")), this[t]=""); } }])&&l(t.prototype,r),n&&l(t,n),e; }(),I={ "ue-table-interlace-color-single":"#fcfcfc", "ue-table-interlace-color-double":"#f7faff" },z=function(){ function e(t){ !function(e,t){ if(!(e instanceof t))throw new TypeError("Cannot call a class as a function"); }(this,e),h(this,"_nodes",[]),h(this,"_firstPageNodes",[]),h(this,"_delayNodes",[]), this._config=t; } var t,r,n; return t=e,(r=[{ key:"set", value:function(){ var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]; this._nodes=e; } },{ key:"len", value:function(){ return this._nodes.length; } },{ key:"get", value:function(){ var e=[]; return this._nodes.length?(e=this._nodes,this._nodes=[]):this._delayNodes.length?(e=this._delayNodes, this._delayNodes=[]):this._config.container&&(e=this._config.container.querySelectorAll("*")), e; } },{ key:"delay", value:function(){ var e=this; this._nodes.forEach(function(t){ return e._delayNodes.push(t); }),this._nodes=[]; } },{ key:"addFirstPageNode", value:function(e){ this._firstPageNodes.push(e); } },{ key:"showFirstPageNodes", value:function(){ this._firstPageNodes.forEach(function(e){ return e.style.visibility="visible"; }),this._firstPageNodes=[]; } }])&&c(t.prototype,r),n&&c(t,n),e; }(),J=r(0),V=r.n(J),K=r(1),L=r.n(K); L.a.windowtext=[0,0,0]; var $=new RegExp(Object.keys(L.a).join("|"),"ig"),D=function(){ function e(t){ var r,n,a,o=t.config,i=t.tnQueue,s=t.bgStack,l=t.cssUtils; !function(e,t){ if(!(e instanceof t))throw new TypeError("Cannot call a class as a function"); }(this,e),a=0,(n="_idx")in(r=this)?Object.defineProperty(r,n,{ value:a, enumerable:!0, configurable:!0, writable:!0 }):r[n]=a,this._config=o,this._tnQueue=i,this._bgStack=s,this._cssUtils=l; } var t,r,n; return t=e,(r=[{ key:"_adjustBrightness", value:function(e,t,r){ var n,a=e.hsl().array(),o=e.alpha(),i=e.rgb().array(),s=(299*i[0]+587*i[1]+114*i[2])/1e3,l=""; if(r.isBgColor){ if(t.getAttribute(C)&&o>=.05&&t.removeAttribute(C),0===a[1]&&a[2]>40||s>250)n=V.a.hsl(0,0,Math.min(100,114-a[2]));else if(s>190){ var u=19e4/(299*i[0]+587*i[1]+114*i[2]); n=V.a.rgb(i[0]*u,i[1]*u,i[2]*u); }else a[2]<26&&(a[2]=26,n=V.a.hsl.apply(V.a,p(a))); if(!r.hasInlineColor){ var c=t.getAttribute(j)||"rgba(0,0,0,0.9)",h=n||e,f=this._adjustBrightness(V()(c),t,{ isTextColor:!0, parentElementBgColorStr:h }); l+=f.newColor?this._cssUtils.genCssKV("color",f.newColor):this._cssUtils.genCssKV("color",c); } }else if(r.isTextColor||r.isBorderColor){ var g=r.parentElementBgColorStr||t.getAttribute(A)||"#232323",d=V()(g),b=d.rgb().array(),m=d.hsl().array(),y=d.alpha(),v=(299*b[0]+587*b[1]+114*b[2])/1e3*y+35*(1-y),w=function(e,t){ if(0===e[0]&&0===e[1]&&0===e[2])return V.a.rgb.apply(V.a,p(e)); var r=1e3*t/(299*e[0]+587*e[1]+114*e[2]),n=Math.min(255,e[0]*r),a=Math.min(255,e[1]*r),o=Math.min(255,e[2]*r); return 0===a?a=(1e3*t-299*n-114*o)/587:0===n?n=(1e3*t-587*a-114*o)/299:0===o?o=(1e3*t-299*n-587*a)/114:255===n||255===o?a=(1e3*t-299*n-114*o)/587:255===a&&(o=(1e3*t-299*n-587*a)/114), V.a.rgb(n,a,o); }; if(!t.getAttribute(C))if(s>=250);else if(60>=v&&75>s)a[2]<=40&&(a[2]=90-a[2],s=(299*(i=V.a.hsl.apply(V.a,p(a)).rgb().array())[0]+587*i[1]+114*i[2])/1e3), n=s>=75?V.a.hsl.apply(V.a,p(a)):w(i,75);else if(Math.abs(v-s)<60)if(v>100){ a[2]=90-a[2]; var k=V.a.hsl.apply(V.a,p(a)).rgb().array(); n=v-(299*k[0]+587*k[1]+114*k[2])/1e3<60?w(k,v-60):V.a.hsl.apply(V.a,p(a)); }else a[2]=m[2]+40,n=V.a.hsl.apply(V.a,p(a)); } return{ newColor:n&&n.alpha(o).rgb(), extStyle:l }; } },{ key:"convert", value:function(e){ var t=this,r=e.nodeName; if(this._config.whitelist.tagName.indexOf(r)>-1)return""; var n,a,o,i=e.style,s="",l="",u=!1,c=!1,h=!1,f=(i.cssText&&i.cssText.split(";")||[]).map(function(e){ var t=e.indexOf(":"); return[e.slice(0,t).toLowerCase(),e.slice(t+1)].map(function(e){ return(e||"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""); }); }).filter(function(e){ var t=b(e,2),r=t[0],o=t[1]; return"color"===r?u=!0:/background/i.test(r)&&(c=!0,"background-position"===r?n=o:"background-size"===r&&(a=o)), (/background/i.test(r)||/^(-webkit-)?border-image/.test(r))&&/url\([^\)]*\)/i.test(o)&&(h=!0), ["-webkit-border-image","border-image","color","background-color","background-image","background","border","border-top","border-right","border-bottom","border-left","border-color","border-top-color","border-right-color","border-bottom-color","border-left-color"].indexOf(r)>-1; }).sort(function(e,t){ var r=b(e,1)[0],n=b(t,1)[0]; return"color"===r||"background-image"===r&&"background-color"===n?1:-1; }); if(N.indexOf(r)>-1&&!c){ var g=function(e){ var t=null; return Array.prototype.some.call(e.classList,function(e){ return!!I[e]&&(t=I[e],!0); }),t; }(e); g||(g=e.getAttribute("bgcolor")),g&&(f.unshift(["background-color",V()(g).toString()]), c=!0); } if("FONT"===r&&!u){ var p=e.getAttribute("color"); p&&(f.push(["color",V()(p).toString()]),u=!0); } if(f.forEach(function(r){ var o=b(r,2),l=o[0],f=o[1],g=f,p=!1,m=/ !important$/; f=f.replace(m,"").replace($,function(e){ return"rgb(".concat(L.a[e.toLowerCase()].toString(),")"); }); var y,v=/rgba?\([^)]+\)/gi,w=/^background/.test(l),k="color"===l,M=/^border/.test(l),_=/gradient/.test(f),x="",S=[]; if(!h&&v.test(f)&&(_&&(f.replace(v,function(e){ return S.push(e); }),y=function(e){ if(!e||e.length<1)return""; if(1===e.length)return e[0]; for(var t=e.shift(),r=e.pop();r;)t=V()(t).mix(V()(r)),r=e.pop(); return t; }([].concat(S))),f=f.replace(v,function(r){ _&&(r=y,p=!0); var n=t._adjustBrightness(V()(r),e,{ isBgColor:w, isTextColor:k, isBorderColor:M, hasInlineColor:u }),a=n.newColor; if(x+=n.extStyle,w||k){ var o=w?A:j,i=w?P:O,s=a?a.toString():r; d(e).forEach(function(e){ e.setAttribute(o,s),e.setAttribute(i,r),w&&V()(s).alpha()>=.05&&e.getAttribute(C)&&e.removeAttribute(C); }); } return a&&(p=!0),a||r; }).replace(/\s?!\s?important/gi,"")),x&&(s+=x),!(e instanceof SVGElement)){ var E=/^background/.test(l),N=/^(-webkit-)?border-image/.test(l); if((E||N)&&/url\([^\)]*\)/i.test(f)){ p=!0; var F=e.getAttribute(P)||"#fff"; if(f=f.replace(/^(.*?)url\(([^\)]*)\)(.*)$/i,function(r){ var o=r,i="",u="",h=""; return"1"!==e.getAttribute(C)&&d(e).forEach(function(e){ return e.setAttribute(C,"1"); }),E?(o="linear-gradient(".concat("rgba(0,0,0,0.1)",", ").concat("rgba(0,0,0,0.1)","),").concat(r), h=t._cssUtils.genCssKV(l,"".concat(o,",linear-gradient(").concat(F,", ").concat(F,")")), n&&(i="top left,".concat(n),s+=t._cssUtils.genCssKV("background-position","".concat(i)), h+=t._cssUtils.genCssKV("background-position","".concat(i,",top left"))),a&&(u="100%,".concat(a), s+=t._cssUtils.genCssKV("background-size","".concat(u)),h+=t._cssUtils.genCssKV("background-size","".concat(u,",100%"))), t._bgStack.push(e,h)):!c&&t._bgStack.push(e,t._cssUtils.genCssKV("background-image","linear-gradient(".concat("rgba(0,0,0,0.1)",", ").concat("rgba(0,0,0,0.1)","),linear-gradient(").concat(F,", ").concat(F,")"))), o; }),!u){ var q=e.getAttribute(O)||"rgba(0,0,0,0.9)"; s+=t._cssUtils.genCssKV("color",q),d(e).forEach(function(e){ return e.setAttribute(j,q); }); } } } p&&(m.test(g)&&(i[l]=g.replace(m,"")),_?t._bgStack.push(e,t._cssUtils.genCssKV(l,f)):s+=t._cssUtils.genCssKV(l,f)); }),s){ q&&e.setAttribute("data-style",i.cssText); var m="".concat("js_darkmode__").concat(this._idx++); e.classList.add(m),l+=s?this._cssUtils.genCss(m,s):""; } return o="",e.childNodes.forEach(function(e){ 3===e.nodeType&&(o+=e.nodeValue.replace(/\s/g,"")); }),o.length>0&&(this._config.delayBgJudge?this._tnQueue.push(e):this._bgStack.contains(e,function(e){ l+=t._cssUtils.genCss(e.className,e.cssKV); })),l; } }])&&v(t.prototype,r),n&&v(t,n),e; }(),H=new RegExp("".concat("js_darkmode__","[^ ]+"),"g"),R={ error:null, mode:"", whitelist:{ tagName:["MPCPS","IFRAME"] }, needJudgeFirstPage:!0, delayBgJudge:!1, container:null },Q=new U(R,"".concat("js_darkmode__","text__")),G=new T(R,"".concat("js_darkmode__","bg__")),W=new B(R),X=new z(R),Y=new D({ config:R, tnQueue:Q, bgStack:G, cssUtils:W }),Z=null,et=function(e){ var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ type:"dom" }; if(t.force&&(W.isFinish=!1),!W.isFinish)try{ (W.mode?"dark"===W.mode:e.matches)?("dom"===t.type?X.get().forEach(function(e){ if(e.className&&"string"==typeof e.className&&(e.className=e.className.replace(H,"")), R.needJudgeFirstPage){ var t=e.getBoundingClientRect(),r=t.top,n=t.bottom; 0>=r&&0>=n?W.addCss(Y.convert(e),!1):r>0&&E>r||n>0&&E>n?(X.addFirstPageNode(e),W.addCss(Y.convert(e),!0)):(R.needJudgeFirstPage=!1, W.writeStyle(!0),X.showFirstPageNodes(),W.addCss(Y.convert(e),!1)); }else W.addCss(Y.convert(e),!1); }):"bg"===t.type&&Q.forEach(function(e){ return G.contains(e,function(e){ W.addCss(W.genCss(e.className,e.cssKV),!1); }); }),W.writeStyle()):(R.needJudgeFirstPage=!1,R.delayBgJudge=!1,null===R.container&&"dom"===t.type&&X.len()&&X.delay()); }catch(e){ console.error(e),"function"==typeof R.error&&R.error(e); } }; }]); });