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