@getopenpay/openpay-js 0.5.24 → 0.5.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -210,9 +210,9 @@ ${S.message}`),S.message)}else return getHumanFriendlyMessage(S.message);if(type
210
210
  </div>
211
211
  </div>
212
212
  `;const C=document.createElement("div"),L=C.attachShadow({mode:"open"});L.appendChild(D.content.cloneNode(!0));const y=L.querySelector(".cancel-button"),_=L.querySelectorAll(".bank-item"),N=()=>{document.body.removeChild(C)};y.addEventListener("click",()=>{N(),M(new Error("Bank selection cancelled"))}),_.forEach((I,x)=>{I.addEventListener("click",()=>{N(),R(S[x])})}),document.body.appendChild(C)})},createAndOpenMicroDepositForm=(S,T)=>{const{width:A,height:P,baseUrl:O}=T??{},R=new URL(`app/direct_debit/micro_deposit/?type=${S}`,O).toString();return new Promise((M,D)=>{const U=createAndOpenFrame(R,{width:A,height:P,title:"Micro Deposit Form"}),C=()=>{U.host.remove()},L=()=>{C(),D(new Error("Micro deposit form cancelled"))},y=V=>{C(),V.status==="success"&&V.payload?"error"in V.payload?D(new Error(V.payload.error)):M(V.payload):D(new Error("Micro deposit form failed"))};U.cancelButton.addEventListener("click",L);const _=startPolling(U.iframe,y,new URL(O).origin,"micro-deposit-status",MicroDepositStatusResponse),N=()=>{U.cancelButton.removeEventListener("click",L),clearInterval(_)},I=L,x=()=>{N(),I()};U.cancelButton.removeEventListener("click",L),U.cancelButton.addEventListener("click",x)})};function startPolling(S,T,A,P,O){const R=async()=>{try{const D=await pingCdeForStatus(S,A,P,O);D&&(clearInterval(M),T(D))}catch{}};R();const M=setInterval(R,CDE_POLLING_INTERVAL);return M}function handleEvents({elements:S,pollingInterval:T,resolve:A}){const P=()=>{clearInterval(T),S.host.remove(),A({status:ThreeDSStatus.CANCELLED})};return S.cancelButton.addEventListener("click",P),()=>{S.cancelButton.removeEventListener("click",P)}}async function start3dsVerification(S){const{url:T,baseUrl:A,frameWidth:P,frameHeight:O,frameTitle:R}=S,M=createAndOpenFrame(T,{width:P,height:O,title:R});return new Promise(D=>{const U=y=>{setTimeout(()=>{M.host.remove()},1e3),D(y),L?.()},C=startPolling(M.iframe,U,new URL(A).origin,"ping-3ds-status",Ping3DSStatusResponse),L=handleEvents({elements:M,pollingInterval:C,resolve:D})})}const start3dsVerificationStrict=async S=>{const T=await start3dsVerification(S);if(T.status===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(T.status===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed");return T.status!==ThreeDSStatus.SUCCESS&&assertNever(T.status),{href:T.href}},openPopupWindow=(S,T)=>{const A=window.open(T,"_blank");if(!A)throw new Error(`${S} popup window blocked. Please allow popups for this site.`);return A},startPopupWindowVerificationStrict=async(S,T,A,P)=>{const{err__:O}=createOjsFlowLoggers("popup-verify");return new Promise((R,M)=>{const D=openPopupWindow(S,P),U=setInterval(async()=>{try{const C=await checkIfPopupWindowVerified(T,A);if(C.present)clearInterval(U),D.close(),R({href:C.href});else if(D.closed)throw new Error(`${S} payment cancelled`)}catch(C){O(getErrorMessage(C)),clearInterval(U),M(getErrorMessage(C))}},1e3)})},detectLanguage=()=>{let T=(navigator.languages&&navigator.languages.length?navigator.languages:[navigator.language])?.[0];return T&&(T=T.split("-")[0]),T},{log__:log__$w,err__:err__$w}=createOjsFlowLoggers("common-cc"),createDynamicValidationSchema=({require_zip_code:S,require_full_billing_address:T,require_full_shipping_address:A,payment_method:P,isBusinessPurchase:O},R)=>{const M={};return P==="ach"&&(M[FieldName.FIRST_NAME]=stringType().min(2,{message:"Minimum length is 2"}),M[FieldName.LAST_NAME]=stringType().min(2,{message:"Minimum length is 2"})),S&&(M[FieldName.ZIP_CODE]=RequiredString),T&&(M[FieldName.LINE1]=RequiredString,M[FieldName.CITY]=RequiredString,M[FieldName.STATE]=RequiredString,M[FieldName.COUNTRY]=RequiredString,M[FieldName.ZIP_CODE]=RequiredString),A&&(M[FieldName.SHIPPING_LINE1]=RequiredString,M[FieldName.SHIPPING_CITY]=RequiredString,M[FieldName.SHIPPING_STATE]=RequiredString,M[FieldName.SHIPPING_COUNTRY]=RequiredString,M[FieldName.SHIPPING_ZIP_CODE]=RequiredString),(R[FieldName.IS_BUSINESS_PURCHASE]??O)&&(M[FieldName.BUSINESS_NAME]=RequiredString),Object.keys(M).length===0?RequiredFormFields:RequiredFormFields.extend(M)},validateNonCdeFormFields=(S,T,A={})=>{if(A){log__$w(`Received default field values: ${JSON.stringify(A)}`);const R=Object.keys(A);for(let M=0;M<R.length;M++){const D=R[M],U=A[D];S[D]||(S[D]=U)}}S[FieldName.IS_SHIPPING_SAME_AS_BILLING]=!!S[FieldName.IS_SHIPPING_SAME_AS_BILLING],S[FieldName.IS_SHIPPING_SAME_AS_BILLING]&&(S[FieldName.SHIPPING_LINE1]=S[FieldName.LINE1],S[FieldName.SHIPPING_LINE2]=S[FieldName.LINE2],S[FieldName.SHIPPING_LINE3]=S[FieldName.LINE3],S[FieldName.SHIPPING_CITY]=S[FieldName.CITY],S[FieldName.SHIPPING_STATE]=S[FieldName.STATE],S[FieldName.SHIPPING_COUNTRY]=S[FieldName.COUNTRY],S[FieldName.SHIPPING_ZIP_CODE]=S[FieldName.ZIP_CODE]);const O=createDynamicValidationSchema(A,S).safeParse(S);if(!O.success){const R=O.error.format(),M=extractIssuesPerField(R),D=Object.keys(M);for(let U=0;U<D.length;U++){const C=D[U],L=M[C];T(C,L,C)}throw err__$w("Got validation errors in non-CDE form fields",M),new Error("Almost there! Just a few things highlighted above to fix before you can submit.")}return O.data},{log__:log__$v,err__:err__$v}=createOjsFlowLoggers("common-cc"),validateNonCdeFormFieldsForCC=validateNonCdeFormFields,validateTokenizeCardResults=(S,T)=>{for(const A of S)if(A.success===!1)throw A.errors.forEach(P=>{const O=AllFieldNames.safeParse(P.elementType);if(!O.success)err__$v(`Unknown field name in onValidationError: ${P.elementType}. Error object:`,P);else{const R=O.data;T(R,P.errors)}}),log__$v(`Error tokenizing card: got validation errors: ${JSON.stringify(A.errors)}`),new Error("Got validation errors while tokenizing card")},{err__:err__$u}=createOjsFlowLoggers("common"),parseConfirmPaymentFlowResponse=S=>{if(S.payment_methods.length!==1)throw new Error(`Expected exactly one payment method, got ${S.payment_methods.length}`);return{payment_method_id:S.payment_methods[0].id}},findCpmMatchingType=(S,T)=>{const A=S.find(P=>T.safeParse(P).success);if(!A)throw err__$u("No CPMs found for model. All models:",S),new Error("No CPMs found for model");return T.parse(A)},createCustomerFieldsFromForm=(S,T)=>({new_customer_email:S.email,new_customer_last_name:S.lastName,new_customer_first_name:S.firstName,customer_business_name:S.businessName,customer_tax_id:S.taxId,customer_tax_id_type:S.taxIdType,new_customer_address:generateBillingAddressFromFields(S),new_customer_shipping_address:generateShippingAddressFromFields(S,T),customer_language:detectLanguage(),new_customer_phone:S.phone}),performSimpleCheckoutOrSetup=async S=>{const{log__:T}=createOjsFlowLoggers(S.logPrefix),A=await getPrefill(S.anyCdeConnection),P=parseConfirmPaymentFlowResponse(S.confirmResult);if(A.mode==="setup")return T("Setting up payment method..."),{mode:"setup",result:await finalizeSetupPaymentMethod(S.anyCdeConnection,{secure_token:A.token,pm_id:P.payment_method_id})};{if(S.usePayFirstFlow){if(T("Using pay-first flow..."),!S.confirmResult.pay_first_success_response)throw err__$u("Checkout failed, no pay-first success response:",S.confirmResult),new Error("Checkout failed, please try again with another payment method.");return{mode:"checkout",result:S.confirmResult.pay_first_success_response}}const O={secure_token:A.token,payment_input:{provider_type:S.checkoutPaymentMethod.provider},customer_email:S.requiredFormFields[FieldName.EMAIL],customer_address:generateBillingAddressFromFields(S.requiredFormFields),customer_shipping_address:generateShippingAddressFromFields(S.requiredFormFields,A.checkout_settings),promotion_code:S.requiredFormFields[FieldName.PROMOTION_CODE],line_items:A.line_items,total_amount_atom:A.amount_total_atom,cancel_at_end:!1,use_confirmed_pm_id:P.payment_method_id,checkout_payment_method:S.checkoutPaymentMethod};return T("Doing checkout...",O),{mode:"checkout",result:await performCheckout(S.anyCdeConnection,O)}}},PaymentProcessor=enumType(["stripe","airwallex","authorize_net","adyen","paypal","pockyt","loop"]);PaymentProcessor.Enum.stripe;const loadScript=({scriptId:S,src:T,checkLoadedFn:A})=>{const P=new AbortController;return new Promise((O,R)=>{let M=document.createElement("script");M.src=T,M.id=S,M.async=!0;const D=document.getElementById(S);A()?O():D?M=D:document.body.appendChild(M),M.addEventListener("load",()=>{P.abort(),O()},{signal:P.signal}),M.addEventListener("error",()=>{P.abort(),R("Failed to load the script")},{signal:P.signal})})},getPaymentDataRequest=({gateway:S,gatewayMerchantId:T,merchantName:A,merchantId:P,initialPreview:O,overridePaymentRequest:R,prefill:M})=>{const D=R?.amount?.amountAtom??O?.amountAtom??0,U=Math.max(D/100,0),C=(R?.amount?.currency??M?.currency??O.currency).toUpperCase(),L={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!0,billingAddressParameters:{format:"FULL"},allowCreditCards:!0,allowPrepaidCards:!0},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:S,gatewayMerchantId:T}}}],emailRequired:!0,shippingAddressRequired:M.checkout_settings.require_full_shipping_address,merchantInfo:{merchantId:P??"",merchantName:A},transactionInfo:{countryCode:"US",currencyCode:C,totalPriceStatus:R?.pending?"ESTIMATED":"FINAL",totalPrice:U.toFixed(2)}};return R?.googlePayPaymentRequest?typeof R.googlePayPaymentRequest=="function"?{...L,...R.googlePayPaymentRequest(L)}:{...L,...R.googlePayPaymentRequest}:L},loadGooglePayScript=()=>loadScript({scriptId:"__op_internal_google_pay_sdk",src:"https://pay.google.com/gp/p/js/pay.js",checkLoadedFn:()=>!!window.google?.payments?.api});let paymentsClient=null;const getGooglePayEnvironment=async S=>await getCurrentEnv(S)==="prod"?"PRODUCTION":"TEST",getGooglePaymentsClient=async(S,T)=>{const A=await getGooglePayEnvironment(S);return paymentsClient===null&&(paymentsClient=new window.google.payments.api.PaymentsClient({environment:A,merchantInfo:T.merchantInfo})),paymentsClient},parseAirwallexStartPaymentFlowResponse=S=>{const T=S.required_user_actions.find(A=>A.type==="airwallex_payment_consent");return T?CommonNextActionMetadata.parse(T):null},fillEmptyFormInputsWithGooglePay=(S,T)=>{const A={...S},P=T.paymentMethodData?.info?.billingAddress,O=T.shippingAddress;if(P){const[R,...M]=P.name?.trim()?.split(/\s+/)??[],D=M.join(" ")||void 0;A[FieldName.EMAIL]=A[FieldName.EMAIL]||T.email||"op_unfilled@getopenpay.com",A[FieldName.LINE1]=A[FieldName.LINE1]||P.address1||"",A[FieldName.LINE2]=A[FieldName.LINE2]||P.address2||"",A[FieldName.LINE3]=A[FieldName.LINE3]||P.address3||"",A[FieldName.CITY]=A[FieldName.CITY]||P.locality||"",A[FieldName.STATE]=A[FieldName.STATE]||P.administrativeArea||"",A[FieldName.COUNTRY]=A[FieldName.COUNTRY]||P.countryCode||"US",A[FieldName.ZIP_CODE]=A[FieldName.ZIP_CODE]||P.postalCode||"00000";const U=A[FieldName.FIRST_NAME]||R||"",C=A[FieldName.LAST_NAME]||D||"";U||C?(A[FieldName.FIRST_NAME]=U,A[FieldName.LAST_NAME]=C):(A[FieldName.FIRST_NAME]="_OP_UNKNOWN",A[FieldName.LAST_NAME]="")}return O&&(A[FieldName.SHIPPING_LINE1]=A[FieldName.SHIPPING_LINE1]||O.address1||"",A[FieldName.SHIPPING_LINE2]=A[FieldName.SHIPPING_LINE2]||O.address2||"",A[FieldName.SHIPPING_LINE3]=A[FieldName.SHIPPING_LINE3]||O.address3||"",A[FieldName.SHIPPING_CITY]=A[FieldName.SHIPPING_CITY]||O.locality||"",A[FieldName.SHIPPING_ZIP_CODE]=A[FieldName.SHIPPING_ZIP_CODE]||O.postalCode||"00000",A[FieldName.SHIPPING_STATE]=A[FieldName.SHIPPING_STATE]||O.administrativeArea||"",A[FieldName.SHIPPING_COUNTRY]=A[FieldName.SHIPPING_COUNTRY]||O.countryCode||"US"),A},{log__:log__$u,err__:err__$t}=createOjsFlowLoggers("awx-bacs"),runAirwallexBACSFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{const R=validateNonCdeFormFieldsForCC(A,P.get.onValidationError),M=S.anyCdeConnection,D=await getPrefill(M),U=O.verificationMethod??"truelayer";let C=null;if(U==="micro_deposit"){log__$u("Micro deposit verification selected, showing form...");try{C=await createAndOpenMicroDepositForm("bacs_direct_debit",{width:"450px",height:"350px",baseUrl:S.baseUrl}),log__$u("Micro deposit data collected")}catch{throw log__$u("Micro deposit form cancelled"),new Error("Micro deposit form cancelled")}}const L=await startPaymentFlow(M,{payment_provider:T.provider,checkout_payment_method:T,...createCustomerFieldsFromForm(R,D.checkout_settings),customer_language:detectLanguage()}),y=parseAirwallexStartPaymentFlowResponse(L),_=y?.consent_id,N=y?.available_banks;let I;if(U==="truelayer"&&N&&N.length>=1){log__$u("Multiple banks available, showing bank selector...");try{I=await createAndOpenBankSelector(N,{width:"450px",height:"500px",title:"Select bank"}),log__$u(`Bank selected: ${I.display_name}`)}catch{throw log__$u("Bank selection cancelled"),new Error("Bank selection cancelled")}}const x=generateBillingAddressFromFields(R),V={type:"bacs_direct_debit",bacs_direct_debit:{bank_name:I?.bank_name,owner_name:getFullName(R[FieldName.FIRST_NAME],R[FieldName.LAST_NAME]),owner_email:R[FieldName.EMAIL],country_code:R[FieldName.COUNTRY],account_number:C?.account_number,sort_code:C?.sort_code,address:{...x,town:x.city,postcode:x.zip_code}}},F=(await confirmPaymentFlow(M,{secure_token:D.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:_,verification_method:U,direct_debit_data:V}})).required_user_actions?.find(ee=>ee.type==="airwallex_payment_consent")?.redirect_url;if(F){log__$u("BACS verification required, starting verification...");const{status:ee}=await start3dsVerification({url:F,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"BACS verification"});if(log__$u(`╰ BACS verification completed [Status: ${ee}]`),ee===ThreeDSStatus.CANCELLED)throw new Error("BACS verification cancelled");if(ee===ThreeDSStatus.FAILURE)throw new Error("BACS verification failed")}const W=await confirmPaymentFlow(M,{secure_token:D.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:_}});try{return performSimpleCheckoutOrSetup({logPrefix:"awx-bacs",anyCdeConnection:M,checkoutPaymentMethod:T,requiredFormFields:R,confirmResult:W,usePayFirstFlow:!1})}catch(ee){throw err__$t("BACS payment error",ee),track("checkout_error",{error:ee}),new Error(ee?.message??"Unknown error")}}),{log__:log__$t,err__:err__$s}=createOjsFlowLoggers("awx-eft"),runAirwallexEFTFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{const R=validateNonCdeFormFieldsForCC(A,P.get.onValidationError),M=S.anyCdeConnection,D=await getPrefill(M),U=O.verificationMethod??"plaid";let C=null;if(U==="micro_deposit"){log__$t("Micro deposit verification selected, showing form...");try{C=await createAndOpenMicroDepositForm("eft_direct_debit",{width:"450px",height:"450px",baseUrl:S.baseUrl}),log__$t("Micro deposit data collected")}catch{throw log__$t("Micro deposit form cancelled"),new Error("Micro deposit form cancelled")}}const L=await startPaymentFlow(M,{payment_provider:T.provider,checkout_payment_method:T,...createCustomerFieldsFromForm(R,D.checkout_settings),customer_language:detectLanguage()}),_=parseAirwallexStartPaymentFlowResponse(L)?.consent_id,N={type:"eft_direct_debit",eft_direct_debit:{business_account:O.isBusinessAccount??!1,owner_name:getFullName(R[FieldName.FIRST_NAME],R[FieldName.LAST_NAME]),owner_email:R[FieldName.EMAIL],institution_number:C?.institution_number,transit_number:C?.transit_number,account_number:C?.account_number}},x=(await confirmPaymentFlow(M,{secure_token:D.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:_,verification_method:U,direct_debit_data:N}})).required_user_actions?.find(k=>k.type==="airwallex_payment_consent")?.redirect_url;if(x){log__$t("EFT verification required, starting verification...");const{status:k}=await start3dsVerification({url:x,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"EFT verification"});if(log__$t(`╰ EFT verification completed [Status: ${k}]`),k===ThreeDSStatus.CANCELLED)throw new Error("EFT verification cancelled");if(k===ThreeDSStatus.FAILURE)throw new Error("EFT verification failed")}const V=await confirmPaymentFlow(M,{secure_token:D.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:_}});try{return performSimpleCheckoutOrSetup({logPrefix:"awx-eft",anyCdeConnection:M,checkoutPaymentMethod:T,requiredFormFields:R,confirmResult:V,usePayFirstFlow:!1})}catch(k){throw err__$s("EFT payment error",k),track("checkout_error",{error:k}),new Error(k?.message??"Unknown error")}}),{log__:log__$s,err__:err__$r}=createOjsFlowLoggers("awx-sepa"),runAirwallexSEPAFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{const R=validateNonCdeFormFieldsForCC(A,P.get.onValidationError),M=S.anyCdeConnection,D=await getPrefill(M),U=O.verificationMethod??"truelayer";let C=null;if(U==="micro_deposit"){log__$s("Micro deposit verification selected, showing form...");try{C=await createAndOpenMicroDepositForm("sepa_direct_debit",{width:"450px",height:"300px",baseUrl:S.baseUrl}),log__$s("Micro deposit data collected")}catch{throw log__$s("Micro deposit form cancelled"),new Error("Micro deposit form cancelled")}}const L=await startPaymentFlow(M,{payment_provider:T.provider,checkout_payment_method:T,...createCustomerFieldsFromForm(R,D.checkout_settings),customer_language:detectLanguage()}),y=parseAirwallexStartPaymentFlowResponse(L),_=y?.consent_id,N=y?.available_banks;let I;if(U==="truelayer"&&N&&N.length>=1){log__$s("Multiple banks available, showing bank selector...");try{I=await createAndOpenBankSelector(N,{width:"450px",height:"500px",title:"Select bank"}),log__$s(`Bank selected: ${I.display_name}`)}catch{throw log__$s("Bank selection cancelled"),new Error("Bank selection cancelled")}}const V=(await confirmPaymentFlow(M,{secure_token:D.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:_,verification_method:U,direct_debit_data:{type:"sepa_direct_debit",sepa_direct_debit:{bank_name:I?.bank_name,country_code:R[FieldName.COUNTRY],owner_name:getFullName(R[FieldName.FIRST_NAME],R[FieldName.LAST_NAME]),owner_email:R[FieldName.EMAIL],iban:C?.iban}}}})).required_user_actions?.find(F=>F.type==="airwallex_payment_consent")?.redirect_url;if(V){log__$s("SEPA verification required, starting verification...");const{status:F}=await start3dsVerification({url:V,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"SEPA verification"});if(log__$s(`╰ SEPA verification completed [Status: ${F}]`),F===ThreeDSStatus.CANCELLED)throw new Error("SEPA verification cancelled");if(F===ThreeDSStatus.FAILURE)throw new Error("SEPA verification failed")}const k=await confirmPaymentFlow(M,{secure_token:D.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:_}});try{return performSimpleCheckoutOrSetup({logPrefix:"awx-sepa",anyCdeConnection:M,checkoutPaymentMethod:T,requiredFormFields:R,confirmResult:k,usePayFirstFlow:!1})}catch(F){throw err__$r("SEPA payment error",F),track("checkout_error",{error:F}),new Error(F?.message??"Unknown error")}}),{log__:log__$r,err__:err__$q}=createOjsFlowLoggers("airwallex-cc"),Airwallex3dsErrorResponseHeaders=objectType({"op-airwallex-3ds-url":stringType(),"op-airwallex-initial-intent-id":stringType(),"op-airwallex-consent-id":stringType()}),parseResponseHeaders$3=S=>{const T=Airwallex3dsErrorResponseHeaders.safeParse(S);if(!T.success){const A="Unable to process your credit card. Please contact support for assistance.",P=`Airwallex 3DS is required but headers are malformed. Got: ${JSON.stringify(S)}`;throw err__$q(P),new Error(A)}return T.data},checkIfRequiresAirwallex3ds=S=>S?.["op-airwallex-3ds-url"]!==void 0,parseIntentIdFrom3dsHref=S=>{try{const T=new URL(S??"").searchParams.get("payment_intent_id");if(!T)throw new Error("No intent ID found in Airwallex 3DS verification result");return log__$r(`Airwallex 3DS verification success. [Intent ID: ${T}]`),T}catch(T){const A="Error verifying Airwallex 3DS verification result.";throw err__$q(A,`Resulting URL: ${S}.
213
- Error: ${getErrorMessage(T)}`),new Error(A)}},runAirwallex3dsFlow=async(S,T)=>{const A=parseResponseHeaders$3(T),P=await start3dsVerificationStrict({url:A["op-airwallex-3ds-url"],baseUrl:S}),O=parseIntentIdFrom3dsHref(P.href??""),R=A["op-airwallex-initial-intent-id"];if(R!==O){const D="Unable to process your credit card. Please contact support for assistance.",U=`Intent ID from callback (${O}) does not match the initial intent ID (${R}).`;throw err__$q(U),new Error(D)}return{existing_cc:{initial_intent_id:O,consent_id:A["op-airwallex-consent-id"]}}},ApplePayCpm$2=objectType({provider:literalType("apple_pay"),processor_name:literalType("airwallex"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType()})}),GooglePayCpm$2=objectType({provider:literalType("google_pay"),processor_name:literalType("airwallex"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType(),google_pay_merchant_id:stringType().nullish()})}),loadApplePayScript=()=>loadScript({scriptId:"__op_internal_apple_pay_sdk",src:"https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",checkLoadedFn:()=>!!window.ApplePaySession}),fillEmptyFormInputsWithApplePay=(S,T)=>{const A=T.token.paymentMethod.billingContact,P=T.billingContact,O=T.shippingContact,R={...S};if(A||P||O){R[FieldName.EMAIL]=R[FieldName.EMAIL]||A?.emailAddress||P?.emailAddress||O?.emailAddress||"op_unfilled@email.com",R[FieldName.COUNTRY]=R[FieldName.COUNTRY]||A?.countryCode||P?.countryCode||O?.countryCode||"US",R[FieldName.ZIP_CODE]=R[FieldName.ZIP_CODE]||A?.postalCode||P?.postalCode||O?.postalCode||"00000";const M=R[FieldName.FIRST_NAME]||A?.givenName||P?.givenName||O?.givenName||"",D=R[FieldName.LAST_NAME]||A?.familyName||P?.familyName||O?.familyName||"";M||D?(R[FieldName.FIRST_NAME]=M,R[FieldName.LAST_NAME]=D):(R[FieldName.FIRST_NAME]="_OP_UNKNOWN",R[FieldName.LAST_NAME]="")}return R};objectType({data:objectType({messageHeaders:recordType(stringType(),anyType()),errors:arrayType(anyType()),messageType:stringType(),messageBody:recordType(stringType(),anyType())}),origin:literalType("https://applepay.cdn-apple.com")});const createRecurringPaymentRequest=({total:S,prefill:T})=>{if(T.mode==="setup")return{paymentDescription:"Setup recurring payment",regularBilling:{amount:S.amount,label:"Setup recurring payment",paymentTiming:"recurring",type:"final"},managementURL:new URL(`/pay/${T.token}`,FRAME_BASE_URL).toString()};const A=T.line_items?.[0];if(!A)return;const P=A?.billing_interval==="week"?"day":A?.billing_interval,O=A?.billing_interval_count?A?.billing_interval==="week"?A?.billing_interval_count*7:A?.billing_interval_count:void 0;return{paymentDescription:A?.description??"",regularBilling:{amount:S.amount,label:A?.description??"",recurringPaymentIntervalUnit:P,recurringPaymentIntervalCount:O,paymentTiming:"recurring",type:"final"},managementURL:`https://cde.getopenpay.com/pay/${T.token}`}},createApplePayTotal=({overridePaymentRequest:S,initialPreview:T,prefill:A,defaultLabel:P="Total"})=>{const O=(S?.amount?.currency??A?.currency??T.currency).toUpperCase(),M=((S?.amount?.amountAtom??T?.amountAtom??0)/100).toFixed(2);return{currencyCode:O,total:{label:S?.label??P??"Total",type:S?.pending?"pending":"final",amount:M}}},getApplePayPaymentRequest=({overridePaymentRequest:S,initialPreview:T,prefill:A,defaultLabel:P})=>{const{currencyCode:O,total:R}=createApplePayTotal({overridePaymentRequest:S,initialPreview:T,prefill:A,defaultLabel:P});let M={countryCode:"US",currencyCode:O,requiredBillingContactFields:["email","postalAddress","name"],requiredShippingContactFields:["email",...A.checkout_settings.require_full_shipping_address?["postalAddress"]:[]],supportedNetworks:["visa","masterCard","amex","discover","jcb"],merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],total:R};return A.line_items.every(U=>U.billing_interval&&U.billing_interval_count)&&(M.recurringPaymentRequest=createRecurringPaymentRequest({total:R,prefill:A})),S?.applePayPaymentRequest&&(typeof S.applePayPaymentRequest=="function"?M={...M,...S.applePayPaymentRequest(M)}:M={...M,...S.applePayPaymentRequest}),M},AdyenEnvironment=enumType(["test","live","live-us","live-in","live-apse","live-au"]),AdyenLocale=enumType(["ar","bg-BG","ca-ES","cs-CZ","da-DK","de-DE","el-GR","en-US","es-ES","et-EE","fi-FI","fr-FR","hr-HR","hu-HU","is-IS","it-IT","ja-JP","ko-KR","lt-LT","lv-LV","nl-NL","no-NO","pl-PL","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sl-SI","sv-SE","zh-CN","zh-TW"]),{log__:log__$q,err__:err__$p}=createOjsFlowLoggers("adyen-cc"),Adyen3dsResponseHeaders=objectType({"op-account-id":stringType(),"op-adyen-client-key":stringType(),"op-adyen-environment":AdyenEnvironment,"op-adyen-action":stringType()}),friendlyErr="Unable to process your credit card. Please contact support for assistance.",parseResponseHeaders$2=S=>{const T=Adyen3dsResponseHeaders.safeParse(S);if(!T.success)throw err__$p(`Adyen 3DS is required but headers are malformed. Got: ${JSON.stringify(S)}`),new Error(friendlyErr);return T.data},decodeAdyenAction=S=>JSON.parse(S),isAdyenAvailable=()=>"AdyenWeb"in window&&"AdyenCheckout"in window.AdyenWeb,getAdyenCheckout=async()=>{log__$q("Waiting for Adyen SDK to load...");for(let S=0;S<10;S++)isAdyenAvailable()||await sleep(500);if(!isAdyenAvailable())throw err__$p("Adyen SDK not loaded properly"),new Error(friendlyErr);return log__$q("Adyen SDK loaded successfully"),window.AdyenWeb.AdyenCheckout},handleAdyen3ds=S=>{const{headers:T,locale:A,countryCode:P,component:O,host:R,cancelButton:M}=S,D=decodeAdyenAction(T["op-adyen-action"]);return log__$q(`Running Adyen 3DS flow for action type: ${D.type}`),new Promise(U=>{const C=()=>{log__$q("Cleaning up Adyen 3DS flow"),M.removeEventListener("click",_),R.remove()},L=I=>{err__$p("Authentication failed. Result:",I),U({status:ThreeDSStatus.FAILURE,cleanup:C})},y=I=>{err__$p("Adyen error:",I),U({status:ThreeDSStatus.FAILURE,cleanup:C})},_=()=>{U({status:ThreeDSStatus.CANCELLED,cleanup:C})};M.addEventListener("click",_);const N=(I,x,V)=>{R.remove(),U({status:ThreeDSStatus.SUCCESS,additionalDetails:I,cleanup:C})};getAdyenCheckout().then(I=>I({clientKey:T["op-adyen-client-key"],environment:T["op-adyen-environment"],locale:A,countryCode:P,onAdditionalDetails:N,onPaymentFailed:L,onError:y})).then(I=>{I.createFromAction(D,{challengeWindowSize:"03"}).mount(O)})})},determineLocale=S=>{const T=navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language,A=S??T,P=AdyenLocale.safeParse(A);return P.success?(log__$q(`Resolved locale: ${P.data}`),P.data):(err__$p(`Resolved invalid locale: ${A}. Defaulting to en-US.`),"en-US")},checkIfRequiresAdyen3ds=S=>S?.["op-adyen-action"]!==void 0,runAdyen3dsFlow=async(S,T,A)=>{const P=parseResponseHeaders$2(T),O=document.createElement("div");O.id="adyen-container";const{host:R,iframe:M,cancelButton:D}=createAndOpenFrame("http://example.com");M.replaceWith(O);const U=await handleAdyen3ds({headers:P,locale:determineLocale(A),countryCode:S,component:O,host:R,cancelButton:D});if(U.cleanup(),U.status===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed");if(U.status===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(U.status===ThreeDSStatus.SUCCESS){if(!U.additionalDetails)throw new Error("3DS verification succeeded but no additional details were returned");return log__$q("3DS verification succeeded"),{existing_cc:{additional_details:U.additionalDetails.data}}}else assertNever(U.status)},ApplePayCpm$1=objectType({provider:literalType("apple_pay"),processor_name:literalType("adyen"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType()})}),GooglePayCpm$1=objectType({provider:literalType("google_pay"),processor_name:literalType("adyen"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType(),google_pay_merchant_id:stringType().nullish()})}),{log__:log__$p}=createOjsFlowLoggers("awx-apple-pay");async function handleValidateMerchant$2(S,T){try{const O=(await preparePaymentFlow(T.connection,{checkout_payment_method:T.checkoutPaymentMethod,processor_specific_metadata:{apple_pay_session:{validation_url:S.validationURL,initiative_context:window.location.hostname,their_account_id:T.processorAccount.processor_account_id}}})).next_action_metadata?.apple_pay_session;if(!O)throw new Error("No session data received from payment flow");T.session.completeMerchantValidation(O),track("apple_pay_complete_merchant_validation",{...O})}catch(A){throw T.session.abort(),A}}async function handlePaymentAuthorized$2(S,T){try{const A=S.payment,P=fillEmptyFormInputsWithApplePay(T.nonCdeFormInputs,A),O=validateNonCdeFormFieldsForCC(P,T.formCallbacks.get.onValidationError,T.defaultFieldValues);track("billing_details_received",{...O}),await startPaymentFlow(T.connection,{payment_provider:T.checkoutPaymentMethod.provider,checkout_payment_method:T.checkoutPaymentMethod,...createCustomerFieldsFromForm(O,T.prefill.checkout_settings)});const R=await confirmPaymentFlow(T.connection,{secure_token:T.prefill.token,processor_specific_metadata:{payment_provider:T.checkoutPaymentMethod.provider,browser_info:getFraudMetadata(),mobile_wallet_payment_data:{encrypted_payment_token:JSON.stringify(A.token)}}});if(log__$p("[1st] Confirm payment flow response",R),!R.payment_methods?.[0]?.id)throw new Error("No PM ID found");const D={status:ApplePaySession.STATUS_SUCCESS};return T.session.completePayment(D),performSimpleCheckoutOrSetup({logPrefix:"adyen-applepay",anyCdeConnection:T.connection,checkoutPaymentMethod:T.checkoutPaymentMethod,requiredFormFields:O,confirmResult:R,usePayFirstFlow:!1})}catch(A){const P={status:ApplePaySession.STATUS_FAILURE};throw T.session.completePayment(P),A}}const{log__:log__$o,err__:err__$o}=createOjsFlowLoggers("adyen-apple-pay"),initAdyenApplePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A={processor:PaymentProcessor.Enum.adyen,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm$1);if(!P)return A;if(log__$o("Loading Apple Pay script"),await loadApplePayScript(),!window.ApplePaySession||!ApplePaySession.canMakePayments())return log__$o("Apple Pay is not available on this device/browser"),A;if(log__$o("Apple Pay Loaded"),!await ApplePaySession.canMakePayments())return log__$o("No active cards available for Apple Pay"),A;if(!P.metadata.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const M=S.anyCdeConnection,D=await getPrefill(M),U=D.mode==="setup",C=await getCheckoutPreviewAmount(M,D.token,U,void 0),L=async y=>{try{await OjsFlows.adyenApplePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:{...y,initialPreview:C},initResult:void 0})}catch(_){err__$o("Apple Pay payment error",_),T.get.onCheckoutError(_?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.adyen,isAvailable:!0,isLoading:!1,startFlow:L}}),runAdyenApplePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,customParams:P,formCallbacks:O})=>{const R=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm$1),{overridePaymentRequest:M,initialPreview:D}=P,U=S.anyCdeConnection,C=await getPrefill(U),L=C.mode==="setup",y=getApplePayPaymentRequest({overridePaymentRequest:M,initialPreview:D,prefill:{...C},defaultLabel:R?.metadata?.processor_account_name}),_=new ApplePaySession(3,y),N={session:_,connection:S.anyCdeConnection,checkoutPaymentMethod:T,nonCdeFormInputs:A,processorAccount:R.metadata,prefill:C,isSetupMode:L,baseUrl:S.baseUrl,formCallbacks:O,defaultFieldValues:P?.defaultFieldValues};return track("apple_pay_flow_started",{processor_name:T.processor_name,prefill:excludeProps(C,["brand"]),overridePaymentRequest:M}),new Promise((I,x)=>{const V=()=>{log__$o("Payment cancelled by user"),x(new Error("Payment cancelled by user"))};_.onvalidatemerchant=async k=>{try{await handleValidateMerchant$2(k,N)}catch(F){x(F)}},_.onpaymentmethodselected=async()=>{const k=await getCheckoutPreviewAmount(U,C.token,L,void 0),F={newTotal:createApplePayTotal({overridePaymentRequest:P.overridePaymentRequest,initialPreview:k,defaultLabel:R?.metadata?.processor_account_name,prefill:C}).total};_.completePaymentMethodSelection(F)},_.onpaymentauthorized=async k=>{track("apple_pay_payment_authorized");try{const F=await handlePaymentAuthorized$2(k,N);I(F)}catch(F){x(F)}},_.oncancel=V,_.begin()}).catch(I=>{throw err__$o("Apple Pay payment error",I),track("apple_pay_payment_error",{error:I}),I})}),{log__:log__$n,err__:err__$n}=createOjsFlowLoggers("adyen-google-pay"),initAdyenGooglePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A={processor:PaymentProcessor.Enum.adyen,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm$1);if(!P)return A;log__$n("Google Pay CPM",P);const O=P.metadata;if(!O.processor_account_id)return err__$n("No gateway merchant ID found in processor account"),A;if(log__$n("Loading Google Pay script"),await loadGooglePayScript(),!window.google?.payments?.api)return err__$n("Google Pay SDK not loaded properly"),A;if(await getGooglePayEnvironment(S.baseUrl)==="PRODUCTION"&&!O.google_pay_merchant_id)return err__$n("Google Pay merchant ID is required for production environment"),A;log__$n("Google Pay SDK loaded",window.google.payments);const M=S.anyCdeConnection,D=await getPrefill(M),U=D.mode==="setup",C=await getCheckoutPreviewAmount(M,D.token,U,void 0);try{const y=getPaymentDataRequest({prefill:D,gateway:"adyen",gatewayMerchantId:O.processor_account_id,merchantName:O.processor_account_name,merchantId:O.google_pay_merchant_id??"",initialPreview:C}),_=await getGooglePaymentsClient(S.baseUrl,y),{result:N}=await _.isReadyToPay(y);if(!N)return log__$n("Google Pay is not available for this user"),A}catch(y){return err__$n("Error checking Google Pay availability",y),A}const L=async y=>{try{OjsFlows.adyenGooglePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:{...y,initialPreview:C}})}catch(_){err__$n("Google Pay payment error",_),T.get.onCheckoutError(_?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.adyen,isAvailable:!0,isLoading:!1,startFlow:L}}),runAdyenGooglePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$n("Starting Google Pay flow...");const R=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm$1),{overridePaymentRequest:M}=O,D=R.metadata;if(!D.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const U=S.anyCdeConnection,C=await getPrefill(U),L=C.mode==="setup",y=await getCheckoutPreviewAmount(U,C.token,L,void 0),_=getPaymentDataRequest({prefill:C,gateway:"adyen",gatewayMerchantId:D.processor_account_id,merchantName:D.processor_account_name,merchantId:D.google_pay_merchant_id??"",initialPreview:y,overridePaymentRequest:M});track("google_pay_flow_started",{processor_name:R.processor_name,prefill:excludeProps(C,["brand"]),overridePaymentRequest:M});const N=await getGooglePaymentsClient(S.baseUrl,_);try{const I=await N.loadPaymentData(_);log__$n("Google Pay Payment data",I);const x=fillEmptyFormInputsWithGooglePay(A,I),V=validateNonCdeFormFieldsForCC(x,P.get.onValidationError,O?.defaultFieldValues);if(track("billing_details_received",{...V}),!I.paymentMethodData?.tokenizationData?.token)throw new Error("No payment token received from Google Pay");const F=await startPaymentFlow(U,{payment_provider:T.provider,checkout_payment_method:T,...createCustomerFieldsFromForm(V,C.checkout_settings)}),W=parseAirwallexStartPaymentFlowResponse(F);log__$n("Start flow next actions",W);let ee=await confirmPaymentFlow(U,{secure_token:C.token,processor_specific_metadata:{payment_provider:T.provider,browser_info:getFraudMetadata(),mobile_wallet_payment_data:{encrypted_payment_token:I.paymentMethodData?.tokenizationData?.token}}});log__$n("[1st] Confirm payment flow response",ee);let ne=ee.payment_methods?.[0]?.id;const le=ee.required_user_actions?.find(Re=>Re.type==="adyen-3ds");if(le&&le.redirect_url){log__$n("Adyen 3DS Required, starting verification...",le);const{status:Re}=await start3dsVerification({url:le.redirect_url,baseUrl:S.baseUrl});if(log__$n(`╰ Adyen 3DS verification completed [Status: ${Re}]`),Re===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(Re===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed")}if(le&&!ne&&(ee=await confirmPaymentFlow(U,{secure_token:C.token,their_pm_id:le.their_pm_id,processor_specific_metadata:{payment_provider:T.provider}}),log__$n("[2nd] Confirm payment flow response after 3DS",ee),ne=ee.payment_methods?.[0]?.id),!ne)throw new Error("No payment method ID found");return performSimpleCheckoutOrSetup({logPrefix:"adyen-googlepay",anyCdeConnection:U,checkoutPaymentMethod:T,requiredFormFields:V,confirmResult:ee,usePayFirstFlow:!1})}catch(I){throw err__$n("Google Pay payment error",I),track("google_pay_payment_error",{error:I}),new Error(I?.message??"Unknown error")}}),{log__:log__$m,err__:err__$m}=createOjsFlowLoggers("awx-ach"),runAirwallexACHFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{const R=validateNonCdeFormFieldsForCC(A,P.get.onValidationError),M=S.anyCdeConnection,D=await getPrefill(M),U=O.verificationMethod??"plaid";let C=null;if(U==="micro_deposit"){log__$m("Micro deposit verification selected, showing form...");try{C=await createAndOpenMicroDepositForm("ach_direct_debit",{width:"450px",height:"400px",baseUrl:S.baseUrl}),log__$m("Micro deposit data collected")}catch{throw log__$m("Micro deposit form cancelled"),new Error("Micro deposit form cancelled")}}const L=await startPaymentFlow(M,{payment_provider:T.provider,checkout_payment_method:T,...createCustomerFieldsFromForm(R,D.checkout_settings),customer_language:detectLanguage()}),_=parseAirwallexStartPaymentFlowResponse(L)?.consent_id,I=(await confirmPaymentFlow(M,{secure_token:D.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:_,verification_method:U,direct_debit_data:{type:"ach_direct_debit",ach_direct_debit:{business_account:O.isBusinessAccount??!1,owner_name:getFullName(R[FieldName.FIRST_NAME],R[FieldName.LAST_NAME]),owner_email:R[FieldName.EMAIL],account_number:C?.account_number,aba_routing_number:C?.aba_routing_number}}}})).required_user_actions?.find(V=>V.type==="airwallex_payment_consent")?.redirect_url;if(I){log__$m("Plaid verification Required, starting verification...");const{status:V}=await start3dsVerification({url:I,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"ACH verification"});if(log__$m(`╰ Plaid verification completed [Status: ${V}]`),V===ThreeDSStatus.CANCELLED)throw new Error("Plaid verification cancelled");if(V===ThreeDSStatus.FAILURE)throw new Error("Plaid verification failed")}const x=await confirmPaymentFlow(M,{secure_token:D.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:_}});try{return performSimpleCheckoutOrSetup({logPrefix:"awx-ach",anyCdeConnection:M,checkoutPaymentMethod:T,requiredFormFields:R,confirmResult:x,usePayFirstFlow:!1})}catch(V){throw err__$m("ACH payment error",V),track("checkout_error",{error:V}),new Error(V?.message??"Unknown error")}}),{log__:log__$l}=createOjsFlowLoggers("awx-apple-pay");async function handleValidateMerchant$1(S,T){try{const O=(await preparePaymentFlow(T.connection,{checkout_payment_method:T.checkoutPaymentMethod,processor_specific_metadata:{airwallex_payment_session:{validation_url:S.validationURL,initiative_context:window.location.hostname,their_account_id:T.processorAccount.processor_account_id}}})).next_action_metadata?.apple_pay_session;if(!O)throw new Error("No session data received from payment flow");T.session.completeMerchantValidation(O),track("apple_pay_complete_merchant_validation",{...O})}catch(A){throw T.session.abort(),A}}async function handle3DS(S,T){if(!S.redirect_url)throw new Error("No redirect URL found");log__$l("3DS Required, starting verification...",S);const{status:A}=await start3dsVerification({url:S.redirect_url,baseUrl:T.baseUrl});if(log__$l(`╰ 3DS verification completed [Status: ${A}]`),A===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(A===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed");const P=await confirmPaymentFlow(T.connection,{secure_token:T.prefill.token,processor_specific_metadata:{their_pm_id:S.their_pm_id,airwallex_consent_id:S.consent_id,payment_provider:T.checkoutPaymentMethod.provider}});return log__$l("[2nd] Confirm payment flow response",P),P}async function handlePaymentAuthorized$1(S,T){try{const A=S.payment,P=fillEmptyFormInputsWithApplePay(T.nonCdeFormInputs,A),O=validateNonCdeFormFieldsForCC(P,T.formCallbacks.get.onValidationError,T.defaultFieldValues);track("billing_details_received",{...O});const D=(await startPaymentFlow(T.connection,{payment_provider:T.checkoutPaymentMethod.provider,checkout_payment_method:T.checkoutPaymentMethod,...createCustomerFieldsFromForm(O,T.prefill.checkout_settings)})).required_user_actions[0].consent_id;if(!D)throw new Error("No consent ID received from payment flow");let U=await confirmPaymentFlow(T.connection,{secure_token:T.prefill.token,processor_specific_metadata:{payment_provider:T.checkoutPaymentMethod.provider,airwallex_consent_id:D,airwallex_payment_method_data:{type:"applepay",applepay:{payment_data_type:"encrypted_payment_token",encrypted_payment_token:JSON.stringify(A.token)}}}});log__$l("[1st] Confirm payment flow response",U);let C=U.payment_methods?.[0]?.id;const L=U.required_user_actions?.find(_=>_.type==="airwallex_payment_consent");if(L?.redirect_url&&L.consent_id&&L.their_pm_id&&(U=await handle3DS(L,T),C=U.payment_methods?.[0]?.id),!C)throw new Error("No PM ID found");const y={status:ApplePaySession.STATUS_SUCCESS};return T.session.completePayment(y),performSimpleCheckoutOrSetup({logPrefix:"awx-applepay",anyCdeConnection:T.connection,checkoutPaymentMethod:T.checkoutPaymentMethod,requiredFormFields:O,confirmResult:U,usePayFirstFlow:!1})}catch(A){const P={status:ApplePaySession.STATUS_FAILURE};throw T.session.completePayment(P),A}}const{log__:log__$k,err__:err__$l}=createOjsFlowLoggers("awx-apple-pay"),initAirwallexApplePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A={processor:PaymentProcessor.Enum.airwallex,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm$2);if(!P)return A;if(log__$k("Loading Apple Pay script"),await loadApplePayScript(),!window.ApplePaySession||!ApplePaySession.canMakePayments())return log__$k("Apple Pay is not available on this device/browser"),A;if(log__$k("Apple Pay Loaded"),!await ApplePaySession.canMakePayments())return log__$k("No active cards available for Apple Pay"),A;if(!P.metadata.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const M=S.anyCdeConnection,D=await getPrefill(M),U=D.mode==="setup",C=await getCheckoutPreviewAmount(M,D.token,U,void 0),L=async y=>{try{await OjsFlows.airwallexApplePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:{...y,initialPreview:C},initResult:void 0})}catch(_){err__$l("Apple Pay payment error",_),T.get.onCheckoutError(_?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.airwallex,isAvailable:!0,isLoading:!1,startFlow:L}}),runAirwallexApplePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,customParams:P,formCallbacks:O})=>{const R=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm$2),{overridePaymentRequest:M}=P,D=S.anyCdeConnection,U=await getPrefill(D),C=U.mode==="setup",L=getApplePayPaymentRequest({overridePaymentRequest:M,initialPreview:P.initialPreview,prefill:{...U},defaultLabel:R?.metadata?.processor_account_name}),y=new ApplePaySession(3,L),_={session:y,connection:S.anyCdeConnection,checkoutPaymentMethod:T,nonCdeFormInputs:A,processorAccount:R.metadata,prefill:U,isSetupMode:C,baseUrl:S.baseUrl,formCallbacks:O,defaultFieldValues:P?.defaultFieldValues};return track("apple_pay_flow_started",{processor_name:T.processor_name,prefill:excludeProps(U,["brand"]),overridePaymentRequest:M}),new Promise((N,I)=>{const x=()=>{log__$k("Payment cancelled by user"),I(new Error("Payment cancelled by user"))};y.oncancel=x,y.onvalidatemerchant=async V=>{try{await handleValidateMerchant$1(V,_)}catch(k){I(k)}},y.onpaymentmethodselected=async()=>{const V=await getCheckoutPreviewAmount(D,U.token,C,void 0),k={newTotal:createApplePayTotal({overridePaymentRequest:P.overridePaymentRequest,initialPreview:V,defaultLabel:R?.metadata?.processor_account_name,prefill:U}).total};y.completePaymentMethodSelection(k)},y.onpaymentauthorized=async V=>{track("apple_pay_payment_authorized");try{const k=await handlePaymentAuthorized$1(V,_);N(k)}catch(k){I(k)}},y.begin()}).catch(N=>{throw err__$l("Apple Pay payment error",N),track("apple_pay_payment_error",{error:N}),N})}),{log__:log__$j,err__:err__$k}=createOjsFlowLoggers("awx-google-pay"),initAirwallexGooglePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A={processor:PaymentProcessor.Enum.airwallex,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm$2);if(!P)return A;log__$j("Google Pay CPM",P);const O=P.metadata;if(!O.processor_account_id)return err__$k("No gateway merchant ID found in processor account"),A;if(log__$j("Loading Google Pay script"),await loadGooglePayScript(),!window.google?.payments?.api)return err__$k("Google Pay SDK not loaded properly"),A;if(await getGooglePayEnvironment(S.baseUrl)==="PRODUCTION"&&!O.google_pay_merchant_id)return err__$k("Google Pay merchant ID is required for production environment"),A;log__$j("Google Pay SDK loaded",window.google.payments);const M=S.anyCdeConnection,D=await getPrefill(M),U=D.mode==="setup",C=await getCheckoutPreviewAmount(M,D.token,U,void 0);try{const y=getPaymentDataRequest({prefill:D,gateway:"airwallex",gatewayMerchantId:O.processor_account_id,merchantName:O.processor_account_name,merchantId:O.google_pay_merchant_id??"",initialPreview:C}),_=await getGooglePaymentsClient(S.baseUrl,y),{result:N}=await _.isReadyToPay(y);if(!N)return log__$j("Google Pay is not available for this user"),A}catch(y){return err__$k("Error checking Google Pay availability",y),A}const L=async y=>{try{OjsFlows.airwallexGooglePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:{...y,initialPreview:C}})}catch(_){err__$k("Google Pay payment error",_),T.get.onCheckoutError(_?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.airwallex,isAvailable:!0,isLoading:!1,startFlow:L}}),runAirwallexGooglePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$j("Starting Google Pay flow...");const R=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm$2),{overridePaymentRequest:M}=O,D=R.metadata;if(!D.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const U=S.anyCdeConnection,C=await getPrefill(U),L=C.mode==="setup",y=await getCheckoutPreviewAmount(U,C.token,L,void 0),_=getPaymentDataRequest({prefill:C,gateway:"airwallex",gatewayMerchantId:D.processor_account_id,merchantName:D.processor_account_name,merchantId:D.google_pay_merchant_id??"",initialPreview:y,overridePaymentRequest:M});track("google_pay_flow_started",{processor_name:R.processor_name,prefill:excludeProps(C,["brand"]),overridePaymentRequest:M});const N=await getGooglePaymentsClient(S.baseUrl,_);try{const I=await N.loadPaymentData(_);log__$j("Google Pay Payment data",I);const x=fillEmptyFormInputsWithGooglePay(A,I),V=validateNonCdeFormFieldsForCC(x,P.get.onValidationError,O?.defaultFieldValues);log__$j("___",V),track("billing_details_received",{...V});const k=I.paymentMethodData?.tokenizationData?.token;if(!k)throw new Error("No payment token received from Google Pay");const F=await startPaymentFlow(U,{payment_provider:T.provider,checkout_payment_method:T,...createCustomerFieldsFromForm(V,C.checkout_settings)}),W=parseAirwallexStartPaymentFlowResponse(F);log__$j("Start flow next actions",W);let ee=await confirmPaymentFlow(U,{secure_token:C.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:W?.consent_id,airwallex_payment_method_data:{type:"googlepay",googlepay:{payment_data_type:"encrypted_payment_token",encrypted_payment_token:k}}}});log__$j("[1st] Confirm payment flow response",ee);let ne=ee.payment_methods?.[0]?.id;const le=ee.required_user_actions?.find(Re=>Re.type==="airwallex_payment_consent");if(le&&le.redirect_url){log__$j("3DS Required, starting verification...",le);const{status:Re}=await start3dsVerification({url:le.redirect_url,baseUrl:S.baseUrl});if(log__$j(`╰ 3DS verification completed [Status: ${Re}]`),Re===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(Re===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed")}if(le&&!ne&&(ee=await confirmPaymentFlow(U,{secure_token:C.token,their_pm_id:le.their_pm_id,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:le.consent_id}}),log__$j("[2nd] Confirm payment flow response",ee),ne=ee.payment_methods?.[0]?.id),!ne)throw new Error("No PM ID found");return performSimpleCheckoutOrSetup({logPrefix:"awx-googlepay",anyCdeConnection:U,checkoutPaymentMethod:T,requiredFormFields:V,confirmResult:ee,usePayFirstFlow:!1})}catch(I){throw err__$k("Google Pay payment error",I),track("google_pay_payment_error",{error:I}),new Error(I?.message??"Unknown error")}}),{log__:log__$i,err__:err__$j}=createOjsFlowLoggers("klarna"),AirwallexKlarnaCpm=objectType({provider:literalType("klarna"),metadata:objectType({}).nullish(),processor_name:literalType("airwallex")}),initAirwallexKlarnaFlow=async({context:S,formCallbacks:T})=>{const A=findCpmMatchingType(S.checkoutPaymentMethods,AirwallexKlarnaCpm);if(!A)throw new Error("Klarna CPM not found in available payment methods");return{isLoading:!1,isAvailable:!0,startFlow:O=>OjsFlows.airwallexKlarna.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:O??{}})}},runAirwallexKlarnaFlow=addBasicCheckoutCallbackHandlers(async({context:S,nonCdeFormInputs:T,checkoutPaymentMethod:A,formCallbacks:P,customParams:O})=>{try{log__$i("Running Klarna flow...",O);const R=S.anyCdeConnection,M=await getPrefill(R),D=!1;log__$i("Verifying CPM...");const U=AirwallexKlarnaCpm.parse(A);log__$i("├ Validating non-CDE form fields");const C=validateNonCdeFormFieldsForCC(T,P.get.onValidationError,{...D?generateAnonymousValues():void 0,...M.checkout_settings}),L=createCustomerFieldsFromForm(C,M.checkout_settings);log__$i("New customer fields",L);const y=await startPaymentFlow(R,{payment_provider:A.provider,checkout_payment_method:A,...createCustomerFieldsFromForm(C,M.checkout_settings)});return console.log("startPaymentFlowResponse",y),performSimpleCheckoutOrSetup({logPrefix:"klarna",anyCdeConnection:R,checkoutPaymentMethod:U,requiredFormFields:C,confirmResult:{payment_methods:[]},usePayFirstFlow:!1})}catch(R){throw err__$j("Klarna payment error",R),track("checkout_error",{payment_method:"klarna",error:R}),new Error(R?.message??"Unknown error")}}),ApplePayCpm=objectType({provider:literalType("apple_pay"),processor_name:literalType("authorize_net"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType()})}),GooglePayCpm=objectType({provider:literalType("google_pay"),processor_name:literalType("authorize_net"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType(),google_pay_merchant_id:stringType().nullish()})});async function handleValidateMerchant(S,T){try{const O=(await preparePaymentFlow(T.connection,{checkout_payment_method:T.checkoutPaymentMethod,processor_specific_metadata:{apple_payment_session:{validation_url:S.validationURL,initiative_context:window.location.hostname,their_account_id:T.processorAccount.processor_account_id}}})).next_action_metadata?.apple_pay_session;if(!O)throw new Error("No session data received from payment flow");T.session.completeMerchantValidation(O),track("apple_pay_complete_merchant_validation",{...O})}catch(A){throw T.session.abort(),A}}async function handlePaymentAuthorized(S,T){try{const A=S.payment,P=fillEmptyFormInputsWithApplePay(T.nonCdeFormInputs,A),O=validateNonCdeFormFieldsForCC(P,T.formCallbacks.get.onValidationError);track("billing_details_received",{...O}),await startPaymentFlow(T.connection,{payment_provider:T.checkoutPaymentMethod.provider,checkout_payment_method:T.checkoutPaymentMethod,...createCustomerFieldsFromForm(O,T.prefill.checkout_settings),customer_language:detectLanguage()});const R={dataDescriptor:"COMMON.APPLE.INAPP.PAYMENT",dataValue:window.btoa(JSON.stringify(A.token.paymentData))},M=await confirmPaymentFlow(T.connection,{secure_token:T.prefill.token,processor_specific_metadata:{payment_provider:T.checkoutPaymentMethod.provider,mobile_wallet_payment_data:R}});if(!M.payment_methods?.[0]?.id)throw new Error("No PM ID found");const U={status:ApplePaySession.STATUS_SUCCESS};return T.session.completePayment(U),performSimpleCheckoutOrSetup({logPrefix:"authnet-applepay",anyCdeConnection:T.connection,checkoutPaymentMethod:T.checkoutPaymentMethod,requiredFormFields:O,confirmResult:M,usePayFirstFlow:!1})}catch(A){const P={status:ApplePaySession.STATUS_FAILURE};throw T.session.completePayment(P),A}}const{log__:log__$h,err__:err__$i}=createOjsFlowLoggers("authnet-applepay"),initAuthnetApplePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A={processor:PaymentProcessor.Enum.authorize_net,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm);if(!P)return A;if(log__$h("Loading Apple Pay script"),await loadApplePayScript(),!window.ApplePaySession||!ApplePaySession.canMakePayments())return log__$h("Apple Pay is not available on this device/browser"),A;if(!await ApplePaySession.canMakePayments())return log__$h("No active cards available for Apple Pay"),A;if(!P.metadata.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const M=S.anyCdeConnection,D=await getPrefill(M),U=D.mode==="setup",C=await getCheckoutPreviewAmount(M,D.token,U,void 0),L=async y=>{try{await OjsFlows.authorizeNetApplePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:{...y,initialPreview:C},initResult:void 0})}catch(_){err__$i("Apple Pay payment error",_),track("apple_pay_payment_error",{error:_}),T.get.onCheckoutError(_?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.authorize_net,isAvailable:!0,isLoading:!1,startFlow:L}}),runAuthnetApplePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,customParams:P,formCallbacks:O})=>{const{initialPreview:R,overridePaymentRequest:M}=P,D=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm),U=S.anyCdeConnection,C=await getPrefill(U),L=C.mode==="setup",y=getApplePayPaymentRequest({overridePaymentRequest:M,initialPreview:R,prefill:C,defaultLabel:D?.metadata?.processor_account_name});track("apple_pay_flow_started",{processor_name:T.processor_name,prefill:C,overridePaymentRequest:M});const _=new ApplePaySession(3,y),N={session:_,connection:S.anyCdeConnection,checkoutPaymentMethod:T,nonCdeFormInputs:A,processorAccount:T.metadata,prefill:C,isSetupMode:L,baseUrl:S.baseUrl,formCallbacks:O};return new Promise((I,x)=>{_.oncancel=()=>{log__$h("Payment cancelled by user"),x(new Error("Payment cancelled by user"))},_.onvalidatemerchant=async V=>{try{await handleValidateMerchant(V,N)}catch(k){x(k)}},_.onpaymentmethodselected=async()=>{const V=await getCheckoutPreviewAmount(U,C.token,L,void 0),k={newTotal:createApplePayTotal({overridePaymentRequest:P.overridePaymentRequest,initialPreview:V,defaultLabel:D?.metadata?.processor_account_name,prefill:C}).total};_.completePaymentMethodSelection(k)},_.onpaymentauthorized=async V=>{track("apple_pay_payment_authorized");try{const k=await handlePaymentAuthorized(V,N);I(k)}catch(k){x(k)}},_.begin()}).catch(I=>{throw err__$i("Apple Pay payment error",I),track("apple_pay_payment_error",{error:I}),I})}),{log__:log__$g,err__:err__$h}=createOjsFlowLoggers("authnet-googlepay"),initAuthnetGooglePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{log__$g("Initializing Authnet GooglePay flow");const A={processor:PaymentProcessor.Enum.authorize_net,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm);if(!P)return A;log__$g("Google Pay CPM",P);const O=P.metadata;if(!O.processor_account_id)return err__$h("No gateway merchant ID found in processor account"),A;if(log__$g("Loading Google Pay script"),await loadGooglePayScript(),!window.google?.payments?.api)return err__$h("Google Pay SDK not loaded properly"),A;log__$g("Google Pay SDK loaded",window.google.payments);const R=S.anyCdeConnection,M=await getPrefill(R),D=M.mode==="setup",U=await getCheckoutPreviewAmount(R,M.token,D,void 0);try{const L=getPaymentDataRequest({prefill:M,gateway:"authorizenet",gatewayMerchantId:O.processor_account_id,merchantName:O.processor_account_name,merchantId:O.google_pay_merchant_id??"",initialPreview:U}),y=await getGooglePaymentsClient(S.baseUrl,L),{result:_}=await y.isReadyToPay(L);if(!_)return log__$g("Google Pay is not available for this user"),A}catch(L){return err__$h("Error checking Google Pay availability",L),A}const C=async L=>{try{OjsFlows.authorizeNetGooglePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:{...L,initialPreview:U}})}catch(y){err__$h("Google Pay payment error",y),track("google_pay_payment_error",{error:y}),T.get.onCheckoutError(y?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.authorize_net,isAvailable:!0,isLoading:!1,startFlow:C}}),runAuthnetGooglePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,nonCdeFormInputs:T,checkoutPaymentMethod:A,formCallbacks:P,customParams:O})=>{const{overridePaymentRequest:R}=O,D=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm).metadata,U=S.anyCdeConnection,C=await getPrefill(U),L=C.mode==="setup",y=await getCheckoutPreviewAmount(U,C.token,L,void 0),_=getPaymentDataRequest({prefill:C,gateway:"authorizenet",gatewayMerchantId:D.processor_account_id,merchantName:D.processor_account_name,merchantId:D.google_pay_merchant_id??"",initialPreview:y,overridePaymentRequest:R});track("google_pay_flow_started",{processor_name:A.processor_name,prefill:C,overridePaymentRequest:R});const N=await getGooglePaymentsClient(S.baseUrl,_);try{const I=await N.loadPaymentData(_);log__$g("Google Pay Payment data",I);const x=fillEmptyFormInputsWithGooglePay(T,I),V=validateNonCdeFormFieldsForCC(x,P.get.onValidationError);track("billing_details_received",{...V});const k=I.paymentMethodData?.tokenizationData?.token;if(!k)throw new Error("No payment token received from Google Pay");const F=await startPaymentFlow(U,{payment_provider:A.provider,checkout_payment_method:A,...createCustomerFieldsFromForm(V,C.checkout_settings),customer_language:detectLanguage()});log__$g("Start payment flow response",F);const W=await confirmPaymentFlow(U,{secure_token:C.token,processor_specific_metadata:{payment_provider:A.provider,mobile_wallet_payment_data:{dataDescriptor:"COMMON.GOOGLE.INAPP.PAYMENT",dataValue:window.btoa(k)}}});if(!W.payment_methods?.[0]?.id)throw new Error("No PM ID found");return performSimpleCheckoutOrSetup({logPrefix:"authnet-googlepay",anyCdeConnection:U,checkoutPaymentMethod:A,requiredFormFields:V,confirmResult:W,usePayFirstFlow:!1})}catch(I){throw err__$h("Google Pay payment error",I),track("google_pay_payment_error",{error:I}),new Error(I?.message??"Unknown error")}}),{log__:log__$f,err__:err__$g}=createOjsFlowLoggers("cybs-frame"),attachDeviceDataCollector=(S,T)=>{const A=document.createElement("iframe");A.name="cardinal_collection_iframe",A.style.display="none",A.style.width="10px",A.style.height="10px";const P=document.createElement("form");P.action=S,P.method="POST",P.target=A.name;const O=document.createElement("input");return O.type="hidden",O.name="JWT",O.value=T,P.appendChild(O),document.body.appendChild(A),document.body.appendChild(P),{form:P,detach:()=>{document.body.removeChild(A),document.body.removeChild(P)}}},runDeviceDataCollection=async S=>new Promise((T,A)=>{const{postUrl:P,accessToken:O}=S,R=new URL(P).origin,{form:M,detach:D}=attachDeviceDataCollector(P,O);log__$f("Attached device data collector");const U=L=>{if(L.origin!==R)return;const y=JSON.parse(L.data);if(log__$f("Received event from device data collector:",y),y.MessageType==="profile.completed"){T(y),C();return}},C=()=>{D(),window.removeEventListener("message",U)};try{window.addEventListener("message",U),log__$f("Attached listener to window"),M.submit(),log__$f("Submitted form")}catch(L){err__$g("Error submitting form:",L),C(),A(L)}}),runPayerAuth=S=>{const{stepUpUrl:T,accessToken:A,merchantData:P,iframe:O,host:R}=S,M=document.createElement("form");M.action=T,M.method="POST",M.target=O.name;const D=document.createElement("input");D.type="hidden",D.name="JWT",D.value=A;const U=document.createElement("input");return U.type="hidden",U.name="MD",U.value=P,M.appendChild(D),M.appendChild(U),R.appendChild(M),M},{log__:log__$e,err__:err__$f}=createOjsFlowLoggers("cybs"),CybersourceActionPayload=objectType({step_up_url:stringType(),access_token:stringType(),dd_url:nullOrUndefOr$1(stringType()),dd_token:nullOrUndefOr$1(stringType()),merchant_data:stringType()}),FRIENDLY_ERR="Unable to process your credit card. Please contact support for assistance.",parseResponseHeaders$1=S=>{const T=CybersourceActionPayload.safeParse(S);if(!T.success)throw err__$f(`Cybersource 3DS is required but user action is malformed. Got: ${JSON.stringify(S)}`),new Error(FRIENDLY_ERR);return T.data},checkIfRequiresCybersource3ds=S=>S.type==="cybersource_payer_auth",handleCybersource3ds=async S=>{const{stepUpUrl:T,accessToken:A,merchantData:P,iframe:O,host:R,cancelButton:M}=S,D=new URL(T).origin;return new Promise(U=>{const C=()=>{log__$e("Cleaning up Cybersource 3DS flow"),M.removeEventListener("click",L),R.remove()},L=()=>{log__$e("Cybersource 3DS cancelled"),U({status:ThreeDSStatus.CANCELLED,cleanup:C})},_=startPolling(O,x=>{log__$e("Cybersource 3DS completed with status:",x),U({status:x.status,cleanup:C}),N()},D,"ping-3ds-status",Ping3DSStatusResponse),N=handleEvents({elements:{host:R,cancelButton:M},pollingInterval:_,resolve:x=>{U({status:x.status,cleanup:C})}});M.addEventListener("click",L),runPayerAuth({stepUpUrl:T,accessToken:A,merchantData:P,iframe:O,host:R}).submit()})},runCybersource3dsFlow=async S=>{const T=parseResponseHeaders$1(S),{step_up_url:A,access_token:P,dd_url:O,dd_token:R,merchant_data:M}=T;if(O&&R){const y=await runDeviceDataCollection({postUrl:O,accessToken:R});log__$e("Device data collection completed with status:",y.Status)}else err__$f("No device data collection URL or token provided");const{host:D,iframe:U,cancelButton:C}=createAndOpenFrame("",{name:"cardinal_auth_iframe"});log__$e("Running Cybersource 3DS flow");const L=await handleCybersource3ds({stepUpUrl:A,accessToken:P,merchantData:M,iframe:U,host:D,cancelButton:C});if(L.cleanup(),L.status===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed");if(L.status===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(L.status===ThreeDSStatus.SUCCESS){log__$e("3DS verification succeeded");return}else assertNever(L.status)},{log__:log__$d,err__:err__$e}=createOjsFlowLoggers("pockyt-cc"),Pockyt3dsErrorResponseHeaders=objectType({"op-pockyt-3ds-url":stringType(),"op-pockyt-txn-no":stringType(),"op-pockyt-ref-no":stringType()}),parseResponseHeaders=S=>{const T=Pockyt3dsErrorResponseHeaders.safeParse(S);if(!T.success){const A="Unable to process your credit card. Please contact support for assistance.",P=`Pockyt 3DS is required but headers are malformed. Got: ${JSON.stringify(S)}`;throw err__$e(P),new Error(A)}return T.data},parseVaultIdFrom3dsHref=S=>{try{const T=new URL(S??"").searchParams.get("vaultId");if(!T)throw new Error("No vault ID found in 3DS verification result");return log__$d(`3DS verification success. [Vault ID: ${T}]`),T}catch(T){const A="Error verifying 3DS verification result.";throw err__$e(A,`Resulting URL: ${S}.
214
- Error: ${getErrorMessage(T)}`),new Error(A)}},parseArgFromHref=(S,T)=>new URL(S).searchParams.get(T),checkIfRequiresPockyt3ds=S=>S?.["op-pockyt-3ds-url"]!==void 0,runPockyt3dsFlow=async(S,T)=>{const A=parseResponseHeaders(T),P=await start3dsVerificationStrict({url:A["op-pockyt-3ds-url"],baseUrl:S});return{existing_cc:{vault_id:parseVaultIdFrom3dsHref(P.href??""),transaction_no:A["op-pockyt-txn-no"],reference_no:A["op-pockyt-ref-no"]}}},{log__:stripeLog__}=createOjsFlowLoggers("stripe-cc"),Stripe3DSMetadataPayload=objectType({stripe_pk:stringType(),client_secret:stringType(),stripe_pm_id:stringType()}),stripeCC3DSFlow=async S=>{track("3ds_stripe_redirect",{...S}),stripeLog__(`├ Using stripe 3DS flow [Client Secret: ${S.client_secret.substring(0,8)}...]`),await launchStripe3DSDialogFlow(S),track("3ds_stripe_complete"),stripeLog__("╰ Stripe 3DS flow completed successfully")},parseUserFEPayload=S=>{const T=Stripe3DSMetadataPayload.safeParse(S);if(!T.success)throw new Error(`Stripe 3DS metadata has unexpected format: ${JSON.stringify(T.error.errors)}`);return{stripe_pk:T.data.stripe_pk,client_secret:T.data.client_secret,stripe_pm_id:T.data.stripe_pm_id}},MAX_CONFIRM_LOOP_ITERATIONS=4,{log__:log__$c,err__:err__$d}=createOjsFlowLoggers("unified-cc"),unsafelyRunUnifiedCcFlow=async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$c("├ Running unified CC flow...",{checkoutPaymentMethod:T});const R=S.anyCdeConnection,M=await getPrefill(R);log__$c(`├ Validating non-CDE form fields [Mode: ${M.mode}]`);const D=validateNonCdeFormFieldsForCC(A,P.get.onValidationError),U={session_id:S.elementsSessionId,checkout_payment_method:T,non_cde_form_fields:D,extra_metadata:{origin:window.location.origin,deviceToken:getDeviceToken()},use_unified_cc_flow:!0,pay_first_flow_cart_info:{line_items:M.line_items,displayed_total_amount_atom:M.amount_total_atom},payment_route_id:O.paymentRouteId};err__$d(O,U),log__$c(`├ Tokenizing card info in Partial PMs [Session: ${S.elementsSessionId}]`);const C=await tokenizeCardOnAllConnections(O.currentCdeConnections,{session_id:S.elementsSessionId});validateTokenizeCardResults(C,P.get.onValidationError);const L=await startPaymentFlowForCC(R,U);if(log__$c("├ startPf result",L),L.checkout_success_response)return returnSuccessResult(M.mode,L);if(!L.checkout_attempt_id)throw new Error("Invalid state: no checkout attempt ID from PF result");return runConfirmLoop({context:S,prefill:M,nonCdeFormInputs:A,commonCheckoutParams:U,anyCdeConnection:R,startPfResult:L,checkoutAttemptId:L.checkout_attempt_id})},runConfirmLoop=async S=>{const{context:T,prefill:A,nonCdeFormInputs:P,commonCheckoutParams:O,anyCdeConnection:R,startPfResult:M,checkoutAttemptId:D}=S;let U=M;for(let C=0;C<MAX_CONFIRM_LOOP_ITERATIONS;C++){log__$c(`├ Running confirm loop iteration ${C}`),track("unified_cc_confirm_loop_iteration",{iteration:C});const{userAction:L}=validatePfResultUserAction(U);try{const y=await runRequiredUserAction(T.baseUrl,L,A,P);O.extra_metadata={...O.extra_metadata,...y.metadataForConfirmStep},log__$c("├ New extra metadata",O.extra_metadata)}catch(y){const _=getErrorMessage(y);err__$d(`├ Error in running user action in iteration ${C}. Continuing to confirm step...`,_),track("unified_cc_user_action_error",{error_message:_,iteration:C})}if(U=await confirmPaymentFlow(R,{secure_token:A.token,checkout_attempt_id:D,processor_specific_metadata:O.extra_metadata}),log__$c(`├ confirmPf result (iteration ${C})`,U),U.checkout_success_response)return returnSuccessResult(A.mode,U)}throw track("unified_cc_unexpected_branch",{secure_token:A.token,checkout_attempt_id:U.checkout_attempt_id,confirmPFResult:U}),new Error("Checkout error, please try another payment method")},runRequiredUserAction=async(S,T,A,P)=>{if(T._unified_cc_action_name==="3DS_REQUIRED"){if(T.type==="stripe_3ds")return await stripeCC3DSFlow(parseUserFEPayload(T)),{metadataForConfirmStep:{}};if(checkIfRequiresAirwallex3ds(T))return{metadataForConfirmStep:{airwallex:await runAirwallex3dsFlow(S,T)}};if(checkIfRequiresAdyen3ds(T))return{metadataForConfirmStep:{adyen:await runAdyen3dsFlow(P[FieldName.COUNTRY],T,A.locale)}};if(checkIfRequiresCybersource3ds(T))return await runCybersource3dsFlow(T),{metadataForConfirmStep:{}};if(checkIfLegacy3DSPath(T))return await commonCC3DSFlow({required_user_actions:[T]},S),{metadataForConfirmStep:{}};throw new Error(`Unhandled 3DS user action: ${JSON.stringify(T)}`)}else throw new Error(`Unknown required user action: ${JSON.stringify(T)}`)},checkIfLegacy3DSPath=S=>{try{return parseCommon3DSNextActionMetadata([S]),!0}catch{return!1}},validatePfResultUserAction=S=>{if(S.required_user_actions){if(S.required_user_actions.length===0)throw new Error("Invalid state: no required user actions");if(S.required_user_actions.length>1)throw new Error("Invalid state: multiple required user actions")}else throw new Error("Invalid state: no required user actions");const T=UserActionFEPayload.safeParse(S.required_user_actions[0]);if(!T.success)throw err__$d("User action raw payload",S.required_user_actions[0]),err__$d("Parsing error",T.error),new Error("Invalid state: schema of user action payload is not valid");return{userAction:T.data}},returnSuccessResult=(S,T)=>{if(S==="setup"){const A=T.cc_pm_id??T.payment_methods?.[0].id;if(!A)throw new Error("Invalid state: no CC PM ID or payment_methods found in PF result");return{mode:"setup",result:{payment_method_id:A}}}else{if(!T.checkout_success_response)throw new Error("Invalid state: no checkout success response from startPF");return{mode:"checkout",result:T.checkout_success_response}}},{log__:log__$b,err__:err__$c}=createOjsFlowLoggers("common-cc");arrayType(objectType({our_existing_pm_id:stringType()})).length(1);const runCommonCcFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$b("├ Running common CC flow...",{checkoutPaymentMethod:T});const R=S.anyCdeConnection,M=await getPrefill(R);track("common_cc_flow_started",{...T,prefill:M});const D=M.final_feature_rollout_settings?.unified_cc??0;log__$b(`├ Unified CC rollout: ${Math.round(D*100)}%`);const U=Math.random(),C=U<D,L={roll:U,unifiedCCRolloutRatio:D,useUnifiedCCFlow:C};if(C)return log__$b(`├ Picked unified CC flow (${U} vs ${D})`),track("unified_cc_flow_picked",L),unsafelyRunUnifiedCcFlow({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O,initResult:void 0});log__$b(`├ Picked legacy CC flow (${U} vs ${D})`),track("legacy_cc_flow_picked",L),log__$b(`├ Validating non-CDE form fields [Mode: ${M.mode}]`);const y=validateNonCdeFormFieldsForCC(A,P.get.onValidationError,M.checkout_settings);track("billing_details_received",{...y});const _={session_id:S.elementsSessionId,checkout_payment_method:T,non_cde_form_fields:y,extra_metadata:{origin:window.location.origin},use_unified_cc_flow:!1,payment_route_id:O.paymentRouteId,customer_language:detectLanguage(),...createCustomerFieldsFromForm(y,M.checkout_settings)};try{log__$b(`├ Tokenizing card info in CDE [Session: ${S.elementsSessionId}]`);const N=await tokenizeCardOnAllConnections(O.currentCdeConnections,{session_id:S.elementsSessionId});if(validateTokenizeCardResults(N,P.get.onValidationError),M.mode==="setup"){log__$b(`├ Setting up payment method in CDE [Token: ${M.token}]`);const I=await setupCheckout(R,_);return log__$b(`╰ Setup completed successfully [PM ID: ${I.payment_method_id}]`),{mode:"setup",result:I}}else{log__$b(`├ Initial checkout flow. Checking out card info in CDE [Session: ${S.elementsSessionId}]`);const I=await checkoutCardElements(R,_);return log__$b("╰ Checkout completed successfully."),{mode:"checkout",result:I}}}catch(N){if(N instanceof CdeError&&N.originalErrorMessage.includes("3DS_REQUIRED")){log__$b("├ Card requires 3DS, starting non-legacy payment flow"),log__$b("Received 3DS error response headers:",N.response.headers),track("3ds_required",{...T,...N.response.headers});const I=N.response.headers??{};"op-existing-cc-pm-id"in I&&(_.existing_cc_pm_id=I["op-existing-cc-pm-id"],log__$b(`├ Existing CC PM ID: ${_.existing_cc_pm_id}`));const x=checkIfRequiresPockyt3ds(N.response.headers);if(x){log__$b("├ Pockyt 3DS case detected. Going through Pockyt 3DS flow.");const le=await runPockyt3dsFlow(S.baseUrl,N.response.headers);_.extra_metadata.pockyt=le}if(checkIfRequiresAirwallex3ds(N.response.headers)){log__$b("├ Airwallex 3DS case detected. Going through Airwallex 3DS flow.");const le=await runAirwallex3dsFlow(S.baseUrl,N.response.headers);_.extra_metadata.airwallex=le}if(checkIfRequiresAdyen3ds(N.response.headers)){log__$b("├ Adyen 3DS case detected. Going through Adyen 3DS flow.");const le=await runAdyen3dsFlow(A[FieldName.COUNTRY],N.response.headers,M.locale);_.extra_metadata.adyen=le}const F=await startPaymentFlowForCC(R,_);log__$b("├ Start payment flow result:",F);const W=F.required_user_actions.find(le=>le.type==="cybersource_payer_auth");if(W){log__$b("├ Cybersource 3DS case detected. Going through Cybersource 3DS flow.");const le=CybersourceActionPayload.parse(W),Re=await runCybersource3dsFlow({...le,_unified_cc_action_name:"",_unified_cc_pccs_id:""});_.extra_metadata.cybersource=Re}const ee=N.response.headers?.["op-should-use-new-flow"]!=="true";!x&&!W?ee?(log__$b("├ Using stripe 3DS flow"),await stripeCC3DSFlow(parseStripe3DSNextActionMetadata(F))):(log__$b("├ Using common 3DS flow"),await commonCC3DSFlow(F,S.baseUrl)):log__$b("├ Pre-start 3DS is successful, other 3DS flows will be skipped.");const ne=F.cc_pm_id;if(M.mode==="setup"){log__$b(`├ Confirming payment flow [cc_pm_id: ${ne}]`);const le=await confirmPaymentFlow(R,{secure_token:M.token,existing_cc_pm_id:ne});log__$b("├ Confirm payment flow result received Result:",le);const Re=parseConfirmPaymentFlowResponse(le);return log__$b(`╰ Setup completed successfully [PM ID: ${Re.payment_method_id}]`),{mode:"setup",result:Re}}else{log__$b(`├ Checking out after 3DS flow [Flow: ${ee?"legacy":"new"}]`);const le=await checkoutCardElements(R,{..._,existing_cc_pm_id:ne,do_not_use_legacy_cc_flow:ee});return log__$b("╰ Checkout completed successfully."),{mode:"checkout",result:le}}}throw err__$c("╰ Error checking out card info in CDE"),err__$c(N),N}}),parseStripe3DSNextActionMetadata=S=>{const T=S.required_user_actions.find(A=>A.type==="stripe_3ds");if(!T)throw new Error("No stripe 3DS action found");return Stripe3DSNextActionMetadata.parse(T)},common3DSActionTypes=["airwallex_payment_consent","adyen"],parseCommon3DSNextActionMetadata=S=>{const T=S.find(A=>common3DSActionTypes.includes(A.type));if(!T)throw new Error("No common 3DS action found");return Common3DSNextActionMetadata.parse(T)},commonCC3DSFlow=async(S,T)=>{const A=parseCommon3DSNextActionMetadata(S.required_user_actions);if(A.redirect_url==="3DS_COMPLETE"){log__$b("├ 3DS flow completed successfully"),track("3ds_complete");return}log__$b(`├ Using common 3DS flow [URL: ${A.redirect_url}]`),track("3ds_redirect",{...A});const{status:P}=await start3dsVerification({url:A.redirect_url,baseUrl:T});if(log__$b(`╰ 3DS verification completed [Status: ${P}]`),P===ThreeDSStatus.CANCELLED)throw track("3ds_cancelled"),new Error("3DS verification cancelled");if(P===ThreeDSStatus.FAILURE)throw track("3ds_failure"),new Error("3DS verification failed");track("common_3ds_completed")},LoopCryptoCpm=objectType({processor_name:literalType("loop"),provider:literalType("crypto"),metadata:objectType({merchant_id:stringType(),entity_id:stringType(),api_token:stringType(),supported_currencies:arrayType(stringType()),environment:stringType()})}),{log__:log__$a,err__:err__$b}=createOjsFlowLoggers("loop-crypto"),initLoopFlow=addErrorCatcherForInit(async({context:S})=>{log__$a("Checking if there are any CPMs for Loop Crypto...");const T=findCpmMatchingType(S.checkoutPaymentMethods,LoopCryptoCpm);log__$a(`checkoutPaymentMethod: ${JSON.stringify(T)}`),log__$a("Starting Loop Crypto flow...");const A=await getPrefill(S.anyCdeConnection),P=A.mode==="setup",O=await preparePaymentFlow(S.anyCdeConnection,{checkout_payment_method:T}),R=await getCheckoutPreviewAmount(S.anyCdeConnection,A.token,P,void 0);if(!P&&!T.metadata.supported_currencies.includes(A.currency))throw Error(`Currency ${A.currency} not enabled for Loop. Enabled currencies: ${T.metadata.supported_currencies}`);if(!O||!O.next_action_metadata)throw Error("Failed to fetch necessary setup data for Loop");const M=O.next_action_metadata;let D=M.authorization_amount,U=M.min_authorization_amount;const C=M.allow_customer_to_choose_auth;let L;P?(L=0,D=Math.max(D,U)):(L=(R?R.amountAtom:A.amount_total_atom)*M.token_price,U=Math.max(U,L),D=Math.max(D,U));const y=L,_=v4(),N={paymentUsdAmount:y,suggestedAuthorizationUsdAmount:D,customerRefId:_,minAuthorizationUsdAmount:U,allowCustomerToChooseAuth:C},I={apiToken:T.metadata.api_token,entityId:T.metadata.entity_id,merchantId:T.metadata.merchant_id,environment:T.metadata.environment};return{isAvailable:!0,widgetProps:N,initLoopConnectProps:I}}),runLoopFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$a("Running Loop flow..."),log__$a("context",S),log__$a("checkoutPaymentMethod",T),log__$a("nonCdeFormInputs",A),log__$a("flowCallbacks",P),log__$a("customParams",O);const R=await getPrefill(S.anyCdeConnection);log__$a(`├ Validating non-CDE form fields [Mode: ${R.mode}]`);const M=validateNonCdeFormFieldsForCC(A,P.get.onValidationError,R.checkout_settings),D=S.anyCdeConnection,U=R.mode!=="setup",C=createCustomerFieldsFromForm(M,R.checkout_settings);if(!O)throw new Error("Checkout failed. Failed to properly submit form data.");if(!O.success)throw track("loop_pay_flow_failure",O),new Error("Checkout failed. Success is not true.");const L=await startPaymentFlow(S.anyCdeConnection,{checkout_payment_method:T,payment_provider:T.provider,...C,use_pay_first_flow:U,pay_first_flow_cart_info:U?{line_items:R.line_items,displayed_total_amount_atom:R.amount_total_atom,promotion_code:M[FieldName.PROMOTION_CODE]}:void 0,customer_language:detectLanguage()}),y=await confirmPaymentFlow(D,{secure_token:R.token,their_pm_id:O.paymentMethod.paymentMethodId,checkout_attempt_id:U?L.checkout_attempt_id:void 0,processor_specific_metadata:{loop_customer:O.customer,loop_payment_method:O.paymentMethod,loop_success:O.success,loop_payin_id:O.payinId}});if(log__$a(`Confirm result: ${y}`),R.mode==="setup"){log__$a("Doing payment setup..."),log__$a("├ Confirm payment flow result received Result:",y);const _=parseConfirmPaymentFlowResponse(y);return log__$a(`╰ Setup completed successfully [PM ID: ${_.payment_method_id}]`),{mode:"setup",result:_}}else{if(log__$a("Doing checkout..."),!y.pay_first_success_response)throw err__$b("Checkout failed, no pay-first success response:",y),new Error("Checkout failed, please try again with another payment method.");return{mode:"checkout",result:y.pay_first_success_response}}}),{log__:log__$9,err__:err__$a}=createOjsFlowLoggers("paypal"),PaypalCpm=objectType({provider:literalType("paypal"),metadata:objectType({client_id:stringType()}),processor_name:literalType("paypal")}),initPaypalFlow=async({context:S,formCallbacks:T})=>{const A=findCpmMatchingType(S.checkoutPaymentMethods,PaypalCpm);if(!A)throw new Error("PayPal CPM not found in available payment methods");return{isLoading:!1,isAvailable:!0,startFlow:()=>OjsFlows.paypal.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:{settings:{}}})}},runPaypalFlow=addBasicCheckoutCallbackHandlers(async({context:S,nonCdeFormInputs:T,checkoutPaymentMethod:A,formCallbacks:P,customParams:O})=>{try{log__$9("Running PayPal flow...");const R=S.anyCdeConnection,M=await getPrefill(R),{isAnonymous:D,useRedirectFlow:U}=O.settings??{};log__$9("Verifying CPM...");const C=PaypalCpm.parse(A);log__$9("├ Validating non-CDE form fields");const L=validateNonCdeFormFieldsForCC(T,P.get.onValidationError,{...D?generateAnonymousValues():void 0,...M.checkout_settings}),y=createCustomerFieldsFromForm(L,M.checkout_settings);log__$9(`Starting payment flow... Mode: ${M.mode}`);const _=v4(),N=!1,I={payment_provider:C.provider,checkout_payment_method:C,use_pay_first_flow:N,pay_first_flow_cart_info:N?{line_items:M.line_items,displayed_total_amount_atom:M.amount_total_atom}:void 0,processor_specific_metadata:{use_paypal_redirect_flow:U,frontend_token_for_redirect_flow:_},...y},x=new URL("/app/pre-action/start/",S.baseUrl).toString(),V=btoa(JSON.stringify(I)),k=new URLSearchParams({st:M.token,r:V}),F=`${x}?${k.toString()}`;if(U)throw log__$9("Starting redirect mode for PayPal..."),window.location.href=F,await sleep(20*1e3),new Error("Paypal flow timed out, please try again with another payment method.");const W=await startPopupWindowVerificationStrict("PayPal",R,_,F);log__$9("Paypal flow result",W);const ee=parseArgFromHref(W.href,"catt"),ne=parseArgFromHref(W.href,"approval_session_id"),le=await confirmPaymentFlow(R,{secure_token:M.token,checkout_attempt_id:N?ee:void 0,their_pm_id:N?ne:void 0});return log__$9("Confirm payment flow result",le),performSimpleCheckoutOrSetup({logPrefix:"paypal",anyCdeConnection:R,checkoutPaymentMethod:C,requiredFormFields:L,confirmResult:le,usePayFirstFlow:N})}catch(R){throw err__$a("PayPal payment error",R),track("checkout_error",{payment_method:"paypal",error:R}),new Error(R?.message??"Unknown error")}}),{log__:log__$8,err__:err__$9}=createOjsFlowLoggers("pockyt-paypal"),PockytPaypalCpm=objectType({processor_name:literalType("pockyt"),provider:literalType("paypal")});arrayType(objectType({paypal_iframe_url:stringType(),verify_token:stringType()})).length(1);const initPockytPaypalFlow=async({context:S,formCallbacks:T})=>{const A=findCpmMatchingType(S.checkoutPaymentMethods,PockytPaypalCpm);if(!A)throw new Error("Pockyt PayPal CPM not found in available payment methods");return{isLoading:!1,isAvailable:!0,startFlow:()=>OjsFlows.pockytPaypal.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:{settings:{}}})}},runPockytPaypalFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$8("Running Pockyt Paypal flow...");const R=S.anyCdeConnection,M=await getPrefill(R);log__$8("Verifying CPM...");const D=PockytPaypalCpm.parse(T);log__$8("├ Validating non-CDE form fields");const U=O?.settings,C=validateNonCdeFormFieldsForCC(A,P.get.onValidationError,U?.defaultFieldValues),L=createCustomerFieldsFromForm(C,M.checkout_settings);log__$8(`Starting payment flow... Mode: ${M.mode}`);const y=v4(),_=M.mode!=="setup",N={payment_provider:D.provider,checkout_payment_method:D,use_pay_first_flow:_,pay_first_flow_cart_info:_?{line_items:M.line_items,displayed_total_amount_atom:M.amount_total_atom}:void 0,processor_specific_metadata:{use_paypal_redirect_flow:!!O?.settings?.useRedirectFlow,frontend_token_for_redirect_flow:y},...L},I=new URL("/app/pre-action/start/",S.baseUrl).toString(),x=btoa(JSON.stringify(N)),V=new URLSearchParams({st:M.token,r:x}),k=`${I}?${V.toString()}`;if(O?.settings?.useRedirectFlow)throw log__$8("Starting redirect mode for PayPal..."),window.location.href=k,await sleep(20*1e3),new Error("Paypal flow timed out, please try again with another payment method.");log__$8("Starting popup mode for PayPal..."),log__$8("Opening paypal iframe...");const F=await startPopupWindowVerificationStrict("PayPal",R,y,k);log__$8("Paypal flow result",F);const W=parseVaultIdFrom3dsHref(F.href),ee=parseArgFromHref(F.href,"catt");if(!ee)throw err__$9("Checkout attempt ID not found in redirect URL:",F.href),new Error("Checkout attempt ID not found in redirect URL");log__$8(`Confirming payment flow using vault ID ${W}`);const ne=await confirmPaymentFlow(R,{secure_token:M.token,their_pm_id:W,checkout_attempt_id:_?ee:void 0});if(log__$8("Confirm payment flow result",ne),M.mode==="setup")return{mode:"setup",result:{payment_method_id:ne.payment_methods[0].id}};if(!ne.pay_first_success_response)throw err__$9("Checkout failed, no pay-first success response:",ne),new Error("Checkout failed, please try again with another payment method.");return{mode:"checkout",result:ne.pay_first_success_response}}),{log__:log__$7,err__:err__$8}=createOjsFlowLoggers("stripe-affirm"),StripeAffirmCpm=objectType({provider:literalType("affirm"),processor_name:literalType("stripe"),metadata:objectType({stripe_pk:stringType()})}),StripeAffirmRequiredUserActions=arrayType(objectType({our_existing_pm_id:stringType().nullish(),client_secret:stringType()})).length(1),initStripeAffirmFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{log__$7("Checking if there are any CPMs for Stripe Affirm...");const A=findCpmMatchingType(S.checkoutPaymentMethods,StripeAffirmCpm);if(!A)return log__$7("No Stripe Affirm CPM found"),{isAvailable:!1,startFlow:async()=>{}};log__$7("Starting stripe affirm flow...");const P=S.anyCdeConnection;return(await getPrefill(P)).mode==="setup"?(log__$7("Setup mode is not supported for Stripe Affirm flow"),{isAvailable:!1,startFlow:async()=>{}}):{isAvailable:!0,startFlow:async D=>{try{return OjsFlows.stripeAffirm.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:D??{},initResult:{isAvailable:!0}})}catch(U){throw err__$8("Error starting Affirm flow:",U),U}}}}),runStripeAffirmFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P})=>{log__$7("Running Stripe Affirm pay-first flow...");const O=S.anyCdeConnection,R=await getPrefill(O);log__$7("Validating form fields...");const M=validateNonCdeFormFieldsForCC(A,P.get.onValidationError);track("billing_details_received",{...M}),log__$7("Creating cart info for pay-first flow...");const D={line_items:R.line_items.map(k=>({price_id:k.price_id,quantity:k.quantity})),promotion_code:M[FieldName.PROMOTION_CODE]||void 0,displayed_total_amount_atom:R.amount_total_atom};log__$7("Starting pay-first payment flow for Affirm...");const U=await startPaymentFlow(O,{payment_provider:T.provider,checkout_payment_method:T,use_pay_first_flow:!0,pay_first_flow_cart_info:D,...createCustomerFieldsFromForm(M,R.checkout_settings),customer_language:detectLanguage()});log__$7("Start payment flow response",U);const C=StripeAffirmRequiredUserActions.parse(U.required_user_actions),{client_secret:L}=C[0];log__$7("Client secret for payment intent",L);const y=findCpmMatchingType(S.checkoutPaymentMethods,StripeAffirmCpm);if(!y)throw new Error("Stripe Affirm CPM not found");const{stripe:_}=await createStripeElements(y.metadata.stripe_pk,{mode:"payment",currency:R.currency??"usd",amount:R.amount_total_atom});log__$7("Stripe instance created",_);const N=generateBillingAddressFromFields(M),I=`${M[FieldName.FIRST_NAME]} ${M[FieldName.LAST_NAME]}`,x={return_url:new URL("/app/3ds/success/",S.baseUrl).toString(),payment_method:{billing_details:{email:M[FieldName.EMAIL],name:I,address:{line1:N.line1,line2:N.line2||void 0,city:N.city,state:N.state,country:N.country,postal_code:N.zip_code}}}},V={handleActions:!1};log__$7(`Confirming Affirm payment with client secret: ${L}`);try{const{error:k,paymentIntent:F}=await _.confirmAffirmPayment(L,x,V);if(k)throw err__$8("Affirm payment confirmation error:",k),new Error(`Affirm payment failed: ${k.message}`);log__$7("Affirm payment confirmed successfully",F);const W=F?.next_action?.redirect_to_url?.url;if(!W)return err__$8("No redirect URL found in Klarna payment confirmation"),P.get.onCheckoutError("Klarna payment failed"),{mode:"checkout",result:{invoice_urls:[],subscription_ids:[],customer_id:"",payment_method_id:""}};log__$7("Payment requires additional action, starting 3DS verification...");const{status:ee}=await start3dsVerification({url:W,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"Affirm verification"});if(ee===ThreeDSStatus.FAILURE)throw new Error("Verification failed");if(ee===ThreeDSStatus.CANCELLED)throw new Error("Verification cancelled");log__$7("3DS verification completed successfully");const ne=F?.payment_method?.toString()??void 0,le=await confirmPaymentFlow(O,{secure_token:R.token,checkout_attempt_id:U.checkout_attempt_id,their_pm_id:ne});return log__$7("Payment flow confirmed",le),performSimpleCheckoutOrSetup({logPrefix:"stripe-affirm",anyCdeConnection:O,checkoutPaymentMethod:T,requiredFormFields:M,confirmResult:le,usePayFirstFlow:!0})}catch(k){throw err__$8("Error in Affirm payment flow:",k),k}}),{log__:log__$6,err__:err__$7}=createOjsFlowLoggers("stripe-afterpay"),StripeAfterpayCpm=objectType({provider:literalType("afterpay"),processor_name:literalType("stripe"),metadata:objectType({stripe_pk:stringType()})}),StripeAfterpayRequiredUserActions=arrayType(objectType({our_existing_pm_id:stringType().nullish(),client_secret:stringType()})).length(1),initStripeAfterpayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{log__$6("Checking if there are any CPMs for Stripe Afterpay...");const A=findCpmMatchingType(S.checkoutPaymentMethods,StripeAfterpayCpm);if(!A)return log__$6("No Stripe Afterpay CPM found"),{isAvailable:!1,startFlow:async()=>{}};log__$6("Starting stripe afterpay flow...");const P=S.anyCdeConnection;return(await getPrefill(P)).mode==="setup"?(log__$6("Setup mode not supported for Stripe Afterpay flow"),{isAvailable:!1,startFlow:async()=>{}}):{isAvailable:!0,startFlow:async D=>{try{return OjsFlows.stripeAfterpay.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:D??{},initResult:{isAvailable:!0}})}catch(U){throw err__$7("Error starting Afterpay flow:",U),U}}}}),runStripeAfterpayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P})=>{log__$6("Running Stripe Afterpay pay-first flow...");const O=S.anyCdeConnection,R=await getPrefill(O);log__$6("Validating form fields...");const M=validateNonCdeFormFieldsForCC(A,P.get.onValidationError);track("billing_details_received",{...M}),log__$6("Creating cart info for pay-first flow...");const D={line_items:R.line_items.map(k=>({price_id:k.price_id,quantity:k.quantity})),promotion_code:M[FieldName.PROMOTION_CODE]||void 0,displayed_total_amount_atom:R.amount_total_atom};log__$6("Starting pay-first payment flow for Afterpay...");const U=await startPaymentFlow(O,{payment_provider:T.provider,checkout_payment_method:T,use_pay_first_flow:!0,pay_first_flow_cart_info:D,...createCustomerFieldsFromForm(M,R.checkout_settings),customer_language:detectLanguage()});log__$6("Start payment flow response",U);const C=StripeAfterpayRequiredUserActions.parse(U.required_user_actions),{client_secret:L}=C[0];log__$6("Client secret for payment intent",L);const y=findCpmMatchingType(S.checkoutPaymentMethods,StripeAfterpayCpm);if(!y)throw new Error("Stripe Afterpay CPM not found");const{stripe:_}=await createStripeElements(y.metadata.stripe_pk,{mode:"payment",currency:R.currency??"usd",amount:R.amount_total_atom});log__$6("Stripe instance created",_);const N=generateBillingAddressFromFields(M),I=`${M[FieldName.FIRST_NAME]} ${M[FieldName.LAST_NAME]}`,x={return_url:new URL("/app/3ds/success/",S.baseUrl).toString(),payment_method:{billing_details:{email:M[FieldName.EMAIL],name:I,address:{line1:N.line1,line2:N.line2||void 0,city:N.city,state:N.state,country:N.country,postal_code:N.zip_code}}}},V={handleActions:!1};log__$6(`Confirming Afterpay payment with client secret: ${L}`);try{const k=await _.confirmAfterpayClearpayPayment(L,x,V);if(log__$6("Afterpay payment confirmation result:",k),k.paymentIntent?.next_action?.type==="redirect_to_url"){const F=k.paymentIntent?.next_action?.redirect_to_url?.url;if(!F)return err__$7("No redirect URL found in Afterpay payment confirmation"),P.get.onCheckoutError("Afterpay payment failed"),{mode:"checkout",result:{invoice_urls:[],subscription_ids:[],customer_id:"",payment_method_id:""}};log__$6("Afterpay verification Required, starting verification...");const{status:W}=await start3dsVerification({url:F,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"Afterpay verification"});if(log__$6(`╰ Afterpay verification completed [Status: ${W}]`),W===ThreeDSStatus.CANCELLED)throw new Error("Afterpay verification cancelled");if(W===ThreeDSStatus.FAILURE)throw new Error("Afterpay verification failed");log__$6("Afterpay verification completed, confirming with backend...");const ee=k.paymentIntent?.payment_method?.toString()??void 0,ne=await confirmPaymentFlow(O,{secure_token:R.token,checkout_attempt_id:U.checkout_attempt_id,their_pm_id:ee});return performSimpleCheckoutOrSetup({logPrefix:"stripe-afterpay",anyCdeConnection:O,checkoutPaymentMethod:T,requiredFormFields:M,confirmResult:ne,usePayFirstFlow:!0})}else throw log__$6("No redirect URL found in Afterpay payment confirmation"),new Error("No redirect URL found in Afterpay payment confirmation")}catch(k){err__$7("Error in Afterpay checkout flow:",k);const F=k instanceof Error?k.message:"Afterpay payment failed";throw new Error(F)}}),{log__:log__$5,err__:err__$6}=createOjsFlowLoggers("stripe-klarna"),StripeKlarnaCpm=objectType({provider:literalType("klarna"),processor_name:literalType("stripe"),metadata:objectType({stripe_pk:stringType()})}),StripeKlarnaRequiredUserActions=arrayType(objectType({our_existing_pm_id:stringType().nullish(),client_secret:stringType()})).length(1),initStripeKlarnaFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{log__$5("Checking if there are any CPMs for Stripe Klarna...");const A=findCpmMatchingType(S.checkoutPaymentMethods,StripeKlarnaCpm);if(!A)return log__$5("No Stripe Klarna CPM found"),{isAvailable:!1,startFlow:async()=>{}};log__$5("Starting stripe klarna flow...");const P=S.anyCdeConnection;return(await getPrefill(P)).mode==="setup"?(log__$5("Setup mode is not supported for Stripe Klarna flow"),{isAvailable:!1,startFlow:async()=>{}}):{isAvailable:!0,startFlow:async D=>{try{return OjsFlows.stripeKlarna.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:D??{},initResult:{isAvailable:!0}})}catch(U){throw err__$6("Error starting Klarna flow:",U),U}}}}),runStripeKlarnaFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P})=>{log__$5("Running Stripe Klarna pay-first flow...");const O=S.anyCdeConnection,R=await getPrefill(O);log__$5("Validating form fields...");const M=validateNonCdeFormFieldsForCC(A,P.get.onValidationError);track("billing_details_received",{...M}),log__$5("Creating cart info for pay-first flow...");const D={line_items:R.line_items.map(k=>({price_id:k.price_id,quantity:k.quantity})),promotion_code:M[FieldName.PROMOTION_CODE]||void 0,displayed_total_amount_atom:R.amount_total_atom};log__$5("Starting pay-first payment flow for Klarna...");const U=await startPaymentFlow(O,{payment_provider:T.provider,checkout_payment_method:T,use_pay_first_flow:!0,pay_first_flow_cart_info:D,...createCustomerFieldsFromForm(M,R.checkout_settings),customer_language:detectLanguage()});log__$5("Start payment flow response",U);const C=StripeKlarnaRequiredUserActions.parse(U.required_user_actions),{client_secret:L}=C[0];log__$5("Client secret for payment intent",L);const y=findCpmMatchingType(S.checkoutPaymentMethods,StripeKlarnaCpm);if(!y)throw new Error("Stripe Klarna CPM not found");const{stripe:_}=await createStripeElements(y.metadata.stripe_pk,{mode:"payment",currency:R.currency??"usd",amount:R.amount_total_atom});log__$5("Stripe instance created",_);const N=generateBillingAddressFromFields(M),I=`${M[FieldName.FIRST_NAME]} ${M[FieldName.LAST_NAME]}`,x={return_url:new URL("/app/3ds/success/",S.baseUrl).toString(),payment_method:{billing_details:{email:M[FieldName.EMAIL],name:I,address:{line1:N.line1,line2:N.line2||void 0,city:N.city,state:N.state,country:N.country,postal_code:N.zip_code}}}},V={handleActions:!1};log__$5(`Confirming Klarna payment with client secret: ${L}`);try{const k=await _.confirmKlarnaPayment(L,x,V);if(log__$5("Klarna payment confirmation result:",k),k.paymentIntent?.next_action?.type==="redirect_to_url"){const F=k.paymentIntent?.next_action?.redirect_to_url?.url;if(!F)return err__$6("No redirect URL found in Klarna payment confirmation"),P.get.onCheckoutError("Klarna payment failed"),{mode:"checkout",result:{invoice_urls:[],subscription_ids:[],customer_id:"",payment_method_id:""}};log__$5("Klarna verification Required, starting verification...");const{status:W}=await start3dsVerification({url:F,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"Klarna verification"});if(log__$5(`╰ Klarna verification completed [Status: ${W}]`),W===ThreeDSStatus.CANCELLED)throw new Error("Klarna verification cancelled");if(W===ThreeDSStatus.FAILURE)throw new Error("Klarna verification failed");log__$5("Klarna verification completed, confirming with backend...");const ee=k.paymentIntent?.payment_method?.toString()??void 0,ne=await confirmPaymentFlow(O,{secure_token:R.token,checkout_attempt_id:U.checkout_attempt_id,their_pm_id:ee});return performSimpleCheckoutOrSetup({logPrefix:"stripe-klarna",anyCdeConnection:O,checkoutPaymentMethod:T,requiredFormFields:M,confirmResult:ne,usePayFirstFlow:!0})}else throw log__$5("No redirect URL found in Klarna payment confirmation"),new Error("No redirect URL found in Klarna payment confirmation")}catch(k){err__$6("Error in Klarna checkout flow:",k);const F=k instanceof Error?k.message:"Klarna payment failed";throw new Error(F)}}),OJS_STRIPE_LINK_BTN_ID="ojs-stripe-link-btn",{log__:log__$4,err__:err__$5}=createOjsFlowLoggers("stripe-link"),StripeLinkCpm=objectType({provider:literalType("stripe_link"),processor_name:literalType("stripe"),metadata:objectType({stripe_pk:stringType()})}),StripeLinkRequiredUserActions=arrayType(objectType({our_existing_pm_id:stringType()})).length(1),initStripeLinkFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A=S.customInitParams.stripeLink;log__$4("Checking if there are any CPMs for Stripe Link...");const P=findCpmMatchingType(S.checkoutPaymentMethods,StripeLinkCpm);log__$4("Starting stripe link flow...");const O=S.anyCdeConnection,R=await getPrefill(O),M=R.mode==="setup";log__$4("Creating stripe elements...");const D=await getCheckoutPreviewAmount(O,R.token,M,void 0),{elements:U,stripe:C}=await createStripeElements(P.metadata.stripe_pk,{mode:"setup",currency:D.currency,setup_future_usage:"off_session",paymentMethodCreation:"manual"}),L=U.create("linkAuthentication");log__$4("Creating express checkout...");const y=U.create("expressCheckout",{buttonHeight:A?.buttonHeight,paymentMethods:{amazonPay:"never",applePay:"never",googlePay:"never",paypal:"never"}}),_=(x,V)=>{let k=document.querySelector(x);k||(err__$5(`Recommanded to render a container with ${x} to avoid rendering in the body`),k=document.body);const F=document.createElement("div");k?.appendChild(F),L.mount(F);let W=!1,ee=!1;if(L.once("ready",()=>{ee=!0,A?.onAuthenticationElementReady?.()}),V){F.style.visibility="hidden",F.style.position="absolute",F.style.top="-1000px",F.style.left="-1000px",F.style.zIndex="-1",L.on("change",le=>{W=le.complete||!!le.value.email,ee&&A?.onAuthenticationStatusChange?.(W)});const ne=F.querySelector("iframe");ne&&new MutationObserver(()=>{const Qe=ne.offsetHeight>160;ee&&A?.onAuthenticationStatusChange?.(W||Qe)}).observe(ne,{attributes:!0,attributeFilter:["style"]})}return L},N=x=>{y.mount(x||`#${OJS_STRIPE_LINK_BTN_ID}`)},I=()=>{y.unmount()};return A?.doNotMountOnInit?log__$4("NOT mounting stripe link button (doNotMountOnInit is true)"):(log__$4("Mounting stripe link button..."),N()),A?.silentlyCheckAuthentication&&(log__$4(`Silently mounting link authentication element at #${OJS_STRIPE_LINK_BTN_ID}...`),_(`#${OJS_STRIPE_LINK_BTN_ID}`,!0)),y.on("click",async x=>{if(log__$4("Stripe Link button clicked"),A?.overrideLinkSubmit&&!await A.overrideLinkSubmit()){log__$4("Stripe Link submit aborted by overrideLinkSubmit");return}x.resolve()}),y.on("confirm",async x=>{log__$4("Stripe Link window confirmed",x);const V=await C.createPaymentMethod({elements:U,params:{billing_details:x.billingDetails}});V.error?(err__$5("error",V.error),T.get.onCheckoutError(V.error.message??"Stripe Link unknown error")):(log__$4("paymentMethod",V.paymentMethod),OjsFlows.stripeLink.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:{stripePM:V.paymentMethod},initResult:{isAvailable:!0}}))}),{isAvailable:!0,controller:{mountButton:N,dismountButton:I,mountLinkAuthenticationElement:x=>_(x,!1),waitForButtonToMount:async()=>await getElementByIdAsync(OJS_STRIPE_LINK_BTN_ID)}}}),runStripeLinkFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$4("Running Stripe Link flow...");const R=S.anyCdeConnection,M=await getPrefill(R);log__$4("Merging PM fields with form fields...");const D=fillEmptyFormInputsWithStripePM(A,O.stripePM),U=validateNonCdeFormFieldsForCC(D,P.get.onValidationError);track("billing_details_received",{...U}),log__$4("Starting payment flow...");const C=await startPaymentFlow(R,{payment_provider:T.provider,checkout_payment_method:T,their_existing_pm_id:O.stripePM.id,...createCustomerFieldsFromForm(U,M.checkout_settings),customer_language:detectLanguage()});log__$4("Start payment flow response",C);const y=StripeLinkRequiredUserActions.parse(C.required_user_actions)[0].our_existing_pm_id;if(M.mode==="setup"){log__$4("Doing payment setup...");const _=await confirmPaymentFlow(R,{secure_token:M.token,existing_cc_pm_id:y});return{mode:"setup",result:parseConfirmPaymentFlowResponse(_)}}else{log__$4("Doing checkout...");const _={secure_token:M.token,payment_input:{provider_type:T.provider},customer_email:U[FieldName.EMAIL],customer_first_name:U[FieldName.FIRST_NAME],customer_last_name:U[FieldName.LAST_NAME],customer_address:generateBillingAddressFromFields(U),customer_shipping_address:generateShippingAddressFromFields(U,M.checkout_settings),promotion_code:U[FieldName.PROMOTION_CODE],line_items:M.line_items,total_amount_atom:M.amount_total_atom,cancel_at_end:!1,checkout_payment_method:T};return{mode:"checkout",result:await performCheckout(R,_)}}}),fillEmptyFormInputsWithStripePM=(S,T)=>{const A={...S},[P,...O]=T.billing_details.name?.trim()?.split(/\s+/)??[],R=O.join(" ")||void 0;A[FieldName.EMAIL]=A[FieldName.EMAIL]||T.link?.email||T.billing_details.email||"op_unfilled@getopenpay.com",A[FieldName.ZIP_CODE]=A[FieldName.ZIP_CODE]||T.billing_details.address?.postal_code||"00000",A[FieldName.COUNTRY]=A[FieldName.COUNTRY]||T.billing_details.address?.country||"US";const M=A[FieldName.FIRST_NAME]||P||"",D=A[FieldName.LAST_NAME]||R||"";return M||D?(A[FieldName.FIRST_NAME]=M,A[FieldName.LAST_NAME]=D):(A[FieldName.FIRST_NAME]="_OP_UNKNOWN",A[FieldName.LAST_NAME]=""),log__$4("Final form inputs:",A),A},getElementByIdAsync=S=>new Promise(T=>{const A=()=>{const P=document.getElementById(S);P?T(P):requestAnimationFrame(A)};A()}),{log__:log__$3,err__:err__$4}=createOjsFlowLoggers("stripe-pr"),StripePrCpm=objectType({provider:unionType([literalType("apple_pay"),literalType("google_pay")]),processor_name:literalType("stripe"),metadata:objectType({stripe_pk:stringType()})}),initStripePrFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{log__$3("Checking if there are any CPMs for Stripe PR...");const A=findCpmMatchingType(S.checkoutPaymentMethods,StripePrCpm);log__$3("Initializing Stripe PR flow...");const P=S.anyCdeConnection,O=await getPrefill(P),R=O.mode==="setup";log__$3("Getting initial preview amount");const M=await getCheckoutPreviewAmount(P,O.token,R,void 0),D=await createStripePaymentRequest(A.metadata.stripe_pk,M.amountAtom,M.currency,R);log__$3("Checking if can make payment");const U=await D.canMakePayment();if(U===null)return err__$4("canMakePayment returned null"),{isAvailable:!1,reason:"canMakePayment returned null"};log__$3("Stripe PR flow initialized successfully. Can make payment",U);const C=(L,y)=>OjsFlows.stripePR.run({context:S,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(S.checkoutPaymentMethods,L),nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:{provider:L,overridePaymentRequest:y?.overridePaymentRequest},initResult:{processor:PaymentProcessor.Enum.stripe,pr:D,isAvailable:!0,availableProviders:{applePay:U.applePay,googlePay:U.googlePay},startFlow:C}});return{processor:PaymentProcessor.Enum.stripe,isAvailable:!0,pr:D,availableProviders:{applePay:U.applePay,googlePay:U.googlePay},startFlow:C}}),runStripePrFlow$1=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O,initResult:R})=>{if(log__$3("Running Stripe PR flow..."),O.provider!==T.provider)throw new Error(`Provider mismatch. Expected ${O.provider}, got ${T.provider}`);const M=S.anyCdeConnection,D=R.pr;if(O?.overridePaymentRequest){const I=O.overridePaymentRequest;log__$3("Overriding PR amount with",I);const x=typeof I.applePayPaymentRequest=="function"?I.applePayPaymentRequest({}):I.applePayPaymentRequest;updatePrWithAmount(D,I.amount,I.pending,x,I.label)}const U=await getPrefill(M);if(!O.overridePaymentRequest){const I=U.mode==="setup";getCheckoutPreviewAmount(M,U.token,I,void 0).then(x=>{D.isShowing()||updatePrWithAmount(D,x,!1,void 0,"Total")})}log__$3("Showing PR dialog..."),D.show();const C=await waitForUserToAddPaymentMethod(D);log__$3("Stripe PM added event:",C),log__$3("Merging PM fields with form fields...");const L=fillEmptyFormInputsWithStripePm(A,C),y=validateNonCdeFormFieldsForCC(L,P.get.onValidationError);track("billing_details_received",{...y}),log__$3("PR dialog finished. Starting p ayment flow...",y);const _=await startPaymentFlowForPR(M,{fields:y,checkoutPaymentMethod:T}),N=parsePRNextActionMetadata(_);if(log__$3("Confirming PR with Stripe..."),await confirmStripePrPM(N,C),U.mode==="setup"){log__$3("Confirming payment flow for setup...");const I=await confirmPaymentFlow(M,{secure_token:U.token});return{mode:"setup",result:parseConfirmPaymentFlowResponse(I)}}else{log__$3("Performing checkout...");const I={secure_token:U.token,payment_input:{provider_type:T.provider},customer_first_name:y[FieldName.FIRST_NAME],customer_last_name:y[FieldName.LAST_NAME],customer_email:y[FieldName.EMAIL],customer_address:generateBillingAddressFromFields(y),customer_shipping_address:generateShippingAddressFromFields(y,U.checkout_settings),promotion_code:y[FieldName.PROMOTION_CODE],line_items:U.line_items,total_amount_atom:U.amount_total_atom,cancel_at_end:!1,checkout_payment_method:T};return{mode:"checkout",result:await performCheckout(M,I)}}}),fillEmptyFormInputsWithStripePm=(S,T)=>{const A={...S},[P,...O]=T.payerName?.trim()?.split(/\s+/)??[],R=O.join(" ")||void 0,M=T.paymentMethod?.billing_details?.address,D=T.shippingAddress;A[FieldName.EMAIL]=A[FieldName.EMAIL]||T.payerEmail||"op_unfilled@getopenpay.com",A[FieldName.ZIP_CODE]=A[FieldName.ZIP_CODE]||M?.postal_code||D?.postalCode||"00000",A[FieldName.COUNTRY]=A[FieldName.COUNTRY]||M?.country||D?.country||"US";const U=A[FieldName.FIRST_NAME]||P||"",C=A[FieldName.LAST_NAME]||R||"";return U||C?(A[FieldName.FIRST_NAME]=U,A[FieldName.LAST_NAME]=C):(A[FieldName.FIRST_NAME]="_OP_UNKNOWN",A[FieldName.LAST_NAME]=""),log__$3("Final form inputs:",A),A},updatePrWithAmount=(S,T,A,P,O)=>{S.update({total:T?{amount:T.amountAtom,label:O??"Total",pending:A}:void 0,currency:T?.currency,applePay:P})},parsePRNextActionMetadata=S=>{if(S.required_user_actions.length!==1)throw new Error(`Error occurred.
215
- Details: got ${S.required_user_actions.length} required user actions`);return PaymentRequestNextActionMetadata.parse(S.required_user_actions[0])},findCheckoutPaymentMethodStrict=(S,T,A)=>{const P=S.filter(O=>{const R=A===void 0?!0:O.processor_name===A,M=O.provider===T;return R&&M});if(P.length===0)throw console.warn("CPMs list",S),new Error(`No CPMs found with provider '${T}' and processor '${A}'`);return P.length!==1&&(console.warn("CPMs list",S),console.warn(`More than one CPM found with provider '${T}' and processor '${A}'`),track("more_than_one_cpm_found",{provider:T,processor:A,cpms:S})),P[0]},OjsFlows={commonCC:{init:async()=>{},run:runCommonCcFlow},stripePR:{init:initStripePrFlow,run:runStripePrFlow$1},stripeLink:{init:initStripeLinkFlow,run:runStripeLinkFlow},stripeKlarna:{init:initStripeKlarnaFlow,run:runStripeKlarnaFlow},stripeAffirm:{init:initStripeAffirmFlow,run:runStripeAffirmFlow},stripeAfterpay:{init:initStripeAfterpayFlow,run:runStripeAfterpayFlow},pockytPaypal:{init:initPockytPaypalFlow,run:runPockytPaypalFlow},paypal:{init:initPaypalFlow,run:runPaypalFlow},airwallexKlarna:{init:initAirwallexKlarnaFlow,run:runAirwallexKlarnaFlow},airwallexGooglePay:{init:initAirwallexGooglePayFlow,run:runAirwallexGooglePayFlow},airwallexApplePay:{init:initAirwallexApplePayFlow,run:runAirwallexApplePayFlow},airwallexACH:{init:async()=>{},run:runAirwallexACHFlow},airwallexEFT:{init:async()=>{},run:runAirwallexEFTFlow},airwallexBACS:{init:async()=>{},run:runAirwallexBACSFlow},airwallexSEPA:{init:async()=>{},run:runAirwallexSEPAFlow},loopCrypto:{init:initLoopFlow,run:runLoopFlow},authorizeNetApplePay:{init:initAuthnetApplePayFlow,run:runAuthnetApplePayFlow},authorizeNetGooglePay:{init:initAuthnetGooglePayFlow,run:runAuthnetGooglePayFlow},adyenGooglePay:{init:initAdyenGooglePayFlow,run:runAdyenGooglePayFlow},adyenApplePay:{init:initAdyenApplePayFlow,run:runAdyenApplePayFlow}},{log__:log__$2,err__:err__$3}=createOjsFlowLoggers("init-flows"),createInitFlowPublisher=(S,T)=>{const A=new LoadedOncePublisher;return{publisher:A,initialize:async P=>{try{if(A.current.isSuccess)throw new Error("This flow has already been initialized.");const O=await T(P);log__$2(`✔ ${S} flow initialized successfully. Result:`,O),A.set(O)}catch(O){err__$3(`𝙭 ${S} flow initialization failed. Error:`,getErrorMessage(O),"Details:",O),A.throw(O,getErrorMessage(O))}}}},startAllInitFlows=async(S,T,A)=>{await Promise.all(Object.values(S).map(P=>P.initialize({context:T,formCallbacks:A})))},createInitFlowsPublishers=()=>({stripePR:createInitFlowPublisher("Stripe PR",OjsFlows.stripePR.init),stripeLink:createInitFlowPublisher("Stripe Link",OjsFlows.stripeLink.init),stripeKlarna:createInitFlowPublisher("Stripe Klarna",OjsFlows.stripeKlarna.init),stripeAffirm:createInitFlowPublisher("Stripe Affirm",OjsFlows.stripeAffirm.init),stripeAfterpay:createInitFlowPublisher("Stripe Afterpay",OjsFlows.stripeAfterpay.init),airwallexGooglePay:createInitFlowPublisher("Airwallex GooglePay",OjsFlows.airwallexGooglePay.init),airwallexApplePay:createInitFlowPublisher("Airwallex ApplePay",OjsFlows.airwallexApplePay.init),loop:createInitFlowPublisher("Loop",OjsFlows.loopCrypto.init),paypal:createInitFlowPublisher("PayPal",OjsFlows.paypal.init),airwallexKlarna:createInitFlowPublisher("Klarna",OjsFlows.airwallexKlarna.init),pockytPaypal:createInitFlowPublisher("Pockyt PayPal",OjsFlows.pockytPaypal.init),authorizeNetGooglePay:createInitFlowPublisher("Authnet GooglePay",OjsFlows.authorizeNetGooglePay.init),authorizeNetApplePay:createInitFlowPublisher("Authnet ApplePay",OjsFlows.authorizeNetApplePay.init),adyenGooglePay:createInitFlowPublisher("Adyen GooglePay",OjsFlows.adyenGooglePay.init),adyenApplePay:createInitFlowPublisher("Adyen ApplePay",OjsFlows.adyenApplePay.init)}),{err__:err__$2}=createOjsFlowLoggers("form-callbacks"),OptionalFn=functionType().optional(),ZodFormCallbacks=objectType({onFocus:OptionalFn,onBlur:OptionalFn,onChange:OptionalFn,onLoad:OptionalFn,onLoadError:OptionalFn,onValidationError:OptionalFn,onCheckoutStarted:OptionalFn,onCheckoutSuccess:OptionalFn,onSetupPaymentMethodSuccess:OptionalFn,onCheckoutError:OptionalFn,onPaymentRequestLoad:OptionalFn}),Ye=class Ye{constructor(){this.setCallbacks=T=>{this._callbacks=Ye.createEmptyCallbacks(),Object.entries(T).forEach(([A,P])=>{const O=makeCallbackSafe(A,P??Ye.NOOP,err__$2);this._callbacks[A]=O})},this._callbacks=Ye.createEmptyCallbacks()}get get(){return{...this._callbacks}}};Ye.NOOP=()=>{},Ye.createEmptyCallbacks=()=>{const T={};return Object.keys(ZodFormCallbacks.keyof().enum).forEach(A=>{T[A]=Ye.NOOP}),T},Ye.fromObject=T=>{const A=new Ye;return A.setCallbacks(ZodFormCallbacks.parse(T)),A};let FormCallbacks=Ye;function detectFramework(){try{const S=getWindowSafe(),T=S;if(T?.next||T?.__NEXT_DATA__||document.querySelector("#__next"))return"nextjs";if(S?.__NUXT__||document.querySelector("#__nuxt"))return"nuxt";if(Object.keys(document).find(O=>O.includes("react"))||Array.from(document.body.querySelectorAll("body > *")).find(O=>O._reactRootContainer))return"react";const P=S;return P?.Vue||P?.__VUE__?"vue":document.querySelector("[ng-version]")?"angular":"vanilla"}catch{return"unknown"}}function getFrameworkVersion(S){try{switch(S){case"react":return null;case"nextjs":{const A=getWindowSafe();return A?.next?.version||A?.__NEXT_DATA__?.buildId||null}case"nuxt":return null;case"vue":return null;case"angular":{const A=getWindowSafe()?.document?.querySelector("[ng-version]");return A?A.getAttribute("ng-version"):null}default:return null}}catch{return null}}function getFrameworkInfo(){const S=detectFramework(),T=getFrameworkVersion(S);return{framework:S,version:T}}const getFraudMetadata=()=>{const S=window&&window.screen?window.screen.height:null,T=window&&window.screen?window.screen.width:null,A=window&&window.screen?window.screen.colorDepth:null,P=window&&window.navigator?window.navigator.javaEnabled():!1,O=window&&window.navigator?window.navigator.userAgent:null,R="text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";let M=null;window&&window.navigator&&(M=window.navigator.language?window.navigator.language:window.navigator.browserLanguage);const D=new Date().getTimezoneOffset();return{color_depth:A,java_enabled:P,javascript_enabled:!0,language:M,screen_height:S,screen_width:T,time_zone_offset:D,user_agent:O,accept_header:R}};var SubmitMethods=(S=>(S.card="card",S.pockytPaypal="pockyt-paypal",S.applePay="apple-pay",S.googlePay="google-pay",S.loopCrypto="loop-crypto",S.paypal="paypal",S.klarna="klarna",S.affirm="affirm",S.afterpay="afterpay",S.stripeLink="stripe-link",S.airwallexGooglePay="airwallex-google-pay",S.airwallexApplePay="airwallex-apple-pay",S.authorizenetGooglePay="authorizenet-google-pay",S.authorizenetApplePay="authorizenet-apple-pay",S.adyenGooglePay="adyen-google-pay",S.adyenApplePay="adyen-apple-pay",S.airwallexACH="airwallex-ach",S.airwallexEFT="airwallex-eft",S.airwallexBACS="airwallex-bacs",S.airwallexSEPA="airwallex-sepa",S))(SubmitMethods||{});nativeEnumType(SubmitMethods);var PaymentProviderType=(S=>(S.ACH="ach",S.EFT="eft",S.BACS="bacs",S.SEPA="sepa",S.APPLE_PAY="apple_pay",S.CREDIT_CARD="credit_card",S.GOOGLE_PAY="google_pay",S.STRIPE_LINK="stripe_link",S.CRYPTO="crypto",S.PAYPAL="paypal",S))(PaymentProviderType||{});const getApplePayProcessors=S=>{const T=[S.airwallexApplePay,S.authorizeNetApplePay,S.adyenApplePay],A=[];T.forEach(O=>{const R=O.publisher.getValueIfLoadedElse(null);R?.isAvailable&&A.push(R)});const P=S.stripePR.publisher.getValueIfLoadedElse(null);return P?.isAvailable&&P.availableProviders.applePay&&A.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.stripe,startFlow:R=>P.startFlow("apple_pay",{overridePaymentRequest:R?.overridePaymentRequest})}),{processors:A.map(O=>O.processor),isAvailable:A.length>0,isLoading:!1,startFlow:O=>startApplePayFlow(A,O)}},getGooglePayProcessors=S=>{const T=[S.airwallexGooglePay,S.authorizeNetGooglePay,S.adyenGooglePay],A=[];T.forEach(O=>{const R=O.publisher.getValueIfLoadedElse(null);R?.isAvailable&&A.push(R)});const P=S.stripePR.publisher.getValueIfLoadedElse(null);return P?.isAvailable&&P.availableProviders.googlePay&&A.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.stripe,startFlow:R=>P.startFlow("google_pay",{overridePaymentRequest:R?.overridePaymentRequest})}),{processors:A.map(O=>O.processor),isAvailable:A.length>0,isLoading:!1,startFlow:O=>startGooglePayFlow(A,O)}},startApplePayFlow=(S,T)=>{if(T?.processor){const P=S.find(O=>O.processor===T.processor);if(P?.isAvailable)return P.startFlow(T);throw new Error(`Specified Apple Pay processor ${T.processor} is not available`)}const A=S.find(P=>P.isAvailable);if(A)return A.startFlow(T);throw new Error("No available Apple Pay processor found")},startGooglePayFlow=(S,T)=>{if(T?.processor){const P=S.find(O=>O.processor===T.processor);if(P?.isAvailable)return P.startFlow(T);throw new Error(`Specified Google Pay processor ${T.processor} is not available`)}const A=S.find(P=>P.isAvailable);if(A)return A.startFlow(T);throw new Error("No available Google Pay processor found")},getKlarnaProcessors=S=>{const T=[],A=S.airwallexKlarna.publisher.getValueIfLoadedElse(null);A?.isAvailable&&T.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.airwallex,startFlow:O=>A.startFlow(O)});const P=S.stripeKlarna.publisher.getValueIfLoadedElse(null);return P?.isAvailable&&T.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.stripe,startFlow:O=>P.startFlow(O)}),{processors:T.map(O=>O.processor),isAvailable:T.length>0,isLoading:!1,startFlow:O=>startKlarnaFlow(T,O)}},startKlarnaFlow=(S,T)=>{if(T?.processor){const P=S.find(O=>O.processor===T.processor);if(P?.isAvailable)return P.startFlow(T);throw new Error(`Specified Klarna processor ${T.processor} is not available`)}const A=S.find(P=>P.isAvailable);if(A)return A.startFlow(T);throw new Error("No available Klarna processor found")},getAffirmProcessors=S=>{const T=[],A=S.stripeAffirm.publisher.getValueIfLoadedElse(null);return A?.isAvailable&&T.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.stripe,startFlow:P=>A.startFlow(P)}),{processors:T.map(P=>P.processor),isAvailable:T.length>0,isLoading:!1,startFlow:P=>startAffirmFlow(T,P)}},startAffirmFlow=(S,T)=>{if(T?.processor){const P=S.find(O=>O.processor===T.processor);if(P?.isAvailable)return P.startFlow(T);throw new Error(`Specified Affirm processor ${T.processor} is not available`)}const A=S.find(P=>P.isAvailable);if(A)return A.startFlow(T);throw new Error("No available Affirm processor found")},getAfterpayProcessors=S=>{const T=[],A=S.stripeAfterpay.publisher.getValueIfLoadedElse(null);return A?.isAvailable&&T.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.stripe,startFlow:P=>A.startFlow(P)}),{processors:T.map(P=>P.processor),isAvailable:T.length>0,isLoading:!1,startFlow:P=>startAfterpayFlow(T,P)}},startAfterpayFlow=(S,T)=>{if(T?.processor){const P=S.find(O=>O.processor===T.processor);if(P?.isAvailable)return P.startFlow(T);throw new Error(`Specified Afterpay processor ${T.processor} is not available`)}const A=S.find(P=>P.isAvailable);if(A)return A.startFlow(T);throw new Error("No available Afterpay processor found")},convertStylesToQueryString=S=>JSON.stringify(S),{log__:log__$1,err__:err__$1}=createOjsFlowLoggers("tracer"),initTracerSafe=(S,T)=>{try{initTracerUnsafe(S,T)}catch(A){err__$1(`Error initializing tracer: ${A}`)}};let globalTracer;const initTracerUnsafe=async(S,T)=>{if(typeof window>"u")return;const A=await Promise.resolve().then(()=>index$5),{ConsoleSpanExporter:P,SimpleSpanProcessor:O,WebTracerProvider:R}=A,M=await Promise.resolve().then(()=>index$3),{FetchInstrumentation:D}=M,U=await Promise.resolve().then(()=>index$2),{ZoneContextManager:C}=U,L=await Promise.resolve().then(()=>index$4),{registerInstrumentations:y}=L,_=await Promise.resolve().then(()=>index$7),{Resource:N}=_,I=await Promise.resolve().then(()=>detectResources),{detectResourcesSync:x}=I,V=await Promise.resolve().then(()=>index$1),{OTLPTraceExporter:k}=V,F=await Promise.resolve().then(()=>index),{B3Propagator:W,B3InjectEncoding:ee}=F,ne=await Promise.resolve().then(()=>index$6),{BatchSpanProcessor:le}=ne;log__$1(`Initializing tracer with version ${S} and baseUrl ${T}`);const Re=getCollectorUrl(T);log__$1(`Using collector URL ${Re}`);const Qe=new k({url:Re}),je={"service.version":S,"service.name":"ojs"};return new R({resource:new N(je).merge(x()),spanProcessors:[new O(new P),new le(Qe,{scheduledDelayMillis:500})]}).register({contextManager:new C,propagator:new W({injectEncoding:ee.MULTI_HEADER})}),y({instrumentations:[new D({propagateTraceHeaderCorsUrls:[/.*/],ignoreUrls:[/^https:\/\/(.*\.)?adyen\.com/,/^https:\/\/(.*\.)?loopcrypto\.xyz/]})]}),globalTracer=trace.getTracer("openpay-js"),log__$1("Tracer initialized"),globalTracer},getCollectorUrl=S=>{const T=new URL(S).hostname;return T==="cde.openpaystaging.com"?"https://otel.openpaysandbox.com/v1/traces":T==="cde.getopenpay.com"?"https://otel.getopenpay.com/v1/traces":"http://localhost:4319/v1/traces"};class OpenPayFormEventHandler{constructor(T,A,P,O){this.handleMessage=R=>{if(!R.source){console.warn("[OJS] No source found");return}if(getCleanOrigin(R.origin)!==getCleanOrigin(this.baseUrl)||typeof R.data=="object"&&R.data.penpal||typeof R.data=="object"&&R.data.source&&R.data.source==="react-devtools-bridge")return;let M=null;try{M=parseEventPayload(JSON.parse(R.data))}catch{return}if(!this.validateEvent(M))return;const{elementId:U,payload:C}=M,L=C.type;switch(L){case"LAYOUT":this.internalCallbacks.setFormHeight(C.height?`${C.height}px`:"100%");break;case"FOCUS":this.formCallbacks.get.onFocus(U,C.elementType);break;case"BLUR":this.formCallbacks.get.onBlur(U,C.elementType,{obfuscatedValue:C.obfuscatedValue});break;case"CHANGE":this.formCallbacks.get.onChange(U,C.elementType,C.errors);break;case"LOADED":this.eventTargets[U]=R.source,this.internalCallbacks.onCdeLoaded(C);break;case"LOAD_ERROR":this.internalCallbacks.onCdeLoadError(C.message);break;case"VALIDATION_ERROR":this.formCallbacks.get.onValidationError(C.elementType,C.errors,U);break;default:console.warn("[form] Unhandled event type:",L)}},this.validateEvent=R=>R.formId!==this.formId||!R.elementId?(console.log("[OJS] formId",this.formId,R.formId),console.warn("[form] Ignoring unknown event:",R),!1):this.nonces.has(R.nonce)?(console.warn("[form] Ignoring duplicate event:",R),!1):(this.nonces.add(R.nonce),!0),this.eventTargets={},this.nonces=new Set,this.formId=T,this.baseUrl=A,this.formCallbacks=P,this.internalCallbacks=O}}const getCleanOrigin=S=>new URL(S).origin;async function createConnection(S,T){const P=await connectToChild({iframe:S,debug:!1,childOrigin:T}).promise,O=await checkIfValidCdeConnectionObject(P);if(!isResultValid(P,O))throw new Error("Got invalid CDE connection object");return P}class ConnectionManager{constructor(){this.connections=new Map}addConnection(T,A){this.connections.set(T,A)}getConnection(){const T=this.connections.values().next().value;if(!T)throw new Error("Connection not found");return T}getAllConnections(){return this.connections}}const setupPaymentRequestHandlers=(S,T,A)=>{const{stripePR:P}=S;P.publisher.subscribe(O=>{if(O.isSuccess){const R=O.loadedValue,M=R.isAvailable&&R.availableProviders.applePay,D=R.isAvailable&&R.availableProviders.googlePay,U={apple_pay:{isLoading:!1,isAvailable:M,startFlow:async C=>{M&&runStripePrFlow("apple_pay",R,T,A,C)}},google_pay:{isLoading:!1,isAvailable:D,startFlow:async C=>{D&&runStripePrFlow("google_pay",R,T,A,C)}}};A.get.onPaymentRequestLoad(U)}})},runStripePrFlow=(S,T,A,P,O)=>OjsFlows.stripePR.run({context:A,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(A.checkoutPaymentMethods,S),nonCdeFormInputs:createInputsDictFromForm(A.formDiv),formCallbacks:P,customParams:{provider:S,overridePaymentRequest:O?.overridePaymentRequest},initResult:T}),GENERIC_CONN_ERR="The secure form failed to load properly. Please check your internet connection, or try again later.",{log__,err__}=createOjsFlowLoggers("op-form"),$e=class $e{constructor(T){this.isDestroyed=!1,this.cdeLoadEvent=new LoadedOncePublisher,this.anyCdeConn=new LoadedOncePublisher,this.context=new LoadedOncePublisher,this.initFlows=createInitFlowsPublishers(),this.isSubmitting=!1,this.startFormInit=async()=>{const O=trace.getTracer("openpay-js"),R=O.startSpan("form.initialize",{kind:SpanKind.CLIENT,attributes:{"ojs.checkoutSecureToken":this.config.checkoutSecureToken,"ojs.deviceToken":this.deviceToken,"ojs.formId":this.formId,"ojs.version":this.ojsVersion,"ojs.release_version":this.ojsReleaseVersion,"ojs.base_url":this.baseUrl,"ojs.referrer":this.referrer}});return context.with(trace.setSpan(context.active(),R),async()=>{try{const M=this.createElement(ElementTypeEnum.CDE_BRIDGE);M.node.id="__op_internal_cde_bridge",M.node.ariaHidden="true",Object.assign(M.node.style,{border:"none",margin:"0px",padding:"0px",width:"1px",height:"1px",overflow:"hidden",visibility:"hidden",position:"fixed",pointerEvents:"none",userSelect:"none"}),M.mount("body"),log__("CDE bridge element mounted"),log__("Initializing OpenPay form:"),log__("├ Waiting for CDE load event...");const D=await this.cdeLoadEvent.waitForLoad({timeoutSec:120,timeoutErrMsg:GENERIC_CONN_ERR});log__("├ CDE load event received"),R?.addEvent("waiting_for_cde_connection"),log__("├ Waiting for CDE connection...");const U=O?.startSpan("cde.connect",void 0,context.active()),C=await this.anyCdeConn.waitForLoad({timeoutSec:120,timeoutErrMsg:GENERIC_CONN_ERR});U?.end(),R?.addEvent("cde_connected"),log__("├ CDE connection received"),await setUserDeviceToken(C,this.deviceToken),log__("├ Creating OJS context, setting up handlers...");const L=$e.buildOjsFlowContext(this.config,D,C,this.getFormDiv());this.context.set(L),setupPaymentRequestHandlers(this.initFlows,L,this.formCallbacks),log__("├ Starting OJS init flows..."),await startAllInitFlows(this.initFlows,L,this.formCallbacks),this.formCallbacks.get.onLoad(D.totalAmountAtoms,D.currency),log__("╰ Done initializing OJS flows."),R?.setStatus({code:SpanStatusCode.OK}),track("form_loaded")}catch(M){const D=getErrorMessage(M);R?.setStatus({code:SpanStatusCode.ERROR,message:D}),err__("╰ Error initializing OP form:",D),track("form_init_error",{error:D}),this.formCallbacks.get.onLoadError(D)}finally{R?.end()}})},this.setFormHeight=O=>{this.formProperties.height=O,this.registeredElements&&Object.values(this.registeredElements).forEach(R=>{!R||R.type===ElementTypeEnum.CDE_BRIDGE||(R.node.style.height=O)})},this.onCdeLoaded=O=>{this.cdeLoadEvent.current.isSuccess||(this.cdeLoadEvent.set(O),track("cde_loaded"))},this.onCdeLoadError=O=>{this.cdeLoadEvent.current.isSuccess||(this.cdeLoadEvent.throw(new Error(O),O),track("cde_load_error",{error:O}))},this.createElement=(O,R={})=>{if(this.checkValidFormInstance("createElement"),!this.config)throw new Error("OpenPay form not initialized");const M=_ElementTypeEnumZod.parse(O),D=document.createElement("iframe"),U=this.buildQueryString(R);D.name=`${M}-element`;const C=new URL(`/app/v1/${D.name}/`,this.config.baseUrl);return C.search=U.toString(),D.src=C.href,D.style.border="none",D.style.width="100%",this.registerIframe(M,D)},this.registerIframe=(O,R)=>{const M={type:O,node:R,mount:D=>{document.querySelector(D)?.appendChild(R),track("element_mounted",{element_type:O})}};return this.connectToElement({type:M.type,node:M.node}),this.registeredElements||(this.registeredElements={[ElementTypeEnum.CARD]:void 0,[ElementTypeEnum.CARD_NUMBER]:void 0,[ElementTypeEnum.CARD_EXPIRY]:void 0,[ElementTypeEnum.CARD_CVC]:void 0,[ElementTypeEnum.CDE_BRIDGE]:void 0}),this.registeredElements[O]=M,M},this.buildQueryString=O=>{const R=new URLSearchParams;return R.append("referer",this.referrer),R.append("formId",this.formId),O.styles&&R.append("styles",convertStylesToQueryString(O.styles)),R.append("secureToken",this.config.checkoutSecureToken),R},this.connectToElement=O=>createTrackingSpan({spanName:"connect_to_element",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},async()=>{const R=await createConnection(O.node);R.tracingContext={checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},this.connectionManager.addConnection(O.type,R),!this.anyCdeConn.current.isSuccess&&O.type===ElementTypeEnum.CDE_BRIDGE&&this.anyCdeConn.set(R)}).catch(R=>err__("[FORM] Error connecting to CDE iframe",R)),this.getFormDiv=()=>document.querySelector(this.formTarget)??document.body,this.submitCard=async O=>{if(this.isSubmitting){err__("Form is already submitting. Please wait for the submission to finish before submitting again.");return}this.isSubmitting=!0;try{const R=await createTrackingSpan({spanName:"submit_card",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer,paymentRouteId:O?.paymentRouteId},async()=>{track("submit_card",{...O}),this.checkValidFormInstance("submitCard");const M=this.context.getValueIfLoadedElse(null);if(!M)throw new Error("Please wait for the form to finish loading before submitting.");await OjsFlows.commonCC.run({context:M,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(M.checkoutPaymentMethods,"credit_card"),nonCdeFormInputs:createInputsDictFromForm(M.formDiv),formCallbacks:this.formCallbacks,customParams:{currentCdeConnections:this.connectionManager.getAllConnections(),paymentRouteId:O?.paymentRouteId},initResult:void 0})});return this.isSubmitting=!1,R}catch(R){throw this.isSubmitting=!1,R}},this.getAvailablePaymentMethods=()=>createTrackingSpan({spanName:"get_available_payment_methods",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},()=>{this.checkValidFormInstance("getAvailablePaymentMethods");const O=this.context.getValueIfLoadedElse(null);if(!O)throw new Error("Please wait for the form to finish loading before getting available payment methods.");const{processors:R,isAvailable:M}=getApplePayProcessors(this.initFlows),{processors:D,isAvailable:U}=getGooglePayProcessors(this.initFlows),L=this.initFlows.paypal.publisher.getValueIfLoadedElse(null)?.isAvailable??!1,{processors:y,isAvailable:_}=getKlarnaProcessors(this.initFlows),{processors:N,isAvailable:I}=getAffirmProcessors(this.initFlows),{processors:x,isAvailable:V}=getAfterpayProcessors(this.initFlows),k=O.checkoutPaymentMethods.some(je=>je.processor_name==="pockyt"&&je.provider==="paypal"),W=this.initFlows.loop.publisher.getValueIfLoadedElse(null)?.isAvailable??!1,ee=this.initFlows.stripeLink.publisher.getValueIfLoadedElse(null),ne=ee?.isAvailable??!1,le=[{name:SubmitMethods.card,processors:[],isAvailable:!0},{name:SubmitMethods.applePay,processors:R,isAvailable:M},{name:SubmitMethods.googlePay,processors:D,isAvailable:U},{name:SubmitMethods.paypal,processors:L?[PaymentProcessor.Enum.paypal]:[],isAvailable:L},{name:SubmitMethods.klarna,processors:y,isAvailable:_},{name:SubmitMethods.affirm,processors:N,isAvailable:I},{name:SubmitMethods.afterpay,processors:x,isAvailable:V},{name:SubmitMethods.pockytPaypal,processors:k?[PaymentProcessor.Enum.pockyt]:[],isAvailable:k},{name:SubmitMethods.loopCrypto,processors:W?[PaymentProcessor.Enum.loop]:[],isAvailable:W},{name:SubmitMethods.stripeLink,processors:[PaymentProcessor.Enum.stripe],isAvailable:ne,controller:ee?.isAvailable?ee.controller:void 0}],Re={paypal:SubmitMethods.paypal,airwallexGooglePay:SubmitMethods.airwallexGooglePay,airwallexApplePay:SubmitMethods.airwallexApplePay,authorizeNetGooglePay:SubmitMethods.authorizenetGooglePay,authorizeNetApplePay:SubmitMethods.authorizenetApplePay,adyenGooglePay:SubmitMethods.adyenGooglePay,adyenApplePay:SubmitMethods.adyenApplePay};return[...Object.entries(this.initFlows).map(([je,ot])=>{const at=ot.publisher.getValueIfLoadedElse(null);return{name:Re[je]??je,processors:[],isAvailable:at?.isAvailable??!1}}),...le]}),this.generalSubmit=async(O,R)=>{if(this.isSubmitting){err__("Form is already submitting. Please wait for the submission to finish before submitting again.");return}this.isSubmitting=!0;try{const M=await createTrackingSpan({spanName:"general_form_submit",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},async()=>{track("general_form_submit",{method:O,settings:R}),this.checkValidFormInstance("generalSubmit");const D=this.context.getValueIfLoadedElse(null);if(!D)throw new Error("Please wait for the form to finish loading before submitting.");switch(O){case SubmitMethods.card:return this.submitCard(R);case SubmitMethods.pockytPaypal:return OjsFlows.pockytPaypal.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.PAYPAL,"pockyt"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:{settings:R},initResult:void 0});case SubmitMethods.paypal:return OjsFlows.paypal.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.PAYPAL,"paypal"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),initResult:void 0,customParams:{settings:R},formCallbacks:this.formCallbacks});case SubmitMethods.klarna:{const{startFlow:U}=getKlarnaProcessors(this.initFlows);return U(R)}case SubmitMethods.affirm:{const{startFlow:U}=getAffirmProcessors(this.initFlows);return U(R)}case SubmitMethods.afterpay:{const{startFlow:U}=getAfterpayProcessors(this.initFlows);return U(R)}case SubmitMethods.loopCrypto:return OjsFlows.loopCrypto.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,"crypto","loop"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:R,initResult:void 0});case SubmitMethods.applePay:{const{startFlow:U}=getApplePayProcessors(this.initFlows);return U(R)}case SubmitMethods.googlePay:{const{startFlow:U}=getGooglePayProcessors(this.initFlows);return U(R)}case SubmitMethods.airwallexGooglePay:{const U=this.initFlows.airwallexGooglePay.publisher.getValueIfLoadedElse(null);if(!U){err__("airwallex-google-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.airwallexApplePay:{const U=this.initFlows.airwallexApplePay.publisher.getValueIfLoadedElse(null);if(!U){err__("airwallex-apple-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.authorizenetGooglePay:{const U=this.initFlows.authorizeNetGooglePay.publisher.getValueIfLoadedElse(null);if(!U){err__("authorize-net-google-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.authorizenetApplePay:{const U=this.initFlows.authorizeNetApplePay.publisher.getValueIfLoadedElse(null);if(!U){err__("authorize-net-apple-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.adyenGooglePay:{const U=this.initFlows.adyenGooglePay.publisher.getValueIfLoadedElse(null);if(!U){err__("adyen-google-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.adyenApplePay:{const U=this.initFlows.adyenApplePay.publisher.getValueIfLoadedElse(null);if(!U){err__("adyen-apple-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.airwallexACH:return OjsFlows.airwallexACH.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.ACH,"airwallex"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:R,initResult:void 0});case SubmitMethods.airwallexEFT:return OjsFlows.airwallexEFT.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.EFT,"airwallex"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:R,initResult:void 0});case SubmitMethods.airwallexBACS:return OjsFlows.airwallexBACS.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.BACS,"airwallex"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:R,initResult:void 0});case SubmitMethods.airwallexSEPA:return OjsFlows.airwallexSEPA.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.SEPA,"airwallex"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:R,initResult:void 0});case SubmitMethods.stripeLink:{err__("StripeLink cannot be submitted manually. Please mount the button properly and if user completed the payment flow via StripeLink button, the payment will be submitted automatically.");return}default:assertNever(O)}});return this.isSubmitting=!1,M}catch(M){throw this.isSubmitting=!1,M}},this.submitWith=this.generalSubmit,this.submit=this.submitCard,this.destroy=()=>{log__("Destroying OpenPay form..."),this.checkValidFormInstance("destroy"),this.isDestroyed=!0;for(const O of Object.values(this.registeredElements??{}))O&&O.node.remove();getWindowSafe()?.removeEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler)),detachAnalyticsEventListeners(),this.registeredElements=null,delete window.ojs,track("form_destroyed")},this.updateCallbacks=O=>{this.formCallbacks.setCallbacks(O)},$e.assignAsSingleton(this),this.ojsVersion="0.5.24",this.ojsReleaseVersion="0.5.24",this.baseUrl=T.baseUrl??"https://cde.getopenpay.com",this.config={...T,baseUrl:this.baseUrl},this.formCallbacks=FormCallbacks.fromObject(T),this.registeredElements=null,this.formId=`opjs-form-${v4()}`,this.referrer=window.location.origin,this.formTarget=T.formTarget??"body",this.formProperties={height:"1px"},this.connectionManager=new ConnectionManager,this.deviceToken=getDeviceToken(),attachAnalyticsEventListeners();const{framework:A,version:P}=getFrameworkInfo();getCurrentEnv(this.baseUrl).then(O=>{if(!metricsPublisher.current.isSuccess){const R={checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,environment:O,framework:A,frameworkVersion:P,ojsVersion:this.ojsVersion,ojsReleaseVersion:this.ojsReleaseVersion,referrer:this.referrer,baseUrl:this.baseUrl};metricsPublisher.set(R)}}),track("form_init"),console.log("OJS VERSION",this.ojsVersion),T.allowTracing===!0&&initTracerSafe(this.ojsVersion,this.baseUrl),this.eventHandler=new OpenPayFormEventHandler(this.formId,this.baseUrl,this.formCallbacks,{setFormHeight:this.setFormHeight,onCdeLoaded:this.onCdeLoaded,onCdeLoadError:this.onCdeLoadError}),getWindowSafe()?.addEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler)),this.startFormInit()}get checkoutSecureToken(){return this.config.checkoutSecureToken}checkValidFormInstance(T="unknown"){const A=$e.getInstance(),P={thisFormId:this.formId,currentFormId:A?.formId||"no-current-instance",isDestroyed:this.isDestroyed,checkoutToken:this.config.checkoutSecureToken.substring(0,10)+"..."},O=`
213
+ Error: ${getErrorMessage(T)}`),new Error(A)}},runAirwallex3dsFlow=async(S,T)=>{const A=parseResponseHeaders$3(T),P=await start3dsVerificationStrict({url:A["op-airwallex-3ds-url"],baseUrl:S}),O=parseIntentIdFrom3dsHref(P.href??""),R=A["op-airwallex-initial-intent-id"];if(R!==O){const D="Unable to process your credit card. Please contact support for assistance.",U=`Intent ID from callback (${O}) does not match the initial intent ID (${R}).`;throw err__$q(U),new Error(D)}return{existing_cc:{initial_intent_id:O,consent_id:A["op-airwallex-consent-id"]}}},ApplePayCpm$2=objectType({provider:literalType("apple_pay"),processor_name:literalType("airwallex"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType()})}),GooglePayCpm$2=objectType({provider:literalType("google_pay"),processor_name:literalType("airwallex"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType(),google_pay_merchant_id:stringType().nullish()})}),loadApplePayScript=()=>loadScript({scriptId:"__op_internal_apple_pay_sdk",src:"https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",checkLoadedFn:()=>!!window.ApplePaySession}),fillEmptyFormInputsWithApplePay=(S,T)=>{const A=T.token.paymentMethod.billingContact,P=T.billingContact,O=T.shippingContact,R={...S};if(A||P||O){R[FieldName.EMAIL]=R[FieldName.EMAIL]||A?.emailAddress||P?.emailAddress||O?.emailAddress||"op_unfilled@email.com",R[FieldName.COUNTRY]=R[FieldName.COUNTRY]||A?.countryCode||P?.countryCode||O?.countryCode||"US",R[FieldName.ZIP_CODE]=R[FieldName.ZIP_CODE]||A?.postalCode||P?.postalCode||O?.postalCode||"00000";const M=R[FieldName.FIRST_NAME]||A?.givenName||P?.givenName||O?.givenName||"",D=R[FieldName.LAST_NAME]||A?.familyName||P?.familyName||O?.familyName||"";M||D?(R[FieldName.FIRST_NAME]=M,R[FieldName.LAST_NAME]=D):(R[FieldName.FIRST_NAME]="_OP_UNKNOWN",R[FieldName.LAST_NAME]="")}return R};objectType({data:objectType({messageHeaders:recordType(stringType(),anyType()),errors:arrayType(anyType()),messageType:stringType(),messageBody:recordType(stringType(),anyType())}),origin:literalType("https://applepay.cdn-apple.com")});const createRecurringPaymentRequest=({total:S,prefill:T})=>{if(T.mode==="setup")return{paymentDescription:"Setup recurring payment",regularBilling:{amount:S.amount,label:"Setup recurring payment",paymentTiming:"recurring",type:"final"},managementURL:new URL(`/pay/${T.token}`,FRAME_BASE_URL).toString()};const A=T.line_items?.[0];if(!A)return;const P=A?.billing_interval==="week"?"day":A?.billing_interval,O=A?.billing_interval_count?A?.billing_interval==="week"?A?.billing_interval_count*7:A?.billing_interval_count:void 0;return{paymentDescription:A?.description??"",regularBilling:{amount:S.amount,label:A?.description??"",recurringPaymentIntervalUnit:P,recurringPaymentIntervalCount:O,paymentTiming:"recurring",type:"final"},managementURL:`https://cde.getopenpay.com/pay/${T.token}`}},createApplePayTotal=({overridePaymentRequest:S,initialPreview:T,prefill:A,defaultLabel:P="Total"})=>{const O=(S?.amount?.currency??A?.currency??T.currency).toUpperCase(),M=((S?.amount?.amountAtom??T?.amountAtom??0)/100).toFixed(2);return{currencyCode:O,total:{label:S?.label??P??"Total",type:S?.pending?"pending":"final",amount:M}}},getApplePayPaymentRequest=({overridePaymentRequest:S,initialPreview:T,prefill:A,defaultLabel:P})=>{const{currencyCode:O,total:R}=createApplePayTotal({overridePaymentRequest:S,initialPreview:T,prefill:A,defaultLabel:P});let M={countryCode:"US",currencyCode:O,requiredBillingContactFields:["email","postalAddress","name"],requiredShippingContactFields:["email",...A.checkout_settings.require_full_shipping_address?["postalAddress"]:[]],supportedNetworks:["visa","masterCard","amex","discover","jcb"],merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],total:R};return A.line_items.every(U=>U.billing_interval&&U.billing_interval_count)&&(M.recurringPaymentRequest=createRecurringPaymentRequest({total:R,prefill:A})),S?.applePayPaymentRequest&&(typeof S.applePayPaymentRequest=="function"?M={...M,...S.applePayPaymentRequest(M)}:M={...M,...S.applePayPaymentRequest}),M},AdyenEnvironment=enumType(["test","live","live-us","live-in","live-apse","live-au"]),AdyenLocale=enumType(["ar","bg-BG","ca-ES","cs-CZ","da-DK","de-DE","el-GR","en-US","es-ES","et-EE","fi-FI","fr-FR","hr-HR","hu-HU","is-IS","it-IT","ja-JP","ko-KR","lt-LT","lv-LV","nl-NL","no-NO","pl-PL","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sl-SI","sv-SE","zh-CN","zh-TW"]),{log__:log__$q,err__:err__$p}=createOjsFlowLoggers("adyen-cc"),Adyen3dsResponseHeaders=objectType({"op-account-id":stringType(),"op-adyen-client-key":stringType(),"op-adyen-environment":AdyenEnvironment,"op-adyen-action":stringType()}),friendlyErr="Unable to process your credit card. Please contact support for assistance.",parseResponseHeaders$2=S=>{const T=Adyen3dsResponseHeaders.safeParse(S);if(!T.success)throw err__$p(`Adyen 3DS is required but headers are malformed. Got: ${JSON.stringify(S)}`),new Error(friendlyErr);return T.data},decodeAdyenAction=S=>JSON.parse(S),isAdyenAvailable=()=>"AdyenWeb"in window&&"AdyenCheckout"in window.AdyenWeb,getAdyenCheckout=async()=>{log__$q("Waiting for Adyen SDK to load...");for(let S=0;S<10;S++)isAdyenAvailable()||await sleep(500);if(!isAdyenAvailable())throw err__$p("Adyen SDK not loaded properly"),new Error(friendlyErr);return log__$q("Adyen SDK loaded successfully"),window.AdyenWeb.AdyenCheckout},handleAdyen3ds=S=>{const{headers:T,locale:A,countryCode:P,component:O,host:R,cancelButton:M}=S,D=decodeAdyenAction(T["op-adyen-action"]);return log__$q(`Running Adyen 3DS flow for action type: ${D.type}`),new Promise(U=>{const C=()=>{log__$q("Cleaning up Adyen 3DS flow"),M.removeEventListener("click",_),R.remove()},L=I=>{err__$p("Authentication failed. Result:",I),U({status:ThreeDSStatus.FAILURE,cleanup:C})},y=I=>{err__$p("Adyen error:",I),U({status:ThreeDSStatus.FAILURE,cleanup:C})},_=()=>{U({status:ThreeDSStatus.CANCELLED,cleanup:C})};M.addEventListener("click",_);const N=(I,x,V)=>{R.remove(),U({status:ThreeDSStatus.SUCCESS,additionalDetails:I,cleanup:C})};getAdyenCheckout().then(I=>I({clientKey:T["op-adyen-client-key"],environment:T["op-adyen-environment"],locale:A,countryCode:P,onAdditionalDetails:N,onPaymentFailed:L,onError:y})).then(I=>{I.createFromAction(D,{challengeWindowSize:"03"}).mount(O)})})},determineLocale=S=>{const T=navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language,A=S??T,P=AdyenLocale.safeParse(A);return P.success?(log__$q(`Resolved locale: ${P.data}`),P.data):(err__$p(`Resolved invalid locale: ${A}. Defaulting to en-US.`),"en-US")},checkIfRequiresAdyen3ds=S=>S?.["op-adyen-action"]!==void 0,runAdyen3dsFlow=async(S,T,A)=>{const P=parseResponseHeaders$2(T),O=document.createElement("div");O.id="adyen-container";const{host:R,iframe:M,cancelButton:D}=createAndOpenFrame("http://example.com");M.replaceWith(O);const U=await handleAdyen3ds({headers:P,locale:determineLocale(A),countryCode:S,component:O,host:R,cancelButton:D});if(U.cleanup(),U.status===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed");if(U.status===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(U.status===ThreeDSStatus.SUCCESS){if(!U.additionalDetails)throw new Error("3DS verification succeeded but no additional details were returned");return log__$q("3DS verification succeeded"),{existing_cc:{additional_details:U.additionalDetails.data}}}else assertNever(U.status)},ApplePayCpm$1=objectType({provider:literalType("apple_pay"),processor_name:literalType("adyen"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType()})}),GooglePayCpm$1=objectType({provider:literalType("google_pay"),processor_name:literalType("adyen"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType(),google_pay_merchant_id:stringType().nullish()})}),{log__:log__$p}=createOjsFlowLoggers("awx-apple-pay");async function handleValidateMerchant$2(S,T){try{const O=(await preparePaymentFlow(T.connection,{checkout_payment_method:T.checkoutPaymentMethod,processor_specific_metadata:{apple_pay_session:{validation_url:S.validationURL,initiative_context:window.location.hostname,their_account_id:T.processorAccount.processor_account_id}}})).next_action_metadata?.apple_pay_session;if(!O)throw new Error("No session data received from payment flow");T.session.completeMerchantValidation(O),track("apple_pay_complete_merchant_validation",{...O})}catch(A){throw T.session.abort(),A}}async function handlePaymentAuthorized$2(S,T){try{const A=S.payment,P=fillEmptyFormInputsWithApplePay(T.nonCdeFormInputs,A),O=validateNonCdeFormFieldsForCC(P,T.formCallbacks.get.onValidationError,T.defaultFieldValues);track("billing_details_received",{...O}),await startPaymentFlow(T.connection,{payment_provider:T.checkoutPaymentMethod.provider,checkout_payment_method:T.checkoutPaymentMethod,...createCustomerFieldsFromForm(O,T.prefill.checkout_settings)});const R=await confirmPaymentFlow(T.connection,{secure_token:T.prefill.token,processor_specific_metadata:{payment_provider:T.checkoutPaymentMethod.provider,browser_info:getFraudMetadata(),mobile_wallet_payment_data:{encrypted_payment_token:btoa(JSON.stringify(A.token.paymentData))}}});if(log__$p("[1st] Confirm payment flow response",R),!R.payment_methods?.[0]?.id)throw new Error("No PM ID found");const D={status:ApplePaySession.STATUS_SUCCESS};return T.session.completePayment(D),performSimpleCheckoutOrSetup({logPrefix:"adyen-applepay",anyCdeConnection:T.connection,checkoutPaymentMethod:T.checkoutPaymentMethod,requiredFormFields:O,confirmResult:R,usePayFirstFlow:!1})}catch(A){const P={status:ApplePaySession.STATUS_FAILURE};throw T.session.completePayment(P),A}}const{log__:log__$o,err__:err__$o}=createOjsFlowLoggers("adyen-apple-pay"),initAdyenApplePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A={processor:PaymentProcessor.Enum.adyen,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm$1);if(!P)return A;if(log__$o("Loading Apple Pay script"),await loadApplePayScript(),!window.ApplePaySession||!ApplePaySession.canMakePayments())return log__$o("Apple Pay is not available on this device/browser"),A;if(log__$o("Apple Pay Loaded"),!await ApplePaySession.canMakePayments())return log__$o("No active cards available for Apple Pay"),A;if(!P.metadata.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const M=S.anyCdeConnection,D=await getPrefill(M),U=D.mode==="setup",C=await getCheckoutPreviewAmount(M,D.token,U,void 0),L=async y=>{try{await OjsFlows.adyenApplePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:{...y,initialPreview:C},initResult:void 0})}catch(_){err__$o("Apple Pay payment error",_),T.get.onCheckoutError(_?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.adyen,isAvailable:!0,isLoading:!1,startFlow:L}}),runAdyenApplePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,customParams:P,formCallbacks:O})=>{const R=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm$1),{overridePaymentRequest:M,initialPreview:D}=P,U=S.anyCdeConnection,C=await getPrefill(U),L=C.mode==="setup",y=getApplePayPaymentRequest({overridePaymentRequest:M,initialPreview:D,prefill:{...C},defaultLabel:R?.metadata?.processor_account_name}),_=new ApplePaySession(3,y),N={session:_,connection:S.anyCdeConnection,checkoutPaymentMethod:T,nonCdeFormInputs:A,processorAccount:R.metadata,prefill:C,isSetupMode:L,baseUrl:S.baseUrl,formCallbacks:O,defaultFieldValues:P?.defaultFieldValues};return track("apple_pay_flow_started",{processor_name:T.processor_name,prefill:excludeProps(C,["brand"]),overridePaymentRequest:M}),new Promise((I,x)=>{const V=()=>{log__$o("Payment cancelled by user"),x(new Error("Payment cancelled by user"))};_.onvalidatemerchant=async k=>{try{await handleValidateMerchant$2(k,N)}catch(F){x(F)}},_.onpaymentmethodselected=async()=>{const k=await getCheckoutPreviewAmount(U,C.token,L,void 0),F={newTotal:createApplePayTotal({overridePaymentRequest:P.overridePaymentRequest,initialPreview:k,defaultLabel:R?.metadata?.processor_account_name,prefill:C}).total};_.completePaymentMethodSelection(F)},_.onpaymentauthorized=async k=>{track("apple_pay_payment_authorized");try{const F=await handlePaymentAuthorized$2(k,N);I(F)}catch(F){x(F)}},_.oncancel=V,_.begin()}).catch(I=>{throw err__$o("Apple Pay payment error",I),track("apple_pay_payment_error",{error:I}),I})}),{log__:log__$n,err__:err__$n}=createOjsFlowLoggers("adyen-google-pay"),initAdyenGooglePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A={processor:PaymentProcessor.Enum.adyen,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm$1);if(!P)return A;log__$n("Google Pay CPM",P);const O=P.metadata;if(!O.processor_account_id)return err__$n("No gateway merchant ID found in processor account"),A;if(log__$n("Loading Google Pay script"),await loadGooglePayScript(),!window.google?.payments?.api)return err__$n("Google Pay SDK not loaded properly"),A;if(await getGooglePayEnvironment(S.baseUrl)==="PRODUCTION"&&!O.google_pay_merchant_id)return err__$n("Google Pay merchant ID is required for production environment"),A;log__$n("Google Pay SDK loaded",window.google.payments);const M=S.anyCdeConnection,D=await getPrefill(M),U=D.mode==="setup",C=await getCheckoutPreviewAmount(M,D.token,U,void 0);try{const y=getPaymentDataRequest({prefill:D,gateway:"adyen",gatewayMerchantId:O.processor_account_id,merchantName:O.processor_account_name,merchantId:O.google_pay_merchant_id??"",initialPreview:C}),_=await getGooglePaymentsClient(S.baseUrl,y),{result:N}=await _.isReadyToPay(y);if(!N)return log__$n("Google Pay is not available for this user"),A}catch(y){return err__$n("Error checking Google Pay availability",y),A}const L=async y=>{try{OjsFlows.adyenGooglePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:{...y,initialPreview:C}})}catch(_){err__$n("Google Pay payment error",_),T.get.onCheckoutError(_?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.adyen,isAvailable:!0,isLoading:!1,startFlow:L}}),runAdyenGooglePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$n("Starting Google Pay flow...");const R=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm$1),{overridePaymentRequest:M}=O,D=R.metadata;if(!D.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const U=S.anyCdeConnection,C=await getPrefill(U),L=C.mode==="setup",y=await getCheckoutPreviewAmount(U,C.token,L,void 0),_=getPaymentDataRequest({prefill:C,gateway:"adyen",gatewayMerchantId:D.processor_account_id,merchantName:D.processor_account_name,merchantId:D.google_pay_merchant_id??"",initialPreview:y,overridePaymentRequest:M});track("google_pay_flow_started",{processor_name:R.processor_name,prefill:excludeProps(C,["brand"]),overridePaymentRequest:M});const N=await getGooglePaymentsClient(S.baseUrl,_);try{const I=await N.loadPaymentData(_);log__$n("Google Pay Payment data",I);const x=fillEmptyFormInputsWithGooglePay(A,I),V=validateNonCdeFormFieldsForCC(x,P.get.onValidationError,O?.defaultFieldValues);if(track("billing_details_received",{...V}),!I.paymentMethodData?.tokenizationData?.token)throw new Error("No payment token received from Google Pay");const F=await startPaymentFlow(U,{payment_provider:T.provider,checkout_payment_method:T,...createCustomerFieldsFromForm(V,C.checkout_settings)}),W=parseAirwallexStartPaymentFlowResponse(F);log__$n("Start flow next actions",W);let ee=await confirmPaymentFlow(U,{secure_token:C.token,processor_specific_metadata:{payment_provider:T.provider,browser_info:getFraudMetadata(),mobile_wallet_payment_data:{encrypted_payment_token:I.paymentMethodData?.tokenizationData?.token}}});log__$n("[1st] Confirm payment flow response",ee);let ne=ee.payment_methods?.[0]?.id;const le=ee.required_user_actions?.find(Re=>Re.type==="adyen-3ds");if(le&&le.redirect_url){log__$n("Adyen 3DS Required, starting verification...",le);const{status:Re}=await start3dsVerification({url:le.redirect_url,baseUrl:S.baseUrl});if(log__$n(`╰ Adyen 3DS verification completed [Status: ${Re}]`),Re===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(Re===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed")}if(le&&!ne&&(ee=await confirmPaymentFlow(U,{secure_token:C.token,their_pm_id:le.their_pm_id,processor_specific_metadata:{payment_provider:T.provider}}),log__$n("[2nd] Confirm payment flow response after 3DS",ee),ne=ee.payment_methods?.[0]?.id),!ne)throw new Error("No payment method ID found");return performSimpleCheckoutOrSetup({logPrefix:"adyen-googlepay",anyCdeConnection:U,checkoutPaymentMethod:T,requiredFormFields:V,confirmResult:ee,usePayFirstFlow:!1})}catch(I){throw err__$n("Google Pay payment error",I),track("google_pay_payment_error",{error:I}),new Error(I?.message??"Unknown error")}}),{log__:log__$m,err__:err__$m}=createOjsFlowLoggers("awx-ach"),runAirwallexACHFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{const R=validateNonCdeFormFieldsForCC(A,P.get.onValidationError),M=S.anyCdeConnection,D=await getPrefill(M),U=O.verificationMethod??"plaid";let C=null;if(U==="micro_deposit"){log__$m("Micro deposit verification selected, showing form...");try{C=await createAndOpenMicroDepositForm("ach_direct_debit",{width:"450px",height:"400px",baseUrl:S.baseUrl}),log__$m("Micro deposit data collected")}catch{throw log__$m("Micro deposit form cancelled"),new Error("Micro deposit form cancelled")}}const L=await startPaymentFlow(M,{payment_provider:T.provider,checkout_payment_method:T,...createCustomerFieldsFromForm(R,D.checkout_settings),customer_language:detectLanguage()}),_=parseAirwallexStartPaymentFlowResponse(L)?.consent_id,I=(await confirmPaymentFlow(M,{secure_token:D.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:_,verification_method:U,direct_debit_data:{type:"ach_direct_debit",ach_direct_debit:{business_account:O.isBusinessAccount??!1,owner_name:getFullName(R[FieldName.FIRST_NAME],R[FieldName.LAST_NAME]),owner_email:R[FieldName.EMAIL],account_number:C?.account_number,aba_routing_number:C?.aba_routing_number}}}})).required_user_actions?.find(V=>V.type==="airwallex_payment_consent")?.redirect_url;if(I){log__$m("Plaid verification Required, starting verification...");const{status:V}=await start3dsVerification({url:I,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"ACH verification"});if(log__$m(`╰ Plaid verification completed [Status: ${V}]`),V===ThreeDSStatus.CANCELLED)throw new Error("Plaid verification cancelled");if(V===ThreeDSStatus.FAILURE)throw new Error("Plaid verification failed")}const x=await confirmPaymentFlow(M,{secure_token:D.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:_}});try{return performSimpleCheckoutOrSetup({logPrefix:"awx-ach",anyCdeConnection:M,checkoutPaymentMethod:T,requiredFormFields:R,confirmResult:x,usePayFirstFlow:!1})}catch(V){throw err__$m("ACH payment error",V),track("checkout_error",{error:V}),new Error(V?.message??"Unknown error")}}),{log__:log__$l}=createOjsFlowLoggers("awx-apple-pay");async function handleValidateMerchant$1(S,T){try{const O=(await preparePaymentFlow(T.connection,{checkout_payment_method:T.checkoutPaymentMethod,processor_specific_metadata:{airwallex_payment_session:{validation_url:S.validationURL,initiative_context:window.location.hostname,their_account_id:T.processorAccount.processor_account_id}}})).next_action_metadata?.apple_pay_session;if(!O)throw new Error("No session data received from payment flow");T.session.completeMerchantValidation(O),track("apple_pay_complete_merchant_validation",{...O})}catch(A){throw T.session.abort(),A}}async function handle3DS(S,T){if(!S.redirect_url)throw new Error("No redirect URL found");log__$l("3DS Required, starting verification...",S);const{status:A}=await start3dsVerification({url:S.redirect_url,baseUrl:T.baseUrl});if(log__$l(`╰ 3DS verification completed [Status: ${A}]`),A===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(A===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed");const P=await confirmPaymentFlow(T.connection,{secure_token:T.prefill.token,processor_specific_metadata:{their_pm_id:S.their_pm_id,airwallex_consent_id:S.consent_id,payment_provider:T.checkoutPaymentMethod.provider}});return log__$l("[2nd] Confirm payment flow response",P),P}async function handlePaymentAuthorized$1(S,T){try{const A=S.payment,P=fillEmptyFormInputsWithApplePay(T.nonCdeFormInputs,A),O=validateNonCdeFormFieldsForCC(P,T.formCallbacks.get.onValidationError,T.defaultFieldValues);track("billing_details_received",{...O});const D=(await startPaymentFlow(T.connection,{payment_provider:T.checkoutPaymentMethod.provider,checkout_payment_method:T.checkoutPaymentMethod,...createCustomerFieldsFromForm(O,T.prefill.checkout_settings)})).required_user_actions[0].consent_id;if(!D)throw new Error("No consent ID received from payment flow");let U=await confirmPaymentFlow(T.connection,{secure_token:T.prefill.token,processor_specific_metadata:{payment_provider:T.checkoutPaymentMethod.provider,airwallex_consent_id:D,airwallex_payment_method_data:{type:"applepay",applepay:{payment_data_type:"encrypted_payment_token",encrypted_payment_token:JSON.stringify(A.token)}}}});log__$l("[1st] Confirm payment flow response",U);let C=U.payment_methods?.[0]?.id;const L=U.required_user_actions?.find(_=>_.type==="airwallex_payment_consent");if(L?.redirect_url&&L.consent_id&&L.their_pm_id&&(U=await handle3DS(L,T),C=U.payment_methods?.[0]?.id),!C)throw new Error("No PM ID found");const y={status:ApplePaySession.STATUS_SUCCESS};return T.session.completePayment(y),performSimpleCheckoutOrSetup({logPrefix:"awx-applepay",anyCdeConnection:T.connection,checkoutPaymentMethod:T.checkoutPaymentMethod,requiredFormFields:O,confirmResult:U,usePayFirstFlow:!1})}catch(A){const P={status:ApplePaySession.STATUS_FAILURE};throw T.session.completePayment(P),A}}const{log__:log__$k,err__:err__$l}=createOjsFlowLoggers("awx-apple-pay"),initAirwallexApplePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A={processor:PaymentProcessor.Enum.airwallex,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm$2);if(!P)return A;if(log__$k("Loading Apple Pay script"),await loadApplePayScript(),!window.ApplePaySession||!ApplePaySession.canMakePayments())return log__$k("Apple Pay is not available on this device/browser"),A;if(log__$k("Apple Pay Loaded"),!await ApplePaySession.canMakePayments())return log__$k("No active cards available for Apple Pay"),A;if(!P.metadata.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const M=S.anyCdeConnection,D=await getPrefill(M),U=D.mode==="setup",C=await getCheckoutPreviewAmount(M,D.token,U,void 0),L=async y=>{try{await OjsFlows.airwallexApplePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:{...y,initialPreview:C},initResult:void 0})}catch(_){err__$l("Apple Pay payment error",_),T.get.onCheckoutError(_?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.airwallex,isAvailable:!0,isLoading:!1,startFlow:L}}),runAirwallexApplePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,customParams:P,formCallbacks:O})=>{const R=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm$2),{overridePaymentRequest:M}=P,D=S.anyCdeConnection,U=await getPrefill(D),C=U.mode==="setup",L=getApplePayPaymentRequest({overridePaymentRequest:M,initialPreview:P.initialPreview,prefill:{...U},defaultLabel:R?.metadata?.processor_account_name}),y=new ApplePaySession(3,L),_={session:y,connection:S.anyCdeConnection,checkoutPaymentMethod:T,nonCdeFormInputs:A,processorAccount:R.metadata,prefill:U,isSetupMode:C,baseUrl:S.baseUrl,formCallbacks:O,defaultFieldValues:P?.defaultFieldValues};return track("apple_pay_flow_started",{processor_name:T.processor_name,prefill:excludeProps(U,["brand"]),overridePaymentRequest:M}),new Promise((N,I)=>{const x=()=>{log__$k("Payment cancelled by user"),I(new Error("Payment cancelled by user"))};y.oncancel=x,y.onvalidatemerchant=async V=>{try{await handleValidateMerchant$1(V,_)}catch(k){I(k)}},y.onpaymentmethodselected=async()=>{const V=await getCheckoutPreviewAmount(D,U.token,C,void 0),k={newTotal:createApplePayTotal({overridePaymentRequest:P.overridePaymentRequest,initialPreview:V,defaultLabel:R?.metadata?.processor_account_name,prefill:U}).total};y.completePaymentMethodSelection(k)},y.onpaymentauthorized=async V=>{track("apple_pay_payment_authorized");try{const k=await handlePaymentAuthorized$1(V,_);N(k)}catch(k){I(k)}},y.begin()}).catch(N=>{throw err__$l("Apple Pay payment error",N),track("apple_pay_payment_error",{error:N}),N})}),{log__:log__$j,err__:err__$k}=createOjsFlowLoggers("awx-google-pay"),initAirwallexGooglePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A={processor:PaymentProcessor.Enum.airwallex,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm$2);if(!P)return A;log__$j("Google Pay CPM",P);const O=P.metadata;if(!O.processor_account_id)return err__$k("No gateway merchant ID found in processor account"),A;if(log__$j("Loading Google Pay script"),await loadGooglePayScript(),!window.google?.payments?.api)return err__$k("Google Pay SDK not loaded properly"),A;if(await getGooglePayEnvironment(S.baseUrl)==="PRODUCTION"&&!O.google_pay_merchant_id)return err__$k("Google Pay merchant ID is required for production environment"),A;log__$j("Google Pay SDK loaded",window.google.payments);const M=S.anyCdeConnection,D=await getPrefill(M),U=D.mode==="setup",C=await getCheckoutPreviewAmount(M,D.token,U,void 0);try{const y=getPaymentDataRequest({prefill:D,gateway:"airwallex",gatewayMerchantId:O.processor_account_id,merchantName:O.processor_account_name,merchantId:O.google_pay_merchant_id??"",initialPreview:C}),_=await getGooglePaymentsClient(S.baseUrl,y),{result:N}=await _.isReadyToPay(y);if(!N)return log__$j("Google Pay is not available for this user"),A}catch(y){return err__$k("Error checking Google Pay availability",y),A}const L=async y=>{try{OjsFlows.airwallexGooglePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:{...y,initialPreview:C}})}catch(_){err__$k("Google Pay payment error",_),T.get.onCheckoutError(_?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.airwallex,isAvailable:!0,isLoading:!1,startFlow:L}}),runAirwallexGooglePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$j("Starting Google Pay flow...");const R=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm$2),{overridePaymentRequest:M}=O,D=R.metadata;if(!D.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const U=S.anyCdeConnection,C=await getPrefill(U),L=C.mode==="setup",y=await getCheckoutPreviewAmount(U,C.token,L,void 0),_=getPaymentDataRequest({prefill:C,gateway:"airwallex",gatewayMerchantId:D.processor_account_id,merchantName:D.processor_account_name,merchantId:D.google_pay_merchant_id??"",initialPreview:y,overridePaymentRequest:M});track("google_pay_flow_started",{processor_name:R.processor_name,prefill:excludeProps(C,["brand"]),overridePaymentRequest:M});const N=await getGooglePaymentsClient(S.baseUrl,_);try{const I=await N.loadPaymentData(_);log__$j("Google Pay Payment data",I);const x=fillEmptyFormInputsWithGooglePay(A,I),V=validateNonCdeFormFieldsForCC(x,P.get.onValidationError,O?.defaultFieldValues);log__$j("___",V),track("billing_details_received",{...V});const k=I.paymentMethodData?.tokenizationData?.token;if(!k)throw new Error("No payment token received from Google Pay");const F=await startPaymentFlow(U,{payment_provider:T.provider,checkout_payment_method:T,...createCustomerFieldsFromForm(V,C.checkout_settings)}),W=parseAirwallexStartPaymentFlowResponse(F);log__$j("Start flow next actions",W);let ee=await confirmPaymentFlow(U,{secure_token:C.token,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:W?.consent_id,airwallex_payment_method_data:{type:"googlepay",googlepay:{payment_data_type:"encrypted_payment_token",encrypted_payment_token:k}}}});log__$j("[1st] Confirm payment flow response",ee);let ne=ee.payment_methods?.[0]?.id;const le=ee.required_user_actions?.find(Re=>Re.type==="airwallex_payment_consent");if(le&&le.redirect_url){log__$j("3DS Required, starting verification...",le);const{status:Re}=await start3dsVerification({url:le.redirect_url,baseUrl:S.baseUrl});if(log__$j(`╰ 3DS verification completed [Status: ${Re}]`),Re===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(Re===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed")}if(le&&!ne&&(ee=await confirmPaymentFlow(U,{secure_token:C.token,their_pm_id:le.their_pm_id,processor_specific_metadata:{payment_provider:T.provider,airwallex_consent_id:le.consent_id}}),log__$j("[2nd] Confirm payment flow response",ee),ne=ee.payment_methods?.[0]?.id),!ne)throw new Error("No PM ID found");return performSimpleCheckoutOrSetup({logPrefix:"awx-googlepay",anyCdeConnection:U,checkoutPaymentMethod:T,requiredFormFields:V,confirmResult:ee,usePayFirstFlow:!1})}catch(I){throw err__$k("Google Pay payment error",I),track("google_pay_payment_error",{error:I}),new Error(I?.message??"Unknown error")}}),{log__:log__$i,err__:err__$j}=createOjsFlowLoggers("klarna"),AirwallexKlarnaCpm=objectType({provider:literalType("klarna"),metadata:objectType({}).nullish(),processor_name:literalType("airwallex")}),initAirwallexKlarnaFlow=async({context:S,formCallbacks:T})=>{const A=findCpmMatchingType(S.checkoutPaymentMethods,AirwallexKlarnaCpm);if(!A)throw new Error("Klarna CPM not found in available payment methods");return{isLoading:!1,isAvailable:!0,startFlow:O=>OjsFlows.airwallexKlarna.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:O??{}})}},runAirwallexKlarnaFlow=addBasicCheckoutCallbackHandlers(async({context:S,nonCdeFormInputs:T,checkoutPaymentMethod:A,formCallbacks:P,customParams:O})=>{try{log__$i("Running Klarna flow...",O);const R=S.anyCdeConnection,M=await getPrefill(R),D=!1;log__$i("Verifying CPM...");const U=AirwallexKlarnaCpm.parse(A);log__$i("├ Validating non-CDE form fields");const C=validateNonCdeFormFieldsForCC(T,P.get.onValidationError,{...D?generateAnonymousValues():void 0,...M.checkout_settings}),L=createCustomerFieldsFromForm(C,M.checkout_settings);log__$i("New customer fields",L);const y=await startPaymentFlow(R,{payment_provider:A.provider,checkout_payment_method:A,...createCustomerFieldsFromForm(C,M.checkout_settings)});return console.log("startPaymentFlowResponse",y),performSimpleCheckoutOrSetup({logPrefix:"klarna",anyCdeConnection:R,checkoutPaymentMethod:U,requiredFormFields:C,confirmResult:{payment_methods:[]},usePayFirstFlow:!1})}catch(R){throw err__$j("Klarna payment error",R),track("checkout_error",{payment_method:"klarna",error:R}),new Error(R?.message??"Unknown error")}}),ApplePayCpm=objectType({provider:literalType("apple_pay"),processor_name:literalType("authorize_net"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType()})}),GooglePayCpm=objectType({provider:literalType("google_pay"),processor_name:literalType("authorize_net"),metadata:objectType({processor_account_id:stringType(),processor_account_name:stringType(),google_pay_merchant_id:stringType().nullish()})});async function handleValidateMerchant(S,T){try{const O=(await preparePaymentFlow(T.connection,{checkout_payment_method:T.checkoutPaymentMethod,processor_specific_metadata:{apple_payment_session:{validation_url:S.validationURL,initiative_context:window.location.hostname,their_account_id:T.processorAccount.processor_account_id}}})).next_action_metadata?.apple_pay_session;if(!O)throw new Error("No session data received from payment flow");T.session.completeMerchantValidation(O),track("apple_pay_complete_merchant_validation",{...O})}catch(A){throw T.session.abort(),A}}async function handlePaymentAuthorized(S,T){try{const A=S.payment,P=fillEmptyFormInputsWithApplePay(T.nonCdeFormInputs,A),O=validateNonCdeFormFieldsForCC(P,T.formCallbacks.get.onValidationError);track("billing_details_received",{...O}),await startPaymentFlow(T.connection,{payment_provider:T.checkoutPaymentMethod.provider,checkout_payment_method:T.checkoutPaymentMethod,...createCustomerFieldsFromForm(O,T.prefill.checkout_settings),customer_language:detectLanguage()});const R={dataDescriptor:"COMMON.APPLE.INAPP.PAYMENT",dataValue:window.btoa(JSON.stringify(A.token.paymentData))},M=await confirmPaymentFlow(T.connection,{secure_token:T.prefill.token,processor_specific_metadata:{payment_provider:T.checkoutPaymentMethod.provider,mobile_wallet_payment_data:R}});if(!M.payment_methods?.[0]?.id)throw new Error("No PM ID found");const U={status:ApplePaySession.STATUS_SUCCESS};return T.session.completePayment(U),performSimpleCheckoutOrSetup({logPrefix:"authnet-applepay",anyCdeConnection:T.connection,checkoutPaymentMethod:T.checkoutPaymentMethod,requiredFormFields:O,confirmResult:M,usePayFirstFlow:!1})}catch(A){const P={status:ApplePaySession.STATUS_FAILURE};throw T.session.completePayment(P),A}}const{log__:log__$h,err__:err__$i}=createOjsFlowLoggers("authnet-applepay"),initAuthnetApplePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A={processor:PaymentProcessor.Enum.authorize_net,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm);if(!P)return A;if(log__$h("Loading Apple Pay script"),await loadApplePayScript(),!window.ApplePaySession||!ApplePaySession.canMakePayments())return log__$h("Apple Pay is not available on this device/browser"),A;if(!await ApplePaySession.canMakePayments())return log__$h("No active cards available for Apple Pay"),A;if(!P.metadata.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const M=S.anyCdeConnection,D=await getPrefill(M),U=D.mode==="setup",C=await getCheckoutPreviewAmount(M,D.token,U,void 0),L=async y=>{try{await OjsFlows.authorizeNetApplePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:{...y,initialPreview:C},initResult:void 0})}catch(_){err__$i("Apple Pay payment error",_),track("apple_pay_payment_error",{error:_}),T.get.onCheckoutError(_?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.authorize_net,isAvailable:!0,isLoading:!1,startFlow:L}}),runAuthnetApplePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,customParams:P,formCallbacks:O})=>{const{initialPreview:R,overridePaymentRequest:M}=P,D=findCpmMatchingType(S.checkoutPaymentMethods,ApplePayCpm),U=S.anyCdeConnection,C=await getPrefill(U),L=C.mode==="setup",y=getApplePayPaymentRequest({overridePaymentRequest:M,initialPreview:R,prefill:C,defaultLabel:D?.metadata?.processor_account_name});track("apple_pay_flow_started",{processor_name:T.processor_name,prefill:C,overridePaymentRequest:M});const _=new ApplePaySession(3,y),N={session:_,connection:S.anyCdeConnection,checkoutPaymentMethod:T,nonCdeFormInputs:A,processorAccount:T.metadata,prefill:C,isSetupMode:L,baseUrl:S.baseUrl,formCallbacks:O};return new Promise((I,x)=>{_.oncancel=()=>{log__$h("Payment cancelled by user"),x(new Error("Payment cancelled by user"))},_.onvalidatemerchant=async V=>{try{await handleValidateMerchant(V,N)}catch(k){x(k)}},_.onpaymentmethodselected=async()=>{const V=await getCheckoutPreviewAmount(U,C.token,L,void 0),k={newTotal:createApplePayTotal({overridePaymentRequest:P.overridePaymentRequest,initialPreview:V,defaultLabel:D?.metadata?.processor_account_name,prefill:C}).total};_.completePaymentMethodSelection(k)},_.onpaymentauthorized=async V=>{track("apple_pay_payment_authorized");try{const k=await handlePaymentAuthorized(V,N);I(k)}catch(k){x(k)}},_.begin()}).catch(I=>{throw err__$i("Apple Pay payment error",I),track("apple_pay_payment_error",{error:I}),I})}),{log__:log__$g,err__:err__$h}=createOjsFlowLoggers("authnet-googlepay"),initAuthnetGooglePayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{log__$g("Initializing Authnet GooglePay flow");const A={processor:PaymentProcessor.Enum.authorize_net,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},P=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm);if(!P)return A;log__$g("Google Pay CPM",P);const O=P.metadata;if(!O.processor_account_id)return err__$h("No gateway merchant ID found in processor account"),A;if(log__$g("Loading Google Pay script"),await loadGooglePayScript(),!window.google?.payments?.api)return err__$h("Google Pay SDK not loaded properly"),A;log__$g("Google Pay SDK loaded",window.google.payments);const R=S.anyCdeConnection,M=await getPrefill(R),D=M.mode==="setup",U=await getCheckoutPreviewAmount(R,M.token,D,void 0);try{const L=getPaymentDataRequest({prefill:M,gateway:"authorizenet",gatewayMerchantId:O.processor_account_id,merchantName:O.processor_account_name,merchantId:O.google_pay_merchant_id??"",initialPreview:U}),y=await getGooglePaymentsClient(S.baseUrl,L),{result:_}=await y.isReadyToPay(L);if(!_)return log__$g("Google Pay is not available for this user"),A}catch(L){return err__$h("Error checking Google Pay availability",L),A}const C=async L=>{try{OjsFlows.authorizeNetGooglePay.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:{...L,initialPreview:U}})}catch(y){err__$h("Google Pay payment error",y),track("google_pay_payment_error",{error:y}),T.get.onCheckoutError(y?.message??"Unknown error")}};return{processor:PaymentProcessor.Enum.authorize_net,isAvailable:!0,isLoading:!1,startFlow:C}}),runAuthnetGooglePayFlow=addBasicCheckoutCallbackHandlers(async({context:S,nonCdeFormInputs:T,checkoutPaymentMethod:A,formCallbacks:P,customParams:O})=>{const{overridePaymentRequest:R}=O,D=findCpmMatchingType(S.checkoutPaymentMethods,GooglePayCpm).metadata,U=S.anyCdeConnection,C=await getPrefill(U),L=C.mode==="setup",y=await getCheckoutPreviewAmount(U,C.token,L,void 0),_=getPaymentDataRequest({prefill:C,gateway:"authorizenet",gatewayMerchantId:D.processor_account_id,merchantName:D.processor_account_name,merchantId:D.google_pay_merchant_id??"",initialPreview:y,overridePaymentRequest:R});track("google_pay_flow_started",{processor_name:A.processor_name,prefill:C,overridePaymentRequest:R});const N=await getGooglePaymentsClient(S.baseUrl,_);try{const I=await N.loadPaymentData(_);log__$g("Google Pay Payment data",I);const x=fillEmptyFormInputsWithGooglePay(T,I),V=validateNonCdeFormFieldsForCC(x,P.get.onValidationError);track("billing_details_received",{...V});const k=I.paymentMethodData?.tokenizationData?.token;if(!k)throw new Error("No payment token received from Google Pay");const F=await startPaymentFlow(U,{payment_provider:A.provider,checkout_payment_method:A,...createCustomerFieldsFromForm(V,C.checkout_settings),customer_language:detectLanguage()});log__$g("Start payment flow response",F);const W=await confirmPaymentFlow(U,{secure_token:C.token,processor_specific_metadata:{payment_provider:A.provider,mobile_wallet_payment_data:{dataDescriptor:"COMMON.GOOGLE.INAPP.PAYMENT",dataValue:window.btoa(k)}}});if(!W.payment_methods?.[0]?.id)throw new Error("No PM ID found");return performSimpleCheckoutOrSetup({logPrefix:"authnet-googlepay",anyCdeConnection:U,checkoutPaymentMethod:A,requiredFormFields:V,confirmResult:W,usePayFirstFlow:!1})}catch(I){throw err__$h("Google Pay payment error",I),track("google_pay_payment_error",{error:I}),new Error(I?.message??"Unknown error")}}),{log__:log__$f,err__:err__$g}=createOjsFlowLoggers("cybs-frame"),attachDeviceDataCollector=(S,T)=>{const A=document.createElement("iframe");A.name="cardinal_collection_iframe",A.style.display="none",A.style.width="10px",A.style.height="10px";const P=document.createElement("form");P.action=S,P.method="POST",P.target=A.name;const O=document.createElement("input");return O.type="hidden",O.name="JWT",O.value=T,P.appendChild(O),document.body.appendChild(A),document.body.appendChild(P),{form:P,detach:()=>{document.body.removeChild(A),document.body.removeChild(P)}}},runDeviceDataCollection=async S=>new Promise((T,A)=>{const{postUrl:P,accessToken:O}=S,R=new URL(P).origin,{form:M,detach:D}=attachDeviceDataCollector(P,O);log__$f("Attached device data collector");const U=L=>{if(L.origin!==R)return;const y=JSON.parse(L.data);if(log__$f("Received event from device data collector:",y),y.MessageType==="profile.completed"){T(y),C();return}},C=()=>{D(),window.removeEventListener("message",U)};try{window.addEventListener("message",U),log__$f("Attached listener to window"),M.submit(),log__$f("Submitted form")}catch(L){err__$g("Error submitting form:",L),C(),A(L)}}),runPayerAuth=S=>{const{stepUpUrl:T,accessToken:A,merchantData:P,iframe:O,host:R}=S,M=document.createElement("form");M.action=T,M.method="POST",M.target=O.name;const D=document.createElement("input");D.type="hidden",D.name="JWT",D.value=A;const U=document.createElement("input");return U.type="hidden",U.name="MD",U.value=P,M.appendChild(D),M.appendChild(U),R.appendChild(M),M},{log__:log__$e,err__:err__$f}=createOjsFlowLoggers("cybs"),CybersourceActionPayload=objectType({step_up_url:stringType(),access_token:stringType(),dd_url:nullOrUndefOr$1(stringType()),dd_token:nullOrUndefOr$1(stringType()),merchant_data:stringType()}),FRIENDLY_ERR="Unable to process your credit card. Please contact support for assistance.",parseResponseHeaders$1=S=>{const T=CybersourceActionPayload.safeParse(S);if(!T.success)throw err__$f(`Cybersource 3DS is required but user action is malformed. Got: ${JSON.stringify(S)}`),new Error(FRIENDLY_ERR);return T.data},checkIfRequiresCybersource3ds=S=>S.type==="cybersource_payer_auth",handleCybersource3ds=async S=>{const{stepUpUrl:T,accessToken:A,merchantData:P,iframe:O,host:R,cancelButton:M}=S,D=new URL(T).origin;return new Promise(U=>{const C=()=>{log__$e("Cleaning up Cybersource 3DS flow"),M.removeEventListener("click",L),R.remove()},L=()=>{log__$e("Cybersource 3DS cancelled"),U({status:ThreeDSStatus.CANCELLED,cleanup:C})},_=startPolling(O,x=>{log__$e("Cybersource 3DS completed with status:",x),U({status:x.status,cleanup:C}),N()},D,"ping-3ds-status",Ping3DSStatusResponse),N=handleEvents({elements:{host:R,cancelButton:M},pollingInterval:_,resolve:x=>{U({status:x.status,cleanup:C})}});M.addEventListener("click",L),runPayerAuth({stepUpUrl:T,accessToken:A,merchantData:P,iframe:O,host:R}).submit()})},runCybersource3dsFlow=async S=>{const T=parseResponseHeaders$1(S),{step_up_url:A,access_token:P,dd_url:O,dd_token:R,merchant_data:M}=T;if(O&&R){const y=await runDeviceDataCollection({postUrl:O,accessToken:R});log__$e("Device data collection completed with status:",y.Status)}else err__$f("No device data collection URL or token provided");const{host:D,iframe:U,cancelButton:C}=createAndOpenFrame("",{name:"cardinal_auth_iframe"});log__$e("Running Cybersource 3DS flow");const L=await handleCybersource3ds({stepUpUrl:A,accessToken:P,merchantData:M,iframe:U,host:D,cancelButton:C});if(L.cleanup(),L.status===ThreeDSStatus.FAILURE)throw new Error("3DS verification failed");if(L.status===ThreeDSStatus.CANCELLED)throw new Error("3DS verification cancelled");if(L.status===ThreeDSStatus.SUCCESS){log__$e("3DS verification succeeded");return}else assertNever(L.status)},{log__:log__$d,err__:err__$e}=createOjsFlowLoggers("pockyt-cc"),Pockyt3dsErrorResponseHeaders=objectType({"op-pockyt-3ds-url":stringType(),"op-pockyt-txn-no":stringType(),"op-pockyt-ref-no":stringType()}),parseResponseHeaders=S=>{const T=Pockyt3dsErrorResponseHeaders.safeParse(S);if(!T.success){const A="Unable to process your credit card. Please contact support for assistance.",P=`Pockyt 3DS is required but headers are malformed. Got: ${JSON.stringify(S)}`;throw err__$e(P),new Error(A)}return T.data},parseVaultIdFrom3dsHref=S=>{try{const T=new URL(S??"").searchParams.get("vaultId");if(!T)throw new Error("No vault ID found in 3DS verification result");return log__$d(`3DS verification success. [Vault ID: ${T}]`),T}catch(T){const A="Error verifying 3DS verification result.";throw err__$e(A,`Resulting URL: ${S}.
214
+ Error: ${getErrorMessage(T)}`),new Error(A)}},parseArgFromHref=(S,T)=>new URL(S).searchParams.get(T),checkIfRequiresPockyt3ds=S=>S?.["op-pockyt-3ds-url"]!==void 0,runPockyt3dsFlow=async(S,T)=>{const A=parseResponseHeaders(T),P=await start3dsVerificationStrict({url:A["op-pockyt-3ds-url"],baseUrl:S});return{existing_cc:{vault_id:parseVaultIdFrom3dsHref(P.href??""),transaction_no:A["op-pockyt-txn-no"],reference_no:A["op-pockyt-ref-no"]}}},{log__:stripeLog__}=createOjsFlowLoggers("stripe-cc"),Stripe3DSMetadataPayload=objectType({stripe_pk:stringType(),client_secret:stringType(),stripe_pm_id:stringType()}),stripeCC3DSFlow=async S=>{track("3ds_stripe_redirect",{...S}),stripeLog__(`├ Using stripe 3DS flow [Client Secret: ${S.client_secret.substring(0,8)}...]`),await launchStripe3DSDialogFlow(S),track("3ds_stripe_complete"),stripeLog__("╰ Stripe 3DS flow completed successfully")},parseUserFEPayload=S=>{const T=Stripe3DSMetadataPayload.safeParse(S);if(!T.success)throw new Error(`Stripe 3DS metadata has unexpected format: ${JSON.stringify(T.error.errors)}`);return{stripe_pk:T.data.stripe_pk,client_secret:T.data.client_secret,stripe_pm_id:T.data.stripe_pm_id}},MAX_CONFIRM_LOOP_ITERATIONS=4,{log__:log__$c,err__:err__$d}=createOjsFlowLoggers("unified-cc"),unsafelyRunUnifiedCcFlow=async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$c("├ Running unified CC flow...",{checkoutPaymentMethod:T});const R=S.anyCdeConnection,M=await getPrefill(R);log__$c(`├ Validating non-CDE form fields [Mode: ${M.mode}]`);const D=validateNonCdeFormFieldsForCC(A,P.get.onValidationError),U={session_id:S.elementsSessionId,checkout_payment_method:T,non_cde_form_fields:D,extra_metadata:{origin:window.location.origin,deviceToken:getDeviceToken()},use_unified_cc_flow:!0,pay_first_flow_cart_info:{line_items:M.line_items,displayed_total_amount_atom:M.amount_total_atom},payment_route_id:O.paymentRouteId};err__$d(O,U),log__$c(`├ Tokenizing card info in Partial PMs [Session: ${S.elementsSessionId}]`);const C=await tokenizeCardOnAllConnections(O.currentCdeConnections,{session_id:S.elementsSessionId});validateTokenizeCardResults(C,P.get.onValidationError);const L=await startPaymentFlowForCC(R,U);if(log__$c("├ startPf result",L),L.checkout_success_response)return returnSuccessResult(M.mode,L);if(!L.checkout_attempt_id)throw new Error("Invalid state: no checkout attempt ID from PF result");return runConfirmLoop({context:S,prefill:M,nonCdeFormInputs:A,commonCheckoutParams:U,anyCdeConnection:R,startPfResult:L,checkoutAttemptId:L.checkout_attempt_id})},runConfirmLoop=async S=>{const{context:T,prefill:A,nonCdeFormInputs:P,commonCheckoutParams:O,anyCdeConnection:R,startPfResult:M,checkoutAttemptId:D}=S;let U=M;for(let C=0;C<MAX_CONFIRM_LOOP_ITERATIONS;C++){log__$c(`├ Running confirm loop iteration ${C}`),track("unified_cc_confirm_loop_iteration",{iteration:C});const{userAction:L}=validatePfResultUserAction(U);try{const y=await runRequiredUserAction(T.baseUrl,L,A,P);O.extra_metadata={...O.extra_metadata,...y.metadataForConfirmStep},log__$c("├ New extra metadata",O.extra_metadata)}catch(y){const _=getErrorMessage(y);err__$d(`├ Error in running user action in iteration ${C}. Continuing to confirm step...`,_),track("unified_cc_user_action_error",{error_message:_,iteration:C})}if(U=await confirmPaymentFlow(R,{secure_token:A.token,checkout_attempt_id:D,processor_specific_metadata:O.extra_metadata}),log__$c(`├ confirmPf result (iteration ${C})`,U),U.checkout_success_response)return returnSuccessResult(A.mode,U)}throw track("unified_cc_unexpected_branch",{secure_token:A.token,checkout_attempt_id:U.checkout_attempt_id,confirmPFResult:U}),new Error("Checkout error, please try another payment method")},runRequiredUserAction=async(S,T,A,P)=>{if(T._unified_cc_action_name==="3DS_REQUIRED"){if(T.type==="stripe_3ds")return await stripeCC3DSFlow(parseUserFEPayload(T)),{metadataForConfirmStep:{}};if(checkIfRequiresAirwallex3ds(T))return{metadataForConfirmStep:{airwallex:await runAirwallex3dsFlow(S,T)}};if(checkIfRequiresAdyen3ds(T))return{metadataForConfirmStep:{adyen:await runAdyen3dsFlow(P[FieldName.COUNTRY],T,A.locale)}};if(checkIfRequiresCybersource3ds(T))return await runCybersource3dsFlow(T),{metadataForConfirmStep:{}};if(checkIfLegacy3DSPath(T))return await commonCC3DSFlow({required_user_actions:[T]},S),{metadataForConfirmStep:{}};throw new Error(`Unhandled 3DS user action: ${JSON.stringify(T)}`)}else throw new Error(`Unknown required user action: ${JSON.stringify(T)}`)},checkIfLegacy3DSPath=S=>{try{return parseCommon3DSNextActionMetadata([S]),!0}catch{return!1}},validatePfResultUserAction=S=>{if(S.required_user_actions){if(S.required_user_actions.length===0)throw new Error("Invalid state: no required user actions");if(S.required_user_actions.length>1)throw new Error("Invalid state: multiple required user actions")}else throw new Error("Invalid state: no required user actions");const T=UserActionFEPayload.safeParse(S.required_user_actions[0]);if(!T.success)throw err__$d("User action raw payload",S.required_user_actions[0]),err__$d("Parsing error",T.error),new Error("Invalid state: schema of user action payload is not valid");return{userAction:T.data}},returnSuccessResult=(S,T)=>{if(S==="setup"){const A=T.cc_pm_id??T.payment_methods?.[0].id;if(!A)throw new Error("Invalid state: no CC PM ID or payment_methods found in PF result");return{mode:"setup",result:{payment_method_id:A}}}else{if(!T.checkout_success_response)throw new Error("Invalid state: no checkout success response from startPF");return{mode:"checkout",result:T.checkout_success_response}}},{log__:log__$b,err__:err__$c}=createOjsFlowLoggers("common-cc");arrayType(objectType({our_existing_pm_id:stringType()})).length(1);const runCommonCcFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$b("├ Running common CC flow...",{checkoutPaymentMethod:T});const R=S.anyCdeConnection,M=await getPrefill(R);track("common_cc_flow_started",{...T,prefill:M});const D=M.final_feature_rollout_settings?.unified_cc??0;log__$b(`├ Unified CC rollout: ${Math.round(D*100)}%`);const U=Math.random(),C=U<D,L={roll:U,unifiedCCRolloutRatio:D,useUnifiedCCFlow:C};if(C)return log__$b(`├ Picked unified CC flow (${U} vs ${D})`),track("unified_cc_flow_picked",L),unsafelyRunUnifiedCcFlow({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O,initResult:void 0});log__$b(`├ Picked legacy CC flow (${U} vs ${D})`),track("legacy_cc_flow_picked",L),log__$b(`├ Validating non-CDE form fields [Mode: ${M.mode}]`);const y=validateNonCdeFormFieldsForCC(A,P.get.onValidationError,M.checkout_settings);track("billing_details_received",{...y});const _={session_id:S.elementsSessionId,checkout_payment_method:T,non_cde_form_fields:y,extra_metadata:{origin:window.location.origin},use_unified_cc_flow:!1,payment_route_id:O.paymentRouteId,customer_language:detectLanguage(),...createCustomerFieldsFromForm(y,M.checkout_settings)};try{log__$b(`├ Tokenizing card info in CDE [Session: ${S.elementsSessionId}]`);const N=await tokenizeCardOnAllConnections(O.currentCdeConnections,{session_id:S.elementsSessionId});if(validateTokenizeCardResults(N,P.get.onValidationError),M.mode==="setup"){log__$b(`├ Setting up payment method in CDE [Token: ${M.token}]`);const I=await setupCheckout(R,_);return log__$b(`╰ Setup completed successfully [PM ID: ${I.payment_method_id}]`),{mode:"setup",result:I}}else{log__$b(`├ Initial checkout flow. Checking out card info in CDE [Session: ${S.elementsSessionId}]`);const I=await checkoutCardElements(R,_);return log__$b("╰ Checkout completed successfully."),{mode:"checkout",result:I}}}catch(N){if(N instanceof CdeError&&N.originalErrorMessage.includes("3DS_REQUIRED")){log__$b("├ Card requires 3DS, starting non-legacy payment flow"),log__$b("Received 3DS error response headers:",N.response.headers),track("3ds_required",{...T,...N.response.headers});const I=N.response.headers??{};"op-existing-cc-pm-id"in I&&(_.existing_cc_pm_id=I["op-existing-cc-pm-id"],log__$b(`├ Existing CC PM ID: ${_.existing_cc_pm_id}`));const x=checkIfRequiresPockyt3ds(N.response.headers);if(x){log__$b("├ Pockyt 3DS case detected. Going through Pockyt 3DS flow.");const le=await runPockyt3dsFlow(S.baseUrl,N.response.headers);_.extra_metadata.pockyt=le}if(checkIfRequiresAirwallex3ds(N.response.headers)){log__$b("├ Airwallex 3DS case detected. Going through Airwallex 3DS flow.");const le=await runAirwallex3dsFlow(S.baseUrl,N.response.headers);_.extra_metadata.airwallex=le}if(checkIfRequiresAdyen3ds(N.response.headers)){log__$b("├ Adyen 3DS case detected. Going through Adyen 3DS flow.");const le=await runAdyen3dsFlow(A[FieldName.COUNTRY],N.response.headers,M.locale);_.extra_metadata.adyen=le}const F=await startPaymentFlowForCC(R,_);log__$b("├ Start payment flow result:",F);const W=F.required_user_actions.find(le=>le.type==="cybersource_payer_auth");if(W){log__$b("├ Cybersource 3DS case detected. Going through Cybersource 3DS flow.");const le=CybersourceActionPayload.parse(W),Re=await runCybersource3dsFlow({...le,_unified_cc_action_name:"",_unified_cc_pccs_id:""});_.extra_metadata.cybersource=Re}const ee=N.response.headers?.["op-should-use-new-flow"]!=="true";!x&&!W?ee?(log__$b("├ Using stripe 3DS flow"),await stripeCC3DSFlow(parseStripe3DSNextActionMetadata(F))):(log__$b("├ Using common 3DS flow"),await commonCC3DSFlow(F,S.baseUrl)):log__$b("├ Pre-start 3DS is successful, other 3DS flows will be skipped.");const ne=F.cc_pm_id;if(M.mode==="setup"){log__$b(`├ Confirming payment flow [cc_pm_id: ${ne}]`);const le=await confirmPaymentFlow(R,{secure_token:M.token,existing_cc_pm_id:ne});log__$b("├ Confirm payment flow result received Result:",le);const Re=parseConfirmPaymentFlowResponse(le);return log__$b(`╰ Setup completed successfully [PM ID: ${Re.payment_method_id}]`),{mode:"setup",result:Re}}else{log__$b(`├ Checking out after 3DS flow [Flow: ${ee?"legacy":"new"}]`);const le=await checkoutCardElements(R,{..._,existing_cc_pm_id:ne,do_not_use_legacy_cc_flow:ee});return log__$b("╰ Checkout completed successfully."),{mode:"checkout",result:le}}}throw err__$c("╰ Error checking out card info in CDE"),err__$c(N),N}}),parseStripe3DSNextActionMetadata=S=>{const T=S.required_user_actions.find(A=>A.type==="stripe_3ds");if(!T)throw new Error("No stripe 3DS action found");return Stripe3DSNextActionMetadata.parse(T)},common3DSActionTypes=["airwallex_payment_consent","adyen"],parseCommon3DSNextActionMetadata=S=>{const T=S.find(A=>common3DSActionTypes.includes(A.type));if(!T)throw new Error("No common 3DS action found");return Common3DSNextActionMetadata.parse(T)},commonCC3DSFlow=async(S,T)=>{const A=parseCommon3DSNextActionMetadata(S.required_user_actions);if(A.redirect_url==="3DS_COMPLETE"){log__$b("├ 3DS flow completed successfully"),track("3ds_complete");return}log__$b(`├ Using common 3DS flow [URL: ${A.redirect_url}]`),track("3ds_redirect",{...A});const{status:P}=await start3dsVerification({url:A.redirect_url,baseUrl:T});if(log__$b(`╰ 3DS verification completed [Status: ${P}]`),P===ThreeDSStatus.CANCELLED)throw track("3ds_cancelled"),new Error("3DS verification cancelled");if(P===ThreeDSStatus.FAILURE)throw track("3ds_failure"),new Error("3DS verification failed");track("common_3ds_completed")},LoopCryptoCpm=objectType({processor_name:literalType("loop"),provider:literalType("crypto"),metadata:objectType({merchant_id:stringType(),entity_id:stringType(),api_token:stringType(),supported_currencies:arrayType(stringType()),environment:stringType()})}),{log__:log__$a,err__:err__$b}=createOjsFlowLoggers("loop-crypto"),initLoopFlow=addErrorCatcherForInit(async({context:S})=>{log__$a("Checking if there are any CPMs for Loop Crypto...");const T=findCpmMatchingType(S.checkoutPaymentMethods,LoopCryptoCpm);log__$a(`checkoutPaymentMethod: ${JSON.stringify(T)}`),log__$a("Starting Loop Crypto flow...");const A=await getPrefill(S.anyCdeConnection),P=A.mode==="setup",O=await preparePaymentFlow(S.anyCdeConnection,{checkout_payment_method:T}),R=await getCheckoutPreviewAmount(S.anyCdeConnection,A.token,P,void 0);if(!P&&!T.metadata.supported_currencies.includes(A.currency))throw Error(`Currency ${A.currency} not enabled for Loop. Enabled currencies: ${T.metadata.supported_currencies}`);if(!O||!O.next_action_metadata)throw Error("Failed to fetch necessary setup data for Loop");const M=O.next_action_metadata;let D=M.authorization_amount,U=M.min_authorization_amount;const C=M.allow_customer_to_choose_auth;let L;P?(L=0,D=Math.max(D,U)):(L=(R?R.amountAtom:A.amount_total_atom)*M.token_price,U=Math.max(U,L),D=Math.max(D,U));const y=L,_=v4(),N={paymentUsdAmount:y,suggestedAuthorizationUsdAmount:D,customerRefId:_,minAuthorizationUsdAmount:U,allowCustomerToChooseAuth:C},I={apiToken:T.metadata.api_token,entityId:T.metadata.entity_id,merchantId:T.metadata.merchant_id,environment:T.metadata.environment};return{isAvailable:!0,widgetProps:N,initLoopConnectProps:I}}),runLoopFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$a("Running Loop flow..."),log__$a("context",S),log__$a("checkoutPaymentMethod",T),log__$a("nonCdeFormInputs",A),log__$a("flowCallbacks",P),log__$a("customParams",O);const R=await getPrefill(S.anyCdeConnection);log__$a(`├ Validating non-CDE form fields [Mode: ${R.mode}]`);const M=validateNonCdeFormFieldsForCC(A,P.get.onValidationError,R.checkout_settings),D=S.anyCdeConnection,U=R.mode!=="setup",C=createCustomerFieldsFromForm(M,R.checkout_settings);if(!O)throw new Error("Checkout failed. Failed to properly submit form data.");if(!O.success)throw track("loop_pay_flow_failure",O),new Error("Checkout failed. Success is not true.");const L=await startPaymentFlow(S.anyCdeConnection,{checkout_payment_method:T,payment_provider:T.provider,...C,use_pay_first_flow:U,pay_first_flow_cart_info:U?{line_items:R.line_items,displayed_total_amount_atom:R.amount_total_atom,promotion_code:M[FieldName.PROMOTION_CODE]}:void 0,customer_language:detectLanguage()}),y=await confirmPaymentFlow(D,{secure_token:R.token,their_pm_id:O.paymentMethod.paymentMethodId,checkout_attempt_id:U?L.checkout_attempt_id:void 0,processor_specific_metadata:{loop_customer:O.customer,loop_payment_method:O.paymentMethod,loop_success:O.success,loop_payin_id:O.payinId}});if(log__$a(`Confirm result: ${y}`),R.mode==="setup"){log__$a("Doing payment setup..."),log__$a("├ Confirm payment flow result received Result:",y);const _=parseConfirmPaymentFlowResponse(y);return log__$a(`╰ Setup completed successfully [PM ID: ${_.payment_method_id}]`),{mode:"setup",result:_}}else{if(log__$a("Doing checkout..."),!y.pay_first_success_response)throw err__$b("Checkout failed, no pay-first success response:",y),new Error("Checkout failed, please try again with another payment method.");return{mode:"checkout",result:y.pay_first_success_response}}}),{log__:log__$9,err__:err__$a}=createOjsFlowLoggers("paypal"),PaypalCpm=objectType({provider:literalType("paypal"),metadata:objectType({client_id:stringType()}),processor_name:literalType("paypal")}),initPaypalFlow=async({context:S,formCallbacks:T})=>{const A=findCpmMatchingType(S.checkoutPaymentMethods,PaypalCpm);if(!A)throw new Error("PayPal CPM not found in available payment methods");return{isLoading:!1,isAvailable:!0,startFlow:()=>OjsFlows.paypal.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:{settings:{}}})}},runPaypalFlow=addBasicCheckoutCallbackHandlers(async({context:S,nonCdeFormInputs:T,checkoutPaymentMethod:A,formCallbacks:P,customParams:O})=>{try{log__$9("Running PayPal flow...");const R=S.anyCdeConnection,M=await getPrefill(R),{isAnonymous:D,useRedirectFlow:U}=O.settings??{};log__$9("Verifying CPM...");const C=PaypalCpm.parse(A);log__$9("├ Validating non-CDE form fields");const L=validateNonCdeFormFieldsForCC(T,P.get.onValidationError,{...D?generateAnonymousValues():void 0,...M.checkout_settings}),y=createCustomerFieldsFromForm(L,M.checkout_settings);log__$9(`Starting payment flow... Mode: ${M.mode}`);const _=v4(),N=!1,I={payment_provider:C.provider,checkout_payment_method:C,use_pay_first_flow:N,pay_first_flow_cart_info:N?{line_items:M.line_items,displayed_total_amount_atom:M.amount_total_atom}:void 0,processor_specific_metadata:{use_paypal_redirect_flow:U,frontend_token_for_redirect_flow:_},...y},x=new URL("/app/pre-action/start/",S.baseUrl).toString(),V=btoa(JSON.stringify(I)),k=new URLSearchParams({st:M.token,r:V}),F=`${x}?${k.toString()}`;if(U)throw log__$9("Starting redirect mode for PayPal..."),window.location.href=F,await sleep(20*1e3),new Error("Paypal flow timed out, please try again with another payment method.");const W=await startPopupWindowVerificationStrict("PayPal",R,_,F);log__$9("Paypal flow result",W);const ee=parseArgFromHref(W.href,"catt"),ne=parseArgFromHref(W.href,"approval_session_id"),le=await confirmPaymentFlow(R,{secure_token:M.token,checkout_attempt_id:N?ee:void 0,their_pm_id:N?ne:void 0});return log__$9("Confirm payment flow result",le),performSimpleCheckoutOrSetup({logPrefix:"paypal",anyCdeConnection:R,checkoutPaymentMethod:C,requiredFormFields:L,confirmResult:le,usePayFirstFlow:N})}catch(R){throw err__$a("PayPal payment error",R),track("checkout_error",{payment_method:"paypal",error:R}),new Error(R?.message??"Unknown error")}}),{log__:log__$8,err__:err__$9}=createOjsFlowLoggers("pockyt-paypal"),PockytPaypalCpm=objectType({processor_name:literalType("pockyt"),provider:literalType("paypal")});arrayType(objectType({paypal_iframe_url:stringType(),verify_token:stringType()})).length(1);const initPockytPaypalFlow=async({context:S,formCallbacks:T})=>{const A=findCpmMatchingType(S.checkoutPaymentMethods,PockytPaypalCpm);if(!A)throw new Error("Pockyt PayPal CPM not found in available payment methods");return{isLoading:!1,isAvailable:!0,startFlow:()=>OjsFlows.pockytPaypal.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,initResult:void 0,customParams:{settings:{}}})}},runPockytPaypalFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$8("Running Pockyt Paypal flow...");const R=S.anyCdeConnection,M=await getPrefill(R);log__$8("Verifying CPM...");const D=PockytPaypalCpm.parse(T);log__$8("├ Validating non-CDE form fields");const U=O?.settings,C=validateNonCdeFormFieldsForCC(A,P.get.onValidationError,U?.defaultFieldValues),L=createCustomerFieldsFromForm(C,M.checkout_settings);log__$8(`Starting payment flow... Mode: ${M.mode}`);const y=v4(),_=M.mode!=="setup",N={payment_provider:D.provider,checkout_payment_method:D,use_pay_first_flow:_,pay_first_flow_cart_info:_?{line_items:M.line_items,displayed_total_amount_atom:M.amount_total_atom}:void 0,processor_specific_metadata:{use_paypal_redirect_flow:!!O?.settings?.useRedirectFlow,frontend_token_for_redirect_flow:y},...L},I=new URL("/app/pre-action/start/",S.baseUrl).toString(),x=btoa(JSON.stringify(N)),V=new URLSearchParams({st:M.token,r:x}),k=`${I}?${V.toString()}`;if(O?.settings?.useRedirectFlow)throw log__$8("Starting redirect mode for PayPal..."),window.location.href=k,await sleep(20*1e3),new Error("Paypal flow timed out, please try again with another payment method.");log__$8("Starting popup mode for PayPal..."),log__$8("Opening paypal iframe...");const F=await startPopupWindowVerificationStrict("PayPal",R,y,k);log__$8("Paypal flow result",F);const W=parseVaultIdFrom3dsHref(F.href),ee=parseArgFromHref(F.href,"catt");if(!ee)throw err__$9("Checkout attempt ID not found in redirect URL:",F.href),new Error("Checkout attempt ID not found in redirect URL");log__$8(`Confirming payment flow using vault ID ${W}`);const ne=await confirmPaymentFlow(R,{secure_token:M.token,their_pm_id:W,checkout_attempt_id:_?ee:void 0});if(log__$8("Confirm payment flow result",ne),M.mode==="setup")return{mode:"setup",result:{payment_method_id:ne.payment_methods[0].id}};if(!ne.pay_first_success_response)throw err__$9("Checkout failed, no pay-first success response:",ne),new Error("Checkout failed, please try again with another payment method.");return{mode:"checkout",result:ne.pay_first_success_response}}),{log__:log__$7,err__:err__$8}=createOjsFlowLoggers("stripe-affirm"),StripeAffirmCpm=objectType({provider:literalType("affirm"),processor_name:literalType("stripe"),metadata:objectType({stripe_pk:stringType()})}),StripeAffirmRequiredUserActions=arrayType(objectType({our_existing_pm_id:stringType().nullish(),client_secret:stringType()})).length(1),initStripeAffirmFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{log__$7("Checking if there are any CPMs for Stripe Affirm...");const A=findCpmMatchingType(S.checkoutPaymentMethods,StripeAffirmCpm);if(!A)return log__$7("No Stripe Affirm CPM found"),{isAvailable:!1,startFlow:async()=>{}};log__$7("Starting stripe affirm flow...");const P=S.anyCdeConnection;return(await getPrefill(P)).mode==="setup"?(log__$7("Setup mode is not supported for Stripe Affirm flow"),{isAvailable:!1,startFlow:async()=>{}}):{isAvailable:!0,startFlow:async D=>{try{return OjsFlows.stripeAffirm.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:D??{},initResult:{isAvailable:!0}})}catch(U){throw err__$8("Error starting Affirm flow:",U),U}}}}),runStripeAffirmFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P})=>{log__$7("Running Stripe Affirm pay-first flow...");const O=S.anyCdeConnection,R=await getPrefill(O);log__$7("Validating form fields...");const M=validateNonCdeFormFieldsForCC(A,P.get.onValidationError);track("billing_details_received",{...M}),log__$7("Creating cart info for pay-first flow...");const D={line_items:R.line_items.map(k=>({price_id:k.price_id,quantity:k.quantity})),promotion_code:M[FieldName.PROMOTION_CODE]||void 0,displayed_total_amount_atom:R.amount_total_atom};log__$7("Starting pay-first payment flow for Affirm...");const U=await startPaymentFlow(O,{payment_provider:T.provider,checkout_payment_method:T,use_pay_first_flow:!0,pay_first_flow_cart_info:D,...createCustomerFieldsFromForm(M,R.checkout_settings),customer_language:detectLanguage()});log__$7("Start payment flow response",U);const C=StripeAffirmRequiredUserActions.parse(U.required_user_actions),{client_secret:L}=C[0];log__$7("Client secret for payment intent",L);const y=findCpmMatchingType(S.checkoutPaymentMethods,StripeAffirmCpm);if(!y)throw new Error("Stripe Affirm CPM not found");const{stripe:_}=await createStripeElements(y.metadata.stripe_pk,{mode:"payment",currency:R.currency??"usd",amount:R.amount_total_atom});log__$7("Stripe instance created",_);const N=generateBillingAddressFromFields(M),I=`${M[FieldName.FIRST_NAME]} ${M[FieldName.LAST_NAME]}`,x={return_url:new URL("/app/3ds/success/",S.baseUrl).toString(),payment_method:{billing_details:{email:M[FieldName.EMAIL],name:I,address:{line1:N.line1,line2:N.line2||void 0,city:N.city,state:N.state,country:N.country,postal_code:N.zip_code}}}},V={handleActions:!1};log__$7(`Confirming Affirm payment with client secret: ${L}`);try{const{error:k,paymentIntent:F}=await _.confirmAffirmPayment(L,x,V);if(k)throw err__$8("Affirm payment confirmation error:",k),new Error(`Affirm payment failed: ${k.message}`);log__$7("Affirm payment confirmed successfully",F);const W=F?.next_action?.redirect_to_url?.url;if(!W)return err__$8("No redirect URL found in Klarna payment confirmation"),P.get.onCheckoutError("Klarna payment failed"),{mode:"checkout",result:{invoice_urls:[],subscription_ids:[],customer_id:"",payment_method_id:""}};log__$7("Payment requires additional action, starting 3DS verification...");const{status:ee}=await start3dsVerification({url:W,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"Affirm verification"});if(ee===ThreeDSStatus.FAILURE)throw new Error("Verification failed");if(ee===ThreeDSStatus.CANCELLED)throw new Error("Verification cancelled");log__$7("3DS verification completed successfully");const ne=F?.payment_method?.toString()??void 0,le=await confirmPaymentFlow(O,{secure_token:R.token,checkout_attempt_id:U.checkout_attempt_id,their_pm_id:ne});return log__$7("Payment flow confirmed",le),performSimpleCheckoutOrSetup({logPrefix:"stripe-affirm",anyCdeConnection:O,checkoutPaymentMethod:T,requiredFormFields:M,confirmResult:le,usePayFirstFlow:!0})}catch(k){throw err__$8("Error in Affirm payment flow:",k),k}}),{log__:log__$6,err__:err__$7}=createOjsFlowLoggers("stripe-afterpay"),StripeAfterpayCpm=objectType({provider:literalType("afterpay"),processor_name:literalType("stripe"),metadata:objectType({stripe_pk:stringType()})}),StripeAfterpayRequiredUserActions=arrayType(objectType({our_existing_pm_id:stringType().nullish(),client_secret:stringType()})).length(1),initStripeAfterpayFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{log__$6("Checking if there are any CPMs for Stripe Afterpay...");const A=findCpmMatchingType(S.checkoutPaymentMethods,StripeAfterpayCpm);if(!A)return log__$6("No Stripe Afterpay CPM found"),{isAvailable:!1,startFlow:async()=>{}};log__$6("Starting stripe afterpay flow...");const P=S.anyCdeConnection;return(await getPrefill(P)).mode==="setup"?(log__$6("Setup mode not supported for Stripe Afterpay flow"),{isAvailable:!1,startFlow:async()=>{}}):{isAvailable:!0,startFlow:async D=>{try{return OjsFlows.stripeAfterpay.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:D??{},initResult:{isAvailable:!0}})}catch(U){throw err__$7("Error starting Afterpay flow:",U),U}}}}),runStripeAfterpayFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P})=>{log__$6("Running Stripe Afterpay pay-first flow...");const O=S.anyCdeConnection,R=await getPrefill(O);log__$6("Validating form fields...");const M=validateNonCdeFormFieldsForCC(A,P.get.onValidationError);track("billing_details_received",{...M}),log__$6("Creating cart info for pay-first flow...");const D={line_items:R.line_items.map(k=>({price_id:k.price_id,quantity:k.quantity})),promotion_code:M[FieldName.PROMOTION_CODE]||void 0,displayed_total_amount_atom:R.amount_total_atom};log__$6("Starting pay-first payment flow for Afterpay...");const U=await startPaymentFlow(O,{payment_provider:T.provider,checkout_payment_method:T,use_pay_first_flow:!0,pay_first_flow_cart_info:D,...createCustomerFieldsFromForm(M,R.checkout_settings),customer_language:detectLanguage()});log__$6("Start payment flow response",U);const C=StripeAfterpayRequiredUserActions.parse(U.required_user_actions),{client_secret:L}=C[0];log__$6("Client secret for payment intent",L);const y=findCpmMatchingType(S.checkoutPaymentMethods,StripeAfterpayCpm);if(!y)throw new Error("Stripe Afterpay CPM not found");const{stripe:_}=await createStripeElements(y.metadata.stripe_pk,{mode:"payment",currency:R.currency??"usd",amount:R.amount_total_atom});log__$6("Stripe instance created",_);const N=generateBillingAddressFromFields(M),I=`${M[FieldName.FIRST_NAME]} ${M[FieldName.LAST_NAME]}`,x={return_url:new URL("/app/3ds/success/",S.baseUrl).toString(),payment_method:{billing_details:{email:M[FieldName.EMAIL],name:I,address:{line1:N.line1,line2:N.line2||void 0,city:N.city,state:N.state,country:N.country,postal_code:N.zip_code}}}},V={handleActions:!1};log__$6(`Confirming Afterpay payment with client secret: ${L}`);try{const k=await _.confirmAfterpayClearpayPayment(L,x,V);if(log__$6("Afterpay payment confirmation result:",k),k.paymentIntent?.next_action?.type==="redirect_to_url"){const F=k.paymentIntent?.next_action?.redirect_to_url?.url;if(!F)return err__$7("No redirect URL found in Afterpay payment confirmation"),P.get.onCheckoutError("Afterpay payment failed"),{mode:"checkout",result:{invoice_urls:[],subscription_ids:[],customer_id:"",payment_method_id:""}};log__$6("Afterpay verification Required, starting verification...");const{status:W}=await start3dsVerification({url:F,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"Afterpay verification"});if(log__$6(`╰ Afterpay verification completed [Status: ${W}]`),W===ThreeDSStatus.CANCELLED)throw new Error("Afterpay verification cancelled");if(W===ThreeDSStatus.FAILURE)throw new Error("Afterpay verification failed");log__$6("Afterpay verification completed, confirming with backend...");const ee=k.paymentIntent?.payment_method?.toString()??void 0,ne=await confirmPaymentFlow(O,{secure_token:R.token,checkout_attempt_id:U.checkout_attempt_id,their_pm_id:ee});return performSimpleCheckoutOrSetup({logPrefix:"stripe-afterpay",anyCdeConnection:O,checkoutPaymentMethod:T,requiredFormFields:M,confirmResult:ne,usePayFirstFlow:!0})}else throw log__$6("No redirect URL found in Afterpay payment confirmation"),new Error("No redirect URL found in Afterpay payment confirmation")}catch(k){err__$7("Error in Afterpay checkout flow:",k);const F=k instanceof Error?k.message:"Afterpay payment failed";throw new Error(F)}}),{log__:log__$5,err__:err__$6}=createOjsFlowLoggers("stripe-klarna"),StripeKlarnaCpm=objectType({provider:literalType("klarna"),processor_name:literalType("stripe"),metadata:objectType({stripe_pk:stringType()})}),StripeKlarnaRequiredUserActions=arrayType(objectType({our_existing_pm_id:stringType().nullish(),client_secret:stringType()})).length(1),initStripeKlarnaFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{log__$5("Checking if there are any CPMs for Stripe Klarna...");const A=findCpmMatchingType(S.checkoutPaymentMethods,StripeKlarnaCpm);if(!A)return log__$5("No Stripe Klarna CPM found"),{isAvailable:!1,startFlow:async()=>{}};log__$5("Starting stripe klarna flow...");const P=S.anyCdeConnection;return(await getPrefill(P)).mode==="setup"?(log__$5("Setup mode is not supported for Stripe Klarna flow"),{isAvailable:!1,startFlow:async()=>{}}):{isAvailable:!0,startFlow:async D=>{try{return OjsFlows.stripeKlarna.run({context:S,checkoutPaymentMethod:A,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:D??{},initResult:{isAvailable:!0}})}catch(U){throw err__$6("Error starting Klarna flow:",U),U}}}}),runStripeKlarnaFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P})=>{log__$5("Running Stripe Klarna pay-first flow...");const O=S.anyCdeConnection,R=await getPrefill(O);log__$5("Validating form fields...");const M=validateNonCdeFormFieldsForCC(A,P.get.onValidationError);track("billing_details_received",{...M}),log__$5("Creating cart info for pay-first flow...");const D={line_items:R.line_items.map(k=>({price_id:k.price_id,quantity:k.quantity})),promotion_code:M[FieldName.PROMOTION_CODE]||void 0,displayed_total_amount_atom:R.amount_total_atom};log__$5("Starting pay-first payment flow for Klarna...");const U=await startPaymentFlow(O,{payment_provider:T.provider,checkout_payment_method:T,use_pay_first_flow:!0,pay_first_flow_cart_info:D,...createCustomerFieldsFromForm(M,R.checkout_settings),customer_language:detectLanguage()});log__$5("Start payment flow response",U);const C=StripeKlarnaRequiredUserActions.parse(U.required_user_actions),{client_secret:L}=C[0];log__$5("Client secret for payment intent",L);const y=findCpmMatchingType(S.checkoutPaymentMethods,StripeKlarnaCpm);if(!y)throw new Error("Stripe Klarna CPM not found");const{stripe:_}=await createStripeElements(y.metadata.stripe_pk,{mode:"payment",currency:R.currency??"usd",amount:R.amount_total_atom});log__$5("Stripe instance created",_);const N=generateBillingAddressFromFields(M),I=`${M[FieldName.FIRST_NAME]} ${M[FieldName.LAST_NAME]}`,x={return_url:new URL("/app/3ds/success/",S.baseUrl).toString(),payment_method:{billing_details:{email:M[FieldName.EMAIL],name:I,address:{line1:N.line1,line2:N.line2||void 0,city:N.city,state:N.state,country:N.country,postal_code:N.zip_code}}}},V={handleActions:!1};log__$5(`Confirming Klarna payment with client secret: ${L}`);try{const k=await _.confirmKlarnaPayment(L,x,V);if(log__$5("Klarna payment confirmation result:",k),k.paymentIntent?.next_action?.type==="redirect_to_url"){const F=k.paymentIntent?.next_action?.redirect_to_url?.url;if(!F)return err__$6("No redirect URL found in Klarna payment confirmation"),P.get.onCheckoutError("Klarna payment failed"),{mode:"checkout",result:{invoice_urls:[],subscription_ids:[],customer_id:"",payment_method_id:""}};log__$5("Klarna verification Required, starting verification...");const{status:W}=await start3dsVerification({url:F,baseUrl:S.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"Klarna verification"});if(log__$5(`╰ Klarna verification completed [Status: ${W}]`),W===ThreeDSStatus.CANCELLED)throw new Error("Klarna verification cancelled");if(W===ThreeDSStatus.FAILURE)throw new Error("Klarna verification failed");log__$5("Klarna verification completed, confirming with backend...");const ee=k.paymentIntent?.payment_method?.toString()??void 0,ne=await confirmPaymentFlow(O,{secure_token:R.token,checkout_attempt_id:U.checkout_attempt_id,their_pm_id:ee});return performSimpleCheckoutOrSetup({logPrefix:"stripe-klarna",anyCdeConnection:O,checkoutPaymentMethod:T,requiredFormFields:M,confirmResult:ne,usePayFirstFlow:!0})}else throw log__$5("No redirect URL found in Klarna payment confirmation"),new Error("No redirect URL found in Klarna payment confirmation")}catch(k){err__$6("Error in Klarna checkout flow:",k);const F=k instanceof Error?k.message:"Klarna payment failed";throw new Error(F)}}),OJS_STRIPE_LINK_BTN_ID="ojs-stripe-link-btn",{log__:log__$4,err__:err__$5}=createOjsFlowLoggers("stripe-link"),StripeLinkCpm=objectType({provider:literalType("stripe_link"),processor_name:literalType("stripe"),metadata:objectType({stripe_pk:stringType()})}),StripeLinkRequiredUserActions=arrayType(objectType({our_existing_pm_id:stringType()})).length(1),initStripeLinkFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{const A=S.customInitParams.stripeLink;log__$4("Checking if there are any CPMs for Stripe Link...");const P=findCpmMatchingType(S.checkoutPaymentMethods,StripeLinkCpm);log__$4("Starting stripe link flow...");const O=S.anyCdeConnection,R=await getPrefill(O),M=R.mode==="setup";log__$4("Creating stripe elements...");const D=await getCheckoutPreviewAmount(O,R.token,M,void 0),{elements:U,stripe:C}=await createStripeElements(P.metadata.stripe_pk,{mode:"setup",currency:D.currency,setup_future_usage:"off_session",paymentMethodCreation:"manual"}),L=U.create("linkAuthentication");log__$4("Creating express checkout...");const y=U.create("expressCheckout",{buttonHeight:A?.buttonHeight,paymentMethods:{amazonPay:"never",applePay:"never",googlePay:"never",paypal:"never"}}),_=(x,V)=>{let k=document.querySelector(x);k||(err__$5(`Recommanded to render a container with ${x} to avoid rendering in the body`),k=document.body);const F=document.createElement("div");k?.appendChild(F),L.mount(F);let W=!1,ee=!1;if(L.once("ready",()=>{ee=!0,A?.onAuthenticationElementReady?.()}),V){F.style.visibility="hidden",F.style.position="absolute",F.style.top="-1000px",F.style.left="-1000px",F.style.zIndex="-1",L.on("change",le=>{W=le.complete||!!le.value.email,ee&&A?.onAuthenticationStatusChange?.(W)});const ne=F.querySelector("iframe");ne&&new MutationObserver(()=>{const Qe=ne.offsetHeight>160;ee&&A?.onAuthenticationStatusChange?.(W||Qe)}).observe(ne,{attributes:!0,attributeFilter:["style"]})}return L},N=x=>{y.mount(x||`#${OJS_STRIPE_LINK_BTN_ID}`)},I=()=>{y.unmount()};return A?.doNotMountOnInit?log__$4("NOT mounting stripe link button (doNotMountOnInit is true)"):(log__$4("Mounting stripe link button..."),N()),A?.silentlyCheckAuthentication&&(log__$4(`Silently mounting link authentication element at #${OJS_STRIPE_LINK_BTN_ID}...`),_(`#${OJS_STRIPE_LINK_BTN_ID}`,!0)),y.on("click",async x=>{if(log__$4("Stripe Link button clicked"),A?.overrideLinkSubmit&&!await A.overrideLinkSubmit()){log__$4("Stripe Link submit aborted by overrideLinkSubmit");return}x.resolve()}),y.on("confirm",async x=>{log__$4("Stripe Link window confirmed",x);const V=await C.createPaymentMethod({elements:U,params:{billing_details:x.billingDetails}});V.error?(err__$5("error",V.error),T.get.onCheckoutError(V.error.message??"Stripe Link unknown error")):(log__$4("paymentMethod",V.paymentMethod),OjsFlows.stripeLink.run({context:S,checkoutPaymentMethod:P,nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:{stripePM:V.paymentMethod},initResult:{isAvailable:!0}}))}),{isAvailable:!0,controller:{mountButton:N,dismountButton:I,mountLinkAuthenticationElement:x=>_(x,!1),waitForButtonToMount:async()=>await getElementByIdAsync(OJS_STRIPE_LINK_BTN_ID)}}}),runStripeLinkFlow=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O})=>{log__$4("Running Stripe Link flow...");const R=S.anyCdeConnection,M=await getPrefill(R);log__$4("Merging PM fields with form fields...");const D=fillEmptyFormInputsWithStripePM(A,O.stripePM),U=validateNonCdeFormFieldsForCC(D,P.get.onValidationError);track("billing_details_received",{...U}),log__$4("Starting payment flow...");const C=await startPaymentFlow(R,{payment_provider:T.provider,checkout_payment_method:T,their_existing_pm_id:O.stripePM.id,...createCustomerFieldsFromForm(U,M.checkout_settings),customer_language:detectLanguage()});log__$4("Start payment flow response",C);const y=StripeLinkRequiredUserActions.parse(C.required_user_actions)[0].our_existing_pm_id;if(M.mode==="setup"){log__$4("Doing payment setup...");const _=await confirmPaymentFlow(R,{secure_token:M.token,existing_cc_pm_id:y});return{mode:"setup",result:parseConfirmPaymentFlowResponse(_)}}else{log__$4("Doing checkout...");const _={secure_token:M.token,payment_input:{provider_type:T.provider},customer_email:U[FieldName.EMAIL],customer_first_name:U[FieldName.FIRST_NAME],customer_last_name:U[FieldName.LAST_NAME],customer_address:generateBillingAddressFromFields(U),customer_shipping_address:generateShippingAddressFromFields(U,M.checkout_settings),promotion_code:U[FieldName.PROMOTION_CODE],line_items:M.line_items,total_amount_atom:M.amount_total_atom,cancel_at_end:!1,checkout_payment_method:T};return{mode:"checkout",result:await performCheckout(R,_)}}}),fillEmptyFormInputsWithStripePM=(S,T)=>{const A={...S},[P,...O]=T.billing_details.name?.trim()?.split(/\s+/)??[],R=O.join(" ")||void 0;A[FieldName.EMAIL]=A[FieldName.EMAIL]||T.link?.email||T.billing_details.email||"op_unfilled@getopenpay.com",A[FieldName.ZIP_CODE]=A[FieldName.ZIP_CODE]||T.billing_details.address?.postal_code||"00000",A[FieldName.COUNTRY]=A[FieldName.COUNTRY]||T.billing_details.address?.country||"US";const M=A[FieldName.FIRST_NAME]||P||"",D=A[FieldName.LAST_NAME]||R||"";return M||D?(A[FieldName.FIRST_NAME]=M,A[FieldName.LAST_NAME]=D):(A[FieldName.FIRST_NAME]="_OP_UNKNOWN",A[FieldName.LAST_NAME]=""),log__$4("Final form inputs:",A),A},getElementByIdAsync=S=>new Promise(T=>{const A=()=>{const P=document.getElementById(S);P?T(P):requestAnimationFrame(A)};A()}),{log__:log__$3,err__:err__$4}=createOjsFlowLoggers("stripe-pr"),StripePrCpm=objectType({provider:unionType([literalType("apple_pay"),literalType("google_pay")]),processor_name:literalType("stripe"),metadata:objectType({stripe_pk:stringType()})}),initStripePrFlow=addErrorCatcherForInit(async({context:S,formCallbacks:T})=>{log__$3("Checking if there are any CPMs for Stripe PR...");const A=findCpmMatchingType(S.checkoutPaymentMethods,StripePrCpm);log__$3("Initializing Stripe PR flow...");const P=S.anyCdeConnection,O=await getPrefill(P),R=O.mode==="setup";log__$3("Getting initial preview amount");const M=await getCheckoutPreviewAmount(P,O.token,R,void 0),D=await createStripePaymentRequest(A.metadata.stripe_pk,M.amountAtom,M.currency,R);log__$3("Checking if can make payment");const U=await D.canMakePayment();if(U===null)return err__$4("canMakePayment returned null"),{isAvailable:!1,reason:"canMakePayment returned null"};log__$3("Stripe PR flow initialized successfully. Can make payment",U);const C=(L,y)=>OjsFlows.stripePR.run({context:S,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(S.checkoutPaymentMethods,L),nonCdeFormInputs:createInputsDictFromForm(S.formDiv),formCallbacks:T,customParams:{provider:L,overridePaymentRequest:y?.overridePaymentRequest},initResult:{processor:PaymentProcessor.Enum.stripe,pr:D,isAvailable:!0,availableProviders:{applePay:U.applePay,googlePay:U.googlePay},startFlow:C}});return{processor:PaymentProcessor.Enum.stripe,isAvailable:!0,pr:D,availableProviders:{applePay:U.applePay,googlePay:U.googlePay},startFlow:C}}),runStripePrFlow$1=addBasicCheckoutCallbackHandlers(async({context:S,checkoutPaymentMethod:T,nonCdeFormInputs:A,formCallbacks:P,customParams:O,initResult:R})=>{if(log__$3("Running Stripe PR flow..."),O.provider!==T.provider)throw new Error(`Provider mismatch. Expected ${O.provider}, got ${T.provider}`);const M=S.anyCdeConnection,D=R.pr,U=await getPrefill(M),C=U.mode==="setup",L=O?.overridePaymentRequest,y=L?typeof L.applePayPaymentRequest=="function"?L.applePayPaymentRequest({}):L.applePayPaymentRequest:void 0,_=!!sessionStorage.getItem("promoCode");D.isShowing()||(_?await getCheckoutPreviewAmount(M,U.token,C,void 0).then(F=>{if(L){log__$3("Overriding PR amount with",L,"freshPreview:",F);const W=L.amount??F;updatePrWithAmount(D,W,L.pending??!1,y,L.label??"Total")}else log__$3("PR flow: No override, using fresh preview:",F),updatePrWithAmount(D,F,!1,void 0,"Total")}):L&&(log__$3("PR flow: using override:",L),updatePrWithAmount(D,L.amount,L.pending,y,L.label??"Total"))),log__$3("Showing PR dialog..."),D.show();const N=await waitForUserToAddPaymentMethod(D);log__$3("Stripe PM added event:",N),log__$3("Merging PM fields with form fields...");const I=fillEmptyFormInputsWithStripePm(A,N),x=validateNonCdeFormFieldsForCC(I,P.get.onValidationError);track("billing_details_received",{...x}),log__$3("PR dialog finished. Starting p ayment flow...",x);const V=await startPaymentFlowForPR(M,{fields:x,checkoutPaymentMethod:T}),k=parsePRNextActionMetadata(V);if(log__$3("Confirming PR with Stripe..."),await confirmStripePrPM(k,N),U.mode==="setup"){log__$3("Confirming payment flow for setup...");const F=await confirmPaymentFlow(M,{secure_token:U.token});return{mode:"setup",result:parseConfirmPaymentFlowResponse(F)}}else{log__$3("Performing checkout...");const F={secure_token:U.token,payment_input:{provider_type:T.provider},customer_first_name:x[FieldName.FIRST_NAME],customer_last_name:x[FieldName.LAST_NAME],customer_email:x[FieldName.EMAIL],customer_address:generateBillingAddressFromFields(x),customer_shipping_address:generateShippingAddressFromFields(x,U.checkout_settings),promotion_code:x[FieldName.PROMOTION_CODE],line_items:U.line_items,total_amount_atom:U.amount_total_atom,cancel_at_end:!1,checkout_payment_method:T};return{mode:"checkout",result:await performCheckout(M,F)}}}),fillEmptyFormInputsWithStripePm=(S,T)=>{const A={...S},[P,...O]=T.payerName?.trim()?.split(/\s+/)??[],R=O.join(" ")||void 0,M=T.paymentMethod?.billing_details?.address,D=T.shippingAddress;A[FieldName.EMAIL]=A[FieldName.EMAIL]||T.payerEmail||"op_unfilled@getopenpay.com",A[FieldName.ZIP_CODE]=A[FieldName.ZIP_CODE]||M?.postal_code||D?.postalCode||"00000",A[FieldName.COUNTRY]=A[FieldName.COUNTRY]||M?.country||D?.country||"US";const U=A[FieldName.FIRST_NAME]||P||"",C=A[FieldName.LAST_NAME]||R||"";return U||C?(A[FieldName.FIRST_NAME]=U,A[FieldName.LAST_NAME]=C):(A[FieldName.FIRST_NAME]="_OP_UNKNOWN",A[FieldName.LAST_NAME]=""),log__$3("Final form inputs:",A),A},updatePrWithAmount=(S,T,A,P,O)=>{S.update({total:T?{amount:T.amountAtom,label:O??"Total",pending:A}:void 0,currency:T?.currency,applePay:P})},parsePRNextActionMetadata=S=>{if(S.required_user_actions.length!==1)throw new Error(`Error occurred.
215
+ Details: got ${S.required_user_actions.length} required user actions`);return PaymentRequestNextActionMetadata.parse(S.required_user_actions[0])},findCheckoutPaymentMethodStrict=(S,T,A)=>{const P=S.filter(O=>{const R=A===void 0?!0:O.processor_name===A,M=O.provider===T;return R&&M});if(P.length===0)throw console.warn("CPMs list",S),new Error(`No CPMs found with provider '${T}' and processor '${A}'`);return P.length!==1&&(console.warn("CPMs list",S),console.warn(`More than one CPM found with provider '${T}' and processor '${A}'`),track("more_than_one_cpm_found",{provider:T,processor:A,cpms:S})),P[0]},OjsFlows={commonCC:{init:async()=>{},run:runCommonCcFlow},stripePR:{init:initStripePrFlow,run:runStripePrFlow$1},stripeLink:{init:initStripeLinkFlow,run:runStripeLinkFlow},stripeKlarna:{init:initStripeKlarnaFlow,run:runStripeKlarnaFlow},stripeAffirm:{init:initStripeAffirmFlow,run:runStripeAffirmFlow},stripeAfterpay:{init:initStripeAfterpayFlow,run:runStripeAfterpayFlow},pockytPaypal:{init:initPockytPaypalFlow,run:runPockytPaypalFlow},paypal:{init:initPaypalFlow,run:runPaypalFlow},airwallexKlarna:{init:initAirwallexKlarnaFlow,run:runAirwallexKlarnaFlow},airwallexGooglePay:{init:initAirwallexGooglePayFlow,run:runAirwallexGooglePayFlow},airwallexApplePay:{init:initAirwallexApplePayFlow,run:runAirwallexApplePayFlow},airwallexACH:{init:async()=>{},run:runAirwallexACHFlow},airwallexEFT:{init:async()=>{},run:runAirwallexEFTFlow},airwallexBACS:{init:async()=>{},run:runAirwallexBACSFlow},airwallexSEPA:{init:async()=>{},run:runAirwallexSEPAFlow},loopCrypto:{init:initLoopFlow,run:runLoopFlow},authorizeNetApplePay:{init:initAuthnetApplePayFlow,run:runAuthnetApplePayFlow},authorizeNetGooglePay:{init:initAuthnetGooglePayFlow,run:runAuthnetGooglePayFlow},adyenGooglePay:{init:initAdyenGooglePayFlow,run:runAdyenGooglePayFlow},adyenApplePay:{init:initAdyenApplePayFlow,run:runAdyenApplePayFlow}},{log__:log__$2,err__:err__$3}=createOjsFlowLoggers("init-flows"),createInitFlowPublisher=(S,T)=>{const A=new LoadedOncePublisher;return{publisher:A,initialize:async P=>{try{if(A.current.isSuccess)throw new Error("This flow has already been initialized.");const O=await T(P);log__$2(`✔ ${S} flow initialized successfully. Result:`,O),A.set(O)}catch(O){err__$3(`𝙭 ${S} flow initialization failed. Error:`,getErrorMessage(O),"Details:",O),A.throw(O,getErrorMessage(O))}}}},startAllInitFlows=async(S,T,A)=>{await Promise.all(Object.values(S).map(P=>P.initialize({context:T,formCallbacks:A})))},createInitFlowsPublishers=()=>({stripePR:createInitFlowPublisher("Stripe PR",OjsFlows.stripePR.init),stripeLink:createInitFlowPublisher("Stripe Link",OjsFlows.stripeLink.init),stripeKlarna:createInitFlowPublisher("Stripe Klarna",OjsFlows.stripeKlarna.init),stripeAffirm:createInitFlowPublisher("Stripe Affirm",OjsFlows.stripeAffirm.init),stripeAfterpay:createInitFlowPublisher("Stripe Afterpay",OjsFlows.stripeAfterpay.init),airwallexGooglePay:createInitFlowPublisher("Airwallex GooglePay",OjsFlows.airwallexGooglePay.init),airwallexApplePay:createInitFlowPublisher("Airwallex ApplePay",OjsFlows.airwallexApplePay.init),loop:createInitFlowPublisher("Loop",OjsFlows.loopCrypto.init),paypal:createInitFlowPublisher("PayPal",OjsFlows.paypal.init),airwallexKlarna:createInitFlowPublisher("Klarna",OjsFlows.airwallexKlarna.init),pockytPaypal:createInitFlowPublisher("Pockyt PayPal",OjsFlows.pockytPaypal.init),authorizeNetGooglePay:createInitFlowPublisher("Authnet GooglePay",OjsFlows.authorizeNetGooglePay.init),authorizeNetApplePay:createInitFlowPublisher("Authnet ApplePay",OjsFlows.authorizeNetApplePay.init),adyenGooglePay:createInitFlowPublisher("Adyen GooglePay",OjsFlows.adyenGooglePay.init),adyenApplePay:createInitFlowPublisher("Adyen ApplePay",OjsFlows.adyenApplePay.init)}),{err__:err__$2}=createOjsFlowLoggers("form-callbacks"),OptionalFn=functionType().optional(),ZodFormCallbacks=objectType({onFocus:OptionalFn,onBlur:OptionalFn,onChange:OptionalFn,onLoad:OptionalFn,onLoadError:OptionalFn,onValidationError:OptionalFn,onCheckoutStarted:OptionalFn,onCheckoutSuccess:OptionalFn,onSetupPaymentMethodSuccess:OptionalFn,onCheckoutError:OptionalFn,onPaymentRequestLoad:OptionalFn}),Ye=class Ye{constructor(){this.setCallbacks=T=>{this._callbacks=Ye.createEmptyCallbacks(),Object.entries(T).forEach(([A,P])=>{const O=makeCallbackSafe(A,P??Ye.NOOP,err__$2);this._callbacks[A]=O})},this._callbacks=Ye.createEmptyCallbacks()}get get(){return{...this._callbacks}}};Ye.NOOP=()=>{},Ye.createEmptyCallbacks=()=>{const T={};return Object.keys(ZodFormCallbacks.keyof().enum).forEach(A=>{T[A]=Ye.NOOP}),T},Ye.fromObject=T=>{const A=new Ye;return A.setCallbacks(ZodFormCallbacks.parse(T)),A};let FormCallbacks=Ye;function detectFramework(){try{const S=getWindowSafe(),T=S;if(T?.next||T?.__NEXT_DATA__||document.querySelector("#__next"))return"nextjs";if(S?.__NUXT__||document.querySelector("#__nuxt"))return"nuxt";if(Object.keys(document).find(O=>O.includes("react"))||Array.from(document.body.querySelectorAll("body > *")).find(O=>O._reactRootContainer))return"react";const P=S;return P?.Vue||P?.__VUE__?"vue":document.querySelector("[ng-version]")?"angular":"vanilla"}catch{return"unknown"}}function getFrameworkVersion(S){try{switch(S){case"react":return null;case"nextjs":{const A=getWindowSafe();return A?.next?.version||A?.__NEXT_DATA__?.buildId||null}case"nuxt":return null;case"vue":return null;case"angular":{const A=getWindowSafe()?.document?.querySelector("[ng-version]");return A?A.getAttribute("ng-version"):null}default:return null}}catch{return null}}function getFrameworkInfo(){const S=detectFramework(),T=getFrameworkVersion(S);return{framework:S,version:T}}const getFraudMetadata=()=>{const S=window&&window.screen?window.screen.height:null,T=window&&window.screen?window.screen.width:null,A=window&&window.screen?window.screen.colorDepth:null,P=window&&window.navigator?window.navigator.javaEnabled():!1,O=window&&window.navigator?window.navigator.userAgent:null,R="text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";let M=null;window&&window.navigator&&(M=window.navigator.language?window.navigator.language:window.navigator.browserLanguage);const D=new Date().getTimezoneOffset();return{color_depth:A,java_enabled:P,javascript_enabled:!0,language:M,screen_height:S,screen_width:T,time_zone_offset:D,user_agent:O,accept_header:R}};var SubmitMethods=(S=>(S.card="card",S.pockytPaypal="pockyt-paypal",S.applePay="apple-pay",S.googlePay="google-pay",S.loopCrypto="loop-crypto",S.paypal="paypal",S.klarna="klarna",S.affirm="affirm",S.afterpay="afterpay",S.stripeLink="stripe-link",S.airwallexGooglePay="airwallex-google-pay",S.airwallexApplePay="airwallex-apple-pay",S.authorizenetGooglePay="authorizenet-google-pay",S.authorizenetApplePay="authorizenet-apple-pay",S.adyenGooglePay="adyen-google-pay",S.adyenApplePay="adyen-apple-pay",S.airwallexACH="airwallex-ach",S.airwallexEFT="airwallex-eft",S.airwallexBACS="airwallex-bacs",S.airwallexSEPA="airwallex-sepa",S))(SubmitMethods||{});nativeEnumType(SubmitMethods);var PaymentProviderType=(S=>(S.ACH="ach",S.EFT="eft",S.BACS="bacs",S.SEPA="sepa",S.APPLE_PAY="apple_pay",S.CREDIT_CARD="credit_card",S.GOOGLE_PAY="google_pay",S.STRIPE_LINK="stripe_link",S.CRYPTO="crypto",S.PAYPAL="paypal",S))(PaymentProviderType||{});const getApplePayProcessors=S=>{const T=[S.airwallexApplePay,S.authorizeNetApplePay,S.adyenApplePay],A=[];T.forEach(O=>{const R=O.publisher.getValueIfLoadedElse(null);R?.isAvailable&&A.push(R)});const P=S.stripePR.publisher.getValueIfLoadedElse(null);return P?.isAvailable&&P.availableProviders.applePay&&A.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.stripe,startFlow:R=>P.startFlow("apple_pay",{overridePaymentRequest:R?.overridePaymentRequest})}),{processors:A.map(O=>O.processor),isAvailable:A.length>0,isLoading:!1,startFlow:O=>startApplePayFlow(A,O)}},getGooglePayProcessors=S=>{const T=[S.airwallexGooglePay,S.authorizeNetGooglePay,S.adyenGooglePay],A=[];T.forEach(O=>{const R=O.publisher.getValueIfLoadedElse(null);R?.isAvailable&&A.push(R)});const P=S.stripePR.publisher.getValueIfLoadedElse(null);return P?.isAvailable&&P.availableProviders.googlePay&&A.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.stripe,startFlow:R=>P.startFlow("google_pay",{overridePaymentRequest:R?.overridePaymentRequest})}),{processors:A.map(O=>O.processor),isAvailable:A.length>0,isLoading:!1,startFlow:O=>startGooglePayFlow(A,O)}},startApplePayFlow=(S,T)=>{if(T?.processor){const P=S.find(O=>O.processor===T.processor);if(P?.isAvailable)return P.startFlow(T);throw new Error(`Specified Apple Pay processor ${T.processor} is not available`)}const A=S.find(P=>P.isAvailable);if(A)return A.startFlow(T);throw new Error("No available Apple Pay processor found")},startGooglePayFlow=(S,T)=>{if(T?.processor){const P=S.find(O=>O.processor===T.processor);if(P?.isAvailable)return P.startFlow(T);throw new Error(`Specified Google Pay processor ${T.processor} is not available`)}const A=S.find(P=>P.isAvailable);if(A)return A.startFlow(T);throw new Error("No available Google Pay processor found")},getKlarnaProcessors=S=>{const T=[],A=S.airwallexKlarna.publisher.getValueIfLoadedElse(null);A?.isAvailable&&T.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.airwallex,startFlow:O=>A.startFlow(O)});const P=S.stripeKlarna.publisher.getValueIfLoadedElse(null);return P?.isAvailable&&T.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.stripe,startFlow:O=>P.startFlow(O)}),{processors:T.map(O=>O.processor),isAvailable:T.length>0,isLoading:!1,startFlow:O=>startKlarnaFlow(T,O)}},startKlarnaFlow=(S,T)=>{if(T?.processor){const P=S.find(O=>O.processor===T.processor);if(P?.isAvailable)return P.startFlow(T);throw new Error(`Specified Klarna processor ${T.processor} is not available`)}const A=S.find(P=>P.isAvailable);if(A)return A.startFlow(T);throw new Error("No available Klarna processor found")},getAffirmProcessors=S=>{const T=[],A=S.stripeAffirm.publisher.getValueIfLoadedElse(null);return A?.isAvailable&&T.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.stripe,startFlow:P=>A.startFlow(P)}),{processors:T.map(P=>P.processor),isAvailable:T.length>0,isLoading:!1,startFlow:P=>startAffirmFlow(T,P)}},startAffirmFlow=(S,T)=>{if(T?.processor){const P=S.find(O=>O.processor===T.processor);if(P?.isAvailable)return P.startFlow(T);throw new Error(`Specified Affirm processor ${T.processor} is not available`)}const A=S.find(P=>P.isAvailable);if(A)return A.startFlow(T);throw new Error("No available Affirm processor found")},getAfterpayProcessors=S=>{const T=[],A=S.stripeAfterpay.publisher.getValueIfLoadedElse(null);return A?.isAvailable&&T.push({isAvailable:!0,isLoading:!1,processor:PaymentProcessor.Enum.stripe,startFlow:P=>A.startFlow(P)}),{processors:T.map(P=>P.processor),isAvailable:T.length>0,isLoading:!1,startFlow:P=>startAfterpayFlow(T,P)}},startAfterpayFlow=(S,T)=>{if(T?.processor){const P=S.find(O=>O.processor===T.processor);if(P?.isAvailable)return P.startFlow(T);throw new Error(`Specified Afterpay processor ${T.processor} is not available`)}const A=S.find(P=>P.isAvailable);if(A)return A.startFlow(T);throw new Error("No available Afterpay processor found")},convertStylesToQueryString=S=>JSON.stringify(S),{log__:log__$1,err__:err__$1}=createOjsFlowLoggers("tracer"),initTracerSafe=(S,T)=>{try{initTracerUnsafe(S,T)}catch(A){err__$1(`Error initializing tracer: ${A}`)}};let globalTracer;const initTracerUnsafe=async(S,T)=>{if(typeof window>"u")return;const A=await Promise.resolve().then(()=>index$5),{ConsoleSpanExporter:P,SimpleSpanProcessor:O,WebTracerProvider:R}=A,M=await Promise.resolve().then(()=>index$3),{FetchInstrumentation:D}=M,U=await Promise.resolve().then(()=>index$2),{ZoneContextManager:C}=U,L=await Promise.resolve().then(()=>index$4),{registerInstrumentations:y}=L,_=await Promise.resolve().then(()=>index$7),{Resource:N}=_,I=await Promise.resolve().then(()=>detectResources),{detectResourcesSync:x}=I,V=await Promise.resolve().then(()=>index$1),{OTLPTraceExporter:k}=V,F=await Promise.resolve().then(()=>index),{B3Propagator:W,B3InjectEncoding:ee}=F,ne=await Promise.resolve().then(()=>index$6),{BatchSpanProcessor:le}=ne;log__$1(`Initializing tracer with version ${S} and baseUrl ${T}`);const Re=getCollectorUrl(T);log__$1(`Using collector URL ${Re}`);const Qe=new k({url:Re}),je={"service.version":S,"service.name":"ojs"};return new R({resource:new N(je).merge(x()),spanProcessors:[new O(new P),new le(Qe,{scheduledDelayMillis:500})]}).register({contextManager:new C,propagator:new W({injectEncoding:ee.MULTI_HEADER})}),y({instrumentations:[new D({propagateTraceHeaderCorsUrls:[/.*/],ignoreUrls:[/^https:\/\/(.*\.)?adyen\.com/,/^https:\/\/(.*\.)?loopcrypto\.xyz/]})]}),globalTracer=trace.getTracer("openpay-js"),log__$1("Tracer initialized"),globalTracer},getCollectorUrl=S=>{const T=new URL(S).hostname;return T==="cde.openpaystaging.com"?"https://otel.openpaysandbox.com/v1/traces":T==="cde.getopenpay.com"?"https://otel.getopenpay.com/v1/traces":"http://localhost:4319/v1/traces"};class OpenPayFormEventHandler{constructor(T,A,P,O){this.handleMessage=R=>{if(!R.source){console.warn("[OJS] No source found");return}if(getCleanOrigin(R.origin)!==getCleanOrigin(this.baseUrl)||typeof R.data=="object"&&R.data.penpal||typeof R.data=="object"&&R.data.source&&R.data.source==="react-devtools-bridge")return;let M=null;try{M=parseEventPayload(JSON.parse(R.data))}catch{return}if(!this.validateEvent(M))return;const{elementId:U,payload:C}=M,L=C.type;switch(L){case"LAYOUT":this.internalCallbacks.setFormHeight(C.height?`${C.height}px`:"100%");break;case"FOCUS":this.formCallbacks.get.onFocus(U,C.elementType);break;case"BLUR":this.formCallbacks.get.onBlur(U,C.elementType,{obfuscatedValue:C.obfuscatedValue});break;case"CHANGE":this.formCallbacks.get.onChange(U,C.elementType,C.errors);break;case"LOADED":this.eventTargets[U]=R.source,this.internalCallbacks.onCdeLoaded(C);break;case"LOAD_ERROR":this.internalCallbacks.onCdeLoadError(C.message);break;case"VALIDATION_ERROR":this.formCallbacks.get.onValidationError(C.elementType,C.errors,U);break;default:console.warn("[form] Unhandled event type:",L)}},this.validateEvent=R=>R.formId!==this.formId||!R.elementId?(console.log("[OJS] formId",this.formId,R.formId),console.warn("[form] Ignoring unknown event:",R),!1):this.nonces.has(R.nonce)?(console.warn("[form] Ignoring duplicate event:",R),!1):(this.nonces.add(R.nonce),!0),this.eventTargets={},this.nonces=new Set,this.formId=T,this.baseUrl=A,this.formCallbacks=P,this.internalCallbacks=O}}const getCleanOrigin=S=>new URL(S).origin;async function createConnection(S,T){const P=await connectToChild({iframe:S,debug:!1,childOrigin:T}).promise,O=await checkIfValidCdeConnectionObject(P);if(!isResultValid(P,O))throw new Error("Got invalid CDE connection object");return P}class ConnectionManager{constructor(){this.connections=new Map}addConnection(T,A){this.connections.set(T,A)}getConnection(){const T=this.connections.values().next().value;if(!T)throw new Error("Connection not found");return T}getAllConnections(){return this.connections}}const setupPaymentRequestHandlers=(S,T,A)=>{const{stripePR:P}=S;P.publisher.subscribe(O=>{if(O.isSuccess){const R=O.loadedValue,M=R.isAvailable&&R.availableProviders.applePay,D=R.isAvailable&&R.availableProviders.googlePay,U={apple_pay:{isLoading:!1,isAvailable:M,startFlow:async C=>{M&&runStripePrFlow("apple_pay",R,T,A,C)}},google_pay:{isLoading:!1,isAvailable:D,startFlow:async C=>{D&&runStripePrFlow("google_pay",R,T,A,C)}}};A.get.onPaymentRequestLoad(U)}})},runStripePrFlow=(S,T,A,P,O)=>OjsFlows.stripePR.run({context:A,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(A.checkoutPaymentMethods,S),nonCdeFormInputs:createInputsDictFromForm(A.formDiv),formCallbacks:P,customParams:{provider:S,overridePaymentRequest:O?.overridePaymentRequest},initResult:T}),GENERIC_CONN_ERR="The secure form failed to load properly. Please check your internet connection, or try again later.",{log__,err__}=createOjsFlowLoggers("op-form"),$e=class $e{constructor(T){this.isDestroyed=!1,this.cdeLoadEvent=new LoadedOncePublisher,this.anyCdeConn=new LoadedOncePublisher,this.context=new LoadedOncePublisher,this.initFlows=createInitFlowsPublishers(),this.isSubmitting=!1,this.startFormInit=async()=>{const O=trace.getTracer("openpay-js"),R=O.startSpan("form.initialize",{kind:SpanKind.CLIENT,attributes:{"ojs.checkoutSecureToken":this.config.checkoutSecureToken,"ojs.deviceToken":this.deviceToken,"ojs.formId":this.formId,"ojs.version":this.ojsVersion,"ojs.release_version":this.ojsReleaseVersion,"ojs.base_url":this.baseUrl,"ojs.referrer":this.referrer}});return context.with(trace.setSpan(context.active(),R),async()=>{try{const M=this.createElement(ElementTypeEnum.CDE_BRIDGE);M.node.id="__op_internal_cde_bridge",M.node.ariaHidden="true",Object.assign(M.node.style,{border:"none",margin:"0px",padding:"0px",width:"1px",height:"1px",overflow:"hidden",visibility:"hidden",position:"fixed",pointerEvents:"none",userSelect:"none"}),M.mount("body"),log__("CDE bridge element mounted"),log__("Initializing OpenPay form:"),log__("├ Waiting for CDE load event...");const D=await this.cdeLoadEvent.waitForLoad({timeoutSec:120,timeoutErrMsg:GENERIC_CONN_ERR});log__("├ CDE load event received"),R?.addEvent("waiting_for_cde_connection"),log__("├ Waiting for CDE connection...");const U=O?.startSpan("cde.connect",void 0,context.active()),C=await this.anyCdeConn.waitForLoad({timeoutSec:120,timeoutErrMsg:GENERIC_CONN_ERR});U?.end(),R?.addEvent("cde_connected"),log__("├ CDE connection received"),await setUserDeviceToken(C,this.deviceToken),log__("├ Creating OJS context, setting up handlers...");const L=$e.buildOjsFlowContext(this.config,D,C,this.getFormDiv());this.context.set(L),setupPaymentRequestHandlers(this.initFlows,L,this.formCallbacks),log__("├ Starting OJS init flows..."),await startAllInitFlows(this.initFlows,L,this.formCallbacks),this.formCallbacks.get.onLoad(D.totalAmountAtoms,D.currency),log__("╰ Done initializing OJS flows."),R?.setStatus({code:SpanStatusCode.OK}),track("form_loaded")}catch(M){const D=getErrorMessage(M);R?.setStatus({code:SpanStatusCode.ERROR,message:D}),err__("╰ Error initializing OP form:",D),track("form_init_error",{error:D}),this.formCallbacks.get.onLoadError(D)}finally{R?.end()}})},this.setFormHeight=O=>{this.formProperties.height=O,this.registeredElements&&Object.values(this.registeredElements).forEach(R=>{!R||R.type===ElementTypeEnum.CDE_BRIDGE||(R.node.style.height=O)})},this.onCdeLoaded=O=>{this.cdeLoadEvent.current.isSuccess||(this.cdeLoadEvent.set(O),track("cde_loaded"))},this.onCdeLoadError=O=>{this.cdeLoadEvent.current.isSuccess||(this.cdeLoadEvent.throw(new Error(O),O),track("cde_load_error",{error:O}))},this.createElement=(O,R={})=>{if(this.checkValidFormInstance("createElement"),!this.config)throw new Error("OpenPay form not initialized");const M=_ElementTypeEnumZod.parse(O),D=document.createElement("iframe"),U=this.buildQueryString(R);D.name=`${M}-element`;const C=new URL(`/app/v1/${D.name}/`,this.config.baseUrl);return C.search=U.toString(),D.src=C.href,D.style.border="none",D.style.width="100%",this.registerIframe(M,D)},this.registerIframe=(O,R)=>{const M={type:O,node:R,mount:D=>{document.querySelector(D)?.appendChild(R),track("element_mounted",{element_type:O})}};return this.connectToElement({type:M.type,node:M.node}),this.registeredElements||(this.registeredElements={[ElementTypeEnum.CARD]:void 0,[ElementTypeEnum.CARD_NUMBER]:void 0,[ElementTypeEnum.CARD_EXPIRY]:void 0,[ElementTypeEnum.CARD_CVC]:void 0,[ElementTypeEnum.CDE_BRIDGE]:void 0}),this.registeredElements[O]=M,M},this.buildQueryString=O=>{const R=new URLSearchParams;return R.append("referer",this.referrer),R.append("formId",this.formId),O.styles&&R.append("styles",convertStylesToQueryString(O.styles)),R.append("secureToken",this.config.checkoutSecureToken),R},this.connectToElement=O=>createTrackingSpan({spanName:"connect_to_element",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},async()=>{const R=await createConnection(O.node);R.tracingContext={checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},this.connectionManager.addConnection(O.type,R),!this.anyCdeConn.current.isSuccess&&O.type===ElementTypeEnum.CDE_BRIDGE&&this.anyCdeConn.set(R)}).catch(R=>err__("[FORM] Error connecting to CDE iframe",R)),this.getFormDiv=()=>document.querySelector(this.formTarget)??document.body,this.submitCard=async O=>{if(this.isSubmitting){err__("Form is already submitting. Please wait for the submission to finish before submitting again.");return}this.isSubmitting=!0;try{const R=await createTrackingSpan({spanName:"submit_card",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer,paymentRouteId:O?.paymentRouteId},async()=>{track("submit_card",{...O}),this.checkValidFormInstance("submitCard");const M=this.context.getValueIfLoadedElse(null);if(!M)throw new Error("Please wait for the form to finish loading before submitting.");await OjsFlows.commonCC.run({context:M,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(M.checkoutPaymentMethods,"credit_card"),nonCdeFormInputs:createInputsDictFromForm(M.formDiv),formCallbacks:this.formCallbacks,customParams:{currentCdeConnections:this.connectionManager.getAllConnections(),paymentRouteId:O?.paymentRouteId},initResult:void 0})});return this.isSubmitting=!1,R}catch(R){throw this.isSubmitting=!1,R}},this.getAvailablePaymentMethods=()=>createTrackingSpan({spanName:"get_available_payment_methods",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},()=>{this.checkValidFormInstance("getAvailablePaymentMethods");const O=this.context.getValueIfLoadedElse(null);if(!O)throw new Error("Please wait for the form to finish loading before getting available payment methods.");const{processors:R,isAvailable:M}=getApplePayProcessors(this.initFlows),{processors:D,isAvailable:U}=getGooglePayProcessors(this.initFlows),L=this.initFlows.paypal.publisher.getValueIfLoadedElse(null)?.isAvailable??!1,{processors:y,isAvailable:_}=getKlarnaProcessors(this.initFlows),{processors:N,isAvailable:I}=getAffirmProcessors(this.initFlows),{processors:x,isAvailable:V}=getAfterpayProcessors(this.initFlows),k=O.checkoutPaymentMethods.some(je=>je.processor_name==="pockyt"&&je.provider==="paypal"),W=this.initFlows.loop.publisher.getValueIfLoadedElse(null)?.isAvailable??!1,ee=this.initFlows.stripeLink.publisher.getValueIfLoadedElse(null),ne=ee?.isAvailable??!1,le=[{name:SubmitMethods.card,processors:[],isAvailable:!0},{name:SubmitMethods.applePay,processors:R,isAvailable:M},{name:SubmitMethods.googlePay,processors:D,isAvailable:U},{name:SubmitMethods.paypal,processors:L?[PaymentProcessor.Enum.paypal]:[],isAvailable:L},{name:SubmitMethods.klarna,processors:y,isAvailable:_},{name:SubmitMethods.affirm,processors:N,isAvailable:I},{name:SubmitMethods.afterpay,processors:x,isAvailable:V},{name:SubmitMethods.pockytPaypal,processors:k?[PaymentProcessor.Enum.pockyt]:[],isAvailable:k},{name:SubmitMethods.loopCrypto,processors:W?[PaymentProcessor.Enum.loop]:[],isAvailable:W},{name:SubmitMethods.stripeLink,processors:[PaymentProcessor.Enum.stripe],isAvailable:ne,controller:ee?.isAvailable?ee.controller:void 0}],Re={paypal:SubmitMethods.paypal,airwallexGooglePay:SubmitMethods.airwallexGooglePay,airwallexApplePay:SubmitMethods.airwallexApplePay,authorizeNetGooglePay:SubmitMethods.authorizenetGooglePay,authorizeNetApplePay:SubmitMethods.authorizenetApplePay,adyenGooglePay:SubmitMethods.adyenGooglePay,adyenApplePay:SubmitMethods.adyenApplePay};return[...Object.entries(this.initFlows).map(([je,ot])=>{const at=ot.publisher.getValueIfLoadedElse(null);return{name:Re[je]??je,processors:[],isAvailable:at?.isAvailable??!1}}),...le]}),this.generalSubmit=async(O,R)=>{if(this.isSubmitting){err__("Form is already submitting. Please wait for the submission to finish before submitting again.");return}this.isSubmitting=!0;try{const M=await createTrackingSpan({spanName:"general_form_submit",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},async()=>{track("general_form_submit",{method:O,settings:R}),this.checkValidFormInstance("generalSubmit");const D=this.context.getValueIfLoadedElse(null);if(!D)throw new Error("Please wait for the form to finish loading before submitting.");switch(O){case SubmitMethods.card:return this.submitCard(R);case SubmitMethods.pockytPaypal:return OjsFlows.pockytPaypal.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.PAYPAL,"pockyt"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:{settings:R},initResult:void 0});case SubmitMethods.paypal:return OjsFlows.paypal.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.PAYPAL,"paypal"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),initResult:void 0,customParams:{settings:R},formCallbacks:this.formCallbacks});case SubmitMethods.klarna:{const{startFlow:U}=getKlarnaProcessors(this.initFlows);return U(R)}case SubmitMethods.affirm:{const{startFlow:U}=getAffirmProcessors(this.initFlows);return U(R)}case SubmitMethods.afterpay:{const{startFlow:U}=getAfterpayProcessors(this.initFlows);return U(R)}case SubmitMethods.loopCrypto:return OjsFlows.loopCrypto.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,"crypto","loop"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:R,initResult:void 0});case SubmitMethods.applePay:{const{startFlow:U}=getApplePayProcessors(this.initFlows);return U(R)}case SubmitMethods.googlePay:{const{startFlow:U}=getGooglePayProcessors(this.initFlows);return U(R)}case SubmitMethods.airwallexGooglePay:{const U=this.initFlows.airwallexGooglePay.publisher.getValueIfLoadedElse(null);if(!U){err__("airwallex-google-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.airwallexApplePay:{const U=this.initFlows.airwallexApplePay.publisher.getValueIfLoadedElse(null);if(!U){err__("airwallex-apple-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.authorizenetGooglePay:{const U=this.initFlows.authorizeNetGooglePay.publisher.getValueIfLoadedElse(null);if(!U){err__("authorize-net-google-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.authorizenetApplePay:{const U=this.initFlows.authorizeNetApplePay.publisher.getValueIfLoadedElse(null);if(!U){err__("authorize-net-apple-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.adyenGooglePay:{const U=this.initFlows.adyenGooglePay.publisher.getValueIfLoadedElse(null);if(!U){err__("adyen-google-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.adyenApplePay:{const U=this.initFlows.adyenApplePay.publisher.getValueIfLoadedElse(null);if(!U){err__("adyen-apple-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return}return U.startFlow(R)}case SubmitMethods.airwallexACH:return OjsFlows.airwallexACH.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.ACH,"airwallex"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:R,initResult:void 0});case SubmitMethods.airwallexEFT:return OjsFlows.airwallexEFT.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.EFT,"airwallex"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:R,initResult:void 0});case SubmitMethods.airwallexBACS:return OjsFlows.airwallexBACS.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.BACS,"airwallex"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:R,initResult:void 0});case SubmitMethods.airwallexSEPA:return OjsFlows.airwallexSEPA.run({context:D,checkoutPaymentMethod:findCheckoutPaymentMethodStrict(D.checkoutPaymentMethods,PaymentProviderType.SEPA,"airwallex"),nonCdeFormInputs:createInputsDictFromForm(D.formDiv),formCallbacks:this.formCallbacks,customParams:R,initResult:void 0});case SubmitMethods.stripeLink:{err__("StripeLink cannot be submitted manually. Please mount the button properly and if user completed the payment flow via StripeLink button, the payment will be submitted automatically.");return}default:assertNever(O)}});return this.isSubmitting=!1,M}catch(M){throw this.isSubmitting=!1,M}},this.submitWith=this.generalSubmit,this.submit=this.submitCard,this.destroy=()=>{log__("Destroying OpenPay form..."),this.checkValidFormInstance("destroy"),this.isDestroyed=!0;for(const O of Object.values(this.registeredElements??{}))O&&O.node.remove();getWindowSafe()?.removeEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler)),detachAnalyticsEventListeners(),this.registeredElements=null,delete window.ojs,track("form_destroyed")},this.updateCallbacks=O=>{this.formCallbacks.setCallbacks(O)},$e.assignAsSingleton(this),this.ojsVersion="0.5.25",this.ojsReleaseVersion="0.5.25",this.baseUrl=T.baseUrl??"https://cde.getopenpay.com",this.config={...T,baseUrl:this.baseUrl},this.formCallbacks=FormCallbacks.fromObject(T),this.registeredElements=null,this.formId=`opjs-form-${v4()}`,this.referrer=window.location.origin,this.formTarget=T.formTarget??"body",this.formProperties={height:"1px"},this.connectionManager=new ConnectionManager,this.deviceToken=getDeviceToken(),attachAnalyticsEventListeners();const{framework:A,version:P}=getFrameworkInfo();getCurrentEnv(this.baseUrl).then(O=>{if(!metricsPublisher.current.isSuccess){const R={checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,environment:O,framework:A,frameworkVersion:P,ojsVersion:this.ojsVersion,ojsReleaseVersion:this.ojsReleaseVersion,referrer:this.referrer,baseUrl:this.baseUrl};metricsPublisher.set(R)}}),track("form_init"),console.log("OJS VERSION",this.ojsVersion),T.allowTracing===!0&&initTracerSafe(this.ojsVersion,this.baseUrl),this.eventHandler=new OpenPayFormEventHandler(this.formId,this.baseUrl,this.formCallbacks,{setFormHeight:this.setFormHeight,onCdeLoaded:this.onCdeLoaded,onCdeLoadError:this.onCdeLoadError}),getWindowSafe()?.addEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler)),this.startFormInit()}get checkoutSecureToken(){return this.config.checkoutSecureToken}checkValidFormInstance(T="unknown"){const A=$e.getInstance(),P={thisFormId:this.formId,currentFormId:A?.formId||"no-current-instance",isDestroyed:this.isDestroyed,checkoutToken:this.config.checkoutSecureToken.substring(0,10)+"..."},O=`
216
216
  [Warning] Invalid form instance detected.
217
217
  It looks like you are still using an old instance that has been destroyed.
218
218
  Please make sure you are using the latest instance of the form and cleanup event listeners.
@@ -240,5 +240,5 @@ Details: got ${S.required_user_actions.length} required user actions`);return Pa
240
240
  * @license Angular v<unknown>
241
241
  * (c) 2010-2025 Google LLC. https://angular.io/
242
242
  * License: MIT
243
- */const S=globalThis;function T(G){return(S.__Zone_symbol_prefix||"__zone_symbol__")+G}function A(){const G=S.performance;function H(ge){G&&G.mark&&G.mark(ge)}function q(ge,j){G&&G.measure&&G.measure(ge,j)}H("Zone");class B{static __symbol__=T;static assertZonePatched(){if(S.Promise!==he.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let j=B.current;for(;j.parent;)j=j.parent;return j}static get current(){return fe.zone}static get currentTask(){return me}static __load_patch(j,K,Y=!1){if(he.hasOwnProperty(j)){const ae=S[T("forceDuplicateZoneCheck")]===!0;if(!Y&&ae)throw Error("Already loaded patch: "+j)}else if(!S["__Zone_disable_"+j]){const ae="Zone:"+j;H(ae),he[j]=K(S,B,Te),q(ae,ae)}}get parent(){return this._parent}get name(){return this._name}_parent;_name;_properties;_zoneDelegate;constructor(j,K){this._parent=j,this._name=K?K.name||"unnamed":"<root>",this._properties=K&&K.properties||{},this._zoneDelegate=new J(this,this._parent&&this._parent._zoneDelegate,K)}get(j){const K=this.getZoneWith(j);if(K)return K._properties[j]}getZoneWith(j){let K=this;for(;K;){if(K._properties.hasOwnProperty(j))return K;K=K._parent}return null}fork(j){if(!j)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,j)}wrap(j,K){if(typeof j!="function")throw new Error("Expecting function got: "+j);const Y=this._zoneDelegate.intercept(this,j,K),ae=this;return function(){return ae.runGuarded(Y,this,arguments,K)}}run(j,K,Y,ae){fe={parent:fe,zone:this};try{return this._zoneDelegate.invoke(this,j,K,Y,ae)}finally{fe=fe.parent}}runGuarded(j,K=null,Y,ae){fe={parent:fe,zone:this};try{try{return this._zoneDelegate.invoke(this,j,K,Y,ae)}catch(Le){if(this._zoneDelegate.handleError(this,Le))throw Le}}finally{fe=fe.parent}}runTask(j,K,Y){if(j.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(j.zone||Ge).name+"; Execution: "+this.name+")");const ae=j,{type:Le,data:{isPeriodic:Ze=!1,isRefreshable:Ne=!1}={}}=j;if(j.state===ke&&(Le===xe||Le===ce))return;const rt=j.state!=Ce;rt&&ae._transitionTo(Ce,te);const it=me;me=ae,fe={parent:fe,zone:this};try{Le==ce&&j.data&&!Ze&&!Ne&&(j.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,ae,K,Y)}catch(Ke){if(this._zoneDelegate.handleError(this,Ke))throw Ke}}finally{const Ke=j.state;if(Ke!==ke&&Ke!==Fe)if(Le==xe||Ze||Ne&&Ke===de)rt&&ae._transitionTo(te,Ce,de);else{const lt=ae._zoneDelegates;this._updateTaskCount(ae,-1),rt&&ae._transitionTo(ke,Ce,ke),Ne&&(ae._zoneDelegates=lt)}fe=fe.parent,me=it}}scheduleTask(j){if(j.zone&&j.zone!==this){let Y=this;for(;Y;){if(Y===j.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${j.zone.name}`);Y=Y.parent}}j._transitionTo(de,ke);const K=[];j._zoneDelegates=K,j._zone=this;try{j=this._zoneDelegate.scheduleTask(this,j)}catch(Y){throw j._transitionTo(Fe,de,ke),this._zoneDelegate.handleError(this,Y),Y}return j._zoneDelegates===K&&this._updateTaskCount(j,1),j.state==de&&j._transitionTo(te,de),j}scheduleMicroTask(j,K,Y,ae){return this.scheduleTask(new se(be,j,K,Y,ae,void 0))}scheduleMacroTask(j,K,Y,ae,Le){return this.scheduleTask(new se(ce,j,K,Y,ae,Le))}scheduleEventTask(j,K,Y,ae,Le){return this.scheduleTask(new se(xe,j,K,Y,ae,Le))}cancelTask(j){if(j.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(j.zone||Ge).name+"; Execution: "+this.name+")");if(!(j.state!==te&&j.state!==Ce)){j._transitionTo(Ie,te,Ce);try{this._zoneDelegate.cancelTask(this,j)}catch(K){throw j._transitionTo(Fe,Ie),this._zoneDelegate.handleError(this,K),K}return this._updateTaskCount(j,-1),j._transitionTo(ke,Ie),j.runCount=-1,j}}_updateTaskCount(j,K){const Y=j._zoneDelegates;K==-1&&(j._zoneDelegates=null);for(let ae=0;ae<Y.length;ae++)Y[ae]._updateTaskCount(j.type,K)}}const Z={name:"",onHasTask:(ge,j,K,Y)=>ge.hasTask(K,Y),onScheduleTask:(ge,j,K,Y)=>ge.scheduleTask(K,Y),onInvokeTask:(ge,j,K,Y,ae,Le)=>ge.invokeTask(K,Y,ae,Le),onCancelTask:(ge,j,K,Y)=>ge.cancelTask(K,Y)};class J{get zone(){return this._zone}_zone;_taskCounts={microTask:0,macroTask:0,eventTask:0};_parentDelegate;_forkDlgt;_forkZS;_forkCurrZone;_interceptDlgt;_interceptZS;_interceptCurrZone;_invokeDlgt;_invokeZS;_invokeCurrZone;_handleErrorDlgt;_handleErrorZS;_handleErrorCurrZone;_scheduleTaskDlgt;_scheduleTaskZS;_scheduleTaskCurrZone;_invokeTaskDlgt;_invokeTaskZS;_invokeTaskCurrZone;_cancelTaskDlgt;_cancelTaskZS;_cancelTaskCurrZone;_hasTaskDlgt;_hasTaskDlgtOwner;_hasTaskZS;_hasTaskCurrZone;constructor(j,K,Y){this._zone=j,this._parentDelegate=K,this._forkZS=Y&&(Y&&Y.onFork?Y:K._forkZS),this._forkDlgt=Y&&(Y.onFork?K:K._forkDlgt),this._forkCurrZone=Y&&(Y.onFork?this._zone:K._forkCurrZone),this._interceptZS=Y&&(Y.onIntercept?Y:K._interceptZS),this._interceptDlgt=Y&&(Y.onIntercept?K:K._interceptDlgt),this._interceptCurrZone=Y&&(Y.onIntercept?this._zone:K._interceptCurrZone),this._invokeZS=Y&&(Y.onInvoke?Y:K._invokeZS),this._invokeDlgt=Y&&(Y.onInvoke?K:K._invokeDlgt),this._invokeCurrZone=Y&&(Y.onInvoke?this._zone:K._invokeCurrZone),this._handleErrorZS=Y&&(Y.onHandleError?Y:K._handleErrorZS),this._handleErrorDlgt=Y&&(Y.onHandleError?K:K._handleErrorDlgt),this._handleErrorCurrZone=Y&&(Y.onHandleError?this._zone:K._handleErrorCurrZone),this._scheduleTaskZS=Y&&(Y.onScheduleTask?Y:K._scheduleTaskZS),this._scheduleTaskDlgt=Y&&(Y.onScheduleTask?K:K._scheduleTaskDlgt),this._scheduleTaskCurrZone=Y&&(Y.onScheduleTask?this._zone:K._scheduleTaskCurrZone),this._invokeTaskZS=Y&&(Y.onInvokeTask?Y:K._invokeTaskZS),this._invokeTaskDlgt=Y&&(Y.onInvokeTask?K:K._invokeTaskDlgt),this._invokeTaskCurrZone=Y&&(Y.onInvokeTask?this._zone:K._invokeTaskCurrZone),this._cancelTaskZS=Y&&(Y.onCancelTask?Y:K._cancelTaskZS),this._cancelTaskDlgt=Y&&(Y.onCancelTask?K:K._cancelTaskDlgt),this._cancelTaskCurrZone=Y&&(Y.onCancelTask?this._zone:K._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;const ae=Y&&Y.onHasTask,Le=K&&K._hasTaskZS;(ae||Le)&&(this._hasTaskZS=ae?Y:Z,this._hasTaskDlgt=K,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,Y.onScheduleTask||(this._scheduleTaskZS=Z,this._scheduleTaskDlgt=K,this._scheduleTaskCurrZone=this._zone),Y.onInvokeTask||(this._invokeTaskZS=Z,this._invokeTaskDlgt=K,this._invokeTaskCurrZone=this._zone),Y.onCancelTask||(this._cancelTaskZS=Z,this._cancelTaskDlgt=K,this._cancelTaskCurrZone=this._zone))}fork(j,K){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,j,K):new B(j,K)}intercept(j,K,Y){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,j,K,Y):K}invoke(j,K,Y,ae,Le){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,j,K,Y,ae,Le):K.apply(Y,ae)}handleError(j,K){return this._handleErrorZS?this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,j,K):!0}scheduleTask(j,K){let Y=K;if(this._scheduleTaskZS)this._hasTaskZS&&Y._zoneDelegates.push(this._hasTaskDlgtOwner),Y=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,j,K),Y||(Y=K);else if(K.scheduleFn)K.scheduleFn(K);else if(K.type==be)Ue(K);else throw new Error("Task is missing scheduleFn.");return Y}invokeTask(j,K,Y,ae){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,j,K,Y,ae):K.callback.apply(Y,ae)}cancelTask(j,K){let Y;if(this._cancelTaskZS)Y=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,j,K);else{if(!K.cancelFn)throw Error("Task is not cancelable");Y=K.cancelFn(K)}return Y}hasTask(j,K){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,j,K)}catch(Y){this.handleError(j,Y)}}_updateTaskCount(j,K){const Y=this._taskCounts,ae=Y[j],Le=Y[j]=ae+K;if(Le<0)throw new Error("More tasks executed then were scheduled.");if(ae==0||Le==0){const Ze={microTask:Y.microTask>0,macroTask:Y.macroTask>0,eventTask:Y.eventTask>0,change:j};this.hasTask(this._zone,Ze)}}}class se{type;source;invoke;callback;data;scheduleFn;cancelFn;_zone=null;runCount=0;_zoneDelegates=null;_state="notScheduled";constructor(j,K,Y,ae,Le,Ze){if(this.type=j,this.source=K,this.data=ae,this.scheduleFn=Le,this.cancelFn=Ze,!Y)throw new Error("callback is not defined");this.callback=Y;const Ne=this;j===xe&&ae&&ae.useG?this.invoke=se.invokeTask:this.invoke=function(){return se.invokeTask.call(S,Ne,this,arguments)}}static invokeTask(j,K,Y){j||(j=this),He++;try{return j.runCount++,j.zone.runTask(j,K,Y)}finally{He==1&&Be(),He--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(ke,de)}_transitionTo(j,K,Y){if(this._state===K||this._state===Y)this._state=j,j==ke&&(this._zoneDelegates=null);else throw new Error(`${this.type} '${this.source}': can not transition to '${j}', expecting state '${K}'${Y?" or '"+Y+"'":""}, was '${this._state}'.`)}toString(){return this.data&&typeof this.data.handleId<"u"?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}const ie=T("setTimeout"),_e=T("Promise"),ye=T("then");let oe=[],Ee=!1,Oe;function Me(ge){if(Oe||S[_e]&&(Oe=S[_e].resolve(0)),Oe){let j=Oe[ye];j||(j=Oe.then),j.call(Oe,ge)}else S[ie](ge,0)}function Ue(ge){He===0&&oe.length===0&&Me(Be),ge&&oe.push(ge)}function Be(){if(!Ee){for(Ee=!0;oe.length;){const ge=oe;oe=[];for(let j=0;j<ge.length;j++){const K=ge[j];try{K.zone.runTask(K,null,null)}catch(Y){Te.onUnhandledError(Y)}}}Te.microtaskDrainDone(),Ee=!1}}const Ge={name:"NO ZONE"},ke="notScheduled",de="scheduling",te="scheduled",Ce="running",Ie="canceling",Fe="unknown",be="microTask",ce="macroTask",xe="eventTask",he={},Te={symbol:T,currentZoneFrame:()=>fe,onUnhandledError:Ve,microtaskDrainDone:Ve,scheduleMicroTask:Ue,showUncaughtError:()=>!B[T("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:Ve,patchMethod:()=>Ve,bindArguments:()=>[],patchThen:()=>Ve,patchMacroTask:()=>Ve,patchEventPrototype:()=>Ve,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>Ve,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>Ve,wrapWithCurrentZone:()=>Ve,filterProperties:()=>[],attachOriginToPatched:()=>Ve,_redefineProperty:()=>Ve,patchCallbacks:()=>Ve,nativeScheduleMicroTask:Me};let fe={parent:null,zone:new B(null,null)},me=null,He=0;function Ve(){}return q("Zone","Zone"),B}function P(){const G=globalThis,H=G[T("forceDuplicateZoneCheck")]===!0;if(G.Zone&&(H||typeof G.Zone.__symbol__!="function"))throw new Error("Zone already loaded.");return G.Zone??=A(),G.Zone}const O=Object.getOwnPropertyDescriptor,R=Object.defineProperty,M=Object.getPrototypeOf,D=Object.create,U=Array.prototype.slice,C="addEventListener",L="removeEventListener",y=T(C),_=T(L),N="true",I="false",x=T("");function V(G,H){return Zone.current.wrap(G,H)}function k(G,H,q,B,Z){return Zone.current.scheduleMacroTask(G,H,q,B,Z)}const F=T,W=typeof window<"u",ee=W?window:void 0,ne=W&&ee||globalThis,le="removeAttribute";function Re(G,H){for(let q=G.length-1;q>=0;q--)typeof G[q]=="function"&&(G[q]=V(G[q],H+"_"+q));return G}function Qe(G,H){const q=G.constructor.name;for(let B=0;B<H.length;B++){const Z=H[B],J=G[Z];if(J){const se=O(G,Z);if(!je(se))continue;G[Z]=(ie=>{const _e=function(){return ie.apply(this,Re(arguments,q+"."+Z))};return tt(_e,ie),_e})(J)}}}function je(G){return G?G.writable===!1?!1:!(typeof G.get=="function"&&typeof G.set>"u"):!0}const ot=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,at=!("nw"in ne)&&typeof ne.process<"u"&&ne.process.toString()==="[object process]",ft=!at&&!ot&&!!(W&&ee.HTMLElement),vt=typeof ne.process<"u"&&ne.process.toString()==="[object process]"&&!ot&&!!(W&&ee.HTMLElement),Et={},Ht=F("enable_beforeunload"),Pt=function(G){if(G=G||ne.event,!G)return;let H=Et[G.type];H||(H=Et[G.type]=F("ON_PROPERTY"+G.type));const q=this||G.target||ne,B=q[H];let Z;if(ft&&q===ee&&G.type==="error"){const J=G;Z=B&&B.call(this,J.message,J.filename,J.lineno,J.colno,J.error),Z===!0&&G.preventDefault()}else Z=B&&B.apply(this,arguments),G.type==="beforeunload"&&ne[Ht]&&typeof Z=="string"?G.returnValue=Z:Z!=null&&!Z&&G.preventDefault();return Z};function Ot(G,H,q){let B=O(G,H);if(!B&&q&&O(q,H)&&(B={enumerable:!0,configurable:!0}),!B||!B.configurable)return;const Z=F("on"+H+"patched");if(G.hasOwnProperty(Z)&&G[Z])return;delete B.writable,delete B.value;const J=B.get,se=B.set,ie=H.slice(2);let _e=Et[ie];_e||(_e=Et[ie]=F("ON_PROPERTY"+ie)),B.set=function(ye){let oe=this;if(!oe&&G===ne&&(oe=ne),!oe)return;typeof oe[_e]=="function"&&oe.removeEventListener(ie,Pt),se?.call(oe,null),oe[_e]=ye,typeof ye=="function"&&oe.addEventListener(ie,Pt,!1)},B.get=function(){let ye=this;if(!ye&&G===ne&&(ye=ne),!ye)return null;const oe=ye[_e];if(oe)return oe;if(J){let Ee=J.call(this);if(Ee)return B.set.call(this,Ee),typeof ye[le]=="function"&&ye.removeAttribute(H),Ee}return null},R(G,H,B),G[Z]=!0}function gt(G,H,q){if(H)for(let B=0;B<H.length;B++)Ot(G,"on"+H[B],q);else{const B=[];for(const Z in G)Z.slice(0,2)=="on"&&B.push(Z);for(let Z=0;Z<B.length;Z++)Ot(G,B[Z],q)}}const We=F("originalInstance");function _t(G){const H=ne[G];if(!H)return;ne[F(G)]=H,ne[G]=function(){const Z=Re(arguments,G);switch(Z.length){case 0:this[We]=new H;break;case 1:this[We]=new H(Z[0]);break;case 2:this[We]=new H(Z[0],Z[1]);break;case 3:this[We]=new H(Z[0],Z[1],Z[2]);break;case 4:this[We]=new H(Z[0],Z[1],Z[2],Z[3]);break;default:throw new Error("Arg list too long.")}},tt(ne[G],H);const q=new H(function(){});let B;for(B in q)G==="XMLHttpRequest"&&B==="responseBlob"||(function(Z){typeof q[Z]=="function"?ne[G].prototype[Z]=function(){return this[We][Z].apply(this[We],arguments)}:R(ne[G].prototype,Z,{set:function(J){typeof J=="function"?(this[We][Z]=V(J,G+"."+Z),tt(this[We][Z],J)):this[We][Z]=J},get:function(){return this[We][Z]}})})(B);for(B in H)B!=="prototype"&&H.hasOwnProperty(B)&&(ne[G][B]=H[B])}function et(G,H,q){let B=G;for(;B&&!B.hasOwnProperty(H);)B=M(B);!B&&G[H]&&(B=G);const Z=F(H);let J=null;if(B&&(!(J=B[Z])||!B.hasOwnProperty(Z))){J=B[Z]=B[H];const se=B&&O(B,H);if(je(se)){const ie=q(J,Z,H);B[H]=function(){return ie(this,arguments)},tt(B[H],J)}}return J}function Yt(G,H,q){let B=null;function Z(J){const se=J.data;return se.args[se.cbIdx]=function(){J.invoke.apply(this,arguments)},B.apply(se.target,se.args),J}B=et(G,H,J=>function(se,ie){const _e=q(se,ie);return _e.cbIdx>=0&&typeof ie[_e.cbIdx]=="function"?k(_e.name,ie[_e.cbIdx],_e,Z):J.apply(se,ie)})}function tt(G,H){G[F("OriginalDelegate")]=H}let Nt=!1,yt=!1;function $t(){if(Nt)return yt;Nt=!0;try{const G=ee.navigator.userAgent;(G.indexOf("MSIE ")!==-1||G.indexOf("Trident/")!==-1||G.indexOf("Edge/")!==-1)&&(yt=!0)}catch{}return yt}function Rt(G){return typeof G=="function"}function Ct(G){return typeof G=="number"}const jt={useG:!0},qe={},Mt={},It=new RegExp("^"+x+"(\\w+)(true|false)$"),Lt=F("propagationStopped");function bt(G,H){const q=(H?H(G):G)+I,B=(H?H(G):G)+N,Z=x+q,J=x+B;qe[G]={},qe[G][I]=Z,qe[G][N]=J}function Kt(G,H,q,B){const Z=B&&B.add||C,J=B&&B.rm||L,se=B&&B.listeners||"eventListeners",ie=B&&B.rmAll||"removeAllListeners",_e=F(Z),ye="."+Z+":",oe="prependListener",Ee="."+oe+":",Oe=function(de,te,Ce){if(de.isRemoved)return;const Ie=de.callback;typeof Ie=="object"&&Ie.handleEvent&&(de.callback=ce=>Ie.handleEvent(ce),de.originalDelegate=Ie);let Fe;try{de.invoke(de,te,[Ce])}catch(ce){Fe=ce}const be=de.options;if(be&&typeof be=="object"&&be.once){const ce=de.originalDelegate?de.originalDelegate:de.callback;te[J].call(te,Ce.type,ce,be)}return Fe};function Me(de,te,Ce){if(te=te||G.event,!te)return;const Ie=de||te.target||G,Fe=Ie[qe[te.type][Ce?N:I]];if(Fe){const be=[];if(Fe.length===1){const ce=Oe(Fe[0],Ie,te);ce&&be.push(ce)}else{const ce=Fe.slice();for(let xe=0;xe<ce.length&&!(te&&te[Lt]===!0);xe++){const he=Oe(ce[xe],Ie,te);he&&be.push(he)}}if(be.length===1)throw be[0];for(let ce=0;ce<be.length;ce++){const xe=be[ce];H.nativeScheduleMicroTask(()=>{throw xe})}}}const Ue=function(de){return Me(this,de,!1)},Be=function(de){return Me(this,de,!0)};function Ge(de,te){if(!de)return!1;let Ce=!0;te&&te.useG!==void 0&&(Ce=te.useG);const Ie=te&&te.vh;let Fe=!0;te&&te.chkDup!==void 0&&(Fe=te.chkDup);let be=!1;te&&te.rt!==void 0&&(be=te.rt);let ce=de;for(;ce&&!ce.hasOwnProperty(Z);)ce=M(ce);if(!ce&&de[Z]&&(ce=de),!ce||ce[_e])return!1;const xe=te&&te.eventNameToString,he={},Te=ce[_e]=ce[Z],fe=ce[F(J)]=ce[J],me=ce[F(se)]=ce[se],He=ce[F(ie)]=ce[ie];let Ve;te&&te.prepend&&(Ve=ce[F(te.prepend)]=ce[te.prepend]);function ge($,X){return X?typeof $=="boolean"?{capture:$,passive:!0}:$?typeof $=="object"&&$.passive!==!1?{...$,passive:!0}:$:{passive:!0}:$}const j=function($){if(!he.isExisting)return Te.call(he.target,he.eventName,he.capture?Be:Ue,he.options)},K=function($){if(!$.isRemoved){const X=qe[$.eventName];let pe;X&&(pe=X[$.capture?N:I]);const Se=pe&&$.target[pe];if(Se){for(let ue=0;ue<Se.length;ue++)if(Se[ue]===$){Se.splice(ue,1),$.isRemoved=!0,$.removeAbortListener&&($.removeAbortListener(),$.removeAbortListener=null),Se.length===0&&($.allRemoved=!0,$.target[pe]=null);break}}}if($.allRemoved)return fe.call($.target,$.eventName,$.capture?Be:Ue,$.options)},Y=function($){return Te.call(he.target,he.eventName,$.invoke,he.options)},ae=function($){return Ve.call(he.target,he.eventName,$.invoke,he.options)},Le=function($){return fe.call($.target,$.eventName,$.invoke,$.options)},Ze=Ce?j:Y,Ne=Ce?K:Le,rt=function($,X){const pe=typeof X;return pe==="function"&&$.callback===X||pe==="object"&&$.originalDelegate===X},it=te?.diff||rt,Ke=Zone[F("UNPATCHED_EVENTS")],lt=G[F("PASSIVE_EVENTS")];function Q($){if(typeof $=="object"&&$!==null){const X={...$};return $.signal&&(X.signal=$.signal),X}return $}const z=function($,X,pe,Se,ue=!1,Ae=!1){return function(){const ve=this||G;let Pe=arguments[0];te&&te.transferEventName&&(Pe=te.transferEventName(Pe));let De=arguments[1];if(!De)return $.apply(this,arguments);if(at&&Pe==="uncaughtException")return $.apply(this,arguments);let we=!1;if(typeof De!="function"){if(!De.handleEvent)return $.apply(this,arguments);we=!0}if(Ie&&!Ie($,De,ve,arguments))return;const nt=!!lt&&lt.indexOf(Pe)!==-1,Xe=Q(ge(arguments[2],nt)),ct=Xe?.signal;if(ct?.aborted)return;if(Ke){for(let Je=0;Je<Ke.length;Je++)if(Pe===Ke[Je])return nt?$.call(ve,Pe,De,Xe):$.apply(this,arguments)}const ht=Xe?typeof Xe=="boolean"?!0:Xe.capture:!1,Vt=Xe&&typeof Xe=="object"?Xe.once:!1,ir=Zone.current;let At=qe[Pe];At||(bt(Pe,xe),At=qe[Pe]);const kt=At[ht?N:I];let ut=ve[kt],Ft=!1;if(ut){if(Ft=!0,Fe){for(let Je=0;Je<ut.length;Je++)if(it(ut[Je],De))return}}else ut=ve[kt]=[];let St;const Bt=ve.constructor.name,Gt=Mt[Bt];Gt&&(St=Gt[Pe]),St||(St=Bt+X+(xe?xe(Pe):Pe)),he.options=Xe,Vt&&(he.options.once=!1),he.target=ve,he.capture=ht,he.eventName=Pe,he.isExisting=Ft;const dt=Ce?jt:void 0;dt&&(dt.taskData=he),ct&&(he.options.signal=void 0);const ze=ir.scheduleEventTask(St,De,dt,pe,Se);if(ct){he.options.signal=ct;const Je=()=>ze.zone.cancelTask(ze);$.call(ct,"abort",Je,{once:!0}),ze.removeAbortListener=()=>ct.removeEventListener("abort",Je)}if(he.target=null,dt&&(dt.taskData=null),Vt&&(he.options.once=!0),typeof ze.options!="boolean"&&(ze.options=Xe),ze.target=ve,ze.capture=ht,ze.eventName=Pe,we&&(ze.originalDelegate=De),Ae?ut.unshift(ze):ut.push(ze),ue)return ve}};return ce[Z]=z(Te,ye,Ze,Ne,be),Ve&&(ce[oe]=z(Ve,Ee,ae,Ne,be,!0)),ce[J]=function(){const $=this||G;let X=arguments[0];te&&te.transferEventName&&(X=te.transferEventName(X));const pe=arguments[2],Se=pe?typeof pe=="boolean"?!0:pe.capture:!1,ue=arguments[1];if(!ue)return fe.apply(this,arguments);if(Ie&&!Ie(fe,ue,$,arguments))return;const Ae=qe[X];let ve;Ae&&(ve=Ae[Se?N:I]);const Pe=ve&&$[ve];if(Pe)for(let De=0;De<Pe.length;De++){const we=Pe[De];if(it(we,ue)){if(Pe.splice(De,1),we.isRemoved=!0,Pe.length===0&&(we.allRemoved=!0,$[ve]=null,!Se&&typeof X=="string")){const nt=x+"ON_PROPERTY"+X;$[nt]=null}return we.zone.cancelTask(we),be?$:void 0}}return fe.apply(this,arguments)},ce[se]=function(){const $=this||G;let X=arguments[0];te&&te.transferEventName&&(X=te.transferEventName(X));const pe=[],Se=Dt($,xe?xe(X):X);for(let ue=0;ue<Se.length;ue++){const Ae=Se[ue];let ve=Ae.originalDelegate?Ae.originalDelegate:Ae.callback;pe.push(ve)}return pe},ce[ie]=function(){const $=this||G;let X=arguments[0];if(X){te&&te.transferEventName&&(X=te.transferEventName(X));const pe=qe[X];if(pe){const Se=pe[I],ue=pe[N],Ae=$[Se],ve=$[ue];if(Ae){const Pe=Ae.slice();for(let De=0;De<Pe.length;De++){const we=Pe[De];let nt=we.originalDelegate?we.originalDelegate:we.callback;this[J].call(this,X,nt,we.options)}}if(ve){const Pe=ve.slice();for(let De=0;De<Pe.length;De++){const we=Pe[De];let nt=we.originalDelegate?we.originalDelegate:we.callback;this[J].call(this,X,nt,we.options)}}}}else{const pe=Object.keys($);for(let Se=0;Se<pe.length;Se++){const ue=pe[Se],Ae=It.exec(ue);let ve=Ae&&Ae[1];ve&&ve!=="removeListener"&&this[ie].call(this,ve)}this[ie].call(this,"removeListener")}if(be)return this},tt(ce[Z],Te),tt(ce[J],fe),He&&tt(ce[ie],He),me&&tt(ce[se],me),!0}let ke=[];for(let de=0;de<q.length;de++)ke[de]=Ge(q[de],B);return ke}function Dt(G,H){if(!H){const J=[];for(let se in G){const ie=It.exec(se);let _e=ie&&ie[1];if(_e&&(!H||_e===H)){const ye=G[se];if(ye)for(let oe=0;oe<ye.length;oe++)J.push(ye[oe])}}return J}let q=qe[H];q||(bt(H),q=qe[H]);const B=G[q[I]],Z=G[q[N]];return B?Z?B.concat(Z):B.slice():Z?Z.slice():[]}function Zt(G,H){const q=G.Event;q&&q.prototype&&H.patchMethod(q.prototype,"stopImmediatePropagation",B=>function(Z,J){Z[Lt]=!0,B&&B.apply(Z,J)})}function qt(G,H){H.patchMethod(G,"queueMicrotask",q=>function(B,Z){Zone.current.scheduleMicroTask("queueMicrotask",Z[0])})}const Tt=F("zoneTask");function st(G,H,q,B){let Z=null,J=null;H+=B,q+=B;const se={};function ie(ye){const oe=ye.data;oe.args[0]=function(){return ye.invoke.apply(this,arguments)};const Ee=Z.apply(G,oe.args);return Ct(Ee)?oe.handleId=Ee:(oe.handle=Ee,oe.isRefreshable=Rt(Ee.refresh)),ye}function _e(ye){const{handle:oe,handleId:Ee}=ye.data;return J.call(G,oe??Ee)}Z=et(G,H,ye=>function(oe,Ee){if(Rt(Ee[0])){const Oe={isRefreshable:!1,isPeriodic:B==="Interval",delay:B==="Timeout"||B==="Interval"?Ee[1]||0:void 0,args:Ee},Me=Ee[0];Ee[0]=function(){try{return Me.apply(this,arguments)}finally{const{handle:Ce,handleId:Ie,isPeriodic:Fe,isRefreshable:be}=Oe;!Fe&&!be&&(Ie?delete se[Ie]:Ce&&(Ce[Tt]=null))}};const Ue=k(H,Ee[0],Oe,ie,_e);if(!Ue)return Ue;const{handleId:Be,handle:Ge,isRefreshable:ke,isPeriodic:de}=Ue.data;if(Be)se[Be]=Ue;else if(Ge&&(Ge[Tt]=Ue,ke&&!de)){const te=Ge.refresh;Ge.refresh=function(){const{zone:Ce,state:Ie}=Ue;return Ie==="notScheduled"?(Ue._state="scheduled",Ce._updateTaskCount(Ue,1)):Ie==="running"&&(Ue._state="scheduling"),te.call(this)}}return Ge??Be??Ue}else return ye.apply(G,Ee)}),J=et(G,q,ye=>function(oe,Ee){const Oe=Ee[0];let Me;Ct(Oe)?(Me=se[Oe],delete se[Oe]):(Me=Oe?.[Tt],Me?Oe[Tt]=null:Me=Oe),Me?.type?Me.cancelFn&&Me.zone.cancelTask(Me):ye.apply(G,Ee)})}function Wt(G,H){const{isBrowser:q,isMix:B}=H.getGlobalObjects();if(!q&&!B||!G.customElements||!("customElements"in G))return;const Z=["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formAssociatedCallback","formDisabledCallback","formResetCallback","formStateRestoreCallback"];H.patchCallbacks(H,G.customElements,"customElements","define",Z)}function zt(G,H){if(Zone[H.symbol("patchEventTarget")])return;const{eventNames:q,zoneSymbolEventNames:B,TRUE_STR:Z,FALSE_STR:J,ZONE_SYMBOL_PREFIX:se}=H.getGlobalObjects();for(let _e=0;_e<q.length;_e++){const ye=q[_e],oe=ye+J,Ee=ye+Z,Oe=se+oe,Me=se+Ee;B[ye]={},B[ye][J]=Oe,B[ye][Z]=Me}const ie=G.EventTarget;if(!(!ie||!ie.prototype))return H.patchEventTarget(G,H,[ie&&ie.prototype]),!0}function Xt(G,H){H.patchEventPrototype(G,H)}function wt(G,H,q){if(!q||q.length===0)return H;const B=q.filter(J=>J.target===G);if(B.length===0)return H;const Z=B[0].ignoreProperties;return H.filter(J=>Z.indexOf(J)===-1)}function Ut(G,H,q,B){if(!G)return;const Z=wt(G,H,q);gt(G,Z,B)}function mt(G){return Object.getOwnPropertyNames(G).filter(H=>H.startsWith("on")&&H.length>2).map(H=>H.substring(2))}function Jt(G,H){if(at&&!vt||Zone[G.symbol("patchEvents")])return;const q=H.__Zone_ignore_on_properties;let B=[];if(ft){const Z=window;B=B.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);const J=[];Ut(Z,mt(Z),q&&q.concat(J),M(Z))}B=B.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let Z=0;Z<B.length;Z++){const J=H[B[Z]];J?.prototype&&Ut(J.prototype,mt(J.prototype),q)}}function Qt(G){G.__load_patch("legacy",H=>{const q=H[G.__symbol__("legacyPatch")];q&&q()}),G.__load_patch("timers",H=>{const B="clear";st(H,"set",B,"Timeout"),st(H,"set",B,"Interval"),st(H,"set",B,"Immediate")}),G.__load_patch("requestAnimationFrame",H=>{st(H,"request","cancel","AnimationFrame"),st(H,"mozRequest","mozCancel","AnimationFrame"),st(H,"webkitRequest","webkitCancel","AnimationFrame")}),G.__load_patch("blocking",(H,q)=>{const B=["alert","prompt","confirm"];for(let Z=0;Z<B.length;Z++){const J=B[Z];et(H,J,(se,ie,_e)=>function(ye,oe){return q.current.run(se,H,oe,_e)})}}),G.__load_patch("EventTarget",(H,q,B)=>{Xt(H,B),zt(H,B);const Z=H.XMLHttpRequestEventTarget;Z&&Z.prototype&&B.patchEventTarget(H,B,[Z.prototype])}),G.__load_patch("MutationObserver",(H,q,B)=>{_t("MutationObserver"),_t("WebKitMutationObserver")}),G.__load_patch("IntersectionObserver",(H,q,B)=>{_t("IntersectionObserver")}),G.__load_patch("FileReader",(H,q,B)=>{_t("FileReader")}),G.__load_patch("on_property",(H,q,B)=>{Jt(B,H)}),G.__load_patch("customElements",(H,q,B)=>{Wt(H,B)}),G.__load_patch("XHR",(H,q)=>{ye(H);const B=F("xhrTask"),Z=F("xhrSync"),J=F("xhrListener"),se=F("xhrScheduled"),ie=F("xhrURL"),_e=F("xhrErrorBeforeScheduled");function ye(oe){const Ee=oe.XMLHttpRequest;if(!Ee)return;const Oe=Ee.prototype;function Me(Te){return Te[B]}let Ue=Oe[y],Be=Oe[_];if(!Ue){const Te=oe.XMLHttpRequestEventTarget;if(Te){const fe=Te.prototype;Ue=fe[y],Be=fe[_]}}const Ge="readystatechange",ke="scheduled";function de(Te){const fe=Te.data,me=fe.target;me[se]=!1,me[_e]=!1;const He=me[J];Ue||(Ue=me[y],Be=me[_]),He&&Be.call(me,Ge,He);const Ve=me[J]=()=>{if(me.readyState===me.DONE)if(!fe.aborted&&me[se]&&Te.state===ke){const j=me[q.__symbol__("loadfalse")];if(me.status!==0&&j&&j.length>0){const K=Te.invoke;Te.invoke=function(){const Y=me[q.__symbol__("loadfalse")];for(let ae=0;ae<Y.length;ae++)Y[ae]===Te&&Y.splice(ae,1);!fe.aborted&&Te.state===ke&&K.call(Te)},j.push(Te)}else Te.invoke()}else!fe.aborted&&me[se]===!1&&(me[_e]=!0)};return Ue.call(me,Ge,Ve),me[B]||(me[B]=Te),xe.apply(me,fe.args),me[se]=!0,Te}function te(){}function Ce(Te){const fe=Te.data;return fe.aborted=!0,he.apply(fe.target,fe.args)}const Ie=et(Oe,"open",()=>function(Te,fe){return Te[Z]=fe[2]==!1,Te[ie]=fe[1],Ie.apply(Te,fe)}),Fe="XMLHttpRequest.send",be=F("fetchTaskAborting"),ce=F("fetchTaskScheduling"),xe=et(Oe,"send",()=>function(Te,fe){if(q.current[ce]===!0||Te[Z])return xe.apply(Te,fe);{const me={target:Te,url:Te[ie],isPeriodic:!1,args:fe,aborted:!1},He=k(Fe,te,me,de,Ce);Te&&Te[_e]===!0&&!me.aborted&&He.state===ke&&He.invoke()}}),he=et(Oe,"abort",()=>function(Te,fe){const me=Me(Te);if(me&&typeof me.type=="string"){if(me.cancelFn==null||me.data&&me.data.aborted)return;me.zone.cancelTask(me)}else if(q.current[be]===!0)return he.apply(Te,fe)})}}),G.__load_patch("geolocation",H=>{H.navigator&&H.navigator.geolocation&&Qe(H.navigator.geolocation,["getCurrentPosition","watchPosition"])}),G.__load_patch("PromiseRejectionEvent",(H,q)=>{function B(Z){return function(J){Dt(H,Z).forEach(ie=>{const _e=H.PromiseRejectionEvent;if(_e){const ye=new _e(Z,{promise:J.promise,reason:J.rejection});ie.invoke(ye)}})}}H.PromiseRejectionEvent&&(q[F("unhandledPromiseRejectionHandler")]=B("unhandledrejection"),q[F("rejectionHandledHandler")]=B("rejectionhandled"))}),G.__load_patch("queueMicrotask",(H,q,B)=>{qt(H,B)})}function er(G){G.__load_patch("ZoneAwarePromise",(H,q,B)=>{const Z=Object.getOwnPropertyDescriptor,J=Object.defineProperty;function se(Q){if(Q&&Q.toString===Object.prototype.toString){const z=Q.constructor&&Q.constructor.name;return(z||"")+": "+JSON.stringify(Q)}return Q?Q.toString():Object.prototype.toString.call(Q)}const ie=B.symbol,_e=[],ye=H[ie("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")]!==!1,oe=ie("Promise"),Ee=ie("then"),Oe="__creationTrace__";B.onUnhandledError=Q=>{if(B.showUncaughtError()){const z=Q&&Q.rejection;z?console.error("Unhandled Promise rejection:",z instanceof Error?z.message:z,"; Zone:",Q.zone.name,"; Task:",Q.task&&Q.task.source,"; Value:",z,z instanceof Error?z.stack:void 0):console.error(Q)}},B.microtaskDrainDone=()=>{for(;_e.length;){const Q=_e.shift();try{Q.zone.runGuarded(()=>{throw Q.throwOriginal?Q.rejection:Q})}catch(z){Ue(z)}}};const Me=ie("unhandledPromiseRejectionHandler");function Ue(Q){B.onUnhandledError(Q);try{const z=q[Me];typeof z=="function"&&z.call(this,Q)}catch{}}function Be(Q){return Q&&typeof Q.then=="function"}function Ge(Q){return Q}function ke(Q){return Ne.reject(Q)}const de=ie("state"),te=ie("value"),Ce=ie("finally"),Ie=ie("parentPromiseValue"),Fe=ie("parentPromiseState"),be="Promise.then",ce=null,xe=!0,he=!1,Te=0;function fe(Q,z){return $=>{try{ge(Q,z,$)}catch(X){ge(Q,!1,X)}}}const me=function(){let Q=!1;return function($){return function(){Q||(Q=!0,$.apply(null,arguments))}}},He="Promise resolved with itself",Ve=ie("currentTaskTrace");function ge(Q,z,$){const X=me();if(Q===$)throw new TypeError(He);if(Q[de]===ce){let pe=null;try{(typeof $=="object"||typeof $=="function")&&(pe=$&&$.then)}catch(Se){return X(()=>{ge(Q,!1,Se)})(),Q}if(z!==he&&$ instanceof Ne&&$.hasOwnProperty(de)&&$.hasOwnProperty(te)&&$[de]!==ce)K($),ge(Q,$[de],$[te]);else if(z!==he&&typeof pe=="function")try{pe.call($,X(fe(Q,z)),X(fe(Q,!1)))}catch(Se){X(()=>{ge(Q,!1,Se)})()}else{Q[de]=z;const Se=Q[te];if(Q[te]=$,Q[Ce]===Ce&&z===xe&&(Q[de]=Q[Fe],Q[te]=Q[Ie]),z===he&&$ instanceof Error){const ue=q.currentTask&&q.currentTask.data&&q.currentTask.data[Oe];ue&&J($,Ve,{configurable:!0,enumerable:!1,writable:!0,value:ue})}for(let ue=0;ue<Se.length;)Y(Q,Se[ue++],Se[ue++],Se[ue++],Se[ue++]);if(Se.length==0&&z==he){Q[de]=Te;let ue=$;try{throw new Error("Uncaught (in promise): "+se($)+($&&$.stack?`
244
- `+$.stack:""))}catch(Ae){ue=Ae}ye&&(ue.throwOriginal=!0),ue.rejection=$,ue.promise=Q,ue.zone=q.current,ue.task=q.currentTask,_e.push(ue),B.scheduleMicroTask()}}}return Q}const j=ie("rejectionHandledHandler");function K(Q){if(Q[de]===Te){try{const z=q[j];z&&typeof z=="function"&&z.call(this,{rejection:Q[te],promise:Q})}catch{}Q[de]=he;for(let z=0;z<_e.length;z++)Q===_e[z].promise&&_e.splice(z,1)}}function Y(Q,z,$,X,pe){K(Q);const Se=Q[de],ue=Se?typeof X=="function"?X:Ge:typeof pe=="function"?pe:ke;z.scheduleMicroTask(be,()=>{try{const Ae=Q[te],ve=!!$&&Ce===$[Ce];ve&&($[Ie]=Ae,$[Fe]=Se);const Pe=z.run(ue,void 0,ve&&ue!==ke&&ue!==Ge?[]:[Ae]);ge($,!0,Pe)}catch(Ae){ge($,!1,Ae)}},$)}const ae="function ZoneAwarePromise() { [native code] }",Le=function(){},Ze=H.AggregateError;class Ne{static toString(){return ae}static resolve(z){return z instanceof Ne?z:ge(new this(null),xe,z)}static reject(z){return ge(new this(null),he,z)}static withResolvers(){const z={};return z.promise=new Ne(($,X)=>{z.resolve=$,z.reject=X}),z}static any(z){if(!z||typeof z[Symbol.iterator]!="function")return Promise.reject(new Ze([],"All promises were rejected"));const $=[];let X=0;try{for(let ue of z)X++,$.push(Ne.resolve(ue))}catch{return Promise.reject(new Ze([],"All promises were rejected"))}if(X===0)return Promise.reject(new Ze([],"All promises were rejected"));let pe=!1;const Se=[];return new Ne((ue,Ae)=>{for(let ve=0;ve<$.length;ve++)$[ve].then(Pe=>{pe||(pe=!0,ue(Pe))},Pe=>{Se.push(Pe),X--,X===0&&(pe=!0,Ae(new Ze(Se,"All promises were rejected")))})})}static race(z){let $,X,pe=new this((Ae,ve)=>{$=Ae,X=ve});function Se(Ae){$(Ae)}function ue(Ae){X(Ae)}for(let Ae of z)Be(Ae)||(Ae=this.resolve(Ae)),Ae.then(Se,ue);return pe}static all(z){return Ne.allWithCallback(z)}static allSettled(z){return(this&&this.prototype instanceof Ne?this:Ne).allWithCallback(z,{thenCallback:X=>({status:"fulfilled",value:X}),errorCallback:X=>({status:"rejected",reason:X})})}static allWithCallback(z,$){let X,pe,Se=new this((Pe,De)=>{X=Pe,pe=De}),ue=2,Ae=0;const ve=[];for(let Pe of z){Be(Pe)||(Pe=this.resolve(Pe));const De=Ae;try{Pe.then(we=>{ve[De]=$?$.thenCallback(we):we,ue--,ue===0&&X(ve)},we=>{$?(ve[De]=$.errorCallback(we),ue--,ue===0&&X(ve)):pe(we)})}catch(we){pe(we)}ue++,Ae++}return ue-=2,ue===0&&X(ve),Se}constructor(z){const $=this;if(!($ instanceof Ne))throw new Error("Must be an instanceof Promise.");$[de]=ce,$[te]=[];try{const X=me();z&&z(X(fe($,xe)),X(fe($,he)))}catch(X){ge($,!1,X)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return Ne}then(z,$){let X=this.constructor?.[Symbol.species];(!X||typeof X!="function")&&(X=this.constructor||Ne);const pe=new X(Le),Se=q.current;return this[de]==ce?this[te].push(Se,pe,z,$):Y(this,Se,pe,z,$),pe}catch(z){return this.then(null,z)}finally(z){let $=this.constructor?.[Symbol.species];(!$||typeof $!="function")&&($=Ne);const X=new $(Le);X[Ce]=Ce;const pe=q.current;return this[de]==ce?this[te].push(pe,X,z,z):Y(this,pe,X,z,z),X}}Ne.resolve=Ne.resolve,Ne.reject=Ne.reject,Ne.race=Ne.race,Ne.all=Ne.all;const rt=H[oe]=H.Promise;H.Promise=Ne;const it=ie("thenPatched");function Ke(Q){const z=Q.prototype,$=Z(z,"then");if($&&($.writable===!1||!$.configurable))return;const X=z.then;z[Ee]=X,Q.prototype.then=function(pe,Se){return new Ne((Ae,ve)=>{X.call(this,Ae,ve)}).then(pe,Se)},Q[it]=!0}B.patchThen=Ke;function lt(Q){return function(z,$){let X=Q.apply(z,$);if(X instanceof Ne)return X;let pe=X.constructor;return pe[it]||Ke(pe),X}}return rt&&(Ke(rt),et(H,"fetch",Q=>lt(Q))),Promise[q.__symbol__("uncaughtPromiseErrors")]=_e,Ne})}function tr(G){G.__load_patch("toString",H=>{const q=Function.prototype.toString,B=F("OriginalDelegate"),Z=F("Promise"),J=F("Error"),se=function(){if(typeof this=="function"){const oe=this[B];if(oe)return typeof oe=="function"?q.call(oe):Object.prototype.toString.call(oe);if(this===Promise){const Ee=H[Z];if(Ee)return q.call(Ee)}if(this===Error){const Ee=H[J];if(Ee)return q.call(Ee)}}return q.call(this)};se[B]=q,Function.prototype.toString=se;const ie=Object.prototype.toString,_e="[object Promise]";Object.prototype.toString=function(){return typeof Promise=="function"&&this instanceof Promise?_e:ie.call(this)}})}function rr(G,H,q,B,Z){const J=Zone.__symbol__(B);if(H[J])return;const se=H[J]=H[B];H[B]=function(ie,_e,ye){return _e&&_e.prototype&&Z.forEach(function(oe){const Ee=`${q}.${B}::`+oe,Oe=_e.prototype;try{if(Oe.hasOwnProperty(oe)){const Me=G.ObjectGetOwnPropertyDescriptor(Oe,oe);Me&&Me.value?(Me.value=G.wrapWithCurrentZone(Me.value,Ee),G._redefineProperty(_e.prototype,oe,Me)):Oe[oe]&&(Oe[oe]=G.wrapWithCurrentZone(Oe[oe],Ee))}else Oe[oe]&&(Oe[oe]=G.wrapWithCurrentZone(Oe[oe],Ee))}catch{}}),se.call(H,ie,_e,ye)},G.attachOriginToPatched(H[B],se)}function nr(G){G.__load_patch("util",(H,q,B)=>{const Z=mt(H);B.patchOnProperties=gt,B.patchMethod=et,B.bindArguments=Re,B.patchMacroTask=Yt;const J=q.__symbol__("BLACK_LISTED_EVENTS"),se=q.__symbol__("UNPATCHED_EVENTS");H[se]&&(H[J]=H[se]),H[J]&&(q[J]=q[se]=H[J]),B.patchEventPrototype=Zt,B.patchEventTarget=Kt,B.isIEOrEdge=$t,B.ObjectDefineProperty=R,B.ObjectGetOwnPropertyDescriptor=O,B.ObjectCreate=D,B.ArraySlice=U,B.patchClass=_t,B.wrapWithCurrentZone=V,B.filterProperties=wt,B.attachOriginToPatched=tt,B._redefineProperty=Object.defineProperty,B.patchCallbacks=rr,B.getGlobalObjects=()=>({globalSources:Mt,zoneSymbolEventNames:qe,eventNames:Z,isBrowser:ft,isMix:vt,isNode:at,TRUE_STR:N,FALSE_STR:I,ZONE_SYMBOL_PREFIX:x,ADD_EVENT_LISTENER_STR:C,REMOVE_EVENT_LISTENER_STR:L})})}function or(G){er(G),tr(G),nr(G)}const xt=P();return or(xt),Qt(xt),zone}requireZone();const index$2=Object.freeze(Object.defineProperty({__proto__:null,ZoneContextManager},Symbol.toStringTag,{value:"Module"}));var detectResources$1={},Resource={};const require$$1$1=getAugmentedNamespace(esm$2),require$$1=getAugmentedNamespace(esm$1),require$$2=getAugmentedNamespace(esm);var browser={},defaultServiceName={},hasRequiredDefaultServiceName;function requireDefaultServiceName(){if(hasRequiredDefaultServiceName)return defaultServiceName;hasRequiredDefaultServiceName=1,Object.defineProperty(defaultServiceName,"__esModule",{value:!0}),defaultServiceName.defaultServiceName=void 0;function S(){return"unknown_service"}return defaultServiceName.defaultServiceName=S,defaultServiceName}var hasRequiredBrowser;function requireBrowser(){return hasRequiredBrowser||(hasRequiredBrowser=1,(function(S){Object.defineProperty(S,"__esModule",{value:!0}),S.defaultServiceName=void 0;var T=requireDefaultServiceName();Object.defineProperty(S,"defaultServiceName",{enumerable:!0,get:function(){return T.defaultServiceName}})})(browser)),browser}var hasRequiredResource;function requireResource(){if(hasRequiredResource)return Resource;hasRequiredResource=1,Object.defineProperty(Resource,"__esModule",{value:!0}),Resource.Resource=void 0;const S=require$$1$1,T=require$$1,A=require$$2,P=requireBrowser();let O=class pt{constructor(M,D){var U;this._attributes=M,this.asyncAttributesPending=D!=null,this._syncAttributes=(U=this._attributes)!==null&&U!==void 0?U:{},this._asyncAttributesPromise=D?.then(C=>(this._attributes=Object.assign({},this._attributes,C),this.asyncAttributesPending=!1,C),C=>(S.diag.debug("a resource's async attributes promise rejected: %s",C),this.asyncAttributesPending=!1,{}))}static empty(){return pt.EMPTY}static default(){return new pt({[T.SEMRESATTRS_SERVICE_NAME]:(0,P.defaultServiceName)(),[T.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE]:A.SDK_INFO[T.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE],[T.SEMRESATTRS_TELEMETRY_SDK_NAME]:A.SDK_INFO[T.SEMRESATTRS_TELEMETRY_SDK_NAME],[T.SEMRESATTRS_TELEMETRY_SDK_VERSION]:A.SDK_INFO[T.SEMRESATTRS_TELEMETRY_SDK_VERSION]})}get attributes(){var M;return this.asyncAttributesPending&&S.diag.error("Accessing resource attributes before async attributes settled"),(M=this._attributes)!==null&&M!==void 0?M:{}}async waitForAsyncAttributes(){this.asyncAttributesPending&&await this._asyncAttributesPromise}merge(M){var D;if(!M)return this;const U=Object.assign(Object.assign({},this._syncAttributes),(D=M._syncAttributes)!==null&&D!==void 0?D:M.attributes);if(!this._asyncAttributesPromise&&!M._asyncAttributesPromise)return new pt(U);const C=Promise.all([this._asyncAttributesPromise,M._asyncAttributesPromise]).then(([L,y])=>{var _;return Object.assign(Object.assign(Object.assign(Object.assign({},this._syncAttributes),L),(_=M._syncAttributes)!==null&&_!==void 0?_:M.attributes),y)});return new pt(U,C)}};return Resource.Resource=O,O.EMPTY=new O({}),Resource}var utils={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils;hasRequiredUtils=1,Object.defineProperty(utils,"__esModule",{value:!0}),utils.isPromiseLike=void 0;const S=T=>T!==null&&typeof T=="object"&&typeof T.then=="function";return utils.isPromiseLike=S,utils}var hasRequiredDetectResources;function requireDetectResources(){if(hasRequiredDetectResources)return detectResources$1;hasRequiredDetectResources=1,Object.defineProperty(detectResources$1,"__esModule",{value:!0}),detectResources$1.detectResourcesSync=detectResources$1.detectResources=void 0;const S=requireResource(),T=require$$1$1,A=requireUtils(),P=async(M={})=>{const D=await Promise.all((M.detectors||[]).map(async U=>{try{const C=await U.detect(M);return T.diag.debug(`${U.constructor.name} found resource.`,C),C}catch(C){return T.diag.debug(`${U.constructor.name} failed: ${C.message}`),S.Resource.empty()}}));return R(D),D.reduce((U,C)=>U.merge(C),S.Resource.empty())};detectResources$1.detectResources=P;const O=(M={})=>{var D;const U=((D=M.detectors)!==null&&D!==void 0?D:[]).map(L=>{try{const y=L.detect(M);let _;if((0,A.isPromiseLike)(y)){const N=async()=>{var I;const x=await y;return await((I=x.waitForAsyncAttributes)===null||I===void 0?void 0:I.call(x)),x.attributes};_=new S.Resource({},N())}else _=y;return _.waitForAsyncAttributes?_.waitForAsyncAttributes().then(()=>T.diag.debug(`${L.constructor.name} found resource.`,_)):T.diag.debug(`${L.constructor.name} found resource.`,_),_}catch(y){return T.diag.error(`${L.constructor.name} failed: ${y.message}`),S.Resource.empty()}}),C=U.reduce((L,y)=>L.merge(y),S.Resource.empty());return C.waitForAsyncAttributes&&C.waitForAsyncAttributes().then(()=>{R(U)}),C};detectResources$1.detectResourcesSync=O;const R=M=>{M.forEach(D=>{if(Object.keys(D.attributes).length>0){const U=JSON.stringify(D.attributes,null,4);T.diag.verbose(U)}})};return detectResources$1}var detectResourcesExports=requireDetectResources();const detectResources=_mergeNamespaces({__proto__:null},[detectResourcesExports]);var OTLPExporterBase=(function(){function S(T){this._delegate=T}return S.prototype.export=function(T,A){this._delegate.export(T,A)},S.prototype.forceFlush=function(){return this._delegate.forceFlush()},S.prototype.shutdown=function(){return this._delegate.shutdown()},S})(),__extends$1=(function(){var S=function(T,A){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,O){P.__proto__=O}||function(P,O){for(var R in O)Object.prototype.hasOwnProperty.call(O,R)&&(P[R]=O[R])},S(T,A)};return function(T,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");S(T,A);function P(){this.constructor=T}T.prototype=A===null?Object.create(A):(P.prototype=A.prototype,new P)}})(),OTLPExporterError=(function(S){__extends$1(T,S);function T(A,P,O){var R=S.call(this,A)||this;return R.name="OTLPExporterError",R.data=O,R.code=P,R}return T})(Error);function validateTimeoutMillis(S){if(!Number.isNaN(S)&&Number.isFinite(S)&&S>0)return S;throw new Error("Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '"+S+"')")}function wrapStaticHeadersInFunction(S){if(S!=null)return function(){return S}}function mergeOtlpSharedConfigurationWithDefaults(S,T,A){var P,O,R,M,D,U;return{timeoutMillis:validateTimeoutMillis((O=(P=S.timeoutMillis)!==null&&P!==void 0?P:T.timeoutMillis)!==null&&O!==void 0?O:A.timeoutMillis),concurrencyLimit:(M=(R=S.concurrencyLimit)!==null&&R!==void 0?R:T.concurrencyLimit)!==null&&M!==void 0?M:A.concurrencyLimit,compression:(U=(D=S.compression)!==null&&D!==void 0?D:T.compression)!==null&&U!==void 0?U:A.compression}}function getSharedConfigurationDefaults(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var __awaiter$2=function(S,T,A,P){function O(R){return R instanceof A?R:new A(function(M){M(R)})}return new(A||(A=Promise))(function(R,M){function D(L){try{C(P.next(L))}catch(y){M(y)}}function U(L){try{C(P.throw(L))}catch(y){M(y)}}function C(L){L.done?R(L.value):O(L.value).then(D,U)}C((P=P.apply(S,T||[])).next())})},__generator$2=function(S,T){var A={label:0,sent:function(){if(R[0]&1)throw R[1];return R[1]},trys:[],ops:[]},P,O,R,M;return M={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(M[Symbol.iterator]=function(){return this}),M;function D(C){return function(L){return U([C,L])}}function U(C){if(P)throw new TypeError("Generator is already executing.");for(;A;)try{if(P=1,O&&(R=C[0]&2?O.return:C[0]?O.throw||((R=O.return)&&R.call(O),0):O.next)&&!(R=R.call(O,C[1])).done)return R;switch(O=0,R&&(C=[C[0]&2,R.value]),C[0]){case 0:case 1:R=C;break;case 4:return A.label++,{value:C[1],done:!1};case 5:A.label++,O=C[1],C=[0];continue;case 7:C=A.ops.pop(),A.trys.pop();continue;default:if(R=A.trys,!(R=R.length>0&&R[R.length-1])&&(C[0]===6||C[0]===2)){A=0;continue}if(C[0]===3&&(!R||C[1]>R[0]&&C[1]<R[3])){A.label=C[1];break}if(C[0]===6&&A.label<R[1]){A.label=R[1],R=C;break}if(R&&A.label<R[2]){A.label=R[2],A.ops.push(C);break}R[2]&&A.ops.pop(),A.trys.pop();continue}C=T.call(S,A)}catch(L){C=[6,L],O=0}finally{P=R=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},BoundedQueueExportPromiseHandler=(function(){function S(T){this._sendingPromises=[],this._concurrencyLimit=T}return S.prototype.pushPromise=function(T){var A=this;if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(T);var P=function(){var O=A._sendingPromises.indexOf(T);A._sendingPromises.splice(O,1)};T.then(P,P)},S.prototype.hasReachedLimit=function(){return this._sendingPromises.length>=this._concurrencyLimit},S.prototype.awaitAll=function(){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(T){switch(T.label){case 0:return[4,Promise.all(this._sendingPromises)];case 1:return T.sent(),[2]}})})},S})();function createBoundedQueueExportPromiseHandler(S){return new BoundedQueueExportPromiseHandler(S.concurrencyLimit)}function isPartialSuccessResponse(S){return Object.prototype.hasOwnProperty.call(S,"partialSuccess")}function createLoggingPartialSuccessResponseHandler(){return{handleResponse:function(S){S==null||!isPartialSuccessResponse(S)||S.partialSuccess==null||Object.keys(S.partialSuccess).length===0||diag.warn("Received Partial Success response:",JSON.stringify(S.partialSuccess))}}}var __awaiter$1=function(S,T,A,P){function O(R){return R instanceof A?R:new A(function(M){M(R)})}return new(A||(A=Promise))(function(R,M){function D(L){try{C(P.next(L))}catch(y){M(y)}}function U(L){try{C(P.throw(L))}catch(y){M(y)}}function C(L){L.done?R(L.value):O(L.value).then(D,U)}C((P=P.apply(S,T||[])).next())})},__generator$1=function(S,T){var A={label:0,sent:function(){if(R[0]&1)throw R[1];return R[1]},trys:[],ops:[]},P,O,R,M;return M={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(M[Symbol.iterator]=function(){return this}),M;function D(C){return function(L){return U([C,L])}}function U(C){if(P)throw new TypeError("Generator is already executing.");for(;A;)try{if(P=1,O&&(R=C[0]&2?O.return:C[0]?O.throw||((R=O.return)&&R.call(O),0):O.next)&&!(R=R.call(O,C[1])).done)return R;switch(O=0,R&&(C=[C[0]&2,R.value]),C[0]){case 0:case 1:R=C;break;case 4:return A.label++,{value:C[1],done:!1};case 5:A.label++,O=C[1],C=[0];continue;case 7:C=A.ops.pop(),A.trys.pop();continue;default:if(R=A.trys,!(R=R.length>0&&R[R.length-1])&&(C[0]===6||C[0]===2)){A=0;continue}if(C[0]===3&&(!R||C[1]>R[0]&&C[1]<R[3])){A.label=C[1];break}if(C[0]===6&&A.label<R[1]){A.label=R[1],R=C;break}if(R&&A.label<R[2]){A.label=R[2],A.ops.push(C);break}R[2]&&A.ops.pop(),A.trys.pop();continue}C=T.call(S,A)}catch(L){C=[6,L],O=0}finally{P=R=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},OTLPExportDelegate=(function(){function S(T,A,P,O,R){this._transport=T,this._serializer=A,this._responseHandler=P,this._promiseQueue=O,this._timeout=R,this._diagLogger=diag.createComponentLogger({namespace:"OTLPExportDelegate"})}return S.prototype.export=function(T,A){var P=this;if(this._diagLogger.debug("items to be sent",T),this._promiseQueue.hasReachedLimit()){A({code:ExportResultCode.FAILED,error:new Error("Concurrent export limit reached")});return}var O=this._serializer.serializeRequest(T);if(O==null){A({code:ExportResultCode.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(O,this._timeout).then(function(R){if(R.status==="success"){if(R.data!=null)try{P._responseHandler.handleResponse(P._serializer.deserializeResponse(R.data))}catch(M){P._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",M,R.data)}A({code:ExportResultCode.SUCCESS});return}else if(R.status==="failure"&&R.error){A({code:ExportResultCode.FAILED,error:R.error});return}else R.status==="retryable"?A({code:ExportResultCode.FAILED,error:new OTLPExporterError("Export failed with retryable status")}):A({code:ExportResultCode.FAILED,error:new OTLPExporterError("Export failed with unknown error")})},function(R){return A({code:ExportResultCode.FAILED,error:R})}))},S.prototype.forceFlush=function(){return this._promiseQueue.awaitAll()},S.prototype.shutdown=function(){return __awaiter$1(this,void 0,void 0,function(){return __generator$1(this,function(T){switch(T.label){case 0:return this._diagLogger.debug("shutdown started"),[4,this.forceFlush()];case 1:return T.sent(),this._transport.shutdown(),[2]}})})},S})();function createOtlpExportDelegate(S,T){return new OTLPExportDelegate(S.transport,S.serializer,createLoggingPartialSuccessResponseHandler(),S.promiseHandler,T.timeout)}function createOtlpNetworkExportDelegate(S,T,A){return createOtlpExportDelegate({transport:A,serializer:T,promiseHandler:createBoundedQueueExportPromiseHandler(S)},{timeout:S.timeoutMillis})}var indexMinimal={},minimal$1={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=S;function S(T,A){for(var P=new Array(arguments.length-1),O=0,R=2,M=!0;R<arguments.length;)P[O++]=arguments[R++];return new Promise(function(U,C){P[O]=function(y){if(M)if(M=!1,y)C(y);else{for(var _=new Array(arguments.length-1),N=0;N<_.length;)_[N++]=arguments[N];U.apply(null,_)}};try{T.apply(A||null,P)}catch(L){M&&(M=!1,C(L))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,(function(S){var T=S;T.length=function(D){var U=D.length;if(!U)return 0;for(var C=0;--U%4>1&&D.charAt(U)==="=";)++C;return Math.ceil(D.length*3)/4-C};for(var A=new Array(64),P=new Array(123),O=0;O<64;)P[A[O]=O<26?O+65:O<52?O+71:O<62?O-4:O-59|43]=O++;T.encode=function(D,U,C){for(var L=null,y=[],_=0,N=0,I;U<C;){var x=D[U++];switch(N){case 0:y[_++]=A[x>>2],I=(x&3)<<4,N=1;break;case 1:y[_++]=A[I|x>>4],I=(x&15)<<2,N=2;break;case 2:y[_++]=A[I|x>>6],y[_++]=A[x&63],N=0;break}_>8191&&((L||(L=[])).push(String.fromCharCode.apply(String,y)),_=0)}return N&&(y[_++]=A[I],y[_++]=61,N===1&&(y[_++]=61)),L?(_&&L.push(String.fromCharCode.apply(String,y.slice(0,_))),L.join("")):String.fromCharCode.apply(String,y.slice(0,_))};var R="invalid encoding";T.decode=function(D,U,C){for(var L=C,y=0,_,N=0;N<D.length;){var I=D.charCodeAt(N++);if(I===61&&y>1)break;if((I=P[I])===void 0)throw Error(R);switch(y){case 0:_=I,y=1;break;case 1:U[C++]=_<<2|(I&48)>>4,_=I,y=2;break;case 2:U[C++]=(_&15)<<4|(I&60)>>2,_=I,y=3;break;case 3:U[C++]=(_&3)<<6|I,y=0;break}}if(y===1)throw Error(R);return C-L},T.test=function(D){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(D)}})(base64)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=S;function S(){this._listeners={}}return S.prototype.on=function(A,P,O){return(this._listeners[A]||(this._listeners[A]=[])).push({fn:P,ctx:O||this}),this},S.prototype.off=function(A,P){if(A===void 0)this._listeners={};else if(P===void 0)this._listeners[A]=[];else for(var O=this._listeners[A],R=0;R<O.length;)O[R].fn===P?O.splice(R,1):++R;return this},S.prototype.emit=function(A){var P=this._listeners[A];if(P){for(var O=[],R=1;R<arguments.length;)O.push(arguments[R++]);for(R=0;R<P.length;)P[R].fn.apply(P[R++].ctx,O)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=S(S);function S(R){return typeof Float32Array<"u"?(function(){var M=new Float32Array([-0]),D=new Uint8Array(M.buffer),U=D[3]===128;function C(N,I,x){M[0]=N,I[x]=D[0],I[x+1]=D[1],I[x+2]=D[2],I[x+3]=D[3]}function L(N,I,x){M[0]=N,I[x]=D[3],I[x+1]=D[2],I[x+2]=D[1],I[x+3]=D[0]}R.writeFloatLE=U?C:L,R.writeFloatBE=U?L:C;function y(N,I){return D[0]=N[I],D[1]=N[I+1],D[2]=N[I+2],D[3]=N[I+3],M[0]}function _(N,I){return D[3]=N[I],D[2]=N[I+1],D[1]=N[I+2],D[0]=N[I+3],M[0]}R.readFloatLE=U?y:_,R.readFloatBE=U?_:y})():(function(){function M(U,C,L,y){var _=C<0?1:0;if(_&&(C=-C),C===0)U(1/C>0?0:2147483648,L,y);else if(isNaN(C))U(2143289344,L,y);else if(C>34028234663852886e22)U((_<<31|2139095040)>>>0,L,y);else if(C<11754943508222875e-54)U((_<<31|Math.round(C/1401298464324817e-60))>>>0,L,y);else{var N=Math.floor(Math.log(C)/Math.LN2),I=Math.round(C*Math.pow(2,-N)*8388608)&8388607;U((_<<31|N+127<<23|I)>>>0,L,y)}}R.writeFloatLE=M.bind(null,T),R.writeFloatBE=M.bind(null,A);function D(U,C,L){var y=U(C,L),_=(y>>31)*2+1,N=y>>>23&255,I=y&8388607;return N===255?I?NaN:_*(1/0):N===0?_*1401298464324817e-60*I:_*Math.pow(2,N-150)*(I+8388608)}R.readFloatLE=D.bind(null,P),R.readFloatBE=D.bind(null,O)})(),typeof Float64Array<"u"?(function(){var M=new Float64Array([-0]),D=new Uint8Array(M.buffer),U=D[7]===128;function C(N,I,x){M[0]=N,I[x]=D[0],I[x+1]=D[1],I[x+2]=D[2],I[x+3]=D[3],I[x+4]=D[4],I[x+5]=D[5],I[x+6]=D[6],I[x+7]=D[7]}function L(N,I,x){M[0]=N,I[x]=D[7],I[x+1]=D[6],I[x+2]=D[5],I[x+3]=D[4],I[x+4]=D[3],I[x+5]=D[2],I[x+6]=D[1],I[x+7]=D[0]}R.writeDoubleLE=U?C:L,R.writeDoubleBE=U?L:C;function y(N,I){return D[0]=N[I],D[1]=N[I+1],D[2]=N[I+2],D[3]=N[I+3],D[4]=N[I+4],D[5]=N[I+5],D[6]=N[I+6],D[7]=N[I+7],M[0]}function _(N,I){return D[7]=N[I],D[6]=N[I+1],D[5]=N[I+2],D[4]=N[I+3],D[3]=N[I+4],D[2]=N[I+5],D[1]=N[I+6],D[0]=N[I+7],M[0]}R.readDoubleLE=U?y:_,R.readDoubleBE=U?_:y})():(function(){function M(U,C,L,y,_,N){var I=y<0?1:0;if(I&&(y=-y),y===0)U(0,_,N+C),U(1/y>0?0:2147483648,_,N+L);else if(isNaN(y))U(0,_,N+C),U(2146959360,_,N+L);else if(y>17976931348623157e292)U(0,_,N+C),U((I<<31|2146435072)>>>0,_,N+L);else{var x;if(y<22250738585072014e-324)x=y/5e-324,U(x>>>0,_,N+C),U((I<<31|x/4294967296)>>>0,_,N+L);else{var V=Math.floor(Math.log(y)/Math.LN2);V===1024&&(V=1023),x=y*Math.pow(2,-V),U(x*4503599627370496>>>0,_,N+C),U((I<<31|V+1023<<20|x*1048576&1048575)>>>0,_,N+L)}}}R.writeDoubleLE=M.bind(null,T,0,4),R.writeDoubleBE=M.bind(null,A,4,0);function D(U,C,L,y,_){var N=U(y,_+C),I=U(y,_+L),x=(I>>31)*2+1,V=I>>>20&2047,k=4294967296*(I&1048575)+N;return V===2047?k?NaN:x*(1/0):V===0?x*5e-324*k:x*Math.pow(2,V-1075)*(k+4503599627370496)}R.readDoubleLE=D.bind(null,P,0,4),R.readDoubleBE=D.bind(null,O,4,0)})(),R}function T(R,M,D){M[D]=R&255,M[D+1]=R>>>8&255,M[D+2]=R>>>16&255,M[D+3]=R>>>24}function A(R,M,D){M[D]=R>>>24,M[D+1]=R>>>16&255,M[D+2]=R>>>8&255,M[D+3]=R&255}function P(R,M){return(R[M]|R[M+1]<<8|R[M+2]<<16|R[M+3]<<24)>>>0}function O(R,M){return(R[M]<<24|R[M+1]<<16|R[M+2]<<8|R[M+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(S){}return null}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,(function(S){var T=S;T.length=function(P){for(var O=0,R=0,M=0;M<P.length;++M)R=P.charCodeAt(M),R<128?O+=1:R<2048?O+=2:(R&64512)===55296&&(P.charCodeAt(M+1)&64512)===56320?(++M,O+=4):O+=3;return O},T.read=function(P,O,R){var M=R-O;if(M<1)return"";for(var D=null,U=[],C=0,L;O<R;)L=P[O++],L<128?U[C++]=L:L>191&&L<224?U[C++]=(L&31)<<6|P[O++]&63:L>239&&L<365?(L=((L&7)<<18|(P[O++]&63)<<12|(P[O++]&63)<<6|P[O++]&63)-65536,U[C++]=55296+(L>>10),U[C++]=56320+(L&1023)):U[C++]=(L&15)<<12|(P[O++]&63)<<6|P[O++]&63,C>8191&&((D||(D=[])).push(String.fromCharCode.apply(String,U)),C=0);return D?(C&&D.push(String.fromCharCode.apply(String,U.slice(0,C))),D.join("")):String.fromCharCode.apply(String,U.slice(0,C))},T.write=function(P,O,R){for(var M=R,D,U,C=0;C<P.length;++C)D=P.charCodeAt(C),D<128?O[R++]=D:D<2048?(O[R++]=D>>6|192,O[R++]=D&63|128):(D&64512)===55296&&((U=P.charCodeAt(C+1))&64512)===56320?(D=65536+((D&1023)<<10)+(U&1023),++C,O[R++]=D>>18|240,O[R++]=D>>12&63|128,O[R++]=D>>6&63|128,O[R++]=D&63|128):(O[R++]=D>>12|224,O[R++]=D>>6&63|128,O[R++]=D&63|128);return R-M}})(utf8)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=S;function S(T,A,P){var O=P||8192,R=O>>>1,M=null,D=O;return function(C){if(C<1||C>R)return T(C);D+C>O&&(M=T(O),D=0);var L=A.call(M,D,D+=C);return D&7&&(D=(D|7)+1),L}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=T;var S=requireMinimal$1();function T(R,M){this.lo=R>>>0,this.hi=M>>>0}var A=T.zero=new T(0,0);A.toNumber=function(){return 0},A.zzEncode=A.zzDecode=function(){return this},A.length=function(){return 1};var P=T.zeroHash="\0\0\0\0\0\0\0\0";T.fromNumber=function(M){if(M===0)return A;var D=M<0;D&&(M=-M);var U=M>>>0,C=(M-U)/4294967296>>>0;return D&&(C=~C>>>0,U=~U>>>0,++U>4294967295&&(U=0,++C>4294967295&&(C=0))),new T(U,C)},T.from=function(M){if(typeof M=="number")return T.fromNumber(M);if(S.isString(M))if(S.Long)M=S.Long.fromString(M);else return T.fromNumber(parseInt(M,10));return M.low||M.high?new T(M.low>>>0,M.high>>>0):A},T.prototype.toNumber=function(M){if(!M&&this.hi>>>31){var D=~this.lo+1>>>0,U=~this.hi>>>0;return D||(U=U+1>>>0),-(D+U*4294967296)}return this.lo+this.hi*4294967296},T.prototype.toLong=function(M){return S.Long?new S.Long(this.lo|0,this.hi|0,!!M):{low:this.lo|0,high:this.hi|0,unsigned:!!M}};var O=String.prototype.charCodeAt;return T.fromHash=function(M){return M===P?A:new T((O.call(M,0)|O.call(M,1)<<8|O.call(M,2)<<16|O.call(M,3)<<24)>>>0,(O.call(M,4)|O.call(M,5)<<8|O.call(M,6)<<16|O.call(M,7)<<24)>>>0)},T.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},T.prototype.zzEncode=function(){var M=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^M)>>>0,this.lo=(this.lo<<1^M)>>>0,this},T.prototype.zzDecode=function(){var M=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^M)>>>0,this.hi=(this.hi>>>1^M)>>>0,this},T.prototype.length=function(){var M=this.lo,D=(this.lo>>>28|this.hi<<4)>>>0,U=this.hi>>>24;return U===0?D===0?M<16384?M<128?1:2:M<2097152?3:4:D<16384?D<128?5:6:D<2097152?7:8:U<128?9:10},longbits}var hasRequiredMinimal$1;function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,(function(S){var T=S;T.asPromise=requireAspromise(),T.base64=requireBase64(),T.EventEmitter=requireEventemitter(),T.float=requireFloat(),T.inquire=requireInquire(),T.utf8=requireUtf8(),T.pool=requirePool(),T.LongBits=requireLongbits(),T.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),T.global=T.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||minimal$1,T.emptyArray=Object.freeze?Object.freeze([]):[],T.emptyObject=Object.freeze?Object.freeze({}):{},T.isInteger=Number.isInteger||function(R){return typeof R=="number"&&isFinite(R)&&Math.floor(R)===R},T.isString=function(R){return typeof R=="string"||R instanceof String},T.isObject=function(R){return R&&typeof R=="object"},T.isset=T.isSet=function(R,M){var D=R[M];return D!=null&&R.hasOwnProperty(M)?typeof D!="object"||(Array.isArray(D)?D.length:Object.keys(D).length)>0:!1},T.Buffer=(function(){try{var O=T.inquire("buffer").Buffer;return O.prototype.utf8Write?O:null}catch{return null}})(),T._Buffer_from=null,T._Buffer_allocUnsafe=null,T.newBuffer=function(R){return typeof R=="number"?T.Buffer?T._Buffer_allocUnsafe(R):new T.Array(R):T.Buffer?T._Buffer_from(R):typeof Uint8Array>"u"?R:new Uint8Array(R)},T.Array=typeof Uint8Array<"u"?Uint8Array:Array,T.Long=T.global.dcodeIO&&T.global.dcodeIO.Long||T.global.Long||T.inquire("long"),T.key2Re=/^true|false|0|1$/,T.key32Re=/^-?(?:0|[1-9][0-9]*)$/,T.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,T.longToHash=function(R){return R?T.LongBits.from(R).toHash():T.LongBits.zeroHash},T.longFromHash=function(R,M){var D=T.LongBits.fromHash(R);return T.Long?T.Long.fromBits(D.lo,D.hi,M):D.toNumber(!!M)};function A(O,R,M){for(var D=Object.keys(R),U=0;U<D.length;++U)(O[D[U]]===void 0||!M)&&(O[D[U]]=R[D[U]]);return O}T.merge=A,T.lcFirst=function(R){return R.charAt(0).toLowerCase()+R.substring(1)};function P(O){function R(M,D){if(!(this instanceof R))return new R(M,D);Object.defineProperty(this,"message",{get:function(){return M}}),Error.captureStackTrace?Error.captureStackTrace(this,R):Object.defineProperty(this,"stack",{value:new Error().stack||""}),D&&A(this,D)}return R.prototype=Object.create(Error.prototype,{constructor:{value:R,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return O},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),R}T.newError=P,T.ProtocolError=P("ProtocolError"),T.oneOfGetter=function(R){for(var M={},D=0;D<R.length;++D)M[R[D]]=1;return function(){for(var U=Object.keys(this),C=U.length-1;C>-1;--C)if(M[U[C]]===1&&this[U[C]]!==void 0&&this[U[C]]!==null)return U[C]}},T.oneOfSetter=function(R){return function(M){for(var D=0;D<R.length;++D)R[D]!==M&&delete this[R[D]]}},T.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},T._configure=function(){var O=T.Buffer;if(!O){T._Buffer_from=T._Buffer_allocUnsafe=null;return}T._Buffer_from=O.from!==Uint8Array.from&&O.from||function(M,D){return new O(M,D)},T._Buffer_allocUnsafe=O.allocUnsafe||function(M){return new O(M)}}})(minimal$1)),minimal$1}var writer,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=U;var S=requireMinimal$1(),T,A=S.LongBits,P=S.base64,O=S.utf8;function R(V,k,F){this.fn=V,this.len=k,this.next=void 0,this.val=F}function M(){}function D(V){this.head=V.head,this.tail=V.tail,this.len=V.len,this.next=V.states}function U(){this.len=0,this.head=new R(M,0,0),this.tail=this.head,this.states=null}var C=function(){return S.Buffer?function(){return(U.create=function(){return new T})()}:function(){return new U}};U.create=C(),U.alloc=function(k){return new S.Array(k)},S.Array!==Array&&(U.alloc=S.pool(U.alloc,S.Array.prototype.subarray)),U.prototype._push=function(k,F,W){return this.tail=this.tail.next=new R(k,F,W),this.len+=F,this};function L(V,k,F){k[F]=V&255}function y(V,k,F){for(;V>127;)k[F++]=V&127|128,V>>>=7;k[F]=V}function _(V,k){this.len=V,this.next=void 0,this.val=k}_.prototype=Object.create(R.prototype),_.prototype.fn=y,U.prototype.uint32=function(k){return this.len+=(this.tail=this.tail.next=new _((k=k>>>0)<128?1:k<16384?2:k<2097152?3:k<268435456?4:5,k)).len,this},U.prototype.int32=function(k){return k<0?this._push(N,10,A.fromNumber(k)):this.uint32(k)},U.prototype.sint32=function(k){return this.uint32((k<<1^k>>31)>>>0)};function N(V,k,F){for(;V.hi;)k[F++]=V.lo&127|128,V.lo=(V.lo>>>7|V.hi<<25)>>>0,V.hi>>>=7;for(;V.lo>127;)k[F++]=V.lo&127|128,V.lo=V.lo>>>7;k[F++]=V.lo}U.prototype.uint64=function(k){var F=A.from(k);return this._push(N,F.length(),F)},U.prototype.int64=U.prototype.uint64,U.prototype.sint64=function(k){var F=A.from(k).zzEncode();return this._push(N,F.length(),F)},U.prototype.bool=function(k){return this._push(L,1,k?1:0)};function I(V,k,F){k[F]=V&255,k[F+1]=V>>>8&255,k[F+2]=V>>>16&255,k[F+3]=V>>>24}U.prototype.fixed32=function(k){return this._push(I,4,k>>>0)},U.prototype.sfixed32=U.prototype.fixed32,U.prototype.fixed64=function(k){var F=A.from(k);return this._push(I,4,F.lo)._push(I,4,F.hi)},U.prototype.sfixed64=U.prototype.fixed64,U.prototype.float=function(k){return this._push(S.float.writeFloatLE,4,k)},U.prototype.double=function(k){return this._push(S.float.writeDoubleLE,8,k)};var x=S.Array.prototype.set?function(k,F,W){F.set(k,W)}:function(k,F,W){for(var ee=0;ee<k.length;++ee)F[W+ee]=k[ee]};return U.prototype.bytes=function(k){var F=k.length>>>0;if(!F)return this._push(L,1,0);if(S.isString(k)){var W=U.alloc(F=P.length(k));P.decode(k,W,0),k=W}return this.uint32(F)._push(x,F,k)},U.prototype.string=function(k){var F=O.length(k);return F?this.uint32(F)._push(O.write,F,k):this._push(L,1,0)},U.prototype.fork=function(){return this.states=new D(this),this.head=this.tail=new R(M,0,0),this.len=0,this},U.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new R(M,0,0),this.len=0),this},U.prototype.ldelim=function(){var k=this.head,F=this.tail,W=this.len;return this.reset().uint32(W),W&&(this.tail.next=k.next,this.tail=F,this.len+=W),this},U.prototype.finish=function(){for(var k=this.head.next,F=this.constructor.alloc(this.len),W=0;k;)k.fn(k.val,F,W),W+=k.len,k=k.next;return F},U._configure=function(V){T=V,U.create=C(),T._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=A;var S=requireWriter();(A.prototype=Object.create(S.prototype)).constructor=A;var T=requireMinimal$1();function A(){S.call(this)}A._configure=function(){A.alloc=T._Buffer_allocUnsafe,A.writeBytesBuffer=T.Buffer&&T.Buffer.prototype instanceof Uint8Array&&T.Buffer.prototype.set.name==="set"?function(R,M,D){M.set(R,D)}:function(R,M,D){if(R.copy)R.copy(M,D,0,R.length);else for(var U=0;U<R.length;)M[D++]=R[U++]}},A.prototype.bytes=function(R){T.isString(R)&&(R=T._Buffer_from(R,"base64"));var M=R.length>>>0;return this.uint32(M),M&&this._push(A.writeBytesBuffer,M,R),this};function P(O,R,M){O.length<40?T.utf8.write(O,R,M):R.utf8Write?R.utf8Write(O,M):R.write(O,M)}return A.prototype.string=function(R){var M=T.Buffer.byteLength(R);return this.uint32(M),M&&this._push(P,M,R),this},A._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=R;var S=requireMinimal$1(),T,A=S.LongBits,P=S.utf8;function O(y,_){return RangeError("index out of range: "+y.pos+" + "+(_||1)+" > "+y.len)}function R(y){this.buf=y,this.pos=0,this.len=y.length}var M=typeof Uint8Array<"u"?function(_){if(_ instanceof Uint8Array||Array.isArray(_))return new R(_);throw Error("illegal buffer")}:function(_){if(Array.isArray(_))return new R(_);throw Error("illegal buffer")},D=function(){return S.Buffer?function(N){return(R.create=function(x){return S.Buffer.isBuffer(x)?new T(x):M(x)})(N)}:M};R.create=D(),R.prototype._slice=S.Array.prototype.subarray||S.Array.prototype.slice,R.prototype.uint32=(function(){var _=4294967295;return function(){if(_=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(_=(_|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(_=(_|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(_=(_|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(_=(_|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return _;if((this.pos+=5)>this.len)throw this.pos=this.len,O(this,10);return _}})(),R.prototype.int32=function(){return this.uint32()|0},R.prototype.sint32=function(){var _=this.uint32();return _>>>1^-(_&1)|0};function U(){var y=new A(0,0),_=0;if(this.len-this.pos>4){for(;_<4;++_)if(y.lo=(y.lo|(this.buf[this.pos]&127)<<_*7)>>>0,this.buf[this.pos++]<128)return y;if(y.lo=(y.lo|(this.buf[this.pos]&127)<<28)>>>0,y.hi=(y.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return y;_=0}else{for(;_<3;++_){if(this.pos>=this.len)throw O(this);if(y.lo=(y.lo|(this.buf[this.pos]&127)<<_*7)>>>0,this.buf[this.pos++]<128)return y}return y.lo=(y.lo|(this.buf[this.pos++]&127)<<_*7)>>>0,y}if(this.len-this.pos>4){for(;_<5;++_)if(y.hi=(y.hi|(this.buf[this.pos]&127)<<_*7+3)>>>0,this.buf[this.pos++]<128)return y}else for(;_<5;++_){if(this.pos>=this.len)throw O(this);if(y.hi=(y.hi|(this.buf[this.pos]&127)<<_*7+3)>>>0,this.buf[this.pos++]<128)return y}throw Error("invalid varint encoding")}R.prototype.bool=function(){return this.uint32()!==0};function C(y,_){return(y[_-4]|y[_-3]<<8|y[_-2]<<16|y[_-1]<<24)>>>0}R.prototype.fixed32=function(){if(this.pos+4>this.len)throw O(this,4);return C(this.buf,this.pos+=4)},R.prototype.sfixed32=function(){if(this.pos+4>this.len)throw O(this,4);return C(this.buf,this.pos+=4)|0};function L(){if(this.pos+8>this.len)throw O(this,8);return new A(C(this.buf,this.pos+=4),C(this.buf,this.pos+=4))}return R.prototype.float=function(){if(this.pos+4>this.len)throw O(this,4);var _=S.float.readFloatLE(this.buf,this.pos);return this.pos+=4,_},R.prototype.double=function(){if(this.pos+8>this.len)throw O(this,4);var _=S.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,_},R.prototype.bytes=function(){var _=this.uint32(),N=this.pos,I=this.pos+_;if(I>this.len)throw O(this,_);if(this.pos+=_,Array.isArray(this.buf))return this.buf.slice(N,I);if(N===I){var x=S.Buffer;return x?x.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,N,I)},R.prototype.string=function(){var _=this.bytes();return P.read(_,0,_.length)},R.prototype.skip=function(_){if(typeof _=="number"){if(this.pos+_>this.len)throw O(this,_);this.pos+=_}else do if(this.pos>=this.len)throw O(this);while(this.buf[this.pos++]&128);return this},R.prototype.skipType=function(y){switch(y){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(y=this.uint32()&7)!==4;)this.skipType(y);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+y+" at offset "+this.pos)}return this},R._configure=function(y){T=y,R.create=D(),T._configure();var _=S.Long?"toLong":"toNumber";S.merge(R.prototype,{int64:function(){return U.call(this)[_](!1)},uint64:function(){return U.call(this)[_](!0)},sint64:function(){return U.call(this).zzDecode()[_](!1)},fixed64:function(){return L.call(this)[_](!0)},sfixed64:function(){return L.call(this)[_](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=A;var S=requireReader();(A.prototype=Object.create(S.prototype)).constructor=A;var T=requireMinimal$1();function A(P){S.call(this,P)}return A._configure=function(){T.Buffer&&(A.prototype._slice=T.Buffer.prototype.slice)},A.prototype.string=function(){var O=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+O,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+O,this.len))},A._configure(),reader_buffer}var rpc={},service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=T;var S=requireMinimal$1();(T.prototype=Object.create(S.EventEmitter.prototype)).constructor=T;function T(A,P,O){if(typeof A!="function")throw TypeError("rpcImpl must be a function");S.EventEmitter.call(this),this.rpcImpl=A,this.requestDelimited=!!P,this.responseDelimited=!!O}return T.prototype.rpcCall=function A(P,O,R,M,D){if(!M)throw TypeError("request must be specified");var U=this;if(!D)return S.asPromise(A,U,P,O,R,M);if(!U.rpcImpl){setTimeout(function(){D(Error("already ended"))},0);return}try{return U.rpcImpl(P,O[U.requestDelimited?"encodeDelimited":"encode"](M).finish(),function(L,y){if(L)return U.emit("error",L,P),D(L);if(y===null){U.end(!0);return}if(!(y instanceof R))try{y=R[U.responseDelimited?"decodeDelimited":"decode"](y)}catch(_){return U.emit("error",_,P),D(_)}return U.emit("data",y,P),D(null,y)})}catch(C){U.emit("error",C,P),setTimeout(function(){D(C)},0);return}},T.prototype.end=function(P){return this.rpcImpl&&(P||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,(function(S){var T=S;T.Service=requireService()})(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,(function(S){var T=S;T.build="minimal",T.Writer=requireWriter(),T.BufferWriter=requireWriter_buffer(),T.Reader=requireReader(),T.BufferReader=requireReader_buffer(),T.util=requireMinimal$1(),T.rpc=requireRpc(),T.roots=requireRoots(),T.configure=A;function A(){T.util._configure(),T.Writer._configure(T.BufferWriter),T.Reader._configure(T.BufferReader)}A()})(indexMinimal)),indexMinimal}var minimal,hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal=requireIndexMinimal()),minimal}var root,hasRequiredRoot;function requireRoot(){if(hasRequiredRoot)return root;hasRequiredRoot=1;var S=requireMinimal(),T=S.Reader,A=S.Writer,P=S.util,O=S.roots.default||(S.roots.default={});return O.opentelemetry=(function(){var R={};return R.proto=(function(){var M={};return M.common=(function(){var D={};return D.v1=(function(){var U={};return U.AnyValue=(function(){function C(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.stringValue=null,C.prototype.boolValue=null,C.prototype.intValue=null,C.prototype.doubleValue=null,C.prototype.arrayValue=null,C.prototype.kvlistValue=null,C.prototype.bytesValue=null;var L;return Object.defineProperty(C.prototype,"value",{get:P.oneOfGetter(L=["stringValue","boolValue","intValue","doubleValue","arrayValue","kvlistValue","bytesValue"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){return N||(N=A.create()),_.stringValue!=null&&Object.hasOwnProperty.call(_,"stringValue")&&N.uint32(10).string(_.stringValue),_.boolValue!=null&&Object.hasOwnProperty.call(_,"boolValue")&&N.uint32(16).bool(_.boolValue),_.intValue!=null&&Object.hasOwnProperty.call(_,"intValue")&&N.uint32(24).int64(_.intValue),_.doubleValue!=null&&Object.hasOwnProperty.call(_,"doubleValue")&&N.uint32(33).double(_.doubleValue),_.arrayValue!=null&&Object.hasOwnProperty.call(_,"arrayValue")&&O.opentelemetry.proto.common.v1.ArrayValue.encode(_.arrayValue,N.uint32(42).fork()).ldelim(),_.kvlistValue!=null&&Object.hasOwnProperty.call(_,"kvlistValue")&&O.opentelemetry.proto.common.v1.KeyValueList.encode(_.kvlistValue,N.uint32(50).fork()).ldelim(),_.bytesValue!=null&&Object.hasOwnProperty.call(_,"bytesValue")&&N.uint32(58).bytes(_.bytesValue),N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.common.v1.AnyValue;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.stringValue=_.string();break}case 2:{x.boolValue=_.bool();break}case 3:{x.intValue=_.int64();break}case 4:{x.doubleValue=_.double();break}case 5:{x.arrayValue=O.opentelemetry.proto.common.v1.ArrayValue.decode(_,_.uint32());break}case 6:{x.kvlistValue=O.opentelemetry.proto.common.v1.KeyValueList.decode(_,_.uint32());break}case 7:{x.bytesValue=_.bytes();break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";var N={};if(_.stringValue!=null&&_.hasOwnProperty("stringValue")&&(N.value=1,!P.isString(_.stringValue)))return"stringValue: string expected";if(_.boolValue!=null&&_.hasOwnProperty("boolValue")){if(N.value===1)return"value: multiple values";if(N.value=1,typeof _.boolValue!="boolean")return"boolValue: boolean expected"}if(_.intValue!=null&&_.hasOwnProperty("intValue")){if(N.value===1)return"value: multiple values";if(N.value=1,!P.isInteger(_.intValue)&&!(_.intValue&&P.isInteger(_.intValue.low)&&P.isInteger(_.intValue.high)))return"intValue: integer|Long expected"}if(_.doubleValue!=null&&_.hasOwnProperty("doubleValue")){if(N.value===1)return"value: multiple values";if(N.value=1,typeof _.doubleValue!="number")return"doubleValue: number expected"}if(_.arrayValue!=null&&_.hasOwnProperty("arrayValue")){if(N.value===1)return"value: multiple values";N.value=1;{var I=O.opentelemetry.proto.common.v1.ArrayValue.verify(_.arrayValue);if(I)return"arrayValue."+I}}if(_.kvlistValue!=null&&_.hasOwnProperty("kvlistValue")){if(N.value===1)return"value: multiple values";N.value=1;{var I=O.opentelemetry.proto.common.v1.KeyValueList.verify(_.kvlistValue);if(I)return"kvlistValue."+I}}if(_.bytesValue!=null&&_.hasOwnProperty("bytesValue")){if(N.value===1)return"value: multiple values";if(N.value=1,!(_.bytesValue&&typeof _.bytesValue.length=="number"||P.isString(_.bytesValue)))return"bytesValue: buffer expected"}return null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.common.v1.AnyValue)return _;var N=new O.opentelemetry.proto.common.v1.AnyValue;if(_.stringValue!=null&&(N.stringValue=String(_.stringValue)),_.boolValue!=null&&(N.boolValue=!!_.boolValue),_.intValue!=null&&(P.Long?(N.intValue=P.Long.fromValue(_.intValue)).unsigned=!1:typeof _.intValue=="string"?N.intValue=parseInt(_.intValue,10):typeof _.intValue=="number"?N.intValue=_.intValue:typeof _.intValue=="object"&&(N.intValue=new P.LongBits(_.intValue.low>>>0,_.intValue.high>>>0).toNumber())),_.doubleValue!=null&&(N.doubleValue=Number(_.doubleValue)),_.arrayValue!=null){if(typeof _.arrayValue!="object")throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected");N.arrayValue=O.opentelemetry.proto.common.v1.ArrayValue.fromObject(_.arrayValue)}if(_.kvlistValue!=null){if(typeof _.kvlistValue!="object")throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected");N.kvlistValue=O.opentelemetry.proto.common.v1.KeyValueList.fromObject(_.kvlistValue)}return _.bytesValue!=null&&(typeof _.bytesValue=="string"?P.base64.decode(_.bytesValue,N.bytesValue=P.newBuffer(P.base64.length(_.bytesValue)),0):_.bytesValue.length>=0&&(N.bytesValue=_.bytesValue)),N},C.toObject=function(_,N){N||(N={});var I={};return _.stringValue!=null&&_.hasOwnProperty("stringValue")&&(I.stringValue=_.stringValue,N.oneofs&&(I.value="stringValue")),_.boolValue!=null&&_.hasOwnProperty("boolValue")&&(I.boolValue=_.boolValue,N.oneofs&&(I.value="boolValue")),_.intValue!=null&&_.hasOwnProperty("intValue")&&(typeof _.intValue=="number"?I.intValue=N.longs===String?String(_.intValue):_.intValue:I.intValue=N.longs===String?P.Long.prototype.toString.call(_.intValue):N.longs===Number?new P.LongBits(_.intValue.low>>>0,_.intValue.high>>>0).toNumber():_.intValue,N.oneofs&&(I.value="intValue")),_.doubleValue!=null&&_.hasOwnProperty("doubleValue")&&(I.doubleValue=N.json&&!isFinite(_.doubleValue)?String(_.doubleValue):_.doubleValue,N.oneofs&&(I.value="doubleValue")),_.arrayValue!=null&&_.hasOwnProperty("arrayValue")&&(I.arrayValue=O.opentelemetry.proto.common.v1.ArrayValue.toObject(_.arrayValue,N),N.oneofs&&(I.value="arrayValue")),_.kvlistValue!=null&&_.hasOwnProperty("kvlistValue")&&(I.kvlistValue=O.opentelemetry.proto.common.v1.KeyValueList.toObject(_.kvlistValue,N),N.oneofs&&(I.value="kvlistValue")),_.bytesValue!=null&&_.hasOwnProperty("bytesValue")&&(I.bytesValue=N.bytes===String?P.base64.encode(_.bytesValue,0,_.bytesValue.length):N.bytes===Array?Array.prototype.slice.call(_.bytesValue):_.bytesValue,N.oneofs&&(I.value="bytesValue")),I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.common.v1.AnyValue"},C})(),U.ArrayValue=(function(){function C(L){if(this.values=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.values=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.values!=null&&y.values.length)for(var N=0;N<y.values.length;++N)O.opentelemetry.proto.common.v1.AnyValue.encode(y.values[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.common.v1.ArrayValue;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.values&&I.values.length||(I.values=[]),I.values.push(O.opentelemetry.proto.common.v1.AnyValue.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.values!=null&&y.hasOwnProperty("values")){if(!Array.isArray(y.values))return"values: array expected";for(var _=0;_<y.values.length;++_){var N=O.opentelemetry.proto.common.v1.AnyValue.verify(y.values[_]);if(N)return"values."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.common.v1.ArrayValue)return y;var _=new O.opentelemetry.proto.common.v1.ArrayValue;if(y.values){if(!Array.isArray(y.values))throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected");_.values=[];for(var N=0;N<y.values.length;++N){if(typeof y.values[N]!="object")throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected");_.values[N]=O.opentelemetry.proto.common.v1.AnyValue.fromObject(y.values[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.values=[]),y.values&&y.values.length){N.values=[];for(var I=0;I<y.values.length;++I)N.values[I]=O.opentelemetry.proto.common.v1.AnyValue.toObject(y.values[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.common.v1.ArrayValue"},C})(),U.KeyValueList=(function(){function C(L){if(this.values=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.values=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.values!=null&&y.values.length)for(var N=0;N<y.values.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.values[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.common.v1.KeyValueList;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.values&&I.values.length||(I.values=[]),I.values.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.values!=null&&y.hasOwnProperty("values")){if(!Array.isArray(y.values))return"values: array expected";for(var _=0;_<y.values.length;++_){var N=O.opentelemetry.proto.common.v1.KeyValue.verify(y.values[_]);if(N)return"values."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.common.v1.KeyValueList)return y;var _=new O.opentelemetry.proto.common.v1.KeyValueList;if(y.values){if(!Array.isArray(y.values))throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected");_.values=[];for(var N=0;N<y.values.length;++N){if(typeof y.values[N]!="object")throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected");_.values[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.values[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.values=[]),y.values&&y.values.length){N.values=[];for(var I=0;I<y.values.length;++I)N.values[I]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.values[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.common.v1.KeyValueList"},C})(),U.KeyValue=(function(){function C(L){if(L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.key=null,C.prototype.value=null,C.create=function(y){return new C(y)},C.encode=function(y,_){return _||(_=A.create()),y.key!=null&&Object.hasOwnProperty.call(y,"key")&&_.uint32(10).string(y.key),y.value!=null&&Object.hasOwnProperty.call(y,"value")&&O.opentelemetry.proto.common.v1.AnyValue.encode(y.value,_.uint32(18).fork()).ldelim(),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.common.v1.KeyValue;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.key=y.string();break}case 2:{I.value=O.opentelemetry.proto.common.v1.AnyValue.decode(y,y.uint32());break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.key!=null&&y.hasOwnProperty("key")&&!P.isString(y.key))return"key: string expected";if(y.value!=null&&y.hasOwnProperty("value")){var _=O.opentelemetry.proto.common.v1.AnyValue.verify(y.value);if(_)return"value."+_}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.common.v1.KeyValue)return y;var _=new O.opentelemetry.proto.common.v1.KeyValue;if(y.key!=null&&(_.key=String(y.key)),y.value!=null){if(typeof y.value!="object")throw TypeError(".opentelemetry.proto.common.v1.KeyValue.value: object expected");_.value=O.opentelemetry.proto.common.v1.AnyValue.fromObject(y.value)}return _},C.toObject=function(y,_){_||(_={});var N={};return _.defaults&&(N.key="",N.value=null),y.key!=null&&y.hasOwnProperty("key")&&(N.key=y.key),y.value!=null&&y.hasOwnProperty("value")&&(N.value=O.opentelemetry.proto.common.v1.AnyValue.toObject(y.value,_)),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.common.v1.KeyValue"},C})(),U.InstrumentationScope=(function(){function C(L){if(this.attributes=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.name=null,C.prototype.version=null,C.prototype.attributes=P.emptyArray,C.prototype.droppedAttributesCount=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.name!=null&&Object.hasOwnProperty.call(y,"name")&&_.uint32(10).string(y.name),y.version!=null&&Object.hasOwnProperty.call(y,"version")&&_.uint32(18).string(y.version),y.attributes!=null&&y.attributes.length)for(var N=0;N<y.attributes.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.attributes[N],_.uint32(26).fork()).ldelim();return y.droppedAttributesCount!=null&&Object.hasOwnProperty.call(y,"droppedAttributesCount")&&_.uint32(32).uint32(y.droppedAttributesCount),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.common.v1.InstrumentationScope;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.name=y.string();break}case 2:{I.version=y.string();break}case 3:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}case 4:{I.droppedAttributesCount=y.uint32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.name!=null&&y.hasOwnProperty("name")&&!P.isString(y.name))return"name: string expected";if(y.version!=null&&y.hasOwnProperty("version")&&!P.isString(y.version))return"version: string expected";if(y.attributes!=null&&y.hasOwnProperty("attributes")){if(!Array.isArray(y.attributes))return"attributes: array expected";for(var _=0;_<y.attributes.length;++_){var N=O.opentelemetry.proto.common.v1.KeyValue.verify(y.attributes[_]);if(N)return"attributes."+N}}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(y.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.common.v1.InstrumentationScope)return y;var _=new O.opentelemetry.proto.common.v1.InstrumentationScope;if(y.name!=null&&(_.name=String(y.name)),y.version!=null&&(_.version=String(y.version)),y.attributes){if(!Array.isArray(y.attributes))throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected");_.attributes=[];for(var N=0;N<y.attributes.length;++N){if(typeof y.attributes[N]!="object")throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected");_.attributes[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.attributes[N])}}return y.droppedAttributesCount!=null&&(_.droppedAttributesCount=y.droppedAttributesCount>>>0),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.attributes=[]),_.defaults&&(N.name="",N.version="",N.droppedAttributesCount=0),y.name!=null&&y.hasOwnProperty("name")&&(N.name=y.name),y.version!=null&&y.hasOwnProperty("version")&&(N.version=y.version),y.attributes&&y.attributes.length){N.attributes=[];for(var I=0;I<y.attributes.length;++I)N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.attributes[I],_)}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&(N.droppedAttributesCount=y.droppedAttributesCount),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.common.v1.InstrumentationScope"},C})(),U})(),D})(),M.resource=(function(){var D={};return D.v1=(function(){var U={};return U.Resource=(function(){function C(L){if(this.attributes=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.attributes=P.emptyArray,C.prototype.droppedAttributesCount=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.attributes!=null&&y.attributes.length)for(var N=0;N<y.attributes.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.attributes[N],_.uint32(10).fork()).ldelim();return y.droppedAttributesCount!=null&&Object.hasOwnProperty.call(y,"droppedAttributesCount")&&_.uint32(16).uint32(y.droppedAttributesCount),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.resource.v1.Resource;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}case 2:{I.droppedAttributesCount=y.uint32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.attributes!=null&&y.hasOwnProperty("attributes")){if(!Array.isArray(y.attributes))return"attributes: array expected";for(var _=0;_<y.attributes.length;++_){var N=O.opentelemetry.proto.common.v1.KeyValue.verify(y.attributes[_]);if(N)return"attributes."+N}}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(y.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.resource.v1.Resource)return y;var _=new O.opentelemetry.proto.resource.v1.Resource;if(y.attributes){if(!Array.isArray(y.attributes))throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: array expected");_.attributes=[];for(var N=0;N<y.attributes.length;++N){if(typeof y.attributes[N]!="object")throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: object expected");_.attributes[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.attributes[N])}}return y.droppedAttributesCount!=null&&(_.droppedAttributesCount=y.droppedAttributesCount>>>0),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.attributes=[]),_.defaults&&(N.droppedAttributesCount=0),y.attributes&&y.attributes.length){N.attributes=[];for(var I=0;I<y.attributes.length;++I)N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.attributes[I],_)}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&(N.droppedAttributesCount=y.droppedAttributesCount),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.resource.v1.Resource"},C})(),U})(),D})(),M.trace=(function(){var D={};return D.v1=(function(){var U={};return U.TracesData=(function(){function C(L){if(this.resourceSpans=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resourceSpans=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resourceSpans!=null&&y.resourceSpans.length)for(var N=0;N<y.resourceSpans.length;++N)O.opentelemetry.proto.trace.v1.ResourceSpans.encode(y.resourceSpans[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.trace.v1.TracesData;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resourceSpans&&I.resourceSpans.length||(I.resourceSpans=[]),I.resourceSpans.push(O.opentelemetry.proto.trace.v1.ResourceSpans.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resourceSpans!=null&&y.hasOwnProperty("resourceSpans")){if(!Array.isArray(y.resourceSpans))return"resourceSpans: array expected";for(var _=0;_<y.resourceSpans.length;++_){var N=O.opentelemetry.proto.trace.v1.ResourceSpans.verify(y.resourceSpans[_]);if(N)return"resourceSpans."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.trace.v1.TracesData)return y;var _=new O.opentelemetry.proto.trace.v1.TracesData;if(y.resourceSpans){if(!Array.isArray(y.resourceSpans))throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected");_.resourceSpans=[];for(var N=0;N<y.resourceSpans.length;++N){if(typeof y.resourceSpans[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected");_.resourceSpans[N]=O.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(y.resourceSpans[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.resourceSpans=[]),y.resourceSpans&&y.resourceSpans.length){N.resourceSpans=[];for(var I=0;I<y.resourceSpans.length;++I)N.resourceSpans[I]=O.opentelemetry.proto.trace.v1.ResourceSpans.toObject(y.resourceSpans[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.trace.v1.TracesData"},C})(),U.ResourceSpans=(function(){function C(L){if(this.scopeSpans=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resource=null,C.prototype.scopeSpans=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resource!=null&&Object.hasOwnProperty.call(y,"resource")&&O.opentelemetry.proto.resource.v1.Resource.encode(y.resource,_.uint32(10).fork()).ldelim(),y.scopeSpans!=null&&y.scopeSpans.length)for(var N=0;N<y.scopeSpans.length;++N)O.opentelemetry.proto.trace.v1.ScopeSpans.encode(y.scopeSpans[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.trace.v1.ResourceSpans;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resource=O.opentelemetry.proto.resource.v1.Resource.decode(y,y.uint32());break}case 2:{I.scopeSpans&&I.scopeSpans.length||(I.scopeSpans=[]),I.scopeSpans.push(O.opentelemetry.proto.trace.v1.ScopeSpans.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resource!=null&&y.hasOwnProperty("resource")){var _=O.opentelemetry.proto.resource.v1.Resource.verify(y.resource);if(_)return"resource."+_}if(y.scopeSpans!=null&&y.hasOwnProperty("scopeSpans")){if(!Array.isArray(y.scopeSpans))return"scopeSpans: array expected";for(var N=0;N<y.scopeSpans.length;++N){var _=O.opentelemetry.proto.trace.v1.ScopeSpans.verify(y.scopeSpans[N]);if(_)return"scopeSpans."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.trace.v1.ResourceSpans)return y;var _=new O.opentelemetry.proto.trace.v1.ResourceSpans;if(y.resource!=null){if(typeof y.resource!="object")throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected");_.resource=O.opentelemetry.proto.resource.v1.Resource.fromObject(y.resource)}if(y.scopeSpans){if(!Array.isArray(y.scopeSpans))throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected");_.scopeSpans=[];for(var N=0;N<y.scopeSpans.length;++N){if(typeof y.scopeSpans[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected");_.scopeSpans[N]=O.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(y.scopeSpans[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.scopeSpans=[]),_.defaults&&(N.resource=null,N.schemaUrl=""),y.resource!=null&&y.hasOwnProperty("resource")&&(N.resource=O.opentelemetry.proto.resource.v1.Resource.toObject(y.resource,_)),y.scopeSpans&&y.scopeSpans.length){N.scopeSpans=[];for(var I=0;I<y.scopeSpans.length;++I)N.scopeSpans[I]=O.opentelemetry.proto.trace.v1.ScopeSpans.toObject(y.scopeSpans[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.trace.v1.ResourceSpans"},C})(),U.ScopeSpans=(function(){function C(L){if(this.spans=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.scope=null,C.prototype.spans=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.scope!=null&&Object.hasOwnProperty.call(y,"scope")&&O.opentelemetry.proto.common.v1.InstrumentationScope.encode(y.scope,_.uint32(10).fork()).ldelim(),y.spans!=null&&y.spans.length)for(var N=0;N<y.spans.length;++N)O.opentelemetry.proto.trace.v1.Span.encode(y.spans[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.trace.v1.ScopeSpans;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.decode(y,y.uint32());break}case 2:{I.spans&&I.spans.length||(I.spans=[]),I.spans.push(O.opentelemetry.proto.trace.v1.Span.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.scope!=null&&y.hasOwnProperty("scope")){var _=O.opentelemetry.proto.common.v1.InstrumentationScope.verify(y.scope);if(_)return"scope."+_}if(y.spans!=null&&y.hasOwnProperty("spans")){if(!Array.isArray(y.spans))return"spans: array expected";for(var N=0;N<y.spans.length;++N){var _=O.opentelemetry.proto.trace.v1.Span.verify(y.spans[N]);if(_)return"spans."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.trace.v1.ScopeSpans)return y;var _=new O.opentelemetry.proto.trace.v1.ScopeSpans;if(y.scope!=null){if(typeof y.scope!="object")throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected");_.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(y.scope)}if(y.spans){if(!Array.isArray(y.spans))throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected");_.spans=[];for(var N=0;N<y.spans.length;++N){if(typeof y.spans[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected");_.spans[N]=O.opentelemetry.proto.trace.v1.Span.fromObject(y.spans[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.spans=[]),_.defaults&&(N.scope=null,N.schemaUrl=""),y.scope!=null&&y.hasOwnProperty("scope")&&(N.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.toObject(y.scope,_)),y.spans&&y.spans.length){N.spans=[];for(var I=0;I<y.spans.length;++I)N.spans[I]=O.opentelemetry.proto.trace.v1.Span.toObject(y.spans[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.trace.v1.ScopeSpans"},C})(),U.Span=(function(){function C(L){if(this.attributes=[],this.events=[],this.links=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.traceId=null,C.prototype.spanId=null,C.prototype.traceState=null,C.prototype.parentSpanId=null,C.prototype.name=null,C.prototype.kind=null,C.prototype.startTimeUnixNano=null,C.prototype.endTimeUnixNano=null,C.prototype.attributes=P.emptyArray,C.prototype.droppedAttributesCount=null,C.prototype.events=P.emptyArray,C.prototype.droppedEventsCount=null,C.prototype.links=P.emptyArray,C.prototype.droppedLinksCount=null,C.prototype.status=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.traceId!=null&&Object.hasOwnProperty.call(y,"traceId")&&_.uint32(10).bytes(y.traceId),y.spanId!=null&&Object.hasOwnProperty.call(y,"spanId")&&_.uint32(18).bytes(y.spanId),y.traceState!=null&&Object.hasOwnProperty.call(y,"traceState")&&_.uint32(26).string(y.traceState),y.parentSpanId!=null&&Object.hasOwnProperty.call(y,"parentSpanId")&&_.uint32(34).bytes(y.parentSpanId),y.name!=null&&Object.hasOwnProperty.call(y,"name")&&_.uint32(42).string(y.name),y.kind!=null&&Object.hasOwnProperty.call(y,"kind")&&_.uint32(48).int32(y.kind),y.startTimeUnixNano!=null&&Object.hasOwnProperty.call(y,"startTimeUnixNano")&&_.uint32(57).fixed64(y.startTimeUnixNano),y.endTimeUnixNano!=null&&Object.hasOwnProperty.call(y,"endTimeUnixNano")&&_.uint32(65).fixed64(y.endTimeUnixNano),y.attributes!=null&&y.attributes.length)for(var N=0;N<y.attributes.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.attributes[N],_.uint32(74).fork()).ldelim();if(y.droppedAttributesCount!=null&&Object.hasOwnProperty.call(y,"droppedAttributesCount")&&_.uint32(80).uint32(y.droppedAttributesCount),y.events!=null&&y.events.length)for(var N=0;N<y.events.length;++N)O.opentelemetry.proto.trace.v1.Span.Event.encode(y.events[N],_.uint32(90).fork()).ldelim();if(y.droppedEventsCount!=null&&Object.hasOwnProperty.call(y,"droppedEventsCount")&&_.uint32(96).uint32(y.droppedEventsCount),y.links!=null&&y.links.length)for(var N=0;N<y.links.length;++N)O.opentelemetry.proto.trace.v1.Span.Link.encode(y.links[N],_.uint32(106).fork()).ldelim();return y.droppedLinksCount!=null&&Object.hasOwnProperty.call(y,"droppedLinksCount")&&_.uint32(112).uint32(y.droppedLinksCount),y.status!=null&&Object.hasOwnProperty.call(y,"status")&&O.opentelemetry.proto.trace.v1.Status.encode(y.status,_.uint32(122).fork()).ldelim(),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.trace.v1.Span;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.traceId=y.bytes();break}case 2:{I.spanId=y.bytes();break}case 3:{I.traceState=y.string();break}case 4:{I.parentSpanId=y.bytes();break}case 5:{I.name=y.string();break}case 6:{I.kind=y.int32();break}case 7:{I.startTimeUnixNano=y.fixed64();break}case 8:{I.endTimeUnixNano=y.fixed64();break}case 9:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}case 10:{I.droppedAttributesCount=y.uint32();break}case 11:{I.events&&I.events.length||(I.events=[]),I.events.push(O.opentelemetry.proto.trace.v1.Span.Event.decode(y,y.uint32()));break}case 12:{I.droppedEventsCount=y.uint32();break}case 13:{I.links&&I.links.length||(I.links=[]),I.links.push(O.opentelemetry.proto.trace.v1.Span.Link.decode(y,y.uint32()));break}case 14:{I.droppedLinksCount=y.uint32();break}case 15:{I.status=O.opentelemetry.proto.trace.v1.Status.decode(y,y.uint32());break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.traceId!=null&&y.hasOwnProperty("traceId")&&!(y.traceId&&typeof y.traceId.length=="number"||P.isString(y.traceId)))return"traceId: buffer expected";if(y.spanId!=null&&y.hasOwnProperty("spanId")&&!(y.spanId&&typeof y.spanId.length=="number"||P.isString(y.spanId)))return"spanId: buffer expected";if(y.traceState!=null&&y.hasOwnProperty("traceState")&&!P.isString(y.traceState))return"traceState: string expected";if(y.parentSpanId!=null&&y.hasOwnProperty("parentSpanId")&&!(y.parentSpanId&&typeof y.parentSpanId.length=="number"||P.isString(y.parentSpanId)))return"parentSpanId: buffer expected";if(y.name!=null&&y.hasOwnProperty("name")&&!P.isString(y.name))return"name: string expected";if(y.kind!=null&&y.hasOwnProperty("kind"))switch(y.kind){default:return"kind: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:break}if(y.startTimeUnixNano!=null&&y.hasOwnProperty("startTimeUnixNano")&&!P.isInteger(y.startTimeUnixNano)&&!(y.startTimeUnixNano&&P.isInteger(y.startTimeUnixNano.low)&&P.isInteger(y.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(y.endTimeUnixNano!=null&&y.hasOwnProperty("endTimeUnixNano")&&!P.isInteger(y.endTimeUnixNano)&&!(y.endTimeUnixNano&&P.isInteger(y.endTimeUnixNano.low)&&P.isInteger(y.endTimeUnixNano.high)))return"endTimeUnixNano: integer|Long expected";if(y.attributes!=null&&y.hasOwnProperty("attributes")){if(!Array.isArray(y.attributes))return"attributes: array expected";for(var _=0;_<y.attributes.length;++_){var N=O.opentelemetry.proto.common.v1.KeyValue.verify(y.attributes[_]);if(N)return"attributes."+N}}if(y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(y.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(y.events!=null&&y.hasOwnProperty("events")){if(!Array.isArray(y.events))return"events: array expected";for(var _=0;_<y.events.length;++_){var N=O.opentelemetry.proto.trace.v1.Span.Event.verify(y.events[_]);if(N)return"events."+N}}if(y.droppedEventsCount!=null&&y.hasOwnProperty("droppedEventsCount")&&!P.isInteger(y.droppedEventsCount))return"droppedEventsCount: integer expected";if(y.links!=null&&y.hasOwnProperty("links")){if(!Array.isArray(y.links))return"links: array expected";for(var _=0;_<y.links.length;++_){var N=O.opentelemetry.proto.trace.v1.Span.Link.verify(y.links[_]);if(N)return"links."+N}}if(y.droppedLinksCount!=null&&y.hasOwnProperty("droppedLinksCount")&&!P.isInteger(y.droppedLinksCount))return"droppedLinksCount: integer expected";if(y.status!=null&&y.hasOwnProperty("status")){var N=O.opentelemetry.proto.trace.v1.Status.verify(y.status);if(N)return"status."+N}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.trace.v1.Span)return y;var _=new O.opentelemetry.proto.trace.v1.Span;switch(y.traceId!=null&&(typeof y.traceId=="string"?P.base64.decode(y.traceId,_.traceId=P.newBuffer(P.base64.length(y.traceId)),0):y.traceId.length>=0&&(_.traceId=y.traceId)),y.spanId!=null&&(typeof y.spanId=="string"?P.base64.decode(y.spanId,_.spanId=P.newBuffer(P.base64.length(y.spanId)),0):y.spanId.length>=0&&(_.spanId=y.spanId)),y.traceState!=null&&(_.traceState=String(y.traceState)),y.parentSpanId!=null&&(typeof y.parentSpanId=="string"?P.base64.decode(y.parentSpanId,_.parentSpanId=P.newBuffer(P.base64.length(y.parentSpanId)),0):y.parentSpanId.length>=0&&(_.parentSpanId=y.parentSpanId)),y.name!=null&&(_.name=String(y.name)),y.kind){default:if(typeof y.kind=="number"){_.kind=y.kind;break}break;case"SPAN_KIND_UNSPECIFIED":case 0:_.kind=0;break;case"SPAN_KIND_INTERNAL":case 1:_.kind=1;break;case"SPAN_KIND_SERVER":case 2:_.kind=2;break;case"SPAN_KIND_CLIENT":case 3:_.kind=3;break;case"SPAN_KIND_PRODUCER":case 4:_.kind=4;break;case"SPAN_KIND_CONSUMER":case 5:_.kind=5;break}if(y.startTimeUnixNano!=null&&(P.Long?(_.startTimeUnixNano=P.Long.fromValue(y.startTimeUnixNano)).unsigned=!1:typeof y.startTimeUnixNano=="string"?_.startTimeUnixNano=parseInt(y.startTimeUnixNano,10):typeof y.startTimeUnixNano=="number"?_.startTimeUnixNano=y.startTimeUnixNano:typeof y.startTimeUnixNano=="object"&&(_.startTimeUnixNano=new P.LongBits(y.startTimeUnixNano.low>>>0,y.startTimeUnixNano.high>>>0).toNumber())),y.endTimeUnixNano!=null&&(P.Long?(_.endTimeUnixNano=P.Long.fromValue(y.endTimeUnixNano)).unsigned=!1:typeof y.endTimeUnixNano=="string"?_.endTimeUnixNano=parseInt(y.endTimeUnixNano,10):typeof y.endTimeUnixNano=="number"?_.endTimeUnixNano=y.endTimeUnixNano:typeof y.endTimeUnixNano=="object"&&(_.endTimeUnixNano=new P.LongBits(y.endTimeUnixNano.low>>>0,y.endTimeUnixNano.high>>>0).toNumber())),y.attributes){if(!Array.isArray(y.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: array expected");_.attributes=[];for(var N=0;N<y.attributes.length;++N){if(typeof y.attributes[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: object expected");_.attributes[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.attributes[N])}}if(y.droppedAttributesCount!=null&&(_.droppedAttributesCount=y.droppedAttributesCount>>>0),y.events){if(!Array.isArray(y.events))throw TypeError(".opentelemetry.proto.trace.v1.Span.events: array expected");_.events=[];for(var N=0;N<y.events.length;++N){if(typeof y.events[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.events: object expected");_.events[N]=O.opentelemetry.proto.trace.v1.Span.Event.fromObject(y.events[N])}}if(y.droppedEventsCount!=null&&(_.droppedEventsCount=y.droppedEventsCount>>>0),y.links){if(!Array.isArray(y.links))throw TypeError(".opentelemetry.proto.trace.v1.Span.links: array expected");_.links=[];for(var N=0;N<y.links.length;++N){if(typeof y.links[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.links: object expected");_.links[N]=O.opentelemetry.proto.trace.v1.Span.Link.fromObject(y.links[N])}}if(y.droppedLinksCount!=null&&(_.droppedLinksCount=y.droppedLinksCount>>>0),y.status!=null){if(typeof y.status!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.status: object expected");_.status=O.opentelemetry.proto.trace.v1.Status.fromObject(y.status)}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.attributes=[],N.events=[],N.links=[]),_.defaults){if(_.bytes===String?N.traceId="":(N.traceId=[],_.bytes!==Array&&(N.traceId=P.newBuffer(N.traceId))),_.bytes===String?N.spanId="":(N.spanId=[],_.bytes!==Array&&(N.spanId=P.newBuffer(N.spanId))),N.traceState="",_.bytes===String?N.parentSpanId="":(N.parentSpanId=[],_.bytes!==Array&&(N.parentSpanId=P.newBuffer(N.parentSpanId))),N.name="",N.kind=_.enums===String?"SPAN_KIND_UNSPECIFIED":0,P.Long){var I=new P.Long(0,0,!1);N.startTimeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.startTimeUnixNano=_.longs===String?"0":0;if(P.Long){var I=new P.Long(0,0,!1);N.endTimeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.endTimeUnixNano=_.longs===String?"0":0;N.droppedAttributesCount=0,N.droppedEventsCount=0,N.droppedLinksCount=0,N.status=null}if(y.traceId!=null&&y.hasOwnProperty("traceId")&&(N.traceId=_.bytes===String?P.base64.encode(y.traceId,0,y.traceId.length):_.bytes===Array?Array.prototype.slice.call(y.traceId):y.traceId),y.spanId!=null&&y.hasOwnProperty("spanId")&&(N.spanId=_.bytes===String?P.base64.encode(y.spanId,0,y.spanId.length):_.bytes===Array?Array.prototype.slice.call(y.spanId):y.spanId),y.traceState!=null&&y.hasOwnProperty("traceState")&&(N.traceState=y.traceState),y.parentSpanId!=null&&y.hasOwnProperty("parentSpanId")&&(N.parentSpanId=_.bytes===String?P.base64.encode(y.parentSpanId,0,y.parentSpanId.length):_.bytes===Array?Array.prototype.slice.call(y.parentSpanId):y.parentSpanId),y.name!=null&&y.hasOwnProperty("name")&&(N.name=y.name),y.kind!=null&&y.hasOwnProperty("kind")&&(N.kind=_.enums===String?O.opentelemetry.proto.trace.v1.Span.SpanKind[y.kind]===void 0?y.kind:O.opentelemetry.proto.trace.v1.Span.SpanKind[y.kind]:y.kind),y.startTimeUnixNano!=null&&y.hasOwnProperty("startTimeUnixNano")&&(typeof y.startTimeUnixNano=="number"?N.startTimeUnixNano=_.longs===String?String(y.startTimeUnixNano):y.startTimeUnixNano:N.startTimeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.startTimeUnixNano):_.longs===Number?new P.LongBits(y.startTimeUnixNano.low>>>0,y.startTimeUnixNano.high>>>0).toNumber():y.startTimeUnixNano),y.endTimeUnixNano!=null&&y.hasOwnProperty("endTimeUnixNano")&&(typeof y.endTimeUnixNano=="number"?N.endTimeUnixNano=_.longs===String?String(y.endTimeUnixNano):y.endTimeUnixNano:N.endTimeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.endTimeUnixNano):_.longs===Number?new P.LongBits(y.endTimeUnixNano.low>>>0,y.endTimeUnixNano.high>>>0).toNumber():y.endTimeUnixNano),y.attributes&&y.attributes.length){N.attributes=[];for(var x=0;x<y.attributes.length;++x)N.attributes[x]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.attributes[x],_)}if(y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&(N.droppedAttributesCount=y.droppedAttributesCount),y.events&&y.events.length){N.events=[];for(var x=0;x<y.events.length;++x)N.events[x]=O.opentelemetry.proto.trace.v1.Span.Event.toObject(y.events[x],_)}if(y.droppedEventsCount!=null&&y.hasOwnProperty("droppedEventsCount")&&(N.droppedEventsCount=y.droppedEventsCount),y.links&&y.links.length){N.links=[];for(var x=0;x<y.links.length;++x)N.links[x]=O.opentelemetry.proto.trace.v1.Span.Link.toObject(y.links[x],_)}return y.droppedLinksCount!=null&&y.hasOwnProperty("droppedLinksCount")&&(N.droppedLinksCount=y.droppedLinksCount),y.status!=null&&y.hasOwnProperty("status")&&(N.status=O.opentelemetry.proto.trace.v1.Status.toObject(y.status,_)),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.trace.v1.Span"},C.SpanKind=(function(){var L={},y=Object.create(L);return y[L[0]="SPAN_KIND_UNSPECIFIED"]=0,y[L[1]="SPAN_KIND_INTERNAL"]=1,y[L[2]="SPAN_KIND_SERVER"]=2,y[L[3]="SPAN_KIND_CLIENT"]=3,y[L[4]="SPAN_KIND_PRODUCER"]=4,y[L[5]="SPAN_KIND_CONSUMER"]=5,y})(),C.Event=(function(){function L(y){if(this.attributes=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.timeUnixNano=null,L.prototype.name=null,L.prototype.attributes=P.emptyArray,L.prototype.droppedAttributesCount=null,L.create=function(_){return new L(_)},L.encode=function(_,N){if(N||(N=A.create()),_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano")&&N.uint32(9).fixed64(_.timeUnixNano),_.name!=null&&Object.hasOwnProperty.call(_,"name")&&N.uint32(18).string(_.name),_.attributes!=null&&_.attributes.length)for(var I=0;I<_.attributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[I],N.uint32(26).fork()).ldelim();return _.droppedAttributesCount!=null&&Object.hasOwnProperty.call(_,"droppedAttributesCount")&&N.uint32(32).uint32(_.droppedAttributesCount),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.trace.v1.Span.Event;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.timeUnixNano=_.fixed64();break}case 2:{x.name=_.string();break}case 3:{x.attributes&&x.attributes.length||(x.attributes=[]),x.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 4:{x.droppedAttributesCount=_.uint32();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&!P.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&P.isInteger(_.timeUnixNano.low)&&P.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(_.name!=null&&_.hasOwnProperty("name")&&!P.isString(_.name))return"name: string expected";if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var N=0;N<_.attributes.length;++N){var I=O.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[N]);if(I)return"attributes."+I}}return _.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(_.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.trace.v1.Span.Event)return _;var N=new O.opentelemetry.proto.trace.v1.Span.Event;if(_.timeUnixNano!=null&&(P.Long?(N.timeUnixNano=P.Long.fromValue(_.timeUnixNano)).unsigned=!1:typeof _.timeUnixNano=="string"?N.timeUnixNano=parseInt(_.timeUnixNano,10):typeof _.timeUnixNano=="number"?N.timeUnixNano=_.timeUnixNano:typeof _.timeUnixNano=="object"&&(N.timeUnixNano=new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber())),_.name!=null&&(N.name=String(_.name)),_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: array expected");N.attributes=[];for(var I=0;I<_.attributes.length;++I){if(typeof _.attributes[I]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: object expected");N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[I])}}return _.droppedAttributesCount!=null&&(N.droppedAttributesCount=_.droppedAttributesCount>>>0),N},L.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.attributes=[]),N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.timeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.timeUnixNano=N.longs===String?"0":0;I.name="",I.droppedAttributesCount=0}if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&(typeof _.timeUnixNano=="number"?I.timeUnixNano=N.longs===String?String(_.timeUnixNano):_.timeUnixNano:I.timeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.timeUnixNano):N.longs===Number?new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano),_.name!=null&&_.hasOwnProperty("name")&&(I.name=_.name),_.attributes&&_.attributes.length){I.attributes=[];for(var V=0;V<_.attributes.length;++V)I.attributes[V]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[V],N)}return _.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")&&(I.droppedAttributesCount=_.droppedAttributesCount),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.trace.v1.Span.Event"},L})(),C.Link=(function(){function L(y){if(this.attributes=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.traceId=null,L.prototype.spanId=null,L.prototype.traceState=null,L.prototype.attributes=P.emptyArray,L.prototype.droppedAttributesCount=null,L.create=function(_){return new L(_)},L.encode=function(_,N){if(N||(N=A.create()),_.traceId!=null&&Object.hasOwnProperty.call(_,"traceId")&&N.uint32(10).bytes(_.traceId),_.spanId!=null&&Object.hasOwnProperty.call(_,"spanId")&&N.uint32(18).bytes(_.spanId),_.traceState!=null&&Object.hasOwnProperty.call(_,"traceState")&&N.uint32(26).string(_.traceState),_.attributes!=null&&_.attributes.length)for(var I=0;I<_.attributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[I],N.uint32(34).fork()).ldelim();return _.droppedAttributesCount!=null&&Object.hasOwnProperty.call(_,"droppedAttributesCount")&&N.uint32(40).uint32(_.droppedAttributesCount),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.trace.v1.Span.Link;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.traceId=_.bytes();break}case 2:{x.spanId=_.bytes();break}case 3:{x.traceState=_.string();break}case 4:{x.attributes&&x.attributes.length||(x.attributes=[]),x.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 5:{x.droppedAttributesCount=_.uint32();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.traceId!=null&&_.hasOwnProperty("traceId")&&!(_.traceId&&typeof _.traceId.length=="number"||P.isString(_.traceId)))return"traceId: buffer expected";if(_.spanId!=null&&_.hasOwnProperty("spanId")&&!(_.spanId&&typeof _.spanId.length=="number"||P.isString(_.spanId)))return"spanId: buffer expected";if(_.traceState!=null&&_.hasOwnProperty("traceState")&&!P.isString(_.traceState))return"traceState: string expected";if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var N=0;N<_.attributes.length;++N){var I=O.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[N]);if(I)return"attributes."+I}}return _.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(_.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.trace.v1.Span.Link)return _;var N=new O.opentelemetry.proto.trace.v1.Span.Link;if(_.traceId!=null&&(typeof _.traceId=="string"?P.base64.decode(_.traceId,N.traceId=P.newBuffer(P.base64.length(_.traceId)),0):_.traceId.length>=0&&(N.traceId=_.traceId)),_.spanId!=null&&(typeof _.spanId=="string"?P.base64.decode(_.spanId,N.spanId=P.newBuffer(P.base64.length(_.spanId)),0):_.spanId.length>=0&&(N.spanId=_.spanId)),_.traceState!=null&&(N.traceState=String(_.traceState)),_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: array expected");N.attributes=[];for(var I=0;I<_.attributes.length;++I){if(typeof _.attributes[I]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: object expected");N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[I])}}return _.droppedAttributesCount!=null&&(N.droppedAttributesCount=_.droppedAttributesCount>>>0),N},L.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.attributes=[]),N.defaults&&(N.bytes===String?I.traceId="":(I.traceId=[],N.bytes!==Array&&(I.traceId=P.newBuffer(I.traceId))),N.bytes===String?I.spanId="":(I.spanId=[],N.bytes!==Array&&(I.spanId=P.newBuffer(I.spanId))),I.traceState="",I.droppedAttributesCount=0),_.traceId!=null&&_.hasOwnProperty("traceId")&&(I.traceId=N.bytes===String?P.base64.encode(_.traceId,0,_.traceId.length):N.bytes===Array?Array.prototype.slice.call(_.traceId):_.traceId),_.spanId!=null&&_.hasOwnProperty("spanId")&&(I.spanId=N.bytes===String?P.base64.encode(_.spanId,0,_.spanId.length):N.bytes===Array?Array.prototype.slice.call(_.spanId):_.spanId),_.traceState!=null&&_.hasOwnProperty("traceState")&&(I.traceState=_.traceState),_.attributes&&_.attributes.length){I.attributes=[];for(var x=0;x<_.attributes.length;++x)I.attributes[x]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[x],N)}return _.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")&&(I.droppedAttributesCount=_.droppedAttributesCount),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.trace.v1.Span.Link"},L})(),C})(),U.Status=(function(){function C(L){if(L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.message=null,C.prototype.code=null,C.create=function(y){return new C(y)},C.encode=function(y,_){return _||(_=A.create()),y.message!=null&&Object.hasOwnProperty.call(y,"message")&&_.uint32(18).string(y.message),y.code!=null&&Object.hasOwnProperty.call(y,"code")&&_.uint32(24).int32(y.code),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.trace.v1.Status;y.pos<N;){var x=y.uint32();switch(x>>>3){case 2:{I.message=y.string();break}case 3:{I.code=y.int32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.message!=null&&y.hasOwnProperty("message")&&!P.isString(y.message))return"message: string expected";if(y.code!=null&&y.hasOwnProperty("code"))switch(y.code){default:return"code: enum value expected";case 0:case 1:case 2:break}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.trace.v1.Status)return y;var _=new O.opentelemetry.proto.trace.v1.Status;switch(y.message!=null&&(_.message=String(y.message)),y.code){default:if(typeof y.code=="number"){_.code=y.code;break}break;case"STATUS_CODE_UNSET":case 0:_.code=0;break;case"STATUS_CODE_OK":case 1:_.code=1;break;case"STATUS_CODE_ERROR":case 2:_.code=2;break}return _},C.toObject=function(y,_){_||(_={});var N={};return _.defaults&&(N.message="",N.code=_.enums===String?"STATUS_CODE_UNSET":0),y.message!=null&&y.hasOwnProperty("message")&&(N.message=y.message),y.code!=null&&y.hasOwnProperty("code")&&(N.code=_.enums===String?O.opentelemetry.proto.trace.v1.Status.StatusCode[y.code]===void 0?y.code:O.opentelemetry.proto.trace.v1.Status.StatusCode[y.code]:y.code),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.trace.v1.Status"},C.StatusCode=(function(){var L={},y=Object.create(L);return y[L[0]="STATUS_CODE_UNSET"]=0,y[L[1]="STATUS_CODE_OK"]=1,y[L[2]="STATUS_CODE_ERROR"]=2,y})(),C})(),U})(),D})(),M.collector=(function(){var D={};return D.trace=(function(){var U={};return U.v1=(function(){var C={};return C.TraceService=(function(){function L(y,_,N){S.rpc.Service.call(this,y,_,N)}return(L.prototype=Object.create(S.rpc.Service.prototype)).constructor=L,L.create=function(_,N,I){return new this(_,N,I)},Object.defineProperty(L.prototype.export=function y(_,N){return this.rpcCall(y,O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,_,N)},"name",{value:"Export"}),L})(),C.ExportTraceServiceRequest=(function(){function L(y){if(this.resourceSpans=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.resourceSpans=P.emptyArray,L.create=function(_){return new L(_)},L.encode=function(_,N){if(N||(N=A.create()),_.resourceSpans!=null&&_.resourceSpans.length)for(var I=0;I<_.resourceSpans.length;++I)O.opentelemetry.proto.trace.v1.ResourceSpans.encode(_.resourceSpans[I],N.uint32(10).fork()).ldelim();return N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.resourceSpans&&x.resourceSpans.length||(x.resourceSpans=[]),x.resourceSpans.push(O.opentelemetry.proto.trace.v1.ResourceSpans.decode(_,_.uint32()));break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.resourceSpans!=null&&_.hasOwnProperty("resourceSpans")){if(!Array.isArray(_.resourceSpans))return"resourceSpans: array expected";for(var N=0;N<_.resourceSpans.length;++N){var I=O.opentelemetry.proto.trace.v1.ResourceSpans.verify(_.resourceSpans[N]);if(I)return"resourceSpans."+I}}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)return _;var N=new O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;if(_.resourceSpans){if(!Array.isArray(_.resourceSpans))throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: array expected");N.resourceSpans=[];for(var I=0;I<_.resourceSpans.length;++I){if(typeof _.resourceSpans[I]!="object")throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: object expected");N.resourceSpans[I]=O.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(_.resourceSpans[I])}}return N},L.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.resourceSpans=[]),_.resourceSpans&&_.resourceSpans.length){I.resourceSpans=[];for(var x=0;x<_.resourceSpans.length;++x)I.resourceSpans[x]=O.opentelemetry.proto.trace.v1.ResourceSpans.toObject(_.resourceSpans[x],N)}return I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"},L})(),C.ExportTraceServiceResponse=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.partialSuccess=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.partialSuccess!=null&&Object.hasOwnProperty.call(_,"partialSuccess")&&O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode(_.partialSuccess,N.uint32(10).fork()).ldelim(),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.partialSuccess=O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode(_,_.uint32());break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")){var N=O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify(_.partialSuccess);if(N)return"partialSuccess."+N}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse)return _;var N=new O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;if(_.partialSuccess!=null){if(typeof _.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.partialSuccess: object expected");N.partialSuccess=O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject(_.partialSuccess)}return N},L.toObject=function(_,N){N||(N={});var I={};return N.defaults&&(I.partialSuccess=null),_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")&&(I.partialSuccess=O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject(_.partialSuccess,N)),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"},L})(),C.ExportTracePartialSuccess=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.rejectedSpans=null,L.prototype.errorMessage=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.rejectedSpans!=null&&Object.hasOwnProperty.call(_,"rejectedSpans")&&N.uint32(8).int64(_.rejectedSpans),_.errorMessage!=null&&Object.hasOwnProperty.call(_,"errorMessage")&&N.uint32(18).string(_.errorMessage),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.rejectedSpans=_.int64();break}case 2:{x.errorMessage=_.string();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){return typeof _!="object"||_===null?"object expected":_.rejectedSpans!=null&&_.hasOwnProperty("rejectedSpans")&&!P.isInteger(_.rejectedSpans)&&!(_.rejectedSpans&&P.isInteger(_.rejectedSpans.low)&&P.isInteger(_.rejectedSpans.high))?"rejectedSpans: integer|Long expected":_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&!P.isString(_.errorMessage)?"errorMessage: string expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess)return _;var N=new O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;return _.rejectedSpans!=null&&(P.Long?(N.rejectedSpans=P.Long.fromValue(_.rejectedSpans)).unsigned=!1:typeof _.rejectedSpans=="string"?N.rejectedSpans=parseInt(_.rejectedSpans,10):typeof _.rejectedSpans=="number"?N.rejectedSpans=_.rejectedSpans:typeof _.rejectedSpans=="object"&&(N.rejectedSpans=new P.LongBits(_.rejectedSpans.low>>>0,_.rejectedSpans.high>>>0).toNumber())),_.errorMessage!=null&&(N.errorMessage=String(_.errorMessage)),N},L.toObject=function(_,N){N||(N={});var I={};if(N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.rejectedSpans=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.rejectedSpans=N.longs===String?"0":0;I.errorMessage=""}return _.rejectedSpans!=null&&_.hasOwnProperty("rejectedSpans")&&(typeof _.rejectedSpans=="number"?I.rejectedSpans=N.longs===String?String(_.rejectedSpans):_.rejectedSpans:I.rejectedSpans=N.longs===String?P.Long.prototype.toString.call(_.rejectedSpans):N.longs===Number?new P.LongBits(_.rejectedSpans.low>>>0,_.rejectedSpans.high>>>0).toNumber():_.rejectedSpans),_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&(I.errorMessage=_.errorMessage),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"},L})(),C})(),U})(),D.metrics=(function(){var U={};return U.v1=(function(){var C={};return C.MetricsService=(function(){function L(y,_,N){S.rpc.Service.call(this,y,_,N)}return(L.prototype=Object.create(S.rpc.Service.prototype)).constructor=L,L.create=function(_,N,I){return new this(_,N,I)},Object.defineProperty(L.prototype.export=function y(_,N){return this.rpcCall(y,O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,_,N)},"name",{value:"Export"}),L})(),C.ExportMetricsServiceRequest=(function(){function L(y){if(this.resourceMetrics=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.resourceMetrics=P.emptyArray,L.create=function(_){return new L(_)},L.encode=function(_,N){if(N||(N=A.create()),_.resourceMetrics!=null&&_.resourceMetrics.length)for(var I=0;I<_.resourceMetrics.length;++I)O.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(_.resourceMetrics[I],N.uint32(10).fork()).ldelim();return N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.resourceMetrics&&x.resourceMetrics.length||(x.resourceMetrics=[]),x.resourceMetrics.push(O.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(_,_.uint32()));break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.resourceMetrics!=null&&_.hasOwnProperty("resourceMetrics")){if(!Array.isArray(_.resourceMetrics))return"resourceMetrics: array expected";for(var N=0;N<_.resourceMetrics.length;++N){var I=O.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(_.resourceMetrics[N]);if(I)return"resourceMetrics."+I}}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest)return _;var N=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;if(_.resourceMetrics){if(!Array.isArray(_.resourceMetrics))throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: array expected");N.resourceMetrics=[];for(var I=0;I<_.resourceMetrics.length;++I){if(typeof _.resourceMetrics[I]!="object")throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: object expected");N.resourceMetrics[I]=O.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(_.resourceMetrics[I])}}return N},L.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.resourceMetrics=[]),_.resourceMetrics&&_.resourceMetrics.length){I.resourceMetrics=[];for(var x=0;x<_.resourceMetrics.length;++x)I.resourceMetrics[x]=O.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(_.resourceMetrics[x],N)}return I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"},L})(),C.ExportMetricsServiceResponse=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.partialSuccess=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.partialSuccess!=null&&Object.hasOwnProperty.call(_,"partialSuccess")&&O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode(_.partialSuccess,N.uint32(10).fork()).ldelim(),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.partialSuccess=O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode(_,_.uint32());break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")){var N=O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify(_.partialSuccess);if(N)return"partialSuccess."+N}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse)return _;var N=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;if(_.partialSuccess!=null){if(typeof _.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.partialSuccess: object expected");N.partialSuccess=O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject(_.partialSuccess)}return N},L.toObject=function(_,N){N||(N={});var I={};return N.defaults&&(I.partialSuccess=null),_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")&&(I.partialSuccess=O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject(_.partialSuccess,N)),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"},L})(),C.ExportMetricsPartialSuccess=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.rejectedDataPoints=null,L.prototype.errorMessage=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.rejectedDataPoints!=null&&Object.hasOwnProperty.call(_,"rejectedDataPoints")&&N.uint32(8).int64(_.rejectedDataPoints),_.errorMessage!=null&&Object.hasOwnProperty.call(_,"errorMessage")&&N.uint32(18).string(_.errorMessage),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.rejectedDataPoints=_.int64();break}case 2:{x.errorMessage=_.string();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){return typeof _!="object"||_===null?"object expected":_.rejectedDataPoints!=null&&_.hasOwnProperty("rejectedDataPoints")&&!P.isInteger(_.rejectedDataPoints)&&!(_.rejectedDataPoints&&P.isInteger(_.rejectedDataPoints.low)&&P.isInteger(_.rejectedDataPoints.high))?"rejectedDataPoints: integer|Long expected":_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&!P.isString(_.errorMessage)?"errorMessage: string expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess)return _;var N=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;return _.rejectedDataPoints!=null&&(P.Long?(N.rejectedDataPoints=P.Long.fromValue(_.rejectedDataPoints)).unsigned=!1:typeof _.rejectedDataPoints=="string"?N.rejectedDataPoints=parseInt(_.rejectedDataPoints,10):typeof _.rejectedDataPoints=="number"?N.rejectedDataPoints=_.rejectedDataPoints:typeof _.rejectedDataPoints=="object"&&(N.rejectedDataPoints=new P.LongBits(_.rejectedDataPoints.low>>>0,_.rejectedDataPoints.high>>>0).toNumber())),_.errorMessage!=null&&(N.errorMessage=String(_.errorMessage)),N},L.toObject=function(_,N){N||(N={});var I={};if(N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.rejectedDataPoints=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.rejectedDataPoints=N.longs===String?"0":0;I.errorMessage=""}return _.rejectedDataPoints!=null&&_.hasOwnProperty("rejectedDataPoints")&&(typeof _.rejectedDataPoints=="number"?I.rejectedDataPoints=N.longs===String?String(_.rejectedDataPoints):_.rejectedDataPoints:I.rejectedDataPoints=N.longs===String?P.Long.prototype.toString.call(_.rejectedDataPoints):N.longs===Number?new P.LongBits(_.rejectedDataPoints.low>>>0,_.rejectedDataPoints.high>>>0).toNumber():_.rejectedDataPoints),_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&(I.errorMessage=_.errorMessage),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"},L})(),C})(),U})(),D.logs=(function(){var U={};return U.v1=(function(){var C={};return C.LogsService=(function(){function L(y,_,N){S.rpc.Service.call(this,y,_,N)}return(L.prototype=Object.create(S.rpc.Service.prototype)).constructor=L,L.create=function(_,N,I){return new this(_,N,I)},Object.defineProperty(L.prototype.export=function y(_,N){return this.rpcCall(y,O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,_,N)},"name",{value:"Export"}),L})(),C.ExportLogsServiceRequest=(function(){function L(y){if(this.resourceLogs=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.resourceLogs=P.emptyArray,L.create=function(_){return new L(_)},L.encode=function(_,N){if(N||(N=A.create()),_.resourceLogs!=null&&_.resourceLogs.length)for(var I=0;I<_.resourceLogs.length;++I)O.opentelemetry.proto.logs.v1.ResourceLogs.encode(_.resourceLogs[I],N.uint32(10).fork()).ldelim();return N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.resourceLogs&&x.resourceLogs.length||(x.resourceLogs=[]),x.resourceLogs.push(O.opentelemetry.proto.logs.v1.ResourceLogs.decode(_,_.uint32()));break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.resourceLogs!=null&&_.hasOwnProperty("resourceLogs")){if(!Array.isArray(_.resourceLogs))return"resourceLogs: array expected";for(var N=0;N<_.resourceLogs.length;++N){var I=O.opentelemetry.proto.logs.v1.ResourceLogs.verify(_.resourceLogs[N]);if(I)return"resourceLogs."+I}}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)return _;var N=new O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;if(_.resourceLogs){if(!Array.isArray(_.resourceLogs))throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: array expected");N.resourceLogs=[];for(var I=0;I<_.resourceLogs.length;++I){if(typeof _.resourceLogs[I]!="object")throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: object expected");N.resourceLogs[I]=O.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(_.resourceLogs[I])}}return N},L.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.resourceLogs=[]),_.resourceLogs&&_.resourceLogs.length){I.resourceLogs=[];for(var x=0;x<_.resourceLogs.length;++x)I.resourceLogs[x]=O.opentelemetry.proto.logs.v1.ResourceLogs.toObject(_.resourceLogs[x],N)}return I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"},L})(),C.ExportLogsServiceResponse=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.partialSuccess=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.partialSuccess!=null&&Object.hasOwnProperty.call(_,"partialSuccess")&&O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode(_.partialSuccess,N.uint32(10).fork()).ldelim(),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.partialSuccess=O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode(_,_.uint32());break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")){var N=O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify(_.partialSuccess);if(N)return"partialSuccess."+N}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse)return _;var N=new O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;if(_.partialSuccess!=null){if(typeof _.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.partialSuccess: object expected");N.partialSuccess=O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject(_.partialSuccess)}return N},L.toObject=function(_,N){N||(N={});var I={};return N.defaults&&(I.partialSuccess=null),_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")&&(I.partialSuccess=O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject(_.partialSuccess,N)),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"},L})(),C.ExportLogsPartialSuccess=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.rejectedLogRecords=null,L.prototype.errorMessage=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.rejectedLogRecords!=null&&Object.hasOwnProperty.call(_,"rejectedLogRecords")&&N.uint32(8).int64(_.rejectedLogRecords),_.errorMessage!=null&&Object.hasOwnProperty.call(_,"errorMessage")&&N.uint32(18).string(_.errorMessage),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.rejectedLogRecords=_.int64();break}case 2:{x.errorMessage=_.string();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){return typeof _!="object"||_===null?"object expected":_.rejectedLogRecords!=null&&_.hasOwnProperty("rejectedLogRecords")&&!P.isInteger(_.rejectedLogRecords)&&!(_.rejectedLogRecords&&P.isInteger(_.rejectedLogRecords.low)&&P.isInteger(_.rejectedLogRecords.high))?"rejectedLogRecords: integer|Long expected":_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&!P.isString(_.errorMessage)?"errorMessage: string expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess)return _;var N=new O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;return _.rejectedLogRecords!=null&&(P.Long?(N.rejectedLogRecords=P.Long.fromValue(_.rejectedLogRecords)).unsigned=!1:typeof _.rejectedLogRecords=="string"?N.rejectedLogRecords=parseInt(_.rejectedLogRecords,10):typeof _.rejectedLogRecords=="number"?N.rejectedLogRecords=_.rejectedLogRecords:typeof _.rejectedLogRecords=="object"&&(N.rejectedLogRecords=new P.LongBits(_.rejectedLogRecords.low>>>0,_.rejectedLogRecords.high>>>0).toNumber())),_.errorMessage!=null&&(N.errorMessage=String(_.errorMessage)),N},L.toObject=function(_,N){N||(N={});var I={};if(N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.rejectedLogRecords=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.rejectedLogRecords=N.longs===String?"0":0;I.errorMessage=""}return _.rejectedLogRecords!=null&&_.hasOwnProperty("rejectedLogRecords")&&(typeof _.rejectedLogRecords=="number"?I.rejectedLogRecords=N.longs===String?String(_.rejectedLogRecords):_.rejectedLogRecords:I.rejectedLogRecords=N.longs===String?P.Long.prototype.toString.call(_.rejectedLogRecords):N.longs===Number?new P.LongBits(_.rejectedLogRecords.low>>>0,_.rejectedLogRecords.high>>>0).toNumber():_.rejectedLogRecords),_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&(I.errorMessage=_.errorMessage),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"},L})(),C})(),U})(),D})(),M.metrics=(function(){var D={};return D.v1=(function(){var U={};return U.MetricsData=(function(){function C(L){if(this.resourceMetrics=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resourceMetrics=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resourceMetrics!=null&&y.resourceMetrics.length)for(var N=0;N<y.resourceMetrics.length;++N)O.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(y.resourceMetrics[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.MetricsData;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resourceMetrics&&I.resourceMetrics.length||(I.resourceMetrics=[]),I.resourceMetrics.push(O.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resourceMetrics!=null&&y.hasOwnProperty("resourceMetrics")){if(!Array.isArray(y.resourceMetrics))return"resourceMetrics: array expected";for(var _=0;_<y.resourceMetrics.length;++_){var N=O.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(y.resourceMetrics[_]);if(N)return"resourceMetrics."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.MetricsData)return y;var _=new O.opentelemetry.proto.metrics.v1.MetricsData;if(y.resourceMetrics){if(!Array.isArray(y.resourceMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: array expected");_.resourceMetrics=[];for(var N=0;N<y.resourceMetrics.length;++N){if(typeof y.resourceMetrics[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: object expected");_.resourceMetrics[N]=O.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(y.resourceMetrics[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.resourceMetrics=[]),y.resourceMetrics&&y.resourceMetrics.length){N.resourceMetrics=[];for(var I=0;I<y.resourceMetrics.length;++I)N.resourceMetrics[I]=O.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(y.resourceMetrics[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.MetricsData"},C})(),U.ResourceMetrics=(function(){function C(L){if(this.scopeMetrics=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resource=null,C.prototype.scopeMetrics=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resource!=null&&Object.hasOwnProperty.call(y,"resource")&&O.opentelemetry.proto.resource.v1.Resource.encode(y.resource,_.uint32(10).fork()).ldelim(),y.scopeMetrics!=null&&y.scopeMetrics.length)for(var N=0;N<y.scopeMetrics.length;++N)O.opentelemetry.proto.metrics.v1.ScopeMetrics.encode(y.scopeMetrics[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.ResourceMetrics;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resource=O.opentelemetry.proto.resource.v1.Resource.decode(y,y.uint32());break}case 2:{I.scopeMetrics&&I.scopeMetrics.length||(I.scopeMetrics=[]),I.scopeMetrics.push(O.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resource!=null&&y.hasOwnProperty("resource")){var _=O.opentelemetry.proto.resource.v1.Resource.verify(y.resource);if(_)return"resource."+_}if(y.scopeMetrics!=null&&y.hasOwnProperty("scopeMetrics")){if(!Array.isArray(y.scopeMetrics))return"scopeMetrics: array expected";for(var N=0;N<y.scopeMetrics.length;++N){var _=O.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(y.scopeMetrics[N]);if(_)return"scopeMetrics."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.ResourceMetrics)return y;var _=new O.opentelemetry.proto.metrics.v1.ResourceMetrics;if(y.resource!=null){if(typeof y.resource!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.resource: object expected");_.resource=O.opentelemetry.proto.resource.v1.Resource.fromObject(y.resource)}if(y.scopeMetrics){if(!Array.isArray(y.scopeMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: array expected");_.scopeMetrics=[];for(var N=0;N<y.scopeMetrics.length;++N){if(typeof y.scopeMetrics[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: object expected");_.scopeMetrics[N]=O.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(y.scopeMetrics[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.scopeMetrics=[]),_.defaults&&(N.resource=null,N.schemaUrl=""),y.resource!=null&&y.hasOwnProperty("resource")&&(N.resource=O.opentelemetry.proto.resource.v1.Resource.toObject(y.resource,_)),y.scopeMetrics&&y.scopeMetrics.length){N.scopeMetrics=[];for(var I=0;I<y.scopeMetrics.length;++I)N.scopeMetrics[I]=O.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(y.scopeMetrics[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.ResourceMetrics"},C})(),U.ScopeMetrics=(function(){function C(L){if(this.metrics=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.scope=null,C.prototype.metrics=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.scope!=null&&Object.hasOwnProperty.call(y,"scope")&&O.opentelemetry.proto.common.v1.InstrumentationScope.encode(y.scope,_.uint32(10).fork()).ldelim(),y.metrics!=null&&y.metrics.length)for(var N=0;N<y.metrics.length;++N)O.opentelemetry.proto.metrics.v1.Metric.encode(y.metrics[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.ScopeMetrics;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.decode(y,y.uint32());break}case 2:{I.metrics&&I.metrics.length||(I.metrics=[]),I.metrics.push(O.opentelemetry.proto.metrics.v1.Metric.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.scope!=null&&y.hasOwnProperty("scope")){var _=O.opentelemetry.proto.common.v1.InstrumentationScope.verify(y.scope);if(_)return"scope."+_}if(y.metrics!=null&&y.hasOwnProperty("metrics")){if(!Array.isArray(y.metrics))return"metrics: array expected";for(var N=0;N<y.metrics.length;++N){var _=O.opentelemetry.proto.metrics.v1.Metric.verify(y.metrics[N]);if(_)return"metrics."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.ScopeMetrics)return y;var _=new O.opentelemetry.proto.metrics.v1.ScopeMetrics;if(y.scope!=null){if(typeof y.scope!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.scope: object expected");_.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(y.scope)}if(y.metrics){if(!Array.isArray(y.metrics))throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: array expected");_.metrics=[];for(var N=0;N<y.metrics.length;++N){if(typeof y.metrics[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: object expected");_.metrics[N]=O.opentelemetry.proto.metrics.v1.Metric.fromObject(y.metrics[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.metrics=[]),_.defaults&&(N.scope=null,N.schemaUrl=""),y.scope!=null&&y.hasOwnProperty("scope")&&(N.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.toObject(y.scope,_)),y.metrics&&y.metrics.length){N.metrics=[];for(var I=0;I<y.metrics.length;++I)N.metrics[I]=O.opentelemetry.proto.metrics.v1.Metric.toObject(y.metrics[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.ScopeMetrics"},C})(),U.Metric=(function(){function C(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.name=null,C.prototype.description=null,C.prototype.unit=null,C.prototype.gauge=null,C.prototype.sum=null,C.prototype.histogram=null,C.prototype.exponentialHistogram=null,C.prototype.summary=null;var L;return Object.defineProperty(C.prototype,"data",{get:P.oneOfGetter(L=["gauge","sum","histogram","exponentialHistogram","summary"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){return N||(N=A.create()),_.name!=null&&Object.hasOwnProperty.call(_,"name")&&N.uint32(10).string(_.name),_.description!=null&&Object.hasOwnProperty.call(_,"description")&&N.uint32(18).string(_.description),_.unit!=null&&Object.hasOwnProperty.call(_,"unit")&&N.uint32(26).string(_.unit),_.gauge!=null&&Object.hasOwnProperty.call(_,"gauge")&&O.opentelemetry.proto.metrics.v1.Gauge.encode(_.gauge,N.uint32(42).fork()).ldelim(),_.sum!=null&&Object.hasOwnProperty.call(_,"sum")&&O.opentelemetry.proto.metrics.v1.Sum.encode(_.sum,N.uint32(58).fork()).ldelim(),_.histogram!=null&&Object.hasOwnProperty.call(_,"histogram")&&O.opentelemetry.proto.metrics.v1.Histogram.encode(_.histogram,N.uint32(74).fork()).ldelim(),_.exponentialHistogram!=null&&Object.hasOwnProperty.call(_,"exponentialHistogram")&&O.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode(_.exponentialHistogram,N.uint32(82).fork()).ldelim(),_.summary!=null&&Object.hasOwnProperty.call(_,"summary")&&O.opentelemetry.proto.metrics.v1.Summary.encode(_.summary,N.uint32(90).fork()).ldelim(),N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.Metric;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.name=_.string();break}case 2:{x.description=_.string();break}case 3:{x.unit=_.string();break}case 5:{x.gauge=O.opentelemetry.proto.metrics.v1.Gauge.decode(_,_.uint32());break}case 7:{x.sum=O.opentelemetry.proto.metrics.v1.Sum.decode(_,_.uint32());break}case 9:{x.histogram=O.opentelemetry.proto.metrics.v1.Histogram.decode(_,_.uint32());break}case 10:{x.exponentialHistogram=O.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode(_,_.uint32());break}case 11:{x.summary=O.opentelemetry.proto.metrics.v1.Summary.decode(_,_.uint32());break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";var N={};if(_.name!=null&&_.hasOwnProperty("name")&&!P.isString(_.name))return"name: string expected";if(_.description!=null&&_.hasOwnProperty("description")&&!P.isString(_.description))return"description: string expected";if(_.unit!=null&&_.hasOwnProperty("unit")&&!P.isString(_.unit))return"unit: string expected";if(_.gauge!=null&&_.hasOwnProperty("gauge")){N.data=1;{var I=O.opentelemetry.proto.metrics.v1.Gauge.verify(_.gauge);if(I)return"gauge."+I}}if(_.sum!=null&&_.hasOwnProperty("sum")){if(N.data===1)return"data: multiple values";N.data=1;{var I=O.opentelemetry.proto.metrics.v1.Sum.verify(_.sum);if(I)return"sum."+I}}if(_.histogram!=null&&_.hasOwnProperty("histogram")){if(N.data===1)return"data: multiple values";N.data=1;{var I=O.opentelemetry.proto.metrics.v1.Histogram.verify(_.histogram);if(I)return"histogram."+I}}if(_.exponentialHistogram!=null&&_.hasOwnProperty("exponentialHistogram")){if(N.data===1)return"data: multiple values";N.data=1;{var I=O.opentelemetry.proto.metrics.v1.ExponentialHistogram.verify(_.exponentialHistogram);if(I)return"exponentialHistogram."+I}}if(_.summary!=null&&_.hasOwnProperty("summary")){if(N.data===1)return"data: multiple values";N.data=1;{var I=O.opentelemetry.proto.metrics.v1.Summary.verify(_.summary);if(I)return"summary."+I}}return null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.Metric)return _;var N=new O.opentelemetry.proto.metrics.v1.Metric;if(_.name!=null&&(N.name=String(_.name)),_.description!=null&&(N.description=String(_.description)),_.unit!=null&&(N.unit=String(_.unit)),_.gauge!=null){if(typeof _.gauge!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.gauge: object expected");N.gauge=O.opentelemetry.proto.metrics.v1.Gauge.fromObject(_.gauge)}if(_.sum!=null){if(typeof _.sum!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.sum: object expected");N.sum=O.opentelemetry.proto.metrics.v1.Sum.fromObject(_.sum)}if(_.histogram!=null){if(typeof _.histogram!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.histogram: object expected");N.histogram=O.opentelemetry.proto.metrics.v1.Histogram.fromObject(_.histogram)}if(_.exponentialHistogram!=null){if(typeof _.exponentialHistogram!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.exponentialHistogram: object expected");N.exponentialHistogram=O.opentelemetry.proto.metrics.v1.ExponentialHistogram.fromObject(_.exponentialHistogram)}if(_.summary!=null){if(typeof _.summary!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.summary: object expected");N.summary=O.opentelemetry.proto.metrics.v1.Summary.fromObject(_.summary)}return N},C.toObject=function(_,N){N||(N={});var I={};return N.defaults&&(I.name="",I.description="",I.unit=""),_.name!=null&&_.hasOwnProperty("name")&&(I.name=_.name),_.description!=null&&_.hasOwnProperty("description")&&(I.description=_.description),_.unit!=null&&_.hasOwnProperty("unit")&&(I.unit=_.unit),_.gauge!=null&&_.hasOwnProperty("gauge")&&(I.gauge=O.opentelemetry.proto.metrics.v1.Gauge.toObject(_.gauge,N),N.oneofs&&(I.data="gauge")),_.sum!=null&&_.hasOwnProperty("sum")&&(I.sum=O.opentelemetry.proto.metrics.v1.Sum.toObject(_.sum,N),N.oneofs&&(I.data="sum")),_.histogram!=null&&_.hasOwnProperty("histogram")&&(I.histogram=O.opentelemetry.proto.metrics.v1.Histogram.toObject(_.histogram,N),N.oneofs&&(I.data="histogram")),_.exponentialHistogram!=null&&_.hasOwnProperty("exponentialHistogram")&&(I.exponentialHistogram=O.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject(_.exponentialHistogram,N),N.oneofs&&(I.data="exponentialHistogram")),_.summary!=null&&_.hasOwnProperty("summary")&&(I.summary=O.opentelemetry.proto.metrics.v1.Summary.toObject(_.summary,N),N.oneofs&&(I.data="summary")),I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.Metric"},C})(),U.Gauge=(function(){function C(L){if(this.dataPoints=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.dataPoints=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.dataPoints!=null&&y.dataPoints.length)for(var N=0;N<y.dataPoints.length;++N)O.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(y.dataPoints[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.Gauge;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.dataPoints&&I.dataPoints.length||(I.dataPoints=[]),I.dataPoints.push(O.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.dataPoints!=null&&y.hasOwnProperty("dataPoints")){if(!Array.isArray(y.dataPoints))return"dataPoints: array expected";for(var _=0;_<y.dataPoints.length;++_){var N=O.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(y.dataPoints[_]);if(N)return"dataPoints."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.Gauge)return y;var _=new O.opentelemetry.proto.metrics.v1.Gauge;if(y.dataPoints){if(!Array.isArray(y.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: array expected");_.dataPoints=[];for(var N=0;N<y.dataPoints.length;++N){if(typeof y.dataPoints[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: object expected");_.dataPoints[N]=O.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(y.dataPoints[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.dataPoints=[]),y.dataPoints&&y.dataPoints.length){N.dataPoints=[];for(var I=0;I<y.dataPoints.length;++I)N.dataPoints[I]=O.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(y.dataPoints[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.Gauge"},C})(),U.Sum=(function(){function C(L){if(this.dataPoints=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.dataPoints=P.emptyArray,C.prototype.aggregationTemporality=null,C.prototype.isMonotonic=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.dataPoints!=null&&y.dataPoints.length)for(var N=0;N<y.dataPoints.length;++N)O.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(y.dataPoints[N],_.uint32(10).fork()).ldelim();return y.aggregationTemporality!=null&&Object.hasOwnProperty.call(y,"aggregationTemporality")&&_.uint32(16).int32(y.aggregationTemporality),y.isMonotonic!=null&&Object.hasOwnProperty.call(y,"isMonotonic")&&_.uint32(24).bool(y.isMonotonic),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.Sum;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.dataPoints&&I.dataPoints.length||(I.dataPoints=[]),I.dataPoints.push(O.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(y,y.uint32()));break}case 2:{I.aggregationTemporality=y.int32();break}case 3:{I.isMonotonic=y.bool();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.dataPoints!=null&&y.hasOwnProperty("dataPoints")){if(!Array.isArray(y.dataPoints))return"dataPoints: array expected";for(var _=0;_<y.dataPoints.length;++_){var N=O.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(y.dataPoints[_]);if(N)return"dataPoints."+N}}if(y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality"))switch(y.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return y.isMonotonic!=null&&y.hasOwnProperty("isMonotonic")&&typeof y.isMonotonic!="boolean"?"isMonotonic: boolean expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.Sum)return y;var _=new O.opentelemetry.proto.metrics.v1.Sum;if(y.dataPoints){if(!Array.isArray(y.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: array expected");_.dataPoints=[];for(var N=0;N<y.dataPoints.length;++N){if(typeof y.dataPoints[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: object expected");_.dataPoints[N]=O.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(y.dataPoints[N])}}switch(y.aggregationTemporality){default:if(typeof y.aggregationTemporality=="number"){_.aggregationTemporality=y.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:_.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:_.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:_.aggregationTemporality=2;break}return y.isMonotonic!=null&&(_.isMonotonic=!!y.isMonotonic),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.dataPoints=[]),_.defaults&&(N.aggregationTemporality=_.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0,N.isMonotonic=!1),y.dataPoints&&y.dataPoints.length){N.dataPoints=[];for(var I=0;I<y.dataPoints.length;++I)N.dataPoints[I]=O.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(y.dataPoints[I],_)}return y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality")&&(N.aggregationTemporality=_.enums===String?O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]===void 0?y.aggregationTemporality:O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]:y.aggregationTemporality),y.isMonotonic!=null&&y.hasOwnProperty("isMonotonic")&&(N.isMonotonic=y.isMonotonic),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.Sum"},C})(),U.Histogram=(function(){function C(L){if(this.dataPoints=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.dataPoints=P.emptyArray,C.prototype.aggregationTemporality=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.dataPoints!=null&&y.dataPoints.length)for(var N=0;N<y.dataPoints.length;++N)O.opentelemetry.proto.metrics.v1.HistogramDataPoint.encode(y.dataPoints[N],_.uint32(10).fork()).ldelim();return y.aggregationTemporality!=null&&Object.hasOwnProperty.call(y,"aggregationTemporality")&&_.uint32(16).int32(y.aggregationTemporality),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.Histogram;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.dataPoints&&I.dataPoints.length||(I.dataPoints=[]),I.dataPoints.push(O.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(y,y.uint32()));break}case 2:{I.aggregationTemporality=y.int32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.dataPoints!=null&&y.hasOwnProperty("dataPoints")){if(!Array.isArray(y.dataPoints))return"dataPoints: array expected";for(var _=0;_<y.dataPoints.length;++_){var N=O.opentelemetry.proto.metrics.v1.HistogramDataPoint.verify(y.dataPoints[_]);if(N)return"dataPoints."+N}}if(y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality"))switch(y.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.Histogram)return y;var _=new O.opentelemetry.proto.metrics.v1.Histogram;if(y.dataPoints){if(!Array.isArray(y.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: array expected");_.dataPoints=[];for(var N=0;N<y.dataPoints.length;++N){if(typeof y.dataPoints[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: object expected");_.dataPoints[N]=O.opentelemetry.proto.metrics.v1.HistogramDataPoint.fromObject(y.dataPoints[N])}}switch(y.aggregationTemporality){default:if(typeof y.aggregationTemporality=="number"){_.aggregationTemporality=y.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:_.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:_.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:_.aggregationTemporality=2;break}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.dataPoints=[]),_.defaults&&(N.aggregationTemporality=_.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),y.dataPoints&&y.dataPoints.length){N.dataPoints=[];for(var I=0;I<y.dataPoints.length;++I)N.dataPoints[I]=O.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(y.dataPoints[I],_)}return y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality")&&(N.aggregationTemporality=_.enums===String?O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]===void 0?y.aggregationTemporality:O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]:y.aggregationTemporality),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.Histogram"},C})(),U.ExponentialHistogram=(function(){function C(L){if(this.dataPoints=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.dataPoints=P.emptyArray,C.prototype.aggregationTemporality=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.dataPoints!=null&&y.dataPoints.length)for(var N=0;N<y.dataPoints.length;++N)O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.encode(y.dataPoints[N],_.uint32(10).fork()).ldelim();return y.aggregationTemporality!=null&&Object.hasOwnProperty.call(y,"aggregationTemporality")&&_.uint32(16).int32(y.aggregationTemporality),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.ExponentialHistogram;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.dataPoints&&I.dataPoints.length||(I.dataPoints=[]),I.dataPoints.push(O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(y,y.uint32()));break}case 2:{I.aggregationTemporality=y.int32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.dataPoints!=null&&y.hasOwnProperty("dataPoints")){if(!Array.isArray(y.dataPoints))return"dataPoints: array expected";for(var _=0;_<y.dataPoints.length;++_){var N=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify(y.dataPoints[_]);if(N)return"dataPoints."+N}}if(y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality"))switch(y.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.ExponentialHistogram)return y;var _=new O.opentelemetry.proto.metrics.v1.ExponentialHistogram;if(y.dataPoints){if(!Array.isArray(y.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: array expected");_.dataPoints=[];for(var N=0;N<y.dataPoints.length;++N){if(typeof y.dataPoints[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: object expected");_.dataPoints[N]=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.fromObject(y.dataPoints[N])}}switch(y.aggregationTemporality){default:if(typeof y.aggregationTemporality=="number"){_.aggregationTemporality=y.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:_.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:_.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:_.aggregationTemporality=2;break}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.dataPoints=[]),_.defaults&&(N.aggregationTemporality=_.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),y.dataPoints&&y.dataPoints.length){N.dataPoints=[];for(var I=0;I<y.dataPoints.length;++I)N.dataPoints[I]=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(y.dataPoints[I],_)}return y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality")&&(N.aggregationTemporality=_.enums===String?O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]===void 0?y.aggregationTemporality:O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]:y.aggregationTemporality),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.ExponentialHistogram"},C})(),U.Summary=(function(){function C(L){if(this.dataPoints=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.dataPoints=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.dataPoints!=null&&y.dataPoints.length)for(var N=0;N<y.dataPoints.length;++N)O.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(y.dataPoints[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.Summary;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.dataPoints&&I.dataPoints.length||(I.dataPoints=[]),I.dataPoints.push(O.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.dataPoints!=null&&y.hasOwnProperty("dataPoints")){if(!Array.isArray(y.dataPoints))return"dataPoints: array expected";for(var _=0;_<y.dataPoints.length;++_){var N=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(y.dataPoints[_]);if(N)return"dataPoints."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.Summary)return y;var _=new O.opentelemetry.proto.metrics.v1.Summary;if(y.dataPoints){if(!Array.isArray(y.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: array expected");_.dataPoints=[];for(var N=0;N<y.dataPoints.length;++N){if(typeof y.dataPoints[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: object expected");_.dataPoints[N]=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(y.dataPoints[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.dataPoints=[]),y.dataPoints&&y.dataPoints.length){N.dataPoints=[];for(var I=0;I<y.dataPoints.length;++I)N.dataPoints[I]=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(y.dataPoints[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.Summary"},C})(),U.AggregationTemporality=(function(){var C={},L=Object.create(C);return L[C[0]="AGGREGATION_TEMPORALITY_UNSPECIFIED"]=0,L[C[1]="AGGREGATION_TEMPORALITY_DELTA"]=1,L[C[2]="AGGREGATION_TEMPORALITY_CUMULATIVE"]=2,L})(),U.DataPointFlags=(function(){var C={},L=Object.create(C);return L[C[0]="DATA_POINT_FLAGS_DO_NOT_USE"]=0,L[C[1]="DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"]=1,L})(),U.NumberDataPoint=(function(){function C(y){if(this.attributes=[],this.exemplars=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.attributes=P.emptyArray,C.prototype.startTimeUnixNano=null,C.prototype.timeUnixNano=null,C.prototype.asDouble=null,C.prototype.asInt=null,C.prototype.exemplars=P.emptyArray,C.prototype.flags=null;var L;return Object.defineProperty(C.prototype,"value",{get:P.oneOfGetter(L=["asDouble","asInt"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){if(N||(N=A.create()),_.startTimeUnixNano!=null&&Object.hasOwnProperty.call(_,"startTimeUnixNano")&&N.uint32(17).fixed64(_.startTimeUnixNano),_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano")&&N.uint32(25).fixed64(_.timeUnixNano),_.asDouble!=null&&Object.hasOwnProperty.call(_,"asDouble")&&N.uint32(33).double(_.asDouble),_.exemplars!=null&&_.exemplars.length)for(var I=0;I<_.exemplars.length;++I)O.opentelemetry.proto.metrics.v1.Exemplar.encode(_.exemplars[I],N.uint32(42).fork()).ldelim();if(_.asInt!=null&&Object.hasOwnProperty.call(_,"asInt")&&N.uint32(49).sfixed64(_.asInt),_.attributes!=null&&_.attributes.length)for(var I=0;I<_.attributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[I],N.uint32(58).fork()).ldelim();return _.flags!=null&&Object.hasOwnProperty.call(_,"flags")&&N.uint32(64).uint32(_.flags),N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.NumberDataPoint;_.pos<I;){var V=_.uint32();switch(V>>>3){case 7:{x.attributes&&x.attributes.length||(x.attributes=[]),x.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 2:{x.startTimeUnixNano=_.fixed64();break}case 3:{x.timeUnixNano=_.fixed64();break}case 4:{x.asDouble=_.double();break}case 6:{x.asInt=_.sfixed64();break}case 5:{x.exemplars&&x.exemplars.length||(x.exemplars=[]),x.exemplars.push(O.opentelemetry.proto.metrics.v1.Exemplar.decode(_,_.uint32()));break}case 8:{x.flags=_.uint32();break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";var N={};if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var I=0;I<_.attributes.length;++I){var x=O.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[I]);if(x)return"attributes."+x}}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&!P.isInteger(_.startTimeUnixNano)&&!(_.startTimeUnixNano&&P.isInteger(_.startTimeUnixNano.low)&&P.isInteger(_.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&!P.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&P.isInteger(_.timeUnixNano.low)&&P.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(_.asDouble!=null&&_.hasOwnProperty("asDouble")&&(N.value=1,typeof _.asDouble!="number"))return"asDouble: number expected";if(_.asInt!=null&&_.hasOwnProperty("asInt")){if(N.value===1)return"value: multiple values";if(N.value=1,!P.isInteger(_.asInt)&&!(_.asInt&&P.isInteger(_.asInt.low)&&P.isInteger(_.asInt.high)))return"asInt: integer|Long expected"}if(_.exemplars!=null&&_.hasOwnProperty("exemplars")){if(!Array.isArray(_.exemplars))return"exemplars: array expected";for(var I=0;I<_.exemplars.length;++I){var x=O.opentelemetry.proto.metrics.v1.Exemplar.verify(_.exemplars[I]);if(x)return"exemplars."+x}}return _.flags!=null&&_.hasOwnProperty("flags")&&!P.isInteger(_.flags)?"flags: integer expected":null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.NumberDataPoint)return _;var N=new O.opentelemetry.proto.metrics.v1.NumberDataPoint;if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: array expected");N.attributes=[];for(var I=0;I<_.attributes.length;++I){if(typeof _.attributes[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: object expected");N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[I])}}if(_.startTimeUnixNano!=null&&(P.Long?(N.startTimeUnixNano=P.Long.fromValue(_.startTimeUnixNano)).unsigned=!1:typeof _.startTimeUnixNano=="string"?N.startTimeUnixNano=parseInt(_.startTimeUnixNano,10):typeof _.startTimeUnixNano=="number"?N.startTimeUnixNano=_.startTimeUnixNano:typeof _.startTimeUnixNano=="object"&&(N.startTimeUnixNano=new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber())),_.timeUnixNano!=null&&(P.Long?(N.timeUnixNano=P.Long.fromValue(_.timeUnixNano)).unsigned=!1:typeof _.timeUnixNano=="string"?N.timeUnixNano=parseInt(_.timeUnixNano,10):typeof _.timeUnixNano=="number"?N.timeUnixNano=_.timeUnixNano:typeof _.timeUnixNano=="object"&&(N.timeUnixNano=new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber())),_.asDouble!=null&&(N.asDouble=Number(_.asDouble)),_.asInt!=null&&(P.Long?(N.asInt=P.Long.fromValue(_.asInt)).unsigned=!1:typeof _.asInt=="string"?N.asInt=parseInt(_.asInt,10):typeof _.asInt=="number"?N.asInt=_.asInt:typeof _.asInt=="object"&&(N.asInt=new P.LongBits(_.asInt.low>>>0,_.asInt.high>>>0).toNumber())),_.exemplars){if(!Array.isArray(_.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: array expected");N.exemplars=[];for(var I=0;I<_.exemplars.length;++I){if(typeof _.exemplars[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: object expected");N.exemplars[I]=O.opentelemetry.proto.metrics.v1.Exemplar.fromObject(_.exemplars[I])}}return _.flags!=null&&(N.flags=_.flags>>>0),N},C.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.exemplars=[],I.attributes=[]),N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.startTimeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.startTimeUnixNano=N.longs===String?"0":0;if(P.Long){var x=new P.Long(0,0,!1);I.timeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.timeUnixNano=N.longs===String?"0":0;I.flags=0}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&(typeof _.startTimeUnixNano=="number"?I.startTimeUnixNano=N.longs===String?String(_.startTimeUnixNano):_.startTimeUnixNano:I.startTimeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.startTimeUnixNano):N.longs===Number?new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber():_.startTimeUnixNano),_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&(typeof _.timeUnixNano=="number"?I.timeUnixNano=N.longs===String?String(_.timeUnixNano):_.timeUnixNano:I.timeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.timeUnixNano):N.longs===Number?new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano),_.asDouble!=null&&_.hasOwnProperty("asDouble")&&(I.asDouble=N.json&&!isFinite(_.asDouble)?String(_.asDouble):_.asDouble,N.oneofs&&(I.value="asDouble")),_.exemplars&&_.exemplars.length){I.exemplars=[];for(var V=0;V<_.exemplars.length;++V)I.exemplars[V]=O.opentelemetry.proto.metrics.v1.Exemplar.toObject(_.exemplars[V],N)}if(_.asInt!=null&&_.hasOwnProperty("asInt")&&(typeof _.asInt=="number"?I.asInt=N.longs===String?String(_.asInt):_.asInt:I.asInt=N.longs===String?P.Long.prototype.toString.call(_.asInt):N.longs===Number?new P.LongBits(_.asInt.low>>>0,_.asInt.high>>>0).toNumber():_.asInt,N.oneofs&&(I.value="asInt")),_.attributes&&_.attributes.length){I.attributes=[];for(var V=0;V<_.attributes.length;++V)I.attributes[V]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[V],N)}return _.flags!=null&&_.hasOwnProperty("flags")&&(I.flags=_.flags),I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.NumberDataPoint"},C})(),U.HistogramDataPoint=(function(){function C(y){if(this.attributes=[],this.bucketCounts=[],this.explicitBounds=[],this.exemplars=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.attributes=P.emptyArray,C.prototype.startTimeUnixNano=null,C.prototype.timeUnixNano=null,C.prototype.count=null,C.prototype.sum=null,C.prototype.bucketCounts=P.emptyArray,C.prototype.explicitBounds=P.emptyArray,C.prototype.exemplars=P.emptyArray,C.prototype.flags=null,C.prototype.min=null,C.prototype.max=null;var L;return Object.defineProperty(C.prototype,"_sum",{get:P.oneOfGetter(L=["sum"]),set:P.oneOfSetter(L)}),Object.defineProperty(C.prototype,"_min",{get:P.oneOfGetter(L=["min"]),set:P.oneOfSetter(L)}),Object.defineProperty(C.prototype,"_max",{get:P.oneOfGetter(L=["max"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){if(N||(N=A.create()),_.startTimeUnixNano!=null&&Object.hasOwnProperty.call(_,"startTimeUnixNano")&&N.uint32(17).fixed64(_.startTimeUnixNano),_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano")&&N.uint32(25).fixed64(_.timeUnixNano),_.count!=null&&Object.hasOwnProperty.call(_,"count")&&N.uint32(33).fixed64(_.count),_.sum!=null&&Object.hasOwnProperty.call(_,"sum")&&N.uint32(41).double(_.sum),_.bucketCounts!=null&&_.bucketCounts.length){N.uint32(50).fork();for(var I=0;I<_.bucketCounts.length;++I)N.fixed64(_.bucketCounts[I]);N.ldelim()}if(_.explicitBounds!=null&&_.explicitBounds.length){N.uint32(58).fork();for(var I=0;I<_.explicitBounds.length;++I)N.double(_.explicitBounds[I]);N.ldelim()}if(_.exemplars!=null&&_.exemplars.length)for(var I=0;I<_.exemplars.length;++I)O.opentelemetry.proto.metrics.v1.Exemplar.encode(_.exemplars[I],N.uint32(66).fork()).ldelim();if(_.attributes!=null&&_.attributes.length)for(var I=0;I<_.attributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[I],N.uint32(74).fork()).ldelim();return _.flags!=null&&Object.hasOwnProperty.call(_,"flags")&&N.uint32(80).uint32(_.flags),_.min!=null&&Object.hasOwnProperty.call(_,"min")&&N.uint32(89).double(_.min),_.max!=null&&Object.hasOwnProperty.call(_,"max")&&N.uint32(97).double(_.max),N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.HistogramDataPoint;_.pos<I;){var V=_.uint32();switch(V>>>3){case 9:{x.attributes&&x.attributes.length||(x.attributes=[]),x.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 2:{x.startTimeUnixNano=_.fixed64();break}case 3:{x.timeUnixNano=_.fixed64();break}case 4:{x.count=_.fixed64();break}case 5:{x.sum=_.double();break}case 6:{if(x.bucketCounts&&x.bucketCounts.length||(x.bucketCounts=[]),(V&7)===2)for(var k=_.uint32()+_.pos;_.pos<k;)x.bucketCounts.push(_.fixed64());else x.bucketCounts.push(_.fixed64());break}case 7:{if(x.explicitBounds&&x.explicitBounds.length||(x.explicitBounds=[]),(V&7)===2)for(var k=_.uint32()+_.pos;_.pos<k;)x.explicitBounds.push(_.double());else x.explicitBounds.push(_.double());break}case 8:{x.exemplars&&x.exemplars.length||(x.exemplars=[]),x.exemplars.push(O.opentelemetry.proto.metrics.v1.Exemplar.decode(_,_.uint32()));break}case 10:{x.flags=_.uint32();break}case 11:{x.min=_.double();break}case 12:{x.max=_.double();break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var N=0;N<_.attributes.length;++N){var I=O.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[N]);if(I)return"attributes."+I}}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&!P.isInteger(_.startTimeUnixNano)&&!(_.startTimeUnixNano&&P.isInteger(_.startTimeUnixNano.low)&&P.isInteger(_.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&!P.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&P.isInteger(_.timeUnixNano.low)&&P.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(_.count!=null&&_.hasOwnProperty("count")&&!P.isInteger(_.count)&&!(_.count&&P.isInteger(_.count.low)&&P.isInteger(_.count.high)))return"count: integer|Long expected";if(_.sum!=null&&_.hasOwnProperty("sum")&&typeof _.sum!="number")return"sum: number expected";if(_.bucketCounts!=null&&_.hasOwnProperty("bucketCounts")){if(!Array.isArray(_.bucketCounts))return"bucketCounts: array expected";for(var N=0;N<_.bucketCounts.length;++N)if(!P.isInteger(_.bucketCounts[N])&&!(_.bucketCounts[N]&&P.isInteger(_.bucketCounts[N].low)&&P.isInteger(_.bucketCounts[N].high)))return"bucketCounts: integer|Long[] expected"}if(_.explicitBounds!=null&&_.hasOwnProperty("explicitBounds")){if(!Array.isArray(_.explicitBounds))return"explicitBounds: array expected";for(var N=0;N<_.explicitBounds.length;++N)if(typeof _.explicitBounds[N]!="number")return"explicitBounds: number[] expected"}if(_.exemplars!=null&&_.hasOwnProperty("exemplars")){if(!Array.isArray(_.exemplars))return"exemplars: array expected";for(var N=0;N<_.exemplars.length;++N){var I=O.opentelemetry.proto.metrics.v1.Exemplar.verify(_.exemplars[N]);if(I)return"exemplars."+I}}return _.flags!=null&&_.hasOwnProperty("flags")&&!P.isInteger(_.flags)?"flags: integer expected":_.min!=null&&_.hasOwnProperty("min")&&typeof _.min!="number"?"min: number expected":_.max!=null&&_.hasOwnProperty("max")&&typeof _.max!="number"?"max: number expected":null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.HistogramDataPoint)return _;var N=new O.opentelemetry.proto.metrics.v1.HistogramDataPoint;if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: array expected");N.attributes=[];for(var I=0;I<_.attributes.length;++I){if(typeof _.attributes[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: object expected");N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[I])}}if(_.startTimeUnixNano!=null&&(P.Long?(N.startTimeUnixNano=P.Long.fromValue(_.startTimeUnixNano)).unsigned=!1:typeof _.startTimeUnixNano=="string"?N.startTimeUnixNano=parseInt(_.startTimeUnixNano,10):typeof _.startTimeUnixNano=="number"?N.startTimeUnixNano=_.startTimeUnixNano:typeof _.startTimeUnixNano=="object"&&(N.startTimeUnixNano=new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber())),_.timeUnixNano!=null&&(P.Long?(N.timeUnixNano=P.Long.fromValue(_.timeUnixNano)).unsigned=!1:typeof _.timeUnixNano=="string"?N.timeUnixNano=parseInt(_.timeUnixNano,10):typeof _.timeUnixNano=="number"?N.timeUnixNano=_.timeUnixNano:typeof _.timeUnixNano=="object"&&(N.timeUnixNano=new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber())),_.count!=null&&(P.Long?(N.count=P.Long.fromValue(_.count)).unsigned=!1:typeof _.count=="string"?N.count=parseInt(_.count,10):typeof _.count=="number"?N.count=_.count:typeof _.count=="object"&&(N.count=new P.LongBits(_.count.low>>>0,_.count.high>>>0).toNumber())),_.sum!=null&&(N.sum=Number(_.sum)),_.bucketCounts){if(!Array.isArray(_.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.bucketCounts: array expected");N.bucketCounts=[];for(var I=0;I<_.bucketCounts.length;++I)P.Long?(N.bucketCounts[I]=P.Long.fromValue(_.bucketCounts[I])).unsigned=!1:typeof _.bucketCounts[I]=="string"?N.bucketCounts[I]=parseInt(_.bucketCounts[I],10):typeof _.bucketCounts[I]=="number"?N.bucketCounts[I]=_.bucketCounts[I]:typeof _.bucketCounts[I]=="object"&&(N.bucketCounts[I]=new P.LongBits(_.bucketCounts[I].low>>>0,_.bucketCounts[I].high>>>0).toNumber())}if(_.explicitBounds){if(!Array.isArray(_.explicitBounds))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.explicitBounds: array expected");N.explicitBounds=[];for(var I=0;I<_.explicitBounds.length;++I)N.explicitBounds[I]=Number(_.explicitBounds[I])}if(_.exemplars){if(!Array.isArray(_.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: array expected");N.exemplars=[];for(var I=0;I<_.exemplars.length;++I){if(typeof _.exemplars[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: object expected");N.exemplars[I]=O.opentelemetry.proto.metrics.v1.Exemplar.fromObject(_.exemplars[I])}}return _.flags!=null&&(N.flags=_.flags>>>0),_.min!=null&&(N.min=Number(_.min)),_.max!=null&&(N.max=Number(_.max)),N},C.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.bucketCounts=[],I.explicitBounds=[],I.exemplars=[],I.attributes=[]),N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.startTimeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.startTimeUnixNano=N.longs===String?"0":0;if(P.Long){var x=new P.Long(0,0,!1);I.timeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.timeUnixNano=N.longs===String?"0":0;if(P.Long){var x=new P.Long(0,0,!1);I.count=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.count=N.longs===String?"0":0;I.flags=0}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&(typeof _.startTimeUnixNano=="number"?I.startTimeUnixNano=N.longs===String?String(_.startTimeUnixNano):_.startTimeUnixNano:I.startTimeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.startTimeUnixNano):N.longs===Number?new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber():_.startTimeUnixNano),_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&(typeof _.timeUnixNano=="number"?I.timeUnixNano=N.longs===String?String(_.timeUnixNano):_.timeUnixNano:I.timeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.timeUnixNano):N.longs===Number?new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano),_.count!=null&&_.hasOwnProperty("count")&&(typeof _.count=="number"?I.count=N.longs===String?String(_.count):_.count:I.count=N.longs===String?P.Long.prototype.toString.call(_.count):N.longs===Number?new P.LongBits(_.count.low>>>0,_.count.high>>>0).toNumber():_.count),_.sum!=null&&_.hasOwnProperty("sum")&&(I.sum=N.json&&!isFinite(_.sum)?String(_.sum):_.sum,N.oneofs&&(I._sum="sum")),_.bucketCounts&&_.bucketCounts.length){I.bucketCounts=[];for(var V=0;V<_.bucketCounts.length;++V)typeof _.bucketCounts[V]=="number"?I.bucketCounts[V]=N.longs===String?String(_.bucketCounts[V]):_.bucketCounts[V]:I.bucketCounts[V]=N.longs===String?P.Long.prototype.toString.call(_.bucketCounts[V]):N.longs===Number?new P.LongBits(_.bucketCounts[V].low>>>0,_.bucketCounts[V].high>>>0).toNumber():_.bucketCounts[V]}if(_.explicitBounds&&_.explicitBounds.length){I.explicitBounds=[];for(var V=0;V<_.explicitBounds.length;++V)I.explicitBounds[V]=N.json&&!isFinite(_.explicitBounds[V])?String(_.explicitBounds[V]):_.explicitBounds[V]}if(_.exemplars&&_.exemplars.length){I.exemplars=[];for(var V=0;V<_.exemplars.length;++V)I.exemplars[V]=O.opentelemetry.proto.metrics.v1.Exemplar.toObject(_.exemplars[V],N)}if(_.attributes&&_.attributes.length){I.attributes=[];for(var V=0;V<_.attributes.length;++V)I.attributes[V]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[V],N)}return _.flags!=null&&_.hasOwnProperty("flags")&&(I.flags=_.flags),_.min!=null&&_.hasOwnProperty("min")&&(I.min=N.json&&!isFinite(_.min)?String(_.min):_.min,N.oneofs&&(I._min="min")),_.max!=null&&_.hasOwnProperty("max")&&(I.max=N.json&&!isFinite(_.max)?String(_.max):_.max,N.oneofs&&(I._max="max")),I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.HistogramDataPoint"},C})(),U.ExponentialHistogramDataPoint=(function(){function C(y){if(this.attributes=[],this.exemplars=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.attributes=P.emptyArray,C.prototype.startTimeUnixNano=null,C.prototype.timeUnixNano=null,C.prototype.count=null,C.prototype.sum=null,C.prototype.scale=null,C.prototype.zeroCount=null,C.prototype.positive=null,C.prototype.negative=null,C.prototype.flags=null,C.prototype.exemplars=P.emptyArray,C.prototype.min=null,C.prototype.max=null,C.prototype.zeroThreshold=null;var L;return Object.defineProperty(C.prototype,"_sum",{get:P.oneOfGetter(L=["sum"]),set:P.oneOfSetter(L)}),Object.defineProperty(C.prototype,"_min",{get:P.oneOfGetter(L=["min"]),set:P.oneOfSetter(L)}),Object.defineProperty(C.prototype,"_max",{get:P.oneOfGetter(L=["max"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){if(N||(N=A.create()),_.attributes!=null&&_.attributes.length)for(var I=0;I<_.attributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[I],N.uint32(10).fork()).ldelim();if(_.startTimeUnixNano!=null&&Object.hasOwnProperty.call(_,"startTimeUnixNano")&&N.uint32(17).fixed64(_.startTimeUnixNano),_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano")&&N.uint32(25).fixed64(_.timeUnixNano),_.count!=null&&Object.hasOwnProperty.call(_,"count")&&N.uint32(33).fixed64(_.count),_.sum!=null&&Object.hasOwnProperty.call(_,"sum")&&N.uint32(41).double(_.sum),_.scale!=null&&Object.hasOwnProperty.call(_,"scale")&&N.uint32(48).sint32(_.scale),_.zeroCount!=null&&Object.hasOwnProperty.call(_,"zeroCount")&&N.uint32(57).fixed64(_.zeroCount),_.positive!=null&&Object.hasOwnProperty.call(_,"positive")&&O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(_.positive,N.uint32(66).fork()).ldelim(),_.negative!=null&&Object.hasOwnProperty.call(_,"negative")&&O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(_.negative,N.uint32(74).fork()).ldelim(),_.flags!=null&&Object.hasOwnProperty.call(_,"flags")&&N.uint32(80).uint32(_.flags),_.exemplars!=null&&_.exemplars.length)for(var I=0;I<_.exemplars.length;++I)O.opentelemetry.proto.metrics.v1.Exemplar.encode(_.exemplars[I],N.uint32(90).fork()).ldelim();return _.min!=null&&Object.hasOwnProperty.call(_,"min")&&N.uint32(97).double(_.min),_.max!=null&&Object.hasOwnProperty.call(_,"max")&&N.uint32(105).double(_.max),_.zeroThreshold!=null&&Object.hasOwnProperty.call(_,"zeroThreshold")&&N.uint32(113).double(_.zeroThreshold),N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.attributes&&x.attributes.length||(x.attributes=[]),x.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 2:{x.startTimeUnixNano=_.fixed64();break}case 3:{x.timeUnixNano=_.fixed64();break}case 4:{x.count=_.fixed64();break}case 5:{x.sum=_.double();break}case 6:{x.scale=_.sint32();break}case 7:{x.zeroCount=_.fixed64();break}case 8:{x.positive=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(_,_.uint32());break}case 9:{x.negative=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(_,_.uint32());break}case 10:{x.flags=_.uint32();break}case 11:{x.exemplars&&x.exemplars.length||(x.exemplars=[]),x.exemplars.push(O.opentelemetry.proto.metrics.v1.Exemplar.decode(_,_.uint32()));break}case 12:{x.min=_.double();break}case 13:{x.max=_.double();break}case 14:{x.zeroThreshold=_.double();break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var N=0;N<_.attributes.length;++N){var I=O.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[N]);if(I)return"attributes."+I}}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&!P.isInteger(_.startTimeUnixNano)&&!(_.startTimeUnixNano&&P.isInteger(_.startTimeUnixNano.low)&&P.isInteger(_.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&!P.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&P.isInteger(_.timeUnixNano.low)&&P.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(_.count!=null&&_.hasOwnProperty("count")&&!P.isInteger(_.count)&&!(_.count&&P.isInteger(_.count.low)&&P.isInteger(_.count.high)))return"count: integer|Long expected";if(_.sum!=null&&_.hasOwnProperty("sum")&&typeof _.sum!="number")return"sum: number expected";if(_.scale!=null&&_.hasOwnProperty("scale")&&!P.isInteger(_.scale))return"scale: integer expected";if(_.zeroCount!=null&&_.hasOwnProperty("zeroCount")&&!P.isInteger(_.zeroCount)&&!(_.zeroCount&&P.isInteger(_.zeroCount.low)&&P.isInteger(_.zeroCount.high)))return"zeroCount: integer|Long expected";if(_.positive!=null&&_.hasOwnProperty("positive")){var I=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(_.positive);if(I)return"positive."+I}if(_.negative!=null&&_.hasOwnProperty("negative")){var I=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(_.negative);if(I)return"negative."+I}if(_.flags!=null&&_.hasOwnProperty("flags")&&!P.isInteger(_.flags))return"flags: integer expected";if(_.exemplars!=null&&_.hasOwnProperty("exemplars")){if(!Array.isArray(_.exemplars))return"exemplars: array expected";for(var N=0;N<_.exemplars.length;++N){var I=O.opentelemetry.proto.metrics.v1.Exemplar.verify(_.exemplars[N]);if(I)return"exemplars."+I}}return _.min!=null&&_.hasOwnProperty("min")&&typeof _.min!="number"?"min: number expected":_.max!=null&&_.hasOwnProperty("max")&&typeof _.max!="number"?"max: number expected":_.zeroThreshold!=null&&_.hasOwnProperty("zeroThreshold")&&typeof _.zeroThreshold!="number"?"zeroThreshold: number expected":null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint)return _;var N=new O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: array expected");N.attributes=[];for(var I=0;I<_.attributes.length;++I){if(typeof _.attributes[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: object expected");N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[I])}}if(_.startTimeUnixNano!=null&&(P.Long?(N.startTimeUnixNano=P.Long.fromValue(_.startTimeUnixNano)).unsigned=!1:typeof _.startTimeUnixNano=="string"?N.startTimeUnixNano=parseInt(_.startTimeUnixNano,10):typeof _.startTimeUnixNano=="number"?N.startTimeUnixNano=_.startTimeUnixNano:typeof _.startTimeUnixNano=="object"&&(N.startTimeUnixNano=new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber())),_.timeUnixNano!=null&&(P.Long?(N.timeUnixNano=P.Long.fromValue(_.timeUnixNano)).unsigned=!1:typeof _.timeUnixNano=="string"?N.timeUnixNano=parseInt(_.timeUnixNano,10):typeof _.timeUnixNano=="number"?N.timeUnixNano=_.timeUnixNano:typeof _.timeUnixNano=="object"&&(N.timeUnixNano=new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber())),_.count!=null&&(P.Long?(N.count=P.Long.fromValue(_.count)).unsigned=!1:typeof _.count=="string"?N.count=parseInt(_.count,10):typeof _.count=="number"?N.count=_.count:typeof _.count=="object"&&(N.count=new P.LongBits(_.count.low>>>0,_.count.high>>>0).toNumber())),_.sum!=null&&(N.sum=Number(_.sum)),_.scale!=null&&(N.scale=_.scale|0),_.zeroCount!=null&&(P.Long?(N.zeroCount=P.Long.fromValue(_.zeroCount)).unsigned=!1:typeof _.zeroCount=="string"?N.zeroCount=parseInt(_.zeroCount,10):typeof _.zeroCount=="number"?N.zeroCount=_.zeroCount:typeof _.zeroCount=="object"&&(N.zeroCount=new P.LongBits(_.zeroCount.low>>>0,_.zeroCount.high>>>0).toNumber())),_.positive!=null){if(typeof _.positive!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive: object expected");N.positive=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(_.positive)}if(_.negative!=null){if(typeof _.negative!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative: object expected");N.negative=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(_.negative)}if(_.flags!=null&&(N.flags=_.flags>>>0),_.exemplars){if(!Array.isArray(_.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: array expected");N.exemplars=[];for(var I=0;I<_.exemplars.length;++I){if(typeof _.exemplars[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: object expected");N.exemplars[I]=O.opentelemetry.proto.metrics.v1.Exemplar.fromObject(_.exemplars[I])}}return _.min!=null&&(N.min=Number(_.min)),_.max!=null&&(N.max=Number(_.max)),_.zeroThreshold!=null&&(N.zeroThreshold=Number(_.zeroThreshold)),N},C.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.attributes=[],I.exemplars=[]),N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.startTimeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.startTimeUnixNano=N.longs===String?"0":0;if(P.Long){var x=new P.Long(0,0,!1);I.timeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.timeUnixNano=N.longs===String?"0":0;if(P.Long){var x=new P.Long(0,0,!1);I.count=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.count=N.longs===String?"0":0;if(I.scale=0,P.Long){var x=new P.Long(0,0,!1);I.zeroCount=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.zeroCount=N.longs===String?"0":0;I.positive=null,I.negative=null,I.flags=0,I.zeroThreshold=0}if(_.attributes&&_.attributes.length){I.attributes=[];for(var V=0;V<_.attributes.length;++V)I.attributes[V]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[V],N)}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&(typeof _.startTimeUnixNano=="number"?I.startTimeUnixNano=N.longs===String?String(_.startTimeUnixNano):_.startTimeUnixNano:I.startTimeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.startTimeUnixNano):N.longs===Number?new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber():_.startTimeUnixNano),_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&(typeof _.timeUnixNano=="number"?I.timeUnixNano=N.longs===String?String(_.timeUnixNano):_.timeUnixNano:I.timeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.timeUnixNano):N.longs===Number?new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano),_.count!=null&&_.hasOwnProperty("count")&&(typeof _.count=="number"?I.count=N.longs===String?String(_.count):_.count:I.count=N.longs===String?P.Long.prototype.toString.call(_.count):N.longs===Number?new P.LongBits(_.count.low>>>0,_.count.high>>>0).toNumber():_.count),_.sum!=null&&_.hasOwnProperty("sum")&&(I.sum=N.json&&!isFinite(_.sum)?String(_.sum):_.sum,N.oneofs&&(I._sum="sum")),_.scale!=null&&_.hasOwnProperty("scale")&&(I.scale=_.scale),_.zeroCount!=null&&_.hasOwnProperty("zeroCount")&&(typeof _.zeroCount=="number"?I.zeroCount=N.longs===String?String(_.zeroCount):_.zeroCount:I.zeroCount=N.longs===String?P.Long.prototype.toString.call(_.zeroCount):N.longs===Number?new P.LongBits(_.zeroCount.low>>>0,_.zeroCount.high>>>0).toNumber():_.zeroCount),_.positive!=null&&_.hasOwnProperty("positive")&&(I.positive=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(_.positive,N)),_.negative!=null&&_.hasOwnProperty("negative")&&(I.negative=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(_.negative,N)),_.flags!=null&&_.hasOwnProperty("flags")&&(I.flags=_.flags),_.exemplars&&_.exemplars.length){I.exemplars=[];for(var V=0;V<_.exemplars.length;++V)I.exemplars[V]=O.opentelemetry.proto.metrics.v1.Exemplar.toObject(_.exemplars[V],N)}return _.min!=null&&_.hasOwnProperty("min")&&(I.min=N.json&&!isFinite(_.min)?String(_.min):_.min,N.oneofs&&(I._min="min")),_.max!=null&&_.hasOwnProperty("max")&&(I.max=N.json&&!isFinite(_.max)?String(_.max):_.max,N.oneofs&&(I._max="max")),_.zeroThreshold!=null&&_.hasOwnProperty("zeroThreshold")&&(I.zeroThreshold=N.json&&!isFinite(_.zeroThreshold)?String(_.zeroThreshold):_.zeroThreshold),I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"},C.Buckets=(function(){function y(_){if(this.bucketCounts=[],_)for(var N=Object.keys(_),I=0;I<N.length;++I)_[N[I]]!=null&&(this[N[I]]=_[N[I]])}return y.prototype.offset=null,y.prototype.bucketCounts=P.emptyArray,y.create=function(N){return new y(N)},y.encode=function(N,I){if(I||(I=A.create()),N.offset!=null&&Object.hasOwnProperty.call(N,"offset")&&I.uint32(8).sint32(N.offset),N.bucketCounts!=null&&N.bucketCounts.length){I.uint32(18).fork();for(var x=0;x<N.bucketCounts.length;++x)I.uint64(N.bucketCounts[x]);I.ldelim()}return I},y.encodeDelimited=function(N,I){return this.encode(N,I).ldelim()},y.decode=function(N,I){N instanceof T||(N=T.create(N));for(var x=I===void 0?N.len:N.pos+I,V=new O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;N.pos<x;){var k=N.uint32();switch(k>>>3){case 1:{V.offset=N.sint32();break}case 2:{if(V.bucketCounts&&V.bucketCounts.length||(V.bucketCounts=[]),(k&7)===2)for(var F=N.uint32()+N.pos;N.pos<F;)V.bucketCounts.push(N.uint64());else V.bucketCounts.push(N.uint64());break}default:N.skipType(k&7);break}}return V},y.decodeDelimited=function(N){return N instanceof T||(N=new T(N)),this.decode(N,N.uint32())},y.verify=function(N){if(typeof N!="object"||N===null)return"object expected";if(N.offset!=null&&N.hasOwnProperty("offset")&&!P.isInteger(N.offset))return"offset: integer expected";if(N.bucketCounts!=null&&N.hasOwnProperty("bucketCounts")){if(!Array.isArray(N.bucketCounts))return"bucketCounts: array expected";for(var I=0;I<N.bucketCounts.length;++I)if(!P.isInteger(N.bucketCounts[I])&&!(N.bucketCounts[I]&&P.isInteger(N.bucketCounts[I].low)&&P.isInteger(N.bucketCounts[I].high)))return"bucketCounts: integer|Long[] expected"}return null},y.fromObject=function(N){if(N instanceof O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets)return N;var I=new O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;if(N.offset!=null&&(I.offset=N.offset|0),N.bucketCounts){if(!Array.isArray(N.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucketCounts: array expected");I.bucketCounts=[];for(var x=0;x<N.bucketCounts.length;++x)P.Long?(I.bucketCounts[x]=P.Long.fromValue(N.bucketCounts[x])).unsigned=!0:typeof N.bucketCounts[x]=="string"?I.bucketCounts[x]=parseInt(N.bucketCounts[x],10):typeof N.bucketCounts[x]=="number"?I.bucketCounts[x]=N.bucketCounts[x]:typeof N.bucketCounts[x]=="object"&&(I.bucketCounts[x]=new P.LongBits(N.bucketCounts[x].low>>>0,N.bucketCounts[x].high>>>0).toNumber(!0))}return I},y.toObject=function(N,I){I||(I={});var x={};if((I.arrays||I.defaults)&&(x.bucketCounts=[]),I.defaults&&(x.offset=0),N.offset!=null&&N.hasOwnProperty("offset")&&(x.offset=N.offset),N.bucketCounts&&N.bucketCounts.length){x.bucketCounts=[];for(var V=0;V<N.bucketCounts.length;++V)typeof N.bucketCounts[V]=="number"?x.bucketCounts[V]=I.longs===String?String(N.bucketCounts[V]):N.bucketCounts[V]:x.bucketCounts[V]=I.longs===String?P.Long.prototype.toString.call(N.bucketCounts[V]):I.longs===Number?new P.LongBits(N.bucketCounts[V].low>>>0,N.bucketCounts[V].high>>>0).toNumber(!0):N.bucketCounts[V]}return x},y.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},y.getTypeUrl=function(N){return N===void 0&&(N="type.googleapis.com"),N+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"},y})(),C})(),U.SummaryDataPoint=(function(){function C(L){if(this.attributes=[],this.quantileValues=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.attributes=P.emptyArray,C.prototype.startTimeUnixNano=null,C.prototype.timeUnixNano=null,C.prototype.count=null,C.prototype.sum=null,C.prototype.quantileValues=P.emptyArray,C.prototype.flags=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.startTimeUnixNano!=null&&Object.hasOwnProperty.call(y,"startTimeUnixNano")&&_.uint32(17).fixed64(y.startTimeUnixNano),y.timeUnixNano!=null&&Object.hasOwnProperty.call(y,"timeUnixNano")&&_.uint32(25).fixed64(y.timeUnixNano),y.count!=null&&Object.hasOwnProperty.call(y,"count")&&_.uint32(33).fixed64(y.count),y.sum!=null&&Object.hasOwnProperty.call(y,"sum")&&_.uint32(41).double(y.sum),y.quantileValues!=null&&y.quantileValues.length)for(var N=0;N<y.quantileValues.length;++N)O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.encode(y.quantileValues[N],_.uint32(50).fork()).ldelim();if(y.attributes!=null&&y.attributes.length)for(var N=0;N<y.attributes.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.attributes[N],_.uint32(58).fork()).ldelim();return y.flags!=null&&Object.hasOwnProperty.call(y,"flags")&&_.uint32(64).uint32(y.flags),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.SummaryDataPoint;y.pos<N;){var x=y.uint32();switch(x>>>3){case 7:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}case 2:{I.startTimeUnixNano=y.fixed64();break}case 3:{I.timeUnixNano=y.fixed64();break}case 4:{I.count=y.fixed64();break}case 5:{I.sum=y.double();break}case 6:{I.quantileValues&&I.quantileValues.length||(I.quantileValues=[]),I.quantileValues.push(O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(y,y.uint32()));break}case 8:{I.flags=y.uint32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.attributes!=null&&y.hasOwnProperty("attributes")){if(!Array.isArray(y.attributes))return"attributes: array expected";for(var _=0;_<y.attributes.length;++_){var N=O.opentelemetry.proto.common.v1.KeyValue.verify(y.attributes[_]);if(N)return"attributes."+N}}if(y.startTimeUnixNano!=null&&y.hasOwnProperty("startTimeUnixNano")&&!P.isInteger(y.startTimeUnixNano)&&!(y.startTimeUnixNano&&P.isInteger(y.startTimeUnixNano.low)&&P.isInteger(y.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(y.timeUnixNano!=null&&y.hasOwnProperty("timeUnixNano")&&!P.isInteger(y.timeUnixNano)&&!(y.timeUnixNano&&P.isInteger(y.timeUnixNano.low)&&P.isInteger(y.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(y.count!=null&&y.hasOwnProperty("count")&&!P.isInteger(y.count)&&!(y.count&&P.isInteger(y.count.low)&&P.isInteger(y.count.high)))return"count: integer|Long expected";if(y.sum!=null&&y.hasOwnProperty("sum")&&typeof y.sum!="number")return"sum: number expected";if(y.quantileValues!=null&&y.hasOwnProperty("quantileValues")){if(!Array.isArray(y.quantileValues))return"quantileValues: array expected";for(var _=0;_<y.quantileValues.length;++_){var N=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(y.quantileValues[_]);if(N)return"quantileValues."+N}}return y.flags!=null&&y.hasOwnProperty("flags")&&!P.isInteger(y.flags)?"flags: integer expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.SummaryDataPoint)return y;var _=new O.opentelemetry.proto.metrics.v1.SummaryDataPoint;if(y.attributes){if(!Array.isArray(y.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: array expected");_.attributes=[];for(var N=0;N<y.attributes.length;++N){if(typeof y.attributes[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: object expected");_.attributes[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.attributes[N])}}if(y.startTimeUnixNano!=null&&(P.Long?(_.startTimeUnixNano=P.Long.fromValue(y.startTimeUnixNano)).unsigned=!1:typeof y.startTimeUnixNano=="string"?_.startTimeUnixNano=parseInt(y.startTimeUnixNano,10):typeof y.startTimeUnixNano=="number"?_.startTimeUnixNano=y.startTimeUnixNano:typeof y.startTimeUnixNano=="object"&&(_.startTimeUnixNano=new P.LongBits(y.startTimeUnixNano.low>>>0,y.startTimeUnixNano.high>>>0).toNumber())),y.timeUnixNano!=null&&(P.Long?(_.timeUnixNano=P.Long.fromValue(y.timeUnixNano)).unsigned=!1:typeof y.timeUnixNano=="string"?_.timeUnixNano=parseInt(y.timeUnixNano,10):typeof y.timeUnixNano=="number"?_.timeUnixNano=y.timeUnixNano:typeof y.timeUnixNano=="object"&&(_.timeUnixNano=new P.LongBits(y.timeUnixNano.low>>>0,y.timeUnixNano.high>>>0).toNumber())),y.count!=null&&(P.Long?(_.count=P.Long.fromValue(y.count)).unsigned=!1:typeof y.count=="string"?_.count=parseInt(y.count,10):typeof y.count=="number"?_.count=y.count:typeof y.count=="object"&&(_.count=new P.LongBits(y.count.low>>>0,y.count.high>>>0).toNumber())),y.sum!=null&&(_.sum=Number(y.sum)),y.quantileValues){if(!Array.isArray(y.quantileValues))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: array expected");_.quantileValues=[];for(var N=0;N<y.quantileValues.length;++N){if(typeof y.quantileValues[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: object expected");_.quantileValues[N]=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(y.quantileValues[N])}}return y.flags!=null&&(_.flags=y.flags>>>0),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.quantileValues=[],N.attributes=[]),_.defaults){if(P.Long){var I=new P.Long(0,0,!1);N.startTimeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.startTimeUnixNano=_.longs===String?"0":0;if(P.Long){var I=new P.Long(0,0,!1);N.timeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.timeUnixNano=_.longs===String?"0":0;if(P.Long){var I=new P.Long(0,0,!1);N.count=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.count=_.longs===String?"0":0;N.sum=0,N.flags=0}if(y.startTimeUnixNano!=null&&y.hasOwnProperty("startTimeUnixNano")&&(typeof y.startTimeUnixNano=="number"?N.startTimeUnixNano=_.longs===String?String(y.startTimeUnixNano):y.startTimeUnixNano:N.startTimeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.startTimeUnixNano):_.longs===Number?new P.LongBits(y.startTimeUnixNano.low>>>0,y.startTimeUnixNano.high>>>0).toNumber():y.startTimeUnixNano),y.timeUnixNano!=null&&y.hasOwnProperty("timeUnixNano")&&(typeof y.timeUnixNano=="number"?N.timeUnixNano=_.longs===String?String(y.timeUnixNano):y.timeUnixNano:N.timeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.timeUnixNano):_.longs===Number?new P.LongBits(y.timeUnixNano.low>>>0,y.timeUnixNano.high>>>0).toNumber():y.timeUnixNano),y.count!=null&&y.hasOwnProperty("count")&&(typeof y.count=="number"?N.count=_.longs===String?String(y.count):y.count:N.count=_.longs===String?P.Long.prototype.toString.call(y.count):_.longs===Number?new P.LongBits(y.count.low>>>0,y.count.high>>>0).toNumber():y.count),y.sum!=null&&y.hasOwnProperty("sum")&&(N.sum=_.json&&!isFinite(y.sum)?String(y.sum):y.sum),y.quantileValues&&y.quantileValues.length){N.quantileValues=[];for(var x=0;x<y.quantileValues.length;++x)N.quantileValues[x]=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.toObject(y.quantileValues[x],_)}if(y.attributes&&y.attributes.length){N.attributes=[];for(var x=0;x<y.attributes.length;++x)N.attributes[x]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.attributes[x],_)}return y.flags!=null&&y.hasOwnProperty("flags")&&(N.flags=y.flags),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.SummaryDataPoint"},C.ValueAtQuantile=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.quantile=null,L.prototype.value=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.quantile!=null&&Object.hasOwnProperty.call(_,"quantile")&&N.uint32(9).double(_.quantile),_.value!=null&&Object.hasOwnProperty.call(_,"value")&&N.uint32(17).double(_.value),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.quantile=_.double();break}case 2:{x.value=_.double();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){return typeof _!="object"||_===null?"object expected":_.quantile!=null&&_.hasOwnProperty("quantile")&&typeof _.quantile!="number"?"quantile: number expected":_.value!=null&&_.hasOwnProperty("value")&&typeof _.value!="number"?"value: number expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile)return _;var N=new O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;return _.quantile!=null&&(N.quantile=Number(_.quantile)),_.value!=null&&(N.value=Number(_.value)),N},L.toObject=function(_,N){N||(N={});var I={};return N.defaults&&(I.quantile=0,I.value=0),_.quantile!=null&&_.hasOwnProperty("quantile")&&(I.quantile=N.json&&!isFinite(_.quantile)?String(_.quantile):_.quantile),_.value!=null&&_.hasOwnProperty("value")&&(I.value=N.json&&!isFinite(_.value)?String(_.value):_.value),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"},L})(),C})(),U.Exemplar=(function(){function C(y){if(this.filteredAttributes=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.filteredAttributes=P.emptyArray,C.prototype.timeUnixNano=null,C.prototype.asDouble=null,C.prototype.asInt=null,C.prototype.spanId=null,C.prototype.traceId=null;var L;return Object.defineProperty(C.prototype,"value",{get:P.oneOfGetter(L=["asDouble","asInt"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){if(N||(N=A.create()),_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano")&&N.uint32(17).fixed64(_.timeUnixNano),_.asDouble!=null&&Object.hasOwnProperty.call(_,"asDouble")&&N.uint32(25).double(_.asDouble),_.spanId!=null&&Object.hasOwnProperty.call(_,"spanId")&&N.uint32(34).bytes(_.spanId),_.traceId!=null&&Object.hasOwnProperty.call(_,"traceId")&&N.uint32(42).bytes(_.traceId),_.asInt!=null&&Object.hasOwnProperty.call(_,"asInt")&&N.uint32(49).sfixed64(_.asInt),_.filteredAttributes!=null&&_.filteredAttributes.length)for(var I=0;I<_.filteredAttributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.filteredAttributes[I],N.uint32(58).fork()).ldelim();return N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.Exemplar;_.pos<I;){var V=_.uint32();switch(V>>>3){case 7:{x.filteredAttributes&&x.filteredAttributes.length||(x.filteredAttributes=[]),x.filteredAttributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 2:{x.timeUnixNano=_.fixed64();break}case 3:{x.asDouble=_.double();break}case 6:{x.asInt=_.sfixed64();break}case 4:{x.spanId=_.bytes();break}case 5:{x.traceId=_.bytes();break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";var N={};if(_.filteredAttributes!=null&&_.hasOwnProperty("filteredAttributes")){if(!Array.isArray(_.filteredAttributes))return"filteredAttributes: array expected";for(var I=0;I<_.filteredAttributes.length;++I){var x=O.opentelemetry.proto.common.v1.KeyValue.verify(_.filteredAttributes[I]);if(x)return"filteredAttributes."+x}}if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&!P.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&P.isInteger(_.timeUnixNano.low)&&P.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(_.asDouble!=null&&_.hasOwnProperty("asDouble")&&(N.value=1,typeof _.asDouble!="number"))return"asDouble: number expected";if(_.asInt!=null&&_.hasOwnProperty("asInt")){if(N.value===1)return"value: multiple values";if(N.value=1,!P.isInteger(_.asInt)&&!(_.asInt&&P.isInteger(_.asInt.low)&&P.isInteger(_.asInt.high)))return"asInt: integer|Long expected"}return _.spanId!=null&&_.hasOwnProperty("spanId")&&!(_.spanId&&typeof _.spanId.length=="number"||P.isString(_.spanId))?"spanId: buffer expected":_.traceId!=null&&_.hasOwnProperty("traceId")&&!(_.traceId&&typeof _.traceId.length=="number"||P.isString(_.traceId))?"traceId: buffer expected":null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.Exemplar)return _;var N=new O.opentelemetry.proto.metrics.v1.Exemplar;if(_.filteredAttributes){if(!Array.isArray(_.filteredAttributes))throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: array expected");N.filteredAttributes=[];for(var I=0;I<_.filteredAttributes.length;++I){if(typeof _.filteredAttributes[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: object expected");N.filteredAttributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.filteredAttributes[I])}}return _.timeUnixNano!=null&&(P.Long?(N.timeUnixNano=P.Long.fromValue(_.timeUnixNano)).unsigned=!1:typeof _.timeUnixNano=="string"?N.timeUnixNano=parseInt(_.timeUnixNano,10):typeof _.timeUnixNano=="number"?N.timeUnixNano=_.timeUnixNano:typeof _.timeUnixNano=="object"&&(N.timeUnixNano=new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber())),_.asDouble!=null&&(N.asDouble=Number(_.asDouble)),_.asInt!=null&&(P.Long?(N.asInt=P.Long.fromValue(_.asInt)).unsigned=!1:typeof _.asInt=="string"?N.asInt=parseInt(_.asInt,10):typeof _.asInt=="number"?N.asInt=_.asInt:typeof _.asInt=="object"&&(N.asInt=new P.LongBits(_.asInt.low>>>0,_.asInt.high>>>0).toNumber())),_.spanId!=null&&(typeof _.spanId=="string"?P.base64.decode(_.spanId,N.spanId=P.newBuffer(P.base64.length(_.spanId)),0):_.spanId.length>=0&&(N.spanId=_.spanId)),_.traceId!=null&&(typeof _.traceId=="string"?P.base64.decode(_.traceId,N.traceId=P.newBuffer(P.base64.length(_.traceId)),0):_.traceId.length>=0&&(N.traceId=_.traceId)),N},C.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.filteredAttributes=[]),N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.timeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.timeUnixNano=N.longs===String?"0":0;N.bytes===String?I.spanId="":(I.spanId=[],N.bytes!==Array&&(I.spanId=P.newBuffer(I.spanId))),N.bytes===String?I.traceId="":(I.traceId=[],N.bytes!==Array&&(I.traceId=P.newBuffer(I.traceId)))}if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&(typeof _.timeUnixNano=="number"?I.timeUnixNano=N.longs===String?String(_.timeUnixNano):_.timeUnixNano:I.timeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.timeUnixNano):N.longs===Number?new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano),_.asDouble!=null&&_.hasOwnProperty("asDouble")&&(I.asDouble=N.json&&!isFinite(_.asDouble)?String(_.asDouble):_.asDouble,N.oneofs&&(I.value="asDouble")),_.spanId!=null&&_.hasOwnProperty("spanId")&&(I.spanId=N.bytes===String?P.base64.encode(_.spanId,0,_.spanId.length):N.bytes===Array?Array.prototype.slice.call(_.spanId):_.spanId),_.traceId!=null&&_.hasOwnProperty("traceId")&&(I.traceId=N.bytes===String?P.base64.encode(_.traceId,0,_.traceId.length):N.bytes===Array?Array.prototype.slice.call(_.traceId):_.traceId),_.asInt!=null&&_.hasOwnProperty("asInt")&&(typeof _.asInt=="number"?I.asInt=N.longs===String?String(_.asInt):_.asInt:I.asInt=N.longs===String?P.Long.prototype.toString.call(_.asInt):N.longs===Number?new P.LongBits(_.asInt.low>>>0,_.asInt.high>>>0).toNumber():_.asInt,N.oneofs&&(I.value="asInt")),_.filteredAttributes&&_.filteredAttributes.length){I.filteredAttributes=[];for(var V=0;V<_.filteredAttributes.length;++V)I.filteredAttributes[V]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.filteredAttributes[V],N)}return I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.Exemplar"},C})(),U})(),D})(),M.logs=(function(){var D={};return D.v1=(function(){var U={};return U.LogsData=(function(){function C(L){if(this.resourceLogs=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resourceLogs=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resourceLogs!=null&&y.resourceLogs.length)for(var N=0;N<y.resourceLogs.length;++N)O.opentelemetry.proto.logs.v1.ResourceLogs.encode(y.resourceLogs[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.logs.v1.LogsData;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resourceLogs&&I.resourceLogs.length||(I.resourceLogs=[]),I.resourceLogs.push(O.opentelemetry.proto.logs.v1.ResourceLogs.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resourceLogs!=null&&y.hasOwnProperty("resourceLogs")){if(!Array.isArray(y.resourceLogs))return"resourceLogs: array expected";for(var _=0;_<y.resourceLogs.length;++_){var N=O.opentelemetry.proto.logs.v1.ResourceLogs.verify(y.resourceLogs[_]);if(N)return"resourceLogs."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.logs.v1.LogsData)return y;var _=new O.opentelemetry.proto.logs.v1.LogsData;if(y.resourceLogs){if(!Array.isArray(y.resourceLogs))throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: array expected");_.resourceLogs=[];for(var N=0;N<y.resourceLogs.length;++N){if(typeof y.resourceLogs[N]!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: object expected");_.resourceLogs[N]=O.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(y.resourceLogs[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.resourceLogs=[]),y.resourceLogs&&y.resourceLogs.length){N.resourceLogs=[];for(var I=0;I<y.resourceLogs.length;++I)N.resourceLogs[I]=O.opentelemetry.proto.logs.v1.ResourceLogs.toObject(y.resourceLogs[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.logs.v1.LogsData"},C})(),U.ResourceLogs=(function(){function C(L){if(this.scopeLogs=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resource=null,C.prototype.scopeLogs=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resource!=null&&Object.hasOwnProperty.call(y,"resource")&&O.opentelemetry.proto.resource.v1.Resource.encode(y.resource,_.uint32(10).fork()).ldelim(),y.scopeLogs!=null&&y.scopeLogs.length)for(var N=0;N<y.scopeLogs.length;++N)O.opentelemetry.proto.logs.v1.ScopeLogs.encode(y.scopeLogs[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.logs.v1.ResourceLogs;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resource=O.opentelemetry.proto.resource.v1.Resource.decode(y,y.uint32());break}case 2:{I.scopeLogs&&I.scopeLogs.length||(I.scopeLogs=[]),I.scopeLogs.push(O.opentelemetry.proto.logs.v1.ScopeLogs.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resource!=null&&y.hasOwnProperty("resource")){var _=O.opentelemetry.proto.resource.v1.Resource.verify(y.resource);if(_)return"resource."+_}if(y.scopeLogs!=null&&y.hasOwnProperty("scopeLogs")){if(!Array.isArray(y.scopeLogs))return"scopeLogs: array expected";for(var N=0;N<y.scopeLogs.length;++N){var _=O.opentelemetry.proto.logs.v1.ScopeLogs.verify(y.scopeLogs[N]);if(_)return"scopeLogs."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.logs.v1.ResourceLogs)return y;var _=new O.opentelemetry.proto.logs.v1.ResourceLogs;if(y.resource!=null){if(typeof y.resource!="object")throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.resource: object expected");_.resource=O.opentelemetry.proto.resource.v1.Resource.fromObject(y.resource)}if(y.scopeLogs){if(!Array.isArray(y.scopeLogs))throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: array expected");_.scopeLogs=[];for(var N=0;N<y.scopeLogs.length;++N){if(typeof y.scopeLogs[N]!="object")throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: object expected");_.scopeLogs[N]=O.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(y.scopeLogs[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.scopeLogs=[]),_.defaults&&(N.resource=null,N.schemaUrl=""),y.resource!=null&&y.hasOwnProperty("resource")&&(N.resource=O.opentelemetry.proto.resource.v1.Resource.toObject(y.resource,_)),y.scopeLogs&&y.scopeLogs.length){N.scopeLogs=[];for(var I=0;I<y.scopeLogs.length;++I)N.scopeLogs[I]=O.opentelemetry.proto.logs.v1.ScopeLogs.toObject(y.scopeLogs[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.logs.v1.ResourceLogs"},C})(),U.ScopeLogs=(function(){function C(L){if(this.logRecords=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.scope=null,C.prototype.logRecords=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.scope!=null&&Object.hasOwnProperty.call(y,"scope")&&O.opentelemetry.proto.common.v1.InstrumentationScope.encode(y.scope,_.uint32(10).fork()).ldelim(),y.logRecords!=null&&y.logRecords.length)for(var N=0;N<y.logRecords.length;++N)O.opentelemetry.proto.logs.v1.LogRecord.encode(y.logRecords[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.logs.v1.ScopeLogs;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.decode(y,y.uint32());break}case 2:{I.logRecords&&I.logRecords.length||(I.logRecords=[]),I.logRecords.push(O.opentelemetry.proto.logs.v1.LogRecord.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.scope!=null&&y.hasOwnProperty("scope")){var _=O.opentelemetry.proto.common.v1.InstrumentationScope.verify(y.scope);if(_)return"scope."+_}if(y.logRecords!=null&&y.hasOwnProperty("logRecords")){if(!Array.isArray(y.logRecords))return"logRecords: array expected";for(var N=0;N<y.logRecords.length;++N){var _=O.opentelemetry.proto.logs.v1.LogRecord.verify(y.logRecords[N]);if(_)return"logRecords."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.logs.v1.ScopeLogs)return y;var _=new O.opentelemetry.proto.logs.v1.ScopeLogs;if(y.scope!=null){if(typeof y.scope!="object")throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.scope: object expected");_.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(y.scope)}if(y.logRecords){if(!Array.isArray(y.logRecords))throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: array expected");_.logRecords=[];for(var N=0;N<y.logRecords.length;++N){if(typeof y.logRecords[N]!="object")throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: object expected");_.logRecords[N]=O.opentelemetry.proto.logs.v1.LogRecord.fromObject(y.logRecords[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.logRecords=[]),_.defaults&&(N.scope=null,N.schemaUrl=""),y.scope!=null&&y.hasOwnProperty("scope")&&(N.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.toObject(y.scope,_)),y.logRecords&&y.logRecords.length){N.logRecords=[];for(var I=0;I<y.logRecords.length;++I)N.logRecords[I]=O.opentelemetry.proto.logs.v1.LogRecord.toObject(y.logRecords[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.logs.v1.ScopeLogs"},C})(),U.SeverityNumber=(function(){var C={},L=Object.create(C);return L[C[0]="SEVERITY_NUMBER_UNSPECIFIED"]=0,L[C[1]="SEVERITY_NUMBER_TRACE"]=1,L[C[2]="SEVERITY_NUMBER_TRACE2"]=2,L[C[3]="SEVERITY_NUMBER_TRACE3"]=3,L[C[4]="SEVERITY_NUMBER_TRACE4"]=4,L[C[5]="SEVERITY_NUMBER_DEBUG"]=5,L[C[6]="SEVERITY_NUMBER_DEBUG2"]=6,L[C[7]="SEVERITY_NUMBER_DEBUG3"]=7,L[C[8]="SEVERITY_NUMBER_DEBUG4"]=8,L[C[9]="SEVERITY_NUMBER_INFO"]=9,L[C[10]="SEVERITY_NUMBER_INFO2"]=10,L[C[11]="SEVERITY_NUMBER_INFO3"]=11,L[C[12]="SEVERITY_NUMBER_INFO4"]=12,L[C[13]="SEVERITY_NUMBER_WARN"]=13,L[C[14]="SEVERITY_NUMBER_WARN2"]=14,L[C[15]="SEVERITY_NUMBER_WARN3"]=15,L[C[16]="SEVERITY_NUMBER_WARN4"]=16,L[C[17]="SEVERITY_NUMBER_ERROR"]=17,L[C[18]="SEVERITY_NUMBER_ERROR2"]=18,L[C[19]="SEVERITY_NUMBER_ERROR3"]=19,L[C[20]="SEVERITY_NUMBER_ERROR4"]=20,L[C[21]="SEVERITY_NUMBER_FATAL"]=21,L[C[22]="SEVERITY_NUMBER_FATAL2"]=22,L[C[23]="SEVERITY_NUMBER_FATAL3"]=23,L[C[24]="SEVERITY_NUMBER_FATAL4"]=24,L})(),U.LogRecordFlags=(function(){var C={},L=Object.create(C);return L[C[0]="LOG_RECORD_FLAGS_DO_NOT_USE"]=0,L[C[255]="LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"]=255,L})(),U.LogRecord=(function(){function C(L){if(this.attributes=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.timeUnixNano=null,C.prototype.observedTimeUnixNano=null,C.prototype.severityNumber=null,C.prototype.severityText=null,C.prototype.body=null,C.prototype.attributes=P.emptyArray,C.prototype.droppedAttributesCount=null,C.prototype.flags=null,C.prototype.traceId=null,C.prototype.spanId=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.timeUnixNano!=null&&Object.hasOwnProperty.call(y,"timeUnixNano")&&_.uint32(9).fixed64(y.timeUnixNano),y.severityNumber!=null&&Object.hasOwnProperty.call(y,"severityNumber")&&_.uint32(16).int32(y.severityNumber),y.severityText!=null&&Object.hasOwnProperty.call(y,"severityText")&&_.uint32(26).string(y.severityText),y.body!=null&&Object.hasOwnProperty.call(y,"body")&&O.opentelemetry.proto.common.v1.AnyValue.encode(y.body,_.uint32(42).fork()).ldelim(),y.attributes!=null&&y.attributes.length)for(var N=0;N<y.attributes.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.attributes[N],_.uint32(50).fork()).ldelim();return y.droppedAttributesCount!=null&&Object.hasOwnProperty.call(y,"droppedAttributesCount")&&_.uint32(56).uint32(y.droppedAttributesCount),y.flags!=null&&Object.hasOwnProperty.call(y,"flags")&&_.uint32(69).fixed32(y.flags),y.traceId!=null&&Object.hasOwnProperty.call(y,"traceId")&&_.uint32(74).bytes(y.traceId),y.spanId!=null&&Object.hasOwnProperty.call(y,"spanId")&&_.uint32(82).bytes(y.spanId),y.observedTimeUnixNano!=null&&Object.hasOwnProperty.call(y,"observedTimeUnixNano")&&_.uint32(89).fixed64(y.observedTimeUnixNano),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.logs.v1.LogRecord;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.timeUnixNano=y.fixed64();break}case 11:{I.observedTimeUnixNano=y.fixed64();break}case 2:{I.severityNumber=y.int32();break}case 3:{I.severityText=y.string();break}case 5:{I.body=O.opentelemetry.proto.common.v1.AnyValue.decode(y,y.uint32());break}case 6:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}case 7:{I.droppedAttributesCount=y.uint32();break}case 8:{I.flags=y.fixed32();break}case 9:{I.traceId=y.bytes();break}case 10:{I.spanId=y.bytes();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.timeUnixNano!=null&&y.hasOwnProperty("timeUnixNano")&&!P.isInteger(y.timeUnixNano)&&!(y.timeUnixNano&&P.isInteger(y.timeUnixNano.low)&&P.isInteger(y.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(y.observedTimeUnixNano!=null&&y.hasOwnProperty("observedTimeUnixNano")&&!P.isInteger(y.observedTimeUnixNano)&&!(y.observedTimeUnixNano&&P.isInteger(y.observedTimeUnixNano.low)&&P.isInteger(y.observedTimeUnixNano.high)))return"observedTimeUnixNano: integer|Long expected";if(y.severityNumber!=null&&y.hasOwnProperty("severityNumber"))switch(y.severityNumber){default:return"severityNumber: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:break}if(y.severityText!=null&&y.hasOwnProperty("severityText")&&!P.isString(y.severityText))return"severityText: string expected";if(y.body!=null&&y.hasOwnProperty("body")){var _=O.opentelemetry.proto.common.v1.AnyValue.verify(y.body);if(_)return"body."+_}if(y.attributes!=null&&y.hasOwnProperty("attributes")){if(!Array.isArray(y.attributes))return"attributes: array expected";for(var N=0;N<y.attributes.length;++N){var _=O.opentelemetry.proto.common.v1.KeyValue.verify(y.attributes[N]);if(_)return"attributes."+_}}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(y.droppedAttributesCount)?"droppedAttributesCount: integer expected":y.flags!=null&&y.hasOwnProperty("flags")&&!P.isInteger(y.flags)?"flags: integer expected":y.traceId!=null&&y.hasOwnProperty("traceId")&&!(y.traceId&&typeof y.traceId.length=="number"||P.isString(y.traceId))?"traceId: buffer expected":y.spanId!=null&&y.hasOwnProperty("spanId")&&!(y.spanId&&typeof y.spanId.length=="number"||P.isString(y.spanId))?"spanId: buffer expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.logs.v1.LogRecord)return y;var _=new O.opentelemetry.proto.logs.v1.LogRecord;switch(y.timeUnixNano!=null&&(P.Long?(_.timeUnixNano=P.Long.fromValue(y.timeUnixNano)).unsigned=!1:typeof y.timeUnixNano=="string"?_.timeUnixNano=parseInt(y.timeUnixNano,10):typeof y.timeUnixNano=="number"?_.timeUnixNano=y.timeUnixNano:typeof y.timeUnixNano=="object"&&(_.timeUnixNano=new P.LongBits(y.timeUnixNano.low>>>0,y.timeUnixNano.high>>>0).toNumber())),y.observedTimeUnixNano!=null&&(P.Long?(_.observedTimeUnixNano=P.Long.fromValue(y.observedTimeUnixNano)).unsigned=!1:typeof y.observedTimeUnixNano=="string"?_.observedTimeUnixNano=parseInt(y.observedTimeUnixNano,10):typeof y.observedTimeUnixNano=="number"?_.observedTimeUnixNano=y.observedTimeUnixNano:typeof y.observedTimeUnixNano=="object"&&(_.observedTimeUnixNano=new P.LongBits(y.observedTimeUnixNano.low>>>0,y.observedTimeUnixNano.high>>>0).toNumber())),y.severityNumber){default:if(typeof y.severityNumber=="number"){_.severityNumber=y.severityNumber;break}break;case"SEVERITY_NUMBER_UNSPECIFIED":case 0:_.severityNumber=0;break;case"SEVERITY_NUMBER_TRACE":case 1:_.severityNumber=1;break;case"SEVERITY_NUMBER_TRACE2":case 2:_.severityNumber=2;break;case"SEVERITY_NUMBER_TRACE3":case 3:_.severityNumber=3;break;case"SEVERITY_NUMBER_TRACE4":case 4:_.severityNumber=4;break;case"SEVERITY_NUMBER_DEBUG":case 5:_.severityNumber=5;break;case"SEVERITY_NUMBER_DEBUG2":case 6:_.severityNumber=6;break;case"SEVERITY_NUMBER_DEBUG3":case 7:_.severityNumber=7;break;case"SEVERITY_NUMBER_DEBUG4":case 8:_.severityNumber=8;break;case"SEVERITY_NUMBER_INFO":case 9:_.severityNumber=9;break;case"SEVERITY_NUMBER_INFO2":case 10:_.severityNumber=10;break;case"SEVERITY_NUMBER_INFO3":case 11:_.severityNumber=11;break;case"SEVERITY_NUMBER_INFO4":case 12:_.severityNumber=12;break;case"SEVERITY_NUMBER_WARN":case 13:_.severityNumber=13;break;case"SEVERITY_NUMBER_WARN2":case 14:_.severityNumber=14;break;case"SEVERITY_NUMBER_WARN3":case 15:_.severityNumber=15;break;case"SEVERITY_NUMBER_WARN4":case 16:_.severityNumber=16;break;case"SEVERITY_NUMBER_ERROR":case 17:_.severityNumber=17;break;case"SEVERITY_NUMBER_ERROR2":case 18:_.severityNumber=18;break;case"SEVERITY_NUMBER_ERROR3":case 19:_.severityNumber=19;break;case"SEVERITY_NUMBER_ERROR4":case 20:_.severityNumber=20;break;case"SEVERITY_NUMBER_FATAL":case 21:_.severityNumber=21;break;case"SEVERITY_NUMBER_FATAL2":case 22:_.severityNumber=22;break;case"SEVERITY_NUMBER_FATAL3":case 23:_.severityNumber=23;break;case"SEVERITY_NUMBER_FATAL4":case 24:_.severityNumber=24;break}if(y.severityText!=null&&(_.severityText=String(y.severityText)),y.body!=null){if(typeof y.body!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.body: object expected");_.body=O.opentelemetry.proto.common.v1.AnyValue.fromObject(y.body)}if(y.attributes){if(!Array.isArray(y.attributes))throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: array expected");_.attributes=[];for(var N=0;N<y.attributes.length;++N){if(typeof y.attributes[N]!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: object expected");_.attributes[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.attributes[N])}}return y.droppedAttributesCount!=null&&(_.droppedAttributesCount=y.droppedAttributesCount>>>0),y.flags!=null&&(_.flags=y.flags>>>0),y.traceId!=null&&(typeof y.traceId=="string"?P.base64.decode(y.traceId,_.traceId=P.newBuffer(P.base64.length(y.traceId)),0):y.traceId.length>=0&&(_.traceId=y.traceId)),y.spanId!=null&&(typeof y.spanId=="string"?P.base64.decode(y.spanId,_.spanId=P.newBuffer(P.base64.length(y.spanId)),0):y.spanId.length>=0&&(_.spanId=y.spanId)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.attributes=[]),_.defaults){if(P.Long){var I=new P.Long(0,0,!1);N.timeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.timeUnixNano=_.longs===String?"0":0;if(N.severityNumber=_.enums===String?"SEVERITY_NUMBER_UNSPECIFIED":0,N.severityText="",N.body=null,N.droppedAttributesCount=0,N.flags=0,_.bytes===String?N.traceId="":(N.traceId=[],_.bytes!==Array&&(N.traceId=P.newBuffer(N.traceId))),_.bytes===String?N.spanId="":(N.spanId=[],_.bytes!==Array&&(N.spanId=P.newBuffer(N.spanId))),P.Long){var I=new P.Long(0,0,!1);N.observedTimeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.observedTimeUnixNano=_.longs===String?"0":0}if(y.timeUnixNano!=null&&y.hasOwnProperty("timeUnixNano")&&(typeof y.timeUnixNano=="number"?N.timeUnixNano=_.longs===String?String(y.timeUnixNano):y.timeUnixNano:N.timeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.timeUnixNano):_.longs===Number?new P.LongBits(y.timeUnixNano.low>>>0,y.timeUnixNano.high>>>0).toNumber():y.timeUnixNano),y.severityNumber!=null&&y.hasOwnProperty("severityNumber")&&(N.severityNumber=_.enums===String?O.opentelemetry.proto.logs.v1.SeverityNumber[y.severityNumber]===void 0?y.severityNumber:O.opentelemetry.proto.logs.v1.SeverityNumber[y.severityNumber]:y.severityNumber),y.severityText!=null&&y.hasOwnProperty("severityText")&&(N.severityText=y.severityText),y.body!=null&&y.hasOwnProperty("body")&&(N.body=O.opentelemetry.proto.common.v1.AnyValue.toObject(y.body,_)),y.attributes&&y.attributes.length){N.attributes=[];for(var x=0;x<y.attributes.length;++x)N.attributes[x]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.attributes[x],_)}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&(N.droppedAttributesCount=y.droppedAttributesCount),y.flags!=null&&y.hasOwnProperty("flags")&&(N.flags=y.flags),y.traceId!=null&&y.hasOwnProperty("traceId")&&(N.traceId=_.bytes===String?P.base64.encode(y.traceId,0,y.traceId.length):_.bytes===Array?Array.prototype.slice.call(y.traceId):y.traceId),y.spanId!=null&&y.hasOwnProperty("spanId")&&(N.spanId=_.bytes===String?P.base64.encode(y.spanId,0,y.spanId.length):_.bytes===Array?Array.prototype.slice.call(y.spanId):y.spanId),y.observedTimeUnixNano!=null&&y.hasOwnProperty("observedTimeUnixNano")&&(typeof y.observedTimeUnixNano=="number"?N.observedTimeUnixNano=_.longs===String?String(y.observedTimeUnixNano):y.observedTimeUnixNano:N.observedTimeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.observedTimeUnixNano):_.longs===Number?new P.LongBits(y.observedTimeUnixNano.low>>>0,y.observedTimeUnixNano.high>>>0).toNumber():y.observedTimeUnixNano),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.logs.v1.LogRecord"},C})(),U})(),D})(),M})(),R})(),root=O,root}var rootExports=requireRoot();function hrTimeToNanos(S){var T=BigInt(1e9);return BigInt(S[0])*T+BigInt(S[1])}function toLongBits(S){var T=Number(BigInt.asUintN(32,S)),A=Number(BigInt.asUintN(32,S>>BigInt(32)));return{low:T,high:A}}function encodeAsLongBits(S){var T=hrTimeToNanos(S);return toLongBits(T)}function optionalHexToBinary(S){if(S!==void 0)return hexToBinary(S)}var DEFAULT_ENCODER={encodeHrTime:encodeAsLongBits,encodeSpanContext:hexToBinary,encodeOptionalSpanContext:optionalHexToBinary};function getOtlpEncoder(S){return DEFAULT_ENCODER}var __read$4=function(S,T){var A=typeof Symbol=="function"&&S[Symbol.iterator];if(!A)return S;var P=A.call(S),O,R=[],M;try{for(;(T===void 0||T-- >0)&&!(O=P.next()).done;)R.push(O.value)}catch(D){M={error:D}}finally{try{O&&!O.done&&(A=P.return)&&A.call(P)}finally{if(M)throw M.error}}return R};function createResource(S){return{attributes:toAttributes(S.attributes),droppedAttributesCount:0}}function createInstrumentationScope(S){return{name:S.name,version:S.version}}function toAttributes(S){return Object.keys(S).map(function(T){return toKeyValue(T,S[T])})}function toKeyValue(S,T){return{key:S,value:toAnyValue(T)}}function toAnyValue(S){var T=typeof S;return T==="string"?{stringValue:S}:T==="number"?Number.isInteger(S)?{intValue:S}:{doubleValue:S}:T==="boolean"?{boolValue:S}:S instanceof Uint8Array?{bytesValue:S}:Array.isArray(S)?{arrayValue:{values:S.map(toAnyValue)}}:T==="object"&&S!=null?{kvlistValue:{values:Object.entries(S).map(function(A){var P=__read$4(A,2),O=P[0],R=P[1];return toKeyValue(O,R)})}}:{}}var __values=function(S){var T=typeof Symbol=="function"&&Symbol.iterator,A=T&&S[T],P=0;if(A)return A.call(S);if(S&&typeof S.length=="number")return{next:function(){return S&&P>=S.length&&(S=void 0),{value:S&&S[P++],done:!S}}};throw new TypeError(T?"Object is not iterable.":"Symbol.iterator is not defined.")},__read$3=function(S,T){var A=typeof Symbol=="function"&&S[Symbol.iterator];if(!A)return S;var P=A.call(S),O,R=[],M;try{for(;(T===void 0||T-- >0)&&!(O=P.next()).done;)R.push(O.value)}catch(D){M={error:D}}finally{try{O&&!O.done&&(A=P.return)&&A.call(P)}finally{if(M)throw M.error}}return R};function sdkSpanToOtlpSpan(S,T){var A,P=S.spanContext(),O=S.status;return{traceId:T.encodeSpanContext(P.traceId),spanId:T.encodeSpanContext(P.spanId),parentSpanId:T.encodeOptionalSpanContext(S.parentSpanId),traceState:(A=P.traceState)===null||A===void 0?void 0:A.serialize(),name:S.name,kind:S.kind==null?0:S.kind+1,startTimeUnixNano:T.encodeHrTime(S.startTime),endTimeUnixNano:T.encodeHrTime(S.endTime),attributes:toAttributes(S.attributes),droppedAttributesCount:S.droppedAttributesCount,events:S.events.map(function(R){return toOtlpSpanEvent(R,T)}),droppedEventsCount:S.droppedEventsCount,status:{code:O.code,message:O.message},links:S.links.map(function(R){return toOtlpLink(R,T)}),droppedLinksCount:S.droppedLinksCount}}function toOtlpLink(S,T){var A;return{attributes:S.attributes?toAttributes(S.attributes):[],spanId:T.encodeSpanContext(S.context.spanId),traceId:T.encodeSpanContext(S.context.traceId),traceState:(A=S.context.traceState)===null||A===void 0?void 0:A.serialize(),droppedAttributesCount:S.droppedAttributesCount||0}}function toOtlpSpanEvent(S,T){return{attributes:S.attributes?toAttributes(S.attributes):[],name:S.name,timeUnixNano:T.encodeHrTime(S.time),droppedAttributesCount:S.droppedAttributesCount||0}}function createExportTraceServiceRequest(S,T){var A=getOtlpEncoder();return{resourceSpans:spanRecordsToResourceSpans(S,A)}}function createResourceMap(S){var T,A,P=new Map;try{for(var O=__values(S),R=O.next();!R.done;R=O.next()){var M=R.value,D=P.get(M.resource);D||(D=new Map,P.set(M.resource,D));var U=M.instrumentationLibrary.name+"@"+(M.instrumentationLibrary.version||"")+":"+(M.instrumentationLibrary.schemaUrl||""),C=D.get(U);C||(C=[],D.set(U,C)),C.push(M)}}catch(L){T={error:L}}finally{try{R&&!R.done&&(A=O.return)&&A.call(O)}finally{if(T)throw T.error}}return P}function spanRecordsToResourceSpans(S,T){for(var A=createResourceMap(S),P=[],O=A.entries(),R=O.next();!R.done;){for(var M=__read$3(R.value,2),D=M[0],U=M[1],C=[],L=U.values(),y=L.next();!y.done;){var _=y.value;if(_.length>0){var N=_.map(function(x){return sdkSpanToOtlpSpan(x,T)});C.push({scope:createInstrumentationScope(_[0].instrumentationLibrary),spans:N,schemaUrl:_[0].instrumentationLibrary.schemaUrl})}y=L.next()}var I={resource:createResource(D),scopeSpans:C,schemaUrl:void 0};P.push(I),R=O.next()}return P}var traceResponseType=rootExports.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,traceRequestType=rootExports.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,ProtobufTraceSerializer={serializeRequest:function(S){var T=createExportTraceServiceRequest(S);return traceRequestType.encode(T).finish()},deserializeResponse:function(S){return traceResponseType.decode(S)}},__awaiter=function(S,T,A,P){function O(R){return R instanceof A?R:new A(function(M){M(R)})}return new(A||(A=Promise))(function(R,M){function D(L){try{C(P.next(L))}catch(y){M(y)}}function U(L){try{C(P.throw(L))}catch(y){M(y)}}function C(L){L.done?R(L.value):O(L.value).then(D,U)}C((P=P.apply(S,T||[])).next())})},__generator=function(S,T){var A={label:0,sent:function(){if(R[0]&1)throw R[1];return R[1]},trys:[],ops:[]},P,O,R,M;return M={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(M[Symbol.iterator]=function(){return this}),M;function D(C){return function(L){return U([C,L])}}function U(C){if(P)throw new TypeError("Generator is already executing.");for(;A;)try{if(P=1,O&&(R=C[0]&2?O.return:C[0]?O.throw||((R=O.return)&&R.call(O),0):O.next)&&!(R=R.call(O,C[1])).done)return R;switch(O=0,R&&(C=[C[0]&2,R.value]),C[0]){case 0:case 1:R=C;break;case 4:return A.label++,{value:C[1],done:!1};case 5:A.label++,O=C[1],C=[0];continue;case 7:C=A.ops.pop(),A.trys.pop();continue;default:if(R=A.trys,!(R=R.length>0&&R[R.length-1])&&(C[0]===6||C[0]===2)){A=0;continue}if(C[0]===3&&(!R||C[1]>R[0]&&C[1]<R[3])){A.label=C[1];break}if(C[0]===6&&A.label<R[1]){A.label=R[1],R=C;break}if(R&&A.label<R[2]){A.label=R[2],A.ops.push(C);break}R[2]&&A.ops.pop(),A.trys.pop();continue}C=T.call(S,A)}catch(L){C=[6,L],O=0}finally{P=R=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},MAX_ATTEMPTS=5,INITIAL_BACKOFF=1e3,MAX_BACKOFF=5e3,BACKOFF_MULTIPLIER=1.5,JITTER=.2;function getJitter(){return Math.random()*(2*JITTER)-JITTER}var RetryingTransport=(function(){function S(T){this._transport=T}return S.prototype.retry=function(T,A,P){var O=this;return new Promise(function(R,M){setTimeout(function(){O._transport.send(T,A).then(R,M)},P)})},S.prototype.send=function(T,A){var P;return __awaiter(this,void 0,void 0,function(){var O,R,M,D,U,C,L;return __generator(this,function(y){switch(y.label){case 0:return O=Date.now()+A,[4,this._transport.send(T,A)];case 1:R=y.sent(),M=MAX_ATTEMPTS,D=INITIAL_BACKOFF,y.label=2;case 2:return R.status==="retryable"&&M>0?(M--,U=Math.max(Math.min(D,MAX_BACKOFF)+getJitter(),0),D=D*BACKOFF_MULTIPLIER,C=(P=R.retryInMillis)!==null&&P!==void 0?P:U,L=O-Date.now(),C>L?[2,R]:[4,this.retry(T,L,C)]):[3,4];case 3:return R=y.sent(),[3,2];case 4:return[2,R]}})})},S.prototype.shutdown=function(){return this._transport.shutdown()},S})();function createRetryingTransport(S){return new RetryingTransport(S.transport)}function isExportRetryable(S){var T=[429,502,503,504];return T.includes(S)}function parseRetryAfterToMills(S){if(S!=null){var T=Number.parseInt(S,10);if(Number.isInteger(T))return T>0?T*1e3:-1;var A=new Date(S).getTime()-Date.now();return A>=0?A:0}}var __read$2=function(S,T){var A=typeof Symbol=="function"&&S[Symbol.iterator];if(!A)return S;var P=A.call(S),O,R=[],M;try{for(;(T===void 0||T-- >0)&&!(O=P.next()).done;)R.push(O.value)}catch(D){M={error:D}}finally{try{O&&!O.done&&(A=P.return)&&A.call(P)}finally{if(M)throw M.error}}return R},XhrTransport=(function(){function S(T){this._parameters=T}return S.prototype.send=function(T,A){var P=this;return new Promise(function(O){var R=new XMLHttpRequest;R.timeout=A,R.open("POST",P._parameters.url);var M=P._parameters.headers();Object.entries(M).forEach(function(D){var U=__read$2(D,2),C=U[0],L=U[1];R.setRequestHeader(C,L)}),R.ontimeout=function(D){O({status:"failure",error:new Error("XHR request timed out")})},R.onreadystatechange=function(){R.status>=200&&R.status<=299?(diag.debug("XHR success"),O({status:"success"})):R.status&&isExportRetryable(R.status)?O({status:"retryable",retryInMillis:parseRetryAfterToMills(R.getResponseHeader("Retry-After"))}):R.status!==0&&O({status:"failure",error:new Error("XHR request failed with non-retryable status")})},R.onabort=function(){O({status:"failure",error:new Error("XHR request aborted")})},R.onerror=function(){O({status:"failure",error:new Error("XHR request errored")})},R.send(T)})},S.prototype.shutdown=function(){},S})();function createXhrTransport(S){return new XhrTransport(S)}var SendBeaconTransport=(function(){function S(T){this._params=T}return S.prototype.send=function(T){var A=this;return new Promise(function(P){navigator.sendBeacon(A._params.url,new Blob([T],{type:A._params.blobType}))?(diag.debug("SendBeacon success"),P({status:"success"})):P({status:"failure",error:new Error("SendBeacon failed")})})},S.prototype.shutdown=function(){},S})();function createSendBeaconTransport(S){return new SendBeaconTransport(S)}function createOtlpXhrExportDelegate(S,T){return createOtlpNetworkExportDelegate(S,T,createRetryingTransport({transport:createXhrTransport(S)}))}function createOtlpSendBeaconExportDelegate(S,T){return createOtlpNetworkExportDelegate(S,T,createRetryingTransport({transport:createSendBeaconTransport({url:S.url,blobType:S.headers()["Content-Type"]})}))}var __read$1=function(S,T){var A=typeof Symbol=="function"&&S[Symbol.iterator];if(!A)return S;var P=A.call(S),O,R=[],M;try{for(;(T===void 0||T-- >0)&&!(O=P.next()).done;)R.push(O.value)}catch(D){M={error:D}}finally{try{O&&!O.done&&(A=P.return)&&A.call(P)}finally{if(M)throw M.error}}return R};function validateAndNormalizeHeaders(S){return function(){var T,A={};return Object.entries((T=S?.())!==null&&T!==void 0?T:{}).forEach(function(P){var O=__read$1(P,2),R=O[0],M=O[1];typeof M<"u"?A[R]=String(M):diag.warn('Header "'+R+'" has invalid value ('+M+") and will be ignored")}),A}}var __assign=function(){return __assign=Object.assign||function(S){for(var T,A=1,P=arguments.length;A<P;A++){T=arguments[A];for(var O in T)Object.prototype.hasOwnProperty.call(T,O)&&(S[O]=T[O])}return S},__assign.apply(this,arguments)};function mergeHeaders(S,T,A){var P=__assign({},A()),O={};return function(){return T!=null&&Object.assign(O,T()),S!=null&&Object.assign(O,S()),Object.assign(O,P)}}function validateUserProvidedUrl(S){if(S!=null)try{return new URL(S),S}catch{throw new Error("Configuration: Could not parse user-provided export URL: '"+S+"'")}}function mergeOtlpHttpConfigurationWithDefaults(S,T,A){var P,O,R,M;return __assign(__assign({},mergeOtlpSharedConfigurationWithDefaults(S,T,A)),{headers:mergeHeaders(validateAndNormalizeHeaders(S.headers),T.headers,A.headers),url:(O=(P=validateUserProvidedUrl(S.url))!==null&&P!==void 0?P:T.url)!==null&&O!==void 0?O:A.url,agentOptions:(M=(R=S.agentOptions)!==null&&R!==void 0?R:T.agentOptions)!==null&&M!==void 0?M:A.agentOptions})}function getHttpConfigurationDefaults(S,T){return __assign(__assign({},getSharedConfigurationDefaults()),{headers:function(){return S},url:"http://localhost:4318/"+T,agentOptions:{keepAlive:!0}})}function convertLegacyBrowserHttpOptions(S,T,A){return mergeOtlpHttpConfigurationWithDefaults({url:S.url,timeoutMillis:S.timeoutMillis,headers:wrapStaticHeadersInFunction(S.headers),concurrencyLimit:S.concurrencyLimit},{},getHttpConfigurationDefaults(A,T))}function createLegacyOtlpBrowserExportDelegate(S,T,A,P){var O=!!S.headers||typeof navigator.sendBeacon!="function",R=convertLegacyBrowserHttpOptions(S,A,P);return O?createOtlpXhrExportDelegate(R,T):createOtlpSendBeaconExportDelegate(R,T)}var __extends=(function(){var S=function(T,A){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,O){P.__proto__=O}||function(P,O){for(var R in O)Object.prototype.hasOwnProperty.call(O,R)&&(P[R]=O[R])},S(T,A)};return function(T,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");S(T,A);function P(){this.constructor=T}T.prototype=A===null?Object.create(A):(P.prototype=A.prototype,new P)}})(),DEFAULT_COLLECTOR_RESOURCE_PATH="v1/traces",OTLPTraceExporter=(function(S){__extends(T,S);function T(A){return A===void 0&&(A={}),S.call(this,createLegacyOtlpBrowserExportDelegate(A,ProtobufTraceSerializer,DEFAULT_COLLECTOR_RESOURCE_PATH,{"Content-Type":"application/x-protobuf"}))||this}return T})(OTLPExporterBase);const index$1=Object.freeze(Object.defineProperty({__proto__:null,OTLPTraceExporter},Symbol.toStringTag,{value:"Module"}));var B3_DEBUG_FLAG_KEY=createContextKey("OpenTelemetry Context Key B3 Debug Flag"),B3_CONTEXT_HEADER="b3",X_B3_TRACE_ID="x-b3-traceid",X_B3_SPAN_ID="x-b3-spanid",X_B3_SAMPLED="x-b3-sampled",X_B3_PARENT_SPAN_ID="x-b3-parentspanid",X_B3_FLAGS="x-b3-flags",VALID_SAMPLED_VALUES=new Set([!0,"true","True","1",1]),VALID_UNSAMPLED_VALUES=new Set([!1,"false","False","0",0]);function isValidSampledValue(S){return S===TraceFlags.SAMPLED||S===TraceFlags.NONE}function parseHeader(S){return Array.isArray(S)?S[0]:S}function getHeaderValue(S,T,A){var P=T.get(S,A);return parseHeader(P)}function getTraceId(S,T){var A=getHeaderValue(S,T,X_B3_TRACE_ID);return typeof A=="string"?A.padStart(32,"0"):""}function getSpanId(S,T){var A=getHeaderValue(S,T,X_B3_SPAN_ID);return typeof A=="string"?A:""}function getDebug(S,T){var A=getHeaderValue(S,T,X_B3_FLAGS);return A==="1"?"1":void 0}function getTraceFlags(S,T){var A=getHeaderValue(S,T,X_B3_SAMPLED),P=getDebug(S,T);if(P==="1"||VALID_SAMPLED_VALUES.has(A))return TraceFlags.SAMPLED;if(A===void 0||VALID_UNSAMPLED_VALUES.has(A))return TraceFlags.NONE}var B3MultiPropagator=(function(){function S(){}return S.prototype.inject=function(T,A,P){var O=trace.getSpanContext(T);if(!(!O||!isSpanContextValid(O)||isTracingSuppressed(T))){var R=T.getValue(B3_DEBUG_FLAG_KEY);P.set(A,X_B3_TRACE_ID,O.traceId),P.set(A,X_B3_SPAN_ID,O.spanId),R==="1"?P.set(A,X_B3_FLAGS,R):O.traceFlags!==void 0&&P.set(A,X_B3_SAMPLED,(TraceFlags.SAMPLED&O.traceFlags)===TraceFlags.SAMPLED?"1":"0")}},S.prototype.extract=function(T,A,P){var O=getTraceId(A,P),R=getSpanId(A,P),M=getTraceFlags(A,P),D=getDebug(A,P);return isValidTraceId(O)&&isValidSpanId(R)&&isValidSampledValue(M)?(T=T.setValue(B3_DEBUG_FLAG_KEY,D),trace.setSpanContext(T,{traceId:O,spanId:R,isRemote:!0,traceFlags:M})):T},S.prototype.fields=function(){return[X_B3_TRACE_ID,X_B3_SPAN_ID,X_B3_FLAGS,X_B3_SAMPLED,X_B3_PARENT_SPAN_ID]},S})(),__read=function(S,T){var A=typeof Symbol=="function"&&S[Symbol.iterator];if(!A)return S;var P=A.call(S),O,R=[],M;try{for(;(T===void 0||T-- >0)&&!(O=P.next()).done;)R.push(O.value)}catch(D){M={error:D}}finally{try{O&&!O.done&&(A=P.return)&&A.call(P)}finally{if(M)throw M.error}}return R},B3_CONTEXT_REGEX=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,PADDING="0".repeat(16),SAMPLED_VALUES=new Set(["d","1"]),DEBUG_STATE="d";function convertToTraceId128(S){return S.length===32?S:""+PADDING+S}function convertToTraceFlags(S){return S&&SAMPLED_VALUES.has(S)?TraceFlags.SAMPLED:TraceFlags.NONE}var B3SinglePropagator=(function(){function S(){}return S.prototype.inject=function(T,A,P){var O=trace.getSpanContext(T);if(!(!O||!isSpanContextValid(O)||isTracingSuppressed(T))){var R=T.getValue(B3_DEBUG_FLAG_KEY)||O.traceFlags&1,M=O.traceId+"-"+O.spanId+"-"+R;P.set(A,B3_CONTEXT_HEADER,M)}},S.prototype.extract=function(T,A,P){var O=P.get(A,B3_CONTEXT_HEADER),R=Array.isArray(O)?O[0]:O;if(typeof R!="string")return T;var M=R.match(B3_CONTEXT_REGEX);if(!M)return T;var D=__read(M,4),U=D[1],C=D[2],L=D[3],y=convertToTraceId128(U);if(!isValidTraceId(y)||!isValidSpanId(C))return T;var _=convertToTraceFlags(L);return L===DEBUG_STATE&&(T=T.setValue(B3_DEBUG_FLAG_KEY,L)),trace.setSpanContext(T,{traceId:y,spanId:C,isRemote:!0,traceFlags:_})},S.prototype.fields=function(){return[B3_CONTEXT_HEADER]},S})(),B3InjectEncoding;(function(S){S[S.SINGLE_HEADER=0]="SINGLE_HEADER",S[S.MULTI_HEADER=1]="MULTI_HEADER"})(B3InjectEncoding||(B3InjectEncoding={}));var B3Propagator=(function(){function S(T){T===void 0&&(T={}),this._b3MultiPropagator=new B3MultiPropagator,this._b3SinglePropagator=new B3SinglePropagator,T.injectEncoding===B3InjectEncoding.MULTI_HEADER?(this._inject=this._b3MultiPropagator.inject,this._fields=this._b3MultiPropagator.fields()):(this._inject=this._b3SinglePropagator.inject,this._fields=this._b3SinglePropagator.fields())}return S.prototype.inject=function(T,A,P){isTracingSuppressed(T)||this._inject(T,A,P)},S.prototype.extract=function(T,A,P){var O=P.get(A,B3_CONTEXT_HEADER),R=Array.isArray(O)?O[0]:O;return R?this._b3SinglePropagator.extract(T,A,P):this._b3MultiPropagator.extract(T,A,P)},S.prototype.fields=function(){return this._fields},S})();const index=Object.freeze(Object.defineProperty({__proto__:null,get B3InjectEncoding(){return B3InjectEncoding},B3Propagator,B3_CONTEXT_HEADER,X_B3_FLAGS,X_B3_PARENT_SPAN_ID,X_B3_SAMPLED,X_B3_SPAN_ID,X_B3_TRACE_ID},Symbol.toStringTag,{value:"Module"}));exports.ElementTypeEnum=ElementTypeEnum,exports.FieldName=FieldName,exports.OpenPayForm=OpenPayForm,exports.SubmitMethods=SubmitMethods,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));
243
+ */const S=globalThis;function T(G){return(S.__Zone_symbol_prefix||"__zone_symbol__")+G}function A(){const G=S.performance;function H(Oe){G&&G.mark&&G.mark(Oe)}function q(Oe,j){G&&G.measure&&G.measure(Oe,j)}H("Zone");class B{static __symbol__=T;static assertZonePatched(){if(S.Promise!==he.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let j=B.current;for(;j.parent;)j=j.parent;return j}static get current(){return fe.zone}static get currentTask(){return me}static __load_patch(j,K,Y=!1){if(he.hasOwnProperty(j)){const ae=S[T("forceDuplicateZoneCheck")]===!0;if(!Y&&ae)throw Error("Already loaded patch: "+j)}else if(!S["__Zone_disable_"+j]){const ae="Zone:"+j;H(ae),he[j]=K(S,B,Te),q(ae,ae)}}get parent(){return this._parent}get name(){return this._name}_parent;_name;_properties;_zoneDelegate;constructor(j,K){this._parent=j,this._name=K?K.name||"unnamed":"<root>",this._properties=K&&K.properties||{},this._zoneDelegate=new J(this,this._parent&&this._parent._zoneDelegate,K)}get(j){const K=this.getZoneWith(j);if(K)return K._properties[j]}getZoneWith(j){let K=this;for(;K;){if(K._properties.hasOwnProperty(j))return K;K=K._parent}return null}fork(j){if(!j)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,j)}wrap(j,K){if(typeof j!="function")throw new Error("Expecting function got: "+j);const Y=this._zoneDelegate.intercept(this,j,K),ae=this;return function(){return ae.runGuarded(Y,this,arguments,K)}}run(j,K,Y,ae){fe={parent:fe,zone:this};try{return this._zoneDelegate.invoke(this,j,K,Y,ae)}finally{fe=fe.parent}}runGuarded(j,K=null,Y,ae){fe={parent:fe,zone:this};try{try{return this._zoneDelegate.invoke(this,j,K,Y,ae)}catch(Le){if(this._zoneDelegate.handleError(this,Le))throw Le}}finally{fe=fe.parent}}runTask(j,K,Y){if(j.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(j.zone||Ge).name+"; Execution: "+this.name+")");const ae=j,{type:Le,data:{isPeriodic:Ze=!1,isRefreshable:Ne=!1}={}}=j;if(j.state===ke&&(Le===xe||Le===ce))return;const rt=j.state!=Ce;rt&&ae._transitionTo(Ce,te);const it=me;me=ae,fe={parent:fe,zone:this};try{Le==ce&&j.data&&!Ze&&!Ne&&(j.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,ae,K,Y)}catch(Ke){if(this._zoneDelegate.handleError(this,Ke))throw Ke}}finally{const Ke=j.state;if(Ke!==ke&&Ke!==Fe)if(Le==xe||Ze||Ne&&Ke===de)rt&&ae._transitionTo(te,Ce,de);else{const lt=ae._zoneDelegates;this._updateTaskCount(ae,-1),rt&&ae._transitionTo(ke,Ce,ke),Ne&&(ae._zoneDelegates=lt)}fe=fe.parent,me=it}}scheduleTask(j){if(j.zone&&j.zone!==this){let Y=this;for(;Y;){if(Y===j.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${j.zone.name}`);Y=Y.parent}}j._transitionTo(de,ke);const K=[];j._zoneDelegates=K,j._zone=this;try{j=this._zoneDelegate.scheduleTask(this,j)}catch(Y){throw j._transitionTo(Fe,de,ke),this._zoneDelegate.handleError(this,Y),Y}return j._zoneDelegates===K&&this._updateTaskCount(j,1),j.state==de&&j._transitionTo(te,de),j}scheduleMicroTask(j,K,Y,ae){return this.scheduleTask(new se(be,j,K,Y,ae,void 0))}scheduleMacroTask(j,K,Y,ae,Le){return this.scheduleTask(new se(ce,j,K,Y,ae,Le))}scheduleEventTask(j,K,Y,ae,Le){return this.scheduleTask(new se(xe,j,K,Y,ae,Le))}cancelTask(j){if(j.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(j.zone||Ge).name+"; Execution: "+this.name+")");if(!(j.state!==te&&j.state!==Ce)){j._transitionTo(Ie,te,Ce);try{this._zoneDelegate.cancelTask(this,j)}catch(K){throw j._transitionTo(Fe,Ie),this._zoneDelegate.handleError(this,K),K}return this._updateTaskCount(j,-1),j._transitionTo(ke,Ie),j.runCount=-1,j}}_updateTaskCount(j,K){const Y=j._zoneDelegates;K==-1&&(j._zoneDelegates=null);for(let ae=0;ae<Y.length;ae++)Y[ae]._updateTaskCount(j.type,K)}}const Z={name:"",onHasTask:(Oe,j,K,Y)=>Oe.hasTask(K,Y),onScheduleTask:(Oe,j,K,Y)=>Oe.scheduleTask(K,Y),onInvokeTask:(Oe,j,K,Y,ae,Le)=>Oe.invokeTask(K,Y,ae,Le),onCancelTask:(Oe,j,K,Y)=>Oe.cancelTask(K,Y)};class J{get zone(){return this._zone}_zone;_taskCounts={microTask:0,macroTask:0,eventTask:0};_parentDelegate;_forkDlgt;_forkZS;_forkCurrZone;_interceptDlgt;_interceptZS;_interceptCurrZone;_invokeDlgt;_invokeZS;_invokeCurrZone;_handleErrorDlgt;_handleErrorZS;_handleErrorCurrZone;_scheduleTaskDlgt;_scheduleTaskZS;_scheduleTaskCurrZone;_invokeTaskDlgt;_invokeTaskZS;_invokeTaskCurrZone;_cancelTaskDlgt;_cancelTaskZS;_cancelTaskCurrZone;_hasTaskDlgt;_hasTaskDlgtOwner;_hasTaskZS;_hasTaskCurrZone;constructor(j,K,Y){this._zone=j,this._parentDelegate=K,this._forkZS=Y&&(Y&&Y.onFork?Y:K._forkZS),this._forkDlgt=Y&&(Y.onFork?K:K._forkDlgt),this._forkCurrZone=Y&&(Y.onFork?this._zone:K._forkCurrZone),this._interceptZS=Y&&(Y.onIntercept?Y:K._interceptZS),this._interceptDlgt=Y&&(Y.onIntercept?K:K._interceptDlgt),this._interceptCurrZone=Y&&(Y.onIntercept?this._zone:K._interceptCurrZone),this._invokeZS=Y&&(Y.onInvoke?Y:K._invokeZS),this._invokeDlgt=Y&&(Y.onInvoke?K:K._invokeDlgt),this._invokeCurrZone=Y&&(Y.onInvoke?this._zone:K._invokeCurrZone),this._handleErrorZS=Y&&(Y.onHandleError?Y:K._handleErrorZS),this._handleErrorDlgt=Y&&(Y.onHandleError?K:K._handleErrorDlgt),this._handleErrorCurrZone=Y&&(Y.onHandleError?this._zone:K._handleErrorCurrZone),this._scheduleTaskZS=Y&&(Y.onScheduleTask?Y:K._scheduleTaskZS),this._scheduleTaskDlgt=Y&&(Y.onScheduleTask?K:K._scheduleTaskDlgt),this._scheduleTaskCurrZone=Y&&(Y.onScheduleTask?this._zone:K._scheduleTaskCurrZone),this._invokeTaskZS=Y&&(Y.onInvokeTask?Y:K._invokeTaskZS),this._invokeTaskDlgt=Y&&(Y.onInvokeTask?K:K._invokeTaskDlgt),this._invokeTaskCurrZone=Y&&(Y.onInvokeTask?this._zone:K._invokeTaskCurrZone),this._cancelTaskZS=Y&&(Y.onCancelTask?Y:K._cancelTaskZS),this._cancelTaskDlgt=Y&&(Y.onCancelTask?K:K._cancelTaskDlgt),this._cancelTaskCurrZone=Y&&(Y.onCancelTask?this._zone:K._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;const ae=Y&&Y.onHasTask,Le=K&&K._hasTaskZS;(ae||Le)&&(this._hasTaskZS=ae?Y:Z,this._hasTaskDlgt=K,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,Y.onScheduleTask||(this._scheduleTaskZS=Z,this._scheduleTaskDlgt=K,this._scheduleTaskCurrZone=this._zone),Y.onInvokeTask||(this._invokeTaskZS=Z,this._invokeTaskDlgt=K,this._invokeTaskCurrZone=this._zone),Y.onCancelTask||(this._cancelTaskZS=Z,this._cancelTaskDlgt=K,this._cancelTaskCurrZone=this._zone))}fork(j,K){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,j,K):new B(j,K)}intercept(j,K,Y){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,j,K,Y):K}invoke(j,K,Y,ae,Le){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,j,K,Y,ae,Le):K.apply(Y,ae)}handleError(j,K){return this._handleErrorZS?this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,j,K):!0}scheduleTask(j,K){let Y=K;if(this._scheduleTaskZS)this._hasTaskZS&&Y._zoneDelegates.push(this._hasTaskDlgtOwner),Y=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,j,K),Y||(Y=K);else if(K.scheduleFn)K.scheduleFn(K);else if(K.type==be)Ue(K);else throw new Error("Task is missing scheduleFn.");return Y}invokeTask(j,K,Y,ae){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,j,K,Y,ae):K.callback.apply(Y,ae)}cancelTask(j,K){let Y;if(this._cancelTaskZS)Y=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,j,K);else{if(!K.cancelFn)throw Error("Task is not cancelable");Y=K.cancelFn(K)}return Y}hasTask(j,K){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,j,K)}catch(Y){this.handleError(j,Y)}}_updateTaskCount(j,K){const Y=this._taskCounts,ae=Y[j],Le=Y[j]=ae+K;if(Le<0)throw new Error("More tasks executed then were scheduled.");if(ae==0||Le==0){const Ze={microTask:Y.microTask>0,macroTask:Y.macroTask>0,eventTask:Y.eventTask>0,change:j};this.hasTask(this._zone,Ze)}}}class se{type;source;invoke;callback;data;scheduleFn;cancelFn;_zone=null;runCount=0;_zoneDelegates=null;_state="notScheduled";constructor(j,K,Y,ae,Le,Ze){if(this.type=j,this.source=K,this.data=ae,this.scheduleFn=Le,this.cancelFn=Ze,!Y)throw new Error("callback is not defined");this.callback=Y;const Ne=this;j===xe&&ae&&ae.useG?this.invoke=se.invokeTask:this.invoke=function(){return se.invokeTask.call(S,Ne,this,arguments)}}static invokeTask(j,K,Y){j||(j=this),He++;try{return j.runCount++,j.zone.runTask(j,K,Y)}finally{He==1&&Be(),He--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(ke,de)}_transitionTo(j,K,Y){if(this._state===K||this._state===Y)this._state=j,j==ke&&(this._zoneDelegates=null);else throw new Error(`${this.type} '${this.source}': can not transition to '${j}', expecting state '${K}'${Y?" or '"+Y+"'":""}, was '${this._state}'.`)}toString(){return this.data&&typeof this.data.handleId<"u"?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}const ie=T("setTimeout"),_e=T("Promise"),ye=T("then");let oe=[],Ee=!1,ge;function Me(Oe){if(ge||S[_e]&&(ge=S[_e].resolve(0)),ge){let j=ge[ye];j||(j=ge.then),j.call(ge,Oe)}else S[ie](Oe,0)}function Ue(Oe){He===0&&oe.length===0&&Me(Be),Oe&&oe.push(Oe)}function Be(){if(!Ee){for(Ee=!0;oe.length;){const Oe=oe;oe=[];for(let j=0;j<Oe.length;j++){const K=Oe[j];try{K.zone.runTask(K,null,null)}catch(Y){Te.onUnhandledError(Y)}}}Te.microtaskDrainDone(),Ee=!1}}const Ge={name:"NO ZONE"},ke="notScheduled",de="scheduling",te="scheduled",Ce="running",Ie="canceling",Fe="unknown",be="microTask",ce="macroTask",xe="eventTask",he={},Te={symbol:T,currentZoneFrame:()=>fe,onUnhandledError:Ve,microtaskDrainDone:Ve,scheduleMicroTask:Ue,showUncaughtError:()=>!B[T("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:Ve,patchMethod:()=>Ve,bindArguments:()=>[],patchThen:()=>Ve,patchMacroTask:()=>Ve,patchEventPrototype:()=>Ve,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>Ve,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>Ve,wrapWithCurrentZone:()=>Ve,filterProperties:()=>[],attachOriginToPatched:()=>Ve,_redefineProperty:()=>Ve,patchCallbacks:()=>Ve,nativeScheduleMicroTask:Me};let fe={parent:null,zone:new B(null,null)},me=null,He=0;function Ve(){}return q("Zone","Zone"),B}function P(){const G=globalThis,H=G[T("forceDuplicateZoneCheck")]===!0;if(G.Zone&&(H||typeof G.Zone.__symbol__!="function"))throw new Error("Zone already loaded.");return G.Zone??=A(),G.Zone}const O=Object.getOwnPropertyDescriptor,R=Object.defineProperty,M=Object.getPrototypeOf,D=Object.create,U=Array.prototype.slice,C="addEventListener",L="removeEventListener",y=T(C),_=T(L),N="true",I="false",x=T("");function V(G,H){return Zone.current.wrap(G,H)}function k(G,H,q,B,Z){return Zone.current.scheduleMacroTask(G,H,q,B,Z)}const F=T,W=typeof window<"u",ee=W?window:void 0,ne=W&&ee||globalThis,le="removeAttribute";function Re(G,H){for(let q=G.length-1;q>=0;q--)typeof G[q]=="function"&&(G[q]=V(G[q],H+"_"+q));return G}function Qe(G,H){const q=G.constructor.name;for(let B=0;B<H.length;B++){const Z=H[B],J=G[Z];if(J){const se=O(G,Z);if(!je(se))continue;G[Z]=(ie=>{const _e=function(){return ie.apply(this,Re(arguments,q+"."+Z))};return tt(_e,ie),_e})(J)}}}function je(G){return G?G.writable===!1?!1:!(typeof G.get=="function"&&typeof G.set>"u"):!0}const ot=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,at=!("nw"in ne)&&typeof ne.process<"u"&&ne.process.toString()==="[object process]",ft=!at&&!ot&&!!(W&&ee.HTMLElement),vt=typeof ne.process<"u"&&ne.process.toString()==="[object process]"&&!ot&&!!(W&&ee.HTMLElement),Et={},Ht=F("enable_beforeunload"),Pt=function(G){if(G=G||ne.event,!G)return;let H=Et[G.type];H||(H=Et[G.type]=F("ON_PROPERTY"+G.type));const q=this||G.target||ne,B=q[H];let Z;if(ft&&q===ee&&G.type==="error"){const J=G;Z=B&&B.call(this,J.message,J.filename,J.lineno,J.colno,J.error),Z===!0&&G.preventDefault()}else Z=B&&B.apply(this,arguments),G.type==="beforeunload"&&ne[Ht]&&typeof Z=="string"?G.returnValue=Z:Z!=null&&!Z&&G.preventDefault();return Z};function gt(G,H,q){let B=O(G,H);if(!B&&q&&O(q,H)&&(B={enumerable:!0,configurable:!0}),!B||!B.configurable)return;const Z=F("on"+H+"patched");if(G.hasOwnProperty(Z)&&G[Z])return;delete B.writable,delete B.value;const J=B.get,se=B.set,ie=H.slice(2);let _e=Et[ie];_e||(_e=Et[ie]=F("ON_PROPERTY"+ie)),B.set=function(ye){let oe=this;if(!oe&&G===ne&&(oe=ne),!oe)return;typeof oe[_e]=="function"&&oe.removeEventListener(ie,Pt),se?.call(oe,null),oe[_e]=ye,typeof ye=="function"&&oe.addEventListener(ie,Pt,!1)},B.get=function(){let ye=this;if(!ye&&G===ne&&(ye=ne),!ye)return null;const oe=ye[_e];if(oe)return oe;if(J){let Ee=J.call(this);if(Ee)return B.set.call(this,Ee),typeof ye[le]=="function"&&ye.removeAttribute(H),Ee}return null},R(G,H,B),G[Z]=!0}function Ot(G,H,q){if(H)for(let B=0;B<H.length;B++)gt(G,"on"+H[B],q);else{const B=[];for(const Z in G)Z.slice(0,2)=="on"&&B.push(Z);for(let Z=0;Z<B.length;Z++)gt(G,B[Z],q)}}const We=F("originalInstance");function _t(G){const H=ne[G];if(!H)return;ne[F(G)]=H,ne[G]=function(){const Z=Re(arguments,G);switch(Z.length){case 0:this[We]=new H;break;case 1:this[We]=new H(Z[0]);break;case 2:this[We]=new H(Z[0],Z[1]);break;case 3:this[We]=new H(Z[0],Z[1],Z[2]);break;case 4:this[We]=new H(Z[0],Z[1],Z[2],Z[3]);break;default:throw new Error("Arg list too long.")}},tt(ne[G],H);const q=new H(function(){});let B;for(B in q)G==="XMLHttpRequest"&&B==="responseBlob"||(function(Z){typeof q[Z]=="function"?ne[G].prototype[Z]=function(){return this[We][Z].apply(this[We],arguments)}:R(ne[G].prototype,Z,{set:function(J){typeof J=="function"?(this[We][Z]=V(J,G+"."+Z),tt(this[We][Z],J)):this[We][Z]=J},get:function(){return this[We][Z]}})})(B);for(B in H)B!=="prototype"&&H.hasOwnProperty(B)&&(ne[G][B]=H[B])}function et(G,H,q){let B=G;for(;B&&!B.hasOwnProperty(H);)B=M(B);!B&&G[H]&&(B=G);const Z=F(H);let J=null;if(B&&(!(J=B[Z])||!B.hasOwnProperty(Z))){J=B[Z]=B[H];const se=B&&O(B,H);if(je(se)){const ie=q(J,Z,H);B[H]=function(){return ie(this,arguments)},tt(B[H],J)}}return J}function Yt(G,H,q){let B=null;function Z(J){const se=J.data;return se.args[se.cbIdx]=function(){J.invoke.apply(this,arguments)},B.apply(se.target,se.args),J}B=et(G,H,J=>function(se,ie){const _e=q(se,ie);return _e.cbIdx>=0&&typeof ie[_e.cbIdx]=="function"?k(_e.name,ie[_e.cbIdx],_e,Z):J.apply(se,ie)})}function tt(G,H){G[F("OriginalDelegate")]=H}let Nt=!1,yt=!1;function $t(){if(Nt)return yt;Nt=!0;try{const G=ee.navigator.userAgent;(G.indexOf("MSIE ")!==-1||G.indexOf("Trident/")!==-1||G.indexOf("Edge/")!==-1)&&(yt=!0)}catch{}return yt}function Rt(G){return typeof G=="function"}function Ct(G){return typeof G=="number"}const jt={useG:!0},qe={},Mt={},It=new RegExp("^"+x+"(\\w+)(true|false)$"),Lt=F("propagationStopped");function bt(G,H){const q=(H?H(G):G)+I,B=(H?H(G):G)+N,Z=x+q,J=x+B;qe[G]={},qe[G][I]=Z,qe[G][N]=J}function Kt(G,H,q,B){const Z=B&&B.add||C,J=B&&B.rm||L,se=B&&B.listeners||"eventListeners",ie=B&&B.rmAll||"removeAllListeners",_e=F(Z),ye="."+Z+":",oe="prependListener",Ee="."+oe+":",ge=function(de,te,Ce){if(de.isRemoved)return;const Ie=de.callback;typeof Ie=="object"&&Ie.handleEvent&&(de.callback=ce=>Ie.handleEvent(ce),de.originalDelegate=Ie);let Fe;try{de.invoke(de,te,[Ce])}catch(ce){Fe=ce}const be=de.options;if(be&&typeof be=="object"&&be.once){const ce=de.originalDelegate?de.originalDelegate:de.callback;te[J].call(te,Ce.type,ce,be)}return Fe};function Me(de,te,Ce){if(te=te||G.event,!te)return;const Ie=de||te.target||G,Fe=Ie[qe[te.type][Ce?N:I]];if(Fe){const be=[];if(Fe.length===1){const ce=ge(Fe[0],Ie,te);ce&&be.push(ce)}else{const ce=Fe.slice();for(let xe=0;xe<ce.length&&!(te&&te[Lt]===!0);xe++){const he=ge(ce[xe],Ie,te);he&&be.push(he)}}if(be.length===1)throw be[0];for(let ce=0;ce<be.length;ce++){const xe=be[ce];H.nativeScheduleMicroTask(()=>{throw xe})}}}const Ue=function(de){return Me(this,de,!1)},Be=function(de){return Me(this,de,!0)};function Ge(de,te){if(!de)return!1;let Ce=!0;te&&te.useG!==void 0&&(Ce=te.useG);const Ie=te&&te.vh;let Fe=!0;te&&te.chkDup!==void 0&&(Fe=te.chkDup);let be=!1;te&&te.rt!==void 0&&(be=te.rt);let ce=de;for(;ce&&!ce.hasOwnProperty(Z);)ce=M(ce);if(!ce&&de[Z]&&(ce=de),!ce||ce[_e])return!1;const xe=te&&te.eventNameToString,he={},Te=ce[_e]=ce[Z],fe=ce[F(J)]=ce[J],me=ce[F(se)]=ce[se],He=ce[F(ie)]=ce[ie];let Ve;te&&te.prepend&&(Ve=ce[F(te.prepend)]=ce[te.prepend]);function Oe($,X){return X?typeof $=="boolean"?{capture:$,passive:!0}:$?typeof $=="object"&&$.passive!==!1?{...$,passive:!0}:$:{passive:!0}:$}const j=function($){if(!he.isExisting)return Te.call(he.target,he.eventName,he.capture?Be:Ue,he.options)},K=function($){if(!$.isRemoved){const X=qe[$.eventName];let pe;X&&(pe=X[$.capture?N:I]);const Se=pe&&$.target[pe];if(Se){for(let ue=0;ue<Se.length;ue++)if(Se[ue]===$){Se.splice(ue,1),$.isRemoved=!0,$.removeAbortListener&&($.removeAbortListener(),$.removeAbortListener=null),Se.length===0&&($.allRemoved=!0,$.target[pe]=null);break}}}if($.allRemoved)return fe.call($.target,$.eventName,$.capture?Be:Ue,$.options)},Y=function($){return Te.call(he.target,he.eventName,$.invoke,he.options)},ae=function($){return Ve.call(he.target,he.eventName,$.invoke,he.options)},Le=function($){return fe.call($.target,$.eventName,$.invoke,$.options)},Ze=Ce?j:Y,Ne=Ce?K:Le,rt=function($,X){const pe=typeof X;return pe==="function"&&$.callback===X||pe==="object"&&$.originalDelegate===X},it=te?.diff||rt,Ke=Zone[F("UNPATCHED_EVENTS")],lt=G[F("PASSIVE_EVENTS")];function Q($){if(typeof $=="object"&&$!==null){const X={...$};return $.signal&&(X.signal=$.signal),X}return $}const z=function($,X,pe,Se,ue=!1,Ae=!1){return function(){const ve=this||G;let Pe=arguments[0];te&&te.transferEventName&&(Pe=te.transferEventName(Pe));let De=arguments[1];if(!De)return $.apply(this,arguments);if(at&&Pe==="uncaughtException")return $.apply(this,arguments);let we=!1;if(typeof De!="function"){if(!De.handleEvent)return $.apply(this,arguments);we=!0}if(Ie&&!Ie($,De,ve,arguments))return;const nt=!!lt&&lt.indexOf(Pe)!==-1,Xe=Q(Oe(arguments[2],nt)),ct=Xe?.signal;if(ct?.aborted)return;if(Ke){for(let Je=0;Je<Ke.length;Je++)if(Pe===Ke[Je])return nt?$.call(ve,Pe,De,Xe):$.apply(this,arguments)}const ht=Xe?typeof Xe=="boolean"?!0:Xe.capture:!1,Vt=Xe&&typeof Xe=="object"?Xe.once:!1,ir=Zone.current;let At=qe[Pe];At||(bt(Pe,xe),At=qe[Pe]);const kt=At[ht?N:I];let ut=ve[kt],Ft=!1;if(ut){if(Ft=!0,Fe){for(let Je=0;Je<ut.length;Je++)if(it(ut[Je],De))return}}else ut=ve[kt]=[];let St;const Bt=ve.constructor.name,Gt=Mt[Bt];Gt&&(St=Gt[Pe]),St||(St=Bt+X+(xe?xe(Pe):Pe)),he.options=Xe,Vt&&(he.options.once=!1),he.target=ve,he.capture=ht,he.eventName=Pe,he.isExisting=Ft;const dt=Ce?jt:void 0;dt&&(dt.taskData=he),ct&&(he.options.signal=void 0);const ze=ir.scheduleEventTask(St,De,dt,pe,Se);if(ct){he.options.signal=ct;const Je=()=>ze.zone.cancelTask(ze);$.call(ct,"abort",Je,{once:!0}),ze.removeAbortListener=()=>ct.removeEventListener("abort",Je)}if(he.target=null,dt&&(dt.taskData=null),Vt&&(he.options.once=!0),typeof ze.options!="boolean"&&(ze.options=Xe),ze.target=ve,ze.capture=ht,ze.eventName=Pe,we&&(ze.originalDelegate=De),Ae?ut.unshift(ze):ut.push(ze),ue)return ve}};return ce[Z]=z(Te,ye,Ze,Ne,be),Ve&&(ce[oe]=z(Ve,Ee,ae,Ne,be,!0)),ce[J]=function(){const $=this||G;let X=arguments[0];te&&te.transferEventName&&(X=te.transferEventName(X));const pe=arguments[2],Se=pe?typeof pe=="boolean"?!0:pe.capture:!1,ue=arguments[1];if(!ue)return fe.apply(this,arguments);if(Ie&&!Ie(fe,ue,$,arguments))return;const Ae=qe[X];let ve;Ae&&(ve=Ae[Se?N:I]);const Pe=ve&&$[ve];if(Pe)for(let De=0;De<Pe.length;De++){const we=Pe[De];if(it(we,ue)){if(Pe.splice(De,1),we.isRemoved=!0,Pe.length===0&&(we.allRemoved=!0,$[ve]=null,!Se&&typeof X=="string")){const nt=x+"ON_PROPERTY"+X;$[nt]=null}return we.zone.cancelTask(we),be?$:void 0}}return fe.apply(this,arguments)},ce[se]=function(){const $=this||G;let X=arguments[0];te&&te.transferEventName&&(X=te.transferEventName(X));const pe=[],Se=Dt($,xe?xe(X):X);for(let ue=0;ue<Se.length;ue++){const Ae=Se[ue];let ve=Ae.originalDelegate?Ae.originalDelegate:Ae.callback;pe.push(ve)}return pe},ce[ie]=function(){const $=this||G;let X=arguments[0];if(X){te&&te.transferEventName&&(X=te.transferEventName(X));const pe=qe[X];if(pe){const Se=pe[I],ue=pe[N],Ae=$[Se],ve=$[ue];if(Ae){const Pe=Ae.slice();for(let De=0;De<Pe.length;De++){const we=Pe[De];let nt=we.originalDelegate?we.originalDelegate:we.callback;this[J].call(this,X,nt,we.options)}}if(ve){const Pe=ve.slice();for(let De=0;De<Pe.length;De++){const we=Pe[De];let nt=we.originalDelegate?we.originalDelegate:we.callback;this[J].call(this,X,nt,we.options)}}}}else{const pe=Object.keys($);for(let Se=0;Se<pe.length;Se++){const ue=pe[Se],Ae=It.exec(ue);let ve=Ae&&Ae[1];ve&&ve!=="removeListener"&&this[ie].call(this,ve)}this[ie].call(this,"removeListener")}if(be)return this},tt(ce[Z],Te),tt(ce[J],fe),He&&tt(ce[ie],He),me&&tt(ce[se],me),!0}let ke=[];for(let de=0;de<q.length;de++)ke[de]=Ge(q[de],B);return ke}function Dt(G,H){if(!H){const J=[];for(let se in G){const ie=It.exec(se);let _e=ie&&ie[1];if(_e&&(!H||_e===H)){const ye=G[se];if(ye)for(let oe=0;oe<ye.length;oe++)J.push(ye[oe])}}return J}let q=qe[H];q||(bt(H),q=qe[H]);const B=G[q[I]],Z=G[q[N]];return B?Z?B.concat(Z):B.slice():Z?Z.slice():[]}function Zt(G,H){const q=G.Event;q&&q.prototype&&H.patchMethod(q.prototype,"stopImmediatePropagation",B=>function(Z,J){Z[Lt]=!0,B&&B.apply(Z,J)})}function qt(G,H){H.patchMethod(G,"queueMicrotask",q=>function(B,Z){Zone.current.scheduleMicroTask("queueMicrotask",Z[0])})}const Tt=F("zoneTask");function st(G,H,q,B){let Z=null,J=null;H+=B,q+=B;const se={};function ie(ye){const oe=ye.data;oe.args[0]=function(){return ye.invoke.apply(this,arguments)};const Ee=Z.apply(G,oe.args);return Ct(Ee)?oe.handleId=Ee:(oe.handle=Ee,oe.isRefreshable=Rt(Ee.refresh)),ye}function _e(ye){const{handle:oe,handleId:Ee}=ye.data;return J.call(G,oe??Ee)}Z=et(G,H,ye=>function(oe,Ee){if(Rt(Ee[0])){const ge={isRefreshable:!1,isPeriodic:B==="Interval",delay:B==="Timeout"||B==="Interval"?Ee[1]||0:void 0,args:Ee},Me=Ee[0];Ee[0]=function(){try{return Me.apply(this,arguments)}finally{const{handle:Ce,handleId:Ie,isPeriodic:Fe,isRefreshable:be}=ge;!Fe&&!be&&(Ie?delete se[Ie]:Ce&&(Ce[Tt]=null))}};const Ue=k(H,Ee[0],ge,ie,_e);if(!Ue)return Ue;const{handleId:Be,handle:Ge,isRefreshable:ke,isPeriodic:de}=Ue.data;if(Be)se[Be]=Ue;else if(Ge&&(Ge[Tt]=Ue,ke&&!de)){const te=Ge.refresh;Ge.refresh=function(){const{zone:Ce,state:Ie}=Ue;return Ie==="notScheduled"?(Ue._state="scheduled",Ce._updateTaskCount(Ue,1)):Ie==="running"&&(Ue._state="scheduling"),te.call(this)}}return Ge??Be??Ue}else return ye.apply(G,Ee)}),J=et(G,q,ye=>function(oe,Ee){const ge=Ee[0];let Me;Ct(ge)?(Me=se[ge],delete se[ge]):(Me=ge?.[Tt],Me?ge[Tt]=null:Me=ge),Me?.type?Me.cancelFn&&Me.zone.cancelTask(Me):ye.apply(G,Ee)})}function Wt(G,H){const{isBrowser:q,isMix:B}=H.getGlobalObjects();if(!q&&!B||!G.customElements||!("customElements"in G))return;const Z=["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formAssociatedCallback","formDisabledCallback","formResetCallback","formStateRestoreCallback"];H.patchCallbacks(H,G.customElements,"customElements","define",Z)}function zt(G,H){if(Zone[H.symbol("patchEventTarget")])return;const{eventNames:q,zoneSymbolEventNames:B,TRUE_STR:Z,FALSE_STR:J,ZONE_SYMBOL_PREFIX:se}=H.getGlobalObjects();for(let _e=0;_e<q.length;_e++){const ye=q[_e],oe=ye+J,Ee=ye+Z,ge=se+oe,Me=se+Ee;B[ye]={},B[ye][J]=ge,B[ye][Z]=Me}const ie=G.EventTarget;if(!(!ie||!ie.prototype))return H.patchEventTarget(G,H,[ie&&ie.prototype]),!0}function Xt(G,H){H.patchEventPrototype(G,H)}function wt(G,H,q){if(!q||q.length===0)return H;const B=q.filter(J=>J.target===G);if(B.length===0)return H;const Z=B[0].ignoreProperties;return H.filter(J=>Z.indexOf(J)===-1)}function Ut(G,H,q,B){if(!G)return;const Z=wt(G,H,q);Ot(G,Z,B)}function mt(G){return Object.getOwnPropertyNames(G).filter(H=>H.startsWith("on")&&H.length>2).map(H=>H.substring(2))}function Jt(G,H){if(at&&!vt||Zone[G.symbol("patchEvents")])return;const q=H.__Zone_ignore_on_properties;let B=[];if(ft){const Z=window;B=B.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);const J=[];Ut(Z,mt(Z),q&&q.concat(J),M(Z))}B=B.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let Z=0;Z<B.length;Z++){const J=H[B[Z]];J?.prototype&&Ut(J.prototype,mt(J.prototype),q)}}function Qt(G){G.__load_patch("legacy",H=>{const q=H[G.__symbol__("legacyPatch")];q&&q()}),G.__load_patch("timers",H=>{const B="clear";st(H,"set",B,"Timeout"),st(H,"set",B,"Interval"),st(H,"set",B,"Immediate")}),G.__load_patch("requestAnimationFrame",H=>{st(H,"request","cancel","AnimationFrame"),st(H,"mozRequest","mozCancel","AnimationFrame"),st(H,"webkitRequest","webkitCancel","AnimationFrame")}),G.__load_patch("blocking",(H,q)=>{const B=["alert","prompt","confirm"];for(let Z=0;Z<B.length;Z++){const J=B[Z];et(H,J,(se,ie,_e)=>function(ye,oe){return q.current.run(se,H,oe,_e)})}}),G.__load_patch("EventTarget",(H,q,B)=>{Xt(H,B),zt(H,B);const Z=H.XMLHttpRequestEventTarget;Z&&Z.prototype&&B.patchEventTarget(H,B,[Z.prototype])}),G.__load_patch("MutationObserver",(H,q,B)=>{_t("MutationObserver"),_t("WebKitMutationObserver")}),G.__load_patch("IntersectionObserver",(H,q,B)=>{_t("IntersectionObserver")}),G.__load_patch("FileReader",(H,q,B)=>{_t("FileReader")}),G.__load_patch("on_property",(H,q,B)=>{Jt(B,H)}),G.__load_patch("customElements",(H,q,B)=>{Wt(H,B)}),G.__load_patch("XHR",(H,q)=>{ye(H);const B=F("xhrTask"),Z=F("xhrSync"),J=F("xhrListener"),se=F("xhrScheduled"),ie=F("xhrURL"),_e=F("xhrErrorBeforeScheduled");function ye(oe){const Ee=oe.XMLHttpRequest;if(!Ee)return;const ge=Ee.prototype;function Me(Te){return Te[B]}let Ue=ge[y],Be=ge[_];if(!Ue){const Te=oe.XMLHttpRequestEventTarget;if(Te){const fe=Te.prototype;Ue=fe[y],Be=fe[_]}}const Ge="readystatechange",ke="scheduled";function de(Te){const fe=Te.data,me=fe.target;me[se]=!1,me[_e]=!1;const He=me[J];Ue||(Ue=me[y],Be=me[_]),He&&Be.call(me,Ge,He);const Ve=me[J]=()=>{if(me.readyState===me.DONE)if(!fe.aborted&&me[se]&&Te.state===ke){const j=me[q.__symbol__("loadfalse")];if(me.status!==0&&j&&j.length>0){const K=Te.invoke;Te.invoke=function(){const Y=me[q.__symbol__("loadfalse")];for(let ae=0;ae<Y.length;ae++)Y[ae]===Te&&Y.splice(ae,1);!fe.aborted&&Te.state===ke&&K.call(Te)},j.push(Te)}else Te.invoke()}else!fe.aborted&&me[se]===!1&&(me[_e]=!0)};return Ue.call(me,Ge,Ve),me[B]||(me[B]=Te),xe.apply(me,fe.args),me[se]=!0,Te}function te(){}function Ce(Te){const fe=Te.data;return fe.aborted=!0,he.apply(fe.target,fe.args)}const Ie=et(ge,"open",()=>function(Te,fe){return Te[Z]=fe[2]==!1,Te[ie]=fe[1],Ie.apply(Te,fe)}),Fe="XMLHttpRequest.send",be=F("fetchTaskAborting"),ce=F("fetchTaskScheduling"),xe=et(ge,"send",()=>function(Te,fe){if(q.current[ce]===!0||Te[Z])return xe.apply(Te,fe);{const me={target:Te,url:Te[ie],isPeriodic:!1,args:fe,aborted:!1},He=k(Fe,te,me,de,Ce);Te&&Te[_e]===!0&&!me.aborted&&He.state===ke&&He.invoke()}}),he=et(ge,"abort",()=>function(Te,fe){const me=Me(Te);if(me&&typeof me.type=="string"){if(me.cancelFn==null||me.data&&me.data.aborted)return;me.zone.cancelTask(me)}else if(q.current[be]===!0)return he.apply(Te,fe)})}}),G.__load_patch("geolocation",H=>{H.navigator&&H.navigator.geolocation&&Qe(H.navigator.geolocation,["getCurrentPosition","watchPosition"])}),G.__load_patch("PromiseRejectionEvent",(H,q)=>{function B(Z){return function(J){Dt(H,Z).forEach(ie=>{const _e=H.PromiseRejectionEvent;if(_e){const ye=new _e(Z,{promise:J.promise,reason:J.rejection});ie.invoke(ye)}})}}H.PromiseRejectionEvent&&(q[F("unhandledPromiseRejectionHandler")]=B("unhandledrejection"),q[F("rejectionHandledHandler")]=B("rejectionhandled"))}),G.__load_patch("queueMicrotask",(H,q,B)=>{qt(H,B)})}function er(G){G.__load_patch("ZoneAwarePromise",(H,q,B)=>{const Z=Object.getOwnPropertyDescriptor,J=Object.defineProperty;function se(Q){if(Q&&Q.toString===Object.prototype.toString){const z=Q.constructor&&Q.constructor.name;return(z||"")+": "+JSON.stringify(Q)}return Q?Q.toString():Object.prototype.toString.call(Q)}const ie=B.symbol,_e=[],ye=H[ie("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")]!==!1,oe=ie("Promise"),Ee=ie("then"),ge="__creationTrace__";B.onUnhandledError=Q=>{if(B.showUncaughtError()){const z=Q&&Q.rejection;z?console.error("Unhandled Promise rejection:",z instanceof Error?z.message:z,"; Zone:",Q.zone.name,"; Task:",Q.task&&Q.task.source,"; Value:",z,z instanceof Error?z.stack:void 0):console.error(Q)}},B.microtaskDrainDone=()=>{for(;_e.length;){const Q=_e.shift();try{Q.zone.runGuarded(()=>{throw Q.throwOriginal?Q.rejection:Q})}catch(z){Ue(z)}}};const Me=ie("unhandledPromiseRejectionHandler");function Ue(Q){B.onUnhandledError(Q);try{const z=q[Me];typeof z=="function"&&z.call(this,Q)}catch{}}function Be(Q){return Q&&typeof Q.then=="function"}function Ge(Q){return Q}function ke(Q){return Ne.reject(Q)}const de=ie("state"),te=ie("value"),Ce=ie("finally"),Ie=ie("parentPromiseValue"),Fe=ie("parentPromiseState"),be="Promise.then",ce=null,xe=!0,he=!1,Te=0;function fe(Q,z){return $=>{try{Oe(Q,z,$)}catch(X){Oe(Q,!1,X)}}}const me=function(){let Q=!1;return function($){return function(){Q||(Q=!0,$.apply(null,arguments))}}},He="Promise resolved with itself",Ve=ie("currentTaskTrace");function Oe(Q,z,$){const X=me();if(Q===$)throw new TypeError(He);if(Q[de]===ce){let pe=null;try{(typeof $=="object"||typeof $=="function")&&(pe=$&&$.then)}catch(Se){return X(()=>{Oe(Q,!1,Se)})(),Q}if(z!==he&&$ instanceof Ne&&$.hasOwnProperty(de)&&$.hasOwnProperty(te)&&$[de]!==ce)K($),Oe(Q,$[de],$[te]);else if(z!==he&&typeof pe=="function")try{pe.call($,X(fe(Q,z)),X(fe(Q,!1)))}catch(Se){X(()=>{Oe(Q,!1,Se)})()}else{Q[de]=z;const Se=Q[te];if(Q[te]=$,Q[Ce]===Ce&&z===xe&&(Q[de]=Q[Fe],Q[te]=Q[Ie]),z===he&&$ instanceof Error){const ue=q.currentTask&&q.currentTask.data&&q.currentTask.data[ge];ue&&J($,Ve,{configurable:!0,enumerable:!1,writable:!0,value:ue})}for(let ue=0;ue<Se.length;)Y(Q,Se[ue++],Se[ue++],Se[ue++],Se[ue++]);if(Se.length==0&&z==he){Q[de]=Te;let ue=$;try{throw new Error("Uncaught (in promise): "+se($)+($&&$.stack?`
244
+ `+$.stack:""))}catch(Ae){ue=Ae}ye&&(ue.throwOriginal=!0),ue.rejection=$,ue.promise=Q,ue.zone=q.current,ue.task=q.currentTask,_e.push(ue),B.scheduleMicroTask()}}}return Q}const j=ie("rejectionHandledHandler");function K(Q){if(Q[de]===Te){try{const z=q[j];z&&typeof z=="function"&&z.call(this,{rejection:Q[te],promise:Q})}catch{}Q[de]=he;for(let z=0;z<_e.length;z++)Q===_e[z].promise&&_e.splice(z,1)}}function Y(Q,z,$,X,pe){K(Q);const Se=Q[de],ue=Se?typeof X=="function"?X:Ge:typeof pe=="function"?pe:ke;z.scheduleMicroTask(be,()=>{try{const Ae=Q[te],ve=!!$&&Ce===$[Ce];ve&&($[Ie]=Ae,$[Fe]=Se);const Pe=z.run(ue,void 0,ve&&ue!==ke&&ue!==Ge?[]:[Ae]);Oe($,!0,Pe)}catch(Ae){Oe($,!1,Ae)}},$)}const ae="function ZoneAwarePromise() { [native code] }",Le=function(){},Ze=H.AggregateError;class Ne{static toString(){return ae}static resolve(z){return z instanceof Ne?z:Oe(new this(null),xe,z)}static reject(z){return Oe(new this(null),he,z)}static withResolvers(){const z={};return z.promise=new Ne(($,X)=>{z.resolve=$,z.reject=X}),z}static any(z){if(!z||typeof z[Symbol.iterator]!="function")return Promise.reject(new Ze([],"All promises were rejected"));const $=[];let X=0;try{for(let ue of z)X++,$.push(Ne.resolve(ue))}catch{return Promise.reject(new Ze([],"All promises were rejected"))}if(X===0)return Promise.reject(new Ze([],"All promises were rejected"));let pe=!1;const Se=[];return new Ne((ue,Ae)=>{for(let ve=0;ve<$.length;ve++)$[ve].then(Pe=>{pe||(pe=!0,ue(Pe))},Pe=>{Se.push(Pe),X--,X===0&&(pe=!0,Ae(new Ze(Se,"All promises were rejected")))})})}static race(z){let $,X,pe=new this((Ae,ve)=>{$=Ae,X=ve});function Se(Ae){$(Ae)}function ue(Ae){X(Ae)}for(let Ae of z)Be(Ae)||(Ae=this.resolve(Ae)),Ae.then(Se,ue);return pe}static all(z){return Ne.allWithCallback(z)}static allSettled(z){return(this&&this.prototype instanceof Ne?this:Ne).allWithCallback(z,{thenCallback:X=>({status:"fulfilled",value:X}),errorCallback:X=>({status:"rejected",reason:X})})}static allWithCallback(z,$){let X,pe,Se=new this((Pe,De)=>{X=Pe,pe=De}),ue=2,Ae=0;const ve=[];for(let Pe of z){Be(Pe)||(Pe=this.resolve(Pe));const De=Ae;try{Pe.then(we=>{ve[De]=$?$.thenCallback(we):we,ue--,ue===0&&X(ve)},we=>{$?(ve[De]=$.errorCallback(we),ue--,ue===0&&X(ve)):pe(we)})}catch(we){pe(we)}ue++,Ae++}return ue-=2,ue===0&&X(ve),Se}constructor(z){const $=this;if(!($ instanceof Ne))throw new Error("Must be an instanceof Promise.");$[de]=ce,$[te]=[];try{const X=me();z&&z(X(fe($,xe)),X(fe($,he)))}catch(X){Oe($,!1,X)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return Ne}then(z,$){let X=this.constructor?.[Symbol.species];(!X||typeof X!="function")&&(X=this.constructor||Ne);const pe=new X(Le),Se=q.current;return this[de]==ce?this[te].push(Se,pe,z,$):Y(this,Se,pe,z,$),pe}catch(z){return this.then(null,z)}finally(z){let $=this.constructor?.[Symbol.species];(!$||typeof $!="function")&&($=Ne);const X=new $(Le);X[Ce]=Ce;const pe=q.current;return this[de]==ce?this[te].push(pe,X,z,z):Y(this,pe,X,z,z),X}}Ne.resolve=Ne.resolve,Ne.reject=Ne.reject,Ne.race=Ne.race,Ne.all=Ne.all;const rt=H[oe]=H.Promise;H.Promise=Ne;const it=ie("thenPatched");function Ke(Q){const z=Q.prototype,$=Z(z,"then");if($&&($.writable===!1||!$.configurable))return;const X=z.then;z[Ee]=X,Q.prototype.then=function(pe,Se){return new Ne((Ae,ve)=>{X.call(this,Ae,ve)}).then(pe,Se)},Q[it]=!0}B.patchThen=Ke;function lt(Q){return function(z,$){let X=Q.apply(z,$);if(X instanceof Ne)return X;let pe=X.constructor;return pe[it]||Ke(pe),X}}return rt&&(Ke(rt),et(H,"fetch",Q=>lt(Q))),Promise[q.__symbol__("uncaughtPromiseErrors")]=_e,Ne})}function tr(G){G.__load_patch("toString",H=>{const q=Function.prototype.toString,B=F("OriginalDelegate"),Z=F("Promise"),J=F("Error"),se=function(){if(typeof this=="function"){const oe=this[B];if(oe)return typeof oe=="function"?q.call(oe):Object.prototype.toString.call(oe);if(this===Promise){const Ee=H[Z];if(Ee)return q.call(Ee)}if(this===Error){const Ee=H[J];if(Ee)return q.call(Ee)}}return q.call(this)};se[B]=q,Function.prototype.toString=se;const ie=Object.prototype.toString,_e="[object Promise]";Object.prototype.toString=function(){return typeof Promise=="function"&&this instanceof Promise?_e:ie.call(this)}})}function rr(G,H,q,B,Z){const J=Zone.__symbol__(B);if(H[J])return;const se=H[J]=H[B];H[B]=function(ie,_e,ye){return _e&&_e.prototype&&Z.forEach(function(oe){const Ee=`${q}.${B}::`+oe,ge=_e.prototype;try{if(ge.hasOwnProperty(oe)){const Me=G.ObjectGetOwnPropertyDescriptor(ge,oe);Me&&Me.value?(Me.value=G.wrapWithCurrentZone(Me.value,Ee),G._redefineProperty(_e.prototype,oe,Me)):ge[oe]&&(ge[oe]=G.wrapWithCurrentZone(ge[oe],Ee))}else ge[oe]&&(ge[oe]=G.wrapWithCurrentZone(ge[oe],Ee))}catch{}}),se.call(H,ie,_e,ye)},G.attachOriginToPatched(H[B],se)}function nr(G){G.__load_patch("util",(H,q,B)=>{const Z=mt(H);B.patchOnProperties=Ot,B.patchMethod=et,B.bindArguments=Re,B.patchMacroTask=Yt;const J=q.__symbol__("BLACK_LISTED_EVENTS"),se=q.__symbol__("UNPATCHED_EVENTS");H[se]&&(H[J]=H[se]),H[J]&&(q[J]=q[se]=H[J]),B.patchEventPrototype=Zt,B.patchEventTarget=Kt,B.isIEOrEdge=$t,B.ObjectDefineProperty=R,B.ObjectGetOwnPropertyDescriptor=O,B.ObjectCreate=D,B.ArraySlice=U,B.patchClass=_t,B.wrapWithCurrentZone=V,B.filterProperties=wt,B.attachOriginToPatched=tt,B._redefineProperty=Object.defineProperty,B.patchCallbacks=rr,B.getGlobalObjects=()=>({globalSources:Mt,zoneSymbolEventNames:qe,eventNames:Z,isBrowser:ft,isMix:vt,isNode:at,TRUE_STR:N,FALSE_STR:I,ZONE_SYMBOL_PREFIX:x,ADD_EVENT_LISTENER_STR:C,REMOVE_EVENT_LISTENER_STR:L})})}function or(G){er(G),tr(G),nr(G)}const xt=P();return or(xt),Qt(xt),zone}requireZone();const index$2=Object.freeze(Object.defineProperty({__proto__:null,ZoneContextManager},Symbol.toStringTag,{value:"Module"}));var detectResources$1={},Resource={};const require$$1$1=getAugmentedNamespace(esm$2),require$$1=getAugmentedNamespace(esm$1),require$$2=getAugmentedNamespace(esm);var browser={},defaultServiceName={},hasRequiredDefaultServiceName;function requireDefaultServiceName(){if(hasRequiredDefaultServiceName)return defaultServiceName;hasRequiredDefaultServiceName=1,Object.defineProperty(defaultServiceName,"__esModule",{value:!0}),defaultServiceName.defaultServiceName=void 0;function S(){return"unknown_service"}return defaultServiceName.defaultServiceName=S,defaultServiceName}var hasRequiredBrowser;function requireBrowser(){return hasRequiredBrowser||(hasRequiredBrowser=1,(function(S){Object.defineProperty(S,"__esModule",{value:!0}),S.defaultServiceName=void 0;var T=requireDefaultServiceName();Object.defineProperty(S,"defaultServiceName",{enumerable:!0,get:function(){return T.defaultServiceName}})})(browser)),browser}var hasRequiredResource;function requireResource(){if(hasRequiredResource)return Resource;hasRequiredResource=1,Object.defineProperty(Resource,"__esModule",{value:!0}),Resource.Resource=void 0;const S=require$$1$1,T=require$$1,A=require$$2,P=requireBrowser();let O=class pt{constructor(M,D){var U;this._attributes=M,this.asyncAttributesPending=D!=null,this._syncAttributes=(U=this._attributes)!==null&&U!==void 0?U:{},this._asyncAttributesPromise=D?.then(C=>(this._attributes=Object.assign({},this._attributes,C),this.asyncAttributesPending=!1,C),C=>(S.diag.debug("a resource's async attributes promise rejected: %s",C),this.asyncAttributesPending=!1,{}))}static empty(){return pt.EMPTY}static default(){return new pt({[T.SEMRESATTRS_SERVICE_NAME]:(0,P.defaultServiceName)(),[T.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE]:A.SDK_INFO[T.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE],[T.SEMRESATTRS_TELEMETRY_SDK_NAME]:A.SDK_INFO[T.SEMRESATTRS_TELEMETRY_SDK_NAME],[T.SEMRESATTRS_TELEMETRY_SDK_VERSION]:A.SDK_INFO[T.SEMRESATTRS_TELEMETRY_SDK_VERSION]})}get attributes(){var M;return this.asyncAttributesPending&&S.diag.error("Accessing resource attributes before async attributes settled"),(M=this._attributes)!==null&&M!==void 0?M:{}}async waitForAsyncAttributes(){this.asyncAttributesPending&&await this._asyncAttributesPromise}merge(M){var D;if(!M)return this;const U=Object.assign(Object.assign({},this._syncAttributes),(D=M._syncAttributes)!==null&&D!==void 0?D:M.attributes);if(!this._asyncAttributesPromise&&!M._asyncAttributesPromise)return new pt(U);const C=Promise.all([this._asyncAttributesPromise,M._asyncAttributesPromise]).then(([L,y])=>{var _;return Object.assign(Object.assign(Object.assign(Object.assign({},this._syncAttributes),L),(_=M._syncAttributes)!==null&&_!==void 0?_:M.attributes),y)});return new pt(U,C)}};return Resource.Resource=O,O.EMPTY=new O({}),Resource}var utils={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils;hasRequiredUtils=1,Object.defineProperty(utils,"__esModule",{value:!0}),utils.isPromiseLike=void 0;const S=T=>T!==null&&typeof T=="object"&&typeof T.then=="function";return utils.isPromiseLike=S,utils}var hasRequiredDetectResources;function requireDetectResources(){if(hasRequiredDetectResources)return detectResources$1;hasRequiredDetectResources=1,Object.defineProperty(detectResources$1,"__esModule",{value:!0}),detectResources$1.detectResourcesSync=detectResources$1.detectResources=void 0;const S=requireResource(),T=require$$1$1,A=requireUtils(),P=async(M={})=>{const D=await Promise.all((M.detectors||[]).map(async U=>{try{const C=await U.detect(M);return T.diag.debug(`${U.constructor.name} found resource.`,C),C}catch(C){return T.diag.debug(`${U.constructor.name} failed: ${C.message}`),S.Resource.empty()}}));return R(D),D.reduce((U,C)=>U.merge(C),S.Resource.empty())};detectResources$1.detectResources=P;const O=(M={})=>{var D;const U=((D=M.detectors)!==null&&D!==void 0?D:[]).map(L=>{try{const y=L.detect(M);let _;if((0,A.isPromiseLike)(y)){const N=async()=>{var I;const x=await y;return await((I=x.waitForAsyncAttributes)===null||I===void 0?void 0:I.call(x)),x.attributes};_=new S.Resource({},N())}else _=y;return _.waitForAsyncAttributes?_.waitForAsyncAttributes().then(()=>T.diag.debug(`${L.constructor.name} found resource.`,_)):T.diag.debug(`${L.constructor.name} found resource.`,_),_}catch(y){return T.diag.error(`${L.constructor.name} failed: ${y.message}`),S.Resource.empty()}}),C=U.reduce((L,y)=>L.merge(y),S.Resource.empty());return C.waitForAsyncAttributes&&C.waitForAsyncAttributes().then(()=>{R(U)}),C};detectResources$1.detectResourcesSync=O;const R=M=>{M.forEach(D=>{if(Object.keys(D.attributes).length>0){const U=JSON.stringify(D.attributes,null,4);T.diag.verbose(U)}})};return detectResources$1}var detectResourcesExports=requireDetectResources();const detectResources=_mergeNamespaces({__proto__:null},[detectResourcesExports]);var OTLPExporterBase=(function(){function S(T){this._delegate=T}return S.prototype.export=function(T,A){this._delegate.export(T,A)},S.prototype.forceFlush=function(){return this._delegate.forceFlush()},S.prototype.shutdown=function(){return this._delegate.shutdown()},S})(),__extends$1=(function(){var S=function(T,A){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,O){P.__proto__=O}||function(P,O){for(var R in O)Object.prototype.hasOwnProperty.call(O,R)&&(P[R]=O[R])},S(T,A)};return function(T,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");S(T,A);function P(){this.constructor=T}T.prototype=A===null?Object.create(A):(P.prototype=A.prototype,new P)}})(),OTLPExporterError=(function(S){__extends$1(T,S);function T(A,P,O){var R=S.call(this,A)||this;return R.name="OTLPExporterError",R.data=O,R.code=P,R}return T})(Error);function validateTimeoutMillis(S){if(!Number.isNaN(S)&&Number.isFinite(S)&&S>0)return S;throw new Error("Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '"+S+"')")}function wrapStaticHeadersInFunction(S){if(S!=null)return function(){return S}}function mergeOtlpSharedConfigurationWithDefaults(S,T,A){var P,O,R,M,D,U;return{timeoutMillis:validateTimeoutMillis((O=(P=S.timeoutMillis)!==null&&P!==void 0?P:T.timeoutMillis)!==null&&O!==void 0?O:A.timeoutMillis),concurrencyLimit:(M=(R=S.concurrencyLimit)!==null&&R!==void 0?R:T.concurrencyLimit)!==null&&M!==void 0?M:A.concurrencyLimit,compression:(U=(D=S.compression)!==null&&D!==void 0?D:T.compression)!==null&&U!==void 0?U:A.compression}}function getSharedConfigurationDefaults(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var __awaiter$2=function(S,T,A,P){function O(R){return R instanceof A?R:new A(function(M){M(R)})}return new(A||(A=Promise))(function(R,M){function D(L){try{C(P.next(L))}catch(y){M(y)}}function U(L){try{C(P.throw(L))}catch(y){M(y)}}function C(L){L.done?R(L.value):O(L.value).then(D,U)}C((P=P.apply(S,T||[])).next())})},__generator$2=function(S,T){var A={label:0,sent:function(){if(R[0]&1)throw R[1];return R[1]},trys:[],ops:[]},P,O,R,M;return M={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(M[Symbol.iterator]=function(){return this}),M;function D(C){return function(L){return U([C,L])}}function U(C){if(P)throw new TypeError("Generator is already executing.");for(;A;)try{if(P=1,O&&(R=C[0]&2?O.return:C[0]?O.throw||((R=O.return)&&R.call(O),0):O.next)&&!(R=R.call(O,C[1])).done)return R;switch(O=0,R&&(C=[C[0]&2,R.value]),C[0]){case 0:case 1:R=C;break;case 4:return A.label++,{value:C[1],done:!1};case 5:A.label++,O=C[1],C=[0];continue;case 7:C=A.ops.pop(),A.trys.pop();continue;default:if(R=A.trys,!(R=R.length>0&&R[R.length-1])&&(C[0]===6||C[0]===2)){A=0;continue}if(C[0]===3&&(!R||C[1]>R[0]&&C[1]<R[3])){A.label=C[1];break}if(C[0]===6&&A.label<R[1]){A.label=R[1],R=C;break}if(R&&A.label<R[2]){A.label=R[2],A.ops.push(C);break}R[2]&&A.ops.pop(),A.trys.pop();continue}C=T.call(S,A)}catch(L){C=[6,L],O=0}finally{P=R=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},BoundedQueueExportPromiseHandler=(function(){function S(T){this._sendingPromises=[],this._concurrencyLimit=T}return S.prototype.pushPromise=function(T){var A=this;if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(T);var P=function(){var O=A._sendingPromises.indexOf(T);A._sendingPromises.splice(O,1)};T.then(P,P)},S.prototype.hasReachedLimit=function(){return this._sendingPromises.length>=this._concurrencyLimit},S.prototype.awaitAll=function(){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(T){switch(T.label){case 0:return[4,Promise.all(this._sendingPromises)];case 1:return T.sent(),[2]}})})},S})();function createBoundedQueueExportPromiseHandler(S){return new BoundedQueueExportPromiseHandler(S.concurrencyLimit)}function isPartialSuccessResponse(S){return Object.prototype.hasOwnProperty.call(S,"partialSuccess")}function createLoggingPartialSuccessResponseHandler(){return{handleResponse:function(S){S==null||!isPartialSuccessResponse(S)||S.partialSuccess==null||Object.keys(S.partialSuccess).length===0||diag.warn("Received Partial Success response:",JSON.stringify(S.partialSuccess))}}}var __awaiter$1=function(S,T,A,P){function O(R){return R instanceof A?R:new A(function(M){M(R)})}return new(A||(A=Promise))(function(R,M){function D(L){try{C(P.next(L))}catch(y){M(y)}}function U(L){try{C(P.throw(L))}catch(y){M(y)}}function C(L){L.done?R(L.value):O(L.value).then(D,U)}C((P=P.apply(S,T||[])).next())})},__generator$1=function(S,T){var A={label:0,sent:function(){if(R[0]&1)throw R[1];return R[1]},trys:[],ops:[]},P,O,R,M;return M={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(M[Symbol.iterator]=function(){return this}),M;function D(C){return function(L){return U([C,L])}}function U(C){if(P)throw new TypeError("Generator is already executing.");for(;A;)try{if(P=1,O&&(R=C[0]&2?O.return:C[0]?O.throw||((R=O.return)&&R.call(O),0):O.next)&&!(R=R.call(O,C[1])).done)return R;switch(O=0,R&&(C=[C[0]&2,R.value]),C[0]){case 0:case 1:R=C;break;case 4:return A.label++,{value:C[1],done:!1};case 5:A.label++,O=C[1],C=[0];continue;case 7:C=A.ops.pop(),A.trys.pop();continue;default:if(R=A.trys,!(R=R.length>0&&R[R.length-1])&&(C[0]===6||C[0]===2)){A=0;continue}if(C[0]===3&&(!R||C[1]>R[0]&&C[1]<R[3])){A.label=C[1];break}if(C[0]===6&&A.label<R[1]){A.label=R[1],R=C;break}if(R&&A.label<R[2]){A.label=R[2],A.ops.push(C);break}R[2]&&A.ops.pop(),A.trys.pop();continue}C=T.call(S,A)}catch(L){C=[6,L],O=0}finally{P=R=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},OTLPExportDelegate=(function(){function S(T,A,P,O,R){this._transport=T,this._serializer=A,this._responseHandler=P,this._promiseQueue=O,this._timeout=R,this._diagLogger=diag.createComponentLogger({namespace:"OTLPExportDelegate"})}return S.prototype.export=function(T,A){var P=this;if(this._diagLogger.debug("items to be sent",T),this._promiseQueue.hasReachedLimit()){A({code:ExportResultCode.FAILED,error:new Error("Concurrent export limit reached")});return}var O=this._serializer.serializeRequest(T);if(O==null){A({code:ExportResultCode.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(O,this._timeout).then(function(R){if(R.status==="success"){if(R.data!=null)try{P._responseHandler.handleResponse(P._serializer.deserializeResponse(R.data))}catch(M){P._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",M,R.data)}A({code:ExportResultCode.SUCCESS});return}else if(R.status==="failure"&&R.error){A({code:ExportResultCode.FAILED,error:R.error});return}else R.status==="retryable"?A({code:ExportResultCode.FAILED,error:new OTLPExporterError("Export failed with retryable status")}):A({code:ExportResultCode.FAILED,error:new OTLPExporterError("Export failed with unknown error")})},function(R){return A({code:ExportResultCode.FAILED,error:R})}))},S.prototype.forceFlush=function(){return this._promiseQueue.awaitAll()},S.prototype.shutdown=function(){return __awaiter$1(this,void 0,void 0,function(){return __generator$1(this,function(T){switch(T.label){case 0:return this._diagLogger.debug("shutdown started"),[4,this.forceFlush()];case 1:return T.sent(),this._transport.shutdown(),[2]}})})},S})();function createOtlpExportDelegate(S,T){return new OTLPExportDelegate(S.transport,S.serializer,createLoggingPartialSuccessResponseHandler(),S.promiseHandler,T.timeout)}function createOtlpNetworkExportDelegate(S,T,A){return createOtlpExportDelegate({transport:A,serializer:T,promiseHandler:createBoundedQueueExportPromiseHandler(S)},{timeout:S.timeoutMillis})}var indexMinimal={},minimal$1={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=S;function S(T,A){for(var P=new Array(arguments.length-1),O=0,R=2,M=!0;R<arguments.length;)P[O++]=arguments[R++];return new Promise(function(U,C){P[O]=function(y){if(M)if(M=!1,y)C(y);else{for(var _=new Array(arguments.length-1),N=0;N<_.length;)_[N++]=arguments[N];U.apply(null,_)}};try{T.apply(A||null,P)}catch(L){M&&(M=!1,C(L))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,(function(S){var T=S;T.length=function(D){var U=D.length;if(!U)return 0;for(var C=0;--U%4>1&&D.charAt(U)==="=";)++C;return Math.ceil(D.length*3)/4-C};for(var A=new Array(64),P=new Array(123),O=0;O<64;)P[A[O]=O<26?O+65:O<52?O+71:O<62?O-4:O-59|43]=O++;T.encode=function(D,U,C){for(var L=null,y=[],_=0,N=0,I;U<C;){var x=D[U++];switch(N){case 0:y[_++]=A[x>>2],I=(x&3)<<4,N=1;break;case 1:y[_++]=A[I|x>>4],I=(x&15)<<2,N=2;break;case 2:y[_++]=A[I|x>>6],y[_++]=A[x&63],N=0;break}_>8191&&((L||(L=[])).push(String.fromCharCode.apply(String,y)),_=0)}return N&&(y[_++]=A[I],y[_++]=61,N===1&&(y[_++]=61)),L?(_&&L.push(String.fromCharCode.apply(String,y.slice(0,_))),L.join("")):String.fromCharCode.apply(String,y.slice(0,_))};var R="invalid encoding";T.decode=function(D,U,C){for(var L=C,y=0,_,N=0;N<D.length;){var I=D.charCodeAt(N++);if(I===61&&y>1)break;if((I=P[I])===void 0)throw Error(R);switch(y){case 0:_=I,y=1;break;case 1:U[C++]=_<<2|(I&48)>>4,_=I,y=2;break;case 2:U[C++]=(_&15)<<4|(I&60)>>2,_=I,y=3;break;case 3:U[C++]=(_&3)<<6|I,y=0;break}}if(y===1)throw Error(R);return C-L},T.test=function(D){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(D)}})(base64)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=S;function S(){this._listeners={}}return S.prototype.on=function(A,P,O){return(this._listeners[A]||(this._listeners[A]=[])).push({fn:P,ctx:O||this}),this},S.prototype.off=function(A,P){if(A===void 0)this._listeners={};else if(P===void 0)this._listeners[A]=[];else for(var O=this._listeners[A],R=0;R<O.length;)O[R].fn===P?O.splice(R,1):++R;return this},S.prototype.emit=function(A){var P=this._listeners[A];if(P){for(var O=[],R=1;R<arguments.length;)O.push(arguments[R++]);for(R=0;R<P.length;)P[R].fn.apply(P[R++].ctx,O)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=S(S);function S(R){return typeof Float32Array<"u"?(function(){var M=new Float32Array([-0]),D=new Uint8Array(M.buffer),U=D[3]===128;function C(N,I,x){M[0]=N,I[x]=D[0],I[x+1]=D[1],I[x+2]=D[2],I[x+3]=D[3]}function L(N,I,x){M[0]=N,I[x]=D[3],I[x+1]=D[2],I[x+2]=D[1],I[x+3]=D[0]}R.writeFloatLE=U?C:L,R.writeFloatBE=U?L:C;function y(N,I){return D[0]=N[I],D[1]=N[I+1],D[2]=N[I+2],D[3]=N[I+3],M[0]}function _(N,I){return D[3]=N[I],D[2]=N[I+1],D[1]=N[I+2],D[0]=N[I+3],M[0]}R.readFloatLE=U?y:_,R.readFloatBE=U?_:y})():(function(){function M(U,C,L,y){var _=C<0?1:0;if(_&&(C=-C),C===0)U(1/C>0?0:2147483648,L,y);else if(isNaN(C))U(2143289344,L,y);else if(C>34028234663852886e22)U((_<<31|2139095040)>>>0,L,y);else if(C<11754943508222875e-54)U((_<<31|Math.round(C/1401298464324817e-60))>>>0,L,y);else{var N=Math.floor(Math.log(C)/Math.LN2),I=Math.round(C*Math.pow(2,-N)*8388608)&8388607;U((_<<31|N+127<<23|I)>>>0,L,y)}}R.writeFloatLE=M.bind(null,T),R.writeFloatBE=M.bind(null,A);function D(U,C,L){var y=U(C,L),_=(y>>31)*2+1,N=y>>>23&255,I=y&8388607;return N===255?I?NaN:_*(1/0):N===0?_*1401298464324817e-60*I:_*Math.pow(2,N-150)*(I+8388608)}R.readFloatLE=D.bind(null,P),R.readFloatBE=D.bind(null,O)})(),typeof Float64Array<"u"?(function(){var M=new Float64Array([-0]),D=new Uint8Array(M.buffer),U=D[7]===128;function C(N,I,x){M[0]=N,I[x]=D[0],I[x+1]=D[1],I[x+2]=D[2],I[x+3]=D[3],I[x+4]=D[4],I[x+5]=D[5],I[x+6]=D[6],I[x+7]=D[7]}function L(N,I,x){M[0]=N,I[x]=D[7],I[x+1]=D[6],I[x+2]=D[5],I[x+3]=D[4],I[x+4]=D[3],I[x+5]=D[2],I[x+6]=D[1],I[x+7]=D[0]}R.writeDoubleLE=U?C:L,R.writeDoubleBE=U?L:C;function y(N,I){return D[0]=N[I],D[1]=N[I+1],D[2]=N[I+2],D[3]=N[I+3],D[4]=N[I+4],D[5]=N[I+5],D[6]=N[I+6],D[7]=N[I+7],M[0]}function _(N,I){return D[7]=N[I],D[6]=N[I+1],D[5]=N[I+2],D[4]=N[I+3],D[3]=N[I+4],D[2]=N[I+5],D[1]=N[I+6],D[0]=N[I+7],M[0]}R.readDoubleLE=U?y:_,R.readDoubleBE=U?_:y})():(function(){function M(U,C,L,y,_,N){var I=y<0?1:0;if(I&&(y=-y),y===0)U(0,_,N+C),U(1/y>0?0:2147483648,_,N+L);else if(isNaN(y))U(0,_,N+C),U(2146959360,_,N+L);else if(y>17976931348623157e292)U(0,_,N+C),U((I<<31|2146435072)>>>0,_,N+L);else{var x;if(y<22250738585072014e-324)x=y/5e-324,U(x>>>0,_,N+C),U((I<<31|x/4294967296)>>>0,_,N+L);else{var V=Math.floor(Math.log(y)/Math.LN2);V===1024&&(V=1023),x=y*Math.pow(2,-V),U(x*4503599627370496>>>0,_,N+C),U((I<<31|V+1023<<20|x*1048576&1048575)>>>0,_,N+L)}}}R.writeDoubleLE=M.bind(null,T,0,4),R.writeDoubleBE=M.bind(null,A,4,0);function D(U,C,L,y,_){var N=U(y,_+C),I=U(y,_+L),x=(I>>31)*2+1,V=I>>>20&2047,k=4294967296*(I&1048575)+N;return V===2047?k?NaN:x*(1/0):V===0?x*5e-324*k:x*Math.pow(2,V-1075)*(k+4503599627370496)}R.readDoubleLE=D.bind(null,P,0,4),R.readDoubleBE=D.bind(null,O,4,0)})(),R}function T(R,M,D){M[D]=R&255,M[D+1]=R>>>8&255,M[D+2]=R>>>16&255,M[D+3]=R>>>24}function A(R,M,D){M[D]=R>>>24,M[D+1]=R>>>16&255,M[D+2]=R>>>8&255,M[D+3]=R&255}function P(R,M){return(R[M]|R[M+1]<<8|R[M+2]<<16|R[M+3]<<24)>>>0}function O(R,M){return(R[M]<<24|R[M+1]<<16|R[M+2]<<8|R[M+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(S){}return null}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,(function(S){var T=S;T.length=function(P){for(var O=0,R=0,M=0;M<P.length;++M)R=P.charCodeAt(M),R<128?O+=1:R<2048?O+=2:(R&64512)===55296&&(P.charCodeAt(M+1)&64512)===56320?(++M,O+=4):O+=3;return O},T.read=function(P,O,R){var M=R-O;if(M<1)return"";for(var D=null,U=[],C=0,L;O<R;)L=P[O++],L<128?U[C++]=L:L>191&&L<224?U[C++]=(L&31)<<6|P[O++]&63:L>239&&L<365?(L=((L&7)<<18|(P[O++]&63)<<12|(P[O++]&63)<<6|P[O++]&63)-65536,U[C++]=55296+(L>>10),U[C++]=56320+(L&1023)):U[C++]=(L&15)<<12|(P[O++]&63)<<6|P[O++]&63,C>8191&&((D||(D=[])).push(String.fromCharCode.apply(String,U)),C=0);return D?(C&&D.push(String.fromCharCode.apply(String,U.slice(0,C))),D.join("")):String.fromCharCode.apply(String,U.slice(0,C))},T.write=function(P,O,R){for(var M=R,D,U,C=0;C<P.length;++C)D=P.charCodeAt(C),D<128?O[R++]=D:D<2048?(O[R++]=D>>6|192,O[R++]=D&63|128):(D&64512)===55296&&((U=P.charCodeAt(C+1))&64512)===56320?(D=65536+((D&1023)<<10)+(U&1023),++C,O[R++]=D>>18|240,O[R++]=D>>12&63|128,O[R++]=D>>6&63|128,O[R++]=D&63|128):(O[R++]=D>>12|224,O[R++]=D>>6&63|128,O[R++]=D&63|128);return R-M}})(utf8)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=S;function S(T,A,P){var O=P||8192,R=O>>>1,M=null,D=O;return function(C){if(C<1||C>R)return T(C);D+C>O&&(M=T(O),D=0);var L=A.call(M,D,D+=C);return D&7&&(D=(D|7)+1),L}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=T;var S=requireMinimal$1();function T(R,M){this.lo=R>>>0,this.hi=M>>>0}var A=T.zero=new T(0,0);A.toNumber=function(){return 0},A.zzEncode=A.zzDecode=function(){return this},A.length=function(){return 1};var P=T.zeroHash="\0\0\0\0\0\0\0\0";T.fromNumber=function(M){if(M===0)return A;var D=M<0;D&&(M=-M);var U=M>>>0,C=(M-U)/4294967296>>>0;return D&&(C=~C>>>0,U=~U>>>0,++U>4294967295&&(U=0,++C>4294967295&&(C=0))),new T(U,C)},T.from=function(M){if(typeof M=="number")return T.fromNumber(M);if(S.isString(M))if(S.Long)M=S.Long.fromString(M);else return T.fromNumber(parseInt(M,10));return M.low||M.high?new T(M.low>>>0,M.high>>>0):A},T.prototype.toNumber=function(M){if(!M&&this.hi>>>31){var D=~this.lo+1>>>0,U=~this.hi>>>0;return D||(U=U+1>>>0),-(D+U*4294967296)}return this.lo+this.hi*4294967296},T.prototype.toLong=function(M){return S.Long?new S.Long(this.lo|0,this.hi|0,!!M):{low:this.lo|0,high:this.hi|0,unsigned:!!M}};var O=String.prototype.charCodeAt;return T.fromHash=function(M){return M===P?A:new T((O.call(M,0)|O.call(M,1)<<8|O.call(M,2)<<16|O.call(M,3)<<24)>>>0,(O.call(M,4)|O.call(M,5)<<8|O.call(M,6)<<16|O.call(M,7)<<24)>>>0)},T.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},T.prototype.zzEncode=function(){var M=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^M)>>>0,this.lo=(this.lo<<1^M)>>>0,this},T.prototype.zzDecode=function(){var M=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^M)>>>0,this.hi=(this.hi>>>1^M)>>>0,this},T.prototype.length=function(){var M=this.lo,D=(this.lo>>>28|this.hi<<4)>>>0,U=this.hi>>>24;return U===0?D===0?M<16384?M<128?1:2:M<2097152?3:4:D<16384?D<128?5:6:D<2097152?7:8:U<128?9:10},longbits}var hasRequiredMinimal$1;function requireMinimal$1(){return hasRequiredMinimal$1||(hasRequiredMinimal$1=1,(function(S){var T=S;T.asPromise=requireAspromise(),T.base64=requireBase64(),T.EventEmitter=requireEventemitter(),T.float=requireFloat(),T.inquire=requireInquire(),T.utf8=requireUtf8(),T.pool=requirePool(),T.LongBits=requireLongbits(),T.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),T.global=T.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||minimal$1,T.emptyArray=Object.freeze?Object.freeze([]):[],T.emptyObject=Object.freeze?Object.freeze({}):{},T.isInteger=Number.isInteger||function(R){return typeof R=="number"&&isFinite(R)&&Math.floor(R)===R},T.isString=function(R){return typeof R=="string"||R instanceof String},T.isObject=function(R){return R&&typeof R=="object"},T.isset=T.isSet=function(R,M){var D=R[M];return D!=null&&R.hasOwnProperty(M)?typeof D!="object"||(Array.isArray(D)?D.length:Object.keys(D).length)>0:!1},T.Buffer=(function(){try{var O=T.inquire("buffer").Buffer;return O.prototype.utf8Write?O:null}catch{return null}})(),T._Buffer_from=null,T._Buffer_allocUnsafe=null,T.newBuffer=function(R){return typeof R=="number"?T.Buffer?T._Buffer_allocUnsafe(R):new T.Array(R):T.Buffer?T._Buffer_from(R):typeof Uint8Array>"u"?R:new Uint8Array(R)},T.Array=typeof Uint8Array<"u"?Uint8Array:Array,T.Long=T.global.dcodeIO&&T.global.dcodeIO.Long||T.global.Long||T.inquire("long"),T.key2Re=/^true|false|0|1$/,T.key32Re=/^-?(?:0|[1-9][0-9]*)$/,T.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,T.longToHash=function(R){return R?T.LongBits.from(R).toHash():T.LongBits.zeroHash},T.longFromHash=function(R,M){var D=T.LongBits.fromHash(R);return T.Long?T.Long.fromBits(D.lo,D.hi,M):D.toNumber(!!M)};function A(O,R,M){for(var D=Object.keys(R),U=0;U<D.length;++U)(O[D[U]]===void 0||!M)&&(O[D[U]]=R[D[U]]);return O}T.merge=A,T.lcFirst=function(R){return R.charAt(0).toLowerCase()+R.substring(1)};function P(O){function R(M,D){if(!(this instanceof R))return new R(M,D);Object.defineProperty(this,"message",{get:function(){return M}}),Error.captureStackTrace?Error.captureStackTrace(this,R):Object.defineProperty(this,"stack",{value:new Error().stack||""}),D&&A(this,D)}return R.prototype=Object.create(Error.prototype,{constructor:{value:R,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return O},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),R}T.newError=P,T.ProtocolError=P("ProtocolError"),T.oneOfGetter=function(R){for(var M={},D=0;D<R.length;++D)M[R[D]]=1;return function(){for(var U=Object.keys(this),C=U.length-1;C>-1;--C)if(M[U[C]]===1&&this[U[C]]!==void 0&&this[U[C]]!==null)return U[C]}},T.oneOfSetter=function(R){return function(M){for(var D=0;D<R.length;++D)R[D]!==M&&delete this[R[D]]}},T.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},T._configure=function(){var O=T.Buffer;if(!O){T._Buffer_from=T._Buffer_allocUnsafe=null;return}T._Buffer_from=O.from!==Uint8Array.from&&O.from||function(M,D){return new O(M,D)},T._Buffer_allocUnsafe=O.allocUnsafe||function(M){return new O(M)}}})(minimal$1)),minimal$1}var writer,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=U;var S=requireMinimal$1(),T,A=S.LongBits,P=S.base64,O=S.utf8;function R(V,k,F){this.fn=V,this.len=k,this.next=void 0,this.val=F}function M(){}function D(V){this.head=V.head,this.tail=V.tail,this.len=V.len,this.next=V.states}function U(){this.len=0,this.head=new R(M,0,0),this.tail=this.head,this.states=null}var C=function(){return S.Buffer?function(){return(U.create=function(){return new T})()}:function(){return new U}};U.create=C(),U.alloc=function(k){return new S.Array(k)},S.Array!==Array&&(U.alloc=S.pool(U.alloc,S.Array.prototype.subarray)),U.prototype._push=function(k,F,W){return this.tail=this.tail.next=new R(k,F,W),this.len+=F,this};function L(V,k,F){k[F]=V&255}function y(V,k,F){for(;V>127;)k[F++]=V&127|128,V>>>=7;k[F]=V}function _(V,k){this.len=V,this.next=void 0,this.val=k}_.prototype=Object.create(R.prototype),_.prototype.fn=y,U.prototype.uint32=function(k){return this.len+=(this.tail=this.tail.next=new _((k=k>>>0)<128?1:k<16384?2:k<2097152?3:k<268435456?4:5,k)).len,this},U.prototype.int32=function(k){return k<0?this._push(N,10,A.fromNumber(k)):this.uint32(k)},U.prototype.sint32=function(k){return this.uint32((k<<1^k>>31)>>>0)};function N(V,k,F){for(;V.hi;)k[F++]=V.lo&127|128,V.lo=(V.lo>>>7|V.hi<<25)>>>0,V.hi>>>=7;for(;V.lo>127;)k[F++]=V.lo&127|128,V.lo=V.lo>>>7;k[F++]=V.lo}U.prototype.uint64=function(k){var F=A.from(k);return this._push(N,F.length(),F)},U.prototype.int64=U.prototype.uint64,U.prototype.sint64=function(k){var F=A.from(k).zzEncode();return this._push(N,F.length(),F)},U.prototype.bool=function(k){return this._push(L,1,k?1:0)};function I(V,k,F){k[F]=V&255,k[F+1]=V>>>8&255,k[F+2]=V>>>16&255,k[F+3]=V>>>24}U.prototype.fixed32=function(k){return this._push(I,4,k>>>0)},U.prototype.sfixed32=U.prototype.fixed32,U.prototype.fixed64=function(k){var F=A.from(k);return this._push(I,4,F.lo)._push(I,4,F.hi)},U.prototype.sfixed64=U.prototype.fixed64,U.prototype.float=function(k){return this._push(S.float.writeFloatLE,4,k)},U.prototype.double=function(k){return this._push(S.float.writeDoubleLE,8,k)};var x=S.Array.prototype.set?function(k,F,W){F.set(k,W)}:function(k,F,W){for(var ee=0;ee<k.length;++ee)F[W+ee]=k[ee]};return U.prototype.bytes=function(k){var F=k.length>>>0;if(!F)return this._push(L,1,0);if(S.isString(k)){var W=U.alloc(F=P.length(k));P.decode(k,W,0),k=W}return this.uint32(F)._push(x,F,k)},U.prototype.string=function(k){var F=O.length(k);return F?this.uint32(F)._push(O.write,F,k):this._push(L,1,0)},U.prototype.fork=function(){return this.states=new D(this),this.head=this.tail=new R(M,0,0),this.len=0,this},U.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new R(M,0,0),this.len=0),this},U.prototype.ldelim=function(){var k=this.head,F=this.tail,W=this.len;return this.reset().uint32(W),W&&(this.tail.next=k.next,this.tail=F,this.len+=W),this},U.prototype.finish=function(){for(var k=this.head.next,F=this.constructor.alloc(this.len),W=0;k;)k.fn(k.val,F,W),W+=k.len,k=k.next;return F},U._configure=function(V){T=V,U.create=C(),T._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=A;var S=requireWriter();(A.prototype=Object.create(S.prototype)).constructor=A;var T=requireMinimal$1();function A(){S.call(this)}A._configure=function(){A.alloc=T._Buffer_allocUnsafe,A.writeBytesBuffer=T.Buffer&&T.Buffer.prototype instanceof Uint8Array&&T.Buffer.prototype.set.name==="set"?function(R,M,D){M.set(R,D)}:function(R,M,D){if(R.copy)R.copy(M,D,0,R.length);else for(var U=0;U<R.length;)M[D++]=R[U++]}},A.prototype.bytes=function(R){T.isString(R)&&(R=T._Buffer_from(R,"base64"));var M=R.length>>>0;return this.uint32(M),M&&this._push(A.writeBytesBuffer,M,R),this};function P(O,R,M){O.length<40?T.utf8.write(O,R,M):R.utf8Write?R.utf8Write(O,M):R.write(O,M)}return A.prototype.string=function(R){var M=T.Buffer.byteLength(R);return this.uint32(M),M&&this._push(P,M,R),this},A._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=R;var S=requireMinimal$1(),T,A=S.LongBits,P=S.utf8;function O(y,_){return RangeError("index out of range: "+y.pos+" + "+(_||1)+" > "+y.len)}function R(y){this.buf=y,this.pos=0,this.len=y.length}var M=typeof Uint8Array<"u"?function(_){if(_ instanceof Uint8Array||Array.isArray(_))return new R(_);throw Error("illegal buffer")}:function(_){if(Array.isArray(_))return new R(_);throw Error("illegal buffer")},D=function(){return S.Buffer?function(N){return(R.create=function(x){return S.Buffer.isBuffer(x)?new T(x):M(x)})(N)}:M};R.create=D(),R.prototype._slice=S.Array.prototype.subarray||S.Array.prototype.slice,R.prototype.uint32=(function(){var _=4294967295;return function(){if(_=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(_=(_|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(_=(_|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(_=(_|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(_=(_|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return _;if((this.pos+=5)>this.len)throw this.pos=this.len,O(this,10);return _}})(),R.prototype.int32=function(){return this.uint32()|0},R.prototype.sint32=function(){var _=this.uint32();return _>>>1^-(_&1)|0};function U(){var y=new A(0,0),_=0;if(this.len-this.pos>4){for(;_<4;++_)if(y.lo=(y.lo|(this.buf[this.pos]&127)<<_*7)>>>0,this.buf[this.pos++]<128)return y;if(y.lo=(y.lo|(this.buf[this.pos]&127)<<28)>>>0,y.hi=(y.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return y;_=0}else{for(;_<3;++_){if(this.pos>=this.len)throw O(this);if(y.lo=(y.lo|(this.buf[this.pos]&127)<<_*7)>>>0,this.buf[this.pos++]<128)return y}return y.lo=(y.lo|(this.buf[this.pos++]&127)<<_*7)>>>0,y}if(this.len-this.pos>4){for(;_<5;++_)if(y.hi=(y.hi|(this.buf[this.pos]&127)<<_*7+3)>>>0,this.buf[this.pos++]<128)return y}else for(;_<5;++_){if(this.pos>=this.len)throw O(this);if(y.hi=(y.hi|(this.buf[this.pos]&127)<<_*7+3)>>>0,this.buf[this.pos++]<128)return y}throw Error("invalid varint encoding")}R.prototype.bool=function(){return this.uint32()!==0};function C(y,_){return(y[_-4]|y[_-3]<<8|y[_-2]<<16|y[_-1]<<24)>>>0}R.prototype.fixed32=function(){if(this.pos+4>this.len)throw O(this,4);return C(this.buf,this.pos+=4)},R.prototype.sfixed32=function(){if(this.pos+4>this.len)throw O(this,4);return C(this.buf,this.pos+=4)|0};function L(){if(this.pos+8>this.len)throw O(this,8);return new A(C(this.buf,this.pos+=4),C(this.buf,this.pos+=4))}return R.prototype.float=function(){if(this.pos+4>this.len)throw O(this,4);var _=S.float.readFloatLE(this.buf,this.pos);return this.pos+=4,_},R.prototype.double=function(){if(this.pos+8>this.len)throw O(this,4);var _=S.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,_},R.prototype.bytes=function(){var _=this.uint32(),N=this.pos,I=this.pos+_;if(I>this.len)throw O(this,_);if(this.pos+=_,Array.isArray(this.buf))return this.buf.slice(N,I);if(N===I){var x=S.Buffer;return x?x.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,N,I)},R.prototype.string=function(){var _=this.bytes();return P.read(_,0,_.length)},R.prototype.skip=function(_){if(typeof _=="number"){if(this.pos+_>this.len)throw O(this,_);this.pos+=_}else do if(this.pos>=this.len)throw O(this);while(this.buf[this.pos++]&128);return this},R.prototype.skipType=function(y){switch(y){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(y=this.uint32()&7)!==4;)this.skipType(y);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+y+" at offset "+this.pos)}return this},R._configure=function(y){T=y,R.create=D(),T._configure();var _=S.Long?"toLong":"toNumber";S.merge(R.prototype,{int64:function(){return U.call(this)[_](!1)},uint64:function(){return U.call(this)[_](!0)},sint64:function(){return U.call(this).zzDecode()[_](!1)},fixed64:function(){return L.call(this)[_](!0)},sfixed64:function(){return L.call(this)[_](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=A;var S=requireReader();(A.prototype=Object.create(S.prototype)).constructor=A;var T=requireMinimal$1();function A(P){S.call(this,P)}return A._configure=function(){T.Buffer&&(A.prototype._slice=T.Buffer.prototype.slice)},A.prototype.string=function(){var O=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+O,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+O,this.len))},A._configure(),reader_buffer}var rpc={},service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=T;var S=requireMinimal$1();(T.prototype=Object.create(S.EventEmitter.prototype)).constructor=T;function T(A,P,O){if(typeof A!="function")throw TypeError("rpcImpl must be a function");S.EventEmitter.call(this),this.rpcImpl=A,this.requestDelimited=!!P,this.responseDelimited=!!O}return T.prototype.rpcCall=function A(P,O,R,M,D){if(!M)throw TypeError("request must be specified");var U=this;if(!D)return S.asPromise(A,U,P,O,R,M);if(!U.rpcImpl){setTimeout(function(){D(Error("already ended"))},0);return}try{return U.rpcImpl(P,O[U.requestDelimited?"encodeDelimited":"encode"](M).finish(),function(L,y){if(L)return U.emit("error",L,P),D(L);if(y===null){U.end(!0);return}if(!(y instanceof R))try{y=R[U.responseDelimited?"decodeDelimited":"decode"](y)}catch(_){return U.emit("error",_,P),D(_)}return U.emit("data",y,P),D(null,y)})}catch(C){U.emit("error",C,P),setTimeout(function(){D(C)},0);return}},T.prototype.end=function(P){return this.rpcImpl&&(P||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,(function(S){var T=S;T.Service=requireService()})(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,(function(S){var T=S;T.build="minimal",T.Writer=requireWriter(),T.BufferWriter=requireWriter_buffer(),T.Reader=requireReader(),T.BufferReader=requireReader_buffer(),T.util=requireMinimal$1(),T.rpc=requireRpc(),T.roots=requireRoots(),T.configure=A;function A(){T.util._configure(),T.Writer._configure(T.BufferWriter),T.Reader._configure(T.BufferReader)}A()})(indexMinimal)),indexMinimal}var minimal,hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,minimal=requireIndexMinimal()),minimal}var root,hasRequiredRoot;function requireRoot(){if(hasRequiredRoot)return root;hasRequiredRoot=1;var S=requireMinimal(),T=S.Reader,A=S.Writer,P=S.util,O=S.roots.default||(S.roots.default={});return O.opentelemetry=(function(){var R={};return R.proto=(function(){var M={};return M.common=(function(){var D={};return D.v1=(function(){var U={};return U.AnyValue=(function(){function C(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.stringValue=null,C.prototype.boolValue=null,C.prototype.intValue=null,C.prototype.doubleValue=null,C.prototype.arrayValue=null,C.prototype.kvlistValue=null,C.prototype.bytesValue=null;var L;return Object.defineProperty(C.prototype,"value",{get:P.oneOfGetter(L=["stringValue","boolValue","intValue","doubleValue","arrayValue","kvlistValue","bytesValue"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){return N||(N=A.create()),_.stringValue!=null&&Object.hasOwnProperty.call(_,"stringValue")&&N.uint32(10).string(_.stringValue),_.boolValue!=null&&Object.hasOwnProperty.call(_,"boolValue")&&N.uint32(16).bool(_.boolValue),_.intValue!=null&&Object.hasOwnProperty.call(_,"intValue")&&N.uint32(24).int64(_.intValue),_.doubleValue!=null&&Object.hasOwnProperty.call(_,"doubleValue")&&N.uint32(33).double(_.doubleValue),_.arrayValue!=null&&Object.hasOwnProperty.call(_,"arrayValue")&&O.opentelemetry.proto.common.v1.ArrayValue.encode(_.arrayValue,N.uint32(42).fork()).ldelim(),_.kvlistValue!=null&&Object.hasOwnProperty.call(_,"kvlistValue")&&O.opentelemetry.proto.common.v1.KeyValueList.encode(_.kvlistValue,N.uint32(50).fork()).ldelim(),_.bytesValue!=null&&Object.hasOwnProperty.call(_,"bytesValue")&&N.uint32(58).bytes(_.bytesValue),N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.common.v1.AnyValue;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.stringValue=_.string();break}case 2:{x.boolValue=_.bool();break}case 3:{x.intValue=_.int64();break}case 4:{x.doubleValue=_.double();break}case 5:{x.arrayValue=O.opentelemetry.proto.common.v1.ArrayValue.decode(_,_.uint32());break}case 6:{x.kvlistValue=O.opentelemetry.proto.common.v1.KeyValueList.decode(_,_.uint32());break}case 7:{x.bytesValue=_.bytes();break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";var N={};if(_.stringValue!=null&&_.hasOwnProperty("stringValue")&&(N.value=1,!P.isString(_.stringValue)))return"stringValue: string expected";if(_.boolValue!=null&&_.hasOwnProperty("boolValue")){if(N.value===1)return"value: multiple values";if(N.value=1,typeof _.boolValue!="boolean")return"boolValue: boolean expected"}if(_.intValue!=null&&_.hasOwnProperty("intValue")){if(N.value===1)return"value: multiple values";if(N.value=1,!P.isInteger(_.intValue)&&!(_.intValue&&P.isInteger(_.intValue.low)&&P.isInteger(_.intValue.high)))return"intValue: integer|Long expected"}if(_.doubleValue!=null&&_.hasOwnProperty("doubleValue")){if(N.value===1)return"value: multiple values";if(N.value=1,typeof _.doubleValue!="number")return"doubleValue: number expected"}if(_.arrayValue!=null&&_.hasOwnProperty("arrayValue")){if(N.value===1)return"value: multiple values";N.value=1;{var I=O.opentelemetry.proto.common.v1.ArrayValue.verify(_.arrayValue);if(I)return"arrayValue."+I}}if(_.kvlistValue!=null&&_.hasOwnProperty("kvlistValue")){if(N.value===1)return"value: multiple values";N.value=1;{var I=O.opentelemetry.proto.common.v1.KeyValueList.verify(_.kvlistValue);if(I)return"kvlistValue."+I}}if(_.bytesValue!=null&&_.hasOwnProperty("bytesValue")){if(N.value===1)return"value: multiple values";if(N.value=1,!(_.bytesValue&&typeof _.bytesValue.length=="number"||P.isString(_.bytesValue)))return"bytesValue: buffer expected"}return null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.common.v1.AnyValue)return _;var N=new O.opentelemetry.proto.common.v1.AnyValue;if(_.stringValue!=null&&(N.stringValue=String(_.stringValue)),_.boolValue!=null&&(N.boolValue=!!_.boolValue),_.intValue!=null&&(P.Long?(N.intValue=P.Long.fromValue(_.intValue)).unsigned=!1:typeof _.intValue=="string"?N.intValue=parseInt(_.intValue,10):typeof _.intValue=="number"?N.intValue=_.intValue:typeof _.intValue=="object"&&(N.intValue=new P.LongBits(_.intValue.low>>>0,_.intValue.high>>>0).toNumber())),_.doubleValue!=null&&(N.doubleValue=Number(_.doubleValue)),_.arrayValue!=null){if(typeof _.arrayValue!="object")throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected");N.arrayValue=O.opentelemetry.proto.common.v1.ArrayValue.fromObject(_.arrayValue)}if(_.kvlistValue!=null){if(typeof _.kvlistValue!="object")throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected");N.kvlistValue=O.opentelemetry.proto.common.v1.KeyValueList.fromObject(_.kvlistValue)}return _.bytesValue!=null&&(typeof _.bytesValue=="string"?P.base64.decode(_.bytesValue,N.bytesValue=P.newBuffer(P.base64.length(_.bytesValue)),0):_.bytesValue.length>=0&&(N.bytesValue=_.bytesValue)),N},C.toObject=function(_,N){N||(N={});var I={};return _.stringValue!=null&&_.hasOwnProperty("stringValue")&&(I.stringValue=_.stringValue,N.oneofs&&(I.value="stringValue")),_.boolValue!=null&&_.hasOwnProperty("boolValue")&&(I.boolValue=_.boolValue,N.oneofs&&(I.value="boolValue")),_.intValue!=null&&_.hasOwnProperty("intValue")&&(typeof _.intValue=="number"?I.intValue=N.longs===String?String(_.intValue):_.intValue:I.intValue=N.longs===String?P.Long.prototype.toString.call(_.intValue):N.longs===Number?new P.LongBits(_.intValue.low>>>0,_.intValue.high>>>0).toNumber():_.intValue,N.oneofs&&(I.value="intValue")),_.doubleValue!=null&&_.hasOwnProperty("doubleValue")&&(I.doubleValue=N.json&&!isFinite(_.doubleValue)?String(_.doubleValue):_.doubleValue,N.oneofs&&(I.value="doubleValue")),_.arrayValue!=null&&_.hasOwnProperty("arrayValue")&&(I.arrayValue=O.opentelemetry.proto.common.v1.ArrayValue.toObject(_.arrayValue,N),N.oneofs&&(I.value="arrayValue")),_.kvlistValue!=null&&_.hasOwnProperty("kvlistValue")&&(I.kvlistValue=O.opentelemetry.proto.common.v1.KeyValueList.toObject(_.kvlistValue,N),N.oneofs&&(I.value="kvlistValue")),_.bytesValue!=null&&_.hasOwnProperty("bytesValue")&&(I.bytesValue=N.bytes===String?P.base64.encode(_.bytesValue,0,_.bytesValue.length):N.bytes===Array?Array.prototype.slice.call(_.bytesValue):_.bytesValue,N.oneofs&&(I.value="bytesValue")),I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.common.v1.AnyValue"},C})(),U.ArrayValue=(function(){function C(L){if(this.values=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.values=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.values!=null&&y.values.length)for(var N=0;N<y.values.length;++N)O.opentelemetry.proto.common.v1.AnyValue.encode(y.values[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.common.v1.ArrayValue;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.values&&I.values.length||(I.values=[]),I.values.push(O.opentelemetry.proto.common.v1.AnyValue.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.values!=null&&y.hasOwnProperty("values")){if(!Array.isArray(y.values))return"values: array expected";for(var _=0;_<y.values.length;++_){var N=O.opentelemetry.proto.common.v1.AnyValue.verify(y.values[_]);if(N)return"values."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.common.v1.ArrayValue)return y;var _=new O.opentelemetry.proto.common.v1.ArrayValue;if(y.values){if(!Array.isArray(y.values))throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected");_.values=[];for(var N=0;N<y.values.length;++N){if(typeof y.values[N]!="object")throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected");_.values[N]=O.opentelemetry.proto.common.v1.AnyValue.fromObject(y.values[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.values=[]),y.values&&y.values.length){N.values=[];for(var I=0;I<y.values.length;++I)N.values[I]=O.opentelemetry.proto.common.v1.AnyValue.toObject(y.values[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.common.v1.ArrayValue"},C})(),U.KeyValueList=(function(){function C(L){if(this.values=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.values=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.values!=null&&y.values.length)for(var N=0;N<y.values.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.values[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.common.v1.KeyValueList;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.values&&I.values.length||(I.values=[]),I.values.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.values!=null&&y.hasOwnProperty("values")){if(!Array.isArray(y.values))return"values: array expected";for(var _=0;_<y.values.length;++_){var N=O.opentelemetry.proto.common.v1.KeyValue.verify(y.values[_]);if(N)return"values."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.common.v1.KeyValueList)return y;var _=new O.opentelemetry.proto.common.v1.KeyValueList;if(y.values){if(!Array.isArray(y.values))throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected");_.values=[];for(var N=0;N<y.values.length;++N){if(typeof y.values[N]!="object")throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected");_.values[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.values[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.values=[]),y.values&&y.values.length){N.values=[];for(var I=0;I<y.values.length;++I)N.values[I]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.values[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.common.v1.KeyValueList"},C})(),U.KeyValue=(function(){function C(L){if(L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.key=null,C.prototype.value=null,C.create=function(y){return new C(y)},C.encode=function(y,_){return _||(_=A.create()),y.key!=null&&Object.hasOwnProperty.call(y,"key")&&_.uint32(10).string(y.key),y.value!=null&&Object.hasOwnProperty.call(y,"value")&&O.opentelemetry.proto.common.v1.AnyValue.encode(y.value,_.uint32(18).fork()).ldelim(),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.common.v1.KeyValue;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.key=y.string();break}case 2:{I.value=O.opentelemetry.proto.common.v1.AnyValue.decode(y,y.uint32());break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.key!=null&&y.hasOwnProperty("key")&&!P.isString(y.key))return"key: string expected";if(y.value!=null&&y.hasOwnProperty("value")){var _=O.opentelemetry.proto.common.v1.AnyValue.verify(y.value);if(_)return"value."+_}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.common.v1.KeyValue)return y;var _=new O.opentelemetry.proto.common.v1.KeyValue;if(y.key!=null&&(_.key=String(y.key)),y.value!=null){if(typeof y.value!="object")throw TypeError(".opentelemetry.proto.common.v1.KeyValue.value: object expected");_.value=O.opentelemetry.proto.common.v1.AnyValue.fromObject(y.value)}return _},C.toObject=function(y,_){_||(_={});var N={};return _.defaults&&(N.key="",N.value=null),y.key!=null&&y.hasOwnProperty("key")&&(N.key=y.key),y.value!=null&&y.hasOwnProperty("value")&&(N.value=O.opentelemetry.proto.common.v1.AnyValue.toObject(y.value,_)),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.common.v1.KeyValue"},C})(),U.InstrumentationScope=(function(){function C(L){if(this.attributes=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.name=null,C.prototype.version=null,C.prototype.attributes=P.emptyArray,C.prototype.droppedAttributesCount=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.name!=null&&Object.hasOwnProperty.call(y,"name")&&_.uint32(10).string(y.name),y.version!=null&&Object.hasOwnProperty.call(y,"version")&&_.uint32(18).string(y.version),y.attributes!=null&&y.attributes.length)for(var N=0;N<y.attributes.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.attributes[N],_.uint32(26).fork()).ldelim();return y.droppedAttributesCount!=null&&Object.hasOwnProperty.call(y,"droppedAttributesCount")&&_.uint32(32).uint32(y.droppedAttributesCount),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.common.v1.InstrumentationScope;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.name=y.string();break}case 2:{I.version=y.string();break}case 3:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}case 4:{I.droppedAttributesCount=y.uint32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.name!=null&&y.hasOwnProperty("name")&&!P.isString(y.name))return"name: string expected";if(y.version!=null&&y.hasOwnProperty("version")&&!P.isString(y.version))return"version: string expected";if(y.attributes!=null&&y.hasOwnProperty("attributes")){if(!Array.isArray(y.attributes))return"attributes: array expected";for(var _=0;_<y.attributes.length;++_){var N=O.opentelemetry.proto.common.v1.KeyValue.verify(y.attributes[_]);if(N)return"attributes."+N}}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(y.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.common.v1.InstrumentationScope)return y;var _=new O.opentelemetry.proto.common.v1.InstrumentationScope;if(y.name!=null&&(_.name=String(y.name)),y.version!=null&&(_.version=String(y.version)),y.attributes){if(!Array.isArray(y.attributes))throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected");_.attributes=[];for(var N=0;N<y.attributes.length;++N){if(typeof y.attributes[N]!="object")throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected");_.attributes[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.attributes[N])}}return y.droppedAttributesCount!=null&&(_.droppedAttributesCount=y.droppedAttributesCount>>>0),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.attributes=[]),_.defaults&&(N.name="",N.version="",N.droppedAttributesCount=0),y.name!=null&&y.hasOwnProperty("name")&&(N.name=y.name),y.version!=null&&y.hasOwnProperty("version")&&(N.version=y.version),y.attributes&&y.attributes.length){N.attributes=[];for(var I=0;I<y.attributes.length;++I)N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.attributes[I],_)}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&(N.droppedAttributesCount=y.droppedAttributesCount),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.common.v1.InstrumentationScope"},C})(),U})(),D})(),M.resource=(function(){var D={};return D.v1=(function(){var U={};return U.Resource=(function(){function C(L){if(this.attributes=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.attributes=P.emptyArray,C.prototype.droppedAttributesCount=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.attributes!=null&&y.attributes.length)for(var N=0;N<y.attributes.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.attributes[N],_.uint32(10).fork()).ldelim();return y.droppedAttributesCount!=null&&Object.hasOwnProperty.call(y,"droppedAttributesCount")&&_.uint32(16).uint32(y.droppedAttributesCount),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.resource.v1.Resource;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}case 2:{I.droppedAttributesCount=y.uint32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.attributes!=null&&y.hasOwnProperty("attributes")){if(!Array.isArray(y.attributes))return"attributes: array expected";for(var _=0;_<y.attributes.length;++_){var N=O.opentelemetry.proto.common.v1.KeyValue.verify(y.attributes[_]);if(N)return"attributes."+N}}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(y.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.resource.v1.Resource)return y;var _=new O.opentelemetry.proto.resource.v1.Resource;if(y.attributes){if(!Array.isArray(y.attributes))throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: array expected");_.attributes=[];for(var N=0;N<y.attributes.length;++N){if(typeof y.attributes[N]!="object")throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: object expected");_.attributes[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.attributes[N])}}return y.droppedAttributesCount!=null&&(_.droppedAttributesCount=y.droppedAttributesCount>>>0),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.attributes=[]),_.defaults&&(N.droppedAttributesCount=0),y.attributes&&y.attributes.length){N.attributes=[];for(var I=0;I<y.attributes.length;++I)N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.attributes[I],_)}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&(N.droppedAttributesCount=y.droppedAttributesCount),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.resource.v1.Resource"},C})(),U})(),D})(),M.trace=(function(){var D={};return D.v1=(function(){var U={};return U.TracesData=(function(){function C(L){if(this.resourceSpans=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resourceSpans=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resourceSpans!=null&&y.resourceSpans.length)for(var N=0;N<y.resourceSpans.length;++N)O.opentelemetry.proto.trace.v1.ResourceSpans.encode(y.resourceSpans[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.trace.v1.TracesData;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resourceSpans&&I.resourceSpans.length||(I.resourceSpans=[]),I.resourceSpans.push(O.opentelemetry.proto.trace.v1.ResourceSpans.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resourceSpans!=null&&y.hasOwnProperty("resourceSpans")){if(!Array.isArray(y.resourceSpans))return"resourceSpans: array expected";for(var _=0;_<y.resourceSpans.length;++_){var N=O.opentelemetry.proto.trace.v1.ResourceSpans.verify(y.resourceSpans[_]);if(N)return"resourceSpans."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.trace.v1.TracesData)return y;var _=new O.opentelemetry.proto.trace.v1.TracesData;if(y.resourceSpans){if(!Array.isArray(y.resourceSpans))throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected");_.resourceSpans=[];for(var N=0;N<y.resourceSpans.length;++N){if(typeof y.resourceSpans[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected");_.resourceSpans[N]=O.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(y.resourceSpans[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.resourceSpans=[]),y.resourceSpans&&y.resourceSpans.length){N.resourceSpans=[];for(var I=0;I<y.resourceSpans.length;++I)N.resourceSpans[I]=O.opentelemetry.proto.trace.v1.ResourceSpans.toObject(y.resourceSpans[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.trace.v1.TracesData"},C})(),U.ResourceSpans=(function(){function C(L){if(this.scopeSpans=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resource=null,C.prototype.scopeSpans=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resource!=null&&Object.hasOwnProperty.call(y,"resource")&&O.opentelemetry.proto.resource.v1.Resource.encode(y.resource,_.uint32(10).fork()).ldelim(),y.scopeSpans!=null&&y.scopeSpans.length)for(var N=0;N<y.scopeSpans.length;++N)O.opentelemetry.proto.trace.v1.ScopeSpans.encode(y.scopeSpans[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.trace.v1.ResourceSpans;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resource=O.opentelemetry.proto.resource.v1.Resource.decode(y,y.uint32());break}case 2:{I.scopeSpans&&I.scopeSpans.length||(I.scopeSpans=[]),I.scopeSpans.push(O.opentelemetry.proto.trace.v1.ScopeSpans.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resource!=null&&y.hasOwnProperty("resource")){var _=O.opentelemetry.proto.resource.v1.Resource.verify(y.resource);if(_)return"resource."+_}if(y.scopeSpans!=null&&y.hasOwnProperty("scopeSpans")){if(!Array.isArray(y.scopeSpans))return"scopeSpans: array expected";for(var N=0;N<y.scopeSpans.length;++N){var _=O.opentelemetry.proto.trace.v1.ScopeSpans.verify(y.scopeSpans[N]);if(_)return"scopeSpans."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.trace.v1.ResourceSpans)return y;var _=new O.opentelemetry.proto.trace.v1.ResourceSpans;if(y.resource!=null){if(typeof y.resource!="object")throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected");_.resource=O.opentelemetry.proto.resource.v1.Resource.fromObject(y.resource)}if(y.scopeSpans){if(!Array.isArray(y.scopeSpans))throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected");_.scopeSpans=[];for(var N=0;N<y.scopeSpans.length;++N){if(typeof y.scopeSpans[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected");_.scopeSpans[N]=O.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(y.scopeSpans[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.scopeSpans=[]),_.defaults&&(N.resource=null,N.schemaUrl=""),y.resource!=null&&y.hasOwnProperty("resource")&&(N.resource=O.opentelemetry.proto.resource.v1.Resource.toObject(y.resource,_)),y.scopeSpans&&y.scopeSpans.length){N.scopeSpans=[];for(var I=0;I<y.scopeSpans.length;++I)N.scopeSpans[I]=O.opentelemetry.proto.trace.v1.ScopeSpans.toObject(y.scopeSpans[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.trace.v1.ResourceSpans"},C})(),U.ScopeSpans=(function(){function C(L){if(this.spans=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.scope=null,C.prototype.spans=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.scope!=null&&Object.hasOwnProperty.call(y,"scope")&&O.opentelemetry.proto.common.v1.InstrumentationScope.encode(y.scope,_.uint32(10).fork()).ldelim(),y.spans!=null&&y.spans.length)for(var N=0;N<y.spans.length;++N)O.opentelemetry.proto.trace.v1.Span.encode(y.spans[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.trace.v1.ScopeSpans;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.decode(y,y.uint32());break}case 2:{I.spans&&I.spans.length||(I.spans=[]),I.spans.push(O.opentelemetry.proto.trace.v1.Span.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.scope!=null&&y.hasOwnProperty("scope")){var _=O.opentelemetry.proto.common.v1.InstrumentationScope.verify(y.scope);if(_)return"scope."+_}if(y.spans!=null&&y.hasOwnProperty("spans")){if(!Array.isArray(y.spans))return"spans: array expected";for(var N=0;N<y.spans.length;++N){var _=O.opentelemetry.proto.trace.v1.Span.verify(y.spans[N]);if(_)return"spans."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.trace.v1.ScopeSpans)return y;var _=new O.opentelemetry.proto.trace.v1.ScopeSpans;if(y.scope!=null){if(typeof y.scope!="object")throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected");_.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(y.scope)}if(y.spans){if(!Array.isArray(y.spans))throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected");_.spans=[];for(var N=0;N<y.spans.length;++N){if(typeof y.spans[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected");_.spans[N]=O.opentelemetry.proto.trace.v1.Span.fromObject(y.spans[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.spans=[]),_.defaults&&(N.scope=null,N.schemaUrl=""),y.scope!=null&&y.hasOwnProperty("scope")&&(N.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.toObject(y.scope,_)),y.spans&&y.spans.length){N.spans=[];for(var I=0;I<y.spans.length;++I)N.spans[I]=O.opentelemetry.proto.trace.v1.Span.toObject(y.spans[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.trace.v1.ScopeSpans"},C})(),U.Span=(function(){function C(L){if(this.attributes=[],this.events=[],this.links=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.traceId=null,C.prototype.spanId=null,C.prototype.traceState=null,C.prototype.parentSpanId=null,C.prototype.name=null,C.prototype.kind=null,C.prototype.startTimeUnixNano=null,C.prototype.endTimeUnixNano=null,C.prototype.attributes=P.emptyArray,C.prototype.droppedAttributesCount=null,C.prototype.events=P.emptyArray,C.prototype.droppedEventsCount=null,C.prototype.links=P.emptyArray,C.prototype.droppedLinksCount=null,C.prototype.status=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.traceId!=null&&Object.hasOwnProperty.call(y,"traceId")&&_.uint32(10).bytes(y.traceId),y.spanId!=null&&Object.hasOwnProperty.call(y,"spanId")&&_.uint32(18).bytes(y.spanId),y.traceState!=null&&Object.hasOwnProperty.call(y,"traceState")&&_.uint32(26).string(y.traceState),y.parentSpanId!=null&&Object.hasOwnProperty.call(y,"parentSpanId")&&_.uint32(34).bytes(y.parentSpanId),y.name!=null&&Object.hasOwnProperty.call(y,"name")&&_.uint32(42).string(y.name),y.kind!=null&&Object.hasOwnProperty.call(y,"kind")&&_.uint32(48).int32(y.kind),y.startTimeUnixNano!=null&&Object.hasOwnProperty.call(y,"startTimeUnixNano")&&_.uint32(57).fixed64(y.startTimeUnixNano),y.endTimeUnixNano!=null&&Object.hasOwnProperty.call(y,"endTimeUnixNano")&&_.uint32(65).fixed64(y.endTimeUnixNano),y.attributes!=null&&y.attributes.length)for(var N=0;N<y.attributes.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.attributes[N],_.uint32(74).fork()).ldelim();if(y.droppedAttributesCount!=null&&Object.hasOwnProperty.call(y,"droppedAttributesCount")&&_.uint32(80).uint32(y.droppedAttributesCount),y.events!=null&&y.events.length)for(var N=0;N<y.events.length;++N)O.opentelemetry.proto.trace.v1.Span.Event.encode(y.events[N],_.uint32(90).fork()).ldelim();if(y.droppedEventsCount!=null&&Object.hasOwnProperty.call(y,"droppedEventsCount")&&_.uint32(96).uint32(y.droppedEventsCount),y.links!=null&&y.links.length)for(var N=0;N<y.links.length;++N)O.opentelemetry.proto.trace.v1.Span.Link.encode(y.links[N],_.uint32(106).fork()).ldelim();return y.droppedLinksCount!=null&&Object.hasOwnProperty.call(y,"droppedLinksCount")&&_.uint32(112).uint32(y.droppedLinksCount),y.status!=null&&Object.hasOwnProperty.call(y,"status")&&O.opentelemetry.proto.trace.v1.Status.encode(y.status,_.uint32(122).fork()).ldelim(),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.trace.v1.Span;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.traceId=y.bytes();break}case 2:{I.spanId=y.bytes();break}case 3:{I.traceState=y.string();break}case 4:{I.parentSpanId=y.bytes();break}case 5:{I.name=y.string();break}case 6:{I.kind=y.int32();break}case 7:{I.startTimeUnixNano=y.fixed64();break}case 8:{I.endTimeUnixNano=y.fixed64();break}case 9:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}case 10:{I.droppedAttributesCount=y.uint32();break}case 11:{I.events&&I.events.length||(I.events=[]),I.events.push(O.opentelemetry.proto.trace.v1.Span.Event.decode(y,y.uint32()));break}case 12:{I.droppedEventsCount=y.uint32();break}case 13:{I.links&&I.links.length||(I.links=[]),I.links.push(O.opentelemetry.proto.trace.v1.Span.Link.decode(y,y.uint32()));break}case 14:{I.droppedLinksCount=y.uint32();break}case 15:{I.status=O.opentelemetry.proto.trace.v1.Status.decode(y,y.uint32());break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.traceId!=null&&y.hasOwnProperty("traceId")&&!(y.traceId&&typeof y.traceId.length=="number"||P.isString(y.traceId)))return"traceId: buffer expected";if(y.spanId!=null&&y.hasOwnProperty("spanId")&&!(y.spanId&&typeof y.spanId.length=="number"||P.isString(y.spanId)))return"spanId: buffer expected";if(y.traceState!=null&&y.hasOwnProperty("traceState")&&!P.isString(y.traceState))return"traceState: string expected";if(y.parentSpanId!=null&&y.hasOwnProperty("parentSpanId")&&!(y.parentSpanId&&typeof y.parentSpanId.length=="number"||P.isString(y.parentSpanId)))return"parentSpanId: buffer expected";if(y.name!=null&&y.hasOwnProperty("name")&&!P.isString(y.name))return"name: string expected";if(y.kind!=null&&y.hasOwnProperty("kind"))switch(y.kind){default:return"kind: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:break}if(y.startTimeUnixNano!=null&&y.hasOwnProperty("startTimeUnixNano")&&!P.isInteger(y.startTimeUnixNano)&&!(y.startTimeUnixNano&&P.isInteger(y.startTimeUnixNano.low)&&P.isInteger(y.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(y.endTimeUnixNano!=null&&y.hasOwnProperty("endTimeUnixNano")&&!P.isInteger(y.endTimeUnixNano)&&!(y.endTimeUnixNano&&P.isInteger(y.endTimeUnixNano.low)&&P.isInteger(y.endTimeUnixNano.high)))return"endTimeUnixNano: integer|Long expected";if(y.attributes!=null&&y.hasOwnProperty("attributes")){if(!Array.isArray(y.attributes))return"attributes: array expected";for(var _=0;_<y.attributes.length;++_){var N=O.opentelemetry.proto.common.v1.KeyValue.verify(y.attributes[_]);if(N)return"attributes."+N}}if(y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(y.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(y.events!=null&&y.hasOwnProperty("events")){if(!Array.isArray(y.events))return"events: array expected";for(var _=0;_<y.events.length;++_){var N=O.opentelemetry.proto.trace.v1.Span.Event.verify(y.events[_]);if(N)return"events."+N}}if(y.droppedEventsCount!=null&&y.hasOwnProperty("droppedEventsCount")&&!P.isInteger(y.droppedEventsCount))return"droppedEventsCount: integer expected";if(y.links!=null&&y.hasOwnProperty("links")){if(!Array.isArray(y.links))return"links: array expected";for(var _=0;_<y.links.length;++_){var N=O.opentelemetry.proto.trace.v1.Span.Link.verify(y.links[_]);if(N)return"links."+N}}if(y.droppedLinksCount!=null&&y.hasOwnProperty("droppedLinksCount")&&!P.isInteger(y.droppedLinksCount))return"droppedLinksCount: integer expected";if(y.status!=null&&y.hasOwnProperty("status")){var N=O.opentelemetry.proto.trace.v1.Status.verify(y.status);if(N)return"status."+N}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.trace.v1.Span)return y;var _=new O.opentelemetry.proto.trace.v1.Span;switch(y.traceId!=null&&(typeof y.traceId=="string"?P.base64.decode(y.traceId,_.traceId=P.newBuffer(P.base64.length(y.traceId)),0):y.traceId.length>=0&&(_.traceId=y.traceId)),y.spanId!=null&&(typeof y.spanId=="string"?P.base64.decode(y.spanId,_.spanId=P.newBuffer(P.base64.length(y.spanId)),0):y.spanId.length>=0&&(_.spanId=y.spanId)),y.traceState!=null&&(_.traceState=String(y.traceState)),y.parentSpanId!=null&&(typeof y.parentSpanId=="string"?P.base64.decode(y.parentSpanId,_.parentSpanId=P.newBuffer(P.base64.length(y.parentSpanId)),0):y.parentSpanId.length>=0&&(_.parentSpanId=y.parentSpanId)),y.name!=null&&(_.name=String(y.name)),y.kind){default:if(typeof y.kind=="number"){_.kind=y.kind;break}break;case"SPAN_KIND_UNSPECIFIED":case 0:_.kind=0;break;case"SPAN_KIND_INTERNAL":case 1:_.kind=1;break;case"SPAN_KIND_SERVER":case 2:_.kind=2;break;case"SPAN_KIND_CLIENT":case 3:_.kind=3;break;case"SPAN_KIND_PRODUCER":case 4:_.kind=4;break;case"SPAN_KIND_CONSUMER":case 5:_.kind=5;break}if(y.startTimeUnixNano!=null&&(P.Long?(_.startTimeUnixNano=P.Long.fromValue(y.startTimeUnixNano)).unsigned=!1:typeof y.startTimeUnixNano=="string"?_.startTimeUnixNano=parseInt(y.startTimeUnixNano,10):typeof y.startTimeUnixNano=="number"?_.startTimeUnixNano=y.startTimeUnixNano:typeof y.startTimeUnixNano=="object"&&(_.startTimeUnixNano=new P.LongBits(y.startTimeUnixNano.low>>>0,y.startTimeUnixNano.high>>>0).toNumber())),y.endTimeUnixNano!=null&&(P.Long?(_.endTimeUnixNano=P.Long.fromValue(y.endTimeUnixNano)).unsigned=!1:typeof y.endTimeUnixNano=="string"?_.endTimeUnixNano=parseInt(y.endTimeUnixNano,10):typeof y.endTimeUnixNano=="number"?_.endTimeUnixNano=y.endTimeUnixNano:typeof y.endTimeUnixNano=="object"&&(_.endTimeUnixNano=new P.LongBits(y.endTimeUnixNano.low>>>0,y.endTimeUnixNano.high>>>0).toNumber())),y.attributes){if(!Array.isArray(y.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: array expected");_.attributes=[];for(var N=0;N<y.attributes.length;++N){if(typeof y.attributes[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: object expected");_.attributes[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.attributes[N])}}if(y.droppedAttributesCount!=null&&(_.droppedAttributesCount=y.droppedAttributesCount>>>0),y.events){if(!Array.isArray(y.events))throw TypeError(".opentelemetry.proto.trace.v1.Span.events: array expected");_.events=[];for(var N=0;N<y.events.length;++N){if(typeof y.events[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.events: object expected");_.events[N]=O.opentelemetry.proto.trace.v1.Span.Event.fromObject(y.events[N])}}if(y.droppedEventsCount!=null&&(_.droppedEventsCount=y.droppedEventsCount>>>0),y.links){if(!Array.isArray(y.links))throw TypeError(".opentelemetry.proto.trace.v1.Span.links: array expected");_.links=[];for(var N=0;N<y.links.length;++N){if(typeof y.links[N]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.links: object expected");_.links[N]=O.opentelemetry.proto.trace.v1.Span.Link.fromObject(y.links[N])}}if(y.droppedLinksCount!=null&&(_.droppedLinksCount=y.droppedLinksCount>>>0),y.status!=null){if(typeof y.status!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.status: object expected");_.status=O.opentelemetry.proto.trace.v1.Status.fromObject(y.status)}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.attributes=[],N.events=[],N.links=[]),_.defaults){if(_.bytes===String?N.traceId="":(N.traceId=[],_.bytes!==Array&&(N.traceId=P.newBuffer(N.traceId))),_.bytes===String?N.spanId="":(N.spanId=[],_.bytes!==Array&&(N.spanId=P.newBuffer(N.spanId))),N.traceState="",_.bytes===String?N.parentSpanId="":(N.parentSpanId=[],_.bytes!==Array&&(N.parentSpanId=P.newBuffer(N.parentSpanId))),N.name="",N.kind=_.enums===String?"SPAN_KIND_UNSPECIFIED":0,P.Long){var I=new P.Long(0,0,!1);N.startTimeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.startTimeUnixNano=_.longs===String?"0":0;if(P.Long){var I=new P.Long(0,0,!1);N.endTimeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.endTimeUnixNano=_.longs===String?"0":0;N.droppedAttributesCount=0,N.droppedEventsCount=0,N.droppedLinksCount=0,N.status=null}if(y.traceId!=null&&y.hasOwnProperty("traceId")&&(N.traceId=_.bytes===String?P.base64.encode(y.traceId,0,y.traceId.length):_.bytes===Array?Array.prototype.slice.call(y.traceId):y.traceId),y.spanId!=null&&y.hasOwnProperty("spanId")&&(N.spanId=_.bytes===String?P.base64.encode(y.spanId,0,y.spanId.length):_.bytes===Array?Array.prototype.slice.call(y.spanId):y.spanId),y.traceState!=null&&y.hasOwnProperty("traceState")&&(N.traceState=y.traceState),y.parentSpanId!=null&&y.hasOwnProperty("parentSpanId")&&(N.parentSpanId=_.bytes===String?P.base64.encode(y.parentSpanId,0,y.parentSpanId.length):_.bytes===Array?Array.prototype.slice.call(y.parentSpanId):y.parentSpanId),y.name!=null&&y.hasOwnProperty("name")&&(N.name=y.name),y.kind!=null&&y.hasOwnProperty("kind")&&(N.kind=_.enums===String?O.opentelemetry.proto.trace.v1.Span.SpanKind[y.kind]===void 0?y.kind:O.opentelemetry.proto.trace.v1.Span.SpanKind[y.kind]:y.kind),y.startTimeUnixNano!=null&&y.hasOwnProperty("startTimeUnixNano")&&(typeof y.startTimeUnixNano=="number"?N.startTimeUnixNano=_.longs===String?String(y.startTimeUnixNano):y.startTimeUnixNano:N.startTimeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.startTimeUnixNano):_.longs===Number?new P.LongBits(y.startTimeUnixNano.low>>>0,y.startTimeUnixNano.high>>>0).toNumber():y.startTimeUnixNano),y.endTimeUnixNano!=null&&y.hasOwnProperty("endTimeUnixNano")&&(typeof y.endTimeUnixNano=="number"?N.endTimeUnixNano=_.longs===String?String(y.endTimeUnixNano):y.endTimeUnixNano:N.endTimeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.endTimeUnixNano):_.longs===Number?new P.LongBits(y.endTimeUnixNano.low>>>0,y.endTimeUnixNano.high>>>0).toNumber():y.endTimeUnixNano),y.attributes&&y.attributes.length){N.attributes=[];for(var x=0;x<y.attributes.length;++x)N.attributes[x]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.attributes[x],_)}if(y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&(N.droppedAttributesCount=y.droppedAttributesCount),y.events&&y.events.length){N.events=[];for(var x=0;x<y.events.length;++x)N.events[x]=O.opentelemetry.proto.trace.v1.Span.Event.toObject(y.events[x],_)}if(y.droppedEventsCount!=null&&y.hasOwnProperty("droppedEventsCount")&&(N.droppedEventsCount=y.droppedEventsCount),y.links&&y.links.length){N.links=[];for(var x=0;x<y.links.length;++x)N.links[x]=O.opentelemetry.proto.trace.v1.Span.Link.toObject(y.links[x],_)}return y.droppedLinksCount!=null&&y.hasOwnProperty("droppedLinksCount")&&(N.droppedLinksCount=y.droppedLinksCount),y.status!=null&&y.hasOwnProperty("status")&&(N.status=O.opentelemetry.proto.trace.v1.Status.toObject(y.status,_)),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.trace.v1.Span"},C.SpanKind=(function(){var L={},y=Object.create(L);return y[L[0]="SPAN_KIND_UNSPECIFIED"]=0,y[L[1]="SPAN_KIND_INTERNAL"]=1,y[L[2]="SPAN_KIND_SERVER"]=2,y[L[3]="SPAN_KIND_CLIENT"]=3,y[L[4]="SPAN_KIND_PRODUCER"]=4,y[L[5]="SPAN_KIND_CONSUMER"]=5,y})(),C.Event=(function(){function L(y){if(this.attributes=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.timeUnixNano=null,L.prototype.name=null,L.prototype.attributes=P.emptyArray,L.prototype.droppedAttributesCount=null,L.create=function(_){return new L(_)},L.encode=function(_,N){if(N||(N=A.create()),_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano")&&N.uint32(9).fixed64(_.timeUnixNano),_.name!=null&&Object.hasOwnProperty.call(_,"name")&&N.uint32(18).string(_.name),_.attributes!=null&&_.attributes.length)for(var I=0;I<_.attributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[I],N.uint32(26).fork()).ldelim();return _.droppedAttributesCount!=null&&Object.hasOwnProperty.call(_,"droppedAttributesCount")&&N.uint32(32).uint32(_.droppedAttributesCount),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.trace.v1.Span.Event;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.timeUnixNano=_.fixed64();break}case 2:{x.name=_.string();break}case 3:{x.attributes&&x.attributes.length||(x.attributes=[]),x.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 4:{x.droppedAttributesCount=_.uint32();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&!P.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&P.isInteger(_.timeUnixNano.low)&&P.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(_.name!=null&&_.hasOwnProperty("name")&&!P.isString(_.name))return"name: string expected";if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var N=0;N<_.attributes.length;++N){var I=O.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[N]);if(I)return"attributes."+I}}return _.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(_.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.trace.v1.Span.Event)return _;var N=new O.opentelemetry.proto.trace.v1.Span.Event;if(_.timeUnixNano!=null&&(P.Long?(N.timeUnixNano=P.Long.fromValue(_.timeUnixNano)).unsigned=!1:typeof _.timeUnixNano=="string"?N.timeUnixNano=parseInt(_.timeUnixNano,10):typeof _.timeUnixNano=="number"?N.timeUnixNano=_.timeUnixNano:typeof _.timeUnixNano=="object"&&(N.timeUnixNano=new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber())),_.name!=null&&(N.name=String(_.name)),_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: array expected");N.attributes=[];for(var I=0;I<_.attributes.length;++I){if(typeof _.attributes[I]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: object expected");N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[I])}}return _.droppedAttributesCount!=null&&(N.droppedAttributesCount=_.droppedAttributesCount>>>0),N},L.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.attributes=[]),N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.timeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.timeUnixNano=N.longs===String?"0":0;I.name="",I.droppedAttributesCount=0}if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&(typeof _.timeUnixNano=="number"?I.timeUnixNano=N.longs===String?String(_.timeUnixNano):_.timeUnixNano:I.timeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.timeUnixNano):N.longs===Number?new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano),_.name!=null&&_.hasOwnProperty("name")&&(I.name=_.name),_.attributes&&_.attributes.length){I.attributes=[];for(var V=0;V<_.attributes.length;++V)I.attributes[V]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[V],N)}return _.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")&&(I.droppedAttributesCount=_.droppedAttributesCount),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.trace.v1.Span.Event"},L})(),C.Link=(function(){function L(y){if(this.attributes=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.traceId=null,L.prototype.spanId=null,L.prototype.traceState=null,L.prototype.attributes=P.emptyArray,L.prototype.droppedAttributesCount=null,L.create=function(_){return new L(_)},L.encode=function(_,N){if(N||(N=A.create()),_.traceId!=null&&Object.hasOwnProperty.call(_,"traceId")&&N.uint32(10).bytes(_.traceId),_.spanId!=null&&Object.hasOwnProperty.call(_,"spanId")&&N.uint32(18).bytes(_.spanId),_.traceState!=null&&Object.hasOwnProperty.call(_,"traceState")&&N.uint32(26).string(_.traceState),_.attributes!=null&&_.attributes.length)for(var I=0;I<_.attributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[I],N.uint32(34).fork()).ldelim();return _.droppedAttributesCount!=null&&Object.hasOwnProperty.call(_,"droppedAttributesCount")&&N.uint32(40).uint32(_.droppedAttributesCount),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.trace.v1.Span.Link;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.traceId=_.bytes();break}case 2:{x.spanId=_.bytes();break}case 3:{x.traceState=_.string();break}case 4:{x.attributes&&x.attributes.length||(x.attributes=[]),x.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 5:{x.droppedAttributesCount=_.uint32();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.traceId!=null&&_.hasOwnProperty("traceId")&&!(_.traceId&&typeof _.traceId.length=="number"||P.isString(_.traceId)))return"traceId: buffer expected";if(_.spanId!=null&&_.hasOwnProperty("spanId")&&!(_.spanId&&typeof _.spanId.length=="number"||P.isString(_.spanId)))return"spanId: buffer expected";if(_.traceState!=null&&_.hasOwnProperty("traceState")&&!P.isString(_.traceState))return"traceState: string expected";if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var N=0;N<_.attributes.length;++N){var I=O.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[N]);if(I)return"attributes."+I}}return _.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(_.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.trace.v1.Span.Link)return _;var N=new O.opentelemetry.proto.trace.v1.Span.Link;if(_.traceId!=null&&(typeof _.traceId=="string"?P.base64.decode(_.traceId,N.traceId=P.newBuffer(P.base64.length(_.traceId)),0):_.traceId.length>=0&&(N.traceId=_.traceId)),_.spanId!=null&&(typeof _.spanId=="string"?P.base64.decode(_.spanId,N.spanId=P.newBuffer(P.base64.length(_.spanId)),0):_.spanId.length>=0&&(N.spanId=_.spanId)),_.traceState!=null&&(N.traceState=String(_.traceState)),_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: array expected");N.attributes=[];for(var I=0;I<_.attributes.length;++I){if(typeof _.attributes[I]!="object")throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: object expected");N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[I])}}return _.droppedAttributesCount!=null&&(N.droppedAttributesCount=_.droppedAttributesCount>>>0),N},L.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.attributes=[]),N.defaults&&(N.bytes===String?I.traceId="":(I.traceId=[],N.bytes!==Array&&(I.traceId=P.newBuffer(I.traceId))),N.bytes===String?I.spanId="":(I.spanId=[],N.bytes!==Array&&(I.spanId=P.newBuffer(I.spanId))),I.traceState="",I.droppedAttributesCount=0),_.traceId!=null&&_.hasOwnProperty("traceId")&&(I.traceId=N.bytes===String?P.base64.encode(_.traceId,0,_.traceId.length):N.bytes===Array?Array.prototype.slice.call(_.traceId):_.traceId),_.spanId!=null&&_.hasOwnProperty("spanId")&&(I.spanId=N.bytes===String?P.base64.encode(_.spanId,0,_.spanId.length):N.bytes===Array?Array.prototype.slice.call(_.spanId):_.spanId),_.traceState!=null&&_.hasOwnProperty("traceState")&&(I.traceState=_.traceState),_.attributes&&_.attributes.length){I.attributes=[];for(var x=0;x<_.attributes.length;++x)I.attributes[x]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[x],N)}return _.droppedAttributesCount!=null&&_.hasOwnProperty("droppedAttributesCount")&&(I.droppedAttributesCount=_.droppedAttributesCount),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.trace.v1.Span.Link"},L})(),C})(),U.Status=(function(){function C(L){if(L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.message=null,C.prototype.code=null,C.create=function(y){return new C(y)},C.encode=function(y,_){return _||(_=A.create()),y.message!=null&&Object.hasOwnProperty.call(y,"message")&&_.uint32(18).string(y.message),y.code!=null&&Object.hasOwnProperty.call(y,"code")&&_.uint32(24).int32(y.code),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.trace.v1.Status;y.pos<N;){var x=y.uint32();switch(x>>>3){case 2:{I.message=y.string();break}case 3:{I.code=y.int32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.message!=null&&y.hasOwnProperty("message")&&!P.isString(y.message))return"message: string expected";if(y.code!=null&&y.hasOwnProperty("code"))switch(y.code){default:return"code: enum value expected";case 0:case 1:case 2:break}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.trace.v1.Status)return y;var _=new O.opentelemetry.proto.trace.v1.Status;switch(y.message!=null&&(_.message=String(y.message)),y.code){default:if(typeof y.code=="number"){_.code=y.code;break}break;case"STATUS_CODE_UNSET":case 0:_.code=0;break;case"STATUS_CODE_OK":case 1:_.code=1;break;case"STATUS_CODE_ERROR":case 2:_.code=2;break}return _},C.toObject=function(y,_){_||(_={});var N={};return _.defaults&&(N.message="",N.code=_.enums===String?"STATUS_CODE_UNSET":0),y.message!=null&&y.hasOwnProperty("message")&&(N.message=y.message),y.code!=null&&y.hasOwnProperty("code")&&(N.code=_.enums===String?O.opentelemetry.proto.trace.v1.Status.StatusCode[y.code]===void 0?y.code:O.opentelemetry.proto.trace.v1.Status.StatusCode[y.code]:y.code),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.trace.v1.Status"},C.StatusCode=(function(){var L={},y=Object.create(L);return y[L[0]="STATUS_CODE_UNSET"]=0,y[L[1]="STATUS_CODE_OK"]=1,y[L[2]="STATUS_CODE_ERROR"]=2,y})(),C})(),U})(),D})(),M.collector=(function(){var D={};return D.trace=(function(){var U={};return U.v1=(function(){var C={};return C.TraceService=(function(){function L(y,_,N){S.rpc.Service.call(this,y,_,N)}return(L.prototype=Object.create(S.rpc.Service.prototype)).constructor=L,L.create=function(_,N,I){return new this(_,N,I)},Object.defineProperty(L.prototype.export=function y(_,N){return this.rpcCall(y,O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,_,N)},"name",{value:"Export"}),L})(),C.ExportTraceServiceRequest=(function(){function L(y){if(this.resourceSpans=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.resourceSpans=P.emptyArray,L.create=function(_){return new L(_)},L.encode=function(_,N){if(N||(N=A.create()),_.resourceSpans!=null&&_.resourceSpans.length)for(var I=0;I<_.resourceSpans.length;++I)O.opentelemetry.proto.trace.v1.ResourceSpans.encode(_.resourceSpans[I],N.uint32(10).fork()).ldelim();return N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.resourceSpans&&x.resourceSpans.length||(x.resourceSpans=[]),x.resourceSpans.push(O.opentelemetry.proto.trace.v1.ResourceSpans.decode(_,_.uint32()));break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.resourceSpans!=null&&_.hasOwnProperty("resourceSpans")){if(!Array.isArray(_.resourceSpans))return"resourceSpans: array expected";for(var N=0;N<_.resourceSpans.length;++N){var I=O.opentelemetry.proto.trace.v1.ResourceSpans.verify(_.resourceSpans[N]);if(I)return"resourceSpans."+I}}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)return _;var N=new O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;if(_.resourceSpans){if(!Array.isArray(_.resourceSpans))throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: array expected");N.resourceSpans=[];for(var I=0;I<_.resourceSpans.length;++I){if(typeof _.resourceSpans[I]!="object")throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: object expected");N.resourceSpans[I]=O.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(_.resourceSpans[I])}}return N},L.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.resourceSpans=[]),_.resourceSpans&&_.resourceSpans.length){I.resourceSpans=[];for(var x=0;x<_.resourceSpans.length;++x)I.resourceSpans[x]=O.opentelemetry.proto.trace.v1.ResourceSpans.toObject(_.resourceSpans[x],N)}return I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"},L})(),C.ExportTraceServiceResponse=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.partialSuccess=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.partialSuccess!=null&&Object.hasOwnProperty.call(_,"partialSuccess")&&O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode(_.partialSuccess,N.uint32(10).fork()).ldelim(),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.partialSuccess=O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode(_,_.uint32());break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")){var N=O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify(_.partialSuccess);if(N)return"partialSuccess."+N}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse)return _;var N=new O.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;if(_.partialSuccess!=null){if(typeof _.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.partialSuccess: object expected");N.partialSuccess=O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject(_.partialSuccess)}return N},L.toObject=function(_,N){N||(N={});var I={};return N.defaults&&(I.partialSuccess=null),_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")&&(I.partialSuccess=O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject(_.partialSuccess,N)),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"},L})(),C.ExportTracePartialSuccess=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.rejectedSpans=null,L.prototype.errorMessage=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.rejectedSpans!=null&&Object.hasOwnProperty.call(_,"rejectedSpans")&&N.uint32(8).int64(_.rejectedSpans),_.errorMessage!=null&&Object.hasOwnProperty.call(_,"errorMessage")&&N.uint32(18).string(_.errorMessage),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.rejectedSpans=_.int64();break}case 2:{x.errorMessage=_.string();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){return typeof _!="object"||_===null?"object expected":_.rejectedSpans!=null&&_.hasOwnProperty("rejectedSpans")&&!P.isInteger(_.rejectedSpans)&&!(_.rejectedSpans&&P.isInteger(_.rejectedSpans.low)&&P.isInteger(_.rejectedSpans.high))?"rejectedSpans: integer|Long expected":_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&!P.isString(_.errorMessage)?"errorMessage: string expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess)return _;var N=new O.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;return _.rejectedSpans!=null&&(P.Long?(N.rejectedSpans=P.Long.fromValue(_.rejectedSpans)).unsigned=!1:typeof _.rejectedSpans=="string"?N.rejectedSpans=parseInt(_.rejectedSpans,10):typeof _.rejectedSpans=="number"?N.rejectedSpans=_.rejectedSpans:typeof _.rejectedSpans=="object"&&(N.rejectedSpans=new P.LongBits(_.rejectedSpans.low>>>0,_.rejectedSpans.high>>>0).toNumber())),_.errorMessage!=null&&(N.errorMessage=String(_.errorMessage)),N},L.toObject=function(_,N){N||(N={});var I={};if(N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.rejectedSpans=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.rejectedSpans=N.longs===String?"0":0;I.errorMessage=""}return _.rejectedSpans!=null&&_.hasOwnProperty("rejectedSpans")&&(typeof _.rejectedSpans=="number"?I.rejectedSpans=N.longs===String?String(_.rejectedSpans):_.rejectedSpans:I.rejectedSpans=N.longs===String?P.Long.prototype.toString.call(_.rejectedSpans):N.longs===Number?new P.LongBits(_.rejectedSpans.low>>>0,_.rejectedSpans.high>>>0).toNumber():_.rejectedSpans),_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&(I.errorMessage=_.errorMessage),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"},L})(),C})(),U})(),D.metrics=(function(){var U={};return U.v1=(function(){var C={};return C.MetricsService=(function(){function L(y,_,N){S.rpc.Service.call(this,y,_,N)}return(L.prototype=Object.create(S.rpc.Service.prototype)).constructor=L,L.create=function(_,N,I){return new this(_,N,I)},Object.defineProperty(L.prototype.export=function y(_,N){return this.rpcCall(y,O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,_,N)},"name",{value:"Export"}),L})(),C.ExportMetricsServiceRequest=(function(){function L(y){if(this.resourceMetrics=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.resourceMetrics=P.emptyArray,L.create=function(_){return new L(_)},L.encode=function(_,N){if(N||(N=A.create()),_.resourceMetrics!=null&&_.resourceMetrics.length)for(var I=0;I<_.resourceMetrics.length;++I)O.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(_.resourceMetrics[I],N.uint32(10).fork()).ldelim();return N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.resourceMetrics&&x.resourceMetrics.length||(x.resourceMetrics=[]),x.resourceMetrics.push(O.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(_,_.uint32()));break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.resourceMetrics!=null&&_.hasOwnProperty("resourceMetrics")){if(!Array.isArray(_.resourceMetrics))return"resourceMetrics: array expected";for(var N=0;N<_.resourceMetrics.length;++N){var I=O.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(_.resourceMetrics[N]);if(I)return"resourceMetrics."+I}}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest)return _;var N=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;if(_.resourceMetrics){if(!Array.isArray(_.resourceMetrics))throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: array expected");N.resourceMetrics=[];for(var I=0;I<_.resourceMetrics.length;++I){if(typeof _.resourceMetrics[I]!="object")throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: object expected");N.resourceMetrics[I]=O.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(_.resourceMetrics[I])}}return N},L.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.resourceMetrics=[]),_.resourceMetrics&&_.resourceMetrics.length){I.resourceMetrics=[];for(var x=0;x<_.resourceMetrics.length;++x)I.resourceMetrics[x]=O.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(_.resourceMetrics[x],N)}return I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"},L})(),C.ExportMetricsServiceResponse=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.partialSuccess=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.partialSuccess!=null&&Object.hasOwnProperty.call(_,"partialSuccess")&&O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode(_.partialSuccess,N.uint32(10).fork()).ldelim(),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.partialSuccess=O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode(_,_.uint32());break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")){var N=O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify(_.partialSuccess);if(N)return"partialSuccess."+N}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse)return _;var N=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;if(_.partialSuccess!=null){if(typeof _.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.partialSuccess: object expected");N.partialSuccess=O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject(_.partialSuccess)}return N},L.toObject=function(_,N){N||(N={});var I={};return N.defaults&&(I.partialSuccess=null),_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")&&(I.partialSuccess=O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject(_.partialSuccess,N)),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"},L})(),C.ExportMetricsPartialSuccess=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.rejectedDataPoints=null,L.prototype.errorMessage=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.rejectedDataPoints!=null&&Object.hasOwnProperty.call(_,"rejectedDataPoints")&&N.uint32(8).int64(_.rejectedDataPoints),_.errorMessage!=null&&Object.hasOwnProperty.call(_,"errorMessage")&&N.uint32(18).string(_.errorMessage),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.rejectedDataPoints=_.int64();break}case 2:{x.errorMessage=_.string();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){return typeof _!="object"||_===null?"object expected":_.rejectedDataPoints!=null&&_.hasOwnProperty("rejectedDataPoints")&&!P.isInteger(_.rejectedDataPoints)&&!(_.rejectedDataPoints&&P.isInteger(_.rejectedDataPoints.low)&&P.isInteger(_.rejectedDataPoints.high))?"rejectedDataPoints: integer|Long expected":_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&!P.isString(_.errorMessage)?"errorMessage: string expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess)return _;var N=new O.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;return _.rejectedDataPoints!=null&&(P.Long?(N.rejectedDataPoints=P.Long.fromValue(_.rejectedDataPoints)).unsigned=!1:typeof _.rejectedDataPoints=="string"?N.rejectedDataPoints=parseInt(_.rejectedDataPoints,10):typeof _.rejectedDataPoints=="number"?N.rejectedDataPoints=_.rejectedDataPoints:typeof _.rejectedDataPoints=="object"&&(N.rejectedDataPoints=new P.LongBits(_.rejectedDataPoints.low>>>0,_.rejectedDataPoints.high>>>0).toNumber())),_.errorMessage!=null&&(N.errorMessage=String(_.errorMessage)),N},L.toObject=function(_,N){N||(N={});var I={};if(N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.rejectedDataPoints=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.rejectedDataPoints=N.longs===String?"0":0;I.errorMessage=""}return _.rejectedDataPoints!=null&&_.hasOwnProperty("rejectedDataPoints")&&(typeof _.rejectedDataPoints=="number"?I.rejectedDataPoints=N.longs===String?String(_.rejectedDataPoints):_.rejectedDataPoints:I.rejectedDataPoints=N.longs===String?P.Long.prototype.toString.call(_.rejectedDataPoints):N.longs===Number?new P.LongBits(_.rejectedDataPoints.low>>>0,_.rejectedDataPoints.high>>>0).toNumber():_.rejectedDataPoints),_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&(I.errorMessage=_.errorMessage),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"},L})(),C})(),U})(),D.logs=(function(){var U={};return U.v1=(function(){var C={};return C.LogsService=(function(){function L(y,_,N){S.rpc.Service.call(this,y,_,N)}return(L.prototype=Object.create(S.rpc.Service.prototype)).constructor=L,L.create=function(_,N,I){return new this(_,N,I)},Object.defineProperty(L.prototype.export=function y(_,N){return this.rpcCall(y,O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,_,N)},"name",{value:"Export"}),L})(),C.ExportLogsServiceRequest=(function(){function L(y){if(this.resourceLogs=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.resourceLogs=P.emptyArray,L.create=function(_){return new L(_)},L.encode=function(_,N){if(N||(N=A.create()),_.resourceLogs!=null&&_.resourceLogs.length)for(var I=0;I<_.resourceLogs.length;++I)O.opentelemetry.proto.logs.v1.ResourceLogs.encode(_.resourceLogs[I],N.uint32(10).fork()).ldelim();return N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.resourceLogs&&x.resourceLogs.length||(x.resourceLogs=[]),x.resourceLogs.push(O.opentelemetry.proto.logs.v1.ResourceLogs.decode(_,_.uint32()));break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.resourceLogs!=null&&_.hasOwnProperty("resourceLogs")){if(!Array.isArray(_.resourceLogs))return"resourceLogs: array expected";for(var N=0;N<_.resourceLogs.length;++N){var I=O.opentelemetry.proto.logs.v1.ResourceLogs.verify(_.resourceLogs[N]);if(I)return"resourceLogs."+I}}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)return _;var N=new O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;if(_.resourceLogs){if(!Array.isArray(_.resourceLogs))throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: array expected");N.resourceLogs=[];for(var I=0;I<_.resourceLogs.length;++I){if(typeof _.resourceLogs[I]!="object")throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: object expected");N.resourceLogs[I]=O.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(_.resourceLogs[I])}}return N},L.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.resourceLogs=[]),_.resourceLogs&&_.resourceLogs.length){I.resourceLogs=[];for(var x=0;x<_.resourceLogs.length;++x)I.resourceLogs[x]=O.opentelemetry.proto.logs.v1.ResourceLogs.toObject(_.resourceLogs[x],N)}return I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"},L})(),C.ExportLogsServiceResponse=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.partialSuccess=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.partialSuccess!=null&&Object.hasOwnProperty.call(_,"partialSuccess")&&O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode(_.partialSuccess,N.uint32(10).fork()).ldelim(),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.partialSuccess=O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode(_,_.uint32());break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")){var N=O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify(_.partialSuccess);if(N)return"partialSuccess."+N}return null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse)return _;var N=new O.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;if(_.partialSuccess!=null){if(typeof _.partialSuccess!="object")throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.partialSuccess: object expected");N.partialSuccess=O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject(_.partialSuccess)}return N},L.toObject=function(_,N){N||(N={});var I={};return N.defaults&&(I.partialSuccess=null),_.partialSuccess!=null&&_.hasOwnProperty("partialSuccess")&&(I.partialSuccess=O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject(_.partialSuccess,N)),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"},L})(),C.ExportLogsPartialSuccess=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.rejectedLogRecords=null,L.prototype.errorMessage=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.rejectedLogRecords!=null&&Object.hasOwnProperty.call(_,"rejectedLogRecords")&&N.uint32(8).int64(_.rejectedLogRecords),_.errorMessage!=null&&Object.hasOwnProperty.call(_,"errorMessage")&&N.uint32(18).string(_.errorMessage),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.rejectedLogRecords=_.int64();break}case 2:{x.errorMessage=_.string();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){return typeof _!="object"||_===null?"object expected":_.rejectedLogRecords!=null&&_.hasOwnProperty("rejectedLogRecords")&&!P.isInteger(_.rejectedLogRecords)&&!(_.rejectedLogRecords&&P.isInteger(_.rejectedLogRecords.low)&&P.isInteger(_.rejectedLogRecords.high))?"rejectedLogRecords: integer|Long expected":_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&!P.isString(_.errorMessage)?"errorMessage: string expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess)return _;var N=new O.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;return _.rejectedLogRecords!=null&&(P.Long?(N.rejectedLogRecords=P.Long.fromValue(_.rejectedLogRecords)).unsigned=!1:typeof _.rejectedLogRecords=="string"?N.rejectedLogRecords=parseInt(_.rejectedLogRecords,10):typeof _.rejectedLogRecords=="number"?N.rejectedLogRecords=_.rejectedLogRecords:typeof _.rejectedLogRecords=="object"&&(N.rejectedLogRecords=new P.LongBits(_.rejectedLogRecords.low>>>0,_.rejectedLogRecords.high>>>0).toNumber())),_.errorMessage!=null&&(N.errorMessage=String(_.errorMessage)),N},L.toObject=function(_,N){N||(N={});var I={};if(N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.rejectedLogRecords=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.rejectedLogRecords=N.longs===String?"0":0;I.errorMessage=""}return _.rejectedLogRecords!=null&&_.hasOwnProperty("rejectedLogRecords")&&(typeof _.rejectedLogRecords=="number"?I.rejectedLogRecords=N.longs===String?String(_.rejectedLogRecords):_.rejectedLogRecords:I.rejectedLogRecords=N.longs===String?P.Long.prototype.toString.call(_.rejectedLogRecords):N.longs===Number?new P.LongBits(_.rejectedLogRecords.low>>>0,_.rejectedLogRecords.high>>>0).toNumber():_.rejectedLogRecords),_.errorMessage!=null&&_.hasOwnProperty("errorMessage")&&(I.errorMessage=_.errorMessage),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"},L})(),C})(),U})(),D})(),M.metrics=(function(){var D={};return D.v1=(function(){var U={};return U.MetricsData=(function(){function C(L){if(this.resourceMetrics=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resourceMetrics=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resourceMetrics!=null&&y.resourceMetrics.length)for(var N=0;N<y.resourceMetrics.length;++N)O.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(y.resourceMetrics[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.MetricsData;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resourceMetrics&&I.resourceMetrics.length||(I.resourceMetrics=[]),I.resourceMetrics.push(O.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resourceMetrics!=null&&y.hasOwnProperty("resourceMetrics")){if(!Array.isArray(y.resourceMetrics))return"resourceMetrics: array expected";for(var _=0;_<y.resourceMetrics.length;++_){var N=O.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(y.resourceMetrics[_]);if(N)return"resourceMetrics."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.MetricsData)return y;var _=new O.opentelemetry.proto.metrics.v1.MetricsData;if(y.resourceMetrics){if(!Array.isArray(y.resourceMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: array expected");_.resourceMetrics=[];for(var N=0;N<y.resourceMetrics.length;++N){if(typeof y.resourceMetrics[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: object expected");_.resourceMetrics[N]=O.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(y.resourceMetrics[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.resourceMetrics=[]),y.resourceMetrics&&y.resourceMetrics.length){N.resourceMetrics=[];for(var I=0;I<y.resourceMetrics.length;++I)N.resourceMetrics[I]=O.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(y.resourceMetrics[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.MetricsData"},C})(),U.ResourceMetrics=(function(){function C(L){if(this.scopeMetrics=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resource=null,C.prototype.scopeMetrics=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resource!=null&&Object.hasOwnProperty.call(y,"resource")&&O.opentelemetry.proto.resource.v1.Resource.encode(y.resource,_.uint32(10).fork()).ldelim(),y.scopeMetrics!=null&&y.scopeMetrics.length)for(var N=0;N<y.scopeMetrics.length;++N)O.opentelemetry.proto.metrics.v1.ScopeMetrics.encode(y.scopeMetrics[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.ResourceMetrics;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resource=O.opentelemetry.proto.resource.v1.Resource.decode(y,y.uint32());break}case 2:{I.scopeMetrics&&I.scopeMetrics.length||(I.scopeMetrics=[]),I.scopeMetrics.push(O.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resource!=null&&y.hasOwnProperty("resource")){var _=O.opentelemetry.proto.resource.v1.Resource.verify(y.resource);if(_)return"resource."+_}if(y.scopeMetrics!=null&&y.hasOwnProperty("scopeMetrics")){if(!Array.isArray(y.scopeMetrics))return"scopeMetrics: array expected";for(var N=0;N<y.scopeMetrics.length;++N){var _=O.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(y.scopeMetrics[N]);if(_)return"scopeMetrics."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.ResourceMetrics)return y;var _=new O.opentelemetry.proto.metrics.v1.ResourceMetrics;if(y.resource!=null){if(typeof y.resource!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.resource: object expected");_.resource=O.opentelemetry.proto.resource.v1.Resource.fromObject(y.resource)}if(y.scopeMetrics){if(!Array.isArray(y.scopeMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: array expected");_.scopeMetrics=[];for(var N=0;N<y.scopeMetrics.length;++N){if(typeof y.scopeMetrics[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: object expected");_.scopeMetrics[N]=O.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(y.scopeMetrics[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.scopeMetrics=[]),_.defaults&&(N.resource=null,N.schemaUrl=""),y.resource!=null&&y.hasOwnProperty("resource")&&(N.resource=O.opentelemetry.proto.resource.v1.Resource.toObject(y.resource,_)),y.scopeMetrics&&y.scopeMetrics.length){N.scopeMetrics=[];for(var I=0;I<y.scopeMetrics.length;++I)N.scopeMetrics[I]=O.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(y.scopeMetrics[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.ResourceMetrics"},C})(),U.ScopeMetrics=(function(){function C(L){if(this.metrics=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.scope=null,C.prototype.metrics=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.scope!=null&&Object.hasOwnProperty.call(y,"scope")&&O.opentelemetry.proto.common.v1.InstrumentationScope.encode(y.scope,_.uint32(10).fork()).ldelim(),y.metrics!=null&&y.metrics.length)for(var N=0;N<y.metrics.length;++N)O.opentelemetry.proto.metrics.v1.Metric.encode(y.metrics[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.ScopeMetrics;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.decode(y,y.uint32());break}case 2:{I.metrics&&I.metrics.length||(I.metrics=[]),I.metrics.push(O.opentelemetry.proto.metrics.v1.Metric.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.scope!=null&&y.hasOwnProperty("scope")){var _=O.opentelemetry.proto.common.v1.InstrumentationScope.verify(y.scope);if(_)return"scope."+_}if(y.metrics!=null&&y.hasOwnProperty("metrics")){if(!Array.isArray(y.metrics))return"metrics: array expected";for(var N=0;N<y.metrics.length;++N){var _=O.opentelemetry.proto.metrics.v1.Metric.verify(y.metrics[N]);if(_)return"metrics."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.ScopeMetrics)return y;var _=new O.opentelemetry.proto.metrics.v1.ScopeMetrics;if(y.scope!=null){if(typeof y.scope!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.scope: object expected");_.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(y.scope)}if(y.metrics){if(!Array.isArray(y.metrics))throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: array expected");_.metrics=[];for(var N=0;N<y.metrics.length;++N){if(typeof y.metrics[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: object expected");_.metrics[N]=O.opentelemetry.proto.metrics.v1.Metric.fromObject(y.metrics[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.metrics=[]),_.defaults&&(N.scope=null,N.schemaUrl=""),y.scope!=null&&y.hasOwnProperty("scope")&&(N.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.toObject(y.scope,_)),y.metrics&&y.metrics.length){N.metrics=[];for(var I=0;I<y.metrics.length;++I)N.metrics[I]=O.opentelemetry.proto.metrics.v1.Metric.toObject(y.metrics[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.ScopeMetrics"},C})(),U.Metric=(function(){function C(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.name=null,C.prototype.description=null,C.prototype.unit=null,C.prototype.gauge=null,C.prototype.sum=null,C.prototype.histogram=null,C.prototype.exponentialHistogram=null,C.prototype.summary=null;var L;return Object.defineProperty(C.prototype,"data",{get:P.oneOfGetter(L=["gauge","sum","histogram","exponentialHistogram","summary"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){return N||(N=A.create()),_.name!=null&&Object.hasOwnProperty.call(_,"name")&&N.uint32(10).string(_.name),_.description!=null&&Object.hasOwnProperty.call(_,"description")&&N.uint32(18).string(_.description),_.unit!=null&&Object.hasOwnProperty.call(_,"unit")&&N.uint32(26).string(_.unit),_.gauge!=null&&Object.hasOwnProperty.call(_,"gauge")&&O.opentelemetry.proto.metrics.v1.Gauge.encode(_.gauge,N.uint32(42).fork()).ldelim(),_.sum!=null&&Object.hasOwnProperty.call(_,"sum")&&O.opentelemetry.proto.metrics.v1.Sum.encode(_.sum,N.uint32(58).fork()).ldelim(),_.histogram!=null&&Object.hasOwnProperty.call(_,"histogram")&&O.opentelemetry.proto.metrics.v1.Histogram.encode(_.histogram,N.uint32(74).fork()).ldelim(),_.exponentialHistogram!=null&&Object.hasOwnProperty.call(_,"exponentialHistogram")&&O.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode(_.exponentialHistogram,N.uint32(82).fork()).ldelim(),_.summary!=null&&Object.hasOwnProperty.call(_,"summary")&&O.opentelemetry.proto.metrics.v1.Summary.encode(_.summary,N.uint32(90).fork()).ldelim(),N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.Metric;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.name=_.string();break}case 2:{x.description=_.string();break}case 3:{x.unit=_.string();break}case 5:{x.gauge=O.opentelemetry.proto.metrics.v1.Gauge.decode(_,_.uint32());break}case 7:{x.sum=O.opentelemetry.proto.metrics.v1.Sum.decode(_,_.uint32());break}case 9:{x.histogram=O.opentelemetry.proto.metrics.v1.Histogram.decode(_,_.uint32());break}case 10:{x.exponentialHistogram=O.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode(_,_.uint32());break}case 11:{x.summary=O.opentelemetry.proto.metrics.v1.Summary.decode(_,_.uint32());break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";var N={};if(_.name!=null&&_.hasOwnProperty("name")&&!P.isString(_.name))return"name: string expected";if(_.description!=null&&_.hasOwnProperty("description")&&!P.isString(_.description))return"description: string expected";if(_.unit!=null&&_.hasOwnProperty("unit")&&!P.isString(_.unit))return"unit: string expected";if(_.gauge!=null&&_.hasOwnProperty("gauge")){N.data=1;{var I=O.opentelemetry.proto.metrics.v1.Gauge.verify(_.gauge);if(I)return"gauge."+I}}if(_.sum!=null&&_.hasOwnProperty("sum")){if(N.data===1)return"data: multiple values";N.data=1;{var I=O.opentelemetry.proto.metrics.v1.Sum.verify(_.sum);if(I)return"sum."+I}}if(_.histogram!=null&&_.hasOwnProperty("histogram")){if(N.data===1)return"data: multiple values";N.data=1;{var I=O.opentelemetry.proto.metrics.v1.Histogram.verify(_.histogram);if(I)return"histogram."+I}}if(_.exponentialHistogram!=null&&_.hasOwnProperty("exponentialHistogram")){if(N.data===1)return"data: multiple values";N.data=1;{var I=O.opentelemetry.proto.metrics.v1.ExponentialHistogram.verify(_.exponentialHistogram);if(I)return"exponentialHistogram."+I}}if(_.summary!=null&&_.hasOwnProperty("summary")){if(N.data===1)return"data: multiple values";N.data=1;{var I=O.opentelemetry.proto.metrics.v1.Summary.verify(_.summary);if(I)return"summary."+I}}return null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.Metric)return _;var N=new O.opentelemetry.proto.metrics.v1.Metric;if(_.name!=null&&(N.name=String(_.name)),_.description!=null&&(N.description=String(_.description)),_.unit!=null&&(N.unit=String(_.unit)),_.gauge!=null){if(typeof _.gauge!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.gauge: object expected");N.gauge=O.opentelemetry.proto.metrics.v1.Gauge.fromObject(_.gauge)}if(_.sum!=null){if(typeof _.sum!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.sum: object expected");N.sum=O.opentelemetry.proto.metrics.v1.Sum.fromObject(_.sum)}if(_.histogram!=null){if(typeof _.histogram!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.histogram: object expected");N.histogram=O.opentelemetry.proto.metrics.v1.Histogram.fromObject(_.histogram)}if(_.exponentialHistogram!=null){if(typeof _.exponentialHistogram!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.exponentialHistogram: object expected");N.exponentialHistogram=O.opentelemetry.proto.metrics.v1.ExponentialHistogram.fromObject(_.exponentialHistogram)}if(_.summary!=null){if(typeof _.summary!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Metric.summary: object expected");N.summary=O.opentelemetry.proto.metrics.v1.Summary.fromObject(_.summary)}return N},C.toObject=function(_,N){N||(N={});var I={};return N.defaults&&(I.name="",I.description="",I.unit=""),_.name!=null&&_.hasOwnProperty("name")&&(I.name=_.name),_.description!=null&&_.hasOwnProperty("description")&&(I.description=_.description),_.unit!=null&&_.hasOwnProperty("unit")&&(I.unit=_.unit),_.gauge!=null&&_.hasOwnProperty("gauge")&&(I.gauge=O.opentelemetry.proto.metrics.v1.Gauge.toObject(_.gauge,N),N.oneofs&&(I.data="gauge")),_.sum!=null&&_.hasOwnProperty("sum")&&(I.sum=O.opentelemetry.proto.metrics.v1.Sum.toObject(_.sum,N),N.oneofs&&(I.data="sum")),_.histogram!=null&&_.hasOwnProperty("histogram")&&(I.histogram=O.opentelemetry.proto.metrics.v1.Histogram.toObject(_.histogram,N),N.oneofs&&(I.data="histogram")),_.exponentialHistogram!=null&&_.hasOwnProperty("exponentialHistogram")&&(I.exponentialHistogram=O.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject(_.exponentialHistogram,N),N.oneofs&&(I.data="exponentialHistogram")),_.summary!=null&&_.hasOwnProperty("summary")&&(I.summary=O.opentelemetry.proto.metrics.v1.Summary.toObject(_.summary,N),N.oneofs&&(I.data="summary")),I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.Metric"},C})(),U.Gauge=(function(){function C(L){if(this.dataPoints=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.dataPoints=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.dataPoints!=null&&y.dataPoints.length)for(var N=0;N<y.dataPoints.length;++N)O.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(y.dataPoints[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.Gauge;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.dataPoints&&I.dataPoints.length||(I.dataPoints=[]),I.dataPoints.push(O.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.dataPoints!=null&&y.hasOwnProperty("dataPoints")){if(!Array.isArray(y.dataPoints))return"dataPoints: array expected";for(var _=0;_<y.dataPoints.length;++_){var N=O.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(y.dataPoints[_]);if(N)return"dataPoints."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.Gauge)return y;var _=new O.opentelemetry.proto.metrics.v1.Gauge;if(y.dataPoints){if(!Array.isArray(y.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: array expected");_.dataPoints=[];for(var N=0;N<y.dataPoints.length;++N){if(typeof y.dataPoints[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: object expected");_.dataPoints[N]=O.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(y.dataPoints[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.dataPoints=[]),y.dataPoints&&y.dataPoints.length){N.dataPoints=[];for(var I=0;I<y.dataPoints.length;++I)N.dataPoints[I]=O.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(y.dataPoints[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.Gauge"},C})(),U.Sum=(function(){function C(L){if(this.dataPoints=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.dataPoints=P.emptyArray,C.prototype.aggregationTemporality=null,C.prototype.isMonotonic=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.dataPoints!=null&&y.dataPoints.length)for(var N=0;N<y.dataPoints.length;++N)O.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(y.dataPoints[N],_.uint32(10).fork()).ldelim();return y.aggregationTemporality!=null&&Object.hasOwnProperty.call(y,"aggregationTemporality")&&_.uint32(16).int32(y.aggregationTemporality),y.isMonotonic!=null&&Object.hasOwnProperty.call(y,"isMonotonic")&&_.uint32(24).bool(y.isMonotonic),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.Sum;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.dataPoints&&I.dataPoints.length||(I.dataPoints=[]),I.dataPoints.push(O.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(y,y.uint32()));break}case 2:{I.aggregationTemporality=y.int32();break}case 3:{I.isMonotonic=y.bool();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.dataPoints!=null&&y.hasOwnProperty("dataPoints")){if(!Array.isArray(y.dataPoints))return"dataPoints: array expected";for(var _=0;_<y.dataPoints.length;++_){var N=O.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(y.dataPoints[_]);if(N)return"dataPoints."+N}}if(y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality"))switch(y.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return y.isMonotonic!=null&&y.hasOwnProperty("isMonotonic")&&typeof y.isMonotonic!="boolean"?"isMonotonic: boolean expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.Sum)return y;var _=new O.opentelemetry.proto.metrics.v1.Sum;if(y.dataPoints){if(!Array.isArray(y.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: array expected");_.dataPoints=[];for(var N=0;N<y.dataPoints.length;++N){if(typeof y.dataPoints[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: object expected");_.dataPoints[N]=O.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(y.dataPoints[N])}}switch(y.aggregationTemporality){default:if(typeof y.aggregationTemporality=="number"){_.aggregationTemporality=y.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:_.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:_.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:_.aggregationTemporality=2;break}return y.isMonotonic!=null&&(_.isMonotonic=!!y.isMonotonic),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.dataPoints=[]),_.defaults&&(N.aggregationTemporality=_.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0,N.isMonotonic=!1),y.dataPoints&&y.dataPoints.length){N.dataPoints=[];for(var I=0;I<y.dataPoints.length;++I)N.dataPoints[I]=O.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(y.dataPoints[I],_)}return y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality")&&(N.aggregationTemporality=_.enums===String?O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]===void 0?y.aggregationTemporality:O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]:y.aggregationTemporality),y.isMonotonic!=null&&y.hasOwnProperty("isMonotonic")&&(N.isMonotonic=y.isMonotonic),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.Sum"},C})(),U.Histogram=(function(){function C(L){if(this.dataPoints=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.dataPoints=P.emptyArray,C.prototype.aggregationTemporality=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.dataPoints!=null&&y.dataPoints.length)for(var N=0;N<y.dataPoints.length;++N)O.opentelemetry.proto.metrics.v1.HistogramDataPoint.encode(y.dataPoints[N],_.uint32(10).fork()).ldelim();return y.aggregationTemporality!=null&&Object.hasOwnProperty.call(y,"aggregationTemporality")&&_.uint32(16).int32(y.aggregationTemporality),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.Histogram;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.dataPoints&&I.dataPoints.length||(I.dataPoints=[]),I.dataPoints.push(O.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(y,y.uint32()));break}case 2:{I.aggregationTemporality=y.int32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.dataPoints!=null&&y.hasOwnProperty("dataPoints")){if(!Array.isArray(y.dataPoints))return"dataPoints: array expected";for(var _=0;_<y.dataPoints.length;++_){var N=O.opentelemetry.proto.metrics.v1.HistogramDataPoint.verify(y.dataPoints[_]);if(N)return"dataPoints."+N}}if(y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality"))switch(y.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.Histogram)return y;var _=new O.opentelemetry.proto.metrics.v1.Histogram;if(y.dataPoints){if(!Array.isArray(y.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: array expected");_.dataPoints=[];for(var N=0;N<y.dataPoints.length;++N){if(typeof y.dataPoints[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: object expected");_.dataPoints[N]=O.opentelemetry.proto.metrics.v1.HistogramDataPoint.fromObject(y.dataPoints[N])}}switch(y.aggregationTemporality){default:if(typeof y.aggregationTemporality=="number"){_.aggregationTemporality=y.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:_.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:_.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:_.aggregationTemporality=2;break}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.dataPoints=[]),_.defaults&&(N.aggregationTemporality=_.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),y.dataPoints&&y.dataPoints.length){N.dataPoints=[];for(var I=0;I<y.dataPoints.length;++I)N.dataPoints[I]=O.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(y.dataPoints[I],_)}return y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality")&&(N.aggregationTemporality=_.enums===String?O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]===void 0?y.aggregationTemporality:O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]:y.aggregationTemporality),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.Histogram"},C})(),U.ExponentialHistogram=(function(){function C(L){if(this.dataPoints=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.dataPoints=P.emptyArray,C.prototype.aggregationTemporality=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.dataPoints!=null&&y.dataPoints.length)for(var N=0;N<y.dataPoints.length;++N)O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.encode(y.dataPoints[N],_.uint32(10).fork()).ldelim();return y.aggregationTemporality!=null&&Object.hasOwnProperty.call(y,"aggregationTemporality")&&_.uint32(16).int32(y.aggregationTemporality),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.ExponentialHistogram;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.dataPoints&&I.dataPoints.length||(I.dataPoints=[]),I.dataPoints.push(O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(y,y.uint32()));break}case 2:{I.aggregationTemporality=y.int32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.dataPoints!=null&&y.hasOwnProperty("dataPoints")){if(!Array.isArray(y.dataPoints))return"dataPoints: array expected";for(var _=0;_<y.dataPoints.length;++_){var N=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify(y.dataPoints[_]);if(N)return"dataPoints."+N}}if(y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality"))switch(y.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:break}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.ExponentialHistogram)return y;var _=new O.opentelemetry.proto.metrics.v1.ExponentialHistogram;if(y.dataPoints){if(!Array.isArray(y.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: array expected");_.dataPoints=[];for(var N=0;N<y.dataPoints.length;++N){if(typeof y.dataPoints[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: object expected");_.dataPoints[N]=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.fromObject(y.dataPoints[N])}}switch(y.aggregationTemporality){default:if(typeof y.aggregationTemporality=="number"){_.aggregationTemporality=y.aggregationTemporality;break}break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:_.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:_.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:_.aggregationTemporality=2;break}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.dataPoints=[]),_.defaults&&(N.aggregationTemporality=_.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),y.dataPoints&&y.dataPoints.length){N.dataPoints=[];for(var I=0;I<y.dataPoints.length;++I)N.dataPoints[I]=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(y.dataPoints[I],_)}return y.aggregationTemporality!=null&&y.hasOwnProperty("aggregationTemporality")&&(N.aggregationTemporality=_.enums===String?O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]===void 0?y.aggregationTemporality:O.opentelemetry.proto.metrics.v1.AggregationTemporality[y.aggregationTemporality]:y.aggregationTemporality),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.ExponentialHistogram"},C})(),U.Summary=(function(){function C(L){if(this.dataPoints=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.dataPoints=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.dataPoints!=null&&y.dataPoints.length)for(var N=0;N<y.dataPoints.length;++N)O.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(y.dataPoints[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.Summary;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.dataPoints&&I.dataPoints.length||(I.dataPoints=[]),I.dataPoints.push(O.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.dataPoints!=null&&y.hasOwnProperty("dataPoints")){if(!Array.isArray(y.dataPoints))return"dataPoints: array expected";for(var _=0;_<y.dataPoints.length;++_){var N=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(y.dataPoints[_]);if(N)return"dataPoints."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.Summary)return y;var _=new O.opentelemetry.proto.metrics.v1.Summary;if(y.dataPoints){if(!Array.isArray(y.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: array expected");_.dataPoints=[];for(var N=0;N<y.dataPoints.length;++N){if(typeof y.dataPoints[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: object expected");_.dataPoints[N]=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(y.dataPoints[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.dataPoints=[]),y.dataPoints&&y.dataPoints.length){N.dataPoints=[];for(var I=0;I<y.dataPoints.length;++I)N.dataPoints[I]=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(y.dataPoints[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.Summary"},C})(),U.AggregationTemporality=(function(){var C={},L=Object.create(C);return L[C[0]="AGGREGATION_TEMPORALITY_UNSPECIFIED"]=0,L[C[1]="AGGREGATION_TEMPORALITY_DELTA"]=1,L[C[2]="AGGREGATION_TEMPORALITY_CUMULATIVE"]=2,L})(),U.DataPointFlags=(function(){var C={},L=Object.create(C);return L[C[0]="DATA_POINT_FLAGS_DO_NOT_USE"]=0,L[C[1]="DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"]=1,L})(),U.NumberDataPoint=(function(){function C(y){if(this.attributes=[],this.exemplars=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.attributes=P.emptyArray,C.prototype.startTimeUnixNano=null,C.prototype.timeUnixNano=null,C.prototype.asDouble=null,C.prototype.asInt=null,C.prototype.exemplars=P.emptyArray,C.prototype.flags=null;var L;return Object.defineProperty(C.prototype,"value",{get:P.oneOfGetter(L=["asDouble","asInt"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){if(N||(N=A.create()),_.startTimeUnixNano!=null&&Object.hasOwnProperty.call(_,"startTimeUnixNano")&&N.uint32(17).fixed64(_.startTimeUnixNano),_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano")&&N.uint32(25).fixed64(_.timeUnixNano),_.asDouble!=null&&Object.hasOwnProperty.call(_,"asDouble")&&N.uint32(33).double(_.asDouble),_.exemplars!=null&&_.exemplars.length)for(var I=0;I<_.exemplars.length;++I)O.opentelemetry.proto.metrics.v1.Exemplar.encode(_.exemplars[I],N.uint32(42).fork()).ldelim();if(_.asInt!=null&&Object.hasOwnProperty.call(_,"asInt")&&N.uint32(49).sfixed64(_.asInt),_.attributes!=null&&_.attributes.length)for(var I=0;I<_.attributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[I],N.uint32(58).fork()).ldelim();return _.flags!=null&&Object.hasOwnProperty.call(_,"flags")&&N.uint32(64).uint32(_.flags),N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.NumberDataPoint;_.pos<I;){var V=_.uint32();switch(V>>>3){case 7:{x.attributes&&x.attributes.length||(x.attributes=[]),x.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 2:{x.startTimeUnixNano=_.fixed64();break}case 3:{x.timeUnixNano=_.fixed64();break}case 4:{x.asDouble=_.double();break}case 6:{x.asInt=_.sfixed64();break}case 5:{x.exemplars&&x.exemplars.length||(x.exemplars=[]),x.exemplars.push(O.opentelemetry.proto.metrics.v1.Exemplar.decode(_,_.uint32()));break}case 8:{x.flags=_.uint32();break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";var N={};if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var I=0;I<_.attributes.length;++I){var x=O.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[I]);if(x)return"attributes."+x}}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&!P.isInteger(_.startTimeUnixNano)&&!(_.startTimeUnixNano&&P.isInteger(_.startTimeUnixNano.low)&&P.isInteger(_.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&!P.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&P.isInteger(_.timeUnixNano.low)&&P.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(_.asDouble!=null&&_.hasOwnProperty("asDouble")&&(N.value=1,typeof _.asDouble!="number"))return"asDouble: number expected";if(_.asInt!=null&&_.hasOwnProperty("asInt")){if(N.value===1)return"value: multiple values";if(N.value=1,!P.isInteger(_.asInt)&&!(_.asInt&&P.isInteger(_.asInt.low)&&P.isInteger(_.asInt.high)))return"asInt: integer|Long expected"}if(_.exemplars!=null&&_.hasOwnProperty("exemplars")){if(!Array.isArray(_.exemplars))return"exemplars: array expected";for(var I=0;I<_.exemplars.length;++I){var x=O.opentelemetry.proto.metrics.v1.Exemplar.verify(_.exemplars[I]);if(x)return"exemplars."+x}}return _.flags!=null&&_.hasOwnProperty("flags")&&!P.isInteger(_.flags)?"flags: integer expected":null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.NumberDataPoint)return _;var N=new O.opentelemetry.proto.metrics.v1.NumberDataPoint;if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: array expected");N.attributes=[];for(var I=0;I<_.attributes.length;++I){if(typeof _.attributes[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: object expected");N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[I])}}if(_.startTimeUnixNano!=null&&(P.Long?(N.startTimeUnixNano=P.Long.fromValue(_.startTimeUnixNano)).unsigned=!1:typeof _.startTimeUnixNano=="string"?N.startTimeUnixNano=parseInt(_.startTimeUnixNano,10):typeof _.startTimeUnixNano=="number"?N.startTimeUnixNano=_.startTimeUnixNano:typeof _.startTimeUnixNano=="object"&&(N.startTimeUnixNano=new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber())),_.timeUnixNano!=null&&(P.Long?(N.timeUnixNano=P.Long.fromValue(_.timeUnixNano)).unsigned=!1:typeof _.timeUnixNano=="string"?N.timeUnixNano=parseInt(_.timeUnixNano,10):typeof _.timeUnixNano=="number"?N.timeUnixNano=_.timeUnixNano:typeof _.timeUnixNano=="object"&&(N.timeUnixNano=new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber())),_.asDouble!=null&&(N.asDouble=Number(_.asDouble)),_.asInt!=null&&(P.Long?(N.asInt=P.Long.fromValue(_.asInt)).unsigned=!1:typeof _.asInt=="string"?N.asInt=parseInt(_.asInt,10):typeof _.asInt=="number"?N.asInt=_.asInt:typeof _.asInt=="object"&&(N.asInt=new P.LongBits(_.asInt.low>>>0,_.asInt.high>>>0).toNumber())),_.exemplars){if(!Array.isArray(_.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: array expected");N.exemplars=[];for(var I=0;I<_.exemplars.length;++I){if(typeof _.exemplars[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: object expected");N.exemplars[I]=O.opentelemetry.proto.metrics.v1.Exemplar.fromObject(_.exemplars[I])}}return _.flags!=null&&(N.flags=_.flags>>>0),N},C.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.exemplars=[],I.attributes=[]),N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.startTimeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.startTimeUnixNano=N.longs===String?"0":0;if(P.Long){var x=new P.Long(0,0,!1);I.timeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.timeUnixNano=N.longs===String?"0":0;I.flags=0}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&(typeof _.startTimeUnixNano=="number"?I.startTimeUnixNano=N.longs===String?String(_.startTimeUnixNano):_.startTimeUnixNano:I.startTimeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.startTimeUnixNano):N.longs===Number?new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber():_.startTimeUnixNano),_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&(typeof _.timeUnixNano=="number"?I.timeUnixNano=N.longs===String?String(_.timeUnixNano):_.timeUnixNano:I.timeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.timeUnixNano):N.longs===Number?new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano),_.asDouble!=null&&_.hasOwnProperty("asDouble")&&(I.asDouble=N.json&&!isFinite(_.asDouble)?String(_.asDouble):_.asDouble,N.oneofs&&(I.value="asDouble")),_.exemplars&&_.exemplars.length){I.exemplars=[];for(var V=0;V<_.exemplars.length;++V)I.exemplars[V]=O.opentelemetry.proto.metrics.v1.Exemplar.toObject(_.exemplars[V],N)}if(_.asInt!=null&&_.hasOwnProperty("asInt")&&(typeof _.asInt=="number"?I.asInt=N.longs===String?String(_.asInt):_.asInt:I.asInt=N.longs===String?P.Long.prototype.toString.call(_.asInt):N.longs===Number?new P.LongBits(_.asInt.low>>>0,_.asInt.high>>>0).toNumber():_.asInt,N.oneofs&&(I.value="asInt")),_.attributes&&_.attributes.length){I.attributes=[];for(var V=0;V<_.attributes.length;++V)I.attributes[V]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[V],N)}return _.flags!=null&&_.hasOwnProperty("flags")&&(I.flags=_.flags),I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.NumberDataPoint"},C})(),U.HistogramDataPoint=(function(){function C(y){if(this.attributes=[],this.bucketCounts=[],this.explicitBounds=[],this.exemplars=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.attributes=P.emptyArray,C.prototype.startTimeUnixNano=null,C.prototype.timeUnixNano=null,C.prototype.count=null,C.prototype.sum=null,C.prototype.bucketCounts=P.emptyArray,C.prototype.explicitBounds=P.emptyArray,C.prototype.exemplars=P.emptyArray,C.prototype.flags=null,C.prototype.min=null,C.prototype.max=null;var L;return Object.defineProperty(C.prototype,"_sum",{get:P.oneOfGetter(L=["sum"]),set:P.oneOfSetter(L)}),Object.defineProperty(C.prototype,"_min",{get:P.oneOfGetter(L=["min"]),set:P.oneOfSetter(L)}),Object.defineProperty(C.prototype,"_max",{get:P.oneOfGetter(L=["max"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){if(N||(N=A.create()),_.startTimeUnixNano!=null&&Object.hasOwnProperty.call(_,"startTimeUnixNano")&&N.uint32(17).fixed64(_.startTimeUnixNano),_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano")&&N.uint32(25).fixed64(_.timeUnixNano),_.count!=null&&Object.hasOwnProperty.call(_,"count")&&N.uint32(33).fixed64(_.count),_.sum!=null&&Object.hasOwnProperty.call(_,"sum")&&N.uint32(41).double(_.sum),_.bucketCounts!=null&&_.bucketCounts.length){N.uint32(50).fork();for(var I=0;I<_.bucketCounts.length;++I)N.fixed64(_.bucketCounts[I]);N.ldelim()}if(_.explicitBounds!=null&&_.explicitBounds.length){N.uint32(58).fork();for(var I=0;I<_.explicitBounds.length;++I)N.double(_.explicitBounds[I]);N.ldelim()}if(_.exemplars!=null&&_.exemplars.length)for(var I=0;I<_.exemplars.length;++I)O.opentelemetry.proto.metrics.v1.Exemplar.encode(_.exemplars[I],N.uint32(66).fork()).ldelim();if(_.attributes!=null&&_.attributes.length)for(var I=0;I<_.attributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[I],N.uint32(74).fork()).ldelim();return _.flags!=null&&Object.hasOwnProperty.call(_,"flags")&&N.uint32(80).uint32(_.flags),_.min!=null&&Object.hasOwnProperty.call(_,"min")&&N.uint32(89).double(_.min),_.max!=null&&Object.hasOwnProperty.call(_,"max")&&N.uint32(97).double(_.max),N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.HistogramDataPoint;_.pos<I;){var V=_.uint32();switch(V>>>3){case 9:{x.attributes&&x.attributes.length||(x.attributes=[]),x.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 2:{x.startTimeUnixNano=_.fixed64();break}case 3:{x.timeUnixNano=_.fixed64();break}case 4:{x.count=_.fixed64();break}case 5:{x.sum=_.double();break}case 6:{if(x.bucketCounts&&x.bucketCounts.length||(x.bucketCounts=[]),(V&7)===2)for(var k=_.uint32()+_.pos;_.pos<k;)x.bucketCounts.push(_.fixed64());else x.bucketCounts.push(_.fixed64());break}case 7:{if(x.explicitBounds&&x.explicitBounds.length||(x.explicitBounds=[]),(V&7)===2)for(var k=_.uint32()+_.pos;_.pos<k;)x.explicitBounds.push(_.double());else x.explicitBounds.push(_.double());break}case 8:{x.exemplars&&x.exemplars.length||(x.exemplars=[]),x.exemplars.push(O.opentelemetry.proto.metrics.v1.Exemplar.decode(_,_.uint32()));break}case 10:{x.flags=_.uint32();break}case 11:{x.min=_.double();break}case 12:{x.max=_.double();break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var N=0;N<_.attributes.length;++N){var I=O.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[N]);if(I)return"attributes."+I}}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&!P.isInteger(_.startTimeUnixNano)&&!(_.startTimeUnixNano&&P.isInteger(_.startTimeUnixNano.low)&&P.isInteger(_.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&!P.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&P.isInteger(_.timeUnixNano.low)&&P.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(_.count!=null&&_.hasOwnProperty("count")&&!P.isInteger(_.count)&&!(_.count&&P.isInteger(_.count.low)&&P.isInteger(_.count.high)))return"count: integer|Long expected";if(_.sum!=null&&_.hasOwnProperty("sum")&&typeof _.sum!="number")return"sum: number expected";if(_.bucketCounts!=null&&_.hasOwnProperty("bucketCounts")){if(!Array.isArray(_.bucketCounts))return"bucketCounts: array expected";for(var N=0;N<_.bucketCounts.length;++N)if(!P.isInteger(_.bucketCounts[N])&&!(_.bucketCounts[N]&&P.isInteger(_.bucketCounts[N].low)&&P.isInteger(_.bucketCounts[N].high)))return"bucketCounts: integer|Long[] expected"}if(_.explicitBounds!=null&&_.hasOwnProperty("explicitBounds")){if(!Array.isArray(_.explicitBounds))return"explicitBounds: array expected";for(var N=0;N<_.explicitBounds.length;++N)if(typeof _.explicitBounds[N]!="number")return"explicitBounds: number[] expected"}if(_.exemplars!=null&&_.hasOwnProperty("exemplars")){if(!Array.isArray(_.exemplars))return"exemplars: array expected";for(var N=0;N<_.exemplars.length;++N){var I=O.opentelemetry.proto.metrics.v1.Exemplar.verify(_.exemplars[N]);if(I)return"exemplars."+I}}return _.flags!=null&&_.hasOwnProperty("flags")&&!P.isInteger(_.flags)?"flags: integer expected":_.min!=null&&_.hasOwnProperty("min")&&typeof _.min!="number"?"min: number expected":_.max!=null&&_.hasOwnProperty("max")&&typeof _.max!="number"?"max: number expected":null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.HistogramDataPoint)return _;var N=new O.opentelemetry.proto.metrics.v1.HistogramDataPoint;if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: array expected");N.attributes=[];for(var I=0;I<_.attributes.length;++I){if(typeof _.attributes[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: object expected");N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[I])}}if(_.startTimeUnixNano!=null&&(P.Long?(N.startTimeUnixNano=P.Long.fromValue(_.startTimeUnixNano)).unsigned=!1:typeof _.startTimeUnixNano=="string"?N.startTimeUnixNano=parseInt(_.startTimeUnixNano,10):typeof _.startTimeUnixNano=="number"?N.startTimeUnixNano=_.startTimeUnixNano:typeof _.startTimeUnixNano=="object"&&(N.startTimeUnixNano=new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber())),_.timeUnixNano!=null&&(P.Long?(N.timeUnixNano=P.Long.fromValue(_.timeUnixNano)).unsigned=!1:typeof _.timeUnixNano=="string"?N.timeUnixNano=parseInt(_.timeUnixNano,10):typeof _.timeUnixNano=="number"?N.timeUnixNano=_.timeUnixNano:typeof _.timeUnixNano=="object"&&(N.timeUnixNano=new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber())),_.count!=null&&(P.Long?(N.count=P.Long.fromValue(_.count)).unsigned=!1:typeof _.count=="string"?N.count=parseInt(_.count,10):typeof _.count=="number"?N.count=_.count:typeof _.count=="object"&&(N.count=new P.LongBits(_.count.low>>>0,_.count.high>>>0).toNumber())),_.sum!=null&&(N.sum=Number(_.sum)),_.bucketCounts){if(!Array.isArray(_.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.bucketCounts: array expected");N.bucketCounts=[];for(var I=0;I<_.bucketCounts.length;++I)P.Long?(N.bucketCounts[I]=P.Long.fromValue(_.bucketCounts[I])).unsigned=!1:typeof _.bucketCounts[I]=="string"?N.bucketCounts[I]=parseInt(_.bucketCounts[I],10):typeof _.bucketCounts[I]=="number"?N.bucketCounts[I]=_.bucketCounts[I]:typeof _.bucketCounts[I]=="object"&&(N.bucketCounts[I]=new P.LongBits(_.bucketCounts[I].low>>>0,_.bucketCounts[I].high>>>0).toNumber())}if(_.explicitBounds){if(!Array.isArray(_.explicitBounds))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.explicitBounds: array expected");N.explicitBounds=[];for(var I=0;I<_.explicitBounds.length;++I)N.explicitBounds[I]=Number(_.explicitBounds[I])}if(_.exemplars){if(!Array.isArray(_.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: array expected");N.exemplars=[];for(var I=0;I<_.exemplars.length;++I){if(typeof _.exemplars[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: object expected");N.exemplars[I]=O.opentelemetry.proto.metrics.v1.Exemplar.fromObject(_.exemplars[I])}}return _.flags!=null&&(N.flags=_.flags>>>0),_.min!=null&&(N.min=Number(_.min)),_.max!=null&&(N.max=Number(_.max)),N},C.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.bucketCounts=[],I.explicitBounds=[],I.exemplars=[],I.attributes=[]),N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.startTimeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.startTimeUnixNano=N.longs===String?"0":0;if(P.Long){var x=new P.Long(0,0,!1);I.timeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.timeUnixNano=N.longs===String?"0":0;if(P.Long){var x=new P.Long(0,0,!1);I.count=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.count=N.longs===String?"0":0;I.flags=0}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&(typeof _.startTimeUnixNano=="number"?I.startTimeUnixNano=N.longs===String?String(_.startTimeUnixNano):_.startTimeUnixNano:I.startTimeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.startTimeUnixNano):N.longs===Number?new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber():_.startTimeUnixNano),_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&(typeof _.timeUnixNano=="number"?I.timeUnixNano=N.longs===String?String(_.timeUnixNano):_.timeUnixNano:I.timeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.timeUnixNano):N.longs===Number?new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano),_.count!=null&&_.hasOwnProperty("count")&&(typeof _.count=="number"?I.count=N.longs===String?String(_.count):_.count:I.count=N.longs===String?P.Long.prototype.toString.call(_.count):N.longs===Number?new P.LongBits(_.count.low>>>0,_.count.high>>>0).toNumber():_.count),_.sum!=null&&_.hasOwnProperty("sum")&&(I.sum=N.json&&!isFinite(_.sum)?String(_.sum):_.sum,N.oneofs&&(I._sum="sum")),_.bucketCounts&&_.bucketCounts.length){I.bucketCounts=[];for(var V=0;V<_.bucketCounts.length;++V)typeof _.bucketCounts[V]=="number"?I.bucketCounts[V]=N.longs===String?String(_.bucketCounts[V]):_.bucketCounts[V]:I.bucketCounts[V]=N.longs===String?P.Long.prototype.toString.call(_.bucketCounts[V]):N.longs===Number?new P.LongBits(_.bucketCounts[V].low>>>0,_.bucketCounts[V].high>>>0).toNumber():_.bucketCounts[V]}if(_.explicitBounds&&_.explicitBounds.length){I.explicitBounds=[];for(var V=0;V<_.explicitBounds.length;++V)I.explicitBounds[V]=N.json&&!isFinite(_.explicitBounds[V])?String(_.explicitBounds[V]):_.explicitBounds[V]}if(_.exemplars&&_.exemplars.length){I.exemplars=[];for(var V=0;V<_.exemplars.length;++V)I.exemplars[V]=O.opentelemetry.proto.metrics.v1.Exemplar.toObject(_.exemplars[V],N)}if(_.attributes&&_.attributes.length){I.attributes=[];for(var V=0;V<_.attributes.length;++V)I.attributes[V]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[V],N)}return _.flags!=null&&_.hasOwnProperty("flags")&&(I.flags=_.flags),_.min!=null&&_.hasOwnProperty("min")&&(I.min=N.json&&!isFinite(_.min)?String(_.min):_.min,N.oneofs&&(I._min="min")),_.max!=null&&_.hasOwnProperty("max")&&(I.max=N.json&&!isFinite(_.max)?String(_.max):_.max,N.oneofs&&(I._max="max")),I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.HistogramDataPoint"},C})(),U.ExponentialHistogramDataPoint=(function(){function C(y){if(this.attributes=[],this.exemplars=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.attributes=P.emptyArray,C.prototype.startTimeUnixNano=null,C.prototype.timeUnixNano=null,C.prototype.count=null,C.prototype.sum=null,C.prototype.scale=null,C.prototype.zeroCount=null,C.prototype.positive=null,C.prototype.negative=null,C.prototype.flags=null,C.prototype.exemplars=P.emptyArray,C.prototype.min=null,C.prototype.max=null,C.prototype.zeroThreshold=null;var L;return Object.defineProperty(C.prototype,"_sum",{get:P.oneOfGetter(L=["sum"]),set:P.oneOfSetter(L)}),Object.defineProperty(C.prototype,"_min",{get:P.oneOfGetter(L=["min"]),set:P.oneOfSetter(L)}),Object.defineProperty(C.prototype,"_max",{get:P.oneOfGetter(L=["max"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){if(N||(N=A.create()),_.attributes!=null&&_.attributes.length)for(var I=0;I<_.attributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.attributes[I],N.uint32(10).fork()).ldelim();if(_.startTimeUnixNano!=null&&Object.hasOwnProperty.call(_,"startTimeUnixNano")&&N.uint32(17).fixed64(_.startTimeUnixNano),_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano")&&N.uint32(25).fixed64(_.timeUnixNano),_.count!=null&&Object.hasOwnProperty.call(_,"count")&&N.uint32(33).fixed64(_.count),_.sum!=null&&Object.hasOwnProperty.call(_,"sum")&&N.uint32(41).double(_.sum),_.scale!=null&&Object.hasOwnProperty.call(_,"scale")&&N.uint32(48).sint32(_.scale),_.zeroCount!=null&&Object.hasOwnProperty.call(_,"zeroCount")&&N.uint32(57).fixed64(_.zeroCount),_.positive!=null&&Object.hasOwnProperty.call(_,"positive")&&O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(_.positive,N.uint32(66).fork()).ldelim(),_.negative!=null&&Object.hasOwnProperty.call(_,"negative")&&O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(_.negative,N.uint32(74).fork()).ldelim(),_.flags!=null&&Object.hasOwnProperty.call(_,"flags")&&N.uint32(80).uint32(_.flags),_.exemplars!=null&&_.exemplars.length)for(var I=0;I<_.exemplars.length;++I)O.opentelemetry.proto.metrics.v1.Exemplar.encode(_.exemplars[I],N.uint32(90).fork()).ldelim();return _.min!=null&&Object.hasOwnProperty.call(_,"min")&&N.uint32(97).double(_.min),_.max!=null&&Object.hasOwnProperty.call(_,"max")&&N.uint32(105).double(_.max),_.zeroThreshold!=null&&Object.hasOwnProperty.call(_,"zeroThreshold")&&N.uint32(113).double(_.zeroThreshold),N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.attributes&&x.attributes.length||(x.attributes=[]),x.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 2:{x.startTimeUnixNano=_.fixed64();break}case 3:{x.timeUnixNano=_.fixed64();break}case 4:{x.count=_.fixed64();break}case 5:{x.sum=_.double();break}case 6:{x.scale=_.sint32();break}case 7:{x.zeroCount=_.fixed64();break}case 8:{x.positive=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(_,_.uint32());break}case 9:{x.negative=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(_,_.uint32());break}case 10:{x.flags=_.uint32();break}case 11:{x.exemplars&&x.exemplars.length||(x.exemplars=[]),x.exemplars.push(O.opentelemetry.proto.metrics.v1.Exemplar.decode(_,_.uint32()));break}case 12:{x.min=_.double();break}case 13:{x.max=_.double();break}case 14:{x.zeroThreshold=_.double();break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";if(_.attributes!=null&&_.hasOwnProperty("attributes")){if(!Array.isArray(_.attributes))return"attributes: array expected";for(var N=0;N<_.attributes.length;++N){var I=O.opentelemetry.proto.common.v1.KeyValue.verify(_.attributes[N]);if(I)return"attributes."+I}}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&!P.isInteger(_.startTimeUnixNano)&&!(_.startTimeUnixNano&&P.isInteger(_.startTimeUnixNano.low)&&P.isInteger(_.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&!P.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&P.isInteger(_.timeUnixNano.low)&&P.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(_.count!=null&&_.hasOwnProperty("count")&&!P.isInteger(_.count)&&!(_.count&&P.isInteger(_.count.low)&&P.isInteger(_.count.high)))return"count: integer|Long expected";if(_.sum!=null&&_.hasOwnProperty("sum")&&typeof _.sum!="number")return"sum: number expected";if(_.scale!=null&&_.hasOwnProperty("scale")&&!P.isInteger(_.scale))return"scale: integer expected";if(_.zeroCount!=null&&_.hasOwnProperty("zeroCount")&&!P.isInteger(_.zeroCount)&&!(_.zeroCount&&P.isInteger(_.zeroCount.low)&&P.isInteger(_.zeroCount.high)))return"zeroCount: integer|Long expected";if(_.positive!=null&&_.hasOwnProperty("positive")){var I=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(_.positive);if(I)return"positive."+I}if(_.negative!=null&&_.hasOwnProperty("negative")){var I=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(_.negative);if(I)return"negative."+I}if(_.flags!=null&&_.hasOwnProperty("flags")&&!P.isInteger(_.flags))return"flags: integer expected";if(_.exemplars!=null&&_.hasOwnProperty("exemplars")){if(!Array.isArray(_.exemplars))return"exemplars: array expected";for(var N=0;N<_.exemplars.length;++N){var I=O.opentelemetry.proto.metrics.v1.Exemplar.verify(_.exemplars[N]);if(I)return"exemplars."+I}}return _.min!=null&&_.hasOwnProperty("min")&&typeof _.min!="number"?"min: number expected":_.max!=null&&_.hasOwnProperty("max")&&typeof _.max!="number"?"max: number expected":_.zeroThreshold!=null&&_.hasOwnProperty("zeroThreshold")&&typeof _.zeroThreshold!="number"?"zeroThreshold: number expected":null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint)return _;var N=new O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;if(_.attributes){if(!Array.isArray(_.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: array expected");N.attributes=[];for(var I=0;I<_.attributes.length;++I){if(typeof _.attributes[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: object expected");N.attributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.attributes[I])}}if(_.startTimeUnixNano!=null&&(P.Long?(N.startTimeUnixNano=P.Long.fromValue(_.startTimeUnixNano)).unsigned=!1:typeof _.startTimeUnixNano=="string"?N.startTimeUnixNano=parseInt(_.startTimeUnixNano,10):typeof _.startTimeUnixNano=="number"?N.startTimeUnixNano=_.startTimeUnixNano:typeof _.startTimeUnixNano=="object"&&(N.startTimeUnixNano=new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber())),_.timeUnixNano!=null&&(P.Long?(N.timeUnixNano=P.Long.fromValue(_.timeUnixNano)).unsigned=!1:typeof _.timeUnixNano=="string"?N.timeUnixNano=parseInt(_.timeUnixNano,10):typeof _.timeUnixNano=="number"?N.timeUnixNano=_.timeUnixNano:typeof _.timeUnixNano=="object"&&(N.timeUnixNano=new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber())),_.count!=null&&(P.Long?(N.count=P.Long.fromValue(_.count)).unsigned=!1:typeof _.count=="string"?N.count=parseInt(_.count,10):typeof _.count=="number"?N.count=_.count:typeof _.count=="object"&&(N.count=new P.LongBits(_.count.low>>>0,_.count.high>>>0).toNumber())),_.sum!=null&&(N.sum=Number(_.sum)),_.scale!=null&&(N.scale=_.scale|0),_.zeroCount!=null&&(P.Long?(N.zeroCount=P.Long.fromValue(_.zeroCount)).unsigned=!1:typeof _.zeroCount=="string"?N.zeroCount=parseInt(_.zeroCount,10):typeof _.zeroCount=="number"?N.zeroCount=_.zeroCount:typeof _.zeroCount=="object"&&(N.zeroCount=new P.LongBits(_.zeroCount.low>>>0,_.zeroCount.high>>>0).toNumber())),_.positive!=null){if(typeof _.positive!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive: object expected");N.positive=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(_.positive)}if(_.negative!=null){if(typeof _.negative!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative: object expected");N.negative=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(_.negative)}if(_.flags!=null&&(N.flags=_.flags>>>0),_.exemplars){if(!Array.isArray(_.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: array expected");N.exemplars=[];for(var I=0;I<_.exemplars.length;++I){if(typeof _.exemplars[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: object expected");N.exemplars[I]=O.opentelemetry.proto.metrics.v1.Exemplar.fromObject(_.exemplars[I])}}return _.min!=null&&(N.min=Number(_.min)),_.max!=null&&(N.max=Number(_.max)),_.zeroThreshold!=null&&(N.zeroThreshold=Number(_.zeroThreshold)),N},C.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.attributes=[],I.exemplars=[]),N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.startTimeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.startTimeUnixNano=N.longs===String?"0":0;if(P.Long){var x=new P.Long(0,0,!1);I.timeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.timeUnixNano=N.longs===String?"0":0;if(P.Long){var x=new P.Long(0,0,!1);I.count=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.count=N.longs===String?"0":0;if(I.scale=0,P.Long){var x=new P.Long(0,0,!1);I.zeroCount=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.zeroCount=N.longs===String?"0":0;I.positive=null,I.negative=null,I.flags=0,I.zeroThreshold=0}if(_.attributes&&_.attributes.length){I.attributes=[];for(var V=0;V<_.attributes.length;++V)I.attributes[V]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.attributes[V],N)}if(_.startTimeUnixNano!=null&&_.hasOwnProperty("startTimeUnixNano")&&(typeof _.startTimeUnixNano=="number"?I.startTimeUnixNano=N.longs===String?String(_.startTimeUnixNano):_.startTimeUnixNano:I.startTimeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.startTimeUnixNano):N.longs===Number?new P.LongBits(_.startTimeUnixNano.low>>>0,_.startTimeUnixNano.high>>>0).toNumber():_.startTimeUnixNano),_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&(typeof _.timeUnixNano=="number"?I.timeUnixNano=N.longs===String?String(_.timeUnixNano):_.timeUnixNano:I.timeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.timeUnixNano):N.longs===Number?new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano),_.count!=null&&_.hasOwnProperty("count")&&(typeof _.count=="number"?I.count=N.longs===String?String(_.count):_.count:I.count=N.longs===String?P.Long.prototype.toString.call(_.count):N.longs===Number?new P.LongBits(_.count.low>>>0,_.count.high>>>0).toNumber():_.count),_.sum!=null&&_.hasOwnProperty("sum")&&(I.sum=N.json&&!isFinite(_.sum)?String(_.sum):_.sum,N.oneofs&&(I._sum="sum")),_.scale!=null&&_.hasOwnProperty("scale")&&(I.scale=_.scale),_.zeroCount!=null&&_.hasOwnProperty("zeroCount")&&(typeof _.zeroCount=="number"?I.zeroCount=N.longs===String?String(_.zeroCount):_.zeroCount:I.zeroCount=N.longs===String?P.Long.prototype.toString.call(_.zeroCount):N.longs===Number?new P.LongBits(_.zeroCount.low>>>0,_.zeroCount.high>>>0).toNumber():_.zeroCount),_.positive!=null&&_.hasOwnProperty("positive")&&(I.positive=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(_.positive,N)),_.negative!=null&&_.hasOwnProperty("negative")&&(I.negative=O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(_.negative,N)),_.flags!=null&&_.hasOwnProperty("flags")&&(I.flags=_.flags),_.exemplars&&_.exemplars.length){I.exemplars=[];for(var V=0;V<_.exemplars.length;++V)I.exemplars[V]=O.opentelemetry.proto.metrics.v1.Exemplar.toObject(_.exemplars[V],N)}return _.min!=null&&_.hasOwnProperty("min")&&(I.min=N.json&&!isFinite(_.min)?String(_.min):_.min,N.oneofs&&(I._min="min")),_.max!=null&&_.hasOwnProperty("max")&&(I.max=N.json&&!isFinite(_.max)?String(_.max):_.max,N.oneofs&&(I._max="max")),_.zeroThreshold!=null&&_.hasOwnProperty("zeroThreshold")&&(I.zeroThreshold=N.json&&!isFinite(_.zeroThreshold)?String(_.zeroThreshold):_.zeroThreshold),I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"},C.Buckets=(function(){function y(_){if(this.bucketCounts=[],_)for(var N=Object.keys(_),I=0;I<N.length;++I)_[N[I]]!=null&&(this[N[I]]=_[N[I]])}return y.prototype.offset=null,y.prototype.bucketCounts=P.emptyArray,y.create=function(N){return new y(N)},y.encode=function(N,I){if(I||(I=A.create()),N.offset!=null&&Object.hasOwnProperty.call(N,"offset")&&I.uint32(8).sint32(N.offset),N.bucketCounts!=null&&N.bucketCounts.length){I.uint32(18).fork();for(var x=0;x<N.bucketCounts.length;++x)I.uint64(N.bucketCounts[x]);I.ldelim()}return I},y.encodeDelimited=function(N,I){return this.encode(N,I).ldelim()},y.decode=function(N,I){N instanceof T||(N=T.create(N));for(var x=I===void 0?N.len:N.pos+I,V=new O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;N.pos<x;){var k=N.uint32();switch(k>>>3){case 1:{V.offset=N.sint32();break}case 2:{if(V.bucketCounts&&V.bucketCounts.length||(V.bucketCounts=[]),(k&7)===2)for(var F=N.uint32()+N.pos;N.pos<F;)V.bucketCounts.push(N.uint64());else V.bucketCounts.push(N.uint64());break}default:N.skipType(k&7);break}}return V},y.decodeDelimited=function(N){return N instanceof T||(N=new T(N)),this.decode(N,N.uint32())},y.verify=function(N){if(typeof N!="object"||N===null)return"object expected";if(N.offset!=null&&N.hasOwnProperty("offset")&&!P.isInteger(N.offset))return"offset: integer expected";if(N.bucketCounts!=null&&N.hasOwnProperty("bucketCounts")){if(!Array.isArray(N.bucketCounts))return"bucketCounts: array expected";for(var I=0;I<N.bucketCounts.length;++I)if(!P.isInteger(N.bucketCounts[I])&&!(N.bucketCounts[I]&&P.isInteger(N.bucketCounts[I].low)&&P.isInteger(N.bucketCounts[I].high)))return"bucketCounts: integer|Long[] expected"}return null},y.fromObject=function(N){if(N instanceof O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets)return N;var I=new O.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;if(N.offset!=null&&(I.offset=N.offset|0),N.bucketCounts){if(!Array.isArray(N.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucketCounts: array expected");I.bucketCounts=[];for(var x=0;x<N.bucketCounts.length;++x)P.Long?(I.bucketCounts[x]=P.Long.fromValue(N.bucketCounts[x])).unsigned=!0:typeof N.bucketCounts[x]=="string"?I.bucketCounts[x]=parseInt(N.bucketCounts[x],10):typeof N.bucketCounts[x]=="number"?I.bucketCounts[x]=N.bucketCounts[x]:typeof N.bucketCounts[x]=="object"&&(I.bucketCounts[x]=new P.LongBits(N.bucketCounts[x].low>>>0,N.bucketCounts[x].high>>>0).toNumber(!0))}return I},y.toObject=function(N,I){I||(I={});var x={};if((I.arrays||I.defaults)&&(x.bucketCounts=[]),I.defaults&&(x.offset=0),N.offset!=null&&N.hasOwnProperty("offset")&&(x.offset=N.offset),N.bucketCounts&&N.bucketCounts.length){x.bucketCounts=[];for(var V=0;V<N.bucketCounts.length;++V)typeof N.bucketCounts[V]=="number"?x.bucketCounts[V]=I.longs===String?String(N.bucketCounts[V]):N.bucketCounts[V]:x.bucketCounts[V]=I.longs===String?P.Long.prototype.toString.call(N.bucketCounts[V]):I.longs===Number?new P.LongBits(N.bucketCounts[V].low>>>0,N.bucketCounts[V].high>>>0).toNumber(!0):N.bucketCounts[V]}return x},y.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},y.getTypeUrl=function(N){return N===void 0&&(N="type.googleapis.com"),N+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"},y})(),C})(),U.SummaryDataPoint=(function(){function C(L){if(this.attributes=[],this.quantileValues=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.attributes=P.emptyArray,C.prototype.startTimeUnixNano=null,C.prototype.timeUnixNano=null,C.prototype.count=null,C.prototype.sum=null,C.prototype.quantileValues=P.emptyArray,C.prototype.flags=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.startTimeUnixNano!=null&&Object.hasOwnProperty.call(y,"startTimeUnixNano")&&_.uint32(17).fixed64(y.startTimeUnixNano),y.timeUnixNano!=null&&Object.hasOwnProperty.call(y,"timeUnixNano")&&_.uint32(25).fixed64(y.timeUnixNano),y.count!=null&&Object.hasOwnProperty.call(y,"count")&&_.uint32(33).fixed64(y.count),y.sum!=null&&Object.hasOwnProperty.call(y,"sum")&&_.uint32(41).double(y.sum),y.quantileValues!=null&&y.quantileValues.length)for(var N=0;N<y.quantileValues.length;++N)O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.encode(y.quantileValues[N],_.uint32(50).fork()).ldelim();if(y.attributes!=null&&y.attributes.length)for(var N=0;N<y.attributes.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.attributes[N],_.uint32(58).fork()).ldelim();return y.flags!=null&&Object.hasOwnProperty.call(y,"flags")&&_.uint32(64).uint32(y.flags),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.metrics.v1.SummaryDataPoint;y.pos<N;){var x=y.uint32();switch(x>>>3){case 7:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}case 2:{I.startTimeUnixNano=y.fixed64();break}case 3:{I.timeUnixNano=y.fixed64();break}case 4:{I.count=y.fixed64();break}case 5:{I.sum=y.double();break}case 6:{I.quantileValues&&I.quantileValues.length||(I.quantileValues=[]),I.quantileValues.push(O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(y,y.uint32()));break}case 8:{I.flags=y.uint32();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.attributes!=null&&y.hasOwnProperty("attributes")){if(!Array.isArray(y.attributes))return"attributes: array expected";for(var _=0;_<y.attributes.length;++_){var N=O.opentelemetry.proto.common.v1.KeyValue.verify(y.attributes[_]);if(N)return"attributes."+N}}if(y.startTimeUnixNano!=null&&y.hasOwnProperty("startTimeUnixNano")&&!P.isInteger(y.startTimeUnixNano)&&!(y.startTimeUnixNano&&P.isInteger(y.startTimeUnixNano.low)&&P.isInteger(y.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(y.timeUnixNano!=null&&y.hasOwnProperty("timeUnixNano")&&!P.isInteger(y.timeUnixNano)&&!(y.timeUnixNano&&P.isInteger(y.timeUnixNano.low)&&P.isInteger(y.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(y.count!=null&&y.hasOwnProperty("count")&&!P.isInteger(y.count)&&!(y.count&&P.isInteger(y.count.low)&&P.isInteger(y.count.high)))return"count: integer|Long expected";if(y.sum!=null&&y.hasOwnProperty("sum")&&typeof y.sum!="number")return"sum: number expected";if(y.quantileValues!=null&&y.hasOwnProperty("quantileValues")){if(!Array.isArray(y.quantileValues))return"quantileValues: array expected";for(var _=0;_<y.quantileValues.length;++_){var N=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(y.quantileValues[_]);if(N)return"quantileValues."+N}}return y.flags!=null&&y.hasOwnProperty("flags")&&!P.isInteger(y.flags)?"flags: integer expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.metrics.v1.SummaryDataPoint)return y;var _=new O.opentelemetry.proto.metrics.v1.SummaryDataPoint;if(y.attributes){if(!Array.isArray(y.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: array expected");_.attributes=[];for(var N=0;N<y.attributes.length;++N){if(typeof y.attributes[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: object expected");_.attributes[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.attributes[N])}}if(y.startTimeUnixNano!=null&&(P.Long?(_.startTimeUnixNano=P.Long.fromValue(y.startTimeUnixNano)).unsigned=!1:typeof y.startTimeUnixNano=="string"?_.startTimeUnixNano=parseInt(y.startTimeUnixNano,10):typeof y.startTimeUnixNano=="number"?_.startTimeUnixNano=y.startTimeUnixNano:typeof y.startTimeUnixNano=="object"&&(_.startTimeUnixNano=new P.LongBits(y.startTimeUnixNano.low>>>0,y.startTimeUnixNano.high>>>0).toNumber())),y.timeUnixNano!=null&&(P.Long?(_.timeUnixNano=P.Long.fromValue(y.timeUnixNano)).unsigned=!1:typeof y.timeUnixNano=="string"?_.timeUnixNano=parseInt(y.timeUnixNano,10):typeof y.timeUnixNano=="number"?_.timeUnixNano=y.timeUnixNano:typeof y.timeUnixNano=="object"&&(_.timeUnixNano=new P.LongBits(y.timeUnixNano.low>>>0,y.timeUnixNano.high>>>0).toNumber())),y.count!=null&&(P.Long?(_.count=P.Long.fromValue(y.count)).unsigned=!1:typeof y.count=="string"?_.count=parseInt(y.count,10):typeof y.count=="number"?_.count=y.count:typeof y.count=="object"&&(_.count=new P.LongBits(y.count.low>>>0,y.count.high>>>0).toNumber())),y.sum!=null&&(_.sum=Number(y.sum)),y.quantileValues){if(!Array.isArray(y.quantileValues))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: array expected");_.quantileValues=[];for(var N=0;N<y.quantileValues.length;++N){if(typeof y.quantileValues[N]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: object expected");_.quantileValues[N]=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(y.quantileValues[N])}}return y.flags!=null&&(_.flags=y.flags>>>0),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.quantileValues=[],N.attributes=[]),_.defaults){if(P.Long){var I=new P.Long(0,0,!1);N.startTimeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.startTimeUnixNano=_.longs===String?"0":0;if(P.Long){var I=new P.Long(0,0,!1);N.timeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.timeUnixNano=_.longs===String?"0":0;if(P.Long){var I=new P.Long(0,0,!1);N.count=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.count=_.longs===String?"0":0;N.sum=0,N.flags=0}if(y.startTimeUnixNano!=null&&y.hasOwnProperty("startTimeUnixNano")&&(typeof y.startTimeUnixNano=="number"?N.startTimeUnixNano=_.longs===String?String(y.startTimeUnixNano):y.startTimeUnixNano:N.startTimeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.startTimeUnixNano):_.longs===Number?new P.LongBits(y.startTimeUnixNano.low>>>0,y.startTimeUnixNano.high>>>0).toNumber():y.startTimeUnixNano),y.timeUnixNano!=null&&y.hasOwnProperty("timeUnixNano")&&(typeof y.timeUnixNano=="number"?N.timeUnixNano=_.longs===String?String(y.timeUnixNano):y.timeUnixNano:N.timeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.timeUnixNano):_.longs===Number?new P.LongBits(y.timeUnixNano.low>>>0,y.timeUnixNano.high>>>0).toNumber():y.timeUnixNano),y.count!=null&&y.hasOwnProperty("count")&&(typeof y.count=="number"?N.count=_.longs===String?String(y.count):y.count:N.count=_.longs===String?P.Long.prototype.toString.call(y.count):_.longs===Number?new P.LongBits(y.count.low>>>0,y.count.high>>>0).toNumber():y.count),y.sum!=null&&y.hasOwnProperty("sum")&&(N.sum=_.json&&!isFinite(y.sum)?String(y.sum):y.sum),y.quantileValues&&y.quantileValues.length){N.quantileValues=[];for(var x=0;x<y.quantileValues.length;++x)N.quantileValues[x]=O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.toObject(y.quantileValues[x],_)}if(y.attributes&&y.attributes.length){N.attributes=[];for(var x=0;x<y.attributes.length;++x)N.attributes[x]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.attributes[x],_)}return y.flags!=null&&y.hasOwnProperty("flags")&&(N.flags=y.flags),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.metrics.v1.SummaryDataPoint"},C.ValueAtQuantile=(function(){function L(y){if(y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}return L.prototype.quantile=null,L.prototype.value=null,L.create=function(_){return new L(_)},L.encode=function(_,N){return N||(N=A.create()),_.quantile!=null&&Object.hasOwnProperty.call(_,"quantile")&&N.uint32(9).double(_.quantile),_.value!=null&&Object.hasOwnProperty.call(_,"value")&&N.uint32(17).double(_.value),N},L.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},L.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;_.pos<I;){var V=_.uint32();switch(V>>>3){case 1:{x.quantile=_.double();break}case 2:{x.value=_.double();break}default:_.skipType(V&7);break}}return x},L.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},L.verify=function(_){return typeof _!="object"||_===null?"object expected":_.quantile!=null&&_.hasOwnProperty("quantile")&&typeof _.quantile!="number"?"quantile: number expected":_.value!=null&&_.hasOwnProperty("value")&&typeof _.value!="number"?"value: number expected":null},L.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile)return _;var N=new O.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;return _.quantile!=null&&(N.quantile=Number(_.quantile)),_.value!=null&&(N.value=Number(_.value)),N},L.toObject=function(_,N){N||(N={});var I={};return N.defaults&&(I.quantile=0,I.value=0),_.quantile!=null&&_.hasOwnProperty("quantile")&&(I.quantile=N.json&&!isFinite(_.quantile)?String(_.quantile):_.quantile),_.value!=null&&_.hasOwnProperty("value")&&(I.value=N.json&&!isFinite(_.value)?String(_.value):_.value),I},L.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},L.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"},L})(),C})(),U.Exemplar=(function(){function C(y){if(this.filteredAttributes=[],y)for(var _=Object.keys(y),N=0;N<_.length;++N)y[_[N]]!=null&&(this[_[N]]=y[_[N]])}C.prototype.filteredAttributes=P.emptyArray,C.prototype.timeUnixNano=null,C.prototype.asDouble=null,C.prototype.asInt=null,C.prototype.spanId=null,C.prototype.traceId=null;var L;return Object.defineProperty(C.prototype,"value",{get:P.oneOfGetter(L=["asDouble","asInt"]),set:P.oneOfSetter(L)}),C.create=function(_){return new C(_)},C.encode=function(_,N){if(N||(N=A.create()),_.timeUnixNano!=null&&Object.hasOwnProperty.call(_,"timeUnixNano")&&N.uint32(17).fixed64(_.timeUnixNano),_.asDouble!=null&&Object.hasOwnProperty.call(_,"asDouble")&&N.uint32(25).double(_.asDouble),_.spanId!=null&&Object.hasOwnProperty.call(_,"spanId")&&N.uint32(34).bytes(_.spanId),_.traceId!=null&&Object.hasOwnProperty.call(_,"traceId")&&N.uint32(42).bytes(_.traceId),_.asInt!=null&&Object.hasOwnProperty.call(_,"asInt")&&N.uint32(49).sfixed64(_.asInt),_.filteredAttributes!=null&&_.filteredAttributes.length)for(var I=0;I<_.filteredAttributes.length;++I)O.opentelemetry.proto.common.v1.KeyValue.encode(_.filteredAttributes[I],N.uint32(58).fork()).ldelim();return N},C.encodeDelimited=function(_,N){return this.encode(_,N).ldelim()},C.decode=function(_,N){_ instanceof T||(_=T.create(_));for(var I=N===void 0?_.len:_.pos+N,x=new O.opentelemetry.proto.metrics.v1.Exemplar;_.pos<I;){var V=_.uint32();switch(V>>>3){case 7:{x.filteredAttributes&&x.filteredAttributes.length||(x.filteredAttributes=[]),x.filteredAttributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(_,_.uint32()));break}case 2:{x.timeUnixNano=_.fixed64();break}case 3:{x.asDouble=_.double();break}case 6:{x.asInt=_.sfixed64();break}case 4:{x.spanId=_.bytes();break}case 5:{x.traceId=_.bytes();break}default:_.skipType(V&7);break}}return x},C.decodeDelimited=function(_){return _ instanceof T||(_=new T(_)),this.decode(_,_.uint32())},C.verify=function(_){if(typeof _!="object"||_===null)return"object expected";var N={};if(_.filteredAttributes!=null&&_.hasOwnProperty("filteredAttributes")){if(!Array.isArray(_.filteredAttributes))return"filteredAttributes: array expected";for(var I=0;I<_.filteredAttributes.length;++I){var x=O.opentelemetry.proto.common.v1.KeyValue.verify(_.filteredAttributes[I]);if(x)return"filteredAttributes."+x}}if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&!P.isInteger(_.timeUnixNano)&&!(_.timeUnixNano&&P.isInteger(_.timeUnixNano.low)&&P.isInteger(_.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(_.asDouble!=null&&_.hasOwnProperty("asDouble")&&(N.value=1,typeof _.asDouble!="number"))return"asDouble: number expected";if(_.asInt!=null&&_.hasOwnProperty("asInt")){if(N.value===1)return"value: multiple values";if(N.value=1,!P.isInteger(_.asInt)&&!(_.asInt&&P.isInteger(_.asInt.low)&&P.isInteger(_.asInt.high)))return"asInt: integer|Long expected"}return _.spanId!=null&&_.hasOwnProperty("spanId")&&!(_.spanId&&typeof _.spanId.length=="number"||P.isString(_.spanId))?"spanId: buffer expected":_.traceId!=null&&_.hasOwnProperty("traceId")&&!(_.traceId&&typeof _.traceId.length=="number"||P.isString(_.traceId))?"traceId: buffer expected":null},C.fromObject=function(_){if(_ instanceof O.opentelemetry.proto.metrics.v1.Exemplar)return _;var N=new O.opentelemetry.proto.metrics.v1.Exemplar;if(_.filteredAttributes){if(!Array.isArray(_.filteredAttributes))throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: array expected");N.filteredAttributes=[];for(var I=0;I<_.filteredAttributes.length;++I){if(typeof _.filteredAttributes[I]!="object")throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: object expected");N.filteredAttributes[I]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(_.filteredAttributes[I])}}return _.timeUnixNano!=null&&(P.Long?(N.timeUnixNano=P.Long.fromValue(_.timeUnixNano)).unsigned=!1:typeof _.timeUnixNano=="string"?N.timeUnixNano=parseInt(_.timeUnixNano,10):typeof _.timeUnixNano=="number"?N.timeUnixNano=_.timeUnixNano:typeof _.timeUnixNano=="object"&&(N.timeUnixNano=new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber())),_.asDouble!=null&&(N.asDouble=Number(_.asDouble)),_.asInt!=null&&(P.Long?(N.asInt=P.Long.fromValue(_.asInt)).unsigned=!1:typeof _.asInt=="string"?N.asInt=parseInt(_.asInt,10):typeof _.asInt=="number"?N.asInt=_.asInt:typeof _.asInt=="object"&&(N.asInt=new P.LongBits(_.asInt.low>>>0,_.asInt.high>>>0).toNumber())),_.spanId!=null&&(typeof _.spanId=="string"?P.base64.decode(_.spanId,N.spanId=P.newBuffer(P.base64.length(_.spanId)),0):_.spanId.length>=0&&(N.spanId=_.spanId)),_.traceId!=null&&(typeof _.traceId=="string"?P.base64.decode(_.traceId,N.traceId=P.newBuffer(P.base64.length(_.traceId)),0):_.traceId.length>=0&&(N.traceId=_.traceId)),N},C.toObject=function(_,N){N||(N={});var I={};if((N.arrays||N.defaults)&&(I.filteredAttributes=[]),N.defaults){if(P.Long){var x=new P.Long(0,0,!1);I.timeUnixNano=N.longs===String?x.toString():N.longs===Number?x.toNumber():x}else I.timeUnixNano=N.longs===String?"0":0;N.bytes===String?I.spanId="":(I.spanId=[],N.bytes!==Array&&(I.spanId=P.newBuffer(I.spanId))),N.bytes===String?I.traceId="":(I.traceId=[],N.bytes!==Array&&(I.traceId=P.newBuffer(I.traceId)))}if(_.timeUnixNano!=null&&_.hasOwnProperty("timeUnixNano")&&(typeof _.timeUnixNano=="number"?I.timeUnixNano=N.longs===String?String(_.timeUnixNano):_.timeUnixNano:I.timeUnixNano=N.longs===String?P.Long.prototype.toString.call(_.timeUnixNano):N.longs===Number?new P.LongBits(_.timeUnixNano.low>>>0,_.timeUnixNano.high>>>0).toNumber():_.timeUnixNano),_.asDouble!=null&&_.hasOwnProperty("asDouble")&&(I.asDouble=N.json&&!isFinite(_.asDouble)?String(_.asDouble):_.asDouble,N.oneofs&&(I.value="asDouble")),_.spanId!=null&&_.hasOwnProperty("spanId")&&(I.spanId=N.bytes===String?P.base64.encode(_.spanId,0,_.spanId.length):N.bytes===Array?Array.prototype.slice.call(_.spanId):_.spanId),_.traceId!=null&&_.hasOwnProperty("traceId")&&(I.traceId=N.bytes===String?P.base64.encode(_.traceId,0,_.traceId.length):N.bytes===Array?Array.prototype.slice.call(_.traceId):_.traceId),_.asInt!=null&&_.hasOwnProperty("asInt")&&(typeof _.asInt=="number"?I.asInt=N.longs===String?String(_.asInt):_.asInt:I.asInt=N.longs===String?P.Long.prototype.toString.call(_.asInt):N.longs===Number?new P.LongBits(_.asInt.low>>>0,_.asInt.high>>>0).toNumber():_.asInt,N.oneofs&&(I.value="asInt")),_.filteredAttributes&&_.filteredAttributes.length){I.filteredAttributes=[];for(var V=0;V<_.filteredAttributes.length;++V)I.filteredAttributes[V]=O.opentelemetry.proto.common.v1.KeyValue.toObject(_.filteredAttributes[V],N)}return I},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(_){return _===void 0&&(_="type.googleapis.com"),_+"/opentelemetry.proto.metrics.v1.Exemplar"},C})(),U})(),D})(),M.logs=(function(){var D={};return D.v1=(function(){var U={};return U.LogsData=(function(){function C(L){if(this.resourceLogs=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resourceLogs=P.emptyArray,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resourceLogs!=null&&y.resourceLogs.length)for(var N=0;N<y.resourceLogs.length;++N)O.opentelemetry.proto.logs.v1.ResourceLogs.encode(y.resourceLogs[N],_.uint32(10).fork()).ldelim();return _},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.logs.v1.LogsData;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resourceLogs&&I.resourceLogs.length||(I.resourceLogs=[]),I.resourceLogs.push(O.opentelemetry.proto.logs.v1.ResourceLogs.decode(y,y.uint32()));break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resourceLogs!=null&&y.hasOwnProperty("resourceLogs")){if(!Array.isArray(y.resourceLogs))return"resourceLogs: array expected";for(var _=0;_<y.resourceLogs.length;++_){var N=O.opentelemetry.proto.logs.v1.ResourceLogs.verify(y.resourceLogs[_]);if(N)return"resourceLogs."+N}}return null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.logs.v1.LogsData)return y;var _=new O.opentelemetry.proto.logs.v1.LogsData;if(y.resourceLogs){if(!Array.isArray(y.resourceLogs))throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: array expected");_.resourceLogs=[];for(var N=0;N<y.resourceLogs.length;++N){if(typeof y.resourceLogs[N]!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: object expected");_.resourceLogs[N]=O.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(y.resourceLogs[N])}}return _},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.resourceLogs=[]),y.resourceLogs&&y.resourceLogs.length){N.resourceLogs=[];for(var I=0;I<y.resourceLogs.length;++I)N.resourceLogs[I]=O.opentelemetry.proto.logs.v1.ResourceLogs.toObject(y.resourceLogs[I],_)}return N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.logs.v1.LogsData"},C})(),U.ResourceLogs=(function(){function C(L){if(this.scopeLogs=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.resource=null,C.prototype.scopeLogs=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.resource!=null&&Object.hasOwnProperty.call(y,"resource")&&O.opentelemetry.proto.resource.v1.Resource.encode(y.resource,_.uint32(10).fork()).ldelim(),y.scopeLogs!=null&&y.scopeLogs.length)for(var N=0;N<y.scopeLogs.length;++N)O.opentelemetry.proto.logs.v1.ScopeLogs.encode(y.scopeLogs[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.logs.v1.ResourceLogs;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.resource=O.opentelemetry.proto.resource.v1.Resource.decode(y,y.uint32());break}case 2:{I.scopeLogs&&I.scopeLogs.length||(I.scopeLogs=[]),I.scopeLogs.push(O.opentelemetry.proto.logs.v1.ScopeLogs.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.resource!=null&&y.hasOwnProperty("resource")){var _=O.opentelemetry.proto.resource.v1.Resource.verify(y.resource);if(_)return"resource."+_}if(y.scopeLogs!=null&&y.hasOwnProperty("scopeLogs")){if(!Array.isArray(y.scopeLogs))return"scopeLogs: array expected";for(var N=0;N<y.scopeLogs.length;++N){var _=O.opentelemetry.proto.logs.v1.ScopeLogs.verify(y.scopeLogs[N]);if(_)return"scopeLogs."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.logs.v1.ResourceLogs)return y;var _=new O.opentelemetry.proto.logs.v1.ResourceLogs;if(y.resource!=null){if(typeof y.resource!="object")throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.resource: object expected");_.resource=O.opentelemetry.proto.resource.v1.Resource.fromObject(y.resource)}if(y.scopeLogs){if(!Array.isArray(y.scopeLogs))throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: array expected");_.scopeLogs=[];for(var N=0;N<y.scopeLogs.length;++N){if(typeof y.scopeLogs[N]!="object")throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: object expected");_.scopeLogs[N]=O.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(y.scopeLogs[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.scopeLogs=[]),_.defaults&&(N.resource=null,N.schemaUrl=""),y.resource!=null&&y.hasOwnProperty("resource")&&(N.resource=O.opentelemetry.proto.resource.v1.Resource.toObject(y.resource,_)),y.scopeLogs&&y.scopeLogs.length){N.scopeLogs=[];for(var I=0;I<y.scopeLogs.length;++I)N.scopeLogs[I]=O.opentelemetry.proto.logs.v1.ScopeLogs.toObject(y.scopeLogs[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.logs.v1.ResourceLogs"},C})(),U.ScopeLogs=(function(){function C(L){if(this.logRecords=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.scope=null,C.prototype.logRecords=P.emptyArray,C.prototype.schemaUrl=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.scope!=null&&Object.hasOwnProperty.call(y,"scope")&&O.opentelemetry.proto.common.v1.InstrumentationScope.encode(y.scope,_.uint32(10).fork()).ldelim(),y.logRecords!=null&&y.logRecords.length)for(var N=0;N<y.logRecords.length;++N)O.opentelemetry.proto.logs.v1.LogRecord.encode(y.logRecords[N],_.uint32(18).fork()).ldelim();return y.schemaUrl!=null&&Object.hasOwnProperty.call(y,"schemaUrl")&&_.uint32(26).string(y.schemaUrl),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.logs.v1.ScopeLogs;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.decode(y,y.uint32());break}case 2:{I.logRecords&&I.logRecords.length||(I.logRecords=[]),I.logRecords.push(O.opentelemetry.proto.logs.v1.LogRecord.decode(y,y.uint32()));break}case 3:{I.schemaUrl=y.string();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.scope!=null&&y.hasOwnProperty("scope")){var _=O.opentelemetry.proto.common.v1.InstrumentationScope.verify(y.scope);if(_)return"scope."+_}if(y.logRecords!=null&&y.hasOwnProperty("logRecords")){if(!Array.isArray(y.logRecords))return"logRecords: array expected";for(var N=0;N<y.logRecords.length;++N){var _=O.opentelemetry.proto.logs.v1.LogRecord.verify(y.logRecords[N]);if(_)return"logRecords."+_}}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&!P.isString(y.schemaUrl)?"schemaUrl: string expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.logs.v1.ScopeLogs)return y;var _=new O.opentelemetry.proto.logs.v1.ScopeLogs;if(y.scope!=null){if(typeof y.scope!="object")throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.scope: object expected");_.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(y.scope)}if(y.logRecords){if(!Array.isArray(y.logRecords))throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: array expected");_.logRecords=[];for(var N=0;N<y.logRecords.length;++N){if(typeof y.logRecords[N]!="object")throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: object expected");_.logRecords[N]=O.opentelemetry.proto.logs.v1.LogRecord.fromObject(y.logRecords[N])}}return y.schemaUrl!=null&&(_.schemaUrl=String(y.schemaUrl)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.logRecords=[]),_.defaults&&(N.scope=null,N.schemaUrl=""),y.scope!=null&&y.hasOwnProperty("scope")&&(N.scope=O.opentelemetry.proto.common.v1.InstrumentationScope.toObject(y.scope,_)),y.logRecords&&y.logRecords.length){N.logRecords=[];for(var I=0;I<y.logRecords.length;++I)N.logRecords[I]=O.opentelemetry.proto.logs.v1.LogRecord.toObject(y.logRecords[I],_)}return y.schemaUrl!=null&&y.hasOwnProperty("schemaUrl")&&(N.schemaUrl=y.schemaUrl),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.logs.v1.ScopeLogs"},C})(),U.SeverityNumber=(function(){var C={},L=Object.create(C);return L[C[0]="SEVERITY_NUMBER_UNSPECIFIED"]=0,L[C[1]="SEVERITY_NUMBER_TRACE"]=1,L[C[2]="SEVERITY_NUMBER_TRACE2"]=2,L[C[3]="SEVERITY_NUMBER_TRACE3"]=3,L[C[4]="SEVERITY_NUMBER_TRACE4"]=4,L[C[5]="SEVERITY_NUMBER_DEBUG"]=5,L[C[6]="SEVERITY_NUMBER_DEBUG2"]=6,L[C[7]="SEVERITY_NUMBER_DEBUG3"]=7,L[C[8]="SEVERITY_NUMBER_DEBUG4"]=8,L[C[9]="SEVERITY_NUMBER_INFO"]=9,L[C[10]="SEVERITY_NUMBER_INFO2"]=10,L[C[11]="SEVERITY_NUMBER_INFO3"]=11,L[C[12]="SEVERITY_NUMBER_INFO4"]=12,L[C[13]="SEVERITY_NUMBER_WARN"]=13,L[C[14]="SEVERITY_NUMBER_WARN2"]=14,L[C[15]="SEVERITY_NUMBER_WARN3"]=15,L[C[16]="SEVERITY_NUMBER_WARN4"]=16,L[C[17]="SEVERITY_NUMBER_ERROR"]=17,L[C[18]="SEVERITY_NUMBER_ERROR2"]=18,L[C[19]="SEVERITY_NUMBER_ERROR3"]=19,L[C[20]="SEVERITY_NUMBER_ERROR4"]=20,L[C[21]="SEVERITY_NUMBER_FATAL"]=21,L[C[22]="SEVERITY_NUMBER_FATAL2"]=22,L[C[23]="SEVERITY_NUMBER_FATAL3"]=23,L[C[24]="SEVERITY_NUMBER_FATAL4"]=24,L})(),U.LogRecordFlags=(function(){var C={},L=Object.create(C);return L[C[0]="LOG_RECORD_FLAGS_DO_NOT_USE"]=0,L[C[255]="LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"]=255,L})(),U.LogRecord=(function(){function C(L){if(this.attributes=[],L)for(var y=Object.keys(L),_=0;_<y.length;++_)L[y[_]]!=null&&(this[y[_]]=L[y[_]])}return C.prototype.timeUnixNano=null,C.prototype.observedTimeUnixNano=null,C.prototype.severityNumber=null,C.prototype.severityText=null,C.prototype.body=null,C.prototype.attributes=P.emptyArray,C.prototype.droppedAttributesCount=null,C.prototype.flags=null,C.prototype.traceId=null,C.prototype.spanId=null,C.create=function(y){return new C(y)},C.encode=function(y,_){if(_||(_=A.create()),y.timeUnixNano!=null&&Object.hasOwnProperty.call(y,"timeUnixNano")&&_.uint32(9).fixed64(y.timeUnixNano),y.severityNumber!=null&&Object.hasOwnProperty.call(y,"severityNumber")&&_.uint32(16).int32(y.severityNumber),y.severityText!=null&&Object.hasOwnProperty.call(y,"severityText")&&_.uint32(26).string(y.severityText),y.body!=null&&Object.hasOwnProperty.call(y,"body")&&O.opentelemetry.proto.common.v1.AnyValue.encode(y.body,_.uint32(42).fork()).ldelim(),y.attributes!=null&&y.attributes.length)for(var N=0;N<y.attributes.length;++N)O.opentelemetry.proto.common.v1.KeyValue.encode(y.attributes[N],_.uint32(50).fork()).ldelim();return y.droppedAttributesCount!=null&&Object.hasOwnProperty.call(y,"droppedAttributesCount")&&_.uint32(56).uint32(y.droppedAttributesCount),y.flags!=null&&Object.hasOwnProperty.call(y,"flags")&&_.uint32(69).fixed32(y.flags),y.traceId!=null&&Object.hasOwnProperty.call(y,"traceId")&&_.uint32(74).bytes(y.traceId),y.spanId!=null&&Object.hasOwnProperty.call(y,"spanId")&&_.uint32(82).bytes(y.spanId),y.observedTimeUnixNano!=null&&Object.hasOwnProperty.call(y,"observedTimeUnixNano")&&_.uint32(89).fixed64(y.observedTimeUnixNano),_},C.encodeDelimited=function(y,_){return this.encode(y,_).ldelim()},C.decode=function(y,_){y instanceof T||(y=T.create(y));for(var N=_===void 0?y.len:y.pos+_,I=new O.opentelemetry.proto.logs.v1.LogRecord;y.pos<N;){var x=y.uint32();switch(x>>>3){case 1:{I.timeUnixNano=y.fixed64();break}case 11:{I.observedTimeUnixNano=y.fixed64();break}case 2:{I.severityNumber=y.int32();break}case 3:{I.severityText=y.string();break}case 5:{I.body=O.opentelemetry.proto.common.v1.AnyValue.decode(y,y.uint32());break}case 6:{I.attributes&&I.attributes.length||(I.attributes=[]),I.attributes.push(O.opentelemetry.proto.common.v1.KeyValue.decode(y,y.uint32()));break}case 7:{I.droppedAttributesCount=y.uint32();break}case 8:{I.flags=y.fixed32();break}case 9:{I.traceId=y.bytes();break}case 10:{I.spanId=y.bytes();break}default:y.skipType(x&7);break}}return I},C.decodeDelimited=function(y){return y instanceof T||(y=new T(y)),this.decode(y,y.uint32())},C.verify=function(y){if(typeof y!="object"||y===null)return"object expected";if(y.timeUnixNano!=null&&y.hasOwnProperty("timeUnixNano")&&!P.isInteger(y.timeUnixNano)&&!(y.timeUnixNano&&P.isInteger(y.timeUnixNano.low)&&P.isInteger(y.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(y.observedTimeUnixNano!=null&&y.hasOwnProperty("observedTimeUnixNano")&&!P.isInteger(y.observedTimeUnixNano)&&!(y.observedTimeUnixNano&&P.isInteger(y.observedTimeUnixNano.low)&&P.isInteger(y.observedTimeUnixNano.high)))return"observedTimeUnixNano: integer|Long expected";if(y.severityNumber!=null&&y.hasOwnProperty("severityNumber"))switch(y.severityNumber){default:return"severityNumber: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:break}if(y.severityText!=null&&y.hasOwnProperty("severityText")&&!P.isString(y.severityText))return"severityText: string expected";if(y.body!=null&&y.hasOwnProperty("body")){var _=O.opentelemetry.proto.common.v1.AnyValue.verify(y.body);if(_)return"body."+_}if(y.attributes!=null&&y.hasOwnProperty("attributes")){if(!Array.isArray(y.attributes))return"attributes: array expected";for(var N=0;N<y.attributes.length;++N){var _=O.opentelemetry.proto.common.v1.KeyValue.verify(y.attributes[N]);if(_)return"attributes."+_}}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&!P.isInteger(y.droppedAttributesCount)?"droppedAttributesCount: integer expected":y.flags!=null&&y.hasOwnProperty("flags")&&!P.isInteger(y.flags)?"flags: integer expected":y.traceId!=null&&y.hasOwnProperty("traceId")&&!(y.traceId&&typeof y.traceId.length=="number"||P.isString(y.traceId))?"traceId: buffer expected":y.spanId!=null&&y.hasOwnProperty("spanId")&&!(y.spanId&&typeof y.spanId.length=="number"||P.isString(y.spanId))?"spanId: buffer expected":null},C.fromObject=function(y){if(y instanceof O.opentelemetry.proto.logs.v1.LogRecord)return y;var _=new O.opentelemetry.proto.logs.v1.LogRecord;switch(y.timeUnixNano!=null&&(P.Long?(_.timeUnixNano=P.Long.fromValue(y.timeUnixNano)).unsigned=!1:typeof y.timeUnixNano=="string"?_.timeUnixNano=parseInt(y.timeUnixNano,10):typeof y.timeUnixNano=="number"?_.timeUnixNano=y.timeUnixNano:typeof y.timeUnixNano=="object"&&(_.timeUnixNano=new P.LongBits(y.timeUnixNano.low>>>0,y.timeUnixNano.high>>>0).toNumber())),y.observedTimeUnixNano!=null&&(P.Long?(_.observedTimeUnixNano=P.Long.fromValue(y.observedTimeUnixNano)).unsigned=!1:typeof y.observedTimeUnixNano=="string"?_.observedTimeUnixNano=parseInt(y.observedTimeUnixNano,10):typeof y.observedTimeUnixNano=="number"?_.observedTimeUnixNano=y.observedTimeUnixNano:typeof y.observedTimeUnixNano=="object"&&(_.observedTimeUnixNano=new P.LongBits(y.observedTimeUnixNano.low>>>0,y.observedTimeUnixNano.high>>>0).toNumber())),y.severityNumber){default:if(typeof y.severityNumber=="number"){_.severityNumber=y.severityNumber;break}break;case"SEVERITY_NUMBER_UNSPECIFIED":case 0:_.severityNumber=0;break;case"SEVERITY_NUMBER_TRACE":case 1:_.severityNumber=1;break;case"SEVERITY_NUMBER_TRACE2":case 2:_.severityNumber=2;break;case"SEVERITY_NUMBER_TRACE3":case 3:_.severityNumber=3;break;case"SEVERITY_NUMBER_TRACE4":case 4:_.severityNumber=4;break;case"SEVERITY_NUMBER_DEBUG":case 5:_.severityNumber=5;break;case"SEVERITY_NUMBER_DEBUG2":case 6:_.severityNumber=6;break;case"SEVERITY_NUMBER_DEBUG3":case 7:_.severityNumber=7;break;case"SEVERITY_NUMBER_DEBUG4":case 8:_.severityNumber=8;break;case"SEVERITY_NUMBER_INFO":case 9:_.severityNumber=9;break;case"SEVERITY_NUMBER_INFO2":case 10:_.severityNumber=10;break;case"SEVERITY_NUMBER_INFO3":case 11:_.severityNumber=11;break;case"SEVERITY_NUMBER_INFO4":case 12:_.severityNumber=12;break;case"SEVERITY_NUMBER_WARN":case 13:_.severityNumber=13;break;case"SEVERITY_NUMBER_WARN2":case 14:_.severityNumber=14;break;case"SEVERITY_NUMBER_WARN3":case 15:_.severityNumber=15;break;case"SEVERITY_NUMBER_WARN4":case 16:_.severityNumber=16;break;case"SEVERITY_NUMBER_ERROR":case 17:_.severityNumber=17;break;case"SEVERITY_NUMBER_ERROR2":case 18:_.severityNumber=18;break;case"SEVERITY_NUMBER_ERROR3":case 19:_.severityNumber=19;break;case"SEVERITY_NUMBER_ERROR4":case 20:_.severityNumber=20;break;case"SEVERITY_NUMBER_FATAL":case 21:_.severityNumber=21;break;case"SEVERITY_NUMBER_FATAL2":case 22:_.severityNumber=22;break;case"SEVERITY_NUMBER_FATAL3":case 23:_.severityNumber=23;break;case"SEVERITY_NUMBER_FATAL4":case 24:_.severityNumber=24;break}if(y.severityText!=null&&(_.severityText=String(y.severityText)),y.body!=null){if(typeof y.body!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.body: object expected");_.body=O.opentelemetry.proto.common.v1.AnyValue.fromObject(y.body)}if(y.attributes){if(!Array.isArray(y.attributes))throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: array expected");_.attributes=[];for(var N=0;N<y.attributes.length;++N){if(typeof y.attributes[N]!="object")throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: object expected");_.attributes[N]=O.opentelemetry.proto.common.v1.KeyValue.fromObject(y.attributes[N])}}return y.droppedAttributesCount!=null&&(_.droppedAttributesCount=y.droppedAttributesCount>>>0),y.flags!=null&&(_.flags=y.flags>>>0),y.traceId!=null&&(typeof y.traceId=="string"?P.base64.decode(y.traceId,_.traceId=P.newBuffer(P.base64.length(y.traceId)),0):y.traceId.length>=0&&(_.traceId=y.traceId)),y.spanId!=null&&(typeof y.spanId=="string"?P.base64.decode(y.spanId,_.spanId=P.newBuffer(P.base64.length(y.spanId)),0):y.spanId.length>=0&&(_.spanId=y.spanId)),_},C.toObject=function(y,_){_||(_={});var N={};if((_.arrays||_.defaults)&&(N.attributes=[]),_.defaults){if(P.Long){var I=new P.Long(0,0,!1);N.timeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.timeUnixNano=_.longs===String?"0":0;if(N.severityNumber=_.enums===String?"SEVERITY_NUMBER_UNSPECIFIED":0,N.severityText="",N.body=null,N.droppedAttributesCount=0,N.flags=0,_.bytes===String?N.traceId="":(N.traceId=[],_.bytes!==Array&&(N.traceId=P.newBuffer(N.traceId))),_.bytes===String?N.spanId="":(N.spanId=[],_.bytes!==Array&&(N.spanId=P.newBuffer(N.spanId))),P.Long){var I=new P.Long(0,0,!1);N.observedTimeUnixNano=_.longs===String?I.toString():_.longs===Number?I.toNumber():I}else N.observedTimeUnixNano=_.longs===String?"0":0}if(y.timeUnixNano!=null&&y.hasOwnProperty("timeUnixNano")&&(typeof y.timeUnixNano=="number"?N.timeUnixNano=_.longs===String?String(y.timeUnixNano):y.timeUnixNano:N.timeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.timeUnixNano):_.longs===Number?new P.LongBits(y.timeUnixNano.low>>>0,y.timeUnixNano.high>>>0).toNumber():y.timeUnixNano),y.severityNumber!=null&&y.hasOwnProperty("severityNumber")&&(N.severityNumber=_.enums===String?O.opentelemetry.proto.logs.v1.SeverityNumber[y.severityNumber]===void 0?y.severityNumber:O.opentelemetry.proto.logs.v1.SeverityNumber[y.severityNumber]:y.severityNumber),y.severityText!=null&&y.hasOwnProperty("severityText")&&(N.severityText=y.severityText),y.body!=null&&y.hasOwnProperty("body")&&(N.body=O.opentelemetry.proto.common.v1.AnyValue.toObject(y.body,_)),y.attributes&&y.attributes.length){N.attributes=[];for(var x=0;x<y.attributes.length;++x)N.attributes[x]=O.opentelemetry.proto.common.v1.KeyValue.toObject(y.attributes[x],_)}return y.droppedAttributesCount!=null&&y.hasOwnProperty("droppedAttributesCount")&&(N.droppedAttributesCount=y.droppedAttributesCount),y.flags!=null&&y.hasOwnProperty("flags")&&(N.flags=y.flags),y.traceId!=null&&y.hasOwnProperty("traceId")&&(N.traceId=_.bytes===String?P.base64.encode(y.traceId,0,y.traceId.length):_.bytes===Array?Array.prototype.slice.call(y.traceId):y.traceId),y.spanId!=null&&y.hasOwnProperty("spanId")&&(N.spanId=_.bytes===String?P.base64.encode(y.spanId,0,y.spanId.length):_.bytes===Array?Array.prototype.slice.call(y.spanId):y.spanId),y.observedTimeUnixNano!=null&&y.hasOwnProperty("observedTimeUnixNano")&&(typeof y.observedTimeUnixNano=="number"?N.observedTimeUnixNano=_.longs===String?String(y.observedTimeUnixNano):y.observedTimeUnixNano:N.observedTimeUnixNano=_.longs===String?P.Long.prototype.toString.call(y.observedTimeUnixNano):_.longs===Number?new P.LongBits(y.observedTimeUnixNano.low>>>0,y.observedTimeUnixNano.high>>>0).toNumber():y.observedTimeUnixNano),N},C.prototype.toJSON=function(){return this.constructor.toObject(this,S.util.toJSONOptions)},C.getTypeUrl=function(y){return y===void 0&&(y="type.googleapis.com"),y+"/opentelemetry.proto.logs.v1.LogRecord"},C})(),U})(),D})(),M})(),R})(),root=O,root}var rootExports=requireRoot();function hrTimeToNanos(S){var T=BigInt(1e9);return BigInt(S[0])*T+BigInt(S[1])}function toLongBits(S){var T=Number(BigInt.asUintN(32,S)),A=Number(BigInt.asUintN(32,S>>BigInt(32)));return{low:T,high:A}}function encodeAsLongBits(S){var T=hrTimeToNanos(S);return toLongBits(T)}function optionalHexToBinary(S){if(S!==void 0)return hexToBinary(S)}var DEFAULT_ENCODER={encodeHrTime:encodeAsLongBits,encodeSpanContext:hexToBinary,encodeOptionalSpanContext:optionalHexToBinary};function getOtlpEncoder(S){return DEFAULT_ENCODER}var __read$4=function(S,T){var A=typeof Symbol=="function"&&S[Symbol.iterator];if(!A)return S;var P=A.call(S),O,R=[],M;try{for(;(T===void 0||T-- >0)&&!(O=P.next()).done;)R.push(O.value)}catch(D){M={error:D}}finally{try{O&&!O.done&&(A=P.return)&&A.call(P)}finally{if(M)throw M.error}}return R};function createResource(S){return{attributes:toAttributes(S.attributes),droppedAttributesCount:0}}function createInstrumentationScope(S){return{name:S.name,version:S.version}}function toAttributes(S){return Object.keys(S).map(function(T){return toKeyValue(T,S[T])})}function toKeyValue(S,T){return{key:S,value:toAnyValue(T)}}function toAnyValue(S){var T=typeof S;return T==="string"?{stringValue:S}:T==="number"?Number.isInteger(S)?{intValue:S}:{doubleValue:S}:T==="boolean"?{boolValue:S}:S instanceof Uint8Array?{bytesValue:S}:Array.isArray(S)?{arrayValue:{values:S.map(toAnyValue)}}:T==="object"&&S!=null?{kvlistValue:{values:Object.entries(S).map(function(A){var P=__read$4(A,2),O=P[0],R=P[1];return toKeyValue(O,R)})}}:{}}var __values=function(S){var T=typeof Symbol=="function"&&Symbol.iterator,A=T&&S[T],P=0;if(A)return A.call(S);if(S&&typeof S.length=="number")return{next:function(){return S&&P>=S.length&&(S=void 0),{value:S&&S[P++],done:!S}}};throw new TypeError(T?"Object is not iterable.":"Symbol.iterator is not defined.")},__read$3=function(S,T){var A=typeof Symbol=="function"&&S[Symbol.iterator];if(!A)return S;var P=A.call(S),O,R=[],M;try{for(;(T===void 0||T-- >0)&&!(O=P.next()).done;)R.push(O.value)}catch(D){M={error:D}}finally{try{O&&!O.done&&(A=P.return)&&A.call(P)}finally{if(M)throw M.error}}return R};function sdkSpanToOtlpSpan(S,T){var A,P=S.spanContext(),O=S.status;return{traceId:T.encodeSpanContext(P.traceId),spanId:T.encodeSpanContext(P.spanId),parentSpanId:T.encodeOptionalSpanContext(S.parentSpanId),traceState:(A=P.traceState)===null||A===void 0?void 0:A.serialize(),name:S.name,kind:S.kind==null?0:S.kind+1,startTimeUnixNano:T.encodeHrTime(S.startTime),endTimeUnixNano:T.encodeHrTime(S.endTime),attributes:toAttributes(S.attributes),droppedAttributesCount:S.droppedAttributesCount,events:S.events.map(function(R){return toOtlpSpanEvent(R,T)}),droppedEventsCount:S.droppedEventsCount,status:{code:O.code,message:O.message},links:S.links.map(function(R){return toOtlpLink(R,T)}),droppedLinksCount:S.droppedLinksCount}}function toOtlpLink(S,T){var A;return{attributes:S.attributes?toAttributes(S.attributes):[],spanId:T.encodeSpanContext(S.context.spanId),traceId:T.encodeSpanContext(S.context.traceId),traceState:(A=S.context.traceState)===null||A===void 0?void 0:A.serialize(),droppedAttributesCount:S.droppedAttributesCount||0}}function toOtlpSpanEvent(S,T){return{attributes:S.attributes?toAttributes(S.attributes):[],name:S.name,timeUnixNano:T.encodeHrTime(S.time),droppedAttributesCount:S.droppedAttributesCount||0}}function createExportTraceServiceRequest(S,T){var A=getOtlpEncoder();return{resourceSpans:spanRecordsToResourceSpans(S,A)}}function createResourceMap(S){var T,A,P=new Map;try{for(var O=__values(S),R=O.next();!R.done;R=O.next()){var M=R.value,D=P.get(M.resource);D||(D=new Map,P.set(M.resource,D));var U=M.instrumentationLibrary.name+"@"+(M.instrumentationLibrary.version||"")+":"+(M.instrumentationLibrary.schemaUrl||""),C=D.get(U);C||(C=[],D.set(U,C)),C.push(M)}}catch(L){T={error:L}}finally{try{R&&!R.done&&(A=O.return)&&A.call(O)}finally{if(T)throw T.error}}return P}function spanRecordsToResourceSpans(S,T){for(var A=createResourceMap(S),P=[],O=A.entries(),R=O.next();!R.done;){for(var M=__read$3(R.value,2),D=M[0],U=M[1],C=[],L=U.values(),y=L.next();!y.done;){var _=y.value;if(_.length>0){var N=_.map(function(x){return sdkSpanToOtlpSpan(x,T)});C.push({scope:createInstrumentationScope(_[0].instrumentationLibrary),spans:N,schemaUrl:_[0].instrumentationLibrary.schemaUrl})}y=L.next()}var I={resource:createResource(D),scopeSpans:C,schemaUrl:void 0};P.push(I),R=O.next()}return P}var traceResponseType=rootExports.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,traceRequestType=rootExports.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,ProtobufTraceSerializer={serializeRequest:function(S){var T=createExportTraceServiceRequest(S);return traceRequestType.encode(T).finish()},deserializeResponse:function(S){return traceResponseType.decode(S)}},__awaiter=function(S,T,A,P){function O(R){return R instanceof A?R:new A(function(M){M(R)})}return new(A||(A=Promise))(function(R,M){function D(L){try{C(P.next(L))}catch(y){M(y)}}function U(L){try{C(P.throw(L))}catch(y){M(y)}}function C(L){L.done?R(L.value):O(L.value).then(D,U)}C((P=P.apply(S,T||[])).next())})},__generator=function(S,T){var A={label:0,sent:function(){if(R[0]&1)throw R[1];return R[1]},trys:[],ops:[]},P,O,R,M;return M={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(M[Symbol.iterator]=function(){return this}),M;function D(C){return function(L){return U([C,L])}}function U(C){if(P)throw new TypeError("Generator is already executing.");for(;A;)try{if(P=1,O&&(R=C[0]&2?O.return:C[0]?O.throw||((R=O.return)&&R.call(O),0):O.next)&&!(R=R.call(O,C[1])).done)return R;switch(O=0,R&&(C=[C[0]&2,R.value]),C[0]){case 0:case 1:R=C;break;case 4:return A.label++,{value:C[1],done:!1};case 5:A.label++,O=C[1],C=[0];continue;case 7:C=A.ops.pop(),A.trys.pop();continue;default:if(R=A.trys,!(R=R.length>0&&R[R.length-1])&&(C[0]===6||C[0]===2)){A=0;continue}if(C[0]===3&&(!R||C[1]>R[0]&&C[1]<R[3])){A.label=C[1];break}if(C[0]===6&&A.label<R[1]){A.label=R[1],R=C;break}if(R&&A.label<R[2]){A.label=R[2],A.ops.push(C);break}R[2]&&A.ops.pop(),A.trys.pop();continue}C=T.call(S,A)}catch(L){C=[6,L],O=0}finally{P=R=0}if(C[0]&5)throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}},MAX_ATTEMPTS=5,INITIAL_BACKOFF=1e3,MAX_BACKOFF=5e3,BACKOFF_MULTIPLIER=1.5,JITTER=.2;function getJitter(){return Math.random()*(2*JITTER)-JITTER}var RetryingTransport=(function(){function S(T){this._transport=T}return S.prototype.retry=function(T,A,P){var O=this;return new Promise(function(R,M){setTimeout(function(){O._transport.send(T,A).then(R,M)},P)})},S.prototype.send=function(T,A){var P;return __awaiter(this,void 0,void 0,function(){var O,R,M,D,U,C,L;return __generator(this,function(y){switch(y.label){case 0:return O=Date.now()+A,[4,this._transport.send(T,A)];case 1:R=y.sent(),M=MAX_ATTEMPTS,D=INITIAL_BACKOFF,y.label=2;case 2:return R.status==="retryable"&&M>0?(M--,U=Math.max(Math.min(D,MAX_BACKOFF)+getJitter(),0),D=D*BACKOFF_MULTIPLIER,C=(P=R.retryInMillis)!==null&&P!==void 0?P:U,L=O-Date.now(),C>L?[2,R]:[4,this.retry(T,L,C)]):[3,4];case 3:return R=y.sent(),[3,2];case 4:return[2,R]}})})},S.prototype.shutdown=function(){return this._transport.shutdown()},S})();function createRetryingTransport(S){return new RetryingTransport(S.transport)}function isExportRetryable(S){var T=[429,502,503,504];return T.includes(S)}function parseRetryAfterToMills(S){if(S!=null){var T=Number.parseInt(S,10);if(Number.isInteger(T))return T>0?T*1e3:-1;var A=new Date(S).getTime()-Date.now();return A>=0?A:0}}var __read$2=function(S,T){var A=typeof Symbol=="function"&&S[Symbol.iterator];if(!A)return S;var P=A.call(S),O,R=[],M;try{for(;(T===void 0||T-- >0)&&!(O=P.next()).done;)R.push(O.value)}catch(D){M={error:D}}finally{try{O&&!O.done&&(A=P.return)&&A.call(P)}finally{if(M)throw M.error}}return R},XhrTransport=(function(){function S(T){this._parameters=T}return S.prototype.send=function(T,A){var P=this;return new Promise(function(O){var R=new XMLHttpRequest;R.timeout=A,R.open("POST",P._parameters.url);var M=P._parameters.headers();Object.entries(M).forEach(function(D){var U=__read$2(D,2),C=U[0],L=U[1];R.setRequestHeader(C,L)}),R.ontimeout=function(D){O({status:"failure",error:new Error("XHR request timed out")})},R.onreadystatechange=function(){R.status>=200&&R.status<=299?(diag.debug("XHR success"),O({status:"success"})):R.status&&isExportRetryable(R.status)?O({status:"retryable",retryInMillis:parseRetryAfterToMills(R.getResponseHeader("Retry-After"))}):R.status!==0&&O({status:"failure",error:new Error("XHR request failed with non-retryable status")})},R.onabort=function(){O({status:"failure",error:new Error("XHR request aborted")})},R.onerror=function(){O({status:"failure",error:new Error("XHR request errored")})},R.send(T)})},S.prototype.shutdown=function(){},S})();function createXhrTransport(S){return new XhrTransport(S)}var SendBeaconTransport=(function(){function S(T){this._params=T}return S.prototype.send=function(T){var A=this;return new Promise(function(P){navigator.sendBeacon(A._params.url,new Blob([T],{type:A._params.blobType}))?(diag.debug("SendBeacon success"),P({status:"success"})):P({status:"failure",error:new Error("SendBeacon failed")})})},S.prototype.shutdown=function(){},S})();function createSendBeaconTransport(S){return new SendBeaconTransport(S)}function createOtlpXhrExportDelegate(S,T){return createOtlpNetworkExportDelegate(S,T,createRetryingTransport({transport:createXhrTransport(S)}))}function createOtlpSendBeaconExportDelegate(S,T){return createOtlpNetworkExportDelegate(S,T,createRetryingTransport({transport:createSendBeaconTransport({url:S.url,blobType:S.headers()["Content-Type"]})}))}var __read$1=function(S,T){var A=typeof Symbol=="function"&&S[Symbol.iterator];if(!A)return S;var P=A.call(S),O,R=[],M;try{for(;(T===void 0||T-- >0)&&!(O=P.next()).done;)R.push(O.value)}catch(D){M={error:D}}finally{try{O&&!O.done&&(A=P.return)&&A.call(P)}finally{if(M)throw M.error}}return R};function validateAndNormalizeHeaders(S){return function(){var T,A={};return Object.entries((T=S?.())!==null&&T!==void 0?T:{}).forEach(function(P){var O=__read$1(P,2),R=O[0],M=O[1];typeof M<"u"?A[R]=String(M):diag.warn('Header "'+R+'" has invalid value ('+M+") and will be ignored")}),A}}var __assign=function(){return __assign=Object.assign||function(S){for(var T,A=1,P=arguments.length;A<P;A++){T=arguments[A];for(var O in T)Object.prototype.hasOwnProperty.call(T,O)&&(S[O]=T[O])}return S},__assign.apply(this,arguments)};function mergeHeaders(S,T,A){var P=__assign({},A()),O={};return function(){return T!=null&&Object.assign(O,T()),S!=null&&Object.assign(O,S()),Object.assign(O,P)}}function validateUserProvidedUrl(S){if(S!=null)try{return new URL(S),S}catch{throw new Error("Configuration: Could not parse user-provided export URL: '"+S+"'")}}function mergeOtlpHttpConfigurationWithDefaults(S,T,A){var P,O,R,M;return __assign(__assign({},mergeOtlpSharedConfigurationWithDefaults(S,T,A)),{headers:mergeHeaders(validateAndNormalizeHeaders(S.headers),T.headers,A.headers),url:(O=(P=validateUserProvidedUrl(S.url))!==null&&P!==void 0?P:T.url)!==null&&O!==void 0?O:A.url,agentOptions:(M=(R=S.agentOptions)!==null&&R!==void 0?R:T.agentOptions)!==null&&M!==void 0?M:A.agentOptions})}function getHttpConfigurationDefaults(S,T){return __assign(__assign({},getSharedConfigurationDefaults()),{headers:function(){return S},url:"http://localhost:4318/"+T,agentOptions:{keepAlive:!0}})}function convertLegacyBrowserHttpOptions(S,T,A){return mergeOtlpHttpConfigurationWithDefaults({url:S.url,timeoutMillis:S.timeoutMillis,headers:wrapStaticHeadersInFunction(S.headers),concurrencyLimit:S.concurrencyLimit},{},getHttpConfigurationDefaults(A,T))}function createLegacyOtlpBrowserExportDelegate(S,T,A,P){var O=!!S.headers||typeof navigator.sendBeacon!="function",R=convertLegacyBrowserHttpOptions(S,A,P);return O?createOtlpXhrExportDelegate(R,T):createOtlpSendBeaconExportDelegate(R,T)}var __extends=(function(){var S=function(T,A){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,O){P.__proto__=O}||function(P,O){for(var R in O)Object.prototype.hasOwnProperty.call(O,R)&&(P[R]=O[R])},S(T,A)};return function(T,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");S(T,A);function P(){this.constructor=T}T.prototype=A===null?Object.create(A):(P.prototype=A.prototype,new P)}})(),DEFAULT_COLLECTOR_RESOURCE_PATH="v1/traces",OTLPTraceExporter=(function(S){__extends(T,S);function T(A){return A===void 0&&(A={}),S.call(this,createLegacyOtlpBrowserExportDelegate(A,ProtobufTraceSerializer,DEFAULT_COLLECTOR_RESOURCE_PATH,{"Content-Type":"application/x-protobuf"}))||this}return T})(OTLPExporterBase);const index$1=Object.freeze(Object.defineProperty({__proto__:null,OTLPTraceExporter},Symbol.toStringTag,{value:"Module"}));var B3_DEBUG_FLAG_KEY=createContextKey("OpenTelemetry Context Key B3 Debug Flag"),B3_CONTEXT_HEADER="b3",X_B3_TRACE_ID="x-b3-traceid",X_B3_SPAN_ID="x-b3-spanid",X_B3_SAMPLED="x-b3-sampled",X_B3_PARENT_SPAN_ID="x-b3-parentspanid",X_B3_FLAGS="x-b3-flags",VALID_SAMPLED_VALUES=new Set([!0,"true","True","1",1]),VALID_UNSAMPLED_VALUES=new Set([!1,"false","False","0",0]);function isValidSampledValue(S){return S===TraceFlags.SAMPLED||S===TraceFlags.NONE}function parseHeader(S){return Array.isArray(S)?S[0]:S}function getHeaderValue(S,T,A){var P=T.get(S,A);return parseHeader(P)}function getTraceId(S,T){var A=getHeaderValue(S,T,X_B3_TRACE_ID);return typeof A=="string"?A.padStart(32,"0"):""}function getSpanId(S,T){var A=getHeaderValue(S,T,X_B3_SPAN_ID);return typeof A=="string"?A:""}function getDebug(S,T){var A=getHeaderValue(S,T,X_B3_FLAGS);return A==="1"?"1":void 0}function getTraceFlags(S,T){var A=getHeaderValue(S,T,X_B3_SAMPLED),P=getDebug(S,T);if(P==="1"||VALID_SAMPLED_VALUES.has(A))return TraceFlags.SAMPLED;if(A===void 0||VALID_UNSAMPLED_VALUES.has(A))return TraceFlags.NONE}var B3MultiPropagator=(function(){function S(){}return S.prototype.inject=function(T,A,P){var O=trace.getSpanContext(T);if(!(!O||!isSpanContextValid(O)||isTracingSuppressed(T))){var R=T.getValue(B3_DEBUG_FLAG_KEY);P.set(A,X_B3_TRACE_ID,O.traceId),P.set(A,X_B3_SPAN_ID,O.spanId),R==="1"?P.set(A,X_B3_FLAGS,R):O.traceFlags!==void 0&&P.set(A,X_B3_SAMPLED,(TraceFlags.SAMPLED&O.traceFlags)===TraceFlags.SAMPLED?"1":"0")}},S.prototype.extract=function(T,A,P){var O=getTraceId(A,P),R=getSpanId(A,P),M=getTraceFlags(A,P),D=getDebug(A,P);return isValidTraceId(O)&&isValidSpanId(R)&&isValidSampledValue(M)?(T=T.setValue(B3_DEBUG_FLAG_KEY,D),trace.setSpanContext(T,{traceId:O,spanId:R,isRemote:!0,traceFlags:M})):T},S.prototype.fields=function(){return[X_B3_TRACE_ID,X_B3_SPAN_ID,X_B3_FLAGS,X_B3_SAMPLED,X_B3_PARENT_SPAN_ID]},S})(),__read=function(S,T){var A=typeof Symbol=="function"&&S[Symbol.iterator];if(!A)return S;var P=A.call(S),O,R=[],M;try{for(;(T===void 0||T-- >0)&&!(O=P.next()).done;)R.push(O.value)}catch(D){M={error:D}}finally{try{O&&!O.done&&(A=P.return)&&A.call(P)}finally{if(M)throw M.error}}return R},B3_CONTEXT_REGEX=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,PADDING="0".repeat(16),SAMPLED_VALUES=new Set(["d","1"]),DEBUG_STATE="d";function convertToTraceId128(S){return S.length===32?S:""+PADDING+S}function convertToTraceFlags(S){return S&&SAMPLED_VALUES.has(S)?TraceFlags.SAMPLED:TraceFlags.NONE}var B3SinglePropagator=(function(){function S(){}return S.prototype.inject=function(T,A,P){var O=trace.getSpanContext(T);if(!(!O||!isSpanContextValid(O)||isTracingSuppressed(T))){var R=T.getValue(B3_DEBUG_FLAG_KEY)||O.traceFlags&1,M=O.traceId+"-"+O.spanId+"-"+R;P.set(A,B3_CONTEXT_HEADER,M)}},S.prototype.extract=function(T,A,P){var O=P.get(A,B3_CONTEXT_HEADER),R=Array.isArray(O)?O[0]:O;if(typeof R!="string")return T;var M=R.match(B3_CONTEXT_REGEX);if(!M)return T;var D=__read(M,4),U=D[1],C=D[2],L=D[3],y=convertToTraceId128(U);if(!isValidTraceId(y)||!isValidSpanId(C))return T;var _=convertToTraceFlags(L);return L===DEBUG_STATE&&(T=T.setValue(B3_DEBUG_FLAG_KEY,L)),trace.setSpanContext(T,{traceId:y,spanId:C,isRemote:!0,traceFlags:_})},S.prototype.fields=function(){return[B3_CONTEXT_HEADER]},S})(),B3InjectEncoding;(function(S){S[S.SINGLE_HEADER=0]="SINGLE_HEADER",S[S.MULTI_HEADER=1]="MULTI_HEADER"})(B3InjectEncoding||(B3InjectEncoding={}));var B3Propagator=(function(){function S(T){T===void 0&&(T={}),this._b3MultiPropagator=new B3MultiPropagator,this._b3SinglePropagator=new B3SinglePropagator,T.injectEncoding===B3InjectEncoding.MULTI_HEADER?(this._inject=this._b3MultiPropagator.inject,this._fields=this._b3MultiPropagator.fields()):(this._inject=this._b3SinglePropagator.inject,this._fields=this._b3SinglePropagator.fields())}return S.prototype.inject=function(T,A,P){isTracingSuppressed(T)||this._inject(T,A,P)},S.prototype.extract=function(T,A,P){var O=P.get(A,B3_CONTEXT_HEADER),R=Array.isArray(O)?O[0]:O;return R?this._b3SinglePropagator.extract(T,A,P):this._b3MultiPropagator.extract(T,A,P)},S.prototype.fields=function(){return this._fields},S})();const index=Object.freeze(Object.defineProperty({__proto__:null,get B3InjectEncoding(){return B3InjectEncoding},B3Propagator,B3_CONTEXT_HEADER,X_B3_FLAGS,X_B3_PARENT_SPAN_ID,X_B3_SAMPLED,X_B3_SPAN_ID,X_B3_TRACE_ID},Symbol.toStringTag,{value:"Module"}));exports.ElementTypeEnum=ElementTypeEnum,exports.FieldName=FieldName,exports.OpenPayForm=OpenPayForm,exports.SubmitMethods=SubmitMethods,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));