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.
7 lines
16 KiB
7 lines
16 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1272],{6629:function(ce,K,o){var t=o(59301),x=o(93314),O=o(3113),Y=Object.defineProperty,Q=Object.defineProperties,$=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,W=(A,v,h)=>v in A?Y(A,v,{enumerable:!0,configurable:!0,writable:!0,value:h}):A[v]=h,U=(A,v)=>{for(var h in v||(v={}))D.call(v,h)&&W(A,h,v[h]);if(y)for(var h of y(v))k.call(v,h)&&W(A,h,v[h]);return A},z=(A,v)=>Q(A,$(v));const H=({img:A,buttonProps:v={},styles:h={},customText:N,ButtonText:R,ButtonClick:q,Buttonclass:_,ButtonTwo:r,imgStyles:m,loading:E=!1})=>t.createElement("section",{className:"tc animated fadeIn",style:U(U({},{color:"#999",margin:"100px auto",visibility:E?"hidden":"visible"}),h)},t.createElement("img",{src:A||x,style:z(U({},m),{pointerEvents:"none",userSelect:"none"})}),t.createElement("p",{className:"mt20 font14"},N||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),R&&t.createElement(O.ZP,U({className:_,onClick:q},v),R),r&&r);K.Z=H},95333:function(ce,K,o){o.d(K,{Z:function(){return q}});var t=o(59301),x={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},O=o(3113),Y=o(74516),Q=o(90612),$=o(6848),y=o(15826),D=o(21797),k=o(6629),W=o(46961),U=o(70891),z=Object.defineProperty,H=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,h=(_,r,m)=>r in _?z(_,r,{enumerable:!0,configurable:!0,writable:!0,value:m}):_[r]=m,N=(_,r)=>{for(var m in r||(r={}))A.call(r,m)&&h(_,m,r[m]);if(H)for(var m of H(r))v.call(r,m)&&h(_,m,r[m]);return _},R=(_,r,m)=>new Promise((E,u)=>{var a=l=>{try{p(m.next(l))}catch(d){u(d)}},n=l=>{try{p(m.throw(l))}catch(d){u(d)}},p=l=>l.done?E(l.value):Promise.resolve(l.value).then(a,n);p((m=m.apply(_,r)).next())}),q=({editOffice:_="view",data:r,theme:m,type:E,filename:u,monacoEditor:a,className:n,style:p,close:l,onClose:d,hasMask:f,disabledDownload:P,onImgDimensions:T,showNodata:L,recordInfo:c})=>{const[B,J]=(0,t.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[M,re]=(0,t.useState)(""),[b,le]=(0,t.useState)(),ee=window.ENV==="build"?"/react/build":"",C=location.host.startsWith("localhost")?W.Z.PROXY_SERVER:W.Z.API_SERVER,ie=10*(1024*1024),X=(0,t.useRef)();r!=null&&r.startsWith("/api")&&E!=="txt"&&(r=W.Z.API_SERVER+r);const ue=S=>S.substring(S.lastIndexOf("/")+1).split(".").pop();u&&(a.filename=u),(0,t.useEffect)(()=>{var S,G;const j=(G=(S=document.cookie)==null?void 0:S.replace(/\s/g,""))==null?void 0:G.split(";");j==null||j.map(I=>{let te=I.split("=");te[0]==="_educoder_session"&&re(te[1])})},[]),(0,t.useEffect)(()=>{E==="office"&&(r.indexOf("bigfilescdn.")>-1||r.indexOf("bigfiles1")>-1?le({url:r,fileType:ue(r),model:r.indexOf("model=edit")?"edit":"view"}):pe())},[E,r]);const pe=()=>R(void 0,null,function*(){console.log("data:",r);let S=r;r.startsWith("http")||(S=location.origin+S);let G=new URL(S).pathname.split("/").pop();const j=yield(0,D.gJ)({attachment_id:G});j.url=C+j.url,le(j)}),ae=()=>{if(r.startsWith("http")||r.startsWith("blob:")){V();return}(0,y.Sv)(u||"educoder",r,u)},V=()=>{c&&(0,U.fc)({id:c==null?void 0:c.id,watch_type:1,course_id:c==null?void 0:c.course_id}),(0,y.Nd)(u||"educoder",decodeURIComponent(r))};return t.createElement("div",{style:N({},p||{}),className:`${f&&x.bgBlack} ${E?x.wrp:"hide"}`},l&&t.createElement("div",{className:x.close,ref:X},!!T&&t.createElement($.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>X.current},t.createElement("span",{onClick:()=>{d(),T()}},t.createElement("i",{className:"icon-yulanpizhu"}))),!P&&t.createElement($.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>X.current},t.createElement("span",{onClick:V},t.createElement("i",{className:"icon-quxiaozhiding"}))),t.createElement($.Z,{title:"\u5173\u95ED",getPopupContainer:()=>X.current},t.createElement("span",{className:"",onClick:d},t.createElement("i",{className:"icon-guanbi1"})))),t.createElement("div",{className:`${x[n]} ${n} ${x.monaco} ${E==="txt"?"show":"hide"}`},E==="txt"&&t.createElement(t.Fragment,null,t.createElement(Q.ZP,N({},a)))),E==="audio"&&t.createElement("audio",{src:`${(r==null?void 0:r.indexOf("http://"))>-1||(r==null?void 0:r.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${r}`,autoPlay:!0}),E==="video"&&t.createElement(t.Fragment,null,(r==null?void 0:r.indexOf("http"))>-1?t.createElement("video",{controls:!0,src:`${r}`,autoPlay:!0}):t.createElement("video",{controls:!0,src:`data:video/mp4;base64,${r}`,autoPlay:!0})),E==="office"&&b&&t.createElement("iframe",{src:`${ee}/office.html?key=${b.key}&url=${btoa(b.url)}&callbackUrl=${C+b.callbackUrl}&fileType=${b.fileType}&title=${b.title}&model=${_}&officeServer=${W.Z.ONLYOFFICE}&disabledDownload=${!!P}`}),E==="html"&&t.createElement("iframe",{src:r+"&disposition=inline"}),E==="pdf"&&t.createElement("iframe",{src:`${ee}/js/pdfview/index.html?url=${encodeURIComponent(r)}&disabledDownload=${!!P}`}),E==="image"&&t.createElement("img",{src:`${(r==null?void 0:r.indexOf("http://"))>-1||(r==null?void 0:r.indexOf("https://"))>-1?"":"data:image/png;base64,"}${r}`}),(E==="other"||E==="download")&&t.createElement(t.Fragment,null,L?t.createElement(k.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:t.createElement(O.ZP,{icon:t.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:ae},"\u4E0B\u8F7D")}):t.createElement(O.ZP,{type:"primary",size:"middle",onClick:ae},t.createElement(Y.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")))}},31272:function(ce,K,o){o.d(K,{z:function(){return E}});var t=o(59301),x=o(8341),O=o(42661),Y=o(64018),Q=o.n(Y),$=o(63824),y=o(46961),D=o(15826),k=o(15342),W=o.n(k),U=o(1012),z=o(95333),H=Object.defineProperty,A=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,N=(u,a,n)=>a in u?H(u,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):u[a]=n,R=(u,a)=>{for(var n in a||(a={}))v.call(a,n)&&N(u,n,a[n]);if(A)for(var n of A(a))h.call(a,n)&&N(u,n,a[n]);return u};const q="@\u2581\u2581@",_="@\u2581@",r=/<pre[^>]*>/g;function m(u){let a=document.createElement("div");return a.innerHTML=u,a.childNodes.length===0?"":a.childNodes[0].nodeValue}const E=(u,a)=>{u=u||"";const n=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,p=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,l=/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return a?u.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(n,(d,f,P,T,L,c,B)=>{const J=f||T||c,M=P||L||B||"?";return y.Z.API_SERVER+"/api/attachments/"+J+M+"&t="+(0,D.Jn)(J,Date.now())+(d.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(u=u.replace(n,(d,f,P,T,L,c,B)=>{const J=f||T||c,M=P||L||B||"?";return y.Z.API_SERVER+"/api/attachments/"+J+M+"&t="+(0,D.Jn)(J,Date.now())+(d.indexOf(")")>-1?")":"&")}).replace(p,(d,f,P,T,L)=>{const c=f||T,B=P||L||"";return'"'+y.Z.API_SERVER+"/api/attachments/"+c+B+c+B+"&t="+(0,D.Jn)(c,Date.now())}).replace(l,(d,f,P,T,L)=>{const c=f||T,B=P||L||"";return"("+y.Z.API_SERVER+"/files/uploads/"+c+B+c+B+"&t="+(0,D.Jn)(c,Date.now())}).replaceAll('src="(','src="').replaceAll("src='(",'src="').replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`),u)};K.Z=({value:u="",className:a,showTextOnly:n,showLines:p,style:l={},stylesPrev:d={},highlightKeywords:f,showProgramFill:P,isProgramFill:T,disabledFill:L=!1,programFillValue:c,onFillChange:B=M=>{},onFillBlur:J=()=>{}})=>{let M=String(u);const[re,b]=(0,t.useState)(""),[le,ee]=(0,t.useState)("office"),[C,se]=(0,t.useState)([]),ie=(0,t.useRef)("a"+(0,U.Z)()),X={},ue=(e,g,s)=>{const i=document.createElement(e===_?"input":"textarea");i.style.width="100%",i.style.height=e===_?"40px":"151px",i.rows=5,i.spellcheck=!1,i.name="edu-program-fill",i.placeholder="\u8BF7\u8F93\u5165",i.dataset.id=g;const w=Object.keys(X).length;return X[w]=i,`<span class="edu-program-fill-wrap ${e===_?"":"show"}" style="width:${e===_?"400px":"100%"}" title=${s||""}><span>${i.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function pe(e){return e=e.replace(/!\[.*?\]\(.*?\)/g,""),e=e.replace(/\[.*?\]\(.*?\)/g,""),e=e.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),e=e.replace(/<embed.*?>/g,""),e=e.replace(/<img.*?>/g,""),e=e.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),e=e.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),e=e.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),e=e.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),e}const ae=e=>e.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(g,s){let i=s.replace(/(\n|\r)/g,"").split("}"),w=[];return i.map(Z=>{Z!=""&&w.push(`.${ie.current} ${Z}`)}),`<style>${w.join("}")}</style>`}),V=(0,t.useMemo)(()=>{try{const i=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,w=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;M=M.replace(i,"("+y.Z.API_SERVER+"/api/attachments/").replace(w,'"'+y.Z.API_SERVER+"/api/attachments/").replace(Z,'"'+y.Z.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(i){}if(P){let i=-1;return M=M.replaceAll("<","<").replaceAll(">",">").replace(/(@▁▁@|@▁@)/g,function(w,Z,oe){var F;return++i,ue(w,i,(F=c==null?void 0:c[i])==null?void 0:F.value)}),`<pre style="background:#fff;padding:4px">${ae(M||"")}</pre>`}let e=ae(M);e=(0,O.ZP)(e);const g=(0,O.ez)();M.match(/\[TOC\]/)&&(e=e.replace("<p>[TOC]</p>",(0,O.Qv)()),(0,O.Iy)()),e=e.replace(/(__special_katext_id_\d+__)/g,(i,w)=>{const{type:Z,expression:oe}=g[w];return(0,k.renderToString)(m(oe)||"",{displayMode:Z==="block",throwOnError:!1,output:"html"})}),e=e.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,O.AL)();const s=document.createElement("div");if(s.innerHTML=e,n)return s.innerText;if(f){const i=f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return j(s,i),s.innerHTML}return setTimeout(()=>de(),500),s.innerHTML},[M,f]);(0,t.useEffect)(()=>{I.current&&I.current.querySelectorAll(["input","textarea"]).forEach(g=>{g.oninput=S,g.onblur=G})},[C]),(0,t.useEffect)(()=>{var e,g,s,i,w;if(c!=null&&c.length)try{const Z=I.current.querySelectorAll(".edu-program-fill-score"),oe=I.current.querySelectorAll('[name="edu-program-fill"]');for(const[F,ne]of oe.entries())ne.value=((e=c==null?void 0:c[F])==null?void 0:e.value)||"",((g=c==null?void 0:c[F])==null?void 0:g.type)==="warning"?ne.className="program-fill-warning":((s=c==null?void 0:c[F])==null?void 0:s.type)==="success"?ne.className="program-fill-success":ne.className="";for(const[F,ne]of Z.entries())ne.innerHTML=(i=c==null?void 0:c[F])!=null&&i.score?`${(w=c==null?void 0:c[F])==null?void 0:w.score}\u5206`:"";se(c)}catch(Z){console.log(Z,"error")}},[c]);const S=e=>{C[e.target.dataset.id]=C[e.target.dataset.id]||{},C[e.target.dataset.id].value=e.target.value,se([...C]),B(C,e.target.dataset.id)},G=e=>{C[e.target.dataset.id]=C[e.target.dataset.id]||{},C[e.target.dataset.id].value=e.target.value,se([...C]),J(C,e.target.dataset.id)};function j(e,g){return e.childNodes.forEach(s=>{var i;if(s.childNodes.length>0)j(s,g);else if(s.nodeName!=="IMG")if(s.innerHTML)s.innerHTML=(i=s.innerHTML)==null?void 0:i.replace(new RegExp(g,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const w=document.createElement("span");w.innerHTML=s.textContent.replace(new RegExp(g,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),s.replaceWith(w)}})}const I=(0,t.useRef)();O.jb.WebkitLineClamp=p,p&&(l=R(R({},l),O.jb));function te(e){let g=e.target;if(g.tagName.toUpperCase()==="A"){let s=g.getAttribute("href");if(s.indexOf("office")>-1)e.preventDefault(),b(s),ee("office");else if(s.indexOf("application/pdf")>-1)e.preventDefault(),b(s),ee("pdf");else if(s.indexOf("text/html")>-1)e.preventDefault(),b(s),ee("html");else if(s.startsWith("#")){e.preventDefault();let i=document.getElementById(s.replace("#",""));i&&i.scrollIntoView(!0)}}}const de=()=>{var e;const g=(e=I.current)==null?void 0:e.querySelectorAll("video");g==null||g.forEach(s=>{if(s.oncontextmenu=()=>!1,s.src.indexOf(".m3u8")>-1&&!s.canPlayType("application/vnd.apple.mpegurl")){if($.ZP.isSupported()){var i=new $.ZP;i.loadSource(s.src),i.attachMedia(s)}}})};return(0,t.useEffect)(()=>{if(I.current&&V&&V.match(r)&&window.PR.prettyPrint(),I.current)return I.current.addEventListener("click",te),()=>{var e;(e=I.current)==null||e.removeEventListener("click",te),(0,O.AL)(),(0,O.Iy)()}},[V,I.current,te]),t.createElement(t.Fragment,null,n&&t.createElement("div",{ref:I},V),!n&&t.createElement("div",{ref:I,style:R({},l),className:`${a||""} ${L?"disabled-fill":""} markdown-body ${ie.current}`,dangerouslySetInnerHTML:{__html:V}}),t.createElement(z.Z,{close:!0,data:re,type:re!=null&&re.length?le:"",style:R({},d),onClose:()=>b("")}))}},42661:function(ce,K,o){o.d(K,{AL:function(){return _},Iy:function(){return W},Qv:function(){return H},ez:function(){return q},jb:function(){return U}});var t=o(32834),x=o.n(t),O=o(11690),Y=o.n(O);function Q(a,n){const p=a.match(/^(\s+)(?:```)/);if(p===null)return n;const l=p[1];return n.split(`
|
|
`).map(d=>{const f=d.match(/^\s+/);if(f===null)return d;const[P]=f;return P.length>=l.length?d.slice(l.length):d}).join(`
|
|
`)}let $=[],y=["<ul>"];const D=new(x()).Renderer,k=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function W(){$.length=0,y=["<ul>"]}const U={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function z(a,n,p,l){if(n>=a.length||a[n].level<=p)return n;var d=a[n];l.push("<li><a href='#"+d.anchor+"'>"+d.text+"</a>"),n++;var f=[];return n=z(a,n,d.level,f),f.length>0&&(l.push("<ul>"),f.forEach(function(P){l.push(P)}),l.push("</ul>")),l.push("</li>"),n=z(a,n,p,l),n}function H(){return z($,0,0,y),y.push("</ul>"),y.join("")}const A={heading(a){const n=k.exec(a);if(n)return{type:"heading",raw:n[0],depth:n[1].length,text:n[2]}},fences(a){const n=this.rules.block.fences.exec(a);if(n){const p=n[0];let l=Q(p,n[3]||"");const d=n[2]?n[2].trim():n[2];if(["latex","katex","math"].indexOf(d)>=0){const f=N(),P=l;l=f,R[f]={type:"block",expression:P}}return{type:"code",raw:p,lang:d,text:l}}}},v=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let h=0;const N=()=>`__special_katext_id_${h++}__`;let R={};function q(){return R}function _(){h=0,R={}}function r(a){return a=a.replace(v,(n,p)=>{const l=N();return R[l]={type:"inline",expression:p},l}),a}const m=D.listitem;D.listitem=function(a){return m(r(a))};const E=D.paragraph;D.paragraph=function(a){return E(r(a))};const u=D.tablecell;D.tablecell=function(a,n){return u(r(a),n)},D.code=function(a,n,p){const l=(n||"").match(/\S*/)[0];return l?["latex","katex","math"].indexOf(l)>=0?`<p class='editormd-tex'>${a}</p>`:`<pre class="prettyprint linenums"><code class="language-${n}">${p?a:(0,O.escape)(a,!0)}</code></pre>
|
|
`:'<pre class="prettyprint linenums"><code>'+(p?a:(0,O.escape)(a,!0))+"</code></pre>"},D.heading=function(a,n,p){let l=this.options.headerPrefix+p.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return $.push({anchor:l,level:n,text:a}),"<h"+n+' id="'+l+'">'+a+"</h"+n+">"},x().setOptions({silent:!0,gfm:!0,pedantic:!1}),x().use({tokenizer:A,renderer:D}),K.ZP=x()}}]);
|