diff --git a/1272.async.js b/1272.async.js index 5585bfac9e..72d05f84a6 100644 --- a/1272.async.js +++ b/1272.async.js @@ -1,5 +1,6 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1272],{6629:function(ie,j,o){var e=o(59301),D=o(93314),K=o(3113),x=Object.defineProperty,V=Object.defineProperties,S=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,Z=(y,_,E)=>_ in y?x(y,_,{enumerable:!0,configurable:!0,writable:!0,value:E}):y[_]=E,W=(y,_)=>{for(var E in _||(_={}))O.call(_,E)&&Z(y,E,_[E]);if(R)for(var E of R(_))H.call(_,E)&&Z(y,E,_[E]);return y},z=(y,_)=>V(y,S(_));const J=({img:y,buttonProps:_={},styles:E={},customText:U,ButtonText:A,ButtonClick:Q,Buttonclass:h,ButtonTwo:n,imgStyles:v,loading:f=!1})=>e.createElement("section",{className:"tc animated fadeIn",style:W(W({},{color:"#999",margin:"100px auto",visibility:f?"hidden":"visible"}),E)},e.createElement("img",{src:y||D,style:z(W({},v),{pointerEvents:"none",userSelect:"none"})}),e.createElement("p",{className:"mt20 font14"},U||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),A&&e.createElement(K.ZP,W({className:h,onClick:Q},_),A),n&&n);j.Z=J},95333:function(ie,j,o){o.d(j,{Z:function(){return Q}});var e=o(59301),D={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},K=o(3113),x=o(74516),V=o(90612),S=o(6848),R=o(15826),O=o(21797),H=o(6629),Z=o(46961),W=o(70891),z=Object.defineProperty,J=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,E=(h,n,v)=>n in h?z(h,n,{enumerable:!0,configurable:!0,writable:!0,value:v}):h[n]=v,U=(h,n)=>{for(var v in n||(n={}))y.call(n,v)&&E(h,v,n[v]);if(J)for(var v of J(n))_.call(n,v)&&E(h,v,n[v]);return h},A=(h,n,v)=>new Promise((f,u)=>{var r=l=>{try{d(v.next(l))}catch(p){u(p)}},t=l=>{try{d(v.throw(l))}catch(p){u(p)}},d=l=>l.done?f(l.value):Promise.resolve(l.value).then(r,t);d((v=v.apply(h,n)).next())}),Q=({editOffice:h="view",data:n,theme:v,type:f,filename:u,monacoEditor:r,className:t,style:d,close:l,onClose:p,hasMask:m,disabledDownload:P,onImgDimensions:B,showNodata:T,recordInfo:c})=>{const[$,X]=(0,e.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[M,ne]=(0,e.useState)(""),[L,le]=(0,e.useState)(),q=window.ENV==="build"?"/react/build":"",w=location.host.startsWith("localhost")?Z.Z.PROXY_SERVER:Z.Z.API_SERVER,ue=10*(1024*1024),re=(0,e.useRef)();n!=null&&n.startsWith("/api")&&f!=="txt"&&(n=Z.Z.API_SERVER+n);const oe=b=>b.substring(b.lastIndexOf("/")+1).split(".").pop();u&&(r.filename=u),(0,e.useEffect)(()=>{var b,Y;const N=(Y=(b=document.cookie)==null?void 0:b.replace(/\s/g,""))==null?void 0:Y.split(";");N==null||N.map(C=>{let ee=C.split("=");ee[0]==="_educoder_session"&&ne(ee[1])})},[]),(0,e.useEffect)(()=>{f==="office"&&(n.indexOf("bigfilescdn.")>-1||n.indexOf("bigfiles1")>-1?le({url:n,fileType:oe(n),model:n.indexOf("model=edit")?"edit":"view"}):de())},[f,n]);const de=()=>A(void 0,null,function*(){console.log("data:",n);let b=n;n.startsWith("http")||(b=location.origin+b);let Y=new URL(b).pathname.split("/").pop();const N=yield(0,O.gJ)({attachment_id:Y});N.url=w+N.url,le(N)}),ae=()=>{if(n.startsWith("http")||n.startsWith("blob:")){G();return}(0,R.Sv)(u||"educoder",n,u)},G=()=>{c&&(0,W.fc)({id:c==null?void 0:c.id,watch_type:1,course_id:c==null?void 0:c.course_id}),(0,R.Nd)(u||"educoder",decodeURIComponent(n))};return e.createElement("div",{style:U({},d||{}),className:`${m&&D.bgBlack} ${f?D.wrp:"hide"}`},l&&e.createElement("div",{className:D.close,ref:re},!!B&&e.createElement(S.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>re.current},e.createElement("span",{onClick:()=>{p(),B()}},e.createElement("i",{className:"icon-yulanpizhu"}))),!P&&e.createElement(S.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>re.current},e.createElement("span",{onClick:G},e.createElement("i",{className:"icon-quxiaozhiding"}))),e.createElement(S.Z,{title:"\u5173\u95ED",getPopupContainer:()=>re.current},e.createElement("span",{className:"",onClick:p},e.createElement("i",{className:"icon-guanbi1"})))),e.createElement("div",{className:`${D[t]} ${t} ${D.monaco} ${f==="txt"?"show":"hide"}`},f==="txt"&&e.createElement(e.Fragment,null,e.createElement(V.ZP,U({},r)))),f==="audio"&&e.createElement("audio",{src:`${(n==null?void 0:n.indexOf("http://"))>-1||(n==null?void 0:n.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${n}`,autoPlay:!0}),f==="video"&&e.createElement(e.Fragment,null,(n==null?void 0:n.indexOf("http"))>-1?e.createElement("video",{controls:!0,src:`${n}`,autoPlay:!0}):e.createElement("video",{controls:!0,src:`data:video/mp4;base64,${n}`,autoPlay:!0})),f==="office"&&L&&e.createElement("iframe",{src:`${q}/office.html?key=${L.key}&url=${btoa(L.url)}&callbackUrl=${w+L.callbackUrl}&fileType=${L.fileType}&title=${L.title}&model=${h}&officeServer=${Z.Z.ONLYOFFICE}&disabledDownload=${!!P}`}),f==="html"&&e.createElement("iframe",{src:n+"&disposition=inline"}),f==="pdf"&&e.createElement("iframe",{src:`${q}/js/pdfview/index.html?url=${encodeURIComponent(n)}&disabledDownload=${!!P}`}),f==="image"&&e.createElement("img",{src:`${(n==null?void 0:n.indexOf("http://"))>-1||(n==null?void 0:n.indexOf("https://"))>-1?"":"data:image/png;base64,"}${n}`}),(f==="other"||f==="download")&&e.createElement(e.Fragment,null,T?e.createElement(H.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:e.createElement(K.ZP,{icon:e.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:ae},"\u4E0B\u8F7D")}):e.createElement(K.ZP,{type:"primary",size:"middle",onClick:ae},e.createElement(x.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")))}},31272:function(ie,j,o){o.d(j,{z:function(){return f}});var e=o(59301),D=o(15826),K=o(8341),x=o(42661),V=o(64018),S=o.n(V),R=o(63824),O=o(46961),H=o(15342),Z=o.n(H),W=o(1012),z=o(95333),J=Object.defineProperty,y=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,U=(u,r,t)=>r in u?J(u,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[r]=t,A=(u,r)=>{for(var t in r||(r={}))_.call(r,t)&&U(u,t,r[t]);if(y)for(var t of y(r))E.call(r,t)&&U(u,t,r[t]);return u};const Q="@\u2581\u2581@",h="@\u2581@",n=/]*>/g;function v(u){let r=document.createElement("div");return r.innerHTML=u,r.childNodes.length===0?"":r.childNodes[0].nodeValue}const f=(u,r)=>{u=u||"";const t=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,d=/\"(?: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 r?u.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(t,(p,m,P,B,T,c,$)=>{const X=m||B||c,M=P||T||$||"?";return O.Z.API_SERVER+"/api/attachments/"+X+M+"&t="+(0,D.Jn)(X,Date.now())+(p.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(u=u.replace(t,(p,m,P,B,T,c,$)=>{const X=m||B||c,M=P||T||$||"?";return O.Z.API_SERVER+"/api/attachments/"+X+M+"&t="+(0,D.Jn)(X,Date.now())+(p.indexOf(")")>-1?")":"&")}).replace(d,(p,m,P,B,T)=>{const c=m||B,$=P||T||"";return'"'+O.Z.API_SERVER+"/api/attachments/"+c+$+c+$+"&t="+(0,D.Jn)(c,Date.now())}).replace(l,(p,m,P,B,T)=>{const c=m||B,$=P||T||"";return"("+O.Z.API_SERVER+"/files/uploads/"+c+$+c+$+"&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)};j.Z=({value:u="",className:r,showTextOnly:t,showLines:d,style:l={},stylesPrev:p={},highlightKeywords:m,showProgramFill:P,isProgramFill:B,disabledFill:T=!1,programFillValue:c,onFillChange:$=M=>{},onFillBlur:X=()=>{}})=>{let M=String(u);const[ne,L]=(0,e.useState)(""),[le,q]=(0,e.useState)("office"),[w,se]=(0,e.useState)([]),ue=(0,e.useRef)("a"+(0,W.Z)()),re=(0,e.useRef)(Date.now()).current,oe={},de=(a,g,s)=>{const i=document.createElement(a===h?"input":"textarea");i.style.width="100%",i.style.height=a===h?"40px":"151px",i.rows=5,i.spellcheck=!1,i.name="edu-program-fill",i.placeholder="\u8BF7\u8F93\u5165",i.dataset.id=g;const I=Object.keys(oe).length;return oe[I]=i,`${i.outerHTML}`},ae=a=>a.replace(/([\s\S]+?)<\/style>/gim,function(g,s){let i=s.replace(/(\n|\r)/g,"").split("}"),I=[];return i.map(F=>{F!=""&&I.push(`.${ue.current} ${F}`)}),``}),G=(0,e.useMemo)(()=>{try{M=f(M)}catch(i){}if(P){let i=-1;return M=M.replaceAll("<","<").replaceAll(">",">").replace(/(@▁▁@|@▁@)/g,function(I,F,ce){var k;return++i,de(I,i,(k=c==null?void 0:c[i])==null?void 0:k.value)}),`
${ae(M||"")}
`}let a=ae(M);a=(0,x.ZP)(a);const g=(0,x.ez)();M.match(/\[TOC\]/)&&(a=a.replace("

[TOC]

",(0,x.Qv)()),(0,x.Iy)()),a=a.replace(/(__special_katext_id_\d+__)/g,(i,I)=>{const{type:F,expression:ce}=g[I];return(0,H.renderToString)(v(ce)||"",{displayMode:F==="block",throwOnError:!1,output:"html"})}),a=a.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,x.AL)();const s=document.createElement("div");if(s.innerHTML=a,m){const i=m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return N(s,i),s.innerHTML}return t?s.innerText:(setTimeout(()=>pe(),500),s.innerHTML)},[M,m]);(0,e.useEffect)(()=>{C.current&&C.current.querySelectorAll(["input","textarea"]).forEach(g=>{g.oninput=b,g.onblur=Y})},[w]),(0,e.useEffect)(()=>{var a,g,s,i,I;if(c!=null&&c.length)try{const F=C.current.querySelectorAll(".edu-program-fill-score"),ce=C.current.querySelectorAll('[name="edu-program-fill"]');for(const[k,te]of ce.entries())te.value=((a=c==null?void 0:c[k])==null?void 0:a.value)||"",((g=c==null?void 0:c[k])==null?void 0:g.type)==="warning"?te.className="program-fill-warning":((s=c==null?void 0:c[k])==null?void 0:s.type)==="success"?te.className="program-fill-success":te.className="";for(const[k,te]of F.entries())te.innerHTML=(i=c==null?void 0:c[k])!=null&&i.score?`${(I=c==null?void 0:c[k])==null?void 0:I.score}\u5206`:"";se(c)}catch(F){console.log(F,"error")}},[c]);const b=a=>{w[a.target.dataset.id]=w[a.target.dataset.id]||{},w[a.target.dataset.id].value=a.target.value,se([...w]),$(w,a.target.dataset.id)},Y=a=>{w[a.target.dataset.id]=w[a.target.dataset.id]||{},w[a.target.dataset.id].value=a.target.value,se([...w]),X(w,a.target.dataset.id)};function N(a,g){return a.childNodes.forEach(s=>{var i;if(s.childNodes.length>0)N(s,g);else if(s.nodeName!=="IMG")if(s.innerHTML)s.innerHTML=(i=s.innerHTML)==null?void 0:i.replace(new RegExp(g,"gi"),'$&');else{const I=document.createElement("span");I.innerHTML=s.textContent.replace(new RegExp(g,"gi"),'$&'),s.replaceWith(I)}})}const C=(0,e.useRef)();x.jb.WebkitLineClamp=d,d&&(l=A(A({},l),x.jb));function ee(a){let g=a.target;if(g.tagName.toUpperCase()==="A"){let s=g.getAttribute("href");if(s.indexOf("office")>-1)a.preventDefault(),L(s),q("office");else if(s.indexOf("application/pdf")>-1)a.preventDefault(),L(s),q("pdf");else if(s.indexOf("text/html")>-1)a.preventDefault(),L(s),q("html");else if(s.startsWith("#")){a.preventDefault();let i=document.getElementById(s.replace("#",""));i&&i.scrollIntoView(!0)}}}const pe=()=>{var a;const g=(a=C.current)==null?void 0:a.querySelectorAll("video");g==null||g.forEach(s=>{if(s.oncontextmenu=()=>!1,s.src.indexOf(".m3u8")>-1&&!s.canPlayType("application/vnd.apple.mpegurl")){if(R.ZP.isSupported()){var i=new R.ZP;i.loadSource(s.src),i.attachMedia(s)}}})};return(0,e.useEffect)(()=>{if(C.current&&G&&G.match(n)&&window.PR.prettyPrint(),C.current)return C.current.addEventListener("click",ee),()=>{var a;(a=C.current)==null||a.removeEventListener("click",ee),(0,x.AL)(),(0,x.Iy)()}},[G,C.current,ee]),e.createElement(e.Fragment,null,t&&e.createElement("div",{ref:C},G),!t&&e.createElement("div",{ref:C,style:A({},l),className:`${r||""} ${T?"disabled-fill":""} markdown-body ${ue.current}`,dangerouslySetInnerHTML:{__html:G}}),e.createElement(z.Z,{close:!0,data:ne,type:ne!=null&&ne.length?le:"",style:A({},p),onClose:()=>L("")}))}},42661:function(ie,j,o){o.d(j,{AL:function(){return h},Iy:function(){return Z},Qv:function(){return J},ez:function(){return Q},jb:function(){return W}});var e=o(32834),D=o.n(e),K=o(11690),x=o.n(K);function V(r,t){const d=r.match(/^(\s+)(?:```)/);if(d===null)return t;const l=d[1];return t.split(` -`).map(p=>{const m=p.match(/^\s+/);if(m===null)return p;const[P]=m;return P.length>=l.length?p.slice(l.length):p}).join(` -`)}let S=[],R=["