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

2 lines
28 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[138],{"9ivq":function(ge,ie,N){},axZZ:function(ge,ie,N){"use strict";N.r(ie);var Me=N("DZo9"),ye=N("8z0m"),$e=N("+L6B"),ee=N("2/Rp"),Xe=N("miYZ"),z=N("tsqr"),te=N("9og8"),Y=N("tJVT"),G=N("q1tI"),O=N.n(G),Fe=N("5NDa"),Ee=N("5rEg"),be=N("Ot1p"),re=N("ErOA");function Q(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Q=function(){return s};var s={},g=Object.prototype,h=g.hasOwnProperty,p=Object.defineProperty||function(r,e,t){r[e]=t.value},R=typeof Symbol=="function"?Symbol:{},j=R.iterator||"@@iterator",I=R.asyncIterator||"@@asyncIterator",P=R.toStringTag||"@@toStringTag";function f(r,e,t){return Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{f({},"")}catch(r){f=function(t,n,a){return t[n]=a}}function T(r,e,t,n){var a=e&&e.prototype instanceof k?e:k,o=Object.create(a.prototype),i=new D(n||[]);return p(o,"_invoke",{value:V(r,t,i)}),o}function c(r,e,t){try{return{type:"normal",arg:r.call(e,t)}}catch(n){return{type:"throw",arg:n}}}s.wrap=T;var d={};function k(){}function y(){}function v(){}var C={};f(C,j,function(){return this});var U=Object.getPrototypeOf,E=U&&U(U(F([])));E&&E!==g&&h.call(E,j)&&(C=E);var S=v.prototype=k.prototype=Object.create(C);function b(r){["next","throw","return"].forEach(function(e){f(r,e,function(t){return this._invoke(e,t)})})}function A(r,e){function t(a,o,i,u){var l=c(r[a],r,o);if(l.type!=="throw"){var _=l.arg,m=_.value;return m&&typeof m=="object"&&h.call(m,"__await")?e.resolve(m.__await).then(function(w){t("next",w,i,u)},function(w){t("throw",w,i,u)}):e.resolve(m).then(function(w){_.value=w,i(_)},function(w){return t("throw",w,i,u)})}u(l.arg)}var n;p(this,"_invoke",{value:function(o,i){function u(){return new e(function(l,_){t(o,i,l,_)})}return n=n?n.then(u,u):u()}})}function V(r,e,t){var n="suspendedStart";return function(a,o){if(n==="executing")throw new Error("Generator is already running");if(n==="completed"){if(a==="throw")throw o;return x()}for(t.method=a,t.arg=o;;){var i=t.delegate;if(i){var u=H(i,t);if(u){if(u===d)continue;return u}}if(t.method==="next")t.sent=t._sent=t.arg;else if(t.method==="throw"){if(n==="suspendedStart")throw n="completed",t.arg;t.dispatchException(t.arg)}else t.method==="return"&&t.abrupt("return",t.arg);n="executing";var l=c(r,e,t);if(l.type==="normal"){if(n=t.done?"completed":"suspendedYield",l.arg===d)continue;return{value:l.arg,done:t.done}}l.type==="throw"&&(n="completed",t.method="throw",t.arg=l.arg)}}}function H(r,e){var t=e.method,n=r.iterator[t];if(n===void 0)return e.delegate=null,t==="throw"&&r.iterator.return&&(e.method="return",e.arg=void 0,H(r,e),e.method==="throw")||t!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+t+"' method")),d;var a=c(n,r.iterator,e.arg);if(a.type==="throw")return e.method="throw",e.arg=a.arg,e.delegate=null,d;var o=a.arg;return o?o.done?(e[r.resultName]=o.value,e.next=r.nextLoc,e.method!=="return"&&(e.method="next",e.arg=void 0),e.delegate=null,d):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function Z(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function X(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function D(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(Z,this),this.reset(!0)}function F(r){if(r){var e=r[j];if(e)return e.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var t=-1,n=function a(){for(;++t<r.length;)if(h.call(r,t))return a.value=r[t],a.done=!1,a;return a.value=void 0,a.done=!0,a};return n.next=n}}return{next:x}}function x(){return{value:void 0,done:!0}}return y.prototype=v,p(S,"constructor",{value:v,configurable:!0}),p(v,"constructor",{value:y,configurable:!0}),y.displayName=f(v,P,"GeneratorFunction"),s.isGeneratorFunction=function(r){var e=typeof r=="function"&&r.constructor;return!!e&&(e===y||(e.displayName||e.name)==="GeneratorFunction")},s.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,v):(r.__proto__=v,f(r,P,"GeneratorFunction")),r.prototype=Object.create(S),r},s.awrap=function(r){return{__await:r}},b(A.prototype),f(A.prototype,I,function(){return this}),s.AsyncIterator=A,s.async=function(r,e,t,n,a){a===void 0&&(a=Promise);var o=new A(T(r,e,t,n),a);return s.isGeneratorFunction(e)?o:o.next().then(function(i){return i.done?i.value:o.next()})},b(S),f(S,P,"Generator"),f(S,j,function(){return this}),f(S,"toString",function(){return"[object Generator]"}),s.keys=function(r){var e=Object(r),t=[];for(var n in e)t.push(n);return t.reverse(),function a(){for(;t.length;){var o=t.pop();if(o in e)return a.value=o,a.done=!1,a}return a.done=!0,a}},s.values=F,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(X),!e)for(var t in this)t.charAt(0)==="t"&&h.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(_,m){return i.type="throw",i.arg=e,t.next=_,m&&(t.method="next",t.arg=void 0),!!m}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if(o.tryLoc==="root")return n("end");if(o.tryLoc<=this.prev){var u=h.call(o,"catchLoc"),l=h.call(o,"finallyLoc");if(u&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&h.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&(e==="break"||e==="continue")&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),X(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var a=n.completion;if(a.type==="throw"){var o=a.arg;X(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:F(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=void 0),d}},s}function we(s){var g=s.setIscreate,h=s.init,p=s.UpdateItem,R=Object(G.useState)(""),j=Object(Y.a)(R,2),I=j[0],P=j[1],f=Object(G.useState)(""),T=Object(Y.a)(f,2),c=T[0],d=T[1];Object(G.useEffect)(function(){if(!p)return;P(p&&p.name),d(p&&p.description)},[p]);function k(){return y.apply(this,arguments)}function y(){return y=Object(te.a)(Q().mark(function U(){var E;return Q().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(I){b.next=3;break}return z.b.info("\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A"),b.abrupt("return");case 3:if(c){b.next=6;break}return z.b.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A"),b.abrupt("return");case 6:if(!p){b.next=9;break}return v(),b.abrupt("return");case 9:return b.next=11,Object(re.a)("/api/hpc_courses.json",{method:"post",body:{name:I,description:c,container_type:window.location.pathname.split("/")[1]}});case 11:E=b.sent,E&&(z.b.info("\u521B\u5EFA\u6210\u529F"),g(!1),h("add"));case 13:case"end":return b.stop()}},U)})),y.apply(this,arguments)}function v(){return C.apply(this,arguments)}function C(){return C=Object(te.a)(Q().mark(function U(){var E;return Q().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,Object(re.a)("/api/hpc_courses/".concat(p.id,".json"),{method:"put",body:{name:I,description:c,container_type:window.location.pathname.split("/")[1]}});case 2:E=b.sent,E&&(z.b.info("\u7F16\u8F91\u6210\u529F"),g(!1),h(""));case 4:case"end":return b.stop()}},U)})),C.apply(this,arguments)}return O.a.createElement("div",null,O.a.createElement(Ee.a,{style:{marginBottom:"20px"},placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",value:I,maxLength:60,addonAfter:String(I.length)+"/60",onChange:function(E){return P(E.target.value)}}),O.a.createElement(be.a,{id:"courseContentMD",defaultValue:c,onChange:function(E){return d(E)}}),O.a.createElement("div",{className:"clearfix mt30 mb30"},O.a.createElement(ee.a,{type:"primary",onClick:function(){return k()},className:"defalutSubmitbtn fl mr20"},"\u63D0\u4EA4"),O.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return g(!1)}},"\u53D6\u6D88")))}var _e=we,Le=N("9Bee");function ue(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ue=function(){return s};var s={},g=Object.prototype,h=g.hasOwnProperty,p=Object.defineProperty||function(r,e,t){r[e]=t.value},R=typeof Symbol=="function"?Symbol:{},j=R.iterator||"@@iterator",I=R.asyncIterator||"@@asyncIterator",P=R.toStringTag||"@@toStringTag";function f(r,e,t){return Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{f({},"")}catch(r){f=function(t,n,a){return t[n]=a}}function T(r,e,t,n){var a=e&&e.prototype instanceof k?e:k,o=Object.create(a.prototype),i=new D(n||[]);return p(o,"_invoke",{value:V(r,t,i)}),o}function c(r,e,t){try{return{type:"normal",arg:r.call(e,t)}}catch(n){return{type:"throw",arg:n}}}s.wrap=T;var d={};function k(){}function y(){}function v(){}var C={};f(C,j,function(){return this});var U=Object.getPrototypeOf,E=U&&U(U(F([])));E&&E!==g&&h.call(E,j)&&(C=E);var S=v.prototype=k.prototype=Object.create(C);function b(r){["next","throw","return"].forEach(function(e){f(r,e,function(t){return this._invoke(e,t)})})}function A(r,e){function t(a,o,i,u){var l=c(r[a],r,o);if(l.type!=="throw"){var _=l.arg,m=_.value;return m&&typeof m=="object"&&h.call(m,"__await")?e.resolve(m.__await).then(function(w){t("next",w,i,u)},function(w){t("throw",w,i,u)}):e.resolve(m).then(function(w){_.value=w,i(_)},function(w){return t("throw",w,i,u)})}u(l.arg)}var n;p(this,"_invoke",{value:function(o,i){function u(){return new e(function(l,_){t(o,i,l,_)})}return n=n?n.then(u,u):u()}})}function V(r,e,t){var n="suspendedStart";return function(a,o){if(n==="executing")throw new Error("Generator is already running");if(n==="completed"){if(a==="throw")throw o;return x()}for(t.method=a,t.arg=o;;){var i=t.delegate;if(i){var u=H(i,t);if(u){if(u===d)continue;return u}}if(t.method==="next")t.sent=t._sent=t.arg;else if(t.method==="throw"){if(n==="suspendedStart")throw n="completed",t.arg;t.dispatchException(t.arg)}else t.method==="return"&&t.abrupt("return",t.arg);n="executing";var l=c(r,e,t);if(l.type==="normal"){if(n=t.done?"completed":"suspendedYield",l.arg===d)continue;return{value:l.arg,done:t.done}}l.type==="throw"&&(n="completed",t.method="throw",t.arg=l.arg)}}}function H(r,e){var t=e.method,n=r.iterator[t];if(n===void 0)return e.delegate=null,t==="throw"&&r.iterator.return&&(e.method="return",e.arg=void 0,H(r,e),e.method==="throw")||t!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+t+"' method")),d;var a=c(n,r.iterator,e.arg);if(a.type==="throw")return e.method="throw",e.arg=a.arg,e.delegate=null,d;var o=a.arg;return o?o.done?(e[r.resultName]=o.value,e.next=r.nextLoc,e.method!=="return"&&(e.method="next",e.arg=void 0),e.delegate=null,d):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function Z(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function X(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function D(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(Z,this),this.reset(!0)}function F(r){if(r){var e=r[j];if(e)return e.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var t=-1,n=function a(){for(;++t<r.length;)if(h.call(r,t))return a.value=r[t],a.done=!1,a;return a.value=void 0,a.done=!0,a};return n.next=n}}return{next:x}}function x(){return{value:void 0,done:!0}}return y.prototype=v,p(S,"constructor",{value:v,configurable:!0}),p(v,"constructor",{value:y,configurable:!0}),y.displayName=f(v,P,"GeneratorFunction"),s.isGeneratorFunction=function(r){var e=typeof r=="function"&&r.constructor;return!!e&&(e===y||(e.displayName||e.name)==="GeneratorFunction")},s.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,v):(r.__proto__=v,f(r,P,"GeneratorFunction")),r.prototype=Object.create(S),r},s.awrap=function(r){return{__await:r}},b(A.prototype),f(A.prototype,I,function(){return this}),s.AsyncIterator=A,s.async=function(r,e,t,n,a){a===void 0&&(a=Promise);var o=new A(T(r,e,t,n),a);return s.isGeneratorFunction(e)?o:o.next().then(function(i){return i.done?i.value:o.next()})},b(S),f(S,P,"Generator"),f(S,j,function(){return this}),f(S,"toString",function(){return"[object Generator]"}),s.keys=function(r){var e=Object(r),t=[];for(var n in e)t.push(n);return t.reverse(),function a(){for(;t.length;){var o=t.pop();if(o in e)return a.value=o,a.done=!1,a}return a.done=!0,a}},s.values=F,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(X),!e)for(var t in this)t.charAt(0)==="t"&&h.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(_,m){return i.type="throw",i.arg=e,t.next=_,m&&(t.method="next",t.arg=void 0),!!m}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if(o.tryLoc==="root")return n("end");if(o.tryLoc<=this.prev){var u=h.call(o,"catchLoc"),l=h.call(o,"finallyLoc");if(u&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&h.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&(e==="break"||e==="continue")&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),X(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var a=n.completion;if(a.type==="throw"){var o=a.arg;X(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:F(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=void 0),d}},s}function Oe(s){var g=s.CourseItem,h=s.userId,p=s.init,R=s.ItemUpdate,j=s.setSee,I=s.UserInfo;function P(){return f.apply(this,arguments)}function f(){return f=Object(te.a)(ue().mark(function c(){var d;return ue().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,Object(re.a)("/api/hpc_courses/".concat(g.id,".json"),{method:"delete"});case 2:d=y.sent,d&&(z.b.info("\u5220\u9664\u6210\u529F"),p("delete"),j(!1));case 4:case"end":return y.stop()}},c)})),f.apply(this,arguments)}function T(){R(g)}return O.a.createElement("div",null,h===299635||h===301458||(I==null?void 0:I.admin)||(I==null?void 0:I.business)?O.a.createElement("div",{style:{textAlign:"right"}},O.a.createElement(ee.a,{onClick:function(){return T()}},"\u7F16\u8F91"),O.a.createElement(ee.a,{onClick:function(){return P()},style:{marginLeft:"30px"}},"\u5220\u9664")):null,O.a.createElement("h1",null,g==null?void 0:g.name),O.a.createElement(Le.a,{value:g==null?void 0:g.description}))}var Se=Oe,xe=N("9ivq"),he=N("m3rI"),je=N("Ty5D"),Ie=N("9kvl");function se(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */se=function(){return s};var s={},g=Object.prototype,h=g.hasOwnProperty,p=Object.defineProperty||function(r,e,t){r[e]=t.value},R=typeof Symbol=="function"?Symbol:{},j=R.iterator||"@@iterator",I=R.asyncIterator||"@@asyncIterator",P=R.toStringTag||"@@toStringTag";function f(r,e,t){return Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{f({},"")}catch(r){f=function(t,n,a){return t[n]=a}}function T(r,e,t,n){var a=e&&e.prototype instanceof k?e:k,o=Object.create(a.prototype),i=new D(n||[]);return p(o,"_invoke",{value:V(r,t,i)}),o}function c(r,e,t){try{return{type:"normal",arg:r.call(e,t)}}catch(n){return{type:"throw",arg:n}}}s.wrap=T;var d={};function k(){}function y(){}function v(){}var C={};f(C,j,function(){return this});var U=Object.getPrototypeOf,E=U&&U(U(F([])));E&&E!==g&&h.call(E,j)&&(C=E);var S=v.prototype=k.prototype=Object.create(C);function b(r){["next","throw","return"].forEach(function(e){f(r,e,function(t){return this._invoke(e,t)})})}function A(r,e){function t(a,o,i,u){var l=c(r[a],r,o);if(l.type!=="throw"){var _=l.arg,m=_.value;return m&&typeof m=="object"&&h.call(m,"__await")?e.resolve(m.__await).then(function(w){t("next",w,i,u)},function(w){t("throw",w,i,u)}):e.resolve(m).then(function(w){_.value=w,i(_)},function(w){return t("throw",w,i,u)})}u(l.arg)}var n;p(this,"_invoke",{value:function(o,i){function u(){return new e(function(l,_){t(o,i,l,_)})}return n=n?n.then(u,u):u()}})}function V(r,e,t){var n="suspendedStart";return function(a,o){if(n==="executing")throw new Error("Generator is already running");if(n==="completed"){if(a==="throw")throw o;return x()}for(t.method=a,t.arg=o;;){var i=t.delegate;if(i){var u=H(i,t);if(u){if(u===d)continue;return u}}if(t.method==="next")t.sent=t._sent=t.arg;else if(t.method==="throw"){if(n==="suspendedStart")throw n="completed",t.arg;t.dispatchException(t.arg)}else t.method==="return"&&t.abrupt("return",t.arg);n="executing";var l=c(r,e,t);if(l.type==="normal"){if(n=t.done?"completed":"suspendedYield",l.arg===d)continue;return{value:l.arg,done:t.done}}l.type==="throw"&&(n="completed",t.method="throw",t.arg=l.arg)}}}function H(r,e){var t=e.method,n=r.iterator[t];if(n===void 0)return e.delegate=null,t==="throw"&&r.iterator.return&&(e.method="return",e.arg=void 0,H(r,e),e.method==="throw")||t!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+t+"' method")),d;var a=c(n,r.iterator,e.arg);if(a.type==="throw")return e.method="throw",e.arg=a.arg,e.delegate=null,d;var o=a.arg;return o?o.done?(e[r.resultName]=o.value,e.next=r.nextLoc,e.method!=="return"&&(e.method="next",e.arg=void 0),e.delegate=null,d):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function Z(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function X(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function D(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(Z,this),this.reset(!0)}function F(r){if(r){var e=r[j];if(e)return e.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var t=-1,n=function a(){for(;++t<r.length;)if(h.call(r,t))return a.value=r[t],a.done=!1,a;return a.value=void 0,a.done=!0,a};return n.next=n}}return{next:x}}function x(){return{value:void 0,done:!0}}return y.prototype=v,p(S,"constructor",{value:v,configurable:!0}),p(v,"constructor",{value:y,configurable:!0}),y.displayName=f(v,P,"GeneratorFunction"),s.isGeneratorFunction=function(r){var e=typeof r=="function"&&r.constructor;return!!e&&(e===y||(e.displayName||e.name)==="GeneratorFunction")},s.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,v):(r.__proto__=v,f(r,P,"GeneratorFunction")),r.prototype=Object.create(S),r},s.awrap=function(r){return{__await:r}},b(A.prototype),f(A.prototype,I,function(){return this}),s.AsyncIterator=A,s.async=function(r,e,t,n,a){a===void 0&&(a=Promise);var o=new A(T(r,e,t,n),a);return s.isGeneratorFunction(e)?o:o.next().then(function(i){return i.done?i.value:o.next()})},b(S),f(S,P,"Generator"),f(S,j,function(){return this}),f(S,"toString",function(){return"[object Generator]"}),s.keys=function(r){var e=Object(r),t=[];for(var n in e)t.push(n);return t.reverse(),function a(){for(;t.length;){var o=t.pop();if(o in e)return a.value=o,a.done=!1,a}return a.done=!0,a}},s.values=F,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(X),!e)for(var t in this)t.charAt(0)==="t"&&h.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(_,m){return i.type="throw",i.arg=e,t.next=_,m&&(t.method="next",t.arg=void 0),!!m}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if(o.tryLoc==="root")return n("end");if(o.tryLoc<=this.prev){var u=h.call(o,"catchLoc"),l=h.call(o,"finallyLoc");if(u&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&h.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&(e==="break"||e==="continue")&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),X(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var a=n.completion;if(a.type==="throw"){var o=a.arg;X(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:F(e),resultName:t,nextLoc:n},this.method==="next"&&(this.arg=void 0),d}},s}function Ne(s){var g,h,p,R,j,I,P,f,T,c=s.user,d=s.dispatch,k=Object(G.useState)(1),y=Object(Y.a)(k,2),v=y[0],C=y[1],U=Object(G.useState)(100),E=Object(Y.a)(U,2),S=E[0],b=E[1],A=Object(G.useState)([]),V=Object(Y.a)(A,2),H=V[0],Z=V[1],X=Object(G.useState)(!1),D=Object(Y.a)(X,2),F=D[0],x=D[1],r=Object(G.useState)(!1),e=Object(Y.a)(r,2),t=e[0],n=e[1],a=Object(G.useState)(""),o=Object(Y.a)(a,2),i=o[0],u=o[1],l=Object(G.useState)(""),_=Object(Y.a)(l,2),m=_[0],w=_[1],Ue=Object(G.useState)(""),pe=Object(Y.a)(Ue,2),ve=pe[0],Pe=pe[1],Re=Object(je.m)(),J=Re.itemname,Te=Object(G.useState)(""),me=Object(Y.a)(Te,2),ne=me[0],W=me[1];Object(G.useEffect)(function(){d({type:"globalSetting/headerToggle",payload:!1}),v&&oe("")},[v]);function oe(M){return ce.apply(this,arguments)}function ce(){return ce=Object(te.a)(se().mark(function M(B){var L,q,le,fe,ae;return se().wrap(function($){for(;;)switch($.prev=$.next){case 0:return $.next=2,Object(re.a)("/api/hpc_courses.json",{method:"get",params:{page:v,per_page:S,container_type:window.location.pathname.split("/")[1]}});case 2:if(L=$.sent,!L){$.next=24;break}if(q=L.data.hpc_courses.length,Z(L.data.hpc_courses),Pe(L.data.file_url),w(""),q){$.next=10;break}return $.abrupt("return");case 10:if(ne){$.next=14;break}J?(ae=0,L==null||((le=L.data)===null||le===void 0||((fe=le.hpc_courses)===null||fe===void 0))||fe.map(function(K,De){var de;(J==null?void 0:J.toLocaleLowerCase())===(K==null||((de=K.name)===null||de===void 0)?void 0:de.toLocaleLowerCase())&&(ae=De)}),u(L.data.hpc_courses[ae]),n(!0),W(L.data.hpc_courses[ae].id),(J==null?void 0:J.toLocaleLowerCase())==="resources"&&(u(L.data.hpc_courses.filter(function(K){return K.id===15})[0]),n(!0),W(15))):(u(L.data.hpc_courses[0]),n(!0),W(L.data.hpc_courses[0].id)),$.next=24;break;case 14:if(!(B==="delete")){$.next=23;break}if(!(q===0)){$.next=18;break}return n(!1),$.abrupt("return");case 18:u(L.data.hpc_courses[0]),n(!0),W(L.data.hpc_courses[0].id),$.next=24;break;case 23:B==="add"?(u(L.data.hpc_courses[q-1]),n(!0),W(L.data.hpc_courses[q-1].id)):(u(L.data.hpc_courses.filter(function(K){return K.id===ne})[0]),n(!0),W(ne));case 24:case"end":return $.stop()}},M)})),ce.apply(this,arguments)}function ke(M){x(!1),n(!0),u(M),W(M.id)}function Ce(M){w(M),x(!0),n(!1)}function Ae(){w(""),x(!0),n(!1)}var Ge={name:"file",multiple:!0,action:"https://www.educoder.net/api/hpc_courses/upload_file.json",data:{container_type:window.location.pathname.split("/")[1]},onChange:function(B){var L=B.file.status;L!=="uploading",L==="done"?(z.b.success("".concat(B.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")),oe("")):L==="error"&&z.b.error("".concat(B.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(B){var L=B.size/1024/1024<150;return L||z.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),L}};return O.a.createElement("div",{style:{marginBottom:"40px"}},O.a.createElement("div",{className:"bannterdiv",style:{background:"url(".concat(he.a.IMG_SERVER+"/".concat(ve),")")}}),O.a.createElement("img",{style:{width:"100%"},src:he.a.IMG_SERVER+"/".concat(ve)}),O.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},O.a.createElement("div",{style:{flex:"1",marginTop:"17px"}},H&&H.map(function(M,B){return O.a.createElement("p",{key:B,onClick:function(){return ke(M)},className:ne===M.id?"menuitemselect":"menuitem task-hide"},M.name)}),(c==null||((g=c.userInfo)===null||g===void 0)?void 0:g.user_id)===299635||(c==null||((h=c.userInfo)===null||h===void 0)?void 0:h.user_id)===301458||(c==null||((p=c.userInfo)===null||p===void 0)?void 0:p.admin)||(c==null||((R=c.userInfo)===null||R===void 0)?void 0:R.business)?O.a.createElement("p",{onClick:function(){return Ae()},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"}},O.a.createElement("span",{style:{fontSize:"16px",marginLeft:"5px"}},"Last updated")):null),O.a.createElement("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"}},F?O.a.createElement(_e,{UpdateItem:m,setIscreate:x,init:oe}):null,t?O.a.createElement(Se,{UserInfo:c==null?void 0:c.userInfo,setSee:n,userId:c==null||((j=c.userInfo)===null||j===void 0)?void 0:j.user_id,ItemUpdate:Ce,CourseItem:i,init:oe}):null)),(c==null||((I=c.userInfo)===null||I===void 0)?void 0:I.user_id)===299635||(c==null||((P=c.userInfo)===null||P===void 0)?void 0:P.user_id)===301458||(c==null||((f=c.userInfo)===null||f===void 0)?void 0:f.admin)||(c==null||((T=c.userInfo)===null||T===void 0)?void 0:T.business)?O.a.createElement(ye.a,Ge,O.a.createElement(ee.a,{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"}},"\u4E0A\u4F20\u9996\u9875\u56FE\u7247")):null)}var Ye=ie.default=Object(Ie.a)(function(s){var g=s.user;return{user:g}})(Ne)}}]);