@stacksjs/orm 0.72.57 → 0.72.61

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.js CHANGED
@@ -1,35 +1,35 @@
1
1
  // @bun
2
- var n7=Object.defineProperty;var p7=(Z)=>Z;function i7(Z,$){this[Z]=p7.bind(null,$)}var j8=(Z,$)=>{for(var X in $)n7(Z,X,{get:$[X],enumerable:!0,configurable:!0,set:i7.bind($,X)})};var _=(Z,$)=>()=>(Z&&($=Z(Z=0)),$);var D=import.meta.require;var Y9;var Q9=_(()=>{Y9={api:"api.stripe.com",files:"files.stripe.com",connect:"connect.stripe.com",meter_events:"meter-events.stripe.com"}});function p(Z){return h2(Z)}function Q5(Z){return encodeURIComponent(Z).replace(/!/g,"%21").replace(/\*/g,"%2A").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/'/g,"%27").replace(/%5B/g,"[").replace(/%5D/g,"]")}function y2(Z){if(Z instanceof Date)return Math.floor(Z.getTime()/1000).toString();if(Z===null)return"";return String(Z)}function h2(Z){let $=[];function X(J,Y){if(Y===void 0)return;if(Y===null||typeof Y!=="object"||Y instanceof Date){$.push(Q5(J)+"="+Q5(y2(Y)));return}if(Array.isArray(Y)){for(let Q=0;Q<Y.length;Q++)if(Y[Q]!==void 0)X(J+"["+Q+"]",Y[Q]);return}for(let Q of Object.keys(Y))X(J+"["+Q+"]",Y[Q])}if(typeof Z==="object"&&Z!==null)for(let J of Object.keys(Z))X(J,Z[J]);return $.join("&")}function v2(Z){return["number","string","boolean"].includes(typeof Z)}function z8(Z){let $={authenticator:null,headers:{},settings:{},streaming:!1,apiBase:null};if(!Z)return $;if(Z.apiKey)$.authenticator=G9(Z.apiKey);if(Z.idempotencyKey)$.headers["Idempotency-Key"]=Z.idempotencyKey;if(Z.stripeAccount)$.headers["Stripe-Account"]=Z.stripeAccount;if(Z.stripeContext){if($.headers["Stripe-Account"])throw Error("Can't specify both stripeAccount and stripeContext.");$.headers["Stripe-Context"]=Z.stripeContext}if(Z.apiVersion)$.headers["Stripe-Version"]=Z.apiVersion;if(Number.isInteger(Z.maxNetworkRetries))$.settings.maxNetworkRetries=Z.maxNetworkRetries;if(Number.isInteger(Z.timeout))$.settings.timeout=Z.timeout;if(Z.authenticator){if(Z.apiKey)throw Error("Can't specify both apiKey and authenticator.");if(typeof Z.authenticator!=="function")throw Error("The authenticator must be a function receiving a request as the first parameter.");$.authenticator=Z.authenticator}if(Z.headers)Object.assign($.headers,Z.headers);if(Z.streaming)$.streaming=!0;return $}function O8(Z){if(typeof Z!=="object")throw Error("Argument must be an object");return Object.keys(Z).reduce(($,X)=>{if(Z[X]!=null)$[X]=Z[X];return $},{})}function W5(Z){if(!(Z&&typeof Z==="object"))return Z;return Object.keys(Z).reduce(($,X)=>{return $[R2(X)]=Z[X],$},{})}function R2(Z){return Z.split("-").map(($)=>$.charAt(0).toUpperCase()+$.substr(1).toLowerCase()).join("-")}function B5(Z){if(Z==="OAuth")return"oauth";else return Z[0].toLowerCase()+Z.substring(1)}function b2(Z){let $=typeof Z;return($==="function"||$==="object")&&!!Z}function V5(Z){let $={},X=(J,Y)=>{Object.entries(J).forEach(([Q,G])=>{let W=Y?`${Y}[${Q}]`:Q;if(b2(G))if(!(G instanceof Uint8Array)&&!Object.prototype.hasOwnProperty.call(G,"data"))return X(G,W);else $[W]=G;else $[W]=String(G)})};return X(Z,null),$}function _8(Z,$,X){if(!Number.isInteger($))if(X!==void 0)return X;else throw Error(`${Z} must be an integer`);return $}function K5(Z){for(let[$,X]of g2)if(Z[$])return X;return""}function G9(Z){let $=(X)=>{return X.headers.Authorization="Bearer "+Z,Promise.resolve()};return $._apiKey=Z,$}function u2(Z,$){if(this[Z]instanceof Date)return Math.floor(this[Z].getTime()/1000).toString();return $}function H5(Z){return JSON.stringify(Z,u2)}function F8(Z){if(!Z)return"v1";return Z.startsWith("/v2")?"v2":"v1"}function w8(Z){if(Array.isArray(Z))return Z.join(", ");return String(Z)}function z5(Z){return Object.entries(Z).map(([$,X])=>{return[$,w8(X)]})}function x0(Z,$){if(!Z||!Z.stack||!$)return;let X=$.substring($.indexOf(`
3
- `)+1),J=Z.stack.indexOf(G5),Y=J>=0?Z.stack.substring(0,J):Z.stack;Z.stack=`${Y}${G5}
4
- ${X}`}var w0,g2,G5=`
5
- Originating from:`;var i=_(()=>{Q9();w0=(()=>{let Z={"\n":"\\n",'"':"\\\"","\u2028":"\\u2028","\u2029":"\\u2029"};return($)=>{let X=$.replace(/["\n\r\u2028\u2029]/g,(J)=>Z[J]);return(J)=>{return X.replace(/\{([\s\S]+?)\}/g,(Y,Q)=>{let G=J[Q];if(v2(G))return encodeURIComponent(G);return""})}}})();g2=[["ANTIGRAVITY_CLI_ALIAS","antigravity"],["CLAUDECODE","claude_code"],["CLINE_ACTIVE","cline"],["CODEX_SANDBOX","codex_cli"],["CODEX_THREAD_ID","codex_cli"],["CODEX_SANDBOX_NETWORK_DISABLED","codex_cli"],["CODEX_CI","codex_cli"],["CURSOR_AGENT","cursor"],["GEMINI_CLI","gemini_cli"],["OPENCLAW_SHELL","openclaw"],["OPENCODE","open_code"]]});class S{getClientName(){throw Error("getClientName not implemented.")}makeRequest(Z,$,X,J,Y,Q,G,W){throw Error("makeRequest not implemented.")}static makeTimeoutError(){let Z=TypeError(S.TIMEOUT_ERROR_CODE);return Z.code=S.TIMEOUT_ERROR_CODE,Z}}class T0{constructor(Z,$){this._statusCode=Z,this._headers=$}getStatusCode(){return this._statusCode}getHeaders(){return this._headers}getRawResponse(){throw Error("getRawResponse not implemented.")}toStream(Z){throw Error("toStream not implemented.")}toJSON(){throw Error("toJSON not implemented.")}}var x8=_(()=>{S.CONNECTION_CLOSED_ERROR_CODES=["ECONNRESET","EPIPE"];S.TIMEOUT_ERROR_CODE="ETIMEDOUT"});var U0,W9;var O5=_(()=>{i();x8();U0=class U0 extends S{constructor(Z){super();if(!Z){if(!globalThis.fetch)throw Error("fetch() function not provided and is not defined in the global scope. You must provide a fetch implementation.");Z=globalThis.fetch}if(globalThis.AbortController)this._fetchFn=U0.makeFetchWithAbortTimeout(Z);else this._fetchFn=U0.makeFetchWithRaceTimeout(Z)}static makeFetchWithRaceTimeout(Z){return($,X,J)=>{let Y,Q=new Promise((W,V)=>{Y=setTimeout(()=>{Y=null,V(S.makeTimeoutError())},J)}),G=Z($,X);return Promise.race([G,Q]).finally(()=>{if(Y)clearTimeout(Y)})}}static makeFetchWithAbortTimeout(Z){return async($,X,J)=>{let Y=new AbortController,Q=setTimeout(()=>{Q=null,Y.abort(S.makeTimeoutError())},J);try{return await Z($,{...X,signal:Y.signal})}catch(G){if(G.name==="AbortError")throw S.makeTimeoutError();else throw G}finally{if(Q)clearTimeout(Q)}}}getClientName(){return"fetch"}async makeRequest(Z,$,X,J,Y,Q,G,W){let V=G==="http";if(!X.startsWith("/"))throw Error(`Only relative paths are supported, got: "${X}"`);let B=new URL(`${V?"http":"https"}://${Z}${X}`);B.port=$;let H=J=="POST"||J=="PUT"||J=="PATCH",z=Q||(H?"":void 0),O=await this._fetchFn(B.toString(),{method:J,headers:z5(Y),body:z},W);return new W9(O)}};W9=class W9 extends T0{constructor(Z){super(Z.status,W9._transformHeadersToObject(Z.headers));this._res=Z}getRawResponse(){return this._res}toStream(Z){return Z(),this._res.body}toJSON(){return this._res.text().then((Z)=>{try{return JSON.parse(Z)}catch($){if($ instanceof Error)$.rawBody=Z;throw $}})}static _transformHeadersToObject(Z){let $={};for(let X of Z){if(!Array.isArray(X)||X.length!=2)throw Error("Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.");$[X[0]]=X[1]}return $}}});class q0{computeHMACSignature(Z,$){throw Error("computeHMACSignature not implemented.")}computeHMACSignatureAsync(Z,$){throw Error("computeHMACSignatureAsync not implemented.")}computeSHA256Async(Z){throw Error("computeSHA256 not implemented.")}}var L0;var T8=_(()=>{L0=class L0 extends Error{}});var V9,B9;var _5=_(()=>{T8();V9=class V9 extends q0{constructor(Z){super();this.subtleCrypto=Z||crypto.subtle}computeHMACSignature(Z,$){throw new L0("SubtleCryptoProvider cannot be used in a synchronous context.")}async computeHMACSignatureAsync(Z,$){let X=new TextEncoder,J=await this.subtleCrypto.importKey("raw",X.encode($),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),Y=await this.subtleCrypto.sign("hmac",J,X.encode(Z)),Q=new Uint8Array(Y),G=Array(Q.length);for(let W=0;W<Q.length;W++)G[W]=B9[Q[W]];return G.join("")}async computeSHA256Async(Z){return new Uint8Array(await this.subtleCrypto.digest("SHA-256",Z))}};B9=Array(256);for(let Z=0;Z<B9.length;Z++)B9[Z]=Z.toString(16).padStart(2,"0")});class K9{constructor(){this._fetchFn=null,this._agent=null}getPlatformInfo(){return null}getTelemetryId(){return null}emitWarning(Z){console.warn(`Stripe: ${Z}`)}getEnv(){return null}getRuntimeVersion(){return null}uuid4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(Z)=>{let $=Math.random()*16|0;return(Z==="x"?$:$&3|8).toString(16)})}secureCompare(Z,$){if(Z.length!==$.length)return!1;let X=Z.length,J=0;for(let Y=0;Y<X;++Y)J|=Z.charCodeAt(Y)^$.charCodeAt(Y);return J===0}createEmitter(){throw Error("createEmitter not implemented.")}tryBufferData(Z){throw Error("tryBufferData not implemented.")}createNodeHttpClient(Z){throw Error("createNodeHttpClient not implemented.")}createFetchHttpClient(Z){return new U0(Z)}createDefaultHttpClient(){throw Error("createDefaultHttpClient not implemented.")}createNodeCryptoProvider(){throw Error("createNodeCryptoProvider not implemented.")}createSubtleCryptoProvider(Z){return new V9(Z)}createDefaultCryptoProvider(){throw Error("createDefaultCryptoProvider not implemented.")}}var F5=_(()=>{O5();_5()});class H9{constructor(){this.eventTarget=new EventTarget,this.listenerMapping=new Map}on(Z,$){let X=(J)=>{$(J.data)};return this.listenerMapping.set($,X),this.eventTarget.addEventListener(Z,X)}removeListener(Z,$){let X=this.listenerMapping.get($);return this.listenerMapping.delete($),this.eventTarget.removeEventListener(Z,X)}once(Z,$){let X=(J)=>{$(J.data)};return this.listenerMapping.set($,X),this.eventTarget.addEventListener(Z,X,{once:!0})}emit(Z,$){return this.eventTarget.dispatchEvent(new w5(Z,$))}}var w5;var x5=_(()=>{w5=class w5 extends Event{constructor(Z,$){super(Z);this.data=$}}});var z9;var T5=_(()=>{F5();x5();z9=class z9 extends K9{createEmitter(){return new H9}tryBufferData(Z){if(Z.file.data instanceof ReadableStream)throw Error("Uploading a file as a stream is not supported in non-Node environments. Please open or upvote an issue at github.com/stripe/stripe-node if you use this, detailing your use-case.");return Promise.resolve(Z)}createNodeHttpClient(){throw Error("Stripe: `createNodeHttpClient()` is not available in non-Node environments. Please use `createFetchHttpClient()` instead.")}createDefaultHttpClient(){return super.createFetchHttpClient()}createNodeCryptoProvider(){throw Error("Stripe: `createNodeCryptoProvider()` is not available in non-Node environments. Please use `createSubtleCryptoProvider()` instead.")}createDefaultCryptoProvider(){return this.createSubtleCryptoProvider()}}});class N{constructor(Z,$){let[X,J]=N.normalize(Z,$);this._coefficient=X,this._exponent=J,Object.freeze(this)}static normalize(Z,$){if(Z===0n)return[0n,0];let X=Z,J=$;while(X!==0n&&X%10n===0n)X/=10n,J+=1;return[X,J]}static roundDivision(Z,$,X,J){if($===0n)return Z;if(J==="round-down")return Z;let Y=$>0n===X>0n?1n:-1n;if(J==="round-up")return Z+Y;if(J==="ceil")return Y===1n?Z+1n:Z;if(J==="floor")return Y===-1n?Z-1n:Z;let Q=$<0n?-$:$,G=X<0n?-X:X,W=Q*2n,V;if(W===G)V=0;else if(W<G)V=-1;else V=1;if(V<0)return Z;if(V>0)return Z+Y;if(J==="half-up")return Z+Y;if(J==="half-down")return Z;if(Z%2n===0n)return Z;else return Z+Y}add(Z){let $=Z;if(this._exponent===$._exponent)return new N(this._coefficient+$._coefficient,this._exponent);if(this._exponent<$._exponent){let X=10n**BigInt($._exponent-this._exponent);return new N(this._coefficient+$._coefficient*X,this._exponent)}else{let X=10n**BigInt(this._exponent-$._exponent);return new N(this._coefficient*X+$._coefficient,$._exponent)}}sub(Z){let $=Z;if(this._exponent===$._exponent)return new N(this._coefficient-$._coefficient,this._exponent);if(this._exponent<$._exponent){let X=10n**BigInt($._exponent-this._exponent);return new N(this._coefficient-$._coefficient*X,this._exponent)}else{let X=10n**BigInt(this._exponent-$._exponent);return new N(this._coefficient*X-$._coefficient,$._exponent)}}mul(Z){let $=Z;return new N(this._coefficient*$._coefficient,this._exponent+$._exponent)}div(Z,$,X){if($<0||!Number.isInteger($))throw Error("precision must be a non-negative integer");let J=Z;if(J._coefficient===0n)throw Error("Division by zero");let Y=this._exponent-J._exponent+$,Q,G,W;if(Y>=0){let B=this._coefficient*10n**BigInt(Y);Q=B/J._coefficient,G=B%J._coefficient,W=J._coefficient}else{let B=J._coefficient*10n**BigInt(-Y);Q=this._coefficient/B,G=this._coefficient%B,W=B}let V=N.roundDivision(Q,G,W,X);return new N(V,-$)}cmp(Z){let $=Z;if(this._exponent===$._exponent){if(this._coefficient<$._coefficient)return-1;if(this._coefficient>$._coefficient)return 1;return 0}if(this._exponent<$._exponent){let X=10n**BigInt($._exponent-this._exponent),J=$._coefficient*X;if(this._coefficient<J)return-1;if(this._coefficient>J)return 1;return 0}else{let X=10n**BigInt(this._exponent-$._exponent),J=this._coefficient*X;if(J<$._coefficient)return-1;if(J>$._coefficient)return 1;return 0}}eq(Z){return this.cmp(Z)===0}lt(Z){return this.cmp(Z)===-1}lte(Z){return this.cmp(Z)<=0}gt(Z){return this.cmp(Z)===1}gte(Z){return this.cmp(Z)>=0}isZero(){return this._coefficient===0n}isNegative(){return this._coefficient<0n}isPositive(){return this._coefficient>0n}neg(){return new N(-this._coefficient,this._exponent)}abs(){if(this._coefficient<0n)return new N(-this._coefficient,this._exponent);return this}round(Z,$){let X=typeof $==="string"?c2[$]:$;if(X===void 0)throw Error(`Unknown rounding preset: "${$}"`);if(X.value<0||!Number.isInteger(X.value))throw Error("DecimalRoundingOptions.value must be a non-negative integer");if(X.mode==="decimal-places"){let H=this.toFixed(X.value,Z);return v.from(H)}if(this._coefficient===0n)return this;let Y=(this._coefficient<0n?(-this._coefficient).toString():this._coefficient.toString()).length;if(X.value===0)return v.zero;if(Y<=X.value)return this;let Q=Y-X.value,G=10n**BigInt(Q),W=this._coefficient/G,V=this._coefficient%G,B=N.roundDivision(W,V,G,Z);return new N(B,this._exponent+Q)}toString(){if(this._coefficient===0n)return"0";let Z=this._coefficient.toString(),$=Z.startsWith("-"),X=$?Z.slice(1):Z;if(this._exponent<0){let Y=-this._exponent;if((Y>=X.length?Y-X.length:0)>30){if(X.length===1)return`${Z}E${String(this._exponent)}`;let G=X[0]??"",W=X.slice(1),V=this._exponent+X.length-1;return`${$?"-":""}${G}.${W}E${String(V)}`}if(Y>=X.length){let G="0".repeat(Y-X.length);return`${$?"-":""}0.${G}${X}`}else{let G=X.slice(0,X.length-Y),W=X.slice(X.length-Y);return`${$?"-":""}${G}.${W}`}}if(X.length+this._exponent<=30){if(this._exponent===0)return Z;let Y="0".repeat(this._exponent);return`${$?"-":""}${X}${Y}`}else{if(X.length===1)return`${Z}E+${String(this._exponent)}`;let Y=X[0]??"",Q=X.slice(1),G=this._exponent+X.length-1;return`${$?"-":""}${Y}.${Q}E+${String(G)}`}}toJSON(){return this.toString()}toNumber(){return Number(this.toString())}toFixed(Z,$){if(Z<0||!Number.isInteger(Z))throw Error("decimalPlaces must be a non-negative integer");let X=(Y)=>{let Q=Y.toString(),G=Q.startsWith("-"),W=G?Q.slice(1):Q;if(Z===0)return Q;if(Z>=W.length){let V="0".repeat(Z-W.length);return`${G?"-":""}0.${V}${W}`}else{let V=W.slice(0,W.length-Z),B=W.slice(W.length-Z);return`${G?"-":""}${V}.${B}`}},J=-Z;if(this._exponent===J)return X(this._coefficient);if(this._exponent<J){let Y=J-this._exponent,Q=10n**BigInt(Y),G=this._coefficient/Q,W=this._coefficient%Q,V=N.roundDivision(G,W,Q,$);return X(V)}else{let Y=this._exponent-J,Q=this._coefficient*10n**BigInt(Y);return X(Q)}}valueOf(){return this.toString()}}var c2,v;var U8=_(()=>{c2={"ubb-usage-count":{mode:"significant-figures",value:15},"v1-api":{mode:"decimal-places",value:12}};v={from(Z){if(typeof Z==="bigint")return new N(Z,0);if(typeof Z==="number"){if(!Number.isFinite(Z))throw Error("Number must be finite");return v.from(Z.toString())}let $=Z.trim();if($==="")throw Error("Cannot parse empty string as Decimal");let X=/^([+-]?)(\d+)(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/.exec($);if(!X)throw Error(`Invalid decimal string: ${Z}`);let J=X[1]==="-"?-1n:1n,Y=X[2]??"",Q=X[3]??"",G=X[4]?Number(X[4]):0;if(!Number.isSafeInteger(G)||G>1e6||G<-1e6)throw Error(`Exponent out of range: ${String(X[4])} exceeds safe integer bounds`);let W=Y+Q,V=J*BigInt(W),B=G-Q.length;if(!Number.isSafeInteger(B)||B>1e6||B<-1e6)throw Error(`Computed exponent out of range: ${String(B)} exceeds safe integer bounds`);return new N(V,B)},zero:new N(0n,0)}});var A8={};j8(A8,{generateV2Error:()=>_9,generateV1Error:()=>D0,generateOAuthError:()=>O9,TemporarySessionExpiredError:()=>P9,StripeUnsupportedResponseTypeError:()=>E9,StripeUnsupportedGrantTypeError:()=>A9,StripeSignatureVerificationError:()=>g,StripeRateLimitError:()=>T9,StripePermissionError:()=>x9,StripeOAuthInvalidRequestError:()=>L9,StripeOAuthError:()=>m,StripeInvalidScopeError:()=>D9,StripeInvalidRequestError:()=>q8,StripeInvalidGrantError:()=>U9,StripeInvalidClientError:()=>q9,StripeIdempotencyError:()=>D8,StripeError:()=>k,StripeConnectionError:()=>L8,StripeCardError:()=>F9,StripeAuthenticationError:()=>w9,StripeAPIError:()=>A0,RateLimitError:()=>C9});var D0=(Z)=>{let $=Z.statusCode;if($===429||$===400&&Z.code==="rate_limit")return new T9(Z);if($===400||$===404){if(Z.type==="idempotency_error")return new D8(Z);return new q8(Z)}if($===401)return new w9(Z);if($===402)return new F9(Z);if($===403)return new x9(Z);return new A0(Z)},O9=(Z)=>{switch(Z.type){case"invalid_grant":return new U9(Z);case"invalid_client":return new q9(Z);case"invalid_request":return new L9(Z);case"invalid_scope":return new D9(Z);case"unsupported_grant_type":return new A9(Z);case"unsupported_response_type":return new E9(Z);default:return new m(Z)}},_9=(Z)=>{switch(Z.type){case"idempotency_error":return new D8(Z);case"rate_limit":return new C9(Z);case"temporary_session_expired":return new P9(Z)}switch(Z.code){case"invalid_fields":return new q8(Z)}return D0(Z)},k,F9,q8,A0,w9,x9,T9,L8,g,D8,m,U9,q9,L9,D9,A9,E9,C9,P9;var E8=_(()=>{k=class k extends Error{constructor(Z={},$=null){super(Z.message);this.type=$||this.constructor.name,this.raw=Z,this.rawType=Z.type,this.detail=Z.detail,this.headers=Z.headers,this.requestId=Z.requestId,this.statusCode=Z.statusCode,this.message=Z.message??"",this.userMessage=Z.user_message,this.advice_code=Z.advice_code,this.charge=Z.charge,this.code=Z.code,this.decline_code=Z.decline_code,this.doc_url=Z.doc_url,this.network_advice_code=Z.network_advice_code,this.network_decline_code=Z.network_decline_code,this.param=Z.param,this.payment_intent=Z.payment_intent,this.payment_method=Z.payment_method,this.payment_method_type=Z.payment_method_type,this.request_log_url=Z.request_log_url,this.setup_intent=Z.setup_intent,this.source=Z.source,this.user_message=Z.user_message}};k.generate=D0;F9=class F9 extends k{constructor(Z={}){super(Z,"StripeCardError");this.decline_code=Z.decline_code??""}};q8=class q8 extends k{constructor(Z={}){super(Z,"StripeInvalidRequestError")}};A0=class A0 extends k{constructor(Z={}){super(Z,"StripeAPIError")}};w9=class w9 extends k{constructor(Z={}){super(Z,"StripeAuthenticationError")}};x9=class x9 extends k{constructor(Z={}){super(Z,"StripePermissionError")}};T9=class T9 extends k{constructor(Z={}){super(Z,"StripeRateLimitError")}};L8=class L8 extends k{constructor(Z={}){super(Z,"StripeConnectionError")}};g=class g extends k{constructor(Z,$,X={}){super(X,"StripeSignatureVerificationError");this.header=Z,this.payload=$}};D8=class D8 extends k{constructor(Z={}){super(Z,"StripeIdempotencyError")}};m=class m extends k{constructor(Z={},$="StripeOAuthError"){super(Z,$)}};U9=class U9 extends m{constructor(Z={}){super(Z,"StripeInvalidGrantError")}};q9=class q9 extends m{constructor(Z={}){super(Z,"StripeInvalidClientError")}};L9=class L9 extends m{constructor(Z={}){super(Z,"StripeOAuthInvalidRequestError")}};D9=class D9 extends m{constructor(Z={}){super(Z,"StripeInvalidScopeError")}};A9=class A9 extends m{constructor(Z={}){super(Z,"StripeUnsupportedGrantTypeError")}};E9=class E9 extends m{constructor(Z={}){super(Z,"StripeUnsupportedResponseTypeError")}};C9=class C9 extends k{constructor(Z={}){super(Z,"RateLimitError")}};P9=class P9 extends k{constructor(Z={}){super(Z,"TemporarySessionExpiredError")}}});class J0{constructor(Z,$){this._stripe=Z,this._maxBufferedRequestMetric=$}_normalizeStripeContext(Z,$){if(Z)return Z.toString()||null;return $?.toString()||null}_addHeadersDirectlyToObject(Z,$){Z.requestId=$["request-id"],Z.stripeAccount=Z.stripeAccount||$["stripe-account"],Z.apiVersion=Z.apiVersion||$["stripe-version"],Z.idempotencyKey=Z.idempotencyKey||$["idempotency-key"]}_makeResponseEvent(Z,$,X){let J=Date.now(),Y=J-Z.request_start_time;return O8({api_version:X["stripe-version"],account:X["stripe-account"],idempotency_key:X["idempotency-key"],method:Z.method,path:Z.path,status:$,request_id:this._getRequestId(X),elapsed:Y,request_start_time:Z.request_start_time,request_end_time:J})}_getRequestId(Z){return Z["request-id"]}_emitStripeNotice(Z){let $=Z["stripe-notice"];if($)this._stripe._platformFunctions.emitWarning(typeof $==="string"?$:$[0])}_streamingResponseHandler(Z,$,X){return(J)=>{let Y=J.getHeaders();this._emitStripeNotice(Y);let Q=()=>{let W=this._makeResponseEvent(Z,J.getStatusCode(),Y);this._stripe._emitter.emit("response",W),this._recordRequestMetrics(this._getRequestId(Y),W.elapsed,$)},G=J.toStream(Q);return this._addHeadersDirectlyToObject(G,Y),X(null,G)}}_jsonResponseHandler(Z,$,X,J){return(Y)=>{let Q=Y.getHeaders();this._emitStripeNotice(Q);let G=this._getRequestId(Q),W=Y.getStatusCode(),V=this._makeResponseEvent(Z,W,Q);Y.toJSON().then((B)=>{if(this._stripe.getEmitEventBodiesEnabled())V.body=B;if(B.error){let H=typeof B.error==="string";if(H)B.error={type:B.error,message:B.error_description};B.error.headers=Q,B.error.statusCode=W,B.error.requestId=G;let z;if(H)z=O9(B.error);else if($==="v2")z=_9(B.error);else z=D0(B.error);throw z}return B},(B)=>{if(this._stripe.getEmitEventBodiesEnabled()&&B.rawBody)V.body=B.rawBody;throw new A0({message:"Invalid JSON received from the Stripe API",exception:B,requestId:Q["request-id"]})}).then((B)=>{this._stripe._emitter.emit("response",V),this._recordRequestMetrics(G,V.elapsed,X);let H=Y.getRawResponse();this._addHeadersDirectlyToObject(H,Q),Object.defineProperty(B,"lastResponse",{enumerable:!1,writable:!1,value:H}),J(null,B)},(B)=>{this._stripe._emitter.emit("response",V),J(B,null)})}}static _generateConnectionErrorMessage(Z){return`An error occurred with our connection to Stripe.${Z>0?` Request was retried ${Z} times.`:""}`}static _shouldRetry(Z,$,X,J){if(J&&$===0&&S.CONNECTION_CLOSED_ERROR_CODES.includes(J.code))return!0;if($>=X)return!1;if(!Z)return!0;if(Z.getHeaders()["stripe-should-retry"]==="false")return!1;if(Z.getHeaders()["stripe-should-retry"]==="true")return!0;if(Z.getStatusCode()===409)return!0;if(Z.getStatusCode()>=500)return!0;return!1}_getSleepTimeInMS(Z){let $=this._stripe.getInitialNetworkRetryDelay(),X=this._stripe.getMaxNetworkRetryDelay(),J=Math.min($*Math.pow(2,Z-1),X);return J*=0.5*(1+Math.random()),J=Math.max($,J),J*1000}_getMaxNetworkRetries(Z={}){return Z.maxNetworkRetries!==void 0&&Number.isInteger(Z.maxNetworkRetries)?Z.maxNetworkRetries:this._stripe.getMaxNetworkRetries()}_defaultIdempotencyKey(Z,$,X){let J=this._getMaxNetworkRetries($),Y=()=>`stripe-node-retry-${this._stripe._platformFunctions.uuid4()}`;if(X==="v2"){if(Z==="POST"||Z==="DELETE")return Y()}else if(X==="v1"){if(Z==="POST"&&J>0)return Y()}return null}_makeHeaders({contentType:Z,contentLength:$,apiVersion:X,clientUserAgent:J,method:Y,userSuppliedHeaders:Q,userSuppliedSettings:G,stripeAccount:W,stripeContext:V,apiMode:B}){let H={Accept:"application/json","Content-Type":Z,"User-Agent":this._getUserAgentString(B),"X-Stripe-Client-User-Agent":J,"X-Stripe-Client-Telemetry":this._getTelemetryHeader(),"Stripe-Version":X,"Stripe-Account":W,"Stripe-Context":V,"Idempotency-Key":this._defaultIdempotencyKey(Y,G,B)},z=Y=="POST"||Y=="PUT"||Y=="PATCH";if(z||$){if(!z)this._stripe._platformFunctions.emitWarning(`${Y} method had non-zero contentLength but no payload is expected for this verb`);H["Content-Length"]=$}return Object.assign(O8(H),W5(Q))}_getUserAgentString(Z){let $=this._stripe.getConstant("PACKAGE_VERSION"),X=this._stripe._appInfo?this._stripe.getAppInfoAsString():"",J=this._stripe.getConstant("AI_AGENT"),Y=`Stripe/${Z} NodeBindings/${$}`;if(X)Y+=` ${X}`;if(J)Y+=` AIAgent/${J}`;return Y}_getTelemetryHeader(){if(this._stripe.getTelemetryEnabled()&&this._stripe._prevRequestMetrics.length>0){let Z=this._stripe._prevRequestMetrics.shift();return JSON.stringify({last_request_metrics:Z})}}_recordRequestMetrics(Z,$,X){if(this._stripe.getTelemetryEnabled()&&Z)if(this._stripe._prevRequestMetrics.length>this._maxBufferedRequestMetric)this._stripe._platformFunctions.emitWarning("Request metrics buffer is full, dropping telemetry message.");else{let J={request_id:Z,request_duration_ms:$};if(X&&X.length>0)J.usage=X;this._stripe._prevRequestMetrics.push(J)}}_rawRequest(Z,$,X,J,Y){return new Promise((Q,G)=>{try{let W=Z.toUpperCase();if(W!=="POST"&&X&&Object.keys(X).length!==0)throw Error("rawRequest only supports params on POST requests. Please pass null and add your parameters to path.");let V=W==="POST"?Object.assign({},X):null,B=z8(J);if(J?.additionalHeaders)Object.assign(B.headers,J.additionalHeaders);let H=B.apiBase||(J?.apiBase??null),z=H?this._stripe.resolveBaseAddress(H):null;this._request(W,z,$,V,B.authenticator,{headers:B.headers,settings:B.settings,streaming:B.streaming},Y||["raw_request"],(O,F)=>{if(O)G(O);else Q(F)})}catch(W){G(W)}})}_getContentLength(Z){return typeof Z==="string"?new TextEncoder().encode(Z).length:Z.length}_request(Z,$,X,J,Y,Q,G=[],W,V=null){let B;Y=Y??this._stripe._authenticator;let H=F8(X),z=(w,T,q,L)=>{return setTimeout(w,this._getSleepTimeInMS(L),T,q,L+1)},O=(w,T,q)=>{let L=Q.settings&&Q.settings.timeout&&Number.isInteger(Q.settings.timeout)&&Q.settings.timeout>=0?Q.settings.timeout:this._stripe.getApiField("timeout"),E={host:$||this._stripe.getApiField("host"),port:this._stripe.getApiField("port"),path:X,method:Z,headers:Object.assign({},T),body:B,protocol:this._stripe.getApiField("protocol")};if(!Y)throw Error("Authenticator was't initialized. Please pass an API Key or an Authenticator when initializing StripeClient.");Y(E).then(()=>{let P=this._stripe.getApiField("httpClient").makeRequest(E.host,E.port,E.path,E.method,E.headers,E.body,E.protocol,L),I=Date.now(),h=O8({api_version:w,account:w8(T["Stripe-Account"]),idempotency_key:w8(T["Idempotency-Key"]),method:Z,path:X,body:this._stripe.getEmitEventBodiesEnabled()?J??void 0:void 0,request_start_time:I}),s=q||0,J8=this._getMaxNetworkRetries(Q.settings||{});this._stripe._emitter.emit("request",h),P.then((M)=>{if(J0._shouldRetry(M,s,J8))return z(O,w,T,s);else if(Q.streaming&&M.getStatusCode()<400)return this._streamingResponseHandler(h,G,W)(M);else return this._jsonResponseHandler(h,H,G,W)(M)}).catch((M)=>{if(J0._shouldRetry(null,s,J8,M))return z(O,w,T,s);else{let V0=M.code&&M.code===S.TIMEOUT_ERROR_CODE;return W(new L8({message:V0?`Request aborted due to timeout being reached (${L}ms)`:J0._generateConnectionErrorMessage(s),detail:M}))}})}).catch((P)=>{throw new k({message:"Unable to authenticate the request",exception:P})})},F=(w,T)=>{if(w)return W(w);B=T,this._stripe.getClientUserAgent((q)=>{let L=this._stripe.getApiField("version"),E=this._makeHeaders({contentType:H=="v2"?"application/json":"application/x-www-form-urlencoded",contentLength:this._getContentLength(T),apiVersion:L,clientUserAgent:q,method:Z,userSuppliedHeaders:Q.headers??null,userSuppliedSettings:Q.settings??{},stripeAccount:Q.stripeAccount??this._stripe.getApiField("stripeAccount"),stripeContext:this._normalizeStripeContext(Q.stripeContext,this._stripe.getApiField("stripeContext")),apiMode:H});O(L,E,0)})};if(V)V(Z,J,Q.headers,F);else{let w;if(H=="v2")w=J?H5(J):"";else w=p(J||{});F(null,w)}}}var U5=_(()=>{E8();x8();i()});var E0=(Z,$)=>{if(Z==null)return Z;switch($.kind){case"int64_string":return typeof Z==="bigint"||typeof Z==="number"?String(Z):Z;case"decimal_string":return typeof Z.toFixed==="function"&&typeof Z.isZero==="function"?Z.toString():Z;case"object":{if(typeof Z!=="object"||Array.isArray(Z))return Z;let X=Z,J={};for(let Y of Object.keys(X)){let Q=$.fields[Y];J[Y]=Q?E0(X[Y],Q):X[Y]}return J}case"array":{if(!Array.isArray(Z))return Z;return Z.map((X)=>E0(X,$.element))}case"nullable":return E0(Z,$.inner)}},C0=(Z,$)=>{if(Z==null)return Z;switch($.kind){case"int64_string":if(typeof Z==="string")try{return BigInt(Z)}catch{throw Error(`Failed to coerce int64_string value: expected an integer string, got '${Z}'`)}return Z;case"decimal_string":if(typeof Z==="string")try{return v.from(Z)}catch{throw Error(`Failed to coerce decimal_string value: expected a decimal string, got '${Z}'`)}return Z;case"object":{if(typeof Z!=="object"||Array.isArray(Z))return Z;let X=Z;for(let J of Object.keys($.fields))if(J in X)X[J]=C0(X[J],$.fields[J]);return X}case"array":{if(!Array.isArray(Z))return Z;for(let X=0;X<Z.length;X++)Z[X]=C0(Z[X],$.element);return Z}case"nullable":return C0(Z,$.inner)}};var q5=_(()=>{U8()});class k9{constructor(Z,$,X,J,Y,Q,G){this.index=0,this.pagePromise=Z,this.promiseCache={currentPromise:null},this.params=$,this.options=X,this.method=J,this.path=Y,this.spec=Q,this.stripeResource=G}async iterate(Z){if(!(Z&&Z.data&&typeof Z.data.length==="number"))throw Error("Unexpected: Stripe API response does not have a well-formed `data` array.");let $=!!this.params.ending_before;if(this.index<Z.data.length){let X=$?Z.data.length-1-this.index:this.index,J=Z.data[X];return this.index+=1,{value:J,done:!1}}else if(Z.has_more){this.index=0,this.pagePromise=this.getNextPage(Z);let X=await this.pagePromise;return this.iterate(X)}return{done:!0,value:void 0}}getNextPage(Z){throw Error("Unimplemented")}async _next(){return this.iterate(await this.pagePromise)}next(){if(this.promiseCache.currentPromise)return this.promiseCache.currentPromise;let Z=(async()=>{let $=await this._next();return this.promiseCache.currentPromise=null,$})();return this.promiseCache.currentPromise=Z,Z}}class A5{constructor(Z,$,X,J){this.firstPagePromise=Z,this.currentPageIterator=null,this.nextPageUrl=null,this.promiseCache={currentPromise:null},this.options=$,this.spec=X,this.stripeResource=J}async initFirstPage(){if(this.firstPagePromise){let Z=await this.firstPagePromise;this.firstPagePromise=null,this.currentPageIterator=Z.data[Symbol.iterator](),this.nextPageUrl=Z.next_page_url||null}}async turnPage(){if(!this.nextPageUrl)return null;let Z=await this.stripeResource._makeRequest("GET",this.nextPageUrl,void 0,this.options,this.spec);return this.nextPageUrl=Z.next_page_url||null,this.currentPageIterator=Z.data[Symbol.iterator](),this.currentPageIterator}async _next(){if(await this.initFirstPage(),this.currentPageIterator){let Z=this.currentPageIterator.next();if(!Z.done)return{done:!1,value:Z.value}}return this.nextFromNewPage()}async nextFromNewPage(){let Z=await this.turnPage();if(!Z)return{done:!0,value:void 0};let $=Z.next();if(!$.done)return{done:!1,value:$.value};return this.nextFromNewPage()}next(){if(this.promiseCache.currentPromise)return this.promiseCache.currentPromise;let Z=(async()=>{try{return await this._next()}finally{this.promiseCache.currentPromise=null}})();return this.promiseCache.currentPromise=Z,Z}}function m2(){if(typeof Symbol<"u"&&Symbol.asyncIterator)return Symbol.asyncIterator;return"@@asyncIterator"}function l2(Z){if(Z.length<2)return null;let $=Z[1];if(typeof $!=="function")throw Error(`The second argument to autoPagingEach, if present, must be a callback function; received ${typeof $}`);return $}function d2(Z){if(Z.length===0)return;let $=Z[0];if(typeof $!=="function")throw Error(`The first argument to autoPagingEach, if present, must be a callback function; received ${typeof $}`);if($.length===2)return $;if($.length>2)throw Error(`The \`onItem\` callback function passed to autoPagingEach must accept at most two arguments; got ${$}`);return function(J,Y){let Q=$(J);Y(Q)}}function n2(Z,$){let X=$?0:Z.data.length-1,J=Z.data[X],Y=J&&J.id;if(!Y)throw Error("Unexpected: No `id` found on the last item while auto-paging a list.");return Y}function p2(Z){return function(){let X=Error().stack,J=[].slice.call(arguments),Y=d2(J),Q=l2(J);if(J.length>2)throw Error(`autoPagingEach takes up to two arguments; received ${J}`);let G=r2(Z,Y).catch((W)=>{throw x0(W,X),W});if(Q)G.then(()=>Q(),(W)=>Q(W));return G}}function i2(Z){return function(X,J){let Y=Error().stack,Q=X&&X.limit;if(!Q)throw Error("You must pass a `limit` option to autoPagingToArray, e.g., `autoPagingToArray({limit: 1000});`.");if(Q>1e4)throw Error("You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.");let G=new Promise((W,V)=>{let B=[];Z((H)=>{if(B.push(H),B.length>=Q)return!1}).then(()=>{W(B)}).catch((H)=>{x0(H,Y),V(H)})});if(J)G.then((W)=>J(null,W),(W)=>J(W));return G}}function r2(Z,$){return new Promise((X,J)=>{function Y(Q){if(Q.done){X();return}let G=Q.value;return new Promise((W)=>{$(G,W)}).then((W)=>{if(W===!1)return Y({done:!0,value:void 0});else return Z().then(Y)})}Z().then(Y).catch(J)})}var L5,D5,E5=(Z,$,X,J,Y,Q,G)=>{let W=F8(Y),V=Q?.methodType;if(W!=="v2"&&V==="search")return N9(new D5(G,$,X,J,Y,Q,Z));if(W!=="v2"&&V==="list")return N9(new L5(G,$,X,J,Y,Q,Z));if(W==="v2"&&V==="list")return N9(new A5(G,X,Q,Z));return null},N9=(Z)=>{let $=p2((...Y)=>Z.next(...Y)),X=i2($),J={autoPagingEach:$,autoPagingToArray:X,next:()=>Z.next(),return:()=>{return{}},[m2()]:()=>{return J}};return J};var C5=_(()=>{i();L5=class L5 extends k9{getNextPage(Z){let $=!!this.params.ending_before,X=n2(Z,$),J={...this.params,[$?"ending_before":"starting_after"]:X};return this.stripeResource._makeRequest(this.method,this.path,J,this.options,this.spec)}};D5=class D5 extends k9{getNextPage(Z){if(!Z.next_page)throw Error("Unexpected: Stripe API response does not have a well-formed `next_page` field, but `has_more` was true.");let $={...this.params,page:Z.next_page};return this.stripeResource._makeRequest(this.method,this.path,$,this.options,this.spec)}}});class K{constructor(Z,$){if(this.resourcePath="",this.requestDataProcessor=null,this._stripe=Z,$)throw Error("Support for curried url params was dropped in stripe-node v7.0.0. Instead, pass two ids.");this.basePath=w0(this.basePath||Z.getApiField("basePath"));let X=this.path||"";this.resourcePath=X,this.path=w0(X),this.initialize(Z,$)}initialize(Z,$){}_makeRequest(Z,$,X,J,Y){let Q=Z.toUpperCase(),W=(Y?.encode||((P)=>P))(X?{...X}:{}),V=z8(J),B=V.apiBase||Y?.apiBase||null,H=B?this._stripe.resolveBaseAddress(B):null,z=V.streaming||!!Y?.streaming,O=Object.assign(V.headers,Y?.headers),F=Y?.usage||[],w=Q==="GET"||Q==="DELETE",T=w?null:W,q=w?W:{};try{if(Y?.validator)Y.validator(W,{headers:O});if(Y?.requestSchema&&T)T=E0(T,Y.requestSchema)}catch(P){return Promise.reject(P)}let L=Error().stack,E=new Promise((P,I)=>{function h(M,V0){if(M)x0(M,L),I(M);else try{if(Y?.responseSchema)C0(V0,Y.responseSchema);P(Y?.transformResponseData?Y.transformResponseData(V0):V0)}catch(d7){I(d7)}}let s=Object.keys(q).length===0,J8=[$,s?"":"?",p(q)].join("");this._stripe._requestSender._request(Q,H,J8,T,V.authenticator,{headers:O,settings:V.settings,streaming:z},F,h,this.requestDataProcessor?.bind(this))});if(Y?.methodType)Object.assign(E,E5(this,X?{...X}:{},J,Q,$,Y,E));return E}}var x=_(()=>{i();q5();C5();K.MAX_BUFFERED_REQUEST_METRICS=100});class l{constructor(Z=[]){this._segments=[...Z]}get segments(){return[...this._segments]}push(Z){if(!Z)throw Error("Segment cannot be null or undefined");return new l([...this._segments,Z])}pop(){if(this._segments.length===0)throw Error("Cannot pop from an empty context");return new l(this._segments.slice(0,-1))}toString(){return this._segments.join("/")}static parse(Z){if(!Z)return new l([]);return new l(Z.split("/"))}}function P5(Z){let $={DEFAULT_TOLERANCE:300,signature:null,constructEvent(H,z,O,F,w,T){try{if(!this.signature)throw Error("ERR: missing signature helper, unable to verify");w=w||V(),this.signature.verifyHeader(H,z,O,F||$.DEFAULT_TOLERANCE,w,T)}catch(L){if(L instanceof L0)L.message+="\nUse `await constructEventAsync(...)` instead of `constructEvent(...)`";throw L}let q=H instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(H)):JSON.parse(H);if(q&&q.object==="v2.core.event")throw Error("You passed an event notification to stripe.webhooks.constructEvent, which expects a webhook payload. Use stripe.parseEventNotification instead.");return q},async constructEventAsync(H,z,O,F,w,T){if(!this.signature)throw Error("ERR: missing signature helper, unable to verify");w=w||V(),await this.signature.verifyHeaderAsync(H,z,O,F||$.DEFAULT_TOLERANCE,w,T);let q=H instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(H)):JSON.parse(H);if(q&&q.object==="v2.core.event")throw Error("You passed an event notification to stripe.webhooks.constructEvent, which expects a webhook payload. Use stripe.parseEventNotificationAsync instead.");return q},generateTestHeaderString:function(H){let z=B(H),O=z.signature||z.cryptoProvider.computeHMACSignature(z.payloadString,z.secret);return z.generateHeaderString(O)},generateTestHeaderStringAsync:async function(H){let z=B(H),O=z.signature||await z.cryptoProvider.computeHMACSignatureAsync(z.payloadString,z.secret);return z.generateHeaderString(O)}},X={EXPECTED_SCHEME:"v1",verifyHeader(H,z,O,F,w,T){let{decodedHeader:q,decodedPayload:L,details:E,suspectPayloadType:P}=Y(H,z,this.EXPECTED_SCHEME),I=/\s/.test(O);w=w||V();let h=w.computeHMACSignature(J(L,E),O);return Q(L,q,E,h,F||0,P,I,T),!0},async verifyHeaderAsync(H,z,O,F,w,T){let{decodedHeader:q,decodedPayload:L,details:E,suspectPayloadType:P}=Y(H,z,this.EXPECTED_SCHEME),I=/\s/.test(O);w=w||V();let h=await w.computeHMACSignatureAsync(J(L,E),O);return Q(L,q,E,h,F||0,P,I,T)}};function J(H,z){return`${z.timestamp}.${H}`}function Y(H,z,O){if(Array.isArray(z))throw Error("Unexpected: An array was passed as a header, which should not be possible for the stripe-signature header.");if(!H)throw new g(z,H,{message:"No webhook payload was provided."});let F=typeof H!="string"&&!(H instanceof Uint8Array),w=new TextDecoder("utf8"),T=H instanceof Uint8Array?w.decode(H):H;if(z==null||z=="")throw new g(z,H,{message:"No stripe-signature header value was provided."});let q=z instanceof Uint8Array?w.decode(z):z,L=G(q,O);if(!L||L.timestamp===-1)throw new g(q,T,{message:"Unable to extract timestamp and signatures from header"});if(!L.signatures.length)throw new g(q,T,{message:"No signatures found with expected scheme"});return{decodedPayload:T,decodedHeader:q,details:L,suspectPayloadType:F}}function Q(H,z,O,F,w,T,q,L){let E=!!O.signatures.filter(Z.secureCompare.bind(Z,F)).length,P=`
6
- Learn more about webhook signing and explore webhook integration examples for various frameworks at https://docs.stripe.com/webhooks/signature`,I=q?`
2
+ var Wc=Object.defineProperty;var Qc=(e)=>e;function Jc(e,t){this[e]=Qc.bind(null,t)}var Oi=(e,t)=>{for(var n in t)Wc(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Jc.bind(t,n)})};var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var T=import.meta.require;var sr;var ar=f(()=>{sr={api:"api.stripe.com",files:"files.stripe.com",connect:"connect.stripe.com",meter_events:"meter-events.stripe.com"}});function z(e){return Dd(e)}function ll(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/\*/g,"%2A").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/'/g,"%27").replace(/%5B/g,"[").replace(/%5D/g,"]")}function Md(e){if(e instanceof Date)return Math.floor(e.getTime()/1000).toString();if(e===null)return"";return String(e)}function Dd(e){let t=[];function n(i,r){if(r===void 0)return;if(r===null||typeof r!=="object"||r instanceof Date){t.push(ll(i)+"="+ll(Md(r)));return}if(Array.isArray(r)){for(let o=0;o<r.length;o++)if(r[o]!==void 0)n(i+"["+o+"]",r[o]);return}for(let o of Object.keys(r))n(i+"["+o+"]",r[o])}if(typeof e==="object"&&e!==null)for(let i of Object.keys(e))n(i,e[i]);return t.join("&")}function Fd(e){return["number","string","boolean"].includes(typeof e)}function fi(e){let t={authenticator:null,headers:{},settings:{},streaming:!1,apiBase:null};if(!e)return t;if(e.apiKey)t.authenticator=lr(e.apiKey);if(e.idempotencyKey)t.headers["Idempotency-Key"]=e.idempotencyKey;if(e.stripeAccount)t.headers["Stripe-Account"]=e.stripeAccount;if(e.stripeContext){if(t.headers["Stripe-Account"])throw Error("Can't specify both stripeAccount and stripeContext.");t.headers["Stripe-Context"]=e.stripeContext}if(e.apiVersion)t.headers["Stripe-Version"]=e.apiVersion;if(Number.isInteger(e.maxNetworkRetries))t.settings.maxNetworkRetries=e.maxNetworkRetries;if(Number.isInteger(e.timeout))t.settings.timeout=e.timeout;if(e.authenticator){if(e.apiKey)throw Error("Can't specify both apiKey and authenticator.");if(typeof e.authenticator!=="function")throw Error("The authenticator must be a function receiving a request as the first parameter.");t.authenticator=e.authenticator}if(e.headers)Object.assign(t.headers,e.headers);if(e.streaming)t.streaming=!0;return t}function _i(e){if(typeof e!=="object")throw Error("Argument must be an object");return Object.keys(e).reduce((t,n)=>{if(e[n]!=null)t[n]=e[n];return t},{})}function dl(e){if(!(e&&typeof e==="object"))return e;return Object.keys(e).reduce((t,n)=>(t[Nd(n)]=e[n],t),{})}function Nd(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()).join("-")}function ul(e){if(e==="OAuth")return"oauth";else return e[0].toLowerCase()+e.substring(1)}function Gd(e){let t=typeof e;return(t==="function"||t==="object")&&!!e}function ml(e){let t={},n=(i,r)=>{Object.entries(i).forEach(([o,s])=>{let a=r?`${r}[${o}]`:o;if(Gd(s))if(!(s instanceof Uint8Array)&&!Object.prototype.hasOwnProperty.call(s,"data"))return n(s,a);else t[a]=s;else t[a]=String(s)})};return n(e,null),t}function ki(e,t,n){if(!Number.isInteger(t))if(n!==void 0)return n;else throw Error(`${e} must be an integer`);return t}function pl(e){for(let[t,n]of Bd)if(e[t])return n;return""}function lr(e){let t=(n)=>(n.headers.Authorization="Bearer "+e,Promise.resolve());return t._apiKey=e,t}function Ld(e,t){if(this[e]instanceof Date)return Math.floor(this[e].getTime()/1000).toString();return t}function fl(e){return JSON.stringify(e,Ld)}function bi(e){if(!e)return"v1";return e.startsWith("/v2")?"v2":"v1"}function gi(e){if(Array.isArray(e))return e.join(", ");return String(e)}function _l(e){return Object.entries(e).map(([t,n])=>[t,gi(n)])}function ge(e,t){if(!e||!e.stack||!t)return;let n=t.substring(t.indexOf(`
3
+ `)+1),i=e.stack.indexOf(cl),r=i>=0?e.stack.substring(0,i):e.stack;e.stack=`${r}${cl}
4
+ ${n}`}var be,Bd,cl=`
5
+ Originating from:`;var W=f(()=>{ar();be=(()=>{let e={"\n":"\\n",'"':"\\\"","\u2028":"\\u2028","\u2029":"\\u2029"};return(t)=>{let n=t.replace(/["\n\r\u2028\u2029]/g,(i)=>e[i]);return(i)=>n.replace(/\{([\s\S]+?)\}/g,(r,o)=>{let s=i[o];if(Fd(s))return encodeURIComponent(s);return""})}})();Bd=[["ANTIGRAVITY_CLI_ALIAS","antigravity"],["CLAUDECODE","claude_code"],["CLINE_ACTIVE","cline"],["CODEX_SANDBOX","codex_cli"],["CODEX_THREAD_ID","codex_cli"],["CODEX_SANDBOX_NETWORK_DISABLED","codex_cli"],["CODEX_CI","codex_cli"],["CURSOR_AGENT","cursor"],["GEMINI_CLI","gemini_cli"],["OPENCLAW_SHELL","openclaw"],["OPENCODE","open_code"]]});class q{getClientName(){throw Error("getClientName not implemented.")}makeRequest(e,t,n,i,r,o,s,a){throw Error("makeRequest not implemented.")}static makeTimeoutError(){let e=TypeError(q.TIMEOUT_ERROR_CODE);return e.code=q.TIMEOUT_ERROR_CODE,e}}class he{constructor(e,t){this._statusCode=e,this._headers=t}getStatusCode(){return this._statusCode}getHeaders(){return this._headers}getRawResponse(){throw Error("getRawResponse not implemented.")}toStream(e){throw Error("toStream not implemented.")}toJSON(){throw Error("toJSON not implemented.")}}var hi=f(()=>{q.CONNECTION_CLOSED_ERROR_CODES=["ECONNRESET","EPIPE"];q.TIMEOUT_ERROR_CODE="ETIMEDOUT"});var ye,cr;var kl=f(()=>{W();hi();ye=class ye extends q{constructor(e){super();if(!e){if(!globalThis.fetch)throw Error("fetch() function not provided and is not defined in the global scope. You must provide a fetch implementation.");e=globalThis.fetch}if(globalThis.AbortController)this._fetchFn=ye.makeFetchWithAbortTimeout(e);else this._fetchFn=ye.makeFetchWithRaceTimeout(e)}static makeFetchWithRaceTimeout(e){return(t,n,i)=>{let r,o=new Promise((a,c)=>{r=setTimeout(()=>{r=null,c(q.makeTimeoutError())},i)}),s=e(t,n);return Promise.race([s,o]).finally(()=>{if(r)clearTimeout(r)})}}static makeFetchWithAbortTimeout(e){return async(t,n,i)=>{let r=new AbortController,o=setTimeout(()=>{o=null,r.abort(q.makeTimeoutError())},i);try{return await e(t,{...n,signal:r.signal})}catch(s){if(s.name==="AbortError")throw q.makeTimeoutError();else throw s}finally{if(o)clearTimeout(o)}}}getClientName(){return"fetch"}async makeRequest(e,t,n,i,r,o,s,a){let c=s==="http";if(!n.startsWith("/"))throw Error(`Only relative paths are supported, got: "${n}"`);let l=new URL(`${c?"http":"https"}://${e}${n}`);l.port=t;let u=i=="POST"||i=="PUT"||i=="PATCH",m=o||(u?"":void 0),p=await this._fetchFn(l.toString(),{method:i,headers:_l(r),body:m},a);return new cr(p)}};cr=class cr extends he{constructor(e){super(e.status,cr._transformHeadersToObject(e.headers));this._res=e}getRawResponse(){return this._res}toStream(e){return e(),this._res.body}toJSON(){return this._res.text().then((e)=>{try{return JSON.parse(e)}catch(t){if(t instanceof Error)t.rawBody=e;throw t}})}static _transformHeadersToObject(e){let t={};for(let n of e){if(!Array.isArray(n)||n.length!=2)throw Error("Response objects produced by the fetch function given to FetchHttpClient do not have an iterable headers map. Response#headers should be an iterable object.");t[n[0]]=n[1]}return t}}});class Re{computeHMACSignature(e,t){throw Error("computeHMACSignature not implemented.")}computeHMACSignatureAsync(e,t){throw Error("computeHMACSignatureAsync not implemented.")}computeSHA256Async(e){throw Error("computeSHA256 not implemented.")}}var Te;var yi=f(()=>{Te=class Te extends Error{}});var ur,dr;var bl=f(()=>{yi();ur=class ur extends Re{constructor(e){super();this.subtleCrypto=e||crypto.subtle}computeHMACSignature(e,t){throw new Te("SubtleCryptoProvider cannot be used in a synchronous context.")}async computeHMACSignatureAsync(e,t){let n=new TextEncoder,i=await this.subtleCrypto.importKey("raw",n.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=await this.subtleCrypto.sign("hmac",i,n.encode(e)),o=new Uint8Array(r),s=Array(o.length);for(let a=0;a<o.length;a++)s[a]=dr[o[a]];return s.join("")}async computeSHA256Async(e){return new Uint8Array(await this.subtleCrypto.digest("SHA-256",e))}};dr=Array(256);for(let e=0;e<dr.length;e++)dr[e]=e.toString(16).padStart(2,"0")});class mr{constructor(){this._fetchFn=null,this._agent=null}getPlatformInfo(){return null}getTelemetryId(){return null}emitWarning(e){console.warn(`Stripe: ${e}`)}getEnv(){return null}getRuntimeVersion(){return null}uuid4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e)=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}secureCompare(e,t){if(e.length!==t.length)return!1;let n=e.length,i=0;for(let r=0;r<n;++r)i|=e.charCodeAt(r)^t.charCodeAt(r);return i===0}createEmitter(){throw Error("createEmitter not implemented.")}tryBufferData(e){throw Error("tryBufferData not implemented.")}createNodeHttpClient(e){throw Error("createNodeHttpClient not implemented.")}createFetchHttpClient(e){return new ye(e)}createDefaultHttpClient(){throw Error("createDefaultHttpClient not implemented.")}createNodeCryptoProvider(){throw Error("createNodeCryptoProvider not implemented.")}createSubtleCryptoProvider(e){return new ur(e)}createDefaultCryptoProvider(){throw Error("createDefaultCryptoProvider not implemented.")}}var gl=f(()=>{kl();bl()});class pr{constructor(){this.eventTarget=new EventTarget,this.listenerMapping=new Map}on(e,t){let n=(i)=>{t(i.data)};return this.listenerMapping.set(t,n),this.eventTarget.addEventListener(e,n)}removeListener(e,t){let n=this.listenerMapping.get(t);return this.listenerMapping.delete(t),this.eventTarget.removeEventListener(e,n)}once(e,t){let n=(i)=>{t(i.data)};return this.listenerMapping.set(t,n),this.eventTarget.addEventListener(e,n,{once:!0})}emit(e,t){return this.eventTarget.dispatchEvent(new hl(e,t))}}var hl;var yl=f(()=>{hl=class hl extends Event{constructor(e,t){super(e);this.data=t}}});var fr;var Rl=f(()=>{gl();yl();fr=class fr extends mr{createEmitter(){return new pr}tryBufferData(e){if(e.file.data instanceof ReadableStream)throw Error("Uploading a file as a stream is not supported in non-Node environments. Please open or upvote an issue at github.com/stripe/stripe-node if you use this, detailing your use-case.");return Promise.resolve(e)}createNodeHttpClient(){throw Error("Stripe: `createNodeHttpClient()` is not available in non-Node environments. Please use `createFetchHttpClient()` instead.")}createDefaultHttpClient(){return super.createFetchHttpClient()}createNodeCryptoProvider(){throw Error("Stripe: `createNodeCryptoProvider()` is not available in non-Node environments. Please use `createSubtleCryptoProvider()` instead.")}createDefaultCryptoProvider(){return this.createSubtleCryptoProvider()}}});class C{constructor(e,t){let[n,i]=C.normalize(e,t);this._coefficient=n,this._exponent=i,Object.freeze(this)}static normalize(e,t){if(e===0n)return[0n,0];let n=e,i=t;while(n!==0n&&n%10n===0n)n/=10n,i+=1;return[n,i]}static roundDivision(e,t,n,i){if(t===0n)return e;if(i==="round-down")return e;let r=t>0n===n>0n?1n:-1n;if(i==="round-up")return e+r;if(i==="ceil")return r===1n?e+1n:e;if(i==="floor")return r===-1n?e-1n:e;let o=t<0n?-t:t,s=n<0n?-n:n,a=o*2n,c;if(a===s)c=0;else if(a<s)c=-1;else c=1;if(c<0)return e;if(c>0)return e+r;if(i==="half-up")return e+r;if(i==="half-down")return e;if(e%2n===0n)return e;else return e+r}add(e){let t=e;if(this._exponent===t._exponent)return new C(this._coefficient+t._coefficient,this._exponent);if(this._exponent<t._exponent){let n=10n**BigInt(t._exponent-this._exponent);return new C(this._coefficient+t._coefficient*n,this._exponent)}else{let n=10n**BigInt(this._exponent-t._exponent);return new C(this._coefficient*n+t._coefficient,t._exponent)}}sub(e){let t=e;if(this._exponent===t._exponent)return new C(this._coefficient-t._coefficient,this._exponent);if(this._exponent<t._exponent){let n=10n**BigInt(t._exponent-this._exponent);return new C(this._coefficient-t._coefficient*n,this._exponent)}else{let n=10n**BigInt(this._exponent-t._exponent);return new C(this._coefficient*n-t._coefficient,t._exponent)}}mul(e){let t=e;return new C(this._coefficient*t._coefficient,this._exponent+t._exponent)}div(e,t,n){if(t<0||!Number.isInteger(t))throw Error("precision must be a non-negative integer");let i=e;if(i._coefficient===0n)throw Error("Division by zero");let r=this._exponent-i._exponent+t,o,s,a;if(r>=0){let l=this._coefficient*10n**BigInt(r);o=l/i._coefficient,s=l%i._coefficient,a=i._coefficient}else{let l=i._coefficient*10n**BigInt(-r);o=this._coefficient/l,s=this._coefficient%l,a=l}let c=C.roundDivision(o,s,a,n);return new C(c,-t)}cmp(e){let t=e;if(this._exponent===t._exponent){if(this._coefficient<t._coefficient)return-1;if(this._coefficient>t._coefficient)return 1;return 0}if(this._exponent<t._exponent){let n=10n**BigInt(t._exponent-this._exponent),i=t._coefficient*n;if(this._coefficient<i)return-1;if(this._coefficient>i)return 1;return 0}else{let n=10n**BigInt(this._exponent-t._exponent),i=this._coefficient*n;if(i<t._coefficient)return-1;if(i>t._coefficient)return 1;return 0}}eq(e){return this.cmp(e)===0}lt(e){return this.cmp(e)===-1}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)===1}gte(e){return this.cmp(e)>=0}isZero(){return this._coefficient===0n}isNegative(){return this._coefficient<0n}isPositive(){return this._coefficient>0n}neg(){return new C(-this._coefficient,this._exponent)}abs(){if(this._coefficient<0n)return new C(-this._coefficient,this._exponent);return this}round(e,t){let n=typeof t==="string"?Kd[t]:t;if(n===void 0)throw Error(`Unknown rounding preset: "${t}"`);if(n.value<0||!Number.isInteger(n.value))throw Error("DecimalRoundingOptions.value must be a non-negative integer");if(n.mode==="decimal-places"){let u=this.toFixed(n.value,e);return M.from(u)}if(this._coefficient===0n)return this;let r=(this._coefficient<0n?(-this._coefficient).toString():this._coefficient.toString()).length;if(n.value===0)return M.zero;if(r<=n.value)return this;let o=r-n.value,s=10n**BigInt(o),a=this._coefficient/s,c=this._coefficient%s,l=C.roundDivision(a,c,s,e);return new C(l,this._exponent+o)}toString(){if(this._coefficient===0n)return"0";let e=this._coefficient.toString(),t=e.startsWith("-"),n=t?e.slice(1):e;if(this._exponent<0){let r=-this._exponent;if((r>=n.length?r-n.length:0)>30){if(n.length===1)return`${e}E${String(this._exponent)}`;let s=n[0]??"",a=n.slice(1),c=this._exponent+n.length-1;return`${t?"-":""}${s}.${a}E${String(c)}`}if(r>=n.length){let s="0".repeat(r-n.length);return`${t?"-":""}0.${s}${n}`}else{let s=n.slice(0,n.length-r),a=n.slice(n.length-r);return`${t?"-":""}${s}.${a}`}}if(n.length+this._exponent<=30){if(this._exponent===0)return e;let r="0".repeat(this._exponent);return`${t?"-":""}${n}${r}`}else{if(n.length===1)return`${e}E+${String(this._exponent)}`;let r=n[0]??"",o=n.slice(1),s=this._exponent+n.length-1;return`${t?"-":""}${r}.${o}E+${String(s)}`}}toJSON(){return this.toString()}toNumber(){return Number(this.toString())}toFixed(e,t){if(e<0||!Number.isInteger(e))throw Error("decimalPlaces must be a non-negative integer");let n=(r)=>{let o=r.toString(),s=o.startsWith("-"),a=s?o.slice(1):o;if(e===0)return o;if(e>=a.length){let c="0".repeat(e-a.length);return`${s?"-":""}0.${c}${a}`}else{let c=a.slice(0,a.length-e),l=a.slice(a.length-e);return`${s?"-":""}${c}.${l}`}},i=-e;if(this._exponent===i)return n(this._coefficient);if(this._exponent<i){let r=i-this._exponent,o=10n**BigInt(r),s=this._coefficient/o,a=this._coefficient%o,c=C.roundDivision(s,a,o,t);return n(c)}else{let r=this._exponent-i,o=this._coefficient*10n**BigInt(r);return n(o)}}valueOf(){return this.toString()}}var Kd,M;var Ri=f(()=>{Kd={"ubb-usage-count":{mode:"significant-figures",value:15},"v1-api":{mode:"decimal-places",value:12}};M={from(e){if(typeof e==="bigint")return new C(e,0);if(typeof e==="number"){if(!Number.isFinite(e))throw Error("Number must be finite");return M.from(e.toString())}let t=e.trim();if(t==="")throw Error("Cannot parse empty string as Decimal");let n=/^([+-]?)(\d+)(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/.exec(t);if(!n)throw Error(`Invalid decimal string: ${e}`);let i=n[1]==="-"?-1n:1n,r=n[2]??"",o=n[3]??"",s=n[4]?Number(n[4]):0;if(!Number.isSafeInteger(s)||s>1e6||s<-1e6)throw Error(`Exponent out of range: ${String(n[4])} exceeds safe integer bounds`);let a=r+o,c=i*BigInt(a),l=s-o.length;if(!Number.isSafeInteger(l)||l>1e6||l<-1e6)throw Error(`Computed exponent out of range: ${String(l)} exceeds safe integer bounds`);return new C(c,l)},zero:new C(0n,0)}});var Si={};Oi(Si,{RateLimitError:()=>Cr,StripeAPIError:()=>ve,StripeAuthenticationError:()=>gr,StripeCardError:()=>br,StripeConnectionError:()=>wi,StripeError:()=>j,StripeIdempotencyError:()=>vi,StripeInvalidClientError:()=>Tr,StripeInvalidGrantError:()=>Rr,StripeInvalidRequestError:()=>Ti,StripeInvalidScopeError:()=>vr,StripeOAuthError:()=>L,StripeOAuthInvalidRequestError:()=>wr,StripePermissionError:()=>hr,StripeRateLimitError:()=>yr,StripeSignatureVerificationError:()=>N,StripeUnsupportedGrantTypeError:()=>Sr,StripeUnsupportedResponseTypeError:()=>xr,TemporarySessionExpiredError:()=>jr,generateOAuthError:()=>_r,generateV1Error:()=>we,generateV2Error:()=>kr});var we=(e)=>{let t=e.statusCode;if(t===429||t===400&&e.code==="rate_limit")return new yr(e);if(t===400||t===404){if(e.type==="idempotency_error")return new vi(e);return new Ti(e)}if(t===401)return new gr(e);if(t===402)return new br(e);if(t===403)return new hr(e);return new ve(e)},_r=(e)=>{switch(e.type){case"invalid_grant":return new Rr(e);case"invalid_client":return new Tr(e);case"invalid_request":return new wr(e);case"invalid_scope":return new vr(e);case"unsupported_grant_type":return new Sr(e);case"unsupported_response_type":return new xr(e);default:return new L(e)}},kr=(e)=>{switch(e.type){case"idempotency_error":return new vi(e);case"rate_limit":return new Cr(e);case"temporary_session_expired":return new jr(e)}switch(e.code){case"invalid_fields":return new Ti(e)}return we(e)},j,br,Ti,ve,gr,hr,yr,wi,N,vi,L,Rr,Tr,wr,vr,Sr,xr,Cr,jr;var xi=f(()=>{j=class j extends Error{constructor(e={},t=null){super(e.message);this.type=t||this.constructor.name,this.raw=e,this.rawType=e.type,this.detail=e.detail,this.headers=e.headers,this.requestId=e.requestId,this.statusCode=e.statusCode,this.message=e.message??"",this.userMessage=e.user_message,this.advice_code=e.advice_code,this.charge=e.charge,this.code=e.code,this.decline_code=e.decline_code,this.doc_url=e.doc_url,this.network_advice_code=e.network_advice_code,this.network_decline_code=e.network_decline_code,this.param=e.param,this.payment_intent=e.payment_intent,this.payment_method=e.payment_method,this.payment_method_type=e.payment_method_type,this.request_log_url=e.request_log_url,this.setup_intent=e.setup_intent,this.source=e.source,this.user_message=e.user_message}};j.generate=we;br=class br extends j{constructor(e={}){super(e,"StripeCardError");this.decline_code=e.decline_code??""}};Ti=class Ti extends j{constructor(e={}){super(e,"StripeInvalidRequestError")}};ve=class ve extends j{constructor(e={}){super(e,"StripeAPIError")}};gr=class gr extends j{constructor(e={}){super(e,"StripeAuthenticationError")}};hr=class hr extends j{constructor(e={}){super(e,"StripePermissionError")}};yr=class yr extends j{constructor(e={}){super(e,"StripeRateLimitError")}};wi=class wi extends j{constructor(e={}){super(e,"StripeConnectionError")}};N=class N extends j{constructor(e,t,n={}){super(n,"StripeSignatureVerificationError");this.header=e,this.payload=t}};vi=class vi extends j{constructor(e={}){super(e,"StripeIdempotencyError")}};L=class L extends j{constructor(e={},t="StripeOAuthError"){super(e,t)}};Rr=class Rr extends L{constructor(e={}){super(e,"StripeInvalidGrantError")}};Tr=class Tr extends L{constructor(e={}){super(e,"StripeInvalidClientError")}};wr=class wr extends L{constructor(e={}){super(e,"StripeOAuthInvalidRequestError")}};vr=class vr extends L{constructor(e={}){super(e,"StripeInvalidScopeError")}};Sr=class Sr extends L{constructor(e={}){super(e,"StripeUnsupportedGrantTypeError")}};xr=class xr extends L{constructor(e={}){super(e,"StripeUnsupportedResponseTypeError")}};Cr=class Cr extends j{constructor(e={}){super(e,"RateLimitError")}};jr=class jr extends j{constructor(e={}){super(e,"TemporarySessionExpiredError")}}});class re{constructor(e,t){this._stripe=e,this._maxBufferedRequestMetric=t}_normalizeStripeContext(e,t){if(e)return e.toString()||null;return t?.toString()||null}_addHeadersDirectlyToObject(e,t){e.requestId=t["request-id"],e.stripeAccount=e.stripeAccount||t["stripe-account"],e.apiVersion=e.apiVersion||t["stripe-version"],e.idempotencyKey=e.idempotencyKey||t["idempotency-key"]}_makeResponseEvent(e,t,n){let i=Date.now(),r=i-e.request_start_time;return _i({api_version:n["stripe-version"],account:n["stripe-account"],idempotency_key:n["idempotency-key"],method:e.method,path:e.path,status:t,request_id:this._getRequestId(n),elapsed:r,request_start_time:e.request_start_time,request_end_time:i})}_getRequestId(e){return e["request-id"]}_emitStripeNotice(e){let t=e["stripe-notice"];if(t)this._stripe._platformFunctions.emitWarning(typeof t==="string"?t:t[0])}_streamingResponseHandler(e,t,n){return(i)=>{let r=i.getHeaders();this._emitStripeNotice(r);let o=()=>{let a=this._makeResponseEvent(e,i.getStatusCode(),r);this._stripe._emitter.emit("response",a),this._recordRequestMetrics(this._getRequestId(r),a.elapsed,t)},s=i.toStream(o);return this._addHeadersDirectlyToObject(s,r),n(null,s)}}_jsonResponseHandler(e,t,n,i){return(r)=>{let o=r.getHeaders();this._emitStripeNotice(o);let s=this._getRequestId(o),a=r.getStatusCode(),c=this._makeResponseEvent(e,a,o);r.toJSON().then((l)=>{if(this._stripe.getEmitEventBodiesEnabled())c.body=l;if(l.error){let u=typeof l.error==="string";if(u)l.error={type:l.error,message:l.error_description};l.error.headers=o,l.error.statusCode=a,l.error.requestId=s;let m;if(u)m=_r(l.error);else if(t==="v2")m=kr(l.error);else m=we(l.error);throw m}return l},(l)=>{if(this._stripe.getEmitEventBodiesEnabled()&&l.rawBody)c.body=l.rawBody;throw new ve({message:"Invalid JSON received from the Stripe API",exception:l,requestId:o["request-id"]})}).then((l)=>{this._stripe._emitter.emit("response",c),this._recordRequestMetrics(s,c.elapsed,n);let u=r.getRawResponse();this._addHeadersDirectlyToObject(u,o),Object.defineProperty(l,"lastResponse",{enumerable:!1,writable:!1,value:u}),i(null,l)},(l)=>{this._stripe._emitter.emit("response",c),i(l,null)})}}static _generateConnectionErrorMessage(e){return`An error occurred with our connection to Stripe.${e>0?` Request was retried ${e} times.`:""}`}static _shouldRetry(e,t,n,i){if(i&&t===0&&q.CONNECTION_CLOSED_ERROR_CODES.includes(i.code))return!0;if(t>=n)return!1;if(!e)return!0;if(e.getHeaders()["stripe-should-retry"]==="false")return!1;if(e.getHeaders()["stripe-should-retry"]==="true")return!0;if(e.getStatusCode()===409)return!0;if(e.getStatusCode()>=500)return!0;return!1}_getSleepTimeInMS(e){let t=this._stripe.getInitialNetworkRetryDelay(),n=this._stripe.getMaxNetworkRetryDelay(),i=Math.min(t*Math.pow(2,e-1),n);return i*=0.5*(1+Math.random()),i=Math.max(t,i),i*1000}_getMaxNetworkRetries(e={}){return e.maxNetworkRetries!==void 0&&Number.isInteger(e.maxNetworkRetries)?e.maxNetworkRetries:this._stripe.getMaxNetworkRetries()}_defaultIdempotencyKey(e,t,n){let i=this._getMaxNetworkRetries(t),r=()=>`stripe-node-retry-${this._stripe._platformFunctions.uuid4()}`;if(n==="v2"){if(e==="POST"||e==="DELETE")return r()}else if(n==="v1"){if(e==="POST"&&i>0)return r()}return null}_makeHeaders({contentType:e,contentLength:t,apiVersion:n,clientUserAgent:i,method:r,userSuppliedHeaders:o,userSuppliedSettings:s,stripeAccount:a,stripeContext:c,apiMode:l}){let u={Accept:"application/json","Content-Type":e,"User-Agent":this._getUserAgentString(l),"X-Stripe-Client-User-Agent":i,"X-Stripe-Client-Telemetry":this._getTelemetryHeader(),"Stripe-Version":n,"Stripe-Account":a,"Stripe-Context":c,"Idempotency-Key":this._defaultIdempotencyKey(r,s,l)},m=r=="POST"||r=="PUT"||r=="PATCH";if(m||t){if(!m)this._stripe._platformFunctions.emitWarning(`${r} method had non-zero contentLength but no payload is expected for this verb`);u["Content-Length"]=t}return Object.assign(_i(u),dl(o))}_getUserAgentString(e){let t=this._stripe.getConstant("PACKAGE_VERSION"),n=this._stripe._appInfo?this._stripe.getAppInfoAsString():"",i=this._stripe.getConstant("AI_AGENT"),r=`Stripe/${e} NodeBindings/${t}`;if(n)r+=` ${n}`;if(i)r+=` AIAgent/${i}`;return r}_getTelemetryHeader(){if(this._stripe.getTelemetryEnabled()&&this._stripe._prevRequestMetrics.length>0){let e=this._stripe._prevRequestMetrics.shift();return JSON.stringify({last_request_metrics:e})}}_recordRequestMetrics(e,t,n){if(this._stripe.getTelemetryEnabled()&&e)if(this._stripe._prevRequestMetrics.length>this._maxBufferedRequestMetric)this._stripe._platformFunctions.emitWarning("Request metrics buffer is full, dropping telemetry message.");else{let i={request_id:e,request_duration_ms:t};if(n&&n.length>0)i.usage=n;this._stripe._prevRequestMetrics.push(i)}}_rawRequest(e,t,n,i,r){return new Promise((o,s)=>{try{let a=e.toUpperCase();if(a!=="POST"&&n&&Object.keys(n).length!==0)throw Error("rawRequest only supports params on POST requests. Please pass null and add your parameters to path.");let c=a==="POST"?Object.assign({},n):null,l=fi(i);if(i?.additionalHeaders)Object.assign(l.headers,i.additionalHeaders);let u=l.apiBase||(i?.apiBase??null),m=u?this._stripe.resolveBaseAddress(u):null;this._request(a,m,t,c,l.authenticator,{headers:l.headers,settings:l.settings,streaming:l.streaming},r||["raw_request"],(p,_)=>{if(p)s(p);else o(_)})}catch(a){s(a)}})}_getContentLength(e){return typeof e==="string"?new TextEncoder().encode(e).length:e.length}_request(e,t,n,i,r,o,s=[],a,c=null){let l;r=r??this._stripe._authenticator;let u=bi(n),m=(k,g,y,R)=>setTimeout(k,this._getSleepTimeInMS(R),g,y,R+1),p=(k,g,y)=>{let R=o.settings&&o.settings.timeout&&Number.isInteger(o.settings.timeout)&&o.settings.timeout>=0?o.settings.timeout:this._stripe.getApiField("timeout"),v={host:t||this._stripe.getApiField("host"),port:this._stripe.getApiField("port"),path:n,method:e,headers:Object.assign({},g),body:l,protocol:this._stripe.getApiField("protocol")};if(!r)throw Error("Authenticator was't initialized. Please pass an API Key or an Authenticator when initializing StripeClient.");r(v).then(()=>{let x=this._stripe.getApiField("httpClient").makeRequest(v.host,v.port,v.path,v.method,v.headers,v.body,v.protocol,R),P=Date.now(),U=_i({api_version:k,account:gi(g["Stripe-Account"]),idempotency_key:gi(g["Idempotency-Key"]),method:e,path:n,body:this._stripe.getEmitEventBodiesEnabled()?i??void 0:void 0,request_start_time:P}),X=y||0,oi=this._getMaxNetworkRetries(o.settings||{});this._stripe._emitter.emit("request",U),x.then((O)=>{if(re._shouldRetry(O,X,oi))return m(p,k,g,X);else if(o.streaming&&O.getStatusCode()<400)return this._streamingResponseHandler(U,s,a)(O);else return this._jsonResponseHandler(U,u,s,a)(O)}).catch((O)=>{if(re._shouldRetry(null,X,oi,O))return m(p,k,g,X);else{let de=O.code&&O.code===q.TIMEOUT_ERROR_CODE;return a(new wi({message:de?`Request aborted due to timeout being reached (${R}ms)`:re._generateConnectionErrorMessage(X),detail:O}))}})}).catch((x)=>{throw new j({message:"Unable to authenticate the request",exception:x})})},_=(k,g)=>{if(k)return a(k);l=g,this._stripe.getClientUserAgent((y)=>{let R=this._stripe.getApiField("version"),v=this._makeHeaders({contentType:u=="v2"?"application/json":"application/x-www-form-urlencoded",contentLength:this._getContentLength(g),apiVersion:R,clientUserAgent:y,method:e,userSuppliedHeaders:o.headers??null,userSuppliedSettings:o.settings??{},stripeAccount:o.stripeAccount??this._stripe.getApiField("stripeAccount"),stripeContext:this._normalizeStripeContext(o.stripeContext,this._stripe.getApiField("stripeContext")),apiMode:u});p(R,v,0)})};if(c)c(e,i,o.headers,_);else{let k;if(u=="v2")k=i?fl(i):"";else k=z(i||{});_(null,k)}}}var Tl=f(()=>{xi();hi();W()});var Se=(e,t)=>{if(e==null)return e;switch(t.kind){case"int64_string":return typeof e==="bigint"||typeof e==="number"?String(e):e;case"decimal_string":return typeof e.toFixed==="function"&&typeof e.isZero==="function"?e.toString():e;case"object":{if(typeof e!=="object"||Array.isArray(e))return e;let n=e,i={};for(let r of Object.keys(n)){let o=t.fields[r];i[r]=o?Se(n[r],o):n[r]}return i}case"array":{if(!Array.isArray(e))return e;return e.map((n)=>Se(n,t.element))}case"nullable":return Se(e,t.inner)}},xe=(e,t)=>{if(e==null)return e;switch(t.kind){case"int64_string":if(typeof e==="string")try{return BigInt(e)}catch{throw Error(`Failed to coerce int64_string value: expected an integer string, got '${e}'`)}return e;case"decimal_string":if(typeof e==="string")try{return M.from(e)}catch{throw Error(`Failed to coerce decimal_string value: expected a decimal string, got '${e}'`)}return e;case"object":{if(typeof e!=="object"||Array.isArray(e))return e;let n=e;for(let i of Object.keys(t.fields))if(i in n)n[i]=xe(n[i],t.fields[i]);return n}case"array":{if(!Array.isArray(e))return e;for(let n=0;n<e.length;n++)e[n]=xe(e[n],t.element);return e}case"nullable":return xe(e,t.inner)}};var wl=f(()=>{Ri()});class Er{constructor(e,t,n,i,r,o,s){this.index=0,this.pagePromise=e,this.promiseCache={currentPromise:null},this.params=t,this.options=n,this.method=i,this.path=r,this.spec=o,this.stripeResource=s}async iterate(e){if(!(e&&e.data&&typeof e.data.length==="number"))throw Error("Unexpected: Stripe API response does not have a well-formed `data` array.");let t=!!this.params.ending_before;if(this.index<e.data.length){let n=t?e.data.length-1-this.index:this.index,i=e.data[n];return this.index+=1,{value:i,done:!1}}else if(e.has_more){this.index=0,this.pagePromise=this.getNextPage(e);let n=await this.pagePromise;return this.iterate(n)}return{done:!0,value:void 0}}getNextPage(e){throw Error("Unimplemented")}async _next(){return this.iterate(await this.pagePromise)}next(){if(this.promiseCache.currentPromise)return this.promiseCache.currentPromise;let e=(async()=>{let t=await this._next();return this.promiseCache.currentPromise=null,t})();return this.promiseCache.currentPromise=e,e}}class xl{constructor(e,t,n,i){this.firstPagePromise=e,this.currentPageIterator=null,this.nextPageUrl=null,this.promiseCache={currentPromise:null},this.options=t,this.spec=n,this.stripeResource=i}async initFirstPage(){if(this.firstPagePromise){let e=await this.firstPagePromise;this.firstPagePromise=null,this.currentPageIterator=e.data[Symbol.iterator](),this.nextPageUrl=e.next_page_url||null}}async turnPage(){if(!this.nextPageUrl)return null;let e=await this.stripeResource._makeRequest("GET",this.nextPageUrl,void 0,this.options,this.spec);return this.nextPageUrl=e.next_page_url||null,this.currentPageIterator=e.data[Symbol.iterator](),this.currentPageIterator}async _next(){if(await this.initFirstPage(),this.currentPageIterator){let e=this.currentPageIterator.next();if(!e.done)return{done:!1,value:e.value}}return this.nextFromNewPage()}async nextFromNewPage(){let e=await this.turnPage();if(!e)return{done:!0,value:void 0};let t=e.next();if(!t.done)return{done:!1,value:t.value};return this.nextFromNewPage()}next(){if(this.promiseCache.currentPromise)return this.promiseCache.currentPromise;let e=(async()=>{try{return await this._next()}finally{this.promiseCache.currentPromise=null}})();return this.promiseCache.currentPromise=e,e}}function Hd(){if(typeof Symbol<"u"&&Symbol.asyncIterator)return Symbol.asyncIterator;return"@@asyncIterator"}function Vd(e){if(e.length<2)return null;let t=e[1];if(typeof t!=="function")throw Error(`The second argument to autoPagingEach, if present, must be a callback function; received ${typeof t}`);return t}function zd(e){if(e.length===0)return;let t=e[0];if(typeof t!=="function")throw Error(`The first argument to autoPagingEach, if present, must be a callback function; received ${typeof t}`);if(t.length===2)return t;if(t.length>2)throw Error(`The \`onItem\` callback function passed to autoPagingEach must accept at most two arguments; got ${t}`);return function(i,r){let o=t(i);r(o)}}function Wd(e,t){let n=t?0:e.data.length-1,i=e.data[n],r=i&&i.id;if(!r)throw Error("Unexpected: No `id` found on the last item while auto-paging a list.");return r}function Qd(e){return function(){let n=Error().stack,i=[].slice.call(arguments),r=zd(i),o=Vd(i);if(i.length>2)throw Error(`autoPagingEach takes up to two arguments; received ${i}`);let s=Xd(e,r).catch((a)=>{throw ge(a,n),a});if(o)s.then(()=>o(),(a)=>o(a));return s}}function Jd(e){return function(n,i){let r=Error().stack,o=n&&n.limit;if(!o)throw Error("You must pass a `limit` option to autoPagingToArray, e.g., `autoPagingToArray({limit: 1000});`.");if(o>1e4)throw Error("You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.");let s=new Promise((a,c)=>{let l=[];e((u)=>{if(l.push(u),l.length>=o)return!1}).then(()=>{a(l)}).catch((u)=>{ge(u,r),c(u)})});if(i)s.then((a)=>i(null,a),(a)=>i(a));return s}}function Xd(e,t){return new Promise((n,i)=>{function r(o){if(o.done){n();return}let s=o.value;return new Promise((a)=>{t(s,a)}).then((a)=>{if(a===!1)return r({done:!0,value:void 0});else return e().then(r)})}e().then(r).catch(i)})}var vl,Sl,Cl=(e,t,n,i,r,o,s)=>{let a=bi(r),c=o?.methodType;if(a!=="v2"&&c==="search")return Pr(new Sl(s,t,n,i,r,o,e));if(a!=="v2"&&c==="list")return Pr(new vl(s,t,n,i,r,o,e));if(a==="v2"&&c==="list")return Pr(new xl(s,n,o,e));return null},Pr=(e)=>{let t=Qd((...r)=>e.next(...r)),n=Jd(t),i={autoPagingEach:t,autoPagingToArray:n,next:()=>e.next(),return:()=>({}),[Hd()]:()=>i};return i};var jl=f(()=>{W();vl=class vl extends Er{getNextPage(e){let t=!!this.params.ending_before,n=Wd(e,t),i={...this.params,[t?"ending_before":"starting_after"]:n};return this.stripeResource._makeRequest(this.method,this.path,i,this.options,this.spec)}};Sl=class Sl extends Er{getNextPage(e){if(!e.next_page)throw Error("Unexpected: Stripe API response does not have a well-formed `next_page` field, but `has_more` was true.");let t={...this.params,page:e.next_page};return this.stripeResource._makeRequest(this.method,this.path,t,this.options,this.spec)}}});class d{constructor(e,t){if(this.resourcePath="",this.requestDataProcessor=null,this._stripe=e,t)throw Error("Support for curried url params was dropped in stripe-node v7.0.0. Instead, pass two ids.");this.basePath=be(this.basePath||e.getApiField("basePath"));let n=this.path||"";this.resourcePath=n,this.path=be(n),this.initialize(e,t)}initialize(e,t){}_makeRequest(e,t,n,i,r){let o=e.toUpperCase(),a=(r?.encode||((x)=>x))(n?{...n}:{}),c=fi(i),l=c.apiBase||r?.apiBase||null,u=l?this._stripe.resolveBaseAddress(l):null,m=c.streaming||!!r?.streaming,p=Object.assign(c.headers,r?.headers),_=r?.usage||[],k=o==="GET"||o==="DELETE",g=k?null:a,y=k?a:{};try{if(r?.validator)r.validator(a,{headers:p});if(r?.requestSchema&&g)g=Se(g,r.requestSchema)}catch(x){return Promise.reject(x)}let R=Error().stack,v=new Promise((x,P)=>{function U(O,de){if(O)ge(O,R),P(O);else try{if(r?.responseSchema)xe(de,r.responseSchema);x(r?.transformResponseData?r.transformResponseData(de):de)}catch(zc){P(zc)}}let X=Object.keys(y).length===0,oi=[t,X?"":"?",z(y)].join("");this._stripe._requestSender._request(o,u,oi,g,c.authenticator,{headers:p,settings:c.settings,streaming:m},_,U,this.requestDataProcessor?.bind(this))});if(r?.methodType)Object.assign(v,Cl(this,n?{...n}:{},i,o,t,r,v));return v}}var b=f(()=>{W();wl();jl();d.MAX_BUFFERED_REQUEST_METRICS=100});class K{constructor(e=[]){this._segments=[...e]}get segments(){return[...this._segments]}push(e){if(!e)throw Error("Segment cannot be null or undefined");return new K([...this._segments,e])}pop(){if(this._segments.length===0)throw Error("Cannot pop from an empty context");return new K(this._segments.slice(0,-1))}toString(){return this._segments.join("/")}static parse(e){if(!e)return new K([]);return new K(e.split("/"))}}function Pl(e){let t={DEFAULT_TOLERANCE:300,signature:null,constructEvent(u,m,p,_,k,g){try{if(!this.signature)throw Error("ERR: missing signature helper, unable to verify");k=k||c(),this.signature.verifyHeader(u,m,p,_||t.DEFAULT_TOLERANCE,k,g)}catch(R){if(R instanceof Te)R.message+="\nUse `await constructEventAsync(...)` instead of `constructEvent(...)`";throw R}let y=u instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(u)):JSON.parse(u);if(y&&y.object==="v2.core.event")throw Error("You passed an event notification to stripe.webhooks.constructEvent, which expects a webhook payload. Use stripe.parseEventNotification instead.");return y},async constructEventAsync(u,m,p,_,k,g){if(!this.signature)throw Error("ERR: missing signature helper, unable to verify");k=k||c(),await this.signature.verifyHeaderAsync(u,m,p,_||t.DEFAULT_TOLERANCE,k,g);let y=u instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(u)):JSON.parse(u);if(y&&y.object==="v2.core.event")throw Error("You passed an event notification to stripe.webhooks.constructEvent, which expects a webhook payload. Use stripe.parseEventNotificationAsync instead.");return y},generateTestHeaderString:function(u){let m=l(u),p=m.signature||m.cryptoProvider.computeHMACSignature(m.payloadString,m.secret);return m.generateHeaderString(p)},generateTestHeaderStringAsync:async function(u){let m=l(u),p=m.signature||await m.cryptoProvider.computeHMACSignatureAsync(m.payloadString,m.secret);return m.generateHeaderString(p)}},n={EXPECTED_SCHEME:"v1",verifyHeader(u,m,p,_,k,g){let{decodedHeader:y,decodedPayload:R,details:v,suspectPayloadType:x}=r(u,m,this.EXPECTED_SCHEME),P=/\s/.test(p);k=k||c();let U=k.computeHMACSignature(i(R,v),p);return o(R,y,v,U,_||0,x,P,g),!0},async verifyHeaderAsync(u,m,p,_,k,g){let{decodedHeader:y,decodedPayload:R,details:v,suspectPayloadType:x}=r(u,m,this.EXPECTED_SCHEME),P=/\s/.test(p);k=k||c();let U=await k.computeHMACSignatureAsync(i(R,v),p);return o(R,y,v,U,_||0,x,P,g)}};function i(u,m){return`${m.timestamp}.${u}`}function r(u,m,p){if(Array.isArray(m))throw Error("Unexpected: An array was passed as a header, which should not be possible for the stripe-signature header.");if(!u)throw new N(m,u,{message:"No webhook payload was provided."});let _=typeof u!="string"&&!(u instanceof Uint8Array),k=new TextDecoder("utf8"),g=u instanceof Uint8Array?k.decode(u):u;if(m==null||m=="")throw new N(m,u,{message:"No stripe-signature header value was provided."});let y=m instanceof Uint8Array?k.decode(m):m,R=s(y,p);if(!R||R.timestamp===-1)throw new N(y,g,{message:"Unable to extract timestamp and signatures from header"});if(!R.signatures.length)throw new N(y,g,{message:"No signatures found with expected scheme"});return{decodedPayload:g,decodedHeader:y,details:R,suspectPayloadType:_}}function o(u,m,p,_,k,g,y,R){let v=!!p.signatures.filter(e.secureCompare.bind(e,_)).length,x=`
6
+ Learn more about webhook signing and explore webhook integration examples for various frameworks at https://docs.stripe.com/webhooks/signature`,P=y?`
7
7
 
8
- Note: The provided signing secret contains whitespace. This often indicates an extra newline or space is in the value`:"";if(!E){if(T)throw new g(z,H,{message:`Webhook payload must be provided as a string or a Buffer (https://nodejs.org/api/buffer.html) instance representing the _raw_ request body.Payload was provided as a parsed JavaScript object instead.
8
+ Note: The provided signing secret contains whitespace. This often indicates an extra newline or space is in the value`:"";if(!v){if(g)throw new N(m,u,{message:`Webhook payload must be provided as a string or a Buffer (https://nodejs.org/api/buffer.html) instance representing the _raw_ request body.Payload was provided as a parsed JavaScript object instead.
9
9
  Signature verification is impossible without access to the original signed material.
10
- `+P+`
11
- `+I});throw new g(z,H,{message:`No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?
10
+ `+x+`
11
+ `+P});throw new N(m,u,{message:`No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?
12
12
  If a webhook request is being forwarded by a third-party tool, ensure that the exact request body, including JSON formatting and new line style, is preserved.
13
- `+P+`
14
- `+I})}let h=Math.floor((typeof L==="number"?L:Date.now())/1000)-O.timestamp;if(w>0&&h>w)throw new g(z,H,{message:"Timestamp outside the tolerance zone"});return!0}function G(H,z){if(typeof H!=="string")return null;return z=z||X.EXPECTED_SCHEME,H.split(",").reduce((O,F)=>{let w=F.split("=");if(w[0]==="t")O.timestamp=parseInt(w[1],10);if(w[0]===z)O.signatures.push(w[1]);return O},{timestamp:-1,signatures:[]})}let W=null;function V(){if(!W)W=Z.createDefaultCryptoProvider();return W}function B(H){if(!H)throw new k({message:"Options are required"});let z=H.timestamp&&Math.floor(H.timestamp)||Math.floor(Date.now()/1000),O=H.scheme||X.EXPECTED_SCHEME,F=H.cryptoProvider||V(),w=`${z}.${H.payload}`;return{...H,timestamp:z,scheme:O,cryptoProvider:F,payloadString:w,generateHeaderString:(q)=>{return`t=${z},${O}=${q}`}}}return $.signature=X,$}var N5=_(()=>{E8();T8()});var I9="2026-06-24.dahlia";function t2(Z,$){for(let X in $){if(!Object.prototype.hasOwnProperty.call($,X))continue;let J=X[0].toLowerCase()+X.substring(1),Y=new $[X](Z);this[J]=Y}}function C(Z,$){return function(X){return new t2(X,$)}}var P0;var j9=_(()=>{x();P0=class P0 extends K{create(Z,$){return this._makeRequest("POST","/v2/core/account_links",Z,$)}}});var N0;var S9=_(()=>{x();N0=class N0 extends K{create(Z,$){return this._makeRequest("POST","/v2/core/account_tokens",Z,$,{requestSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v2/core/account_tokens/${encodeURIComponent(Z)}`,$,X)}}});var k0;var M9=_(()=>{x();k0=class k0 extends K{list(Z,$){return this._makeRequest("GET","/v1/financial_connections/accounts",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}`,$,X)}disconnect(Z,$,X){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}/disconnect`,$,X)}refresh(Z,$,X){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}/refresh`,$,X)}subscribe(Z,$,X){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}/subscribe`,$,X)}unsubscribe(Z,$,X){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}/unsubscribe`,$,X)}listOwners(Z,$,X){return this._makeRequest("GET",`/v1/financial_connections/accounts/${encodeURIComponent(Z)}/owners`,$,X,{methodType:"list"})}}});var f9;var k5=_(()=>{x();f9=class f9 extends K{list(Z,$,X){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(Z)}/persons`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}})}create(Z,$,X){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(Z)}/persons`,$,X,{requestSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}del(Z,$,X,J){return this._makeRequest("DELETE",`/v2/core/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J)}retrieve(Z,$,X,J){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J,{responseSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}update(Z,$,X,J){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J,{requestSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}}});var y9;var I5=_(()=>{x();y9=class y9 extends K{create(Z,$,X){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(Z)}/person_tokens`,$,X,{requestSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}retrieve(Z,$,X,J){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(Z)}/person_tokens/${encodeURIComponent($)}`,X,J)}}});var I0;var h9=_(()=>{x();k5();I5();I0=class I0 extends K{constructor(Z){super(Z);this.stripe=Z,this.persons=new f9(Z),this.personTokens=new y9(Z)}list(Z,$){return this._makeRequest("GET","/v2/core/accounts",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v2/core/accounts",Z,$,{requestSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}},responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}},responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}close(Z,$,X){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(Z)}/close`,$,X,{responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}}});var j0;var v9=_(()=>{x();j0=class j0 extends K{list(Z,$){return this._makeRequest("GET","/v1/entitlements/active_entitlements",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/entitlements/active_entitlements/${encodeURIComponent(Z)}`,$,X)}}});var S0;var R9=_(()=>{x();S0=class S0 extends K{list(Z,$){return this._makeRequest("GET","/v1/billing/alerts",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/billing/alerts",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/billing/alerts/${encodeURIComponent(Z)}`,$,X)}activate(Z,$,X){return this._makeRequest("POST",`/v1/billing/alerts/${encodeURIComponent(Z)}/activate`,$,X)}archive(Z,$,X){return this._makeRequest("POST",`/v1/billing/alerts/${encodeURIComponent(Z)}/archive`,$,X)}deactivate(Z,$,X){return this._makeRequest("POST",`/v1/billing/alerts/${encodeURIComponent(Z)}/deactivate`,$,X)}}});var M0;var b9=_(()=>{x();M0=class M0 extends K{find(Z,$){return this._makeRequest("GET","/v1/tax/associations/find",Z,$)}}});var f0;var g9=_(()=>{x();f0=class f0 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/authorizations",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/authorizations/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/authorizations/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}approve(Z,$,X){return this._makeRequest("POST",`/v1/issuing/authorizations/${encodeURIComponent(Z)}/approve`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}decline(Z,$,X){return this._makeRequest("POST",`/v1/issuing/authorizations/${encodeURIComponent(Z)}/decline`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}}});var y0;var u9=_(()=>{x();y0=class y0 extends K{create(Z,$){return this._makeRequest("POST","/v1/test_helpers/issuing/authorizations",Z,$,{requestSchema:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}capture(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/capture`,$,X,{requestSchema:{kind:"object",fields:{purchase_details:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}},receipt:{kind:"array",element:{kind:"object",fields:{quantity:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}expire(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/expire`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}finalizeAmount(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/finalize_amount`,$,X,{requestSchema:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}respond(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/fraud_challenges/respond`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}increment(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/increment`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}reverse(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(Z)}/reverse`,$,X,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}}});var h0;var c9=_(()=>{x();h0=class h0 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax/calculations/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/tax/calculations",Z,$)}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/tax/calculations/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list"})}}});var v0;var m9=_(()=>{x();v0=class v0 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/cardholders",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/issuing/cardholders",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/cardholders/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/cardholders/${encodeURIComponent(Z)}`,$,X)}}});var R0;var l9=_(()=>{x();R0=class R0 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/cards",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/issuing/cards",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/cards/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/cards/${encodeURIComponent(Z)}`,$,X)}}});var b0;var d9=_(()=>{x();b0=class b0 extends K{deliverCard(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(Z)}/shipping/deliver`,$,X)}failCard(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(Z)}/shipping/fail`,$,X)}returnCard(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(Z)}/shipping/return`,$,X)}shipCard(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(Z)}/shipping/ship`,$,X)}submitCard(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(Z)}/shipping/submit`,$,X)}}});var g0;var n9=_(()=>{x();g0=class g0 extends K{list(Z,$){return this._makeRequest("GET","/v1/billing_portal/configurations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/billing_portal/configurations",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/billing_portal/configurations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/billing_portal/configurations/${encodeURIComponent(Z)}`,$,X)}}});var u0;var p9=_(()=>{x();u0=class u0 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/terminal/configurations/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/terminal/configurations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/terminal/configurations/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/terminal/configurations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/terminal/configurations",Z,$)}}});var c0;var i9=_(()=>{x();c0=class c0 extends K{create(Z,$){return this._makeRequest("POST","/v1/test_helpers/confirmation_tokens",Z,$)}}});var m0;var r9=_(()=>{x();m0=class m0 extends K{create(Z,$){return this._makeRequest("POST","/v1/terminal/connection_tokens",Z,$)}}});var l0;var t9=_(()=>{x();l0=class l0 extends K{retrieve(Z,$){return this._makeRequest("GET","/v1/billing/credit_balance_summary",Z,$)}}});var d0;var s9=_(()=>{x();d0=class d0 extends K{list(Z,$){return this._makeRequest("GET","/v1/billing/credit_balance_transactions",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/billing/credit_balance_transactions/${encodeURIComponent(Z)}`,$,X)}}});var n0;var o9=_(()=>{x();n0=class n0 extends K{list(Z,$){return this._makeRequest("GET","/v1/billing/credit_grants",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/billing/credit_grants",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/billing/credit_grants/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/billing/credit_grants/${encodeURIComponent(Z)}`,$,X)}expire(Z,$,X){return this._makeRequest("POST",`/v1/billing/credit_grants/${encodeURIComponent(Z)}/expire`,$,X)}voidGrant(Z,$,X){return this._makeRequest("POST",`/v1/billing/credit_grants/${encodeURIComponent(Z)}/void`,$,X)}}});var p0;var a9=_(()=>{x();p0=class p0 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/credit_reversals",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/credit_reversals",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/credit_reversals/${encodeURIComponent(Z)}`,$,X)}}});var i0;var e9=_(()=>{x();i0=class i0 extends K{fundCashBalance(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/customers/${encodeURIComponent(Z)}/fund_cash_balance`,$,X)}}});var r0;var Z1=_(()=>{x();r0=class r0 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/debit_reversals",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/debit_reversals",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/debit_reversals/${encodeURIComponent(Z)}`,$,X)}}});var t0;var $1=_(()=>{x();t0=class t0 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/disputes",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/issuing/disputes",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/disputes/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/disputes/${encodeURIComponent(Z)}`,$,X)}submit(Z,$,X){return this._makeRequest("POST",`/v1/issuing/disputes/${encodeURIComponent(Z)}/submit`,$,X)}}});var s0;var X1=_(()=>{x();s0=class s0 extends K{list(Z,$){return this._makeRequest("GET","/v1/radar/early_fraud_warnings",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/radar/early_fraud_warnings/${encodeURIComponent(Z)}`,$,X)}}});var o0;var J1=_(()=>{x();o0=class o0 extends K{list(Z,$){return this._makeRequest("GET","/v2/core/event_destinations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v2/core/event_destinations",Z,$)}del(Z,$,X){return this._makeRequest("DELETE",`/v2/core/event_destinations/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v2/core/event_destinations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(Z)}`,$,X)}disable(Z,$,X){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(Z)}/disable`,$,X)}enable(Z,$,X){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(Z)}/enable`,$,X)}ping(Z,$,X){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(Z)}/ping`,$,X)}}});var a0;var Y1=_(()=>{x();a0=class a0 extends K{list(Z,$){let X=(J)=>{return{...J,data:J.data.map(this.addFetchRelatedObjectIfNeeded.bind(this))}};return this._makeRequest("GET","/v2/core/events",Z,$,{methodType:"list",transformResponseData:X})}retrieve(Z,$,X){let J=(Y)=>{return this.addFetchRelatedObjectIfNeeded(Y)};return this._makeRequest("GET",`/v2/core/events/${encodeURIComponent(Z)}`,$,X,{transformResponseData:J})}addFetchRelatedObjectIfNeeded(Z){if(!Z.related_object||!Z.related_object.url)return Z;return{...Z,fetchRelatedObject:()=>this._makeRequest("GET",Z.related_object.url,void 0,{stripeContext:Z.context,headers:{"Stripe-Request-Trigger":`event=${Z.id}`}})}}}});var e0;var Q1=_(()=>{x();e0=class e0 extends K{list(Z,$){return this._makeRequest("GET","/v1/entitlements/features",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/entitlements/features",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/entitlements/features/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/entitlements/features/${encodeURIComponent(Z)}`,$,X)}}});var Z4;var G1=_(()=>{x();Z4=class Z4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/financial_accounts",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/financial_accounts",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/financial_accounts/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/treasury/financial_accounts/${encodeURIComponent(Z)}`,$,X)}close(Z,$,X){return this._makeRequest("POST",`/v1/treasury/financial_accounts/${encodeURIComponent(Z)}/close`,$,X)}updateFeatures(Z,$,X){return this._makeRequest("POST",`/v1/treasury/financial_accounts/${encodeURIComponent(Z)}/features`,$,X)}retrieveFeatures(Z,$,X){return this._makeRequest("GET",`/v1/treasury/financial_accounts/${encodeURIComponent(Z)}/features`,$,X)}}});var $4;var W1=_(()=>{x();$4=class $4 extends K{list(Z,$){return this._makeRequest("GET","/v2/commerce/product_catalog/imports",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{status_details:{kind:"object",fields:{processing:{kind:"object",fields:{error_count:{kind:"int64_string"},success_count:{kind:"int64_string"}}},succeeded:{kind:"object",fields:{success_count:{kind:"int64_string"}}},succeeded_with_errors:{kind:"object",fields:{error_count:{kind:"int64_string"},error_file:{kind:"object",fields:{size:{kind:"int64_string"}}},samples:{kind:"array",element:{kind:"object",fields:{row:{kind:"int64_string"}}}},success_count:{kind:"int64_string"}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v2/commerce/product_catalog/imports",Z,$,{responseSchema:{kind:"object",fields:{status_details:{kind:"object",fields:{processing:{kind:"object",fields:{error_count:{kind:"int64_string"},success_count:{kind:"int64_string"}}},succeeded:{kind:"object",fields:{success_count:{kind:"int64_string"}}},succeeded_with_errors:{kind:"object",fields:{error_count:{kind:"int64_string"},error_file:{kind:"object",fields:{size:{kind:"int64_string"}}},samples:{kind:"array",element:{kind:"object",fields:{row:{kind:"int64_string"}}}},success_count:{kind:"int64_string"}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v2/commerce/product_catalog/imports/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{status_details:{kind:"object",fields:{processing:{kind:"object",fields:{error_count:{kind:"int64_string"},success_count:{kind:"int64_string"}}},succeeded:{kind:"object",fields:{success_count:{kind:"int64_string"}}},succeeded_with_errors:{kind:"object",fields:{error_count:{kind:"int64_string"},error_file:{kind:"object",fields:{size:{kind:"int64_string"}}},samples:{kind:"array",element:{kind:"object",fields:{row:{kind:"int64_string"}}}},success_count:{kind:"int64_string"}}}}}}}})}}});var X4;var B1=_(()=>{x();X4=class X4 extends K{fail(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/inbound_transfers/${encodeURIComponent(Z)}/fail`,$,X)}returnInboundTransfer(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/inbound_transfers/${encodeURIComponent(Z)}/return`,$,X)}succeed(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/inbound_transfers/${encodeURIComponent(Z)}/succeed`,$,X)}}});var J4;var V1=_(()=>{x();J4=class J4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/inbound_transfers",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/inbound_transfers",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/inbound_transfers/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/treasury/inbound_transfers/${encodeURIComponent(Z)}/cancel`,$,X)}}});var Y4;var K1=_(()=>{x();Y4=class Y4 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/terminal/locations/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/terminal/locations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/terminal/locations/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/terminal/locations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/terminal/locations",Z,$)}}});var Q4;var H1=_(()=>{x();Q4=class Q4 extends K{create(Z,$){return this._makeRequest("POST","/v1/billing/meter_event_adjustments",Z,$)}}});var G4;var z1=_(()=>{x();G4=class G4 extends K{create(Z,$){return this._makeRequest("POST","/v2/billing/meter_event_adjustments",Z,$)}}});var W4;var O1=_(()=>{x();W4=class W4 extends K{create(Z,$){return this._makeRequest("POST","/v2/billing/meter_event_session",Z,$)}}});var B4;var _1=_(()=>{x();B4=class B4 extends K{create(Z,$){return this._makeRequest("POST","/v2/billing/meter_event_stream",Z,$,{apiBase:"meter_events"})}}});var V4;var F1=_(()=>{x();V4=class V4 extends K{create(Z,$){return this._makeRequest("POST","/v1/billing/meter_events",Z,$)}}});var K4;var w1=_(()=>{x();K4=class K4 extends K{create(Z,$){return this._makeRequest("POST","/v2/billing/meter_events",Z,$)}}});var H4;var x1=_(()=>{x();H4=class H4 extends K{list(Z,$){return this._makeRequest("GET","/v1/billing/meters",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/billing/meters",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/billing/meters/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/billing/meters/${encodeURIComponent(Z)}`,$,X)}deactivate(Z,$,X){return this._makeRequest("POST",`/v1/billing/meters/${encodeURIComponent(Z)}/deactivate`,$,X)}reactivate(Z,$,X){return this._makeRequest("POST",`/v1/billing/meters/${encodeURIComponent(Z)}/reactivate`,$,X)}listEventSummaries(Z,$,X){return this._makeRequest("GET",`/v1/billing/meters/${encodeURIComponent(Z)}/event_summaries`,$,X,{methodType:"list"})}}});var z4;var T1=_(()=>{x();z4=class z4 extends K{create(Z,$){return this._makeRequest("POST","/v1/terminal/onboarding_links",Z,$)}}});var O4;var U1=_(()=>{x();O4=class O4 extends K{list(Z,$){return this._makeRequest("GET","/v1/climate/orders",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/climate/orders",Z,$,{requestSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/climate/orders/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/climate/orders/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}cancel(Z,$,X){return this._makeRequest("POST",`/v1/climate/orders/${encodeURIComponent(Z)}/cancel`,$,X,{responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}}});var _4;var q1=_(()=>{x();_4=class _4 extends K{update(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(Z)}`,$,X)}fail(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(Z)}/fail`,$,X)}post(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(Z)}/post`,$,X)}returnOutboundPayment(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(Z)}/return`,$,X)}}});var F4;var L1=_(()=>{x();F4=class F4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/outbound_payments",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/outbound_payments",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/outbound_payments/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/treasury/outbound_payments/${encodeURIComponent(Z)}/cancel`,$,X)}}});var w4;var D1=_(()=>{x();w4=class w4 extends K{update(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(Z)}`,$,X)}fail(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(Z)}/fail`,$,X)}post(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(Z)}/post`,$,X)}returnOutboundTransfer(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(Z)}/return`,$,X)}}});var x4;var A1=_(()=>{x();x4=class x4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/outbound_transfers",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/treasury/outbound_transfers",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/outbound_transfers/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/treasury/outbound_transfers/${encodeURIComponent(Z)}/cancel`,$,X)}}});var T4;var E1=_(()=>{x();T4=class T4 extends K{create(Z,$){return this._makeRequest("POST","/v1/radar/payment_evaluations",Z,$)}}});var U4;var C1=_(()=>{x();U4=class U4 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/personalization_designs",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/issuing/personalization_designs",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/personalization_designs/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/personalization_designs/${encodeURIComponent(Z)}`,$,X)}}});var q4;var P1=_(()=>{x();q4=class q4 extends K{activate(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/personalization_designs/${encodeURIComponent(Z)}/activate`,$,X)}deactivate(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/personalization_designs/${encodeURIComponent(Z)}/deactivate`,$,X)}reject(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/personalization_designs/${encodeURIComponent(Z)}/reject`,$,X)}}});var L4;var N1=_(()=>{x();L4=class L4 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/physical_bundles",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/physical_bundles/${encodeURIComponent(Z)}`,$,X)}}});var D4;var k1=_(()=>{x();D4=class D4 extends K{list(Z,$){return this._makeRequest("GET","/v1/climate/products",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{metric_tons_available:{kind:"decimal_string"}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/climate/products/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{metric_tons_available:{kind:"decimal_string"}}}})}}});var A4;var I1=_(()=>{x();A4=class A4 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/terminal/readers/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/terminal/readers/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/terminal/readers",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/terminal/readers",Z,$)}cancelAction(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/cancel_action`,$,X)}collectInputs(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/collect_inputs`,$,X)}collectPaymentMethod(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/collect_payment_method`,$,X)}confirmPaymentIntent(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/confirm_payment_intent`,$,X)}processPaymentIntent(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/process_payment_intent`,$,X)}processSetupIntent(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/process_setup_intent`,$,X)}refundPayment(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/refund_payment`,$,X)}setReaderDisplay(Z,$,X){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(Z)}/set_reader_display`,$,X)}}});var E4;var j1=_(()=>{x();E4=class E4 extends K{presentPaymentMethod(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/terminal/readers/${encodeURIComponent(Z)}/present_payment_method`,$,X)}succeedInputCollection(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/terminal/readers/${encodeURIComponent(Z)}/succeed_input_collection`,$,X)}timeoutInputCollection(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/terminal/readers/${encodeURIComponent(Z)}/timeout_input_collection`,$,X)}}});var C4;var S1=_(()=>{x();C4=class C4 extends K{create(Z,$){return this._makeRequest("POST","/v1/test_helpers/treasury/received_credits",Z,$)}}});var P4;var M1=_(()=>{x();P4=class P4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/received_credits",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/received_credits/${encodeURIComponent(Z)}`,$,X)}}});var N4;var f1=_(()=>{x();N4=class N4 extends K{create(Z,$){return this._makeRequest("POST","/v1/test_helpers/treasury/received_debits",Z,$)}}});var k4;var y1=_(()=>{x();k4=class k4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/received_debits",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/received_debits/${encodeURIComponent(Z)}`,$,X)}}});var I4;var h1=_(()=>{x();I4=class I4 extends K{expire(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/refunds/${encodeURIComponent(Z)}/expire`,$,X)}}});var j4;var v1=_(()=>{x();j4=class j4 extends K{list(Z,$){return this._makeRequest("GET","/v1/tax/registrations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/tax/registrations",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax/registrations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/tax/registrations/${encodeURIComponent(Z)}`,$,X)}}});var S4;var R1=_(()=>{x();S4=class S4 extends K{list(Z,$){return this._makeRequest("GET","/v1/reporting/report_runs",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/reporting/report_runs",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/reporting/report_runs/${encodeURIComponent(Z)}`,$,X)}}});var M4;var b1=_(()=>{x();M4=class M4 extends K{list(Z,$){return this._makeRequest("GET","/v1/reporting/report_types",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/reporting/report_types/${encodeURIComponent(Z)}`,$,X)}}});var f4;var g1=_(()=>{x();f4=class f4 extends K{list(Z,$){return this._makeRequest("GET","/v1/forwarding/requests",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/forwarding/requests",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/forwarding/requests/${encodeURIComponent(Z)}`,$,X)}}});var y4;var u1=_(()=>{x();y4=class y4 extends K{list(Z,$){return this._makeRequest("GET","/v1/sigma/scheduled_query_runs",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/sigma/scheduled_query_runs/${encodeURIComponent(Z)}`,$,X)}}});var h4;var c1=_(()=>{x();h4=class h4 extends K{list(Z,$){return this._makeRequest("GET","/v1/apps/secrets",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/apps/secrets",Z,$)}find(Z,$){return this._makeRequest("GET","/v1/apps/secrets/find",Z,$)}deleteWhere(Z,$){return this._makeRequest("POST","/v1/apps/secrets/delete",Z,$)}}});var v4;var m1=_(()=>{x();v4=class v4 extends K{create(Z,$){return this._makeRequest("POST","/v1/billing_portal/sessions",Z,$)}}});var R4;var l1=_(()=>{x();R4=class R4 extends K{list(Z,$){return this._makeRequest("GET","/v1/checkout/sessions",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/checkout/sessions",Z,$,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/checkout/sessions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/checkout/sessions/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}expire(Z,$,X){return this._makeRequest("POST",`/v1/checkout/sessions/${encodeURIComponent(Z)}/expire`,$,X,{responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/checkout/sessions/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var b4;var d1=_(()=>{x();b4=class b4 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/financial_connections/sessions/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/financial_connections/sessions",Z,$)}}});var g4;var n1=_(()=>{x();g4=class g4 extends K{retrieve(Z,$){return this._makeRequest("GET","/v1/tax/settings",Z,$)}update(Z,$){return this._makeRequest("POST","/v1/tax/settings",Z,$)}}});var u4;var p1=_(()=>{x();u4=class u4 extends K{list(Z,$){return this._makeRequest("GET","/v1/climate/suppliers",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/climate/suppliers/${encodeURIComponent(Z)}`,$,X)}}});var c4;var i1=_(()=>{x();c4=class c4 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/test_helpers/test_clocks/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/test_helpers/test_clocks/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/test_helpers/test_clocks",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/test_helpers/test_clocks",Z,$)}advance(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/test_clocks/${encodeURIComponent(Z)}/advance`,$,X)}}});var m4;var r1=_(()=>{x();m4=class m4 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/tokens",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/tokens/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/tokens/${encodeURIComponent(Z)}`,$,X)}}});var l4;var t1=_(()=>{x();l4=class l4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/transaction_entries",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/transaction_entries/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}})}}});var d4;var s1=_(()=>{x();d4=class d4 extends K{list(Z,$){return this._makeRequest("GET","/v1/financial_connections/transactions",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/financial_connections/transactions/${encodeURIComponent(Z)}`,$,X)}}});var n4;var o1=_(()=>{x();n4=class n4 extends K{list(Z,$){return this._makeRequest("GET","/v1/issuing/transactions",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/issuing/transactions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/issuing/transactions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}}});var p4;var a1=_(()=>{x();p4=class p4 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax/transactions/${encodeURIComponent(Z)}`,$,X)}createFromCalculation(Z,$){return this._makeRequest("POST","/v1/tax/transactions/create_from_calculation",Z,$)}createReversal(Z,$){return this._makeRequest("POST","/v1/tax/transactions/create_reversal",Z,$)}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/tax/transactions/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list"})}}});var i4;var e1=_(()=>{x();i4=class i4 extends K{refund(Z,$,X){return this._makeRequest("POST",`/v1/test_helpers/issuing/transactions/${encodeURIComponent(Z)}/refund`,$,X,{responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}createForceCapture(Z,$){return this._makeRequest("POST","/v1/test_helpers/issuing/transactions/create_force_capture",Z,$,{requestSchema:{kind:"object",fields:{purchase_details:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}},receipt:{kind:"array",element:{kind:"object",fields:{quantity:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}createUnlinkedRefund(Z,$){return this._makeRequest("POST","/v1/test_helpers/issuing/transactions/create_unlinked_refund",Z,$,{requestSchema:{kind:"object",fields:{purchase_details:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}},receipt:{kind:"array",element:{kind:"object",fields:{quantity:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}}});var r4;var ZZ=_(()=>{x();r4=class r4 extends K{list(Z,$){return this._makeRequest("GET","/v1/treasury/transactions",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{entries:{kind:"nullable",inner:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/treasury/transactions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{entries:{kind:"nullable",inner:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}}}}}})}}});var t4;var $Z=_(()=>{x();t4=class t4 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/radar/value_list_items/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/radar/value_list_items/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/radar/value_list_items",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/radar/value_list_items",Z,$)}}});var s4;var XZ=_(()=>{x();s4=class s4 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/radar/value_lists/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/radar/value_lists/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/radar/value_lists/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/radar/value_lists",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/radar/value_lists",Z,$)}}});var o4;var JZ=_(()=>{x();o4=class o4 extends K{list(Z,$){return this._makeRequest("GET","/v1/identity/verification_reports",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/identity/verification_reports/${encodeURIComponent(Z)}`,$,X)}}});var a4;var YZ=_(()=>{x();a4=class a4 extends K{list(Z,$){return this._makeRequest("GET","/v1/identity/verification_sessions",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/identity/verification_sessions",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/identity/verification_sessions/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/identity/verification_sessions/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/identity/verification_sessions/${encodeURIComponent(Z)}/cancel`,$,X)}redact(Z,$,X){return this._makeRequest("POST",`/v1/identity/verification_sessions/${encodeURIComponent(Z)}/redact`,$,X)}}});var Y0;var C8=_(()=>{x();Y0=class Y0 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/accounts/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){if(typeof Z==="string")return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}`,$,X);else return this._makeRequest("GET","/v1/account",$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}`,$,X)}retrieveCurrent(Z,$){return this._makeRequest("GET","/v1/account",Z,$)}list(Z,$){return this._makeRequest("GET","/v1/accounts",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/accounts",Z,$)}reject(Z,$,X){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/reject`,$,X)}listCapabilities(Z,$,X){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/capabilities`,$,X,{methodType:"list"})}retrieveCapability(Z,$,X,J){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/capabilities/${encodeURIComponent($)}`,X,J)}updateCapability(Z,$,X,J){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/capabilities/${encodeURIComponent($)}`,X,J)}deleteExternalAccount(Z,$,X,J){return this._makeRequest("DELETE",`/v1/accounts/${encodeURIComponent(Z)}/external_accounts/${encodeURIComponent($)}`,X,J)}retrieveExternalAccount(Z,$,X,J){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/external_accounts/${encodeURIComponent($)}`,X,J)}updateExternalAccount(Z,$,X,J){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/external_accounts/${encodeURIComponent($)}`,X,J)}listExternalAccounts(Z,$,X){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/external_accounts`,$,X,{methodType:"list"})}createExternalAccount(Z,$,X){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/external_accounts`,$,X)}createLoginLink(Z,$,X){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/login_links`,$,X)}deletePerson(Z,$,X,J){return this._makeRequest("DELETE",`/v1/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J)}retrievePerson(Z,$,X,J){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J)}updatePerson(Z,$,X,J){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/persons/${encodeURIComponent($)}`,X,J)}listPersons(Z,$,X){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(Z)}/persons`,$,X,{methodType:"list"})}createPerson(Z,$,X){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(Z)}/persons`,$,X)}}});var e4;var QZ=_(()=>{x();e4=class e4 extends K{create(Z,$){return this._makeRequest("POST","/v1/account_links",Z,$)}}});var Z6;var GZ=_(()=>{x();Z6=class Z6 extends K{create(Z,$){return this._makeRequest("POST","/v1/account_sessions",Z,$)}}});var $6;var WZ=_(()=>{x();$6=class $6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/apple_pay/domains/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/apple_pay/domains/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/apple_pay/domains",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/apple_pay/domains",Z,$)}}});var X6;var BZ=_(()=>{x();X6=class X6 extends K{list(Z,$){return this._makeRequest("GET","/v1/application_fees",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/application_fees/${encodeURIComponent(Z)}`,$,X)}retrieveRefund(Z,$,X,J){return this._makeRequest("GET",`/v1/application_fees/${encodeURIComponent(Z)}/refunds/${encodeURIComponent($)}`,X,J)}updateRefund(Z,$,X,J){return this._makeRequest("POST",`/v1/application_fees/${encodeURIComponent(Z)}/refunds/${encodeURIComponent($)}`,X,J)}listRefunds(Z,$,X){return this._makeRequest("GET",`/v1/application_fees/${encodeURIComponent(Z)}/refunds`,$,X,{methodType:"list"})}createRefund(Z,$,X){return this._makeRequest("POST",`/v1/application_fees/${encodeURIComponent(Z)}/refunds`,$,X)}}});var Q0;var P8=_(()=>{x();Q0=class Q0 extends K{retrieve(Z,$){return this._makeRequest("GET","/v1/balance",Z,$)}}});var J6;var VZ=_(()=>{x();J6=class J6 extends K{retrieve(Z,$){return this._makeRequest("GET","/v1/balance_settings",Z,$)}update(Z,$){return this._makeRequest("POST","/v1/balance_settings",Z,$)}}});var Y6;var KZ=_(()=>{x();Y6=class Y6 extends K{list(Z,$){return this._makeRequest("GET","/v1/balance_transactions",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/balance_transactions/${encodeURIComponent(Z)}`,$,X)}}});var Q6;var HZ=_(()=>{x();Q6=class Q6 extends K{list(Z,$){return this._makeRequest("GET","/v1/charges",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/charges",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/charges/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/charges/${encodeURIComponent(Z)}`,$,X)}search(Z,$){return this._makeRequest("GET","/v1/charges/search",Z,$,{methodType:"search"})}capture(Z,$,X){return this._makeRequest("POST",`/v1/charges/${encodeURIComponent(Z)}/capture`,$,X)}}});var G6;var zZ=_(()=>{x();G6=class G6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/confirmation_tokens/${encodeURIComponent(Z)}`,$,X)}}});var W6;var OZ=_(()=>{x();W6=class W6 extends K{list(Z,$){return this._makeRequest("GET","/v1/country_specs",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/country_specs/${encodeURIComponent(Z)}`,$,X)}}});var B6;var _Z=_(()=>{x();B6=class B6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/coupons/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/coupons/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/coupons/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/coupons",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/coupons",Z,$)}}});var V6;var FZ=_(()=>{x();V6=class V6 extends K{list(Z,$){return this._makeRequest("GET","/v1/credit_notes",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/credit_notes",Z,$,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/credit_notes/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/credit_notes/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}preview(Z,$){return this._makeRequest("GET","/v1/credit_notes/preview",Z,$,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}voidCreditNote(Z,$,X){return this._makeRequest("POST",`/v1/credit_notes/${encodeURIComponent(Z)}/void`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}listPreviewLineItems(Z,$){return this._makeRequest("GET","/v1/credit_notes/preview/lines",Z,$,{methodType:"list",requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/credit_notes/${encodeURIComponent(Z)}/lines`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var K6;var wZ=_(()=>{x();K6=class K6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}deleteDiscount(Z,$,X){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(Z)}/discount`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/customers",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/customers",Z,$,{responseSchema:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/customers/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}})}listBalanceTransactions(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/balance_transactions`,$,X,{methodType:"list"})}createBalanceTransaction(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/balance_transactions`,$,X)}retrieveBalanceTransaction(Z,$,X,J){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/balance_transactions/${encodeURIComponent($)}`,X,J)}updateBalanceTransaction(Z,$,X,J){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/balance_transactions/${encodeURIComponent($)}`,X,J)}retrieveCashBalance(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/cash_balance`,$,X)}updateCashBalance(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/cash_balance`,$,X)}listCashBalanceTransactions(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/cash_balance_transactions`,$,X,{methodType:"list"})}retrieveCashBalanceTransaction(Z,$,X,J){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/cash_balance_transactions/${encodeURIComponent($)}`,X,J)}createFundingInstructions(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/funding_instructions`,$,X)}listPaymentMethods(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/payment_methods`,$,X,{methodType:"list"})}retrievePaymentMethod(Z,$,X,J){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/payment_methods/${encodeURIComponent($)}`,X,J)}listSources(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/sources`,$,X,{methodType:"list"})}createSource(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/sources`,$,X)}retrieveSource(Z,$,X,J){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/sources/${encodeURIComponent($)}`,X,J)}updateSource(Z,$,X,J){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/sources/${encodeURIComponent($)}`,X,J)}deleteSource(Z,$,X,J){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(Z)}/sources/${encodeURIComponent($)}`,X,J)}verifySource(Z,$,X,J){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/sources/${encodeURIComponent($)}/verify`,X,J)}deleteTaxId(Z,$,X,J){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(Z)}/tax_ids/${encodeURIComponent($)}`,X,J)}retrieveTaxId(Z,$,X,J){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/tax_ids/${encodeURIComponent($)}`,X,J)}listTaxIds(Z,$,X){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(Z)}/tax_ids`,$,X,{methodType:"list"})}createTaxId(Z,$,X){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(Z)}/tax_ids`,$,X)}}});var H6;var xZ=_(()=>{x();H6=class H6 extends K{create(Z,$){return this._makeRequest("POST","/v1/customer_sessions",Z,$)}}});var z6;var TZ=_(()=>{x();z6=class z6 extends K{list(Z,$){return this._makeRequest("GET","/v1/disputes",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/disputes/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/disputes/${encodeURIComponent(Z)}`,$,X)}close(Z,$,X){return this._makeRequest("POST",`/v1/disputes/${encodeURIComponent(Z)}/close`,$,X)}}});var O6;var UZ=_(()=>{x();O6=class O6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/ephemeral_keys/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/ephemeral_keys",Z,$,{validator:(X,J)=>{if(!J.headers||!J.headers["Stripe-Version"])throw Error("Passing apiVersion in a separate options hash is required to create an ephemeral key. See https://stripe.com/docs/api/versioning?lang=node")}})}}});var _6;var qZ=_(()=>{x();_6=class _6 extends K{list(Z,$){return this._makeRequest("GET","/v1/events",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/events/${encodeURIComponent(Z)}`,$,X)}}});var F6;var LZ=_(()=>{x();F6=class F6 extends K{list(Z,$){return this._makeRequest("GET","/v1/exchange_rates",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/exchange_rates/${encodeURIComponent(Z)}`,$,X)}}});function j5(Z,$,X,J){if($=$||{},Z!=="POST")return J(null,p($));this._stripe._platformFunctions.tryBufferData($).then((Y)=>{let Q=s2(Z,Y,X);return J(null,Q)}).catch((Y)=>J(Y,null))}var s2=(Z,$,X)=>{let J=(Math.round(Math.random()*10000000000000000)+Math.round(Math.random()*10000000000000000)).toString();X["Content-Type"]=`multipart/form-data; boundary=${J}`;let Y=new TextEncoder,Q=new Uint8Array(0),G=Y.encode(`\r
15
- `);function W(H){let z=Q,O=H instanceof Uint8Array?H:new Uint8Array(Y.encode(H));Q=new Uint8Array(z.length+O.length+2),Q.set(z),Q.set(O,z.length),Q.set(G,Q.length-2)}function V(H){return`"${H.replace(/"|"/g,"%22").replace(/\r\n|\r|\n/g," ")}"`}let B=V5($);for(let H in B){if(!Object.prototype.hasOwnProperty.call(B,H))continue;let z=B[H];if(W(`--${J}`),Object.prototype.hasOwnProperty.call(z,"data")){let O=z;W(`Content-Disposition: form-data; name=${V(H)}; filename=${V(O.name||"blob")}`),W(`Content-Type: ${O.type||"application/octet-stream"}`),W(""),W(O.data)}else W(`Content-Disposition: form-data; name=${V(H)}`),W(""),W(z)}return W(`--${J}--`),Q};var S5=_(()=>{i()});var w6;var DZ=_(()=>{S5();x();w6=class w6 extends K{constructor(){super(...arguments);this.requestDataProcessor=j5}list(Z,$){return this._makeRequest("GET","/v1/files",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/files",Z,$,{headers:{"Content-Type":"multipart/form-data"},apiBase:"files"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/files/${encodeURIComponent(Z)}`,$,X)}}});var x6;var AZ=_(()=>{x();x6=class x6 extends K{list(Z,$){return this._makeRequest("GET","/v1/file_links",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/file_links",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/file_links/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/file_links/${encodeURIComponent(Z)}`,$,X)}}});var T6;var EZ=_(()=>{x();T6=class T6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/invoices/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}list(Z,$){return this._makeRequest("GET","/v1/invoices",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/invoices",Z,$,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/invoices/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}addLines(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/add_lines`,$,X,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}attachPayment(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/attach_payment`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}finalizeInvoice(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/finalize`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}markUncollectible(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/mark_uncollectible`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}pay(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/pay`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}removeLines(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/remove_lines`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}sendInvoice(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/send`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}updateLines(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/update_lines`,$,X,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}voidInvoice(Z,$,X){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/void`,$,X,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}createPreview(Z,$){return this._makeRequest("POST","/v1/invoices/create_preview",Z,$,{requestSchema:{kind:"object",fields:{invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},schedule_details:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}},subscription_details:{kind:"object",fields:{items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/invoices/${encodeURIComponent(Z)}/lines`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}updateLineItem(Z,$,X,J){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(Z)}/lines/${encodeURIComponent($)}`,X,J,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}}});var U6;var CZ=_(()=>{x();U6=class U6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/invoiceitems/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoiceitems/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/invoiceitems/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}list(Z,$){return this._makeRequest("GET","/v1/invoiceitems",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/invoiceitems",Z,$,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}}});var q6;var PZ=_(()=>{x();q6=class q6 extends K{list(Z,$){return this._makeRequest("GET","/v1/invoice_payments",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoice_payments/${encodeURIComponent(Z)}`,$,X)}}});var L6;var NZ=_(()=>{x();L6=class L6 extends K{list(Z,$){return this._makeRequest("GET","/v1/invoice_rendering_templates",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/invoice_rendering_templates/${encodeURIComponent(Z)}`,$,X)}archive(Z,$,X){return this._makeRequest("POST",`/v1/invoice_rendering_templates/${encodeURIComponent(Z)}/archive`,$,X)}unarchive(Z,$,X){return this._makeRequest("POST",`/v1/invoice_rendering_templates/${encodeURIComponent(Z)}/unarchive`,$,X)}}});var D6;var kZ=_(()=>{x();D6=class D6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/mandates/${encodeURIComponent(Z)}`,$,X)}}});var A6;var M5=_(()=>{x();i();A6=class A6 extends K{constructor(){super(...arguments);this.basePath=w0("/")}authorizeUrl(Z,$){Z=Z||{},$=$||{};let X="oauth/authorize";if($.express)X=`express/${X}`;if(!Z.response_type)Z.response_type="code";if(!Z.client_id)Z.client_id=this._stripe.getClientId();if(!Z.scope)Z.scope="read_write";return`https://${this._stripe.resolveBaseAddress("connect")}/${X}?${p(Z)}`}token(Z,$){return this._makeRequest("POST","/oauth/token",Z,$,{apiBase:"connect"})}deauthorize(Z,$){if(!Z.client_id)Z.client_id=this._stripe.getClientId();return this._makeRequest("POST","/oauth/deauthorize",Z,$,{apiBase:"connect"})}}});var E6;var IZ=_(()=>{x();E6=class E6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_attempt_records",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_attempt_records/${encodeURIComponent(Z)}`,$,X)}}});var C6;var jZ=_(()=>{x();C6=class C6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_intents",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_intents",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_intents/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}`,$,X)}search(Z,$){return this._makeRequest("GET","/v1/payment_intents/search",Z,$,{methodType:"search"})}applyCustomerBalance(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/apply_customer_balance`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/cancel`,$,X)}capture(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/capture`,$,X)}confirm(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/confirm`,$,X)}incrementAuthorization(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/increment_authorization`,$,X)}verifyMicrodeposits(Z,$,X){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(Z)}/verify_microdeposits`,$,X)}listAmountDetailsLineItems(Z,$,X){return this._makeRequest("GET",`/v1/payment_intents/${encodeURIComponent(Z)}/amount_details_line_items`,$,X,{methodType:"list"})}}});var P6;var SZ=_(()=>{x();P6=class P6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_links",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/payment_links",Z,$,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_links/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_links/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/payment_links/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var N6;var MZ=_(()=>{x();N6=class N6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_methods",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_methods",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_methods/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(Z)}`,$,X)}attach(Z,$,X){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(Z)}/attach`,$,X)}detach(Z,$,X){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(Z)}/detach`,$,X)}}});var k6;var fZ=_(()=>{x();k6=class k6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_method_configurations",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_method_configurations",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_method_configurations/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_method_configurations/${encodeURIComponent(Z)}`,$,X)}}});var I6;var yZ=_(()=>{x();I6=class I6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payment_method_domains",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payment_method_domains",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_method_domains/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payment_method_domains/${encodeURIComponent(Z)}`,$,X)}validate(Z,$,X){return this._makeRequest("POST",`/v1/payment_method_domains/${encodeURIComponent(Z)}/validate`,$,X)}}});var j6;var hZ=_(()=>{x();j6=class j6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payment_records/${encodeURIComponent(Z)}`,$,X)}reportPaymentAttempt(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt`,$,X)}reportPaymentAttemptCanceled(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_canceled`,$,X)}reportPaymentAttemptFailed(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_failed`,$,X)}reportPaymentAttemptGuaranteed(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_guaranteed`,$,X)}reportPaymentAttemptInformational(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_payment_attempt_informational`,$,X)}reportRefund(Z,$,X){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(Z)}/report_refund`,$,X)}reportPayment(Z,$){return this._makeRequest("POST","/v1/payment_records/report_payment",Z,$)}}});var S6;var vZ=_(()=>{x();S6=class S6 extends K{list(Z,$){return this._makeRequest("GET","/v1/payouts",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/payouts",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/payouts/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(Z)}/cancel`,$,X)}reverse(Z,$,X){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(Z)}/reverse`,$,X)}}});var M6;var RZ=_(()=>{x();M6=class M6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/plans/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/plans/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/plans/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}list(Z,$){return this._makeRequest("GET","/v1/plans",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/plans",Z,$,{requestSchema:{kind:"object",fields:{amount_decimal:{kind:"decimal_string"},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var f6;var bZ=_(()=>{x();f6=class f6 extends K{list(Z,$){return this._makeRequest("GET","/v1/prices",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/prices",Z,$,{requestSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/prices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/prices/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}search(Z,$){return this._makeRequest("GET","/v1/prices/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var y6;var gZ=_(()=>{x();y6=class y6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/products/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/products/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/products",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/products",Z,$,{requestSchema:{kind:"object",fields:{default_price_data:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/products/search",Z,$,{methodType:"search"})}deleteFeature(Z,$,X,J){return this._makeRequest("DELETE",`/v1/products/${encodeURIComponent(Z)}/features/${encodeURIComponent($)}`,X,J)}retrieveFeature(Z,$,X,J){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(Z)}/features/${encodeURIComponent($)}`,X,J)}listFeatures(Z,$,X){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(Z)}/features`,$,X,{methodType:"list"})}createFeature(Z,$,X){return this._makeRequest("POST",`/v1/products/${encodeURIComponent(Z)}/features`,$,X)}}});var h6;var uZ=_(()=>{x();h6=class h6 extends K{list(Z,$){return this._makeRequest("GET","/v1/promotion_codes",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/promotion_codes",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/promotion_codes/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/promotion_codes/${encodeURIComponent(Z)}`,$,X)}}});var v6;var cZ=_(()=>{x();v6=class v6 extends K{list(Z,$){return this._makeRequest("GET","/v1/quotes",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/quotes",Z,$,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}accept(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}/accept`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}cancel(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}/cancel`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}finalizeQuote(Z,$,X){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(Z)}/finalize`,$,X,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}pdf(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}/pdf`,$,X,{apiBase:"files",streaming:!0})}listComputedUpfrontLineItems(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}/computed_upfront_line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}listLineItems(Z,$,X){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(Z)}/line_items`,$,X,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var R6;var mZ=_(()=>{x();R6=class R6 extends K{list(Z,$){return this._makeRequest("GET","/v1/refunds",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/refunds",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/refunds/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/refunds/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/refunds/${encodeURIComponent(Z)}/cancel`,$,X)}}});var b6;var lZ=_(()=>{x();b6=class b6 extends K{list(Z,$){return this._makeRequest("GET","/v1/reviews",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/reviews/${encodeURIComponent(Z)}`,$,X)}approve(Z,$,X){return this._makeRequest("POST",`/v1/reviews/${encodeURIComponent(Z)}/approve`,$,X)}}});var g6;var dZ=_(()=>{x();g6=class g6 extends K{list(Z,$){return this._makeRequest("GET","/v1/setup_attempts",Z,$,{methodType:"list"})}}});var u6;var nZ=_(()=>{x();u6=class u6 extends K{list(Z,$){return this._makeRequest("GET","/v1/setup_intents",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/setup_intents",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/setup_intents/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}/cancel`,$,X)}confirm(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}/confirm`,$,X)}verifyMicrodeposits(Z,$,X){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(Z)}/verify_microdeposits`,$,X)}}});var c6;var pZ=_(()=>{x();c6=class c6 extends K{list(Z,$){return this._makeRequest("GET","/v1/shipping_rates",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/shipping_rates",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/shipping_rates/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/shipping_rates/${encodeURIComponent(Z)}`,$,X)}}});var m6;var iZ=_(()=>{x();m6=class m6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/sources/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/sources/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/sources",Z,$)}verify(Z,$,X){return this._makeRequest("POST",`/v1/sources/${encodeURIComponent(Z)}/verify`,$,X)}listSourceTransactions(Z,$,X){return this._makeRequest("GET",`/v1/sources/${encodeURIComponent(Z)}/source_transactions`,$,X,{methodType:"list"})}}});var l6;var rZ=_(()=>{x();l6=class l6 extends K{cancel(Z,$,X){return this._makeRequest("DELETE",`/v1/subscriptions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/subscriptions/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}deleteDiscount(Z,$,X){return this._makeRequest("DELETE",`/v1/subscriptions/${encodeURIComponent(Z)}/discount`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/subscriptions",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/subscriptions",Z,$,{requestSchema:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}search(Z,$){return this._makeRequest("GET","/v1/subscriptions/search",Z,$,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}})}migrate(Z,$,X){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(Z)}/migrate`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}resume(Z,$,X){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(Z)}/resume`,$,X,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}}});var d6;var tZ=_(()=>{x();d6=class d6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/subscription_items/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/subscription_items/${encodeURIComponent(Z)}`,$,X,{responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}update(Z,$,X){return this._makeRequest("POST",`/v1/subscription_items/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}list(Z,$){return this._makeRequest("GET","/v1/subscription_items",Z,$,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}create(Z,$){return this._makeRequest("POST","/v1/subscription_items",Z,$,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}}});var n6;var sZ=_(()=>{x();n6=class n6 extends K{list(Z,$){return this._makeRequest("GET","/v1/subscription_schedules",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/subscription_schedules",Z,$,{requestSchema:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}}})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/subscription_schedules/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(Z)}`,$,X,{requestSchema:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}}})}cancel(Z,$,X){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(Z)}/cancel`,$,X)}release(Z,$,X){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(Z)}/release`,$,X)}}});var p6;var oZ=_(()=>{x();p6=class p6 extends K{list(Z,$){return this._makeRequest("GET","/v1/tax_codes",Z,$,{methodType:"list"})}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax_codes/${encodeURIComponent(Z)}`,$,X)}}});var i6;var aZ=_(()=>{x();i6=class i6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/tax_ids/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax_ids/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/tax_ids",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/tax_ids",Z,$)}}});var r6;var eZ=_(()=>{x();r6=class r6 extends K{list(Z,$){return this._makeRequest("GET","/v1/tax_rates",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/tax_rates",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tax_rates/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/tax_rates/${encodeURIComponent(Z)}`,$,X)}}});var t6;var Z$=_(()=>{x();t6=class t6 extends K{retrieve(Z,$,X){return this._makeRequest("GET",`/v1/tokens/${encodeURIComponent(Z)}`,$,X)}create(Z,$){return this._makeRequest("POST","/v1/tokens",Z,$)}}});var s6;var $$=_(()=>{x();s6=class s6 extends K{list(Z,$){return this._makeRequest("GET","/v1/topups",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/topups",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/topups/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/topups/${encodeURIComponent(Z)}`,$,X)}cancel(Z,$,X){return this._makeRequest("POST",`/v1/topups/${encodeURIComponent(Z)}/cancel`,$,X)}}});var o6;var X$=_(()=>{x();o6=class o6 extends K{list(Z,$){return this._makeRequest("GET","/v1/transfers",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/transfers",Z,$)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(Z)}`,$,X)}listReversals(Z,$,X){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(Z)}/reversals`,$,X,{methodType:"list"})}createReversal(Z,$,X){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(Z)}/reversals`,$,X)}retrieveReversal(Z,$,X,J){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(Z)}/reversals/${encodeURIComponent($)}`,X,J)}updateReversal(Z,$,X,J){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(Z)}/reversals/${encodeURIComponent($)}`,X,J)}}});var a6;var J$=_(()=>{x();a6=class a6 extends K{del(Z,$,X){return this._makeRequest("DELETE",`/v1/webhook_endpoints/${encodeURIComponent(Z)}`,$,X)}retrieve(Z,$,X){return this._makeRequest("GET",`/v1/webhook_endpoints/${encodeURIComponent(Z)}`,$,X)}update(Z,$,X){return this._makeRequest("POST",`/v1/webhook_endpoints/${encodeURIComponent(Z)}`,$,X)}list(Z,$){return this._makeRequest("GET","/v1/webhook_endpoints",Z,$,{methodType:"list"})}create(Z,$){return this._makeRequest("POST","/v1/webhook_endpoints",Z,$)}}});var G0={};j8(G0,{WebhookEndpoints:()=>a6,V2:()=>_X,Treasury:()=>OX,Transfers:()=>o6,Topups:()=>s6,Tokens:()=>t6,TestHelpers:()=>zX,Terminal:()=>HX,TaxRates:()=>r6,TaxIds:()=>i6,TaxCodes:()=>p6,Tax:()=>KX,Subscriptions:()=>l6,SubscriptionSchedules:()=>n6,SubscriptionItems:()=>d6,Sources:()=>m6,Sigma:()=>VX,ShippingRates:()=>c6,SetupIntents:()=>u6,SetupAttempts:()=>g6,Reviews:()=>b6,Reporting:()=>BX,Refunds:()=>R6,Radar:()=>WX,Quotes:()=>v6,PromotionCodes:()=>h6,Products:()=>y6,Prices:()=>f6,Plans:()=>M6,Payouts:()=>S6,PaymentRecords:()=>j6,PaymentMethods:()=>N6,PaymentMethodDomains:()=>I6,PaymentMethodConfigurations:()=>k6,PaymentLinks:()=>P6,PaymentIntents:()=>C6,PaymentAttemptRecords:()=>E6,OAuthResource:()=>A6,Mandates:()=>D6,Issuing:()=>GX,Invoices:()=>T6,InvoiceRenderingTemplates:()=>L6,InvoicePayments:()=>q6,InvoiceItems:()=>U6,Identity:()=>QX,Forwarding:()=>YX,FinancialConnections:()=>JX,Files:()=>w6,FileLinks:()=>x6,ExchangeRates:()=>F6,Events:()=>_6,EphemeralKeys:()=>O6,Entitlements:()=>XX,Disputes:()=>z6,Customers:()=>K6,CustomerSessions:()=>H6,CreditNotes:()=>V6,Coupons:()=>B6,CountrySpecs:()=>W6,ConfirmationTokens:()=>G6,Climate:()=>$X,Checkout:()=>ZX,Charges:()=>Q6,BillingPortal:()=>e2,Billing:()=>a2,Balances:()=>Q0,BalanceTransactions:()=>Y6,BalanceSettings:()=>J6,Balance:()=>Q0,Apps:()=>o2,ApplicationFees:()=>X6,ApplePayDomains:()=>$6,Accounts:()=>Y0,AccountSessions:()=>Z6,AccountLinks:()=>e4,Account:()=>Y0});var o2,a2,e2,ZX,$X,XX,JX,YX,QX,GX,WX,BX,VX,KX,HX,zX,OX,_X;var Y$=_(()=>{j9();S9();M9();h9();v9();R9();b9();g9();u9();c9();m9();l9();d9();n9();p9();i9();r9();t9();s9();o9();a9();e9();Z1();$1();X1();J1();Y1();Q1();G1();W1();B1();V1();K1();H1();z1();O1();_1();F1();w1();x1();T1();U1();q1();L1();D1();A1();E1();C1();P1();N1();k1();I1();j1();S1();M1();f1();y1();h1();v1();R1();b1();g1();u1();c1();m1();l1();d1();n1();p1();i1();r1();t1();s1();o1();a1();e1();ZZ();$Z();XZ();JZ();YZ();C8();C8();QZ();GZ();WZ();BZ();P8();P8();VZ();KZ();HZ();zZ();OZ();_Z();FZ();wZ();xZ();TZ();UZ();qZ();LZ();DZ();AZ();EZ();CZ();PZ();NZ();kZ();M5();IZ();jZ();SZ();MZ();fZ();yZ();hZ();vZ();RZ();bZ();gZ();uZ();cZ();mZ();lZ();dZ();nZ();pZ();iZ();rZ();tZ();sZ();oZ();aZ();eZ();Z$();$$();X$();J$();o2=C("apps",{Secrets:h4}),a2=C("billing",{Alerts:S0,CreditBalanceSummary:l0,CreditBalanceTransactions:d0,CreditGrants:n0,MeterEventAdjustments:Q4,MeterEvents:V4,Meters:H4}),e2=C("billingPortal",{Configurations:g0,Sessions:v4}),ZX=C("checkout",{Sessions:R4}),$X=C("climate",{Orders:O4,Products:D4,Suppliers:u4}),XX=C("entitlements",{ActiveEntitlements:j0,Features:e0}),JX=C("financialConnections",{Accounts:k0,Sessions:b4,Transactions:d4}),YX=C("forwarding",{Requests:f4}),QX=C("identity",{VerificationReports:o4,VerificationSessions:a4}),GX=C("issuing",{Authorizations:f0,Cardholders:v0,Cards:R0,Disputes:t0,PersonalizationDesigns:U4,PhysicalBundles:L4,Tokens:m4,Transactions:n4}),WX=C("radar",{EarlyFraudWarnings:s0,PaymentEvaluations:T4,ValueListItems:t4,ValueLists:s4}),BX=C("reporting",{ReportRuns:S4,ReportTypes:M4}),VX=C("sigma",{ScheduledQueryRuns:y4}),KX=C("tax",{Associations:M0,Calculations:h0,Registrations:j4,Settings:g4,Transactions:p4}),HX=C("terminal",{Configurations:u0,ConnectionTokens:m0,Locations:Y4,OnboardingLinks:z4,Readers:A4}),zX=C("testHelpers",{ConfirmationTokens:c0,Customers:i0,Refunds:I4,TestClocks:c4,Issuing:C("issuing",{Authorizations:y0,Cards:b0,PersonalizationDesigns:q4,Transactions:i4}),Terminal:C("terminal",{Readers:E4}),Treasury:C("treasury",{InboundTransfers:X4,OutboundPayments:_4,OutboundTransfers:w4,ReceivedCredits:C4,ReceivedDebits:N4})}),OX=C("treasury",{CreditReversals:p0,DebitReversals:r0,FinancialAccounts:Z4,InboundTransfers:J4,OutboundPayments:F4,OutboundTransfers:x4,ReceivedCredits:P4,ReceivedDebits:k4,TransactionEntries:l4,Transactions:r4}),_X=C("v2",{Billing:C("billing",{MeterEventAdjustments:G4,MeterEventSession:W4,MeterEventStream:B4,MeterEvents:K4}),Commerce:C("commerce",{ProductCatalog:C("productCatalog",{Imports:$4})}),Core:C("core",{AccountLinks:P0,AccountTokens:N0,Accounts:I0,EventDestinations:o0,Events:a0})})});var f5=_(()=>{U8()});class Q${constructor(Z){this.stripe=Z,this.secrets=new h4(Z)}}var y5=_(()=>{c1()});class G${constructor(Z){this.stripe=Z,this.alerts=new S0(Z),this.creditBalanceSummaries=new l0(Z),this.creditBalanceTransactions=new d0(Z),this.creditGrants=new n0(Z),this.meters=new H4(Z),this.meterEvents=new V4(Z),this.meterEventAdjustments=new Q4(Z)}}var h5=_(()=>{R9();t9();s9();o9();x1();F1();H1()});class W${constructor(Z){this.stripe=Z,this.configurations=new g0(Z),this.sessions=new v4(Z)}}var v5=_(()=>{n9();m1()});class B${constructor(Z){this.stripe=Z,this.sessions=new R4(Z)}}var R5=_(()=>{l1()});class V${constructor(Z){this.stripe=Z,this.orders=new O4(Z),this.products=new D4(Z),this.suppliers=new u4(Z)}}var b5=_(()=>{U1();k1();p1()});class K${constructor(Z){this.stripe=Z,this.activeEntitlements=new j0(Z),this.features=new e0(Z)}}var g5=_(()=>{v9();Q1()});class H${constructor(Z){this.stripe=Z,this.accounts=new k0(Z),this.sessions=new b4(Z),this.transactions=new d4(Z)}}var u5=_(()=>{M9();d1();s1()});class z${constructor(Z){this.stripe=Z,this.requests=new f4(Z)}}var c5=_(()=>{g1()});class O${constructor(Z){this.stripe=Z,this.verificationReports=new o4(Z),this.verificationSessions=new a4(Z)}}var m5=_(()=>{JZ();YZ()});class _${constructor(Z){this.stripe=Z,this.authorizations=new f0(Z),this.cards=new R0(Z),this.cardholders=new v0(Z),this.disputes=new t0(Z),this.personalizationDesigns=new U4(Z),this.physicalBundles=new L4(Z),this.tokens=new m4(Z),this.transactions=new n4(Z)}}var l5=_(()=>{g9();l9();m9();$1();C1();N1();r1();o1()});class F${constructor(Z){this.stripe=Z,this.earlyFraudWarnings=new s0(Z),this.paymentEvaluations=new T4(Z),this.valueLists=new s4(Z),this.valueListItems=new t4(Z)}}var d5=_(()=>{X1();E1();XZ();$Z()});class w${constructor(Z){this.stripe=Z,this.reportRuns=new S4(Z),this.reportTypes=new M4(Z)}}var n5=_(()=>{R1();b1()});class x${constructor(Z){this.stripe=Z,this.scheduledQueryRuns=new y4(Z)}}var p5=_(()=>{u1()});class T${constructor(Z){this.stripe=Z,this.associations=new M0(Z),this.calculations=new h0(Z),this.registrations=new j4(Z),this.settings=new g4(Z),this.transactions=new p4(Z)}}var i5=_(()=>{b9();c9();v1();n1();a1()});class U${constructor(Z){this.stripe=Z,this.configurations=new u0(Z),this.connectionTokens=new m0(Z),this.locations=new Y4(Z),this.onboardingLinks=new z4(Z),this.readers=new A4(Z)}}var r5=_(()=>{p9();r9();K1();T1();I1()});class q${constructor(Z){this.stripe=Z,this.authorizations=new y0(Z),this.cards=new b0(Z),this.personalizationDesigns=new q4(Z),this.transactions=new i4(Z)}}var t5=_(()=>{u9();d9();P1();e1()});class L${constructor(Z){this.stripe=Z,this.readers=new E4(Z)}}var s5=_(()=>{j1()});class D${constructor(Z){this.stripe=Z,this.inboundTransfers=new X4(Z),this.outboundPayments=new _4(Z),this.outboundTransfers=new w4(Z),this.receivedCredits=new C4(Z),this.receivedDebits=new N4(Z)}}var o5=_(()=>{B1();q1();D1();S1();f1()});class A${constructor(Z){this.stripe=Z,this.confirmationTokens=new c0(Z),this.customers=new i0(Z),this.refunds=new I4(Z),this.testClocks=new c4(Z),this.issuing=new q$(Z),this.terminal=new L$(Z),this.treasury=new D$(Z)}}var a5=_(()=>{i9();e9();h1();i1();t5();s5();o5()});class E${constructor(Z){this.stripe=Z,this.creditReversals=new p0(Z),this.debitReversals=new r0(Z),this.financialAccounts=new Z4(Z),this.inboundTransfers=new J4(Z),this.outboundPayments=new F4(Z),this.outboundTransfers=new x4(Z),this.receivedCredits=new P4(Z),this.receivedDebits=new k4(Z),this.transactions=new r4(Z),this.transactionEntries=new l4(Z)}}var e5=_(()=>{a9();Z1();G1();V1();L1();A1();M1();y1();ZZ();t1()});class C${constructor(Z){this.stripe=Z,this.meterEvents=new K4(Z),this.meterEventAdjustments=new G4(Z),this.meterEventSession=new W4(Z),this.meterEventStream=new B4(Z)}}var Z7=_(()=>{w1();z1();O1();_1()});class P${constructor(Z){this.stripe=Z,this.imports=new $4(Z)}}var $7=_(()=>{W1()});class N${constructor(Z){this.stripe=Z,this.productCatalog=new P$(Z)}}var X7=_(()=>{$7()});class k${constructor(Z){this.stripe=Z,this.accounts=new I0(Z),this.accountLinks=new P0(Z),this.accountTokens=new N0(Z),this.events=new a0(Z),this.eventDestinations=new o0(Z)}}var J7=_(()=>{h9();j9();S9();Y1();J1()});class I${constructor(Z){this.stripe=Z,this.billing=new C$(Z),this.commerce=new N$(Z),this.core=new k$(Z)}}var Y7=_(()=>{Z7();X7();J7()});class A{static initialize(Z,$=z7){A._platformFunctions=Z,A._requestSenderFactory=$,A.webhooks=P5(Z),A.createNodeHttpClient=Z.createNodeHttpClient,A.createFetchHttpClient=Z.createFetchHttpClient,A.createNodeCryptoProvider=Z.createNodeCryptoProvider,A.createSubtleCryptoProvider=Z.createSubtleCryptoProvider;let X=Z.getEnv(),J=Z.getRuntimeVersion();A.aiAgent=X?K5(X):"",A.AI_AGENT=A.aiAgent,A.USER_AGENT={bindings_version:A.PACKAGE_VERSION,lang:"node",typescript:!1,...J?{lang_version:J}:{},...A.aiAgent?{ai_agent:A.aiAgent}:{}}}constructor(Z,$={}){this._authenticator=null;let X=this._getPropsFromConfig($);this._platformFunctions=A._platformFunctions,Object.defineProperty(this,"_emitter",{value:this._platformFunctions.createEmitter(),enumerable:!1,configurable:!1,writable:!1}),this.VERSION=A.PACKAGE_VERSION,this.on=this._emitter.on.bind(this._emitter),this.once=this._emitter.once.bind(this._emitter),this.off=this._emitter.removeListener.bind(this._emitter);let J=X.httpAgent||null;this._api={host:X.host||j$,port:X.port||Q7,protocol:X.protocol||"https",basePath:G7,version:X.apiVersion||W7,timeout:_8("timeout",X.timeout,B7),maxNetworkRetries:_8("maxNetworkRetries",X.maxNetworkRetries,2),agent:J,httpClient:X.httpClient||(J?this._platformFunctions.createNodeHttpClient(J):this._platformFunctions.createDefaultHttpClient()),dev:!1,stripeAccount:X.stripeAccount||null,stripeContext:X.stripeContext||null};let Y=X.typescript||!1;if(Y!==A.USER_AGENT.typescript)A.USER_AGENT.typescript=Y;if(X.appInfo)this._setAppInfo(X.appInfo);this._setAuthenticator(Z,X.authenticator||null),this.errors=A8,this.Decimal=v,this.webhooks=A.webhooks,this._prevRequestMetrics=[],this._enableTelemetry=X.telemetry!==!1,this._emitEventBodies=X.emitEventBodies===!0,this._requestSender=A._requestSenderFactory(this),this.accountLinks=new e4(this),this.accountSessions=new Z6(this),this.accounts=new Y0(this),this.applePayDomains=new $6(this),this.applicationFees=new X6(this),this.balance=new Q0(this),this.balanceSettings=new J6(this),this.balanceTransactions=new Y6(this),this.charges=new Q6(this),this.confirmationTokens=new G6(this),this.countrySpecs=new W6(this),this.coupons=new B6(this),this.creditNotes=new V6(this),this.customerSessions=new H6(this),this.customers=new K6(this),this.disputes=new z6(this),this.ephemeralKeys=new O6(this),this.events=new _6(this),this.exchangeRates=new F6(this),this.fileLinks=new x6(this),this.files=new w6(this),this.invoiceItems=new U6(this),this.invoicePayments=new q6(this),this.invoiceRenderingTemplates=new L6(this),this.invoices=new T6(this),this.mandates=new D6(this),this.paymentAttemptRecords=new E6(this),this.paymentIntents=new C6(this),this.paymentLinks=new P6(this),this.paymentMethodConfigurations=new k6(this),this.paymentMethodDomains=new I6(this),this.paymentMethods=new N6(this),this.paymentRecords=new j6(this),this.payouts=new S6(this),this.plans=new M6(this),this.prices=new f6(this),this.products=new y6(this),this.promotionCodes=new h6(this),this.quotes=new v6(this),this.refunds=new R6(this),this.reviews=new b6(this),this.setupAttempts=new g6(this),this.setupIntents=new u6(this),this.shippingRates=new c6(this),this.sources=new m6(this),this.subscriptionItems=new d6(this),this.subscriptionSchedules=new n6(this),this.subscriptions=new l6(this),this.taxCodes=new p6(this),this.taxIds=new i6(this),this.taxRates=new r6(this),this.tokens=new t6(this),this.topups=new s6(this),this.transfers=new o6(this),this.webhookEndpoints=new a6(this),this.apps=new Q$(this),this.billing=new G$(this),this.billingPortal=new W$(this),this.checkout=new B$(this),this.climate=new V$(this),this.entitlements=new K$(this),this.financialConnections=new H$(this),this.forwarding=new z$(this),this.identity=new O$(this),this.issuing=new _$(this),this.radar=new F$(this),this.reporting=new w$(this),this.sigma=new x$(this),this.tax=new T$(this),this.terminal=new U$(this),this.testHelpers=new A$(this),this.treasury=new E$(this),this.v2=new I$(this),this.account=this.accounts,this.oauth=new A6(this)}rawRequest(Z,$,X,J){return this._requestSender._rawRequest(Z,$,X,J)}_setAuthenticator(Z,$){if(Z&&$)throw Error("Can't specify both apiKey and authenticator");if(!Z&&!$)throw Error("Neither apiKey nor config.authenticator provided");this._authenticator=Z?G9(Z):$}_setAppInfo(Z){if(Z&&typeof Z!=="object")throw Error("AppInfo must be an object.");if(Z&&!Z.name)throw Error("AppInfo.name is required");Z=Z||{},this._appInfo=FX.reduce(($,X)=>{if(typeof Z[X]=="string")$=$||{},$[X]=Z[X];return $},{})}setClientId(Z){this._clientId=Z}getClientId(){return this._clientId}getConstant(Z){switch(Z){case"DEFAULT_HOST":return j$;case"DEFAULT_PORT":return Q7;case"DEFAULT_BASE_PATH":return G7;case"DEFAULT_API_VERSION":return W7;case"DEFAULT_TIMEOUT":return B7;case"MAX_NETWORK_RETRY_DELAY_SEC":return V7;case"INITIAL_NETWORK_RETRY_DELAY_SEC":return K7}return A[Z]}resolveBaseAddress(Z){let $=this.getApiField("host");if($!==j$)return $;return Y9[Z]}getMaxNetworkRetries(){return this.getApiField("maxNetworkRetries")}_setApiNumberField(Z,$,X){let J=_8(Z,$,X);this._setApiField(Z,J)}getMaxNetworkRetryDelay(){return V7}getInitialNetworkRetryDelay(){return K7}getClientUserAgent(Z){return this.getClientUserAgentSeeded(A.USER_AGENT,Z)}getClientUserAgentSeeded(Z,$){let X={};for(let Q in Z){if(!Object.prototype.hasOwnProperty.call(Z,Q))continue;X[Q]=encodeURIComponent(Z[Q]??"null")}let J=this._platformFunctions.getPlatformInfo();if(J&&this.getTelemetryEnabled())X.platform=encodeURIComponent(J);else delete X.platform;let Y=this.getApiField("httpClient");if(Y)X.httplib=encodeURIComponent(Y.getClientName());if(this._appInfo)X.application=this._appInfo;if(this.getTelemetryEnabled()){let Q=this._platformFunctions.getTelemetryId();if(Q)X.telemetry_id=Q}$(JSON.stringify(X))}getAppInfoAsString(){if(!this._appInfo)return"";let Z=this._appInfo.name;if(this._appInfo.version)Z+=`/${this._appInfo.version}`;if(this._appInfo.url)Z+=` (${this._appInfo.url})`;return Z}getTelemetryEnabled(){return this._enableTelemetry}getEmitEventBodiesEnabled(){return this._emitEventBodies}_prepResources(){for(let Z in G0){if(!Object.prototype.hasOwnProperty.call(G0,Z))continue;this[B5(Z.replace("Resource",""))]=new G0[Z](this)}}_getPropsFromConfig(Z){if(!Z)return{};let $=typeof Z==="string";if(!(Z===Object(Z)&&!Array.isArray(Z))&&!$)throw Error("Config must either be an object or a string");if($)return{apiVersion:Z};if(Object.keys(Z).filter((Y)=>!H7.includes(Y)).length>0)throw Error(`Config object may only contain the following: ${H7.join(", ")}`);return Z}_setApiField(Z,$){this._api[Z]=$}getApiField(Z){return this._api[Z]}parseEventNotification(Z,$,X,J,Y,Q){if(!this.webhooks.signature)throw Error("ERR: missing signature helper, unable to verify");this.webhooks.signature.verifyHeader(Z,$,X,J||this.webhooks.DEFAULT_TOLERANCE,Y||this._platformFunctions.createDefaultCryptoProvider(),Q);let G=Z instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(Z)):JSON.parse(Z);if(G&&G.object==="event")throw Error("You passed a webhook payload to stripe.parseEventNotification, which expects an event notification. Use stripe.webhooks.constructEvent instead.");if(G.context)G.context=l.parse(G.context);return G.fetchEvent=()=>{return this._requestSender._rawRequest("GET",`/v2/core/events/${G.id}`,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_event"])},G.fetchRelatedObject=()=>{if(!G.related_object)return Promise.resolve(null);return this._requestSender._rawRequest("GET",G.related_object.url,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_related_object"])},G}async parseEventNotificationAsync(Z,$,X,J,Y,Q){if(!this.webhooks.signature)throw Error("ERR: missing signature helper, unable to verify");await this.webhooks.signature.verifyHeaderAsync(Z,$,X,J||this.webhooks.DEFAULT_TOLERANCE,Y||this._platformFunctions.createDefaultCryptoProvider(),Q);let G=Z instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(Z)):JSON.parse(Z);if(G&&G.object==="event")throw Error("You passed a webhook payload to stripe.parseEventNotificationAsync, which expects an event notification. Use stripe.webhooks.constructEventAsync instead.");if(G.context)G.context=l.parse(G.context);return G.fetchEvent=()=>{return this._requestSender._rawRequest("GET",`/v2/core/events/${G.id}`,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_event"])},G.fetchRelatedObject=()=>{if(!G.related_object)return Promise.resolve(null);return this._requestSender._rawRequest("GET",G.related_object.url,void 0,{stripeContext:G.context,headers:{"Stripe-Request-Trigger":`event=${G.id}`}},["fetch_related_object"])},G}}var j$="api.stripe.com",Q7="443",G7="/v1/",W7,B7=80000,V7=5,K7=0.5,FX,H7,z7=(Z)=>new J0(Z,K.MAX_BUFFERED_REQUEST_METRICS);var O7=_(()=>{E8();U5();x();Q9();N5();T8();x8();Y$();i();f5();C8();QZ();GZ();WZ();BZ();P8();VZ();KZ();HZ();zZ();OZ();_Z();FZ();wZ();xZ();TZ();UZ();LZ();DZ();AZ();EZ();CZ();PZ();NZ();kZ();IZ();jZ();SZ();MZ();fZ();yZ();hZ();vZ();RZ();bZ();gZ();uZ();cZ();mZ();lZ();dZ();nZ();pZ();iZ();rZ();tZ();sZ();oZ();aZ();eZ();Z$();$$();X$();J$();y5();h5();v5();R5();b5();g5();u5();c5();m5();l5();d5();n5();p5();i5();r5();a5();e5();Y7();qZ();Y$();W7=I9,FX=["name","version","url","partner_id"],H7=["authenticator","apiVersion","typescript","maxNetworkRetries","httpAgent","httpClient","timeout","host","port","protocol","telemetry","emitEventBodies","appInfo","stripeAccount","stripeContext"];A.PACKAGE_VERSION="22.3.2";A.API_VERSION=I9;A.aiAgent="";A.AI_AGENT="";A.USER_AGENT={bindings_version:A.PACKAGE_VERSION,lang:"node",typescript:!1};A.StripeResource=K;A.resources=G0;A.HttpClient=S;A.HttpClientResponse=T0;A.CryptoProvider=q0;A.StripeContext=l;A.errors=A8;A.Decimal=v;A._requestSenderFactory=z7});var _7={};j8(_7,{default:()=>wX,Stripe:()=>A,Decimal:()=>v});var wX;var F7=_(()=>{T5();U8();O7();A.initialize(new z9);wX=A});import"@stacksjs/validation";import{log as S8}from"@stacksjs/cli";import{db as R$}from"@stacksjs/database";async function r7(Z,$={}){let{olderThanDays:X=30,column:J="created_at",query:Y}=$;try{if(Y){let B=R$.deleteFrom(Z);B=Y(B);let H=await B.execute(),z=Array.isArray(H)?H:[H],O=Number(z[0]?.numDeletedRows??z.length??0);return S8.info(`Pruned ${O} records from ${Z}`),O}let Q=new Date;Q.setDate(Q.getDate()-X);let G=await R$.deleteFrom(Z).where(J,"<",Q.toISOString()).execute(),W=Array.isArray(G)?G:[G],V=Number(W[0]?.numDeletedRows??W.length??0);return S8.info(`Pruned ${V} records from ${Z} older than ${X} days`),V}catch(Q){throw S8.error(`Failed to prune ${Z}:`,Q),Q}}async function UY(Z,$={}){return r7(Z,$)}function qY(Z){if(!Z?.prunable)return null;if(typeof Z.prunable==="boolean")return{olderThanDays:30,column:"created_at"};return Z.prunable}import{createCipheriv as t7,createDecipheriv as s7,createHash as o7,randomBytes as a7}from"crypto";import{log as Q8}from"@stacksjs/logging";var b$="enc:",g$="aes-256-gcm",e7=12,Y8=null;async function u$(){if(Y8)return Y8;let Z=process.env.APP_KEY;if(!Z)try{Z=(await import("@stacksjs/config").catch(()=>null))?.config?.app?.key}catch{}if(!Z)return null;return Y8=o7("sha256").update(Z).digest(),Y8}function K0(Z){return typeof Z==="string"&&Z.startsWith(b$)}async function M8(Z){if(Z==null)return Z;if(K0(Z))return Z;if(typeof Z!=="string")return Z;let $=await u$();if(!$)return Q8.warn("[orm] encrypted attribute: APP_KEY not set - storing value in plaintext"),Z;let X=a7(e7),J=t7(g$,$,X),Y=Buffer.concat([J.update(Z,"utf8"),J.final()]),Q=J.getAuthTag();return`${b$}${X.toString("base64")}:${Q.toString("base64")}:${Y.toString("base64")}`}async function f8(Z){if(Z==null)return Z;if(typeof Z!=="string")return Z;if(!K0(Z))return Z;try{let $=await u$();if(!$)return Q8.warn("[orm] encrypted attribute: APP_KEY not set - cannot decrypt"),null;let[,X,J,Y]=Z.split(":");if(!X||!J||!Y)return Q8.warn("[orm] encrypted attribute: malformed envelope, returning null"),null;let Q=Buffer.from(X,"base64"),G=Buffer.from(J,"base64"),W=Buffer.from(Y,"base64"),V=s7(g$,$,Q);return V.setAuthTag(G),Buffer.concat([V.update(W),V.final()]).toString("utf8")}catch($){return Q8.warn("[orm] encrypted attribute: decrypt failed (key rotation? corrupted ciphertext?)",{error:$}),null}}function y8(Z){let $=Z.attributes;if(!$||typeof $!=="object")return[];let X=[];for(let[J,Y]of Object.entries($))if(Y&&typeof Y==="object"&&Y.encrypted===!0)X.push(J);return X}import{sqlDateTime as Z2}from"@stacksjs/database";import{log as z0}from"@stacksjs/logging";var $2=[/^password$/i,/^password_hash$/i,/^api_key$/i,/_token$/i,/_secret$/i,/^remember_token$/i],m$="model_audits",R8=null;function X2(Z){R8=Z}async function h8(){if(R8!=null)return R8;try{let Z=await import("@stacksjs/router").catch(()=>null);if(!Z)return null;let $=Z.getCurrentRequest;if(typeof $!=="function")return null;let X=$();if(!X)return null;return(X.user??X._user)?.id??null}catch{return null}}function G8(Z){if(!Z||typeof Z!=="object")return null;let $={};for(let[X,J]of Object.entries(Z)){if($2.some((Y)=>Y.test(X)))continue;$[X]=J}return $}function H0(Z){if(!Z||typeof Z!=="object")return null;let $=Z;if($._attributes&&typeof $._attributes==="object")return{...$._attributes};return{...Z}}function J2(Z,$){if(!Z||!$)return{old:Z,next:$};let X={},J={},Y=new Set([...Object.keys(Z),...Object.keys($)]);for(let Q of Y)if(Z[Q]!==$[Q])X[Q]=Z[Q],J[Q]=$[Q];return{old:X,next:J}}async function v8(Z,$=!1){try{let{db:X}=await import("@stacksjs/database");await X.insertInto(m$).values({auditable_type:Z.auditable_type,auditable_id:Z.auditable_id,event:Z.event,old_values:Z.old_values?JSON.stringify(Z.old_values):null,new_values:Z.new_values?JSON.stringify(Z.new_values):null,user_id:Z.user_id,created_at:Z2()}).executeTakeFirst()}catch(X){if(z0.warn(`[orm] audit row write failed for ${Z.auditable_type}#${String(Z.auditable_id)} (${Z.event})`,{error:X}),$)throw X}}function l$(Z){return{async audits($){try{let{db:X}=await import("@stacksjs/database");return(await X.selectFrom(m$).selectAll().where("auditable_type","=",Z).where("auditable_id","=",$).orderBy("created_at","desc").execute()??[]).map((Y)=>({...Y,old_values:typeof Y.old_values==="string"?c$(Y.old_values):Y.old_values,new_values:typeof Y.new_values==="string"?c$(Y.new_values):Y.new_values}))}catch(X){return z0.warn(`[orm] audits() lookup failed for ${Z}#${String($)}`,{error:X}),[]}}}}function c$(Z){try{return JSON.parse(Z)}catch{return Z}}function d$(Z){if(Z&&typeof Z==="object"&&"transactional"in Z)return{transactional:Z.transactional===!0};return{transactional:!1}}function n$(Z,$,X="id",J={}){let Y=J.transactional===!0,Q=Z;if(typeof Z.audits!=="function")Z.audits=l$($).audits;let G=async(H)=>{if(!Y)return await H();let{db:z}=await import("@stacksjs/database");return await z.transaction(async()=>H())},W=Z.create;if(typeof W==="function")Z.create=async function(...H){return await G(async()=>{let z=await W.apply(this,H);try{let O=H0(z),F=O?.[X];if(F!=null){let w=await h8();await v8({auditable_type:$,auditable_id:F,event:"created",old_values:null,new_values:G8(O),user_id:w},Y)}}catch(O){if(z0.warn(`[orm] audit(create) failed for ${$}`,{error:O}),Y)throw O}return z})};let V=Z.update;if(typeof V==="function")Z.update=async function(H,z){return await G(async()=>{let O=Q.find,F=typeof O==="function"?H0(await O.call(Q,H)):null,w=await V.call(this,H,z);try{let T=H0(w)??(typeof O==="function"?H0(await O.call(Q,H)):null),{old:q,next:L}=J2(F,T);if(L&&Object.keys(L).length>0){let E=await h8();await v8({auditable_type:$,auditable_id:H,event:"updated",old_values:G8(q),new_values:G8(L),user_id:E},Y)}}catch(T){if(z0.warn(`[orm] audit(update) failed for ${$}#${String(H)}`,{error:T}),Y)throw T}return w})};let B=(H)=>{let z=Z[H];if(typeof z!=="function")return;Z[H]=async function(O){return await G(async()=>{let F=Q.find,w=typeof F==="function"?H0(await F.call(Q,O)):null,T=await z.call(this,O);try{if(T!==!1&&w){let q=await h8();await v8({auditable_type:$,auditable_id:O,event:"deleted",old_values:G8(w),new_values:null,user_id:q},Y)}}catch(q){if(z0.warn(`[orm] audit(${H}) failed for ${$}#${String(O)}`,{error:q}),Y)throw q}return T})}};B("delete"),B("softDelete")}import{db as Y2,sql as Q2,sqlDateTime as b8}from"@stacksjs/database";function u(Z,$){if(typeof Z!=="number"||!Number.isFinite(Z)||Z<=0)throw Error(`[orm/commentable] ${$} requires a positive numeric id (received ${String(Z)})`)}var O0="commentable_upvotes",_0="commentables";function G2(Z){let $=Z;return $.code==="SQLITE_CONSTRAINT_UNIQUE"||$.code==="SQLITE_CONSTRAINT"||$.code==="23505"||$.errno===1062||/unique|duplicate/i.test($.message??"")}function g8(Z){let $=Y2;return{async comments(X){return u(X,"comments"),await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).selectAll().execute()},async commentCount(X){let J=await $.selectFrom("commentables").select(Q2`count(*) as count`).where("commentables_id","=",X).where("commentables_type","=",Z).executeTakeFirst();return Number(J?.count)||0},async addComment(X,J){if(u(X,"addComment"),!J||typeof J.title!=="string"||J.title.trim().length===0)throw Error("[orm/commentable] addComment requires a non-empty comment.title");if(typeof J.body!=="string"||J.body.trim().length===0)throw Error("[orm/commentable] addComment requires a non-empty comment.body");let Y=await $.insertInto("commentables").values({...J,commentables_id:X,commentables_type:Z,status:"pending",created_at:b8(),updated_at:b8()}).returningAll().executeTakeFirst();if(Y&&typeof Y==="object"&&"id"in Y)return Y;let Q=Y?.lastInsertRowid;if(Q==null)return Y;return await $.selectFrom("commentables").where("id","=",Number(Q)).selectAll().executeTakeFirst()},async approvedComments(X){return await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).where("status","=","approved").selectAll().execute()},async pendingComments(X){return await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).where("status","=","pending").selectAll().execute()},async rejectedComments(X){return await $.selectFrom("commentables").where("commentables_id","=",X).where("commentables_type","=",Z).where("status","=","rejected").selectAll().execute()},async upvoteComment(X,J){u(X,"upvoteComment"),u(J,"upvoteComment");let Y=()=>$.selectFrom(O0).where("upvoteable_id","=",X).where("upvoteable_type","=",_0).where("user_id","=",J).selectAll().executeTakeFirst(),Q=await Y();if(Q)return Q;try{await $.insertInto(O0).values({upvoteable_id:X,upvoteable_type:_0,user_id:J,created_at:b8()}).execute()}catch(G){if(!G2(G))throw G}return await Y()},async removeCommentUpvote(X,J){u(X,"removeCommentUpvote"),u(J,"removeCommentUpvote"),await $.deleteFrom(O0).where("upvoteable_id","=",X).where("upvoteable_type","=",_0).where("user_id","=",J).execute()},async commentUpvoteCount(X){u(X,"commentUpvoteCount");let J=await $.selectFrom(O0).select("count(*) as count").where("upvoteable_id","=",X).where("upvoteable_type","=",_0).executeTakeFirst();return Number(J?.count)||0},async hasUpvotedComment(X,J){return u(X,"hasUpvotedComment"),u(J,"hasUpvotedComment"),!!await $.selectFrom(O0).where("upvoteable_id","=",X).where("upvoteable_type","=",_0).where("user_id","=",J).selectAll().executeTakeFirst()}}}import{db as W2,sql as B2,sqlDateTime as p$}from"@stacksjs/database";function u8(Z,$){if(typeof Z!=="number"||!Number.isFinite(Z)||Z<=0)throw Error(`[orm/taggable] ${$} requires a positive numeric id (received ${String(Z)})`)}function c8(Z){let $=W2;return{async tags(X){return u8(X,"tags"),await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).selectAll().execute()},async tagCount(X){u8(X,"tagCount");let J=await $.selectFrom("taggables").select(B2`count(*) as count`).where("taggable_id","=",X).where("taggable_type","=",Z).executeTakeFirst();return Number(J?.count)||0},async addTag(X,J){if(u8(X,"addTag"),!J||typeof J.name!=="string"||J.name.trim().length===0)throw Error("[orm/taggable] addTag requires a non-empty tag.name");return await $.insertInto("taggables").values({...J,taggable_id:X,taggable_type:Z,slug:J.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),is_active:!0,created_at:p$(),updated_at:p$()}).execute(),await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("name","=",J.name).selectAll().executeTakeFirst()},async activeTags(X){return await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("is_active","=",!0).selectAll().execute()},async inactiveTags(X){return await $.selectFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("is_active","=",!1).selectAll().execute()},async removeTag(X,J){await $.deleteFrom("taggables").where("taggable_id","=",X).where("taggable_type","=",Z).where("id","=",J).execute()}}}import{db as V2,sqlDateTime as W8}from"@stacksjs/database";function m8(Z){let $=V2;async function X(J){return(await $.selectFrom("categorizable_models").where("categorizable_id","=",J).where("categorizable_type","=",Z).selectAll().execute()).map((Q)=>Q.category_id)}return{async categories(J){let Y=await X(J);if(Y.length===0)return[];return await $.selectFrom("categorizables").where("id","in",Y).selectAll().execute()},async categoryCount(J){return(await X(J)).length},async addCategory(J,Y){let Q=()=>$.selectFrom("categorizables").where("name","=",Y.name).where("categorizable_type","=",Z).selectAll().executeTakeFirst(),G=await Q();if(!G)await $.insertInto("categorizables").values({name:Y.name,description:Y.description,slug:Y.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),categorizable_type:Z,is_active:!0,created_at:W8(),updated_at:W8()}).execute(),G=await Q();return await $.insertInto("categorizable_models").values({categorizable_id:J,categorizable_type:Z,category_id:G.id,created_at:W8(),updated_at:W8()}).execute(),G},async activeCategories(J){let Y=await X(J);if(Y.length===0)return[];return await $.selectFrom("categorizables").where("id","in",Y).where("is_active","=",!0).selectAll().execute()},async inactiveCategories(J){let Y=await X(J);if(Y.length===0)return[];return await $.selectFrom("categorizables").where("id","in",Y).where("is_active","=",!1).selectAll().execute()},async removeCategory(J,Y){await $.deleteFrom("categorizable_models").where("categorizable_id","=",J).where("categorizable_type","=",Z).where("category_id","=",Y).execute()}}}import{db as K2,sqlDateTime as H2}from"@stacksjs/database";function l8(Z,$){let X=K2,J=$?.table||`${Z}_likes`,Y=$?.foreignKey||`${Z.replace(/s$/,"")}_id`;return{async likes(Q){return await X.selectFrom(J).where(Y,"=",Q).selectAll().execute()},async likeCount(Q){let G=await X.selectFrom(J).select("count(*) as count").where(Y,"=",Q).executeTakeFirst();return Number(G?.count)||0},async like(Q,G){if(typeof Q!=="number"||!Number.isFinite(Q)||Q<=0)throw Error(`[orm/likeable] like requires a positive numeric id (received ${String(Q)})`);if(typeof G!=="number"||!Number.isFinite(G)||G<=0)throw Error(`[orm/likeable] like requires a positive numeric userId (received ${String(G)})`);let W=H2();try{return await X.insertInto(J).values({[Y]:Q,user_id:G,created_at:W,updated_at:W}).returningAll().executeTakeFirst()}catch(V){let B=V;if(!(B.code==="SQLITE_CONSTRAINT_UNIQUE"||B.code==="SQLITE_CONSTRAINT"||B.code==="23505"||B.errno===1062||/unique|duplicate/i.test(B.message??"")))throw V;let z=await X.selectFrom(J).where(Y,"=",Q).where("user_id","=",G).selectAll().executeTakeFirst();if(z)return z;throw V}},async unlike(Q,G){await X.deleteFrom(J).where(Y,"=",Q).where("user_id","=",G).execute()},async isLiked(Q,G){return!!await X.selectFrom(J).where(Y,"=",Q).where("user_id","=",G).selectAll().executeTakeFirst()},async likedBy(Q){return(await X.selectFrom(J).select([Y]).where("user_id","=",Q).execute()).map((W)=>Number(W[Y])).filter(Boolean)}}}function r$(Z){let $=Z;return $?.code==="SQLITE_CONSTRAINT_UNIQUE"||$?.code==="SQLITE_CONSTRAINT"||$?.code==="23505"||$?.errno===1062||/unique|duplicate/i.test($?.message??"")}function z2(Z,$,X){let J=Z;if(Z instanceof Error&&typeof J.status==="number"&&Number.isInteger(J.status)&&J.status>=400&&J.status<600){let Y={error:Z.message};if(J.details!==void 0)Y.details=J.details;return{status:J.status,body:Y}}if(r$(Z))return{status:409,body:{error:`${$} already exists`}};return{status:500,body:{error:`Failed to ${X} ${$}`,detail:String(Z)}}}function y(Z){return Z.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function O2(Z){let $={};for(let[X,J]of Object.entries(Z))$[y(X)]=J;return $}function vY(Z,$){let X=String($||"").replace(/^\/+|\/+$/g,""),J=String(Z).replace(/^\/+/,"");return`/api/${X?`${X}/`:""}${J}`}function RY(Z){if(!Z)return null;let $=Z.attributes??{};if(Object.prototype.hasOwnProperty.call($,"teamId")||Object.prototype.hasOwnProperty.call($,"team_id"))return"team_id";return Z.belongsTo?.some((X)=>X==="Team")?"team_id":null}function bY(Z,$,X){let J=Object.keys(Z).find((Q)=>y(Q)===y($));if(Array.isArray(X)){if(J===void 0)return{data:Z,error:"Ownership value is required"};if(!X.some((Q)=>String(Q)===String(Z[J])))return{data:Z,error:"Ownership value is not available to this caller"};return{data:{...Z,[$]:Z[J]}}}if(X===null||X===void 0)return{data:Z,error:"Caller has no ownership identity"};let Y={...Z};for(let Q of Object.keys(Y))if(y(Q)===y($))delete Y[Q];return Y[$]=X,{data:Y}}function _2(Z){if(!Z)return[];let $=Object.entries(Z.attributes??{}).filter(([,X])=>X?.fillable===!0).map(([X])=>X);for(let X of Z.belongsTo??[]){if(typeof X!=="string"||!X.trim())continue;let J=y(X.trim()).split("_").filter(Boolean);if(J.length===0)continue;let Y=`${J[0]}${J.slice(1).map((Q)=>`${Q[0]?.toUpperCase()}${Q.slice(1)}`).join("")}Id`;$.push(Y)}return[...new Set($)]}function F2(Z,$){if(!Z||$.length===0)return{};let X={};for(let J of $){if(J in Z){X[J]=Z[J];continue}let Y=y(J);if(Y!==J&&Y in Z)X[J]=Z[Y]}return X}function w2(Z,$){if(Z?.name!=="date"||$ instanceof Date||typeof $!=="string")return $;let X=/^(\d{4})-(\d{2})-(\d{2})$/.exec($);if(!X)return $;let J=Number(X[1]),Y=Number(X[2]),Q=Number(X[3]),G=new Date(Date.UTC(J,Y-1,Q));if(G.getUTCFullYear()!==J||G.getUTCMonth()!==Y-1||G.getUTCDate()!==Q)return $;return G}function gY(Z,$){if(!$.length)return Z;let X={...Z};for(let J of $)delete X[J],delete X[y(J)];return X}function uY(Z,$){if(!Z||$.length===0)return Z;let X={...Z};for(let J of $)delete X[J],delete X[y(J)];return X}var x2=["id","uuid","created_at","updated_at","deleted_at"];function cY(Z,$){let X=new Map;for(let J of[...Object.keys(Z??{}),...x2]){let Y=y(J);if(!/^\w+$/.test(Y))continue;X.set(J,Y),X.set(Y,Y)}for(let J of $)X.delete(J),X.delete(y(J));return X}function mY(Z,$,X){if(!$)return Z;let J=String($).split(",").map((Q)=>Q.trim()).filter(Boolean),Y=Z;for(let Q of J){let G=Q.startsWith("-"),W=G?Q.slice(1):Q;if(!/^\w+$/.test(W))continue;let V=X.get(W);if(!V)continue;Y=Y.orderBy(V,G?"desc":"asc")}return Y}var T2={string:{get:(Z)=>Z!=null?String(Z):null,set:(Z)=>Z!=null?String(Z):null},number:{get:(Z)=>Z!=null?Number(Z):null,set:(Z)=>Z!=null?Number(Z):null},integer:{get:(Z)=>Z!=null?Math.trunc(Number(Z)):null,set:(Z)=>Z!=null?Math.trunc(Number(Z)):null},float:{get:(Z)=>Z!=null?Number.parseFloat(String(Z)):null,set:(Z)=>Z!=null?Number.parseFloat(String(Z)):null},boolean:{get:(Z)=>Z===1||Z==="1"||Z===!0||Z==="true",set:(Z)=>Z===!0||Z===1||Z==="1"||Z==="true"?1:0},json:{get:(Z)=>Z==null?null:typeof Z==="string"?U2(Z):Z,set:(Z)=>Z==null?null:typeof Z==="string"?Z:JSON.stringify(Z)},datetime:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString():Z},date:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString().split("T")[0]:Z},array:{get:(Z)=>Z==null?[]:Array.isArray(Z)?Z:typeof Z==="string"?q2(Z):[],set:(Z)=>Z==null?null:Array.isArray(Z)?JSON.stringify(Z):Z}};function U2(Z){try{return JSON.parse(Z)}catch{return Z}}function q2(Z){try{return JSON.parse(Z)}catch{return[]}}function lY(Z,$,X){if(!Z||typeof Z!=="object"||!$||Object.keys($).length===0)return Z;let J={...Z};for(let[Y,Q]of Object.entries($)){let G=typeof Q==="string"?T2[Q]:Q;if(!G||typeof G[X]!=="function")continue;if(Object.prototype.hasOwnProperty.call(J,Y))J[Y]=G[X](J[Y]);let W=y(Y);if(W!==Y&&Object.prototype.hasOwnProperty.call(J,W))J[W]=G[X](J[W])}return J}function t$(Z,$,X){let J=$?.attributes??{},Y={};for(let[Q,G]of Object.entries(J)){let W=G?.validation?.rule;if(!W||typeof W.validate!=="function")continue;let V=Object.prototype.hasOwnProperty.call(Z,Q);if(!V&&X==="updating")continue;let B=G!==null&&typeof G==="object"&&Object.prototype.hasOwnProperty.call(G,"default"),H=V?Z[Q]:B?G.default:void 0,z=w2(W,H),O=W.validate(z);if(!O?.valid&&Array.isArray(O?.errors)&&O.errors.length>0)Y[Q]=O.errors.map((F)=>G?.validation?.message?.[F?.code]??F?.message??"invalid")}return Object.keys(Y).length===0?{valid:!0}:{valid:!1,errors:Y}}function dY(Z){return Z.replace(/\{[^}]*\}/g,"{}").replace(/:[^/]+/g,"{}")}function d8(Z){if(Array.isArray(Z))return Z.filter(($)=>typeof $==="string"&&$.length>0);return typeof Z==="string"&&Z?[Z]:[]}function nY(Z){let $=typeof Z==="object"&&Z!==null&&"middleware"in Z,X=Z?.middleware;if(!$)return{read:["auth"],write:["auth"],declared:!1};if(X&&typeof X==="object"&&!Array.isArray(X)){let Y=X;return{read:"read"in Y?d8(Y.read):["auth"],write:"write"in Y?d8(Y.write):["auth"],declared:!0}}let J=d8(X);return{read:J,write:J,declared:!0}}var i$=15,L2=100;function pY(Z){let $=Number.parseInt(Z.get("page")||String(1),10),X=Number.isFinite($)?Math.max(1,$):1,J=Number.parseInt(Z.get("per_page")||String(i$),10),Y=Math.min(Number.isFinite(J)?Math.max(1,J):i$,L2);return{page:X,perPage:Y,offset:(X-1)*Y}}function B8(Z,$){let X=new URL(Z.toString());return X.searchParams.set("page",String($)),`${X.pathname}${X.search}`}function D2(Z,$,X,J,Y,Q){let G=($-1)*X,W=J===0,V={page:$,per_page:X,from:W?null:G+1,to:W?null:G+J,has_more_pages:Y,prev_page_url:$>1?B8(Z,$-1):null,next_page_url:Y?B8(Z,$+1):null};if(Q!==void 0&&!Number.isNaN(Q)){let B=Math.max(1,Math.ceil(Q/X));V.total=Q,V.last_page=B,V.first_page_url=B8(Z,1),V.last_page_url=B8(Z,B)}return V}function iY(Z,$,X,J,Y,Q){let{page:G,...W}=D2(Z,$,X,J,Y,Q);return{current_page:G,...W}}import{cacheRequestQuery as A2}from"@stacksjs/router";var V8=new WeakMap;function sY(Z,$){return A2(`batchLoad:${Z.name??"model"}:${String($)}`,async()=>{return new Promise((X,J)=>{let Y=V8.get(Z);if(!Y)Y={keys:[],resolvers:[],scheduled:!1},V8.set(Z,Y);if(Y.keys.push($),Y.resolvers.push({key:$,resolve:X,reject:J}),Y.scheduled)return;Y.scheduled=!0,Promise.resolve().then(async()=>{let Q=V8.get(Z);if(!Q)return;V8.delete(Z);let G=Array.from(new Set(Q.keys));try{let W=typeof Z.findMany==="function"?await Z.findMany(G):await Promise.all(G.map((B)=>Z.find?.(B))),V=new Map;for(let B of W??[]){let H=B?.id;if(H!==void 0)V.set(H,B)}for(let B of Q.resolvers)B.resolve(V.get(B.key))}catch(W){for(let V of Q.resolvers)V.reject(W)}})})})}import{db as ZQ}from"@stacksjs/database";class E2{conditions=[];where(Z,...$){let[X,J]=$,Y=J===void 0?"=":X,Q=J===void 0?X:J;this.addCondition("and","where",Z,Y,Q)}orWhere(Z,...$){let[X,J]=$,Y=J===void 0?"=":X,Q=J===void 0?X:J;this.addCondition("or","where",Z,Y,Q)}whereIn(Z,$){this.conditions.push({type:"and",method:"whereIn",column:Z,values:$})}whereNotIn(Z,$){this.conditions.push({type:"and",method:"whereIn",column:Z,values:$,operator:"not in"})}whereNull(Z){this.conditions.push({type:"and",method:"whereNull",column:Z})}whereNotNull(Z){this.conditions.push({type:"and",method:"whereNotNull",column:Z})}whereBetween(Z,$){this.conditions.push({type:"and",method:"whereBetween",column:Z,range:$})}whereExists(Z){this.conditions.push({type:"and",method:"whereExists",column:"",callback:Z})}addCondition(Z,$,X,J,Y){this.conditions.push({type:Z,method:$,column:X,operator:J,value:Y})}getConditions(){return this.conditions}}import{db as n8,runInTransactionScope as C2}from"@stacksjs/database";async function JQ(Z,$){return await C2(async()=>{return await n8.transaction(Z,$)})}async function YQ(Z){return await n8.savepoint(Z)}function QQ(Z,$){return n8.transactional(Z,$)}import{path as c}from"@stacksjs/path";import{fs as $0,globSync as t8}from"@stacksjs/storage";import{plural as Z5,singular as s$,snakeCase as j}from"@stacksjs/strings";import{isString as K8}from"@stacksjs/validation";function $5(Z){let $=Z.belongsToMany;if(!$)return[];if(Array.isArray($))return $.map((X)=>({relationName:typeof X==="string"?j(X):j(String(X.model)),relation:X}));return Object.entries($).map(([X,J])=>{if(typeof J==="string")return{relationName:X,relation:J};return{relationName:X,relation:{model:J.model,pivotTable:J.table,firstForeignKey:J.foreignKey,secondForeignKey:J.relatedKey}}})}async function HQ(Z){if(typeof Z==="string")Z=(await import(Z)).default;return Z.table??j(Z5(Z?.name||""))}function F0(Z,$){if(Z.name)return Z.name;return c.basename($).replace(/\.ts$/,"")}function b(Z,$){if(Z.table)return Z.table;return j(Z5(F0(Z,$)))}function P2(Z,$){let X=[Z,$];return X.sort(),X.join("_")}function zQ(Z,$){return $ in Z}async function N2(Z,$){let X=[];if(Z.hasOne)for(let J of Z.hasOne)X.push(await p8(J,Z,$,"hasOne"));if(Z.hasMany)for(let J of Z.hasMany)X.push(await p8(J,Z,$,"hasMany"));if(Z.belongsTo)for(let J of Z.belongsTo)X.push(await p8(J,Z,$,"belongsTo"));if(Z.hasOneThrough)for(let J of Z.hasOneThrough)X.push(await a$(J,Z,$,"hasOneThrough"));if(Z.hasManyThrough)for(let J of Z.hasManyThrough)X.push(await a$(J,Z,$,"hasManyThrough"));if(Z.belongsToMany)for(let{relationName:J,relation:Y}of $5(Z))X.push(await I2(Y,Z,$,"belongsToMany",J));if(Z.morphOne)X.push(await e$(Z.morphOne,Z,$,"morphOne"));if(Z.morphMany){let J=Array.isArray(Z.morphMany)?Z.morphMany:[Z.morphMany];for(let Y of J)X.push(await e$(Y,Z,$,"morphMany"))}if(Z.morphTo){let J=Z.morphTo,Y=Array.isArray(J)?J:typeof J==="object"&&J!==null?[J]:[];for(let Q of Y)X.push(k2(Q,Z,$))}if(Z.morphToMany){let J=Array.isArray(Z.morphToMany)?Z.morphToMany:[Z.morphToMany];for(let Y of J)X.push(o$(Y,Z,$,"morphToMany"))}if(Z.morphedByMany){let J=Array.isArray(Z.morphedByMany)?Z.morphedByMany:[Z.morphedByMany];for(let Y of J)X.push(o$(Y,Z,$,"morphedByMany"))}return X}function k2(Z,$,X){let J=Z&&typeof Z==="object"&&Z.name?String(Z.name):`${j(X)}able`,Y=Z?.type||`${J}_type`;return{relationship:"morphTo",model:"",table:"",relationTable:"",foreignKey:Z?.id||`${J}_id`,modelKey:Y,relationName:J,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:"",pivotKey:"",pivotTable:""}}function o$(Z,$,X,J){let Y=typeof Z==="object"&&Z!==null,Q=Y?String(Z.model||""):String(Z),G=Y&&Z.morphName?String(Z.morphName):`${j(X)}able`,W=Y&&Z.pivotTable?String(Z.pivotTable):G,V=Y&&Z.id||`${G}_id`,B=Y&&Z.type||`${G}_type`;return{relationship:J,model:Q,table:"",relationTable:"",foreignKey:V,modelKey:B,relationName:G,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:V,pivotKey:B,pivotTable:W}}async function H8(Z,$){let X=r8(`${$}.ts`),J=r8(`${Z}.ts`),Y=i8(`${Z}.ts`),Q=i8(`${$}.ts`);if(!X&&!Q)throw Error(`Model not found: ${$}`);if(!J&&!Y)throw Error(`Model not found: ${Z}`);let G;try{if($0.existsSync(X))G=(await import(X)).default;else G=(await import(Q)).default}catch(V){throw Error(`Failed to load model: ${$}. Error: ${V?.message||"Unknown error"}`)}let W=$0.existsSync(J)?J:Y;return{modelRelation:G,modelPath:W,modelRelationPath:$0.existsSync(X)?X:Q}}async function a$(Z,$,X,J){let Y="",Q="",G="",W="";if(K8(Z))Y=Z;else Y=Z.model,Q=Z.relationName||"",G=Z.through,W=Z.throughForeignKey||"";let{modelRelation:V,modelPath:B,modelRelationPath:H}=await H8(X,Y),z=b(V,H),O=b($,B),F=j(F0(V,H)),w=j(X);return{relationship:J,model:Y,table:z,relationTable:O,foreignKey:`${w}_id`,modelKey:`${F}_id`,relationName:Q,relationModel:X,throughModel:G,throughForeignKey:W,pivotForeign:`${w}_id`,pivotKey:`${F}_id`,pivotTable:O}}async function I2(Z,$,X,J,Y){let Q="",G="",W="",V=j(X);if(K8(Z))Q=Z;else Q=Z.model,G=Z.pivotTable||"",W=Z.firstForeignKey||`${V}_id`;let{modelRelation:B,modelPath:H,modelRelationPath:z}=await H8(X,Q),O=b(B,z),F=b($,H),w=j(F0(B,z));return{relationship:J,model:Q,table:O,relationTable:F,foreignKey:typeof Z==="string"?`${V}_id`:Z.firstForeignKey||`${V}_id`,modelKey:typeof Z==="string"?`${w}_id`:Z.secondForeignKey||`${w}_id`,relationName:Y,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:W,pivotKey:`${w}_id`,pivotTable:G}}async function e$(Z,$,X,J){let Y="",Q="",G="",W="";if(K8(Z))Y=Z,Q=`${j(X)}able`;else Y=Z.model,Q=Z.morphName||`${j(X)}able`,G=Z.type||`${Q}_type`,W=Z.id||`${Q}_id`;let{modelRelation:V,modelPath:B,modelRelationPath:H}=await H8(X,Y),z=b(V,H),O=b($,B);return{relationship:J,model:Y,table:z,relationTable:O,foreignKey:W||`${Q}_id`,modelKey:G||`${Q}_type`,relationName:Q,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:"",pivotKey:"",pivotTable:O}}async function p8(Z,$,X,J){let Y="",Q="";if(K8(Z))Y=Z;else Y=Z.model,Q=Z.relationName||"";let{modelRelation:G,modelPath:W,modelRelationPath:V}=await H8(X,Y),B=b(G,V),H=b($,W),z=j(F0(G,V)),O=j(X),F={relationship:J,model:Y,table:B,relationTable:H,foreignKey:typeof Z==="string"?`${O}_id`:Z.foreignKey||`${O}_id`,modelKey:`${z}_id`,relationName:Q,relationModel:X,throughModel:"",throughForeignKey:"",pivotForeign:`${O}_id`,pivotKey:`${z}_id`,pivotTable:H};if(J==="belongsTo")F.foreignKey="";return F}function OQ(Z){let $=/belongs/,X=/has/,J=/Through/,Y=/morph/;if(J.test(Z))return"throughType";if($.test(Z))return"belongsType";if(X.test(Z))return"hasType";if(Y.test(Z))return"morphType";return""}function _Q(Z){let $=/One/;if(/Many/.test(Z))return"many";if($.test(Z))return"one";return""}async function FQ(Z,$){let X=[];if("belongsToMany"in Z){for(let{relation:J}of $5(Z)){let Y,Q;if(typeof J==="string")Q=J;else Q=J.model;let G=r8(`${Q}.ts`),W=i8(`${Q}.ts`);if($0.existsSync(G))Y=(await import(G)).default;else Y=(await import(W)).default;let V=b(Y,G),B=b(Z,$),H=typeof J==="object"&&"firstForeignKey"in J?J.firstForeignKey:`${s$(B)}_${Z.primaryKey}`,z=typeof J==="object"&&"secondForeignKey"in J?J.secondForeignKey:`${s$(V)}_${Z.primaryKey}`;X.push({table:(typeof J==="object"&&"pivotTable"in J?J.pivotTable:void 0)??P2(B,V),firstForeignKey:H,secondForeignKey:z})}return X}return[]}async function wQ(Z){let $=t8([c.userModelsPath("*.ts"),c.storagePath("framework/defaults/app/Models/**/*.ts")],{absolute:!0}),X=[];for(let J=0;J<$.length;J++){let Y=$[J],Q=await import(Y);if(Z===Q.default.name)continue;let G=F0(Q,Y),W=await N2(Q.default,G);if(!W.length)continue;let V=W.find((B)=>B.model===Z);if(V)X.push(V)}return X}function xQ(Z){if(Z===void 0)return[];return Object.keys(Z).filter(($)=>{return Z[$]?.hidden===!0})}function TQ(Z){let $=Z.attributes;if($===void 0)return[];return Object.keys($).filter((X)=>{return $[X]?.guarded===!0}).map((X)=>j(X))}function UQ(Z,$){let X=Z.attributes,J=[];if(X===void 0)return[];let Y=typeof Z.traits?.billable==="object"||typeof Z.traits?.billable==="boolean",Q=typeof Z.traits?.useAuth==="object"?Z.traits?.useAuth.usePasskey:!1,G=Z.traits?.useUuid||!1;if(Y)J.push("stripe_id");if(G)J.push("uuid");if(Q)J.push(...["two_factor_secret","public_key"]);let W=$.map((V)=>V.foreignKey).filter((V)=>V);return[...Object.keys(X).filter((V)=>{if(X===void 0)return!1;return X[V]?.fillable===!0}).map((V)=>j(V)),...J,...W]}async function qQ(Z,$){let X=Z.attributes;if(!X)X={};let J=Object.keys(X),Y=[],Q=Bun.file($),G="";try{if(await Q.exists())G=await Q.text()}catch{G=""}let W=/rule:.*$/gm,V;V=W.exec(G);while(V!==null)Y.push(V[0]),V=W.exec(G);return J.map((H,z)=>{let O=X[H],F=null,w=!1,T=!1,q=!1,L=!1;if(O)F=O||null,w=O.unique||!1,T=O.hidden||!1,q=O.fillable||!1;let E=Y[z]??"";return L=(O.validation?.rule).isRequired??!1,{field:H,default:F,unique:w,hidden:T,fillable:q,required:L,fieldArray:j2(E)}})}function j2(Z){let $=Z.split("rule: schema.");if($.length!==2)return null;if(!$[1])$[1]="";let X=$[1].replace(/,/g,"");if(!X)return null;let J=X.split("."),Y=/\(([^)]+)\)/;return J.map((Q)=>{let G=Y.exec(Q),W=G?G[1]:null;return{entity:Q.replace(Y,"").replace(/\(|\)/g,""),charValue:W}})[0]||null}function LQ(Z){let $=Z.fieldArray?.entity;switch($){case"enum":return"string | string[]";case"date":return"Date | string";case"timestamp":return"Date | string";case"datetime":return"Date | string";case"float":return"number";case"double":return"number";case"decimal":return"number";case"integer":return"number";case"bigint":return"number";default:return $}}function i8(Z){let $=c.join(c.storagePath("framework/defaults/app/Models"),"/"),X=c.join($,Z);if($0.existsSync(X))return X;return t8(`${$}**/${Z}`,{absolute:!0})[0]??""}function r8(Z){let $=c.join(c.userModelsPath("/"),"/"),X=c.join($,Z);if($0.existsSync(X))return X;return t8(`${$}**/${Z}`,{absolute:!0})[0]??""}function DQ(Z){let $=typeof Z==="number"?new Date(Z):typeof Z==="string"?new Date(Z):Z;if(Number.isNaN($.getTime()))throw Error(`Invalid date value: ${String(Z)}`);return $.toISOString().replace("T"," ").split(".")[0]??""}function AQ(Z){return Z.toISOString().split("T")[0]??""}function EQ(Z){return Z.getTime()}import{createModel as LX,registerModel as DX}from"@stacksjs/query-builder";import{log as f}from"@stacksjs/logging";import{snakeCase as d}from"@stacksjs/strings";import{AsyncLocalStorage as N7}from"async_hooks";function S2(Z){if(Z===null||typeof Z!=="object")return!1;let $=Z;return Array.isArray($.data)&&typeof $.current_page==="number"&&typeof $.per_page==="number"&&typeof $.total==="number"&&typeof $.last_page==="number"}function M2(Z){if(Z===null||typeof Z!=="object")return!1;let $=Z;return Array.isArray($.data)&&typeof $.current_page==="number"&&typeof $.per_page==="number"&&typeof $.has_more_pages==="boolean"&&!("total"in $)}function f2(Z){if(Z===null||typeof Z!=="object")return!1;let $=Z;return Array.isArray($.data)&&(typeof $.next_cursor==="string"||$.next_cursor===null)}function s8(Z){let{data:$}=Z,{perPage:X,page:J,total:Y,lastPage:Q}=Z.meta,G=$.length===0,W=G?null:(J-1)*X+1,V=G?null:W+$.length-1;return{data:$,current_page:J,per_page:X,total:Y,last_page:Q,from:W,to:V,has_more_pages:J<Q}}function o8(Z){return{data:Z.data,current_page:Z.meta.page,per_page:Z.meta.perPage,has_more_pages:Z.meta.hasMore}}function a8(Z){return{data:Z.data,per_page:Z.meta.perPage,next_cursor:X5(Z.meta.nextCursor),prev_cursor:X5(Z.meta.prevCursor),has_more_pages:Z.meta.nextCursor!==null&&Z.meta.nextCursor!==void 0}}function X5(Z){if(Z===null||Z===void 0)return null;if(typeof Z==="string")return Z;return JSON.stringify(Z)}function Z9(Z,$){let X=J9(),J=X?e8(X,"per_page"):void 0,Y=X?e8(X,"page"):void 0,Q=Z!==void 0?Math.max(1,Math.floor(Z)):Math.min(100,Math.max(1,J??15)),G=Math.max(1,Math.floor($??Y??1));return{perPage:Q,page:G}}function $9(Z,$){let X=J9(),J=X?Y5(X,"cursor"):void 0,Y=X?e8(X,"per_page"):void 0,Q=Z!==void 0?Math.max(1,Math.floor(Z)):Math.min(100,Math.max(1,Y??15)),W=J5($!==void 0?$:J??null);return{perPage:Q,cursor:W}}function J5(Z){if(Z===null||Z===void 0)return null;if(Array.isArray(Z))return Z;if(typeof Z==="string"&&Z.startsWith("["))try{let $=JSON.parse(Z);if(Array.isArray($))return $}catch{}return Z}function X9(Z){let $=J9();if(!$)return Z;let X=(()=>{try{return new URL($.url)}catch{return null}})();if(!X)return Z;let J=X.pathname;if(Z.path=J,"next_cursor"in Z)return Z.next_page_url=Z.next_cursor!==null?o(X,{cursor:Z.next_cursor}):null,Z.prev_page_url=Z.prev_cursor!==null?o(X,{cursor:Z.prev_cursor}):null,Z;let Y=Z.current_page;if(Z.prev_page_url=Y>1?o(X,{page:Y-1}):null,"total"in Z){let Q=Z.last_page;Z.next_page_url=Y<Q?o(X,{page:Y+1}):null,Z.first_page_url=o(X,{page:1}),Z.last_page_url=o(X,{page:Q})}else Z.next_page_url=Z.has_more_pages?o(X,{page:Y+1}):null;return Z}function o(Z,$){let X=new URL(Z.toString());for(let[J,Y]of Object.entries($))X.searchParams.set(J,String(Y));return`${X.pathname}${X.search}`}var X0;function J9(){if(X0===null)return;if(X0===void 0)try{let $=D("@stacksjs/router");if(typeof $.getCurrentRequest==="function")X0=$.getCurrentRequest;else{X0=null;return}}catch{X0=null;return}return X0()}function e8(Z,$){let X=Y5(Z,$);if(X===void 0)return;let J=Number(X);return Number.isFinite(J)?J:void 0}function Y5(Z,$){let X=Z.query?.[$];if(X===void 0)return;return Array.isArray(X)?X[0]:X}import{db as xX}from"@stacksjs/database";function w7(Z){let $=xX;return{async createStripeUser(X,J){let{manageCustomer:Y}=await import("@stacksjs/payments");return await Y.createStripeCustomer(X,J)},async updateStripeUser(X,J){let{manageCustomer:Y}=await import("@stacksjs/payments");return await Y.updateStripeCustomer(X,J)},async deleteStripeUser(X){let{manageCustomer:J}=await import("@stacksjs/payments");return await J.deleteStripeUser(X)},async createOrGetStripeUser(X,J){let{manageCustomer:Y}=await import("@stacksjs/payments");return await Y.createOrGetStripeUser(X,J)},async retrieveStripeUser(X){let{manageCustomer:J}=await import("@stacksjs/payments");return await J.retrieveStripeUser(X)},async defaultPaymentMethod(X){let{managePaymentMethod:J}=await import("@stacksjs/payments");return await J.retrieveDefaultPaymentMethod(X)},async setDefaultPaymentMethod(X,J){let{managePaymentMethod:Y}=await import("@stacksjs/payments");return await Y.setDefaultPaymentMethod(X,J)},async addPaymentMethod(X,J){let{managePaymentMethod:Y}=await import("@stacksjs/payments");return await Y.addPaymentMethod(X,J)},async paymentMethods(X,J){let{managePaymentMethod:Y}=await import("@stacksjs/payments");return await Y.listPaymentMethods(X,J)},async newSubscription(X,J,Y,Q={}){let{manageSubscription:G}=await import("@stacksjs/payments"),W=await G.create(X,J,Y,Q),B=W.latest_invoice?.payment_intent;return{subscription:W,paymentIntent:B}},async updateSubscription(X,J,Y,Q={}){let{manageSubscription:G}=await import("@stacksjs/payments"),W=await G.update(X,J,Y,Q),B=W.latest_invoice?.payment_intent;return{subscription:W,paymentIntent:B}},async cancelSubscription(X,J,Y={}){let{manageSubscription:Q}=await import("@stacksjs/payments");return{subscription:await Q.cancel(J,Y)}},async activeSubscription(X){let{manageSubscription:J}=await import("@stacksjs/payments"),Y=await $.selectFrom("subscriptions").where("user_id","=",X.id).where("provider_status","=","active").selectAll().executeTakeFirst();if(Y){let Q=await J.retrieve(X,Y.provider_id||"");return{subscription:Y,providerSubscription:Q}}return},async checkout(X,J,Y={}){let{manageCheckout:Q,manageCustomer:G}=await import("@stacksjs/payments"),W={};if(Y.enableTax)W.automatic_tax={enabled:!0},delete Y.enableTax;if(Y.allowPromotions)W.allow_promotion_codes=!0,delete Y.allowPromotions;let H={...{mode:"payment",customer:(await G.createOrGetStripeUser(X,{})).id,line_items:J.map((z)=>({price:z.priceId,quantity:z.quantity||1}))},...W,...Y};return await Q.create(X,H)},async createSetupIntent(X,J={}){let{manageSetupIntent:Y}=await import("@stacksjs/payments");return await Y.create(X,J)},async subscriptionHistory(X){let{manageInvoice:J}=await import("@stacksjs/payments");return await J.list(X)},async transactionHistory(X){let{manageTransaction:J}=await import("@stacksjs/payments");return await J.list(X)},async connectAccount(X,J={}){let Y=J.accountColumn||"stripe_account_id",Q=(X._attributes??X)[Y];if(!Q)return null;let G=await e6();try{return await G.accounts.retrieve(Q)}catch{return null}},async createConnectAccount(X,J={}){let Y=J.accountColumn||"stripe_account_id",Q=X._attributes??X,G=Q[Y],W=await e6();if(!G){let{stacksIdempotencyKey:V}=await import("@stacksjs/payments"),B=J.modelTable||Z,H=await W.accounts.create({type:J.type??"express",email:J.email??Q.email,country:J.country??"US",capabilities:J.capabilities??{card_payments:{requested:!0},transfers:{requested:!0}}},{idempotencyKey:V("connect.account.create",B,Q.id)});return G=H.id,await $.updateTable(B).set({[Y]:G}).where("id","=",Number(Q.id)).execute(),H}return await W.accounts.retrieve(G)},async connectOnboardLink(X,J){let Y=J.accountColumn||"stripe_account_id",G=(X._attributes??X)[Y];if(!G)throw Error("connectOnboardLink: model has no Stripe Connect account; call createConnectAccount first");return{url:(await(await e6()).accountLinks.create({account:G,refresh_url:J.refreshUrl,return_url:J.returnUrl,type:J.type??"account_onboarding"})).url,accountId:G}},async syncConnectStatus(X,J={}){let Y=J.accountColumn||"stripe_account_id",Q=J.chargesColumn||"charges_enabled",G=J.payoutsColumn||"payouts_enabled",W=X._attributes??X,V=W[Y];if(!V)return{chargesEnabled:!1,payoutsEnabled:!1};let H=await(await e6()).accounts.retrieve(V),z=!!H.charges_enabled,O=!!H.payouts_enabled,F=J.modelTable||Z;return await $.updateTable(F).set({[Q]:z,[G]:O}).where("id","=",Number(W.id)).execute(),{chargesEnabled:z,payoutsEnabled:O}},async chargeWithSplit(X,J){let Y=await e6(),Q=J.accountColumn||"stripe_account_id",G=X._attributes??X,W=J.connectAccountId||G[Q],V={amount:J.amountCents,currency:J.currency||"usd",automatic_payment_methods:{enabled:!0},metadata:J.metadata};if(W){if(V.transfer_data={destination:W},J.platformFeeCents)V.application_fee_amount=J.platformFeeCents}let{freshIdempotencyKey:B}=await import("@stacksjs/payments");return await Y.paymentIntents.create(V,{idempotencyKey:B("payment_intent.create",G.id,J.amountCents)})}}}async function e6(){let Z=globalThis.process?.env?.STRIPE_SECRET_KEY;if(!Z)throw Error("Stripe Connect: STRIPE_SECRET_KEY not configured");return new(await Promise.resolve().then(() => (F7(),_7))).default(Z,{apiVersion:"2026-06-24.dahlia"})}function x7(){return{async generateTwoFactorForModel(Z){let{generateTwoFactorSecret:$}=await import("@stacksjs/auth"),X=$();await Z.update({two_factor_secret:X})},async verifyTwoFactorCode(Z,$){let X=Z.get("two_factor_secret");if(typeof X!=="string")return!1;let{verifyTwoFactorCode:J,RateLimiter:Y}=await import("@stacksjs/auth"),Q=String(Z.id??Z.get?.("id")??Z.get?.("email")??X),G=`2fa:${Q}`;if(await Y.isRateLimited(G)){let{HttpError:V}=await import("@stacksjs/error-handling");throw new V(429,"Too many verification attempts. Please try again later.")}if(!await J($,X))return await Y.recordFailedAttempt(G),!1;try{let{cache:V}=await import("@stacksjs/cache"),B=`2fa:used:${Q}:${$}`;if(await V.has(B))return await Y.recordFailedAttempt(G),!1;await V.set(B,"1",90)}catch{}return await Y.resetAttempts(G),!0}}}import{sqlDateTime as TX}from"@stacksjs/database";import{log as W0}from"@stacksjs/logging";var N8="deleted_at";function T7(Z,$="id"){return{async softDelete(X){let J=TX(),Y=Z.where($,X);if(typeof Y?.update==="function")return await Y.update({[N8]:J}),!0;return!1},async restore(X){let J=Z.where($,X);if(typeof J?.update==="function")return await J.update({[N8]:null}),!0;return!1},async forceDelete(X){let J=Z.where($,X);if(typeof J?.delete==="function")return await J.delete(),!0;return!1},withTrashed(){return typeof Z.query==="function"?Z.query():Z},onlyTrashed(){let X=typeof Z.query==="function"?Z.query():Z;if(typeof X?.whereNotNull==="function")return X.whereNotNull(N8);return X?.where?.(N8,"!=",null)??X}}}function U7(Z){if(Z===!0||Z==null)return{};if(typeof Z==="object"&&!Array.isArray(Z)){let $=Z;if(Array.isArray($.cascade)){let X=$.cascade.filter((J)=>typeof J==="string");return X.length?{cascade:X}:{}}return{}}return{}}function UX(Z,$){let X=Z.hasMany??[],J=Z.hasOne??[],Y=X.some((H)=>S$(H,$,!0)),Q=J.some((H)=>S$(H,$,!1));if(!Y&&!Q)return W0.warn(`[orm] soft-delete cascade: '${$}' is not a declared hasMany/hasOne relation - skipping`),null;let W=(Y?X:J).find((H)=>S$(H,$,Y))??null;if(!W)return null;let B=globalThis[W];if(!B)return W0.warn(`[orm] soft-delete cascade: model '${W}' is not yet on globalThis - skipping cascade for '${$}'`),null;return{className:W,model:B}}function S$(Z,$,X){let J=Z.toLowerCase();if($===J)return!0;if(X&&$===`${J}s`)return!0;if(X&&J.endsWith("y")&&$===`${J.slice(0,-1)}ies`)return!0;return!1}async function qX(Z,$,X,J,Y){try{let Q=X.where;if(typeof Q!=="function"){W0.warn(`[orm] cascade ${Y}: child model has no .where()`);return}if(Y==="softDelete"){let G=X.softDelete;if(typeof G==="function"){let V=Q.call(X,J,$),B=typeof V?.get==="function"?await V.get():Array.isArray(V)?V:[],H=X.primaryKey||"id";for(let z of B){let O=z?.[H];if(O!=null)await G.call(X,O)}return}let W=Q.call(X,J,$);if(typeof W?.delete==="function"){W0.debug(`[orm] cascade soft-delete: child has no softDeletes trait, hard-deleting from ${String(X.table??"?")}`),await W.delete();return}}else{let G=X.restore;if(typeof G!=="function"){W0.debug("[orm] cascade restore: child has no restore() - nothing to do");return}let W=X.withTrashed,B=(typeof W==="function"?W.call(X):X).where?.(J,$),H=typeof B?.get==="function"?await B.get():[],z=X.primaryKey||"id";for(let O of H){let F=O?.[z];if(F!=null)await G.call(X,F)}}}catch(Q){if(W0.warn(`[orm] soft-delete cascade ${Y} on ${Z}#${String($)} failed`,{error:Q}),process.env.STACKS_ORM_CASCADE_SWALLOW!=="true")throw Q}}async function Z8(Z,$,X,J){let Y=$.cascade;if(!Y||Y.length===0)return;let Q=`${Z.name.toLowerCase()}_id`;for(let G of Y){let W=UX(Z,G);if(!W)continue;await qX(W.className,X,W.model,Q,J)}}var k7=new N7;function Z0(){return k7.getStore()?.suppressed===!0}function e(Z){return Promise.resolve(k7.run({suppressed:!0},Z))}var I7=new N7;function AX(){return I7.getStore()?.suppressed===!0}function EX(Z){return Promise.resolve(I7.run({suppressed:!0},Z))}var v$=Symbol.for("stacks.orm.modelDefinition");class j7 extends Error{status=422;errors;constructor(Z,$){let X=Object.keys($).join(", ");super(`${Z} validation failed: ${X}`);this.name="ModelValidationError",this.errors=$}}var q7=new Set;function CX(Z,$){let X=typeof Z==="string"?Z.slice(0,80):String(Z),J=`${typeof Z}:${X}`;if(q7.has(J))return;q7.add(J);let Y=$ instanceof Error?$.message:String($);console.error(`[orm] JSON cast failed to parse value (returning null): ${Y} - value preview: ${JSON.stringify(X)}`)}var PX={string:{get:(Z)=>Z!=null?String(Z):null,set:(Z)=>Z!=null?String(Z):null},number:{get:(Z)=>Z!=null?Number(Z):null,set:(Z)=>Z!=null?Number(Z):null},integer:{get:(Z)=>Z!=null?Math.trunc(Number(Z)):null,set:(Z)=>Z!=null?Math.trunc(Number(Z)):null},float:{get:(Z)=>Z!=null?Number.parseFloat(String(Z)):null,set:(Z)=>Z!=null?Number.parseFloat(String(Z)):null},boolean:{get:(Z)=>Z===1||Z==="1"||Z===!0||Z==="true",set:(Z)=>Z===!0||Z===1||Z==="1"||Z==="true"?1:0},json:{get:(Z)=>{if(Z==null)return null;if(typeof Z==="string")try{return JSON.parse(Z)}catch($){return CX(Z,$),null}return Z},set:(Z)=>{if(Z==null)return null;return typeof Z==="string"?Z:JSON.stringify(Z)}},datetime:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString():Z},date:{get:(Z)=>Z?new Date(Z):null,set:(Z)=>Z instanceof Date?Z.toISOString().split("T")[0]:Z},array:{get:(Z)=>{if(Z==null)return[];if(Array.isArray(Z))return Z;if(typeof Z==="string")try{return JSON.parse(Z)}catch{return[]}return[]},set:(Z)=>{if(Z==null)return null;return Array.isArray(Z)?JSON.stringify(Z):Z}}};function S7(Z){return typeof Z==="string"?PX[Z]:Z}function L7(Z,$,X){if(!Z||typeof Z!=="object")return Z;let J={...Z};for(let[Y,Q]of Object.entries($))if(Y in J){let G=S7(Q);J[Y]=G[X](J[Y])}return J}var k8=new Set(["_attributes","_original","_definition","_hasSaved","_relations"]),D7=Symbol.for("stacks.modelInstanceProxy"),NX={tags:{bag:"_taggable",mode:"id"},tagCount:{bag:"_taggable",mode:"id"},addTag:{bag:"_taggable",mode:"id"},activeTags:{bag:"_taggable",mode:"id"},inactiveTags:{bag:"_taggable",mode:"id"},removeTag:{bag:"_taggable",mode:"id"},categories:{bag:"_categorizable",mode:"id"},categoryCount:{bag:"_categorizable",mode:"id"},addCategory:{bag:"_categorizable",mode:"id"},activeCategories:{bag:"_categorizable",mode:"id"},inactiveCategories:{bag:"_categorizable",mode:"id"},removeCategory:{bag:"_categorizable",mode:"id"},comments:{bag:"_commentable",mode:"id"},commentCount:{bag:"_commentable",mode:"id"},addComment:{bag:"_commentable",mode:"id"},approvedComments:{bag:"_commentable",mode:"id"},pendingComments:{bag:"_commentable",mode:"id"},rejectedComments:{bag:"_commentable",mode:"id"},likes:{bag:"_likeable",mode:"id"},likeCount:{bag:"_likeable",mode:"id"},like:{bag:"_likeable",mode:"id"},unlike:{bag:"_likeable",mode:"id"},isLiked:{bag:"_likeable",mode:"id"},createStripeUser:{bag:"_billable",mode:"model"},updateStripeUser:{bag:"_billable",mode:"model"},deleteStripeUser:{bag:"_billable",mode:"model"},createOrGetStripeUser:{bag:"_billable",mode:"model"},retrieveStripeUser:{bag:"_billable",mode:"model"},defaultPaymentMethod:{bag:"_billable",mode:"model"},setDefaultPaymentMethod:{bag:"_billable",mode:"model"},addPaymentMethod:{bag:"_billable",mode:"model"},paymentMethods:{bag:"_billable",mode:"model"},newSubscription:{bag:"_billable",mode:"model"},updateSubscription:{bag:"_billable",mode:"model"},cancelSubscription:{bag:"_billable",mode:"model"},activeSubscription:{bag:"_billable",mode:"model"},checkout:{bag:"_billable",mode:"model"},createSetupIntent:{bag:"_billable",mode:"model"},subscriptionHistory:{bag:"_billable",mode:"model"},transactionHistory:{bag:"_billable",mode:"model"},connectAccount:{bag:"_billable",mode:"model"},createConnectAccount:{bag:"_billable",mode:"model"},connectOnboardLink:{bag:"_billable",mode:"model"},syncConnectStatus:{bag:"_billable",mode:"model"},chargeWithSplit:{bag:"_billable",mode:"model"},generateTwoFactorForModel:{bag:"_twoFactor",mode:"model"},verifyTwoFactorCode:{bag:"_twoFactor",mode:"model"}};function kX(Z,$){if(!Z||!$)return null;let X=$.split("."),J=Z;for(let Y of X){if(J==null||typeof J!=="object")return null;let Q=J;if("_attributes"in Q&&Q._attributes&&typeof Q._attributes==="object"){let G=Q._attributes;if(Y in G){J=G[Y];continue}}if(Y in Q){J=Q[Y];continue}return null}return J??null}function R(Z,$){if(!Z||typeof Z!=="object")return Z;if(Z[D7])return Z;let X=Z._attributes;if(!X||typeof X!=="object")return Z;if($&&Object.keys($).length>0){for(let[J,Y]of Object.entries($))if(Object.prototype.hasOwnProperty.call(X,J))X[J]=S7(Y).get(X[J])}return new Proxy(Z,{get(J,Y,Q){if(Y===D7)return!0;if(Y==="saveAsync")return async function(){let W=J._definition,V=W?.set;if(V&&typeof J.isDirty==="function"){for(let[H,z]of Object.entries(V)){if(typeof z!=="function")continue;if(!J.isDirty(H))continue;let O=z(J._attributes),F=O&&typeof O.then==="function"?await O:O;J._attributes[H]=F}let B=W.set;W.set={};try{return J.save()}finally{W.set=B}}return J.save()};if(Y==="save")return function(){let W=J._definition,V=W?.set;if(V&&Object.keys(V).length>0&&typeof J.isDirty==="function"){for(let[H,z]of Object.entries(V)){if(typeof z!=="function")continue;if(!J.isDirty(H))continue;let O=z(J._attributes);if(O&&typeof O.then==="function")throw Error(`Setter for "${H}" returned a Promise - use \`saveAsync()\` instead of \`save()\` when a model has async setters.`);J._attributes[H]=O}let B=W.set;W.set={};try{return J.save()}finally{W.set=B}}return J.save()};if(Y==="updateAsync")return async function(W){if(W&&typeof W==="object"&&!Array.isArray(W))for(let[V,B]of Object.entries(W))Q[V]=B;return Q.saveAsync()};if(Y==="saveQuietly")return function(){return e(()=>J.save())};if(Y==="saveAsyncQuietly")return function(){return e(()=>Q.saveAsync())};if(Y==="updateQuietly")return function(W){return e(()=>J.update(W))};if(Y==="updateAsyncQuietly")return function(W){return e(()=>Q.updateAsync(W))};if(Y==="deleteQuietly")return function(){return e(()=>J.delete())};if(Y==="toSearchableObject")return function(){let B=J._definition?.traits?.useSearch;if(!B)return null;let H=J._attributes;if(!H)return null;if(B===!0){let T={...H};if(H.id!=null)T.id=String(H.id);return T}let z={},O=B.displayable?.length?B.displayable:[...B.searchable??[],...B.filterable??[],...B.sortable??[],"id"],F=B.denormalize??{},w=J._relations;for(let T of O){let q=d(T),L=H[q]??H[T];if(L!==void 0){z[q]=L;continue}let E=F[T]??F[q];if(E){z[q]=kX(w,E);continue}z[q]=void 0}if(H.id!=null)z.id=String(H.id);return z};if(typeof Y==="string"&&!k8.has(Y)){let W=J._attributes;if(W&&Object.prototype.hasOwnProperty.call(W,Y))return W[Y];let V=J._relations;if(V&&Object.prototype.hasOwnProperty.call(V,Y)){let H=V[Y];if(Array.isArray(H))return H.map((z)=>R(z,$));return R(H,$)}let B=NX[Y];if(B){let O=J._definition?.__traitMethods?.[B.bag]?.[Y];if(typeof O==="function")return B.mode==="model"?(...F)=>O(Q,...F):(...F)=>O(J.id,...F)}if(W){let H=d(Y);if(H!==Y&&Object.prototype.hasOwnProperty.call(W,H))return W[H]}}let G=Reflect.get(J,Y,J);return typeof G==="function"?G.bind(J):G},set(J,Y,Q,G){if(typeof Y==="string"&&!k8.has(Y)){let{_attributes:W,set:V}=J;if(W&&Object.prototype.hasOwnProperty.call(W,Y)){if(typeof V==="function")V.call(J,Y,Q);else W[Y]=Q;return!0}if(W){let B=d(Y);if(B!==Y&&Object.prototype.hasOwnProperty.call(W,B)){if(typeof V==="function")V.call(J,B,Q);else W[B]=Q;return!0}}if(W&&!(Y in J)){if(typeof V==="function")V.call(J,Y,Q);else W[Y]=Q;return!0}}return Reflect.set(J,Y,Q,G)},has(J,Y){if(typeof Y==="string"&&!k8.has(Y)){let Q=J._attributes;if(Q&&Object.prototype.hasOwnProperty.call(Q,Y))return!0;let G=J._relations;if(G&&Object.prototype.hasOwnProperty.call(G,Y))return!0;if(Q){let W=d(Y);if(W!==Y&&Object.prototype.hasOwnProperty.call(Q,W))return!0}}return Reflect.has(J,Y)},deleteProperty(J,Y){if(typeof Y==="string"&&!k8.has(Y)){let Q=J._attributes;if(Q&&Object.prototype.hasOwnProperty.call(Q,Y))return delete Q[Y],!0}return Reflect.deleteProperty(J,Y)},ownKeys(J){let Y=J._attributes;return Y?Object.keys(Y):[]},getOwnPropertyDescriptor(J,Y){if(typeof Y==="string"){let Q=J._attributes;if(Q&&Object.prototype.hasOwnProperty.call(Q,Y))return{configurable:!0,enumerable:!0,value:Q[Y],writable:!0}}return Object.getOwnPropertyDescriptor(J,Y)}})}var IX=new Set(["get","first","last","firstOrFail","find","findOrFail","all","paginate","simplePaginate","cursorPaginate"]),jX={paginate:s8,simplePaginate:o8,cursorPaginate:a8},A7=Symbol.for("stacks.queryBuilderProxy");function M7(Z,$){if(!Z||typeof Z!=="object")return Z;if(Z[A7])return Z;return new Proxy(Z,{get(X,J,Y){if(J===A7)return!0;let Q=Reflect.get(X,J,Y);if(typeof Q!=="function")return Q;return function(...G){let W=G,V=String(J);if(V==="paginate"||V==="simplePaginate"){let{perPage:z,page:O}=Z9(G[0],G[1]);W=[z,O]}else if(V==="cursorPaginate"){let{perPage:z,cursor:O}=$9(G[0],G[1]);W=[z,O,G[2],G[3]]}let B=Q.apply(X,W),H=(z)=>{if(IX.has(V)){if(Array.isArray(z))return z.map((F)=>R(F,$));let O=jX[V];if(O&&z&&Array.isArray(z.data)){let F=z.data.map((T)=>R(T,$)),w=O({...z,data:F});return X9(w)}if(z&&Array.isArray(z.data))return{...z,data:z.data.map((F)=>R(F,$))};return R(z,$)}if(z&&typeof z==="object"&&typeof z.get==="function")return M7(z,$);return z};if(B&&typeof B.then==="function")return B.then(H);return H(B)}}})}function SX(Z,$){let X=["find","first","last","all","firstOrFail","findOrFail","findMany"];for(let Q of X){let G=Z[Q];if(typeof G!=="function")continue;Z[Q]=function(...W){let V=G.apply(this,W),B=(H)=>Array.isArray(H)?H.map((z)=>R(z,$)):R(H,$);if(V&&typeof V.then==="function")return V.then(B);return B(V)}}let J=["create","firstOrCreate","updateOrCreate","make"];for(let Q of J){let G=Z[Q];if(typeof G!=="function")continue;Z[Q]=function(...W){let V=G.apply(this,W),B=(H)=>Array.isArray(H)?H.map((z)=>R(z,$)):R(H,$);if(V&&typeof V.then==="function")return V.then(B);return B(V)}}let Y=["query","where","orWhere","whereIn","whereNotIn","whereNull","whereNotNull","whereLike","whereBetween","whereNotBetween","orderBy","orderByDesc","select","with","limit","take","skip","latest","oldest"];for(let Q of Y){let G=Z[Q];if(typeof G!=="function")continue;Z[Q]=function(...W){let V=G.apply(this,W);return M7(V,$)}}}class f7 extends Error{model;id;constructor(Z,$){super($!=null?`[ORM] ${Z} not found for id=${String($)}`:`[ORM] No matching ${Z} row`);this.name="ModelNotFoundError",this.model=Z,this.id=$}}class f$ extends Error{model;attribute;reason;constructor(Z,$,X){let J=X==="guarded"?`'${$}' is marked guarded`:`'${$}' is not in the fillable allowlist`;super(`[ORM] Mass assignment to ${Z} forbidden: ${J}. Use ${Z}.forceCreate(...) / .forceUpdate(...) to bypass.`);this.name="MassAssignmentException",this.model=Z,this.attribute=$,this.reason=X}}var MX=new Set(["id","created_at","updated_at","deleted_at","uuid"]);function $8(Z,$,X={}){if(X.force)return $;if(!$||typeof $!=="object"||Array.isArray($))return $;let J=Z.attributes;if(!J)return $;let Y=new Set,Q=new Set,G=new Set;for(let[V,B]of Object.entries(J)){let H=d(V);if(Y.add(H),B?.fillable===!0)Q.add(H);if(B?.guarded===!0)G.add(H)}let W=Q.size>0?Q:Y;for(let V of Object.keys($)){let B=d(V);if(MX.has(B))continue;if(G.has(B))throw new f$(Z.name,V,"guarded");if(B.endsWith("_id"))continue;if(!W.has(B))throw new f$(Z.name,V,"not-fillable")}return $}async function y$(Z,$){let X=Z.set;if(!X||typeof X!=="object")return $;let J={...$};for(let[Y,Q]of Object.entries(X)){if(typeof Q!=="function"||!(Y in J))continue;try{J[Y]=await Q(J)}catch(G){f.error(`[orm] ${Z.name}.set.${Y} threw - skipping setter`,G)}}return J}function fX(Z,$){let X=$.primaryKey||"id",J=Z.create;function Y(B){let H=Z.where;if(typeof H!=="function")throw Error(`[ORM] ${$.name}.${B} needs a working where(): the underlying query builder did not expose one`);return H}function Q(B){let H=Z.find;if(typeof H!=="function")throw Error(`[ORM] ${$.name}.${B} needs a working find(): the underlying query builder did not expose one`);return H}function G(B){let H=Z.create;if(typeof H!=="function")throw Error(`[ORM] ${$.name}.${B} cannot create: the underlying query builder did not expose create()`);return H}if(typeof Z.update!=="function")Z.update=async function(B,H){if(B==null)throw Error(`[ORM] ${$.name}.update requires an id as the first argument`);if(!H||typeof H!=="object"||Array.isArray(H))throw Error(`[ORM] ${$.name}.update requires a data object as the second argument`);if(Object.keys(H).length===0){f.debug(`[orm] ${$.name}.update called with empty data - short-circuiting and returning current row`);let F=Z.find;return typeof F==="function"?await F.call(Z,B):null}$8($,H);let z=await y$($,H);await Y("update").call(Z,X,B).update(z);let O=Z.find;return typeof O==="function"?await O.call(Z,B):null};if(typeof Z.forceUpdate!=="function")Z.forceUpdate=async function(B,H){if(B==null)throw Error(`[ORM] ${$.name}.forceUpdate requires an id as the first argument`);if(!H||typeof H!=="object"||Array.isArray(H))throw Error(`[ORM] ${$.name}.forceUpdate requires a data object as the second argument`);let z=await y$($,H);await Y("forceUpdate").call(Z,X,B).update(z);let O=Z.find;return typeof O==="function"?await O.call(Z,B):null};if(typeof Z.forceCreate!=="function")Z.forceCreate=async function(B){if(!B||typeof B!=="object"||Array.isArray(B))throw Error(`[ORM] ${$.name}.forceCreate requires a data object`);let H=Z.make;if(typeof H==="function"){let z=await H.call(Z);if(z&&typeof z.forceFill==="function"&&typeof z.save==="function")return z.forceFill(B),await z.save()??z}if(typeof J!=="function")throw Error(`[ORM] ${$.name}.forceCreate cannot create: the underlying query builder did not expose create()`);return await J.call(Z,B)};if(typeof Z.delete!=="function")Z.delete=async function(B){if(B==null)throw Error(`[ORM] ${$.name}.delete requires an id as the first argument`);if(!await Q("delete").call(Z,B))return!1;return await Y("delete").call(Z,X,B).delete(),!0};if(typeof Z.findOrFail!=="function")Z.findOrFail=async function(B){let H=await Q("findOrFail").call(Z,B);if(H==null)throw new f7($.name,B);return H};if(typeof Z.exists!=="function")Z.exists=async function(B){if(B==null)return!1;let H=Y("exists").call(Z,X,B);if(typeof H.count==="function"){let O=await H.count();return Number(O)>0}let z=Z.find;return typeof z==="function"?await z.call(Z,B)!=null:!1};if(typeof Z.firstOrCreate!=="function")Z.firstOrCreate=async function(B,H={}){if(!B||typeof B!=="object"||Array.isArray(B))throw Error(`[ORM] ${$.name}.firstOrCreate requires a where-attrs object`);let z=Y("firstOrCreate").call(Z,B),O=typeof z.first==="function"?await z.first():await z;if(O)return O;let F={...B,...H};return $8($,F),await G("firstOrCreate").call(Z,F)};if(typeof Z.updateOrCreate!=="function")Z.updateOrCreate=async function(B,H){if(!B||typeof B!=="object"||Array.isArray(B))throw Error(`[ORM] ${$.name}.updateOrCreate requires a where-attrs object`);if(!H||typeof H!=="object"||Array.isArray(H))throw Error(`[ORM] ${$.name}.updateOrCreate requires a values object`);let z=Y("updateOrCreate").call(Z,B),O=typeof z.first==="function"?await z.first():await z;if(O){$8($,H);let w=O[X];await Y("updateOrCreate").call(Z,X,w).update(H);let T=Z.find;return typeof T==="function"?await T.call(Z,w):{...O,...H}}let F={...B,...H};return $8($,F),await G("updateOrCreate").call(Z,F)};if(typeof Z.count!=="function")Z.count=async function(){let B=Z;if(typeof B.query==="function"){let O=B.query();if(typeof O?.count==="function"){let F=await O.count();return Number(F)||0}}let{all:H,get:z}=Z;if(typeof H==="function")return(await H.call(Z)||[]).length;if(typeof z==="function")return(await z.call(Z)||[]).length;return 0};if(typeof Z.pluck!=="function")Z.pluck=async function(B){if(!B||typeof B!=="string")throw Error(`[ORM] ${$.name}.pluck requires a column name`);let H=Z.all;return((typeof H==="function"?await H.call(Z):[])||[]).map((O)=>O?.[B])};if(typeof Z.whereIn!=="function")Z.whereIn=async function(B,H){if(!B||typeof B!=="string")throw Error(`[ORM] ${$.name}.whereIn requires a column name`);if(!Array.isArray(H))throw Error(`[ORM] ${$.name}.whereIn requires an array of values`);if(H.length===0)return[];let z=Z.where;if(typeof z!=="function")return[];let O=z.call(Z,B,"in",H);if(O&&typeof O.get==="function")return await O.get();return await O};let W=[["latest","desc"],["oldest","asc"]];for(let[B,H]of W)if(typeof Z[B]!=="function")Z[B]=async function(z="created_at"){let O=Z,F=typeof O.query==="function"?O.query():O;if(typeof F?.orderBy==="function"){let L=F.orderBy(z,H);if(typeof L.first==="function")return await L.first();if(typeof L.get==="function")return(await L.get())?.[0]??null}let w=Z.all;if(typeof w!=="function")return null;return[...await w.call(Z)||[]].sort((L,E)=>{let P=L?.[z],I=E?.[z];if(P===I)return 0;return(P>I?1:-1)*(H==="desc"?-1:1)})[0]??null};let V=v7($.traits?.useSearch,$);if(V){let B=V.index??$.table??d(`${$.name}s`);if(typeof Z.search!=="function")Z.search=function(H,z){return RX(Z,B,H,z,V.searchable)};if(typeof Z.makeAllSearchable!=="function")Z.makeAllSearchable=async function(H=500){let z=Z.all;if(typeof z!=="function")throw Error(`[ORM] ${$.name}.makeAllSearchable cannot run: the underlying query builder did not expose all()`);let{useSearchEngine:O}=await import("@stacksjs/search-engine"),F=O(),w=0,T=Z.query;if(typeof T==="function")try{let E=T.call(Z);if(E&&typeof E.chunk==="function")return await E.chunk(H,async(P)=>{let I=await h$(P,V);if(I.length>0)await F.addDocuments(B,I);w+=I.length}),w}catch{}let q=await z.call(Z)||[],L=await h$(q,V);if(L.length>0)await F.addDocuments(B,L);return L.length};if(typeof Z.removeAllFromSearch!=="function")Z.removeAllFromSearch=async function(){let{useSearchEngine:H}=await import("@stacksjs/search-engine"),z=H();if(typeof z.deleteAllDocuments==="function"){await z.deleteAllDocuments(B);return}let O=Z.all,F=typeof O==="function"?await O.call(Z)||[]:[],w=H();for(let T of F){let q=T?.id??T?._attributes?.id;if(q!=null)await w.deleteDocument(B,Number(q))}}}}async function h$(Z,$){if(Z.length===0)return[];if(typeof $.shapeMany==="function"){let J=await $.shapeMany(Z);if(!Array.isArray(J)||J.length!==Z.length)throw TypeError(`[orm/search] shapeMany returned ${Array.isArray(J)?J.length:typeof J} documents for ${Z.length} rows. It must return one document per row, in order, or documents are indexed under the wrong ids.`);return J.filter(Boolean)}return(await Promise.all(Z.map((J)=>vX(J,$)))).filter(Boolean)}function yX(Z){let $=new Set,X=Z.attributes??{};for(let[J,Y]of Object.entries(X))if(Y?.hidden)$.add(J);return $}function hX(Z,$){if(!Z||$.size===0)return Z;let X={};for(let[J,Y]of Object.entries(Z))if(!$.has(J))X[J]=Y;return X}async function vX(Z,$){if(typeof $.shape==="function")try{return await $.shape(Z)}catch{return}let X=Z?.toSearchableObject?.();if(X!==void 0)return X;return hX(Z?._attributes??(typeof Z?.toJSON==="function"?Z.toJSON():null),$.hidden??new Set)}function RX(Z,$,X,J,Y){let Q=Y&&Y.length>0?{query_by:[...Y].join(",")}:{},G={q:X,...Q,...J??{}},W={with(V){return G={...G,...V},W},where(V){return G={...G,filter:V},W},async get(){let{useSearchEngine:V}=await import("@stacksjs/search-engine");return(await V().search($,G))?.hits??[]},async paginate(V,B=1){let{useSearchEngine:H}=await import("@stacksjs/search-engine"),O=await H().search($,{...G,limit:V,offset:(B-1)*V});return{hits:O.hits??[],total:Number(O.estimatedTotalHits??O.nbHits??O.total??0),page:B,perPage:V}},async raw(){let{useSearchEngine:V}=await import("@stacksjs/search-engine");return await V().search($,G)}};return W}function y7(Z){let $=d(Z);return $===Z?[Z]:[Z,$]}async function M$(Z,$){if(!Z||typeof Z!=="object")return;let X=Z._attributes??Z;for(let J of $)for(let Y of y7(J)){if(!(Y in X))continue;let Q=X[Y];if(!K0(Q))continue;X[Y]=await f8(Q)}}function bX(Z,$){if($.length===0)return;let X=async(W)=>{if(Array.isArray(W)){for(let V of W)await M$(V,$);return W}if(W&&typeof W==="object"&&Array.isArray(W.data)){for(let V of W.data)await M$(V,$);return W}if(W)await M$(W,$);return W},J=["find","first","last","all","firstOrFail","findOrFail","findMany"];for(let W of J){let V=Z[W];if(typeof V!=="function")continue;Z[W]=async function(...B){let H=await V.apply(this,B);return await X(H)}}let Y=["create","firstOrCreate","updateOrCreate","make"];for(let W of Y){let V=Z[W];if(typeof V!=="function")continue;Z[W]=async function(...B){let H=await V.apply(this,B);return await X(H)}}for(let W of["update","forceUpdate"]){let V=Z[W];if(typeof V!=="function")continue;Z[W]=async function(B,H){let z=await V.call(this,B,H);return await X(z)}}let Q=["first","firstOrFail","get","all","find","findOrFail","last","paginate","simplePaginate"],G=(W)=>{if(!W||typeof W!=="object")return W;let V=W;if(V.__stacksEncryptedReads)return W;for(let B of Q){let H=V[B];if(typeof H!=="function")continue;V[B]=async function(...z){return await X(await H.apply(this,z))}}for(let B of["where","whereIn","whereNull","whereNotNull","orWhere","orderBy","orderByDesc","limit","offset","with"]){let H=V[B];if(typeof H!=="function")continue;V[B]=function(...z){return G(H.apply(this,z))}}return Object.defineProperty(V,"__stacksEncryptedReads",{value:!0,enumerable:!1}),W};for(let W of["where","whereIn","whereNull","whereNotNull","orderBy","orderByDesc","limit","query"]){let V=Z[W];if(typeof V!=="function")continue;Z[W]=function(...B){return G(V.apply(this,B))}}}function gX(Z,$){if($.length===0)return;let X=async(Y)=>{if(!Y||typeof Y!=="object"||Array.isArray(Y))return Y;let Q={...Y};for(let G of $)for(let W of y7(G))if(W in Q)Q[W]=await M8(Q[W]);return Q},J=["create","firstOrCreate","updateOrCreate","forceCreate"];for(let Y of J){let Q=Z[Y];if(typeof Q!=="function")continue;Z[Y]=async function(...G){if(G[0]=await X(G[0]),G[1])G[1]=await X(G[1]);return await Q.apply(this,G)}}for(let Y of["update","forceUpdate"]){let Q=Z[Y];if(typeof Q!=="function")continue;Z[Y]=async function(G,W){let V=await X(W);return await Q.call(this,G,V)}}}function uX(Z,$){let X=Z.create;if(typeof X==="function")Z.create=async function(J,...Y){$8($,J);let Q=await y$($,J);return await X.call(this,Q,...Y)};for(let J of["firstOrCreate","updateOrCreate"]){let Y=Z[J];if(typeof Y!=="function")continue}}function cX(Z,$){let X=String($?.name??Z.name??"Model"),J=(G,W)=>{if(AX())return;if(!G||typeof G!=="object"||Array.isArray(G))return;let V=t$(G,$,W);if(!V.valid)throw new j7(X,V.errors)},Y=Z.create;if(typeof Y==="function")Z.create=async function(G,...W){return J(G,"creating"),await Y.call(this,G,...W)};let Q=Z.update;if(typeof Q==="function")Z.update=async function(G,W,...V){return J(W,"updating"),await Q.call(this,G,W,...V)}}function mX(Z,$){let X=["create","firstOrCreate","updateOrCreate"];for(let Y of X){let Q=Z[Y];if(typeof Q==="function")Z[Y]=async function(...G){if(f.debug(`[orm] ${Y.charAt(0).toUpperCase()+Y.slice(1)} ${String(Z.name||"unknown")}`,G[0]),G[0]&&typeof G[0]==="object"&&!Array.isArray(G[0]))G[0]=L7(G[0],$,"set");return await Q.apply(this,G)}}let J=Z.update;if(typeof J==="function")Z.update=async function(Y,Q){let G=Q&&typeof Q==="object"&&!Array.isArray(Q)?L7(Q,$,"set"):Q;return await J.call(this,Y,G)}}function h7(Z){f.debug(`[orm] Defining model: ${Z.name} (table: ${Z.table})`);let $=lX(Z),X=nX(Z),J=dX($,X),Y=pX(Z);Z.__traitMethods=Y;let Q=J?{...Z,hooks:{...Z.hooks,...J}}:Z,W=LX(Q);if(SX(W,Z.casts),fX(W,Q),uX(W,Q),Z.casts&&Object.keys(Z.casts).length>0)mX(W,Z.casts);let V=y8(Z);if(V.length>0)gX(W,V),bX(W,V);let B=Z.traits?.useSoftDeletes;if(B)iX(W,Q,B);let H=Z.traits?.useAudit;if(H){let O=d$(H);n$(W,Z.name,Z.primaryKey||"id",O)}cX(W,Q),W.withoutValidation=function(O){return EX(O)},W.withoutEvents=function(O){return e(O)};for(let O of["create","update","firstOrCreate","updateOrCreate","forceCreate","forceUpdate","delete","forceDelete","softDelete","restore"]){let F=W[O];if(typeof F!=="function")continue;let w=`${O}Quietly`;if(typeof W[w]==="function")continue;W[w]=function(...T){return e(()=>F.apply(W,T))}}let z=Object.assign(W,Y,{...Z,getDefinition:()=>Z,_isStacksModel:!0});return DX(Z.name,z),Object.defineProperty(z,v$,{value:Z,enumerable:!1,configurable:!0}),z}function lX(Z){let $=Z.traits?.observe;if(!$)return;let X=Z.name.toLowerCase(),J=(O)=>{let F=O?.attributes;if(!F||typeof F!=="object")return O;let w=Z.primaryKey||"id",T={...F};if(T[w]===void 0&&O[w]!==void 0)T[w]=O[w];return T},Y=async(O,F)=>{if(Z0())return;try{let{dispatch:w}=await import("@stacksjs/events");await w(O,F)}catch(w){if(w&&typeof w==="object"&&"code"in w&&w.code==="MODULE_NOT_FOUND")return;if(console.error(`[ORM] Event '${O}' handler error:`,w),process.env.STACKS_ORM_EVENT_ERRORS!=="swallow")throw w}},Q=Z.traits?.broadcastOn,G=Z.traits?.broadcastWith,W=typeof Q==="function"&&typeof G==="function",V=async(O,F)=>{if(!W)return;if(Z0())return;try{let w=Q(F),T=Array.isArray(w)?w:[w],q=G(F),E=(await import("@stacksjs/realtime").catch(()=>null))?.broadcast;if(typeof E!=="function")return;for(let P of T){if(typeof P!=="string"||P.length===0)continue;await E(P,O,q)}}catch(w){if(w&&typeof w==="object"&&"code"in w&&w.code==="MODULE_NOT_FOUND")return;if(console.error(`[ORM] Broadcast '${O}' handler error:`,w),process.env.STACKS_ORM_BROADCAST_ERRORS==="throw")throw w}},B=async(O,F)=>{if(Z0())return!0;try{let{dispatchAsync:w}=await import("@stacksjs/events"),T=await w(O,F);if(Array.isArray(T)&&T.some((q)=>q===!1))return!1}catch(w){if(w&&typeof w==="object"&&"code"in w&&w.code==="MODULE_NOT_FOUND")return!0;if(console.error(`[ORM] Before-event '${O}' handler error:`,w),process.env.STACKS_ORM_EVENT_ERRORS!=="swallow")throw w}return!0},H=$===!0?["create","update","delete"]:Array.isArray($)?$:[],z={};if(H.includes("create"))z.beforeCreate=async(O)=>{if(f.debug(`[orm] Create ${X}`,O),!await B(`${X}:saving`,O))throw Error(`[ORM] ${X}:saving event cancelled the operation`);if(!await B(`${X}:creating`,O))throw Error(`[ORM] ${X}:creating event cancelled the operation`)},z.afterCreate=async(O)=>{let F=J(O);await Y(`${X}:created`,F),await Y(`${X}:saved`,F),await V(`${X}:created`,O)};if(H.includes("update"))z.beforeUpdate=async(O)=>{if(f.debug(`[orm] Update ${X}#${O?.id??"unknown"}`,O),!await B(`${X}:saving`,O))throw Error(`[ORM] ${X}:saving event cancelled the operation`);if(!await B(`${X}:updating`,O))throw Error(`[ORM] ${X}:updating event cancelled the operation`)},z.afterUpdate=async(O)=>{let F=J(O);await Y(`${X}:updated`,F),await Y(`${X}:saved`,F),await V(`${X}:updated`,O)};if(H.includes("delete"))z.beforeDelete=async(O)=>{if(f.debug(`[orm] Delete ${X}#${O?.id??"unknown"}`),!await B(`${X}:deleting`,O))throw Error(`[ORM] ${X}:deleting event cancelled the operation`)},z.afterDelete=async(O)=>{await Y(`${X}:deleted`,J(O)),await V(`${X}:deleted`,O)};return z}function dX(...Z){let $={},X=new Set;for(let J of Z){if(!J)continue;for(let Y of Object.keys(J))X.add(Y)}for(let J of X){let Y=Z.map((Q)=>Q?.[J]).filter((Q)=>typeof Q==="function");if(!Y.length)continue;$[J]=async(...Q)=>{for(let G of Y)await G(...Q)}}return Object.keys($).length?$:void 0}function v7(Z,$){if(!Z)return null;let X=Z===!0?{}:typeof Z==="object"?{...Z}:null;if(!X)return null;if($)X.hidden=yX($);return X}function nX(Z){let $=v7(Z.traits?.useSearch,Z);if(!$)return;let X=$,J=X.index??Z.table??d(`${Z.name}s`);async function Y(W){if(typeof X.shapeMany==="function")try{let[H]=await h$([W],X);return H}catch(H){f.warn(`[orm/search] shapeMany() threw for ${Z.name}: ${H.message}`);return}if(typeof X.shape==="function")try{return await X.shape(W)}catch(H){f.warn(`[orm/search] shape() threw for ${Z.name}: ${H.message}`);return}let B=R(W).toSearchableObject?.();if(B!==void 0)return B;return W?._attributes??(typeof W?.toJSON==="function"?W.toJSON():null)}let Q=async(W)=>{if(Z0())return;let V=await Y(W);if(!V)return;if($.queueable){try{let{Jobs:B}=await import("@stacksjs/queue");await B.dispatch("SyncSearchIndex",{index:J,op:"upsert",doc:V})}catch(B){f.warn(`[orm/search] queue dispatch failed for ${Z.name}; falling back to inline: ${B.message}`),await C7(J,V,Z.name)}return}await C7(J,V,Z.name)};return{afterCreate:Q,afterUpdate:Q,afterDelete:async(W)=>{if(Z0())return;let V=W?.id??W?._attributes?.id;if(V==null)return;if($.queueable){try{let{Jobs:B}=await import("@stacksjs/queue");await B.dispatch("SyncSearchIndex",{index:J,op:"delete",id:Number(V)})}catch(B){f.warn(`[orm/search] queue dispatch failed for ${Z.name}#${V}; falling back to inline: ${B.message}`),await P7(J,Number(V),Z.name)}return}await P7(J,Number(V),Z.name)}}}var E7=new Map;function R7(Z,$){let X=E7.get(Z)??0;if(E7.set(Z,X+1),X===0)f.warn(`[orm/search] ${$}`);else if(X===9)f.warn(`[orm/search] ${Z} is still failing; further identical warnings suppressed for this process.`)}async function C7(Z,$,X){try{let{useSearchEngine:J}=await import("@stacksjs/search-engine");await J().addDocument(Z,$)}catch(J){R7(`index:${X}`,`Failed to index ${X}: ${J.message}`)}}async function P7(Z,$,X){try{let{useSearchEngine:J}=await import("@stacksjs/search-engine");await J().deleteDocument(Z,$)}catch(J){R7(`remove:${X}`,`Failed to remove ${X}#${$}: ${J.message}`)}}function pX(Z){let $={},X=Z.table,J=Z.traits;if(!J)return $;if(J.taggable)$._taggable=c8(X);if(J.categorizable)$._categorizable=m8(X);if(J.commentable)$._commentable=g8(X);if(J.billable)$._billable=w7(X);if(J.likeable){let Q=typeof J.likeable==="object"?J.likeable:void 0;$._likeable=l8(X,Q)}let Y=J.useAuth||J.authenticatable;if(typeof Y==="object"&&Y&&"useTwoFactor"in Y&&Y.useTwoFactor)$._twoFactor=x7();return $}function iX(Z,$,X){let J=T7(Z,$.primaryKey||"id"),Y=U7(X),Q=$,G=$.name.toLowerCase(),W=$.traits?.observe!=null&&$.traits?.observe!==!1,V=async(F)=>{if(!W||Z0())return!0;try{let{dispatchAsync:w}=await import("@stacksjs/events"),T=await w(`${G}:restoring`,{id:F});if(Array.isArray(T)&&T.some((q)=>q===!1))return!1}catch(w){if(w?.code!=="MODULE_NOT_FOUND")console.error(`[ORM] Before-event '${G}:restoring' handler error:`,w)}return!0},B=async(F)=>{if(!W||Z0())return;try{let{dispatch:w}=await import("@stacksjs/events");await w(`${G}:restored`,{id:F})}catch(w){if(w?.code!=="MODULE_NOT_FOUND")console.error(`[ORM] Event '${G}:restored' handler error:`,w)}},H=process.env.STACKS_ORM_CASCADE_SWALLOW!=="true",z=async(F)=>{if(!Y.cascade?.length||!H){let T=await J.softDelete(F);if(T&&Y.cascade?.length)await Z8(Q,Y,F,"softDelete");return T}let{db:w}=await import("@stacksjs/database");return await w.transaction(async()=>{let T=await J.softDelete(F);if(T)await Z8(Q,Y,F,"softDelete");return T})},O=async(F)=>{if(!await V(F))return!1;if(!Y.cascade?.length||!H){let L=await J.restore(F);if(L){if(Y.cascade?.length)await Z8(Q,Y,F,"restore");await B(F)}return L}let{db:T}=await import("@stacksjs/database"),q=await T.transaction(async()=>{let L=await J.restore(F);if(L)await Z8(Q,Y,F,"restore");return L});if(q)await B(F);return q};Z.softDelete=z,Z.restore=O,Z.forceDelete=J.forceDelete,Z.withTrashed=J.withTrashed,Z.onlyTrashed=J.onlyTrashed,Z.delete=z}function rX(Z){if(Z==null)return Z;if(Array.isArray(Z))return Z.map(rX);if(typeof Z!=="object")return Z;if(typeof Z.toJSON==="function")return Z.toJSON();if(Z._attributes&&typeof Z._attributes==="object")return Z._attributes;return Z}var tX=["belongsTo","hasOne","hasMany","belongsToMany","morphMany","morphOne"],sX=["traits","dashboard"];function oX(Z){let $=Z?.[v$];if($&&typeof $==="object")return $;if(Z&&typeof Z==="object"&&"name"in Z&&"attributes"in Z)return Z;throw TypeError("extendModel() expects a model created by defineModel(), or a model definition. Import the framework model itself rather than its table name.")}function aX(Z,$){let X=Array.isArray(Z)?Z:[],J=Array.isArray($)?$:[];if(!X.length&&!J.length)return;return[...new Set([...X,...J])]}function eX(Z){if(!Z)return 0;return Object.values(Z).reduce(($,X)=>{let J=Number(X?.order);return Number.isFinite(J)&&J>$?J:$},0)}function ZJ(Z,$){let X={...Z,...$},J=Z.attributes??{},Y=$.attributes??{};if($.attributes){let Q=eX(J),G=Object.fromEntries(Object.entries(Y).map(([W,V])=>{let B=!(W in J),H=Number.isFinite(Number(V?.order));if(B&&!H)return[W,{...V,order:++Q}];return[W,V]}));X.attributes={...J,...G}}for(let Q of tX){let G=aX(Z[Q],$[Q]);if(G)X[Q]=G}for(let Q of sX){let G=Z[Q],W=$[Q];if(G&&W&&typeof G==="object"&&typeof W==="object")X[Q]={...G,...W}}return X}function wT(Z,$){return h7(ZJ(oX(Z),$))}import{log as $J}from"@stacksjs/logging";import{path as n}from"@stacksjs/path";import{fs as X8}from"@stacksjs/storage";function r(Z){return Z.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase()}function XJ(Z){let $=Z.default;if(typeof $==="boolean")return"boolean";if(typeof $==="number")return"number";if(typeof $==="string")return"string";return"unknown"}function JJ(Z){let $=Z.validation;if(!$||typeof $!=="object")return null;let X=$.rule;return X&&typeof X==="object"?X:null}function YJ(Z){if(!Z||String(Z.name??"")!=="enum")return null;let X=(Array.isArray(Z.allowedValues)?Z.allowedValues:[]).filter((J)=>typeof J==="string"||typeof J==="number").map((J)=>typeof J==="number"?String(J):JSON.stringify(J));return X.length>0?X.join(" | "):null}function QJ(Z){let $=JJ(Z),X=YJ($);if(X!==null)return Z.nullable===!0?`${X} | null`:X;let J=typeof Z.type==="string"?Z.type.toLowerCase():String($?.name??"").toLowerCase(),Y=(()=>{switch(J){case"string":case"text":case"longtext":case"mediumtext":case"tinytext":case"char":case"varchar":case"enum":case"uuid":case"date":case"datetime":case"timestamp":case"timestamptz":case"password":case"time":case"year":return"string";case"number":case"integer":case"int":case"tinyint":case"smallint":case"mediumint":case"float":case"double":case"decimal":case"numeric":return"number";case"bigint":return"number | bigint";case"boolean":case"bool":return"boolean";case"json":case"jsonb":return"unknown";case"binary":case"blob":case"bytea":return"Uint8Array";case"unix":return"number";case"array":return"unknown[]";case"object":return"Record<string, unknown>";default:return XJ(Z)}})();return Z.nullable===!0?`${Y} | null`:Y}function GJ(Z){let $={},X=Z.belongsTo;if(!X)return $;let J=Array.isArray(X)?X:Object.values(X);for(let Y of J){if(typeof Y==="string"){$[`${r(Y)}_id`]="number";continue}if(Y&&typeof Y==="object"){let Q=Y;if(typeof Q.foreignKey==="string"){$[Q.foreignKey]="number";continue}if(typeof Q.model==="string")$[`${r(Q.model)}_id`]="number"}}return $}function WJ(Z,$){let[X,J]=[r(Z),r($)].sort();return`${X}_${J}`}function BJ(Z){let $=Z.default,X=typeof $==="string"?"string":typeof $==="number"?"number":typeof $==="boolean"?"boolean":$ instanceof Date?"string":"unknown";return Z.nullable?`${X} | null`:X}function VJ(Z,$){let X=$.belongsToMany;if(!X)return[];let J=[],Y=Array.isArray(X)?X:Object.values(X);for(let Q of Y){let G,W,V,B,H={},z=!0;if(typeof Q==="string")G=Q;else if(Q&&typeof Q==="object"&&"model"in Q){let q=Q;if(G=q.model,"pivotTable"in q||"firstForeignKey"in q||"secondForeignKey"in q)W=q.pivotTable,V=q.firstForeignKey,B=q.secondForeignKey;else{let L=Q;W=L.table,V=L.foreignKey,B=L.relatedKey,H=L.pivot?.columns??{},z=Boolean(L.pivot?.timestamps)}}else continue;let O=W??WJ(Z,G),F=V??`${r(Z)}_id`,w=B??`${r(G)}_id`,T={id:"number",[F]:"number",[w]:"number"};for(let[q,L]of Object.entries(H))T[q]=BJ(L);if(z)T.created_at="string",T.updated_at="string | null";J.push({table:O,columns:T})}return J}var KJ={email_verified_at:"string | null",password_changed_at:"string | null",two_factor_secret:"string | null",two_factor_enabled:"boolean | null",two_factor_last_used_step:"number | null",stripe_id:"string | null"};function HJ(Z){let $={id:"number"},X=Z.traits??{};if(X.useUuid)$.uuid="string";if((X.useTimestamps??X.timestampable)!==!1)$.created_at="string",$.updated_at="string | null";if(X.useSoftDeletes??X.softDeletable)$.deleted_at="string | null";if((Z.table??"")==="users"||Z.name==="User")Object.assign($,KJ);return $}function zJ(Z){let $={},X=Z.attributes??{};for(let[J,Y]of Object.entries(X))$[r(J)]=QJ(Y);return $}function OJ(Z){return Z.replace(/_([a-z0-9])/g,($,X)=>X.toUpperCase())}function _J(Z){let $={...Z};for(let[X,J]of Object.entries(Z)){let Y=OJ(X);if(Y!==X&&!(Y in $))$[Y]=J}return $}function b7(Z,$,X=2){let J=" ".repeat(X),Y=" ".repeat(X+1),Q=Object.entries($).map(([W,V])=>`${Y}${W}: ${V}`).join(`
16
- `),G=/^[A-Z_a-z]\w*$/.test(Z)?Z:`'${Z}'`;return`${J}${G}: {
17
- ${Y}// columns
18
- ${Q}
19
- ${J}}`}var FJ=`/* eslint-disable */
13
+ `+x+`
14
+ `+P})}let U=Math.floor((typeof R==="number"?R:Date.now())/1000)-p.timestamp;if(k>0&&U>k)throw new N(m,u,{message:"Timestamp outside the tolerance zone"});return!0}function s(u,m){if(typeof u!=="string")return null;return m=m||n.EXPECTED_SCHEME,u.split(",").reduce((p,_)=>{let k=_.split("=");if(k[0]==="t")p.timestamp=parseInt(k[1],10);if(k[0]===m)p.signatures.push(k[1]);return p},{timestamp:-1,signatures:[]})}let a=null;function c(){if(!a)a=e.createDefaultCryptoProvider();return a}function l(u){if(!u)throw new j({message:"Options are required"});let m=u.timestamp&&Math.floor(u.timestamp)||Math.floor(Date.now()/1000),p=u.scheme||n.EXPECTED_SCHEME,_=u.cryptoProvider||c(),k=`${m}.${u.payload}`;return{...u,timestamp:m,scheme:p,cryptoProvider:_,payloadString:k,generateHeaderString:(y)=>`t=${m},${p}=${y}`}}return t.signature=n,t}var El=f(()=>{xi();yi()});var qr="2026-06-24.dahlia";function Yd(e,t){for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let i=n[0].toLowerCase()+n.substring(1),r=new t[n](e);this[i]=r}}function S(e,t){return function(n){return new Yd(n,t)}}var Ce;var Or=f(()=>{b();Ce=class Ce extends d{create(e,t){return this._makeRequest("POST","/v2/core/account_links",e,t)}}});var je;var Ar=f(()=>{b();je=class je extends d{create(e,t){return this._makeRequest("POST","/v2/core/account_tokens",e,t,{requestSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v2/core/account_tokens/${encodeURIComponent(e)}`,t,n)}}});var Pe;var Ir=f(()=>{b();Pe=class Pe extends d{list(e,t){return this._makeRequest("GET","/v1/financial_connections/accounts",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/financial_connections/accounts/${encodeURIComponent(e)}`,t,n)}disconnect(e,t,n){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(e)}/disconnect`,t,n)}refresh(e,t,n){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(e)}/refresh`,t,n)}subscribe(e,t,n){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(e)}/subscribe`,t,n)}unsubscribe(e,t,n){return this._makeRequest("POST",`/v1/financial_connections/accounts/${encodeURIComponent(e)}/unsubscribe`,t,n)}listOwners(e,t,n){return this._makeRequest("GET",`/v1/financial_connections/accounts/${encodeURIComponent(e)}/owners`,t,n,{methodType:"list"})}}});var $r;var ql=f(()=>{b();$r=class $r extends d{list(e,t,n){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(e)}/persons`,t,n,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}})}create(e,t,n){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(e)}/persons`,t,n,{requestSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}del(e,t,n,i){return this._makeRequest("DELETE",`/v2/core/accounts/${encodeURIComponent(e)}/persons/${encodeURIComponent(t)}`,n,i)}retrieve(e,t,n,i){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(e)}/persons/${encodeURIComponent(t)}`,n,i,{responseSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}update(e,t,n,i){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(e)}/persons/${encodeURIComponent(t)}`,n,i,{requestSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}}});var Ur;var Ol=f(()=>{b();Ur=class Ur extends d{create(e,t,n){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(e)}/person_tokens`,t,n,{requestSchema:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}})}retrieve(e,t,n,i){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(e)}/person_tokens/${encodeURIComponent(t)}`,n,i)}}});var Ee;var Mr=f(()=>{b();ql();Ol();Ee=class Ee extends d{constructor(e){super(e);this.stripe=e,this.persons=new $r(e),this.personTokens=new Ur(e)}list(e,t){return this._makeRequest("GET","/v2/core/accounts",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v2/core/accounts",e,t,{requestSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}},responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v2/core/accounts/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(e)}`,t,n,{requestSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}},responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}close(e,t,n){return this._makeRequest("POST",`/v2/core/accounts/${encodeURIComponent(e)}/close`,t,n,{responseSchema:{kind:"object",fields:{identity:{kind:"object",fields:{individual:{kind:"object",fields:{relationship:{kind:"object",fields:{percent_ownership:{kind:"decimal_string"}}}}}}}}}})}}});var qe;var Dr=f(()=>{b();qe=class qe extends d{list(e,t){return this._makeRequest("GET","/v1/entitlements/active_entitlements",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/entitlements/active_entitlements/${encodeURIComponent(e)}`,t,n)}}});var Oe;var Fr=f(()=>{b();Oe=class Oe extends d{list(e,t){return this._makeRequest("GET","/v1/billing/alerts",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/billing/alerts",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/billing/alerts/${encodeURIComponent(e)}`,t,n)}activate(e,t,n){return this._makeRequest("POST",`/v1/billing/alerts/${encodeURIComponent(e)}/activate`,t,n)}archive(e,t,n){return this._makeRequest("POST",`/v1/billing/alerts/${encodeURIComponent(e)}/archive`,t,n)}deactivate(e,t,n){return this._makeRequest("POST",`/v1/billing/alerts/${encodeURIComponent(e)}/deactivate`,t,n)}}});var Ae;var Nr=f(()=>{b();Ae=class Ae extends d{find(e,t){return this._makeRequest("GET","/v1/tax/associations/find",e,t)}}});var Ie;var Gr=f(()=>{b();Ie=class Ie extends d{list(e,t){return this._makeRequest("GET","/v1/issuing/authorizations",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/issuing/authorizations/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/issuing/authorizations/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}approve(e,t,n){return this._makeRequest("POST",`/v1/issuing/authorizations/${encodeURIComponent(e)}/approve`,t,n,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}decline(e,t,n){return this._makeRequest("POST",`/v1/issuing/authorizations/${encodeURIComponent(e)}/decline`,t,n,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}}});var $e;var Br=f(()=>{b();$e=class $e extends d{create(e,t){return this._makeRequest("POST","/v1/test_helpers/issuing/authorizations",e,t,{requestSchema:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}capture(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(e)}/capture`,t,n,{requestSchema:{kind:"object",fields:{purchase_details:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}},receipt:{kind:"array",element:{kind:"object",fields:{quantity:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}expire(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(e)}/expire`,t,n,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}finalizeAmount(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(e)}/finalize_amount`,t,n,{requestSchema:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}respond(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(e)}/fraud_challenges/respond`,t,n,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}increment(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(e)}/increment`,t,n,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}reverse(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/authorizations/${encodeURIComponent(e)}/reverse`,t,n,{responseSchema:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}}});var Ue;var Lr=f(()=>{b();Ue=class Ue extends d{retrieve(e,t,n){return this._makeRequest("GET",`/v1/tax/calculations/${encodeURIComponent(e)}`,t,n)}create(e,t){return this._makeRequest("POST","/v1/tax/calculations",e,t)}listLineItems(e,t,n){return this._makeRequest("GET",`/v1/tax/calculations/${encodeURIComponent(e)}/line_items`,t,n,{methodType:"list"})}}});var Me;var Kr=f(()=>{b();Me=class Me extends d{list(e,t){return this._makeRequest("GET","/v1/issuing/cardholders",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/issuing/cardholders",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/issuing/cardholders/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/issuing/cardholders/${encodeURIComponent(e)}`,t,n)}}});var De;var Hr=f(()=>{b();De=class De extends d{list(e,t){return this._makeRequest("GET","/v1/issuing/cards",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/issuing/cards",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/issuing/cards/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/issuing/cards/${encodeURIComponent(e)}`,t,n)}}});var Fe;var Vr=f(()=>{b();Fe=class Fe extends d{deliverCard(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(e)}/shipping/deliver`,t,n)}failCard(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(e)}/shipping/fail`,t,n)}returnCard(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(e)}/shipping/return`,t,n)}shipCard(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(e)}/shipping/ship`,t,n)}submitCard(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/cards/${encodeURIComponent(e)}/shipping/submit`,t,n)}}});var Ne;var zr=f(()=>{b();Ne=class Ne extends d{list(e,t){return this._makeRequest("GET","/v1/billing_portal/configurations",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/billing_portal/configurations",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/billing_portal/configurations/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/billing_portal/configurations/${encodeURIComponent(e)}`,t,n)}}});var Ge;var Wr=f(()=>{b();Ge=class Ge extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/terminal/configurations/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/terminal/configurations/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/terminal/configurations/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/terminal/configurations",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/terminal/configurations",e,t)}}});var Be;var Qr=f(()=>{b();Be=class Be extends d{create(e,t){return this._makeRequest("POST","/v1/test_helpers/confirmation_tokens",e,t)}}});var Le;var Jr=f(()=>{b();Le=class Le extends d{create(e,t){return this._makeRequest("POST","/v1/terminal/connection_tokens",e,t)}}});var Ke;var Xr=f(()=>{b();Ke=class Ke extends d{retrieve(e,t){return this._makeRequest("GET","/v1/billing/credit_balance_summary",e,t)}}});var He;var Yr=f(()=>{b();He=class He extends d{list(e,t){return this._makeRequest("GET","/v1/billing/credit_balance_transactions",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/billing/credit_balance_transactions/${encodeURIComponent(e)}`,t,n)}}});var Ve;var Zr=f(()=>{b();Ve=class Ve extends d{list(e,t){return this._makeRequest("GET","/v1/billing/credit_grants",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/billing/credit_grants",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/billing/credit_grants/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/billing/credit_grants/${encodeURIComponent(e)}`,t,n)}expire(e,t,n){return this._makeRequest("POST",`/v1/billing/credit_grants/${encodeURIComponent(e)}/expire`,t,n)}voidGrant(e,t,n){return this._makeRequest("POST",`/v1/billing/credit_grants/${encodeURIComponent(e)}/void`,t,n)}}});var ze;var eo=f(()=>{b();ze=class ze extends d{list(e,t){return this._makeRequest("GET","/v1/treasury/credit_reversals",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/treasury/credit_reversals",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/treasury/credit_reversals/${encodeURIComponent(e)}`,t,n)}}});var We;var to=f(()=>{b();We=class We extends d{fundCashBalance(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/customers/${encodeURIComponent(e)}/fund_cash_balance`,t,n)}}});var Qe;var no=f(()=>{b();Qe=class Qe extends d{list(e,t){return this._makeRequest("GET","/v1/treasury/debit_reversals",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/treasury/debit_reversals",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/treasury/debit_reversals/${encodeURIComponent(e)}`,t,n)}}});var Je;var io=f(()=>{b();Je=class Je extends d{list(e,t){return this._makeRequest("GET","/v1/issuing/disputes",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/issuing/disputes",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/issuing/disputes/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/issuing/disputes/${encodeURIComponent(e)}`,t,n)}submit(e,t,n){return this._makeRequest("POST",`/v1/issuing/disputes/${encodeURIComponent(e)}/submit`,t,n)}}});var Xe;var ro=f(()=>{b();Xe=class Xe extends d{list(e,t){return this._makeRequest("GET","/v1/radar/early_fraud_warnings",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/radar/early_fraud_warnings/${encodeURIComponent(e)}`,t,n)}}});var Ye;var oo=f(()=>{b();Ye=class Ye extends d{list(e,t){return this._makeRequest("GET","/v2/core/event_destinations",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v2/core/event_destinations",e,t)}del(e,t,n){return this._makeRequest("DELETE",`/v2/core/event_destinations/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v2/core/event_destinations/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(e)}`,t,n)}disable(e,t,n){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(e)}/disable`,t,n)}enable(e,t,n){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(e)}/enable`,t,n)}ping(e,t,n){return this._makeRequest("POST",`/v2/core/event_destinations/${encodeURIComponent(e)}/ping`,t,n)}}});var Ze;var so=f(()=>{b();Ze=class Ze extends d{list(e,t){let n=(i)=>({...i,data:i.data.map(this.addFetchRelatedObjectIfNeeded.bind(this))});return this._makeRequest("GET","/v2/core/events",e,t,{methodType:"list",transformResponseData:n})}retrieve(e,t,n){let i=(r)=>this.addFetchRelatedObjectIfNeeded(r);return this._makeRequest("GET",`/v2/core/events/${encodeURIComponent(e)}`,t,n,{transformResponseData:i})}addFetchRelatedObjectIfNeeded(e){if(!e.related_object||!e.related_object.url)return e;return{...e,fetchRelatedObject:()=>this._makeRequest("GET",e.related_object.url,void 0,{stripeContext:e.context,headers:{"Stripe-Request-Trigger":`event=${e.id}`}})}}}});var et;var ao=f(()=>{b();et=class et extends d{list(e,t){return this._makeRequest("GET","/v1/entitlements/features",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/entitlements/features",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/entitlements/features/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/entitlements/features/${encodeURIComponent(e)}`,t,n)}}});var tt;var lo=f(()=>{b();tt=class tt extends d{list(e,t){return this._makeRequest("GET","/v1/treasury/financial_accounts",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/treasury/financial_accounts",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/treasury/financial_accounts/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/treasury/financial_accounts/${encodeURIComponent(e)}`,t,n)}close(e,t,n){return this._makeRequest("POST",`/v1/treasury/financial_accounts/${encodeURIComponent(e)}/close`,t,n)}updateFeatures(e,t,n){return this._makeRequest("POST",`/v1/treasury/financial_accounts/${encodeURIComponent(e)}/features`,t,n)}retrieveFeatures(e,t,n){return this._makeRequest("GET",`/v1/treasury/financial_accounts/${encodeURIComponent(e)}/features`,t,n)}}});var nt;var co=f(()=>{b();nt=class nt extends d{list(e,t){return this._makeRequest("GET","/v2/commerce/product_catalog/imports",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{status_details:{kind:"object",fields:{processing:{kind:"object",fields:{error_count:{kind:"int64_string"},success_count:{kind:"int64_string"}}},succeeded:{kind:"object",fields:{success_count:{kind:"int64_string"}}},succeeded_with_errors:{kind:"object",fields:{error_count:{kind:"int64_string"},error_file:{kind:"object",fields:{size:{kind:"int64_string"}}},samples:{kind:"array",element:{kind:"object",fields:{row:{kind:"int64_string"}}}},success_count:{kind:"int64_string"}}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v2/commerce/product_catalog/imports",e,t,{responseSchema:{kind:"object",fields:{status_details:{kind:"object",fields:{processing:{kind:"object",fields:{error_count:{kind:"int64_string"},success_count:{kind:"int64_string"}}},succeeded:{kind:"object",fields:{success_count:{kind:"int64_string"}}},succeeded_with_errors:{kind:"object",fields:{error_count:{kind:"int64_string"},error_file:{kind:"object",fields:{size:{kind:"int64_string"}}},samples:{kind:"array",element:{kind:"object",fields:{row:{kind:"int64_string"}}}},success_count:{kind:"int64_string"}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v2/commerce/product_catalog/imports/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{status_details:{kind:"object",fields:{processing:{kind:"object",fields:{error_count:{kind:"int64_string"},success_count:{kind:"int64_string"}}},succeeded:{kind:"object",fields:{success_count:{kind:"int64_string"}}},succeeded_with_errors:{kind:"object",fields:{error_count:{kind:"int64_string"},error_file:{kind:"object",fields:{size:{kind:"int64_string"}}},samples:{kind:"array",element:{kind:"object",fields:{row:{kind:"int64_string"}}}},success_count:{kind:"int64_string"}}}}}}}})}}});var it;var uo=f(()=>{b();it=class it extends d{fail(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/inbound_transfers/${encodeURIComponent(e)}/fail`,t,n)}returnInboundTransfer(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/inbound_transfers/${encodeURIComponent(e)}/return`,t,n)}succeed(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/inbound_transfers/${encodeURIComponent(e)}/succeed`,t,n)}}});var rt;var mo=f(()=>{b();rt=class rt extends d{list(e,t){return this._makeRequest("GET","/v1/treasury/inbound_transfers",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/treasury/inbound_transfers",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/treasury/inbound_transfers/${encodeURIComponent(e)}`,t,n)}cancel(e,t,n){return this._makeRequest("POST",`/v1/treasury/inbound_transfers/${encodeURIComponent(e)}/cancel`,t,n)}}});var ot;var po=f(()=>{b();ot=class ot extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/terminal/locations/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/terminal/locations/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/terminal/locations/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/terminal/locations",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/terminal/locations",e,t)}}});var st;var fo=f(()=>{b();st=class st extends d{create(e,t){return this._makeRequest("POST","/v1/billing/meter_event_adjustments",e,t)}}});var at;var _o=f(()=>{b();at=class at extends d{create(e,t){return this._makeRequest("POST","/v2/billing/meter_event_adjustments",e,t)}}});var lt;var ko=f(()=>{b();lt=class lt extends d{create(e,t){return this._makeRequest("POST","/v2/billing/meter_event_session",e,t)}}});var ct;var bo=f(()=>{b();ct=class ct extends d{create(e,t){return this._makeRequest("POST","/v2/billing/meter_event_stream",e,t,{apiBase:"meter_events"})}}});var dt;var go=f(()=>{b();dt=class dt extends d{create(e,t){return this._makeRequest("POST","/v1/billing/meter_events",e,t)}}});var ut;var ho=f(()=>{b();ut=class ut extends d{create(e,t){return this._makeRequest("POST","/v2/billing/meter_events",e,t)}}});var mt;var yo=f(()=>{b();mt=class mt extends d{list(e,t){return this._makeRequest("GET","/v1/billing/meters",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/billing/meters",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/billing/meters/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/billing/meters/${encodeURIComponent(e)}`,t,n)}deactivate(e,t,n){return this._makeRequest("POST",`/v1/billing/meters/${encodeURIComponent(e)}/deactivate`,t,n)}reactivate(e,t,n){return this._makeRequest("POST",`/v1/billing/meters/${encodeURIComponent(e)}/reactivate`,t,n)}listEventSummaries(e,t,n){return this._makeRequest("GET",`/v1/billing/meters/${encodeURIComponent(e)}/event_summaries`,t,n,{methodType:"list"})}}});var pt;var Ro=f(()=>{b();pt=class pt extends d{create(e,t){return this._makeRequest("POST","/v1/terminal/onboarding_links",e,t)}}});var ft;var To=f(()=>{b();ft=class ft extends d{list(e,t){return this._makeRequest("GET","/v1/climate/orders",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/climate/orders",e,t,{requestSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/climate/orders/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/climate/orders/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}cancel(e,t,n){return this._makeRequest("POST",`/v1/climate/orders/${encodeURIComponent(e)}/cancel`,t,n,{responseSchema:{kind:"object",fields:{metric_tons:{kind:"decimal_string"}}}})}}});var _t;var wo=f(()=>{b();_t=class _t extends d{update(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(e)}`,t,n)}fail(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(e)}/fail`,t,n)}post(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(e)}/post`,t,n)}returnOutboundPayment(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_payments/${encodeURIComponent(e)}/return`,t,n)}}});var kt;var vo=f(()=>{b();kt=class kt extends d{list(e,t){return this._makeRequest("GET","/v1/treasury/outbound_payments",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/treasury/outbound_payments",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/treasury/outbound_payments/${encodeURIComponent(e)}`,t,n)}cancel(e,t,n){return this._makeRequest("POST",`/v1/treasury/outbound_payments/${encodeURIComponent(e)}/cancel`,t,n)}}});var bt;var So=f(()=>{b();bt=class bt extends d{update(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(e)}`,t,n)}fail(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(e)}/fail`,t,n)}post(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(e)}/post`,t,n)}returnOutboundTransfer(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/treasury/outbound_transfers/${encodeURIComponent(e)}/return`,t,n)}}});var gt;var xo=f(()=>{b();gt=class gt extends d{list(e,t){return this._makeRequest("GET","/v1/treasury/outbound_transfers",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/treasury/outbound_transfers",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/treasury/outbound_transfers/${encodeURIComponent(e)}`,t,n)}cancel(e,t,n){return this._makeRequest("POST",`/v1/treasury/outbound_transfers/${encodeURIComponent(e)}/cancel`,t,n)}}});var ht;var Co=f(()=>{b();ht=class ht extends d{create(e,t){return this._makeRequest("POST","/v1/radar/payment_evaluations",e,t)}}});var yt;var jo=f(()=>{b();yt=class yt extends d{list(e,t){return this._makeRequest("GET","/v1/issuing/personalization_designs",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/issuing/personalization_designs",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/issuing/personalization_designs/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/issuing/personalization_designs/${encodeURIComponent(e)}`,t,n)}}});var Rt;var Po=f(()=>{b();Rt=class Rt extends d{activate(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/personalization_designs/${encodeURIComponent(e)}/activate`,t,n)}deactivate(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/personalization_designs/${encodeURIComponent(e)}/deactivate`,t,n)}reject(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/personalization_designs/${encodeURIComponent(e)}/reject`,t,n)}}});var Tt;var Eo=f(()=>{b();Tt=class Tt extends d{list(e,t){return this._makeRequest("GET","/v1/issuing/physical_bundles",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/issuing/physical_bundles/${encodeURIComponent(e)}`,t,n)}}});var wt;var qo=f(()=>{b();wt=class wt extends d{list(e,t){return this._makeRequest("GET","/v1/climate/products",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{metric_tons_available:{kind:"decimal_string"}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/climate/products/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{metric_tons_available:{kind:"decimal_string"}}}})}}});var vt;var Oo=f(()=>{b();vt=class vt extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/terminal/readers/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/terminal/readers/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/terminal/readers",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/terminal/readers",e,t)}cancelAction(e,t,n){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(e)}/cancel_action`,t,n)}collectInputs(e,t,n){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(e)}/collect_inputs`,t,n)}collectPaymentMethod(e,t,n){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(e)}/collect_payment_method`,t,n)}confirmPaymentIntent(e,t,n){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(e)}/confirm_payment_intent`,t,n)}processPaymentIntent(e,t,n){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(e)}/process_payment_intent`,t,n)}processSetupIntent(e,t,n){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(e)}/process_setup_intent`,t,n)}refundPayment(e,t,n){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(e)}/refund_payment`,t,n)}setReaderDisplay(e,t,n){return this._makeRequest("POST",`/v1/terminal/readers/${encodeURIComponent(e)}/set_reader_display`,t,n)}}});var St;var Ao=f(()=>{b();St=class St extends d{presentPaymentMethod(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/terminal/readers/${encodeURIComponent(e)}/present_payment_method`,t,n)}succeedInputCollection(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/terminal/readers/${encodeURIComponent(e)}/succeed_input_collection`,t,n)}timeoutInputCollection(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/terminal/readers/${encodeURIComponent(e)}/timeout_input_collection`,t,n)}}});var xt;var Io=f(()=>{b();xt=class xt extends d{create(e,t){return this._makeRequest("POST","/v1/test_helpers/treasury/received_credits",e,t)}}});var Ct;var $o=f(()=>{b();Ct=class Ct extends d{list(e,t){return this._makeRequest("GET","/v1/treasury/received_credits",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/treasury/received_credits/${encodeURIComponent(e)}`,t,n)}}});var jt;var Uo=f(()=>{b();jt=class jt extends d{create(e,t){return this._makeRequest("POST","/v1/test_helpers/treasury/received_debits",e,t)}}});var Pt;var Mo=f(()=>{b();Pt=class Pt extends d{list(e,t){return this._makeRequest("GET","/v1/treasury/received_debits",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/treasury/received_debits/${encodeURIComponent(e)}`,t,n)}}});var Et;var Do=f(()=>{b();Et=class Et extends d{expire(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/refunds/${encodeURIComponent(e)}/expire`,t,n)}}});var qt;var Fo=f(()=>{b();qt=class qt extends d{list(e,t){return this._makeRequest("GET","/v1/tax/registrations",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/tax/registrations",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/tax/registrations/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/tax/registrations/${encodeURIComponent(e)}`,t,n)}}});var Ot;var No=f(()=>{b();Ot=class Ot extends d{list(e,t){return this._makeRequest("GET","/v1/reporting/report_runs",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/reporting/report_runs",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/reporting/report_runs/${encodeURIComponent(e)}`,t,n)}}});var At;var Go=f(()=>{b();At=class At extends d{list(e,t){return this._makeRequest("GET","/v1/reporting/report_types",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/reporting/report_types/${encodeURIComponent(e)}`,t,n)}}});var It;var Bo=f(()=>{b();It=class It extends d{list(e,t){return this._makeRequest("GET","/v1/forwarding/requests",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/forwarding/requests",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/forwarding/requests/${encodeURIComponent(e)}`,t,n)}}});var $t;var Lo=f(()=>{b();$t=class $t extends d{list(e,t){return this._makeRequest("GET","/v1/sigma/scheduled_query_runs",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/sigma/scheduled_query_runs/${encodeURIComponent(e)}`,t,n)}}});var Ut;var Ko=f(()=>{b();Ut=class Ut extends d{list(e,t){return this._makeRequest("GET","/v1/apps/secrets",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/apps/secrets",e,t)}find(e,t){return this._makeRequest("GET","/v1/apps/secrets/find",e,t)}deleteWhere(e,t){return this._makeRequest("POST","/v1/apps/secrets/delete",e,t)}}});var Mt;var Ho=f(()=>{b();Mt=class Mt extends d{create(e,t){return this._makeRequest("POST","/v1/billing_portal/sessions",e,t)}}});var Dt;var Vo=f(()=>{b();Dt=class Dt extends d{list(e,t){return this._makeRequest("GET","/v1/checkout/sessions",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/checkout/sessions",e,t,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/checkout/sessions/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/checkout/sessions/${encodeURIComponent(e)}`,t,n,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}expire(e,t,n){return this._makeRequest("POST",`/v1/checkout/sessions/${encodeURIComponent(e)}/expire`,t,n,{responseSchema:{kind:"object",fields:{currency_conversion:{kind:"nullable",inner:{kind:"object",fields:{fx_rate:{kind:"decimal_string"}}}},line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}listLineItems(e,t,n){return this._makeRequest("GET",`/v1/checkout/sessions/${encodeURIComponent(e)}/line_items`,t,n,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var Ft;var zo=f(()=>{b();Ft=class Ft extends d{retrieve(e,t,n){return this._makeRequest("GET",`/v1/financial_connections/sessions/${encodeURIComponent(e)}`,t,n)}create(e,t){return this._makeRequest("POST","/v1/financial_connections/sessions",e,t)}}});var Nt;var Wo=f(()=>{b();Nt=class Nt extends d{retrieve(e,t){return this._makeRequest("GET","/v1/tax/settings",e,t)}update(e,t){return this._makeRequest("POST","/v1/tax/settings",e,t)}}});var Gt;var Qo=f(()=>{b();Gt=class Gt extends d{list(e,t){return this._makeRequest("GET","/v1/climate/suppliers",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/climate/suppliers/${encodeURIComponent(e)}`,t,n)}}});var Bt;var Jo=f(()=>{b();Bt=class Bt extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/test_helpers/test_clocks/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/test_helpers/test_clocks/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/test_helpers/test_clocks",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/test_helpers/test_clocks",e,t)}advance(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/test_clocks/${encodeURIComponent(e)}/advance`,t,n)}}});var Lt;var Xo=f(()=>{b();Lt=class Lt extends d{list(e,t){return this._makeRequest("GET","/v1/issuing/tokens",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/issuing/tokens/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/issuing/tokens/${encodeURIComponent(e)}`,t,n)}}});var Kt;var Yo=f(()=>{b();Kt=class Kt extends d{list(e,t){return this._makeRequest("GET","/v1/treasury/transaction_entries",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/treasury/transaction_entries/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}})}}});var Ht;var Zo=f(()=>{b();Ht=class Ht extends d{list(e,t){return this._makeRequest("GET","/v1/financial_connections/transactions",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/financial_connections/transactions/${encodeURIComponent(e)}`,t,n)}}});var Vt;var es=f(()=>{b();Vt=class Vt extends d{list(e,t){return this._makeRequest("GET","/v1/issuing/transactions",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/issuing/transactions/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/issuing/transactions/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}}});var zt;var ts=f(()=>{b();zt=class zt extends d{retrieve(e,t,n){return this._makeRequest("GET",`/v1/tax/transactions/${encodeURIComponent(e)}`,t,n)}createFromCalculation(e,t){return this._makeRequest("POST","/v1/tax/transactions/create_from_calculation",e,t)}createReversal(e,t){return this._makeRequest("POST","/v1/tax/transactions/create_reversal",e,t)}listLineItems(e,t,n){return this._makeRequest("GET",`/v1/tax/transactions/${encodeURIComponent(e)}/line_items`,t,n,{methodType:"list"})}}});var Wt;var ns=f(()=>{b();Wt=class Wt extends d{refund(e,t,n){return this._makeRequest("POST",`/v1/test_helpers/issuing/transactions/${encodeURIComponent(e)}/refund`,t,n,{responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}createForceCapture(e,t){return this._makeRequest("POST","/v1/test_helpers/issuing/transactions/create_force_capture",e,t,{requestSchema:{kind:"object",fields:{purchase_details:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}},receipt:{kind:"array",element:{kind:"object",fields:{quantity:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}createUnlinkedRefund(e,t){return this._makeRequest("POST","/v1/test_helpers/issuing/transactions/create_unlinked_refund",e,t,{requestSchema:{kind:"object",fields:{purchase_details:{kind:"object",fields:{fleet:{kind:"object",fields:{reported_breakdown:{kind:"object",fields:{fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},non_fuel:{kind:"object",fields:{gross_amount_decimal:{kind:"decimal_string"}}},tax:{kind:"object",fields:{local_amount_decimal:{kind:"decimal_string"},national_amount_decimal:{kind:"decimal_string"}}}}}}},fuel:{kind:"object",fields:{quantity_decimal:{kind:"decimal_string"},unit_cost_decimal:{kind:"decimal_string"}}},receipt:{kind:"array",element:{kind:"object",fields:{quantity:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}})}}});var Qt;var is=f(()=>{b();Qt=class Qt extends d{list(e,t){return this._makeRequest("GET","/v1/treasury/transactions",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{entries:{kind:"nullable",inner:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/treasury/transactions/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{entries:{kind:"nullable",inner:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{flow_details:{kind:"nullable",inner:{kind:"object",fields:{issuing_authorization:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},transactions:{kind:"array",element:{kind:"object",fields:{purchase_details:{kind:"nullable",inner:{kind:"object",fields:{fleet:{kind:"nullable",inner:{kind:"object",fields:{reported_breakdown:{kind:"nullable",inner:{kind:"object",fields:{fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},non_fuel:{kind:"nullable",inner:{kind:"object",fields:{gross_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tax:{kind:"nullable",inner:{kind:"object",fields:{local_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},national_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}},fuel:{kind:"nullable",inner:{kind:"object",fields:{quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_cost_decimal:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}}}}}})}}});var Jt;var rs=f(()=>{b();Jt=class Jt extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/radar/value_list_items/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/radar/value_list_items/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/radar/value_list_items",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/radar/value_list_items",e,t)}}});var Xt;var os=f(()=>{b();Xt=class Xt extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/radar/value_lists/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/radar/value_lists/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/radar/value_lists/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/radar/value_lists",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/radar/value_lists",e,t)}}});var Yt;var ss=f(()=>{b();Yt=class Yt extends d{list(e,t){return this._makeRequest("GET","/v1/identity/verification_reports",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/identity/verification_reports/${encodeURIComponent(e)}`,t,n)}}});var Zt;var as=f(()=>{b();Zt=class Zt extends d{list(e,t){return this._makeRequest("GET","/v1/identity/verification_sessions",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/identity/verification_sessions",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/identity/verification_sessions/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/identity/verification_sessions/${encodeURIComponent(e)}`,t,n)}cancel(e,t,n){return this._makeRequest("POST",`/v1/identity/verification_sessions/${encodeURIComponent(e)}/cancel`,t,n)}redact(e,t,n){return this._makeRequest("POST",`/v1/identity/verification_sessions/${encodeURIComponent(e)}/redact`,t,n)}}});var oe;var Ci=f(()=>{b();oe=class oe extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/accounts/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){if(typeof e==="string")return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(e)}`,t,n);else return this._makeRequest("GET","/v1/account",t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(e)}`,t,n)}retrieveCurrent(e,t){return this._makeRequest("GET","/v1/account",e,t)}list(e,t){return this._makeRequest("GET","/v1/accounts",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/accounts",e,t)}reject(e,t,n){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(e)}/reject`,t,n)}listCapabilities(e,t,n){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(e)}/capabilities`,t,n,{methodType:"list"})}retrieveCapability(e,t,n,i){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(e)}/capabilities/${encodeURIComponent(t)}`,n,i)}updateCapability(e,t,n,i){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(e)}/capabilities/${encodeURIComponent(t)}`,n,i)}deleteExternalAccount(e,t,n,i){return this._makeRequest("DELETE",`/v1/accounts/${encodeURIComponent(e)}/external_accounts/${encodeURIComponent(t)}`,n,i)}retrieveExternalAccount(e,t,n,i){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(e)}/external_accounts/${encodeURIComponent(t)}`,n,i)}updateExternalAccount(e,t,n,i){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(e)}/external_accounts/${encodeURIComponent(t)}`,n,i)}listExternalAccounts(e,t,n){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(e)}/external_accounts`,t,n,{methodType:"list"})}createExternalAccount(e,t,n){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(e)}/external_accounts`,t,n)}createLoginLink(e,t,n){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(e)}/login_links`,t,n)}deletePerson(e,t,n,i){return this._makeRequest("DELETE",`/v1/accounts/${encodeURIComponent(e)}/persons/${encodeURIComponent(t)}`,n,i)}retrievePerson(e,t,n,i){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(e)}/persons/${encodeURIComponent(t)}`,n,i)}updatePerson(e,t,n,i){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(e)}/persons/${encodeURIComponent(t)}`,n,i)}listPersons(e,t,n){return this._makeRequest("GET",`/v1/accounts/${encodeURIComponent(e)}/persons`,t,n,{methodType:"list"})}createPerson(e,t,n){return this._makeRequest("POST",`/v1/accounts/${encodeURIComponent(e)}/persons`,t,n)}}});var en;var ls=f(()=>{b();en=class en extends d{create(e,t){return this._makeRequest("POST","/v1/account_links",e,t)}}});var tn;var cs=f(()=>{b();tn=class tn extends d{create(e,t){return this._makeRequest("POST","/v1/account_sessions",e,t)}}});var nn;var ds=f(()=>{b();nn=class nn extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/apple_pay/domains/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/apple_pay/domains/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/apple_pay/domains",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/apple_pay/domains",e,t)}}});var rn;var us=f(()=>{b();rn=class rn extends d{list(e,t){return this._makeRequest("GET","/v1/application_fees",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/application_fees/${encodeURIComponent(e)}`,t,n)}retrieveRefund(e,t,n,i){return this._makeRequest("GET",`/v1/application_fees/${encodeURIComponent(e)}/refunds/${encodeURIComponent(t)}`,n,i)}updateRefund(e,t,n,i){return this._makeRequest("POST",`/v1/application_fees/${encodeURIComponent(e)}/refunds/${encodeURIComponent(t)}`,n,i)}listRefunds(e,t,n){return this._makeRequest("GET",`/v1/application_fees/${encodeURIComponent(e)}/refunds`,t,n,{methodType:"list"})}createRefund(e,t,n){return this._makeRequest("POST",`/v1/application_fees/${encodeURIComponent(e)}/refunds`,t,n)}}});var se;var ji=f(()=>{b();se=class se extends d{retrieve(e,t){return this._makeRequest("GET","/v1/balance",e,t)}}});var on;var ms=f(()=>{b();on=class on extends d{retrieve(e,t){return this._makeRequest("GET","/v1/balance_settings",e,t)}update(e,t){return this._makeRequest("POST","/v1/balance_settings",e,t)}}});var sn;var ps=f(()=>{b();sn=class sn extends d{list(e,t){return this._makeRequest("GET","/v1/balance_transactions",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/balance_transactions/${encodeURIComponent(e)}`,t,n)}}});var an;var fs=f(()=>{b();an=class an extends d{list(e,t){return this._makeRequest("GET","/v1/charges",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/charges",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/charges/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/charges/${encodeURIComponent(e)}`,t,n)}search(e,t){return this._makeRequest("GET","/v1/charges/search",e,t,{methodType:"search"})}capture(e,t,n){return this._makeRequest("POST",`/v1/charges/${encodeURIComponent(e)}/capture`,t,n)}}});var ln;var _s=f(()=>{b();ln=class ln extends d{retrieve(e,t,n){return this._makeRequest("GET",`/v1/confirmation_tokens/${encodeURIComponent(e)}`,t,n)}}});var cn;var ks=f(()=>{b();cn=class cn extends d{list(e,t){return this._makeRequest("GET","/v1/country_specs",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/country_specs/${encodeURIComponent(e)}`,t,n)}}});var dn;var bs=f(()=>{b();dn=class dn extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/coupons/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/coupons/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/coupons/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/coupons",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/coupons",e,t)}}});var un;var gs=f(()=>{b();un=class un extends d{list(e,t){return this._makeRequest("GET","/v1/credit_notes",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/credit_notes",e,t,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/credit_notes/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/credit_notes/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}preview(e,t){return this._makeRequest("GET","/v1/credit_notes/preview",e,t,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}voidCreditNote(e,t,n){return this._makeRequest("POST",`/v1/credit_notes/${encodeURIComponent(e)}/void`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}listPreviewLineItems(e,t){return this._makeRequest("GET","/v1/credit_notes/preview/lines",e,t,{methodType:"list",requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}listLineItems(e,t,n){return this._makeRequest("GET",`/v1/credit_notes/${encodeURIComponent(e)}/lines`,t,n,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var mn;var hs=f(()=>{b();mn=class mn extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}deleteDiscount(e,t,n){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(e)}/discount`,t,n)}list(e,t){return this._makeRequest("GET","/v1/customers",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/customers",e,t,{responseSchema:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}search(e,t){return this._makeRequest("GET","/v1/customers/search",e,t,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{subscriptions:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}})}listBalanceTransactions(e,t,n){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/balance_transactions`,t,n,{methodType:"list"})}createBalanceTransaction(e,t,n){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(e)}/balance_transactions`,t,n)}retrieveBalanceTransaction(e,t,n,i){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/balance_transactions/${encodeURIComponent(t)}`,n,i)}updateBalanceTransaction(e,t,n,i){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(e)}/balance_transactions/${encodeURIComponent(t)}`,n,i)}retrieveCashBalance(e,t,n){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/cash_balance`,t,n)}updateCashBalance(e,t,n){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(e)}/cash_balance`,t,n)}listCashBalanceTransactions(e,t,n){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/cash_balance_transactions`,t,n,{methodType:"list"})}retrieveCashBalanceTransaction(e,t,n,i){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/cash_balance_transactions/${encodeURIComponent(t)}`,n,i)}createFundingInstructions(e,t,n){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(e)}/funding_instructions`,t,n)}listPaymentMethods(e,t,n){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/payment_methods`,t,n,{methodType:"list"})}retrievePaymentMethod(e,t,n,i){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/payment_methods/${encodeURIComponent(t)}`,n,i)}listSources(e,t,n){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/sources`,t,n,{methodType:"list"})}createSource(e,t,n){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(e)}/sources`,t,n)}retrieveSource(e,t,n,i){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/sources/${encodeURIComponent(t)}`,n,i)}updateSource(e,t,n,i){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(e)}/sources/${encodeURIComponent(t)}`,n,i)}deleteSource(e,t,n,i){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(e)}/sources/${encodeURIComponent(t)}`,n,i)}verifySource(e,t,n,i){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(e)}/sources/${encodeURIComponent(t)}/verify`,n,i)}deleteTaxId(e,t,n,i){return this._makeRequest("DELETE",`/v1/customers/${encodeURIComponent(e)}/tax_ids/${encodeURIComponent(t)}`,n,i)}retrieveTaxId(e,t,n,i){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/tax_ids/${encodeURIComponent(t)}`,n,i)}listTaxIds(e,t,n){return this._makeRequest("GET",`/v1/customers/${encodeURIComponent(e)}/tax_ids`,t,n,{methodType:"list"})}createTaxId(e,t,n){return this._makeRequest("POST",`/v1/customers/${encodeURIComponent(e)}/tax_ids`,t,n)}}});var pn;var ys=f(()=>{b();pn=class pn extends d{create(e,t){return this._makeRequest("POST","/v1/customer_sessions",e,t)}}});var fn;var Rs=f(()=>{b();fn=class fn extends d{list(e,t){return this._makeRequest("GET","/v1/disputes",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/disputes/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/disputes/${encodeURIComponent(e)}`,t,n)}close(e,t,n){return this._makeRequest("POST",`/v1/disputes/${encodeURIComponent(e)}/close`,t,n)}}});var _n;var Ts=f(()=>{b();_n=class _n extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/ephemeral_keys/${encodeURIComponent(e)}`,t,n)}create(e,t){return this._makeRequest("POST","/v1/ephemeral_keys",e,t,{validator:(n,i)=>{if(!i.headers||!i.headers["Stripe-Version"])throw Error("Passing apiVersion in a separate options hash is required to create an ephemeral key. See https://stripe.com/docs/api/versioning?lang=node")}})}}});var kn;var ws=f(()=>{b();kn=class kn extends d{list(e,t){return this._makeRequest("GET","/v1/events",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/events/${encodeURIComponent(e)}`,t,n)}}});var bn;var vs=f(()=>{b();bn=class bn extends d{list(e,t){return this._makeRequest("GET","/v1/exchange_rates",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/exchange_rates/${encodeURIComponent(e)}`,t,n)}}});function Al(e,t,n,i){if(t=t||{},e!=="POST")return i(null,z(t));this._stripe._platformFunctions.tryBufferData(t).then((r)=>{let o=Zd(e,r,n);return i(null,o)}).catch((r)=>i(r,null))}var Zd=(e,t,n)=>{let i=(Math.round(Math.random()*10000000000000000)+Math.round(Math.random()*10000000000000000)).toString();n["Content-Type"]=`multipart/form-data; boundary=${i}`;let r=new TextEncoder,o=new Uint8Array(0),s=r.encode(`\r
15
+ `);function a(u){let m=o,p=u instanceof Uint8Array?u:new Uint8Array(r.encode(u));o=new Uint8Array(m.length+p.length+2),o.set(m),o.set(p,m.length),o.set(s,o.length-2)}function c(u){return`"${u.replace(/"|"/g,"%22").replace(/\r\n|\r|\n/g," ")}"`}let l=ml(t);for(let u in l){if(!Object.prototype.hasOwnProperty.call(l,u))continue;let m=l[u];if(a(`--${i}`),Object.prototype.hasOwnProperty.call(m,"data")){let p=m;a(`Content-Disposition: form-data; name=${c(u)}; filename=${c(p.name||"blob")}`),a(`Content-Type: ${p.type||"application/octet-stream"}`),a(""),a(p.data)}else a(`Content-Disposition: form-data; name=${c(u)}`),a(""),a(m)}return a(`--${i}--`),o};var Il=f(()=>{W()});var gn;var Ss=f(()=>{Il();b();gn=class gn extends d{constructor(){super(...arguments);this.requestDataProcessor=Al}list(e,t){return this._makeRequest("GET","/v1/files",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/files",e,t,{headers:{"Content-Type":"multipart/form-data"},apiBase:"files"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/files/${encodeURIComponent(e)}`,t,n)}}});var hn;var xs=f(()=>{b();hn=class hn extends d{list(e,t){return this._makeRequest("GET","/v1/file_links",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/file_links",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/file_links/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/file_links/${encodeURIComponent(e)}`,t,n)}}});var yn;var Cs=f(()=>{b();yn=class yn extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/invoices/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/invoices/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}list(e,t){return this._makeRequest("GET","/v1/invoices",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/invoices",e,t,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}search(e,t){return this._makeRequest("GET","/v1/invoices/search",e,t,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}addLines(e,t,n){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}/add_lines`,t,n,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}attachPayment(e,t,n){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}/attach_payment`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}finalizeInvoice(e,t,n){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}/finalize`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}markUncollectible(e,t,n){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}/mark_uncollectible`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}pay(e,t,n){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}/pay`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}removeLines(e,t,n){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}/remove_lines`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}sendInvoice(e,t,n){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}/send`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}updateLines(e,t,n){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}/update_lines`,t,n,{requestSchema:{kind:"object",fields:{lines:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}voidInvoice(e,t,n){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}/void`,t,n,{responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}createPreview(e,t){return this._makeRequest("POST","/v1/invoices/create_preview",e,t,{requestSchema:{kind:"object",fields:{invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},schedule_details:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}},subscription_details:{kind:"object",fields:{items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}},responseSchema:{kind:"object",fields:{lines:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}listLineItems(e,t,n){return this._makeRequest("GET",`/v1/invoices/${encodeURIComponent(e)}/lines`,t,n,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}updateLineItem(e,t,n,i){return this._makeRequest("POST",`/v1/invoices/${encodeURIComponent(e)}/lines/${encodeURIComponent(t)}`,n,i,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}}});var Rn;var js=f(()=>{b();Rn=class Rn extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/invoiceitems/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/invoiceitems/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/invoiceitems/${encodeURIComponent(e)}`,t,n,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}list(e,t){return this._makeRequest("GET","/v1/invoiceitems",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/invoiceitems",e,t,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}},quantity_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{pricing:{kind:"nullable",inner:{kind:"object",fields:{unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},quantity_decimal:{kind:"decimal_string"}}}})}}});var Tn;var Ps=f(()=>{b();Tn=class Tn extends d{list(e,t){return this._makeRequest("GET","/v1/invoice_payments",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/invoice_payments/${encodeURIComponent(e)}`,t,n)}}});var wn;var Es=f(()=>{b();wn=class wn extends d{list(e,t){return this._makeRequest("GET","/v1/invoice_rendering_templates",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/invoice_rendering_templates/${encodeURIComponent(e)}`,t,n)}archive(e,t,n){return this._makeRequest("POST",`/v1/invoice_rendering_templates/${encodeURIComponent(e)}/archive`,t,n)}unarchive(e,t,n){return this._makeRequest("POST",`/v1/invoice_rendering_templates/${encodeURIComponent(e)}/unarchive`,t,n)}}});var vn;var qs=f(()=>{b();vn=class vn extends d{retrieve(e,t,n){return this._makeRequest("GET",`/v1/mandates/${encodeURIComponent(e)}`,t,n)}}});var Sn;var $l=f(()=>{b();W();Sn=class Sn extends d{constructor(){super(...arguments);this.basePath=be("/")}authorizeUrl(e,t){e=e||{},t=t||{};let n="oauth/authorize";if(t.express)n=`express/${n}`;if(!e.response_type)e.response_type="code";if(!e.client_id)e.client_id=this._stripe.getClientId();if(!e.scope)e.scope="read_write";return`https://${this._stripe.resolveBaseAddress("connect")}/${n}?${z(e)}`}token(e,t){return this._makeRequest("POST","/oauth/token",e,t,{apiBase:"connect"})}deauthorize(e,t){if(!e.client_id)e.client_id=this._stripe.getClientId();return this._makeRequest("POST","/oauth/deauthorize",e,t,{apiBase:"connect"})}}});var xn;var Os=f(()=>{b();xn=class xn extends d{list(e,t){return this._makeRequest("GET","/v1/payment_attempt_records",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/payment_attempt_records/${encodeURIComponent(e)}`,t,n)}}});var Cn;var As=f(()=>{b();Cn=class Cn extends d{list(e,t){return this._makeRequest("GET","/v1/payment_intents",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/payment_intents",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/payment_intents/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(e)}`,t,n)}search(e,t){return this._makeRequest("GET","/v1/payment_intents/search",e,t,{methodType:"search"})}applyCustomerBalance(e,t,n){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(e)}/apply_customer_balance`,t,n)}cancel(e,t,n){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(e)}/cancel`,t,n)}capture(e,t,n){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(e)}/capture`,t,n)}confirm(e,t,n){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(e)}/confirm`,t,n)}incrementAuthorization(e,t,n){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(e)}/increment_authorization`,t,n)}verifyMicrodeposits(e,t,n){return this._makeRequest("POST",`/v1/payment_intents/${encodeURIComponent(e)}/verify_microdeposits`,t,n)}listAmountDetailsLineItems(e,t,n){return this._makeRequest("GET",`/v1/payment_intents/${encodeURIComponent(e)}/amount_details_line_items`,t,n,{methodType:"list"})}}});var jn;var Is=f(()=>{b();jn=class jn extends d{list(e,t){return this._makeRequest("GET","/v1/payment_links",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/payment_links",e,t,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/payment_links/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/payment_links/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}})}listLineItems(e,t,n){return this._makeRequest("GET",`/v1/payment_links/${encodeURIComponent(e)}/line_items`,t,n,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var Pn;var $s=f(()=>{b();Pn=class Pn extends d{list(e,t){return this._makeRequest("GET","/v1/payment_methods",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/payment_methods",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/payment_methods/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(e)}`,t,n)}attach(e,t,n){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(e)}/attach`,t,n)}detach(e,t,n){return this._makeRequest("POST",`/v1/payment_methods/${encodeURIComponent(e)}/detach`,t,n)}}});var En;var Us=f(()=>{b();En=class En extends d{list(e,t){return this._makeRequest("GET","/v1/payment_method_configurations",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/payment_method_configurations",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/payment_method_configurations/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/payment_method_configurations/${encodeURIComponent(e)}`,t,n)}}});var qn;var Ms=f(()=>{b();qn=class qn extends d{list(e,t){return this._makeRequest("GET","/v1/payment_method_domains",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/payment_method_domains",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/payment_method_domains/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/payment_method_domains/${encodeURIComponent(e)}`,t,n)}validate(e,t,n){return this._makeRequest("POST",`/v1/payment_method_domains/${encodeURIComponent(e)}/validate`,t,n)}}});var On;var Ds=f(()=>{b();On=class On extends d{retrieve(e,t,n){return this._makeRequest("GET",`/v1/payment_records/${encodeURIComponent(e)}`,t,n)}reportPaymentAttempt(e,t,n){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(e)}/report_payment_attempt`,t,n)}reportPaymentAttemptCanceled(e,t,n){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(e)}/report_payment_attempt_canceled`,t,n)}reportPaymentAttemptFailed(e,t,n){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(e)}/report_payment_attempt_failed`,t,n)}reportPaymentAttemptGuaranteed(e,t,n){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(e)}/report_payment_attempt_guaranteed`,t,n)}reportPaymentAttemptInformational(e,t,n){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(e)}/report_payment_attempt_informational`,t,n)}reportRefund(e,t,n){return this._makeRequest("POST",`/v1/payment_records/${encodeURIComponent(e)}/report_refund`,t,n)}reportPayment(e,t){return this._makeRequest("POST","/v1/payment_records/report_payment",e,t)}}});var An;var Fs=f(()=>{b();An=class An extends d{list(e,t){return this._makeRequest("GET","/v1/payouts",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/payouts",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/payouts/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(e)}`,t,n)}cancel(e,t,n){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(e)}/cancel`,t,n)}reverse(e,t,n){return this._makeRequest("POST",`/v1/payouts/${encodeURIComponent(e)}/reverse`,t,n)}}});var In;var Ns=f(()=>{b();In=class In extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/plans/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/plans/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/plans/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}list(e,t){return this._makeRequest("GET","/v1/plans",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/plans",e,t,{requestSchema:{kind:"object",fields:{amount_decimal:{kind:"decimal_string"},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}}}},responseSchema:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var $n;var Gs=f(()=>{b();$n=class $n extends d{list(e,t){return this._makeRequest("GET","/v1/prices",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/prices",e,t,{requestSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}},responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/prices/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/prices/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}})}search(e,t){return this._makeRequest("GET","/v1/prices/search",e,t,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}})}}});var Un;var Bs=f(()=>{b();Un=class Un extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/products/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/products/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/products",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/products",e,t,{requestSchema:{kind:"object",fields:{default_price_data:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"decimal_string"},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}},unit_amount_decimal:{kind:"decimal_string"}}}}}})}search(e,t){return this._makeRequest("GET","/v1/products/search",e,t,{methodType:"search"})}deleteFeature(e,t,n,i){return this._makeRequest("DELETE",`/v1/products/${encodeURIComponent(e)}/features/${encodeURIComponent(t)}`,n,i)}retrieveFeature(e,t,n,i){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(e)}/features/${encodeURIComponent(t)}`,n,i)}listFeatures(e,t,n){return this._makeRequest("GET",`/v1/products/${encodeURIComponent(e)}/features`,t,n,{methodType:"list"})}createFeature(e,t,n){return this._makeRequest("POST",`/v1/products/${encodeURIComponent(e)}/features`,t,n)}}});var Mn;var Ls=f(()=>{b();Mn=class Mn extends d{list(e,t){return this._makeRequest("GET","/v1/promotion_codes",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/promotion_codes",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/promotion_codes/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/promotion_codes/${encodeURIComponent(e)}`,t,n)}}});var Dn;var Ks=f(()=>{b();Dn=class Dn extends d{list(e,t){return this._makeRequest("GET","/v1/quotes",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/quotes",e,t,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(e)}`,t,n,{requestSchema:{kind:"object",fields:{line_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}accept(e,t,n){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(e)}/accept`,t,n,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}cancel(e,t,n){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(e)}/cancel`,t,n,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}finalizeQuote(e,t,n){return this._makeRequest("POST",`/v1/quotes/${encodeURIComponent(e)}/finalize`,t,n,{responseSchema:{kind:"object",fields:{computed:{kind:"object",fields:{upfront:{kind:"object",fields:{line_items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}}}})}pdf(e,t,n){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(e)}/pdf`,t,n,{apiBase:"files",streaming:!0})}listComputedUpfrontLineItems(e,t,n){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(e)}/computed_upfront_line_items`,t,n,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}listLineItems(e,t,n){return this._makeRequest("GET",`/v1/quotes/${encodeURIComponent(e)}/line_items`,t,n,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{price:{kind:"nullable",inner:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}})}}});var Fn;var Hs=f(()=>{b();Fn=class Fn extends d{list(e,t){return this._makeRequest("GET","/v1/refunds",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/refunds",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/refunds/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/refunds/${encodeURIComponent(e)}`,t,n)}cancel(e,t,n){return this._makeRequest("POST",`/v1/refunds/${encodeURIComponent(e)}/cancel`,t,n)}}});var Nn;var Vs=f(()=>{b();Nn=class Nn extends d{list(e,t){return this._makeRequest("GET","/v1/reviews",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/reviews/${encodeURIComponent(e)}`,t,n)}approve(e,t,n){return this._makeRequest("POST",`/v1/reviews/${encodeURIComponent(e)}/approve`,t,n)}}});var Gn;var zs=f(()=>{b();Gn=class Gn extends d{list(e,t){return this._makeRequest("GET","/v1/setup_attempts",e,t,{methodType:"list"})}}});var Bn;var Ws=f(()=>{b();Bn=class Bn extends d{list(e,t){return this._makeRequest("GET","/v1/setup_intents",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/setup_intents",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/setup_intents/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(e)}`,t,n)}cancel(e,t,n){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(e)}/cancel`,t,n)}confirm(e,t,n){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(e)}/confirm`,t,n)}verifyMicrodeposits(e,t,n){return this._makeRequest("POST",`/v1/setup_intents/${encodeURIComponent(e)}/verify_microdeposits`,t,n)}}});var Ln;var Qs=f(()=>{b();Ln=class Ln extends d{list(e,t){return this._makeRequest("GET","/v1/shipping_rates",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/shipping_rates",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/shipping_rates/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/shipping_rates/${encodeURIComponent(e)}`,t,n)}}});var Kn;var Js=f(()=>{b();Kn=class Kn extends d{retrieve(e,t,n){return this._makeRequest("GET",`/v1/sources/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/sources/${encodeURIComponent(e)}`,t,n)}create(e,t){return this._makeRequest("POST","/v1/sources",e,t)}verify(e,t,n){return this._makeRequest("POST",`/v1/sources/${encodeURIComponent(e)}/verify`,t,n)}listSourceTransactions(e,t,n){return this._makeRequest("GET",`/v1/sources/${encodeURIComponent(e)}/source_transactions`,t,n,{methodType:"list"})}}});var Hn;var Xs=f(()=>{b();Hn=class Hn extends d{cancel(e,t,n){return this._makeRequest("DELETE",`/v1/subscriptions/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/subscriptions/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(e)}`,t,n,{requestSchema:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}deleteDiscount(e,t,n){return this._makeRequest("DELETE",`/v1/subscriptions/${encodeURIComponent(e)}/discount`,t,n)}list(e,t){return this._makeRequest("GET","/v1/subscriptions",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/subscriptions",e,t,{requestSchema:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}},responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}search(e,t){return this._makeRequest("GET","/v1/subscriptions/search",e,t,{methodType:"search",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}}}}})}migrate(e,t,n){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(e)}/migrate`,t,n,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}resume(e,t,n){return this._makeRequest("POST",`/v1/subscriptions/${encodeURIComponent(e)}/resume`,t,n,{responseSchema:{kind:"object",fields:{items:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}}}})}}});var Vn;var Ys=f(()=>{b();Vn=class Vn extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/subscription_items/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/subscription_items/${encodeURIComponent(e)}`,t,n,{responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}update(e,t,n){return this._makeRequest("POST",`/v1/subscription_items/${encodeURIComponent(e)}`,t,n,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}list(e,t){return this._makeRequest("GET","/v1/subscription_items",e,t,{methodType:"list",responseSchema:{kind:"object",fields:{data:{kind:"array",element:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}}}}})}create(e,t){return this._makeRequest("POST","/v1/subscription_items",e,t,{requestSchema:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}},responseSchema:{kind:"object",fields:{plan:{kind:"object",fields:{amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}},price:{kind:"object",fields:{currency_options:{kind:"array",element:{kind:"object",fields:{tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},tiers:{kind:"array",element:{kind:"object",fields:{flat_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}},unit_amount_decimal:{kind:"nullable",inner:{kind:"decimal_string"}}}}}}})}}});var zn;var Zs=f(()=>{b();zn=class zn extends d{list(e,t){return this._makeRequest("GET","/v1/subscription_schedules",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/subscription_schedules",e,t,{requestSchema:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}}})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/subscription_schedules/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(e)}`,t,n,{requestSchema:{kind:"object",fields:{phases:{kind:"array",element:{kind:"object",fields:{add_invoice_items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}},items:{kind:"array",element:{kind:"object",fields:{price_data:{kind:"object",fields:{unit_amount_decimal:{kind:"decimal_string"}}}}}}}}}}}})}cancel(e,t,n){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(e)}/cancel`,t,n)}release(e,t,n){return this._makeRequest("POST",`/v1/subscription_schedules/${encodeURIComponent(e)}/release`,t,n)}}});var Wn;var ea=f(()=>{b();Wn=class Wn extends d{list(e,t){return this._makeRequest("GET","/v1/tax_codes",e,t,{methodType:"list"})}retrieve(e,t,n){return this._makeRequest("GET",`/v1/tax_codes/${encodeURIComponent(e)}`,t,n)}}});var Qn;var ta=f(()=>{b();Qn=class Qn extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/tax_ids/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/tax_ids/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/tax_ids",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/tax_ids",e,t)}}});var Jn;var na=f(()=>{b();Jn=class Jn extends d{list(e,t){return this._makeRequest("GET","/v1/tax_rates",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/tax_rates",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/tax_rates/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/tax_rates/${encodeURIComponent(e)}`,t,n)}}});var Xn;var ia=f(()=>{b();Xn=class Xn extends d{retrieve(e,t,n){return this._makeRequest("GET",`/v1/tokens/${encodeURIComponent(e)}`,t,n)}create(e,t){return this._makeRequest("POST","/v1/tokens",e,t)}}});var Yn;var ra=f(()=>{b();Yn=class Yn extends d{list(e,t){return this._makeRequest("GET","/v1/topups",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/topups",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/topups/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/topups/${encodeURIComponent(e)}`,t,n)}cancel(e,t,n){return this._makeRequest("POST",`/v1/topups/${encodeURIComponent(e)}/cancel`,t,n)}}});var Zn;var oa=f(()=>{b();Zn=class Zn extends d{list(e,t){return this._makeRequest("GET","/v1/transfers",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/transfers",e,t)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(e)}`,t,n)}listReversals(e,t,n){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(e)}/reversals`,t,n,{methodType:"list"})}createReversal(e,t,n){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(e)}/reversals`,t,n)}retrieveReversal(e,t,n,i){return this._makeRequest("GET",`/v1/transfers/${encodeURIComponent(e)}/reversals/${encodeURIComponent(t)}`,n,i)}updateReversal(e,t,n,i){return this._makeRequest("POST",`/v1/transfers/${encodeURIComponent(e)}/reversals/${encodeURIComponent(t)}`,n,i)}}});var ei;var sa=f(()=>{b();ei=class ei extends d{del(e,t,n){return this._makeRequest("DELETE",`/v1/webhook_endpoints/${encodeURIComponent(e)}`,t,n)}retrieve(e,t,n){return this._makeRequest("GET",`/v1/webhook_endpoints/${encodeURIComponent(e)}`,t,n)}update(e,t,n){return this._makeRequest("POST",`/v1/webhook_endpoints/${encodeURIComponent(e)}`,t,n)}list(e,t){return this._makeRequest("GET","/v1/webhook_endpoints",e,t,{methodType:"list"})}create(e,t){return this._makeRequest("POST","/v1/webhook_endpoints",e,t)}}});var ae={};Oi(ae,{Account:()=>oe,AccountLinks:()=>en,AccountSessions:()=>tn,Accounts:()=>oe,ApplePayDomains:()=>nn,ApplicationFees:()=>rn,Apps:()=>eu,Balance:()=>se,BalanceSettings:()=>on,BalanceTransactions:()=>sn,Balances:()=>se,Billing:()=>tu,BillingPortal:()=>nu,Charges:()=>an,Checkout:()=>iu,Climate:()=>ru,ConfirmationTokens:()=>ln,CountrySpecs:()=>cn,Coupons:()=>dn,CreditNotes:()=>un,CustomerSessions:()=>pn,Customers:()=>mn,Disputes:()=>fn,Entitlements:()=>ou,EphemeralKeys:()=>_n,Events:()=>kn,ExchangeRates:()=>bn,FileLinks:()=>hn,Files:()=>gn,FinancialConnections:()=>su,Forwarding:()=>au,Identity:()=>lu,InvoiceItems:()=>Rn,InvoicePayments:()=>Tn,InvoiceRenderingTemplates:()=>wn,Invoices:()=>yn,Issuing:()=>cu,Mandates:()=>vn,OAuthResource:()=>Sn,PaymentAttemptRecords:()=>xn,PaymentIntents:()=>Cn,PaymentLinks:()=>jn,PaymentMethodConfigurations:()=>En,PaymentMethodDomains:()=>qn,PaymentMethods:()=>Pn,PaymentRecords:()=>On,Payouts:()=>An,Plans:()=>In,Prices:()=>$n,Products:()=>Un,PromotionCodes:()=>Mn,Quotes:()=>Dn,Radar:()=>du,Refunds:()=>Fn,Reporting:()=>uu,Reviews:()=>Nn,SetupAttempts:()=>Gn,SetupIntents:()=>Bn,ShippingRates:()=>Ln,Sigma:()=>mu,Sources:()=>Kn,SubscriptionItems:()=>Vn,SubscriptionSchedules:()=>zn,Subscriptions:()=>Hn,Tax:()=>pu,TaxCodes:()=>Wn,TaxIds:()=>Qn,TaxRates:()=>Jn,Terminal:()=>fu,TestHelpers:()=>_u,Tokens:()=>Xn,Topups:()=>Yn,Transfers:()=>Zn,Treasury:()=>ku,V2:()=>bu,WebhookEndpoints:()=>ei});var eu,tu,nu,iu,ru,ou,su,au,lu,cu,du,uu,mu,pu,fu,_u,ku,bu;var aa=f(()=>{Or();Ar();Ir();Mr();Dr();Fr();Nr();Gr();Br();Lr();Kr();Hr();Vr();zr();Wr();Qr();Jr();Xr();Yr();Zr();eo();to();no();io();ro();oo();so();ao();lo();co();uo();mo();po();fo();_o();ko();bo();go();ho();yo();Ro();To();wo();vo();So();xo();Co();jo();Po();Eo();qo();Oo();Ao();Io();$o();Uo();Mo();Do();Fo();No();Go();Bo();Lo();Ko();Ho();Vo();zo();Wo();Qo();Jo();Xo();Yo();Zo();es();ts();ns();is();rs();os();ss();as();Ci();Ci();ls();cs();ds();us();ji();ji();ms();ps();fs();_s();ks();bs();gs();hs();ys();Rs();Ts();ws();vs();Ss();xs();Cs();js();Ps();Es();qs();$l();Os();As();Is();$s();Us();Ms();Ds();Fs();Ns();Gs();Bs();Ls();Ks();Hs();Vs();zs();Ws();Qs();Js();Xs();Ys();Zs();ea();ta();na();ia();ra();oa();sa();eu=S("apps",{Secrets:Ut}),tu=S("billing",{Alerts:Oe,CreditBalanceSummary:Ke,CreditBalanceTransactions:He,CreditGrants:Ve,MeterEventAdjustments:st,MeterEvents:dt,Meters:mt}),nu=S("billingPortal",{Configurations:Ne,Sessions:Mt}),iu=S("checkout",{Sessions:Dt}),ru=S("climate",{Orders:ft,Products:wt,Suppliers:Gt}),ou=S("entitlements",{ActiveEntitlements:qe,Features:et}),su=S("financialConnections",{Accounts:Pe,Sessions:Ft,Transactions:Ht}),au=S("forwarding",{Requests:It}),lu=S("identity",{VerificationReports:Yt,VerificationSessions:Zt}),cu=S("issuing",{Authorizations:Ie,Cardholders:Me,Cards:De,Disputes:Je,PersonalizationDesigns:yt,PhysicalBundles:Tt,Tokens:Lt,Transactions:Vt}),du=S("radar",{EarlyFraudWarnings:Xe,PaymentEvaluations:ht,ValueListItems:Jt,ValueLists:Xt}),uu=S("reporting",{ReportRuns:Ot,ReportTypes:At}),mu=S("sigma",{ScheduledQueryRuns:$t}),pu=S("tax",{Associations:Ae,Calculations:Ue,Registrations:qt,Settings:Nt,Transactions:zt}),fu=S("terminal",{Configurations:Ge,ConnectionTokens:Le,Locations:ot,OnboardingLinks:pt,Readers:vt}),_u=S("testHelpers",{ConfirmationTokens:Be,Customers:We,Refunds:Et,TestClocks:Bt,Issuing:S("issuing",{Authorizations:$e,Cards:Fe,PersonalizationDesigns:Rt,Transactions:Wt}),Terminal:S("terminal",{Readers:St}),Treasury:S("treasury",{InboundTransfers:it,OutboundPayments:_t,OutboundTransfers:bt,ReceivedCredits:xt,ReceivedDebits:jt})}),ku=S("treasury",{CreditReversals:ze,DebitReversals:Qe,FinancialAccounts:tt,InboundTransfers:rt,OutboundPayments:kt,OutboundTransfers:gt,ReceivedCredits:Ct,ReceivedDebits:Pt,TransactionEntries:Kt,Transactions:Qt}),bu=S("v2",{Billing:S("billing",{MeterEventAdjustments:at,MeterEventSession:lt,MeterEventStream:ct,MeterEvents:ut}),Commerce:S("commerce",{ProductCatalog:S("productCatalog",{Imports:nt})}),Core:S("core",{AccountLinks:Ce,AccountTokens:je,Accounts:Ee,EventDestinations:Ye,Events:Ze})})});var Ul=f(()=>{Ri()});class la{constructor(e){this.stripe=e,this.secrets=new Ut(e)}}var Ml=f(()=>{Ko()});class ca{constructor(e){this.stripe=e,this.alerts=new Oe(e),this.creditBalanceSummaries=new Ke(e),this.creditBalanceTransactions=new He(e),this.creditGrants=new Ve(e),this.meters=new mt(e),this.meterEvents=new dt(e),this.meterEventAdjustments=new st(e)}}var Dl=f(()=>{Fr();Xr();Yr();Zr();yo();go();fo()});class da{constructor(e){this.stripe=e,this.configurations=new Ne(e),this.sessions=new Mt(e)}}var Fl=f(()=>{zr();Ho()});class ua{constructor(e){this.stripe=e,this.sessions=new Dt(e)}}var Nl=f(()=>{Vo()});class ma{constructor(e){this.stripe=e,this.orders=new ft(e),this.products=new wt(e),this.suppliers=new Gt(e)}}var Gl=f(()=>{To();qo();Qo()});class pa{constructor(e){this.stripe=e,this.activeEntitlements=new qe(e),this.features=new et(e)}}var Bl=f(()=>{Dr();ao()});class fa{constructor(e){this.stripe=e,this.accounts=new Pe(e),this.sessions=new Ft(e),this.transactions=new Ht(e)}}var Ll=f(()=>{Ir();zo();Zo()});class _a{constructor(e){this.stripe=e,this.requests=new It(e)}}var Kl=f(()=>{Bo()});class ka{constructor(e){this.stripe=e,this.verificationReports=new Yt(e),this.verificationSessions=new Zt(e)}}var Hl=f(()=>{ss();as()});class ba{constructor(e){this.stripe=e,this.authorizations=new Ie(e),this.cards=new De(e),this.cardholders=new Me(e),this.disputes=new Je(e),this.personalizationDesigns=new yt(e),this.physicalBundles=new Tt(e),this.tokens=new Lt(e),this.transactions=new Vt(e)}}var Vl=f(()=>{Gr();Hr();Kr();io();jo();Eo();Xo();es()});class ga{constructor(e){this.stripe=e,this.earlyFraudWarnings=new Xe(e),this.paymentEvaluations=new ht(e),this.valueLists=new Xt(e),this.valueListItems=new Jt(e)}}var zl=f(()=>{ro();Co();os();rs()});class ha{constructor(e){this.stripe=e,this.reportRuns=new Ot(e),this.reportTypes=new At(e)}}var Wl=f(()=>{No();Go()});class ya{constructor(e){this.stripe=e,this.scheduledQueryRuns=new $t(e)}}var Ql=f(()=>{Lo()});class Ra{constructor(e){this.stripe=e,this.associations=new Ae(e),this.calculations=new Ue(e),this.registrations=new qt(e),this.settings=new Nt(e),this.transactions=new zt(e)}}var Jl=f(()=>{Nr();Lr();Fo();Wo();ts()});class Ta{constructor(e){this.stripe=e,this.configurations=new Ge(e),this.connectionTokens=new Le(e),this.locations=new ot(e),this.onboardingLinks=new pt(e),this.readers=new vt(e)}}var Xl=f(()=>{Wr();Jr();po();Ro();Oo()});class wa{constructor(e){this.stripe=e,this.authorizations=new $e(e),this.cards=new Fe(e),this.personalizationDesigns=new Rt(e),this.transactions=new Wt(e)}}var Yl=f(()=>{Br();Vr();Po();ns()});class va{constructor(e){this.stripe=e,this.readers=new St(e)}}var Zl=f(()=>{Ao()});class Sa{constructor(e){this.stripe=e,this.inboundTransfers=new it(e),this.outboundPayments=new _t(e),this.outboundTransfers=new bt(e),this.receivedCredits=new xt(e),this.receivedDebits=new jt(e)}}var ec=f(()=>{uo();wo();So();Io();Uo()});class xa{constructor(e){this.stripe=e,this.confirmationTokens=new Be(e),this.customers=new We(e),this.refunds=new Et(e),this.testClocks=new Bt(e),this.issuing=new wa(e),this.terminal=new va(e),this.treasury=new Sa(e)}}var tc=f(()=>{Qr();to();Do();Jo();Yl();Zl();ec()});class Ca{constructor(e){this.stripe=e,this.creditReversals=new ze(e),this.debitReversals=new Qe(e),this.financialAccounts=new tt(e),this.inboundTransfers=new rt(e),this.outboundPayments=new kt(e),this.outboundTransfers=new gt(e),this.receivedCredits=new Ct(e),this.receivedDebits=new Pt(e),this.transactions=new Qt(e),this.transactionEntries=new Kt(e)}}var nc=f(()=>{eo();no();lo();mo();vo();xo();$o();Mo();is();Yo()});class ja{constructor(e){this.stripe=e,this.meterEvents=new ut(e),this.meterEventAdjustments=new at(e),this.meterEventSession=new lt(e),this.meterEventStream=new ct(e)}}var ic=f(()=>{ho();_o();ko();bo()});class Pa{constructor(e){this.stripe=e,this.imports=new nt(e)}}var rc=f(()=>{co()});class Ea{constructor(e){this.stripe=e,this.productCatalog=new Pa(e)}}var oc=f(()=>{rc()});class qa{constructor(e){this.stripe=e,this.accounts=new Ee(e),this.accountLinks=new Ce(e),this.accountTokens=new je(e),this.events=new Ze(e),this.eventDestinations=new Ye(e)}}var sc=f(()=>{Mr();Or();Ar();so();oo()});class Oa{constructor(e){this.stripe=e,this.billing=new ja(e),this.commerce=new Ea(e),this.core=new qa(e)}}var ac=f(()=>{ic();oc();sc()});class w{static initialize(e,t=_c){w._platformFunctions=e,w._requestSenderFactory=t,w.webhooks=Pl(e),w.createNodeHttpClient=e.createNodeHttpClient,w.createFetchHttpClient=e.createFetchHttpClient,w.createNodeCryptoProvider=e.createNodeCryptoProvider,w.createSubtleCryptoProvider=e.createSubtleCryptoProvider;let n=e.getEnv(),i=e.getRuntimeVersion();w.aiAgent=n?pl(n):"",w.AI_AGENT=w.aiAgent,w.USER_AGENT={bindings_version:w.PACKAGE_VERSION,lang:"node",typescript:!1,...i?{lang_version:i}:{},...w.aiAgent?{ai_agent:w.aiAgent}:{}}}constructor(e,t={}){this._authenticator=null;let n=this._getPropsFromConfig(t);this._platformFunctions=w._platformFunctions,Object.defineProperty(this,"_emitter",{value:this._platformFunctions.createEmitter(),enumerable:!1,configurable:!1,writable:!1}),this.VERSION=w.PACKAGE_VERSION,this.on=this._emitter.on.bind(this._emitter),this.once=this._emitter.once.bind(this._emitter),this.off=this._emitter.removeListener.bind(this._emitter);let i=n.httpAgent||null;this._api={host:n.host||Aa,port:n.port||lc,protocol:n.protocol||"https",basePath:cc,version:n.apiVersion||dc,timeout:ki("timeout",n.timeout,uc),maxNetworkRetries:ki("maxNetworkRetries",n.maxNetworkRetries,2),agent:i,httpClient:n.httpClient||(i?this._platformFunctions.createNodeHttpClient(i):this._platformFunctions.createDefaultHttpClient()),dev:!1,stripeAccount:n.stripeAccount||null,stripeContext:n.stripeContext||null};let r=n.typescript||!1;if(r!==w.USER_AGENT.typescript)w.USER_AGENT.typescript=r;if(n.appInfo)this._setAppInfo(n.appInfo);this._setAuthenticator(e,n.authenticator||null),this.errors=Si,this.Decimal=M,this.webhooks=w.webhooks,this._prevRequestMetrics=[],this._enableTelemetry=n.telemetry!==!1,this._emitEventBodies=n.emitEventBodies===!0,this._requestSender=w._requestSenderFactory(this),this.accountLinks=new en(this),this.accountSessions=new tn(this),this.accounts=new oe(this),this.applePayDomains=new nn(this),this.applicationFees=new rn(this),this.balance=new se(this),this.balanceSettings=new on(this),this.balanceTransactions=new sn(this),this.charges=new an(this),this.confirmationTokens=new ln(this),this.countrySpecs=new cn(this),this.coupons=new dn(this),this.creditNotes=new un(this),this.customerSessions=new pn(this),this.customers=new mn(this),this.disputes=new fn(this),this.ephemeralKeys=new _n(this),this.events=new kn(this),this.exchangeRates=new bn(this),this.fileLinks=new hn(this),this.files=new gn(this),this.invoiceItems=new Rn(this),this.invoicePayments=new Tn(this),this.invoiceRenderingTemplates=new wn(this),this.invoices=new yn(this),this.mandates=new vn(this),this.paymentAttemptRecords=new xn(this),this.paymentIntents=new Cn(this),this.paymentLinks=new jn(this),this.paymentMethodConfigurations=new En(this),this.paymentMethodDomains=new qn(this),this.paymentMethods=new Pn(this),this.paymentRecords=new On(this),this.payouts=new An(this),this.plans=new In(this),this.prices=new $n(this),this.products=new Un(this),this.promotionCodes=new Mn(this),this.quotes=new Dn(this),this.refunds=new Fn(this),this.reviews=new Nn(this),this.setupAttempts=new Gn(this),this.setupIntents=new Bn(this),this.shippingRates=new Ln(this),this.sources=new Kn(this),this.subscriptionItems=new Vn(this),this.subscriptionSchedules=new zn(this),this.subscriptions=new Hn(this),this.taxCodes=new Wn(this),this.taxIds=new Qn(this),this.taxRates=new Jn(this),this.tokens=new Xn(this),this.topups=new Yn(this),this.transfers=new Zn(this),this.webhookEndpoints=new ei(this),this.apps=new la(this),this.billing=new ca(this),this.billingPortal=new da(this),this.checkout=new ua(this),this.climate=new ma(this),this.entitlements=new pa(this),this.financialConnections=new fa(this),this.forwarding=new _a(this),this.identity=new ka(this),this.issuing=new ba(this),this.radar=new ga(this),this.reporting=new ha(this),this.sigma=new ya(this),this.tax=new Ra(this),this.terminal=new Ta(this),this.testHelpers=new xa(this),this.treasury=new Ca(this),this.v2=new Oa(this),this.account=this.accounts,this.oauth=new Sn(this)}rawRequest(e,t,n,i){return this._requestSender._rawRequest(e,t,n,i)}_setAuthenticator(e,t){if(e&&t)throw Error("Can't specify both apiKey and authenticator");if(!e&&!t)throw Error("Neither apiKey nor config.authenticator provided");this._authenticator=e?lr(e):t}_setAppInfo(e){if(e&&typeof e!=="object")throw Error("AppInfo must be an object.");if(e&&!e.name)throw Error("AppInfo.name is required");e=e||{},this._appInfo=gu.reduce((t,n)=>{if(typeof e[n]=="string")t=t||{},t[n]=e[n];return t},{})}setClientId(e){this._clientId=e}getClientId(){return this._clientId}getConstant(e){switch(e){case"DEFAULT_HOST":return Aa;case"DEFAULT_PORT":return lc;case"DEFAULT_BASE_PATH":return cc;case"DEFAULT_API_VERSION":return dc;case"DEFAULT_TIMEOUT":return uc;case"MAX_NETWORK_RETRY_DELAY_SEC":return mc;case"INITIAL_NETWORK_RETRY_DELAY_SEC":return pc}return w[e]}resolveBaseAddress(e){let t=this.getApiField("host");if(t!==Aa)return t;return sr[e]}getMaxNetworkRetries(){return this.getApiField("maxNetworkRetries")}_setApiNumberField(e,t,n){let i=ki(e,t,n);this._setApiField(e,i)}getMaxNetworkRetryDelay(){return mc}getInitialNetworkRetryDelay(){return pc}getClientUserAgent(e){return this.getClientUserAgentSeeded(w.USER_AGENT,e)}getClientUserAgentSeeded(e,t){let n={};for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;n[o]=encodeURIComponent(e[o]??"null")}let i=this._platformFunctions.getPlatformInfo();if(i&&this.getTelemetryEnabled())n.platform=encodeURIComponent(i);else delete n.platform;let r=this.getApiField("httpClient");if(r)n.httplib=encodeURIComponent(r.getClientName());if(this._appInfo)n.application=this._appInfo;if(this.getTelemetryEnabled()){let o=this._platformFunctions.getTelemetryId();if(o)n.telemetry_id=o}t(JSON.stringify(n))}getAppInfoAsString(){if(!this._appInfo)return"";let e=this._appInfo.name;if(this._appInfo.version)e+=`/${this._appInfo.version}`;if(this._appInfo.url)e+=` (${this._appInfo.url})`;return e}getTelemetryEnabled(){return this._enableTelemetry}getEmitEventBodiesEnabled(){return this._emitEventBodies}_prepResources(){for(let e in ae){if(!Object.prototype.hasOwnProperty.call(ae,e))continue;this[ul(e.replace("Resource",""))]=new ae[e](this)}}_getPropsFromConfig(e){if(!e)return{};let t=typeof e==="string";if(!(e===Object(e)&&!Array.isArray(e))&&!t)throw Error("Config must either be an object or a string");if(t)return{apiVersion:e};if(Object.keys(e).filter((r)=>!fc.includes(r)).length>0)throw Error(`Config object may only contain the following: ${fc.join(", ")}`);return e}_setApiField(e,t){this._api[e]=t}getApiField(e){return this._api[e]}parseEventNotification(e,t,n,i,r,o){if(!this.webhooks.signature)throw Error("ERR: missing signature helper, unable to verify");this.webhooks.signature.verifyHeader(e,t,n,i||this.webhooks.DEFAULT_TOLERANCE,r||this._platformFunctions.createDefaultCryptoProvider(),o);let s=e instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(e)):JSON.parse(e);if(s&&s.object==="event")throw Error("You passed a webhook payload to stripe.parseEventNotification, which expects an event notification. Use stripe.webhooks.constructEvent instead.");if(s.context)s.context=K.parse(s.context);return s.fetchEvent=()=>this._requestSender._rawRequest("GET",`/v2/core/events/${s.id}`,void 0,{stripeContext:s.context,headers:{"Stripe-Request-Trigger":`event=${s.id}`}},["fetch_event"]),s.fetchRelatedObject=()=>{if(!s.related_object)return Promise.resolve(null);return this._requestSender._rawRequest("GET",s.related_object.url,void 0,{stripeContext:s.context,headers:{"Stripe-Request-Trigger":`event=${s.id}`}},["fetch_related_object"])},s}async parseEventNotificationAsync(e,t,n,i,r,o){if(!this.webhooks.signature)throw Error("ERR: missing signature helper, unable to verify");await this.webhooks.signature.verifyHeaderAsync(e,t,n,i||this.webhooks.DEFAULT_TOLERANCE,r||this._platformFunctions.createDefaultCryptoProvider(),o);let s=e instanceof Uint8Array?JSON.parse(new TextDecoder("utf8").decode(e)):JSON.parse(e);if(s&&s.object==="event")throw Error("You passed a webhook payload to stripe.parseEventNotificationAsync, which expects an event notification. Use stripe.webhooks.constructEventAsync instead.");if(s.context)s.context=K.parse(s.context);return s.fetchEvent=()=>this._requestSender._rawRequest("GET",`/v2/core/events/${s.id}`,void 0,{stripeContext:s.context,headers:{"Stripe-Request-Trigger":`event=${s.id}`}},["fetch_event"]),s.fetchRelatedObject=()=>{if(!s.related_object)return Promise.resolve(null);return this._requestSender._rawRequest("GET",s.related_object.url,void 0,{stripeContext:s.context,headers:{"Stripe-Request-Trigger":`event=${s.id}`}},["fetch_related_object"])},s}}var Aa="api.stripe.com",lc="443",cc="/v1/",dc,uc=80000,mc=5,pc=0.5,gu,fc,_c=(e)=>new re(e,d.MAX_BUFFERED_REQUEST_METRICS);var kc=f(()=>{xi();Tl();b();ar();El();yi();hi();aa();W();Ul();Ci();ls();cs();ds();us();ji();ms();ps();fs();_s();ks();bs();gs();hs();ys();Rs();Ts();vs();Ss();xs();Cs();js();Ps();Es();qs();Os();As();Is();$s();Us();Ms();Ds();Fs();Ns();Gs();Bs();Ls();Ks();Hs();Vs();zs();Ws();Qs();Js();Xs();Ys();Zs();ea();ta();na();ia();ra();oa();sa();Ml();Dl();Fl();Nl();Gl();Bl();Ll();Kl();Hl();Vl();zl();Wl();Ql();Jl();Xl();tc();nc();ac();ws();aa();dc=qr,gu=["name","version","url","partner_id"],fc=["authenticator","apiVersion","typescript","maxNetworkRetries","httpAgent","httpClient","timeout","host","port","protocol","telemetry","emitEventBodies","appInfo","stripeAccount","stripeContext"];w.PACKAGE_VERSION="22.3.2";w.API_VERSION=qr;w.aiAgent="";w.AI_AGENT="";w.USER_AGENT={bindings_version:w.PACKAGE_VERSION,lang:"node",typescript:!1};w.StripeResource=d;w.resources=ae;w.HttpClient=q;w.HttpClientResponse=he;w.CryptoProvider=Re;w.StripeContext=K;w.errors=Si;w.Decimal=M;w._requestSenderFactory=_c});var bc={};Oi(bc,{Decimal:()=>M,Stripe:()=>w,default:()=>hu});var hu;var gc=f(()=>{Rl();Ri();kc();w.initialize(new fr);hu=w});import"@stacksjs/validation";import{log as Ai}from"@stacksjs/cli";import{db as Na}from"@stacksjs/database";async function Xc(e,t={}){let{olderThanDays:n=30,column:i="created_at",query:r}=t;try{if(r){let l=Na.deleteFrom(e);l=r(l);let u=await l.execute(),m=Array.isArray(u)?u:[u],p=Number(m[0]?.numDeletedRows??m.length??0);return Ai.info(`Pruned ${p} records from ${e}`),p}let o=new Date;o.setDate(o.getDate()-n);let s=await Na.deleteFrom(e).where(i,"<",o.toISOString()).execute(),a=Array.isArray(s)?s:[s],c=Number(a[0]?.numDeletedRows??a.length??0);return Ai.info(`Pruned ${c} records from ${e} older than ${n} days`),c}catch(o){throw Ai.error(`Failed to prune ${e}:`,o),o}}async function wf(e,t={}){return Xc(e,t)}function vf(e){if(!e?.prunable)return null;if(typeof e.prunable==="boolean")return{olderThanDays:30,column:"created_at"};return e.prunable}import{createCipheriv as Yc,createDecipheriv as Zc,createHash as ed,randomBytes as td}from"crypto";import{log as ai}from"@stacksjs/logging";var Ga="enc:",Ba="aes-256-gcm",nd=12,si=null;async function La(){if(si)return si;let e=process.env.APP_KEY;if(!e)try{e=(await import("@stacksjs/config").catch(()=>null))?.config?.app?.key}catch{}if(!e)return null;return si=ed("sha256").update(e).digest(),si}function ue(e){return typeof e==="string"&&e.startsWith(Ga)}async function Ii(e){if(e==null)return e;if(ue(e))return e;if(typeof e!=="string")return e;let t=await La();if(!t)return ai.warn("[orm] encrypted attribute: APP_KEY not set - storing value in plaintext"),e;let n=td(nd),i=Yc(Ba,t,n),r=Buffer.concat([i.update(e,"utf8"),i.final()]),o=i.getAuthTag();return`${Ga}${n.toString("base64")}:${o.toString("base64")}:${r.toString("base64")}`}async function $i(e){if(e==null)return e;if(typeof e!=="string")return e;if(!ue(e))return e;try{let t=await La();if(!t)return ai.warn("[orm] encrypted attribute: APP_KEY not set - cannot decrypt"),null;let[,n,i,r]=e.split(":");if(!n||!i||!r)return ai.warn("[orm] encrypted attribute: malformed envelope, returning null"),null;let o=Buffer.from(n,"base64"),s=Buffer.from(i,"base64"),a=Buffer.from(r,"base64"),c=Zc(Ba,t,o);return c.setAuthTag(s),Buffer.concat([c.update(a),c.final()]).toString("utf8")}catch(t){return ai.warn("[orm] encrypted attribute: decrypt failed (key rotation? corrupted ciphertext?)",{error:t}),null}}function Ui(e){let t=e.attributes;if(!t||typeof t!=="object")return[];let n=[];for(let[i,r]of Object.entries(t))if(r&&typeof r==="object"&&r.encrypted===!0)n.push(i);return n}import{sqlDateTime as id}from"@stacksjs/database";import{log as pe}from"@stacksjs/logging";var rd=[/^password$/i,/^password_hash$/i,/^api_key$/i,/_token$/i,/_secret$/i,/^remember_token$/i],Ha="model_audits",Fi=null;function od(e){Fi=e}async function Mi(){if(Fi!=null)return Fi;try{let e=await import("@stacksjs/router").catch(()=>null);if(!e)return null;let t=e.getCurrentRequest;if(typeof t!=="function")return null;let n=t();if(!n)return null;return(n.user??n._user)?.id??null}catch{return null}}function li(e){if(!e||typeof e!=="object")return null;let t={};for(let[n,i]of Object.entries(e)){if(rd.some((r)=>r.test(n)))continue;t[n]=i}return t}function me(e){if(!e||typeof e!=="object")return null;let t=e;if(t._attributes&&typeof t._attributes==="object")return{...t._attributes};return{...e}}function sd(e,t){if(!e||!t)return{old:e,next:t};let n={},i={},r=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of r)if(e[o]!==t[o])n[o]=e[o],i[o]=t[o];return{old:n,next:i}}async function Di(e,t=!1){try{let{db:n}=await import("@stacksjs/database");await n.insertInto(Ha).values({auditable_type:e.auditable_type,auditable_id:e.auditable_id,event:e.event,old_values:e.old_values?JSON.stringify(e.old_values):null,new_values:e.new_values?JSON.stringify(e.new_values):null,user_id:e.user_id,created_at:id()}).executeTakeFirst()}catch(n){if(pe.warn(`[orm] audit row write failed for ${e.auditable_type}#${String(e.auditable_id)} (${e.event})`,{error:n}),t)throw n}}function Va(e){return{async audits(t){try{let{db:n}=await import("@stacksjs/database");return(await n.selectFrom(Ha).selectAll().where("auditable_type","=",e).where("auditable_id","=",t).orderBy("created_at","desc").execute()??[]).map((r)=>({...r,old_values:typeof r.old_values==="string"?Ka(r.old_values):r.old_values,new_values:typeof r.new_values==="string"?Ka(r.new_values):r.new_values}))}catch(n){return pe.warn(`[orm] audits() lookup failed for ${e}#${String(t)}`,{error:n}),[]}}}}function Ka(e){try{return JSON.parse(e)}catch{return e}}function za(e){if(e&&typeof e==="object"&&"transactional"in e)return{transactional:e.transactional===!0};return{transactional:!1}}function Wa(e,t,n="id",i={}){let r=i.transactional===!0,o=e;if(typeof e.audits!=="function")e.audits=Va(t).audits;let s=async(u)=>{if(!r)return await u();let{db:m}=await import("@stacksjs/database");return await m.transaction(async()=>u())},a=e.create;if(typeof a==="function")e.create=async function(...u){return await s(async()=>{let m=await a.apply(this,u);try{let p=me(m),_=p?.[n];if(_!=null){let k=await Mi();await Di({auditable_type:t,auditable_id:_,event:"created",old_values:null,new_values:li(p),user_id:k},r)}}catch(p){if(pe.warn(`[orm] audit(create) failed for ${t}`,{error:p}),r)throw p}return m})};let c=e.update;if(typeof c==="function")e.update=async function(u,m){return await s(async()=>{let p=o.find,_=typeof p==="function"?me(await p.call(o,u)):null,k=await c.call(this,u,m);try{let g=me(k)??(typeof p==="function"?me(await p.call(o,u)):null),{old:y,next:R}=sd(_,g);if(R&&Object.keys(R).length>0){let v=await Mi();await Di({auditable_type:t,auditable_id:u,event:"updated",old_values:li(y),new_values:li(R),user_id:v},r)}}catch(g){if(pe.warn(`[orm] audit(update) failed for ${t}#${String(u)}`,{error:g}),r)throw g}return k})};let l=(u)=>{let m=e[u];if(typeof m!=="function")return;e[u]=async function(p){return await s(async()=>{let _=o.find,k=typeof _==="function"?me(await _.call(o,p)):null,g=await m.call(this,p);try{if(g!==!1&&k){let y=await Mi();await Di({auditable_type:t,auditable_id:p,event:"deleted",old_values:li(k),new_values:null,user_id:y},r)}}catch(y){if(pe.warn(`[orm] audit(${u}) failed for ${t}#${String(p)}`,{error:y}),r)throw y}return g})}};l("delete"),l("softDelete")}import{db as ad,sql as ld,sqlDateTime as Ni}from"@stacksjs/database";function G(e,t){if(typeof e!=="number"||!Number.isFinite(e)||e<=0)throw Error(`[orm/commentable] ${t} requires a positive numeric id (received ${String(e)})`)}var fe="commentable_upvotes",_e="commentables";function cd(e){let t=e;return t.code==="SQLITE_CONSTRAINT_UNIQUE"||t.code==="SQLITE_CONSTRAINT"||t.code==="23505"||t.errno===1062||/unique|duplicate/i.test(t.message??"")}function Gi(e){let t=ad;return{async comments(n){return G(n,"comments"),await t.selectFrom("commentables").where("commentables_id","=",n).where("commentables_type","=",e).selectAll().execute()},async commentCount(n){let i=await t.selectFrom("commentables").select(ld`count(*) as count`).where("commentables_id","=",n).where("commentables_type","=",e).executeTakeFirst();return Number(i?.count)||0},async addComment(n,i){if(G(n,"addComment"),!i||typeof i.title!=="string"||i.title.trim().length===0)throw Error("[orm/commentable] addComment requires a non-empty comment.title");if(typeof i.body!=="string"||i.body.trim().length===0)throw Error("[orm/commentable] addComment requires a non-empty comment.body");let r=await t.insertInto("commentables").values({...i,commentables_id:n,commentables_type:e,status:"pending",created_at:Ni(),updated_at:Ni()}).returningAll().executeTakeFirst();if(r&&typeof r==="object"&&"id"in r)return r;let o=r?.lastInsertRowid;if(o==null)return r;return await t.selectFrom("commentables").where("id","=",Number(o)).selectAll().executeTakeFirst()},async approvedComments(n){return await t.selectFrom("commentables").where("commentables_id","=",n).where("commentables_type","=",e).where("status","=","approved").selectAll().execute()},async pendingComments(n){return await t.selectFrom("commentables").where("commentables_id","=",n).where("commentables_type","=",e).where("status","=","pending").selectAll().execute()},async rejectedComments(n){return await t.selectFrom("commentables").where("commentables_id","=",n).where("commentables_type","=",e).where("status","=","rejected").selectAll().execute()},async upvoteComment(n,i){G(n,"upvoteComment"),G(i,"upvoteComment");let r=()=>t.selectFrom(fe).where("upvoteable_id","=",n).where("upvoteable_type","=",_e).where("user_id","=",i).selectAll().executeTakeFirst(),o=await r();if(o)return o;try{await t.insertInto(fe).values({upvoteable_id:n,upvoteable_type:_e,user_id:i,created_at:Ni()}).execute()}catch(s){if(!cd(s))throw s}return await r()},async removeCommentUpvote(n,i){G(n,"removeCommentUpvote"),G(i,"removeCommentUpvote"),await t.deleteFrom(fe).where("upvoteable_id","=",n).where("upvoteable_type","=",_e).where("user_id","=",i).execute()},async commentUpvoteCount(n){G(n,"commentUpvoteCount");let i=await t.selectFrom(fe).select("count(*) as count").where("upvoteable_id","=",n).where("upvoteable_type","=",_e).executeTakeFirst();return Number(i?.count)||0},async hasUpvotedComment(n,i){return G(n,"hasUpvotedComment"),G(i,"hasUpvotedComment"),!!await t.selectFrom(fe).where("upvoteable_id","=",n).where("upvoteable_type","=",_e).where("user_id","=",i).selectAll().executeTakeFirst()}}}import{db as dd,sql as ud,sqlDateTime as Qa}from"@stacksjs/database";function Bi(e,t){if(typeof e!=="number"||!Number.isFinite(e)||e<=0)throw Error(`[orm/taggable] ${t} requires a positive numeric id (received ${String(e)})`)}function Li(e){let t=dd;return{async tags(n){return Bi(n,"tags"),await t.selectFrom("taggables").where("taggable_id","=",n).where("taggable_type","=",e).selectAll().execute()},async tagCount(n){Bi(n,"tagCount");let i=await t.selectFrom("taggables").select(ud`count(*) as count`).where("taggable_id","=",n).where("taggable_type","=",e).executeTakeFirst();return Number(i?.count)||0},async addTag(n,i){if(Bi(n,"addTag"),!i||typeof i.name!=="string"||i.name.trim().length===0)throw Error("[orm/taggable] addTag requires a non-empty tag.name");return await t.insertInto("taggables").values({...i,taggable_id:n,taggable_type:e,slug:i.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),is_active:!0,created_at:Qa(),updated_at:Qa()}).execute(),await t.selectFrom("taggables").where("taggable_id","=",n).where("taggable_type","=",e).where("name","=",i.name).selectAll().executeTakeFirst()},async activeTags(n){return await t.selectFrom("taggables").where("taggable_id","=",n).where("taggable_type","=",e).where("is_active","=",!0).selectAll().execute()},async inactiveTags(n){return await t.selectFrom("taggables").where("taggable_id","=",n).where("taggable_type","=",e).where("is_active","=",!1).selectAll().execute()},async removeTag(n,i){await t.deleteFrom("taggables").where("taggable_id","=",n).where("taggable_type","=",e).where("id","=",i).execute()}}}import{db as md,sqlDateTime as ci}from"@stacksjs/database";function Ki(e){let t=md;async function n(i){return(await t.selectFrom("categorizable_models").where("categorizable_id","=",i).where("categorizable_type","=",e).selectAll().execute()).map((o)=>o.category_id)}return{async categories(i){let r=await n(i);if(r.length===0)return[];return await t.selectFrom("categorizables").where("id","in",r).selectAll().execute()},async categoryCount(i){return(await n(i)).length},async addCategory(i,r){let o=()=>t.selectFrom("categorizables").where("name","=",r.name).where("categorizable_type","=",e).selectAll().executeTakeFirst(),s=await o();if(!s)await t.insertInto("categorizables").values({name:r.name,description:r.description,slug:r.name.toLowerCase().replace(/[^a-z0-9]+/g,"-"),categorizable_type:e,is_active:!0,created_at:ci(),updated_at:ci()}).execute(),s=await o();return await t.insertInto("categorizable_models").values({categorizable_id:i,categorizable_type:e,category_id:s.id,created_at:ci(),updated_at:ci()}).execute(),s},async activeCategories(i){let r=await n(i);if(r.length===0)return[];return await t.selectFrom("categorizables").where("id","in",r).where("is_active","=",!0).selectAll().execute()},async inactiveCategories(i){let r=await n(i);if(r.length===0)return[];return await t.selectFrom("categorizables").where("id","in",r).where("is_active","=",!1).selectAll().execute()},async removeCategory(i,r){await t.deleteFrom("categorizable_models").where("categorizable_id","=",i).where("categorizable_type","=",e).where("category_id","=",r).execute()}}}import{db as pd,sqlDateTime as fd}from"@stacksjs/database";function Hi(e,t){let n=pd,i=t?.table||`${e}_likes`,r=t?.foreignKey||`${e.replace(/s$/,"")}_id`;return{async likes(o){return await n.selectFrom(i).where(r,"=",o).selectAll().execute()},async likeCount(o){let s=await n.selectFrom(i).select("count(*) as count").where(r,"=",o).executeTakeFirst();return Number(s?.count)||0},async like(o,s){if(typeof o!=="number"||!Number.isFinite(o)||o<=0)throw Error(`[orm/likeable] like requires a positive numeric id (received ${String(o)})`);if(typeof s!=="number"||!Number.isFinite(s)||s<=0)throw Error(`[orm/likeable] like requires a positive numeric userId (received ${String(s)})`);let a=fd();try{return await n.insertInto(i).values({[r]:o,user_id:s,created_at:a,updated_at:a}).returningAll().executeTakeFirst()}catch(c){let l=c;if(!(l.code==="SQLITE_CONSTRAINT_UNIQUE"||l.code==="SQLITE_CONSTRAINT"||l.code==="23505"||l.errno===1062||/unique|duplicate/i.test(l.message??"")))throw c;let m=await n.selectFrom(i).where(r,"=",o).where("user_id","=",s).selectAll().executeTakeFirst();if(m)return m;throw c}},async unlike(o,s){await n.deleteFrom(i).where(r,"=",o).where("user_id","=",s).execute()},async isLiked(o,s){return!!await n.selectFrom(i).where(r,"=",o).where("user_id","=",s).selectAll().executeTakeFirst()},async likedBy(o){return(await n.selectFrom(i).select([r]).where("user_id","=",o).execute()).map((a)=>Number(a[r])).filter(Boolean)}}}function Xa(e){let t=e;return t?.code==="SQLITE_CONSTRAINT_UNIQUE"||t?.code==="SQLITE_CONSTRAINT"||t?.code==="23505"||t?.errno===1062||/unique|duplicate/i.test(t?.message??"")}function _d(e,t,n){let i=e;if(e instanceof Error&&typeof i.status==="number"&&Number.isInteger(i.status)&&i.status>=400&&i.status<600){let r={error:e.message};if(i.details!==void 0)r.details=i.details;return{status:i.status,body:r}}if(Xa(e))return{status:409,body:{error:`${t} already exists`}};return{status:500,body:{error:`Failed to ${n} ${t}`,detail:String(e)}}}function I(e){return e.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function kd(e){let t={};for(let[n,i]of Object.entries(e))t[I(n)]=i;return t}function Nf(e,t){let n=String(t||"").replace(/^\/+|\/+$/g,""),i=String(e).replace(/^\/+/,"");return`/api/${n?`${n}/`:""}${i}`}function Gf(e){if(!e)return null;let t=e.attributes??{};if(Object.prototype.hasOwnProperty.call(t,"teamId")||Object.prototype.hasOwnProperty.call(t,"team_id"))return"team_id";return e.belongsTo?.some((n)=>n==="Team")?"team_id":null}function Bf(e,t,n){let i=Object.keys(e).find((o)=>I(o)===I(t));if(Array.isArray(n)){if(i===void 0)return{data:e,error:"Ownership value is required"};if(!n.some((o)=>String(o)===String(e[i])))return{data:e,error:"Ownership value is not available to this caller"};return{data:{...e,[t]:e[i]}}}if(n===null||n===void 0)return{data:e,error:"Caller has no ownership identity"};let r={...e};for(let o of Object.keys(r))if(I(o)===I(t))delete r[o];return r[t]=n,{data:r}}function bd(e){if(!e)return[];let t=Object.entries(e.attributes??{}).filter(([,n])=>n?.fillable===!0).map(([n])=>n);for(let n of e.belongsTo??[]){if(typeof n!=="string"||!n.trim())continue;let i=I(n.trim()).split("_").filter(Boolean);if(i.length===0)continue;let r=`${i[0]}${i.slice(1).map((o)=>`${o[0]?.toUpperCase()}${o.slice(1)}`).join("")}Id`;t.push(r)}return[...new Set(t)]}function gd(e,t){if(!e||t.length===0)return{};let n={};for(let i of t){if(i in e){n[i]=e[i];continue}let r=I(i);if(r!==i&&r in e)n[i]=e[r]}return n}function hd(e,t){if(e?.name!=="date"||t instanceof Date||typeof t!=="string")return t;let n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(!n)return t;let i=Number(n[1]),r=Number(n[2]),o=Number(n[3]),s=new Date(Date.UTC(i,r-1,o));if(s.getUTCFullYear()!==i||s.getUTCMonth()!==r-1||s.getUTCDate()!==o)return t;return s}function Lf(e,t){if(!t.length)return e;let n={...e};for(let i of t)delete n[i],delete n[I(i)];return n}function Kf(e,t){if(!e||t.length===0)return e;let n={...e};for(let i of t)delete n[i],delete n[I(i)];return n}var yd=["id","uuid","created_at","updated_at","deleted_at"];function Hf(e,t){let n=new Map;for(let i of[...Object.keys(e??{}),...yd]){let r=I(i);if(!/^\w+$/.test(r))continue;n.set(i,r),n.set(r,r)}for(let i of t)n.delete(i),n.delete(I(i));return n}function Vf(e,t,n){if(!t)return e;let i=String(t).split(",").map((o)=>o.trim()).filter(Boolean),r=e;for(let o of i){let s=o.startsWith("-"),a=s?o.slice(1):o;if(!/^\w+$/.test(a))continue;let c=n.get(a);if(!c)continue;r=r.orderBy(c,s?"desc":"asc")}return r}var Rd={string:{get:(e)=>e!=null?String(e):null,set:(e)=>e!=null?String(e):null},number:{get:(e)=>e!=null?Number(e):null,set:(e)=>e!=null?Number(e):null},integer:{get:(e)=>e!=null?Math.trunc(Number(e)):null,set:(e)=>e!=null?Math.trunc(Number(e)):null},float:{get:(e)=>e!=null?Number.parseFloat(String(e)):null,set:(e)=>e!=null?Number.parseFloat(String(e)):null},boolean:{get:(e)=>e===1||e==="1"||e===!0||e==="true",set:(e)=>e===!0||e===1||e==="1"||e==="true"?1:0},json:{get:(e)=>e==null?null:typeof e==="string"?Td(e):e,set:(e)=>e==null?null:typeof e==="string"?e:JSON.stringify(e)},datetime:{get:(e)=>e?new Date(e):null,set:(e)=>e instanceof Date?e.toISOString():e},date:{get:(e)=>e?new Date(e):null,set:(e)=>e instanceof Date?e.toISOString().split("T")[0]:e},array:{get:(e)=>e==null?[]:Array.isArray(e)?e:typeof e==="string"?wd(e):[],set:(e)=>e==null?null:Array.isArray(e)?JSON.stringify(e):e}};function Td(e){try{return JSON.parse(e)}catch{return e}}function wd(e){try{return JSON.parse(e)}catch{return[]}}function zf(e,t,n){if(!e||typeof e!=="object"||!t||Object.keys(t).length===0)return e;let i={...e};for(let[r,o]of Object.entries(t)){let s=typeof o==="string"?Rd[o]:o;if(!s||typeof s[n]!=="function")continue;if(Object.prototype.hasOwnProperty.call(i,r))i[r]=s[n](i[r]);let a=I(r);if(a!==r&&Object.prototype.hasOwnProperty.call(i,a))i[a]=s[n](i[a])}return i}function Ya(e,t,n){let i=t?.attributes??{},r={};for(let[o,s]of Object.entries(i)){let a=s?.validation?.rule;if(!a||typeof a.validate!=="function")continue;let c=Object.prototype.hasOwnProperty.call(e,o);if(!c&&n==="updating")continue;let l=s!==null&&typeof s==="object"&&Object.prototype.hasOwnProperty.call(s,"default"),u=c?e[o]:l?s.default:void 0,m=hd(a,u),p=a.validate(m);if(!p?.valid&&Array.isArray(p?.errors)&&p.errors.length>0)r[o]=p.errors.map((_)=>s?.validation?.message?.[_?.code]??_?.message??"invalid")}return Object.keys(r).length===0?{valid:!0}:{valid:!1,errors:r}}function Wf(e){return e.replace(/\{[^}]*\}/g,"{}").replace(/:[^/]+/g,"{}")}function Vi(e){if(Array.isArray(e))return e.filter((t)=>typeof t==="string"&&t.length>0);return typeof e==="string"&&e?[e]:[]}function Qf(e){let t=typeof e==="object"&&e!==null&&"middleware"in e,n=e?.middleware;if(!t)return{read:["auth"],write:["auth"],declared:!1};if(n&&typeof n==="object"&&!Array.isArray(n)){let r=n;return{read:"read"in r?Vi(r.read):["auth"],write:"write"in r?Vi(r.write):["auth"],declared:!0}}let i=Vi(n);return{read:i,write:i,declared:!0}}var Ja=15,vd=100;function Jf(e){let t=Number.parseInt(e.get("page")||String(1),10),n=Number.isFinite(t)?Math.max(1,t):1,i=Number.parseInt(e.get("per_page")||String(Ja),10),r=Math.min(Number.isFinite(i)?Math.max(1,i):Ja,vd);return{page:n,perPage:r,offset:(n-1)*r}}function di(e,t){let n=new URL(e.toString());return n.searchParams.set("page",String(t)),`${n.pathname}${n.search}`}function Sd(e,t,n,i,r,o){let s=(t-1)*n,a=i===0,c={page:t,per_page:n,from:a?null:s+1,to:a?null:s+i,has_more_pages:r,prev_page_url:t>1?di(e,t-1):null,next_page_url:r?di(e,t+1):null};if(o!==void 0&&!Number.isNaN(o)){let l=Math.max(1,Math.ceil(o/n));c.total=o,c.last_page=l,c.first_page_url=di(e,1),c.last_page_url=di(e,l)}return c}function Xf(e,t,n,i,r,o){let{page:s,...a}=Sd(e,t,n,i,r,o);return{current_page:s,...a}}import{cacheRequestQuery as xd}from"@stacksjs/router";var ui=new WeakMap;function e_(e,t){return xd(`batchLoad:${e.name??"model"}:${String(t)}`,async()=>new Promise((n,i)=>{let r=ui.get(e);if(!r)r={keys:[],resolvers:[],scheduled:!1},ui.set(e,r);if(r.keys.push(t),r.resolvers.push({key:t,resolve:n,reject:i}),r.scheduled)return;r.scheduled=!0,Promise.resolve().then(async()=>{let o=ui.get(e);if(!o)return;ui.delete(e);let s=Array.from(new Set(o.keys));try{let a=typeof e.findMany==="function"?await e.findMany(s):await Promise.all(s.map((l)=>e.find?.(l))),c=new Map;for(let l of a??[]){let u=l?.id;if(u!==void 0)c.set(u,l)}for(let l of o.resolvers)l.resolve(c.get(l.key))}catch(a){for(let c of o.resolvers)c.reject(a)}})}))}import{db as r_}from"@stacksjs/database";class Cd{conditions=[];where(e,...t){let[n,i]=t,r=i===void 0?"=":n,o=i===void 0?n:i;this.addCondition("and","where",e,r,o)}orWhere(e,...t){let[n,i]=t,r=i===void 0?"=":n,o=i===void 0?n:i;this.addCondition("or","where",e,r,o)}whereIn(e,t){this.conditions.push({type:"and",method:"whereIn",column:e,values:t})}whereNotIn(e,t){this.conditions.push({type:"and",method:"whereIn",column:e,values:t,operator:"not in"})}whereNull(e){this.conditions.push({type:"and",method:"whereNull",column:e})}whereNotNull(e){this.conditions.push({type:"and",method:"whereNotNull",column:e})}whereBetween(e,t){this.conditions.push({type:"and",method:"whereBetween",column:e,range:t})}whereExists(e){this.conditions.push({type:"and",method:"whereExists",column:"",callback:e})}addCondition(e,t,n,i,r){this.conditions.push({type:e,method:t,column:n,operator:i,value:r})}getConditions(){return this.conditions}}import{db as zi,runInTransactionScope as jd}from"@stacksjs/database";async function a_(e,t){return await jd(async()=>await zi.transaction(e,t))}async function l_(e){return await zi.savepoint(e)}function c_(e,t){return zi.transactional(e,t)}import{path as B}from"@stacksjs/path";import{fs as ne,globSync as Xi}from"@stacksjs/storage";import{plural as il,singular as Za,snakeCase as E}from"@stacksjs/strings";import{isString as mi}from"@stacksjs/validation";function rl(e){let t=e.belongsToMany;if(!t)return[];if(Array.isArray(t))return t.map((n)=>({relationName:typeof n==="string"?E(n):E(String(n.model)),relation:n}));return Object.entries(t).map(([n,i])=>{if(typeof i==="string")return{relationName:n,relation:i};return{relationName:n,relation:{model:i.model,pivotTable:i.table,firstForeignKey:i.foreignKey,secondForeignKey:i.relatedKey}}})}async function __(e){if(typeof e==="string")e=(await import(e)).default;return e.table??E(il(e?.name||""))}function ke(e,t){if(e.name)return e.name;return B.basename(t).replace(/\.ts$/,"")}function F(e,t){if(e.table)return e.table;return E(il(ke(e,t)))}function Pd(e,t){let n=[e,t];return n.sort(),n.join("_")}function k_(e,t){return t in e}async function Ed(e,t){let n=[];if(e.hasOne)for(let i of e.hasOne)n.push(await Wi(i,e,t,"hasOne"));if(e.hasMany)for(let i of e.hasMany)n.push(await Wi(i,e,t,"hasMany"));if(e.belongsTo)for(let i of e.belongsTo)n.push(await Wi(i,e,t,"belongsTo"));if(e.hasOneThrough)for(let i of e.hasOneThrough)n.push(await tl(i,e,t,"hasOneThrough"));if(e.hasManyThrough)for(let i of e.hasManyThrough)n.push(await tl(i,e,t,"hasManyThrough"));if(e.belongsToMany)for(let{relationName:i,relation:r}of rl(e))n.push(await Od(r,e,t,"belongsToMany",i));if(e.morphOne)n.push(await nl(e.morphOne,e,t,"morphOne"));if(e.morphMany){let i=Array.isArray(e.morphMany)?e.morphMany:[e.morphMany];for(let r of i)n.push(await nl(r,e,t,"morphMany"))}if(e.morphTo){let i=e.morphTo,r=Array.isArray(i)?i:typeof i==="object"&&i!==null?[i]:[];for(let o of r)n.push(qd(o,e,t))}if(e.morphToMany){let i=Array.isArray(e.morphToMany)?e.morphToMany:[e.morphToMany];for(let r of i)n.push(el(r,e,t,"morphToMany"))}if(e.morphedByMany){let i=Array.isArray(e.morphedByMany)?e.morphedByMany:[e.morphedByMany];for(let r of i)n.push(el(r,e,t,"morphedByMany"))}return n}function qd(e,t,n){let i=e&&typeof e==="object"&&e.name?String(e.name):`${E(n)}able`,r=e?.type||`${i}_type`;return{relationship:"morphTo",model:"",table:"",relationTable:"",foreignKey:e?.id||`${i}_id`,modelKey:r,relationName:i,relationModel:n,throughModel:"",throughForeignKey:"",pivotForeign:"",pivotKey:"",pivotTable:""}}function el(e,t,n,i){let r=typeof e==="object"&&e!==null,o=r?String(e.model||""):String(e),s=r&&e.morphName?String(e.morphName):`${E(n)}able`,a=r&&e.pivotTable?String(e.pivotTable):s,c=r&&e.id||`${s}_id`,l=r&&e.type||`${s}_type`;return{relationship:i,model:o,table:"",relationTable:"",foreignKey:c,modelKey:l,relationName:s,relationModel:n,throughModel:"",throughForeignKey:"",pivotForeign:c,pivotKey:l,pivotTable:a}}async function pi(e,t){let n=Ji(`${t}.ts`),i=Ji(`${e}.ts`),r=Qi(`${e}.ts`),o=Qi(`${t}.ts`);if(!n&&!o)throw Error(`Model not found: ${t}`);if(!i&&!r)throw Error(`Model not found: ${e}`);let s;try{if(ne.existsSync(n))s=(await import(n)).default;else s=(await import(o)).default}catch(c){throw Error(`Failed to load model: ${t}. Error: ${c?.message||"Unknown error"}`)}let a=ne.existsSync(i)?i:r;return{modelRelation:s,modelPath:a,modelRelationPath:ne.existsSync(n)?n:o}}async function tl(e,t,n,i){let r="",o="",s="",a="";if(mi(e))r=e;else r=e.model,o=e.relationName||"",s=e.through,a=e.throughForeignKey||"";let{modelRelation:c,modelPath:l,modelRelationPath:u}=await pi(n,r),m=F(c,u),p=F(t,l),_=E(ke(c,u)),k=E(n);return{relationship:i,model:r,table:m,relationTable:p,foreignKey:`${k}_id`,modelKey:`${_}_id`,relationName:o,relationModel:n,throughModel:s,throughForeignKey:a,pivotForeign:`${k}_id`,pivotKey:`${_}_id`,pivotTable:p}}async function Od(e,t,n,i,r){let o="",s="",a="",c=E(n);if(mi(e))o=e;else o=e.model,s=e.pivotTable||"",a=e.firstForeignKey||`${c}_id`;let{modelRelation:l,modelPath:u,modelRelationPath:m}=await pi(n,o),p=F(l,m),_=F(t,u),k=E(ke(l,m));return{relationship:i,model:o,table:p,relationTable:_,foreignKey:typeof e==="string"?`${c}_id`:e.firstForeignKey||`${c}_id`,modelKey:typeof e==="string"?`${k}_id`:e.secondForeignKey||`${k}_id`,relationName:r,relationModel:n,throughModel:"",throughForeignKey:"",pivotForeign:a,pivotKey:`${k}_id`,pivotTable:s}}async function nl(e,t,n,i){let r="",o="",s="",a="";if(mi(e))r=e,o=`${E(n)}able`;else r=e.model,o=e.morphName||`${E(n)}able`,s=e.type||`${o}_type`,a=e.id||`${o}_id`;let{modelRelation:c,modelPath:l,modelRelationPath:u}=await pi(n,r),m=F(c,u),p=F(t,l);return{relationship:i,model:r,table:m,relationTable:p,foreignKey:a||`${o}_id`,modelKey:s||`${o}_type`,relationName:o,relationModel:n,throughModel:"",throughForeignKey:"",pivotForeign:"",pivotKey:"",pivotTable:p}}async function Wi(e,t,n,i){let r="",o="";if(mi(e))r=e;else r=e.model,o=e.relationName||"";let{modelRelation:s,modelPath:a,modelRelationPath:c}=await pi(n,r),l=F(s,c),u=F(t,a),m=E(ke(s,c)),p=E(n),_={relationship:i,model:r,table:l,relationTable:u,foreignKey:typeof e==="string"?`${p}_id`:e.foreignKey||`${p}_id`,modelKey:`${m}_id`,relationName:o,relationModel:n,throughModel:"",throughForeignKey:"",pivotForeign:`${p}_id`,pivotKey:`${m}_id`,pivotTable:u};if(i==="belongsTo")_.foreignKey="";return _}function b_(e){let t=/belongs/,n=/has/,i=/Through/,r=/morph/;if(i.test(e))return"throughType";if(t.test(e))return"belongsType";if(n.test(e))return"hasType";if(r.test(e))return"morphType";return""}function g_(e){let t=/One/;if(/Many/.test(e))return"many";if(t.test(e))return"one";return""}async function h_(e,t){let n=[];if("belongsToMany"in e){for(let{relation:i}of rl(e)){let r,o;if(typeof i==="string")o=i;else o=i.model;let s=Ji(`${o}.ts`),a=Qi(`${o}.ts`);if(ne.existsSync(s))r=(await import(s)).default;else r=(await import(a)).default;let c=F(r,s),l=F(e,t),u=typeof i==="object"&&"firstForeignKey"in i?i.firstForeignKey:`${Za(l)}_${e.primaryKey}`,m=typeof i==="object"&&"secondForeignKey"in i?i.secondForeignKey:`${Za(c)}_${e.primaryKey}`;n.push({table:(typeof i==="object"&&"pivotTable"in i?i.pivotTable:void 0)??Pd(l,c),firstForeignKey:u,secondForeignKey:m})}return n}return[]}async function y_(e){let t=Xi([B.userModelsPath("*.ts"),B.storagePath("framework/defaults/app/Models/**/*.ts")],{absolute:!0}),n=[];for(let i=0;i<t.length;i++){let r=t[i],o=await import(r);if(e===o.default.name)continue;let s=ke(o,r),a=await Ed(o.default,s);if(!a.length)continue;let c=a.find((l)=>l.model===e);if(c)n.push(c)}return n}function R_(e){if(e===void 0)return[];return Object.keys(e).filter((t)=>e[t]?.hidden===!0)}function T_(e){let t=e.attributes;if(t===void 0)return[];return Object.keys(t).filter((n)=>t[n]?.guarded===!0).map((n)=>E(n))}function w_(e,t){let n=e.attributes,i=[];if(n===void 0)return[];let r=typeof e.traits?.billable==="object"||typeof e.traits?.billable==="boolean",o=typeof e.traits?.useAuth==="object"?e.traits?.useAuth.usePasskey:!1,s=e.traits?.useUuid||!1;if(r)i.push("stripe_id");if(s)i.push("uuid");if(o)i.push(...["two_factor_secret","public_key"]);let a=t.map((c)=>c.foreignKey).filter((c)=>c);return[...Object.keys(n).filter((c)=>{if(n===void 0)return!1;return n[c]?.fillable===!0}).map((c)=>E(c)),...i,...a]}async function v_(e,t){let n=e.attributes;if(!n)n={};let i=Object.keys(n),r=[],o=Bun.file(t),s="";try{if(await o.exists())s=await o.text()}catch{s=""}let a=/rule:.*$/gm,c;c=a.exec(s);while(c!==null)r.push(c[0]),c=a.exec(s);return i.map((u,m)=>{let p=n[u],_=null,k=!1,g=!1,y=!1,R=!1;if(p)_=p||null,k=p.unique||!1,g=p.hidden||!1,y=p.fillable||!1;let v=r[m]??"";return R=(p.validation?.rule).isRequired??!1,{field:u,default:_,unique:k,hidden:g,fillable:y,required:R,fieldArray:Ad(v)}})}function Ad(e){let t=e.split("rule: schema.");if(t.length!==2)return null;if(!t[1])t[1]="";let n=t[1].replace(/,/g,"");if(!n)return null;let i=n.split("."),r=/\(([^)]+)\)/;return i.map((o)=>{let s=r.exec(o),a=s?s[1]:null;return{entity:o.replace(r,"").replace(/\(|\)/g,""),charValue:a}})[0]||null}function S_(e){let t=e.fieldArray?.entity;switch(t){case"enum":return"string | string[]";case"date":return"Date | string";case"timestamp":return"Date | string";case"datetime":return"Date | string";case"float":return"number";case"double":return"number";case"decimal":return"number";case"integer":return"number";case"bigint":return"number";default:return t}}function Qi(e){let t=B.join(B.storagePath("framework/defaults/app/Models"),"/"),n=B.join(t,e);if(ne.existsSync(n))return n;return Xi(`${t}**/${e}`,{absolute:!0})[0]??""}function Ji(e){let t=B.join(B.userModelsPath("/"),"/"),n=B.join(t,e);if(ne.existsSync(n))return n;return Xi(`${t}**/${e}`,{absolute:!0})[0]??""}function x_(e){let t=typeof e==="number"?new Date(e):typeof e==="string"?new Date(e):e;if(Number.isNaN(t.getTime()))throw Error(`Invalid date value: ${String(e)}`);return t.toISOString().replace("T"," ").split(".")[0]??""}function C_(e){return e.toISOString().split("T")[0]??""}function j_(e){return e.getTime()}import{createModel as vu,registerModel as Su}from"@stacksjs/query-builder";import{log as A}from"@stacksjs/logging";import{snakeCase as H}from"@stacksjs/strings";import{AsyncLocalStorage as Ec}from"async_hooks";function Id(e){if(e===null||typeof e!=="object")return!1;let t=e;return Array.isArray(t.data)&&typeof t.current_page==="number"&&typeof t.per_page==="number"&&typeof t.total==="number"&&typeof t.last_page==="number"}function $d(e){if(e===null||typeof e!=="object")return!1;let t=e;return Array.isArray(t.data)&&typeof t.current_page==="number"&&typeof t.per_page==="number"&&typeof t.has_more_pages==="boolean"&&!("total"in t)}function Ud(e){if(e===null||typeof e!=="object")return!1;let t=e;return Array.isArray(t.data)&&(typeof t.next_cursor==="string"||t.next_cursor===null)}function Yi(e){let{data:t}=e,{perPage:n,page:i,total:r,lastPage:o}=e.meta,s=t.length===0,a=s?null:(i-1)*n+1,c=s?null:a+t.length-1;return{data:t,current_page:i,per_page:n,total:r,last_page:o,from:a,to:c,has_more_pages:i<o}}function Zi(e){return{data:e.data,current_page:e.meta.page,per_page:e.meta.perPage,has_more_pages:e.meta.hasMore}}function er(e){return{data:e.data,per_page:e.meta.perPage,next_cursor:ol(e.meta.nextCursor),prev_cursor:ol(e.meta.prevCursor),has_more_pages:e.meta.nextCursor!==null&&e.meta.nextCursor!==void 0}}function ol(e){if(e===null||e===void 0)return null;if(typeof e==="string")return e;return JSON.stringify(e)}function nr(e,t){let n=or(),i=n?tr(n,"per_page"):void 0,r=n?tr(n,"page"):void 0,o=e!==void 0?Math.max(1,Math.floor(e)):Math.min(100,Math.max(1,i??15)),s=Math.max(1,Math.floor(t??r??1));return{perPage:o,page:s}}function ir(e,t){let n=or(),i=n?al(n,"cursor"):void 0,r=n?tr(n,"per_page"):void 0,o=e!==void 0?Math.max(1,Math.floor(e)):Math.min(100,Math.max(1,r??15)),a=sl(t!==void 0?t:i??null);return{perPage:o,cursor:a}}function sl(e){if(e===null||e===void 0)return null;if(Array.isArray(e))return e;if(typeof e==="string"&&e.startsWith("["))try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e}function rr(e){let t=or();if(!t)return e;let n=(()=>{try{return new URL(t.url)}catch{return null}})();if(!n)return e;let i=n.pathname;if(e.path=i,"next_cursor"in e)return e.next_page_url=e.next_cursor!==null?Y(n,{cursor:e.next_cursor}):null,e.prev_page_url=e.prev_cursor!==null?Y(n,{cursor:e.prev_cursor}):null,e;let r=e.current_page;if(e.prev_page_url=r>1?Y(n,{page:r-1}):null,"total"in e){let o=e.last_page;e.next_page_url=r<o?Y(n,{page:r+1}):null,e.first_page_url=Y(n,{page:1}),e.last_page_url=Y(n,{page:o})}else e.next_page_url=e.has_more_pages?Y(n,{page:r+1}):null;return e}function Y(e,t){let n=new URL(e.toString());for(let[i,r]of Object.entries(t))n.searchParams.set(i,String(r));return`${n.pathname}${n.search}`}var ie;function or(){if(ie===null)return;if(ie===void 0)try{let t=T("@stacksjs/router");if(typeof t.getCurrentRequest==="function")ie=t.getCurrentRequest;else{ie=null;return}}catch{ie=null;return}return ie()}function tr(e,t){let n=al(e,t);if(n===void 0)return;let i=Number(n);return Number.isFinite(i)?i:void 0}function al(e,t){let n=e.query?.[t];if(n===void 0)return;return Array.isArray(n)?n[0]:n}import{db as yu}from"@stacksjs/database";function hc(e){let t=yu;return{async createStripeUser(n,i){let{manageCustomer:r}=await import("@stacksjs/payments");return await r.createStripeCustomer(n,i)},async updateStripeUser(n,i){let{manageCustomer:r}=await import("@stacksjs/payments");return await r.updateStripeCustomer(n,i)},async deleteStripeUser(n){let{manageCustomer:i}=await import("@stacksjs/payments");return await i.deleteStripeUser(n)},async createOrGetStripeUser(n,i){let{manageCustomer:r}=await import("@stacksjs/payments");return await r.createOrGetStripeUser(n,i)},async retrieveStripeUser(n){let{manageCustomer:i}=await import("@stacksjs/payments");return await i.retrieveStripeUser(n)},async defaultPaymentMethod(n){let{managePaymentMethod:i}=await import("@stacksjs/payments");return await i.retrieveDefaultPaymentMethod(n)},async setDefaultPaymentMethod(n,i){let{managePaymentMethod:r}=await import("@stacksjs/payments");return await r.setDefaultPaymentMethod(n,i)},async addPaymentMethod(n,i){let{managePaymentMethod:r}=await import("@stacksjs/payments");return await r.addPaymentMethod(n,i)},async paymentMethods(n,i){let{managePaymentMethod:r}=await import("@stacksjs/payments");return await r.listPaymentMethods(n,i)},async newSubscription(n,i,r,o={}){let{manageSubscription:s}=await import("@stacksjs/payments"),a=await s.create(n,i,r,o),l=a.latest_invoice?.payment_intent;return{subscription:a,paymentIntent:l}},async updateSubscription(n,i,r,o={}){let{manageSubscription:s}=await import("@stacksjs/payments"),a=await s.update(n,i,r,o),l=a.latest_invoice?.payment_intent;return{subscription:a,paymentIntent:l}},async cancelSubscription(n,i,r={}){let{manageSubscription:o}=await import("@stacksjs/payments");return{subscription:await o.cancel(i,r)}},async activeSubscription(n){let{manageSubscription:i}=await import("@stacksjs/payments"),r=await t.selectFrom("subscriptions").where("user_id","=",n.id).where("provider_status","=","active").selectAll().executeTakeFirst();if(r){let o=await i.retrieve(n,r.provider_id||"");return{subscription:r,providerSubscription:o}}return},async checkout(n,i,r={}){let{manageCheckout:o,manageCustomer:s}=await import("@stacksjs/payments"),a={};if(r.enableTax)a.automatic_tax={enabled:!0},delete r.enableTax;if(r.allowPromotions)a.allow_promotion_codes=!0,delete r.allowPromotions;let u={...{mode:"payment",customer:(await s.createOrGetStripeUser(n,{})).id,line_items:i.map((m)=>({price:m.priceId,quantity:m.quantity||1}))},...a,...r};return await o.create(n,u)},async createSetupIntent(n,i={}){let{manageSetupIntent:r}=await import("@stacksjs/payments");return await r.create(n,i)},async subscriptionHistory(n){let{manageInvoice:i}=await import("@stacksjs/payments");return await i.list(n)},async transactionHistory(n){let{manageTransaction:i}=await import("@stacksjs/payments");return await i.list(n)},async connectAccount(n,i={}){let r=i.accountColumn||"stripe_account_id",o=(n._attributes??n)[r];if(!o)return null;let s=await ti();try{return await s.accounts.retrieve(o)}catch{return null}},async createConnectAccount(n,i={}){let r=i.accountColumn||"stripe_account_id",o=n._attributes??n,s=o[r],a=await ti();if(!s){let{stacksIdempotencyKey:c}=await import("@stacksjs/payments"),l=i.modelTable||e,u=await a.accounts.create({type:i.type??"express",email:i.email??o.email,country:i.country??"US",capabilities:i.capabilities??{card_payments:{requested:!0},transfers:{requested:!0}}},{idempotencyKey:c("connect.account.create",l,o.id)});return s=u.id,await t.updateTable(l).set({[r]:s}).where("id","=",Number(o.id)).execute(),u}return await a.accounts.retrieve(s)},async connectOnboardLink(n,i){let r=i.accountColumn||"stripe_account_id",s=(n._attributes??n)[r];if(!s)throw Error("connectOnboardLink: model has no Stripe Connect account; call createConnectAccount first");return{url:(await(await ti()).accountLinks.create({account:s,refresh_url:i.refreshUrl,return_url:i.returnUrl,type:i.type??"account_onboarding"})).url,accountId:s}},async syncConnectStatus(n,i={}){let r=i.accountColumn||"stripe_account_id",o=i.chargesColumn||"charges_enabled",s=i.payoutsColumn||"payouts_enabled",a=n._attributes??n,c=a[r];if(!c)return{chargesEnabled:!1,payoutsEnabled:!1};let u=await(await ti()).accounts.retrieve(c),m=!!u.charges_enabled,p=!!u.payouts_enabled,_=i.modelTable||e;return await t.updateTable(_).set({[o]:m,[s]:p}).where("id","=",Number(a.id)).execute(),{chargesEnabled:m,payoutsEnabled:p}},async chargeWithSplit(n,i){let r=await ti(),o=i.accountColumn||"stripe_account_id",s=n._attributes??n,a=i.connectAccountId||s[o],c={amount:i.amountCents,currency:i.currency||"usd",automatic_payment_methods:{enabled:!0},metadata:i.metadata};if(a){if(c.transfer_data={destination:a},i.platformFeeCents)c.application_fee_amount=i.platformFeeCents}let{freshIdempotencyKey:l}=await import("@stacksjs/payments");return await r.paymentIntents.create(c,{idempotencyKey:l("payment_intent.create",s.id,i.amountCents)})}}}async function ti(){let e=globalThis.process?.env?.STRIPE_SECRET_KEY;if(!e)throw Error("Stripe Connect: STRIPE_SECRET_KEY not configured");return new(await Promise.resolve().then(() => (gc(),bc))).default(e,{apiVersion:"2026-06-24.dahlia"})}function yc(){return{async generateTwoFactorForModel(e){let{generateTwoFactorSecret:t}=await import("@stacksjs/auth"),n=t();await e.update({two_factor_secret:n})},async verifyTwoFactorCode(e,t){let n=e.get("two_factor_secret");if(typeof n!=="string")return!1;let{verifyTwoFactorCode:i,RateLimiter:r}=await import("@stacksjs/auth"),o=String(e.id??e.get?.("id")??e.get?.("email")??n),s=`2fa:${o}`;if(await r.isRateLimited(s)){let{HttpError:c}=await import("@stacksjs/error-handling");throw new c(429,"Too many verification attempts. Please try again later.")}if(!await i(t,n))return await r.recordFailedAttempt(s),!1;try{let{cache:c}=await import("@stacksjs/cache"),l=`2fa:used:${o}:${t}`;if(await c.has(l))return await r.recordFailedAttempt(s),!1;await c.set(l,"1",90)}catch{}return await r.resetAttempts(s),!0}}}import{sqlDateTime as Ru}from"@stacksjs/database";import{log as le}from"@stacksjs/logging";var Pi="deleted_at";function Rc(e,t="id"){return{async softDelete(n){let i=Ru(),r=e.where(t,n);if(typeof r?.update==="function")return await r.update({[Pi]:i}),!0;return!1},async restore(n){let i=e.where(t,n);if(typeof i?.update==="function")return await i.update({[Pi]:null}),!0;return!1},async forceDelete(n){let i=e.where(t,n);if(typeof i?.delete==="function")return await i.delete(),!0;return!1},withTrashed(){return typeof e.query==="function"?e.query():e},onlyTrashed(){let n=typeof e.query==="function"?e.query():e;if(typeof n?.whereNotNull==="function")return n.whereNotNull(Pi);return n?.where?.(Pi,"!=",null)??n}}}function Tc(e){if(e===!0||e==null)return{};if(typeof e==="object"&&!Array.isArray(e)){let t=e;if(Array.isArray(t.cascade)){let n=t.cascade.filter((i)=>typeof i==="string");return n.length?{cascade:n}:{}}return{}}return{}}function Tu(e,t){let n=e.hasMany??[],i=e.hasOne??[],r=n.some((u)=>Ia(u,t,!0)),o=i.some((u)=>Ia(u,t,!1));if(!r&&!o)return le.warn(`[orm] soft-delete cascade: '${t}' is not a declared hasMany/hasOne relation - skipping`),null;let a=(r?n:i).find((u)=>Ia(u,t,r))??null;if(!a)return null;let l=globalThis[a];if(!l)return le.warn(`[orm] soft-delete cascade: model '${a}' is not yet on globalThis - skipping cascade for '${t}'`),null;return{className:a,model:l}}function Ia(e,t,n){let i=e.toLowerCase();if(t===i)return!0;if(n&&t===`${i}s`)return!0;if(n&&i.endsWith("y")&&t===`${i.slice(0,-1)}ies`)return!0;return!1}async function wu(e,t,n,i,r){try{let o=n.where;if(typeof o!=="function"){le.warn(`[orm] cascade ${r}: child model has no .where()`);return}if(r==="softDelete"){let s=n.softDelete;if(typeof s==="function"){let c=o.call(n,i,t),l=typeof c?.get==="function"?await c.get():Array.isArray(c)?c:[],u=n.primaryKey||"id";for(let m of l){let p=m?.[u];if(p!=null)await s.call(n,p)}return}let a=o.call(n,i,t);if(typeof a?.delete==="function"){le.debug(`[orm] cascade soft-delete: child has no softDeletes trait, hard-deleting from ${String(n.table??"?")}`),await a.delete();return}}else{let s=n.restore;if(typeof s!=="function"){le.debug("[orm] cascade restore: child has no restore() - nothing to do");return}let a=n.withTrashed,l=(typeof a==="function"?a.call(n):n).where?.(i,t),u=typeof l?.get==="function"?await l.get():[],m=n.primaryKey||"id";for(let p of u){let _=p?.[m];if(_!=null)await s.call(n,_)}}}catch(o){if(le.warn(`[orm] soft-delete cascade ${r} on ${e}#${String(t)} failed`,{error:o}),process.env.STACKS_ORM_CASCADE_SWALLOW!=="true")throw o}}async function ni(e,t,n,i){let r=t.cascade;if(!r||r.length===0)return;let o=`${e.name.toLowerCase()}_id`;for(let s of r){let a=Tu(e,s);if(!a)continue;await wu(a.className,n,a.model,o,i)}}var qc=new Ec;function te(){return qc.getStore()?.suppressed===!0}function ee(e){return Promise.resolve(qc.run({suppressed:!0},e))}var Oc=new Ec;function xu(){return Oc.getStore()?.suppressed===!0}function Cu(e){return Promise.resolve(Oc.run({suppressed:!0},e))}var Fa=Symbol.for("stacks.orm.modelDefinition");class Ac extends Error{status=422;errors;constructor(e,t){let n=Object.keys(t).join(", ");super(`${e} validation failed: ${n}`);this.name="ModelValidationError",this.errors=t}}var wc=new Set;function ju(e,t){let n=typeof e==="string"?e.slice(0,80):String(e),i=`${typeof e}:${n}`;if(wc.has(i))return;wc.add(i);let r=t instanceof Error?t.message:String(t);console.error(`[orm] JSON cast failed to parse value (returning null): ${r} - value preview: ${JSON.stringify(n)}`)}var Pu={string:{get:(e)=>e!=null?String(e):null,set:(e)=>e!=null?String(e):null},number:{get:(e)=>e!=null?Number(e):null,set:(e)=>e!=null?Number(e):null},integer:{get:(e)=>e!=null?Math.trunc(Number(e)):null,set:(e)=>e!=null?Math.trunc(Number(e)):null},float:{get:(e)=>e!=null?Number.parseFloat(String(e)):null,set:(e)=>e!=null?Number.parseFloat(String(e)):null},boolean:{get:(e)=>e===1||e==="1"||e===!0||e==="true",set:(e)=>e===!0||e===1||e==="1"||e==="true"?1:0},json:{get:(e)=>{if(e==null)return null;if(typeof e==="string")try{return JSON.parse(e)}catch(t){return ju(e,t),null}return e},set:(e)=>{if(e==null)return null;return typeof e==="string"?e:JSON.stringify(e)}},datetime:{get:(e)=>e?new Date(e):null,set:(e)=>e instanceof Date?e.toISOString():e},date:{get:(e)=>e?new Date(e):null,set:(e)=>e instanceof Date?e.toISOString().split("T")[0]:e},array:{get:(e)=>{if(e==null)return[];if(Array.isArray(e))return e;if(typeof e==="string")try{return JSON.parse(e)}catch{return[]}return[]},set:(e)=>{if(e==null)return null;return Array.isArray(e)?JSON.stringify(e):e}}};function Ic(e){return typeof e==="string"?Pu[e]:e}function vc(e,t,n){if(!e||typeof e!=="object")return e;let i={...e};for(let[r,o]of Object.entries(t))if(r in i){let s=Ic(o);i[r]=s[n](i[r])}return i}var Ei=new Set(["_attributes","_original","_definition","_hasSaved","_relations"]),Sc=Symbol.for("stacks.modelInstanceProxy"),Eu={tags:{bag:"_taggable",mode:"id"},tagCount:{bag:"_taggable",mode:"id"},addTag:{bag:"_taggable",mode:"id"},activeTags:{bag:"_taggable",mode:"id"},inactiveTags:{bag:"_taggable",mode:"id"},removeTag:{bag:"_taggable",mode:"id"},categories:{bag:"_categorizable",mode:"id"},categoryCount:{bag:"_categorizable",mode:"id"},addCategory:{bag:"_categorizable",mode:"id"},activeCategories:{bag:"_categorizable",mode:"id"},inactiveCategories:{bag:"_categorizable",mode:"id"},removeCategory:{bag:"_categorizable",mode:"id"},comments:{bag:"_commentable",mode:"id"},commentCount:{bag:"_commentable",mode:"id"},addComment:{bag:"_commentable",mode:"id"},approvedComments:{bag:"_commentable",mode:"id"},pendingComments:{bag:"_commentable",mode:"id"},rejectedComments:{bag:"_commentable",mode:"id"},likes:{bag:"_likeable",mode:"id"},likeCount:{bag:"_likeable",mode:"id"},like:{bag:"_likeable",mode:"id"},unlike:{bag:"_likeable",mode:"id"},isLiked:{bag:"_likeable",mode:"id"},createStripeUser:{bag:"_billable",mode:"model"},updateStripeUser:{bag:"_billable",mode:"model"},deleteStripeUser:{bag:"_billable",mode:"model"},createOrGetStripeUser:{bag:"_billable",mode:"model"},retrieveStripeUser:{bag:"_billable",mode:"model"},defaultPaymentMethod:{bag:"_billable",mode:"model"},setDefaultPaymentMethod:{bag:"_billable",mode:"model"},addPaymentMethod:{bag:"_billable",mode:"model"},paymentMethods:{bag:"_billable",mode:"model"},newSubscription:{bag:"_billable",mode:"model"},updateSubscription:{bag:"_billable",mode:"model"},cancelSubscription:{bag:"_billable",mode:"model"},activeSubscription:{bag:"_billable",mode:"model"},checkout:{bag:"_billable",mode:"model"},createSetupIntent:{bag:"_billable",mode:"model"},subscriptionHistory:{bag:"_billable",mode:"model"},transactionHistory:{bag:"_billable",mode:"model"},connectAccount:{bag:"_billable",mode:"model"},createConnectAccount:{bag:"_billable",mode:"model"},connectOnboardLink:{bag:"_billable",mode:"model"},syncConnectStatus:{bag:"_billable",mode:"model"},chargeWithSplit:{bag:"_billable",mode:"model"},generateTwoFactorForModel:{bag:"_twoFactor",mode:"model"},verifyTwoFactorCode:{bag:"_twoFactor",mode:"model"}};function qu(e,t){if(!e||!t)return null;let n=t.split("."),i=e;for(let r of n){if(i==null||typeof i!=="object")return null;let o=i;if("_attributes"in o&&o._attributes&&typeof o._attributes==="object"){let s=o._attributes;if(r in s){i=s[r];continue}}if(r in o){i=o[r];continue}return null}return i??null}function D(e,t){if(!e||typeof e!=="object")return e;if(e[Sc])return e;let n=e._attributes;if(!n||typeof n!=="object")return e;if(t&&Object.keys(t).length>0){for(let[i,r]of Object.entries(t))if(Object.prototype.hasOwnProperty.call(n,i))n[i]=Ic(r).get(n[i])}return new Proxy(e,{get(i,r,o){if(r===Sc)return!0;if(r==="saveAsync")return async function(){let a=i._definition,c=a?.set;if(c&&typeof i.isDirty==="function"){for(let[u,m]of Object.entries(c)){if(typeof m!=="function")continue;if(!i.isDirty(u))continue;let p=m(i._attributes),_=p&&typeof p.then==="function"?await p:p;i._attributes[u]=_}let l=a.set;a.set={};try{return i.save()}finally{a.set=l}}return i.save()};if(r==="save")return function(){let a=i._definition,c=a?.set;if(c&&Object.keys(c).length>0&&typeof i.isDirty==="function"){for(let[u,m]of Object.entries(c)){if(typeof m!=="function")continue;if(!i.isDirty(u))continue;let p=m(i._attributes);if(p&&typeof p.then==="function")throw Error(`Setter for "${u}" returned a Promise - use \`saveAsync()\` instead of \`save()\` when a model has async setters.`);i._attributes[u]=p}let l=a.set;a.set={};try{return i.save()}finally{a.set=l}}return i.save()};if(r==="updateAsync")return async function(a){if(a&&typeof a==="object"&&!Array.isArray(a))for(let[c,l]of Object.entries(a))o[c]=l;return o.saveAsync()};if(r==="saveQuietly")return function(){return ee(()=>i.save())};if(r==="saveAsyncQuietly")return function(){return ee(()=>o.saveAsync())};if(r==="updateQuietly")return function(a){return ee(()=>i.update(a))};if(r==="updateAsyncQuietly")return function(a){return ee(()=>o.updateAsync(a))};if(r==="deleteQuietly")return function(){return ee(()=>i.delete())};if(r==="toSearchableObject")return function(){let l=i._definition?.traits?.useSearch;if(!l)return null;let u=i._attributes;if(!u)return null;if(l===!0){let g={...u};if(u.id!=null)g.id=String(u.id);return g}let m={},p=l.displayable?.length?l.displayable:[...l.searchable??[],...l.filterable??[],...l.sortable??[],"id"],_=l.denormalize??{},k=i._relations;for(let g of p){let y=H(g),R=u[y]??u[g];if(R!==void 0){m[y]=R;continue}let v=_[g]??_[y];if(v){m[y]=qu(k,v);continue}m[y]=void 0}if(u.id!=null)m.id=String(u.id);return m};if(typeof r==="string"&&!Ei.has(r)){let a=i._attributes;if(a&&Object.prototype.hasOwnProperty.call(a,r))return a[r];let c=i._relations;if(c&&Object.prototype.hasOwnProperty.call(c,r)){let u=c[r];if(Array.isArray(u))return u.map((m)=>D(m,t));return D(u,t)}let l=Eu[r];if(l){let p=i._definition?.__traitMethods?.[l.bag]?.[r];if(typeof p==="function")return l.mode==="model"?(..._)=>p(o,..._):(..._)=>p(i.id,..._)}if(a){let u=H(r);if(u!==r&&Object.prototype.hasOwnProperty.call(a,u))return a[u]}}let s=Reflect.get(i,r,i);return typeof s==="function"?s.bind(i):s},set(i,r,o,s){if(typeof r==="string"&&!Ei.has(r)){let{_attributes:a,set:c}=i;if(a&&Object.prototype.hasOwnProperty.call(a,r)){if(typeof c==="function")c.call(i,r,o);else a[r]=o;return!0}if(a){let l=H(r);if(l!==r&&Object.prototype.hasOwnProperty.call(a,l)){if(typeof c==="function")c.call(i,l,o);else a[l]=o;return!0}}if(a&&!(r in i)){if(typeof c==="function")c.call(i,r,o);else a[r]=o;return!0}}return Reflect.set(i,r,o,s)},has(i,r){if(typeof r==="string"&&!Ei.has(r)){let o=i._attributes;if(o&&Object.prototype.hasOwnProperty.call(o,r))return!0;let s=i._relations;if(s&&Object.prototype.hasOwnProperty.call(s,r))return!0;if(o){let a=H(r);if(a!==r&&Object.prototype.hasOwnProperty.call(o,a))return!0}}return Reflect.has(i,r)},deleteProperty(i,r){if(typeof r==="string"&&!Ei.has(r)){let o=i._attributes;if(o&&Object.prototype.hasOwnProperty.call(o,r))return delete o[r],!0}return Reflect.deleteProperty(i,r)},ownKeys(i){let r=i._attributes;return r?Object.keys(r):[]},getOwnPropertyDescriptor(i,r){if(typeof r==="string"){let o=i._attributes;if(o&&Object.prototype.hasOwnProperty.call(o,r))return{configurable:!0,enumerable:!0,value:o[r],writable:!0}}return Object.getOwnPropertyDescriptor(i,r)}})}var Ou=new Set(["get","first","last","firstOrFail","find","findOrFail","all","paginate","simplePaginate","cursorPaginate"]),Au={paginate:Yi,simplePaginate:Zi,cursorPaginate:er},xc=Symbol.for("stacks.queryBuilderProxy");function $c(e,t){if(!e||typeof e!=="object")return e;if(e[xc])return e;return new Proxy(e,{get(n,i,r){if(i===xc)return!0;let o=Reflect.get(n,i,r);if(typeof o!=="function")return o;return function(...s){let a=s,c=String(i);if(c==="paginate"||c==="simplePaginate"){let{perPage:m,page:p}=nr(s[0],s[1]);a=[m,p]}else if(c==="cursorPaginate"){let{perPage:m,cursor:p}=ir(s[0],s[1]);a=[m,p,s[2],s[3]]}let l=o.apply(n,a),u=(m)=>{if(Ou.has(c)){if(Array.isArray(m))return m.map((_)=>D(_,t));let p=Au[c];if(p&&m&&Array.isArray(m.data)){let _=m.data.map((g)=>D(g,t)),k=p({...m,data:_});return rr(k)}if(m&&Array.isArray(m.data))return{...m,data:m.data.map((_)=>D(_,t))};return D(m,t)}if(m&&typeof m==="object"&&typeof m.get==="function")return $c(m,t);return m};if(l&&typeof l.then==="function")return l.then(u);return u(l)}}})}function Iu(e,t){let n=["find","first","last","all","firstOrFail","findOrFail","findMany"];for(let o of n){let s=e[o];if(typeof s!=="function")continue;e[o]=function(...a){let c=s.apply(this,a),l=(u)=>Array.isArray(u)?u.map((m)=>D(m,t)):D(u,t);if(c&&typeof c.then==="function")return c.then(l);return l(c)}}let i=["create","firstOrCreate","updateOrCreate","make"];for(let o of i){let s=e[o];if(typeof s!=="function")continue;e[o]=function(...a){let c=s.apply(this,a),l=(u)=>Array.isArray(u)?u.map((m)=>D(m,t)):D(u,t);if(c&&typeof c.then==="function")return c.then(l);return l(c)}}let r=["query","where","orWhere","whereIn","whereNotIn","whereNull","whereNotNull","whereLike","whereBetween","whereNotBetween","orderBy","orderByDesc","select","with","limit","take","skip","latest","oldest"];for(let o of r){let s=e[o];if(typeof s!=="function")continue;e[o]=function(...a){let c=s.apply(this,a);return $c(c,t)}}}class Uc extends Error{model;id;constructor(e,t){super(t!=null?`[ORM] ${e} not found for id=${String(t)}`:`[ORM] No matching ${e} row`);this.name="ModelNotFoundError",this.model=e,this.id=t}}class Ua extends Error{model;attribute;reason;constructor(e,t,n){let i=n==="guarded"?`'${t}' is marked guarded`:`'${t}' is not in the fillable allowlist`;super(`[ORM] Mass assignment to ${e} forbidden: ${i}. Use ${e}.forceCreate(...) / .forceUpdate(...) to bypass.`);this.name="MassAssignmentException",this.model=e,this.attribute=t,this.reason=n}}var $u=new Set(["id","created_at","updated_at","deleted_at","uuid"]);function ii(e,t,n={}){if(n.force)return t;if(!t||typeof t!=="object"||Array.isArray(t))return t;let i=e.attributes;if(!i)return t;let r=new Set,o=new Set,s=new Set;for(let[c,l]of Object.entries(i)){let u=H(c);if(r.add(u),l?.fillable===!0)o.add(u);if(l?.guarded===!0)s.add(u)}let a=o.size>0?o:r;for(let c of Object.keys(t)){let l=H(c);if($u.has(l))continue;if(s.has(l))throw new Ua(e.name,c,"guarded");if(l.endsWith("_id"))continue;if(!a.has(l))throw new Ua(e.name,c,"not-fillable")}return t}async function Ma(e,t){let n=e.set;if(!n||typeof n!=="object")return t;let i={...t};for(let[r,o]of Object.entries(n)){if(typeof o!=="function"||!(r in i))continue;try{i[r]=await o(i)}catch(s){A.error(`[orm] ${e.name}.set.${r} threw - skipping setter`,s)}}return i}function Uu(e,t){let n=t.primaryKey||"id",i=e.create;function r(l){let u=e.where;if(typeof u!=="function")throw Error(`[ORM] ${t.name}.${l} needs a working where(): the underlying query builder did not expose one`);return u}function o(l){let u=e.find;if(typeof u!=="function")throw Error(`[ORM] ${t.name}.${l} needs a working find(): the underlying query builder did not expose one`);return u}function s(l){let u=e.create;if(typeof u!=="function")throw Error(`[ORM] ${t.name}.${l} cannot create: the underlying query builder did not expose create()`);return u}if(typeof e.update!=="function")e.update=async function(l,u){if(l==null)throw Error(`[ORM] ${t.name}.update requires an id as the first argument`);if(!u||typeof u!=="object"||Array.isArray(u))throw Error(`[ORM] ${t.name}.update requires a data object as the second argument`);if(Object.keys(u).length===0){A.debug(`[orm] ${t.name}.update called with empty data - short-circuiting and returning current row`);let _=e.find;return typeof _==="function"?await _.call(e,l):null}ii(t,u);let m=await Ma(t,u);await r("update").call(e,n,l).update(m);let p=e.find;return typeof p==="function"?await p.call(e,l):null};if(typeof e.forceUpdate!=="function")e.forceUpdate=async function(l,u){if(l==null)throw Error(`[ORM] ${t.name}.forceUpdate requires an id as the first argument`);if(!u||typeof u!=="object"||Array.isArray(u))throw Error(`[ORM] ${t.name}.forceUpdate requires a data object as the second argument`);let m=await Ma(t,u);await r("forceUpdate").call(e,n,l).update(m);let p=e.find;return typeof p==="function"?await p.call(e,l):null};if(typeof e.forceCreate!=="function")e.forceCreate=async function(l){if(!l||typeof l!=="object"||Array.isArray(l))throw Error(`[ORM] ${t.name}.forceCreate requires a data object`);let u=e.make;if(typeof u==="function"){let m=await u.call(e);if(m&&typeof m.forceFill==="function"&&typeof m.save==="function")return m.forceFill(l),await m.save()??m}if(typeof i!=="function")throw Error(`[ORM] ${t.name}.forceCreate cannot create: the underlying query builder did not expose create()`);return await i.call(e,l)};if(typeof e.delete!=="function")e.delete=async function(l){if(l==null)throw Error(`[ORM] ${t.name}.delete requires an id as the first argument`);if(!await o("delete").call(e,l))return!1;return await r("delete").call(e,n,l).delete(),!0};if(typeof e.findOrFail!=="function")e.findOrFail=async function(l){let u=await o("findOrFail").call(e,l);if(u==null)throw new Uc(t.name,l);return u};if(typeof e.exists!=="function")e.exists=async function(l){if(l==null)return!1;let u=r("exists").call(e,n,l);if(typeof u.count==="function"){let p=await u.count();return Number(p)>0}let m=e.find;return typeof m==="function"?await m.call(e,l)!=null:!1};if(typeof e.firstOrCreate!=="function")e.firstOrCreate=async function(l,u={}){if(!l||typeof l!=="object"||Array.isArray(l))throw Error(`[ORM] ${t.name}.firstOrCreate requires a where-attrs object`);let m=r("firstOrCreate").call(e,l),p=typeof m.first==="function"?await m.first():await m;if(p)return p;let _={...l,...u};return ii(t,_),await s("firstOrCreate").call(e,_)};if(typeof e.updateOrCreate!=="function")e.updateOrCreate=async function(l,u){if(!l||typeof l!=="object"||Array.isArray(l))throw Error(`[ORM] ${t.name}.updateOrCreate requires a where-attrs object`);if(!u||typeof u!=="object"||Array.isArray(u))throw Error(`[ORM] ${t.name}.updateOrCreate requires a values object`);let m=r("updateOrCreate").call(e,l),p=typeof m.first==="function"?await m.first():await m;if(p){ii(t,u);let k=p[n];await r("updateOrCreate").call(e,n,k).update(u);let g=e.find;return typeof g==="function"?await g.call(e,k):{...p,...u}}let _={...l,...u};return ii(t,_),await s("updateOrCreate").call(e,_)};if(typeof e.count!=="function")e.count=async function(){let l=e;if(typeof l.query==="function"){let p=l.query();if(typeof p?.count==="function"){let _=await p.count();return Number(_)||0}}let{all:u,get:m}=e;if(typeof u==="function")return(await u.call(e)||[]).length;if(typeof m==="function")return(await m.call(e)||[]).length;return 0};if(typeof e.pluck!=="function")e.pluck=async function(l){if(!l||typeof l!=="string")throw Error(`[ORM] ${t.name}.pluck requires a column name`);let u=e.all;return((typeof u==="function"?await u.call(e):[])||[]).map((p)=>p?.[l])};if(typeof e.whereIn!=="function")e.whereIn=async function(l,u){if(!l||typeof l!=="string")throw Error(`[ORM] ${t.name}.whereIn requires a column name`);if(!Array.isArray(u))throw Error(`[ORM] ${t.name}.whereIn requires an array of values`);if(u.length===0)return[];let m=e.where;if(typeof m!=="function")return[];let p=m.call(e,l,"in",u);if(p&&typeof p.get==="function")return await p.get();return await p};let a=[["latest","desc"],["oldest","asc"]];for(let[l,u]of a)if(typeof e[l]!=="function")e[l]=async function(m="created_at"){let p=e,_=typeof p.query==="function"?p.query():p;if(typeof _?.orderBy==="function"){let R=_.orderBy(m,u);if(typeof R.first==="function")return await R.first();if(typeof R.get==="function")return(await R.get())?.[0]??null}let k=e.all;if(typeof k!=="function")return null;return[...await k.call(e)||[]].sort((R,v)=>{let x=R?.[m],P=v?.[m];if(x===P)return 0;return(x>P?1:-1)*(u==="desc"?-1:1)})[0]??null};let c=Fc(t.traits?.useSearch,t);if(c){let l=c.index??t.table??H(`${t.name}s`);if(typeof e.search!=="function")e.search=function(u,m){return Nu(e,l,u,m,c.searchable)};if(typeof e.makeAllSearchable!=="function")e.makeAllSearchable=async function(u=500){let m=e.all;if(typeof m!=="function")throw Error(`[ORM] ${t.name}.makeAllSearchable cannot run: the underlying query builder did not expose all()`);let{useSearchEngine:p}=await import("@stacksjs/search-engine"),_=p(),k=0,g=e.query;if(typeof g==="function")try{let v=g.call(e);if(v&&typeof v.chunk==="function")return await v.chunk(u,async(x)=>{let P=await Da(x,c);if(P.length>0)await _.addDocuments(l,P);k+=P.length}),k}catch{}let y=await m.call(e)||[],R=await Da(y,c);if(R.length>0)await _.addDocuments(l,R);return R.length};if(typeof e.removeAllFromSearch!=="function")e.removeAllFromSearch=async function(){let{useSearchEngine:u}=await import("@stacksjs/search-engine"),m=u();if(typeof m.deleteAllDocuments==="function"){await m.deleteAllDocuments(l);return}let p=e.all,_=typeof p==="function"?await p.call(e)||[]:[],k=u();for(let g of _){let y=g?.id??g?._attributes?.id;if(y!=null)await k.deleteDocument(l,Number(y))}}}}async function Da(e,t){if(e.length===0)return[];if(typeof t.shapeMany==="function"){let i=await t.shapeMany(e);if(!Array.isArray(i)||i.length!==e.length)throw TypeError(`[orm/search] shapeMany returned ${Array.isArray(i)?i.length:typeof i} documents for ${e.length} rows. It must return one document per row, in order, or documents are indexed under the wrong ids.`);return i.filter(Boolean)}return(await Promise.all(e.map((i)=>Fu(i,t)))).filter(Boolean)}function Mu(e){let t=new Set,n=e.attributes??{};for(let[i,r]of Object.entries(n))if(r?.hidden)t.add(i);return t}function Du(e,t){if(!e||t.size===0)return e;let n={};for(let[i,r]of Object.entries(e))if(!t.has(i))n[i]=r;return n}async function Fu(e,t){if(typeof t.shape==="function")try{return await t.shape(e)}catch{return}let n=e?.toSearchableObject?.();if(n!==void 0)return n;return Du(e?._attributes??(typeof e?.toJSON==="function"?e.toJSON():null),t.hidden??new Set)}function Nu(e,t,n,i,r){let o=r&&r.length>0?{query_by:[...r].join(",")}:{},s={q:n,...o,...i??{}},a={with(c){return s={...s,...c},a},where(c){return s={...s,filter:c},a},async get(){let{useSearchEngine:c}=await import("@stacksjs/search-engine");return(await c().search(t,s))?.hits??[]},async paginate(c,l=1){let{useSearchEngine:u}=await import("@stacksjs/search-engine"),p=await u().search(t,{...s,limit:c,offset:(l-1)*c});return{hits:p.hits??[],total:Number(p.estimatedTotalHits??p.nbHits??p.total??0),page:l,perPage:c}},async raw(){let{useSearchEngine:c}=await import("@stacksjs/search-engine");return await c().search(t,s)}};return a}function Mc(e){let t=H(e);return t===e?[e]:[e,t]}async function $a(e,t){if(!e||typeof e!=="object")return;let n=e._attributes??e;for(let i of t)for(let r of Mc(i)){if(!(r in n))continue;let o=n[r];if(!ue(o))continue;n[r]=await $i(o)}}function Gu(e,t){if(t.length===0)return;let n=async(a)=>{if(Array.isArray(a)){for(let c of a)await $a(c,t);return a}if(a&&typeof a==="object"&&Array.isArray(a.data)){for(let c of a.data)await $a(c,t);return a}if(a)await $a(a,t);return a},i=["find","first","last","all","firstOrFail","findOrFail","findMany"];for(let a of i){let c=e[a];if(typeof c!=="function")continue;e[a]=async function(...l){let u=await c.apply(this,l);return await n(u)}}let r=["create","firstOrCreate","updateOrCreate","make"];for(let a of r){let c=e[a];if(typeof c!=="function")continue;e[a]=async function(...l){let u=await c.apply(this,l);return await n(u)}}for(let a of["update","forceUpdate"]){let c=e[a];if(typeof c!=="function")continue;e[a]=async function(l,u){let m=await c.call(this,l,u);return await n(m)}}let o=["first","firstOrFail","get","all","find","findOrFail","last","paginate","simplePaginate"],s=(a)=>{if(!a||typeof a!=="object")return a;let c=a;if(c.__stacksEncryptedReads)return a;for(let l of o){let u=c[l];if(typeof u!=="function")continue;c[l]=async function(...m){return await n(await u.apply(this,m))}}for(let l of["where","whereIn","whereNull","whereNotNull","orWhere","orderBy","orderByDesc","limit","offset","with"]){let u=c[l];if(typeof u!=="function")continue;c[l]=function(...m){return s(u.apply(this,m))}}return Object.defineProperty(c,"__stacksEncryptedReads",{value:!0,enumerable:!1}),a};for(let a of["where","whereIn","whereNull","whereNotNull","orderBy","orderByDesc","limit","query"]){let c=e[a];if(typeof c!=="function")continue;e[a]=function(...l){return s(c.apply(this,l))}}}function Bu(e,t){if(t.length===0)return;let n=async(r)=>{if(!r||typeof r!=="object"||Array.isArray(r))return r;let o={...r};for(let s of t)for(let a of Mc(s))if(a in o)o[a]=await Ii(o[a]);return o},i=["create","firstOrCreate","updateOrCreate","forceCreate"];for(let r of i){let o=e[r];if(typeof o!=="function")continue;e[r]=async function(...s){if(s[0]=await n(s[0]),s[1])s[1]=await n(s[1]);return await o.apply(this,s)}}for(let r of["update","forceUpdate"]){let o=e[r];if(typeof o!=="function")continue;e[r]=async function(s,a){let c=await n(a);return await o.call(this,s,c)}}}function Lu(e,t){let n=e.create;if(typeof n==="function")e.create=async function(i,...r){ii(t,i);let o=await Ma(t,i);return await n.call(this,o,...r)};for(let i of["firstOrCreate","updateOrCreate"]){let r=e[i];if(typeof r!=="function")continue}}function Ku(e,t){let n=String(t?.name??e.name??"Model"),i=(s,a)=>{if(xu())return;if(!s||typeof s!=="object"||Array.isArray(s))return;let c=Ya(s,t,a);if(!c.valid)throw new Ac(n,c.errors)},r=e.create;if(typeof r==="function")e.create=async function(s,...a){return i(s,"creating"),await r.call(this,s,...a)};let o=e.update;if(typeof o==="function")e.update=async function(s,a,...c){return i(a,"updating"),await o.call(this,s,a,...c)}}function Hu(e,t){let n=["create","firstOrCreate","updateOrCreate"];for(let r of n){let o=e[r];if(typeof o==="function")e[r]=async function(...s){if(A.debug(`[orm] ${r.charAt(0).toUpperCase()+r.slice(1)} ${String(e.name||"unknown")}`,s[0]),s[0]&&typeof s[0]==="object"&&!Array.isArray(s[0]))s[0]=vc(s[0],t,"set");return await o.apply(this,s)}}let i=e.update;if(typeof i==="function")e.update=async function(r,o){let s=o&&typeof o==="object"&&!Array.isArray(o)?vc(o,t,"set"):o;return await i.call(this,r,s)}}function Dc(e){A.debug(`[orm] Defining model: ${e.name} (table: ${e.table})`);let t=Vu(e),n=Wu(e),i=zu(t,n),r=Qu(e);e.__traitMethods=r;let o=i?{...e,hooks:{...e.hooks,...i}}:e,a=vu(o);if(Iu(a,e.casts),Uu(a,o),Lu(a,o),e.casts&&Object.keys(e.casts).length>0)Hu(a,e.casts);let c=Ui(e);if(c.length>0)Bu(a,c),Gu(a,c);let l=e.traits?.useSoftDeletes;if(l)Ju(a,o,l);let u=e.traits?.useAudit;if(u){let p=za(u);Wa(a,e.name,e.primaryKey||"id",p)}Ku(a,o),a.withoutValidation=function(p){return Cu(p)},a.withoutEvents=function(p){return ee(p)};for(let p of["create","update","firstOrCreate","updateOrCreate","forceCreate","forceUpdate","delete","forceDelete","softDelete","restore"]){let _=a[p];if(typeof _!=="function")continue;let k=`${p}Quietly`;if(typeof a[k]==="function")continue;a[k]=function(...g){return ee(()=>_.apply(a,g))}}let m=Object.assign(a,r,{...e,getDefinition:()=>e,_isStacksModel:!0});return Su(e.name,m),Object.defineProperty(m,Fa,{value:e,enumerable:!1,configurable:!0}),m}function Vu(e){let t=e.traits?.observe;if(!t)return;let n=e.name.toLowerCase(),i=(p)=>{let _=p?.attributes;if(!_||typeof _!=="object")return p;let k=e.primaryKey||"id",g={..._};if(g[k]===void 0&&p[k]!==void 0)g[k]=p[k];return g},r=async(p,_)=>{if(te())return;try{let{dispatch:k}=await import("@stacksjs/events");await k(p,_)}catch(k){if(k&&typeof k==="object"&&"code"in k&&k.code==="MODULE_NOT_FOUND")return;if(console.error(`[ORM] Event '${p}' handler error:`,k),process.env.STACKS_ORM_EVENT_ERRORS!=="swallow")throw k}},o=e.traits?.broadcastOn,s=e.traits?.broadcastWith,a=typeof o==="function"&&typeof s==="function",c=async(p,_)=>{if(!a)return;if(te())return;try{let k=o(_),g=Array.isArray(k)?k:[k],y=s(_),v=(await import("@stacksjs/realtime").catch(()=>null))?.broadcast;if(typeof v!=="function")return;for(let x of g){if(typeof x!=="string"||x.length===0)continue;await v(x,p,y)}}catch(k){if(k&&typeof k==="object"&&"code"in k&&k.code==="MODULE_NOT_FOUND")return;if(console.error(`[ORM] Broadcast '${p}' handler error:`,k),process.env.STACKS_ORM_BROADCAST_ERRORS==="throw")throw k}},l=async(p,_)=>{if(te())return!0;try{let{dispatchAsync:k}=await import("@stacksjs/events"),g=await k(p,_);if(Array.isArray(g)&&g.some((y)=>y===!1))return!1}catch(k){if(k&&typeof k==="object"&&"code"in k&&k.code==="MODULE_NOT_FOUND")return!0;if(console.error(`[ORM] Before-event '${p}' handler error:`,k),process.env.STACKS_ORM_EVENT_ERRORS!=="swallow")throw k}return!0},u=t===!0?["create","update","delete"]:Array.isArray(t)?t:[],m={};if(u.includes("create"))m.beforeCreate=async(p)=>{if(A.debug(`[orm] Create ${n}`,p),!await l(`${n}:saving`,p))throw Error(`[ORM] ${n}:saving event cancelled the operation`);if(!await l(`${n}:creating`,p))throw Error(`[ORM] ${n}:creating event cancelled the operation`)},m.afterCreate=async(p)=>{let _=i(p);await r(`${n}:created`,_),await r(`${n}:saved`,_),await c(`${n}:created`,p)};if(u.includes("update"))m.beforeUpdate=async(p)=>{if(A.debug(`[orm] Update ${n}#${p?.id??"unknown"}`,p),!await l(`${n}:saving`,p))throw Error(`[ORM] ${n}:saving event cancelled the operation`);if(!await l(`${n}:updating`,p))throw Error(`[ORM] ${n}:updating event cancelled the operation`)},m.afterUpdate=async(p)=>{let _=i(p);await r(`${n}:updated`,_),await r(`${n}:saved`,_),await c(`${n}:updated`,p)};if(u.includes("delete"))m.beforeDelete=async(p)=>{if(A.debug(`[orm] Delete ${n}#${p?.id??"unknown"}`),!await l(`${n}:deleting`,p))throw Error(`[ORM] ${n}:deleting event cancelled the operation`)},m.afterDelete=async(p)=>{await r(`${n}:deleted`,i(p)),await c(`${n}:deleted`,p)};return m}function zu(...e){let t={},n=new Set;for(let i of e){if(!i)continue;for(let r of Object.keys(i))n.add(r)}for(let i of n){let r=e.map((o)=>o?.[i]).filter((o)=>typeof o==="function");if(!r.length)continue;t[i]=async(...o)=>{for(let s of r)await s(...o)}}return Object.keys(t).length?t:void 0}function Fc(e,t){if(!e)return null;let n=e===!0?{}:typeof e==="object"?{...e}:null;if(!n)return null;if(t)n.hidden=Mu(t);return n}function Wu(e){let t=Fc(e.traits?.useSearch,e);if(!t)return;let n=t,i=n.index??e.table??H(`${e.name}s`);async function r(a){if(typeof n.shapeMany==="function")try{let[u]=await Da([a],n);return u}catch(u){A.warn(`[orm/search] shapeMany() threw for ${e.name}: ${u.message}`);return}if(typeof n.shape==="function")try{return await n.shape(a)}catch(u){A.warn(`[orm/search] shape() threw for ${e.name}: ${u.message}`);return}let l=D(a).toSearchableObject?.();if(l!==void 0)return l;return a?._attributes??(typeof a?.toJSON==="function"?a.toJSON():null)}let o=async(a)=>{if(te())return;let c=await r(a);if(!c)return;if(t.queueable){try{let{Jobs:l}=await import("@stacksjs/queue");await l.dispatch("SyncSearchIndex",{index:i,op:"upsert",doc:c})}catch(l){A.warn(`[orm/search] queue dispatch failed for ${e.name}; falling back to inline: ${l.message}`),await jc(i,c,e.name)}return}await jc(i,c,e.name)};return{afterCreate:o,afterUpdate:o,afterDelete:async(a)=>{if(te())return;let c=a?.id??a?._attributes?.id;if(c==null)return;if(t.queueable){try{let{Jobs:l}=await import("@stacksjs/queue");await l.dispatch("SyncSearchIndex",{index:i,op:"delete",id:Number(c)})}catch(l){A.warn(`[orm/search] queue dispatch failed for ${e.name}#${c}; falling back to inline: ${l.message}`),await Pc(i,Number(c),e.name)}return}await Pc(i,Number(c),e.name)}}}var Cc=new Map;function Nc(e,t){let n=Cc.get(e)??0;if(Cc.set(e,n+1),n===0)A.warn(`[orm/search] ${t}`);else if(n===9)A.warn(`[orm/search] ${e} is still failing; further identical warnings suppressed for this process.`)}async function jc(e,t,n){try{let{useSearchEngine:i}=await import("@stacksjs/search-engine");await i().addDocument(e,t)}catch(i){Nc(`index:${n}`,`Failed to index ${n}: ${i.message}`)}}async function Pc(e,t,n){try{let{useSearchEngine:i}=await import("@stacksjs/search-engine");await i().deleteDocument(e,t)}catch(i){Nc(`remove:${n}`,`Failed to remove ${n}#${t}: ${i.message}`)}}function Qu(e){let t={},n=e.table,i=e.traits;if(!i)return t;if(i.taggable)t._taggable=Li(n);if(i.categorizable)t._categorizable=Ki(n);if(i.commentable)t._commentable=Gi(n);if(i.billable)t._billable=hc(n);if(i.likeable){let o=typeof i.likeable==="object"?i.likeable:void 0;t._likeable=Hi(n,o)}let r=i.useAuth||i.authenticatable;if(typeof r==="object"&&r&&"useTwoFactor"in r&&r.useTwoFactor)t._twoFactor=yc();return t}function Ju(e,t,n){let i=Rc(e,t.primaryKey||"id"),r=Tc(n),o=t,s=t.name.toLowerCase(),a=t.traits?.observe!=null&&t.traits?.observe!==!1,c=async(_)=>{if(!a||te())return!0;try{let{dispatchAsync:k}=await import("@stacksjs/events"),g=await k(`${s}:restoring`,{id:_});if(Array.isArray(g)&&g.some((y)=>y===!1))return!1}catch(k){if(k?.code!=="MODULE_NOT_FOUND")console.error(`[ORM] Before-event '${s}:restoring' handler error:`,k)}return!0},l=async(_)=>{if(!a||te())return;try{let{dispatch:k}=await import("@stacksjs/events");await k(`${s}:restored`,{id:_})}catch(k){if(k?.code!=="MODULE_NOT_FOUND")console.error(`[ORM] Event '${s}:restored' handler error:`,k)}},u=process.env.STACKS_ORM_CASCADE_SWALLOW!=="true",m=async(_)=>{if(!r.cascade?.length||!u){let g=await i.softDelete(_);if(g&&r.cascade?.length)await ni(o,r,_,"softDelete");return g}let{db:k}=await import("@stacksjs/database");return await k.transaction(async()=>{let g=await i.softDelete(_);if(g)await ni(o,r,_,"softDelete");return g})},p=async(_)=>{if(!await c(_))return!1;if(!r.cascade?.length||!u){let R=await i.restore(_);if(R){if(r.cascade?.length)await ni(o,r,_,"restore");await l(_)}return R}let{db:g}=await import("@stacksjs/database"),y=await g.transaction(async()=>{let R=await i.restore(_);if(R)await ni(o,r,_,"restore");return R});if(y)await l(_);return y};e.softDelete=m,e.restore=p,e.forceDelete=i.forceDelete,e.withTrashed=i.withTrashed,e.onlyTrashed=i.onlyTrashed,e.delete=m}function Xu(e){if(e==null)return e;if(Array.isArray(e))return e.map(Xu);if(typeof e!=="object")return e;if(typeof e.toJSON==="function")return e.toJSON();if(e._attributes&&typeof e._attributes==="object")return e._attributes;return e}var Yu=["belongsTo","hasOne","hasMany","belongsToMany","morphMany","morphOne"],Zu=["traits","dashboard"];function em(e){let t=e?.[Fa];if(t&&typeof t==="object")return t;if(e&&typeof e==="object"&&"name"in e&&"attributes"in e)return e;throw TypeError("extendModel() expects a model created by defineModel(), or a model definition. Import the framework model itself rather than its table name.")}function tm(e,t){let n=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];if(!n.length&&!i.length)return;return[...new Set([...n,...i])]}function nm(e){if(!e)return 0;return Object.values(e).reduce((t,n)=>{let i=Number(n?.order);return Number.isFinite(i)&&i>t?i:t},0)}function im(e,t){let n={...e,...t},i=e.attributes??{},r=t.attributes??{};if(t.attributes){let o=nm(i),s=Object.fromEntries(Object.entries(r).map(([a,c])=>{let l=!(a in i),u=Number.isFinite(Number(c?.order));if(l&&!u)return[a,{...c,order:++o}];return[a,c]}));n.attributes={...i,...s}}for(let o of Yu){let s=tm(e[o],t[o]);if(s)n[o]=s}for(let o of Zu){let s=e[o],a=t[o];if(s&&a&&typeof s==="object"&&typeof a==="object")n[o]={...s,...a}}return n}function yj(e,t){return Dc(im(em(e),t))}import{log as rm}from"@stacksjs/logging";import{path as V}from"@stacksjs/path";import{fs as ri}from"@stacksjs/storage";function Q(e){return e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase()}function om(e){let t=e.default;if(typeof t==="boolean")return"boolean";if(typeof t==="number")return"number";if(typeof t==="string")return"string";return"unknown"}function sm(e){let t=e.validation;if(!t||typeof t!=="object")return null;let n=t.rule;return n&&typeof n==="object"?n:null}function am(e){if(!e||String(e.name??"")!=="enum")return null;let n=(Array.isArray(e.allowedValues)?e.allowedValues:[]).filter((i)=>typeof i==="string"||typeof i==="number").map((i)=>typeof i==="number"?String(i):JSON.stringify(i));return n.length>0?n.join(" | "):null}function lm(e){let t=sm(e),n=am(t);if(n!==null)return e.nullable===!0?`${n} | null`:n;let i=typeof e.type==="string"?e.type.toLowerCase():String(t?.name??"").toLowerCase(),r=(()=>{switch(i){case"string":case"text":case"longtext":case"mediumtext":case"tinytext":case"char":case"varchar":case"enum":case"uuid":case"date":case"datetime":case"timestamp":case"timestamptz":case"password":case"time":case"year":return"string";case"number":case"integer":case"int":case"tinyint":case"smallint":case"mediumint":case"float":case"double":case"decimal":case"numeric":return"number";case"bigint":return"number | bigint";case"boolean":case"bool":return"boolean";case"json":case"jsonb":return"unknown";case"binary":case"blob":case"bytea":return"Uint8Array";case"unix":return"number";case"array":return"unknown[]";case"object":return"Record<string, unknown>";default:return om(e)}})();return e.nullable===!0?`${r} | null`:r}function cm(e){let t={},n=e.belongsTo;if(!n)return t;let i=Array.isArray(n)?n:Object.values(n);for(let r of i){if(typeof r==="string"){t[`${Q(r)}_id`]="number";continue}if(r&&typeof r==="object"){let o=r;if(typeof o.foreignKey==="string"){t[o.foreignKey]="number";continue}if(typeof o.model==="string")t[`${Q(o.model)}_id`]="number"}}return t}function dm(e,t){let[n,i]=[Q(e),Q(t)].sort();return`${n}_${i}`}function um(e){let t=e.default,n=typeof t==="string"?"string":typeof t==="number"?"number":typeof t==="boolean"?"boolean":t instanceof Date?"string":"unknown";return e.nullable?`${n} | null`:n}function mm(e,t){let n=t.belongsToMany;if(!n)return[];let i=[],r=Array.isArray(n)?n:Object.values(n);for(let o of r){let s,a,c,l,u={},m=!0;if(typeof o==="string")s=o;else if(o&&typeof o==="object"&&"model"in o){let y=o;if(s=y.model,"pivotTable"in y||"firstForeignKey"in y||"secondForeignKey"in y)a=y.pivotTable,c=y.firstForeignKey,l=y.secondForeignKey;else{let R=o;a=R.table,c=R.foreignKey,l=R.relatedKey,u=R.pivot?.columns??{},m=Boolean(R.pivot?.timestamps)}}else continue;let p=a??dm(e,s),_=c??`${Q(e)}_id`,k=l??`${Q(s)}_id`,g={id:"number",[_]:"number",[k]:"number"};for(let[y,R]of Object.entries(u))g[y]=um(R);if(m)g.created_at="string",g.updated_at="string | null";i.push({table:p,columns:g})}return i}var pm={email_verified_at:"string | null",password_changed_at:"string | null",two_factor_secret:"string | null",two_factor_enabled:"boolean | null",two_factor_last_used_step:"number | null",stripe_id:"string | null"};function fm(e){let t={id:"number"},n=e.traits??{};if(n.useUuid)t.uuid="string";if((n.useTimestamps??n.timestampable)!==!1)t.created_at="string",t.updated_at="string | null";if(n.useSoftDeletes??n.softDeletable)t.deleted_at="string | null";if((e.table??"")==="users"||e.name==="User")Object.assign(t,pm);return t}function _m(e){let t={},n=e.attributes??{};for(let[i,r]of Object.entries(n))t[Q(i)]=lm(r);return t}function km(e){return e.replace(/_([a-z0-9])/g,(t,n)=>n.toUpperCase())}function bm(e){let t={...e};for(let[n,i]of Object.entries(e)){let r=km(n);if(r!==n&&!(r in t))t[r]=i}return t}function Gc(e,t,n=2){let i=" ".repeat(n),r=" ".repeat(n+1),o=Object.entries(t).map(([a,c])=>`${r}${a}: ${c}`).join(`
16
+ `),s=/^[A-Z_a-z]\w*$/.test(e)?e:`'${e}'`;return`${i}${s}: {
17
+ ${r}// columns
18
+ ${o}
19
+ ${i}}`}var gm=`/* eslint-disable */
20
20
  // AUTO-GENERATED by \`buddy generate:db-types\` \u2014 do not edit.
21
21
  // Regenerate after adding/removing a model or changing its attributes.
22
22
  // See stacksjs/stacks#1923.
23
23
 
24
24
  declare module '@stacksjs/database' {
25
25
  interface DatabaseSchema {
26
- `,wJ=` }
26
+ `,hm=` }
27
27
  }
28
28
 
29
29
  export {}
30
- `,xJ="/* eslint-disable */\n// AUTO-GENERATED by `buddy generate:db-types --framework` \u2014 do not edit.\n//\n// The shapes of the tables the framework itself ships, so framework code gets\n// real rows from `db.selectFrom(...)` without asserting them. An application's\n// own tables (and its overrides of these) live in `DatabaseSchema`, which takes\n// precedence - see `RowOf` in `./utils`.\n\nexport interface FrameworkSchema {\n",TJ=`}
31
- `;function g7(Z){return Z==="framework"?xJ:FJ}function u7(Z){return Z==="framework"?TJ:wJ}async function c7(Z,$,X=[]){let J=[];if(!X8.existsSync(Z))return J;let Y=X8.readdirSync(Z,{withFileTypes:!0});for(let Q of Y){let G=n.join(Z,Q.name);if(Q.isDirectory()){if($){let W=await c7(G,!0,X);J.push(...W)}continue}if(!Q.name.endsWith(".ts"))continue;if(Q.name.startsWith("_")||Q.name.startsWith("index"))continue;try{let W=await(n.isAbsolute(G)?import(G):import(n.resolve(G))),V=W.default||W;if(V?.name&&(V.attributes||V.table))J.push({filePath:G,model:V})}catch(W){X.push({file:G,error:W.message})}}return J}async function UJ(Z={}){let $=Z.modelsDir??n.userModelsPath(),X=Z.defaultsDir??n.frameworkPath("defaults/app/Models"),J=Z.outFile??n.projectPath("database/types.d.ts"),Y=[],Q=[];for(let[F,w]of[[$,!1],[X,!0]])try{let T=await c7(F,w,Y);Q.push(...T)}catch(T){Y.push({file:F,error:T.message})}let G=new Map;for(let F of Q)G.set(F.model.name??n.basename(F.filePath).replace(/\.ts$/,""),F);for(let F of Q)if(F.filePath.startsWith($))G.set(F.model.name??n.basename(F.filePath).replace(/\.ts$/,""),F);let W=[];for(let[F,{model:w}]of G){let T=w.table??`${r(F)}s`,q=_J({...HJ(w),...zJ(w),...GJ(w)});W.push({table:T,model:F,columns:q})}let V=new Map;for(let[F,{model:w}]of G)for(let T of VJ(F,w)){if(V.has(T.table))continue;V.set(T.table,{table:T.table,model:`(${T.table} pivot)`,columns:T.columns})}W.push(...V.values()),W.sort((F,w)=>F.table.localeCompare(w.table));let B=Z.target??"app",H=B==="framework"?1:2,z=W.map((F)=>b7(F.table,F.columns,H)).join(`
32
- `),O=`${g7(B)}${z}
33
- ${u7(B)}`;if(!Z.dryRun){let F=n.dirname(J);if(!X8.existsSync(F))X8.mkdirSync(F,{recursive:!0});X8.writeFileSync(J,O,"utf-8"),$J.success(`[generate:db-types] wrote ${W.length} table(s) to ${J}`)}return{outFile:J,tables:W,errors:Y,content:O}}function qJ(Z,$="app"){let X=[...Z].sort((J,Y)=>J.table.localeCompare(Y.table)).map((J)=>b7(J.table,J.columns,$==="framework"?1:2)).join(`
34
- `);return`${g7($)}${X}
35
- ${u7($)}`}import{configureOrm as LJ}from"@stacksjs/query-builder";function DJ(){try{let Z=process.env.DB_DATABASE_PATH||"database/stacks.sqlite";if((process.env.DB_CONNECTION||"sqlite")==="sqlite")LJ({database:Z})}catch{}}DJ();async function m7(Z){for(let $=0;;$++){let X=await import(Z);try{return X.default}catch(J){if($<5&&J instanceof ReferenceError&&/before initialization/.test(J.message)){await new Promise((Y)=>setTimeout(Y,0));continue}throw J}}}async function I8(Z,$=[""]){let{path:X}=await import("@stacksjs/path"),J=X.userModelsPath(`${Z}.ts`);try{if(await Bun.file(J).exists())return await m7(J)}catch(Y){console.error(`[orm] Failed to import userland model ${Z} from ${J} - falling back to framework default. Reason:`,Y)}for(let Y of $){let Q=Y?`${Y}/`:"",G=X.frameworkPath(`defaults/app/Models/${Q}${Z}.ts`);try{if(await Bun.file(G).exists())return await m7(G)}catch(W){console.error(`[orm] Failed to import framework default model ${Z} from ${G} - trying next subdir. Reason:`,W)}}return null}var t={},l7=()=>{},ET=new Promise((Z)=>{l7=Z});function U(Z){return new Proxy(function(){},{get($,X){if(X==="then")return;let J=t[Z];if(J==null)return;let Y=J[X];return typeof Y==="function"?Y.bind(J):Y},set($,X,J){let Y=t[Z];if(Y==null)return!1;return Y[X]=J,!0},has($,X){let J=t[Z];return J==null?!1:(X in J)},apply($,X,J){let Y=t[Z];if(Y==null||typeof Y!=="function")return;return Y.apply(X,J)}})}var AJ=U("User"),EJ=U("Job"),CJ=U("FailedJob"),PJ=[["Team",[""],"auth"],["TeamInvitation",[""],"auth"],["TeamMember",[""],"auth"],["SocialAccount",[""],"auth"],["Subscriber",[""],"auth"],["SubscriberEmail",[""],"auth"],["Subscription",[""],"auth"],["Post",["Content"],"cms"],["Page",["Content"],"cms"],["PageRevision",["Content"],"cms"],["Redirect",["Content"],"cms"],["Menu",["Content"],"cms"],["MenuItem",["Content"],"cms"],["Author",["Content"],"cms"],["Comment",[""],"cms"],["Tag",[""],"cms"],["Site",[""],"auth"],["SiteDomain",[""],"auth"],["MagicLinkToken",[""],"auth"],["SmsOptOut",[""],"auth"],["Form",["Forms"],"forms"],["FormField",["Forms"],"forms"],["FormSubmission",["Forms"],"forms"],["Activity",[""],"dashboard"],["Board",[""],"dashboard"],["BoardColumn",[""],"dashboard"],["Card",[""],"dashboard"],["CardComment",[""],"dashboard"],["Deployment",[""],"dashboard"],["Label",[""],"dashboard"],["Release",[""],"dashboard"],["Notification",[""],"dashboard"],["NotificationDelivery",[""],"dashboard"],["MailPreference",[""],"dashboard"],["Log",[""],"dashboard"],["Request",[""],"dashboard"],["AnalyticsEvent",[""],"dashboard"],["QueryLog",[""],"dashboard"],["Error",[""],"monitoring"],["Websocket",["realtime"],"realtime"],["Campaign",[""],"marketing"],["CampaignSend",[""],"marketing"],["EmailList",[""],"marketing"],["EmailListSubscriber",[""],"marketing"],["EmailIdempotency",[""],"marketing"],["EmailSuppression",[""],"marketing"],["EmailWebhookEvent",[""],"marketing"],["SocialPost",[""],"marketing"],["Automation",[""],"marketing"],["AutomationRun",[""],"marketing"],["CampaignVariant",[""],"marketing"],["CommunicationSuppression",[""],"marketing"],["ConsentEvent",[""],"marketing"],["SenderDomain",[""],"marketing"],["UsageEvent",[""],"marketing"],["PaymentMethod",[""],"commerce"],["PaymentProduct",[""],"commerce"],["PaymentTransaction",[""],"commerce"],["Order",["commerce"],"commerce"],["OrderIdempotency",["commerce"],"commerce"],["OrderItem",["commerce"],"commerce"],["Cart",["commerce"],"commerce"],["CartItem",["commerce"],"commerce"],["Customer",["commerce"],"commerce"],["Product",["commerce"],"commerce"],["ProductVariant",["commerce"],"commerce"],["ProductUnit",["commerce"],"commerce"],["Manufacturer",["commerce"],"commerce"],["Category",["commerce"],"commerce"],["Coupon",["commerce"],"commerce"],["GiftCard",["commerce"],"commerce"],["LicenseKey",["commerce"],"commerce"],["Review",["commerce"],"commerce"],["Receipt",["commerce"],"commerce"],["PrintDevice",["commerce"],"commerce"],["ShippingMethod",["commerce"],"commerce"],["ShippingRate",["commerce"],"commerce"],["ShippingZone",["commerce"],"commerce"],["DeliveryRoute",["commerce"],"commerce"],["DeliveryStop",["commerce"],"commerce"],["DigitalDelivery",["commerce"],"commerce"],["Driver",["commerce"],"commerce"],["DriverPing",["commerce"],"commerce"],["TaxRate",["commerce"],"commerce"],["WaitlistProduct",["commerce"],"commerce"],["WaitlistRestaurant",["commerce"],"commerce"],["Auction",["commerce"],"commerce"],["AuctionItem",["commerce"],"commerce"],["Bid",["commerce"],"commerce"],["Pledge",["commerce"],"commerce"],["LoyaltyPoint",["commerce"],"commerce"],["LoyaltyReward",["commerce"],"commerce"],["Payment",["commerce"],"commerce"],["Transaction",["commerce"],"commerce"]];queueMicrotask(async()=>{try{let{feature:Z}=await import("@stacksjs/config"),$=await I8("User");if($)t.User=$;if(Z("queue")){let X=await I8("Job");if(X)t.Job=X;let J=await I8("FailedJob");if(J)t.FailedJob=J}for(let[X,J,Y]of PJ){if(!Z(Y))continue;let Q=await I8(X,J);if(Q)t[X]=Q}}catch(Z){console.error("[orm] deferred model load failed:",Z)}finally{l7()}});var NJ=U("Activity"),kJ=U("AnalyticsEvent"),IJ=U("Automation"),jJ=U("AutomationRun"),SJ=U("Auction"),MJ=U("CampaignVariant"),fJ=U("CommunicationSuppression"),yJ=U("ConsentEvent"),hJ=U("SenderDomain"),vJ=U("UsageEvent"),RJ=U("AuctionItem"),bJ=U("Author"),gJ=U("Bid"),uJ=U("Board"),cJ=U("BoardColumn"),mJ=U("Campaign"),lJ=U("Card"),dJ=U("CardComment"),nJ=U("Cart"),pJ=U("CartItem"),iJ=U("Category"),rJ=U("Comment"),tJ=U("Coupon"),sJ=U("Customer"),oJ=U("DeliveryRoute"),aJ=U("DeliveryStop"),eJ=U("Deployment"),Z3=U("DigitalDelivery"),$3=U("Driver"),X3=U("DriverPing"),J3=U("CampaignSend"),Y3=U("EmailList"),Q3=U("EmailListSubscriber"),G3=U("Form"),W3=U("FormField"),B3=U("FormSubmission"),V3=U("MagicLinkToken"),K3=U("Menu"),H3=U("MenuItem"),z3=U("PageRevision"),O3=U("Pledge"),_3=U("Redirect"),F3=U("Site"),w3=U("SiteDomain"),x3=U("SmsOptOut"),T3=U("EmailIdempotency"),U3=U("EmailSuppression"),q3=U("EmailWebhookEvent"),L3=U("Error"),D3=U("GiftCard"),A3=U("Label"),E3=U("LicenseKey"),C3=U("Log"),P3=U("LoyaltyPoint"),N3=U("LoyaltyReward"),k3=U("MailPreference"),I3=U("Manufacturer"),j3=U("Notification"),S3=U("NotificationDelivery"),M3=U("Order"),f3=U("OrderIdempotency"),y3=U("OrderItem"),h3=U("Page"),v3=U("Payment"),R3=U("PaymentMethod"),b3=U("PaymentProduct"),g3=U("PaymentTransaction"),u3=U("Post"),c3=U("PrintDevice"),m3=U("Product"),l3=U("ProductUnit"),d3=U("ProductVariant"),n3=U("QueryLog"),p3=U("Receipt"),i3=U("Release"),r3=U("Request"),t3=U("Review"),s3=U("ShippingMethod"),o3=U("ShippingRate"),a3=U("ShippingZone"),e3=U("SocialPost"),ZY=U("SocialAccount"),$Y=U("Subscriber"),XY=U("SubscriberEmail"),JY=U("Subscription"),YY=U("Tag"),QY=U("TaxRate"),GY=U("Team"),WY=U("TeamInvitation"),BY=U("TeamMember"),VY=U("Transaction"),KY=U("WaitlistProduct"),HY=U("WaitlistRestaurant"),zY=U("Websocket"),OY={User:AJ,Job:EJ,FailedJob:CJ,Activity:NJ,AnalyticsEvent:kJ,Automation:IJ,AutomationRun:jJ,Auction:SJ,AuctionItem:RJ,Author:bJ,Bid:gJ,Board:uJ,BoardColumn:cJ,Campaign:mJ,CampaignSend:J3,CampaignVariant:MJ,Card:lJ,CardComment:dJ,Cart:nJ,CartItem:pJ,Category:iJ,Comment:rJ,Coupon:tJ,Customer:sJ,CommunicationSuppression:fJ,ConsentEvent:yJ,DeliveryRoute:oJ,DeliveryStop:aJ,Deployment:eJ,DigitalDelivery:Z3,Driver:$3,DriverPing:X3,EmailList:Y3,EmailListSubscriber:Q3,EmailIdempotency:T3,EmailSuppression:U3,EmailWebhookEvent:q3,ErrorModel:L3,Form:G3,FormField:W3,FormSubmission:B3,GiftCard:D3,Label:A3,LicenseKey:E3,Log:C3,LoyaltyPoint:P3,LoyaltyReward:N3,MailPreference:k3,Manufacturer:I3,Notification:j3,MagicLinkToken:V3,Menu:K3,MenuItem:H3,NotificationDelivery:S3,Order:M3,OrderIdempotency:f3,OrderItem:y3,Page:h3,PageRevision:z3,Payment:v3,PaymentMethod:R3,PaymentProduct:b3,PaymentTransaction:g3,Pledge:O3,Post:u3,PrintDevice:c3,Product:m3,ProductUnit:l3,ProductVariant:d3,QueryLog:n3,Receipt:p3,Release:i3,Request:r3,Review:t3,ShippingMethod:s3,Redirect:_3,SenderDomain:hJ,ShippingRate:o3,ShippingZone:a3,Site:F3,SiteDomain:w3,SmsOptOut:x3,SocialAccount:ZY,SocialPost:e3,Subscriber:$Y,SubscriberEmail:XY,Subscription:JY,Tag:YY,TaxRate:QY,Team:GY,TeamInvitation:WY,TeamMember:BY,Transaction:VY,UsageEvent:vJ,WaitlistProduct:KY,WaitlistRestaurant:HY,Websocket:zY},B0=globalThis;for(let[Z,$]of Object.entries(OY))if($&&B0[Z]===void 0)B0[Z]=$;async function _Y(Z){if(!Z)return[];try{if(typeof Z.all==="function"){let $=await Z.all();return Array.isArray($)?$:[]}if(typeof Z.get==="function"){let $=await Z.get();return Array.isArray($)?$:[]}}catch{}return[]}function FY(Z,$,X=""){if(!Z)return X;try{if(typeof Z.get==="function"){let Y=Z.get($);if(Y!==void 0&&Y!==null)return Y}}catch{}let J=Z?.[$];return J!==void 0&&J!==null?J:X}if(B0.safeAll===void 0)B0.safeAll=_Y;if(B0.safeGet===void 0)B0.safeGet=FY;export{EX as withoutValidation,e as withoutEvents,QQ as transactional,JQ as transaction,EQ as toTimestamp,O2 as toSnakeCaseKeys,o8 as toSimplePaginator,s8 as toPaginator,a8 as toCursorPaginator,rX as toAttrs,X2 as setAuditUser,YQ as savepoint,Z9 as resolvePageArgs,$9 as resolveCursorArgs,qJ as renderDatabaseTypeFile,r7 as prunable,h$ as projectDocumentsFromTrait,J5 as parseCursor,ET as ormReady,HQ as modelTableName,ZJ as mergeModelDefinition,UY as massPrunable,z2 as mapWriteError,LQ as mapEntity,r$ as isUniqueViolation,M2 as isSimplePaginator,S2 as isPaginator,K0 as isEncrypted,f2 as isCursorPaginator,zQ as hasRelations,_2 as getWritableFields,b as getTableName,N2 as getRelations,OQ as getRelationType,_Q as getRelationCount,qY as getPrunableConfig,FQ as getPivotTables,P2 as getPivotTableName,F0 as getModelName,xQ as getHiddenAttributes,TQ as getGuardedAttributes,UQ as getFillableAttributes,DQ as formatDate,r8 as findUserModel,i8 as findCoreModel,F2 as filterFillable,wQ as fetchOtherModelRelations,qQ as extractFields,AQ as extractDate,wT as extendModel,X9 as enrichPaginatorUrls,M8 as encryptValue,h7 as defineModel,f8 as decryptValue,ZQ as db,c8 as createTaggableMethods,l8 as createLikeableMethods,g8 as createCommentableMethods,m8 as createCategorizableMethods,l$ as createAuditMethods,y8 as collectEncryptedAttributes,UJ as buildDatabaseSchema,sY as batchLoad,zY as Websocket,HY as WaitlistRestaurant,KY as WaitlistProduct,AJ as User,vJ as UsageEvent,VY as Transaction,BY as TeamMember,WY as TeamInvitation,GY as Team,QY as TaxRate,YY as Tag,JY as Subscription,XY as SubscriberEmail,$Y as Subscriber,E2 as SubqueryBuilder,e3 as SocialPost,ZY as SocialAccount,x3 as SmsOptOut,w3 as SiteDomain,F3 as Site,a3 as ShippingZone,o3 as ShippingRate,s3 as ShippingMethod,hJ as SenderDomain,t3 as Review,r3 as Request,i3 as Release,_3 as Redirect,p3 as Receipt,n3 as QueryLog,d3 as ProductVariant,l3 as ProductUnit,m3 as Product,c3 as PrintDevice,u3 as Post,O3 as Pledge,g3 as PaymentTransaction,b3 as PaymentProduct,R3 as PaymentMethod,v3 as Payment,z3 as PageRevision,h3 as Page,y3 as OrderItem,f3 as OrderIdempotency,M3 as Order,S3 as NotificationDelivery,j3 as Notification,j7 as ModelValidationError,f7 as ModelNotFoundError,H3 as MenuItem,K3 as Menu,f$ as MassAssignmentException,I3 as Manufacturer,k3 as MailPreference,V3 as MagicLinkToken,v$ as MODEL_DEFINITION,N3 as LoyaltyReward,P3 as LoyaltyPoint,C3 as Log,E3 as LicenseKey,A3 as Label,EJ as Job,D3 as GiftCard,B3 as FormSubmission,W3 as FormField,G3 as Form,CJ as FailedJob,L3 as ErrorModel,q3 as EmailWebhookEvent,U3 as EmailSuppression,Q3 as EmailListSubscriber,Y3 as EmailList,T3 as EmailIdempotency,X3 as DriverPing,$3 as Driver,Z3 as DigitalDelivery,eJ as Deployment,aJ as DeliveryStop,oJ as DeliveryRoute,sJ as Customer,tJ as Coupon,yJ as ConsentEvent,fJ as CommunicationSuppression,rJ as Comment,iJ as Category,pJ as CartItem,nJ as Cart,dJ as CardComment,lJ as Card,MJ as CampaignVariant,J3 as CampaignSend,mJ as Campaign,cJ as BoardColumn,uJ as Board,gJ as Bid,jJ as AutomationRun,IJ as Automation,bJ as Author,RJ as AuctionItem,SJ as Auction,kJ as AnalyticsEvent,NJ as Activity};
30
+ `,ym="/* eslint-disable */\n// AUTO-GENERATED by `buddy generate:db-types --framework` \u2014 do not edit.\n//\n// The shapes of the tables the framework itself ships, so framework code gets\n// real rows from `db.selectFrom(...)` without asserting them. An application's\n// own tables (and its overrides of these) live in `DatabaseSchema`, which takes\n// precedence - see `RowOf` in `./utils`.\n\nexport interface FrameworkSchema {\n",Rm=`}
31
+ `;function Bc(e){return e==="framework"?ym:gm}function Lc(e){return e==="framework"?Rm:hm}async function Kc(e,t,n=[]){let i=[];if(!ri.existsSync(e))return i;let r=ri.readdirSync(e,{withFileTypes:!0});for(let o of r){let s=V.join(e,o.name);if(o.isDirectory()){if(t){let a=await Kc(s,!0,n);i.push(...a)}continue}if(!o.name.endsWith(".ts"))continue;if(o.name.startsWith("_")||o.name.startsWith("index"))continue;try{let a=await(V.isAbsolute(s)?import(s):import(V.resolve(s))),c=a.default||a;if(c?.name&&(c.attributes||c.table))i.push({filePath:s,model:c})}catch(a){n.push({file:s,error:a.message})}}return i}async function Tm(e={}){let t=e.modelsDir??V.userModelsPath(),n=e.defaultsDir??V.frameworkPath("defaults/app/Models"),i=e.outFile??V.projectPath("database/types.d.ts"),r=[],o=[];for(let[_,k]of[[t,!1],[n,!0]])try{let g=await Kc(_,k,r);o.push(...g)}catch(g){r.push({file:_,error:g.message})}let s=new Map;for(let _ of o)s.set(_.model.name??V.basename(_.filePath).replace(/\.ts$/,""),_);for(let _ of o)if(_.filePath.startsWith(t))s.set(_.model.name??V.basename(_.filePath).replace(/\.ts$/,""),_);let a=[];for(let[_,{model:k}]of s){let g=k.table??`${Q(_)}s`,y=bm({...fm(k),..._m(k),...cm(k)});a.push({table:g,model:_,columns:y})}let c=new Map;for(let[_,{model:k}]of s)for(let g of mm(_,k)){if(c.has(g.table))continue;c.set(g.table,{table:g.table,model:`(${g.table} pivot)`,columns:g.columns})}a.push(...c.values()),a.sort((_,k)=>_.table.localeCompare(k.table));let l=e.target??"app",u=l==="framework"?1:2,m=a.map((_)=>Gc(_.table,_.columns,u)).join(`
32
+ `),p=`${Bc(l)}${m}
33
+ ${Lc(l)}`;if(!e.dryRun){let _=V.dirname(i);if(!ri.existsSync(_))ri.mkdirSync(_,{recursive:!0});ri.writeFileSync(i,p,"utf-8"),rm.success(`[generate:db-types] wrote ${a.length} table(s) to ${i}`)}return{outFile:i,tables:a,errors:r,content:p}}function wm(e,t="app"){let n=[...e].sort((i,r)=>i.table.localeCompare(r.table)).map((i)=>Gc(i.table,i.columns,t==="framework"?1:2)).join(`
34
+ `);return`${Bc(t)}${n}
35
+ ${Lc(t)}`}import{configureOrm as vm}from"@stacksjs/query-builder";function Sm(){try{let e=process.env.DB_DATABASE_PATH||"database/stacks.sqlite";if((process.env.DB_CONNECTION||"sqlite")==="sqlite")vm({database:e})}catch{}}Sm();async function Hc(e){for(let t=0;;t++){let n=await import(e);try{return n.default}catch(i){if(t<5&&i instanceof ReferenceError&&/before initialization/.test(i.message)){await new Promise((r)=>setTimeout(r,0));continue}throw i}}}async function qi(e,t=[""]){let{path:n}=await import("@stacksjs/path"),i=n.userModelsPath(`${e}.ts`);try{if(await Bun.file(i).exists())return await Hc(i)}catch(r){console.error(`[orm] Failed to import userland model ${e} from ${i} - falling back to framework default. Reason:`,r)}for(let r of t){let o=r?`${r}/`:"",s=n.frameworkPath(`defaults/app/Models/${o}${e}.ts`);try{if(await Bun.file(s).exists())return await Hc(s)}catch(a){console.error(`[orm] Failed to import framework default model ${e} from ${s} - trying next subdir. Reason:`,a)}}return null}var J={},Vc=()=>{},jj=new Promise((e)=>{Vc=e});function h(e){return new Proxy(function(){},{get(t,n){if(n==="then")return;let i=J[e];if(i==null)return;let r=i[n];return typeof r==="function"?r.bind(i):r},set(t,n,i){let r=J[e];if(r==null)return!1;return r[n]=i,!0},has(t,n){let i=J[e];return i==null?!1:(n in i)},apply(t,n,i){let r=J[e];if(r==null||typeof r!=="function")return;return r.apply(n,i)}})}var xm=h("User"),Cm=h("Job"),jm=h("FailedJob"),Pm=[["Team",[""],"auth"],["TeamInvitation",[""],"auth"],["TeamMember",[""],"auth"],["SocialAccount",[""],"auth"],["Subscriber",[""],"auth"],["SubscriberEmail",[""],"auth"],["Subscription",[""],"auth"],["Post",["Content"],"cms"],["Page",["Content"],"cms"],["PageRevision",["Content"],"cms"],["Redirect",["Content"],"cms"],["Menu",["Content"],"cms"],["MenuItem",["Content"],"cms"],["Author",["Content"],"cms"],["Comment",[""],"cms"],["Tag",[""],"cms"],["Site",[""],"auth"],["SiteDomain",[""],"auth"],["MagicLinkToken",[""],"auth"],["SmsOptOut",[""],"auth"],["Form",["Forms"],"forms"],["FormField",["Forms"],"forms"],["FormSubmission",["Forms"],"forms"],["Activity",[""],"dashboard"],["Board",[""],"dashboard"],["BoardColumn",[""],"dashboard"],["Card",[""],"dashboard"],["CardComment",[""],"dashboard"],["Deployment",[""],"dashboard"],["Label",[""],"dashboard"],["Release",[""],"dashboard"],["Notification",[""],"dashboard"],["NotificationDelivery",[""],"dashboard"],["MailPreference",[""],"dashboard"],["Log",[""],"dashboard"],["Request",[""],"dashboard"],["AnalyticsEvent",[""],"dashboard"],["QueryLog",[""],"dashboard"],["Error",[""],"monitoring"],["Websocket",["realtime"],"realtime"],["Campaign",[""],"marketing"],["CampaignSend",[""],"marketing"],["EmailList",[""],"marketing"],["EmailListSubscriber",[""],"marketing"],["EmailIdempotency",[""],"marketing"],["EmailSuppression",[""],"marketing"],["EmailWebhookEvent",[""],"marketing"],["SocialPost",[""],"marketing"],["Automation",[""],"marketing"],["AutomationRun",[""],"marketing"],["CampaignVariant",[""],"marketing"],["CommunicationSuppression",[""],"marketing"],["ConsentEvent",[""],"marketing"],["SenderDomain",[""],"marketing"],["UsageEvent",[""],"marketing"],["PaymentMethod",[""],"commerce"],["PaymentProduct",[""],"commerce"],["PaymentTransaction",[""],"commerce"],["Order",["commerce"],"commerce"],["OrderIdempotency",["commerce"],"commerce"],["OrderItem",["commerce"],"commerce"],["Cart",["commerce"],"commerce"],["CartItem",["commerce"],"commerce"],["Customer",["commerce"],"commerce"],["Product",["commerce"],"commerce"],["ProductVariant",["commerce"],"commerce"],["ProductUnit",["commerce"],"commerce"],["Manufacturer",["commerce"],"commerce"],["Category",["commerce"],"commerce"],["Coupon",["commerce"],"commerce"],["GiftCard",["commerce"],"commerce"],["LicenseKey",["commerce"],"commerce"],["Review",["commerce"],"commerce"],["Receipt",["commerce"],"commerce"],["PrintDevice",["commerce"],"commerce"],["ShippingMethod",["commerce"],"commerce"],["ShippingRate",["commerce"],"commerce"],["ShippingZone",["commerce"],"commerce"],["DeliveryRoute",["commerce"],"commerce"],["DeliveryStop",["commerce"],"commerce"],["DigitalDelivery",["commerce"],"commerce"],["Driver",["commerce"],"commerce"],["DriverPing",["commerce"],"commerce"],["TaxRate",["commerce"],"commerce"],["WaitlistProduct",["commerce"],"commerce"],["WaitlistRestaurant",["commerce"],"commerce"],["Auction",["commerce"],"commerce"],["AuctionItem",["commerce"],"commerce"],["Bid",["commerce"],"commerce"],["Pledge",["commerce"],"commerce"],["LoyaltyPoint",["commerce"],"commerce"],["LoyaltyReward",["commerce"],"commerce"],["Payment",["commerce"],"commerce"],["Transaction",["commerce"],"commerce"]];queueMicrotask(async()=>{try{let{feature:e}=await import("@stacksjs/config"),t=await qi("User");if(t)J.User=t;if(e("queue")){let n=await qi("Job");if(n)J.Job=n;let i=await qi("FailedJob");if(i)J.FailedJob=i}for(let[n,i,r]of Pm){if(!e(r))continue;let o=await qi(n,i);if(o)J[n]=o}}catch(e){console.error("[orm] deferred model load failed:",e)}finally{Vc()}});var Em=h("Activity"),qm=h("AnalyticsEvent"),Om=h("Automation"),Am=h("AutomationRun"),Im=h("Auction"),$m=h("CampaignVariant"),Um=h("CommunicationSuppression"),Mm=h("ConsentEvent"),Dm=h("SenderDomain"),Fm=h("UsageEvent"),Nm=h("AuctionItem"),Gm=h("Author"),Bm=h("Bid"),Lm=h("Board"),Km=h("BoardColumn"),Hm=h("Campaign"),Vm=h("Card"),zm=h("CardComment"),Wm=h("Cart"),Qm=h("CartItem"),Jm=h("Category"),Xm=h("Comment"),Ym=h("Coupon"),Zm=h("Customer"),ep=h("DeliveryRoute"),tp=h("DeliveryStop"),np=h("Deployment"),ip=h("DigitalDelivery"),rp=h("Driver"),op=h("DriverPing"),sp=h("CampaignSend"),ap=h("EmailList"),lp=h("EmailListSubscriber"),cp=h("Form"),dp=h("FormField"),up=h("FormSubmission"),mp=h("MagicLinkToken"),pp=h("Menu"),fp=h("MenuItem"),_p=h("PageRevision"),kp=h("Pledge"),bp=h("Redirect"),gp=h("Site"),hp=h("SiteDomain"),yp=h("SmsOptOut"),Rp=h("EmailIdempotency"),Tp=h("EmailSuppression"),wp=h("EmailWebhookEvent"),vp=h("Error"),Sp=h("GiftCard"),xp=h("Label"),Cp=h("LicenseKey"),jp=h("Log"),Pp=h("LoyaltyPoint"),Ep=h("LoyaltyReward"),qp=h("MailPreference"),Op=h("Manufacturer"),Ap=h("Notification"),Ip=h("NotificationDelivery"),$p=h("Order"),Up=h("OrderIdempotency"),Mp=h("OrderItem"),Dp=h("Page"),Fp=h("Payment"),Np=h("PaymentMethod"),Gp=h("PaymentProduct"),Bp=h("PaymentTransaction"),Lp=h("Post"),Kp=h("PrintDevice"),Hp=h("Product"),Vp=h("ProductUnit"),zp=h("ProductVariant"),Wp=h("QueryLog"),Qp=h("Receipt"),Jp=h("Release"),Xp=h("Request"),Yp=h("Review"),Zp=h("ShippingMethod"),ef=h("ShippingRate"),tf=h("ShippingZone"),nf=h("SocialPost"),rf=h("SocialAccount"),of=h("Subscriber"),sf=h("SubscriberEmail"),af=h("Subscription"),lf=h("Tag"),cf=h("TaxRate"),df=h("Team"),uf=h("TeamInvitation"),mf=h("TeamMember"),pf=h("Transaction"),ff=h("WaitlistProduct"),_f=h("WaitlistRestaurant"),kf=h("Websocket"),bf={User:xm,Job:Cm,FailedJob:jm,Activity:Em,AnalyticsEvent:qm,Automation:Om,AutomationRun:Am,Auction:Im,AuctionItem:Nm,Author:Gm,Bid:Bm,Board:Lm,BoardColumn:Km,Campaign:Hm,CampaignSend:sp,CampaignVariant:$m,Card:Vm,CardComment:zm,Cart:Wm,CartItem:Qm,Category:Jm,Comment:Xm,Coupon:Ym,Customer:Zm,CommunicationSuppression:Um,ConsentEvent:Mm,DeliveryRoute:ep,DeliveryStop:tp,Deployment:np,DigitalDelivery:ip,Driver:rp,DriverPing:op,EmailList:ap,EmailListSubscriber:lp,EmailIdempotency:Rp,EmailSuppression:Tp,EmailWebhookEvent:wp,ErrorModel:vp,Form:cp,FormField:dp,FormSubmission:up,GiftCard:Sp,Label:xp,LicenseKey:Cp,Log:jp,LoyaltyPoint:Pp,LoyaltyReward:Ep,MailPreference:qp,Manufacturer:Op,Notification:Ap,MagicLinkToken:mp,Menu:pp,MenuItem:fp,NotificationDelivery:Ip,Order:$p,OrderIdempotency:Up,OrderItem:Mp,Page:Dp,PageRevision:_p,Payment:Fp,PaymentMethod:Np,PaymentProduct:Gp,PaymentTransaction:Bp,Pledge:kp,Post:Lp,PrintDevice:Kp,Product:Hp,ProductUnit:Vp,ProductVariant:zp,QueryLog:Wp,Receipt:Qp,Release:Jp,Request:Xp,Review:Yp,ShippingMethod:Zp,Redirect:bp,SenderDomain:Dm,ShippingRate:ef,ShippingZone:tf,Site:gp,SiteDomain:hp,SmsOptOut:yp,SocialAccount:rf,SocialPost:nf,Subscriber:of,SubscriberEmail:sf,Subscription:af,Tag:lf,TaxRate:cf,Team:df,TeamInvitation:uf,TeamMember:mf,Transaction:pf,UsageEvent:Fm,WaitlistProduct:ff,WaitlistRestaurant:_f,Websocket:kf},ce=globalThis;for(let[e,t]of Object.entries(bf))if(t&&ce[e]===void 0)ce[e]=t;async function gf(e){if(!e)return[];try{if(typeof e.all==="function"){let t=await e.all();return Array.isArray(t)?t:[]}if(typeof e.get==="function"){let t=await e.get();return Array.isArray(t)?t:[]}}catch{}return[]}function hf(e,t,n=""){if(!e)return n;try{if(typeof e.get==="function"){let r=e.get(t);if(r!==void 0&&r!==null)return r}}catch{}let i=e?.[t];return i!==void 0&&i!==null?i:n}if(ce.safeAll===void 0)ce.safeAll=gf;if(ce.safeGet===void 0)ce.safeGet=hf;export{Em as Activity,qm as AnalyticsEvent,Im as Auction,Nm as AuctionItem,Gm as Author,Om as Automation,Am as AutomationRun,Bm as Bid,Lm as Board,Km as BoardColumn,Hm as Campaign,sp as CampaignSend,$m as CampaignVariant,Vm as Card,zm as CardComment,Wm as Cart,Qm as CartItem,Jm as Category,Xm as Comment,Um as CommunicationSuppression,Mm as ConsentEvent,Ym as Coupon,Zm as Customer,ep as DeliveryRoute,tp as DeliveryStop,np as Deployment,ip as DigitalDelivery,rp as Driver,op as DriverPing,Rp as EmailIdempotency,ap as EmailList,lp as EmailListSubscriber,Tp as EmailSuppression,wp as EmailWebhookEvent,vp as ErrorModel,jm as FailedJob,cp as Form,dp as FormField,up as FormSubmission,Sp as GiftCard,Cm as Job,xp as Label,Cp as LicenseKey,jp as Log,Pp as LoyaltyPoint,Ep as LoyaltyReward,Fa as MODEL_DEFINITION,mp as MagicLinkToken,qp as MailPreference,Op as Manufacturer,Ua as MassAssignmentException,pp as Menu,fp as MenuItem,Uc as ModelNotFoundError,Ac as ModelValidationError,Ap as Notification,Ip as NotificationDelivery,$p as Order,Up as OrderIdempotency,Mp as OrderItem,Dp as Page,_p as PageRevision,Fp as Payment,Np as PaymentMethod,Gp as PaymentProduct,Bp as PaymentTransaction,kp as Pledge,Lp as Post,Kp as PrintDevice,Hp as Product,Vp as ProductUnit,zp as ProductVariant,Wp as QueryLog,Qp as Receipt,bp as Redirect,Jp as Release,Xp as Request,Yp as Review,Dm as SenderDomain,Zp as ShippingMethod,ef as ShippingRate,tf as ShippingZone,gp as Site,hp as SiteDomain,yp as SmsOptOut,rf as SocialAccount,nf as SocialPost,Cd as SubqueryBuilder,of as Subscriber,sf as SubscriberEmail,af as Subscription,lf as Tag,cf as TaxRate,df as Team,uf as TeamInvitation,mf as TeamMember,pf as Transaction,Fm as UsageEvent,xm as User,ff as WaitlistProduct,_f as WaitlistRestaurant,kf as Websocket,e_ as batchLoad,Tm as buildDatabaseSchema,Ui as collectEncryptedAttributes,Va as createAuditMethods,Ki as createCategorizableMethods,Gi as createCommentableMethods,Hi as createLikeableMethods,Li as createTaggableMethods,r_ as db,$i as decryptValue,Dc as defineModel,Ii as encryptValue,rr as enrichPaginatorUrls,yj as extendModel,C_ as extractDate,v_ as extractFields,y_ as fetchOtherModelRelations,gd as filterFillable,Qi as findCoreModel,Ji as findUserModel,x_ as formatDate,w_ as getFillableAttributes,T_ as getGuardedAttributes,R_ as getHiddenAttributes,ke as getModelName,Pd as getPivotTableName,h_ as getPivotTables,vf as getPrunableConfig,g_ as getRelationCount,b_ as getRelationType,Ed as getRelations,F as getTableName,bd as getWritableFields,k_ as hasRelations,Ud as isCursorPaginator,ue as isEncrypted,Id as isPaginator,$d as isSimplePaginator,Xa as isUniqueViolation,S_ as mapEntity,_d as mapWriteError,wf as massPrunable,im as mergeModelDefinition,__ as modelTableName,jj as ormReady,sl as parseCursor,Da as projectDocumentsFromTrait,Xc as prunable,wm as renderDatabaseTypeFile,ir as resolveCursorArgs,nr as resolvePageArgs,l_ as savepoint,od as setAuditUser,Xu as toAttrs,er as toCursorPaginator,Yi as toPaginator,Zi as toSimplePaginator,kd as toSnakeCaseKeys,j_ as toTimestamp,a_ as transaction,c_ as transactional,ee as withoutEvents,Cu as withoutValidation};