You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Classrooms__Lists__Exerc...

10641 lines
452 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(self["webpackChunk"] = self["webpackChunk"] || []).push([[14889,79817],{
/***/ 79924:
/*!*******************************************************************************************************************!*\
!*** ./node_modules/_@ant-design_icons@5.3.4@@ant-design/icons/es/icons/ExclamationCircleOutlined.js + 1 modules ***!
\*******************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ icons_ExclamationCircleOutlined; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.24.0@@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__(36384);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/ExclamationCircleOutlined.js
// This icon file is generated automatically.
var ExclamationCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" } }] }, "name": "exclamation-circle", "theme": "outlined" };
/* harmony default export */ var asn_ExclamationCircleOutlined = (ExclamationCircleOutlined);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.4@@ant-design/icons/es/components/AntdIcon.js + 3 modules
var AntdIcon = __webpack_require__(80109);
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.3.4@@ant-design/icons/es/icons/ExclamationCircleOutlined.js
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
var ExclamationCircleOutlined_ExclamationCircleOutlined = function ExclamationCircleOutlined(props, ref) {
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
ref: ref,
icon: asn_ExclamationCircleOutlined
}));
};
var RefIcon = /*#__PURE__*/_react_17_0_2_react.forwardRef(ExclamationCircleOutlined_ExclamationCircleOutlined);
if (false) {}
/* harmony default export */ var icons_ExclamationCircleOutlined = (RefIcon);
/***/ }),
/***/ 38415:
/*!*********************************************************!*\
!*** ./src/components/MathematicalGraphics/js/index.js ***!
\*********************************************************/
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = (__webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/typeof.js */ 31468)["default"]);
(function () {
if (typeof window.GGBApplet == "function") {
console.warn("deployggb.js was loaded twice");
return;
}
var isRenderGGBElementEnabled = false;
var scriptLoadStarted = false;
var html5AppletsToProcess = null;
var ggbHTML5LoadedCodebaseIsWebSimple = false;
var ggbHTML5LoadedCodebaseVersion = null;
var ggbHTML5LoadedScript = null;
var GGBApplet = function GGBApplet() {
"use strict";
var applet = {};
var ggbVersion = "5.0";
var parameters = {};
var views = null;
var html5NoWebSimple = false;
var html5NoWebSimpleParamExists = false;
var appletID = null;
var initComplete = false;
var html5OverwrittenCodebaseVersion = null;
var html5OverwrittenCodebase = null;
for (var i = 0; i < arguments.length; i++) {
var p = arguments[i];
if (p !== null) {
switch (_typeof(p)) {
case "number":
ggbVersion = p.toFixed(1);
break;
case "string":
if (p.match(new RegExp("^[0-9]\\.[0-9]+$"))) {
ggbVersion = p;
} else {
appletID = p;
}
break;
case "object":
if (typeof p.is3D !== "undefined") {
views = p;
} else {
parameters = p;
}
break;
case "boolean":
html5NoWebSimple = p;
html5NoWebSimpleParamExists = true;
break;
}
}
}
if (views === null) {
views = {
is3D: false,
AV: false,
SV: false,
CV: false,
EV2: false,
CP: false,
PC: false,
DA: false,
FI: false,
PV: false,
macro: false
};
if (parameters.material_id !== undefined && !html5NoWebSimpleParamExists) {
html5NoWebSimple = true;
}
}
if (appletID !== null && parameters.id === undefined) {
parameters.id = appletID;
}
var jnlpFilePath = "";
var html5Codebase = "";
var isHTML5Offline = false;
var loadedAppletType = null;
var html5CodebaseVersion = null;
var html5CodebaseScript = null;
var html5CodebaseIsWebSimple = false;
var previewImagePath = null;
var previewLoadingPath = null;
var previewPlayPath = null;
var fonts_css_url = null;
var jnlpBaseDir = null;
if (parameters.height !== undefined) {
parameters.height = Math.round(parameters.height);
}
if (parameters.width !== undefined) {
parameters.width = Math.round(parameters.width);
}
var parseVersion = function parseVersion(d) {
return parseFloat(d) > 4 ? parseFloat(d) : 5;
};
applet.setHTML5Codebase = function (codebase, offline) {
html5OverwrittenCodebase = codebase;
setHTML5CodebaseInternal(codebase, offline);
};
applet.setJavaCodebase = applet.setJavaCodebaseVersion = applet.isCompiledInstalled = applet.setPreCompiledScriptPath = applet.setPreCompiledResourcePath = function () {};
applet.setHTML5CodebaseVersion = function (version, offline) {
var numVersion = parseFloat(version);
if (numVersion !== NaN && numVersion < 5) {
console.log("The GeoGebra HTML5 codebase version " + numVersion + " is deprecated. Using version latest instead.");
return;
}
html5OverwrittenCodebaseVersion = version;
setDefaultHTML5CodebaseForVersion(version, offline);
};
applet.getHTML5CodebaseVersion = function () {
return html5CodebaseVersion;
};
applet.getParameters = function () {
return parameters;
};
applet.setFontsCSSURL = function (url) {
fonts_css_url = url;
};
applet.setGiacJSURL = function (url) {};
applet.setJNLPFile = function (newJnlpFilePath) {
jnlpFilePath = newJnlpFilePath;
};
applet.setJNLPBaseDir = function (baseDir) {};
applet.inject = function () {
function isOwnIFrame() {
return window.frameElement && window.frameElement.getAttribute("data-singleton");
}
var type = "auto";
var container_ID = parameters.id;
var container;
var noPreview = false;
for (var i = 0; i < arguments.length; i++) {
var p = arguments[i];
if (typeof p === "string") {
p = p.toLowerCase();
if (p.match(/^(prefer)?(java|html5|compiled|auto|screenshot)$/)) {
type = p;
} else {
container_ID = arguments[i];
}
} else if (typeof p === "boolean") {
noPreview = p;
} else if (p instanceof HTMLElement) {
container = p;
}
}
continueInject();
function continueInject() {
if (!initComplete) {
setTimeout(continueInject, 200);
return;
}
type = detectAppletType(type);
var appletElem = container || document.getElementById(container_ID);
if (!appletElem) {
console.log("possibly bug on ajax loading? ");
return;
}
applet.removeExistingApplet(appletElem, false);
if (parameters.width === undefined && appletElem.clientWidth) {
parameters.width = appletElem.clientWidth;
}
if (parameters.height === undefined && appletElem.clientHeight) {
parameters.height = appletElem.clientHeight;
}
if (!(parameters.width && parameters.height) && type === "html5") {
delete parameters.width;
delete parameters.height;
}
loadedAppletType = type;
if (type === "screenshot") {
injectScreenshot(appletElem, parameters);
} else {
var playButton = false;
if (parameters.hasOwnProperty("playButton") && parameters.playButton || parameters.hasOwnProperty("clickToLoad") && parameters.clickToLoad) {
playButton = true;
} else if (parameters.hasOwnProperty("playButtonAutoDecide") && parameters.playButtonAutoDecide) {
playButton = (!isInIframe() || isOwnIFrame()) && isMobileDevice();
}
if (playButton) {
loadedAppletType = "screenshot";
injectPlayButton(appletElem, parameters, noPreview, type);
} else {
injectHTML5Applet(appletElem, parameters, noPreview);
}
}
}
return;
};
function isInIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
function isMobileDevice() {
if (parameters.hasOwnProperty("screenshotGenerator") && parameters.screenshotGenerator) {
return false;
}
return Math.max(screen.width, screen.height) < 800;
}
applet.getViews = function () {
return views;
};
applet.isJavaInstalled = function () {
return false;
};
var fetchParametersFromApi = function fetchParametersFromApi(successCallback) {
var onSuccess = function onSuccess(text) {
var jsonData = JSON.parse(text);
var isGeoGebra = function isGeoGebra(element) {
return element.type == "G" || element.type == "E";
};
var item = jsonData.elements ? jsonData.elements.filter(isGeoGebra)[0] : jsonData;
if (!item || !item.url) {
onError();
return;
}
parameters.fileName = item.url;
updateAppletSettings(item.settings || {});
views.is3D = true;
var imageDir = "https://www.geogebra.org/images/";
applet.setPreviewImage(previewImagePath || item.previewUrl, imageDir + "GeoGebra_loading.png", imageDir + "applet_play.png");
successCallback();
};
var onError = function onError() {
parameters.onError && parameters.onError();
log("Error: Fetching material (id " + parameters.material_id + ") failed.", parameters);
};
var host = location.host.match(/(www|stage|beta|groot|alpha).geogebra.(org|net)/) ? location.host : "www.geogebra.org";
var path = "/materials/" + parameters.material_id + "?scope=basic";
sendCorsRequest("https://" + host + "/api/proxy.php?path=" + encodeURIComponent(path), onSuccess, onError);
};
function updateAppletSettings(settings) {
var parameterNames = ["width", "height", "showToolBar", "showMenuBar", "showAlgebraInput", "allowStyleBar", "showResetIcon", "enableLabelDrags", "enableShiftDragZoom", "enableRightClick", "appName"];
["enableLabelDrags", "enableShiftDragZoom", "enableRightClick"].forEach(function (name) {
settings[name] = !!settings[name];
});
parameterNames.forEach(function (name) {
if (parameters[name] === undefined && settings[name] !== undefined) {
parameters[name] = settings[name];
}
});
if (parameters.showToolBarHelp === undefined) {
parameters.showToolBarHelp = parameters.showToolBar;
}
}
function sendCorsRequest(url, onSuccess, onError) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.onload = function () {
onSuccess(xhr.responseText);
};
xhr.onerror = onError;
xhr.send();
}
applet.isHTML5Installed = function () {
return true;
};
applet.getLoadedAppletType = function () {
return loadedAppletType;
};
applet.setPreviewImage = function (previewFilePath, loadingFilePath, playFilePath) {
previewImagePath = previewFilePath;
previewLoadingPath = loadingFilePath;
previewPlayPath = playFilePath;
};
applet.removeExistingApplet = function (appletParent, showScreenshot) {
var i;
if (typeof appletParent === "string") {
appletParent = document.getElementById(appletParent);
}
loadedAppletType = null;
var removedID = null;
for (i = 0; i < appletParent.childNodes.length; i++) {
var currentChild = appletParent.childNodes[i];
var className = currentChild.className;
if (className === "applet_screenshot") {
if (showScreenshot) {
currentChild.style.display = "block";
loadedAppletType = "screenshot";
} else {
currentChild.style.display = "none";
}
} else if (className !== "applet_scaler prerender") {
appletParent.removeChild(currentChild);
removedID = className && className.indexOf("appletParameters") != -1 ? currentChild.id : null;
i--;
}
}
var appName = parameters.id !== undefined ? parameters.id : removedID;
var app = window[appName];
if (app && typeof app.getBase64 === "function") {
app.remove();
window[appName] = null;
}
};
applet.refreshHitPoints = function () {
if (parseVersion(ggbHTML5LoadedCodebaseVersion) >= 5) {
return true;
}
var app = applet.getAppletObject();
if (app) {
if (typeof app.recalculateEnvironments === "function") {
app.recalculateEnvironments();
return true;
}
}
return false;
};
applet.startAnimation = function () {
var app = applet.getAppletObject();
if (app) {
if (typeof app.startAnimation === "function") {
app.startAnimation();
return true;
}
}
return false;
};
applet.stopAnimation = function () {
var app = applet.getAppletObject();
if (app) {
if (typeof app.stopAnimation === "function") {
app.stopAnimation();
return true;
}
}
return false;
};
applet.getAppletObject = function () {
var appName = parameters.id !== undefined ? parameters.id : "ggbApplet";
return window[appName];
};
applet.resize = function () {};
var appendParam = function appendParam(applet, name, value) {
var param = document.createElement("param");
param.setAttribute("name", name);
param.setAttribute("value", value);
applet.appendChild(param);
};
var valBoolean = function valBoolean(value) {
return value && value !== "false";
};
var injectHTML5Applet = function injectHTML5Applet(appletElem, parameters, noPreview) {
if (parseVersion(html5CodebaseVersion) <= 4.2) {
noPreview = true;
}
var loadScript = !isRenderGGBElementEnabled && !scriptLoadStarted;
if (!isRenderGGBElementEnabled && !scriptLoadStarted || ggbHTML5LoadedCodebaseVersion !== html5CodebaseVersion || ggbHTML5LoadedCodebaseIsWebSimple && !html5CodebaseIsWebSimple) {
loadScript = true;
isRenderGGBElementEnabled = false;
scriptLoadStarted = false;
}
var article = document.createElement("div");
article.classList.add("appletParameters", "notranslate");
var oriWidth = parameters.width;
var oriHeight = parameters.height;
parameters.disableAutoScale = parameters.disableAutoScale === undefined ? GGBAppletUtils.isFlexibleWorksheetEditor() : parameters.disableAutoScale;
if (parameters.width !== undefined) {
if (parseVersion(html5CodebaseVersion) <= 4.4) {
if (valBoolean(parameters.showToolBar)) {
parameters.height -= 7;
}
if (valBoolean(parameters.showAlgebraInput)) {
parameters.height -= 37;
}
if (parameters.width < 605 && valBoolean(parameters.showToolBar)) {
parameters.width = 605;
oriWidth = 605;
}
} else {
var minWidth = 100;
if (valBoolean(parameters.showToolBar) || valBoolean(parameters.showMenuBar)) {
if (parameters.hasOwnProperty("customToolBar")) {
parameters.customToolbar = parameters.customToolBar;
}
minWidth = valBoolean(parameters.showMenuBar) ? 245 : 155;
}
if (oriWidth < minWidth) {
parameters.width = minWidth;
oriWidth = minWidth;
}
}
}
article.style.border = "none";
article.style.display = "inline-block";
for (var key in parameters) {
if (parameters.hasOwnProperty(key) && key !== "appletOnLoad") {
article.setAttribute("data-param-" + key, parameters[key]);
}
}
if (fonts_css_url) {
article.setAttribute("data-param-fontscssurl", fonts_css_url);
}
applet.resize = function () {
GGBAppletUtils.responsiveResize(appletElem, parameters);
};
window.addEventListener("resize", function (evt) {
applet.resize();
});
var oriAppletOnload = typeof parameters.appletOnLoad === "function" ? parameters.appletOnLoad : function () {};
if (!noPreview && parameters.width !== undefined) {
if (!parameters.hasOwnProperty("showSplash")) {
article.setAttribute("data-param-showSplash", "false");
}
var previewPositioner = appletElem.querySelector(".applet_scaler.prerender");
var preRendered = previewPositioner !== null;
if (!preRendered) {
var previewContainer = createScreenShotDiv(oriWidth, oriHeight, parameters.borderColor, false);
previewPositioner = document.createElement("div");
previewPositioner.className = "applet_scaler";
previewPositioner.style.position = "relative";
previewPositioner.style.display = "block";
previewPositioner.style.width = oriWidth + "px";
previewPositioner.style.height = oriHeight + "px";
} else {
var previewContainer = previewPositioner.querySelector(".ggb_preview");
}
if (window.GGBT_spinner) {
window.GGBT_spinner.attachSpinner(previewPositioner, "66%");
}
if (parseVersion(html5CodebaseVersion) >= 5) {
parameters.appletOnLoad = function (api) {
var preview = appletElem.querySelector(".ggb_preview");
if (preview) {
preview.parentNode.removeChild(preview);
}
if (window.GGBT_spinner) {
window.GGBT_spinner.removeSpinner(previewPositioner);
}
if (window.GGBT_wsf_view) {
$(window).trigger("resize");
}
oriAppletOnload(api);
};
if (!preRendered) {
previewPositioner.appendChild(previewContainer);
}
} else {
article.appendChild(previewContainer);
}
previewPositioner.appendChild(article);
if (!preRendered) {
appletElem.appendChild(previewPositioner);
}
setTimeout(function () {
applet.resize();
}, 1);
} else {
var appletScaler = document.createElement("div");
appletScaler.className = "applet_scaler";
appletScaler.style.position = "relative";
appletScaler.style.display = "block";
appletScaler.appendChild(article);
appletElem.appendChild(appletScaler);
parameters.appletOnLoad = function (api) {
applet.resize();
oriAppletOnload(api);
};
}
function renderGGBElementWithParams(article, parameters) {
if (parameters && typeof parameters.appletOnLoad === "function" && typeof renderGGBElement === "function") {
renderGGBElement(article, parameters.appletOnLoad);
} else {
renderGGBElement(article);
}
log("GeoGebra HTML5 applet injected and rendered with previously loaded codebase.", parameters);
}
function renderGGBElementOnTube(a, parameters) {
if (typeof renderGGBElement === "undefined") {
if (html5AppletsToProcess === null) {
html5AppletsToProcess = [];
}
html5AppletsToProcess.push({
article: a,
params: parameters
});
window.renderGGBElementReady = function () {
isRenderGGBElementEnabled = true;
if (html5AppletsToProcess !== null && html5AppletsToProcess.length) {
html5AppletsToProcess.forEach(function (obj) {
renderGGBElementWithParams(obj.article, obj.params);
});
html5AppletsToProcess = null;
}
};
if (parseVersion(html5CodebaseVersion) < 5) {
a.className += " geogebraweb";
}
} else {
renderGGBElementWithParams(a, parameters);
}
}
if (loadScript) {
scriptLoadStarted = true;
for (var i = 0; i < article.childNodes.length; i++) {
var tag = article.childNodes[i].tagName;
if (tag === "TABLE") {
article.removeChild(article.childNodes[i]);
i--;
}
}
if (ggbHTML5LoadedScript !== null) {
var el = document.querySelector('script[src="' + ggbHTML5LoadedScript + '"]');
if (el !== undefined && el !== null) {
el.parentNode.removeChild(el);
}
}
var script = document.createElement("script");
var scriptLoaded = function scriptLoaded() {
renderGGBElementOnTube(article, parameters);
};
script.src = html5Codebase + html5CodebaseScript;
ggbHTML5LoadedCodebaseIsWebSimple = html5CodebaseIsWebSimple;
ggbHTML5LoadedCodebaseVersion = html5CodebaseVersion;
ggbHTML5LoadedScript = script.src;
log("GeoGebra HTML5 codebase loaded: '" + html5Codebase + "'.", parameters);
if (!html5OverwrittenCodebase && (!html5OverwrittenCodebaseVersion || html5OverwrittenCodebaseVersion == "5.0")) {
if (html5CodebaseIsWebSimple) {
webSimple.succeeded = webSimple.succeeded || webSimple();
} else {
web3d.succeeded = web3d.succeeded || web3d();
}
scriptLoaded();
} else if (html5Codebase.requirejs) {
__webpack_require__.e(/*! AMD require */ 73644).then(function() { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(/*! ./web3d */ 73644)]; (scriptLoaded).apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);}.bind(this))['catch'](__webpack_require__.oe);
} else {
script.onload = scriptLoaded;
appletElem.appendChild(script);
}
} else {
renderGGBElementOnTube(article, parameters);
}
parameters.height = oriHeight;
parameters.width = oriWidth;
};
var injectScreenshot = function injectScreenshot(appletElem, parameters, showPlayButton) {
var previewContainer = createScreenShotDiv(parameters.width, parameters.height, parameters.borderColor, showPlayButton);
var previewPositioner = document.createElement("div");
previewPositioner.style.position = "relative";
previewPositioner.style.display = "block";
previewPositioner.style.width = parameters.width + "px";
previewPositioner.style.height = parameters.height + "px";
previewPositioner.className = "applet_screenshot applet_scaler" + (showPlayButton ? " applet_screenshot_play" : "");
previewPositioner.appendChild(previewContainer);
var scale = GGBAppletUtils.getScale(parameters, appletElem, showPlayButton);
if (showPlayButton) {
appletElem.appendChild(getPlayButton());
if (!window.GGBT_wsf_view) {
appletElem.style.position = "relative";
}
} else if (window.GGBT_spinner) {
window.GGBT_spinner.attachSpinner(previewPositioner, "66%");
}
appletElem.appendChild(previewPositioner);
if (scale !== 1 && !isNaN(scale)) {
GGBAppletUtils.scaleElement(previewPositioner, scale);
previewPositioner.style.width = parameters.width + "px";
previewPositioner.style.height = parameters.height + "px";
previewPositioner.parentNode.style.width = parameters.width * scale + "px";
previewPositioner.parentNode.style.height = parameters.height * scale + "px";
}
applet.resize = function () {
resizeScreenshot(appletElem, previewContainer, previewPositioner, showPlayButton);
};
window.addEventListener("resize", function (evt) {
applet.resize();
});
applet.resize();
};
function resizeScreenshot(appletElem, previewContainer, previewPositioner, showPlayButton) {
if (!appletElem.contains(previewContainer)) {
return;
}
if (_typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
if (appletElem.id !== "fullscreencontent") {
return;
}
window.GGBT_wsf_view.setCloseBtnPosition(appletElem);
}
var scale = GGBAppletUtils.getScale(parameters, appletElem, showPlayButton);
if (previewPositioner.parentNode !== null) {
if (!isNaN(scale) && scale !== 1) {
GGBAppletUtils.scaleElement(previewPositioner, scale);
previewPositioner.parentNode.style.width = parameters.width * scale + "px";
previewPositioner.parentNode.style.height = parameters.height * scale + "px";
} else {
GGBAppletUtils.scaleElement(previewPositioner, 1);
previewPositioner.parentNode.style.width = parameters.width + "px";
previewPositioner.parentNode.style.height = parameters.height + "px";
}
}
if (_typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
GGBAppletUtils.positionCenter(appletElem);
}
if (_typeof(window.GGBT_ws_header_footer) === "object") {
window.GGBT_ws_header_footer.setWsScrollerHeight();
}
}
applet.onExitFullscreen = function (fullscreenContainer, appletElem) {
appletElem.appendChild(fullscreenContainer);
};
var injectPlayButton = function injectPlayButton(appletElem, parameters, noPreview, type) {
injectScreenshot(appletElem, parameters, true);
var play = function play() {
var elems = [];
for (i = 0; i < appletElem.childNodes.length; i++) {
elems.push(appletElem.childNodes[i]);
}
if (window.GGBT_wsf_view) {
var content = window.GGBT_wsf_view.renderFullScreen(appletElem, parameters.id);
var container = document.getElementById("fullscreencontainer");
var oldcontent = jQuery(appletElem).find(".fullscreencontent");
if (oldcontent.length > 0) {
content.remove();
oldcontent.attr("id", "fullscreencontent").show();
jQuery(container).append(oldcontent);
window.dispatchEvent(new Event("resize"));
} else {
injectHTML5Applet(content, parameters, false);
}
window.GGBT_wsf_view.launchFullScreen(container);
} else {
loadedAppletType = type;
injectHTML5Applet(appletElem, parameters, false);
}
if (!window.GGBT_wsf_view) {
for (i = 0; i < elems.length; i++) {
appletElem.removeChild(elems[i]);
}
}
};
var imgs = appletElem.getElementsByClassName("ggb_preview_play");
for (var i = 0; i < imgs.length; i++) {
imgs[i].addEventListener("click", play, false);
imgs[i].addEventListener("ontouchstart", play, false);
}
if (typeof window.ggbAppletPlayerOnload === "function") {
window.ggbAppletPlayerOnload(appletElem);
}
if (isMobileDevice() && window.GGBT_wsf_view) {
$(".wsf-element-fullscreen-button").remove();
}
};
var getPlayButton = function getPlayButton() {
var playButtonContainer = document.createElement("div");
playButtonContainer.className = "ggb_preview_play icon-applet-play";
if (!window.GGBT_wsf_view) {
var css = "" + ".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");' + "}";
var style = document.createElement("style");
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
document.getElementsByTagName("head")[0].appendChild(style);
}
return playButtonContainer;
};
var createScreenShotDiv = function createScreenShotDiv(oriWidth, oriHeight, borderColor, showPlayButton) {
var previewContainer = document.createElement("div");
previewContainer.className = "ggb_preview";
previewContainer.style.position = "absolute";
previewContainer.style.zIndex = "90";
previewContainer.style.width = oriWidth - 2 + "px";
previewContainer.style.height = oriHeight - 2 + "px";
previewContainer.style.top = "0px";
previewContainer.style.left = "0px";
previewContainer.style.overflow = "hidden";
previewContainer.style.backgroundColor = "white";
var bc = "lightgrey";
if (borderColor !== undefined) {
if (borderColor === "none") {
bc = "transparent";
} else {
bc = borderColor;
}
}
previewContainer.style.border = "1px solid " + bc;
var preview = document.createElement("img");
preview.style.position = "relative";
preview.style.zIndex = "1000";
preview.style.top = "-1px";
preview.style.left = "-1px";
if (previewImagePath !== null) {
preview.setAttribute("src", previewImagePath);
}
preview.style.opacity = .7;
if (previewLoadingPath !== null) {
var previewOverlay;
var pWidth, pHeight;
if (!showPlayButton) {
previewOverlay = document.createElement("img");
previewOverlay.style.position = "absolute";
previewOverlay.style.zIndex = "1001";
previewOverlay.style.opacity = 1;
preview.style.opacity = .3;
pWidth = 360;
if (pWidth > oriWidth / 4 * 3) {
pWidth = oriWidth / 4 * 3;
}
pHeight = pWidth / 5.8;
previewOverlay.setAttribute("src", previewLoadingPath);
previewOverlay.setAttribute("width", pWidth);
previewOverlay.setAttribute("height", pHeight);
var pX = (oriWidth - pWidth) / 2;
var pY = (oriHeight - pHeight) / 2;
previewOverlay.style.left = pX + "px";
previewOverlay.style.top = pY + "px";
previewContainer.appendChild(previewOverlay);
}
}
previewContainer.appendChild(preview);
return previewContainer;
};
var detectAppletType = function detectAppletType(preferredType) {
preferredType = preferredType.toLowerCase();
if (preferredType === "html5" || preferredType === "screenshot") {
return preferredType;
}
return "html5";
};
var modules = ["web", "webSimple", "web3d", "tablet", "tablet3d", "phone"];
var setDefaultHTML5CodebaseForVersion = function setDefaultHTML5CodebaseForVersion(version, offline) {
html5CodebaseVersion = version;
if (offline) {
setHTML5CodebaseInternal(html5CodebaseVersion, true);
return;
}
var hasWebSimple = !html5NoWebSimple;
if (hasWebSimple) {
var v = parseVersion(html5CodebaseVersion);
if (!isNaN(v) && v < 4.4) {
hasWebSimple = false;
}
}
var protocol, codebase;
if (window.location.protocol.substr(0, 4) === "http") {
protocol = window.location.protocol;
} else {
protocol = "http:";
}
var index = html5CodebaseVersion.indexOf("//");
if (index > 0) {
codebase = html5CodebaseVersion;
} else if (index === 0) {
codebase = protocol + html5CodebaseVersion;
} else {
codebase = "https://www.geogebra.org/apps/5.2.814.0/";
}
for (var key in modules) {
if (html5CodebaseVersion.slice(modules[key].length * -1) === modules[key] || html5CodebaseVersion.slice((modules[key].length + 1) * -1) === modules[key] + "/") {
setHTML5CodebaseInternal(codebase, false);
return;
}
}
if (!GGBAppletUtils.isFlexibleWorksheetEditor() && hasWebSimple && !views.is3D && !views.AV && !views.SV && !views.CV && !views.EV2 && !views.CP && !views.PC && !views.DA && !views.FI && !views.PV && !valBoolean(parameters.showToolBar) && !valBoolean(parameters.showMenuBar) && !valBoolean(parameters.showAlgebraInput) && !valBoolean(parameters.enableRightClick) && (!parameters.appName || parameters.appName == "classic")) {
codebase += "webSimple/";
} else {
codebase += "web3d/";
}
setHTML5CodebaseInternal(codebase, false);
};
var setHTML5CodebaseInternal = function setHTML5CodebaseInternal(codebase, offline) {
if (codebase.requirejs) {
html5Codebase = codebase;
return;
}
if (codebase.slice(-1) !== "/") {
codebase += "/";
}
html5Codebase = codebase;
if (offline === null) {
offline = codebase.indexOf("http") === -1;
}
isHTML5Offline = offline;
html5CodebaseScript = "web.nocache.js";
html5CodebaseIsWebSimple = false;
var folders = html5Codebase.split("/");
if (folders.length > 1) {
if (!offline && folders[folders.length - 2] === "webSimple") {
html5CodebaseScript = "webSimple.nocache.js";
html5CodebaseIsWebSimple = true;
} else if (modules.indexOf(folders[folders.length - 2]) >= 0) {
html5CodebaseScript = folders[folders.length - 2] + ".nocache.js";
}
}
folders = codebase.split("/");
html5CodebaseVersion = folders[folders.length - 3];
if (html5CodebaseVersion.substr(0, 4) === "test") {
html5CodebaseVersion = html5CodebaseVersion.substr(4, 1) + "." + html5CodebaseVersion.substr(5, 1);
} else if (html5CodebaseVersion.substr(0, 3) === "war" || html5CodebaseVersion.substr(0, 4) === "beta") {
html5CodebaseVersion = "5.0";
}
var numVersion = parseFloat(html5CodebaseVersion);
if (numVersion !== NaN && numVersion < 5 && codebase.indexOf("geogebra.org") >= 0) {
console.log("The GeoGebra HTML5 codebase version " + numVersion + " is deprecated. Using version latest instead.");
setDefaultHTML5CodebaseForVersion("5.0", offline);
}
};
var log = function log(text, parameters) {
if (window.console && window.console.log) {
if (!parameters || typeof parameters.showLogging === "undefined" || parameters.showLogging && parameters.showLogging !== "false") {
console.log(text);
}
}
};
if (parameters.material_id !== undefined) {
fetchParametersFromApi(continueInit);
} else {
continueInit();
}
function continueInit() {
var html5Version = ggbVersion;
if (html5OverwrittenCodebaseVersion !== null) {
html5Version = html5OverwrittenCodebaseVersion;
} else {
if (parseFloat(html5Version) < 5) {
html5Version = "5.0";
}
}
setDefaultHTML5CodebaseForVersion(html5Version, false);
if (html5OverwrittenCodebase !== null) {
setHTML5CodebaseInternal(html5OverwrittenCodebase, isHTML5Offline);
}
initComplete = true;
}
return applet;
};
var GGBAppletUtils = function () {
"use strict";
function isFlexibleWorksheetEditor() {
return window.GGBT_wsf_edit !== undefined;
}
function scaleElement(el, scale) {
if (scale != 1) {
el.style.transformOrigin = "0% 0% 0px";
el.style.webkitTransformOrigin = "0% 0% 0px";
el.style.transform = "scale(" + scale + "," + scale + ")";
el.style.webkitTransform = "scale(" + scale + "," + scale + ")";
el.style.maxWidth = "initial";
if (el.querySelector(".ggb_preview") !== null) {
el.querySelector(".ggb_preview").style.maxWidth = "initial";
}
if (el.querySelectorAll(".ggb_preview img")[0] !== undefined) {
el.querySelectorAll(".ggb_preview img")[0].style.maxWidth = "initial";
}
if (el.querySelectorAll(".ggb_preview img")[1] !== undefined) {
el.querySelectorAll(".ggb_preview img")[1].style.maxWidth = "initial";
}
} else {
el.style.transform = "none";
el.style.webkitTransform = "none";
}
}
function getWidthHeight(appletElem, appletWidth, allowUpscale, autoHeight, noBorder, scaleContainerClass) {
var container = null;
if (scaleContainerClass != undefined && scaleContainerClass != "") {
var parent = appletElem.parentNode;
while (parent != null) {
if ((" " + parent.className + " ").indexOf(" " + scaleContainerClass + " ") > -1) {
container = parent;
break;
} else {
parent = parent.parentNode;
}
}
}
var myWidth = 0,
myHeight = 0,
windowWidth = 0,
border = 0,
borderRight = 0,
borderLeft = 0,
borderTop = 0;
if (container) {
myWidth = container.offsetWidth;
myHeight = Math.max(autoHeight ? container.offsetWidth : 0, container.offsetHeight);
} else {
if (window.innerWidth && document.documentElement.clientWidth) {
myWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
myHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
windowWidth = myWidth;
} else {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
windowWidth = window.innerWidth;
}
if (appletElem) {
var rect = appletElem.getBoundingClientRect();
if (rect.left > 0) {
if (rect.left <= myWidth && (noBorder === undefined || !noBorder)) {
if (document.dir === "rtl") {
borderRight = myWidth - rect.width - rect.left;
borderLeft = windowWidth <= 480 ? 10 : 30;
} else {
borderLeft = rect.left;
borderRight = windowWidth <= 480 ? 10 : 30;
}
border = borderLeft + borderRight;
}
}
}
if (appletElem && _typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
var appletRect = appletElem.getBoundingClientRect();
if (window.GGBT_wsf_view.getCloseBtnPosition() === "closePositionRight") {
border = 40;
borderTop = 0;
} else if (window.GGBT_wsf_view.getCloseBtnPosition() === "closePositionTop") {
border = 0;
borderTop = 40;
}
}
}
if (appletElem) {
if ((allowUpscale === undefined || !allowUpscale) && appletWidth > 0 && appletWidth + border < myWidth) {
myWidth = appletWidth;
} else {
myWidth -= border;
}
if (_typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen() && (allowUpscale === undefined || !allowUpscale)) {
myHeight -= borderTop;
}
}
return {
width: myWidth,
height: myHeight
};
}
function calcScale(parameters, appletElem, allowUpscale, showPlayButton, scaleContainerClass) {
if (parameters.isScreenshoGenerator) {
return 1;
}
var ignoreHeight = showPlayButton !== undefined && showPlayButton;
var noScaleMargin = parameters.noScaleMargin != undefined && parameters.noScaleMargin;
var valBoolean = function valBoolean(value) {
return value && value !== "false";
};
var autoHeight = valBoolean(parameters.autoHeight);
var windowSize = getWidthHeight(appletElem, parameters.width, allowUpscale, autoHeight, ignoreHeight && window.GGBT_wsf_view || noScaleMargin, scaleContainerClass);
var windowWidth = parseInt(windowSize.width);
var appletWidth = parameters.width;
var appletHeight = parameters.height;
if (appletWidth === undefined) {
var article = appletElem.querySelector(".appletParameters");
if (article) {
appletWidth = article.offsetWidth;
appletHeight = article.offsetHeight;
}
}
var xscale = windowWidth / appletWidth;
var yscale = ignoreHeight ? 1 : windowSize.height / appletHeight;
if (allowUpscale !== undefined && !allowUpscale) {
xscale = Math.min(1, xscale);
yscale = Math.min(1, yscale);
}
return Math.min(xscale, yscale);
}
function getScale(parameters, appletElem, showPlayButton) {
var scale = 1,
autoScale,
allowUpscale = false;
if (parameters.hasOwnProperty("allowUpscale")) {
allowUpscale = parameters.allowUpscale;
}
if (parameters.hasOwnProperty("scale")) {
scale = parseFloat(parameters.scale);
if (isNaN(scale) || scale === null || scale === 0) {
scale = 1;
}
if (scale > 1) {
allowUpscale = true;
}
}
if (appletElem && _typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
allowUpscale = true;
}
if (!(parameters.hasOwnProperty("disableAutoScale") && parameters.disableAutoScale)) {
autoScale = calcScale(parameters, appletElem, allowUpscale, showPlayButton, parameters.scaleContainerClass);
} else {
return scale;
}
if (allowUpscale && (!parameters.hasOwnProperty("scale") || scale === 1)) {
return autoScale;
} else {
return Math.min(scale, autoScale);
}
}
function positionCenter(appletElem) {
var windowWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
var windowHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
var appletRect = appletElem.getBoundingClientRect();
var calcHorizontalBorder = (windowWidth - appletRect.width) / 2;
var calcVerticalBorder = (windowHeight - appletRect.height) / 2;
if (calcVerticalBorder < 0) {
calcVerticalBorder = 0;
}
appletElem.style.position = "relative";
if (window.GGBT_wsf_view.getCloseBtnPosition() === "closePositionRight") {
if (calcHorizontalBorder < 40) {
appletElem.style.left = "40px";
} else {
appletElem.style.left = calcHorizontalBorder + "px";
}
appletElem.style.top = calcVerticalBorder + "px";
} else if (window.GGBT_wsf_view.getCloseBtnPosition() === "closePositionTop") {
if (calcVerticalBorder < 40) {
appletElem.style.top = "40px";
} else {
appletElem.style.top = calcVerticalBorder + "px";
}
appletElem.style.left = calcHorizontalBorder + "px";
}
}
function responsiveResize(appletElem, parameters) {
var article = appletElem.querySelector(".appletParameters");
if (article) {
if (_typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
if (parameters.id !== article.getAttribute("data-param-id")) {
return;
}
window.GGBT_wsf_view.setCloseBtnPosition(appletElem);
}
if (article.parentElement && /fullscreen/.test(article.parentElement.className)) {
return;
}
var scale = getScale(parameters, appletElem);
if (isFlexibleWorksheetEditor()) {
article.setAttribute("data-param-scale", scale);
}
var scaleElem = null;
for (var i = 0; i < appletElem.childNodes.length; i++) {
if (appletElem.childNodes[i].className !== undefined && appletElem.childNodes[i].className.match(/^applet_scaler/)) {
scaleElem = appletElem.childNodes[i];
break;
}
}
if (scaleElem !== null && scaleElem.querySelector(".noscale") !== null) {
return;
}
var appName = parameters.id !== undefined ? parameters.id : "ggbApplet";
var app = window[appName];
if ((app == null || !app.recalculateEnvironments) && scaleElem !== null && !scaleElem.className.match(/fullscreen/)) {
scaleElem.parentNode.style.transform = "";
if (!isNaN(scale) && scale !== 1) {
scaleElem.parentNode.style.width = parameters.width * scale + "px";
scaleElem.parentNode.style.height = parameters.height * scale + "px";
scaleElement(scaleElem, scale);
} else {
scaleElement(scaleElem, 1);
scaleElem.parentNode.style.width = parameters.width + "px";
scaleElem.parentNode.style.height = parameters.height + "px";
}
}
if (_typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
positionCenter(appletElem);
}
if (window.GGBT_wsf_view && !window.GGBT_wsf_view.isFullscreen()) {
window.GGBT_wsf_general.adjustContentToResize($(article).parents(".content-added-content"));
}
}
}
return {
responsiveResize: responsiveResize,
isFlexibleWorksheetEditor: isFlexibleWorksheetEditor,
positionCenter: positionCenter,
getScale: getScale,
scaleElement: scaleElement
};
}();
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return GGBApplet;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (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";
var n = window;
var o = document;
q(H, I);
function p() {
var a = n.location.search;
return a.indexOf(J) != -1 || a.indexOf(K) != -1;
}
function q(a, b) {}
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 false;
};
webModule.__gwt_getMetaProperty = function () {
return null;
};
var r = null;
var s = n.__gwt_activeModules = n.__gwt_activeModules || {};
s[L] = {
moduleName: L
};
webModule.__moduleStartupDone = function (e) {
var f = s[L].bindings;
s[L].bindings = function () {
var a = f ? f() : {};
var b = e[webModule.__softPermutationId];
for (var c = O; c < b.length; c++) {
var d = b[c];
a[d[O]] = d[P];
}
return a;
};
};
var t;
function u() {
v();
return t;
}
function v() {
if (t) {
return;
}
var a = o.createElement(Q);
a.id = L;
a.style.cssText = R + S;
a.tabIndex = -1;
o.body.appendChild(a);
t = a.contentWindow.document;
if (navigator.userAgent.indexOf(T) == -1) {
t.open();
var b = document.compatMode == U ? V : W;
t.write(b + X);
t.close();
}
}
function w(f) {
function g(a) {
function b() {
if (_typeof(o.readyState) == Y) {
return _typeof(o.body) != Y && o.body != null;
}
return /loaded|complete/.test(o.readyState);
}
var c = b();
if (c) {
a();
return;
}
function d() {
if (!c) {
if (!b()) {
return;
}
c = true;
a();
if (o.removeEventListener) {
o.removeEventListener(Z, d, false);
}
if (e) {
clearInterval(e);
}
}
}
if (o.addEventListener) {
o.addEventListener(Z, d, false);
}
var e = setInterval(function () {
d();
}, $);
}
function h(a) {
var b = u();
var c = b.body;
var d = b.createElement(_);
d.language = ab;
d.crossOrigin = W;
d.src = a;
if (webModule.__errFn) {
d.onerror = function () {
webModule.__errFn(L, new Error(bb + a));
};
}
c.appendChild(d);
q(cb, db);
}
q(cb, eb);
g(function () {
h(f);
});
}
webModule.__startLoadingFragment = function (a) {
return C(a);
};
webModule.__installRunAsyncCode = function (a) {
var b = u();
var c = b.body;
var d = b.createElement(_);
d.language = ab;
d.text = a;
c.appendChild(d);
c.removeChild(d);
};
function A() {
var c = {};
var d;
var e;
var f = o.getElementsByTagName(fb);
for (var g = O, h = f.length; g < h; ++g) {
var i = f[g],
j = i.getAttribute(gb),
k;
if (j) {
j = j.replace(hb, W);
if (j.indexOf(ib) >= O) {
continue;
}
if (j == jb) {
k = i.getAttribute(kb);
if (k) {
var l,
m = k.indexOf(lb);
if (m >= O) {
j = k.substring(O, m);
l = k.substring(m + P);
} else {
j = k;
l = W;
}
c[j] = l;
}
} else if (j == mb) {
k = i.getAttribute(kb);
if (k) {
try {
d = eval(k);
} catch (a) {
alert(nb + k + ob);
}
}
} else if (j == pb) {
k = i.getAttribute(kb);
if (k) {
try {
e = eval(k);
} catch (a) {
alert(nb + k + qb);
}
}
}
}
}
__gwt_getMetaProperty = function __gwt_getMetaProperty(a) {
var b = c[a];
return b == null ? null : b;
};
r = d;
webModule.__errFn = e;
}
function B() {
function e(a) {
var b = a.lastIndexOf(rb);
if (b == -1) {
b = a.length;
}
var c = a.indexOf(sb);
if (c == -1) {
c = a.length;
}
var d = a.lastIndexOf(tb, Math.min(c, b));
return d >= O ? a.substring(O, d + P) : W;
}
function f(a) {
if (a.match(/^\w+:\/\//)) {} else {
var b = o.createElement(ub);
b.src = a + vb;
a = e(b.src);
}
return a;
}
function g() {
var a = __gwt_getMetaProperty(wb);
if (a != null) {
return a;
}
return W;
}
function h() {
var a = o.getElementsByTagName(_);
for (var b = O; b < a.length; ++b) {
if (a[b].src.indexOf(xb) != -1) {
return e(a[b].src);
}
}
return W;
}
function i() {
var a = o.getElementsByTagName(yb);
if (a.length > O) {
return a[a.length - P].href;
}
return W;
}
function j() {
var a = o.location;
return a.href == a.protocol + zb + a.host + a.pathname + a.search + a.hash;
}
var k = g();
if (k == W) {
k = h();
}
if (k == W) {
k = i();
}
if (k == W && j()) {
k = e(o.location.href);
}
k = f(k);
return k;
}
function C(a) {
if (a.match(/^\//)) {
return a;
}
if (a.match(/^[a-zA-Z]+:\/\//)) {
return a;
}
return webModule.__moduleBase + a;
}
function D() {
var f = [];
var g = O;
var h = [];
var i = [];
function j(a) {
var b = i[a](),
c = h[a];
if (b in c) {
return b;
}
var d = [];
for (var e in c) {
d[c[e]] = e;
}
if (r) {
r(a, d, b);
}
throw null;
}
__gwt_isKnownPropertyValue = function __gwt_isKnownPropertyValue(a, b) {
return b in h[a];
};
webModule.__getPropMap = function () {
var a = {};
for (var b in h) {
if (h.hasOwnProperty(b)) {
a[b] = j(b);
}
}
return a;
};
webModule.__computePropValue = j;
n.__gwt_activeModules[L].bindings = webModule.__getPropMap;
if (p()) {
return C(Bb);
}
var k;
try {
k = Cb;
var l = k.indexOf(Db);
if (l != -1) {
g = parseInt(k.substring(l + P), $);
k = k.substring(O, l);
}
} catch (a) {}
webModule.__softPermutationId = g;
return C(k + Eb);
}
function F() {
if (!n.__gwt_stylesLoaded) {
n.__gwt_stylesLoaded = {};
}
}
A();
webModule.__moduleBase = "/js/mathematicalGraphics/" + name + "/";
s[L].moduleBase = webModule.__moduleBase;
var G = D();
F();
w(G);
return true;
}
return webModule;
};
if (typeof window.web3d !== "function") {
window.web3d = GGBAppletUtils.makeModule("web3d", "A18F540516513B1292CA7CEF2F6AFC7E");
}
if (typeof window.webSimple !== "function") {
window.webSimple = GGBAppletUtils.makeModule("webSimple", "96B09BF1B436BF53F0DF54116700F16A");
}
window.GGBApplet = GGBApplet;
})();
/***/ }),
/***/ 78436:
/*!*********************************!*\
!*** ./src/pages/tasks/util.js ***!
\*********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Ax: function() { return /* binding */ processTreeData; },
/* harmony export */ Ds: function() { return /* binding */ debounce; },
/* harmony export */ KI: function() { return /* binding */ apiPref; },
/* harmony export */ SI: function() { return /* binding */ getTreeData; },
/* harmony export */ f1: function() { return /* binding */ isCompileOk; }
/* harmony export */ });
/* unused harmony export isProd */
/* harmony import */ var _utils_env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/env */ 33259);
function isCompileOk(rs) {
var flag = true;
if (rs.length > 0) {
for (var i = 0; i < rs.length; i++) {
if (rs[i].compile_success == 0 || !rs[i].compile_success) {
flag = false;
break;
}
}
} else {
flag = false;
}
return flag;
}
function getTreeData(data) {
var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var result = [];
for (var i = 0; i < data.length; i++) {
var item = data[i];
var key = parentKey ? "".concat(parentKey, "/").concat(item.name) : "".concat(item.name);
result.push({
title: item.name,
isLeaf: item.type === 'tree' ? false : true,
key: key
});
}
return result;
}
function processTreeData(repos, key, newData) {
for (var i = 0; i < repos.length; i++) {
var item = repos[i];
if (item.key === key) {
item.children = newData;
break;
}
if (item.children) {
processTreeData(item.children, key, newData);
}
}
return repos;
}
function debounce(func, wait, immediate) {
var timeout;
return function () {
var context = this,
args = arguments;
var later = function later() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}
var isProd = true;
var apiPref = _utils_env__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.API_SERVER;
// export const isProd =
// window.location.href.indexOf('test-') > 0 ||
// window.location.href.indexOf('localhost') > 0
// ? false
// : true;
// export const apiPref = isProd
// ? 'https://www.educoder.net'
// : 'https://test-newweb.educoder.net';
/***/ }),
/***/ 8179:
/*!**************************************************************!*\
!*** ./src/components/ImageDimensions/index.tsx + 1 modules ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ components_ImageDimensions; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./src/components/ImageDimensions/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var ImageDimensionsmodules = ({"imageDimensions":"imageDimensions___a7crR","img":"img___Kroat","fullWidth":"fullWidth___c492T"});
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
var _classnames_2_5_1_classnames = __webpack_require__(92310);
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
var spin = __webpack_require__(71418);
// EXTERNAL MODULE: ./node_modules/_markerjs3@2.29.1@markerjs3/markerjs2.esm.js
var markerjs2_esm = __webpack_require__(2859);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(14735);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(63834);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/components/ImageDimensions/index.tsx
var ImageDimensions = function ImageDimensions(_ref) {
var data = _ref.data,
className = _ref.className,
fullWidth = _ref.fullWidth,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
onClose = _ref.onClose,
onOk = _ref.onOk,
showFullTools = _ref.showFullTools,
noAssociationId = _ref.noAssociationId;
var imgRef = (0,_react_17_0_2_react.useRef)(null);
var markerArea = (0,_react_17_0_2_react.useRef)(null);
var _useState = (0,_react_17_0_2_react.useState)(false),
_useState2 = slicedToArray_default()(_useState, 2),
loading = _useState2[0],
setLoading = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)('正在加载中'),
_useState4 = slicedToArray_default()(_useState3, 2),
loadingText = _useState4[0],
setLoadingText = _useState4[1];
(0,_react_17_0_2_react.useEffect)(function () {
if (data !== null && data !== void 0 && data.visible) {
document.body.setAttribute('data-custom', 'y-hidden');
} else {
document.body.removeAttribute('data-custom');
}
if (data !== null && data !== void 0 && data.src) {
getImg();
}
}, [data === null || data === void 0 ? void 0 : data.visible]);
var getImg = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
setLoading(true);
setLoadingText('正在加载中');
_context.next = 4;
return (0,util/* toDataUrl */.ZJ)(data === null || data === void 0 ? void 0 : data.src);
case 4:
res = _context.sent;
imgRef.current.src = "";
imgRef.current.src = res;
imgRef.current.onload = function () {
initMarkerjs();
};
setLoading(false);
setLoadingText('');
case 10:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getImg() {
return _ref2.apply(this, arguments);
};
}();
var onSave = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(event) {
var res, result;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
setLoading(true);
setLoadingText('正在保存中');
_context2.next = 4;
return (0,fetch/* default */.ZP)('/api/attachments.json', {
method: 'post',
body: {
file_type: 'base64',
original_filename: data.title,
file: event.dataUrl
}
});
case 4:
res = _context2.sent;
if (!(res !== null && res !== void 0 && res.id && !noAssociationId)) {
_context2.next = 12;
break;
}
_context2.next = 8;
return (0,fetch/* default */.ZP)("/api/attachments/".concat(data.id, "/add_subitem.json"), {
method: 'post',
body: {
subitem_id: res === null || res === void 0 ? void 0 : res.id,
settings: JSON.stringify(event.state)
}
});
case 8:
result = _context2.sent;
if (result.status === 0) {
onOk();
}
_context2.next = 13;
break;
case 12:
if (res !== null && res !== void 0 && res.id) {
onOk(res);
}
case 13:
setLoading(false);
setLoadingText('');
case 15:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function onSave(_x) {
return _ref3.apply(this, arguments);
};
}();
var dealDom = function dealDom() {
// 删除标签
// 找到href为"https://markerjs.com/"的a标签
var targetLink = document.querySelector('a[href="https://markerjs.com/"]');
if (targetLink && targetLink.parentNode) {
targetLink.parentNode.style.display = 'none';
}
// 设置title
var item = [{
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: '退出'
}];
item.forEach(function (e) {
var targetElement = document.querySelector(e.name);
if (targetElement) {
targetElement.setAttribute('title', e.title);
}
});
};
var initMarkerjs = function initMarkerjs() {
markerArea.current = new markerjs2_esm/* MarkerArea */.hP(imgRef.current);
markerArea.current.addEventListener('render', onSave);
markerArea.current.addEventListener('beforeclose', onClose);
if (showFullTools) {
markerArea.current.availableMarkerTypes = markerArea.current.ALL_MARKER_TYPES;
markerArea.current.uiStyleSettings.redoButtonVisible = true;
markerArea.current.uiStyleSettings.notesButtonVisible = true;
markerArea.current.uiStyleSettings.zoomButtonVisible = true;
markerArea.current.uiStyleSettings.zoomOutButtonVisible = true;
markerArea.current.uiStyleSettings.clearButtonVisible = true;
}
window.markerArea = markerArea.current.uiStyleSettings;
markerArea.current.show();
if (data !== null && data !== void 0 && data.snapshotData) {
markerArea.current.restoreState(data.snapshotData);
}
setTimeout(function () {
dealDom();
}, 300);
};
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
children: (data === null || data === void 0 ? void 0 : data.visible) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: _classnames_2_5_1_classnames_default()(ImageDimensionsmodules.imageDimensions, className, fullWidth ? ImageDimensionsmodules.fullWidth : ""),
style: style,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(spin/* default */.Z, {
spinning: loading,
tip: loadingText,
style: {
position: 'absolute'
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
className: ImageDimensionsmodules.img,
ref: imgRef
// crossOrigin='anonymous'
// src={data?.src}
})]
})
});
};
/* harmony default export */ var components_ImageDimensions = (ImageDimensions);
/***/ }),
/***/ 83868:
/*!*****************************************************!*\
!*** ./src/components/MathsLatexKeybords/index.tsx ***!
\*****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.less?modules */ 67373);
/* harmony import */ var mathlatex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! mathlatex */ 48136);
/* harmony import */ var _keybords__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./keybords */ 59277);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd */ 43418);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
var MathsLatex = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (_ref, ref) {
var callback = _ref.callback,
width = _ref.width,
onChange = _ref.onChange,
disabled = _ref.disabled,
readOnly = _ref.readOnly,
_ref$type = _ref.type,
type = _ref$type === void 0 ? "" : _ref$type,
_ref$value = _ref.value,
value = _ref$value === void 0 ? "" : _ref$value;
var GraphicsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
var KeybordsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
var getData = function getData() {
var dom = document.createElement("div");
dom.innerHTML = GraphicsRef.current.getValue();
var str = dom.innerText;
callback && callback(str);
return str;
};
(0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(ref, function () {
return {
getData: getData
};
});
var showInput = function showInput() {
if (disabled || readOnly) return;
antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z.confirm({
content: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_keybords__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
value: value,
ref: KeybordsRef,
onChange: onChange,
showSaveButton: false
}),
width: 860,
icon: null,
title: "输入LATEX公式",
onOk: function onOk() {
var val = KeybordsRef.current.getData();
GraphicsRef.current.setValue(val);
onChange(val);
}
});
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
style: {
width: width || "100%"
},
className: "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.mathFillWrap, " ").concat(disabled || readOnly ? 'cursorDefault' : ''),
onClick: function onClick() {
return showInput();
},
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("math-field", {
disabled: disabled,
locale: "zh_cn",
"class": "".concat(_index_less_modules__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.mathField, " ").concat(type),
readOnly: readOnly,
placeholder: "\u8BF7\u8F93\u5165latex\u516C\u5F0F",
ref: GraphicsRef,
style: {
width: "100%",
fontSize: value ? 18 : 14
},
value: value || ""
})
});
});
/* harmony default export */ __webpack_exports__.Z = (MathsLatex);
/***/ }),
/***/ 28805:
/*!*********************************************************!*\
!*** ./src/components/QuestionEditor/Buttonloading.tsx ***!
\*********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js */ 7557);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js */ 41498);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var umi__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! umi */ 8931);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! antd */ 8591);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! antd */ 3113);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! antd */ 43418);
/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! js-base64 */ 24334);
/* harmony import */ var js_base64__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(js_base64__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _utils_fetch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/fetch */ 14735);
/* harmony import */ var _pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/pages/MyProblem/service */ 76958);
/* harmony import */ var _pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/pages/MyProblem/TestCasePanel */ 46706);
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! moment */ 9498);
/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
/**
* @description: 自测运行
* @param {*}
* ButtonProps:按钮部分样式等参数
* ButtonText 按钮文字
* form 表单内容
* answerKey 填空字段
* items 为运行调试字段
* @return {*}
*/
var ButtonLoading = function ButtonLoading(_ref) {
var ButtonProps = _ref.ButtonProps,
ButtonText = _ref.ButtonText,
form = _ref.form,
answerKey = _ref.answerKey,
_ref$hackidentifier = _ref.hackidentifier,
hackidentifier = _ref$hackidentifier === void 0 ? "" : _ref$hackidentifier,
_ref$items = _ref.items,
items = _ref$items === void 0 ? {} : _ref$items,
setIsSubmitCode = _ref.setIsSubmitCode;
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(false),
_useState2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState, 2),
isloading = _useState2[0],
setisloading = _useState2[1];
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(''),
_useState4 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState3, 2),
identifier = _useState4[0],
setidentifier = _useState4[1];
var param = (0,umi__WEBPACK_IMPORTED_MODULE_4__.useParams)();
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)({}),
_useState6 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_3___default()(_useState5, 2),
modalshow = _useState6[0],
setmodalshow = _useState6[1];
var isEdit = param.type === 'edit';
var type = window.location.href.includes('problemset') ? 1 : 2;
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
if (isEdit || hackidentifier) {
setidentifier(hackidentifier || param.id);
}
}, [param]);
(0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () {
return function () {
sessionStorage.removeItem("projectFill");
};
}, []);
function onUpdateCode(_x, _x2) {
return _onUpdateCode.apply(this, arguments);
}
function _onUpdateCode() {
_onUpdateCode = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee4(re, id) {
var _stats$filter;
var code, stats, codes, response;
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
code = form.getFieldValue("hack_codes");
stats = form.getFieldValue(answerKey);
if (code.code) {
_context4.next = 5;
break;
}
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('程序代码不能为空!');
return _context4.abrupt("return");
case 5:
if (code.language) {
_context4.next = 8;
break;
}
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('编程语言不能为空!');
return _context4.abrupt("return");
case 8:
if (!(stats.length > 0 && ((_stats$filter = stats.filter(function (item) {
return !item.answer_text;
})) === null || _stats$filter === void 0 ? void 0 : _stats$filter.length) > 0)) {
_context4.next = 11;
break;
}
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.info('填空项不能为空!');
return _context4.abrupt("return");
case 11:
codes = code.code;
if (stats.length > 0) {
stats === null || stats === void 0 || stats.map(function (item) {
if (item.multi_line) {
codes = codes.substring(0, codes.indexOf('@▁▁@')) + item.answer_text + codes.substring(codes.indexOf('@▁▁@') + 4);
} else {
codes = codes.substring(0, codes.indexOf('@▁@')) + item.answer_text + codes.substring(codes.indexOf('@▁@') + 3);
}
});
}
_context4.next = 15;
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .updateCode */ .n4)(id, re ? re : {
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(codes),
language: code.language,
answers: stats === null || stats === void 0 ? void 0 : stats.map(function (item) {
return item.answer_text;
})
});
case 15:
response = _context4.sent;
return _context4.abrupt("return", response);
case 17:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return _onUpdateCode.apply(this, arguments);
}
function onUpdateCodes(_x3, _x4) {
return _onUpdateCodes.apply(this, arguments);
}
function _onUpdateCodes() {
_onUpdateCodes = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee5(re, id) {
var stats, codes, response;
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
stats = items.userAnswer;
codes = js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.decode(items.code); // if (stats.length > 0 && stats.filter((item) => !item.value)?.length > 0) {
// message.info('填空项不能为空!')
// return
// }
if (stats.length > 0) {
stats === null || stats === void 0 || stats.map(function (item) {
if (item.multi_line) {
codes = codes.substring(0, codes.indexOf('@▁▁@')) + item.value + codes.substring(codes.indexOf('@▁▁@') + 4);
} else {
codes = codes.substring(0, codes.indexOf('@▁@')) + item.value + codes.substring(codes.indexOf('@▁@') + 3);
}
});
}
_context5.next = 5;
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .updateCode */ .n4)(id, re ? re : {
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(codes),
language: items.language,
answers: stats === null || stats === void 0 ? void 0 : stats.map(function (item) {
return item.value;
})
});
case 5:
response = _context5.sent;
return _context5.abrupt("return", response);
case 7:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return _onUpdateCodes.apply(this, arguments);
}
function getTimeStamp() {
return new Date().getTime();
}
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .ZP, _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
loading: isloading
}, ButtonProps), {}, {
onClick: /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee3() {
var _res, _response, executeCode, startTime, aa, res, formValues, _formValues$hack, _res2, _formValues$hack2, res1, response, _executeCode, _startTime;
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
console.log('----', 111);
if (!(ButtonText === '提交代码')) {
_context3.next = 22;
break;
}
setisloading(true);
if (!isloading) {
_context3.next = 5;
break;
}
return _context3.abrupt("return");
case 5:
_context3.next = 7;
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems/".concat(identifier, "/start.json"), {
method: 'get'
});
case 7:
_res = _context3.sent;
_context3.next = 10;
return onUpdateCodes(null, _res === null || _res === void 0 ? void 0 : _res.identifier);
case 10:
_response = _context3.sent;
if (!((_response === null || _response === void 0 ? void 0 : _response.status) === 0)) {
_context3.next = 19;
break;
}
executeCode = /*#__PURE__*/function () {
var _ref3 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee() {
var _items$userAnswer;
var _yield$getOperationRe, status, message, data, executeTime, isTimeOut;
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .getOperationResult */ .rX)(_res === null || _res === void 0 ? void 0 : _res.identifier, 'submit');
case 2:
_yield$getOperationRe = _context.sent;
status = _yield$getOperationRe.status;
message = _yield$getOperationRe.message;
data = _yield$getOperationRe.data;
executeTime = getTimeStamp();
isTimeOut = executeTime - startTime > 10 * 1000 * (items === null || items === void 0 || (_items$userAnswer = items.userAnswer) === null || _items$userAnswer === void 0 ? void 0 : _items$userAnswer.length);
if (status !== 0 && !isTimeOut) {
setTimeout(executeCode, 1000);
}
if (!isTimeOut) {
_context.next = 13;
break;
}
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
centered: true,
okText: '知道啦',
title: '调试代码超时'
});
setisloading(false);
return _context.abrupt("return");
case 13:
if (status === 0) {
setisloading(false);
// let datas = await Fetch(`/api/myproblems/record_detail.json`, {
// method: 'GET',
// params: {
// id: data?.id
// }
// })
setmodalshow(data);
if (data.status === 2) {
setisloading(false);
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
centered: true,
okText: '知道啦',
title: '调试代码超时'
});
}
}
case 14:
case "end":
return _context.stop();
}
}, _callee);
}));
return function executeCode() {
return _ref3.apply(this, arguments);
};
}();
startTime = getTimeStamp();
_context3.next = 16;
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .sumbitCode */ .bM)(_res === null || _res === void 0 ? void 0 : _res.identifier, {});
case 16:
executeCode();
_context3.next = 20;
break;
case 19:
setisloading(false);
case 20:
!!setIsSubmitCode && setIsSubmitCode(true);
return _context3.abrupt("return");
case 22:
aa = true;
_context3.next = 25;
return form.validateFields().then(function () {
aa = false;
}, function (errInfo) {
var _errInfo$errorFields, _errInfo$errorFields2;
if (errInfo.errorFields[0].name.includes("standard_answers")) {
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.error("填空项答案不能为空");
} else {
antd__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .ZP.error(errInfo.errorFields[0].errors[0]);
}
if (((_errInfo$errorFields = errInfo.errorFields) === null || _errInfo$errorFields === void 0 ? void 0 : _errInfo$errorFields.length) === 0) {
aa = false;
}
form.scrollToField(errInfo === null || errInfo === void 0 || (_errInfo$errorFields2 = errInfo.errorFields) === null || _errInfo$errorFields2 === void 0 || (_errInfo$errorFields2 = _errInfo$errorFields2[0]) === null || _errInfo$errorFields2 === void 0 ? void 0 : _errInfo$errorFields2.name, {
behavior: 'smooth',
block: 'center'
});
aa = true;
});
case 25:
if (!aa) {
_context3.next = 27;
break;
}
return _context3.abrupt("return");
case 27:
setisloading(true);
if (!isloading) {
_context3.next = 30;
break;
}
return _context3.abrupt("return");
case 30:
res = '';
formValues = form.getFieldsValue();
if (identifier) {
_context3.next = 41;
break;
}
_context3.next = 35;
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems.json", {
method: 'post',
body: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues), {}, {
hack: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues === null || formValues === void 0 ? void 0 : formValues.hack), {}, {
sub_discipline_id: formValues === null || formValues === void 0 || (_formValues$hack = formValues.hack) === null || _formValues$hack === void 0 || (_formValues$hack = _formValues$hack.sub_discipline_id) === null || _formValues$hack === void 0 ? void 0 : _formValues$hack[1],
difficult: formValues.difficulty,
item_banks_group_id: formValues.item_banks_group_id
}),
hack_codes: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_codes), {}, {
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(formValues.hack_codes.code)
}),
hack_sets: [_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_sets)],
is_blank: true
})
});
case 35:
res = _context3.sent;
identifier = (_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.identifier;
sessionStorage.projectFill = identifier;
setidentifier(identifier);
_context3.next = 44;
break;
case 41:
_context3.next = 43;
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems/".concat(identifier, ".json"), {
method: 'put',
body: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues), {}, {
hack: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues === null || formValues === void 0 ? void 0 : formValues.hack), {}, {
sub_discipline_id: formValues === null || formValues === void 0 || (_formValues$hack2 = formValues.hack) === null || _formValues$hack2 === void 0 || (_formValues$hack2 = _formValues$hack2.sub_discipline_id) === null || _formValues$hack2 === void 0 ? void 0 : _formValues$hack2[1],
difficult: formValues.difficulty,
item_banks_group_id: formValues.item_banks_group_id
}),
hack_codes: _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_codes), {}, {
code: js_base64__WEBPACK_IMPORTED_MODULE_6__.Base64.encode(formValues.hack_codes.code)
}),
update_hack_sets: [_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formValues.hack_sets)],
is_blank: true
})
});
case 43:
res = _context3.sent;
case 44:
_context3.next = 46;
return (0,_utils_fetch__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .ZP)("/api/problems/".concat(identifier, "/start.json"), {
method: 'get'
});
case 46:
res1 = _context3.sent;
_context3.next = 49;
return onUpdateCode(null, res1 === null || res1 === void 0 ? void 0 : res1.identifier);
case 49:
response = _context3.sent;
if (!((response === null || response === void 0 ? void 0 : response.status) === 0)) {
_context3.next = 58;
break;
}
_executeCode = /*#__PURE__*/function () {
var _ref4 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_2___default()( /*#__PURE__*/_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().mark(function _callee2() {
var _formValues$standard_;
var _yield$getOperationRe2, status, message, data, executeTime, isTimeOut;
return _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_1___default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .getOperationResult */ .rX)(res1 === null || res1 === void 0 ? void 0 : res1.identifier, 'submit');
case 2:
_yield$getOperationRe2 = _context2.sent;
status = _yield$getOperationRe2.status;
message = _yield$getOperationRe2.message;
data = _yield$getOperationRe2.data;
executeTime = getTimeStamp();
isTimeOut = executeTime - _startTime > (formValues.hack.time_limit + 3) * 1000 * (formValues === null || formValues === void 0 || (_formValues$standard_ = formValues.standard_answers) === null || _formValues$standard_ === void 0 ? void 0 : _formValues$standard_.length);
if (status !== 0 && !isTimeOut) {
setTimeout(_executeCode, 1000);
}
if (!isTimeOut) {
_context2.next = 13;
break;
}
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
centered: true,
okText: '知道啦',
title: '调试代码超时'
});
setisloading(false);
return _context2.abrupt("return");
case 13:
if (status === 0) {
setisloading(false);
setmodalshow(data);
if (data.status === 2) {
setisloading(false);
antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z.error({
centered: true,
okText: '知道啦',
title: '调试代码超时'
});
}
}
case 14:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function _executeCode() {
return _ref4.apply(this, arguments);
};
}();
_startTime = getTimeStamp();
_context3.next = 55;
return (0,_pages_MyProblem_service__WEBPACK_IMPORTED_MODULE_8__/* .sumbitCode */ .bM)(res1 === null || res1 === void 0 ? void 0 : res1.identifier, {});
case 55:
_executeCode();
_context3.next = 59;
break;
case 58:
setisloading(false);
case 59:
case "end":
return _context3.stop();
}
}, _callee3);
})),
children: ButtonText
})), (modalshow === null || modalshow === void 0 ? void 0 : modalshow.id) && modalshow.status !== 2 && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(antd__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {
open: (modalshow === null || modalshow === void 0 ? void 0 : modalshow.id) && modalshow.status !== 2,
title: "\u8FD0\u884C\u7ED3\u679C",
width: 1100,
footer: false,
onOk: function onOk() {
setmodalshow({});
},
onCancel: function onCancel() {
setmodalshow({});
},
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
style: {
maxHeight: 600,
overflow: 'auto',
marginBottom: 15
},
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
style: {
marginBottom: 20,
display: 'flex',
justifyContent: 'space-between',
fontSize: 14
},
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
style: {
color: '#666666'
},
children: "\u72B6\u6001"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
style: {
marginLeft: 12,
color: modalshow.status !== 0 && '#E30000'
},
children: _pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_9__/* .ExecuteDict */ .Im[modalshow.status]
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
style: {
color: '#666666'
},
children: "\u63D0\u4EA4\u65F6\u95F4"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
style: {
marginLeft: 12
},
children: moment__WEBPACK_IMPORTED_MODULE_10___default()(modalshow.created_at).format('YYYY-MM-DD HH:mm:ss')
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
style: {
color: '#666666'
},
children: "\u8BED\u8A00"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
style: {
marginLeft: 12
},
children: modalshow.language
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("div", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)("span", {
style: {
color: '#666666'
},
children: "\u6267\u884C\u7528\u65F6"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)("span", {
style: {
marginLeft: 12
},
children: [modalshow.execute_time, "ms"]
})]
})]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_pages_MyProblem_TestCasePanel__WEBPACK_IMPORTED_MODULE_9__/* .DetailCommitOut */ .Y4, _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, modalshow))]
})
})]
});
};
/* harmony default export */ __webpack_exports__.Z = (ButtonLoading);
/***/ }),
/***/ 84213:
/*!*********************************************************!*\
!*** ./src/components/TestResult/index.tsx + 1 modules ***!
\*********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ components_TestResult; }
});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
;// CONCATENATED MODULE: ./src/components/TestResult/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var TestResultmodules = ({"flex_box_center":"flex_box_center___Gc4dd","flex_space_between":"flex_space_between___K2f1v","flex_box_vertical_center":"flex_box_vertical_center___pupRp","flex_box_center_end":"flex_box_center_end___UDLRC","flex_box_column":"flex_box_column___a5uDo","result":"result___gu5zt","title":"title___xrnx2","left":"left___IAxp9","leftNode":"leftNode___HL8fG","right":"right___ZXYmw","rightNode":"rightNode___jYL5_"});
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
var _classnames_2_5_1_classnames = __webpack_require__(92310);
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/components/TestResult/index.tsx
var TestResult = function TestResult(_ref) {
var className = _ref.className,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
leftNode = _ref.leftNode,
_ref$leftTitle = _ref.leftTitle,
leftTitle = _ref$leftTitle === void 0 ? '自测输入' : _ref$leftTitle,
rightNode = _ref.rightNode,
_ref$rightTitle = _ref.rightTitle,
rightTitle = _ref$rightTitle === void 0 ? '运行结果' : _ref$rightTitle;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: _classnames_2_5_1_classnames_default()(TestResultmodules.result, className),
style: style,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: TestResultmodules.left,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: TestResultmodules.title,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
style: {
color: '#08CF76'
},
className: "iconfont iconfont icon-zidingyiceshiyongli font14 mr5"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: leftTitle
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: TestResultmodules.leftNode,
children: leftNode
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: TestResultmodules.right,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: TestResultmodules.title,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
style: {
color: '#00DFFF'
},
className: "iconfont iconfont icon-daimazhihangjieguo font14 mr5"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: rightTitle
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: TestResultmodules.rightNode,
children: rightNode
})]
})]
});
};
/* harmony default export */ var components_TestResult = (TestResult);
/***/ }),
/***/ 46055:
/*!*************************************************************!*\
!*** ./src/components/markdown-editor/code-block/index.tsx ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ h: function() { return /* binding */ MyCodeMirror; }
/* harmony export */ });
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 57809);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 78241);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 3113);
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! codemirror */ 89780);
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! codemirror/lib/codemirror.css */ 98151);
/* harmony import */ var codemirror_theme_blackboard_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! codemirror/theme/blackboard.css */ 83463);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
var Option = antd__WEBPACK_IMPORTED_MODULE_7__["default"].Option;
//https://github.com/codemirror/CodeMirror/issues/4838
var formItemLayout = {
labelCol: {
span: 4
},
wrapperCol: {
span: 20
}
};
var LanguageDesc = {
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']
};
/* harmony default export */ __webpack_exports__.Z = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)('python'),
_useState2 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
mode = _useState2[0],
setMode = _useState2[1];
function onSetMode(value) {
setMode(LanguageDesc[value][1]);
}
function onSubmit(values) {
callback(values);
}
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formItemLayout), {}, {
className: "code-block-panel",
initialValues: {
language: 'python',
content: ''
},
onFinish: onSubmit,
style: {
width: 500
},
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
label: "\u4EE3\u7801\u8BED\u8A00",
name: "language",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__["default"], {
getPopupContainer: function getPopupContainer(trigger) {
return trigger.parentNode;
},
onChange: onSetMode,
children: Object.keys(LanguageDesc).map(function (item) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(Option, {
value: item,
children: LanguageDesc[item][0]
}, item);
})
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
label: "\u4EE3\u7801\u5185\u5BB9",
name: "content",
rules: [{
required: true,
message: '请输入代码内容'
}],
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(MyCodeMirror, {
mode: mode
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
className: "flex-container flex-end",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP, {
type: "ghost",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
}));
});
function MyCodeMirror(_ref2) {
var value = _ref2.value,
onChange = _ref2.onChange,
mode = _ref2.mode,
_ref2$options = _ref2.options,
options = _ref2$options === void 0 ? {} : _ref2$options;
var el = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)();
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(),
_useState4 = _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),
cm = _useState4[0],
setCm = _useState4[1];
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (cm) {
var onChangeHandler = function onChangeHandler(cm) {
var content = cm.getValue();
onChange && onChange(content);
};
cm.on('change', onChangeHandler);
return function () {
cm.off('change', onChangeHandler);
};
}
}, [cm, onChange]);
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (cm) {
cm.setOption('mode', mode);
}
}, [cm, mode]);
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (cm) {
if (value !== cm.getValue() || value === '') {
setTimeout(function () {
cm.setValue(value || '');
}, 300);
}
}
}, [cm, value]);
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (el.current && !cm) {
var instance = codemirror__WEBPACK_IMPORTED_MODULE_3___default().fromTextArea(el.current, _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
mode: mode,
lineNumbers: true,
lineWrapping: true,
autoCloseBrackets: true,
tabSize: 4,
autofocus: true,
autoCloseTags: true,
matchBrackets: true,
styleActiveLine: true
}, options));
setCm(instance);
}
}, [el.current, cm]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
className: "my-codemirror-container",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("textarea", {
ref: el
})
});
}
/***/ }),
/***/ 93521:
/*!***************************************************************!*\
!*** ./src/components/markdown-editor/index.tsx + 15 modules ***!
\***************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ markdown_editor; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createForOfIteratorHelper.js
var createForOfIteratorHelper = __webpack_require__(91232);
var createForOfIteratorHelper_default = /*#__PURE__*/__webpack_require__.n(createForOfIteratorHelper);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/defineProperty.js
var defineProperty = __webpack_require__(85573);
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/lib/codemirror.js
var codemirror = __webpack_require__(89780);
var codemirror_default = /*#__PURE__*/__webpack_require__.n(codemirror);
// EXTERNAL MODULE: ./node_modules/_resize-observer-polyfill@1.5.1@resize-observer-polyfill/dist/ResizeObserver.es.js
var ResizeObserver_es = __webpack_require__(76374);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/lib/codemirror.css
var lib_codemirror = __webpack_require__(98151);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/edit/closetag.js
var closetag = __webpack_require__(6313);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/edit/closebrackets.js
var closebrackets = __webpack_require__(25717);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/display/placeholder.js
var placeholder = __webpack_require__(99498);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/mode/markdown/markdown.js
var markdown = __webpack_require__(25419);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/mode/stex/stex.js
var stex = __webpack_require__(67549);
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
var RenderHtml = __webpack_require__(52961);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/components/RenderHtml/stex.tsx
// const latexjs = require('latex-l.js/dist/latex.js');
// import "latex-l.js/dist/css/base.css"
/* harmony default export */ var RenderHtml_stex = (function (_ref) {
var _ref$value = _ref.value,
value = _ref$value === void 0 ? '' : _ref$value,
className = _ref.className,
showTextOnly = _ref.showTextOnly,
showLines = _ref.showLines,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style;
var html = (0,_react_17_0_2_react.useMemo)(function () {
// try {
// const latex = value || 'This is some text';
// let generator = new latexjs.default.HtmlGenerator({ hyphenate: true })
// let doc = latexjs.default.parse(latex, { generator: generator }).htmlDocument()
// return doc.body.innerHTML
// }catch(e){
// console.log("e:",e)
// return "错误的latex语法请检查"
// }
return "";
}, [value]);
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
dangerouslySetInnerHTML: {
__html: html
}
})
});
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
;// CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.less
// extracted by mini-css-extract-plugin
;// CONCATENATED MODULE: ./src/components/markdown-editor/css/iconfont.css
// extracted by mini-css-extract-plugin
;// CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.tsx
var DEFAULTICONS = [{
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 AButton(_ref) {
var onActionCallback = _ref.onActionCallback,
title = _ref.title,
icon = _ref.icon,
actionName = _ref.actionName,
_ref$className = _ref.className,
className = _ref$className === void 0 ? '' : _ref$className,
children = _ref.children;
function onAction() {
onActionCallback(actionName);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)("a", {
title: title,
className: className,
onClick: onAction,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "".concat(icon)
}), children]
});
}
/* harmony default export */ var toolbar = (function (_ref2) {
var watch = _ref2.watch,
showNullButton = _ref2.showNullButton,
showNullProgramButton = _ref2.showNullProgramButton,
onActionCallback = _ref2.onActionCallback,
fullScreen = _ref2.fullScreen,
insertTemp = _ref2.insertTemp,
hidetoolBar = _ref2.hidetoolBar,
extraUse = _ref2.extraUse;
var icons = [].concat(DEFAULTICONS, [{
title: "".concat(watch ? '关闭实时预览' : '开启实时预览'),
icon: "".concat(watch ? 'md-iconfont icon-eye-slash' : 'md-iconfont icon-eye'),
actionName: 'trigger-watch'
}]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
className: "markdown-toolbar-container",
children: [!hidetoolBar && icons.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: item.actionName ? /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, objectSpread2_default()(objectSpread2_default()({}, item), {}, {
onActionCallback: onActionCallback
})) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "v-line"
})
}, index);
}), showNullButton ? /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "md-iconfont icon-edit insert-blank",
className: "btn-null",
title: "\u589E\u52A0\u586B\u7A7A",
actionName: "add-null-ch",
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"
})
})
}) : null, showNullProgramButton ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "md-iconfont icon-edit insert-blank",
className: "btn-null",
title: "\u589E\u52A0\u586B\u7A7A",
actionName: "add-signal",
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "\u6DFB\u52A0\u5355\u884C\u586B\u7A7A\u9879"
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "md-iconfont icon-uniE900 insert-blank",
className: "btn-null",
title: "\u589E\u52A0\u586B\u7A7A",
actionName: "add-multiple",
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "\u6DFB\u52A0\u591A\u884C\u586B\u7A7A\u9879"
})
})
})]
}) : null, insertTemp && /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "md-iconfont icon-edit",
className: "btn-null",
title: "\u63D2\u5165\u6A21\u677F",
actionName: "inster-template-".concat(insertTemp),
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "\u63D2\u5165\u6A21\u677F"
})
})
}), extraUse && /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: extraUse
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: "btn-full-screen",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "".concat(fullScreen ? 'md-iconfont icon-shrink' : 'md-iconfont icon-enlarge'),
title: fullScreen ? '关闭全屏' : '开启全屏',
actionName: "trigger-full-screen",
onActionCallback: onActionCallback
})
})]
});
});
// EXTERNAL MODULE: ./src/components/modal.tsx
var modal = __webpack_require__(613);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
var es_form = __webpack_require__(78241);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(9641);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
;// CONCATENATED MODULE: ./src/components/markdown-editor/link/index.tsx
var formItemLayout = {
labelCol: {
span: 4
},
wrapperCol: {
span: 20
}
};
/* harmony default export */ var markdown_editor_link = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
function onSubmit(values) {
callback(values);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, formItemLayout), {}, {
initialValues: {
link: 'http://',
title: ''
},
className: "link-panel",
onFinish: onSubmit,
style: {
width: 500
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u94FE\u63A5\u5730\u5740",
name: "link",
rules: [{
required: true,
message: '请输入链接地址'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u94FE\u63A5\u6807\u9898",
name: "title",
rules: [{
required: true,
message: '请输入链接标题'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container flex-end",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "ghost",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
}));
});
// EXTERNAL MODULE: ./src/components/markdown-editor/code-block/index.tsx
var code_block = __webpack_require__(46055);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/pages/tasks/util.js
var util = __webpack_require__(78436);
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.tsx
var useForm = es_form/* default */.Z.useForm;
var style = {
width: 280,
marginRight: 10
};
var upload_image_formItemLayout = {
labelCol: {
span: 5
},
wrapperCol: {
span: 19
}
};
/* harmony default export */ var upload_image = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
var _useForm = useForm(),
_useForm2 = slicedToArray_default()(_useForm, 1),
form = _useForm2[0];
var currentFile = (0,_react_17_0_2_react.useRef)();
function onSubmit(values) {
callback(values, currentFile.current);
}
function onAddUrl(data, file) {
if (data.status === -1) {
message/* default */.ZP.error(data.message);
return;
}
form.setFieldsValue({
src: "/api/attachments/".concat(data.id),
type: file.type
});
}
function onFileChange(e) {
var file = e.target.files[0];
currentFile.current = file;
uploadImage(file, onAddUrl);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, objectSpread2_default()(objectSpread2_default()({
form: form
}, upload_image_formItemLayout), {}, {
className: "upload-image-panel",
onFinish: onSubmit,
style: {
width: 470,
overflow: "hidden"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u56FE\u7247\u5730\u5740",
required: true,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
noStyle: true,
name: "src",
rules: [{
required: true,
message: '请输入图片地址'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
style: style
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(UploadButton, {
onFileChange: onFileChange
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u56FE\u7247\u63CF\u8FF0",
name: "alt"
// rules={[{ required: true, message: '请输入图片描述' }]}
,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
style: {
width: 264
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z.Item, {
style: {
textAlign: "right"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "default",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
}));
});
function UploadButton(_ref2) {
var onFileChange = _ref2.onFileChange;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("label", {
className: "upload-button",
style: {
cursor: "pointer"
},
children: ["\u672C\u5730\u4E0A\u4F20", /*#__PURE__*/(0,jsx_runtime.jsx)("input", {
type: "file",
onChange: onFileChange
})]
});
}
function uploadImage(file, callback) {
if (!file) {
throw new String('没有文件');
return;
}
var formData = new FormData();
formData.append('editormd-image-file', file);
formData.append('file_param_name', 'editormd-image-file');
formData.append('byxhr', 'true');
var xhr = new window.XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('load', function (response) {
callback(JSON.parse(response.target.responseText), file);
}, false);
xhr.addEventListener('error', function (error) {
console.error(error);
}, false);
xhr.open('POST', "".concat(util/* apiPref */.KI, "/api/attachments.json"));
xhr.send(formData);
}
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
var row = __webpack_require__(95237);
// EXTERNAL MODULE: ./src/components/ImageDimensions/index.tsx + 1 modules
var ImageDimensions = __webpack_require__(8179);
;// CONCATENATED MODULE: ./src/components/markdown-editor/draw-image/index.tsx
/* harmony default export */ var draw_image = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
canvas.width = 1000;
canvas.height = 800;
context.fillStyle = '#ffffff';
context.fillRect(0, 0, canvas.width, canvas.height);
var base64Image = canvas.toDataURL('image/png');
return /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
style: {
height: "100vh"
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ImageDimensions/* default */.Z, {
fullWidth: true,
noAssociationId: true,
showFullTools: true,
data: {
src: base64Image,
visible: true,
title: String(Date.now())
},
onOk: function onOk(data) {
callback({
src: data.url
});
},
onClose: onCancel
})
});
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(37205);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
// EXTERNAL MODULE: ./node_modules/_gojs3@2.3.10@gojs3/release/go-module.js
var go_module = __webpack_require__(12378);
;// CONCATENATED MODULE: ./public/js/go/DrawCommandHandler.js
/*
* Copyright (C) 1998-2023 by Northwoods Software Corporation. All Rights Reserved.
*/
/*
* This is an extension and not part of the main GoJS library.
* Note that the API for this class may change with any version, even point releases.
* If you intend to use an extension in production, you should copy the code to your own source directory.
* Extensions can be found in the GoJS kit under the extensions or extensionsJSM folders.
* See the Extensions intro page (https://gojs.net/latest/intro/extensions.html) for more information.
*/
/**
* @constructor
* @extends CommandHandler
* @class
* This CommandHandler class allows the user to position selected Parts in a diagram
* relative to the first part selected, in addition to overriding the doKeyDown method
* of the CommandHandler for handling the arrow keys in additional manners.
* <p>
* Typical usage:
* <pre>
* new go.Diagram("myDiagramDiv",
* {
* commandHandler: $(DrawCommandHandler),
* . . .
* }
* )
* </pre>
* or:
* <pre>
* myDiagram.commandHandler = new DrawCommandHandler();
* </pre>
*/
function DrawCommandHandler() {
go.CommandHandler.call(this);
this._arrowKeyBehavior = "move";
this._pasteOffset = new go.Point(10, 10);
this._lastPasteOffset = new go.Point(0, 0);
}
go.Diagram.inherit(DrawCommandHandler, go.CommandHandler);
/**
* This controls whether or not the user can invoke the {@link #alignLeft}, {@link #alignRight},
* {@link #alignTop}, {@link #alignBottom}, {@link #alignCenterX}, {@link #alignCenterY} commands.
* @this {DrawCommandHandler}
* @return {boolean}
* This returns true:
* if the diagram is not {@link Diagram#isReadOnly},
* if the model is not {@link Model#isReadOnly}, and
* if there are at least two selected {@link Part}s.
*/
DrawCommandHandler.prototype.canAlignSelection = function () {
var diagram = this.diagram;
if (diagram === null || diagram.isReadOnly || diagram.isModelReadOnly) return false;
if (diagram.selection.count < 2) return false;
return true;
};
/**
* Aligns selected parts along the left-most edge of the left-most part.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignLeft = function () {
var diagram = this.diagram;
diagram.startTransaction("aligning left");
var minPosition = Infinity;
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
minPosition = Math.min(current.position.x, minPosition);
});
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
current.move(new go.Point(minPosition, current.position.y));
});
diagram.commitTransaction("aligning left");
};
/**
* Aligns selected parts at the right-most edge of the right-most part.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignRight = function () {
var diagram = this.diagram;
diagram.startTransaction("aligning right");
var maxPosition = -Infinity;
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
var rightSideLoc = current.actualBounds.x + current.actualBounds.width;
maxPosition = Math.max(rightSideLoc, maxPosition);
});
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
current.move(new go.Point(maxPosition - current.actualBounds.width, current.position.y));
});
diagram.commitTransaction("aligning right");
};
/**
* Aligns selected parts at the top-most edge of the top-most part.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignTop = function () {
var diagram = this.diagram;
diagram.startTransaction("alignTop");
var minPosition = Infinity;
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
minPosition = Math.min(current.position.y, minPosition);
});
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
current.move(new go.Point(current.position.x, minPosition));
});
diagram.commitTransaction("alignTop");
};
/**
* Aligns selected parts at the bottom-most edge of the bottom-most part.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignBottom = function () {
var diagram = this.diagram;
diagram.startTransaction("aligning bottom");
var maxPosition = -Infinity;
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
var bottomSideLoc = current.actualBounds.y + current.actualBounds.height;
maxPosition = Math.max(bottomSideLoc, maxPosition);
});
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
current.move(new go.Point(current.actualBounds.x, maxPosition - current.actualBounds.height));
});
diagram.commitTransaction("aligning bottom");
};
/**
* Aligns selected parts at the x-value of the center point of the first selected part.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignCenterX = function () {
var diagram = this.diagram;
var firstSelection = diagram.selection.first();
if (!firstSelection) return;
diagram.startTransaction("aligning Center X");
var centerX = firstSelection.actualBounds.x + firstSelection.actualBounds.width / 2;
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
current.move(new go.Point(centerX - current.actualBounds.width / 2, current.actualBounds.y));
});
diagram.commitTransaction("aligning Center X");
};
/**
* Aligns selected parts at the y-value of the center point of the first selected part.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.alignCenterY = function () {
var diagram = this.diagram;
var firstSelection = diagram.selection.first();
if (!firstSelection) return;
diagram.startTransaction("aligning Center Y");
var centerY = firstSelection.actualBounds.y + firstSelection.actualBounds.height / 2;
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
current.move(new go.Point(current.actualBounds.x, centerY - current.actualBounds.height / 2));
});
diagram.commitTransaction("aligning Center Y");
};
/**
* Aligns selected parts top-to-bottom in order of the order selected.
* Distance between parts can be specified. Default distance is 0.
* @this {DrawCommandHandler}
* @param {number} distance
*/
DrawCommandHandler.prototype.alignColumn = function (distance) {
var diagram = this.diagram;
diagram.startTransaction("align Column");
if (distance === undefined) distance = 0; // for aligning edge to edge
distance = parseFloat(distance);
var selectedParts = new Array();
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
selectedParts.push(current);
});
for (var i = 0; i < selectedParts.length - 1; i++) {
var current = selectedParts[i];
// adds distance specified between parts
var curBottomSideLoc = current.actualBounds.y + current.actualBounds.height + distance;
var next = selectedParts[i + 1];
next.move(new go.Point(current.actualBounds.x, curBottomSideLoc));
}
diagram.commitTransaction("align Column");
};
/**
* Aligns selected parts left-to-right in order of the order selected.
* Distance between parts can be specified. Default distance is 0.
* @this {DrawCommandHandler}
* @param {number} distance
*/
DrawCommandHandler.prototype.alignRow = function (distance) {
if (distance === undefined) distance = 0; // for aligning edge to edge
distance = parseFloat(distance);
var diagram = this.diagram;
diagram.startTransaction("align Row");
var selectedParts = new Array();
diagram.selection.each(function (current) {
if (current instanceof go.Link) return; // skips over go.Link
selectedParts.push(current);
});
for (var i = 0; i < selectedParts.length - 1; i++) {
var current = selectedParts[i];
// adds distance specified between parts
var curRightSideLoc = current.actualBounds.x + current.actualBounds.width + distance;
var next = selectedParts[i + 1];
next.move(new go.Point(curRightSideLoc, current.actualBounds.y));
}
diagram.commitTransaction("align Row");
};
/**
* This controls whether or not the user can invoke the {@link #rotate} command.
* @this {DrawCommandHandler}
* @param {number=} angle the positive (clockwise) or negative (counter-clockwise) change in the rotation angle of each Part, in degrees.
* @return {boolean}
* This returns true:
* if the diagram is not {@link Diagram#isReadOnly},
* if the model is not {@link Model#isReadOnly}, and
* if there is at least one selected {@link Part}.
*/
DrawCommandHandler.prototype.canRotate = function (number) {
var diagram = this.diagram;
if (diagram === null || diagram.isReadOnly || diagram.isModelReadOnly) return false;
if (diagram.selection.count < 1) return false;
return true;
};
/**
* Change the angle of the parts connected with the given part. This is in the command handler
* so it can be easily accessed for the purpose of creating commands that change the rotation of a part.
* @this {DrawCommandHandler}
* @param {number=} angle the positive (clockwise) or negative (counter-clockwise) change in the rotation angle of each Part, in degrees.
*/
DrawCommandHandler.prototype.rotate = function (angle) {
if (angle === undefined) angle = 90;
var diagram = this.diagram;
diagram.startTransaction("rotate " + angle.toString());
var diagram = this.diagram;
diagram.selection.each(function (current) {
if (current instanceof go.Link || current instanceof go.Group) return; // skips over Links and Groups
current.angle += angle;
});
diagram.commitTransaction("rotate " + angle.toString());
};
/**
* Change the z-ordering of selected parts to pull them forward, in front of all other parts
* in their respective layers.
* All unselected parts in each layer with a selected Part with a non-numeric {@link Part#zOrder} will get a zOrder of zero.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.pullToFront = function () {
var diagram = this.diagram;
diagram.startTransaction("pullToFront");
// find the affected Layers
var layers = new go.Map();
diagram.selection.each(function (part) {
layers.set(part.layer, 0);
});
// find the maximum zOrder in each Layer
layers.iteratorKeys.each(function (layer) {
var max = 0;
layer.parts.each(function (part) {
if (part.isSelected) return;
var z = part.zOrder;
if (isNaN(z)) {
part.zOrder = 0;
} else {
max = Math.max(max, z);
}
});
layers.set(layer, max);
});
// assign each selected Part.zOrder to the computed value for each Layer
diagram.selection.each(function (part) {
DrawCommandHandler._assignZOrder(part, layers.get(part.layer) + 1);
});
diagram.commitTransaction("pullToFront");
};
/**
* Change the z-ordering of selected parts to push them backward, behind of all other parts
* in their respective layers.
* All unselected parts in each layer with a selected Part with a non-numeric {@link Part#zOrder} will get a zOrder of zero.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype.pushToBack = function () {
var diagram = this.diagram;
diagram.startTransaction("pushToBack");
// find the affected Layers
var layers = new go.Map();
diagram.selection.each(function (part) {
layers.set(part.layer, 0);
});
// find the minimum zOrder in each Layer
layers.iteratorKeys.each(function (layer) {
var min = 0;
layer.parts.each(function (part) {
if (part.isSelected) return;
var z = part.zOrder;
if (isNaN(z)) {
part.zOrder = 0;
} else {
min = Math.min(min, z);
}
});
layers.set(layer, min);
});
// assign each selected Part.zOrder to the computed value for each Layer
diagram.selection.each(function (part) {
DrawCommandHandler._assignZOrder(part,
// make sure a group's nested nodes are also behind everything else
layers.get(part.layer) - 1 - DrawCommandHandler._findGroupDepth(part));
});
diagram.commitTransaction("pushToBack");
};
DrawCommandHandler._assignZOrder = function (part, z, root) {
if (root === undefined) root = part;
if (part.layer === root.layer) part.zOrder = z;
if (part instanceof go.Group) {
part.memberParts.each(function (m) {
DrawCommandHandler._assignZOrder(m, z + 1, root);
});
}
};
DrawCommandHandler._findGroupDepth = function (part) {
if (part instanceof go.Group) {
var d = 0;
part.memberParts.each(function (m) {
d = Math.max(d, DrawCommandHandler._findGroupDepth(m));
});
return d + 1;
} else {
return 0;
}
};
/**
* This implements custom behaviors for arrow key keyboard events.
* Set {@link #arrowKeyBehavior} to "select", "move" (the default), "scroll" (the standard behavior), or "none"
* to affect the behavior when the user types an arrow key.
* @this {DrawCommandHandler}*/
DrawCommandHandler.prototype.doKeyDown = function () {
var diagram = this.diagram;
if (diagram === null) return;
var e = diagram.lastInput;
// determines the function of the arrow keys
if (e.key === "Up" || e.key === "Down" || e.key === "Left" || e.key === "Right") {
var behavior = this.arrowKeyBehavior;
if (behavior === "none") {
// no-op
return;
} else if (behavior === "select") {
this._arrowKeySelect();
return;
} else if (behavior === "move") {
this._arrowKeyMove();
return;
} else if (behavior === "tree") {
this._arrowKeyTree();
return;
}
// otherwise drop through to get the default scrolling behavior
}
// otherwise still does all standard commands
go.CommandHandler.prototype.doKeyDown.call(this);
};
/**
* Collects in an Array all of the non-Link Parts currently in the Diagram.
* @this {DrawCommandHandler}
* @return {Array}
*/
DrawCommandHandler.prototype._getAllParts = function () {
var allParts = new Array();
this.diagram.nodes.each(function (node) {
allParts.push(node);
});
this.diagram.parts.each(function (part) {
allParts.push(part);
});
// note that this ignores Links
return allParts;
};
/**
* To be called when arrow keys should move the Diagram.selection.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype._arrowKeyMove = function () {
var diagram = this.diagram;
var e = diagram.lastInput;
// moves all selected parts in the specified direction
var vdistance = 0;
var hdistance = 0;
// if control is being held down, move pixel by pixel. Else, moves by grid cell size
if (e.control || e.meta) {
vdistance = 1;
hdistance = 1;
} else if (diagram.grid !== null) {
var cellsize = diagram.grid.gridCellSize;
hdistance = cellsize.width;
vdistance = cellsize.height;
}
diagram.startTransaction("arrowKeyMove");
diagram.selection.each(function (part) {
if (e.key === "Up") {
part.move(new go.Point(part.actualBounds.x, part.actualBounds.y - vdistance));
} else if (e.key === "Down") {
part.move(new go.Point(part.actualBounds.x, part.actualBounds.y + vdistance));
} else if (e.key === "Left") {
part.move(new go.Point(part.actualBounds.x - hdistance, part.actualBounds.y));
} else if (e.key === "Right") {
part.move(new go.Point(part.actualBounds.x + hdistance, part.actualBounds.y));
}
});
diagram.commitTransaction("arrowKeyMove");
};
/**
* To be called when arrow keys should change selection.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype._arrowKeySelect = function () {
var diagram = this.diagram;
var e = diagram.lastInput;
// with a part selected, arrow keys change the selection
// arrow keys + shift selects the additional part in the specified direction
// arrow keys + control toggles the selection of the additional part
var nextPart = null;
if (e.key === "Up") {
nextPart = this._findNearestPartTowards(270);
} else if (e.key === "Down") {
nextPart = this._findNearestPartTowards(90);
} else if (e.key === "Left") {
nextPart = this._findNearestPartTowards(180);
} else if (e.key === "Right") {
nextPart = this._findNearestPartTowards(0);
}
if (nextPart !== null) {
if (e.shift) {
nextPart.isSelected = true;
} else if (e.control || e.meta) {
nextPart.isSelected = !nextPart.isSelected;
} else {
diagram.select(nextPart);
}
}
};
/**
* Finds the nearest selectable Part in the specified direction, based on their center points.
* if it doesn't find anything, it just returns the current Part.
* @this {DrawCommandHandler}
* @param {number} dir the direction, in degrees
* @return {Part} the closest Part found in the given direction
*/
DrawCommandHandler.prototype._findNearestPartTowards = function (dir) {
var originalPart = this.diagram.selection.first();
if (originalPart === null) return null;
var originalPoint = originalPart.actualBounds.center;
var allParts = this._getAllParts();
var closestDistance = Infinity;
var closest = originalPart; // if no parts meet the criteria, the same part remains selected
for (var i = 0; i < allParts.length; i++) {
var nextPart = allParts[i];
if (nextPart === originalPart) continue; // skips over currently selected part
if (!nextPart.canSelect()) continue;
var nextPoint = nextPart.actualBounds.center;
var angle = originalPoint.directionPoint(nextPoint);
var anglediff = this._angleCloseness(angle, dir);
if (anglediff <= 45) {
// if this part's center is within the desired direction's sector,
var distance = originalPoint.distanceSquaredPoint(nextPoint);
distance *= 1 + Math.sin(anglediff * Math.PI / 180); // the more different from the intended angle, the further it is
if (distance < closestDistance) {
// and if it's closer than any other part,
closestDistance = distance; // remember it as a better choice
closest = nextPart;
}
}
}
return closest;
};
/**
* @this {DrawCommandHandler}
* @param {number} a
* @param {number} dir
* @return {number}
*/
DrawCommandHandler.prototype._angleCloseness = function (a, dir) {
return Math.min(Math.abs(dir - a), Math.min(Math.abs(dir + 360 - a), Math.abs(dir - 360 - a)));
};
/**
* To be called when arrow keys should change the selected node in a tree and expand or collapse subtrees.
* @this {DrawCommandHandler}
*/
DrawCommandHandler.prototype._arrowKeyTree = function () {
var diagram = this.diagram;
var selected = diagram.selection.first();
if (!(selected instanceof go.Node)) return;
var e = diagram.lastInput;
if (e.key === "Right") {
if (selected.isTreeLeaf) {
// no-op
} else if (!selected.isTreeExpanded) {
if (diagram.commandHandler.canExpandTree(selected)) {
diagram.commandHandler.expandTree(selected); // expands the tree
}
} else {
// already expanded -- select the first child node
var first = this._sortTreeChildrenByY(selected).first();
if (first !== null) diagram.select(first);
}
} else if (e.key === "Left") {
if (!selected.isTreeLeaf && selected.isTreeExpanded) {
if (diagram.commandHandler.canCollapseTree(selected)) {
diagram.commandHandler.collapseTree(selected); // collapses the tree
}
} else {
// either a leaf or is already collapsed -- select the parent node
var parent = selected.findTreeParentNode();
if (parent !== null) diagram.select(parent);
}
} else if (e.key === "Up") {
var parent = selected.findTreeParentNode();
if (parent !== null) {
var list = this._sortTreeChildrenByY(parent);
var idx = list.indexOf(selected);
if (idx > 0) {
// if there is a previous sibling
var prev = list.elt(idx - 1);
// keep looking at the last child until it's a leaf or collapsed
while (prev !== null && prev.isTreeExpanded && !prev.isTreeLeaf) {
var children = this._sortTreeChildrenByY(prev);
prev = children.last();
}
if (prev !== null) diagram.select(prev);
} else {
// no previous sibling -- select parent
diagram.select(parent);
}
}
} else if (e.key === "Down") {
// if at an expanded parent, select the first child
if (selected.isTreeExpanded && !selected.isTreeLeaf) {
var first = this._sortTreeChildrenByY(selected).first();
if (first !== null) diagram.select(first);
} else {
while (selected !== null) {
var parent = selected.findTreeParentNode();
if (parent === null) break;
var list = this._sortTreeChildrenByY(parent);
var idx = list.indexOf(selected);
if (idx < list.length - 1) {
// select next lower node
diagram.select(list.elt(idx + 1));
break;
} else {
// already at bottom of list of children
selected = parent;
}
}
}
}
// make sure the selection is now in the viewport, but not necessarily centered
var sel = diagram.selection.first();
if (sel !== null) diagram.scrollToRect(sel.actualBounds);
};
DrawCommandHandler.prototype._sortTreeChildrenByY = function (node) {
var list = new go.List().addAll(node.findTreeChildrenNodes());
list.sort(function (a, b) {
var aloc = a.location;
var bloc = b.location;
if (aloc.y < bloc.y) return -1;
if (aloc.y > bloc.y) return 1;
if (aloc.x < bloc.x) return -1;
if (aloc.x > bloc.x) return 1;
return 0;
});
return list;
};
/**
* Reset the last offset for pasting.
* @this {DrawCommandHandler}
* @param {Iterable.<Part>} coll a collection of {@link Part}s.
*/
DrawCommandHandler.prototype.copyToClipboard = function (coll) {
go.CommandHandler.prototype.copyToClipboard.call(this, coll);
this._lastPasteOffset.set(this.pasteOffset);
};
/**
* Paste from the clipboard with an offset incremented on each paste, and reset when copied.
* @this {DrawCommandHandler}
* @return {Set.<Part>} a collection of newly pasted {@link Part}s
*/
DrawCommandHandler.prototype.pasteFromClipboard = function () {
var coll = go.CommandHandler.prototype.pasteFromClipboard.call(this);
this.diagram.moveParts(coll, this._lastPasteOffset);
this._lastPasteOffset.add(this.pasteOffset);
return coll;
};
/**
* Gets or sets the arrow key behavior. Possible values are "move", "select", "scroll", and "tree".
* The default value is "move".
* @name DrawCommandHandler#arrowKeyBehavior
* @return {string}
*/
Object.defineProperty(DrawCommandHandler.prototype, "arrowKeyBehavior", {
get: function get() {
return this._arrowKeyBehavior;
},
set: function set(val) {
if (val !== "move" && val !== "select" && val !== "scroll" && val !== "tree" && val !== "none") {
throw new Error("DrawCommandHandler.arrowKeyBehavior must be either \"move\", \"select\", \"scroll\", \"tree\", or \"none\", not: " + val);
}
this._arrowKeyBehavior = val;
}
});
/**
* Gets or sets the offset at which each repeated pasteSelection() puts the new copied parts from the clipboard.
* The default value is (10,10).
* @name DrawCommandHandler#pasteOffset
* @return {Point}
*/
Object.defineProperty(DrawCommandHandler.prototype, "pasteOffset", {
get: function get() {
return this._pasteOffset;
},
set: function set(val) {
if (!(val instanceof go.Point)) throw new Error("DrawCommandHandler.pasteOffset must be a Point, not: " + val);
this._pasteOffset.set(val);
}
});
/* harmony default export */ var go_DrawCommandHandler = (DrawCommandHandler);
// EXTERNAL MODULE: ./public/js/go/Figures.js
var Figures = __webpack_require__(79006);
// EXTERNAL MODULE: ./node_modules/_gojs-react@1.1.2@gojs-react/lib/esm/gojsreact.js + 1 modules
var gojsreact = __webpack_require__(85160);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
var es_modal = __webpack_require__(43418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
var col = __webpack_require__(43604);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(14735);
;// CONCATENATED MODULE: ./src/components/markdown-editor/flow-chart/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var flow_chartmodules = ({"myPaletteDiv":"myPaletteDiv___Xjz2I","maxH60":"maxH60___Pd4Re"});
;// CONCATENATED MODULE: ./src/components/markdown-editor/flow-chart/index.tsx
window.go = go_module;
function FlowChart(_ref) {
var onCancel = _ref.onCancel,
callback = _ref.callback;
var myDiagram = (0,_react_17_0_2_react.useRef)();
var myDiagramDivRef = (0,_react_17_0_2_react.useRef)();
var myPaletteDivRef = (0,_react_17_0_2_react.useRef)();
var hidedenContentRef = (0,_react_17_0_2_react.useRef)(false);
var modalRef = (0,_react_17_0_2_react.useRef)(false);
var _useState = (0,_react_17_0_2_react.useState)(0),
_useState2 = slicedToArray_default()(_useState, 2),
updateModal = _useState2[0],
setUpdateModal = _useState2[1];
function initDiagram() {
var $ = go_module.GraphObject.make;
var colors = {
red: "#ff3333",
blue: "#3358ff",
green: "#25ad23",
magenta: "#d533ff",
purple: "#7d33ff",
orange: "#ff6233",
brown: "#8e571e",
white: "#ffffff",
black: "#000000",
beige: "#fffcd5",
extralightblue: "#d5ebff",
extralightred: "#f2dfe0",
lightblue: "#a5d2fa",
lightgray: "#cccccc",
lightgreen: "#b3e6b3",
lightred: "#fcbbbd"
};
myDiagram.current = new go_module.Diagram(myDiagramDivRef.current, {
padding: 20,
// extra space when scrolled all the way
grid: $(go_module.Panel, "Grid",
// a simple 10x10 grid
$(go_module.Shape, "LineH", {
stroke: "lightgray",
strokeWidth: 0.5
}), $(go_module.Shape, "LineV", {
stroke: "lightgray",
strokeWidth: 0.5
})),
"draggingTool.isGridSnapEnabled": true,
handlesDragDropForTopLevelParts: true,
mouseDrop: function mouseDrop(e) {
var ok = e.diagram.commandHandler.addTopLevelParts(e.diagram.selection, true);
if (!ok) e.diagram.currentTool.doCancel();
},
commandHandler: $(go_DrawCommandHandler),
// support offset copy-and-paste
"clickCreatingTool.archetypeNodeData": {
text: "未命名",
fill: null,
stroke: null,
borderColor: "rgba(0,0,0,0)"
},
// create a new node by double-clicking in background
"PartCreated": function PartCreated(e) {
var node = e.subject; // the newly inserted Node -- now need to snap its location to the grid
node.location = node.location.copy().snapToGridPoint(e.diagram.grid.gridOrigin, e.diagram.grid.gridCellSize);
setTimeout(function () {
// and have the user start editing its text
e.diagram.commandHandler.editTextBlock();
}, 20);
},
"commandHandler.archetypeGroupData": {
isGroup: true,
text: "NEW GROUP"
},
"SelectionGrouped": function SelectionGrouped(e) {
var group = e.subject;
setTimeout(function () {
// and have the user start editing its text
e.diagram.commandHandler.editTextBlock();
});
},
"LinkRelinked": function LinkRelinked(e) {
// re-spread the connections of other links connected with both old and new nodes
var oldnode = e.parameter.part;
oldnode.invalidateConnectedLinks();
var link = e.subject;
if (e.diagram.toolManager.linkingTool.isForwards) {
link.toNode.invalidateConnectedLinks();
} else {
link.fromNode.invalidateConnectedLinks();
}
},
"undoManager.isEnabled": true
});
// Node template
myDiagram.current.nodeTemplate = $(go_module.Node, "Auto", {
locationSpot: go_module.Spot.Center,
locationObjectName: "SHAPE",
desiredSize: new go_module.Size(120, 60),
minSize: new go_module.Size(40, 40),
resizable: true,
resizeCellSize: new go_module.Size(10, 10),
rotatable: true
// rotateObjectName: "SHAPE", // rotate the Shape without rotating the label
},
// these Bindings are TwoWay because the DraggingTool and ResizingTool modify the target properties
new go_module.Binding("location", "loc", go_module.Point.parse).makeTwoWay(go_module.Point.stringify), new go_module.Binding("desiredSize", "size", go_module.Size.parse).makeTwoWay(go_module.Size.stringify), $(go_module.Shape, {
// the border
name: "SHAPE",
fill: colors.white,
cursor: "pointer",
portId: "",
fromLinkable: true,
toLinkable: true,
fromLinkableDuplicates: true,
toLinkableDuplicates: true,
fromSpot: go_module.Spot.AllSides,
toSpot: go_module.Spot.AllSides
}, new go_module.Binding("figure"), new go_module.Binding("fill"), new go_module.Binding("stroke", "borderColor"), new go_module.Binding("strokeWidth", "thickness"), new go_module.Binding("strokeDashArray", "dash")),
// this Shape prevents mouse events from reaching the middle of the port
$(go_module.Shape, {
width: 100,
height: 20,
strokeWidth: 0,
fill: "transparent"
}), $(go_module.TextBlock, {
margin: 1,
textAlign: "center",
overflow: go_module.TextBlock.OverflowEllipsis,
editable: true
},
// this Binding is TwoWay due to the user editing the text with the TextEditingTool
new go_module.Binding("text").makeTwoWay(), new go_module.Binding("stroke", "color")));
myDiagram.current.nodeTemplate.toolTip = $("ToolTip",
// show some detailed information
$(go_module.Panel, "Vertical", {
maxSize: new go_module.Size(200, NaN)
},
// limit width but not height
$(go_module.TextBlock, {
font: "bold 10pt sans-serif",
textAlign: "center"
}, new go_module.Binding("text")), $(go_module.TextBlock, {
font: "10pt sans-serif",
textAlign: "center"
}, new go_module.Binding("text", "details"))));
// Node selection adornment
// Include four large triangular buttons so that the user can easily make a copy
// of the node, move it to be in that direction relative to the original node,
// and add a link to the new node.
function makeArrowButton(spot, fig) {
var maker = function maker(e, shape) {
e.handled = true;
e.diagram.model.commit(function (m) {
var selnode = shape.part.adornedPart;
// create a new node in the direction of the spot
var p = new go_module.Point().setRectSpot(selnode.actualBounds, spot);
p.subtract(selnode.location);
p.scale(2, 2);
p.x += Math.sign(p.x) * 130;
p.y += Math.sign(p.y) * 130;
p.add(selnode.location);
p.snapToGridPoint(e.diagram.grid.gridOrigin, e.diagram.grid.gridCellSize);
// make the new node a copy of the selected node
var nodedata = m.copyNodeData(selnode.data);
// add to same group as selected node
m.setGroupKeyForNodeData(nodedata, m.getGroupKeyForNodeData(selnode.data));
m.addNodeData(nodedata); // add to model
// create a link from the selected node to the new node
var linkdata = {
from: selnode.key,
to: m.getKeyForNodeData(nodedata)
};
m.addLinkData(linkdata); // add to model
// move the new node to the computed location, select it, and start to edit it
var newnode = e.diagram.findNodeForData(nodedata);
newnode.location = p;
e.diagram.select(newnode);
setTimeout(function () {
e.diagram.commandHandler.editTextBlock();
}, 20);
});
};
return $(go_module.Shape, {
figure: fig,
alignment: spot,
alignmentFocus: spot.opposite(),
width: spot.equals(go_module.Spot.Top) || spot.equals(go_module.Spot.Bottom) ? 25 : 18,
height: spot.equals(go_module.Spot.Top) || spot.equals(go_module.Spot.Bottom) ? 18 : 25,
fill: "orange",
stroke: colors.white,
strokeWidth: 4,
mouseEnter: function mouseEnter(e, shape) {
return shape.fill = "dodgerblue";
},
mouseLeave: function mouseLeave(e, shape) {
return shape.fill = "orange";
},
isActionable: true,
// needed because it's in an Adornment
click: maker,
contextClick: maker
});
}
// create a button that brings up the context menu
function CMButton(options) {
return $(go_module.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",
// M10 0 A2 2 0 1 0 14 10 M20 0 A2 2 0 1 0 24 10,
isActionable: true,
cursor: "context-menu",
mouseEnter: function mouseEnter(e, shape) {
return shape.fill = "dodgerblue";
},
mouseLeave: function mouseLeave(e, shape) {
return shape.fill = "orange";
},
click: function click(e, shape) {
e.diagram.commandHandler.showContextMenu(shape.part.adornedPart);
}
}, options || {});
}
myDiagram.current.nodeTemplate.selectionAdornmentTemplate = $(go_module.Adornment, "Spot", $(go_module.Placeholder, {
padding: 10
}), makeArrowButton(go_module.Spot.Top, "TriangleUp"), makeArrowButton(go_module.Spot.Left, "TriangleLeft"), makeArrowButton(go_module.Spot.Right, "TriangleRight"), makeArrowButton(go_module.Spot.Bottom, "TriangleDown"), CMButton({
alignment: new go_module.Spot(0.75, 0)
}));
// Common context menu button definitions
// All buttons in context menu work on both click and contextClick,
// in case the user context-clicks on the button.
// All buttons modify the node data, not the Node, so the Bindings need not be TwoWay.
// A button-defining helper function that returns a click event handler.
// PROPNAME is the name of the data property that should be set to the given VALUE.
function ClickFunction(propname, value) {
return function (e, obj) {
e.handled = true; // don't let the click bubble up
e.diagram.model.commit(function (m) {
m.set(obj.part.adornedPart.data, propname, value);
});
};
}
// Create a context menu button for setting a data property with a color value.
function ColorButton(color, propname) {
if (!propname) propname = "color";
return $(go_module.Shape, {
width: 16,
height: 16,
stroke: "lightgray",
fill: color,
margin: 1,
background: "transparent",
mouseEnter: function mouseEnter(e, shape) {
return shape.stroke = "dodgerblue";
},
mouseLeave: function mouseLeave(e, shape) {
return shape.stroke = "lightgray";
},
click: ClickFunction(propname, color),
contextClick: ClickFunction(propname, color)
});
}
function LightFillButtons() {
// used by multiple context menus
return [$("ContextMenuButton", $(go_module.Panel, "Horizontal", ColorButton(colors.white, "fill"), ColorButton(colors.beige, "fill"), ColorButton(colors.extralightblue, "fill"), ColorButton(colors.extralightred, "fill"))), $("ContextMenuButton", $(go_module.Panel, "Horizontal", ColorButton(colors.lightgray, "fill"), ColorButton(colors.lightgreen, "fill"), ColorButton(colors.lightblue, "fill"), ColorButton(colors.lightred, "fill")))];
}
function DarkColorButtons() {
// used by multiple context menus
return [$("ContextMenuButton", $(go_module.Panel, "Horizontal", ColorButton(colors.black), ColorButton(colors.green), ColorButton(colors.blue), ColorButton(colors.red))), $("ContextMenuButton", $(go_module.Panel, "Horizontal", ColorButton(colors.white), ColorButton(colors.magenta), ColorButton(colors.purple), ColorButton(colors.orange)))];
}
// Create a context menu button for setting a data property with a stroke width value.
function ThicknessButton(sw, propname) {
if (!propname) propname = "thickness";
return $(go_module.Shape, "LineH", {
width: 16,
height: 16,
strokeWidth: sw,
margin: 1,
background: "transparent",
mouseEnter: function mouseEnter(e, shape) {
return shape.background = "dodgerblue";
},
mouseLeave: function mouseLeave(e, shape) {
return shape.background = "transparent";
},
click: ClickFunction(propname, sw),
contextClick: ClickFunction(propname, sw)
});
}
// Create a context menu button for setting a data property with a stroke dash Array value.
function DashButton(dash, propname) {
if (!propname) propname = "dash";
return $(go_module.Shape, "LineH", {
width: 24,
height: 16,
strokeWidth: 2,
strokeDashArray: dash,
margin: 1,
background: "transparent",
mouseEnter: function mouseEnter(e, shape) {
return shape.background = "dodgerblue";
},
mouseLeave: function mouseLeave(e, shape) {
return shape.background = "transparent";
},
click: ClickFunction(propname, dash),
contextClick: ClickFunction(propname, dash)
});
}
function StrokeOptionsButtons() {
// used by multiple context menus
return [$("ContextMenuButton", $(go_module.Panel, "Horizontal", ThicknessButton(1), ThicknessButton(2), ThicknessButton(3), ThicknessButton(4))), $("ContextMenuButton", $(go_module.Panel, "Horizontal", DashButton(null), DashButton([2, 4]), DashButton([4, 4])))];
}
// Node context menu
function FigureButton(fig, propname) {
if (!propname) propname = "figure";
return $(go_module.Shape, {
width: 32,
height: 32,
scale: 0.5,
fill: "lightgray",
figure: fig,
margin: 1,
background: "transparent",
mouseEnter: function mouseEnter(e, shape) {
return shape.fill = "dodgerblue";
},
mouseLeave: function mouseLeave(e, shape) {
return shape.fill = "lightgray";
},
click: ClickFunction(propname, fig),
contextClick: ClickFunction(propname, fig)
});
}
myDiagram.current.nodeTemplate.contextMenu = $("ContextMenu",
// $("ContextMenuButton",
// $(go.TextBlock, 'Move Up', {
// // Associate the custom command to move the node up
// click: (e, obj) => {
// const node = obj.part.adornedPart;
// myDiagram.current.commandHandler['MoveNodeUp'].execute(myDiagram.current);
// }
// })
// ),
// $("ContextMenuButton",
// $(go.TextBlock, 'Move Up', {
// // Associate the custom command to move the node up
// click: (e, obj) => {
// const node = obj.part.adornedPart;
// myDiagram.current.commandHandler['moveNodeUpCommand'].execute(myDiagram.current);
// }
// })
// ),
$("ContextMenuButton", $(go_module.Panel, "Horizontal", FigureButton("Rectangle"), FigureButton("RoundedRectangle"), FigureButton("Ellipse"), FigureButton("Diamond"))), $("ContextMenuButton", $(go_module.Panel, "Horizontal", FigureButton("Parallelogram2"), FigureButton("ManualOperation"), FigureButton("Procedure"), FigureButton("Cylinder1"))), $("ContextMenuButton", $(go_module.Panel, "Horizontal", FigureButton("Terminator"), FigureButton("CreateRequest"), FigureButton("Document"), FigureButton("TriangleDown"))), LightFillButtons(), DarkColorButtons(), StrokeOptionsButtons());
// Group template
myDiagram.current.groupTemplate = $(go_module.Group, "Spot", {
layerName: "Background",
ungroupable: true,
locationSpot: go_module.Spot.Center,
selectionObjectName: "BODY",
computesBoundsAfterDrag: true,
// allow dragging out of a Group that uses a Placeholder
handlesDragDropForMembers: true,
// don't need to define handlers on Nodes and Links
mouseDrop: function mouseDrop(e, grp) {
// add dropped nodes as members of the group
var ok = grp.addMembers(grp.diagram.selection, true);
if (!ok) grp.diagram.currentTool.doCancel();
},
avoidable: false
}, new go_module.Binding("location", "loc", go_module.Point.parse).makeTwoWay(go_module.Point.stringify), $(go_module.Panel, "Auto", {
name: "BODY"
}, $(go_module.Shape, {
parameter1: 10,
fill: colors.white,
strokeWidth: 2,
cursor: "pointer",
fromLinkable: true,
toLinkable: true,
fromLinkableDuplicates: true,
toLinkableDuplicates: true,
fromSpot: go_module.Spot.AllSides,
toSpot: go_module.Spot.AllSides
}, new go_module.Binding("fill"), new go_module.Binding("stroke", "color"), new go_module.Binding("strokeWidth", "thickness"), new go_module.Binding("strokeDashArray", "dash")), $(go_module.Placeholder, {
background: "transparent",
margin: 20
})), $(go_module.TextBlock, {
alignment: go_module.Spot.Top,
alignmentFocus: go_module.Spot.Bottom,
font: "bold 12pt sans-serif",
editable: true
}, new go_module.Binding("text"), new go_module.Binding("stroke", "color")));
myDiagram.current.groupTemplate.selectionAdornmentTemplate = $(go_module.Adornment, "Spot", $(go_module.Panel, "Auto", $(go_module.Shape, {
fill: null,
stroke: "dodgerblue",
strokeWidth: 3
}), $(go_module.Placeholder, {
margin: 1.5
})), CMButton({
alignment: go_module.Spot.TopRight,
alignmentFocus: go_module.Spot.BottomRight
}));
// 右键
myDiagram.current.groupTemplate.contextMenu = $("ContextMenu", LightFillButtons(), DarkColorButtons(), StrokeOptionsButtons());
// Link template
myDiagram.current.linkTemplate = $(go_module.Link, {
layerName: "Foreground",
routing: go_module.Link.AvoidsNodes,
corner: 10,
fromShortLength: 10,
toShortLength: 15,
// assume arrowhead at "to" end, need to avoid bad appearance when path is thick
relinkableFrom: true,
relinkableTo: true,
reshapable: true,
resegmentable: true
}, new go_module.Binding("fromSpot", "fromSpot", go_module.Spot.parse), new go_module.Binding("toSpot", "toSpot", go_module.Spot.parse), new go_module.Binding("fromShortLength", "dir", function (dir) {
return dir >= 1 ? 10 : 0;
}), new go_module.Binding("toShortLength", "dir", function (dir) {
return dir >= 1 ? 10 : 0;
}), new go_module.Binding("points").makeTwoWay(),
// TwoWay due to user reshaping with LinkReshapingTool
$(go_module.Shape, {
strokeWidth: 2
}, new go_module.Binding("stroke", "color"), new go_module.Binding("strokeWidth", "thickness"), new go_module.Binding("strokeDashArray", "dash")), $(go_module.Shape,
// custom arrowheads to create the lifted effect
{
segmentIndex: 0,
segmentOffset: new go_module.Point(15, 0),
segmentOrientation: go_module.Link.OrientAlong,
alignmentFocus: go_module.Spot.Right,
figure: "circle",
width: 10,
strokeWidth: 0
}, new go_module.Binding("fill", "color"), new go_module.Binding("visible", "dir", function (dir) {
return dir === 1;
})), $(go_module.Shape, {
segmentIndex: -1,
segmentOffset: new go_module.Point(-10, 6),
segmentOrientation: go_module.Link.OrientPlus90,
alignmentFocus: go_module.Spot.Right,
figure: "triangle",
width: 12,
height: 12,
strokeWidth: 0
}, new go_module.Binding("fill", "color"), new go_module.Binding("visible", "dir", function (dir) {
return dir >= 1;
}), new go_module.Binding("width", "thickness", function (t) {
return 7 + 3 * t;
}),
// custom arrowhead must scale with the size of the while
new go_module.Binding("height", "thickness", function (t) {
return 7 + 3 * t;
}),
// while remaining centered on line
new go_module.Binding("segmentOffset", "thickness", function (t) {
return new go_module.Point(-15, 4 + 1.5 * t);
})), $(go_module.Shape, {
segmentIndex: 0,
segmentOffset: new go_module.Point(15, -6),
segmentOrientation: go_module.Link.OrientMinus90,
alignmentFocus: go_module.Spot.Right,
figure: "triangle",
width: 12,
height: 12,
strokeWidth: 0
}, new go_module.Binding("fill", "color"), new go_module.Binding("visible", "dir", function (dir) {
return dir === 2;
}), new go_module.Binding("width", "thickness", function (t) {
return 7 + 3 * t;
}), new go_module.Binding("height", "thickness", function (t) {
return 7 + 3 * t;
}), new go_module.Binding("segmentOffset", "thickness", function (t) {
return new go_module.Point(-15, 4 + 1.5 * t);
})), $(go_module.TextBlock, {
alignmentFocus: new go_module.Spot(0, 1, -4, 0),
editable: true
}, new go_module.Binding("text").makeTwoWay(),
// TwoWay due to user editing with TextEditingTool
new go_module.Binding("stroke", "color")));
myDiagram.current.linkTemplate.selectionAdornmentTemplate = $(go_module.Adornment,
// use a special selection Adornment that does not obscure the link path itself
$(go_module.Shape, {
// this uses a pathPattern with a gap in it, in order to avoid drawing on top of the link path Shape
isPanelMain: true,
stroke: "transparent",
strokeWidth: 6,
pathPattern: makeAdornmentPathPattern(2) // == thickness or strokeWidth
}, new go_module.Binding("pathPattern", "thickness", makeAdornmentPathPattern)), CMButton({
alignmentFocus: new go_module.Spot(0, 0, -6, -4)
}));
function makeAdornmentPathPattern(w) {
return $(go_module.Shape, {
stroke: "dodgerblue",
strokeWidth: 2,
strokeCap: "square",
geometryString: "M0 0 M4 2 H3 M4 " + (w + 4).toString() + " H3"
});
}
// Link context menu
// All buttons in context menu work on both click and contextClick,
// in case the user context-clicks on the button.
// All buttons modify the link data, not the Link, so the Bindings need not be TwoWay.
function ArrowButton(num) {
var geo = "M0 0 M8 16 M0 8 L16 8 M12 11 L16 8 L12 5";
if (num === 0) {
geo = "M0 0 M16 16 M0 8 L16 8";
} else if (num === 2) {
geo = "M0 0 M16 16 M0 8 L16 8 M12 11 L16 8 L12 5 M4 11 L0 8 L4 5";
}
return $(go_module.Shape, {
geometryString: geo,
margin: 2,
background: "transparent",
mouseEnter: function mouseEnter(e, shape) {
return shape.background = "dodgerblue";
},
mouseLeave: function mouseLeave(e, shape) {
return shape.background = "transparent";
},
click: ClickFunction("dir", num),
contextClick: ClickFunction("dir", num)
});
}
function AllSidesButton(to) {
var setter = function setter(e, shape) {
e.handled = true;
e.diagram.model.commit(function (m) {
var link = shape.part.adornedPart;
m.set(link.data, to ? "toSpot" : "fromSpot", go_module.Spot.stringify(go_module.Spot.AllSides));
// re-spread the connections of other links connected with the node
(to ? link.toNode : link.fromNode).invalidateConnectedLinks();
});
};
return $(go_module.Shape, {
width: 12,
height: 12,
fill: "transparent",
mouseEnter: function mouseEnter(e, shape) {
return shape.background = "dodgerblue";
},
mouseLeave: function mouseLeave(e, shape) {
return shape.background = "transparent";
},
click: setter,
contextClick: setter
});
}
function SpotButton(spot, to) {
var ang = 0;
var side = go_module.Spot.RightSide;
if (spot.equals(go_module.Spot.Top)) {
ang = 270;
side = go_module.Spot.TopSide;
} else if (spot.equals(go_module.Spot.Left)) {
ang = 180;
side = go_module.Spot.LeftSide;
} else if (spot.equals(go_module.Spot.Bottom)) {
ang = 90;
side = go_module.Spot.BottomSide;
}
if (!to) ang -= 180;
var setter = function setter(e, shape) {
e.handled = true;
e.diagram.model.commit(function (m) {
var link = shape.part.adornedPart;
m.set(link.data, to ? "toSpot" : "fromSpot", go_module.Spot.stringify(side));
// re-spread the connections of other links connected with the node
(to ? link.toNode : link.fromNode).invalidateConnectedLinks();
});
};
return $(go_module.Shape, {
alignment: spot,
alignmentFocus: spot.opposite(),
geometryString: "M0 0 M12 12 M12 6 L1 6 L4 4 M1 6 L4 8",
angle: ang,
background: "transparent",
mouseEnter: function mouseEnter(e, shape) {
return shape.background = "dodgerblue";
},
mouseLeave: function mouseLeave(e, shape) {
return shape.background = "transparent";
},
click: setter,
contextClick: setter
});
}
myDiagram.current.linkTemplate.contextMenu = $("ContextMenu", DarkColorButtons(), StrokeOptionsButtons(), $("ContextMenuButton", $(go_module.Panel, "Horizontal", ArrowButton(0), ArrowButton(1), ArrowButton(2))), $("ContextMenuButton", $(go_module.Panel, "Horizontal", $(go_module.Panel, "Spot", AllSidesButton(false), SpotButton(go_module.Spot.Top, false), SpotButton(go_module.Spot.Left, false), SpotButton(go_module.Spot.Right, false), SpotButton(go_module.Spot.Bottom, false)), $(go_module.Panel, "Spot", {
margin: new go_module.Margin(0, 0, 0, 2)
}, AllSidesButton(true), SpotButton(go_module.Spot.Top, true), SpotButton(go_module.Spot.Left, true), SpotButton(go_module.Spot.Right, true), SpotButton(go_module.Spot.Bottom, true)))));
var initData = "{ \"class\": \"GraphLinksModel\",\n \"nodeDataArray\": [\n{\"text\":\"Find Problem\",\"key\":-9,\"loc\":\"-20 -140\",\"color\":\"#3358ff\",\"fill\":\"white\",\"figure\":\"Procedure\",\"thickness\":3},\n{\"text\":\"What do we want?\",\"key\":-10,\"loc\":\"-65 -324.305\",\"group\":-16,\"figure\":\"Ellipse\",\"fill\":\"white\"},\n{\"text\":\"What do our users want?\",\"key\":-11,\"loc\":\"105 -334.305\",\"group\":-20,\"figure\":\"Ellipse\",\"fill\":\"#ffffff\",\"color\":\"black\"},\n{\"text\":\"Meetings\",\"key\":-12,\"loc\":\"-65 -444.305\",\"group\":-16,\"figure\":\"TriangleDown\",\"fill\":\"#ffffff\"},\n{\"text\":\"Reviews\",\"key\":-13,\"loc\":\"105 -454.305\",\"group\":-20,\"figure\":\"TriangleDown\",\"fill\":\"#ffffff\",\"color\":\"black\"},\n{\"text\":\"Can we solve it?\",\"key\":-14,\"loc\":\"190 -140\",\"color\":\"#7d33ff\",\"fill\":\"#ffffff\",\"figure\":\"Diamond\",\"size\":\"140 80\",\"thickness\":3},\n{\"isGroup\":true,\"text\":\"Internal\",\"key\":-16,\"loc\":\"-65 -384.305\",\"fill\":\"#d5ebff\",\"dash\":null,\"thickness\":1,\"group\":-22},\n{\"isGroup\":true,\"text\":\"External\",\"key\":-20,\"loc\":\"105 -394.305\",\"fill\":\"#d5ebff\",\"dash\":null,\"thickness\":1,\"group\":-22},\n{\"isGroup\":true,\"text\":\"Sources\",\"key\":-22,\"loc\":\"20 -400\",\"fill\":\"#a5d2fa\",\"dash\":[4,4],\"color\":\"#3358ff\"}\n],\n \"linkDataArray\": [\n{\"from\":-12,\"to\":-10,\"points\":[-65,-414.305,-65,-404.305,-65,-384.305,-65,-384.305,-65,-364.305,-65,-354.305],\"dash\":null,\"dir\":1},\n{\"from\":-13,\"to\":-11,\"points\":[105,-424.305,105,-414.305,105,-394.305,105,-394.305,105,-374.305,105,-364.305],\"dash\":null,\"color\":\"#000000\",\"dir\":1},\n{\"from\":-10,\"to\":-9,\"points\":[-65,-294.305,-65,-284.305,-65,-232.1525,-40,-232.1525,-40,-180,-40,-170],\"dir\":2,\"dash\":[4,4]},\n{\"from\":-11,\"to\":-9,\"points\":[105,-304.305,105,-294.305,105,-237.1525,0,-237.1525,0,-180,0,-170],\"dash\":[4,4],\"dir\":2},\n{\"from\":-9,\"to\":-14,\"points\":[40,-150,58,-150,80,-150,80,-153.33333333333331,102,-153.33333333333331,120,-153.33333333333331],\"dir\":1,\"color\":\"#3358ff\"},\n{\"from\":-14,\"to\":-9,\"points\":[190,-100,190,-90,-20,-90,-20,-95,-20,-100,-20,-110],\"fromSpot\":\"BottomSide\",\"toSpot\":\"BottomSide\",\"text\":\"No\",\"color\":\"#ff3333\",\"thickness\":2,\"dir\":1},\n{\"from\":-9,\"to\":-14,\"points\":[40,-130,58,-130,80,-130,80,-126.66666666666666,102,-126.66666666666666,120,-126.66666666666666]}\n]}";
// myDiagram.current.model = go.Model.fromJson(initData);
// start
var builtIn = ["Rectangle", "Square", "RoundedRectangle", "Border", "Ellipse", "Circle", "TriangleRight", "TriangleDown", "TriangleLeft", "TriangleUp", "Triangle", "Diamond", "LineH", "LineV", "None", "BarH", "BarV", "MinusLine", "PlusLine", "XLine", "LineRight", "LineDown", "LineLeft", "LineUp"];
function isBuiltIn(shapeName) {
console.log("shapeName:", shapeName);
return builtIn.indexOf(shapeName) >= 0;
}
var myPalette = new go_module.Palette(myPaletteDivRef.current,
// must name or refer to the DIV HTML element
{
maxSelectionCount: 1,
// nodeTemplateMap: myDiagram.current.nodeTemplateMap, // share the templates used by myDiagram.current
linkTemplate:
// simplify the link template, just in this Palette
$(go_module.Link, {
// because the GridLayout.alignment is Location and the nodes have locationSpot == Spot.Center,
// to line up the Link in the same manner we have to pretend the Link has the same location spot
locationSpot: go_module.Spot.Center,
selectionAdornmentTemplate: $(go_module.Adornment, "Link", {
locationSpot: go_module.Spot.Center
}, $(go_module.Shape, {
isPanelMain: true,
fill: null,
stroke: "deepskyblue",
strokeWidth: 0
}), $(go_module.Shape,
// the arrowhead
{
toArrow: "Standard",
stroke: null
}))
}, {
routing: go_module.Link.AvoidsNodes,
curve: go_module.Link.JumpOver,
corner: 5,
toShortLength: 4
}, new go_module.Binding("points"), $(go_module.Shape,
// the link path shape
{
isPanelMain: true,
strokeWidth: 2
}), $(go_module.Shape,
// the arrowhead
{
toArrow: "Standard",
stroke: null
})),
model: new go_module.GraphLinksModel([
// specify the contents of the Palette
{
text: "未命名",
"size": "100 100",
fill: null,
stroke: "#000"
}].concat(toConsumableArray_default()(go_module.Shape.getFigureGenerators().toArray().map(function (item) {
return {
text: "未命名",
"size": "100 100",
figure: item.key,
fill: "white",
stroke: "#666",
borderColor: "#000"
};
})))) // [
// // the Palette also has a disconnected Link, which the user can drag-and-drop
// { points: new go.List(/*go.Point*/).addAll([new go.Point(0, 0), new go.Point(30, 0), new go.Point(30, 40), new go.Point(60, 40)]) }
// ]
});
// $("ContextMenuButton",
// $(go.Panel, "Horizontal",
// FigureButton("Rectangle"), FigureButton("RoundedRectangle"), FigureButton("Ellipse"), FigureButton("Diamond")
// )
// ),
// $("ContextMenuButton",
// $(go.Panel, "Horizontal",
// FigureButton("Parallelogram2"), FigureButton("ManualOperation"), FigureButton("Procedure"), FigureButton("Cylinder1")
// )
// ),
// $("ContextMenuButton",
// $(go.Panel, "Horizontal",
// FigureButton("Terminator"), FigureButton("CreateRequest"), FigureButton("Document"), FigureButton("TriangleDown")
// )
// ),
myPalette.nodeTemplate = $(go_module.Node, "Auto", {
locationSpot: go_module.Spot.Center
}, new go_module.Binding("location", "location", go_module.Point.parse).makeTwoWay(go_module.Point.stringify), $(go_module.Shape, "Circle", {
fill: "white",
stroke: "gray",
strokeWidth: 2,
width: 20,
height: 20,
portId: "",
fromLinkable: true,
toLinkable: true,
fromLinkableDuplicates: true,
toLinkableDuplicates: true,
fromLinkableSelfNode: true,
toLinkableSelfNode: true
}, new go_module.Binding("stroke").makeTwoWay(), new go_module.Binding("fill").makeTwoWay(), new go_module.Binding("figure")), $(go_module.TextBlock, {
margin: new go_module.Margin(5, 5, 3, 5),
font: "10pt sans-serif",
minSize: new go_module.Size(16, 16),
maxSize: new go_module.Size(10, NaN),
textAlign: "center",
editable: true
}, new go_module.Binding("key").makeTwoWay()));
// end
setTimeout(function () {
myDiagram.current.grid = $(go_module.Panel, "Grid", $(go_module.Shape, "LineH", {
stroke: "lightgray",
strokeWidth: 0.5
}), $(go_module.Shape, "LineV", {
stroke: "lightgray",
strokeWidth: 0.5
}));
myDiagram.current.grid.visible = true; // 隐藏网格
myDiagram.current.grid.gridCellStroke = "darkgray"; // 设置网格线的颜色
myDiagram.current.grid.gridCellStrokeWidth = 1; // 设置网格线的粗细
}, 300);
window.myDiagrams = myDiagram.current;
return myDiagram.current;
}
var save = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var imgs, res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
// console.log(JSON.stringify(myDiagram.current.model.toJson()))
imgs = myDiagram.current.makeImage();
_context.next = 3;
return (0,fetch/* default */.ZP)('/api/attachments.json', {
method: 'post',
body: {
file_type: 'base64',
original_filename: Date.now(),
file: imgs.src
}
});
case 3:
res = _context.sent;
callback({
src: res.url
});
case 5:
case "end":
return _context.stop();
}
}, _callee);
}));
return function save() {
return _ref2.apply(this, arguments);
};
}();
(0,_react_17_0_2_react.useEffect)(function () {
setUpdateModal(updateModal + 1);
}, []);
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: modalRef,
className: hidedenContentRef.current ? "".concat(flow_chartmodules.maxH60, " body-overflow-initial") : "body-overflow-initial",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
width: 1200,
icon: null,
footer: null,
closable: true,
visible: !!updateModal,
destroyOnClose: true,
maskClosable: false,
getContainer: modalRef.current,
rootClassName: "zIndex-9999",
title: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: 1,
children: "\u63D2\u5165\u6D41\u7A0B\u56FE"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
onClick: function onClick() {
hidedenContentRef.current = !hidedenContentRef.current;
setUpdateModal(updateModal + 1);
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "current c-blue mr30",
style: {
fontWeight: 400
},
children: "\u5C55\u5F00/\u6536\u8D77"
})
})]
}),
onCancel: onCancel,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
width: "100%",
height: "80vh",
overflow: "hidden",
position: "relative"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: "flex",
height: "100%"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
width: "300px",
height: "100%"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
background: "#fff",
position: "relative",
zIndex: 12,
fontSize: 16,
color: "#3061d0"
},
children: "\u56FE\u5F62\u5E93"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
height: "calc(100% - 50px)"
},
className: flow_chartmodules.myPaletteDiv,
ref: myPaletteDivRef
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
flex: 1,
position: "relative"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(gojsreact/* ReactDiagram */.FI, {
initDiagram: initDiagram,
divClassName: "diagram-component",
style: {
height: "80vh"
}
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: myDiagramDivRef
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "tr",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
size: "large",
onClick: save,
style: {
position: "absolute",
right: 0,
bottom: 0,
zIndex: 8
},
type: "primary",
children: "\u4FDD\u5B58\u5230\u7F16\u8F91\u5668"
})
})]
})
})
});
}
/* harmony default export */ var flow_chart = (FlowChart);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
var es_radio = __webpack_require__(5112);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input-number/index.js + 14 modules
var input_number = __webpack_require__(97913);
;// CONCATENATED MODULE: ./src/components/markdown-editor/add-table-panel/index.tsx
var RadioGroup = es_radio/* default.Group */.ZP.Group;
var add_table_panel_style = {
margin: '0 8px'
};
/* harmony default export */ var add_table_panel = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
function onSubmit(values) {
callback(values);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
className: "add-table-panel",
initialValues: {
row: 3,
col: 2,
align: 'default'
},
onFinish: onSubmit,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
style: {
alignItems: "baseline"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: add_table_panel_style,
children: "\u5355\u5143\u683C\u6570\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: add_table_panel_style,
children: "\u884C\u6570"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "row",
rules: [{
required: true,
message: '请输入行数'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: add_table_panel_style,
children: "\u5217\u6570"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "col",
rules: [{
required: true,
message: '请输入列数'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
style: {
marginTop: 12,
alignItems: "baseline"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: add_table_panel_style,
children: "\u5BF9\u9F50\u65B9\u5F0F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "align",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(RadioGroup, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "default",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-justify"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "left",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-left"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "center",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-center"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "right",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-right"
})
})]
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container flex-end",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "ghost",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
});
});
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/switch/index.js + 2 modules
var es_switch = __webpack_require__(78673);
// EXTERNAL MODULE: ./src/components/MathematicalGraphics/js/index.js
var js = __webpack_require__(38415);
var js_default = /*#__PURE__*/__webpack_require__.n(js);
;// CONCATENATED MODULE: ./src/components/MathematicalGraphics/index.tsx
var MathematicalGraphics_FlowChart = /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(function (_ref, ref) {
var use3d = _ref.use3d,
width = _ref.width,
height = _ref.height,
callback = _ref.callback,
showSaveButton = _ref.showSaveButton;
var ggbAppletRef = (0,_react_17_0_2_react.useRef)();
var appletRef = (0,_react_17_0_2_react.useRef)();
var _useState = (0,_react_17_0_2_react.useState)(false),
_useState2 = slicedToArray_default()(_useState, 2),
is3D = _useState2[0],
setIs3d = _useState2[1];
var parameters = (0,_react_17_0_2_react.useRef)({
"id": ggbAppletRef,
"appName": "graphing",
"width": width || 1000,
"height": height || 600,
"showToolBar": true,
"showMenuBar": true,
"allowStyleBar": true,
"showAlgebraInput": true,
"enableLabelDrags": false,
"enableShiftDragZoom": true,
"showToolBarHelp": false,
"errorDialogsActive": true,
"showTutorialLink": true,
"showLogging": true,
"useBrowserForJS": false
});
(0,_react_17_0_2_react.useEffect)(function () {
appletRef.current = new (js_default())(parameters.current, true);
window.onload = function () {
appletRef.current.inject('applet_container');
};
}, []);
var getImgData = function getImgData() {
var str = window.ggbApplet.getPNGBase64(1, true, 72);
callback && callback(str);
return str;
};
(0,_react_17_0_2_react.useEffect)(function () {
parameters.current.appName = is3D ? "3D" : "graphing";
appletRef.current.inject('applet_container');
}, [is3D]);
(0,_react_17_0_2_react.useEffect)(function () {
setIs3d(use3d);
}, [use3d]);
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
return {
getImgData: getImgData
};
});
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
width: "100%",
height: "100%"
},
id: "applet_container",
ref: ggbAppletRef
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: 1,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_switch/* default */.Z, {
size: "default",
checkedChildren: "\u5173\u95ED3D\u56FE\u50CF",
unCheckedChildren: "\u5F00\u542F3D\u56FE\u50CF",
checked: is3D,
onChange: function onChange(e) {
return setIs3d(e);
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
size: "large",
onClick: getImgData,
style: {
zIndex: 8,
marginTop: 10
},
type: "primary",
children: "\u4FDD\u5B58\u5230\u7F16\u8F91\u5668"
})
})]
})]
});
});
/* harmony default export */ var MathematicalGraphics = (MathematicalGraphics_FlowChart);
// EXTERNAL MODULE: ./src/components/MathsLatexKeybords/keybords.tsx
var keybords = __webpack_require__(59277);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(33259);
;// CONCATENATED MODULE: ./src/components/markdown-editor/constant.ts
var LINK = 'link';
var UPLOAD_IMAGE = 'upload-image';
var ADD_FLOWCHART = 'add-flowchart';
var DRAW_IMAGE = 'draw-image';
var FLOW_CHART = 'add-flowchart';
var CODE_BLOCK = 'code-block';
var ADD_TABLE = 'add-table';
var HRLINE = '------------';
var ALIGNSIGN = {
"default": HRLINE,
left: ":".concat(HRLINE),
center: ":".concat(HRLINE, ":"),
right: "".concat(HRLINE, ":")
};
// EXTERNAL MODULE: ./src/components/useInterval.tsx
var useInterval = __webpack_require__(59587);
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.tsx
function noop() {}
var pending = 0;
var StorageTimeTicket = 10000;
var NULL_CH = '▁';
var ADD_MULTI = '@▁▁@';
var ADD_SINGLE = '@▁@';
var TEMP1 = '\n**模板标题**\n模板正文内容可输入文本内容和粘贴图片等操作'; //课程须知模板
var officeSix = ["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 processSize(size) {
return !/^\d+$/.test(size) ? size : "".concat(size, "px");
}
var isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
var key = isMac ? 'Cmd' : 'Ctrl';
var DEFAULTKEYMAP = defineProperty_default()(defineProperty_default()({}, key + '-B', 'bold'), key + '-I', 'italic');
var TitleDesc = defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, LINK, '添加链接'), CODE_BLOCK, '添加代码块'), UPLOAD_IMAGE, '添加图片'), DRAW_IMAGE, '添加画图'), ADD_FLOWCHART, '插入流程图'), ADD_TABLE, '添加表格'), 'maths-latex', "数学图像"), 'inline-latex', "LATEX公式");
//https://codemirror.net/demo
//The height can be set through CSS (by giving the .CodeMirror class a height property), or by calling the cm's setSize method.
/* harmony default export */ var markdown_editor = (function (_ref) {
var _ref$defaultValue = _ref.defaultValue,
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
onChange = _ref.onChange,
_ref$width = _ref.width,
width = _ref$width === void 0 ? '100%' : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 400 : _ref$height,
_ref$miniToolbar = _ref.miniToolbar,
miniToolbar = _ref$miniToolbar === void 0 ? false : _ref$miniToolbar,
_ref$isFocus = _ref.isFocus,
isFocus = _ref$isFocus === void 0 ? false : _ref$isFocus,
watch = _ref.watch,
insertTemp = _ref.insertTemp,
_ref$mode = _ref.mode,
mode = _ref$mode === void 0 ? "markdown" : _ref$mode,
_ref$id = _ref.id,
id = _ref$id === void 0 ? 'markdown-editor-id' : _ref$id,
_ref$showResizeBar = _ref.showResizeBar,
showResizeBar = _ref$showResizeBar === void 0 ? false : _ref$showResizeBar,
_ref$noStorage = _ref.noStorage,
noStorage = _ref$noStorage === void 0 ? false : _ref$noStorage,
_ref$showNullButton = _ref.showNullButton,
showNullButton = _ref$showNullButton === void 0 ? false : _ref$showNullButton,
_ref$showNullProgramB = _ref.showNullProgramButton,
showNullProgramButton = _ref$showNullProgramB === void 0 ? false : _ref$showNullProgramB,
_ref$hidetoolBar = _ref.hidetoolBar,
hidetoolBar = _ref$hidetoolBar === void 0 ? false : _ref$hidetoolBar,
_ref$fullScreen = _ref.fullScreen,
fullScreen = _ref$fullScreen === void 0 ? false : _ref$fullScreen,
onBlur = _ref.onBlur,
onCMBeforeChange = _ref.onCMBeforeChange,
onFullScreen = _ref.onFullScreen,
_ref$className = _ref.className,
className = _ref$className === void 0 ? '' : _ref$className,
_ref$disablePaste = _ref.disablePaste,
disablePaste = _ref$disablePaste === void 0 ? false : _ref$disablePaste,
_ref$disabled = _ref.disabled,
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
_ref$disabledFill = _ref.disabledFill,
disabledFill = _ref$disabledFill === void 0 ? false : _ref$disabledFill,
_ref$placeholder = _ref.placeholder,
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
_ref$values = _ref.values,
values = _ref$values === void 0 ? '' : _ref$values,
extraUse = _ref.extraUse;
var _useState = (0,_react_17_0_2_react.useState)(null),
_useState2 = slicedToArray_default()(_useState, 2),
cm = _useState2[0],
setCm = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(defaultValue),
_useState4 = slicedToArray_default()(_useState3, 2),
value = _useState4[0],
setValue = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(watch),
_useState6 = slicedToArray_default()(_useState5, 2),
preview = _useState6[0],
setPreview = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(fullScreen),
_useState8 = slicedToArray_default()(_useState7, 2),
isFull = _useState8[0],
setIsFull = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)(''),
_useState10 = slicedToArray_default()(_useState9, 2),
action = _useState10[0],
setAction = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)(0),
_useState12 = slicedToArray_default()(_useState11, 2),
lastedUpdateTime = _useState12[0],
setLastedUpdateTime = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)(height),
_useState14 = slicedToArray_default()(_useState13, 2),
h = _useState14[0],
setH = _useState14[1];
var _useState15 = (0,_react_17_0_2_react.useState)(false),
_useState16 = slicedToArray_default()(_useState15, 2),
tip = _useState16[0],
setTip = _useState16[1];
var cmEl = (0,_react_17_0_2_react.useRef)();
var containerEl = (0,_react_17_0_2_react.useRef)();
var resizeBarEl = (0,_react_17_0_2_react.useRef)();
var previewEl = (0,_react_17_0_2_react.useRef)();
// useEffect(() => {
// setValue(defaultValue)
// cm?.setValue(defaultValue)
// },[])
(0,_react_17_0_2_react.useEffect)(function () {
var scrollTop = window.scrollY || window.pageYOffset;
setValue(values);
cm === null || cm === void 0 || cm.setValue(values);
window.scrollTo(0, scrollTop);
}, [values]);
(0,_react_17_0_2_react.useEffect)(function () {
onFullScreen === null || onFullScreen === void 0 || onFullScreen(isFull);
}, [isFull]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cmEl.current) {
var onPaste = function onPaste(_, e) {
if (disablePaste) {
e.preventDefault();
return;
}
var clipboardData = e.clipboardData;
if (clipboardData) {
var types = clipboardData.types.toString();
var items = clipboardData.items;
if (types === 'Files' || clipboardData.types.indexOf("Files") > -1) {
e.preventDefault();
if (mode == "stex") return;
try {
var _items$;
var item = items[1];
if (((_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.kind) === 'file') {
item = items[0];
}
var file = item.getAsFile();
var fileSix = file.name.split(".").pop();
// console.log("item:", item, file, item?.type?.match(/^video\//i))
uploadImage(file, function (data) {
if (data.id) {
var _file$type, _file$type2, _file$type3;
if ((file === null || file === void 0 || (_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.indexOf("image")) > -1) {
instance.replaceSelection("![,](/api/attachments/".concat(data.id, "?type=").concat(data.content_type, ")"));
} else if ((file === null || file === void 0 || (_file$type2 = file.type) === null || _file$type2 === void 0 ? void 0 : _file$type2.indexOf("video")) > -1) {
instance.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
} else if ((file === null || file === void 0 || (_file$type3 = file.type) === null || _file$type3 === void 0 ? void 0 : _file$type3.indexOf("pdf")) > -1) {
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(file.type, "&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else if (officeSix.includes(fileSix)) {
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=office&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else {
instance.replaceSelection("[".concat(file.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(data.content_type, ")"));
}
} else {
if ((data === null || data === void 0 ? void 0 : data.status) === 401) document.location.href = '/user/login';
}
});
} catch (e) {
message/* default */.ZP.warning("请使用chrome浏览器粘贴");
}
return true;
} else {
//toMarkdown ?
// let html = clipboardData.getData('text/html')
return true;
}
}
return true;
};
var instance = codemirror_default().fromTextArea(cmEl.current, {
mode: mode,
// inputStyle: 'contenteditable',
lineNumbers: miniToolbar ? false : true,
lineWrapping: true,
value: defaultValue,
autoCloseTags: true,
autoCloseBrackets: true
});
instance.on("keyup", function (cm, event) {
if (event.keyCode === 8) {
if (cm.getValue() == "") {
instance.setOption("placeholder", placeholder);
} else {
instance.setOption("placeholder", null);
}
}
});
instance.on("keydown", function (cm, event) {
if (event.keyCode === 8) {
var pos = deleteAtSymbol(cm);
if (pos) {
event.preventDefault();
}
}
});
isFocus && instance.focus();
instance.on('paste', onPaste);
if (disabled) {
instance.on("beforeChange", function (instances, change) {
if (change.origin === "paste" || change.origin === "+input") {
change.cancel();
}
});
}
setCm(instance);
return function () {
instance.off('paste', onPaste);
};
}
}, []);
var resizeEditorBodyHeight = (0,_react_17_0_2_react.useCallback)(function () {
if (containerEl.current) {
try {
// let toolH = containerEl.current.getElementsByClassName('markdown-toolbar-container')[0].offsetHeight
// let mdBody = containerEl.current.getElementsByClassName('markdown-editor-body')[0]
// if (!isFull) {
// mdBody.style.height = `${h - toolH}px`
// } else {
// mdBody.style.height = `calc(100vh - ${toolH}px)`
// }
} catch (error) {
console.log(error, '---- to set md editor body height');
}
}
}, [h, containerEl, isFull]);
(0,_react_17_0_2_react.useEffect)(function () {
function onLayout() {
var ro = new ResizeObserver_es/* default */.Z(function (entries) {
var _iterator = createForOfIteratorHelper_default()(entries),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var entry = _step.value;
if (entry.target.offsetHeight > 0 || entry.target.offsetWidth > 0) {
resizeEditorBodyHeight();
cm.setSize('100%', '100%');
cm.refresh();
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
});
ro.observe(cmEl.current.parentElement);
return ro;
}
if (cm) {
var ro = onLayout();
return function () {
var _cmEl$current, _cmEl$current2;
if ((_cmEl$current = cmEl.current) !== null && _cmEl$current !== void 0 && _cmEl$current.parentElement) ro.unobserve((_cmEl$current2 = cmEl.current) === null || _cmEl$current2 === void 0 ? void 0 : _cmEl$current2.parentElement);
};
}
}, [cm, resizeEditorBodyHeight]);
//keymap
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
var keymap = [];
var _loop = function _loop() {
var _Object$entries$_i = slicedToArray_default()(_Object$entries[_i], 2),
k = _Object$entries$_i[0],
value = _Object$entries$_i[1];
var map = defineProperty_default()({}, k, function () {
onActionCallback(value);
});
keymap.push(map);
cm.addKeyMap(map);
};
for (var _i = 0, _Object$entries = Object.entries(DEFAULTKEYMAP); _i < _Object$entries.length; _i++) {
_loop();
}
return function () {
for (var _i2 = 0, _keymap = keymap; _i2 < _keymap.length; _i2++) {
var m = _keymap[_i2];
cm.removeKeyMap(m);
}
};
}
}, [cm]);
(0,_react_17_0_2_react.useEffect)(function () {
if (fullScreen !== isFull) {
setIsFull(fullScreen);
}
}, [fullScreen]);
(0,useInterval/* default */.Z)(function () {
if (!noStorage && lastedUpdateTime > 0) {
var currentTime = new Date().getTime();
var lastedValue = window.sessionStorage.getItem(id);
if (currentTime >= lastedUpdateTime + StorageTimeTicket && (!lastedValue || lastedValue !== value)) {
window.sessionStorage.setItem(id, value);
setTip(true);
}
}
}, StorageTimeTicket);
(0,_react_17_0_2_react.useEffect)(function () {
setPreview(watch);
}, [cm, watch]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
isFocus && cm.focus();
}
}, [cm, isFocus]);
(0,_react_17_0_2_react.useEffect)(function () {
if (preview && cm) {
var syncScroll = function syncScroll(e) {
var target = e.target;
if (previewEl.current) {
var ratio = target.scrollTop / target.scrollHeight;
previewEl.current.scrollTop = previewEl.current.scrollHeight * ratio;
}
};
var scrollEl = cm.getScrollerElement();
scrollEl.addEventListener('scroll', syncScroll);
return function () {
scrollEl.removeEventListener('scroll', syncScroll);
};
}
}, [cm, preview]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm && onCMBeforeChange) {
var onChangeHandler = function onChangeHandler(cm, change) {
onCMBeforeChange(cm, change);
};
cm.on('beforeChange', onChangeHandler);
return function () {
cm.off('beforeChange', onChangeHandler);
};
}
}, [cm, onCMBeforeChange]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm && onBlur) {
var onBlurHandler = function onBlurHandler() {
onBlur(cm.getValue());
};
cm.on('blur', onBlurHandler);
return function () {
cm.off('blur', onBlurHandler);
};
}
}, [cm, onBlur]);
function deleteAtSymbol(cm, change) {
var doc = cm.getDoc();
var cursor = doc.getCursor();
var line = doc.getLine(cursor.line);
var ch = line.charAt(cursor.ch - 1);
var p1 = line.lastIndexOf("@▁@", cursor.ch);
var p2 = line.lastIndexOf("@▁▁@", cursor.ch);
var posStart = p1 > p2 ? p1 : p2;
var n = p1 > p2 ? 3 : 4;
if (ADD_MULTI.indexOf(ch) === -1) return null;
console.log("change1:", change, cm, line, cursor, posStart, p1, p2, ch);
if (posStart >= 0 && cursor.ch - posStart < 5) {
var posEnd = posStart + n;
doc.replaceRange("", {
line: cursor.line,
ch: posStart
}, {
line: cursor.line,
ch: posEnd
});
return {
line: cursor.line,
ch: posEnd
};
}
return null;
}
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
var onChangeHandler = function onChangeHandler(cm, change) {
var content = cm.getValue();
setValue(content);
setLastedUpdateTime(new Date().getTime());
cm.getScrollerElement().dispatchEvent(new CustomEvent('scroll'));
if (onChange) {
if (showNullProgramButton) {
onChange(content, formatProgramFill(content));
} else {
onChange(content);
}
}
};
cm.on('change', onChangeHandler);
return function () {
cm.off('change', onChangeHandler);
};
}
}, [cm, onChange]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
// isFocus && cm.focus()
if (defaultValue === null || defaultValue === undefined) {
cm.setValue('');
setValue('');
} else {
var scrollTop = window.scrollY || window.pageYOffset;
if (defaultValue !== cm.getValue()) {
cm.setValue(defaultValue);
setValue(defaultValue);
cm.setCursor(disabled ? 1 : cm.lineCount(), 0);
window.scrollTo(0, scrollTop);
}
}
}
}, [cm, defaultValue]);
var onActionCallback = (0,_react_17_0_2_react.useCallback)(function (actionName) {
var cursor = cm.getCursor();
var selection = cm.getSelection();
var selectionText = selection.split('\n');
switch (actionName) {
case 'bold':
cm.replaceSelection('**' + selection + '**');
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch + 2);
}
return cm.focus();
case 'italic':
cm.replaceSelection('*' + selection + '*');
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch + 1);
}
return cm.focus();
case 'code':
cm.replaceSelection('`' + selection + '`');
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch + 1);
}
return cm.focus();
case 'inline-latex':
setAction("inline-latex");
// cm.replaceSelection('`$$' + selection + '$$`')
// if (selection === '') {
// cm.setCursor(cursor.line, cursor.ch + 3)
// }
return cm.focus();
case 'latex':
cm.replaceSelection("```latex\n" + selection + "\n```");
cm.setCursor(cursor.line + 1, selection.length + 1);
return cm.focus();
case 'line-break':
cm.replaceSelection('<br/>\n');
return cm.focus();
case 'list-ul':
if (selection === '') {
cm.replaceSelection('- ' + selection);
} else {
cm.replaceSelection(selectionText.map(function (item) {
return item === '' ? '' : "- ".concat(item);
}).join('\n'));
}
return cm.focus();
case 'list-ol':
if (selection === '') {
cm.replaceSelection('1. ' + selection);
} else {
cm.replaceSelection(selectionText.map(function (item, index) {
return item === '' ? '' : "".concat(index + 1, ". ").concat(item);
}).join('\n'));
}
return cm.focus();
case 'add-null-ch':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(NULL_CH);
return cm.focus();
case 'add-signal':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(ADD_SINGLE);
return cm.focus();
case 'add-multiple':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(ADD_MULTI);
return cm.focus();
case 'inster-template-1':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(TEMP1);
return cm.focus();
case 'eraser':
cm.setValue('');
return cm.focus();
case 'trigger-watch':
setPreview(!preview);
return cm.focus();
case 'trigger-full-screen':
setIsFull(!isFull);
return cm.focus();
case LINK:
setAction(LINK);
return;
case CODE_BLOCK:
setAction(CODE_BLOCK);
return;
case UPLOAD_IMAGE:
setAction(UPLOAD_IMAGE);
return;
case DRAW_IMAGE:
setAction(DRAW_IMAGE);
return;
case "maths-latex":
setAction("maths-latex");
return;
case ADD_FLOWCHART:
setAction(ADD_FLOWCHART);
return;
case ADD_TABLE:
setAction(ADD_TABLE);
return;
default:
throw new Error();
}
}, [cm, preview, isFull]);
var ExecutePluginAction = (0,_react_17_0_2_react.useCallback)(function (values, currentFile) {
var _file$name, _file$name$pop, _file$type4, _file$type5, _file$type6;
setAction('');
switch (action) {
case LINK:
var title = values.title,
link = values.link;
cm.replaceSelection("[".concat(title, "](").concat(link, ")"));
return cm.focus();
case CODE_BLOCK:
var language = values.language,
content = values.content;
cm.replaceSelection(['```' + language, content, '```'].join('\n'));
return cm.focus();
case "maths-latex":
var binaryString = atob(values);
var uint8Array = new Uint8Array(binaryString.length);
for (var i = 0; i < binaryString.length; i++) {
uint8Array[i] = binaryString.charCodeAt(i);
}
var files = new Blob([uint8Array], {
type: "image/png"
});
uploadImage(files, function (data) {
if (data.id) {
cm.replaceSelection("![,](/api/attachments/".concat(data.id, "?type=").concat(data.content_type, ")"));
} else {
if ((data === null || data === void 0 ? void 0 : data.status) === 401) document.location.href = '/user/login';
}
});
break;
case "inline-latex":
cm.replaceSelection("`$$" + values + "$$`");
break;
case UPLOAD_IMAGE:
case DRAW_IMAGE:
case FLOW_CHART:
var src = values.src,
alt = values.alt;
var file = currentFile;
var fileSix = file === null || file === void 0 || (_file$name = file.name) === null || _file$name === void 0 || (_file$name = _file$name.split(".")) === null || _file$name === void 0 || (_file$name$pop = _file$name.pop) === null || _file$name$pop === void 0 ? void 0 : _file$name$pop.call(_file$name);
if ((file === null || file === void 0 || (_file$type4 = file.type) === null || _file$type4 === void 0 ? void 0 : _file$type4.indexOf("image")) > -1 || !(file !== null && file !== void 0 && file.type)) {
if (alt) {
cm.replaceSelection("![ ".concat(alt, " ]( ").concat(src, " \"").concat(alt, "\" )"));
} else {
cm.replaceSelection("![,](".concat(src, ")"));
}
} else if ((file === null || file === void 0 || (_file$type5 = file.type) === null || _file$type5 === void 0 ? void 0 : _file$type5.indexOf("video")) > -1) {
cm.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER).concat(src, "\"></video>"));
} else if ((file === null || file === void 0 || (_file$type6 = file.type) === null || _file$type6 === void 0 ? void 0 : _file$type6.indexOf("pdf")) > -1) {
cm.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER).concat(src, "?type=").concat(file.type, "&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else if (officeSix.includes(fileSix)) {
cm.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER).concat(src, "?type=office&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else {
cm.replaceSelection("[".concat(file.name, "](").concat(env/* default */.Z.API_SERVER).concat(src, ")"));
}
return cm.focus();
case ADD_TABLE:
var row = values.row,
col = values.col,
align = values.align;
var table = '\n';
for (var r = 0; r < row; r++) {
var rows = [];
var heads = [];
for (var c = 0; c < col; c++) {
if (r === 1) {
heads.push(ALIGNSIGN[align]);
}
rows.push(' ');
}
if (r === 1) {
table += "| ".concat(heads.join(' | '), " |\n");
}
table += "| ".concat(rows.join(col === 1 ? '' : ' | '), " |\n");
}
cm.replaceSelection(table + '\n');
return cm.focus();
default:
throw new Error();
}
}, [cm, action]);
var PluginEl = (0,_react_17_0_2_react.useMemo)(function () {
switch (action) {
case LINK:
return /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor_link, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case CODE_BLOCK:
return /*#__PURE__*/(0,jsx_runtime.jsx)(code_block/* default */.Z, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case UPLOAD_IMAGE:
return /*#__PURE__*/(0,jsx_runtime.jsx)(upload_image, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case ADD_FLOWCHART:
return /*#__PURE__*/(0,jsx_runtime.jsx)(flow_chart, {
callback: ExecutePluginAction,
onCancel: onCancel
})
// <iframe src='/knowledgegraph/blockEditor.html' style={{width:"80vw",height:"80vh"}} frameBorder={0} />
;
case ADD_TABLE:
return /*#__PURE__*/(0,jsx_runtime.jsx)(add_table_panel, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case "maths-latex":
return /*#__PURE__*/(0,jsx_runtime.jsx)(MathematicalGraphics, {
showSaveButton: true,
callback: ExecutePluginAction
});
case "inline-latex":
return /*#__PURE__*/(0,jsx_runtime.jsx)(keybords/* default */.Z, {
showSaveButton: true,
callback: ExecutePluginAction
});
default:
return null;
}
}, [action]);
function onCancel() {
setAction('');
}
(0,_react_17_0_2_react.useEffect)(function () {
if (resizeBarEl.current) {
var onMouseDown = function onMouseDown(e) {
dragging = true;
startY = e.pageY;
};
var onMouseUp = function onMouseUp() {
dragging = false;
};
var onMouseMove = function onMouseMove(e) {
if (dragging) {
var delta = e.pageY - startY;
if (delta < 0) {
delta = 0;
}
if (delta > 300) {
delta = 300;
}
var resizeH = height + delta + 'px';
setH(resizeH);
}
};
var resizeBar = resizeBarEl.current;
var dragging = false;
var startY = 0;
resizeBar.addEventListener('mousedown', onMouseDown);
document.addEventListener('mousemove', onMouseMove);
document.addEventListener('mouseup', onMouseUp);
return function () {
resizeBar.removeEventListener('mousedown', onMouseDown);
document.removeEventListener('mousemove', onMouseMove);
document.removeEventListener('mouseup', onMouseUp);
};
}
}, [cm, resizeBarEl]);
(0,_react_17_0_2_react.useEffect)(function () {
setH(height);
}, [height]);
var fixedWidth = processSize(width);
var fixedHeight = processSize(h);
var style = {
width: fixedWidth,
height: fixedHeight
};
var saveTime = (0,_react_17_0_2_react.useMemo)(function () {
if (lastedUpdateTime) {
var d = new Date(lastedUpdateTime);
var _h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
_h = _h < 10 ? '0' + _h : _h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
return "".concat(_h, ":").concat(m, ":").concat(s);
}
return 0;
}, [lastedUpdateTime]);
var formatProgramFill = function formatProgramFill(str) {
var arr = [];
if (showNullProgramButton) {
var num = -1;
str = str.replace(/(@▁▁@|@▁@)/g, function (a, b, c) {
arr.push({
multiLine: !(a === ADD_SINGLE)
});
});
}
return arr;
};
function onCancelStorage() {
window.sessionStorage.removeItem(id);
setTip(false);
setLastedUpdateTime(0);
}
function onReset() {
setTip(false);
setLastedUpdateTime(0);
cm.setValue(window.sessionStorage.getItem(id));
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "markdown-editor-wrapper",
ref: containerEl,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "markdown-editor-container ".concat(className, " ").concat(preview ? 'on-preview' : '', " ").concat(miniToolbar ? 'mini' : '', " ").concat(isFull ? 'full-screen' : ''),
style: style,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(toolbar, {
insertTemp: insertTemp,
watch: preview,
fullScreen: isFull,
showNullButton: showNullButton,
showNullProgramButton: showNullProgramButton,
onActionCallback: onActionCallback,
hidetoolBar: hidetoolBar,
extraUse: extraUse
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "markdown-editor-body",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "codemirror-container",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("textarea", {
ref: cmEl,
placeholder: placeholder
})
}), preview ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
ref: previewEl,
className: "preview-container",
children: [mode === "stex" && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml_stex, {
value: value
}), mode !== "stex" && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
disabledFill: disabledFill,
showProgramFill: showNullProgramButton,
value: value
})]
}) : null]
})]
})
}), showResizeBar ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
ref: resizeBarEl,
className: "editor-resize"
}) : null, action === DRAW_IMAGE && /*#__PURE__*/(0,jsx_runtime.jsx)(draw_image, {
callback: ExecutePluginAction,
onCancel: onCancel
}), action === ADD_FLOWCHART && /*#__PURE__*/(0,jsx_runtime.jsx)(flow_chart, {
callback: ExecutePluginAction,
onCancel: onCancel
}), /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
children: TitleDesc[action] && action !== DRAW_IMAGE && action !== ADD_FLOWCHART ? /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
centered: true,
title: TitleDesc[action],
open: true,
onCancel: onCancel,
footer: null,
destroyOnClose: true,
width: action === ADD_FLOWCHART ? "1200px" : null,
height: action === ADD_FLOWCHART ? "80vh" : null,
className: "markdown-popup-form",
children: PluginEl
}) : null
})]
});
});
/***/ }),
/***/ 35089:
/*!*********************************************************************************!*\
!*** ./src/pages/Classrooms/Lists/Exercise/ImitateAnswer/index.tsx + 8 modules ***!
\*********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ ImitateAnswer; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 15 modules
var _umi_production_exports = __webpack_require__(8931);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/index.js + 5 modules
var statistic = __webpack_require__(31797);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(9641);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
var es_modal = __webpack_require__(43418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/progress/index.js + 13 modules
var es_progress = __webpack_require__(93948);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
var es_radio = __webpack_require__(5112);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js + 3 modules
var es_checkbox = __webpack_require__(24905);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
var row = __webpack_require__(95237);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
var col = __webpack_require__(43604);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
var tooltip = __webpack_require__(6848);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/spin/index.js + 1 modules
var spin = __webpack_require__(71418);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.4@@ant-design/icons/es/icons/MinusSquareOutlined.js + 1 modules
var MinusSquareOutlined = __webpack_require__(31818);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.4@@ant-design/icons/es/icons/PlusSquareOutlined.js + 1 modules
var PlusSquareOutlined = __webpack_require__(61914);
// EXTERNAL MODULE: ./src/components/Exercise/recordScreen.tsx + 3 modules
var recordScreen = __webpack_require__(5470);
// EXTERNAL MODULE: ./node_modules/_dayjs@1.11.10@dayjs/dayjs.min.js
var dayjs_min = __webpack_require__(9498);
var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/ImitateAnswer/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var ImitateAnswermodules = ({"flex_box_center":"flex_box_center___MzHUI","flex_space_between":"flex_space_between___ZPKmx","flex_box_vertical_center":"flex_box_vertical_center___MNo4n","flex_box_center_end":"flex_box_center_end___stoyX","flex_box_column":"flex_box_column___HR6oq","baseMargin":"baseMargin___V_l7f","noWrap":"noWrap___ZcvYB","singleItem":"singleItem___vjYWR","questionIcons":"questionIcons___kiVRR","green":"green___PIOSW","orange":"orange___aGI_B","greenTip":"greenTip___bShpb","redTip":"redTip___wCm4Z","orangeTip":"orangeTip___HRBLJ","pollDesc":"pollDesc___SxQ7V","answered":"answered___e5zk4","unanswer":"unanswer___dEmC8","anchor":"anchor___xdS4e","answerFlag":"answerFlag____R2kw","flagActive":"flagActive___hkk6X","flagHalf":"flagHalf___ZgZyz","answerStudentFlag":"answerStudentFlag___RlIwt","answerStudentActive":"answerStudentActive___pQpEA","questionItem":"questionItem___Yg7y3","questionScore":"questionScore___hGLaV","itemFlag":"itemFlag___KI4Jb","answerWrap":"answerWrap___CETMI","answerSubjective":"answerSubjective____A1OC","otherInput":"otherInput___hanjt","randomFlag":"randomFlag___mId_V","answerTrue":"answerTrue___QzQ9o","answerFalse":"answerFalse____K4Me","answerHalf":"answerHalf___gnzWI","renderHtml":"renderHtml___dDhM4","simpleText":"simpleText___kJ0Kc","answerYes":"answerYes___btoYt","answerNo":"answerNo___aNG_f","answerInfo":"answerInfo___af0Ma","answerProgress":"answerProgress___h6he7","answerSheetWrap":"answerSheetWrap___qVk_a","answerSheetQuestionTitle":"answerSheetQuestionTitle___YqJ8X","answerSheet":"answerSheet___ojXFi","answerSheetItem":"answerSheetItem___coR9L","qindex":"qindex___Fx51y","active":"active___KmAlt","partialActive":"partialActive___UsoA4","selected":"selected___QBbv4","answerSheetBottom":"answerSheetBottom___Lh0Ny","countDown":"countDown___W4ClT","red":"red___RSej4","fold":"fold___pujAY","cardList":"cardList___Bd4OZ","iframe":"iframe___kQjBw","mainPart":"mainPart___aRRl1","tooltipWrap":"tooltipWrap___FJod3","leftPart":"leftPart___f5dDH","rightPart":"rightPart___M7fOP","questionPart":"questionPart___HlX7z","questionTypeTitle":"questionTypeTitle___RRn2_","questionTypeInfo":"questionTypeInfo___a3Iny","toIframeBtn":"toIframeBtn___PH9eF","bottom":"bottom___slps3","changeButton":"changeButton___YjNWr","prevBtn":"prevBtn___NeeAj","fixHeader":"fixHeader___Jjypd","title":"title___h5yRx","submitButton":"submitButton___ATddm","dottedLineWrapper":"dottedLineWrapper___RxpC7","leftHalfCircle":"leftHalfCircle___McsYA","dottedLine":"dottedLine___cwiMH","rightHalfCircle":"rightHalfCircle___sP0Ln"});
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(63834);
// EXTERNAL MODULE: ./src/utils/authority.ts
var authority = __webpack_require__(71912);
// EXTERNAL MODULE: ./src/utils/fullscreen.ts
var fullscreen = __webpack_require__(2434);
// EXTERNAL MODULE: ./src/service/exercise.ts
var exercise = __webpack_require__(39935);
// EXTERNAL MODULE: ./src/service/shixuns.ts
var shixuns = __webpack_require__(60118);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
var RenderHtml = __webpack_require__(52961);
// EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 15 modules
var markdown_editor = __webpack_require__(93521);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/ImitateAnswer/components/Simple.tsx
var Simple = function Simple(_ref) {
var _answerData$exercise, _item$user_answer, _item$user_answer2, _item$user_answer4, _item$standard_answer;
var item = _ref.item,
answerData = _ref.answerData,
_ref$onBlur = _ref.onBlur,
_onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur;
var _useState = (0,_react_17_0_2_react.useState)(),
_useState2 = slicedToArray_default()(_useState, 2),
value = _useState2[0],
setValue = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(),
_useState4 = slicedToArray_default()(_useState3, 2),
isShow = _useState4[0],
setIsShow = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(),
_useState6 = slicedToArray_default()(_useState5, 2),
showEditor = _useState6[0],
setShowEditor = _useState6[1];
(0,_react_17_0_2_react.useEffect)(function () {
setIsShow(item === null || item === void 0 ? void 0 : item.a_flag);
}, [item === null || item === void 0 ? void 0 : item.a_flag]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [(answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.commit_status) === 1 ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "mt10 mb10",
children: "\u6211\u7684\u7B54\u6848\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ImitateAnswermodules.simpleText,
style: {
marginBottom: 20
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer[0]
})
})]
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: item.user_score && (item.user_score === item.question_score ? "c-green" : "c-red"),
children: showEditor ? /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor/* default */.Z, {
height: 450,
isFocus: true,
defaultValue: item === null || item === void 0 || (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2[0],
id: item === null || item === void 0 ? void 0 : item.question_id,
onChange: function onChange(value) {
return setValue(value);
},
onBlur: function onBlur() {
return _onBlur(value);
}
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
onClick: function onClick() {
var _item$user_answer3;
if (!item.repeat_answer && (item === null || item === void 0 || (_item$user_answer3 = item.user_answer) === null || _item$user_answer3 === void 0 ? void 0 : _item$user_answer3.length) > 0) {
return;
}
setShowEditor(true);
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
disabled: !item.repeat_answer && (item === null || item === void 0 || (_item$user_answer4 = item.user_answer) === null || _item$user_answer4 === void 0 ? void 0 : _item$user_answer4.length) > 0 && !item.israp,
size: 'middle',
className: "current",
style: {
marginBottom: 20
},
placeholder: "\u70B9\u51FB\u5F00\u59CB\u4F5C\u7B54",
readOnly: true
})
})
}), (item === null || item === void 0 ? void 0 : item.standard_answer) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "mt10 mb0",
children: "\u53C2\u8003\u7B54\u6848\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
border: "1px solid #eee",
background: "#f5f5f5",
borderRadius: 4,
padding: 5
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: item === null || item === void 0 || (_item$standard_answer = item.standard_answer) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer[0]
})
})]
})]
});
};
/* harmony default export */ var components_Simple = (Simple);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/anchor/index.js + 4 modules
var es_anchor = __webpack_require__(79817);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/table/index.js + 85 modules
var table = __webpack_require__(9143);
// EXTERNAL MODULE: ./src/components/monaco-editor/index.jsx + 4 modules
var monaco_editor = __webpack_require__(32598);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/ImitateAnswer/components/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var componentsmodules = ({"flex_box_center":"flex_box_center___NzoJU","flex_space_between":"flex_space_between___Hwix8","flex_box_vertical_center":"flex_box_vertical_center___IjC7Y","flex_box_center_end":"flex_box_center_end___HmCsd","flex_box_column":"flex_box_column___hOf25","shixunWrp":"shixunWrp___yZiPI","fill":"fill___gz7tU","index":"index___eoHnJ","success":"success___vcRmo","fail":"fail___u5yz8","fillInput":"fillInput___ras_5","shixunWrapper":"shixunWrapper___jNj55","score":"score___gt155","name":"name___BgNAP","programWrapper":"programWrapper___lMcxv","desc":"desc___ODeOH","content":"content___RoL0o"});
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/ImitateAnswer/components/Shixun.tsx
var Shixun = function Shixun(_ref) {
var _answerData$exercise, _answerData$exercise2, _answerData$exercise3, _item$shixun;
var item = _ref.item,
answerData = _ref.answerData;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
data = _useState2[0],
setData = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)([]),
_useState4 = slicedToArray_default()(_useState3, 2),
challengeData = _useState4[0],
setChallengeData = _useState4[1];
(0,_react_17_0_2_react.useEffect)(function () {
var _item$shixun_details;
if (!(item !== null && item !== void 0 && (_item$shixun_details = item.shixun_details) !== null && _item$shixun_details !== void 0 && _item$shixun_details.length)) {
return;
}
var shixun = [];
var challenge = [];
for (var i = 0; i < (item === null || item === void 0 || (_item$shixun_details2 = item.shixun_details) === null || _item$shixun_details2 === void 0 ? void 0 : _item$shixun_details2.length); i++) {
var _item$shixun_details2, _item$shixun_details4;
for (var j = 0; j < (item === null || item === void 0 ? void 0 : item.shixun_details[i].stage_list.length); j++) {
var _item$shixun_details3;
var shixunItem = item === null || item === void 0 ? void 0 : item.shixun_details[i].stage_list[j];
shixun.push(objectSpread2_default()(objectSpread2_default()({}, shixunItem), {
operation: item === null || item === void 0 || (_item$shixun_details3 = item.shixun_details) === null || _item$shixun_details3 === void 0 || (_item$shixun_details3 = _item$shixun_details3[i]) === null || _item$shixun_details3 === void 0 || (_item$shixun_details3 = _item$shixun_details3.shixun_detail) === null || _item$shixun_details3 === void 0 || (_item$shixun_details3 = _item$shixun_details3[0]) === null || _item$shixun_details3 === void 0 ? void 0 : _item$shixun_details3.game_identifier
}));
}
if (item !== null && item !== void 0 && (_item$shixun_details4 = item.shixun_details) !== null && _item$shixun_details4 !== void 0 && (_item$shixun_details4 = _item$shixun_details4[i]) !== null && _item$shixun_details4 !== void 0 && _item$shixun_details4.shixun_detail) {
var _item$shixun_details5;
challenge.push(item === null || item === void 0 || (_item$shixun_details5 = item.shixun_details) === null || _item$shixun_details5 === void 0 || (_item$shixun_details5 = _item$shixun_details5[i]) === null || _item$shixun_details5 === void 0 || (_item$shixun_details5 = _item$shixun_details5.shixun_detail) === null || _item$shixun_details5 === void 0 ? void 0 : _item$shixun_details5[0]);
}
}
setChallengeData(challenge);
setData(shixun);
}, [item === null || item === void 0 ? void 0 : item.shixun_details]);
var columns = [{
title: "关卡",
dataIndex: "position",
key: "position",
align: 'center'
}, {
title: "任务名称",
dataIndex: "name",
key: "name",
align: 'center',
render: function render(name) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "overflowHidden1",
style: {
maxWidth: "400px"
},
title: name && name.length > 25 ? name : "",
children: name
});
}
}, {
title: "评测次数",
dataIndex: "evaluate_count",
key: "evaluate_count",
align: 'center',
render: function render(testCount, item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: item.evaluate_count ? item.evaluate_count : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "color-grey-9",
children: "--"
})
});
}
}, {
title: "完成时间",
key: "endTime",
dataIndex: "endTime",
align: 'center',
render: function render(endTime, item) {
var timeOver = false;
if (item.finished_time && answerData !== null && answerData !== void 0 && answerData.exercise && answerData !== null && answerData !== void 0 && answerData.exercise_answer_user) {
// issue#29511 exercise.time -1没有设置答题的时间限制则比较完成时间和试卷截至时间
if ((answerData === null || answerData === void 0 ? void 0 : answerData.exercise.time) === -1) {
timeOver = dayjs_min_default()(answerData === null || answerData === void 0 ? void 0 : answerData.exercise.end_time).isBefore(item.finished_time);
} else {
timeOver = dayjs_min_default()(answerData === null || answerData === void 0 ? void 0 : answerData.exercise_answer_user.start_at).add(answerData === null || answerData === void 0 ? void 0 : answerData.exercise.time, "m").isBefore(item.finished_time);
}
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: [item.finished_time || /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-grey-999",
children: "--"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-orange-ff9 ",
children: timeOver ? "(已超时)" : ""
})]
});
}
}, {
title: "耗时",
dataIndex: "time_consuming",
key: "time_consuming",
align: 'center',
render: function render(time, item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: item.time_consuming || /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "color-grey-9",
children: "--"
})
});
}
}, {
title: "查看答案",
dataIndex: "view_answer",
key: "view_answer",
align: 'center',
render: function render(exp, item) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: item.view_answer ? "已查看" : "未查看"
});
}
},
// {
// title: "经验值",
// dataIndex: "experience",
// key: "experience",
// align: 'center',
// render: (exp: any, item: any) => {
// return (
// <span>
// <span className="c-green">{item.myself_experience}</span>/
// {item.experience}
// </span>
// );
// },
// },
{
title: "操作",
dataIndex: "operation",
key: "operation",
align: 'center',
render: function render(value, data, index) {
return value ? /*#__PURE__*/(0,jsx_runtime.jsx)(es_anchor/* default */.Z, {
affix: false,
className: "mt10",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_anchor/* default */.Z.Link, {
href: "#challenge_".concat(item === null || item === void 0 ? void 0 : item.question_id).concat(index),
title: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#0152d9'
},
children: "\u67E5\u770B"
})
})
}) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-grey-999",
children: "--"
});
}
}];
var outputColumns = [{
title: '评测次数',
dataIndex: 'key',
width: "127px",
key: 'key',
align: 'center',
render: function render(text, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: record.key
});
}
}, {
title: '详细信息',
dataIndex: 'error_msg',
key: 'error_msg',
align: 'center',
render: function render(text, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: record.error_msg ? record.error_msg : "--"
});
}
}];
var options = {
selectOnLineNumbers: true,
readOnly: true,
minimap: {
enabled: false
},
scrollBeyondLastLine: false
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: componentsmodules.shixunWrapper,
children: [(answerData === null || answerData === void 0 || (_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.commit_status) === 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: item.shixun.map(function (val, key) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: "mb20",
justify: "space-between",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
flex: 1,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: componentsmodules.score,
children: ["(", val.challenge_score, "\u5206)"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: componentsmodules.name,
children: [val.challenge_name, " "]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
children: [val.answer_status === 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14",
style: {
color: '#FA6400'
},
children: "\u672A\u5B8C\u6210"
}), val.answer_status === 1 && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "font14",
style: {
color: '#37AD83'
},
children: "\u5DF2\u5B8C\u6210"
})]
})]
});
})
}), (answerData === null || answerData === void 0 || (_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.commit_status) !== 0 || (answerData === null || answerData === void 0 || (_answerData$exercise3 = answerData.exercise) === null || _answerData$exercise3 === void 0 ? void 0 : _answerData$exercise3.user_exercise_status) !== 0 ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [!!(data !== null && data !== void 0 && data.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "font16 c-grey-666",
children: "\u9636\u6BB5\u6210\u7EE9"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(table/* default */.Z, {
columns: columns,
dataSource: data,
pagination: false
})]
}), !!(challengeData !== null && challengeData !== void 0 && challengeData.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "font16 c-grey-666 mt10",
children: "\u5B9E\u8BAD\u8BE6\u60C5"
}), challengeData === null || challengeData === void 0 ? void 0 : challengeData.map(function (chanllenge, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
id: "challenge_".concat(item === null || item === void 0 ? void 0 : item.question_id).concat(index),
className: "mt5",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "font16 mr15",
children: [" \u7B2C", chanllenge.position, "\u5173"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(_umi_production_exports.Link, {
className: "current c-black font16",
to: "/tasks/".concat(chanllenge.game_identifier),
children: chanllenge.name
})]
}), (chanllenge === null || chanllenge === void 0 ? void 0 : chanllenge.st) === 0 && chanllenge.passed_code && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: componentsmodules.shixunWrp,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("h2", {
children: ["\u6700\u540E\u4E00\u6B21\u901A\u5173\u7684\u4EE3\u7801\uFF08\u672A\u901A\u5173\u5219\u4E3A\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\u8BC4\u6D4B\u7684\u4EE3\u7801\uFF09", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-light-black",
children: chanllenge.path
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, {
height: 300,
language: "python",
theme: "default",
value: chanllenge.passed_code,
options: options
})]
})]
});
})]
})]
}) : /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: "c-grey-999 mt20 mb20",
value: item === null || item === void 0 ? void 0 : item.question_title
}), item === null || item === void 0 || (_item$shixun = item.shixun) === null || _item$shixun === void 0 ? void 0 : _item$shixun.map(function (shixun, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
className: "font16 c-grey-666 mb5",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "mr20",
children: ["\u7B2C", shixun === null || shixun === void 0 ? void 0 : shixun.challenge_position, "\u5173 ", shixun === null || shixun === void 0 ? void 0 : shixun.challenge_name]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: [shixun === null || shixun === void 0 ? void 0 : shixun.challenge_score, "\u5206"]
})]
}, index);
})]
})]
});
};
/* harmony default export */ var components_Shixun = (Shixun);
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
var base64 = __webpack_require__(24334);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/ImitateAnswer/components/Program.tsx
var Program = function Program(_ref) {
var item = _ref.item,
answerData = _ref.answerData;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
data = _useState2[0],
setData = _useState2[1];
(0,_react_17_0_2_react.useEffect)(function () {
var _item$evaluate_codes;
if ((item === null || item === void 0 || (_item$evaluate_codes = item.evaluate_codes) === null || _item$evaluate_codes === void 0 ? void 0 : _item$evaluate_codes.length) > 0) {
var _item$evaluate_codes2;
setData(item === null || item === void 0 || (_item$evaluate_codes2 = item.evaluate_codes) === null || _item$evaluate_codes2 === void 0 ? void 0 : _item$evaluate_codes2.map(function (code, index) {
return {
key: index + 1,
error_msg: code !== null && code !== void 0 && code.error_msg ? base64.Base64.decode(code === null || code === void 0 ? void 0 : code.error_msg) : ''
};
}));
} else {
setData([{
key: "--",
error_msg: "--"
}]);
}
}, [item === null || item === void 0 ? void 0 : item.evaluate_codes]);
var columns = [{
title: '评测次数',
dataIndex: 'key',
width: "127px",
key: 'key',
align: 'center',
render: function render(text, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: record.key
});
}
}, {
title: '详细信息',
dataIndex: 'error_msg',
key: 'error_msg',
align: 'center',
render: function render(text, record) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: record.error_msg ? record.error_msg : "--"
});
}
}];
var options = {
selectOnLineNumbers: true,
readOnly: true,
minimap: {
enabled: false
},
scrollBeyondLastLine: false
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "".concat(componentsmodules.programWrapper),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: componentsmodules.desc,
children: "\u9898\u76EE\u63CF\u8FF0"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: componentsmodules.content,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: item === null || item === void 0 ? void 0 : item.description
})
}), !!(item !== null && item !== void 0 && item.user_answer.length) && (item === null || item === void 0 ? void 0 : item.passed_code) && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: componentsmodules.shixunWrp,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("h3", {
children: "\u7B2C\u4E00\u6B21\u8BC4\u6D4B\u901A\u8FC7\u7684\u4EE3\u7801\uFF08\u672A\u901A\u5173\u5219\u4E3A\u6700\u540E\u4E00\u6B21\u63D0\u4EA4\u8BC4\u6D4B\u7684\u4EE3\u7801\uFF09"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(monaco_editor/* default */.ZP, {
style: {
border: '1px solid #ccc'
},
height: 300,
language: "python",
theme: "vs-light",
value: item !== null && item !== void 0 && item.passed_code ? base64.Base64.decode(item === null || item === void 0 ? void 0 : item.passed_code) : "",
options: options
})]
})]
});
};
/* harmony default export */ var components_Program = (Program);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(37205);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
// EXTERNAL MODULE: ./src/components/MathsLatexKeybords/index.tsx
var MathsLatexKeybords = __webpack_require__(83868);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/ImitateAnswer/components/Fill.tsx
var TextArea = input/* default */.Z.TextArea;
var Fill = function Fill(_ref) {
var _item$standard_answer2, _item$standard_answer3;
var item = _ref.item,
answerData = _ref.answerData,
_ref$onBlur = _ref.onBlur,
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
userAnswer = _useState2[0],
setUserAnswer = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)([]),
_useState4 = slicedToArray_default()(_useState3, 2),
saveStatusArr = _useState4[0],
setSaveStatusArr = _useState4[1];
var saveStatusArrs = (0,_react_17_0_2_react.useRef)();
(0,_react_17_0_2_react.useEffect)(function () {
var _item$standard_answer;
// const data: any = [];
// for (let i = 0; i < item?.multi_count; i++) {
// const param = item?.user_answer?.find((e: any) => e.choice_id === i + 1) || {
// choice_id: i + 1,
// answer_text: ''
// };
// data.push({ ...param });
// }
var data = [];
data = item === null || item === void 0 || (_item$standard_answer = item.standard_answers) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer.map(function (val) {
var _item$user_answer;
return objectSpread2_default()(objectSpread2_default()({}, val), {}, {
choice_id: val.position,
answer_text: (item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 || (_item$user_answer = _item$user_answer.find(function (e) {
return e.choice_id === val.choice_id;
})) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer.answer_text) || ''
});
});
setUserAnswer(data);
}, [item === null || item === void 0 ? void 0 : item.user_answer]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [userAnswer === null || userAnswer === void 0 ? void 0 : userAnswer.map(function (answer, index) {
var _item$user_answer2, _saveStatusArr$index, _saveStatusArr$index2, _saveStatusArr$index3;
return /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: "".concat(componentsmodules.baseMargin, " ").concat(componentsmodules.fill),
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: componentsmodules.index,
children: ["\u586B\u7A7A\u9879", index + 1]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: '430px',
className: "ml20 mr20",
children: (answer === null || answer === void 0 ? void 0 : answer.model) === 1 ? /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
placeholder: "\u8BF7\u8F93\u5165\u7B54\u6848",
disabled: !item.repeat_answer && (item === null || item === void 0 || (_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2.length) > 0 && !item.israp || !!(answerData !== null && answerData !== void 0 && answerData.exercise.commit_status),
value: answer === null || answer === void 0 ? void 0 : answer.answer_text,
onChange: function onChange(e) {
userAnswer[index].answer_text = e.target.value;
setUserAnswer(toConsumableArray_default()(userAnswer));
},
onBlur: ( /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(e) {
var res, newArr, _newArr;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return onBlur(answer === null || answer === void 0 ? void 0 : answer.answer_text, index + 1, userAnswer);
case 2:
res = _context.sent;
if (res.status === 0) {
newArr = saveStatusArr.slice();
newArr[index] = {
status: 'success',
errorText: ''
};
saveStatusArrs.current = newArr;
setSaveStatusArr(newArr);
} else {
_newArr = saveStatusArr.slice();
_newArr[index] = {
status: 'fail',
errorText: res.message
};
saveStatusArrs.current = _newArr;
setSaveStatusArr(_newArr);
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}()),
className: "".concat(item.user_score && (item.user_score === item.question_score ? "c-green" : "c-red"), " ").concat(componentsmodules.fillInput)
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(MathsLatexKeybords/* default */.Z, {
value: answer === null || answer === void 0 ? void 0 : answer.answer_text,
onChange: ( /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(e) {
var res, _saveStatusArrs$curre, newArr, _saveStatusArrs$curre2, _newArr2;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
userAnswer[index].answer_text = e;
setUserAnswer(toConsumableArray_default()(userAnswer));
_context2.next = 4;
return onBlur(e, index + 1, userAnswer);
case 4:
res = _context2.sent;
if (!res.status) {
newArr = (saveStatusArrs === null || saveStatusArrs === void 0 || (_saveStatusArrs$curre = saveStatusArrs.current) === null || _saveStatusArrs$curre === void 0 ? void 0 : _saveStatusArrs$curre.slice()) || [].slice();
newArr[index] = {
status: 'success',
errorText: ''
};
saveStatusArrs.current = newArr;
setSaveStatusArr(newArr);
} else {
_newArr2 = (saveStatusArrs === null || saveStatusArrs === void 0 || (_saveStatusArrs$curre2 = saveStatusArrs.current) === null || _saveStatusArrs$curre2 === void 0 ? void 0 : _saveStatusArrs$curre2.slice()) || [].slice();
_newArr2[index] = {
status: 'fail',
errorText: res.message
};
saveStatusArrs.current = _newArr2;
setSaveStatusArr(_newArr2);
}
case 6:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return function (_x2) {
return _ref3.apply(this, arguments);
};
}())
})
}), ((_saveStatusArr$index = saveStatusArr[index]) === null || _saveStatusArr$index === void 0 ? void 0 : _saveStatusArr$index.status) === "success" && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
style: {
marginRight: 8
},
className: "iconfont icon-chenggong1 ".concat(componentsmodules.success)
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: componentsmodules.success,
children: "\u4FDD\u5B58\u6210\u529F"
})]
})
}), ((_saveStatusArr$index2 = saveStatusArr[index]) === null || _saveStatusArr$index2 === void 0 ? void 0 : _saveStatusArr$index2.status) === "fail" && /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
style: {
marginRight: 8
},
className: "iconfont icon-tishi7 ".concat(componentsmodules.fail)
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: componentsmodules.fail,
children: (_saveStatusArr$index3 = saveStatusArr[index]) === null || _saveStatusArr$index3 === void 0 ? void 0 : _saveStatusArr$index3.errorText
})]
})
})]
}, index);
}), !!(item !== null && item !== void 0 && (_item$standard_answer2 = item.standard_answer) !== null && _item$standard_answer2 !== void 0 && _item$standard_answer2.length) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: item === null || item === void 0 || (_item$standard_answer3 = item.standard_answer) === null || _item$standard_answer3 === void 0 ? void 0 : _item$standard_answer3.map(function (answer, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u53C2\u8003\u7B54\u6848\uFF1A\uFF08\u586B\u7A7A", index + 1, "\uFF09:"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
autoSize: true,
disabled: true,
value: answer === null || answer === void 0 ? void 0 : answer.answer_text[0]
})
})]
}, index);
})
})]
});
};
/* harmony default export */ var components_Fill = (Fill);
// EXTERNAL MODULE: ./src/components/QuestionEditor/Buttonloading.tsx
var Buttonloading = __webpack_require__(28805);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.4@@ant-design/icons/es/icons/ExclamationCircleOutlined.js + 1 modules
var ExclamationCircleOutlined = __webpack_require__(79924);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/ImitateAnswer/components/BFill.tsx
var BFill_TextArea = input/* default */.Z.TextArea;
var BFill = function BFill(_ref) {
var _item$standard_answer2, _item$standard_answer3;
var item = _ref.item,
answerData = _ref.answerData,
_ref$onBlur = _ref.onBlur,
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
_ref$onDebug = _ref.onDebug,
onDebug = _ref$onDebug === void 0 ? function () {} : _ref$onDebug;
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
userAnswer = _useState2[0],
setUserAnswer = _useState2[1];
(0,_react_17_0_2_react.useEffect)(function () {
var _item$standard_answer;
var data = item === null || item === void 0 || (_item$standard_answer = item.standard_answer_with_score) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer.map(function (val, index) {
var _item$user_answer;
return objectSpread2_default()(objectSpread2_default()({}, val), {}, {
value: (item === null || item === void 0 || (_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 || (_item$user_answer = _item$user_answer.find(function (item) {
return parseInt(item.choice_id) === index + 1;
})) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer.answer_text) || ''
});
});
setUserAnswer(data);
}, [item === null || item === void 0 ? void 0 : item.standard_answer_with_score]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [(item === null || item === void 0 ? void 0 : item.code) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
border: '1px solid #CCCCCC',
padding: '10px',
marginBottom: 20
},
children: /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: componentsmodules.content,
programFillValue: userAnswer,
showProgramFill: true,
onFillBlur: ( /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(e, index) {
var _e$parseInt;
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return onBlur(e === null || e === void 0 || (_e$parseInt = e[parseInt(index)]) === null || _e$parseInt === void 0 ? void 0 : _e$parseInt.value, parseInt(index) + 1, userAnswer);
case 2:
res = _context.sent;
if (res.status === 0) {
userAnswer[parseInt(index)].type = "success";
setUserAnswer(userAnswer);
} else {
userAnswer[parseInt(index)].type = "warning";
setUserAnswer(userAnswer);
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x, _x2) {
return _ref2.apply(this, arguments);
};
}()),
value: base64.Base64.decode((item === null || item === void 0 ? void 0 : item.code) || '')
})
}), !!(item !== null && item !== void 0 && (_item$standard_answer2 = item.standard_answer) !== null && _item$standard_answer2 !== void 0 && _item$standard_answer2.length) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: item === null || item === void 0 || (_item$standard_answer3 = item.standard_answer) === null || _item$standard_answer3 === void 0 ? void 0 : _item$standard_answer3.map(function (answer, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u53C2\u8003\u7B54\u6848\uFF1A\uFF08\u586B\u7A7A", index + 1, "\uFF09:"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(BFill_TextArea, {
autoSize: true,
disabled: true,
value: answer === null || answer === void 0 ? void 0 : answer.answer_text[0]
})
})]
}, index);
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
justifyContent: 'space-between'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
fontSize: 14,
color: '#ff0000'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ExclamationCircleOutlined/* default */.Z, {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: 5
},
children: "\u6CE8\u610F\uFF1A\u586B\u5199\u7B54\u6848\u4E4B\u540E\uFF0C\u5FC5\u987B\u63D0\u4EA4\u4EE3\u7801\u8FDB\u884C\u8BC4\u6D4B\uFF0C\u5426\u5219\u65E0\u6CD5\u5F97\u5206"
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Buttonloading/* default */.Z, {
ButtonProps: {
type: 'primary'
},
ButtonText: "\u63D0\u4EA4\u4EE3\u7801",
items: objectSpread2_default()(objectSpread2_default()({}, item), {}, {
userAnswer: userAnswer
}),
hackidentifier: item === null || item === void 0 ? void 0 : item.hack_identifier
})]
})]
});
};
/* harmony default export */ var components_BFill = (BFill);
// EXTERNAL MODULE: ./src/components/ImagesIcon/index.ts + 33 modules
var ImagesIcon = __webpack_require__(76508);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/ImitateAnswer/components/ErrCheckIpTip.tsx
var ErrCheckIpTip_TextArea = input/* default */.Z.TextArea;
var ErrCheckIpTip_Fill = function Fill(_ref) {
var data = _ref.data;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "tc mt80",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
width: "486",
src: ImagesIcon/* errIcon */.BV
}), " ", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), data.status === -1 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "c-grey-999 mt60",
children: "\u60A8\u7684IP\u4E0D\u5728\u8003\u8BD5\u5141\u8BB8\u7684\u8303\u56F4\u5185\uFF01"
}), data.status === -2 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: " c-grey-999 mt60",
children: ["\u60A8\u5DF2\u7ED1\u5B9A\u5F53\u524D\u8003\u8BD5IP\u5730\u5740\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-red",
children: data.ip
}), "\u8BF7\u4F7F\u7528\u8BE5IP\u5730\u5740\u8FDB\u5165\u8003\u8BD5\u3002"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: "mt40 pl20 pr20",
type: "primary",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/",
children: "\u56DE\u5230\u9996\u9875"
})
})]
});
};
/* harmony default export */ var ErrCheckIpTip = (ErrCheckIpTip_Fill);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(33259);
// EXTERNAL MODULE: ./node_modules/_lodash@4.17.21@lodash/lodash.js
var lodash = __webpack_require__(89392);
// EXTERNAL MODULE: ./src/utils/constant.ts
var constant = __webpack_require__(70594);
;// CONCATENATED MODULE: ./src/pages/Classrooms/Lists/Exercise/ImitateAnswer/index.tsx
var Countdown = statistic/* default */.Z.Countdown;
var ImitateAnswer_TextArea = input/* default */.Z.TextArea;
var tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
var scoreStatusMapping = {
0: 'c-red-ee4',
1: 'c-green'
};
var Answer = function Answer(_ref) {
var _answerData$exercise4, _answerData$exercise17, _answerData$exercise18, _answerData$exercise19, _answerData$exercise20, _answerData$exercise21, _answerData$question_4, _answerData$exercise_10, _answerData$question_5, _answerData$exercise_11, _answerData$exercise_12, _answerData$exercise_13, _answerData$exercise_14, _answerData$exercise_15, _answerData$exercise_16, _answerData$exercise_18, _answerData$exercise_19;
var user = _ref.user,
dispatch = _ref.dispatch;
var params = (0,_umi_production_exports.useParams)();
var _useState = (0,_react_17_0_2_react.useState)({}),
_useState2 = slicedToArray_default()(_useState, 2),
answerData = _useState2[0],
setAnswerData = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)({}),
_useState4 = slicedToArray_default()(_useState3, 2),
answerCheckData = _useState4[0],
setAnswerCheckData = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)({}),
_useState6 = slicedToArray_default()(_useState5, 2),
hideAnswerCard = _useState6[0],
setHideAnswerCard = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(false),
_useState8 = slicedToArray_default()(_useState7, 2),
isSpin = _useState8[0],
setIsSpin = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)(true),
_useState10 = slicedToArray_default()(_useState9, 2),
showAnswerCard = _useState10[0],
setShowAnswerCard = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)(false),
_useState12 = slicedToArray_default()(_useState11, 2),
showCamera = _useState12[0],
setShowCamera = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)(false),
_useState14 = slicedToArray_default()(_useState13, 2),
openFullScreen = _useState14[0],
setOpenFullScreen = _useState14[1];
var _useState15 = (0,_react_17_0_2_react.useState)(),
_useState16 = slicedToArray_default()(_useState15, 2),
time = _useState16[0],
setTime = _useState16[1];
var _useState17 = (0,_react_17_0_2_react.useState)(''),
_useState18 = slicedToArray_default()(_useState17, 2),
iframeUrl = _useState18[0],
setIframeUrl = _useState18[1];
var _useState19 = (0,_react_17_0_2_react.useState)('none'),
_useState20 = slicedToArray_default()(_useState19, 2),
iframeBlock = _useState20[0],
setIframeBlock = _useState20[1];
var _useState21 = (0,_react_17_0_2_react.useState)(''),
_useState22 = slicedToArray_default()(_useState21, 2),
countDownColor = _useState22[0],
setCountDownColor = _useState22[1];
var _useState23 = (0,_react_17_0_2_react.useState)({
status: 0
}),
_useState24 = slicedToArray_default()(_useState23, 2),
checkStatus = _useState24[0],
setCheckStatus = _useState24[1]; //0ip合法,-1ip不在范围,-2已绑定其他ip
var iframe = (0,_react_17_0_2_react.useRef)();
var _useState25 = (0,_react_17_0_2_react.useState)(0),
_useState26 = slicedToArray_default()(_useState25, 2),
oneindex = _useState26[0],
setoneindex = _useState26[1]; //大题下标
var _useState27 = (0,_react_17_0_2_react.useState)(0),
_useState28 = slicedToArray_default()(_useState27, 2),
twoindex = _useState28[0],
settwoindex = _useState28[1]; //小题下标
var _useState29 = (0,_react_17_0_2_react.useState)(false),
_useState30 = slicedToArray_default()(_useState29, 2),
isShowmodal = _useState30[0],
setisshowmodal = _useState30[1];
var _useState31 = (0,_react_17_0_2_react.useState)(false),
_useState32 = slicedToArray_default()(_useState31, 2),
ischecked = _useState32[0],
setischecked = _useState32[1];
var _useState33 = (0,_react_17_0_2_react.useState)(),
_useState34 = slicedToArray_default()(_useState33, 2),
type = _useState34[0],
settype = _useState34[1];
var _useState35 = (0,_react_17_0_2_react.useState)(),
_useState36 = slicedToArray_default()(_useState35, 2),
indexitems = _useState36[0],
setindexitems = _useState36[1];
(0,_react_17_0_2_react.useEffect)(function () {
dispatch({
type: "globalSetting/headerFooterToggle",
payload: false
});
if (((0,authority/* isAdmin */.GJ)() || (0,authority/* isCommonAdminOrCreator */.EO)()) && params.categoryId && user.userInfo.login) {
initData();
}
window.addEventListener('message', handleMessage);
return function () {
window.removeEventListener('message', handleMessage);
window.removeEventListener("beforeunload", onBeforeunload);
dispatch({
type: "globalSetting/headerFooterToggle",
payload: true
});
if (location.pathname.indexOf("/detail") > -1) (0,fullscreen/* exitFull */.BU)();
};
}, [params.categoryId, user.userInfo.login]);
var handleMessage = function handleMessage(data) {
if (data.data === 'backExercise') {
setIframeBlock("none");
setIframeUrl("");
initData();
}
};
var onBeforeunload = function onBeforeunload(e) {
var confirmationMessage = "确定离开此页面吗?此页数据可能会丢失";
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
};
var initData = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res, _res$exercise_scores;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
setIsSpin(true);
_context.next = 3;
return (0,exercise/* startSimulateAnswer */._F)(objectSpread2_default()({}, params))["catch"](function () {
return setIsSpin(false);
});
case 3:
res = _context.sent;
(res === null || res === void 0 ? void 0 : res.exercise) && (res.exercise.user_exercise_status = 1);
setIsSpin(false);
if (res) {
res.exercise_types = (res === null || res === void 0 ? void 0 : res.exercise_types) || (res === null || res === void 0 || (_res$exercise_scores = res.exercise_scores) === null || _res$exercise_scores === void 0 ? void 0 : _res$exercise_scores.exercise_types);
setAnswerData(res);
}
case 7:
case "end":
return _context.stop();
}
}, _callee);
}));
return function initData() {
return _ref2.apply(this, arguments);
};
}();
(0,_react_17_0_2_react.useEffect)(function () {
var _answerData$exercise, _answerData$exercise2, _answerData$exercise3;
if (((_answerData$exercise = answerData.exercise) === null || _answerData$exercise === void 0 ? void 0 : _answerData$exercise.time) === 0) handleSubmitAnswer(); //自动任务失败进入后时间为0自动提交试卷
((_answerData$exercise2 = answerData.exercise) === null || _answerData$exercise2 === void 0 ? void 0 : _answerData$exercise2.time) && setTime(Date.now() + (answerData === null || answerData === void 0 || (_answerData$exercise3 = answerData.exercise) === null || _answerData$exercise3 === void 0 ? void 0 : _answerData$exercise3.time) * 1000 * 60);
}, [(_answerData$exercise4 = answerData.exercise) === null || _answerData$exercise4 === void 0 ? void 0 : _answerData$exercise4.time]);
var handleToDetail = function handleToDetail() {
initData();
};
// 自动交卷
var handleFinishTime = /*#__PURE__*/function () {
var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
var res, _time;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return (0,exercise/* submitSimulateExerciseAnswer */.kp)({
categoryId: params.categoryId,
commit_method: 2
});
case 2:
res = _context3.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
es_modal/* default */.Z.info({
width: 530,
title: '提示',
centered: true,
okText: '确定',
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "tc font16",
children: ["\u7B54\u9898\u7ED3\u675F\u4E86\uFF0C\u7CFB\u7EDF\u5DF2\u81EA\u52A8\u63D0\u4EA4\u8BD5\u5377", /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), "\u4E0D\u80FD\u518D\u4FEE\u6539\u7B54\u9898"]
}),
onOk: function () {
var _onOk = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
handleToDetail();
case 1:
case "end":
return _context2.stop();
}
}, _callee2);
}));
function onOk() {
return _onOk.apply(this, arguments);
}
return onOk;
}()
});
message/* default */.ZP.info(res === null || res === void 0 ? void 0 : res.message);
}
if ((res === null || res === void 0 ? void 0 : res.status) === -3) {
_time = parseInt(res === null || res === void 0 ? void 0 : res.message);
answerData.exercise.time = _time;
setAnswerData(objectSpread2_default()({}, answerData));
}
case 5:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return function handleFinishTime() {
return _ref3.apply(this, arguments);
};
}();
var goShixun = /*#__PURE__*/function () {
var _ref4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(item) {
var res;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return (item.is_jupyter || item.is_jupyter_lab ? shixuns/* execJupyter */.BK : shixuns/* execShixun */.Ir)({
id: item.shixun_identifier
});
case 2:
res = _context4.sent;
if (res !== null && res !== void 0 && res.game_identifier || res !== null && res !== void 0 && res.identifier) {
if (item.is_jupyter_lab || item.is_jupyter) {
setIframeUrl("/tasks/".concat(res.identifier, "/jupyter?type=exercises&exercisesId=").concat(params.categoryId, "&coursesId=coursesId&login=").concat(params.login, "&questionId=").concat(item.question_id));
} else {
setIframeUrl("/tasks/".concat(res.game_identifier, "?type=exercises&exercisesId=").concat(params.categoryId, "&coursesId=").concat(params.coursesId, "&login=").concat(params.login, "&questionId=").concat(item.question_id));
}
setIframeBlock("block");
}
if ((res === null || res === void 0 ? void 0 : res.status) === -3) {
(0,util/* bindPhone */.eF)();
} else if ((res === null || res === void 0 ? void 0 : res.status) === 2) {
handleResetGame(res === null || res === void 0 ? void 0 : res.message, item.question_id, item.is_jupyter_lab, item.is_jupyter);
} else if ((res === null || res === void 0 ? void 0 : res.status) === 3) {
handleInBeta(res === null || res === void 0 ? void 0 : res.message);
}
case 5:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return function goShixun(_x) {
return _ref4.apply(this, arguments);
};
}();
var handleResetGame = function handleResetGame(url, question_id, is_jupyter_lab, is_jupyter) {
var _url;
url = (_url = url) !== null && _url !== void 0 && _url.includes('.json') ? url : "".concat(url, ".json");
es_modal/* default */.Z.confirm({
centered: true,
title: '提示',
okText: '确定',
cancelText: '取消',
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "tc font16",
children: "\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"
}),
onOk: function () {
var _onOk2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee5() {
var res, execRes;
return regeneratorRuntime_default()().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return (0,exercise/* resetMyGame */.$Q)({
url: url
});
case 2:
res = _context5.sent;
if (res) {
_context5.next = 5;
break;
}
return _context5.abrupt("return");
case 5:
message/* default */.ZP.success("重置成功,正在进入实践项目!");
_context5.next = 8;
return (0,shixuns/* execShixun */.Ir)({
id: res.shixun_identifier
});
case 8:
execRes = _context5.sent;
if (!(execRes !== null && execRes !== void 0 && execRes.game_identifier)) {
_context5.next = 12;
break;
}
goShixun({
shixun_identifier: execRes === null || execRes === void 0 ? void 0 : execRes.game_identifier,
question_id: question_id,
is_jupyter_lab: is_jupyter_lab,
is_jupyter: is_jupyter
});
return _context5.abrupt("return");
case 12:
if ((execRes === null || execRes === void 0 ? void 0 : execRes.status) === 2) {
handleResetGame(execRes === null || execRes === void 0 ? void 0 : execRes.message, question_id, is_jupyter_lab, is_jupyter);
} else if ((execRes === null || execRes === void 0 ? void 0 : execRes.status) === 3) {
handleInBeta(execRes === null || execRes === void 0 ? void 0 : execRes.message);
}
case 13:
case "end":
return _context5.stop();
}
}, _callee5);
}));
function onOk() {
return _onOk2.apply(this, arguments);
}
return onOk;
}()
});
};
var handleInBeta = function handleInBeta(message) {
es_modal/* default */.Z.confirm({
centered: true,
title: '提示',
okText: '确定',
cancelText: '取消',
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "tc font16",
children: ["\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E", message, "\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01"]
})
});
};
var handleJoinShixun = function handleJoinShixun(item) {
if (item.redo) {
es_modal/* default */.Z.info({
width: 530,
title: '提示',
centered: true,
okText: '确定',
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "tc font16",
children: "\u60A8\u4E4B\u524D\u5DF2\u7ECF\u6311\u6218\u8FC7\u8BE5\u5B9E\u8BAD\uFF0C\u8003\u8BD5\u8FC7\u7A0B\u4E2D\u9700\u8981\u91CD\u65B0\u6311\u6218"
}),
onOk: function () {
var _onOk3 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee6() {
var res, newQuestions, index, newItem;
return regeneratorRuntime_default()().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
_context6.next = 2;
return (0,exercise/* resetMyGame */.$Q)({
id: item.myshixun_identifier,
url: item.url
});
case 2:
res = _context6.sent;
if (res) {
newQuestions = (0,lodash.cloneDeep)(answerData === null || answerData === void 0 ? void 0 : answerData.exercise_question_types);
index = newQuestions === null || newQuestions === void 0 ? void 0 : newQuestions.findIndex(function (e) {
return e.question_type === 5;
});
newQuestions[index].items.find(function (er) {
return er.question_id === item.question_id;
}).redo = false;
newQuestions[index].items.find(function (er) {
return er.question_id === item.question_id;
}).shixun_identifier = res.shixun_identifier;
answerData.exercise_question_types = newQuestions;
setAnswerData(answerData);
newItem = objectSpread2_default()(objectSpread2_default()({}, item), {}, {
shixun_identifier: res.shixun_identifier
});
goShixun(newItem);
}
case 4:
case "end":
return _context6.stop();
}
}, _callee6);
}));
function onOk() {
return _onOk3.apply(this, arguments);
}
return onOk;
}()
});
} else {
goShixun(item);
}
};
var handleJoinProgram = /*#__PURE__*/function () {
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee7(item) {
var res;
return regeneratorRuntime_default()().wrap(function _callee7$(_context7) {
while (1) switch (_context7.prev = _context7.next) {
case 0:
if (!item.hack_identifier) {
_context7.next = 5;
break;
}
_context7.next = 3;
return (0,exercise/* startProgram */.nF)({
id: item.hack_identifier
});
case 3:
res = _context7.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
setIframeUrl("/myproblems/".concat(res.identifier, "?type=exercises&exercisesId=").concat(params.categoryId, "&coursesId=").concat(params.coursesId, "&login=").concat(params.login, "&questionId=").concat(item.question_id));
setIframeBlock("block");
}
case 5:
case "end":
return _context7.stop();
}
}, _callee7);
}));
return function handleJoinProgram(_x2) {
return _ref5.apply(this, arguments);
};
}();
var handleSave = /*#__PURE__*/function () {
var _ref6 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee8(questionId, exercise_choice_id, answer_text, callBack) {
var res;
return regeneratorRuntime_default()().wrap(function _callee8$(_context8) {
while (1) switch (_context8.prev = _context8.next) {
case 0:
if (questionId) {
_context8.next = 3;
break;
}
console.error("handleSave no questionId params");
return _context8.abrupt("return");
case 3:
_context8.next = 5;
return (0,exercise/* updateExerciseAnswers */.oX)({
questionId: questionId,
exercise_choice_id: exercise_choice_id,
answer_text: answer_text
});
case 5:
res = _context8.sent;
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
callBack && callBack();
}
return _context8.abrupt("return", res);
case 8:
case "end":
return _context8.stop();
}
}, _callee8);
}));
return function handleSave(_x3, _x4, _x5, _x6) {
return _ref6.apply(this, arguments);
};
}();
var handleVerifySave = /*#__PURE__*/function () {
var _ref7 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee11(isSave) {
var res, tip, _answerData$exercise_;
return regeneratorRuntime_default()().wrap(function _callee11$(_context11) {
while (1) switch (_context11.prev = _context11.next) {
case 0:
_context11.next = 2;
return (0,exercise/* simulateBeginCommit */.WL)({
id: params.categoryId
});
case 2:
res = _context11.sent;
if (res) {
_context11.next = 5;
break;
}
return _context11.abrupt("return");
case 5:
if (res.question_undo !== 0 || res.oj_undo !== 0) {
tip = '';
if (res.question_undo !== 0 && res.oj_undo !== 0) {
tip = "\u6709 ".concat(res.question_undo, " \u9898\u672A\u5B8C\u6210\uFF0C\u5305\u542B ").concat(res.oj_undo, " \u4E2A").concat((answerData === null || answerData === void 0 || (_answerData$exercise_ = answerData.exercise_question_types) === null || _answerData$exercise_ === void 0 || (_answerData$exercise_ = _answerData$exercise_.find(function (item) {
return item.question_type == 6;
})) === null || _answerData$exercise_ === void 0 ? void 0 : _answerData$exercise_.name) || "编程题");
} else if (res.question_undo !== 0 && res.oj_undo === 0) {
tip = "\u6709 ".concat(res.question_undo, " \u9898\u672A\u5B8C\u6210");
} else if (res.question_undo === 0 && res.oj_undo !== 0) {
tip = "\u6709 ".concat(res.oj_undo, " \u7F16\u7A0B\u9898\u672A\u5B8C\u6210");
}
es_modal/* default */.Z.confirm({
width: 530,
title: '提示',
centered: true,
okText: '确定',
cancelText: '取消',
content: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "tc font16",
children: [tip, /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), isSave ? "\u5728".concat(dayjs_min_default()(res.end_time).format("YYYY-MM-DD HH:mm"), "\u4E4B\u524D\uFF0C\u5141\u8BB8\u4FEE\u6539\u7B54\u9898") : "\u63D0\u4EA4\u540E\u65E0\u6CD5\u518D\u4FEE\u6539\u7B54\u9898\uFF0C\u662F\u5426\u786E\u8BA4\u63D0\u4EA4\uFF1F"]
}),
onOk: function () {
var _onOk4 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee9() {
return regeneratorRuntime_default()().wrap(function _callee9$(_context9) {
while (1) switch (_context9.prev = _context9.next) {
case 0:
if (isSave) {
handleToDetail();
} else {
handleSubmitAnswer();
}
case 1:
case "end":
return _context9.stop();
}
}, _callee9);
}));
function onOk() {
return _onOk4.apply(this, arguments);
}
return onOk;
}()
});
} else {
es_modal/* default */.Z.info({
width: 530,
title: '提示',
centered: true,
okText: '知道啦',
content: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "tc font16",
children: isSave ? "\u5728".concat(dayjs_min_default()(res.end_time).format("YYYY-MM-DD HH:mm"), "\u4E4B\u524D\uFF0C\u5141\u8BB8\u4FEE\u6539\u7B54\u9898") : "\u63D0\u4EA4\u540E\u65E0\u6CD5\u518D\u4FEE\u6539\u7B54\u9898\uFF0C\u662F\u5426\u786E\u8BA4\u63D0\u4EA4\uFF1F"
}),
onOk: function () {
var _onOk5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee10() {
return regeneratorRuntime_default()().wrap(function _callee10$(_context10) {
while (1) switch (_context10.prev = _context10.next) {
case 0:
if (isSave) {
handleToDetail();
} else {
handleSubmitAnswer();
}
case 1:
case "end":
return _context10.stop();
}
}, _callee10);
}));
function onOk() {
return _onOk5.apply(this, arguments);
}
return onOk;
}()
});
}
case 6:
case "end":
return _context11.stop();
}
}, _callee11);
}));
return function handleVerifySave(_x7) {
return _ref7.apply(this, arguments);
};
}();
var submitProgressContent = function submitProgressContent(progress) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_progress/* default */.Z, {
strokeColor: {
from: '#108ee9',
to: '#87d068'
},
status: "active",
percent: progress
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "c-grey-c tc mt10 mb20",
children: "\u6B63\u5728\u5224\u5206\u4E2D\u2026"
})]
});
};
var submitProgressLoading = function submitProgressLoading() {
var progress = 0;
var modal = es_modal/* default */.Z.info({
title: "交卷中",
icon: null,
className: "modal-footer-none",
content: submitProgressContent(progress)
});
var interval = setInterval(function () {
if (progress <= 100) {
progress += 2;
modal.update({
content: submitProgressContent(progress)
});
} else {
modal.destroy();
clearInterval(interval);
}
}, 50);
};
var handleSubmitAnswer = /*#__PURE__*/function () {
var _ref8 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee12() {
var res;
return regeneratorRuntime_default()().wrap(function _callee12$(_context12) {
while (1) switch (_context12.prev = _context12.next) {
case 0:
submitProgressLoading();
_context12.next = 3;
return (0,exercise/* submitSimulateExerciseAnswer */.kp)({
categoryId: params.categoryId,
commit_method: 1
});
case 3:
res = _context12.sent;
(0,fullscreen/* exitFull */.BU)();
dispatch({
type: "exercise/setActionTabs",
payload: objectSpread2_default()({}, {
removeEventListenerExitScreen: true
})
});
if ((res === null || res === void 0 ? void 0 : res.status) === 0) {
message/* default */.ZP.success(res === null || res === void 0 ? void 0 : res.message);
setShowCamera(false);
setTimeout(function () {
es_modal/* default */.Z.info({
title: "交卷成功!",
okText: "确定",
onOk: function onOk() {
handleToDetail();
}
});
}, 3000);
}
case 7:
case "end":
return _context12.stop();
}
}, _callee12);
}));
return function handleSubmitAnswer() {
return _ref8.apply(this, arguments);
};
}();
var handleChangeSingle = /*#__PURE__*/function () {
var _ref9 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee13(value, id, key, item) {
return regeneratorRuntime_default()().wrap(function _callee13$(_context13) {
while (1) switch (_context13.prev = _context13.next) {
case 0:
handleSave(id, value, null, function () {
//题目选中
// const newQuestions = cloneDeep(answerData?.exercise_question_types);
// const index = newQuestions?.findIndex((e: any) => e.question_type === key)
// newQuestions[index].items.find((item: any) => item.question_id === id).user_answer[0] = value;
// answerData.exercise_question_types = newQuestions;
//答题卡选中
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = value ? 1 : 0;
item.user_answer = [];
item.user_answer.push(value);
if (!item.repeat_answer) {
item.israp = true;
}
setAnswerData(objectSpread2_default()({}, answerData));
});
case 1:
case "end":
return _context13.stop();
}
}, _callee13);
}));
return function handleChangeSingle(_x8, _x9, _x10, _x11) {
return _ref9.apply(this, arguments);
};
}();
var handleChangeSingles = /*#__PURE__*/function () {
var _ref10 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee14(value, id, key, item, items) {
return regeneratorRuntime_default()().wrap(function _callee14$(_context14) {
while (1) switch (_context14.prev = _context14.next) {
case 0:
handleSave(item.question_id, value, null, function () {
var _items$sub_exercise_q, _items$sub_exercise_q2, _items$sub_exercise_q3;
//题目选中
// const newQuestions = cloneDeep(answerData?.exercise_question_types);
// const index = newQuestions?.findIndex((e: any) => e.question_type === key)
// newQuestions[index].items.find((item: any) => item.question_id === id).user_answer[0] = value;
// answerData.exercise_question_types = newQuestions;
//答题卡选中
// console.log(answerData,id);
item.user_answer = [];
item.user_answer.push(value);
// let items=answerData?.exercise_question_types?.find((item:any)=>item.question_type === 7)?.items?.find((items:any)=>items.question_id===id)
var answer = items === null || items === void 0 || (_items$sub_exercise_q = items.sub_exercise_questions) === null || _items$sub_exercise_q === void 0 ? void 0 : _items$sub_exercise_q.filter(function (item) {
var _item$user_answer;
return ((_item$user_answer = item.user_answer) === null || _item$user_answer === void 0 ? void 0 : _item$user_answer.length) === 0;
});
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = (answer === null || answer === void 0 ? void 0 : answer.length) === (items === null || items === void 0 || (_items$sub_exercise_q2 = items.sub_exercise_questions) === null || _items$sub_exercise_q2 === void 0 ? void 0 : _items$sub_exercise_q2.length) ? 0 : (answer === null || answer === void 0 ? void 0 : answer.length) > 0 && (answer === null || answer === void 0 ? void 0 : answer.length) < (items === null || items === void 0 || (_items$sub_exercise_q3 = items.sub_exercise_questions) === null || _items$sub_exercise_q3 === void 0 ? void 0 : _items$sub_exercise_q3.length) ? 2 : 1;
setAnswerData(objectSpread2_default()({}, answerData));
// initData();
});
case 1:
case "end":
return _context14.stop();
}
}, _callee14);
}));
return function handleChangeSingles(_x12, _x13, _x14, _x15, _x16) {
return _ref10.apply(this, arguments);
};
}();
var handleChangeMultiple = function handleChangeMultiple(value, id, item, items) {
handleSave(id, value, null, function () {
item.user_answer = value;
if (items !== null && items !== void 0 && items.question_id) {
var _items$sub_exercise_q4, _items$sub_exercise_q5, _items$sub_exercise_q6;
// 组合题中的多选题
var answer = items === null || items === void 0 || (_items$sub_exercise_q4 = items.sub_exercise_questions) === null || _items$sub_exercise_q4 === void 0 ? void 0 : _items$sub_exercise_q4.filter(function (item) {
var _item$user_answer2;
return ((_item$user_answer2 = item.user_answer) === null || _item$user_answer2 === void 0 ? void 0 : _item$user_answer2.length) === 0;
});
answerData.question_status.find(function (item) {
return item.ques_id === (items === null || items === void 0 ? void 0 : items.question_id);
}).ques_status = (answer === null || answer === void 0 ? void 0 : answer.length) === (items === null || items === void 0 || (_items$sub_exercise_q5 = items.sub_exercise_questions) === null || _items$sub_exercise_q5 === void 0 ? void 0 : _items$sub_exercise_q5.length) ? 0 : (answer === null || answer === void 0 ? void 0 : answer.length) > 0 && (answer === null || answer === void 0 ? void 0 : answer.length) < (items === null || items === void 0 || (_items$sub_exercise_q6 = items.sub_exercise_questions) === null || _items$sub_exercise_q6 === void 0 ? void 0 : _items$sub_exercise_q6.length) ? 2 : 1;
} else {
if (!item.repeat_answer) {
item.israp = true;
}
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = value !== null && value !== void 0 && value.length ? 1 : 0;
}
setAnswerData(objectSpread2_default()({}, answerData));
});
};
var handleBlurFill = /*#__PURE__*/function () {
var _ref11 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee15(value, index, id, param, item, items) {
var res;
return regeneratorRuntime_default()().wrap(function _callee15$(_context15) {
while (1) switch (_context15.prev = _context15.next) {
case 0:
_context15.next = 2;
return handleSave(id, index, value, function () {
// item.user_answer=value;
var answers = {
choice_id: index,
answer_text: value
};
if (item.user_answer.filter(function (item) {
return item.choice_id != index;
})) {
item.user_answer.splice(index - 1, 1, answers);
} else {
item.user_answer.push(answers);
}
if (items !== null && items !== void 0 && items.question_id) {
var _items$sub_exercise_q7, _items$sub_exercise_q8, _items$sub_exercise_q9;
// 组合题中的填空题
var answer = items === null || items === void 0 || (_items$sub_exercise_q7 = items.sub_exercise_questions) === null || _items$sub_exercise_q7 === void 0 ? void 0 : _items$sub_exercise_q7.filter(function (item) {
var _item$user_answer3;
return ((_item$user_answer3 = item.user_answer) === null || _item$user_answer3 === void 0 ? void 0 : _item$user_answer3.length) === 0;
});
answerData.question_status.find(function (item) {
return item.ques_id === (items === null || items === void 0 ? void 0 : items.question_id);
}).ques_status = (answer === null || answer === void 0 ? void 0 : answer.length) === (items === null || items === void 0 || (_items$sub_exercise_q8 = items.sub_exercise_questions) === null || _items$sub_exercise_q8 === void 0 ? void 0 : _items$sub_exercise_q8.length) ? 0 : (answer === null || answer === void 0 ? void 0 : answer.length) > 0 && (answer === null || answer === void 0 ? void 0 : answer.length) < (items === null || items === void 0 || (_items$sub_exercise_q9 = items.sub_exercise_questions) === null || _items$sub_exercise_q9 === void 0 ? void 0 : _items$sub_exercise_q9.length) ? 2 : 1;
} else {
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = param.every(function (k) {
return !!k.answer_text;
}) ? 1 : answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = param.some(function (k) {
return !!k.answer_text;
}) ? 2 : 0;
if (!item.repeat_answer) {
item.israp = true;
}
}
setAnswerData(objectSpread2_default()({}, answerData));
});
case 2:
res = _context15.sent;
return _context15.abrupt("return", res);
case 4:
case "end":
return _context15.stop();
}
}, _callee15);
}));
return function handleBlurFill(_x17, _x18, _x19, _x20, _x21, _x22) {
return _ref11.apply(this, arguments);
};
}();
var handleBlurBProgram = /*#__PURE__*/function () {
var _ref12 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee16(value, index, id, param, item) {
var res;
return regeneratorRuntime_default()().wrap(function _callee16$(_context16) {
while (1) switch (_context16.prev = _context16.next) {
case 0:
_context16.next = 2;
return handleSave(id, index, value, function () {
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = param.every(function (k) {
return !!k.value;
}) ? 1 : answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = param.some(function (k) {
return !!k.value;
}) ? 2 : 0;
// item.user_answer=value;
var answers = {
choice_id: index,
answer_text: value
};
if (item.user_answer.filter(function (item) {
return item.choice_id != index;
})) {
item.user_answer.splice(index - 1, 1, answers);
} else {
item.user_answer.push(answers);
}
if (!item.repeat_answer) {
item.israp = true;
}
setAnswerData(objectSpread2_default()({}, answerData));
});
case 2:
res = _context16.sent;
return _context16.abrupt("return", res);
case 4:
case "end":
return _context16.stop();
}
}, _callee16);
}));
return function handleBlurBProgram(_x23, _x24, _x25, _x26, _x27) {
return _ref12.apply(this, arguments);
};
}();
var handleBlurSimple = function handleBlurSimple(value, id, item, items) {
handleSave(id, null, value, function () {
// item.user_answer=value;
item.user_answer = [];
item.user_answer.push(value);
if (items !== null && items !== void 0 && items.question_id) {
var _items$sub_exercise_q10, _items$sub_exercise_q11, _items$sub_exercise_q12;
// 组合题中的简答题
var answer = items === null || items === void 0 || (_items$sub_exercise_q10 = items.sub_exercise_questions) === null || _items$sub_exercise_q10 === void 0 ? void 0 : _items$sub_exercise_q10.filter(function (item) {
var _item$user_answer4;
return ((_item$user_answer4 = item.user_answer) === null || _item$user_answer4 === void 0 ? void 0 : _item$user_answer4.length) === 0;
});
answerData.question_status.find(function (item) {
return item.ques_id === (items === null || items === void 0 ? void 0 : items.question_id);
}).ques_status = (answer === null || answer === void 0 ? void 0 : answer.length) === (items === null || items === void 0 || (_items$sub_exercise_q11 = items.sub_exercise_questions) === null || _items$sub_exercise_q11 === void 0 ? void 0 : _items$sub_exercise_q11.length) ? 0 : (answer === null || answer === void 0 ? void 0 : answer.length) > 0 && (answer === null || answer === void 0 ? void 0 : answer.length) < (items === null || items === void 0 || (_items$sub_exercise_q12 = items.sub_exercise_questions) === null || _items$sub_exercise_q12 === void 0 ? void 0 : _items$sub_exercise_q12.length) ? 2 : 1;
} else {
answerData.question_status.find(function (item) {
return item.ques_id === id;
}).ques_status = value ? 1 : 0;
if (!item.repeat_answer) {
item.israp = true;
}
}
setAnswerData(objectSpread2_default()({}, answerData));
});
};
var renderSingle = function renderSingle(item, key) {
var _answerData$exercise5, _item$user_answer5, _item$user_answer6, _item$question_choice, _answerData$exercise6, _answerData$exercise7, _answerData$exercise8, _item$standard_answer;
var disabled = (answerData === null || answerData === void 0 || (_answerData$exercise5 = answerData.exercise) === null || _answerData$exercise5 === void 0 ? void 0 : _answerData$exercise5.user_exercise_status) === 1 || !item.repeat_answer && (item === null || item === void 0 || (_item$user_answer5 = item.user_answer) === null || _item$user_answer5 === void 0 ? void 0 : _item$user_answer5.length) > 0 && item.ques_status !== 0;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: ImitateAnswermodules.baseMargin,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, {
disabled: disabled,
defaultValue: item === null || item === void 0 || (_item$user_answer6 = item.user_answer) === null || _item$user_answer6 === void 0 ? void 0 : _item$user_answer6[0],
onChange: function onChange(e) {
return handleChangeSingle(e.target.value, item === null || item === void 0 ? void 0 : item.question_id, key, item);
},
className: item.user_score && "edu-radio-".concat(item.user_score === item.question_score ? "green" : "red"),
children: item === null || item === void 0 || (_item$question_choice = item.question_choices) === null || _item$question_choice === void 0 ? void 0 : _item$question_choice.map(function (answer, index) {
var isJudge = item.question_type == 2;
var prefix = isJudge ? '' : "".concat(tagList[index], ".");
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(ImitateAnswermodules.answerWrap),
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
className: ImitateAnswermodules.noWrap
// disabled={(!item.repeat_answer && item?.user_answer?.length > 0 && !item.israp)}
,
disabled: !!(answerData !== null && answerData !== void 0 && answerData.exercise.commit_status),
value: answer === null || answer === void 0 ? void 0 : answer.choice_id,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "mr3 font16",
children: prefix
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
style: {
width: 740
},
className: ImitateAnswermodules.renderHtml,
value: answer === null || answer === void 0 ? void 0 : answer.choice_text
})]
})
}, index);
})
}), (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise6 = answerData.exercise) === null || _answerData$exercise6 === void 0 ? void 0 : _answerData$exercise6.answer_open) && ((answerData === null || answerData === void 0 || (_answerData$exercise7 = answerData.exercise) === null || _answerData$exercise7 === void 0 ? void 0 : _answerData$exercise7.exercise_status) == 3 || (answerData === null || answerData === void 0 || (_answerData$exercise8 = answerData.exercise) === null || _answerData$exercise8 === void 0 ? void 0 : _answerData$exercise8.user_exercise_status) == 1) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: ["\u53C2\u8003\u7B54\u6848\uFF1A", item === null || item === void 0 || (_item$standard_answer = item.standard_answer) === null || _item$standard_answer === void 0 ? void 0 : _item$standard_answer.map(function (answer, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: tagList[Number(answer) - 1]
}, index);
})]
})]
});
};
var renderCombinaiton = function renderCombinaiton(items, keys, i) {
var _items$sub_exercise_q13;
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
children: items === null || items === void 0 || (_items$sub_exercise_q13 = items.sub_exercise_questions) === null || _items$sub_exercise_q13 === void 0 ? void 0 : _items$sub_exercise_q13.map(function (item, key) {
var _item$user_answer7, _item$question_choice2, _answerData$exercise9, _answerData$exercise10, _answerData$exercise11, _item$standard_answer2;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "".concat(ImitateAnswermodules.baseMargin, " ").concat(ImitateAnswermodules.singleItem, " mb20"),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'baseline',
userSelect: "none",
marginBottom: 40
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
flexShrink: 0,
color: '#999999'
},
className: "font14",
children: ["\uFF08", item === null || item === void 0 ? void 0 : item.question_score, "\u5206\uFF09"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
flexShrink: 0,
marginRight: 6
},
className: "font16",
children: i + 1 + '.' + (key + 1)
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: item === null || item === void 0 ? void 0 : item.question_title
})]
}), (item.question_type == 0 || item.question_type == 2) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default.Group */.ZP.Group, {
style: {
marginLeft: 66
},
disabled: !!(answerData !== null && answerData !== void 0 && answerData.exercise.commit_status),
defaultValue: item === null || item === void 0 || (_item$user_answer7 = item.user_answer) === null || _item$user_answer7 === void 0 ? void 0 : _item$user_answer7[0],
onChange: function onChange(e) {
return handleChangeSingles(e.target.value, items === null || items === void 0 ? void 0 : items.question_id, key, item, items);
},
className: item.user_score && "edu-radio-".concat(item.user_score === item.question_score ? "green" : "red"),
children: item === null || item === void 0 || (_item$question_choice2 = item.question_choices) === null || _item$question_choice2 === void 0 ? void 0 : _item$question_choice2.map(function (answer, index) {
var _item$user_answer8;
var isJudge = item.question_type == 2;
var prefix = isJudge ? '' : "".concat(tagList[index], ".");
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ImitateAnswermodules.answerWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_radio/* default */.ZP, {
className: ImitateAnswermodules.noWrap,
disabled: !item.repeat_answer && (item === null || item === void 0 || (_item$user_answer8 = item.user_answer) === null || _item$user_answer8 === void 0 ? void 0 : _item$user_answer8.length) > 0,
value: answer === null || answer === void 0 ? void 0 : answer.choice_id,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#333333'
},
className: "mr3 font16 ".concat(ImitateAnswermodules.noWrap),
children: prefix
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
style: {
width: 734
},
className: ImitateAnswermodules.renderHtml,
value: answer === null || answer === void 0 ? void 0 : answer.choice_text
})]
})
}, index);
})
}), (item === null || item === void 0 ? void 0 : item.question_type) == 1 && renderMultiple(item, key, items), (item === null || item === void 0 ? void 0 : item.question_type) == 3 && renderFill(item, item === null || item === void 0 ? void 0 : item.question_type, items), (item === null || item === void 0 ? void 0 : item.question_type) == 4 && renderSimple(item, item === null || item === void 0 ? void 0 : item.question_type, items), (0,authority/* isStudent */.dE)() && (item.question_type == 0 || item.question_type == 2) && (answerData === null || answerData === void 0 || (_answerData$exercise9 = answerData.exercise) === null || _answerData$exercise9 === void 0 ? void 0 : _answerData$exercise9.answer_open) && ((answerData === null || answerData === void 0 || (_answerData$exercise10 = answerData.exercise) === null || _answerData$exercise10 === void 0 ? void 0 : _answerData$exercise10.exercise_status) == 3 || (answerData === null || answerData === void 0 || (_answerData$exercise11 = answerData.exercise) === null || _answerData$exercise11 === void 0 ? void 0 : _answerData$exercise11.user_exercise_status) == 1) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: ["\u53C2\u8003\u7B54\u6848\uFF1A", item === null || item === void 0 || (_item$standard_answer2 = item.standard_answer) === null || _item$standard_answer2 === void 0 ? void 0 : _item$standard_answer2.map(function (answer, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: tagList[Number(answer) - 1]
}, index);
})]
})]
}, key);
})
});
};
var renderMultiple = function renderMultiple(item, key, items) {
var _item$question_choice3, _answerData$exercise12, _answerData$exercise13, _item$standard_answer3;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: ImitateAnswermodules.baseMargin,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z.Group, {
disabled: !!(answerData !== null && answerData !== void 0 && answerData.exercise.commit_status),
defaultValue: item === null || item === void 0 ? void 0 : item.user_answer,
onChange: function onChange(value) {
return handleChangeMultiple(value, item === null || item === void 0 ? void 0 : item.question_id, item, items);
},
className: item.user_score && "edu-checkbox-".concat(item.user_score === item.question_score ? "green" : "red"),
children: item === null || item === void 0 || (_item$question_choice3 = item.question_choices) === null || _item$question_choice3 === void 0 ? void 0 : _item$question_choice3.map(function (answer, index) {
var _item$user_answer9;
var prefix = "".concat(tagList[index], ".");
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ImitateAnswermodules.answerWrap,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(es_checkbox/* default */.Z, {
disabled: !item.repeat_answer && (item === null || item === void 0 || (_item$user_answer9 = item.user_answer) === null || _item$user_answer9 === void 0 ? void 0 : _item$user_answer9.length) > 0 && !item.israp,
value: answer === null || answer === void 0 ? void 0 : answer.choice_id,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "mr3 font16",
children: prefix
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
className: ImitateAnswermodules.renderHtml,
value: answer === null || answer === void 0 ? void 0 : answer.choice_text
})]
})
}, index);
})
}), (0,authority/* isStudent */.dE)() && (answerData === null || answerData === void 0 || (_answerData$exercise12 = answerData.exercise) === null || _answerData$exercise12 === void 0 ? void 0 : _answerData$exercise12.answer_open) && (answerData === null || answerData === void 0 || (_answerData$exercise13 = answerData.exercise) === null || _answerData$exercise13 === void 0 ? void 0 : _answerData$exercise13.exercise_status) == 3 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: ["\u53C2\u8003\u7B54\u6848\uFF1A", item === null || item === void 0 || (_item$standard_answer3 = item.standard_answer) === null || _item$standard_answer3 === void 0 ? void 0 : _item$standard_answer3.map(function (answer, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: tagList[Number(answer) - 1]
}, index);
})]
})]
});
};
var renderFill = function renderFill(item, key, items) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Fill, {
item: item,
answerData: answerData,
onBlur: ( /*#__PURE__*/function () {
var _ref13 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee17(value, index, userAnswer) {
return regeneratorRuntime_default()().wrap(function _callee17$(_context17) {
while (1) switch (_context17.prev = _context17.next) {
case 0:
_context17.next = 2;
return handleBlurFill(value, index, item === null || item === void 0 ? void 0 : item.question_id, userAnswer, item, items);
case 2:
return _context17.abrupt("return", _context17.sent);
case 3:
case "end":
return _context17.stop();
}
}, _callee17);
}));
return function (_x28, _x29, _x30) {
return _ref13.apply(this, arguments);
};
}())
});
};
// 简答题
var renderSimple = function renderSimple(item, key, items) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Simple, {
item: item,
answerData: answerData,
onBlur: function onBlur(value) {
return handleBlurSimple(value, item === null || item === void 0 ? void 0 : item.question_id, item, items);
}
});
};
var renderShixun = function renderShixun(item, key) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Shixun, {
item: item,
answerData: answerData
});
};
var renderProgram = function renderProgram(item, key) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_Program, {
item: item,
answerData: answerData
});
};
var renderBProgram = function renderBProgram(item, key) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(components_BFill, {
item: item,
answerData: answerData,
onBlur: ( /*#__PURE__*/function () {
var _ref14 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee18(value, index, userAnswer) {
return regeneratorRuntime_default()().wrap(function _callee18$(_context18) {
while (1) switch (_context18.prev = _context18.next) {
case 0:
_context18.next = 2;
return handleBlurBProgram(value, index, item === null || item === void 0 ? void 0 : item.question_id, userAnswer, item);
case 2:
return _context18.abrupt("return", _context18.sent);
case 3:
case "end":
return _context18.stop();
}
}, _callee18);
}));
return function (_x31, _x32, _x33) {
return _ref14.apply(this, arguments);
};
}())
});
};
var renderAnswerCard = function renderAnswerCard(title, key, index) {
var _answerData$exercise_2, _obj$items;
var obj = answerData === null || answerData === void 0 || (_answerData$exercise_2 = answerData.exercise_question_types) === null || _answerData$exercise_2 === void 0 ? void 0 : _answerData$exercise_2.find(function (item) {
return item.question_type === key;
});
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: ImitateAnswermodules.answerSheetWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: ImitateAnswermodules.answerSheetQuestionTitle,
onClick: function onClick() {
hideAnswerCard[key] = !hideAnswerCard[key];
setHideAnswerCard(objectSpread2_default()({}, hideAnswerCard));
},
children: [!hideAnswerCard[key] && /*#__PURE__*/(0,jsx_runtime.jsx)(MinusSquareOutlined/* default */.Z, {}), hideAnswerCard[key] && /*#__PURE__*/(0,jsx_runtime.jsx)(PlusSquareOutlined/* default */.Z, {}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "ml5 c-grey-666",
children: title
})]
}), !hideAnswerCard[key] && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
className: ImitateAnswermodules.answerSheet,
gutter: [20, 20],
children: obj === null || obj === void 0 || (_obj$items = obj.items) === null || _obj$items === void 0 ? void 0 : _obj$items.map(function (item, k) {
if (item.question_type === key) {
var _answerData$question_, _answerData$question_2, _answerData$question_3;
return /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
onClick: function onClick() {
var _answerData$exercise14;
if (index === oneindex && k === twoindex) {
//点击的答题卡选项恰好是当前题目时不该做任何操作
return;
}
answerData.exercise_question_types[oneindex].items[twoindex].israp = false;
setAnswerData(objectSpread2_default()({}, answerData));
if (!ischecked && (answerData === null || answerData === void 0 || (_answerData$exercise14 = answerData.exercise) === null || _answerData$exercise14 === void 0 ? void 0 : _answerData$exercise14.user_exercise_status) === 0 && (0,authority/* isStudent */.dE)()) {
var _answerData$exercise_3;
if (!((_answerData$exercise_3 = answerData.exercise_question_types) !== null && _answerData$exercise_3 !== void 0 && (_answerData$exercise_3 = _answerData$exercise_3[oneindex]) !== null && _answerData$exercise_3 !== void 0 && (_answerData$exercise_3 = _answerData$exercise_3.items) !== null && _answerData$exercise_3 !== void 0 && (_answerData$exercise_3 = _answerData$exercise_3[twoindex]) !== null && _answerData$exercise_3 !== void 0 && _answerData$exercise_3.repeat_answer)) {
setisshowmodal(true);
settype(3);
setindexitems({
oneindex: index,
twoindex: k
});
return;
}
}
setoneindex(index);
settwoindex(k);
var anchorName = "Anchor_".concat(key, "_").concat(k);
var anchorElement = document.getElementById(anchorName);
if (anchorElement) {
setTimeout(function () {
return anchorElement.scrollIntoView({
block: "start",
behavior: "smooth"
});
});
}
},
className: "\n ".concat(ImitateAnswermodules.answerSheetItem, "\n ").concat(answerData !== null && answerData !== void 0 && (_answerData$question_ = answerData.question_status) !== null && _answerData$question_ !== void 0 && _answerData$question_.some(function (val) {
return val.ques_id === item.question_id && (val === null || val === void 0 ? void 0 : val.ques_status) === 1;
}) ? ImitateAnswermodules.active : '', "\n ").concat(answerData !== null && answerData !== void 0 && (_answerData$question_2 = answerData.question_status) !== null && _answerData$question_2 !== void 0 && _answerData$question_2.some(function (val) {
return val.ques_id === item.question_id && (val === null || val === void 0 ? void 0 : val.ques_status) === 2;
}) ? ImitateAnswermodules.partialActive : '', "\n ").concat(index === oneindex && k === twoindex ? ImitateAnswermodules.selected : '', "\n "),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ImitateAnswermodules.qindex,
children: k + 1
}), (answerData === null || answerData === void 0 || (_answerData$question_3 = answerData.question_status) === null || _answerData$question_3 === void 0 ? void 0 : _answerData$question_3.some(function (val) {
return val.ques_id === item.question_id && (val === null || val === void 0 ? void 0 : val.ques_status) === 2;
})) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
height: 12,
background: '#3061D0',
position: 'absolute',
width: '100%',
bottom: 0
}
})]
}, k)
});
}
})
}, key)]
});
};
var renderQuestion = function renderQuestion(item, i) {
var _item$schools, _item$answer_comments, _item$answer_comments2, _answerData$exercise15, _answerData$exercise16;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: ImitateAnswermodules.questionItem,
id: "Anchor_".concat(item === null || item === void 0 ? void 0 : item.question_type, "_").concat(i),
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
display: 'flex',
alignItems: 'baseline',
marginTop: 20,
marginBottom: 40,
userSelect: "none"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "".concat(ImitateAnswermodules.questionScore, " mr10"),
children: [item === null || item === void 0 ? void 0 : item.question_score, "\u5206"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "font16 ".concat(ImitateAnswermodules.noWrap),
children: [i + 1, "\u3001"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: (item === null || item === void 0 ? void 0 : item.question_type) == 8 ? item === null || item === void 0 ? void 0 : item.description : item === null || item === void 0 ? void 0 : item.question_title
}), !(item !== null && item !== void 0 && item.repeat_answer) && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#E30000',
marginLeft: 20,
fontSize: 14
},
children: "\u6CE8\u610F\uFF1A\u8BE5\u9898\u4F5C\u7B54\u4E4B\u540E\u4E0D\u5141\u8BB8\u4FEE\u6539\u7B54\u6848\u3002"
}), !!(item !== null && item !== void 0 && (_item$schools = item.schools) !== null && _item$schools !== void 0 && _item$schools.length) && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: "\u8BE5\u5B9E\u8BAD\u9898\u9762\u5411\u6307\u5B9A\u5355\u4F4D\u5F00\u653E",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "iconfont icon-zhidinggongkai1 line24 font18 c-orange"
})
})]
}),
// 单选题
(item === null || item === void 0 ? void 0 : item.question_type) == 0 && renderSingle(item, item === null || item === void 0 ? void 0 : item.question_type),
// 判断题
(item === null || item === void 0 ? void 0 : item.question_type) == 2 && renderSingle(item, item === null || item === void 0 ? void 0 : item.question_type),
// 多选题
(item === null || item === void 0 ? void 0 : item.question_type) == 1 && renderMultiple(item, item === null || item === void 0 ? void 0 : item.question_type),
// 填空题
(item === null || item === void 0 ? void 0 : item.question_type) == 3 && renderFill(item, item === null || item === void 0 ? void 0 : item.question_type),
// 简答题
(item === null || item === void 0 ? void 0 : item.question_type) == 4 && renderSimple(item, item === null || item === void 0 ? void 0 : item.question_type),
// 实训题
(item === null || item === void 0 ? void 0 : item.question_type) == 5 && renderShixun(item, item === null || item === void 0 ? void 0 : item.question_type),
// 编程题
(item === null || item === void 0 ? void 0 : item.question_type) == 6 && renderProgram(item, item === null || item === void 0 ? void 0 : item.question_type),
// 组合题
(item === null || item === void 0 ? void 0 : item.question_type) == 7 && renderCombinaiton(item, item === null || item === void 0 ? void 0 : item.question_type, i),
// 程序填空题
(item === null || item === void 0 ? void 0 : item.question_type) == 8 && renderBProgram(item, item === null || item === void 0 ? void 0 : item.question_type), !!(item !== null && item !== void 0 && (_item$answer_comments = item.answer_comments) !== null && _item$answer_comments !== void 0 && _item$answer_comments.length) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "mt30",
children: item === null || item === void 0 || (_item$answer_comments2 = item.answer_comments) === null || _item$answer_comments2 === void 0 ? void 0 : _item$answer_comments2.map(function (v, k) {
var _v$user, _v$user2;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
gutter: [0, 10],
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: "50px",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
src: env/* default */.Z.API_SERVER + '/images/' + ((_v$user = v.user) === null || _v$user === void 0 ? void 0 : _v$user.image_url),
width: "40",
style: {
borderRadius: 40
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
flex: "1",
children: [v.updated_at, /*#__PURE__*/(0,jsx_runtime.jsx)("br", {}), (_v$user2 = v.user) === null || _v$user2 === void 0 ? void 0 : _v$user2.name]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: "c-grey-c",
children: [v.shixun_chanllge_position && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u7B2C", v.shixun_chanllge_position, "\u5173"]
}), item.question_type !== 4 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u539F\u59CB\u5F97\u5206", v.origin_score, "\u5206 \uFF0C"]
}), " \u4FEE\u6B63\u4E3A", v.score, "\u5206"]
})]
}), v.comment && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
gutter: [0, 10],
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: "50px"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: "1",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(ImitateAnswer_TextArea, {
autoSize: true,
value: v.comment,
disabled: true
})
})]
})]
}, k);
})
}), (item === null || item === void 0 ? void 0 : item.question_type) < 3 && (item === null || item === void 0 ? void 0 : item.standard_answer_show) && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "font16 ml20",
children: ["\u6B63\u786E\u7B54\u6848\uFF1A", item === null || item === void 0 ? void 0 : item.standard_answer_show]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: (item === null || item === void 0 ? void 0 : item.user_score) !== null && (item === null || item === void 0 ? void 0 : item.user_score) >= 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: scoreStatusMapping[Number(item === null || item === void 0 ? void 0 : item.answer_status)] || 'c-orange-ff9',
children: item === null || item === void 0 ? void 0 : item.user_score
}), " \u5206"]
})
}),
// 实训题 ,答题
(item === null || item === void 0 ? void 0 : item.question_type) == 5 && !((_answerData$exercise15 = answerData.exercise) !== null && _answerData$exercise15 !== void 0 && _answerData$exercise15.commit_status) && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
justify: "end",
className: "mt20",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
className: ImitateAnswermodules.toIframeBtn,
onClick: function onClick() {
return handleJoinShixun(item);
},
children: "\u8FDB\u5165\u7B54\u9898"
})
}),
// 编程题 ,答题
(item === null || item === void 0 ? void 0 : item.question_type) == 6 && !((_answerData$exercise16 = answerData.exercise) !== null && _answerData$exercise16 !== void 0 && _answerData$exercise16.commit_status) && /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
justify: "end",
className: "mt20",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
className: ImitateAnswermodules.toIframeBtn,
onClick: function onClick() {
return handleJoinProgram(item);
},
children: "\u8FDB\u5165\u7B54\u9898"
})
})]
});
};
var renderCardList = function renderCardList(item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
children: renderAnswerCard(item.name || constant/* QUESTIONTYPE */.f[item.question_type].name, item.question_type, index)
});
};
//转换中文
var toChinesNum = function toChinesNum(num) {
var changeNum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']; //changeNum[0] = "零"
var unit = ["", "十", "百", "千", "万"];
num = parseInt(num);
var getWan = function getWan(temp) {
var strArr = temp.toString().split("").reverse();
var newNum = "";
for (var i = 0; i < strArr.length; i++) {
newNum = (i == 0 && strArr[i] == 0 ? "" : i > 0 && strArr[i] == 0 && strArr[i - 1] == 0 ? "" : changeNum[strArr[i]] + (strArr[i] == 0 ? unit[0] : unit[i])) + newNum;
}
return newNum;
};
var overWan = Math.floor(num / 10000);
var noWan = num % 10000;
if (noWan.toString().length < 4) noWan = "0" + noWan;
return overWan ? getWan(overWan) + "万" + getWan(noWan) : getWan(num);
};
var renderClassifyQuestion = function renderClassifyQuestion() {
var _answerData$exercise_4, _answerData$exercise_5, _answerData$exercise_6, _answerData$exercise_7, _answerData$exercise_8, _answerData$exercise_9;
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "pt20",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: ImitateAnswermodules.questionTypeTitle,
children: [toChinesNum(oneindex + 1), "\u3001", answerData === null || answerData === void 0 || (_answerData$exercise_4 = answerData.exercise_question_types) === null || _answerData$exercise_4 === void 0 || (_answerData$exercise_4 = _answerData$exercise_4[oneindex]) === null || _answerData$exercise_4 === void 0 ? void 0 : _answerData$exercise_4.name]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: ImitateAnswermodules.questionTypeInfo,
children: ["\uFF08\u5171", answerData === null || answerData === void 0 || (_answerData$exercise_5 = answerData.exercise_question_types) === null || _answerData$exercise_5 === void 0 || (_answerData$exercise_5 = _answerData$exercise_5[oneindex]) === null || _answerData$exercise_5 === void 0 ? void 0 : _answerData$exercise_5.count, "\u9898\uFF1B", (answerData === null || answerData === void 0 || (_answerData$exercise_6 = answerData.exercise_question_types) === null || _answerData$exercise_6 === void 0 || (_answerData$exercise_6 = _answerData$exercise_6[oneindex]) === null || _answerData$exercise_6 === void 0 ? void 0 : _answerData$exercise_6.question_type) === 7 ? "\u5305\u542B".concat(answerData === null || answerData === void 0 || (_answerData$exercise_7 = answerData.exercise_question_types) === null || _answerData$exercise_7 === void 0 || (_answerData$exercise_7 = _answerData$exercise_7[oneindex]) === null || _answerData$exercise_7 === void 0 ? void 0 : _answerData$exercise_7.sub_questions_count, "\u5C0F\u9898") : '', " \u5171", answerData === null || answerData === void 0 || (_answerData$exercise_8 = answerData.exercise_question_types) === null || _answerData$exercise_8 === void 0 || (_answerData$exercise_8 = _answerData$exercise_8[oneindex]) === null || _answerData$exercise_8 === void 0 ? void 0 : _answerData$exercise_8.score, "\u5206\uFF09"]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
children: renderQuestion(answerData === null || answerData === void 0 || (_answerData$exercise_9 = answerData.exercise_question_types) === null || _answerData$exercise_9 === void 0 || (_answerData$exercise_9 = _answerData$exercise_9[oneindex]) === null || _answerData$exercise_9 === void 0 || (_answerData$exercise_9 = _answerData$exercise_9.items) === null || _answerData$exercise_9 === void 0 ? void 0 : _answerData$exercise_9[twoindex], twoindex)
}, twoindex)]
}, oneindex);
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)(spin/* default */.Z, {
size: 'middle',
spinning: isSpin,
children: [openFullScreen && /*#__PURE__*/(0,jsx_runtime.jsx)(recordScreen/* default */.Z, {
iframe: iframe
}), /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
style: {
display: iframeBlock
},
id: "iframeShixuns",
className: ImitateAnswermodules.iframe,
src: iframeUrl,
ref: iframe,
frameBorder: "0"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: ImitateAnswermodules.fixHeader,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
className: "edu-container",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(util/* StatusClassroomsTags */.VV, {
status: answerData !== null && answerData !== void 0 && (_answerData$exercise17 = answerData.exercise) !== null && _answerData$exercise17 !== void 0 && _answerData$exercise17.commit_status ? [util/* ExerciseStatus */.ju[4]] : [util/* ExerciseStatus */.ju[99]]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: "".concat(ImitateAnswermodules.title, " ml10"),
children: answerData === null || answerData === void 0 || (_answerData$exercise18 = answerData.exercise) === null || _answerData$exercise18 === void 0 ? void 0 : _answerData$exercise18.exercise_name
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
style: {
marginLeft: 'auto'
},
children: (answerData === null || answerData === void 0 || (_answerData$exercise19 = answerData.exercise) === null || _answerData$exercise19 === void 0 ? void 0 : _answerData$exercise19.time) !== -1 && !(answerData !== null && answerData !== void 0 && (_answerData$exercise20 = answerData.exercise) !== null && _answerData$exercise20 !== void 0 && _answerData$exercise20.commit_status) && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: "".concat(ImitateAnswermodules.countDown, " ").concat(countDownColor),
children: ["\u5269\u4F59\u7B54\u9898\u65F6\u957F", /*#__PURE__*/(0,jsx_runtime.jsx)(Countdown, {
value: time,
onFinish: handleFinishTime
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: !(answerData !== null && answerData !== void 0 && (_answerData$exercise21 = answerData.exercise) !== null && _answerData$exercise21 !== void 0 && _answerData$exercise21.commit_status) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: ImitateAnswermodules.submitButton,
style: {
marginLeft: 30
},
type: "primary",
onClick: function onClick() {
return handleVerifySave(false);
},
children: "\u4EA4\u5377"
})
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
className: "edu-container",
children: [checkStatus.status === 0 && /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: ImitateAnswermodules.mainPart,
wrap: false,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
flex: showAnswerCard ? "280px" : "0px",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: ImitateAnswermodules.leftPart,
children: [showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: "bg-white",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("aside", {
className: ImitateAnswermodules.answerInfo,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
justify: "space-between",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: "\u7B54\u9898\u8FDB\u5EA6"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: ImitateAnswermodules.answerProgress,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#165DFF'
},
children: answerData === null || answerData === void 0 || (_answerData$question_4 = answerData.question_status) === null || _answerData$question_4 === void 0 || (_answerData$question_4 = _answerData$question_4.filter(function (val) {
return (val === null || val === void 0 ? void 0 : val.ques_status) === 1;
})) === null || _answerData$question_4 === void 0 ? void 0 : _answerData$question_4.length
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#999999'
},
children: ["/", answerData === null || answerData === void 0 || (_answerData$exercise_10 = answerData.exercise_types) === null || _answerData$exercise_10 === void 0 ? void 0 : _answerData$exercise_10.q_counts]
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_progress/* default */.Z, {
strokeColor: "#165dffa6",
trailColor: "#0000000d",
percent: (answerData === null || answerData === void 0 || (_answerData$question_5 = answerData.question_status) === null || _answerData$question_5 === void 0 || (_answerData$question_5 = _answerData$question_5.filter(function (val) {
return (val === null || val === void 0 ? void 0 : val.ques_status) === 1;
})) === null || _answerData$question_5 === void 0 ? void 0 : _answerData$question_5.length) / (answerData === null || answerData === void 0 || (_answerData$exercise_11 = answerData.exercise_types) === null || _answerData$exercise_11 === void 0 ? void 0 : _answerData$exercise_11.q_counts) * 100,
showInfo: false
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "c-grey-333",
children: ["\u5171 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#165DFF'
},
children: (answerData === null || answerData === void 0 || (_answerData$exercise_12 = answerData.exercise_types) === null || _answerData$exercise_12 === void 0 ? void 0 : _answerData$exercise_12.q_counts) || (answerData === null || answerData === void 0 || (_answerData$exercise_13 = answerData.exercise_scores) === null || _answerData$exercise_13 === void 0 || (_answerData$exercise_13 = _answerData$exercise_13.exercise_types) === null || _answerData$exercise_13 === void 0 ? void 0 : _answerData$exercise_13.q_counts)
}), " \u9898\uFF1A"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
className: "c-grey-333",
children: ["\u6EE1\u5206 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#FA6400'
},
children: (answerData === null || answerData === void 0 || (_answerData$exercise_14 = answerData.exercise_types) === null || _answerData$exercise_14 === void 0 ? void 0 : _answerData$exercise_14.q_scores) || (answerData === null || answerData === void 0 || (_answerData$exercise_15 = answerData.exercise_scores) === null || _answerData$exercise_15 === void 0 || (_answerData$exercise_15 = _answerData$exercise_15.exercise_types) === null || _answerData$exercise_15 === void 0 ? void 0 : _answerData$exercise_15.q_scores)
}), " \u5206"]
})]
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: ImitateAnswermodules.dottedLineWrapper,
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: ImitateAnswermodules.leftHalfCircle
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: 1,
className: ImitateAnswermodules.dottedLine
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
className: ImitateAnswermodules.rightHalfCircle
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: "1",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("aside", {
className: ImitateAnswermodules.cardList,
children: answerData === null || answerData === void 0 || (_answerData$exercise_16 = answerData.exercise_question_types) === null || _answerData$exercise_16 === void 0 ? void 0 : _answerData$exercise_16.map(function (er, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)(_react_17_0_2_react.Fragment, {
children: renderCardList(er, index)
}, er.question_type);
})
})
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
justify: "space-around",
align: "middle",
className: ImitateAnswermodules.answerSheetBottom,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: ImitateAnswermodules.tooltipWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: ImitateAnswermodules.answerYes
}), "\u5DF2\u7B54"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: ImitateAnswermodules.tooltipWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(ImitateAnswermodules.answerNo, " ml10"),
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
height: '50%',
background: '#0152d9'
}
})
}), "\u90E8\u5206\u7B54\u9898"]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
className: ImitateAnswermodules.tooltipWrap,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "".concat(ImitateAnswermodules.answerNo, " ml10")
}), "\u672A\u7B54"]
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: ImitateAnswermodules.fold,
onClick: function onClick() {
return setShowAnswerCard(!showAnswerCard);
},
children: [showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: "\u6536\u8D77\u7B54\u9898\u5361",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "icon-zuojiantou iconfont c-grey-c"
})
}), !showAnswerCard && /*#__PURE__*/(0,jsx_runtime.jsx)(tooltip/* default */.Z, {
title: "\u5C55\u5F00",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "icon-youjiantou iconfont c-grey-c"
})
})]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: "1",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("section", {
className: [ImitateAnswermodules.rightPart, 'ml20'].join(' '),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "".concat(ImitateAnswermodules.questionPart, " pl30 pr30"),
children: renderClassifyQuestion()
}), /*#__PURE__*/(0,jsx_runtime.jsx)(row/* default */.Z, {
className: ImitateAnswermodules.bottom,
align: "middle",
justify: "end",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(col/* default */.Z, {
children: [(oneindex != 0 || twoindex != 0) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: "".concat(ImitateAnswermodules.changeButton, " ").concat(ImitateAnswermodules.prevBtn, " mr20"),
type: "default",
onClick: function onClick() {
var _answerData$exercise22;
answerData.exercise_question_types[oneindex].items[twoindex].israp = false;
setAnswerData(objectSpread2_default()({}, answerData));
if (!ischecked && (answerData === null || answerData === void 0 || (_answerData$exercise22 = answerData.exercise) === null || _answerData$exercise22 === void 0 ? void 0 : _answerData$exercise22.user_exercise_status) === 0 && (0,authority/* isStudent */.dE)()) {
var _answerData$exercise_17;
if (!((_answerData$exercise_17 = answerData.exercise_question_types) !== null && _answerData$exercise_17 !== void 0 && (_answerData$exercise_17 = _answerData$exercise_17[oneindex]) !== null && _answerData$exercise_17 !== void 0 && (_answerData$exercise_17 = _answerData$exercise_17.items) !== null && _answerData$exercise_17 !== void 0 && (_answerData$exercise_17 = _answerData$exercise_17[twoindex]) !== null && _answerData$exercise_17 !== void 0 && _answerData$exercise_17.repeat_answer)) {
setisshowmodal(true);
settype(1);
return;
}
}
if (twoindex === 0) {
oneindex -= 1;
twoindex = answerData.exercise_question_types[oneindex].items.length - 1;
} else {
twoindex -= 1;
}
setoneindex(oneindex);
settwoindex(twoindex);
},
children: "\u4E0A\u4E00\u9898"
}), !(oneindex === (answerData === null || answerData === void 0 || (_answerData$exercise_18 = answerData.exercise_question_types) === null || _answerData$exercise_18 === void 0 ? void 0 : _answerData$exercise_18.length) - 1 && twoindex === (answerData === null || answerData === void 0 || (_answerData$exercise_19 = answerData.exercise_question_types) === null || _answerData$exercise_19 === void 0 || (_answerData$exercise_19 = _answerData$exercise_19[oneindex]) === null || _answerData$exercise_19 === void 0 || (_answerData$exercise_19 = _answerData$exercise_19.items) === null || _answerData$exercise_19 === void 0 ? void 0 : _answerData$exercise_19.length) - 1) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: ImitateAnswermodules.changeButton,
type: "primary",
onClick: function onClick() {
var _answerData$exercise23;
answerData.exercise_question_types[oneindex].items[twoindex].israp = false;
setAnswerData(objectSpread2_default()({}, answerData));
if (!ischecked && (answerData === null || answerData === void 0 || (_answerData$exercise23 = answerData.exercise) === null || _answerData$exercise23 === void 0 ? void 0 : _answerData$exercise23.user_exercise_status) === 0 && (0,authority/* isStudent */.dE)()) {
var _answerData$exercise_20;
if (!((_answerData$exercise_20 = answerData.exercise_question_types) !== null && _answerData$exercise_20 !== void 0 && (_answerData$exercise_20 = _answerData$exercise_20[oneindex]) !== null && _answerData$exercise_20 !== void 0 && (_answerData$exercise_20 = _answerData$exercise_20.items) !== null && _answerData$exercise_20 !== void 0 && (_answerData$exercise_20 = _answerData$exercise_20[twoindex]) !== null && _answerData$exercise_20 !== void 0 && _answerData$exercise_20.repeat_answer)) {
setisshowmodal(true);
settype(2);
return;
}
}
if (answerData.exercise_question_types[oneindex].items.length - 1 === twoindex) {
oneindex = oneindex + 1;
twoindex = 0;
} else {
twoindex = twoindex + 1;
}
setoneindex(oneindex);
settwoindex(twoindex);
},
children: "\u4E0B\u4E00\u9898"
})]
})
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
title: "\u6CE8\u610F",
open: isShowmodal,
onCancel: function onCancel() {
return setisshowmodal(false);
},
footer: false,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
style: {
marginBottom: 0
},
children: "\u79BB\u5F00\u8BE5\u9898\u540E\u4E0D\u5141\u8BB8\u518D\u6B21\u4FEE\u6539\u7B54\u6848\uFF0C\u786E\u8BA4\u79BB\u5F00\u5417\uFF1F"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
marginTop: 60,
display: 'flex',
justifyContent: 'space-between'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
checked: ischecked,
onChange: function onChange(e) {
setischecked(e.target.checked);
},
children: "\u4E0B\u6B21\u4E0D\u518D\u663E\u793A"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
if (!answerData.exercise_question_types[oneindex].items[twoindex].israp) {
if (answerData.exercise_question_types[oneindex].items[twoindex].israp === '') {
answerData.exercise_question_types[oneindex].items[twoindex].israp = true;
setAnswerData(objectSpread2_default()({}, answerData));
}
} else {
answerData.exercise_question_types[oneindex].items[twoindex].israp = true;
setAnswerData(objectSpread2_default()({}, answerData));
}
},
children: "\u6211\u518D\u60F3\u60F3"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
answerData.exercise_question_types[oneindex].items[twoindex].israp = false;
setAnswerData(objectSpread2_default()({}, answerData));
if (type === 1) {
if (twoindex === 0) {
oneindex -= 1;
twoindex = answerData.exercise_question_types[oneindex].items.length - 1;
} else {
twoindex -= 1;
}
console.log(answerData.exercise_question_types[oneindex].items[twoindex], '-----');
setoneindex(oneindex);
settwoindex(twoindex);
} else if (type === 2) {
if (answerData.exercise_question_types[oneindex].items.length - 1 === twoindex) {
oneindex = oneindex + 1;
twoindex = 0;
} else {
twoindex = twoindex + 1;
}
setoneindex(oneindex);
settwoindex(twoindex);
} else {
setoneindex(indexitems.oneindex);
settwoindex(indexitems.twoindex);
}
// initData();
setisshowmodal(false);
},
type: "primary",
style: {
marginLeft: 30
},
children: "\u786E\u8BA4"
})]
})]
})]
})
})]
}), checkStatus.status !== 0 && /*#__PURE__*/(0,jsx_runtime.jsx)(ErrCheckIpTip, {
data: checkStatus
})]
})]
});
};
/* harmony default export */ var ImitateAnswer = ((0,_umi_production_exports.connect)(function (_ref15) {
var loading = _ref15.loading,
user = _ref15.user;
return {
user: user,
loading: loading.effects
};
})(Answer));
/***/ }),
/***/ 46706:
/*!*****************************************************************!*\
!*** ./src/pages/MyProblem/TestCasePanel/index.tsx + 1 modules ***!
\*****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Y4: function() { return /* binding */ DetailCommitOut; },
Im: function() { return /* binding */ ExecuteDict; },
ZP: function() { return /* binding */ TestCasePanel; }
});
// UNUSED EXPORTS: getCommitOut
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/defineProperty.js
var defineProperty = __webpack_require__(85573);
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(9641);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.4@@ant-design/icons/es/icons/DownOutlined.js + 1 modules
var DownOutlined = __webpack_require__(83208);
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.3.4@@ant-design/icons/es/icons/UpOutlined.js + 1 modules
var UpOutlined = __webpack_require__(8650);
// EXTERNAL MODULE: ./src/pages/MyProblem/interface.ts
var MyProblem_interface = __webpack_require__(20981);
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
var base64 = __webpack_require__(24334);
;// CONCATENATED MODULE: ./src/pages/MyProblem/TestCasePanel/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/components/Spinner/index.tsx + 1 modules
var Spinner = __webpack_require__(92997);
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
var RenderHtml = __webpack_require__(52961);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(63834);
// EXTERNAL MODULE: ./node_modules/_xterm@4.8.1@xterm/lib/xterm.js
var xterm = __webpack_require__(34376);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var utils_fetch = __webpack_require__(14735);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts + 15 modules
var _umi_production_exports = __webpack_require__(8931);
// EXTERNAL MODULE: ./src/components/TestResult/index.tsx + 1 modules
var TestResult = __webpack_require__(84213);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/MyProblem/TestCasePanel/index.tsx
var TextArea = input/* default */.Z.TextArea;
var initialState = {
visible: false,
tabIndex: '0'
};
var ExecuteDict = defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, MyProblem_interface/* ExecuteStatus */.h.NOMATCH, '测试用例结果不匹配'), MyProblem_interface/* ExecuteStatus */.h.OK, '调试通过'), 2, '调试超时'), 3, '调试pod失败'), 4, '编译失败'), 5, '执行失败');
var Types = /*#__PURE__*/function (Types) {
Types[Types["SET_VISIBLE"] = 0] = "SET_VISIBLE";
Types[Types["SET_TABINDEX"] = 1] = "SET_TABINDEX";
return Types;
}(Types || {});
function Reducer(state, action) {
switch (action.type) {
case Types.SET_VISIBLE:
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
visible: action.payload
});
case Types.SET_TABINDEX:
return objectSpread2_default()(objectSpread2_default()({}, state), {}, {
tabIndex: action.payload
});
default:
throw new Error();
}
}
function DetailCommitOut(debugResult) {
var status = debugResult.status,
error_msg = debugResult.error_msg,
output = debugResult.output,
input = debugResult.input,
expected_output = debugResult.expected_output,
is_file = debugResult.is_file,
input_file_url = debugResult.input_file_url,
output_file_url = debugResult.output_file_url,
expected_output_file_url = debugResult.expected_output_file_url,
setMonacoValue = debugResult.setMonacoValue,
setData = debugResult.setData;
var outputRef = (0,_react_17_0_2_react.useRef)();
var inputRef = (0,_react_17_0_2_react.useRef)();
var expectedOutputRef = (0,_react_17_0_2_react.useRef)();
var rs = null;
var mdStyle = {
minHeight: 150,
marginBottom: 10,
paddingLeft: 24,
background: '#070f19',
color: '#fff'
};
(0,_react_17_0_2_react.useEffect)(function () {
if (output && !is_file && outputRef.current) {
var term = new xterm.Terminal({
fontSize: 14,
letterSpacing: 1,
cols: 83,
rows: 10
});
term.open(outputRef.current);
var actual_output_format = (0,util/* findEndWhitespace */.pp)(base64.Base64.decode(output));
term.write(actual_output_format);
term.setOption('theme', {
background: '#1e1e1e'
});
}
if (input && !is_file && inputRef.current) {
var term2 = new xterm.Terminal({
fontSize: 14,
letterSpacing: 1,
cols: 83,
rows: 10
});
term2.open(inputRef.current);
term2.write((0,util/* findEndWhitespace */.pp)(input));
term2.setOption('theme', {
background: '#1e1e1e'
});
}
if (expected_output && !is_file && expectedOutputRef.current) {
var term3 = new xterm.Terminal({
fontSize: 14,
letterSpacing: 1,
cols: 83,
rows: 10
});
term3.open(expectedOutputRef.current);
term3.write((0,util/* findEndWhitespace */.pp)(base64.Base64.decode(expected_output)));
term3.setOption('theme', {
background: '#1e1e1e'
});
}
}, [output]);
switch (status) {
case MyProblem_interface/* ExecuteStatus */.h.NOMATCH:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "c-red",
children: "\u5B9E\u9645\u8F93\u5165\uFF1A"
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: inputRef
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: mdStyle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
// href={input_file_url}
style: {
fontSize: '16px'
},
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return fetch(input_file_url, {
method: "Get",
headers: {
"Content-Type": "application/octet-stream",
"Accept": "*/*"
}
});
case 2:
res = _context.sent;
_context.t0 = setMonacoValue;
_context.next = 6;
return res.text();
case 6:
_context.t1 = _context.sent;
(0, _context.t0)(_context.t1);
setTimeout(function () {
setData(input_file_url);
}, 200);
// download(input_file_url, input)
case 9:
case "end":
return _context.stop();
}
}, _callee);
}))
// download={expected_output}
// target="_blank"
,
children: input
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "c-red",
children: "\u5B9E\u9645\u8F93\u51FA\uFF1A"
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: outputRef
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: mdStyle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
// href={output_file_url}
style: {
fontSize: '16px'
},
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var res;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return (0,utils_fetch/* default */.ZP)(output_file_url, {
method: "Get",
headers: {
"Content-Type": "application/xml",
"Accept": "*/*"
}
});
case 2:
res = _context2.sent;
setMonacoValue(res);
setTimeout(function () {
setData(output_file_url);
}, 200);
// download(output_file_url, output)
case 5:
case "end":
return _context2.stop();
}
}, _callee2);
}))
// download={expected_output} target="_blank"
,
children: output
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
className: "c-red",
children: "\u9884\u671F\u8F93\u51FA\uFF1A"
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: expectedOutputRef
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: mdStyle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
// href={expected_output_file_url}
style: {
fontSize: '16px'
},
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee3() {
var res;
return regeneratorRuntime_default()().wrap(function _callee3$(_context3) {
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return fetch(expected_output_file_url, {
method: "Get",
headers: {
"Content-Type": "application/octet-stream",
"Accept": "*/*"
}
});
case 2:
res = _context3.sent;
_context3.t0 = setMonacoValue;
_context3.next = 6;
return res.text();
case 6:
_context3.t1 = _context3.sent;
(0, _context3.t0)(_context3.t1);
setTimeout(function () {
setData(expected_output_file_url);
}, 200);
case 9:
case "end":
return _context3.stop();
}
}, _callee3);
}))
// download={expected_output} target="_blank"
,
children: expected_output
})
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.EXECUTEFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
border: '1px #F6F7F9 solid'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
style: {
width: '100%',
height: 40,
background: '#F6F7F9',
lineHeight: '40px',
color: "#666666",
paddingLeft: '12px'
},
children: "\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
value: input,
style: mdStyle
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: mdStyle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
// href={input_file_url} style={{fontSize:'16px'}} target="_blank"
onClick: function onClick() {
return (0,util/* download */.LR)(input_file_url, input);
},
children: input
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
style: {
border: '1px #F6F7F9 solid',
marginTop: '10px'
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
style: {
width: '100%',
height: 40,
background: '#F6F7F9',
lineHeight: '40px',
color: "#666666",
paddingLeft: '12px'
},
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("pre", {
className: "error",
style: {
color: '#E30000',
padding: '0 10px'
},
children: [base64.Base64.decode(error_msg), "111"]
})]
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.COMPILEFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"
}), !is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: inputRef
}), is_file && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: mdStyle,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
// href={input_file_url} style={{fontSize:'16px'}} target="_blank"
onClick: function onClick() {
return (0,util/* download */.LR)(input_file_url, input);
},
children: input
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
className: "error",
children: base64.Base64.decode(error_msg)
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.PODFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
});
break;
case MyProblem_interface/* ExecuteStatus */.h.TIMEOUT:
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
});
break;
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [" ", rs, " "]
});
}
function getCommitOut(debugResult) {
var status = debugResult.status,
error_msg = debugResult.error_msg,
execute_time = debugResult.execute_time,
output = debugResult.output,
input = debugResult.input,
expected_output = debugResult.expected_output,
is_file = debugResult.is_file,
input_file_url = debugResult.input_file_url,
output_file_url = debugResult.output_file_url,
expected_output_file_url = debugResult.expected_output_file_url;
var rs = null;
switch (status) {
case MyProblem_interface/* ExecuteStatus */.h.OK:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u6267\u884C\u7528\u65F6\uFF1A", execute_time / 1000, "\u79D2"]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u6267\u884C\u7ED3\u679C\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
children: base64.Base64.decode(output)
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.NOMATCH:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
children: input
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u8F93\u51FA\uFF1A", output && base64.Base64.decode(output)]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u9884\u671F\u8F93\u51FA\uFF1A", expected_output && base64.Base64.decode(expected_output)]
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.EXECUTEFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
children: input
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
className: "error",
children: base64.Base64.decode(error_msg)
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.COMPILEFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
children: ["\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A", /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
children: input
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("pre", {
className: "error",
children: base64.Base64.decode(error_msg)
})]
});
break;
case MyProblem_interface/* ExecuteStatus */.h.PODFAILURE:
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
});
break;
case MyProblem_interface/* ExecuteStatus */.h.TIMEOUT:
rs = /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
children: "\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"
});
break;
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [" ", rs, " "]
});
}
/* harmony default export */ var TestCasePanel = (function (_ref4) {
var input = _ref4.input,
is_file = _ref4.is_file,
debuging = _ref4.debuging,
submitting = _ref4.submitting,
executingMessage = _ref4.executingMessage,
debugResult = _ref4.debugResult,
onChangeInput = _ref4.onChangeInput,
onDebugCode = _ref4.onDebugCode,
onSubmitCode = _ref4.onSubmitCode,
hack = _ref4.hack,
user = _ref4.user;
var _useReducer = (0,_react_17_0_2_react.useReducer)(Reducer, initialState),
_useReducer2 = slicedToArray_default()(_useReducer, 2),
state = _useReducer2[0],
dispatch = _useReducer2[1];
var visible = state.visible,
tabIndex = state.tabIndex;
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
searchParams = _useSearchParams2[0];
function onTabIndexChange(e) {
var id = e.target.id;
dispatch({
type: Types.SET_TABINDEX,
payload: id
});
}
function onTriggerCollapse() {
dispatch({
type: Types.SET_VISIBLE,
payload: !visible
});
}
var executeResult = (0,_react_17_0_2_react.useMemo)(function () {
if (debugResult) {
var status = debugResult.status;
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: getCommitOut(debugResult)
});
}
return null;
}, [debugResult]);
function onDebug() {
if (!input || is_file) {
message/* default */.ZP.error("请输入自测用例");
dispatch({
type: Types.SET_VISIBLE,
payload: true
});
dispatch({
type: Types.SET_TABINDEX,
payload: '0'
});
return;
}
dispatch({
type: Types.SET_VISIBLE,
payload: true
});
dispatch({
type: Types.SET_TABINDEX,
payload: '1'
});
onDebugCode();
}
var skip = /*#__PURE__*/function () {
var _ref5 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee4(text) {
var res;
return regeneratorRuntime_default()().wrap(function _callee4$(_context4) {
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return (0,utils_fetch/* default */.ZP)("/api/problems/".concat(text, "/start.json"), {
method: 'get',
params: {
hack_user_id: user === null || user === void 0 ? void 0 : user.user_id
}
});
case 2:
res = _context4.sent;
if (res) {
window.location.href = "/myproblems/".concat(res === null || res === void 0 ? void 0 : res.identifier, "?type=1");
}
case 4:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return function skip(_x) {
return _ref5.apply(this, arguments);
};
}();
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "test-case-panel",
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "test-case-panel-body ".concat(visible ? 'active' : ''),
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("ul", {
className: "s-navs",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
className: 'active',
children: "\u8C03\u8BD5\u4EE3\u7801\u7ED3\u679C"
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(TestResult/* default */.Z, {
leftTitle: "\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B",
rightTitle: "\u4EE3\u7801\u6267\u884C\u7ED3\u679C",
style: {
height: 240
},
leftNode: /*#__PURE__*/(0,jsx_runtime.jsx)(TextArea, {
placeholder: "\u8BF7\u8F93\u5165\u81EA\u6D4B\u7528\u4F8B\uFF08\u5982\u679C\u672A\u586B\u5199\uFF0C\u81EA\u6D4B\u8FD0\u884C\u65F6\uFF0C\u7CFB\u7EDF\u4F1A\u81EA\u52A8\u586B\u5145\u7B2C\u4E00\u4E2A\u975E\u9690\u85CF\u7684\u6587\u672C\u7C7B\u578B\u7684\u6D4B\u8BD5\u7528\u4F8B\uFF09",
value: is_file ? '' : input,
onChange: onChangeInput
}),
rightNode: debuging ? /*#__PURE__*/(0,jsx_runtime.jsx)(Spinner/* default */.Z, {
message: '代码执行中...'
}) : debugResult ? executeResult : /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
style: {
color: '#536879'
},
children: "\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D"
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
className: "btn-collapse ".concat(visible ? 'up' : ''),
onClick: onTriggerCollapse,
children: visible ? /*#__PURE__*/(0,jsx_runtime.jsx)(DownOutlined/* default */.Z, {}) : /*#__PURE__*/(0,jsx_runtime.jsx)(UpOutlined/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("footer", {
className: "footer",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
children: "\u63A7\u5236\u53F0"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
children: [(hack === null || hack === void 0 ? void 0 : hack.is_program) && (hack === null || hack === void 0 ? void 0 : hack.above_question) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
return skip(hack === null || hack === void 0 ? void 0 : hack.above_question);
},
id: "oj-prev",
className: "btn-blue",
type: "ghost",
children: "\u4E0A\u4E00\u9898"
}), (hack === null || hack === void 0 ? void 0 : hack.is_program) && (hack === null || hack === void 0 ? void 0 : hack.under_question) && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
return skip(hack === null || hack === void 0 ? void 0 : hack.under_question);
},
id: "oj-next",
className: "btn-blue",
type: "ghost",
children: "\u4E0B\u4E00\u9898"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
className: "btn-green",
type: "ghost",
loading: debuging,
onClick: onDebug,
children: "\u8C03\u8BD5\u4EE3\u7801"
}), searchParams.get("qtype") !== '8' && /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
className: "custom-ant-disabled",
loading: submitting,
disabled: submitting,
onClick: function onClick() {
dispatch({
type: Types.SET_VISIBLE,
payload: false
});
// dispatch({
// type: Types.SET_TABINDEX,
// payload: '1'
// })
onSubmitCode();
},
children: "\u8BC4\u6D4B\u5E76\u63D0\u4EA4"
})]
})]
})]
});
});
/***/ }),
/***/ 20981:
/*!******************************************!*\
!*** ./src/pages/MyProblem/interface.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ h: function() { return /* binding */ ExecuteStatus; }
/* harmony export */ });
// created_at: "2020-07-09T19:53:54.000+08:00"
// execute_memory: null
// execute_time: 0.269
// id: 872
// language: "C"
// status: 4
var ExecuteStatus = /*#__PURE__*/function (ExecuteStatus) {
ExecuteStatus[ExecuteStatus["NOMATCH"] = -1] = "NOMATCH";
ExecuteStatus[ExecuteStatus["OK"] = 0] = "OK";
ExecuteStatus[ExecuteStatus["TIMEOUT"] = 2] = "TIMEOUT";
ExecuteStatus[ExecuteStatus["PODFAILURE"] = 3] = "PODFAILURE";
ExecuteStatus[ExecuteStatus["COMPILEFAILURE"] = 4] = "COMPILEFAILURE";
ExecuteStatus[ExecuteStatus["EXECUTEFAILURE"] = 5] = "EXECUTEFAILURE";
return ExecuteStatus;
}({});
// "id": "1",
// "status": 2, # -1测试用例结果不匹配; 0: 评测通过; ;2 评测超时;3 创建pod失败; 4 编译失败;5 执行失败
// "error_line": 3, # 错误行数
// "error_msg": "error line 7 input.." , # 报错信息
// "input": "3 4", # 输入
// "output": "7", # 输出
// "execute_time": 3, #执行时间
// "execute_memory": 300, #消耗内存
// "expected_output": "7" # 如果提交模式 会多这个参数
/***/ }),
/***/ 76958:
/*!****************************************!*\
!*** ./src/pages/MyProblem/service.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ H7: function() { return /* binding */ resetCode; },
/* harmony export */ MK: function() { return /* binding */ addNotes; },
/* harmony export */ MU: function() { return /* binding */ debugCode; },
/* harmony export */ X6: function() { return /* binding */ getRecordDetail; },
/* harmony export */ bM: function() { return /* binding */ sumbitCode; },
/* harmony export */ fi: function() { return /* binding */ syncCode; },
/* harmony export */ fu: function() { return /* binding */ getProgrammingTopic; },
/* harmony export */ n4: function() { return /* binding */ updateCode; },
/* harmony export */ rX: function() { return /* binding */ getOperationResult; },
/* harmony export */ vl: function() { return /* binding */ triggerPlus; },
/* harmony export */ zO: function() { return /* binding */ getSubmitRecords; }
/* harmony export */ });
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
/* harmony import */ var _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/utils/fetch.ts */ 14735);
function getProgrammingTopic(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, ".json"), _root_workspace_ppte5yg23_SJ5m_develop_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
hidePopLogin: true
}, params || {}));
}
function sumbitCode(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/code_submit.json"), params);
}
function debugCode(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/code_debug.json"), params);
}
function getSubmitRecords(id, params) {
if (params.language) {
params.language = encodeURIComponent(params.language);
}
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, "/submit_records.json"), params);
}
function getRecordDetail(id) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/record_detail.json", {
id: id
});
}
function getOperationResult(id, mode) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .get */ .U2)("myproblems/".concat(id, "/result.json"), {
mode: mode
});
}
function addNotes(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/add_notes.json"), params);
}
function resetCode(id) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/restore_initial_code.json"));
}
function syncCode(id) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/sync_code.json"));
}
function updateCode(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("myproblems/".concat(id, "/update_code.json"), params);
}
function triggerPlus(id, params) {
return (0,_utils_fetch_ts__WEBPACK_IMPORTED_MODULE_1__/* .post */ .v_)("discusses/".concat(id, "/plus.json"), params);
}
/***/ }),
/***/ 27666:
/*!****************************************************************************!*\
!*** ./node_modules/_antd@5.9.0@antd/es/_util/throttleByAnimationFrame.js ***!
\****************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ 41411);
/* harmony import */ var rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rc-util/es/raf */ 91659);
function throttleByAnimationFrame(fn) {
let requestId;
const later = args => () => {
requestId = null;
fn.apply(void 0, (0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(args));
};
const throttled = function () {
if (requestId == null) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
requestId = (0,rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(later(args));
}
};
throttled.cancel = () => {
rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.cancel(requestId);
requestId = null;
};
return throttled;
}
/* harmony default export */ __webpack_exports__.Z = (throttleByAnimationFrame);
/***/ }),
/***/ 81228:
/*!*********************************************************************!*\
!*** ./node_modules/_antd@5.9.0@antd/es/affix/index.js + 2 modules ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ affix; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.24.0@@babel/runtime/helpers/esm/classCallCheck.js
var classCallCheck = __webpack_require__(94627);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.24.0@@babel/runtime/helpers/esm/createClass.js
var createClass = __webpack_require__(24721);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.24.0@@babel/runtime/helpers/esm/inherits.js
var inherits = __webpack_require__(12451);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.24.0@@babel/runtime/helpers/esm/createSuper.js + 1 modules
var createSuper = __webpack_require__(36247);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
var _classnames_2_5_1_classnames = __webpack_require__(92310);
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
// EXTERNAL MODULE: ./node_modules/_rc-resize-observer@1.4.0@rc-resize-observer/es/index.js + 4 modules
var es = __webpack_require__(28647);
// EXTERNAL MODULE: ./node_modules/_rc-util@5.39.1@rc-util/es/omit.js
var omit = __webpack_require__(62805);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/throttleByAnimationFrame.js
var throttleByAnimationFrame = __webpack_require__(27666);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
var context = __webpack_require__(36355);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
var genComponentStyleHook = __webpack_require__(83116);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/statistic.js
var statistic = __webpack_require__(37613);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/affix/style/index.js
// ============================== Shared ==============================
const genSharedAffixStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
position: 'fixed',
zIndex: token.zIndexPopup
}
};
};
// ============================== Export ==============================
/* harmony default export */ var style = ((0,genComponentStyleHook/* default */.Z)('Affix', token => {
const affixToken = (0,statistic/* merge */.TS)(token, {
zIndexPopup: token.zIndexBase + 10
});
return [genSharedAffixStyle(affixToken)];
}));
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/affix/utils.js
function getTargetRect(target) {
return target !== window ? target.getBoundingClientRect() : {
top: 0,
bottom: window.innerHeight
};
}
function getFixedTop(placeholderRect, targetRect, offsetTop) {
if (offsetTop !== undefined && targetRect.top > placeholderRect.top - offsetTop) {
return offsetTop + targetRect.top;
}
return undefined;
}
function getFixedBottom(placeholderRect, targetRect, offsetBottom) {
if (offsetBottom !== undefined && targetRect.bottom < placeholderRect.bottom + offsetBottom) {
const targetBottomOffset = window.innerHeight - targetRect.bottom;
return offsetBottom + targetBottomOffset;
}
return undefined;
}
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/affix/index.js
"use client";
const TRIGGER_EVENTS = ['resize', 'scroll', 'touchstart', 'touchmove', 'touchend', 'pageshow', 'load'];
function getDefaultTarget() {
return typeof window !== 'undefined' ? window : null;
}
var AffixStatus;
(function (AffixStatus) {
AffixStatus[AffixStatus["None"] = 0] = "None";
AffixStatus[AffixStatus["Prepare"] = 1] = "Prepare";
})(AffixStatus || (AffixStatus = {}));
let InternalAffix = /*#__PURE__*/function (_React$Component) {
(0,inherits/* default */.Z)(InternalAffix, _React$Component);
var _super = (0,createSuper/* default */.Z)(InternalAffix);
function InternalAffix() {
var _this;
(0,classCallCheck/* default */.Z)(this, InternalAffix);
_this = _super.apply(this, arguments);
_this.state = {
status: AffixStatus.None,
lastAffix: false,
prevTarget: null
};
_this.placeholderNodeRef = /*#__PURE__*/(0,_react_17_0_2_react.createRef)();
_this.fixedNodeRef = /*#__PURE__*/(0,_react_17_0_2_react.createRef)();
_this.addListeners = () => {
const targetFunc = _this.getTargetFunc();
const target = targetFunc === null || targetFunc === void 0 ? void 0 : targetFunc();
const {
prevTarget
} = _this.state;
if (prevTarget !== target) {
TRIGGER_EVENTS.forEach(eventName => {
prevTarget === null || prevTarget === void 0 ? void 0 : prevTarget.removeEventListener(eventName, _this.lazyUpdatePosition);
target === null || target === void 0 ? void 0 : target.addEventListener(eventName, _this.lazyUpdatePosition);
});
_this.updatePosition();
_this.setState({
prevTarget: target
});
}
};
_this.removeListeners = () => {
if (_this.timer) {
clearTimeout(_this.timer);
_this.timer = null;
}
const {
prevTarget
} = _this.state;
const targetFunc = _this.getTargetFunc();
const newTarget = targetFunc === null || targetFunc === void 0 ? void 0 : targetFunc();
TRIGGER_EVENTS.forEach(eventName => {
newTarget === null || newTarget === void 0 ? void 0 : newTarget.removeEventListener(eventName, _this.lazyUpdatePosition);
prevTarget === null || prevTarget === void 0 ? void 0 : prevTarget.removeEventListener(eventName, _this.lazyUpdatePosition);
});
_this.updatePosition.cancel();
// https://github.com/ant-design/ant-design/issues/22683
_this.lazyUpdatePosition.cancel();
};
_this.getOffsetTop = () => {
const {
offsetBottom,
offsetTop
} = _this.props;
return offsetBottom === undefined && offsetTop === undefined ? 0 : offsetTop;
};
_this.getOffsetBottom = () => _this.props.offsetBottom;
// =================== Measure ===================
_this.measure = () => {
const {
status,
lastAffix
} = _this.state;
const {
onChange
} = _this.props;
const targetFunc = _this.getTargetFunc();
if (status !== AffixStatus.Prepare || !_this.fixedNodeRef.current || !_this.placeholderNodeRef.current || !targetFunc) {
return;
}
const offsetTop = _this.getOffsetTop();
const offsetBottom = _this.getOffsetBottom();
const targetNode = targetFunc();
if (targetNode) {
const newState = {
status: AffixStatus.None
};
const placeholderRect = getTargetRect(_this.placeholderNodeRef.current);
if (placeholderRect.top === 0 && placeholderRect.left === 0 && placeholderRect.width === 0 && placeholderRect.height === 0) {
return;
}
const targetRect = getTargetRect(targetNode);
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop);
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
if (fixedTop !== undefined) {
newState.affixStyle = {
position: 'fixed',
top: fixedTop,
width: placeholderRect.width,
height: placeholderRect.height
};
newState.placeholderStyle = {
width: placeholderRect.width,
height: placeholderRect.height
};
} else if (fixedBottom !== undefined) {
newState.affixStyle = {
position: 'fixed',
bottom: fixedBottom,
width: placeholderRect.width,
height: placeholderRect.height
};
newState.placeholderStyle = {
width: placeholderRect.width,
height: placeholderRect.height
};
}
newState.lastAffix = !!newState.affixStyle;
if (onChange && lastAffix !== newState.lastAffix) {
onChange(newState.lastAffix);
}
_this.setState(newState);
}
};
_this.prepareMeasure = () => {
// event param is used before. Keep compatible ts define here.
_this.setState({
status: AffixStatus.Prepare,
affixStyle: undefined,
placeholderStyle: undefined
});
// Test if `updatePosition` called
if (false) {}
};
_this.updatePosition = (0,throttleByAnimationFrame/* default */.Z)(() => {
_this.prepareMeasure();
});
_this.lazyUpdatePosition = (0,throttleByAnimationFrame/* default */.Z)(() => {
const targetFunc = _this.getTargetFunc();
const {
affixStyle
} = _this.state;
// Check position change before measure to make Safari smooth
if (targetFunc && affixStyle) {
const offsetTop = _this.getOffsetTop();
const offsetBottom = _this.getOffsetBottom();
const targetNode = targetFunc();
if (targetNode && _this.placeholderNodeRef.current) {
const targetRect = getTargetRect(targetNode);
const placeholderRect = getTargetRect(_this.placeholderNodeRef.current);
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop);
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
if (fixedTop !== undefined && affixStyle.top === fixedTop || fixedBottom !== undefined && affixStyle.bottom === fixedBottom) {
return;
}
}
}
// Directly call prepare measure since it's already throttled.
_this.prepareMeasure();
});
return _this;
}
(0,createClass/* default */.Z)(InternalAffix, [{
key: "getTargetFunc",
value: function getTargetFunc() {
const {
getTargetContainer
} = this.context;
const {
target
} = this.props;
if (target !== undefined) {
return target;
}
return getTargetContainer !== null && getTargetContainer !== void 0 ? getTargetContainer : getDefaultTarget;
}
// Event handler
}, {
key: "componentDidMount",
value: function componentDidMount() {
// [Legacy] Wait for parent component ref has its value.
// We should use target as directly element instead of function which makes element check hard.
this.timer = setTimeout(this.addListeners);
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
this.addListeners();
if (prevProps.offsetTop !== this.props.offsetTop || prevProps.offsetBottom !== this.props.offsetBottom) {
this.updatePosition();
}
this.measure();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.removeListeners();
}
// =================== Render ===================
}, {
key: "render",
value: function render() {
const {
affixStyle,
placeholderStyle
} = this.state;
const {
affixPrefixCls,
rootClassName,
children
} = this.props;
const className = _classnames_2_5_1_classnames_default()(affixStyle && rootClassName, {
[affixPrefixCls]: !!affixStyle
});
let props = (0,omit/* default */.Z)(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target', 'onChange', 'affixPrefixCls', 'rootClassName']);
// Omit this since `onTestUpdatePosition` only works on test.
if (false) {}
return /*#__PURE__*/_react_17_0_2_react.createElement(es/* default */.Z, {
onResize: this.updatePosition
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", Object.assign({}, props, {
ref: this.placeholderNodeRef
}), affixStyle && /*#__PURE__*/_react_17_0_2_react.createElement("div", {
style: placeholderStyle,
"aria-hidden": "true"
}), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: className,
ref: this.fixedNodeRef,
style: affixStyle
}, /*#__PURE__*/_react_17_0_2_react.createElement(es/* default */.Z, {
onResize: this.updatePosition
}, children))));
}
}]);
return InternalAffix;
}(_react_17_0_2_react.Component);
InternalAffix.contextType = context/* ConfigContext */.E_;
const Affix = /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)((props, ref) => {
const {
prefixCls: customizePrefixCls,
rootClassName
} = props;
const {
getPrefixCls
} = (0,_react_17_0_2_react.useContext)(context/* ConfigContext */.E_);
const affixPrefixCls = getPrefixCls('affix', customizePrefixCls);
const [wrapSSR, hashId] = style(affixPrefixCls);
const AffixProps = Object.assign(Object.assign({}, props), {
affixPrefixCls,
rootClassName: _classnames_2_5_1_classnames_default()(rootClassName, hashId)
});
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(InternalAffix, Object.assign({}, AffixProps, {
ref: ref
})));
});
if (false) {}
/* harmony default export */ var affix = (Affix);
/***/ }),
/***/ 79817:
/*!**********************************************************************!*\
!*** ./node_modules/_antd@5.9.0@antd/es/anchor/index.js + 4 modules ***!
\**********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ es_anchor; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.24.0@@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
var toConsumableArray = __webpack_require__(41411);
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
var _classnames_2_5_1_classnames = __webpack_require__(92310);
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
// EXTERNAL MODULE: ./node_modules/_rc-util@5.39.1@rc-util/es/index.js
var es = __webpack_require__(9487);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_scroll-into-view-if-needed@3.1.0@scroll-into-view-if-needed/dist/index.js + 1 modules
var dist = __webpack_require__(6774);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/getScroll.js
var getScroll = __webpack_require__(13845);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/scrollTo.js + 1 modules
var scrollTo = __webpack_require__(68031);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/affix/index.js + 2 modules
var es_affix = __webpack_require__(81228);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
var config_provider_context = __webpack_require__(36355);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/anchor/context.js
const AnchorContext = /*#__PURE__*/_react_17_0_2_react.createContext(undefined);
/* harmony default export */ var anchor_context = (AnchorContext);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/anchor/AnchorLink.js
"use client";
const AnchorLink = props => {
const {
href,
title,
prefixCls: customizePrefixCls,
children,
className,
target,
replace
} = props;
const context = _react_17_0_2_react.useContext(anchor_context);
const {
registerLink,
unregisterLink,
scrollTo,
onClick,
activeLink,
direction
} = context || {};
_react_17_0_2_react.useEffect(() => {
registerLink === null || registerLink === void 0 ? void 0 : registerLink(href);
return () => {
unregisterLink === null || unregisterLink === void 0 ? void 0 : unregisterLink(href);
};
}, [href]);
const handleClick = e => {
if (replace) {
e.preventDefault();
window.location.replace(href);
}
onClick === null || onClick === void 0 ? void 0 : onClick(e, {
title,
href
});
scrollTo === null || scrollTo === void 0 ? void 0 : scrollTo(href);
};
// =================== Warning =====================
if (false) {}
const {
getPrefixCls
} = _react_17_0_2_react.useContext(config_provider_context/* ConfigContext */.E_);
const prefixCls = getPrefixCls('anchor', customizePrefixCls);
const active = activeLink === href;
const wrapperClassName = _classnames_2_5_1_classnames_default()(`${prefixCls}-link`, className, {
[`${prefixCls}-link-active`]: active
});
const titleClassName = _classnames_2_5_1_classnames_default()(`${prefixCls}-link-title`, {
[`${prefixCls}-link-title-active`]: active
});
return /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: wrapperClassName
}, /*#__PURE__*/_react_17_0_2_react.createElement("a", {
className: titleClassName,
href: href,
title: typeof title === 'string' ? title : '',
target: target,
onClick: handleClick
}, title), direction !== 'horizontal' ? children : null);
};
/* harmony default export */ var anchor_AnchorLink = (AnchorLink);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/index.js
var style = __webpack_require__(17313);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
var genComponentStyleHook = __webpack_require__(83116);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/statistic.js
var statistic = __webpack_require__(37613);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/anchor/style/index.js
// ============================== Shared ==============================
const genSharedAnchorStyle = token => {
const {
componentCls,
holderOffsetBlock,
motionDurationSlow,
lineWidthBold,
colorPrimary,
lineType,
colorSplit
} = token;
return {
[`${componentCls}-wrapper`]: {
marginBlockStart: -holderOffsetBlock,
paddingBlockStart: holderOffsetBlock,
// delete overflow: auto
// overflow: 'auto',
[componentCls]: Object.assign(Object.assign({}, (0,style/* resetComponent */.Wf)(token)), {
position: 'relative',
paddingInlineStart: lineWidthBold,
[`${componentCls}-link`]: {
paddingBlock: token.linkPaddingBlock,
paddingInline: `${token.linkPaddingInlineStart}px 0`,
'&-title': Object.assign(Object.assign({}, style/* textEllipsis */.vS), {
position: 'relative',
display: 'block',
marginBlockEnd: token.anchorTitleBlock,
color: token.colorText,
transition: `all ${token.motionDurationSlow}`,
'&:only-child': {
marginBlockEnd: 0
}
}),
[`&-active > ${componentCls}-link-title`]: {
color: token.colorPrimary
},
// link link
[`${componentCls}-link`]: {
paddingBlock: token.anchorPaddingBlockSecondary
}
}
}),
[`&:not(${componentCls}-wrapper-horizontal)`]: {
[componentCls]: {
'&::before': {
position: 'absolute',
insetInlineStart: 0,
top: 0,
height: '100%',
borderInlineStart: `${lineWidthBold}px ${lineType} ${colorSplit}`,
content: '" "'
},
[`${componentCls}-ink`]: {
position: 'absolute',
insetInlineStart: 0,
display: 'none',
transform: 'translateY(-50%)',
transition: `top ${motionDurationSlow} ease-in-out`,
width: lineWidthBold,
backgroundColor: colorPrimary,
[`&${componentCls}-ink-visible`]: {
display: 'inline-block'
}
}
}
},
[`${componentCls}-fixed ${componentCls}-ink ${componentCls}-ink`]: {
display: 'none'
}
}
};
};
const genSharedAnchorHorizontalStyle = token => {
const {
componentCls,
motionDurationSlow,
lineWidthBold,
colorPrimary
} = token;
return {
[`${componentCls}-wrapper-horizontal`]: {
position: 'relative',
'&::before': {
position: 'absolute',
left: {
_skip_check_: true,
value: 0
},
right: {
_skip_check_: true,
value: 0
},
bottom: 0,
borderBottom: `1px ${token.lineType} ${token.colorSplit}`,
content: '" "'
},
[componentCls]: {
overflowX: 'scroll',
position: 'relative',
display: 'flex',
scrollbarWidth: 'none' /* Firefox */,
'&::-webkit-scrollbar': {
display: 'none' /* Safari and Chrome */
},
[`${componentCls}-link:first-of-type`]: {
paddingInline: 0
},
[`${componentCls}-ink`]: {
position: 'absolute',
bottom: 0,
transition: `left ${motionDurationSlow} ease-in-out, width ${motionDurationSlow} ease-in-out`,
height: lineWidthBold,
backgroundColor: colorPrimary
}
}
}
};
};
// ============================== Export ==============================
/* harmony default export */ var anchor_style = ((0,genComponentStyleHook/* default */.Z)('Anchor', token => {
const {
fontSize,
fontSizeLG,
paddingXXS
} = token;
const anchorToken = (0,statistic/* merge */.TS)(token, {
holderOffsetBlock: paddingXXS,
anchorPaddingBlockSecondary: paddingXXS / 2,
anchorTitleBlock: fontSize / 14 * 3,
anchorBallSize: fontSizeLG / 2
});
return [genSharedAnchorStyle(anchorToken), genSharedAnchorHorizontalStyle(anchorToken)];
}, token => ({
linkPaddingBlock: token.paddingXXS,
linkPaddingInlineStart: token.padding
})));
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/anchor/Anchor.js
"use client";
function getDefaultContainer() {
return window;
}
function getOffsetTop(element, container) {
if (!element.getClientRects().length) {
return 0;
}
const rect = element.getBoundingClientRect();
if (rect.width || rect.height) {
if (container === window) {
container = element.ownerDocument.documentElement;
return rect.top - container.clientTop;
}
return rect.top - container.getBoundingClientRect().top;
}
return rect.top;
}
const sharpMatcherRegex = /#([\S ]+)$/;
const AnchorContent = props => {
var _a;
const {
rootClassName,
anchorPrefixCls: prefixCls,
className,
style,
offsetTop,
affix = true,
showInkInFixed = false,
children,
items,
direction: anchorDirection = 'vertical',
bounds,
targetOffset,
onClick,
onChange,
getContainer,
getCurrentAnchor,
replace
} = props;
// =================== Warning =====================
if (false) {}
if (false) {}
const [links, setLinks] = _react_17_0_2_react.useState([]);
const [activeLink, setActiveLink] = _react_17_0_2_react.useState(null);
const activeLinkRef = _react_17_0_2_react.useRef(activeLink);
const wrapperRef = _react_17_0_2_react.useRef(null);
const spanLinkNode = _react_17_0_2_react.useRef(null);
const animating = _react_17_0_2_react.useRef(false);
const {
direction,
getTargetContainer,
anchor
} = _react_17_0_2_react.useContext(config_provider_context/* ConfigContext */.E_);
const getCurrentContainer = (_a = getContainer !== null && getContainer !== void 0 ? getContainer : getTargetContainer) !== null && _a !== void 0 ? _a : getDefaultContainer;
const dependencyListItem = JSON.stringify(links);
const registerLink = (0,es.useEvent)(link => {
if (!links.includes(link)) {
setLinks(prev => [].concat((0,toConsumableArray/* default */.Z)(prev), [link]));
}
});
const unregisterLink = (0,es.useEvent)(link => {
if (links.includes(link)) {
setLinks(prev => prev.filter(i => i !== link));
}
});
const updateInk = () => {
var _a;
const linkNode = (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(`.${prefixCls}-link-title-active`);
if (linkNode && spanLinkNode.current) {
const {
style: inkStyle
} = spanLinkNode.current;
const horizontalAnchor = anchorDirection === 'horizontal';
inkStyle.top = horizontalAnchor ? '' : `${linkNode.offsetTop + linkNode.clientHeight / 2}px`;
inkStyle.height = horizontalAnchor ? '' : `${linkNode.clientHeight}px`;
inkStyle.left = horizontalAnchor ? `${linkNode.offsetLeft}px` : '';
inkStyle.width = horizontalAnchor ? `${linkNode.clientWidth}px` : '';
if (horizontalAnchor) {
(0,dist/* default */.Z)(linkNode, {
scrollMode: 'if-needed',
block: 'nearest'
});
}
}
};
const getInternalCurrentAnchor = function (_links) {
let _offsetTop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
let _bounds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
const linkSections = [];
const container = getCurrentContainer();
_links.forEach(link => {
const sharpLinkMatch = sharpMatcherRegex.exec(link === null || link === void 0 ? void 0 : link.toString());
if (!sharpLinkMatch) {
return;
}
const target = document.getElementById(sharpLinkMatch[1]);
if (target) {
const top = getOffsetTop(target, container);
if (top < _offsetTop + _bounds) {
linkSections.push({
link,
top
});
}
}
});
if (linkSections.length) {
const maxSection = linkSections.reduce((prev, curr) => curr.top > prev.top ? curr : prev);
return maxSection.link;
}
return '';
};
const setCurrentActiveLink = (0,es.useEvent)(link => {
// FIXME: Seems a bug since this compare is not equals
// `activeLinkRef` is parsed value which will always trigger `onChange` event.
if (activeLinkRef.current === link) {
return;
}
// https://github.com/ant-design/ant-design/issues/30584
const newLink = typeof getCurrentAnchor === 'function' ? getCurrentAnchor(link) : link;
setActiveLink(newLink);
activeLinkRef.current = newLink;
// onChange should respect the original link (which may caused by
// window scroll or user click), not the new link
onChange === null || onChange === void 0 ? void 0 : onChange(link);
});
const handleScroll = _react_17_0_2_react.useCallback(() => {
if (animating.current) {
return;
}
const currentActiveLink = getInternalCurrentAnchor(links, targetOffset !== undefined ? targetOffset : offsetTop || 0, bounds);
setCurrentActiveLink(currentActiveLink);
}, [dependencyListItem, targetOffset, offsetTop]);
const handleScrollTo = _react_17_0_2_react.useCallback(link => {
setCurrentActiveLink(link);
const sharpLinkMatch = sharpMatcherRegex.exec(link);
if (!sharpLinkMatch) {
return;
}
const targetElement = document.getElementById(sharpLinkMatch[1]);
if (!targetElement) {
return;
}
const container = getCurrentContainer();
const scrollTop = (0,getScroll/* default */.Z)(container, true);
const eleOffsetTop = getOffsetTop(targetElement, container);
let y = scrollTop + eleOffsetTop;
y -= targetOffset !== undefined ? targetOffset : offsetTop || 0;
animating.current = true;
(0,scrollTo/* default */.Z)(y, {
getContainer: getCurrentContainer,
callback() {
animating.current = false;
}
});
}, [targetOffset, offsetTop]);
const wrapperClass = _classnames_2_5_1_classnames_default()(rootClassName, `${prefixCls}-wrapper`, {
[`${prefixCls}-wrapper-horizontal`]: anchorDirection === 'horizontal',
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, anchor === null || anchor === void 0 ? void 0 : anchor.className);
const anchorClass = _classnames_2_5_1_classnames_default()(prefixCls, {
[`${prefixCls}-fixed`]: !affix && !showInkInFixed
});
const inkClass = _classnames_2_5_1_classnames_default()(`${prefixCls}-ink`, {
[`${prefixCls}-ink-visible`]: activeLink
});
const wrapperStyle = Object.assign(Object.assign({
maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh'
}, anchor === null || anchor === void 0 ? void 0 : anchor.style), style);
const createNestedLink = options => Array.isArray(options) ? options.map(item => /*#__PURE__*/_react_17_0_2_react.createElement(anchor_AnchorLink, Object.assign({
replace: replace
}, item, {
key: item.key
}), anchorDirection === 'vertical' && createNestedLink(item.children))) : null;
const anchorContent = /*#__PURE__*/_react_17_0_2_react.createElement("div", {
ref: wrapperRef,
className: wrapperClass,
style: wrapperStyle
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: anchorClass
}, /*#__PURE__*/_react_17_0_2_react.createElement("span", {
className: inkClass,
ref: spanLinkNode
}), 'items' in props ? createNestedLink(items) : children));
_react_17_0_2_react.useEffect(() => {
const scrollContainer = getCurrentContainer();
handleScroll();
scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.addEventListener('scroll', handleScroll);
return () => {
scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.removeEventListener('scroll', handleScroll);
};
}, [dependencyListItem]);
_react_17_0_2_react.useEffect(() => {
if (typeof getCurrentAnchor === 'function') {
setCurrentActiveLink(getCurrentAnchor(activeLinkRef.current || ''));
}
}, [getCurrentAnchor]);
_react_17_0_2_react.useEffect(() => {
updateInk();
}, [anchorDirection, getCurrentAnchor, dependencyListItem, activeLink]);
const memoizedContextValue = _react_17_0_2_react.useMemo(() => ({
registerLink,
unregisterLink,
scrollTo: handleScrollTo,
activeLink,
onClick,
direction: anchorDirection
}), [activeLink, onClick, handleScrollTo, anchorDirection]);
return /*#__PURE__*/_react_17_0_2_react.createElement(anchor_context.Provider, {
value: memoizedContextValue
}, affix ? /*#__PURE__*/_react_17_0_2_react.createElement(es_affix/* default */.Z, {
offsetTop: offsetTop,
target: getCurrentContainer
}, anchorContent) : anchorContent);
};
const Anchor = props => {
const {
prefixCls: customizePrefixCls,
rootClassName
} = props;
const {
getPrefixCls
} = _react_17_0_2_react.useContext(config_provider_context/* ConfigContext */.E_);
const anchorPrefixCls = getPrefixCls('anchor', customizePrefixCls);
const [wrapSSR, hashId] = anchor_style(anchorPrefixCls);
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(AnchorContent, Object.assign({}, props, {
rootClassName: _classnames_2_5_1_classnames_default()(hashId, rootClassName),
anchorPrefixCls: anchorPrefixCls
})));
};
if (false) {}
/* harmony default export */ var anchor_Anchor = (Anchor);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/anchor/index.js
"use client";
const es_anchor_Anchor = anchor_Anchor;
es_anchor_Anchor.Link = anchor_AnchorLink;
/* harmony default export */ var es_anchor = (es_anchor_Anchor);
/***/ }),
/***/ 31797:
/*!*************************************************************************!*\
!*** ./node_modules/_antd@5.9.0@antd/es/statistic/index.js + 5 modules ***!
\*************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ es_statistic; }
});
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/hooks/useForceUpdate.js
var useForceUpdate = __webpack_require__(56762);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/reactNode.js
var reactNode = __webpack_require__(92343);
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
var _classnames_2_5_1_classnames = __webpack_require__(92310);
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
var context = __webpack_require__(36355);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/skeleton/index.js + 12 modules
var skeleton = __webpack_require__(7901);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/Number.js
"use client";
const StatisticNumber = props => {
const {
value,
formatter,
precision,
decimalSeparator,
groupSeparator = '',
prefixCls
} = props;
let valueNode;
if (typeof formatter === 'function') {
// Customize formatter
valueNode = formatter(value);
} else {
// Internal formatter
const val = String(value);
const cells = val.match(/^(-?)(\d*)(\.(\d+))?$/);
// Process if illegal number
if (!cells || val === '-') {
valueNode = val;
} else {
const negative = cells[1];
let int = cells[2] || '0';
let decimal = cells[4] || '';
int = int.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
if (typeof precision === 'number') {
decimal = decimal.padEnd(precision, '0').slice(0, precision > 0 ? precision : 0);
}
if (decimal) {
decimal = `${decimalSeparator}${decimal}`;
}
valueNode = [/*#__PURE__*/_react_17_0_2_react.createElement("span", {
key: "int",
className: `${prefixCls}-content-value-int`
}, negative, int), decimal && /*#__PURE__*/_react_17_0_2_react.createElement("span", {
key: "decimal",
className: `${prefixCls}-content-value-decimal`
}, decimal)];
}
}
return /*#__PURE__*/_react_17_0_2_react.createElement("span", {
className: `${prefixCls}-content-value`
}, valueNode);
};
/* harmony default export */ var statistic_Number = (StatisticNumber);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/index.js
var style = __webpack_require__(17313);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
var genComponentStyleHook = __webpack_require__(83116);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/statistic.js
var statistic = __webpack_require__(37613);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/style/index.js
"use client";
const genStatisticStyle = token => {
const {
componentCls,
marginXXS,
padding,
colorTextDescription,
titleFontSize,
colorTextHeading,
contentFontSize,
fontFamily
} = token;
return {
[`${componentCls}`]: Object.assign(Object.assign({}, (0,style/* resetComponent */.Wf)(token)), {
[`${componentCls}-title`]: {
marginBottom: marginXXS,
color: colorTextDescription,
fontSize: titleFontSize
},
[`${componentCls}-skeleton`]: {
paddingTop: padding
},
[`${componentCls}-content`]: {
color: colorTextHeading,
fontSize: contentFontSize,
fontFamily,
[`${componentCls}-content-value`]: {
display: 'inline-block',
direction: 'ltr'
},
[`${componentCls}-content-prefix, ${componentCls}-content-suffix`]: {
display: 'inline-block'
},
[`${componentCls}-content-prefix`]: {
marginInlineEnd: marginXXS
},
[`${componentCls}-content-suffix`]: {
marginInlineStart: marginXXS
}
}
})
};
};
// ============================== Export ==============================
/* harmony default export */ var statistic_style = ((0,genComponentStyleHook/* default */.Z)('Statistic', token => {
const statisticToken = (0,statistic/* merge */.TS)(token, {});
return [genStatisticStyle(statisticToken)];
}, token => {
const {
fontSizeHeading3,
fontSize
} = token;
return {
titleFontSize: fontSize,
contentFontSize: fontSizeHeading3
};
}));
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/Statistic.js
"use client";
const Statistic = props => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
style,
valueStyle,
value = 0,
title,
valueRender,
prefix,
suffix,
loading = false,
onMouseEnter,
onMouseLeave,
decimalSeparator = '.',
groupSeparator = ','
} = props;
const {
getPrefixCls,
direction,
statistic
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
const prefixCls = getPrefixCls('statistic', customizePrefixCls);
const [wrapSSR, hashId] = statistic_style(prefixCls);
const valueNode = /*#__PURE__*/_react_17_0_2_react.createElement(statistic_Number, Object.assign({
decimalSeparator: decimalSeparator,
groupSeparator: groupSeparator,
prefixCls: prefixCls
}, props, {
value: value
}));
const cls = _classnames_2_5_1_classnames_default()(prefixCls, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}, statistic === null || statistic === void 0 ? void 0 : statistic.className, className, rootClassName, hashId);
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: cls,
style: Object.assign(Object.assign({}, statistic === null || statistic === void 0 ? void 0 : statistic.style), style),
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave
}, title && /*#__PURE__*/_react_17_0_2_react.createElement("div", {
className: `${prefixCls}-title`
}, title), /*#__PURE__*/_react_17_0_2_react.createElement(skeleton/* default */.Z, {
paragraph: false,
loading: loading,
className: `${prefixCls}-skeleton`
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
style: valueStyle,
className: `${prefixCls}-content`
}, prefix && /*#__PURE__*/_react_17_0_2_react.createElement("span", {
className: `${prefixCls}-content-prefix`
}, prefix), valueRender ? valueRender(valueNode) : valueNode, suffix && /*#__PURE__*/_react_17_0_2_react.createElement("span", {
className: `${prefixCls}-content-suffix`
}, suffix)))));
};
if (false) {}
/* harmony default export */ var statistic_Statistic = (Statistic);
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/utils.js
// Countdown
const timeUnits = [['Y', 1000 * 60 * 60 * 24 * 365], ['M', 1000 * 60 * 60 * 24 * 30], ['D', 1000 * 60 * 60 * 24], ['H', 1000 * 60 * 60], ['m', 1000 * 60], ['s', 1000], ['S', 1] // million seconds
];
function formatTimeStr(duration, format) {
let leftDuration = duration;
const escapeRegex = /\[[^\]]*]/g;
const keepList = (format.match(escapeRegex) || []).map(str => str.slice(1, -1));
const templateText = format.replace(escapeRegex, '[]');
const replacedText = timeUnits.reduce((current, _ref) => {
let [name, unit] = _ref;
if (current.includes(name)) {
const value = Math.floor(leftDuration / unit);
leftDuration -= value * unit;
return current.replace(new RegExp(`${name}+`, 'g'), match => {
const len = match.length;
return value.toString().padStart(len, '0');
});
}
return current;
}, templateText);
let index = 0;
return replacedText.replace(escapeRegex, () => {
const match = keepList[index];
index += 1;
return match;
});
}
function formatCountdown(value, config) {
const {
format = ''
} = config;
const target = new Date(value).getTime();
const current = Date.now();
const diff = Math.max(target - current, 0);
return formatTimeStr(diff, format);
}
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/Countdown.js
"use client";
const REFRESH_INTERVAL = 1000 / 30;
function getTime(value) {
return new Date(value).getTime();
}
const Countdown = props => {
const {
value,
format = 'HH:mm:ss',
onChange,
onFinish
} = props;
const forceUpdate = (0,useForceUpdate/* default */.Z)();
const countdown = _react_17_0_2_react.useRef(null);
const stopTimer = () => {
onFinish === null || onFinish === void 0 ? void 0 : onFinish();
if (countdown.current) {
clearInterval(countdown.current);
countdown.current = null;
}
};
const syncTimer = () => {
const timestamp = getTime(value);
if (timestamp >= Date.now()) {
countdown.current = setInterval(() => {
forceUpdate();
onChange === null || onChange === void 0 ? void 0 : onChange(timestamp - Date.now());
if (timestamp < Date.now()) {
stopTimer();
}
}, REFRESH_INTERVAL);
}
};
_react_17_0_2_react.useEffect(() => {
syncTimer();
return () => {
if (countdown.current) {
clearInterval(countdown.current);
countdown.current = null;
}
};
}, [value]);
const formatter = (formatValue, config) => formatCountdown(formatValue, Object.assign(Object.assign({}, config), {
format
}));
const valueRender = node => (0,reactNode/* cloneElement */.Tm)(node, {
title: undefined
});
return /*#__PURE__*/_react_17_0_2_react.createElement(statistic_Statistic, Object.assign({}, props, {
valueRender: valueRender,
formatter: formatter
}));
};
/* harmony default export */ var statistic_Countdown = (/*#__PURE__*/_react_17_0_2_react.memo(Countdown));
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/index.js
"use client";
statistic_Statistic.Countdown = statistic_Countdown;
/* harmony default export */ var es_statistic = (statistic_Statistic);
/***/ })
}]);