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__Problems__OjForm__index....

1 line
81 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.

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[34994,79462],{65363:function(e,n,t){t.d(n,{Z:function(){return l}});var a=t(54476),i=t(59301),r={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"},c=t(7657),s=function(e,n){return i.createElement(c.Z,(0,a.Z)({},e,{ref:n,icon:r}))};var l=i.forwardRef(s)},76618:function(e,n,t){t.d(n,{Z:function(){return l}});var a=t(54476),i=t(59301),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M705.6 124.9a8 8 0 00-11.6 7.2v64.2c0 5.5 2.9 10.6 7.5 13.6a352.2 352.2 0 0162.2 49.8c32.7 32.8 58.4 70.9 76.3 113.3a355 355 0 0127.9 138.7c0 48.1-9.4 94.8-27.9 138.7a355.92 355.92 0 01-76.3 113.3 353.06 353.06 0 01-113.2 76.4c-43.8 18.6-90.5 28-138.5 28s-94.7-9.4-138.5-28a353.06 353.06 0 01-113.2-76.4A355.92 355.92 0 01184 650.4a355 355 0 01-27.9-138.7c0-48.1 9.4-94.8 27.9-138.7 17.9-42.4 43.6-80.5 76.3-113.3 19-19 39.8-35.6 62.2-49.8 4.7-2.9 7.5-8.1 7.5-13.6V132c0-6-6.3-9.8-11.6-7.2C178.5 195.2 82 339.3 80 506.3 77.2 745.1 272.5 943.5 511.2 944c239 .5 432.8-193.3 432.8-432.4 0-169.2-97-315.7-238.4-386.7zM480 560h64c4.4 0 8-3.6 8-8V88c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8z"}}]},name:"poweroff",theme:"outlined"},c=t(7657),s=function(e,n){return i.createElement(c.Z,(0,a.Z)({},e,{ref:n,icon:r}))};var l=i.forwardRef(s)},78988:function(e,n,t){function a(e){var n=!0;if(e.length>0){for(var t=0;t<e.length;t++)if(0==e[t].compile_success||!e[t].compile_success){n=!1;break}}else n=!1;return n}function i(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",t=[],a=0;a<e.length;a++){var i=e[a],r=n?"".concat(n,"/").concat(i.name):"".concat(i.name);t.push({title:i.name,isLeaf:"tree"!==i.type,key:r})}return t}function r(e,n,t){for(var a=0;a<e.length;a++){var i=e[a];if(i.key===n){i.children=t;break}i.children&&r(i.children,n,t)}return e}function c(e,n,t){var a;return function(){var i=this,r=arguments,c=function(){a=null,t||e.apply(i,r)},s=t&&!a;clearTimeout(a),a=setTimeout(c,n),s&&e.apply(i,r)}}t.d(n,{Ax:function(){return r},Ds:function(){return c},KI:function(){return s},SI:function(){return i},f1:function(){return a}});var s=t(91689).Z.API_SERVER},23075:function(e,n,t){t.d(n,{Z:function(){return y}});var a=t(82242),i=t.n(a),r=t(7557),c=t.n(r),s=t(41498),l=t.n(s),o=t(79800),u=t.n(o),d=t(39647),p=t.n(d),f=t(59301),h=t(17574),m=t(32701),v="customTree___ZhEHU",_="name___RIkn2",g=t(37712),x=["value","onChange","defaultValue","disabled"],y=function(e){var n=e.value,t=e.onChange,a=e.defaultValue,r=e.disabled,s=p()(e,x),o=(0,f.useState)([]),d=u()(o,2),y=d[0],j=d[1],b=(0,f.useState)("1"),k=u()(b,2),w=k[0],S=k[1];(0,f.useEffect)((function(){Z()}),[]);var Z=function(){var e=l()(c()().mark((function e(){var n,t;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,m.NZ)({});case 2:null!=(n=e.sent)&&n.data&&(t=[{title:(0,g.jsx)("div",{title:"根目录",className:_,children:"根目录"}),value:0,key:0,icon:(0,g.jsx)("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:C(n.data||[])}],j(t),S("2"));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(e){function n(e){var t=e.children,a=Array.isArray(t)&&t.length>0,i=null==e?void 0:e.group_id;return{title:(0,g.jsx)("div",{title:null==e?void 0:e.name,className:_,children:null==e?void 0:e.name}),value:i,key:i,icon:(0,g.jsx)("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:a?null==t?void 0:t.map((function(e){return n(e)})):[]}}return null==e?void 0:e.map((function(e){return n(e)}))},N=a?{defaultExpandedKeys:[0],defaultSelectedKeys:[0]}:{selectedKeys:n,defaultExpandedKeys:n};return(0,g.jsx)("div",{className:v,children:(0,g.jsx)(h.Z,i()(i()({},N),{},{showIcon:!0,treeData:y,onSelect:t,disabled:r},s),w)})}},52058:function(e,n,t){t.d(n,{N:function(){return C}});var a=t(7557),i=t.n(a),r=t(41498),c=t.n(r),s=t(37205),l=t.n(s),o=t(79800),u=t.n(o),d=t(59301),p=t(57809),f=t(43418),h=t(95237),m=t(43604),v=t(10249),_=t(8591),g=t(94171),x="wrap___F7E3F",y="selectWrapper____kESB",j="tips___aHjQY",b="linkBtn___uggVr",k="mainText____S1I0",w=t(87169),S=t(37712),Z=p.default.Option,C=function(e){var n=e.subId,t=e.value,a=e.selectvalues,r=e.disabled,s=e.knowledgeOptions,o=void 0===s?[]:s,C=e.onChange,N=void 0===C?function(){}:C,T=e.onAddKnowledgeFinish,E=void 0===T?function(){}:T,I=(0,d.useRef)(),A=(0,d.useState)([]),P=u()(A,2),F=P[0],L=P[1];t=t||[];(0,d.useEffect)((function(){(null==a?void 0:a.length)>0&&(L(l()(a)),N(l()(a)))}),[o]),(0,d.useEffect)((function(){var e;(null===(e=t)||void 0===e?void 0:e.length)>0&&N(l()(t))}),[o]);return(0,S.jsxs)(h.Z,{wrap:!1,align:"middle",className:x,children:[(0,S.jsx)(m.Z,{children:(0,S.jsx)(p.default,{disabled:!n||r,className:y,placeholder:"请选择知识点",onChange:function(e,n){e?(L([n.key]),N([n.key])):(L([]),N([]))},style:{width:490},showSearch:!0,allowClear:!0,value:null==o?void 0:o.filter((function(e){return(null==F?void 0:F.includes(null==e?void 0:e.id))||(null==F?void 0:F.includes((null==e?void 0:e.id)+""))})).map((function(e){return e.name})),children:null==o?void 0:o.map((function(e){return(0,S.jsx)(Z,{value:e.name,children:(0,S.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,S.jsx)("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:e.name}),(0,S.jsx)("span",{children:"personal"===e.type?"(自用)":""})]})},e.id)}))})}),n&&(0,S.jsxs)(m.Z,{className:"ml20",children:[(0,S.jsx)("span",{className:j,children:"没有合适的知识点?"}),(0,S.jsx)("span",{className:b,onClick:function(e){e.preventDefault(),I.current="",f.Z.confirm({centered:!0,width:640,okText:"确定",cancelText:"取消",icon:null,title:"新建知识点",className:"custom-modal-divider",content:(0,S.jsxs)("div",{className:"font14",children:[(0,S.jsxs)(h.Z,{className:"mb20",children:[(0,S.jsx)(m.Z,{children:(0,S.jsx)(w.Z,{style:{color:"#FF8C29"}})}),(0,S.jsxs)(m.Z,{className:"ml10 ".concat(k),children:["新建的知识点仅本人可见,平台审核列入公开知识点后,对所有用户可见。",(0,S.jsx)("br",{}),"平台有权删除不合适的知识点,请认真填写知识点名称。"]})]}),(0,S.jsx)(v.Z,{maxLength:20,size:"middle",showCount:!0,placeholder:"请输入知识点名称",defaultValue:I.current,onChange:function(e){I.current=e.target.value}})]}),onOk:function(){return new Promise(function(){var e=c()(i()().mark((function e(t,a){var r,c;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I.current){e.next=3;break}return _.ZP.warning("请输入知识点名称"),e.abrupt("return",a());case 3:if(!(I.current.length>20)){e.next=6;break}return _.ZP.warning("请输入不超过20字的知识点名称"),e.abrupt("return",a());case 6:return e.next=8,(0,g.ZP)("/api/tag_disciplines.json",{method:"post",body:{name:I.current,sub_discipline_id:n}});case 8:return 0===(null==(r=e.sent)?void 0:r.status)&&(E({id:r.tag_discipline_id,name:I.current,type:"personal"}),(c=[]).push(r.tag_discipline_id),N([].concat(c)),L([r.tag_discipline_id]),N([].concat(c))),e.abrupt("return",t());case 11:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}())}})},children:"新建知识点"})]})]})}},58605:function(e,n,t){t.d(n,{h:function(){return p},x:function(){return f}});var a=t(82242),i=t.n(a),r=t(39647),c=t.n(r),s=t(59081),l=t(69092),o=(t(59301),t(71212)),u=t(37712),d=["value","onChange","scrollId"],p=function(e){var n=e.value,t=e.onChange,a=e.scrollId,r=c()(e,d);return(0,u.jsx)("div",{id:a||"",children:(0,u.jsx)(s.Z,i()(i()({},r),{},{hidetoolBar:!0,defaultValue:n,onChange:function(e,n){console.log("a:",e,n),null!=n&&n.length?t(e,n):t(e)}}))})},f=function(e){var n=e.value,t=e.onChange,a=e.placeholder,i=e.height,r=void 0===i?140:i;return e.isEdit?(0,u.jsx)(s.Z,{watch:!0,isFocus:!0,height:r,placeholder:a,defaultValue:n,onChange:t}):(0,u.jsx)("div",{style:{cursor:"pointer"},children:n?(0,u.jsx)(o.Z,{className:l.Z.inputBorder,value:n}):(0,u.jsx)("div",{className:"".concat(l.Z.inputBorder," ").concat(l.Z.placeholder),children:a})})}},71212:function(e,n,t){t.d(n,{Z:function(){return q}});var a=t(82242),i=t.n(a),r=t(37205),c=t.n(r),s=t(91232),l=t.n(s),o=t(79800),u=t.n(o),d=t(59301),p=(t(88831),t(32834)),f=t.n(p),h=t(11690);var m=[],v=["<ul>"],_=new(f().Renderer),g=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function x(){m.length=0,v=["<ul>"]}var y={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function j(e,n,t,a){if(n>=e.length||e[n].level<=t)return n;var i=e[n];a.push("<li><a href='#"+i.anchor+"'>"+i.text+"</a>");var r=[];return n=j(e,++n,i.level,r),r.length>0&&(a.push("<ul>"),r.forEach((function(e){a.push(e)})),a.push("</ul>")),a.push("</li>"),n=j(e,n,t,a)}function b(){return j(m,0,0,v),v.push("</ul>"),v.join("")}var k={heading:function(e){var n=g.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[1].length,text:n[2]}},fences:function(e){var n=this.rules.block.fences.exec(e);if(n){var t=n[0],a=function(e,n){var t=e.match(/^(\s+)(?:```)/);if(null===t)return n;var a=t[1];return n.split("\n").map((function(e){var n=e.match(/^\s+/);return null===n?e:u()(n,1)[0].length>=a.length?e.slice(a.length):e})).join("\n")}(t,n[3]||""),i=n[2]?n[2].trim():n[2];if(["latex","katex","math"].indexOf(i)>=0){var r=Z(),c=a;a=r,C[r]={type:"block",expression:c}}return{type:"code",raw:t,lang:i,text:a}}}},w=/(?:\${2})([^\n`]+?)(?:\${2})/gi,S=0,Z=function(){return"__special_katext_id_".concat(S++,"__")},C={};function N(){return C}function T(){S=0,C={}}function E(e){return e=e.replace(w,(function(e,n){var t=Z();return C[t]={type:"inline",expression:n},t}))}var I=_.listitem;_.listitem=function(e){return I(E(e))};var A=_.paragraph;_.paragraph=function(e){return A(E(e))};var P=_.tablecell;_.tablecell=function(e,n){return P(E(e),n)},_.code=function(e,n,t){var a=(n||"").match(/\S*/)[0];return a?["latex","katex","math"].indexOf(a)>=0?"<p class='editormd-tex'>".concat(e,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(n,'">').concat(t?e:(0,h.escape)(e,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(t?e:(0,h.escape)(e,!0))+"</code></pre>"},_.heading=function(e,n,t){var a=this.options.headerPrefix+t.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return m.push({anchor:a,level:n,text:e}),"<h"+n+' id="'+a+'">'+e+"</h"+n+">"},f().setOptions({silent:!0,gfm:!0,pedantic:!1}),f().use({tokenizer:k,renderer:_});var F=f(),L=(t(64018),t(44523)),R=t(91689),V=t(15342),O=t(1012),M=t(32831),B=t(37712),D="@▁@",z=/<pre[^>]*>/g;var q=function(e){var n=e.value,t=void 0===n?"":n,a=e.className,r=e.showTextOnly,s=e.showLines,o=e.style,p=void 0===o?{}:o,f=e.stylesPrev,h=void 0===f?{}:f,m=e.highlightKeywords,v=e.showProgramFill,_=(e.isProgramFill,e.disabledFill),g=void 0!==_&&_,j=e.programFillValue,k=e.onFillChange,w=void 0===k?function(e){}:k,S=e.onFillBlur,Z=void 0===S?function(){}:S,C=String(t),E=(0,d.useState)(""),I=u()(E,2),A=I[0],P=I[1],q=(0,d.useState)("office"),H=u()(q,2),G=H[0],U=H[1],W=(0,d.useState)([]),K=u()(W,2),J=K[0],Y=K[1],$=(0,d.useRef)("a"+(0,O.Z)()),Q={},X=function(e){return e.replace(/<style.*?>([\s\S]+?)<\/style>/gim,(function(e,n){var t=n.replace(/(\n|\r)/g,"").split("}"),a=[];return t.map((function(e){""!=e&&a.push(".".concat($.current," ").concat(e))})),"<style>".concat(a.join("}"),"</style>")}))},ee=(0,d.useMemo)((function(){try{C=C.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+R.Z.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+R.Z.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+R.Z.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,"\n")}catch(e){}if(v){var e=-1;return C=C.replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(@▁▁@|@▁@)/g,(function(n,t,a){return function(e,n){var t=document.createElement(e===D?"input":"textarea");t.style.width="100%",t.style.height=e===D?"40px":"151px",t.rows=5,t.spellcheck=!1,t.name="edu-program-fill",t.placeholder="请输入",t.dataset.id=n;var a=Object.keys(Q).length;return Q[a]=t,'<span class="edu-program-fill-wrap '.concat(e===D?"":"show",'" style="width:').concat(e===D?"200px":"100%",'"><span>').concat(t.outerHTML,'<span class="edu-program-fill-score"></span></span></span>')}(n,++e)})),'<pre style="background:#fff;padding:4px">'.concat(X(C||""),"</pre>")}var n=F(C);n=X(n);var t=N();C.match(/\[TOC\]/)&&(n=n.replace("<p>[TOC]</p>",b()),x()),n=n.replace(/(__special_katext_id_\d+__)/g,(function(e,n){var a=t[n],i=a.type,r=a.expression;return(0,V.renderToString)(function(e){var n=document.createElement("div");return n.innerHTML=e,0===n.childNodes.length?"":n.childNodes[0].nodeValue}(r)||"",{displayMode:"block"===i,throwOnError:!1,output:"html"})})),n=n.replace(/▁/g,"▁▁▁"),T();var a=document.createElement("div");return a.innerHTML=n,m?(ae(a,m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),a.innerHTML):r?a.innerText:(setTimeout((function(){return ce()}),500),a.innerHTML)}),[C,m]);(0,d.useEffect)((function(){ie.current&&ie.current.querySelectorAll(["input","textarea"]).forEach((function(e){e.oninput=ne,e.onblur=te}))}),[J]),(0,d.useEffect)((function(){if(null!=j&&j.length){var e,n=ie.current.querySelectorAll(".edu-program-fill-score"),t=ie.current.querySelectorAll('[name="edu-program-fill"]'),a=l()(t.entries());try{for(a.s();!(e=a.n()).done;){var i,r=u()(e.value,2),c=r[0],s=r[1];s.value=null===(i=j[c])||void 0===i?void 0:i.value,"warning"===j[c].type?s.className="program-fill-warning":"success"===j[c].type?s.className="program-fill-success":s.className=""}}catch(e){a.e(e)}finally{a.f()}var o,d=l()(n.entries());try{for(d.s();!(o=d.n()).done;){var p,f,h=u()(o.value,2),m=h[0];h[1].innerHTML=null!==(p=j[m])&&void 0!==p&&p.score?"".concat(null===(f=j[m])||void 0===f?void 0:f.score,"分"):""}}catch(e){d.e(e)}finally{d.f()}Y(j)}}),[j]);var ne=function(e){J[e.target.dataset.id]=J[e.target.dataset.id]||{},J[e.target.dataset.id].value=e.target.value,Y(c()(J)),w(J,e.target.dataset.id)},te=function(e){J[e.target.dataset.id]=J[e.target.dataset.id]||{},J[e.target.dataset.id].value=e.target.value,Y(c()(J)),Z(J,e.target.dataset.id)};function ae(e,n){return e.childNodes.forEach((function(e){if(e.childNodes.length>0)ae(e,n);else if("IMG"!==e.nodeName)if(e.innerHTML){var t;e.innerHTML=null===(t=e.innerHTML)||void 0===t?void 0:t.replace(new RegExp(n,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>')}else{var a=document.createElement("span");a.innerHTML=e.textContent.replace(new RegExp(n,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),e.replaceWith(a)}}))}var ie=(0,d.useRef)();function re(e){var n=e.target;if("A"===n.tagName.toUpperCase()){var t=n.getAttribute("href");if(t.indexOf("office")>-1)e.preventDefault(),P(t),U("office");else if(t.indexOf("application/pdf")>-1)e.preventDefault(),P(t),U("pdf");else if(t.indexOf("text/html")>-1)e.preventDefault(),P(t),U("html");else if(t.startsWith("#")){e.preventDefault();var a=document.getElementById(t.replace("#",""));a&&a.scrollIntoView(!0)}}}y.WebkitLineClamp=s,s&&(p=i()(i()({},p),y));var ce=function(){var e,n=null===(e=ie.current)||void 0===e?void 0:e.querySelectorAll("video");null==n||n.forEach((function(e){if(e.oncontextmenu=function(){return!1},e.src.indexOf(".m3u8")>-1)if(e.canPlayType("application/vnd.apple.mpegurl"));else if(L.ZP.isSupported()){var n=new L.ZP;n.loadSource(e.src),n.attachMedia(e)}}))};return(0,d.useEffect)((function(){if(ie.current&&ee&&ee.match(z)&&window.PR.prettyPrint(),ie.current)return ie.current.addEventListener("click",re),function(){var e;null===(e=ie.current)||void 0===e||e.removeEventListener("click",re),T(),x()}}),[ee,ie.current,re]),(0,B.jsxs)(B.Fragment,{children:[r&&(0,B.jsx)("div",{ref:ie,children:ee}),!r&&(0,B.jsx)("div",{ref:ie,style:i()({},p),className:"".concat(a||""," ").concat(g?"disabled-fill":""," markdown-body ").concat($.current),dangerouslySetInnerHTML:{__html:ee}}),(0,B.jsx)(M.Z,{close:!0,data:A,type:null!=A&&A.length?G:"",style:i()({},h),onClose:function(){return P("")}})]})}},2028:function(e,n,t){t.d(n,{Z:function(){return s}});var a=t(79800),i=t.n(a),r=t(59301),c=t(37712),s=function(e){var n=e.defaultX,t=void 0===n?"40%":n,a=e.leftChild,s=e.rightChild,l=e.className,o=e.hideResize,u=void 0!==o&&o,d=(0,r.useState)(t),p=i()(d,2),f=p[0],h=p[1],m=(0,r.useRef)();(0,r.useEffect)((function(){function e(e){m.current&&h(e.pageX)}function n(){m.current=!1}return window.addEventListener("mousemove",e),window.addEventListener("mouseup",n),function(){window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n)}}),[]);var v="number"==typeof f&&.01!==f?"".concat(f,"px"):t,_="calc(100% - ".concat(u?"0px":"4px"," - ").concat(v,")");return(0,c.jsxs)("div",{className:"split-panel-container ".concat(l),children:[(0,c.jsx)("section",{style:{width:v,display:.01===f?"none":""},children:a}),(0,c.jsx)("section",{className:"resize-x-bar",onMouseDown:function(){m.current=!0},children:(0,c.jsx)("a",{className:"btn-resize",children:(0,c.jsx)("svg",{width:"16",height:"13",viewBox:"0 0 16 13",children:(0,c.jsx)("path",{d:"M12.245 7.53H5.647v1.882h6.598v2.823L16 8.471l-3.755-3.765V7.53zM10.353 4.706H3.755v2.823L0 3.765 3.755 0v2.824h6.598v1.882z"})})})}),(0,c.jsx)("section",{style:{width:_},children:s})]})}},17124:function(e,n,t){t.d(n,{h:function(){return _}});var a=t(82242),i=t.n(a),r=t(79800),c=t.n(r),s=t(59301),l=t(57809),o=t(78241),u=t(3113),d=t(89780),p=t.n(d),f=(t(66543),t(59598),t(37712)),h=l.default.Option,m={labelCol:{span:4},wrapperCol:{span:20}},v={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};function _(e){var n=e.value,t=e.onChange,a=e.mode,r=e.options,l=void 0===r?{}:r,o=(0,s.useRef)(),u=(0,s.useState)(),d=c()(u,2),h=d[0],m=d[1];return(0,s.useEffect)((function(){if(h){var e=function(e){var n=e.getValue();t&&t(n)};return h.on("change",e),function(){h.off("change",e)}}}),[h,t]),(0,s.useEffect)((function(){h&&h.setOption("mode",a)}),[h,a]),(0,s.useEffect)((function(){h&&(n===h.getValue()&&""!==n||setTimeout((function(){h.setValue(n||"")}),300))}),[h,n]),(0,s.useEffect)((function(){if(o.current&&!h){var e=p().fromTextArea(o.current,i()({mode:a,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},l));m(e)}}),[o.current,h]),(0,f.jsx)("div",{className:"my-codemirror-container",children:(0,f.jsx)("textarea",{ref:o})})}n.Z=function(e){var n=e.callback,t=e.onCancel,a=(0,s.useState)("python"),r=c()(a,2),d=r[0],p=r[1];return(0,f.jsxs)(o.Z,i()(i()({},m),{},{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){n(e)},children:[(0,f.jsx)(o.Z.Item,{label:"代码语言",name:"language",children:(0,f.jsx)(l.default,{getPopupContainer:function(e){return e.parentNode},onChange:function(e){p(v[e][1])},children:Object.keys(v).map((function(e){return(0,f.jsx)(h,{value:e,children:v[e][0]},e)}))})}),(0,f.jsx)(o.Z.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}],children:(0,f.jsx)(_,{mode:d})}),(0,f.jsxs)("div",{className:"flex-container flex-end",children:[(0,f.jsx)(u.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,f.jsx)(u.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))}},59081:function(e,n,t){t.d(n,{Z:function(){return le}});var a=t(91232),i=t.n(a),r=t(7557),c=t.n(r),s=t(41498),l=t.n(s),o=t(79800),u=t.n(o),d=t(85573),p=t.n(d),f=t(59301),h=t(89780),m=t.n(h),v=t(76374),_=(t(66543),t(6313),t(25717),t(99498),t(25419),t(67549),t(71212)),g=t(37712),x=function(e){var n=e.value,t=void 0===n?"":n,a=(e.className,e.showTextOnly,e.showLines,e.style,(0,f.useMemo)((function(){return""}),[t]));return(0,g.jsx)(g.Fragment,{children:(0,g.jsx)("div",{dangerouslySetInnerHTML:{__html:a}})})},y=t(82242),j=t.n(y),b=[{title:"粗体",icon:"icon-bold",actionName:"bold"},{title:"斜体",icon:"icon-italic",actionName:"italic"},"|",{title:"无序列表",icon:"icon-unorder-list",actionName:"list-ul"},{title:"有序列表",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"行内代码",icon:"icon-code",actionName:"code"},{title:"代码块(多语言风格)",icon:"icon-file-code",actionName:"code-block"},{title:"链接",icon:"icon-link",actionName:"link"},"|",{title:"行内公式",icon:"icon-sum",actionName:"inline-latex"},{title:"多行公式",icon:"icon-formula",actionName:"latex"},"|",{title:"添加图片",icon:"icon-picture",actionName:"upload-image"},{title:"表格",icon:"icon-table",actionName:"add-table"},"|",{title:"换行",icon:"icon-minus",actionName:"line-break"},{title:"清空",icon:"icon-eraser",actionName:"eraser"}];function k(e){var n=e.onActionCallback,t=e.title,a=e.icon,i=e.actionName,r=e.className,c=void 0===r?"":r,s=e.children;return(0,g.jsxs)("a",{title:t,className:c,onClick:function(){n(i)},children:[(0,g.jsx)("i",{className:"md-iconfont ".concat(a)}),s]})}var w=function(e){var n=e.watch,t=e.showNullButton,a=e.showNullProgramButton,i=e.onActionCallback,r=e.fullScreen,c=e.insertTemp,s=e.hidetoolBar,l=[].concat(b,[{title:"".concat(n?"关闭实时预览":"开启实时预览"),icon:"".concat(n?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return(0,g.jsxs)("ul",{className:"markdown-toolbar-container",children:[!s&&l.map((function(e,n){return(0,g.jsx)("li",{children:e.actionName?(0,g.jsx)(k,j()(j()({},e),{},{onActionCallback:i})):(0,g.jsx)("span",{className:"v-line"})},n)})),t?(0,g.jsx)("li",{children:(0,g.jsx)(k,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-null-ch",onActionCallback:i,children:(0,g.jsx)("span",{className:"fill-tip",children:"点击插入\b填空项"})})}):null,a?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("li",{children:(0,g.jsx)(k,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-signal",onActionCallback:i,children:(0,g.jsx)("span",{className:"fill-tip",children:"添加单行填空项"})})}),(0,g.jsx)("li",{children:(0,g.jsx)(k,{icon:"icon-uniE900 insert-blank",className:"btn-null",title:"增加填空",actionName:"add-multiple",onActionCallback:i,children:(0,g.jsx)("span",{className:"fill-tip",children:"添加多行填空项"})})})]}):null,c&&(0,g.jsx)("li",{children:(0,g.jsx)(k,{icon:"icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(c),onActionCallback:i,children:(0,g.jsx)("span",{className:"fill-tip",children:"插入模板"})})}),(0,g.jsx)("li",{className:"btn-full-screen",children:(0,g.jsx)(k,{icon:"".concat(r?"icon-shrink":"icon-enlarge"),title:r?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:i})})]})},S=t(82255),Z=t(78241),C=t(10249),N=t(3113),T={labelCol:{span:4},wrapperCol:{span:20}},E=function(e){var n=e.callback,t=e.onCancel;return(0,g.jsxs)(Z.Z,j()(j()({},T),{},{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(e){n(e)},children:[(0,g.jsx)(Z.Z.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}],children:(0,g.jsx)(C.Z,{})}),(0,g.jsx)(Z.Z.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}],children:(0,g.jsx)(C.Z,{})}),(0,g.jsxs)("div",{className:"flex-container flex-end",children:[(0,g.jsx)(N.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(N.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))},I=t(17124),A=t(8591),P=t(78988),F=Z.Z.useForm,L={width:280,marginRight:10},R={labelCol:{span:5},wrapperCol:{span:19}},V=function(e){var n=e.callback,t=e.onCancel,a=F(),i=u()(a,1)[0],r=(0,f.useRef)();function c(e,n){-1!==e.status?i.setFieldsValue({src:"/api/attachments/".concat(e.id),type:n.type}):A.ZP.error(e.message)}return(0,g.jsxs)(Z.Z,j()(j()({form:i},R),{},{className:"upload-image-panel",onFinish:function(e){n(j()(j()({},e),{},{name:r.current}))},style:{width:470,overflow:"hidden"},children:[(0,g.jsx)(Z.Z.Item,{label:"图片地址",required:!0,children:(0,g.jsxs)("div",{className:"flex-container",children:[(0,g.jsx)(Z.Z.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入文件地址"}],children:(0,g.jsx)(C.Z,{style:L})}),(0,g.jsx)(O,{onFileChange:function(e){var n=e.target.files[0];r.current=n.name,M(n,c)}})]})}),(0,g.jsx)(Z.Z.Item,{label:"图片描述",name:"alt",children:(0,g.jsx)(C.Z,{style:{width:264}})}),(0,g.jsxs)(Z.Z.Item,{style:{textAlign:"right"},children:[(0,g.jsx)(N.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(N.ZP,{type:"default",onClick:t,children:"取消"})]})]}))};function O(e){var n=e.onFileChange;return(0,g.jsxs)("label",{className:"upload-button",style:{cursor:"pointer"},children:["本地上传",(0,g.jsx)("input",{type:"file",onChange:n})]})}function M(e,n){if(!e)throw new String("没有文件");var t=new FormData;t.append("editormd-image-file",e),t.append("file_param_name","editormd-image-file"),t.append("byxhr","true");var a=new window.XMLHttpRequest;a.withCredentials=!0,a.addEventListener("load",(function(t){n(JSON.parse(t.target.responseText),e)}),!1),a.addEventListener("error",(function(e){console.error(e)}),!1),a.open("POST","".concat(P.KI,"/api/attachments.json")),a.send(t)}var B=t(5112),D=t(5871),z=B.ZP.Group,q={margin:"0 8px"},H=function(e){var n=e.callback,t=e.onCancel;return(0,g.jsxs)(Z.Z,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){n(e)},children:[(0,g.jsxs)("div",{className:"flex-container",style:{alignItems:"baseline"},children:[(0,g.jsx)("span",{style:q,children:"单元格数:"}),(0,g.jsx)("span",{style:q,children:"行数"}),(0,g.jsx)(Z.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,g.jsx)(D.Z,{})}),(0,g.jsx)("span",{style:q,children:"列数"}),(0,g.jsx)(Z.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,g.jsx)(D.Z,{})})]}),(0,g.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,g.jsx)("span",{style:q,children:"对齐方式:"}),(0,g.jsx)(Z.Z.Item,{name:"align",children:(0,g.jsxs)(z,{children:[(0,g.jsx)(B.ZP,{value:"default",children:(0,g.jsx)("i",{className:"fa fa-align-justify"})}),(0,g.jsx)(B.ZP,{value:"left",children:(0,g.jsx)("i",{className:"fa fa-align-left"})}),(0,g.jsx)(B.ZP,{value:"center",children:(0,g.jsx)("i",{className:"fa fa-align-center"})}),(0,g.jsx)(B.ZP,{value:"right",children:(0,g.jsx)("i",{className:"fa fa-align-right"})})]})})]}),(0,g.jsxs)("div",{className:"flex-container flex-end",children:[(0,g.jsx)(N.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(N.ZP,{type:"ghost",onClick:t,children:"取消"})]})]})},G=t(91689),U=t(94171),W=t(1012),K=t(43418),J="link",Y="upload-image",$="code-block",Q="add-table",X="------------",ee={default:X,left:":".concat(X),center:":".concat(X,":"),right:"".concat(X,":")},ne=t(22336);var te="@▁▁@";function ae(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var ie=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",re=["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"],ce=p()(p()({},ie+"-B","bold"),ie+"-I","italic"),se=p()(p()(p()(p()({},J,"添加链接"),$,"添加代码块"),Y,"添加文件"),Q,"添加表格"),le=function(e){var n=e.defaultValue,t=void 0===n?"":n,a=e.onChange,r=e.width,s=void 0===r?"100%":r,o=e.height,d=void 0===o?400:o,h=e.miniToolbar,y=void 0!==h&&h,j=e.isFocus,b=void 0!==j&&j,k=e.watch,Z=e.insertTemp,C=e.mode,N=void 0===C?"markdown":C,T=e.id,P=void 0===T?"markdown-editor-id":T,F=e.showResizeBar,L=void 0!==F&&F,R=e.noStorage,O=void 0!==R&&R,B=e.showNullButton,D=void 0!==B&&B,z=e.showNullProgramButton,q=void 0!==z&&z,X=e.hidetoolBar,ie=void 0!==X&&X,le=e.fullScreen,oe=void 0!==le&&le,ue=e.onBlur,de=e.onCMBeforeChange,pe=e.onFullScreen,fe=e.className,he=void 0===fe?"":fe,me=e.disablePaste,ve=void 0!==me&&me,_e=e.disabled,ge=void 0!==_e&&_e,xe=e.disabledFill,ye=void 0!==xe&&xe,je=e.placeholder,be=void 0===je?"":je,ke=e.values,we=void 0===ke?"":ke,Se=(0,f.useState)(null),Ze=u()(Se,2),Ce=Ze[0],Ne=Ze[1],Te=(0,f.useState)(t),Ee=u()(Te,2),Ie=Ee[0],Ae=Ee[1],Pe=(0,f.useState)(k),Fe=u()(Pe,2),Le=Fe[0],Re=Fe[1],Ve=(0,f.useState)(oe),Oe=u()(Ve,2),Me=Oe[0],Be=Oe[1],De=(0,f.useState)(""),ze=u()(De,2),qe=ze[0],He=ze[1],Ge=(0,f.useState)(0),Ue=u()(Ge,2),We=Ue[0],Ke=Ue[1],Je=(0,f.useState)(d),Ye=u()(Je,2),$e=Ye[0],Qe=Ye[1],Xe=(0,f.useState)(!1),en=u()(Xe,2),nn=(en[0],en[1]),tn=(0,f.useRef)((0,W.Z)()),an=(0,f.useRef)(!1),rn=(0,f.useRef)(),cn=(0,f.useRef)(),sn=(0,f.useRef)(),ln=(0,f.useRef)(),on=(0,f.useRef)(),un=function(){var e=l()(c()().mark((function e(){var n,t;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,U.ZP)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:tn.current}});case 2:null!=(t=e.sent)&&null!==(n=t.attachments)&&void 0!==n&&n.length&&(console.log("cm:",Ce,cn),t.attachments.map((function(e){e.content_type.indexOf("image")>-1?Ce.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):e.content_type.indexOf("video")>-1?Ce.replaceSelection('<video width="100%" controls src="'.concat(G.Z.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):e.content_type.indexOf("pdf")>-1?Ce.replaceSelection('<a href="'.concat(G.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):Ce.replaceSelection("[".concat(e.name,"](").concat(G.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")"))})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,f.useEffect)((function(){var e=window.scrollY||window.pageYOffset;Ae(we),null==Ce||Ce.setValue(we),window.scrollTo(0,e)}),[we]),(0,f.useEffect)((function(){null==pe||pe(Me)}),[Me]),(0,f.useEffect)((function(){if(cn.current){var e=function(e,t){if(!ve){var a=t.clipboardData;if(a){var i=a.types.toString(),r=a.items;if("Files"===i||a.types.indexOf("Files")>-1){if(t.preventDefault(),"stex"==N)return;try{var c,s=r[1];"file"===(null===(c=r[0])||void 0===c?void 0:c.kind)&&(s=r[0]);var l=s.getAsFile(),o=l.name.split(".").pop();M(l,(function(e){var t,a,i;e.id?(null==l||null===(t=l.type)||void 0===t?void 0:t.indexOf("image"))>-1?n.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):(null==l||null===(a=l.type)||void 0===a?void 0:a.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(G.Z.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==l||null===(i=l.type)||void 0===i?void 0:i.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(G.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(l.type,'&disposition=inline" target="_blank">').concat(l.name,"</a>")):re.includes(o)?n.replaceSelection('<a href="'.concat(G.Z.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(l.name,"</a>")):n.replaceSelection("[".concat(l.name,"](").concat(G.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")")):401===(null==e?void 0:e.status)&&(document.location.href="/user/login")}))}catch(t){A.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}t.preventDefault()},n=m().fromTextArea(cn.current,{mode:N,lineNumbers:!y,lineWrapping:!0,value:t,autoCloseTags:!q,autoCloseBrackets:!0});return n.on("keyup",(function(e,t){8===t.keyCode&&(""==e.getValue()?n.setOption("placeholder",be):n.setOption("placeholder",null))})),n.on("keydown",(function(e,n){if(8===n.keyCode){var t=function(e,n){var t=e.getDoc(),a=t.getCursor(),i=t.getLine(a.line),r=i.charAt(a.ch-1),c=i.lastIndexOf("@▁@",a.ch),s=i.lastIndexOf("@▁▁@",a.ch),l=c>s?c:s,o=c>s?3:4;if(-1===te.indexOf(r))return null;if(console.log("change1:",n,e,i,a,l,c,s,r),l>=0&&a.ch-l<5){var u=l+o;return t.replaceRange("",{line:a.line,ch:l},{line:a.line,ch:u}),{line:a.line,ch:u}}return null}(e);t&&n.preventDefault()}})),b&&n.focus(),n.on("paste",e),n.on("dragleave",(function(e,n){sn.current.classList.remove("mouse-hover-md")})),n.on("dragover",(function(e,n){sn.current.classList.add("mouse-hover-md")})),n.on("drop",(function(e,t){var a;if(sn.current.classList.add("mouse-hover-md"),(a=t.dataTransfer.files).length>0){t.preventDefault(),t.stopPropagation();for(var i=function(){var e=a[r],t=e.name.split(".").pop();M(e,(function(a){var i,r,c;a.id?(null==e||null===(i=e.type)||void 0===i?void 0:i.indexOf("image"))>-1?n.replaceSelection("![,](/api/attachments/".concat(a.id,"?type=").concat(a.content_type,")")):(null==e||null===(r=e.type)||void 0===r?void 0:r.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(G.Z.API_SERVER,"/api/attachments/").concat(a.id,'"></video>')):(null==e||null===(c=e.type)||void 0===c?void 0:c.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(G.Z.API_SERVER,"/api/attachments/").concat(a.id,"?type=").concat(e.type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):re.includes(t)?n.replaceSelection('<a href="'.concat(G.Z.API_SERVER,"/api/attachments/").concat(a.id,'?type=office&disposition=inline" target="_blank">').concat(e.name,"</a>")):n.replaceSelection("[".concat(e.name,"](").concat(G.Z.API_SERVER,"/api/attachments/").concat(a.id,"?type=").concat(a.content_type,")")):401===(null==a?void 0:a.status)&&(document.location.href="/user/login")}))},r=0;r<a.length;r++)i()}})),ge&&n.on("beforeChange",(function(e,n){"paste"!==n.origin&&"+input"!==n.origin||n.cancel()})),Ne(n),function(){n.off("paste",e)}}}),[]);var dn=(0,f.useCallback)((function(){sn.current}),[$e,sn,Me]);(0,f.useEffect)((function(){if(Ce){var e=function(){var e=new v.Z((function(e){var n,t=i()(e);try{for(t.s();!(n=t.n()).done;){var a=n.value;(a.target.offsetHeight>0||a.target.offsetWidth>0)&&(dn(),Ce.setSize("100%","100%"),Ce.refresh())}}catch(e){t.e(e)}finally{t.f()}}));return e.observe(cn.current.parentElement),e}();return function(){var n,t;null!==(n=cn.current)&&void 0!==n&&n.parentElement&&e.unobserve(null===(t=cn.current)||void 0===t?void 0:t.parentElement)}}}),[Ce,dn]),(0,f.useEffect)((function(){if(Ce){for(var e=[],n=function(){var n=u()(a[t],2),i=n[0],r=n[1],c=p()({},i,(function(){pn(r)}));e.push(c),Ce.addKeyMap(c)},t=0,a=Object.entries(ce);t<a.length;t++)n();return rn.current=setInterval((function(){an.current&&un()}),4e3),function(){clearInterval(rn.current);for(var n=0,t=e;n<t.length;n++){var a=t[n];Ce.removeKeyMap(a)}}}}),[Ce]),(0,f.useEffect)((function(){oe!==Me&&Be(oe)}),[oe]),(0,ne.Z)((function(){if(!O&&We>0){var e=(new Date).getTime(),n=window.sessionStorage.getItem(P);e>=We+1e4&&(!n||n!==Ie)&&(window.sessionStorage.setItem(P,Ie),nn(!0))}}),1e4),(0,f.useEffect)((function(){Re(k)}),[Ce,k]),(0,f.useEffect)((function(){Ce&&b&&Ce.focus()}),[Ce,b]),(0,f.useEffect)((function(){if(Le&&Ce){var e=function(e){var n=e.target;if(on.current){var t=n.scrollTop/n.scrollHeight;on.current.scrollTop=on.current.scrollHeight*t}},n=Ce.getScrollerElement();return n.addEventListener("scroll",e),function(){n.removeEventListener("scroll",e)}}}),[Ce,Le]),(0,f.useEffect)((function(){if(Ce&&de){var e=function(e,n){de(e,n)};return Ce.on("beforeChange",e),function(){Ce.off("beforeChange",e)}}}),[Ce,de]),(0,f.useEffect)((function(){if(Ce&&ue){var e=function(){ue(Ce.getValue())};return Ce.on("blur",e),function(){Ce.off("blur",e)}}}),[Ce,ue]),(0,f.useEffect)((function(){if(Ce){var e=function(e,n){var t=e.getValue();Ae(t),Ke((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),a&&(q?a(t,_n(t)):a(t))};return Ce.on("change",e),function(){Ce.off("change",e)}}}),[Ce,a]),(0,f.useEffect)((function(){if(Ce)if(null==t)Ce.setValue(""),Ae("");else{var e=window.scrollY||window.pageYOffset;t!==Ce.getValue()&&(Ce.setValue(t),Ae(t),Ce.setCursor(ge?1:Ce.lineCount(),0),window.scrollTo(0,e))}}),[Ce,t]);var pn=(0,f.useCallback)((function(e){var n=Ce.getCursor(),t=Ce.getSelection(),a=t.split("\n");switch(e){case"bold":return Ce.replaceSelection("**"+t+"**"),""===t&&Ce.setCursor(n.line,n.ch+2),Ce.focus();case"italic":return Ce.replaceSelection("*"+t+"*"),""===t&&Ce.setCursor(n.line,n.ch+1),Ce.focus();case"code":return Ce.replaceSelection("`"+t+"`"),""===t&&Ce.setCursor(n.line,n.ch+1),Ce.focus();case"inline-latex":return Ce.replaceSelection("`$$"+t+"$$`"),""===t&&Ce.setCursor(n.line,n.ch+3),Ce.focus();case"latex":return Ce.replaceSelection("```latex\n"+t+"\n```"),Ce.setCursor(n.line+1,t.length+1),Ce.focus();case"line-break":return Ce.replaceSelection("<br/>\n"),Ce.focus();case"list-ul":return""===t?Ce.replaceSelection("- "+t):Ce.replaceSelection(a.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Ce.focus();case"list-ol":return""===t?Ce.replaceSelection("1. "+t):Ce.replaceSelection(a.map((function(e,n){return""===e?"":"".concat(n+1,". ").concat(e)})).join("\n")),Ce.focus();case"add-null-ch":return""===t&&Ce.setCursor(n.line,n.ch),Ce.replaceSelection("▁"),Ce.focus();case"add-signal":return""===t&&Ce.setCursor(n.line,n.ch),Ce.replaceSelection("@▁@"),Ce.focus();case"add-multiple":return""===t&&Ce.setCursor(n.line,n.ch),Ce.replaceSelection(te),Ce.focus();case"inster-template-1":return""===t&&Ce.setCursor(n.line,n.ch),Ce.replaceSelection("\n**模板标题**\n模板正文内容可输入文本内容和粘贴图片等操作"),Ce.focus();case"eraser":return Ce.setValue(""),Ce.focus();case"trigger-watch":return Re(!Le),Ce.focus();case"trigger-full-screen":return Be(!Me),Ce.focus();case J:return void He(J);case $:return void He($);case Y:return void He(Y);case Q:return void He(Q);default:throw new Error}}),[Ce,Le,Me]),fn=(0,f.useCallback)((function(e){switch(He(""),qe){case J:var n=e.title,t=e.link;return Ce.replaceSelection("[".concat(n,"](").concat(t,")")),Ce.focus();case $:var a=e.language,i=e.content;return Ce.replaceSelection(["```"+a,i,"```"].join("\n")),Ce.focus();case Y:var r=e.src,c=e.alt;return c?Ce.replaceSelection("![ ".concat(c," ]( ").concat(r,' "').concat(c,'" )')):Ce.replaceSelection("![,](".concat(r,")")),Ce.focus();case Q:for(var s=e.row,l=e.col,o=e.align,u="\n",d=0;d<s;d++){for(var p=[],f=[],h=0;h<l;h++)1===d&&f.push(ee[o]),p.push(" ");1===d&&(u+="| ".concat(f.join(" | ")," |\n")),u+="| ".concat(p.join(1===l?"":" | ")," |\n")}return Ce.replaceSelection(u+"\n"),Ce.focus();default:throw new Error}}),[Ce,qe]),hn=(0,f.useMemo)((function(){switch(qe){case J:return(0,g.jsx)(E,{callback:fn,onCancel:mn});case $:return(0,g.jsx)(I.Z,{callback:fn,onCancel:mn});case Y:return(0,g.jsx)(V,{callback:fn,onCancel:mn});case Q:return(0,g.jsx)(H,{callback:fn,onCancel:mn});default:return null}}),[qe]);function mn(){He("")}(0,f.useEffect)((function(){if(ln.current){var e=function(e){i=!0,r=e.pageY},n=function(){i=!1},t=function(e){if(i){var n=e.pageY-r;n<0&&(n=0),n>300&&(n=300),Qe(d+n+"px")}},a=ln.current,i=!1,r=0;return a.addEventListener("mousedown",e),document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),function(){a.removeEventListener("mousedown",e),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}}}),[Ce,ln]),(0,f.useEffect)((function(){Qe(d)}),[d]);var vn={width:ae(s),height:ae($e)},_n=((0,f.useMemo)((function(){if(We){var e=new Date(We),n=e.getHours(),t=e.getMinutes(),a=e.getSeconds();return t=t<10?"0"+t:t,a=a<10?"0"+a:a,"".concat(n=n<10?"0"+n:n,":").concat(t,":").concat(a)}return 0}),[We]),function(e){var n=[];if(q){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,t,a){n.push({multiLine:!("@▁@"===e)})}))}return n});return(0,g.jsxs)(f.Fragment,{children:[(0,g.jsx)("div",{className:"markdown-editor-wrapper",ref:sn,children:(0,g.jsxs)("div",{className:"markdown-editor-container ".concat(he," ").concat(Le?"on-preview":""," ").concat(y?"mini":""," ").concat(Me?"full-screen":""),style:vn,children:[(0,g.jsx)(w,{insertTemp:Z,watch:Le,fullScreen:Me,showNullButton:D,showNullProgramButton:q,onActionCallback:pn,hidetoolBar:ie,uuid:tn.current,setOpenPhones:function(){an.current=!0}}),(0,g.jsxs)("div",{className:"markdown-editor-body",children:[(0,g.jsx)("div",{className:"codemirror-container",children:(0,g.jsx)("textarea",{ref:cn,placeholder:be})}),Le?(0,g.jsxs)("div",{ref:on,className:"preview-container",children:["stex"===N&&(0,g.jsx)(x,{value:Ie}),"stex"!==N&&(0,g.jsx)(_.Z,{disabledFill:ye,showProgramFill:q,value:Ie})]}):null]})]})}),L?(0,g.jsx)("a",{ref:ln,className:"editor-resize"}):null,(0,g.jsx)(S.Z,{children:se[qe]?(0,g.jsx)(K.Z,{centered:!0,title:se[qe],open:!0,onCancel:mn,footer:null,className:"markdown-popup-form",children:hn}):null})]})}},82255:function(e,n,t){t.d(n,{Z:function(){return f}});var a=t(82100),i=t.n(a),r=t(29186),c=t.n(r),s=t(80619),l=t.n(s),o=t(47074),u=t.n(o),d=t(59301),p=t(4676),f=function(e){l()(t,e);var n=u()(t);function t(e){var a;i()(this,t),a=n.call(this,e);var r=window.document;return a.node=r.createElement("div"),r.body.appendChild(a.node),a}return c()(t,[{key:"render",value:function(){var e=this.props.children;return(0,p.createPortal)(e,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),t}(d.Component)},86048:function(e,n,t){t(59301),t(45298);var a=t(57809),i=t(78673),r=t(37712),c=a.default.Option;n.Z=function(e){var n=e.isTheoretical,t=e.onFontSizeChange,s=e.cmFontSize,l=e.cmCodeMode,o=(e.autoFormat,e.onCodeModeChange),u=e.onTabToSpace,d=(e.onAutoFormat,e.formatDocument),p=e.className,f=void 0===p?"":p,h=e.tabToSpace,m=e.children;return(0,r.jsxs)("div",{className:"tpi-code-setting ".concat(f),children:[(0,r.jsx)("h3",{children:"代码格式"}),(0,r.jsxs)("section",{children:[(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"显示模式"}),(0,r.jsxs)(a.default,{bordered:!1,size:"small",value:l,onChange:o,children:[(0,r.jsx)(c,{value:"vs",children:"白色背景"}),(0,r.jsx)(c,{value:"vs-dark",children:"黑色背景"})]})]}),!n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"字体大小"}),(0,r.jsxs)(a.default,{bordered:!1,size:"small",value:s,onChange:t,children:[(0,r.jsx)(c,{value:12,children:"12px"}),(0,r.jsx)(c,{value:14,children:"14px"}),(0,r.jsx)(c,{value:16,children:"16px"}),(0,r.jsx)(c,{value:18,children:"18px"}),(0,r.jsx)(c,{value:20,children:"20px"}),(0,r.jsx)(c,{value:22,children:"22px"})]})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"Tab转换"}),(0,r.jsx)(i.Z,{checked:h,onChange:u})]}),(0,r.jsx)("div",{className:"file-item",onClick:d,children:(0,r.jsx)("b",{style:{cursor:"pointer"},children:"格式化代码"})})]})]}),!n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h3",{children:"快捷键"}),(0,r.jsxs)("section",{children:[(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"保存代码"}),(0,r.jsx)("span",{children:"Ctrl + S"})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"唤出快捷键列表"}),(0,r.jsx)("span",{children:"F1 / Alt + F1"})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"左右缩进"}),(0,r.jsx)("span",{children:"Ctrl + ]/["})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"跳到匹配的括号"}),(0,r.jsx)("span",{children:"Ctrl + Shift + \\"})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"转到行首"}),(0,r.jsx)("span",{children:"Home"})]}),(0,r.jsxs)("div",{className:"file-item",children:[(0,r.jsx)("b",{children:"转到行尾"}),(0,r.jsx)("span",{children:"End"})]})]}),m]})]})}},22336:function(e,n,t){t.d(n,{Z:function(){return i}});var a=t(59301);function i(e,n){var t=(0,a.useRef)();(0,a.useEffect)((function(){t.current=e})),(0,a.useEffect)((function(){if(null!==n){var e=setInterval((function(){t.current()}),n);return function(){return clearInterval(e)}}}),[n])}},92745:function(e,n,t){t.d(n,{Z:function(){return _}});var a=t(79800),i=t.n(a),r=t(82242),c=t.n(r),s=t(59301),l=t(43428),o=t(63631),u=t(86048),d=t(82255),p=t(34407),f=t(37712),h={theme:(0,p.G)("cmCodeMode","vs-dark"),fontSize:(0,p.G)("cmFontSize",14),showEditorSetting:!1,tabToSpace:(0,p.G)("cmTabToSpace",!0)},m=function(e){return e[e.set_font_size=0]="set_font_size",e[e.set_theme=1]="set_theme",e[e.on_tab_to_space=2]="on_tab_to_space",e[e.set_show_editor_setting=3]="set_show_editor_setting",e}(m||{});function v(e,n){switch(n.type){case m.set_show_editor_setting:return c()(c()({},e),{},{showEditorSetting:n.payload});case m.set_theme:return c()(c()({},e),{},{theme:n.payload});case m.set_font_size:return c()(c()({},e),{},{fontSize:n.payload});case m.on_tab_to_space:return c()(c()({},e),{},{tabToSpace:n.payload});default:throw new Error}}var _=function(e){var n=e.isLoading,t=e.value,a=e.onChange,r=e.language,_=e.onUpdateCode,x=e.ActionBarRender,y=void 0===x?function(e){return(0,f.jsx)(g,{onShowCodeSetting:e})}:x,j=(0,s.useReducer)(v,h),b=i()(j,2),k=b[0],w=b[1],S=k.theme,Z=k.fontSize,C=k.showEditorSetting,N=k.tabToSpace,T=(0,s.useRef)(),E=(0,s.useRef)(),I={onFontSizeChange:function(e){w({type:m.set_font_size,payload:e}),(0,p.t)("cmFontSize",e)},tabToSpace:N,cmFontSize:Z,className:"oj",cmCodeMode:S,onTabToSpace:function(e){w({type:m.on_tab_to_space,payload:e}),(0,p.t)("cmTabToSpace",e)},onCodeModeChange:function(e){w({type:m.set_theme,payload:e}),(0,p.t)("cmCodeMode",e)}};var A={value:t,language:r,theme:S,height:"calc(100% - 56px)",options:{fontSize:Z,insertSpaces:N},onChange:function(e){a(e),E.current=e,clearTimeout(T.current),T.current=setTimeout((function(){_(E.current)}),1e4)},onEditBlur:function(e){E.current&&_(E.current)}};return(0,f.jsxs)(s.Fragment,{children:[(0,f.jsxs)("div",{className:"code-panel-container",children:[y((function(){w({type:m.set_show_editor_setting,payload:!0})})),!n&&(0,f.jsx)(o.ZP,c()({},A))]}),(0,f.jsx)(d.Z,{children:(0,f.jsx)(l.Z,{rootClassName:"oj",title:null,placement:"right",closable:!1,open:C,onClose:function(){w({type:m.set_show_editor_setting,payload:!1})},children:(0,f.jsx)(u.Z,c()({},I))})})]})};function g(e){var n=e.onShowCodeSetting;return(0,f.jsxs)("div",{className:"action-bar",children:[(0,f.jsx)("span",{children:"学员初始代码文件"}),(0,f.jsx)("a",{onClick:n,children:(0,f.jsx)("i",{className:"iconfont icon-shezhi"})})]})}},10114:function(e,n,t){t.d(n,{Z:function(){return j}});var a=t(79800),i=t.n(a),r=t(82242),c=t.n(r),s=t(59301),l=t(43428),o=t(63631),u=t(86048),d=t(82255),p=t(34407),f="code-panel-container___RFtv_",h="action-oj-bar___ByFmZ",m="active___s9gT5",v=t(89392),_=t(37712),g={theme:(0,p.G)("cmCodeMode","vs-dark"),fontSize:(0,p.G)("cmFontSize",14),showEditorSetting:!1,tabToSpace:(0,p.G)("cmTabToSpace",!0)},x=function(e){return e[e.set_font_size=0]="set_font_size",e[e.set_theme=1]="set_theme",e[e.on_tab_to_space=2]="on_tab_to_space",e[e.set_show_editor_setting=3]="set_show_editor_setting",e}(x||{});function y(e,n){switch(n.type){case x.set_show_editor_setting:return c()(c()({},e),{},{showEditorSetting:n.payload});case x.set_theme:return c()(c()({},e),{},{theme:n.payload});case x.set_font_size:return c()(c()({},e),{},{fontSize:n.payload});case x.on_tab_to_space:return c()(c()({},e),{},{tabToSpace:n.payload});default:throw new Error}}var j=function(e){var n,t=e.isLoading,a=e.value,r=void 0===a?[]:a,h=e.onChange,m=(0,s.useReducer)(y,g),j=i()(m,2),k=j[0],w=j[1],S=k.theme,Z=k.fontSize,C=k.showEditorSetting,N=k.tabToSpace,T=(0,s.useState)("c"),E=i()(T,2),I=E[0],A=E[1],P=(0,s.useRef)([]);(0,s.useEffect)((function(){null!=r&&r.length&&(P.current=(0,v.cloneDeep)(r))}),[r]);var F={onFontSizeChange:function(e){w({type:x.set_font_size,payload:e}),(0,p.t)("cmFontSize",e)},tabToSpace:N,cmFontSize:Z,className:"oj",cmCodeMode:S,onTabToSpace:function(e){w({type:x.on_tab_to_space,payload:e}),(0,p.t)("cmTabToSpace",e)},onCodeModeChange:function(e){w({type:x.set_theme,payload:e}),(0,p.t)("cmCodeMode",e)}};var L={key:I,value:null==r||null===(n=r.find((function(e){return e.language===I})))||void 0===n?void 0:n.code,language:I,onChange:function(e){var n,t=null===(n=P.current)||void 0===n?void 0:n.map((function(n){return n.language===I?(n.code=e,n):n}));P.current=(0,v.cloneDeep)(t),h(t)},theme:S,height:"calc(100% - 56px)",options:{fontSize:Z,insertSpaces:N}};return(0,_.jsxs)(s.Fragment,{children:[(0,_.jsxs)("div",{className:f,children:[(0,_.jsx)(b,{languageItems:r,onLanguage:function(e){return A(e)},language:I,onShowCodeSetting:function(){w({type:x.set_show_editor_setting,payload:!0})}}),!t&&(0,_.jsx)(o.ZP,c()({},L))]}),(0,_.jsx)(d.Z,{children:(0,_.jsx)(l.Z,{rootClassName:"oj",title:null,placement:"right",closable:!1,open:C,onClose:function(){w({type:x.set_show_editor_setting,payload:!1})},children:(0,_.jsx)(u.Z,c()({},F))})})]})};function b(e){var n=e.languageItems,t=e.language,a=e.onShowCodeSetting,i=e.onLanguage;return(0,_.jsxs)("div",{className:h,children:[(0,_.jsx)("span",{children:"学员初始代码文件"}),null==n?void 0:n.map((function(e){return(0,_.jsx)("div",{className:t===(null==e?void 0:e.language)?m:"",onClick:function(){return i(null==e?void 0:e.language)},children:null==e?void 0:e.language},null==e?void 0:e.language)})),(0,_.jsx)("a",{onClick:a,children:(0,_.jsx)("i",{className:"iconfont icon-shezhi"})})]})}},28944:function(e,n,t){t.r(n),t.d(n,{Types:function(){return re}});var a=t(70236),i=t.n(a),r=t(91232),c=t.n(r),s=t(37205),l=t.n(s),o=t(7557),u=t.n(o),d=t(41498),p=t.n(d),f=t(79800),h=t.n(f),m=t(82242),v=t.n(m),_=t(59301),g=t(12085),x=t(10249),y=t(43418),j=t(36381),b=t(78241),k=t(8591),w=t(71418),S=t(3113),Z=t(57809),C=t(19842),N=t(5871),T=t(24905),E=t(5112),I=t(81327),A=t(14478),P=t(42190),F=t(49389),L=t(24334),R=t(76618),V=t(65363),O=t(59081),M=t(13119),B=t(94280),D=t(2028),z=t(92745),q=t(10114),H=t(94171),G=t(83287),U=t(91689),W=t(52058),K=t(23075),J=t(82887),Y=t(17477),$=t(97183),Q=t(58605),X=t(37712),ee=x.Z.TextArea,ne=y.Z.confirm,te=j.Z.Panel;function ae(){return(new Date).getTime()}var ie={loading:!0,user:null,disciplines:[],dicts:null,status:0,data:void 0,lastedUpdateTime:0},re=function(e){return e[e.SET_INITAL_DATA=0]="SET_INITAL_DATA",e[e.SET_LOADING=1]="SET_LOADING",e[e.SET_STATUS=2]="SET_STATUS",e}({});function ce(e,n){switch(n.type){case re.SET_INITAL_DATA:return v()(v()({},e),n.payload);case re.SET_LOADING:return v()(v()({},e),{},{loading:n.payload});case re.SET_STATUS:return v()(v()({},e),{},{status:n.payload});default:throw new Error}}function se(e){var n,t,a=e.form,r=e.onAddTestCases,c=e.handleAddKnowledgeFinish,s=e.ischecked,o=(e.MyGroup,e.formValue),u=e.knowledgeOptions,d=e.categorys,p=e.hack,f=e.callback_url,m=e.onChangeAverage,y=e.onChangeScore,k=e.onChangehide,w=e.onChangeFile,F=e.onAddTestCase,L=e.onRemoveTestCase,R=e.onChangeSubDiscipline,M=e.onChangeLanguage,B=e.uploadData,D=e.setUploadData,z=e.handleUploadRatio,q=e.isshows,H=e.isProgram,G=e.addUploadFnc,U=(null===(n=location)||void 0===n||null===(n=n.search)||void 0===n?void 0:n.includes("select"))||!1,Y=(0,_.useState)(q),$=h()(Y,2),ne=$[0],ae=$[1],ie=(0,_.useState)(!1),re=h()(ie,2),ce=re[0],se=re[1],le=p.test_set_average,oe=p.test_set_score,ue=(0,_.useState)(!1),de=h()(ue,2),pe=de[0],fe=de[1];function he(e){e.stopPropagation()}return(0,X.jsxs)("div",{className:g.Z["oj-left-panel"],children:[(0,X.jsxs)("div",{className:g.Z["oj-form-info"],children:[(0,X.jsxs)("div",{className:g.Z.field,children:[(0,X.jsx)(b.Z.Item,{label:"难易度",name:["hack","difficult"],rules:[{required:!0,message:"请选择难易度"}],children:(0,X.jsx)(Z.default,{disabled:U,children:(0,P.jw)(P.R8.difficult)})}),(0,X.jsx)(b.Z.Item,{label:"课程(合理的课程分类有利于快速检索)",name:["hack","sub_discipline_id"],rules:[{required:!0,message:"请选择课程"}],children:(0,X.jsx)(C.Z,{disabled:U,allowClear:!1,options:d,placeholder:"请选择",onChange:R})})]}),(0,X.jsxs)("div",{className:g.Z.field,children:[f&&(0,X.jsx)(b.Z.Item,{label:"分数",name:["hack","score"],rules:[{required:!0,message:"请输入分数"}],extra:(0,X.jsx)("span",{style:{position:"absolute",left:100,top:5},children:"分"}),children:(0,X.jsx)(N.Z,{disabled:U,min:1,max:100})}),(0,X.jsx)(b.Z.Item,{label:(0,X.jsx)("div",{children:"单个测试集评测时长限制 "}),name:["hack","time_limit"],rules:[{required:!0,message:"请输入单个测试集评测时长限制"},{type:"number",min:3,message:"最小限制时间是3秒"}],extra:(0,X.jsx)("span",{style:{position:"absolute",left:100,top:5},children:"秒"}),children:(0,X.jsx)(N.Z,{min:3})}),H?(0,X.jsx)(b.Z.Item,{label:"编程语言",style:{paddingBottom:16},name:["hack","languages"],rules:[{required:!0,message:"请选择编程语言"}],children:(0,X.jsxs)(T.Z.Group,{children:[(0,X.jsx)(T.Z,{value:"C",children:"C"}),(0,X.jsx)(T.Z,{value:"C++",children:"C++"}),(0,X.jsx)(T.Z,{value:"Java",children:"Java"}),(0,X.jsx)(T.Z,{value:"Python",children:"Python"})]})}):(0,X.jsx)(b.Z.Item,{label:"编程语言",name:["hack_codes","language"],style:{paddingBottom:16},rules:[{required:!0,message:"请选择编程语言"}],children:(0,X.jsx)(Z.default,{onChange:M,children:(0,P.jw)(P.R8.language)})})]}),(0,X.jsx)(b.Z.Item,{label:(0,X.jsxs)("span",{children:["知识点:",(0,X.jsx)("span",{className:"c-grey-999",children:"所有自建知识点仅本人可见被EduCoder平台审核通过为官方知识点后所有用户可见"})]}),name:["hack","tag_discipline_ids"],children:(0,X.jsx)(W.N,{selectvalues:(null==p?void 0:p.tag_discipline_id)||(null==p?void 0:p.tag_discipline_ids),disabled:U,subId:null==o||null===(t=o.hack)||void 0===t||null===(t=t.sub_discipline_id)||void 0===t?void 0:t[1],knowledgeOptions:u,onAddKnowledgeFinish:c})}),(0,X.jsx)(b.Z.Item,{label:"加入文件夹目录",name:["hack","item_banks_group_ids"],labelCol:{span:24},wrapperCol:{span:24},children:(0,X.jsx)(K.Z,{disabled:U})}),(0,X.jsx)(b.Z.Item,{label:"任务名称",name:["hack","name"],rules:[{required:!0,message:"请输入任务名称"}],children:(0,X.jsx)(x.Z,{maxLength:60,placeholder:"请输入任务名称",suffix:(0,X.jsx)("span",{children:60-p.name.length})})}),(0,X.jsx)(b.Z.Item,{name:["hack","description"],valuePropName:"defaultValue",rules:[{required:!0,message:"请输入描述内容"}],children:(0,X.jsx)(O.Z,{miniToolbar:!0,id:"moop_cases_content",noStorage:!0,height:200})}),(0,X.jsx)("div",{onClick:function(){return se(!0)},children:(0,X.jsx)(b.Z.Item,{label:"题目解析",name:["hack","analysis"],className:"".concat(g.Z.baseLineHeight),children:(0,X.jsx)(Q.x,{placeholder:"请编辑题目解析(非必填)",isEdit:ce})})}),(0,X.jsxs)("div",{className:"tst-case-info",children:[(0,X.jsxs)("h3",{className:"flex-container",style:{justifyContent:"space-between"},children:[" 测试用例与系统评分规则",!p.is_file&&(0,X.jsx)(S.ZP,{type:"primary",ghost:!0,onClick:F,children:"添加测试用例"})]}),(0,X.jsx)(b.Z.Item,{name:["hack","test_set_score"],children:(0,X.jsxs)(E.ZP.Group,{onChange:y,children:[(0,X.jsxs)(E.ZP,{value:!0,children:["通过全部测试集",(0,X.jsx)("span",{className:"tip",children:" (学员评测,仅当所有测试集都正确时,才获得一次性奖励)"})]}),(0,X.jsxs)(E.ZP,{value:!1,children:["通过部分测试集",(0,X.jsx)("span",{className:"tip",children:" (学员评测,通过测试集即可获得对应奖励)"})]})]})}),(0,X.jsx)(T.Z,{style:{marginBottom:"5px"},checked:s,onChange:k,children:"隐藏实际输出 (选中,则在学生考试过程中无法看到实际输出结果,仅展示是否评测是否通过)"}),(0,X.jsx)(b.Z.Item,{className:g.Z.testJi,name:["hack","is_file"],label:"用例类型:",children:(0,X.jsx)(E.ZP.Group,{onChange:w,children:(0,X.jsxs)(I.Z,{direction:"horizontal",children:[(0,X.jsx)(E.ZP,{value:!1,children:"文本"}),(0,X.jsx)(E.ZP,{value:!0,children:"文件"})]})})}),!p.test_set_score&&(0,X.jsx)(b.Z.Item,{name:["hack","test_set_average"],label:"系统评分占比",children:(0,X.jsxs)(E.ZP.Group,{onChange:m,children:[(0,X.jsx)(E.ZP,{value:!0,children:"均分比例"}),(0,X.jsx)(E.ZP,{value:!1,children:"自定义比例"})]})}),!p.test_set_score&&(0,X.jsxs)("div",{style:{marginBottom:"20px",marginTop:"-10px"},children:[(0,X.jsxs)("div",{style:{display:"flex",height:"30px",marginBottom:"10px"},children:[(0,X.jsx)(T.Z,{checked:ne,style:{display:"flex",alignItems:"center"},className:g.Z.checkboxs,onChange:function(e){ae(e.target.checked),a.setFieldsValue({hack:{code_compile_score:0}}),p.test_set_average&&(p.is_file?z(B):r())},children:"启用编译通过即可得分"}),ne&&(0,X.jsxs)("span",{style:{display:"flex"},children:[(0,X.jsx)(b.Z.Item,{rules:[{required:!0,message:"请输入编译得分"}],name:["hack","code_compile_score"],children:(0,X.jsx)(N.Z,{onChange:function(){p.test_set_average&&(p.is_file?z(B):r())},parser:function(e){return isNaN(parseInt(e))?"":parseInt(e)},min:0,max:100,style:{width:"90px",margin:"5px 0px"}})})," ",(0,X.jsx)("span",{style:{display:"flex",alignItems:"center",marginLeft:"5px"},children:"%"})]})]}),(0,X.jsx)("span",{style:{color:"#999",fontSize:"12px",marginLeft:"-8px"},children:"(请注意该实训题是否有编译过程,若没有则无法获得编译得分)"})]}),(0,X.jsxs)("div",{className:g.Z.upBtn,children:[(0,X.jsx)(S.ZP,{ghost:!0,type:"primary",className:"mb20",onClick:function(){return fe(!0)},children:"批量上传测试用例"}),(null==p?void 0:p.is_file)&&(0,X.jsx)(J.Y2,{disabled:null==p?void 0:p.test_set_average,inputChange:function(e,n){console.log(e,n);var t=B.map((function(t,a){return a===n?v()(v()({},t),{},{score:e.target.value?Number(e.target.value):0}):t}));D(t)},showScore:!p.test_set_score,data:B,onRemove:function(e,n){var t=l()(B);t.splice(n,1),le?z(t):D(t)}})]}),!p.is_file&&(0,X.jsx)(b.Z.List,{name:"hack_sets",children:function(e,n){return i()(n),(0,X.jsx)(j.Z,{accordion:!0,className:g.Z.collapse,children:e.map((function(e,n){return(0,X.jsxs)(te,{header:(0,X.jsxs)("a",{className:g.Z["test-case-name"],children:[(0,X.jsxs)("span",{children:["测试用例",n+1]}),oe?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(b.Z.Item,{name:[e.name,"score"],fieldKey:[e.fieldKey,"score"],rules:[{required:!0,message:"请输入测试集".concat(n+1,"评分")}],children:(0,X.jsx)(N.Z,{onClick:he,min:0,max:100,disabled:le})}),(0,X.jsx)("span",{children:"%"})]})]}),extra:n>0?(0,X.jsx)("div",{onClick:he,children:(0,X.jsx)(A.Z,{okText:"确定",cancelText:"取消",title:"确定删除测试集"+(n+1),onConfirm:function(){L(n)},children:(0,X.jsx)(V.Z,{className:g.Z["btn-remove-case"]})})}):null,children:[(0,X.jsx)(b.Z.Item,{label:"输入",name:[e.name,"input"],fieldKey:[e.fieldKey,"input"],children:(0,X.jsx)(ee,{})}),(0,X.jsx)(b.Z.Item,{label:"输出",name:[e.name,"output"],fieldKey:[e.fieldKey,"output"],rules:[{required:!0,message:"请输入输出内容"}],children:(0,X.jsx)(ee,{})})]},"".concat(e.key,"--").concat(n))}))})}})]})]}),(0,X.jsx)(J.ZP,{rootIdentifier:null,visible:pe,onClose:function(){return fe(!1)},onOK:function(e){if(null!=e&&e.length){if(null!=e&&e[0].is_file){G(e,!0)();var n=B.concat(e);p.test_set_average?z(n):D(n)}null!=e&&e[0].is_file||G(e)}},multiple:!0,defaultMultipleValue:null==p?void 0:p.is_file})]})}n.default=function(){var e,n,t=(0,F.useSearchParams)(),a=h()(t,1)[0],i=((0,F.useLocation)(),(0,F.useParams)().id),r=b.Z.useForm(),s=h()(r,1)[0],o=(0,_.useState)(),d=h()(o,2),f=d[0],m=d[1],x=(0,_.useState)([]),j=h()(x,2),Z=j[0],C=j[1],N=(0,_.useState)([]),T=h()(N,2),E=T[0],I=T[1],A=(0,_.useReducer)(ce,ie),V=h()(A,2),O=V[0],W=V[1],K=O.loading,J=O.data,Q=O.user,ee=O.disciplines,te=O.dicts,le=O.status,oe=null==J?void 0:J.hack_sets,ue=null==J||null===(e=J.hack)||void 0===e?void 0:e.test_set_average,de=(0,G.oP)(),pe=de.callback_url,fe=de.express_id,he=de.score,me=de.question_id,ve=de.type,_e=(0,_.useState)([]),ge=h()(_e,2),xe=ge[0],ye=ge[1],je=(0,_.useState)(!1),be=h()(je,2),ke=be[0],we=be[1],Se=(0,_.useState)(!1),Ze=h()(Se,2),Ce=Ze[0],Ne=Ze[1],Te="1"===ve,Ee=(0,_.useMemo)((function(){var e=[];return ee&&(0,P.D0)(ee,e),e}),[ee]),Ie=(0,_.useCallback)(p()(u()().mark((function e(){var n,t,a,r,c,l,o,d,p,f,_,g,x,y,j,b,k,w,S,Z,C,N,T,E,A,F,R,V,O,B,D,z,q,H,U,K,J,Y,$,Q,X,ne,te,ae,ie,ce,se,le,oe,ue,de,pe,fe=arguments;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=fe.length>0&&void 0!==fe[0]?fe[0]:0,0!==(t=ee).length){e.next=7;break}return e.next=5,(0,M.d1)("new_question");case 5:a=e.sent,t=a.disciplines;case 7:if(!i){e.next=15;break}return r={disciplines:t},e.next=11,(0,M.fu)(i);case 11:(c=e.sent).message?"401"===c.status&&(document.location.href="/user/login"):(l=c.category,o=c.user,d=c.code,p=c.language,f=c.hack_sets,_=c.description,g=c.difficult,x=c.name,y=c.open_or_not,j=c.sub_discipline_id,c.tag_discipline_id,b=c.analysis,k=c.time_limit,w=c.test_set_average,S=c.test_set_score,Z=c.status,C=c.tag_discipline_ids,N=c.item_banks_group_id,T=c.is_file,E=void 0!==T&&T,A=c.hide_actual_output,F=c.code_compile_score,R=c.languages,V=c.is_my,O=c.codes,B=(0,P.y3)(t,j),D=h()(B,2),z=D[0],q=D[1],we(A),H=E?[{input:"",output:"",score:100,position:1}]:f,E?(I(f),s.setFieldsValue({hack_sets:H})):I([]),U=(0,G.oP)(),K=U.lastedUpdateTime,J=null==O?void 0:O.map((function(e){return v()(v()({},e),{},{code:L.Base64.decode(null==e?void 0:e.code)})})),r=v()(v()({},r),{},{loading:!1,user:o,dicts:q,status:Z,lastedUpdateTime:n||(K||0),data:{hack_codes:{language:p,code:L.Base64.decode(d)},hack:{category:l,difficult:g,name:x,description:_,open_or_not:y,time_limit:k,test_set_average:w,test_set_score:S,sub_discipline_id:z,tag_discipline_ids:C,languages:R,score:he||1,item_banks_group_ids:N,is_file:E,is_my:V,code_compile_score:F,analysis:b},hack_sets:H,tags:C,codes:J}}),parseInt(F)>0&&Ne(!0),W({type:re.SET_INITAL_DATA,payload:r}),m({hack:{category:l,difficult:g,name:x,description:_,open_or_not:y,time_limit:k,test_set_average:w,test_set_score:S,sub_discipline_id:z,tag_discipline_ids:C,score:he||1,item_banks_group_ids:N,is_file:E,analysis:b},codes:J}),Ae(null==z?void 0:z[0],null==z?void 0:z[1],t)),e.next=25;break;case 15:return e.next=17,(0,M.PR)();case 17:Q=e.sent,X=Q.user,ne=(0,G.oP)(),te=ne.difficult,ae=ne.sub_discipline_id,ie=ne.tag_discipline_id,ce=ne.tagIds,se=ne.banksIds,le=(0,P.y3)(t,parseInt(ae,10)),oe=h()(le,2),ue=oe[0],de=oe[1],pe=[Number(se)],W({type:re.SET_INITAL_DATA,payload:{loading:!1,user:X,disciplines:t,status:0,dicts:de,data:{hack_codes:{language:"C",code:""},hack:{category:null,difficult:parseInt(te,10),time_limit:3,description:"",test_set_score:!0,test_set_average:!0,open_or_not:!0,sub_discipline_id:ue,tag_discipline_id:ce&&(null==ce||null===(Y=ce.split(","))||void 0===Y?void 0:Y.map((function(e){return Number(e)}))),name:"",item_banks_group_ids:pe,is_file:!1},tags:ie?null==ie?void 0:ie.split(",").map((function(e){return parseInt(e,10)})):[],hack_sets:[{input:"",output:"",score:100,position:1}]}}}),m({hack:{category:null,difficult:parseInt(te,10),time_limit:3,description:"",test_set_average:!0,open_or_not:!0,sub_discipline_id:ue,tag_discipline_id:ce&&(null==ce||null===($=ce.split(","))||void 0===$?void 0:$.map((function(e){return Number(e)}))),name:"",item_banks_group_id:pe,is_file:!1}}),Ae(null==ue?void 0:ue[0],null==ue?void 0:ue[1],t);case 25:case"end":return e.stop()}}),e)}))),[i,ee]);(0,_.useEffect)((function(){try{Ie()}catch(e){console.log(e,"----")}}),[]),(0,_.useEffect)((function(){function e(){return e=p()(u()().mark((function e(){var n;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,H.U2)("item_banks_groups/mine.json");case 2:n=e.sent,ye(n);case 4:case"end":return e.stop()}}),e)}))),e.apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[]);var Ae=function(e,n,t){var a;null==t||null===(a=t.find((function(n){return n.id===e})))||void 0===a||null===(a=a.sub_disciplines)||void 0===a||null===(a=a.find((function(e){return e.id===n})))||void 0===a||a.tag_disciplines};function Pe(e,n,t){return Fe.apply(this,arguments)}function Fe(){return Fe=p()(u()().mark((function e(n,t,a){var r,s,l,o,d,p,f,h,m,_,g,x,y,j,b,w,S,Z,C;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=v()({},n),s=r.hack_sets,l=r.hack_codes,o=r.hack,d=r.tags,p=r.codes,o.hide_actual_output=ke,f=[],h=[],m=0,_=null!=o&&o.is_file?E.map((function(e,n){return v()(v()({},e),{},{position:n+1})})):s.map((function(e){return v()(v()({},e),{},{is_file:!1})})),g=c()(_);try{for(g.s();!(x=g.n()).done;)y=x.value,m+=y.score,y.id&&y.id>=0?f.push(y):h.push(y)}catch(e){g.e(e)}finally{g.f()}if(null!=_&&_.length){e.next=11;break}return k.ZP.error("测试集不能为空"),e.abrupt("return");case 11:if(100===(m+=parseInt(o.code_compile_score||0))||o.test_set_score){e.next=15;break}return k.ZP.error("测试集的评分占比之和必须等于100"),e.abrupt("return");case 15:if(null==_||!_.some((function(e){return!e.output}))){e.next=18;break}return k.ZP.error("测试集输出不能为空"),e.abrupt("return");case 18:if(j={},Te?null==p||p.forEach((function(e){j[e.language]=null!=e&&e.code?L.Base64.encode(null==e?void 0:e.code):""})):l.code=L.Base64.encode(null==l?void 0:l.code),o.sub_discipline_id=o.sub_discipline_id[1],W({type:re.SET_LOADING,payload:!0}),pe||(o.score=100*o.difficult),!i){e.next=50;break}return e.next=26,(0,M.l_)(i,{hack:o,hack_codes:l,hack_sets:h,update_hack_sets:f,tags:d,is_cover:a,languages:o.languages,codes:j});case 26:if(!pe){e.next=45;break}return e.next=29,(0,M.j2)(i);case 29:if(!pe.includes("paperlibrary")){e.next=35;break}return e.next=32,(0,Y.oF)({id:fe,question_id:me,item_type:$.c.Program,name:o.name,question_score:o.score,difficulty:o.difficult,sub_discipline_id:o.sub_discipline_id,tag_discipline_ids:o.tag_discipline_ids,item_banks_group_ids:o.item_banks_group_ids,analysis:o.analysis});case 32:return 0===e.sent.status&&F.history.replace(pe),e.abrupt("return");case 35:return e.next=37,(0,M.GM)(me,{question_type:6,question_score:o.score,question_title:o.name,description:o.description,sub_discipline_id:o.sub_discipline_id,tag_discipline_ids:o.tag_discipline_ids,item_banks_group_ids:o.item_banks_group_ids,identifier:i,analysis:o.analysis});case 37:if(b=e.sent,0!==b.status){e.next=43;break}if("start"!==t){e.next=42;break}return e.abrupt("return");case 42:F.history.replace(pe);case 43:e.next=47;break;case 45:k.ZP.success("保存成功"),Ie(ae());case 47:W({type:re.SET_LOADING,payload:!1}),e.next=80;break;case 50:return e.next=52,(0,M.zQ)({hack:o,hack_codes:l,hack_sets:_,tags:d,examination_bank_id:fe||null});case 52:if(w=e.sent,S=w.identifier,Z=w.exam_identifier,W({type:re.SET_LOADING,payload:!1}),"start"!==t){e.next=58;break}return e.abrupt("return");case 58:if(!S){e.next=80;break}if(pe){e.next=63;break}F.history.replace("/problems/".concat(S,"/edit?lastedUpdateTime=").concat(ae())),e.next=80;break;case 63:return e.next=65,(0,M.j2)(S);case 65:if(i){e.next=79;break}if(!pe.includes("paperlibrary")){e.next=72;break}return e.next=69,(0,Y.oF)({id:fe,item_type:$.c.Program,name:o.name,question_score:o.score,difficulty:o.difficult,sub_discipline_id:o.sub_discipline_id,tag_discipline_ids:o.tag_discipline_ids,identifier:Z,analysis:o.analysis});case 69:return 0===e.sent.status&&F.history.replace(pe),e.abrupt("return");case 72:return e.next=74,(0,M.MK)(parseInt(fe,10),{question_type:6,question_score:o.score,question_title:o.name,identifier:S,tag_discipline_ids:o.tag_discipline_ids,analysis:o.analysis});case 74:C=e.sent,0===C.status&&F.history.replace(pe),e.next=80;break;case 79:F.history.replace(pe);case 80:case"end":return e.stop()}}),e)}))),Fe.apply(this,arguments)}function Le(){return(Le=p()(u()().mark((function e(){var n;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,M.ZS)(i);case 2:0===(n=e.sent).status?(k.ZP.success("撤销发布成功"),W({type:re.SET_STATUS,payload:0})):k.ZP.info(n.message);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Re(){return(Re=p()(u()().mark((function e(){return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Pe,e.next=3,s.getFieldValue();case 3:e.t1=e.sent,(0,e.t0)(e.t1,"start"),setTimeout(p()(u()().mark((function e(){var n,t;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,M.uE)(i);case 2:n=e.sent,t=n.identifier,window.location.href=Te?"/myproblems/".concat(t,"?type=1"):"/myproblems/".concat(t);case 5:case"end":return e.stop()}}),e)}))),400);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ve(){if(pe)F.history.replace(pe);else if(Te){var e,n=null===(e=localStorage.getItem("program_homework"))||void 0===e?void 0:e.split(",");F.history.push("/classrooms/".concat(null==n?void 0:n[0],"/program_homework/").concat(null==n?void 0:n[1],"/detail"))}else F.history.replace("/problemset")}var Oe=function(e){var n=parseInt(s.getFieldValue("hack").code_compile_score)||0,t=Math.floor((100-n)/e.length),a=t+(100-n)%e.length;e=e.map((function(n,i){return i===e.length-1?v()(v()({},n),{},{score:a}):v()(v()({},n),{},{score:t})})),I(e)};(0,_.useEffect)((function(){if(ue){var e=parseInt(s.getFieldValue("hack").code_compile_score)||0,n=null==oe?void 0:oe.length,t=Math.floor((100-e)/n),a=(100-e)%n;null==oe||oe.map((function(e,i){return e.score=t,e.position=i+1,i===n-1&&(e.score=t+a),e})),W({type:re.SET_INITAL_DATA,payload:{data:v()(v()({},J),{},{hack_sets:oe})}}),s.setFieldsValue({hack_sets:oe})}}),[ue]);(0,_.useEffect)((function(){var e,n;null!=J&&null!==(e=J.hack)&&void 0!==e&&null!==(e=e.sub_discipline_id)&&void 0!==e&&e[1]&&Me(null==J||null===(n=J.hack)||void 0===n||null===(n=n.sub_discipline_id)||void 0===n?void 0:n[1])}),[null==J||null===(n=J.hack)||void 0===n?void 0:n.sub_discipline_id]);var Me=function(){var e=p()(u()().mark((function e(n){var t;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,B.YY)({sub_discipline_id:n});case 2:t=e.sent,C(t.tag_disciplines);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,X.jsx)(w.Z,{spinning:K,delay:500,children:J?(0,X.jsxs)(_.Fragment,{children:[(0,X.jsxs)("header",{className:g.Z.header,children:[(0,X.jsxs)("div",{children:[(0,X.jsx)("img",{src:"".concat(U.Z.IMG_SERVER,"/images/").concat(null==Q?void 0:Q.image_url),alt:"user",width:30}),(0,X.jsx)("span",{children:null==Q?void 0:Q.name})]}),(0,X.jsxs)("h2",{children:[" ",null==J?void 0:J.hack.name," "]}),i?(0,X.jsxs)("a",{className:g.Z.btn_back,onClick:Ve,children:[" ",(0,X.jsx)(R.Z,{}),"退出"]}):null]}),(0,X.jsxs)(b.Z,{form:s,initialValues:J,layout:"vertical",className:g.Z["oj-form-container"],onValuesChange:function(e){var n;if(null!=e&&null!==(n=e.hack)&&void 0!==n&&n.sub_discipline_id){var t,a,i,r=null==e||null===(t=e.hack)||void 0===t?void 0:t.sub_discipline_id,c=h()(r,2),l=c[0],o=c[1],u=(null==ee||null===(a=ee.find((function(e){return e.id===l})))||void 0===a||null===(a=a.sub_disciplines)||void 0===a||null===(a=a.find((function(e){return e.id===o})))||void 0===a||a.tag_disciplines,v()(v()({},s.getFieldsValue()),{},{hack:v()(v()({},null===(i=s.getFieldsValue())||void 0===i?void 0:i.hack),{},{tag_discipline_ids:[]})}));s.setFieldsValue(u),m(u)}else m(v()({},s.getFieldsValue()))},onFinish:function(e,n){!a.get("exercise")||pe.includes("paperlibrary")?Pe(e,n):y.Z.confirm({title:"保存提示",content:"此题目已存在试题库中,是否将修改后的试题覆盖试题库的原题?",okText:"覆盖原题",cancelText:"不覆盖",onOk:function(){return Pe(e,n,1)},onCancel:function(){return Pe(e,n,0)}})},children:[(0,X.jsx)(D.Z,{leftChild:(0,X.jsx)(se,{onAddTestCases:function(){var e=s.getFieldValue("hack_sets"),n=parseInt(s.getFieldValue("hack").code_compile_score)||0,t=e.length,a=Math.floor((100-n)/t),i=(100-n)%t;e.map((function(n,t){return ue&&(n.score=a,t===e.length-1&&(n.score=a+i)),n.position=t+1,n})),s.setFieldsValue({hack_sets:e}),W({type:re.SET_INITAL_DATA,payload:{data:v()(v()({},J),{},{hack_sets:e})}})},form:s,handleAddKnowledgeFinish:function(e){C([].concat(l()(Z),[v()({},e)]))},MyGroup:xe,formValue:f,knowledgeOptions:Z,onChangeLanguage:function(e){W({type:re.SET_INITAL_DATA,payload:{data:v()(v()({},J),{},{hack_codes:v()(v()({},J.hack_codes),{},{language:e})})}})},onChangeSubDiscipline:function(e){var n=e[1],t=(0,P.y3)(ee,n),a=h()(t,2)[1];s.setFieldsValue({tags:[]}),W({type:re.SET_INITAL_DATA,payload:{dicts:a,data:v()(v()({},J),{},{hack:v()(v()({},J.hack),{},{sub_discipline_id:e}),tags:[]})}})},onRemoveTestCase:function(e){var n=s.getFieldValue("hack_sets"),t=parseInt(s.getFieldValue("hack").code_compile_score)||0,a=(null==n?void 0:n.length)-1,i=Math.floor((100-t)/a),r=(100-t)%a;n.splice(e,1),null==n||n.map((function(e,n){return ue&&(e.score=i,n===a-1&&(e.score=i+r)),e.position=n+1,e})),W({type:re.SET_INITAL_DATA,payload:{data:v()(v()({},J),{},{hack_sets:n})}}),s.setFieldsValue({hack_sets:n})},onAddTestCase:function(){var e=s.getFieldValue("hack_sets"),n=parseInt(s.getFieldValue("hack").code_compile_score)||0,t=e.length+1,a=Math.floor((100-n)/t),i=(100-n)%t;e.map((function(e,n){return ue&&(e.score=a),e.position=n+1,e})),e.push({input:"",output:"",position:t,score:ue?a+i:0}),s.setFieldsValue({hack_sets:e}),W({type:re.SET_INITAL_DATA,payload:{data:v()(v()({},J),{},{hack_sets:e})}})},dicts:te,categorys:Ee,callback_url:pe,hack:J.hack,onChangeScore:function(e){e.target.value||Oe(E),W({type:re.SET_INITAL_DATA,payload:{data:v()(v()({},J),{},{hack:v()(v()({},J.hack),{},{test_set_score:e.target.value})})}})},onChangehide:function(e){we(e.target.checked)},onChangeAverage:function(e){var n=e.target.value;n&&Oe(E),W({type:re.SET_INITAL_DATA,payload:{data:v()(v()({},J),{},{hack:v()(v()({},J.hack),{},{test_set_average:n})})}})},onChangeFile:function(e){W({type:re.SET_INITAL_DATA,payload:{data:v()(v()({},J),{},{hack:v()(v()({},J.hack),{},{is_file:e.target.value})})}})},uploadData:E,setUploadData:I,handleUploadRatio:Oe,ischecked:ke,isshows:Ce,isProgram:Te,addUploadFnc:function(e){var n,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t)return function(){W({type:re.SET_INITAL_DATA,payload:{data:v()(v()({},J),{},{hack:v()(v()({},J.hack),{},{is_file:!0})})}}),s.setFieldsValue({hack:{is_file:!0}})};var a=null==e?void 0:e.map((function(e){return{input:e.input,output:e.output,score:0,position:1}})),i=null===(n=s.getFieldValue("hack_sets"))||void 0===n||null===(n=n.filter((function(e){return e.input||e.output})))||void 0===n?void 0:n.concat(a),r=parseInt(s.getFieldValue("hack").code_compile_score)||0,c=null==i?void 0:i.length,l=Math.floor((100-r)/c),o=(100-r)%c;null==i||i.map((function(e,n){return ue&&(e.score=l,n===c-1&&(e.score=l+o)),e.position=n+1,e})),W({type:re.SET_INITAL_DATA,payload:{data:v()(v()({},J),{},{hack_sets:i,hack:v()(v()({},J.hack),{},{is_file:!1})})}}),s.setFieldsValue({hack_sets:i,hack:{is_file:!1}})}}),rightChild:Te?(0,X.jsx)(b.Z.Item,{name:"codes",style:{marginBottom:0},children:(0,X.jsx)(q.Z,{})}):(0,X.jsx)(b.Z.Item,{name:["hack_codes","code"],style:{marginBottom:0},children:(0,X.jsx)(z.Z,{language:J.hack_codes.language})})}),(0,X.jsx)("div",{className:g.Z.footer,children:i?(0,X.jsxs)(_.Fragment,{children:[Te&&(0,X.jsx)(S.ZP,{onClick:Ve,type:"primary",ghost:!0,children:"退出编辑"}),pe||Te?null:(0,X.jsx)(S.ZP,{type:le?"default":"primary",onClick:function(){ne(0===le?{title:"提示",content:(0,X.jsxs)(_.Fragment,{children:[" ",(0,X.jsx)("div",{children:"发布后即可应用到自己管理的课堂"})," ",(0,X.jsx)("div",{children:" 是否确认发布?"})," "]}),okText:"确定",cancelText:"取消",onOk:function(){s.submit(),setTimeout(p()(u()().mark((function e(){var n;return u()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,M.j2)(i);case 2:0===(n=e.sent).status?(k.ZP.success("发布成功"),W({type:re.SET_STATUS,payload:1})):k.ZP.info(n.message);case 4:case"end":return e.stop()}}),e)}))),400)}}:{title:"提示",content:(0,X.jsx)("p",{children:"是否确认撤销发布?"}),okText:"确定",cancelText:"取消",onOk:function(){!function(){Le.apply(this,arguments)}()}})},children:le?"撤销发布":"立即发布"}),(0,X.jsx)(S.ZP,{loading:K,type:"primary",htmlType:"submit",children:"保存"}),(0,X.jsx)(S.ZP,{type:"primary",onClick:function(){return Re.apply(this,arguments)},children:le?"开始挑战":"模拟挑战"})]}):(0,X.jsxs)(_.Fragment,{children:[(0,X.jsx)(S.ZP,{onClick:Ve,children:"取消"}),(0,X.jsx)(S.ZP,{loading:K,type:"primary",htmlType:"submit",children:"保存"})]})})]})]}):null})}},13119:function(e,n,t){t.d(n,{GM:function(){return u},MK:function(){return o},PR:function(){return i},ZS:function(){return p},d1:function(){return r},fu:function(){return c},j2:function(){return d},l_:function(){return s},uE:function(){return f},zQ:function(){return l}});var a=t(94171);function i(){return(0,a.U2)("problems/new.json")}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"question";return(0,a.U2)("disciplines.json",{source:e})}function c(e){return(0,a.U2)("problems/".concat(e,"/edit.json"))}function s(e,n){return(0,a.gz)("problems/".concat(e,".json"),n)}function l(e){return(0,a.v_)("problems.json",e)}function o(e,n){return(0,a.v_)("exercises/".concat(e,"/exercise_questions.json"),n)}function u(e,n){return(0,a.gz)("exercise_questions/".concat(e,".json"),n)}function d(e){return(0,a.v_)("problems/".concat(e,"/publish.json"))}function p(e){return(0,a.v_)("problems/".concat(e,"/cancel_publish.json"))}function f(e){return(0,a.U2)("problems/".concat(e,"/start.json"))}},42190:function(e,n,t){t.d(n,{D0:function(){return d},R8:function(){return l},jw:function(){return u},y3:function(){return p}});var a=t(85573),i=t.n(a),r=t(57809),c=(t(59301),t(37712)),s=r.default.Option,l=function(e){return e[e.language=0]="language",e[e.difficult=1]="difficult",e[e.category=2]="category",e[e.openOrNot=3]="openOrNot",e}({}),o=i()(i()(i()(i()({},l.language,[{title:"C",key:"C"},{title:"C++",key:"C++"},{title:"Python",key:"Python"},{title:"Java",key:"Java"},{title:"JavaScript",key:"JavaScript"},{title:"Ruby",key:"Ruby"}]),l.difficult,[{title:"简单",key:1},{title:"中等",key:2},{title:"困难",key:3}]),l.category,[{title:"程序设计",key:1},{title:"算法",key:2}]),l.openOrNot,[{title:"公开",key:1},{title:"私有",key:0}]);function u(e){return o[e].map((function(e){return(0,c.jsxs)(s,{value:e.key,children:[" ",e.title," "]},e.title)}))}function d(e,n){e.map((function(e){var t=e.id,a=e.name,i=e.sub_disciplines,r={value:t,label:a};n.push(r),i&&i.length>0&&(r.children=[],d(i,r.children))}))}function p(e,n){for(var t=[],a=0;a<e.length;a++){var i,r=e[a];if((null===(i=r.sub_disciplines)||void 0===i?void 0:i.length)>0){t[0]=r.id;for(var c=0;c<r.sub_disciplines.length;c++){var s=r.sub_disciplines[c];if(s.id===n)return t[1]=s.id,[t,s.tag_disciplines||s.sub_disciplines||[]]}}}return[t,[]]}},97183:function(e,n,t){t.d(n,{c:function(){return a}});var a=function(e){return e[e.Single=0]="Single",e[e.Multiple=1]="Multiple",e[e.Judge=2]="Judge",e[e.Fill=3]="Fill",e[e.Subjective=4]="Subjective",e[e.Shixun=5]="Shixun",e[e.Program=6]="Program",e[e.Combine=7]="Combine",e}({})},34407:function(e,n,t){t.d(n,{G:function(){return c},t:function(){return r}});var a=t(7062),i=t.n(a);function r(e,n){var t=i().get("__ec");t||(t={}),t[e]=n,i().set("__ec",t)}function c(e,n){var t=i().get("__ec");return t?void 0===t[e]?n:t[e]:n}},69092:function(e,n){n.Z={wrap:"wrap___ilWvf",deleteIcon:"deleteIcon___JBDG8",keywordTag:"keywordTag___iieCb",questionTitleEditorWrap:"questionTitleEditorWrap___MHB5s",choiceWrap:"choiceWrap___QFkTc",choiceIndex:"choiceIndex___Mr2YO",judgementIndex:"judgementIndex___fUVWK",setAnswerBtn:"setAnswerBtn___Whox5",activeAnswer:"activeAnswer___fGU6Y",activeJudgementAnswer:"activeJudgementAnswer___wJv8P",actionWrapper:"actionWrapper___ERQ7k",addIcon:"addIcon___L9TE0",inputBorder:"inputBorder___Q5tRE",placeholder:"placeholder___p9sFY",blankWrapper:"blankWrapper___nC45e",blankInput:"blankInput___pEHsx",blankInputNumberWrapper:"blankInputNumberWrapper___uEHb0",addBtn:"addBtn___WR5ZI",blankIndex:"blankIndex___x9Pny",baseInputWrapper:"baseInputWrapper___eVsG7",collapseWrapper:"collapseWrapper___ZTysU",panelHeader:"panelHeader___QSN9g",open:"open___B6FU9",close:"close___QX19r",hide:"hide___mn25n"}},12085:function(e,n){n.Z={header:"header___HqHSe",checkboxs:"checkboxs___ObBnD",field:"field___w_sM6","oj-form-container":"oj-form-container____odYP","oj-left-panel":"oj-left-panel___emEB2","oj-form-info":"oj-form-info___m00Ag",footer:"footer___O4iSJ",collapse:"collapse___Ltfkj","test-case-name":"test-case-name___miZcb","btn-remove-case":"btn-remove-case___cHap2","icon-tag":"icon-tag___gmyTb",btn_back:"btn_back___tNmX3",testJi:"testJi___L3fHb",upBtn:"upBtn___RGH6X"}},45298:function(){}}]);