1import{d as L,r as M,w as U,c as p,o as j,Z as q,z as d,B as a,G as i,X as z,C as l}from"./vendor-vue-Dzwqm9Y9.js";import{a as D}from"./index-D4B9XJED.js";import{u as I}from"./vendor-i18n-BuoWFzps.js";import"./vendor-misc-B-nM3tYW.js";const Q={class:"min-h-screen bg-gray-50 px-4 py-10 dark:bg-dark-900"},V={class:"mx-auto max-w-2xl"},F={class:"card p-6"},G={class:"text-lg font-semibold text-gray-900 dark:text-white"},N={class:"mt-2 text-sm text-gray-600 dark:text-gray-400"},O={key:0,class:"mt-6 flex items-center justify-center py-10"},X={key:1,class:"mt-6 rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-dark-700 dark:bg-dark-800/80"},Z={class:"text-sm text-gray-700 dark:text-gray-300"},ee=L({__name:"WechatPaymentCallbackView",setup(H){const{t:c}=I(),f=z(),m=q(),g=D(),s=M("");U(s,t=>{t&&g.showError(t)});const k=p(()=>c("auth.wechatPayment.callbackProcessing")),b=p(()=>c("auth.wechatPayment.callbackTitle")),w=p(()=>c("auth.wechatPayment.backToPayment"));function x(t){const e=f.query[t];return Array.isArray(e)?typeof e[0]=="string"?e[0]:"":typeof e=="string"?e:""}function v(){const t=typeof window<"u"?window.location.hash:"",e=t.startsWith("#")?t.slice(1):t;return new URLSearchParams(e)}function P(t){const e=(t||"").trim();return!e||!e.startsWith("/")||e.startsWith("//")||e.includes("://")||e==="/payment"?"/purchase":e.startsWith("/payment?")?"/purchase"+e.slice(8):e}function n(t,e,o){o&&(t[e]=o)}function T(){m.replace("/purchase")}return j(async()=>{const t=v(),e=_=>t.get(_)||x(_),o=e("error")||e("err_msg")||e("errmsg"),R=e("error_description")||e("message");if(o){s.value=R||o;return}const u=e("wechat_resume_token"),y=e("openid"),B=e("state"),S=e("scope"),W=e("payment_type"),C=e("amount"),A=e("order_type"),E=e("plan_id"),h=new URL(P(e("redirect")),window.location.origin);if(!u&&!y){s.value=c("auth.wechatPayment.callbackMissingResumeToken");return}const r={...Object.fromEntries(h.searchParams.entries()),wechat_resume:"1"};u?r.wechat_resume_token=u:(r.openid=y,n(r,"state",B),n(r,"scope",S),n(r,"payment_type",W),n(r,"amount",C),n(r,"order_type",A),n(r,"plan_id",E)),await m.replace({path:h.pathname,query:r})}),(t,e)=>(l(),d("div",Q,[a("div",V,[a("div",F,[a("h1",G,i(b.value),1),a("p",N,i(s.value||k.value),1),s.value?(l(),d("div",X,[a("p",Z,i(s.value),1),a("button",{class:"btn btn-primary mt-4",type:"button",onClick:T},i(w.value),1)])):(l(),d("div",O,[...e[0]||(e[0]=[a("div",{class:"h-8 w-8 animate-spin rounded-full border-4 border-primary-500 border-t-transparent"},null,-1)])]))])])]))}});export{ee as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.