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

1 line
27 KiB

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[135],{"9ivq":function(t,e,r){},axZZ:function(t,e,r){"use strict";r.r(e);r("DZo9");var n=r("8z0m"),o=(r("+L6B"),r("2/Rp")),i=(r("miYZ"),r("tsqr")),a=r("9og8"),c=r("tJVT"),u=r("q1tI"),l=r.n(u),s=(r("5NDa"),r("5rEg")),f=r("Ot1p"),h=r("ErOA");function p(){p=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),c=new G(n||[]);return o(a,"_invoke",{value:k(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",d="suspendedYield",v="executing",y="completed",m={};function g(){}function w(){}function b(){}var x={};l(x,a,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(T([])));L&&L!==r&&n.call(L,a)&&(x=L);var j=b.prototype=g.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==typeof s&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function k(e,r,n){var o=h;return function(i,a){if(o===v)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:d,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,o(j,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=l(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,u,"GeneratorFunction")),t.prototype=Object.create(j),t},e.awrap=function(t){return{__await:t}},O(_.prototype),l(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(j),l(j,u,"Generator"),l(j,a,(function(){return this})),l(j,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function d(t){var e=t.setIscreate,r=t.init,n=t.UpdateItem,d=Object(u["useState"])(""),v=Object(c["a"])(d,2),y=v[0],m=v[1],g=Object(u["useState"])(""),w=Object(c["a"])(g,2),b=w[0],x=w[1];function E(){return L.apply(this,arguments)}function L(){return L=Object(a["a"])(p().mark((function t(){var o;return p().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(y){t.next=3;break}return i["b"].info("\u6807\u9898\u4e0d\u80fd\u4e3a\u7a7a"),t.abrupt("return");case 3:if(b){t.next=6;break}return i["b"].info("\u5185\u5bb9\u4e0d\u80fd\u4e3a\u7a7a"),t.abrupt("return");case 6:if(!n){t.next=9;break}return j(),t.abrupt("return");case 9:return t.next=11,Object(h["a"])("/api/hpc_courses.json",{method:"post",body:{name:y,description:b,container_type:window.location.pathname.split("/")[1]}});case 11:o=t.sent,o&&(i["b"].info("\u521b\u5efa\u6210\u529f"),e(!1),r("add"));case 13:case"end":return t.stop()}}),t)}))),L.apply(this,arguments)}function j(){return O.apply(this,arguments)}function O(){return O=Object(a["a"])(p().mark((function t(){var o;return p().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(h["a"])("/api/hpc_courses/".concat(n.id,".json"),{method:"put",body:{name:y,description:b,container_type:window.location.pathname.split("/")[1]}});case 2:o=t.sent,o&&(i["b"].info("\u7f16\u8f91\u6210\u529f"),e(!1),r(""));case 4:case"end":return t.stop()}}),t)}))),O.apply(this,arguments)}return Object(u["useEffect"])((function(){n&&(m(n&&n.name),x(n&&n.description))}),[n]),l.a.createElement("div",null,l.a.createElement(s["a"],{style:{marginBottom:"20px"},placeholder:"\u8bf7\u8f93\u5165\u6807\u9898",value:y,maxLength:60,addonAfter:String(y.length)+"/60",onChange:function(t){return m(t.target.value)}}),l.a.createElement(f["a"],{id:"courseContentMD",defaultValue:b,onChange:function(t){return x(t)}}),l.a.createElement("div",{className:"clearfix mt30 mb30"},l.a.createElement(o["a"],{type:"primary",onClick:function(){return E()},className:"defalutSubmitbtn fl mr20"},"\u63d0\u4ea4"),l.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return e(!1)}},"\u53d6\u6d88")))}var v=d,y=r("9Bee");function m(){m=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),c=new G(n||[]);return o(a,"_invoke",{value:k(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",d="executing",v="completed",y={};function g(){}function w(){}function b(){}var x={};l(x,a,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(T([])));L&&L!==r&&n.call(L,a)&&(x=L);var j=b.prototype=g.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==typeof s&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function k(e,r,n){var o=h;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?v:p,l.arg===y)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,n.method="throw",n.arg=l.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,o(j,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=l(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,u,"GeneratorFunction")),t.prototype=Object.create(j),t},e.awrap=function(t){return{__await:t}},O(_.prototype),l(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(j),l(j,u,"Generator"),l(j,a,(function(){return this})),l(j,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function g(t){var e=t.CourseItem,r=t.userId,n=t.init,c=t.ItemUpdate,u=t.setSee,s=t.UserInfo;function f(){return p.apply(this,arguments)}function p(){return p=Object(a["a"])(m().mark((function t(){var r;return m().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(h["a"])("/api/hpc_courses/".concat(e.id,".json"),{method:"delete"});case 2:r=t.sent,r&&(i["b"].info("\u5220\u9664\u6210\u529f"),n("delete"),u(!1));case 4:case"end":return t.stop()}}),t)}))),p.apply(this,arguments)}function d(){c(e)}return l.a.createElement("div",null,299635===r||301458===r||(null===s||void 0===s?void 0:s.admin)||(null===s||void 0===s?void 0:s.business)?l.a.createElement("div",{style:{textAlign:"right"}},l.a.createElement(o["a"],{onClick:function(){return d()}},"\u7f16\u8f91"),l.a.createElement(o["a"],{onClick:function(){return f()},style:{marginLeft:"30px"}},"\u5220\u9664")):null,l.a.createElement("h1",null,null===e||void 0===e?void 0:e.name),l.a.createElement(y["a"],{value:null===e||void 0===e?void 0:e.description}))}var w=g,b=(r("9ivq"),r("m3rI")),x=r("Ty5D"),E=r("9kvl");function L(){L=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new G(n||[]);return o(a,"_invoke",{value:k(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",d="executing",v="completed",y={};function m(){}function g(){}function w(){}var b={};l(b,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(T([])));E&&E!==r&&n.call(E,a)&&(b=E);var j=w.prototype=m.prototype=Object.create(b);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==typeof s&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function k(e,r,n){var o=h;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?v:p,l.arg===y)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,n.method="throw",n.arg=l.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return g.prototype=w,o(j,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(j),t},e.awrap=function(t){return{__await:t}},O(_.prototype),l(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(j),l(j,u,"Generator"),l(j,a,(function(){return this})),l(j,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),N(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;N(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function j(t){var e,r,s,f,p,d,y,m,g,E=t.user,j=t.dispatch,O=Object(u["useState"])(1),_=Object(c["a"])(O,2),k=_[0],S=(_[1],Object(u["useState"])(100)),I=Object(c["a"])(S,2),N=I[0],G=(I[1],Object(u["useState"])([])),T=Object(c["a"])(G,2),P=T[0],C=T[1],F=Object(u["useState"])(!1),A=Object(c["a"])(F,2),U=A[0],Y=A[1],B=Object(u["useState"])(!1),R=Object(c["a"])(B,2),q=R[0],z=R[1],D=Object(u["useState"])(""),M=Object(c["a"])(D,2),V=M[0],Z=M[1],J=Object(u["useState"])(""),H=Object(c["a"])(J,2),K=H[0],Q=H[1],W=Object(u["useState"])(""),X=Object(c["a"])(W,2),$=X[0],tt=X[1],et=Object(x["m"])(),rt=et.itemname,nt=Object(u["useState"])(""),ot=Object(c["a"])(nt,2),it=ot[0],at=ot[1];function ct(t){return ut.apply(this,arguments)}function ut(){return ut=Object(a["a"])(L().mark((function t(e){var r,n,o,i,a;return L().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(h["a"])("/api/hpc_courses.json",{method:"get",params:{page:k,per_page:N,container_type:window.location.pathname.split("/")[1]}});case 2:if(r=t.sent,!r){t.next=24;break}if(n=r.data.hpc_courses.length,C(r.data.hpc_courses),tt(r.data.file_url),Q(""),n){t.next=10;break}return t.abrupt("return");case 10:if(it){t.next=14;break}rt?(a=0,null===r||void 0===r||null===(o=r.data)||void 0===o||null===(i=o.hpc_courses)||void 0===i||i.map((function(t,e){var r;(null===rt||void 0===rt?void 0:rt.toLocaleLowerCase())===(null===t||void 0===t||null===(r=t.name)||void 0===r?void 0:r.toLocaleLowerCase())&&(a=e)})),Z(r.data.hpc_courses[a]),z(!0),at(r.data.hpc_courses[a].id),"resources"===(null===rt||void 0===rt?void 0:rt.toLocaleLowerCase())&&(Z(r.data.hpc_courses.filter((function(t){return 15===t.id}))[0]),z(!0),at(15))):(Z(r.data.hpc_courses[0]),z(!0),at(r.data.hpc_courses[0].id)),t.next=24;break;case 14:if("delete"!==e){t.next=23;break}if(0!==n){t.next=18;break}return z(!1),t.abrupt("return");case 18:Z(r.data.hpc_courses[0]),z(!0),at(r.data.hpc_courses[0].id),t.next=24;break;case 23:"add"===e?(Z(r.data.hpc_courses[n-1]),z(!0),at(r.data.hpc_courses[n-1].id)):(Z(r.data.hpc_courses.filter((function(t){return t.id===it}))[0]),z(!0),at(it));case 24:case"end":return t.stop()}}),t)}))),ut.apply(this,arguments)}function lt(t){Y(!1),z(!0),Z(t),at(t.id)}function st(t){Q(t),Y(!0),z(!1)}function ft(){Q(""),Y(!0),z(!1)}Object(u["useEffect"])((function(){j({type:"globalSetting/headerToggle",payload:!1}),k&&ct("")}),[k]);var ht={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(t){var e=t.file.status;"done"===e?(i["b"].success("".concat(t.file.name," \u6587\u4ef6\u4e0a\u4f20\u6210\u529f")),ct("")):"error"===e&&i["b"].error("".concat(t.file.name," \u6587\u4ef6\u4e0a\u4f20\u5931\u8d25"))},beforeUpload:function(t){var e=t.size/1024/1024<150;return e||i["b"].info("\u6587\u4ef6\u5927\u5c0f\u5fc5\u987b\u5c0f\u4e8e150MB"),e}};return l.a.createElement("div",{style:{marginBottom:"40px"}},l.a.createElement("div",{className:"bannterdiv",style:{background:"url(".concat(b["a"].IMG_SERVER+"/".concat($),")")}}),l.a.createElement("img",{style:{width:"100%"},src:b["a"].IMG_SERVER+"/".concat($)}),l.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},l.a.createElement("div",{style:{flex:"1",marginTop:"17px"}},P&&P.map((function(t,e){return l.a.createElement("p",{key:e,onClick:function(){return lt(t)},className:it===t.id?"menuitemselect":"menuitem task-hide"},t.name)})),299635===(null===E||void 0===E||null===(e=E.userInfo)||void 0===e?void 0:e.user_id)||301458===(null===E||void 0===E||null===(r=E.userInfo)||void 0===r?void 0:r.user_id)||(null===E||void 0===E||null===(s=E.userInfo)||void 0===s?void 0:s.admin)||(null===E||void 0===E||null===(f=E.userInfo)||void 0===f?void 0:f.business)?l.a.createElement("p",{onClick:function(){return ft()},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"}},l.a.createElement("span",{style:{fontSize:"16px",marginLeft:"5px"}},"Last updated")):null),l.a.createElement("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"}},U?l.a.createElement(v,{UpdateItem:K,setIscreate:Y,init:ct}):null,q?l.a.createElement(w,{UserInfo:null===E||void 0===E?void 0:E.userInfo,setSee:z,userId:null===E||void 0===E||null===(p=E.userInfo)||void 0===p?void 0:p.user_id,ItemUpdate:st,CourseItem:V,init:ct}):null)),299635===(null===E||void 0===E||null===(d=E.userInfo)||void 0===d?void 0:d.user_id)||301458===(null===E||void 0===E||null===(y=E.userInfo)||void 0===y?void 0:y.user_id)||(null===E||void 0===E||null===(m=E.userInfo)||void 0===m?void 0:m.admin)||(null===E||void 0===E||null===(g=E.userInfo)||void 0===g?void 0:g.business)?l.a.createElement(n["a"],ht,l.a.createElement(o["a"],{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"}},"\u4e0a\u4f20\u9996\u9875\u56fe\u7247")):null)}e["default"]=Object(E["a"])((function(t){var e=t.user;return{user:e}}))(j)}}]);