1function paypalSrc(e){const n=new URLSearchParams;return e.components&&n.set("components",e.components),e.currency&&n.set("currency",e.currency),e.clientId&&n.set("client-id",e.clientId),e.enableFunding&&n.set("enable-funding",e.enableFunding),e.disableFunding&&n.set("disable-funding",e.disableFunding),n.set("commit",e.commit?"true":"false"),`${PAYPAL_SRC_PREFIX}?${n.toString()}`}function paypalParamsMatch(e,n){return!(!e||!n)&&paypalSrc(e)===paypalSrc(n)}function isDev(){return"development"===document.querySelector('meta[name="current-env"]')?.content}function reportConflict(e,n){if(isDev())throw new Error(`[payment_sdk_loader] ${e}: ${JSON.stringify(n,null,2)}`);if(console.error("[payment_sdk_loader]",e,n),"function"==typeof window.Airbrake?.notify)try{window.Airbrake.notify({error:new Error(`[payment_sdk_loader] ${e}`),params:n})}catch(e){console.error("[payment_sdk_loader] Airbrake.notify failed",e)}}function adoptExistingPayPal(){if(paypal.scriptElement)return;const e=document.querySelector(`script[src^="${PAYPAL_SRC_PREFIX}"]`);if(!e)return;let n;try{n=new URL(e.src)}catch{return}paypal.scriptElement=e,paypal.params={commit:"true"===n.searchParams.get("commit"),clientId:n.searchParams.get("client-id"),currency:n.searchParams.get("currency"),components:n.searchParams.get("components"),enableFunding:n.searchParams.get("enable-funding"),disableFunding:n.searchParams.get("disable-funding")},paypal.loadPromise=window.paypal?Promise.resolve(window.paypal):new Promise(((n,t)=>{e.addEventListener("load",(()=>n(window.paypal)),{once:!0}),e.addEventListener("error",(()=>t(new Error("PayPal SDK failed to load"))),{once:!0})}))}function tearDownPayPal(){devlog("payment_sdk_loader: tearing down paypal",{previousParams:paypal.params}),paypal.scriptElement?.remove(),document.querySelectorAll('[id^="zoid-"]').forEach((e=>e.remove())),delete window.paypal,paypal.scriptElement=null,paypal.loadPromise=null,paypal.params=null}function injectPayPal(e,n,t){const r=document.createElement("script");r.src=paypalSrc(e),n&&(r.dataset.clientToken=n),t&&(r.dataset.partnerAttributionId=t),paypal.scriptElement=r,paypal.params=e,paypal.loadPromise=new Promise(((e,n)=>{r.addEventListener("load",(()=>e(window.paypal)),{once:!0}),r.addEventListener("error",(()=>n(new Error("PayPal SDK failed to load"))),{once:!0})})),document.head.appendChild(r)}function adoptExistingStripe(){if(stripe.scriptElement)return;const e=document.querySelector(`script[src^="${STRIPE_SRC}"]`);e&&(stripe.scriptElement=e,stripe.loadPromise=window.Stripe?Promise.resolve(window.Stripe):new Promise(((n,t)=>{e.addEventListener("load",(()=>n(window.Stripe)),{once:!0}),e.addEventListener("error",(()=>t(new Error("Stripe SDK failed to load"))),{once:!0})})))}function injectStripe(){const e=document.createElement("script");e.src=STRIPE_SRC,stripe.scriptElement=e,stripe.loadPromise=new Promise(((n,t)=>{e.addEventListener("load",(()=>n(window.Stripe)),{once:!0}),e.addEventListener("error",(()=>t(new Error("Stripe SDK failed to load"))),{once:!0})})),document.head.appendChild(e)}const PAYPAL_SRC_PREFIX="https://www.paypal.com/sdk/js",STRIPE_SRC="https://js.stripe.com/v3/",paypal={scriptElement:null,loadPromise:null,params:null,mounts:new Set},stripe={scriptElement:null,loadPromise:null,mounts:new Set};export async function loadPayPal({mountId:e,commit:n,clientId:t,identityToken:r,partnerAttributionId:a,currency:o,components:i,enableFunding:l,disableFunding:p}){if(!e)throw new Error("loadPayPal requires mountId");const s={commit:n,clientId:t,currency:o,components:i,enableFunding:l,disableFunding:p};if(adoptExistingPayPal(),paypal.scriptElement&&paypalParamsMatch(paypal.params,s))return paypal.mounts.add(e),paypal.loadPromise;if(paypal.scriptElement){const n=[...paypal.mounts].filter((n=>n!==e));n.length>0&&reportConflict("PayPal SDK commit-param conflict between mounts",{currentParams:paypal.params,requestedParams:s,otherMounts:n,requestingMount:e}),tearDownPayPal()}return injectPayPal(s,r,a),paypal.mounts.add(e),paypal.loadPromise}export function releasePayPal(e){paypal.mounts.delete(e)}export async function loadStripe({mountId:e}){if(!e)throw new Error("loadStripe requires mountId");return adoptExistingStripe(),stripe.scriptElement||injectStripe(),stripe.mounts.add(e),stripe.loadPromise}export function releaseStripe(e){stripe.mounts.delete(e)}
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.