token-usage-dashboard 1.0.6

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.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/bin/ai-usage-dashboard.js +92 -0
  4. package/build/client/_app/immutable/assets/0.fjR0gTLF.css +1 -0
  5. package/build/client/_app/immutable/assets/0.fjR0gTLF.css.br +0 -0
  6. package/build/client/_app/immutable/assets/0.fjR0gTLF.css.gz +0 -0
  7. package/build/client/_app/immutable/assets/2.BABRsmGA.css +1 -0
  8. package/build/client/_app/immutable/assets/2.BABRsmGA.css.br +0 -0
  9. package/build/client/_app/immutable/assets/2.BABRsmGA.css.gz +0 -0
  10. package/build/client/_app/immutable/chunks/Bjy-W4x2.js +81 -0
  11. package/build/client/_app/immutable/chunks/Bjy-W4x2.js.br +0 -0
  12. package/build/client/_app/immutable/chunks/Bjy-W4x2.js.gz +0 -0
  13. package/build/client/_app/immutable/chunks/DC6tN2WI.js +3 -0
  14. package/build/client/_app/immutable/chunks/DC6tN2WI.js.br +0 -0
  15. package/build/client/_app/immutable/chunks/DC6tN2WI.js.gz +0 -0
  16. package/build/client/_app/immutable/chunks/DRLSLo2t.js +2 -0
  17. package/build/client/_app/immutable/chunks/DRLSLo2t.js.br +0 -0
  18. package/build/client/_app/immutable/chunks/DRLSLo2t.js.gz +0 -0
  19. package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
  20. package/build/client/_app/immutable/chunks/xihTtKlq.js.br +1 -0
  21. package/build/client/_app/immutable/chunks/xihTtKlq.js.gz +0 -0
  22. package/build/client/_app/immutable/entry/app.C7Gg5PnI.js +2 -0
  23. package/build/client/_app/immutable/entry/app.C7Gg5PnI.js.br +0 -0
  24. package/build/client/_app/immutable/entry/app.C7Gg5PnI.js.gz +0 -0
  25. package/build/client/_app/immutable/entry/start.fbJ-_JRS.js +1 -0
  26. package/build/client/_app/immutable/entry/start.fbJ-_JRS.js.br +0 -0
  27. package/build/client/_app/immutable/entry/start.fbJ-_JRS.js.gz +0 -0
  28. package/build/client/_app/immutable/nodes/0.BNwlucmP.js +1 -0
  29. package/build/client/_app/immutable/nodes/0.BNwlucmP.js.br +0 -0
  30. package/build/client/_app/immutable/nodes/0.BNwlucmP.js.gz +0 -0
  31. package/build/client/_app/immutable/nodes/1.Dj3Fzim2.js +1 -0
  32. package/build/client/_app/immutable/nodes/1.Dj3Fzim2.js.br +0 -0
  33. package/build/client/_app/immutable/nodes/1.Dj3Fzim2.js.gz +0 -0
  34. package/build/client/_app/immutable/nodes/2.Csi9nKxw.js +2 -0
  35. package/build/client/_app/immutable/nodes/2.Csi9nKxw.js.br +0 -0
  36. package/build/client/_app/immutable/nodes/2.Csi9nKxw.js.gz +0 -0
  37. package/build/client/_app/version.json +1 -0
  38. package/build/client/_app/version.json.br +0 -0
  39. package/build/client/_app/version.json.gz +0 -0
  40. package/build/client/favicon.svg +1 -0
  41. package/build/client/favicon.svg.br +0 -0
  42. package/build/client/favicon.svg.gz +0 -0
  43. package/build/client/robots.txt +2 -0
  44. package/build/client/robots.txt.br +3 -0
  45. package/build/client/robots.txt.gz +0 -0
  46. package/build/env.js +70 -0
  47. package/build/handler.js +22 -0
  48. package/build/index.js +145 -0
  49. package/build/server/chunks/chunks/client.js-C1_n_a2s.js +28 -0
  50. package/build/server/chunks/chunks/env.js-l0sNRNKZ.js +2 -0
  51. package/build/server/chunks/chunks/exports.js-Dd48p7Ih.js +263 -0
  52. package/build/server/chunks/chunks/internal.js-b-1wrnfA.js +1201 -0
  53. package/build/server/chunks/chunks/internal2.js-BlXt2rfE.js +22 -0
  54. package/build/server/chunks/chunks/queries.js-aTxz7ubg.js +676 -0
  55. package/build/server/chunks/chunks/range.js-CLYFtcRE.js +117 -0
  56. package/build/server/chunks/chunks/refresh.js-DM1hnB2Y.js +107 -0
  57. package/build/server/chunks/chunks/request.js-B3j1_Icg.js +20 -0
  58. package/build/server/chunks/chunks/server.js-mTMwhapa.js +5374 -0
  59. package/build/server/chunks/chunks/shared.js-7DyfRqo3.js +255 -0
  60. package/build/server/chunks/chunks/utils.js-DzwqnkBT.js +1049 -0
  61. package/build/server/chunks/entries/endpoints/api/refresh/_server.ts.js-CJa6pKKD.js +21 -0
  62. package/build/server/chunks/entries/endpoints/api/settings/_server.ts.js-DQt7Bc2q.js +24 -0
  63. package/build/server/chunks/entries/endpoints/api/usage/_server.ts.js-kInjrhtE.js +17 -0
  64. package/build/server/chunks/entries/fallbacks/error.svelte.js-CVKDebWa.js +68 -0
  65. package/build/server/chunks/entries/hooks.server.js-BbojNy1X.js +16 -0
  66. package/build/server/chunks/entries/pages/_layout.svelte.js-C9kkUOBf.js +9 -0
  67. package/build/server/chunks/entries/pages/_page.server.ts.js-Oa3Sfml2.js +17 -0
  68. package/build/server/chunks/entries/pages/_page.svelte.js-D91hy9R4.js +1255 -0
  69. package/build/server/chunks/handler-br42Ds2q.js +1475 -0
  70. package/build/server/chunks/index.js-CBAFVV7O.js +3972 -0
  71. package/build/server/chunks/manifest.js-s70ajt69.js +63 -0
  72. package/build/server/chunks/nodes/0.js-Bzngkdxl.js +9 -0
  73. package/build/server/chunks/nodes/1.js-Cvu2_eGw.js +9 -0
  74. package/build/server/chunks/nodes/2.js-7xvomkGu.js +20 -0
  75. package/build/shims.js +33 -0
  76. package/package.json +64 -0
