"use strict";const RAZORPAY_CHECKOUT_SCRIPT_URL="https://checkout.razorpay.com/v1/checkout.js",RAZORPAY_METHOD_META={card:{icon:"razorpay",label:()=>wp.i18n.__("Credit Card","surecart")},upi:{icon:"upi",label:()=>wp.i18n.__("UPI","surecart")}},getRazorpayMethodLabel=a=>{var o;return a?null===(o=RAZORPAY_METHOD_META[a])||void 0===o?void 0:o.label():void 0},getRazorpayMethodIcon=a=>{var o;return a&&(null===(o=RAZORPAY_METHOD_META[a])||void 0===o?void 0:o.icon)||"razorpay"};let razorpayInstance=null,loadPromise=null;const loadRazorpay=()=>razorpayInstance?Promise.resolve(razorpayInstance):loadPromise||(loadPromise=new Promise(((a,o)=>{const r=document.createElement("script");r.src=RAZORPAY_CHECKOUT_SCRIPT_URL,r.async=!0,r.onload=()=>{razorpayInstance=window.Razorpay,a(razorpayInstance)},r.onerror=()=>{loadPromise=null,o(new Error(wp.i18n.__("Failed to load Razorpay script.","surecart")))},document.head.appendChild(r)})),loadPromise);exports.getRazorpayMethodIcon=getRazorpayMethodIcon,exports.getRazorpayMethodLabel=getRazorpayMethodLabel,exports.loadRazorpay=loadRazorpay;