1 line
9.9 KiB
JavaScript
1 line
9.9 KiB
JavaScript
module.exports=[97399,a=>{"use strict";function b(){return{url:"https://pocketbase.hackrobot.cn"}}function c(){return{apiUrl:function(){let a=process.env.PAYMENT_API_INTERNAL_URL?.trim();if(a)return a.replace(/\/$/,"");let b=process.env.PAYMENT_API_URL||"http://127.0.0.1:8007";return/^(https?:\/\/)?(127\.0\.0\.1|localhost)(:\d+)?(\/|$)/i.test(b)?"https://api.hackrobot.cn":b}(),provider:process.env.PAYMENT_PROVIDER||"zpay",zpaySubmitUrl:process.env.ZPAY_SUBMIT_URL||"https://zpayz.cn/submit.php",defaultAmount:Number(process.env.PAYMENT_DEFAULT_AMOUNT)||18800,nomadvipPayPath:"/nomadvip/payh5"}}process.env.PAYJSAPI_PORT,a.s(["getPaymentConfig",()=>c,"getPocketBaseConfig",()=>b])},13049,80048,a=>{"use strict";function b(){return!("u"<typeof navigator)&&/MicroMessenger/i.test(navigator.userAgent)?"wechat":!("u"<typeof navigator)&&/AppleWebKit.*Mobile|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"h5":"pc"}function c(a){return"wechat"===a?"wechat":"pc"===a?"pc":"h5"}a.s(["getDeviceFromEnv",()=>c,"getPayEnv",()=>b],80048);var d=a.i(97399);let e="nomadvip_anon_uid",f="nomadvip_pay_order";function g(a,b){}function h(a){if("u"<typeof document||!/^user\d+$/.test(a))return;let b="https:"===window.location.protocol?"; Secure":"";document.cookie=`${e}=${encodeURIComponent(a)}; Path=/; Max-Age=2592000; SameSite=Lax${b}`}function i(){let a=function(){let a=null;if(a&&/^user\d+$/.test(a))return a;let b=null;if(b&&/^user\d+$/.test(b))return b;let c=function(a){if("u"<typeof document)return null;let b=document.cookie.match(RegExp(`(?:^|; )${a}=([^;]*)`));return b?decodeURIComponent(b[1]):null}(e);return c&&/^user\d+$/.test(c)?(g("memosAccount",c),c):null}();if(a)return g("userId",a),h(a),a;let b=null;if(b?.startsWith("{")&&b.includes("data"))try{let a=JSON.parse(b);a?.data&&(b=a.data,g("userId",b))}catch{b=null}return b||g("userId",b=`user${Date.now()}`),b}async function j(){let a=i();if(a&&!a.startsWith("user"))return a;try{let a=await fetch("/api/auth/me",{credentials:"include",cache:"no-store"}),b=await a.json();if(b?.user?.id)return g("userId",b.user.id),b.user.id}catch{}return a}async function k(a,b){let c=await fetch("/api/pay",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,device:"h5",provider:"zpay",html:"0"})}),d=await c.json().catch(()=>({}));if(!d?.ok)return alert(d?.error||"支付发起失败"),null;let e=!!d?.redirect_url,h=!!d?.params&&!!d?.payUrl;if(!e&&!h)return alert(d?.error||"支付发起失败"),null;let i=d?.order_id?.trim()||null;if(i){let a;(a=i.trim())&&(!function(a){if("u"<typeof document)return;let b=a.trim();if(!b)return;let c="https:"===window.location.protocol?"; Secure":"";document.cookie=`${f}=${encodeURIComponent(`${b}|${Date.now()}`)}; Path=/; Max-Age=900; SameSite=Lax${c}`}(a),g(f,`${a}|${Date.now()}`)),b?.(i)}if(d?.redirect_url)return window.location.href=d.redirect_url,i;let j=document.createElement("form");for(let[a,b]of(j.method="POST",j.action=d.payUrl,j.target="_self",j.style.display="none",Object.entries(d.params))){if(null==b)continue;let c=document.createElement("input");c.type="hidden",c.name=a,c.value=String(b),j.appendChild(c)}return document.body.appendChild(j),j.submit(),document.body.removeChild(j),i}async function l(a){var e;let f="u">typeof navigator&&/MicroMessenger/i.test(navigator.userAgent)?i():await j();/^user\d+$/.test(f)&&(g("memosAccount",f),g("userId",f),h(f));let l=`${window.location.origin}/paid`,m=c(b()),n={user_id:f,return_url:l,total_fee:(0,d.getPaymentConfig)().defaultAmount??8800,type:"vip",channel:"wxpay"};if("wechat"===m){let a;(a=document.createElement("form")).method="POST",a.action="/api/pay",a.target="_self",a.style.display="none",[["user_id",n.user_id],["return_url",n.return_url],["total_fee",String(n.total_fee)],["type",n.type],["channel",n.channel],["device","wechat"],["provider","xorpay"],["html","1"]].forEach(([b,c])=>{let d=document.createElement("input");d.type="hidden",d.name=b,d.value=c,a.appendChild(d)}),document.body.appendChild(a),a.submit()}else if("h5"===m)await k(n,a);else{let a;e={...n,device:m},(a=document.createElement("form")).method="POST",a.action="/api/pay",a.target="_self",a.style.display="none",[["user_id",e.user_id],["return_url",e.return_url],["total_fee",String(e.total_fee)],["type",e.type],["channel",e.channel],["device",e.device],["provider","zpay"],["html","1"]].forEach(([b,c])=>{let d=document.createElement("input");d.type="hidden",d.name=b,d.value=c,a.appendChild(d)}),document.body.appendChild(a),a.submit()}}a.s(["triggerPay",()=>l],13049)},91536,a=>{a.v({bigNumber:"vip-module__C0jyLa__bigNumber",bigNumberLabel:"vip-module__C0jyLa__bigNumberLabel",btnLarge:"vip-module__C0jyLa__btnLarge",btnPrimary:"vip-module__C0jyLa__btnPrimary",btnSecondary:"vip-module__C0jyLa__btnSecondary",card:"vip-module__C0jyLa__card",freeBadge:"vip-module__C0jyLa__freeBadge",header:"vip-module__C0jyLa__header",heroSection:"vip-module__C0jyLa__heroSection",loading:"vip-module__C0jyLa__loading",loadingSpinner:"vip-module__C0jyLa__loadingSpinner",loginCard:"vip-module__C0jyLa__loginCard",loginCardLabel:"vip-module__C0jyLa__loginCardLabel",loginCardLink:"vip-module__C0jyLa__loginCardLink",loginCardRow:"vip-module__C0jyLa__loginCardRow",loginCardTitle:"vip-module__C0jyLa__loginCardTitle",loginCardValue:"vip-module__C0jyLa__loginCardValue",loginLink:"vip-module__C0jyLa__loginLink",logo:"vip-module__C0jyLa__logo",main:"vip-module__C0jyLa__main",nav:"vip-module__C0jyLa__nav",root:"vip-module__C0jyLa__root",section:"vip-module__C0jyLa__section",sectionDesc:"vip-module__C0jyLa__sectionDesc",sectionTitle:"vip-module__C0jyLa__sectionTitle",spin:"vip-module__C0jyLa__spin",statsGrid:"vip-module__C0jyLa__statsGrid",statsGrid4:"vip-module__C0jyLa__statsGrid4",statsSection:"vip-module__C0jyLa__statsSection",topicCard:"vip-module__C0jyLa__topicCard",topicCardInner:"vip-module__C0jyLa__topicCardInner",topicDesc:"vip-module__C0jyLa__topicDesc",topicGrid:"vip-module__C0jyLa__topicGrid",topicIcon:"vip-module__C0jyLa__topicIcon",topicLock:"vip-module__C0jyLa__topicLock",topicTitle:"vip-module__C0jyLa__topicTitle",topicsSection:"vip-module__C0jyLa__topicsSection",userBadge:"vip-module__C0jyLa__userBadge",vipTag:"vip-module__C0jyLa__vipTag"})},26043,67690,a=>{"use strict";function b(){return!1}function c(a,b){return!1}a.s(["canWatchLesson",()=>c,"isPaid",()=>b],26043);var d=a.i(81629),e=a.i(84365),f=a.i(13049),g=a.i(91536);function h({open:a,onClose:b}){return((0,e.useEffect)(()=>(a?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[a]),(0,e.useEffect)(()=>{if(!a)return;let c=a=>{"Escape"===a.key&&b()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a,b]),a)?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",role:"dialog","aria-modal":"true","aria-labelledby":"qa-vip-modal-title",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:b}),(0,d.jsxs)("div",{className:"relative w-full max-w-[360px] rounded-2xl border border-[var(--border)] bg-[var(--card)] p-6 shadow-2xl animate__animated animate__fadeIn animate__faster",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"mb-4 flex items-center gap-3",children:[(0,d.jsx)("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[var(--accent)]/20 text-xl",children:"💬"}),(0,d.jsx)("h2",{id:"qa-vip-modal-title",className:"text-lg font-semibold text-[var(--foreground)]",style:{margin:0},children:"即时问答"})]}),(0,d.jsx)("p",{className:"mb-6 text-sm leading-relaxed text-[var(--muted-foreground)]",children:"即时问答是会员专享的贴心服务,开通后即可获得一对一技术咨询支持,随时解答你的疑问~"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)("button",{type:"button",onClick:()=>{b(),(0,f.triggerPay)()},className:`${g.default.btnPrimary} ${g.default.btnLarge} w-full`,children:"立即开通 →"}),(0,d.jsx)("button",{type:"button",onClick:b,className:"w-full rounded-full border border-[var(--border)] py-2.5 text-sm text-[var(--muted-foreground)] transition hover:bg-[var(--muted)] hover:text-[var(--foreground)]",children:"稍后再说"})]})]})]}):null}a.s(["InstantQaVipModal",()=>h],67690)},65648,a=>{"use strict";var b=a.i(81629),c=a.i(84365),d=a.i(26043),e=a.i(67690);function f(){let[a,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)(!1);(0,c.useEffect)(()=>{f((0,d.isPaid)());let a=()=>f((0,d.isPaid)());return window.addEventListener("pay:updated",a),()=>window.removeEventListener("pay:updated",a)},[]);let i="animate__animated animate__bounceIn fixed bottom-6 right-6 z-40 flex h-12 w-12 items-center justify-center rounded-full shadow-lg transition-all hover:scale-110";return a?(0,b.jsx)("a",{href:"https://chatwoot.hackrobot.cn/livechat?user_id=hackrobot",target:"_blank",rel:"noopener noreferrer",className:`${i} bg-[var(--accent)] text-[var(--accent-foreground)] shadow-[var(--accent)]/30 hover:shadow-xl hover:shadow-[var(--accent)]/40`,style:{animationDelay:"0.5s",animationFillMode:"both"},"aria-label":"即时问答",children:(0,b.jsx)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,b.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("button",{type:"button",onClick:()=>h(!0),className:`${i} bg-[var(--accent)] text-[var(--accent-foreground)] shadow-[var(--accent)]/30 hover:shadow-xl hover:shadow-[var(--accent)]/40`,style:{animationDelay:"0.5s",animationFillMode:"both"},"aria-label":"即时问答(开通VIP解锁)",title:"即时问答",children:(0,b.jsx)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,b.jsx)("path",{d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),(0,b.jsx)(e.InstantQaVipModal,{open:g,onClose:()=>h(!1)})]})}a.s(["ChatFloatButton",()=>f])}]; |