1const PaypalExpressCheckout={primaryCssClassName:"jetpack-simple-payments",messageCssClassName:"jetpack-simple-payments-purchase-message",wpRestAPIHost:"https://public-api.wordpress.com",wpRestAPIVersion:"/wpcom/v2",getEnvironment:function(){if(localStorage&&localStorage.getItem&&localStorage.getItem("simple-payments-env")==="sandbox"){return"sandbox"}return"production"},getCreatePaymentEndpoint:function(e){return PaypalExpressCheckout.wpRestAPIHost+PaypalExpressCheckout.wpRestAPIVersion+"/sites/"+e+"/simple-payments/paypal/payment"},getExecutePaymentEndpoint:function(e,s){return PaypalExpressCheckout.wpRestAPIHost+PaypalExpressCheckout.wpRestAPIVersion+"/sites/"+e+"/simple-payments/paypal/"+s+"/execute"},getNumberOfItems:function(e,s){if(s!=="1"){return 1}const r=document.getElementById(e);if(!r){return 1}const t=Number(r.value);if(isNaN(t)){return 1}return t},getMessageContainer:function(e){return document.getElementById(e+"-message-container")},showMessage:function(e,s,r){const t=PaypalExpressCheckout.getMessageContainer(s);let o=PaypalExpressCheckout.messageCssClassName+" show ";o+=r?"error":"success";setTimeout(function(){t.innerHTML=e;t.setAttribute("class",o)},1e3)},showError:function(e,s){PaypalExpressCheckout.showMessage(e,s,true)},processErrorMessage:function(e){const s=e?e.responseJSON:null;const r="There was an issue processing your payment.";if(!s){return"<p>"+r+"</p>"}if(s.additional_errors){const e=[];s.additional_errors.forEach(function(s){if(s.message){e.push("<p>"+s.message.toString()+"</p>")}});return e.join("")}return"<p>"+(s.message||r)+"</p>"},processSuccessMessage:function(e){const s=e.message;const r="Thank you. Your purchase was successful!";if(!s){return"<p>"+r+"</p>"}return"<p>"+s+"</p>"},cleanAndHideMessage:function(e){const s=PaypalExpressCheckout.getMessageContainer(e);s.setAttribute("class",PaypalExpressCheckout.messageCssClassName);s.innerHTML=""},renderButton:function(e,s,r,t){const o=PaypalExpressCheckout.getEnvironment();if(!paypal){throw new Error("PayPal module is required by PaypalExpressCheckout")}const n=r+"_button";paypal.Button.render({env:o,commit:true,style:{label:"pay",shape:"rect",color:"silver",size:"responsive",fundingicons:true},payment:function(){PaypalExpressCheckout.cleanAndHideMessage(r);const n={number:PaypalExpressCheckout.getNumberOfItems(r+"_number",t),buttonId:s,env:o};return new paypal.Promise(function(s,t){jQuery.post(PaypalExpressCheckout.getCreatePaymentEndpoint(e),n).done(function(e){if(!e){PaypalExpressCheckout.showError(PaypalExpressCheckout.processErrorMessage(),r);return t(new Error("server_error"))}s(e.id)}).fail(function(e){const s=PaypalExpressCheckout.processErrorMessage(e);PaypalExpressCheckout.showError(s,r);const o=e.responseJSON&&e.responseJSON.code?e.responseJSON.code:"server_error";t(new Error(o))})})},onAuthorize:function(t){const n={buttonId:s,payerId:t.payerID,env:o};return new paypal.Promise(function(s,o){jQuery.post(PaypalExpressCheckout.getExecutePaymentEndpoint(e,t.paymentID),n).done(function(e){if(!e){PaypalExpressCheckout.showError(PaypalExpressCheckout.processErrorMessage(),r);return o(new Error("server_error"))}PaypalExpressCheckout.showMessage(PaypalExpressCheckout.processSuccessMessage(e),r);s()}).fail(function(e){const s=PaypalExpressCheckout.processErrorMessage(e);PaypalExpressCheckout.showError(s,r);const t=e.responseJSON&&e.responseJSON.code?e.responseJSON.code:"server_error";o(new Error(t))})})}},n)}};
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.