@fragno-dev/stripe 0.0.0-canary-19162768485-1-20251107083532 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client/react.d.ts +120 -120
- package/dist/browser/client/react.js +1 -1
- package/dist/browser/client/solid.d.ts +120 -120
- package/dist/browser/client/solid.js +1 -1
- package/dist/browser/client/svelte.d.ts +120 -120
- package/dist/browser/client/svelte.js +1 -1
- package/dist/browser/client/vanilla.d.ts +120 -120
- package/dist/browser/client/vanilla.d.ts.map +1 -1
- package/dist/browser/client/vanilla.js +1 -1
- package/dist/browser/client/vue.d.ts +120 -120
- package/dist/browser/client/vue.d.ts.map +1 -1
- package/dist/browser/client/vue.js +1 -1
- package/dist/browser/index.d.ts +243 -243
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{src-ZvTFzOPP.js → src-k2PmVjgJ.js} +3 -4
- package/dist/browser/src-k2PmVjgJ.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +14 -6
- package/dist/browser/src-ZvTFzOPP.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fragno-dev/stripe",
|
|
3
3
|
"description": "Stripe integration using Fragno",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
@@ -66,8 +66,7 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"stripe": "^19.1.0",
|
|
68
68
|
"zod": "^4.0.5",
|
|
69
|
-
"@fragno-dev/core": "0.1.8"
|
|
70
|
-
"@fragno-dev/db": "0.1.14"
|
|
69
|
+
"@fragno-dev/core": "0.1.8"
|
|
71
70
|
},
|
|
72
71
|
"devDependencies": {
|
|
73
72
|
"@types/node": "^20",
|
|
@@ -75,8 +74,9 @@
|
|
|
75
74
|
"tsdown": "^0.11.9",
|
|
76
75
|
"vitest": "^3.2.4",
|
|
77
76
|
"@fragno-dev/test": "0.1.12",
|
|
78
|
-
"@fragno-dev/unplugin-fragno": "0.0.
|
|
79
|
-
"@fragno-private/vitest-config": "0.0.0"
|
|
77
|
+
"@fragno-dev/unplugin-fragno": "0.0.4",
|
|
78
|
+
"@fragno-private/vitest-config": "0.0.0",
|
|
79
|
+
"@fragno-dev/db": "0.1.14"
|
|
80
80
|
},
|
|
81
81
|
"private": false,
|
|
82
82
|
"peerDependencies": {
|
|
@@ -84,8 +84,16 @@
|
|
|
84
84
|
"solid-js": ">=1.0.0",
|
|
85
85
|
"svelte": ">=4.0.0",
|
|
86
86
|
"typescript": "^5",
|
|
87
|
-
"vue": ">=3.0.0"
|
|
87
|
+
"vue": ">=3.0.0",
|
|
88
|
+
"@fragno-dev/db": "^0.1.13"
|
|
89
|
+
},
|
|
90
|
+
"repository": {
|
|
91
|
+
"type": "git",
|
|
92
|
+
"url": "https://github.com/rejot-dev/fragno.git",
|
|
93
|
+
"directory": "packages/stripe"
|
|
88
94
|
},
|
|
95
|
+
"homepage": "https://fragno.dev",
|
|
96
|
+
"license": "MIT",
|
|
89
97
|
"scripts": {
|
|
90
98
|
"test": "vitest run",
|
|
91
99
|
"types:check": "tsc --noEmit",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-ZvTFzOPP.js","names":["resolveRouteFactories","context","routesOrFactories","routes","item","factoryRoutes","push","defineRoute","config","defineRoutes","_fragmentBuilder","create","fn","ctx","n","r","t","r","resolveRouteFactories","addRoute","createRouter","findRoute","FragnoApiError","Error","status","code","constructor","message","name","toResponse","Response","json","FragnoApiValidationError","issues","addRoute$1","route","getMountRoute","opts","mountRoute","endsWith","slice","RequestInputContext","path","method","pathParams","searchParams","headers","body","parsedBody","inputSchema","shouldValidateInput","config","rawBody","fromRequest","state","fromSSRContext","URLSearchParams","Headers","query","input","schema","valid","validateInput","#validateInput","FormData","Blob","result","validate","value","ResponseStream","writer","encoder","abortSubscribers","responseReadable","aborted","closed","writable","readable","getWriter","TextEncoder","reader","getReader","push","cancel","ReadableStream","pull","controller","done","read","close","enqueue","abort","writeRaw","encode","write","JSON","stringify","sleep","ms","Promise","res","setTimeout","onAbort","listener","forEach","subscriber","mergeHeaders","headerSources","mergedHeaders","headerSource","key","entries","set","Array","isArray","Object","OutputContext","error","initOrStatus","empty","defaultHeaders","mergedHeaders$1","object","jsonStream","cb","onError","TransformStream","stream","e","console","RequestOutputContext","outputSchema","MutableRequestState","initialBody","bodyOverride","setBody","hasBodyOverride","RequestMiddlewareOutputContext","deps","services","RequestMiddlewareInputContext","options","routes","find","route$1","queryParams","requestState","ifMatchesRoute","handler","request","parseFragnoResponse","response","get","includes","type","parseNDJSONStream","text","data","parse","decoder","TextDecoder","buffer","decode","lines","split","pop","line","trim","releaseLock","instantiatedFragmentFakeSymbol","createFragment","fragmentBuilder","routesOrFactories","interfaceImplementations","definition","usedServices","serviceName","serviceMeta","implementation","required","depsWithInterfaces","dependencies","servicesFromWithServices","providedServicesResolved","providedServices","serviceOrFactory","router","middlewareHandler","handlerWrapper","createHandlerWrapper","routeConfig","toUpperCase","fragment","additionalContext","withMiddleware","callRoute","inputOptions","callRouteRaw","requestHeaders","inputContext","outputContext","thisContext","call","handlersFor","framework","astro","ALL","loader","action","GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","req","url","URL","pathname","matchRoute","startsWith","length","requestBody","clone","params","middlewareInputContext","middlewareOutputContext","middlewareResult","FragmentInstantiationBuilder","withConfig","withRoutes","withOptions","withServices","build","instantiateFragment","a","c","i","l","n","o","s","t","u","tasks","resolves","startTask","prevResolves","i","task","cb","endTask","promise","finally","t","allTasks","Promise","resolve","push","cleanTasks","cleanTasks","clean","Symbol","cleanStores","stores","process","env","NODE_ENV","Error","$store","mocked","clean","listenerQueue","lqIndex","QUEUE_ITEMS_PER_LISTENER","epoch","atom","initialValue","listeners","$atom","get","lc","listen","value","listener","push","i","length","splice","index","indexOf","off","notify","oldValue","changedKey","runListenerQueue","set","newValue","subscribe","unbind","process","env","NODE_ENV","readonlyType","store","clean","START","STOP","SET","NOTIFY","MOUNT","UNMOUNT","REVERT_MUTATION","on","object","listener","eventKey","mutateStore","events","eventProps","reduceRight","event","l","shared","push","currentListeners","index","indexOf","splice","length","onStart","$store","runListeners","originListen","listen","arg","lc","starting","onStop","originOff","off","onSet","originSet","set","originSetKey","setKey","changed","changedValue","isAborted","abort","newValue","value","onNotify","originNotify","notify","oldValue","STORE_UNMOUNT_DELAY","onMount","initialize","payload","destroy","args","active","setTimeout","process","env","NODE_ENV","originClean","atom","epoch","onMount","computedStore","stores","cb","batched","Array","isArray","previousArgs","currentEpoch","set","args","map","$store","get","some","arg","i","value","then","t","asyncValue","$computed","undefined","timer","run","clearTimeout","setTimeout","unbinds","listen","unbind","computed","fn","atom","map","initial","$map","setKey","key","value","oldMap","notify","allTasks","stores","SSR_ENABLED","getStores","addStore","store","push","cleanStores","clientInitialData","hydrateFromWindow","window","__FRAGNO_INITIAL_DATA__","Map","console","warn","Array","from","entries","getInitialData","key","has","data","get","delete","listenToStores","listen","getFinalStoreValues","stores$1","storesInitialValue","value","loading","set","a","i","n","o","r","t","createNanoEvents","emit","event","args","callbacks","events","i","length","on","cb","push","filter","map","onStart","onStop","atom","batched","startTask","createNanoEvents","defaultOnErrorRetry","retryCount","Math","random","nanoqueryFactory","isAppVisible","visibilityChangeSubscribe","reconnectChangeSubscribe","nanoquery","cache","Map","fetcher","globalFetcher","globalSettings","events","focus","emit","FOCUS","RECONNECT","_revalidateOnInterval","_errorInvalidateTimeouts","_runningFetches","rewrittenSettings","getCachedValueByKey","key","fromCache","get","cacheHit","expires","getNow","data","error","runFetcher","keyParts","store","settings","set","v","SET_CACHE","setAsLoading","prev","toSet","loading","promise","dedupeTime","cacheLifetime","Infinity","onErrorRetry","now","has","value","cachedValue","cachedError","created","notLoading","finishTask","clearTimeout","res","onError","timer","setTimeout","invalidateKeys","delete","createFetcherStore","keyInput","fetcherSettings","process","env","NODE_ENV","Error","fetcherStore","_","fetcherSymbol","invalidate","revalidate","revalidateKeys","mutate","mutateCache","fetch","resolve","Promise","r","unsub","listen","finally","keysInternalUnsub","prevKey","prevKeyParts","keyUnsub","keyStore","evtUnsubs","firstRun","getKeyStore","subscribe","currentKeys","newKey","currentKeyValue","handleNewListener","revalidateInterval","revalidateOnFocus","revalidateOnReconnect","runRefetcher","setInterval","push","on","cacheKeyChangeHandler","keySelector","testKeyAgainstSelector","INVALIDATE_KEYS","REVALIDATE_KEYS","full","originListen","listener","forEach","fn","clearInterval","iterOverCache","cb","keys","cached","createMutatorStore","mutator","opts","throttleCalls","newMutator","keysToInvalidate","keysToRevalidate","safeKeySet","k","lc","setKey","result","getCacheUpdater","shouldRevalidate","newVal","__unsafeOverruleSettings","console","warn","isSomeKey","$key","keysAsStoresToIndexes","setKeyStoreValue","some","join","i","length","keyOrStore","storesAsArray","$storeKeys","storeValues","partIndex","noop","selector","Array","isArray","includes","Date","getTime","Symbol","name","isServer","window","addEventListener","browserCompat","document","hidden","a","RequestOutputContext","o","RequestInputContext","s","getMountRoute","r","resolveRouteFactories","getInitialData","n","addStore","t","SSR_ENABLED","computed","task","nanoquery","extractPathParams","pathPattern","segments","split","filter","length","names","segment","startsWith","push","slice","buildPath","params","patternSegments","builtSegments","name","value","Error","encodeURIComponent","join","FragnoClientError","code","constructor","message","options","cause","FragnoClientFetchError","fromUnknownFetchError","error","FragnoClientFetchNetworkError","FragnoClientFetchAbortError","FragnoClientUnknownApiError","status","FragnoClientApiError","fromResponse","response","unknown","json","parseContentType","contentType","trimmed","trim","parts","map","part","mediaType","typeParts","type","subtype","toLowerCase","parameters","i","param","equalIndex","indexOf","key","endsWith","createAbortPromise","abortSignal","Promise","_","reject","abortHandler","aborted","addEventListener","once","handleNdjsonStreamingFirstItem","store","body","decoder","TextDecoder","reader","getReader","buffer","firstItem","items","releaseLock","done","race","read","decode","stream","lines","pop","line","jsonObject","JSON","parse","streamingPromise","continueStreaming","parseError","setError","clientError","initialBuffer","lines$1","setData","unwrapAtom","get","unwrapObject","Object","fromEntries","entries","isReadableAtom","lc","notify","off","subscribe","mergeFetcherConfigs","authorConfig","userConfig","authorOpts","userOpts","keys","headers","mergeHeaders","author","user","merged","Headers","forEach","set","next","GET_HOOK_SYMBOL","Symbol","MUTATOR_HOOK_SYMBOL","STORE_SYMBOL","buildUrl","config","baseUrl","mountRoute","path","pathParams","queryParams","normalizedPathParams","normalizedQueryParams","filteredQueryParams","searchParams","URLSearchParams","toString","getCacheKey","method","pathParamValues","queryParamValues","sort","v","isStreamingResponse","isGetHook","hook","isMutatorHook","isStore","obj","ClientBuilder","publicConfig","fragmentConfig","fetcherConfig","cache","Map","createFetcherStore","createMutatorStore","invalidateKeys","cacheEntries","createStore","query","getFetcher","fetcher","defaultOptions","getFetcherOptions","#getFetcher","fetch","#getFetcherOptions","createHook","route","routes","find","outputSchema","createRouteQueryHook","createMutator","onInvalidate","createRouteQueryMutator","#createRouteQueryHook","fetcherOptions","callServerSideHandler","handler","fromSSRContext","executeQuery","window","url","ok","args","initialData","d","isStreaming","loading","Array","isArray","data","onErrorRetry","dedupeTime","Infinity","#createRouteQueryMutator","invalidate","executeMutateQuery","inputSchema","stringify","mutatorStore","bind","onError","console","mutateQuery","#invalidate","prefix","k","createClientBuilder","fragmentBuilder","routesOrFactories","authorFetcherConfig","definition","deps","services","mergedFetcherConfig","c","f","l","m","p","u","defineRoute","defineRoutes","z","StripeFragmentConfig","StripeFragmentDeps","StripeFragmentServices","webhookRoutesFactory","create","config","deps","services","method","path","outputSchema","object","success","boolean","errorCodes","const","handler","z","CustomerResponseSchema","object","id","string","literal","balance","number","business_name","optional","created","currency","nullable","deleted","void","delinquent","boolean","description","email","individual_name","invoice_credit_balance","record","invoice_prefix","livemode","metadata","name","next_invoice_sequence","phone","preferred_locales","array","infer","defineRoute","defineRoutes","z","StripeFragmentConfig","StripeFragmentDeps","StripeFragmentServices","CustomerResponseSchema","customersRoutesFactory","create","deps","config","method","path","inputSchema","object","limit","number","int","positive","max","optional","default","describe","startingAfter","string","outputSchema","customers","array","hasMore","boolean","handler","z","SubscriptionReponseSchema","object","id","string","stripeSubscriptionId","stripeCustomerId","stripePriceId","referenceId","nullable","status","enum","periodStart","date","periodEnd","trialStart","trialEnd","cancelAtPeriodEnd","boolean","cancelAt","seats","number","createdAt","updatedAt","SubscriptionUpgradeRequestSchema","priceId","describe","quantity","positive","successUrl","url","cancelUrl","returnUrl","optional","SubscriptionResponse","infer","defineRoute","defineRoutes","z","StripeFragmentConfig","StripeFragmentDeps","StripeFragmentServices","SubscriptionReponseSchema","SubscriptionUpgradeRequestSchema","SubscriptionResponse","subscriptionsRoutesFactory","create","deps","services","config","method","path","outputSchema","object","subscriptions","array","handler","inputSchema","url","string","redirect","boolean","sessionId","optional","errorCodes","const","returnUrl","describe","z","ProductResponseSchema","object","id","string","literal","active","boolean","created","number","default_price","union","any","nullable","optional","deleted","void","description","images","array","livemode","marketing_features","metadata","name","package_dimensions","shippable","statement_descriptor","tax_code","type","unit_label","updated","url","infer","defineRoute","defineRoutes","z","StripeFragmentConfig","StripeFragmentDeps","StripeFragmentServices","ProductResponseSchema","productsRoutesFactory","create","deps","config","method","path","inputSchema","object","limit","number","int","positive","max","optional","default","describe","startingAfter","string","outputSchema","products","array","hasMore","boolean","handler","z","PriceResponseSchema","object","id","string","literal","active","boolean","billing_scheme","created","number","currency","custom_unit_amount","any","nullable","optional","deleted","void","livemode","lookup_key","metadata","nickname","product","union","recurring","aggregate_usage","interval","enum","interval_count","meter","trial_period_days","usage_type","tax_behavior","tiers_mode","transform_quantity","type","unit_amount","unit_amount_decimal","infer","defineRoute","defineRoutes","z","StripeFragmentConfig","StripeFragmentDeps","StripeFragmentServices","PriceResponseSchema","pricesRoutesFactory","create","deps","config","method","path","inputSchema","object","limit","number","int","positive","max","optional","default","describe","startingAfter","string","outputSchema","prices","array","hasMore","boolean","handler","createFragment","FragnoPublicClientConfig","createClientBuilder","AbstractQuery","TableToInsertValues","defineFragmentWithDatabase","FragnoPublicConfigWithDatabase","Logger","StripeFragmentConfig","StripeFragmentDeps","StripeFragmentServices","webhookRoutesFactory","customersRoutesFactory","subscriptionsRoutesFactory","productsRoutesFactory","pricesRoutesFactory","stripeFragmentDefinition","withDatabase","withDependencies","providesService","createStripeFragment","config","fragnoConfig","createStripeFragmentClients","builder","useCustomers","createHook","useProducts","usePrices","useSubscription","upgradeSubscription","createMutator","cancelSubscription","FragnoRouteConfig"],"sources":["../../../fragno/dist/route-C4CyNHkC.js","../../../fragno/dist/fragment-instantiation-DUT-HLl1.js","../../../../node_modules/.pnpm/nanostores@1.0.1/node_modules/nanostores/task/index.js","../../../../node_modules/.pnpm/nanostores@1.0.1/node_modules/nanostores/clean-stores/index.js","../../../../node_modules/.pnpm/nanostores@1.0.1/node_modules/nanostores/atom/index.js","../../../../node_modules/.pnpm/nanostores@1.0.1/node_modules/nanostores/lifecycle/index.js","../../../../node_modules/.pnpm/nanostores@1.0.1/node_modules/nanostores/computed/index.js","../../../../node_modules/.pnpm/nanostores@1.0.1/node_modules/nanostores/map/index.js","../../../fragno/dist/ssr-kyKI7pqH.js","../../../../node_modules/.pnpm/nanoevents@9.1.0/node_modules/nanoevents/index.js","../../../../node_modules/.pnpm/@nanostores+query@0.3.4_nanostores@1.0.1/node_modules/@nanostores/query/dist/nanoquery.js","../../../fragno/dist/client-DAFHcKqA.js","../../src/routes/webhooks.ts","../../src/models/customers.ts","../../src/routes/customers.ts","../../src/models/subscriptions.ts","../../src/routes/subscriptions.ts","../../src/models/products.ts","../../src/routes/products.ts","../../src/models/prices.ts","../../src/routes/prices.ts","../../src/index.ts"],"sourcesContent":["//#region src/api/route.ts\nfunction resolveRouteFactories(context, routesOrFactories) {\n\tconst routes = [];\n\tfor (const item of routesOrFactories) if (typeof item === \"function\") {\n\t\tconst factoryRoutes = item(context);\n\t\troutes.push(...factoryRoutes);\n\t} else routes.push(item);\n\treturn routes;\n}\nfunction defineRoute(config) {\n\treturn config;\n}\nfunction defineRoutes(_fragmentBuilder) {\n\treturn { create: (fn) => {\n\t\treturn (ctx) => {\n\t\t\treturn fn({\n\t\t\t\t...ctx,\n\t\t\t\tdefineRoute\n\t\t\t});\n\t\t};\n\t} };\n}\n\n//#endregion\nexport { defineRoutes as n, resolveRouteFactories as r, defineRoute as t };\n//# sourceMappingURL=route-C4CyNHkC.js.map","import { r as resolveRouteFactories } from \"./route-C4CyNHkC.js\";\nimport { addRoute, createRouter, findRoute } from \"rou3\";\n\n//#region src/api/error.ts\nvar FragnoApiError = class extends Error {\n\t#status;\n\t#code;\n\tconstructor({ message, code }, status) {\n\t\tsuper(message);\n\t\tthis.name = \"FragnoApiError\";\n\t\tthis.#status = status;\n\t\tthis.#code = code;\n\t}\n\tget status() {\n\t\treturn this.#status;\n\t}\n\tget code() {\n\t\treturn this.#code;\n\t}\n\ttoResponse() {\n\t\treturn Response.json({\n\t\t\tmessage: this.message,\n\t\t\tcode: this.code\n\t\t}, { status: this.status });\n\t}\n};\nvar FragnoApiValidationError = class extends FragnoApiError {\n\t#issues;\n\tconstructor(message, issues) {\n\t\tsuper({\n\t\t\tmessage,\n\t\t\tcode: \"FRAGNO_VALIDATION_ERROR\"\n\t\t}, 400);\n\t\tthis.name = \"FragnoApiValidationError\";\n\t\tthis.#issues = issues;\n\t}\n\tget issues() {\n\t\treturn this.#issues;\n\t}\n\ttoResponse() {\n\t\treturn Response.json({\n\t\t\tmessage: this.message,\n\t\t\tissues: this.#issues,\n\t\t\tcode: this.code\n\t\t}, { status: this.status });\n\t}\n};\n\n//#endregion\n//#region src/api/api.ts\nfunction addRoute$1(route) {\n\treturn route;\n}\n\n//#endregion\n//#region src/api/internal/route.ts\nfunction getMountRoute(opts) {\n\tconst mountRoute = opts.mountRoute ?? `/api/${opts.name}`;\n\tif (mountRoute.endsWith(\"/\")) return mountRoute.slice(0, -1);\n\treturn mountRoute;\n}\n\n//#endregion\n//#region src/api/request-input-context.ts\nvar RequestInputContext = class RequestInputContext {\n\t#path;\n\t#method;\n\t#pathParams;\n\t#searchParams;\n\t#headers;\n\t#body;\n\t#parsedBody;\n\t#inputSchema;\n\t#shouldValidateInput;\n\tconstructor(config) {\n\t\tthis.#path = config.path;\n\t\tthis.#method = config.method;\n\t\tthis.#pathParams = config.pathParams;\n\t\tthis.#searchParams = config.searchParams;\n\t\tthis.#headers = config.headers;\n\t\tthis.#body = config.rawBody;\n\t\tthis.#parsedBody = config.parsedBody;\n\t\tthis.#inputSchema = config.inputSchema;\n\t\tthis.#shouldValidateInput = config.shouldValidateInput ?? true;\n\t}\n\t/**\n\t* Create a RequestContext from a Request object for server-side handling\n\t*/\n\tstatic async fromRequest(config) {\n\t\treturn new RequestInputContext({\n\t\t\tmethod: config.method,\n\t\t\tpath: config.path,\n\t\t\tpathParams: config.state.pathParams,\n\t\t\tsearchParams: config.state.searchParams,\n\t\t\theaders: config.state.headers,\n\t\t\tparsedBody: config.state.body,\n\t\t\trawBody: config.rawBody,\n\t\t\tinputSchema: config.inputSchema,\n\t\t\tshouldValidateInput: config.shouldValidateInput\n\t\t});\n\t}\n\t/**\n\t* Create a RequestContext for server-side rendering contexts (no Request object)\n\t*/\n\tstatic fromSSRContext(config) {\n\t\treturn new RequestInputContext({\n\t\t\tmethod: config.method,\n\t\t\tpath: config.path,\n\t\t\tpathParams: config.pathParams,\n\t\t\tsearchParams: config.searchParams ?? new URLSearchParams(),\n\t\t\theaders: config.headers ?? new Headers(),\n\t\t\tparsedBody: \"body\" in config ? config.body : void 0,\n\t\t\tinputSchema: \"inputSchema\" in config ? config.inputSchema : void 0,\n\t\t\tshouldValidateInput: false\n\t\t});\n\t}\n\t/**\n\t* The HTTP method as string (e.g., `GET`, `POST`)\n\t*/\n\tget method() {\n\t\treturn this.#method;\n\t}\n\t/**\n\t* The matched route path (e.g., `/users/:id`)\n\t* @remarks `string`\n\t*/\n\tget path() {\n\t\treturn this.#path;\n\t}\n\t/**\n\t* Extracted path parameters as object (e.g., `{ id: '123' }`)\n\t* @remarks `Record<string, string>`\n\t*/\n\tget pathParams() {\n\t\treturn this.#pathParams;\n\t}\n\t/**\n\t* [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) object for query parameters\n\t* @remarks `URLSearchParams`\n\t*/\n\tget query() {\n\t\treturn this.#searchParams;\n\t}\n\t/**\n\t* [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object for request headers\n\t* @remarks `Headers`\n\t*/\n\tget headers() {\n\t\treturn this.#headers;\n\t}\n\tget rawBody() {\n\t\treturn this.#body;\n\t}\n\t/**\n\t* Input validation context (only if inputSchema is defined)\n\t* @remarks `InputContext`\n\t*/\n\tget input() {\n\t\tif (!this.#inputSchema) return;\n\t\treturn {\n\t\t\tschema: this.#inputSchema,\n\t\t\tvalid: async () => {\n\t\t\t\tif (!this.#shouldValidateInput) return this.#parsedBody;\n\t\t\t\treturn this.#validateInput();\n\t\t\t}\n\t\t};\n\t}\n\tasync #validateInput() {\n\t\tif (!this.#inputSchema) throw new Error(\"No input schema defined for this route\");\n\t\tif (this.#parsedBody instanceof FormData || this.#parsedBody instanceof Blob) throw new Error(\"Schema validation is only supported for JSON data, not FormData or Blob\");\n\t\tconst result = await this.#inputSchema[\"~standard\"].validate(this.#parsedBody);\n\t\tif (result.issues) throw new FragnoApiValidationError(\"Validation failed\", result.issues);\n\t\treturn result.value;\n\t}\n};\n\n//#endregion\n//#region src/api/internal/response-stream.ts\nvar ResponseStream = class {\n\t#writer;\n\t#encoder;\n\t#abortSubscribers = [];\n\t#responseReadable;\n\t#aborted = false;\n\t#closed = false;\n\t/**\n\t* Whether the stream has been aborted.\n\t*/\n\tget aborted() {\n\t\treturn this.#aborted;\n\t}\n\t/**\n\t* Whether the stream has been closed normally.\n\t*/\n\tget closed() {\n\t\treturn this.#closed;\n\t}\n\t/**\n\t* The readable stream that the response is piped to.\n\t*/\n\tget responseReadable() {\n\t\treturn this.#responseReadable;\n\t}\n\tconstructor(writable, readable) {\n\t\tthis.#writer = writable.getWriter();\n\t\tthis.#encoder = new TextEncoder();\n\t\tconst reader = readable.getReader();\n\t\tthis.#abortSubscribers.push(async () => {\n\t\t\tawait reader.cancel();\n\t\t});\n\t\tthis.#responseReadable = new ReadableStream({\n\t\t\tasync pull(controller) {\n\t\t\t\tconst { done, value } = await reader.read();\n\t\t\t\tif (done) controller.close();\n\t\t\t\telse controller.enqueue(value);\n\t\t\t},\n\t\t\tcancel: () => {\n\t\t\t\tthis.abort();\n\t\t\t}\n\t\t});\n\t}\n\tasync writeRaw(input) {\n\t\ttry {\n\t\t\tif (typeof input === \"string\") input = this.#encoder.encode(input);\n\t\t\tawait this.#writer.write(input);\n\t\t} catch {}\n\t}\n\twrite(input) {\n\t\treturn this.writeRaw(JSON.stringify(input) + \"\\n\");\n\t}\n\tsleep(ms) {\n\t\treturn new Promise((res) => setTimeout(res, ms));\n\t}\n\tasync close() {\n\t\ttry {\n\t\t\tawait this.#writer.close();\n\t\t} catch {} finally {\n\t\t\tthis.#closed = true;\n\t\t}\n\t}\n\tonAbort(listener) {\n\t\tthis.#abortSubscribers.push(listener);\n\t}\n\t/**\n\t* Abort the stream.\n\t* You can call this method when stream is aborted by external event.\n\t*/\n\tabort() {\n\t\tif (!this.aborted) {\n\t\t\tthis.#aborted = true;\n\t\t\tthis.#abortSubscribers.forEach((subscriber) => subscriber());\n\t\t}\n\t}\n};\n\n//#endregion\n//#region src/api/request-output-context.ts\n/**\n* Utility function to merge headers from multiple sources.\n* Later headers override earlier ones.\n*/\nfunction mergeHeaders(...headerSources) {\n\tconst mergedHeaders = new Headers();\n\tfor (const headerSource of headerSources) {\n\t\tif (!headerSource) continue;\n\t\tif (headerSource instanceof Headers) for (const [key, value] of headerSource.entries()) mergedHeaders.set(key, value);\n\t\telse if (Array.isArray(headerSource)) for (const [key, value] of headerSource) mergedHeaders.set(key, value);\n\t\telse for (const [key, value] of Object.entries(headerSource)) mergedHeaders.set(key, value);\n\t}\n\treturn mergedHeaders;\n}\nvar OutputContext = class {\n\t/**\n\t* Creates an error response.\n\t*\n\t* Shortcut for `throw new FragnoApiError(...)`\n\t*/\n\terror = ({ message, code }, initOrStatus, headers) => {\n\t\tif (typeof initOrStatus === \"undefined\") return Response.json({\n\t\t\tmessage,\n\t\t\tcode\n\t\t}, {\n\t\t\tstatus: 500,\n\t\t\theaders\n\t\t});\n\t\tif (typeof initOrStatus === \"number\") return Response.json({\n\t\t\tmessage,\n\t\t\tcode\n\t\t}, {\n\t\t\tstatus: initOrStatus,\n\t\t\theaders\n\t\t});\n\t\tconst mergedHeaders = mergeHeaders(initOrStatus.headers, headers);\n\t\treturn Response.json({\n\t\t\tmessage,\n\t\t\tcode\n\t\t}, {\n\t\t\tstatus: initOrStatus.status,\n\t\t\theaders: mergedHeaders\n\t\t});\n\t};\n\tempty = (initOrStatus, headers) => {\n\t\tconst defaultHeaders = {};\n\t\tif (typeof initOrStatus === \"undefined\") {\n\t\t\tconst mergedHeaders$1 = mergeHeaders(defaultHeaders, headers);\n\t\t\treturn new Response(null, {\n\t\t\t\tstatus: 201,\n\t\t\t\theaders: mergedHeaders$1\n\t\t\t});\n\t\t}\n\t\tif (typeof initOrStatus === \"number\") {\n\t\t\tconst mergedHeaders$1 = mergeHeaders(defaultHeaders, headers);\n\t\t\treturn new Response(null, {\n\t\t\t\tstatus: initOrStatus,\n\t\t\t\theaders: mergedHeaders$1\n\t\t\t});\n\t\t}\n\t\tconst mergedHeaders = mergeHeaders(defaultHeaders, initOrStatus.headers, headers);\n\t\treturn new Response(null, {\n\t\t\tstatus: initOrStatus.status,\n\t\t\theaders: mergedHeaders\n\t\t});\n\t};\n\tjson = (object, initOrStatus, headers) => {\n\t\tif (typeof initOrStatus === \"undefined\") return Response.json(object, {\n\t\t\tstatus: 200,\n\t\t\theaders\n\t\t});\n\t\tif (typeof initOrStatus === \"number\") return Response.json(object, {\n\t\t\tstatus: initOrStatus,\n\t\t\theaders\n\t\t});\n\t\tconst mergedHeaders = mergeHeaders(initOrStatus.headers, headers);\n\t\treturn Response.json(object, {\n\t\t\tstatus: initOrStatus.status,\n\t\t\theaders: mergedHeaders\n\t\t});\n\t};\n\tjsonStream = (cb, { onError, headers } = {}) => {\n\t\tconst defaultHeaders = {\n\t\t\t\"content-type\": \"application/x-ndjson; charset=utf-8\",\n\t\t\t\"transfer-encoding\": \"chunked\",\n\t\t\t\"cache-control\": \"no-cache\"\n\t\t};\n\t\tconst { readable, writable } = new TransformStream();\n\t\tconst stream = new ResponseStream(writable, readable);\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tawait cb(stream);\n\t\t\t} catch (e) {\n\t\t\t\tif (e === void 0) {} else if (e instanceof Error && onError) await onError(e, stream);\n\t\t\t\telse console.error(e);\n\t\t\t} finally {\n\t\t\t\tstream.close();\n\t\t\t}\n\t\t})();\n\t\treturn new Response(stream.responseReadable, {\n\t\t\tstatus: 200,\n\t\t\theaders: mergeHeaders(defaultHeaders, headers)\n\t\t});\n\t};\n};\nvar RequestOutputContext = class extends OutputContext {\n\t#outputSchema;\n\tconstructor(outputSchema) {\n\t\tsuper();\n\t\tthis.#outputSchema = outputSchema;\n\t}\n};\n\n//#endregion\n//#region src/api/mutable-request-state.ts\n/**\n* Holds mutable request state that can be modified by middleware and consumed by handlers.\n*\n* This class provides a structural way for middleware to modify request data:\n* - Path parameters can be modified\n* - Query/search parameters can be modified\n* - Request body can be overridden\n* - Request headers can be modified\n*\n* @example\n* ```typescript\n* // In middleware\n* const state = new MutableRequestState({\n* pathParams: { id: \"123\" },\n* searchParams: new URLSearchParams(\"?role=user\"),\n* body: { name: \"John\" },\n* headers: new Headers()\n* });\n*\n* // Modify query parameters\n* state.searchParams.set(\"role\", \"admin\");\n*\n* // Override body\n* state.setBody({ name: \"Jane\" });\n*\n* // Modify headers\n* state.headers.set(\"X-Custom\", \"value\");\n* ```\n*/\nvar MutableRequestState = class {\n\t#pathParams;\n\t#searchParams;\n\t#headers;\n\t#initialBody;\n\t#bodyOverride;\n\tconstructor(config) {\n\t\tthis.#pathParams = config.pathParams;\n\t\tthis.#searchParams = config.searchParams;\n\t\tthis.#headers = config.headers;\n\t\tthis.#initialBody = config.body;\n\t\tthis.#bodyOverride = void 0;\n\t}\n\t/**\n\t* Path parameters extracted from the route.\n\t* Can be modified directly (e.g., `state.pathParams.id = \"456\"`).\n\t*/\n\tget pathParams() {\n\t\treturn this.#pathParams;\n\t}\n\t/**\n\t* URLSearchParams for query parameters.\n\t* Can be modified using URLSearchParams API (e.g., `state.searchParams.set(\"key\", \"value\")`).\n\t*/\n\tget searchParams() {\n\t\treturn this.#searchParams;\n\t}\n\t/**\n\t* Request headers.\n\t* Can be modified using Headers API (e.g., `state.headers.set(\"X-Custom\", \"value\")`).\n\t*/\n\tget headers() {\n\t\treturn this.#headers;\n\t}\n\t/**\n\t* Get the current body value.\n\t* Returns the override if set, otherwise the initial body.\n\t*/\n\tget body() {\n\t\treturn this.#bodyOverride !== void 0 ? this.#bodyOverride : this.#initialBody;\n\t}\n\t/**\n\t* Override the request body.\n\t* This allows middleware to replace the body that will be seen by the handler.\n\t*\n\t* @param body - The new body value\n\t*\n\t* @example\n\t* ```typescript\n\t* // In middleware\n\t* state.setBody({ modifiedField: \"new value\" });\n\t* ```\n\t*/\n\tsetBody(body) {\n\t\tthis.#bodyOverride = body;\n\t}\n\t/**\n\t* Check if the body has been overridden by middleware.\n\t*/\n\tget hasBodyOverride() {\n\t\treturn this.#bodyOverride !== void 0;\n\t}\n};\n\n//#endregion\n//#region src/api/request-middleware.ts\nvar RequestMiddlewareOutputContext = class extends OutputContext {\n\t#deps;\n\t#services;\n\tconstructor(deps, services) {\n\t\tsuper();\n\t\tthis.#deps = deps;\n\t\tthis.#services = services;\n\t}\n\tget deps() {\n\t\treturn this.#deps;\n\t}\n\tget services() {\n\t\treturn this.#services;\n\t}\n};\nvar RequestMiddlewareInputContext = class {\n\t#options;\n\t#route;\n\t#state;\n\tconstructor(routes, options) {\n\t\tthis.#options = options;\n\t\tthis.#state = options.state;\n\t\tconst route = routes.find((route$1) => route$1.path === options.path && route$1.method === options.method);\n\t\tif (!route) throw new Error(`Route not found: ${options.path} ${options.method}`);\n\t\tthis.#route = route;\n\t}\n\tget path() {\n\t\treturn this.#options.path;\n\t}\n\tget method() {\n\t\treturn this.#options.method;\n\t}\n\tget pathParams() {\n\t\treturn this.#state.pathParams;\n\t}\n\tget queryParams() {\n\t\treturn this.#state.searchParams;\n\t}\n\tget headers() {\n\t\treturn this.#state.headers;\n\t}\n\tget inputSchema() {\n\t\treturn this.#route.inputSchema;\n\t}\n\tget outputSchema() {\n\t\treturn this.#route.outputSchema;\n\t}\n\t/**\n\t* Access to the mutable request state.\n\t* Use this to modify query parameters, path parameters, or request body.\n\t*\n\t* @example\n\t* ```typescript\n\t* // Modify body\n\t* requestState.setBody({ modified: true });\n\t*\n\t* // Query params are already accessible via queryParams getter\n\t* // Path params are already accessible via pathParams getter\n\t* ```\n\t*/\n\tget requestState() {\n\t\treturn this.#state;\n\t}\n\tifMatchesRoute = async (method, path, handler) => {\n\t\tif (this.path !== path || this.method !== method) return;\n\t\treturn await handler(await RequestInputContext.fromRequest({\n\t\t\trequest: this.#options.request,\n\t\t\tmethod: this.#options.method,\n\t\t\tpath,\n\t\t\tpathParams: this.pathParams,\n\t\t\tinputSchema: this.#route.inputSchema,\n\t\t\tstate: this.#state\n\t\t}), new RequestOutputContext(this.#route.outputSchema));\n\t};\n};\n\n//#endregion\n//#region src/api/fragno-response.ts\n/**\n* Parse a Response object into a FragnoResponse discriminated union\n*/\nasync function parseFragnoResponse(response) {\n\tconst status = response.status;\n\tconst headers = response.headers;\n\tif ((headers.get(\"content-type\") || \"\").includes(\"application/x-ndjson\")) return {\n\t\ttype: \"jsonStream\",\n\t\tstatus,\n\t\theaders,\n\t\tstream: parseNDJSONStream(response)\n\t};\n\tconst text = await response.text();\n\tif (!text || text === \"null\") return {\n\t\ttype: \"empty\",\n\t\tstatus,\n\t\theaders\n\t};\n\tconst data = JSON.parse(text);\n\tif (data && typeof data === \"object\" && \"code\" in data) {\n\t\tif (\"message\" in data) return {\n\t\t\ttype: \"error\",\n\t\t\tstatus,\n\t\t\theaders,\n\t\t\terror: {\n\t\t\t\tmessage: data.message,\n\t\t\t\tcode: data.code\n\t\t\t}\n\t\t};\n\t\tif (\"error\" in data) return {\n\t\t\ttype: \"error\",\n\t\t\tstatus,\n\t\t\theaders,\n\t\t\terror: {\n\t\t\t\tmessage: data.error,\n\t\t\t\tcode: data.code\n\t\t\t}\n\t\t};\n\t}\n\treturn {\n\t\ttype: \"json\",\n\t\tstatus,\n\t\theaders,\n\t\tdata\n\t};\n}\n/**\n* Parse an NDJSON stream into an async generator\n*/\nasync function* parseNDJSONStream(response) {\n\tif (!response.body) return;\n\tconst reader = response.body.getReader();\n\tconst decoder = new TextDecoder();\n\tlet buffer = \"\";\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = await reader.read();\n\t\t\tif (done) break;\n\t\t\tbuffer += decoder.decode(value, { stream: true });\n\t\t\tconst lines = buffer.split(\"\\n\");\n\t\t\tbuffer = lines.pop() || \"\";\n\t\t\tfor (const line of lines) if (line.trim()) yield JSON.parse(line);\n\t\t}\n\t\tif (buffer.trim()) yield JSON.parse(buffer);\n\t} finally {\n\t\treader.releaseLock();\n\t}\n}\n\n//#endregion\n//#region src/api/fragment-instantiation.ts\nconst instantiatedFragmentFakeSymbol = \"$fragno-instantiated-fragment\";\nfunction createFragment(fragmentBuilder, config, routesOrFactories, options, interfaceImplementations) {\n\tconst definition = fragmentBuilder.definition;\n\tif (definition.usedServices) for (const [serviceName, serviceMeta] of Object.entries(definition.usedServices)) {\n\t\tconst implementation = interfaceImplementations?.[serviceName];\n\t\tif (serviceMeta.required && !implementation) throw new Error(`Fragment '${definition.name}' requires service '${serviceMeta.name}' but it was not provided`);\n\t}\n\tconst depsWithInterfaces = {\n\t\t...definition.dependencies?.(config, options) ?? {},\n\t\t...interfaceImplementations\n\t};\n\tconst servicesFromWithServices = definition.services?.(config, options, depsWithInterfaces) ?? {};\n\tlet providedServicesResolved;\n\tif (typeof definition.providedServices === \"function\") providedServicesResolved = definition.providedServices(config, options, depsWithInterfaces);\n\telse if (definition.providedServices && typeof definition.providedServices === \"object\") {\n\t\tprovidedServicesResolved = {};\n\t\tfor (const [serviceName, serviceOrFactory] of Object.entries(definition.providedServices)) if (typeof serviceOrFactory === \"function\") providedServicesResolved[serviceName] = serviceOrFactory(config, options, depsWithInterfaces);\n\t\telse providedServicesResolved[serviceName] = serviceOrFactory;\n\t}\n\tconst services = {\n\t\t...servicesFromWithServices,\n\t\t...providedServicesResolved,\n\t\t...interfaceImplementations\n\t};\n\tconst routes = resolveRouteFactories({\n\t\tconfig,\n\t\tdeps: depsWithInterfaces,\n\t\tservices\n\t}, routesOrFactories);\n\tconst mountRoute = getMountRoute({\n\t\tname: definition.name,\n\t\tmountRoute: options.mountRoute\n\t});\n\tconst router = createRouter();\n\tlet middlewareHandler;\n\tconst handlerWrapper = definition.createHandlerWrapper?.(options);\n\tfor (const routeConfig of routes) addRoute(router, routeConfig.method.toUpperCase(), routeConfig.path, routeConfig);\n\tconst fragment = {\n\t\t[instantiatedFragmentFakeSymbol]: instantiatedFragmentFakeSymbol,\n\t\tmountRoute,\n\t\tconfig: {\n\t\t\tname: definition.name,\n\t\t\troutes\n\t\t},\n\t\tservices,\n\t\tdeps: depsWithInterfaces,\n\t\tadditionalContext: {\n\t\t\t...definition.additionalContext,\n\t\t\t...options\n\t\t},\n\t\twithMiddleware: (handler) => {\n\t\t\tif (middlewareHandler) throw new Error(\"Middleware already set\");\n\t\t\tmiddlewareHandler = handler;\n\t\t\treturn fragment;\n\t\t},\n\t\tcallRoute: async (method, path, inputOptions) => {\n\t\t\treturn parseFragnoResponse(await fragment.callRouteRaw(method, path, inputOptions));\n\t\t},\n\t\tcallRouteRaw: async (method, path, inputOptions) => {\n\t\t\tconst route = routes.find((r) => r.method === method && r.path === path);\n\t\t\tif (!route) return Response.json({\n\t\t\t\terror: `Route ${method} ${path} not found`,\n\t\t\t\tcode: \"ROUTE_NOT_FOUND\"\n\t\t\t}, { status: 404 });\n\t\t\tconst { pathParams = {}, body, query, headers } = inputOptions || {};\n\t\t\tconst searchParams = query instanceof URLSearchParams ? query : query ? new URLSearchParams(query) : new URLSearchParams();\n\t\t\tconst requestHeaders = headers instanceof Headers ? headers : headers ? new Headers(headers) : new Headers();\n\t\t\tconst inputContext = new RequestInputContext({\n\t\t\t\tpath: route.path,\n\t\t\t\tmethod: route.method,\n\t\t\t\tpathParams,\n\t\t\t\tsearchParams,\n\t\t\t\theaders: requestHeaders,\n\t\t\t\tparsedBody: body,\n\t\t\t\tinputSchema: route.inputSchema,\n\t\t\t\tshouldValidateInput: true\n\t\t\t});\n\t\t\tconst outputContext = new RequestOutputContext(route.outputSchema);\n\t\t\ttry {\n\t\t\t\tlet response;\n\t\t\t\tconst thisContext = {};\n\t\t\t\tif (handlerWrapper) response = await handlerWrapper(route.handler).call(thisContext, inputContext, outputContext);\n\t\t\t\telse response = await route.handler.call(thisContext, inputContext, outputContext);\n\t\t\t\treturn response;\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"Error in callRoute handler\", error);\n\t\t\t\tif (error instanceof FragnoApiError) return error.toResponse();\n\t\t\t\treturn Response.json({\n\t\t\t\t\terror: \"Internal server error\",\n\t\t\t\t\tcode: \"INTERNAL_SERVER_ERROR\"\n\t\t\t\t}, { status: 500 });\n\t\t\t}\n\t\t},\n\t\thandlersFor: (framework) => {\n\t\t\tconst handler = fragment.handler;\n\t\t\tif (framework === \"h3\" || framework === \"nuxt\") throw new Error(`To get handlers for h3, use the 'fromWebHandler' utility function:\n import { fromWebHandler } from \"h3\";\n export default fromWebHandler(myFragment().handler);`);\n\t\t\treturn {\n\t\t\t\tastro: { ALL: handler },\n\t\t\t\t\"react-router\": {\n\t\t\t\t\tloader: ({ request }) => handler(request),\n\t\t\t\t\taction: ({ request }) => handler(request)\n\t\t\t\t},\n\t\t\t\t\"next-js\": {\n\t\t\t\t\tGET: handler,\n\t\t\t\t\tPOST: handler,\n\t\t\t\t\tPUT: handler,\n\t\t\t\t\tDELETE: handler,\n\t\t\t\t\tPATCH: handler,\n\t\t\t\t\tHEAD: handler,\n\t\t\t\t\tOPTIONS: handler\n\t\t\t\t},\n\t\t\t\t\"svelte-kit\": {\n\t\t\t\t\tGET: handler,\n\t\t\t\t\tPOST: handler,\n\t\t\t\t\tPUT: handler,\n\t\t\t\t\tDELETE: handler,\n\t\t\t\t\tPATCH: handler,\n\t\t\t\t\tHEAD: handler,\n\t\t\t\t\tOPTIONS: handler\n\t\t\t\t},\n\t\t\t\t\"solid-start\": {\n\t\t\t\t\tGET: ({ request }) => handler(request),\n\t\t\t\t\tPOST: ({ request }) => handler(request),\n\t\t\t\t\tPUT: ({ request }) => handler(request),\n\t\t\t\t\tDELETE: ({ request }) => handler(request),\n\t\t\t\t\tPATCH: ({ request }) => handler(request),\n\t\t\t\t\tHEAD: ({ request }) => handler(request),\n\t\t\t\t\tOPTIONS: ({ request }) => handler(request)\n\t\t\t\t},\n\t\t\t\t\"tanstack-start\": {\n\t\t\t\t\tGET: ({ request }) => handler(request),\n\t\t\t\t\tPOST: ({ request }) => handler(request),\n\t\t\t\t\tPUT: ({ request }) => handler(request),\n\t\t\t\t\tDELETE: ({ request }) => handler(request),\n\t\t\t\t\tPATCH: ({ request }) => handler(request),\n\t\t\t\t\tHEAD: ({ request }) => handler(request),\n\t\t\t\t\tOPTIONS: ({ request }) => handler(request)\n\t\t\t\t}\n\t\t\t}[framework];\n\t\t},\n\t\thandler: async (req) => {\n\t\t\tconst url = new URL(req.url);\n\t\t\tconst pathname = url.pathname;\n\t\t\tconst matchRoute = pathname.startsWith(mountRoute) ? pathname.slice(mountRoute.length) : null;\n\t\t\tif (matchRoute === null) return Response.json({\n\t\t\t\terror: `Fragno: Route for '${definition.name}' not found. Is the fragment mounted on the right route? Expecting: '${mountRoute}'.`,\n\t\t\t\tcode: \"ROUTE_NOT_FOUND\"\n\t\t\t}, { status: 404 });\n\t\t\tconst route = findRoute(router, req.method, matchRoute);\n\t\t\tif (!route) return Response.json({\n\t\t\t\terror: `Fragno: Route for '${definition.name}' not found`,\n\t\t\t\tcode: \"ROUTE_NOT_FOUND\"\n\t\t\t}, { status: 404 });\n\t\t\tconst { handler, inputSchema, outputSchema, path } = route.data;\n\t\t\tconst outputContext = new RequestOutputContext(outputSchema);\n\t\t\tlet requestBody = void 0;\n\t\t\tlet rawBody = void 0;\n\t\t\tif (req.body instanceof ReadableStream) {\n\t\t\t\trawBody = await req.clone().text();\n\t\t\t\tif (rawBody) try {\n\t\t\t\t\trequestBody = JSON.parse(rawBody);\n\t\t\t\t} catch {\n\t\t\t\t\trequestBody = void 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst requestState = new MutableRequestState({\n\t\t\t\tpathParams: route.params ?? {},\n\t\t\t\tsearchParams: url.searchParams,\n\t\t\t\tbody: requestBody,\n\t\t\t\theaders: new Headers(req.headers)\n\t\t\t});\n\t\t\tif (middlewareHandler) {\n\t\t\t\tconst middlewareInputContext = new RequestMiddlewareInputContext(routes, {\n\t\t\t\t\tmethod: req.method,\n\t\t\t\t\tpath,\n\t\t\t\t\trequest: req,\n\t\t\t\t\tstate: requestState\n\t\t\t\t});\n\t\t\t\tconst middlewareOutputContext = new RequestMiddlewareOutputContext(depsWithInterfaces, services);\n\t\t\t\ttry {\n\t\t\t\t\tconst middlewareResult = await middlewareHandler(middlewareInputContext, middlewareOutputContext);\n\t\t\t\t\tif (middlewareResult !== void 0) return middlewareResult;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error(\"Error in middleware\", error);\n\t\t\t\t\tif (error instanceof FragnoApiError) return error.toResponse();\n\t\t\t\t\treturn Response.json({\n\t\t\t\t\t\terror: \"Internal server error\",\n\t\t\t\t\t\tcode: \"INTERNAL_SERVER_ERROR\"\n\t\t\t\t\t}, { status: 500 });\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst inputContext = await RequestInputContext.fromRequest({\n\t\t\t\trequest: req,\n\t\t\t\tmethod: req.method,\n\t\t\t\tpath,\n\t\t\t\tpathParams: route.params ?? {},\n\t\t\t\tinputSchema,\n\t\t\t\tstate: requestState,\n\t\t\t\trawBody\n\t\t\t});\n\t\t\ttry {\n\t\t\t\treturn await (handlerWrapper ? handlerWrapper(handler) : handler).call({}, inputContext, outputContext);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"Error in handler\", error);\n\t\t\t\tif (error instanceof FragnoApiError) return error.toResponse();\n\t\t\t\treturn Response.json({\n\t\t\t\t\terror: \"Internal server error\",\n\t\t\t\t\tcode: \"INTERNAL_SERVER_ERROR\"\n\t\t\t\t}, { status: 500 });\n\t\t\t}\n\t\t}\n\t};\n\treturn fragment;\n}\n/**\n* Builder class for fluent fragment instantiation API\n*/\nvar FragmentInstantiationBuilder = class {\n\t#fragmentBuilder;\n\t#config;\n\t#routes;\n\t#options;\n\t#services;\n\tconstructor(fragmentBuilder) {\n\t\tthis.#fragmentBuilder = fragmentBuilder;\n\t}\n\t/**\n\t* Set the configuration for the fragment\n\t*/\n\twithConfig(config) {\n\t\tthis.#config = config;\n\t\treturn this;\n\t}\n\t/**\n\t* Set the routes for the fragment\n\t*/\n\twithRoutes(routes) {\n\t\tthis.#routes = routes;\n\t\treturn this;\n\t}\n\t/**\n\t* Set the options for the fragment (e.g., mountRoute, databaseAdapter)\n\t*/\n\twithOptions(options) {\n\t\tthis.#options = options;\n\t\treturn this;\n\t}\n\t/**\n\t* Provide implementations for services that this fragment uses\n\t*/\n\twithServices(services) {\n\t\tthis.#services = services;\n\t\treturn this;\n\t}\n\t/**\n\t* Build and return the instantiated fragment\n\t*/\n\tbuild() {\n\t\treturn createFragment(this.#fragmentBuilder, this.#config ?? {}, this.#routes ?? [], this.#options ?? {}, this.#services);\n\t}\n};\n/**\n* Create a fluent builder for instantiating a fragment\n*\n* @example\n* ```ts\n* const fragment = instantiateFragment(myFragmentBuilder)\n* .withConfig({ apiKey: \"key\" })\n* .withRoutes([route1, route2])\n* .withOptions({ mountRoute: \"/api\" })\n* .build();\n* ```\n*/\nfunction instantiateFragment(fragmentBuilder) {\n\treturn new FragmentInstantiationBuilder(fragmentBuilder);\n}\n\n//#endregion\nexport { RequestOutputContext as a, addRoute$1 as c, instantiatedFragmentFakeSymbol as i, FragnoApiError as l, createFragment as n, RequestInputContext as o, instantiateFragment as r, getMountRoute as s, FragmentInstantiationBuilder as t, FragnoApiValidationError as u };\n//# sourceMappingURL=fragment-instantiation-DUT-HLl1.js.map","let tasks = 0\nlet resolves = []\n\nexport function startTask() {\n tasks += 1\n return () => {\n tasks -= 1\n if (tasks === 0) {\n let prevResolves = resolves\n resolves = []\n for (let i of prevResolves) i()\n }\n }\n}\n\nexport function task(cb) {\n let endTask = startTask()\n let promise = cb().finally(endTask)\n promise.t = true\n return promise\n}\n\nexport function allTasks() {\n if (tasks === 0) {\n return Promise.resolve()\n } else {\n return new Promise(resolve => {\n resolves.push(resolve)\n })\n }\n}\n\nexport function cleanTasks() {\n tasks = 0\n}\n","import { cleanTasks } from '../task/index.js'\n\nexport let clean = Symbol('clean')\n\nexport let cleanStores = (...stores) => {\n if (process.env.NODE_ENV === 'production') {\n throw new Error(\n 'cleanStores() can be used only during development or tests'\n )\n }\n cleanTasks()\n for (let $store of stores) {\n if ($store) {\n if ($store.mocked) delete $store.mocked\n if ($store[clean]) $store[clean]()\n }\n }\n}\n","import { clean } from '../clean-stores/index.js'\n\nlet listenerQueue = []\nlet lqIndex = 0\nconst QUEUE_ITEMS_PER_LISTENER = 4\nexport let epoch = 0\n\nexport let atom = initialValue => {\n let listeners = []\n let $atom = {\n get() {\n if (!$atom.lc) {\n $atom.listen(() => {})()\n }\n return $atom.value\n },\n lc: 0,\n listen(listener) {\n $atom.lc = listeners.push(listener)\n\n return () => {\n for (\n let i = lqIndex + QUEUE_ITEMS_PER_LISTENER;\n i < listenerQueue.length;\n\n ) {\n if (listenerQueue[i] === listener) {\n listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER)\n } else {\n i += QUEUE_ITEMS_PER_LISTENER\n }\n }\n\n let index = listeners.indexOf(listener)\n if (~index) {\n listeners.splice(index, 1)\n if (!--$atom.lc) $atom.off()\n }\n }\n },\n notify(oldValue, changedKey) {\n epoch++\n let runListenerQueue = !listenerQueue.length\n for (let listener of listeners) {\n listenerQueue.push(listener, $atom.value, oldValue, changedKey)\n }\n\n if (runListenerQueue) {\n for (\n lqIndex = 0;\n lqIndex < listenerQueue.length;\n lqIndex += QUEUE_ITEMS_PER_LISTENER\n ) {\n listenerQueue[lqIndex](\n listenerQueue[lqIndex + 1],\n listenerQueue[lqIndex + 2],\n listenerQueue[lqIndex + 3]\n )\n }\n listenerQueue.length = 0\n }\n },\n /* It will be called on last listener unsubscribing.\n We will redefine it in onMount and onStop. */\n off() {},\n set(newValue) {\n let oldValue = $atom.value\n if (oldValue !== newValue) {\n $atom.value = newValue\n $atom.notify(oldValue)\n }\n },\n subscribe(listener) {\n let unbind = $atom.listen(listener)\n listener($atom.value)\n return unbind\n },\n value: initialValue\n }\n\n if (process.env.NODE_ENV !== 'production') {\n $atom[clean] = () => {\n listeners = []\n $atom.lc = 0\n $atom.off()\n }\n }\n\n return $atom\n}\n\nexport const readonlyType = store => store\n","import { clean } from '../clean-stores/index.js'\n\nconst START = 0\nconst STOP = 1\nconst SET = 2\nconst NOTIFY = 3\nconst MOUNT = 5\nconst UNMOUNT = 6\nconst REVERT_MUTATION = 10\n\nexport let on = (object, listener, eventKey, mutateStore) => {\n object.events = object.events || {}\n if (!object.events[eventKey + REVERT_MUTATION]) {\n object.events[eventKey + REVERT_MUTATION] = mutateStore(eventProps => {\n // eslint-disable-next-line no-sequences\n object.events[eventKey].reduceRight((event, l) => (l(event), event), {\n shared: {},\n ...eventProps\n })\n })\n }\n object.events[eventKey] = object.events[eventKey] || []\n object.events[eventKey].push(listener)\n return () => {\n let currentListeners = object.events[eventKey]\n let index = currentListeners.indexOf(listener)\n currentListeners.splice(index, 1)\n if (!currentListeners.length) {\n delete object.events[eventKey]\n object.events[eventKey + REVERT_MUTATION]()\n delete object.events[eventKey + REVERT_MUTATION]\n }\n }\n}\n\nexport let onStart = ($store, listener) =>\n on($store, listener, START, runListeners => {\n let originListen = $store.listen\n $store.listen = arg => {\n if (!$store.lc && !$store.starting) {\n $store.starting = true\n runListeners()\n delete $store.starting\n }\n return originListen(arg)\n }\n return () => {\n $store.listen = originListen\n }\n })\n\nexport let onStop = ($store, listener) =>\n on($store, listener, STOP, runListeners => {\n let originOff = $store.off\n $store.off = () => {\n runListeners()\n originOff()\n }\n return () => {\n $store.off = originOff\n }\n })\n\nexport let onSet = ($store, listener) =>\n on($store, listener, SET, runListeners => {\n let originSet = $store.set\n let originSetKey = $store.setKey\n if ($store.setKey) {\n $store.setKey = (changed, changedValue) => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({\n abort,\n changed,\n newValue: { ...$store.value, [changed]: changedValue }\n })\n if (!isAborted) return originSetKey(changed, changedValue)\n }\n }\n $store.set = newValue => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({ abort, newValue })\n if (!isAborted) return originSet(newValue)\n }\n return () => {\n $store.set = originSet\n $store.setKey = originSetKey\n }\n })\n\nexport let onNotify = ($store, listener) =>\n on($store, listener, NOTIFY, runListeners => {\n let originNotify = $store.notify\n $store.notify = (oldValue, changed) => {\n let isAborted\n let abort = () => {\n isAborted = true\n }\n\n runListeners({ abort, changed, oldValue })\n if (!isAborted) return originNotify(oldValue, changed)\n }\n return () => {\n $store.notify = originNotify\n }\n })\n\nexport let STORE_UNMOUNT_DELAY = 1000\n\nexport let onMount = ($store, initialize) => {\n let listener = payload => {\n let destroy = initialize(payload)\n if (destroy) $store.events[UNMOUNT].push(destroy)\n }\n return on($store, listener, MOUNT, runListeners => {\n let originListen = $store.listen\n $store.listen = (...args) => {\n if (!$store.lc && !$store.active) {\n $store.active = true\n runListeners()\n }\n return originListen(...args)\n }\n\n let originOff = $store.off\n $store.events[UNMOUNT] = []\n $store.off = () => {\n originOff()\n setTimeout(() => {\n if ($store.active && !$store.lc) {\n $store.active = false\n for (let destroy of $store.events[UNMOUNT]) destroy()\n $store.events[UNMOUNT] = []\n }\n }, STORE_UNMOUNT_DELAY)\n }\n\n if (process.env.NODE_ENV !== 'production') {\n let originClean = $store[clean]\n $store[clean] = () => {\n for (let destroy of $store.events[UNMOUNT]) destroy()\n $store.events[UNMOUNT] = []\n $store.active = false\n originClean()\n }\n }\n\n return () => {\n $store.listen = originListen\n $store.off = originOff\n }\n })\n}\n","import { atom, epoch } from '../atom/index.js'\nimport { onMount } from '../lifecycle/index.js'\n\nlet computedStore = (stores, cb, batched) => {\n if (!Array.isArray(stores)) stores = [stores]\n\n let previousArgs\n let currentEpoch\n let set = () => {\n if (currentEpoch === epoch) return\n currentEpoch = epoch\n let args = stores.map($store => $store.get())\n if (!previousArgs || args.some((arg, i) => arg !== previousArgs[i])) {\n previousArgs = args\n let value = cb(...args)\n if (value && value.then && value.t) {\n value.then(asyncValue => {\n if (previousArgs === args) {\n // Prevent a stale set\n $computed.set(asyncValue)\n }\n })\n } else {\n $computed.set(value)\n currentEpoch = epoch\n }\n }\n }\n let $computed = atom(undefined)\n let get = $computed.get\n $computed.get = () => {\n set()\n return get()\n }\n\n let timer\n let run = batched\n ? () => {\n clearTimeout(timer)\n timer = setTimeout(set)\n }\n : set\n\n onMount($computed, () => {\n let unbinds = stores.map($store => $store.listen(run))\n set()\n return () => {\n for (let unbind of unbinds) unbind()\n }\n })\n\n return $computed\n}\n\nexport let computed = (stores, fn) => computedStore(stores, fn)\nexport let batched = (stores, fn) => computedStore(stores, fn, true)\n","import { atom } from '../atom/index.js'\n\nexport let map = (initial = {}) => {\n let $map = atom(initial)\n\n $map.setKey = function (key, value) {\n let oldMap = $map.value\n if (typeof value === 'undefined' && key in $map.value) {\n $map.value = { ...$map.value }\n delete $map.value[key]\n $map.notify(oldMap, key)\n } else if ($map.value[key] !== value) {\n $map.value = {\n ...$map.value,\n [key]: value\n }\n $map.notify(oldMap, key)\n }\n }\n\n return $map\n}\n","import { allTasks } from \"nanostores\";\n\n//#region src/util/ssr.ts\nlet stores = [];\nconst SSR_ENABLED = false;\nfunction getStores() {\n\treturn stores;\n}\nfunction addStore(store) {\n\tstores.push(store);\n}\nfunction cleanStores() {\n\tstores = [];\n}\nlet clientInitialData;\nfunction hydrateFromWindow() {\n\tif (typeof window !== \"undefined\" && window.__FRAGNO_INITIAL_DATA__) {\n\t\tclientInitialData = new Map(window.__FRAGNO_INITIAL_DATA__);\n\t\tdelete window.__FRAGNO_INITIAL_DATA__;\n\t\tconsole.warn(\"hydrateFromWindow\", { clientInitialData: Array.from(clientInitialData.entries()) });\n\t}\n}\nfunction getInitialData(key) {\n\tif (clientInitialData?.has(key)) {\n\t\tconst data = clientInitialData.get(key);\n\t\tclientInitialData.delete(key);\n\t\treturn data;\n\t}\n}\nfunction listenToStores() {\n\tfor (const store of getStores()) store.listen(() => {});\n}\nasync function getFinalStoreValues() {\n\tlistenToStores();\n\tawait allTasks();\n\tconst stores$1 = getStores();\n\tconst storesInitialValue = /* @__PURE__ */ new Map();\n\tfor (const store of stores$1) {\n\t\tconst value = store.get();\n\t\tif (!value || !store.key || value.loading) continue;\n\t\tstoresInitialValue.set(store.key, value.data);\n\t}\n\treturn storesInitialValue;\n}\n\n//#endregion\nexport { getInitialData as a, getFinalStoreValues as i, addStore as n, hydrateFromWindow as o, cleanStores as r, SSR_ENABLED as t };\n//# sourceMappingURL=ssr-kyKI7pqH.js.map","export let createNanoEvents = () => ({\n emit(event, ...args) {\n for (\n let callbacks = this.events[event] || [],\n i = 0,\n length = callbacks.length;\n i < length;\n i++\n ) {\n callbacks[i](...args)\n }\n },\n events: {},\n on(event, cb) {\n ;(this.events[event] ||= []).push(cb)\n return () => {\n this.events[event] = this.events[event]?.filter(i => cb !== i)\n }\n }\n})\n","import { map, onStart, onStop, atom, batched, startTask } from 'nanostores';\nimport { createNanoEvents } from 'nanoevents';\n\nfunction defaultOnErrorRetry({ retryCount }) {\n return ~~((Math.random() + 0.5) * (1 << (retryCount < 8 ? retryCount : 8))) * 2e3;\n}\nconst nanoqueryFactory = ([\n isAppVisible,\n visibilityChangeSubscribe,\n reconnectChangeSubscribe\n]) => {\n const nanoquery = ({\n cache = /* @__PURE__ */ new Map(),\n fetcher: globalFetcher,\n ...globalSettings\n } = {}) => {\n const events = createNanoEvents();\n let focus = true;\n visibilityChangeSubscribe(() => {\n focus = isAppVisible();\n focus && events.emit(FOCUS);\n });\n reconnectChangeSubscribe(() => events.emit(RECONNECT));\n const _revalidateOnInterval = /* @__PURE__ */ new Map(), _errorInvalidateTimeouts = /* @__PURE__ */ new Map(), _runningFetches = /* @__PURE__ */ new Map();\n let rewrittenSettings = {};\n const getCachedValueByKey = (key) => {\n const fromCache = cache.get(key);\n if (!fromCache)\n return [];\n const cacheHit = (fromCache.expires || 0) > getNow();\n return cacheHit ? [fromCache.data, fromCache.error] : [];\n };\n const runFetcher = async ([key, keyParts], store, settings) => {\n if (!focus)\n return;\n const set = (v) => {\n if (store.key === key) {\n store.set(v);\n events.emit(SET_CACHE, key, v, true);\n }\n };\n const setAsLoading = (prev) => {\n const toSet = prev === void 0 ? {} : { data: prev };\n set({\n ...toSet,\n ...loading,\n promise: _runningFetches.get(key)\n });\n };\n let {\n dedupeTime = 4e3,\n cacheLifetime = Infinity,\n fetcher,\n onErrorRetry = defaultOnErrorRetry\n } = {\n ...settings,\n ...rewrittenSettings\n };\n if (cacheLifetime < dedupeTime)\n cacheLifetime = dedupeTime;\n const now = getNow();\n if (_runningFetches.has(key)) {\n if (!store.value.loading)\n setAsLoading(getCachedValueByKey(key)[0]);\n return;\n }\n let cachedValue, cachedError;\n const fromCache = cache.get(key);\n if (fromCache?.data !== void 0 || fromCache?.error) {\n [cachedValue, cachedError] = getCachedValueByKey(key);\n if ((fromCache.created || 0) + dedupeTime > now) {\n if (store.value.data != cachedValue || store.value.error != cachedError) {\n set({ ...notLoading, data: cachedValue, error: cachedError });\n }\n return;\n }\n }\n const finishTask = startTask();\n try {\n clearTimeout(_errorInvalidateTimeouts.get(key));\n const promise = fetcher(...keyParts);\n _runningFetches.set(key, promise);\n setAsLoading(cachedValue);\n const res = await promise;\n cache.set(key, {\n data: res,\n created: getNow(),\n expires: getNow() + cacheLifetime\n });\n set({ data: res, ...notLoading });\n } catch (error) {\n settings.onError?.(error);\n const retryCount = (cache.get(key)?.retryCount || 0) + 1;\n cache.set(key, {\n error,\n created: getNow(),\n expires: getNow() + cacheLifetime,\n retryCount\n });\n if (onErrorRetry) {\n const timer = onErrorRetry({\n error,\n key,\n retryCount\n });\n if (timer)\n _errorInvalidateTimeouts.set(\n key,\n setTimeout(() => {\n invalidateKeys(key);\n cache.set(key, { retryCount });\n }, timer)\n );\n }\n set({ data: store.value.data, error, ...notLoading });\n } finally {\n finishTask();\n _runningFetches.delete(key);\n }\n };\n const createFetcherStore = (keyInput, {\n fetcher = globalFetcher,\n ...fetcherSettings\n } = {}) => {\n if (process.env.NODE_ENV !== \"production\" && !fetcher) {\n throw new Error(\n \"You need to set up either global fetcher of fetcher in createFetcherStore\"\n );\n }\n const fetcherStore = map({\n ...notLoading\n }), settings = { ...globalSettings, ...fetcherSettings, fetcher };\n fetcherStore._ = fetcherSymbol;\n fetcherStore.invalidate = () => {\n const { key } = fetcherStore;\n if (key) {\n invalidateKeys(key);\n }\n };\n fetcherStore.revalidate = () => {\n const { key } = fetcherStore;\n if (key) {\n revalidateKeys(key);\n }\n };\n fetcherStore.mutate = (data) => {\n const { key } = fetcherStore;\n if (key) {\n mutateCache(key, data);\n }\n };\n fetcherStore.fetch = async () => {\n let resolve;\n const promise = new Promise((r) => resolve = r);\n const unsub = fetcherStore.listen(({ error, data }) => {\n if (error !== void 0)\n resolve({ error });\n if (data !== void 0)\n resolve({ data });\n });\n return promise.finally(unsub);\n };\n let keysInternalUnsub, prevKey, prevKeyParts, keyUnsub, keyStore;\n let evtUnsubs = [];\n onStart(fetcherStore, () => {\n const firstRun = !keysInternalUnsub;\n [keyStore, keysInternalUnsub] = getKeyStore(keyInput);\n keyUnsub = keyStore.subscribe((currentKeys) => {\n if (currentKeys) {\n const [newKey, keyParts] = currentKeys;\n fetcherStore.key = newKey;\n runFetcher([newKey, keyParts], fetcherStore, settings);\n prevKey = newKey;\n prevKeyParts = keyParts;\n } else {\n fetcherStore.key = prevKey = prevKeyParts = void 0;\n fetcherStore.set({ ...notLoading });\n }\n });\n const currentKeyValue = keyStore.get();\n if (currentKeyValue) {\n [prevKey, prevKeyParts] = currentKeyValue;\n if (firstRun)\n handleNewListener();\n }\n const {\n revalidateInterval = 0,\n revalidateOnFocus,\n revalidateOnReconnect\n } = settings;\n const runRefetcher = () => {\n if (prevKey)\n runFetcher([prevKey, prevKeyParts], fetcherStore, settings);\n };\n if (revalidateInterval > 0) {\n _revalidateOnInterval.set(\n keyInput,\n setInterval(runRefetcher, revalidateInterval)\n );\n }\n if (revalidateOnFocus)\n evtUnsubs.push(events.on(FOCUS, runRefetcher));\n if (revalidateOnReconnect)\n evtUnsubs.push(events.on(RECONNECT, runRefetcher));\n const cacheKeyChangeHandler = (keySelector) => {\n if (prevKey && testKeyAgainstSelector(prevKey, keySelector)) {\n runFetcher([prevKey, prevKeyParts], fetcherStore, settings);\n }\n };\n evtUnsubs.push(\n events.on(INVALIDATE_KEYS, cacheKeyChangeHandler),\n events.on(REVALIDATE_KEYS, cacheKeyChangeHandler),\n events.on(SET_CACHE, (keySelector, data, full) => {\n if (prevKey && testKeyAgainstSelector(prevKey, keySelector) && fetcherStore.value !== data && fetcherStore.value.data !== data) {\n fetcherStore.set(\n full ? data : { data, ...notLoading }\n );\n }\n })\n );\n });\n const handleNewListener = () => {\n if (prevKey && prevKeyParts)\n runFetcher([prevKey, prevKeyParts], fetcherStore, settings);\n };\n const originListen = fetcherStore.listen;\n fetcherStore.listen = (listener) => {\n const unsub = originListen(listener);\n listener(fetcherStore.value);\n handleNewListener();\n return unsub;\n };\n onStop(fetcherStore, () => {\n fetcherStore.value = { ...notLoading };\n keysInternalUnsub?.();\n evtUnsubs.forEach((fn) => fn());\n evtUnsubs = [];\n keyUnsub?.();\n clearInterval(_revalidateOnInterval.get(keyInput));\n });\n return fetcherStore;\n };\n const iterOverCache = (keySelector, cb) => {\n for (const key of cache.keys()) {\n if (testKeyAgainstSelector(key, keySelector))\n cb(key);\n }\n };\n const invalidateKeys = (keySelector) => {\n iterOverCache(keySelector, (key) => {\n cache.delete(key);\n });\n events.emit(INVALIDATE_KEYS, keySelector);\n };\n const revalidateKeys = (keySelector) => {\n iterOverCache(keySelector, (key) => {\n const cached = cache.get(key);\n if (cached) {\n cache.set(key, { ...cached, created: -Infinity });\n }\n });\n events.emit(REVALIDATE_KEYS, keySelector);\n };\n const mutateCache = (keySelector, data) => {\n iterOverCache(keySelector, (key) => {\n if (data === void 0)\n cache.delete(key);\n else {\n cache.set(key, {\n data,\n created: getNow(),\n expires: getNow() + (globalSettings.cacheLifetime ?? 8e3)\n });\n }\n });\n events.emit(SET_CACHE, keySelector, data);\n };\n function createMutatorStore(mutator, opts) {\n const { throttleCalls, onError } = opts ?? {\n throttleCalls: true,\n onError: globalSettings?.onError\n };\n const mutate = async (data) => {\n if (throttleCalls && store.value?.loading)\n return;\n const newMutator = rewrittenSettings.fetcher ?? mutator;\n const keysToInvalidate = [], keysToRevalidate = [];\n const safeKeySet = (k, v) => {\n if (store.lc) {\n store.setKey(k, v);\n }\n };\n try {\n store.set({\n error: void 0,\n data: void 0,\n mutate,\n ...loading\n });\n const result = await newMutator({\n data,\n invalidate: (key) => {\n keysToInvalidate.push(key);\n },\n revalidate: (key) => {\n keysToRevalidate.push(key);\n },\n getCacheUpdater: (key, shouldRevalidate = true) => [\n (newVal) => {\n mutateCache(key, newVal);\n if (shouldRevalidate) {\n keysToRevalidate.push(key);\n }\n },\n cache.get(key)?.data\n ]\n });\n safeKeySet(\"data\", result);\n return result;\n } catch (error) {\n onError?.(error);\n safeKeySet(\"error\", error);\n store.setKey(\"error\", error);\n } finally {\n safeKeySet(\"loading\", false);\n keysToInvalidate.forEach(invalidateKeys);\n keysToRevalidate.forEach(revalidateKeys);\n }\n };\n const store = map({\n mutate,\n ...notLoading\n });\n onStop(\n store,\n () => store.set({ mutate, ...notLoading })\n );\n store.mutate = mutate;\n return store;\n }\n const __unsafeOverruleSettings = (data) => {\n if (process.env.NODE_ENV !== \"test\") {\n console.warn(\n `You should only use __unsafeOverruleSettings in test environment`\n );\n }\n rewrittenSettings = data;\n };\n return [\n createFetcherStore,\n createMutatorStore,\n { __unsafeOverruleSettings, invalidateKeys, revalidateKeys, mutateCache }\n ];\n };\n function isSomeKey(key) {\n return typeof key === \"string\" || typeof key === \"number\" || key === true;\n }\n const getKeyStore = (keys) => {\n if (isSomeKey(keys))\n return [\n atom([\"\" + keys, [keys]]),\n () => {\n }\n ];\n const keyParts = [];\n const $key = atom(null);\n const keysAsStoresToIndexes = /* @__PURE__ */ new Map();\n const setKeyStoreValue = () => {\n if (keyParts.some((v) => v === null || v === void 0 || v === false)) {\n $key.set(null);\n } else {\n $key.set([keyParts.join(\"\"), keyParts]);\n }\n };\n for (let i = 0; i < keys.length; i++) {\n const keyOrStore = keys[i];\n if (isSomeKey(keyOrStore)) {\n keyParts.push(keyOrStore);\n } else {\n keyParts.push(null);\n keysAsStoresToIndexes.set(keyOrStore, i);\n }\n }\n const storesAsArray = [...keysAsStoresToIndexes.keys()];\n const $storeKeys = batched(storesAsArray, (...storeValues) => {\n for (let i = 0; i < storeValues.length; i++) {\n const store = storesAsArray[i], partIndex = keysAsStoresToIndexes.get(store);\n keyParts[partIndex] = store._ === fetcherSymbol ? store.value && \"data\" in store.value ? store.key : null : storeValues[i];\n }\n setKeyStoreValue();\n });\n setKeyStoreValue();\n return [$key, $storeKeys.subscribe(noop)];\n };\n function noop() {\n }\n const FOCUS = 1, RECONNECT = 2, INVALIDATE_KEYS = 3, REVALIDATE_KEYS = 4, SET_CACHE = 5;\n const testKeyAgainstSelector = (key, selector) => {\n if (Array.isArray(selector))\n return selector.includes(key);\n else if (typeof selector === \"function\")\n return selector(key);\n else\n return key === selector;\n };\n const getNow = () => (/* @__PURE__ */ new Date()).getTime();\n const fetcherSymbol = Symbol();\n const loading = { loading: true }, notLoading = { loading: false };\n return nanoquery;\n};\n\nconst subscribe = (name, fn) => {\n const isServer = typeof window === \"undefined\";\n if (!isServer) {\n addEventListener(name, fn);\n }\n};\nconst browserCompat = [\n () => !document.hidden,\n (cb) => subscribe(\"visibilitychange\", cb),\n (cb) => subscribe(\"online\", cb)\n];\n\nconst nanoquery = nanoqueryFactory(browserCompat);\n\nexport { nanoquery, defaultOnErrorRetry as onErrorRetry };\n","import { a as RequestOutputContext, o as RequestInputContext, s as getMountRoute } from \"./fragment-instantiation-DUT-HLl1.js\";\nimport { r as resolveRouteFactories } from \"./route-C4CyNHkC.js\";\nimport { a as getInitialData, n as addStore, t as SSR_ENABLED } from \"./ssr-kyKI7pqH.js\";\nimport { computed, task } from \"nanostores\";\nimport { nanoquery } from \"@nanostores/query\";\n\n//#region src/api/internal/path.ts\n/**\n* Extract parameter names from a path pattern at runtime.\n* Examples:\n* - \"/users/:id\" => [\"id\"]\n* - \"/files/**\" => [\"**\"]\n* - \"/files/**:rest\" => [\"rest\"]\n*/\nfunction extractPathParams(pathPattern) {\n\tconst segments = pathPattern.split(\"/\").filter((s) => s.length > 0);\n\tconst names = [];\n\tfor (const segment of segments) {\n\t\tif (segment.startsWith(\":\")) {\n\t\t\tnames.push(segment.slice(1));\n\t\t\tcontinue;\n\t\t}\n\t\tif (segment === \"**\") {\n\t\t\tnames.push(\"**\");\n\t\t\tcontinue;\n\t\t}\n\t\tif (segment.startsWith(\"**:\")) {\n\t\t\tnames.push(segment.slice(3));\n\t\t\tcontinue;\n\t\t}\n\t}\n\treturn names;\n}\n/**\n* Build a concrete path by replacing placeholders in a path pattern with values.\n*\n* Supports the same placeholder syntax as the matcher:\n* - Named parameter \":name\" is URL-encoded as a single segment\n* - Anonymous wildcard \"**\" inserts the remainder as-is (slashes preserved)\n* - Named wildcard \"**:name\" inserts the remainder from the named key\n*\n* Examples:\n* - buildPath(\"/users/:id\", { id: \"123\" }) => \"/users/123\"\n* - buildPath(\"/files/**\", { \"**\": \"a/b\" }) => \"/files/a/b\"\n* - buildPath(\"/files/**:rest\", { rest: \"a/b\" }) => \"/files/a/b\"\n*/\nfunction buildPath(pathPattern, params) {\n\tconst patternSegments = pathPattern.split(\"/\");\n\tconst builtSegments = [];\n\tfor (const segment of patternSegments) {\n\t\tif (segment.length === 0) {\n\t\t\tbuiltSegments.push(\"\");\n\t\t\tcontinue;\n\t\t}\n\t\tif (segment.startsWith(\":\")) {\n\t\t\tconst name = segment.slice(1);\n\t\t\tconst value = params[name];\n\t\t\tif (value === void 0) throw new Error(`Missing value for path parameter :${name}`);\n\t\t\tbuiltSegments.push(encodeURIComponent(value));\n\t\t\tcontinue;\n\t\t}\n\t\tif (segment === \"**\") {\n\t\t\tconst value = params[\"**\"];\n\t\t\tif (value === void 0) throw new Error(\"Missing value for path wildcard **\");\n\t\t\tbuiltSegments.push(value);\n\t\t\tcontinue;\n\t\t}\n\t\tif (segment.startsWith(\"**:\")) {\n\t\t\tconst name = segment.slice(3);\n\t\t\tconst value = params[name];\n\t\t\tif (value === void 0) throw new Error(`Missing value for path wildcard **:${name}`);\n\t\t\tbuiltSegments.push(value);\n\t\t\tcontinue;\n\t\t}\n\t\tbuiltSegments.push(segment);\n\t}\n\treturn builtSegments.join(\"/\");\n}\n\n//#endregion\n//#region src/client/client-error.ts\n/**\n* Base error class for all Fragno client errors.\n*/\nvar FragnoClientError = class extends Error {\n\t#code;\n\tconstructor(message, code, options = {}) {\n\t\tsuper(message, { cause: options.cause });\n\t\tthis.name = \"FragnoClientError\";\n\t\tthis.#code = code;\n\t}\n\tget code() {\n\t\treturn this.#code;\n\t}\n};\nvar FragnoClientFetchError = class extends FragnoClientError {\n\tconstructor(message, code, options = {}) {\n\t\tsuper(message, code, options);\n\t\tthis.name = \"FragnoClientFetchError\";\n\t}\n\tstatic fromUnknownFetchError(error) {\n\t\tif (!(error instanceof Error)) return new FragnoClientFetchNetworkError(\"Network request failed\", { cause: error });\n\t\tif (error.name === \"AbortError\") return new FragnoClientFetchAbortError(\"Request was aborted\", { cause: error });\n\t\treturn new FragnoClientFetchNetworkError(\"Network request failed\", { cause: error });\n\t}\n};\n/**\n* Error thrown when a network request fails (e.g., no internet connection, DNS failure).\n*/\nvar FragnoClientFetchNetworkError = class extends FragnoClientFetchError {\n\tconstructor(message = \"Network request failed\", options = {}) {\n\t\tsuper(message, \"NETWORK_ERROR\", options);\n\t\tthis.name = \"FragnoClientFetchNetworkError\";\n\t}\n};\n/**\n* Error thrown when a request is aborted (e.g., user cancels request, timeout).\n*/\nvar FragnoClientFetchAbortError = class extends FragnoClientFetchError {\n\tconstructor(message = \"Request was aborted\", options = {}) {\n\t\tsuper(message, \"ABORT_ERROR\", options);\n\t\tthis.name = \"FragnoClientFetchAbortError\";\n\t}\n};\n/**\n* Error thrown when the API result is unexpected, e.g. no json is returned.\n*/\nvar FragnoClientUnknownApiError = class extends FragnoClientError {\n\t#status;\n\tconstructor(message = \"Unknown API error\", status, options = {}) {\n\t\tsuper(message, \"UNKNOWN_API_ERROR\", options);\n\t\tthis.name = \"FragnoClientUnknownApiError\";\n\t\tthis.#status = status;\n\t}\n\tget status() {\n\t\treturn this.#status;\n\t}\n};\nvar FragnoClientApiError = class FragnoClientApiError extends FragnoClientError {\n\t#status;\n\tconstructor({ message, code }, status, options = {}) {\n\t\tsuper(message, code, options);\n\t\tthis.name = \"FragnoClientApiError\";\n\t\tthis.#status = status;\n\t}\n\tget status() {\n\t\treturn this.#status;\n\t}\n\t/**\n\t* The error code returned by the API.\n\t*\n\t* The type is `TErrorCode` (the set of known error codes for this route), but may also be a string\n\t* for forward compatibility with future error codes.\n\t*/\n\tget code() {\n\t\treturn super.code;\n\t}\n\tstatic async fromResponse(response) {\n\t\tconst unknown = await response.json();\n\t\tconst status = response.status;\n\t\tif (!(\"message\" in unknown || \"code\" in unknown)) return new FragnoClientUnknownApiError(\"Unknown API error\", status);\n\t\tif (!(typeof unknown.message === \"string\" && typeof unknown.code === \"string\")) return new FragnoClientUnknownApiError(\"Unknown API error\", status);\n\t\treturn new FragnoClientApiError({\n\t\t\tmessage: unknown.message,\n\t\t\tcode: unknown.code\n\t\t}, status);\n\t}\n};\n\n//#endregion\n//#region src/util/content-type.ts\n/**\n* Parses a content-type header string into its components\n*\n* @param contentType - The content-type header value to parse\n* @returns A ParsedContentType object or null if the input is invalid\n*\n* @example\n* ```ts\n* const { type, subtype, mediaType, parameters }\n* = parseContentType(\"application/json; charset=utf-8\");\n* console.assert(type === \"application\");\n* console.assert(subtype === \"json\");\n* console.assert(mediaType === \"application/json\");\n* console.assert(parameters[\"charset\"] === \"utf-8\");\n*/\nfunction parseContentType(contentType) {\n\tif (!contentType || typeof contentType !== \"string\") return null;\n\tconst trimmed = contentType.trim();\n\tif (!trimmed) return null;\n\tconst parts = trimmed.split(\";\").map((part) => part.trim());\n\tconst mediaType = parts[0];\n\tif (!mediaType) return null;\n\tconst typeParts = mediaType.split(\"/\");\n\tif (typeParts.length !== 2) return null;\n\tconst [type, subtype] = typeParts.map((part) => part.trim().toLowerCase());\n\tif (!type || !subtype) return null;\n\tconst parameters = {};\n\tfor (let i = 1; i < parts.length; i++) {\n\t\tconst param = parts[i];\n\t\tconst equalIndex = param.indexOf(\"=\");\n\t\tif (equalIndex > 0) {\n\t\t\tconst key = param.slice(0, equalIndex).trim().toLowerCase();\n\t\t\tlet value = param.slice(equalIndex + 1).trim();\n\t\t\tif (value.startsWith(\"\\\"\") && value.endsWith(\"\\\"\")) value = value.slice(1, -1);\n\t\t\tif (key) parameters[key] = value;\n\t\t}\n\t}\n\treturn {\n\t\ttype,\n\t\tsubtype,\n\t\tmediaType: `${type}/${subtype}`,\n\t\tparameters\n\t};\n}\n\n//#endregion\n//#region src/client/internal/ndjson-streaming.ts\n/**\n* Creates a promise that rejects when the abort signal is triggered\n*/\nfunction createAbortPromise(abortSignal) {\n\treturn new Promise((_, reject) => {\n\t\tconst abortHandler = () => {\n\t\t\treject(new FragnoClientFetchAbortError(\"Operation was aborted\"));\n\t\t};\n\t\tif (abortSignal.aborted) abortHandler();\n\t\telse abortSignal.addEventListener(\"abort\", abortHandler, { once: true });\n\t});\n}\n/**\n* Handles NDJSON streaming responses by returning the first item from the fetcher\n* and then continuing to stream updates via the store's mutate method.\n*\n* This makes it so that we can wait until the first chunk before updating the store, if we did\n* not do this, `loading` would briefly be false before the first item would be populated in the\n* result.\n*\n* @param response - The fetch Response object containing the NDJSON stream\n* @param store - The fetcher store to update with streaming data\n* @param abortSignal - Optional AbortSignal to cancel the streaming operation\n* @returns A promise that resolves to an object containing the first item and a streaming promise\n*/\nasync function handleNdjsonStreamingFirstItem(response, store, options = {}) {\n\tif (!response.body) throw new FragnoClientFetchError(\"Streaming response has no body\", \"NO_BODY\");\n\tconst { abortSignal } = options;\n\tif (abortSignal?.aborted) throw new FragnoClientFetchAbortError(\"Operation was aborted\");\n\tconst decoder = new TextDecoder();\n\tconst reader = response.body.getReader();\n\tlet buffer = \"\";\n\tlet firstItem = null;\n\tconst items = [];\n\ttry {\n\t\twhile (firstItem === null) {\n\t\t\tif (abortSignal?.aborted) {\n\t\t\t\treader.releaseLock();\n\t\t\t\tthrow new FragnoClientFetchAbortError(\"Operation was aborted\");\n\t\t\t}\n\t\t\tconst { done, value } = await (abortSignal ? Promise.race([reader.read(), createAbortPromise(abortSignal)]) : reader.read());\n\t\t\tif (done) break;\n\t\t\tbuffer += decoder.decode(value, { stream: true });\n\t\t\tconst lines = buffer.split(\"\\n\");\n\t\t\tbuffer = lines.pop() || \"\";\n\t\t\tfor (const line of lines) {\n\t\t\t\tif (!line.trim()) continue;\n\t\t\t\ttry {\n\t\t\t\t\tconst jsonObject = JSON.parse(line);\n\t\t\t\t\titems.push(jsonObject);\n\t\t\t\t\tif (firstItem === null) {\n\t\t\t\t\t\tfirstItem = jsonObject;\n\t\t\t\t\t\tconst streamingPromise = continueStreaming(reader, decoder, buffer, items, store, abortSignal);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfirstItem,\n\t\t\t\t\t\t\tstreamingPromise\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} catch (parseError) {\n\t\t\t\t\tthrow new FragnoClientUnknownApiError(\"Failed to parse NDJSON line\", 500, { cause: parseError });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (firstItem === null) {\n\t\t\treader.releaseLock();\n\t\t\tthrow new FragnoClientUnknownApiError(\"NDJSON stream contained no valid items\", 500);\n\t\t}\n\t\treader.releaseLock();\n\t\tthrow new FragnoClientFetchError(\"Unexpected end of stream processing\", \"NO_BODY\");\n\t} catch (error) {\n\t\tif (error instanceof FragnoClientError) {\n\t\t\tstore?.setError(error);\n\t\t\tthrow error;\n\t\t} else {\n\t\t\tconst clientError = new FragnoClientUnknownApiError(\"Unknown streaming error\", 500, { cause: error });\n\t\t\tstore?.setError(clientError);\n\t\t\tthrow clientError;\n\t\t}\n\t}\n}\n/**\n* Continues streaming the remaining items in the background\n*/\nasync function continueStreaming(reader, decoder, initialBuffer, items, store, abortSignal) {\n\tlet buffer = initialBuffer;\n\ttry {\n\t\twhile (true) {\n\t\t\tif (abortSignal?.aborted) throw new FragnoClientFetchAbortError(\"Operation was aborted\");\n\t\t\tconst { done, value } = await (abortSignal ? Promise.race([reader.read(), createAbortPromise(abortSignal)]) : reader.read());\n\t\t\tif (done) {\n\t\t\t\tif (buffer.trim()) {\n\t\t\t\t\tconst lines$1 = buffer.split(\"\\n\");\n\t\t\t\t\tfor (const line of lines$1) {\n\t\t\t\t\t\tif (!line.trim()) continue;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst jsonObject = JSON.parse(line);\n\t\t\t\t\t\t\titems.push(jsonObject);\n\t\t\t\t\t\t\tstore?.setData([...items]);\n\t\t\t\t\t\t} catch (parseError) {\n\t\t\t\t\t\t\tthrow new FragnoClientUnknownApiError(\"Failed to parse NDJSON line\", 400, { cause: parseError });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbuffer += decoder.decode(value, { stream: true });\n\t\t\tconst lines = buffer.split(\"\\n\");\n\t\t\tbuffer = lines.pop() || \"\";\n\t\t\tfor (const line of lines) {\n\t\t\t\tif (!line.trim()) continue;\n\t\t\t\ttry {\n\t\t\t\t\tconst jsonObject = JSON.parse(line);\n\t\t\t\t\titems.push(jsonObject);\n\t\t\t\t\tstore?.setData([...items]);\n\t\t\t\t} catch (parseError) {\n\t\t\t\t\tthrow new FragnoClientUnknownApiError(\"Failed to parse NDJSON line\", 400, { cause: parseError });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof FragnoClientError) store?.setError(error);\n\t\telse {\n\t\t\tconst clientError = new FragnoClientUnknownApiError(\"Unknown streaming error\", 400, { cause: error });\n\t\t\tstore?.setError(clientError);\n\t\t\tthrow clientError;\n\t\t}\n\t\tthrow error;\n\t} finally {\n\t\treader.releaseLock();\n\t}\n\treturn items;\n}\n\n//#endregion\n//#region src/util/nanostores.ts\n/**\n* Normalizes a value that could be a plain value, an Atom, or a Vue Ref to a plain value.\n*/\nfunction unwrapAtom(value) {\n\tif (value && typeof value === \"object\" && \"get\" in value && typeof value.get === \"function\") return value.get();\n\treturn value;\n}\n/**\n* Normalizes an object where values can be plain values, Atoms, or Vue Refs.\n* Returns a new object with all values normalized to plain values.\n*/\nfunction unwrapObject(params) {\n\tif (!params) return;\n\treturn Object.fromEntries(Object.entries(params).map(([key, value]) => [key, unwrapAtom(value)]));\n}\nfunction isReadableAtom(value) {\n\tif (!value) return false;\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(\"get\" in value) || typeof value.get !== \"function\") return false;\n\tif (!(\"lc\" in value) || typeof value.lc !== \"number\") return false;\n\tif (!(\"notify\" in value) || typeof value.notify !== \"function\") return false;\n\tif (!(\"off\" in value) || typeof value.off !== \"function\") return false;\n\tif (!(\"subscribe\" in value) || typeof value.subscribe !== \"function\") return false;\n\tif (!(\"value\" in value)) return false;\n\treturn true;\n}\n\n//#endregion\n//#region src/client/internal/fetcher-merge.ts\n/**\n* Merge two fetcher configurations, with user config taking precedence.\n* If user provides a custom function, it takes full precedence.\n* Otherwise, deep merge RequestInit options.\n*/\nfunction mergeFetcherConfigs(authorConfig, userConfig) {\n\tif (userConfig?.type === \"function\") return userConfig;\n\tif (!userConfig && authorConfig?.type === \"function\") return authorConfig;\n\tconst authorOpts = authorConfig?.type === \"options\" ? authorConfig.options : {};\n\tconst userOpts = userConfig?.type === \"options\" ? userConfig.options : {};\n\tif (Object.keys(authorOpts).length === 0 && Object.keys(userOpts).length === 0) return;\n\treturn {\n\t\ttype: \"options\",\n\t\toptions: {\n\t\t\t...authorOpts,\n\t\t\t...userOpts,\n\t\t\theaders: mergeHeaders(authorOpts.headers, userOpts.headers)\n\t\t}\n\t};\n}\n/**\n* Merge headers from author and user configs.\n* User headers override author headers.\n*/\nfunction mergeHeaders(author, user) {\n\tif (!author && !user) return;\n\tconst merged = new Headers(author);\n\tnew Headers(user).forEach((value, key) => merged.set(key, value));\n\tif (merged.keys().next().done) return;\n\treturn merged;\n}\n\n//#endregion\n//#region src/client/client.ts\n/**\n* Symbols used to identify hook types\n*/\nconst GET_HOOK_SYMBOL = Symbol(\"fragno-get-hook\");\nconst MUTATOR_HOOK_SYMBOL = Symbol(\"fragno-mutator-hook\");\nconst STORE_SYMBOL = Symbol(\"fragno-store\");\nfunction buildUrl(config, params) {\n\tconst { baseUrl = \"\", mountRoute, path } = config;\n\tconst { pathParams, queryParams } = params ?? {};\n\tconst normalizedPathParams = unwrapObject(pathParams);\n\tconst normalizedQueryParams = unwrapObject(queryParams) ?? {};\n\tconst filteredQueryParams = Object.fromEntries(Object.entries(normalizedQueryParams).filter(([_, value]) => value !== void 0));\n\tconst searchParams = new URLSearchParams(filteredQueryParams);\n\treturn `${baseUrl}${mountRoute}${buildPath(path, normalizedPathParams ?? {})}${searchParams.toString() ? `?${searchParams.toString()}` : \"\"}`;\n}\n/**\n* This method returns an array, which can be passed directly to nanostores.\n*\n* The returned array is always: path, pathParams (In order they appear in the path), queryParams (In alphabetical order)\n* Missing pathParams are replaced with \"<missing>\".\n* Atoms with undefined values are wrapped in computed atoms that map undefined to \"\" to avoid nanoquery treating the key as incomplete.\n* @param path\n* @param params\n* @returns\n*/\nfunction getCacheKey(method, path, params) {\n\tif (!params) return [method, path];\n\tconst { pathParams, queryParams } = params;\n\tconst pathParamValues = extractPathParams(path).map((name) => pathParams?.[name] ?? \"<missing>\");\n\tconst queryParamValues = queryParams ? Object.keys(queryParams).sort().map((key) => {\n\t\tconst value = queryParams[key];\n\t\tif (value && typeof value === \"object\" && \"get\" in value) return computed(value, (v) => v ?? \"\");\n\t\treturn value ?? \"\";\n\t}) : [];\n\treturn [\n\t\tmethod,\n\t\tpath,\n\t\t...pathParamValues,\n\t\t...queryParamValues\n\t];\n}\nfunction isStreamingResponse(response) {\n\tconst contentType = parseContentType(response.headers.get(\"content-type\"));\n\tif (!contentType) return false;\n\tif (!(response.headers.get(\"transfer-encoding\") === \"chunked\")) return false;\n\tif (contentType.subtype === \"octet-stream\") return \"octet-stream\";\n\tif (contentType.subtype === \"x-ndjson\") return \"ndjson\";\n\treturn false;\n}\nfunction isGetHook(hook) {\n\treturn typeof hook === \"object\" && hook !== null && GET_HOOK_SYMBOL in hook && hook[GET_HOOK_SYMBOL] === true;\n}\nfunction isMutatorHook(hook) {\n\treturn typeof hook === \"object\" && hook !== null && MUTATOR_HOOK_SYMBOL in hook && hook[MUTATOR_HOOK_SYMBOL] === true;\n}\nfunction isStore(obj) {\n\treturn typeof obj === \"object\" && obj !== null && STORE_SYMBOL in obj && obj[STORE_SYMBOL] === true;\n}\nvar ClientBuilder = class {\n\t#publicConfig;\n\t#fragmentConfig;\n\t#fetcherConfig;\n\t#cache = /* @__PURE__ */ new Map();\n\t#createFetcherStore;\n\t#createMutatorStore;\n\t#invalidateKeys;\n\tconstructor(publicConfig, fragmentConfig) {\n\t\tthis.#publicConfig = publicConfig;\n\t\tthis.#fragmentConfig = fragmentConfig;\n\t\tthis.#fetcherConfig = publicConfig.fetcherConfig;\n\t\tconst [createFetcherStore, createMutatorStore, { invalidateKeys }] = nanoquery({ cache: this.#cache });\n\t\tthis.#createFetcherStore = createFetcherStore;\n\t\tthis.#createMutatorStore = createMutatorStore;\n\t\tthis.#invalidateKeys = invalidateKeys;\n\t}\n\tget cacheEntries() {\n\t\treturn Object.fromEntries(this.#cache.entries());\n\t}\n\tcreateStore(obj) {\n\t\treturn {\n\t\t\tobj,\n\t\t\t[STORE_SYMBOL]: true\n\t\t};\n\t}\n\t/**\n\t* Build a URL for a custom backend call using the configured baseUrl and mountRoute.\n\t* Useful for fragment authors who need to make custom fetch calls.\n\t*/\n\tbuildUrl(path, params) {\n\t\treturn buildUrl({\n\t\t\tbaseUrl: this.#publicConfig.baseUrl ?? \"\",\n\t\t\tmountRoute: getMountRoute(this.#fragmentConfig),\n\t\t\tpath\n\t\t}, {\n\t\t\tpathParams: params?.path,\n\t\t\tqueryParams: params?.query\n\t\t});\n\t}\n\t/**\n\t* Get the configured fetcher function for custom backend calls.\n\t* Returns fetch with merged options applied.\n\t*/\n\tgetFetcher() {\n\t\treturn {\n\t\t\tfetcher: this.#getFetcher(),\n\t\t\tdefaultOptions: this.#getFetcherOptions()\n\t\t};\n\t}\n\t#getFetcher() {\n\t\tif (this.#fetcherConfig?.type === \"function\") return this.#fetcherConfig.fetcher;\n\t\treturn fetch;\n\t}\n\t#getFetcherOptions() {\n\t\tif (this.#fetcherConfig?.type === \"options\") return this.#fetcherConfig.options;\n\t}\n\tcreateHook(path, options) {\n\t\tconst route = this.#fragmentConfig.routes.find((r) => r.path === path && r.method === \"GET\" && r.outputSchema !== void 0);\n\t\tif (!route) throw new Error(`Route '${path}' not found or is not a GET route with an output schema.`);\n\t\treturn this.#createRouteQueryHook(route, options);\n\t}\n\tcreateMutator(method, path, onInvalidate) {\n\t\tconst route = this.#fragmentConfig.routes.find((r) => r.method !== \"GET\" && r.path === path && r.method === method);\n\t\tif (!route) throw new Error(`Route '${path}' not found or is a GET route with an input and output schema.`);\n\t\treturn this.#createRouteQueryMutator(route, onInvalidate);\n\t}\n\t#createRouteQueryHook(route, options = {}) {\n\t\tif (route.method !== \"GET\") throw new Error(`Only GET routes are supported for hooks. Route '${route.path}' is a ${route.method} route.`);\n\t\tif (!route.outputSchema) throw new Error(`Output schema is required for GET routes. Route '${route.path}' has no output schema.`);\n\t\tconst baseUrl = this.#publicConfig.baseUrl ?? \"\";\n\t\tconst mountRoute = getMountRoute(this.#fragmentConfig);\n\t\tconst fetcher = this.#getFetcher();\n\t\tconst fetcherOptions = this.#getFetcherOptions();\n\t\tasync function callServerSideHandler(params) {\n\t\t\tconst { pathParams, queryParams } = params ?? {};\n\t\t\tconst normalizedPathParams = unwrapObject(pathParams);\n\t\t\tconst normalizedQueryParams = unwrapObject(queryParams) ?? {};\n\t\t\tconst filteredQueryParams = Object.fromEntries(Object.entries(normalizedQueryParams).filter(([_, value]) => value !== void 0));\n\t\t\tconst searchParams = new URLSearchParams(filteredQueryParams);\n\t\t\treturn await route.handler(RequestInputContext.fromSSRContext({\n\t\t\t\tmethod: route.method,\n\t\t\t\tpath: route.path,\n\t\t\t\tpathParams: normalizedPathParams,\n\t\t\t\tsearchParams\n\t\t\t}), new RequestOutputContext(route.outputSchema));\n\t\t}\n\t\tasync function executeQuery(params) {\n\t\t\tconst { pathParams, queryParams } = params ?? {};\n\t\t\tif (typeof window === \"undefined\") return task(async () => callServerSideHandler({\n\t\t\t\tpathParams,\n\t\t\t\tqueryParams\n\t\t\t}));\n\t\t\tconst url = buildUrl({\n\t\t\t\tbaseUrl,\n\t\t\t\tmountRoute,\n\t\t\t\tpath: route.path\n\t\t\t}, {\n\t\t\t\tpathParams,\n\t\t\t\tqueryParams\n\t\t\t});\n\t\t\tlet response;\n\t\t\ttry {\n\t\t\t\tresponse = fetcherOptions ? await fetcher(url, fetcherOptions) : await fetcher(url);\n\t\t\t} catch (error) {\n\t\t\t\tthrow FragnoClientFetchError.fromUnknownFetchError(error);\n\t\t\t}\n\t\t\tif (!response.ok) throw await FragnoClientApiError.fromResponse(response);\n\t\t\treturn response;\n\t\t}\n\t\treturn {\n\t\t\troute,\n\t\t\tstore: (args) => {\n\t\t\t\tconst { path, query } = args ?? {};\n\t\t\t\tconst key = getCacheKey(route.method, route.path, {\n\t\t\t\t\tpathParams: path,\n\t\t\t\t\tqueryParams: query\n\t\t\t\t});\n\t\t\t\tconst store = this.#createFetcherStore(key, {\n\t\t\t\t\tfetcher: async () => {\n\t\t\t\t\t\tif (SSR_ENABLED) {\n\t\t\t\t\t\t\tconst initialData = getInitialData(key.map((d) => typeof d === \"string\" ? d : d.get()).join(\"\"));\n\t\t\t\t\t\t\tif (initialData) return initialData;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst response = await executeQuery({\n\t\t\t\t\t\t\tpathParams: path,\n\t\t\t\t\t\t\tqueryParams: query\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst isStreaming = isStreamingResponse(response);\n\t\t\t\t\t\tif (!isStreaming) return response.json();\n\t\t\t\t\t\tif (typeof window === \"undefined\") return [];\n\t\t\t\t\t\tif (isStreaming === \"ndjson\") {\n\t\t\t\t\t\t\tconst { firstItem } = await handleNdjsonStreamingFirstItem(response, {\n\t\t\t\t\t\t\t\tsetData: (value) => {\n\t\t\t\t\t\t\t\t\tstore.set({\n\t\t\t\t\t\t\t\t\t\t...store.get(),\n\t\t\t\t\t\t\t\t\t\tloading: !(Array.isArray(value) && value.length > 0),\n\t\t\t\t\t\t\t\t\t\tdata: value\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tsetError: (value) => {\n\t\t\t\t\t\t\t\t\tstore.set({\n\t\t\t\t\t\t\t\t\t\t...store.get(),\n\t\t\t\t\t\t\t\t\t\terror: value\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn [firstItem];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (isStreaming === \"octet-stream\") throw new Error(\"Octet-stream streaming is not supported.\");\n\t\t\t\t\t\tthrow new Error(\"Unreachable\");\n\t\t\t\t\t},\n\t\t\t\t\tonErrorRetry: options?.onErrorRetry,\n\t\t\t\t\tdedupeTime: Infinity\n\t\t\t\t});\n\t\t\t\tif (typeof window === \"undefined\") addStore(store);\n\t\t\t\treturn store;\n\t\t\t},\n\t\t\tquery: async (args) => {\n\t\t\t\tconst { path, query } = args ?? {};\n\t\t\t\tconst response = await executeQuery({\n\t\t\t\t\tpathParams: path,\n\t\t\t\t\tqueryParams: query\n\t\t\t\t});\n\t\t\t\tconst isStreaming = isStreamingResponse(response);\n\t\t\t\tif (!isStreaming) return await response.json();\n\t\t\t\tif (isStreaming === \"ndjson\") {\n\t\t\t\t\tconst { streamingPromise } = await handleNdjsonStreamingFirstItem(response);\n\t\t\t\t\treturn await streamingPromise;\n\t\t\t\t}\n\t\t\t\tif (isStreaming === \"octet-stream\") throw new Error(\"Octet-stream streaming is not supported.\");\n\t\t\t\tthrow new Error(\"Unreachable\");\n\t\t\t},\n\t\t\t[GET_HOOK_SYMBOL]: true\n\t\t};\n\t}\n\t#createRouteQueryMutator(route, onInvalidate = (invalidate, params) => invalidate(\"GET\", route.path, params)) {\n\t\tconst method = route.method;\n\t\tconst baseUrl = this.#publicConfig.baseUrl ?? \"\";\n\t\tconst mountRoute = getMountRoute(this.#fragmentConfig);\n\t\tconst fetcher = this.#getFetcher();\n\t\tconst fetcherOptions = this.#getFetcherOptions();\n\t\tasync function executeMutateQuery({ body, path, query }) {\n\t\t\tif (typeof window === \"undefined\") return task(async () => route.handler(RequestInputContext.fromSSRContext({\n\t\t\t\tinputSchema: route.inputSchema,\n\t\t\t\tmethod,\n\t\t\t\tpath: route.path,\n\t\t\t\tpathParams: path ?? {},\n\t\t\t\tsearchParams: new URLSearchParams(query),\n\t\t\t\tbody\n\t\t\t}), new RequestOutputContext(route.outputSchema)));\n\t\t\tconst url = buildUrl({\n\t\t\t\tbaseUrl,\n\t\t\t\tmountRoute,\n\t\t\t\tpath: route.path\n\t\t\t}, {\n\t\t\t\tpathParams: path,\n\t\t\t\tqueryParams: query\n\t\t\t});\n\t\t\tlet response;\n\t\t\ttry {\n\t\t\t\tresponse = await fetcher(url, {\n\t\t\t\t\t...fetcherOptions,\n\t\t\t\t\tmethod,\n\t\t\t\t\tbody: body !== void 0 ? JSON.stringify(body) : void 0\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow FragnoClientFetchError.fromUnknownFetchError(error);\n\t\t\t}\n\t\t\tif (!response.ok) throw await FragnoClientApiError.fromResponse(response);\n\t\t\treturn response;\n\t\t}\n\t\tconst mutatorStore = this.#createMutatorStore(async ({ data }) => {\n\t\t\tif (typeof window === \"undefined\") {}\n\t\t\tconst { body, path, query } = data;\n\t\t\tif (typeof body === \"undefined\" && route.inputSchema !== void 0) throw new Error(\"Body is required.\");\n\t\t\tconst response = await executeMutateQuery({\n\t\t\t\tbody,\n\t\t\t\tpath,\n\t\t\t\tquery\n\t\t\t});\n\t\t\tonInvalidate(this.#invalidate.bind(this), {\n\t\t\t\tpathParams: path ?? {},\n\t\t\t\tqueryParams: query\n\t\t\t});\n\t\t\tif (response.status === 201 || response.status === 204) return;\n\t\t\tconst isStreaming = isStreamingResponse(response);\n\t\t\tif (!isStreaming) return response.json();\n\t\t\tif (typeof window === \"undefined\") return [];\n\t\t\tif (isStreaming === \"ndjson\") {\n\t\t\t\tconst { firstItem } = await handleNdjsonStreamingFirstItem(response, {\n\t\t\t\t\tsetData: (value) => {\n\t\t\t\t\t\tmutatorStore.set({\n\t\t\t\t\t\t\t...mutatorStore.get(),\n\t\t\t\t\t\t\tloading: !(Array.isArray(value) && value.length > 0),\n\t\t\t\t\t\t\tdata: value\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tsetError: (value) => {\n\t\t\t\t\t\tmutatorStore.set({\n\t\t\t\t\t\t\t...mutatorStore.get(),\n\t\t\t\t\t\t\terror: value\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn [firstItem];\n\t\t\t}\n\t\t\tif (isStreaming === \"octet-stream\") throw new Error(\"Octet-stream streaming is not supported.\");\n\t\t\tthrow new Error(\"Unreachable\");\n\t\t}, { onError: (error) => {\n\t\t\tconsole.error(\"Error in mutatorStore\", error);\n\t\t} });\n\t\tconst mutateQuery = (async (data) => {\n\t\t\tconst { body, path, query } = data;\n\t\t\tif (typeof body === \"undefined\" && route.inputSchema !== void 0) throw new Error(\"Body is required for mutateQuery\");\n\t\t\tconst response = await executeMutateQuery({\n\t\t\t\tbody,\n\t\t\t\tpath,\n\t\t\t\tquery\n\t\t\t});\n\t\t\tif (response.status === 201 || response.status === 204) return;\n\t\t\tconst isStreaming = isStreamingResponse(response);\n\t\t\tif (!isStreaming) return response.json();\n\t\t\tif (isStreaming === \"ndjson\") {\n\t\t\t\tconst { streamingPromise } = await handleNdjsonStreamingFirstItem(response);\n\t\t\t\treturn await streamingPromise;\n\t\t\t}\n\t\t\tif (isStreaming === \"octet-stream\") throw new Error(\"Octet-stream streaming is not supported for mutations\");\n\t\t\tthrow new Error(\"Unreachable\");\n\t\t});\n\t\treturn {\n\t\t\troute,\n\t\t\tmutateQuery,\n\t\t\tmutatorStore,\n\t\t\t[MUTATOR_HOOK_SYMBOL]: true\n\t\t};\n\t}\n\t#invalidate(method, path, params) {\n\t\tconst prefix = getCacheKey(method, path, {\n\t\t\tpathParams: params?.pathParams,\n\t\t\tqueryParams: params?.queryParams\n\t\t}).map((k) => typeof k === \"string\" ? k : k.get()).join(\"\");\n\t\tthis.#invalidateKeys((key) => key.startsWith(prefix));\n\t}\n};\nfunction createClientBuilder(fragmentBuilder, publicConfig, routesOrFactories, authorFetcherConfig) {\n\tconst definition = fragmentBuilder.definition;\n\tconst routes = resolveRouteFactories({\n\t\tconfig: {},\n\t\tdeps: {},\n\t\tservices: {}\n\t}, routesOrFactories);\n\tconst fragmentConfig = {\n\t\tname: definition.name,\n\t\troutes\n\t};\n\tconst mountRoute = publicConfig.mountRoute ?? `/${definition.name}`;\n\tconst mergedFetcherConfig = mergeFetcherConfigs(authorFetcherConfig, publicConfig.fetcherConfig);\n\treturn new ClientBuilder({\n\t\t...publicConfig,\n\t\tmountRoute,\n\t\tfetcherConfig: mergedFetcherConfig\n\t}, fragmentConfig);\n}\n\n//#endregion\nexport { isGetHook as a, isReadableAtom as c, FragnoClientFetchAbortError as d, FragnoClientFetchError as f, getCacheKey as i, FragnoClientApiError as l, FragnoClientUnknownApiError as m, buildUrl as n, isMutatorHook as o, FragnoClientFetchNetworkError as p, createClientBuilder as r, isStore as s, ClientBuilder as t, FragnoClientError as u };\n//# sourceMappingURL=client-DAFHcKqA.js.map","import { defineRoute, defineRoutes } from \"@fragno-dev/core\";\nimport { z } from \"zod\";\nimport Stripe from \"stripe\";\nimport type { StripeFragmentConfig, StripeFragmentDeps, StripeFragmentServices } from \"../types\";\nimport { eventToHandler, type SupportedStripeEvent } from \"../webhook/handlers\";\n\nexport const webhookRoutesFactory = defineRoutes<\n StripeFragmentConfig,\n StripeFragmentDeps,\n StripeFragmentServices\n>().create(({ config, deps, services }) => {\n return [\n defineRoute({\n method: \"POST\",\n path: \"/webhook\",\n outputSchema: z.object({\n success: z.boolean(),\n }),\n errorCodes: [\"MISSING_SIGNATURE\", \"WEBHOOK_SIGNATURE_INVALID\", \"WEBHOOK_ERROR\"] as const,\n handler: async ({ headers, rawBody }, { json, error }) => {\n // Get the signature\n const signature = headers.get(\"stripe-signature\");\n\n if (!signature) {\n return error(\n { message: \"Missing stripe-signature header\", code: \"MISSING_SIGNATURE\" },\n 400,\n );\n }\n\n if (!rawBody) {\n return error(\n { message: \"Missing request body for webhook verification\", code: \"WEBHOOK_ERROR\" },\n 400,\n );\n }\n\n // Verify the webhook signature\n let event: Stripe.Event;\n try {\n // Support both Stripe v18 (constructEvent) and v19+ (constructEventAsync)\n if (typeof deps.stripe.webhooks.constructEventAsync === \"function\") {\n // Stripe v19+ - use async method\n event = await deps.stripe.webhooks.constructEventAsync(\n rawBody,\n signature,\n config.webhookSecret,\n );\n } else {\n // Stripe v18 - use sync method\n event = deps.stripe.webhooks.constructEvent(rawBody, signature, config.webhookSecret);\n }\n } catch (err) {\n if (err instanceof Stripe.errors.StripeSignatureVerificationError) {\n return error(\n {\n message: `Webhook signature verification failed`,\n code: \"WEBHOOK_SIGNATURE_INVALID\",\n },\n 400,\n );\n }\n throw err;\n }\n\n if (!event) {\n return error({ message: \"Failed to construct event\", code: \"WEBHOOK_ERROR\" }, 400);\n }\n\n if (config.onEvent) {\n deps.log.info(\"Running user callback event\");\n await config.onEvent({ event, stripeClient: deps.stripe });\n }\n\n const eventHandler = eventToHandler[event.type as SupportedStripeEvent];\n if (!eventHandler) {\n deps.log.info(`Webhook event ${event.type}: ${event.id} ignored`);\n return json({ success: true });\n }\n\n deps.log.info(`Executing event handler for ${event.type}: ${event.id}`);\n await eventHandler({ event, services, deps, config });\n\n return json({ success: true });\n },\n }),\n ];\n});\n","import { z } from \"zod\";\n\nexport const CustomerResponseSchema = z.object({\n id: z.string(),\n object: z.literal(\"customer\"),\n balance: z.number(),\n business_name: z.string().optional(),\n created: z.number(),\n currency: z.string().nullable().optional(),\n deleted: z.void().optional(),\n delinquent: z.boolean().nullable().optional(),\n description: z.string().nullable(),\n email: z.string().nullable(),\n individual_name: z.string().optional(),\n invoice_credit_balance: z.record(z.string(), z.number()).optional(),\n invoice_prefix: z.string().nullable().optional(),\n livemode: z.boolean(),\n metadata: z.record(z.string(), z.string()),\n name: z.string().nullable().optional(),\n next_invoice_sequence: z.number().optional(),\n phone: z.string().nullable().optional(),\n preferred_locales: z.array(z.string()).nullable().optional(),\n});\n\nexport type CustomerResponseSchema = z.infer<typeof CustomerResponseSchema>;\n","import { defineRoute, defineRoutes } from \"@fragno-dev/core\";\nimport { z } from \"zod\";\nimport type { StripeFragmentConfig, StripeFragmentDeps, StripeFragmentServices } from \"../types\";\nimport { CustomerResponseSchema } from \"../models/customers\";\n\nexport const customersRoutesFactory = defineRoutes<\n StripeFragmentConfig,\n StripeFragmentDeps,\n StripeFragmentServices\n>().create(({ deps, config }) => {\n return [\n defineRoute({\n method: \"GET\",\n path: \"/admin/customers\",\n inputSchema: z.object({\n limit: z\n .number()\n .int()\n .positive()\n .max(100)\n .optional()\n .default(50)\n .describe(\"Number of customers to return (max 100)\"),\n startingAfter: z.string().optional().describe(\"Customer ID to start after for pagination\"),\n }),\n outputSchema: z.object({\n customers: z.array(CustomerResponseSchema),\n hasMore: z.boolean().describe(\"Whether there are more customers to fetch\"),\n }),\n handler: async ({ query }, { json, error }) => {\n if (!config.enableAdminRoutes) {\n return error({ message: \"Unauthorized\", code: \"UNAUTHORIZED\" }, 401);\n }\n\n const limit = Number(query.get(\"limit\")) || undefined;\n const startingAfter = query.get(\"startingAfter\") || undefined;\n\n const customers = await deps.stripe.customers.list({\n limit,\n starting_after: startingAfter,\n });\n return json({\n customers: customers.data,\n hasMore: customers.has_more,\n });\n },\n }),\n ];\n});\n","import { z } from \"zod\";\n\nexport const SubscriptionReponseSchema = z.object({\n id: z.string(),\n stripeSubscriptionId: z.string(),\n stripeCustomerId: z.string(),\n stripePriceId: z.string(),\n referenceId: z.string().nullable(),\n status: z.enum([\n \"active\",\n \"canceled\",\n \"incomplete\",\n \"incomplete_expired\",\n \"past_due\",\n \"paused\",\n \"trialing\",\n \"unpaid\",\n ]),\n periodStart: z.date().nullable(),\n periodEnd: z.date().nullable(),\n trialStart: z.date().nullable(),\n trialEnd: z.date().nullable(),\n cancelAtPeriodEnd: z.boolean().nullable(),\n cancelAt: z.date().nullable(),\n seats: z.number().nullable(),\n createdAt: z.date(),\n updatedAt: z.date(),\n});\n\nexport const SubscriptionUpgradeRequestSchema = z.object({\n priceId: z.string().describe(\"Stripe price ID to subscribe/upgrade to\"),\n quantity: z.number().positive().describe(\"Number of seats\"),\n successUrl: z.url().describe(\"Redirect URL after successful checkout\"),\n cancelUrl: z.url().describe(\"Redirect URL if checkout is cancelled\"),\n returnUrl: z.string().optional().describe(\"Return URL for billing portal\"),\n});\n\nexport type SubscriptionResponse = z.infer<typeof SubscriptionReponseSchema>;\n","import { defineRoute, defineRoutes } from \"@fragno-dev/core\";\nimport { z } from \"zod\";\nimport type { StripeFragmentConfig, StripeFragmentDeps, StripeFragmentServices } from \"../types\";\nimport {\n SubscriptionReponseSchema,\n SubscriptionUpgradeRequestSchema,\n type SubscriptionResponse,\n} from \"../models/subscriptions\";\nimport { stripeToApiError } from \"./errors\";\n\nexport const subscriptionsRoutesFactory = defineRoutes<\n StripeFragmentConfig,\n StripeFragmentDeps,\n StripeFragmentServices\n>().create(({ deps, services, config }) => {\n return [\n defineRoute({\n method: \"GET\",\n path: \"/admin/subscriptions\",\n outputSchema: z.object({\n subscriptions: z.array(SubscriptionReponseSchema),\n }),\n handler: async (_, { json, error }) => {\n if (!config.enableAdminRoutes) {\n return error({ message: \"Unauthorized\", code: \"UNAUTHORIZED\" }, 401);\n }\n\n // TODO: Implement pagination\n return json({\n subscriptions: await services.getAllSubscriptions(),\n });\n },\n }),\n defineRoute({\n method: \"POST\",\n path: \"/subscription/upgrade\",\n inputSchema: SubscriptionUpgradeRequestSchema,\n outputSchema: z.object({\n url: z.string(),\n redirect: z.boolean(),\n sessionId: z.string().optional(),\n }),\n errorCodes: [\n \"MISSING_CUSTOMER_INFO\",\n \"SUBSCRIPTION_NOT_FOUND\",\n \"CUSTOMER_SUBSCRIPTION_MISMATCH\",\n \"UPGRADE_HAS_NO_EFFECT\",\n \"SUBSCRIPTION_UPDATE_NOT_ALLOWED\",\n ] as const,\n handler: async (context, { json, error }) => {\n const body = await context.input.valid();\n const user = await config.resolveEntityFromRequest(context);\n\n let customerId: string | undefined = user.stripeCustomerId;\n let existingSubscription: SubscriptionResponse | null = null;\n\n // Step 1: Check if upgrading or creating subscription\n if (user.subscriptionId) {\n existingSubscription = await services.getSubscriptionById(user.subscriptionId);\n\n if (!existingSubscription) {\n return error(\n {\n message: \"Could not retrieve existing subscription\",\n code: \"SUBSCRIPTION_NOT_FOUND\",\n },\n 404,\n );\n }\n\n if (\n customerId &&\n existingSubscription.stripeCustomerId &&\n existingSubscription.stripeCustomerId !== customerId\n ) {\n return error(\n {\n message:\n \"Subsciption being updated does not belong to Stripe Customer that was provided\",\n code: \"CUSTOMER_SUBSCRIPTION_MISMATCH\",\n },\n 422,\n );\n }\n\n customerId = existingSubscription.stripeCustomerId;\n }\n\n // Step 2: Get or Create customer if not found\n if (!customerId) {\n const existingLinkedCustomer = await deps.stripe.customers.search({\n query: `metadata['referenceId']:'${user.referenceId}'`,\n limit: 1,\n });\n\n if (existingLinkedCustomer.data.length === 1) {\n // Use existing customer\n customerId = existingLinkedCustomer.data[0].id;\n } else {\n // Create new Stripe Customer\n\n // Check if sufficient data is provided for this scenario\n if (!user.customerEmail || !user.referenceId) {\n return error({\n message:\n \"New Stripe Customer must be created, but customerEmail or referenceID has not been provide\",\n code: \"MISSING_CUSTOMER_INFO\",\n });\n }\n\n const newCustomer = await deps.stripe.customers.create({\n email: user.customerEmail,\n metadata: {\n referenceId: user.referenceId,\n ...user.stripeMetadata,\n },\n });\n customerId = newCustomer.id;\n }\n\n // Communicate back to the user that a customer has been created/linked\n try {\n await config.onStripeCustomerCreated(customerId, user.referenceId);\n } catch (error) {\n deps.log.error(\"onStripeCustomerCreated failed!\", error);\n }\n }\n\n // Step 4: If existing subscription is active, modify using billing portal\n if (\n existingSubscription?.status === \"active\" ||\n existingSubscription?.status === \"trialing\"\n ) {\n const stripeSubscription = await deps.stripe.subscriptions.retrieve(\n existingSubscription.stripeSubscriptionId,\n );\n\n try {\n const portalSession = await deps.stripe.billingPortal.sessions.create({\n customer: customerId,\n return_url: body.returnUrl || body.successUrl,\n flow_data: {\n type: \"subscription_update_confirm\",\n after_completion: {\n type: \"redirect\",\n redirect: {\n return_url: body.returnUrl || body.successUrl,\n },\n },\n subscription_update_confirm: {\n subscription: existingSubscription.stripeSubscriptionId,\n items: [\n {\n // We always create subscriptions with a single item\n id: stripeSubscription.items.data[0]?.id as string,\n quantity: body.quantity,\n price: body.priceId,\n },\n ],\n },\n },\n });\n return json({\n url: portalSession.url,\n redirect: true,\n });\n } catch (error: unknown) {\n throw stripeToApiError(error);\n }\n }\n\n // Step 5: Create a Subscription\n const checkoutSession = await deps.stripe.checkout.sessions.create({\n customer: customerId,\n success_url: body.successUrl,\n cancel_url: body.cancelUrl,\n line_items: [\n {\n price: body.priceId,\n quantity: body.quantity,\n },\n ],\n mode: \"subscription\",\n metadata: {\n referenceId: user.referenceId,\n },\n });\n\n return json({\n url: checkoutSession.url!,\n redirect: true,\n sessionId: checkoutSession.id,\n });\n },\n }),\n defineRoute({\n method: \"POST\",\n path: \"/subscription/cancel\",\n inputSchema: z.object({\n returnUrl: z.url().describe(\"URL to redirect to after cancellation is complete\"),\n }),\n outputSchema: z.object({\n url: z.url().describe(\"URL to redirect to after cancellation\"),\n redirect: z.boolean().describe(\"Whether to redirect to the URL\"),\n }),\n errorCodes: [\n \"SUBSCRIPTION_NOT_FOUND\",\n \"NO_SUBSCRIPTION_TO_CANCEL\",\n \"SUBSCRIPTION_ALREADY_CANCELED\",\n ] as const,\n handler: async (context, { json, error }) => {\n const body = await context.input.valid();\n const { subscriptionId } = await config.resolveEntityFromRequest(context);\n\n if (!subscriptionId) {\n return error(\n { message: \"No subscription to cancel\", code: \"NO_SUBSCRIPTION_TO_CANCEL\" },\n 404,\n );\n }\n\n // Get the subscription from our database\n const subscription = await services.getSubscriptionById(subscriptionId);\n\n if (!subscription) {\n return error(\n {\n message: \"Subscription not found\",\n code: \"SUBSCRIPTION_NOT_FOUND\",\n },\n 404,\n );\n }\n\n // Check if already canceled\n if (subscription.status === \"canceled\") {\n return error(\n {\n message: \"Subscription is already canceled\",\n code: \"SUBSCRIPTION_ALREADY_CANCELED\",\n },\n 400,\n );\n }\n\n try {\n // Get active subscriptions from Stripe for this customer\n const activeSubscriptions = await deps.stripe.subscriptions.list({\n customer: subscription.stripeCustomerId,\n status: \"active\",\n });\n\n // Find the specific subscription in Stripe\n const stripeSubscription = activeSubscriptions.data.find(\n (sub) => sub.id === subscription.stripeSubscriptionId,\n );\n\n if (!stripeSubscription) {\n return error(\n {\n message: \"Active subscription not found in Stripe\",\n code: \"SUBSCRIPTION_NOT_FOUND\",\n },\n 404,\n );\n }\n\n // Check if subscription is already set to cancel at period end\n if (stripeSubscription.cancel_at_period_end) {\n // Already scheduled for cancellation, just return success\n // Optionally update our database to reflect this state\n return json({\n url: \"\", // No redirect needed\n redirect: false,\n });\n }\n\n // Create billing portal session for cancellation\n const portalSession = await deps.stripe.billingPortal.sessions.create({\n customer: subscription.stripeCustomerId!,\n return_url: body.returnUrl,\n flow_data: {\n type: \"subscription_cancel\",\n subscription_cancel: {\n subscription: stripeSubscription.id,\n },\n after_completion: {\n type: \"redirect\",\n redirect: {\n return_url: body.returnUrl,\n },\n },\n },\n });\n\n return json({\n url: portalSession.url,\n redirect: true,\n });\n } catch (err: unknown) {\n throw stripeToApiError(err);\n }\n },\n }),\n ];\n});\n","import { z } from \"zod\";\n\nexport const ProductResponseSchema = z.object({\n id: z.string(),\n object: z.literal(\"product\"),\n active: z.boolean(),\n created: z.number(),\n default_price: z.union([z.string(), z.any()]).nullable().optional(),\n deleted: z.void().optional(),\n description: z.string().nullable(),\n images: z.array(z.string()),\n livemode: z.boolean(),\n marketing_features: z.array(z.any()),\n metadata: z.any(),\n name: z.string(),\n package_dimensions: z.any().nullable(),\n shippable: z.boolean().nullable(),\n statement_descriptor: z.string().nullable().optional(),\n tax_code: z.union([z.string(), z.any()]).nullable(),\n type: z.string(),\n unit_label: z.string().nullable().optional(),\n updated: z.number(),\n url: z.string().nullable(),\n});\n\nexport type ProductResponseSchema = z.infer<typeof ProductResponseSchema>;\n","import { defineRoute, defineRoutes } from \"@fragno-dev/core\";\nimport { z } from \"zod\";\nimport type { StripeFragmentConfig, StripeFragmentDeps, StripeFragmentServices } from \"../types\";\nimport { ProductResponseSchema } from \"../models/products\";\n\nexport const productsRoutesFactory = defineRoutes<\n StripeFragmentConfig,\n StripeFragmentDeps,\n StripeFragmentServices\n>().create(({ deps, config }) => {\n return [\n defineRoute({\n method: \"GET\",\n path: \"/admin/products\",\n inputSchema: z.object({\n limit: z\n .number()\n .int()\n .positive()\n .max(100)\n .optional()\n .default(50)\n .describe(\"Number of products to return (max 100)\"),\n startingAfter: z.string().optional().describe(\"Product ID to start after for pagination\"),\n }),\n outputSchema: z.object({\n products: z.array(ProductResponseSchema),\n hasMore: z.boolean().describe(\"Whether there are more items to fetch\"),\n }),\n handler: async ({ query }, { json, error }) => {\n if (!config.enableAdminRoutes) {\n return error({ message: \"Unauthorized\", code: \"UNAUTHORIZED\" }, 401);\n }\n\n const limit = Number(query.get(\"limit\")) || undefined;\n const startingAfter = query.get(\"startingAfter\") || undefined;\n\n const products = await deps.stripe.products.list({\n limit,\n starting_after: startingAfter,\n });\n\n return json({\n products: products.data,\n hasMore: products.has_more,\n });\n },\n }),\n ];\n});\n","import { z } from \"zod\";\n\nexport const PriceResponseSchema = z.object({\n id: z.string(),\n object: z.literal(\"price\"),\n active: z.boolean(),\n billing_scheme: z.string(),\n created: z.number(),\n currency: z.string(),\n custom_unit_amount: z.any().nullable().optional(),\n deleted: z.void().optional(),\n livemode: z.boolean(),\n lookup_key: z.string().nullable().optional(),\n metadata: z.any(),\n nickname: z.string().nullable().optional(),\n product: z.union([z.string(), z.any()]),\n recurring: z\n .object({\n aggregate_usage: z.string().nullable().optional(),\n interval: z.enum([\"day\", \"week\", \"month\", \"year\"]),\n interval_count: z.number(),\n meter: z.string().nullable().optional(),\n trial_period_days: z.number().nullable().optional(),\n usage_type: z.string(),\n })\n .nullable()\n .optional(),\n tax_behavior: z.string().nullable().optional(),\n tiers_mode: z.string().nullable().optional(),\n transform_quantity: z.any().nullable().optional(),\n type: z.enum([\"one_time\", \"recurring\"]),\n unit_amount: z.number().nullable().optional(),\n unit_amount_decimal: z.string().nullable().optional(),\n});\n\nexport type PriceResponseSchema = z.infer<typeof PriceResponseSchema>;\n","import { defineRoute, defineRoutes } from \"@fragno-dev/core\";\nimport { z } from \"zod\";\nimport type { StripeFragmentConfig, StripeFragmentDeps, StripeFragmentServices } from \"../types\";\nimport { PriceResponseSchema } from \"../models/prices\";\n\nexport const pricesRoutesFactory = defineRoutes<\n StripeFragmentConfig,\n StripeFragmentDeps,\n StripeFragmentServices\n>().create(({ deps, config }) => {\n return [\n defineRoute({\n method: \"GET\",\n path: \"/admin/products/:productId/prices\",\n inputSchema: z.object({\n limit: z\n .number()\n .int()\n .positive()\n .max(100)\n .optional()\n .default(50)\n .describe(\"Number of prices to return (max 100)\"),\n startingAfter: z.string().optional().describe(\"Price ID to start after for pagination\"),\n }),\n outputSchema: z.object({\n prices: z.array(PriceResponseSchema),\n hasMore: z.boolean().describe(\"Whether there are more items to fetch\"),\n }),\n handler: async ({ pathParams, query }, { json, error }) => {\n if (!config.enableAdminRoutes) {\n return error({ message: \"Unauthorized\", code: \"UNAUTHORIZED\" }, 401);\n }\n\n const { productId } = pathParams;\n const limit = Number(query.get(\"limit\")) || undefined;\n const startingAfter = query.get(\"startingAfter\") || undefined;\n\n const prices = await deps.stripe.prices.list({\n product: productId,\n limit,\n starting_after: startingAfter,\n });\n\n return json({\n prices: prices.data,\n hasMore: prices.has_more,\n });\n },\n }),\n ];\n});\n","import { createFragment, type FragnoPublicClientConfig } from \"@fragno-dev/core\";\nimport { createClientBuilder } from \"@fragno-dev/core/client\";\nimport type { AbstractQuery, TableToInsertValues } from \"@fragno-dev/db/query\";\n\nimport {\n defineFragmentWithDatabase,\n type FragnoPublicConfigWithDatabase,\n} from \"@fragno-dev/db/fragment\";\n\nimport Stripe from \"stripe\";\nimport type {\n Logger,\n StripeFragmentConfig,\n StripeFragmentDeps,\n StripeFragmentServices,\n} from \"./types\";\nimport { stripeSchema } from \"./database/schema\";\nimport { webhookRoutesFactory } from \"./routes/webhooks\";\nimport { customersRoutesFactory } from \"./routes/customers\";\nimport { subscriptionsRoutesFactory } from \"./routes/subscriptions\";\nimport { productsRoutesFactory } from \"./routes/products\";\nimport { pricesRoutesFactory } from \"./routes/prices\";\nimport { stripeSubscriptionToInternalSubscription } from \"./utils\";\n\nconst LOG_PREFIX = \"[Stripe Fragment]\";\nconst defaultLogger: Logger = {\n info: (...data) => console.info(LOG_PREFIX, ...data),\n error: (...data) => console.error(LOG_PREFIX, ...data),\n warn: (...data) => console.warn(LOG_PREFIX, ...data),\n debug: (...data) => console.debug(LOG_PREFIX, ...data),\n log: (...data) => console.log(LOG_PREFIX, ...data),\n};\n\nexport const stripeFragmentDefinition = defineFragmentWithDatabase<StripeFragmentConfig>(\"stripe\")\n .withDatabase(stripeSchema, \"stripe\")\n .withDependencies(({ config }): StripeFragmentDeps => {\n const stripeClient = new Stripe(config.stripeSecretKey, config.stripeClientOptions ?? {});\n\n return {\n stripe: stripeClient,\n log: config.logger ? config.logger : defaultLogger,\n };\n })\n .providesService(({ deps, db, defineService }) => {\n return defineService({\n ...createStripeServices(deps, db),\n });\n });\n\nfunction createStripeServices(\n deps: StripeFragmentDeps,\n db: AbstractQuery<typeof stripeSchema>,\n): StripeFragmentServices {\n const services: StripeFragmentServices = {\n getStripeClient(): Stripe {\n return deps.stripe;\n },\n createSubscription: async (\n data: Omit<\n TableToInsertValues<typeof stripeSchema.tables.subscription>,\n \"id\" | \"createdAt\" | \"updatedAt\"\n >,\n ) => {\n return (await db.create(\"subscription\", data)).externalId;\n },\n updateSubscription: async (\n id: string,\n data: Partial<Omit<TableToInsertValues<typeof stripeSchema.tables.subscription>, \"id\">>,\n ) => {\n await db.update(\"subscription\", id, (b) => b.set({ ...data, updatedAt: new Date() }));\n },\n\n getSubscriptionByStripeId: async (stripeSubscriptionId: string) => {\n const result = await db.findFirst(\"subscription\", (b) =>\n b.whereIndex(\"idx_stripe_subscription_id\", (eb) =>\n eb(\"stripeSubscriptionId\", \"=\", stripeSubscriptionId),\n ),\n );\n if (!result) {\n return null;\n }\n\n return {\n ...result,\n id: result.id.externalId,\n status: result.status as Stripe.Subscription.Status,\n };\n },\n getSubscriptionByStripeCustomerId: async (stripeCustomerId: string) => {\n return (\n await db.find(\"subscription\", (b) =>\n b.whereIndex(\"idx_stripe_customer_id\", (eb) =>\n eb(\"stripeCustomerId\", \"=\", stripeCustomerId),\n ),\n )\n ).map((subscription) => ({\n ...subscription,\n id: subscription.id.externalId,\n status: subscription.status as Stripe.Subscription.Status,\n }));\n },\n getSubscriptionById: async (id: string) => {\n const result = await db.findFirst(\"subscription\", (b) =>\n b.whereIndex(\"primary\", (eb) => eb(\"id\", \"=\", id)),\n );\n if (!result) {\n return null;\n }\n return {\n ...result,\n id: result.id.externalId,\n status: result.status as Stripe.Subscription.Status,\n };\n },\n getSubscriptionByReferenceId: async (referenceId: string) => {\n const result = await db.findFirst(\"subscription\", (b) =>\n b.whereIndex(\"idx_reference_id\", (eb) => eb(\"referenceId\", \"=\", referenceId)),\n );\n if (!result) {\n return null;\n }\n return {\n ...result,\n id: result.id.externalId,\n status: result.status as Stripe.Subscription.Status,\n };\n },\n\n deleteSubscription: async (id: string) => {\n await db.delete(\"subscription\", id);\n },\n\n deleteSubscriptionByReferenceId: async (referenceId: string) => {\n const uow = db\n .createUnitOfWork()\n .find(\"subscription\", (b) =>\n b.whereIndex(\"idx_reference_id\", (eb) => eb(\"referenceId\", \"=\", referenceId)),\n );\n\n const [subscriptions] = await uow.executeRetrieve();\n const subscription = subscriptions[0];\n\n if (subscription) {\n uow.delete(\"subscription\", subscription.id);\n\n const success = await uow.executeMutations();\n if (!success) {\n throw new Error(\"Failed to deleted subscription, conflict on subscription resource\");\n }\n return true;\n }\n return false;\n },\n\n getAllSubscriptions: async () => {\n return (await db.find(\"subscription\", (b) => b.whereIndex(\"primary\"))).map(\n (subscription) => ({\n ...subscription,\n id: subscription.id.externalId,\n status: subscription.status as Stripe.Subscription.Status,\n }),\n );\n },\n\n /* Retrieve Stripe Subscription and create/update/delete internal entity */\n syncStripeSubscription: async (referenceId: string, stripeCustomerId: string) => {\n const stripeSubscriptions = await deps.stripe.subscriptions.list({\n customer: stripeCustomerId,\n limit: 1,\n status: \"all\",\n });\n\n if (stripeSubscriptions.data.length === 0) {\n // No active subscriptions for this customer\n await services.deleteSubscriptionByReferenceId(referenceId);\n return;\n }\n\n const stripeSubscription = stripeSubscriptions.data[0];\n\n const existingSubscription = await db.findFirst(\"subscription\", (b) =>\n b.whereIndex(\"idx_stripe_subscription_id\", (eb) =>\n eb(\"stripeSubscriptionId\", \"=\", stripeSubscription.id),\n ),\n );\n if (existingSubscription) {\n await db.update(\"subscription\", existingSubscription.id, (b) =>\n b.set({\n ...stripeSubscriptionToInternalSubscription(stripeSubscription),\n updatedAt: new Date(),\n }),\n );\n } else {\n const subscriptionData = {\n ...stripeSubscriptionToInternalSubscription(stripeSubscription),\n referenceId: referenceId ?? null,\n };\n await services.createSubscription(subscriptionData);\n }\n return;\n },\n };\n return services;\n}\n\nexport function createStripeFragment(\n config: StripeFragmentConfig,\n fragnoConfig: FragnoPublicConfigWithDatabase,\n) {\n return createFragment(\n stripeFragmentDefinition,\n config,\n [\n webhookRoutesFactory,\n customersRoutesFactory,\n subscriptionsRoutesFactory,\n productsRoutesFactory,\n pricesRoutesFactory,\n ],\n fragnoConfig,\n );\n}\n\nexport function createStripeFragmentClients(fragnoConfig: FragnoPublicClientConfig = {}) {\n const builder = createClientBuilder(stripeFragmentDefinition, fragnoConfig, [\n webhookRoutesFactory,\n customersRoutesFactory,\n subscriptionsRoutesFactory,\n productsRoutesFactory,\n pricesRoutesFactory,\n ]);\n\n return {\n // These hooks are for building internal administrative interfaces\n useCustomers: builder.createHook(\"/admin/customers\"),\n useProducts: builder.createHook(\"/admin/products\"),\n usePrices: builder.createHook(\"/admin/products/:productId/prices\"),\n useSubscription: builder.createHook(\"/admin/subscriptions\"),\n // These clients are for end-users to create/update/cancel their subscriptions\n upgradeSubscription: builder.createMutator(\"POST\", \"/subscription/upgrade\"),\n cancelSubscription: builder.createMutator(\"POST\", \"/subscription/cancel\"),\n };\n}\n\nexport type { StripeFragmentConfig, StripeFragmentDeps, StripeFragmentServices } from \"./types\";\nexport type { FragnoRouteConfig } from \"@fragno-dev/core/api\";\n"],"x_google_ignoreList":[2,3,4,5,6,7,9,10],"mappings":";;;;;AACA,SAASA,sBAAsBC,SAASC,mBAAmB;CAC1D,MAAMC,SAAS,CAAE;AACjB,MAAK,MAAMC,QAAQF,kBAAmB,YAAWE,SAAS,YAAY;EACrE,MAAMC,gBAAgBD,KAAKH,QAAQ;AACnCE,SAAOG,KAAK,GAAGD,cAAc;CAC7B,MAAMF,QAAOG,KAAKF,KAAK;AACxB,QAAOD;AACR;;;;ACJA,IAAImB,iBAAiB,cAAcC,MAAM;CACxC;CACA;CACAG,YAAY,EAAEC,SAASF,MAAM,EAAED,QAAQ;AACtC,QAAMG,QAAQ;AACd,OAAKC,OAAO;AACZ,OAAK,UAAUJ;AACf,OAAK,QAAQC;CACd;CACA,IAAID,SAAS;AACZ,SAAO,KAAK;CACb;CACA,IAAIC,OAAO;AACV,SAAO,KAAK;CACb;CACAI,aAAa;AACZ,SAAOC,SAASC,KAAK;GACpBJ,SAAS,KAAKA;GACdF,MAAM,KAAKA;EACX,GAAE,EAAED,QAAQ,KAAKA,OAAQ,EAAC;CAC5B;AACA;AACD,IAAIQ,2BAA2B,cAAcV,eAAe;CAC3D;CACAI,YAAYC,SAASM,QAAQ;AAC5B,QAAM;GACLN;GACAF,MAAM;EACN,GAAE,IAA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