/home/altere25/labratnyc.com/wp-content/plugins/woocommerce-payments/dist
Edit: /home/altere25/labratnyc.com/wp-content/plugins/woocommerce-payments/dist/subscription-edit-page.js (3151B)
(()=>{var e={};(()=>{var t;globalThis.importScripts&&(t=globalThis.location+"");var n=globalThis.document;if(!t&&n&&(n.currentScript&&"SCRIPT"===n.currentScript.tagName.toUpperCase()&&(t=n.currentScript.src),!t)){var a=n.getElementsByTagName("script");if(a.length)for(var o=a.length-1;o>-1&&(!t||!/^http(s?):/.test(t));)t=a[o--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=t})(),e.p=window.wcpayAssets.url,(()=>{"use strict";const e=window.React,t=window.ReactDOM,n=window.wp.i18n,a=window.ReactJSXRuntime,o=new Map,r=(e,t)=>`${e}-${t}`,s=(e,t)=>{const n=r(e,t),a=o.get(n);if(void 0===a)return 0;const s=a.find(e=>e.isDefault);return void 0!==s?s.tokenId:0},c=({inputName:t,initialValue:c,initialUserId:i,nonce:l,ajaxUrl:u,gatewayId:d})=>{const[m,p]=(0,e.useState)(c),[w,y]=(0,e.useState)(i),[h,f]=(0,e.useState)(!1),[g,_]=(0,e.useState)(null);return(0,e.useEffect)(()=>(()=>{const e=document.getElementById("customer_user"),t=e instanceof HTMLSelectElement?e:null;if(!t)return()=>{};const a=async()=>{(async e=>{const t=r(e,d),a=s(e,d);if(p(a),y(e),!o.has(t)){f(!0);try{const r=await(async(e,t,a,o)=>{const r=new FormData;r.append("action","wcpay_get_user_payment_tokens"),r.append("nonce",a),r.append("user_id",e.toString()),r.append("gateway_id",o);const s=await fetch(t,{method:"POST",body:r});if(!s.ok)throw new Error((0,n.__)("Failed to fetch user tokens","woocommerce-payments"));const c=(await s.json()).data;if(void 0===c)throw new Error((0,n.__)("Failed to fetch user tokens. Please reload the page and try again.","woocommerce-payments"));return c.tokens})(e,u,l,d);o.set(t,r);const c=s(e,d);a!==c&&p(c),f(!1),_(null)}catch(e){f(!1),_(e instanceof Error?e.message:(0,n.__)("Unknown error","woocommerce-payments"))}}})(parseInt(t.value,10)||0)};return jQuery(t).on("select2:select",a),t.addEventListener("change",a),()=>{jQuery(t).off("select2:select",a),t.removeEventListener("change",a)}})(),[u,l,d]),w<=0?(0,a.jsx)("select",{name:t,defaultValue:0,children:(0,a.jsx)("option",{value:0,disabled:!0,children:(0,n.__)("Please select a customer first","woocommerce-payments")},"no-customer")},"no-customer"):h?(0,a.jsx)(a.Fragment,{children:(0,n.__)("Loading…","woocommerce-payments")}):g?(0,a.jsx)("strong",{children:g}):(0,a.jsxs)("select",{name:t,defaultValue:m,children:[0===m&&(0,a.jsx)("option",{value:0,disabled:!0,children:(0,n.__)("Please select a payment method","woocommerce-payments")},"select"),o.get(r(w,d))?.map(e=>(0,a.jsx)("option",{value:e.tokenId,children:e.displayName},e.tokenId))]},w)};document.querySelectorAll(".wcpay-subscription-payment-method").forEach(e=>{(e=>{const n=JSON.parse(e.getAttribute("data-wcpay-pm-selector")||"{}"),s=n.userId??0,i=n.value??0,l=n.gatewayId??"woocommerce_payments";s&&o.set(r(s,l),n.tokens??[]);const u=e.querySelector("select,input");u&&(u instanceof HTMLSelectElement||u instanceof HTMLInputElement)&&(0,t.createRoot)(e).render((0,a.jsx)(c,{inputName:u.name,initialValue:i,initialUserId:s,nonce:n.nonce,ajaxUrl:n.ajaxUrl,gatewayId:l}))})(e)})})()})();