@@ -0,0 +1,263 @@
1
+ var internal = new URL("sveltekit-internal://");
2
+ /**
3
+ * @param {string} base
4
+ * @param {string} path
5
+ */
6
+ function resolve(base, path) {
7
+ if (path[0] === "/" && path[1] === "/") return path;
8
+ let url = new URL(base, internal);
9
+ url = new URL(path, url);
10
+ return url.protocol === internal.protocol ? url.pathname + url.search + url.hash : url.href;
11
+ }
12
+ /**
13
+ * @param {string} path
14
+ * @param {import('types').TrailingSlash} trailing_slash
15
+ */
16
+ function normalize_path(path, trailing_slash) {
17
+ if (path === "/" || trailing_slash === "ignore") return path;
18
+ if (trailing_slash === "never") return path.endsWith("/") ? path.slice(0, -1) : path;
19
+ else if (trailing_slash === "always" && !path.endsWith("/")) return path + "/";
20
+ return path;
21
+ }
22
+ /**
23
+ * Decode pathname excluding %25 to prevent further double decoding of params
24
+ * @param {string} pathname
25
+ */
26
+ function decode_pathname(pathname) {
27
+ return pathname.split("%25").map(decodeURI).join("%25");
28
+ }
29
+ /** @param {Record<string, string>} params */
30
+ function decode_params(params) {
31
+ for (const key in params) params[key] = decodeURIComponent(params[key]);
32
+ return params;
33
+ }
34
+ /**
35
+ * @param {URL} url
36
+ * @param {() => void} callback
37
+ * @param {(search_param: string) => void} search_params_callback
38
+ * @param {boolean} [allow_hash]
39
+ */
40
+ function make_trackable(url, callback, search_params_callback, allow_hash = false) {
41
+ const tracked = new URL(url);
42
+ Object.defineProperty(tracked, "searchParams", {
43
+ value: new Proxy(tracked.searchParams, { get(obj, key) {
44
+ if (key === "get" || key === "getAll" || key === "has") return (param, ...rest) => {
45
+ search_params_callback(param);
46
+ return obj[key](param, ...rest);
47
+ };
48
+ callback();
49
+ const value = Reflect.get(obj, key);
50
+ return typeof value === "function" ? value.bind(obj) : value;
51
+ } }),
52
+ enumerable: true,
53
+ configurable: true
54
+ });
55
+ /**
56
+ * URL properties that could change during the lifetime of the page,
57
+ * which excludes things like `origin`
58
+ * @type {(keyof URL)[]}
59
+ */
60
+ const tracked_url_properties = [
61
+ "href",
62
+ "pathname",
63
+ "search",
64
+ "toString",
65
+ "toJSON"
66
+ ];
67
+ if (allow_hash) tracked_url_properties.push("hash");
68
+ for (const property of tracked_url_properties) Object.defineProperty(tracked, property, {
69
+ get() {
70
+ callback();
71
+ return url[property];
72
+ },
73
+ enumerable: true,
74
+ configurable: true
75
+ });
76
+ tracked[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
77
+ return inspect(url, opts);
78
+ };
79
+ tracked.searchParams[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
80
+ return inspect(url.searchParams, opts);
81
+ };
82
+ if (!allow_hash) disable_hash(tracked);
83
+ return tracked;
84
+ }
85
+ /**
86
+ * Disallow access to `url.hash` on the server and in `load`
87
+ * @param {URL} url
88
+ */
89
+ function disable_hash(url) {
90
+ allow_nodejs_console_log(url);
91
+ Object.defineProperty(url, "hash", { get() {
92
+ throw new Error("Cannot access event.url.hash. Consider using `page.url.hash` inside a component instead");
93
+ } });
94
+ }
95
+ /**
96
+ * Disallow access to `url.search` and `url.searchParams` during prerendering
97
+ * @param {URL} url
98
+ */
99
+ function disable_search(url) {
100
+ allow_nodejs_console_log(url);
101
+ for (const property of ["search", "searchParams"]) Object.defineProperty(url, property, { get() {
102
+ throw new Error(`Cannot access url.${property} on a page with prerendering enabled`);
103
+ } });
104
+ }
105
+ /**
106
+ * Allow URL to be console logged, bypassing disabled properties.
107
+ * @param {URL} url
108
+ */
109
+ function allow_nodejs_console_log(url) {
110
+ url[Symbol.for("nodejs.util.inspect.custom")] = (_depth, opts, inspect) => {
111
+ return inspect(new URL(url), opts);
112
+ };
113
+ }
114
+ //#endregion
115
+ //#region node_modules/@sveltejs/kit/src/utils/hash.js
116
+ /**
117
+ * Hash using djb2
118
+ * @param {import('types').StrictBody[]} values
119
+ */
120
+ function hash(...values) {
121
+ let hash = 5381;
122
+ for (const value of values) if (typeof value === "string") {
123
+ let i = value.length;
124
+ while (i) hash = hash * 33 ^ value.charCodeAt(--i);
125
+ } else if (ArrayBuffer.isView(value)) {
126
+ const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
127
+ let i = buffer.length;
128
+ while (i) hash = hash * 33 ^ buffer[--i];
129
+ } else throw new TypeError("value must be a string or TypedArray");
130
+ return (hash >>> 0).toString(36);
131
+ }
132
+ //#endregion
133
+ //#region node_modules/@sveltejs/kit/src/utils/routing.js
134
+ /**
135
+ * @param {RegExpMatchArray} match
136
+ * @param {import('types').RouteParam[]} params
137
+ * @param {Record<string, import('@sveltejs/kit').ParamMatcher>} matchers
138
+ */
139
+ function exec(match, params, matchers) {
140
+ /** @type {Record<string, string>} */
141
+ const result = {};
142
+ const values = match.slice(1);
143
+ const values_needing_match = values.filter((value) => value !== void 0);
144
+ let buffered = 0;
145
+ for (let i = 0; i < params.length; i += 1) {
146
+ const param = params[i];
147
+ let value = values[i - buffered];
148
+ if (param.chained && param.rest && buffered) {
149
+ value = values.slice(i - buffered, i + 1).filter((s) => s).join("/");
150
+ buffered = 0;
151
+ }
152
+ if (value === void 0) {
153
+ if (param.rest) value = "";
154
+ else continue;
155
+ }
156
+ if (!param.matcher || matchers[param.matcher](value)) {
157
+ result[param.name] = value;
158
+ const next_param = params[i + 1];
159
+ const next_value = values[i + 1];
160
+ if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) buffered = 0;
161
+ if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) buffered = 0;
162
+ continue;
163
+ }
164
+ if (param.optional && param.chained) {
165
+ buffered++;
166
+ continue;
167
+ }
168
+ return;
169
+ }
170
+ if (buffered) return;
171
+ return result;
172
+ }
173
+ /**
174
+ * Find the first route that matches the given path
175
+ * @template {{pattern: RegExp, params: import('types').RouteParam[]}} Route
176
+ * @param {string} path - The decoded pathname to match
177
+ * @param {Route[]} routes
178
+ * @param {Record<string, import('@sveltejs/kit').ParamMatcher>} matchers
179
+ * @returns {{ route: Route, params: Record<string, string> } | null}
180
+ */
181
+ function find_route(path, routes, matchers) {
182
+ for (const route of routes) {
183
+ const match = route.pattern.exec(path);
184
+ if (!match) continue;
185
+ const matched = exec(match, route.params, matchers);
186
+ if (matched) return {
187
+ route,
188
+ params: decode_params(matched)
189
+ };
190
+ }
191
+ return null;
192
+ }
193
+ //#endregion
194
+ //#region node_modules/@sveltejs/kit/src/utils/exports.js
195
+ /**
196
+ * @param {Set<string>} expected
197
+ */
198
+ function validator(expected) {
199
+ /**
200
+ * @param {any} module
201
+ * @param {string} [file]
202
+ */
203
+ function validate(module, file) {
204
+ if (!module) return;
205
+ for (const key in module) {
206
+ if (key[0] === "_" || expected.has(key)) continue;
207
+ const values = [...expected.values()];
208
+ const hint = hint_for_supported_files(key, file?.slice(file.lastIndexOf("."))) ?? `valid exports are ${values.join(", ")}, or anything with a '_' prefix`;
209
+ throw new Error(`Invalid export '${key}'${file ? ` in ${file}` : ""} (${hint})`);
210
+ }
211
+ }
212
+ return validate;
213
+ }
214
+ /**
215
+ * @param {string} key
216
+ * @param {string} ext
217
+ * @returns {string | void}
218
+ */
219
+ function hint_for_supported_files(key, ext = ".js") {
220
+ const supported_files = [];
221
+ if (valid_layout_exports.has(key)) supported_files.push(`+layout${ext}`);
222
+ if (valid_page_exports.has(key)) supported_files.push(`+page${ext}`);
223
+ if (valid_layout_server_exports.has(key)) supported_files.push(`+layout.server${ext}`);
224
+ if (valid_page_server_exports.has(key)) supported_files.push(`+page.server${ext}`);
225
+ if (valid_server_exports.has(key)) supported_files.push(`+server${ext}`);
226
+ if (supported_files.length > 0) return `'${key}' is a valid export in ${supported_files.slice(0, -1).join(", ")}${supported_files.length > 1 ? " or " : ""}${supported_files.at(-1)}`;
227
+ }
228
+ var valid_layout_exports = /* @__PURE__ */ new Set([
229
+ "load",
230
+ "prerender",
231
+ "csr",
232
+ "ssr",
233
+ "trailingSlash",
234
+ "config"
235
+ ]);
236
+ var valid_page_exports = /* @__PURE__ */ new Set([...valid_layout_exports, "entries"]);
237
+ var valid_layout_server_exports = /* @__PURE__ */ new Set([...valid_layout_exports]);
238
+ var valid_page_server_exports = /* @__PURE__ */ new Set([
239
+ ...valid_layout_server_exports,
240
+ "actions",
241
+ "entries"
242
+ ]);
243
+ var valid_server_exports = /* @__PURE__ */ new Set([
244
+ "GET",
245
+ "POST",
246
+ "PATCH",
247
+ "PUT",
248
+ "DELETE",
249
+ "OPTIONS",
250
+ "HEAD",
251
+ "fallback",
252
+ "prerender",
253
+ "trailingSlash",
254
+ "config",
255
+ "entries"
256
+ ]);
257
+ var validate_layout_exports = validator(valid_layout_exports);
258
+ var validate_page_exports = validator(valid_page_exports);
259
+ var validate_layout_server_exports = validator(valid_layout_server_exports);
260
+ var validate_page_server_exports = validator(valid_page_server_exports);
261
+
262
+ export { disable_search as a, validate_layout_exports as b, validate_page_server_exports as c, decode_pathname as d, validate_page_exports as e, find_route as f, hash as h, make_trackable as m, normalize_path as n, resolve as r, validate_layout_server_exports as v };
263
+ //# sourceMappingURL=exports.js-Dd48p7Ih.js.map