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

1 line
110 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([[14889,12768],{80882:function(e,n,t){t.d(n,{Z:function(){return c}});var r=t(87462),i=t(67294),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},a=t(43387),l=function(e,n){return i.createElement(a.Z,(0,r.Z)({},e,{ref:n,icon:s}))};var c=i.forwardRef(l)},28638:function(e,n,t){t.d(n,{Z:function(){return c}});var r=t(87462),i=t(67294),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"minus-square",theme:"outlined"},a=t(43387),l=function(e,n){return i.createElement(a.Z,(0,r.Z)({},e,{ref:n,icon:s}))};var c=i.forwardRef(l)},13982:function(e,n,t){t.d(n,{Z:function(){return c}});var r=t(87462),i=t(67294),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"plus-square",theme:"outlined"},a=t(43387),l=function(e,n){return i.createElement(a.Z,(0,r.Z)({},e,{ref:n,icon:s}))};var c=i.forwardRef(l)},48115:function(e,n,t){t.d(n,{Z:function(){return c}});var r=t(87462),i=t(67294),s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},a=t(43387),l=function(e,n){return i.createElement(a.Z,(0,r.Z)({},e,{ref:n,icon:s}))};var c=i.forwardRef(l)},96403:function(e,n,t){function r(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=[],r=0;r<e.length;r++){var i=e[r],s=n?"".concat(n,"/").concat(i.name):"".concat(i.name);t.push({title:i.name,isLeaf:"tree"!==i.type,key:s})}return t}function s(e,n,t){for(var r=0;r<e.length;r++){var i=e[r];if(i.key===n){i.children=t;break}i.children&&s(i.children,n,t)}return e}function a(e,n,t){var r;return function(){var i=this,s=arguments,a=function(){r=null,t||e.apply(i,s)},l=t&&!r;clearTimeout(r),r=setTimeout(a,n),l&&e.apply(i,s)}}t.d(n,{Ax:function(){return s},Ds:function(){return a},KI:function(){return l},SI:function(){return i},f1:function(){return r}});var l=t(59758).Z.API_SERVER},36579:function(e,n,t){t.d(n,{Z:function(){return w}});var r=t(42122),i=t.n(r),s=t(17061),a=t.n(s),l=t(17156),c=t.n(l),o=t(27424),u=t.n(o),d=t(67294),p={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},f=t(71577),v=t(77171),m=t(8691),h=t(83062),x=t(29427),_=t(51412),g=t(82982),j=t(59758),y=t(85893),w=function(e){var n,t,r,s,l,o,w,b=e.editOffice,k=void 0===b?"view":b,N=e.data,S=(e.theme,e.type),Z=e.filename,E=e.monacoEditor,q=e.className,I=e.style,C=e.close,T=e.onClose,P=e.hasMask,F=e.disabledDownload,R=e.onImgDimensions,B=e.showNodata,L=(0,d.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),O=u()(L,2),A=(O[0],O[1],(0,d.useState)("")),M=u()(A,2),H=(M[0],M[1]),V=(0,d.useState)(),D=u()(V,2),W=D[0],z=D[1],U="build"===window.ENV?"/react/build":"",Y=location.host.startsWith("localhost")?j.Z.PROXY_SERVER:j.Z.API_SERVER,$=(0,d.useRef)();null!==(n=N)&&void 0!==n&&n.startsWith("/api")&&"txt"!==S&&(N=j.Z.API_SERVER+N),Z&&(E.filename=Z),(0,d.useEffect)((function(){var e,n,t=null===(e=document.cookie)||void 0===e||null===(n=e.replace(/\s/g,""))||void 0===n?void 0:n.split(";");null==t||t.map((function(e){var n=e.split("=");"_educoder_session"===n[0]&&H(n[1])}))}),[]),(0,d.useEffect)((function(){"office"===S&&X()}),[S,N]);var X=function(){var e=c()(a()().mark((function e(){var n,t,r;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=N,N.startsWith("http")||(n=location.origin+n),t=new URL(n).pathname.split("/").pop(),e.next=5,(0,_.gJ)({attachment_id:t});case 5:r=e.sent,z(r);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),J=function(){K()},K=function(){(0,x.Nd)(Z||"educoder",decodeURIComponent(N))};return(0,y.jsxs)("div",{style:i()({},I||{}),className:"".concat(P&&p.bgBlack," ").concat(S?p.wrp:"hide"),children:[C&&(0,y.jsxs)("div",{className:p.close,ref:$,children:[!!R&&(0,y.jsx)(h.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return $.current},children:(0,y.jsx)("span",{onClick:function(){T(),R()},children:(0,y.jsx)("i",{className:"icon-yulanpizhu"})})}),!F&&(0,y.jsx)(h.Z,{title:"点击下载此文件",getPopupContainer:function(){return $.current},children:(0,y.jsx)("span",{onClick:K,children:(0,y.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,y.jsx)(h.Z,{title:"关闭",getPopupContainer:function(){return $.current},children:(0,y.jsx)("span",{className:"",onClick:T,children:(0,y.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,y.jsx)("div",{className:"".concat(p[q]," ").concat(q," ").concat(p.monaco," ").concat("txt"===S?"show":"hide"),children:"txt"===S&&(0,y.jsx)(m.ZP,i()({},E))}),"audio"===S&&(0,y.jsx)("audio",{src:(null===(t=N)||void 0===t?void 0:t.indexOf("http"))>-1||null!==(r=N)&&void 0!==r&&r.startsWith("/api")?N:"data:image/png;base64,".concat(N),autoPlay:!0}),"video"===S&&(0,y.jsx)(y.Fragment,{children:(null===(s=N)||void 0===s?void 0:s.indexOf("http"))>-1||null!==(l=N)&&void 0!==l&&l.startsWith("/api")?(0,y.jsx)("video",{controls:!0,src:"".concat(N),autoPlay:!0}):(0,y.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(N),autoPlay:!0})}),"office"===S&&W&&(0,y.jsx)("iframe",{src:"".concat(U,"/office.html?key=").concat(W.key,"&url=").concat(Y+W.url,"&callbackUrl=").concat(Y+W.callbackUrl,"&fileType=").concat(W.fileType,"&title=").concat(W.title,"&model=").concat(k,"&officeServer=").concat(j.Z.ONLYOFFICE,"&disabledDownload=").concat(!!F)}),"html"===S&&(0,y.jsx)("iframe",{src:N+"&disposition=inline"}),"pdf"===S&&(0,y.jsx)("iframe",{src:"".concat(U,"/js/pdfview/index.html?url=").concat(N,"&disabledDownload=").concat(!!F)}),"image"===S&&(0,y.jsx)("img",{src:(null===(o=N)||void 0===o?void 0:o.indexOf("http"))>-1||null!==(w=N)&&void 0!==w&&w.startsWith("/api")?N:"data:image/png;base64,".concat(N)}),("other"===S||"download"===S)&&(0,y.jsx)(y.Fragment,{children:B?(0,y.jsx)(g.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,y.jsx)(f.ZP,{icon:(0,y.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:J,children:"下载"})}):(0,y.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:J,children:[(0,y.jsx)(v.Z,{}),"点击下载"]})})]})}},88517:function(e,n,t){var r=t(42122),i=t.n(r),s=t(17061),a=t.n(s),l=t(17156),c=t.n(l),o=t(27424),u=t.n(o),d=t(88275),p=t(67294),f=t(2453),v=t(71577),m=t(14446),h=t(19575),x=t(84519),_=t(64241),g=t(92632),j=t(27484),y=t.n(j),w=t(85893);n.Z=function(e){var n=e.ButtonProps,t=e.ButtonText,r=e.form,s=e.answerKey,l=e.hackidentifier,o=void 0===l?"":l,j=e.items,b=void 0===j?{}:j,k=(0,p.useState)(!1),N=u()(k,2),S=N[0],Z=N[1],E=(0,p.useState)(""),q=u()(E,2),I=q[0],C=q[1],T=(0,d.useParams)(),P=(0,p.useState)({}),F=u()(P,2),R=F[0],B=F[1],L="edit"===T.type;window.location.href.includes("problemset");function O(e,n){return A.apply(this,arguments)}function A(){return(A=c()(a()().mark((function e(n,t){var i,l,c,o,u;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l=r.getFieldValue("hack_codes"),c=r.getFieldValue(s),l.code){e.next=5;break}return f.ZP.info("程序代码不能为空!"),e.abrupt("return");case 5:if(l.language){e.next=8;break}return f.ZP.info("编程语言不能为空!"),e.abrupt("return");case 8:if(!(c.length>0&&(null===(i=c.filter((function(e){return!e.answer_text})))||void 0===i?void 0:i.length)>0)){e.next=11;break}return f.ZP.info("填空项不能为空!"),e.abrupt("return");case 11:return o=l.code,c.length>0&&(null==c||c.map((function(e){o=e.multi_line?o.substring(0,o.indexOf("@▁▁@"))+e.answer_text+o.substring(o.indexOf("@▁▁@")+4):o.substring(0,o.indexOf("@▁@"))+e.answer_text+o.substring(o.indexOf("@▁@")+3)}))),e.next=15,(0,_.n4)(t,n||{code:h.Base64.encode(o),language:l.language});case 15:return u=e.sent,e.abrupt("return",u);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(e,n){return H.apply(this,arguments)}function H(){return(H=c()(a()().mark((function e(n,t){var r,i,s,l;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=b.userAnswer,s=h.Base64.decode(b.code),!(i.length>0&&(null===(r=i.filter((function(e){return!e.value})))||void 0===r?void 0:r.length)>0)){e.next=6;break}return f.ZP.info("填空项不能为空!"),e.abrupt("return");case 6:return i.length>0&&(null==i||i.map((function(e){s=e.multi_line?s.substring(0,s.indexOf("@▁▁@"))+e.value+s.substring(s.indexOf("@▁▁@")+4):s.substring(0,s.indexOf("@▁@"))+e.value+s.substring(s.indexOf("@▁@")+3)}))),e.next=9,(0,_.n4)(t,n||{code:h.Base64.encode(s),language:b.language});case 9:return l=e.sent,e.abrupt("return",l);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(){return(new Date).getTime()}return(0,p.useEffect)((function(){(L||o)&&C(o||T.id)}),[T]),(0,p.useEffect)((function(){return function(){sessionStorage.removeItem("projectFill")}}),[]),(0,w.jsxs)("div",{children:[(0,w.jsx)(v.ZP,i()(i()({loading:S},n),{},{onClick:c()(a()().mark((function e(){var n,s,l,o,u,d,p,v,g,j,y,w,b,k,N,E;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("运行调试"!==t){e.next=20;break}if(Z(!0),!S){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,(0,x.ZP)("/api/problems/".concat(I,"/start.json"),{method:"get"});case 6:return n=e.sent,e.next=9,M(null,null==n?void 0:n.identifier);case 9:if(0!==(null==(s=e.sent)?void 0:s.status)){e.next=18;break}return l=function(){var e=c()(a()().mark((function e(){var t,r,i,s,c;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,_.rX)(null==n?void 0:n.identifier,"submit");case 2:if(t=e.sent,r=t.status,t.message,i=t.data,s=V(),c=s-o>6e3,0===r||c||setTimeout(l,1e3),!c){e.next=13;break}return m.Z.error({centered:!0,okText:"知道啦",title:"调试代码超时"}),Z(!1),e.abrupt("return");case 13:0===r&&(Z(!1),B(i),2===i.status&&(Z(!1),m.Z.error({centered:!0,okText:"知道啦",title:"调试代码超时"})));case 14:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),o=V(),e.next=15,(0,_.bM)(null==n?void 0:n.identifier,{});case 15:l(),e.next=19;break;case 18:Z(!1);case 19:return e.abrupt("return");case 20:return u=!0,e.next=23,r.validateFields().then((function(){u=!1}),(function(e){var n,t,i;e.errorFields[0].name.includes("standard_answers")?f.ZP.error("填空项答案不能为空"):f.ZP.error(e.errorFields[0].errors[0]),0===(null===(n=e.errorFields)||void 0===n?void 0:n.length)&&(u=!1),r.scrollToField(null==e||null===(t=e.errorFields)||void 0===t||null===(i=t[0])||void 0===i?void 0:i.name,{behavior:"smooth",block:"center"}),u=!0}));case 23:if(!u){e.next=25;break}return e.abrupt("return");case 25:if(Z(!0),!S){e.next=28;break}return e.abrupt("return");case 28:if(d="",p=r.getFieldsValue(),I){e.next=39;break}return e.next=33,(0,x.ZP)("/api/problems.json",{method:"post",body:i()(i()({},p),{},{hack:i()(i()({},null==p?void 0:p.hack),{},{sub_discipline_id:null==p||null===(v=p.hack)||void 0===v||null===(g=v.sub_discipline_id)||void 0===g?void 0:g[1],difficult:p.difficulty,item_banks_group_id:p.item_banks_group_id}),hack_codes:i()(i()({},p.hack_codes),{},{code:h.Base64.encode(p.hack_codes.code)}),hack_sets:[i()({},p.hack_sets)],is_blank:!0})});case 33:d=e.sent,I=null===(j=d)||void 0===j?void 0:j.identifier,sessionStorage.projectFill=I,C(I),e.next=42;break;case 39:return e.next=41,(0,x.ZP)("/api/problems/".concat(I,".json"),{method:"put",body:i()(i()({},p),{},{hack:i()(i()({},null==p?void 0:p.hack),{},{sub_discipline_id:null==p||null===(y=p.hack)||void 0===y||null===(w=y.sub_discipline_id)||void 0===w?void 0:w[1],difficult:p.difficulty,item_banks_group_id:p.item_banks_group_id}),hack_codes:i()(i()({},p.hack_codes),{},{code:h.Base64.encode(p.hack_codes.code)}),update_hack_sets:[i()({},p.hack_sets)],is_blank:!0})});case 41:d=e.sent;case 42:return e.next=44,(0,x.ZP)("/api/problems/".concat(I,"/start.json"),{method:"get"});case 44:return b=e.sent,e.next=47,O(null,null==b?void 0:b.identifier);case 47:if(0!==(null==(k=e.sent)?void 0:k.status)){e.next=56;break}return N=function(){var e=c()(a()().mark((function e(){var n,t,r,i,s;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,_.rX)(null==b?void 0:b.identifier,"submit");case 2:if(n=e.sent,t=n.status,n.message,r=n.data,i=V(),s=i-E>1e3*(p.hack.time_limit+3),0===t||s||setTimeout(N,1e3),!s){e.next=13;break}return m.Z.error({centered:!0,okText:"知道啦",title:"调试代码超时"}),Z(!1),e.abrupt("return");case 13:0===t&&(Z(!1),B(r),2===r.status&&(Z(!1),m.Z.error({centered:!0,okText:"知道啦",title:"调试代码超时"})));case 14:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),E=V(),e.next=53,(0,_.bM)(null==b?void 0:b.identifier,{});case 53:N(),e.next=57;break;case 56:Z(!1);case 57:case"end":return e.stop()}}),e)}))),children:t})),(null==R?void 0:R.id)&&2!==R.status&&(0,w.jsx)(m.Z,{open:(null==R?void 0:R.id)&&2!==R.status,title:"运行结果",width:1100,footer:!1,onOk:function(){B({})},onCancel:function(){B({})},children:(0,w.jsxs)("div",{style:{maxHeight:600,overflow:"auto",marginBottom:15},children:[(0,w.jsxs)("div",{style:{marginBottom:20,display:"flex",justifyContent:"space-between",fontSize:14},children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("span",{style:{color:"#666666"},children:"状态"}),(0,w.jsx)("span",{style:{marginLeft:12,color:0!==R.status&&"#E30000"},children:g.Im[R.status]})]}),(0,w.jsxs)("div",{children:[(0,w.jsx)("span",{style:{color:"#666666"},children:"提交时间"}),(0,w.jsx)("span",{style:{marginLeft:12},children:y()(R.created_at).format("YYYY-MM-DD HH:mm:ss")})]}),(0,w.jsxs)("div",{children:[(0,w.jsx)("span",{style:{color:"#666666"},children:"语言"}),(0,w.jsx)("span",{style:{marginLeft:12},children:R.language})]}),(0,w.jsxs)("div",{children:[(0,w.jsx)("span",{style:{color:"#666666"},children:"执行用时"}),(0,w.jsxs)("span",{style:{marginLeft:12},children:[R.execute_time,"ms"]})]})]}),(0,w.jsx)(g.Y4,i()({},R))]})})]})}},12768:function(e,n,t){t.d(n,{Z:function(){return W}});var r=t(42122),i=t.n(r),s=t(861),a=t.n(s),l=t(74704),c=t.n(l),o=t(27424),u=t.n(o),d=t(67294),p=(t(81897),t(47084)),f=t.n(p),v=t(90621);var m=[],h=["<ul>"],x=new(f().Renderer),_=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function g(){m.length=0,h=["<ul>"]}var j={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function y(e,n,t,r){if(n>=e.length||e[n].level<=t)return n;var i=e[n];r.push("<li><a href='#"+i.anchor+"'>"+i.text+"</a>");var s=[];return n=y(e,++n,i.level,s),s.length>0&&(r.push("<ul>"),s.forEach((function(e){r.push(e)})),r.push("</ul>")),r.push("</li>"),n=y(e,n,t,r)}function w(){return y(m,0,0,h),h.push("</ul>"),h.join("")}var b={heading:function(e){var n=_.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],r=function(e,n){var t=e.match(/^(\s+)(?:```)/);if(null===t)return n;var r=t[1];return n.split("\n").map((function(e){var n=e.match(/^\s+/);return null===n?e:u()(n,1)[0].length>=r.length?e.slice(r.length):e})).join("\n")}(t,n[3]||""),i=n[2]?n[2].trim():n[2];if(["latex","katex","math"].indexOf(i)>=0){var s=S(),a=r;r=s,Z[s]={type:"block",expression:a}}return{type:"code",raw:t,lang:i,text:r}}}},k=/(?:\${2})([^\n`]+?)(?:\${2})/gi,N=0,S=function(){return"__special_katext_id_".concat(N++,"__")},Z={};function E(){return Z}function q(){N=0,Z={}}function I(e){return e=e.replace(k,(function(e,n){var t=S();return Z[t]={type:"inline",expression:n},t}))}var C=x.listitem;x.listitem=function(e){return C(I(e))};var T=x.paragraph;x.paragraph=function(e){return T(I(e))};var P=x.tablecell;x.tablecell=function(e,n){return P(I(e),n)},x.code=function(e,n,t){var r=(n||"").match(/\S*/)[0];return r?["latex","katex","math"].indexOf(r)>=0?"<p class='editormd-tex'>".concat(e,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(n,'">').concat(t?e:(0,v.escape)(e,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(t?e:(0,v.escape)(e,!0))+"</code></pre>"},x.heading=function(e,n,t){var r=this.options.headerPrefix+t.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return m.push({anchor:r,level:n,text:e}),"<h"+n+' id="'+r+'">'+e+"</h"+n+">"},f().setOptions({silent:!0,gfm:!0,pedantic:!1}),f().use({tokenizer:b,renderer:x});var F=f(),R=(t(11771),t(67631)),B=t.n(R),L=t(59758),O=t(20527),A=t(25934),M=t(36579),H=t(85893),V="@▁@",D=/<pre[^>]*>/g;var W=function(e){var n=e.value,t=void 0===n?"":n,r=e.className,s=e.showTextOnly,l=e.showLines,o=e.style,p=void 0===o?{}:o,f=e.stylesPrev,v=void 0===f?{}:f,m=e.highlightKeywords,h=e.showProgramFill,x=(e.isProgramFill,e.disabledFill),_=void 0!==x&&x,y=e.programFillValue,b=e.onFillChange,k=void 0===b?function(e){}:b,N=e.onFillBlur,S=void 0===N?function(){}:N,Z=String(t),I=(0,d.useState)(""),C=u()(I,2),T=C[0],P=C[1],R=(0,d.useState)("office"),W=u()(R,2),z=W[0],U=W[1],Y=(0,d.useState)([]),$=u()(Y,2),X=$[0],J=$[1],K=(0,d.useRef)("a"+(0,A.Z)()),G={},Q=function(e){return e.replace(/<style.*?>([\s\S]+?)<\/style>/gim,(function(e,n){var t=n.replace(/(\n|\r)/g,"").split("}"),r=[];return t.map((function(e){""!=e&&r.push(".".concat(K.current," ").concat(e))})),"<style>".concat(r.join("}"),"</style>")}))},ee=(0,d.useMemo)((function(){try{Z=Z.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+L.Z.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+L.Z.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+L.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(h){var e=-1;return Z=Z.replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(@▁▁@|@▁@)/g,(function(n,t,r){return function(e,n){var t=document.createElement(e===V?"input":"textarea");t.style.width="100%",t.style.height=e===V?"40px":"151px",t.rows=5,t.spellcheck=!1,t.name="edu-program-fill",t.placeholder="请输入",t.dataset.id=n;var r=Object.keys(G).length;return G[r]=t,'<span class="edu-program-fill-wrap '.concat(e===V?"":"show",'" style="width:').concat(e===V?"200px":"100%",'"><span>').concat(t.outerHTML,'<span class="edu-program-fill-score"></span></span></span>')}(n,++e)})),'<pre style="background:#fff;padding:4px">'.concat(Q(Z||""),"</pre>")}var n=F(Z);n=Q(n);var t=E();Z.match(/\[TOC\]/)&&(n=n.replace("<p>[TOC]</p>",w()),g()),n=n.replace(/(__special_katext_id_\d+__)/g,(function(e,n){var r=t[n],i=r.type,s=r.expression;return(0,O.renderToString)(function(e){var n=document.createElement("div");return n.innerHTML=e,0===n.childNodes.length?"":n.childNodes[0].nodeValue}(s)||"",{displayMode:"block"===i,throwOnError:!1,output:"html"})})),n=n.replace(/▁/g,"▁▁▁"),q();var r=document.createElement("div");return r.innerHTML=n,m?(re(r,m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),r.innerHTML):s?r.innerText:(setTimeout((function(){return ae()}),500),r.innerHTML)}),[Z,m]);(0,d.useEffect)((function(){ie.current&&ie.current.querySelectorAll(["input","textarea"]).forEach((function(e){e.oninput=ne,e.onblur=te}))}),[X]),(0,d.useEffect)((function(){if(null!=y&&y.length){var e,n=ie.current.querySelectorAll(".edu-program-fill-score"),t=ie.current.querySelectorAll('[name="edu-program-fill"]'),r=c()(t.entries());try{for(r.s();!(e=r.n()).done;){var i,s=u()(e.value,2),a=s[0],l=s[1];l.value=null===(i=y[a])||void 0===i?void 0:i.value,"warning"===y[a].type?l.className="program-fill-warning":"success"===y[a].type?l.className="program-fill-success":l.className=""}}catch(e){r.e(e)}finally{r.f()}var o,d=c()(n.entries());try{for(d.s();!(o=d.n()).done;){var p,f,v=u()(o.value,2),m=v[0];v[1].innerHTML=null!==(p=y[m])&&void 0!==p&&p.score?"".concat(null===(f=y[m])||void 0===f?void 0:f.score,"分"):""}}catch(e){d.e(e)}finally{d.f()}J(y)}}),[y]);var ne=function(e){X[e.target.dataset.id]=X[e.target.dataset.id]||{},X[e.target.dataset.id].value=e.target.value,J(a()(X)),k(X,e.target.dataset.id)},te=function(e){X[e.target.dataset.id]=X[e.target.dataset.id]||{},X[e.target.dataset.id].value=e.target.value,J(a()(X)),S(X,e.target.dataset.id)};function re(e,n){return e.childNodes.forEach((function(e){if(e.childNodes.length>0)re(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 r=document.createElement("span");r.innerHTML=e.textContent.replace(new RegExp(n,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),e.replaceWith(r)}}))}var ie=(0,d.useRef)();function se(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 r=document.getElementById(t.replace("#",""));r&&r.scrollIntoView(!0)}}}j.WebkitLineClamp=l,l&&(p=i()(i()({},p),j));var ae=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(B().isSupported()){var n=new(B());n.loadSource(e.src),n.attachMedia(e)}}))};return(0,d.useEffect)((function(){if(ie.current&&ee&&ee.match(D)&&window.PR.prettyPrint(),ie.current)return ie.current.addEventListener("click",se),function(){var e;null===(e=ie.current)||void 0===e||e.removeEventListener("click",se),q(),g()}}),[ee,ie.current,se]),(0,H.jsxs)(H.Fragment,{children:[s&&(0,H.jsx)("div",{ref:ie,children:ee}),!s&&(0,H.jsx)("div",{ref:ie,style:i()({},p),className:"".concat(r||""," ").concat(_?"disabled-fill":""," markdown-body ").concat(K.current),dangerouslySetInnerHTML:{__html:ee}}),(0,H.jsx)(M.Z,{close:!0,data:T,type:null!=T&&T.length?z:"",style:i()({},v),onClose:function(){return P("")}})]})}},97501:function(e,n,t){t.d(n,{h:function(){return x}});var r=t(42122),i=t.n(r),s=t(27424),a=t.n(s),l=t(67294),c=t(96101),o=t(91773),u=t(71577),d=t(4631),p=t.n(d),f=(t(71749),t(30483),t(85893)),v=c.Z.Option,m={labelCol:{span:4},wrapperCol:{span:20}},h={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 x(e){var n=e.value,t=e.onChange,r=e.mode,s=e.options,c=void 0===s?{}:s,o=(0,l.useRef)(),u=(0,l.useState)(),d=a()(u,2),v=d[0],m=d[1];return(0,l.useEffect)((function(){if(v){var e=function(e){var n=e.getValue();t&&t(n)};return v.on("change",e),function(){v.off("change",e)}}}),[v,t]),(0,l.useEffect)((function(){v&&v.setOption("mode",r)}),[v,r]),(0,l.useEffect)((function(){v&&(n===v.getValue()&&""!==n||setTimeout((function(){v.setValue(n||"")}),300))}),[v,n]),(0,l.useEffect)((function(){if(o.current&&!v){var e=p().fromTextArea(o.current,i()({mode:r,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));m(e)}}),[o.current,v]),(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,r=(0,l.useState)("python"),s=a()(r,2),d=s[0],p=s[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)(c.Z,{getPopupContainer:function(e){return e.parentNode},onChange:function(e){p(h[e][1])},children:Object.keys(h).map((function(e){return(0,f.jsx)(v,{value:e,children:h[e][0]},e)}))})}),(0,f.jsx)(o.Z.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}],children:(0,f.jsx)(x,{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:"取消"})]})]}))}},55373:function(e,n,t){t.d(n,{Z:function(){return ue}});var r=t(74704),i=t.n(r),s=t(17061),a=t.n(s),l=t(17156),c=t.n(l),o=t(27424),u=t.n(o),d=t(38416),p=t.n(d),f=t(67294),v=t(4631),m=t.n(v),h=t(91033),x=(t(71749),t(57341),t(82801),t(88386),t(49047),t(80785),t(12768)),_=t(85893),g=function(e){var n=e.value,t=void 0===n?"":n,r=(e.className,e.showTextOnly,e.showLines,e.style,(0,f.useMemo)((function(){return""}),[t]));return(0,_.jsx)(_.Fragment,{children:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:r}})})},j=t(42122),y=t.n(j),w=[{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 b(e){var n=e.onActionCallback,t=e.title,r=e.icon,i=e.actionName,s=e.className,a=void 0===s?"":s,l=e.children;return(0,_.jsxs)("a",{title:t,className:a,onClick:function(){n(i)},children:[(0,_.jsx)("i",{className:"md-iconfont ".concat(r)}),l]})}var k=function(e){var n=e.watch,t=e.showNullButton,r=e.showNullProgramButton,i=e.onActionCallback,s=e.fullScreen,a=e.insertTemp,l=e.hidetoolBar,c=[].concat(w,[{title:"".concat(n?"关闭实时预览":"开启实时预览"),icon:"".concat(n?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return(0,_.jsxs)("ul",{className:"markdown-toolbar-container",children:[!l&&c.map((function(e,n){return(0,_.jsx)("li",{children:e.actionName?(0,_.jsx)(b,y()(y()({},e),{},{onActionCallback:i})):(0,_.jsx)("span",{className:"v-line"})},n)})),t?(0,_.jsx)("li",{children:(0,_.jsx)(b,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-null-ch",onActionCallback:i,children:(0,_.jsx)("span",{className:"fill-tip",children:"点击插入\b填空项"})})}):null,r?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("li",{children:(0,_.jsx)(b,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-signal",onActionCallback:i,children:(0,_.jsx)("span",{className:"fill-tip",children:"添加单行填空项"})})}),(0,_.jsx)("li",{children:(0,_.jsx)(b,{icon:"icon-uniE900 insert-blank",className:"btn-null",title:"增加填空",actionName:"add-multiple",onActionCallback:i,children:(0,_.jsx)("span",{className:"fill-tip",children:"添加多行填空项"})})})]}):null,a&&(0,_.jsx)("li",{children:(0,_.jsx)(b,{icon:"icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(a),onActionCallback:i,children:(0,_.jsx)("span",{className:"fill-tip",children:"插入模板"})})}),(0,_.jsx)("li",{className:"btn-full-screen",children:(0,_.jsx)(b,{icon:"".concat(s?"icon-shrink":"icon-enlarge"),title:s?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:i})})]})},N=t(12264),S=t(91773),Z=t(11486),E=t(71577),q={labelCol:{span:4},wrapperCol:{span:20}},I=function(e){var n=e.callback,t=e.onCancel;return(0,_.jsxs)(S.Z,y()(y()({},q),{},{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(e){n(e)},children:[(0,_.jsx)(S.Z.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}],children:(0,_.jsx)(Z.Z,{})}),(0,_.jsx)(S.Z.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}],children:(0,_.jsx)(Z.Z,{})}),(0,_.jsxs)("div",{className:"flex-container flex-end",children:[(0,_.jsx)(E.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,_.jsx)(E.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))},C=t(97501),T=t(2453),P=t(96403),F=S.Z.useForm,R={width:280,marginRight:10},B={labelCol:{span:5},wrapperCol:{span:19}},L=function(e){var n=e.callback,t=e.onCancel,r=F(),i=u()(r,1)[0],s=(0,f.useRef)();function a(e,n){-1!==e.status?i.setFieldsValue({src:"/api/attachments/".concat(e.id),type:n.type}):T.ZP.error(e.message)}return(0,_.jsxs)(S.Z,y()(y()({form:i},B),{},{className:"upload-image-panel",onFinish:function(e){n(y()(y()({},e),{},{name:s.current}))},style:{width:470,overflow:"hidden"},children:[(0,_.jsx)(S.Z.Item,{label:"图片地址",required:!0,children:(0,_.jsxs)("div",{className:"flex-container",children:[(0,_.jsx)(S.Z.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入文件地址"}],children:(0,_.jsx)(Z.Z,{style:R})}),(0,_.jsx)(O,{onFileChange:function(e){var n=e.target.files[0];s.current=n.name,A(n,a)}})]})}),(0,_.jsx)(S.Z.Item,{label:"图片描述",name:"alt",children:(0,_.jsx)(Z.Z,{style:{width:264}})}),(0,_.jsxs)(S.Z.Item,{style:{textAlign:"right"},children:[(0,_.jsx)(E.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,_.jsx)(E.ZP,{type:"default",onClick:t,children:"取消"})]})]}))};function O(e){var n=e.onFileChange;return(0,_.jsxs)("label",{className:"upload-button",style:{cursor:"pointer"},children:["本地上传",(0,_.jsx)("input",{type:"file",onChange:n})]})}function A(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 r=new window.XMLHttpRequest;r.withCredentials=!0,r.addEventListener("load",(function(t){n(JSON.parse(t.target.responseText),e)}),!1),r.addEventListener("error",(function(e){console.error(e)}),!1),r.open("POST","".concat(P.KI,"/api/attachments.json")),r.send(t)}var M,H,V=t(78045),D=t(4082),W=V.ZP.Group,z={margin:"0 8px"},U=function(e){var n=e.callback,t=e.onCancel;return(0,_.jsxs)(S.Z,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){n(e)},children:[(0,_.jsxs)("div",{className:"flex-container",style:{alignItems:"baseline"},children:[(0,_.jsx)("span",{style:z,children:"单元格数:"}),(0,_.jsx)("span",{style:z,children:"行数"}),(0,_.jsx)(S.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,_.jsx)(D.Z,{})}),(0,_.jsx)("span",{style:z,children:"列数"}),(0,_.jsx)(S.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,_.jsx)(D.Z,{})})]}),(0,_.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,_.jsx)("span",{style:z,children:"对齐方式:"}),(0,_.jsx)(S.Z.Item,{name:"align",children:(0,_.jsxs)(W,{children:[(0,_.jsx)(V.ZP,{value:"default",children:(0,_.jsx)("i",{className:"fa fa-align-justify"})}),(0,_.jsx)(V.ZP,{value:"left",children:(0,_.jsx)("i",{className:"fa fa-align-left"})}),(0,_.jsx)(V.ZP,{value:"center",children:(0,_.jsx)("i",{className:"fa fa-align-center"})}),(0,_.jsx)(V.ZP,{value:"right",children:(0,_.jsx)("i",{className:"fa fa-align-right"})})]})})]}),(0,_.jsxs)("div",{className:"flex-container flex-end",children:[(0,_.jsx)(E.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,_.jsx)(E.ZP,{type:"ghost",onClick:t,children:"取消"})]})]})},Y=t(59758),$=t(84519),X=t(25934),J=t(14446),K="link",G="upload-image",Q="code-block",ee="add-table",ne="------------",te={default:ne,left:":".concat(ne),center:":".concat(ne,":"),right:"".concat(ne,":")},re=t(61891);var ie="@▁▁@";function se(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var ae=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",le=["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=(M={},p()(M,ae+"-B","bold"),p()(M,ae+"-I","italic"),M),oe=(H={},p()(H,K,"添加链接"),p()(H,Q,"添加代码块"),p()(H,G,"添加文件"),p()(H,ee,"添加表格"),H),ue=function(e){var n=e.defaultValue,t=void 0===n?"":n,r=e.onChange,s=e.width,l=void 0===s?"100%":s,o=e.height,d=void 0===o?400:o,v=e.miniToolbar,j=void 0!==v&&v,y=e.isFocus,w=void 0!==y&&y,b=e.watch,S=e.insertTemp,Z=e.mode,E=void 0===Z?"markdown":Z,q=e.id,P=void 0===q?"markdown-editor-id":q,F=e.showResizeBar,R=void 0!==F&&F,B=e.noStorage,O=void 0!==B&&B,M=e.showNullButton,H=void 0!==M&&M,V=e.showNullProgramButton,D=void 0!==V&&V,W=e.hidetoolBar,z=void 0!==W&&W,ne=e.fullScreen,ae=void 0!==ne&&ne,ue=e.onBlur,de=e.onCMBeforeChange,pe=e.onFullScreen,fe=e.className,ve=void 0===fe?"":fe,me=e.disablePaste,he=void 0!==me&&me,xe=e.disabled,_e=void 0!==xe&&xe,ge=e.disabledFill,je=void 0!==ge&&ge,ye=e.placeholder,we=void 0===ye?"":ye,be=e.values,ke=void 0===be?"":be,Ne=(0,f.useState)(null),Se=u()(Ne,2),Ze=Se[0],Ee=Se[1],qe=(0,f.useState)(t),Ie=u()(qe,2),Ce=Ie[0],Te=Ie[1],Pe=(0,f.useState)(b),Fe=u()(Pe,2),Re=Fe[0],Be=Fe[1],Le=(0,f.useState)(ae),Oe=u()(Le,2),Ae=Oe[0],Me=Oe[1],He=(0,f.useState)(""),Ve=u()(He,2),De=Ve[0],We=Ve[1],ze=(0,f.useState)(0),Ue=u()(ze,2),Ye=Ue[0],$e=Ue[1],Xe=(0,f.useState)(d),Je=u()(Xe,2),Ke=Je[0],Ge=Je[1],Qe=(0,f.useState)(!1),en=u()(Qe,2),nn=(en[0],en[1]),tn=(0,f.useRef)((0,X.Z)()),rn=(0,f.useRef)(!1),sn=(0,f.useRef)(),an=(0,f.useRef)(),ln=(0,f.useRef)(),cn=(0,f.useRef)(),on=(0,f.useRef)(),un=function(){var e=c()(a()().mark((function e(){var n,t;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,$.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:",Ze,an),t.attachments.map((function(e){e.content_type.indexOf("image")>-1?Ze.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):e.content_type.indexOf("video")>-1?Ze.replaceSelection('<video width="100%" controls src="'.concat(Y.Z.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):e.content_type.indexOf("pdf")>-1?Ze.replaceSelection('<a href="'.concat(Y.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):Ze.replaceSelection("[".concat(e.name,"](").concat(Y.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;Te(ke),null==Ze||Ze.setValue(ke),window.scrollTo(0,e)}),[ke]),(0,f.useEffect)((function(){null==pe||pe(Ae)}),[Ae]),(0,f.useEffect)((function(){if(an.current){var e=function(e,t){if(!he){var r=t.clipboardData;if(r){var i=r.types.toString(),s=r.items;if("Files"===i||r.types.indexOf("Files")>-1){if(t.preventDefault(),"stex"==E)return;try{var a,l=s[1];"file"===(null===(a=s[0])||void 0===a?void 0:a.kind)&&(l=s[0]);var c=l.getAsFile(),o=c.name.split(".").pop();A(c,(function(e){var t,r,i;e.id?(null==c||null===(t=c.type)||void 0===t?void 0:t.indexOf("image"))>-1?n.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):(null==c||null===(r=c.type)||void 0===r?void 0:r.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(Y.Z.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==c||null===(i=c.type)||void 0===i?void 0:i.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(Y.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(c.type,'&disposition=inline" target="_blank">').concat(c.name,"</a>")):le.includes(o)?n.replaceSelection('<a href="'.concat(Y.Z.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(c.name,"</a>")):n.replaceSelection("[".concat(c.name,"](").concat(Y.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){T.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}t.preventDefault()},n=m().fromTextArea(an.current,{mode:E,lineNumbers:!j,lineWrapping:!0,value:t,autoCloseTags:!D,autoCloseBrackets:!0});return n.on("keyup",(function(e,t){8===t.keyCode&&(""==e.getValue()?n.setOption("placeholder",we):n.setOption("placeholder",null))})),n.on("keydown",(function(e,n){if(8===n.keyCode){var t=function(e,n){var t=e.getDoc(),r=t.getCursor(),i=t.getLine(r.line),s=i.charAt(r.ch-1),a=i.lastIndexOf("@▁@",r.ch),l=i.lastIndexOf("@▁▁@",r.ch),c=a>l?a:l,o=a>l?3:4;if(-1===ie.indexOf(s))return null;if(console.log("change1:",n,e,i,r,c,a,l,s),c>=0&&r.ch-c<5){var u=c+o;return t.replaceRange("",{line:r.line,ch:c},{line:r.line,ch:u}),{line:r.line,ch:u}}return null}(e);t&&n.preventDefault()}})),w&&n.focus(),n.on("paste",e),n.on("dragleave",(function(e,n){ln.current.classList.remove("mouse-hover-md")})),n.on("dragover",(function(e,n){ln.current.classList.add("mouse-hover-md")})),n.on("drop",(function(e,t){var r;if(ln.current.classList.add("mouse-hover-md"),(r=t.dataTransfer.files).length>0){t.preventDefault(),t.stopPropagation();for(var i=function(){var e=r[s],t=e.name.split(".").pop();A(e,(function(r){var i,s,a;r.id?(null==e||null===(i=e.type)||void 0===i?void 0:i.indexOf("image"))>-1?n.replaceSelection("![,](/api/attachments/".concat(r.id,"?type=").concat(r.content_type,")")):(null==e||null===(s=e.type)||void 0===s?void 0:s.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(Y.Z.API_SERVER,"/api/attachments/").concat(r.id,'"></video>')):(null==e||null===(a=e.type)||void 0===a?void 0:a.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(Y.Z.API_SERVER,"/api/attachments/").concat(r.id,"?type=").concat(e.type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):le.includes(t)?n.replaceSelection('<a href="'.concat(Y.Z.API_SERVER,"/api/attachments/").concat(r.id,'?type=office&disposition=inline" target="_blank">').concat(e.name,"</a>")):n.replaceSelection("[".concat(e.name,"](").concat(Y.Z.API_SERVER,"/api/attachments/").concat(r.id,"?type=").concat(r.content_type,")")):401===(null==r?void 0:r.status)&&(document.location.href="/user/login")}))},s=0;s<r.length;s++)i()}})),_e&&n.on("beforeChange",(function(e,n){"paste"!==n.origin&&"+input"!==n.origin||n.cancel()})),Ee(n),function(){n.off("paste",e)}}}),[]);var dn=(0,f.useCallback)((function(){ln.current}),[Ke,ln,Ae]);(0,f.useEffect)((function(){if(Ze){var e=function(){var e=new h.Z((function(e){var n,t=i()(e);try{for(t.s();!(n=t.n()).done;){var r=n.value;(r.target.offsetHeight>0||r.target.offsetWidth>0)&&(dn(),Ze.setSize("100%","100%"),Ze.refresh())}}catch(e){t.e(e)}finally{t.f()}}));return e.observe(an.current.parentElement),e}();return function(){var n,t;null!==(n=an.current)&&void 0!==n&&n.parentElement&&e.unobserve(null===(t=an.current)||void 0===t?void 0:t.parentElement)}}}),[Ze,dn]),(0,f.useEffect)((function(){if(Ze){for(var e=[],n=function(){var n=u()(r[t],2),i=n[0],s=n[1],a=p()({},i,(function(){pn(s)}));e.push(a),Ze.addKeyMap(a)},t=0,r=Object.entries(ce);t<r.length;t++)n();return sn.current=setInterval((function(){rn.current&&un()}),4e3),function(){clearInterval(sn.current);for(var n=0,t=e;n<t.length;n++){var r=t[n];Ze.removeKeyMap(r)}}}}),[Ze]),(0,f.useEffect)((function(){ae!==Ae&&Me(ae)}),[ae]),(0,re.Z)((function(){if(!O&&Ye>0){var e=(new Date).getTime(),n=window.sessionStorage.getItem(P);e>=Ye+1e4&&(!n||n!==Ce)&&(window.sessionStorage.setItem(P,Ce),nn(!0))}}),1e4),(0,f.useEffect)((function(){Be(b)}),[Ze,b]),(0,f.useEffect)((function(){Ze&&w&&Ze.focus()}),[Ze,w]),(0,f.useEffect)((function(){if(Re&&Ze){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=Ze.getScrollerElement();return n.addEventListener("scroll",e),function(){n.removeEventListener("scroll",e)}}}),[Ze,Re]),(0,f.useEffect)((function(){if(Ze&&de){var e=function(e,n){de(e,n)};return Ze.on("beforeChange",e),function(){Ze.off("beforeChange",e)}}}),[Ze,de]),(0,f.useEffect)((function(){if(Ze&&ue){var e=function(){ue(Ze.getValue())};return Ze.on("blur",e),function(){Ze.off("blur",e)}}}),[Ze,ue]),(0,f.useEffect)((function(){if(Ze){var e=function(e,n){var t=e.getValue();Te(t),$e((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),r&&(D?r(t,xn(t)):r(t))};return Ze.on("change",e),function(){Ze.off("change",e)}}}),[Ze,r]),(0,f.useEffect)((function(){if(Ze)if(null==t)Ze.setValue(""),Te("");else{var e=window.scrollY||window.pageYOffset;t!==Ze.getValue()&&(Ze.setValue(t),Te(t),Ze.setCursor(_e?1:Ze.lineCount(),0),window.scrollTo(0,e))}}),[Ze,t]);var pn=(0,f.useCallback)((function(e){var n=Ze.getCursor(),t=Ze.getSelection(),r=t.split("\n");switch(e){case"bold":return Ze.replaceSelection("**"+t+"**"),""===t&&Ze.setCursor(n.line,n.ch+2),Ze.focus();case"italic":return Ze.replaceSelection("*"+t+"*"),""===t&&Ze.setCursor(n.line,n.ch+1),Ze.focus();case"code":return Ze.replaceSelection("`"+t+"`"),""===t&&Ze.setCursor(n.line,n.ch+1),Ze.focus();case"inline-latex":return Ze.replaceSelection("`$$"+t+"$$`"),""===t&&Ze.setCursor(n.line,n.ch+3),Ze.focus();case"latex":return Ze.replaceSelection("```latex\n"+t+"\n```"),Ze.setCursor(n.line+1,t.length+1),Ze.focus();case"line-break":return Ze.replaceSelection("<br/>\n"),Ze.focus();case"list-ul":return""===t?Ze.replaceSelection("- "+t):Ze.replaceSelection(r.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),Ze.focus();case"list-ol":return""===t?Ze.replaceSelection("1. "+t):Ze.replaceSelection(r.map((function(e,n){return""===e?"":"".concat(n+1,". ").concat(e)})).join("\n")),Ze.focus();case"add-null-ch":return""===t&&Ze.setCursor(n.line,n.ch),Ze.replaceSelection("▁"),Ze.focus();case"add-signal":return""===t&&Ze.setCursor(n.line,n.ch),Ze.replaceSelection("@▁@"),Ze.focus();case"add-multiple":return""===t&&Ze.setCursor(n.line,n.ch),Ze.replaceSelection(ie),Ze.focus();case"inster-template-1":return""===t&&Ze.setCursor(n.line,n.ch),Ze.replaceSelection("\n**模板标题**\n模板正文内容可输入文本内容和粘贴图片等操作"),Ze.focus();case"eraser":return Ze.setValue(""),Ze.focus();case"trigger-watch":return Be(!Re),Ze.focus();case"trigger-full-screen":return Me(!Ae),Ze.focus();case K:return void We(K);case Q:return void We(Q);case G:return void We(G);case ee:return void We(ee);default:throw new Error}}),[Ze,Re,Ae]),fn=(0,f.useCallback)((function(e){switch(We(""),De){case K:var n=e.title,t=e.link;return Ze.replaceSelection("[".concat(n,"](").concat(t,")")),Ze.focus();case Q:var r=e.language,i=e.content;return Ze.replaceSelection(["```"+r,i,"```"].join("\n")),Ze.focus();case G:var s=e.src,a=e.alt;return a?Ze.replaceSelection("![ ".concat(a," ]( ").concat(s,' "').concat(a,'" )')):Ze.replaceSelection("![,](".concat(s,")")),Ze.focus();case ee:for(var l=e.row,c=e.col,o=e.align,u="\n",d=0;d<l;d++){for(var p=[],f=[],v=0;v<c;v++)1===d&&f.push(te[o]),p.push(" ");1===d&&(u+="| ".concat(f.join(" | ")," |\n")),u+="| ".concat(p.join(1===c?"":" | ")," |\n")}return Ze.replaceSelection(u+"\n"),Ze.focus();default:throw new Error}}),[Ze,De]),vn=(0,f.useMemo)((function(){switch(De){case K:return(0,_.jsx)(I,{callback:fn,onCancel:mn});case Q:return(0,_.jsx)(C.Z,{callback:fn,onCancel:mn});case G:return(0,_.jsx)(L,{callback:fn,onCancel:mn});case ee:return(0,_.jsx)(U,{callback:fn,onCancel:mn});default:return null}}),[De]);function mn(){We("")}(0,f.useEffect)((function(){if(cn.current){var e=function(e){i=!0,s=e.pageY},n=function(){i=!1},t=function(e){if(i){var n=e.pageY-s;n<0&&(n=0),n>300&&(n=300),Ge(d+n+"px")}},r=cn.current,i=!1,s=0;return r.addEventListener("mousedown",e),document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),function(){r.removeEventListener("mousedown",e),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}}}),[Ze,cn]),(0,f.useEffect)((function(){Ge(d)}),[d]);var hn={width:se(l),height:se(Ke)},xn=((0,f.useMemo)((function(){if(Ye){var e=new Date(Ye),n=e.getHours(),t=e.getMinutes(),r=e.getSeconds();return t=t<10?"0"+t:t,r=r<10?"0"+r:r,"".concat(n=n<10?"0"+n:n,":").concat(t,":").concat(r)}return 0}),[Ye]),function(e){var n=[];if(D){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,t,r){n.push({multiLine:!("@▁@"===e)})}))}return n});return(0,_.jsxs)(f.Fragment,{children:[(0,_.jsx)("div",{className:"markdown-editor-wrapper",ref:ln,children:(0,_.jsxs)("div",{className:"markdown-editor-container ".concat(ve," ").concat(Re?"on-preview":""," ").concat(j?"mini":""," ").concat(Ae?"full-screen":""),style:hn,children:[(0,_.jsx)(k,{insertTemp:S,watch:Re,fullScreen:Ae,showNullButton:H,showNullProgramButton:D,onActionCallback:pn,hidetoolBar:z,uuid:tn.current,setOpenPhones:function(){rn.current=!0}}),(0,_.jsxs)("div",{className:"markdown-editor-body",children:[(0,_.jsx)("div",{className:"codemirror-container",children:(0,_.jsx)("textarea",{ref:an,placeholder:we})}),Re?(0,_.jsxs)("div",{ref:on,className:"preview-container",children:["stex"===E&&(0,_.jsx)(g,{value:Ce}),"stex"!==E&&(0,_.jsx)(x.Z,{disabledFill:je,showProgramFill:D,value:Ce})]}):null]})]})}),R?(0,_.jsx)("a",{ref:cn,className:"editor-resize"}):null,(0,_.jsx)(N.Z,{children:oe[De]?(0,_.jsx)(J.Z,{centered:!0,title:oe[De],open:!0,onCancel:mn,footer:null,className:"markdown-popup-form",children:vn}):null})]})}},74559:function(e,n,t){t.r(n),t.d(n,{default:function(){return oe}});var r=t(17061),i=t.n(r),s=t(42122),a=t.n(s),l=t(17156),c=t.n(l),o=t(27424),u=t.n(o),d=t(67294),p=t(88275),f=t(55054),v=t(11486),m=t(14446),h=t(2453),x=t(38703),_=t(78045),g=t(84567),j=t(71230),y=t(15746),w=t(83062),b=t(71577),k=t(57953),N=t(28638),S=t(13982),Z=t(78806),E=t(27484),q=t.n(E),I={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"},C=t(29427),T=t(7),P=t(15994),F=t(51412),R=t(56088),B=t(12768),L=t(55373),O=t(85893),A=function(e){var n,t,r,i,s,a=e.item,l=e.answerData,c=e.onBlur,o=void 0===c?function(){}:c,p=(0,d.useState)(),f=u()(p,2),m=f[0],h=f[1],x=(0,d.useState)(),_=u()(x,2),g=(_[0],_[1]),j=(0,d.useState)(),y=u()(j,2),w=y[0],b=y[1];return(0,d.useEffect)((function(){g(null==a?void 0:a.a_flag)}),[null==a?void 0:a.a_flag]),(0,O.jsxs)("div",{children:[1===(null==l||null===(n=l.exercise)||void 0===n?void 0:n.commit_status)?(0,O.jsxs)("div",{children:[(0,O.jsx)("p",{className:"mt10 mb0",children:"我的答案:"}),(0,O.jsx)("div",{className:I.simpleText,children:(0,O.jsx)(B.Z,{value:null==a||null===(t=a.user_answer)||void 0===t?void 0:t[0]})})]}):(0,O.jsx)("div",{className:a.user_score&&(a.user_score===a.question_score?"c-green":"c-red"),children:w?(0,O.jsx)(L.Z,{height:450,isFocus:!0,defaultValue:null==a||null===(r=a.user_answer)||void 0===r?void 0:r[0],id:null==a?void 0:a.question_id,onChange:function(e){return h(e)},onBlur:function(){return o(m)}}):(0,O.jsx)("div",{onClick:function(){var e;!a.repeat_answer&&(null==a||null===(e=a.user_answer)||void 0===e?void 0:e.length)>0||b(!0)},children:(0,O.jsx)(v.Z,{disabled:!a.repeat_answer&&(null==a||null===(i=a.user_answer)||void 0===i?void 0:i.length)>0&&!a.israp,size:"middle",className:"current",placeholder:"点击开始作答",readOnly:!0})})}),(null==a?void 0:a.standard_answer)&&(0,O.jsxs)("div",{children:[(0,O.jsx)("p",{className:"mt10 mb0",children:"参考答案:"}),(0,O.jsx)("div",{style:{border:"1px solid #eee",background:"#f5f5f5",borderRadius:4,padding:5},children:(0,O.jsx)(B.Z,{value:null==a||null===(s=a.standard_answer)||void 0===s?void 0:s[0]})})]})]})},M=t(36569),H=t(76661),V=t(8691),D={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"},W=function(e){var n,t,r,i,s=e.item,l=e.answerData,c=(0,d.useState)([]),o=u()(c,2),f=o[0],v=o[1],m=(0,d.useState)([]),h=u()(m,2),x=h[0],_=h[1];(0,d.useEffect)((function(){var e;if(null!=s&&null!==(e=s.shixun_details)&&void 0!==e&&e.length){for(var n=[],t=[],r=0;r<(null==s||null===(i=s.shixun_details)||void 0===i?void 0:i.length);r++){for(var i,l,c,o,u,d,p=0;p<(null==s?void 0:s.shixun_details[r].stage_list.length);p++){var f,m,h,x,g=null==s?void 0:s.shixun_details[r].stage_list[p];n.push(a()(a()({},g),{operation:null==s||null===(f=s.shixun_details)||void 0===f||null===(m=f[r])||void 0===m||null===(h=m.shixun_detail)||void 0===h||null===(x=h[0])||void 0===x?void 0:x.game_identifier}))}if(null!=s&&null!==(l=s.shixun_details)&&void 0!==l&&null!==(c=l[r])&&void 0!==c&&c.shixun_detail)t.push(null==s||null===(o=s.shixun_details)||void 0===o||null===(u=o[r])||void 0===u||null===(d=u.shixun_detail)||void 0===d?void 0:d[0])}_(t),v(n)}}),[null==s?void 0:s.shixun_details]);var g=[{title:"关卡",dataIndex:"position",key:"position",align:"center"},{title:"任务名称",dataIndex:"name",key:"name",align:"center",render:function(e){return(0,O.jsx)("span",{className:"overflowHidden1",style:{maxWidth:"400px"},title:e&&e.length>25?e:"",children:e})}},{title:"评测次数",dataIndex:"evaluate_count",key:"evaluate_count",align:"center",render:function(e,n){return(0,O.jsx)("span",{children:n.evaluate_count?n.evaluate_count:(0,O.jsx)("span",{className:"color-grey-9",children:"--"})})}},{title:"完成时间",key:"endTime",dataIndex:"endTime",align:"center",render:function(e,n){var t=!1;return n.finished_time&&null!=l&&l.exercise&&null!=l&&l.exercise_answer_user&&(t=-1===(null==l?void 0:l.exercise.time)?q()(null==l?void 0:l.exercise.end_time).isBefore(n.finished_time):q()(null==l?void 0:l.exercise_answer_user.start_at).add(null==l?void 0:l.exercise.time,"m").isBefore(n.finished_time)),(0,O.jsxs)("span",{children:[n.finished_time||(0,O.jsx)("span",{className:"c-grey-999",children:"--"}),(0,O.jsx)("span",{className:"c-orange-ff9 ",children:t?"(已超时)":""})]})}},{title:"耗时",dataIndex:"time_consuming",key:"time_consuming",align:"center",render:function(e,n){return(0,O.jsx)("span",{children:n.time_consuming||(0,O.jsx)("span",{className:"color-grey-9",children:"--"})})}},{title:"查看答案",dataIndex:"view_answer",key:"view_answer",align:"center",render:function(e,n){return(0,O.jsx)("span",{children:n.view_answer?"已查看":"未查看"})}},{title:"操作",dataIndex:"operation",key:"operation",align:"center",render:function(e,n,t){return s.is_jupyter_lab||s.is_jupyter?(0,O.jsx)("span",{className:"c-grey-999",children:"--"}):e?(0,O.jsx)(M.Z,{affix:!1,className:"mt10",children:(0,O.jsx)(M.Z.Link,{href:"#challenge_".concat(null==s?void 0:s.question_id).concat(t),title:(0,O.jsx)("span",{style:{color:"#0152d9"},children:"查看"})})}):(0,O.jsx)("span",{className:"c-grey-999",children:"--"})}}],w={selectOnLineNumbers:!0,readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1};return(0,O.jsxs)("div",{className:D.shixunWrapper,children:[0===(null==l||null===(n=l.exercise)||void 0===n?void 0:n.commit_status)&&(0,O.jsx)("div",{children:s.shixun.map((function(e,n){return(0,O.jsxs)(j.Z,{className:"mb20",justify:"space-between",children:[(0,O.jsxs)(y.Z,{flex:1,children:[(0,O.jsxs)("span",{className:D.score,children:["(",e.challenge_score,"分)"]}),(0,O.jsxs)("span",{className:D.name,children:[e.challenge_name," "]})]}),(0,O.jsxs)(y.Z,{children:[0===e.answer_status&&(0,O.jsx)("span",{className:"font14",style:{color:"#FA6400"},children:"未完成"}),1===e.answer_status&&(0,O.jsx)("span",{className:"font14",style:{color:"#37AD83"},children:"已完成"})]})]})}))}),0!==(null==l||null===(t=l.exercise)||void 0===t?void 0:t.commit_status)||0!==(null==l||null===(r=l.exercise)||void 0===r?void 0:r.user_exercise_status)?(0,O.jsxs)(O.Fragment,{children:[!(null==f||!f.length)&&(0,O.jsxs)("div",{children:[(0,O.jsx)("p",{className:"font16 c-grey-666",children:"阶段成绩"}),(0,O.jsx)(H.Z,{columns:g,dataSource:f,pagination:!1})]}),!(null==x||!x.length)&&(0,O.jsxs)("div",{children:[(0,O.jsx)("p",{className:"font16 c-grey-666 mt10",children:"实训详情"}),null==x?void 0:x.map((function(e,n){return(0,O.jsxs)("div",{id:"challenge_".concat(null==s?void 0:s.question_id).concat(n),className:"mt5",children:[(0,O.jsxs)("div",{children:[(0,O.jsxs)("span",{className:"font16 mr15",children:[" 第",e.position,"关"]}),(0,O.jsx)(p.Link,{className:"current c-black font16",to:"/tasks/".concat(e.game_identifier),children:e.name})]}),0===(null==e?void 0:e.st)&&e.passed_code&&(0,O.jsxs)("aside",{className:D.shixunWrp,children:[(0,O.jsxs)("h2",{children:["最后一次通关的代码(未通关则为最后一次提交评测的代码)",(0,O.jsx)("span",{className:"c-light-black",children:e.path})]}),(0,O.jsx)(V.ZP,{height:300,language:"python",theme:"default",value:e.passed_code,options:w})]})]})}))]})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(B.Z,{className:"c-grey-999 mt20 mb20",value:null==s?void 0:s.question_title}),null==s||null===(i=s.shixun)||void 0===i?void 0:i.map((function(e,n){return(0,O.jsxs)("p",{className:"font16 c-grey-666 mb5",children:[(0,O.jsxs)("span",{className:"mr20",children:["第",null==e?void 0:e.challenge_position,"关 ",null==e?void 0:e.challenge_name]}),(0,O.jsxs)("span",{children:[null==e?void 0:e.challenge_score,"分"]})]},n)}))]})]})},z=t(19575),U=function(e){var n=e.item,t=(e.answerData,(0,d.useState)([])),r=u()(t,2),i=(r[0],r[1]);(0,d.useEffect)((function(){var e,t;(null==n||null===(e=n.evaluate_codes)||void 0===e?void 0:e.length)>0?i(null==n||null===(t=n.evaluate_codes)||void 0===t?void 0:t.map((function(e,n){return{key:n+1,error_msg:null!=e&&e.error_msg?z.Base64.decode(null==e?void 0:e.error_msg):""}}))):i([{key:"--",error_msg:"--"}])}),[null==n?void 0:n.evaluate_codes]);return(0,O.jsxs)("div",{className:"".concat(D.programWrapper),children:[(0,O.jsx)("div",{className:D.desc,children:"题目描述"}),(0,O.jsx)("div",{className:D.content,children:(0,O.jsx)(B.Z,{value:null==n?void 0:n.description})}),!(null==n||!n.user_answer.length)&&(null==n?void 0:n.passed_code)&&(0,O.jsxs)("aside",{className:D.shixunWrp,children:[(0,O.jsx)("h3",{children:"第一次评测通过的代码(未通关则为最后一次提交评测的代码)"}),(0,O.jsx)(V.ZP,{style:{border:"1px solid #ccc"},height:300,language:"python",theme:"vs-light",value:null!=n&&n.passed_code?z.Base64.decode(null==n?void 0:n.passed_code):"",options:{selectOnLineNumbers:!0,readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1}})]})]})},Y=t(861),$=t.n(Y),X=v.Z.TextArea,J=function(e){var n,t,r=e.item,s=e.answerData,l=e.onBlur,o=void 0===l?function(){}:l,p=(0,d.useState)([]),f=u()(p,2),m=f[0],h=f[1],x=(0,d.useState)([]),_=u()(x,2),g=_[0],w=_[1];return(0,d.useEffect)((function(){for(var e=[],n=function(n){var t,i=(null==r||null===(t=r.user_answer)||void 0===t?void 0:t.find((function(e){return e.choice_id===n+1})))||{choice_id:n+1,answer_text:""};e.push(a()({},i))},t=0;t<(null==r?void 0:r.multi_count);t++)n(t);h(e)}),[null==r?void 0:r.user_answer]),(0,O.jsxs)("div",{children:[null==m?void 0:m.map((function(e,n){var t,a,l,u;return(0,O.jsxs)(j.Z,{className:"".concat(D.baseMargin," ").concat(D.fill),align:"middle",children:[(0,O.jsxs)(y.Z,{className:D.index,children:["填空项",n+1]}),(0,O.jsx)(y.Z,{flex:"430px",className:"ml20 mr20",children:(0,O.jsx)(v.Z,{placeholder:"请输入答案",disabled:!r.repeat_answer&&(null==r||null===(t=r.user_answer)||void 0===t?void 0:t.length)>0&&!r.israp||!(null==s||!s.exercise.commit_status),value:null==e?void 0:e.answer_text,onChange:function(e){m[n].answer_text=e.target.value,h($()(m))},onBlur:function(){var t=c()(i()().mark((function t(r){var s,a,l;return i()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o(null==e?void 0:e.answer_text,n+1,m);case 2:0===(s=t.sent).status?((a=g.slice())[n]={status:"success",errorText:""},w(a)):((l=g.slice())[n]={status:"fail",errorText:s.message},w(l));case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),className:"".concat(r.user_score&&(r.user_score===r.question_score?"c-green":"c-red")," ").concat(D.fillInput)})}),"success"===(null===(a=g[n])||void 0===a?void 0:a.status)&&(0,O.jsx)(y.Z,{children:(0,O.jsxs)(j.Z,{align:"middle",children:[(0,O.jsx)("i",{style:{marginRight:8},className:"iconfont icon-chenggong1 ".concat(D.success)}),(0,O.jsx)("span",{className:D.success,children:"保存成功"})]})}),"fail"===(null===(l=g[n])||void 0===l?void 0:l.status)&&(0,O.jsx)(y.Z,{children:(0,O.jsxs)(j.Z,{align:"middle",children:[(0,O.jsx)("i",{style:{marginRight:8},className:"iconfont icon-tishi7 ".concat(D.fail)}),(0,O.jsx)("span",{className:D.fail,children:null===(u=g[n])||void 0===u?void 0:u.errorText})]})})]},n)})),!(null==r||null===(n=r.standard_answer)||void 0===n||!n.length)&&(0,O.jsx)("div",{children:null==r||null===(t=r.standard_answer)||void 0===t?void 0:t.map((function(e,n){return(0,O.jsxs)("div",{children:[(0,O.jsxs)("span",{children:["参考答案:(填空",n+1,":"]}),(0,O.jsx)("div",{children:(0,O.jsx)(X,{autoSize:!0,disabled:!0,value:null==e?void 0:e.answer_text[0]})})]},n)}))})]})},K=t(88517),G=v.Z.TextArea,Q=function(e){var n,t,r=e.item,s=(e.answerData,e.onBlur),l=void 0===s?function(){}:s,o=(e.onDebug,(0,d.useState)([])),p=u()(o,2),f=p[0],v=p[1];return(0,d.useEffect)((function(){var e,n=null==r||null===(e=r.standard_answer_with_score)||void 0===e?void 0:e.map((function(e,n){var t,i;return a()(a()({},e),{},{value:(null==r||null===(t=r.user_answer)||void 0===t||null===(i=t[n])||void 0===i?void 0:i.answer_text)||""})}));v(n)}),[null==r?void 0:r.standard_answer_with_score]),(0,O.jsxs)("div",{children:[(null==r?void 0:r.code)&&(0,O.jsx)("div",{style:{border:"1px solid #CCCCCC",padding:"10px",marginBottom:20},children:(0,O.jsx)(B.Z,{className:D.content,programFillValue:f,showProgramFill:!0,onFillBlur:function(){var e=c()(i()().mark((function e(n,t){var r;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l(null==n||null===(r=n[parseInt(t)])||void 0===r?void 0:r.value,parseInt(t)+1,f);case 2:0===e.sent.status?(f[parseInt(t)].type="success",v(f)):(f[parseInt(t)].type="warning",v(f));case 4:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),value:z.Base64.decode((null==r?void 0:r.code)||"")})}),!(null==r||null===(n=r.standard_answer)||void 0===n||!n.length)&&(0,O.jsx)("div",{children:null==r||null===(t=r.standard_answer)||void 0===t?void 0:t.map((function(e,n){return(0,O.jsxs)("div",{children:[(0,O.jsxs)("span",{children:["参考答案:(填空",n+1,":"]}),(0,O.jsx)("div",{children:(0,O.jsx)(G,{autoSize:!0,disabled:!0,value:null==e?void 0:e.answer_text[0]})})]},n)}))}),(null==r?void 0:r.allow_student_debug)&&(0,O.jsx)("div",{style:{textAlign:"end"},children:(0,O.jsx)(K.Z,{ButtonProps:{type:"primary"},ButtonText:"运行调试",items:a()(a()({},r),{},{userAnswer:f}),hackidentifier:null==r?void 0:r.hack_identifier})})]})},ee=t(81728),ne=(v.Z.TextArea,function(e){var n=e.data;return(0,O.jsxs)("div",{className:"tc mt80",children:[(0,O.jsx)("img",{width:"486",src:ee.BV})," ",(0,O.jsx)("br",{}),-1===n.status&&(0,O.jsx)("div",{className:"c-grey-999 mt60",children:"您的IP不在考试允许的范围内"}),-2===n.status&&(0,O.jsxs)("div",{className:" c-grey-999 mt60",children:["您已绑定当前考试IP地址",(0,O.jsx)("span",{className:"c-red",children:n.ip}),"请使用该IP地址进入考试。"]}),(0,O.jsx)(b.ZP,{className:"mt40 pl20 pr20",type:"primary",children:(0,O.jsx)("a",{href:"/",children:"回到首页"})})]})}),te=t(59758),re=t(96486),ie=t(12729),se=f.Z.Countdown,ae=v.Z.TextArea,le=["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"],ce={0:"c-red-ee4",1:"c-green"},oe=(0,p.connect)((function(e){var n=e.loading;return{user:e.user,loading:n.effects}}))((function(e){var n,t,r,s,l,o,f,v,E,L,M,H,V,D,z,Y,$,X,K,G,ee,oe,ue,de=e.user,pe=e.dispatch,fe=(0,p.useParams)(),ve=(0,d.useState)({}),me=u()(ve,2),he=me[0],xe=me[1],_e=(0,d.useState)({}),ge=u()(_e,2),je=(ge[0],ge[1],(0,d.useState)({})),ye=u()(je,2),we=ye[0],be=ye[1],ke=(0,d.useState)(!1),Ne=u()(ke,2),Se=Ne[0],Ze=Ne[1],Ee=(0,d.useState)(!0),qe=u()(Ee,2),Ie=qe[0],Ce=qe[1],Te=(0,d.useState)(!1),Pe=u()(Te,2),Fe=(Pe[0],Pe[1]),Re=(0,d.useState)(!1),Be=u()(Re,2),Le=Be[0],Oe=(Be[1],(0,d.useState)()),Ae=u()(Oe,2),Me=Ae[0],He=Ae[1],Ve=(0,d.useState)(""),De=u()(Ve,2),We=De[0],ze=De[1],Ue=(0,d.useState)("none"),Ye=u()(Ue,2),$e=Ye[0],Xe=Ye[1],Je=(0,d.useState)(""),Ke=u()(Je,2),Ge=Ke[0],Qe=(Ke[1],(0,d.useState)({status:0})),en=u()(Qe,2),nn=en[0],tn=(en[1],(0,d.useRef)()),rn=(0,d.useState)(0),sn=u()(rn,2),an=sn[0],ln=sn[1],cn=(0,d.useState)(0),on=u()(cn,2),un=on[0],dn=on[1],pn=(0,d.useState)(!1),fn=u()(pn,2),vn=fn[0],mn=fn[1],hn=(0,d.useState)(!1),xn=u()(hn,2),_n=xn[0],gn=xn[1],jn=(0,d.useState)(),yn=u()(jn,2),wn=yn[0],bn=yn[1],kn=(0,d.useState)(),Nn=u()(kn,2),Sn=Nn[0],Zn=Nn[1];(0,d.useEffect)((function(){return pe({type:"globalSetting/headerFooterToggle",payload:!1}),((0,T.GJ)()||(0,T.EO)())&&fe.categoryId&&de.userInfo.login&&In(),window.addEventListener("message",En),function(){window.removeEventListener("message",En),window.removeEventListener("beforeunload",qn),pe({type:"globalSetting/headerFooterToggle",payload:!0}),location.pathname.indexOf("/detail")>-1&&(0,P.BU)()}}),[fe.categoryId,de.userInfo.login]);var En=function(e){"backExercise"===e.data&&(Xe("none"),ze(""),In())},qn=function(e){var n="确定离开此页面吗?此页数据可能会丢失";return(e||window.event).returnValue=n,n},In=function(){var e=c()(i()().mark((function e(){var n,t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ze(!0),e.next=3,(0,F._F)(a()({},fe)).catch((function(){return Ze(!1)}));case 3:(null==(n=e.sent)?void 0:n.exercise)&&(n.exercise.user_exercise_status=1),Ze(!1),n&&(n.exercise_types=(null==n?void 0:n.exercise_types)||(null==n||null===(t=n.exercise_scores)||void 0===t?void 0:t.exercise_types),xe(n));case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,d.useEffect)((function(){var e,n,t;0===(null===(e=he.exercise)||void 0===e?void 0:e.time)&&et(),(null===(n=he.exercise)||void 0===n?void 0:n.time)&&He(Date.now()+1e3*(null==he||null===(t=he.exercise)||void 0===t?void 0:t.time)*60)}),[null===(n=he.exercise)||void 0===n?void 0:n.time]);var Cn,Tn,Pn,Fn,Rn,Bn,Ln,On,An,Mn,Hn,Vn,Dn,Wn=function(){In()},zn=function(){var e=c()(i()().mark((function e(){var n,t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,F.kp)({categoryId:fe.categoryId,commit_method:2});case 2:0===(null==(n=e.sent)?void 0:n.status)&&(m.Z.info({width:530,title:"提示",centered:!0,okText:"确定",content:(0,O.jsxs)("div",{className:"tc font16",children:["答题结束了,系统已自动提交试卷",(0,O.jsx)("br",{}),"不能再修改答题"]}),onOk:function(){var e=c()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Wn();case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()}),h.ZP.info(null==n?void 0:n.message)),-3===(null==n?void 0:n.status)&&(t=parseInt(null==n?void 0:n.message),he.exercise.time=t,xe(a()({},he)));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Un=function(){var e=c()(i()().mark((function e(n){var t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(n.is_jupyter||n.is_jupyter_lab?R.BK:R.Ir)({id:n.shixun_identifier});case 2:(null!=(t=e.sent)&&t.game_identifier||null!=t&&t.identifier)&&(n.is_jupyter_lab||n.is_jupyter?ze("/tasks/".concat(t.identifier,"/jupyter?type=exercises&exercisesId=").concat(fe.categoryId,"&coursesId=coursesId&login=").concat(fe.login,"&questionId=").concat(n.question_id)):ze("/tasks/".concat(t.game_identifier,"?type=exercises&exercisesId=").concat(fe.categoryId,"&coursesId=").concat(fe.coursesId,"&login=").concat(fe.login,"&questionId=").concat(n.question_id)),Xe("block")),-3===(null==t?void 0:t.status)?(0,C.eF)():2===(null==t?void 0:t.status)?Yn(null==t?void 0:t.message,n.question_id,n.is_jupyter_lab,n.is_jupyter):3===(null==t?void 0:t.status)&&$n(null==t?void 0:t.message);case 5:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),Yn=function e(n,t,r,s){var a,l;n=null!==(a=n)&&void 0!==a&&a.includes(".json")?n:"".concat(n,".json"),m.Z.confirm({centered:!0,title:"提示",okText:"确定",cancelText:"取消",content:(0,O.jsx)("div",{className:"tc font16",children:"实训已经更新了,正在为您重置!"}),onOk:(l=c()(i()().mark((function a(){var l,c;return i()().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,(0,F.$Q)({url:n});case 2:if(l=i.sent){i.next=5;break}return i.abrupt("return");case 5:return h.ZP.success("重置成功,正在进入实践项目!"),i.next=8,(0,R.Ir)({id:l.shixun_identifier});case 8:if(null==(c=i.sent)||!c.game_identifier){i.next=12;break}return Un({shixun_identifier:null==c?void 0:c.game_identifier,question_id:t,is_jupyter_lab:r,is_jupyter:s}),i.abrupt("return");case 12:2===(null==c?void 0:c.status)?e(null==c?void 0:c.message,t,r,s):3===(null==c?void 0:c.status)&&$n(null==c?void 0:c.message);case 13:case"end":return i.stop()}}),a)}))),function(){return l.apply(this,arguments)})})},$n=function(e){m.Z.confirm({centered:!0,title:"提示",okText:"确定",cancelText:"取消",content:(0,O.jsxs)("div",{className:"tc font16",children:["目前该实践项目尚在内测中,将于",e,"之后开放,谢谢!"]})})},Xn=function(){var e=c()(i()().mark((function e(n){var t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.hack_identifier){e.next=5;break}return e.next=3,(0,F.nF)({id:n.hack_identifier});case 3:0===(null==(t=e.sent)?void 0:t.status)&&(ze("/myproblems/".concat(t.identifier,"?type=exercises&exercisesId=").concat(fe.categoryId,"&coursesId=").concat(fe.coursesId,"&login=").concat(fe.login,"&questionId=").concat(n.question_id)),Xe("block"));case 5:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),Jn=function(){var e=c()(i()().mark((function e(n,t,r,s){var a;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=3;break}return console.error("handleSave no questionId params"),e.abrupt("return");case 3:return e.next=5,(0,F.oX)({questionId:n,exercise_choice_id:t,answer_text:r});case 5:return 0===(null==(a=e.sent)?void 0:a.status)&&s&&s(),e.abrupt("return",a);case 8:case"end":return e.stop()}}),e)})));return function(n,t,r,i){return e.apply(this,arguments)}}(),Kn=function(){var e=c()(i()().mark((function e(n){var t,r,s,a;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,F.WL)({id:fe.categoryId});case 2:if(t=e.sent){e.next=5;break}return e.abrupt("return");case 5:0!==t.question_undo||0!==t.oj_undo?(r="",0!==t.question_undo&&0!==t.oj_undo?r="有 ".concat(t.question_undo," 题未完成,包含 ").concat(t.oj_undo," 个").concat((null==he||null===(s=he.exercise_question_types)||void 0===s||null===(a=s.find((function(e){return 6==e.question_type})))||void 0===a?void 0:a.name)||"编程题"):0!==t.question_undo&&0===t.oj_undo?r="有 ".concat(t.question_undo," 题未完成"):0===t.question_undo&&0!==t.oj_undo&&(r="有 ".concat(t.oj_undo," 编程题未完成")),m.Z.confirm({width:530,title:"提示",centered:!0,okText:"确定",cancelText:"取消",content:(0,O.jsxs)("div",{className:"tc font16",children:[r,(0,O.jsx)("br",{}),n?"在".concat(q()(t.end_time).format("YYYY-MM-DD HH:mm"),"之前,允许修改答题"):"提交后无法再修改答题,是否确认提交?"]}),onOk:function(){var e=c()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n?Wn():et();case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()})):m.Z.info({width:530,title:"提示",centered:!0,okText:"知道啦",content:(0,O.jsx)("div",{className:"tc font16",children:n?"在".concat(q()(t.end_time).format("YYYY-MM-DD HH:mm"),"之前,允许修改答题"):"提交后无法再修改答题,是否确认提交?"}),onOk:function(){var e=c()(i()().mark((function e(){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n?Wn():et();case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),Gn=function(e){return(0,O.jsxs)("div",{children:[(0,O.jsx)(x.Z,{strokeColor:{from:"#108ee9",to:"#87d068"},status:"active",percent:e}),(0,O.jsx)("div",{className:"c-grey-c tc mt10 mb20",children:"正在判分中…"})]})},Qn=function(){var e=0,n=m.Z.info({title:"交卷中",icon:null,className:"modal-footer-none",content:Gn(e)}),t=setInterval((function(){e<=100?(e+=2,n.update({content:Gn(e)})):(n.destroy(),clearInterval(t))}),50)},et=function(){var e=c()(i()().mark((function e(){var n;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Qn(),e.next=3,(0,F.kp)({categoryId:fe.categoryId,commit_method:1});case 3:n=e.sent,(0,P.BU)(),pe({type:"exercise/setActionTabs",payload:a()({},{removeEventListenerExitScreen:!0})}),0===(null==n?void 0:n.status)&&(h.ZP.success(null==n?void 0:n.message),Fe(!1),setTimeout((function(){m.Z.info({title:"交卷成功!",okText:"确定",onOk:function(){Wn()}})}),3e3));case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),nt=function(){var e=c()(i()().mark((function e(n,t,r,s){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Jn(t,n,null,(function(){he.question_status.find((function(e){return e.ques_id===t})).ques_status=n?1:0,s.user_answer=[],s.user_answer.push(n),s.repeat_answer||(s.israp=!0),xe(a()({},he))}));case 1:case"end":return e.stop()}}),e)})));return function(n,t,r,i){return e.apply(this,arguments)}}(),tt=function(){var e=c()(i()().mark((function e(n,t,r,s,l){return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Jn(s.question_id,n,null,(function(){var e,r,i;s.user_answer=[],s.user_answer.push(n);var c=null==l||null===(e=l.sub_exercise_questions)||void 0===e?void 0:e.filter((function(e){var n;return 0===(null===(n=e.user_answer)||void 0===n?void 0:n.length)}));he.question_status.find((function(e){return e.ques_id===t})).ques_status=(null==c?void 0:c.length)===(null==l||null===(r=l.sub_exercise_questions)||void 0===r?void 0:r.length)?0:(null==c?void 0:c.length)>0&&(null==c?void 0:c.length)<(null==l||null===(i=l.sub_exercise_questions)||void 0===i?void 0:i.length)?2:1,xe(a()({},he))}));case 1:case"end":return e.stop()}}),e)})));return function(n,t,r,i,s){return e.apply(this,arguments)}}(),rt=function(){var e=c()(i()().mark((function e(n,t,r,s,l){var c;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Jn(r,t,n,(function(){he.question_status.find((function(e){return e.ques_id===r})).ques_status=s.every((function(e){return!!e.answer_text}))?1:he.question_status.find((function(e){return e.ques_id===r})).ques_status=s.some((function(e){return!!e.answer_text}))?2:0;var e={choice_id:t,answer_text:n};l.user_answer.filter((function(e){return e.choice_id!=t}))?l.user_answer.splice(t-1,1,e):l.user_answer.push(e),l.repeat_answer||(l.israp=!0),xe(a()({},he))}));case 2:return c=e.sent,e.abrupt("return",c);case 4:case"end":return e.stop()}}),e)})));return function(n,t,r,i,s){return e.apply(this,arguments)}}(),it=function(){var e=c()(i()().mark((function e(n,t,r,s,l){var c;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Jn(r,t,n,(function(){he.question_status.find((function(e){return e.ques_id===r})).ques_status=s.every((function(e){return!!e.value}))?1:he.question_status.find((function(e){return e.ques_id===r})).ques_status=s.some((function(e){return!!e.value}))?2:0;var e={choice_id:t,answer_text:n};l.user_answer.filter((function(e){return e.choice_id!=t}))?l.user_answer.splice(t-1,1,e):l.user_answer.push(e),l.repeat_answer||(l.israp=!0),xe(a()({},he))}));case 2:return c=e.sent,e.abrupt("return",c);case 4:case"end":return e.stop()}}),e)})));return function(n,t,r,i,s){return e.apply(this,arguments)}}(),st=function(e,n){var t,r,i,s,a,l;return(0,O.jsxs)("div",{className:I.baseMargin,children:[(0,O.jsx)(_.ZP.Group,{disabled:!(null==he||!he.exercise.commit_status),defaultValue:null==e||null===(t=e.user_answer)||void 0===t?void 0:t[0],onChange:function(t){return nt(t.target.value,null==e?void 0:e.question_id,n,e)},className:e.user_score&&"edu-radio-".concat(e.user_score===e.question_score?"green":"red"),children:null==e||null===(r=e.question_choices)||void 0===r?void 0:r.map((function(n,t){var r,i=2==e.question_type?"":"".concat(le[t],".");return(0,O.jsx)("div",{className:"".concat(I.answerWrap),children:(0,O.jsxs)(_.ZP,{className:I.noWrap,disabled:!e.repeat_answer&&(null==e||null===(r=e.user_answer)||void 0===r?void 0:r.length)>0&&!e.israp,value:null==n?void 0:n.choice_id,children:[(0,O.jsx)("span",{className:"mr3 font16",children:i}),(0,O.jsx)(B.Z,{style:{width:740},className:I.renderHtml,value:null==n?void 0:n.choice_text})]})},t)}))}),(0,T.dE)()&&(null==he||null===(i=he.exercise)||void 0===i?void 0:i.answer_open)&&(3==(null==he||null===(s=he.exercise)||void 0===s?void 0:s.exercise_status)||1==(null==he||null===(a=he.exercise)||void 0===a?void 0:a.user_exercise_status))&&(0,O.jsxs)("div",{children:["参考答案:",null==e||null===(l=e.standard_answer)||void 0===l?void 0:l.map((function(e,n){return(0,O.jsx)("span",{children:le[Number(e)-1]},n)}))]})]})},at=function(e,n,t){var r;return(0,O.jsx)("div",{children:null==e||null===(r=e.sub_exercise_questions)||void 0===r?void 0:r.map((function(n,r){var i,s,a,l,c,o;return(0,O.jsxs)("div",{className:"".concat(I.baseMargin," ").concat(I.singleItem," mb20"),children:[(0,O.jsxs)("div",{style:{display:"flex",alignItems:"baseline",userSelect:"none",marginBottom:40},children:[(0,O.jsxs)("span",{style:{flexShrink:0,color:"#999999"},className:"font14",children:["",null==n?void 0:n.question_score,"分)"]}),(0,O.jsx)("span",{style:{flexShrink:0,marginRight:6},className:"font16",children:t+1+"."+(r+1)}),(0,O.jsx)(B.Z,{value:null==n?void 0:n.question_title})]}),(0,O.jsx)(_.ZP.Group,{style:{marginLeft:66},disabled:!(null==he||!he.exercise.commit_status),defaultValue:null==n||null===(i=n.user_answer)||void 0===i?void 0:i[0],onChange:function(t){return tt(t.target.value,null==e?void 0:e.question_id,r,n,e)},className:n.user_score&&"edu-radio-".concat(n.user_score===n.question_score?"green":"red"),children:null==n||null===(s=n.question_choices)||void 0===s?void 0:s.map((function(e,t){var r,i=2==n.question_type?"":"".concat(le[t],".");return(0,O.jsx)("div",{className:I.answerWrap,children:(0,O.jsxs)(_.ZP,{className:I.noWrap,disabled:!n.repeat_answer&&(null==n||null===(r=n.user_answer)||void 0===r?void 0:r.length)>0,value:null==e?void 0:e.choice_id,children:[(0,O.jsx)("span",{style:{color:"#333333"},className:"mr3 font16 ".concat(I.noWrap),children:i}),(0,O.jsx)(B.Z,{style:{width:734},className:I.renderHtml,value:null==e?void 0:e.choice_text})]})},t)}))}),(0,T.dE)()&&(null==he||null===(a=he.exercise)||void 0===a?void 0:a.answer_open)&&(3==(null==he||null===(l=he.exercise)||void 0===l?void 0:l.exercise_status)||1==(null==he||null===(c=he.exercise)||void 0===c?void 0:c.user_exercise_status))&&(0,O.jsxs)("div",{children:["参考答案:",null==n||null===(o=n.standard_answer)||void 0===o?void 0:o.map((function(e,n){return(0,O.jsx)("span",{children:le[Number(e)-1]},n)}))]})]},r)}))})},lt=function(e,n){var t,r,i,s;return(0,O.jsxs)("div",{className:I.baseMargin,children:[(0,O.jsx)(g.Z.Group,{disabled:!(null==he||!he.exercise.commit_status),defaultValue:null==e?void 0:e.user_answer,onChange:function(n){return function(e,n,t){Jn(n,e,null,(function(){t.user_answer=e,t.repeat_answer||(t.israp=!0),he.question_status.find((function(e){return e.ques_id===n})).ques_status=null!=e&&e.length?1:0,xe(a()({},he))}))}(n,null==e?void 0:e.question_id,e)},className:e.user_score&&"edu-checkbox-".concat(e.user_score===e.question_score?"green":"red"),children:null==e||null===(t=e.question_choices)||void 0===t?void 0:t.map((function(n,t){var r,i="".concat(le[t],".");return(0,O.jsx)("div",{className:I.answerWrap,children:(0,O.jsxs)(g.Z,{disabled:!e.repeat_answer&&(null==e||null===(r=e.user_answer)||void 0===r?void 0:r.length)>0&&!e.israp,value:null==n?void 0:n.choice_id,children:[(0,O.jsx)("span",{className:"mr3 font16",children:i}),(0,O.jsx)(B.Z,{className:I.renderHtml,value:null==n?void 0:n.choice_text})]})},t)}))}),(0,T.dE)()&&(null==he||null===(r=he.exercise)||void 0===r?void 0:r.answer_open)&&3==(null==he||null===(i=he.exercise)||void 0===i?void 0:i.exercise_status)&&(0,O.jsxs)("div",{children:["参考答案:",null==e||null===(s=e.standard_answer)||void 0===s?void 0:s.map((function(e,n){return(0,O.jsx)("span",{children:le[Number(e)-1]},n)}))]})]})},ct=function(e,n){return(0,O.jsx)(J,{item:e,answerData:he,onBlur:function(){var n=c()(i()().mark((function n(t,r,s){return i()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,rt(t,r,null==e?void 0:e.question_id,s,e);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n)})));return function(e,t,r){return n.apply(this,arguments)}}()})},ot=function(e,n){return(0,O.jsx)(A,{item:e,answerData:he,onBlur:function(n){return function(e,n,t){Jn(n,null,e,(function(){he.question_status.find((function(e){return e.ques_id===n})).ques_status=e?1:0,t.user_answer=[],t.user_answer.push(e),t.repeat_answer||(t.israp=!0),xe(a()({},he))}))}(n,null==e?void 0:e.question_id,e)}})},ut=function(e,n){return(0,O.jsx)(W,{item:e,answerData:he})},dt=function(e,n){return(0,O.jsx)(U,{item:e,answerData:he})},pt=function(e,n){return(0,O.jsx)(Q,{item:e,answerData:he,onBlur:function(){var n=c()(i()().mark((function n(t,r,s){return i()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,it(t,r,null==e?void 0:e.question_id,s,e);case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n)})));return function(e,t,r){return n.apply(this,arguments)}}()})},ft=function(e,n,t){var r,i,s=null==he||null===(r=he.exercise_question_types)||void 0===r?void 0:r.find((function(e){return e.question_type===n}));return(0,O.jsxs)("div",{className:I.answerSheetWrap,children:[(0,O.jsxs)("div",{className:I.answerSheetQuestionTitle,onClick:function(){we[n]=!we[n],be(a()({},we))},children:[!we[n]&&(0,O.jsx)(N.Z,{}),we[n]&&(0,O.jsx)(S.Z,{}),(0,O.jsx)("span",{className:"ml5 c-grey-666",children:e})]}),!we[n]&&(0,O.jsx)(j.Z,{className:I.answerSheet,gutter:[20,20],children:null==s||null===(i=s.items)||void 0===i?void 0:i.map((function(e,r){var i,s,l;if(e.question_type===n)return(0,O.jsx)(y.Z,{children:(0,O.jsxs)("div",{onClick:function(){var e;if(t!==an||r!==un){var i,s,l,c;if(he.exercise_question_types[an].items[un].israp=!1,xe(a()({},he)),!_n&&0===(null==he||null===(e=he.exercise)||void 0===e?void 0:e.user_exercise_status)&&(0,T.dE)())if(null===(i=he.exercise_question_types)||void 0===i||null===(s=i[an])||void 0===s||null===(l=s.items)||void 0===l||null===(c=l[un])||void 0===c||!c.repeat_answer)return mn(!0),bn(3),void Zn({oneindex:t,twoindex:r});ln(t),dn(r);var o="Anchor_".concat(n,"_").concat(r),u=document.getElementById(o);u&&setTimeout((function(){return u.scrollIntoView({block:"start",behavior:"smooth"})}))}},className:"\n ".concat(I.answerSheetItem,"\n ").concat(null!=he&&null!==(i=he.question_status)&&void 0!==i&&i.some((function(n){return n.ques_id===e.question_id&&1===(null==n?void 0:n.ques_status)}))?I.active:"","\n ").concat(null!=he&&null!==(s=he.question_status)&&void 0!==s&&s.some((function(n){return n.ques_id===e.question_id&&2===(null==n?void 0:n.ques_status)}))?I.partialActive:"","\n ").concat(t===an&&r===un?I.selected:"","\n "),children:[(0,O.jsx)("span",{className:I.qindex,children:r+1}),(null==he||null===(l=he.question_status)||void 0===l?void 0:l.some((function(n){return n.ques_id===e.question_id&&2===(null==n?void 0:n.ques_status)})))&&(0,O.jsx)("div",{style:{height:12,background:"#3061D0",position:"absolute",width:"100%",bottom:0}})]},r)})}))},n)]})},vt=function(e,n){var t,r,s,l,o;return(0,O.jsxs)("div",{className:I.questionItem,id:"Anchor_".concat(null==e?void 0:e.question_type,"_").concat(n),children:[(0,O.jsxs)("div",{style:{display:"flex",alignItems:"baseline",marginTop:20,marginBottom:40,userSelect:"none"},children:[(0,O.jsxs)("span",{className:"".concat(I.questionScore," mr10"),children:[null==e?void 0:e.question_score,"分"]}),(0,O.jsxs)("span",{className:"font16 ".concat(I.noWrap),children:[n+1,"、"]}),(0,O.jsx)(B.Z,{value:8==(null==e?void 0:e.question_type)?null==e?void 0:e.description:null==e?void 0:e.question_title}),!(null!=e&&e.repeat_answer)&&(0,O.jsx)("span",{style:{color:"#E30000",marginLeft:20,fontSize:14},children:"注意:该题作答之后不允许修改答案。"}),!(null==e||null===(t=e.schools)||void 0===t||!t.length)&&(0,O.jsx)(w.Z,{title:"该实训题面向指定单位开放",children:(0,O.jsx)("i",{className:"iconfont icon-zhidinggongkai1 line24 font18 c-orange"})})]}),0==(null==e?void 0:e.question_type)&&st(e,null==e?void 0:e.question_type),2==(null==e?void 0:e.question_type)&&st(e,null==e?void 0:e.question_type),1==(null==e?void 0:e.question_type)&&lt(e,null==e||e.question_type),3==(null==e?void 0:e.question_type)&&ct(e,null==e||e.question_type),4==(null==e?void 0:e.question_type)&&ot(e,null==e||e.question_type),5==(null==e?void 0:e.question_type)&&ut(e,null==e||e.question_type),6==(null==e?void 0:e.question_type)&&dt(e,null==e||e.question_type),7==(null==e?void 0:e.question_type)&&at(e,null==e||e.question_type,n),8==(null==e?void 0:e.question_type)&&pt(e,null==e||e.question_type),!(null==e||null===(r=e.answer_comments)||void 0===r||!r.length)&&(0,O.jsx)("div",{className:"mt30",children:null==e||null===(s=e.answer_comments)||void 0===s?void 0:s.map((function(n,t){var r,i;return(0,O.jsxs)("div",{children:[(0,O.jsxs)(j.Z,{align:"middle",gutter:[0,10],children:[(0,O.jsx)(y.Z,{flex:"50px",children:(0,O.jsx)("img",{src:te.Z.API_SERVER+"/images/"+(null===(r=n.user)||void 0===r?void 0:r.image_url),width:"40",style:{borderRadius:40}})}),(0,O.jsxs)(y.Z,{flex:"1",children:[n.updated_at,(0,O.jsx)("br",{}),null===(i=n.user)||void 0===i?void 0:i.name]}),(0,O.jsxs)(y.Z,{className:"c-grey-c",children:[n.shixun_chanllge_position&&(0,O.jsxs)("span",{children:["第",n.shixun_chanllge_position,"关"]}),4!==e.question_type&&(0,O.jsxs)("span",{children:["原始得分",n.origin_score,"分 "]})," 修正为",n.score,"分"]})]}),n.comment&&(0,O.jsxs)(j.Z,{align:"middle",gutter:[0,10],children:[(0,O.jsx)(y.Z,{flex:"50px"}),(0,O.jsx)(y.Z,{flex:"1",children:(0,O.jsx)(ae,{autoSize:!0,value:n.comment,disabled:!0})})]})]},t)}))}),(null==e?void 0:e.question_type)<3&&(null==e?void 0:e.standard_answer_show)&&(0,O.jsxs)("span",{className:"font16 ml20",children:["正确答案:",null==e?void 0:e.standard_answer_show]}),(0,O.jsx)("span",{children:null!==(null==e?void 0:e.user_score)&&(null==e?void 0:e.user_score)>=0&&(0,O.jsxs)("span",{children:[(0,O.jsx)("span",{className:ce[Number(null==e?void 0:e.answer_status)]||"c-orange-ff9",children:null==e?void 0:e.user_score})," 分"]})}),5==(null==e?void 0:e.question_type)&&!(null!==(l=he.exercise)&&void 0!==l&&l.commit_status)&&(0,O.jsx)(j.Z,{justify:"end",className:"mt20",children:(0,O.jsx)(b.ZP,{type:"primary",className:I.toIframeBtn,onClick:function(){return function(e){var n;e.redo?m.Z.info({width:530,title:"提示",centered:!0,okText:"确定",content:(0,O.jsx)("div",{className:"tc font16",children:"您之前已经挑战过该实训,考试过程中需要重新挑战"}),onOk:(n=c()(i()().mark((function n(){var t,r,s,l;return i()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,F.$Q)({id:e.myshixun_identifier,url:e.url});case 2:(t=n.sent)&&(r=(0,re.cloneDeep)(null==he?void 0:he.exercise_question_types),s=null==r?void 0:r.findIndex((function(e){return 5===e.question_type})),r[s].items.find((function(n){return n.question_id===e.question_id})).redo=!1,r[s].items.find((function(n){return n.question_id===e.question_id})).shixun_identifier=t.shixun_identifier,he.exercise_question_types=r,xe(he),l=a()(a()({},e),{},{shixun_identifier:t.shixun_identifier}),Un(l));case 4:case"end":return n.stop()}}),n)}))),function(){return n.apply(this,arguments)})}):Un(e)}(e)},children:"进入答题"})}),6==(null==e?void 0:e.question_type)&&!(null!==(o=he.exercise)&&void 0!==o&&o.commit_status)&&(0,O.jsx)(j.Z,{justify:"end",className:"mt20",children:(0,O.jsx)(b.ZP,{type:"primary",className:I.toIframeBtn,onClick:function(){return Xn(e)},children:"进入答题"})})]})},mt=function(e,n){return(0,O.jsx)(d.Fragment,{children:ft(e.name||ie.f[e.question_type].name,e.question_type,n)})},ht=function(e){var n=["零","一","二","三","四","五","六","七","八","九"],t=["","十","百","千","万"];e=parseInt(e);var r=function(e){for(var r=e.toString().split("").reverse(),i="",s=0;s<r.length;s++)i=(0==s&&0==r[s]||s>0&&0==r[s]&&0==r[s-1]?"":n[r[s]]+(0==r[s]?t[0]:t[s]))+i;return i},i=Math.floor(e/1e4),s=e%1e4;return s.toString().length<4&&(s="0"+s),i?r(i)+"万"+r(s):r(e)};return(0,O.jsxs)(k.Z,{size:"middle",spinning:Se,children:[Le&&(0,O.jsx)(Z.Z,{iframe:tn}),(0,O.jsx)("iframe",{style:{display:$e},id:"iframeShixuns",className:I.iframe,src:We,ref:tn,frameBorder:"0"}),(0,O.jsx)("div",{className:I.fixHeader,children:(0,O.jsxs)(j.Z,{align:"middle",className:"edu-container",children:[(0,O.jsx)(y.Z,{children:(0,O.jsx)(C.VV,{status:null!=he&&null!==(t=he.exercise)&&void 0!==t&&t.commit_status?[C.ju[4]]:[C.ju[99]]})}),(0,O.jsx)(y.Z,{className:"".concat(I.title," ml10"),children:null==he||null===(r=he.exercise)||void 0===r?void 0:r.exercise_name}),(0,O.jsx)(y.Z,{style:{marginLeft:"auto"},children:-1!==(null==he||null===(s=he.exercise)||void 0===s?void 0:s.time)&&!(null!=he&&null!==(l=he.exercise)&&void 0!==l&&l.commit_status)&&(0,O.jsxs)("aside",{className:"".concat(I.countDown," ").concat(Ge),children:["剩余答题时长",(0,O.jsx)(se,{value:Me,onFinish:zn})]})}),(0,O.jsx)(y.Z,{children:!(null!=he&&null!==(o=he.exercise)&&void 0!==o&&o.commit_status)&&(0,O.jsx)(b.ZP,{className:I.submitButton,style:{marginLeft:30},type:"primary",onClick:function(){return Kn(!1)},children:"交卷"})})]})}),(0,O.jsxs)("section",{className:"edu-container",children:[0===nn.status&&(0,O.jsxs)(j.Z,{className:I.mainPart,wrap:!1,children:[(0,O.jsxs)(y.Z,{flex:Ie?"280px":"0px",children:[(0,O.jsxs)("div",{className:I.leftPart,children:[Ie&&(0,O.jsxs)("aside",{className:"bg-white",children:[(0,O.jsxs)("aside",{className:I.answerInfo,children:[(0,O.jsxs)(j.Z,{justify:"space-between",children:[(0,O.jsx)(y.Z,{children:"答题进度"}),(0,O.jsxs)(y.Z,{className:I.answerProgress,children:[(0,O.jsx)("span",{style:{color:"#165DFF"},children:null==he||null===(f=he.question_status)||void 0===f||null===(v=f.filter((function(e){return 1===(null==e?void 0:e.ques_status)})))||void 0===v?void 0:v.length}),(0,O.jsxs)("span",{style:{color:"#999999"},children:["/",null==he||null===(E=he.exercise_types)||void 0===E?void 0:E.q_counts]})]})]}),(0,O.jsx)(j.Z,{children:(0,O.jsx)(x.Z,{strokeColor:"#165dffa6",trailColor:"#0000000d",percent:(null==he||null===(L=he.question_status)||void 0===L||null===(M=L.filter((function(e){return 1===(null==e?void 0:e.ques_status)})))||void 0===M?void 0:M.length)/(null==he||null===(H=he.exercise_types)||void 0===H?void 0:H.q_counts)*100,showInfo:!1})}),(0,O.jsx)(j.Z,{children:(0,O.jsxs)(y.Z,{children:[(0,O.jsxs)("span",{className:"c-grey-333",children:["共 ",(0,O.jsx)("span",{style:{color:"#165DFF"},children:(null==he||null===(V=he.exercise_types)||void 0===V?void 0:V.q_counts)||(null==he||null===(D=he.exercise_scores)||void 0===D||null===(z=D.exercise_types)||void 0===z?void 0:z.q_counts)})," 题:"]}),(0,O.jsxs)("span",{className:"c-grey-333",children:["满分 ",(0,O.jsx)("span",{style:{color:"#FA6400"},children:(null==he||null===(Y=he.exercise_types)||void 0===Y?void 0:Y.q_scores)||(null==he||null===($=he.exercise_scores)||void 0===$||null===(X=$.exercise_types)||void 0===X?void 0:X.q_scores)})," 分"]})]})})]}),(0,O.jsxs)(j.Z,{className:I.dottedLineWrapper,align:"middle",children:[(0,O.jsx)(y.Z,{className:I.leftHalfCircle}),(0,O.jsx)(y.Z,{flex:1,className:I.dottedLine}),(0,O.jsx)(y.Z,{className:I.rightHalfCircle})]}),(0,O.jsx)(j.Z,{children:(0,O.jsx)(y.Z,{flex:"1",children:(0,O.jsx)("aside",{className:I.cardList,children:null==he||null===(K=he.exercise_question_types)||void 0===K?void 0:K.map((function(e,n){return(0,O.jsx)(d.Fragment,{children:mt(e,n)},e.question_type)}))})})})]}),(0,O.jsxs)(j.Z,{justify:"space-around",align:"middle",className:I.answerSheetBottom,children:[(0,O.jsxs)(y.Z,{className:I.tooltipWrap,children:[(0,O.jsx)("span",{className:I.answerYes}),"已答"]}),(0,O.jsxs)(y.Z,{className:I.tooltipWrap,children:[(0,O.jsx)("span",{className:"".concat(I.answerNo," ml10"),children:(0,O.jsx)("div",{style:{height:"50%",background:"#0152d9"}})}),"部分答题"]}),(0,O.jsxs)(y.Z,{className:I.tooltipWrap,children:[(0,O.jsx)("span",{className:"".concat(I.answerNo," ml10")}),"未答"]})]})]}),(0,O.jsxs)("div",{className:I.fold,onClick:function(){return Ce(!Ie)},children:[Ie&&(0,O.jsx)(w.Z,{title:"收起答题卡",children:(0,O.jsx)("span",{className:"icon-zuojiantou iconfont c-grey-c"})}),!Ie&&(0,O.jsx)(w.Z,{title:"展开",children:(0,O.jsx)("span",{className:"icon-youjiantou iconfont c-grey-c"})})]})]}),(0,O.jsx)(y.Z,{flex:"1",children:(0,O.jsxs)("section",{className:[I.rightPart,"ml20"].join(" "),children:[(0,O.jsx)("div",{className:"".concat(I.questionPart," pl30 pr30"),children:(0,O.jsxs)(d.Fragment,{children:[(0,O.jsxs)("div",{className:"pt20",children:[(0,O.jsxs)("span",{className:I.questionTypeTitle,children:[ht(an+1),"、",null==he||null===(Cn=he.exercise_question_types)||void 0===Cn||null===(Tn=Cn[an])||void 0===Tn?void 0:Tn.name]}),(0,O.jsxs)("span",{className:I.questionTypeInfo,children:["(共",null==he||null===(Pn=he.exercise_question_types)||void 0===Pn||null===(Fn=Pn[an])||void 0===Fn?void 0:Fn.count,"题;",7===(null==he||null===(Rn=he.exercise_question_types)||void 0===Rn||null===(Bn=Rn[an])||void 0===Bn?void 0:Bn.question_type)?"包含".concat(null==he||null===(Ln=he.exercise_question_types)||void 0===Ln||null===(On=Ln[an])||void 0===On?void 0:On.sub_questions_count,"小题"):""," 共",null==he||null===(An=he.exercise_question_types)||void 0===An||null===(Mn=An[an])||void 0===Mn?void 0:Mn.score,"分)"]})]}),(0,O.jsx)(d.Fragment,{children:vt(null==he||null===(Hn=he.exercise_question_types)||void 0===Hn||null===(Vn=Hn[an])||void 0===Vn||null===(Dn=Vn.items)||void 0===Dn?void 0:Dn[un],un)},un)]},an)}),(0,O.jsx)(j.Z,{className:I.bottom,align:"middle",justify:"end",children:(0,O.jsxs)(y.Z,{children:[(0!=an||0!=un)&&(0,O.jsx)(b.ZP,{className:"".concat(I.changeButton," ").concat(I.prevBtn," mr20"),type:"default",onClick:function(){var e,n,t,r,i;if((he.exercise_question_types[an].items[un].israp=!1,xe(a()({},he)),!_n&&0===(null==he||null===(e=he.exercise)||void 0===e?void 0:e.user_exercise_status)&&(0,T.dE)())&&(null===(n=he.exercise_question_types)||void 0===n||null===(t=n[an])||void 0===t||null===(r=t.items)||void 0===r||null===(i=r[un])||void 0===i||!i.repeat_answer))return mn(!0),void bn(1);0===un?(an-=1,un=he.exercise_question_types[an].items.length-1):un-=1,ln(an),dn(un)},children:"上一题"}),!(an===(null==he||null===(G=he.exercise_question_types)||void 0===G?void 0:G.length)-1&&un===(null==he||null===(ee=he.exercise_question_types)||void 0===ee||null===(oe=ee[an])||void 0===oe||null===(ue=oe.items)||void 0===ue?void 0:ue.length)-1)&&(0,O.jsx)(b.ZP,{className:I.changeButton,type:"primary",onClick:function(){var e,n,t,r,i;if((he.exercise_question_types[an].items[un].israp=!1,xe(a()({},he)),!_n&&0===(null==he||null===(e=he.exercise)||void 0===e?void 0:e.user_exercise_status)&&(0,T.dE)())&&(null===(n=he.exercise_question_types)||void 0===n||null===(t=n[an])||void 0===t||null===(r=t.items)||void 0===r||null===(i=r[un])||void 0===i||!i.repeat_answer))return mn(!0),void bn(2);he.exercise_question_types[an].items.length-1===un?(an+=1,un=0):un+=1,ln(an),dn(un)},children:"下一题"})]})})]})}),(0,O.jsx)(m.Z,{title:"注意",open:vn,onCancel:function(){return mn(!1)},footer:!1,children:(0,O.jsxs)("div",{children:[(0,O.jsx)("p",{style:{marginBottom:0},children:"离开该题后不允许再次修改答案,确认离开吗?"}),(0,O.jsxs)("div",{style:{marginTop:60,display:"flex",justifyContent:"space-between"},children:[(0,O.jsx)(g.Z,{checked:_n,onChange:function(e){gn(e.target.checked)},children:"下次不再显示"}),(0,O.jsxs)("div",{children:[(0,O.jsx)(b.ZP,{onClick:function(){(he.exercise_question_types[an].items[un].israp||""===he.exercise_question_types[an].items[un].israp)&&(he.exercise_question_types[an].items[un].israp=!0,xe(a()({},he)))},children:"我再想想"}),(0,O.jsx)(b.ZP,{onClick:function(){he.exercise_question_types[an].items[un].israp=!1,xe(a()({},he)),1===wn?(0===un?(an-=1,un=he.exercise_question_types[an].items.length-1):un-=1,console.log(he.exercise_question_types[an].items[un],"-----"),ln(an),dn(un)):2===wn?(he.exercise_question_types[an].items.length-1===un?(an+=1,un=0):un+=1,ln(an),dn(un)):(ln(Sn.oneindex),dn(Sn.twoindex)),mn(!1)},type:"primary",style:{marginLeft:30},children:"确认"})]})]})]})})]}),0!==nn.status&&(0,O.jsx)(ne,{data:nn})]})]})}))},92632:function(e,n,t){t.d(n,{Y4:function(){return P},Im:function(){return I},ZP:function(){return R}});var r,i=t(27424),s=t.n(i),a=t(17061),l=t.n(a),c=t(17156),o=t.n(c),u=t(42122),d=t.n(u),p=t(38416),f=t.n(p),v=t(67294),m=t(11486),h=t(71577),x=t(80882),_=t(48115),g=t(10790),j=t(19575),y=t(38054),w=t(12768),b=t(29427),k=t(12320),N=t(84519),S=t(88275),Z=t(85893),E=m.Z.TextArea,q={visible:!1,tabIndex:"0"},I=(r={},f()(r,g.h.NOMATCH,"测试用例结果不匹配"),f()(r,g.h.OK,"调试通过"),f()(r,2,"调试超时"),f()(r,3,"调试pod失败"),f()(r,4,"编译失败"),f()(r,5,"执行失败"),r),C=function(e){return e[e.SET_VISIBLE=0]="SET_VISIBLE",e[e.SET_TABINDEX=1]="SET_TABINDEX",e}(C||{});function T(e,n){switch(n.type){case C.SET_VISIBLE:return d()(d()({},e),{},{visible:n.payload});case C.SET_TABINDEX:return d()(d()({},e),{},{tabIndex:n.payload});default:throw new Error}}function P(e){var n=e.status,t=e.error_msg,r=e.output,i=e.input,s=e.expected_output,a=e.is_file,c=e.input_file_url,u=e.output_file_url,d=e.expected_output_file_url,p=e.setMonacoValue,f=e.setData,m=(0,v.useRef)(),h=(0,v.useRef)(),x=(0,v.useRef)(),_=null,y={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch((0,v.useEffect)((function(){if(r&&!a&&m.current){var e=new k.Terminal({fontSize:14,letterSpacing:1,cols:83,rows:10});e.open(m.current);var n=(0,b.pp)(j.Base64.decode(r));e.write(n),e.setOption("theme",{background:"#1e1e1e"})}if(i&&!a&&h.current){var t=new k.Terminal({fontSize:14,letterSpacing:1,cols:83,rows:10});t.open(h.current),t.write((0,b.pp)(i)),t.setOption("theme",{background:"#1e1e1e"})}if(s&&!a&&x.current){var l=new k.Terminal({fontSize:14,letterSpacing:1,cols:83,rows:10});l.open(x.current),l.write((0,b.pp)(j.Base64.decode(s))),l.setOption("theme",{background:"#1e1e1e"})}}),[r]),n){case g.h.NOMATCH:_=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("p",{className:"c-red",children:"实际输入:"}),!a&&(0,Z.jsx)("div",{ref:h}),a&&(0,Z.jsx)("div",{style:y,children:(0,Z.jsx)("a",{style:{fontSize:"16px"},onClick:o()(l()().mark((function e(){var n;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(c,{method:"Get",headers:{"Content-Type":"application/octet-stream",Accept:"*/*"}});case 2:return n=e.sent,e.t0=p,e.next=6,n.text();case 6:e.t1=e.sent,(0,e.t0)(e.t1),setTimeout((function(){f(c)}),200);case 9:case"end":return e.stop()}}),e)}))),children:i})}),(0,Z.jsx)("p",{className:"c-red",children:"实际输出:"}),!a&&(0,Z.jsx)("div",{ref:m}),a&&(0,Z.jsx)("div",{style:y,children:(0,Z.jsx)("a",{style:{fontSize:"16px"},onClick:o()(l()().mark((function e(){var n;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,N.ZP)(u,{method:"Get",headers:{"Content-Type":"application/xml",Accept:"*/*"}});case 2:n=e.sent,p(n),setTimeout((function(){f(u)}),200);case 5:case"end":return e.stop()}}),e)}))),children:r})}),(0,Z.jsx)("p",{className:"c-red",children:"预期输出:"}),!a&&(0,Z.jsx)("div",{ref:x}),a&&(0,Z.jsx)("div",{style:y,children:(0,Z.jsx)("a",{style:{fontSize:"16px"},onClick:o()(l()().mark((function e(){var n;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(d,{method:"Get",headers:{"Content-Type":"application/octet-stream",Accept:"*/*"}});case 2:return n=e.sent,e.t0=p,e.next=6,n.text();case 6:e.t1=e.sent,(0,e.t0)(e.t1),setTimeout((function(){f(d)}),200);case 9:case"end":return e.stop()}}),e)}))),children:s})})]});break;case g.h.EXECUTEFAILURE:_=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)("div",{style:{border:"1px #F6F7F9 solid"},children:[(0,Z.jsx)("p",{style:{width:"100%",height:40,background:"#F6F7F9",lineHeight:"40px",color:"#666666",paddingLeft:"12px"},children:"最后执行的输入:"}),!a&&(0,Z.jsx)(w.Z,{value:i,style:y}),a&&(0,Z.jsx)("div",{style:y,children:(0,Z.jsx)("a",{onClick:function(){return(0,b.LR)(c,i)},children:i})})]}),(0,Z.jsxs)("div",{style:{border:"1px #F6F7F9 solid",marginTop:"10px"},children:[(0,Z.jsx)("p",{style:{width:"100%",height:40,background:"#F6F7F9",lineHeight:"40px",color:"#666666",paddingLeft:"12px"},children:"执行出错信息:"}),(0,Z.jsxs)("pre",{className:"error",style:{color:"#E30000",padding:"0 10px"},children:[j.Base64.decode(t),"111"]})]})]});break;case g.h.COMPILEFAILURE:_=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("p",{children:"最后执行的输入:"}),!a&&(0,Z.jsx)("div",{ref:h}),a&&(0,Z.jsx)("div",{style:y,children:(0,Z.jsx)("a",{onClick:function(){return(0,b.LR)(c,i)},children:i})}),(0,Z.jsx)("p",{children:"执行出错信息:"}),(0,Z.jsx)("pre",{className:"error",children:j.Base64.decode(t)})]});break;case g.h.PODFAILURE:_=(0,Z.jsx)("p",{children:"创建pod失败请稍后重试"});break;case g.h.TIMEOUT:_=(0,Z.jsx)("p",{children:"评测超时,请稍后重试"})}return(0,Z.jsxs)(Z.Fragment,{children:[" ",_," "]})}function F(e){var n=e.status,t=e.error_msg,r=e.execute_time,i=e.output,s=e.input,a=e.expected_output,l=(e.is_file,e.input_file_url,e.output_file_url,e.expected_output_file_url,null);switch(n){case g.h.OK:l=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)("p",{children:["执行用时:",r/1e3,"秒"]}),(0,Z.jsx)("p",{children:"执行结果:"}),(0,Z.jsx)("pre",{children:j.Base64.decode(i)})]});break;case g.h.NOMATCH:l=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)("p",{children:["输入:",(0,Z.jsx)("pre",{children:s})]}),(0,Z.jsxs)("p",{children:["输出:",i&&j.Base64.decode(i)]}),(0,Z.jsxs)("p",{children:["预期输出:",a&&j.Base64.decode(a)]})]});break;case g.h.EXECUTEFAILURE:case g.h.COMPILEFAILURE:l=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)("p",{children:["最后执行的输入:",(0,Z.jsx)("pre",{children:s})]}),(0,Z.jsx)("p",{children:"执行出错信息:"}),(0,Z.jsx)("pre",{className:"error",children:j.Base64.decode(t)})]});break;case g.h.PODFAILURE:l=(0,Z.jsx)("p",{children:"创建pod失败请稍后重试"});break;case g.h.TIMEOUT:l=(0,Z.jsx)("p",{children:"评测超时,请稍后重试"})}return(0,Z.jsxs)(Z.Fragment,{children:[" ",l," "]})}var R=function(e){var n=e.input,t=e.debuging,r=e.submitting,i=e.executingMessage,a=e.debugResult,c=e.onChangeInput,u=e.onDebugCode,d=e.onSubmitCode,p=e.hack,f=e.user,m=(0,v.useReducer)(T,q),g=s()(m,2),j=g[0],w=g[1],b=j.visible,k=j.tabIndex,I=(0,S.useSearchParams)(),P=s()(I,1)[0];function R(e){var n=e.target.id;w({type:C.SET_TABINDEX,payload:n})}var B=(0,v.useMemo)((function(){if(a){a.status;return(0,Z.jsx)(Z.Fragment,{children:F(a)})}return null}),[a]);var L=function(){var e=o()(l()().mark((function e(n){var t;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,N.ZP)("/api/problems/".concat(n,"/start.json"),{method:"get",params:{hack_user_id:null==f?void 0:f.user_id}});case 2:(t=e.sent)&&(window.location.href="/myproblems/".concat(null==t?void 0:t.identifier,"?type=1"));case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,Z.jsxs)("div",{className:"test-case-panel",children:[(0,Z.jsxs)("div",{className:"test-case-panel-body ".concat(b?"active":""),children:[(0,Z.jsxs)("ul",{className:"s-navs",children:[(0,Z.jsx)("li",{children:(0,Z.jsx)("a",{className:"0"===k?"active":"",id:"0",onClick:R,children:"自定义测试用例"})}),(0,Z.jsx)("li",{children:(0,Z.jsx)("a",{className:"1"===k?"active":"",id:"1",onClick:R,children:"代码执行结果"})})]}),(0,Z.jsx)("div",{className:"tab-panel-body ".concat("0"===k?"":"hide"),children:(0,Z.jsx)(E,{placeholder:"请填写测试用例的输入值,点击“调试代码”",value:n,onChange:c})}),(0,Z.jsx)("div",{className:"tab-panel-body ".concat("1"===k?"":"hide"),children:t?(0,Z.jsx)(y.Z,{message:i}):a?(0,Z.jsxs)("section",{style:{height:200},children:[" ",B," "]}):(0,Z.jsx)("p",{className:"tip",children:"请填写测试用例的输入值,点击“调试代码”"})})]}),(0,Z.jsx)("a",{className:"btn-collapse ".concat(b?"up":""),onClick:function(){w({type:C.SET_VISIBLE,payload:!b})},children:b?(0,Z.jsx)(x.Z,{}):(0,Z.jsx)(_.Z,{})}),(0,Z.jsxs)("footer",{className:"footer",children:[(0,Z.jsx)("span",{children:"控制台"}),(0,Z.jsxs)("div",{className:"flex-container",children:[(null==p?void 0:p.is_program)&&(null==p?void 0:p.above_question)&&(0,Z.jsx)(h.ZP,{onClick:function(){return L(null==p?void 0:p.above_question)},id:"oj-prev",className:"btn-blue",type:"ghost",children:"上一题"}),(null==p?void 0:p.is_program)&&(null==p?void 0:p.under_question)&&(0,Z.jsx)(h.ZP,{onClick:function(){return L(null==p?void 0:p.under_question)},id:"oj-next",className:"btn-blue",type:"ghost",children:"下一题"}),(0,Z.jsx)(h.ZP,{className:"btn-green",type:"ghost",loading:t,onClick:function(){w({type:C.SET_VISIBLE,payload:!0}),w({type:C.SET_TABINDEX,payload:"1"}),u()},children:"调试代码"}),"8"!==P.get("qtype")&&(0,Z.jsx)(h.ZP,{type:"primary",className:"custom-ant-disabled",loading:r,disabled:r,onClick:function(){w({type:C.SET_VISIBLE,payload:!1}),d()},children:"评测并提交"})]})]})]})}},10790:function(e,n,t){t.d(n,{h:function(){return r}});var r=function(e){return e[e.NOMATCH=-1]="NOMATCH",e[e.OK=0]="OK",e[e.TIMEOUT=2]="TIMEOUT",e[e.PODFAILURE=3]="PODFAILURE",e[e.COMPILEFAILURE=4]="COMPILEFAILURE",e[e.EXECUTEFAILURE=5]="EXECUTEFAILURE",e}({})},64241:function(e,n,t){t.d(n,{H7:function(){return f},MK:function(){return p},MU:function(){return c},X6:function(){return u},bM:function(){return l},fi:function(){return v},fu:function(){return a},n4:function(){return m},rX:function(){return d},vl:function(){return h},zO:function(){return o}});var r=t(42122),i=t.n(r),s=t(84519);function a(e,n){return(0,s.U2)("myproblems/".concat(e,".json"),i()({hidePopLogin:!0},n||{}))}function l(e,n){return(0,s.v_)("myproblems/".concat(e,"/code_submit.json"),n)}function c(e,n){return(0,s.v_)("myproblems/".concat(e,"/code_debug.json"),n)}function o(e,n){return n.language&&(n.language=encodeURIComponent(n.language)),(0,s.U2)("myproblems/".concat(e,"/submit_records.json"),n)}function u(e){return(0,s.U2)("myproblems/record_detail.json",{id:e})}function d(e,n){return(0,s.U2)("myproblems/".concat(e,"/result.json"),{mode:n})}function p(e,n){return(0,s.v_)("myproblems/".concat(e,"/add_notes.json"),n)}function f(e){return(0,s.v_)("myproblems/".concat(e,"/restore_initial_code.json"))}function v(e){return(0,s.v_)("myproblems/".concat(e,"/sync_code.json"))}function m(e,n){return(0,s.v_)("myproblems/".concat(e,"/update_code.json"),n)}function h(e,n){return(0,s.v_)("discusses/".concat(e,"/plus.json"),n)}},55054:function(e,n,t){t.d(n,{Z:function(){return y}});var r=t(67294),i=t(57838),s=t(96159),a=t(94184),l=t.n(a),c=t(53124),o=t(4310);var u=e=>{const{value:n,formatter:t,precision:i,decimalSeparator:s,groupSeparator:a="",prefixCls:l}=e;let c;if("function"==typeof t)c=t(n);else{const e=String(n),t=e.match(/^(-?)(\d*)(\.(\d+))?$/);if(t&&"-"!==e){const e=t[1];let n=t[2]||"0",o=t[4]||"";n=n.replace(/\B(?=(\d{3})+(?!\d))/g,a),"number"==typeof i&&(o=o.padEnd(i,"0").slice(0,i>0?i:0)),o&&(o=`${s}${o}`),c=[r.createElement("span",{key:"int",className:`${l}-content-value-int`},e,n),o&&r.createElement("span",{key:"decimal",className:`${l}-content-value-decimal`},o)]}else c=e}return r.createElement("span",{className:`${l}-content-value`},c)},d=t(14747),p=t(67968),f=t(45503);const v=e=>{const{componentCls:n,marginXXS:t,padding:r,colorTextDescription:i,titleFontSize:s,colorTextHeading:a,contentFontSize:l,fontFamily:c}=e;return{[`${n}`]:Object.assign(Object.assign({},(0,d.Wf)(e)),{[`${n}-title`]:{marginBottom:t,color:i,fontSize:s},[`${n}-skeleton`]:{paddingTop:r},[`${n}-content`]:{color:a,fontSize:l,fontFamily:c,[`${n}-content-value`]:{display:"inline-block",direction:"ltr"},[`${n}-content-prefix, ${n}-content-suffix`]:{display:"inline-block"},[`${n}-content-prefix`]:{marginInlineEnd:t},[`${n}-content-suffix`]:{marginInlineStart:t}}})}};var m=(0,p.Z)("Statistic",(e=>{const n=(0,f.TS)(e,{});return[v(n)]}),(e=>{const{fontSizeHeading3:n,fontSize:t}=e;return{titleFontSize:t,contentFontSize:n}}));var h=e=>{const{prefixCls:n,className:t,rootClassName:i,style:s,valueStyle:a,value:d=0,title:p,valueRender:f,prefix:v,suffix:h,loading:x=!1,onMouseEnter:_,onMouseLeave:g,decimalSeparator:j=".",groupSeparator:y=","}=e,{getPrefixCls:w,direction:b,statistic:k}=r.useContext(c.E_),N=w("statistic",n),[S,Z]=m(N),E=r.createElement(u,Object.assign({decimalSeparator:j,groupSeparator:y,prefixCls:N},e,{value:d})),q=l()(N,{[`${N}-rtl`]:"rtl"===b},null==k?void 0:k.className,t,i,Z);return S(r.createElement("div",{className:q,style:Object.assign(Object.assign({},null==k?void 0:k.style),s),onMouseEnter:_,onMouseLeave:g},p&&r.createElement("div",{className:`${N}-title`},p),r.createElement(o.Z,{paragraph:!1,loading:x,className:`${N}-skeleton`},r.createElement("div",{style:a,className:`${N}-content`},v&&r.createElement("span",{className:`${N}-content-prefix`},v),f?f(E):E,h&&r.createElement("span",{className:`${N}-content-suffix`},h)))))};const x=[["Y",31536e6],["M",2592e6],["D",864e5],["H",36e5],["m",6e4],["s",1e3],["S",1]];function _(e,n){const{format:t=""}=n,r=new Date(e).getTime(),i=Date.now();return function(e,n){let t=e;const r=/\[[^\]]*]/g,i=(n.match(r)||[]).map((e=>e.slice(1,-1))),s=n.replace(r,"[]"),a=x.reduce(((e,n)=>{let[r,i]=n;if(e.includes(r)){const n=Math.floor(t/i);return t-=n*i,e.replace(new RegExp(`${r}+`,"g"),(e=>{const t=e.length;return n.toString().padStart(t,"0")}))}return e}),s);let l=0;return a.replace(r,(()=>{const e=i[l];return l+=1,e}))}(Math.max(r-i,0),t)}const g=e=>{const{value:n,format:t="HH:mm:ss",onChange:a,onFinish:l}=e,c=(0,i.Z)(),o=r.useRef(null),u=()=>{const e=function(e){return new Date(e).getTime()}(n);e>=Date.now()&&(o.current=setInterval((()=>{c(),null==a||a(e-Date.now()),e<Date.now()&&(null==l||l(),o.current&&(clearInterval(o.current),o.current=null))}),33.333333333333336))};r.useEffect((()=>(u(),()=>{o.current&&(clearInterval(o.current),o.current=null)})),[n]);return r.createElement(h,Object.assign({},e,{valueRender:e=>(0,s.Tm)(e,{title:void 0}),formatter:(e,n)=>_(e,Object.assign(Object.assign({},n),{format:t}))}))};var j=r.memo(g);h.Countdown=j;var y=h}}]);