"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[39731],{77135:function(e,t,n){n.d(t,{Z:function(){return b}});var i=n(82242),a=n.n(i),s=n(7557),r=n.n(s),l=n(41498),o=n.n(l),c=n(79800),u=n.n(c),d=n(59301),p=n(7880),h=n(78241),f=n(8591),m=n(43418),v=n(8772),x="wrap___TwY3U",g="content___Ks95W",_="mainPathWrap___CrMaa",y="colorBlue___dvWbP",j=n(37712),b=(0,p.connect)((function(e){var t=e.shixunsDetail,n=e.loading;return{shixunsDetail:t,globalSetting:e.globalSetting,loading:n.models.index}}))((function(e){var t=e.shixunsDetail,n=(e.globalSetting,e.loading,e.dispatch),i=e.title,s=e.pathList,l=void 0===s?[]:s,c=e.showInputPath,b=void 0!==c&&c,w=e.isMergeSelectFile,k=void 0!==w&&w,Z=e.onFinish,S=void 0===Z?function(){}:Z,N=h.Z.useForm(),C=u()(N,1)[0],P=(0,p.useParams)(),D=(0,p.useLocation)(),F=(0,d.useRef)(),T=(0,d.useState)(""),R=u()(T,2),L=R[0],E=R[1],I=(0,d.useState)(""),B=u()(I,2),O=B[0],M=B[1],V=(0,d.useState)([]),z=u()(V,2),A=z[0],q=z[1],G=(0,d.useState)([]),K=u()(G,2),U=K[0],H=K[1];(0,d.useEffect)((function(){var e;F.current="repository"===(null===(e=D.pathname)||void 0===e||null===(e=e.split("/"))||void 0===e?void 0:e[3])}),[]),(0,d.useEffect)((function(){if("Repository-SelectFilePath"===t.actionTabs.key){var e=l.join("/"),n=[];l.map((function(t,i){0===i?n.push({val:"根目录",path:""},{val:"/".concat(t),path:e}):n.push({val:"/".concat(t),path:e})})),q(n),E(e),M(e),W(e)}}),[t.actionTabs.key]);var W=function(){var e=o()(r()().mark((function e(t){var i;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n({type:F.current?"shixunsDetail/getRepository":"shixunsDetail/getSecretRepository",payload:{id:P.id,path:t}});case 2:(i=e.sent)&&H(i.trees||[]);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),J=function(){var e=o()(r()().mark((function e(){var t,i,s;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=null==C?void 0:C.getFieldsValue(),i=L?"".concat(L).concat(null!=t&&t.name?"/".concat(null==t?void 0:t.name):""):null==t?void 0:t.name,!k){e.next=6;break}return S(i),Q(),e.abrupt("return");case 6:if(!b){e.next=16;break}return e.next=9,C.validateFields();case 9:return e.next=11,n({type:"shixunsDetail/uploadGitFolder",payload:a()(a()({},{id:P.id,path:i}),F.current?{}:{secret_repository:!0})});case 11:s=e.sent,S(O),0===s.status&&f.ZP.info("新建成功"),e.next=18;break;case 16:S(i),f.ZP.success("选择文件目录成功");case 18:Q();case 19:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Q=function(){n({type:"shixunsDetail/setActionTabs",payload:{}}),C.resetFields()};return(0,j.jsx)(m.Z,{centered:!0,title:i||"新建文件夹",closable:!1,keyboard:!1,open:"Repository-SelectFilePath"===t.actionTabs.key,onOk:J,onCancel:Q,children:(0,j.jsxs)("div",{className:x,children:[(0,j.jsxs)("div",{className:g,children:[(0,j.jsx)("div",{className:_,children:!(null==A||!A.length)&&A.map((function(e,t){return(0,j.jsx)("a",{onClick:function(){return function(e,t){var n=A.filter((function(e,n){return n<=t}));q(n);var i=n.filter((function(e,t){return 0!==t})).map((function(e){return e.val})).join("").substr(1);E(i),W(i)}(0,t)},children:e.val},t)}))}),!(null==U||!U.length)&&U.map((function(e,t){return"tree"===e.type&&(0,j.jsxs)("a",{onClick:function(){return function(e){var t=L;"tree"===e.type&&(A.length?A.push({val:"/".concat(e.name),path:e.name}):A.push({val:"根目录",path:""},{val:"/".concat(e.name),path:e.name}),q(A),t=L?"".concat(L,"/").concat(e.name):e.name,E(t)),W(t)}(e)},children:[(0,j.jsx)("i",{className:"iconfont icon-wenjianjia ".concat(y)}),e.name]},t)}))]}),(0,j.jsx)("label",{className:"mt5",children:"选中的新建文件夹目录:"}),(0,j.jsx)("div",{className:"mt5 mb5",children:L}),b&&(0,j.jsx)(h.Z,{form:C,scrollToFirstError:!0,className:"mt20",children:(0,j.jsx)(h.Z.Item,{name:"name",rules:[{required:!0,message:"请输入名称"},{whitespace:!0,message:"请勿输入空格"}],children:(0,j.jsx)(v.Z,{placeholder:"请输入新文件夹名/子文件夹名。(如:src/step1)"})})})]})})}))},39731:function(e,t,n){n.r(t),n.d(t,{default:function(){return Ee}});var i=n(82242),a=n.n(i),s=n(7557),r=n.n(s),l=n(41498),o=n.n(l),c=n(79800),u=n.n(c),d=n(39647),p=n.n(d),h=n(59301),f="menu___szqfh",m="warehouse___SVzfZ",v="header___DfoMH",x="title___y2IOb",g="content___pGWUf",_="left___eYHD7",y="right___RbSHM",j="loading___g8ST2",b="empty___JqJWS",w="tabs___fuMob",k="line___Wav7D",Z="footer___xymfv",S="commit___ZwkDv",N="filePathWrp____p6mm",C="filePath___qkzoJ",P="bottom0___MrVME",D=n(7880),F=n(99313),T=n(6848),R=n(8591),L=n(20834),E=n(95237),I=n(43604),B=n(38854),O=n(43418),M=n(71418),V=n(3113),z=n(37205),A=n.n(z),q=n(51589),G=n(78673),K=n(56102),U=n(78241),H=n(8772),W={wrap:"wrap___yTLAj",modal:"modal___B3dwx",title:"title___FHscn",path:"path___o7aJh",colorBlue:"colorBlue___p4I9Y",width240:"width240___UNGpD",filePath:"filePath___uTJLX"},J=n(37712),Q=["shixunsDetail","globalSetting","loading","user","dispatch","isRepository"],Y=(0,D.connect)((function(e){var t=e.shixunsDetail,n=e.loading;return{shixunsDetail:t,globalSetting:e.globalSetting,user:e.user,loading:n.models.index}}))((function(e){e.shixunsDetail,e.globalSetting,e.loading,e.user;var t=e.dispatch,n=e.isRepository,i=p()(e,Q),s=(0,D.useLocation)(),l=(0,D.useParams)(),c=(0,h.useState)({}),d=u()(c,2),f=(d[0],d[1]),m=(0,h.useRef)(),v=U.Z.useForm(),x=u()(v,1)[0],g=(0,h.useState)(""),_=u()(g,2),y=(_[0],_[1]);(0,h.useEffect)((function(){i.visible&&x.resetFields()}),[i.visible]),(0,h.useEffect)((function(){var e=sessionStorage.getItem("pathArray");if(e){var t=e.split(",").join("/"),n=0===t.indexOf("/")?t.substr(1):t;y(n)}}),[]),(0,h.useEffect)((function(){var e;m.current=null===(e=s.pathname)||void 0===e||null===(e=e.split("/"))||void 0===e?void 0:e[2]}),[]);var j=function(){var e=o()(r()().mark((function e(){var a,s,o=arguments;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.length>0&&void 0!==o[0]?o[0]:{},e.next=3,t({type:"shixunsDetail/addRepositoryFile",payload:{id:l.id,message:a.commitMessage,content:"",path:(i.defaultPath?i.defaultPath+"/":"")+a.path+"/"+(a.file||".gitkeep"),secret_repository:!n||void 0}});case 3:null!=(s=e.sent)&&s.url&&(R.ZP.success("添加成功"),i.onOK({path:(i.defaultPath?i.defaultPath+"/":"")+a.path+"/"+(a.file||".gitkeep"),name:a.path.split("/")[a.path.split("/").length-1]}),i.onClose());case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,J.jsx)(O.Z,{width:"60%",centered:!0,open:i.visible,wrapClassName:W.modal,onOk:function(){x.submit()},onCancel:i.onClose,title:"新建文件夹",children:(0,J.jsx)("section",{className:W.bg,children:(0,J.jsx)("div",{className:W.wrap,children:(0,J.jsxs)(U.Z,{className:"mt10",form:x,scrollToFirstError:!0,layout:"vertical",onFinish:j,onChange:function(){var e,t,n,i,s=a()({},x.getFieldsValue()),r=null==s||null===(e=s.path)||void 0===e?void 0:e.split(""),l=null==s||null===(t=s.file)||void 0===t?void 0:t.split("");null!=r&&null!==(n=r.filter((function(e){return"/"==e})))&&void 0!==n&&n.length&&(s.path=s.path.substring(0,s.path.length-1)),null!=l&&null!==(i=l.filter((function(e){return"/"==e})))&&void 0!==i&&i.length&&(s.file=s.file.substring(0,s.path.length-1)),x.setFieldsValue(a()({},s)),f(s)},children:[(0,J.jsx)(U.Z.Item,{label:"文件夹名称:",name:"path",children:(0,J.jsxs)(E.Z,{children:[(0,J.jsx)(I.Z,{children:(0,J.jsx)("span",{className:W.filePath,children:i.defaultPath+"/"})}),(0,J.jsx)(I.Z,{flex:"1",children:(0,J.jsx)(U.Z.Item,{name:"path",rules:[{required:!0,message:"请输入文件夹名称"},{whitespace:!0,message:"请勿输入空格"}],children:(0,J.jsx)(H.Z,{placeholder:"请输入文件夹名称",size:"middle"})})})]})}),(0,J.jsx)(U.Z.Item,{label:"文件名称:",name:"file",children:(0,J.jsx)(H.Z,{placeholder:"请输入文件名称,如果不填写系统将在文件夹下创建.gitkeep的默认文件",size:"middle"})}),(0,J.jsx)(U.Z.Item,{label:"提交信息:",name:"commitMessage",rules:[{required:!0,message:"请输入提交信息"},{whitespace:!0,message:"请勿输入空格"}],children:(0,J.jsx)(H.Z,{placeholder:"请输入本次提交的主要信息,合理的描述信息有利于代码历史记录的管理",size:"middle"})})]})})})})})),X=n(37507),$=n(55648),ee=["shixunsDetail","globalSetting","loading","user","dispatch","isRepository"],te=(0,D.connect)((function(e){var t=e.shixunsDetail,n=e.loading;return{shixunsDetail:t,globalSetting:e.globalSetting,user:e.user,loading:n.models.index}}))((function(e){var t=e.shixunsDetail,n=(e.globalSetting,e.loading,e.user,e.dispatch),i=e.isRepository,s=p()(e,ee),l=(0,D.useLocation)(),c=(0,D.useParams)(),d=(0,h.useState)({}),f=u()(d,2),m=(f[0],f[1]),v=(0,h.useRef)(),x=U.Z.useForm(),g=u()(x,1)[0],_=(0,h.useState)(""),y=u()(_,2),j=(y[0],y[1]);(0,h.useEffect)((function(){s.visible&&g.resetFields()}),[s.visible]),(0,h.useEffect)((function(){var e=sessionStorage.getItem("pathArray");if(e){var t=e.split(",").join("/"),n=0===t.indexOf("/")?t.substr(1):t;j(n)}}),[]),(0,h.useEffect)((function(){var e;v.current=null===(e=l.pathname)||void 0===e||null===(e=e.split("/"))||void 0===e?void 0:e[2]}),[]);var b=function(){var e=o()(r()().mark((function e(){var a,l,o,u,d,p,h=arguments;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=h.length>0&&void 0!==h[0]?h[0]:{},o=h.length>1&&void 0!==h[1]&&h[1],u=h.length>2&&void 0!==h[2]?h[2]:1,e.next=5,n({type:"shixunsDetail/addRepositoryFile",payload:{id:c.id,message:l.commitMessage,content:l.codeMirror,path:(s.defaultPath?s.defaultPath+"/":"")+l.path,secret_repository:!i||void 0,sync_origin_shixun:o}});case 5:null!=(d=e.sent)&&d.url&&(null!=t&&null!==(p=t.detail)&&void 0!==p&&p.copy_for_exercise||R.ZP.success("添加成功"),s.onOK({path:(s.defaultPath?s.defaultPath+"/":"")+l.path,name:l.path.split("/")[l.path.split("/").length-1]}),s.onClose()),null!=t&&null!==(a=t.detail)&&void 0!==a&&a.copy_for_exercise&&(0,$.m)(n,t,c.id,u);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,J.jsx)(O.Z,{width:"60%",open:s.visible,wrapClassName:W.modal,destroyOnClose:!0,centered:!0,onOk:function(){g.submit()},onCancel:s.onClose,title:"新建文件",children:(0,J.jsx)("section",{className:W.bg,children:(0,J.jsx)("div",{className:W.wrap,children:(0,J.jsxs)(U.Z,{className:"mt10",form:g,scrollToFirstError:!0,layout:"vertical",onFinish:function(e){var i,a;null!=t&&null!==(i=t.detail)&&void 0!==i&&i.is_fork_from_creator&&null!=t&&null!==(a=t.detail)&&void 0!==a&&a.copy_for_exercise?(s.onClose(),n({type:"classroomList/setActionTabs",payload:{key:"同步修改",value:e,type:"wareHouse",fn:function(e,t,n){b(e,t,n)}}})):b(e)},onChange:function(){var e,t,n=a()({},g.getFieldsValue()),i=null==n||null===(e=n.path)||void 0===e?void 0:e.split("");(null==i||null===(t=i.filter((function(e){return"/"==e})))||void 0===t?void 0:t.length)>1&&(n.path=n.path.substring(0,n.path.length-1)),g.setFieldsValue(a()({},n)),m(n)},children:[(0,J.jsx)(U.Z.Item,{label:"文件名称或文件路径:",name:"path",children:(0,J.jsxs)(E.Z,{children:[(0,J.jsx)(I.Z,{children:(0,J.jsx)("span",{className:W.filePath,children:s.defaultPath+"/"})}),(0,J.jsx)(I.Z,{flex:"1",children:(0,J.jsx)(U.Z.Item,{name:"path",style:{marginBottom:0},rules:[{required:!0,message:"请输入文件名称"},{whitespace:!0,message:"请勿输入空格"}],children:(0,J.jsx)(H.Z,{placeholder:"请输入文件名称",size:"middle"})})})]})}),(0,J.jsx)(U.Z.Item,{label:"提交信息:",name:"commitMessage",rules:[{required:!0,message:"请输入提交信息"},{whitespace:!0,message:"请勿输入空格"}],children:(0,J.jsx)(H.Z,{placeholder:"请输入本次提交的主要信息,合理的描述信息有利于代码历史记录的管理",size:"middle"})}),(0,J.jsx)("div",{className:"mt10 mb20",children:(0,J.jsx)(U.Z.Item,{name:"codeMirror",label:"文件内容:",rules:[{required:!0,message:"请输入文件内容"}],style:{marginBottom:0},children:(0,J.jsx)(X.h,{options:{modal:"javascript",lineNumbers:!0,theme:"railscasts",indentUnit:4,matchBrackets:!0,autoRefresh:!0,smartIndent:!0,extraKeys:{"Alt-/":"autocomplete"},autofocus:!0,styleActiveLine:!0,lint:!0,linkurl:"",gutters:["CodeMirror-linenumbers","breakpoints","CodeMirror-lint-markers"]}})})})]})})})})})),ne=["shixunsDetail","globalSetting","loading","user","dispatch","isRepository"],ie=(0,D.connect)((function(e){var t=e.shixunsDetail,n=e.loading;return{shixunsDetail:t,globalSetting:e.globalSetting,user:e.user,loading:n.models.index}}))((function(e){e.shixunsDetail,e.globalSetting,e.loading,e.user;var t=e.dispatch,n=e.isRepository,i=p()(e,ne),s=(0,D.useLocation)(),l=(0,D.useParams)(),c=(0,h.useState)({}),d=u()(c,2),f=(d[0],d[1]),m=(0,h.useRef)(),v=U.Z.useForm(),x=u()(v,1)[0],g=(0,h.useState)(""),_=u()(g,2),y=_[0],j=_[1],b=(0,h.useState)(""),w=u()(b,2),k=w[0],Z=w[1];(0,h.useEffect)((function(){i.visible&&x.resetFields()}),[i.visible]),(0,h.useEffect)((function(){var e=i.defaultPath.split("/");1===e.length?(j(""),Z(i.defaultPath)):(Z(e.pop()),j(e.join("/")+"/"))}),[i.defaultPath]),(0,h.useEffect)((function(){var e;m.current=null===(e=s.pathname)||void 0===e||null===(e=e.split("/"))||void 0===e?void 0:e[2]}),[]);var S=function(){var e=o()(r()().mark((function e(){var a,s,o=arguments;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.length>0&&void 0!==o[0]?o[0]:{},e.next=3,t({type:"shixunsDetail/moveGitFile",payload:{id:l.id,from:i.defaultPath,to:y+a.path,message:a.commitMessage||"".concat(i.defaultPath," rename to ").concat(y).concat(a.path," "),secret_repository:n}});case 3:0===(null==(s=e.sent)?void 0:s.status)&&(R.ZP.success("添加成功"),i.onOK({path:a.path,name:a.path}),i.onClose());case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,J.jsx)(O.Z,{width:"40%",open:i.visible,wrapClassName:W.modal,centered:!0,onOk:function(){x.submit()},onCancel:i.onClose,title:"提交说明",children:(0,J.jsx)("section",{className:W.bg,children:(0,J.jsx)("div",{className:W.wrap,children:(0,J.jsxs)(U.Z,{className:"mt10",form:x,scrollToFirstError:!0,layout:"vertical",onFinish:S,onChange:function(){var e,t,n=a()({},x.getFieldsValue()),i=null==n||null===(e=n.path)||void 0===e?void 0:e.split("");(null==i||null===(t=i.filter((function(e){return"/"==e})))||void 0===t?void 0:t.length)>1&&(n.path=n.path.substring(0,n.path.length-1)),x.setFieldsValue(a()({},n)),f(n)},children:[(0,J.jsx)(U.Z.Item,{label:"重命名:",name:"path",children:(0,J.jsx)(E.Z,{children:(0,J.jsx)(I.Z,{flex:"1",children:(0,J.jsx)(U.Z.Item,{name:"path",rules:[{required:!0,message:"请输入文件名称"},{whitespace:!0,message:"请勿输入空格"}],children:(0,J.jsx)(H.Z,{placeholder:"请输入文件名称",size:"middle",defaultValue:k})})})})}),(0,J.jsx)(U.Z.Item,{label:"提交信息:",name:"commitMessage",children:(0,J.jsx)(H.Z,{placeholder:"如不填写,默认提交信息是(".concat(i.defaultPath," rename to 新的名称 )"),size:"middle"})})]})})})})})),ae=n(27065),se=n(51136),re=n(21068),le=n(77135),oe={wrap:"wrap___T4tjB",title:"title____QnQT",path:"path___PLUeD",colorBlue:"colorBlue___eL7QF"},ce=["shixunsDetail","globalSetting","loading","user","dispatch","isRepository"],ue=re.Z.Dragger,de=(0,D.connect)((function(e){var t=e.shixunsDetail,n=e.loading;return{shixunsDetail:t,globalSetting:e.globalSetting,user:e.user,loading:n.models.index}}))((function(e){var t,n=e.shixunsDetail,i=(e.globalSetting,e.loading,e.user,e.dispatch),s=e.isRepository,l=p()(e,ce),c=(0,D.useLocation)(),d=(0,D.useParams)(),f=(0,h.useState)({}),m=u()(f,2),v=m[0],x=m[1],g=(0,h.useRef)(),_=U.Z.useForm(),y=u()(_,1)[0],j=(0,h.useState)([]),b=u()(j,2),w=b[0],k=b[1],Z=(0,h.useState)(),S=u()(Z,2),N=S[0],C=S[1];(0,h.useEffect)((function(){l.visible&&(y.resetFields(),k([]))}),[l.visible]),(0,h.useEffect)((function(){g.current=d.id}),[]),(0,h.useEffect)((function(){var e=sessionStorage.getItem("pathArray");if(e){var t=e.split(",").join("/"),n=0===t.indexOf("/")?t.substr(1):t;C(n)}}),[]);var P,F=function(){var e=o()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.response){e.next=3;break}return R.ZP.info("还未上传完成,无法进行删除操作!"),e.abrupt("return");case 3:return e.next=5,i({type:"shixunsDetail/deleteGitFile",payload:{id:d.id,path:N?"".concat(N,"/").concat(t.name):t.name,message:y.getFieldValue("commitMessage")||"删除了".concat(N?"".concat(N,"/").concat(t.name):t.name),secret_repository:!s||null}});case 5:0===e.sent.status&&(k(w.filter((function(e){return e.uid!==t.uid}))),R.ZP.info("删除成功"));case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),T={height:300,multiple:!0,withCredentials:!0,openFileDialogOnClick:Boolean(y.getFieldValue("commitMessage")),data:(P=o()(r()().mark((function e(){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=o()(r()().mark((function e(n,i){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:setTimeout(o()(r()().mark((function e(){var i;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.getFieldsValue();case 2:e.sent,i=a()(a()({},{path:l.defaultPath?l.defaultPath:"",message:v.commitMessage||"上传了".concat(t)}),s?{}:{secret_repository:!0}),n(i);case 5:case"end":return e.stop()}}),e)}))),200);case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(){return P.apply(this,arguments)}),fileList:w,method:"post",action:"".concat(ae.Z.API_SERVER,"/api/shixuns/").concat(g.current,"/upload_git_file.json"),onChange:function(e){if(t=e.file.name,"done"===e.file.status||"uploading"===e.file.status){var i,a,s,r;if(k(e.fileList),!e.file.response)return;if(0===(null===(i=e.file.response)||void 0===i?void 0:i.status))return void(null!=n&&null!==(r=n.detail)&&void 0!==r&&r.copy_for_exercise||(R.ZP.success("上传成功!"),y.validateFields()));k(w.filter((function(t){return t.uid!==e.file.uid}))),(null===(a=e.file.response)||void 0===a?void 0:a.message)&&R.ZP.info(null===(s=e.file.response)||void 0===s?void 0:s.message)}},onRemove:F,beforeUpload:function(e){return t=e.name,!(e.size/1024/1024>50)||(R.ZP.info("文件大小必须小于50MB"),!1)}},L=function(){var e=o()(r()().mark((function e(){var o,c,u,p,h,f,m=arguments;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=m.length>0&&void 0!==m[0]&&m[0],u=m.length>1&&void 0!==m[1]?m[1]:1,p=a()(a()({},{path:l.defaultPath?l.defaultPath:"",message:v.commitMessage||"上传了".concat(t)}),s?{}:{secret_repository:!0}),h=r()().mark((function e(){var t;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=new FormData).append("file",w[f].originFileObj),t.append("sync_origin_shixun",c.toString()),Object.keys(p).forEach((function(e){t.append(e,p[e].toString())})),e.next=6,(0,se.ZP)("/api/shixuns/".concat(g.current,"/upload_git_file.json"),{method:"post",body:t},!0);case 6:e.sent;case 7:case"end":return e.stop()}}),e)})),f=0;case 5:if(!(f0&&void 0!==n[0]?n[0]:"",e.next=3,(0,ye.Zt)({id:b.id,secret_dir_path:t});case 3:e.sent&&Ke(t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ye=function(e){var t;return(0,J.jsxs)(L.Z,{className:pe.menu,onClick:function(t){switch(le(e.path||""),t.key){case"1":(0,je.L9)(["实践项目","设置","代码仓库","新建文件"]),F(!0);break;case"2":(0,je.L9)(["实践项目","设置","代码仓库","新建文件夹"]),Q(!0);break;case"3":(0,je.L9)(["实践项目","设置","代码仓库","上传"]),ne(!0);break;case"4":(0,je.L9)(["实践项目","设置","代码仓库","重命名"]),q(!0);break;case"5":(0,je.L9)(["实践项目","设置","代码仓库","删除"]),rt(e.path,e.name,e);break;case"6":(0,je.L9)(["实践项目","设置","代码仓库","复制路径"]),lt(e)}},children:[("topTree"===e.type||"tree"===e.type)&&(0,J.jsx)(L.Z.Item,{children:"新建文件"},"1"),("topTree"===e.type||"tree"===e.type)&&(0,J.jsx)(L.Z.Item,{children:"新建文件夹"},"2"),("topTree"===e.type||"tree"===e.type)&&(0,J.jsx)(L.Z.Item,{children:"上传"},"3"),"topTree"!==e.type&&"tree"!==e.type&&(null==f||null===(t=f.detail)||void 0===t?void 0:t.public)<2&&(0,J.jsx)(L.Z.Item,{children:"重命名"},"4"),"topTree"!==e.type&&(0,J.jsx)(K.CopyToClipboard,{text:"/data/workspace/myshixun/".concat(_?"":"secret/").concat(null==e?void 0:e.path),onCopy:function(){return R.ZP.success("复制成功")},children:(0,J.jsx)(L.Z.Item,{children:(0,J.jsx)(J.Fragment,{children:"复制路径"})},"6")}),"topTree"!==e.type&&(0,J.jsx)(L.Z.Item,{children:"删除"},"5")]})},Xe=function(e,t){return e.map((function(e){return e.path=""==t?t+e.name:t+"/"+e.name,e.title=(0,J.jsxs)(E.Z,{className:"font14",children:[(0,J.jsx)(I.Z,{flex:"1",children:(0,J.jsxs)(E.Z,{children:["blob"===e.type&&(0,J.jsx)(I.Z,{flex:"20px",style:{marginLeft:-20},children:(0,J.jsx)("span",{className:"iconfont icon-wenjian11 font12"})}),(0,J.jsx)(I.Z,{flex:"1",children:(0,J.jsx)("span",{className:" multi_ellipsis1",children:e.name})})]})}),(0,J.jsx)(I.Z,{children:("blob"===e.type||"tree"===e.type)&&(0,J.jsx)(B.Z,{dropdownRender:function(){return Ye(e)},className:pe.ellipsis,children:(0,J.jsx)("i",{className:"iconfont icon-gengduo2 c-555a88"})})})]}),e.disableCheckbox=S&&S!==e.name,e.className="tree"===e.type?pe.pl23:"",e.checkable="tree"!==e.type,e.isLeaf="tree"!==e.type,e.children="tree"===e.type&&[],e.key=e.path,e}))},$e=function(e){x({type:"practiceSetting/setSideBarTabs",payload:{selectPath:e}})},et=function(){var e=o()(r()().mark((function e(t,n){var i;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.split("/"),e.next=3,it(re);case 3:setTimeout((function(){$e(t),ue=[i[0]||""],ve=[t],we(A()(ve)),he(A()(ue))}),150);case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),tt=function(e,t){if(""==t)y=A()(e),j(A()(e));else{var n=nt(y,t,e);y=n,j([].concat(n))}};function nt(e,t,n){return e.map((function(e){return e.key===t?(e.children=A()(n),a()({},e)):e.children?a()(a()({},e),{},{children:nt(e.children,t,n)}):e}))}var it=function(){var e=o()(r()().mark((function e(){var t,n,i,a,s,l=arguments;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:"",e.next=3,x({type:_?"shixunsDetail/getRepository":"shixunsDetail/getSecretRepository",payload:{id:b.id,path:t}});case 3:return(n=e.sent)&&(null!==(i=n.trees)&&void 0!==i&&i.length?(s=Xe(A()(n.trees),t),tt(s,t),Pe(n.trees||[]),Me(t||""),console.log("handleGetRepository:",s,t),setTimeout((function(){return console.log(y,n.trees,t,999999)}),2e3)):""==t&&j([]),Ie((null===(a=n.commits)||void 0===a?void 0:a[0])||{})),e.abrupt("return",n);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),at=function(){var e=o()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=o()(r()().mark((function e(n,i){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.children.length&&n(),Ae(t.path),e.next=4,it(t.path);case 4:n();case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),st=function(){var e=o()(r()().mark((function e(t,n){var i,a;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("handleSelectTree",t,n.nativeEvent.target.nodeName,n),i=function(){$e(n.node.path),t=[n.node.path],we(A()(t))},"svg"!==n.nativeEvent.target.nodeName&&"LI"!==n.nativeEvent.target.nodeName&&"I"!==n.nativeEvent.target.nodeName){e.next=4;break}return e.abrupt("return");case 4:"blob"===n.node.type&&(null!=g&&null!==(a=g.sideBar)&&void 0!==a&&a.confirmLeave?O.Z.confirm({title:"离开此页提示",content:"系统可能不会保存您所做的更改。",okText:"离开",cancelText:"取消",onOk:function(){i(),x({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})}}):i());case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),rt=function(e,t,n){var i;O.Z.confirm({centered:!0,title:"确认需要删除该文件".concat(n.children?"夹":"","?"),okText:"确定",cancelText:"取消",onOk:(i=o()(r()().mark((function t(){var n,i,a;return r()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x({type:"shixunsDetail/deleteGitFile",payload:{id:b.id,path:e,message:"删除".concat(e),secret_repository:!_||null}});case 2:if(n=t.sent,i=e.split("/"),0!==(null==n?void 0:n.status)){t.next=20;break}return R.ZP.info("删除成功"),i.splice(i.length-1,1),t.next=9,it(i.length>1?i.join("/"):"");case 9:if(null==(a=t.sent)||!a.trees){t.next=13;break}t.next=16;break;case 13:return i.splice(i.length-1,1),t.next=16,it(i.length>1?i.join("/"):"");case 16:return $e(""),t.abrupt("return",!0);case 20:-3===(null==n?void 0:n.status)?O.Z.confirm({title:"删除失败",centered:!0,content:(0,J.jsxs)("div",{children:["该文件“",e,"”已经被任务关卡的学员任务文件或评测执行文件使用,请先修改任务关卡中评测设置的文件路径后再删除。"]}),okText:"前往修改",cancelText:"取消",onOk:function(){window.location.href="/shixuns/".concat(b.id,"/edit/").concat(null==n?void 0:n.message,"/tab=2")}}):-4===(null==n?void 0:n.status)&&O.Z.confirm({title:"删除失败",centered:!0,content:(0,J.jsx)("div",{children:null==n?void 0:n.message}),okText:"前往修改",cancelText:"取消",onOk:function(){window.location.href="/shixuns/".concat(b.id,"/edit?tabId=service")}});case 21:case"end":return t.stop()}}),t)}))),function(){return i.apply(this,arguments)})})},lt=function(e){console.log(e,"item")},ot=function(){var e=o()(r()().mark((function e(t,n){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("handleExpand",n),"svg"!==n.nativeEvent.target.nodeName&&"path"!==n.nativeEvent.target.nodeName&&"LI"!==n.nativeEvent.target.nodeName){e.next=5;break}return e.abrupt("return",!0);case 5:return e.next=7,at(n.node);case 7:ue.includes(n.node.path)?ue.splice(ue.indexOf(n.node.path),1):ue.push(n.node.path);case 8:he(A()(ue));case 9:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),ct=function(){Re(!1),localStorage.warehouseHideTip=!0},ut=function(){var e=o()(r()().mark((function e(t){var n,i,a,s,l;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a="",e.t0=_,e.next=!0===e.t0?4:!1===e.t0?9:11;break;case 4:return a="开启版本库",s="开启",l="不开启",i=(0,J.jsx)("div",{children:"新建实践题关卡时,需要使用代码仓库;如果只有选择题关卡,则不需要代码仓库。代码仓库启用后,将无法关闭。"}),e.abrupt("break",11);case 9:return null!=f&&null!==(n=f.detail)&&void 0!==n&&n.secret_repository?(a="关闭私密代码仓库",s="确定",l="取消",i=(0,J.jsx)("div",{children:"关闭私密代码仓库后,已创建的私密代码仓库及其内容,将被删除。确认要关闭私密代码仓库?"})):(a="开启私密代码仓库",s="不使用",l="使用",i=(0,J.jsx)("div",{children:"私密版本库的文件对学员始终隐藏,无法访问查看。适用于命令行、图形化桌面两类实训,其他类型实训不建议使用私密版本库。"})),e.abrupt("break",11);case 11:if(_||!(0,be.gy)(x,"不能开启/关闭私密代码仓库")){e.next=13;break}return e.abrupt("return");case 13:O.Z.confirm({title:a,okText:s,cancelText:l,content:i,onOk:function(){var e;(0,je.L9)(["实践项目","设置","代码仓库",a]),(_||null!=f&&null!==(e=f.detail)&&void 0!==e&&e.secret_repository)&&dt(t)},onCancel:function(){var e;_||null!=f&&null!==(e=f.detail)&&void 0!==e&&e.secret_repository||dt(t)}});case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),dt=function(){var e=o()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!_){e.next=6;break}return e.next=3,(0,ye.h4)(a()({},b));case 3:x({type:"practiceSetting/getCommonData",payload:a()({},b)}),e.next=8;break;case 6:return e.next=8,(0,ye.K0)(a()(a()({},b),{},{is_secret_repository:t}));case 8:it(),x({type:"shixunsDetail/getShixunsDetail",payload:{id:b.id}});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),pt=function(){var e=o()(r()().mark((function e(t){var n,i;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log(t),t.node.key,t.dragNode.key,n=t.node.pos.split("-"),t.dropPosition-Number(n[n.length-1]),"tree"!==t.dragNode.type){e.next=8;break}return R.ZP.warning("不支持文件夹移动目录"),e.abrupt("return");case 8:if("tree"===t.node.type){e.next=11;break}return R.ZP.warning("未移动文件目录位置"),e.abrupt("return");case 11:return e.next=13,x({type:"shixunsDetail/moveGitFile",payload:{id:b.id,from:t.dragNode.path,to:t.node.path+"/"+t.dragNode.name,message:"".concat(t.dragNode.path," move to ").concat(t.node.path+"/"+t.dragNode.name," ")}});case 13:if(0!==e.sent.status){e.next=26;break}return $e(""),e.next=18,it("");case 18:i=0;case 19:if(!(i0&&void 0!==c[0]&&c[0],s=c.length>1&&void 0!==c[1]?c[1]:1,e.next=4,ie({type:"shixunsDetail/updateRepositoryFile",payload:{id:Oe.id,path:null==se||null===(t=se.fileContent)||void 0===t||null===(t=t.params)||void 0===t?void 0:t.path,content:ve,secret_repository:!je||null,sync_origin_shixun:i}});case 4:null!=(l=e.sent)&&l.content&&(null!=se&&null!==(o=se.detail)&&void 0!==o&&o.copy_for_exercise||R.ZP.success("保存成功"),ie({type:"practiceSetting/setSideBarTabs",payload:a()(a()({},ae.sideBar),{},{confirmLeave:!1})})),null!=se&&null!==(n=se.detail)&&void 0!==n&&n.copy_for_exercise&&(0,$.m)(ie,se,Oe.id,s);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,J.jsxs)("div",{className:m,children:[(0,J.jsx)("div",{className:v,children:(0,J.jsxs)(E.Z,{align:"middle",className:"w100 c-white",style:{height:60},children:[(0,J.jsx)(I.Z,{flex:"1",children:(0,J.jsxs)(E.Z,{align:"middle",children:[(0,J.jsx)(I.Z,{children:(0,J.jsx)(B.Z,{dropdownRender:function(){return Ve},className:f,children:(0,J.jsxs)("span",{className:"font16 c-white current ml20",children:[Me.find((function(e){return e.id===oe})).name," ",(0,J.jsx)("span",{style:{color:"#B0B5D6"},className:"iconfont icon-sanjiaoxing font12"})]})})}),(0,J.jsx)(I.Z,{flex:"81px",children:(0,J.jsx)("div",{className:k})}),(0,J.jsx)(I.Z,{children:(0,J.jsxs)(F.Z,{className:w,activeKey:pe,onChange:function(e){var t;null!=ae&&null!==(t=ae.sideBar)&&void 0!==t&&t.confirmLeave?O.Z.confirm({title:"离开此页提示",content:"系统可能不会保存您所做的更改。",okText:"离开",cancelText:"取消",onOk:function(){he(e),ie({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1,selectPath:""}})}}):(he(e),ie({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1,selectPath:""}}))},children:[(0,J.jsx)(Le,{tab:(0,J.jsx)("span",{className:"leaveClick",children:"代码文件"})},"1"),je&&(null==se||null===(s=se.detail)||void 0===s?void 0:s.init_repository)&&(0,J.jsx)(Le,{tab:"提交记录",className:"leaveClick"},"2"),!je&&(null==se||null===(l=se.detail)||void 0===l?void 0:l.secret_repository)&&(0,J.jsx)(Le,{tab:"提交记录",className:"leaveClick"},"2")]})})]})}),(je&&(null==se||null===(c=se.repository)||void 0===c?void 0:c.git_url)||!je&&(null==se||null===(d=se.secretRepository)||void 0===d?void 0:d.git_url))&&(0,J.jsx)(J.Fragment,{children:(0,J.jsxs)(I.Z,{children:[(0,J.jsx)("span",{className:x,children:"仓库地址:"}),(0,J.jsx)("input",{value:je?null==se||null===(z=se.repository)||void 0===z?void 0:z.git_url:null==se||null===(A=se.secretRepository)||void 0===A?void 0:A.git_url}),(0,J.jsx)(K.CopyToClipboard,{text:je?null==se||null===(q=se.repository)||void 0===q?void 0:q.git_url:null==se||null===(G=se.secretRepository)||void 0===G?void 0:G.git_url,onCopy:function(){return R.ZP.success("复制成功")},children:(0,J.jsx)(T.Z,{placement:"topLeft",title:"点击复制版本库",children:(0,J.jsx)("i",{className:"iconfont icon-fuzhi2 current ml5 mr40"})})})]})})]})}),(0,J.jsxs)("div",{className:g,style:{overflow:"auto"},children:["1"===pe&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("aside",{className:_,children:(0,J.jsx)(M.Z,{spinning:!!ne.effects["shixunsDetail/getRepository"],wrapperClassName:"".concat(j," ").concat(P),children:(0,J.jsx)(Ne,{setTreeData:Ie,treeData:Ee,activeKey:oe,isRepository:je})})}),(0,J.jsxs)("aside",{className:y,ref:Be,children:[""!==(null==ae||null===(U=ae.sideBar)||void 0===U?void 0:U.selectPath)&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(M.Z,{spinning:!!ne.effects["shixunsDetail/getFileContent"],wrapperClassName:j,children:[(0,J.jsx)("div",{className:N,children:(0,J.jsxs)(E.Z,{align:"middle",className:"w100",children:[(0,J.jsx)(I.Z,{children:(0,J.jsx)("span",{className:"iconfont icon-daimacangku2 c-white"})}),(0,J.jsx)(I.Z,{flex:"40px",children:(0,J.jsx)("div",{className:k,style:{marginLeft:20}})}),(0,J.jsx)(I.Z,{className:C,children:Se.map((function(e,t){return(0,J.jsx)("span",{className:"c-blue",children:e})}))})]})}),(0,J.jsx)("div",{className:ne.effects["shixunsDetail/getFileContent"]?"hide":"show",children:(0,J.jsx)(Te.Z,{className:"darkBlue",style:{top:66,height:"calc(100% - 60px)",position:"absolute",zIndex:1},filename:null==se||null===(H=se.fileContent)||void 0===H?void 0:H.filename,type:"office"===(null==se||null===(W=se.fileContent)||void 0===W?void 0:W.file_type)?"download":null==se||null===(Q=se.fileContent)||void 0===Q?void 0:Q.file_type,data:ve,monacoEditor:{value:ve,language:null==se||null===(Y=se.fileContent)||void 0===Y?void 0:Y.language,onChange:function(e){return function(e){xe(e);var t=-1;t=e===ge.current?0:1,ie({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!!t}})}(e)},options:{fontSize:14}}})})]}),"txt"===(null==se||null===(X=se.fileContent)||void 0===X?void 0:X.file_type)&&(0,J.jsx)(E.Z,{align:"middle",justify:"center",className:Z,children:(0,J.jsxs)(I.Z,{children:[(0,J.jsx)(V.ZP,{type:"primary",size:"middle",ghost:!0,onClick:function(){D.history.push("/shixuns/".concat(Oe.id,"/challenges"))},children:"取消"}),(0,J.jsx)(V.ZP,{type:"primary",size:"middle",className:"ml40",onClick:function(e){var t,n;null!=se&&null!==(t=se.detail)&&void 0!==t&&t.is_fork_from_creator&&null!=se&&null!==(n=se.detail)&&void 0!==n&&n.copy_for_exercise?ie({type:"classroomList/setActionTabs",payload:{key:"同步修改",type:"wareHouse",fn:function(e,t){ze(e,t)}}}):ze()},children:"提交"})]})})]}),""==(null==ae||null===(ee=ae.sideBar)||void 0===ee?void 0:ee.selectPath)&&(null==se||null===(te=se.detail)||void 0===te?void 0:te.init_repository)&&(0,J.jsxs)("div",{className:b,children:[(0,J.jsx)("img",{src:we.x7,width:"258"}),(0,J.jsx)("br",{}),(0,J.jsxs)("span",{className:"c-grey-c",children:[!(null==Ee||!Ee.length)&&"在左侧代码仓库区域点击目录打开文件",!(null!=Ee&&Ee.length)&&"请先在左侧上传文件或新建文件!"]})]})]})]}),"2"===pe&&(0,J.jsx)("div",{className:S,children:(0,J.jsx)(Fe,{isRepository:je})})]})]})}))},55648:function(e,t,n){n.d(t,{S:function(){return d},m:function(){return p}});var i=n(7557),a=n.n(i),s=n(41498),r=n.n(s),l=n(6457),o=n(8591),c=n(43418),u=n(37712),d=function(e){var t=document.createElement("textarea");return t.value=e,t.value},p=function(){var e=r()(a()().mark((function e(t,n,i,s,r){var d,p,h;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t({type:"shixunsDetail/saveCopyForExercise",payload:{id:i,save_type:s}});case 2:d=e.sent,1===s?(0==(null==d?void 0:d.status)&&o.ZP.success("保存成功"),null!=d&&null!==(p=d.data)&&void 0!==p&&p.exists_same_shixun_name?t({type:"classroomList/setActionTabs",payload:{key:"重名修改",name:null==d||null===(h=d.data)||void 0===h?void 0:h.shixun_name}}):t({type:"classroomList/setActionTabs",payload:{}})):(t({type:"classroomList/setActionTabs",payload:{}}),0===(null==d?void 0:d.status)&&c.Z.info({title:"提示",width:460,icon:null,centered:!0,content:(0,u.jsx)("div",{children:(0,u.jsx)("div",{children:"实训同步修改完成,请验证实训是否可以正常使用。"})}),okText:"前往原实训",onOk:function(){var e;(0,l.xg)("/shixuns/".concat(null==n||null===(e=n.detail)||void 0===e||null===(e=e.fork_from)||void 0===e?void 0:e.fork_identifier,"/challenges"))}}));case 4:case"end":return e.stop()}}),e)})));return function(t,n,i,a,s){return e.apply(this,arguments)}}()}}]);