diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c25b566 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Tests + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + test: + name: Run Tests + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test -- --run + diff --git a/dist/asset-manifest.json b/dist/asset-manifest.json deleted file mode 100644 index 95fb17f..0000000 --- a/dist/asset-manifest.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "assets/index-BBBHO-8r.js": { - "hash": "3afbd2ab8432e7eabd12606c81c7e5f9a58f6712d07c92e6cd2775bb8ffefae9", - "size": 747650 - }, - "assets/index-CKNEcXLx.css": { - "hash": "fb92075a0ea560b2e0d90720f826536e803edd3ac37bf91613e8b70530d4f869", - "size": 52373 - }, - "cart.png": { - "hash": "7f447e40edee2caa22d91ccab3420324a3ed86c61b1dc6fa3dd8a53fb2ea0c82", - "size": 45827 - }, - "index.html": { - "hash": "d86c731110449f74e139238be391756e8ac9dab4736ba78ab0812d9db081fc53", - "size": 455 - }, - "logo.png": { - "hash": "876df5d6c4960441007de433e054433e06c14d6233c331cb351dc5db02ab5f35", - "size": 648990 - }, - "logo.svg": { - "hash": "1e7acf9b67412ab2d260d9cd504d4f66bfc1f79b1c4dbcca2a1a68cd6e1f2af2", - "size": 760 - }, - "skinnylogo.png": { - "hash": "29380663a5375bc9ac63b26d91a3542ec9654cc55d68f20b151859832b80a991", - "size": 283578 - } -} \ No newline at end of file diff --git a/dist/assets/index-BBBHO-8r.js b/dist/assets/index-BBBHO-8r.js deleted file mode 100644 index 5e9e401..0000000 --- a/dist/assets/index-BBBHO-8r.js +++ /dev/null @@ -1,444 +0,0 @@ -function _M(e,t){for(var r=0;rn[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))n(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function r(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(l){if(l.ep)return;l.ep=!0;const o=r(l);fetch(l.href,o)}})();function ha(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Um={exports:{}},fs={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var J1;function MM(){if(J1)return fs;J1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,l,o){var c=null;if(o!==void 0&&(c=""+o),l.key!==void 0&&(c=""+l.key),"key"in l){o={};for(var d in l)d!=="key"&&(o[d]=l[d])}else o=l;return l=o.ref,{$$typeof:e,type:n,key:c,ref:l!==void 0?l:null,props:o}}return fs.Fragment=t,fs.jsx=r,fs.jsxs=r,fs}var ew;function PM(){return ew||(ew=1,Um.exports=MM()),Um.exports}var f=PM(),Bm={exports:{}},_e={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var tw;function DM(){if(tw)return _e;tw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.iterator;function b(R){return R===null||typeof R!="object"?null:(R=g&&R[g]||R["@@iterator"],typeof R=="function"?R:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,S={};function N(R,J,ee){this.props=R,this.context=J,this.refs=S,this.updater=ee||w}N.prototype.isReactComponent={},N.prototype.setState=function(R,J){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,J,"setState")},N.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function O(){}O.prototype=N.prototype;function C(R,J,ee){this.props=R,this.context=J,this.refs=S,this.updater=ee||w}var E=C.prototype=new O;E.constructor=C,j(E,N.prototype),E.isPureReactComponent=!0;var _=Array.isArray,k={H:null,A:null,T:null,S:null,V:null},M=Object.prototype.hasOwnProperty;function D(R,J,ee,le,ue,Se){return ee=Se.ref,{$$typeof:e,type:R,key:J,ref:ee!==void 0?ee:null,props:Se}}function U(R,J){return D(R.type,J,void 0,void 0,void 0,R.props)}function G(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function oe(R){var J={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ee){return J[ee]})}var W=/\/+/g;function ae(R,J){return typeof R=="object"&&R!==null&&R.key!=null?oe(""+R.key):J.toString(36)}function ce(){}function de(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(ce,ce):(R.status="pending",R.then(function(J){R.status==="pending"&&(R.status="fulfilled",R.value=J)},function(J){R.status==="pending"&&(R.status="rejected",R.reason=J)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function pe(R,J,ee,le,ue){var Se=typeof R;(Se==="undefined"||Se==="boolean")&&(R=null);var he=!1;if(R===null)he=!0;else switch(Se){case"bigint":case"string":case"number":he=!0;break;case"object":switch(R.$$typeof){case e:case t:he=!0;break;case m:return he=R._init,pe(he(R._payload),J,ee,le,ue)}}if(he)return ue=ue(R),he=le===""?"."+ae(R,0):le,_(ue)?(ee="",he!=null&&(ee=he.replace(W,"$&/")+"/"),pe(ue,J,ee,"",function(L){return L})):ue!=null&&(G(ue)&&(ue=U(ue,ee+(ue.key==null||R&&R.key===ue.key?"":(""+ue.key).replace(W,"$&/")+"/")+he)),J.push(ue)),1;he=0;var Me=le===""?".":le+":";if(_(R))for(var Ie=0;Ie>>1,R=I[ye];if(0>>1;yel(le,Y))uel(Se,le)?(I[ye]=Se,I[ue]=Y,ye=ue):(I[ye]=le,I[ee]=Y,ye=ee);else if(uel(Se,Y))I[ye]=Se,I[ue]=Y,ye=ue;else break e}}return Z}function l(I,Z){var Y=I.sortIndex-Z.sortIndex;return Y!==0?Y:I.id-Z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var h=[],p=[],m=1,g=null,b=3,w=!1,j=!1,S=!1,N=!1,O=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function _(I){for(var Z=r(p);Z!==null;){if(Z.callback===null)n(p);else if(Z.startTime<=I)n(p),Z.sortIndex=Z.expirationTime,t(h,Z);else break;Z=r(p)}}function k(I){if(S=!1,_(I),!j)if(r(h)!==null)j=!0,M||(M=!0,ae());else{var Z=r(p);Z!==null&&pe(k,Z.startTime-I)}}var M=!1,D=-1,U=5,G=-1;function oe(){return N?!0:!(e.unstable_now()-GI&&oe());){var ye=g.callback;if(typeof ye=="function"){g.callback=null,b=g.priorityLevel;var R=ye(g.expirationTime<=I);if(I=e.unstable_now(),typeof R=="function"){g.callback=R,_(I),Z=!0;break t}g===r(h)&&n(h),_(I)}else n(h);g=r(h)}if(g!==null)Z=!0;else{var J=r(p);J!==null&&pe(k,J.startTime-I),Z=!1}}break e}finally{g=null,b=Y,w=!1}Z=void 0}}finally{Z?ae():M=!1}}}var ae;if(typeof E=="function")ae=function(){E(W)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,de=ce.port2;ce.port1.onmessage=W,ae=function(){de.postMessage(null)}}else ae=function(){O(W,0)};function pe(I,Z){D=O(function(){I(e.unstable_now())},Z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125ye?(I.sortIndex=Y,t(p,I),r(h)===null&&I===r(p)&&(S?(C(D),D=-1):S=!0,pe(k,Y-ye))):(I.sortIndex=R,t(h,I),j||w||(j=!0,M||(M=!0,ae()))),I},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(I){var Z=b;return function(){var Y=b;b=Z;try{return I.apply(this,arguments)}finally{b=Y}}}})(qm)),qm}var aw;function UM(){return aw||(aw=1,$m.exports=zM()),$m.exports}var Hm={exports:{}},sr={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var iw;function BM(){if(iw)return sr;iw=1;var e=eo();function t(h){var p="https://react.dev/errors/"+h;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Hm.exports=BM(),Hm.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var ow;function IM(){if(ow)return ds;ow=1;var e=UM(),t=eo(),r=CN();function n(a){var i="https://react.dev/errors/"+a;if(1R||(a.current=ye[R],ye[R]=null,R--)}function le(a,i){R++,ye[R]=a.current,a.current=i}var ue=J(null),Se=J(null),he=J(null),Me=J(null);function Ie(a,i){switch(le(he,i),le(Se,a),le(ue,null),i.nodeType){case 9:case 11:a=(a=i.documentElement)&&(a=a.namespaceURI)?E1(a):0;break;default:if(a=i.tagName,i=i.namespaceURI)i=E1(i),a=C1(i,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}ee(ue),le(ue,a)}function L(){ee(ue),ee(Se),ee(he)}function V(a){a.memoizedState!==null&&le(Me,a);var i=ue.current,s=C1(i,a.type);i!==s&&(le(Se,a),le(ue,s))}function ie(a){Se.current===a&&(ee(ue),ee(Se)),Me.current===a&&(ee(Me),ls._currentValue=Y)}var F=Object.prototype.hasOwnProperty,ze=e.unstable_scheduleCallback,ke=e.unstable_cancelCallback,Ye=e.unstable_shouldYield,dt=e.unstable_requestPaint,tt=e.unstable_now,se=e.unstable_getCurrentPriorityLevel,me=e.unstable_ImmediatePriority,$e=e.unstable_UserBlockingPriority,pt=e.unstable_NormalPriority,Gr=e.unstable_LowPriority,Ln=e.unstable_IdlePriority,Fi=e.log,po=e.unstable_setDisableYieldValue,li=null,ne=null;function fe(a){if(typeof Fi=="function"&&po(a),ne&&typeof ne.setStrictMode=="function")try{ne.setStrictMode(li,a)}catch{}}var je=Math.clz32?Math.clz32:Sn,Pe=Math.log,ct=Math.LN2;function Sn(a){return a>>>=0,a===0?32:31-(Pe(a)/ct|0)|0}var Rt=256,Ar=4194304;function ar(a){var i=a&42;if(i!==0)return i;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function ir(a,i,s){var u=a.pendingLanes;if(u===0)return 0;var v=0,y=a.suspendedLanes,A=a.pingedLanes;a=a.warmLanes;var T=u&134217727;return T!==0?(u=T&~y,u!==0?v=ar(u):(A&=T,A!==0?v=ar(A):s||(s=T&~a,s!==0&&(v=ar(s))))):(T=u&~y,T!==0?v=ar(T):A!==0?v=ar(A):s||(s=u&~a,s!==0&&(v=ar(s)))),v===0?0:i!==0&&i!==v&&(i&y)===0&&(y=v&-v,s=i&-i,y>=s||y===32&&(s&4194048)!==0)?i:v}function ya(a,i){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&i)===0}function Ed(a,i){switch(a){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function vo(){var a=Rt;return Rt<<=1,(Rt&4194048)===0&&(Rt=256),a}function oi(){var a=Ar;return Ar<<=1,(Ar&62914560)===0&&(Ar=4194304),a}function Zi(a){for(var i=[],s=0;31>s;s++)i.push(a);return i}function ba(a,i){a.pendingLanes|=i,i!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function bk(a,i,s,u,v,y){var A=a.pendingLanes;a.pendingLanes=s,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=s,a.entangledLanes&=s,a.errorRecoveryDisabledLanes&=s,a.shellSuspendCounter=0;var T=a.entanglements,P=a.expirationTimes,q=a.hiddenUpdates;for(s=A&~s;0)":-1v||P[u]!==q[v]){var Q=` -`+P[u].replace(" at new "," at ");return a.displayName&&Q.includes("")&&(Q=Q.replace("",a.displayName)),Q}while(1<=u&&0<=v);break}}}finally{Pd=!1,Error.prepareStackTrace=s}return(s=a?a.displayName||a.name:"")?rl(s):""}function Ak(a){switch(a.tag){case 26:case 27:case 5:return rl(a.type);case 16:return rl("Lazy");case 13:return rl("Suspense");case 19:return rl("SuspenseList");case 0:case 15:return Dd(a.type,!1);case 11:return Dd(a.type.render,!1);case 1:return Dd(a.type,!0);case 31:return rl("Activity");default:return""}}function w0(a){try{var i="";do i+=Ak(a),a=a.return;while(a);return i}catch(s){return` -Error generating stack: `+s.message+` -`+s.stack}}function Yr(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function j0(a){var i=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Ok(a){var i=j0(a)?"checked":"value",s=Object.getOwnPropertyDescriptor(a.constructor.prototype,i),u=""+a[i];if(!a.hasOwnProperty(i)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var v=s.get,y=s.set;return Object.defineProperty(a,i,{configurable:!0,get:function(){return v.call(this)},set:function(A){u=""+A,y.call(this,A)}}),Object.defineProperty(a,i,{enumerable:s.enumerable}),{getValue:function(){return u},setValue:function(A){u=""+A},stopTracking:function(){a._valueTracker=null,delete a[i]}}}}function uc(a){a._valueTracker||(a._valueTracker=Ok(a))}function S0(a){if(!a)return!1;var i=a._valueTracker;if(!i)return!0;var s=i.getValue(),u="";return a&&(u=j0(a)?a.checked?"true":"false":a.value),a=u,a!==s?(i.setValue(a),!0):!1}function fc(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var Ek=/[\n"\\]/g;function Vr(a){return a.replace(Ek,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Rd(a,i,s,u,v,y,A,T){a.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?a.type=A:a.removeAttribute("type"),i!=null?A==="number"?(i===0&&a.value===""||a.value!=i)&&(a.value=""+Yr(i)):a.value!==""+Yr(i)&&(a.value=""+Yr(i)):A!=="submit"&&A!=="reset"||a.removeAttribute("value"),i!=null?Ld(a,A,Yr(i)):s!=null?Ld(a,A,Yr(s)):u!=null&&a.removeAttribute("value"),v==null&&y!=null&&(a.defaultChecked=!!y),v!=null&&(a.checked=v&&typeof v!="function"&&typeof v!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?a.name=""+Yr(T):a.removeAttribute("name")}function N0(a,i,s,u,v,y,A,T){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(a.type=y),i!=null||s!=null){if(!(y!=="submit"&&y!=="reset"||i!=null))return;s=s!=null?""+Yr(s):"",i=i!=null?""+Yr(i):s,T||i===a.value||(a.value=i),a.defaultValue=i}u=u??v,u=typeof u!="function"&&typeof u!="symbol"&&!!u,a.checked=T?a.checked:!!u,a.defaultChecked=!!u,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(a.name=A)}function Ld(a,i,s){i==="number"&&fc(a.ownerDocument)===a||a.defaultValue===""+s||(a.defaultValue=""+s)}function nl(a,i,s,u){if(a=a.options,i){i={};for(var v=0;v"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$d=!1;if(Un)try{var xo={};Object.defineProperty(xo,"passive",{get:function(){$d=!0}}),window.addEventListener("test",xo,xo),window.removeEventListener("test",xo,xo)}catch{$d=!1}var wa=null,qd=null,hc=null;function _0(){if(hc)return hc;var a,i=qd,s=i.length,u,v="value"in wa?wa.value:wa.textContent,y=v.length;for(a=0;a=So),z0=" ",U0=!1;function B0(a,i){switch(a){case"keyup":return t_.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function I0(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var ol=!1;function n_(a,i){switch(a){case"compositionend":return I0(i);case"keypress":return i.which!==32?null:(U0=!0,z0);case"textInput":return a=i.data,a===z0&&U0?null:a;default:return null}}function a_(a,i){if(ol)return a==="compositionend"||!Vd&&B0(a,i)?(a=_0(),hc=qd=wa=null,ol=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:s,offset:i-a};a=u}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=X0(s)}}function Z0(a,i){return a&&i?a===i?!0:a&&a.nodeType===3?!1:i&&i.nodeType===3?Z0(a,i.parentNode):"contains"in a?a.contains(i):a.compareDocumentPosition?!!(a.compareDocumentPosition(i)&16):!1:!1}function W0(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var i=fc(a.document);i instanceof a.HTMLIFrameElement;){try{var s=typeof i.contentWindow.location.href=="string"}catch{s=!1}if(s)a=i.contentWindow;else break;i=fc(a.document)}return i}function Zd(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i&&(i==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||i==="textarea"||a.contentEditable==="true")}var d_=Un&&"documentMode"in document&&11>=document.documentMode,sl=null,Wd=null,Eo=null,Qd=!1;function Q0(a,i,s){var u=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Qd||sl==null||sl!==fc(u)||(u=sl,"selectionStart"in u&&Zd(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Eo&&Oo(Eo,u)||(Eo=u,u=nu(Wd,"onSelect"),0>=A,v-=A,In=1<<32-je(i)+v|s<y?y:8;var A=I.T,T={};I.T=T,zh(a,!1,i,s);try{var P=v(),q=I.S;if(q!==null&&q(T,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var Q=w_(P,u);qo(a,i,Q,_r(a))}else qo(a,i,u,_r(a))}catch(re){qo(a,i,{then:function(){},status:"rejected",reason:re},_r())}finally{Z.p=y,I.T=A}}function O_(){}function Rh(a,i,s,u){if(a.tag!==5)throw Error(n(476));var v=Jb(a).queue;Qb(a,v,i,Y,s===null?O_:function(){return ex(a),s(u)})}function Jb(a){var i=a.memoizedState;if(i!==null)return i;i={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:Y},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:s},next:null},a.memoizedState=i,a=a.alternate,a!==null&&(a.memoizedState=i),i}function ex(a){var i=Jb(a).next.queue;qo(a,i,{},_r())}function Lh(){return or(ls)}function tx(){return _t().memoizedState}function rx(){return _t().memoizedState}function E_(a){for(var i=a.return;i!==null;){switch(i.tag){case 24:case 3:var s=_r();a=Na(s);var u=Aa(i,a,s);u!==null&&(Mr(u,i,s),Lo(u,i,s)),i={cache:dh()},a.payload=i;return}i=i.return}}function C_(a,i,s){var u=_r();s={lane:u,revertLane:0,action:s,hasEagerState:!1,eagerState:null,next:null},zc(a)?ax(i,s):(s=rh(a,i,s,u),s!==null&&(Mr(s,a,u),ix(s,i,u)))}function nx(a,i,s){var u=_r();qo(a,i,s,u)}function qo(a,i,s,u){var v={lane:u,revertLane:0,action:s,hasEagerState:!1,eagerState:null,next:null};if(zc(a))ax(i,v);else{var y=a.alternate;if(a.lanes===0&&(y===null||y.lanes===0)&&(y=i.lastRenderedReducer,y!==null))try{var A=i.lastRenderedState,T=y(A,s);if(v.hasEagerState=!0,v.eagerState=T,Or(T,A))return xc(a,i,v,0),ut===null&&bc(),!1}catch{}finally{}if(s=rh(a,i,v,u),s!==null)return Mr(s,a,u),ix(s,i,u),!0}return!1}function zh(a,i,s,u){if(u={lane:2,revertLane:pm(),action:u,hasEagerState:!1,eagerState:null,next:null},zc(a)){if(i)throw Error(n(479))}else i=rh(a,s,u,2),i!==null&&Mr(i,a,2)}function zc(a){var i=a.alternate;return a===De||i!==null&&i===De}function ax(a,i){yl=_c=!0;var s=a.pending;s===null?i.next=i:(i.next=s.next,s.next=i),a.pending=i}function ix(a,i,s){if((s&4194048)!==0){var u=i.lanes;u&=a.pendingLanes,s|=u,i.lanes=s,h0(a,s)}}var Uc={readContext:or,use:Pc,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et},lx={readContext:or,use:Pc,useCallback:function(a,i){return gr().memoizedState=[a,i===void 0?null:i],a},useContext:or,useEffect:Hb,useImperativeHandle:function(a,i,s){s=s!=null?s.concat([a]):null,Lc(4194308,4,Vb.bind(null,i,a),s)},useLayoutEffect:function(a,i){return Lc(4194308,4,a,i)},useInsertionEffect:function(a,i){Lc(4,2,a,i)},useMemo:function(a,i){var s=gr();i=i===void 0?null:i;var u=a();if(xi){fe(!0);try{a()}finally{fe(!1)}}return s.memoizedState=[u,i],u},useReducer:function(a,i,s){var u=gr();if(s!==void 0){var v=s(i);if(xi){fe(!0);try{s(i)}finally{fe(!1)}}}else v=i;return u.memoizedState=u.baseState=v,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:v},u.queue=a,a=a.dispatch=C_.bind(null,De,a),[u.memoizedState,a]},useRef:function(a){var i=gr();return a={current:a},i.memoizedState=a},useState:function(a){a=_h(a);var i=a.queue,s=nx.bind(null,De,i);return i.dispatch=s,[a.memoizedState,s]},useDebugValue:Ph,useDeferredValue:function(a,i){var s=gr();return Dh(s,a,i)},useTransition:function(){var a=_h(!1);return a=Qb.bind(null,De,a.queue,!0,!1),gr().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,i,s){var u=De,v=gr();if(Ve){if(s===void 0)throw Error(n(407));s=s()}else{if(s=i(),ut===null)throw Error(n(349));(qe&124)!==0||Eb(u,i,s)}v.memoizedState=s;var y={value:s,getSnapshot:i};return v.queue=y,Hb(Tb.bind(null,u,y,a),[a]),u.flags|=2048,xl(9,Rc(),Cb.bind(null,u,y,s,i),null),s},useId:function(){var a=gr(),i=ut.identifierPrefix;if(Ve){var s=$n,u=In;s=(u&~(1<<32-je(u)-1)).toString(32)+s,i="Ā«"+i+"R"+s,s=Mc++,0Ce?(Gt=Ne,Ne=null):Gt=Ne.sibling;var He=H(B,Ne,$[Ce],te);if(He===null){Ne===null&&(Ne=Gt);break}a&&Ne&&He.alternate===null&&i(B,Ne),z=y(He,z,Ce),Le===null?be=He:Le.sibling=He,Le=He,Ne=Gt}if(Ce===$.length)return s(B,Ne),Ve&&mi(B,Ce),be;if(Ne===null){for(;Ce<$.length;Ce++)Ne=re(B,$[Ce],te),Ne!==null&&(z=y(Ne,z,Ce),Le===null?be=Ne:Le.sibling=Ne,Le=Ne);return Ve&&mi(B,Ce),be}for(Ne=u(Ne);Ce<$.length;Ce++)Gt=K(Ne,B,Ce,$[Ce],te),Gt!==null&&(a&&Gt.alternate!==null&&Ne.delete(Gt.key===null?Ce:Gt.key),z=y(Gt,z,Ce),Le===null?be=Gt:Le.sibling=Gt,Le=Gt);return a&&Ne.forEach(function(qa){return i(B,qa)}),Ve&&mi(B,Ce),be}function Ee(B,z,$,te){if($==null)throw Error(n(151));for(var be=null,Le=null,Ne=z,Ce=z=0,Gt=null,He=$.next();Ne!==null&&!He.done;Ce++,He=$.next()){Ne.index>Ce?(Gt=Ne,Ne=null):Gt=Ne.sibling;var qa=H(B,Ne,He.value,te);if(qa===null){Ne===null&&(Ne=Gt);break}a&&Ne&&qa.alternate===null&&i(B,Ne),z=y(qa,z,Ce),Le===null?be=qa:Le.sibling=qa,Le=qa,Ne=Gt}if(He.done)return s(B,Ne),Ve&&mi(B,Ce),be;if(Ne===null){for(;!He.done;Ce++,He=$.next())He=re(B,He.value,te),He!==null&&(z=y(He,z,Ce),Le===null?be=He:Le.sibling=He,Le=He);return Ve&&mi(B,Ce),be}for(Ne=u(Ne);!He.done;Ce++,He=$.next())He=K(Ne,B,Ce,He.value,te),He!==null&&(a&&He.alternate!==null&&Ne.delete(He.key===null?Ce:He.key),z=y(He,z,Ce),Le===null?be=He:Le.sibling=He,Le=He);return a&&Ne.forEach(function(kM){return i(B,kM)}),Ve&&mi(B,Ce),be}function at(B,z,$,te){if(typeof $=="object"&&$!==null&&$.type===j&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case b:e:{for(var be=$.key;z!==null;){if(z.key===be){if(be=$.type,be===j){if(z.tag===7){s(B,z.sibling),te=v(z,$.props.children),te.return=B,B=te;break e}}else if(z.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===U&&sx(be)===z.type){s(B,z.sibling),te=v(z,$.props),Ko(te,$),te.return=B,B=te;break e}s(B,z);break}else i(B,z);z=z.sibling}$.type===j?(te=di($.props.children,B.mode,te,$.key),te.return=B,B=te):(te=jc($.type,$.key,$.props,null,B.mode,te),Ko(te,$),te.return=B,B=te)}return A(B);case w:e:{for(be=$.key;z!==null;){if(z.key===be)if(z.tag===4&&z.stateNode.containerInfo===$.containerInfo&&z.stateNode.implementation===$.implementation){s(B,z.sibling),te=v(z,$.children||[]),te.return=B,B=te;break e}else{s(B,z);break}else i(B,z);z=z.sibling}te=ih($,B.mode,te),te.return=B,B=te}return A(B);case U:return be=$._init,$=be($._payload),at(B,z,$,te)}if(pe($))return Te(B,z,$,te);if(ae($)){if(be=ae($),typeof be!="function")throw Error(n(150));return $=be.call($),Ee(B,z,$,te)}if(typeof $.then=="function")return at(B,z,Bc($),te);if($.$$typeof===E)return at(B,z,Oc(B,$),te);Ic(B,$)}return typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint"?($=""+$,z!==null&&z.tag===6?(s(B,z.sibling),te=v(z,$),te.return=B,B=te):(s(B,z),te=ah($,B.mode,te),te.return=B,B=te),A(B)):s(B,z)}return function(B,z,$,te){try{Ho=0;var be=at(B,z,$,te);return wl=null,be}catch(Ne){if(Ne===Do||Ne===Cc)throw Ne;var Le=Er(29,Ne,null,B.mode);return Le.lanes=te,Le.return=B,Le}finally{}}}var jl=cx(!0),ux=cx(!1),Qr=J(null),An=null;function Ea(a){var i=a.alternate;le(zt,zt.current&1),le(Qr,a),An===null&&(i===null||gl.current!==null||i.memoizedState!==null)&&(An=a)}function fx(a){if(a.tag===22){if(le(zt,zt.current),le(Qr,a),An===null){var i=a.alternate;i!==null&&i.memoizedState!==null&&(An=a)}}else Ca()}function Ca(){le(zt,zt.current),le(Qr,Qr.current)}function Gn(a){ee(Qr),An===a&&(An=null),ee(zt)}var zt=J(0);function $c(a){for(var i=a;i!==null;){if(i.tag===13){var s=i.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||Em(s)))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!==void 0){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break;for(;i.sibling===null;){if(i.return===null||i.return===a)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}function Uh(a,i,s,u){i=a.memoizedState,s=s(u,i),s=s==null?i:m({},i,s),a.memoizedState=s,a.lanes===0&&(a.updateQueue.baseState=s)}var Bh={enqueueSetState:function(a,i,s){a=a._reactInternals;var u=_r(),v=Na(u);v.payload=i,s!=null&&(v.callback=s),i=Aa(a,v,u),i!==null&&(Mr(i,a,u),Lo(i,a,u))},enqueueReplaceState:function(a,i,s){a=a._reactInternals;var u=_r(),v=Na(u);v.tag=1,v.payload=i,s!=null&&(v.callback=s),i=Aa(a,v,u),i!==null&&(Mr(i,a,u),Lo(i,a,u))},enqueueForceUpdate:function(a,i){a=a._reactInternals;var s=_r(),u=Na(s);u.tag=2,i!=null&&(u.callback=i),i=Aa(a,u,s),i!==null&&(Mr(i,a,s),Lo(i,a,s))}};function dx(a,i,s,u,v,y,A){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(u,y,A):i.prototype&&i.prototype.isPureReactComponent?!Oo(s,u)||!Oo(v,y):!0}function hx(a,i,s,u){a=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(s,u),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(s,u),i.state!==a&&Bh.enqueueReplaceState(i,i.state,null)}function wi(a,i){var s=i;if("ref"in i){s={};for(var u in i)u!=="ref"&&(s[u]=i[u])}if(a=a.defaultProps){s===i&&(s=m({},s));for(var v in a)s[v]===void 0&&(s[v]=a[v])}return s}var qc=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)};function mx(a){qc(a)}function px(a){console.error(a)}function vx(a){qc(a)}function Hc(a,i){try{var s=a.onUncaughtError;s(i.value,{componentStack:i.stack})}catch(u){setTimeout(function(){throw u})}}function gx(a,i,s){try{var u=a.onCaughtError;u(s.value,{componentStack:s.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Ih(a,i,s){return s=Na(s),s.tag=3,s.payload={element:null},s.callback=function(){Hc(a,i)},s}function yx(a){return a=Na(a),a.tag=3,a}function bx(a,i,s,u){var v=s.type.getDerivedStateFromError;if(typeof v=="function"){var y=u.value;a.payload=function(){return v(y)},a.callback=function(){gx(i,s,u)}}var A=s.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(a.callback=function(){gx(i,s,u),typeof v!="function"&&(Da===null?Da=new Set([this]):Da.add(this));var T=u.stack;this.componentDidCatch(u.value,{componentStack:T!==null?T:""})})}function k_(a,i,s,u,v){if(s.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(i=s.alternate,i!==null&&_o(i,s,v,!0),s=Qr.current,s!==null){switch(s.tag){case 13:return An===null?um():s.alternate===null&&At===0&&(At=3),s.flags&=-257,s.flags|=65536,s.lanes=v,u===ph?s.flags|=16384:(i=s.updateQueue,i===null?s.updateQueue=new Set([u]):i.add(u),dm(a,u,v)),!1;case 22:return s.flags|=65536,u===ph?s.flags|=16384:(i=s.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([u])},s.updateQueue=i):(s=i.retryQueue,s===null?i.retryQueue=new Set([u]):s.add(u)),dm(a,u,v)),!1}throw Error(n(435,s.tag))}return dm(a,u,v),um(),!1}if(Ve)return i=Qr.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=v,u!==sh&&(a=Error(n(422),{cause:u}),ko(Xr(a,s)))):(u!==sh&&(i=Error(n(423),{cause:u}),ko(Xr(i,s))),a=a.current.alternate,a.flags|=65536,v&=-v,a.lanes|=v,u=Xr(u,s),v=Ih(a.stateNode,u,v),yh(a,v),At!==4&&(At=2)),!1;var y=Error(n(520),{cause:u});if(y=Xr(y,s),Wo===null?Wo=[y]:Wo.push(y),At!==4&&(At=2),i===null)return!0;u=Xr(u,s),s=i;do{switch(s.tag){case 3:return s.flags|=65536,a=v&-v,s.lanes|=a,a=Ih(s.stateNode,u,a),yh(s,a),!1;case 1:if(i=s.type,y=s.stateNode,(s.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Da===null||!Da.has(y))))return s.flags|=65536,v&=-v,s.lanes|=v,v=yx(v),bx(v,a,s,u),yh(s,v),!1}s=s.return}while(s!==null);return!1}var xx=Error(n(461)),Ht=!1;function Qt(a,i,s,u){i.child=a===null?ux(i,null,s,u):jl(i,a.child,s,u)}function wx(a,i,s,u,v){s=s.render;var y=i.ref;if("ref"in u){var A={};for(var T in u)T!=="ref"&&(A[T]=u[T])}else A=u;return yi(i),u=Sh(a,i,s,A,y,v),T=Nh(),a!==null&&!Ht?(Ah(a,i,v),Yn(a,i,v)):(Ve&&T&&lh(i),i.flags|=1,Qt(a,i,u,v),i.child)}function jx(a,i,s,u,v){if(a===null){var y=s.type;return typeof y=="function"&&!nh(y)&&y.defaultProps===void 0&&s.compare===null?(i.tag=15,i.type=y,Sx(a,i,y,u,v)):(a=jc(s.type,null,u,i,i.mode,v),a.ref=i.ref,a.return=i,i.child=a)}if(y=a.child,!Xh(a,v)){var A=y.memoizedProps;if(s=s.compare,s=s!==null?s:Oo,s(A,u)&&a.ref===i.ref)return Yn(a,i,v)}return i.flags|=1,a=Bn(y,u),a.ref=i.ref,a.return=i,i.child=a}function Sx(a,i,s,u,v){if(a!==null){var y=a.memoizedProps;if(Oo(y,u)&&a.ref===i.ref)if(Ht=!1,i.pendingProps=u=y,Xh(a,v))(a.flags&131072)!==0&&(Ht=!0);else return i.lanes=a.lanes,Yn(a,i,v)}return $h(a,i,s,u,v)}function Nx(a,i,s){var u=i.pendingProps,v=u.children,y=a!==null?a.memoizedState:null;if(u.mode==="hidden"){if((i.flags&128)!==0){if(u=y!==null?y.baseLanes|s:s,a!==null){for(v=i.child=a.child,y=0;v!==null;)y=y|v.lanes|v.childLanes,v=v.sibling;i.childLanes=y&~u}else i.childLanes=0,i.child=null;return Ax(a,i,u,s)}if((s&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},a!==null&&Ec(i,y!==null?y.cachePool:null),y!==null?Sb(i,y):xh(),fx(i);else return i.lanes=i.childLanes=536870912,Ax(a,i,y!==null?y.baseLanes|s:s,s)}else y!==null?(Ec(i,y.cachePool),Sb(i,y),Ca(),i.memoizedState=null):(a!==null&&Ec(i,null),xh(),Ca());return Qt(a,i,v,s),i.child}function Ax(a,i,s,u){var v=mh();return v=v===null?null:{parent:Lt._currentValue,pool:v},i.memoizedState={baseLanes:s,cachePool:v},a!==null&&Ec(i,null),xh(),fx(i),a!==null&&_o(a,i,u,!0),null}function Kc(a,i){var s=i.ref;if(s===null)a!==null&&a.ref!==null&&(i.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(n(284));(a===null||a.ref!==s)&&(i.flags|=4194816)}}function $h(a,i,s,u,v){return yi(i),s=Sh(a,i,s,u,void 0,v),u=Nh(),a!==null&&!Ht?(Ah(a,i,v),Yn(a,i,v)):(Ve&&u&&lh(i),i.flags|=1,Qt(a,i,s,v),i.child)}function Ox(a,i,s,u,v,y){return yi(i),i.updateQueue=null,s=Ab(i,u,s,v),Nb(a),u=Nh(),a!==null&&!Ht?(Ah(a,i,y),Yn(a,i,y)):(Ve&&u&&lh(i),i.flags|=1,Qt(a,i,s,y),i.child)}function Ex(a,i,s,u,v){if(yi(i),i.stateNode===null){var y=dl,A=s.contextType;typeof A=="object"&&A!==null&&(y=or(A)),y=new s(u,y),i.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Bh,i.stateNode=y,y._reactInternals=i,y=i.stateNode,y.props=u,y.state=i.memoizedState,y.refs={},vh(i),A=s.contextType,y.context=typeof A=="object"&&A!==null?or(A):dl,y.state=i.memoizedState,A=s.getDerivedStateFromProps,typeof A=="function"&&(Uh(i,s,A,u),y.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(A=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),A!==y.state&&Bh.enqueueReplaceState(y,y.state,null),Uo(i,u,y,v),zo(),y.state=i.memoizedState),typeof y.componentDidMount=="function"&&(i.flags|=4194308),u=!0}else if(a===null){y=i.stateNode;var T=i.memoizedProps,P=wi(s,T);y.props=P;var q=y.context,Q=s.contextType;A=dl,typeof Q=="object"&&Q!==null&&(A=or(Q));var re=s.getDerivedStateFromProps;Q=typeof re=="function"||typeof y.getSnapshotBeforeUpdate=="function",T=i.pendingProps!==T,Q||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(T||q!==A)&&hx(i,y,u,A),Sa=!1;var H=i.memoizedState;y.state=H,Uo(i,u,y,v),zo(),q=i.memoizedState,T||H!==q||Sa?(typeof re=="function"&&(Uh(i,s,re,u),q=i.memoizedState),(P=Sa||dx(i,s,P,u,H,q,A))?(Q||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(i.flags|=4194308)):(typeof y.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=u,i.memoizedState=q),y.props=u,y.state=q,y.context=A,u=P):(typeof y.componentDidMount=="function"&&(i.flags|=4194308),u=!1)}else{y=i.stateNode,gh(a,i),A=i.memoizedProps,Q=wi(s,A),y.props=Q,re=i.pendingProps,H=y.context,q=s.contextType,P=dl,typeof q=="object"&&q!==null&&(P=or(q)),T=s.getDerivedStateFromProps,(q=typeof T=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(A!==re||H!==P)&&hx(i,y,u,P),Sa=!1,H=i.memoizedState,y.state=H,Uo(i,u,y,v),zo();var K=i.memoizedState;A!==re||H!==K||Sa||a!==null&&a.dependencies!==null&&Ac(a.dependencies)?(typeof T=="function"&&(Uh(i,s,T,u),K=i.memoizedState),(Q=Sa||dx(i,s,Q,u,H,K,P)||a!==null&&a.dependencies!==null&&Ac(a.dependencies))?(q||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(u,K,P),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(u,K,P)),typeof y.componentDidUpdate=="function"&&(i.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof y.componentDidUpdate!="function"||A===a.memoizedProps&&H===a.memoizedState||(i.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||A===a.memoizedProps&&H===a.memoizedState||(i.flags|=1024),i.memoizedProps=u,i.memoizedState=K),y.props=u,y.state=K,y.context=P,u=Q):(typeof y.componentDidUpdate!="function"||A===a.memoizedProps&&H===a.memoizedState||(i.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||A===a.memoizedProps&&H===a.memoizedState||(i.flags|=1024),u=!1)}return y=u,Kc(a,i),u=(i.flags&128)!==0,y||u?(y=i.stateNode,s=u&&typeof s.getDerivedStateFromError!="function"?null:y.render(),i.flags|=1,a!==null&&u?(i.child=jl(i,a.child,null,v),i.child=jl(i,null,s,v)):Qt(a,i,s,v),i.memoizedState=y.state,a=i.child):a=Yn(a,i,v),a}function Cx(a,i,s,u){return To(),i.flags|=256,Qt(a,i,s,u),i.child}var qh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hh(a){return{baseLanes:a,cachePool:pb()}}function Kh(a,i,s){return a=a!==null?a.childLanes&~s:0,i&&(a|=Jr),a}function Tx(a,i,s){var u=i.pendingProps,v=!1,y=(i.flags&128)!==0,A;if((A=y)||(A=a!==null&&a.memoizedState===null?!1:(zt.current&2)!==0),A&&(v=!0,i.flags&=-129),A=(i.flags&32)!==0,i.flags&=-33,a===null){if(Ve){if(v?Ea(i):Ca(),Ve){var T=Nt,P;if(P=T){e:{for(P=T,T=Nn;P.nodeType!==8;){if(!T){T=null;break e}if(P=hn(P.nextSibling),P===null){T=null;break e}}T=P}T!==null?(i.memoizedState={dehydrated:T,treeContext:hi!==null?{id:In,overflow:$n}:null,retryLane:536870912,hydrationErrors:null},P=Er(18,null,null,0),P.stateNode=T,P.return=i,i.child=P,fr=i,Nt=null,P=!0):P=!1}P||vi(i)}if(T=i.memoizedState,T!==null&&(T=T.dehydrated,T!==null))return Em(T)?i.lanes=32:i.lanes=536870912,null;Gn(i)}return T=u.children,u=u.fallback,v?(Ca(),v=i.mode,T=Gc({mode:"hidden",children:T},v),u=di(u,v,s,null),T.return=i,u.return=i,T.sibling=u,i.child=T,v=i.child,v.memoizedState=Hh(s),v.childLanes=Kh(a,A,s),i.memoizedState=qh,u):(Ea(i),Gh(i,T))}if(P=a.memoizedState,P!==null&&(T=P.dehydrated,T!==null)){if(y)i.flags&256?(Ea(i),i.flags&=-257,i=Yh(a,i,s)):i.memoizedState!==null?(Ca(),i.child=a.child,i.flags|=128,i=null):(Ca(),v=u.fallback,T=i.mode,u=Gc({mode:"visible",children:u.children},T),v=di(v,T,s,null),v.flags|=2,u.return=i,v.return=i,u.sibling=v,i.child=u,jl(i,a.child,null,s),u=i.child,u.memoizedState=Hh(s),u.childLanes=Kh(a,A,s),i.memoizedState=qh,i=v);else if(Ea(i),Em(T)){if(A=T.nextSibling&&T.nextSibling.dataset,A)var q=A.dgst;A=q,u=Error(n(419)),u.stack="",u.digest=A,ko({value:u,source:null,stack:null}),i=Yh(a,i,s)}else if(Ht||_o(a,i,s,!1),A=(s&a.childLanes)!==0,Ht||A){if(A=ut,A!==null&&(u=s&-s,u=(u&42)!==0?1:Cd(u),u=(u&(A.suspendedLanes|s))!==0?0:u,u!==0&&u!==P.retryLane))throw P.retryLane=u,fl(a,u),Mr(A,a,u),xx;T.data==="$?"||um(),i=Yh(a,i,s)}else T.data==="$?"?(i.flags|=192,i.child=a.child,i=null):(a=P.treeContext,Nt=hn(T.nextSibling),fr=i,Ve=!0,pi=null,Nn=!1,a!==null&&(Zr[Wr++]=In,Zr[Wr++]=$n,Zr[Wr++]=hi,In=a.id,$n=a.overflow,hi=i),i=Gh(i,u.children),i.flags|=4096);return i}return v?(Ca(),v=u.fallback,T=i.mode,P=a.child,q=P.sibling,u=Bn(P,{mode:"hidden",children:u.children}),u.subtreeFlags=P.subtreeFlags&65011712,q!==null?v=Bn(q,v):(v=di(v,T,s,null),v.flags|=2),v.return=i,u.return=i,u.sibling=v,i.child=u,u=v,v=i.child,T=a.child.memoizedState,T===null?T=Hh(s):(P=T.cachePool,P!==null?(q=Lt._currentValue,P=P.parent!==q?{parent:q,pool:q}:P):P=pb(),T={baseLanes:T.baseLanes|s,cachePool:P}),v.memoizedState=T,v.childLanes=Kh(a,A,s),i.memoizedState=qh,u):(Ea(i),s=a.child,a=s.sibling,s=Bn(s,{mode:"visible",children:u.children}),s.return=i,s.sibling=null,a!==null&&(A=i.deletions,A===null?(i.deletions=[a],i.flags|=16):A.push(a)),i.child=s,i.memoizedState=null,s)}function Gh(a,i){return i=Gc({mode:"visible",children:i},a.mode),i.return=a,a.child=i}function Gc(a,i){return a=Er(22,a,null,i),a.lanes=0,a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},a}function Yh(a,i,s){return jl(i,a.child,null,s),a=Gh(i,i.pendingProps.children),a.flags|=2,i.memoizedState=null,a}function kx(a,i,s){a.lanes|=i;var u=a.alternate;u!==null&&(u.lanes|=i),uh(a.return,i,s)}function Vh(a,i,s,u,v){var y=a.memoizedState;y===null?a.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:u,tail:s,tailMode:v}:(y.isBackwards=i,y.rendering=null,y.renderingStartTime=0,y.last=u,y.tail=s,y.tailMode=v)}function _x(a,i,s){var u=i.pendingProps,v=u.revealOrder,y=u.tail;if(Qt(a,i,u.children,s),u=zt.current,(u&2)!==0)u=u&1|2,i.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=i.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&kx(a,s,i);else if(a.tag===19)kx(a,s,i);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}u&=1}switch(le(zt,u),v){case"forwards":for(s=i.child,v=null;s!==null;)a=s.alternate,a!==null&&$c(a)===null&&(v=s),s=s.sibling;s=v,s===null?(v=i.child,i.child=null):(v=s.sibling,s.sibling=null),Vh(i,!1,v,s,y);break;case"backwards":for(s=null,v=i.child,i.child=null;v!==null;){if(a=v.alternate,a!==null&&$c(a)===null){i.child=v;break}a=v.sibling,v.sibling=s,s=v,v=a}Vh(i,!0,s,null,y);break;case"together":Vh(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function Yn(a,i,s){if(a!==null&&(i.dependencies=a.dependencies),Pa|=i.lanes,(s&i.childLanes)===0)if(a!==null){if(_o(a,i,s,!1),(s&i.childLanes)===0)return null}else return null;if(a!==null&&i.child!==a.child)throw Error(n(153));if(i.child!==null){for(a=i.child,s=Bn(a,a.pendingProps),i.child=s,s.return=i;a.sibling!==null;)a=a.sibling,s=s.sibling=Bn(a,a.pendingProps),s.return=i;s.sibling=null}return i.child}function Xh(a,i){return(a.lanes&i)!==0?!0:(a=a.dependencies,!!(a!==null&&Ac(a)))}function __(a,i,s){switch(i.tag){case 3:Ie(i,i.stateNode.containerInfo),ja(i,Lt,a.memoizedState.cache),To();break;case 27:case 5:V(i);break;case 4:Ie(i,i.stateNode.containerInfo);break;case 10:ja(i,i.type,i.memoizedProps.value);break;case 13:var u=i.memoizedState;if(u!==null)return u.dehydrated!==null?(Ea(i),i.flags|=128,null):(s&i.child.childLanes)!==0?Tx(a,i,s):(Ea(i),a=Yn(a,i,s),a!==null?a.sibling:null);Ea(i);break;case 19:var v=(a.flags&128)!==0;if(u=(s&i.childLanes)!==0,u||(_o(a,i,s,!1),u=(s&i.childLanes)!==0),v){if(u)return _x(a,i,s);i.flags|=128}if(v=i.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),le(zt,zt.current),u)break;return null;case 22:case 23:return i.lanes=0,Nx(a,i,s);case 24:ja(i,Lt,a.memoizedState.cache)}return Yn(a,i,s)}function Mx(a,i,s){if(a!==null)if(a.memoizedProps!==i.pendingProps)Ht=!0;else{if(!Xh(a,s)&&(i.flags&128)===0)return Ht=!1,__(a,i,s);Ht=(a.flags&131072)!==0}else Ht=!1,Ve&&(i.flags&1048576)!==0&&sb(i,Nc,i.index);switch(i.lanes=0,i.tag){case 16:e:{a=i.pendingProps;var u=i.elementType,v=u._init;if(u=v(u._payload),i.type=u,typeof u=="function")nh(u)?(a=wi(u,a),i.tag=1,i=Ex(null,i,u,a,s)):(i.tag=0,i=$h(null,i,u,a,s));else{if(u!=null){if(v=u.$$typeof,v===_){i.tag=11,i=wx(null,i,u,a,s);break e}else if(v===D){i.tag=14,i=jx(null,i,u,a,s);break e}}throw i=de(u)||u,Error(n(306,i,""))}}return i;case 0:return $h(a,i,i.type,i.pendingProps,s);case 1:return u=i.type,v=wi(u,i.pendingProps),Ex(a,i,u,v,s);case 3:e:{if(Ie(i,i.stateNode.containerInfo),a===null)throw Error(n(387));u=i.pendingProps;var y=i.memoizedState;v=y.element,gh(a,i),Uo(i,u,null,s);var A=i.memoizedState;if(u=A.cache,ja(i,Lt,u),u!==y.cache&&fh(i,[Lt],s,!0),zo(),u=A.element,y.isDehydrated)if(y={element:u,isDehydrated:!1,cache:A.cache},i.updateQueue.baseState=y,i.memoizedState=y,i.flags&256){i=Cx(a,i,u,s);break e}else if(u!==v){v=Xr(Error(n(424)),i),ko(v),i=Cx(a,i,u,s);break e}else{switch(a=i.stateNode.containerInfo,a.nodeType){case 9:a=a.body;break;default:a=a.nodeName==="HTML"?a.ownerDocument.body:a}for(Nt=hn(a.firstChild),fr=i,Ve=!0,pi=null,Nn=!0,s=ux(i,null,u,s),i.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(To(),u===v){i=Yn(a,i,s);break e}Qt(a,i,u,s)}i=i.child}return i;case 26:return Kc(a,i),a===null?(s=L1(i.type,null,i.pendingProps,null))?i.memoizedState=s:Ve||(s=i.type,a=i.pendingProps,u=iu(he.current).createElement(s),u[lr]=i,u[pr]=a,er(u,s,a),qt(u),i.stateNode=u):i.memoizedState=L1(i.type,a.memoizedProps,i.pendingProps,a.memoizedState),null;case 27:return V(i),a===null&&Ve&&(u=i.stateNode=P1(i.type,i.pendingProps,he.current),fr=i,Nn=!0,v=Nt,za(i.type)?(Cm=v,Nt=hn(u.firstChild)):Nt=v),Qt(a,i,i.pendingProps.children,s),Kc(a,i),a===null&&(i.flags|=4194304),i.child;case 5:return a===null&&Ve&&((v=u=Nt)&&(u=iM(u,i.type,i.pendingProps,Nn),u!==null?(i.stateNode=u,fr=i,Nt=hn(u.firstChild),Nn=!1,v=!0):v=!1),v||vi(i)),V(i),v=i.type,y=i.pendingProps,A=a!==null?a.memoizedProps:null,u=y.children,Nm(v,y)?u=null:A!==null&&Nm(v,A)&&(i.flags|=32),i.memoizedState!==null&&(v=Sh(a,i,S_,null,null,s),ls._currentValue=v),Kc(a,i),Qt(a,i,u,s),i.child;case 6:return a===null&&Ve&&((a=s=Nt)&&(s=lM(s,i.pendingProps,Nn),s!==null?(i.stateNode=s,fr=i,Nt=null,a=!0):a=!1),a||vi(i)),null;case 13:return Tx(a,i,s);case 4:return Ie(i,i.stateNode.containerInfo),u=i.pendingProps,a===null?i.child=jl(i,null,u,s):Qt(a,i,u,s),i.child;case 11:return wx(a,i,i.type,i.pendingProps,s);case 7:return Qt(a,i,i.pendingProps,s),i.child;case 8:return Qt(a,i,i.pendingProps.children,s),i.child;case 12:return Qt(a,i,i.pendingProps.children,s),i.child;case 10:return u=i.pendingProps,ja(i,i.type,u.value),Qt(a,i,u.children,s),i.child;case 9:return v=i.type._context,u=i.pendingProps.children,yi(i),v=or(v),u=u(v),i.flags|=1,Qt(a,i,u,s),i.child;case 14:return jx(a,i,i.type,i.pendingProps,s);case 15:return Sx(a,i,i.type,i.pendingProps,s);case 19:return _x(a,i,s);case 31:return u=i.pendingProps,s=i.mode,u={mode:u.mode,children:u.children},a===null?(s=Gc(u,s),s.ref=i.ref,i.child=s,s.return=i,i=s):(s=Bn(a.child,u),s.ref=i.ref,i.child=s,s.return=i,i=s),i;case 22:return Nx(a,i,s);case 24:return yi(i),u=or(Lt),a===null?(v=mh(),v===null&&(v=ut,y=dh(),v.pooledCache=y,y.refCount++,y!==null&&(v.pooledCacheLanes|=s),v=y),i.memoizedState={parent:u,cache:v},vh(i),ja(i,Lt,v)):((a.lanes&s)!==0&&(gh(a,i),Uo(i,null,null,s),zo()),v=a.memoizedState,y=i.memoizedState,v.parent!==u?(v={parent:u,cache:u},i.memoizedState=v,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=v),ja(i,Lt,u)):(u=y.cache,ja(i,Lt,u),u!==v.cache&&fh(i,[Lt],s,!0))),Qt(a,i,i.pendingProps.children,s),i.child;case 29:throw i.pendingProps}throw Error(n(156,i.tag))}function Vn(a){a.flags|=4}function Px(a,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!$1(i)){if(i=Qr.current,i!==null&&((qe&4194048)===qe?An!==null:(qe&62914560)!==qe&&(qe&536870912)===0||i!==An))throw Ro=ph,vb;a.flags|=8192}}function Yc(a,i){i!==null&&(a.flags|=4),a.flags&16384&&(i=a.tag!==22?oi():536870912,a.lanes|=i,Ol|=i)}function Go(a,i){if(!Ve)switch(a.tailMode){case"hidden":i=a.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?a.tail=null:s.sibling=null;break;case"collapsed":s=a.tail;for(var u=null;s!==null;)s.alternate!==null&&(u=s),s=s.sibling;u===null?i||a.tail===null?a.tail=null:a.tail.sibling=null:u.sibling=null}}function xt(a){var i=a.alternate!==null&&a.alternate.child===a.child,s=0,u=0;if(i)for(var v=a.child;v!==null;)s|=v.lanes|v.childLanes,u|=v.subtreeFlags&65011712,u|=v.flags&65011712,v.return=a,v=v.sibling;else for(v=a.child;v!==null;)s|=v.lanes|v.childLanes,u|=v.subtreeFlags,u|=v.flags,v.return=a,v=v.sibling;return a.subtreeFlags|=u,a.childLanes=s,i}function M_(a,i,s){var u=i.pendingProps;switch(oh(i),i.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xt(i),null;case 1:return xt(i),null;case 3:return s=i.stateNode,u=null,a!==null&&(u=a.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),Hn(Lt),L(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(a===null||a.child===null)&&(Co(i)?Vn(i):a===null||a.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,fb())),xt(i),null;case 26:return s=i.memoizedState,a===null?(Vn(i),s!==null?(xt(i),Px(i,s)):(xt(i),i.flags&=-16777217)):s?s!==a.memoizedState?(Vn(i),xt(i),Px(i,s)):(xt(i),i.flags&=-16777217):(a.memoizedProps!==u&&Vn(i),xt(i),i.flags&=-16777217),null;case 27:ie(i),s=he.current;var v=i.type;if(a!==null&&i.stateNode!=null)a.memoizedProps!==u&&Vn(i);else{if(!u){if(i.stateNode===null)throw Error(n(166));return xt(i),null}a=ue.current,Co(i)?cb(i):(a=P1(v,u,s),i.stateNode=a,Vn(i))}return xt(i),null;case 5:if(ie(i),s=i.type,a!==null&&i.stateNode!=null)a.memoizedProps!==u&&Vn(i);else{if(!u){if(i.stateNode===null)throw Error(n(166));return xt(i),null}if(a=ue.current,Co(i))cb(i);else{switch(v=iu(he.current),a){case 1:a=v.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:a=v.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":a=v.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":a=v.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":a=v.createElement("div"),a.innerHTML=" - + +
diff --git a/dist/worker.bundle.js b/dist/worker.bundle.js deleted file mode 100644 index 393fe9c..0000000 --- a/dist/worker.bundle.js +++ /dev/null @@ -1,14040 +0,0 @@ -// Worker Bundle - Built 2025-11-12T18:52:38Z -// Version: 0.0.0 -// Built with wrangler (nodejs_compat enabled, node: imports resolved) -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -var __esm = (fn, res) => function __init() { - return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; -}; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); - -// node_modules/unenv/dist/runtime/_internal/utils.mjs -// @__NO_SIDE_EFFECTS__ -function createNotImplementedError(name) { - return new Error(`[unenv] ${name} is not implemented yet!`); -} -// @__NO_SIDE_EFFECTS__ -function notImplemented(name) { - const fn = /* @__PURE__ */ __name(() => { - throw /* @__PURE__ */ createNotImplementedError(name); - }, "fn"); - return Object.assign(fn, { __unenv__: true }); -} -// @__NO_SIDE_EFFECTS__ -function notImplementedClass(name) { - return class { - __unenv__ = true; - constructor() { - throw new Error(`[unenv] ${name} is not implemented yet!`); - } - }; -} -var init_utils = __esm({ - "node_modules/unenv/dist/runtime/_internal/utils.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - __name(createNotImplementedError, "createNotImplementedError"); - __name(notImplemented, "notImplemented"); - __name(notImplementedClass, "notImplementedClass"); - } -}); - -// node_modules/unenv/dist/runtime/node/internal/perf_hooks/performance.mjs -var _timeOrigin, _performanceNow, nodeTiming, PerformanceEntry, PerformanceMark, PerformanceMeasure, PerformanceResourceTiming, PerformanceObserverEntryList, Performance, PerformanceObserver, performance; -var init_performance = __esm({ - "node_modules/unenv/dist/runtime/node/internal/perf_hooks/performance.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - init_utils(); - _timeOrigin = globalThis.performance?.timeOrigin ?? Date.now(); - _performanceNow = globalThis.performance?.now ? globalThis.performance.now.bind(globalThis.performance) : () => Date.now() - _timeOrigin; - nodeTiming = { - name: "node", - entryType: "node", - startTime: 0, - duration: 0, - nodeStart: 0, - v8Start: 0, - bootstrapComplete: 0, - environment: 0, - loopStart: 0, - loopExit: 0, - idleTime: 0, - uvMetricsInfo: { - loopCount: 0, - events: 0, - eventsWaiting: 0 - }, - detail: void 0, - toJSON() { - return this; - } - }; - PerformanceEntry = class { - static { - __name(this, "PerformanceEntry"); - } - __unenv__ = true; - detail; - entryType = "event"; - name; - startTime; - constructor(name, options) { - this.name = name; - this.startTime = options?.startTime || _performanceNow(); - this.detail = options?.detail; - } - get duration() { - return _performanceNow() - this.startTime; - } - toJSON() { - return { - name: this.name, - entryType: this.entryType, - startTime: this.startTime, - duration: this.duration, - detail: this.detail - }; - } - }; - PerformanceMark = class PerformanceMark2 extends PerformanceEntry { - static { - __name(this, "PerformanceMark"); - } - entryType = "mark"; - constructor() { - super(...arguments); - } - get duration() { - return 0; - } - }; - PerformanceMeasure = class extends PerformanceEntry { - static { - __name(this, "PerformanceMeasure"); - } - entryType = "measure"; - }; - PerformanceResourceTiming = class extends PerformanceEntry { - static { - __name(this, "PerformanceResourceTiming"); - } - entryType = "resource"; - serverTiming = []; - connectEnd = 0; - connectStart = 0; - decodedBodySize = 0; - domainLookupEnd = 0; - domainLookupStart = 0; - encodedBodySize = 0; - fetchStart = 0; - initiatorType = ""; - name = ""; - nextHopProtocol = ""; - redirectEnd = 0; - redirectStart = 0; - requestStart = 0; - responseEnd = 0; - responseStart = 0; - secureConnectionStart = 0; - startTime = 0; - transferSize = 0; - workerStart = 0; - responseStatus = 0; - }; - PerformanceObserverEntryList = class { - static { - __name(this, "PerformanceObserverEntryList"); - } - __unenv__ = true; - getEntries() { - return []; - } - getEntriesByName(_name, _type) { - return []; - } - getEntriesByType(type) { - return []; - } - }; - Performance = class { - static { - __name(this, "Performance"); - } - __unenv__ = true; - timeOrigin = _timeOrigin; - eventCounts = /* @__PURE__ */ new Map(); - _entries = []; - _resourceTimingBufferSize = 0; - navigation = void 0; - timing = void 0; - timerify(_fn, _options) { - throw createNotImplementedError("Performance.timerify"); - } - get nodeTiming() { - return nodeTiming; - } - eventLoopUtilization() { - return {}; - } - markResourceTiming() { - return new PerformanceResourceTiming(""); - } - onresourcetimingbufferfull = null; - now() { - if (this.timeOrigin === _timeOrigin) { - return _performanceNow(); - } - return Date.now() - this.timeOrigin; - } - clearMarks(markName) { - this._entries = markName ? this._entries.filter((e) => e.name !== markName) : this._entries.filter((e) => e.entryType !== "mark"); - } - clearMeasures(measureName) { - this._entries = measureName ? this._entries.filter((e) => e.name !== measureName) : this._entries.filter((e) => e.entryType !== "measure"); - } - clearResourceTimings() { - this._entries = this._entries.filter((e) => e.entryType !== "resource" || e.entryType !== "navigation"); - } - getEntries() { - return this._entries; - } - getEntriesByName(name, type) { - return this._entries.filter((e) => e.name === name && (!type || e.entryType === type)); - } - getEntriesByType(type) { - return this._entries.filter((e) => e.entryType === type); - } - mark(name, options) { - const entry = new PerformanceMark(name, options); - this._entries.push(entry); - return entry; - } - measure(measureName, startOrMeasureOptions, endMark) { - let start; - let end; - if (typeof startOrMeasureOptions === "string") { - start = this.getEntriesByName(startOrMeasureOptions, "mark")[0]?.startTime; - end = this.getEntriesByName(endMark, "mark")[0]?.startTime; - } else { - start = Number.parseFloat(startOrMeasureOptions?.start) || this.now(); - end = Number.parseFloat(startOrMeasureOptions?.end) || this.now(); - } - const entry = new PerformanceMeasure(measureName, { - startTime: start, - detail: { - start, - end - } - }); - this._entries.push(entry); - return entry; - } - setResourceTimingBufferSize(maxSize) { - this._resourceTimingBufferSize = maxSize; - } - addEventListener(type, listener, options) { - throw createNotImplementedError("Performance.addEventListener"); - } - removeEventListener(type, listener, options) { - throw createNotImplementedError("Performance.removeEventListener"); - } - dispatchEvent(event) { - throw createNotImplementedError("Performance.dispatchEvent"); - } - toJSON() { - return this; - } - }; - PerformanceObserver = class { - static { - __name(this, "PerformanceObserver"); - } - __unenv__ = true; - static supportedEntryTypes = []; - _callback = null; - constructor(callback) { - this._callback = callback; - } - takeRecords() { - return []; - } - disconnect() { - throw createNotImplementedError("PerformanceObserver.disconnect"); - } - observe(options) { - throw createNotImplementedError("PerformanceObserver.observe"); - } - bind(fn) { - return fn; - } - runInAsyncScope(fn, thisArg, ...args) { - return fn.call(thisArg, ...args); - } - asyncId() { - return 0; - } - triggerAsyncId() { - return 0; - } - emitDestroy() { - return this; - } - }; - performance = globalThis.performance && "addEventListener" in globalThis.performance ? globalThis.performance : new Performance(); - } -}); - -// node_modules/unenv/dist/runtime/node/perf_hooks.mjs -var init_perf_hooks = __esm({ - "node_modules/unenv/dist/runtime/node/perf_hooks.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - init_performance(); - } -}); - -// node_modules/@cloudflare/unenv-preset/dist/runtime/polyfill/performance.mjs -var init_performance2 = __esm({ - "node_modules/@cloudflare/unenv-preset/dist/runtime/polyfill/performance.mjs"() { - init_perf_hooks(); - globalThis.performance = performance; - globalThis.Performance = Performance; - globalThis.PerformanceEntry = PerformanceEntry; - globalThis.PerformanceMark = PerformanceMark; - globalThis.PerformanceMeasure = PerformanceMeasure; - globalThis.PerformanceObserver = PerformanceObserver; - globalThis.PerformanceObserverEntryList = PerformanceObserverEntryList; - globalThis.PerformanceResourceTiming = PerformanceResourceTiming; - } -}); - -// node_modules/unenv/dist/runtime/mock/noop.mjs -var noop_default; -var init_noop = __esm({ - "node_modules/unenv/dist/runtime/mock/noop.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - noop_default = Object.assign(() => { - }, { __unenv__: true }); - } -}); - -// node_modules/unenv/dist/runtime/node/console.mjs -// node:stream polyfill - Writable class for unenv console polyfill -var Writable = class { - constructor() {} - write() { return true; } - end() { return this; } - on() { return this; } - once() { return this; } - emit() { return false; } - removeListener() { return this; } -}; -var _console, _ignoreErrors, _stderr, _stdout, log, info, trace, debug, table, error, warn, createTask, clear, count, countReset, dir, dirxml, group, groupEnd, groupCollapsed, profile, profileEnd, time, timeEnd, timeLog, timeStamp, Console, _times, _stdoutErrorHandler, _stderrErrorHandler; -var init_console = __esm({ - "node_modules/unenv/dist/runtime/node/console.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - init_noop(); - init_utils(); - _console = globalThis.console; - _ignoreErrors = true; - _stderr = new Writable(); - _stdout = new Writable(); - log = _console?.log ?? noop_default; - info = _console?.info ?? log; - trace = _console?.trace ?? info; - debug = _console?.debug ?? log; - table = _console?.table ?? log; - error = _console?.error ?? log; - warn = _console?.warn ?? error; - createTask = _console?.createTask ?? /* @__PURE__ */ notImplemented("console.createTask"); - clear = _console?.clear ?? noop_default; - count = _console?.count ?? noop_default; - countReset = _console?.countReset ?? noop_default; - dir = _console?.dir ?? noop_default; - dirxml = _console?.dirxml ?? noop_default; - group = _console?.group ?? noop_default; - groupEnd = _console?.groupEnd ?? noop_default; - groupCollapsed = _console?.groupCollapsed ?? noop_default; - profile = _console?.profile ?? noop_default; - profileEnd = _console?.profileEnd ?? noop_default; - time = _console?.time ?? noop_default; - timeEnd = _console?.timeEnd ?? noop_default; - timeLog = _console?.timeLog ?? noop_default; - timeStamp = _console?.timeStamp ?? noop_default; - Console = _console?.Console ?? /* @__PURE__ */ notImplementedClass("console.Console"); - _times = /* @__PURE__ */ new Map(); - _stdoutErrorHandler = noop_default; - _stderrErrorHandler = noop_default; - } -}); - -// node_modules/@cloudflare/unenv-preset/dist/runtime/node/console.mjs -var workerdConsole, assert, clear2, context, count2, countReset2, createTask2, debug2, dir2, dirxml2, error2, group2, groupCollapsed2, groupEnd2, info2, log2, profile2, profileEnd2, table2, time2, timeEnd2, timeLog2, timeStamp2, trace2, warn2, console_default; -var init_console2 = __esm({ - "node_modules/@cloudflare/unenv-preset/dist/runtime/node/console.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - init_console(); - workerdConsole = globalThis["console"]; - ({ - assert, - clear: clear2, - context: ( - // @ts-expect-error undocumented public API - context - ), - count: count2, - countReset: countReset2, - createTask: ( - // @ts-expect-error undocumented public API - createTask2 - ), - debug: debug2, - dir: dir2, - dirxml: dirxml2, - error: error2, - group: group2, - groupCollapsed: groupCollapsed2, - groupEnd: groupEnd2, - info: info2, - log: log2, - profile: profile2, - profileEnd: profileEnd2, - table: table2, - time: time2, - timeEnd: timeEnd2, - timeLog: timeLog2, - timeStamp: timeStamp2, - trace: trace2, - warn: warn2 - } = workerdConsole); - Object.assign(workerdConsole, { - Console, - _ignoreErrors, - _stderr, - _stderrErrorHandler, - _stdout, - _stdoutErrorHandler, - _times - }); - console_default = workerdConsole; - } -}); - -// node_modules/wrangler/_virtual_unenv_global_polyfill-@cloudflare-unenv-preset-node-console -var init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console = __esm({ - "node_modules/wrangler/_virtual_unenv_global_polyfill-@cloudflare-unenv-preset-node-console"() { - init_console2(); - globalThis.console = console_default; - } -}); - -// node_modules/unenv/dist/runtime/node/internal/process/hrtime.mjs -var hrtime; -var init_hrtime = __esm({ - "node_modules/unenv/dist/runtime/node/internal/process/hrtime.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - hrtime = /* @__PURE__ */ Object.assign(/* @__PURE__ */ __name(function hrtime2(startTime) { - const now = Date.now(); - const seconds = Math.trunc(now / 1e3); - const nanos = now % 1e3 * 1e6; - if (startTime) { - let diffSeconds = seconds - startTime[0]; - let diffNanos = nanos - startTime[0]; - if (diffNanos < 0) { - diffSeconds = diffSeconds - 1; - diffNanos = 1e9 + diffNanos; - } - return [diffSeconds, diffNanos]; - } - return [seconds, nanos]; - }, "hrtime"), { bigint: /* @__PURE__ */ __name(function bigint() { - return BigInt(Date.now() * 1e6); - }, "bigint") }); - } -}); - -// node_modules/unenv/dist/runtime/node/internal/tty/read-stream.mjs -var ReadStream; -var init_read_stream = __esm({ - "node_modules/unenv/dist/runtime/node/internal/tty/read-stream.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - ReadStream = class { - static { - __name(this, "ReadStream"); - } - fd; - isRaw = false; - isTTY = false; - constructor(fd) { - this.fd = fd; - } - setRawMode(mode) { - this.isRaw = mode; - return this; - } - }; - } -}); - -// node_modules/unenv/dist/runtime/node/internal/tty/write-stream.mjs -var WriteStream; -var init_write_stream = __esm({ - "node_modules/unenv/dist/runtime/node/internal/tty/write-stream.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - WriteStream = class { - static { - __name(this, "WriteStream"); - } - fd; - columns = 80; - rows = 24; - isTTY = false; - constructor(fd) { - this.fd = fd; - } - clearLine(dir3, callback) { - callback && callback(); - return false; - } - clearScreenDown(callback) { - callback && callback(); - return false; - } - cursorTo(x, y, callback) { - callback && typeof callback === "function" && callback(); - return false; - } - moveCursor(dx, dy, callback) { - callback && callback(); - return false; - } - getColorDepth(env2) { - return 1; - } - hasColors(count3, env2) { - return false; - } - getWindowSize() { - return [this.columns, this.rows]; - } - write(str, encoding, cb) { - if (str instanceof Uint8Array) { - str = new TextDecoder().decode(str); - } - try { - console.log(str); - } catch { - } - cb && typeof cb === "function" && cb(); - return false; - } - }; - } -}); - -// node_modules/unenv/dist/runtime/node/tty.mjs -var init_tty = __esm({ - "node_modules/unenv/dist/runtime/node/tty.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - init_read_stream(); - init_write_stream(); - } -}); - -// node_modules/unenv/dist/runtime/node/internal/process/node-version.mjs -var NODE_VERSION; -var init_node_version = __esm({ - "node_modules/unenv/dist/runtime/node/internal/process/node-version.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - NODE_VERSION = "22.14.0"; - } -}); - -// node_modules/unenv/dist/runtime/node/internal/process/process.mjs -// node:events polyfill - EventEmitter class for unenv -var EventEmitter = class { - constructor() {} - on() { return this; } - once() { return this; } - emit() { return false; } - removeListener() { return this; } - addListener() { return this; } -}; -var Process; -var init_process = __esm({ - "node_modules/unenv/dist/runtime/node/internal/process/process.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - init_tty(); - init_utils(); - init_node_version(); - Process = class _Process extends EventEmitter { - static { - __name(this, "Process"); - } - env; - hrtime; - nextTick; - constructor(impl) { - super(); - this.env = impl.env; - this.hrtime = impl.hrtime; - this.nextTick = impl.nextTick; - for (const prop of [...Object.getOwnPropertyNames(_Process.prototype), ...Object.getOwnPropertyNames(EventEmitter.prototype)]) { - const value = this[prop]; - if (typeof value === "function") { - this[prop] = value.bind(this); - } - } - } - // --- event emitter --- - emitWarning(warning, type, code) { - console.warn(`${code ? `[${code}] ` : ""}${type ? `${type}: ` : ""}${warning}`); - } - emit(...args) { - return super.emit(...args); - } - listeners(eventName) { - return super.listeners(eventName); - } - // --- stdio (lazy initializers) --- - #stdin; - #stdout; - #stderr; - get stdin() { - return this.#stdin ??= new ReadStream(0); - } - get stdout() { - return this.#stdout ??= new WriteStream(1); - } - get stderr() { - return this.#stderr ??= new WriteStream(2); - } - // --- cwd --- - #cwd = "/"; - chdir(cwd2) { - this.#cwd = cwd2; - } - cwd() { - return this.#cwd; - } - // --- dummy props and getters --- - arch = ""; - platform = ""; - argv = []; - argv0 = ""; - execArgv = []; - execPath = ""; - title = ""; - pid = 200; - ppid = 100; - get version() { - return `v${NODE_VERSION}`; - } - get versions() { - return { node: NODE_VERSION }; - } - get allowedNodeEnvironmentFlags() { - return /* @__PURE__ */ new Set(); - } - get sourceMapsEnabled() { - return false; - } - get debugPort() { - return 0; - } - get throwDeprecation() { - return false; - } - get traceDeprecation() { - return false; - } - get features() { - return {}; - } - get release() { - return {}; - } - get connected() { - return false; - } - get config() { - return {}; - } - get moduleLoadList() { - return []; - } - constrainedMemory() { - return 0; - } - availableMemory() { - return 0; - } - uptime() { - return 0; - } - resourceUsage() { - return {}; - } - // --- noop methods --- - ref() { - } - unref() { - } - // --- unimplemented methods --- - umask() { - throw createNotImplementedError("process.umask"); - } - getBuiltinModule() { - return void 0; - } - getActiveResourcesInfo() { - throw createNotImplementedError("process.getActiveResourcesInfo"); - } - exit() { - throw createNotImplementedError("process.exit"); - } - reallyExit() { - throw createNotImplementedError("process.reallyExit"); - } - kill() { - throw createNotImplementedError("process.kill"); - } - abort() { - throw createNotImplementedError("process.abort"); - } - dlopen() { - throw createNotImplementedError("process.dlopen"); - } - setSourceMapsEnabled() { - throw createNotImplementedError("process.setSourceMapsEnabled"); - } - loadEnvFile() { - throw createNotImplementedError("process.loadEnvFile"); - } - disconnect() { - throw createNotImplementedError("process.disconnect"); - } - cpuUsage() { - throw createNotImplementedError("process.cpuUsage"); - } - setUncaughtExceptionCaptureCallback() { - throw createNotImplementedError("process.setUncaughtExceptionCaptureCallback"); - } - hasUncaughtExceptionCaptureCallback() { - throw createNotImplementedError("process.hasUncaughtExceptionCaptureCallback"); - } - initgroups() { - throw createNotImplementedError("process.initgroups"); - } - openStdin() { - throw createNotImplementedError("process.openStdin"); - } - assert() { - throw createNotImplementedError("process.assert"); - } - binding() { - throw createNotImplementedError("process.binding"); - } - // --- attached interfaces --- - permission = { has: /* @__PURE__ */ notImplemented("process.permission.has") }; - report = { - directory: "", - filename: "", - signal: "SIGUSR2", - compact: false, - reportOnFatalError: false, - reportOnSignal: false, - reportOnUncaughtException: false, - getReport: /* @__PURE__ */ notImplemented("process.report.getReport"), - writeReport: /* @__PURE__ */ notImplemented("process.report.writeReport") - }; - finalization = { - register: /* @__PURE__ */ notImplemented("process.finalization.register"), - unregister: /* @__PURE__ */ notImplemented("process.finalization.unregister"), - registerBeforeExit: /* @__PURE__ */ notImplemented("process.finalization.registerBeforeExit") - }; - memoryUsage = Object.assign(() => ({ - arrayBuffers: 0, - rss: 0, - external: 0, - heapTotal: 0, - heapUsed: 0 - }), { rss: /* @__PURE__ */ __name(() => 0, "rss") }); - // --- undefined props --- - mainModule = void 0; - domain = void 0; - // optional - send = void 0; - exitCode = void 0; - channel = void 0; - getegid = void 0; - geteuid = void 0; - getgid = void 0; - getgroups = void 0; - getuid = void 0; - setegid = void 0; - seteuid = void 0; - setgid = void 0; - setgroups = void 0; - setuid = void 0; - // internals - _events = void 0; - _eventsCount = void 0; - _exiting = void 0; - _maxListeners = void 0; - _debugEnd = void 0; - _debugProcess = void 0; - _fatalException = void 0; - _getActiveHandles = void 0; - _getActiveRequests = void 0; - _kill = void 0; - _preload_modules = void 0; - _rawDebug = void 0; - _startProfilerIdleNotifier = void 0; - _stopProfilerIdleNotifier = void 0; - _tickCallback = void 0; - _disconnect = void 0; - _handleQueue = void 0; - _pendingMessage = void 0; - _channel = void 0; - _send = void 0; - _linkedBinding = void 0; - }; - } -}); - -// node_modules/@cloudflare/unenv-preset/dist/runtime/node/process.mjs -var globalProcess, getBuiltinModule, workerdProcess, isWorkerdProcessV2, unenvProcess, exit, features, platform, env, hrtime3, nextTick, _channel, _disconnect, _events, _eventsCount, _handleQueue, _maxListeners, _pendingMessage, _send, assert2, disconnect, mainModule, _debugEnd, _debugProcess, _exiting, _fatalException, _getActiveHandles, _getActiveRequests, _kill, _linkedBinding, _preload_modules, _rawDebug, _startProfilerIdleNotifier, _stopProfilerIdleNotifier, _tickCallback, abort, addListener, allowedNodeEnvironmentFlags, arch, argv, argv0, availableMemory, binding, channel, chdir, config, connected, constrainedMemory, cpuUsage, cwd, debugPort, dlopen, domain, emit, emitWarning, eventNames, execArgv, execPath, exitCode, finalization, getActiveResourcesInfo, getegid, geteuid, getgid, getgroups, getMaxListeners, getuid, hasUncaughtExceptionCaptureCallback, initgroups, kill, listenerCount, listeners, loadEnvFile, memoryUsage, moduleLoadList, off, on, once, openStdin, permission, pid, ppid, prependListener, prependOnceListener, rawListeners, reallyExit, ref, release, removeAllListeners, removeListener, report, resourceUsage, send, setegid, seteuid, setgid, setgroups, setMaxListeners, setSourceMapsEnabled, setuid, setUncaughtExceptionCaptureCallback, sourceMapsEnabled, stderr, stdin, stdout, throwDeprecation, title, traceDeprecation, umask, unref, uptime, version, versions, _process, process_default; -var init_process2 = __esm({ - "node_modules/@cloudflare/unenv-preset/dist/runtime/node/process.mjs"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - init_hrtime(); - init_process(); - globalProcess = globalThis["process"]; - getBuiltinModule = globalProcess.getBuiltinModule; - workerdProcess = getBuiltinModule("node:process"); - isWorkerdProcessV2 = globalThis.Cloudflare.compatibilityFlags.enable_nodejs_process_v2; - unenvProcess = new Process({ - env: globalProcess.env, - // `hrtime` is only available from workerd process v2 - hrtime: isWorkerdProcessV2 ? workerdProcess.hrtime : hrtime, - // `nextTick` is available from workerd process v1 - nextTick: workerdProcess.nextTick - }); - ({ exit, features, platform } = workerdProcess); - ({ - env: ( - // Always implemented by workerd - env - ), - hrtime: ( - // Only implemented in workerd v2 - hrtime3 - ), - nextTick: ( - // Always implemented by workerd - nextTick - ) - } = unenvProcess); - ({ - _channel, - _disconnect, - _events, - _eventsCount, - _handleQueue, - _maxListeners, - _pendingMessage, - _send, - assert: assert2, - disconnect, - mainModule - } = unenvProcess); - ({ - _debugEnd: ( - // @ts-expect-error `_debugEnd` is missing typings - _debugEnd - ), - _debugProcess: ( - // @ts-expect-error `_debugProcess` is missing typings - _debugProcess - ), - _exiting: ( - // @ts-expect-error `_exiting` is missing typings - _exiting - ), - _fatalException: ( - // @ts-expect-error `_fatalException` is missing typings - _fatalException - ), - _getActiveHandles: ( - // @ts-expect-error `_getActiveHandles` is missing typings - _getActiveHandles - ), - _getActiveRequests: ( - // @ts-expect-error `_getActiveRequests` is missing typings - _getActiveRequests - ), - _kill: ( - // @ts-expect-error `_kill` is missing typings - _kill - ), - _linkedBinding: ( - // @ts-expect-error `_linkedBinding` is missing typings - _linkedBinding - ), - _preload_modules: ( - // @ts-expect-error `_preload_modules` is missing typings - _preload_modules - ), - _rawDebug: ( - // @ts-expect-error `_rawDebug` is missing typings - _rawDebug - ), - _startProfilerIdleNotifier: ( - // @ts-expect-error `_startProfilerIdleNotifier` is missing typings - _startProfilerIdleNotifier - ), - _stopProfilerIdleNotifier: ( - // @ts-expect-error `_stopProfilerIdleNotifier` is missing typings - _stopProfilerIdleNotifier - ), - _tickCallback: ( - // @ts-expect-error `_tickCallback` is missing typings - _tickCallback - ), - abort, - addListener, - allowedNodeEnvironmentFlags, - arch, - argv, - argv0, - availableMemory, - binding: ( - // @ts-expect-error `binding` is missing typings - binding - ), - channel, - chdir, - config, - connected, - constrainedMemory, - cpuUsage, - cwd, - debugPort, - dlopen, - domain: ( - // @ts-expect-error `domain` is missing typings - domain - ), - emit, - emitWarning, - eventNames, - execArgv, - execPath, - exitCode, - finalization, - getActiveResourcesInfo, - getegid, - geteuid, - getgid, - getgroups, - getMaxListeners, - getuid, - hasUncaughtExceptionCaptureCallback, - initgroups: ( - // @ts-expect-error `initgroups` is missing typings - initgroups - ), - kill, - listenerCount, - listeners, - loadEnvFile, - memoryUsage, - moduleLoadList: ( - // @ts-expect-error `moduleLoadList` is missing typings - moduleLoadList - ), - off, - on, - once, - openStdin: ( - // @ts-expect-error `openStdin` is missing typings - openStdin - ), - permission, - pid, - ppid, - prependListener, - prependOnceListener, - rawListeners, - reallyExit: ( - // @ts-expect-error `reallyExit` is missing typings - reallyExit - ), - ref, - release, - removeAllListeners, - removeListener, - report, - resourceUsage, - send, - setegid, - seteuid, - setgid, - setgroups, - setMaxListeners, - setSourceMapsEnabled, - setuid, - setUncaughtExceptionCaptureCallback, - sourceMapsEnabled, - stderr, - stdin, - stdout, - throwDeprecation, - title, - traceDeprecation, - umask, - unref, - uptime, - version, - versions - } = isWorkerdProcessV2 ? workerdProcess : unenvProcess); - _process = { - abort, - addListener, - allowedNodeEnvironmentFlags, - hasUncaughtExceptionCaptureCallback, - setUncaughtExceptionCaptureCallback, - loadEnvFile, - sourceMapsEnabled, - arch, - argv, - argv0, - chdir, - config, - connected, - constrainedMemory, - availableMemory, - cpuUsage, - cwd, - debugPort, - dlopen, - disconnect, - emit, - emitWarning, - env, - eventNames, - execArgv, - execPath, - exit, - finalization, - features, - getBuiltinModule, - getActiveResourcesInfo, - getMaxListeners, - hrtime: hrtime3, - kill, - listeners, - listenerCount, - memoryUsage, - nextTick, - on, - off, - once, - pid, - platform, - ppid, - prependListener, - prependOnceListener, - rawListeners, - release, - removeAllListeners, - removeListener, - report, - resourceUsage, - setMaxListeners, - setSourceMapsEnabled, - stderr, - stdin, - stdout, - title, - throwDeprecation, - traceDeprecation, - umask, - uptime, - version, - versions, - // @ts-expect-error old API - domain, - initgroups, - moduleLoadList, - reallyExit, - openStdin, - assert: assert2, - binding, - send, - exitCode, - channel, - getegid, - geteuid, - getgid, - getgroups, - getuid, - setegid, - seteuid, - setgid, - setgroups, - setuid, - permission, - mainModule, - _events, - _eventsCount, - _exiting, - _maxListeners, - _debugEnd, - _debugProcess, - _fatalException, - _getActiveHandles, - _getActiveRequests, - _kill, - _preload_modules, - _rawDebug, - _startProfilerIdleNotifier, - _stopProfilerIdleNotifier, - _tickCallback, - _disconnect, - _handleQueue, - _pendingMessage, - _channel, - _send, - _linkedBinding - }; - process_default = _process; - } -}); - -// node_modules/wrangler/_virtual_unenv_global_polyfill-@cloudflare-unenv-preset-node-process -var init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process = __esm({ - "node_modules/wrangler/_virtual_unenv_global_polyfill-@cloudflare-unenv-preset-node-process"() { - init_process2(); - globalThis.process = process_default; - } -}); - -// src/config/constants.js -function getCorsOrigins(env2) { - if (env2.CORS_ORIGINS) { - return env2.CORS_ORIGINS.split(",").map((origin) => origin.trim()); - } - if (env2.SITE_URL) { - return [env2.SITE_URL]; - } - return ["*"]; -} -var CORS_ORIGINS, CORS_ALLOWED_METHODS, CORS_ALLOWED_HEADERS, SHIPPING_COUNTRIES, ALLOWED_DRIVE_HOSTS, ADMIN_TOKEN_TTL, ADMIN_TOKEN_TTL_MS, KV_KEYS, THEME_COLOR_KEYS, THEME_RADIUS_MULTIPLIER_MIN, THEME_RADIUS_MULTIPLIER_MAX; -var init_constants = __esm({ - "src/config/constants.js"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - __name(getCorsOrigins, "getCorsOrigins"); - CORS_ORIGINS = ["*"]; - CORS_ALLOWED_METHODS = ["GET", "POST", "PUT", "DELETE", "OPTIONS"]; - CORS_ALLOWED_HEADERS = ["Content-Type", "X-Admin-Token"]; - SHIPPING_COUNTRIES = [ - "US", - "CA", - "GB", - "AU", - "DE", - "FR", - "IT", - "ES", - "NL", - "BE", - "AT", - "CH", - "SE", - "NO", - "DK", - "FI", - "IE", - "PT", - "PL", - "CZ", - "HU", - "GR", - "RO", - "BG", - "HR", - "SI", - "SK", - "EE", - "LV", - "LT", - "LU", - "MT", - "CY" - ]; - ALLOWED_DRIVE_HOSTS = [ - "drive.google.com", - "drive.usercontent.google.com", - "lh3.googleusercontent.com" - ]; - ADMIN_TOKEN_TTL = 86400; - ADMIN_TOKEN_TTL_MS = 864e5; - KV_KEYS = { - PRODUCTS_LIST: "products:all", - COLLECTIONS_LIST: "collections:all", - MEDIA_LIST: "media:all", - STORE_SETTINGS: "store:settings", - DRIVE_TOKEN: "drive:oauth:tokens", - DRIVE_FOLDER_PREFIX: "drive:folder", - ADMIN_TOKEN_PREFIX: "admin_token:" - }; - THEME_COLOR_KEYS = ["primary", "secondary", "accent", "text", "background", "card"]; - THEME_RADIUS_MULTIPLIER_MIN = 0; - THEME_RADIUS_MULTIPLIER_MAX = 4; - } -}); - -// src/config/env.js -function validateEnv(env2) { - const required = ["STRIPE_SECRET_KEY", "SITE_URL"]; - const missing = required.filter((key) => !env2[key]); - return { - valid: missing.length === 0, - missing - }; -} -function getEnv(env2, key, defaultValue = void 0) { - return env2[key] ?? defaultValue; -} -var init_env = __esm({ - "src/config/env.js"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - __name(validateEnv, "validateEnv"); - __name(getEnv, "getEnv"); - } -}); - -// src/config/index.js -var config_exports = {}; -__export(config_exports, { - ADMIN_TOKEN_TTL: () => ADMIN_TOKEN_TTL, - ADMIN_TOKEN_TTL_MS: () => ADMIN_TOKEN_TTL_MS, - ALLOWED_DRIVE_HOSTS: () => ALLOWED_DRIVE_HOSTS, - CORS_ALLOWED_HEADERS: () => CORS_ALLOWED_HEADERS, - CORS_ALLOWED_METHODS: () => CORS_ALLOWED_METHODS, - CORS_ORIGINS: () => CORS_ORIGINS, - KV_KEYS: () => KV_KEYS, - SHIPPING_COUNTRIES: () => SHIPPING_COUNTRIES, - THEME_COLOR_KEYS: () => THEME_COLOR_KEYS, - THEME_RADIUS_MULTIPLIER_MAX: () => THEME_RADIUS_MULTIPLIER_MAX, - THEME_RADIUS_MULTIPLIER_MIN: () => THEME_RADIUS_MULTIPLIER_MIN, - getCorsOrigins: () => getCorsOrigins, - getEnv: () => getEnv, - validateEnv: () => validateEnv -}); -var init_config = __esm({ - "src/config/index.js"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - init_constants(); - init_env(); - } -}); - -// src/utils/kv.js -var kv_exports = {}; -__export(kv_exports, { - getKVNamespace: () => getKVNamespace -}); -function getKVNamespace(env2) { - if (!env2 || typeof env2 !== "object") { - console.error("getKVNamespace: Invalid environment object"); - return null; - } - const possibleBindings = [ - "OPENSHOP-TEST3_KV", - "OPENSHOP_TEST3_KV", - "OPENSHOP_KV" - ]; - for (const bindingName of possibleBindings) { - if (bindingName in env2 && env2[bindingName]) { - const kvNamespace2 = env2[bindingName]; - if (isKVNamespace(kvNamespace2)) { - console.log(`Found KV namespace via direct access: ${bindingName}`); - return kvNamespace2; - } - } - } - const kvBindingName = Object.keys(env2).find( - (key) => (key.endsWith("_KV") || key.endsWith("-KV") || key.includes("KV")) && isKVNamespace(env2[key]) - ); - if (kvBindingName) { - console.log(`Found KV namespace via search: ${kvBindingName}`); - return env2[kvBindingName]; - } - const kvNamespace = Object.values(env2).find( - (binding2) => isKVNamespace(binding2) - ); - if (kvNamespace) { - console.log("Found KV namespace via fallback"); - return kvNamespace; - } - console.error("No KV namespace found! Available bindings:", Object.keys(env2)); - console.error("Environment value types:", Object.values(env2).map((v) => typeof v)); - return null; -} -function isKVNamespace(binding2) { - return binding2 && typeof binding2.get === "function" && typeof binding2.put === "function" && typeof binding2.delete === "function" && typeof binding2.list === "function"; -} -var init_kv = __esm({ - "src/utils/kv.js"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - __name(getKVNamespace, "getKVNamespace"); - __name(isKVNamespace, "isKVNamespace"); - } -}); - -// node_modules/es-errors/type.js -var require_type = __commonJS({ - "node_modules/es-errors/type.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = TypeError; - } -}); - -// (disabled):node_modules/object-inspect/util.inspect -var require_util = __commonJS({ - "(disabled):node_modules/object-inspect/util.inspect"() { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - } -}); - -// node_modules/object-inspect/index.js -var require_object_inspect = __commonJS({ - "node_modules/object-inspect/index.js"(exports, module) { - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var hasMap = typeof Map === "function" && Map.prototype; - var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null; - var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === "function" ? mapSizeDescriptor.get : null; - var mapForEach = hasMap && Map.prototype.forEach; - var hasSet = typeof Set === "function" && Set.prototype; - var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null; - var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === "function" ? setSizeDescriptor.get : null; - var setForEach = hasSet && Set.prototype.forEach; - var hasWeakMap = typeof WeakMap === "function" && WeakMap.prototype; - var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null; - var hasWeakSet = typeof WeakSet === "function" && WeakSet.prototype; - var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null; - var hasWeakRef = typeof WeakRef === "function" && WeakRef.prototype; - var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null; - var booleanValueOf = Boolean.prototype.valueOf; - var objectToString = Object.prototype.toString; - var functionToString = Function.prototype.toString; - var $match = String.prototype.match; - var $slice = String.prototype.slice; - var $replace = String.prototype.replace; - var $toUpperCase = String.prototype.toUpperCase; - var $toLowerCase = String.prototype.toLowerCase; - var $test = RegExp.prototype.test; - var $concat = Array.prototype.concat; - var $join = Array.prototype.join; - var $arrSlice = Array.prototype.slice; - var $floor = Math.floor; - var bigIntValueOf = typeof BigInt === "function" ? BigInt.prototype.valueOf : null; - var gOPS = Object.getOwnPropertySymbols; - var symToString = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? Symbol.prototype.toString : null; - var hasShammedSymbols = typeof Symbol === "function" && typeof Symbol.iterator === "object"; - var toStringTag = typeof Symbol === "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? "object" : "symbol") ? Symbol.toStringTag : null; - var isEnumerable = Object.prototype.propertyIsEnumerable; - var gPO = (typeof Reflect === "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(O) { - return O.__proto__; - } : null); - function addNumericSeparator(num, str) { - if (num === Infinity || num === -Infinity || num !== num || num && num > -1e3 && num < 1e3 || $test.call(/e/, str)) { - return str; - } - var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g; - if (typeof num === "number") { - var int = num < 0 ? -$floor(-num) : $floor(num); - if (int !== num) { - var intStr = String(int); - var dec = $slice.call(str, intStr.length + 1); - return $replace.call(intStr, sepRegex, "$&_") + "." + $replace.call($replace.call(dec, /([0-9]{3})/g, "$&_"), /_$/, ""); - } - } - return $replace.call(str, sepRegex, "$&_"); - } - __name(addNumericSeparator, "addNumericSeparator"); - var utilInspect = require_util(); - var inspectCustom = utilInspect.custom; - var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null; - var quotes = { - __proto__: null, - "double": '"', - single: "'" - }; - var quoteREs = { - __proto__: null, - "double": /(["\\])/g, - single: /(['\\])/g - }; - module.exports = /* @__PURE__ */ __name(function inspect_(obj, options, depth, seen) { - var opts = options || {}; - if (has(opts, "quoteStyle") && !has(quotes, opts.quoteStyle)) { - throw new TypeError('option "quoteStyle" must be "single" or "double"'); - } - if (has(opts, "maxStringLength") && (typeof opts.maxStringLength === "number" ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) { - throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); - } - var customInspect = has(opts, "customInspect") ? opts.customInspect : true; - if (typeof customInspect !== "boolean" && customInspect !== "symbol") { - throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`"); - } - if (has(opts, "indent") && opts.indent !== null && opts.indent !== " " && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) { - throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`'); - } - if (has(opts, "numericSeparator") && typeof opts.numericSeparator !== "boolean") { - throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`'); - } - var numericSeparator = opts.numericSeparator; - if (typeof obj === "undefined") { - return "undefined"; - } - if (obj === null) { - return "null"; - } - if (typeof obj === "boolean") { - return obj ? "true" : "false"; - } - if (typeof obj === "string") { - return inspectString(obj, opts); - } - if (typeof obj === "number") { - if (obj === 0) { - return Infinity / obj > 0 ? "0" : "-0"; - } - var str = String(obj); - return numericSeparator ? addNumericSeparator(obj, str) : str; - } - if (typeof obj === "bigint") { - var bigIntStr = String(obj) + "n"; - return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr; - } - var maxDepth = typeof opts.depth === "undefined" ? 5 : opts.depth; - if (typeof depth === "undefined") { - depth = 0; - } - if (depth >= maxDepth && maxDepth > 0 && typeof obj === "object") { - return isArray(obj) ? "[Array]" : "[Object]"; - } - var indent = getIndent(opts, depth); - if (typeof seen === "undefined") { - seen = []; - } else if (indexOf(seen, obj) >= 0) { - return "[Circular]"; - } - function inspect(value, from, noIndent) { - if (from) { - seen = $arrSlice.call(seen); - seen.push(from); - } - if (noIndent) { - var newOpts = { - depth: opts.depth - }; - if (has(opts, "quoteStyle")) { - newOpts.quoteStyle = opts.quoteStyle; - } - return inspect_(value, newOpts, depth + 1, seen); - } - return inspect_(value, opts, depth + 1, seen); - } - __name(inspect, "inspect"); - if (typeof obj === "function" && !isRegExp(obj)) { - var name = nameOf(obj); - var keys = arrObjKeys(obj, inspect); - return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys.length > 0 ? " { " + $join.call(keys, ", ") + " }" : ""); - } - if (isSymbol(obj)) { - var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, "$1") : symToString.call(obj); - return typeof obj === "object" && !hasShammedSymbols ? markBoxed(symString) : symString; - } - if (isElement(obj)) { - var s = "<" + $toLowerCase.call(String(obj.nodeName)); - var attrs = obj.attributes || []; - for (var i = 0; i < attrs.length; i++) { - s += " " + attrs[i].name + "=" + wrapQuotes(quote(attrs[i].value), "double", opts); - } - s += ">"; - if (obj.childNodes && obj.childNodes.length) { - s += "..."; - } - s += ""; - return s; - } - if (isArray(obj)) { - if (obj.length === 0) { - return "[]"; - } - var xs = arrObjKeys(obj, inspect); - if (indent && !singleLineValues(xs)) { - return "[" + indentedJoin(xs, indent) + "]"; - } - return "[ " + $join.call(xs, ", ") + " ]"; - } - if (isError(obj)) { - var parts = arrObjKeys(obj, inspect); - if (!("cause" in Error.prototype) && "cause" in obj && !isEnumerable.call(obj, "cause")) { - return "{ [" + String(obj) + "] " + $join.call($concat.call("[cause]: " + inspect(obj.cause), parts), ", ") + " }"; - } - if (parts.length === 0) { - return "[" + String(obj) + "]"; - } - return "{ [" + String(obj) + "] " + $join.call(parts, ", ") + " }"; - } - if (typeof obj === "object" && customInspect) { - if (inspectSymbol && typeof obj[inspectSymbol] === "function" && utilInspect) { - return utilInspect(obj, { depth: maxDepth - depth }); - } else if (customInspect !== "symbol" && typeof obj.inspect === "function") { - return obj.inspect(); - } - } - if (isMap(obj)) { - var mapParts = []; - if (mapForEach) { - mapForEach.call(obj, function(value, key) { - mapParts.push(inspect(key, obj, true) + " => " + inspect(value, obj)); - }); - } - return collectionOf("Map", mapSize.call(obj), mapParts, indent); - } - if (isSet(obj)) { - var setParts = []; - if (setForEach) { - setForEach.call(obj, function(value) { - setParts.push(inspect(value, obj)); - }); - } - return collectionOf("Set", setSize.call(obj), setParts, indent); - } - if (isWeakMap(obj)) { - return weakCollectionOf("WeakMap"); - } - if (isWeakSet(obj)) { - return weakCollectionOf("WeakSet"); - } - if (isWeakRef(obj)) { - return weakCollectionOf("WeakRef"); - } - if (isNumber(obj)) { - return markBoxed(inspect(Number(obj))); - } - if (isBigInt(obj)) { - return markBoxed(inspect(bigIntValueOf.call(obj))); - } - if (isBoolean(obj)) { - return markBoxed(booleanValueOf.call(obj)); - } - if (isString(obj)) { - return markBoxed(inspect(String(obj))); - } - if (typeof window !== "undefined" && obj === window) { - return "{ [object Window] }"; - } - if (typeof globalThis !== "undefined" && obj === globalThis || typeof global !== "undefined" && obj === global) { - return "{ [object globalThis] }"; - } - if (!isDate(obj) && !isRegExp(obj)) { - var ys = arrObjKeys(obj, inspect); - var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object; - var protoTag = obj instanceof Object ? "" : "null prototype"; - var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : ""; - var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : ""; - var tag = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat.call([], stringTag || [], protoTag || []), ": ") + "] " : ""); - if (ys.length === 0) { - return tag + "{}"; - } - if (indent) { - return tag + "{" + indentedJoin(ys, indent) + "}"; - } - return tag + "{ " + $join.call(ys, ", ") + " }"; - } - return String(obj); - }, "inspect_"); - function wrapQuotes(s, defaultStyle, opts) { - var style = opts.quoteStyle || defaultStyle; - var quoteChar = quotes[style]; - return quoteChar + s + quoteChar; - } - __name(wrapQuotes, "wrapQuotes"); - function quote(s) { - return $replace.call(String(s), /"/g, """); - } - __name(quote, "quote"); - function canTrustToString(obj) { - return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined")); - } - __name(canTrustToString, "canTrustToString"); - function isArray(obj) { - return toStr(obj) === "[object Array]" && canTrustToString(obj); - } - __name(isArray, "isArray"); - function isDate(obj) { - return toStr(obj) === "[object Date]" && canTrustToString(obj); - } - __name(isDate, "isDate"); - function isRegExp(obj) { - return toStr(obj) === "[object RegExp]" && canTrustToString(obj); - } - __name(isRegExp, "isRegExp"); - function isError(obj) { - return toStr(obj) === "[object Error]" && canTrustToString(obj); - } - __name(isError, "isError"); - function isString(obj) { - return toStr(obj) === "[object String]" && canTrustToString(obj); - } - __name(isString, "isString"); - function isNumber(obj) { - return toStr(obj) === "[object Number]" && canTrustToString(obj); - } - __name(isNumber, "isNumber"); - function isBoolean(obj) { - return toStr(obj) === "[object Boolean]" && canTrustToString(obj); - } - __name(isBoolean, "isBoolean"); - function isSymbol(obj) { - if (hasShammedSymbols) { - return obj && typeof obj === "object" && obj instanceof Symbol; - } - if (typeof obj === "symbol") { - return true; - } - if (!obj || typeof obj !== "object" || !symToString) { - return false; - } - try { - symToString.call(obj); - return true; - } catch (e) { - } - return false; - } - __name(isSymbol, "isSymbol"); - function isBigInt(obj) { - if (!obj || typeof obj !== "object" || !bigIntValueOf) { - return false; - } - try { - bigIntValueOf.call(obj); - return true; - } catch (e) { - } - return false; - } - __name(isBigInt, "isBigInt"); - var hasOwn = Object.prototype.hasOwnProperty || function(key) { - return key in this; - }; - function has(obj, key) { - return hasOwn.call(obj, key); - } - __name(has, "has"); - function toStr(obj) { - return objectToString.call(obj); - } - __name(toStr, "toStr"); - function nameOf(f) { - if (f.name) { - return f.name; - } - var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/); - if (m) { - return m[1]; - } - return null; - } - __name(nameOf, "nameOf"); - function indexOf(xs, x) { - if (xs.indexOf) { - return xs.indexOf(x); - } - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) { - return i; - } - } - return -1; - } - __name(indexOf, "indexOf"); - function isMap(x) { - if (!mapSize || !x || typeof x !== "object") { - return false; - } - try { - mapSize.call(x); - try { - setSize.call(x); - } catch (s) { - return true; - } - return x instanceof Map; - } catch (e) { - } - return false; - } - __name(isMap, "isMap"); - function isWeakMap(x) { - if (!weakMapHas || !x || typeof x !== "object") { - return false; - } - try { - weakMapHas.call(x, weakMapHas); - try { - weakSetHas.call(x, weakSetHas); - } catch (s) { - return true; - } - return x instanceof WeakMap; - } catch (e) { - } - return false; - } - __name(isWeakMap, "isWeakMap"); - function isWeakRef(x) { - if (!weakRefDeref || !x || typeof x !== "object") { - return false; - } - try { - weakRefDeref.call(x); - return true; - } catch (e) { - } - return false; - } - __name(isWeakRef, "isWeakRef"); - function isSet(x) { - if (!setSize || !x || typeof x !== "object") { - return false; - } - try { - setSize.call(x); - try { - mapSize.call(x); - } catch (m) { - return true; - } - return x instanceof Set; - } catch (e) { - } - return false; - } - __name(isSet, "isSet"); - function isWeakSet(x) { - if (!weakSetHas || !x || typeof x !== "object") { - return false; - } - try { - weakSetHas.call(x, weakSetHas); - try { - weakMapHas.call(x, weakMapHas); - } catch (s) { - return true; - } - return x instanceof WeakSet; - } catch (e) { - } - return false; - } - __name(isWeakSet, "isWeakSet"); - function isElement(x) { - if (!x || typeof x !== "object") { - return false; - } - if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) { - return true; - } - return typeof x.nodeName === "string" && typeof x.getAttribute === "function"; - } - __name(isElement, "isElement"); - function inspectString(str, opts) { - if (str.length > opts.maxStringLength) { - var remaining = str.length - opts.maxStringLength; - var trailer = "... " + remaining + " more character" + (remaining > 1 ? "s" : ""); - return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer; - } - var quoteRE = quoteREs[opts.quoteStyle || "single"]; - quoteRE.lastIndex = 0; - var s = $replace.call($replace.call(str, quoteRE, "\\$1"), /[\x00-\x1f]/g, lowbyte); - return wrapQuotes(s, "single", opts); - } - __name(inspectString, "inspectString"); - function lowbyte(c) { - var n = c.charCodeAt(0); - var x = { - 8: "b", - 9: "t", - 10: "n", - 12: "f", - 13: "r" - }[n]; - if (x) { - return "\\" + x; - } - return "\\x" + (n < 16 ? "0" : "") + $toUpperCase.call(n.toString(16)); - } - __name(lowbyte, "lowbyte"); - function markBoxed(str) { - return "Object(" + str + ")"; - } - __name(markBoxed, "markBoxed"); - function weakCollectionOf(type) { - return type + " { ? }"; - } - __name(weakCollectionOf, "weakCollectionOf"); - function collectionOf(type, size, entries, indent) { - var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ", "); - return type + " (" + size + ") {" + joinedEntries + "}"; - } - __name(collectionOf, "collectionOf"); - function singleLineValues(xs) { - for (var i = 0; i < xs.length; i++) { - if (indexOf(xs[i], "\n") >= 0) { - return false; - } - } - return true; - } - __name(singleLineValues, "singleLineValues"); - function getIndent(opts, depth) { - var baseIndent; - if (opts.indent === " ") { - baseIndent = " "; - } else if (typeof opts.indent === "number" && opts.indent > 0) { - baseIndent = $join.call(Array(opts.indent + 1), " "); - } else { - return null; - } - return { - base: baseIndent, - prev: $join.call(Array(depth + 1), baseIndent) - }; - } - __name(getIndent, "getIndent"); - function indentedJoin(xs, indent) { - if (xs.length === 0) { - return ""; - } - var lineJoiner = "\n" + indent.prev + indent.base; - return lineJoiner + $join.call(xs, "," + lineJoiner) + "\n" + indent.prev; - } - __name(indentedJoin, "indentedJoin"); - function arrObjKeys(obj, inspect) { - var isArr = isArray(obj); - var xs = []; - if (isArr) { - xs.length = obj.length; - for (var i = 0; i < obj.length; i++) { - xs[i] = has(obj, i) ? inspect(obj[i], obj) : ""; - } - } - var syms = typeof gOPS === "function" ? gOPS(obj) : []; - var symMap; - if (hasShammedSymbols) { - symMap = {}; - for (var k = 0; k < syms.length; k++) { - symMap["$" + syms[k]] = syms[k]; - } - } - for (var key in obj) { - if (!has(obj, key)) { - continue; - } - if (isArr && String(Number(key)) === key && key < obj.length) { - continue; - } - if (hasShammedSymbols && symMap["$" + key] instanceof Symbol) { - continue; - } else if ($test.call(/[^\w$]/, key)) { - xs.push(inspect(key, obj) + ": " + inspect(obj[key], obj)); - } else { - xs.push(key + ": " + inspect(obj[key], obj)); - } - } - if (typeof gOPS === "function") { - for (var j = 0; j < syms.length; j++) { - if (isEnumerable.call(obj, syms[j])) { - xs.push("[" + inspect(syms[j]) + "]: " + inspect(obj[syms[j]], obj)); - } - } - } - return xs; - } - __name(arrObjKeys, "arrObjKeys"); - } -}); - -// node_modules/side-channel-list/index.js -var require_side_channel_list = __commonJS({ - "node_modules/side-channel-list/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var inspect = require_object_inspect(); - var $TypeError = require_type(); - var listGetNode = /* @__PURE__ */ __name(function(list, key, isDelete) { - var prev = list; - var curr; - for (; (curr = prev.next) != null; prev = curr) { - if (curr.key === key) { - prev.next = curr.next; - if (!isDelete) { - curr.next = /** @type {NonNullable} */ - list.next; - list.next = curr; - } - return curr; - } - } - }, "listGetNode"); - var listGet = /* @__PURE__ */ __name(function(objects, key) { - if (!objects) { - return void 0; - } - var node = listGetNode(objects, key); - return node && node.value; - }, "listGet"); - var listSet = /* @__PURE__ */ __name(function(objects, key, value) { - var node = listGetNode(objects, key); - if (node) { - node.value = value; - } else { - objects.next = /** @type {import('./list.d.ts').ListNode} */ - { - // eslint-disable-line no-param-reassign, no-extra-parens - key, - next: objects.next, - value - }; - } - }, "listSet"); - var listHas = /* @__PURE__ */ __name(function(objects, key) { - if (!objects) { - return false; - } - return !!listGetNode(objects, key); - }, "listHas"); - var listDelete = /* @__PURE__ */ __name(function(objects, key) { - if (objects) { - return listGetNode(objects, key, true); - } - }, "listDelete"); - module.exports = /* @__PURE__ */ __name(function getSideChannelList() { - var $o; - var channel2 = { - assert: /* @__PURE__ */ __name(function(key) { - if (!channel2.has(key)) { - throw new $TypeError("Side channel does not contain " + inspect(key)); - } - }, "assert"), - "delete": /* @__PURE__ */ __name(function(key) { - var root = $o && $o.next; - var deletedNode = listDelete($o, key); - if (deletedNode && root && root === deletedNode) { - $o = void 0; - } - return !!deletedNode; - }, "delete"), - get: /* @__PURE__ */ __name(function(key) { - return listGet($o, key); - }, "get"), - has: /* @__PURE__ */ __name(function(key) { - return listHas($o, key); - }, "has"), - set: /* @__PURE__ */ __name(function(key, value) { - if (!$o) { - $o = { - next: void 0 - }; - } - listSet( - /** @type {NonNullable} */ - $o, - key, - value - ); - }, "set") - }; - return channel2; - }, "getSideChannelList"); - } -}); - -// node_modules/es-object-atoms/index.js -var require_es_object_atoms = __commonJS({ - "node_modules/es-object-atoms/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Object; - } -}); - -// node_modules/es-errors/index.js -var require_es_errors = __commonJS({ - "node_modules/es-errors/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Error; - } -}); - -// node_modules/es-errors/eval.js -var require_eval = __commonJS({ - "node_modules/es-errors/eval.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = EvalError; - } -}); - -// node_modules/es-errors/range.js -var require_range = __commonJS({ - "node_modules/es-errors/range.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = RangeError; - } -}); - -// node_modules/es-errors/ref.js -var require_ref = __commonJS({ - "node_modules/es-errors/ref.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = ReferenceError; - } -}); - -// node_modules/es-errors/syntax.js -var require_syntax = __commonJS({ - "node_modules/es-errors/syntax.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = SyntaxError; - } -}); - -// node_modules/es-errors/uri.js -var require_uri = __commonJS({ - "node_modules/es-errors/uri.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = URIError; - } -}); - -// node_modules/math-intrinsics/abs.js -var require_abs = __commonJS({ - "node_modules/math-intrinsics/abs.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Math.abs; - } -}); - -// node_modules/math-intrinsics/floor.js -var require_floor = __commonJS({ - "node_modules/math-intrinsics/floor.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Math.floor; - } -}); - -// node_modules/math-intrinsics/max.js -var require_max = __commonJS({ - "node_modules/math-intrinsics/max.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Math.max; - } -}); - -// node_modules/math-intrinsics/min.js -var require_min = __commonJS({ - "node_modules/math-intrinsics/min.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Math.min; - } -}); - -// node_modules/math-intrinsics/pow.js -var require_pow = __commonJS({ - "node_modules/math-intrinsics/pow.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Math.pow; - } -}); - -// node_modules/math-intrinsics/round.js -var require_round = __commonJS({ - "node_modules/math-intrinsics/round.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Math.round; - } -}); - -// node_modules/math-intrinsics/isNaN.js -var require_isNaN = __commonJS({ - "node_modules/math-intrinsics/isNaN.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Number.isNaN || /* @__PURE__ */ __name(function isNaN2(a) { - return a !== a; - }, "isNaN"); - } -}); - -// node_modules/math-intrinsics/sign.js -var require_sign = __commonJS({ - "node_modules/math-intrinsics/sign.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var $isNaN = require_isNaN(); - module.exports = /* @__PURE__ */ __name(function sign(number) { - if ($isNaN(number) || number === 0) { - return number; - } - return number < 0 ? -1 : 1; - }, "sign"); - } -}); - -// node_modules/gopd/gOPD.js -var require_gOPD = __commonJS({ - "node_modules/gopd/gOPD.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Object.getOwnPropertyDescriptor; - } -}); - -// node_modules/gopd/index.js -var require_gopd = __commonJS({ - "node_modules/gopd/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var $gOPD = require_gOPD(); - if ($gOPD) { - try { - $gOPD([], "length"); - } catch (e) { - $gOPD = null; - } - } - module.exports = $gOPD; - } -}); - -// node_modules/es-define-property/index.js -var require_es_define_property = __commonJS({ - "node_modules/es-define-property/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var $defineProperty = Object.defineProperty || false; - if ($defineProperty) { - try { - $defineProperty({}, "a", { value: 1 }); - } catch (e) { - $defineProperty = false; - } - } - module.exports = $defineProperty; - } -}); - -// node_modules/has-symbols/shams.js -var require_shams = __commonJS({ - "node_modules/has-symbols/shams.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = /* @__PURE__ */ __name(function hasSymbols() { - if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") { - return false; - } - if (typeof Symbol.iterator === "symbol") { - return true; - } - var obj = {}; - var sym = Symbol("test"); - var symObj = Object(sym); - if (typeof sym === "string") { - return false; - } - if (Object.prototype.toString.call(sym) !== "[object Symbol]") { - return false; - } - if (Object.prototype.toString.call(symObj) !== "[object Symbol]") { - return false; - } - var symVal = 42; - obj[sym] = symVal; - for (var _ in obj) { - return false; - } - if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) { - return false; - } - if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) { - return false; - } - var syms = Object.getOwnPropertySymbols(obj); - if (syms.length !== 1 || syms[0] !== sym) { - return false; - } - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { - return false; - } - if (typeof Object.getOwnPropertyDescriptor === "function") { - var descriptor = ( - /** @type {PropertyDescriptor} */ - Object.getOwnPropertyDescriptor(obj, sym) - ); - if (descriptor.value !== symVal || descriptor.enumerable !== true) { - return false; - } - } - return true; - }, "hasSymbols"); - } -}); - -// node_modules/has-symbols/index.js -var require_has_symbols = __commonJS({ - "node_modules/has-symbols/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var origSymbol = typeof Symbol !== "undefined" && Symbol; - var hasSymbolSham = require_shams(); - module.exports = /* @__PURE__ */ __name(function hasNativeSymbols() { - if (typeof origSymbol !== "function") { - return false; - } - if (typeof Symbol !== "function") { - return false; - } - if (typeof origSymbol("foo") !== "symbol") { - return false; - } - if (typeof Symbol("bar") !== "symbol") { - return false; - } - return hasSymbolSham(); - }, "hasNativeSymbols"); - } -}); - -// node_modules/get-proto/Reflect.getPrototypeOf.js -var require_Reflect_getPrototypeOf = __commonJS({ - "node_modules/get-proto/Reflect.getPrototypeOf.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null; - } -}); - -// node_modules/get-proto/Object.getPrototypeOf.js -var require_Object_getPrototypeOf = __commonJS({ - "node_modules/get-proto/Object.getPrototypeOf.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var $Object = require_es_object_atoms(); - module.exports = $Object.getPrototypeOf || null; - } -}); - -// node_modules/function-bind/implementation.js -var require_implementation = __commonJS({ - "node_modules/function-bind/implementation.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; - var toStr = Object.prototype.toString; - var max = Math.max; - var funcType = "[object Function]"; - var concatty = /* @__PURE__ */ __name(function concatty2(a, b) { - var arr = []; - for (var i = 0; i < a.length; i += 1) { - arr[i] = a[i]; - } - for (var j = 0; j < b.length; j += 1) { - arr[j + a.length] = b[j]; - } - return arr; - }, "concatty"); - var slicy = /* @__PURE__ */ __name(function slicy2(arrLike, offset) { - var arr = []; - for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { - arr[j] = arrLike[i]; - } - return arr; - }, "slicy"); - var joiny = /* @__PURE__ */ __name(function(arr, joiner) { - var str = ""; - for (var i = 0; i < arr.length; i += 1) { - str += arr[i]; - if (i + 1 < arr.length) { - str += joiner; - } - } - return str; - }, "joiny"); - module.exports = /* @__PURE__ */ __name(function bind(that) { - var target = this; - if (typeof target !== "function" || toStr.apply(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slicy(arguments, 1); - var bound; - var binder = /* @__PURE__ */ __name(function() { - if (this instanceof bound) { - var result = target.apply( - this, - concatty(args, arguments) - ); - if (Object(result) === result) { - return result; - } - return this; - } - return target.apply( - that, - concatty(args, arguments) - ); - }, "binder"); - var boundLength = max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs[i] = "$" + i; - } - bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder); - if (target.prototype) { - var Empty = /* @__PURE__ */ __name(function Empty2() { - }, "Empty"); - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }, "bind"); - } -}); - -// node_modules/function-bind/index.js -var require_function_bind = __commonJS({ - "node_modules/function-bind/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var implementation = require_implementation(); - module.exports = Function.prototype.bind || implementation; - } -}); - -// node_modules/call-bind-apply-helpers/functionCall.js -var require_functionCall = __commonJS({ - "node_modules/call-bind-apply-helpers/functionCall.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Function.prototype.call; - } -}); - -// node_modules/call-bind-apply-helpers/functionApply.js -var require_functionApply = __commonJS({ - "node_modules/call-bind-apply-helpers/functionApply.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = Function.prototype.apply; - } -}); - -// node_modules/call-bind-apply-helpers/reflectApply.js -var require_reflectApply = __commonJS({ - "node_modules/call-bind-apply-helpers/reflectApply.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - module.exports = typeof Reflect !== "undefined" && Reflect && Reflect.apply; - } -}); - -// node_modules/call-bind-apply-helpers/actualApply.js -var require_actualApply = __commonJS({ - "node_modules/call-bind-apply-helpers/actualApply.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var bind = require_function_bind(); - var $apply = require_functionApply(); - var $call = require_functionCall(); - var $reflectApply = require_reflectApply(); - module.exports = $reflectApply || bind.call($call, $apply); - } -}); - -// node_modules/call-bind-apply-helpers/index.js -var require_call_bind_apply_helpers = __commonJS({ - "node_modules/call-bind-apply-helpers/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var bind = require_function_bind(); - var $TypeError = require_type(); - var $call = require_functionCall(); - var $actualApply = require_actualApply(); - module.exports = /* @__PURE__ */ __name(function callBindBasic(args) { - if (args.length < 1 || typeof args[0] !== "function") { - throw new $TypeError("a function is required"); - } - return $actualApply(bind, $call, args); - }, "callBindBasic"); - } -}); - -// node_modules/dunder-proto/get.js -var require_get = __commonJS({ - "node_modules/dunder-proto/get.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var callBind = require_call_bind_apply_helpers(); - var gOPD = require_gopd(); - var hasProtoAccessor; - try { - hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ - [].__proto__ === Array.prototype; - } catch (e) { - if (!e || typeof e !== "object" || !("code" in e) || e.code !== "ERR_PROTO_ACCESS") { - throw e; - } - } - var desc = !!hasProtoAccessor && gOPD && gOPD( - Object.prototype, - /** @type {keyof typeof Object.prototype} */ - "__proto__" - ); - var $Object = Object; - var $getPrototypeOf = $Object.getPrototypeOf; - module.exports = desc && typeof desc.get === "function" ? callBind([desc.get]) : typeof $getPrototypeOf === "function" ? ( - /** @type {import('./get')} */ - /* @__PURE__ */ __name(function getDunder(value) { - return $getPrototypeOf(value == null ? value : $Object(value)); - }, "getDunder") - ) : false; - } -}); - -// node_modules/get-proto/index.js -var require_get_proto = __commonJS({ - "node_modules/get-proto/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var reflectGetProto = require_Reflect_getPrototypeOf(); - var originalGetProto = require_Object_getPrototypeOf(); - var getDunderProto = require_get(); - module.exports = reflectGetProto ? /* @__PURE__ */ __name(function getProto(O) { - return reflectGetProto(O); - }, "getProto") : originalGetProto ? /* @__PURE__ */ __name(function getProto(O) { - if (!O || typeof O !== "object" && typeof O !== "function") { - throw new TypeError("getProto: not an object"); - } - return originalGetProto(O); - }, "getProto") : getDunderProto ? /* @__PURE__ */ __name(function getProto(O) { - return getDunderProto(O); - }, "getProto") : null; - } -}); - -// node_modules/hasown/index.js -var require_hasown = __commonJS({ - "node_modules/hasown/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var call = Function.prototype.call; - var $hasOwn = Object.prototype.hasOwnProperty; - var bind = require_function_bind(); - module.exports = bind.call(call, $hasOwn); - } -}); - -// node_modules/get-intrinsic/index.js -var require_get_intrinsic = __commonJS({ - "node_modules/get-intrinsic/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var undefined2; - var $Object = require_es_object_atoms(); - var $Error = require_es_errors(); - var $EvalError = require_eval(); - var $RangeError = require_range(); - var $ReferenceError = require_ref(); - var $SyntaxError = require_syntax(); - var $TypeError = require_type(); - var $URIError = require_uri(); - var abs = require_abs(); - var floor = require_floor(); - var max = require_max(); - var min = require_min(); - var pow = require_pow(); - var round = require_round(); - var sign = require_sign(); - var $Function = Function; - var getEvalledConstructor = /* @__PURE__ */ __name(function(expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")(); - } catch (e) { - } - }, "getEvalledConstructor"); - var $gOPD = require_gopd(); - var $defineProperty = require_es_define_property(); - var throwTypeError = /* @__PURE__ */ __name(function() { - throw new $TypeError(); - }, "throwTypeError"); - var ThrowTypeError = $gOPD ? function() { - try { - arguments.callee; - return throwTypeError; - } catch (calleeThrows) { - try { - return $gOPD(arguments, "callee").get; - } catch (gOPDthrows) { - return throwTypeError; - } - } - }() : throwTypeError; - var hasSymbols = require_has_symbols()(); - var getProto = require_get_proto(); - var $ObjectGPO = require_Object_getPrototypeOf(); - var $ReflectGPO = require_Reflect_getPrototypeOf(); - var $apply = require_functionApply(); - var $call = require_functionCall(); - var needsEval = {}; - var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined2 : getProto(Uint8Array); - var INTRINSICS = { - __proto__: null, - "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError, - "%Array%": Array, - "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer, - "%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined2, - "%AsyncFromSyncIteratorPrototype%": undefined2, - "%AsyncFunction%": needsEval, - "%AsyncGenerator%": needsEval, - "%AsyncGeneratorFunction%": needsEval, - "%AsyncIteratorPrototype%": needsEval, - "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics, - "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt, - "%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined2 : BigInt64Array, - "%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined2 : BigUint64Array, - "%Boolean%": Boolean, - "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView, - "%Date%": Date, - "%decodeURI%": decodeURI, - "%decodeURIComponent%": decodeURIComponent, - "%encodeURI%": encodeURI, - "%encodeURIComponent%": encodeURIComponent, - "%Error%": $Error, - "%eval%": eval, - // eslint-disable-line no-eval - "%EvalError%": $EvalError, - "%Float16Array%": typeof Float16Array === "undefined" ? undefined2 : Float16Array, - "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array, - "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array, - "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry, - "%Function%": $Function, - "%GeneratorFunction%": needsEval, - "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array, - "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array, - "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array, - "%isFinite%": isFinite, - "%isNaN%": isNaN, - "%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined2, - "%JSON%": typeof JSON === "object" ? JSON : undefined2, - "%Map%": typeof Map === "undefined" ? undefined2 : Map, - "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()), - "%Math%": Math, - "%Number%": Number, - "%Object%": $Object, - "%Object.getOwnPropertyDescriptor%": $gOPD, - "%parseFloat%": parseFloat, - "%parseInt%": parseInt, - "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise, - "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy, - "%RangeError%": $RangeError, - "%ReferenceError%": $ReferenceError, - "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect, - "%RegExp%": RegExp, - "%Set%": typeof Set === "undefined" ? undefined2 : Set, - "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()), - "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer, - "%String%": String, - "%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined2, - "%Symbol%": hasSymbols ? Symbol : undefined2, - "%SyntaxError%": $SyntaxError, - "%ThrowTypeError%": ThrowTypeError, - "%TypedArray%": TypedArray, - "%TypeError%": $TypeError, - "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array, - "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray, - "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array, - "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array, - "%URIError%": $URIError, - "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap, - "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef, - "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet, - "%Function.prototype.call%": $call, - "%Function.prototype.apply%": $apply, - "%Object.defineProperty%": $defineProperty, - "%Object.getPrototypeOf%": $ObjectGPO, - "%Math.abs%": abs, - "%Math.floor%": floor, - "%Math.max%": max, - "%Math.min%": min, - "%Math.pow%": pow, - "%Math.round%": round, - "%Math.sign%": sign, - "%Reflect.getPrototypeOf%": $ReflectGPO - }; - if (getProto) { - try { - null.error; - } catch (e) { - errorProto = getProto(getProto(e)); - INTRINSICS["%Error.prototype%"] = errorProto; - } - } - var errorProto; - var doEval = /* @__PURE__ */ __name(function doEval2(name) { - var value; - if (name === "%AsyncFunction%") { - value = getEvalledConstructor("async function () {}"); - } else if (name === "%GeneratorFunction%") { - value = getEvalledConstructor("function* () {}"); - } else if (name === "%AsyncGeneratorFunction%") { - value = getEvalledConstructor("async function* () {}"); - } else if (name === "%AsyncGenerator%") { - var fn = doEval2("%AsyncGeneratorFunction%"); - if (fn) { - value = fn.prototype; - } - } else if (name === "%AsyncIteratorPrototype%") { - var gen = doEval2("%AsyncGenerator%"); - if (gen && getProto) { - value = getProto(gen.prototype); - } - } - INTRINSICS[name] = value; - return value; - }, "doEval"); - var LEGACY_ALIASES = { - __proto__: null, - "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], - "%ArrayPrototype%": ["Array", "prototype"], - "%ArrayProto_entries%": ["Array", "prototype", "entries"], - "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], - "%ArrayProto_keys%": ["Array", "prototype", "keys"], - "%ArrayProto_values%": ["Array", "prototype", "values"], - "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], - "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], - "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], - "%BooleanPrototype%": ["Boolean", "prototype"], - "%DataViewPrototype%": ["DataView", "prototype"], - "%DatePrototype%": ["Date", "prototype"], - "%ErrorPrototype%": ["Error", "prototype"], - "%EvalErrorPrototype%": ["EvalError", "prototype"], - "%Float32ArrayPrototype%": ["Float32Array", "prototype"], - "%Float64ArrayPrototype%": ["Float64Array", "prototype"], - "%FunctionPrototype%": ["Function", "prototype"], - "%Generator%": ["GeneratorFunction", "prototype"], - "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], - "%Int8ArrayPrototype%": ["Int8Array", "prototype"], - "%Int16ArrayPrototype%": ["Int16Array", "prototype"], - "%Int32ArrayPrototype%": ["Int32Array", "prototype"], - "%JSONParse%": ["JSON", "parse"], - "%JSONStringify%": ["JSON", "stringify"], - "%MapPrototype%": ["Map", "prototype"], - "%NumberPrototype%": ["Number", "prototype"], - "%ObjectPrototype%": ["Object", "prototype"], - "%ObjProto_toString%": ["Object", "prototype", "toString"], - "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], - "%PromisePrototype%": ["Promise", "prototype"], - "%PromiseProto_then%": ["Promise", "prototype", "then"], - "%Promise_all%": ["Promise", "all"], - "%Promise_reject%": ["Promise", "reject"], - "%Promise_resolve%": ["Promise", "resolve"], - "%RangeErrorPrototype%": ["RangeError", "prototype"], - "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], - "%RegExpPrototype%": ["RegExp", "prototype"], - "%SetPrototype%": ["Set", "prototype"], - "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], - "%StringPrototype%": ["String", "prototype"], - "%SymbolPrototype%": ["Symbol", "prototype"], - "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], - "%TypedArrayPrototype%": ["TypedArray", "prototype"], - "%TypeErrorPrototype%": ["TypeError", "prototype"], - "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], - "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], - "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], - "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], - "%URIErrorPrototype%": ["URIError", "prototype"], - "%WeakMapPrototype%": ["WeakMap", "prototype"], - "%WeakSetPrototype%": ["WeakSet", "prototype"] - }; - var bind = require_function_bind(); - var hasOwn = require_hasown(); - var $concat = bind.call($call, Array.prototype.concat); - var $spliceApply = bind.call($apply, Array.prototype.splice); - var $replace = bind.call($call, String.prototype.replace); - var $strSlice = bind.call($call, String.prototype.slice); - var $exec = bind.call($call, RegExp.prototype.exec); - var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; - var reEscapeChar = /\\(\\)?/g; - var stringToPath = /* @__PURE__ */ __name(function stringToPath2(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === "%" && last !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); - } else if (last === "%" && first !== "%") { - throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); - } - var result = []; - $replace(string, rePropName, function(match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match; - }); - return result; - }, "stringToPath"); - var getBaseIntrinsic = /* @__PURE__ */ __name(function getBaseIntrinsic2(name, allowMissing) { - var intrinsicName = name; - var alias; - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = "%" + alias[0] + "%"; - } - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - if (value === needsEval) { - value = doEval(intrinsicName); - } - if (typeof value === "undefined" && !allowMissing) { - throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); - } - return { - alias, - name: intrinsicName, - value - }; - } - throw new $SyntaxError("intrinsic " + name + " does not exist!"); - }, "getBaseIntrinsic"); - module.exports = /* @__PURE__ */ __name(function GetIntrinsic(name, allowMissing) { - if (typeof name !== "string" || name.length === 0) { - throw new $TypeError("intrinsic name must be a non-empty string"); - } - if (arguments.length > 1 && typeof allowMissing !== "boolean") { - throw new $TypeError('"allowMissing" argument must be a boolean'); - } - if ($exec(/^%?[^%]*%?$/, name) === null) { - throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name"); - } - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ""; - var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - var alias = intrinsic.alias; - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([0, 1], alias)); - } - for (var i = 1, isOwn = true; i < parts.length; i += 1) { - var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) { - throw new $SyntaxError("property names with quotes must have matching quotes"); - } - if (part === "constructor" || !isOwn) { - skipFurtherCaching = true; - } - intrinsicBaseName += "." + part; - intrinsicRealName = "%" + intrinsicBaseName + "%"; - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); - } - return void undefined2; - } - if ($gOPD && i + 1 >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - if (isOwn && "get" in desc && !("originalValue" in desc.get)) { - value = desc.get; - } else { - value = value[part]; - } - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - if (isOwn && !skipFurtherCaching) { - INTRINSICS[intrinsicRealName] = value; - } - } - } - return value; - }, "GetIntrinsic"); - } -}); - -// node_modules/call-bound/index.js -var require_call_bound = __commonJS({ - "node_modules/call-bound/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var GetIntrinsic = require_get_intrinsic(); - var callBindBasic = require_call_bind_apply_helpers(); - var $indexOf = callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]); - module.exports = /* @__PURE__ */ __name(function callBoundIntrinsic(name, allowMissing) { - var intrinsic = ( - /** @type {(this: unknown, ...args: unknown[]) => unknown} */ - GetIntrinsic(name, !!allowMissing) - ); - if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) { - return callBindBasic( - /** @type {const} */ - [intrinsic] - ); - } - return intrinsic; - }, "callBoundIntrinsic"); - } -}); - -// node_modules/side-channel-map/index.js -var require_side_channel_map = __commonJS({ - "node_modules/side-channel-map/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var GetIntrinsic = require_get_intrinsic(); - var callBound = require_call_bound(); - var inspect = require_object_inspect(); - var $TypeError = require_type(); - var $Map = GetIntrinsic("%Map%", true); - var $mapGet = callBound("Map.prototype.get", true); - var $mapSet = callBound("Map.prototype.set", true); - var $mapHas = callBound("Map.prototype.has", true); - var $mapDelete = callBound("Map.prototype.delete", true); - var $mapSize = callBound("Map.prototype.size", true); - module.exports = !!$Map && /** @type {Exclude} */ - /* @__PURE__ */ __name(function getSideChannelMap() { - var $m; - var channel2 = { - assert: /* @__PURE__ */ __name(function(key) { - if (!channel2.has(key)) { - throw new $TypeError("Side channel does not contain " + inspect(key)); - } - }, "assert"), - "delete": /* @__PURE__ */ __name(function(key) { - if ($m) { - var result = $mapDelete($m, key); - if ($mapSize($m) === 0) { - $m = void 0; - } - return result; - } - return false; - }, "delete"), - get: /* @__PURE__ */ __name(function(key) { - if ($m) { - return $mapGet($m, key); - } - }, "get"), - has: /* @__PURE__ */ __name(function(key) { - if ($m) { - return $mapHas($m, key); - } - return false; - }, "has"), - set: /* @__PURE__ */ __name(function(key, value) { - if (!$m) { - $m = new $Map(); - } - $mapSet($m, key, value); - }, "set") - }; - return channel2; - }, "getSideChannelMap"); - } -}); - -// node_modules/side-channel-weakmap/index.js -var require_side_channel_weakmap = __commonJS({ - "node_modules/side-channel-weakmap/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var GetIntrinsic = require_get_intrinsic(); - var callBound = require_call_bound(); - var inspect = require_object_inspect(); - var getSideChannelMap = require_side_channel_map(); - var $TypeError = require_type(); - var $WeakMap = GetIntrinsic("%WeakMap%", true); - var $weakMapGet = callBound("WeakMap.prototype.get", true); - var $weakMapSet = callBound("WeakMap.prototype.set", true); - var $weakMapHas = callBound("WeakMap.prototype.has", true); - var $weakMapDelete = callBound("WeakMap.prototype.delete", true); - module.exports = $WeakMap ? ( - /** @type {Exclude} */ - /* @__PURE__ */ __name(function getSideChannelWeakMap() { - var $wm; - var $m; - var channel2 = { - assert: /* @__PURE__ */ __name(function(key) { - if (!channel2.has(key)) { - throw new $TypeError("Side channel does not contain " + inspect(key)); - } - }, "assert"), - "delete": /* @__PURE__ */ __name(function(key) { - if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { - if ($wm) { - return $weakMapDelete($wm, key); - } - } else if (getSideChannelMap) { - if ($m) { - return $m["delete"](key); - } - } - return false; - }, "delete"), - get: /* @__PURE__ */ __name(function(key) { - if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { - if ($wm) { - return $weakMapGet($wm, key); - } - } - return $m && $m.get(key); - }, "get"), - has: /* @__PURE__ */ __name(function(key) { - if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { - if ($wm) { - return $weakMapHas($wm, key); - } - } - return !!$m && $m.has(key); - }, "has"), - set: /* @__PURE__ */ __name(function(key, value) { - if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) { - if (!$wm) { - $wm = new $WeakMap(); - } - $weakMapSet($wm, key, value); - } else if (getSideChannelMap) { - if (!$m) { - $m = getSideChannelMap(); - } - $m.set(key, value); - } - }, "set") - }; - return channel2; - }, "getSideChannelWeakMap") - ) : getSideChannelMap; - } -}); - -// node_modules/side-channel/index.js -var require_side_channel = __commonJS({ - "node_modules/side-channel/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var $TypeError = require_type(); - var inspect = require_object_inspect(); - var getSideChannelList = require_side_channel_list(); - var getSideChannelMap = require_side_channel_map(); - var getSideChannelWeakMap = require_side_channel_weakmap(); - var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList; - module.exports = /* @__PURE__ */ __name(function getSideChannel() { - var $channelData; - var channel2 = { - assert: /* @__PURE__ */ __name(function(key) { - if (!channel2.has(key)) { - throw new $TypeError("Side channel does not contain " + inspect(key)); - } - }, "assert"), - "delete": /* @__PURE__ */ __name(function(key) { - return !!$channelData && $channelData["delete"](key); - }, "delete"), - get: /* @__PURE__ */ __name(function(key) { - return $channelData && $channelData.get(key); - }, "get"), - has: /* @__PURE__ */ __name(function(key) { - return !!$channelData && $channelData.has(key); - }, "has"), - set: /* @__PURE__ */ __name(function(key, value) { - if (!$channelData) { - $channelData = makeChannel(); - } - $channelData.set(key, value); - }, "set") - }; - return channel2; - }, "getSideChannel"); - } -}); - -// node_modules/qs/lib/formats.js -var require_formats = __commonJS({ - "node_modules/qs/lib/formats.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var replace = String.prototype.replace; - var percentTwenties = /%20/g; - var Format = { - RFC1738: "RFC1738", - RFC3986: "RFC3986" - }; - module.exports = { - "default": Format.RFC3986, - formatters: { - RFC1738: /* @__PURE__ */ __name(function(value) { - return replace.call(value, percentTwenties, "+"); - }, "RFC1738"), - RFC3986: /* @__PURE__ */ __name(function(value) { - return String(value); - }, "RFC3986") - }, - RFC1738: Format.RFC1738, - RFC3986: Format.RFC3986 - }; - } -}); - -// node_modules/qs/lib/utils.js -var require_utils = __commonJS({ - "node_modules/qs/lib/utils.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var formats = require_formats(); - var has = Object.prototype.hasOwnProperty; - var isArray = Array.isArray; - var hexTable = function() { - var array = []; - for (var i = 0; i < 256; ++i) { - array.push("%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase()); - } - return array; - }(); - var compactQueue = /* @__PURE__ */ __name(function compactQueue2(queue) { - while (queue.length > 1) { - var item = queue.pop(); - var obj = item.obj[item.prop]; - if (isArray(obj)) { - var compacted = []; - for (var j = 0; j < obj.length; ++j) { - if (typeof obj[j] !== "undefined") { - compacted.push(obj[j]); - } - } - item.obj[item.prop] = compacted; - } - } - }, "compactQueue"); - var arrayToObject = /* @__PURE__ */ __name(function arrayToObject2(source, options) { - var obj = options && options.plainObjects ? { __proto__: null } : {}; - for (var i = 0; i < source.length; ++i) { - if (typeof source[i] !== "undefined") { - obj[i] = source[i]; - } - } - return obj; - }, "arrayToObject"); - var merge = /* @__PURE__ */ __name(function merge2(target, source, options) { - if (!source) { - return target; - } - if (typeof source !== "object" && typeof source !== "function") { - if (isArray(target)) { - target.push(source); - } else if (target && typeof target === "object") { - if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) { - target[source] = true; - } - } else { - return [target, source]; - } - return target; - } - if (!target || typeof target !== "object") { - return [target].concat(source); - } - var mergeTarget = target; - if (isArray(target) && !isArray(source)) { - mergeTarget = arrayToObject(target, options); - } - if (isArray(target) && isArray(source)) { - source.forEach(function(item, i) { - if (has.call(target, i)) { - var targetItem = target[i]; - if (targetItem && typeof targetItem === "object" && item && typeof item === "object") { - target[i] = merge2(targetItem, item, options); - } else { - target.push(item); - } - } else { - target[i] = item; - } - }); - return target; - } - return Object.keys(source).reduce(function(acc, key) { - var value = source[key]; - if (has.call(acc, key)) { - acc[key] = merge2(acc[key], value, options); - } else { - acc[key] = value; - } - return acc; - }, mergeTarget); - }, "merge"); - var assign = /* @__PURE__ */ __name(function assignSingleSource(target, source) { - return Object.keys(source).reduce(function(acc, key) { - acc[key] = source[key]; - return acc; - }, target); - }, "assignSingleSource"); - var decode = /* @__PURE__ */ __name(function(str, defaultDecoder, charset) { - var strWithoutPlus = str.replace(/\+/g, " "); - if (charset === "iso-8859-1") { - return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); - } - try { - return decodeURIComponent(strWithoutPlus); - } catch (e) { - return strWithoutPlus; - } - }, "decode"); - var limit = 1024; - var encode = /* @__PURE__ */ __name(function encode2(str, defaultEncoder, charset, kind, format) { - if (str.length === 0) { - return str; - } - var string = str; - if (typeof str === "symbol") { - string = Symbol.prototype.toString.call(str); - } else if (typeof str !== "string") { - string = String(str); - } - if (charset === "iso-8859-1") { - return escape(string).replace(/%u[0-9a-f]{4}/gi, function($0) { - return "%26%23" + parseInt($0.slice(2), 16) + "%3B"; - }); - } - var out = ""; - for (var j = 0; j < string.length; j += limit) { - var segment = string.length >= limit ? string.slice(j, j + limit) : string; - var arr = []; - for (var i = 0; i < segment.length; ++i) { - var c = segment.charCodeAt(i); - if (c === 45 || c === 46 || c === 95 || c === 126 || c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || format === formats.RFC1738 && (c === 40 || c === 41)) { - arr[arr.length] = segment.charAt(i); - continue; - } - if (c < 128) { - arr[arr.length] = hexTable[c]; - continue; - } - if (c < 2048) { - arr[arr.length] = hexTable[192 | c >> 6] + hexTable[128 | c & 63]; - continue; - } - if (c < 55296 || c >= 57344) { - arr[arr.length] = hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63]; - continue; - } - i += 1; - c = 65536 + ((c & 1023) << 10 | segment.charCodeAt(i) & 1023); - arr[arr.length] = hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63]; - } - out += arr.join(""); - } - return out; - }, "encode"); - var compact = /* @__PURE__ */ __name(function compact2(value) { - var queue = [{ obj: { o: value }, prop: "o" }]; - var refs = []; - for (var i = 0; i < queue.length; ++i) { - var item = queue[i]; - var obj = item.obj[item.prop]; - var keys = Object.keys(obj); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; - var val = obj[key]; - if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) { - queue.push({ obj, prop: key }); - refs.push(val); - } - } - } - compactQueue(queue); - return value; - }, "compact"); - var isRegExp = /* @__PURE__ */ __name(function isRegExp2(obj) { - return Object.prototype.toString.call(obj) === "[object RegExp]"; - }, "isRegExp"); - var isBuffer = /* @__PURE__ */ __name(function isBuffer2(obj) { - if (!obj || typeof obj !== "object") { - return false; - } - return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); - }, "isBuffer"); - var combine = /* @__PURE__ */ __name(function combine2(a, b) { - return [].concat(a, b); - }, "combine"); - var maybeMap = /* @__PURE__ */ __name(function maybeMap2(val, fn) { - if (isArray(val)) { - var mapped = []; - for (var i = 0; i < val.length; i += 1) { - mapped.push(fn(val[i])); - } - return mapped; - } - return fn(val); - }, "maybeMap"); - module.exports = { - arrayToObject, - assign, - combine, - compact, - decode, - encode, - isBuffer, - isRegExp, - maybeMap, - merge - }; - } -}); - -// node_modules/qs/lib/stringify.js -var require_stringify = __commonJS({ - "node_modules/qs/lib/stringify.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var getSideChannel = require_side_channel(); - var utils = require_utils(); - var formats = require_formats(); - var has = Object.prototype.hasOwnProperty; - var arrayPrefixGenerators = { - brackets: /* @__PURE__ */ __name(function brackets(prefix) { - return prefix + "[]"; - }, "brackets"), - comma: "comma", - indices: /* @__PURE__ */ __name(function indices(prefix, key) { - return prefix + "[" + key + "]"; - }, "indices"), - repeat: /* @__PURE__ */ __name(function repeat(prefix) { - return prefix; - }, "repeat") - }; - var isArray = Array.isArray; - var push = Array.prototype.push; - var pushToArray = /* @__PURE__ */ __name(function(arr, valueOrArray) { - push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); - }, "pushToArray"); - var toISO = Date.prototype.toISOString; - var defaultFormat = formats["default"]; - var defaults = { - addQueryPrefix: false, - allowDots: false, - allowEmptyArrays: false, - arrayFormat: "indices", - charset: "utf-8", - charsetSentinel: false, - commaRoundTrip: false, - delimiter: "&", - encode: true, - encodeDotInKeys: false, - encoder: utils.encode, - encodeValuesOnly: false, - filter: void 0, - format: defaultFormat, - formatter: formats.formatters[defaultFormat], - // deprecated - indices: false, - serializeDate: /* @__PURE__ */ __name(function serializeDate(date) { - return toISO.call(date); - }, "serializeDate"), - skipNulls: false, - strictNullHandling: false - }; - var isNonNullishPrimitive = /* @__PURE__ */ __name(function isNonNullishPrimitive2(v) { - return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint"; - }, "isNonNullishPrimitive"); - var sentinel = {}; - var stringify2 = /* @__PURE__ */ __name(function stringify3(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) { - var obj = object; - var tmpSc = sideChannel; - var step = 0; - var findFlag = false; - while ((tmpSc = tmpSc.get(sentinel)) !== void 0 && !findFlag) { - var pos = tmpSc.get(object); - step += 1; - if (typeof pos !== "undefined") { - if (pos === step) { - throw new RangeError("Cyclic object value"); - } else { - findFlag = true; - } - } - if (typeof tmpSc.get(sentinel) === "undefined") { - step = 0; - } - } - if (typeof filter === "function") { - obj = filter(prefix, obj); - } else if (obj instanceof Date) { - obj = serializeDate(obj); - } else if (generateArrayPrefix === "comma" && isArray(obj)) { - obj = utils.maybeMap(obj, function(value2) { - if (value2 instanceof Date) { - return serializeDate(value2); - } - return value2; - }); - } - if (obj === null) { - if (strictNullHandling) { - return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix; - } - obj = ""; - } - if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) { - if (encoder) { - var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, "key", format); - return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults.encoder, charset, "value", format))]; - } - return [formatter(prefix) + "=" + formatter(String(obj))]; - } - var values = []; - if (typeof obj === "undefined") { - return values; - } - var objKeys; - if (generateArrayPrefix === "comma" && isArray(obj)) { - if (encodeValuesOnly && encoder) { - obj = utils.maybeMap(obj, encoder); - } - objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }]; - } else if (isArray(filter)) { - objKeys = filter; - } else { - var keys = Object.keys(obj); - objKeys = sort ? keys.sort(sort) : keys; - } - var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, "%2E") : String(prefix); - var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix; - if (allowEmptyArrays && isArray(obj) && obj.length === 0) { - return adjustedPrefix + "[]"; - } - for (var j = 0; j < objKeys.length; ++j) { - var key = objKeys[j]; - var value = typeof key === "object" && key && typeof key.value !== "undefined" ? key.value : obj[key]; - if (skipNulls && value === null) { - continue; - } - var encodedKey = allowDots && encodeDotInKeys ? String(key).replace(/\./g, "%2E") : String(key); - var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]"); - sideChannel.set(object, step); - var valueSideChannel = getSideChannel(); - valueSideChannel.set(sentinel, sideChannel); - pushToArray(values, stringify3( - value, - keyPrefix, - generateArrayPrefix, - commaRoundTrip, - allowEmptyArrays, - strictNullHandling, - skipNulls, - encodeDotInKeys, - generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, - filter, - sort, - allowDots, - serializeDate, - format, - formatter, - encodeValuesOnly, - charset, - valueSideChannel - )); - } - return values; - }, "stringify"); - var normalizeStringifyOptions = /* @__PURE__ */ __name(function normalizeStringifyOptions2(opts) { - if (!opts) { - return defaults; - } - if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") { - throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided"); - } - if (typeof opts.encodeDotInKeys !== "undefined" && typeof opts.encodeDotInKeys !== "boolean") { - throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided"); - } - if (opts.encoder !== null && typeof opts.encoder !== "undefined" && typeof opts.encoder !== "function") { - throw new TypeError("Encoder has to be a function."); - } - var charset = opts.charset || defaults.charset; - if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") { - throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); - } - var format = formats["default"]; - if (typeof opts.format !== "undefined") { - if (!has.call(formats.formatters, opts.format)) { - throw new TypeError("Unknown format option provided."); - } - format = opts.format; - } - var formatter = formats.formatters[format]; - var filter = defaults.filter; - if (typeof opts.filter === "function" || isArray(opts.filter)) { - filter = opts.filter; - } - var arrayFormat; - if (opts.arrayFormat in arrayPrefixGenerators) { - arrayFormat = opts.arrayFormat; - } else if ("indices" in opts) { - arrayFormat = opts.indices ? "indices" : "repeat"; - } else { - arrayFormat = defaults.arrayFormat; - } - if ("commaRoundTrip" in opts && typeof opts.commaRoundTrip !== "boolean") { - throw new TypeError("`commaRoundTrip` must be a boolean, or absent"); - } - var allowDots = typeof opts.allowDots === "undefined" ? opts.encodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots; - return { - addQueryPrefix: typeof opts.addQueryPrefix === "boolean" ? opts.addQueryPrefix : defaults.addQueryPrefix, - allowDots, - allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays, - arrayFormat, - charset, - charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel, - commaRoundTrip: !!opts.commaRoundTrip, - delimiter: typeof opts.delimiter === "undefined" ? defaults.delimiter : opts.delimiter, - encode: typeof opts.encode === "boolean" ? opts.encode : defaults.encode, - encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults.encodeDotInKeys, - encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder, - encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults.encodeValuesOnly, - filter, - format, - formatter, - serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults.serializeDate, - skipNulls: typeof opts.skipNulls === "boolean" ? opts.skipNulls : defaults.skipNulls, - sort: typeof opts.sort === "function" ? opts.sort : null, - strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling - }; - }, "normalizeStringifyOptions"); - module.exports = function(object, opts) { - var obj = object; - var options = normalizeStringifyOptions(opts); - var objKeys; - var filter; - if (typeof options.filter === "function") { - filter = options.filter; - obj = filter("", obj); - } else if (isArray(options.filter)) { - filter = options.filter; - objKeys = filter; - } - var keys = []; - if (typeof obj !== "object" || obj === null) { - return ""; - } - var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat]; - var commaRoundTrip = generateArrayPrefix === "comma" && options.commaRoundTrip; - if (!objKeys) { - objKeys = Object.keys(obj); - } - if (options.sort) { - objKeys.sort(options.sort); - } - var sideChannel = getSideChannel(); - for (var i = 0; i < objKeys.length; ++i) { - var key = objKeys[i]; - var value = obj[key]; - if (options.skipNulls && value === null) { - continue; - } - pushToArray(keys, stringify2( - value, - key, - generateArrayPrefix, - commaRoundTrip, - options.allowEmptyArrays, - options.strictNullHandling, - options.skipNulls, - options.encodeDotInKeys, - options.encode ? options.encoder : null, - options.filter, - options.sort, - options.allowDots, - options.serializeDate, - options.format, - options.formatter, - options.encodeValuesOnly, - options.charset, - sideChannel - )); - } - var joined = keys.join(options.delimiter); - var prefix = options.addQueryPrefix === true ? "?" : ""; - if (options.charsetSentinel) { - if (options.charset === "iso-8859-1") { - prefix += "utf8=%26%2310003%3B&"; - } else { - prefix += "utf8=%E2%9C%93&"; - } - } - return joined.length > 0 ? prefix + joined : ""; - }; - } -}); - -// node_modules/qs/lib/parse.js -var require_parse = __commonJS({ - "node_modules/qs/lib/parse.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var utils = require_utils(); - var has = Object.prototype.hasOwnProperty; - var isArray = Array.isArray; - var defaults = { - allowDots: false, - allowEmptyArrays: false, - allowPrototypes: false, - allowSparse: false, - arrayLimit: 20, - charset: "utf-8", - charsetSentinel: false, - comma: false, - decodeDotInKeys: false, - decoder: utils.decode, - delimiter: "&", - depth: 5, - duplicates: "combine", - ignoreQueryPrefix: false, - interpretNumericEntities: false, - parameterLimit: 1e3, - parseArrays: true, - plainObjects: false, - strictDepth: false, - strictNullHandling: false, - throwOnLimitExceeded: false - }; - var interpretNumericEntities = /* @__PURE__ */ __name(function(str) { - return str.replace(/&#(\d+);/g, function($0, numberStr) { - return String.fromCharCode(parseInt(numberStr, 10)); - }); - }, "interpretNumericEntities"); - var parseArrayValue = /* @__PURE__ */ __name(function(val, options, currentArrayLength) { - if (val && typeof val === "string" && options.comma && val.indexOf(",") > -1) { - return val.split(","); - } - if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) { - throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array."); - } - return val; - }, "parseArrayValue"); - var isoSentinel = "utf8=%26%2310003%3B"; - var charsetSentinel = "utf8=%E2%9C%93"; - var parseValues = /* @__PURE__ */ __name(function parseQueryStringValues(str, options) { - var obj = { __proto__: null }; - var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str; - cleanStr = cleanStr.replace(/%5B/gi, "[").replace(/%5D/gi, "]"); - var limit = options.parameterLimit === Infinity ? void 0 : options.parameterLimit; - var parts = cleanStr.split( - options.delimiter, - options.throwOnLimitExceeded ? limit + 1 : limit - ); - if (options.throwOnLimitExceeded && parts.length > limit) { - throw new RangeError("Parameter limit exceeded. Only " + limit + " parameter" + (limit === 1 ? "" : "s") + " allowed."); - } - var skipIndex = -1; - var i; - var charset = options.charset; - if (options.charsetSentinel) { - for (i = 0; i < parts.length; ++i) { - if (parts[i].indexOf("utf8=") === 0) { - if (parts[i] === charsetSentinel) { - charset = "utf-8"; - } else if (parts[i] === isoSentinel) { - charset = "iso-8859-1"; - } - skipIndex = i; - i = parts.length; - } - } - } - for (i = 0; i < parts.length; ++i) { - if (i === skipIndex) { - continue; - } - var part = parts[i]; - var bracketEqualsPos = part.indexOf("]="); - var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1; - var key; - var val; - if (pos === -1) { - key = options.decoder(part, defaults.decoder, charset, "key"); - val = options.strictNullHandling ? null : ""; - } else { - key = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key"); - val = utils.maybeMap( - parseArrayValue( - part.slice(pos + 1), - options, - isArray(obj[key]) ? obj[key].length : 0 - ), - function(encodedVal) { - return options.decoder(encodedVal, defaults.decoder, charset, "value"); - } - ); - } - if (val && options.interpretNumericEntities && charset === "iso-8859-1") { - val = interpretNumericEntities(String(val)); - } - if (part.indexOf("[]=") > -1) { - val = isArray(val) ? [val] : val; - } - var existing = has.call(obj, key); - if (existing && options.duplicates === "combine") { - obj[key] = utils.combine(obj[key], val); - } else if (!existing || options.duplicates === "last") { - obj[key] = val; - } - } - return obj; - }, "parseQueryStringValues"); - var parseObject = /* @__PURE__ */ __name(function(chain, val, options, valuesParsed) { - var currentArrayLength = 0; - if (chain.length > 0 && chain[chain.length - 1] === "[]") { - var parentKey = chain.slice(0, -1).join(""); - currentArrayLength = Array.isArray(val) && val[parentKey] ? val[parentKey].length : 0; - } - var leaf = valuesParsed ? val : parseArrayValue(val, options, currentArrayLength); - for (var i = chain.length - 1; i >= 0; --i) { - var obj; - var root = chain[i]; - if (root === "[]" && options.parseArrays) { - obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : utils.combine([], leaf); - } else { - obj = options.plainObjects ? { __proto__: null } : {}; - var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root; - var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot; - var index = parseInt(decodedRoot, 10); - if (!options.parseArrays && decodedRoot === "") { - obj = { 0: leaf }; - } else if (!isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) { - obj = []; - obj[index] = leaf; - } else if (decodedRoot !== "__proto__") { - obj[decodedRoot] = leaf; - } - } - leaf = obj; - } - return leaf; - }, "parseObject"); - var parseKeys = /* @__PURE__ */ __name(function parseQueryStringKeys(givenKey, val, options, valuesParsed) { - if (!givenKey) { - return; - } - var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey; - var brackets = /(\[[^[\]]*])/; - var child = /(\[[^[\]]*])/g; - var segment = options.depth > 0 && brackets.exec(key); - var parent = segment ? key.slice(0, segment.index) : key; - var keys = []; - if (parent) { - if (!options.plainObjects && has.call(Object.prototype, parent)) { - if (!options.allowPrototypes) { - return; - } - } - keys.push(parent); - } - var i = 0; - while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) { - i += 1; - if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { - if (!options.allowPrototypes) { - return; - } - } - keys.push(segment[1]); - } - if (segment) { - if (options.strictDepth === true) { - throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true"); - } - keys.push("[" + key.slice(segment.index) + "]"); - } - return parseObject(keys, val, options, valuesParsed); - }, "parseQueryStringKeys"); - var normalizeParseOptions = /* @__PURE__ */ __name(function normalizeParseOptions2(opts) { - if (!opts) { - return defaults; - } - if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") { - throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided"); - } - if (typeof opts.decodeDotInKeys !== "undefined" && typeof opts.decodeDotInKeys !== "boolean") { - throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided"); - } - if (opts.decoder !== null && typeof opts.decoder !== "undefined" && typeof opts.decoder !== "function") { - throw new TypeError("Decoder has to be a function."); - } - if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") { - throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined"); - } - if (typeof opts.throwOnLimitExceeded !== "undefined" && typeof opts.throwOnLimitExceeded !== "boolean") { - throw new TypeError("`throwOnLimitExceeded` option must be a boolean"); - } - var charset = typeof opts.charset === "undefined" ? defaults.charset : opts.charset; - var duplicates = typeof opts.duplicates === "undefined" ? defaults.duplicates : opts.duplicates; - if (duplicates !== "combine" && duplicates !== "first" && duplicates !== "last") { - throw new TypeError("The duplicates option must be either combine, first, or last"); - } - var allowDots = typeof opts.allowDots === "undefined" ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots; - return { - allowDots, - allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays, - allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults.allowPrototypes, - allowSparse: typeof opts.allowSparse === "boolean" ? opts.allowSparse : defaults.allowSparse, - arrayLimit: typeof opts.arrayLimit === "number" ? opts.arrayLimit : defaults.arrayLimit, - charset, - charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel, - comma: typeof opts.comma === "boolean" ? opts.comma : defaults.comma, - decodeDotInKeys: typeof opts.decodeDotInKeys === "boolean" ? opts.decodeDotInKeys : defaults.decodeDotInKeys, - decoder: typeof opts.decoder === "function" ? opts.decoder : defaults.decoder, - delimiter: typeof opts.delimiter === "string" || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter, - // eslint-disable-next-line no-implicit-coercion, no-extra-parens - depth: typeof opts.depth === "number" || opts.depth === false ? +opts.depth : defaults.depth, - duplicates, - ignoreQueryPrefix: opts.ignoreQueryPrefix === true, - interpretNumericEntities: typeof opts.interpretNumericEntities === "boolean" ? opts.interpretNumericEntities : defaults.interpretNumericEntities, - parameterLimit: typeof opts.parameterLimit === "number" ? opts.parameterLimit : defaults.parameterLimit, - parseArrays: opts.parseArrays !== false, - plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects, - strictDepth: typeof opts.strictDepth === "boolean" ? !!opts.strictDepth : defaults.strictDepth, - strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling, - throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === "boolean" ? opts.throwOnLimitExceeded : false - }; - }, "normalizeParseOptions"); - module.exports = function(str, opts) { - var options = normalizeParseOptions(opts); - if (str === "" || str === null || typeof str === "undefined") { - return options.plainObjects ? { __proto__: null } : {}; - } - var tempObj = typeof str === "string" ? parseValues(str, options) : str; - var obj = options.plainObjects ? { __proto__: null } : {}; - var keys = Object.keys(tempObj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var newObj = parseKeys(key, tempObj[key], options, typeof str === "string"); - obj = utils.merge(obj, newObj, options); - } - if (options.allowSparse === true) { - return obj; - } - return utils.compact(obj); - }; - } -}); - -// node_modules/qs/lib/index.js -var require_lib = __commonJS({ - "node_modules/qs/lib/index.js"(exports, module) { - "use strict"; - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); - init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); - init_performance2(); - var stringify2 = require_stringify(); - var parse = require_parse(); - var formats = require_formats(); - module.exports = { - formats, - parse, - stringify: stringify2 - }; - } -}); - -// src/worker.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/index.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/hono.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/hono-base.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/compose.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var compose = /* @__PURE__ */ __name((middleware, onError, onNotFound) => { - return (context2, next) => { - let index = -1; - return dispatch(0); - async function dispatch(i) { - if (i <= index) { - throw new Error("next() called multiple times"); - } - index = i; - let res; - let isError = false; - let handler; - if (middleware[i]) { - handler = middleware[i][0][0]; - context2.req.routeIndex = i; - } else { - handler = i === middleware.length && next || void 0; - } - if (handler) { - try { - res = await handler(context2, () => dispatch(i + 1)); - } catch (err) { - if (err instanceof Error && onError) { - context2.error = err; - res = await onError(err, context2); - isError = true; - } else { - throw err; - } - } - } else { - if (context2.finalized === false && onNotFound) { - res = await onNotFound(context2); - } - } - if (res && (context2.finalized === false || isError)) { - context2.res = res; - } - return context2; - } - __name(dispatch, "dispatch"); - }; -}, "compose"); - -// node_modules/hono/dist/context.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/request.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/request/constants.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var GET_MATCH_RESULT = Symbol(); - -// node_modules/hono/dist/utils/body.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var parseBody = /* @__PURE__ */ __name(async (request, options = /* @__PURE__ */ Object.create(null)) => { - const { all = false, dot = false } = options; - const headers = request instanceof HonoRequest ? request.raw.headers : request.headers; - const contentType = headers.get("Content-Type"); - if (contentType?.startsWith("multipart/form-data") || contentType?.startsWith("application/x-www-form-urlencoded")) { - return parseFormData(request, { all, dot }); - } - return {}; -}, "parseBody"); -async function parseFormData(request, options) { - const formData = await request.formData(); - if (formData) { - return convertFormDataToBodyData(formData, options); - } - return {}; -} -__name(parseFormData, "parseFormData"); -function convertFormDataToBodyData(formData, options) { - const form = /* @__PURE__ */ Object.create(null); - formData.forEach((value, key) => { - const shouldParseAllValues = options.all || key.endsWith("[]"); - if (!shouldParseAllValues) { - form[key] = value; - } else { - handleParsingAllValues(form, key, value); - } - }); - if (options.dot) { - Object.entries(form).forEach(([key, value]) => { - const shouldParseDotValues = key.includes("."); - if (shouldParseDotValues) { - handleParsingNestedValues(form, key, value); - delete form[key]; - } - }); - } - return form; -} -__name(convertFormDataToBodyData, "convertFormDataToBodyData"); -var handleParsingAllValues = /* @__PURE__ */ __name((form, key, value) => { - if (form[key] !== void 0) { - if (Array.isArray(form[key])) { - ; - form[key].push(value); - } else { - form[key] = [form[key], value]; - } - } else { - if (!key.endsWith("[]")) { - form[key] = value; - } else { - form[key] = [value]; - } - } -}, "handleParsingAllValues"); -var handleParsingNestedValues = /* @__PURE__ */ __name((form, key, value) => { - let nestedForm = form; - const keys = key.split("."); - keys.forEach((key2, index) => { - if (index === keys.length - 1) { - nestedForm[key2] = value; - } else { - if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) { - nestedForm[key2] = /* @__PURE__ */ Object.create(null); - } - nestedForm = nestedForm[key2]; - } - }); -}, "handleParsingNestedValues"); - -// node_modules/hono/dist/utils/url.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var splitPath = /* @__PURE__ */ __name((path) => { - const paths = path.split("/"); - if (paths[0] === "") { - paths.shift(); - } - return paths; -}, "splitPath"); -var splitRoutingPath = /* @__PURE__ */ __name((routePath) => { - const { groups, path } = extractGroupsFromPath(routePath); - const paths = splitPath(path); - return replaceGroupMarks(paths, groups); -}, "splitRoutingPath"); -var extractGroupsFromPath = /* @__PURE__ */ __name((path) => { - const groups = []; - path = path.replace(/\{[^}]+\}/g, (match, index) => { - const mark = `@${index}`; - groups.push([mark, match]); - return mark; - }); - return { groups, path }; -}, "extractGroupsFromPath"); -var replaceGroupMarks = /* @__PURE__ */ __name((paths, groups) => { - for (let i = groups.length - 1; i >= 0; i--) { - const [mark] = groups[i]; - for (let j = paths.length - 1; j >= 0; j--) { - if (paths[j].includes(mark)) { - paths[j] = paths[j].replace(mark, groups[i][1]); - break; - } - } - } - return paths; -}, "replaceGroupMarks"); -var patternCache = {}; -var getPattern = /* @__PURE__ */ __name((label, next) => { - if (label === "*") { - return "*"; - } - const match = label.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/); - if (match) { - const cacheKey = `${label}#${next}`; - if (!patternCache[cacheKey]) { - if (match[2]) { - patternCache[cacheKey] = next && next[0] !== ":" && next[0] !== "*" ? [cacheKey, match[1], new RegExp(`^${match[2]}(?=/${next})`)] : [label, match[1], new RegExp(`^${match[2]}$`)]; - } else { - patternCache[cacheKey] = [label, match[1], true]; - } - } - return patternCache[cacheKey]; - } - return null; -}, "getPattern"); -var tryDecode = /* @__PURE__ */ __name((str, decoder) => { - try { - return decoder(str); - } catch { - return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => { - try { - return decoder(match); - } catch { - return match; - } - }); - } -}, "tryDecode"); -var tryDecodeURI = /* @__PURE__ */ __name((str) => tryDecode(str, decodeURI), "tryDecodeURI"); -var getPath = /* @__PURE__ */ __name((request) => { - const url = request.url; - const start = url.indexOf("/", url.indexOf(":") + 4); - let i = start; - for (; i < url.length; i++) { - const charCode = url.charCodeAt(i); - if (charCode === 37) { - const queryIndex = url.indexOf("?", i); - const path = url.slice(start, queryIndex === -1 ? void 0 : queryIndex); - return tryDecodeURI(path.includes("%25") ? path.replace(/%25/g, "%2525") : path); - } else if (charCode === 63) { - break; - } - } - return url.slice(start, i); -}, "getPath"); -var getPathNoStrict = /* @__PURE__ */ __name((request) => { - const result = getPath(request); - return result.length > 1 && result.at(-1) === "/" ? result.slice(0, -1) : result; -}, "getPathNoStrict"); -var mergePath = /* @__PURE__ */ __name((base, sub, ...rest) => { - if (rest.length) { - sub = mergePath(sub, ...rest); - } - return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`; -}, "mergePath"); -var checkOptionalParameter = /* @__PURE__ */ __name((path) => { - if (path.charCodeAt(path.length - 1) !== 63 || !path.includes(":")) { - return null; - } - const segments = path.split("/"); - const results = []; - let basePath = ""; - segments.forEach((segment) => { - if (segment !== "" && !/\:/.test(segment)) { - basePath += "/" + segment; - } else if (/\:/.test(segment)) { - if (/\?/.test(segment)) { - if (results.length === 0 && basePath === "") { - results.push("/"); - } else { - results.push(basePath); - } - const optionalSegment = segment.replace("?", ""); - basePath += "/" + optionalSegment; - results.push(basePath); - } else { - basePath += "/" + segment; - } - } - }); - return results.filter((v, i, a) => a.indexOf(v) === i); -}, "checkOptionalParameter"); -var _decodeURI = /* @__PURE__ */ __name((value) => { - if (!/[%+]/.test(value)) { - return value; - } - if (value.indexOf("+") !== -1) { - value = value.replace(/\+/g, " "); - } - return value.indexOf("%") !== -1 ? tryDecode(value, decodeURIComponent_) : value; -}, "_decodeURI"); -var _getQueryParam = /* @__PURE__ */ __name((url, key, multiple) => { - let encoded; - if (!multiple && key && !/[%+]/.test(key)) { - let keyIndex2 = url.indexOf(`?${key}`, 8); - if (keyIndex2 === -1) { - keyIndex2 = url.indexOf(`&${key}`, 8); - } - while (keyIndex2 !== -1) { - const trailingKeyCode = url.charCodeAt(keyIndex2 + key.length + 1); - if (trailingKeyCode === 61) { - const valueIndex = keyIndex2 + key.length + 2; - const endIndex = url.indexOf("&", valueIndex); - return _decodeURI(url.slice(valueIndex, endIndex === -1 ? void 0 : endIndex)); - } else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) { - return ""; - } - keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1); - } - encoded = /[%+]/.test(url); - if (!encoded) { - return void 0; - } - } - const results = {}; - encoded ??= /[%+]/.test(url); - let keyIndex = url.indexOf("?", 8); - while (keyIndex !== -1) { - const nextKeyIndex = url.indexOf("&", keyIndex + 1); - let valueIndex = url.indexOf("=", keyIndex); - if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) { - valueIndex = -1; - } - let name = url.slice( - keyIndex + 1, - valueIndex === -1 ? nextKeyIndex === -1 ? void 0 : nextKeyIndex : valueIndex - ); - if (encoded) { - name = _decodeURI(name); - } - keyIndex = nextKeyIndex; - if (name === "") { - continue; - } - let value; - if (valueIndex === -1) { - value = ""; - } else { - value = url.slice(valueIndex + 1, nextKeyIndex === -1 ? void 0 : nextKeyIndex); - if (encoded) { - value = _decodeURI(value); - } - } - if (multiple) { - if (!(results[name] && Array.isArray(results[name]))) { - results[name] = []; - } - ; - results[name].push(value); - } else { - results[name] ??= value; - } - } - return key ? results[key] : results; -}, "_getQueryParam"); -var getQueryParam = _getQueryParam; -var getQueryParams = /* @__PURE__ */ __name((url, key) => { - return _getQueryParam(url, key, true); -}, "getQueryParams"); -var decodeURIComponent_ = decodeURIComponent; - -// node_modules/hono/dist/request.js -var tryDecodeURIComponent = /* @__PURE__ */ __name((str) => tryDecode(str, decodeURIComponent_), "tryDecodeURIComponent"); -var HonoRequest = class { - static { - __name(this, "HonoRequest"); - } - raw; - #validatedData; - #matchResult; - routeIndex = 0; - path; - bodyCache = {}; - constructor(request, path = "/", matchResult = [[]]) { - this.raw = request; - this.path = path; - this.#matchResult = matchResult; - this.#validatedData = {}; - } - param(key) { - return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams(); - } - #getDecodedParam(key) { - const paramKey = this.#matchResult[0][this.routeIndex][1][key]; - const param = this.#getParamValue(paramKey); - return param ? /\%/.test(param) ? tryDecodeURIComponent(param) : param : void 0; - } - #getAllDecodedParams() { - const decoded = {}; - const keys = Object.keys(this.#matchResult[0][this.routeIndex][1]); - for (const key of keys) { - const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]); - if (value && typeof value === "string") { - decoded[key] = /\%/.test(value) ? tryDecodeURIComponent(value) : value; - } - } - return decoded; - } - #getParamValue(paramKey) { - return this.#matchResult[1] ? this.#matchResult[1][paramKey] : paramKey; - } - query(key) { - return getQueryParam(this.url, key); - } - queries(key) { - return getQueryParams(this.url, key); - } - header(name) { - if (name) { - return this.raw.headers.get(name) ?? void 0; - } - const headerData = {}; - this.raw.headers.forEach((value, key) => { - headerData[key] = value; - }); - return headerData; - } - async parseBody(options) { - return this.bodyCache.parsedBody ??= await parseBody(this, options); - } - #cachedBody = /* @__PURE__ */ __name((key) => { - const { bodyCache, raw: raw2 } = this; - const cachedBody = bodyCache[key]; - if (cachedBody) { - return cachedBody; - } - const anyCachedKey = Object.keys(bodyCache)[0]; - if (anyCachedKey) { - return bodyCache[anyCachedKey].then((body) => { - if (anyCachedKey === "json") { - body = JSON.stringify(body); - } - return new Response(body)[key](); - }); - } - return bodyCache[key] = raw2[key](); - }, "#cachedBody"); - json() { - return this.#cachedBody("text").then((text) => JSON.parse(text)); - } - text() { - return this.#cachedBody("text"); - } - arrayBuffer() { - return this.#cachedBody("arrayBuffer"); - } - blob() { - return this.#cachedBody("blob"); - } - formData() { - return this.#cachedBody("formData"); - } - addValidatedData(target, data) { - this.#validatedData[target] = data; - } - valid(target) { - return this.#validatedData[target]; - } - get url() { - return this.raw.url; - } - get method() { - return this.raw.method; - } - get [GET_MATCH_RESULT]() { - return this.#matchResult; - } - get matchedRoutes() { - return this.#matchResult[0].map(([[, route]]) => route); - } - get routePath() { - return this.#matchResult[0].map(([[, route]]) => route)[this.routeIndex].path; - } -}; - -// node_modules/hono/dist/utils/html.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var HtmlEscapedCallbackPhase = { - Stringify: 1, - BeforeStream: 2, - Stream: 3 -}; -var raw = /* @__PURE__ */ __name((value, callbacks) => { - const escapedString = new String(value); - escapedString.isEscaped = true; - escapedString.callbacks = callbacks; - return escapedString; -}, "raw"); -var resolveCallback = /* @__PURE__ */ __name(async (str, phase, preserveCallbacks, context2, buffer) => { - if (typeof str === "object" && !(str instanceof String)) { - if (!(str instanceof Promise)) { - str = str.toString(); - } - if (str instanceof Promise) { - str = await str; - } - } - const callbacks = str.callbacks; - if (!callbacks?.length) { - return Promise.resolve(str); - } - if (buffer) { - buffer[0] += str; - } else { - buffer = [str]; - } - const resStr = Promise.all(callbacks.map((c) => c({ phase, buffer, context: context2 }))).then( - (res) => Promise.all( - res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context2, buffer)) - ).then(() => buffer[0]) - ); - if (preserveCallbacks) { - return raw(await resStr, callbacks); - } else { - return resStr; - } -}, "resolveCallback"); - -// node_modules/hono/dist/context.js -var TEXT_PLAIN = "text/plain; charset=UTF-8"; -var setDefaultContentType = /* @__PURE__ */ __name((contentType, headers) => { - return { - "Content-Type": contentType, - ...headers - }; -}, "setDefaultContentType"); -var Context = class { - static { - __name(this, "Context"); - } - #rawRequest; - #req; - env = {}; - #var; - finalized = false; - error; - #status; - #executionCtx; - #res; - #layout; - #renderer; - #notFoundHandler; - #preparedHeaders; - #matchResult; - #path; - constructor(req, options) { - this.#rawRequest = req; - if (options) { - this.#executionCtx = options.executionCtx; - this.env = options.env; - this.#notFoundHandler = options.notFoundHandler; - this.#path = options.path; - this.#matchResult = options.matchResult; - } - } - get req() { - this.#req ??= new HonoRequest(this.#rawRequest, this.#path, this.#matchResult); - return this.#req; - } - get event() { - if (this.#executionCtx && "respondWith" in this.#executionCtx) { - return this.#executionCtx; - } else { - throw Error("This context has no FetchEvent"); - } - } - get executionCtx() { - if (this.#executionCtx) { - return this.#executionCtx; - } else { - throw Error("This context has no ExecutionContext"); - } - } - get res() { - return this.#res ||= new Response(null, { - headers: this.#preparedHeaders ??= new Headers() - }); - } - set res(_res) { - if (this.#res && _res) { - _res = new Response(_res.body, _res); - for (const [k, v] of this.#res.headers.entries()) { - if (k === "content-type") { - continue; - } - if (k === "set-cookie") { - const cookies = this.#res.headers.getSetCookie(); - _res.headers.delete("set-cookie"); - for (const cookie of cookies) { - _res.headers.append("set-cookie", cookie); - } - } else { - _res.headers.set(k, v); - } - } - } - this.#res = _res; - this.finalized = true; - } - render = /* @__PURE__ */ __name((...args) => { - this.#renderer ??= (content) => this.html(content); - return this.#renderer(...args); - }, "render"); - setLayout = /* @__PURE__ */ __name((layout) => this.#layout = layout, "setLayout"); - getLayout = /* @__PURE__ */ __name(() => this.#layout, "getLayout"); - setRenderer = /* @__PURE__ */ __name((renderer) => { - this.#renderer = renderer; - }, "setRenderer"); - header = /* @__PURE__ */ __name((name, value, options) => { - if (this.finalized) { - this.#res = new Response(this.#res.body, this.#res); - } - const headers = this.#res ? this.#res.headers : this.#preparedHeaders ??= new Headers(); - if (value === void 0) { - headers.delete(name); - } else if (options?.append) { - headers.append(name, value); - } else { - headers.set(name, value); - } - }, "header"); - status = /* @__PURE__ */ __name((status) => { - this.#status = status; - }, "status"); - set = /* @__PURE__ */ __name((key, value) => { - this.#var ??= /* @__PURE__ */ new Map(); - this.#var.set(key, value); - }, "set"); - get = /* @__PURE__ */ __name((key) => { - return this.#var ? this.#var.get(key) : void 0; - }, "get"); - get var() { - if (!this.#var) { - return {}; - } - return Object.fromEntries(this.#var); - } - #newResponse(data, arg, headers) { - const responseHeaders = this.#res ? new Headers(this.#res.headers) : this.#preparedHeaders ?? new Headers(); - if (typeof arg === "object" && "headers" in arg) { - const argHeaders = arg.headers instanceof Headers ? arg.headers : new Headers(arg.headers); - for (const [key, value] of argHeaders) { - if (key.toLowerCase() === "set-cookie") { - responseHeaders.append(key, value); - } else { - responseHeaders.set(key, value); - } - } - } - if (headers) { - for (const [k, v] of Object.entries(headers)) { - if (typeof v === "string") { - responseHeaders.set(k, v); - } else { - responseHeaders.delete(k); - for (const v2 of v) { - responseHeaders.append(k, v2); - } - } - } - } - const status = typeof arg === "number" ? arg : arg?.status ?? this.#status; - return new Response(data, { status, headers: responseHeaders }); - } - newResponse = /* @__PURE__ */ __name((...args) => this.#newResponse(...args), "newResponse"); - body = /* @__PURE__ */ __name((data, arg, headers) => this.#newResponse(data, arg, headers), "body"); - text = /* @__PURE__ */ __name((text, arg, headers) => { - return !this.#preparedHeaders && !this.#status && !arg && !headers && !this.finalized ? new Response(text) : this.#newResponse( - text, - arg, - setDefaultContentType(TEXT_PLAIN, headers) - ); - }, "text"); - json = /* @__PURE__ */ __name((object, arg, headers) => { - return this.#newResponse( - JSON.stringify(object), - arg, - setDefaultContentType("application/json", headers) - ); - }, "json"); - html = /* @__PURE__ */ __name((html, arg, headers) => { - const res = /* @__PURE__ */ __name((html2) => this.#newResponse(html2, arg, setDefaultContentType("text/html; charset=UTF-8", headers)), "res"); - return typeof html === "object" ? resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then(res) : res(html); - }, "html"); - redirect = /* @__PURE__ */ __name((location, status) => { - const locationString = String(location); - this.header( - "Location", - !/[^\x00-\xFF]/.test(locationString) ? locationString : encodeURI(locationString) - ); - return this.newResponse(null, status ?? 302); - }, "redirect"); - notFound = /* @__PURE__ */ __name(() => { - this.#notFoundHandler ??= () => new Response(); - return this.#notFoundHandler(this); - }, "notFound"); -}; - -// node_modules/hono/dist/router.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var METHOD_NAME_ALL = "ALL"; -var METHOD_NAME_ALL_LOWERCASE = "all"; -var METHODS = ["get", "post", "put", "delete", "options", "patch"]; -var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built."; -var UnsupportedPathError = class extends Error { - static { - __name(this, "UnsupportedPathError"); - } -}; - -// node_modules/hono/dist/utils/constants.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var COMPOSED_HANDLER = "__COMPOSED_HANDLER"; - -// node_modules/hono/dist/hono-base.js -var notFoundHandler = /* @__PURE__ */ __name((c) => { - return c.text("404 Not Found", 404); -}, "notFoundHandler"); -var errorHandler = /* @__PURE__ */ __name((err, c) => { - if ("getResponse" in err) { - const res = err.getResponse(); - return c.newResponse(res.body, res); - } - console.error(err); - return c.text("Internal Server Error", 500); -}, "errorHandler"); -var Hono = class { - static { - __name(this, "Hono"); - } - get; - post; - put; - delete; - options; - patch; - all; - on; - use; - router; - getPath; - _basePath = "/"; - #path = "/"; - routes = []; - constructor(options = {}) { - const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE]; - allMethods.forEach((method) => { - this[method] = (args1, ...args) => { - if (typeof args1 === "string") { - this.#path = args1; - } else { - this.#addRoute(method, this.#path, args1); - } - args.forEach((handler) => { - this.#addRoute(method, this.#path, handler); - }); - return this; - }; - }); - this.on = (method, path, ...handlers) => { - for (const p of [path].flat()) { - this.#path = p; - for (const m of [method].flat()) { - handlers.map((handler) => { - this.#addRoute(m.toUpperCase(), this.#path, handler); - }); - } - } - return this; - }; - this.use = (arg1, ...handlers) => { - if (typeof arg1 === "string") { - this.#path = arg1; - } else { - this.#path = "*"; - handlers.unshift(arg1); - } - handlers.forEach((handler) => { - this.#addRoute(METHOD_NAME_ALL, this.#path, handler); - }); - return this; - }; - const { strict, ...optionsWithoutStrict } = options; - Object.assign(this, optionsWithoutStrict); - this.getPath = strict ?? true ? options.getPath ?? getPath : getPathNoStrict; - } - #clone() { - const clone = new Hono({ - router: this.router, - getPath: this.getPath - }); - clone.errorHandler = this.errorHandler; - clone.#notFoundHandler = this.#notFoundHandler; - clone.routes = this.routes; - return clone; - } - #notFoundHandler = notFoundHandler; - errorHandler = errorHandler; - route(path, app2) { - const subApp = this.basePath(path); - app2.routes.map((r) => { - let handler; - if (app2.errorHandler === errorHandler) { - handler = r.handler; - } else { - handler = /* @__PURE__ */ __name(async (c, next) => (await compose([], app2.errorHandler)(c, () => r.handler(c, next))).res, "handler"); - handler[COMPOSED_HANDLER] = r.handler; - } - subApp.#addRoute(r.method, r.path, handler); - }); - return this; - } - basePath(path) { - const subApp = this.#clone(); - subApp._basePath = mergePath(this._basePath, path); - return subApp; - } - onError = /* @__PURE__ */ __name((handler) => { - this.errorHandler = handler; - return this; - }, "onError"); - notFound = /* @__PURE__ */ __name((handler) => { - this.#notFoundHandler = handler; - return this; - }, "notFound"); - mount(path, applicationHandler, options) { - let replaceRequest; - let optionHandler; - if (options) { - if (typeof options === "function") { - optionHandler = options; - } else { - optionHandler = options.optionHandler; - if (options.replaceRequest === false) { - replaceRequest = /* @__PURE__ */ __name((request) => request, "replaceRequest"); - } else { - replaceRequest = options.replaceRequest; - } - } - } - const getOptions = optionHandler ? (c) => { - const options2 = optionHandler(c); - return Array.isArray(options2) ? options2 : [options2]; - } : (c) => { - let executionContext = void 0; - try { - executionContext = c.executionCtx; - } catch { - } - return [c.env, executionContext]; - }; - replaceRequest ||= (() => { - const mergedPath = mergePath(this._basePath, path); - const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length; - return (request) => { - const url = new URL(request.url); - url.pathname = url.pathname.slice(pathPrefixLength) || "/"; - return new Request(url, request); - }; - })(); - const handler = /* @__PURE__ */ __name(async (c, next) => { - const res = await applicationHandler(replaceRequest(c.req.raw), ...getOptions(c)); - if (res) { - return res; - } - await next(); - }, "handler"); - this.#addRoute(METHOD_NAME_ALL, mergePath(path, "*"), handler); - return this; - } - #addRoute(method, path, handler) { - method = method.toUpperCase(); - path = mergePath(this._basePath, path); - const r = { basePath: this._basePath, path, method, handler }; - this.router.add(method, path, [handler, r]); - this.routes.push(r); - } - #handleError(err, c) { - if (err instanceof Error) { - return this.errorHandler(err, c); - } - throw err; - } - #dispatch(request, executionCtx, env2, method) { - if (method === "HEAD") { - return (async () => new Response(null, await this.#dispatch(request, executionCtx, env2, "GET")))(); - } - const path = this.getPath(request, { env: env2 }); - const matchResult = this.router.match(method, path); - const c = new Context(request, { - path, - matchResult, - env: env2, - executionCtx, - notFoundHandler: this.#notFoundHandler - }); - if (matchResult[0].length === 1) { - let res; - try { - res = matchResult[0][0][0][0](c, async () => { - c.res = await this.#notFoundHandler(c); - }); - } catch (err) { - return this.#handleError(err, c); - } - return res instanceof Promise ? res.then( - (resolved) => resolved || (c.finalized ? c.res : this.#notFoundHandler(c)) - ).catch((err) => this.#handleError(err, c)) : res ?? this.#notFoundHandler(c); - } - const composed = compose(matchResult[0], this.errorHandler, this.#notFoundHandler); - return (async () => { - try { - const context2 = await composed(c); - if (!context2.finalized) { - throw new Error( - "Context is not finalized. Did you forget to return a Response object or `await next()`?" - ); - } - return context2.res; - } catch (err) { - return this.#handleError(err, c); - } - })(); - } - fetch = /* @__PURE__ */ __name((request, ...rest) => { - return this.#dispatch(request, rest[1], rest[0], request.method); - }, "fetch"); - request = /* @__PURE__ */ __name((input, requestInit, Env, executionCtx) => { - if (input instanceof Request) { - return this.fetch(requestInit ? new Request(input, requestInit) : input, Env, executionCtx); - } - input = input.toString(); - return this.fetch( - new Request( - /^https?:\/\//.test(input) ? input : `http://localhost${mergePath("/", input)}`, - requestInit - ), - Env, - executionCtx - ); - }, "request"); - fire = /* @__PURE__ */ __name(() => { - addEventListener("fetch", (event) => { - event.respondWith(this.#dispatch(event.request, event, void 0, event.request.method)); - }); - }, "fire"); -}; - -// node_modules/hono/dist/router/reg-exp-router/index.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/router/reg-exp-router/router.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/router/reg-exp-router/node.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var LABEL_REG_EXP_STR = "[^/]+"; -var ONLY_WILDCARD_REG_EXP_STR = ".*"; -var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)"; -var PATH_ERROR = Symbol(); -var regExpMetaChars = new Set(".\\+*[^]$()"); -function compareKey(a, b) { - if (a.length === 1) { - return b.length === 1 ? a < b ? -1 : 1 : -1; - } - if (b.length === 1) { - return 1; - } - if (a === ONLY_WILDCARD_REG_EXP_STR || a === TAIL_WILDCARD_REG_EXP_STR) { - return 1; - } else if (b === ONLY_WILDCARD_REG_EXP_STR || b === TAIL_WILDCARD_REG_EXP_STR) { - return -1; - } - if (a === LABEL_REG_EXP_STR) { - return 1; - } else if (b === LABEL_REG_EXP_STR) { - return -1; - } - return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length; -} -__name(compareKey, "compareKey"); -var Node = class { - static { - __name(this, "Node"); - } - #index; - #varIndex; - #children = /* @__PURE__ */ Object.create(null); - insert(tokens, index, paramMap, context2, pathErrorCheckOnly) { - if (tokens.length === 0) { - if (this.#index !== void 0) { - throw PATH_ERROR; - } - if (pathErrorCheckOnly) { - return; - } - this.#index = index; - return; - } - const [token, ...restTokens] = tokens; - const pattern = token === "*" ? restTokens.length === 0 ? ["", "", ONLY_WILDCARD_REG_EXP_STR] : ["", "", LABEL_REG_EXP_STR] : token === "/*" ? ["", "", TAIL_WILDCARD_REG_EXP_STR] : token.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/); - let node; - if (pattern) { - const name = pattern[1]; - let regexpStr = pattern[2] || LABEL_REG_EXP_STR; - if (name && pattern[2]) { - if (regexpStr === ".*") { - throw PATH_ERROR; - } - regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:"); - if (/\((?!\?:)/.test(regexpStr)) { - throw PATH_ERROR; - } - } - node = this.#children[regexpStr]; - if (!node) { - if (Object.keys(this.#children).some( - (k) => k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR - )) { - throw PATH_ERROR; - } - if (pathErrorCheckOnly) { - return; - } - node = this.#children[regexpStr] = new Node(); - if (name !== "") { - node.#varIndex = context2.varIndex++; - } - } - if (!pathErrorCheckOnly && name !== "") { - paramMap.push([name, node.#varIndex]); - } - } else { - node = this.#children[token]; - if (!node) { - if (Object.keys(this.#children).some( - (k) => k.length > 1 && k !== ONLY_WILDCARD_REG_EXP_STR && k !== TAIL_WILDCARD_REG_EXP_STR - )) { - throw PATH_ERROR; - } - if (pathErrorCheckOnly) { - return; - } - node = this.#children[token] = new Node(); - } - } - node.insert(restTokens, index, paramMap, context2, pathErrorCheckOnly); - } - buildRegExpStr() { - const childKeys = Object.keys(this.#children).sort(compareKey); - const strList = childKeys.map((k) => { - const c = this.#children[k]; - return (typeof c.#varIndex === "number" ? `(${k})@${c.#varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + c.buildRegExpStr(); - }); - if (typeof this.#index === "number") { - strList.unshift(`#${this.#index}`); - } - if (strList.length === 0) { - return ""; - } - if (strList.length === 1) { - return strList[0]; - } - return "(?:" + strList.join("|") + ")"; - } -}; - -// node_modules/hono/dist/router/reg-exp-router/trie.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var Trie = class { - static { - __name(this, "Trie"); - } - #context = { varIndex: 0 }; - #root = new Node(); - insert(path, index, pathErrorCheckOnly) { - const paramAssoc = []; - const groups = []; - for (let i = 0; ; ) { - let replaced = false; - path = path.replace(/\{[^}]+\}/g, (m) => { - const mark = `@\\${i}`; - groups[i] = [mark, m]; - i++; - replaced = true; - return mark; - }); - if (!replaced) { - break; - } - } - const tokens = path.match(/(?::[^\/]+)|(?:\/\*$)|./g) || []; - for (let i = groups.length - 1; i >= 0; i--) { - const [mark] = groups[i]; - for (let j = tokens.length - 1; j >= 0; j--) { - if (tokens[j].indexOf(mark) !== -1) { - tokens[j] = tokens[j].replace(mark, groups[i][1]); - break; - } - } - } - this.#root.insert(tokens, index, paramAssoc, this.#context, pathErrorCheckOnly); - return paramAssoc; - } - buildRegExp() { - let regexp = this.#root.buildRegExpStr(); - if (regexp === "") { - return [/^$/, [], []]; - } - let captureIndex = 0; - const indexReplacementMap = []; - const paramReplacementMap = []; - regexp = regexp.replace(/#(\d+)|@(\d+)|\.\*\$/g, (_, handlerIndex, paramIndex) => { - if (handlerIndex !== void 0) { - indexReplacementMap[++captureIndex] = Number(handlerIndex); - return "$()"; - } - if (paramIndex !== void 0) { - paramReplacementMap[Number(paramIndex)] = ++captureIndex; - return ""; - } - return ""; - }); - return [new RegExp(`^${regexp}`), indexReplacementMap, paramReplacementMap]; - } -}; - -// node_modules/hono/dist/router/reg-exp-router/router.js -var emptyParam = []; -var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)]; -var wildcardRegExpCache = /* @__PURE__ */ Object.create(null); -function buildWildcardRegExp(path) { - return wildcardRegExpCache[path] ??= new RegExp( - path === "*" ? "" : `^${path.replace( - /\/\*$|([.\\+*[^\]$()])/g, - (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)" - )}$` - ); -} -__name(buildWildcardRegExp, "buildWildcardRegExp"); -function clearWildcardRegExpCache() { - wildcardRegExpCache = /* @__PURE__ */ Object.create(null); -} -__name(clearWildcardRegExpCache, "clearWildcardRegExpCache"); -function buildMatcherFromPreprocessedRoutes(routes) { - const trie = new Trie(); - const handlerData = []; - if (routes.length === 0) { - return nullMatcher; - } - const routesWithStaticPathFlag = routes.map( - (route) => [!/\*|\/:/.test(route[0]), ...route] - ).sort( - ([isStaticA, pathA], [isStaticB, pathB]) => isStaticA ? 1 : isStaticB ? -1 : pathA.length - pathB.length - ); - const staticMap = /* @__PURE__ */ Object.create(null); - for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) { - const [pathErrorCheckOnly, path, handlers] = routesWithStaticPathFlag[i]; - if (pathErrorCheckOnly) { - staticMap[path] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam]; - } else { - j++; - } - let paramAssoc; - try { - paramAssoc = trie.insert(path, j, pathErrorCheckOnly); - } catch (e) { - throw e === PATH_ERROR ? new UnsupportedPathError(path) : e; - } - if (pathErrorCheckOnly) { - continue; - } - handlerData[j] = handlers.map(([h, paramCount]) => { - const paramIndexMap = /* @__PURE__ */ Object.create(null); - paramCount -= 1; - for (; paramCount >= 0; paramCount--) { - const [key, value] = paramAssoc[paramCount]; - paramIndexMap[key] = value; - } - return [h, paramIndexMap]; - }); - } - const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp(); - for (let i = 0, len = handlerData.length; i < len; i++) { - for (let j = 0, len2 = handlerData[i].length; j < len2; j++) { - const map = handlerData[i][j]?.[1]; - if (!map) { - continue; - } - const keys = Object.keys(map); - for (let k = 0, len3 = keys.length; k < len3; k++) { - map[keys[k]] = paramReplacementMap[map[keys[k]]]; - } - } - } - const handlerMap = []; - for (const i in indexReplacementMap) { - handlerMap[i] = handlerData[indexReplacementMap[i]]; - } - return [regexp, handlerMap, staticMap]; -} -__name(buildMatcherFromPreprocessedRoutes, "buildMatcherFromPreprocessedRoutes"); -function findMiddleware(middleware, path) { - if (!middleware) { - return void 0; - } - for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) { - if (buildWildcardRegExp(k).test(path)) { - return [...middleware[k]]; - } - } - return void 0; -} -__name(findMiddleware, "findMiddleware"); -var RegExpRouter = class { - static { - __name(this, "RegExpRouter"); - } - name = "RegExpRouter"; - #middleware; - #routes; - constructor() { - this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) }; - this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) }; - } - add(method, path, handler) { - const middleware = this.#middleware; - const routes = this.#routes; - if (!middleware || !routes) { - throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT); - } - if (!middleware[method]) { - ; - [middleware, routes].forEach((handlerMap) => { - handlerMap[method] = /* @__PURE__ */ Object.create(null); - Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p) => { - handlerMap[method][p] = [...handlerMap[METHOD_NAME_ALL][p]]; - }); - }); - } - if (path === "/*") { - path = "*"; - } - const paramCount = (path.match(/\/:/g) || []).length; - if (/\*$/.test(path)) { - const re = buildWildcardRegExp(path); - if (method === METHOD_NAME_ALL) { - Object.keys(middleware).forEach((m) => { - middleware[m][path] ||= findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || []; - }); - } else { - middleware[method][path] ||= findMiddleware(middleware[method], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || []; - } - Object.keys(middleware).forEach((m) => { - if (method === METHOD_NAME_ALL || method === m) { - Object.keys(middleware[m]).forEach((p) => { - re.test(p) && middleware[m][p].push([handler, paramCount]); - }); - } - }); - Object.keys(routes).forEach((m) => { - if (method === METHOD_NAME_ALL || method === m) { - Object.keys(routes[m]).forEach( - (p) => re.test(p) && routes[m][p].push([handler, paramCount]) - ); - } - }); - return; - } - const paths = checkOptionalParameter(path) || [path]; - for (let i = 0, len = paths.length; i < len; i++) { - const path2 = paths[i]; - Object.keys(routes).forEach((m) => { - if (method === METHOD_NAME_ALL || method === m) { - routes[m][path2] ||= [ - ...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || [] - ]; - routes[m][path2].push([handler, paramCount - len + i + 1]); - } - }); - } - } - match(method, path) { - clearWildcardRegExpCache(); - const matchers = this.#buildAllMatchers(); - this.match = (method2, path2) => { - const matcher = matchers[method2] || matchers[METHOD_NAME_ALL]; - const staticMatch = matcher[2][path2]; - if (staticMatch) { - return staticMatch; - } - const match = path2.match(matcher[0]); - if (!match) { - return [[], emptyParam]; - } - const index = match.indexOf("", 1); - return [matcher[1][index], match]; - }; - return this.match(method, path); - } - #buildAllMatchers() { - const matchers = /* @__PURE__ */ Object.create(null); - Object.keys(this.#routes).concat(Object.keys(this.#middleware)).forEach((method) => { - matchers[method] ||= this.#buildMatcher(method); - }); - this.#middleware = this.#routes = void 0; - return matchers; - } - #buildMatcher(method) { - const routes = []; - let hasOwnRoute = method === METHOD_NAME_ALL; - [this.#middleware, this.#routes].forEach((r) => { - const ownRoute = r[method] ? Object.keys(r[method]).map((path) => [path, r[method][path]]) : []; - if (ownRoute.length !== 0) { - hasOwnRoute ||= true; - routes.push(...ownRoute); - } else if (method !== METHOD_NAME_ALL) { - routes.push( - ...Object.keys(r[METHOD_NAME_ALL]).map((path) => [path, r[METHOD_NAME_ALL][path]]) - ); - } - }); - if (!hasOwnRoute) { - return null; - } else { - return buildMatcherFromPreprocessedRoutes(routes); - } - } -}; - -// node_modules/hono/dist/router/smart-router/index.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/router/smart-router/router.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var SmartRouter = class { - static { - __name(this, "SmartRouter"); - } - name = "SmartRouter"; - #routers = []; - #routes = []; - constructor(init) { - this.#routers = init.routers; - } - add(method, path, handler) { - if (!this.#routes) { - throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT); - } - this.#routes.push([method, path, handler]); - } - match(method, path) { - if (!this.#routes) { - throw new Error("Fatal error"); - } - const routers = this.#routers; - const routes = this.#routes; - const len = routers.length; - let i = 0; - let res; - for (; i < len; i++) { - const router15 = routers[i]; - try { - for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) { - router15.add(...routes[i2]); - } - res = router15.match(method, path); - } catch (e) { - if (e instanceof UnsupportedPathError) { - continue; - } - throw e; - } - this.match = router15.match.bind(router15); - this.#routers = [router15]; - this.#routes = void 0; - break; - } - if (i === len) { - throw new Error("Fatal error"); - } - this.name = `SmartRouter + ${this.activeRouter.name}`; - return res; - } - get activeRouter() { - if (this.#routes || this.#routers.length !== 1) { - throw new Error("No active router has been determined yet."); - } - return this.#routers[0]; - } -}; - -// node_modules/hono/dist/router/trie-router/index.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/router/trie-router/router.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/router/trie-router/node.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var emptyParams = /* @__PURE__ */ Object.create(null); -var Node2 = class { - static { - __name(this, "Node"); - } - #methods; - #children; - #patterns; - #order = 0; - #params = emptyParams; - constructor(method, handler, children) { - this.#children = children || /* @__PURE__ */ Object.create(null); - this.#methods = []; - if (method && handler) { - const m = /* @__PURE__ */ Object.create(null); - m[method] = { handler, possibleKeys: [], score: 0 }; - this.#methods = [m]; - } - this.#patterns = []; - } - insert(method, path, handler) { - this.#order = ++this.#order; - let curNode = this; - const parts = splitRoutingPath(path); - const possibleKeys = []; - for (let i = 0, len = parts.length; i < len; i++) { - const p = parts[i]; - const nextP = parts[i + 1]; - const pattern = getPattern(p, nextP); - const key = Array.isArray(pattern) ? pattern[0] : p; - if (key in curNode.#children) { - curNode = curNode.#children[key]; - if (pattern) { - possibleKeys.push(pattern[1]); - } - continue; - } - curNode.#children[key] = new Node2(); - if (pattern) { - curNode.#patterns.push(pattern); - possibleKeys.push(pattern[1]); - } - curNode = curNode.#children[key]; - } - curNode.#methods.push({ - [method]: { - handler, - possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i), - score: this.#order - } - }); - return curNode; - } - #getHandlerSets(node, method, nodeParams, params) { - const handlerSets = []; - for (let i = 0, len = node.#methods.length; i < len; i++) { - const m = node.#methods[i]; - const handlerSet = m[method] || m[METHOD_NAME_ALL]; - const processedSet = {}; - if (handlerSet !== void 0) { - handlerSet.params = /* @__PURE__ */ Object.create(null); - handlerSets.push(handlerSet); - if (nodeParams !== emptyParams || params && params !== emptyParams) { - for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) { - const key = handlerSet.possibleKeys[i2]; - const processed = processedSet[handlerSet.score]; - handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key]; - processedSet[handlerSet.score] = true; - } - } - } - } - return handlerSets; - } - search(method, path) { - const handlerSets = []; - this.#params = emptyParams; - const curNode = this; - let curNodes = [curNode]; - const parts = splitPath(path); - const curNodesQueue = []; - for (let i = 0, len = parts.length; i < len; i++) { - const part = parts[i]; - const isLast = i === len - 1; - const tempNodes = []; - for (let j = 0, len2 = curNodes.length; j < len2; j++) { - const node = curNodes[j]; - const nextNode = node.#children[part]; - if (nextNode) { - nextNode.#params = node.#params; - if (isLast) { - if (nextNode.#children["*"]) { - handlerSets.push( - ...this.#getHandlerSets(nextNode.#children["*"], method, node.#params) - ); - } - handlerSets.push(...this.#getHandlerSets(nextNode, method, node.#params)); - } else { - tempNodes.push(nextNode); - } - } - for (let k = 0, len3 = node.#patterns.length; k < len3; k++) { - const pattern = node.#patterns[k]; - const params = node.#params === emptyParams ? {} : { ...node.#params }; - if (pattern === "*") { - const astNode = node.#children["*"]; - if (astNode) { - handlerSets.push(...this.#getHandlerSets(astNode, method, node.#params)); - astNode.#params = params; - tempNodes.push(astNode); - } - continue; - } - const [key, name, matcher] = pattern; - if (!part && !(matcher instanceof RegExp)) { - continue; - } - const child = node.#children[key]; - const restPathString = parts.slice(i).join("/"); - if (matcher instanceof RegExp) { - const m = matcher.exec(restPathString); - if (m) { - params[name] = m[0]; - handlerSets.push(...this.#getHandlerSets(child, method, node.#params, params)); - if (Object.keys(child.#children).length) { - child.#params = params; - const componentCount = m[0].match(/\//)?.length ?? 0; - const targetCurNodes = curNodesQueue[componentCount] ||= []; - targetCurNodes.push(child); - } - continue; - } - } - if (matcher === true || matcher.test(part)) { - params[name] = part; - if (isLast) { - handlerSets.push(...this.#getHandlerSets(child, method, params, node.#params)); - if (child.#children["*"]) { - handlerSets.push( - ...this.#getHandlerSets(child.#children["*"], method, params, node.#params) - ); - } - } else { - child.#params = params; - tempNodes.push(child); - } - } - } - } - curNodes = tempNodes.concat(curNodesQueue.shift() ?? []); - } - if (handlerSets.length > 1) { - handlerSets.sort((a, b) => { - return a.score - b.score; - }); - } - return [handlerSets.map(({ handler, params }) => [handler, params])]; - } -}; - -// node_modules/hono/dist/router/trie-router/router.js -var TrieRouter = class { - static { - __name(this, "TrieRouter"); - } - name = "TrieRouter"; - #node; - constructor() { - this.#node = new Node2(); - } - add(method, path, handler) { - const results = checkOptionalParameter(path); - if (results) { - for (let i = 0, len = results.length; i < len; i++) { - this.#node.insert(method, results[i], handler); - } - return; - } - this.#node.insert(method, path, handler); - } - match(method, path) { - return this.#node.search(method, path); - } -}; - -// node_modules/hono/dist/hono.js -var Hono2 = class extends Hono { - static { - __name(this, "Hono"); - } - constructor(options = {}) { - super(options); - this.router = options.router ?? new SmartRouter({ - routers: [new RegExpRouter(), new TrieRouter()] - }); - } -}; - -// src/middleware/cors.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/hono/dist/middleware/cors/index.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var cors = /* @__PURE__ */ __name((options) => { - const defaults = { - origin: "*", - allowMethods: ["GET", "HEAD", "PUT", "POST", "DELETE", "PATCH"], - allowHeaders: [], - exposeHeaders: [] - }; - const opts = { - ...defaults, - ...options - }; - const findAllowOrigin = ((optsOrigin) => { - if (typeof optsOrigin === "string") { - if (optsOrigin === "*") { - return () => optsOrigin; - } else { - return (origin) => optsOrigin === origin ? origin : null; - } - } else if (typeof optsOrigin === "function") { - return optsOrigin; - } else { - return (origin) => optsOrigin.includes(origin) ? origin : null; - } - })(opts.origin); - const findAllowMethods = ((optsAllowMethods) => { - if (typeof optsAllowMethods === "function") { - return optsAllowMethods; - } else if (Array.isArray(optsAllowMethods)) { - return () => optsAllowMethods; - } else { - return () => []; - } - })(opts.allowMethods); - return /* @__PURE__ */ __name(async function cors2(c, next) { - function set(key, value) { - c.res.headers.set(key, value); - } - __name(set, "set"); - const allowOrigin = await findAllowOrigin(c.req.header("origin") || "", c); - if (allowOrigin) { - set("Access-Control-Allow-Origin", allowOrigin); - } - if (opts.origin !== "*") { - const existingVary = c.req.header("Vary"); - if (existingVary) { - set("Vary", existingVary); - } else { - set("Vary", "Origin"); - } - } - if (opts.credentials) { - set("Access-Control-Allow-Credentials", "true"); - } - if (opts.exposeHeaders?.length) { - set("Access-Control-Expose-Headers", opts.exposeHeaders.join(",")); - } - if (c.req.method === "OPTIONS") { - if (opts.maxAge != null) { - set("Access-Control-Max-Age", opts.maxAge.toString()); - } - const allowMethods = await findAllowMethods(c.req.header("origin") || "", c); - if (allowMethods.length) { - set("Access-Control-Allow-Methods", allowMethods.join(",")); - } - let headers = opts.allowHeaders; - if (!headers?.length) { - const requestHeaders = c.req.header("Access-Control-Request-Headers"); - if (requestHeaders) { - headers = requestHeaders.split(/\s*,\s*/); - } - } - if (headers?.length) { - set("Access-Control-Allow-Headers", headers.join(",")); - c.res.headers.append("Vary", "Access-Control-Request-Headers"); - } - c.res.headers.delete("Content-Length"); - c.res.headers.delete("Content-Type"); - return new Response(null, { - headers: c.res.headers, - status: 204, - statusText: "No Content" - }); - } - await next(); - }, "cors2"); -}, "cors"); - -// src/middleware/cors.js -init_config(); -function createCorsMiddleware(env2 = {}) { - const origins = getCorsOrigins(env2); - const originConfig = origins.length === 1 && origins[0] === "*" ? "*" : (origin) => { - const requestOrigin = origin; - if (origins.includes("*") || origins.includes(requestOrigin)) { - return requestOrigin; - } - return origins[0]; - }; - return cors({ - origin: originConfig, - allowMethods: CORS_ALLOWED_METHODS, - allowHeaders: CORS_ALLOWED_HEADERS, - credentials: true - }); -} -__name(createCorsMiddleware, "createCorsMiddleware"); - -// src/middleware/errorHandler.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/utils/errors.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var APIError = class extends Error { - static { - __name(this, "APIError"); - } - constructor(message, statusCode = 500, details = null) { - super(message); - this.name = "APIError"; - this.statusCode = statusCode; - this.details = details; - } - toJSON() { - return { - error: this.message, - status: this.statusCode, - ...this.details && { details: this.details } - }; - } -}; -var ValidationError = class extends APIError { - static { - __name(this, "ValidationError"); - } - constructor(message, details = null) { - super(message, 400, details); - this.name = "ValidationError"; - } -}; -var AuthenticationError = class extends APIError { - static { - __name(this, "AuthenticationError"); - } - constructor(message = "Authentication required") { - super(message, 401); - this.name = "AuthenticationError"; - } -}; -var NotFoundError = class extends APIError { - static { - __name(this, "NotFoundError"); - } - constructor(message = "Resource not found") { - super(message, 404); - this.name = "NotFoundError"; - } -}; - -// src/middleware/errorHandler.js -function errorHandler2(error3, c) { - console.error("Error in request handler:", error3); - if (error3 instanceof APIError) { - return c.json(error3.toJSON(), error3.statusCode); - } - if (error3.name === "ValidationError" || error3.status === 400) { - return c.json({ - error: error3.message || "Validation error", - status: 400 - }, 400); - } - if (error3.name === "AuthenticationError" || error3.status === 401) { - return c.json({ - error: error3.message || "Authentication required", - status: 401 - }, 401); - } - if (error3.name === "NotFoundError" || error3.status === 404) { - return c.json({ - error: error3.message || "Resource not found", - status: 404 - }, 404); - } - return c.json({ - error: error3.message || "Internal server error", - status: 500 - }, 500); -} -__name(errorHandler2, "errorHandler"); -function asyncHandler(fn) { - return async (c, next) => { - try { - return await fn(c, next); - } catch (error3) { - return errorHandler2(error3, c); - } - }; -} -__name(asyncHandler, "asyncHandler"); - -// src/middleware/auth.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -init_kv(); - -// src/utils/crypto.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -function getCrypto() { - const cryptoObj = typeof globalThis !== "undefined" ? globalThis.crypto : null; - if (!cryptoObj) { - throw new Error("Web Crypto API is not available in this environment"); - } - return cryptoObj; -} -__name(getCrypto, "getCrypto"); -function randomHex(bytes = 16) { - const cryptoObj = getCrypto(); - if (typeof cryptoObj.getRandomValues !== "function") { - throw new Error("crypto.getRandomValues is not available"); - } - const buffer = new Uint8Array(bytes); - cryptoObj.getRandomValues(buffer); - return Array.from(buffer, (b) => b.toString(16).padStart(2, "0")).join(""); -} -__name(randomHex, "randomHex"); -function generateSessionToken() { - const cryptoObj = getCrypto(); - if (typeof cryptoObj.randomUUID === "function") { - return cryptoObj.randomUUID().replace(/-/g, ""); - } - return randomHex(32); -} -__name(generateSessionToken, "generateSessionToken"); -async function hashToken(token) { - if (typeof token !== "string" || token.length === 0) { - throw new Error("Token must be a non-empty string for hashing"); - } - const cryptoObj = getCrypto(); - if (!cryptoObj.subtle || typeof cryptoObj.subtle.digest !== "function") { - throw new Error("Web Crypto API is not available for hashing tokens"); - } - const encoder = new TextEncoder(); - const data = encoder.encode(token); - const digest = await cryptoObj.subtle.digest("SHA-256", data); - const hashArray = Array.from(new Uint8Array(digest)); - return hashArray.map((b) => b.toString(16).padStart(2, "0")).join(""); -} -__name(hashToken, "hashToken"); -async function hashPassword(password, salt, iterations = 1e5) { - const cryptoObj = getCrypto(); - if (!cryptoObj.subtle) { - throw new Error("Web Crypto API is not available for password hashing"); - } - const encoder = new TextEncoder(); - const passwordData = encoder.encode(password); - const saltBytes = new Uint8Array(salt.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))); - const keyMaterial = await cryptoObj.subtle.importKey( - "raw", - passwordData, - { name: "PBKDF2" }, - false, - ["deriveBits"] - ); - const derivedBits = await cryptoObj.subtle.deriveBits( - { - name: "PBKDF2", - salt: saltBytes, - iterations, - hash: "SHA-256" - }, - keyMaterial, - 256 - // 256 bits = 32 bytes - ); - return Array.from(new Uint8Array(derivedBits)).map((b) => b.toString(16).padStart(2, "0")).join(""); -} -__name(hashPassword, "hashPassword"); -async function verifyPassword(password, hash) { - try { - const [iterationsStr, salt, expectedHash] = hash.split(":"); - const iterations = parseInt(iterationsStr, 10); - if (!iterations || !salt || !expectedHash) { - return false; - } - const computedHash = await hashPassword(password, salt, iterations); - return computedHash === expectedHash; - } catch (error3) { - return false; - } -} -__name(verifyPassword, "verifyPassword"); -function generateSalt(bytes = 16) { - return randomHex(bytes); -} -__name(generateSalt, "generateSalt"); -async function hashPasswordWithSalt(password, iterations = 1e5) { - const salt = generateSalt(16); - const hash = await hashPassword(password, salt, iterations); - return `${iterations}:${salt}:${hash}`; -} -__name(hashPasswordWithSalt, "hashPasswordWithSalt"); - -// src/middleware/auth.js -init_config(); -async function verifyAdminAuth(request, env2) { - let adminToken; - try { - if (request && typeof request.header === "function") { - adminToken = request.header("X-Admin-Token") || request.header("x-admin-token"); - } else if (request && request.headers && typeof request.headers.get === "function") { - adminToken = request.headers.get("X-Admin-Token") || request.headers.get("x-admin-token"); - } else if (request && request.raw && request.raw.headers && typeof request.raw.headers.get === "function") { - adminToken = request.raw.headers.get("X-Admin-Token") || request.raw.headers.get("x-admin-token"); - } - } catch (e) { - console.error("Auth middleware - error reading admin token header:", e); - } - if (!adminToken) { - return { - isValid: false, - error: "Admin authentication required", - status: 401 - }; - } - try { - const kvNamespace = getKVNamespace(env2); - if (!kvNamespace) { - console.error("Auth middleware - KV namespace is undefined"); - return { - isValid: false, - error: "KV namespace not available", - status: 500 - }; - } - const hashedToken = await hashToken(adminToken); - const storageKey = `${KV_KEYS.ADMIN_TOKEN_PREFIX}${hashedToken}`; - const tokenData = await kvNamespace.get(storageKey); - if (!tokenData) { - return { - isValid: false, - error: "Invalid or expired admin token", - status: 401 - }; - } - const tokenTime = parseInt(tokenData); - const now = Date.now(); - if (now - tokenTime > ADMIN_TOKEN_TTL_MS) { - await kvNamespace.delete(storageKey); - return { - isValid: false, - error: "Admin session expired", - status: 401 - }; - } - return { isValid: true }; - } catch (error3) { - console.error("Admin auth verification error:", error3); - return { - isValid: false, - error: "Authentication verification failed", - status: 500 - }; - } -} -__name(verifyAdminAuth, "verifyAdminAuth"); - -// src/routes/index.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/routes/public/products.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/services/ProductService.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/lib/kv.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var KVManager = class { - static { - __name(this, "KVManager"); - } - constructor(namespace) { - this.namespace = namespace; - } - // Product operations - async createProduct(product) { - const key = `product:${product.id}`; - const productData = { - ...product, - images: Array.isArray(product.images) ? product.images : product.imageUrl ? [product.imageUrl] : [] - }; - await this.namespace.put(key, JSON.stringify(productData)); - const productIds = await this.namespace.get("products:all"); - const existingIds = productIds ? JSON.parse(productIds) : []; - existingIds.push(product.id); - await this.namespace.put("products:all", JSON.stringify(existingIds)); - return productData; - } - async getProduct(id) { - const key = `product:${id}`; - const product = await this.namespace.get(key); - return product ? JSON.parse(product) : null; - } - async updateProduct(id, updates) { - const existing = await this.getProduct(id); - if (!existing) throw new Error("Product not found"); - const updated = { - ...existing, - ...updates, - // Ensure images is always an array - images: Array.isArray(updates.images) ? updates.images : updates.imageUrl ? [updates.imageUrl] : existing.images || [] - }; - const key = `product:${id}`; - await this.namespace.put(key, JSON.stringify(updated)); - return updated; - } - async deleteProduct(id) { - const key = `product:${id}`; - await this.namespace.delete(key); - const productIds = await this.namespace.get("products:all"); - if (productIds) { - const existingIds = JSON.parse(productIds); - const filtered = existingIds.filter((pid2) => pid2 !== id); - await this.namespace.put("products:all", JSON.stringify(filtered)); - } - } - async getAllProducts() { - const productIds = await this.namespace.get("products:all"); - if (!productIds) return []; - const ids = JSON.parse(productIds); - const products = await Promise.all( - ids.map((id) => this.getProduct(id)) - ); - return products.filter(Boolean); - } - // Collection operations - async createCollection(collection) { - const key = `collection:${collection.id}`; - await this.namespace.put(key, JSON.stringify(collection)); - const collectionIds = await this.namespace.get("collections:all"); - const existingIds = collectionIds ? JSON.parse(collectionIds) : []; - existingIds.push(collection.id); - await this.namespace.put("collections:all", JSON.stringify(existingIds)); - return collection; - } - async getCollection(id) { - const key = `collection:${id}`; - const collection = await this.namespace.get(key); - return collection ? JSON.parse(collection) : null; - } - async updateCollection(id, updates) { - const existing = await this.getCollection(id); - if (!existing) throw new Error("Collection not found"); - const updated = { ...existing, ...updates }; - const key = `collection:${id}`; - await this.namespace.put(key, JSON.stringify(updated)); - return updated; - } - async deleteCollection(id) { - const key = `collection:${id}`; - await this.namespace.delete(key); - const collectionIds = await this.namespace.get("collections:all"); - if (collectionIds) { - const existingIds = JSON.parse(collectionIds); - const filtered = existingIds.filter((cid) => cid !== id); - await this.namespace.put("collections:all", JSON.stringify(filtered)); - } - } - async getAllCollections() { - const collectionIds = await this.namespace.get("collections:all"); - if (!collectionIds) return []; - const ids = JSON.parse(collectionIds); - const collections = await Promise.all( - ids.map((id) => this.getCollection(id)) - ); - return collections.filter(Boolean); - } - async getProductsByCollection(collectionId) { - const allProducts = await this.getAllProducts(); - return allProducts.filter((product) => product.collectionId === collectionId); - } - // Media operations - async createMediaItem(item) { - const id = item.id; - if (!id) throw new Error("Media item missing id"); - const key = `media:${id}`; - const record = { - id, - url: String(item.url || ""), - source: item.source || "unknown", - filename: item.filename || "", - mimeType: item.mimeType || "", - driveFileId: item.driveFileId || "", - createdAt: typeof item.createdAt === "number" ? item.createdAt : Date.now(), - updatedAt: Date.now() - }; - await this.namespace.put(key, JSON.stringify(record)); - const listKey = "media:all"; - const existing = await this.namespace.get(listKey); - const ids = existing ? JSON.parse(existing) : []; - if (!ids.includes(id)) ids.push(id); - await this.namespace.put(listKey, JSON.stringify(ids)); - return record; - } - async getMediaItem(id) { - const key = `media:${id}`; - const raw2 = await this.namespace.get(key); - return raw2 ? JSON.parse(raw2) : null; - } - async deleteMediaItem(id) { - const key = `media:${id}`; - await this.namespace.delete(key); - const listKey = "media:all"; - const existing = await this.namespace.get(listKey); - if (existing) { - const ids = JSON.parse(existing); - const next = ids.filter((mid) => mid !== id); - await this.namespace.put(listKey, JSON.stringify(next)); - } - } - async getAllMediaItems() { - const listKey = "media:all"; - const existing = await this.namespace.get(listKey); - if (!existing) return []; - const ids = JSON.parse(existing); - const items = await Promise.all(ids.map((id) => this.getMediaItem(id))); - return items.filter(Boolean); - } -}; - -// src/services/ProductService.js -var ProductService = class { - static { - __name(this, "ProductService"); - } - constructor(kvNamespace) { - this.kv = new KVManager(kvNamespace); - } - /** - * Get all products (excluding archived) - */ - async getAllProducts() { - const products = await this.kv.getAllProducts(); - return products.filter((p) => !p.archived); - } - /** - * Get all products including archived (for admin) - */ - async getAllProductsAdmin() { - return await this.kv.getAllProducts(); - } - /** - * Get single product by ID - */ - async getProduct(id) { - const product = await this.kv.getProduct(id); - if (!product) { - throw new NotFoundError("Product not found"); - } - return product; - } - /** - * Create a new product - */ - async createProduct(productData) { - return await this.kv.createProduct(productData); - } - /** - * Update an existing product - */ - async updateProduct(id, updates) { - const existing = await this.kv.getProduct(id); - if (!existing) { - throw new NotFoundError("Product not found"); - } - return await this.kv.updateProduct(id, updates); - } - /** - * Delete a product - */ - async deleteProduct(id) { - const existing = await this.kv.getProduct(id); - if (!existing) { - throw new NotFoundError("Product not found"); - } - await this.kv.deleteProduct(id); - } - /** - * Get products by collection ID - */ - async getProductsByCollection(collectionId) { - const products = await this.kv.getProductsByCollection(collectionId); - return products.filter((p) => !p.archived); - } -}; - -// src/routes/public/products.js -init_kv(); -var router = new Hono2(); -router.get("/", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const productService = new ProductService(kvNamespace); - const products = await productService.getAllProducts(); - return c.json(products); -})); -router.get("/:id", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const productService = new ProductService(kvNamespace); - const product = await productService.getProduct(c.req.param("id")); - return c.json(product); -})); -var products_default = router; - -// src/routes/public/collections.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/services/CollectionService.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var CollectionService = class { - static { - __name(this, "CollectionService"); - } - constructor(kvNamespace) { - this.kv = new KVManager(kvNamespace); - } - /** - * Get all collections (excluding archived) - */ - async getAllCollections() { - const collections = await this.kv.getAllCollections(); - return collections.filter((col) => !col.archived); - } - /** - * Get all collections including archived (for admin) - */ - async getAllCollectionsAdmin() { - return await this.kv.getAllCollections(); - } - /** - * Get single collection by ID - */ - async getCollection(id) { - const collection = await this.kv.getCollection(id); - if (!collection) { - throw new NotFoundError("Collection not found"); - } - return collection; - } - /** - * Create a new collection - */ - async createCollection(collectionData) { - return await this.kv.createCollection(collectionData); - } - /** - * Update an existing collection - */ - async updateCollection(id, updates) { - const existing = await this.kv.getCollection(id); - if (!existing) { - throw new NotFoundError("Collection not found"); - } - return await this.kv.updateCollection(id, updates); - } - /** - * Delete a collection - */ - async deleteCollection(id) { - const existing = await this.kv.getCollection(id); - if (!existing) { - throw new NotFoundError("Collection not found"); - } - await this.kv.deleteCollection(id); - } - /** - * Get products in a collection (with archived check) - */ - async getProductsInCollection(collectionId) { - const collection = await this.kv.getCollection(collectionId); - if (!collection) { - throw new NotFoundError("Collection not found"); - } - const products = await this.kv.getProductsByCollection(collectionId); - if (collection.archived) { - return []; - } - return products.filter((p) => !p.archived); - } -}; - -// src/routes/public/collections.js -init_kv(); -var router2 = new Hono2(); -router2.get("/", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const collectionService = new CollectionService(kvNamespace); - const collections = await collectionService.getAllCollections(); - return c.json(collections); -})); -router2.get("/:id", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const collectionService = new CollectionService(kvNamespace); - const collection = await collectionService.getCollection(c.req.param("id")); - return c.json(collection); -})); -router2.get("/:id/products", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const collectionService = new CollectionService(kvNamespace); - const products = await collectionService.getProductsInCollection(c.req.param("id")); - return c.json(products); -})); -var collections_default = router2; - -// src/routes/public/storefront.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/services/ThemeService.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -init_kv(); - -// src/lib/theme.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var BASE_RADIUS_PX = 12; -var THEME_KV_KEY = "storefront:theme"; -var HEX_COLOR_REGEX = /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/; -var FONT_OPTIONS = [ - { - id: "inter", - label: "Inter", - stack: "'Inter', 'system-ui', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif" - }, - { - id: "roboto", - label: "Roboto", - stack: "'Roboto', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif" - }, - { - id: "montserrat", - label: "Montserrat", - stack: "'Montserrat', 'Segoe UI', sans-serif" - }, - { - id: "poppins", - label: "Poppins", - stack: "'Poppins', 'Segoe UI', sans-serif" - }, - { - id: "lora", - label: "Lora", - stack: "'Lora', 'Georgia', serif" - } -]; -var FONT_LOOKUP = FONT_OPTIONS.reduce((acc, option) => { - acc[option.id] = option; - return acc; -}, {}); -var DEFAULT_STORE_THEME = { - colors: { - primary: "#1e293b", - secondary: "#475569", - accent: "#3b82f6", - text: "#0f172a", - background: "#f8fafc", - card: "#ffffff" - }, - typography: { - fontId: "inter" - }, - corners: { - enabled: true, - radiusMultiplier: 1 - } -}; -function clamp(value, min, max) { - return Math.min(Math.max(value, min), max); -} -__name(clamp, "clamp"); -function hexToRgb(hex) { - if (!hex) return null; - const normalized = hex.length === 4 ? `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}` : hex; - const value = normalized.replace("#", ""); - const int = parseInt(value, 16); - if (Number.isNaN(int)) return null; - return { - r: int >> 16 & 255, - g: int >> 8 & 255, - b: int & 255 - }; -} -__name(hexToRgb, "hexToRgb"); -function rgbToHex({ r, g, b }) { - const toHex = /* @__PURE__ */ __name((channel2) => channel2.toString(16).padStart(2, "0"), "toHex"); - return `#${toHex(clamp(Math.round(channelSafe(r)), 0, 255))}${toHex(clamp(Math.round(channelSafe(g)), 0, 255))}${toHex(clamp(Math.round(channelSafe(b)), 0, 255))}`; -} -__name(rgbToHex, "rgbToHex"); -function channelSafe(value) { - return Number.isFinite(value) ? value : 0; -} -__name(channelSafe, "channelSafe"); -function mixChannel(channel2, target, factor) { - return channel2 + (target - channel2) * factor; -} -__name(mixChannel, "mixChannel"); -function lighten(hex, factor = 0.1) { - const rgb = hexToRgb(hex); - if (!rgb) return hex; - return rgbToHex({ - r: mixChannel(rgb.r, 255, factor), - g: mixChannel(rgb.g, 255, factor), - b: mixChannel(rgb.b, 255, factor) - }); -} -__name(lighten, "lighten"); -function darken(hex, factor = 0.1) { - const rgb = hexToRgb(hex); - if (!rgb) return hex; - return rgbToHex({ - r: mixChannel(rgb.r, 0, factor), - g: mixChannel(rgb.g, 0, factor), - b: mixChannel(rgb.b, 0, factor) - }); -} -__name(darken, "darken"); -function getContrastColor(hex) { - const rgb = hexToRgb(hex); - if (!rgb) return "#ffffff"; - const luminance = (0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b) / 255; - return luminance > 0.6 ? "#0f172a" : "#ffffff"; -} -__name(getContrastColor, "getContrastColor"); -function ensureHex(color, fallback) { - if (typeof color !== "string") return fallback; - return HEX_COLOR_REGEX.test(color.trim()) ? color.trim() : fallback; -} -__name(ensureHex, "ensureHex"); -function ensureFontId(fontId) { - return FONT_LOOKUP[fontId] ? fontId : DEFAULT_STORE_THEME.typography.fontId; -} -__name(ensureFontId, "ensureFontId"); -function ensureRadiusMultiplier(value) { - if (typeof value === "string" && value.trim() !== "") { - const parsed = Number(value); - if (!Number.isNaN(parsed)) { - value = parsed; - } - } - if (typeof value !== "number" || Number.isNaN(value)) { - value = DEFAULT_STORE_THEME.corners.radiusMultiplier; - } - return clamp(Math.abs(value), 0, 4); -} -__name(ensureRadiusMultiplier, "ensureRadiusMultiplier"); -function sanitizeThemeInput(partialTheme = {}) { - const colors = partialTheme.colors || {}; - const typography = partialTheme.typography || partialTheme.font; - const corners = partialTheme.corners || partialTheme.radius; - const sanitizedColors = { - primary: ensureHex(colors.primary, DEFAULT_STORE_THEME.colors.primary), - secondary: ensureHex(colors.secondary, DEFAULT_STORE_THEME.colors.secondary), - accent: ensureHex(colors.accent, DEFAULT_STORE_THEME.colors.accent), - text: ensureHex(colors.text, DEFAULT_STORE_THEME.colors.text), - background: ensureHex(colors.background, DEFAULT_STORE_THEME.colors.background), - card: ensureHex(colors.card, DEFAULT_STORE_THEME.colors.card) - }; - const sanitizedTypography = { - fontId: ensureFontId(typography?.fontId ?? typography?.font ?? typography?.id) - }; - const sanitizedCorners = { - enabled: corners?.enabled !== void 0 ? Boolean(corners.enabled) : DEFAULT_STORE_THEME.corners.enabled, - radiusMultiplier: ensureRadiusMultiplier(corners?.radiusMultiplier ?? corners?.multiplier ?? corners?.value) - }; - return { - colors: sanitizedColors, - typography: sanitizedTypography, - corners: sanitizedCorners - }; -} -__name(sanitizeThemeInput, "sanitizeThemeInput"); -function deriveThemeDetails(theme) { - const { colors, typography, corners } = theme; - const { fontId } = typography; - const fontOption = FONT_LOOKUP[fontId] || FONT_LOOKUP[DEFAULT_STORE_THEME.typography.fontId]; - const radiusBase = corners.enabled ? corners.radiusMultiplier * BASE_RADIUS_PX : 0; - const derivedColors = { - onPrimary: getContrastColor(colors.primary), - onSecondary: getContrastColor(colors.secondary), - primaryHover: darken(colors.primary, 0.12), - secondaryHover: darken(colors.secondary, 0.12), - accentSoft: lighten(colors.accent, 0.4), - background: colors.background, - surface: "#ffffff", - mutedText: lighten(colors.text, 0.35) - }; - return { - colors: derivedColors, - typography: { - fontFamily: fontOption.stack, - fontLabel: fontOption.label - }, - corners: { - radiusPx: radiusBase, - radiusSm: corners.enabled ? Math.max(radiusBase * 0.5, 2) : 0, - radiusLg: corners.enabled ? radiusBase * 1.5 : 0 - } - }; -} -__name(deriveThemeDetails, "deriveThemeDetails"); -function buildCssVariables(theme) { - const base = sanitizeThemeInput(theme); - const derived = deriveThemeDetails(base); - return { - "--storefront-color-primary": base.colors.primary, - "--storefront-color-primary-hover": derived.colors.primaryHover, - "--storefront-color-primary-contrast": derived.colors.onPrimary, - "--storefront-color-secondary": base.colors.secondary, - "--storefront-color-secondary-hover": derived.colors.secondaryHover, - "--storefront-color-secondary-contrast": derived.colors.onSecondary, - "--storefront-color-accent": base.colors.accent, - "--storefront-color-accent-soft": derived.colors.accentSoft, - "--storefront-color-text": base.colors.text, - "--storefront-color-text-muted": derived.colors.mutedText, - "--storefront-color-background": derived.colors.background, - "--storefront-color-surface": derived.colors.surface, - "--storefront-color-card": base.colors.card, - "--storefront-font-family": derived.typography.fontFamily, - "--storefront-radius-base": `${derived.corners.radiusPx}px`, - "--storefront-radius-sm": `${derived.corners.radiusSm}px`, - "--storefront-radius-lg": `${derived.corners.radiusLg}px` - }; -} -__name(buildCssVariables, "buildCssVariables"); -function resolveStorefrontTheme(partialTheme = {}) { - const sanitized = sanitizeThemeInput(partialTheme.theme ?? partialTheme); - const merged = { - ...DEFAULT_STORE_THEME, - ...sanitized, - colors: { - ...DEFAULT_STORE_THEME.colors, - ...sanitized.colors - }, - typography: { - ...DEFAULT_STORE_THEME.typography, - ...sanitized.typography - }, - corners: { - ...DEFAULT_STORE_THEME.corners, - ...sanitized.corners - } - }; - const { typography, corners } = deriveThemeDetails(merged); - return { - ...merged, - typography: { - ...merged.typography, - fontFamily: typography.fontFamily, - fontLabel: typography.fontLabel - }, - corners: { - ...merged.corners, - radiusPx: corners.radiusPx, - radiusSm: corners.radiusSm, - radiusLg: corners.radiusLg - }, - meta: { - updatedAt: partialTheme.updatedAt ?? null - }, - cssVariables: buildCssVariables(merged) - }; -} -__name(resolveStorefrontTheme, "resolveStorefrontTheme"); - -// src/services/ThemeService.js -var ThemeService = class { - static { - __name(this, "ThemeService"); - } - constructor(env2) { - this.env = env2; - this.kv = getKVNamespace(env2); - } - /** - * Get storefront theme - */ - async getTheme() { - try { - const kvTheme = this.kv ? await this.kv.get(THEME_KV_KEY) : null; - let storedTheme = null; - if (kvTheme) { - try { - storedTheme = JSON.parse(kvTheme); - } catch (parseError) { - console.error("Invalid theme JSON in KV, falling back to defaults:", parseError); - } - } - return resolveStorefrontTheme(storedTheme || DEFAULT_STORE_THEME); - } catch (error3) { - console.error("Error fetching storefront theme:", error3); - return resolveStorefrontTheme(DEFAULT_STORE_THEME); - } - } - /** - * Update storefront theme - */ - async updateTheme(payload) { - if (!this.kv) { - throw new Error("KV namespace unavailable"); - } - const sanitized = sanitizeThemeInput(payload); - const record = { - theme: sanitized, - updatedAt: Date.now() - }; - await this.kv.put(THEME_KV_KEY, JSON.stringify(record)); - return resolveStorefrontTheme(record); - } - /** - * Reset storefront theme to defaults - */ - async resetTheme() { - if (!this.kv) { - throw new Error("KV namespace unavailable"); - } - await this.kv.delete(THEME_KV_KEY); - return resolveStorefrontTheme(DEFAULT_STORE_THEME); - } -}; - -// src/services/StoreSettingsService.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -init_config(); -var DEFAULT_SETTINGS = { - logoType: "text", - logoText: "OpenShop", - logoImageUrl: "", - storeName: "OpenShop", - storeDescription: "Your amazing online store", - heroImageUrl: "", - heroTitle: "Welcome to OpenShop", - heroSubtitle: "Discover amazing products at unbeatable prices. Built on Cloudflare for lightning-fast performance.", - contactEmail: "contact@example.com", - businessName: "", - businessAddressLine1: "", - businessAddressLine2: "", - businessCity: "", - businessState: "", - businessPostalCode: "", - businessCountry: "" -}; -var StoreSettingsService = class { - static { - __name(this, "StoreSettingsService"); - } - constructor(kvNamespace) { - this.kv = new KVManager(kvNamespace); - } - /** - * Get store settings - */ - async getSettings() { - const settings = await this.kv.namespace.get(KV_KEYS.STORE_SETTINGS); - if (settings) { - const parsed = JSON.parse(settings); - return { ...DEFAULT_SETTINGS, ...parsed }; - } - return DEFAULT_SETTINGS; - } - /** - * Update store settings - */ - async updateSettings(settings) { - if (!settings.logoType || !["text", "image"].includes(settings.logoType)) { - throw new Error('Invalid logoType. Must be "text" or "image"'); - } - const updatedSettings = { ...DEFAULT_SETTINGS, ...settings }; - await this.kv.namespace.put(KV_KEYS.STORE_SETTINGS, JSON.stringify(updatedSettings)); - return updatedSettings; - } - /** - * Get contact email - */ - async getContactEmail() { - const settings = await this.getSettings(); - return { email: settings.contactEmail || "contact@example.com" }; - } -}; - -// src/routes/public/storefront.js -init_kv(); -var router3 = new Hono2(); -router3.get("/theme", asyncHandler(async (c) => { - const themeService = new ThemeService(c.env); - const theme = await themeService.getTheme(); - return c.json(theme); -})); -var storefront_default = router3; - -// src/routes/public/checkout.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/services/StripeService.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/stripe.esm.worker.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/platform/WebPlatformFunctions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/platform/PlatformFunctions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/net/FetchHttpClient.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/utils.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var qs = __toESM(require_lib(), 1); -var OPTIONS_KEYS = [ - "apiKey", - "idempotencyKey", - "stripeAccount", - "apiVersion", - "maxNetworkRetries", - "timeout", - "host", - "authenticator", - "stripeContext", - "additionalHeaders", - "streaming" -]; -function isOptionsHash(o) { - return o && typeof o === "object" && OPTIONS_KEYS.some((prop) => Object.prototype.hasOwnProperty.call(o, prop)); -} -__name(isOptionsHash, "isOptionsHash"); -function queryStringifyRequestData(data, apiMode) { - return qs.stringify(data, { - serializeDate: /* @__PURE__ */ __name((d) => Math.floor(d.getTime() / 1e3).toString(), "serializeDate"), - arrayFormat: apiMode == "v2" ? "repeat" : "indices" - }).replace(/%5B/g, "[").replace(/%5D/g, "]"); -} -__name(queryStringifyRequestData, "queryStringifyRequestData"); -var makeURLInterpolator = /* @__PURE__ */ (() => { - const rc = { - "\n": "\\n", - '"': '\\"', - "\u2028": "\\u2028", - "\u2029": "\\u2029" - }; - return (str) => { - const cleanString = str.replace(/["\n\r\u2028\u2029]/g, ($0) => rc[$0]); - return (outputs) => { - return cleanString.replace(/\{([\s\S]+?)\}/g, ($0, $1) => { - const output = outputs[$1]; - if (isValidEncodeUriComponentType(output)) - return encodeURIComponent(output); - return ""; - }); - }; - }; -})(); -function isValidEncodeUriComponentType(value) { - return ["number", "string", "boolean"].includes(typeof value); -} -__name(isValidEncodeUriComponentType, "isValidEncodeUriComponentType"); -function extractUrlParams(path) { - const params = path.match(/\{\w+\}/g); - if (!params) { - return []; - } - return params.map((param) => param.replace(/[{}]/g, "")); -} -__name(extractUrlParams, "extractUrlParams"); -function getDataFromArgs(args) { - if (!Array.isArray(args) || !args[0] || typeof args[0] !== "object") { - return {}; - } - if (!isOptionsHash(args[0])) { - return args.shift(); - } - const argKeys = Object.keys(args[0]); - const optionKeysInArgs = argKeys.filter((key) => OPTIONS_KEYS.includes(key)); - if (optionKeysInArgs.length > 0 && optionKeysInArgs.length !== argKeys.length) { - emitWarning2(`Options found in arguments (${optionKeysInArgs.join(", ")}). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options.`); - } - return {}; -} -__name(getDataFromArgs, "getDataFromArgs"); -function getOptionsFromArgs(args) { - const opts = { - host: null, - headers: {}, - settings: {}, - streaming: false - }; - if (args.length > 0) { - const arg = args[args.length - 1]; - if (typeof arg === "string") { - opts.authenticator = createApiKeyAuthenticator(args.pop()); - } else if (isOptionsHash(arg)) { - const params = Object.assign({}, args.pop()); - const extraKeys = Object.keys(params).filter((key) => !OPTIONS_KEYS.includes(key)); - if (extraKeys.length) { - emitWarning2(`Invalid options found (${extraKeys.join(", ")}); ignoring.`); - } - if (params.apiKey) { - opts.authenticator = createApiKeyAuthenticator(params.apiKey); - } - if (params.idempotencyKey) { - opts.headers["Idempotency-Key"] = params.idempotencyKey; - } - if (params.stripeAccount) { - opts.headers["Stripe-Account"] = params.stripeAccount; - } - if (params.stripeContext) { - if (opts.headers["Stripe-Account"]) { - throw new Error("Can't specify both stripeAccount and stripeContext."); - } - opts.headers["Stripe-Context"] = params.stripeContext; - } - if (params.apiVersion) { - opts.headers["Stripe-Version"] = params.apiVersion; - } - if (Number.isInteger(params.maxNetworkRetries)) { - opts.settings.maxNetworkRetries = params.maxNetworkRetries; - } - if (Number.isInteger(params.timeout)) { - opts.settings.timeout = params.timeout; - } - if (params.host) { - opts.host = params.host; - } - if (params.authenticator) { - if (params.apiKey) { - throw new Error("Can't specify both apiKey and authenticator."); - } - if (typeof params.authenticator !== "function") { - throw new Error("The authenticator must be a function receiving a request as the first parameter."); - } - opts.authenticator = params.authenticator; - } - if (params.additionalHeaders) { - opts.headers = params.additionalHeaders; - } - if (params.streaming) { - opts.streaming = true; - } - } - } - return opts; -} -__name(getOptionsFromArgs, "getOptionsFromArgs"); -function protoExtend(sub) { - const Super = this; - const Constructor = Object.prototype.hasOwnProperty.call(sub, "constructor") ? sub.constructor : function(...args) { - Super.apply(this, args); - }; - Object.assign(Constructor, Super); - Constructor.prototype = Object.create(Super.prototype); - Object.assign(Constructor.prototype, sub); - return Constructor; -} -__name(protoExtend, "protoExtend"); -function removeNullish(obj) { - if (typeof obj !== "object") { - throw new Error("Argument must be an object"); - } - return Object.keys(obj).reduce((result, key) => { - if (obj[key] != null) { - result[key] = obj[key]; - } - return result; - }, {}); -} -__name(removeNullish, "removeNullish"); -function normalizeHeaders(obj) { - if (!(obj && typeof obj === "object")) { - return obj; - } - return Object.keys(obj).reduce((result, header) => { - result[normalizeHeader(header)] = obj[header]; - return result; - }, {}); -} -__name(normalizeHeaders, "normalizeHeaders"); -function normalizeHeader(header) { - return header.split("-").map((text) => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase()).join("-"); -} -__name(normalizeHeader, "normalizeHeader"); -function callbackifyPromiseWithTimeout(promise, callback) { - if (callback) { - return promise.then((res) => { - setTimeout(() => { - callback(null, res); - }, 0); - }, (err) => { - setTimeout(() => { - callback(err, null); - }, 0); - }); - } - return promise; -} -__name(callbackifyPromiseWithTimeout, "callbackifyPromiseWithTimeout"); -function pascalToCamelCase(name) { - if (name === "OAuth") { - return "oauth"; - } else { - return name[0].toLowerCase() + name.substring(1); - } -} -__name(pascalToCamelCase, "pascalToCamelCase"); -function emitWarning2(warning) { - if (typeof process.emitWarning !== "function") { - return console.warn(`Stripe: ${warning}`); - } - return process.emitWarning(warning, "Stripe"); -} -__name(emitWarning2, "emitWarning"); -function isObject(obj) { - const type = typeof obj; - return (type === "function" || type === "object") && !!obj; -} -__name(isObject, "isObject"); -function flattenAndStringify(data) { - const result = {}; - const step = /* @__PURE__ */ __name((obj, prevKey) => { - Object.entries(obj).forEach(([key, value]) => { - const newKey = prevKey ? `${prevKey}[${key}]` : key; - if (isObject(value)) { - if (!(value instanceof Uint8Array) && !Object.prototype.hasOwnProperty.call(value, "data")) { - return step(value, newKey); - } else { - result[newKey] = value; - } - } else { - result[newKey] = String(value); - } - }); - }, "step"); - step(data, null); - return result; -} -__name(flattenAndStringify, "flattenAndStringify"); -function validateInteger(name, n, defaultVal) { - if (!Number.isInteger(n)) { - if (defaultVal !== void 0) { - return defaultVal; - } else { - throw new Error(`${name} must be an integer`); - } - } - return n; -} -__name(validateInteger, "validateInteger"); -function determineProcessUserAgentProperties() { - return typeof process === "undefined" ? {} : { - lang_version: process.version, - platform: process.platform - }; -} -__name(determineProcessUserAgentProperties, "determineProcessUserAgentProperties"); -function createApiKeyAuthenticator(apiKey) { - const authenticator = /* @__PURE__ */ __name((request) => { - request.headers.Authorization = "Bearer " + apiKey; - return Promise.resolve(); - }, "authenticator"); - authenticator._apiKey = apiKey; - return authenticator; -} -__name(createApiKeyAuthenticator, "createApiKeyAuthenticator"); -function dateTimeReplacer(key, value) { - if (this[key] instanceof Date) { - return Math.floor(this[key].getTime() / 1e3).toString(); - } - return value; -} -__name(dateTimeReplacer, "dateTimeReplacer"); -function jsonStringifyRequestData(data) { - return JSON.stringify(data, dateTimeReplacer); -} -__name(jsonStringifyRequestData, "jsonStringifyRequestData"); -function getAPIMode(path) { - if (!path) { - return "v1"; - } - return path.startsWith("/v2") ? "v2" : "v1"; -} -__name(getAPIMode, "getAPIMode"); -function parseHttpHeaderAsString(header) { - if (Array.isArray(header)) { - return header.join(", "); - } - return String(header); -} -__name(parseHttpHeaderAsString, "parseHttpHeaderAsString"); -function parseHttpHeaderAsNumber(header) { - const number = Array.isArray(header) ? header[0] : header; - return Number(number); -} -__name(parseHttpHeaderAsNumber, "parseHttpHeaderAsNumber"); -function parseHeadersForFetch(headers) { - return Object.entries(headers).map(([key, value]) => { - return [key, parseHttpHeaderAsString(value)]; - }); -} -__name(parseHeadersForFetch, "parseHeadersForFetch"); - -// node_modules/stripe/esm/net/HttpClient.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var HttpClient = class _HttpClient { - static { - __name(this, "HttpClient"); - } - /** The client name used for diagnostics. */ - getClientName() { - throw new Error("getClientName not implemented."); - } - makeRequest(host, port, path, method, headers, requestData, protocol, timeout) { - throw new Error("makeRequest not implemented."); - } - /** Helper to make a consistent timeout error across implementations. */ - static makeTimeoutError() { - const timeoutErr = new TypeError(_HttpClient.TIMEOUT_ERROR_CODE); - timeoutErr.code = _HttpClient.TIMEOUT_ERROR_CODE; - return timeoutErr; - } -}; -HttpClient.CONNECTION_CLOSED_ERROR_CODES = ["ECONNRESET", "EPIPE"]; -HttpClient.TIMEOUT_ERROR_CODE = "ETIMEDOUT"; -var HttpClientResponse = class { - static { - __name(this, "HttpClientResponse"); - } - constructor(statusCode, headers) { - this._statusCode = statusCode; - this._headers = headers; - } - getStatusCode() { - return this._statusCode; - } - getHeaders() { - return this._headers; - } - getRawResponse() { - throw new Error("getRawResponse not implemented."); - } - toStream(streamCompleteCallback) { - throw new Error("toStream not implemented."); - } - toJSON() { - throw new Error("toJSON not implemented."); - } -}; - -// node_modules/stripe/esm/net/FetchHttpClient.js -var FetchHttpClient = class _FetchHttpClient extends HttpClient { - static { - __name(this, "FetchHttpClient"); - } - constructor(fetchFn) { - super(); - if (!fetchFn) { - if (!globalThis.fetch) { - throw new Error("fetch() function not provided and is not defined in the global scope. You must provide a fetch implementation."); - } - fetchFn = globalThis.fetch; - } - if (globalThis.AbortController) { - this._fetchFn = _FetchHttpClient.makeFetchWithAbortTimeout(fetchFn); - } else { - this._fetchFn = _FetchHttpClient.makeFetchWithRaceTimeout(fetchFn); - } - } - static makeFetchWithRaceTimeout(fetchFn) { - return (url, init, timeout) => { - let pendingTimeoutId; - const timeoutPromise = new Promise((_, reject) => { - pendingTimeoutId = setTimeout(() => { - pendingTimeoutId = null; - reject(HttpClient.makeTimeoutError()); - }, timeout); - }); - const fetchPromise = fetchFn(url, init); - return Promise.race([fetchPromise, timeoutPromise]).finally(() => { - if (pendingTimeoutId) { - clearTimeout(pendingTimeoutId); - } - }); - }; - } - static makeFetchWithAbortTimeout(fetchFn) { - return async (url, init, timeout) => { - const abort2 = new AbortController(); - let timeoutId = setTimeout(() => { - timeoutId = null; - abort2.abort(HttpClient.makeTimeoutError()); - }, timeout); - try { - return await fetchFn(url, Object.assign(Object.assign({}, init), { signal: abort2.signal })); - } catch (err) { - if (err.name === "AbortError") { - throw HttpClient.makeTimeoutError(); - } else { - throw err; - } - } finally { - if (timeoutId) { - clearTimeout(timeoutId); - } - } - }; - } - /** @override. */ - getClientName() { - return "fetch"; - } - async makeRequest(host, port, path, method, headers, requestData, protocol, timeout) { - const isInsecureConnection = protocol === "http"; - const url = new URL(path, `${isInsecureConnection ? "http" : "https"}://${host}`); - url.port = port; - const methodHasPayload = method == "POST" || method == "PUT" || method == "PATCH"; - const body = requestData || (methodHasPayload ? "" : void 0); - const res = await this._fetchFn(url.toString(), { - method, - headers: parseHeadersForFetch(headers), - body: typeof body === "object" ? JSON.stringify(body) : body - }, timeout); - return new FetchHttpClientResponse(res); - } -}; -var FetchHttpClientResponse = class _FetchHttpClientResponse extends HttpClientResponse { - static { - __name(this, "FetchHttpClientResponse"); - } - constructor(res) { - super(res.status, _FetchHttpClientResponse._transformHeadersToObject(res.headers)); - this._res = res; - } - getRawResponse() { - return this._res; - } - toStream(streamCompleteCallback) { - streamCompleteCallback(); - return this._res.body; - } - toJSON() { - return this._res.json(); - } - static _transformHeadersToObject(headers) { - const headersObj = {}; - for (const entry of headers) { - if (!Array.isArray(entry) || entry.length != 2) { - throw new 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."); - } - headersObj[entry[0]] = entry[1]; - } - return headersObj; - } -}; - -// node_modules/stripe/esm/crypto/SubtleCryptoProvider.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/crypto/CryptoProvider.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var CryptoProvider = class { - static { - __name(this, "CryptoProvider"); - } - /** - * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8). - * The output HMAC should be encoded in hexadecimal. - * - * Sample values for implementations: - * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd' - * - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43 - */ - computeHMACSignature(payload, secret) { - throw new Error("computeHMACSignature not implemented."); - } - /** - * Asynchronous version of `computeHMACSignature`. Some implementations may - * only allow support async signature computation. - * - * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8). - * The output HMAC should be encoded in hexadecimal. - * - * Sample values for implementations: - * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd' - * - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43 - */ - computeHMACSignatureAsync(payload, secret) { - throw new Error("computeHMACSignatureAsync not implemented."); - } - /** - * Computes a SHA-256 hash of the data. - */ - computeSHA256Async(data) { - throw new Error("computeSHA256 not implemented."); - } -}; -var CryptoProviderOnlySupportsAsyncError = class extends Error { - static { - __name(this, "CryptoProviderOnlySupportsAsyncError"); - } -}; - -// node_modules/stripe/esm/crypto/SubtleCryptoProvider.js -var SubtleCryptoProvider = class extends CryptoProvider { - static { - __name(this, "SubtleCryptoProvider"); - } - constructor(subtleCrypto) { - super(); - this.subtleCrypto = subtleCrypto || crypto.subtle; - } - /** @override */ - computeHMACSignature(payload, secret) { - throw new CryptoProviderOnlySupportsAsyncError("SubtleCryptoProvider cannot be used in a synchronous context."); - } - /** @override */ - async computeHMACSignatureAsync(payload, secret) { - const encoder = new TextEncoder(); - const key = await this.subtleCrypto.importKey("raw", encoder.encode(secret), { - name: "HMAC", - hash: { name: "SHA-256" } - }, false, ["sign"]); - const signatureBuffer = await this.subtleCrypto.sign("hmac", key, encoder.encode(payload)); - const signatureBytes = new Uint8Array(signatureBuffer); - const signatureHexCodes = new Array(signatureBytes.length); - for (let i = 0; i < signatureBytes.length; i++) { - signatureHexCodes[i] = byteHexMapping[signatureBytes[i]]; - } - return signatureHexCodes.join(""); - } - /** @override */ - async computeSHA256Async(data) { - return new Uint8Array(await this.subtleCrypto.digest("SHA-256", data)); - } -}; -var byteHexMapping = new Array(256); -for (let i = 0; i < byteHexMapping.length; i++) { - byteHexMapping[i] = i.toString(16).padStart(2, "0"); -} - -// node_modules/stripe/esm/platform/PlatformFunctions.js -var PlatformFunctions = class { - static { - __name(this, "PlatformFunctions"); - } - constructor() { - this._fetchFn = null; - this._agent = null; - } - /** - * Gets uname with Node's built-in `exec` function, if available. - */ - getUname() { - throw new Error("getUname not implemented."); - } - /** - * Generates a v4 UUID. See https://stackoverflow.com/a/2117523 - */ - uuid4() { - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => { - const r = Math.random() * 16 | 0; - const v = c === "x" ? r : r & 3 | 8; - return v.toString(16); - }); - } - /** - * Compares strings in constant time. - */ - secureCompare(a, b) { - if (a.length !== b.length) { - return false; - } - const len = a.length; - let result = 0; - for (let i = 0; i < len; ++i) { - result |= a.charCodeAt(i) ^ b.charCodeAt(i); - } - return result === 0; - } - /** - * Creates an event emitter. - */ - createEmitter() { - throw new Error("createEmitter not implemented."); - } - /** - * Checks if the request data is a stream. If so, read the entire stream - * to a buffer and return the buffer. - */ - tryBufferData(data) { - throw new Error("tryBufferData not implemented."); - } - /** - * Creates an HTTP client which uses the Node `http` and `https` packages - * to issue requests. - */ - createNodeHttpClient(agent) { - throw new Error("createNodeHttpClient not implemented."); - } - /** - * Creates an HTTP client for issuing Stripe API requests which uses the Web - * Fetch API. - * - * A fetch function can optionally be passed in as a parameter. If none is - * passed, will default to the default `fetch` function in the global scope. - */ - createFetchHttpClient(fetchFn) { - return new FetchHttpClient(fetchFn); - } - /** - * Creates an HTTP client using runtime-specific APIs. - */ - createDefaultHttpClient() { - throw new Error("createDefaultHttpClient not implemented."); - } - /** - * Creates a CryptoProvider which uses the Node `crypto` package for its computations. - */ - createNodeCryptoProvider() { - throw new Error("createNodeCryptoProvider not implemented."); - } - /** - * Creates a CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API. - */ - createSubtleCryptoProvider(subtleCrypto) { - return new SubtleCryptoProvider(subtleCrypto); - } - createDefaultCryptoProvider() { - throw new Error("createDefaultCryptoProvider not implemented."); - } -}; - -// node_modules/stripe/esm/StripeEmitter.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var _StripeEvent = class extends Event { - static { - __name(this, "_StripeEvent"); - } - constructor(eventName, data) { - super(eventName); - this.data = data; - } -}; -var StripeEmitter = class { - static { - __name(this, "StripeEmitter"); - } - constructor() { - this.eventTarget = new EventTarget(); - this.listenerMapping = /* @__PURE__ */ new Map(); - } - on(eventName, listener) { - const listenerWrapper = /* @__PURE__ */ __name((event) => { - listener(event.data); - }, "listenerWrapper"); - this.listenerMapping.set(listener, listenerWrapper); - return this.eventTarget.addEventListener(eventName, listenerWrapper); - } - removeListener(eventName, listener) { - const listenerWrapper = this.listenerMapping.get(listener); - this.listenerMapping.delete(listener); - return this.eventTarget.removeEventListener(eventName, listenerWrapper); - } - once(eventName, listener) { - const listenerWrapper = /* @__PURE__ */ __name((event) => { - listener(event.data); - }, "listenerWrapper"); - this.listenerMapping.set(listener, listenerWrapper); - return this.eventTarget.addEventListener(eventName, listenerWrapper, { - once: true - }); - } - emit(eventName, data) { - return this.eventTarget.dispatchEvent(new _StripeEvent(eventName, data)); - } -}; - -// node_modules/stripe/esm/platform/WebPlatformFunctions.js -var WebPlatformFunctions = class extends PlatformFunctions { - static { - __name(this, "WebPlatformFunctions"); - } - /** @override */ - getUname() { - return Promise.resolve(null); - } - /** @override */ - createEmitter() { - return new StripeEmitter(); - } - /** @override */ - tryBufferData(data) { - if (data.file.data instanceof ReadableStream) { - throw new 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(data); - } - /** @override */ - createNodeHttpClient() { - throw new Error("Stripe: `createNodeHttpClient()` is not available in non-Node environments. Please use `createFetchHttpClient()` instead."); - } - /** @override */ - createDefaultHttpClient() { - return super.createFetchHttpClient(); - } - /** @override */ - createNodeCryptoProvider() { - throw new Error("Stripe: `createNodeCryptoProvider()` is not available in non-Node environments. Please use `createSubtleCryptoProvider()` instead."); - } - /** @override */ - createDefaultCryptoProvider() { - return this.createSubtleCryptoProvider(); - } -}; - -// node_modules/stripe/esm/stripe.core.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/Error.js -var Error_exports = {}; -__export(Error_exports, { - StripeAPIError: () => StripeAPIError, - StripeAuthenticationError: () => StripeAuthenticationError, - StripeCardError: () => StripeCardError, - StripeConnectionError: () => StripeConnectionError, - StripeError: () => StripeError, - StripeIdempotencyError: () => StripeIdempotencyError, - StripeInvalidGrantError: () => StripeInvalidGrantError, - StripeInvalidRequestError: () => StripeInvalidRequestError, - StripePermissionError: () => StripePermissionError, - StripeRateLimitError: () => StripeRateLimitError, - StripeSignatureVerificationError: () => StripeSignatureVerificationError, - StripeUnknownError: () => StripeUnknownError, - TemporarySessionExpiredError: () => TemporarySessionExpiredError, - generateV1Error: () => generateV1Error, - generateV2Error: () => generateV2Error -}); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var generateV1Error = /* @__PURE__ */ __name((rawStripeError) => { - switch (rawStripeError.type) { - case "card_error": - return new StripeCardError(rawStripeError); - case "invalid_request_error": - return new StripeInvalidRequestError(rawStripeError); - case "api_error": - return new StripeAPIError(rawStripeError); - case "authentication_error": - return new StripeAuthenticationError(rawStripeError); - case "rate_limit_error": - return new StripeRateLimitError(rawStripeError); - case "idempotency_error": - return new StripeIdempotencyError(rawStripeError); - case "invalid_grant": - return new StripeInvalidGrantError(rawStripeError); - default: - return new StripeUnknownError(rawStripeError); - } -}, "generateV1Error"); -var generateV2Error = /* @__PURE__ */ __name((rawStripeError) => { - switch (rawStripeError.type) { - // switchCases: The beginning of the section generated from our OpenAPI spec - case "temporary_session_expired": - return new TemporarySessionExpiredError(rawStripeError); - } - switch (rawStripeError.code) { - case "invalid_fields": - return new StripeInvalidRequestError(rawStripeError); - } - return generateV1Error(rawStripeError); -}, "generateV2Error"); -var StripeError = class extends Error { - static { - __name(this, "StripeError"); - } - constructor(raw2 = {}, type = null) { - var _a; - super(raw2.message); - this.type = type || this.constructor.name; - this.raw = raw2; - this.rawType = raw2.type; - this.code = raw2.code; - this.doc_url = raw2.doc_url; - this.param = raw2.param; - this.detail = raw2.detail; - this.headers = raw2.headers; - this.requestId = raw2.requestId; - this.statusCode = raw2.statusCode; - this.message = (_a = raw2.message) !== null && _a !== void 0 ? _a : ""; - this.userMessage = raw2.user_message; - this.charge = raw2.charge; - this.decline_code = raw2.decline_code; - this.payment_intent = raw2.payment_intent; - this.payment_method = raw2.payment_method; - this.payment_method_type = raw2.payment_method_type; - this.setup_intent = raw2.setup_intent; - this.source = raw2.source; - } -}; -StripeError.generate = generateV1Error; -var StripeCardError = class extends StripeError { - static { - __name(this, "StripeCardError"); - } - constructor(raw2 = {}) { - super(raw2, "StripeCardError"); - } -}; -var StripeInvalidRequestError = class extends StripeError { - static { - __name(this, "StripeInvalidRequestError"); - } - constructor(raw2 = {}) { - super(raw2, "StripeInvalidRequestError"); - } -}; -var StripeAPIError = class extends StripeError { - static { - __name(this, "StripeAPIError"); - } - constructor(raw2 = {}) { - super(raw2, "StripeAPIError"); - } -}; -var StripeAuthenticationError = class extends StripeError { - static { - __name(this, "StripeAuthenticationError"); - } - constructor(raw2 = {}) { - super(raw2, "StripeAuthenticationError"); - } -}; -var StripePermissionError = class extends StripeError { - static { - __name(this, "StripePermissionError"); - } - constructor(raw2 = {}) { - super(raw2, "StripePermissionError"); - } -}; -var StripeRateLimitError = class extends StripeError { - static { - __name(this, "StripeRateLimitError"); - } - constructor(raw2 = {}) { - super(raw2, "StripeRateLimitError"); - } -}; -var StripeConnectionError = class extends StripeError { - static { - __name(this, "StripeConnectionError"); - } - constructor(raw2 = {}) { - super(raw2, "StripeConnectionError"); - } -}; -var StripeSignatureVerificationError = class extends StripeError { - static { - __name(this, "StripeSignatureVerificationError"); - } - constructor(header, payload, raw2 = {}) { - super(raw2, "StripeSignatureVerificationError"); - this.header = header; - this.payload = payload; - } -}; -var StripeIdempotencyError = class extends StripeError { - static { - __name(this, "StripeIdempotencyError"); - } - constructor(raw2 = {}) { - super(raw2, "StripeIdempotencyError"); - } -}; -var StripeInvalidGrantError = class extends StripeError { - static { - __name(this, "StripeInvalidGrantError"); - } - constructor(raw2 = {}) { - super(raw2, "StripeInvalidGrantError"); - } -}; -var StripeUnknownError = class extends StripeError { - static { - __name(this, "StripeUnknownError"); - } - constructor(raw2 = {}) { - super(raw2, "StripeUnknownError"); - } -}; -var TemporarySessionExpiredError = class extends StripeError { - static { - __name(this, "TemporarySessionExpiredError"); - } - constructor(rawStripeError = {}) { - super(rawStripeError, "TemporarySessionExpiredError"); - } -}; - -// node_modules/stripe/esm/RequestSender.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var MAX_RETRY_AFTER_WAIT = 60; -var RequestSender = class _RequestSender { - static { - __name(this, "RequestSender"); - } - constructor(stripe, maxBufferedRequestMetric) { - this._stripe = stripe; - this._maxBufferedRequestMetric = maxBufferedRequestMetric; - } - _addHeadersDirectlyToObject(obj, headers) { - obj.requestId = headers["request-id"]; - obj.stripeAccount = obj.stripeAccount || headers["stripe-account"]; - obj.apiVersion = obj.apiVersion || headers["stripe-version"]; - obj.idempotencyKey = obj.idempotencyKey || headers["idempotency-key"]; - } - _makeResponseEvent(requestEvent, statusCode, headers) { - const requestEndTime = Date.now(); - const requestDurationMs = requestEndTime - requestEvent.request_start_time; - return removeNullish({ - api_version: headers["stripe-version"], - account: headers["stripe-account"], - idempotency_key: headers["idempotency-key"], - method: requestEvent.method, - path: requestEvent.path, - status: statusCode, - request_id: this._getRequestId(headers), - elapsed: requestDurationMs, - request_start_time: requestEvent.request_start_time, - request_end_time: requestEndTime - }); - } - _getRequestId(headers) { - return headers["request-id"]; - } - /** - * Used by methods with spec.streaming === true. For these methods, we do not - * buffer successful responses into memory or do parse them into stripe - * objects, we delegate that all of that to the user and pass back the raw - * http.Response object to the callback. - * - * (Unsuccessful responses shouldn't make it here, they should - * still be buffered/parsed and handled by _jsonResponseHandler -- see - * makeRequest) - */ - _streamingResponseHandler(requestEvent, usage, callback) { - return (res) => { - const headers = res.getHeaders(); - const streamCompleteCallback = /* @__PURE__ */ __name(() => { - const responseEvent = this._makeResponseEvent(requestEvent, res.getStatusCode(), headers); - this._stripe._emitter.emit("response", responseEvent); - this._recordRequestMetrics(this._getRequestId(headers), responseEvent.elapsed, usage); - }, "streamCompleteCallback"); - const stream = res.toStream(streamCompleteCallback); - this._addHeadersDirectlyToObject(stream, headers); - return callback(null, stream); - }; - } - /** - * Default handler for Stripe responses. Buffers the response into memory, - * parses the JSON and returns it (i.e. passes it to the callback) if there - * is no "error" field. Otherwise constructs/passes an appropriate Error. - */ - _jsonResponseHandler(requestEvent, apiMode, usage, callback) { - return (res) => { - const headers = res.getHeaders(); - const requestId = this._getRequestId(headers); - const statusCode = res.getStatusCode(); - const responseEvent = this._makeResponseEvent(requestEvent, statusCode, headers); - this._stripe._emitter.emit("response", responseEvent); - res.toJSON().then((jsonResponse) => { - if (jsonResponse.error) { - let err; - if (typeof jsonResponse.error === "string") { - jsonResponse.error = { - type: jsonResponse.error, - message: jsonResponse.error_description - }; - } - jsonResponse.error.headers = headers; - jsonResponse.error.statusCode = statusCode; - jsonResponse.error.requestId = requestId; - if (statusCode === 401) { - err = new StripeAuthenticationError(jsonResponse.error); - } else if (statusCode === 403) { - err = new StripePermissionError(jsonResponse.error); - } else if (statusCode === 429) { - err = new StripeRateLimitError(jsonResponse.error); - } else if (apiMode === "v2") { - err = generateV2Error(jsonResponse.error); - } else { - err = generateV1Error(jsonResponse.error); - } - throw err; - } - return jsonResponse; - }, (e) => { - throw new StripeAPIError({ - message: "Invalid JSON received from the Stripe API", - exception: e, - requestId: headers["request-id"] - }); - }).then((jsonResponse) => { - this._recordRequestMetrics(requestId, responseEvent.elapsed, usage); - const rawResponse = res.getRawResponse(); - this._addHeadersDirectlyToObject(rawResponse, headers); - Object.defineProperty(jsonResponse, "lastResponse", { - enumerable: false, - writable: false, - value: rawResponse - }); - callback(null, jsonResponse); - }, (e) => callback(e, null)); - }; - } - static _generateConnectionErrorMessage(requestRetries) { - return `An error occurred with our connection to Stripe.${requestRetries > 0 ? ` Request was retried ${requestRetries} times.` : ""}`; - } - // For more on when and how to retry API requests, see https://stripe.com/docs/error-handling#safely-retrying-requests-with-idempotency - static _shouldRetry(res, numRetries, maxRetries, error3) { - if (error3 && numRetries === 0 && HttpClient.CONNECTION_CLOSED_ERROR_CODES.includes(error3.code)) { - return true; - } - if (numRetries >= maxRetries) { - return false; - } - if (!res) { - return true; - } - if (res.getHeaders()["stripe-should-retry"] === "false") { - return false; - } - if (res.getHeaders()["stripe-should-retry"] === "true") { - return true; - } - if (res.getStatusCode() === 409) { - return true; - } - if (res.getStatusCode() >= 500) { - return true; - } - return false; - } - _getSleepTimeInMS(numRetries, retryAfter = null) { - const initialNetworkRetryDelay = this._stripe.getInitialNetworkRetryDelay(); - const maxNetworkRetryDelay = this._stripe.getMaxNetworkRetryDelay(); - let sleepSeconds = Math.min(initialNetworkRetryDelay * Math.pow(2, numRetries - 1), maxNetworkRetryDelay); - sleepSeconds *= 0.5 * (1 + Math.random()); - sleepSeconds = Math.max(initialNetworkRetryDelay, sleepSeconds); - if (Number.isInteger(retryAfter) && retryAfter <= MAX_RETRY_AFTER_WAIT) { - sleepSeconds = Math.max(sleepSeconds, retryAfter); - } - return sleepSeconds * 1e3; - } - // Max retries can be set on a per request basis. Favor those over the global setting - _getMaxNetworkRetries(settings = {}) { - return settings.maxNetworkRetries !== void 0 && Number.isInteger(settings.maxNetworkRetries) ? settings.maxNetworkRetries : this._stripe.getMaxNetworkRetries(); - } - _defaultIdempotencyKey(method, settings, apiMode) { - const maxRetries = this._getMaxNetworkRetries(settings); - const genKey = /* @__PURE__ */ __name(() => `stripe-node-retry-${this._stripe._platformFunctions.uuid4()}`, "genKey"); - if (apiMode === "v2") { - if (method === "POST" || method === "DELETE") { - return genKey(); - } - } else if (apiMode === "v1") { - if (method === "POST" && maxRetries > 0) { - return genKey(); - } - } - return null; - } - _makeHeaders({ contentType, contentLength, apiVersion, clientUserAgent, method, userSuppliedHeaders, userSuppliedSettings, stripeAccount, stripeContext, apiMode }) { - const defaultHeaders = { - Accept: "application/json", - "Content-Type": contentType, - "User-Agent": this._getUserAgentString(apiMode), - "X-Stripe-Client-User-Agent": clientUserAgent, - "X-Stripe-Client-Telemetry": this._getTelemetryHeader(), - "Stripe-Version": apiVersion, - "Stripe-Account": stripeAccount, - "Stripe-Context": stripeContext, - "Idempotency-Key": this._defaultIdempotencyKey(method, userSuppliedSettings, apiMode) - }; - const methodHasPayload = method == "POST" || method == "PUT" || method == "PATCH"; - if (methodHasPayload || contentLength) { - if (!methodHasPayload) { - emitWarning2(`${method} method had non-zero contentLength but no payload is expected for this verb`); - } - defaultHeaders["Content-Length"] = contentLength; - } - return Object.assign( - removeNullish(defaultHeaders), - // If the user supplied, say 'idempotency-key', override instead of appending by ensuring caps are the same. - normalizeHeaders(userSuppliedHeaders) - ); - } - _getUserAgentString(apiMode) { - const packageVersion = this._stripe.getConstant("PACKAGE_VERSION"); - const appInfo = this._stripe._appInfo ? this._stripe.getAppInfoAsString() : ""; - return `Stripe/${apiMode} NodeBindings/${packageVersion} ${appInfo}`.trim(); - } - _getTelemetryHeader() { - if (this._stripe.getTelemetryEnabled() && this._stripe._prevRequestMetrics.length > 0) { - const metrics = this._stripe._prevRequestMetrics.shift(); - return JSON.stringify({ - last_request_metrics: metrics - }); - } - } - _recordRequestMetrics(requestId, requestDurationMs, usage) { - if (this._stripe.getTelemetryEnabled() && requestId) { - if (this._stripe._prevRequestMetrics.length > this._maxBufferedRequestMetric) { - emitWarning2("Request metrics buffer is full, dropping telemetry message."); - } else { - const m = { - request_id: requestId, - request_duration_ms: requestDurationMs - }; - if (usage && usage.length > 0) { - m.usage = usage; - } - this._stripe._prevRequestMetrics.push(m); - } - } - } - _rawRequest(method, path, params, options) { - const requestPromise = new Promise((resolve, reject) => { - let opts; - try { - const requestMethod = method.toUpperCase(); - if (requestMethod !== "POST" && params && Object.keys(params).length !== 0) { - throw new Error("rawRequest only supports params on POST requests. Please pass null and add your parameters to path."); - } - const args = [].slice.call([params, options]); - const dataFromArgs = getDataFromArgs(args); - const data = requestMethod === "POST" ? Object.assign({}, dataFromArgs) : null; - const calculatedOptions = getOptionsFromArgs(args); - const headers2 = calculatedOptions.headers; - const authenticator2 = calculatedOptions.authenticator; - opts = { - requestMethod, - requestPath: path, - bodyData: data, - queryData: {}, - authenticator: authenticator2, - headers: headers2, - host: calculatedOptions.host, - streaming: !!calculatedOptions.streaming, - settings: {}, - usage: ["raw_request"] - }; - } catch (err) { - reject(err); - return; - } - function requestCallback(err, response) { - if (err) { - reject(err); - } else { - resolve(response); - } - } - __name(requestCallback, "requestCallback"); - const { headers, settings } = opts; - const authenticator = opts.authenticator; - this._request(opts.requestMethod, opts.host, path, opts.bodyData, authenticator, { headers, settings, streaming: opts.streaming }, opts.usage, requestCallback); - }); - return requestPromise; - } - _request(method, host, path, data, authenticator, options, usage = [], callback, requestDataProcessor = null) { - var _a; - let requestData; - authenticator = (_a = authenticator !== null && authenticator !== void 0 ? authenticator : this._stripe._authenticator) !== null && _a !== void 0 ? _a : null; - const apiMode = getAPIMode(path); - const retryRequest = /* @__PURE__ */ __name((requestFn, apiVersion, headers, requestRetries, retryAfter) => { - return setTimeout(requestFn, this._getSleepTimeInMS(requestRetries, retryAfter), apiVersion, headers, requestRetries + 1); - }, "retryRequest"); - const makeRequest = /* @__PURE__ */ __name((apiVersion, headers, numRetries) => { - const timeout = options.settings && options.settings.timeout && Number.isInteger(options.settings.timeout) && options.settings.timeout >= 0 ? options.settings.timeout : this._stripe.getApiField("timeout"); - const request = { - host: host || this._stripe.getApiField("host"), - port: this._stripe.getApiField("port"), - path, - method, - headers: Object.assign({}, headers), - body: requestData, - protocol: this._stripe.getApiField("protocol") - }; - authenticator(request).then(() => { - const req = this._stripe.getApiField("httpClient").makeRequest(request.host, request.port, request.path, request.method, request.headers, request.body, request.protocol, timeout); - const requestStartTime = Date.now(); - const requestEvent = removeNullish({ - api_version: apiVersion, - account: parseHttpHeaderAsString(headers["Stripe-Account"]), - idempotency_key: parseHttpHeaderAsString(headers["Idempotency-Key"]), - method, - path, - request_start_time: requestStartTime - }); - const requestRetries = numRetries || 0; - const maxRetries = this._getMaxNetworkRetries(options.settings || {}); - this._stripe._emitter.emit("request", requestEvent); - req.then((res) => { - if (_RequestSender._shouldRetry(res, requestRetries, maxRetries)) { - return retryRequest(makeRequest, apiVersion, headers, requestRetries, parseHttpHeaderAsNumber(res.getHeaders()["retry-after"])); - } else if (options.streaming && res.getStatusCode() < 400) { - return this._streamingResponseHandler(requestEvent, usage, callback)(res); - } else { - return this._jsonResponseHandler(requestEvent, apiMode, usage, callback)(res); - } - }).catch((error3) => { - if (_RequestSender._shouldRetry(null, requestRetries, maxRetries, error3)) { - return retryRequest(makeRequest, apiVersion, headers, requestRetries, null); - } else { - const isTimeoutError = error3.code && error3.code === HttpClient.TIMEOUT_ERROR_CODE; - return callback(new StripeConnectionError({ - message: isTimeoutError ? `Request aborted due to timeout being reached (${timeout}ms)` : _RequestSender._generateConnectionErrorMessage(requestRetries), - detail: error3 - })); - } - }); - }).catch((e) => { - throw new StripeError({ - message: "Unable to authenticate the request", - exception: e - }); - }); - }, "makeRequest"); - const prepareAndMakeRequest = /* @__PURE__ */ __name((error3, data2) => { - if (error3) { - return callback(error3); - } - requestData = data2; - this._stripe.getClientUserAgent((clientUserAgent) => { - const apiVersion = this._stripe.getApiField("version"); - const headers = this._makeHeaders({ - contentType: apiMode == "v2" ? "application/json" : "application/x-www-form-urlencoded", - contentLength: requestData.length, - apiVersion, - clientUserAgent, - method, - userSuppliedHeaders: options.headers, - userSuppliedSettings: options.settings, - stripeAccount: apiMode == "v2" ? null : this._stripe.getApiField("stripeAccount"), - stripeContext: apiMode == "v2" ? this._stripe.getApiField("stripeContext") : null, - apiMode - }); - makeRequest(apiVersion, headers, 0); - }); - }, "prepareAndMakeRequest"); - if (requestDataProcessor) { - requestDataProcessor(method, data, options.headers, prepareAndMakeRequest); - } else { - let stringifiedData; - if (apiMode == "v2") { - stringifiedData = data ? jsonStringifyRequestData(data) : ""; - } else { - stringifiedData = queryStringifyRequestData(data || {}, apiMode); - } - prepareAndMakeRequest(null, stringifiedData); - } - } -}; - -// node_modules/stripe/esm/StripeResource.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/StripeMethod.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/autoPagination.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var V1Iterator = class { - static { - __name(this, "V1Iterator"); - } - constructor(firstPagePromise, requestArgs, spec, stripeResource) { - this.index = 0; - this.pagePromise = firstPagePromise; - this.promiseCache = { currentPromise: null }; - this.requestArgs = requestArgs; - this.spec = spec; - this.stripeResource = stripeResource; - } - async iterate(pageResult) { - if (!(pageResult && pageResult.data && typeof pageResult.data.length === "number")) { - throw Error("Unexpected: Stripe API response does not have a well-formed `data` array."); - } - const reverseIteration = isReverseIteration(this.requestArgs); - if (this.index < pageResult.data.length) { - const idx = reverseIteration ? pageResult.data.length - 1 - this.index : this.index; - const value = pageResult.data[idx]; - this.index += 1; - return { value, done: false }; - } else if (pageResult.has_more) { - this.index = 0; - this.pagePromise = this.getNextPage(pageResult); - const nextPageResult = await this.pagePromise; - return this.iterate(nextPageResult); - } - return { done: true, value: void 0 }; - } - /** @abstract */ - getNextPage(_pageResult) { - throw new Error("Unimplemented"); - } - async _next() { - return this.iterate(await this.pagePromise); - } - next() { - if (this.promiseCache.currentPromise) { - return this.promiseCache.currentPromise; - } - const nextPromise = (async () => { - const ret = await this._next(); - this.promiseCache.currentPromise = null; - return ret; - })(); - this.promiseCache.currentPromise = nextPromise; - return nextPromise; - } -}; -var V1ListIterator = class extends V1Iterator { - static { - __name(this, "V1ListIterator"); - } - getNextPage(pageResult) { - const reverseIteration = isReverseIteration(this.requestArgs); - const lastId = getLastId(pageResult, reverseIteration); - return this.stripeResource._makeRequest(this.requestArgs, this.spec, { - [reverseIteration ? "ending_before" : "starting_after"]: lastId - }); - } -}; -var V1SearchIterator = class extends V1Iterator { - static { - __name(this, "V1SearchIterator"); - } - getNextPage(pageResult) { - if (!pageResult.next_page) { - throw Error("Unexpected: Stripe API response does not have a well-formed `next_page` field, but `has_more` was true."); - } - return this.stripeResource._makeRequest(this.requestArgs, this.spec, { - page: pageResult.next_page - }); - } -}; -var V2ListIterator = class { - static { - __name(this, "V2ListIterator"); - } - constructor(firstPagePromise, requestArgs, spec, stripeResource) { - this.currentPageIterator = (async () => { - const page = await firstPagePromise; - return page.data[Symbol.iterator](); - })(); - this.nextPageUrl = (async () => { - const page = await firstPagePromise; - return page.next_page_url || null; - })(); - this.requestArgs = requestArgs; - this.spec = spec; - this.stripeResource = stripeResource; - } - async turnPage() { - const nextPageUrl = await this.nextPageUrl; - if (!nextPageUrl) - return null; - this.spec.fullPath = nextPageUrl; - const page = await this.stripeResource._makeRequest([], this.spec, {}); - this.nextPageUrl = Promise.resolve(page.next_page_url); - this.currentPageIterator = Promise.resolve(page.data[Symbol.iterator]()); - return this.currentPageIterator; - } - async next() { - { - const result2 = (await this.currentPageIterator).next(); - if (!result2.done) - return { done: false, value: result2.value }; - } - const nextPageIterator = await this.turnPage(); - if (!nextPageIterator) { - return { done: true, value: void 0 }; - } - const result = nextPageIterator.next(); - if (!result.done) - return { done: false, value: result.value }; - return { done: true, value: void 0 }; - } -}; -var makeAutoPaginationMethods = /* @__PURE__ */ __name((stripeResource, requestArgs, spec, firstPagePromise) => { - const apiMode = getAPIMode(spec.fullPath || spec.path); - if (apiMode !== "v2" && spec.methodType === "search") { - return makeAutoPaginationMethodsFromIterator(new V1SearchIterator(firstPagePromise, requestArgs, spec, stripeResource)); - } - if (apiMode !== "v2" && spec.methodType === "list") { - return makeAutoPaginationMethodsFromIterator(new V1ListIterator(firstPagePromise, requestArgs, spec, stripeResource)); - } - if (apiMode === "v2" && spec.methodType === "list") { - return makeAutoPaginationMethodsFromIterator(new V2ListIterator(firstPagePromise, requestArgs, spec, stripeResource)); - } - return null; -}, "makeAutoPaginationMethods"); -var makeAutoPaginationMethodsFromIterator = /* @__PURE__ */ __name((iterator) => { - const autoPagingEach = makeAutoPagingEach((...args) => iterator.next(...args)); - const autoPagingToArray = makeAutoPagingToArray(autoPagingEach); - const autoPaginationMethods = { - autoPagingEach, - autoPagingToArray, - // Async iterator functions: - next: /* @__PURE__ */ __name(() => iterator.next(), "next"), - return: /* @__PURE__ */ __name(() => { - return {}; - }, "return"), - [getAsyncIteratorSymbol()]: () => { - return autoPaginationMethods; - } - }; - return autoPaginationMethods; -}, "makeAutoPaginationMethodsFromIterator"); -function getAsyncIteratorSymbol() { - if (typeof Symbol !== "undefined" && Symbol.asyncIterator) { - return Symbol.asyncIterator; - } - return "@@asyncIterator"; -} -__name(getAsyncIteratorSymbol, "getAsyncIteratorSymbol"); -function getDoneCallback(args) { - if (args.length < 2) { - return null; - } - const onDone = args[1]; - if (typeof onDone !== "function") { - throw Error(`The second argument to autoPagingEach, if present, must be a callback function; received ${typeof onDone}`); - } - return onDone; -} -__name(getDoneCallback, "getDoneCallback"); -function getItemCallback(args) { - if (args.length === 0) { - return void 0; - } - const onItem = args[0]; - if (typeof onItem !== "function") { - throw Error(`The first argument to autoPagingEach, if present, must be a callback function; received ${typeof onItem}`); - } - if (onItem.length === 2) { - return onItem; - } - if (onItem.length > 2) { - throw Error(`The \`onItem\` callback function passed to autoPagingEach must accept at most two arguments; got ${onItem}`); - } - return /* @__PURE__ */ __name(function _onItem(item, next) { - const shouldContinue = onItem(item); - next(shouldContinue); - }, "_onItem"); -} -__name(getItemCallback, "getItemCallback"); -function getLastId(listResult, reverseIteration) { - const lastIdx = reverseIteration ? 0 : listResult.data.length - 1; - const lastItem = listResult.data[lastIdx]; - const lastId = lastItem && lastItem.id; - if (!lastId) { - throw Error("Unexpected: No `id` found on the last item while auto-paging a list."); - } - return lastId; -} -__name(getLastId, "getLastId"); -function makeAutoPagingEach(asyncIteratorNext) { - return /* @__PURE__ */ __name(function autoPagingEach() { - const args = [].slice.call(arguments); - const onItem = getItemCallback(args); - const onDone = getDoneCallback(args); - if (args.length > 2) { - throw Error(`autoPagingEach takes up to two arguments; received ${args}`); - } - const autoPagePromise = wrapAsyncIteratorWithCallback( - asyncIteratorNext, - // @ts-ignore we might need a null check - onItem - ); - return callbackifyPromiseWithTimeout(autoPagePromise, onDone); - }, "autoPagingEach"); -} -__name(makeAutoPagingEach, "makeAutoPagingEach"); -function makeAutoPagingToArray(autoPagingEach) { - return /* @__PURE__ */ __name(function autoPagingToArray(opts, onDone) { - const limit = opts && opts.limit; - if (!limit) { - throw Error("You must pass a `limit` option to autoPagingToArray, e.g., `autoPagingToArray({limit: 1000});`."); - } - if (limit > 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."); - } - const promise = new Promise((resolve, reject) => { - const items = []; - autoPagingEach((item) => { - items.push(item); - if (items.length >= limit) { - return false; - } - }).then(() => { - resolve(items); - }).catch(reject); - }); - return callbackifyPromiseWithTimeout(promise, onDone); - }, "autoPagingToArray"); -} -__name(makeAutoPagingToArray, "makeAutoPagingToArray"); -function wrapAsyncIteratorWithCallback(asyncIteratorNext, onItem) { - return new Promise((resolve, reject) => { - function handleIteration(iterResult) { - if (iterResult.done) { - resolve(); - return; - } - const item = iterResult.value; - return new Promise((next) => { - onItem(item, next); - }).then((shouldContinue) => { - if (shouldContinue === false) { - return handleIteration({ done: true, value: void 0 }); - } else { - return asyncIteratorNext().then(handleIteration); - } - }); - } - __name(handleIteration, "handleIteration"); - asyncIteratorNext().then(handleIteration).catch(reject); - }); -} -__name(wrapAsyncIteratorWithCallback, "wrapAsyncIteratorWithCallback"); -function isReverseIteration(requestArgs) { - const args = [].slice.call(requestArgs); - const dataFromArgs = getDataFromArgs(args); - return !!dataFromArgs.ending_before; -} -__name(isReverseIteration, "isReverseIteration"); - -// node_modules/stripe/esm/StripeMethod.js -function stripeMethod(spec) { - if (spec.path !== void 0 && spec.fullPath !== void 0) { - throw new Error(`Method spec specified both a 'path' (${spec.path}) and a 'fullPath' (${spec.fullPath}).`); - } - return function(...args) { - const callback = typeof args[args.length - 1] == "function" && args.pop(); - spec.urlParams = extractUrlParams(spec.fullPath || this.createResourcePathWithSymbols(spec.path || "")); - const requestPromise = callbackifyPromiseWithTimeout(this._makeRequest(args, spec, {}), callback); - Object.assign(requestPromise, makeAutoPaginationMethods(this, args, spec, requestPromise)); - return requestPromise; - }; -} -__name(stripeMethod, "stripeMethod"); - -// node_modules/stripe/esm/StripeResource.js -StripeResource.extend = protoExtend; -StripeResource.method = stripeMethod; -StripeResource.MAX_BUFFERED_REQUEST_METRICS = 100; -function StripeResource(stripe, deprecatedUrlData) { - this._stripe = stripe; - if (deprecatedUrlData) { - throw new Error("Support for curried url params was dropped in stripe-node v7.0.0. Instead, pass two ids."); - } - this.basePath = makeURLInterpolator( - // @ts-ignore changing type of basePath - this.basePath || stripe.getApiField("basePath") - ); - this.resourcePath = this.path; - this.path = makeURLInterpolator(this.path); - this.initialize(...arguments); -} -__name(StripeResource, "StripeResource"); -StripeResource.prototype = { - _stripe: null, - // @ts-ignore the type of path changes in ctor - path: "", - resourcePath: "", - // Methods that don't use the API's default '/v1' path can override it with this setting. - basePath: null, - initialize() { - }, - // Function to override the default data processor. This allows full control - // over how a StripeResource's request data will get converted into an HTTP - // body. This is useful for non-standard HTTP requests. The function should - // take method name, data, and headers as arguments. - requestDataProcessor: null, - // Function to add a validation checks before sending the request, errors should - // be thrown, and they will be passed to the callback/promise. - validateRequest: null, - createFullPath(commandPath, urlData) { - const urlParts = [this.basePath(urlData), this.path(urlData)]; - if (typeof commandPath === "function") { - const computedCommandPath = commandPath(urlData); - if (computedCommandPath) { - urlParts.push(computedCommandPath); - } - } else { - urlParts.push(commandPath); - } - return this._joinUrlParts(urlParts); - }, - // Creates a relative resource path with symbols left in (unlike - // createFullPath which takes some data to replace them with). For example it - // might produce: /invoices/{id} - createResourcePathWithSymbols(pathWithSymbols) { - if (pathWithSymbols) { - return `/${this._joinUrlParts([this.resourcePath, pathWithSymbols])}`; - } else { - return `/${this.resourcePath}`; - } - }, - _joinUrlParts(parts) { - return parts.join("/").replace(/\/{2,}/g, "/"); - }, - _getRequestOpts(requestArgs, spec, overrideData) { - var _a; - const requestMethod = (spec.method || "GET").toUpperCase(); - const usage = spec.usage || []; - const urlParams = spec.urlParams || []; - const encode = spec.encode || ((data2) => data2); - const isUsingFullPath = !!spec.fullPath; - const commandPath = makeURLInterpolator(isUsingFullPath ? spec.fullPath : spec.path || ""); - const path = isUsingFullPath ? spec.fullPath : this.createResourcePathWithSymbols(spec.path); - const args = [].slice.call(requestArgs); - const urlData = urlParams.reduce((urlData2, param) => { - const arg = args.shift(); - if (typeof arg !== "string") { - throw new Error(`Stripe: Argument "${param}" must be a string, but got: ${arg} (on API request to \`${requestMethod} ${path}\`)`); - } - urlData2[param] = arg; - return urlData2; - }, {}); - const dataFromArgs = getDataFromArgs(args); - const data = encode(Object.assign({}, dataFromArgs, overrideData)); - const options = getOptionsFromArgs(args); - const host = options.host || spec.host; - const streaming = !!spec.streaming || !!options.streaming; - if (args.filter((x) => x != null).length) { - throw new Error(`Stripe: Unknown arguments (${args}). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options. (on API request to ${requestMethod} \`${path}\`)`); - } - const requestPath = isUsingFullPath ? commandPath(urlData) : this.createFullPath(commandPath, urlData); - const headers = Object.assign(options.headers, spec.headers); - if (spec.validator) { - spec.validator(data, { headers }); - } - const dataInQuery = spec.method === "GET" || spec.method === "DELETE"; - const bodyData = dataInQuery ? null : data; - const queryData = dataInQuery ? data : {}; - return { - requestMethod, - requestPath, - bodyData, - queryData, - authenticator: (_a = options.authenticator) !== null && _a !== void 0 ? _a : null, - headers, - host: host !== null && host !== void 0 ? host : null, - streaming, - settings: options.settings, - usage - }; - }, - _makeRequest(requestArgs, spec, overrideData) { - return new Promise((resolve, reject) => { - var _a; - let opts; - try { - opts = this._getRequestOpts(requestArgs, spec, overrideData); - } catch (err) { - reject(err); - return; - } - function requestCallback(err, response) { - if (err) { - reject(err); - } else { - resolve(spec.transformResponseData ? spec.transformResponseData(response) : response); - } - } - __name(requestCallback, "requestCallback"); - const emptyQuery = Object.keys(opts.queryData).length === 0; - const path = [ - opts.requestPath, - emptyQuery ? "" : "?", - queryStringifyRequestData(opts.queryData, getAPIMode(opts.requestPath)) - ].join(""); - const { headers, settings } = opts; - this._stripe._requestSender._request(opts.requestMethod, opts.host, path, opts.bodyData, opts.authenticator, { - headers, - settings, - streaming: opts.streaming - }, opts.usage, requestCallback, (_a = this.requestDataProcessor) === null || _a === void 0 ? void 0 : _a.bind(this)); - }); - } -}; - -// node_modules/stripe/esm/Webhooks.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -function createWebhooks(platformFunctions) { - const Webhook = { - DEFAULT_TOLERANCE: 300, - signature: null, - constructEvent(payload, header, secret, tolerance, cryptoProvider, receivedAt) { - try { - if (!this.signature) { - throw new Error("ERR: missing signature helper, unable to verify"); - } - this.signature.verifyHeader(payload, header, secret, tolerance || Webhook.DEFAULT_TOLERANCE, cryptoProvider, receivedAt); - } catch (e) { - if (e instanceof CryptoProviderOnlySupportsAsyncError) { - e.message += "\nUse `await constructEventAsync(...)` instead of `constructEvent(...)`"; - } - throw e; - } - const jsonPayload = payload instanceof Uint8Array ? JSON.parse(new TextDecoder("utf8").decode(payload)) : JSON.parse(payload); - return jsonPayload; - }, - async constructEventAsync(payload, header, secret, tolerance, cryptoProvider, receivedAt) { - if (!this.signature) { - throw new Error("ERR: missing signature helper, unable to verify"); - } - await this.signature.verifyHeaderAsync(payload, header, secret, tolerance || Webhook.DEFAULT_TOLERANCE, cryptoProvider, receivedAt); - const jsonPayload = payload instanceof Uint8Array ? JSON.parse(new TextDecoder("utf8").decode(payload)) : JSON.parse(payload); - return jsonPayload; - }, - /** - * Generates a header to be used for webhook mocking - * - * @typedef {object} opts - * @property {number} timestamp - Timestamp of the header. Defaults to Date.now() - * @property {string} payload - JSON stringified payload object, containing the 'id' and 'object' parameters - * @property {string} secret - Stripe webhook secret 'whsec_...' - * @property {string} scheme - Version of API to hit. Defaults to 'v1'. - * @property {string} signature - Computed webhook signature - * @property {CryptoProvider} cryptoProvider - Crypto provider to use for computing the signature if none was provided. Defaults to NodeCryptoProvider. - */ - generateTestHeaderString: /* @__PURE__ */ __name(function(opts) { - const preparedOpts = prepareOptions(opts); - const signature2 = preparedOpts.signature || preparedOpts.cryptoProvider.computeHMACSignature(preparedOpts.payloadString, preparedOpts.secret); - return preparedOpts.generateHeaderString(signature2); - }, "generateTestHeaderString"), - generateTestHeaderStringAsync: /* @__PURE__ */ __name(async function(opts) { - const preparedOpts = prepareOptions(opts); - const signature2 = preparedOpts.signature || await preparedOpts.cryptoProvider.computeHMACSignatureAsync(preparedOpts.payloadString, preparedOpts.secret); - return preparedOpts.generateHeaderString(signature2); - }, "generateTestHeaderStringAsync") - }; - const signature = { - EXPECTED_SCHEME: "v1", - verifyHeader(encodedPayload, encodedHeader, secret, tolerance, cryptoProvider, receivedAt) { - const { decodedHeader: header, decodedPayload: payload, details, suspectPayloadType } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME); - const secretContainsWhitespace = /\s/.test(secret); - cryptoProvider = cryptoProvider || getCryptoProvider(); - const expectedSignature = cryptoProvider.computeHMACSignature(makeHMACContent(payload, details), secret); - validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType, secretContainsWhitespace, receivedAt); - return true; - }, - async verifyHeaderAsync(encodedPayload, encodedHeader, secret, tolerance, cryptoProvider, receivedAt) { - const { decodedHeader: header, decodedPayload: payload, details, suspectPayloadType } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME); - const secretContainsWhitespace = /\s/.test(secret); - cryptoProvider = cryptoProvider || getCryptoProvider(); - const expectedSignature = await cryptoProvider.computeHMACSignatureAsync(makeHMACContent(payload, details), secret); - return validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType, secretContainsWhitespace, receivedAt); - } - }; - function makeHMACContent(payload, details) { - return `${details.timestamp}.${payload}`; - } - __name(makeHMACContent, "makeHMACContent"); - function parseEventDetails(encodedPayload, encodedHeader, expectedScheme) { - if (!encodedPayload) { - throw new StripeSignatureVerificationError(encodedHeader, encodedPayload, { - message: "No webhook payload was provided." - }); - } - const suspectPayloadType = typeof encodedPayload != "string" && !(encodedPayload instanceof Uint8Array); - const textDecoder = new TextDecoder("utf8"); - const decodedPayload = encodedPayload instanceof Uint8Array ? textDecoder.decode(encodedPayload) : encodedPayload; - if (Array.isArray(encodedHeader)) { - throw new Error("Unexpected: An array was passed as a header, which should not be possible for the stripe-signature header."); - } - if (encodedHeader == null || encodedHeader == "") { - throw new StripeSignatureVerificationError(encodedHeader, encodedPayload, { - message: "No stripe-signature header value was provided." - }); - } - const decodedHeader = encodedHeader instanceof Uint8Array ? textDecoder.decode(encodedHeader) : encodedHeader; - const details = parseHeader(decodedHeader, expectedScheme); - if (!details || details.timestamp === -1) { - throw new StripeSignatureVerificationError(decodedHeader, decodedPayload, { - message: "Unable to extract timestamp and signatures from header" - }); - } - if (!details.signatures.length) { - throw new StripeSignatureVerificationError(decodedHeader, decodedPayload, { - message: "No signatures found with expected scheme" - }); - } - return { - decodedPayload, - decodedHeader, - details, - suspectPayloadType - }; - } - __name(parseEventDetails, "parseEventDetails"); - function validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType, secretContainsWhitespace, receivedAt) { - const signatureFound = !!details.signatures.filter(platformFunctions.secureCompare.bind(platformFunctions, expectedSignature)).length; - const docsLocation = "\nLearn more about webhook signing and explore webhook integration examples for various frameworks at https://docs.stripe.com/webhooks/signature"; - const whitespaceMessage = secretContainsWhitespace ? "\n\nNote: The provided signing secret contains whitespace. This often indicates an extra newline or space is in the value" : ""; - if (!signatureFound) { - if (suspectPayloadType) { - throw new StripeSignatureVerificationError(header, payload, { - 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. \nSignature verification is impossible without access to the original signed material. \n" + docsLocation + "\n" + whitespaceMessage - }); - } - throw new StripeSignatureVerificationError(header, payload, { - message: "No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? \n 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.\n" + docsLocation + "\n" + whitespaceMessage - }); - } - const timestampAge = Math.floor((typeof receivedAt === "number" ? receivedAt : Date.now()) / 1e3) - details.timestamp; - if (tolerance > 0 && timestampAge > tolerance) { - throw new StripeSignatureVerificationError(header, payload, { - message: "Timestamp outside the tolerance zone" - }); - } - return true; - } - __name(validateComputedSignature, "validateComputedSignature"); - function parseHeader(header, scheme) { - if (typeof header !== "string") { - return null; - } - return header.split(",").reduce((accum, item) => { - const kv = item.split("="); - if (kv[0] === "t") { - accum.timestamp = parseInt(kv[1], 10); - } - if (kv[0] === scheme) { - accum.signatures.push(kv[1]); - } - return accum; - }, { - timestamp: -1, - signatures: [] - }); - } - __name(parseHeader, "parseHeader"); - let webhooksCryptoProviderInstance = null; - function getCryptoProvider() { - if (!webhooksCryptoProviderInstance) { - webhooksCryptoProviderInstance = platformFunctions.createDefaultCryptoProvider(); - } - return webhooksCryptoProviderInstance; - } - __name(getCryptoProvider, "getCryptoProvider"); - function prepareOptions(opts) { - if (!opts) { - throw new StripeError({ - message: "Options are required" - }); - } - const timestamp = Math.floor(opts.timestamp) || Math.floor(Date.now() / 1e3); - const scheme = opts.scheme || signature.EXPECTED_SCHEME; - const cryptoProvider = opts.cryptoProvider || getCryptoProvider(); - const payloadString = `${timestamp}.${opts.payload}`; - const generateHeaderString = /* @__PURE__ */ __name((signature2) => { - return `t=${timestamp},${scheme}=${signature2}`; - }, "generateHeaderString"); - return Object.assign(Object.assign({}, opts), { - timestamp, - scheme, - cryptoProvider, - payloadString, - generateHeaderString - }); - } - __name(prepareOptions, "prepareOptions"); - Webhook.signature = signature; - return Webhook; -} -__name(createWebhooks, "createWebhooks"); - -// node_modules/stripe/esm/apiVersion.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var ApiVersion = "2025-08-27.basil"; - -// node_modules/stripe/esm/resources.js -var resources_exports = {}; -__export(resources_exports, { - Account: () => Accounts2, - AccountLinks: () => AccountLinks, - AccountSessions: () => AccountSessions, - Accounts: () => Accounts2, - ApplePayDomains: () => ApplePayDomains, - ApplicationFees: () => ApplicationFees, - Apps: () => Apps, - Balance: () => Balance, - BalanceTransactions: () => BalanceTransactions, - Billing: () => Billing, - BillingPortal: () => BillingPortal, - Charges: () => Charges, - Checkout: () => Checkout, - Climate: () => Climate, - ConfirmationTokens: () => ConfirmationTokens2, - CountrySpecs: () => CountrySpecs, - Coupons: () => Coupons, - CreditNotes: () => CreditNotes, - CustomerSessions: () => CustomerSessions, - Customers: () => Customers2, - Disputes: () => Disputes2, - Entitlements: () => Entitlements, - EphemeralKeys: () => EphemeralKeys, - Events: () => Events2, - ExchangeRates: () => ExchangeRates, - FileLinks: () => FileLinks, - Files: () => Files, - FinancialConnections: () => FinancialConnections, - Forwarding: () => Forwarding, - Identity: () => Identity, - InvoiceItems: () => InvoiceItems, - InvoicePayments: () => InvoicePayments, - InvoiceRenderingTemplates: () => InvoiceRenderingTemplates, - Invoices: () => Invoices, - Issuing: () => Issuing, - Mandates: () => Mandates, - OAuth: () => OAuth, - PaymentIntents: () => PaymentIntents, - PaymentLinks: () => PaymentLinks, - PaymentMethodConfigurations: () => PaymentMethodConfigurations, - PaymentMethodDomains: () => PaymentMethodDomains, - PaymentMethods: () => PaymentMethods, - Payouts: () => Payouts, - Plans: () => Plans, - Prices: () => Prices, - Products: () => Products2, - PromotionCodes: () => PromotionCodes, - Quotes: () => Quotes, - Radar: () => Radar, - Refunds: () => Refunds2, - Reporting: () => Reporting, - Reviews: () => Reviews, - SetupAttempts: () => SetupAttempts, - SetupIntents: () => SetupIntents, - ShippingRates: () => ShippingRates, - Sigma: () => Sigma, - Sources: () => Sources, - SubscriptionItems: () => SubscriptionItems, - SubscriptionSchedules: () => SubscriptionSchedules, - Subscriptions: () => Subscriptions, - Tax: () => Tax, - TaxCodes: () => TaxCodes, - TaxIds: () => TaxIds, - TaxRates: () => TaxRates, - Terminal: () => Terminal, - TestHelpers: () => TestHelpers, - Tokens: () => Tokens2, - Topups: () => Topups, - Transfers: () => Transfers, - Treasury: () => Treasury, - V2: () => V2, - WebhookEndpoints: () => WebhookEndpoints -}); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/ResourceNamespace.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -function ResourceNamespace(stripe, resources) { - for (const name in resources) { - if (!Object.prototype.hasOwnProperty.call(resources, name)) { - continue; - } - const camelCaseName = name[0].toLowerCase() + name.substring(1); - const resource = new resources[name](stripe); - this[camelCaseName] = resource; - } -} -__name(ResourceNamespace, "ResourceNamespace"); -function resourceNamespace(namespace, resources) { - return function(stripe) { - return new ResourceNamespace(stripe, resources); - }; -} -__name(resourceNamespace, "resourceNamespace"); - -// node_modules/stripe/esm/resources/FinancialConnections/Accounts.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod2 = StripeResource.method; -var Accounts = StripeResource.extend({ - retrieve: stripeMethod2({ - method: "GET", - fullPath: "/v1/financial_connections/accounts/{account}" - }), - list: stripeMethod2({ - method: "GET", - fullPath: "/v1/financial_connections/accounts", - methodType: "list" - }), - disconnect: stripeMethod2({ - method: "POST", - fullPath: "/v1/financial_connections/accounts/{account}/disconnect" - }), - listOwners: stripeMethod2({ - method: "GET", - fullPath: "/v1/financial_connections/accounts/{account}/owners", - methodType: "list" - }), - refresh: stripeMethod2({ - method: "POST", - fullPath: "/v1/financial_connections/accounts/{account}/refresh" - }), - subscribe: stripeMethod2({ - method: "POST", - fullPath: "/v1/financial_connections/accounts/{account}/subscribe" - }), - unsubscribe: stripeMethod2({ - method: "POST", - fullPath: "/v1/financial_connections/accounts/{account}/unsubscribe" - }) -}); - -// node_modules/stripe/esm/resources/Entitlements/ActiveEntitlements.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod3 = StripeResource.method; -var ActiveEntitlements = StripeResource.extend({ - retrieve: stripeMethod3({ - method: "GET", - fullPath: "/v1/entitlements/active_entitlements/{id}" - }), - list: stripeMethod3({ - method: "GET", - fullPath: "/v1/entitlements/active_entitlements", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Billing/Alerts.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod4 = StripeResource.method; -var Alerts = StripeResource.extend({ - create: stripeMethod4({ method: "POST", fullPath: "/v1/billing/alerts" }), - retrieve: stripeMethod4({ method: "GET", fullPath: "/v1/billing/alerts/{id}" }), - list: stripeMethod4({ - method: "GET", - fullPath: "/v1/billing/alerts", - methodType: "list" - }), - activate: stripeMethod4({ - method: "POST", - fullPath: "/v1/billing/alerts/{id}/activate" - }), - archive: stripeMethod4({ - method: "POST", - fullPath: "/v1/billing/alerts/{id}/archive" - }), - deactivate: stripeMethod4({ - method: "POST", - fullPath: "/v1/billing/alerts/{id}/deactivate" - }) -}); - -// node_modules/stripe/esm/resources/Issuing/Authorizations.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod5 = StripeResource.method; -var Authorizations = StripeResource.extend({ - retrieve: stripeMethod5({ - method: "GET", - fullPath: "/v1/issuing/authorizations/{authorization}" - }), - update: stripeMethod5({ - method: "POST", - fullPath: "/v1/issuing/authorizations/{authorization}" - }), - list: stripeMethod5({ - method: "GET", - fullPath: "/v1/issuing/authorizations", - methodType: "list" - }), - approve: stripeMethod5({ - method: "POST", - fullPath: "/v1/issuing/authorizations/{authorization}/approve" - }), - decline: stripeMethod5({ - method: "POST", - fullPath: "/v1/issuing/authorizations/{authorization}/decline" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Issuing/Authorizations.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod6 = StripeResource.method; -var Authorizations2 = StripeResource.extend({ - create: stripeMethod6({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/authorizations" - }), - capture: stripeMethod6({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/authorizations/{authorization}/capture" - }), - expire: stripeMethod6({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/authorizations/{authorization}/expire" - }), - finalizeAmount: stripeMethod6({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/authorizations/{authorization}/finalize_amount" - }), - increment: stripeMethod6({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/authorizations/{authorization}/increment" - }), - respond: stripeMethod6({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond" - }), - reverse: stripeMethod6({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/authorizations/{authorization}/reverse" - }) -}); - -// node_modules/stripe/esm/resources/Tax/Calculations.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod7 = StripeResource.method; -var Calculations = StripeResource.extend({ - create: stripeMethod7({ method: "POST", fullPath: "/v1/tax/calculations" }), - retrieve: stripeMethod7({ - method: "GET", - fullPath: "/v1/tax/calculations/{calculation}" - }), - listLineItems: stripeMethod7({ - method: "GET", - fullPath: "/v1/tax/calculations/{calculation}/line_items", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Issuing/Cardholders.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod8 = StripeResource.method; -var Cardholders = StripeResource.extend({ - create: stripeMethod8({ method: "POST", fullPath: "/v1/issuing/cardholders" }), - retrieve: stripeMethod8({ - method: "GET", - fullPath: "/v1/issuing/cardholders/{cardholder}" - }), - update: stripeMethod8({ - method: "POST", - fullPath: "/v1/issuing/cardholders/{cardholder}" - }), - list: stripeMethod8({ - method: "GET", - fullPath: "/v1/issuing/cardholders", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Issuing/Cards.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod9 = StripeResource.method; -var Cards = StripeResource.extend({ - create: stripeMethod9({ method: "POST", fullPath: "/v1/issuing/cards" }), - retrieve: stripeMethod9({ method: "GET", fullPath: "/v1/issuing/cards/{card}" }), - update: stripeMethod9({ method: "POST", fullPath: "/v1/issuing/cards/{card}" }), - list: stripeMethod9({ - method: "GET", - fullPath: "/v1/issuing/cards", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Issuing/Cards.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod10 = StripeResource.method; -var Cards2 = StripeResource.extend({ - deliverCard: stripeMethod10({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/cards/{card}/shipping/deliver" - }), - failCard: stripeMethod10({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/cards/{card}/shipping/fail" - }), - returnCard: stripeMethod10({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/cards/{card}/shipping/return" - }), - shipCard: stripeMethod10({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/cards/{card}/shipping/ship" - }), - submitCard: stripeMethod10({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/cards/{card}/shipping/submit" - }) -}); - -// node_modules/stripe/esm/resources/BillingPortal/Configurations.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod11 = StripeResource.method; -var Configurations = StripeResource.extend({ - create: stripeMethod11({ - method: "POST", - fullPath: "/v1/billing_portal/configurations" - }), - retrieve: stripeMethod11({ - method: "GET", - fullPath: "/v1/billing_portal/configurations/{configuration}" - }), - update: stripeMethod11({ - method: "POST", - fullPath: "/v1/billing_portal/configurations/{configuration}" - }), - list: stripeMethod11({ - method: "GET", - fullPath: "/v1/billing_portal/configurations", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Terminal/Configurations.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod12 = StripeResource.method; -var Configurations2 = StripeResource.extend({ - create: stripeMethod12({ - method: "POST", - fullPath: "/v1/terminal/configurations" - }), - retrieve: stripeMethod12({ - method: "GET", - fullPath: "/v1/terminal/configurations/{configuration}" - }), - update: stripeMethod12({ - method: "POST", - fullPath: "/v1/terminal/configurations/{configuration}" - }), - list: stripeMethod12({ - method: "GET", - fullPath: "/v1/terminal/configurations", - methodType: "list" - }), - del: stripeMethod12({ - method: "DELETE", - fullPath: "/v1/terminal/configurations/{configuration}" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/ConfirmationTokens.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod13 = StripeResource.method; -var ConfirmationTokens = StripeResource.extend({ - create: stripeMethod13({ - method: "POST", - fullPath: "/v1/test_helpers/confirmation_tokens" - }) -}); - -// node_modules/stripe/esm/resources/Terminal/ConnectionTokens.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod14 = StripeResource.method; -var ConnectionTokens = StripeResource.extend({ - create: stripeMethod14({ - method: "POST", - fullPath: "/v1/terminal/connection_tokens" - }) -}); - -// node_modules/stripe/esm/resources/Billing/CreditBalanceSummary.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod15 = StripeResource.method; -var CreditBalanceSummary = StripeResource.extend({ - retrieve: stripeMethod15({ - method: "GET", - fullPath: "/v1/billing/credit_balance_summary" - }) -}); - -// node_modules/stripe/esm/resources/Billing/CreditBalanceTransactions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod16 = StripeResource.method; -var CreditBalanceTransactions = StripeResource.extend({ - retrieve: stripeMethod16({ - method: "GET", - fullPath: "/v1/billing/credit_balance_transactions/{id}" - }), - list: stripeMethod16({ - method: "GET", - fullPath: "/v1/billing/credit_balance_transactions", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Billing/CreditGrants.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod17 = StripeResource.method; -var CreditGrants = StripeResource.extend({ - create: stripeMethod17({ method: "POST", fullPath: "/v1/billing/credit_grants" }), - retrieve: stripeMethod17({ - method: "GET", - fullPath: "/v1/billing/credit_grants/{id}" - }), - update: stripeMethod17({ - method: "POST", - fullPath: "/v1/billing/credit_grants/{id}" - }), - list: stripeMethod17({ - method: "GET", - fullPath: "/v1/billing/credit_grants", - methodType: "list" - }), - expire: stripeMethod17({ - method: "POST", - fullPath: "/v1/billing/credit_grants/{id}/expire" - }), - voidGrant: stripeMethod17({ - method: "POST", - fullPath: "/v1/billing/credit_grants/{id}/void" - }) -}); - -// node_modules/stripe/esm/resources/Treasury/CreditReversals.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod18 = StripeResource.method; -var CreditReversals = StripeResource.extend({ - create: stripeMethod18({ - method: "POST", - fullPath: "/v1/treasury/credit_reversals" - }), - retrieve: stripeMethod18({ - method: "GET", - fullPath: "/v1/treasury/credit_reversals/{credit_reversal}" - }), - list: stripeMethod18({ - method: "GET", - fullPath: "/v1/treasury/credit_reversals", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Customers.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod19 = StripeResource.method; -var Customers = StripeResource.extend({ - fundCashBalance: stripeMethod19({ - method: "POST", - fullPath: "/v1/test_helpers/customers/{customer}/fund_cash_balance" - }) -}); - -// node_modules/stripe/esm/resources/Treasury/DebitReversals.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod20 = StripeResource.method; -var DebitReversals = StripeResource.extend({ - create: stripeMethod20({ - method: "POST", - fullPath: "/v1/treasury/debit_reversals" - }), - retrieve: stripeMethod20({ - method: "GET", - fullPath: "/v1/treasury/debit_reversals/{debit_reversal}" - }), - list: stripeMethod20({ - method: "GET", - fullPath: "/v1/treasury/debit_reversals", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Issuing/Disputes.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod21 = StripeResource.method; -var Disputes = StripeResource.extend({ - create: stripeMethod21({ method: "POST", fullPath: "/v1/issuing/disputes" }), - retrieve: stripeMethod21({ - method: "GET", - fullPath: "/v1/issuing/disputes/{dispute}" - }), - update: stripeMethod21({ - method: "POST", - fullPath: "/v1/issuing/disputes/{dispute}" - }), - list: stripeMethod21({ - method: "GET", - fullPath: "/v1/issuing/disputes", - methodType: "list" - }), - submit: stripeMethod21({ - method: "POST", - fullPath: "/v1/issuing/disputes/{dispute}/submit" - }) -}); - -// node_modules/stripe/esm/resources/Radar/EarlyFraudWarnings.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod22 = StripeResource.method; -var EarlyFraudWarnings = StripeResource.extend({ - retrieve: stripeMethod22({ - method: "GET", - fullPath: "/v1/radar/early_fraud_warnings/{early_fraud_warning}" - }), - list: stripeMethod22({ - method: "GET", - fullPath: "/v1/radar/early_fraud_warnings", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/V2/Core/EventDestinations.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod23 = StripeResource.method; -var EventDestinations = StripeResource.extend({ - create: stripeMethod23({ - method: "POST", - fullPath: "/v2/core/event_destinations" - }), - retrieve: stripeMethod23({ - method: "GET", - fullPath: "/v2/core/event_destinations/{id}" - }), - update: stripeMethod23({ - method: "POST", - fullPath: "/v2/core/event_destinations/{id}" - }), - list: stripeMethod23({ - method: "GET", - fullPath: "/v2/core/event_destinations", - methodType: "list" - }), - del: stripeMethod23({ - method: "DELETE", - fullPath: "/v2/core/event_destinations/{id}" - }), - disable: stripeMethod23({ - method: "POST", - fullPath: "/v2/core/event_destinations/{id}/disable" - }), - enable: stripeMethod23({ - method: "POST", - fullPath: "/v2/core/event_destinations/{id}/enable" - }), - ping: stripeMethod23({ - method: "POST", - fullPath: "/v2/core/event_destinations/{id}/ping" - }) -}); - -// node_modules/stripe/esm/resources/V2/Core/Events.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod24 = StripeResource.method; -var Events = StripeResource.extend({ - retrieve(...args) { - const transformResponseData = /* @__PURE__ */ __name((response) => { - return this.addFetchRelatedObjectIfNeeded(response); - }, "transformResponseData"); - return stripeMethod24({ - method: "GET", - fullPath: "/v2/core/events/{id}", - transformResponseData - }).apply(this, args); - }, - list(...args) { - const transformResponseData = /* @__PURE__ */ __name((response) => { - return Object.assign(Object.assign({}, response), { data: response.data.map(this.addFetchRelatedObjectIfNeeded.bind(this)) }); - }, "transformResponseData"); - return stripeMethod24({ - method: "GET", - fullPath: "/v2/core/events", - methodType: "list", - transformResponseData - }).apply(this, args); - }, - /** - * @private - * - * For internal use in stripe-node. - * - * @param pulledEvent The retrieved event object - * @returns The retrieved event object with a fetchRelatedObject method, - * if pulledEvent.related_object is valid (non-null and has a url) - */ - addFetchRelatedObjectIfNeeded(pulledEvent) { - if (!pulledEvent.related_object || !pulledEvent.related_object.url) { - return pulledEvent; - } - return Object.assign(Object.assign({}, pulledEvent), { fetchRelatedObject: /* @__PURE__ */ __name(() => ( - // call stripeMethod with 'this' resource to fetch - // the related object. 'this' is needed to construct - // and send the request, but the method spec controls - // the url endpoint and method, so it doesn't matter - // that 'this' is an Events resource object here - stripeMethod24({ - method: "GET", - fullPath: pulledEvent.related_object.url - }).apply(this, [ - { - stripeAccount: pulledEvent.context - } - ]) - ), "fetchRelatedObject") }); - } -}); - -// node_modules/stripe/esm/resources/Entitlements/Features.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod25 = StripeResource.method; -var Features = StripeResource.extend({ - create: stripeMethod25({ method: "POST", fullPath: "/v1/entitlements/features" }), - retrieve: stripeMethod25({ - method: "GET", - fullPath: "/v1/entitlements/features/{id}" - }), - update: stripeMethod25({ - method: "POST", - fullPath: "/v1/entitlements/features/{id}" - }), - list: stripeMethod25({ - method: "GET", - fullPath: "/v1/entitlements/features", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Treasury/FinancialAccounts.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod26 = StripeResource.method; -var FinancialAccounts = StripeResource.extend({ - create: stripeMethod26({ - method: "POST", - fullPath: "/v1/treasury/financial_accounts" - }), - retrieve: stripeMethod26({ - method: "GET", - fullPath: "/v1/treasury/financial_accounts/{financial_account}" - }), - update: stripeMethod26({ - method: "POST", - fullPath: "/v1/treasury/financial_accounts/{financial_account}" - }), - list: stripeMethod26({ - method: "GET", - fullPath: "/v1/treasury/financial_accounts", - methodType: "list" - }), - close: stripeMethod26({ - method: "POST", - fullPath: "/v1/treasury/financial_accounts/{financial_account}/close" - }), - retrieveFeatures: stripeMethod26({ - method: "GET", - fullPath: "/v1/treasury/financial_accounts/{financial_account}/features" - }), - updateFeatures: stripeMethod26({ - method: "POST", - fullPath: "/v1/treasury/financial_accounts/{financial_account}/features" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Treasury/InboundTransfers.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod27 = StripeResource.method; -var InboundTransfers = StripeResource.extend({ - fail: stripeMethod27({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/inbound_transfers/{id}/fail" - }), - returnInboundTransfer: stripeMethod27({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/inbound_transfers/{id}/return" - }), - succeed: stripeMethod27({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/inbound_transfers/{id}/succeed" - }) -}); - -// node_modules/stripe/esm/resources/Treasury/InboundTransfers.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod28 = StripeResource.method; -var InboundTransfers2 = StripeResource.extend({ - create: stripeMethod28({ - method: "POST", - fullPath: "/v1/treasury/inbound_transfers" - }), - retrieve: stripeMethod28({ - method: "GET", - fullPath: "/v1/treasury/inbound_transfers/{id}" - }), - list: stripeMethod28({ - method: "GET", - fullPath: "/v1/treasury/inbound_transfers", - methodType: "list" - }), - cancel: stripeMethod28({ - method: "POST", - fullPath: "/v1/treasury/inbound_transfers/{inbound_transfer}/cancel" - }) -}); - -// node_modules/stripe/esm/resources/Terminal/Locations.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod29 = StripeResource.method; -var Locations = StripeResource.extend({ - create: stripeMethod29({ method: "POST", fullPath: "/v1/terminal/locations" }), - retrieve: stripeMethod29({ - method: "GET", - fullPath: "/v1/terminal/locations/{location}" - }), - update: stripeMethod29({ - method: "POST", - fullPath: "/v1/terminal/locations/{location}" - }), - list: stripeMethod29({ - method: "GET", - fullPath: "/v1/terminal/locations", - methodType: "list" - }), - del: stripeMethod29({ - method: "DELETE", - fullPath: "/v1/terminal/locations/{location}" - }) -}); - -// node_modules/stripe/esm/resources/Billing/MeterEventAdjustments.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod30 = StripeResource.method; -var MeterEventAdjustments = StripeResource.extend({ - create: stripeMethod30({ - method: "POST", - fullPath: "/v1/billing/meter_event_adjustments" - }) -}); - -// node_modules/stripe/esm/resources/V2/Billing/MeterEventAdjustments.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod31 = StripeResource.method; -var MeterEventAdjustments2 = StripeResource.extend({ - create: stripeMethod31({ - method: "POST", - fullPath: "/v2/billing/meter_event_adjustments" - }) -}); - -// node_modules/stripe/esm/resources/V2/Billing/MeterEventSession.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod32 = StripeResource.method; -var MeterEventSession = StripeResource.extend({ - create: stripeMethod32({ - method: "POST", - fullPath: "/v2/billing/meter_event_session" - }) -}); - -// node_modules/stripe/esm/resources/V2/Billing/MeterEventStream.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod33 = StripeResource.method; -var MeterEventStream = StripeResource.extend({ - create: stripeMethod33({ - method: "POST", - fullPath: "/v2/billing/meter_event_stream", - host: "meter-events.stripe.com" - }) -}); - -// node_modules/stripe/esm/resources/Billing/MeterEvents.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod34 = StripeResource.method; -var MeterEvents = StripeResource.extend({ - create: stripeMethod34({ method: "POST", fullPath: "/v1/billing/meter_events" }) -}); - -// node_modules/stripe/esm/resources/V2/Billing/MeterEvents.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod35 = StripeResource.method; -var MeterEvents2 = StripeResource.extend({ - create: stripeMethod35({ method: "POST", fullPath: "/v2/billing/meter_events" }) -}); - -// node_modules/stripe/esm/resources/Billing/Meters.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod36 = StripeResource.method; -var Meters = StripeResource.extend({ - create: stripeMethod36({ method: "POST", fullPath: "/v1/billing/meters" }), - retrieve: stripeMethod36({ method: "GET", fullPath: "/v1/billing/meters/{id}" }), - update: stripeMethod36({ method: "POST", fullPath: "/v1/billing/meters/{id}" }), - list: stripeMethod36({ - method: "GET", - fullPath: "/v1/billing/meters", - methodType: "list" - }), - deactivate: stripeMethod36({ - method: "POST", - fullPath: "/v1/billing/meters/{id}/deactivate" - }), - listEventSummaries: stripeMethod36({ - method: "GET", - fullPath: "/v1/billing/meters/{id}/event_summaries", - methodType: "list" - }), - reactivate: stripeMethod36({ - method: "POST", - fullPath: "/v1/billing/meters/{id}/reactivate" - }) -}); - -// node_modules/stripe/esm/resources/Climate/Orders.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod37 = StripeResource.method; -var Orders = StripeResource.extend({ - create: stripeMethod37({ method: "POST", fullPath: "/v1/climate/orders" }), - retrieve: stripeMethod37({ - method: "GET", - fullPath: "/v1/climate/orders/{order}" - }), - update: stripeMethod37({ - method: "POST", - fullPath: "/v1/climate/orders/{order}" - }), - list: stripeMethod37({ - method: "GET", - fullPath: "/v1/climate/orders", - methodType: "list" - }), - cancel: stripeMethod37({ - method: "POST", - fullPath: "/v1/climate/orders/{order}/cancel" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Treasury/OutboundPayments.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod38 = StripeResource.method; -var OutboundPayments = StripeResource.extend({ - update: stripeMethod38({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/outbound_payments/{id}" - }), - fail: stripeMethod38({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/outbound_payments/{id}/fail" - }), - post: stripeMethod38({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/outbound_payments/{id}/post" - }), - returnOutboundPayment: stripeMethod38({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/outbound_payments/{id}/return" - }) -}); - -// node_modules/stripe/esm/resources/Treasury/OutboundPayments.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod39 = StripeResource.method; -var OutboundPayments2 = StripeResource.extend({ - create: stripeMethod39({ - method: "POST", - fullPath: "/v1/treasury/outbound_payments" - }), - retrieve: stripeMethod39({ - method: "GET", - fullPath: "/v1/treasury/outbound_payments/{id}" - }), - list: stripeMethod39({ - method: "GET", - fullPath: "/v1/treasury/outbound_payments", - methodType: "list" - }), - cancel: stripeMethod39({ - method: "POST", - fullPath: "/v1/treasury/outbound_payments/{id}/cancel" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Treasury/OutboundTransfers.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod40 = StripeResource.method; -var OutboundTransfers = StripeResource.extend({ - update: stripeMethod40({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}" - }), - fail: stripeMethod40({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail" - }), - post: stripeMethod40({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post" - }), - returnOutboundTransfer: stripeMethod40({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return" - }) -}); - -// node_modules/stripe/esm/resources/Treasury/OutboundTransfers.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod41 = StripeResource.method; -var OutboundTransfers2 = StripeResource.extend({ - create: stripeMethod41({ - method: "POST", - fullPath: "/v1/treasury/outbound_transfers" - }), - retrieve: stripeMethod41({ - method: "GET", - fullPath: "/v1/treasury/outbound_transfers/{outbound_transfer}" - }), - list: stripeMethod41({ - method: "GET", - fullPath: "/v1/treasury/outbound_transfers", - methodType: "list" - }), - cancel: stripeMethod41({ - method: "POST", - fullPath: "/v1/treasury/outbound_transfers/{outbound_transfer}/cancel" - }) -}); - -// node_modules/stripe/esm/resources/Issuing/PersonalizationDesigns.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod42 = StripeResource.method; -var PersonalizationDesigns = StripeResource.extend({ - create: stripeMethod42({ - method: "POST", - fullPath: "/v1/issuing/personalization_designs" - }), - retrieve: stripeMethod42({ - method: "GET", - fullPath: "/v1/issuing/personalization_designs/{personalization_design}" - }), - update: stripeMethod42({ - method: "POST", - fullPath: "/v1/issuing/personalization_designs/{personalization_design}" - }), - list: stripeMethod42({ - method: "GET", - fullPath: "/v1/issuing/personalization_designs", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Issuing/PersonalizationDesigns.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod43 = StripeResource.method; -var PersonalizationDesigns2 = StripeResource.extend({ - activate: stripeMethod43({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/personalization_designs/{personalization_design}/activate" - }), - deactivate: stripeMethod43({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/personalization_designs/{personalization_design}/deactivate" - }), - reject: stripeMethod43({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/personalization_designs/{personalization_design}/reject" - }) -}); - -// node_modules/stripe/esm/resources/Issuing/PhysicalBundles.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod44 = StripeResource.method; -var PhysicalBundles = StripeResource.extend({ - retrieve: stripeMethod44({ - method: "GET", - fullPath: "/v1/issuing/physical_bundles/{physical_bundle}" - }), - list: stripeMethod44({ - method: "GET", - fullPath: "/v1/issuing/physical_bundles", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Climate/Products.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod45 = StripeResource.method; -var Products = StripeResource.extend({ - retrieve: stripeMethod45({ - method: "GET", - fullPath: "/v1/climate/products/{product}" - }), - list: stripeMethod45({ - method: "GET", - fullPath: "/v1/climate/products", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Terminal/Readers.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod46 = StripeResource.method; -var Readers = StripeResource.extend({ - create: stripeMethod46({ method: "POST", fullPath: "/v1/terminal/readers" }), - retrieve: stripeMethod46({ - method: "GET", - fullPath: "/v1/terminal/readers/{reader}" - }), - update: stripeMethod46({ - method: "POST", - fullPath: "/v1/terminal/readers/{reader}" - }), - list: stripeMethod46({ - method: "GET", - fullPath: "/v1/terminal/readers", - methodType: "list" - }), - del: stripeMethod46({ - method: "DELETE", - fullPath: "/v1/terminal/readers/{reader}" - }), - cancelAction: stripeMethod46({ - method: "POST", - fullPath: "/v1/terminal/readers/{reader}/cancel_action" - }), - collectInputs: stripeMethod46({ - method: "POST", - fullPath: "/v1/terminal/readers/{reader}/collect_inputs" - }), - collectPaymentMethod: stripeMethod46({ - method: "POST", - fullPath: "/v1/terminal/readers/{reader}/collect_payment_method" - }), - confirmPaymentIntent: stripeMethod46({ - method: "POST", - fullPath: "/v1/terminal/readers/{reader}/confirm_payment_intent" - }), - processPaymentIntent: stripeMethod46({ - method: "POST", - fullPath: "/v1/terminal/readers/{reader}/process_payment_intent" - }), - processSetupIntent: stripeMethod46({ - method: "POST", - fullPath: "/v1/terminal/readers/{reader}/process_setup_intent" - }), - refundPayment: stripeMethod46({ - method: "POST", - fullPath: "/v1/terminal/readers/{reader}/refund_payment" - }), - setReaderDisplay: stripeMethod46({ - method: "POST", - fullPath: "/v1/terminal/readers/{reader}/set_reader_display" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Terminal/Readers.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod47 = StripeResource.method; -var Readers2 = StripeResource.extend({ - presentPaymentMethod: stripeMethod47({ - method: "POST", - fullPath: "/v1/test_helpers/terminal/readers/{reader}/present_payment_method" - }), - succeedInputCollection: stripeMethod47({ - method: "POST", - fullPath: "/v1/test_helpers/terminal/readers/{reader}/succeed_input_collection" - }), - timeoutInputCollection: stripeMethod47({ - method: "POST", - fullPath: "/v1/test_helpers/terminal/readers/{reader}/timeout_input_collection" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Treasury/ReceivedCredits.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod48 = StripeResource.method; -var ReceivedCredits = StripeResource.extend({ - create: stripeMethod48({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/received_credits" - }) -}); - -// node_modules/stripe/esm/resources/Treasury/ReceivedCredits.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod49 = StripeResource.method; -var ReceivedCredits2 = StripeResource.extend({ - retrieve: stripeMethod49({ - method: "GET", - fullPath: "/v1/treasury/received_credits/{id}" - }), - list: stripeMethod49({ - method: "GET", - fullPath: "/v1/treasury/received_credits", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Treasury/ReceivedDebits.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod50 = StripeResource.method; -var ReceivedDebits = StripeResource.extend({ - create: stripeMethod50({ - method: "POST", - fullPath: "/v1/test_helpers/treasury/received_debits" - }) -}); - -// node_modules/stripe/esm/resources/Treasury/ReceivedDebits.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod51 = StripeResource.method; -var ReceivedDebits2 = StripeResource.extend({ - retrieve: stripeMethod51({ - method: "GET", - fullPath: "/v1/treasury/received_debits/{id}" - }), - list: stripeMethod51({ - method: "GET", - fullPath: "/v1/treasury/received_debits", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Refunds.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod52 = StripeResource.method; -var Refunds = StripeResource.extend({ - expire: stripeMethod52({ - method: "POST", - fullPath: "/v1/test_helpers/refunds/{refund}/expire" - }) -}); - -// node_modules/stripe/esm/resources/Tax/Registrations.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod53 = StripeResource.method; -var Registrations = StripeResource.extend({ - create: stripeMethod53({ method: "POST", fullPath: "/v1/tax/registrations" }), - retrieve: stripeMethod53({ - method: "GET", - fullPath: "/v1/tax/registrations/{id}" - }), - update: stripeMethod53({ - method: "POST", - fullPath: "/v1/tax/registrations/{id}" - }), - list: stripeMethod53({ - method: "GET", - fullPath: "/v1/tax/registrations", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Reporting/ReportRuns.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod54 = StripeResource.method; -var ReportRuns = StripeResource.extend({ - create: stripeMethod54({ method: "POST", fullPath: "/v1/reporting/report_runs" }), - retrieve: stripeMethod54({ - method: "GET", - fullPath: "/v1/reporting/report_runs/{report_run}" - }), - list: stripeMethod54({ - method: "GET", - fullPath: "/v1/reporting/report_runs", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Reporting/ReportTypes.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod55 = StripeResource.method; -var ReportTypes = StripeResource.extend({ - retrieve: stripeMethod55({ - method: "GET", - fullPath: "/v1/reporting/report_types/{report_type}" - }), - list: stripeMethod55({ - method: "GET", - fullPath: "/v1/reporting/report_types", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Forwarding/Requests.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod56 = StripeResource.method; -var Requests = StripeResource.extend({ - create: stripeMethod56({ method: "POST", fullPath: "/v1/forwarding/requests" }), - retrieve: stripeMethod56({ - method: "GET", - fullPath: "/v1/forwarding/requests/{id}" - }), - list: stripeMethod56({ - method: "GET", - fullPath: "/v1/forwarding/requests", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Sigma/ScheduledQueryRuns.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod57 = StripeResource.method; -var ScheduledQueryRuns = StripeResource.extend({ - retrieve: stripeMethod57({ - method: "GET", - fullPath: "/v1/sigma/scheduled_query_runs/{scheduled_query_run}" - }), - list: stripeMethod57({ - method: "GET", - fullPath: "/v1/sigma/scheduled_query_runs", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Apps/Secrets.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod58 = StripeResource.method; -var Secrets = StripeResource.extend({ - create: stripeMethod58({ method: "POST", fullPath: "/v1/apps/secrets" }), - list: stripeMethod58({ - method: "GET", - fullPath: "/v1/apps/secrets", - methodType: "list" - }), - deleteWhere: stripeMethod58({ - method: "POST", - fullPath: "/v1/apps/secrets/delete" - }), - find: stripeMethod58({ method: "GET", fullPath: "/v1/apps/secrets/find" }) -}); - -// node_modules/stripe/esm/resources/BillingPortal/Sessions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod59 = StripeResource.method; -var Sessions = StripeResource.extend({ - create: stripeMethod59({ - method: "POST", - fullPath: "/v1/billing_portal/sessions" - }) -}); - -// node_modules/stripe/esm/resources/Checkout/Sessions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod60 = StripeResource.method; -var Sessions2 = StripeResource.extend({ - create: stripeMethod60({ method: "POST", fullPath: "/v1/checkout/sessions" }), - retrieve: stripeMethod60({ - method: "GET", - fullPath: "/v1/checkout/sessions/{session}" - }), - update: stripeMethod60({ - method: "POST", - fullPath: "/v1/checkout/sessions/{session}" - }), - list: stripeMethod60({ - method: "GET", - fullPath: "/v1/checkout/sessions", - methodType: "list" - }), - expire: stripeMethod60({ - method: "POST", - fullPath: "/v1/checkout/sessions/{session}/expire" - }), - listLineItems: stripeMethod60({ - method: "GET", - fullPath: "/v1/checkout/sessions/{session}/line_items", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/FinancialConnections/Sessions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod61 = StripeResource.method; -var Sessions3 = StripeResource.extend({ - create: stripeMethod61({ - method: "POST", - fullPath: "/v1/financial_connections/sessions" - }), - retrieve: stripeMethod61({ - method: "GET", - fullPath: "/v1/financial_connections/sessions/{session}" - }) -}); - -// node_modules/stripe/esm/resources/Tax/Settings.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod62 = StripeResource.method; -var Settings = StripeResource.extend({ - retrieve: stripeMethod62({ method: "GET", fullPath: "/v1/tax/settings" }), - update: stripeMethod62({ method: "POST", fullPath: "/v1/tax/settings" }) -}); - -// node_modules/stripe/esm/resources/Climate/Suppliers.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod63 = StripeResource.method; -var Suppliers = StripeResource.extend({ - retrieve: stripeMethod63({ - method: "GET", - fullPath: "/v1/climate/suppliers/{supplier}" - }), - list: stripeMethod63({ - method: "GET", - fullPath: "/v1/climate/suppliers", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/TestClocks.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod64 = StripeResource.method; -var TestClocks = StripeResource.extend({ - create: stripeMethod64({ - method: "POST", - fullPath: "/v1/test_helpers/test_clocks" - }), - retrieve: stripeMethod64({ - method: "GET", - fullPath: "/v1/test_helpers/test_clocks/{test_clock}" - }), - list: stripeMethod64({ - method: "GET", - fullPath: "/v1/test_helpers/test_clocks", - methodType: "list" - }), - del: stripeMethod64({ - method: "DELETE", - fullPath: "/v1/test_helpers/test_clocks/{test_clock}" - }), - advance: stripeMethod64({ - method: "POST", - fullPath: "/v1/test_helpers/test_clocks/{test_clock}/advance" - }) -}); - -// node_modules/stripe/esm/resources/Issuing/Tokens.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod65 = StripeResource.method; -var Tokens = StripeResource.extend({ - retrieve: stripeMethod65({ - method: "GET", - fullPath: "/v1/issuing/tokens/{token}" - }), - update: stripeMethod65({ - method: "POST", - fullPath: "/v1/issuing/tokens/{token}" - }), - list: stripeMethod65({ - method: "GET", - fullPath: "/v1/issuing/tokens", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Treasury/TransactionEntries.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod66 = StripeResource.method; -var TransactionEntries = StripeResource.extend({ - retrieve: stripeMethod66({ - method: "GET", - fullPath: "/v1/treasury/transaction_entries/{id}" - }), - list: stripeMethod66({ - method: "GET", - fullPath: "/v1/treasury/transaction_entries", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/FinancialConnections/Transactions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod67 = StripeResource.method; -var Transactions = StripeResource.extend({ - retrieve: stripeMethod67({ - method: "GET", - fullPath: "/v1/financial_connections/transactions/{transaction}" - }), - list: stripeMethod67({ - method: "GET", - fullPath: "/v1/financial_connections/transactions", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Issuing/Transactions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod68 = StripeResource.method; -var Transactions2 = StripeResource.extend({ - retrieve: stripeMethod68({ - method: "GET", - fullPath: "/v1/issuing/transactions/{transaction}" - }), - update: stripeMethod68({ - method: "POST", - fullPath: "/v1/issuing/transactions/{transaction}" - }), - list: stripeMethod68({ - method: "GET", - fullPath: "/v1/issuing/transactions", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Tax/Transactions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod69 = StripeResource.method; -var Transactions3 = StripeResource.extend({ - retrieve: stripeMethod69({ - method: "GET", - fullPath: "/v1/tax/transactions/{transaction}" - }), - createFromCalculation: stripeMethod69({ - method: "POST", - fullPath: "/v1/tax/transactions/create_from_calculation" - }), - createReversal: stripeMethod69({ - method: "POST", - fullPath: "/v1/tax/transactions/create_reversal" - }), - listLineItems: stripeMethod69({ - method: "GET", - fullPath: "/v1/tax/transactions/{transaction}/line_items", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/TestHelpers/Issuing/Transactions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod70 = StripeResource.method; -var Transactions4 = StripeResource.extend({ - createForceCapture: stripeMethod70({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/transactions/create_force_capture" - }), - createUnlinkedRefund: stripeMethod70({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/transactions/create_unlinked_refund" - }), - refund: stripeMethod70({ - method: "POST", - fullPath: "/v1/test_helpers/issuing/transactions/{transaction}/refund" - }) -}); - -// node_modules/stripe/esm/resources/Treasury/Transactions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod71 = StripeResource.method; -var Transactions5 = StripeResource.extend({ - retrieve: stripeMethod71({ - method: "GET", - fullPath: "/v1/treasury/transactions/{id}" - }), - list: stripeMethod71({ - method: "GET", - fullPath: "/v1/treasury/transactions", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Radar/ValueListItems.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod72 = StripeResource.method; -var ValueListItems = StripeResource.extend({ - create: stripeMethod72({ - method: "POST", - fullPath: "/v1/radar/value_list_items" - }), - retrieve: stripeMethod72({ - method: "GET", - fullPath: "/v1/radar/value_list_items/{item}" - }), - list: stripeMethod72({ - method: "GET", - fullPath: "/v1/radar/value_list_items", - methodType: "list" - }), - del: stripeMethod72({ - method: "DELETE", - fullPath: "/v1/radar/value_list_items/{item}" - }) -}); - -// node_modules/stripe/esm/resources/Radar/ValueLists.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod73 = StripeResource.method; -var ValueLists = StripeResource.extend({ - create: stripeMethod73({ method: "POST", fullPath: "/v1/radar/value_lists" }), - retrieve: stripeMethod73({ - method: "GET", - fullPath: "/v1/radar/value_lists/{value_list}" - }), - update: stripeMethod73({ - method: "POST", - fullPath: "/v1/radar/value_lists/{value_list}" - }), - list: stripeMethod73({ - method: "GET", - fullPath: "/v1/radar/value_lists", - methodType: "list" - }), - del: stripeMethod73({ - method: "DELETE", - fullPath: "/v1/radar/value_lists/{value_list}" - }) -}); - -// node_modules/stripe/esm/resources/Identity/VerificationReports.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod74 = StripeResource.method; -var VerificationReports = StripeResource.extend({ - retrieve: stripeMethod74({ - method: "GET", - fullPath: "/v1/identity/verification_reports/{report}" - }), - list: stripeMethod74({ - method: "GET", - fullPath: "/v1/identity/verification_reports", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Identity/VerificationSessions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod75 = StripeResource.method; -var VerificationSessions = StripeResource.extend({ - create: stripeMethod75({ - method: "POST", - fullPath: "/v1/identity/verification_sessions" - }), - retrieve: stripeMethod75({ - method: "GET", - fullPath: "/v1/identity/verification_sessions/{session}" - }), - update: stripeMethod75({ - method: "POST", - fullPath: "/v1/identity/verification_sessions/{session}" - }), - list: stripeMethod75({ - method: "GET", - fullPath: "/v1/identity/verification_sessions", - methodType: "list" - }), - cancel: stripeMethod75({ - method: "POST", - fullPath: "/v1/identity/verification_sessions/{session}/cancel" - }), - redact: stripeMethod75({ - method: "POST", - fullPath: "/v1/identity/verification_sessions/{session}/redact" - }) -}); - -// node_modules/stripe/esm/resources/Accounts.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod76 = StripeResource.method; -var Accounts2 = StripeResource.extend({ - create: stripeMethod76({ method: "POST", fullPath: "/v1/accounts" }), - retrieve(id, ...args) { - if (typeof id === "string") { - return stripeMethod76({ - method: "GET", - fullPath: "/v1/accounts/{id}" - }).apply(this, [id, ...args]); - } else { - if (id === null || id === void 0) { - [].shift.apply([id, ...args]); - } - return stripeMethod76({ - method: "GET", - fullPath: "/v1/account" - }).apply(this, [id, ...args]); - } - }, - update: stripeMethod76({ method: "POST", fullPath: "/v1/accounts/{account}" }), - list: stripeMethod76({ - method: "GET", - fullPath: "/v1/accounts", - methodType: "list" - }), - del: stripeMethod76({ method: "DELETE", fullPath: "/v1/accounts/{account}" }), - createExternalAccount: stripeMethod76({ - method: "POST", - fullPath: "/v1/accounts/{account}/external_accounts" - }), - createLoginLink: stripeMethod76({ - method: "POST", - fullPath: "/v1/accounts/{account}/login_links" - }), - createPerson: stripeMethod76({ - method: "POST", - fullPath: "/v1/accounts/{account}/persons" - }), - deleteExternalAccount: stripeMethod76({ - method: "DELETE", - fullPath: "/v1/accounts/{account}/external_accounts/{id}" - }), - deletePerson: stripeMethod76({ - method: "DELETE", - fullPath: "/v1/accounts/{account}/persons/{person}" - }), - listCapabilities: stripeMethod76({ - method: "GET", - fullPath: "/v1/accounts/{account}/capabilities", - methodType: "list" - }), - listExternalAccounts: stripeMethod76({ - method: "GET", - fullPath: "/v1/accounts/{account}/external_accounts", - methodType: "list" - }), - listPersons: stripeMethod76({ - method: "GET", - fullPath: "/v1/accounts/{account}/persons", - methodType: "list" - }), - reject: stripeMethod76({ - method: "POST", - fullPath: "/v1/accounts/{account}/reject" - }), - retrieveCurrent: stripeMethod76({ method: "GET", fullPath: "/v1/account" }), - retrieveCapability: stripeMethod76({ - method: "GET", - fullPath: "/v1/accounts/{account}/capabilities/{capability}" - }), - retrieveExternalAccount: stripeMethod76({ - method: "GET", - fullPath: "/v1/accounts/{account}/external_accounts/{id}" - }), - retrievePerson: stripeMethod76({ - method: "GET", - fullPath: "/v1/accounts/{account}/persons/{person}" - }), - updateCapability: stripeMethod76({ - method: "POST", - fullPath: "/v1/accounts/{account}/capabilities/{capability}" - }), - updateExternalAccount: stripeMethod76({ - method: "POST", - fullPath: "/v1/accounts/{account}/external_accounts/{id}" - }), - updatePerson: stripeMethod76({ - method: "POST", - fullPath: "/v1/accounts/{account}/persons/{person}" - }) -}); - -// node_modules/stripe/esm/resources/AccountLinks.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod77 = StripeResource.method; -var AccountLinks = StripeResource.extend({ - create: stripeMethod77({ method: "POST", fullPath: "/v1/account_links" }) -}); - -// node_modules/stripe/esm/resources/AccountSessions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod78 = StripeResource.method; -var AccountSessions = StripeResource.extend({ - create: stripeMethod78({ method: "POST", fullPath: "/v1/account_sessions" }) -}); - -// node_modules/stripe/esm/resources/ApplePayDomains.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod79 = StripeResource.method; -var ApplePayDomains = StripeResource.extend({ - create: stripeMethod79({ method: "POST", fullPath: "/v1/apple_pay/domains" }), - retrieve: stripeMethod79({ - method: "GET", - fullPath: "/v1/apple_pay/domains/{domain}" - }), - list: stripeMethod79({ - method: "GET", - fullPath: "/v1/apple_pay/domains", - methodType: "list" - }), - del: stripeMethod79({ - method: "DELETE", - fullPath: "/v1/apple_pay/domains/{domain}" - }) -}); - -// node_modules/stripe/esm/resources/ApplicationFees.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod80 = StripeResource.method; -var ApplicationFees = StripeResource.extend({ - retrieve: stripeMethod80({ - method: "GET", - fullPath: "/v1/application_fees/{id}" - }), - list: stripeMethod80({ - method: "GET", - fullPath: "/v1/application_fees", - methodType: "list" - }), - createRefund: stripeMethod80({ - method: "POST", - fullPath: "/v1/application_fees/{id}/refunds" - }), - listRefunds: stripeMethod80({ - method: "GET", - fullPath: "/v1/application_fees/{id}/refunds", - methodType: "list" - }), - retrieveRefund: stripeMethod80({ - method: "GET", - fullPath: "/v1/application_fees/{fee}/refunds/{id}" - }), - updateRefund: stripeMethod80({ - method: "POST", - fullPath: "/v1/application_fees/{fee}/refunds/{id}" - }) -}); - -// node_modules/stripe/esm/resources/Balance.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod81 = StripeResource.method; -var Balance = StripeResource.extend({ - retrieve: stripeMethod81({ method: "GET", fullPath: "/v1/balance" }) -}); - -// node_modules/stripe/esm/resources/BalanceTransactions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod82 = StripeResource.method; -var BalanceTransactions = StripeResource.extend({ - retrieve: stripeMethod82({ - method: "GET", - fullPath: "/v1/balance_transactions/{id}" - }), - list: stripeMethod82({ - method: "GET", - fullPath: "/v1/balance_transactions", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Charges.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod83 = StripeResource.method; -var Charges = StripeResource.extend({ - create: stripeMethod83({ method: "POST", fullPath: "/v1/charges" }), - retrieve: stripeMethod83({ method: "GET", fullPath: "/v1/charges/{charge}" }), - update: stripeMethod83({ method: "POST", fullPath: "/v1/charges/{charge}" }), - list: stripeMethod83({ - method: "GET", - fullPath: "/v1/charges", - methodType: "list" - }), - capture: stripeMethod83({ - method: "POST", - fullPath: "/v1/charges/{charge}/capture" - }), - search: stripeMethod83({ - method: "GET", - fullPath: "/v1/charges/search", - methodType: "search" - }) -}); - -// node_modules/stripe/esm/resources/ConfirmationTokens.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod84 = StripeResource.method; -var ConfirmationTokens2 = StripeResource.extend({ - retrieve: stripeMethod84({ - method: "GET", - fullPath: "/v1/confirmation_tokens/{confirmation_token}" - }) -}); - -// node_modules/stripe/esm/resources/CountrySpecs.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod85 = StripeResource.method; -var CountrySpecs = StripeResource.extend({ - retrieve: stripeMethod85({ - method: "GET", - fullPath: "/v1/country_specs/{country}" - }), - list: stripeMethod85({ - method: "GET", - fullPath: "/v1/country_specs", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Coupons.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod86 = StripeResource.method; -var Coupons = StripeResource.extend({ - create: stripeMethod86({ method: "POST", fullPath: "/v1/coupons" }), - retrieve: stripeMethod86({ method: "GET", fullPath: "/v1/coupons/{coupon}" }), - update: stripeMethod86({ method: "POST", fullPath: "/v1/coupons/{coupon}" }), - list: stripeMethod86({ - method: "GET", - fullPath: "/v1/coupons", - methodType: "list" - }), - del: stripeMethod86({ method: "DELETE", fullPath: "/v1/coupons/{coupon}" }) -}); - -// node_modules/stripe/esm/resources/CreditNotes.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod87 = StripeResource.method; -var CreditNotes = StripeResource.extend({ - create: stripeMethod87({ method: "POST", fullPath: "/v1/credit_notes" }), - retrieve: stripeMethod87({ method: "GET", fullPath: "/v1/credit_notes/{id}" }), - update: stripeMethod87({ method: "POST", fullPath: "/v1/credit_notes/{id}" }), - list: stripeMethod87({ - method: "GET", - fullPath: "/v1/credit_notes", - methodType: "list" - }), - listLineItems: stripeMethod87({ - method: "GET", - fullPath: "/v1/credit_notes/{credit_note}/lines", - methodType: "list" - }), - listPreviewLineItems: stripeMethod87({ - method: "GET", - fullPath: "/v1/credit_notes/preview/lines", - methodType: "list" - }), - preview: stripeMethod87({ method: "GET", fullPath: "/v1/credit_notes/preview" }), - voidCreditNote: stripeMethod87({ - method: "POST", - fullPath: "/v1/credit_notes/{id}/void" - }) -}); - -// node_modules/stripe/esm/resources/CustomerSessions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod88 = StripeResource.method; -var CustomerSessions = StripeResource.extend({ - create: stripeMethod88({ method: "POST", fullPath: "/v1/customer_sessions" }) -}); - -// node_modules/stripe/esm/resources/Customers.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod89 = StripeResource.method; -var Customers2 = StripeResource.extend({ - create: stripeMethod89({ method: "POST", fullPath: "/v1/customers" }), - retrieve: stripeMethod89({ method: "GET", fullPath: "/v1/customers/{customer}" }), - update: stripeMethod89({ method: "POST", fullPath: "/v1/customers/{customer}" }), - list: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers", - methodType: "list" - }), - del: stripeMethod89({ method: "DELETE", fullPath: "/v1/customers/{customer}" }), - createBalanceTransaction: stripeMethod89({ - method: "POST", - fullPath: "/v1/customers/{customer}/balance_transactions" - }), - createFundingInstructions: stripeMethod89({ - method: "POST", - fullPath: "/v1/customers/{customer}/funding_instructions" - }), - createSource: stripeMethod89({ - method: "POST", - fullPath: "/v1/customers/{customer}/sources" - }), - createTaxId: stripeMethod89({ - method: "POST", - fullPath: "/v1/customers/{customer}/tax_ids" - }), - deleteDiscount: stripeMethod89({ - method: "DELETE", - fullPath: "/v1/customers/{customer}/discount" - }), - deleteSource: stripeMethod89({ - method: "DELETE", - fullPath: "/v1/customers/{customer}/sources/{id}" - }), - deleteTaxId: stripeMethod89({ - method: "DELETE", - fullPath: "/v1/customers/{customer}/tax_ids/{id}" - }), - listBalanceTransactions: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/balance_transactions", - methodType: "list" - }), - listCashBalanceTransactions: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/cash_balance_transactions", - methodType: "list" - }), - listPaymentMethods: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/payment_methods", - methodType: "list" - }), - listSources: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/sources", - methodType: "list" - }), - listTaxIds: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/tax_ids", - methodType: "list" - }), - retrieveBalanceTransaction: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/balance_transactions/{transaction}" - }), - retrieveCashBalance: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/cash_balance" - }), - retrieveCashBalanceTransaction: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/cash_balance_transactions/{transaction}" - }), - retrievePaymentMethod: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/payment_methods/{payment_method}" - }), - retrieveSource: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/sources/{id}" - }), - retrieveTaxId: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/{customer}/tax_ids/{id}" - }), - search: stripeMethod89({ - method: "GET", - fullPath: "/v1/customers/search", - methodType: "search" - }), - updateBalanceTransaction: stripeMethod89({ - method: "POST", - fullPath: "/v1/customers/{customer}/balance_transactions/{transaction}" - }), - updateCashBalance: stripeMethod89({ - method: "POST", - fullPath: "/v1/customers/{customer}/cash_balance" - }), - updateSource: stripeMethod89({ - method: "POST", - fullPath: "/v1/customers/{customer}/sources/{id}" - }), - verifySource: stripeMethod89({ - method: "POST", - fullPath: "/v1/customers/{customer}/sources/{id}/verify" - }) -}); - -// node_modules/stripe/esm/resources/Disputes.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod90 = StripeResource.method; -var Disputes2 = StripeResource.extend({ - retrieve: stripeMethod90({ method: "GET", fullPath: "/v1/disputes/{dispute}" }), - update: stripeMethod90({ method: "POST", fullPath: "/v1/disputes/{dispute}" }), - list: stripeMethod90({ - method: "GET", - fullPath: "/v1/disputes", - methodType: "list" - }), - close: stripeMethod90({ - method: "POST", - fullPath: "/v1/disputes/{dispute}/close" - }) -}); - -// node_modules/stripe/esm/resources/EphemeralKeys.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod91 = StripeResource.method; -var EphemeralKeys = StripeResource.extend({ - create: stripeMethod91({ - method: "POST", - fullPath: "/v1/ephemeral_keys", - validator: /* @__PURE__ */ __name((data, options) => { - if (!options.headers || !options.headers["Stripe-Version"]) { - throw new Error("Passing apiVersion in a separate options hash is required to create an ephemeral key. See https://stripe.com/docs/api/versioning?lang=node"); - } - }, "validator") - }), - del: stripeMethod91({ method: "DELETE", fullPath: "/v1/ephemeral_keys/{key}" }) -}); - -// node_modules/stripe/esm/resources/Events.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod92 = StripeResource.method; -var Events2 = StripeResource.extend({ - retrieve: stripeMethod92({ method: "GET", fullPath: "/v1/events/{id}" }), - list: stripeMethod92({ - method: "GET", - fullPath: "/v1/events", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/ExchangeRates.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod93 = StripeResource.method; -var ExchangeRates = StripeResource.extend({ - retrieve: stripeMethod93({ - method: "GET", - fullPath: "/v1/exchange_rates/{rate_id}" - }), - list: stripeMethod93({ - method: "GET", - fullPath: "/v1/exchange_rates", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/FileLinks.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod94 = StripeResource.method; -var FileLinks = StripeResource.extend({ - create: stripeMethod94({ method: "POST", fullPath: "/v1/file_links" }), - retrieve: stripeMethod94({ method: "GET", fullPath: "/v1/file_links/{link}" }), - update: stripeMethod94({ method: "POST", fullPath: "/v1/file_links/{link}" }), - list: stripeMethod94({ - method: "GET", - fullPath: "/v1/file_links", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Files.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// node_modules/stripe/esm/multipart.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var multipartDataGenerator = /* @__PURE__ */ __name((method, data, headers) => { - const segno = (Math.round(Math.random() * 1e16) + Math.round(Math.random() * 1e16)).toString(); - headers["Content-Type"] = `multipart/form-data; boundary=${segno}`; - const textEncoder = new TextEncoder(); - let buffer = new Uint8Array(0); - const endBuffer = textEncoder.encode("\r\n"); - function push(l) { - const prevBuffer = buffer; - const newBuffer = l instanceof Uint8Array ? l : new Uint8Array(textEncoder.encode(l)); - buffer = new Uint8Array(prevBuffer.length + newBuffer.length + 2); - buffer.set(prevBuffer); - buffer.set(newBuffer, prevBuffer.length); - buffer.set(endBuffer, buffer.length - 2); - } - __name(push, "push"); - function q(s) { - return `"${s.replace(/"|"/g, "%22").replace(/\r\n|\r|\n/g, " ")}"`; - } - __name(q, "q"); - const flattenedData = flattenAndStringify(data); - for (const k in flattenedData) { - if (!Object.prototype.hasOwnProperty.call(flattenedData, k)) { - continue; - } - const v = flattenedData[k]; - push(`--${segno}`); - if (Object.prototype.hasOwnProperty.call(v, "data")) { - const typedEntry = v; - push(`Content-Disposition: form-data; name=${q(k)}; filename=${q(typedEntry.name || "blob")}`); - push(`Content-Type: ${typedEntry.type || "application/octet-stream"}`); - push(""); - push(typedEntry.data); - } else { - push(`Content-Disposition: form-data; name=${q(k)}`); - push(""); - push(v); - } - } - push(`--${segno}--`); - return buffer; -}, "multipartDataGenerator"); -function multipartRequestDataProcessor(method, data, headers, callback) { - data = data || {}; - if (method !== "POST") { - return callback(null, queryStringifyRequestData(data)); - } - this._stripe._platformFunctions.tryBufferData(data).then((bufferedData) => { - const buffer = multipartDataGenerator(method, bufferedData, headers); - return callback(null, buffer); - }).catch((err) => callback(err, null)); -} -__name(multipartRequestDataProcessor, "multipartRequestDataProcessor"); - -// node_modules/stripe/esm/resources/Files.js -var stripeMethod95 = StripeResource.method; -var Files = StripeResource.extend({ - create: stripeMethod95({ - method: "POST", - fullPath: "/v1/files", - headers: { - "Content-Type": "multipart/form-data" - }, - host: "files.stripe.com" - }), - retrieve: stripeMethod95({ method: "GET", fullPath: "/v1/files/{file}" }), - list: stripeMethod95({ - method: "GET", - fullPath: "/v1/files", - methodType: "list" - }), - requestDataProcessor: multipartRequestDataProcessor -}); - -// node_modules/stripe/esm/resources/InvoiceItems.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod96 = StripeResource.method; -var InvoiceItems = StripeResource.extend({ - create: stripeMethod96({ method: "POST", fullPath: "/v1/invoiceitems" }), - retrieve: stripeMethod96({ - method: "GET", - fullPath: "/v1/invoiceitems/{invoiceitem}" - }), - update: stripeMethod96({ - method: "POST", - fullPath: "/v1/invoiceitems/{invoiceitem}" - }), - list: stripeMethod96({ - method: "GET", - fullPath: "/v1/invoiceitems", - methodType: "list" - }), - del: stripeMethod96({ - method: "DELETE", - fullPath: "/v1/invoiceitems/{invoiceitem}" - }) -}); - -// node_modules/stripe/esm/resources/InvoicePayments.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod97 = StripeResource.method; -var InvoicePayments = StripeResource.extend({ - retrieve: stripeMethod97({ - method: "GET", - fullPath: "/v1/invoice_payments/{invoice_payment}" - }), - list: stripeMethod97({ - method: "GET", - fullPath: "/v1/invoice_payments", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/InvoiceRenderingTemplates.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod98 = StripeResource.method; -var InvoiceRenderingTemplates = StripeResource.extend({ - retrieve: stripeMethod98({ - method: "GET", - fullPath: "/v1/invoice_rendering_templates/{template}" - }), - list: stripeMethod98({ - method: "GET", - fullPath: "/v1/invoice_rendering_templates", - methodType: "list" - }), - archive: stripeMethod98({ - method: "POST", - fullPath: "/v1/invoice_rendering_templates/{template}/archive" - }), - unarchive: stripeMethod98({ - method: "POST", - fullPath: "/v1/invoice_rendering_templates/{template}/unarchive" - }) -}); - -// node_modules/stripe/esm/resources/Invoices.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod99 = StripeResource.method; -var Invoices = StripeResource.extend({ - create: stripeMethod99({ method: "POST", fullPath: "/v1/invoices" }), - retrieve: stripeMethod99({ method: "GET", fullPath: "/v1/invoices/{invoice}" }), - update: stripeMethod99({ method: "POST", fullPath: "/v1/invoices/{invoice}" }), - list: stripeMethod99({ - method: "GET", - fullPath: "/v1/invoices", - methodType: "list" - }), - del: stripeMethod99({ method: "DELETE", fullPath: "/v1/invoices/{invoice}" }), - addLines: stripeMethod99({ - method: "POST", - fullPath: "/v1/invoices/{invoice}/add_lines" - }), - attachPayment: stripeMethod99({ - method: "POST", - fullPath: "/v1/invoices/{invoice}/attach_payment" - }), - createPreview: stripeMethod99({ - method: "POST", - fullPath: "/v1/invoices/create_preview" - }), - finalizeInvoice: stripeMethod99({ - method: "POST", - fullPath: "/v1/invoices/{invoice}/finalize" - }), - listLineItems: stripeMethod99({ - method: "GET", - fullPath: "/v1/invoices/{invoice}/lines", - methodType: "list" - }), - markUncollectible: stripeMethod99({ - method: "POST", - fullPath: "/v1/invoices/{invoice}/mark_uncollectible" - }), - pay: stripeMethod99({ method: "POST", fullPath: "/v1/invoices/{invoice}/pay" }), - removeLines: stripeMethod99({ - method: "POST", - fullPath: "/v1/invoices/{invoice}/remove_lines" - }), - search: stripeMethod99({ - method: "GET", - fullPath: "/v1/invoices/search", - methodType: "search" - }), - sendInvoice: stripeMethod99({ - method: "POST", - fullPath: "/v1/invoices/{invoice}/send" - }), - updateLines: stripeMethod99({ - method: "POST", - fullPath: "/v1/invoices/{invoice}/update_lines" - }), - updateLineItem: stripeMethod99({ - method: "POST", - fullPath: "/v1/invoices/{invoice}/lines/{line_item_id}" - }), - voidInvoice: stripeMethod99({ - method: "POST", - fullPath: "/v1/invoices/{invoice}/void" - }) -}); - -// node_modules/stripe/esm/resources/Mandates.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod100 = StripeResource.method; -var Mandates = StripeResource.extend({ - retrieve: stripeMethod100({ method: "GET", fullPath: "/v1/mandates/{mandate}" }) -}); - -// node_modules/stripe/esm/resources/OAuth.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod101 = StripeResource.method; -var oAuthHost = "connect.stripe.com"; -var OAuth = StripeResource.extend({ - basePath: "/", - authorizeUrl(params, options) { - params = params || {}; - options = options || {}; - let path = "oauth/authorize"; - if (options.express) { - path = `express/${path}`; - } - if (!params.response_type) { - params.response_type = "code"; - } - if (!params.client_id) { - params.client_id = this._stripe.getClientId(); - } - if (!params.scope) { - params.scope = "read_write"; - } - return `https://${oAuthHost}/${path}?${queryStringifyRequestData(params)}`; - }, - token: stripeMethod101({ - method: "POST", - path: "oauth/token", - host: oAuthHost - }), - deauthorize(spec, ...args) { - if (!spec.client_id) { - spec.client_id = this._stripe.getClientId(); - } - return stripeMethod101({ - method: "POST", - path: "oauth/deauthorize", - host: oAuthHost - }).apply(this, [spec, ...args]); - } -}); - -// node_modules/stripe/esm/resources/PaymentIntents.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod102 = StripeResource.method; -var PaymentIntents = StripeResource.extend({ - create: stripeMethod102({ method: "POST", fullPath: "/v1/payment_intents" }), - retrieve: stripeMethod102({ - method: "GET", - fullPath: "/v1/payment_intents/{intent}" - }), - update: stripeMethod102({ - method: "POST", - fullPath: "/v1/payment_intents/{intent}" - }), - list: stripeMethod102({ - method: "GET", - fullPath: "/v1/payment_intents", - methodType: "list" - }), - applyCustomerBalance: stripeMethod102({ - method: "POST", - fullPath: "/v1/payment_intents/{intent}/apply_customer_balance" - }), - cancel: stripeMethod102({ - method: "POST", - fullPath: "/v1/payment_intents/{intent}/cancel" - }), - capture: stripeMethod102({ - method: "POST", - fullPath: "/v1/payment_intents/{intent}/capture" - }), - confirm: stripeMethod102({ - method: "POST", - fullPath: "/v1/payment_intents/{intent}/confirm" - }), - incrementAuthorization: stripeMethod102({ - method: "POST", - fullPath: "/v1/payment_intents/{intent}/increment_authorization" - }), - search: stripeMethod102({ - method: "GET", - fullPath: "/v1/payment_intents/search", - methodType: "search" - }), - verifyMicrodeposits: stripeMethod102({ - method: "POST", - fullPath: "/v1/payment_intents/{intent}/verify_microdeposits" - }) -}); - -// node_modules/stripe/esm/resources/PaymentLinks.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod103 = StripeResource.method; -var PaymentLinks = StripeResource.extend({ - create: stripeMethod103({ method: "POST", fullPath: "/v1/payment_links" }), - retrieve: stripeMethod103({ - method: "GET", - fullPath: "/v1/payment_links/{payment_link}" - }), - update: stripeMethod103({ - method: "POST", - fullPath: "/v1/payment_links/{payment_link}" - }), - list: stripeMethod103({ - method: "GET", - fullPath: "/v1/payment_links", - methodType: "list" - }), - listLineItems: stripeMethod103({ - method: "GET", - fullPath: "/v1/payment_links/{payment_link}/line_items", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/PaymentMethodConfigurations.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod104 = StripeResource.method; -var PaymentMethodConfigurations = StripeResource.extend({ - create: stripeMethod104({ - method: "POST", - fullPath: "/v1/payment_method_configurations" - }), - retrieve: stripeMethod104({ - method: "GET", - fullPath: "/v1/payment_method_configurations/{configuration}" - }), - update: stripeMethod104({ - method: "POST", - fullPath: "/v1/payment_method_configurations/{configuration}" - }), - list: stripeMethod104({ - method: "GET", - fullPath: "/v1/payment_method_configurations", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/PaymentMethodDomains.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod105 = StripeResource.method; -var PaymentMethodDomains = StripeResource.extend({ - create: stripeMethod105({ - method: "POST", - fullPath: "/v1/payment_method_domains" - }), - retrieve: stripeMethod105({ - method: "GET", - fullPath: "/v1/payment_method_domains/{payment_method_domain}" - }), - update: stripeMethod105({ - method: "POST", - fullPath: "/v1/payment_method_domains/{payment_method_domain}" - }), - list: stripeMethod105({ - method: "GET", - fullPath: "/v1/payment_method_domains", - methodType: "list" - }), - validate: stripeMethod105({ - method: "POST", - fullPath: "/v1/payment_method_domains/{payment_method_domain}/validate" - }) -}); - -// node_modules/stripe/esm/resources/PaymentMethods.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod106 = StripeResource.method; -var PaymentMethods = StripeResource.extend({ - create: stripeMethod106({ method: "POST", fullPath: "/v1/payment_methods" }), - retrieve: stripeMethod106({ - method: "GET", - fullPath: "/v1/payment_methods/{payment_method}" - }), - update: stripeMethod106({ - method: "POST", - fullPath: "/v1/payment_methods/{payment_method}" - }), - list: stripeMethod106({ - method: "GET", - fullPath: "/v1/payment_methods", - methodType: "list" - }), - attach: stripeMethod106({ - method: "POST", - fullPath: "/v1/payment_methods/{payment_method}/attach" - }), - detach: stripeMethod106({ - method: "POST", - fullPath: "/v1/payment_methods/{payment_method}/detach" - }) -}); - -// node_modules/stripe/esm/resources/Payouts.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod107 = StripeResource.method; -var Payouts = StripeResource.extend({ - create: stripeMethod107({ method: "POST", fullPath: "/v1/payouts" }), - retrieve: stripeMethod107({ method: "GET", fullPath: "/v1/payouts/{payout}" }), - update: stripeMethod107({ method: "POST", fullPath: "/v1/payouts/{payout}" }), - list: stripeMethod107({ - method: "GET", - fullPath: "/v1/payouts", - methodType: "list" - }), - cancel: stripeMethod107({ - method: "POST", - fullPath: "/v1/payouts/{payout}/cancel" - }), - reverse: stripeMethod107({ - method: "POST", - fullPath: "/v1/payouts/{payout}/reverse" - }) -}); - -// node_modules/stripe/esm/resources/Plans.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod108 = StripeResource.method; -var Plans = StripeResource.extend({ - create: stripeMethod108({ method: "POST", fullPath: "/v1/plans" }), - retrieve: stripeMethod108({ method: "GET", fullPath: "/v1/plans/{plan}" }), - update: stripeMethod108({ method: "POST", fullPath: "/v1/plans/{plan}" }), - list: stripeMethod108({ - method: "GET", - fullPath: "/v1/plans", - methodType: "list" - }), - del: stripeMethod108({ method: "DELETE", fullPath: "/v1/plans/{plan}" }) -}); - -// node_modules/stripe/esm/resources/Prices.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod109 = StripeResource.method; -var Prices = StripeResource.extend({ - create: stripeMethod109({ method: "POST", fullPath: "/v1/prices" }), - retrieve: stripeMethod109({ method: "GET", fullPath: "/v1/prices/{price}" }), - update: stripeMethod109({ method: "POST", fullPath: "/v1/prices/{price}" }), - list: stripeMethod109({ - method: "GET", - fullPath: "/v1/prices", - methodType: "list" - }), - search: stripeMethod109({ - method: "GET", - fullPath: "/v1/prices/search", - methodType: "search" - }) -}); - -// node_modules/stripe/esm/resources/Products.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod110 = StripeResource.method; -var Products2 = StripeResource.extend({ - create: stripeMethod110({ method: "POST", fullPath: "/v1/products" }), - retrieve: stripeMethod110({ method: "GET", fullPath: "/v1/products/{id}" }), - update: stripeMethod110({ method: "POST", fullPath: "/v1/products/{id}" }), - list: stripeMethod110({ - method: "GET", - fullPath: "/v1/products", - methodType: "list" - }), - del: stripeMethod110({ method: "DELETE", fullPath: "/v1/products/{id}" }), - createFeature: stripeMethod110({ - method: "POST", - fullPath: "/v1/products/{product}/features" - }), - deleteFeature: stripeMethod110({ - method: "DELETE", - fullPath: "/v1/products/{product}/features/{id}" - }), - listFeatures: stripeMethod110({ - method: "GET", - fullPath: "/v1/products/{product}/features", - methodType: "list" - }), - retrieveFeature: stripeMethod110({ - method: "GET", - fullPath: "/v1/products/{product}/features/{id}" - }), - search: stripeMethod110({ - method: "GET", - fullPath: "/v1/products/search", - methodType: "search" - }) -}); - -// node_modules/stripe/esm/resources/PromotionCodes.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod111 = StripeResource.method; -var PromotionCodes = StripeResource.extend({ - create: stripeMethod111({ method: "POST", fullPath: "/v1/promotion_codes" }), - retrieve: stripeMethod111({ - method: "GET", - fullPath: "/v1/promotion_codes/{promotion_code}" - }), - update: stripeMethod111({ - method: "POST", - fullPath: "/v1/promotion_codes/{promotion_code}" - }), - list: stripeMethod111({ - method: "GET", - fullPath: "/v1/promotion_codes", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Quotes.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod112 = StripeResource.method; -var Quotes = StripeResource.extend({ - create: stripeMethod112({ method: "POST", fullPath: "/v1/quotes" }), - retrieve: stripeMethod112({ method: "GET", fullPath: "/v1/quotes/{quote}" }), - update: stripeMethod112({ method: "POST", fullPath: "/v1/quotes/{quote}" }), - list: stripeMethod112({ - method: "GET", - fullPath: "/v1/quotes", - methodType: "list" - }), - accept: stripeMethod112({ method: "POST", fullPath: "/v1/quotes/{quote}/accept" }), - cancel: stripeMethod112({ method: "POST", fullPath: "/v1/quotes/{quote}/cancel" }), - finalizeQuote: stripeMethod112({ - method: "POST", - fullPath: "/v1/quotes/{quote}/finalize" - }), - listComputedUpfrontLineItems: stripeMethod112({ - method: "GET", - fullPath: "/v1/quotes/{quote}/computed_upfront_line_items", - methodType: "list" - }), - listLineItems: stripeMethod112({ - method: "GET", - fullPath: "/v1/quotes/{quote}/line_items", - methodType: "list" - }), - pdf: stripeMethod112({ - method: "GET", - fullPath: "/v1/quotes/{quote}/pdf", - host: "files.stripe.com", - streaming: true - }) -}); - -// node_modules/stripe/esm/resources/Refunds.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod113 = StripeResource.method; -var Refunds2 = StripeResource.extend({ - create: stripeMethod113({ method: "POST", fullPath: "/v1/refunds" }), - retrieve: stripeMethod113({ method: "GET", fullPath: "/v1/refunds/{refund}" }), - update: stripeMethod113({ method: "POST", fullPath: "/v1/refunds/{refund}" }), - list: stripeMethod113({ - method: "GET", - fullPath: "/v1/refunds", - methodType: "list" - }), - cancel: stripeMethod113({ - method: "POST", - fullPath: "/v1/refunds/{refund}/cancel" - }) -}); - -// node_modules/stripe/esm/resources/Reviews.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod114 = StripeResource.method; -var Reviews = StripeResource.extend({ - retrieve: stripeMethod114({ method: "GET", fullPath: "/v1/reviews/{review}" }), - list: stripeMethod114({ - method: "GET", - fullPath: "/v1/reviews", - methodType: "list" - }), - approve: stripeMethod114({ - method: "POST", - fullPath: "/v1/reviews/{review}/approve" - }) -}); - -// node_modules/stripe/esm/resources/SetupAttempts.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod115 = StripeResource.method; -var SetupAttempts = StripeResource.extend({ - list: stripeMethod115({ - method: "GET", - fullPath: "/v1/setup_attempts", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/SetupIntents.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod116 = StripeResource.method; -var SetupIntents = StripeResource.extend({ - create: stripeMethod116({ method: "POST", fullPath: "/v1/setup_intents" }), - retrieve: stripeMethod116({ - method: "GET", - fullPath: "/v1/setup_intents/{intent}" - }), - update: stripeMethod116({ - method: "POST", - fullPath: "/v1/setup_intents/{intent}" - }), - list: stripeMethod116({ - method: "GET", - fullPath: "/v1/setup_intents", - methodType: "list" - }), - cancel: stripeMethod116({ - method: "POST", - fullPath: "/v1/setup_intents/{intent}/cancel" - }), - confirm: stripeMethod116({ - method: "POST", - fullPath: "/v1/setup_intents/{intent}/confirm" - }), - verifyMicrodeposits: stripeMethod116({ - method: "POST", - fullPath: "/v1/setup_intents/{intent}/verify_microdeposits" - }) -}); - -// node_modules/stripe/esm/resources/ShippingRates.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod117 = StripeResource.method; -var ShippingRates = StripeResource.extend({ - create: stripeMethod117({ method: "POST", fullPath: "/v1/shipping_rates" }), - retrieve: stripeMethod117({ - method: "GET", - fullPath: "/v1/shipping_rates/{shipping_rate_token}" - }), - update: stripeMethod117({ - method: "POST", - fullPath: "/v1/shipping_rates/{shipping_rate_token}" - }), - list: stripeMethod117({ - method: "GET", - fullPath: "/v1/shipping_rates", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Sources.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod118 = StripeResource.method; -var Sources = StripeResource.extend({ - create: stripeMethod118({ method: "POST", fullPath: "/v1/sources" }), - retrieve: stripeMethod118({ method: "GET", fullPath: "/v1/sources/{source}" }), - update: stripeMethod118({ method: "POST", fullPath: "/v1/sources/{source}" }), - listSourceTransactions: stripeMethod118({ - method: "GET", - fullPath: "/v1/sources/{source}/source_transactions", - methodType: "list" - }), - verify: stripeMethod118({ - method: "POST", - fullPath: "/v1/sources/{source}/verify" - }) -}); - -// node_modules/stripe/esm/resources/SubscriptionItems.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod119 = StripeResource.method; -var SubscriptionItems = StripeResource.extend({ - create: stripeMethod119({ method: "POST", fullPath: "/v1/subscription_items" }), - retrieve: stripeMethod119({ - method: "GET", - fullPath: "/v1/subscription_items/{item}" - }), - update: stripeMethod119({ - method: "POST", - fullPath: "/v1/subscription_items/{item}" - }), - list: stripeMethod119({ - method: "GET", - fullPath: "/v1/subscription_items", - methodType: "list" - }), - del: stripeMethod119({ - method: "DELETE", - fullPath: "/v1/subscription_items/{item}" - }) -}); - -// node_modules/stripe/esm/resources/SubscriptionSchedules.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod120 = StripeResource.method; -var SubscriptionSchedules = StripeResource.extend({ - create: stripeMethod120({ - method: "POST", - fullPath: "/v1/subscription_schedules" - }), - retrieve: stripeMethod120({ - method: "GET", - fullPath: "/v1/subscription_schedules/{schedule}" - }), - update: stripeMethod120({ - method: "POST", - fullPath: "/v1/subscription_schedules/{schedule}" - }), - list: stripeMethod120({ - method: "GET", - fullPath: "/v1/subscription_schedules", - methodType: "list" - }), - cancel: stripeMethod120({ - method: "POST", - fullPath: "/v1/subscription_schedules/{schedule}/cancel" - }), - release: stripeMethod120({ - method: "POST", - fullPath: "/v1/subscription_schedules/{schedule}/release" - }) -}); - -// node_modules/stripe/esm/resources/Subscriptions.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod121 = StripeResource.method; -var Subscriptions = StripeResource.extend({ - create: stripeMethod121({ method: "POST", fullPath: "/v1/subscriptions" }), - retrieve: stripeMethod121({ - method: "GET", - fullPath: "/v1/subscriptions/{subscription_exposed_id}" - }), - update: stripeMethod121({ - method: "POST", - fullPath: "/v1/subscriptions/{subscription_exposed_id}" - }), - list: stripeMethod121({ - method: "GET", - fullPath: "/v1/subscriptions", - methodType: "list" - }), - cancel: stripeMethod121({ - method: "DELETE", - fullPath: "/v1/subscriptions/{subscription_exposed_id}" - }), - deleteDiscount: stripeMethod121({ - method: "DELETE", - fullPath: "/v1/subscriptions/{subscription_exposed_id}/discount" - }), - migrate: stripeMethod121({ - method: "POST", - fullPath: "/v1/subscriptions/{subscription}/migrate" - }), - resume: stripeMethod121({ - method: "POST", - fullPath: "/v1/subscriptions/{subscription}/resume" - }), - search: stripeMethod121({ - method: "GET", - fullPath: "/v1/subscriptions/search", - methodType: "search" - }) -}); - -// node_modules/stripe/esm/resources/TaxCodes.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod122 = StripeResource.method; -var TaxCodes = StripeResource.extend({ - retrieve: stripeMethod122({ method: "GET", fullPath: "/v1/tax_codes/{id}" }), - list: stripeMethod122({ - method: "GET", - fullPath: "/v1/tax_codes", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/TaxIds.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod123 = StripeResource.method; -var TaxIds = StripeResource.extend({ - create: stripeMethod123({ method: "POST", fullPath: "/v1/tax_ids" }), - retrieve: stripeMethod123({ method: "GET", fullPath: "/v1/tax_ids/{id}" }), - list: stripeMethod123({ - method: "GET", - fullPath: "/v1/tax_ids", - methodType: "list" - }), - del: stripeMethod123({ method: "DELETE", fullPath: "/v1/tax_ids/{id}" }) -}); - -// node_modules/stripe/esm/resources/TaxRates.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod124 = StripeResource.method; -var TaxRates = StripeResource.extend({ - create: stripeMethod124({ method: "POST", fullPath: "/v1/tax_rates" }), - retrieve: stripeMethod124({ method: "GET", fullPath: "/v1/tax_rates/{tax_rate}" }), - update: stripeMethod124({ method: "POST", fullPath: "/v1/tax_rates/{tax_rate}" }), - list: stripeMethod124({ - method: "GET", - fullPath: "/v1/tax_rates", - methodType: "list" - }) -}); - -// node_modules/stripe/esm/resources/Tokens.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod125 = StripeResource.method; -var Tokens2 = StripeResource.extend({ - create: stripeMethod125({ method: "POST", fullPath: "/v1/tokens" }), - retrieve: stripeMethod125({ method: "GET", fullPath: "/v1/tokens/{token}" }) -}); - -// node_modules/stripe/esm/resources/Topups.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod126 = StripeResource.method; -var Topups = StripeResource.extend({ - create: stripeMethod126({ method: "POST", fullPath: "/v1/topups" }), - retrieve: stripeMethod126({ method: "GET", fullPath: "/v1/topups/{topup}" }), - update: stripeMethod126({ method: "POST", fullPath: "/v1/topups/{topup}" }), - list: stripeMethod126({ - method: "GET", - fullPath: "/v1/topups", - methodType: "list" - }), - cancel: stripeMethod126({ method: "POST", fullPath: "/v1/topups/{topup}/cancel" }) -}); - -// node_modules/stripe/esm/resources/Transfers.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod127 = StripeResource.method; -var Transfers = StripeResource.extend({ - create: stripeMethod127({ method: "POST", fullPath: "/v1/transfers" }), - retrieve: stripeMethod127({ method: "GET", fullPath: "/v1/transfers/{transfer}" }), - update: stripeMethod127({ method: "POST", fullPath: "/v1/transfers/{transfer}" }), - list: stripeMethod127({ - method: "GET", - fullPath: "/v1/transfers", - methodType: "list" - }), - createReversal: stripeMethod127({ - method: "POST", - fullPath: "/v1/transfers/{id}/reversals" - }), - listReversals: stripeMethod127({ - method: "GET", - fullPath: "/v1/transfers/{id}/reversals", - methodType: "list" - }), - retrieveReversal: stripeMethod127({ - method: "GET", - fullPath: "/v1/transfers/{transfer}/reversals/{id}" - }), - updateReversal: stripeMethod127({ - method: "POST", - fullPath: "/v1/transfers/{transfer}/reversals/{id}" - }) -}); - -// node_modules/stripe/esm/resources/WebhookEndpoints.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var stripeMethod128 = StripeResource.method; -var WebhookEndpoints = StripeResource.extend({ - create: stripeMethod128({ method: "POST", fullPath: "/v1/webhook_endpoints" }), - retrieve: stripeMethod128({ - method: "GET", - fullPath: "/v1/webhook_endpoints/{webhook_endpoint}" - }), - update: stripeMethod128({ - method: "POST", - fullPath: "/v1/webhook_endpoints/{webhook_endpoint}" - }), - list: stripeMethod128({ - method: "GET", - fullPath: "/v1/webhook_endpoints", - methodType: "list" - }), - del: stripeMethod128({ - method: "DELETE", - fullPath: "/v1/webhook_endpoints/{webhook_endpoint}" - }) -}); - -// node_modules/stripe/esm/resources.js -var Apps = resourceNamespace("apps", { Secrets }); -var Billing = resourceNamespace("billing", { - Alerts, - CreditBalanceSummary, - CreditBalanceTransactions, - CreditGrants, - MeterEventAdjustments, - MeterEvents, - Meters -}); -var BillingPortal = resourceNamespace("billingPortal", { - Configurations, - Sessions -}); -var Checkout = resourceNamespace("checkout", { - Sessions: Sessions2 -}); -var Climate = resourceNamespace("climate", { - Orders, - Products, - Suppliers -}); -var Entitlements = resourceNamespace("entitlements", { - ActiveEntitlements, - Features -}); -var FinancialConnections = resourceNamespace("financialConnections", { - Accounts, - Sessions: Sessions3, - Transactions -}); -var Forwarding = resourceNamespace("forwarding", { - Requests -}); -var Identity = resourceNamespace("identity", { - VerificationReports, - VerificationSessions -}); -var Issuing = resourceNamespace("issuing", { - Authorizations, - Cardholders, - Cards, - Disputes, - PersonalizationDesigns, - PhysicalBundles, - Tokens, - Transactions: Transactions2 -}); -var Radar = resourceNamespace("radar", { - EarlyFraudWarnings, - ValueListItems, - ValueLists -}); -var Reporting = resourceNamespace("reporting", { - ReportRuns, - ReportTypes -}); -var Sigma = resourceNamespace("sigma", { - ScheduledQueryRuns -}); -var Tax = resourceNamespace("tax", { - Calculations, - Registrations, - Settings, - Transactions: Transactions3 -}); -var Terminal = resourceNamespace("terminal", { - Configurations: Configurations2, - ConnectionTokens, - Locations, - Readers -}); -var TestHelpers = resourceNamespace("testHelpers", { - ConfirmationTokens, - Customers, - Refunds, - TestClocks, - Issuing: resourceNamespace("issuing", { - Authorizations: Authorizations2, - Cards: Cards2, - PersonalizationDesigns: PersonalizationDesigns2, - Transactions: Transactions4 - }), - Terminal: resourceNamespace("terminal", { - Readers: Readers2 - }), - Treasury: resourceNamespace("treasury", { - InboundTransfers, - OutboundPayments, - OutboundTransfers, - ReceivedCredits, - ReceivedDebits - }) -}); -var Treasury = resourceNamespace("treasury", { - CreditReversals, - DebitReversals, - FinancialAccounts, - InboundTransfers: InboundTransfers2, - OutboundPayments: OutboundPayments2, - OutboundTransfers: OutboundTransfers2, - ReceivedCredits: ReceivedCredits2, - ReceivedDebits: ReceivedDebits2, - TransactionEntries, - Transactions: Transactions5 -}); -var V2 = resourceNamespace("v2", { - Billing: resourceNamespace("billing", { - MeterEventAdjustments: MeterEventAdjustments2, - MeterEventSession, - MeterEventStream, - MeterEvents: MeterEvents2 - }), - Core: resourceNamespace("core", { - EventDestinations, - Events - }) -}); - -// node_modules/stripe/esm/stripe.core.js -var DEFAULT_HOST = "api.stripe.com"; -var DEFAULT_PORT = "443"; -var DEFAULT_BASE_PATH = "/v1/"; -var DEFAULT_API_VERSION = ApiVersion; -var DEFAULT_TIMEOUT = 8e4; -var MAX_NETWORK_RETRY_DELAY_SEC = 5; -var INITIAL_NETWORK_RETRY_DELAY_SEC = 0.5; -var APP_INFO_PROPERTIES = ["name", "version", "url", "partner_id"]; -var ALLOWED_CONFIG_PROPERTIES = [ - "authenticator", - "apiVersion", - "typescript", - "maxNetworkRetries", - "httpAgent", - "httpClient", - "timeout", - "host", - "port", - "protocol", - "telemetry", - "appInfo", - "stripeAccount", - "stripeContext" -]; -var defaultRequestSenderFactory = /* @__PURE__ */ __name((stripe) => new RequestSender(stripe, StripeResource.MAX_BUFFERED_REQUEST_METRICS), "defaultRequestSenderFactory"); -function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) { - Stripe2.PACKAGE_VERSION = "18.5.0"; - Stripe2.API_VERSION = ApiVersion; - Stripe2.USER_AGENT = Object.assign({ bindings_version: Stripe2.PACKAGE_VERSION, lang: "node", publisher: "stripe", uname: null, typescript: false }, determineProcessUserAgentProperties()); - Stripe2.StripeResource = StripeResource; - Stripe2.resources = resources_exports; - Stripe2.HttpClient = HttpClient; - Stripe2.HttpClientResponse = HttpClientResponse; - Stripe2.CryptoProvider = CryptoProvider; - Stripe2.webhooks = createWebhooks(platformFunctions); - function Stripe2(key, config2 = {}) { - if (!(this instanceof Stripe2)) { - return new Stripe2(key, config2); - } - const props = this._getPropsFromConfig(config2); - this._platformFunctions = platformFunctions; - Object.defineProperty(this, "_emitter", { - value: this._platformFunctions.createEmitter(), - enumerable: false, - configurable: false, - writable: false - }); - this.VERSION = Stripe2.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); - const agent = props.httpAgent || null; - this._api = { - host: props.host || DEFAULT_HOST, - port: props.port || DEFAULT_PORT, - protocol: props.protocol || "https", - basePath: DEFAULT_BASE_PATH, - version: props.apiVersion || DEFAULT_API_VERSION, - timeout: validateInteger("timeout", props.timeout, DEFAULT_TIMEOUT), - maxNetworkRetries: validateInteger("maxNetworkRetries", props.maxNetworkRetries, 2), - agent, - httpClient: props.httpClient || (agent ? this._platformFunctions.createNodeHttpClient(agent) : this._platformFunctions.createDefaultHttpClient()), - dev: false, - stripeAccount: props.stripeAccount || null, - stripeContext: props.stripeContext || null - }; - const typescript = props.typescript || false; - if (typescript !== Stripe2.USER_AGENT.typescript) { - Stripe2.USER_AGENT.typescript = typescript; - } - if (props.appInfo) { - this._setAppInfo(props.appInfo); - } - this._prepResources(); - this._setAuthenticator(key, props.authenticator); - this.errors = Error_exports; - this.webhooks = Stripe2.webhooks; - this._prevRequestMetrics = []; - this._enableTelemetry = props.telemetry !== false; - this._requestSender = requestSender(this); - this.StripeResource = Stripe2.StripeResource; - } - __name(Stripe2, "Stripe"); - Stripe2.errors = Error_exports; - Stripe2.createNodeHttpClient = platformFunctions.createNodeHttpClient; - Stripe2.createFetchHttpClient = platformFunctions.createFetchHttpClient; - Stripe2.createNodeCryptoProvider = platformFunctions.createNodeCryptoProvider; - Stripe2.createSubtleCryptoProvider = platformFunctions.createSubtleCryptoProvider; - Stripe2.prototype = { - // Properties are set in the constructor above - _appInfo: void 0, - on: null, - off: null, - once: null, - VERSION: null, - StripeResource: null, - webhooks: null, - errors: null, - _api: null, - _prevRequestMetrics: null, - _emitter: null, - _enableTelemetry: null, - _requestSender: null, - _platformFunctions: null, - rawRequest(method, path, params, options) { - return this._requestSender._rawRequest(method, path, params, options); - }, - /** - * @private - */ - _setAuthenticator(key, authenticator) { - if (key && authenticator) { - throw new Error("Can't specify both apiKey and authenticator"); - } - if (!key && !authenticator) { - throw new Error("Neither apiKey nor config.authenticator provided"); - } - this._authenticator = key ? createApiKeyAuthenticator(key) : authenticator; - }, - /** - * @private - * This may be removed in the future. - */ - _setAppInfo(info3) { - if (info3 && typeof info3 !== "object") { - throw new Error("AppInfo must be an object."); - } - if (info3 && !info3.name) { - throw new Error("AppInfo.name is required"); - } - info3 = info3 || {}; - this._appInfo = APP_INFO_PROPERTIES.reduce((accum, prop) => { - if (typeof info3[prop] == "string") { - accum = accum || {}; - accum[prop] = info3[prop]; - } - return accum; - }, {}); - }, - /** - * @private - * This may be removed in the future. - */ - _setApiField(key, value) { - this._api[key] = value; - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - */ - getApiField(key) { - return this._api[key]; - }, - setClientId(clientId) { - this._clientId = clientId; - }, - getClientId() { - return this._clientId; - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - */ - getConstant: /* @__PURE__ */ __name((c) => { - switch (c) { - case "DEFAULT_HOST": - return DEFAULT_HOST; - case "DEFAULT_PORT": - return DEFAULT_PORT; - case "DEFAULT_BASE_PATH": - return DEFAULT_BASE_PATH; - case "DEFAULT_API_VERSION": - return DEFAULT_API_VERSION; - case "DEFAULT_TIMEOUT": - return DEFAULT_TIMEOUT; - case "MAX_NETWORK_RETRY_DELAY_SEC": - return MAX_NETWORK_RETRY_DELAY_SEC; - case "INITIAL_NETWORK_RETRY_DELAY_SEC": - return INITIAL_NETWORK_RETRY_DELAY_SEC; - } - return Stripe2[c]; - }, "getConstant"), - getMaxNetworkRetries() { - return this.getApiField("maxNetworkRetries"); - }, - /** - * @private - * This may be removed in the future. - */ - _setApiNumberField(prop, n, defaultVal) { - const val = validateInteger(prop, n, defaultVal); - this._setApiField(prop, val); - }, - getMaxNetworkRetryDelay() { - return MAX_NETWORK_RETRY_DELAY_SEC; - }, - getInitialNetworkRetryDelay() { - return INITIAL_NETWORK_RETRY_DELAY_SEC; - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - * - * Gets a JSON version of a User-Agent and uses a cached version for a slight - * speed advantage. - */ - getClientUserAgent(cb) { - return this.getClientUserAgentSeeded(Stripe2.USER_AGENT, cb); - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - * - * Gets a JSON version of a User-Agent by encoding a seeded object and - * fetching a uname from the system. - */ - getClientUserAgentSeeded(seed, cb) { - this._platformFunctions.getUname().then((uname) => { - var _a; - const userAgent = {}; - for (const field in seed) { - if (!Object.prototype.hasOwnProperty.call(seed, field)) { - continue; - } - userAgent[field] = encodeURIComponent((_a = seed[field]) !== null && _a !== void 0 ? _a : "null"); - } - userAgent.uname = encodeURIComponent(uname || "UNKNOWN"); - const client = this.getApiField("httpClient"); - if (client) { - userAgent.httplib = encodeURIComponent(client.getClientName()); - } - if (this._appInfo) { - userAgent.application = this._appInfo; - } - cb(JSON.stringify(userAgent)); - }); - }, - /** - * @private - * Please open or upvote an issue at github.com/stripe/stripe-node - * if you use this, detailing your use-case. - * - * It may be deprecated and removed in the future. - */ - getAppInfoAsString() { - if (!this._appInfo) { - return ""; - } - let formatted = this._appInfo.name; - if (this._appInfo.version) { - formatted += `/${this._appInfo.version}`; - } - if (this._appInfo.url) { - formatted += ` (${this._appInfo.url})`; - } - return formatted; - }, - getTelemetryEnabled() { - return this._enableTelemetry; - }, - /** - * @private - * This may be removed in the future. - */ - _prepResources() { - for (const name in resources_exports) { - if (!Object.prototype.hasOwnProperty.call(resources_exports, name)) { - continue; - } - this[pascalToCamelCase(name)] = new resources_exports[name](this); - } - }, - /** - * @private - * This may be removed in the future. - */ - _getPropsFromConfig(config2) { - if (!config2) { - return {}; - } - const isString = typeof config2 === "string"; - const isObject2 = config2 === Object(config2) && !Array.isArray(config2); - if (!isObject2 && !isString) { - throw new Error("Config must either be an object or a string"); - } - if (isString) { - return { - apiVersion: config2 - }; - } - const values = Object.keys(config2).filter((value) => !ALLOWED_CONFIG_PROPERTIES.includes(value)); - if (values.length > 0) { - throw new Error(`Config object may only contain the following: ${ALLOWED_CONFIG_PROPERTIES.join(", ")}`); - } - return config2; - }, - parseThinEvent(payload, header, secret, tolerance, cryptoProvider, receivedAt) { - return this.webhooks.constructEvent(payload, header, secret, tolerance, cryptoProvider, receivedAt); - } - }; - return Stripe2; -} -__name(createStripe, "createStripe"); - -// node_modules/stripe/esm/stripe.esm.worker.js -var Stripe = createStripe(new WebPlatformFunctions()); -var stripe_esm_worker_default = Stripe; - -// src/services/StripeService.js -init_config(); -var StripeService = class { - static { - __name(this, "StripeService"); - } - constructor(secretKey, siteUrl) { - this.stripe = new stripe_esm_worker_default(secretKey); - this.siteUrl = siteUrl; - } - /** - * Create a Stripe product - */ - async createProduct(productData) { - const stripeImages = Array.isArray(productData.images) ? productData.images : productData.imageUrl ? [productData.imageUrl] : []; - const productParams = { - name: productData.name, - images: stripeImages.slice(0, 8), - type: "good", - tax_code: "txcd_99999999" - // Physical goods tax code - }; - if (productData.description && String(productData.description).trim() !== "") { - productParams.description = String(productData.description); - } - return await this.stripe.products.create(productParams); - } - /** - * Update a Stripe product - */ - async updateProduct(productId, updates) { - const updateParams = { - name: updates.name, - images: updates.images?.slice(0, 8) || [] - }; - if (typeof updates.description === "string") { - const trimmed = updates.description.trim(); - if (trimmed) { - updateParams.description = trimmed; - } - } - return await this.stripe.products.update(productId, updateParams); - } - /** - * Archive a Stripe product - */ - async archiveProduct(productId) { - return await this.stripe.products.update(productId, { active: false }); - } - /** - * Create a Stripe price - */ - async createPrice(params) { - return await this.stripe.prices.create({ - unit_amount: Math.round(params.amount * 100), - currency: params.currency, - product: params.productId, - nickname: params.nickname, - metadata: params.metadata || {} - }); - } - /** - * Archive a Stripe price - */ - async archivePrice(priceId) { - return await this.stripe.prices.update(priceId, { active: false }); - } - /** - * Create checkout session for single item - */ - async createCheckoutSession(priceId) { - return await this.stripe.checkout.sessions.create({ - payment_method_types: ["card"], - line_items: [{ price: priceId, quantity: 1 }], - mode: "payment", - shipping_address_collection: { - allowed_countries: SHIPPING_COUNTRIES - }, - billing_address_collection: "required", - success_url: `${this.siteUrl}/success?session_id={CHECKOUT_SESSION_ID}`, - cancel_url: `${this.siteUrl}/` - }); - } - /** - * Create checkout session for cart - */ - async createCartCheckoutSession(items) { - const lineItems = items.map((item) => { - const lineItem = { - price: item.stripePriceId, - quantity: item.quantity || 1 - }; - return lineItem; - }); - const metadata = { - order_type: "cart_checkout", - item_count: items.length.toString(), - total_quantity: items.reduce((sum, item) => sum + item.quantity, 0).toString() - }; - items.forEach((item, index) => { - const itemName = item.name || `Item ${index + 1}`; - metadata[`item_${index}_name`] = itemName; - if (item.selectedVariant?.name) { - metadata[`item_${index}_variant1`] = item.selectedVariant.name; - } - if (item.selectedVariant2?.name) { - metadata[`item_${index}_variant2`] = item.selectedVariant2.name; - } - }); - return await this.stripe.checkout.sessions.create({ - payment_method_types: ["card"], - line_items: lineItems, - mode: "payment", - shipping_address_collection: { - allowed_countries: SHIPPING_COUNTRIES - }, - billing_address_collection: "required", - success_url: `${this.siteUrl}/success?session_id={CHECKOUT_SESSION_ID}`, - cancel_url: `${this.siteUrl}/`, - metadata - }); - } - /** - * Get checkout session details - */ - async getCheckoutSession(sessionId) { - const session = await this.stripe.checkout.sessions.retrieve(sessionId); - return { - id: session.id, - amount_total: session.amount_total, - currency: session.currency, - customer_email: session.customer_details?.email, - payment_status: session.payment_status, - created: session.created - }; - } - /** - * List checkout sessions with pagination - */ - async listCheckoutSessions(options = {}) { - const params = { - limit: Math.min(options.limit || 25, 50) - }; - if (options.cursor) { - if (options.direction === "prev") { - params.ending_before = options.cursor; - } else { - params.starting_after = options.cursor; - } - } - return await this.stripe.checkout.sessions.list(params); - } - /** - * Get line items for a checkout session - */ - async getCheckoutSessionLineItems(sessionId) { - return await this.stripe.checkout.sessions.listLineItems(sessionId, { - limit: 100, - expand: ["data.price"] - }); - } - /** - * Get payment intent with shipping details - */ - async getPaymentIntent(paymentIntentId) { - return await this.stripe.paymentIntents.retrieve(paymentIntentId, { - expand: ["shipping"] - }); - } - /** - * List payment intents for analytics - */ - async listPaymentIntents(startDate) { - return await this.stripe.paymentIntents.list({ - created: { gte: Math.floor(startDate.getTime() / 1e3) }, - limit: 100 - }); - } -}; - -// src/routes/public/checkout.js -var router4 = new Hono2(); -router4.post("/create-checkout-session", asyncHandler(async (c) => { - const { priceId } = await c.req.json(); - if (!priceId || typeof priceId !== "string") { - throw new ValidationError("Valid price ID is required"); - } - const trimmedPriceId = priceId.trim(); - if (trimmedPriceId.length === 0) { - throw new ValidationError("Valid price ID is required"); - } - if (!trimmedPriceId.startsWith("price_")) { - throw new ValidationError("Invalid price ID format"); - } - if (trimmedPriceId.length > 255) { - throw new ValidationError("Price ID is too long"); - } - const stripeService = new StripeService(c.env.STRIPE_SECRET_KEY, c.env.SITE_URL); - const session = await stripeService.createCheckoutSession(trimmedPriceId); - return c.json({ sessionId: session.id }); -})); -router4.post("/create-cart-checkout-session", asyncHandler(async (c) => { - const { items } = await c.req.json(); - if (!items || !Array.isArray(items) || items.length === 0) { - throw new ValidationError("Cart items are required"); - } - if (items.length > 100) { - throw new ValidationError("Cart size exceeds maximum allowed items"); - } - const normalizedItems = items.map((item, index) => { - if (!item || typeof item !== "object") { - throw new ValidationError(`Invalid cart item format at index ${index}`); - } - const priceId = item.stripePriceId || item.priceId; - if (!priceId || typeof priceId !== "string" || !priceId.startsWith("price_")) { - throw new ValidationError(`Invalid price ID in cart item at index ${index}`); - } - let quantity = item.quantity; - if (quantity === void 0 || quantity === null) { - quantity = 1; - } - quantity = Number.parseInt(quantity, 10); - if (!Number.isInteger(quantity) || quantity < 1 || quantity > 100) { - throw new ValidationError(`Invalid quantity in cart item at index ${index} (must be 1-100, got ${quantity})`); - } - return { - ...item, - stripePriceId: priceId.trim(), - quantity - }; - }); - const stripeService = new StripeService(c.env.STRIPE_SECRET_KEY, c.env.SITE_URL); - const session = await stripeService.createCartCheckoutSession(normalizedItems); - return c.json({ sessionId: session.id }); -})); -router4.get("/checkout-session/:sessionId", asyncHandler(async (c) => { - const sessionId = c.req.param("sessionId"); - if (!sessionId || typeof sessionId !== "string") { - throw new ValidationError("Invalid session ID format"); - } - const trimmedSessionId = sessionId.trim(); - if (!trimmedSessionId.startsWith("cs_")) { - throw new ValidationError("Invalid session ID format"); - } - if (trimmedSessionId.length > 255) { - throw new ValidationError("Session ID is too long"); - } - const stripeService = new StripeService(c.env.STRIPE_SECRET_KEY, c.env.SITE_URL); - const session = await stripeService.getCheckoutSession(trimmedSessionId); - return c.json(session); -})); -var checkout_default = router4; - -// src/routes/public/imageProxy.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -init_config(); -var router5 = new Hono2(); -router5.get("/", asyncHandler(async (c) => { - const src = c.req.query("src"); - if (!src) { - throw new ValidationError("Missing src"); - } - let targetUrl; - try { - const u = new URL(src); - const isAllowed = ALLOWED_DRIVE_HOSTS.some((h) => u.hostname === h || u.hostname.endsWith("." + h)); - if (!isAllowed) { - throw new ValidationError("Host not allowed"); - } - if (u.hostname.endsWith("drive.google.com")) { - const pathId = u.pathname.match(/\/file\/d\/([a-zA-Z0-9_-]+)/); - const queryId = u.searchParams.get("id"); - const id = pathId && pathId[1] || queryId; - if (!id) { - throw new ValidationError("Missing Google Drive file id"); - } - targetUrl = `https://drive.usercontent.google.com/download?id=${id}&export=view`; - } else if (u.hostname.endsWith("drive.usercontent.google.com")) { - const id = u.searchParams.get("id"); - if (!id) { - throw new ValidationError("Missing Google Drive file id"); - } - const newUrl = new URL("https://drive.usercontent.google.com/download"); - newUrl.searchParams.set("id", id); - newUrl.searchParams.set("export", "view"); - targetUrl = newUrl.toString(); - } else { - targetUrl = u.toString(); - } - } catch (error3) { - if (error3 instanceof ValidationError) { - throw error3; - } - throw new ValidationError("Invalid src url"); - } - const upstream = await fetch(targetUrl, { - redirect: "follow", - headers: { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123 Safari/537.36", - "Accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8", - "Accept-Language": "en-US,en;q=0.9", - "Referer": "https://drive.google.com/" - }, - cf: { cacheEverything: true } - }); - if (!upstream.ok) { - throw new Error(`Upstream error: ${upstream.status}`); - } - const headers = new Headers(); - const contentType = upstream.headers.get("content-type") || "image/jpeg"; - headers.set("Content-Type", contentType); - headers.set("Cache-Control", "public, max-age=86400"); - headers.set("Access-Control-Allow-Origin", "*"); - headers.set("Cross-Origin-Resource-Policy", "cross-origin"); - return new Response(upstream.body, { headers }); -})); -var imageProxy_default = router5; - -// src/routes/public/storeSettings.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -init_kv(); -var router6 = new Hono2(); -router6.get("/", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const settingsService = new StoreSettingsService(kvNamespace); - const settings = await settingsService.getSettings(); - return c.json(settings); -})); -var storeSettings_default = router6; -var contactEmailRouter = new Hono2(); -contactEmailRouter.get("/", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const settingsService = new StoreSettingsService(kvNamespace); - const email = await settingsService.getContactEmail(); - return c.json(email); -})); - -// src/routes/admin/auth.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -init_kv(); -init_config(); -var router7 = new Hono2(); -router7.post("/login", asyncHandler(async (c) => { - const { password } = await c.req.json(); - if (!password || typeof password !== "string") { - throw new ValidationError("Password is required"); - } - const kvNamespace = getKVNamespace(c.env); - const clientIp = c.req.header("CF-Connecting-IP") || c.req.header("X-Forwarded-For") || "unknown"; - const rateLimitKey = `rate_limit:login:${clientIp}`; - const attempts = await kvNamespace.get(rateLimitKey); - const attemptCount = attempts ? parseInt(attempts, 10) : 0; - if (attemptCount >= 5) { - throw new AuthenticationError("Too many login attempts. Please try again later."); - } - const storedHashKey = `${KV_KEYS.ADMIN_TOKEN_PREFIX}password_hash`; - let storedHash = await kvNamespace.get(storedHashKey); - const adminPassword = c.env.ADMIN_PASSWORD || "admin123"; - if (!storedHash) { - storedHash = await hashPasswordWithSalt(adminPassword); - await kvNamespace.put(storedHashKey, storedHash); - } - const isValid = await verifyPassword(password, storedHash); - if (!isValid) { - await kvNamespace.put(rateLimitKey, (attemptCount + 1).toString(), { - expirationTtl: 900 - // 15 minutes - }); - throw new AuthenticationError("Invalid password"); - } - await kvNamespace.delete(rateLimitKey); - const token = generateSessionToken(); - const hashedToken = await hashToken(token); - await kvNamespace.put(`${KV_KEYS.ADMIN_TOKEN_PREFIX}${hashedToken}`, Date.now().toString(), { - expirationTtl: ADMIN_TOKEN_TTL - // 24 hours - }); - return c.json({ token }); -})); -var auth_default = router7; - -// src/routes/admin/products.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/services/ProductStripeService.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var ProductStripeService = class { - static { - __name(this, "ProductStripeService"); - } - constructor(stripeService) { - this.stripe = stripeService; - } - /** - * Create Stripe product and prices for a product with variants - */ - async createProductWithPrices(productData) { - const stripeProduct = await this.stripe.createProduct({ - name: productData.name, - description: productData.description, - images: Array.isArray(productData.images) ? productData.images : productData.imageUrl ? [productData.imageUrl] : [] - }); - const variants = Array.isArray(productData.variants) ? productData.variants : []; - const variants2 = Array.isArray(productData.variants2) ? productData.variants2 : []; - let basePrice = null; - const variantPrices = {}; - if (variants.length === 0 && variants2.length === 0) { - basePrice = await this.stripe.createPrice({ - amount: productData.price, - currency: productData.currency, - productId: stripeProduct.id, - nickname: `${productData.name} - Base`, - metadata: { - price_type: "base", - product_name: productData.name - } - }); - } else { - const combinations = []; - if (variants.length > 0 && variants2.length > 0) { - for (const v1 of variants) { - for (const v2 of variants2) { - const comboName = `${productData.name} - ${v1.name} - ${v2.name}`; - const comboPrice = v1.hasCustomPrice && v1.price ? v1.price : v2.hasCustomPrice && v2.price ? v2.price : productData.price; - combinations.push({ - name: comboName, - price: comboPrice, - variant1: v1, - variant2: v2, - description: comboName, - variantCombo: `${v1.id || v1.name}-${v2.id || v2.name}` - }); - } - } - } else if (variants.length > 0) { - for (const v of variants) { - const comboName = `${productData.name} - ${v.name}`; - const comboPrice = v.hasCustomPrice && v.price ? v.price : productData.price; - combinations.push({ - name: comboName, - price: comboPrice, - variant1: v, - description: comboName, - variantCombo: `${v.id || v.name}` - }); - } - } else if (variants2.length > 0) { - for (const v of variants2) { - const comboName = `${productData.name} - ${v.name}`; - const comboPrice = v.hasCustomPrice && v.price ? v.price : productData.price; - combinations.push({ - name: comboName, - price: comboPrice, - variant2: v, - description: comboName, - variantCombo: `${v.id || v.name}` - }); - } - } - for (const combo of combinations) { - const stripePrice = await this.stripe.createPrice({ - amount: combo.price, - currency: productData.currency, - productId: stripeProduct.id, - nickname: combo.name, - metadata: { - price_type: "variant_combo", - product_name: productData.name, - variant1_name: combo.variant1?.name || "", - variant2_name: combo.variant2?.name || "", - variant1_id: combo.variant1?.id || "", - variant2_id: combo.variant2?.id || "", - variant1_style: productData.variantStyle || "Variant", - variant2_style: productData.variantStyle2 || "Variant", - variant_combo: combo.variantCombo - } - }); - if (combo.variant1 && combo.variant2) { - variantPrices[`${combo.variant1.id}-${combo.variant2.id}`] = stripePrice.id; - } else if (combo.variant1) { - variantPrices[combo.variant1.id] = stripePrice.id; - } else if (combo.variant2) { - variantPrices[combo.variant2.id] = stripePrice.id; - } - } - basePrice = await this.stripe.createPrice({ - amount: productData.price, - currency: productData.currency, - productId: stripeProduct.id, - nickname: `${productData.name} - Base`, - metadata: { - price_type: "base", - product_name: productData.name - } - }); - } - return { - stripeProduct, - basePrice, - variantPrices - }; - } - /** - * Update product variants and prices - */ - async updateProductVariants(existingProduct, updates, stripeService) { - const baseStripePriceId = updates.stripePriceId || existingProduct.stripePriceId; - const updatedVariants = []; - const updatedVariants2 = []; - if (Array.isArray(updates.variants)) { - const incomingVariants = updates.variants; - const existingVariants = Array.isArray(existingProduct.variants) ? existingProduct.variants : []; - for (const v of incomingVariants) { - const prior = v.id ? existingVariants.find((ev) => ev.id === v.id) : void 0; - const wantsCustom = !!v.hasCustomPrice && typeof v.price === "number" && v.price > 0; - if (wantsCustom) { - const desiredUnitAmount = Math.round(v.price * 100); - let priceIdToUse = prior?.stripePriceId; - const priorWasCustom = !!prior?.hasCustomPrice && typeof prior?.price === "number"; - const priorAmount = priorWasCustom ? Math.round(prior.price * 100) : null; - if (!priceIdToUse || !priorWasCustom || priorAmount !== desiredUnitAmount) { - const newVariantPrice = await stripeService.createPrice({ - amount: v.price, - currency: updates.currency || existingProduct.currency, - productId: existingProduct.stripeProductId, - nickname: `${updates.name || existingProduct.name} - ${v.name}`, - metadata: { - price_type: "variant_primary", - variant_id: v.id || "", - variant_name: v.name || "" - } - }); - if (prior?.stripePriceId && priorWasCustom) { - try { - await stripeService.archivePrice(prior.stripePriceId); - } catch (_) { - } - } - priceIdToUse = newVariantPrice.id; - } - updatedVariants.push({ ...v, stripePriceId: priceIdToUse, hasCustomPrice: true }); - } else { - if (prior?.stripePriceId && prior?.hasCustomPrice) { - try { - await stripeService.archivePrice(prior.stripePriceId); - } catch (_) { - } - } - updatedVariants.push({ ...v, stripePriceId: baseStripePriceId, hasCustomPrice: false, price: void 0 }); - } - } - } - if (Array.isArray(updates.variants2)) { - const incomingVariants = updates.variants2; - const existingVariants = Array.isArray(existingProduct.variants2) ? existingProduct.variants2 : []; - for (const v of incomingVariants) { - const prior = v.id ? existingVariants.find((ev) => ev.id === v.id) : void 0; - const wantsCustom = !!v.hasCustomPrice && typeof v.price === "number" && v.price > 0; - if (wantsCustom) { - const desiredUnitAmount = Math.round(v.price * 100); - let priceIdToUse = prior?.stripePriceId; - const priorWasCustom = !!prior?.hasCustomPrice && typeof prior?.price === "number"; - const priorAmount = priorWasCustom ? Math.round(prior.price * 100) : null; - if (!priceIdToUse || !priorWasCustom || priorAmount !== desiredUnitAmount) { - const newVariantPrice = await stripeService.createPrice({ - amount: v.price, - currency: updates.currency || existingProduct.currency, - productId: existingProduct.stripeProductId, - nickname: `${updates.name || existingProduct.name}${updates.variantStyle2 || existingProduct.variantStyle2 ? ` - ${updates.variantStyle2 || existingProduct.variantStyle2}: ${v.name}` : ` - ${v.name}`}`, - metadata: { - price_type: "variant_secondary", - variant_id: v.id || "", - variant_name: v.name || "", - variant2_name: v.name || "" - } - }); - if (prior?.stripePriceId && priorWasCustom) { - try { - await stripeService.archivePrice(prior.stripePriceId); - } catch (_) { - } - } - priceIdToUse = newVariantPrice.id; - } - updatedVariants2.push({ ...v, stripePriceId: priceIdToUse, hasCustomPrice: true }); - } else { - if (prior?.stripePriceId && prior?.hasCustomPrice) { - try { - await stripeService.archivePrice(prior.stripePriceId); - } catch (_) { - } - } - updatedVariants2.push({ ...v, stripePriceId: baseStripePriceId, hasCustomPrice: false, price: void 0 }); - } - } - } - return { - variants: updatedVariants.length > 0 ? updatedVariants : existingProduct.variants, - variants2: updatedVariants2.length > 0 ? updatedVariants2 : existingProduct.variants2 - }; - } -}; - -// src/routes/admin/products.js -init_kv(); -var router8 = new Hono2(); -router8.get("/", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const productService = new ProductService(kvNamespace); - const products = await productService.getAllProductsAdmin(); - return c.json(products); -})); -router8.post("/", asyncHandler(async (c) => { - const productData = await c.req.json(); - const kvNamespace = getKVNamespace(c.env); - const productService = new ProductService(kvNamespace); - const stripeService = new StripeService(c.env.STRIPE_SECRET_KEY, c.env.SITE_URL); - const productStripeService = new ProductStripeService(stripeService); - const { stripeProduct, basePrice, variantPrices } = await productStripeService.createProductWithPrices(productData); - const product = { - ...productData, - stripePriceId: basePrice?.id || Object.values(variantPrices)[0] || "", - stripeProductId: stripeProduct.id, - variantPrices, - variants: Array.isArray(productData.variants) ? productData.variants : [], - variants2: Array.isArray(productData.variants2) ? productData.variants2 : [] - }; - const savedProduct = await productService.createProduct(product); - return c.json(savedProduct, 201); -})); -router8.get("/:id", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const productService = new ProductService(kvNamespace); - const product = await productService.getProduct(c.req.param("id")); - return c.json(product); -})); -router8.put("/:id", asyncHandler(async (c) => { - const updates = await c.req.json(); - const kvNamespace = getKVNamespace(c.env); - const productService = new ProductService(kvNamespace); - const stripeService = new StripeService(c.env.STRIPE_SECRET_KEY, c.env.SITE_URL); - const productStripeService = new ProductStripeService(stripeService); - const existingProduct = await productService.getProduct(c.req.param("id")); - if (updates.name || updates.description !== void 0 || updates.images || updates.imageUrl) { - const stripeImages = Array.isArray(updates.images) ? updates.images : updates.imageUrl ? [updates.imageUrl] : Array.isArray(existingProduct.images) ? existingProduct.images : existingProduct.imageUrl ? [existingProduct.imageUrl] : []; - await stripeService.updateProduct(existingProduct.stripeProductId, { - name: updates.name || existingProduct.name, - description: updates.description, - images: stripeImages.slice(0, 8) - }); - } - if (typeof updates.price !== "undefined" && updates.price !== existingProduct.price) { - const numericPrice = typeof updates.price === "number" ? updates.price : parseFloat(String(updates.price)); - const newPrice = await stripeService.createPrice({ - amount: numericPrice, - currency: updates.currency || existingProduct.currency, - productId: existingProduct.stripeProductId, - nickname: `${updates.name || existingProduct.name} - Base`, - metadata: {} - }); - if (existingProduct.stripePriceId) { - await stripeService.archivePrice(existingProduct.stripePriceId); - } - updates.stripePriceId = newPrice.id; - updates.price = numericPrice; - } - if (Array.isArray(updates.variants) || Array.isArray(updates.variants2)) { - const variantUpdates = await productStripeService.updateProductVariants(existingProduct, updates, stripeService); - updates.variants = variantUpdates.variants; - updates.variants2 = variantUpdates.variants2; - } - const updatedProduct = await productService.updateProduct(c.req.param("id"), updates); - return c.json(updatedProduct); -})); -router8.delete("/:id", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const productService = new ProductService(kvNamespace); - const stripeService = new StripeService(c.env.STRIPE_SECRET_KEY, c.env.SITE_URL); - const existingProduct = await productService.getProduct(c.req.param("id")); - if (existingProduct.stripePriceId) { - await stripeService.archivePrice(existingProduct.stripePriceId); - } - if (existingProduct.stripeProductId) { - await stripeService.archiveProduct(existingProduct.stripeProductId); - } - await productService.deleteProduct(c.req.param("id")); - return c.json({ success: true }); -})); -var products_default2 = router8; - -// src/routes/admin/collections.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -init_kv(); -var router9 = new Hono2(); -router9.get("/", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const collectionService = new CollectionService(kvNamespace); - const collections = await collectionService.getAllCollectionsAdmin(); - return c.json(collections); -})); -router9.post("/", asyncHandler(async (c) => { - const collectionData = await c.req.json(); - const kvNamespace = getKVNamespace(c.env); - const collectionService = new CollectionService(kvNamespace); - const savedCollection = await collectionService.createCollection(collectionData); - return c.json(savedCollection, 201); -})); -router9.get("/:id", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const collectionService = new CollectionService(kvNamespace); - const collection = await collectionService.getCollection(c.req.param("id")); - return c.json(collection); -})); -router9.put("/:id", asyncHandler(async (c) => { - const updates = await c.req.json(); - const kvNamespace = getKVNamespace(c.env); - const collectionService = new CollectionService(kvNamespace); - const updatedCollection = await collectionService.updateCollection(c.req.param("id"), updates); - return c.json(updatedCollection); -})); -router9.delete("/:id", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const collectionService = new CollectionService(kvNamespace); - await collectionService.deleteCollection(c.req.param("id")); - return c.json({ success: true }); -})); -var collections_default2 = router9; - -// src/routes/admin/analytics.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/services/AnalyticsService.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var AnalyticsService = class { - static { - __name(this, "AnalyticsService"); - } - constructor(stripeService) { - this.stripe = stripeService; - } - /** - * Get analytics data for a period - */ - async getAnalytics(period = "30d") { - const periodDays = { "1d": 1, "7d": 7, "30d": 30, "90d": 90, "1y": 365 }; - const days = periodDays[period] || 30; - const now = /* @__PURE__ */ new Date(); - const startDate = new Date(now.getTime() - days * 24 * 60 * 60 * 1e3); - const paymentIntents = await this.stripe.listPaymentIntents(startDate); - const successfulPayments = paymentIntents.data.filter((pi) => pi.status === "succeeded"); - const totalRevenue = successfulPayments.reduce((sum, payment) => sum + payment.amount, 0) / 100; - const totalOrders = successfulPayments.length; - const averageOrderValue = totalOrders > 0 ? totalRevenue / totalOrders : 0; - const chartData = []; - if (period === "1d") { - const hourlyOrders = {}; - const hourlyRevenue = {}; - successfulPayments.forEach((payment) => { - const d = new Date(payment.created * 1e3); - const bucket = new Date(d); - bucket.setMinutes(0, 0, 0); - const key = bucket.toISOString(); - hourlyOrders[key] = (hourlyOrders[key] || 0) + 1; - hourlyRevenue[key] = (hourlyRevenue[key] || 0) + payment.amount / 100; - }); - const cursor = new Date(now); - cursor.setMinutes(0, 0, 0); - const startHour = new Date(cursor.getTime() - 23 * 60 * 60 * 1e3); - const iter = new Date(startHour); - while (iter <= cursor) { - const key = new Date(iter).toISOString(); - chartData.push({ - date: key, - orders: hourlyOrders[key] || 0, - revenue: Math.round(((hourlyRevenue[key] || 0) + Number.EPSILON) * 100) / 100, - formattedDate: new Date(iter).toLocaleTimeString("en-US", { hour: "numeric" }) - }); - iter.setHours(iter.getHours() + 1); - } - } else { - const dailyData = {}; - const revenueByDate = {}; - successfulPayments.forEach((payment) => { - const date = new Date(payment.created * 1e3).toISOString().split("T")[0]; - dailyData[date] = (dailyData[date] || 0) + 1; - revenueByDate[date] = (revenueByDate[date] || 0) + payment.amount / 100; - }); - const currentDate = new Date(startDate); - while (currentDate <= now) { - const dateStr = currentDate.toISOString().split("T")[0]; - chartData.push({ - date: dateStr, - orders: dailyData[dateStr] || 0, - revenue: revenueByDate[dateStr] || 0, - formattedDate: currentDate.toLocaleDateString("en-US", { month: "short", day: "numeric" }) - }); - currentDate.setDate(currentDate.getDate() + 1); - } - } - return { - period, - totalRevenue: Math.round(totalRevenue * 100) / 100, - totalOrders, - averageOrderValue: Math.round(averageOrderValue * 100) / 100, - chartData, - recentOrders: [], - dateRange: { - start: startDate.toISOString(), - end: now.toISOString() - } - }; - } - /** - * Get orders with fulfillment status - */ - async getOrders(options = {}) { - const limit = Math.min(options.limit || 25, 50); - const direction = options.direction || "next"; - const cursor = options.cursor; - const showFulfilled = options.showFulfilled === true; - const listParams = { limit }; - if (cursor) { - if (direction === "prev") { - listParams.ending_before = cursor; - } else { - listParams.starting_after = cursor; - } - } - const sessions = await this.stripe.listCheckoutSessions(listParams); - let filteredSessions = []; - for (const s of sessions.data) { - if (s.payment_status === "paid" || s.status === "complete" || s.status === "completed") { - let includeSession = true; - if (options.kvNamespace) { - const fulfillmentKey = `order_fulfillment:${s.id}`; - const fulfillmentData = await options.kvNamespace.get(fulfillmentKey); - const fulfillmentStatus = fulfillmentData ? JSON.parse(fulfillmentData) : { fulfilled: false }; - if (showFulfilled) { - if (!fulfillmentStatus.fulfilled) { - includeSession = false; - } - } else { - if (fulfillmentStatus.fulfilled) { - includeSession = false; - } - } - } - if (includeSession) { - filteredSessions.push(s); - } - } - } - const ordered = filteredSessions.reverse(); - const orders = []; - for (const s of ordered) { - try { - const lineItems = await this.stripe.getCheckoutSessionLineItems(s.id); - let shippingDetails = null; - if (s.shipping_details) { - shippingDetails = s.shipping_details; - } else if (s.payment_intent) { - try { - const paymentIntent = await this.stripe.getPaymentIntent(s.payment_intent); - if (paymentIntent.shipping) { - shippingDetails = { - address: paymentIntent.shipping.address, - name: paymentIntent.shipping.name - }; - } - } catch (piError) { - console.log("Error fetching payment intent shipping:", piError.message); - } - } - const fulfillmentKey = `order_fulfillment:${s.id}`; - const fulfillmentData = options.kvNamespace ? await options.kvNamespace.get(fulfillmentKey) : null; - const fulfillmentStatus = fulfillmentData ? JSON.parse(fulfillmentData) : { fulfilled: false, fulfilledAt: null, fulfilledBy: null }; - orders.push({ - id: s.id, - created: s.created, - amount_total: s.amount_total, - currency: s.currency, - customer_email: s.customer_details?.email || s.customer_email || null, - customer_name: s.customer_details?.name || null, - shipping: shippingDetails, - payment_intent: s.payment_intent || null, - billing: { - name: s.customer_details?.name || null, - email: s.customer_details?.email || null, - address: s.customer_details?.address || null - }, - fulfillment: fulfillmentStatus, - items: lineItems.data.map((li) => { - const nickname = li.price?.nickname || ""; - let productName = "Unknown Product"; - let variant1Info = ""; - let variant2Info = ""; - if (nickname.includes(" - ")) { - const parts = nickname.split(" - "); - productName = parts[0]; - if (parts.length >= 2) { - variant1Info = parts[1]; - } - if (parts.length >= 3) { - variant2Info = parts[2]; - } - } else { - productName = nickname; - } - return { - id: li.id, - description: productName, - quantity: li.quantity, - amount_total: li.amount_total, - currency: li.currency, - price_nickname: nickname, - variant1_name: variant1Info || li.price?.metadata?.variant1_name || null, - variant1_style: li.price?.metadata?.variant1_style || "Variant", - variant2_name: variant2Info || li.price?.metadata?.variant2_name || null, - variant2_style: li.price?.metadata?.variant2_style || "Variant" - }; - }) - }); - } catch (e) { - console.error("Error fetching line items for session", s.id, e); - let fulfillmentStatus = { fulfilled: false, fulfilledAt: null, fulfilledBy: null }; - if (options.kvNamespace) { - const fulfillmentKey = `order_fulfillment:${s.id}`; - const fulfillmentData = await options.kvNamespace.get(fulfillmentKey); - fulfillmentStatus = fulfillmentData ? JSON.parse(fulfillmentData) : { fulfilled: false, fulfilledAt: null, fulfilledBy: null }; - } - orders.push({ - id: s.id, - created: s.created, - amount_total: s.amount_total, - currency: s.currency, - customer_email: s.customer_details?.email || s.customer_email || null, - customer_name: s.customer_details?.name || null, - shipping: s.shipping_details || null, - billing: { - name: s.customer_details?.name || null, - email: s.customer_details?.email || null, - address: s.customer_details?.address || null - }, - fulfillment: fulfillmentStatus, - items: [] - }); - } - } - const nextCursor = ordered.length > 0 ? ordered[0].id : null; - const prevCursor = ordered.length > 0 ? ordered[ordered.length - 1].id : null; - return { - limit, - orders, - cursors: { next: nextCursor, prev: prevCursor }, - has_more: sessions.has_more - }; - } -}; - -// src/routes/admin/analytics.js -init_kv(); -var router10 = new Hono2(); -router10.get("/", asyncHandler(async (c) => { - const period = c.req.query("period") || "30d"; - const stripeService = new StripeService(c.env.STRIPE_SECRET_KEY, c.env.SITE_URL); - const analyticsService = new AnalyticsService(stripeService); - const analytics = await analyticsService.getAnalytics(period); - return c.json(analytics); -})); -router10.get("/orders", asyncHandler(async (c) => { - const limit = Math.min(parseInt(c.req.query("limit") || "25", 10), 50); - const direction = c.req.query("direction") || "next"; - const cursor = c.req.query("cursor") || void 0; - const showFulfilled = c.req.query("showFulfilled") === "true"; - const stripeService = new StripeService(c.env.STRIPE_SECRET_KEY, c.env.SITE_URL); - const analyticsService = new AnalyticsService(stripeService); - const kvNamespace = getKVNamespace(c.env); - const orders = await analyticsService.getOrders({ - limit, - direction, - cursor, - showFulfilled, - kvNamespace - }); - return c.json(orders); -})); -router10.post("/orders/:orderId/fulfill", asyncHandler(async (c) => { - const orderId = c.req.param("orderId"); - const kvNamespace = getKVNamespace(c.env); - if (!kvNamespace) { - throw new Error("KV namespace not available"); - } - const fulfillmentKey = `order_fulfillment:${orderId}`; - const fulfillmentData = { - fulfilled: true, - fulfilledAt: (/* @__PURE__ */ new Date()).toISOString(), - fulfilledBy: "admin" - }; - await kvNamespace.put(fulfillmentKey, JSON.stringify(fulfillmentData)); - return c.json({ success: true, fulfillment: fulfillmentData }); -})); -var analytics_default = router10; - -// src/routes/admin/media.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/services/MediaService.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -var MediaService = class { - static { - __name(this, "MediaService"); - } - constructor(kvNamespace) { - this.kv = new KVManager(kvNamespace); - } - /** - * Generate server ID for media item - */ - generateServerId() { - const rnd = randomHex(4); - const ts = Date.now().toString(36); - return `${ts}-${rnd}`; - } - /** - * Get all media items (sorted by creation date, most recent first) - */ - async getAllMediaItems() { - const items = await this.kv.getAllMediaItems(); - return [...items].sort((a, b) => (b.createdAt || 0) - (a.createdAt || 0)); - } - /** - * Create media item - */ - async createMediaItem(itemData) { - const item = { - id: itemData.id || this.generateServerId(), - url: String(itemData.url || ""), - source: itemData.source || "link", - filename: itemData.filename || "", - mimeType: itemData.mimeType || "", - driveFileId: itemData.driveFileId || "", - createdAt: typeof itemData.createdAt === "number" ? itemData.createdAt : Date.now() - }; - return await this.kv.createMediaItem(item); - } - /** - * Delete media item - */ - async deleteMediaItem(id) { - await this.kv.deleteMediaItem(id); - } -}; - -// src/routes/admin/media.js -init_kv(); -var router11 = new Hono2(); -router11.get("/", asyncHandler(async (c) => { - const kvNamespace = getKVNamespace(c.env); - const mediaService = new MediaService(kvNamespace); - const items = await mediaService.getAllMediaItems(); - return c.json(items); -})); -router11.post("/", asyncHandler(async (c) => { - const body = await c.req.json(); - const url = body?.url; - if (!url || typeof url !== "string" || url.trim() === "") { - throw new ValidationError("url is required"); - } - const kvNamespace = getKVNamespace(c.env); - const mediaService = new MediaService(kvNamespace); - const saved = await mediaService.createMediaItem(body); - return c.json(saved, 201); -})); -router11.delete("/:id", asyncHandler(async (c) => { - const id = c.req.param("id"); - if (!id) { - throw new ValidationError("Missing id"); - } - const kvNamespace = getKVNamespace(c.env); - const mediaService = new MediaService(kvNamespace); - await mediaService.deleteMediaItem(id); - return c.json({ success: true }); -})); -var media_default = router11; - -// src/routes/admin/drive.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); - -// src/services/DriveService.js -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process(); -init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console(); -init_performance2(); -init_kv(); -init_config(); -var DRIVE_TOKEN_KEY = KV_KEYS.DRIVE_TOKEN; -var DRIVE_FOLDER_KV_PREFIX = KV_KEYS.DRIVE_FOLDER_PREFIX; -var DriveService = class { - static { - __name(this, "DriveService"); - } - constructor(env2) { - this.env = env2; - this.kv = getKVNamespace(env2); - } - /** - * Get Drive connection status - */ - async getConnectionStatus() { - try { - const raw2 = await this.kv.get(DRIVE_TOKEN_KEY); - if (!raw2) return { connected: false }; - const t = JSON.parse(raw2); - return { connected: !!t?.access_token }; - } catch (_) { - return { connected: false }; - } - } - /** - * Disconnect Drive - */ - async disconnect() { - if (!this.kv) { - throw new Error("KV namespace not available"); - } - await this.kv.delete(DRIVE_TOKEN_KEY); - const keys = await this.kv.list({ prefix: DRIVE_FOLDER_KV_PREFIX }); - for (const key of keys.keys) { - await this.kv.delete(key.name); - } - } - /** - * Ensure we have a valid access token - */ - async ensureAccessToken() { - const raw2 = await this.kv.get(DRIVE_TOKEN_KEY); - if (!raw2) throw new Error("Drive not connected"); - let tok = JSON.parse(raw2); - const now = Math.floor(Date.now() / 1e3); - if (tok.expiry && tok.expiry > now + 60) return tok; - if (!tok.refresh_token) return tok; - const tokenRes = await fetch("https://oauth2.googleapis.com/token", { - method: "POST", - headers: { "Content-Type": "application/x-www-form-urlencoded" }, - body: new URLSearchParams({ - client_id: this.env.GOOGLE_CLIENT_ID, - client_secret: this.env.GOOGLE_CLIENT_SECRET, - refresh_token: tok.refresh_token, - grant_type: "refresh_token" - }) - }); - if (!tokenRes.ok) { - let errText = ""; - try { - errText = await tokenRes.text(); - } catch (_) { - } - console.error("Drive token refresh failed", tokenRes.status, errText); - if (errText && /invalid_grant/i.test(errText)) { - try { - const cleared = { ...tok, access_token: "", refresh_token: null, expiry: 0 }; - await this.kv.put(DRIVE_TOKEN_KEY, JSON.stringify(cleared)); - } catch (_) { - } - } - throw new Error("Failed to refresh token"); - } - const t = await tokenRes.json(); - tok.access_token = t.access_token; - tok.expiry = Math.floor(Date.now() / 1e3) + (t.expires_in || 3600) - 30; - await this.kv.put(DRIVE_TOKEN_KEY, JSON.stringify(tok)); - return tok; - } - /** - * Ensure root folder exists - */ - async ensureRootFolder(tok) { - const desiredName = this.env.DRIVE_ROOT_FOLDER && String(this.env.DRIVE_ROOT_FOLDER).trim() || this.deriveDefaultFolderName(); - const kvKey = `${DRIVE_FOLDER_KV_PREFIX}:${desiredName}:id`; - const existing = await this.kv.get(kvKey); - if (existing) return { id: existing, name: desiredName }; - const query = `mimeType='application/vnd.google-apps.folder' and name='${desiredName.replace(/'/g, "\\'")}' and 'root' in parents and trashed=false`; - const listUrl = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name)`; - const foundRes = await fetch(listUrl, { - headers: { Authorization: `Bearer ${tok.access_token}` } - }); - if (foundRes.ok) { - const j = await foundRes.json(); - if (Array.isArray(j.files) && j.files.length > 0) { - const id = j.files[0].id; - await this.kv.put(kvKey, id); - return { id, name: desiredName }; - } - } - const createRes = await fetch("https://www.googleapis.com/drive/v3/files", { - method: "POST", - headers: { - Authorization: `Bearer ${tok.access_token}`, - "Content-Type": "application/json" - }, - body: JSON.stringify({ - name: desiredName, - mimeType: "application/vnd.google-apps.folder" - }) - }); - if (!createRes.ok) { - const t = await createRes.text(); - console.error("Failed to create Drive folder", t); - throw new Error("Failed to create Drive folder"); - } - const created = await createRes.json(); - const folderId = created.id; - await this.kv.put(kvKey, folderId); - return { id: folderId, name: desiredName }; - } - /** - * Derive default folder name from site URL - */ - deriveDefaultFolderName() { - try { - if (this.env.SITE_URL) { - const u = new URL(this.env.SITE_URL); - const sub = u.hostname.split(".")[0] || "openshop"; - return sub.replace(/[-_]+/g, " ").trim(); - } - } catch (_) { - } - return "OpenShop"; - } - /** - * Upload file to Drive - */ - async uploadFile(mimeType, dataBase64, filename) { - const tok = await this.ensureAccessToken(); - const folder = await this.ensureRootFolder(tok); - const boundary = `openshop-${generateSessionToken()}`; - const metadata = { name: filename || "openshop-image", parents: [folder.id] }; - const body = `--${boundary}\r -Content-Type: application/json; charset=UTF-8\r -\r -${JSON.stringify(metadata)}\r ---${boundary}\r -Content-Type: ${mimeType}\r -Content-Transfer-Encoding: base64\r -\r -${dataBase64}\r ---${boundary}--`; - const uploadRes = await fetch("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", { - method: "POST", - headers: { - "Authorization": `Bearer ${tok.access_token}`, - "Content-Type": `multipart/related; boundary=${boundary}` - }, - body - }); - if (!uploadRes.ok) { - const t = await uploadRes.text(); - console.error("Drive upload failed", t); - throw new Error(`Drive upload failed: ${t}`); - } - const file = await uploadRes.json(); - const fileId = file.id; - await fetch(`https://www.googleapis.com/drive/v3/files/${fileId}/permissions`, { - method: "POST", - headers: { - "Authorization": `Bearer ${tok.access_token}`, - "Content-Type": "application/json" - }, - body: JSON.stringify({ role: "reader", type: "anyone" }) - }).catch(() => { - }); - const viewUrl = `https://drive.usercontent.google.com/download?id=${fileId}&export=view`; - return { id: fileId, viewUrl, webViewLink: file.webViewLink, downloadUrl: viewUrl, folder: { id: folder.id, name: folder.name } }; - } - /** - * Get picker configuration - */ - async getPickerConfig() { - const apiKey = this.env.GOOGLE_API_KEY; - const clientId = this.env.GOOGLE_CLIENT_ID; - if (!apiKey || !clientId) { - throw new Error("Picker not configured"); - } - const tok = await this.ensureAccessToken(); - const now = Math.floor(Date.now() / 1e3); - const expiresIn = Math.max(0, (tok.expiry || now) - now); - return { apiKey, clientId, accessToken: tok.access_token, expiresIn }; - } - /** - * Copy files to Drive folder - */ - async copyFiles(fileIds, resourceKeys = {}) { - const tok = await this.ensureAccessToken(); - const folder = await this.ensureRootFolder(tok); - const results = []; - for (const srcId of fileIds) { - const rk = resourceKeys[srcId] || ""; - const metaUrl = `https://www.googleapis.com/drive/v3/files/${encodeURIComponent(srcId)}?fields=id,mimeType,shortcutDetails,targetId,resourceKey,webViewLink,driveId&supportsAllDrives=true${rk ? `&resourceKey=${encodeURIComponent(rk)}` : ""}`; - const metaRes = await fetch(metaUrl, { headers: { "Authorization": `Bearer ${tok.access_token}` } }); - if (!metaRes.ok) { - const t = await metaRes.text().catch(() => ""); - console.error("Drive get file failed", srcId, t); - throw new Error(`Drive file lookup failed: ${t}`); - } - const meta = await metaRes.json(); - let effectiveId = meta && meta.mimeType === "application/vnd.google-apps.shortcut" && meta.shortcutDetails && meta.shortcutDetails.targetId ? meta.shortcutDetails.targetId : meta && meta.id ? meta.id : srcId; - const effectiveResourceKey = meta && meta.resourceKey ? meta.resourceKey : rk; - const copyEndpoint = `https://www.googleapis.com/drive/v3/files/${encodeURIComponent(effectiveId)}/copy?supportsAllDrives=true${effectiveResourceKey ? `&resourceKey=${encodeURIComponent(effectiveResourceKey)}` : ""}`; - const copyRes = await fetch(copyEndpoint, { - method: "POST", - headers: { - "Authorization": `Bearer ${tok.access_token}`, - "Content-Type": "application/json" - }, - body: JSON.stringify({ parents: [folder.id] }) - }); - if (!copyRes.ok) { - const t = await copyRes.text().catch(() => ""); - console.error("Drive copy failed", effectiveId, t); - throw new Error(`Drive copy failed: ${t}`); - } - const copied = await copyRes.json(); - const fileId = copied.id; - await fetch(`https://www.googleapis.com/drive/v3/files/${fileId}/permissions?supportsAllDrives=true`, { - method: "POST", - headers: { - "Authorization": `Bearer ${tok.access_token}`, - "Content-Type": "application/json" - }, - body: JSON.stringify({ role: "reader", type: "anyone" }) - }).catch(() => { - }); - const viewUrl = `https://drive.usercontent.google.com/download?id=${fileId}&export=view`; - results.push({ id: fileId, viewUrl, webViewLink: copied.webViewLink, downloadUrl: viewUrl, folder: { id: folder.id, name: folder.name } }); - } - return results; - } -}; - -// src/routes/admin/drive.js -var router12 = new Hono2(); -router12.get("/status", asyncHandler(async (c) => { - const driveService = new DriveService(c.env); - const status = await driveService.getConnectionStatus(); - return c.json(status); -})); -router12.post("/disconnect", asyncHandler(async (c) => { - const driveService = new DriveService(c.env); - await driveService.disconnect(); - return c.json({ success: true }); -})); -router12.get("/oauth/start", asyncHandler(async (c) => { - const clientId = c.env.GOOGLE_CLIENT_ID; - const origin = new URL(c.req.url).origin; - const redirectUri = `${origin}/api/admin/drive/oauth/callback`; - if (!clientId || !redirectUri) { - throw new Error("Drive OAuth not configured"); - } - const params = new URLSearchParams(); - params.set("response_type", "code"); - params.set("client_id", clientId); - params.set("redirect_uri", redirectUri); - params.set("scope", "https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/drive.file"); - params.set("access_type", "offline"); - params.set("prompt", "consent"); - params.set("include_granted_scopes", "true"); - const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`; - return c.redirect(url, 302); -})); -router12.get("/oauth/callback", asyncHandler(async (c) => { - const code = c.req.query("code"); - if (!code) { - return c.text("Missing code", 400); - } - const clientId = c.env.GOOGLE_CLIENT_ID; - const clientSecret = c.env.GOOGLE_CLIENT_SECRET; - const origin = new URL(c.req.url).origin; - const redirectUri = `${origin}/api/admin/drive/oauth/callback`; - if (!clientId || !clientSecret) { - return c.text("OAuth not configured", 500); - } - const tokenRes = await fetch("https://oauth2.googleapis.com/token", { - method: "POST", - headers: { "Content-Type": "application/x-www-form-urlencoded" }, - body: new URLSearchParams({ - code, - client_id: clientId, - client_secret: clientSecret, - redirect_uri: redirectUri, - grant_type: "authorization_code" - }) - }); - if (!tokenRes.ok) { - const t = await tokenRes.text(); - console.error("Token exchange failed", t); - return c.text("Token exchange failed", 500); - } - const tokens = await tokenRes.json(); - const now = Math.floor(Date.now() / 1e3); - const record = { - access_token: tokens.access_token, - refresh_token: tokens.refresh_token || null, - scope: tokens.scope, - token_type: tokens.token_type, - expiry: now + (tokens.expires_in || 3600) - 30 - }; - const { getKVNamespace: getKVNamespace2 } = await Promise.resolve().then(() => (init_kv(), kv_exports)); - const { KV_KEYS: KV_KEYS2 } = await Promise.resolve().then(() => (init_config(), config_exports)); - const kv = getKVNamespace2(c.env); - if (kv) { - await kv.put(KV_KEYS2.DRIVE_TOKEN, JSON.stringify(record)); - } - return c.html(`

Google Drive connected. You can close this window.