PageSourceSearch

https://fictionme.net/n_assets/BWtEfKRp.js

js fictionme.net collected 2026-10-02 05:31:56 UTC 48,716 bytes, 496 lines download raw bytes

1import{y as $t,ad as Lt,a5 as Tt,I as Ft}from"#entry";const Z="https://sdk-web.y.uno/v1.6/main.js",Q="WALLET",Mt=3e3;let M=null;function Rt(o=Z){if(typeof window>"u"||typeof window.Yuno<"u")return Promise.resolve();if(M)return M;const c=new Promise((a,k)=>{const I=document.querySelector(`script[src="${o}"]`);if(I){I.addEventListener("load",()=>a()),I.addEventListener("error",()=>k(new Error("Failed to load Yuno SDK")));return}const w=document.createElement("script");w.src=o,w.async=!0,w.defer=!0,w.onload=()=>a(),w.onerror=()=>k(new Error("Failed to load Yuno SDK")),document.head.appendChild(w)}).catch(a=>{throw M=null,a});return M=c,c}function Ot(){const o=Tt();let c={theme:"light",stylePrefix:"gzbryz4m8pq6xbe9b93zy4vs6359l1p2",apiEndpoint:"/api/yuno/session/payload",apiStatusEndpoint:"/api/yuno/session/payment-status/payload",domain:window.location.origin,sessionParamName:"session",statusParamName:"status",sessionInQueryParam:!0,sessionId:null,statusId:null,yunoSdkUrl:Z,paymentSelector:"#payment-selector",enrollmentFormContainerSelector:"#enrollment-form-container",actionFormContainerSelector:"#action-form-container",paymentMethodsListSelector:"#payment-methods-list",paymentMethodsListItemSelector:"#payment-method-list-item",checkoutFormContainerSelector:"#checkout-form-container",paymentBtnSelector:"#button-pay",customCheckout:!1,paymentMethods:[]},a={appData:null,yuno:null,flowType:"checkout"};async function k(t={}){const e=D,n=()=>{D=e};if(c={...c,keepFormOnFailure:!1,suppressSuccessMessage:!1,suppressRedirect:!1,customCheckout:!1,paymentMethods:[],...t},R=!1,Y=!1,x=null,_=null,o.log("[YunoIntegration] Initializing...",c),c.customCheckout&&!(c.paymentMethods??[]).length){o.error("[YunoIntegration] customCheckout requires a non-empty paymentMethods list"),l("customCheckoutFailed",{message:"paymentMethods is empty"});return}if(c.sessionInQueryParam&&(c.sessionId=I()),c.statusId||(c.statusId=w()),c.sessionId){o.log("[YunoIntegration] Session ID:",c.sessionId);const r=nt();r.catch(()=>{});try{await N(c.sessionId)}catch(i){o.error("[YunoIntegration] Failed to load session data:",i),l("sessionFailed",{message:i.message??""}),n();return}try{await r}catch(i){o.error("[YunoIntegration] Failed to load Yuno SDK:",i),l("sdkNotLoaded",{message:i?.message??""}),n();return}D=[],await dt(e),await ot(),await j(),B()}else if(c.statusId){o.log("[YunoIntegration] Status ID:",c.statusId);try{await tt(c.statusId)}catch(r){o.error("[YunoIntegration] Failed to load status data:",r),l("sessionFailed",{message:r.message??""});return}await j(),B()}else l("sessionNotExists",{message:"No session parameter found in URL"}),o.info("[YunoIntegration] No session/status parameter found in URL")}function I(){return new URLSearchParams(window.location.search).get(c.sessionParamName)}function w(){return new URLSearchParams(window.location.search).get(c.statusParamName)}async function N(t){o.log("[YunoIntegration] Fetching session data...");const e=await fetch(`${c.domain}${c.apiEndpoint}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({session:t})});if(!e.ok){const i=await e.text();let m=null;try{m=JSON.parse(i)}catch{}throw!m||typeof m!="object"?(o.error("[YunoIntegration] HTTP Error:",i),d("CLOSE_WEBVIEW"),l("sessionFailed",{message:"Non-JSON Response",status:e.status}),u("Session is failed"),await p({message:"decode session fail",responseStatus:e.status,response:i.slice(0,500)})):typeof m.code=="string"&&(o.error("[YunoIntegration] HTTP Error:",m),d("CLOSE_WEBVIEW"),l("sessionFailed",{message:m.code,status:e.status}),u(m.errors?.message??"Session is failed"),await p({message:"decode session fail",responseStatus:e.status,response:m})),new Error(`HTTP error! status: ${e.status}`)}const n=e.headers.get("content-type");if(!n||!n.includes("application/json")){const i=await e.text();throw o.error("[YunoIntegration] Non-JSON Response:",i),d("CLOSE_WEBVIEW"),l("sessionFailed",{message:"Non-JSON Response",status:e.status}),await p({message:"session failed",responseStatus:e.status,response:i.slice(0,500)}),new Error(`HTTP error! status: ${e.status}`)}const{data:r}=await e.json();a.appData=r.payload??null,a.flowType=et(r),o.log("[YunoIntegration] Flow type:",a.flowType),l("sessionSuccess",{message:"Client session processed",flow:a.flowType}
1),a.appData.user&&l("loadUser",{message:"User data",data:a.appData.user}),a.appData.device&&l("loadDevice",{message:"Device data",data:a.appData.device}),a.appData.product&&l("loadProduct",{message:"Product data",data:a.appData.product}),p({message:"Session encrypted",flow:a.flowType}).then()}async function tt(t){o.log("[YunoIntegration] Fetching status data...");const e=await fetch(`${c.domain}${c.apiStatusEndpoint}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({token:t})});if(!e.ok){const i=await e.text();let m=null;try{m=JSON.parse(i)}catch{}throw!m||typeof m!="object"?(u("Status token is failed"),o.error("[YunoIntegration] HTTP Error:",i),l("statusTokenFailed",{message:"Non-JSON Response",status:e.status}),await p({message:"decode status token fail",responseStatus:e.status,response:i.slice(0,500)}),d("CLOSE_WEBVIEW")):typeof m.code=="string"&&(o.error("[YunoIntegration] HTTP Error:",m),u(m.errors?.message??"Status token is failed"),l("statusTokenFailed",{message:m.code,status:e.status}),await p({message:"decode status token fail",responseStatus:e.status,response:m}),d("CLOSE_WEBVIEW")),new Error(`HTTP error! status: ${e.status}`)}const n=e.headers.get("content-type");if(!n||!n.includes("application/json")){const i=await e.text();throw o.error("[YunoIntegration] Non-JSON Response:",i),l("statusTokenFailed",{message:"Non-JSON Response",status:e.status}),await p({message:"status token failed",responseStatus:e.status,response:i.slice(0,500)}),d("CLOSE_WEBVIEW"),new Error(`HTTP error! status: ${e.status}`)}const{data:r}=await e.json();a.appData=r.payload??null,a.flowType="status",o.log("[YunoIntegration] Flow type: status"),l("statusTokenSuccess",{message:"Client status token processed",flow:a.flowType}),a.appData.user&&l("loadUser",{message:"User data",data:a.appData.user}),a.appData.device&&l("loadDevice",{message:"Device data",data:a.appData.device}),a.appData.product&&l("loadProduct",{message:"Product data",data:a.appData.product}),p({message:"Session encrypted",flow:a.flowType}).then()}function et(t){return t.flow?t.flow:t.payload?.checkoutSession?"checkout":t.customerSession?"enrollment":"checkout"}function nt(){return typeof window.Yuno<"u"?(o.log("[YunoIntegration] SDK already loaded"),l("sdkLoaded",{message:"Yuno SDK already loaded"}),Promise.resolve()):(o.log("[YunoIntegration] Loading Yuno SDK..."),Rt(c.yunoSdkUrl).then(()=>{o.log("[YunoIntegration] SDK loaded successfully"),l("sdkLoaded",{message:"Yuno SDK loaded successfully"})},t=>{throw l("sdkNotLoaded",{message:"Failed to load Yuno SDK"}),t}))}async function ot(){if(o.log("[YunoIntegration] Initializing Yuno SDK..."),typeof window.Yuno>"u")throw l("sdkNotLoaded",{message:"Yuno SDK not loaded"}),new Error("Yuno SDK not loaded");a.yuno=await window.Yuno.initialize(a.appData.publicKey),o.log("[YunoIntegration] Yuno initialized:",a.yuno),l("sdkInitialized",{message:"Yuno SDK initialized"})}async function j(){switch(a.flowType){case"checkout":at(),A();break;case"enrollment":rt(),it();break;case"status":A();break;default:l("flowUndefined",{message:"undefined flow: "+a.flowType}),o.error("[YunoIntegration] Unknown flow type:",a.flowType)}}function at(){o.log("[YunoIntegration] Starting Rendering Checkout html elements...");let t=document.getElementById(f());t?t.innerHTML="":(t=document.createElement("div"),t.id=f(),document.body.appendChild(t)),t.classList.add(s("payment-container"));const e=document.createElement("div");e.id=O(),e.classList.add(O()),t.appendChild(e);const n=document.createElement("button");n.id=S(),n.classList.add(S()),n.style.display="none",n.textContent="Pay Now",t.appendChild(n),l("render",{message:"Checkout element rendered"})}function rt(){o.log("[YunoIntegration] Starting Rendering Enrollment html elements...");let t=document.getElementById(f());t?t.innerHTML="":(t=document.createElement("div"),t.id=f(),document.body.appendChild(t)),t.classList.add(s("payment-container"));const e=document.createElement("div");e.id=h(),e.classList.add(h()),t.appendChild(e);const n=document.createElement("div");n.id=L(),n.classList.add(L()),n.classList.add("custom-enrollment-form-container"),t.appendChild(n);const r=document.createElement("div");r.id=U(),r.classList.add(U()),t.appendChild(r),l("render",{message:"Enrollment element rendered"})}function A(){if(document.getElementById(s()))return;const t=document.createElement("style");t.id=s();const e=f();t.innerHTML=`
2            #${e} {
3                max-width: 480px !important;
4                margin: 0 auto !important;
5                padding: 0 20px 40px !important;
6                border: none !important;
7                background: transparent !important;
8            }
9
10            #${e} #${S()} {
11                margin-top: 15px !important;
12                width: 100% !important;
13                padding: 16px 24px !important;
14                background-color: #A051FA !important;
15                color: #ffffff !important;
16                border: none !important;
17                border-radius: 12px !important;
18                font-size: 16px !important;
19                font-weight: 600 !important;
20                cursor: pointer !important;
21                transition: all 0.2s ease !important;
22                letter-spacing: 0.5px !important;
23                text-transform: none !important;
24                font-family: inherit !important;
25            }
26
27            #${e} #${S()}:hover {
28                background-color: #8b38ef !important;
29                transform: translateY(-1px) !important;
30            }
31
32            #${e} #${S()}:active {
33                transform: translateY(0) !important;
34            }
35
36            #${e} #${S()}:disabled {
37                background-color: #d1d5db !important;
38                cursor: not-allowed !important;
39                transform: none !important;
40            }
41
42            #${e} .${s("success-message")} {
43                text-align: center !important;
44                padding: 40px 20px !important;
45                animation: fadeIn 0.5s ease-in !important;
46                border: none !important;
47                background: transparent !important;
48            }
49
50            @keyframes fadeIn {
51                from { opacity: 0; transform: translateY(-10px); }
52                to { opacity: 1; transform: translateY(0); }
53            }
54
55            #${e} .${s("success-icon")} {
56                width: 80px !important;
57                height: 80px !important;
58                background-color: #4CAF50 !important;
59                border-radius: 50% !important;
60                display: flex !important;
61                align-items: center !important;
62                justify-content: center !important;
63                font-size: 48px !important;
64                color: white !important;
65                margin: 0 auto 24px !important;
66                animation: scaleIn 0.5s ease-out !important;
67                border: none !important;
68                line-height: 1 !important;
69            }
70
71            @keyframes scaleIn {
72                from { transform: scale(0); }
73                to { transform: scale(1); }
74            }
75
76            #${e} .${s("success-title")} {
77                font-size: 24px !important;
78                font-weight: 600 !important;
79                color: #111827 !important;
80                margin: 0 0 12px 0 !important;
81                text-transform: none !important;
82                letter-spacing: normal !important;
83                text-shadow: none !important;
84                font-family: inherit !important;
85            }
86
87            #${e} .${s("success-text")} {
88                font-size: 16px !important;
89                color: #6b7280 !important;
90                margin: 0 !important;
91                font-style: normal !important;
92                font-family: inherit !important;
93            }
94
95            #${e} .${s("failure-message")} {
96                text-align: center !important;
97                padding: 40px 20px !important;
98                animation: fadeIn 0.5s ease-in !important;
99                border: none !important;
100                background: transparent !important;
101            }
102
103            #${e} .${s("failure-icon")} {
104                width: 80px !important;
105                height: 80px !important;
106                background-color: #EB4444 !important;
107                border-radius: 50% !important;
108                display: flex !important;
109                align-items: center !important;
110                justify-content: center !important;
111                font-size: 48px !important;
112                color: white !important;
113                margin: 0 auto 24px !important;
114                animation: scaleIn 0.5s ease-out !important;
115                border: none !important;
116                line-height: 1 !important;
117            }
118
119            #${e} .${s("failure-title")} {
120                font-size: 24px !important;
121                font-weight: 600 !important;
122                color: #111827 !important;
123                margin: 0 0 12px 0 !important;
124                text-transform: none !important;
125                letter-spacing: normal !important;
126                text-shadow: none !important;
127                font-family: inherit !important;
128            }
129
130            #${e} .${s("failure-text")} {
131                font-size: 16px !important;
132                color: #6b7280 !important;
133                margin: 0 0 24px 0 !important;
134                font-style: normal !important;
135                font-family: inherit !important;
136            }
137
138            #${e} .${s("failure-retry-btn")} {
139                display: inline-block !important;
140                padding: 12px 32px !important;
141                background-color: #EB4444 !important;
142                color: white !important;
143                border: none !important;
144                border-radius: 8px !important;
145                font-size: 16px !important;
146                font-weight: 600 !important;
147                cursor: pointer !important;
148                transition: background-color 0.2s ease !important;
149                font-family: inherit !important;
150                text-decoration: none !important;
151                letter-spacing: normal !important;
152                text-transform: none !important;
153                line-height: normal !important;
154            }
155
156            #${e} .${s("failure-retry-btn")}:hover {
157                background-color: #c53030 !important;
158            }
159
160            #${e} .${s("loader-overlay")} {
161                display: flex !important;
162                flex-direction: column !important;
163                align-items: center !important;
164                justify-content: center !important;
165                padding: 60px 20px !important;
166                animation: fadeIn 0.3s ease-in !important;
167            }
168
169            #${e} .${s("loader-spinner")} {
170                width: 48px !important;
171                height: 48px !important;
172                border: 4px solid #e5e7eb !important;
173                border-top-color: #A051FA !important;
174                border-radius: 50% !important;
175                animation: ${s("spin")} 0.8s linear infinite !important;
176                margin-bottom: 20px !important;
177            }
178
179            @keyframes ${s("spin")} {
180                to { transform: rotate(360deg); }
181            }
182
183            #${e} .${s("loader-text")} {
184                font-size: 15px !important;
185                color: #6b7280 !important;
186                font-weight: 400 !important;
187                letter-spacing: normal !important;
188                text-transform: none !important;
189                line-height: normal !important;
190            }
191
192            /* ── Dark mode overrides ── */
193            .dark #${e} #${S()}:disabled {
194                background-color: #52525b !important;
195            }
196
197            .dark #${e} .${s("success-title")},
198            .dark #${e} .${s("failure-title")} {
199                color: #f4f4f5 !important;
200            }
201
202            .dark #${e} .${s("success-text")},
203            .dark #${e} .${s("failure-text")},
204            .dark #${e} .${s("loader-text")} {
205                color: #a1a1aa !important;
206            }
207
208            .dark #${e} .${s("loader-spinner")} {
209                border-color: #3f3f46 !important;
210                border-top-color: #A051FA !important;
211            }
212            
213            .dark #${e} .Yuno-external-button__subtitle {
214                color: white !important;
215            }
216        `,document.head.appendChild(t),l("render",{message:"Checkout styles rendered"})}function it(){if(document.getElementById(s()))return;const t=document.createElement("style");t.id=s();const e=f();t.innerHTML=`
217            #${e} {
218                max-width: 480px !important;
219                margin: 0 auto !important;
220                padding: 0 20px 40px !important;
221                border: none !important;
222                background: transparent !important;
223            }
224
225            #${e} .${h()} {
226                display: flex !important;
227                flex-direction: column !important;
228                gap: 12px !important;
229                padding: 16px !important;
230                border: none !important;
231                background: transparent !important;
232            }
233
234            #${e} .${h()} .payment-method-item {
235                display: flex !important;
236                align-items: center !important;
237                gap: 12px !important;
238                padding: 16px !important;
239                border: 1px solid #e5e7eb !important;
240                border-radius: 8px !important;
241                cursor: pointer !important;
242                background: #ffffff !important;
243                color: #111827 !important;
244                -webkit-tap-highlight-color: transparent !important;
245            }
246
247            #${e} .${h()} .payment-method-item:active {
248                background-color: #f9fafb !important;
249            }
250
251            #${e} .${h()} .payment-method-item img {
252                width: 40px !important;
253                height: 40px !important;
254                border: none !important;
255                border-radius: 4px !important;
256                filter: none !important;
257            }
258
259            #${e} .${h()} .payment-method-item span {
260                font-size: 1rem !important;
261                font-weight: 500 !important;
262                color: #111827 !important;
263                text-decoration: none !important;
264            }
265
266            #${e} #${L()} {
267                margin-top: 20px !important;
268                border: none !important;
269            }
270
271            #${e} .${b()} {
272                display: flex !important;
273                align-items: center !important;
274                gap: 12px !important;
275                padding: 16px !important;
276                border: 2px solid #e5e7eb !important;
277                border-radius: 12px !important;
278                cursor: pointer !important;
279                transition: all 0.2s ease !important;
280                background: #ffffff !important;
281                color: #111827 !important;
282            }
283
284            #${e} .${b()}:hover {
285                border-color: #A051FA !important;
286                background: #f9fafb !important;
287                transform: translateY(-2px) !important;
288                font-size: 1rem !important;
289                font-weight: 500 !important;
290                color: #111827 !important;
291            }
292
293            #${e} .${b()}:active {
294                transform: translateY(0) !important;
295            }
296
297            #${e} .${b()} img {
298                width: 40px !important;
299                height: 40px !important;
300                object-fit: contain !important;
301                border: none !important;
302                border-radius: 4px !important;
303                filter: none !important;
304            }
305
306            #${e} .${b()} span {
307                font-size: 1rem !important;
308                font-weight: 500 !important;
309                color: #111827 !important;
310                text-decoration: none !important;
311            }
312
313            #${e} .${s("success-message")} {
314                text-align: center !important;
315                padding: 40px 20px !important;
316                animation: fadeIn 0.5s ease-in !important;
317                border: none !important;
318                background: transparent !important;
319            }
320
321            @keyframes fadeIn {
322                from { opacity: 0; transform: translateY(-10px); }
323                to { opacity: 1; transform: translateY(0); }
324            }
325
326            #${e} .${s("success-icon")} {
327                width: 80px !important;
328                height: 80px !important;
329                background-color: #4CAF50 !important;
330                border-radius: 50% !important;
331                display: flex !important;
332                align-items: center !important;
333                justify-content: center !important;
334                font-size: 48px !important;
335                color: white !important;
336                margin: 0 auto 24px !important;
337                animation: scaleIn 0.5s ease-out !important;
338                border: none !important;
339                line-height: 1 !important;
340            }
341
342            @keyframes scaleIn {
343                from { transform: scale(0); }
344                to { transform: scale(1); }
345            }
346
347            #${e} .${s("success-title")} {
348                font-size: 24px !important;
349                font-weight: 600 !important;
350                color: #111827 !important;
351                margin: 0 0 12px 0 !important;
352                text-transform: none !important;
353                letter-spacing: normal !important;
354                text-shadow: none !important;
355                font-family: inherit !important;
356            }
357
358            #${e} .${s("success-text")} {
359                font-size: 16px !important;
360                color: #6b7280 !important;
361                margin: 0 !important;
362                font-style: normal !important;
363                font-family: inherit !important;
364            }
365
366            #${e} .${s("failure-message")} {
367                text-align: center !important;
368                padding: 40px 20px !important;
369                animation: fadeIn 0.5s ease-in !important;
370                border: none !important;
371                background: transparent !important;
372            }
373
374            #${e} .${s("failure-icon")} {
375                width: 80px !important;
376                height: 80px !important;
377                background-color: #EB4444 !important;
378                border-radius: 50% !important;
379                display: flex !important;
380                align-items: center !important;
381                justify-content: center !important;
382                font-size: 48px !important;
383                color: white !important;
384                margin: 0 auto 24px !important;
385                animation: scaleIn 0.5s ease-out !important;
386                border: none !important;
387                line-height: 1 !important;
388            }
389
390            #${e} .${s("failure-title")} {
391                font-size: 24px !important;
392                font-weight: 600 !important;
393                color: #111827 !important;
394                margin: 0 0 12px 0 !important;
395                text-transform: none !important;
396                letter-spacing: normal !important;
397                text-shadow: none !important;
398                font-family: inherit !important;
399            }
400
401            #${e} .${s("failure-text")} {
402                font-size: 16px !important;
403                color: #6b7280 !important;
404                margin: 0 0 24px 0 !important;
405                font-style: normal !important;
406                font-family: inherit !important;
407            }
408
409            #${e} .${s("failure-retry-btn")} {
410                display: inline-block !important;
411                padding: 12px 32px !important;
412                background-color: #EB4444 !important;
413                color: white !important;
414                border: none !important;
415                border-radius: 8px !important;
416                font-size: 16px !important;
417                font-weight: 600 !important;
418                cursor: pointer !important;
419                transition: background-color 0.2s ease !important;
420                font-family: inherit !important;
421                text-decoration: none !important;
422                letter-spacing: normal !important;
423                text-transform: none !important;
424                line-height: normal !important;
425            }
426
427            #${e} .${s("failure-retry-btn")}:hover {
428                background-color: #c53030 !important;
429            }
430
431            /* ── Dark mode overrides ── */
432            .dark #${e} .${h()} .payment-method-item {
433                background: #27272a !important;
434                border-color: #3f3f46 !important;
435                color: #f4f4f5 !important;
436            }
437
438            .dark #${e} .${h()} .payment-method-item:active {
439                background-color: #3f3f46 !important;
440            }
441
442            .dark #${e} .${h()} .payment-method-item span {
443                color: #f4f4f5 !important;
444            }
445
446            .dark #${e} .${b()} {
447                background: #27272a !important;
448                border-color: #3f3f46 !important;
449                color: #f4f4f5 !important;
450            }
451
452            .dark #${e} .${b()}:hover {
453                background: #3f3f46 !important;
454                border-color: #A051FA !important;
455                color: #f4f4f5 !important;
456            }
457
458            .dark #${e} .${b()} span {
459                color: #f4f4f5 !important;
460            }
461
462            .dark #${e} .${s("success-title")},
463            .dark #${e} .${s("failure-title")} {
464                color: #f4f4f5 !important;
465            }
466
467            .dark #${e} .${s("success-text")},
468            .dark #${e} .${s("failure-text")} {
469                color: #a1a1aa !important;
470            }
471            
472            .dark #${e} .Yuno-external-button__subtitle {
473                color: white !important;
474            }
475        `,document.head.appendChild(t),l("render",{message:"Enrollmen
475t styles rendered"})}function st(){const t=c.theme==="dark";return{surface:t?"#27272a":"#ffffff",text:t?"#f4f4f5":"#18181b",muted:t?"#a1a1aa":"#71717a",border:t?"#3f3f46":"#e4e4e7"}}function lt(){const{surface:t,text:e,muted:n,border:r}=st();return`
476            html, body, #root, #root * { background-color: ${t} !important; }
477            #root input, #root .Yuno-input__base, #root .Yuno-input__input { background-image: none !important; }
478            #root, #root * { color: ${e} !important; }
479            input, select, .Yuno-input__base, .Yuno-input__input { color: ${e} !important; font-size: 16px !important; }
480            .Yuno-fieldset__box { overflow: hidden !important; border-radius: 12px !important; border-color: ${r} !important; }
481            input::placeholder, #root .Yuno-input__input::placeholder { color: ${n} !important; }
482            label, .Yuno-input__label, #root .Yuno-input__label * { color: ${n} !important; }
483        `}function ct(){const t=s("custom-checkout");if(document.getElementById(t))return;const e=f(),n=document.createElement("style");n.id=t,n.innerHTML=`
484            /* The shared checkout styles centre the container with auto margins, which inside a flex
485               column shrinks it to its content instead of filling the dialog. */
486            #${e} {
487                width: 100% !important;
488                padding: 0 !important;
489            }
490
491            /* Yuno's own express-payment block duplicates the wallet buttons the page already shows. */
492            #${e} .Yuno-external-button { display: none !important; }
493        `,document.head.appendChild(n)}function B(){switch(a.flowType){case"checkout":mt();break;case"enrollment":gt();break;case"status":yt();break;default:l("flowUndefined",{message:"undefined flow: "+a.flowType}),o.error("[YunoIntegration] Unknown flow type:",a.flowType)}}function mt(){if(o.log("[YunoIntegration] Starting Checkout flow..."),a.yuno.startCheckout({checkoutSession:a.appData.checkoutSession,elementSelector:`#${O()}`,countryCode:a.appData.countryCode||"US",language:a.appData.language||"en",showLoading:!0,issuersFormEnable:!0,showPaymentStatus:!c.suppressSuccessMessage,card:{type:"elements",...c.customCheckout?{styles:lt()}:{},cardSaveEnable:!1,hideCardholderName:!1,isCreditCardProcessingOnly:!0,onChange:t=>{t.error&&(o.log("[YunoIntegration] Card form error:",t.data),l("cardFormError",{message:t.data}),p({message:"cardFormError "+t.data}))}},onLoading:t=>{o.log("[YunoIntegration] Loading:",t)},yunoPaymentMethodSelected:t=>{o.log("[YunoIntegration] Payment method selected:",t),a.appData.paymentType=t.type;const e=document.getElementById(S());e&&(e.style.display="block"),l("paymentMethodSelected",{type:t.type??"none",enrolled:!!t.vaulted_token})},yunoPaymentResult:t=>{o.log("[YunoIntegration] Payment result:",t),xt(t)},yunoError:(t,e)=>{o.error("[YunoIntegration] Payment error:",t,e),c.customCheckout&&J(),d("HANDLE_PAYMENT_FAILURE",t),l("paymentFailed",{status:t}),p({message:"HANDLE_PAYMENT_FAILURE",status:t}),t!=="CANCELED_BY_USER"&&u("An error occurred during payment. Please try again.")},async yunoCreatePayment(t){if(o.log("[YunoIntegration] Creating payment...",{oneTimeToken:t}),c.customCheckout){if(R){o.warn("[YunoIntegration] Payment token already issued — ignoring repeat submit");return}R=!0}const e=document.getElementById(S());e&&e.setAttribute("disabled","disabled"),await p({message:"apiCreatePayment"}),await Pt(t)}}),c.customCheckout){pt().catch(t=>{o.error("[YunoIntegration] Custom checkout failed:",t),l("customCheckoutFailed",{message:t?.message??""}),p({message:"customCheckoutFailed",error:t?.message??""})});return}z()}function z(){a.yuno.mountCheckout();const t=document.getElementById(S());!t||t.dataset.yunoBound==="true"||(t.dataset.yunoBound="true",t.addEventListener("click",()=>{o.log("[YunoIntegration] Pay button clicked"),a.yuno.startPayment()}))}async function pt(){o.log("[YunoIntegration] Starting Custom Checkout flow..."),ct();const t=c.paymentMethods??[],e=await ft(t.map(i=>i.paymentMethodType)),{walletMethods:n,formMethods:r}=ut(e);o.log("[YunoIntegration] Custom checkout methods:",{walletMethods:n,formMethods:r}),D=n,l("customCheckoutMethodsResolved",{wallets:n.map(i=>i.paymentMethodType),forms:r.map(i=>i.paymentMethodType)}),await Ft(),r.length>0&&z(),n.length>0&&(await W(()=>a.yuno.clearApiCache()),await a.yuno.mountExternalButtons(n.map(i=>({...i,checkoutSession:a.appData.checkoutSession})))),l("customCheckoutMounted",{wallets:n.map(i=>i.paymentMethodType),forms:r.map(i=>i.paymentMethodType)})}async function dt(t){!a.yuno||!t.length||(await W(()=>
493a.yuno.unmountAllExternalButtons()),t.forEach(e=>{document.querySelector(e.elementSelector)?.replaceChildren()}))}function J(){a.yuno&&Promise.race([(async()=>a.yuno.notifyError?.())(),new Promise(t=>setTimeout(t,Mt))]).catch(()=>{})}async function W(t){try{await t()}catch(e){o.log("[YunoIntegration] Non-fatal SDK call failed:",e)}}function ut(t){const e=new Set,n=(c.paymentMethods??[]).map(i=>{const m=t.find(y=>y.type===i.paymentMethodType);return m?{...i,category:m.category}:null}).filter(Boolean).filter(i=>{const m=i.elementSelector;return e.has(m)?!1:(e.add(m),!0)}),r=({paymentMethodType:i,elementSelector:m})=>({paymentMethodType:i,elementSelector:m});return{walletMethods:n.filter(i=>i.category===Q).map(r),formMethods:n.filter(i=>i.category!==Q).map(r)}}async function ft(t){try{return(await(await fetch(`${c.domain}/api/yuno/session/payment-methods`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({hash:a.appData.env,web_session:a.appData.webSession,checkout_session:a.appData.checkoutSession,...t.length>0?{payment_methods:t}:{}})})).json()).data??[]}catch(e){return o.error("[YunoIntegration] Failed to get available payment methods:",e),p({message:"getAvailablePaymentMethodsFailed",error:e?.message??""}),[]}}function gt(){const t=a.appData.paymentMethods;!Array.isArray(t)||t.length===0?(o.error("[YunoIntegration] No payment methods found"),l("noPaymentMethodsFound",{message:"No payment methods found"}),p({message:"No payment methods found"})):t.length===1?K(t[0].type):Et()}function yt(){o.log("[YunoIntegration] Starting Status flow..."),$({withLoader:!0}).then()}function ht(){o.log("[YunoIntegration] Starting Enrollment flow..."),a.yuno.mountEnrollmentLite({customerSession:a.appData.customerSession,countryCode:a.appData.countryCode||"US",language:a.appData.language||"en",showLoading:!0,onLoading:t=>{o.log("[YunoIntegration] Loading:",t)},renderMode:{type:"element",elementSelector:{apmForm:`#${L()}`,actionForm:`#${U()}`}},card:{type:"extends",cardSaveEnable:!1,texts:{},documentEnable:!1},yunoEnrollmentStatus:({status:t,vaultedToken:e})=>{o.log("[YunoIntegration] Enrollment status:",{status:t,vaultedToken:e}),l("enrollmentStatus",{status:t}),t==="ENROLLED"?(o.log("[YunoIntegration] Enrollment successful!"),_t().then(()=>{})):["EXPIRED","REJECTED","DECLINED","CANCELED","ERROR","UNENROLLED"].includes(t)?(o.warn("[YunoIntegration] Enrollment failed:",t),u("Enrollment failed. Please try again."),d("HANDLE_PAYMENT_FAILURE",t),p({message:"yunoEnrollmentStatus "+t})):["ENROLL_IN_PROCESS"].includes(t)?a.yuno.continuePayment().then(n=>{o.warn("ContinuePayment:",n),l("enrollInProcess",{action:n?.action??null,type:n?.type??null,redirect_init_url:n?.redirect?.init_url??null,redirect_success_url:n?.redirect?.success_url??null,redirect_error_url:n?.redirect?.error_url??null,raw:JSON.stringify(n??null)}),p({message:"yunoEnrollmentStatus",continuePayment:n})}):(o.info("[YunoIntegration] Enrollment in progress:",t),p({message:"yunoEnrollmentStatus "+t}))},yunoError:t=>{o.log("[YunoIntegration] Enrollment error:",t),u("An error occurred during enrollment. Please try again."),p({message:"mountEnrollmentLite.yunoError",error:C(t)}),d("HANDLE_PAYMENT_FAILURE"),l("yunoEnrollError",{error:JSON.stringify(C(t))}),a.yuno.hideLoader()}})}function Et(){o.log("[YunoIntegration] Starting Enrollment with methods flow..."),wt(a.appData.paymentMethods)}function wt(t){const e=document.getElementById(h());if(!e){o.error("[YunoIntegration] Payment methods container not found");return}e.innerHTML="",o.log("[YunoIntegration] Rendering payment methods:",t),t.forEach(n=>{const r=document.createElement("div");r.className=b(),r.innerHTML=`
494                <img src="${n.icon}" alt="${n.name}">
495                <span>${n.name}</span>
496            `,r.onclick=()=>K(n.type),e.appendChild(r)})}async function K(t){o.log("[YunoIntegration] Payment method selected:",t);try{const e=await fetch(`${c.domain}/api/yuno/add-payment-method`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({web_session:a.appData.webSession,customer_session:a.appData.customerSession,payment_method_type:t})}),{data:n}=await e.json();if(o.log("[YunoIntegration] Payment method added:",n),n.id){const r=document.getElementById("payment-methods-list");r&&(r.style.display="none"),ht()}}catch(e){o.error("[YunoIntegration] Failed to add payment method:",e)}}let x=null,D=[],Y=!1,R=!1;function St(t){return t<1e4?3e3:t<6e4?5e3:t<12e4?1e4:2e4}async function It(){return await(await fetch(`${c.domain}/api/yuno/session/payment/check`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({hash:a.appData.env,web_session:a.appData.webSession,checkout_session:a.appData.checkoutSession})}
496)).json()}function bt(){return x?(o.log("[YunoIntegration] Payment check already in progress, reusing existing"),x):(x=new Promise(t=>{const n=Date.now();let r=null,i=!1;function m(){return r?Date.now()-r.getTime():Date.now()-n}async function y(){try{const E=await It();if(E&&E.success&&E.data){const P=E.data.status,F=E.data.sub_status;if(!r&&E.data.created_at&&(r=new Date(E.data.created_at),o.log("[YunoIntegration] Payment created at:",r.toISOString())),P==="VERIFIED"&&F==="VERIFIED"||P==="SUCCEEDED"&&F==="VERIFIED"||P==="SUCCEEDED"&&F==="APPROVED"){o.log("[YunoIntegration] Payment check final status:",P,F),x=null,t(E.data);return}if(["PENDING","CREATED","READY_TO_PAY"].includes(P))o.log("[YunoIntegration] Payment check continue status:",P);else{o.log("[YunoIntegration] Payment check final status:",P),x=null,t(E.data);return}o.log("[YunoIntegration] Payment check intermediate status:",P,"- continue polling")}}catch(E){o.error("[YunoIntegration] Payment check request failed:",E)}if(i){o.warn("[YunoIntegration] Payment check timed out after 10 minutes (final check done)"),x=null,t(null);return}const T=m();if(T>=6e5){o.log("[YunoIntegration] Payment check time expired, performing final check..."),i=!0,setTimeout(y,1e3);return}const H=St(T),G=Math.round(T/1e3),X=Math.round((6e5-T)/1e3);o.log(`[YunoIntegration] Payment data not ready, retrying in ${H/1e3}s (elapsed: ${G}s, remaining: ${X}s)`),p({message:"payment_check_polling",elapsed:G,remaining:X,nextRetry:H/1e3}),setTimeout(y,H)}y()}),x)}let _=null;function kt(){return _?(o.log("[YunoIntegration] Payment sync already in progress, reusing existing"),_):(_=fetch(`${c.domain}/api/yuno/session/payment/sync`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({hash:a.appData.env,web_session:a.appData.webSession,checkout_session:a.appData.checkoutSession})}).then(t=>t.json()).then(t=>(o.log("[YunoIntegration] Payment sync response:",t),_=null,t)).catch(t=>(o.error("[YunoIntegration] Payment sync failed:",t),_=null,null)),_)}function xt(t){c.customCheckout&&t!=="SUCCEEDED"&&t!=="PENDING"&&J(),t==="SUCCEEDED"?(o.log("[YunoIntegration] Payment successful!"),$().then()):t==="REJECTED"?(o.log("[YunoIntegration] Payment rejected"),u("Payment was rejected. Please try a different payment method."),d("HANDLE_PAYMENT_FAILURE","REJECTED"),l("paymentFailed",{status:t}),p({message:"HANDLE_PAYMENT_FAILURE",status:t}),g("Payment was rejected")):t==="DECLINED"?(o.log("[YunoIntegration] Payment declined"),u("Payment was declined. Please check your payment details."),d("HANDLE_PAYMENT_FAILURE","DECLINED"),l("paymentFailed",{status:t}),p({message:"HANDLE_PAYMENT_FAILURE",status:t}),g("Payment was declined")):t==="CANCELLED"?(o.log("[YunoIntegration] Payment cancelled"),u("Payment was cancelled."),d("HANDLE_PAYMENT_CANCELLATION","CANCELLED"),l("paymentCancelled",{status:t}),p({message:"HANDLE_PAYMENT_CANCELLATION",status:t}),Nt()):t==="PENDING"?(o.log("[YunoIntegration] Payment pending"),l("paymentPending",{status:t}),p({message:"HANDLE_PAYMENT_PENDING",status:t})):t==="ERROR"?(o.log("[YunoIntegration] Payment error"),u("An error occurred during payment. Please try again."),d("HANDLE_PAYMENT_FAILURE","ERROR"),l("paymentFailed",{status:t}),p({message:"HANDLE_PAYMENT_FAILURE",status:t}),g("An error occurred during payment")):(o.log("[YunoIntegration] Unknown payment status:",t),u("Payment failed. Please try again."),d("HANDLE_PAYMENT_FAILURE",t),l("paymentFailed",{status:t}),p({message:"HANDLE_PAYMENT_FAILURE",status:t}),g("Unknown payment status"))}async function $({withLoader:t=!1}={}){t&&Ct("Verifying payment..."),await bt().then(e=>{if(t&&Yt(),!e)o.warn("[YunoIntegration] Payment check timed out"),l("paymentFailed",{status:"TIMEOUT"}),p({message:"HANDLE_PAYMENT_CHECK_TIMEOUT"}).then(),d("HANDLE_PAYMENT_FAILURE","TIMEOUT"),u("Payment verification timed out. Please try again."),g("Payment verification timed out");else{if(e.status==="SUCCEEDED"&&e.sub_status==="APPROVED"||e.status==="SUCCEEDED"&&e.sub_status==="VERIFIED"||e.status==="VERIFIED"&&e.sub_status==="VERIFIED")return Y?void 0:(Y=!0,kt().then(n=>(o.log("[YunoIntegration] Payment sync result:",n),l("paymentSuccess",{subscription_id:n?.data?.subscription_id??null,payment_id:n?.data?.payment_id??null,invoice_id:a.appData?.requestPayload?.invoice_id??null}),p({message:"HANDLE_PAYMENT_SUCCESS"}).then(),d("HANDLE_PAYMENT_SUCCESS",e.status),q(),V(n?n.data.payment_id:""),n)));o.warn("[YunoIntegration] Unexpected final status:",e.status,e.sub_status),d("HANDLE_PAYMENT_FAILURE",e.status),l("paymentFailed",{status:e.status,sub_status:e.sub_status}),p({message:"HANDLE_PAYMENT_FAILURE",status:e.status,sub_status:e.sub_status}),u("Payment failed. Please try again."),g("Payment failed")}})}async function Pt(t){try{const n=await(await fetch(`${c.domain}/api/yuno/payments`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({checkout_session:a.appData.checkoutSession,payment_type:a.appData.paymentType||"CARD",token:t})})).json();o.log("[YunoIntegration] Payment created:",n),n.data.sdk_action_required?(o.log("[YunoIntegration] SDK action required - continuing payment"),a.yuno.continuePayment().then(r=>
496{o.info("[YunoIntegration] Payment continued:",r),l("sdkActionRequired",{action:r?.action??null,type:r?.type??null,redirect_init_url:r?.redirect?.init_url??null,redirect_success_url:r?.redirect?.success_url??null,redirect_error_url:r?.redirect?.error_url??null,raw:JSON.stringify(r??null)}),p({message:"sdkActionRequired",continuePayment:r})}),$().then()):n.data.subscription_id?(o.log("[YunoIntegration] Payment succeeded without 3DS"),$().then()):(o.log("[YunoIntegration] Payment failed"),u("Payment failed. Please try again."),d("HANDLE_PAYMENT_FAILURE","API ERROR"),l("paymentFailed",{}),await p({message:"HANDLE_PAYMENT_FAILURE",code:n.code||""}),g("Payment failed"))}catch(e){o.error("[YunoIntegration] API Error:",e),u("An error occurred. Please try again."),d("HANDLE_PAYMENT_FAILURE","API_ERROR"),l("paymentFailed",{error:JSON.stringify(C(e))}),await p({message:"HANDLE_PAYMENT_FAILURE",error:C(e)}),g("Payment failed")}}async function _t(t,e="succeeded"){try{const n=await fetch(`${c.domain}/api/yuno/subscription`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({customer_session:a.appData.customerSession,enrollment_status:e})});if(!n.ok){const m=await n.text();return o.error("[YunoIntegration] HTTP Error:",m),u("Subscription creation failed. Please try again."),d("HANDLE_PAYMENT_FAILURE"),l("paymentFailed",{message:"Non-JSON Response",status:n.status}),await p({message:"createSubscription fail",responseStatus:n.status,response:m}),g("Subscription creation failed"),null}const r=n.headers.get("content-type");if(!r||!r.includes("application/json")){const m=await n.text();return o.error("[YunoIntegration] Non-JSON Response:",m),u("Subscription creation failed. Please try again."),d("HANDLE_PAYMENT_FAILURE"),l("paymentFailed",{message:"Non-JSON Response",status:n.status}),await p({message:"createSubscription fail",responseStatus:n.status,response:m}),g("Subscription creation failed"),null}const{data:i}=await n.json();if(i){if(o.log("[YunoIntegration] Subscription created successfully"),Y)return null;Y=!0,q(),d("HANDLE_PAYMENT_SUCCESS"),l("paymentSuccess",{subscription_id:i?.subscription_id??null,invoice_id:a.appData?.requestPayload?.invoice_id??null}),await p({message:"HANDLE_PAYMENT_SUCCESS"}),V("")}else o.log("[YunoIntegration] Subscription failed"),u("Subscription creation failed. Please try again."),d("HANDLE_PAYMENT_FAILURE"),l("paymentFailed",{}),await p({message:"apiCreateSubscription - response fail"}),g("Subscription creation failed");return i}catch(n){o.error("[YunoIntegration] API Error:",n),u("An error occurred. Please try again."),d("HANDLE_PAYMENT_FAILURE","API_ERROR"),l("paymentFailed",{error:C(n)}),await p({message:"apiCreateSubscription",error:C(n)}),g("Subscription creation failed")}return null}function Ct(t="Processing payment..."){document.getElementById(s())||A();let e=document.getElementById(f());e?e.innerHTML="":(e=document.createElement("div"),e.id=f(),document.body.appendChild(e));const n=document.createElement("div");n.className=s("loader-overlay");const r=document.createElement("div");r.className=s("loader-spinner");const i=document.createElement("div");i.className=s("loader-text"),i.textContent=t,n.appendChild(r),n.appendChild(i),e.appendChild(n)}function Yt(){const t=document.getElementById(f());if(!t)return;const e=t.querySelector("."+s("loader-overlay"));e&&e.remove()}function q(){if(c.suppressSuccessMessage){l("successMessageShown",{message:"Success message suppressed"});return}const t=document.getElementById(f());if(!t)return;t.innerHTML="";const e=document.createElement("div");e.className=s("success-message");const n=document.createElement("div");n.className=s("success-icon"),n.textContent="✓";const r=document.createElement("h2");r.className=s("success-title"),r.textContent="Payment Successful!";const i=document.createElement("p");
496i.className=s("success-text"),i.textContent="Thank you for your payment.",e.appendChild(n),e.appendChild(r),e.appendChild(i),t.appendChild(e),l("successMessageShown",{message:"Success message displayed"})}function u(t=""){if(c.keepFormOnFailure){l("failureMessageShown",{message:"Failure message suppressed",reason:t});return}document.getElementById(s())||A();let e=document.getElementById(f());e?e.innerHTML="":(e=document.createElement("div"),e.id=f(),document.body.appendChild(e));const n=document.createElement("div");n.className=s("failure-message");const r=document.createElement("div");r.className=s("failure-icon"),r.textContent="✕";const i=document.createElement("h2");i.className=s("failure-title"),i.textContent="Oops! Something Went Wrong";const m=document.createElement("p");m.className=s("failure-text"),m.textContent=t||"An unexpected error occurred. Please try again later.";const y=document.createElement("button");y.className=s("failure-retry-btn"),y.textContent="Try Again",y.addEventListener("click",()=>window.location.reload()),n.appendChild(r),n.appendChild(i),n.appendChild(m),n.appendChild(y),e.appendChild(n),l("failureMessageShown",{message:"Failure message displayed",reason:t})}function V(t){v("success",t)}function Nt(){c.keepFormOnFailure||v("cancelled")}function g(t=""){c.keepFormOnFailure||v("failed","",t)}function v(t,e="",n=""){if(c.suppressRedirect)return;const r=a.appData?.redirectUrl;if(!r)return;const i=r.trim();if(!i)return;let m=i+"?status="+encodeURIComponent(t);e.trim()&&(m+="&transaction_id="+encodeURIComponent(e.trim())),n.trim()&&(m+="&reason="+encodeURIComponent(n.trim())),a.appData?.requestPayload?.invoice_id&&(m+="&invoice_id="+a.appData.requestPayload.invoice_id),l("redirect",{status:t,url:m}),window.location.href=m}function l(t,e=null){const n={name:t,data:e};window.webkit?.messageHandlers?.eventHandler&&window.webkit.messageHandlers.eventHandler.postMessage(n),At(t,e)}function d(t,e=null){const n={command:t,data:e};window.webkit?.messageHandlers?.commandHandler&&window.webkit.messageHandlers.commandHandler.postMessage(n)}async function p(t){try{await fetch(`${c.domain}/api/yuno/analytic-logger`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch(e){o.error("[YunoIntegration] Failed to send log:",e)}}function At(t,e){const n=new CustomEvent("yuno:event",{detail:{name:t,data:e}});window.dispatchEvent(n)}function s(t=""){if(!c.stylePrefix)return t;const e=/^\d/.test(c.stylePrefix)?"_"+c.stylePrefix:c.stylePrefix;return t===""?e:e+"-"+t}function f(){return c.paymentSelector.replace(/^#/,"")}function h(){return s(c.paymentMethodsListSelector.replace(/^#/,""))}function b(){return s(c.paymentMethodsListItemSelector.replace(/^#/,""))}function L(){return s(c.enrollmentFormContainerSelector.replace(/^#/,""))}function U(){return s(c.actionFormContainerSelector.replace(/^#/,""))}function O(){return s(c.checkoutFormContainerSelector.replace(/^#/,""))}function S(){return s(c.paymentBtnSelector.replace(/^#/,""))}function C(t){return{name:t.name,message:t.message,stack:t.stack,...t.cause&&{cause:t.cause},...t.code&&{code:t.code}}}function Dt(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}return{init:k,camelToKebab:Dt,getState:()=>a,getConfig:()=>c}}const Ht=()=>{const o=new Map,c=k=>{const{name:I,data:w}=k.detail,N=o.get(I);N&&N(w)},a=(k,I)=>{o.set(k,I)};return $t(()=>window.addEventListener("yuno:event",c)),Lt(()=>window.removeEventListener("yuno:event",c)),{on:a}};export{Z as YUNO_SDK_URL,Ot as createYunoPaymentIntegration,Rt as preloadYunoSdk,Ht as useYunoEvents};

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.