1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
(this.webpackJsonph5=this.webpackJsonph5||[]).push([[8],{177:function(e,t,n){"use strict";var a=new function(e){var t={},n={subscribe:function(e,n){return t[e]||(t[e]=[]),t[e].push(n),this.unsubscribe.bind(null,e,n)},unsubscribe:function(e,n){var a=t[e],c=-1;if(a){for(var r=0;r<a.length;r++)if(a[r].name===n.name){c=r;break}if(0<=c)return t[e].splice(c,1),!0}return!1},publish:function(e){if(!t[e])return!1;var n=Array.prototype.slice.call(arguments,1);return t[e].forEach((function(e){e.apply(null,n)})),this}};return n};t.a=a},179:function(e,t,n){"use strict";var a=n(0),c=n.n(a),r=(n(203),n(176)),i=n(204),l=n.n(i),o=n(205),s=n(206);function u(e){return Object(s.renderToString)((t=(t=e).replace(/( |\u00a0| )/g,"").replace(/>/g,">").replace(/</g,"<").replace(/\\$/g,"").replace(/^\\(?:{)/,"\\\\{")).match(/\S/)?t:"",{throwOnError:!1});var t}var d=/\`?\${2}([^\$\n]+?)\${2}\`?/g,f=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,p=[],m=["<ul>"];var h={heading:function(e){var t=f.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[1].length,text:t[2]}},paragraph:function(e){var t=this.rules.block.paragraph.exec(e),n="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];if(n.match(d)&&(n=n.replace(d,(function(e,t){return u(t)}))),t)return{type:"paragraph",raw:t[0],text:n}},code:function(e,t){var n=this.rules.block.code.exec(e);if(n){var a=t[t.length-1];if(a&&"paragraph"===a.type)return{raw:n[0],text:n[0].trimRight()};var c=n[0].replace(/^ {4}/gm,"");return(c=this.options.pedantic?c:Object(o.rtrim)(c,"\n")).match(d)&&(c=c.replace(d,(function(e,t){return u(t)}))),{type:"code",raw:n[0],codeBlockStyle:"indented",text:c}}},fences:function(e){var t=this.rules.block.fences.exec(e);if(t){var n=t[0],a=function(e,t){var n=e.match(/^(\s+)(?:```)/);if(null===n)return t;var a=n[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null!==t&&Object(r.a)(t,1)[0].length>=a.length?e.slice(a.length):e})).join("\n")}(n,t[3]||""),c=t[2]?t[2].trim():t[2];return 0<=["latex","katex","math"].indexOf(c)&&(a=u(a)),{type:"code",raw:n,lang:c,text:a}}}},g={code:function(e,t,n){var a=(t||"").match(/\S*/)[0];return a?0<=["latex","katex","math"].indexOf(a)?"<p class='editormd-tex'>".concat(e,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(t,'">').concat(n?e:Object(o.escape)(e,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(n?e:Object(o.escape)(e,!0))+"</code></pre>"},heading:function(e,t,n){var a=this.options.headerPrefix+n.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return p.push({anchor:a,level:t,text:e}),"<h"+t+' id="'+a+'">'+e+"</h"+t+">"}};l.a.setOptions({silent:!0,smartypants:!0,gfm:!0,pedantic:!1}),l.a.use({tokenizer:h,renderer:g});var v=l.a,b=/<pre[^>]*>/g;t.a=function(e){var t=e.value,n=void 0===t?"":t,r=e.is_md,i=void 0===r||r,l=e.className,o=e.style,s=void 0===o?{}:o,u=String(n),d=i?v(u):n;u.match(/\[TOC\]/)&&(d=d.replace("<p>[TOC]</p>",(function e(t,n,a,c){if(n>=t.length||t[n].level<=a)return n;var r=t[n];c.push("<li><a href='#"+r.anchor+"'>"+r.text+"</a>");var i=[];return n=e(t,++n,r.level,i),0<i.length&&(c.push("<ul>"),i.forEach((function(e){c.push(e)})),c.push("</ul>")),c.push("</li>"),e(t,n,a,c)}(p,0,0,m),m.push("</ul>"),m.join(""))),p=[],m=["<ul>"]),d=d.replace(/\u2581/g,"\u2581\u2581\u2581");var f=Object(a.useRef)();function h(e){var t=e.target;if("A"===t.tagName.toUpperCase()){var n=t.getAttribute("href");if(n.startsWith("#")){e.preventDefault();var a=document.getElementById(n.replace("#",""));a&&(a.parentNode.scrollTop=a.offsetTop)}}}return Object(a.useEffect)((function(){if(f.current&&d&&d.match(b)&&window.PR.prettyPrint(),f.current)return f.current.addEventListener("click",h),function(){f.current.removeEventListener("click",h)}}),[d,f.current,h]),c.a.createElement("div",{ref:f,style:s,className:"".concat(l||""," markdown-body"),dangerouslySetInnerHTML:{__html:d}})}},582:function(e,t,n){},583:function(e,t,n){},584:function(e,t,n){},613:function(e,t,n){"use strict";function a(e){var t=Object(o.h)(),n=t.identifier,a=t.educoder_session,c=t.autologin_trustie,s=Object(o.f)(),d=Object(o.g)(),p=Object(o.i)(),h=Object(i.useState)(!1),v=Object(r.a)(h,2),E=v[0],O=v[1],N=Object(i.useState)(null),S=Object(r.a)(N,2),C=S[0],T=S[1],R=Object(i.useState)([]),L=Object(r.a)(R,2),_=L[0],I=L[1],P=Object(i.useState)(!1),A=Object(r.a)(P,2),B=A[0],$=A[1],z=Object(i.useState)(0),D=Object(r.a)(z,2),J=D[0],M=D[1],F=Object(i.useState)(["\u5173\u5361","","","\u4ee3\u7801"]),W=Object(r.a)(F,2),G=W[0],H=W[1],X=Object(i.useState)(!1),Y=Object(r.a)(X,2),q=Y[0],U=Y[1],K=Object(i.useState)(null),Q=Object(r.a)(K,2),V=Q[0],Z=Q[1],ee=Object(i.useState)("null"),te=Object(r.a)(ee,2),ne=te[0],ae=te[1],ce=Object(i.useRef)(!1);function re(t){if(t){ce.current=!1;var n="/tasks/".concat(t,".json");w.a.get(n,{}).then((function(t){var n,a,c,r,i=!1;if(O(!1),t.data.challenge){var l=t.data.challenge.task_pass;ae(l),M(t.data.challenge.position),T(t.data.challenge),Z(t.data.challenge.id)}if(e.onGetTaskInfo(t.data),PR.prettyPrint(),t.data.shixun&&t.data.user&&t.data.user.identity){var o=t.data.user.identity;i=1===o||2===o||3===o||4===o||5===o||!0===t.data.shixun.task_pass,$(i),t.data.myshixun.identifier&&(n=t.data.myshixun.identifier,a=t.data.challenge.position,c=i,r="/myshixuns/".concat(n,"/challenges.json"),w.a.get(r,{}).then((function(e){if(e.data){var t=0;e.data.map((function(e,n){n===a-1&&(t=e.status)}));var n=G;1!=a&&1!=e.data.length?n[1]="\u4e0a\u4e00\u5173":n[1]="",!0===c&&(a!=e.data.length?n[2]="\u4e0b\u4e00\u5173":n[2]=""),!1===c&&(a!=e.data.length&&2===t?n[2]="\u4e0b\u4e00\u5173":n[2]=""),H(n),I(e.data)}})))}}))}else j.a.info("\u8be5\u5b9e\u8bad\u4e0d\u652f\u6301\u8df3\u5173")}function ie(e,t){var a=!(1<arguments.length&&void 0!==t)||t,c=new RegExp(n,"g"),r=d.pathname.replace(c,e);a&&(p.isExact||(r=r.replace("/code",""))),s.replace(r)}function le(e){_&&0<_.length&&_.map((function(t,n){0===e?n===J-2&&ie(t.identifier):1===e&&n===J&&ie(t.identifier)}))}Object(i.useEffect)((function(){ce.current=!1}),[V]),Object(i.useEffect)((function(){var e=[];e.push({id:"educoder_session",value:a}),e.push({id:"autologin_trustie",value:c}),Object(y.c)(e)}),[a,c]),Object(i.useEffect)((function(){re(n)}),[n]);var oe=function(t){if(t){var r="/weapps/challenges/".concat(t,"/is_play.json");w.a.get(r,{}).then((function(t){if(t.data)if(0===t.data.status){if(ce.current=!0,p.isExact){var r="/educodermd/".concat(n,"/").concat(a,"/").concat(c,"/code");e.history.push(r)}e.callback&&e.callback()}else-5===t.data.status&&U(!0)}))}};return Object(i.useEffect)((function(){var t=k.a.subscribe("to-task",(function(){ce.current?e.callback():oe(V)})),a=k.a.subscribe("reset-game",(function(){re(n)})),c=k.a.subscribe("next-game",(function(e){ie(e,!1)}));return function(){t(),a(),c()}}),[V,oe,ce.current]),l.a.createElement("div",{className:"wx-code-flex"},l.a.createElement("div",{style:{position:"fixed",height:"100%",width:"100%",top:0,overflow:"hidden"}},l.a.createElement(m.a,{unselectedTintColor:"#949494",tintColor:"#33A3F4",barTintColor:"white",tabBarPosition:"bottom",prerenderingSiblingsNumber:0},G.map((function(e,t){return l.a.createElement(m.a.Item,{title:"\u4ee3\u7801"===e?"":e,key:t,selectedIcon:l.a.createElement("div",null,"\u5173\u5361"===e?l.a.createElement("i",{className:"iconfont iconguankamulu"}):"\u4e0a\u4e00\u5173"===e?l.a.createElement("i",{className:"iconfont iconshangyiguan"}):"\u4e0b\u4e00\u5173"===e?l.a.createElement("i",{className:"iconfont iconxiayiguan"}):"\u4ee3\u7801"===e?l.a.createElement("div",{className:"wx-pt-btn"},"\u4ee3\u7801"):""),selected:!0,onPress:function(){return function(e){"\u5173\u5361"===e?O(!0):"\u4ee3\u7801"===e?oe(V):"\u4e0a\u4e00\u5173"===e?le(0):"\u4e0b\u4e00\u5173"===e&&le(1)}(e)}},l.a.createElement(b.a,{size:"lg"}),l.a.createElement(g.a,null,null===C?"":l.a.createElement("div",{className:"challengestitle"},"\u7b2c",C&&C.position,"\u5173: ",C&&C.subject)),l.a.createElement(b.a,{size:"lg"}),l.a.createElement(g.a,null,null===C?"":l.a.createElement(x.a,{value:ne,style:{height:"calc(100vh - 88px)",paddingBottom:"50px"}})),l.a.createElement("div",{className:"inputBox"},l.a.createElement("input",{className:"copyInput apiInput",value:"https://www.educoder.net/tasks/".concat(n),readOnly:!0})))})))),l.a.createElement(f.a,{visible:q,transparent:!0,maskClosable:!1,onClose:function(){return U(!1)},title:"\u8be5\u9879\u76ee\u8fd1\u671f\u5c06\u63d0\u4f9b\u5c0f\u7a0b\u5e8f\u5165\u53e3\uff0c\u8bf7\u5229\u7528\u4e0b\u9762\u7684\u7f51\u5740\u5728\u7535\u8111\u7aef\u64cd\u4f5c\uff1a",footer:[{text:"\u6211\u77e5\u9053\u4e86",onPress:function(){return U(!1)}}],wrapProps:{onTouchStart:null}},l.a.createElement("div",{style:{height:100,overflow:"scroll"}},l.a.createElement("div",{className:"mt10"},"\u5b9e\u8bad\u5730\u5740\uff1ahttps://www.educoder.ne"),l.a.createElement("div",null,"t/tasks/",n),l.a.createElement("div",{className:"mt10 color51 ml10",onClick:function(){var e,t;e=document.querySelector(".inputBox input"),t=document.createRange(),window.getSelection().removeAllRanges(),t.selectNode(e),window.getSelection().addRange(t),document.execCommand("copy")?j.a.info("\u590d\u5236\u6210\u529f\uff01"):j.a.info("\u590d\u5236\u5931\u8d25\uff0c\u8bf7\u624b\u52a8\u590d\u5236\uff01"),window.getSelection().removeAllRanges()}},"\u590d\u5236\u94fe\u63a5",l.a.createElement("i",{className:"iconfont iconfuzhi1 ml5 color51"})))),l.a.createElement(f.a,{popup:!0,visible:E,onClose:function(){return O(!1)},animationType:"slide-up"},l.a.createElement(u.a,{renderHeader:function(){return l.a.createElement("div",null,l.a.createElement("div",{className:"fl Jumpoff"},"\u5171",_&&_.length,"\u5173 ",!0===B?"":l.a.createElement("span",{className:"JumpoffFF9C3D"},"\uff08\u8be5\u5b9e\u8bad\u4e0d\u652f\u6301\u8df3\u5173\uff09")),l.a.createElement("div",{className:"fr closebutton",onClick:function(){return O(!1)}},"\u5173\u95ed"))},className:"popup-list"},_.map((function(e,t){return l.a.createElement(u.a.Item,{key:t,onClick:function(){return ie(e.identifier)}},l.a.createElement("div",{className:"fl colorC0C4CC"},"\u7b2c",e.position,"\u5173"),l.a.createElement("div",{className:e.identifier?"conlistfont fl ml10":"conlistfontclose fl ml10"},e.name),2===e.status?l.a.createElement("i",{className:"iconfont iconwanchengjiaobiao"}):"")})))))}function c(e){var t,n,a,c,r,o,s=e.onLeft,u=e.onRight,d=e.children,f=e.cls,p=Object(i.useRef)(),m=(document.documentElement.clientWidth||document.body.clientWidth)/2;function h(e){var a=e.changedTouches[0];t=a.pageX,n=a.pageY,o=(new Date).getTime()}function g(e){var i=e.changedTouches[0];c=i.pageY-n,a=i.pageX-t,r=(new Date).getTime()-o,(Math.abs(a)>m||r<=320)&&Math.abs(a)>Math.abs(c)&&(a<0?s&&s():u&&u())}return Object(i.useEffect)((function(){var e=p.current;return e&&(e.addEventListener("touchstart",h),e.addEventListener("touchend",g)),function(){e.removeEventListener("touchstart",h),e.removeEventListener("touchend",g)}}),[p.current,h,g]),l.a.createElement("div",{ref:p,className:f,style:{width:"100%",height:"100%"}},d)}n.r(t);var r=n(176),i=n(0),l=n.n(i),o=n(15),s=(n(550),n(552)),u=n.n(s),d=(n(183),n(184)),f=n.n(d),p=(n(558),n(564)),m=n.n(p),h=(n(576),n(578)),g=n.n(h),v=(n(579),n(581)),b=n.n(v),E=(n(94),n(19)),j=n.n(E),O=(n(582),n(583),n(32)),w=n.n(O),y=n(58),k=n(177),x=n(179),N=(n(584),Object(i.lazy)((function(){return n.e(9).then(n.bind(null,612))}))),S=/(?:\/educodermd\/)[^ \/]+\/[^ \/]+\/[^ \/]+$/i;t.default=function(e){var t=Object(i.useState)(0),n=Object(r.a)(t,2),s=n[0],u=n[1],d=Object(i.useState)(null),f=Object(r.a)(d,2),p=f[0],m=f[1],h=Object(i.useCallback)((function(){0===s&&k.a.publish("to-task")}),[s]),g=Object(i.useCallback)((function(){1===s&&(u(0),k.a.publish("update-cost-time"))}),[s]);return Object(i.useEffect)((function(){function e(){S.test(location.pathname)&&u(0)}return window.addEventListener("popstate",e),function(){window.removeEventListener("popstate",e)}}),[]),l.a.createElement(c,{cls:s?"task-game-panel right":"task-game-panel",onLeft:h,onRight:g},l.a.createElement("div",{className:"task-game-panel-body"},l.a.createElement("div",{className:"left-panel"},l.a.createElement(a,Object.assign({},e,{callback:function(){u(1)},onGetTaskInfo:function(e){m(e)}}))),l.a.createElement("div",{className:"right-panel"},l.a.createElement(o.c,null,l.a.createElement(o.a,{path:"/educodermd/:identifier/:educoder_session/:autologin_trustie/code",render:function(e){return l.a.createElement(N,Object.assign({},e,{taskData:p}))}})))))}}}]); |