vite-plugin-kiru 0.32.0-preview.1 → 0.32.0
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/build.dev.ts +3 -4
- package/dist/index.d.ts +26 -63
- package/dist/index.js +790 -244
- package/package.json +3 -14
- package/dist/server.d.ts +0 -19
- package/dist/server.js +0 -6912
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
// ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js
|
|
28
28
|
var require_sourcemap_codec_umd = __commonJS({
|
|
29
29
|
"../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js"(exports, module) {
|
|
30
|
-
(function(
|
|
30
|
+
(function(global, factory) {
|
|
31
31
|
if (typeof exports === "object" && typeof module !== "undefined") {
|
|
32
32
|
factory(module);
|
|
33
33
|
module.exports = def(module);
|
|
@@ -39,8 +39,8 @@ var require_sourcemap_codec_umd = __commonJS({
|
|
|
39
39
|
} else {
|
|
40
40
|
const mod = { exports: {} };
|
|
41
41
|
factory(mod);
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
global = typeof globalThis !== "undefined" ? globalThis : global || self;
|
|
43
|
+
global.sourcemapCodec = def(mod);
|
|
44
44
|
}
|
|
45
45
|
function def(m) {
|
|
46
46
|
return "default" in m.exports ? m.exports.default : m.exports;
|
|
@@ -2140,6 +2140,687 @@ function replaceOnHMRCallbacks(code, ast, isBuild) {
|
|
|
2140
2140
|
}
|
|
2141
2141
|
}
|
|
2142
2142
|
|
|
2143
|
+
// src/codegen/hoistJSX.ts
|
|
2144
|
+
var staticHoistableIds = /* @__PURE__ */ new Set();
|
|
2145
|
+
function prepareJSXHoisting(ctx) {
|
|
2146
|
+
const { code, ast } = ctx;
|
|
2147
|
+
const createElement = createAliasHandler("createElement");
|
|
2148
|
+
const fragment = createAliasHandler("Fragment");
|
|
2149
|
+
const memo = createAliasHandler("memo");
|
|
2150
|
+
const bodyNodes = ast.body;
|
|
2151
|
+
for (const node of bodyNodes) {
|
|
2152
|
+
if (node.type === "ImportDeclaration") {
|
|
2153
|
+
;
|
|
2154
|
+
[createElement, fragment, memo].forEach((handler) => {
|
|
2155
|
+
handler.addAliases(node);
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
let counter = 0;
|
|
2160
|
+
const hoistableSet = /* @__PURE__ */ new Set();
|
|
2161
|
+
staticHoistableIds.clear();
|
|
2162
|
+
for (const node of bodyNodes) {
|
|
2163
|
+
if (node.type !== "VariableDeclaration") continue;
|
|
2164
|
+
const kind = node.kind;
|
|
2165
|
+
if (kind !== "const") continue;
|
|
2166
|
+
const declarations2 = node.declarations || [];
|
|
2167
|
+
for (const decl of declarations2) {
|
|
2168
|
+
if (decl.type !== "VariableDeclarator") continue;
|
|
2169
|
+
const id = decl.id;
|
|
2170
|
+
if (!id || id.type !== "Identifier" || !id.name) continue;
|
|
2171
|
+
const init = decl.init;
|
|
2172
|
+
if (!init) continue;
|
|
2173
|
+
let isStatic = false;
|
|
2174
|
+
if (isStaticLiteral(init)) {
|
|
2175
|
+
isStatic = true;
|
|
2176
|
+
} else if (init.type === "CallExpression" && isHoistableSubtree(init, createElement.aliases, fragment.aliases)) {
|
|
2177
|
+
isStatic = true;
|
|
2178
|
+
}
|
|
2179
|
+
if (isStatic) {
|
|
2180
|
+
staticHoistableIds.add(id.name);
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
for (const node of bodyNodes) {
|
|
2185
|
+
let pushCandidate2 = function(node2) {
|
|
2186
|
+
candidateNodes.push(node2);
|
|
2187
|
+
};
|
|
2188
|
+
var pushCandidate = pushCandidate2;
|
|
2189
|
+
const candidateNodes = [];
|
|
2190
|
+
let fnDepth = 0;
|
|
2191
|
+
const FunctionDepthTracker = () => {
|
|
2192
|
+
fnDepth++;
|
|
2193
|
+
return () => fnDepth--;
|
|
2194
|
+
};
|
|
2195
|
+
walk(node, {
|
|
2196
|
+
FunctionDeclaration: FunctionDepthTracker,
|
|
2197
|
+
FunctionExpression: FunctionDepthTracker,
|
|
2198
|
+
ArrowFunctionExpression: FunctionDepthTracker,
|
|
2199
|
+
CallExpression: (callNode) => {
|
|
2200
|
+
if (fnDepth === 0) return;
|
|
2201
|
+
const callee = callNode.callee;
|
|
2202
|
+
if (createElement.isMatchingCallExpression(callNode)) {
|
|
2203
|
+
pushCandidate2(callNode);
|
|
2204
|
+
const childrenArgs = callNode.arguments?.slice(2) || [];
|
|
2205
|
+
for (const child of childrenArgs) {
|
|
2206
|
+
if (child.type === "BinaryExpression" || child.type === "UnaryExpression" || child.type === "ConditionalExpression" || child.type === "LogicalExpression") {
|
|
2207
|
+
pushCandidate2(child);
|
|
2208
|
+
collectNestedOperations(child, candidateNodes);
|
|
2209
|
+
}
|
|
2210
|
+
if (child.type === "ArrayExpression" && isStaticLiteral(child)) {
|
|
2211
|
+
pushCandidate2(child);
|
|
2212
|
+
}
|
|
2213
|
+
if (child.type === "ObjectExpression" && isStaticLiteral(child)) {
|
|
2214
|
+
pushCandidate2(child);
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
return;
|
|
2218
|
+
}
|
|
2219
|
+
if (callee?.type === "MemberExpression") {
|
|
2220
|
+
const obj = callee.object;
|
|
2221
|
+
if (obj?.type === "ArrayExpression" || obj?.type === "ObjectExpression" || obj?.type === "CallExpression" || obj?.type === "MemberExpression") {
|
|
2222
|
+
pushCandidate2(callNode);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
},
|
|
2226
|
+
MemberExpression: (memberNode) => {
|
|
2227
|
+
if (fnDepth === 0) return;
|
|
2228
|
+
const obj = memberNode.object;
|
|
2229
|
+
if (obj?.type === "ArrayExpression" || obj?.type === "ObjectExpression") {
|
|
2230
|
+
pushCandidate2(memberNode);
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
});
|
|
2234
|
+
let changed = true;
|
|
2235
|
+
while (changed) {
|
|
2236
|
+
changed = false;
|
|
2237
|
+
for (let i = candidateNodes.length - 1; i >= 0; i--) {
|
|
2238
|
+
const node2 = candidateNodes[i];
|
|
2239
|
+
if (hoistableSet.has(node2)) continue;
|
|
2240
|
+
if (node2.type === "CallExpression") {
|
|
2241
|
+
const callee = node2.callee;
|
|
2242
|
+
if (callee?.type === "MemberExpression") {
|
|
2243
|
+
if (isHoistableStaticOperation(
|
|
2244
|
+
node2,
|
|
2245
|
+
createElement.aliases,
|
|
2246
|
+
fragment.aliases,
|
|
2247
|
+
hoistableSet
|
|
2248
|
+
)) {
|
|
2249
|
+
hoistableSet.add(node2);
|
|
2250
|
+
changed = true;
|
|
2251
|
+
}
|
|
2252
|
+
} else {
|
|
2253
|
+
if (isHoistableSubtree(
|
|
2254
|
+
node2,
|
|
2255
|
+
createElement.aliases,
|
|
2256
|
+
fragment.aliases,
|
|
2257
|
+
hoistableSet
|
|
2258
|
+
)) {
|
|
2259
|
+
hoistableSet.add(node2);
|
|
2260
|
+
changed = true;
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
} else if (node2.type === "MemberExpression") {
|
|
2264
|
+
if (isHoistableStaticOperation(
|
|
2265
|
+
node2,
|
|
2266
|
+
createElement.aliases,
|
|
2267
|
+
fragment.aliases,
|
|
2268
|
+
hoistableSet
|
|
2269
|
+
)) {
|
|
2270
|
+
hoistableSet.add(node2);
|
|
2271
|
+
changed = true;
|
|
2272
|
+
}
|
|
2273
|
+
} else if (node2.type === "ArrayExpression") {
|
|
2274
|
+
if (isStaticLiteral(node2)) {
|
|
2275
|
+
hoistableSet.add(node2);
|
|
2276
|
+
changed = true;
|
|
2277
|
+
}
|
|
2278
|
+
} else if (node2.type === "ObjectExpression") {
|
|
2279
|
+
if (isStaticLiteral(node2)) {
|
|
2280
|
+
hoistableSet.add(node2);
|
|
2281
|
+
changed = true;
|
|
2282
|
+
}
|
|
2283
|
+
} else {
|
|
2284
|
+
if (isHoistableStaticExpression(
|
|
2285
|
+
node2,
|
|
2286
|
+
createElement.aliases,
|
|
2287
|
+
fragment.aliases,
|
|
2288
|
+
hoistableSet
|
|
2289
|
+
)) {
|
|
2290
|
+
hoistableSet.add(node2);
|
|
2291
|
+
changed = true;
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
const allHoistables = [];
|
|
2298
|
+
for (const node of bodyNodes) {
|
|
2299
|
+
walk(node, {
|
|
2300
|
+
CallExpression: (callNode, walkCtx) => {
|
|
2301
|
+
if (!hoistableSet.has(callNode)) return;
|
|
2302
|
+
const varName = `$k${counter++}`;
|
|
2303
|
+
allHoistables.push({
|
|
2304
|
+
node: callNode,
|
|
2305
|
+
code: code.original.substring(callNode.start, callNode.end),
|
|
2306
|
+
varName
|
|
2307
|
+
});
|
|
2308
|
+
walkCtx.exitBranch();
|
|
2309
|
+
},
|
|
2310
|
+
MemberExpression: (memberNode, walkCtx) => {
|
|
2311
|
+
if (!hoistableSet.has(memberNode)) return;
|
|
2312
|
+
const stack = walkCtx.stack || [];
|
|
2313
|
+
if (stack.length > 0) {
|
|
2314
|
+
const parent = stack[stack.length - 1];
|
|
2315
|
+
if (parent?.type === "CallExpression" && parent.callee === memberNode) {
|
|
2316
|
+
if (!hoistableSet.has(parent)) {
|
|
2317
|
+
return;
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
const varName = `$k${counter++}`;
|
|
2322
|
+
allHoistables.push({
|
|
2323
|
+
node: memberNode,
|
|
2324
|
+
code: code.original.substring(memberNode.start, memberNode.end),
|
|
2325
|
+
varName
|
|
2326
|
+
});
|
|
2327
|
+
walkCtx.exitBranch();
|
|
2328
|
+
},
|
|
2329
|
+
BinaryExpression: (binaryNode, walkCtx) => {
|
|
2330
|
+
if (!hoistableSet.has(binaryNode)) return;
|
|
2331
|
+
const varName = `$k${counter++}`;
|
|
2332
|
+
allHoistables.push({
|
|
2333
|
+
node: binaryNode,
|
|
2334
|
+
code: code.original.substring(binaryNode.start, binaryNode.end),
|
|
2335
|
+
varName
|
|
2336
|
+
});
|
|
2337
|
+
walkCtx.exitBranch();
|
|
2338
|
+
},
|
|
2339
|
+
ConditionalExpression: (conditionalNode, walkCtx) => {
|
|
2340
|
+
if (!hoistableSet.has(conditionalNode)) return;
|
|
2341
|
+
const varName = `$k${counter++}`;
|
|
2342
|
+
allHoistables.push({
|
|
2343
|
+
node: conditionalNode,
|
|
2344
|
+
code: code.original.substring(
|
|
2345
|
+
conditionalNode.start,
|
|
2346
|
+
conditionalNode.end
|
|
2347
|
+
),
|
|
2348
|
+
varName
|
|
2349
|
+
});
|
|
2350
|
+
walkCtx.exitBranch();
|
|
2351
|
+
},
|
|
2352
|
+
LogicalExpression: (logicalNode, walkCtx) => {
|
|
2353
|
+
if (!hoistableSet.has(logicalNode)) return;
|
|
2354
|
+
const varName = `$k${counter++}`;
|
|
2355
|
+
allHoistables.push({
|
|
2356
|
+
node: logicalNode,
|
|
2357
|
+
code: code.original.substring(logicalNode.start, logicalNode.end),
|
|
2358
|
+
varName
|
|
2359
|
+
});
|
|
2360
|
+
walkCtx.exitBranch();
|
|
2361
|
+
},
|
|
2362
|
+
ArrayExpression: (arrayNode, walkCtx) => {
|
|
2363
|
+
if (!hoistableSet.has(arrayNode)) return;
|
|
2364
|
+
const varName = `$k${counter++}`;
|
|
2365
|
+
allHoistables.push({
|
|
2366
|
+
node: arrayNode,
|
|
2367
|
+
code: code.original.substring(arrayNode.start, arrayNode.end),
|
|
2368
|
+
varName
|
|
2369
|
+
});
|
|
2370
|
+
walkCtx.exitBranch();
|
|
2371
|
+
},
|
|
2372
|
+
ObjectExpression: (objectNode, walkCtx) => {
|
|
2373
|
+
if (!hoistableSet.has(objectNode)) return;
|
|
2374
|
+
const varName = `$k${counter++}`;
|
|
2375
|
+
allHoistables.push({
|
|
2376
|
+
node: objectNode,
|
|
2377
|
+
code: code.original.substring(objectNode.start, objectNode.end),
|
|
2378
|
+
varName
|
|
2379
|
+
});
|
|
2380
|
+
walkCtx.exitBranch();
|
|
2381
|
+
}
|
|
2382
|
+
});
|
|
2383
|
+
}
|
|
2384
|
+
if (allHoistables.length === 0) return;
|
|
2385
|
+
const declarations = allHoistables.length === 1 ? `const ${allHoistables[0].varName} = ${allHoistables[0].code}` : allHoistables.map(
|
|
2386
|
+
(h, i) => i === 0 ? `const ${h.varName} =${h.code.startsWith("_jsx") ? " /* @__PURE__ */" : ""} ${h.code}` : ` ${h.varName} =${h.code.startsWith("_jsx") ? " /* @__PURE__ */" : ""} ${h.code}`
|
|
2387
|
+
).join(",\n");
|
|
2388
|
+
code.append(`
|
|
2389
|
+
${declarations}
|
|
2390
|
+
`);
|
|
2391
|
+
for (let i = allHoistables.length - 1; i >= 0; i--) {
|
|
2392
|
+
const h = allHoistables[i];
|
|
2393
|
+
code.update(h.node.start, h.node.end, h.varName);
|
|
2394
|
+
if ("_rollupAnnotations" in h.node) {
|
|
2395
|
+
const annotations = h.node._rollupAnnotations;
|
|
2396
|
+
const pureAnnotation = annotations.find((a) => a.type === "pure");
|
|
2397
|
+
if (pureAnnotation) {
|
|
2398
|
+
code.remove(pureAnnotation.start, pureAnnotation.end);
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
function isHoistableStaticOperation(node, jsxAliases, fragmentAliases, hoistableSet) {
|
|
2404
|
+
let memberExpr;
|
|
2405
|
+
let isCall = false;
|
|
2406
|
+
if (node.type === "CallExpression") {
|
|
2407
|
+
const callee = node.callee;
|
|
2408
|
+
if (callee?.type !== "MemberExpression") return false;
|
|
2409
|
+
memberExpr = callee;
|
|
2410
|
+
isCall = true;
|
|
2411
|
+
} else if (node.type === "MemberExpression") {
|
|
2412
|
+
memberExpr = node;
|
|
2413
|
+
isCall = false;
|
|
2414
|
+
} else {
|
|
2415
|
+
return false;
|
|
2416
|
+
}
|
|
2417
|
+
const obj = memberExpr.object;
|
|
2418
|
+
if (!obj) return false;
|
|
2419
|
+
let isStaticSource = false;
|
|
2420
|
+
if (obj.type === "ArrayExpression") {
|
|
2421
|
+
const elements = obj.elements || [];
|
|
2422
|
+
isStaticSource = elements.every((elem) => {
|
|
2423
|
+
if (!elem) return true;
|
|
2424
|
+
return isStaticLiteral(elem);
|
|
2425
|
+
});
|
|
2426
|
+
} else if (obj.type === "ObjectExpression") {
|
|
2427
|
+
const objNode = obj;
|
|
2428
|
+
const properties = objNode.properties || [];
|
|
2429
|
+
isStaticSource = properties.every((prop) => {
|
|
2430
|
+
if (prop.type !== "Property") return false;
|
|
2431
|
+
return isStaticLiteral(prop.value);
|
|
2432
|
+
});
|
|
2433
|
+
} else if (obj.type === "CallExpression" || obj.type === "MemberExpression") {
|
|
2434
|
+
const objNode = obj;
|
|
2435
|
+
if (hoistableSet.has(objNode)) {
|
|
2436
|
+
isStaticSource = true;
|
|
2437
|
+
} else {
|
|
2438
|
+
hoistableSet.add(objNode);
|
|
2439
|
+
isStaticSource = isHoistableStaticOperation(
|
|
2440
|
+
objNode,
|
|
2441
|
+
jsxAliases,
|
|
2442
|
+
fragmentAliases,
|
|
2443
|
+
hoistableSet
|
|
2444
|
+
);
|
|
2445
|
+
if (!isStaticSource) {
|
|
2446
|
+
hoistableSet.delete(objNode);
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
if (!isStaticSource) return false;
|
|
2451
|
+
if (!isCall) {
|
|
2452
|
+
const prop = memberExpr.property;
|
|
2453
|
+
if (prop?.type === "Identifier" && prop.name) {
|
|
2454
|
+
return true;
|
|
2455
|
+
}
|
|
2456
|
+
return false;
|
|
2457
|
+
}
|
|
2458
|
+
const callNode = node;
|
|
2459
|
+
const args = callNode.arguments || [];
|
|
2460
|
+
if (args.length === 0) return true;
|
|
2461
|
+
const firstArg = args[0];
|
|
2462
|
+
if (firstArg.type === "ArrowFunctionExpression" || firstArg.type === "FunctionExpression") {
|
|
2463
|
+
const params = firstArg.params || [];
|
|
2464
|
+
if (params.length === 0) return false;
|
|
2465
|
+
const paramNames = /* @__PURE__ */ new Set();
|
|
2466
|
+
for (const param of params) {
|
|
2467
|
+
if (param.type === "Identifier" && param.name) {
|
|
2468
|
+
paramNames.add(param.name);
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
if (paramNames.size === 0) return false;
|
|
2472
|
+
const body = firstArg.body;
|
|
2473
|
+
if (!body) return false;
|
|
2474
|
+
if (Array.isArray(body)) return false;
|
|
2475
|
+
const bodyNode = body;
|
|
2476
|
+
let callbackResult = false;
|
|
2477
|
+
if (bodyNode.type === "BlockStatement") {
|
|
2478
|
+
const statements = bodyNode.body || [];
|
|
2479
|
+
if (statements.length !== 1) return false;
|
|
2480
|
+
const stmt = statements[0];
|
|
2481
|
+
if (stmt.type !== "ReturnStatement" || !stmt.argument)
|
|
2482
|
+
return false;
|
|
2483
|
+
const returnValue = stmt.argument;
|
|
2484
|
+
const firstParamName = Array.from(paramNames)[0];
|
|
2485
|
+
callbackResult = isStaticallyDerivedJSX(
|
|
2486
|
+
returnValue,
|
|
2487
|
+
firstParamName,
|
|
2488
|
+
jsxAliases,
|
|
2489
|
+
fragmentAliases,
|
|
2490
|
+
hoistableSet
|
|
2491
|
+
) || isStaticallyDerivedValueMultiParam(returnValue, paramNames);
|
|
2492
|
+
} else {
|
|
2493
|
+
const firstParamName = Array.from(paramNames)[0];
|
|
2494
|
+
callbackResult = isStaticallyDerivedJSX(
|
|
2495
|
+
bodyNode,
|
|
2496
|
+
firstParamName,
|
|
2497
|
+
jsxAliases,
|
|
2498
|
+
fragmentAliases,
|
|
2499
|
+
hoistableSet
|
|
2500
|
+
) || isStaticallyDerivedValueMultiParam(bodyNode, paramNames);
|
|
2501
|
+
}
|
|
2502
|
+
return callbackResult && args.slice(1).every((arg) => isStaticLiteral(arg));
|
|
2503
|
+
}
|
|
2504
|
+
return args.every((arg) => isStaticLiteral(arg));
|
|
2505
|
+
}
|
|
2506
|
+
function isStaticallyDerivedProps(propsArg, paramName) {
|
|
2507
|
+
if (!propsArg) return true;
|
|
2508
|
+
if (propsArg.type === "Literal") {
|
|
2509
|
+
return propsArg.value === null || propsArg.value === void 0;
|
|
2510
|
+
}
|
|
2511
|
+
if (propsArg.type === "ObjectExpression") {
|
|
2512
|
+
const props = propsArg.properties || [];
|
|
2513
|
+
if (props.length === 0) return true;
|
|
2514
|
+
for (const prop of props) {
|
|
2515
|
+
if (prop.type !== "Property") return false;
|
|
2516
|
+
if (!isStaticallyDerivedValue(prop.value, paramName)) {
|
|
2517
|
+
return false;
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
return true;
|
|
2521
|
+
}
|
|
2522
|
+
return false;
|
|
2523
|
+
}
|
|
2524
|
+
function isStaticallyDerivedValueMultiParam(node, paramNames) {
|
|
2525
|
+
if (!node) return true;
|
|
2526
|
+
switch (node.type) {
|
|
2527
|
+
case "Literal":
|
|
2528
|
+
return true;
|
|
2529
|
+
case "Identifier":
|
|
2530
|
+
return node.name ? paramNames.has(node.name) : false;
|
|
2531
|
+
case "BinaryExpression":
|
|
2532
|
+
return isStaticallyDerivedValueMultiParam(node.left, paramNames) && isStaticallyDerivedValueMultiParam(node.right, paramNames);
|
|
2533
|
+
case "UnaryExpression":
|
|
2534
|
+
return isStaticallyDerivedValueMultiParam(
|
|
2535
|
+
node.argument,
|
|
2536
|
+
paramNames
|
|
2537
|
+
);
|
|
2538
|
+
case "MemberExpression":
|
|
2539
|
+
const obj = node.object;
|
|
2540
|
+
if (obj?.type === "Identifier" && obj.name && paramNames.has(obj.name)) {
|
|
2541
|
+
return true;
|
|
2542
|
+
}
|
|
2543
|
+
return false;
|
|
2544
|
+
default:
|
|
2545
|
+
return false;
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
function isStaticallyDerivedValue(node, paramName) {
|
|
2549
|
+
return isStaticallyDerivedValueMultiParam(node, /* @__PURE__ */ new Set([paramName]));
|
|
2550
|
+
}
|
|
2551
|
+
function isStaticallyDerivedJSX(node, paramName, jsxAliases, fragmentAliases, hoistableSet) {
|
|
2552
|
+
if (node.type !== "CallExpression") return false;
|
|
2553
|
+
const callee = node.callee;
|
|
2554
|
+
if (callee?.type !== "Identifier" || !callee.name || !jsxAliases.has(callee.name)) {
|
|
2555
|
+
return false;
|
|
2556
|
+
}
|
|
2557
|
+
const propsArg = node.arguments?.[1];
|
|
2558
|
+
if (!isStaticallyDerivedProps(propsArg, paramName)) {
|
|
2559
|
+
return false;
|
|
2560
|
+
}
|
|
2561
|
+
const childrenArgs = node.arguments?.slice(2) || [];
|
|
2562
|
+
for (const child of childrenArgs) {
|
|
2563
|
+
if (child.type === "Identifier") {
|
|
2564
|
+
if (child.name !== paramName) {
|
|
2565
|
+
return false;
|
|
2566
|
+
}
|
|
2567
|
+
continue;
|
|
2568
|
+
}
|
|
2569
|
+
if (child.type === "CallExpression") {
|
|
2570
|
+
const childCallee = child.callee;
|
|
2571
|
+
if (childCallee?.type === "Identifier" && childCallee.name && jsxAliases.has(childCallee.name)) {
|
|
2572
|
+
if (hoistableSet.has(child)) {
|
|
2573
|
+
continue;
|
|
2574
|
+
}
|
|
2575
|
+
if (isStaticallyDerivedJSX(
|
|
2576
|
+
child,
|
|
2577
|
+
paramName,
|
|
2578
|
+
jsxAliases,
|
|
2579
|
+
fragmentAliases,
|
|
2580
|
+
hoistableSet
|
|
2581
|
+
)) {
|
|
2582
|
+
hoistableSet.add(child);
|
|
2583
|
+
continue;
|
|
2584
|
+
}
|
|
2585
|
+
return false;
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
if (!isStaticValue(child)) {
|
|
2589
|
+
return false;
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
return true;
|
|
2593
|
+
}
|
|
2594
|
+
function isHoistableSubtree(callNode, jsxAliases, fragmentAliases, hoistableSet) {
|
|
2595
|
+
const callee = callNode.callee;
|
|
2596
|
+
if (callee?.type !== "Identifier" || !callee.name || !jsxAliases.has(callee.name)) {
|
|
2597
|
+
return false;
|
|
2598
|
+
}
|
|
2599
|
+
const typeArg = callNode.arguments?.[0];
|
|
2600
|
+
if (!typeArg) return false;
|
|
2601
|
+
const propsArg = callNode.arguments?.[1];
|
|
2602
|
+
if (!isHoistablePropsStatic(propsArg)) {
|
|
2603
|
+
return false;
|
|
2604
|
+
}
|
|
2605
|
+
const childrenArgs = callNode.arguments?.slice(2) || [];
|
|
2606
|
+
for (const child of childrenArgs) {
|
|
2607
|
+
if (child.type === "CallExpression") {
|
|
2608
|
+
const childCallee = child.callee;
|
|
2609
|
+
if (childCallee?.type === "Identifier" && childCallee.name && jsxAliases.has(childCallee.name)) {
|
|
2610
|
+
if (hoistableSet?.has(child)) {
|
|
2611
|
+
continue;
|
|
2612
|
+
}
|
|
2613
|
+
if (isHoistableSubtree(child, jsxAliases, fragmentAliases, hoistableSet)) {
|
|
2614
|
+
hoistableSet?.add(child);
|
|
2615
|
+
continue;
|
|
2616
|
+
}
|
|
2617
|
+
return false;
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
if (!isStaticChild(child)) {
|
|
2621
|
+
return false;
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
return true;
|
|
2625
|
+
}
|
|
2626
|
+
function collectNestedOperations(node, candidates) {
|
|
2627
|
+
if (!node) return;
|
|
2628
|
+
switch (node.type) {
|
|
2629
|
+
case "BinaryExpression":
|
|
2630
|
+
collectNestedOperations(node.left, candidates);
|
|
2631
|
+
collectNestedOperations(node.right, candidates);
|
|
2632
|
+
break;
|
|
2633
|
+
case "UnaryExpression":
|
|
2634
|
+
collectNestedOperations(node.argument, candidates);
|
|
2635
|
+
break;
|
|
2636
|
+
case "ConditionalExpression":
|
|
2637
|
+
collectNestedOperations(node.test, candidates);
|
|
2638
|
+
collectNestedOperations(node.consequent, candidates);
|
|
2639
|
+
collectNestedOperations(node.alternate, candidates);
|
|
2640
|
+
break;
|
|
2641
|
+
case "LogicalExpression":
|
|
2642
|
+
collectNestedOperations(node.left, candidates);
|
|
2643
|
+
collectNestedOperations(node.right, candidates);
|
|
2644
|
+
break;
|
|
2645
|
+
case "CallExpression":
|
|
2646
|
+
case "MemberExpression":
|
|
2647
|
+
candidates.push(node);
|
|
2648
|
+
break;
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
function isHoistableStaticExpression(node, jsxAliases, fragmentAliases, hoistableSet) {
|
|
2652
|
+
if (!node) return false;
|
|
2653
|
+
switch (node.type) {
|
|
2654
|
+
case "BinaryExpression":
|
|
2655
|
+
return isHoistableStaticExpression(
|
|
2656
|
+
node.left,
|
|
2657
|
+
jsxAliases,
|
|
2658
|
+
fragmentAliases,
|
|
2659
|
+
hoistableSet
|
|
2660
|
+
) && isHoistableStaticExpression(
|
|
2661
|
+
node.right,
|
|
2662
|
+
jsxAliases,
|
|
2663
|
+
fragmentAliases,
|
|
2664
|
+
hoistableSet
|
|
2665
|
+
);
|
|
2666
|
+
case "UnaryExpression":
|
|
2667
|
+
return isHoistableStaticExpression(
|
|
2668
|
+
node.argument,
|
|
2669
|
+
jsxAliases,
|
|
2670
|
+
fragmentAliases,
|
|
2671
|
+
hoistableSet
|
|
2672
|
+
);
|
|
2673
|
+
case "ConditionalExpression":
|
|
2674
|
+
return isHoistableStaticExpression(
|
|
2675
|
+
node.test,
|
|
2676
|
+
jsxAliases,
|
|
2677
|
+
fragmentAliases,
|
|
2678
|
+
hoistableSet
|
|
2679
|
+
) && isHoistableStaticExpression(
|
|
2680
|
+
node.consequent,
|
|
2681
|
+
jsxAliases,
|
|
2682
|
+
fragmentAliases,
|
|
2683
|
+
hoistableSet
|
|
2684
|
+
) && isHoistableStaticExpression(
|
|
2685
|
+
node.alternate,
|
|
2686
|
+
jsxAliases,
|
|
2687
|
+
fragmentAliases,
|
|
2688
|
+
hoistableSet
|
|
2689
|
+
);
|
|
2690
|
+
case "LogicalExpression":
|
|
2691
|
+
return isHoistableStaticExpression(
|
|
2692
|
+
node.left,
|
|
2693
|
+
jsxAliases,
|
|
2694
|
+
fragmentAliases,
|
|
2695
|
+
hoistableSet
|
|
2696
|
+
) && isHoistableStaticExpression(
|
|
2697
|
+
node.right,
|
|
2698
|
+
jsxAliases,
|
|
2699
|
+
fragmentAliases,
|
|
2700
|
+
hoistableSet
|
|
2701
|
+
);
|
|
2702
|
+
case "Literal":
|
|
2703
|
+
return true;
|
|
2704
|
+
case "ArrayExpression":
|
|
2705
|
+
return isStaticLiteral(node);
|
|
2706
|
+
case "ObjectExpression":
|
|
2707
|
+
return isStaticLiteral(node);
|
|
2708
|
+
case "CallExpression":
|
|
2709
|
+
case "MemberExpression":
|
|
2710
|
+
if (jsxAliases && fragmentAliases && hoistableSet) {
|
|
2711
|
+
if (hoistableSet.has(node)) return true;
|
|
2712
|
+
const isHoistable = isHoistableStaticOperation(
|
|
2713
|
+
node,
|
|
2714
|
+
jsxAliases,
|
|
2715
|
+
fragmentAliases,
|
|
2716
|
+
hoistableSet
|
|
2717
|
+
);
|
|
2718
|
+
if (isHoistable) {
|
|
2719
|
+
hoistableSet.add(node);
|
|
2720
|
+
}
|
|
2721
|
+
return isHoistable;
|
|
2722
|
+
}
|
|
2723
|
+
return false;
|
|
2724
|
+
default:
|
|
2725
|
+
return false;
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
function isStaticChild(node) {
|
|
2729
|
+
if (!node) return true;
|
|
2730
|
+
switch (node.type) {
|
|
2731
|
+
case "Literal":
|
|
2732
|
+
return true;
|
|
2733
|
+
case "Identifier":
|
|
2734
|
+
if (node.name && staticHoistableIds.has(node.name)) {
|
|
2735
|
+
return true;
|
|
2736
|
+
}
|
|
2737
|
+
return false;
|
|
2738
|
+
case "ArrayExpression": {
|
|
2739
|
+
const elems = node.expressions || [];
|
|
2740
|
+
return elems.every((e) => isStaticChild(e));
|
|
2741
|
+
}
|
|
2742
|
+
case "ObjectExpression": {
|
|
2743
|
+
const props = node.properties || [];
|
|
2744
|
+
return props.every((p) => {
|
|
2745
|
+
if (p.type !== "Property") return false;
|
|
2746
|
+
return isStaticChild(p.value);
|
|
2747
|
+
});
|
|
2748
|
+
}
|
|
2749
|
+
case "BinaryExpression":
|
|
2750
|
+
return isStaticChild(node.left) && isStaticChild(node.right);
|
|
2751
|
+
case "ConditionalExpression":
|
|
2752
|
+
return isStaticChild(node.test) && isStaticChild(node.consequent) && isStaticChild(node.alternate);
|
|
2753
|
+
case "LogicalExpression":
|
|
2754
|
+
return isStaticChild(node.left) && isStaticChild(node.right);
|
|
2755
|
+
case "TemplateLiteral":
|
|
2756
|
+
return false;
|
|
2757
|
+
default:
|
|
2758
|
+
return false;
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
function isHoistablePropsStatic(propsArg) {
|
|
2762
|
+
if (!propsArg) return true;
|
|
2763
|
+
if (propsArg.type === "Literal") {
|
|
2764
|
+
return propsArg.value === null || propsArg.value === void 0;
|
|
2765
|
+
}
|
|
2766
|
+
if (propsArg.type === "ObjectExpression") {
|
|
2767
|
+
const props = propsArg.properties || [];
|
|
2768
|
+
if (props.length === 0) return true;
|
|
2769
|
+
for (const prop of props) {
|
|
2770
|
+
if (prop.type !== "Property") return false;
|
|
2771
|
+
if (!isStaticLiteral(prop.value)) return false;
|
|
2772
|
+
}
|
|
2773
|
+
return true;
|
|
2774
|
+
}
|
|
2775
|
+
return false;
|
|
2776
|
+
}
|
|
2777
|
+
function isStaticLiteral(node) {
|
|
2778
|
+
if (!node) return true;
|
|
2779
|
+
switch (node.type) {
|
|
2780
|
+
case "Literal":
|
|
2781
|
+
return true;
|
|
2782
|
+
case "ArrayExpression": {
|
|
2783
|
+
const elems = node.elements || [];
|
|
2784
|
+
return elems.every((e) => isStaticLiteral(e));
|
|
2785
|
+
}
|
|
2786
|
+
case "ObjectExpression": {
|
|
2787
|
+
const props = node.properties || [];
|
|
2788
|
+
return props.every((p) => {
|
|
2789
|
+
if (p.type !== "Property") return false;
|
|
2790
|
+
return isStaticLiteral(p.value);
|
|
2791
|
+
});
|
|
2792
|
+
}
|
|
2793
|
+
case "BinaryExpression":
|
|
2794
|
+
return isStaticLiteral(node.left) && isStaticLiteral(node.right);
|
|
2795
|
+
default:
|
|
2796
|
+
return false;
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
function isStaticValue(node) {
|
|
2800
|
+
if (!node) return true;
|
|
2801
|
+
switch (node.type) {
|
|
2802
|
+
case "Literal":
|
|
2803
|
+
return true;
|
|
2804
|
+
case "Identifier":
|
|
2805
|
+
return true;
|
|
2806
|
+
case "ArrayExpression": {
|
|
2807
|
+
const elems = node.expressions || [];
|
|
2808
|
+
return elems.every((e) => isStaticValue(e));
|
|
2809
|
+
}
|
|
2810
|
+
case "ObjectExpression": {
|
|
2811
|
+
const props = node.properties || [];
|
|
2812
|
+
return props.every((p) => {
|
|
2813
|
+
if (p.type !== "Property") return false;
|
|
2814
|
+
return isStaticValue(p.value);
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
case "BinaryExpression":
|
|
2818
|
+
return isStaticValue(node.left) && isStaticValue(node.right);
|
|
2819
|
+
default:
|
|
2820
|
+
return false;
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2143
2824
|
// src/ansi.ts
|
|
2144
2825
|
var colors = {
|
|
2145
2826
|
black: "\x1B[30m",
|
|
@@ -8808,8 +9489,8 @@ function createLogger(state) {
|
|
|
8808
9489
|
console.log(ANSI.cyan("[vite-plugin-kiru]"), ...data);
|
|
8809
9490
|
};
|
|
8810
9491
|
}
|
|
8811
|
-
function resolveUserDocument(projectRoot,
|
|
8812
|
-
const { dir, document } =
|
|
9492
|
+
function resolveUserDocument(projectRoot, ssgOptions) {
|
|
9493
|
+
const { dir, document } = ssgOptions;
|
|
8813
9494
|
const fp = path2.resolve(projectRoot, dir, document).replace(/\\/g, "/");
|
|
8814
9495
|
const matches = globSync(fp);
|
|
8815
9496
|
if (!matches.length) {
|
|
@@ -8840,80 +9521,57 @@ function shouldTransformFile(id, state) {
|
|
|
8840
9521
|
}
|
|
8841
9522
|
|
|
8842
9523
|
// src/virtual-modules.ts
|
|
8843
|
-
var
|
|
9524
|
+
var VIRTUAL_ROUTES_ID = "virtual:kiru:routes";
|
|
8844
9525
|
var VIRTUAL_ENTRY_SERVER_ID = "virtual:kiru:entry-server";
|
|
8845
9526
|
var VIRTUAL_ENTRY_CLIENT_ID = "virtual:kiru:entry-client";
|
|
8846
|
-
async function createVirtualModules(projectRoot,
|
|
8847
|
-
const userDoc = resolveUserDocument(projectRoot,
|
|
8848
|
-
function
|
|
8849
|
-
const { dir, baseUrl, page, layout,
|
|
9527
|
+
async function createVirtualModules(projectRoot, ssgOptions) {
|
|
9528
|
+
const userDoc = resolveUserDocument(projectRoot, ssgOptions);
|
|
9529
|
+
function createRoutesModule() {
|
|
9530
|
+
const { dir, baseUrl, page, layout, transition } = ssgOptions;
|
|
8850
9531
|
return `
|
|
8851
9532
|
import { formatViteImportMap, normalizePrefixPath } from "kiru/router/utils"
|
|
8852
9533
|
|
|
8853
9534
|
const dir = normalizePrefixPath("${dir}")
|
|
8854
9535
|
const baseUrl = normalizePrefixPath("${baseUrl}")
|
|
8855
|
-
const
|
|
8856
|
-
const
|
|
8857
|
-
const
|
|
9536
|
+
const pagesMap = import.meta.glob(["/**/${page}"])
|
|
9537
|
+
const layoutsMap = import.meta.glob(["/**/${layout}"])
|
|
9538
|
+
const pages = formatViteImportMap(pagesMap, dir, baseUrl)
|
|
9539
|
+
const layouts = formatViteImportMap(layoutsMap, dir, baseUrl)
|
|
8858
9540
|
const transition = ${transition}
|
|
8859
9541
|
|
|
8860
|
-
export { dir, baseUrl, pages, layouts,
|
|
9542
|
+
export { dir, baseUrl, pages, layouts, transition }
|
|
8861
9543
|
`;
|
|
8862
9544
|
}
|
|
8863
9545
|
function createEntryServerModule() {
|
|
8864
|
-
const documentModuleId = userDoc.substring(projectRoot.length);
|
|
8865
|
-
if (mode === "ssr") {
|
|
8866
|
-
return `
|
|
8867
|
-
import { render as kiruServerRender } from "kiru/router/ssr"
|
|
8868
|
-
import Document from "${userDoc}"
|
|
8869
|
-
import * as config from "${VIRTUAL_CONFIG_ID}"
|
|
8870
|
-
|
|
8871
|
-
export const documentModuleId = "${documentModuleId}"
|
|
8872
|
-
|
|
8873
|
-
export async function render(url, ctx) {
|
|
8874
|
-
return kiruServerRender(url, { ...ctx, ...config, Document })
|
|
8875
|
-
}
|
|
8876
|
-
`;
|
|
8877
|
-
}
|
|
8878
9546
|
return `
|
|
8879
9547
|
import {
|
|
8880
|
-
render as
|
|
8881
|
-
generateStaticPaths as
|
|
8882
|
-
} from "kiru/router/
|
|
9548
|
+
render as kiruServerRender,
|
|
9549
|
+
generateStaticPaths as kiruServerGenerateStaticPaths
|
|
9550
|
+
} from "kiru/router/server"
|
|
8883
9551
|
import Document from "${userDoc}"
|
|
8884
|
-
import
|
|
8885
|
-
|
|
8886
|
-
export const documentModuleId = "${documentModuleId}"
|
|
9552
|
+
import { pages, layouts } from "${VIRTUAL_ROUTES_ID}"
|
|
8887
9553
|
|
|
8888
9554
|
export async function render(url, ctx) {
|
|
8889
|
-
|
|
9555
|
+
const { registerModule, registerPreloadedPageProps } = ctx
|
|
9556
|
+
return kiruServerRender(url, { registerModule, registerPreloadedPageProps, Document, pages, layouts })
|
|
8890
9557
|
}
|
|
8891
9558
|
|
|
8892
9559
|
export async function generateStaticPaths() {
|
|
8893
|
-
return
|
|
9560
|
+
return kiruServerGenerateStaticPaths(pages)
|
|
8894
9561
|
}
|
|
8895
9562
|
`;
|
|
8896
9563
|
}
|
|
8897
9564
|
function createEntryClientModule() {
|
|
8898
|
-
if (mode === "ssr") {
|
|
8899
|
-
return `
|
|
8900
|
-
import { initClient } from "kiru/router/client"
|
|
8901
|
-
import * as config from "${VIRTUAL_CONFIG_ID}"
|
|
8902
|
-
import "${userDoc}"
|
|
8903
|
-
|
|
8904
|
-
initClient({ ...config, hydrationMode: "dynamic" })
|
|
8905
|
-
`;
|
|
8906
|
-
}
|
|
8907
9565
|
return `
|
|
8908
9566
|
import { initClient } from "kiru/router/client"
|
|
8909
|
-
import
|
|
9567
|
+
import { dir, baseUrl, pages, layouts, transition } from "${VIRTUAL_ROUTES_ID}"
|
|
8910
9568
|
import "${userDoc}"
|
|
8911
9569
|
|
|
8912
|
-
initClient({
|
|
9570
|
+
initClient({ dir, baseUrl, pages, layouts, transition })
|
|
8913
9571
|
`;
|
|
8914
9572
|
}
|
|
8915
9573
|
return {
|
|
8916
|
-
[
|
|
9574
|
+
[VIRTUAL_ROUTES_ID]: createRoutesModule,
|
|
8917
9575
|
[VIRTUAL_ENTRY_SERVER_ID]: createEntryServerModule,
|
|
8918
9576
|
[VIRTUAL_ENTRY_CLIENT_ID]: createEntryClientModule
|
|
8919
9577
|
};
|
|
@@ -8934,21 +9592,11 @@ var defaultSSGOptions = {
|
|
|
8934
9592
|
document: "document.{tsx,jsx}",
|
|
8935
9593
|
page: "index.{tsx,jsx}",
|
|
8936
9594
|
layout: "layout.{tsx,jsx}",
|
|
8937
|
-
guard: "guard.{ts,js}",
|
|
8938
9595
|
transition: false,
|
|
8939
9596
|
build: {
|
|
8940
9597
|
maxConcurrentRenders: 100
|
|
8941
9598
|
}
|
|
8942
9599
|
};
|
|
8943
|
-
var defaultSSROptions = {
|
|
8944
|
-
baseUrl: "/",
|
|
8945
|
-
dir: "src/pages",
|
|
8946
|
-
document: "document.{tsx,jsx}",
|
|
8947
|
-
page: "index.{tsx,jsx}",
|
|
8948
|
-
layout: "layout.{tsx,jsx}",
|
|
8949
|
-
guard: "guard.{ts,js}",
|
|
8950
|
-
transition: false
|
|
8951
|
-
};
|
|
8952
9600
|
function createPluginState(opts = {}) {
|
|
8953
9601
|
let fileLinkFormatter = (path8, line) => `vscode://file/${path8}:${line}`;
|
|
8954
9602
|
let dtClientPathname = "/__devtools__";
|
|
@@ -8969,78 +9617,50 @@ function createPluginState(opts = {}) {
|
|
|
8969
9617
|
dtHostScriptPath: "/__devtools_host__.js",
|
|
8970
9618
|
manifestPath: "vite-manifest.json",
|
|
8971
9619
|
loggingEnabled: opts.loggingEnabled === true,
|
|
8972
|
-
|
|
8973
|
-
|
|
9620
|
+
features: {
|
|
9621
|
+
staticHoisting: opts.experimental?.staticHoisting === true
|
|
9622
|
+
},
|
|
9623
|
+
ssgOptions: null
|
|
8974
9624
|
};
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
);
|
|
8979
|
-
}
|
|
8980
|
-
const { ssg, ssr } = opts;
|
|
8981
|
-
if (ssg) {
|
|
8982
|
-
if (ssg === true) {
|
|
8983
|
-
return {
|
|
8984
|
-
...state,
|
|
8985
|
-
ssgOptions: defaultSSGOptions
|
|
8986
|
-
};
|
|
8987
|
-
}
|
|
8988
|
-
if (ssg.baseUrl && !ssg.baseUrl.startsWith("/")) {
|
|
8989
|
-
throw new Error("[vite-plugin-kiru]: ssg.baseUrl must start with '/'");
|
|
8990
|
-
}
|
|
8991
|
-
const {
|
|
8992
|
-
baseUrl,
|
|
8993
|
-
dir,
|
|
8994
|
-
document,
|
|
8995
|
-
page,
|
|
8996
|
-
layout,
|
|
8997
|
-
guard,
|
|
8998
|
-
transition,
|
|
8999
|
-
build: { maxConcurrentRenders }
|
|
9000
|
-
} = defaultSSGOptions;
|
|
9625
|
+
const { ssg } = opts;
|
|
9626
|
+
if (!ssg) return state;
|
|
9627
|
+
if (ssg === true) {
|
|
9001
9628
|
return {
|
|
9002
9629
|
...state,
|
|
9003
|
-
ssgOptions:
|
|
9004
|
-
baseUrl,
|
|
9005
|
-
dir,
|
|
9006
|
-
document,
|
|
9007
|
-
page,
|
|
9008
|
-
layout,
|
|
9009
|
-
guard,
|
|
9010
|
-
transition,
|
|
9011
|
-
sitemap: ssg.sitemap,
|
|
9012
|
-
...ssg,
|
|
9013
|
-
build: {
|
|
9014
|
-
maxConcurrentRenders: ssg.build?.maxConcurrentRenders ?? maxConcurrentRenders
|
|
9015
|
-
}
|
|
9016
|
-
}
|
|
9630
|
+
ssgOptions: defaultSSGOptions
|
|
9017
9631
|
};
|
|
9018
9632
|
}
|
|
9019
|
-
if (
|
|
9020
|
-
|
|
9021
|
-
throw new Error("[vite-plugin-kiru]: ssr.baseUrl must start with '/'");
|
|
9022
|
-
}
|
|
9023
|
-
const { baseUrl, dir, document, page, layout, guard, transition } = defaultSSROptions;
|
|
9024
|
-
return {
|
|
9025
|
-
...state,
|
|
9026
|
-
ssrOptions: {
|
|
9027
|
-
baseUrl,
|
|
9028
|
-
dir,
|
|
9029
|
-
document,
|
|
9030
|
-
page,
|
|
9031
|
-
layout,
|
|
9032
|
-
guard,
|
|
9033
|
-
transition,
|
|
9034
|
-
...ssr
|
|
9035
|
-
}
|
|
9036
|
-
};
|
|
9633
|
+
if (ssg.baseUrl && !ssg.baseUrl.startsWith("/")) {
|
|
9634
|
+
throw new Error("[vite-plugin-kiru]: ssg.baseUrl must start with '/'");
|
|
9037
9635
|
}
|
|
9038
|
-
|
|
9636
|
+
const {
|
|
9637
|
+
baseUrl,
|
|
9638
|
+
dir,
|
|
9639
|
+
document,
|
|
9640
|
+
page,
|
|
9641
|
+
layout,
|
|
9642
|
+
transition,
|
|
9643
|
+
build: { maxConcurrentRenders }
|
|
9644
|
+
} = defaultSSGOptions;
|
|
9645
|
+
return {
|
|
9646
|
+
...state,
|
|
9647
|
+
ssgOptions: {
|
|
9648
|
+
...ssg,
|
|
9649
|
+
baseUrl: ssg.baseUrl ?? baseUrl,
|
|
9650
|
+
dir: ssg.dir ?? dir,
|
|
9651
|
+
document: ssg.document ?? document,
|
|
9652
|
+
page: ssg.page ?? page,
|
|
9653
|
+
layout: ssg.layout ?? layout,
|
|
9654
|
+
transition: ssg.transition ?? transition,
|
|
9655
|
+
sitemap: ssg.sitemap,
|
|
9656
|
+
build: {
|
|
9657
|
+
maxConcurrentRenders: ssg.build?.maxConcurrentRenders ?? maxConcurrentRenders
|
|
9658
|
+
}
|
|
9659
|
+
}
|
|
9660
|
+
};
|
|
9039
9661
|
}
|
|
9040
9662
|
function createViteConfig(config, opts) {
|
|
9041
|
-
|
|
9042
|
-
const hasSSR = !!opts.ssr;
|
|
9043
|
-
if (!hasSSG && !hasSSR) {
|
|
9663
|
+
if (!opts.ssg) {
|
|
9044
9664
|
return {
|
|
9045
9665
|
...config,
|
|
9046
9666
|
esbuild: {
|
|
@@ -9109,8 +9729,10 @@ function updatePluginState(state, config, opts) {
|
|
|
9109
9729
|
dtClientPathname: state.dtClientPathname,
|
|
9110
9730
|
dtHostScriptPath: state.dtHostScriptPath,
|
|
9111
9731
|
manifestPath: state.manifestPath,
|
|
9732
|
+
features: {
|
|
9733
|
+
staticHoisting: state.features?.staticHoisting ?? false
|
|
9734
|
+
},
|
|
9112
9735
|
ssgOptions: state.ssgOptions,
|
|
9113
|
-
ssrOptions: state.ssrOptions,
|
|
9114
9736
|
staticProps: {}
|
|
9115
9737
|
};
|
|
9116
9738
|
}
|
|
@@ -9123,35 +9745,35 @@ var dist_default = `<!DOCTYPE html>
|
|
|
9123
9745
|
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
|
9124
9746
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
9125
9747
|
<title>Kiru Devtools</title>
|
|
9126
|
-
<script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const eu="production",de=eu==="development",za=Symbol.for("kiru.signal"),nu=Symbol.for("kiru.context"),Ri=Symbol.for("kiru.contextProvider"),zt=Symbol.for("kiru.fragment"),Ha=Symbol.for("kiru.error"),Va=Symbol.for("kiru.memo"),to=Symbol.for("kiru.errorBoundary"),iu=Symbol.for("kiru.streamData"),su=Symbol.for("kiru.devFileLink"),ou=50,gn="kiru:deferred",ie=2,ae=4,Ni=8,le=16,Ba=32,ds=64,Ke=128,ru=/^on:?/,Wa=new Set(["animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","path","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","title","tspan","use"]),au=new Set(["allowfullscreen","autofocus","autoplay","async","checked","compact","controls","contenteditable","declare","default","defer","disabled","download","hidden","inert","ismap","multiple","nohref","noresize","noshade","novalidate","nowrap","open","popover","readonly","required","sandbox","scoped","selected","sortable","spellcheck","translate","wrap"]),lu=new Map([["acceptCharset","accept-charset"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["httpEquiv","http-equiv"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Re={current:null},ja={current:0},Ht={current:"window"in globalThis?"dom":"string"},cu={current:"dynamic"};var $a;class Ze extends Error{constructor(t){const n=typeof t=="string"?t:t.message;super(n),this[$a]=!0,typeof t!="string"&&(this.fatal=t?.fatal)}static isKiruError(t){return t instanceof Error&&t[Ha]===!0}}$a=Ha;const Qe={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Go(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Go(e,!1);const t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},uu=e=>{const t=e.target;!e.isTrusted||!t||Qe.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Go=(e,t)=>{for(const n in e)if(n.startsWith("on")){const i=n.substring(2);e[t?"addEventListener":"removeEventListener"](i,uu,{passive:!0})}};let eo=!1,ps=!1;const Ua=e=>{e.preventDefault(),e.stopPropagation(),ps=!0};let Oe=null;function hu(){eo=!0,Oe=document.activeElement,Oe&&Oe!==document.body&&Oe.addEventListener("blur",Ua)}function fu(){ps&&(Oe.removeEventListener("blur",Ua),Oe.isConnected&&Oe.focus(),ps=!1),eo=!1}function du(e){const t=e.type;return t=="#text"?Ya(e):Wa.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Ya(e){const{nodeValue:t}=e.props;if(!W.isSignal(t))return document.createTextNode(t);const n=t.peek()??"",i=document.createTextNode(n);return ms(e,i,t),i}function pu(e,t,n){const i=gs.get(e)??{},s=i[t]=o=>{if(eo){o.preventDefault(),o.stopPropagation();return}n(o)};return gs.set(e,i),s}const gs=new WeakMap;function Xa(e){const{dom:t,prev:n,props:i,cleanups:s}=e,o=n?.props??{},r=i??{},a=Ht.current==="hydrate";if(t instanceof Text){const f=r.nodeValue;!W.isSignal(f)&&t.nodeValue!==f&&(t.nodeValue=f);return}const l=[];for(const f in o)l.push(f);for(const f in r)f in o||l.push(f);for(let f=0;f<l.length;f++){const d=l[f],m=o[d],y=r[d];if(Cs.isEvent(d)){if(m!==y||a){const x=d.replace(ru,""),v=x==="focus"||x==="blur",w=gs.get(e);d in o&&t.removeEventListener(x,v?w?.[x]:m),d in r&&t.addEventListener(x,v?pu(e,x,y):y)}continue}if(!(Cs.isInternalProp(d)&&d!=="innerHTML")&&m!==y){if(W.isSignal(m)&&s){const x=s[d];x&&(x(),delete s[d])}if(W.isSignal(y)){xu(e,t,d,y,m);continue}gi(t,d,y,m)}}const c=o.ref,u=r.ref;c!==u&&(c&&Os(c,null),u&&Os(u,t))}function gu(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function qa(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(n=>{n.selected=t.indexOf(n.value)>-1})}const mu={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},bu=["progress","meter","number","range"];function xu(e,t,n,i,s){const o=e.cleanups??(e.cleanups={}),[r,a]=n.split(":");if(r!=="bind"){o[n]=i.subscribe((E,C)=>{E!==C&&gi(t,n,E,C)});const w=i.peek(),k=tn(s);if(w===k)return;gi(t,n,w,k);return}const l=mu[a];if(!l)return;const c=t instanceof HTMLSelectElement,u=c?w=>qa(t,w):w=>t[a]=w,f=w=>{u(w)},d=w=>{i.sneak(w),i.notify(k=>k!==f)};let m;if(a==="value"){const w=bu.indexOf(t.type)!==-1;m=()=>{let k=t.value;c?k=gu(t):typeof i.peek()=="number"&&w&&(k=t.valueAsNumber),d(k)}}else m=w=>{const k=w.target[a];a==="currentTime"&&i.peek()===k||d(k)};t.addEventListener(l,m);const y=i.subscribe(f);o[n]=()=>{t.removeEventListener(l,m),y()};const x=i.peek(),v=tn(s);x!==v&&gi(t,a,x,v)}function ms(e,t,n){(e.cleanups??(e.cleanups={})).nodeValue=n.subscribe((i,s)=>{i!==s&&(t.nodeValue=i)})}function yu(e){if(e.type!=="#text"||!W.isSignal(e.props.nodeValue))return;const t=tn(e.props.nodeValue);if(t!=null)return;const n=Ya(e);return Qe.parent().appendChild(n),n}function vu(e){const t=Qe.nextChild()??yu(e);if(!t)throw new Ze({message:"Hydration mismatch - no node found",vNode:e});let n=t.nodeName;if(Wa.has(n)||(n=n.toLowerCase()),e.type!==n)throw new Ze({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${n}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&le)){Xa(e);return}W.isSignal(e.props.nodeValue)&&ms(e,t,e.props.nodeValue);let i=e,s=e.sibling;for(;s&&s.type==="#text";){const o=s;Qe.bumpChildIndex();const r=String(tn(i.props.nodeValue)??""),a=i.dom.splitText(r.length);o.dom=a,W.isSignal(o.props.nodeValue)&&ms(o,a,o.props.nodeValue),i=s,s=s.sibling}}function Ga(e,t,n,i=!1){if(n===null)return e.removeAttribute(t),!0;switch(typeof n){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(i&&!n)return e.removeAttribute(t),!0}return!1}function _u(e,t,n){const i=au.has(t);Ga(e,t,n,i)||e.setAttribute(t,i&&typeof n=="boolean"?"":String(n))}const wu=["INPUT","TEXTAREA"],Su=e=>wu.indexOf(e.nodeName)>-1;function gi(e,t,n,i){switch(t){case"style":return Mu(e,n,i);case"className":return Tu(e,n);case"innerHTML":return ku(e,n);case"muted":e.muted=!!n;return;case"value":if(e.nodeName==="SELECT")return qa(e,n);const s=n==null?"":String(n);if(Su(e)){e.value=s;return}e.setAttribute("value",s);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!n;return}e.setAttribute("checked",String(n));return;default:return _u(e,Xu(t),n)}}function ku(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function Tu(e,t){const n=tn(t);if(!n)return e.removeAttribute("class");e.setAttribute("class",n)}function Mu(e,t,n){if(Ga(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let i={};typeof n=="string"?e.setAttribute("style",""):typeof n=="object"&&n&&(i=n);const s=t;new Set([...Object.keys(i),...Object.keys(s)]).forEach(r=>{const a=i[r],l=s[r];if(a!==l){if(l===void 0){e.style[r]="";return}e.style[r]=l}})}function Eu(e){let t=e.parent,n=t?.dom;for(;t&&!n;)t=t.parent,n=t?.dom;if(!n||!t){if(!e.parent&&e.dom)return e;throw new Ze({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function Cu(e,t){const{node:n,lastChild:i}=t,s=e.dom;if(i){i.after(s);return}const o=Ka(e,n);if(o){n.dom.insertBefore(s,o);return}n.dom.appendChild(s)}function Ka(e,t){let n=e;for(;n;){let i=n.sibling;for(;i;){if(!(i.flags&(ae|le))){const s=Ou(i);if(s?.isConnected)return s}i=i.sibling}if(n=n.parent,!n||n.flags&le||n===t)return}}function Ou(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&le)return;t=t.child}}function Pu(e){if(Ht.current==="hydrate")return Fi(e,wi);const t={node:e.dom?e:Eu(e)};bs(e,t,(e.flags&ae)>0),e.dom&&!(e.flags&le)&&Za(e,t,!1),wi(e)}function bs(e,t,n){let i=e.child;for(;i;){if(i.flags&ds){i.flags&ae&&Au(i,t),wi(i),i=i.sibling;continue}i.dom?(bs(i,{node:i},!1),i.flags&le||Za(i,t,n)):bs(i,t,(i.flags&ae)>0||n),wi(i),i=i.sibling}}function Za(e,t,n){(n||!e.dom.isConnected||e.flags&ae)&&Cu(e,t),(!e.prev||e.flags&ie)&&Xa(e),t.lastChild=e.dom}function Du(e){e===e.parent?.child&&(e.parent.child=e.sibling),Fi(e,t=>{const{hooks:n,subs:i,cleanups:s,dom:o,props:{ref:r}}=t;for(i?.forEach(a=>a()),s&&Object.values(s).forEach(a=>a());n?.length;)n.pop().cleanup?.();o&&(o.isConnected&&!(t.flags&le)&&o.remove(),r&&Os(r,null),delete t.dom)}),e.parent=null}function Au(e,t){if(!e.child)return;const n=[];if(Qa(e.child,n),n.length===0)return;const{node:i,lastChild:s}=t;if(s)s.after(...n);else{const o=Ka(e,i),r=i.dom;o?o.before(...n):r.append(...n)}t.lastChild=n[n.length-1]}function Qa(e,t){let n=e;for(;n;)n.dom?t.push(n.dom):n.child&&Qa(n.child,t),n=n.sibling}function g(e,t=null,...n){e===Tt&&(e=zt);const i=t===null?{}:t,s=dl(i.key),o=n.length;return o===1?i.children=n[0]:o>1&&(i.children=n),{type:e,key:s,props:i}}function Tt({children:e,key:t}){return{type:zt,key:dl(t),props:{children:e}}}function Ja(e){return typeof e=="function"&&typeof e[Va]?.arePropsEqual=="function"}function tl(e,t=null,n={},i=null,s=0){e===Tt&&(e=zt);const o=t?t.depth+1:0;return{type:e,key:i,props:n,parent:t,index:s,depth:o,flags:0,child:null,sibling:null,prev:null,deletions:null}}function no(e,t){return Array.isArray(t)?Lu(e,t):Iu(e,t)}function Iu(e,t){const n=e.child;if(n===null)return il(e,t);const i=n.sibling,s=el(e,n,t);if(s!==null)return n&&n!==s&&!s.prev?xs(e,n):i&&xs(e,i),s;{const o=rl(n),r=sl(o,e,0,t);if(r!==null){const a=r.prev;if(a!==null){const l=a.key;o.delete(l===null?a.index:l)}mi(r,0,0)}return o.forEach(a=>vi(e,a)),r}}function Lu(e,t){let n=null,i=null,s=e.child,o=null,r=0,a=0;for(;s!==null&&a<t.length;a++){s.index>a?(o=s,s=null):o=s.sibling;const c=el(e,s,t[a]);if(c===null){s===null&&(s=o);break}s&&!c.prev&&vi(e,s),r=mi(c,r,a),i===null?n=c:i.sibling=c,i=c,s=o}if(a===t.length)return xs(e,s),n;if(s===null){for(;a<t.length;a++){const c=il(e,t[a]);c!==null&&(r=mi(c,r,a),i===null?n=c:i.sibling=c,i=c)}return n}const l=rl(s);for(;a<t.length;a++){const c=sl(l,e,a,t[a]);if(c!==null){const u=c.prev;if(u!==null){const f=u.key;l.delete(f===null?u.index:f)}r=mi(c,r,a),i===null?n=c:i.sibling=c,i=c}}return l.forEach(c=>vi(e,c)),n}function el(e,t,n){const i=t===null?null:t.key;return so(n)?i!==null||t?.type==="#text"&&W.isSignal(t.props.nodeValue)?null:Ko(e,t,""+n):W.isSignal(n)?t&&t.props.nodeValue!==n?null:Ko(e,t,n):io(n)?n.key!==i?null:Ru(e,t,n):Array.isArray(n)?i!==null?null:nl(e,t,n):null}function Ko(e,t,n){return t===null||t.type!=="#text"?Nt(e,"#text",{nodeValue:n}):(t.props.nodeValue!==n&&(t.props.nodeValue=n,t.flags|=ie),t.sibling=null,t)}function Ru(e,t,n){let{type:i,props:s,key:o}=n;return i===zt?nl(e,t,s.children||[],s):t?.type===i?(t.index=0,t.sibling=null,typeof i=="string"?ol(t.props,s)&&(t.flags|=ie):t.flags|=ie,t.props=s,t):Nt(e,i,s,o)}function nl(e,t,n,i={}){return t===null||t.type!==zt?Nt(e,zt,{children:n,...i}):(t.props={...t.props,...i,children:n},t.flags|=ie,t.sibling=null,t)}function il(e,t){return so(t)?Nt(e,"#text",{nodeValue:""+t}):W.isSignal(t)?Nt(e,"#text",{nodeValue:t}):io(t)?Nt(e,t.type,t.props,t.key):Array.isArray(t)?Nt(e,zt,{children:t}):null}function mi(e,t,n){e.index=n;const i=e.prev;if(i!==null){const s=i.index;return s<t?(e.flags|=ae,t):s}else return e.flags|=ae,t}function sl(e,t,n,i){if(W.isSignal(i)||so(i)){const o=e.get(n);if(o){if(o.props.nodeValue===i)return o;o.type==="#text"&&W.isSignal(o.props.nodeValue)&&o.cleanups?.nodeValue?.()}return Nt(t,"#text",{nodeValue:i},null,n)}if(io(i)){const{type:o,props:r,key:a}=i,l=e.get(a===null?n:a);return l?.type===o?(typeof o=="string"?ol(l.props,r)&&(l.flags|=ie):l.flags|=ie,l.props=r,l.sibling=null,l.index=n,l):Nt(t,o,r,a,n)}if(Array.isArray(i)){const o=e.get(n);return o?(o.flags|=ie,o.props.children=i,o):Nt(t,zt,{children:i},null,n)}return null}function ol(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!0;for(let s of n)if(!(s==="children"||s==="key")&&e[s]!==t[s])return!0;return!1}function rl(e){const t=new Map;for(;e;){const n=e.key;t.set(n===null?e.index:n,e),e=e.sibling}return t}function vi(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function xs(e,t){for(;t;)vi(e,t),t=t.sibling}function Nt(e,t,n,i=null,s=0){const o=tl(t,e,n,i,s);return o.flags|=ae,typeof t=="function"&&Ja(t)&&(o.flags|=Ba,o.arePropsEqual=t[Va].arePropsEqual),o}let Xt=[],Je=!1,ys=[],vs=[],_s=!1,ws=!1,Ss=!1,ks=0,al=[],Ts=[],ll=-1;function Nu(e){if(Je){ys.push(e);return}e()}function cl(){Je&&(window.cancelAnimationFrame(ll),ul())}function Zo(e){e.flags|=Ke,Xt.push(e),Je=!0,cl()}function zn(e){if(Ht.current==="hydrate")return Nu(()=>Ms(e));Ms(e)}function Fu(){Je||(Je=!0,ll=window.requestAnimationFrame(ul))}function zu(){for(Je=!1;ys.length;)ys.shift()()}function Ms(e){if(_s&&(ws=!0),Re.current===e){Ss=!0;return}if(!(e.flags&(Ke|Ni))){if(e.flags|=Ke,!Xt.length)return Xt.push(e),Fu();Xt.push(e)}}function Hu(e){Fi(e,t=>t.flags|=Ni),vs.push(e)}const Vu=(e,t)=>t.depth-e.depth;let te=null;function ul(){let e=1;for(hu();Xt.length;){Xt.length>e&&Xt.sort(Vu),te=Xt.shift(),e=Xt.length;const t=te.flags;if(!(t&Ni)&&t&Ke){let n=te;for(;n=Bu(n););for(;vs.length;)Du(vs.pop());Pu(te),te.flags&=~Ke}}if(fu(),_s=!0,Ji(al),_s=!1,ws)return Uu(),Ji(Ts),ws=!1,ks++,cl();ks=0,zu(),Ji(Ts)}function Bu(e){let t=!0;try{typeof e.type=="string"?$u(e):Gu(e.type)?Wu(e):t=ju(e)}catch(i){const s=th(e);if(s){const o=s.error=i instanceof Error?i:new Error(String(i));return s.props.onError?.(o),s.depth<te.depth&&(te=s),s}if(Ze.isKiruError(i)){if(i.customNodeStack&&setTimeout(()=>{throw new Error(i.customNodeStack)}),i.fatal)throw i;console.error(i);return}setTimeout(()=>{throw i})}if(e.deletions!==null&&(e.deletions.forEach(Hu),e.deletions=null),t&&e.child)return e.child;let n=e;for(;n;){if(n.immediateEffects&&(al.push(...n.immediateEffects),n.immediateEffects=void 0),n.effects&&(Ts.push(...n.effects),n.effects=void 0),n===te)return;if(n.sibling)return n.sibling;n=n.parent,Ht.current==="hydrate"&&n?.dom&&Qe.pop()}}function Wu(e){const{props:t,type:n}=e;let i=t.children;if(n===Ri){const{props:{dependents:s,value:o},prev:r}=e;s.size&&r&&r.props.value!==o&&s.forEach(Ms)}else if(n===to){const s=e,{error:o}=s;o&&(i=typeof t.fallback=="function"?t.fallback(o):t.fallback,delete s.error)}e.child=no(e,i)}function ju(e){const{type:t,props:n,subs:i,prev:s,flags:o}=e;if(o&Ba){if(e.memoizedProps=n,s?.memoizedProps&&e.arePropsEqual(s.memoizedProps,n)&&!e.hmrUpdated)return e.flags|=ds,!1;e.flags&=~ds}try{Re.current=e;let r,a=0;do e.flags&=~Ke,Ss=!1,ja.current=0,i&&(i.forEach(l=>l()),i.clear()),r=t(n);while(Ss);return e.child=no(e,r),!0}finally{Re.current=null}}function $u(e){const{props:t,type:n}=e;e.dom||(Ht.current==="hydrate"?vu(e):e.dom=du(e)),n!=="#text"&&(e.child=no(e,t.children),e.child&&Ht.current==="hydrate"&&Qe.push(e.dom))}function Uu(){if(ks>ou)throw new Ze("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function Ji(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var Qo;(function(e){e.Start="start",e.End="end"})(Qo||(Qo={}));const pe=()=>{const e=hl("useRequestUpdate");return()=>zn(e)};function _t(e,t,n){const i=hl(e),s=(a,l)=>{if(l?.immediate){(i.immediateEffects??(i.immediateEffects=[])).push(a);return}(i.effects??(i.effects=[])).push(a)},o=ja.current++;let r=i.hooks?.at(o);try{const a=r??(typeof t=="function"?t():{...t});return i.hooks??(i.hooks=[]),i.hooks[o]=a,n({hook:a,isInit:!r,update:()=>zn(i),queueEffect:s,vNode:i,index:o})}catch(a){throw a}}function hl(e){const t=Re.current;if(!t)throw new Ze(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`);return t}function Hn(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function He(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((n,i)=>!Object.is(n,e[i]))}const Es={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},Ye=new Map;var fl;class W{constructor(t,n){this[fl]=!0,this.$id=nh(),this.$value=t,n&&(this.displayName=n),this.$subs=new Set}get value(){return this.onBeforeRead?.(),W.entangle(this),this.$value}set value(t){Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),this.$value}sneak(t){this.$prevValue=this.$value,this.$value=t}toString(){return this.onBeforeRead?.(),W.entangle(this),\`\${this.$value}\`}subscribe(t){return this.$subs.add(t),()=>this.$subs.delete(t)}notify(t){this.$subs.forEach(n=>{if(!(t&&!t(n)))return n(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&za in t}static subscribers(t){return t.$subs}static makeReadonly(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&!n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},configurable:!0})}static makeWritable(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},set:function(i){this.$value=i,this.notify()},configurable:!0})}static entangle(t){const n=Re.current,i=Es.current();if(i){(!n||n&&yt())&&i.set(t.$id,t);return}if(!n||!yt())return;const s=t.subscribe(()=>zn(n));(n.subs??(n.subs=new Set)).add(s)}static configure(t,n){t.onBeforeRead=n}static dispose(t){t.$isDisposed=!0,t.$subs.clear()}}fl=za;const G=(e,t)=>new W(e,t),J=(e,t)=>_t("useSignal",{signal:null},({hook:n,isInit:i,isHMR:s})=>(i&&(n.cleanup=()=>W.dispose(n.signal),n.signal=new W(e,t)),n.signal));function tn(e,t=!1){return W.isSignal(e)?t?e.value:e.peek():e}const Yu=()=>{Ye.forEach(e=>e()),Ye.clear()};function _i(...e){return e.filter(Boolean).join(" ")}const Jo=new Set(["children","ref","key","innerHTML"]),Cs={isInternalProp:e=>Jo.has(e),isEvent:e=>e.startsWith("on"),isStringRenderableProperty:e=>!Jo.has(e)&&!Cs.isEvent(e)};function Xu(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():lu.get(e)||e}}const tr=Object.freeze(()=>{});function Os(e,t){if(typeof e=="function"){e(t);return}if(W.isSignal(e)){e.value=t;return}e.current=t}function yt(){return Ht.current==="dom"||Ht.current==="hydrate"}function qu(e){return(e.flags&Ni)!==0}function io(e){return typeof e=="object"&&e!==null&&"type"in e}function so(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function Gu(e){return e===zt||e===Ri||e===to}function Ku(e){return e.type===zt}function Zu(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.lazy"}function Qu(e){return typeof e.type=="function"&&Ja(e.type)}function wi(e){const{props:{children:t,...n},key:i,memoizedProps:s,index:o}=e;e.prev={props:n,key:i,memoizedProps:s,index:o},e.flags&=-15}function Fi(e,t){t(e);let n=e.child;for(;n;)t(n),n.child&&Fi(n,t),n=n.sibling}function Ju(e,t){let n=e.parent;for(;n;){if(t(n))return n;n=n.parent}return null}function th(e){return Ju(e,t=>t.type===to)}function dl(e){return e===void 0?null:typeof e=="string"||typeof e=="number"?e:null}const eh="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function nh(e=10,t=eh){let n="";for(let i=0;i<e;i++)n+=t[Math.random()*t.length|0];return n}function ih(){const e=new Set,t=new WeakMap,n=new Map;function i(a,l,c){n.get(a)?.forEach(u=>u(l,c))}function s(a,l){n.has(a)||n.set(a,new Set),n.get(a).add(l)}function o(a,l){n.get(a)?.delete(l)}const r={get apps(){return Array.from(e)},emit:i,on:s,off:o};return s("mount",(a,l)=>{e.add(a),l&&typeof l=="function"&&t.set(a,{requestUpdate:l})}),s("unmount",a=>{e.delete(a),t.delete(a)}),r}function sh(e){const{id:t,subs:n,fn:i,deps:s=[],onDepChanged:o}=e;let r;Ye.delete(t);const a=!!Re.current&&!yt();a||(r=new Map,Es.stack.push(r));const l=i(...s.map(c=>c.value));if(!a){for(const[u,f]of n)r.has(u)||(f(),n.delete(u));const c=()=>{Ye.size||queueMicrotask(Yu),Ye.set(t,o)};for(const[u,f]of r){if(n.has(u))continue;const d=f.subscribe(c);n.set(u,d)}Es.stack.pop()}return l}class Ee extends W{constructor(t,n){super(void 0,n),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,W.configure(this,()=>{this.$isDirty&&Ee.run(this)})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&Ee.run(this),super.subscribe(t)}static dispose(t){Ee.stop(t),W.dispose(t)}static updateGetter(t,n){const i=t;i.$getter=n,i.$isDirty=!0,Ee.run(i),!Object.is(i.$value,i.$prevValue)&&i.notify()}static stop(t){const{$id:n,$unsubs:i}=t;Ye.delete(n),i.forEach(s=>s()),i.clear(),t.$isDirty=!0}static run(t){const n=t,{$id:i,$getter:s,$unsubs:o}=n,r=sh({id:i,subs:o,fn:()=>s(n.$value),onDepChanged:()=>{n.$isDirty=!0,t.$subs.size&&(Ee.run(n),!Object.is(n.$value,n.$prevValue)&&n.notify())}});n.sneak(r),n.$isDirty=!1}}function Vn(e,t){return new Ee(e,t)}let oh=0;function rh(e,t,n){const i=ah(t),s=oh++,o={id:s,name:\`App-\${s}\`,rootNode:i,render:r,unmount:a};function r(l){i.props.children=l,Zo(i)}function a(){i.props.children=null,Zo(i),window.__kiru.emit("unmount",o)}return r(e),window.__kiru.emit("mount",o,zn),o}function ah(e){const t=tl(e.nodeName.toLowerCase());return t.flags|=le,t.dom=e,t}function ge(e){return yt()?_t("useState",{state:void 0,dispatch:tr},({hook:t,isInit:n,update:i,isHMR:s})=>(n&&(t.state=typeof e=="function"?e():e,t.dispatch=o=>{const r=typeof o=="function"?o(t.state):o;Object.is(t.state,r)||(t.state=r,i())}),[t.state,t.dispatch])):[typeof e=="function"?e():e,tr]}function lh(e){const t={[nu]:!0,Provider:({value:n,children:i})=>{const[s]=ge(()=>new Set);return g(Ri,{value:n,ctx:t,dependents:s},typeof i=="function"?i(n):i)},default:()=>e,set displayName(n){this.Provider.displayName=n},get displayName(){return this.Provider.displayName||"Anonymous Context"}};return t}function Xe(e,t){return yt()?_t("useCallback",{callback:e,deps:t},({hook:n,isHMR:i})=>(He(t,n.deps)&&(n.deps=t,n.callback=e),n.callback)):e}function ch(e,t=!0){return _t("useContext",{context:e,warnIfNotFound:t},uh)}const uh=({hook:e,isInit:t,vNode:n})=>{if(t){let i=n.parent;for(;i;){if(i.type===Ri){const s=i,{ctx:o,value:r,dependents:a}=s.props;if(o===e.context)return a.add(n),e.cleanup=()=>a.delete(n),e.provider=s,r}i=i.parent}}return e.provider?e.provider.props.value:e.context.default()};function rt(e,t){if(yt())return _t("useEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||He(t,n.deps))&&(n.deps=t,Hn(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)}))})}function pl(){return _t("useId",hh,fh)}const hh=()=>({id:"",idx:0}),fh=({hook:e,isInit:t,vNode:n})=>{if(t||n.index!==e.idx){e.idx=n.index;const i=[];let s=n;for(;s;)i.push(s.index),i.push(s.depth),s=s.parent;e.id=\`k:\${BigInt(i.join("")).toString(36)}\`}return e.id};function oo(e,t){if(yt())return _t("useLayoutEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||He(t,n.deps))&&(n.deps=t,Hn(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)},{immediate:!0}))})}function Si(e,t){return yt()?_t("useMemo",{deps:t,value:void 0},({hook:n,isInit:i,isHMR:s})=>((i||He(t,n.deps))&&(n.deps=t,n.value=e()),n.value)):e()}const er=new WeakMap;function dh(e,t){const n=pl(),i=J(!0);return _t("usePromise",{},({hook:s,isInit:o,vNode:r,update:a})=>{if(o||He(t,s.deps)){i.value=!0,s.deps=t,Hn(s);const l=s.abortController=new AbortController;s.cleanup=()=>l.abort();const c=er.get(r)??0;er.set(r,c+1);const u=\`\${n}:data:\${c}\`;let f;Ht.current==="string"?f=Promise.resolve():Ht.current==="hydrate"&&cu.current==="dynamic"?f=ph(u,l.signal):f=e(l.signal);const d={id:u,state:"pending"},m=s.promise=Object.assign(f,d,{isPending:i,refresh:()=>{s.deps=void 0,a()}});m.then(y=>{m.state="fulfilled",m.value=y,i.value=!1}).catch(y=>{m.state="rejected",m.error=y instanceof Error?y:new Error(y)})}return s.promise})}function ph(e,t){return new Promise((n,i)=>{const s=window[gn]??(window[gn]=new Map),o=s.get(e);if(o){const{data:a,error:l}=o;return s.delete(e),l?i(l):n(a)}const r=a=>{const{detail:l}=a;if(l.id===e){s.delete(e),window.removeEventListener(gn,r);const{data:c,error:u}=l;if(u)return i(u);n(c)}};window.addEventListener(gn,r),t.addEventListener("abort",()=>{window.removeEventListener(gn,r),i()})})}function Ne(e){return yt()?_t("useRef",{ref:{current:e}},({hook:t,isInit:n,isHMR:i})=>t.ref):{current:e}}function nr(e){return e instanceof Promise&&"id"in e&&"state"in e}function Ps(e){const{from:t,children:n,fallback:i,mode:s}=e,o=Ne(null),r=new Set;let a;if(nr(t))r.add(t),a=t.value;else if(W.isSignal(t))a=t.value;else{const l={};for(const c in t){const u=t[c];nr(u)&&r.add(u),l[c]=u.value}a=l}if(r.size===0)return n(a);if(!yt())throw{[iu]:{fallback:i,data:Array.from(r)}};for(const l of r){if(l.state==="rejected")throw l.error;if(l.state==="pending"){const c=Re.current;return Promise.allSettled(r).then(()=>zn(c)),s!=="fallback"&&o.current?n(o.current,!0):i}}return o.current=a,n(a,!1)}"window"in globalThis&&(window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map));var ir;"window"in globalThis&&!globalThis.__KIRU_DEVTOOLS__&&((ir=globalThis.window).__kiru??(ir.__kiru=ih()));function gh(e,t){if(!e)throw new Error(t)}function mh(...e){return e.filter(Boolean).join(" ")}function ro(e,t,n){let i=e;for(let s=0;s<t.length;s++){const o=t[s];s===t.length-1?i[o]=n:i=i[o]}}function ao(e){return e.type.displayName??(e.type.name||"Anonymous Function")}const bh=e=>e[su]??null;function An(e){return e.name==="kiru.devtools"}function gl(e){return Array.from(e.entries())}function xh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},g("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),g("path",{d:"M12 9v11"}),g("path",{d:"M2 9h13a2 2 0 0 1 2 2v9"}))}function ce(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"m9 18 6-6-6-6"}))}function yh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),g("circle",{cx:"12",cy:"12",r:"3"}))}function vh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}),g("path",{d:"m21 3-9 9"}),g("path",{d:"M15 3h6v6"}))}function _h(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z"}),g("path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z"}),g("path",{d:"M3 5a2 2 0 0 0 2 2h3"}),g("path",{d:"M3 3v13a2 2 0 0 0 2 2h3"}))}function wh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"m12 14 4-4"}),g("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}))}function Sh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("circle",{cx:"12",cy:"12",r:"10"}),g("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),g("path",{d:"M2 12h20"}))}function ml(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),g("path",{d:"M21 3v5h-5"}),g("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),g("path",{d:"M8 16H3v5"}))}function kh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},g("path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z"}),g("path",{d:"M6 18h12"}),g("path",{d:"M6 14h12"}),g("rect",{width:"12",height:"12",x:"6",y:"10"}))}function Th(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),g("path",{d:"M8 12h8"}),g("path",{d:"m12 16 4-4-4-4"}))}function lo(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),g("path",{d:"M12 9v4"}),g("path",{d:"M12 17h.01"}))}function bl({title:e,children:t,className:n,disabled:i,...s}){const[o,r]=ge(!0);rt(()=>{!o&&i&&r(!0)},[i]);const a=Xe(l=>{l.preventDefault(),l.stopImmediatePropagation(),r(c=>!c)},[]);return g("div",{className:"flex flex-col"},g("button",{onclick:a,disabled:i,className:\`\${i?"opacity-50 cursor-default":"cursor-pointer"}\`},g("span",{className:"flex items-center gap-2 font-medium"},g(ce,{className:\`transition \${o?"":"rotate-90"}\`}),e)),o?null:g("div",{className:\`p-2 \${n||""}\`,...s},t))}const co={arrayChunkSize:10,objectKeysChunkSize:100};function xl(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;const n=new Set([...Object.keys(e),...Object.keys(t)]);for(const i in n)if(typeof t[i]!=typeof e[i]||typeof e[i]=="object"&&!xl(e[i],t[i]))return!1;return!0}function yl(e,t,n){for(const i in t)typeof e[i]>"u"&&(e[i]=structuredClone(t[i]));for(const i in e)typeof e[i]=="object"?yl(e[i],t[i],n):n(e,i,e[i])}let vl={...co};const sr=localStorage.getItem("kiru.devtools.userSettings");if(sr)try{const e=JSON.parse(sr);xl(co,e)&&(vl=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}const _l=lh({userSettings:null,saveUserSettings:()=>{}}),zi=()=>ch(_l);function Mh({children:e}){const[t,n]=ge(vl),i=s=>{localStorage.setItem("kiru.devtools.userSettings",JSON.stringify(s)),n(s)};return g(_l.Provider,{value:{userSettings:t,saveUserSettings:i}},e)}function Eh(){const{userSettings:e,saveUserSettings:t}=zi();return g("div",{className:"rounded bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 overflow-hidden"},g(me,{border:!1,data:e,onChange:(n,i)=>{const s={...e};ro(s,n,i),yl(s,co,(o,r,a)=>{o[r]=a<1?1:a}),t(s)},mutable:!0,objectRefAcc:[]}))}const Ch=Object.freeze(()=>{});function me({data:e,onChange:t,mutable:n,objectRefAcc:i,keys:s=[],className:o,border:r=!0}){const{userSettings:{objectKeysChunkSize:a}}=zi(),[l,c]=ge(0),u=Si(()=>Object.keys(e).slice(0,(l+1)*a),[l,a,e]),f=()=>{u.forEach(m=>{typeof e[m]=="object"&&i.splice(i.indexOf(e[m]),1)}),c(l+1)},d=u.length<Object.keys(e).length;return g(Tt,null,g("div",{className:mh("flex flex-col items-start w-full",r&&"border border-neutral-700",tn(o))},u.map(m=>{const y=s.concat(m),x=y.join(".");return g("div",{key:x,"data-key":x,className:"flex flex-col items-start w-full gap-2 pl-2 py-1 pr-1 border-b border-neutral-700 last:border-b-0"},g(uo,{value:e[m],onChange:t,keys:y,path:x,label:m,mutable:n,objectRefAcc:i}))})),d&&g("button",{onclick:f,title:"Show more",className:"p-1 border font-bold border-neutral-700 hover:bg-neutral-700"},g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},g("circle",{cx:"12",cy:"12",r:"1"}),g("circle",{cx:"19",cy:"12",r:"1"}),g("circle",{cx:"5",cy:"12",r:"1"}))))}function ki(e,t){Array.isArray(e)?(t(e),e.forEach(n=>ki(n,t))):typeof e=="object"&&e!==null&&(t(e),Object.values(e).forEach(n=>ki(n,t)))}function uo({value:e,onChange:t,keys:n,path:i,mutable:s,objectRefAcc:o,label:r}){const{userSettings:{arrayChunkSize:a}}=zi(),[l,c]=ge(!0),u=r!==void 0&&g("label",{htmlFor:i,className:"text-xs truncate",title:i,children:r});if(e===null)return g(mt,null,u,g(Qt,null,"null"));if(e===void 0)return g(mt,null,u,g(Qt,null,"undefined"));const f=window.opener?window.opener.Node:Node;if(e instanceof f)return g(mt,null,u,g(Qt,null,"<",g("span",{style:{color:"#f0a05e"}},e.nodeName),"/>"));const d=window.opener?window.opener.Error:Error;if(e instanceof d)return g(mt,null,u,"cause"in e&&e.cause?g(Qt,null,e.message," (",String(e.cause),")"):g(Qt,null,e.message));const m=y=>t(n,y);switch(typeof e){case"string":return g(mt,null,u,g(ts,{disabled:!s,id:i,type:"text",value:e,onchange:y=>m(y.target.value)}));case"number":return g(mt,null,u,g(ts,{disabled:!s,id:i,type:"number",value:e,placeholder:"NaN",onchange:y=>m(Number(y.target.value))}));case"bigint":return g(mt,null,u,g(ts,{disabled:!s,id:i,type:"number",value:e.toString(),onchange:y=>m(BigInt(y.target.value))}));case"boolean":return g(mt,null,u,g("input",{disabled:!s,id:i,type:"checkbox",checked:e,onchange:y=>m(y.target.checked),className:"accent-red-500"}));case"function":return g(mt,null,u,g(Qt,null,\`\u0192 \${e.name||"anonymous"}()\`));default:return Array.isArray(e)?g(mt,null,g("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{ki(e,y=>o.splice(o.indexOf(y),1)),c(y=>!y)}},r,g(ce,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?g(Qt,null,"Array(",e.length,")"):e.length>a?g(Oh,{array:e,objectRefAcc:o}):g("div",{className:"flex flex-col items-start gap-1 w-full"},e.map((y,x)=>g(uo,{value:y,onChange:t,keys:[...n,x.toString()],path:i.concat(".",x.toString()),label:x.toString(),mutable:s,objectRefAcc:o})))):o.includes(e)?g(mt,null,u,g(Qt,null,"Object(circular reference)")):(o.push(e),g(mt,null,g("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{ki(e,y=>o.splice(o.indexOf(y),1)),c(y=>!y)}},r,g(ce,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?null:g(me,{data:e,onChange:t,keys:n,mutable:s,objectRefAcc:o})))}}function mt({children:e}){return g("div",{className:"flex flex-col items-start gap-1 w-full"},e)}function ts(e){return g("input",{className:"flex-grow text-xs px-2 py-1 text-neutral-300 w-full",...e})}function Qt({children:e}){return g("small",{className:"text-neutral-300"},g("i",null,e))}function Oh({array:e,objectRefAcc:t}){const{userSettings:{arrayChunkSize:n}}=zi(),i=e.length,s=Math.ceil(i/n);return g("div",{className:"flex flex-col items-start gap-1 w-full"},Array.from({length:s}).map((o,r)=>g(Ph,{array:e,range:{start:r*n,end:(r+1)*n},objectRefAcc:t})))}function Ph({array:e,range:t,objectRefAcc:n}){const[i,s]=ge(!0);let o;return i?o=void 0:o=e.slice(t.start,t.end),g("div",{className:"flex flex-col items-start gap-1 w-full"},g("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",onclick:()=>{n.splice(n.indexOf(e),1),s(r=>!r)}},"[",t.start,"..",(t.end<e.length?t.end:e.length)-1,"]",g(ce,{width:10,height:10,className:\`transition \${i?"":"rotate-90"}\`})),o&&g("div",{className:"flex flex-col items-start gap-1 w-full"},o.map((r,a)=>g(uo,{value:r,onChange:Ch,label:(t.start+a).toString(),keys:[a.toString()],path:a.toString(),mutable:!1,objectRefAcc:n}))))}const Dh="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??=null,window.__devtoolsNodeUpdatePtr??=null);class Ah extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}}const Fe=new Ah(Dh);function Hi({fn:e,onclick:t}){const n=Si(()=>bh(e),[e]);return n?g("a",{className:"flex items-center gap-1 text-[10px] opacity-50 hover:opacity-100 transition-opacity",href:n,onclick:i=>{i.preventDefault(),Fe.send({type:"open-editor",fileLink:n}),t?.(i)},title:"Open in editor"},"Open in editor",g(vh,{width:"0.65rem",height:"0.65rem"})):null}function Ih({selectedApp:e,selectedNode:t,setSelectedNode:n,kiruGlobal:i}){const s=pe();rt(()=>{const l=c=>{c===e&&(qu(t)?n(null):s())};return i?.on("update",l),()=>i?.off("update",l)},[]);const o=()=>{const l=window.opener;if(!t||!l){console.error("invalid refresh state",{w:l,selectedNode:t});return}l.__devtoolsNodeUpdatePtr=t,Fe.send({type:"update-node"}),console.debug("[kiru]: sent refresh message",t)},r={...t.props};delete r.children;const a=Nh(t);return g("div",{className:"flex-grow p-2 sticky top-0"},g("h2",{className:"flex justify-between items-center font-bold mb-2 pb-2 border-b-2 border-neutral-800"},g("div",{className:"flex gap-2 items-center"},"<"+ao(t)+">",g(Hi,{fn:t.type})),g("button",{onclick:o},g(ml,{className:"w-5 h-5"}))),g(bl,{title:"props",disabled:Object.keys(r).length===0},g(me,{data:r,onChange:()=>{},mutable:!1,objectRefAcc:[]})),g(wl,{node:a,selectedApp:e}))}function Lh(e){return e.name==="devtools:useHookDebugGroup"}function Rh(e){return Ds in e}const Ds=Symbol.for("devtools.hookGroup");function Nh(e){const t={parent:null,name:"hooks",children:[],[Ds]:!0};if(e.hooks?.length){let n=t;for(let i=0;i<e.hooks.length;i++){const s=e.hooks[i];if(Lh(s)){switch(s.action){case"start":const o={parent:n,name:s.displayName,children:[],[Ds]:!0};n.children.push(o),n=o;break;case"end":if(n.name!==s.displayName||n.parent===null)throw new Error("useHookDebugGroup:end called with no start");n=n.parent;break}continue}n.children.push(s)}}return t}function wl({node:e,selectedApp:t,depth:n=0}){if(Rh(e))return g(bl,{title:e.name,className:"bg-[#ffffff04] border border-[#fff1] flex flex-col gap-2 pl-6",disabled:e.children.length===0},e.children.map(u=>g(wl,{node:u,selectedApp:t,depth:n+1})));const{name:i,dev:s,cleanup:o,...r}=e,a=s?.devtools,l=typeof a?.get=="function"?a.get():r;return g("div",null,g("i",{className:"text-neutral-300 text-sm"},i||"anonymous hook"),g("div",{className:"p-2"},g(me,{data:l,onChange:(u,f)=>{if(!t||!a?.set||!a?.get)return;const d=a.get();ro(d,u,f),a.set(d)},mutable:!!a?.set,objectRefAcc:[]})))}const Ae=(e,t,n={})=>{rt(()=>{let i=window;const s=n?.ref?.();return s?i=s:n.ref&&console.warn("useEventListener ref failed, using window"),i.addEventListener(e,t,n),()=>{i.removeEventListener(e,t,n)}},[t])},Fh=()=>{const e=J({x:0,y:0}),t=J({x:0,y:0}),n=J({x:0,y:0});return Ae("mousemove",i=>{e.value={x:i.x,y:i.y},t.value={x:i.movementX,y:i.movementY},n.value={x:i.clientX,y:i.clientY}}),{mouse:e,delta:t,client:n}},Qn="window"in globalThis&&"ResizeObserver"in globalThis.window,zh=(e,t,n=void 0)=>yt()?Qn?_t("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i&&(s.resizeObserver=new ResizeObserver(t),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null}),o(()=>{He([e.current],s.deps)&&(s.deps=[e.current],s.resizeObserver?.disconnect?.(),e.current&&s.resizeObserver?.observe(e.current,n))}),{isSupported:Qn,start:()=>{s.resizeObserver==null&&(s.resizeObserver=new ResizeObserver(t),e.current&&s.resizeObserver.observe(e.current,n),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null})},stop:()=>{Hn(s)}})):{isSupported:Qn,start:()=>{},stop:()=>{}}:{isSupported:Qn,start:()=>{},stop:()=>{}},Jn="window"in globalThis&&"MutationObserver"in globalThis.window,Hh=(e,t,n=void 0)=>yt()?Jn?_t("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i?(o(()=>{s.deps=[e.current],s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n)}),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null}):He([e.current],s.deps)&&(s.deps=[e.current],s.mutationObserver?.disconnect?.(),e.current&&s.mutationObserver?.observe(e.current,n)),{isSupported:Jn,start:()=>{s.mutationObserver==null&&(s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null})},stop:()=>{Hn(s)}})):{isSupported:Jn,start:()=>{},stop:()=>{}}:{isSupported:Jn,start:()=>{},stop:()=>{}},Vh=(e,t={windowScroll:!0,windowResize:!0})=>{const n=t?.windowScroll??!0,i=t?.windowResize??!0,s=t.immediate??!0,o=J(0),r=J(0),a=J(0),l=J(0),c=J(0),u=J(0),f=J(0),d=J(0),m=()=>{const y=e.current;if(!y){o.value=0,r.value=0,a.value=0,l.value=0,c.value=0,u.value=0,f.value=0,d.value=0;return}const x=y.getBoundingClientRect();o.value=x.width,r.value=x.height,a.value=x.top,l.value=x.right,c.value=x.bottom,u.value=x.left,f.value=x.x,d.value=x.y};return zh(e,m),Hh(e,m,{attributeFilter:["style","class"]}),Ae("scroll",()=>{n&&m()},{capture:!0,passive:!0}),Ae("resize",()=>{i&&m()},{passive:!0}),oo(()=>{s&&m()},[]),{width:o,height:r,top:a,right:l,bottom:c,left:u,x:f,y:d,update:m}};function Bh(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}const or=(e,t,n={})=>{const{ref:i,eventName:s="keydown",passive:o=!1}=n,r=Bh(e);return Ae(s,l=>{l.repeat&&!n.repeat||r(l)&&t(l)},{ref:i,passive:o})};function ho({value:e,className:t,...n}){const i=pl();return g("div",{className:_i("w-full p-2 z-10","bg-[#1d1d1d] border border-white border-opacity-10 rounded",t?.toString()),...n},g("input",{className:_i("px-2 py-1 w-full rounded focus:outline focus:outline-primary","bg-[#212121] border border-white border-opacity-10 rounded"),placeholder:"Filter...",type:"text",autocomplete:i+Math.random().toString(36).substring(2,15),name:"filter-search",id:"filter-search","bind:value":e}))}let U;"window"in globalThis&&window.opener&&(U=window.opener.__kiru);const qe=G(!1);Fe.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(qe.value=e.data.value)});const Sl=(U?.apps??[]).filter(e=>!An(e)),se=G(Sl);G(null);const Lt=G(Sl[0]??null),oe=G(null);U?.on("mount",e=>{An(e)||(se.value=[...se.peek(),e],Lt.peek()===null&&(Lt.value=e))});U?.on("unmount",e=>{se.value=se.peek().filter(t=>t!==e),Lt.peek()===e&&(Lt.value=se.peek()[0]??null)});const As=G(new Map),Rt=G(null),fo=G("");function Wh(e){return e.type.displayName??(e.type.name||"Anonymous Function")}function jh(e,t){const n=t.toLowerCase();return e.every(i=>n.includes(i))}function Is(e){return typeof e.type=="function"&&!Ku(e)&&!Zu(e)&&!Qu(e)}function $h(e){let t=[e];for(;t.length;){const n=t.pop();if(Is(n))return!0;n.child&&t.push(n.child),n.sibling&&t.push(n.sibling)}return!1}const Uh=(e,t)=>{const n=[t.parent];for(;n.length;){const i=n.pop();if(e===i)return!0;i?.parent&&n.push(i.parent)}return!1};function Ls(e,t){if(!e)return null;const n=t(e),i=Ls(e.sibling,t),s=Ls(e.child,t);return n?{ref:e,sibling:i??null,child:s??null}:i||s||null}function Ti({node:e,traverseSiblings:t=!0}){const[n,i]=ge(!0),o=oe.value===e,r=Si(()=>crypto.randomUUID(),[]),a=Si(()=>Rt.value==null?null:Uh(e,Rt.value),[Rt.value,e]);rt(()=>{a&&i(!1)},[a]),rt(()=>{if(!(!e||!Is(e)))return As.peek().set(r,{vNode:e,setCollapsed:i}),()=>{As.peek().delete(r)}});const l=fo.value;if(!e)return null;if(!Is(e)||l.length>0&&!jh(l.toLowerCase().split(" "),e.type.name))return g(Tt,null,e.child&&g(Ti,{node:e.child}),t&&g(rr,{node:e}));const c=e.child&&$h(e.child);return g(Tt,null,g("div",{className:"pl-4 mb-1"},g("h2",{onclick:()=>{Rt.value=null,oe.value=o?null:e},className:\`flex gap-2 items-center cursor-pointer mb-1 scroll-m-12 \${o?"font-medium bg-primary selected-vnode":""}\`,"data-id":r},c&&g(ce,{className:\`cursor-pointer transition \${n?"":"rotate-90"}\`,onclick:u=>{u.preventDefault(),u.stopImmediatePropagation(),Rt.value=null,i(f=>!f)}}),g("div",{className:c?"":"ml-6"},g("span",{className:o?"":"text-neutral-400"},"<"),g("span",{className:o?"":"text-primary"},Wh(e)),g("span",{className:o?"":"text-neutral-400"},">"))),!n&&e.child||a!=null&&a&&e.child?g(Ti,{node:e.child}):null),t&&g(rr,{node:e}))}function rr({node:e}){if(!e)return null;let t=[],n=e.sibling;for(;n;)t.push(n),n=n.sibling;return g(Tt,null,t.map(i=>g(Ti,{node:i,traverseSiblings:!1})))}const Yh=()=>{const e=Ne(null),t=r=>{if(!r)return null;const a=r.getAttribute("data-id");if(a!=null)return As.peek().get(a)},n=r=>{if(!r)return;const a=t(r);a!=null&&(r.scrollIntoView({behavior:"smooth"}),oe.value=a.vNode)},i=r=>{if(!r||r===document.body)return null;const a=r.parentElement,l=a?.nextElementSibling?.querySelector("h2[data-id]");return l||i(a)},s=()=>{const r=document.querySelector("h2[data-id]");n(r)},o=()=>{const r=document.querySelectorAll("h2[data-id]"),a=r.item(r.length-1);a&&n(a)};return or(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],r=>{if(Rt.value&&(Rt.value=null),document.activeElement&&document.activeElement instanceof HTMLInputElement&&document.activeElement!=e.current)return;r.preventDefault();const a=document.querySelector(".selected-vnode");if(a===null){r.key==="ArrowDown"?s():r.key==="ArrowUp"&&o();return}if(r.key==="ArrowRight"){const l=t(a);l&&l.setCollapsed(!1);return}else if(r.key==="ArrowLeft"){const l=t(a);l&&l.setCollapsed(!0);return}if(r.key==="ArrowDown"){const l=a?.nextElementSibling?.querySelector("h2[data-id]");if(l)return n(l);const c=a.parentElement?.nextElementSibling?.querySelector("h2[data-id]");if(c)return n(c);const u=i(a);return u?n(u):s()}else if(r.key==="ArrowUp"){const l=a.parentElement?.previousElementSibling;if(l?.matches("h2[data-id]"))return n(l);const c=l?.querySelectorAll("h2[data-id]");return c?.length!=null&&c?.length>=1?n(c?.item?.(c.length-1)):o()}}),or("l",r=>{r.ctrlKey&&(r.preventDefault(),e.current?.focus({preventScroll:!1}))}),{searchRef:e}},Xh=e=>{fo.value=e.target.value,Rt.value&&(Rt.value=null)};function qh(){const{searchRef:e}=Yh(),t=Lt.value;return g("div",{className:"flex-grow p-2 sticky top-0"},g("div",{className:"flex gap-4 pb-2 border-b-2 border-neutral-800 mb-2 items-center"},g("input",{ref:e,className:"bg-[#171616] px-1 py-2 w-full focus:outline focus:outline-primary",placeholder:"Search for component",type:"text",value:fo,oninput:Xh})),t?.rootNode&&g(Ti,{node:t.rootNode}))}const kl=e=>{const{mouse:t}=Fh(),n=J(null),i=J(0),s=J(0),o=Ne(null),r=Vh(o),a=Ne(null),[l,c]=Array.isArray(e.children)?e.children:[];return oo(()=>{a.current&&(s.value=a.current.clientWidth/2)},[a.current]),Ae("mouseup",Xe(()=>n.value=null,[])),Ae("mousemove",Xe(u=>{if(n.value==null||a.current==null)return;const f=Math.max(i.value+u.x-n.value.x,250);s.value=Math.min(f,a.current.clientWidth-250)},[])),Ae("resize",Xe(()=>{a.current!=null&&a.current.clientWidth-250<s.value&&(s.value=Math.max(a.current.clientWidth-250,250))},[])),g("div",{onmousemove:u=>{u.x},ref:a,className:"flex-grow grid gap-2 items-start w-full relative",style:{gridTemplateColumns:\`\${s}px 1fr\`}},g("div",{ref:o,className:"firstContainer w-full h-full"},l),r.width.value!=0&&g("div",{className:"w-8 flex justify-center h-full absolute top-0 -translate-x-1/2 cursor-col-resize z-[9999]",style:{left:\`\${r.width}px\`},onmousedown:u=>{u.preventDefault(),n.value={...t.value},i.value=s.value}},g("div",{className:"dividerLine w-[5px] bg-neutral-800 h-full"})),g("div",{className:"secondContainer h-full"},c))},Gh=()=>g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer"},g("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),g("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})),Kh=()=>{qe.value=!qe.value,Fe.send({type:"set-inspect-enabled",value:qe.value})};function Zh(){const e=Lt.value,t=oe.value,n=pe();return rt(()=>{const i=s=>{s===e&&n()};return U?.on("update",i),()=>U?.off("update",i)},[Lt]),rt(()=>{const i=s=>{if(s.data.type!=="select-node")return;gh(window.__devtoolsSelection,"no selection ptr");const{app:o,node:r}=window.__devtoolsSelection;window.__devtoolsSelection=null,Lt.value=o,oe.value=r,Rt.value=r,qe.value=!1};return Fe.addEventListener(i),()=>Fe.removeEventListener(i)},[Lt]),g(Tt,null,g("div",{className:"flex items-center justify-between gap-4 p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},g("div",{className:"flex items-center gap-4"},g("select",{className:"px-2 py-1 bg-neutral-800 text-neutral-100 rounded border border-white border-opacity-10",value:e?.name??"",onchange:i=>Lt.value=se.peek().find(s=>s.name===i.currentTarget.value)??null},g("option",{value:"",disabled:!0},"Select App"),se.value.map(i=>g("option",{key:i.id,value:i.name},i.name))),g("button",{title:"Toggle Component Inspection",onclick:Kh,className:\`p-1 rounded \${qe.value?"bg-neutral-900":""}\`},g(Gh,null)))),g(kl,null,e&&g(qh,null),t&&e&&g(Ih,{selectedApp:e,selectedNode:t,setSelectedNode:i=>oe.value=i,kiruGlobal:U})))}const Rs=G({}),Ce=G([]);U?.stores?.subscribe(e=>{Rs.value=e,Ce.value=Ce.value.filter(t=>Object.values(Rs.value).includes(t))});const Tl=G(""),Qh=Vn(()=>Tl.value.toLowerCase().split(" ").filter(e=>e.length>0));function Jh(e){return Qh.value.every(t=>e.toLowerCase().includes(t))}function tf(){const e=Object.entries(Rs.value);return e.length===0?g("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},g(lo,null),g("h2",{className:"text-lg italic"},"No stores detected")):g("div",{className:"flex flex-col gap-2 items-start"},g(ho,{value:Tl,className:"sticky top-0"}),g("div",{className:"flex flex-col gap-2 w-full"},e.filter(([t])=>Jh(t)).map(([t,n])=>g(ef,{key:t,name:t,store:n}))))}function ef({name:e,store:t}){const n=Ce.value.includes(t),i=pe(),{value:s}=Ml(t);oo(()=>{const r=t.subscribe(()=>i());return()=>r()},[]);const o=Xe(()=>{n?Ce.value=Ce.value.filter(r=>r!==t):Ce.value=[...Ce.value,t]},[n]);return g("div",{className:"flex flex-col"},g("button",{onclick:o,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,g("div",{className:"flex gap-2"},g(Hi,{fn:t,onclick:r=>r.stopPropagation()}),g(ce,{className:"transition-all"+(n?" rotate-90":"")}))),n&&g("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},g(me,{data:{value:s},mutable:!0,objectRefAcc:[],onChange:(r,a)=>{const l=structuredClone({value:s});ro(l,r,a),t.setState(l.value)}}),g(nf,{store:t})))}function nf({store:e}){const t=se.value;return t.length===0?null:g(Tt,null,t.map(n=>g(sf,{store:e,app:n})))}const ar=Symbol.for("kiru.hmrAccept"),Ml=e=>{if(ar in e)return e[ar].provide().current;throw new Error("Unable to get store subscribers")};function sf({store:e,app:t}){const n=pe(),{subscribers:i,nodeStateMap:s}=Ml(e),o=t.rootNode.child;if(rt(()=>{const a=l=>{l===t&&n()};return U?.on("update",a),()=>U?.off("update",a)},[]),!o)return null;const r=Ls(o,a=>i.has(a));return g("div",{className:"flex flex-col gap-2 p-2 rounded-b border border-white border-opacity-10"},g("b",null,t.name),r&&g("ul",{className:"pl-8"},g(Ns,{node:r,nodeStateMap:s})))}function Ns({node:e,nodeStateMap:t}){const[n,i]=ge(!1),o=t.get(e.ref)?.slices??[];return g(Tt,null,g("li",{className:"flex flex-col gap-2"},g("div",{className:"flex flex-col border border-white border-opacity-10 rounded"+(n?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400")},g("button",{onclick:()=>i(!n),className:"flex gap-2 p-2 justify-between cursor-pointer"},g("span",null,"<"+ao(e.ref)+" />"),g("div",{className:"flex gap-2 items-center"},g(Hi,{fn:e.ref.type,onclick:r=>r.stopPropagation()}),g(ce,{className:"transition-all"+(n?" rotate-90":"")}))),n&&g("div",{className:"flex flex-col gap-2 p-2 bg-[#1a1a1a]"},o.length===0&&g("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},g("h5",{className:"border-b border-white border-opacity-10"},"No slices")),o.map(r=>g("div",{className:"flex flex-col gap-2"},g("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},g("h5",{className:"border-b border-white border-opacity-10"},"Slice:"),g("pre",{className:"text-neutral-400"},g(me,{data:{value:r.value},mutable:!1,objectRefAcc:[],onChange:()=>{}}))),g("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},g("h5",{className:"border-b border-white border-opacity-10"},"SliceFn:"),g("pre",{className:"text-neutral-400"},r.sliceFn?r.sliceFn.toString():"null")),r.eq&&g("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},g("h5",{className:"border-b border-white border-opacity-10"},"eq:"),g("pre",{className:"text-neutral-400"},r.eq.toString())))))),e.child&&g("ul",{className:"pl-8 flex flex-col gap-2"},g(Ns,{node:e.child,nodeStateMap:t}))),e.sibling&&g(Ns,{node:e.sibling,nodeStateMap:t}))}/*!
|
|
9748
|
+
<script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const iu="production",pe=iu==="development",Va=Symbol.for("kiru.signal"),su=Symbol.for("kiru.context"),Ni=Symbol.for("kiru.contextProvider"),zt=Symbol.for("kiru.fragment"),Ba=Symbol.for("kiru.error"),Wa=Symbol.for("kiru.memo"),no=Symbol.for("kiru.errorBoundary"),ou=Symbol.for("kiru.streamData"),ru=Symbol.for("kiru.devFileLink"),au=50,gn="kiru:deferred",se=2,le=4,Ri=8,ce=16,ja=32,gs=64,Fe=128,lu=/^on:?/,$a=new Set(["animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","path","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","title","tspan","use"]),cu=new Set(["allowfullscreen","autofocus","autoplay","async","checked","compact","controls","contenteditable","declare","default","defer","disabled","download","hidden","inert","ismap","multiple","nohref","noresize","noshade","novalidate","nowrap","open","popover","readonly","required","sandbox","scoped","selected","sortable","spellcheck","translate","wrap"]),uu=new Map([["acceptCharset","accept-charset"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["httpEquiv","http-equiv"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ze={current:null},Ua={current:0},Ht={current:"window"in globalThis?"dom":"string"},hu={current:"dynamic"};var Ya;class Je extends Error{constructor(t){const n=typeof t=="string"?t:t.message;super(n),this[Ya]=!0,typeof t!="string"&&(this.fatal=t?.fatal)}static isKiruError(t){return t instanceof Error&&t[Ba]===!0}}Ya=Ba;const mn=[],ke=[],Gt={bumpChildIndex(){ke[ke.length-1]++},getCurrentChild(){const e=ke[ke.length-1];return this.getCurrentParent().childNodes[e]},getCurrentParent(){return mn[mn.length-1]},clear(){mn.length=0,ke.length=0},pop(){mn.pop(),ke.pop()},push(e){mn.push(e),ke.push(0)}};let io=!1,ms=!1;const Xa=e=>{e.preventDefault(),e.stopPropagation(),ms=!0};let De=null;function fu(){io=!0,De=document.activeElement,De&&De!==document.body&&De.addEventListener("blur",Xa)}function du(){ms&&(De.removeEventListener("blur",Xa),De.isConnected&&De.focus(),ms=!1),io=!1}function pu(e){const t=e.type;return t=="#text"?gu(e):$a.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function gu(e){const{nodeValue:t}=e.props;return W.isSignal(t)?qa(e,t):document.createTextNode(t)}function qa(e,t){const n=t.peek()??"",i=document.createTextNode(n);return bs(e,i,t),i}function mu(e){return t=>{if(io){t.preventDefault(),t.stopPropagation();return}e(t)}}const Zo=new WeakMap;function Ga(e){const{dom:t,prev:n,props:i,cleanups:s}=e,o=n?.props??{},r=i??{},a=Ht.current==="hydrate";if(t instanceof Text){const d=r.nodeValue;!W.isSignal(d)&&t.nodeValue!==d&&(t.nodeValue=d);return}const l=[];for(const d in o)l.push(d);for(const d in r)d in o||l.push(d);let c;for(let d=0;d<l.length;d++){const m=l[d],x=o[m],y=r[m];if(Ps.isEvent(m)){if(c??(c=Zo.get(e)),c||Zo.set(e,c={}),x!==y||a){const v=m.replace(lu,""),w=c[v];if(!y){w&&(t.removeEventListener(v,w),delete c[v]);continue}let k=y.bind(void 0);if((v==="focus"||v==="blur")&&(k=mu(k)),w){w.handleEvent=k;continue}t.addEventListener(v,c[v]={handleEvent:k})}continue}if(!(Ps.isInternalProp(m)&&m!=="innerHTML")&&x!==y){if(W.isSignal(x)&&s){const v=s[m];v&&(v(),delete s[m])}if(W.isSignal(y)){vu(e,t,m,y,x);continue}ys(t,m,y,x)}}const u=o.ref,f=r.ref;u!==f&&(u&&Ds(u,null),f&&Ds(f,t))}function bu(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Ka(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(n=>{n.selected=t.indexOf(n.value)>-1})}const yu={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},xu=new Set(["progress","meter","number","range"]);function vu(e,t,n,i,s){const[o,r]=n.split(":"),a=e.cleanups??(e.cleanups={});if(o!=="bind")a[n]=i.subscribe((u,f)=>{u!==f&&ys(t,n,u,f)});else{const u=yu[r];if(!u)return;a[n]=wu(e,t,r,u,i)}const l=i.peek(),c=Fi(s);l!==c&&ys(t,r??o,l,c)}function _u(e,t){return e instanceof HTMLInputElement?Su(e,t):e instanceof HTMLSelectElement?()=>bu(e):()=>e.value}function wu(e,t,n,i,s){const o=u=>{s.sneak(u),s.notify(f=>f!==a)},r=t instanceof HTMLSelectElement&&n==="value"?u=>Ka(t,u):u=>t[n]=u,a=u=>{r(u)};let l;if(n==="value"){const u=_u(t,s);l=()=>o(u())}else l=()=>{const u=t[n];n==="currentTime"&&s.peek()===u||o(u)};t.addEventListener(i,l);const c=s.subscribe(a);return()=>{t.removeEventListener(i,l),c()}}function Su(e,t){const n=e.type,i=t.peek();return n==="date"&&i instanceof Date?()=>e.valueAsDate:xu.has(n)&&typeof i=="number"?()=>e.valueAsNumber:()=>e.value}function bs(e,t,n){(e.cleanups??(e.cleanups={})).nodeValue=n.subscribe((i,s)=>{i!==s&&(t.nodeValue=i)})}function ku(e){const t=e.props.nodeValue;if(!W.isSignal(t))return Gt.getCurrentChild();const n=t.peek();if(zi(n))return Gt.getCurrentChild();const i=qa(e,t),s=Gt.getCurrentChild();return s?(s.before(i),i):Gt.getCurrentParent().appendChild(i)}function Tu(e){const t=e.type==="#text"?ku(e):Gt.getCurrentChild();if(Gt.bumpChildIndex(),!t)throw new Je({message:"Hydration mismatch - no node found",vNode:e});let n=t.nodeName;if($a.has(n)||(n=n.toLowerCase()),e.type!==n)throw new Je({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${n}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&ce)){Ga(e);return}W.isSignal(e.props.nodeValue)&&bs(e,t,e.props.nodeValue);let i=e,s=e.sibling;for(;s&&s.type==="#text";){const o=s;Gt.bumpChildIndex();const r=String(Fi(i.props.nodeValue)??""),a=i.dom.splitText(r.length);o.dom=a,W.isSignal(o.props.nodeValue)&&bs(o,a,o.props.nodeValue),i=s,s=s.sibling}}function Za(e,t,n,i=!1){if(n===null)return e.removeAttribute(t),!0;switch(typeof n){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(i&&!n)return e.removeAttribute(t),!0}return!1}function Mu(e,t,n){const i=cu.has(t);Za(e,t,n,i)||e.setAttribute(t,i&&typeof n=="boolean"?"":String(n))}const Eu=["INPUT","TEXTAREA"],Cu=e=>Eu.indexOf(e.nodeName)>-1;function ys(e,t,n,i){switch(t){case"style":return Du(e,n,i);case"className":return Pu(e,n);case"innerHTML":return Ou(e,n);case"muted":e.muted=!!n;return;case"value":if(e.nodeName==="SELECT")return Ka(e,n);const s=n==null?"":String(n);if(Cu(e)){e.value=s;return}e.setAttribute("value",s);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!n;return}e.setAttribute("checked",String(n));return;default:return Mu(e,Ju(t),n)}}function Ou(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function Pu(e,t){const n=Fi(t);if(!n)return e.removeAttribute("class");e.setAttribute("class",n)}function Du(e,t,n){if(Za(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let i={};typeof n=="string"?e.setAttribute("style",""):typeof n=="object"&&n&&(i=n);const s=t;new Set([...Object.keys(i),...Object.keys(s)]).forEach(r=>{const a=i[r],l=s[r];if(a!==l){if(l===void 0){e.style[r]="";return}e.style[r]=l}})}function Au(e){let t=e.parent,n=t?.dom;for(;t&&!n;)t=t.parent,n=t?.dom;if(!n||!t){if(!e.parent&&e.dom)return e;throw new Je({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function Iu(e,t){const{node:n,lastChild:i}=t,s=e.dom;if(i){i.after(s);return}const o=Qa(e,n);if(o){n.dom.insertBefore(s,o);return}n.dom.appendChild(s)}function Qa(e,t){let n=e;for(;n;){let i=n.sibling;for(;i;){if(!(i.flags&(le|ce))){const s=Lu(i);if(s?.isConnected)return s}i=i.sibling}if(n=n.parent,!n||n.flags&ce||n===t)return}}function Lu(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&ce)return;t=t.child}}function Nu(e){if(Ht.current==="hydrate")return Hi(e,wi);const t={node:e.dom?e:Au(e)};xs(e,t,(e.flags&le)>0),e.dom&&!(e.flags&ce)&&Ja(e,t,!1),wi(e)}function xs(e,t,n){let i=e.child;for(;i;){if(i.flags&gs){i.flags&le&&Fu(i,t),wi(i),i=i.sibling;continue}i.dom?(xs(i,{node:i},!1),i.flags&ce||Ja(i,t,n)):xs(i,t,(i.flags&le)>0||n),wi(i),i=i.sibling}}function Ja(e,t,n){(n||!e.dom.isConnected||e.flags&le)&&Iu(e,t),(!e.prev||e.flags&se)&&Ga(e),t.lastChild=e.dom}function Ru(e){e===e.parent?.child&&(e.parent.child=e.sibling),Hi(e,t=>{const{hooks:n,subs:i,cleanups:s,dom:o,props:{ref:r}}=t;for(i?.forEach(a=>a()),s&&Object.values(s).forEach(a=>a());n?.length;)n.pop().cleanup?.();o&&(o.isConnected&&!(t.flags&ce)&&o.remove(),r&&Ds(r,null),delete t.dom)}),e.parent=null}function Fu(e,t){if(!e.child)return;const n=[];if(tl(e.child,n),n.length===0)return;const{node:i,lastChild:s}=t;if(s)s.after(...n);else{const o=Qa(e,i),r=i.dom;o?o.before(...n):r.append(...n)}t.lastChild=n[n.length-1]}function tl(e,t){let n=e;for(;n;)n.dom?t.push(n.dom):n.child&&tl(n.child,t),n=n.sibling}function g(e,t=null,...n){e===Tt&&(e=zt);const i=t===null?{}:t,s=gl(i.key),o=n.length;return o===1?i.children=n[0]:o>1&&(i.children=n),{type:e,key:s,props:i}}function Tt({children:e,key:t}){return{type:zt,key:gl(t),props:{children:e}}}function el(e){return typeof e[Wa]=="function"}function nl(e,t=null,n={},i=null,s=0){e===Tt&&(e=zt);const o=t?t.depth+1:0;return{type:e,key:i,props:n,parent:t,index:s,depth:o,flags:0,child:null,sibling:null,prev:null,deletions:null}}function so(e,t){return Array.isArray(t)?Hu(e,t):zu(e,t)}function zu(e,t){const n=e.child;if(n===null)return ol(e,t);const i=n.sibling,s=il(e,n,t);if(s!==null)return n&&n!==s&&!s.prev?vs(e,n):i&&vs(e,i),s;{const o=ll(n),r=rl(o,e,0,t);if(r!==null){const a=r.prev;if(a!==null){const l=a.key;o.delete(l===null?a.index:l)}mi(r,0,0)}return o.forEach(a=>vi(e,a)),r}}function Hu(e,t){let n=null,i=null,s=e.child,o=null,r=0,a=0;for(;s!==null&&a<t.length;a++){s.index>a?(o=s,s=null):o=s.sibling;const c=il(e,s,t[a]);if(c===null){s===null&&(s=o);break}s&&!c.prev&&vi(e,s),r=mi(c,r,a),i===null?n=c:i.sibling=c,i=c,s=o}if(a===t.length)return vs(e,s),n;if(s===null){for(;a<t.length;a++){const c=ol(e,t[a]);c!==null&&(r=mi(c,r,a),i===null?n=c:i.sibling=c,i=c)}return n}const l=ll(s);for(;a<t.length;a++){const c=rl(l,e,a,t[a]);if(c!==null){const u=c.prev;if(u!==null){const f=u.key;l.delete(f===null?u.index:f)}r=mi(c,r,a),i===null?n=c:i.sibling=c,i=c}}return l.forEach(c=>vi(e,c)),n}function il(e,t,n){const i=t===null?null:t.key;return zi(n)?i!==null||t?.type==="#text"&&W.isSignal(t.props.nodeValue)?null:Qo(e,t,""+n):W.isSignal(n)?t&&t.props.nodeValue!==n?null:Qo(e,t,n):ro(n)?n.key!==i?null:Vu(e,t,n):Array.isArray(n)?i!==null?null:sl(e,t,n):null}function Qo(e,t,n){return t===null||t.type!=="#text"?Rt(e,"#text",{nodeValue:n}):(t.props.nodeValue!==n&&(t.props.nodeValue=n,t.flags|=se),t.sibling=null,t)}function Vu(e,t,n){let{type:i,props:s,key:o}=n;return i===zt?sl(e,t,s.children||[],s):t?.type===i?(t.index=0,t.sibling=null,typeof i=="string"?al(t.props,s)&&(t.flags|=se):t.flags|=se,t.props=s,t):Rt(e,i,s,o)}function sl(e,t,n,i={}){return t===null||t.type!==zt?Rt(e,zt,{children:n,...i}):(t.props={...t.props,...i,children:n},t.flags|=se,t.sibling=null,t)}function ol(e,t){return zi(t)?Rt(e,"#text",{nodeValue:""+t}):W.isSignal(t)?Rt(e,"#text",{nodeValue:t}):ro(t)?Rt(e,t.type,t.props,t.key):Array.isArray(t)?Rt(e,zt,{children:t}):null}function mi(e,t,n){e.index=n;const i=e.prev;if(i!==null){const s=i.index;return s<t?(e.flags|=le,t):s}else return e.flags|=le,t}function rl(e,t,n,i){if(W.isSignal(i)||zi(i)){const o=e.get(n);if(o){if(o.props.nodeValue===i)return o;o.type==="#text"&&W.isSignal(o.props.nodeValue)&&o.cleanups?.nodeValue?.()}return Rt(t,"#text",{nodeValue:i},null,n)}if(ro(i)){const{type:o,props:r,key:a}=i,l=e.get(a===null?n:a);return l?.type===o?(typeof o=="string"?al(l.props,r)&&(l.flags|=se):l.flags|=se,l.props=r,l.sibling=null,l.index=n,l):Rt(t,o,r,a,n)}if(Array.isArray(i)){const o=e.get(n);return o?(o.flags|=se,o.props.children=i,o):Rt(t,zt,{children:i},null,n)}return null}function al(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!0;for(let s of n)if(!(s==="children"||s==="key")&&e[s]!==t[s])return!0;return!1}function ll(e){const t=new Map;for(;e;){const n=e.key;t.set(n===null?e.index:n,e),e=e.sibling}return t}function vi(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function vs(e,t){for(;t;)vi(e,t),t=t.sibling}function Rt(e,t,n,i=null,s=0){const o=nl(t,e,n,i,s);return o.flags|=le,typeof t=="function"&&el(t)&&(o.flags|=ja),o}let Xt=[],tn=!1,_s=[],ws=[],Ss=!1,ks=!1,Ts=!1,Ms=0,cl=[],Es=[],ul=-1;function Bu(e){if(tn){_s.push(e);return}e()}function hl(){tn&&(window.cancelAnimationFrame(ul),fl())}function Jo(e){e.flags|=Fe,Xt.push(e),tn=!0,hl()}function Hn(e){if(Ht.current==="hydrate")return Bu(()=>Cs(e));Cs(e)}function Wu(){tn||(tn=!0,ul=window.requestAnimationFrame(fl))}function ju(){for(tn=!1;_s.length;)_s.shift()()}function Cs(e){if(Ss&&(ks=!0),ze.current===e){Ts=!0;return}if(!(e.flags&(Fe|Ri))){if(e.flags|=Fe,!Xt.length)return Xt.push(e),Wu();Xt.push(e)}}function $u(e){Hi(e,t=>t.flags|=Ri),ws.push(e)}const Uu=(e,t)=>t.depth-e.depth;let ee=null;function fl(){let e=1;for(fu();Xt.length;){Xt.length>e&&Xt.sort(Uu),ee=Xt.shift(),e=Xt.length;const t=ee.flags;if(!(t&Ri)&&t&Fe){let n=ee;for(;n=Yu(n););for(;ws.length;)Ru(ws.pop());Nu(ee),ee.flags&=~Fe}}if(du(),Ss=!0,es(cl),Ss=!1,ks)return Zu(),es(Es),ks=!1,Ms++,hl();Ms=0,ju(),queueMicrotask(()=>es(Es))}function Yu(e){const t=Xu(e);if(e.deletions!==null&&(e.deletions.forEach($u),e.deletions=null),t)return t;let n=e;for(;n;){if(n.immediateEffects&&(cl.push(...n.immediateEffects),n.immediateEffects=void 0),n.effects&&(Es.push(...n.effects),n.effects=void 0),n===ee)return null;if(n.sibling)return n.sibling;n=n.parent,Ht.current==="hydrate"&&n?.dom&&Gt.pop()}return null}function Xu(e){const{type:t,props:n,prev:i,flags:s}=e;if((s&Fe)===0&&n===i?.props)return null;try{return typeof t=="string"?Ku(e):eh(t)?qu(e):Gu(e)}catch(o){const r=rh(e);if(r){const a=r.error=o instanceof Error?o:new Error(String(o));return r.props.onError?.(a),r.depth<ee.depth&&(ee=r),r}if(Je.isKiruError(o)){if(o.customNodeStack&&setTimeout(()=>{throw new Error(o.customNodeStack)}),o.fatal)throw o;return console.error(o),e.child}setTimeout(()=>{throw o})}return null}function qu(e){const{props:t,type:n}=e;let i=t.children;if(n===Ni){const{props:{dependents:s,value:o},prev:r}=e;s.size&&r&&r.props.value!==o&&s.forEach(Cs)}else if(n===no){const s=e,{error:o}=s;o&&(i=typeof t.fallback=="function"?t.fallback(o):t.fallback,delete s.error)}return e.child=so(e,i)}function Gu(e){const{type:t,props:n,subs:i,prev:s,flags:o}=e;if(o&ja){if(s&&t[Wa](s.props,n))return e.flags|=gs,null;e.flags&=~gs}try{ze.current=e;let r,a=0;do e.flags&=~Fe,Ts=!1,Ua.current=0,i&&(i.forEach(oo),i.clear()),r=t(n);while(Ts);return e.child=so(e,r)}finally{ze.current=null}}function Ku(e){const{props:t,type:n}=e;return e.dom||(Ht.current==="hydrate"?Tu(e):e.dom=pu(e)),n!=="#text"&&(e.child=so(e,t.children),e.child&&Ht.current==="hydrate"&&Gt.push(e.dom)),e.child}function Zu(){if(Ms>au)throw new Je("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function es(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var tr;(function(e){e.Start="start",e.End="end"})(tr||(tr={}));const ge=()=>{const e=dl("useRequestUpdate");return()=>Hn(e)};function _t(e,t,n){const i=dl(e),s=(a,l)=>{if(l?.immediate){(i.immediateEffects??(i.immediateEffects=[])).push(a);return}(i.effects??(i.effects=[])).push(a)},o=Ua.current++;let r=i.hooks?.at(o);try{const a=r??(typeof t=="function"?t():{...t});return i.hooks??(i.hooks=[]),i.hooks[o]=a,n({hook:a,isInit:!r,update:()=>Hn(i),queueEffect:s,vNode:i,index:o})}catch(a){throw a}}function dl(e){const t=ze.current;if(!t)throw new Je(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`);return t}function Vn(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function We(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((n,i)=>!Object.is(n,e[i]))}const Os={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},Ge=new Map;var pl;class W{constructor(t,n){this[pl]=!0,this.$id=lh(),this.$value=t,n&&(this.displayName=n),this.$subs=new Set}get value(){return W.entangle(this),this.$value}set value(t){Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.$value}sneak(t){this.$prevValue=this.$value,this.$value=t}toString(){return W.entangle(this),\`\${this.$value}\`}subscribe(t){return this.$subs.add(t),()=>this.$subs.delete(t)}notify(t){this.$subs.forEach(n=>{if(!(t&&!t(n)))return n(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&Va in t}static subscribers(t){return t.$subs}static makeReadonly(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&!n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},configurable:!0})}static makeWritable(t){const n=Object.getOwnPropertyDescriptor(t,"value");return n&&n.writable?t:Object.defineProperty(t,"value",{get:function(){return W.entangle(this),this.$value},set:function(i){this.$value=i,this.notify()},configurable:!0})}static entangle(t){const n=ze.current,i=Os.current();if(i){(!n||n&&xt())&&i.set(t.$id,t);return}if(!n||!xt())return;const s=t.subscribe(()=>Hn(n));(n.subs??(n.subs=new Set)).add(s)}static dispose(t){t.$isDisposed=!0,t.$subs.clear()}}pl=Va;const G=(e,t)=>new W(e,t),J=(e,t)=>_t("useSignal",{signal:null},({hook:n,isInit:i,isHMR:s})=>(i&&(n.cleanup=()=>W.dispose(n.signal),n.signal=new W(e,t)),n.signal));function Fi(e,t=!1){return W.isSignal(e)?t?e.value:e.peek():e}const Qu=()=>{Ge.forEach(oo),Ge.clear()};function _i(...e){return e.filter(Boolean).join(" ")}const er=new Set(["children","ref","key","innerHTML"]),Ps={isInternalProp:e=>er.has(e),isEvent:e=>e.startsWith("on"),isStringRenderableProperty:e=>!er.has(e)&&!Ps.isEvent(e)};function Ju(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():uu.get(e)||e}}function oo(e){e()}const nr=Object.freeze(()=>{});function Ds(e,t){if(typeof e=="function"){e(t);return}if(W.isSignal(e)){e.value=t;return}e.current=t}function xt(){return Ht.current==="dom"||Ht.current==="hydrate"}function th(e){return(e.flags&Ri)!==0}function ro(e){return typeof e=="object"&&e!==null&&"type"in e}function zi(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function eh(e){return e===zt||e===Ni||e===no}function nh(e){return e.type===zt}function ih(e){return typeof e.type=="function"&&"displayName"in e.type&&e.type.displayName==="Kiru.lazy"}function sh(e){return typeof e.type=="function"&&el(e.type)}function wi(e){const{props:t,key:n,index:i}=e;e.prev={props:t,key:n,index:i},e.flags&=-15}function Hi(e,t){t(e);let n=e.child;for(;n;)t(n),n.child&&Hi(n,t),n=n.sibling}function oh(e,t){let n=e.parent;for(;n;){if(t(n))return n;n=n.parent}return null}function rh(e){return oh(e,t=>t.type===no)}function gl(e){return e===void 0?null:typeof e=="string"||typeof e=="number"?e:null}const ah="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function lh(e=10,t=ah){let n="";for(let i=0;i<e;i++)n+=t[Math.random()*t.length|0];return n}function ch(){const e=new Set,t=new WeakMap,n=new Map;function i(a,l,c){n.get(a)?.forEach(u=>u(l,c))}function s(a,l){n.has(a)||n.set(a,new Set),n.get(a).add(l)}function o(a,l){n.get(a)?.delete(l)}const r={get apps(){return Array.from(e)},emit:i,on:s,off:o};return s("mount",(a,l)=>{e.add(a),l&&typeof l=="function"&&t.set(a,{requestUpdate:l})}),s("unmount",a=>{e.delete(a),t.delete(a)}),r}function uh(e){const{id:t,subs:n,fn:i,deps:s=[],onDepChanged:o}=e;let r;Ge.delete(t);const a=!!ze.current&&!xt();a||(r=new Map,Os.stack.push(r));const l=i(...s.map(c=>c.value));if(!a){for(const[u,f]of n)r.has(u)||(f(),n.delete(u));const c=()=>{Ge.size||queueMicrotask(Qu),Ge.set(t,o)};for(const[u,f]of r){if(n.has(u))continue;const d=f.subscribe(c);n.set(u,d)}Os.stack.pop()}return l}class Oe extends W{constructor(t,n){super(void 0,n),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0}get value(){return this.ensureNotDirty(),super.value}toString(){return this.ensureNotDirty(),super.toString()}peek(){return this.ensureNotDirty(),super.peek()}set value(t){}subscribe(t){return this.$isDirty&&Oe.run(this),super.subscribe(t)}static dispose(t){Oe.stop(t),W.dispose(t)}static updateGetter(t,n){const i=t;i.$getter=n,i.$isDirty=!0,Oe.run(i),!Object.is(i.$value,i.$prevValue)&&i.notify()}static stop(t){const{$id:n,$unsubs:i}=t;Ge.delete(n),i.forEach(oo),i.clear(),t.$isDirty=!0}static run(t){const n=t,{$id:i,$getter:s,$unsubs:o}=n,r=uh({id:i,subs:o,fn:()=>s(n.$value),onDepChanged:()=>{n.$isDirty=!0,t.$subs.size&&(Oe.run(n),!Object.is(n.$value,n.$prevValue)&&n.notify())}});n.sneak(r),n.$isDirty=!1}ensureNotDirty(){this.$isDirty&&Oe.run(this)}}function Bn(e,t){return new Oe(e,t)}let hh=0;function fh(e,t,n){const i=dh(t),s=hh++,o={id:s,name:\`App-\${s}\`,rootNode:i,render:r,unmount:a};function r(l){i.props.children=l,Jo(i)}function a(){i.props.children=null,Jo(i),window.__kiru.emit("unmount",o)}return r(e),window.__kiru.emit("mount",o,Hn),o}function dh(e){const t=nl(e.nodeName.toLowerCase());return t.flags|=ce,t.dom=e,t}function me(e){return xt()?_t("useState",{state:void 0,dispatch:nr},({hook:t,isInit:n,update:i,isHMR:s})=>(n&&(t.state=typeof e=="function"?e():e,t.dispatch=o=>{const r=typeof o=="function"?o(t.state):o;Object.is(t.state,r)||(t.state=r,i())}),[t.state,t.dispatch])):[typeof e=="function"?e():e,nr]}function ph(e){const t={[su]:!0,Provider:({value:n,children:i})=>{const[s]=me(()=>new Set);return g(Ni,{value:n,ctx:t,dependents:s},typeof i=="function"?i(n):i)},default:()=>e,set displayName(n){this.Provider.displayName=n},get displayName(){return this.Provider.displayName||"Anonymous Context"}};return t}function Ke(e,t){return xt()?_t("useCallback",{callback:e,deps:t},({hook:n,isHMR:i})=>(We(t,n.deps)&&(n.deps=t,n.callback=e),n.callback)):e}function gh(e,t=!0){return _t("useContext",{context:e,warnIfNotFound:t},mh)}const mh=({hook:e,isInit:t,vNode:n})=>{if(t){let i=n.parent;for(;i;){if(i.type===Ni){const s=i,{ctx:o,value:r,dependents:a}=s.props;if(o===e.context)return a.add(n),e.cleanup=()=>a.delete(n),e.provider=s,r}i=i.parent}}return e.provider?e.provider.props.value:e.context.default()};function rt(e,t){if(xt())return _t("useEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||We(t,n.deps))&&(n.deps=t,Vn(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)}))})}function ml(){return _t("useId",bh,yh)}const bh=()=>({id:"",idx:0}),yh=({hook:e,isInit:t,vNode:n})=>{if(t||n.index!==e.idx){e.idx=n.index;const i=[];let s=n;for(;s;)i.push(s.index),i.push(s.depth),s=s.parent;e.id=\`k:\${BigInt(i.join("")).toString(36)}\`}return e.id};function ao(e,t){if(xt())return _t("useLayoutEffect",{deps:t},({hook:n,isInit:i,isHMR:s,queueEffect:o})=>{(i||We(t,n.deps))&&(n.deps=t,Vn(n),o(()=>{const r=e();typeof r=="function"&&(n.cleanup=r)},{immediate:!0}))})}function Si(e,t){return xt()?_t("useMemo",{deps:t,value:void 0},({hook:n,isInit:i,isHMR:s})=>((i||We(t,n.deps))&&(n.deps=t,n.value=e()),n.value)):e()}const ir=new WeakMap;function xh(e,t){const n=ml(),i=J(!0);return _t("usePromise",{},({hook:s,isInit:o,vNode:r,update:a})=>{if(o||We(t,s.deps)){i.value=!0,s.deps=t,Vn(s);const l=s.abortController=new AbortController;s.cleanup=()=>l.abort();const c=ir.get(r)??0;ir.set(r,c+1);const u=\`\${n}:data:\${c}\`;let f;Ht.current==="string"?f=Promise.resolve():Ht.current==="hydrate"&&hu.current==="dynamic"?f=vh(u,l.signal):f=e(l.signal);const d={id:u,state:"pending"},m=s.promise=Object.assign(f,d,{isPending:i,refresh:()=>{s.deps=void 0,a()}});m.then(x=>{m.state="fulfilled",m.value=x,i.value=!1}).catch(x=>{m.state="rejected",m.error=x instanceof Error?x:new Error(x)})}return s.promise})}function vh(e,t){return new Promise((n,i)=>{const s=window[gn]??(window[gn]=new Map),o=s.get(e);if(o){const{data:a,error:l}=o;return s.delete(e),l?i(l):n(a)}const r=a=>{const{detail:l}=a;if(l.id===e){s.delete(e),window.removeEventListener(gn,r);const{data:c,error:u}=l;if(u)return i(u);n(c)}};window.addEventListener(gn,r),t.addEventListener("abort",()=>{window.removeEventListener(gn,r),i()})})}function He(e){return xt()?_t("useRef",{ref:{current:e}},({hook:t,isInit:n,isHMR:i})=>t.ref):{current:e}}function sr(e){return e instanceof Promise&&"id"in e&&"state"in e}function As(e){const{from:t,children:n,fallback:i,mode:s}=e,o=He(null),r=new Set;let a;if(sr(t))r.add(t),a=t.value;else if(W.isSignal(t))a=t.value;else{const l={};for(const c in t){const u=t[c];sr(u)&&r.add(u),l[c]=u.value}a=l}if(r.size===0)return n(a);if(!xt())throw{[ou]:{fallback:i,data:Array.from(r)}};for(const l of r){if(l.state==="rejected")throw l.error;if(l.state==="pending"){const c=ze.current;return Promise.allSettled(r).then(()=>Hn(c)),s!=="fallback"&&o.current?n(o.current,!0):i}}return o.current=a,n(a,!1)}"window"in globalThis&&(window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map));var or;"window"in globalThis&&!globalThis.__KIRU_DEVTOOLS__&&((or=globalThis.window).__kiru??(or.__kiru=ch()));function _h(e,t){if(!e)throw new Error(t)}function wh(...e){return e.filter(Boolean).join(" ")}function lo(e,t,n){let i=e;for(let s=0;s<t.length;s++){const o=t[s];s===t.length-1?i[o]=n:i=i[o]}}function co(e){return e.type.displayName??(e.type.name||"Anonymous Function")}const Sh=e=>e[ru]??null;function In(e){return e.name==="kiru.devtools"}function bl(e){return Array.from(e.entries())}function kh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},g("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),g("path",{d:"M12 9v11"}),g("path",{d:"M2 9h13a2 2 0 0 1 2 2v9"}))}function ue(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"m9 18 6-6-6-6"}))}function Th(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),g("circle",{cx:"12",cy:"12",r:"3"}))}function Mh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"}),g("path",{d:"m21 3-9 9"}),g("path",{d:"M15 3h6v6"}))}function Eh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z"}),g("path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z"}),g("path",{d:"M3 5a2 2 0 0 0 2 2h3"}),g("path",{d:"M3 3v13a2 2 0 0 0 2 2h3"}))}function Ch(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"m12 14 4-4"}),g("path",{d:"M3.34 19a10 10 0 1 1 17.32 0"}))}function Oh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("circle",{cx:"12",cy:"12",r:"10"}),g("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),g("path",{d:"M2 12h20"}))}function yl(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),g("path",{d:"M21 3v5h-5"}),g("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),g("path",{d:"M8 16H3v5"}))}function Ph(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e},g("path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z"}),g("path",{d:"M6 18h12"}),g("path",{d:"M6 14h12"}),g("rect",{width:"12",height:"12",x:"6",y:"10"}))}function Dh(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),g("path",{d:"M8 12h8"}),g("path",{d:"m12 16 4-4-4-4"}))}function uo(e){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e},g("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),g("path",{d:"M12 9v4"}),g("path",{d:"M12 17h.01"}))}function xl({title:e,children:t,className:n,disabled:i,...s}){const[o,r]=me(!0);rt(()=>{!o&&i&&r(!0)},[i]);const a=Ke(l=>{l.preventDefault(),l.stopImmediatePropagation(),r(c=>!c)},[]);return g("div",{className:"flex flex-col"},g("button",{onclick:a,disabled:i,className:\`\${i?"opacity-50 cursor-default":"cursor-pointer"}\`},g("span",{className:"flex items-center gap-2 font-medium"},g(ue,{className:\`transition \${o?"":"rotate-90"}\`}),e)),o?null:g("div",{className:\`p-2 \${n||""}\`,...s},t))}const ho={arrayChunkSize:10,objectKeysChunkSize:100};function vl(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;const n=new Set([...Object.keys(e),...Object.keys(t)]);for(const i in n)if(typeof t[i]!=typeof e[i]||typeof e[i]=="object"&&!vl(e[i],t[i]))return!1;return!0}function _l(e,t,n){for(const i in t)typeof e[i]>"u"&&(e[i]=structuredClone(t[i]));for(const i in e)typeof e[i]=="object"?_l(e[i],t[i],n):n(e,i,e[i])}let wl={...ho};const rr=localStorage.getItem("kiru.devtools.userSettings");if(rr)try{const e=JSON.parse(rr);vl(ho,e)&&(wl=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}const Sl=ph({userSettings:null,saveUserSettings:()=>{}}),Vi=()=>gh(Sl);function Ah({children:e}){const[t,n]=me(wl),i=s=>{localStorage.setItem("kiru.devtools.userSettings",JSON.stringify(s)),n(s)};return g(Sl.Provider,{value:{userSettings:t,saveUserSettings:i}},e)}function Ih(){const{userSettings:e,saveUserSettings:t}=Vi();return g("div",{className:"rounded bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 overflow-hidden"},g(be,{border:!1,data:e,onChange:(n,i)=>{const s={...e};lo(s,n,i),_l(s,ho,(o,r,a)=>{o[r]=a<1?1:a}),t(s)},mutable:!0,objectRefAcc:[]}))}const Lh=Object.freeze(()=>{});function be({data:e,onChange:t,mutable:n,objectRefAcc:i,keys:s=[],className:o,border:r=!0}){const{userSettings:{objectKeysChunkSize:a}}=Vi(),[l,c]=me(0),u=Si(()=>Object.keys(e).slice(0,(l+1)*a),[l,a,e]),f=()=>{u.forEach(m=>{typeof e[m]=="object"&&i.splice(i.indexOf(e[m]),1)}),c(l+1)},d=u.length<Object.keys(e).length;return g(Tt,null,g("div",{className:wh("flex flex-col items-start w-full",r&&"border border-neutral-700",Fi(o))},u.map(m=>{const x=s.concat(m),y=x.join(".");return g("div",{key:y,"data-key":y,className:"flex flex-col items-start w-full gap-2 pl-2 py-1 pr-1 border-b border-neutral-700 last:border-b-0"},g(fo,{value:e[m],onChange:t,keys:x,path:y,label:m,mutable:n,objectRefAcc:i}))})),d&&g("button",{onclick:f,title:"Show more",className:"p-1 border font-bold border-neutral-700 hover:bg-neutral-700"},g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},g("circle",{cx:"12",cy:"12",r:"1"}),g("circle",{cx:"19",cy:"12",r:"1"}),g("circle",{cx:"5",cy:"12",r:"1"}))))}function ki(e,t){Array.isArray(e)?(t(e),e.forEach(n=>ki(n,t))):typeof e=="object"&&e!==null&&(t(e),Object.values(e).forEach(n=>ki(n,t)))}function fo({value:e,onChange:t,keys:n,path:i,mutable:s,objectRefAcc:o,label:r}){const{userSettings:{arrayChunkSize:a}}=Vi(),[l,c]=me(!0),u=r!==void 0&&g("label",{htmlFor:i,className:"text-xs truncate",title:i,children:r});if(e===null)return g(mt,null,u,g(Jt,null,"null"));if(e===void 0)return g(mt,null,u,g(Jt,null,"undefined"));const f=window.opener?window.opener.Node:Node;if(e instanceof f)return g(mt,null,u,g(Jt,null,"<",g("span",{style:{color:"#f0a05e"}},e.nodeName),"/>"));const d=window.opener?window.opener.Error:Error;if(e instanceof d)return g(mt,null,u,"cause"in e&&e.cause?g(Jt,null,e.message," (",String(e.cause),")"):g(Jt,null,e.message));const m=x=>t(n,x);switch(typeof e){case"string":return g(mt,null,u,g(ns,{disabled:!s,id:i,type:"text",value:e,onchange:x=>m(x.target.value)}));case"number":return g(mt,null,u,g(ns,{disabled:!s,id:i,type:"number",value:e,placeholder:"NaN",onchange:x=>m(Number(x.target.value))}));case"bigint":return g(mt,null,u,g(ns,{disabled:!s,id:i,type:"number",value:e.toString(),onchange:x=>m(BigInt(x.target.value))}));case"boolean":return g(mt,null,u,g("input",{disabled:!s,id:i,type:"checkbox",checked:e,onchange:x=>m(x.target.checked),className:"accent-red-500"}));case"function":return g(mt,null,u,g(Jt,null,\`\u0192 \${e.name||"anonymous"}()\`));default:return Array.isArray(e)?g(mt,null,g("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{ki(e,x=>o.splice(o.indexOf(x),1)),c(x=>!x)}},r,g(ue,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?g(Jt,null,"Array(",e.length,")"):e.length>a?g(Nh,{array:e,objectRefAcc:o}):g("div",{className:"flex flex-col items-start gap-1 w-full"},e.map((x,y)=>g(fo,{value:x,onChange:t,keys:[...n,y.toString()],path:i.concat(".",y.toString()),label:y.toString(),mutable:s,objectRefAcc:o})))):o.includes(e)?g(mt,null,u,g(Jt,null,"Object(circular reference)")):(o.push(e),g(mt,null,g("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",title:i,onclick:()=>{ki(e,x=>o.splice(o.indexOf(x),1)),c(x=>!x)}},r,g(ue,{width:10,height:10,className:\`transition \${l?"":"rotate-90"}\`})),l?null:g(be,{data:e,onChange:t,keys:n,mutable:s,objectRefAcc:o})))}}function mt({children:e}){return g("div",{className:"flex flex-col items-start gap-1 w-full"},e)}function ns(e){return g("input",{className:"flex-grow text-xs px-2 py-1 text-neutral-300 w-full",...e})}function Jt({children:e}){return g("small",{className:"text-neutral-300"},g("i",null,e))}function Nh({array:e,objectRefAcc:t}){const{userSettings:{arrayChunkSize:n}}=Vi(),i=e.length,s=Math.ceil(i/n);return g("div",{className:"flex flex-col items-start gap-1 w-full"},Array.from({length:s}).map((o,r)=>g(Rh,{array:e,range:{start:r*n,end:(r+1)*n},objectRefAcc:t})))}function Rh({array:e,range:t,objectRefAcc:n}){const[i,s]=me(!0);let o;return i?o=void 0:o=e.slice(t.start,t.end),g("div",{className:"flex flex-col items-start gap-1 w-full"},g("button",{className:"text-xs flex items-center gap-1 cursor-pointer w-full",onclick:()=>{n.splice(n.indexOf(e),1),s(r=>!r)}},"[",t.start,"..",(t.end<e.length?t.end:e.length)-1,"]",g(ue,{width:10,height:10,className:\`transition \${i?"":"rotate-90"}\`})),o&&g("div",{className:"flex flex-col items-start gap-1 w-full"},o.map((r,a)=>g(fo,{value:r,onChange:Lh,label:(t.start+a).toString(),keys:[a.toString()],path:a.toString(),mutable:!1,objectRefAcc:n}))))}const Fh="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??=null,window.__devtoolsNodeUpdatePtr??=null);class zh extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}}const Ve=new zh(Fh);function Bi({fn:e,onclick:t}){const n=Si(()=>Sh(e),[e]);return n?g("a",{className:"flex items-center gap-1 text-[10px] opacity-50 hover:opacity-100 transition-opacity",href:n,onclick:i=>{i.preventDefault(),Ve.send({type:"open-editor",fileLink:n}),t?.(i)},title:"Open in editor"},"Open in editor",g(Mh,{width:"0.65rem",height:"0.65rem"})):null}function Hh({selectedApp:e,selectedNode:t,setSelectedNode:n,kiruGlobal:i}){const s=ge();rt(()=>{const l=c=>{c===e&&(th(t)?n(null):s())};return i?.on("update",l),()=>i?.off("update",l)},[]);const o=()=>{const l=window.opener;if(!t||!l){console.error("invalid refresh state",{w:l,selectedNode:t});return}l.__devtoolsNodeUpdatePtr=t,Ve.send({type:"update-node"}),console.debug("[kiru]: sent refresh message",t)},r={...t.props};delete r.children;const a=Wh(t);return g("div",{className:"flex-grow p-2 sticky top-0"},g("h2",{className:"flex justify-between items-center font-bold mb-2 pb-2 border-b-2 border-neutral-800"},g("div",{className:"flex gap-2 items-center"},"<"+co(t)+">",g(Bi,{fn:t.type})),g("button",{onclick:o},g(yl,{className:"w-5 h-5"}))),g(xl,{title:"props",disabled:Object.keys(r).length===0},g(be,{data:r,onChange:()=>{},mutable:!1,objectRefAcc:[]})),g(kl,{node:a,selectedApp:e}))}function Vh(e){return e.name==="devtools:useHookDebugGroup"}function Bh(e){return Is in e}const Is=Symbol.for("devtools.hookGroup");function Wh(e){const t={parent:null,name:"hooks",children:[],[Is]:!0};if(e.hooks?.length){let n=t;for(let i=0;i<e.hooks.length;i++){const s=e.hooks[i];if(Vh(s)){switch(s.action){case"start":const o={parent:n,name:s.displayName,children:[],[Is]:!0};n.children.push(o),n=o;break;case"end":if(n.name!==s.displayName||n.parent===null)throw new Error("useHookDebugGroup:end called with no start");n=n.parent;break}continue}n.children.push(s)}}return t}function kl({node:e,selectedApp:t,depth:n=0}){if(Bh(e))return g(xl,{title:e.name,className:"bg-[#ffffff04] border border-[#fff1] flex flex-col gap-2 pl-6",disabled:e.children.length===0},e.children.map(u=>g(kl,{node:u,selectedApp:t,depth:n+1})));const{name:i,dev:s,cleanup:o,...r}=e,a=s?.devtools,l=typeof a?.get=="function"?a.get():r;return g("div",null,g("i",{className:"text-neutral-300 text-sm"},i||"anonymous hook"),g("div",{className:"p-2"},g(be,{data:l,onChange:(u,f)=>{if(!t||!a?.set||!a?.get)return;const d=a.get();lo(d,u,f),a.set(d)},mutable:!!a?.set,objectRefAcc:[]})))}const Le=(e,t,n={})=>{rt(()=>{let i=window;const s=n?.ref?.();return s?i=s:n.ref&&console.warn("useEventListener ref failed, using window"),i.addEventListener(e,t,n),()=>{i.removeEventListener(e,t,n)}},[t])},jh=()=>{const e=J({x:0,y:0}),t=J({x:0,y:0}),n=J({x:0,y:0});return Le("mousemove",i=>{e.value={x:i.x,y:i.y},t.value={x:i.movementX,y:i.movementY},n.value={x:i.clientX,y:i.clientY}}),{mouse:e,delta:t,client:n}},Jn="window"in globalThis&&"ResizeObserver"in globalThis.window,$h=(e,t,n=void 0)=>xt()?Jn?_t("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i&&(s.resizeObserver=new ResizeObserver(t),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null}),o(()=>{We([e.current],s.deps)&&(s.deps=[e.current],s.resizeObserver?.disconnect?.(),e.current&&s.resizeObserver?.observe(e.current,n))}),{isSupported:Jn,start:()=>{s.resizeObserver==null&&(s.resizeObserver=new ResizeObserver(t),e.current&&s.resizeObserver.observe(e.current,n),s.cleanup=()=>{s.resizeObserver?.disconnect?.(),s.resizeObserver=null})},stop:()=>{Vn(s)}})):{isSupported:Jn,start:()=>{},stop:()=>{}}:{isSupported:Jn,start:()=>{},stop:()=>{}},ti="window"in globalThis&&"MutationObserver"in globalThis.window,Uh=(e,t,n=void 0)=>xt()?ti?_t("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:i,hook:s,queueEffect:o})=>(i?(o(()=>{s.deps=[e.current],s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n)}),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null}):We([e.current],s.deps)&&(s.deps=[e.current],s.mutationObserver?.disconnect?.(),e.current&&s.mutationObserver?.observe(e.current,n)),{isSupported:ti,start:()=>{s.mutationObserver==null&&(s.mutationObserver=new MutationObserver(t),e.current&&s.mutationObserver.observe(e.current,n),s.cleanup=()=>{s.mutationObserver?.disconnect?.(),s.mutationObserver=null})},stop:()=>{Vn(s)}})):{isSupported:ti,start:()=>{},stop:()=>{}}:{isSupported:ti,start:()=>{},stop:()=>{}},Yh=(e,t={windowScroll:!0,windowResize:!0})=>{const n=t?.windowScroll??!0,i=t?.windowResize??!0,s=t.immediate??!0,o=J(0),r=J(0),a=J(0),l=J(0),c=J(0),u=J(0),f=J(0),d=J(0),m=()=>{const x=e.current;if(!x){o.value=0,r.value=0,a.value=0,l.value=0,c.value=0,u.value=0,f.value=0,d.value=0;return}const y=x.getBoundingClientRect();o.value=y.width,r.value=y.height,a.value=y.top,l.value=y.right,c.value=y.bottom,u.value=y.left,f.value=y.x,d.value=y.y};return $h(e,m),Uh(e,m,{attributeFilter:["style","class"]}),Le("scroll",()=>{n&&m()},{capture:!0,passive:!0}),Le("resize",()=>{i&&m()},{passive:!0}),ao(()=>{s&&m()},[]),{width:o,height:r,top:a,right:l,bottom:c,left:u,x:f,y:d,update:m}};function Xh(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}const ar=(e,t,n={})=>{const{ref:i,eventName:s="keydown",passive:o=!1}=n,r=Xh(e);return Le(s,l=>{l.repeat&&!n.repeat||r(l)&&t(l)},{ref:i,passive:o})};function po({value:e,className:t,...n}){const i=ml();return g("div",{className:_i("w-full p-2 z-10","bg-[#1d1d1d] border border-white border-opacity-10 rounded",t?.toString()),...n},g("input",{className:_i("px-2 py-1 w-full rounded focus:outline focus:outline-primary","bg-[#212121] border border-white border-opacity-10 rounded"),placeholder:"Filter...",type:"text",autocomplete:i+Math.random().toString(36).substring(2,15),name:"filter-search",id:"filter-search","bind:value":e}))}let U;"window"in globalThis&&window.opener&&(U=window.opener.__kiru);const Ze=G(!1);Ve.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(Ze.value=e.data.value)});const Tl=(U?.apps??[]).filter(e=>!In(e)),oe=G(Tl);G(null);const Lt=G(Tl[0]??null),re=G(null);U?.on("mount",e=>{In(e)||(oe.value=[...oe.peek(),e],Lt.peek()===null&&(Lt.value=e))});U?.on("unmount",e=>{oe.value=oe.peek().filter(t=>t!==e),Lt.peek()===e&&(Lt.value=oe.peek()[0]??null)});const Ls=G(new Map),Nt=G(null),go=G("");function qh(e){return e.type.displayName??(e.type.name||"Anonymous Function")}function Gh(e,t){const n=t.toLowerCase();return e.every(i=>n.includes(i))}function Ns(e){return typeof e.type=="function"&&!nh(e)&&!ih(e)&&!sh(e)}function Kh(e){let t=[e];for(;t.length;){const n=t.pop();if(Ns(n))return!0;n.child&&t.push(n.child),n.sibling&&t.push(n.sibling)}return!1}const Zh=(e,t)=>{const n=[t.parent];for(;n.length;){const i=n.pop();if(e===i)return!0;i?.parent&&n.push(i.parent)}return!1};function Rs(e,t){if(!e)return null;const n=t(e),i=Rs(e.sibling,t),s=Rs(e.child,t);return n?{ref:e,sibling:i??null,child:s??null}:i||s||null}function Ti({node:e,traverseSiblings:t=!0}){const[n,i]=me(!0),o=re.value===e,r=Si(()=>crypto.randomUUID(),[]),a=Si(()=>Nt.value==null?null:Zh(e,Nt.value),[Nt.value,e]);rt(()=>{a&&i(!1)},[a]),rt(()=>{if(!(!e||!Ns(e)))return Ls.peek().set(r,{vNode:e,setCollapsed:i}),()=>{Ls.peek().delete(r)}});const l=go.value;if(!e)return null;if(!Ns(e)||l.length>0&&!Gh(l.toLowerCase().split(" "),e.type.name))return g(Tt,null,e.child&&g(Ti,{node:e.child}),t&&g(lr,{node:e}));const c=e.child&&Kh(e.child);return g(Tt,null,g("div",{className:"pl-4 mb-1"},g("h2",{onclick:()=>{Nt.value=null,re.value=o?null:e},className:\`flex gap-2 items-center cursor-pointer mb-1 scroll-m-12 \${o?"font-medium bg-primary selected-vnode":""}\`,"data-id":r},c&&g(ue,{className:\`cursor-pointer transition \${n?"":"rotate-90"}\`,onclick:u=>{u.preventDefault(),u.stopImmediatePropagation(),Nt.value=null,i(f=>!f)}}),g("div",{className:c?"":"ml-6"},g("span",{className:o?"":"text-neutral-400"},"<"),g("span",{className:o?"":"text-primary"},qh(e)),g("span",{className:o?"":"text-neutral-400"},">"))),!n&&e.child||a!=null&&a&&e.child?g(Ti,{node:e.child}):null),t&&g(lr,{node:e}))}function lr({node:e}){if(!e)return null;let t=[],n=e.sibling;for(;n;)t.push(n),n=n.sibling;return g(Tt,null,t.map(i=>g(Ti,{node:i,traverseSiblings:!1})))}const Qh=()=>{const e=He(null),t=r=>{if(!r)return null;const a=r.getAttribute("data-id");if(a!=null)return Ls.peek().get(a)},n=r=>{if(!r)return;const a=t(r);a!=null&&(r.scrollIntoView({behavior:"smooth"}),re.value=a.vNode)},i=r=>{if(!r||r===document.body)return null;const a=r.parentElement,l=a?.nextElementSibling?.querySelector("h2[data-id]");return l||i(a)},s=()=>{const r=document.querySelector("h2[data-id]");n(r)},o=()=>{const r=document.querySelectorAll("h2[data-id]"),a=r.item(r.length-1);a&&n(a)};return ar(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],r=>{if(Nt.value&&(Nt.value=null),document.activeElement&&document.activeElement instanceof HTMLInputElement&&document.activeElement!=e.current)return;r.preventDefault();const a=document.querySelector(".selected-vnode");if(a===null){r.key==="ArrowDown"?s():r.key==="ArrowUp"&&o();return}if(r.key==="ArrowRight"){const l=t(a);l&&l.setCollapsed(!1);return}else if(r.key==="ArrowLeft"){const l=t(a);l&&l.setCollapsed(!0);return}if(r.key==="ArrowDown"){const l=a?.nextElementSibling?.querySelector("h2[data-id]");if(l)return n(l);const c=a.parentElement?.nextElementSibling?.querySelector("h2[data-id]");if(c)return n(c);const u=i(a);return u?n(u):s()}else if(r.key==="ArrowUp"){const l=a.parentElement?.previousElementSibling;if(l?.matches("h2[data-id]"))return n(l);const c=l?.querySelectorAll("h2[data-id]");return c?.length!=null&&c?.length>=1?n(c?.item?.(c.length-1)):o()}}),ar("l",r=>{r.ctrlKey&&(r.preventDefault(),e.current?.focus({preventScroll:!1}))}),{searchRef:e}},Jh=e=>{go.value=e.target.value,Nt.value&&(Nt.value=null)};function tf(){const{searchRef:e}=Qh(),t=Lt.value;return g("div",{className:"flex-grow p-2 sticky top-0"},g("div",{className:"flex gap-4 pb-2 border-b-2 border-neutral-800 mb-2 items-center"},g("input",{ref:e,className:"bg-[#171616] px-1 py-2 w-full focus:outline focus:outline-primary",placeholder:"Search for component",type:"text",value:go,oninput:Jh})),t?.rootNode&&g(Ti,{node:t.rootNode}))}const Ml=e=>{const{mouse:t}=jh(),n=J(null),i=J(0),s=J(0),o=He(null),r=Yh(o),a=He(null),[l,c]=Array.isArray(e.children)?e.children:[];return ao(()=>{a.current&&(s.value=a.current.clientWidth/2)},[a.current]),Le("mouseup",Ke(()=>n.value=null,[])),Le("mousemove",Ke(u=>{if(n.value==null||a.current==null)return;const f=Math.max(i.value+u.x-n.value.x,250);s.value=Math.min(f,a.current.clientWidth-250)},[])),Le("resize",Ke(()=>{a.current!=null&&a.current.clientWidth-250<s.value&&(s.value=Math.max(a.current.clientWidth-250,250))},[])),g("div",{onmousemove:u=>{u.x},ref:a,className:"flex-grow grid gap-2 items-start w-full relative",style:{gridTemplateColumns:\`\${s}px 1fr\`}},g("div",{ref:o,className:"firstContainer w-full h-full"},l),r.width.value!=0&&g("div",{className:"w-8 flex justify-center h-full absolute top-0 -translate-x-1/2 cursor-col-resize z-[9999]",style:{left:\`\${r.width}px\`},onmousedown:u=>{u.preventDefault(),n.value={...t.value},i.value=s.value}},g("div",{className:"dividerLine w-[5px] bg-neutral-800 h-full"})),g("div",{className:"secondContainer h-full"},c))},ef=()=>g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer"},g("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),g("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})),nf=()=>{Ze.value=!Ze.value,Ve.send({type:"set-inspect-enabled",value:Ze.value})};function sf(){const e=Lt.value,t=re.value,n=ge();return rt(()=>{const i=s=>{s===e&&n()};return U?.on("update",i),()=>U?.off("update",i)},[Lt]),rt(()=>{const i=s=>{if(s.data.type!=="select-node")return;_h(window.__devtoolsSelection,"no selection ptr");const{app:o,node:r}=window.__devtoolsSelection;window.__devtoolsSelection=null,Lt.value=o,re.value=r,Nt.value=r,Ze.value=!1};return Ve.addEventListener(i),()=>Ve.removeEventListener(i)},[Lt]),g(Tt,null,g("div",{className:"flex items-center justify-between gap-4 p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},g("div",{className:"flex items-center gap-4"},g("select",{className:"px-2 py-1 bg-neutral-800 text-neutral-100 rounded border border-white border-opacity-10",value:e?.name??"",onchange:i=>Lt.value=oe.peek().find(s=>s.name===i.currentTarget.value)??null},g("option",{value:"",disabled:!0},"Select App"),oe.value.map(i=>g("option",{key:i.id,value:i.name},i.name))),g("button",{title:"Toggle Component Inspection",onclick:nf,className:\`p-1 rounded \${Ze.value?"bg-neutral-900":""}\`},g(ef,null)))),g(Ml,null,e&&g(tf,null),t&&e&&g(Hh,{selectedApp:e,selectedNode:t,setSelectedNode:i=>re.value=i,kiruGlobal:U})))}const Fs=G({}),Pe=G([]);U?.stores?.subscribe(e=>{Fs.value=e,Pe.value=Pe.value.filter(t=>Object.values(Fs.value).includes(t))});const El=G(""),of=Bn(()=>El.value.toLowerCase().split(" ").filter(e=>e.length>0));function rf(e){return of.value.every(t=>e.toLowerCase().includes(t))}function af(){const e=Object.entries(Fs.value);return e.length===0?g("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},g(uo,null),g("h2",{className:"text-lg italic"},"No stores detected")):g("div",{className:"flex flex-col gap-2 items-start"},g(po,{value:El,className:"sticky top-0"}),g("div",{className:"flex flex-col gap-2 w-full"},e.filter(([t])=>rf(t)).map(([t,n])=>g(lf,{key:t,name:t,store:n}))))}function lf({name:e,store:t}){const n=Pe.value.includes(t),i=ge(),{value:s}=Cl(t);ao(()=>{const r=t.subscribe(()=>i());return()=>r()},[]);const o=Ke(()=>{n?Pe.value=Pe.value.filter(r=>r!==t):Pe.value=[...Pe.value,t]},[n]);return g("div",{className:"flex flex-col"},g("button",{onclick:o,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,g("div",{className:"flex gap-2"},g(Bi,{fn:t,onclick:r=>r.stopPropagation()}),g(ue,{className:"transition-all"+(n?" rotate-90":"")}))),n&&g("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},g(be,{data:{value:s},mutable:!0,objectRefAcc:[],onChange:(r,a)=>{const l=structuredClone({value:s});lo(l,r,a),t.setState(l.value)}}),g(cf,{store:t})))}function cf({store:e}){const t=oe.value;return t.length===0?null:g(Tt,null,t.map(n=>g(uf,{store:e,app:n})))}const cr=Symbol.for("kiru.hmrAccept"),Cl=e=>{if(cr in e)return e[cr].provide().current;throw new Error("Unable to get store subscribers")};function uf({store:e,app:t}){const n=ge(),{subscribers:i,nodeStateMap:s}=Cl(e),o=t.rootNode.child;if(rt(()=>{const a=l=>{l===t&&n()};return U?.on("update",a),()=>U?.off("update",a)},[]),!o)return null;const r=Rs(o,a=>i.has(a));return g("div",{className:"flex flex-col gap-2 p-2 rounded-b border border-white border-opacity-10"},g("b",null,t.name),r&&g("ul",{className:"pl-8"},g(zs,{node:r,nodeStateMap:s})))}function zs({node:e,nodeStateMap:t}){const[n,i]=me(!1),o=t.get(e.ref)?.slices??[];return g(Tt,null,g("li",{className:"flex flex-col gap-2"},g("div",{className:"flex flex-col border border-white border-opacity-10 rounded"+(n?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400")},g("button",{onclick:()=>i(!n),className:"flex gap-2 p-2 justify-between cursor-pointer"},g("span",null,"<"+co(e.ref)+" />"),g("div",{className:"flex gap-2 items-center"},g(Bi,{fn:e.ref.type,onclick:r=>r.stopPropagation()}),g(ue,{className:"transition-all"+(n?" rotate-90":"")}))),n&&g("div",{className:"flex flex-col gap-2 p-2 bg-[#1a1a1a]"},o.length===0&&g("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},g("h5",{className:"border-b border-white border-opacity-10"},"No slices")),o.map(r=>g("div",{className:"flex flex-col gap-2"},g("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},g("h5",{className:"border-b border-white border-opacity-10"},"Slice:"),g("pre",{className:"text-neutral-400"},g(be,{data:{value:r.value},mutable:!1,objectRefAcc:[],onChange:()=>{}}))),g("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},g("h5",{className:"border-b border-white border-opacity-10"},"SliceFn:"),g("pre",{className:"text-neutral-400"},r.sliceFn?r.sliceFn.toString():"null")),r.eq&&g("div",{className:"p-2 bg-black bg-opacity-30 text-sm"},g("h5",{className:"border-b border-white border-opacity-10"},"eq:"),g("pre",{className:"text-neutral-400"},r.eq.toString())))))),e.child&&g("ul",{className:"pl-8 flex flex-col gap-2"},g(zs,{node:e.child,nodeStateMap:t}))),e.sibling&&g(zs,{node:e.sibling,nodeStateMap:t}))}/*!
|
|
9127
9749
|
* @kurkle/color v0.3.4
|
|
9128
9750
|
* https://github.com/kurkle/color#readme
|
|
9129
9751
|
* (c) 2024 Jukka Kurkela
|
|
9130
9752
|
* Released under the MIT License
|
|
9131
|
-
*/function
|
|
9753
|
+
*/function Wn(e){return e+.5|0}const ne=(e,t,n)=>Math.max(Math.min(e,n),t);function Sn(e){return ne(Wn(e*2.55),0,255)}function ae(e){return ne(Wn(e*255),0,255)}function Yt(e){return ne(Wn(e/2.55)/100,0,1)}function ur(e){return ne(Wn(e*100),0,100)}const bt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Hs=[..."0123456789ABCDEF"],hf=e=>Hs[e&15],ff=e=>Hs[(e&240)>>4]+Hs[e&15],ei=e=>(e&240)>>4===(e&15),df=e=>ei(e.r)&&ei(e.g)&&ei(e.b)&&ei(e.a);function pf(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&bt[e[1]]*17,g:255&bt[e[2]]*17,b:255&bt[e[3]]*17,a:t===5?bt[e[4]]*17:255}:(t===7||t===9)&&(n={r:bt[e[1]]<<4|bt[e[2]],g:bt[e[3]]<<4|bt[e[4]],b:bt[e[5]]<<4|bt[e[6]],a:t===9?bt[e[7]]<<4|bt[e[8]]:255})),n}const gf=(e,t)=>e<255?t(e):"";function mf(e){var t=df(e)?hf:ff;return e?"#"+t(e.r)+t(e.g)+t(e.b)+gf(e.a,t):void 0}const bf=/^(hsla?|hwb|hsv)\\(\\s*([-+.e\\d]+)(?:deg)?[\\s,]+([-+.e\\d]+)%[\\s,]+([-+.e\\d]+)%(?:[\\s,]+([-+.e\\d]+)(%)?)?\\s*\\)$/;function Ol(e,t,n){const i=t*Math.min(n,1-n),s=(o,r=(o+e/30)%12)=>n-i*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function yf(e,t,n){const i=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function xf(e,t,n){const i=Ol(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)i[s]*=1-t-n,i[s]+=t;return i}function vf(e,t,n,i,s){return e===s?(t-n)/i+(t<n?6:0):t===s?(n-e)/i+2:(e-t)/i+4}function mo(e){const n=e.r/255,i=e.g/255,s=e.b/255,o=Math.max(n,i,s),r=Math.min(n,i,s),a=(o+r)/2;let l,c,u;return o!==r&&(u=o-r,c=a>.5?u/(2-o-r):u/(o+r),l=vf(n,i,s,u,o),l=l*60+.5),[l|0,c||0,a]}function bo(e,t,n,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,i)).map(ae)}function yo(e,t,n){return bo(Ol,e,t,n)}function _f(e,t,n){return bo(xf,e,t,n)}function wf(e,t,n){return bo(yf,e,t,n)}function Pl(e){return(e%360+360)%360}function Sf(e){const t=bf.exec(e);let n=255,i;if(!t)return;t[5]!==i&&(n=t[6]?Sn(+t[5]):ae(+t[5]));const s=Pl(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=_f(s,o,r):t[1]==="hsv"?i=wf(s,o,r):i=yo(s,o,r),{r:i[0],g:i[1],b:i[2],a:n}}function kf(e,t){var n=mo(e);n[0]=Pl(n[0]+t),n=yo(n),e.r=n[0],e.g=n[1],e.b=n[2]}function Tf(e){if(!e)return;const t=mo(e),n=t[0],i=ur(t[1]),s=ur(t[2]);return e.a<255?\`hsla(\${n}, \${i}%, \${s}%, \${Yt(e.a)})\`:\`hsl(\${n}, \${i}%, \${s}%)\`}const hr={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},fr={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Mf(){const e={},t=Object.keys(fr),n=Object.keys(hr);let i,s,o,r,a;for(i=0;i<t.length;i++){for(r=a=t[i],s=0;s<n.length;s++)o=n[s],a=a.replace(o,hr[o]);o=parseInt(fr[r],16),e[a]=[o>>16&255,o>>8&255,o&255]}return e}let ni;function Ef(e){ni||(ni=Mf(),ni.transparent=[0,0,0,0]);const t=ni[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Cf=/^rgba?\\(\\s*([-+.\\d]+)(%)?[\\s,]+([-+.e\\d]+)(%)?[\\s,]+([-+.e\\d]+)(%)?(?:[\\s,/]+([-+.e\\d]+)(%)?)?\\s*\\)$/;function Of(e){const t=Cf.exec(e);let n=255,i,s,o;if(t){if(t[7]!==i){const r=+t[7];n=t[8]?Sn(r):ne(r*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?Sn(i):ne(i,0,255)),s=255&(t[4]?Sn(s):ne(s,0,255)),o=255&(t[6]?Sn(o):ne(o,0,255)),{r:i,g:s,b:o,a:n}}}function Pf(e){return e&&(e.a<255?\`rgba(\${e.r}, \${e.g}, \${e.b}, \${Yt(e.a)})\`:\`rgb(\${e.r}, \${e.g}, \${e.b})\`)}const is=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,qe=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function Df(e,t,n){const i=qe(Yt(e.r)),s=qe(Yt(e.g)),o=qe(Yt(e.b));return{r:ae(is(i+n*(qe(Yt(t.r))-i))),g:ae(is(s+n*(qe(Yt(t.g))-s))),b:ae(is(o+n*(qe(Yt(t.b))-o))),a:e.a+n*(t.a-e.a)}}function ii(e,t,n){if(e){let i=mo(e);i[t]=Math.max(0,Math.min(i[t]+i[t]*n,t===0?360:1)),i=yo(i),e.r=i[0],e.g=i[1],e.b=i[2]}}function Dl(e,t){return e&&Object.assign(t||{},e)}function dr(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=ae(e[3]))):(t=Dl(e,{r:0,g:0,b:0,a:1}),t.a=ae(t.a)),t}function Af(e){return e.charAt(0)==="r"?Of(e):Sf(e)}class Ln{constructor(t){if(t instanceof Ln)return t;const n=typeof t;let i;n==="object"?i=dr(t):n==="string"&&(i=pf(t)||Ef(t)||Af(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Dl(this._rgb);return t&&(t.a=Yt(t.a)),t}set rgb(t){this._rgb=dr(t)}rgbString(){return this._valid?Pf(this._rgb):void 0}hexString(){return this._valid?mf(this._rgb):void 0}hslString(){return this._valid?Tf(this._rgb):void 0}mix(t,n){if(t){const i=this.rgb,s=t.rgb;let o;const r=n===o?.5:n,a=2*r-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,i.r=255&c*i.r+o*s.r+.5,i.g=255&c*i.g+o*s.g+.5,i.b=255&c*i.b+o*s.b+.5,i.a=r*i.a+(1-r)*s.a,this.rgb=i}return this}interpolate(t,n){return t&&(this._rgb=Df(this._rgb,t._rgb,n)),this}clone(){return new Ln(this.rgb)}alpha(t){return this._rgb.a=ae(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=Wn(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return ii(this._rgb,2,t),this}darken(t){return ii(this._rgb,2,-t),this}saturate(t){return ii(this._rgb,1,t),this}desaturate(t){return ii(this._rgb,1,-t),this}rotate(t){return kf(this._rgb,t),this}}/*!
|
|
9132
9754
|
* Chart.js v4.5.0
|
|
9133
9755
|
* https://www.chartjs.org
|
|
9134
9756
|
* (c) 2025 Chart.js Contributors
|
|
9135
9757
|
* Released under the MIT License
|
|
9136
|
-
*/function jt(){}const Ef=(()=>{let e=0;return()=>e++})();function B(e){return e==null}function tt(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function V(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function vt(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Pt(e,t){return vt(e)?e:t}function R(e,t){return typeof e>"u"?t:e}const Cf=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function I(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function F(e,t,n,i){let s,o,r;if(tt(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(V(e))for(r=Object.keys(e),o=r.length,s=0;s<o;s++)t.call(n,e[r[s]],r[s])}function Mi(e,t){let n,i,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function Ei(e){if(tt(e))return e.map(Ei);if(V(e)){const t=Object.create(null),n=Object.keys(e),i=n.length;let s=0;for(;s<i;++s)t[n[s]]=Ei(e[n[s]]);return t}return e}function Pl(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function Of(e,t,n,i){if(!Pl(e))return;const s=t[e],o=n[e];V(s)&&V(o)?Ln(s,o,i):t[e]=Ei(o)}function Ln(e,t,n){const i=tt(t)?t:[t],s=i.length;if(!V(e))return e;n=n||{};const o=n.merger||Of;let r;for(let a=0;a<s;++a){if(r=i[a],!V(r))continue;const l=Object.keys(r);for(let c=0,u=l.length;c<u;++c)o(l[c],e,r,n)}return e}function Mn(e,t){return Ln(e,t,{merger:Pf})}function Pf(e,t,n){if(!Pl(e))return;const i=t[e],s=n[e];V(i)&&V(s)?Mn(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Ei(s))}const fr={"":e=>e,x:e=>e.x,y:e=>e.y};function Df(e){const t=e.split("."),n=[];let i="";for(const s of t)i+=s,i.endsWith("\\\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function Af(e){const t=Df(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function Ci(e,t){return(fr[t]||(fr[t]=Af(t)))(e)}function bo(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Oi=e=>typeof e<"u",ue=e=>typeof e=="function",dr=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function If(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const et=Math.PI,Ft=2*et,Lf=Ft+et,Pi=Number.POSITIVE_INFINITY,Rf=et/180,kt=et/2,Se=et/4,pr=et*2/3,Dl=Math.log10,he=Math.sign;function Ie(e,t,n){return Math.abs(e-t)<n}function gr(e){const t=Math.round(e);e=Ie(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(Dl(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function Nf(e){const t=[],n=Math.sqrt(e);let i;for(i=1;i<n;i++)e%i===0&&(t.push(i),t.push(e/i));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function Ff(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function Rn(e){return!Ff(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function zf(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function Hf(e,t,n){let i,s,o;for(i=0,s=e.length;i<s;i++)o=e[i][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Pe(e){return e*(et/180)}function Vf(e){return e*(180/et)}function mr(e){if(!vt(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function Bf(e,t){const n=t.x-e.x,i=t.y-e.y,s=Math.sqrt(n*n+i*i);let o=Math.atan2(i,n);return o<-.5*et&&(o+=Ft),{angle:o,distance:s}}function zs(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Wf(e,t){return(e-t+Lf)%Ft-et}function Jt(e){return(e%Ft+Ft)%Ft}function Al(e,t,n,i){const s=Jt(e),o=Jt(t),r=Jt(n),a=Jt(o-s),l=Jt(r-s),c=Jt(s-o),u=Jt(s-r);return s===o||s===r||i&&o===r||a>l&&c<u}function xt(e,t,n){return Math.max(t,Math.min(n,e))}function jf(e){return xt(e,-32768,32767)}function Sn(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function xo(e,t,n){n=n||(r=>e[r]<t);let i=e.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,n(o)?s=o:i=o;return{lo:s,hi:i}}const De=(e,t,n,i)=>xo(e,n,i?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),$f=(e,t,n)=>xo(e,n,i=>e[i][t]>=n);function Uf(e,t,n){let i=0,s=e.length;for(;i<s&&e[i]<t;)i++;for(;s>i&&e[s-1]>n;)s--;return i>0||s<e.length?e.slice(i,s):e}const Il=["push","pop","shift","splice","unshift"];function Yf(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Il.forEach(n=>{const i="_onData"+bo(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function br(e,t){const n=e._chartjs;if(!n)return;const i=n.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Il.forEach(o=>{delete e[o]}),delete e._chartjs)}function Xf(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const Ll=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function Rl(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,Ll.call(window,()=>{i=!1,e.apply(t,n)}))}}function qf(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const Nl=e=>e==="start"?"left":e==="end"?"right":"center",ft=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,Gf=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function Kf(e,t,n){const i=t.length;let s=0,o=i;if(e._sorted){const{iScale:r,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=r.axis,{min:f,max:d,minDefined:m,maxDefined:y}=r.getUserBounds();if(m){if(s=Math.min(De(l,u,f).lo,n?i:De(t,u,r.getPixelForValue(f)).lo),c){const x=l.slice(0,s+1).reverse().findIndex(v=>!B(v[a.axis]));s-=Math.max(0,x)}s=xt(s,0,i-1)}if(y){let x=Math.max(De(l,r.axis,d,!0).hi+1,n?0:De(t,u,r.getPixelForValue(d),!0).hi+1);if(c){const v=l.slice(x-1).findIndex(w=>!B(w[a.axis]));x+=Math.max(0,v)}o=xt(x,s,i)-s}else o=i-s}return{start:s,count:o}}function Zf(e){const{xScale:t,yScale:n,_scaleRanges:i}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!i)return e._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,s),o}const ii=e=>e===0||e===1,xr=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*Ft/n)),yr=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*Ft/n)+1,En={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*kt)+1,easeOutSine:e=>Math.sin(e*kt),easeInOutSine:e=>-.5*(Math.cos(et*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>ii(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>ii(e)?e:xr(e,.075,.3),easeOutElastic:e=>ii(e)?e:yr(e,.075,.3),easeInOutElastic(e){return ii(e)?e:e<.5?.5*xr(e*2,.1125,.45):.5+.5*yr(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-En.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?En.easeInBounce(e*2)*.5:En.easeOutBounce(e*2-1)*.5+.5};function yo(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function vr(e){return yo(e)?e:new In(e)}function ns(e){return yo(e)?e:new In(e).saturate(.5).darken(.1).hexString()}const Qf=["x","y","borderWidth","radius","tension"],Jf=["color","borderColor","backgroundColor"];function td(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:Jf},numbers:{type:"number",properties:Qf}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function ed(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const _r=new Map;function nd(e,t){t=t||{};const n=e+JSON.stringify(t);let i=_r.get(n);return i||(i=new Intl.NumberFormat(e,t),_r.set(n,i)),i}function Fl(e,t,n){return nd(t,n).format(e)}const id={values(e){return tt(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const i=this.chart.options.locale;let s,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=sd(e,n)}const r=Dl(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Fl(e,i,l)}};function sd(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var zl={formatters:id};function od(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:zl.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const ze=Object.create(null),Hs=Object.create(null);function Cn(e,t){if(!t)return e;const n=t.split(".");for(let i=0,s=n.length;i<s;++i){const o=n[i];e=e[o]||(e[o]=Object.create(null))}return e}function is(e,t,n){return typeof t=="string"?Ln(Cn(e,t),n):Ln(Cn(e,""),t)}class rd{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>ns(s.backgroundColor),this.hoverBorderColor=(i,s)=>ns(s.borderColor),this.hoverColor=(i,s)=>ns(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return is(this,t,n)}get(t){return Cn(this,t)}describe(t,n){return is(Hs,t,n)}override(t,n){return is(ze,t,n)}route(t,n,i,s){const o=Cn(this,t),r=Cn(this,i),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=r[s];return V(l)?Object.assign({},c,l):R(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var Y=new rd({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[td,ed,od]);function ad(e){return!e||B(e.size)||B(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function wr(e,t,n,i,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>i&&(i=o),i}function ke(e,t,n){const i=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*i)/i+s}function Sr(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Vs(e,t,n,i){Hl(e,t,n,i,null)}function Hl(e,t,n,i,s){let o,r,a,l,c,u,f,d;const m=t.pointStyle,y=t.rotation,x=t.radius;let v=(y||0)*Rf;if(m&&typeof m=="object"&&(o=m.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(v),e.drawImage(m,-m.width/2,-m.height/2,m.width,m.height),e.restore();return}if(!(isNaN(x)||x<=0)){switch(e.beginPath(),m){default:s?e.ellipse(n,i,s/2,x,0,0,Ft):e.arc(n,i,x,0,Ft),e.closePath();break;case"triangle":u=s?s/2:x,e.moveTo(n+Math.sin(v)*u,i-Math.cos(v)*x),v+=pr,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*x),v+=pr,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*x),e.closePath();break;case"rectRounded":c=x*.516,l=x-c,r=Math.cos(v+Se)*l,f=Math.cos(v+Se)*(s?s/2-c:l),a=Math.sin(v+Se)*l,d=Math.sin(v+Se)*(s?s/2-c:l),e.arc(n-f,i-a,c,v-et,v-kt),e.arc(n+d,i-r,c,v-kt,v),e.arc(n+f,i+a,c,v,v+kt),e.arc(n-d,i+r,c,v+kt,v+et),e.closePath();break;case"rect":if(!y){l=Math.SQRT1_2*x,u=s?s/2:l,e.rect(n-u,i-l,2*u,2*l);break}v+=Se;case"rectRot":f=Math.cos(v)*(s?s/2:x),r=Math.cos(v)*x,a=Math.sin(v)*x,d=Math.sin(v)*(s?s/2:x),e.moveTo(n-f,i-a),e.lineTo(n+d,i-r),e.lineTo(n+f,i+a),e.lineTo(n-d,i+r),e.closePath();break;case"crossRot":v+=Se;case"cross":f=Math.cos(v)*(s?s/2:x),r=Math.cos(v)*x,a=Math.sin(v)*x,d=Math.sin(v)*(s?s/2:x),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r);break;case"star":f=Math.cos(v)*(s?s/2:x),r=Math.cos(v)*x,a=Math.sin(v)*x,d=Math.sin(v)*(s?s/2:x),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r),v+=Se,f=Math.cos(v)*(s?s/2:x),r=Math.cos(v)*x,a=Math.sin(v)*x,d=Math.sin(v)*(s?s/2:x),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r);break;case"line":r=s?s/2:Math.cos(v)*x,a=Math.sin(v)*x,e.moveTo(n-r,i-a),e.lineTo(n+r,i+a);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(v)*(s?s/2:x),i+Math.sin(v)*x);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function en(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function vo(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function _o(e){e.restore()}function ld(e,t,n,i,s){if(!t)return e.lineTo(n.x,n.y);if(s==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else s==="after"!=!!i?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function cd(e,t,n,i){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?n.cp2x:n.cp1x,i?n.cp2y:n.cp1y,n.x,n.y)}function ud(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),B(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function hd(e,t,n,i,s){if(s.strikethrough||s.underline){const o=e.measureText(i),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(r,u),e.lineTo(a,u),e.stroke()}}function fd(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Di(e,t,n,i,s,o={}){const r=tt(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,ud(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&fd(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),B(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,i,o.maxWidth)),e.fillText(c,n,i,o.maxWidth),hd(e,n,i,c,o),i+=Number(s.lineHeight);e.restore()}function Bs(e,t){const{x:n,y:i,w:s,h:o,radius:r}=t;e.arc(n+r.topLeft,i+r.topLeft,r.topLeft,1.5*et,et,!0),e.lineTo(n,i+o-r.bottomLeft),e.arc(n+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,et,kt,!0),e.lineTo(n+s-r.bottomRight,i+o),e.arc(n+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,kt,0,!0),e.lineTo(n+s,i+r.topRight),e.arc(n+s-r.topRight,i+r.topRight,r.topRight,0,-kt,!0),e.lineTo(n+r.topLeft,i)}const dd=/^(normal|(\\d+(?:\\.\\d+)?)(px|em|%)?)$/,pd=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function gd(e,t){const n=(""+e).match(dd);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const md=e=>+e||0;function Vl(e,t){const n={},i=V(t),s=i?Object.keys(t):t,o=V(e)?i?r=>R(e[r],e[t[r]]):r=>e[r]:()=>e;for(const r of s)n[r]=md(o(r));return n}function bd(e){return Vl(e,{top:"y",right:"x",bottom:"y",left:"x"})}function On(e){return Vl(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Mt(e){const t=bd(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ht(e,t){e=e||{},t=t||Y.font;let n=R(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=R(e.style,t.style);i&&!(""+i).match(pd)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:R(e.family,t.family),lineHeight:gd(R(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:R(e.weight,t.weight),string:""};return s.string=ad(s),s}function si(e,t,n,i){let s,o,r;for(s=0,o=e.length;s<o;++s)if(r=e[s],r!==void 0&&r!==void 0)return r}function xd(e,t,n){const{min:i,max:s}=e,o=Cf(t,(s-i)/2),r=(a,l)=>n&&a===0?0:a+l;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function Ve(e,t){return Object.assign(Object.create(e),t)}function wo(e,t=[""],n,i,s=()=>e[0]){const o=n||e;typeof i>"u"&&(i=$l("_fallback",e));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>wo([a,...e],t,o,i)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return Wl(a,l,()=>Md(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return Tr(a).includes(l)},ownKeys(a){return Tr(a)},set(a,l,c){const u=a._storage||(a._storage=s());return a[l]=u[l]=c,delete a._keys,!0}})}function nn(e,t,n,i){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:Bl(e,i),setContext:o=>nn(e,o,n,i),override:o=>nn(e.override(o),t,n,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return Wl(o,r,()=>vd(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function Bl(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:i,isScriptable:ue(n)?n:()=>n,isIndexable:ue(i)?i:()=>i}}const yd=(e,t)=>e?e+bo(t):t,So=(e,t)=>V(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Wl(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function vd(e,t,n){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=e;let a=i[t];return ue(a)&&r.isScriptable(t)&&(a=_d(t,a,e,n)),tt(a)&&a.length&&(a=wd(t,a,e,r.isIndexable)),So(t,a)&&(a=nn(a,s,o&&o[t],r)),a}function _d(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,r||i);return a.delete(e),So(e,l)&&(l=ko(s._scopes,s,e,l)),l}function wd(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=n;if(typeof o.index<"u"&&i(e))return t[o.index%t.length];if(V(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const f=ko(c,s,e,u);t.push(nn(f,o,r&&r[e],a))}}return t}function jl(e,t,n){return ue(e)?e(t,n):e}const Sd=(e,t)=>e===!0?t:typeof e=="string"?Ci(t,e):void 0;function kd(e,t,n,i,s){for(const o of t){const r=Sd(n,o);if(r){e.add(r);const a=jl(r._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==i)return a}else if(r===!1&&typeof i<"u"&&n!==i)return null}return!1}function ko(e,t,n,i){const s=t._rootScopes,o=jl(t._fallback,n,i),r=[...e,...s],a=new Set;a.add(i);let l=kr(a,r,n,o||n,i);return l===null||typeof o<"u"&&o!==n&&(l=kr(a,r,o,l,i),l===null)?!1:wo(Array.from(a),[""],s,o,()=>Td(t,n,i))}function kr(e,t,n,i,s){for(;n;)n=kd(e,t,n,i,s);return n}function Td(e,t,n){const i=e._getTarget();t in i||(i[t]={});const s=i[t];return tt(s)&&V(n)?n:s||{}}function Md(e,t,n,i){let s;for(const o of t)if(s=$l(yd(o,e),n),typeof s<"u")return So(e,s)?ko(n,i,e,s):s}function $l(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function Tr(e){let t=e._keys;return t||(t=e._keys=Ed(e._scopes)),t}function Ed(e){const t=new Set;for(const n of e)for(const i of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}const Cd=Number.EPSILON||1e-14,sn=(e,t)=>t<e.length&&!e[t].skip&&e[t],Ul=e=>e==="x"?"y":"x";function Od(e,t,n,i){const s=e.skip?t:e,o=t,r=n.skip?t:n,a=zs(o,s),l=zs(r,o);let c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const f=i*c,d=i*u;return{previous:{x:o.x-f*(r.x-s.x),y:o.y-f*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function Pd(e,t,n){const i=e.length;let s,o,r,a,l,c=sn(e,0);for(let u=0;u<i-1;++u)if(l=c,c=sn(e,u+1),!(!l||!c)){if(Ie(t[u],0,Cd)){n[u]=n[u+1]=0;continue}s=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[u]=s*r*t[u],n[u+1]=o*r*t[u])}}function Dd(e,t,n="x"){const i=Ul(n),s=e.length;let o,r,a,l=sn(e,0);for(let c=0;c<s;++c){if(r=a,a=l,l=sn(e,c+1),!a)continue;const u=a[n],f=a[i];r&&(o=(u-r[n])/3,a[\`cp1\${n}\`]=u-o,a[\`cp1\${i}\`]=f-o*t[c]),l&&(o=(l[n]-u)/3,a[\`cp2\${n}\`]=u+o,a[\`cp2\${i}\`]=f+o*t[c])}}function Ad(e,t="x"){const n=Ul(t),i=e.length,s=Array(i).fill(0),o=Array(i);let r,a,l,c=sn(e,0);for(r=0;r<i;++r)if(a=l,l=c,c=sn(e,r+1),!!l){if(c){const u=c[t]-l[t];s[r]=u!==0?(c[n]-l[n])/u:0}o[r]=a?c?he(s[r-1])!==he(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}Pd(e,s,o),Dd(e,o,t)}function oi(e,t,n){return Math.max(Math.min(e,n),t)}function Id(e,t){let n,i,s,o,r,a=en(e[0],t);for(n=0,i=e.length;n<i;++n)r=o,o=a,a=n<i-1&&en(e[n+1],t),o&&(s=e[n],r&&(s.cp1x=oi(s.cp1x,t.left,t.right),s.cp1y=oi(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=oi(s.cp2x,t.left,t.right),s.cp2y=oi(s.cp2y,t.top,t.bottom)))}function Ld(e,t,n,i,s){let o,r,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Ad(e,s);else{let c=i?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=Od(c,a,e[Math.min(o+1,r-(i?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&Id(e,n)}function To(){return typeof window<"u"&&typeof document<"u"}function Mo(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ai(e,t,n){let i;return typeof e=="string"?(i=parseInt(e,10),e.indexOf("%")!==-1&&(i=i/100*t.parentNode[n])):i=e,i}const Vi=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function Rd(e,t){return Vi(e).getPropertyValue(t)}const Nd=["top","right","bottom","left"];function Le(e,t,n){const i={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=Nd[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Fd=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function zd(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i;let r=!1,a,l;if(Fd(s,o,e.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function It(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,s=Vi(n),o=s.boxSizing==="border-box",r=Le(s,"padding"),a=Le(s,"border","width"),{x:l,y:c,box:u}=zd(e,n),f=r.left+(u&&a.left),d=r.top+(u&&a.top);let{width:m,height:y}=t;return o&&(m-=r.width+a.width,y-=r.height+a.height),{x:Math.round((l-f)/m*n.width/i),y:Math.round((c-d)/y*n.height/i)}}function Hd(e,t,n){let i,s;if(t===void 0||n===void 0){const o=e&&Mo(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const r=o.getBoundingClientRect(),a=Vi(o),l=Le(a,"border","width"),c=Le(a,"padding");t=r.width-c.width-l.width,n=r.height-c.height-l.height,i=Ai(a.maxWidth,o,"clientWidth"),s=Ai(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||Pi,maxHeight:s||Pi}}const ri=e=>Math.round(e*10)/10;function Vd(e,t,n,i){const s=Vi(e),o=Le(s,"margin"),r=Ai(s.maxWidth,e,"clientWidth")||Pi,a=Ai(s.maxHeight,e,"clientHeight")||Pi,l=Hd(e,t,n);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const d=Le(s,"border","width"),m=Le(s,"padding");c-=m.width+d.width,u-=m.height+d.height}return c=Math.max(0,c-o.width),u=Math.max(0,i?c/i:u-o.height),c=ri(Math.min(c,r,l.maxWidth)),u=ri(Math.min(u,a,l.maxHeight)),c&&!u&&(u=ri(c/2)),(t!==void 0||n!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=ri(Math.floor(u*i))),{width:c,height:u}}function Mr(e,t,n){const i=t||1,s=Math.floor(e.height*i),o=Math.floor(e.width*i);e.height=Math.floor(e.height),e.width=Math.floor(e.width);const r=e.canvas;return r.style&&(n||!r.style.height&&!r.style.width)&&(r.style.height=\`\${e.height}px\`,r.style.width=\`\${e.width}px\`),e.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(e.currentDevicePixelRatio=i,r.height=s,r.width=o,e.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Bd=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};To()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function Er(e,t){const n=Rd(e,t),i=n&&n.match(/^(\\d+)(\\.\\d+)?px$/);return i?+i[1]:void 0}function Me(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function Wd(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:i==="middle"?n<.5?e.y:t.y:i==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function jd(e,t,n,i){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=Me(e,s,n),a=Me(s,o,n),l=Me(o,t,n),c=Me(r,a,n),u=Me(a,l,n);return Me(c,u,n)}const $d=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},Ud=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Ge(e,t,n){return e?$d(t,n):Ud()}function Yl(e,t){let n,i;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=i)}function Xl(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function ql(e){return e==="angle"?{between:Al,compare:Wf,normalize:Jt}:{between:Sn,compare:(t,n)=>t-n,normalize:t=>t}}function Cr({start:e,end:t,count:n,loop:i,style:s}){return{start:e%n,end:t%n,loop:i&&(t-e+1)%n===0,style:s}}function Yd(e,t,n){const{property:i,start:s,end:o}=n,{between:r,normalize:a}=ql(i),l=t.length;let{start:c,end:u,loop:f}=e,d,m;if(f){for(c+=l,u+=l,d=0,m=l;d<m&&r(a(t[c%l][i]),s,o);++d)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:f,style:e.style}}function Xd(e,t,n){if(!n)return[e];const{property:i,start:s,end:o}=n,r=t.length,{compare:a,between:l,normalize:c}=ql(i),{start:u,end:f,loop:d,style:m}=Yd(e,t,n),y=[];let x=!1,v=null,w,k,E;const C=()=>l(s,E,w)&&a(s,E)!==0,T=()=>a(o,w)===0||l(o,E,w),D=()=>x||C(),P=()=>!x||T();for(let O=u,A=u;O<=f;++O)k=t[O%r],!k.skip&&(w=c(k[i]),w!==E&&(x=l(w,s,o),v===null&&D()&&(v=a(w,s)===0?O:A),v!==null&&P()&&(y.push(Cr({start:v,end:O,loop:d,count:r,style:m})),v=null),A=O,E=w));return v!==null&&y.push(Cr({start:v,end:f,loop:d,count:r,style:m})),y}function qd(e,t){const n=[],i=e.segments;for(let s=0;s<i.length;s++){const o=Xd(i[s],e.points,t);o.length&&n.push(...o)}return n}function Gd(e,t,n,i){let s=0,o=t-1;if(n&&!i)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,n&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Kd(e,t,n,i){const s=e.length,o=[];let r=t,a=e[t],l;for(l=t+1;l<=n;++l){const c=e[l%s];c.skip||c.stop?a.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function Zd(e,t){const n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:r,end:a}=Gd(n,s,o,i);if(i===!0)return Or(e,[{start:r,end:a,loop:o}],n,t);const l=a<r?a+s:a,c=!!e._fullLoop&&r===0&&a===s-1;return Or(e,Kd(n,r,l,c),n,t)}function Or(e,t,n,i){return!i||!i.setContext||!n?t:Qd(e,t,n,i)}function Qd(e,t,n,i){const s=e._chart.getContext(),o=Pr(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=n.length,c=[];let u=o,f=t[0].start,d=f;function m(y,x,v,w){const k=a?-1:1;if(y!==x){for(y+=l;n[y%l].skip;)y-=k;for(;n[x%l].skip;)x+=k;y%l!==x%l&&(c.push({start:y%l,end:x%l,loop:v,style:w}),u=w,f=x%l)}}for(const y of t){f=a?f:y.start;let x=n[f%l],v;for(d=f+1;d<=y.end;d++){const w=n[d%l];v=Pr(i.setContext(Ve(s,{type:"segment",p0:x,p1:w,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:r}))),Jd(v,u)&&m(f,d-1,y.loop,u),x=w,u=v}f<d-1&&m(f,d-1,y.loop,u)}return c}function Pr(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Jd(e,t){if(!t)return!1;const n=[],i=function(s,o){return yo(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function ai(e,t,n){return e.options.clip?e[n]:t[n]}function tp(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:ai(n,t,"left"),right:ai(n,t,"right"),top:ai(i,t,"top"),bottom:ai(i,t,"bottom")}:t}function ep(e,t){const n=t._clip;if(n.disabled)return!1;const i=tp(t,e.chartArea);return{left:n.left===!1?0:i.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:i.right+(n.right===!0?0:n.right),top:n.top===!1?0:i.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:i.bottom+(n.bottom===!0?0:n.bottom)}}/*!
|
|
9758
|
+
*/function jt(){}const If=(()=>{let e=0;return()=>e++})();function B(e){return e==null}function tt(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function V(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function vt(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function Pt(e,t){return vt(e)?e:t}function N(e,t){return typeof e>"u"?t:e}const Lf=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function I(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function F(e,t,n,i){let s,o,r;if(tt(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(V(e))for(r=Object.keys(e),o=r.length,s=0;s<o;s++)t.call(n,e[r[s]],r[s])}function Mi(e,t){let n,i,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function Ei(e){if(tt(e))return e.map(Ei);if(V(e)){const t=Object.create(null),n=Object.keys(e),i=n.length;let s=0;for(;s<i;++s)t[n[s]]=Ei(e[n[s]]);return t}return e}function Al(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function Nf(e,t,n,i){if(!Al(e))return;const s=t[e],o=n[e];V(s)&&V(o)?Nn(s,o,i):t[e]=Ei(o)}function Nn(e,t,n){const i=tt(t)?t:[t],s=i.length;if(!V(e))return e;n=n||{};const o=n.merger||Nf;let r;for(let a=0;a<s;++a){if(r=i[a],!V(r))continue;const l=Object.keys(r);for(let c=0,u=l.length;c<u;++c)o(l[c],e,r,n)}return e}function En(e,t){return Nn(e,t,{merger:Rf})}function Rf(e,t,n){if(!Al(e))return;const i=t[e],s=n[e];V(i)&&V(s)?En(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=Ei(s))}const pr={"":e=>e,x:e=>e.x,y:e=>e.y};function Ff(e){const t=e.split("."),n=[];let i="";for(const s of t)i+=s,i.endsWith("\\\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function zf(e){const t=Ff(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function Ci(e,t){return(pr[t]||(pr[t]=zf(t)))(e)}function xo(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Oi=e=>typeof e<"u",he=e=>typeof e=="function",gr=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function Hf(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const et=Math.PI,Ft=2*et,Vf=Ft+et,Pi=Number.POSITIVE_INFINITY,Bf=et/180,kt=et/2,Te=et/4,mr=et*2/3,Il=Math.log10,fe=Math.sign;function Ne(e,t,n){return Math.abs(e-t)<n}function br(e){const t=Math.round(e);e=Ne(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(Il(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function Wf(e){const t=[],n=Math.sqrt(e);let i;for(i=1;i<n;i++)e%i===0&&(t.push(i),t.push(e/i));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function jf(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function Rn(e){return!jf(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function $f(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function Uf(e,t,n){let i,s,o;for(i=0,s=e.length;i<s;i++)o=e[i][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Ae(e){return e*(et/180)}function Yf(e){return e*(180/et)}function yr(e){if(!vt(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function Xf(e,t){const n=t.x-e.x,i=t.y-e.y,s=Math.sqrt(n*n+i*i);let o=Math.atan2(i,n);return o<-.5*et&&(o+=Ft),{angle:o,distance:s}}function Vs(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function qf(e,t){return(e-t+Vf)%Ft-et}function te(e){return(e%Ft+Ft)%Ft}function Ll(e,t,n,i){const s=te(e),o=te(t),r=te(n),a=te(o-s),l=te(r-s),c=te(s-o),u=te(s-r);return s===o||s===r||i&&o===r||a>l&&c<u}function yt(e,t,n){return Math.max(t,Math.min(n,e))}function Gf(e){return yt(e,-32768,32767)}function kn(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function vo(e,t,n){n=n||(r=>e[r]<t);let i=e.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,n(o)?s=o:i=o;return{lo:s,hi:i}}const Ie=(e,t,n,i)=>vo(e,n,i?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),Kf=(e,t,n)=>vo(e,n,i=>e[i][t]>=n);function Zf(e,t,n){let i=0,s=e.length;for(;i<s&&e[i]<t;)i++;for(;s>i&&e[s-1]>n;)s--;return i>0||s<e.length?e.slice(i,s):e}const Nl=["push","pop","shift","splice","unshift"];function Qf(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Nl.forEach(n=>{const i="_onData"+xo(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return e._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function xr(e,t){const n=e._chartjs;if(!n)return;const i=n.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Nl.forEach(o=>{delete e[o]}),delete e._chartjs)}function Jf(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const Rl=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function Fl(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,Rl.call(window,()=>{i=!1,e.apply(t,n)}))}}function td(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const zl=e=>e==="start"?"left":e==="end"?"right":"center",ft=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,ed=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function nd(e,t,n){const i=t.length;let s=0,o=i;if(e._sorted){const{iScale:r,vScale:a,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=r.axis,{min:f,max:d,minDefined:m,maxDefined:x}=r.getUserBounds();if(m){if(s=Math.min(Ie(l,u,f).lo,n?i:Ie(t,u,r.getPixelForValue(f)).lo),c){const y=l.slice(0,s+1).reverse().findIndex(v=>!B(v[a.axis]));s-=Math.max(0,y)}s=yt(s,0,i-1)}if(x){let y=Math.max(Ie(l,r.axis,d,!0).hi+1,n?0:Ie(t,u,r.getPixelForValue(d),!0).hi+1);if(c){const v=l.slice(y-1).findIndex(w=>!B(w[a.axis]));y+=Math.max(0,v)}o=yt(y,s,i)-s}else o=i-s}return{start:s,count:o}}function id(e){const{xScale:t,yScale:n,_scaleRanges:i}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!i)return e._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,s),o}const si=e=>e===0||e===1,vr=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*Ft/n)),_r=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*Ft/n)+1,Cn={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*kt)+1,easeOutSine:e=>Math.sin(e*kt),easeInOutSine:e=>-.5*(Math.cos(et*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>si(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>si(e)?e:vr(e,.075,.3),easeOutElastic:e=>si(e)?e:_r(e,.075,.3),easeInOutElastic(e){return si(e)?e:e<.5?.5*vr(e*2,.1125,.45):.5+.5*_r(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-Cn.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?Cn.easeInBounce(e*2)*.5:Cn.easeOutBounce(e*2-1)*.5+.5};function _o(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function wr(e){return _o(e)?e:new Ln(e)}function ss(e){return _o(e)?e:new Ln(e).saturate(.5).darken(.1).hexString()}const sd=["x","y","borderWidth","radius","tension"],od=["color","borderColor","backgroundColor"];function rd(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:od},numbers:{type:"number",properties:sd}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function ad(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Sr=new Map;function ld(e,t){t=t||{};const n=e+JSON.stringify(t);let i=Sr.get(n);return i||(i=new Intl.NumberFormat(e,t),Sr.set(n,i)),i}function Hl(e,t,n){return ld(t,n).format(e)}const cd={values(e){return tt(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const i=this.chart.options.locale;let s,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=ud(e,n)}const r=Il(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Hl(e,i,l)}};function ud(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var Vl={formatters:cd};function hd(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Vl.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Be=Object.create(null),Bs=Object.create(null);function On(e,t){if(!t)return e;const n=t.split(".");for(let i=0,s=n.length;i<s;++i){const o=n[i];e=e[o]||(e[o]=Object.create(null))}return e}function os(e,t,n){return typeof t=="string"?Nn(On(e,t),n):Nn(On(e,""),t)}class fd{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>ss(s.backgroundColor),this.hoverBorderColor=(i,s)=>ss(s.borderColor),this.hoverColor=(i,s)=>ss(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return os(this,t,n)}get(t){return On(this,t)}describe(t,n){return os(Bs,t,n)}override(t,n){return os(Be,t,n)}route(t,n,i,s){const o=On(this,t),r=On(this,i),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=r[s];return V(l)?Object.assign({},c,l):N(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(n=>n(this))}}var Y=new fd({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[rd,ad,hd]);function dd(e){return!e||B(e.size)||B(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function kr(e,t,n,i,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>i&&(i=o),i}function Me(e,t,n){const i=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*i)/i+s}function Tr(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function Ws(e,t,n,i){Bl(e,t,n,i,null)}function Bl(e,t,n,i,s){let o,r,a,l,c,u,f,d;const m=t.pointStyle,x=t.rotation,y=t.radius;let v=(x||0)*Bf;if(m&&typeof m=="object"&&(o=m.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(v),e.drawImage(m,-m.width/2,-m.height/2,m.width,m.height),e.restore();return}if(!(isNaN(y)||y<=0)){switch(e.beginPath(),m){default:s?e.ellipse(n,i,s/2,y,0,0,Ft):e.arc(n,i,y,0,Ft),e.closePath();break;case"triangle":u=s?s/2:y,e.moveTo(n+Math.sin(v)*u,i-Math.cos(v)*y),v+=mr,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*y),v+=mr,e.lineTo(n+Math.sin(v)*u,i-Math.cos(v)*y),e.closePath();break;case"rectRounded":c=y*.516,l=y-c,r=Math.cos(v+Te)*l,f=Math.cos(v+Te)*(s?s/2-c:l),a=Math.sin(v+Te)*l,d=Math.sin(v+Te)*(s?s/2-c:l),e.arc(n-f,i-a,c,v-et,v-kt),e.arc(n+d,i-r,c,v-kt,v),e.arc(n+f,i+a,c,v,v+kt),e.arc(n-d,i+r,c,v+kt,v+et),e.closePath();break;case"rect":if(!x){l=Math.SQRT1_2*y,u=s?s/2:l,e.rect(n-u,i-l,2*u,2*l);break}v+=Te;case"rectRot":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,d=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+d,i-r),e.lineTo(n+f,i+a),e.lineTo(n-d,i+r),e.closePath();break;case"crossRot":v+=Te;case"cross":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,d=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r);break;case"star":f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,d=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r),v+=Te,f=Math.cos(v)*(s?s/2:y),r=Math.cos(v)*y,a=Math.sin(v)*y,d=Math.sin(v)*(s?s/2:y),e.moveTo(n-f,i-a),e.lineTo(n+f,i+a),e.moveTo(n+d,i-r),e.lineTo(n-d,i+r);break;case"line":r=s?s/2:Math.cos(v)*y,a=Math.sin(v)*y,e.moveTo(n-r,i-a),e.lineTo(n+r,i+a);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(v)*(s?s/2:y),i+Math.sin(v)*y);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function en(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function wo(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function So(e){e.restore()}function pd(e,t,n,i,s){if(!t)return e.lineTo(n.x,n.y);if(s==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else s==="after"!=!!i?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function gd(e,t,n,i){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?n.cp2x:n.cp1x,i?n.cp2y:n.cp1y,n.x,n.y)}function md(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),B(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function bd(e,t,n,i,s){if(s.strikethrough||s.underline){const o=e.measureText(i),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(r,u),e.lineTo(a,u),e.stroke()}}function yd(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function Di(e,t,n,i,s,o={}){const r=tt(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,md(e,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&yd(e,o.backdrop),a&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),B(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,i,o.maxWidth)),e.fillText(c,n,i,o.maxWidth),bd(e,n,i,c,o),i+=Number(s.lineHeight);e.restore()}function js(e,t){const{x:n,y:i,w:s,h:o,radius:r}=t;e.arc(n+r.topLeft,i+r.topLeft,r.topLeft,1.5*et,et,!0),e.lineTo(n,i+o-r.bottomLeft),e.arc(n+r.bottomLeft,i+o-r.bottomLeft,r.bottomLeft,et,kt,!0),e.lineTo(n+s-r.bottomRight,i+o),e.arc(n+s-r.bottomRight,i+o-r.bottomRight,r.bottomRight,kt,0,!0),e.lineTo(n+s,i+r.topRight),e.arc(n+s-r.topRight,i+r.topRight,r.topRight,0,-kt,!0),e.lineTo(n+r.topLeft,i)}const xd=/^(normal|(\\d+(?:\\.\\d+)?)(px|em|%)?)$/,vd=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function _d(e,t){const n=(""+e).match(xd);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const wd=e=>+e||0;function Wl(e,t){const n={},i=V(t),s=i?Object.keys(t):t,o=V(e)?i?r=>N(e[r],e[t[r]]):r=>e[r]:()=>e;for(const r of s)n[r]=wd(o(r));return n}function Sd(e){return Wl(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Pn(e){return Wl(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Mt(e){const t=Sd(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ht(e,t){e=e||{},t=t||Y.font;let n=N(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=N(e.style,t.style);i&&!(""+i).match(vd)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:N(e.family,t.family),lineHeight:_d(N(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:N(e.weight,t.weight),string:""};return s.string=dd(s),s}function oi(e,t,n,i){let s,o,r;for(s=0,o=e.length;s<o;++s)if(r=e[s],r!==void 0&&r!==void 0)return r}function kd(e,t,n){const{min:i,max:s}=e,o=Lf(t,(s-i)/2),r=(a,l)=>n&&a===0?0:a+l;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function je(e,t){return Object.assign(Object.create(e),t)}function ko(e,t=[""],n,i,s=()=>e[0]){const o=n||e;typeof i>"u"&&(i=Yl("_fallback",e));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>ko([a,...e],t,o,i)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete e[0][l],!0},get(a,l){return $l(a,l,()=>Ad(l,t,e,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(a,l){return Er(a).includes(l)},ownKeys(a){return Er(a)},set(a,l,c){const u=a._storage||(a._storage=s());return a[l]=u[l]=c,delete a._keys,!0}})}function nn(e,t,n,i){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:jl(e,i),setContext:o=>nn(e,o,n,i),override:o=>nn(e.override(o),t,n,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete e[r],!0},get(o,r,a){return $l(o,r,()=>Md(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(e,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,r)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,r){return Reflect.has(e,r)},ownKeys(){return Reflect.ownKeys(e)},set(o,r,a){return e[r]=a,delete o[r],!0}})}function jl(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:i,isScriptable:he(n)?n:()=>n,isIndexable:he(i)?i:()=>i}}const Td=(e,t)=>e?e+xo(t):t,To=(e,t)=>V(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function $l(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function Md(e,t,n){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=e;let a=i[t];return he(a)&&r.isScriptable(t)&&(a=Ed(t,a,e,n)),tt(a)&&a.length&&(a=Cd(t,a,e,r.isIndexable)),To(t,a)&&(a=nn(a,s,o&&o[t],r)),a}function Ed(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=n;if(a.has(e))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+e);a.add(e);let l=t(o,r||i);return a.delete(e),To(e,l)&&(l=Mo(s._scopes,s,e,l)),l}function Cd(e,t,n,i){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=n;if(typeof o.index<"u"&&i(e))return t[o.index%t.length];if(V(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const f=Mo(c,s,e,u);t.push(nn(f,o,r&&r[e],a))}}return t}function Ul(e,t,n){return he(e)?e(t,n):e}const Od=(e,t)=>e===!0?t:typeof e=="string"?Ci(t,e):void 0;function Pd(e,t,n,i,s){for(const o of t){const r=Od(n,o);if(r){e.add(r);const a=Ul(r._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==i)return a}else if(r===!1&&typeof i<"u"&&n!==i)return null}return!1}function Mo(e,t,n,i){const s=t._rootScopes,o=Ul(t._fallback,n,i),r=[...e,...s],a=new Set;a.add(i);let l=Mr(a,r,n,o||n,i);return l===null||typeof o<"u"&&o!==n&&(l=Mr(a,r,o,l,i),l===null)?!1:ko(Array.from(a),[""],s,o,()=>Dd(t,n,i))}function Mr(e,t,n,i,s){for(;n;)n=Pd(e,t,n,i,s);return n}function Dd(e,t,n){const i=e._getTarget();t in i||(i[t]={});const s=i[t];return tt(s)&&V(n)?n:s||{}}function Ad(e,t,n,i){let s;for(const o of t)if(s=Yl(Td(o,e),n),typeof s<"u")return To(e,s)?Mo(n,i,e,s):s}function Yl(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function Er(e){let t=e._keys;return t||(t=e._keys=Id(e._scopes)),t}function Id(e){const t=new Set;for(const n of e)for(const i of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}const Ld=Number.EPSILON||1e-14,sn=(e,t)=>t<e.length&&!e[t].skip&&e[t],Xl=e=>e==="x"?"y":"x";function Nd(e,t,n,i){const s=e.skip?t:e,o=t,r=n.skip?t:n,a=Vs(o,s),l=Vs(r,o);let c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const f=i*c,d=i*u;return{previous:{x:o.x-f*(r.x-s.x),y:o.y-f*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function Rd(e,t,n){const i=e.length;let s,o,r,a,l,c=sn(e,0);for(let u=0;u<i-1;++u)if(l=c,c=sn(e,u+1),!(!l||!c)){if(Ne(t[u],0,Ld)){n[u]=n[u+1]=0;continue}s=n[u]/t[u],o=n[u+1]/t[u],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),n[u]=s*r*t[u],n[u+1]=o*r*t[u])}}function Fd(e,t,n="x"){const i=Xl(n),s=e.length;let o,r,a,l=sn(e,0);for(let c=0;c<s;++c){if(r=a,a=l,l=sn(e,c+1),!a)continue;const u=a[n],f=a[i];r&&(o=(u-r[n])/3,a[\`cp1\${n}\`]=u-o,a[\`cp1\${i}\`]=f-o*t[c]),l&&(o=(l[n]-u)/3,a[\`cp2\${n}\`]=u+o,a[\`cp2\${i}\`]=f+o*t[c])}}function zd(e,t="x"){const n=Xl(t),i=e.length,s=Array(i).fill(0),o=Array(i);let r,a,l,c=sn(e,0);for(r=0;r<i;++r)if(a=l,l=c,c=sn(e,r+1),!!l){if(c){const u=c[t]-l[t];s[r]=u!==0?(c[n]-l[n])/u:0}o[r]=a?c?fe(s[r-1])!==fe(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}Rd(e,s,o),Fd(e,o,t)}function ri(e,t,n){return Math.max(Math.min(e,n),t)}function Hd(e,t){let n,i,s,o,r,a=en(e[0],t);for(n=0,i=e.length;n<i;++n)r=o,o=a,a=n<i-1&&en(e[n+1],t),o&&(s=e[n],r&&(s.cp1x=ri(s.cp1x,t.left,t.right),s.cp1y=ri(s.cp1y,t.top,t.bottom)),a&&(s.cp2x=ri(s.cp2x,t.left,t.right),s.cp2y=ri(s.cp2y,t.top,t.bottom)))}function Vd(e,t,n,i,s){let o,r,a,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")zd(e,s);else{let c=i?e[e.length-1]:e[0];for(o=0,r=e.length;o<r;++o)a=e[o],l=Nd(c,a,e[Math.min(o+1,r-(i?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&Hd(e,n)}function Eo(){return typeof window<"u"&&typeof document<"u"}function Co(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ai(e,t,n){let i;return typeof e=="string"?(i=parseInt(e,10),e.indexOf("%")!==-1&&(i=i/100*t.parentNode[n])):i=e,i}const Wi=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function Bd(e,t){return Wi(e).getPropertyValue(t)}const Wd=["top","right","bottom","left"];function Re(e,t,n){const i={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=Wd[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const jd=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function $d(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i;let r=!1,a,l;if(jd(s,o,e.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function It(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,s=Wi(n),o=s.boxSizing==="border-box",r=Re(s,"padding"),a=Re(s,"border","width"),{x:l,y:c,box:u}=$d(e,n),f=r.left+(u&&a.left),d=r.top+(u&&a.top);let{width:m,height:x}=t;return o&&(m-=r.width+a.width,x-=r.height+a.height),{x:Math.round((l-f)/m*n.width/i),y:Math.round((c-d)/x*n.height/i)}}function Ud(e,t,n){let i,s;if(t===void 0||n===void 0){const o=e&&Co(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const r=o.getBoundingClientRect(),a=Wi(o),l=Re(a,"border","width"),c=Re(a,"padding");t=r.width-c.width-l.width,n=r.height-c.height-l.height,i=Ai(a.maxWidth,o,"clientWidth"),s=Ai(a.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||Pi,maxHeight:s||Pi}}const ai=e=>Math.round(e*10)/10;function Yd(e,t,n,i){const s=Wi(e),o=Re(s,"margin"),r=Ai(s.maxWidth,e,"clientWidth")||Pi,a=Ai(s.maxHeight,e,"clientHeight")||Pi,l=Ud(e,t,n);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const d=Re(s,"border","width"),m=Re(s,"padding");c-=m.width+d.width,u-=m.height+d.height}return c=Math.max(0,c-o.width),u=Math.max(0,i?c/i:u-o.height),c=ai(Math.min(c,r,l.maxWidth)),u=ai(Math.min(u,a,l.maxHeight)),c&&!u&&(u=ai(c/2)),(t!==void 0||n!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=ai(Math.floor(u*i))),{width:c,height:u}}function Cr(e,t,n){const i=t||1,s=Math.floor(e.height*i),o=Math.floor(e.width*i);e.height=Math.floor(e.height),e.width=Math.floor(e.width);const r=e.canvas;return r.style&&(n||!r.style.height&&!r.style.width)&&(r.style.height=\`\${e.height}px\`,r.style.width=\`\${e.width}px\`),e.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(e.currentDevicePixelRatio=i,r.height=s,r.width=o,e.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Xd=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};Eo()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function Or(e,t){const n=Bd(e,t),i=n&&n.match(/^(\\d+)(\\.\\d+)?px$/);return i?+i[1]:void 0}function Ce(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function qd(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:i==="middle"?n<.5?e.y:t.y:i==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function Gd(e,t,n,i){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},r=Ce(e,s,n),a=Ce(s,o,n),l=Ce(o,t,n),c=Ce(r,a,n),u=Ce(a,l,n);return Ce(c,u,n)}const Kd=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},Zd=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Qe(e,t,n){return e?Kd(t,n):Zd()}function ql(e,t){let n,i;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=i)}function Gl(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Kl(e){return e==="angle"?{between:Ll,compare:qf,normalize:te}:{between:kn,compare:(t,n)=>t-n,normalize:t=>t}}function Pr({start:e,end:t,count:n,loop:i,style:s}){return{start:e%n,end:t%n,loop:i&&(t-e+1)%n===0,style:s}}function Qd(e,t,n){const{property:i,start:s,end:o}=n,{between:r,normalize:a}=Kl(i),l=t.length;let{start:c,end:u,loop:f}=e,d,m;if(f){for(c+=l,u+=l,d=0,m=l;d<m&&r(a(t[c%l][i]),s,o);++d)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:f,style:e.style}}function Jd(e,t,n){if(!n)return[e];const{property:i,start:s,end:o}=n,r=t.length,{compare:a,between:l,normalize:c}=Kl(i),{start:u,end:f,loop:d,style:m}=Qd(e,t,n),x=[];let y=!1,v=null,w,k,C;const O=()=>l(s,C,w)&&a(s,C)!==0,T=()=>a(o,w)===0||l(o,C,w),D=()=>y||O(),P=()=>!y||T();for(let E=u,A=u;E<=f;++E)k=t[E%r],!k.skip&&(w=c(k[i]),w!==C&&(y=l(w,s,o),v===null&&D()&&(v=a(w,s)===0?E:A),v!==null&&P()&&(x.push(Pr({start:v,end:E,loop:d,count:r,style:m})),v=null),A=E,C=w));return v!==null&&x.push(Pr({start:v,end:f,loop:d,count:r,style:m})),x}function tp(e,t){const n=[],i=e.segments;for(let s=0;s<i.length;s++){const o=Jd(i[s],e.points,t);o.length&&n.push(...o)}return n}function ep(e,t,n,i){let s=0,o=t-1;if(n&&!i)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,n&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function np(e,t,n,i){const s=e.length,o=[];let r=t,a=e[t],l;for(l=t+1;l<=n;++l){const c=e[l%s];c.skip||c.stop?a.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function ip(e,t){const n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:r,end:a}=ep(n,s,o,i);if(i===!0)return Dr(e,[{start:r,end:a,loop:o}],n,t);const l=a<r?a+s:a,c=!!e._fullLoop&&r===0&&a===s-1;return Dr(e,np(n,r,l,c),n,t)}function Dr(e,t,n,i){return!i||!i.setContext||!n?t:sp(e,t,n,i)}function sp(e,t,n,i){const s=e._chart.getContext(),o=Ar(e.options),{_datasetIndex:r,options:{spanGaps:a}}=e,l=n.length,c=[];let u=o,f=t[0].start,d=f;function m(x,y,v,w){const k=a?-1:1;if(x!==y){for(x+=l;n[x%l].skip;)x-=k;for(;n[y%l].skip;)y+=k;x%l!==y%l&&(c.push({start:x%l,end:y%l,loop:v,style:w}),u=w,f=y%l)}}for(const x of t){f=a?f:x.start;let y=n[f%l],v;for(d=f+1;d<=x.end;d++){const w=n[d%l];v=Ar(i.setContext(je(s,{type:"segment",p0:y,p1:w,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:r}))),op(v,u)&&m(f,d-1,x.loop,u),y=w,u=v}f<d-1&&m(f,d-1,x.loop,u)}return c}function Ar(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function op(e,t){if(!t)return!1;const n=[],i=function(s,o){return _o(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function li(e,t,n){return e.options.clip?e[n]:t[n]}function rp(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:li(n,t,"left"),right:li(n,t,"right"),top:li(i,t,"top"),bottom:li(i,t,"bottom")}:t}function ap(e,t){const n=t._clip;if(n.disabled)return!1;const i=rp(t,e.chartArea);return{left:n.left===!1?0:i.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:i.right+(n.right===!0?0:n.right),top:n.top===!1?0:i.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:i.bottom+(n.bottom===!0?0:n.bottom)}}/*!
|
|
9137
9759
|
* Chart.js v4.5.0
|
|
9138
9760
|
* https://www.chartjs.org
|
|
9139
9761
|
* (c) 2025 Chart.js Contributors
|
|
9140
9762
|
* Released under the MIT License
|
|
9141
|
-
*/class np{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,i,s){const o=n.listeners[s],r=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:r,currentStep:Math.min(i-n.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Ll.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const i=n.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var $t=new np;const Dr="transparent",ip={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=vr(e||Dr),s=i.valid&&vr(t||Dr);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class sp{constructor(t,n,i,s){const o=n[i];s=si([t.to,s,o,t.from]);const r=si([t.from,o,s]);this._active=!0,this._fn=t.fn||ip[t.type||typeof r],this._easing=En[t.easing]||En.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=si([t.to,n,s,t.from]),this._from=si([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||n<i),!this._active){this._target[s]=a,this._notify(!0);return}if(n<0){this._target[s]=o;return}l=n/i%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){const n=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][n]()}}class Gl{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!V(t))return;const n=Object.keys(Y.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!V(o))return;const r={};for(const a of n)r[a]=o[a];(tt(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,n){const i=n.options,s=rp(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&op(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,n){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(n),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,n));continue}const u=n[c];let f=o[c];const d=i.get(c);if(f)if(d&&f.active()){f.update(d,u,a);continue}else f.cancel();if(!d||!d.duration){t[c]=u;continue}o[c]=f=new sp(d,t,c,u),s.push(f)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const i=this._createAnimations(t,n);if(i.length)return $t.add(this._chart,i),!0}}function op(e,t){const n=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=e[i[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function rp(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Ar(e,t){const n=e&&e.options||{},i=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function ap(e,t,n){if(n===!1)return!1;const i=Ar(e,n),s=Ar(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function lp(e){let t,n,i,s;return V(e)?(t=e.top,n=e.right,i=e.bottom,s=e.left):t=n=i=s=e,{top:t,right:n,bottom:i,left:s,disabled:e===!1}}function Kl(e,t){const n=[],i=e._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)n.push(i[s].index);return n}function Ir(e,t,n,i={}){const s=e.keys,o=i.mode==="single";let r,a,l,c;if(t===null)return;let u=!1;for(r=0,a=s.length;r<a;++r){if(l=+s[r],l===n){if(u=!0,i.all)continue;break}c=e.values[l],vt(c)&&(o||t===0||he(t)===he(c))&&(t+=c)}return!u&&!i.all?0:t}function cp(e,t){const{iScale:n,vScale:i}=t,s=n.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length);let l,c,u;for(l=0,c=r.length;l<c;++l)u=r[l],a[l]={[s]:u,[o]:e[u]};return a}function ss(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function up(e,t,n){return\`\${e.id}.\${t.id}.\${n.stack||n.type}\`}function hp(e){const{min:t,max:n,minDefined:i,maxDefined:s}=e.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function fp(e,t,n){const i=e[t]||(e[t]={});return i[n]||(i[n]={})}function Lr(e,t,n,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function Rr(e,t){const{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,c=r.axis,u=up(o,r,i),f=t.length;let d;for(let m=0;m<f;++m){const y=t[m],{[l]:x,[c]:v}=y,w=y._stacks||(y._stacks={});d=w[c]=fp(s,u,x),d[a]=v,d._top=Lr(d,r,!0,i.type),d._bottom=Lr(d,r,!1,i.type);const k=d._visualValues||(d._visualValues={});k[a]=v}}function os(e,t){const n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function dp(e,t){return Ve(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function pp(e,t,n){return Ve(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function mn(e,t){const n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][n]===void 0)return;delete o[i][n],o[i]._visualValues!==void 0&&o[i]._visualValues[n]!==void 0&&delete o[i]._visualValues[n]}}}const rs=e=>e==="reset"||e==="none",Nr=(e,t)=>t?e:Object.assign({},e),gp=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Kl(n,!0),values:null};class Zl{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ss(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&mn(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(f,d,m,y)=>f==="x"?d:f==="r"?y:m,o=n.xAxisID=R(i.xAxisID,os(t,"x")),r=n.yAxisID=R(i.yAxisID,os(t,"y")),a=n.rAxisID=R(i.rAxisID,os(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,r,a),u=n.vAxisID=s(l,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&br(this._data,this),t._stacked&&mn(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(V(n)){const s=this._cachedMeta;this._data=cp(n,s)}else if(i!==n){if(i){br(i,this);const s=this._cachedMeta;mn(s),s._parsed=[]}n&&Object.isExtensible(n)&&Yf(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=ss(n.vScale,n),n.stack!==i.stack&&(s=!0,mn(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&(Rr(this,n._parsed),n._stacked=ss(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis;let l=t===0&&n===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,f,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{tt(s[t])?d=this.parseArrayData(i,s,t,n):V(s[t])?d=this.parseObjectData(i,s,t,n):d=this.parsePrimitiveData(i,s,t,n);const m=()=>f[a]===null||c&&f[a]<c[a];for(u=0;u<n;++u)i._parsed[u+t]=f=d[u],l&&(m()&&(l=!1),c=f);i._sorted=l}r&&Rr(this,d)}parsePrimitiveData(t,n,i,s){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),u=o===r,f=new Array(s);let d,m,y;for(d=0,m=s;d<m;++d)y=d+i,f[d]={[a]:u||o.parse(c[y],y),[l]:r.parse(n[y],y)};return f}parseArrayData(t,n,i,s){const{xScale:o,yScale:r}=t,a=new Array(s);let l,c,u,f;for(l=0,c=s;l<c;++l)u=l+i,f=n[u],a[l]={x:o.parse(f[0],u),y:r.parse(f[1],u)};return a}parseObjectData(t,n,i,s){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let u,f,d,m;for(u=0,f=s;u<f;++u)d=u+i,m=n[d],c[u]={x:o.parse(Ci(m,a),d),y:r.parse(Ci(m,l),d)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,i){const s=this.chart,o=this._cachedMeta,r=n[t.axis],a={keys:Kl(s,!0),values:n._stacks[t.axis]._visualValues};return Ir(a,r,o.index,{mode:i})}updateRangeFromParsed(t,n,i,s){const o=i[n.axis];let r=o===null?NaN:o;const a=s&&i._stacks[n.axis];s&&a&&(s.values=a,r=Ir(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,n){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,r=s.length,a=this._getOtherScale(t),l=gp(n,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:f}=hp(a);let d,m;function y(){m=s[d];const x=m[a.axis];return!vt(m[t.axis])||u>x||f<x}for(d=0;d<r&&!(!y()&&(this.updateRangeFromParsed(c,t,m,l),o));++d);if(o){for(d=r-1;d>=0;--d)if(!y()){this.updateRangeFromParsed(c,t,m,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,i=[];let s,o,r;for(s=0,o=n.length;s<o;++s)r=n[s][t.axis],vt(r)&&i.push(r);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,i=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=lp(R(this.options.clip,ap(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,i=this._cachedMeta,s=i.data||[],o=n.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,o,a,l),u=a;u<a+l;++u){const f=s[u];f.hidden||(f.active&&c?r.push(f):f.draw(t,o))}for(u=0;u<r.length;++u)r[u].draw(t,o)}getStyle(t,n){const i=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,n,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=pp(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=dp(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",i){const s=n==="active",o=this._cachedDataOpts,r=t+"-"+n,a=o[r],l=this.enableOptionSharing&&Oi(i);if(a)return Nr(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),f=s?[\`\${t}Hover\`,"hover",t,""]:[t,""],d=c.getOptionScopes(this.getDataset(),u),m=Object.keys(Y.elements[t]),y=()=>this.getContext(i,s,n),x=c.resolveNamedOptions(d,m,y,f);return x.$shared&&(x.$shared=l,o[r]=Object.freeze(Nr(x,l))),x}_resolveAnimations(t,n,i){const s=this.chart,o=this._cachedDataOpts,r=\`animation-\${n}\`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const u=this.chart.config,f=u.datasetAnimationScopeKeys(this._type,n),d=u.getOptionScopes(this.getDataset(),f);l=u.createResolver(d,this.getContext(t,i,n))}const c=new Gl(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||rs(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const i=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,i),{sharedOptions:o,includeOptions:r}}updateElement(t,n,i,s){rs(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!rs(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,o=n.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,i=!0){const s=this._cachedMeta,o=s.data,r=t+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=r;a--)c[a]=c[a-n]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,n),i&&this.updateElements(o,t,n,"reset")}updateElements(t,n,i,s){}_removeElements(t,n){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,n);i._stacked&&mn(i,s)}i.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,i,s]=t;this[n](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}class mp extends Zl{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=n,r=this.chart._animationsDisabled;let{start:a,count:l}=Kf(n,s,r);this._drawStart=a,this._drawCount=l,Zf(n)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:f}=this._getSharedOptions(n,s),d=r.axis,m=a.axis,{spanGaps:y,segment:x}=this.options,v=Rn(y)?y:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||o||s==="none",k=n+i,E=t.length;let C=n>0&&this.getParsed(n-1);for(let T=0;T<E;++T){const D=t[T],P=w?D:{};if(T<n||T>=k){P.skip=!0;continue}const O=this.getParsed(T),A=B(O[m]),z=P[d]=r.getPixelForValue(O[d],T),L=P[m]=o||A?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,O,l):O[m],T);P.skip=isNaN(z)||isNaN(L)||A,P.stop=T>0&&Math.abs(O[d]-C[d])>v,x&&(P.parsed=O,P.raw=c.data[T]),f&&(P.options=u||this.resolveDataElementOptions(T,D.active?"active":s)),w||this.updateElement(D,T,P,s),C=O}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}function Te(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Eo{static override(t){Object.assign(Eo.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Te()}parse(){return Te()}format(){return Te()}add(){return Te()}diff(){return Te()}startOf(){return Te()}endOf(){return Te()}}var bp={_date:Eo};function xp(e,t,n,i){const{controller:s,data:o,_sorted:r}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?$f:De;if(i){if(s._sharedOptions){const u=o[0],f=typeof u.getRange=="function"&&u.getRange(t);if(f){const d=c(o,t,n-f),m=c(o,t,n+f);return{lo:d.lo,hi:m.hi}}}}else{const u=c(o,t,n);if(l){const{vScale:f}=s._cachedMeta,{_parsed:d}=e,m=d.slice(0,u.lo+1).reverse().findIndex(x=>!B(x[f.axis]));u.lo-=Math.max(0,m);const y=d.slice(u.hi).findIndex(x=>!B(x[f.axis]));u.hi+=Math.max(0,y)}return u}}return{lo:0,hi:o.length-1}}function Bi(e,t,n,i,s){const o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:u}=o[a],{lo:f,hi:d}=xp(o[a],t,r,s);for(let m=f;m<=d;++m){const y=u[m];y.skip||i(y,c,m)}}}function yp(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,r=n?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function as(e,t,n,i,s){const o=[];return!s&&!e.isPointInArea(t)||Bi(e,n,t,function(a,l,c){!s&&!en(a,e.chartArea,0)||a.inRange(t.x,t.y,i)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function vp(e,t,n,i){let s=[];function o(r,a,l){const{startAngle:c,endAngle:u}=r.getProps(["startAngle","endAngle"],i),{angle:f}=Bf(r,{x:t.x,y:t.y});Al(f,c,u)&&s.push({element:r,datasetIndex:a,index:l})}return Bi(e,n,t,o),s}function _p(e,t,n,i,s,o){let r=[];const a=yp(n);let l=Number.POSITIVE_INFINITY;function c(u,f,d){const m=u.inRange(t.x,t.y,s);if(i&&!m)return;const y=u.getCenterPoint(s);if(!(!!o||e.isPointInArea(y))&&!m)return;const v=a(t,y);v<l?(r=[{element:u,datasetIndex:f,index:d}],l=v):v===l&&r.push({element:u,datasetIndex:f,index:d})}return Bi(e,n,t,c),r}function ls(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?vp(e,t,n,s):_p(e,t,n,i,s,o)}function Fr(e,t,n,i,s){const o=[],r=n==="x"?"inXRange":"inYRange";let a=!1;return Bi(e,n,t,(l,c,u)=>{l[r]&&l[r](t[n],s)&&(o.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:o}var wp={modes:{index(e,t,n,i){const s=It(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?as(e,s,o,i,r):ls(e,s,o,!1,i,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,f=c.data[u];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;let a=n.intersect?as(e,s,o,i,r):ls(e,s,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return as(e,s,o,i,r)},nearest(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return ls(e,s,o,n.intersect,i,r)},x(e,t,n,i){const s=It(t,e);return Fr(e,s,"x",n.intersect,i)},y(e,t,n,i){const s=It(t,e);return Fr(e,s,"y",n.intersect,i)}}};const Ql=["left","top","right","bottom"];function bn(e,t){return e.filter(n=>n.pos===t)}function zr(e,t){return e.filter(n=>Ql.indexOf(n.pos)===-1&&n.box.axis===t)}function xn(e,t){return e.sort((n,i)=>{const s=t?i:n,o=t?n:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Sp(e){const t=[];let n,i,s,o,r,a;for(n=0,i=(e||[]).length;n<i;++n)s=e[n],{position:o,options:{stack:r,stackWeight:a=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return t}function kp(e){const t={};for(const n of e){const{stack:i,pos:s,stackWeight:o}=n;if(!i||!Ql.includes(s))continue;const r=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function Tp(e,t){const n=kp(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];const{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*i:l&&t.availableWidth,a.height=s):(a.width=i,a.height=u?u*s:l&&t.availableHeight)}return n}function Mp(e){const t=Sp(e),n=xn(t.filter(c=>c.box.fullSize),!0),i=xn(bn(t,"left"),!0),s=xn(bn(t,"right")),o=xn(bn(t,"top"),!0),r=xn(bn(t,"bottom")),a=zr(t,"x"),l=zr(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:bn(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function Hr(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function Jl(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Ep(e,t,n,i){const{pos:s,box:o}=n,r=e.maxPadding;if(!V(s)){n.size&&(e[s]-=n.size);const f=i[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?o.height:o.width),n.size=f.size/f.count,e[s]+=n.size}o.getPadding&&Jl(r,o.getPadding());const a=Math.max(0,t.outerWidth-Hr(r,e,"left","right")),l=Math.max(0,t.outerHeight-Hr(r,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function Cp(e){const t=e.maxPadding;function n(i){const s=Math.max(t[i]-e[i],0);return e[i]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function Op(e,t){const n=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],n[r])}),o}return i(e?["left","right"]:["top","bottom"])}function kn(e,t,n,i){const s=[];let o,r,a,l,c,u;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],l=a.box,l.update(a.width||t.w,a.height||t.h,Op(a.horizontal,t));const{same:f,other:d}=Ep(t,n,a,i);c|=f&&s.length,u=u||d,l.fullSize||s.push(a)}return c&&kn(s,t,n,i)||u}function li(e,t,n,i,s){e.top=n,e.left=t,e.right=t+i,e.bottom=n+s,e.width=i,e.height=s}function Vr(e,t,n,i){const s=n.padding;let{x:o,y:r}=t;for(const a of e){const l=a.box,c=i[a.stack]||{placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const f=t.w*u,d=c.size||l.height;Oi(c.start)&&(r=c.start),l.fullSize?li(l,s.left,r,n.outerWidth-s.right-s.left,d):li(l,t.left+c.placed,r,f,d),c.start=r,c.placed+=f,r=l.bottom}else{const f=t.h*u,d=c.size||l.width;Oi(c.start)&&(o=c.start),l.fullSize?li(l,o,s.top,d,n.outerHeight-s.bottom-s.top):li(l,o,t.top+c.placed,d,f),c.start=o,c.placed+=f,o=l.right}}t.x=o,t.y=r}var ne={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,i){if(!e)return;const s=Mt(e.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(n-s.height,0),a=Mp(e.boxes),l=a.vertical,c=a.horizontal;F(e.boxes,x=>{typeof x.beforeLayout=="function"&&x.beforeLayout()});const u=l.reduce((x,v)=>v.box.options&&v.box.options.display===!1?x:x+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),d=Object.assign({},s);Jl(d,Mt(i));const m=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),y=Tp(l.concat(c),f);kn(a.fullSize,m,f,y),kn(l,m,f,y),kn(c,m,f,y)&&kn(l,m,f,y),Cp(m),Vr(a.leftAndTop,m,f,y),m.x+=m.w,m.y+=m.h,Vr(a.rightAndBottom,m,f,y),e.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},F(a.chartArea,x=>{const v=x.box;Object.assign(v,e.chartArea),v.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class tc{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,s){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Pp extends tc{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const bi="$chartjs",Dp={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Br=e=>e===null||e==="";function Ap(e,t){const n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[bi]={initial:{height:i,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Br(s)){const o=Er(e,"width");o!==void 0&&(e.width=o)}if(Br(i))if(e.style.height==="")e.height=e.width/(t||2);else{const o=Er(e,"height");o!==void 0&&(e.height=o)}return e}const ec=Bd?{passive:!0}:!1;function Ip(e,t,n){e&&e.addEventListener(t,n,ec)}function Lp(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,ec)}function Rp(e,t){const n=Dp[e.type]||e.type,{x:i,y:s}=It(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Ii(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function Np(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ii(a.addedNodes,i),r=r&&!Ii(a.removedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function Fp(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ii(a.removedNodes,i),r=r&&!Ii(a.addedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Nn=new Map;let Wr=0;function nc(){const e=window.devicePixelRatio;e!==Wr&&(Wr=e,Nn.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function zp(e,t){Nn.size||window.addEventListener("resize",nc),Nn.set(e,t)}function Hp(e){Nn.delete(e),Nn.size||window.removeEventListener("resize",nc)}function Vp(e,t,n){const i=e.canvas,s=i&&Mo(i);if(!s)return;const o=Rl((a,l)=>{const c=s.clientWidth;n(a,l),c<s.clientWidth&&n()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return r.observe(s),zp(e,o),r}function cs(e,t,n){n&&n.disconnect(),t==="resize"&&Hp(e)}function Bp(e,t,n){const i=e.canvas,s=Rl(o=>{e.ctx!==null&&n(Rp(o,e))},e);return Ip(i,t,s),s}class Wp extends tc{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Ap(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[bi])return!1;const i=n[bi].initial;["height","width"].forEach(o=>{const r=i[o];B(r)?n.removeAttribute(o):n.setAttribute(o,r)});const s=i.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[bi],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),r={attach:Np,detach:Fp,resize:Vp}[n]||Bp;s[n]=r(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:cs,detach:cs,resize:cs}[n]||Lp)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return Vd(t,n,i,s)}isAttached(t){const n=t&&Mo(t);return!!(n&&n.isConnected)}}function jp(e){return!To()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?Pp:Wp}class on{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return Rn(this.x)&&Rn(this.y)}getProps(t,n){const i=this.$animations;if(!n||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}function $p(e,t){const n=e.options.ticks,i=Up(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?Xp(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return qp(t,c,o,r/s),c;const u=Yp(o,t,s);if(r>0){let f,d;const m=r>1?Math.round((l-a)/(r-1)):null;for(ci(t,c,u,B(m)?0:a-m,a),f=0,d=r-1;f<d;f++)ci(t,c,u,o[f],o[f+1]);return ci(t,c,u,l,B(m)?t.length:l+m),c}return ci(t,c,u),c}function Up(e){const t=e.options.offset,n=e._tickSize(),i=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(i,s))}function Yp(e,t,n){const i=Gp(e),s=t.length/n;if(!i)return Math.max(s,1);const o=Nf(i);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>s)return l}return Math.max(s,1)}function Xp(e){const t=[];let n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function qp(e,t,n,i){let s=0,o=n[0],r;for(i=Math.ceil(i),r=0;r<e.length;r++)r===o&&(t.push(e[r]),s++,o=n[s*i])}function ci(e,t,n,i,s){const o=R(i,0),r=Math.min(R(s,e.length),e.length);let a=0,l,c,u;for(n=Math.ceil(n),s&&(l=s-i,n=l/Math.floor(l/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(c=Math.max(o,0);c<r;c++)c===u&&(t.push(e[c]),a++,u=Math.round(o+a*n))}function Gp(e){const t=e.length;let n,i;if(t<2)return!1;for(i=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==i)return!1;return i}const Kp=e=>e==="left"?"right":e==="right"?"left":e,jr=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,$r=(e,t)=>Math.min(t||e,e);function Ur(e,t){const n=[],i=e.length/t,s=e.length;let o=0;for(;o<s;o+=i)n.push(e[Math.floor(o)]);return n}function Zp(e,t,n){const i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,r=e._endPixel,a=1e-6;let l=e.getPixelForTick(s),c;if(!(n&&(i===1?c=Math.max(l-o,r-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-a||l>r+a)))return l}function Qp(e,t){F(e,n=>{const i=n.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete n.data[i[o]];i.splice(0,s)}})}function yn(e){return e.drawTicks?e.tickLength:0}function Yr(e,t){if(!e.display)return 0;const n=ht(e.font,t),i=Mt(e.padding);return(tt(e.text)?e.text.length:1)*n.lineHeight+i.height}function Jp(e,t){return Ve(e,{scale:t,type:"scale"})}function tg(e,t,n){return Ve(e,{tick:n,index:t,type:"tick"})}function eg(e,t,n){let i=Nl(e);return(n&&t!=="right"||!n&&t==="right")&&(i=Kp(i)),i}function ng(e,t,n,i){const{top:s,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:u}=l;let f=0,d,m,y;const x=r-s,v=a-o;if(e.isHorizontal()){if(m=ft(i,o,a),V(n)){const w=Object.keys(n)[0],k=n[w];y=u[w].getPixelForValue(k)+x-t}else n==="center"?y=(c.bottom+c.top)/2+x-t:y=jr(e,n,t);d=a-o}else{if(V(n)){const w=Object.keys(n)[0],k=n[w];m=u[w].getPixelForValue(k)-v+t}else n==="center"?m=(c.left+c.right)/2-v+t:m=jr(e,n,t);y=ft(i,r,s),f=n==="left"?-kt:kt}return{titleX:m,titleY:y,maxWidth:d,rotation:f}}class rn extends on{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:i,_suggestedMax:s}=this;return t=Pt(t,Number.POSITIVE_INFINITY),n=Pt(n,Number.NEGATIVE_INFINITY),i=Pt(i,Number.POSITIVE_INFINITY),s=Pt(s,Number.NEGATIVE_INFINITY),{min:Pt(t,i),max:Pt(n,s),minDefined:vt(t),maxDefined:vt(n)}}getMinMax(t){let{min:n,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:n,max:i};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),s||(n=Math.min(n,r.min)),o||(i=Math.max(i,r.max));return n=o&&n>i?i:n,i=s&&n>i?n:i,{min:Pt(n,Pt(i,n)),max:Pt(i,Pt(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I(this.options.beforeUpdate,[this])}update(t,n,i){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=xd(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Ur(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=$p(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,i;this.isHorizontal()?(n=this.left,i=this.right):(n=this.top,i=this.bottom,t=!t),this._startPixel=n,this._endPixel=i,this._reversePixels=t,this._length=i-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){I(this.options.afterUpdate,[this])}beforeSetDimensions(){I(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){I(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),I(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){I(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=I(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,i=$r(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let r=s,a,l,c;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),f=u.widest.width,d=u.highest.height,m=xt(this.chart.width-f,0,this.maxWidth);a=t.offset?this.maxWidth/i:m/(i-1),f+6>a&&(a=m/(i-(t.offset?.5:1)),l=this.maxHeight-yn(t.grid)-n.padding-Yr(t.title,this.chart.options.font),c=Math.sqrt(f*f+d*d),r=Vf(Math.min(Math.asin(xt((u.highest.height+6)/a,-1,1)),Math.asin(xt(l/c,-1,1))-Math.asin(xt(d/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Yr(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=yn(o)+l):(t.height=this.maxHeight,t.width=yn(o)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:f,highest:d}=this._getLabelSizes(),m=i.padding*2,y=Pe(this.labelRotation),x=Math.cos(y),v=Math.sin(y);if(a){const w=i.mirror?0:v*f.width+x*d.height;t.height=Math.min(this.maxHeight,t.height+w+m)}else{const w=i.mirror?0:x*f.width+v*d.height;t.width=Math.min(this.maxWidth,t.width+w+m)}this._calculatePadding(c,u,v,x)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,m=0;l?c?(d=s*t.width,m=i*n.height):(d=i*t.height,m=s*n.width):o==="start"?m=n.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,m=n.width/2),this.paddingLeft=Math.max((d-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((m-f+r)*this.width/(this.width-f),0)}else{let u=n.height/2,f=t.height/2;o==="start"?(u=0,f=t.height):o==="end"&&(u=n.height,f=0),this.paddingTop=u+r,this.paddingBottom=f+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){I(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n<i;n++)B(t[n].label)&&(t.splice(n,1),i--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let i=this.ticks;n<i.length&&(i=Ur(i,n)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,i){const{ctx:s,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(n/$r(n,i));let c=0,u=0,f,d,m,y,x,v,w,k,E,C,T;for(f=0;f<n;f+=l){if(y=t[f].label,x=this._resolveTickFontOptions(f),s.font=v=x.string,w=o[v]=o[v]||{data:{},gc:[]},k=x.lineHeight,E=C=0,!B(y)&&!tt(y))E=wr(s,w.data,w.gc,E,y),C=k;else if(tt(y))for(d=0,m=y.length;d<m;++d)T=y[d],!B(T)&&!tt(T)&&(E=wr(s,w.data,w.gc,E,T),C+=k);r.push(E),a.push(C),c=Math.max(E,c),u=Math.max(C,u)}Qp(o,n);const D=r.indexOf(c),P=a.indexOf(u),O=A=>({width:r[A]||0,height:a[A]||0});return{first:O(0),last:O(n-1),widest:O(D),highest:O(P),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return jf(this._alignToPixels?ke(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const i=n[t];return i.$context||(i.$context=tg(this.getContext(),t,i))}return this.$context||(this.$context=Jp(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Pe(this.labelRotation),i=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*i>a*s?a/i:l/s:l*s<a*i?l/i:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),d=yn(o),m=[],y=a.setContext(this.getContext()),x=y.display?y.width:0,v=x/2,w=function(q){return ke(i,q,x)};let k,E,C,T,D,P,O,A,z,L,H,Z;if(r==="top")k=w(this.bottom),P=this.bottom-d,A=k-v,L=w(t.top)+v,Z=t.bottom;else if(r==="bottom")k=w(this.top),L=t.top,Z=w(t.bottom)-v,P=k+v,A=this.top+d;else if(r==="left")k=w(this.right),D=this.right-d,O=k-v,z=w(t.left)+v,H=t.right;else if(r==="right")k=w(this.left),z=t.left,H=w(t.right)-v,D=k+v,O=this.left+d;else if(n==="x"){if(r==="center")k=w((t.top+t.bottom)/2+.5);else if(V(r)){const q=Object.keys(r)[0],it=r[q];k=w(this.chart.scales[q].getPixelForValue(it))}L=t.top,Z=t.bottom,P=k+v,A=P+d}else if(n==="y"){if(r==="center")k=w((t.left+t.right)/2);else if(V(r)){const q=Object.keys(r)[0],it=r[q];k=w(this.chart.scales[q].getPixelForValue(it))}D=k-v,O=D-d,z=t.left,H=t.right}const nt=R(s.ticks.maxTicksLimit,f),j=Math.max(1,Math.ceil(f/nt));for(E=0;E<f;E+=j){const q=this.getContext(E),it=o.setContext(q),We=a.setContext(q),be=it.lineWidth,Gt=it.color,je=We.dash||[],dt=We.dashOffset,xe=it.tickWidth,wt=it.tickColor,ye=it.tickBorderDash||[],Vt=it.tickBorderDashOffset;C=Zp(this,E,l),C!==void 0&&(T=ke(i,C,be),c?D=O=z=H=T:P=A=L=Z=T,m.push({tx1:D,ty1:P,tx2:O,ty2:A,x1:z,y1:L,x2:H,y2:Z,width:be,color:Gt,borderDash:je,borderDashOffset:dt,tickWidth:xe,tickColor:wt,tickBorderDash:ye,tickBorderDashOffset:Vt}))}return this._ticksLength=f,this._borderValue=k,m}_computeLabelItems(t){const n=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:f}=o,d=yn(i.grid),m=d+u,y=f?-u:m,x=-Pe(this.labelRotation),v=[];let w,k,E,C,T,D,P,O,A,z,L,H,Z="middle";if(s==="top")D=this.bottom-y,P=this._getXAxisLabelAlignment();else if(s==="bottom")D=this.top+y,P=this._getXAxisLabelAlignment();else if(s==="left"){const j=this._getYAxisLabelAlignment(d);P=j.textAlign,T=j.x}else if(s==="right"){const j=this._getYAxisLabelAlignment(d);P=j.textAlign,T=j.x}else if(n==="x"){if(s==="center")D=(t.top+t.bottom)/2+m;else if(V(s)){const j=Object.keys(s)[0],q=s[j];D=this.chart.scales[j].getPixelForValue(q)+m}P=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")T=(t.left+t.right)/2-m;else if(V(s)){const j=Object.keys(s)[0],q=s[j];T=this.chart.scales[j].getPixelForValue(q)}P=this._getYAxisLabelAlignment(d).textAlign}n==="y"&&(l==="start"?Z="top":l==="end"&&(Z="bottom"));const nt=this._getLabelSizes();for(w=0,k=a.length;w<k;++w){E=a[w],C=E.label;const j=o.setContext(this.getContext(w));O=this.getPixelForTick(w)+o.labelOffset,A=this._resolveTickFontOptions(w),z=A.lineHeight,L=tt(C)?C.length:1;const q=L/2,it=j.color,We=j.textStrokeColor,be=j.textStrokeWidth;let Gt=P;r?(T=O,P==="inner"&&(w===k-1?Gt=this.options.reverse?"left":"right":w===0?Gt=this.options.reverse?"right":"left":Gt="center"),s==="top"?c==="near"||x!==0?H=-L*z+z/2:c==="center"?H=-nt.highest.height/2-q*z+z:H=-nt.highest.height+z/2:c==="near"||x!==0?H=z/2:c==="center"?H=nt.highest.height/2-q*z:H=nt.highest.height-L*z,f&&(H*=-1),x!==0&&!j.showLabelBackdrop&&(T+=z/2*Math.sin(x))):(D=O,H=(1-L)*z/2);let je;if(j.showLabelBackdrop){const dt=Mt(j.backdropPadding),xe=nt.heights[w],wt=nt.widths[w];let ye=H-dt.top,Vt=0-dt.left;switch(Z){case"middle":ye-=xe/2;break;case"bottom":ye-=xe;break}switch(P){case"center":Vt-=wt/2;break;case"right":Vt-=wt;break;case"inner":w===k-1?Vt-=wt:w>0&&(Vt-=wt/2);break}je={left:Vt,top:ye,width:wt+dt.width,height:xe+dt.height,color:j.backdropColor}}v.push({label:C,font:A,textOffset:H,options:{rotation:x,color:it,strokeColor:We,strokeWidth:be,textAlign:Gt,textBaseline:Z,translation:[T,D],backdrop:je}})}return v}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Pe(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,u;return n==="left"?s?(u=this.right+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?s?(u=this.left+o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:i,top:s,width:o,height:r}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(o=0,r=s.length;o<r;++o){const l=s[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),r=i.display?o.width:0;if(!r)return;const a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,f,d;this.isHorizontal()?(c=ke(t,this.left,r)-r/2,u=ke(t,this.right,a)+a/2,f=d=l):(f=ke(t,this.top,r)-r/2,d=ke(t,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,f),n.lineTo(u,d),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&vo(i,s);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,u=r.textOffset;Di(i,c,0,u,l,a)}s&&_o(i)}drawTitle(){const{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;const o=ht(i.font),r=Mt(i.padding),a=i.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||V(n)?(l+=r.bottom,tt(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=r.top;const{titleX:c,titleY:u,maxWidth:f,rotation:d}=ng(this,l,n,a);Di(t,i.text,0,0,o,{color:i.color,maxWidth:f,rotation:d,textAlign:eg(a,n,s),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,i=R(t.grid&&t.grid.z,-1),s=R(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==rn.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,r;for(o=0,r=n.length;o<r;++o){const a=n[o];a[i]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return ht(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class ui{constructor(t,n,i){this.type=t,this.scope=n,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let i;og(n)&&(i=this.register(n));const s=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,ig(t,r,i),this.override&&Y.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const n=this.items,i=t.id,s=this.scope;i in n&&delete n[i],s&&i in Y[s]&&(delete Y[s][i],this.override&&delete ze[i])}}function ig(e,t,n){const i=Ln(Object.create(null),[n?Y.get(n):{},Y.get(t),e.defaults]);Y.set(t,i),e.defaultRoutes&&sg(t,e.defaultRoutes),e.descriptors&&Y.describe(t,e.descriptors)}function sg(e,t){Object.keys(t).forEach(n=>{const i=n.split("."),s=i.pop(),o=[e].concat(i).join("."),r=t[n].split("."),a=r.pop(),l=r.join(".");Y.route(o,s,l,a)})}function og(e){return"id"in e&&"defaults"in e}class rg{constructor(){this.controllers=new ui(Zl,"datasets",!0),this.elements=new ui(on,"elements"),this.plugins=new ui(Object,"plugins"),this.scales=new ui(rn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,i){[...n].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):F(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,i){const s=bo(t);I(i["before"+s],[],i),n[t](i),I(i["after"+s],[],i)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const i=this._typedRegistries[n];if(i.isForType(t))return i}return this.plugins}_get(t,n,i){const s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var At=new rg;class ag{constructor(){this._init=[]}notify(t,n,i,s){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,n,i,s){s=s||{};for(const o of t){const r=o.plugin,a=r[i],l=[n,s,o.options];if(I(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){B(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const i=t&&t.config,s=R(i.options&&i.options.plugins,{}),o=lg(i);return s===!1&&!n?[]:ug(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}}function lg(e){const t={},n=[],i=Object.keys(At.plugins.items);for(let o=0;o<i.length;o++)n.push(At.getPlugin(i[o]));const s=e.plugins||[];for(let o=0;o<s.length;o++){const r=s[o];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function cg(e,t){return!t&&e===!1?null:e===!0?{}:e}function ug(e,{plugins:t,localIds:n},i,s){const o=[],r=e.getContext();for(const a of t){const l=a.id,c=cg(i[l],s);c!==null&&o.push({plugin:a,options:hg(e.config,{plugin:a,local:n[l]},c,r)})}return o}function hg(e,{plugin:t,local:n},i,s){const o=e.pluginScopeKeys(t),r=e.getOptionScopes(i,o);return n&&t.defaults&&r.push(t.defaults),e.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Ws(e,t){const n=Y.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function fg(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function dg(e,t){return e===t?"_index_":"_value_"}function Xr(e){if(e==="x"||e==="y"||e==="r")return e}function pg(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function js(e,...t){if(Xr(e))return e;for(const n of t){const i=n.axis||pg(n.position)||e.length>1&&Xr(e[0].toLowerCase());if(i)return i}throw new Error(\`Cannot determine type of '\${e}' axis. Please provide 'axis' or 'position' option.\`)}function qr(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function gg(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return qr(e,"x",n[0])||qr(e,"y",n[0])}return{}}function mg(e,t){const n=ze[e.type]||{scales:{}},i=t.scales||{},s=Ws(e.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!V(a))return console.error(\`Invalid scale configuration for scale: \${r}\`);if(a._proxy)return console.warn(\`Ignoring resolver passed as options for scale: \${r}\`);const l=js(r,a,gg(r,e),Y.scales[a.type]),c=dg(l,s),u=n.scales||{};o[r]=Mn(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(r=>{const a=r.type||e.type,l=r.indexAxis||Ws(a,t),u=(ze[a]||{}).scales||{};Object.keys(u).forEach(f=>{const d=fg(f,l),m=r[d+"AxisID"]||d;o[m]=o[m]||Object.create(null),Mn(o[m],[{axis:d},i[m],u[f]])})}),Object.keys(o).forEach(r=>{const a=o[r];Mn(a,[Y.scales[a.type],Y.scale])}),o}function ic(e){const t=e.options||(e.options={});t.plugins=R(t.plugins,{}),t.scales=mg(e,t)}function sc(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function bg(e){return e=e||{},e.data=sc(e.data),ic(e),e}const Gr=new Map,oc=new Set;function hi(e,t){let n=Gr.get(e);return n||(n=t(),Gr.set(e,n),oc.add(n)),n}const vn=(e,t,n)=>{const i=Ci(t,n);i!==void 0&&e.add(i)};class xg{constructor(t){this._config=bg(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=sc(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),ic(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return hi(t,()=>[[\`datasets.\${t}\`,""]])}datasetAnimationScopeKeys(t,n){return hi(\`\${t}.transition.\${n}\`,()=>[[\`datasets.\${t}.transitions.\${n}\`,\`transitions.\${n}\`],[\`datasets.\${t}\`,""]])}datasetElementScopeKeys(t,n){return hi(\`\${t}-\${n}\`,()=>[[\`datasets.\${t}.elements.\${n}\`,\`datasets.\${t}\`,\`elements.\${n}\`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return hi(\`\${i}-plugin-\${n}\`,()=>[[\`plugins.\${n}\`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const i=this._scopeCache;let s=i.get(t);return(!s||n)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,n,i){const{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(n);if(a)return a;const l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(f=>vn(l,t,f))),u.forEach(f=>vn(l,s,f)),u.forEach(f=>vn(l,ze[o]||{},f)),u.forEach(f=>vn(l,Y,f)),u.forEach(f=>vn(l,Hs,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),oc.has(n)&&r.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,ze[n]||{},Y.datasets[n]||{},{type:n},Y,Hs]}resolveNamedOptions(t,n,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Kr(this._resolverCache,t,s);let l=r;if(vg(r,n)){o.$shared=!1,i=ue(i)?i():i;const c=this.createResolver(t,i,a);l=nn(r,i,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,i=[""],s){const{resolver:o}=Kr(this._resolverCache,t,i);return V(n)?nn(o,n,void 0,s):o}}function Kr(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));const s=n.join();let o=i.get(s);return o||(o={resolver:wo(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const yg=e=>V(e)&&Object.getOwnPropertyNames(e).some(t=>ue(e[t]));function vg(e,t){const{isScriptable:n,isIndexable:i}=Bl(e);for(const s of t){const o=n(s),r=i(s),a=(r||o)&&e[s];if(o&&(ue(a)||yg(a))||r&&tt(a))return!0}return!1}var _g="4.5.0";const wg=["top","bottom","left","right","chartArea"];function Zr(e,t){return e==="top"||e==="bottom"||wg.indexOf(e)===-1&&t==="x"}function Qr(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function Jr(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),I(n&&n.onComplete,[e],t)}function Sg(e){const t=e.chart,n=t.options.animation;I(n&&n.onProgress,[e],t)}function rc(e){return To()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const xi={},ta=e=>{const t=rc(e);return Object.values(xi).filter(n=>n.canvas===t).pop()};function kg(e,t,n){const i=Object.keys(e);for(const s of i){const o=+s;if(o>=t){const r=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=r)}}}function Tg(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}class $s{static defaults=Y;static instances=xi;static overrides=ze;static registry=At;static version=_g;static getChart=ta;static register(...t){At.add(...t),ea()}static unregister(...t){At.remove(...t),ea()}constructor(t,n){const i=this.config=new xg(n),s=rc(t),o=ta(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||jp(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=Ef(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new ag,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=qf(f=>this.update(f),r.resizeDelay||0),this._dataChanges=[],xi[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}$t.listen(this,"complete",Jr),$t.listen(this,"progress",Sg),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return B(t)?n&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return At}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Mr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Sr(this.canvas,this.ctx),this}stop(){return $t.stop(this),this}resize(t,n){$t.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,n,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Mr(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),I(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};F(n,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];n&&(o=o.concat(Object.keys(n).map(r=>{const a=n[r],l=js(r,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),F(o,r=>{const a=r.options,l=a.id,c=js(l,a),u=R(a.type,r.dtype);(a.position===void 0||Zr(a.position,c)!==Zr(r.dposition))&&(a.position=r.dposition),s[l]=!0;let f=null;if(l in i&&i[l].type===u)f=i[l];else{const d=At.getScale(u);f=new d({id:l,type:u,ctx:this.ctx,chart:this}),i[f.id]=f}f.init(a,t)}),F(s,(r,a)=>{r||delete i[a]}),F(i,r=>{ne.configure(this,r,r.options),ne.addBox(this,r)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>n){for(let s=n;s<i;++s)this._destroyDatasetMeta(s);t.splice(n,i-n)}this._sortedMetasets=t.slice(0).sort(Qr("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((i,s)=>{n.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=n.length;i<s;i++){const o=n[i];let r=this.getDatasetMeta(i);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(i),r=this.getDatasetMeta(i)),r.type=a,r.indexAxis=o.indexAxis||Ws(a,this.options),r.order=o.order||0,r.index=i,r.label=""+o.label,r.visible=this.isDatasetVisible(i),r.controller)r.controller.updateIndex(i),r.controller.linkScales();else{const l=At.getController(a),{datasetElementType:c,dataElementType:u}=Y.datasets[a];Object.assign(l,{dataElementType:At.getElement(u),datasetElementType:c&&At.getElement(c)}),r.controller=new l(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){F(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:f}=this.getDatasetMeta(c),d=!s&&o.indexOf(f)===-1;f.buildOrUpdateElements(d),r=Math.max(+f.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||F(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Qr("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){F(this.scales,t=>{ne.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!dr(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of n){const r=i==="_removeElements"?-o:o;kg(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;o<n;o++)if(!dr(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ne.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],F(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n<i;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,i=this.data.datasets.length;n<i;++n)this._updateDataset(n,ue(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&($t.has(this)?this.attached&&!$t.running(this)&&$t.start(this):(this.draw(),Jr({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,i=[];let s,o;for(s=0,o=n.length;s<o;++s){const r=n[s];(!t||r.visible)&&i.push(r)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=ep(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&vo(n,s),t.controller.draw(),s&&_o(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return en(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){const o=wp.modes[n];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Ve(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){const i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);Oi(n)?(o.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),$t.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Sr(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete xi[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,i=(o,r)=>{n.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};F(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},n.isAttached(this.canvas)?a():r()}unbindEvents(){F(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},F(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){const s=i?"set":"remove";let o,r,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],i=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Mi(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){const s=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(f=>u.datasetIndex===f.datasetIndex&&u.index===f.index)),r=o(n,t),a=i?t:o(t,n);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,n,i){const{_active:s=[],options:o}=this,r=n,a=this._getActiveElements(t,s,i,r),l=If(t),c=Tg(t,this._lastEvent,i,l);i&&(this._lastEvent=null,I(o.onHover,[t,a,this],this),l&&I(o.onClick,[t,a,this],this));const u=!Mi(a,s);return(u||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,u}_getActiveElements(t,n,i,s){if(t.type==="mouseout")return[];if(!i)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}function ea(){return F($s.instances,e=>e._plugins.invalidate())}function ac(e,t,n=t){e.lineCap=R(n.borderCapStyle,t.borderCapStyle),e.setLineDash(R(n.borderDash,t.borderDash)),e.lineDashOffset=R(n.borderDashOffset,t.borderDashOffset),e.lineJoin=R(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=R(n.borderWidth,t.borderWidth),e.strokeStyle=R(n.borderColor,t.borderColor)}function Mg(e,t,n){e.lineTo(n.x,n.y)}function Eg(e){return e.stepped?ld:e.tension||e.cubicInterpolationMode==="monotone"?cd:Mg}function lc(e,t,n={}){const i=e.length,{start:s=0,end:o=i-1}=n,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),u=s<r&&o<r||s>a&&o>a;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function Cg(e,t,n,i){const{points:s,options:o}=t,{count:r,start:a,loop:l,ilen:c}=lc(s,n,i),u=Eg(o);let{move:f=!0,reverse:d}=i||{},m,y,x;for(m=0;m<=c;++m)y=s[(a+(d?c-m:m))%r],!y.skip&&(f?(e.moveTo(y.x,y.y),f=!1):u(e,x,y,d,o.stepped),x=y);return l&&(y=s[(a+(d?c:0))%r],u(e,x,y,d,o.stepped)),!!l}function Og(e,t,n,i){const s=t.points,{count:o,start:r,ilen:a}=lc(s,n,i),{move:l=!0,reverse:c}=i||{};let u=0,f=0,d,m,y,x,v,w;const k=C=>(r+(c?a-C:C))%o,E=()=>{x!==v&&(e.lineTo(u,v),e.lineTo(u,x),e.lineTo(u,w))};for(l&&(m=s[k(0)],e.moveTo(m.x,m.y)),d=0;d<=a;++d){if(m=s[k(d)],m.skip)continue;const C=m.x,T=m.y,D=C|0;D===y?(T<x?x=T:T>v&&(v=T),u=(f*u+C)/++f):(E(),e.lineTo(C,T),y=D,f=0,x=v=T),w=T}E()}function Us(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Og:Cg}function Pg(e){return e.stepped?Wd:e.tension||e.cubicInterpolationMode==="monotone"?jd:Me}function Dg(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),ac(e,t.options),e.stroke(s)}function Ag(e,t,n,i){const{segments:s,options:o}=t,r=Us(t);for(const a of s)ac(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const Ig=typeof Path2D=="function";function Lg(e,t,n,i){Ig&&!t.options.segment?Dg(e,t,n,i):Ag(e,t,n,i)}class Rg extends on{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Ld(this._points,i,t,s,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Zd(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){const i=this.options,s=t[n],o=this.points,r=qd(this,{property:n,start:s,end:s});if(!r.length)return;const a=[],l=Pg(i);let c,u;for(c=0,u=r.length;c<u;++c){const{start:f,end:d}=r[c],m=o[f],y=o[d];if(m===y){a.push(m);continue}const x=Math.abs((s-m[n])/(y[n]-m[n])),v=l(m,y,x,i.stepped);v[n]=t[n],a.push(v)}return a.length===1?a[0]:a}pathSegment(t,n,i){return Us(this)(t,this,n,i)}path(t,n,i){const s=this.segments,o=Us(this);let r=this._loop;n=n||0,i=i||this.points.length-n;for(const a of s)r&=o(t,this,a,{start:n,end:n+i-1});return!!r}draw(t,n,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Lg(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function na(e,t,n,i){const s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}class Ng extends on{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.options,{x:o,y:r}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(n-r,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return na(this,t,"x",n)}inYRange(t,n){return na(this,t,"y",n)}getCenterPoint(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);const i=n&&t.borderWidth||0;return(n+i)*2}draw(t,n){const i=this.options;this.skip||i.radius<.1||!en(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Vs(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}const ia=(e,t)=>{let{boxHeight:n=t,boxWidth:i=t}=e;return e.usePointStyle&&(n=Math.min(n,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(t,n)}},Fg=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class sa extends on{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,i){this.maxWidth=t,this.maxHeight=n,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=I(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(i=>t.filter(i,this.chart.data))),t.sort&&(n=n.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=ht(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=ia(i,o);let c,u;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,o,a,l)+10):(u=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+a;let f=t;o.textAlign="left",o.textBaseline="middle";let d=-1,m=-u;return this.legendItems.forEach((y,x)=>{const v=i+n/2+o.measureText(y.text).width;(x===0||c[c.length-1]+v+2*a>r)&&(f+=u,c[c.length-(x>0?0:1)]=0,m+=u,d++),l[x]={left:0,top:m,row:d,width:v,height:s},c[c.length-1]+=v+a}),f}_fitCols(t,n,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t;let f=a,d=0,m=0,y=0,x=0;return this.legendItems.forEach((v,w)=>{const{itemWidth:k,itemHeight:E}=zg(i,n,o,v,s);w>0&&m+E+2*a>u&&(f+=d+a,c.push({width:d,height:m}),y+=d+a,x++,d=m=0),l[w]={left:y,top:m,col:x,width:k,height:E},d=Math.max(d,k),m+=E+a}),f+=d,c.push({width:d,height:m}),f}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:s},rtl:o}}=this,r=Ge(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=ft(i,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=ft(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;vo(t,this),this._draw(),_o(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=Y.color,l=Ge(t.rtl,this.left,this.width),c=ht(r.font),{padding:u}=r,f=c.size,d=f/2;let m;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:y,boxHeight:x,itemHeight:v}=ia(r,f),w=function(D,P,O){if(isNaN(y)||y<=0||isNaN(x)||x<0)return;s.save();const A=R(O.lineWidth,1);if(s.fillStyle=R(O.fillStyle,a),s.lineCap=R(O.lineCap,"butt"),s.lineDashOffset=R(O.lineDashOffset,0),s.lineJoin=R(O.lineJoin,"miter"),s.lineWidth=A,s.strokeStyle=R(O.strokeStyle,a),s.setLineDash(R(O.lineDash,[])),r.usePointStyle){const z={radius:x*Math.SQRT2/2,pointStyle:O.pointStyle,rotation:O.rotation,borderWidth:A},L=l.xPlus(D,y/2),H=P+d;Hl(s,z,L,H,r.pointStyleWidth&&y)}else{const z=P+Math.max((f-x)/2,0),L=l.leftForLtr(D,y),H=On(O.borderRadius);s.beginPath(),Object.values(H).some(Z=>Z!==0)?Bs(s,{x:L,y:z,w:y,h:x,radius:H}):s.rect(L,z,y,x),s.fill(),A!==0&&s.stroke()}s.restore()},k=function(D,P,O){Di(s,O.text,D,P+v/2,c,{strikethrough:O.hidden,textAlign:l.textAlign(O.textAlign)})},E=this.isHorizontal(),C=this._computeTitleHeight();E?m={x:ft(o,this.left+u,this.right-i[0]),y:this.top+u+C,line:0}:m={x:this.left+u,y:ft(o,this.top+C+u,this.bottom-n[0].height),line:0},Yl(this.ctx,t.textDirection);const T=v+u;this.legendItems.forEach((D,P)=>{s.strokeStyle=D.fontColor,s.fillStyle=D.fontColor;const O=s.measureText(D.text).width,A=l.textAlign(D.textAlign||(D.textAlign=r.textAlign)),z=y+d+O;let L=m.x,H=m.y;l.setWidth(this.width),E?P>0&&L+z+u>this.right&&(H=m.y+=T,m.line++,L=m.x=ft(o,this.left+u,this.right-i[m.line])):P>0&&H+T>this.bottom&&(L=m.x=L+n[m.line].width+u,m.line++,H=m.y=ft(o,this.top+C+u,this.bottom-n[m.line].height));const Z=l.x(L);if(w(Z,H,D),L=Gf(A,L+y+d,E?L+z:this.right,t.rtl),k(l.x(L),H,D),E)m.x+=z+u;else if(typeof D.text!="string"){const nt=c.lineHeight;m.y+=cc(D,nt)+u}else m.y+=T}),Xl(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=ht(n.font),s=Mt(n.padding);if(!n.display)return;const o=Ge(t.rtl,this.left,this.width),r=this.ctx,a=n.position,l=i.size/2,c=s.top+l;let u,f=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),u=this.top+c,f=ft(t.align,f,this.right-d);else{const y=this.columnSizes.reduce((x,v)=>Math.max(x,v.height),0);u=c+ft(t.align,this.top,this.bottom-y-t.labels.padding-this._computeTitleHeight())}const m=ft(a,f,f+d);r.textAlign=o.textAlign(Nl(a)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=i.string,Di(r,n.text,m,u,i)}_computeTitleHeight(){const t=this.options.title,n=ht(t.font),i=Mt(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,s,o;if(Sn(t,this.left,this.right)&&Sn(n,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],Sn(t,s.left,s.left+s.width)&&Sn(n,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const n=this.options;if(!Bg(t.type,n))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=Fg(s,i);s&&!o&&I(n.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&I(n.onHover,[t,i,this],this)}else i&&I(n.onClick,[t,i,this],this)}}function zg(e,t,n,i,s){const o=Hg(i,e,t,n),r=Vg(s,i,t.lineHeight);return{itemWidth:o,itemHeight:r}}function Hg(e,t,n,i){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),t+n.size/2+i.measureText(s).width}function Vg(e,t,n){let i=e;return typeof t.text!="string"&&(i=cc(t,n)),i}function cc(e,t){const n=e.text?e.text.length:0;return t*n}function Bg(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var Wg={id:"legend",_element:sa,start(e,t,n){const i=e.legend=new sa({ctx:e.ctx,options:n,chart:e});ne.configure(e,i,n),ne.addBox(e,i)},stop(e){ne.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;ne.configure(e,i,n),i.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const i=t.datasetIndex,s=n.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=Mt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};const Tn={average(e){if(!e.length)return!1;let t,n,i=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((a,l)=>a+l)/i.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){const l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=zs(t,c);u<s&&(s=u,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,i=l.y}return{x:n,y:i}}};function Dt(e,t){return t&&(tt(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Ut(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(\`
|
|
9763
|
+
*/class lp{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,i,s){const o=n.listeners[s],r=n.duration;o.forEach(a=>a({chart:t,initial:n.initial,numSteps:r,currentStep:Math.min(i-n.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Rl.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const i=n.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var $t=new lp;const Ir="transparent",cp={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=wr(e||Ir),s=i.valid&&wr(t||Ir);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class up{constructor(t,n,i,s){const o=n[i];s=oi([t.to,s,o,t.from]);const r=oi([t.from,o,s]);this._active=!0,this._fn=t.fn||cp[t.type||typeof r],this._easing=Cn[t.easing]||Cn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=oi([t.to,n,s,t.from]),this._from=oi([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||n<i),!this._active){this._target[s]=a,this._notify(!0);return}if(n<0){this._target[s]=o;return}l=n/i%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){const n=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][n]()}}class Zl{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!V(t))return;const n=Object.keys(Y.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!V(o))return;const r={};for(const a of n)r[a]=o[a];(tt(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,n){const i=n.options,s=fp(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&hp(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,n){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(n),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,n));continue}const u=n[c];let f=o[c];const d=i.get(c);if(f)if(d&&f.active()){f.update(d,u,a);continue}else f.cancel();if(!d||!d.duration){t[c]=u;continue}o[c]=f=new up(d,t,c,u),s.push(f)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const i=this._createAnimations(t,n);if(i.length)return $t.add(this._chart,i),!0}}function hp(e,t){const n=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=e[i[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function fp(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Lr(e,t){const n=e&&e.options||{},i=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function dp(e,t,n){if(n===!1)return!1;const i=Lr(e,n),s=Lr(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function pp(e){let t,n,i,s;return V(e)?(t=e.top,n=e.right,i=e.bottom,s=e.left):t=n=i=s=e,{top:t,right:n,bottom:i,left:s,disabled:e===!1}}function Ql(e,t){const n=[],i=e._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)n.push(i[s].index);return n}function Nr(e,t,n,i={}){const s=e.keys,o=i.mode==="single";let r,a,l,c;if(t===null)return;let u=!1;for(r=0,a=s.length;r<a;++r){if(l=+s[r],l===n){if(u=!0,i.all)continue;break}c=e.values[l],vt(c)&&(o||t===0||fe(t)===fe(c))&&(t+=c)}return!u&&!i.all?0:t}function gp(e,t){const{iScale:n,vScale:i}=t,s=n.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",r=Object.keys(e),a=new Array(r.length);let l,c,u;for(l=0,c=r.length;l<c;++l)u=r[l],a[l]={[s]:u,[o]:e[u]};return a}function rs(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function mp(e,t,n){return\`\${e.id}.\${t.id}.\${n.stack||n.type}\`}function bp(e){const{min:t,max:n,minDefined:i,maxDefined:s}=e.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function yp(e,t,n){const i=e[t]||(e[t]={});return i[n]||(i[n]={})}function Rr(e,t,n,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function Fr(e,t){const{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,c=r.axis,u=mp(o,r,i),f=t.length;let d;for(let m=0;m<f;++m){const x=t[m],{[l]:y,[c]:v}=x,w=x._stacks||(x._stacks={});d=w[c]=yp(s,u,y),d[a]=v,d._top=Rr(d,r,!0,i.type),d._bottom=Rr(d,r,!1,i.type);const k=d._visualValues||(d._visualValues={});k[a]=v}}function as(e,t){const n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function xp(e,t){return je(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function vp(e,t,n){return je(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function bn(e,t){const n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][n]===void 0)return;delete o[i][n],o[i]._visualValues!==void 0&&o[i]._visualValues[n]!==void 0&&delete o[i]._visualValues[n]}}}const ls=e=>e==="reset"||e==="none",zr=(e,t)=>t?e:Object.assign({},e),_p=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Ql(n,!0),values:null};class Jl{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=rs(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&bn(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(f,d,m,x)=>f==="x"?d:f==="r"?x:m,o=n.xAxisID=N(i.xAxisID,as(t,"x")),r=n.yAxisID=N(i.yAxisID,as(t,"y")),a=n.rAxisID=N(i.rAxisID,as(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,r,a),u=n.vAxisID=s(l,r,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(r),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&xr(this._data,this),t._stacked&&bn(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(V(n)){const s=this._cachedMeta;this._data=gp(n,s)}else if(i!==n){if(i){xr(i,this);const s=this._cachedMeta;bn(s),s._parsed=[]}n&&Object.isExtensible(n)&&Qf(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=rs(n.vScale,n),n.stack!==i.stack&&(s=!0,bn(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&(Fr(this,n._parsed),n._stacked=rs(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis;let l=t===0&&n===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,f,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{tt(s[t])?d=this.parseArrayData(i,s,t,n):V(s[t])?d=this.parseObjectData(i,s,t,n):d=this.parsePrimitiveData(i,s,t,n);const m=()=>f[a]===null||c&&f[a]<c[a];for(u=0;u<n;++u)i._parsed[u+t]=f=d[u],l&&(m()&&(l=!1),c=f);i._sorted=l}r&&Fr(this,d)}parsePrimitiveData(t,n,i,s){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),u=o===r,f=new Array(s);let d,m,x;for(d=0,m=s;d<m;++d)x=d+i,f[d]={[a]:u||o.parse(c[x],x),[l]:r.parse(n[x],x)};return f}parseArrayData(t,n,i,s){const{xScale:o,yScale:r}=t,a=new Array(s);let l,c,u,f;for(l=0,c=s;l<c;++l)u=l+i,f=n[u],a[l]={x:o.parse(f[0],u),y:r.parse(f[1],u)};return a}parseObjectData(t,n,i,s){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let u,f,d,m;for(u=0,f=s;u<f;++u)d=u+i,m=n[d],c[u]={x:o.parse(Ci(m,a),d),y:r.parse(Ci(m,l),d)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,i){const s=this.chart,o=this._cachedMeta,r=n[t.axis],a={keys:Ql(s,!0),values:n._stacks[t.axis]._visualValues};return Nr(a,r,o.index,{mode:i})}updateRangeFromParsed(t,n,i,s){const o=i[n.axis];let r=o===null?NaN:o;const a=s&&i._stacks[n.axis];s&&a&&(s.values=a,r=Nr(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,n){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,r=s.length,a=this._getOtherScale(t),l=_p(n,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:f}=bp(a);let d,m;function x(){m=s[d];const y=m[a.axis];return!vt(m[t.axis])||u>y||f<y}for(d=0;d<r&&!(!x()&&(this.updateRangeFromParsed(c,t,m,l),o));++d);if(o){for(d=r-1;d>=0;--d)if(!x()){this.updateRangeFromParsed(c,t,m,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,i=[];let s,o,r;for(s=0,o=n.length;s<o;++s)r=n[s][t.axis],vt(r)&&i.push(r);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,i=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=pp(N(this.options.clip,dp(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,i=this._cachedMeta,s=i.data||[],o=n.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,o,a,l),u=a;u<a+l;++u){const f=s[u];f.hidden||(f.active&&c?r.push(f):f.draw(t,o))}for(u=0;u<r.length;++u)r[u].draw(t,o)}getStyle(t,n){const i=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,n,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=vp(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=xp(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",i){const s=n==="active",o=this._cachedDataOpts,r=t+"-"+n,a=o[r],l=this.enableOptionSharing&&Oi(i);if(a)return zr(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),f=s?[\`\${t}Hover\`,"hover",t,""]:[t,""],d=c.getOptionScopes(this.getDataset(),u),m=Object.keys(Y.elements[t]),x=()=>this.getContext(i,s,n),y=c.resolveNamedOptions(d,m,x,f);return y.$shared&&(y.$shared=l,o[r]=Object.freeze(zr(y,l))),y}_resolveAnimations(t,n,i){const s=this.chart,o=this._cachedDataOpts,r=\`animation-\${n}\`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const u=this.chart.config,f=u.datasetAnimationScopeKeys(this._type,n),d=u.getOptionScopes(this.getDataset(),f);l=u.createResolver(d,this.getContext(t,i,n))}const c=new Zl(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||ls(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const i=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,i),{sharedOptions:o,includeOptions:r}}updateElement(t,n,i,s){ls(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!ls(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,o=n.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,i=!0){const s=this._cachedMeta,o=s.data,r=t+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=r;a--)c[a]=c[a-n]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,n),i&&this.updateElements(o,t,n,"reset")}updateElements(t,n,i,s){}_removeElements(t,n){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,n);i._stacked&&bn(i,s)}i.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,i,s]=t;this[n](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}class wp extends Jl{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=n,r=this.chart._animationsDisabled;let{start:a,count:l}=nd(n,s,r);this._drawStart=a,this._drawCount=l,id(n)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:f}=this._getSharedOptions(n,s),d=r.axis,m=a.axis,{spanGaps:x,segment:y}=this.options,v=Rn(x)?x:Number.POSITIVE_INFINITY,w=this.chart._animationsDisabled||o||s==="none",k=n+i,C=t.length;let O=n>0&&this.getParsed(n-1);for(let T=0;T<C;++T){const D=t[T],P=w?D:{};if(T<n||T>=k){P.skip=!0;continue}const E=this.getParsed(T),A=B(E[m]),z=P[d]=r.getPixelForValue(E[d],T),L=P[m]=o||A?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,E,l):E[m],T);P.skip=isNaN(z)||isNaN(L)||A,P.stop=T>0&&Math.abs(E[d]-O[d])>v,y&&(P.parsed=E,P.raw=c.data[T]),f&&(P.options=u||this.resolveDataElementOptions(T,D.active?"active":s)),w||this.updateElement(D,T,P,s),O=E}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}function Ee(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Oo{static override(t){Object.assign(Oo.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Ee()}parse(){return Ee()}format(){return Ee()}add(){return Ee()}diff(){return Ee()}startOf(){return Ee()}endOf(){return Ee()}}var Sp={_date:Oo};function kp(e,t,n,i){const{controller:s,data:o,_sorted:r}=e,a=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?Kf:Ie;if(i){if(s._sharedOptions){const u=o[0],f=typeof u.getRange=="function"&&u.getRange(t);if(f){const d=c(o,t,n-f),m=c(o,t,n+f);return{lo:d.lo,hi:m.hi}}}}else{const u=c(o,t,n);if(l){const{vScale:f}=s._cachedMeta,{_parsed:d}=e,m=d.slice(0,u.lo+1).reverse().findIndex(y=>!B(y[f.axis]));u.lo-=Math.max(0,m);const x=d.slice(u.hi).findIndex(y=>!B(y[f.axis]));u.hi+=Math.max(0,x)}return u}}return{lo:0,hi:o.length-1}}function ji(e,t,n,i,s){const o=e.getSortedVisibleDatasetMetas(),r=n[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:u}=o[a],{lo:f,hi:d}=kp(o[a],t,r,s);for(let m=f;m<=d;++m){const x=u[m];x.skip||i(x,c,m)}}}function Tp(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,r=n?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function cs(e,t,n,i,s){const o=[];return!s&&!e.isPointInArea(t)||ji(e,n,t,function(a,l,c){!s&&!en(a,e.chartArea,0)||a.inRange(t.x,t.y,i)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function Mp(e,t,n,i){let s=[];function o(r,a,l){const{startAngle:c,endAngle:u}=r.getProps(["startAngle","endAngle"],i),{angle:f}=Xf(r,{x:t.x,y:t.y});Ll(f,c,u)&&s.push({element:r,datasetIndex:a,index:l})}return ji(e,n,t,o),s}function Ep(e,t,n,i,s,o){let r=[];const a=Tp(n);let l=Number.POSITIVE_INFINITY;function c(u,f,d){const m=u.inRange(t.x,t.y,s);if(i&&!m)return;const x=u.getCenterPoint(s);if(!(!!o||e.isPointInArea(x))&&!m)return;const v=a(t,x);v<l?(r=[{element:u,datasetIndex:f,index:d}],l=v):v===l&&r.push({element:u,datasetIndex:f,index:d})}return ji(e,n,t,c),r}function us(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?Mp(e,t,n,s):Ep(e,t,n,i,s,o)}function Hr(e,t,n,i,s){const o=[],r=n==="x"?"inXRange":"inYRange";let a=!1;return ji(e,n,t,(l,c,u)=>{l[r]&&l[r](t[n],s)&&(o.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:o}var Cp={modes:{index(e,t,n,i){const s=It(t,e),o=n.axis||"x",r=n.includeInvisible||!1,a=n.intersect?cs(e,s,o,i,r):us(e,s,o,!1,i,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,f=c.data[u];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;let a=n.intersect?cs(e,s,o,i,r):us(e,s,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return cs(e,s,o,i,r)},nearest(e,t,n,i){const s=It(t,e),o=n.axis||"xy",r=n.includeInvisible||!1;return us(e,s,o,n.intersect,i,r)},x(e,t,n,i){const s=It(t,e);return Hr(e,s,"x",n.intersect,i)},y(e,t,n,i){const s=It(t,e);return Hr(e,s,"y",n.intersect,i)}}};const tc=["left","top","right","bottom"];function yn(e,t){return e.filter(n=>n.pos===t)}function Vr(e,t){return e.filter(n=>tc.indexOf(n.pos)===-1&&n.box.axis===t)}function xn(e,t){return e.sort((n,i)=>{const s=t?i:n,o=t?n:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function Op(e){const t=[];let n,i,s,o,r,a;for(n=0,i=(e||[]).length;n<i;++n)s=e[n],{position:o,options:{stack:r,stackWeight:a=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return t}function Pp(e){const t={};for(const n of e){const{stack:i,pos:s,stackWeight:o}=n;if(!i||!tc.includes(s))continue;const r=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function Dp(e,t){const n=Pp(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,r,a;for(o=0,r=e.length;o<r;++o){a=e[o];const{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*i:l&&t.availableWidth,a.height=s):(a.width=i,a.height=u?u*s:l&&t.availableHeight)}return n}function Ap(e){const t=Op(e),n=xn(t.filter(c=>c.box.fullSize),!0),i=xn(yn(t,"left"),!0),s=xn(yn(t,"right")),o=xn(yn(t,"top"),!0),r=xn(yn(t,"bottom")),a=Vr(t,"x"),l=Vr(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:yn(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function Br(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function ec(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Ip(e,t,n,i){const{pos:s,box:o}=n,r=e.maxPadding;if(!V(s)){n.size&&(e[s]-=n.size);const f=i[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?o.height:o.width),n.size=f.size/f.count,e[s]+=n.size}o.getPadding&&ec(r,o.getPadding());const a=Math.max(0,t.outerWidth-Br(r,e,"left","right")),l=Math.max(0,t.outerHeight-Br(r,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function Lp(e){const t=e.maxPadding;function n(i){const s=Math.max(t[i]-e[i],0);return e[i]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function Np(e,t){const n=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],n[r])}),o}return i(e?["left","right"]:["top","bottom"])}function Tn(e,t,n,i){const s=[];let o,r,a,l,c,u;for(o=0,r=e.length,c=0;o<r;++o){a=e[o],l=a.box,l.update(a.width||t.w,a.height||t.h,Np(a.horizontal,t));const{same:f,other:d}=Ip(t,n,a,i);c|=f&&s.length,u=u||d,l.fullSize||s.push(a)}return c&&Tn(s,t,n,i)||u}function ci(e,t,n,i,s){e.top=n,e.left=t,e.right=t+i,e.bottom=n+s,e.width=i,e.height=s}function Wr(e,t,n,i){const s=n.padding;let{x:o,y:r}=t;for(const a of e){const l=a.box,c=i[a.stack]||{placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const f=t.w*u,d=c.size||l.height;Oi(c.start)&&(r=c.start),l.fullSize?ci(l,s.left,r,n.outerWidth-s.right-s.left,d):ci(l,t.left+c.placed,r,f,d),c.start=r,c.placed+=f,r=l.bottom}else{const f=t.h*u,d=c.size||l.width;Oi(c.start)&&(o=c.start),l.fullSize?ci(l,o,s.top,d,n.outerHeight-s.bottom-s.top):ci(l,o,t.top+c.placed,d,f),c.start=o,c.placed+=f,o=l.right}}t.x=o,t.y=r}var ie={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,i){if(!e)return;const s=Mt(e.options.layout.padding),o=Math.max(t-s.width,0),r=Math.max(n-s.height,0),a=Ap(e.boxes),l=a.vertical,c=a.horizontal;F(e.boxes,y=>{typeof y.beforeLayout=="function"&&y.beforeLayout()});const u=l.reduce((y,v)=>v.box.options&&v.box.options.display===!1?y:y+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),d=Object.assign({},s);ec(d,Mt(i));const m=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),x=Dp(l.concat(c),f);Tn(a.fullSize,m,f,x),Tn(l,m,f,x),Tn(c,m,f,x)&&Tn(l,m,f,x),Lp(m),Wr(a.leftAndTop,m,f,x),m.x+=m.w,m.y+=m.h,Wr(a.rightAndBottom,m,f,x),e.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},F(a.chartArea,y=>{const v=y.box;Object.assign(v,e.chartArea),v.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class nc{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,s){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Rp extends nc{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const bi="$chartjs",Fp={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},jr=e=>e===null||e==="";function zp(e,t){const n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[bi]={initial:{height:i,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",jr(s)){const o=Or(e,"width");o!==void 0&&(e.width=o)}if(jr(i))if(e.style.height==="")e.height=e.width/(t||2);else{const o=Or(e,"height");o!==void 0&&(e.height=o)}return e}const ic=Xd?{passive:!0}:!1;function Hp(e,t,n){e&&e.addEventListener(t,n,ic)}function Vp(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,ic)}function Bp(e,t){const n=Fp[e.type]||e.type,{x:i,y:s}=It(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Ii(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function Wp(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ii(a.addedNodes,i),r=r&&!Ii(a.removedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function jp(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ii(a.removedNodes,i),r=r&&!Ii(a.addedNodes,i);r&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Fn=new Map;let $r=0;function sc(){const e=window.devicePixelRatio;e!==$r&&($r=e,Fn.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function $p(e,t){Fn.size||window.addEventListener("resize",sc),Fn.set(e,t)}function Up(e){Fn.delete(e),Fn.size||window.removeEventListener("resize",sc)}function Yp(e,t,n){const i=e.canvas,s=i&&Co(i);if(!s)return;const o=Fl((a,l)=>{const c=s.clientWidth;n(a,l),c<s.clientWidth&&n()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return r.observe(s),$p(e,o),r}function hs(e,t,n){n&&n.disconnect(),t==="resize"&&Up(e)}function Xp(e,t,n){const i=e.canvas,s=Fl(o=>{e.ctx!==null&&n(Bp(o,e))},e);return Hp(i,t,s),s}class qp extends nc{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(zp(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[bi])return!1;const i=n[bi].initial;["height","width"].forEach(o=>{const r=i[o];B(r)?n.removeAttribute(o):n.setAttribute(o,r)});const s=i.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[bi],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),r={attach:Wp,detach:jp,resize:Yp}[n]||Xp;s[n]=r(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:hs,detach:hs,resize:hs}[n]||Vp)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return Yd(t,n,i,s)}isAttached(t){const n=t&&Co(t);return!!(n&&n.isConnected)}}function Gp(e){return!Eo()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?Rp:qp}class on{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return Rn(this.x)&&Rn(this.y)}getProps(t,n){const i=this.$animations;if(!n||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}function Kp(e,t){const n=e.options.ticks,i=Zp(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?Jp(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return tg(t,c,o,r/s),c;const u=Qp(o,t,s);if(r>0){let f,d;const m=r>1?Math.round((l-a)/(r-1)):null;for(ui(t,c,u,B(m)?0:a-m,a),f=0,d=r-1;f<d;f++)ui(t,c,u,o[f],o[f+1]);return ui(t,c,u,l,B(m)?t.length:l+m),c}return ui(t,c,u),c}function Zp(e){const t=e.options.offset,n=e._tickSize(),i=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(i,s))}function Qp(e,t,n){const i=eg(e),s=t.length/n;if(!i)return Math.max(s,1);const o=Wf(i);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>s)return l}return Math.max(s,1)}function Jp(e){const t=[];let n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function tg(e,t,n,i){let s=0,o=n[0],r;for(i=Math.ceil(i),r=0;r<e.length;r++)r===o&&(t.push(e[r]),s++,o=n[s*i])}function ui(e,t,n,i,s){const o=N(i,0),r=Math.min(N(s,e.length),e.length);let a=0,l,c,u;for(n=Math.ceil(n),s&&(l=s-i,n=l/Math.floor(l/n)),u=o;u<0;)a++,u=Math.round(o+a*n);for(c=Math.max(o,0);c<r;c++)c===u&&(t.push(e[c]),a++,u=Math.round(o+a*n))}function eg(e){const t=e.length;let n,i;if(t<2)return!1;for(i=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==i)return!1;return i}const ng=e=>e==="left"?"right":e==="right"?"left":e,Ur=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,Yr=(e,t)=>Math.min(t||e,e);function Xr(e,t){const n=[],i=e.length/t,s=e.length;let o=0;for(;o<s;o+=i)n.push(e[Math.floor(o)]);return n}function ig(e,t,n){const i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,r=e._endPixel,a=1e-6;let l=e.getPixelForTick(s),c;if(!(n&&(i===1?c=Math.max(l-o,r-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-a||l>r+a)))return l}function sg(e,t){F(e,n=>{const i=n.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete n.data[i[o]];i.splice(0,s)}})}function vn(e){return e.drawTicks?e.tickLength:0}function qr(e,t){if(!e.display)return 0;const n=ht(e.font,t),i=Mt(e.padding);return(tt(e.text)?e.text.length:1)*n.lineHeight+i.height}function og(e,t){return je(e,{scale:t,type:"scale"})}function rg(e,t,n){return je(e,{tick:n,index:t,type:"tick"})}function ag(e,t,n){let i=zl(e);return(n&&t!=="right"||!n&&t==="right")&&(i=ng(i)),i}function lg(e,t,n,i){const{top:s,left:o,bottom:r,right:a,chart:l}=e,{chartArea:c,scales:u}=l;let f=0,d,m,x;const y=r-s,v=a-o;if(e.isHorizontal()){if(m=ft(i,o,a),V(n)){const w=Object.keys(n)[0],k=n[w];x=u[w].getPixelForValue(k)+y-t}else n==="center"?x=(c.bottom+c.top)/2+y-t:x=Ur(e,n,t);d=a-o}else{if(V(n)){const w=Object.keys(n)[0],k=n[w];m=u[w].getPixelForValue(k)-v+t}else n==="center"?m=(c.left+c.right)/2-v+t:m=Ur(e,n,t);x=ft(i,r,s),f=n==="left"?-kt:kt}return{titleX:m,titleY:x,maxWidth:d,rotation:f}}class rn extends on{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:i,_suggestedMax:s}=this;return t=Pt(t,Number.POSITIVE_INFINITY),n=Pt(n,Number.NEGATIVE_INFINITY),i=Pt(i,Number.POSITIVE_INFINITY),s=Pt(s,Number.NEGATIVE_INFINITY),{min:Pt(t,i),max:Pt(n,s),minDefined:vt(t),maxDefined:vt(n)}}getMinMax(t){let{min:n,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:n,max:i};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),s||(n=Math.min(n,r.min)),o||(i=Math.max(i,r.max));return n=o&&n>i?i:n,i=s&&n>i?n:i,{min:Pt(n,Pt(i,n)),max:Pt(i,Pt(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I(this.options.beforeUpdate,[this])}update(t,n,i){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=kd(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Xr(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=Kp(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,i;this.isHorizontal()?(n=this.left,i=this.right):(n=this.top,i=this.bottom,t=!t),this._startPixel=n,this._endPixel=i,this._reversePixels=t,this._length=i-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){I(this.options.afterUpdate,[this])}beforeSetDimensions(){I(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){I(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),I(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){I(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=I(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){I(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){I(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,i=Yr(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let r=s,a,l,c;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),f=u.widest.width,d=u.highest.height,m=yt(this.chart.width-f,0,this.maxWidth);a=t.offset?this.maxWidth/i:m/(i-1),f+6>a&&(a=m/(i-(t.offset?.5:1)),l=this.maxHeight-vn(t.grid)-n.padding-qr(t.title,this.chart.options.font),c=Math.sqrt(f*f+d*d),r=Yf(Math.min(Math.asin(yt((u.highest.height+6)/a,-1,1)),Math.asin(yt(l/c,-1,1))-Math.asin(yt(d/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=qr(s,n.options.font);if(a?(t.width=this.maxWidth,t.height=vn(o)+l):(t.height=this.maxHeight,t.width=vn(o)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:f,highest:d}=this._getLabelSizes(),m=i.padding*2,x=Ae(this.labelRotation),y=Math.cos(x),v=Math.sin(x);if(a){const w=i.mirror?0:v*f.width+y*d.height;t.height=Math.min(this.maxHeight,t.height+w+m)}else{const w=i.mirror?0:y*f.width+v*d.height;t.width=Math.min(this.maxWidth,t.width+w+m)}this._calculatePadding(c,u,v,y)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,m=0;l?c?(d=s*t.width,m=i*n.height):(d=i*t.height,m=s*n.width):o==="start"?m=n.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,m=n.width/2),this.paddingLeft=Math.max((d-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((m-f+r)*this.width/(this.width-f),0)}else{let u=n.height/2,f=t.height/2;o==="start"?(u=0,f=t.height):o==="end"&&(u=n.height,f=0),this.paddingTop=u+r,this.paddingBottom=f+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){I(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n<i;n++)B(t[n].label)&&(t.splice(n,1),i--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let i=this.ticks;n<i.length&&(i=Xr(i,n)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,i){const{ctx:s,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(n/Yr(n,i));let c=0,u=0,f,d,m,x,y,v,w,k,C,O,T;for(f=0;f<n;f+=l){if(x=t[f].label,y=this._resolveTickFontOptions(f),s.font=v=y.string,w=o[v]=o[v]||{data:{},gc:[]},k=y.lineHeight,C=O=0,!B(x)&&!tt(x))C=kr(s,w.data,w.gc,C,x),O=k;else if(tt(x))for(d=0,m=x.length;d<m;++d)T=x[d],!B(T)&&!tt(T)&&(C=kr(s,w.data,w.gc,C,T),O+=k);r.push(C),a.push(O),c=Math.max(C,c),u=Math.max(O,u)}sg(o,n);const D=r.indexOf(c),P=a.indexOf(u),E=A=>({width:r[A]||0,height:a[A]||0});return{first:E(0),last:E(n-1),widest:E(D),highest:E(P),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return Gf(this._alignToPixels?Me(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const i=n[t];return i.$context||(i.$context=rg(this.getContext(),t,i))}return this.$context||(this.$context=og(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Ae(this.labelRotation),i=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*i>a*s?a/i:l/s:l*s<a*i?l/i:a/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),d=vn(o),m=[],x=a.setContext(this.getContext()),y=x.display?x.width:0,v=y/2,w=function(q){return Me(i,q,y)};let k,C,O,T,D,P,E,A,z,L,H,Z;if(r==="top")k=w(this.bottom),P=this.bottom-d,A=k-v,L=w(t.top)+v,Z=t.bottom;else if(r==="bottom")k=w(this.top),L=t.top,Z=w(t.bottom)-v,P=k+v,A=this.top+d;else if(r==="left")k=w(this.right),D=this.right-d,E=k-v,z=w(t.left)+v,H=t.right;else if(r==="right")k=w(this.left),z=t.left,H=w(t.right)-v,D=k+v,E=this.left+d;else if(n==="x"){if(r==="center")k=w((t.top+t.bottom)/2+.5);else if(V(r)){const q=Object.keys(r)[0],it=r[q];k=w(this.chart.scales[q].getPixelForValue(it))}L=t.top,Z=t.bottom,P=k+v,A=P+d}else if(n==="y"){if(r==="center")k=w((t.left+t.right)/2);else if(V(r)){const q=Object.keys(r)[0],it=r[q];k=w(this.chart.scales[q].getPixelForValue(it))}D=k-v,E=D-d,z=t.left,H=t.right}const nt=N(s.ticks.maxTicksLimit,f),j=Math.max(1,Math.ceil(f/nt));for(C=0;C<f;C+=j){const q=this.getContext(C),it=o.setContext(q),Ue=a.setContext(q),ye=it.lineWidth,Kt=it.color,Ye=Ue.dash||[],dt=Ue.dashOffset,xe=it.tickWidth,wt=it.tickColor,ve=it.tickBorderDash||[],Vt=it.tickBorderDashOffset;O=ig(this,C,l),O!==void 0&&(T=Me(i,O,ye),c?D=E=z=H=T:P=A=L=Z=T,m.push({tx1:D,ty1:P,tx2:E,ty2:A,x1:z,y1:L,x2:H,y2:Z,width:ye,color:Kt,borderDash:Ye,borderDashOffset:dt,tickWidth:xe,tickColor:wt,tickBorderDash:ve,tickBorderDashOffset:Vt}))}return this._ticksLength=f,this._borderValue=k,m}_computeLabelItems(t){const n=this.axis,i=this.options,{position:s,ticks:o}=i,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:f}=o,d=vn(i.grid),m=d+u,x=f?-u:m,y=-Ae(this.labelRotation),v=[];let w,k,C,O,T,D,P,E,A,z,L,H,Z="middle";if(s==="top")D=this.bottom-x,P=this._getXAxisLabelAlignment();else if(s==="bottom")D=this.top+x,P=this._getXAxisLabelAlignment();else if(s==="left"){const j=this._getYAxisLabelAlignment(d);P=j.textAlign,T=j.x}else if(s==="right"){const j=this._getYAxisLabelAlignment(d);P=j.textAlign,T=j.x}else if(n==="x"){if(s==="center")D=(t.top+t.bottom)/2+m;else if(V(s)){const j=Object.keys(s)[0],q=s[j];D=this.chart.scales[j].getPixelForValue(q)+m}P=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")T=(t.left+t.right)/2-m;else if(V(s)){const j=Object.keys(s)[0],q=s[j];T=this.chart.scales[j].getPixelForValue(q)}P=this._getYAxisLabelAlignment(d).textAlign}n==="y"&&(l==="start"?Z="top":l==="end"&&(Z="bottom"));const nt=this._getLabelSizes();for(w=0,k=a.length;w<k;++w){C=a[w],O=C.label;const j=o.setContext(this.getContext(w));E=this.getPixelForTick(w)+o.labelOffset,A=this._resolveTickFontOptions(w),z=A.lineHeight,L=tt(O)?O.length:1;const q=L/2,it=j.color,Ue=j.textStrokeColor,ye=j.textStrokeWidth;let Kt=P;r?(T=E,P==="inner"&&(w===k-1?Kt=this.options.reverse?"left":"right":w===0?Kt=this.options.reverse?"right":"left":Kt="center"),s==="top"?c==="near"||y!==0?H=-L*z+z/2:c==="center"?H=-nt.highest.height/2-q*z+z:H=-nt.highest.height+z/2:c==="near"||y!==0?H=z/2:c==="center"?H=nt.highest.height/2-q*z:H=nt.highest.height-L*z,f&&(H*=-1),y!==0&&!j.showLabelBackdrop&&(T+=z/2*Math.sin(y))):(D=E,H=(1-L)*z/2);let Ye;if(j.showLabelBackdrop){const dt=Mt(j.backdropPadding),xe=nt.heights[w],wt=nt.widths[w];let ve=H-dt.top,Vt=0-dt.left;switch(Z){case"middle":ve-=xe/2;break;case"bottom":ve-=xe;break}switch(P){case"center":Vt-=wt/2;break;case"right":Vt-=wt;break;case"inner":w===k-1?Vt-=wt:w>0&&(Vt-=wt/2);break}Ye={left:Vt,top:ve,width:wt+dt.width,height:xe+dt.height,color:j.backdropColor}}v.push({label:O,font:A,textOffset:H,options:{rotation:y,color:it,strokeColor:Ue,strokeWidth:ye,textAlign:Kt,textBaseline:Z,translation:[T,D],backdrop:Ye}})}return v}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Ae(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,u;return n==="left"?s?(u=this.right+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?s?(u=this.left+o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:i,top:s,width:o,height:r}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(o=0,r=s.length;o<r;++o){const l=s[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),r=i.display?o.width:0;if(!r)return;const a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,f,d;this.isHorizontal()?(c=Me(t,this.left,r)-r/2,u=Me(t,this.right,a)+a/2,f=d=l):(f=Me(t,this.top,r)-r/2,d=Me(t,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,f),n.lineTo(u,d),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&wo(i,s);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,u=r.textOffset;Di(i,c,0,u,l,a)}s&&So(i)}drawTitle(){const{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;const o=ht(i.font),r=Mt(i.padding),a=i.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||V(n)?(l+=r.bottom,tt(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=r.top;const{titleX:c,titleY:u,maxWidth:f,rotation:d}=lg(this,l,n,a);Di(t,i.text,0,0,o,{color:i.color,maxWidth:f,rotation:d,textAlign:ag(a,n,s),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,i=N(t.grid&&t.grid.z,-1),s=N(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==rn.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,r;for(o=0,r=n.length;o<r;++o){const a=n[o];a[i]===this.id&&(!t||a.type===t)&&s.push(a)}return s}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return ht(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class hi{constructor(t,n,i){this.type=t,this.scope=n,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let i;hg(n)&&(i=this.register(n));const s=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,cg(t,r,i),this.override&&Y.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const n=this.items,i=t.id,s=this.scope;i in n&&delete n[i],s&&i in Y[s]&&(delete Y[s][i],this.override&&delete Be[i])}}function cg(e,t,n){const i=Nn(Object.create(null),[n?Y.get(n):{},Y.get(t),e.defaults]);Y.set(t,i),e.defaultRoutes&&ug(t,e.defaultRoutes),e.descriptors&&Y.describe(t,e.descriptors)}function ug(e,t){Object.keys(t).forEach(n=>{const i=n.split("."),s=i.pop(),o=[e].concat(i).join("."),r=t[n].split("."),a=r.pop(),l=r.join(".");Y.route(o,s,l,a)})}function hg(e){return"id"in e&&"defaults"in e}class fg{constructor(){this.controllers=new hi(Jl,"datasets",!0),this.elements=new hi(on,"elements"),this.plugins=new hi(Object,"plugins"),this.scales=new hi(rn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,i){[...n].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):F(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,n,i){const s=xo(t);I(i["before"+s],[],i),n[t](i),I(i["after"+s],[],i)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const i=this._typedRegistries[n];if(i.isForType(t))return i}return this.plugins}_get(t,n,i){const s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var At=new fg;class dg{constructor(){this._init=[]}notify(t,n,i,s){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,n,i,s){s=s||{};for(const o of t){const r=o.plugin,a=r[i],l=[n,s,o.options];if(I(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){B(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const i=t&&t.config,s=N(i.options&&i.options.plugins,{}),o=pg(i);return s===!1&&!n?[]:mg(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],i=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}}function pg(e){const t={},n=[],i=Object.keys(At.plugins.items);for(let o=0;o<i.length;o++)n.push(At.getPlugin(i[o]));const s=e.plugins||[];for(let o=0;o<s.length;o++){const r=s[o];n.indexOf(r)===-1&&(n.push(r),t[r.id]=!0)}return{plugins:n,localIds:t}}function gg(e,t){return!t&&e===!1?null:e===!0?{}:e}function mg(e,{plugins:t,localIds:n},i,s){const o=[],r=e.getContext();for(const a of t){const l=a.id,c=gg(i[l],s);c!==null&&o.push({plugin:a,options:bg(e.config,{plugin:a,local:n[l]},c,r)})}return o}function bg(e,{plugin:t,local:n},i,s){const o=e.pluginScopeKeys(t),r=e.getOptionScopes(i,o);return n&&t.defaults&&r.push(t.defaults),e.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function $s(e,t){const n=Y.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function yg(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function xg(e,t){return e===t?"_index_":"_value_"}function Gr(e){if(e==="x"||e==="y"||e==="r")return e}function vg(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Us(e,...t){if(Gr(e))return e;for(const n of t){const i=n.axis||vg(n.position)||e.length>1&&Gr(e[0].toLowerCase());if(i)return i}throw new Error(\`Cannot determine type of '\${e}' axis. Please provide 'axis' or 'position' option.\`)}function Kr(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function _g(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return Kr(e,"x",n[0])||Kr(e,"y",n[0])}return{}}function wg(e,t){const n=Be[e.type]||{scales:{}},i=t.scales||{},s=$s(e.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!V(a))return console.error(\`Invalid scale configuration for scale: \${r}\`);if(a._proxy)return console.warn(\`Ignoring resolver passed as options for scale: \${r}\`);const l=Us(r,a,_g(r,e),Y.scales[a.type]),c=xg(l,s),u=n.scales||{};o[r]=En(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(r=>{const a=r.type||e.type,l=r.indexAxis||$s(a,t),u=(Be[a]||{}).scales||{};Object.keys(u).forEach(f=>{const d=yg(f,l),m=r[d+"AxisID"]||d;o[m]=o[m]||Object.create(null),En(o[m],[{axis:d},i[m],u[f]])})}),Object.keys(o).forEach(r=>{const a=o[r];En(a,[Y.scales[a.type],Y.scale])}),o}function oc(e){const t=e.options||(e.options={});t.plugins=N(t.plugins,{}),t.scales=wg(e,t)}function rc(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Sg(e){return e=e||{},e.data=rc(e.data),oc(e),e}const Zr=new Map,ac=new Set;function fi(e,t){let n=Zr.get(e);return n||(n=t(),Zr.set(e,n),ac.add(n)),n}const _n=(e,t,n)=>{const i=Ci(t,n);i!==void 0&&e.add(i)};class kg{constructor(t){this._config=Sg(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=rc(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),oc(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return fi(t,()=>[[\`datasets.\${t}\`,""]])}datasetAnimationScopeKeys(t,n){return fi(\`\${t}.transition.\${n}\`,()=>[[\`datasets.\${t}.transitions.\${n}\`,\`transitions.\${n}\`],[\`datasets.\${t}\`,""]])}datasetElementScopeKeys(t,n){return fi(\`\${t}-\${n}\`,()=>[[\`datasets.\${t}.elements.\${n}\`,\`datasets.\${t}\`,\`elements.\${n}\`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return fi(\`\${i}-plugin-\${n}\`,()=>[[\`plugins.\${n}\`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const i=this._scopeCache;let s=i.get(t);return(!s||n)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,n,i){const{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(n);if(a)return a;const l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(f=>_n(l,t,f))),u.forEach(f=>_n(l,s,f)),u.forEach(f=>_n(l,Be[o]||{},f)),u.forEach(f=>_n(l,Y,f)),u.forEach(f=>_n(l,Bs,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),ac.has(n)&&r.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Be[n]||{},Y.datasets[n]||{},{type:n},Y,Bs]}resolveNamedOptions(t,n,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Qr(this._resolverCache,t,s);let l=r;if(Mg(r,n)){o.$shared=!1,i=he(i)?i():i;const c=this.createResolver(t,i,a);l=nn(r,i,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,i=[""],s){const{resolver:o}=Qr(this._resolverCache,t,i);return V(n)?nn(o,n,void 0,s):o}}function Qr(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));const s=n.join();let o=i.get(s);return o||(o={resolver:ko(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const Tg=e=>V(e)&&Object.getOwnPropertyNames(e).some(t=>he(e[t]));function Mg(e,t){const{isScriptable:n,isIndexable:i}=jl(e);for(const s of t){const o=n(s),r=i(s),a=(r||o)&&e[s];if(o&&(he(a)||Tg(a))||r&&tt(a))return!0}return!1}var Eg="4.5.0";const Cg=["top","bottom","left","right","chartArea"];function Jr(e,t){return e==="top"||e==="bottom"||Cg.indexOf(e)===-1&&t==="x"}function ta(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function ea(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),I(n&&n.onComplete,[e],t)}function Og(e){const t=e.chart,n=t.options.animation;I(n&&n.onProgress,[e],t)}function lc(e){return Eo()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const yi={},na=e=>{const t=lc(e);return Object.values(yi).filter(n=>n.canvas===t).pop()};function Pg(e,t,n){const i=Object.keys(e);for(const s of i){const o=+s;if(o>=t){const r=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=r)}}}function Dg(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}class Ys{static defaults=Y;static instances=yi;static overrides=Be;static registry=At;static version=Eg;static getChart=na;static register(...t){At.add(...t),ia()}static unregister(...t){At.remove(...t),ia()}constructor(t,n){const i=this.config=new kg(n),s=lc(t),o=na(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Gp(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=If(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new dg,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=td(f=>this.update(f),r.resizeDelay||0),this._dataChanges=[],yi[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}$t.listen(this,"complete",ea),$t.listen(this,"progress",Og),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return B(t)?n&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return At}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Cr(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Tr(this.canvas,this.ctx),this}stop(){return $t.stop(this),this}resize(t,n){$t.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,n,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,Cr(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),I(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};F(n,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];n&&(o=o.concat(Object.keys(n).map(r=>{const a=n[r],l=Us(r,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),F(o,r=>{const a=r.options,l=a.id,c=Us(l,a),u=N(a.type,r.dtype);(a.position===void 0||Jr(a.position,c)!==Jr(r.dposition))&&(a.position=r.dposition),s[l]=!0;let f=null;if(l in i&&i[l].type===u)f=i[l];else{const d=At.getScale(u);f=new d({id:l,type:u,ctx:this.ctx,chart:this}),i[f.id]=f}f.init(a,t)}),F(s,(r,a)=>{r||delete i[a]}),F(i,r=>{ie.configure(this,r,r.options),ie.addBox(this,r)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>n){for(let s=n;s<i;++s)this._destroyDatasetMeta(s);t.splice(n,i-n)}this._sortedMetasets=t.slice(0).sort(ta("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((i,s)=>{n.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=n.length;i<s;i++){const o=n[i];let r=this.getDatasetMeta(i);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(i),r=this.getDatasetMeta(i)),r.type=a,r.indexAxis=o.indexAxis||$s(a,this.options),r.order=o.order||0,r.index=i,r.label=""+o.label,r.visible=this.isDatasetVisible(i),r.controller)r.controller.updateIndex(i),r.controller.linkScales();else{const l=At.getController(a),{datasetElementType:c,dataElementType:u}=Y.datasets[a];Object.assign(l,{dataElementType:At.getElement(u),datasetElementType:c&&At.getElement(c)}),r.controller=new l(this,i),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){F(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:f}=this.getDatasetMeta(c),d=!s&&o.indexOf(f)===-1;f.buildOrUpdateElements(d),r=Math.max(+f.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||F(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ta("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){F(this.scales,t=>{ie.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!gr(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of n){const r=i==="_removeElements"?-o:o;Pg(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;o<n;o++)if(!gr(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ie.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],F(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n<i;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,i=this.data.datasets.length;n<i;++n)this._updateDataset(n,he(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&($t.has(this)?this.attached&&!$t.running(this)&&$t.start(this):(this.draw(),ea({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,i=[];let s,o;for(s=0,o=n.length;s<o;++s){const r=n[s];(!t||r.visible)&&i.push(r)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=ap(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&wo(n,s),t.controller.draw(),s&&So(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return en(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){const o=Cp.modes[n];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=je(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){const i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);Oi(n)?(o.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),$t.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Tr(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete yi[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,i=(o,r)=>{n.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};F(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},n.isAttached(this.canvas)?a():r()}unbindEvents(){F(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},F(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){const s=i?"set":"remove";let o,r,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],i=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Mi(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){const s=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(f=>u.datasetIndex===f.datasetIndex&&u.index===f.index)),r=o(n,t),a=i?t:o(t,n);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,n){const i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,n,i){const{_active:s=[],options:o}=this,r=n,a=this._getActiveElements(t,s,i,r),l=Hf(t),c=Dg(t,this._lastEvent,i,l);i&&(this._lastEvent=null,I(o.onHover,[t,a,this],this),l&&I(o.onClick,[t,a,this],this));const u=!Mi(a,s);return(u||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,u}_getActiveElements(t,n,i,s){if(t.type==="mouseout")return[];if(!i)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}function ia(){return F(Ys.instances,e=>e._plugins.invalidate())}function cc(e,t,n=t){e.lineCap=N(n.borderCapStyle,t.borderCapStyle),e.setLineDash(N(n.borderDash,t.borderDash)),e.lineDashOffset=N(n.borderDashOffset,t.borderDashOffset),e.lineJoin=N(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=N(n.borderWidth,t.borderWidth),e.strokeStyle=N(n.borderColor,t.borderColor)}function Ag(e,t,n){e.lineTo(n.x,n.y)}function Ig(e){return e.stepped?pd:e.tension||e.cubicInterpolationMode==="monotone"?gd:Ag}function uc(e,t,n={}){const i=e.length,{start:s=0,end:o=i-1}=n,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),u=s<r&&o<r||s>a&&o>a;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function Lg(e,t,n,i){const{points:s,options:o}=t,{count:r,start:a,loop:l,ilen:c}=uc(s,n,i),u=Ig(o);let{move:f=!0,reverse:d}=i||{},m,x,y;for(m=0;m<=c;++m)x=s[(a+(d?c-m:m))%r],!x.skip&&(f?(e.moveTo(x.x,x.y),f=!1):u(e,y,x,d,o.stepped),y=x);return l&&(x=s[(a+(d?c:0))%r],u(e,y,x,d,o.stepped)),!!l}function Ng(e,t,n,i){const s=t.points,{count:o,start:r,ilen:a}=uc(s,n,i),{move:l=!0,reverse:c}=i||{};let u=0,f=0,d,m,x,y,v,w;const k=O=>(r+(c?a-O:O))%o,C=()=>{y!==v&&(e.lineTo(u,v),e.lineTo(u,y),e.lineTo(u,w))};for(l&&(m=s[k(0)],e.moveTo(m.x,m.y)),d=0;d<=a;++d){if(m=s[k(d)],m.skip)continue;const O=m.x,T=m.y,D=O|0;D===x?(T<y?y=T:T>v&&(v=T),u=(f*u+O)/++f):(C(),e.lineTo(O,T),x=D,f=0,y=v=T),w=T}C()}function Xs(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Ng:Lg}function Rg(e){return e.stepped?qd:e.tension||e.cubicInterpolationMode==="monotone"?Gd:Ce}function Fg(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),cc(e,t.options),e.stroke(s)}function zg(e,t,n,i){const{segments:s,options:o}=t,r=Xs(t);for(const a of s)cc(e,o,a.style),e.beginPath(),r(e,t,a,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const Hg=typeof Path2D=="function";function Vg(e,t,n,i){Hg&&!t.options.segment?Fg(e,t,n,i):zg(e,t,n,i)}class Bg extends on{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Vd(this._points,i,t,s,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=ip(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){const i=this.options,s=t[n],o=this.points,r=tp(this,{property:n,start:s,end:s});if(!r.length)return;const a=[],l=Rg(i);let c,u;for(c=0,u=r.length;c<u;++c){const{start:f,end:d}=r[c],m=o[f],x=o[d];if(m===x){a.push(m);continue}const y=Math.abs((s-m[n])/(x[n]-m[n])),v=l(m,x,y,i.stepped);v[n]=t[n],a.push(v)}return a.length===1?a[0]:a}pathSegment(t,n,i){return Xs(this)(t,this,n,i)}path(t,n,i){const s=this.segments,o=Xs(this);let r=this._loop;n=n||0,i=i||this.points.length-n;for(const a of s)r&=o(t,this,a,{start:n,end:n+i-1});return!!r}draw(t,n,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Vg(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function sa(e,t,n,i){const s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}class Wg extends on{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.options,{x:o,y:r}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(n-r,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return sa(this,t,"x",n)}inYRange(t,n){return sa(this,t,"y",n)}getCenterPoint(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);const i=n&&t.borderWidth||0;return(n+i)*2}draw(t,n){const i=this.options;this.skip||i.radius<.1||!en(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Ws(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}const oa=(e,t)=>{let{boxHeight:n=t,boxWidth:i=t}=e;return e.usePointStyle&&(n=Math.min(n,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(t,n)}},jg=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class ra extends on{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,i){this.maxWidth=t,this.maxHeight=n,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=I(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(i=>t.filter(i,this.chart.data))),t.sort&&(n=n.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=ht(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=oa(i,o);let c,u;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,o,a,l)+10):(u=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+a;let f=t;o.textAlign="left",o.textBaseline="middle";let d=-1,m=-u;return this.legendItems.forEach((x,y)=>{const v=i+n/2+o.measureText(x.text).width;(y===0||c[c.length-1]+v+2*a>r)&&(f+=u,c[c.length-(y>0?0:1)]=0,m+=u,d++),l[y]={left:0,top:m,row:d,width:v,height:s},c[c.length-1]+=v+a}),f}_fitCols(t,n,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t;let f=a,d=0,m=0,x=0,y=0;return this.legendItems.forEach((v,w)=>{const{itemWidth:k,itemHeight:C}=$g(i,n,o,v,s);w>0&&m+C+2*a>u&&(f+=d+a,c.push({width:d,height:m}),x+=d+a,y++,d=m=0),l[w]={left:x,top:m,col:y,width:k,height:C},d=Math.max(d,k),m+=C+a}),f+=d,c.push({width:d,height:m}),f}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:s},rtl:o}}=this,r=Qe(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=ft(i,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=ft(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=ft(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;wo(t,this),this._draw(),So(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=Y.color,l=Qe(t.rtl,this.left,this.width),c=ht(r.font),{padding:u}=r,f=c.size,d=f/2;let m;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:x,boxHeight:y,itemHeight:v}=oa(r,f),w=function(D,P,E){if(isNaN(x)||x<=0||isNaN(y)||y<0)return;s.save();const A=N(E.lineWidth,1);if(s.fillStyle=N(E.fillStyle,a),s.lineCap=N(E.lineCap,"butt"),s.lineDashOffset=N(E.lineDashOffset,0),s.lineJoin=N(E.lineJoin,"miter"),s.lineWidth=A,s.strokeStyle=N(E.strokeStyle,a),s.setLineDash(N(E.lineDash,[])),r.usePointStyle){const z={radius:y*Math.SQRT2/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:A},L=l.xPlus(D,x/2),H=P+d;Bl(s,z,L,H,r.pointStyleWidth&&x)}else{const z=P+Math.max((f-y)/2,0),L=l.leftForLtr(D,x),H=Pn(E.borderRadius);s.beginPath(),Object.values(H).some(Z=>Z!==0)?js(s,{x:L,y:z,w:x,h:y,radius:H}):s.rect(L,z,x,y),s.fill(),A!==0&&s.stroke()}s.restore()},k=function(D,P,E){Di(s,E.text,D,P+v/2,c,{strikethrough:E.hidden,textAlign:l.textAlign(E.textAlign)})},C=this.isHorizontal(),O=this._computeTitleHeight();C?m={x:ft(o,this.left+u,this.right-i[0]),y:this.top+u+O,line:0}:m={x:this.left+u,y:ft(o,this.top+O+u,this.bottom-n[0].height),line:0},ql(this.ctx,t.textDirection);const T=v+u;this.legendItems.forEach((D,P)=>{s.strokeStyle=D.fontColor,s.fillStyle=D.fontColor;const E=s.measureText(D.text).width,A=l.textAlign(D.textAlign||(D.textAlign=r.textAlign)),z=x+d+E;let L=m.x,H=m.y;l.setWidth(this.width),C?P>0&&L+z+u>this.right&&(H=m.y+=T,m.line++,L=m.x=ft(o,this.left+u,this.right-i[m.line])):P>0&&H+T>this.bottom&&(L=m.x=L+n[m.line].width+u,m.line++,H=m.y=ft(o,this.top+O+u,this.bottom-n[m.line].height));const Z=l.x(L);if(w(Z,H,D),L=ed(A,L+x+d,C?L+z:this.right,t.rtl),k(l.x(L),H,D),C)m.x+=z+u;else if(typeof D.text!="string"){const nt=c.lineHeight;m.y+=hc(D,nt)+u}else m.y+=T}),Gl(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=ht(n.font),s=Mt(n.padding);if(!n.display)return;const o=Qe(t.rtl,this.left,this.width),r=this.ctx,a=n.position,l=i.size/2,c=s.top+l;let u,f=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),u=this.top+c,f=ft(t.align,f,this.right-d);else{const x=this.columnSizes.reduce((y,v)=>Math.max(y,v.height),0);u=c+ft(t.align,this.top,this.bottom-x-t.labels.padding-this._computeTitleHeight())}const m=ft(a,f,f+d);r.textAlign=o.textAlign(zl(a)),r.textBaseline="middle",r.strokeStyle=n.color,r.fillStyle=n.color,r.font=i.string,Di(r,n.text,m,u,i)}_computeTitleHeight(){const t=this.options.title,n=ht(t.font),i=Mt(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,s,o;if(kn(t,this.left,this.right)&&kn(n,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],kn(t,s.left,s.left+s.width)&&kn(n,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const n=this.options;if(!Xg(t.type,n))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=jg(s,i);s&&!o&&I(n.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&I(n.onHover,[t,i,this],this)}else i&&I(n.onClick,[t,i,this],this)}}function $g(e,t,n,i,s){const o=Ug(i,e,t,n),r=Yg(s,i,t.lineHeight);return{itemWidth:o,itemHeight:r}}function Ug(e,t,n,i){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),t+n.size/2+i.measureText(s).width}function Yg(e,t,n){let i=e;return typeof t.text!="string"&&(i=hc(t,n)),i}function hc(e,t){const n=e.text?e.text.length:0;return t*n}function Xg(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var qg={id:"legend",_element:ra,start(e,t,n){const i=e.legend=new ra({ctx:e.ctx,options:n,chart:e});ie.configure(e,i,n),ie.addBox(e,i)},stop(e){ie.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;ie.configure(e,i,n),i.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const i=t.datasetIndex,s=n.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=Mt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};const Mn={average(e){if(!e.length)return!1;let t,n,i=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){const a=e[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((a,l)=>a+l)/i.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o<r;++o){const l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=Vs(t,c);u<s&&(s=u,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,i=l.y}return{x:n,y:i}}};function Dt(e,t){return t&&(tt(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Ut(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(\`
|
|
9142
9764
|
\`)>-1?e.split(\`
|
|
9143
|
-
\`):e}function jg(e,t){const{element:n,datasetIndex:i,index:s}=t,o=e.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:e,label:r,parsed:o.getParsed(s),raw:e.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:n}}function oa(e,t){const n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:r,boxHeight:a}=t,l=ht(t.bodyFont),c=ht(t.titleFont),u=ht(t.footerFont),f=o.length,d=s.length,m=i.length,y=Mt(t.padding);let x=y.height,v=0,w=i.reduce((C,T)=>C+T.before.length+T.lines.length+T.after.length,0);if(w+=e.beforeBody.length+e.afterBody.length,f&&(x+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),w){const C=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;x+=m*C+(w-m)*l.lineHeight+(w-1)*t.bodySpacing}d&&(x+=t.footerMarginTop+d*u.lineHeight+(d-1)*t.footerSpacing);let k=0;const E=function(C){v=Math.max(v,n.measureText(C).width+k)};return n.save(),n.font=c.string,F(e.title,E),n.font=l.string,F(e.beforeBody.concat(e.afterBody),E),k=t.displayColors?r+2+t.boxPadding:0,F(i,C=>{F(C.before,E),F(C.lines,E),F(C.after,E)}),k=0,n.font=u.string,F(e.footer,E),n.restore(),v+=y.width,{width:v,height:x}}function $g(e,t){const{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function Ug(e,t,n,i){const{x:s,width:o}=i,r=n.caretSize+n.caretPadding;if(e==="left"&&s+o+r>t.width||e==="right"&&s-o-r<0)return!0}function Yg(e,t,n,i){const{x:s,width:o}=n,{width:r,chartArea:{left:a,right:l}}=e;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),Ug(c,e,t,n)&&(c="center"),c}function ra(e,t,n){const i=n.yAlign||t.yAlign||$g(e,n);return{xAlign:n.xAlign||t.xAlign||Yg(e,t,n,i),yAlign:i}}function Xg(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function qg(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function aa(e,t,n,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:u,topRight:f,bottomLeft:d,bottomRight:m}=On(r);let y=Xg(t,a);const x=qg(t,l,c);return l==="center"?a==="left"?y+=c:a==="right"&&(y-=c):a==="left"?y-=Math.max(u,d)+s:a==="right"&&(y+=Math.max(f,m)+s),{x:xt(y,0,i.width-t.width),y:xt(x,0,i.height-t.height)}}function fi(e,t,n){const i=Mt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function la(e){return Dt([],Ut(e))}function Gg(e,t,n){return Ve(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function ca(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const uc={beforeTitle:jt,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return n[t.dataIndex]}return""},afterTitle:jt,beforeBody:jt,beforeLabel:jt,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return B(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:jt,afterBody:jt,beforeFooter:jt,footer:jt,afterFooter:jt};function lt(e,t,n,i){const s=e[t].call(n,i);return typeof s>"u"?uc[t].call(n,i):s}class ua extends on{static positioners=Tn;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&n.options.animation&&i.animations,o=new Gl(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Gg(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,s=lt(i,"beforeTitle",this,t),o=lt(i,"title",this,t),r=lt(i,"afterTitle",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}getBeforeBody(t,n){return la(lt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,s=[];return F(t,o=>{const r={before:[],lines:[],after:[]},a=ca(i,o);Dt(r.before,Ut(lt(a,"beforeLabel",this,o))),Dt(r.lines,lt(a,"label",this,o)),Dt(r.after,Ut(lt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,n){return la(lt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,s=lt(i,"beforeFooter",this,t),o=lt(i,"footer",this,t),r=lt(i,"afterFooter",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}_createItems(t){const n=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(jg(this.chart,n[l]));return t.filter&&(a=a.filter((u,f,d)=>t.filter(u,f,d,i))),t.itemSort&&(a=a.sort((u,f)=>t.itemSort(u,f,i))),F(a,u=>{const f=ca(t.callbacks,u);s.push(lt(f,"labelColor",this,u)),o.push(lt(f,"labelPointStyle",this,u)),r.push(lt(f,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,n){const i=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Tn[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const l=this._size=oa(this,i),c=Object.assign({},a,l),u=ra(this.chart,i,c),f=aa(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,s){const o=this.getCaretPosition(t,i,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,i){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:f}=On(a),{x:d,y:m}=t,{width:y,height:x}=n;let v,w,k,E,C,T;return o==="center"?(C=m+x/2,s==="left"?(v=d,w=v-r,E=C+r,T=C-r):(v=d+y,w=v+r,E=C-r,T=C+r),k=v):(s==="left"?w=d+Math.max(l,u)+r:s==="right"?w=d+y-Math.max(c,f)-r:w=this.caretX,o==="top"?(E=m,C=E-r,v=w-r,k=w+r):(E=m+x,C=E+r,v=w+r,k=w-r),T=E),{x1:v,x2:w,x3:k,y1:E,y2:C,y3:T}}drawTitle(t,n,i){const s=this.title,o=s.length;let r,a,l;if(o){const c=Ge(i.rtl,this.x,this.width);for(t.x=fi(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",r=ht(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=r.string,l=0;l<o;++l)n.fillText(s[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,n,i,s,o){const r=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,u=ht(o.bodyFont),f=fi(this,"left",o),d=s.x(f),m=l<u.lineHeight?(u.lineHeight-l)/2:0,y=n.y+m;if(o.usePointStyle){const x={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},v=s.leftForLtr(d,c)+c/2,w=y+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Vs(t,x,v,w),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Vs(t,x,v,w)}else{t.lineWidth=V(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const x=s.leftForLtr(d,c),v=s.leftForLtr(s.xPlus(d,1),c-2),w=On(r.borderRadius);Object.values(w).some(k=>k!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Bs(t,{x,y,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Bs(t,{x:v,y:y+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(x,y,c,l),t.strokeRect(x,y,c,l),t.fillStyle=r.backgroundColor,t.fillRect(v,y+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,f=ht(i.bodyFont);let d=f.lineHeight,m=0;const y=Ge(i.rtl,this.x,this.width),x=function(O){n.fillText(O,y.x(t.x+m),t.y+d/2),t.y+=d+o},v=y.textAlign(r);let w,k,E,C,T,D,P;for(n.textAlign=r,n.textBaseline="middle",n.font=f.string,t.x=fi(this,v,i),n.fillStyle=i.bodyColor,F(this.beforeBody,x),m=a&&v!=="right"?r==="center"?c/2+u:c+2+u:0,C=0,D=s.length;C<D;++C){for(w=s[C],k=this.labelTextColors[C],n.fillStyle=k,F(w.before,x),E=w.lines,a&&E.length&&(this._drawColorBox(n,t,C,y,i),d=Math.max(f.lineHeight,l)),T=0,P=E.length;T<P;++T)x(E[T]),d=f.lineHeight;F(w.after,x)}m=0,d=f.lineHeight,F(this.afterBody,x),t.y-=o}drawFooter(t,n,i){const s=this.footer,o=s.length;let r,a;if(o){const l=Ge(i.rtl,this.x,this.width);for(t.x=fi(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=l.textAlign(i.footerAlign),n.textBaseline="middle",r=ht(i.footerFont),n.fillStyle=i.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(s[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+i.footerSpacing}}drawBackground(t,n,i,s){const{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:u}=i,{topLeft:f,topRight:d,bottomLeft:m,bottomRight:y}=On(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+f,l),r==="top"&&this.drawCaret(t,n,i,s),n.lineTo(a+c-d,l),n.quadraticCurveTo(a+c,l,a+c,l+d),r==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(a+c,l+u-y),n.quadraticCurveTo(a+c,l+u,a+c-y,l+u),r==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(a+m,l+u),n.quadraticCurveTo(a,l+u,a,l+u-m),r==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(a,l+f),n.quadraticCurveTo(a,l,a+f,l),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const r=Tn[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=oa(this,t),l=Object.assign({},r,this._size),c=ra(n,t,l),u=aa(t,l,c,n);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=Mt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,n),Yl(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),Xl(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Mi(i,s),r=this._positionChanged(s,n);(o||r)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,n,i),a=this._positionChanged(r,t),l=n||!Mi(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,n){const{caretX:i,caretY:s,options:o}=this,r=Tn[o.position].call(this,t,n);return r!==!1&&(i!==r.x||s!==r.y)}}var Kg={id:"tooltip",_element:ua,positioners:Tn,afterInit(e,t,n){n&&(e.tooltip=new ua({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:uc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Zg=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Qg(e,t,n,i){const s=e.indexOf(t);if(s===-1)return Zg(e,t,n,i);const o=e.lastIndexOf(t);return s!==o?n:s}const Jg=(e,t)=>e===null?null:xt(Math.round(e),0,t);function ha(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class tm extends rn{static id="category";static defaults={ticks:{callback:ha}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const i=this.getLabels();for(const{index:s,label:o}of n)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(B(t))return null;const i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:Qg(i,t,R(n,t),this._addedLabels),Jg(n,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),n||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,n=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=t;r<=n;r++)s.push({value:r});return s}getLabelForValue(t){return ha.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function em(e,t){const n=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:d}=e,m=o||1,y=u-1,{min:x,max:v}=t,w=!B(r),k=!B(a),E=!B(c),C=(v-x)/(f+1);let T=gr((v-x)/y/m)*m,D,P,O,A;if(T<1e-14&&!w&&!k)return[{value:x},{value:v}];A=Math.ceil(v/T)-Math.floor(x/T),A>y&&(T=gr(A*T/y/m)*m),B(l)||(D=Math.pow(10,l),T=Math.ceil(T*D)/D),s==="ticks"?(P=Math.floor(x/T)*T,O=Math.ceil(v/T)*T):(P=x,O=v),w&&k&&o&&zf((a-r)/o,T/1e3)?(A=Math.round(Math.min((a-r)/T,u)),T=(a-r)/A,P=r,O=a):E?(P=w?r:P,O=k?a:O,A=c-1,T=(O-P)/A):(A=(O-P)/T,Ie(A,Math.round(A),T/1e3)?A=Math.round(A):A=Math.ceil(A));const z=Math.max(mr(T),mr(P));D=Math.pow(10,B(l)?z:l),P=Math.round(P*D)/D,O=Math.round(O*D)/D;let L=0;for(w&&(d&&P!==r?(n.push({value:r}),P<r&&L++,Ie(Math.round((P+L*T)*D)/D,r,fa(r,C,e))&&L++):P<r&&L++);L<A;++L){const H=Math.round((P+L*T)*D)/D;if(k&&H>a)break;n.push({value:H})}return k&&d&&O!==a?n.length&&Ie(n[n.length-1].value,a,fa(a,C,e))?n[n.length-1].value=a:n.push({value:a}):(!k||O===a)&&n.push({value:O}),n}function fa(e,t,{horizontal:n,minRotation:i}){const s=Pe(i),o=(n?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}class nm extends rn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return B(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=n?s:l,a=l=>o=i?o:l;if(t){const l=he(s),c=he(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(\`scales.\${this.id}.ticks.stepSize: \${i} would result generating up to \${s} ticks. Limiting to 1000.\`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,r=em(s,o);return t.bounds==="ticks"&&Hf(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-n)/Math.max(t.length-1,1)/2;n-=s,i+=s}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return Fl(t,this.chart.options.locale,this.options.ticks.format)}}class im extends nm{static id="linear";static defaults={ticks:{callback:zl.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=vt(t)?t:0,this.max=vt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=Pe(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Wi={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ut=Object.keys(Wi);function da(e,t){return e-t}function pa(e,t){if(B(t))return null;const n=e._adapter,{parser:i,round:s,isoWeekday:o}=e._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),vt(r)||(r=typeof i=="string"?n.parse(r,i):n.parse(r)),r===null?null:(s&&(r=s==="week"&&(Rn(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,s)),+r)}function ga(e,t,n,i){const s=ut.length;for(let o=ut.indexOf(e);o<s-1;++o){const r=Wi[ut[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=i)return ut[o]}return ut[s-1]}function sm(e,t,n,i,s){for(let o=ut.length-1;o>=ut.indexOf(n);o--){const r=ut[o];if(Wi[r].common&&e._adapter.diff(s,i,r)>=t-1)return r}return ut[n?ut.indexOf(n):0]}function om(e){for(let t=ut.indexOf(e)+1,n=ut.length;t<n;++t)if(Wi[ut[t]].common)return ut[t]}function ma(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:i,hi:s}=xo(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function rm(e,t,n,i){const s=e._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,i))l=n[a],l>=0&&(t[l].major=!0);return t}function ba(e,t,n){const i=[],s={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],s[a]=r,i.push({value:a,major:!1});return o===0||!n?i:rm(e,i,s,n)}class xa extends rn{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const i=t.time||(t.time={}),s=this._adapter=new bp._date(t.adapters.date);s.init(n),Mn(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:pa(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=vt(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=vt(o)&&!isNaN(o)?o:+n.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],i=t[t.length-1]),{min:n,max:i}}buildTicks(){const t=this.options,n=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,r=this.max,a=Uf(s,o,r);return this._unit=n.unit||(i.autoSkip?ga(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):sm(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:om(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),ba(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;n=xt(n,0,r),i=xt(i,0,r),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||ga(o.minUnit,n,i,this._getLabelCapacity(n)),a=R(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=Rn(l)||l===!0,u={};let f=n,d,m;if(c&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,c?"day":r),t.diff(i,n,r)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+r);const y=s.ticks.source==="data"&&this.getDataTimestamps();for(d=f,m=0;d<i;d=+t.add(d,a,r),m++)ma(u,d,y);return(d===i||s.bounds==="ticks"||m===1)&&ma(u,d,y),Object.keys(u).sort(da).map(x=>+x)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,r=n||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,n,i,s){const o=this.options,r=o.ticks.callback;if(r)return I(r,[t,n,i],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],f=c&&a[c],d=i[n],m=c&&f&&d&&d.major;return this._adapter.format(t,s||(m?f:u))}generateTickLabels(t){let n,i,s;for(n=0,i=t.length;n<i;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+i)*n.factor)}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,i=this.ctx.measureText(t).width,s=Pe(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),r=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*o+a*r,h:i*r+a*o}}_getLabelCapacity(t){const n=this.options.time,i=n.displayFormats,s=i[n.unit]||i.millisecond,o=this._tickFormatFunction(t,0,ba(this,[t],this._majorUnit),s),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,i=s.length;n<i;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,i;if(t.length)return t;const s=this.getLabels();for(n=0,i=s.length;n<i;++n)t.push(pa(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Xf(t.sort(da))}}function di(e,t,n){let i=0,s=e.length-1,o,r,a,l;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=De(e,"pos",t)),{pos:o,time:a}=e[i],{pos:r,time:l}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=De(e,"time",t)),{time:o,pos:a}=e[i],{time:r,pos:l}=e[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class gb extends xa{static id="timeseries";static defaults=xa.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=di(n,this.min),this._tableRange=di(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,s=[],o=[];let r,a,l,c,u;for(r=0,a=t.length;r<a;++r)c=t[r],c>=n&&c<=i&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(r=0,a=s.length;r<a;++r)u=s[r+1],l=s[r-1],c=s[r],Math.round((u+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,n=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(n)||i.length===1)&&i.push(n),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(di(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return di(this._table,i*this._tableRange+this._minPos,!0)}}function am(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var us={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
9765
|
+
\`):e}function Gg(e,t){const{element:n,datasetIndex:i,index:s}=t,o=e.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:e,label:r,parsed:o.getParsed(s),raw:e.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:n}}function aa(e,t){const n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:r,boxHeight:a}=t,l=ht(t.bodyFont),c=ht(t.titleFont),u=ht(t.footerFont),f=o.length,d=s.length,m=i.length,x=Mt(t.padding);let y=x.height,v=0,w=i.reduce((O,T)=>O+T.before.length+T.lines.length+T.after.length,0);if(w+=e.beforeBody.length+e.afterBody.length,f&&(y+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),w){const O=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=m*O+(w-m)*l.lineHeight+(w-1)*t.bodySpacing}d&&(y+=t.footerMarginTop+d*u.lineHeight+(d-1)*t.footerSpacing);let k=0;const C=function(O){v=Math.max(v,n.measureText(O).width+k)};return n.save(),n.font=c.string,F(e.title,C),n.font=l.string,F(e.beforeBody.concat(e.afterBody),C),k=t.displayColors?r+2+t.boxPadding:0,F(i,O=>{F(O.before,C),F(O.lines,C),F(O.after,C)}),k=0,n.font=u.string,F(e.footer,C),n.restore(),v+=x.width,{width:v,height:y}}function Kg(e,t){const{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function Zg(e,t,n,i){const{x:s,width:o}=i,r=n.caretSize+n.caretPadding;if(e==="left"&&s+o+r>t.width||e==="right"&&s-o-r<0)return!0}function Qg(e,t,n,i){const{x:s,width:o}=n,{width:r,chartArea:{left:a,right:l}}=e;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),Zg(c,e,t,n)&&(c="center"),c}function la(e,t,n){const i=n.yAlign||t.yAlign||Kg(e,n);return{xAlign:n.xAlign||t.xAlign||Qg(e,t,n,i),yAlign:i}}function Jg(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function tm(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function ca(e,t,n,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:u,topRight:f,bottomLeft:d,bottomRight:m}=Pn(r);let x=Jg(t,a);const y=tm(t,l,c);return l==="center"?a==="left"?x+=c:a==="right"&&(x-=c):a==="left"?x-=Math.max(u,d)+s:a==="right"&&(x+=Math.max(f,m)+s),{x:yt(x,0,i.width-t.width),y:yt(y,0,i.height-t.height)}}function di(e,t,n){const i=Mt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function ua(e){return Dt([],Ut(e))}function em(e,t,n){return je(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function ha(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const fc={beforeTitle:jt,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return n[t.dataIndex]}return""},afterTitle:jt,beforeBody:jt,beforeLabel:jt,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return B(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:jt,afterBody:jt,beforeFooter:jt,footer:jt,afterFooter:jt};function lt(e,t,n,i){const s=e[t].call(n,i);return typeof s>"u"?fc[t].call(n,i):s}class fa extends on{static positioners=Mn;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&n.options.animation&&i.animations,o=new Zl(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=em(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,s=lt(i,"beforeTitle",this,t),o=lt(i,"title",this,t),r=lt(i,"afterTitle",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}getBeforeBody(t,n){return ua(lt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,s=[];return F(t,o=>{const r={before:[],lines:[],after:[]},a=ha(i,o);Dt(r.before,Ut(lt(a,"beforeLabel",this,o))),Dt(r.lines,lt(a,"label",this,o)),Dt(r.after,Ut(lt(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,n){return ua(lt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,s=lt(i,"beforeFooter",this,t),o=lt(i,"footer",this,t),r=lt(i,"afterFooter",this,t);let a=[];return a=Dt(a,Ut(s)),a=Dt(a,Ut(o)),a=Dt(a,Ut(r)),a}_createItems(t){const n=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(Gg(this.chart,n[l]));return t.filter&&(a=a.filter((u,f,d)=>t.filter(u,f,d,i))),t.itemSort&&(a=a.sort((u,f)=>t.itemSort(u,f,i))),F(a,u=>{const f=ha(t.callbacks,u);s.push(lt(f,"labelColor",this,u)),o.push(lt(f,"labelPointStyle",this,u)),r.push(lt(f,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,n){const i=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Mn[i.position].call(this,s,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const l=this._size=aa(this,i),c=Object.assign({},a,l),u=la(this.chart,i,c),f=ca(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,s){const o=this.getCaretPosition(t,i,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,i){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:f}=Pn(a),{x:d,y:m}=t,{width:x,height:y}=n;let v,w,k,C,O,T;return o==="center"?(O=m+y/2,s==="left"?(v=d,w=v-r,C=O+r,T=O-r):(v=d+x,w=v+r,C=O-r,T=O+r),k=v):(s==="left"?w=d+Math.max(l,u)+r:s==="right"?w=d+x-Math.max(c,f)-r:w=this.caretX,o==="top"?(C=m,O=C-r,v=w-r,k=w+r):(C=m+y,O=C+r,v=w+r,k=w-r),T=C),{x1:v,x2:w,x3:k,y1:C,y2:O,y3:T}}drawTitle(t,n,i){const s=this.title,o=s.length;let r,a,l;if(o){const c=Qe(i.rtl,this.x,this.width);for(t.x=di(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",r=ht(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=r.string,l=0;l<o;++l)n.fillText(s[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,n,i,s,o){const r=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,u=ht(o.bodyFont),f=di(this,"left",o),d=s.x(f),m=l<u.lineHeight?(u.lineHeight-l)/2:0,x=n.y+m;if(o.usePointStyle){const y={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},v=s.leftForLtr(d,c)+c/2,w=x+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Ws(t,y,v,w),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Ws(t,y,v,w)}else{t.lineWidth=V(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const y=s.leftForLtr(d,c),v=s.leftForLtr(s.xPlus(d,1),c-2),w=Pn(r.borderRadius);Object.values(w).some(k=>k!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,js(t,{x:y,y:x,w:c,h:l,radius:w}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),js(t,{x:v,y:x+1,w:c-2,h:l-2,radius:w}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(y,x,c,l),t.strokeRect(y,x,c,l),t.fillStyle=r.backgroundColor,t.fillRect(v,x+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,f=ht(i.bodyFont);let d=f.lineHeight,m=0;const x=Qe(i.rtl,this.x,this.width),y=function(E){n.fillText(E,x.x(t.x+m),t.y+d/2),t.y+=d+o},v=x.textAlign(r);let w,k,C,O,T,D,P;for(n.textAlign=r,n.textBaseline="middle",n.font=f.string,t.x=di(this,v,i),n.fillStyle=i.bodyColor,F(this.beforeBody,y),m=a&&v!=="right"?r==="center"?c/2+u:c+2+u:0,O=0,D=s.length;O<D;++O){for(w=s[O],k=this.labelTextColors[O],n.fillStyle=k,F(w.before,y),C=w.lines,a&&C.length&&(this._drawColorBox(n,t,O,x,i),d=Math.max(f.lineHeight,l)),T=0,P=C.length;T<P;++T)y(C[T]),d=f.lineHeight;F(w.after,y)}m=0,d=f.lineHeight,F(this.afterBody,y),t.y-=o}drawFooter(t,n,i){const s=this.footer,o=s.length;let r,a;if(o){const l=Qe(i.rtl,this.x,this.width);for(t.x=di(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=l.textAlign(i.footerAlign),n.textBaseline="middle",r=ht(i.footerFont),n.fillStyle=i.footerColor,n.font=r.string,a=0;a<o;++a)n.fillText(s[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+i.footerSpacing}}drawBackground(t,n,i,s){const{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:u}=i,{topLeft:f,topRight:d,bottomLeft:m,bottomRight:x}=Pn(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+f,l),r==="top"&&this.drawCaret(t,n,i,s),n.lineTo(a+c-d,l),n.quadraticCurveTo(a+c,l,a+c,l+d),r==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(a+c,l+u-x),n.quadraticCurveTo(a+c,l+u,a+c-x,l+u),r==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(a+m,l+u),n.quadraticCurveTo(a,l+u,a,l+u-m),r==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(a,l+f),n.quadraticCurveTo(a,l,a+f,l),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const r=Mn[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=aa(this,t),l=Object.assign({},r,this._size),c=la(n,t,l),u=ca(t,l,c,n);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=Mt(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,n),ql(t,n.textDirection),o.y+=r.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),Gl(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Mi(i,s),r=this._positionChanged(s,n);(o||r)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,n,i),a=this._positionChanged(r,t),l=n||!Mi(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,n){const{caretX:i,caretY:s,options:o}=this,r=Mn[o.position].call(this,t,n);return r!==!1&&(i!==r.x||s!==r.y)}}var nm={id:"tooltip",_element:fa,positioners:Mn,afterInit(e,t,n){n&&(e.tooltip=new fa({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:fc},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const im=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function sm(e,t,n,i){const s=e.indexOf(t);if(s===-1)return im(e,t,n,i);const o=e.lastIndexOf(t);return s!==o?n:s}const om=(e,t)=>e===null?null:yt(Math.round(e),0,t);function da(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class rm extends rn{static id="category";static defaults={ticks:{callback:da}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const i=this.getLabels();for(const{index:s,label:o}of n)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(B(t))return null;const i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:sm(i,t,N(n,t),this._addedLabels),om(n,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),n||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,n=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=t;r<=n;r++)s.push({value:r});return s}getLabelForValue(t){return da.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function am(e,t){const n=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:d}=e,m=o||1,x=u-1,{min:y,max:v}=t,w=!B(r),k=!B(a),C=!B(c),O=(v-y)/(f+1);let T=br((v-y)/x/m)*m,D,P,E,A;if(T<1e-14&&!w&&!k)return[{value:y},{value:v}];A=Math.ceil(v/T)-Math.floor(y/T),A>x&&(T=br(A*T/x/m)*m),B(l)||(D=Math.pow(10,l),T=Math.ceil(T*D)/D),s==="ticks"?(P=Math.floor(y/T)*T,E=Math.ceil(v/T)*T):(P=y,E=v),w&&k&&o&&$f((a-r)/o,T/1e3)?(A=Math.round(Math.min((a-r)/T,u)),T=(a-r)/A,P=r,E=a):C?(P=w?r:P,E=k?a:E,A=c-1,T=(E-P)/A):(A=(E-P)/T,Ne(A,Math.round(A),T/1e3)?A=Math.round(A):A=Math.ceil(A));const z=Math.max(yr(T),yr(P));D=Math.pow(10,B(l)?z:l),P=Math.round(P*D)/D,E=Math.round(E*D)/D;let L=0;for(w&&(d&&P!==r?(n.push({value:r}),P<r&&L++,Ne(Math.round((P+L*T)*D)/D,r,pa(r,O,e))&&L++):P<r&&L++);L<A;++L){const H=Math.round((P+L*T)*D)/D;if(k&&H>a)break;n.push({value:H})}return k&&d&&E!==a?n.length&&Ne(n[n.length-1].value,a,pa(a,O,e))?n[n.length-1].value=a:n.push({value:a}):(!k||E===a)&&n.push({value:E}),n}function pa(e,t,{horizontal:n,minRotation:i}){const s=Ae(i),o=(n?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+e).length;return Math.min(t/o,r)}class lm extends rn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return B(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=n?s:l,a=l=>o=i?o:l;if(t){const l=fe(s),c=fe(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(\`scales.\${this.id}.ticks.stepSize: \${i} would result generating up to \${s} ticks. Limiting to 1000.\`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,r=am(s,o);return t.bounds==="ticks"&&Uf(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-n)/Math.max(t.length-1,1)/2;n-=s,i+=s}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return Hl(t,this.chart.options.locale,this.options.ticks.format)}}class cm extends lm{static id="linear";static defaults={ticks:{callback:Vl.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=vt(t)?t:0,this.max=vt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=Ae(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const $i={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ut=Object.keys($i);function ga(e,t){return e-t}function ma(e,t){if(B(t))return null;const n=e._adapter,{parser:i,round:s,isoWeekday:o}=e._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),vt(r)||(r=typeof i=="string"?n.parse(r,i):n.parse(r)),r===null?null:(s&&(r=s==="week"&&(Rn(o)||o===!0)?n.startOf(r,"isoWeek",o):n.startOf(r,s)),+r)}function ba(e,t,n,i){const s=ut.length;for(let o=ut.indexOf(e);o<s-1;++o){const r=$i[ut[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((n-t)/(a*r.size))<=i)return ut[o]}return ut[s-1]}function um(e,t,n,i,s){for(let o=ut.length-1;o>=ut.indexOf(n);o--){const r=ut[o];if($i[r].common&&e._adapter.diff(s,i,r)>=t-1)return r}return ut[n?ut.indexOf(n):0]}function hm(e){for(let t=ut.indexOf(e)+1,n=ut.length;t<n;++t)if($i[ut[t]].common)return ut[t]}function ya(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:i,hi:s}=vo(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function fm(e,t,n,i){const s=e._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,i))l=n[a],l>=0&&(t[l].major=!0);return t}function xa(e,t,n){const i=[],s={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],s[a]=r,i.push({value:a,major:!1});return o===0||!n?i:fm(e,i,s,n)}class va extends rn{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const i=t.time||(t.time={}),s=this._adapter=new Sp._date(t.adapters.date);s.init(n),En(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:ma(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=vt(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=vt(o)&&!isNaN(o)?o:+n.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],i=t[t.length-1]),{min:n,max:i}}buildTicks(){const t=this.options,n=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,r=this.max,a=Zf(s,o,r);return this._unit=n.unit||(i.autoSkip?ba(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):um(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:hm(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),xa(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;n=yt(n,0,r),i=yt(i,0,r),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||ba(o.minUnit,n,i,this._getLabelCapacity(n)),a=N(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=Rn(l)||l===!0,u={};let f=n,d,m;if(c&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,c?"day":r),t.diff(i,n,r)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+r);const x=s.ticks.source==="data"&&this.getDataTimestamps();for(d=f,m=0;d<i;d=+t.add(d,a,r),m++)ya(u,d,x);return(d===i||s.bounds==="ticks"||m===1)&&ya(u,d,x),Object.keys(u).sort(ga).map(y=>+y)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,r=n||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,n,i,s){const o=this.options,r=o.ticks.callback;if(r)return I(r,[t,n,i],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],f=c&&a[c],d=i[n],m=c&&f&&d&&d.major;return this._adapter.format(t,s||(m?f:u))}generateTickLabels(t){let n,i,s;for(n=0,i=t.length;n<i;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+i)*n.factor)}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,i=this.ctx.measureText(t).width,s=Ae(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),r=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*o+a*r,h:i*r+a*o}}_getLabelCapacity(t){const n=this.options.time,i=n.displayFormats,s=i[n.unit]||i.millisecond,o=this._tickFormatFunction(t,0,xa(this,[t],this._majorUnit),s),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,i=s.length;n<i;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,i;if(t.length)return t;const s=this.getLabels();for(n=0,i=s.length;n<i;++n)t.push(ma(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Jf(t.sort(ga))}}function pi(e,t,n){let i=0,s=e.length-1,o,r,a,l;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=Ie(e,"pos",t)),{pos:o,time:a}=e[i],{pos:r,time:l}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=Ie(e,"time",t)),{time:o,pos:a}=e[i],{time:r,pos:l}=e[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class _b extends va{static id="timeseries";static defaults=va.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=pi(n,this.min),this._tableRange=pi(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,s=[],o=[];let r,a,l,c,u;for(r=0,a=t.length;r<a;++r)c=t[r],c>=n&&c<=i&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(r=0,a=s.length;r<a;++r)u=s[r+1],l=s[r-1],c=s[r],Math.round((u+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,n=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(n)||i.length===1)&&i.push(n),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(pi(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return pi(this._table,i*this._tableRange+this._minPos,!0)}}function dm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fs={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
9144
9766
|
* http://hammerjs.github.io/
|
|
9145
9767
|
*
|
|
9146
9768
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
9147
|
-
* Licensed under the MIT license */var
|
|
9769
|
+
* Licensed under the MIT license */var _a;function pm(){return _a||(_a=1,(function(e){(function(t,n,i,s){var o=["","webkit","Moz","MS","ms","o"],r=n.createElement("div"),a="function",l=Math.round,c=Math.abs,u=Date.now;function f(h,p,b){return setTimeout(C(h,b),p)}function d(h,p,b){return Array.isArray(h)?(m(h,b[p],b),!0):!1}function m(h,p,b){var _;if(h)if(h.forEach)h.forEach(p,b);else if(h.length!==s)for(_=0;_<h.length;)p.call(b,h[_],_,h),_++;else for(_ in h)h.hasOwnProperty(_)&&p.call(b,h[_],_,h)}function x(h,p,b){var _="DEPRECATED METHOD: "+p+\`
|
|
9148
9770
|
\`+b+\` AT
|
|
9149
|
-
\`;return function(){var S=new Error("get-stack-trace"),M=S&&S.stack?S.stack.replace(/^[^\\(]+?[\\n$]/gm,"").replace(/^\\s+at\\s+/gm,"").replace(/^Object.<anonymous>\\s*\\(/gm,"{anonymous}()@"):"Unknown Stack Trace",N=t.console&&(t.console.warn||t.console.log);return N&&N.call(t.console,_,M),h.apply(this,arguments)}}var x;typeof Object.assign!="function"?x=function(p){if(p===s||p===null)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(p),_=1;_<arguments.length;_++){var S=arguments[_];if(S!==s&&S!==null)for(var M in S)S.hasOwnProperty(M)&&(b[M]=S[M])}return b}:x=Object.assign;var v=y(function(p,b,_){for(var S=Object.keys(b),M=0;M<S.length;)(!_||_&&p[S[M]]===s)&&(p[S[M]]=b[S[M]]),M++;return p},"extend","Use \`assign\`."),w=y(function(p,b){return v(p,b,!0)},"merge","Use \`assign\`.");function k(h,p,b){var _=p.prototype,S;S=h.prototype=Object.create(_),S.constructor=h,S._super=_,b&&x(S,b)}function E(h,p){return function(){return h.apply(p,arguments)}}function C(h,p){return typeof h==a?h.apply(p&&p[0]||s,p):h}function T(h,p){return h===s?p:h}function D(h,p,b){m(z(p),function(_){h.addEventListener(_,b,!1)})}function P(h,p,b){m(z(p),function(_){h.removeEventListener(_,b,!1)})}function O(h,p){for(;h;){if(h==p)return!0;h=h.parentNode}return!1}function A(h,p){return h.indexOf(p)>-1}function z(h){return h.trim().split(/\\s+/g)}function L(h,p,b){if(h.indexOf&&!b)return h.indexOf(p);for(var _=0;_<h.length;){if(b&&h[_][b]==p||!b&&h[_]===p)return _;_++}return-1}function H(h){return Array.prototype.slice.call(h,0)}function Z(h,p,b){for(var _=[],S=[],M=0;M<h.length;){var N=h[M][p];L(S,N)<0&&_.push(h[M]),S[M]=N,M++}return _=_.sort(function(Q,ot){return Q[p]>ot[p]}),_}function nt(h,p){for(var b,_,S=p[0].toUpperCase()+p.slice(1),M=0;M<o.length;){if(b=o[M],_=b?b+S:p,_ in h)return _;M++}return s}var j=1;function q(){return j++}function it(h){var p=h.ownerDocument||h;return p.defaultView||p.parentWindow||t}var We=/mobile|tablet|ip(ad|hone|od)|android/i,be="ontouchstart"in t,Gt=nt(t,"PointerEvent")!==s,je=be&&We.test(navigator.userAgent),dt="touch",xe="pen",wt="mouse",ye="kinect",Vt=25,st=1,ve=2,X=4,at=8,Wn=1,ln=2,cn=4,un=8,hn=16,Et=ln|cn,_e=un|hn,Po=Et|_e,Do=["x","y"],jn=["clientX","clientY"];function pt(h,p){var b=this;this.manager=h,this.callback=p,this.element=h.element,this.target=h.options.inputTarget,this.domHandler=function(_){C(h.options.enable,[h])&&b.handler(_)},this.init()}pt.prototype={handler:function(){},init:function(){this.evEl&&D(this.element,this.evEl,this.domHandler),this.evTarget&&D(this.target,this.evTarget,this.domHandler),this.evWin&&D(it(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(it(this.element),this.evWin,this.domHandler)}};function Cc(h){var p,b=h.options.inputClass;return b?p=b:Gt?p=$i:je?p=Yn:be?p=Ui:p=Un,new p(h,Oc)}function Oc(h,p,b){var _=b.pointers.length,S=b.changedPointers.length,M=p&st&&_-S===0,N=p&(X|at)&&_-S===0;b.isFirst=!!M,b.isFinal=!!N,M&&(h.session={}),b.eventType=p,Pc(h,b),h.emit("hammer.input",b),h.recognize(b),h.session.prevInput=b}function Pc(h,p){var b=h.session,_=p.pointers,S=_.length;b.firstInput||(b.firstInput=Ao(p)),S>1&&!b.firstMultiple?b.firstMultiple=Ao(p):S===1&&(b.firstMultiple=!1);var M=b.firstInput,N=b.firstMultiple,K=N?N.center:M.center,Q=p.center=Io(_);p.timeStamp=u(),p.deltaTime=p.timeStamp-M.timeStamp,p.angle=ji(K,Q),p.distance=$n(K,Q),Dc(b,p),p.offsetDirection=Ro(p.deltaX,p.deltaY);var ot=Lo(p.deltaTime,p.deltaX,p.deltaY);p.overallVelocityX=ot.x,p.overallVelocityY=ot.y,p.overallVelocity=c(ot.x)>c(ot.y)?ot.x:ot.y,p.scale=N?Lc(N.pointers,_):1,p.rotation=N?Ic(N.pointers,_):0,p.maxPointers=b.prevInput?p.pointers.length>b.prevInput.maxPointers?p.pointers.length:b.prevInput.maxPointers:p.pointers.length,Ac(b,p);var Ot=h.element;O(p.srcEvent.target,Ot)&&(Ot=p.srcEvent.target),p.target=Ot}function Dc(h,p){var b=p.center,_=h.offsetDelta||{},S=h.prevDelta||{},M=h.prevInput||{};(p.eventType===st||M.eventType===X)&&(S=h.prevDelta={x:M.deltaX||0,y:M.deltaY||0},_=h.offsetDelta={x:b.x,y:b.y}),p.deltaX=S.x+(b.x-_.x),p.deltaY=S.y+(b.y-_.y)}function Ac(h,p){var b=h.lastInterval||p,_=p.timeStamp-b.timeStamp,S,M,N,K;if(p.eventType!=at&&(_>Vt||b.velocity===s)){var Q=p.deltaX-b.deltaX,ot=p.deltaY-b.deltaY,Ot=Lo(_,Q,ot);M=Ot.x,N=Ot.y,S=c(Ot.x)>c(Ot.y)?Ot.x:Ot.y,K=Ro(Q,ot),h.lastInterval=p}else S=b.velocity,M=b.velocityX,N=b.velocityY,K=b.direction;p.velocity=S,p.velocityX=M,p.velocityY=N,p.direction=K}function Ao(h){for(var p=[],b=0;b<h.pointers.length;)p[b]={clientX:l(h.pointers[b].clientX),clientY:l(h.pointers[b].clientY)},b++;return{timeStamp:u(),pointers:p,center:Io(p),deltaX:h.deltaX,deltaY:h.deltaY}}function Io(h){var p=h.length;if(p===1)return{x:l(h[0].clientX),y:l(h[0].clientY)};for(var b=0,_=0,S=0;S<p;)b+=h[S].clientX,_+=h[S].clientY,S++;return{x:l(b/p),y:l(_/p)}}function Lo(h,p,b){return{x:p/h||0,y:b/h||0}}function Ro(h,p){return h===p?Wn:c(h)>=c(p)?h<0?ln:cn:p<0?un:hn}function $n(h,p,b){b||(b=Do);var _=p[b[0]]-h[b[0]],S=p[b[1]]-h[b[1]];return Math.sqrt(_*_+S*S)}function ji(h,p,b){b||(b=Do);var _=p[b[0]]-h[b[0]],S=p[b[1]]-h[b[1]];return Math.atan2(S,_)*180/Math.PI}function Ic(h,p){return ji(p[1],p[0],jn)+ji(h[1],h[0],jn)}function Lc(h,p){return $n(p[0],p[1],jn)/$n(h[0],h[1],jn)}var Rc={mousedown:st,mousemove:ve,mouseup:X},Nc="mousedown",Fc="mousemove mouseup";function Un(){this.evEl=Nc,this.evWin=Fc,this.pressed=!1,pt.apply(this,arguments)}k(Un,pt,{handler:function(p){var b=Rc[p.type];b&st&&p.button===0&&(this.pressed=!0),b&ve&&p.which!==1&&(b=X),this.pressed&&(b&X&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[p],changedPointers:[p],pointerType:wt,srcEvent:p}))}});var zc={pointerdown:st,pointermove:ve,pointerup:X,pointercancel:at,pointerout:at},Hc={2:dt,3:xe,4:wt,5:ye},No="pointerdown",Fo="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(No="MSPointerDown",Fo="MSPointerMove MSPointerUp MSPointerCancel");function $i(){this.evEl=No,this.evWin=Fo,pt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}k($i,pt,{handler:function(p){var b=this.store,_=!1,S=p.type.toLowerCase().replace("ms",""),M=zc[S],N=Hc[p.pointerType]||p.pointerType,K=N==dt,Q=L(b,p.pointerId,"pointerId");M&st&&(p.button===0||K)?Q<0&&(b.push(p),Q=b.length-1):M&(X|at)&&(_=!0),!(Q<0)&&(b[Q]=p,this.callback(this.manager,M,{pointers:b,changedPointers:[p],pointerType:N,srcEvent:p}),_&&b.splice(Q,1))}});var Vc={touchstart:st,touchmove:ve,touchend:X,touchcancel:at},Bc="touchstart",Wc="touchstart touchmove touchend touchcancel";function zo(){this.evTarget=Bc,this.evWin=Wc,this.started=!1,pt.apply(this,arguments)}k(zo,pt,{handler:function(p){var b=Vc[p.type];if(b===st&&(this.started=!0),!!this.started){var _=jc.call(this,p,b);b&(X|at)&&_[0].length-_[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:p})}}});function jc(h,p){var b=H(h.touches),_=H(h.changedTouches);return p&(X|at)&&(b=Z(b.concat(_),"identifier")),[b,_]}var $c={touchstart:st,touchmove:ve,touchend:X,touchcancel:at},Uc="touchstart touchmove touchend touchcancel";function Yn(){this.evTarget=Uc,this.targetIds={},pt.apply(this,arguments)}k(Yn,pt,{handler:function(p){var b=$c[p.type],_=Yc.call(this,p,b);_&&this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:p})}});function Yc(h,p){var b=H(h.touches),_=this.targetIds;if(p&(st|ve)&&b.length===1)return _[b[0].identifier]=!0,[b,b];var S,M,N=H(h.changedTouches),K=[],Q=this.target;if(M=b.filter(function(ot){return O(ot.target,Q)}),p===st)for(S=0;S<M.length;)_[M[S].identifier]=!0,S++;for(S=0;S<N.length;)_[N[S].identifier]&&K.push(N[S]),p&(X|at)&&delete _[N[S].identifier],S++;if(K.length)return[Z(M.concat(K),"identifier"),K]}var Xc=2500,Ho=25;function Ui(){pt.apply(this,arguments);var h=E(this.handler,this);this.touch=new Yn(this.manager,h),this.mouse=new Un(this.manager,h),this.primaryTouch=null,this.lastTouches=[]}k(Ui,pt,{handler:function(p,b,_){var S=_.pointerType==dt,M=_.pointerType==wt;if(!(M&&_.sourceCapabilities&&_.sourceCapabilities.firesTouchEvents)){if(S)qc.call(this,b,_);else if(M&&Gc.call(this,_))return;this.callback(p,b,_)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function qc(h,p){h&st?(this.primaryTouch=p.changedPointers[0].identifier,Vo.call(this,p)):h&(X|at)&&Vo.call(this,p)}function Vo(h){var p=h.changedPointers[0];if(p.identifier===this.primaryTouch){var b={x:p.clientX,y:p.clientY};this.lastTouches.push(b);var _=this.lastTouches,S=function(){var M=_.indexOf(b);M>-1&&_.splice(M,1)};setTimeout(S,Xc)}}function Gc(h){for(var p=h.srcEvent.clientX,b=h.srcEvent.clientY,_=0;_<this.lastTouches.length;_++){var S=this.lastTouches[_],M=Math.abs(p-S.x),N=Math.abs(b-S.y);if(M<=Ho&&N<=Ho)return!0}return!1}var Bo=nt(r.style,"touchAction"),Wo=Bo!==s,jo="compute",$o="auto",Yi="manipulation",we="none",fn="pan-x",dn="pan-y",Xn=Zc();function Xi(h,p){this.manager=h,this.set(p)}Xi.prototype={set:function(h){h==jo&&(h=this.compute()),Wo&&this.manager.element.style&&Xn[h]&&(this.manager.element.style[Bo]=h),this.actions=h.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var h=[];return m(this.manager.recognizers,function(p){C(p.options.enable,[p])&&(h=h.concat(p.getTouchAction()))}),Kc(h.join(" "))},preventDefaults:function(h){var p=h.srcEvent,b=h.offsetDirection;if(this.manager.session.prevented){p.preventDefault();return}var _=this.actions,S=A(_,we)&&!Xn[we],M=A(_,dn)&&!Xn[dn],N=A(_,fn)&&!Xn[fn];if(S){var K=h.pointers.length===1,Q=h.distance<2,ot=h.deltaTime<250;if(K&&Q&&ot)return}if(!(N&&M)&&(S||M&&b&Et||N&&b&_e))return this.preventSrc(p)},preventSrc:function(h){this.manager.session.prevented=!0,h.preventDefault()}};function Kc(h){if(A(h,we))return we;var p=A(h,fn),b=A(h,dn);return p&&b?we:p||b?p?fn:dn:A(h,Yi)?Yi:$o}function Zc(){if(!Wo)return!1;var h={},p=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(b){h[b]=p?t.CSS.supports("touch-action",b):!0}),h}var qn=1,gt=2,$e=4,Kt=8,Bt=Kt,pn=16,Ct=32;function Wt(h){this.options=x({},this.defaults,h||{}),this.id=q(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=qn,this.simultaneous={},this.requireFail=[]}Wt.prototype={defaults:{},set:function(h){return x(this.options,h),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(h){if(d(h,"recognizeWith",this))return this;var p=this.simultaneous;return h=Gn(h,this),p[h.id]||(p[h.id]=h,h.recognizeWith(this)),this},dropRecognizeWith:function(h){return d(h,"dropRecognizeWith",this)?this:(h=Gn(h,this),delete this.simultaneous[h.id],this)},requireFailure:function(h){if(d(h,"requireFailure",this))return this;var p=this.requireFail;return h=Gn(h,this),L(p,h)===-1&&(p.push(h),h.requireFailure(this)),this},dropRequireFailure:function(h){if(d(h,"dropRequireFailure",this))return this;h=Gn(h,this);var p=L(this.requireFail,h);return p>-1&&this.requireFail.splice(p,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(h){return!!this.simultaneous[h.id]},emit:function(h){var p=this,b=this.state;function _(S){p.manager.emit(S,h)}b<Kt&&_(p.options.event+Uo(b)),_(p.options.event),h.additionalEvent&&_(h.additionalEvent),b>=Kt&&_(p.options.event+Uo(b))},tryEmit:function(h){if(this.canEmit())return this.emit(h);this.state=Ct},canEmit:function(){for(var h=0;h<this.requireFail.length;){if(!(this.requireFail[h].state&(Ct|qn)))return!1;h++}return!0},recognize:function(h){var p=x({},h);if(!C(this.options.enable,[this,p])){this.reset(),this.state=Ct;return}this.state&(Bt|pn|Ct)&&(this.state=qn),this.state=this.process(p),this.state&(gt|$e|Kt|pn)&&this.tryEmit(p)},process:function(h){},getTouchAction:function(){},reset:function(){}};function Uo(h){return h&pn?"cancel":h&Kt?"end":h&$e?"move":h>?"start":""}function Yo(h){return h==hn?"down":h==un?"up":h==ln?"left":h==cn?"right":""}function Gn(h,p){var b=p.manager;return b?b.get(h):h}function St(){Wt.apply(this,arguments)}k(St,Wt,{defaults:{pointers:1},attrTest:function(h){var p=this.options.pointers;return p===0||h.pointers.length===p},process:function(h){var p=this.state,b=h.eventType,_=p&(gt|$e),S=this.attrTest(h);return _&&(b&at||!S)?p|pn:_||S?b&X?p|Kt:p>?p|$e:gt:Ct}});function Kn(){St.apply(this,arguments),this.pX=null,this.pY=null}k(Kn,St,{defaults:{event:"pan",threshold:10,pointers:1,direction:Po},getTouchAction:function(){var h=this.options.direction,p=[];return h&Et&&p.push(dn),h&_e&&p.push(fn),p},directionTest:function(h){var p=this.options,b=!0,_=h.distance,S=h.direction,M=h.deltaX,N=h.deltaY;return S&p.direction||(p.direction&Et?(S=M===0?Wn:M<0?ln:cn,b=M!=this.pX,_=Math.abs(h.deltaX)):(S=N===0?Wn:N<0?un:hn,b=N!=this.pY,_=Math.abs(h.deltaY))),h.direction=S,b&&_>p.threshold&&S&p.direction},attrTest:function(h){return St.prototype.attrTest.call(this,h)&&(this.state>||!(this.state>)&&this.directionTest(h))},emit:function(h){this.pX=h.deltaX,this.pY=h.deltaY;var p=Yo(h.direction);p&&(h.additionalEvent=this.options.event+p),this._super.emit.call(this,h)}});function qi(){St.apply(this,arguments)}k(qi,St,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[we]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.scale-1)>this.options.threshold||this.state>)},emit:function(h){if(h.scale!==1){var p=h.scale<1?"in":"out";h.additionalEvent=this.options.event+p}this._super.emit.call(this,h)}});function Gi(){Wt.apply(this,arguments),this._timer=null,this._input=null}k(Gi,Wt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[$o]},process:function(h){var p=this.options,b=h.pointers.length===p.pointers,_=h.distance<p.threshold,S=h.deltaTime>p.time;if(this._input=h,!_||!b||h.eventType&(X|at)&&!S)this.reset();else if(h.eventType&st)this.reset(),this._timer=f(function(){this.state=Bt,this.tryEmit()},p.time,this);else if(h.eventType&X)return Bt;return Ct},reset:function(){clearTimeout(this._timer)},emit:function(h){this.state===Bt&&(h&&h.eventType&X?this.manager.emit(this.options.event+"up",h):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}});function Ki(){St.apply(this,arguments)}k(Ki,St,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[we]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.rotation)>this.options.threshold||this.state>)}});function Zi(){St.apply(this,arguments)}k(Zi,St,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Et|_e,pointers:1},getTouchAction:function(){return Kn.prototype.getTouchAction.call(this)},attrTest:function(h){var p=this.options.direction,b;return p&(Et|_e)?b=h.overallVelocity:p&Et?b=h.overallVelocityX:p&_e&&(b=h.overallVelocityY),this._super.attrTest.call(this,h)&&p&h.offsetDirection&&h.distance>this.options.threshold&&h.maxPointers==this.options.pointers&&c(b)>this.options.velocity&&h.eventType&X},emit:function(h){var p=Yo(h.offsetDirection);p&&this.manager.emit(this.options.event+p,h),this.manager.emit(this.options.event,h)}});function Zn(){Wt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}k(Zn,Wt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Yi]},process:function(h){var p=this.options,b=h.pointers.length===p.pointers,_=h.distance<p.threshold,S=h.deltaTime<p.time;if(this.reset(),h.eventType&st&&this.count===0)return this.failTimeout();if(_&&S&&b){if(h.eventType!=X)return this.failTimeout();var M=this.pTime?h.timeStamp-this.pTime<p.interval:!0,N=!this.pCenter||$n(this.pCenter,h.center)<p.posThreshold;this.pTime=h.timeStamp,this.pCenter=h.center,!N||!M?this.count=1:this.count+=1,this._input=h;var K=this.count%p.taps;if(K===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=Bt,this.tryEmit()},p.interval,this),gt):Bt}return Ct},failTimeout:function(){return this._timer=f(function(){this.state=Ct},this.options.interval,this),Ct},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Bt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Zt(h,p){return p=p||{},p.recognizers=T(p.recognizers,Zt.defaults.preset),new Qi(h,p)}Zt.VERSION="2.0.7",Zt.defaults={domEvents:!1,touchAction:jo,enable:!0,inputTarget:null,inputClass:null,preset:[[Ki,{enable:!1}],[qi,{enable:!1},["rotate"]],[Zi,{direction:Et}],[Kn,{direction:Et},["swipe"]],[Zn],[Zn,{event:"doubletap",taps:2},["tap"]],[Gi]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Qc=1,Xo=2;function Qi(h,p){this.options=x({},Zt.defaults,p||{}),this.options.inputTarget=this.options.inputTarget||h,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=h,this.input=Cc(this),this.touchAction=new Xi(this,this.options.touchAction),qo(this,!0),m(this.options.recognizers,function(b){var _=this.add(new b[0](b[1]));b[2]&&_.recognizeWith(b[2]),b[3]&&_.requireFailure(b[3])},this)}Qi.prototype={set:function(h){return x(this.options,h),h.touchAction&&this.touchAction.update(),h.inputTarget&&(this.input.destroy(),this.input.target=h.inputTarget,this.input.init()),this},stop:function(h){this.session.stopped=h?Xo:Qc},recognize:function(h){var p=this.session;if(!p.stopped){this.touchAction.preventDefaults(h);var b,_=this.recognizers,S=p.curRecognizer;(!S||S&&S.state&Bt)&&(S=p.curRecognizer=null);for(var M=0;M<_.length;)b=_[M],p.stopped!==Xo&&(!S||b==S||b.canRecognizeWith(S))?b.recognize(h):b.reset(),!S&&b.state&(gt|$e|Kt)&&(S=p.curRecognizer=b),M++}},get:function(h){if(h instanceof Wt)return h;for(var p=this.recognizers,b=0;b<p.length;b++)if(p[b].options.event==h)return p[b];return null},add:function(h){if(d(h,"add",this))return this;var p=this.get(h.options.event);return p&&this.remove(p),this.recognizers.push(h),h.manager=this,this.touchAction.update(),h},remove:function(h){if(d(h,"remove",this))return this;if(h=this.get(h),h){var p=this.recognizers,b=L(p,h);b!==-1&&(p.splice(b,1),this.touchAction.update())}return this},on:function(h,p){if(h!==s&&p!==s){var b=this.handlers;return m(z(h),function(_){b[_]=b[_]||[],b[_].push(p)}),this}},off:function(h,p){if(h!==s){var b=this.handlers;return m(z(h),function(_){p?b[_]&&b[_].splice(L(b[_],p),1):delete b[_]}),this}},emit:function(h,p){this.options.domEvents&&Jc(h,p);var b=this.handlers[h]&&this.handlers[h].slice();if(!(!b||!b.length)){p.type=h,p.preventDefault=function(){p.srcEvent.preventDefault()};for(var _=0;_<b.length;)b[_](p),_++}},destroy:function(){this.element&&qo(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function qo(h,p){var b=h.element;if(b.style){var _;m(h.options.cssProps,function(S,M){_=nt(b.style,M),p?(h.oldCssProps[_]=b.style[_],b.style[_]=S):b.style[_]=h.oldCssProps[_]||""}),p||(h.oldCssProps={})}}function Jc(h,p){var b=n.createEvent("Event");b.initEvent(h,!0,!0),b.gesture=p,p.target.dispatchEvent(b)}x(Zt,{INPUT_START:st,INPUT_MOVE:ve,INPUT_END:X,INPUT_CANCEL:at,STATE_POSSIBLE:qn,STATE_BEGAN:gt,STATE_CHANGED:$e,STATE_ENDED:Kt,STATE_RECOGNIZED:Bt,STATE_CANCELLED:pn,STATE_FAILED:Ct,DIRECTION_NONE:Wn,DIRECTION_LEFT:ln,DIRECTION_RIGHT:cn,DIRECTION_UP:un,DIRECTION_DOWN:hn,DIRECTION_HORIZONTAL:Et,DIRECTION_VERTICAL:_e,DIRECTION_ALL:Po,Manager:Qi,Input:pt,TouchAction:Xi,TouchInput:Yn,MouseInput:Un,PointerEventInput:$i,TouchMouseInput:Ui,SingleTouchInput:zo,Recognizer:Wt,AttrRecognizer:St,Tap:Zn,Pan:Kn,Swipe:Zi,Pinch:qi,Rotate:Ki,Press:Gi,on:D,off:P,each:m,merge:w,extend:v,assign:x,inherit:k,bindFn:E,prefixed:nt});var tu=typeof t<"u"?t:typeof self<"u"?self:{};tu.Hammer=Zt,e.exports?e.exports=Zt:t[i]=Zt})(window,document,"Hammer")})(us)),us.exports}var cm=lm();const Pn=am(cm);/*!
|
|
9771
|
+
\`;return function(){var S=new Error("get-stack-trace"),M=S&&S.stack?S.stack.replace(/^[^\\(]+?[\\n$]/gm,"").replace(/^\\s+at\\s+/gm,"").replace(/^Object.<anonymous>\\s*\\(/gm,"{anonymous}()@"):"Unknown Stack Trace",R=t.console&&(t.console.warn||t.console.log);return R&&R.call(t.console,_,M),h.apply(this,arguments)}}var y;typeof Object.assign!="function"?y=function(p){if(p===s||p===null)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(p),_=1;_<arguments.length;_++){var S=arguments[_];if(S!==s&&S!==null)for(var M in S)S.hasOwnProperty(M)&&(b[M]=S[M])}return b}:y=Object.assign;var v=x(function(p,b,_){for(var S=Object.keys(b),M=0;M<S.length;)(!_||_&&p[S[M]]===s)&&(p[S[M]]=b[S[M]]),M++;return p},"extend","Use \`assign\`."),w=x(function(p,b){return v(p,b,!0)},"merge","Use \`assign\`.");function k(h,p,b){var _=p.prototype,S;S=h.prototype=Object.create(_),S.constructor=h,S._super=_,b&&y(S,b)}function C(h,p){return function(){return h.apply(p,arguments)}}function O(h,p){return typeof h==a?h.apply(p&&p[0]||s,p):h}function T(h,p){return h===s?p:h}function D(h,p,b){m(z(p),function(_){h.addEventListener(_,b,!1)})}function P(h,p,b){m(z(p),function(_){h.removeEventListener(_,b,!1)})}function E(h,p){for(;h;){if(h==p)return!0;h=h.parentNode}return!1}function A(h,p){return h.indexOf(p)>-1}function z(h){return h.trim().split(/\\s+/g)}function L(h,p,b){if(h.indexOf&&!b)return h.indexOf(p);for(var _=0;_<h.length;){if(b&&h[_][b]==p||!b&&h[_]===p)return _;_++}return-1}function H(h){return Array.prototype.slice.call(h,0)}function Z(h,p,b){for(var _=[],S=[],M=0;M<h.length;){var R=h[M][p];L(S,R)<0&&_.push(h[M]),S[M]=R,M++}return _=_.sort(function(Q,ot){return Q[p]>ot[p]}),_}function nt(h,p){for(var b,_,S=p[0].toUpperCase()+p.slice(1),M=0;M<o.length;){if(b=o[M],_=b?b+S:p,_ in h)return _;M++}return s}var j=1;function q(){return j++}function it(h){var p=h.ownerDocument||h;return p.defaultView||p.parentWindow||t}var Ue=/mobile|tablet|ip(ad|hone|od)|android/i,ye="ontouchstart"in t,Kt=nt(t,"PointerEvent")!==s,Ye=ye&&Ue.test(navigator.userAgent),dt="touch",xe="pen",wt="mouse",ve="kinect",Vt=25,st=1,_e=2,X=4,at=8,jn=1,ln=2,cn=4,un=8,hn=16,Et=ln|cn,we=un|hn,Ao=Et|we,Io=["x","y"],$n=["clientX","clientY"];function pt(h,p){var b=this;this.manager=h,this.callback=p,this.element=h.element,this.target=h.options.inputTarget,this.domHandler=function(_){O(h.options.enable,[h])&&b.handler(_)},this.init()}pt.prototype={handler:function(){},init:function(){this.evEl&&D(this.element,this.evEl,this.domHandler),this.evTarget&&D(this.target,this.evTarget,this.domHandler),this.evWin&&D(it(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(it(this.element),this.evWin,this.domHandler)}};function Pc(h){var p,b=h.options.inputClass;return b?p=b:Kt?p=Yi:Ye?p=Xn:ye?p=Xi:p=Yn,new p(h,Dc)}function Dc(h,p,b){var _=b.pointers.length,S=b.changedPointers.length,M=p&st&&_-S===0,R=p&(X|at)&&_-S===0;b.isFirst=!!M,b.isFinal=!!R,M&&(h.session={}),b.eventType=p,Ac(h,b),h.emit("hammer.input",b),h.recognize(b),h.session.prevInput=b}function Ac(h,p){var b=h.session,_=p.pointers,S=_.length;b.firstInput||(b.firstInput=Lo(p)),S>1&&!b.firstMultiple?b.firstMultiple=Lo(p):S===1&&(b.firstMultiple=!1);var M=b.firstInput,R=b.firstMultiple,K=R?R.center:M.center,Q=p.center=No(_);p.timeStamp=u(),p.deltaTime=p.timeStamp-M.timeStamp,p.angle=Ui(K,Q),p.distance=Un(K,Q),Ic(b,p),p.offsetDirection=Fo(p.deltaX,p.deltaY);var ot=Ro(p.deltaTime,p.deltaX,p.deltaY);p.overallVelocityX=ot.x,p.overallVelocityY=ot.y,p.overallVelocity=c(ot.x)>c(ot.y)?ot.x:ot.y,p.scale=R?Rc(R.pointers,_):1,p.rotation=R?Nc(R.pointers,_):0,p.maxPointers=b.prevInput?p.pointers.length>b.prevInput.maxPointers?p.pointers.length:b.prevInput.maxPointers:p.pointers.length,Lc(b,p);var Ot=h.element;E(p.srcEvent.target,Ot)&&(Ot=p.srcEvent.target),p.target=Ot}function Ic(h,p){var b=p.center,_=h.offsetDelta||{},S=h.prevDelta||{},M=h.prevInput||{};(p.eventType===st||M.eventType===X)&&(S=h.prevDelta={x:M.deltaX||0,y:M.deltaY||0},_=h.offsetDelta={x:b.x,y:b.y}),p.deltaX=S.x+(b.x-_.x),p.deltaY=S.y+(b.y-_.y)}function Lc(h,p){var b=h.lastInterval||p,_=p.timeStamp-b.timeStamp,S,M,R,K;if(p.eventType!=at&&(_>Vt||b.velocity===s)){var Q=p.deltaX-b.deltaX,ot=p.deltaY-b.deltaY,Ot=Ro(_,Q,ot);M=Ot.x,R=Ot.y,S=c(Ot.x)>c(Ot.y)?Ot.x:Ot.y,K=Fo(Q,ot),h.lastInterval=p}else S=b.velocity,M=b.velocityX,R=b.velocityY,K=b.direction;p.velocity=S,p.velocityX=M,p.velocityY=R,p.direction=K}function Lo(h){for(var p=[],b=0;b<h.pointers.length;)p[b]={clientX:l(h.pointers[b].clientX),clientY:l(h.pointers[b].clientY)},b++;return{timeStamp:u(),pointers:p,center:No(p),deltaX:h.deltaX,deltaY:h.deltaY}}function No(h){var p=h.length;if(p===1)return{x:l(h[0].clientX),y:l(h[0].clientY)};for(var b=0,_=0,S=0;S<p;)b+=h[S].clientX,_+=h[S].clientY,S++;return{x:l(b/p),y:l(_/p)}}function Ro(h,p,b){return{x:p/h||0,y:b/h||0}}function Fo(h,p){return h===p?jn:c(h)>=c(p)?h<0?ln:cn:p<0?un:hn}function Un(h,p,b){b||(b=Io);var _=p[b[0]]-h[b[0]],S=p[b[1]]-h[b[1]];return Math.sqrt(_*_+S*S)}function Ui(h,p,b){b||(b=Io);var _=p[b[0]]-h[b[0]],S=p[b[1]]-h[b[1]];return Math.atan2(S,_)*180/Math.PI}function Nc(h,p){return Ui(p[1],p[0],$n)+Ui(h[1],h[0],$n)}function Rc(h,p){return Un(p[0],p[1],$n)/Un(h[0],h[1],$n)}var Fc={mousedown:st,mousemove:_e,mouseup:X},zc="mousedown",Hc="mousemove mouseup";function Yn(){this.evEl=zc,this.evWin=Hc,this.pressed=!1,pt.apply(this,arguments)}k(Yn,pt,{handler:function(p){var b=Fc[p.type];b&st&&p.button===0&&(this.pressed=!0),b&_e&&p.which!==1&&(b=X),this.pressed&&(b&X&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[p],changedPointers:[p],pointerType:wt,srcEvent:p}))}});var Vc={pointerdown:st,pointermove:_e,pointerup:X,pointercancel:at,pointerout:at},Bc={2:dt,3:xe,4:wt,5:ve},zo="pointerdown",Ho="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(zo="MSPointerDown",Ho="MSPointerMove MSPointerUp MSPointerCancel");function Yi(){this.evEl=zo,this.evWin=Ho,pt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}k(Yi,pt,{handler:function(p){var b=this.store,_=!1,S=p.type.toLowerCase().replace("ms",""),M=Vc[S],R=Bc[p.pointerType]||p.pointerType,K=R==dt,Q=L(b,p.pointerId,"pointerId");M&st&&(p.button===0||K)?Q<0&&(b.push(p),Q=b.length-1):M&(X|at)&&(_=!0),!(Q<0)&&(b[Q]=p,this.callback(this.manager,M,{pointers:b,changedPointers:[p],pointerType:R,srcEvent:p}),_&&b.splice(Q,1))}});var Wc={touchstart:st,touchmove:_e,touchend:X,touchcancel:at},jc="touchstart",$c="touchstart touchmove touchend touchcancel";function Vo(){this.evTarget=jc,this.evWin=$c,this.started=!1,pt.apply(this,arguments)}k(Vo,pt,{handler:function(p){var b=Wc[p.type];if(b===st&&(this.started=!0),!!this.started){var _=Uc.call(this,p,b);b&(X|at)&&_[0].length-_[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:p})}}});function Uc(h,p){var b=H(h.touches),_=H(h.changedTouches);return p&(X|at)&&(b=Z(b.concat(_),"identifier")),[b,_]}var Yc={touchstart:st,touchmove:_e,touchend:X,touchcancel:at},Xc="touchstart touchmove touchend touchcancel";function Xn(){this.evTarget=Xc,this.targetIds={},pt.apply(this,arguments)}k(Xn,pt,{handler:function(p){var b=Yc[p.type],_=qc.call(this,p,b);_&&this.callback(this.manager,b,{pointers:_[0],changedPointers:_[1],pointerType:dt,srcEvent:p})}});function qc(h,p){var b=H(h.touches),_=this.targetIds;if(p&(st|_e)&&b.length===1)return _[b[0].identifier]=!0,[b,b];var S,M,R=H(h.changedTouches),K=[],Q=this.target;if(M=b.filter(function(ot){return E(ot.target,Q)}),p===st)for(S=0;S<M.length;)_[M[S].identifier]=!0,S++;for(S=0;S<R.length;)_[R[S].identifier]&&K.push(R[S]),p&(X|at)&&delete _[R[S].identifier],S++;if(K.length)return[Z(M.concat(K),"identifier"),K]}var Gc=2500,Bo=25;function Xi(){pt.apply(this,arguments);var h=C(this.handler,this);this.touch=new Xn(this.manager,h),this.mouse=new Yn(this.manager,h),this.primaryTouch=null,this.lastTouches=[]}k(Xi,pt,{handler:function(p,b,_){var S=_.pointerType==dt,M=_.pointerType==wt;if(!(M&&_.sourceCapabilities&&_.sourceCapabilities.firesTouchEvents)){if(S)Kc.call(this,b,_);else if(M&&Zc.call(this,_))return;this.callback(p,b,_)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Kc(h,p){h&st?(this.primaryTouch=p.changedPointers[0].identifier,Wo.call(this,p)):h&(X|at)&&Wo.call(this,p)}function Wo(h){var p=h.changedPointers[0];if(p.identifier===this.primaryTouch){var b={x:p.clientX,y:p.clientY};this.lastTouches.push(b);var _=this.lastTouches,S=function(){var M=_.indexOf(b);M>-1&&_.splice(M,1)};setTimeout(S,Gc)}}function Zc(h){for(var p=h.srcEvent.clientX,b=h.srcEvent.clientY,_=0;_<this.lastTouches.length;_++){var S=this.lastTouches[_],M=Math.abs(p-S.x),R=Math.abs(b-S.y);if(M<=Bo&&R<=Bo)return!0}return!1}var jo=nt(r.style,"touchAction"),$o=jo!==s,Uo="compute",Yo="auto",qi="manipulation",Se="none",fn="pan-x",dn="pan-y",qn=Jc();function Gi(h,p){this.manager=h,this.set(p)}Gi.prototype={set:function(h){h==Uo&&(h=this.compute()),$o&&this.manager.element.style&&qn[h]&&(this.manager.element.style[jo]=h),this.actions=h.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var h=[];return m(this.manager.recognizers,function(p){O(p.options.enable,[p])&&(h=h.concat(p.getTouchAction()))}),Qc(h.join(" "))},preventDefaults:function(h){var p=h.srcEvent,b=h.offsetDirection;if(this.manager.session.prevented){p.preventDefault();return}var _=this.actions,S=A(_,Se)&&!qn[Se],M=A(_,dn)&&!qn[dn],R=A(_,fn)&&!qn[fn];if(S){var K=h.pointers.length===1,Q=h.distance<2,ot=h.deltaTime<250;if(K&&Q&&ot)return}if(!(R&&M)&&(S||M&&b&Et||R&&b&we))return this.preventSrc(p)},preventSrc:function(h){this.manager.session.prevented=!0,h.preventDefault()}};function Qc(h){if(A(h,Se))return Se;var p=A(h,fn),b=A(h,dn);return p&&b?Se:p||b?p?fn:dn:A(h,qi)?qi:Yo}function Jc(){if(!$o)return!1;var h={},p=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(b){h[b]=p?t.CSS.supports("touch-action",b):!0}),h}var Gn=1,gt=2,Xe=4,Zt=8,Bt=Zt,pn=16,Ct=32;function Wt(h){this.options=y({},this.defaults,h||{}),this.id=q(),this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=Gn,this.simultaneous={},this.requireFail=[]}Wt.prototype={defaults:{},set:function(h){return y(this.options,h),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(h){if(d(h,"recognizeWith",this))return this;var p=this.simultaneous;return h=Kn(h,this),p[h.id]||(p[h.id]=h,h.recognizeWith(this)),this},dropRecognizeWith:function(h){return d(h,"dropRecognizeWith",this)?this:(h=Kn(h,this),delete this.simultaneous[h.id],this)},requireFailure:function(h){if(d(h,"requireFailure",this))return this;var p=this.requireFail;return h=Kn(h,this),L(p,h)===-1&&(p.push(h),h.requireFailure(this)),this},dropRequireFailure:function(h){if(d(h,"dropRequireFailure",this))return this;h=Kn(h,this);var p=L(this.requireFail,h);return p>-1&&this.requireFail.splice(p,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(h){return!!this.simultaneous[h.id]},emit:function(h){var p=this,b=this.state;function _(S){p.manager.emit(S,h)}b<Zt&&_(p.options.event+Xo(b)),_(p.options.event),h.additionalEvent&&_(h.additionalEvent),b>=Zt&&_(p.options.event+Xo(b))},tryEmit:function(h){if(this.canEmit())return this.emit(h);this.state=Ct},canEmit:function(){for(var h=0;h<this.requireFail.length;){if(!(this.requireFail[h].state&(Ct|Gn)))return!1;h++}return!0},recognize:function(h){var p=y({},h);if(!O(this.options.enable,[this,p])){this.reset(),this.state=Ct;return}this.state&(Bt|pn|Ct)&&(this.state=Gn),this.state=this.process(p),this.state&(gt|Xe|Zt|pn)&&this.tryEmit(p)},process:function(h){},getTouchAction:function(){},reset:function(){}};function Xo(h){return h&pn?"cancel":h&Zt?"end":h&Xe?"move":h>?"start":""}function qo(h){return h==hn?"down":h==un?"up":h==ln?"left":h==cn?"right":""}function Kn(h,p){var b=p.manager;return b?b.get(h):h}function St(){Wt.apply(this,arguments)}k(St,Wt,{defaults:{pointers:1},attrTest:function(h){var p=this.options.pointers;return p===0||h.pointers.length===p},process:function(h){var p=this.state,b=h.eventType,_=p&(gt|Xe),S=this.attrTest(h);return _&&(b&at||!S)?p|pn:_||S?b&X?p|Zt:p>?p|Xe:gt:Ct}});function Zn(){St.apply(this,arguments),this.pX=null,this.pY=null}k(Zn,St,{defaults:{event:"pan",threshold:10,pointers:1,direction:Ao},getTouchAction:function(){var h=this.options.direction,p=[];return h&Et&&p.push(dn),h&we&&p.push(fn),p},directionTest:function(h){var p=this.options,b=!0,_=h.distance,S=h.direction,M=h.deltaX,R=h.deltaY;return S&p.direction||(p.direction&Et?(S=M===0?jn:M<0?ln:cn,b=M!=this.pX,_=Math.abs(h.deltaX)):(S=R===0?jn:R<0?un:hn,b=R!=this.pY,_=Math.abs(h.deltaY))),h.direction=S,b&&_>p.threshold&&S&p.direction},attrTest:function(h){return St.prototype.attrTest.call(this,h)&&(this.state>||!(this.state>)&&this.directionTest(h))},emit:function(h){this.pX=h.deltaX,this.pY=h.deltaY;var p=qo(h.direction);p&&(h.additionalEvent=this.options.event+p),this._super.emit.call(this,h)}});function Ki(){St.apply(this,arguments)}k(Ki,St,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.scale-1)>this.options.threshold||this.state>)},emit:function(h){if(h.scale!==1){var p=h.scale<1?"in":"out";h.additionalEvent=this.options.event+p}this._super.emit.call(this,h)}});function Zi(){Wt.apply(this,arguments),this._timer=null,this._input=null}k(Zi,Wt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Yo]},process:function(h){var p=this.options,b=h.pointers.length===p.pointers,_=h.distance<p.threshold,S=h.deltaTime>p.time;if(this._input=h,!_||!b||h.eventType&(X|at)&&!S)this.reset();else if(h.eventType&st)this.reset(),this._timer=f(function(){this.state=Bt,this.tryEmit()},p.time,this);else if(h.eventType&X)return Bt;return Ct},reset:function(){clearTimeout(this._timer)},emit:function(h){this.state===Bt&&(h&&h.eventType&X?this.manager.emit(this.options.event+"up",h):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}});function Qi(){St.apply(this,arguments)}k(Qi,St,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.rotation)>this.options.threshold||this.state>)}});function Ji(){St.apply(this,arguments)}k(Ji,St,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Et|we,pointers:1},getTouchAction:function(){return Zn.prototype.getTouchAction.call(this)},attrTest:function(h){var p=this.options.direction,b;return p&(Et|we)?b=h.overallVelocity:p&Et?b=h.overallVelocityX:p&we&&(b=h.overallVelocityY),this._super.attrTest.call(this,h)&&p&h.offsetDirection&&h.distance>this.options.threshold&&h.maxPointers==this.options.pointers&&c(b)>this.options.velocity&&h.eventType&X},emit:function(h){var p=qo(h.offsetDirection);p&&this.manager.emit(this.options.event+p,h),this.manager.emit(this.options.event,h)}});function Qn(){Wt.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}k(Qn,Wt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[qi]},process:function(h){var p=this.options,b=h.pointers.length===p.pointers,_=h.distance<p.threshold,S=h.deltaTime<p.time;if(this.reset(),h.eventType&st&&this.count===0)return this.failTimeout();if(_&&S&&b){if(h.eventType!=X)return this.failTimeout();var M=this.pTime?h.timeStamp-this.pTime<p.interval:!0,R=!this.pCenter||Un(this.pCenter,h.center)<p.posThreshold;this.pTime=h.timeStamp,this.pCenter=h.center,!R||!M?this.count=1:this.count+=1,this._input=h;var K=this.count%p.taps;if(K===0)return this.hasRequireFailures()?(this._timer=f(function(){this.state=Bt,this.tryEmit()},p.interval,this),gt):Bt}return Ct},failTimeout:function(){return this._timer=f(function(){this.state=Ct},this.options.interval,this),Ct},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Bt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Qt(h,p){return p=p||{},p.recognizers=T(p.recognizers,Qt.defaults.preset),new ts(h,p)}Qt.VERSION="2.0.7",Qt.defaults={domEvents:!1,touchAction:Uo,enable:!0,inputTarget:null,inputClass:null,preset:[[Qi,{enable:!1}],[Ki,{enable:!1},["rotate"]],[Ji,{direction:Et}],[Zn,{direction:Et},["swipe"]],[Qn],[Qn,{event:"doubletap",taps:2},["tap"]],[Zi]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var tu=1,Go=2;function ts(h,p){this.options=y({},Qt.defaults,p||{}),this.options.inputTarget=this.options.inputTarget||h,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=h,this.input=Pc(this),this.touchAction=new Gi(this,this.options.touchAction),Ko(this,!0),m(this.options.recognizers,function(b){var _=this.add(new b[0](b[1]));b[2]&&_.recognizeWith(b[2]),b[3]&&_.requireFailure(b[3])},this)}ts.prototype={set:function(h){return y(this.options,h),h.touchAction&&this.touchAction.update(),h.inputTarget&&(this.input.destroy(),this.input.target=h.inputTarget,this.input.init()),this},stop:function(h){this.session.stopped=h?Go:tu},recognize:function(h){var p=this.session;if(!p.stopped){this.touchAction.preventDefaults(h);var b,_=this.recognizers,S=p.curRecognizer;(!S||S&&S.state&Bt)&&(S=p.curRecognizer=null);for(var M=0;M<_.length;)b=_[M],p.stopped!==Go&&(!S||b==S||b.canRecognizeWith(S))?b.recognize(h):b.reset(),!S&&b.state&(gt|Xe|Zt)&&(S=p.curRecognizer=b),M++}},get:function(h){if(h instanceof Wt)return h;for(var p=this.recognizers,b=0;b<p.length;b++)if(p[b].options.event==h)return p[b];return null},add:function(h){if(d(h,"add",this))return this;var p=this.get(h.options.event);return p&&this.remove(p),this.recognizers.push(h),h.manager=this,this.touchAction.update(),h},remove:function(h){if(d(h,"remove",this))return this;if(h=this.get(h),h){var p=this.recognizers,b=L(p,h);b!==-1&&(p.splice(b,1),this.touchAction.update())}return this},on:function(h,p){if(h!==s&&p!==s){var b=this.handlers;return m(z(h),function(_){b[_]=b[_]||[],b[_].push(p)}),this}},off:function(h,p){if(h!==s){var b=this.handlers;return m(z(h),function(_){p?b[_]&&b[_].splice(L(b[_],p),1):delete b[_]}),this}},emit:function(h,p){this.options.domEvents&&eu(h,p);var b=this.handlers[h]&&this.handlers[h].slice();if(!(!b||!b.length)){p.type=h,p.preventDefault=function(){p.srcEvent.preventDefault()};for(var _=0;_<b.length;)b[_](p),_++}},destroy:function(){this.element&&Ko(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ko(h,p){var b=h.element;if(b.style){var _;m(h.options.cssProps,function(S,M){_=nt(b.style,M),p?(h.oldCssProps[_]=b.style[_],b.style[_]=S):b.style[_]=h.oldCssProps[_]||""}),p||(h.oldCssProps={})}}function eu(h,p){var b=n.createEvent("Event");b.initEvent(h,!0,!0),b.gesture=p,p.target.dispatchEvent(b)}y(Qt,{INPUT_START:st,INPUT_MOVE:_e,INPUT_END:X,INPUT_CANCEL:at,STATE_POSSIBLE:Gn,STATE_BEGAN:gt,STATE_CHANGED:Xe,STATE_ENDED:Zt,STATE_RECOGNIZED:Bt,STATE_CANCELLED:pn,STATE_FAILED:Ct,DIRECTION_NONE:jn,DIRECTION_LEFT:ln,DIRECTION_RIGHT:cn,DIRECTION_UP:un,DIRECTION_DOWN:hn,DIRECTION_HORIZONTAL:Et,DIRECTION_VERTICAL:we,DIRECTION_ALL:Ao,Manager:ts,Input:pt,TouchAction:Gi,TouchInput:Xn,MouseInput:Yn,PointerEventInput:Yi,TouchMouseInput:Xi,SingleTouchInput:Vo,Recognizer:Wt,AttrRecognizer:St,Tap:Qn,Pan:Zn,Swipe:Ji,Pinch:Ki,Rotate:Qi,Press:Zi,on:D,off:P,each:m,merge:w,extend:v,assign:y,inherit:k,bindFn:C,prefixed:nt});var nu=typeof t<"u"?t:typeof self<"u"?self:{};nu.Hammer=Qt,e.exports?e.exports=Qt:t[i]=Qt})(window,document,"Hammer")})(fs)),fs.exports}var gm=pm();const Dn=dm(gm);/*!
|
|
9150
9772
|
* chartjs-plugin-zoom v2.2.0
|
|
9151
9773
|
* https://www.chartjs.org/chartjs-plugin-zoom/2.2.0/
|
|
9152
9774
|
* (c) 2016-2024 chartjs-plugin-zoom Contributors
|
|
9153
9775
|
* Released under the MIT License
|
|
9154
|
-
*/const Fn=e=>e&&e.enabled&&e.modifierKey,hc=(e,t)=>e&&t[e+"Key"],Co=(e,t)=>e&&!t[e+"Key"];function fe(e,t,n){return e===void 0?!0:typeof e=="string"?e.indexOf(t)!==-1:typeof e=="function"?e({chart:n}).indexOf(t)!==-1:!1}function hs(e,t){return typeof e=="function"&&(e=e({chart:t})),typeof e=="string"?{x:e.indexOf("x")!==-1,y:e.indexOf("y")!==-1}:{x:!1,y:!1}}function um(e,t){let n;return function(){return clearTimeout(n),n=setTimeout(e,t),t}}function hm({x:e,y:t},n){const i=n.scales,s=Object.keys(i);for(let o=0;o<s.length;o++){const r=i[s[o]];if(t>=r.top&&t<=r.bottom&&e>=r.left&&e<=r.right)return r}return null}function fc(e,t,n){const{mode:i="xy",scaleMode:s,overScaleMode:o}=e||{},r=hm(t,n),a=hs(i,n),l=hs(s,n);if(o){const u=hs(o,n);for(const f of["x","y"])u[f]&&(l[f]=a[f],a[f]=!1)}if(r&&l[r.axis])return[r];const c=[];return F(n.scales,function(u){a[u.axis]&&c.push(u)}),c}const Ys=new WeakMap;function $(e){let t=Ys.get(e);return t||(t={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},Ys.set(e,t)),t}function fm(e){Ys.delete(e)}function dc(e,t,n,i){const s=Math.max(0,Math.min(1,(e-t)/n||0)),o=1-s;return{min:i*s,max:i*o}}function pc(e,t){const n=e.isHorizontal()?t.x:t.y;return e.getValueForPixel(n)}function gc(e,t,n){const i=e.max-e.min,s=i*(t-1),o=pc(e,n);return dc(o,e.min,i,s)}function dm(e,t,n){const i=pc(e,n);if(i===void 0)return{min:e.min,max:e.max};const s=Math.log10(e.min),o=Math.log10(e.max),r=Math.log10(i),a=o-s,l=a*(t-1),c=dc(r,s,a,l);return{min:Math.pow(10,s+c.min),max:Math.pow(10,o-c.max)}}function pm(e,t){return t&&(t[e.id]||t[e.axis])||{}}function va(e,t,n,i,s){let o=n[i];if(o==="original"){const r=e.originalScaleLimits[t.id][i];o=R(r.options,r.scale)}return R(o,s)}function gm(e,t,n){const i=e.getValueForPixel(t),s=e.getValueForPixel(n);return{min:Math.min(i,s),max:Math.max(i,s)}}function mm(e,{min:t,max:n,minLimit:i,maxLimit:s},o){const r=(e-n+t)/2;t-=r,n+=r;const a=o.min.options??o.min.scale,l=o.max.options??o.max.scale,c=e/1e6;return Ie(t,a,c)&&(t=a),Ie(n,l,c)&&(n=l),t<i?(t=i,n=Math.min(i+e,s)):n>s&&(n=s,t=Math.max(s-e,i)),{min:t,max:n}}function Be(e,{min:t,max:n},i,s=!1){const o=$(e.chart),{options:r}=e,a=pm(e,i),{minRange:l=0}=a,c=va(o,e,a,"min",-1/0),u=va(o,e,a,"max",1/0);if(s==="pan"&&(t<c||n>u))return!0;const f=e.max-e.min,d=s?Math.max(n-t,l):f;if(s&&d===l&&f<=l)return!0;const m=mm(d,{min:t,max:n,minLimit:c,maxLimit:u},o.originalScaleLimits[e.id]);return r.min=m.min,r.max=m.max,o.updatedScaleLimits[e.id]=m,e.parse(m.min)!==e.min||e.parse(m.max)!==e.max}function bm(e,t,n,i){const s=gc(e,t,n),o={min:e.min+s.min,max:e.max-s.max};return Be(e,o,i,!0)}function xm(e,t,n,i){const s=dm(e,t,n);return Be(e,s,i,!0)}function ym(e,t,n,i){Be(e,gm(e,t,n),i,!0)}const _a=e=>e===0||isNaN(e)?0:e<0?Math.min(Math.round(e),-1):Math.max(Math.round(e),1);function vm(e){const n=e.getLabels().length-1;e.min>0&&(e.min-=1),e.max<n&&(e.max+=1)}function _m(e,t,n,i){const s=gc(e,t,n);e.min===e.max&&t<1&&vm(e);const o={min:e.min+_a(s.min),max:e.max-_a(s.max)};return Be(e,o,i,!0)}function wm(e){return e.isHorizontal()?e.width:e.height}function Sm(e,t,n){const s=e.getLabels().length-1;let{min:o,max:r}=e;const a=Math.max(r-o,1),l=Math.round(wm(e)/Math.max(a,10)),c=Math.round(Math.abs(t/l));let u;return t<-l?(r=Math.min(r+c,s),o=a===1?r:r-a,u=r===s):t>l&&(o=Math.max(0,o-c),r=a===1?o:o+a,u=o===0),Be(e,{min:o,max:r},n)||u}const km={second:500,minute:30*1e3,hour:1800*1e3,day:720*60*1e3,week:3.5*24*60*60*1e3,month:360*60*60*1e3,quarter:1440*60*60*1e3,year:4368*60*60*1e3};function mc(e,t,n,i=!1){const{min:s,max:o,options:r}=e,a=r.time&&r.time.round,l=km[a]||0,c=e.getValueForPixel(e.getPixelForValue(s+l)-t),u=e.getValueForPixel(e.getPixelForValue(o+l)-t);return isNaN(c)||isNaN(u)?!0:Be(e,{min:c,max:u},n,i?"pan":!1)}function wa(e,t,n){return mc(e,t,n,!0)}const Xs={category:_m,default:bm,logarithmic:xm},qs={default:ym},Gs={category:Sm,default:mc,logarithmic:wa,timeseries:wa};function Tm(e,t,n){const{id:i,options:{min:s,max:o}}=e;if(!t[i]||!n[i])return!0;const r=n[i];return r.min!==s||r.max!==o}function Sa(e,t){F(e,(n,i)=>{t[i]||delete e[i]})}function an(e,t){const{scales:n}=e,{originalScaleLimits:i,updatedScaleLimits:s}=t;return F(n,function(o){Tm(o,i,s)&&(i[o.id]={min:{scale:o.min,options:o.options.min},max:{scale:o.max,options:o.options.max}})}),Sa(i,n),Sa(s,n),i}function ka(e,t,n,i){const s=Xs[e.type]||Xs.default;I(s,[e,t,n,i])}function Ta(e,t,n,i){const s=qs[e.type]||qs.default;I(s,[e,t,n,i])}function Mm(e){const t=e.chartArea;return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function Oo(e,t,n="none",i="api"){const{x:s=1,y:o=1,focalPoint:r=Mm(e)}=typeof t=="number"?{x:t,y:t}:t,a=$(e),{options:{limits:l,zoom:c}}=a;an(e,a);const u=s!==1,f=o!==1,d=fc(c,r,e);F(d||e.scales,function(m){m.isHorizontal()&&u?ka(m,s,r,l):!m.isHorizontal()&&f&&ka(m,o,r,l)}),e.update(n),I(c.onZoom,[{chart:e,trigger:i}])}function bc(e,t,n,i="none",s="api"){const o=$(e),{options:{limits:r,zoom:a}}=o,{mode:l="xy"}=a;an(e,o);const c=fe(l,"x",e),u=fe(l,"y",e);F(e.scales,function(f){f.isHorizontal()&&c?Ta(f,t.x,n.x,r):!f.isHorizontal()&&u&&Ta(f,t.y,n.y,r)}),e.update(i),I(a.onZoom,[{chart:e,trigger:s}])}function Em(e,t,n,i="none",s="api"){const o=$(e);an(e,o);const r=e.scales[t];Be(r,n,void 0,!0),e.update(i),I(o.options.zoom?.onZoom,[{chart:e,trigger:s}])}function Cm(e,t="default"){const n=$(e),i=an(e,n);F(e.scales,function(s){const o=s.options;i[s.id]?(o.min=i[s.id].min.options,o.max=i[s.id].max.options):(delete o.min,delete o.max),delete n.updatedScaleLimits[s.id]}),e.update(t),I(n.options.zoom.onZoomComplete,[{chart:e}])}function Om(e,t){const n=e.originalScaleLimits[t];if(!n)return;const{min:i,max:s}=n;return R(s.options,s.scale)-R(i.options,i.scale)}function Pm(e){const t=$(e);let n=1,i=1;return F(e.scales,function(s){const o=Om(t,s.id);if(o){const r=Math.round(o/(s.max-s.min)*100)/100;n=Math.min(n,r),i=Math.max(i,r)}}),n<1?n:i}function Ma(e,t,n,i){const{panDelta:s}=i,o=s[e.id]||0;he(o)===he(t)&&(t+=o);const r=Gs[e.type]||Gs.default;I(r,[e,t,n])?s[e.id]=0:s[e.id]=t}function xc(e,t,n,i="none"){const{x:s=0,y:o=0}=typeof t=="number"?{x:t,y:t}:t,r=$(e),{options:{pan:a,limits:l}}=r,{onPan:c}=a||{};an(e,r);const u=s!==0,f=o!==0;F(n||e.scales,function(d){d.isHorizontal()&&u?Ma(d,s,l,r):!d.isHorizontal()&&f&&Ma(d,o,l,r)}),e.update(i),I(c,[{chart:e}])}function yc(e){const t=$(e);an(e,t);const n={};for(const i of Object.keys(e.scales)){const{min:s,max:o}=t.originalScaleLimits[i]||{min:{},max:{}};n[i]={min:s.scale,max:o.scale}}return n}function Dm(e){const t=$(e),n={};for(const i of Object.keys(e.scales))n[i]=t.updatedScaleLimits[i];return n}function Am(e){const t=yc(e);for(const n of Object.keys(e.scales)){const{min:i,max:s}=t[n];if(i!==void 0&&e.scales[n].min!==i||s!==void 0&&e.scales[n].max!==s)return!0}return!1}function Ea(e){const t=$(e);return t.panning||t.dragging}const Ca=(e,t,n)=>Math.min(n,Math.max(t,e));function ct(e,t){const{handlers:n}=$(e),i=n[t];i&&i.target&&(i.target.removeEventListener(t,i),delete n[t])}function Dn(e,t,n,i){const{handlers:s,options:o}=$(e),r=s[n];if(r&&r.target===t)return;ct(e,n),s[n]=l=>i(e,l,o),s[n].target=t;const a=n==="wheel"?!1:void 0;t.addEventListener(n,s[n],{passive:a})}function Im(e,t){const n=$(e);n.dragStart&&(n.dragging=!0,n.dragEnd=t,e.update("none"))}function Lm(e,t){const n=$(e);!n.dragStart||t.key!=="Escape"||(ct(e,"keydown"),n.dragging=!1,n.dragStart=n.dragEnd=null,e.update("none"))}function Ks(e,t){if(e.target!==t.canvas){const n=t.canvas.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}return It(e,t)}function vc(e,t,n){const{onZoomStart:i,onZoomRejected:s}=n;if(i){const o=Ks(t,e);if(I(i,[{chart:e,event:t,point:o}])===!1)return I(s,[{chart:e,event:t}]),!1}}function Rm(e,t){if(e.legend){const o=It(t,e);if(en(o,e.legend))return}const n=$(e),{pan:i,zoom:s={}}=n.options;if(t.button!==0||hc(Fn(i),t)||Co(Fn(s.drag),t))return I(s.onZoomRejected,[{chart:e,event:t}]);vc(e,t,s)!==!1&&(n.dragStart=t,Dn(e,e.canvas.ownerDocument,"mousemove",Im),Dn(e,window.document,"keydown",Lm))}function Nm({begin:e,end:t},n){let i=t.x-e.x,s=t.y-e.y;const o=Math.abs(i/s);o>n?i=Math.sign(i)*Math.abs(s*n):o<n&&(s=Math.sign(s)*Math.abs(i/n)),t.x=e.x+i,t.y=e.y+s}function Oa(e,t,n,{min:i,max:s,prop:o}){e[i]=Ca(Math.min(n.begin[o],n.end[o]),t[i],t[s]),e[s]=Ca(Math.max(n.begin[o],n.end[o]),t[i],t[s])}function Fm(e,t,n){const i={begin:Ks(t.dragStart,e),end:Ks(t.dragEnd,e)};if(n){const s=e.chartArea.width/e.chartArea.height;Nm(i,s)}return i}function _c(e,t,n,i){const s=fe(t,"x",e),o=fe(t,"y",e),{top:r,left:a,right:l,bottom:c,width:u,height:f}=e.chartArea,d={top:r,left:a,right:l,bottom:c},m=Fm(e,n,i&&s&&o);s&&Oa(d,e.chartArea,m,{min:"left",max:"right",prop:"x"}),o&&Oa(d,e.chartArea,m,{min:"top",max:"bottom",prop:"y"});const y=d.right-d.left,x=d.bottom-d.top;return{...d,width:y,height:x,zoomX:s&&y?1+(u-y)/u:1,zoomY:o&&x?1+(f-x)/f:1}}function zm(e,t){const n=$(e);if(!n.dragStart)return;ct(e,"mousemove");const{mode:i,onZoomComplete:s,drag:{threshold:o=0,maintainAspectRatio:r}}=n.options.zoom,a=_c(e,i,{dragStart:n.dragStart,dragEnd:t},r),l=fe(i,"x",e)?a.width:0,c=fe(i,"y",e)?a.height:0,u=Math.sqrt(l*l+c*c);if(n.dragStart=n.dragEnd=null,u<=o){n.dragging=!1,e.update("none");return}bc(e,{x:a.left,y:a.top},{x:a.right,y:a.bottom},"zoom","drag"),n.dragging=!1,n.filterNextClick=!0,I(s,[{chart:e}])}function Hm(e,t,n){if(Co(Fn(n.wheel),t)){I(n.onZoomRejected,[{chart:e,event:t}]);return}if(vc(e,t,n)!==!1&&(t.cancelable&&t.preventDefault(),t.deltaY!==void 0))return!0}function Vm(e,t){const{handlers:{onZoomComplete:n},options:{zoom:i}}=$(e);if(!Hm(e,t,i))return;const s=t.target.getBoundingClientRect(),o=i.wheel.speed,r=t.deltaY>=0?2-1/(1-o):1+o,a={x:r,y:r,focalPoint:{x:t.clientX-s.left,y:t.clientY-s.top}};Oo(e,a,"zoom","wheel"),I(n,[{chart:e}])}function Bm(e,t,n,i){n&&($(e).handlers[t]=um(()=>I(n,[{chart:e}]),i))}function Wm(e,t){const n=e.canvas,{wheel:i,drag:s,onZoomComplete:o}=t.zoom;i.enabled?(Dn(e,n,"wheel",Vm),Bm(e,"onZoomComplete",o,250)):ct(e,"wheel"),s.enabled?(Dn(e,n,"mousedown",Rm),Dn(e,n.ownerDocument,"mouseup",zm)):(ct(e,"mousedown"),ct(e,"mousemove"),ct(e,"mouseup"),ct(e,"keydown"))}function jm(e){ct(e,"mousedown"),ct(e,"mousemove"),ct(e,"mouseup"),ct(e,"wheel"),ct(e,"click"),ct(e,"keydown")}function $m(e,t){return function(n,i){const{pan:s,zoom:o={}}=t.options;if(!s||!s.enabled)return!1;const r=i&&i.srcEvent;return r&&!t.panning&&i.pointerType==="mouse"&&(Co(Fn(s),r)||hc(Fn(o.drag),r))?(I(s.onPanRejected,[{chart:e,event:i}]),!1):!0}}function Um(e,t){const n=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY),s=n/i;let o,r;return s>.3&&s<1.7?o=r=!0:n>i?o=!0:r=!0,{x:o,y:r}}function wc(e,t,n){if(t.scale){const{center:i,pointers:s}=n,o=1/t.scale*n.scale,r=n.target.getBoundingClientRect(),a=Um(s[0],s[1]),l=t.options.zoom.mode,c={x:a.x&&fe(l,"x",e)?o:1,y:a.y&&fe(l,"y",e)?o:1,focalPoint:{x:i.x-r.left,y:i.y-r.top}};Oo(e,c,"zoom","pinch"),t.scale=n.scale}}function Ym(e,t,n){if(t.options.zoom.pinch.enabled){const i=It(n,e);I(t.options.zoom.onZoomStart,[{chart:e,event:n,point:i}])===!1?(t.scale=null,I(t.options.zoom.onZoomRejected,[{chart:e,event:n}])):t.scale=1}}function Xm(e,t,n){t.scale&&(wc(e,t,n),t.scale=null,I(t.options.zoom.onZoomComplete,[{chart:e}]))}function Sc(e,t,n){const i=t.delta;i&&(t.panning=!0,xc(e,{x:n.deltaX-i.x,y:n.deltaY-i.y},t.panScales),t.delta={x:n.deltaX,y:n.deltaY})}function qm(e,t,n){const{enabled:i,onPanStart:s,onPanRejected:o}=t.options.pan;if(!i)return;const r=n.target.getBoundingClientRect(),a={x:n.center.x-r.left,y:n.center.y-r.top};if(I(s,[{chart:e,event:n,point:a}])===!1)return I(o,[{chart:e,event:n}]);t.panScales=fc(t.options.pan,a,e),t.delta={x:0,y:0},Sc(e,t,n)}function Gm(e,t){t.delta=null,t.panning&&(t.panning=!1,t.filterNextClick=!0,I(t.options.pan.onPanComplete,[{chart:e}]))}const Zs=new WeakMap;function Pa(e,t){const n=$(e),i=e.canvas,{pan:s,zoom:o}=t,r=new Pn.Manager(i);o&&o.pinch.enabled&&(r.add(new Pn.Pinch),r.on("pinchstart",a=>Ym(e,n,a)),r.on("pinch",a=>wc(e,n,a)),r.on("pinchend",a=>Xm(e,n,a))),s&&s.enabled&&(r.add(new Pn.Pan({threshold:s.threshold,enable:$m(e,n)})),r.on("panstart",a=>qm(e,n,a)),r.on("panmove",a=>Sc(e,n,a)),r.on("panend",()=>Gm(e,n))),Zs.set(e,r)}function Da(e){const t=Zs.get(e);t&&(t.remove("pinchstart"),t.remove("pinch"),t.remove("pinchend"),t.remove("panstart"),t.remove("pan"),t.remove("panend"),t.destroy(),Zs.delete(e))}function Km(e,t){const{pan:n,zoom:i}=e,{pan:s,zoom:o}=t;return i?.zoom?.pinch?.enabled!==o?.zoom?.pinch?.enabled||n?.enabled!==s?.enabled||n?.threshold!==s?.threshold}var Zm="2.2.0";function pi(e,t,n){const i=n.zoom.drag,{dragStart:s,dragEnd:o}=$(e);if(i.drawTime!==t||!o)return;const{left:r,top:a,width:l,height:c}=_c(e,n.zoom.mode,{dragStart:s,dragEnd:o},i.maintainAspectRatio),u=e.ctx;u.save(),u.beginPath(),u.fillStyle=i.backgroundColor||"rgba(225,225,225,0.3)",u.fillRect(r,a,l,c),i.borderWidth>0&&(u.lineWidth=i.borderWidth,u.strokeStyle=i.borderColor||"rgba(225,225,225)",u.strokeRect(r,a,l,c)),u.restore()}var Qm={id:"zoom",version:Zm,defaults:{pan:{enabled:!1,mode:"xy",threshold:10,modifierKey:null},zoom:{wheel:{enabled:!1,speed:.1,modifierKey:null},drag:{enabled:!1,drawTime:"beforeDatasetsDraw",modifierKey:null},pinch:{enabled:!1},mode:"xy"}},start:function(e,t,n){const i=$(e);i.options=n,Object.prototype.hasOwnProperty.call(n.zoom,"enabled")&&console.warn("The option \`zoom.enabled\` is no longer supported. Please use \`zoom.wheel.enabled\`, \`zoom.drag.enabled\`, or \`zoom.pinch.enabled\`."),(Object.prototype.hasOwnProperty.call(n.zoom,"overScaleMode")||Object.prototype.hasOwnProperty.call(n.pan,"overScaleMode"))&&console.warn("The option \`overScaleMode\` is deprecated. Please use \`scaleMode\` instead (and update \`mode\` as desired)."),Pn&&Pa(e,n),e.pan=(s,o,r)=>xc(e,s,o,r),e.zoom=(s,o)=>Oo(e,s,o),e.zoomRect=(s,o,r)=>bc(e,s,o,r),e.zoomScale=(s,o,r)=>Em(e,s,o,r),e.resetZoom=s=>Cm(e,s),e.getZoomLevel=()=>Pm(e),e.getInitialScaleBounds=()=>yc(e),e.getZoomedScaleBounds=()=>Dm(e),e.isZoomedOrPanned=()=>Am(e),e.isZoomingOrPanning=()=>Ea(e)},beforeEvent(e,{event:t}){if(Ea(e))return!1;if(t.type==="click"||t.type==="mouseup"){const n=$(e);if(n.filterNextClick)return n.filterNextClick=!1,!1}},beforeUpdate:function(e,t,n){const i=$(e),s=i.options;i.options=n,Km(s,n)&&(Da(e),Pa(e,n)),Wm(e,n)},beforeDatasetsDraw(e,t,n){pi(e,"beforeDatasetsDraw",n)},afterDatasetsDraw(e,t,n){pi(e,"afterDatasetsDraw",n)},beforeDraw(e,t,n){pi(e,"beforeDraw",n)},afterDraw(e,t,n){pi(e,"afterDraw",n)},stop:function(e){jm(e),Pn&&Da(e),fm(e)},panFunctions:Gs,zoomFunctions:Xs,zoomRectFunctions:qs};function Jm({data:e,...t}){const n=Ne(null),i=Ne(null);return rt(()=>{$s.register(Qm,im,mp,tm,Ng,Rg,Wg,Kg);const s=i.current,o=n.current=new $s(s,{type:"line",data:e.peek(),options:{scales:{y:{min:0}},animation:!1,responsive:!0,plugins:{zoom:{pan:{enabled:!0,mode:"x"},zoom:{wheel:{enabled:!0},mode:"x"}},legend:{position:"top"},title:{display:!1}}}}),r=e.subscribe(a=>{o.data=a,o.update()});return()=>{o.destroy(),r()}},[]),g("canvas",{ref:i,...t})}function tb(){const e=pe();rt(()=>{const n=i=>{An(i)||e()};return U?.on("mount",n),U?.on("unmount",n),()=>{U?.off("mount",n),U?.off("unmount",n)}},[]);const t=U?.profilingContext;return g("div",{className:"flex flex-col gap-2"},gl(t.appStats).filter(([n])=>!An(n)).map(([n])=>g(eb,{key:n.id,app:n})))}const Aa=100,Ia=e=>Object.entries(e).map(([t,{values:n,color:i}])=>({label:t,data:n,fill:!1,borderColor:i,tension:.1}));function eb({app:e}){const t=pe(),n=Ne({update:{values:[0],color:"#ad981f"},updateDirtied:{values:[0],color:"#b21f3a"},createNode:{values:[0],color:"#198019"},removeNode:{values:[0],color:"#5F3691"},updateNode:{values:[0],color:"#2f2f9d"},signalAttrUpdate:{values:[0],color:"#28888f"},signalTextUpdate:{values:[0],color:"#9b3b98"}}),i=J({labels:[(performance.now()/1e3).toFixed(2)],datasets:Ia(n.current)}),s=J(!1),o=U?.profilingContext;return rt(()=>{const r=a=>{a.id===e.id&&t()};return U?.on("update",r),()=>U?.off("update",r)},[]),rt(()=>{const r=[];Object.entries(n.current).forEach(([l,{values:c}])=>{const u=d=>{d.id===e.id&&s.peek()!==!0&&c[c.length-1]++},f=l;o.addEventListener(f,u),r.push(()=>o.removeEventListener(f,u))});const a=setInterval(()=>{if(s.peek()===!0)return;const l=[...i.value.labels];Object.values(n.current).forEach(c=>{c.values.push(0),c.values.length>Aa&&c.values.shift()}),l.push((performance.now()/1e3).toFixed(2)),l.length>Aa&&l.shift(),i.value={labels:l,datasets:Ia(n.current)}},100);return()=>{r.forEach(l=>l()),clearInterval(a)}},[]),g("div",{className:"flex flex-col gap-2 border border-white border-opacity-10 rounded bg-neutral-400 bg-opacity-5 text-neutral-400 p-2"},g("div",{className:"grid items-start gap-2",style:"grid-template-columns: 1fr max-content;"},g("div",{className:"flex flex-col gap-2"},g("span",null,e.name),g(Jm,{data:i,className:"w-full max-w-full min-h-20 bg-black bg-opacity-30",onmouseenter:()=>s.value=!0,onmouseleave:()=>s.value=!1})),g("div",{className:"text-xs grid grid-cols-2 gap-x-4",style:"grid-template-columns: auto auto;"},g("span",{className:"text-right"},"Mount duration:"),o.mountDuration(e).toFixed(2)," ms",g("span",{className:"text-right"},"Total updates:"),g("span",null,o.totalTicks(e).toLocaleString()),g("span",{className:"text-right"},"Avg. update duration:"),o.averageTickDuration(e).toFixed(2)," ms",g("span",{className:"text-right"},"Latest update:"),g("span",null,o.lastTickDuration(e).toFixed(2)," ms"))))}const _n=G([]),kc=G(""),nb=Vn(()=>kc.value.toLowerCase().split(" ").filter(e=>e.length>0));function ib(e){return nb.value.every(t=>e.toLowerCase().includes(t))}function sb(){const e=pe();rt(()=>{const n=i=>{An(i)||e()};return U?.on("update",n),()=>U?.off("update",n)},[]);const t=U?.SWRGlobalCache??new Map;return t.size===0?g("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},g(lo,null),g("h2",{className:"text-lg italic"},"No SWR detected")):g("div",{className:"flex flex-col gap-2 items-start"},g(ho,{value:kc,className:"sticky top-0"}),g("div",{className:"flex flex-col gap-2 w-full"},gl(t).filter(([n])=>ib(n)).map(([n,i])=>g(ob,{key:n,entry:i}))))}function ob({key:e,entry:t}){const n=_n.value.includes(e),i=pe();rt(()=>{const{resource:o,isValidating:r,isMutating:a}=t,l=[o.subscribe(i),r.subscribe(i),a.subscribe(i)];return()=>l.forEach(c=>c())},[]);const s=Xe(()=>{n?_n.value=_n.value.filter(o=>o!==e):_n.value=[..._n.value,e]},[n]);return g("div",{className:"flex flex-col"},g("button",{onclick:s,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,g(ce,{className:"transition-all"+(n?" rotate-90":"")})),n&&g("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},g(me,{data:{resource:t.resource.peek(),isMutating:t.isMutating.peek(),isValidating:t.isValidating.peek()},mutable:!1,objectRefAcc:[],keys:[],onChange:()=>{}})))}const qt=U.fileRouterInstance?.current?.devtools,yi=G({}),fs=G(null),La=G({});function rb(e){const t=new Map,n=new Map,i=[];function s(a){return a.filter(l=>!(l.startsWith("(")&&l.endsWith(")")))}function o(a){return"/"+s(a).join("/")}for(const[a,l]of Object.entries(e)){const c=l.route,u=s(l.segments),f=o(u),d={routeKey:a,route:c,entry:l,children:[]};t.set(c,d),n.set(f,d)}for(const[,a]of Object.entries(e)){const l=a.route,c=a.segments,u=t.get(l),f=s(c);if(f.length>1){const d=f.slice(0,-1),m=o(d),y=n.get(m);y?y.children.push(u):i.push(u)}else i.push(u)}function r(a){return a.sort((l,c)=>l.route.localeCompare(c.route)).map(l=>({...l,children:r(l.children)}))}return r(i)}const ab=Vn(()=>rb(yi.value)),Qs=G(null),Tc=G(""),Ra=Vn(()=>Tc.value.toLowerCase().split(" ").filter(e=>e.length>0));function lb(e,t){if(Ra.value.length===0)return!0;const n=(e+" "+t.filePath).toLowerCase();return Ra.value.every(i=>n.includes(i))}function Mc(e){return e.map(t=>{const n=Mc(t.children);return lb(t.route,t.entry)||n.length>0?{...t,children:n}:null}).filter(t=>t!==null)}const cb=Vn(()=>Mc(ab.value));function ub(){return rt(()=>{if(!qt){yi.value={},fs.value=null,La.value={};return}yi.value=qt.getPages(),console.log(yi.value);const e=qt.subscribe((t,n)=>{fs.value=t,La.value=n});return()=>e()},[qt]),qt?g(Tt,null,g(kl,null,g("div",{className:"flex-grow sticky pr-2 top-0 flex flex-col gap-2"},g(ho,{value:Tc,className:"sticky top-0"}),g("div",{className:"flex-grow flex flex-col gap-1 items-start"},g(Ps,{from:{filteredRouteTree:cb,selectedRoute:Qs,currentPage:fs}},({filteredRouteTree:e,selectedRoute:t,currentPage:n})=>g(Ec,{nodes:e,selected:t,currentPage:n,depth:0})))),g("div",{className:"flex-grow p-2 sticky top-0"},g(Ps,{from:Qs},e=>e&&g(hb,{page:e}))))):g("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},g(lo,null),g("h2",{className:"text-lg italic"},"No file router detected"))}function Ec({nodes:e,selected:t,currentPage:n,depth:i}){return g(Tt,null,e.map(s=>{const o=s.routeKey,r=s.route,a=s.entry,l=o===t,c=n?.route===r,u=s.children.length>0;let f=a.route;if(i>0){const d=a.route.split("/").filter(Boolean);d.length>0&&(f="/"+d[d.length-1])}return g("div",{key:o,className:_i("flex-grow",i>0?"ml-4":"w-full")},g("button",{onclick:()=>Qs.value=o,className:_i("flex items-center gap-2 justify-between px-2 py-1 w-full cursor-pointer rounded","border border-white border-opacity-10 group",l?" bg-white bg-opacity-5 text-neutral-100":" hover:[&:not(:group-hover)]:bg-white/10 hover:[&:not(:group-hover)]:text-neutral-100 text-neutral-400")},g("span",{className:"text-sm"},f),c?g("div",{className:"flex items-center gap-2 relative"},g("span",{className:"text-xs text-neutral-300 bg-white/15 rounded px-1 py-0.5 font-medium"},"Current"),g("button",{className:"flex items-center gap-2 text-neutral-400 hover:text-neutral-100 hover:bg-white/10 rounded p-1",onclick:d=>{d.stopPropagation(),qt.reload()}},g(ml,{className:"w-4 h-4"})),a.params.length>0&&g(Na,{entry:a,route:a.route})):g("div",{className:"flex invisible items-center gap-2 relative group-hover:visible"},g(Na,{entry:a,route:a.route}))),u&&g("div",{className:"mt-1 flex flex-col gap-1"},g(Ec,{nodes:s.children,selected:t,currentPage:n,depth:i+1})))}))}function Na({route:e,entry:t}){return g("button",{className:"flex items-center gap-2 text-neutral-400 hover:text-neutral-100 hover:bg-white/10 rounded p-1",onclick:n=>{if(n.stopPropagation(),!t.params.length)return qt.navigate(e);let i={};for(let o=0;o<t.params.length;o++){const r=t.params[o],a=prompt(\`Enter value for "\${r}"\`);if(!a){alert("Navigation cancelled");return}i[r]=a}const s=t.route.split("/").filter(o=>!o.startsWith("(")&&!o.endsWith(")")).map(o=>o.startsWith("[...")&&o.endsWith("]")?i[o.slice(4,-1)]:o.startsWith("[")&&o.endsWith("]")?i[o.slice(1,-1)]:o).filter(Boolean).join("/");qt.navigate(\`/\${s}\`)}},g(Th,{className:"w-4 h-4"}))}function hb({page:e}){const n=qt.getPages()[e],i=dh(async()=>(await new Promise(s=>setTimeout(s,150)),await n.load()),[e]);return g(Ps,{from:i,fallback:g("div",null,"Loading...")},(s,o)=>{const{default:r,config:a}=s;return g("div",{className:\`transition-opacity \${o?"opacity-75":""}\`},g("h2",{className:"flex justify-between items-center font-bold mb-2 pb-2 border-b-2 border-neutral-800"},g("div",{className:"flex gap-2 items-center"},\`<\${ao({type:r})}>\`,g(Hi,{fn:r}))),a?g("div",{className:"flex items-center gap-2"},g("span",{className:"text-sm text-neutral-400"},"Config:"),g(me,{data:a,mutable:!1,objectRefAcc:[],keys:[],onChange:()=>{}})):g("i",{className:"text-sm text-neutral-400"},"No config"))})}const fb=e=>e.active?g("main",{className:"flex flex-col flex-1 max-h-[calc(100vh-1rem)] overflow-y-auto"},e.children):null,Js={Apps:{Icon:xh,View:Zh},FileRouter:{Icon:_h,View:ub},Stores:{Icon:kh,View:tf},SWR:{Icon:Sh,View:sb},Profiling:{Icon:wh,View:tb},Settings:{Icon:yh,View:Eh}},Li=G("Apps");let Fa=oe.peek();oe.subscribe(e=>{e!==Fa&&e!==null&&(Li.value="Apps"),Fa=e});function db(){return g(Mh,null,g("nav",{className:"flex flex-col gap-2 justify-between p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},g("div",{className:"flex flex-col gap-2"},Object.keys(Js).map(e=>g(pb,{key:e,title:e})))),Object.entries(Js).map(([e,{View:t}])=>g(fb,{key:e,active:Li.value===e},g(t,null))))}function pb({title:e}){const{Icon:t}=Js[e];return g("button",{key:e,onclick:()=>{Li.value=e},className:"flex items-center px-2 py-1 gap-2 rounded border text-xs border-white border-opacity-10"+(Li.value===e?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400"),title:e},g(t,{className:"text-primary"}),g("span",{className:"hidden sm:inline"},e))}rh(g(db,null),document.getElementById("app"));Fe.send({type:"ready"});setInterval(()=>{window.opener||window.close()},250);</script>
|
|
9776
|
+
*/const zn=e=>e&&e.enabled&&e.modifierKey,dc=(e,t)=>e&&t[e+"Key"],Po=(e,t)=>e&&!t[e+"Key"];function de(e,t,n){return e===void 0?!0:typeof e=="string"?e.indexOf(t)!==-1:typeof e=="function"?e({chart:n}).indexOf(t)!==-1:!1}function ds(e,t){return typeof e=="function"&&(e=e({chart:t})),typeof e=="string"?{x:e.indexOf("x")!==-1,y:e.indexOf("y")!==-1}:{x:!1,y:!1}}function mm(e,t){let n;return function(){return clearTimeout(n),n=setTimeout(e,t),t}}function bm({x:e,y:t},n){const i=n.scales,s=Object.keys(i);for(let o=0;o<s.length;o++){const r=i[s[o]];if(t>=r.top&&t<=r.bottom&&e>=r.left&&e<=r.right)return r}return null}function pc(e,t,n){const{mode:i="xy",scaleMode:s,overScaleMode:o}=e||{},r=bm(t,n),a=ds(i,n),l=ds(s,n);if(o){const u=ds(o,n);for(const f of["x","y"])u[f]&&(l[f]=a[f],a[f]=!1)}if(r&&l[r.axis])return[r];const c=[];return F(n.scales,function(u){a[u.axis]&&c.push(u)}),c}const qs=new WeakMap;function $(e){let t=qs.get(e);return t||(t={originalScaleLimits:{},updatedScaleLimits:{},handlers:{},panDelta:{},dragging:!1,panning:!1},qs.set(e,t)),t}function ym(e){qs.delete(e)}function gc(e,t,n,i){const s=Math.max(0,Math.min(1,(e-t)/n||0)),o=1-s;return{min:i*s,max:i*o}}function mc(e,t){const n=e.isHorizontal()?t.x:t.y;return e.getValueForPixel(n)}function bc(e,t,n){const i=e.max-e.min,s=i*(t-1),o=mc(e,n);return gc(o,e.min,i,s)}function xm(e,t,n){const i=mc(e,n);if(i===void 0)return{min:e.min,max:e.max};const s=Math.log10(e.min),o=Math.log10(e.max),r=Math.log10(i),a=o-s,l=a*(t-1),c=gc(r,s,a,l);return{min:Math.pow(10,s+c.min),max:Math.pow(10,o-c.max)}}function vm(e,t){return t&&(t[e.id]||t[e.axis])||{}}function wa(e,t,n,i,s){let o=n[i];if(o==="original"){const r=e.originalScaleLimits[t.id][i];o=N(r.options,r.scale)}return N(o,s)}function _m(e,t,n){const i=e.getValueForPixel(t),s=e.getValueForPixel(n);return{min:Math.min(i,s),max:Math.max(i,s)}}function wm(e,{min:t,max:n,minLimit:i,maxLimit:s},o){const r=(e-n+t)/2;t-=r,n+=r;const a=o.min.options??o.min.scale,l=o.max.options??o.max.scale,c=e/1e6;return Ne(t,a,c)&&(t=a),Ne(n,l,c)&&(n=l),t<i?(t=i,n=Math.min(i+e,s)):n>s&&(n=s,t=Math.max(s-e,i)),{min:t,max:n}}function $e(e,{min:t,max:n},i,s=!1){const o=$(e.chart),{options:r}=e,a=vm(e,i),{minRange:l=0}=a,c=wa(o,e,a,"min",-1/0),u=wa(o,e,a,"max",1/0);if(s==="pan"&&(t<c||n>u))return!0;const f=e.max-e.min,d=s?Math.max(n-t,l):f;if(s&&d===l&&f<=l)return!0;const m=wm(d,{min:t,max:n,minLimit:c,maxLimit:u},o.originalScaleLimits[e.id]);return r.min=m.min,r.max=m.max,o.updatedScaleLimits[e.id]=m,e.parse(m.min)!==e.min||e.parse(m.max)!==e.max}function Sm(e,t,n,i){const s=bc(e,t,n),o={min:e.min+s.min,max:e.max-s.max};return $e(e,o,i,!0)}function km(e,t,n,i){const s=xm(e,t,n);return $e(e,s,i,!0)}function Tm(e,t,n,i){$e(e,_m(e,t,n),i,!0)}const Sa=e=>e===0||isNaN(e)?0:e<0?Math.min(Math.round(e),-1):Math.max(Math.round(e),1);function Mm(e){const n=e.getLabels().length-1;e.min>0&&(e.min-=1),e.max<n&&(e.max+=1)}function Em(e,t,n,i){const s=bc(e,t,n);e.min===e.max&&t<1&&Mm(e);const o={min:e.min+Sa(s.min),max:e.max-Sa(s.max)};return $e(e,o,i,!0)}function Cm(e){return e.isHorizontal()?e.width:e.height}function Om(e,t,n){const s=e.getLabels().length-1;let{min:o,max:r}=e;const a=Math.max(r-o,1),l=Math.round(Cm(e)/Math.max(a,10)),c=Math.round(Math.abs(t/l));let u;return t<-l?(r=Math.min(r+c,s),o=a===1?r:r-a,u=r===s):t>l&&(o=Math.max(0,o-c),r=a===1?o:o+a,u=o===0),$e(e,{min:o,max:r},n)||u}const Pm={second:500,minute:30*1e3,hour:1800*1e3,day:720*60*1e3,week:3.5*24*60*60*1e3,month:360*60*60*1e3,quarter:1440*60*60*1e3,year:4368*60*60*1e3};function yc(e,t,n,i=!1){const{min:s,max:o,options:r}=e,a=r.time&&r.time.round,l=Pm[a]||0,c=e.getValueForPixel(e.getPixelForValue(s+l)-t),u=e.getValueForPixel(e.getPixelForValue(o+l)-t);return isNaN(c)||isNaN(u)?!0:$e(e,{min:c,max:u},n,i?"pan":!1)}function ka(e,t,n){return yc(e,t,n,!0)}const Gs={category:Em,default:Sm,logarithmic:km},Ks={default:Tm},Zs={category:Om,default:yc,logarithmic:ka,timeseries:ka};function Dm(e,t,n){const{id:i,options:{min:s,max:o}}=e;if(!t[i]||!n[i])return!0;const r=n[i];return r.min!==s||r.max!==o}function Ta(e,t){F(e,(n,i)=>{t[i]||delete e[i]})}function an(e,t){const{scales:n}=e,{originalScaleLimits:i,updatedScaleLimits:s}=t;return F(n,function(o){Dm(o,i,s)&&(i[o.id]={min:{scale:o.min,options:o.options.min},max:{scale:o.max,options:o.options.max}})}),Ta(i,n),Ta(s,n),i}function Ma(e,t,n,i){const s=Gs[e.type]||Gs.default;I(s,[e,t,n,i])}function Ea(e,t,n,i){const s=Ks[e.type]||Ks.default;I(s,[e,t,n,i])}function Am(e){const t=e.chartArea;return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function Do(e,t,n="none",i="api"){const{x:s=1,y:o=1,focalPoint:r=Am(e)}=typeof t=="number"?{x:t,y:t}:t,a=$(e),{options:{limits:l,zoom:c}}=a;an(e,a);const u=s!==1,f=o!==1,d=pc(c,r,e);F(d||e.scales,function(m){m.isHorizontal()&&u?Ma(m,s,r,l):!m.isHorizontal()&&f&&Ma(m,o,r,l)}),e.update(n),I(c.onZoom,[{chart:e,trigger:i}])}function xc(e,t,n,i="none",s="api"){const o=$(e),{options:{limits:r,zoom:a}}=o,{mode:l="xy"}=a;an(e,o);const c=de(l,"x",e),u=de(l,"y",e);F(e.scales,function(f){f.isHorizontal()&&c?Ea(f,t.x,n.x,r):!f.isHorizontal()&&u&&Ea(f,t.y,n.y,r)}),e.update(i),I(a.onZoom,[{chart:e,trigger:s}])}function Im(e,t,n,i="none",s="api"){const o=$(e);an(e,o);const r=e.scales[t];$e(r,n,void 0,!0),e.update(i),I(o.options.zoom?.onZoom,[{chart:e,trigger:s}])}function Lm(e,t="default"){const n=$(e),i=an(e,n);F(e.scales,function(s){const o=s.options;i[s.id]?(o.min=i[s.id].min.options,o.max=i[s.id].max.options):(delete o.min,delete o.max),delete n.updatedScaleLimits[s.id]}),e.update(t),I(n.options.zoom.onZoomComplete,[{chart:e}])}function Nm(e,t){const n=e.originalScaleLimits[t];if(!n)return;const{min:i,max:s}=n;return N(s.options,s.scale)-N(i.options,i.scale)}function Rm(e){const t=$(e);let n=1,i=1;return F(e.scales,function(s){const o=Nm(t,s.id);if(o){const r=Math.round(o/(s.max-s.min)*100)/100;n=Math.min(n,r),i=Math.max(i,r)}}),n<1?n:i}function Ca(e,t,n,i){const{panDelta:s}=i,o=s[e.id]||0;fe(o)===fe(t)&&(t+=o);const r=Zs[e.type]||Zs.default;I(r,[e,t,n])?s[e.id]=0:s[e.id]=t}function vc(e,t,n,i="none"){const{x:s=0,y:o=0}=typeof t=="number"?{x:t,y:t}:t,r=$(e),{options:{pan:a,limits:l}}=r,{onPan:c}=a||{};an(e,r);const u=s!==0,f=o!==0;F(n||e.scales,function(d){d.isHorizontal()&&u?Ca(d,s,l,r):!d.isHorizontal()&&f&&Ca(d,o,l,r)}),e.update(i),I(c,[{chart:e}])}function _c(e){const t=$(e);an(e,t);const n={};for(const i of Object.keys(e.scales)){const{min:s,max:o}=t.originalScaleLimits[i]||{min:{},max:{}};n[i]={min:s.scale,max:o.scale}}return n}function Fm(e){const t=$(e),n={};for(const i of Object.keys(e.scales))n[i]=t.updatedScaleLimits[i];return n}function zm(e){const t=_c(e);for(const n of Object.keys(e.scales)){const{min:i,max:s}=t[n];if(i!==void 0&&e.scales[n].min!==i||s!==void 0&&e.scales[n].max!==s)return!0}return!1}function Oa(e){const t=$(e);return t.panning||t.dragging}const Pa=(e,t,n)=>Math.min(n,Math.max(t,e));function ct(e,t){const{handlers:n}=$(e),i=n[t];i&&i.target&&(i.target.removeEventListener(t,i),delete n[t])}function An(e,t,n,i){const{handlers:s,options:o}=$(e),r=s[n];if(r&&r.target===t)return;ct(e,n),s[n]=l=>i(e,l,o),s[n].target=t;const a=n==="wheel"?!1:void 0;t.addEventListener(n,s[n],{passive:a})}function Hm(e,t){const n=$(e);n.dragStart&&(n.dragging=!0,n.dragEnd=t,e.update("none"))}function Vm(e,t){const n=$(e);!n.dragStart||t.key!=="Escape"||(ct(e,"keydown"),n.dragging=!1,n.dragStart=n.dragEnd=null,e.update("none"))}function Qs(e,t){if(e.target!==t.canvas){const n=t.canvas.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}return It(e,t)}function wc(e,t,n){const{onZoomStart:i,onZoomRejected:s}=n;if(i){const o=Qs(t,e);if(I(i,[{chart:e,event:t,point:o}])===!1)return I(s,[{chart:e,event:t}]),!1}}function Bm(e,t){if(e.legend){const o=It(t,e);if(en(o,e.legend))return}const n=$(e),{pan:i,zoom:s={}}=n.options;if(t.button!==0||dc(zn(i),t)||Po(zn(s.drag),t))return I(s.onZoomRejected,[{chart:e,event:t}]);wc(e,t,s)!==!1&&(n.dragStart=t,An(e,e.canvas.ownerDocument,"mousemove",Hm),An(e,window.document,"keydown",Vm))}function Wm({begin:e,end:t},n){let i=t.x-e.x,s=t.y-e.y;const o=Math.abs(i/s);o>n?i=Math.sign(i)*Math.abs(s*n):o<n&&(s=Math.sign(s)*Math.abs(i/n)),t.x=e.x+i,t.y=e.y+s}function Da(e,t,n,{min:i,max:s,prop:o}){e[i]=Pa(Math.min(n.begin[o],n.end[o]),t[i],t[s]),e[s]=Pa(Math.max(n.begin[o],n.end[o]),t[i],t[s])}function jm(e,t,n){const i={begin:Qs(t.dragStart,e),end:Qs(t.dragEnd,e)};if(n){const s=e.chartArea.width/e.chartArea.height;Wm(i,s)}return i}function Sc(e,t,n,i){const s=de(t,"x",e),o=de(t,"y",e),{top:r,left:a,right:l,bottom:c,width:u,height:f}=e.chartArea,d={top:r,left:a,right:l,bottom:c},m=jm(e,n,i&&s&&o);s&&Da(d,e.chartArea,m,{min:"left",max:"right",prop:"x"}),o&&Da(d,e.chartArea,m,{min:"top",max:"bottom",prop:"y"});const x=d.right-d.left,y=d.bottom-d.top;return{...d,width:x,height:y,zoomX:s&&x?1+(u-x)/u:1,zoomY:o&&y?1+(f-y)/f:1}}function $m(e,t){const n=$(e);if(!n.dragStart)return;ct(e,"mousemove");const{mode:i,onZoomComplete:s,drag:{threshold:o=0,maintainAspectRatio:r}}=n.options.zoom,a=Sc(e,i,{dragStart:n.dragStart,dragEnd:t},r),l=de(i,"x",e)?a.width:0,c=de(i,"y",e)?a.height:0,u=Math.sqrt(l*l+c*c);if(n.dragStart=n.dragEnd=null,u<=o){n.dragging=!1,e.update("none");return}xc(e,{x:a.left,y:a.top},{x:a.right,y:a.bottom},"zoom","drag"),n.dragging=!1,n.filterNextClick=!0,I(s,[{chart:e}])}function Um(e,t,n){if(Po(zn(n.wheel),t)){I(n.onZoomRejected,[{chart:e,event:t}]);return}if(wc(e,t,n)!==!1&&(t.cancelable&&t.preventDefault(),t.deltaY!==void 0))return!0}function Ym(e,t){const{handlers:{onZoomComplete:n},options:{zoom:i}}=$(e);if(!Um(e,t,i))return;const s=t.target.getBoundingClientRect(),o=i.wheel.speed,r=t.deltaY>=0?2-1/(1-o):1+o,a={x:r,y:r,focalPoint:{x:t.clientX-s.left,y:t.clientY-s.top}};Do(e,a,"zoom","wheel"),I(n,[{chart:e}])}function Xm(e,t,n,i){n&&($(e).handlers[t]=mm(()=>I(n,[{chart:e}]),i))}function qm(e,t){const n=e.canvas,{wheel:i,drag:s,onZoomComplete:o}=t.zoom;i.enabled?(An(e,n,"wheel",Ym),Xm(e,"onZoomComplete",o,250)):ct(e,"wheel"),s.enabled?(An(e,n,"mousedown",Bm),An(e,n.ownerDocument,"mouseup",$m)):(ct(e,"mousedown"),ct(e,"mousemove"),ct(e,"mouseup"),ct(e,"keydown"))}function Gm(e){ct(e,"mousedown"),ct(e,"mousemove"),ct(e,"mouseup"),ct(e,"wheel"),ct(e,"click"),ct(e,"keydown")}function Km(e,t){return function(n,i){const{pan:s,zoom:o={}}=t.options;if(!s||!s.enabled)return!1;const r=i&&i.srcEvent;return r&&!t.panning&&i.pointerType==="mouse"&&(Po(zn(s),r)||dc(zn(o.drag),r))?(I(s.onPanRejected,[{chart:e,event:i}]),!1):!0}}function Zm(e,t){const n=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY),s=n/i;let o,r;return s>.3&&s<1.7?o=r=!0:n>i?o=!0:r=!0,{x:o,y:r}}function kc(e,t,n){if(t.scale){const{center:i,pointers:s}=n,o=1/t.scale*n.scale,r=n.target.getBoundingClientRect(),a=Zm(s[0],s[1]),l=t.options.zoom.mode,c={x:a.x&&de(l,"x",e)?o:1,y:a.y&&de(l,"y",e)?o:1,focalPoint:{x:i.x-r.left,y:i.y-r.top}};Do(e,c,"zoom","pinch"),t.scale=n.scale}}function Qm(e,t,n){if(t.options.zoom.pinch.enabled){const i=It(n,e);I(t.options.zoom.onZoomStart,[{chart:e,event:n,point:i}])===!1?(t.scale=null,I(t.options.zoom.onZoomRejected,[{chart:e,event:n}])):t.scale=1}}function Jm(e,t,n){t.scale&&(kc(e,t,n),t.scale=null,I(t.options.zoom.onZoomComplete,[{chart:e}]))}function Tc(e,t,n){const i=t.delta;i&&(t.panning=!0,vc(e,{x:n.deltaX-i.x,y:n.deltaY-i.y},t.panScales),t.delta={x:n.deltaX,y:n.deltaY})}function tb(e,t,n){const{enabled:i,onPanStart:s,onPanRejected:o}=t.options.pan;if(!i)return;const r=n.target.getBoundingClientRect(),a={x:n.center.x-r.left,y:n.center.y-r.top};if(I(s,[{chart:e,event:n,point:a}])===!1)return I(o,[{chart:e,event:n}]);t.panScales=pc(t.options.pan,a,e),t.delta={x:0,y:0},Tc(e,t,n)}function eb(e,t){t.delta=null,t.panning&&(t.panning=!1,t.filterNextClick=!0,I(t.options.pan.onPanComplete,[{chart:e}]))}const Js=new WeakMap;function Aa(e,t){const n=$(e),i=e.canvas,{pan:s,zoom:o}=t,r=new Dn.Manager(i);o&&o.pinch.enabled&&(r.add(new Dn.Pinch),r.on("pinchstart",a=>Qm(e,n,a)),r.on("pinch",a=>kc(e,n,a)),r.on("pinchend",a=>Jm(e,n,a))),s&&s.enabled&&(r.add(new Dn.Pan({threshold:s.threshold,enable:Km(e,n)})),r.on("panstart",a=>tb(e,n,a)),r.on("panmove",a=>Tc(e,n,a)),r.on("panend",()=>eb(e,n))),Js.set(e,r)}function Ia(e){const t=Js.get(e);t&&(t.remove("pinchstart"),t.remove("pinch"),t.remove("pinchend"),t.remove("panstart"),t.remove("pan"),t.remove("panend"),t.destroy(),Js.delete(e))}function nb(e,t){const{pan:n,zoom:i}=e,{pan:s,zoom:o}=t;return i?.zoom?.pinch?.enabled!==o?.zoom?.pinch?.enabled||n?.enabled!==s?.enabled||n?.threshold!==s?.threshold}var ib="2.2.0";function gi(e,t,n){const i=n.zoom.drag,{dragStart:s,dragEnd:o}=$(e);if(i.drawTime!==t||!o)return;const{left:r,top:a,width:l,height:c}=Sc(e,n.zoom.mode,{dragStart:s,dragEnd:o},i.maintainAspectRatio),u=e.ctx;u.save(),u.beginPath(),u.fillStyle=i.backgroundColor||"rgba(225,225,225,0.3)",u.fillRect(r,a,l,c),i.borderWidth>0&&(u.lineWidth=i.borderWidth,u.strokeStyle=i.borderColor||"rgba(225,225,225)",u.strokeRect(r,a,l,c)),u.restore()}var sb={id:"zoom",version:ib,defaults:{pan:{enabled:!1,mode:"xy",threshold:10,modifierKey:null},zoom:{wheel:{enabled:!1,speed:.1,modifierKey:null},drag:{enabled:!1,drawTime:"beforeDatasetsDraw",modifierKey:null},pinch:{enabled:!1},mode:"xy"}},start:function(e,t,n){const i=$(e);i.options=n,Object.prototype.hasOwnProperty.call(n.zoom,"enabled")&&console.warn("The option \`zoom.enabled\` is no longer supported. Please use \`zoom.wheel.enabled\`, \`zoom.drag.enabled\`, or \`zoom.pinch.enabled\`."),(Object.prototype.hasOwnProperty.call(n.zoom,"overScaleMode")||Object.prototype.hasOwnProperty.call(n.pan,"overScaleMode"))&&console.warn("The option \`overScaleMode\` is deprecated. Please use \`scaleMode\` instead (and update \`mode\` as desired)."),Dn&&Aa(e,n),e.pan=(s,o,r)=>vc(e,s,o,r),e.zoom=(s,o)=>Do(e,s,o),e.zoomRect=(s,o,r)=>xc(e,s,o,r),e.zoomScale=(s,o,r)=>Im(e,s,o,r),e.resetZoom=s=>Lm(e,s),e.getZoomLevel=()=>Rm(e),e.getInitialScaleBounds=()=>_c(e),e.getZoomedScaleBounds=()=>Fm(e),e.isZoomedOrPanned=()=>zm(e),e.isZoomingOrPanning=()=>Oa(e)},beforeEvent(e,{event:t}){if(Oa(e))return!1;if(t.type==="click"||t.type==="mouseup"){const n=$(e);if(n.filterNextClick)return n.filterNextClick=!1,!1}},beforeUpdate:function(e,t,n){const i=$(e),s=i.options;i.options=n,nb(s,n)&&(Ia(e),Aa(e,n)),qm(e,n)},beforeDatasetsDraw(e,t,n){gi(e,"beforeDatasetsDraw",n)},afterDatasetsDraw(e,t,n){gi(e,"afterDatasetsDraw",n)},beforeDraw(e,t,n){gi(e,"beforeDraw",n)},afterDraw(e,t,n){gi(e,"afterDraw",n)},stop:function(e){Gm(e),Dn&&Ia(e),ym(e)},panFunctions:Zs,zoomFunctions:Gs,zoomRectFunctions:Ks};function ob({data:e,...t}){const n=He(null),i=He(null);return rt(()=>{Ys.register(sb,cm,wp,rm,Wg,Bg,qg,nm);const s=i.current,o=n.current=new Ys(s,{type:"line",data:e.peek(),options:{scales:{y:{min:0}},animation:!1,responsive:!0,plugins:{zoom:{pan:{enabled:!0,mode:"x"},zoom:{wheel:{enabled:!0},mode:"x"}},legend:{position:"top"},title:{display:!1}}}}),r=e.subscribe(a=>{o.data=a,o.update()});return()=>{o.destroy(),r()}},[]),g("canvas",{ref:i,...t})}function rb(){const e=ge();rt(()=>{const n=i=>{In(i)||e()};return U?.on("mount",n),U?.on("unmount",n),()=>{U?.off("mount",n),U?.off("unmount",n)}},[]);const t=U?.profilingContext;return g("div",{className:"flex flex-col gap-2"},bl(t.appStats).filter(([n])=>!In(n)).map(([n])=>g(ab,{key:n.id,app:n})))}const La=100,Na=e=>Object.entries(e).map(([t,{values:n,color:i}])=>({label:t,data:n,fill:!1,borderColor:i,tension:.1}));function ab({app:e}){const t=ge(),n=He({update:{values:[0],color:"#ad981f"},updateDirtied:{values:[0],color:"#b21f3a"},createNode:{values:[0],color:"#198019"},removeNode:{values:[0],color:"#5F3691"},updateNode:{values:[0],color:"#2f2f9d"},signalAttrUpdate:{values:[0],color:"#28888f"},signalTextUpdate:{values:[0],color:"#9b3b98"}}),i=J({labels:[(performance.now()/1e3).toFixed(2)],datasets:Na(n.current)}),s=J(!1),o=U?.profilingContext;return rt(()=>{const r=a=>{a.id===e.id&&t()};return U?.on("update",r),()=>U?.off("update",r)},[]),rt(()=>{const r=[];Object.entries(n.current).forEach(([l,{values:c}])=>{const u=d=>{d.id===e.id&&s.peek()!==!0&&c[c.length-1]++},f=l;o.addEventListener(f,u),r.push(()=>o.removeEventListener(f,u))});const a=setInterval(()=>{if(s.peek()===!0)return;const l=[...i.value.labels];Object.values(n.current).forEach(c=>{c.values.push(0),c.values.length>La&&c.values.shift()}),l.push((performance.now()/1e3).toFixed(2)),l.length>La&&l.shift(),i.value={labels:l,datasets:Na(n.current)}},100);return()=>{r.forEach(l=>l()),clearInterval(a)}},[]),g("div",{className:"flex flex-col gap-2 border border-white border-opacity-10 rounded bg-neutral-400 bg-opacity-5 text-neutral-400 p-2"},g("div",{className:"grid items-start gap-2",style:"grid-template-columns: 1fr max-content;"},g("div",{className:"flex flex-col gap-2"},g("span",null,e.name),g(ob,{data:i,className:"w-full max-w-full min-h-20 bg-black bg-opacity-30",onmouseenter:()=>s.value=!0,onmouseleave:()=>s.value=!1})),g("div",{className:"text-xs grid grid-cols-2 gap-x-4",style:"grid-template-columns: auto auto;"},g("span",{className:"text-right"},"Mount duration:"),o.mountDuration(e).toFixed(2)," ms",g("span",{className:"text-right"},"Total updates:"),g("span",null,o.totalTicks(e).toLocaleString()),g("span",{className:"text-right"},"Avg. update duration:"),o.averageTickDuration(e).toFixed(2)," ms",g("span",{className:"text-right"},"Latest update:"),g("span",null,o.lastTickDuration(e).toFixed(2)," ms"))))}const wn=G([]),Mc=G(""),lb=Bn(()=>Mc.value.toLowerCase().split(" ").filter(e=>e.length>0));function cb(e){return lb.value.every(t=>e.toLowerCase().includes(t))}function ub(){const e=ge();rt(()=>{const n=i=>{In(i)||e()};return U?.on("update",n),()=>U?.off("update",n)},[]);const t=U?.SWRGlobalCache??new Map;return t.size===0?g("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},g(uo,null),g("h2",{className:"text-lg italic"},"No SWR detected")):g("div",{className:"flex flex-col gap-2 items-start"},g(po,{value:Mc,className:"sticky top-0"}),g("div",{className:"flex flex-col gap-2 w-full"},bl(t).filter(([n])=>cb(n)).map(([n,i])=>g(hb,{key:n,entry:i}))))}function hb({key:e,entry:t}){const n=wn.value.includes(e),i=ge();rt(()=>{const{resource:o,isValidating:r,isMutating:a}=t,l=[o.subscribe(i),r.subscribe(i),a.subscribe(i)];return()=>l.forEach(c=>c())},[]);const s=Ke(()=>{n?wn.value=wn.value.filter(o=>o!==e):wn.value=[...wn.value,e]},[n]);return g("div",{className:"flex flex-col"},g("button",{onclick:s,className:"flex items-center gap-2 justify-between p-2 border border-white border-opacity-10 cursor-pointer"+(n?" bg-white bg-opacity-5 text-neutral-100 rounded-t":" hover:bg-white hover:bg-opacity-10 text-neutral-400 rounded")},e,g(ue,{className:"transition-all"+(n?" rotate-90":"")})),n&&g("div",{className:"flex flex-col gap-2 p-2 border border-white border-opacity-10"},g(be,{data:{resource:t.resource.peek(),isMutating:t.isMutating.peek(),isValidating:t.isValidating.peek()},mutable:!1,objectRefAcc:[],keys:[],onChange:()=>{}})))}const qt=U.fileRouterInstance?.current?.devtools,xi=G({}),ps=G(null),Ra=G({});function fb(e){const t=new Map,n=new Map,i=[];function s(a){return a.filter(l=>!(l.startsWith("(")&&l.endsWith(")")))}function o(a){return"/"+s(a).join("/")}for(const[a,l]of Object.entries(e)){const c=l.route,u=s(l.segments),f=o(u),d={routeKey:a,route:c,entry:l,children:[]};t.set(c,d),n.set(f,d)}for(const[,a]of Object.entries(e)){const l=a.route,c=a.segments,u=t.get(l),f=s(c);if(f.length>1){const d=f.slice(0,-1),m=o(d),x=n.get(m);x?x.children.push(u):i.push(u)}else i.push(u)}function r(a){return a.sort((l,c)=>l.route.localeCompare(c.route)).map(l=>({...l,children:r(l.children)}))}return r(i)}const db=Bn(()=>fb(xi.value)),to=G(null),Ec=G(""),Fa=Bn(()=>Ec.value.toLowerCase().split(" ").filter(e=>e.length>0));function pb(e,t){if(Fa.value.length===0)return!0;const n=(e+" "+t.filePath).toLowerCase();return Fa.value.every(i=>n.includes(i))}function Cc(e){return e.map(t=>{const n=Cc(t.children);return pb(t.route,t.entry)||n.length>0?{...t,children:n}:null}).filter(t=>t!==null)}const gb=Bn(()=>Cc(db.value));function mb(){return rt(()=>{if(!qt){xi.value={},ps.value=null,Ra.value={};return}xi.value=qt.getPages(),console.log(xi.value);const e=qt.subscribe((t,n)=>{ps.value=t,Ra.value=n});return()=>e()},[qt]),qt?g(Tt,null,g(Ml,null,g("div",{className:"flex-grow sticky pr-2 top-0 flex flex-col gap-2"},g(po,{value:Ec,className:"sticky top-0"}),g("div",{className:"flex-grow flex flex-col gap-1 items-start"},g(As,{from:{filteredRouteTree:gb,selectedRoute:to,currentPage:ps}},({filteredRouteTree:e,selectedRoute:t,currentPage:n})=>g(Oc,{nodes:e,selected:t,currentPage:n,depth:0})))),g("div",{className:"flex-grow p-2 sticky top-0"},g(As,{from:to},e=>e&&g(bb,{page:e}))))):g("div",{className:"flex flex-col items-center justify-center h-full text-neutral-400"},g(uo,null),g("h2",{className:"text-lg italic"},"No file router detected"))}function Oc({nodes:e,selected:t,currentPage:n,depth:i}){return g(Tt,null,e.map(s=>{const o=s.routeKey,r=s.route,a=s.entry,l=o===t,c=n?.route===r,u=s.children.length>0;let f=a.route;if(i>0){const d=a.route.split("/").filter(Boolean);d.length>0&&(f="/"+d[d.length-1])}return g("div",{key:o,className:_i("flex-grow",i>0?"ml-4":"w-full")},g("button",{onclick:()=>to.value=o,className:_i("flex items-center gap-2 justify-between px-2 py-1 w-full cursor-pointer rounded","border border-white border-opacity-10 group",l?" bg-white bg-opacity-5 text-neutral-100":" hover:[&:not(:group-hover)]:bg-white/10 hover:[&:not(:group-hover)]:text-neutral-100 text-neutral-400")},g("span",{className:"text-sm"},f),c?g("div",{className:"flex items-center gap-2 relative"},g("span",{className:"text-xs text-neutral-300 bg-white/15 rounded px-1 py-0.5 font-medium"},"Current"),g("button",{className:"flex items-center gap-2 text-neutral-400 hover:text-neutral-100 hover:bg-white/10 rounded p-1",onclick:d=>{d.stopPropagation(),qt.reload()}},g(yl,{className:"w-4 h-4"})),a.params.length>0&&g(za,{entry:a,route:a.route})):g("div",{className:"flex invisible items-center gap-2 relative group-hover:visible"},g(za,{entry:a,route:a.route}))),u&&g("div",{className:"mt-1 flex flex-col gap-1"},g(Oc,{nodes:s.children,selected:t,currentPage:n,depth:i+1})))}))}function za({route:e,entry:t}){return g("button",{className:"flex items-center gap-2 text-neutral-400 hover:text-neutral-100 hover:bg-white/10 rounded p-1",onclick:n=>{if(n.stopPropagation(),!t.params.length)return qt.navigate(e);let i={};for(let o=0;o<t.params.length;o++){const r=t.params[o],a=prompt(\`Enter value for "\${r}"\`);if(!a){alert("Navigation cancelled");return}i[r]=a}const s=t.route.split("/").filter(o=>!o.startsWith("(")&&!o.endsWith(")")).map(o=>o.startsWith("[...")&&o.endsWith("]")?i[o.slice(4,-1)]:o.startsWith("[")&&o.endsWith("]")?i[o.slice(1,-1)]:o).filter(Boolean).join("/");qt.navigate(\`/\${s}\`)}},g(Dh,{className:"w-4 h-4"}))}function bb({page:e}){const n=qt.getPages()[e],i=xh(async()=>(await new Promise(s=>setTimeout(s,150)),await n.load()),[e]);return g(As,{from:i,fallback:g("div",null,"Loading...")},(s,o)=>{const{default:r,config:a}=s;return g("div",{className:\`transition-opacity \${o?"opacity-75":""}\`},g("h2",{className:"flex justify-between items-center font-bold mb-2 pb-2 border-b-2 border-neutral-800"},g("div",{className:"flex gap-2 items-center"},\`<\${co({type:r})}>\`,g(Bi,{fn:r}))),a?g("div",{className:"flex items-center gap-2"},g("span",{className:"text-sm text-neutral-400"},"Config:"),g(be,{data:a,mutable:!1,objectRefAcc:[],keys:[],onChange:()=>{}})):g("i",{className:"text-sm text-neutral-400"},"No config"))})}const yb=e=>e.active?g("main",{className:"flex flex-col flex-1 max-h-[calc(100vh-1rem)] overflow-y-auto"},e.children):null,eo={Apps:{Icon:kh,View:sf},FileRouter:{Icon:Eh,View:mb},Stores:{Icon:Ph,View:af},SWR:{Icon:Oh,View:ub},Profiling:{Icon:Ch,View:rb},Settings:{Icon:Th,View:Ih}},Li=G("Apps");let Ha=re.peek();re.subscribe(e=>{e!==Ha&&e!==null&&(Li.value="Apps"),Ha=e});function xb(){return g(Ah,null,g("nav",{className:"flex flex-col gap-2 justify-between p-2 bg-neutral-400 bg-opacity-5 border border-white border-opacity-10 rounded"},g("div",{className:"flex flex-col gap-2"},Object.keys(eo).map(e=>g(vb,{key:e,title:e})))),Object.entries(eo).map(([e,{View:t}])=>g(yb,{key:e,active:Li.value===e},g(t,null))))}function vb({title:e}){const{Icon:t}=eo[e];return g("button",{key:e,onclick:()=>{Li.value=e},className:"flex items-center px-2 py-1 gap-2 rounded border text-xs border-white border-opacity-10"+(Li.value===e?" bg-white bg-opacity-5 text-neutral-100":" hover:bg-white hover:bg-opacity-10 text-neutral-400"),title:e},g(t,{className:"text-primary"}),g("span",{className:"hidden sm:inline"},e))}fh(g(xb,null),document.getElementById("app"));Ve.send({type:"ready"});setInterval(()=>{window.opener||window.close()},250);</script>
|
|
9155
9777
|
<style rel="stylesheet" crossorigin>*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.invisible{visibility:hidden}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.top-0{top:0}.z-10{z-index:10}.z-\\[9999\\]{z-index:9999}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.mt-1{margin-top:.25rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-4{height:1rem}.h-5{height:1.25rem}.h-full{height:100%}.max-h-\\[calc\\(100vh-1rem\\)\\]{max-height:calc(100vh - 1rem)}.min-h-20{min-height:5rem}.min-h-screen{min-height:100vh}.w-4{width:1rem}.w-5{width:1.25rem}.w-8{width:2rem}.w-\\[5px\\]{width:5px}.w-full{width:100%}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.scroll-m-12{scroll-margin:3rem}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded{border-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-\\[\\#fff1\\]{border-color:#fff1}.border-neutral-700{--tw-border-opacity: 1;border-color:rgb(64 64 64 / var(--tw-border-opacity, 1))}.border-neutral-800{--tw-border-opacity: 1;border-color:rgb(38 38 38 / var(--tw-border-opacity, 1))}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-opacity-10{--tw-border-opacity: .1}.bg-\\[\\#171616\\]{--tw-bg-opacity: 1;background-color:rgb(23 22 22 / var(--tw-bg-opacity, 1))}.bg-\\[\\#1a1a1a\\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\\[\\#1d1d1d\\]{--tw-bg-opacity: 1;background-color:rgb(29 29 29 / var(--tw-bg-opacity, 1))}.bg-\\[\\#212121\\]{--tw-bg-opacity: 1;background-color:rgb(33 33 33 / var(--tw-bg-opacity, 1))}.bg-\\[\\#ffffff04\\]{background-color:#ffffff04}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-neutral-400{--tw-bg-opacity: 1;background-color:rgb(163 163 163 / var(--tw-bg-opacity, 1))}.bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity, 1))}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity, 1))}.bg-primary{--tw-bg-opacity: 1;background-color:rgb(220 20 60 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\\/15{background-color:#ffffff26}.bg-opacity-30{--tw-bg-opacity: .3}.bg-opacity-5{--tw-bg-opacity: .05}.p-1{padding:.25rem}.p-2{padding:.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-2{padding-bottom:.5rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.text-right{text-align:right}.text-\\[10px\\]{font-size:10px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.italic{font-style:italic}.text-neutral-100{--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity, 1))}.text-neutral-300{--tw-text-opacity: 1;color:rgb(212 212 212 / var(--tw-text-opacity, 1))}.text-neutral-400{--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity, 1))}.text-primary{--tw-text-opacity: 1;color:rgb(220 20 60 / var(--tw-text-opacity, 1))}.accent-red-500{accent-color:#ef4444}.opacity-50{opacity:.5}.opacity-75{opacity:.75}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{color-scheme:dark}#app{min-width:-moz-fit-content;min-width:fit-content;background-image:linear-gradient(#171616,#0e0e0e);color:#fff;min-height:100vh;width:100%;display:flex;flex-direction:row;padding:.5rem;gap:.5rem}select{background:url("data:image/svg+xml,<svg height='10px' width='10px' viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>") no-repeat;background-position:calc(100% - .75rem) center!important;-moz-appearance:none!important;-webkit-appearance:none!important;appearance:none!important;padding-right:2rem!important}select:not([disabled]){cursor:pointer}.last\\:border-b-0:last-child{border-bottom-width:0px}.hover\\:bg-neutral-700:hover{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity, 1))}.hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\\:bg-white\\/10:hover{background-color:#ffffff1a}.hover\\:bg-opacity-10:hover{--tw-bg-opacity: .1}.hover\\:text-neutral-100:hover{--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity, 1))}.hover\\:opacity-100:hover{opacity:1}.focus\\:outline:focus{outline-style:solid}.focus\\:outline-primary:focus{outline-color:#dc143c}.group:hover .group-hover\\:visible{visibility:visible}@media (min-width: 640px){.sm\\:inline{display:inline}}.hover\\:\\[\\&\\:not\\(\\:group-hover\\)\\]\\:bg-white\\/10:not(:group-hover):hover{background-color:#ffffff1a}.hover\\:\\[\\&\\:not\\(\\:group-hover\\)\\]\\:text-neutral-100:not(:group-hover):hover{--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity, 1))}</style>
|
|
9156
9778
|
</head>
|
|
9157
9779
|
<body class="w-full min-h-screen">
|
|
@@ -9162,11 +9784,11 @@ var dist_default = `<!DOCTYPE html>
|
|
|
9162
9784
|
`;
|
|
9163
9785
|
|
|
9164
9786
|
// ../devtools-host/dist/index.js
|
|
9165
|
-
var dist_default2 = `var
|
|
9787
|
+
var dist_default2 = `var Xe="production";if(Xe!=="development"&&Xe!=="production")throw new Error("NODE_ENV must either be set to development or production.");var l=Xe==="development";var Ye=Symbol.for("kiru.signal"),Pt=Symbol.for("kiru.context"),oe=Symbol.for("kiru.contextProvider"),A=Symbol.for("kiru.fragment"),Ze=Symbol.for("kiru.error"),ie=Symbol.for("kiru.hmrAccept"),Re=Symbol.for("kiru.memo"),se=Symbol.for("kiru.errorBoundary"),Je=Symbol.for("kiru.streamData"),Lt=Symbol.for("kiru.devFileLink"),Qe=50;var D=2,O=4,me=8,V=16,De=32,ve=64,J=128,Vt=/^on:?/;var et=new Set(["animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","path","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","title","tspan","use"]),tt=new Set(["allowfullscreen","autofocus","autoplay","async","checked","compact","controls","contenteditable","declare","default","defer","disabled","download","hidden","inert","ismap","multiple","nohref","noresize","noshade","novalidate","nowrap","open","popover","readonly","required","sandbox","scoped","selected","sortable","spellcheck","translate","wrap"]),$t=new Map([["acceptCharset","accept-charset"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["httpEquiv","http-equiv"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]);var _={current:null},X={current:0},M={current:"window"in globalThis?"dom":"string"};var Nt,S=class extends Error{constructor(t){let r=typeof t=="string"?t:t.message;super(r),this[Nt]=!0,typeof t!="string"&&(l&&t?.vNode&&(this.customNodeStack=Br(t.vNode)),this.fatal=t?.fatal)}static isKiruError(t){return t instanceof Error&&t[Ze]===!0}};Nt=Ze;function Br(e){let t=e,r=[];for(;t&&t.parent;)typeof t.type=="function"?r.push(qr(t.type)):typeof t.type=="string"&&r.push(t.type),t=t.parent;let n=typeof e.type=="function"?e:rt(e,o=>typeof o.type=="function");return\`The above error occurred in the <\${It(n?.type||K)}> component:
|
|
9166
9788
|
|
|
9167
9789
|
\${r.map(o=>\` at \${o}\`).join(\`
|
|
9168
9790
|
\`)}
|
|
9169
|
-
\`}function Br(e){let t=$t(e);if(l){let r=Wr(e);r&&(t=\`\${t} (\${r})\`)}return t}function $t(e){return e.displayName??(e.name||"Anonymous Function")}function Wr(e){return e.toString().match(/\\/\\/ \\[kiru_devtools\\]:(.*)/)?.[1]??null}var te={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){It(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){It(e,!1);let t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},Gr=e=>{let t=e.target;!e.isTrusted||!t||te.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},It=(e,t)=>{for(let r in e)if(r.startsWith("on")){let n=r.substring(2);e[t?"addEventListener":"removeEventListener"](n,Gr,{passive:!0})}};var st=!1,rt=!1,Nt=e=>{e.preventDefault(),e.stopPropagation(),rt=!0},le=null;function Ht(){st=!0,le=document.activeElement,le&&le!==document.body&&le.addEventListener("blur",Nt)}function Ft(){rt&&(le.removeEventListener("blur",Nt),le.isConnected&&le.focus(),rt=!1),st=!1}function zt(e){let t=e.type;return t=="#text"?jt(e):Qe.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function jt(e){let{nodeValue:t}=e.props;if(!b.isSignal(t))return document.createTextNode(t);let r=t.peek()??"",n=document.createTextNode(r);return ot(e,n,t),n}function qr(e,t,r){let n=nt.get(e)??{},o=n[t]=i=>{if(st){i.preventDefault(),i.stopPropagation();return}r(i)};return nt.set(e,n),o}var nt=new WeakMap;function Kt(e){let{dom:t,prev:r,props:n,cleanups:o}=e,i=r?.props??{},s=n??{},a=M.current==="hydrate";if(t instanceof Text){let p=s.nodeValue;!b.isSignal(p)&&t.nodeValue!==p&&(t.nodeValue=p);return}let u=[];for(let p in i)u.push(p);for(let p in s)p in i||u.push(p);for(let p=0;p<u.length;p++){let v=u[p],f=i[v],y=s[v];if(Te.isEvent(v)){if(f!==y||a){let E=v.replace(Pt,""),U=E==="focus"||E==="blur",S=nt.get(e);v in i&&t.removeEventListener(E,U?S?.[E]:f),v in s&&t.addEventListener(E,U?qr(e,E,y):y)}continue}if(!(Te.isInternalProp(v)&&v!=="innerHTML")&&f!==y){if(b.isSignal(f)&&o){let E=o[v];E&&(E(),delete o[v])}if(b.isSignal(y)){Jr(e,t,v,y,f);continue}Ae(t,v,y,f)}}let c=i.ref,d=s.ref;c!==d&&(c&&Me(c,null),d&&Me(d,t))}function Xr(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Ut(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(r=>{r.selected=t.indexOf(r.value)>-1})}var Yr={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},Zr=["progress","meter","number","range"];function Jr(e,t,r,n,o){let i=e.cleanups??(e.cleanups={}),[s,a]=r.split(":");if(s!=="bind"){i[r]=n.subscribe((he,Ge)=>{he!==Ge&&(Ae(t,r,he,Ge),l&&window.__kiru.profilingContext?.emit("signalAttrUpdate",N(e)))});let S=n.peek(),D=J(o);if(S===D)return;Ae(t,r,S,D);return}let u=Yr[a];if(!u){l&&console.error(\`[kiru]: \${a} is not a valid element binding attribute.\`);return}let c=t instanceof HTMLSelectElement,d=c?S=>Ut(t,S):S=>t[a]=S,p=S=>{d(S),l&&window.__kiru.profilingContext?.emit("signalAttrUpdate",N(e))},v=S=>{n.sneak(S),n.notify(D=>D!==p)},f;if(a==="value"){let S=Zr.indexOf(t.type)!==-1;f=()=>{let D=t.value;c?D=Xr(t):typeof n.peek()=="number"&&S&&(D=t.valueAsNumber),v(D)}}else f=S=>{let D=S.target[a];a==="currentTime"&&n.peek()===D||v(D)};t.addEventListener(u,f);let y=n.subscribe(p);i[r]=()=>{t.removeEventListener(u,f),y()};let E=n.peek(),U=J(o);E!==U&&Ae(t,a,E,U)}function ot(e,t,r){(e.cleanups??(e.cleanups={})).nodeValue=r.subscribe((n,o)=>{n!==o&&(t.nodeValue=n,l&&window.__kiru.profilingContext?.emit("signalTextUpdate",N(e)))})}function Qr(e){if(e.type!=="#text"||!b.isSignal(e.props.nodeValue))return;let t=J(e.props.nodeValue);if(t!=null)return;let r=jt(e);return te.parent().appendChild(r),r}function Bt(e){let t=te.nextChild()??Qr(e);if(!t)throw new k({message:"Hydration mismatch - no node found",vNode:e});let r=t.nodeName;if(Qe.has(r)||(r=r.toLowerCase()),e.type!==r)throw new k({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${r}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&I)){Kt(e);return}b.isSignal(e.props.nodeValue)&&ot(e,t,e.props.nodeValue);let n=e,o=e.sibling;for(;o&&o.type==="#text";){let i=o;te.bumpChildIndex();let s=String(J(n.props.nodeValue)??""),a=n.dom.splitText(s.length);i.dom=a,b.isSignal(i.props.nodeValue)&&ot(i,a,i.props.nodeValue),n=o,o=o.sibling}}function Wt(e,t,r,n=!1){if(r===null)return e.removeAttribute(t),!0;switch(typeof r){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(n&&!r)return e.removeAttribute(t),!0}return!1}function en(e,t,r){let n=et.has(t);Wt(e,t,r,n)||e.setAttribute(t,n&&typeof r=="boolean"?"":String(r))}var tn=["INPUT","TEXTAREA"],rn=e=>tn.indexOf(e.nodeName)>-1;function Ae(e,t,r,n){switch(t){case"style":return sn(e,r,n);case"className":return on(e,r);case"innerHTML":return nn(e,r);case"muted":e.muted=!!r;return;case"value":if(e.nodeName==="SELECT")return Ut(e,r);let o=r==null?"":String(r);if(rn(e)){e.value=o;return}e.setAttribute("value",o);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!r;return}e.setAttribute("checked",String(r));return;default:return en(e,Jt(t),r)}}function nn(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function on(e,t){let r=J(t);if(!r)return e.removeAttribute("class");e.setAttribute("class",r)}function sn(e,t,r){if(Wt(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let n={};typeof r=="string"?e.setAttribute("style",""):typeof r=="object"&&r&&(n=r);let o=t;new Set([...Object.keys(n),...Object.keys(o)]).forEach(s=>{let a=n[s],u=o[s];if(a!==u){if(u===void 0){e.style[s]="";return}e.style[s]=u}})}function an(e){let t=e.parent,r=t?.dom;for(;t&&!r;)t=t.parent,r=t?.dom;if(!r||!t){if(!e.parent&&e.dom)return e;throw new k({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function ln(e,t){let{node:r,lastChild:n}=t,o=e.dom;if(n){n.after(o);return}let i=Gt(e,r);if(i){r.dom.insertBefore(o,i);return}r.dom.appendChild(o)}function Gt(e,t){let r=e;for(;r;){let n=r.sibling;for(;n;){if(!(n.flags&(L|I))){let o=un(n);if(o?.isConnected)return o}n=n.sibling}if(r=r.parent,!r||r.flags&I||r===t)return}}function un(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&I)return;t=t.child}}function qt(e){if(M.current==="hydrate")return Q(e,be);let t={node:e.dom?e:an(e)};it(e,t,(e.flags&L)>0),e.dom&&!(e.flags&I)&&Xt(e,t,!1),be(e)}function it(e,t,r){let n=e.child;for(;n;){if(n.flags&we){n.flags&L&&cn(n,t),be(n),n=n.sibling;continue}n.dom?(it(n,{node:n},!1),n.flags&I||Xt(n,t,r)):it(n,t,(n.flags&L)>0||r),be(n),n=n.sibling}}function Xt(e,t,r){(r||!e.dom.isConnected||e.flags&L)&&ln(e,t),(!e.prev||e.flags&P)&&Kt(e),t.lastChild=e.dom}function Yt(e){e===e.parent?.child&&(e.parent.child=e.sibling);let t;l&&(t=N(e)),Q(e,r=>{let{hooks:n,subs:o,cleanups:i,dom:s,props:{ref:a}}=r;for(o?.forEach(u=>u()),i&&Object.values(i).forEach(u=>u());n?.length;)n.pop().cleanup?.();l&&(window.__kiru.profilingContext?.emit("removeNode",t),s instanceof Element&&delete s.__kiruNode),s&&(s.isConnected&&!(r.flags&I)&&s.remove(),a&&Me(a,null),delete r.dom)}),e.parent=null}function cn(e,t){if(!e.child)return;let r=[];if(Zt(e.child,r),r.length===0)return;let{node:n,lastChild:o}=t;if(o)o.after(...r);else{let i=Gt(e,n),s=n.dom;i?i.before(...r):s.append(...r)}t.lastChild=r[r.length-1]}function Zt(e,t){let r=e;for(;r;)r.dom?t.push(r.dom):r.child&&Zt(r.child,t),r=r.sibling}function m(e,t=null,...r){e===ue&&(e=T);let n=t===null?{}:t,o=at(n.key),i=r.length;return i===1?n.children=r[0]:i>1&&(n.children=r),{type:e,key:o,props:n}}function ue({children:e,key:t}){return{type:T,key:at(t),props:{children:e}}}function lt(e){return typeof e=="function"&&typeof e[_e]?.arePropsEqual=="function"}function Re(e,t=null,r={},n=null,o=0){e===ue&&(e=T);let i=t?t.depth+1:0;return{type:e,key:n,props:r,parent:t,index:o,depth:i,flags:0,child:null,sibling:null,prev:null,deletions:null}}var ft;function Pe(e,t){return l&&(ft=N(e)),Array.isArray(t)?(l&&(ir in t&&gn(e,t),mn(e,t)),pn(e,t)):fn(e,t)}function fn(e,t){let r=e.child;if(r===null)return rr(e,t);let n=r.sibling,o=er(e,r,t);if(o!==null)return r&&r!==o&&!o.prev?ct(e,r):n&&ct(e,n),o;{let i=sr(r),s=nr(i,e,0,t);if(s!==null){let a=s.prev;if(a!==null){let u=a.key;i.delete(u===null?a.index:u)}De(s,0,0)}return i.forEach(a=>Oe(e,a)),s}}function pn(e,t){let r=null,n=null,o=e.child,i=null,s=0,a=0;for(;o!==null&&a<t.length;a++){o.index>a?(i=o,o=null):i=o.sibling;let c=er(e,o,t[a]);if(c===null){o===null&&(o=i);break}o&&!c.prev&&Oe(e,o),s=De(c,s,a),n===null?r=c:n.sibling=c,n=c,o=i}if(a===t.length)return ct(e,o),r;if(o===null){for(;a<t.length;a++){let c=rr(e,t[a]);c!==null&&(s=De(c,s,a),n===null?r=c:n.sibling=c,n=c)}return r}let u=sr(o);for(;a<t.length;a++){let c=nr(u,e,a,t[a]);if(c!==null){let d=c.prev;if(d!==null){let p=d.key;u.delete(p===null?d.index:p)}s=De(c,s,a),n===null?r=c:n.sibling=c,n=c}}return u.forEach(c=>Oe(e,c)),r}function er(e,t,r){let n=t===null?null:t.key;return Le(r)?n!==null||t?.type==="#text"&&b.isSignal(t.props.nodeValue)?null:Qt(e,t,""+r):b.isSignal(r)?t&&t.props.nodeValue!==r?null:Qt(e,t,r):pe(r)?r.key!==n?null:dn(e,t,r):Array.isArray(r)?n!==null?null:(l&&pt(r),tr(e,t,r)):null}function Qt(e,t,r){return t===null||t.type!=="#text"?W(e,"#text",{nodeValue:r}):(l&&ye(),t.props.nodeValue!==r&&(t.props.nodeValue=r,t.flags|=P),t.sibling=null,t)}function dn(e,t,r){let{type:n,props:o,key:i}=r;return l&&typeof n=="function"&&(n=_(n)),n===T?tr(e,t,o.children||[],o):t?.type===n?(l&&ye(),t.index=0,t.sibling=null,typeof n=="string"?or(t.props,o)&&(t.flags|=P):t.flags|=P,t.props=o,t):W(e,n,o,i)}function tr(e,t,r,n={}){return t===null||t.type!==T?W(e,T,{children:r,...n}):(l&&ye(),t.props={...t.props,...n,children:r},t.flags|=P,t.sibling=null,t)}function rr(e,t){return Le(t)?W(e,"#text",{nodeValue:""+t}):b.isSignal(t)?W(e,"#text",{nodeValue:t}):pe(t)?W(e,t.type,t.props,t.key):Array.isArray(t)?(l&&pt(t),W(e,T,{children:t})):null}function De(e,t,r){e.index=r;let n=e.prev;if(n!==null){let o=n.index;return o<t?(e.flags|=L,t):o}else return e.flags|=L,t}function nr(e,t,r,n){if(b.isSignal(n)||Le(n)){let i=e.get(r);if(i){if(i.props.nodeValue===n)return i;i.type==="#text"&&b.isSignal(i.props.nodeValue)&&i.cleanups?.nodeValue?.()}return W(t,"#text",{nodeValue:n},null,r)}if(pe(n)){let{type:i,props:s,key:a}=n,u=e.get(a===null?r:a);return u?.type===i?(l&&ye(),typeof i=="string"?or(u.props,s)&&(u.flags|=P):u.flags|=P,u.props=s,u.sibling=null,u.index=r,u):W(t,i,s,a,r)}if(Array.isArray(n)){let i=e.get(r);return l&&pt(n),i?(l&&ye(),i.flags|=P,i.props.children=n,i):W(t,T,{children:n},null,r)}return null}function or(e,t){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!0;for(let o of r)if(!(o==="children"||o==="key")&&e[o]!==t[o])return!0;return!1}function ye(){"window"in globalThis&&window.__kiru.profilingContext?.emit("updateNode",ft)}var ir=Symbol("kiru:marked-list-child");function pt(e){Object.assign(e,{[ir]:!0})}function sr(e){let t=new Map;for(;e;){let r=e.key;t.set(r===null?e.index:r,e),e=e.sibling}return t}function Oe(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function ct(e,t){for(;t;)Oe(e,t),t=t.sibling}function mn(e,t){let r=new Set,n=!1;for(let o of t){if(!pe(o))continue;let i=o.key;if(typeof i=="string"){if(!n&&r.has(i)){let s=lr(e);ar(\`\${s} component produced a child in a list with a duplicate key prop: "\${i}". Keys should be unique so that components maintain their identity across updates\`),n=!0}r.add(i)}}}function gn(e,t){let r=!1,n=!1;for(let o of t)pe(o)&&(typeof o.key=="string"?r=!0:n=!0);if(n&&r){let o=lr(e);ar(\`\${o} component produced a child in a list without a valid key prop\`)}}function ar(e){let t=\`[kiru]: \${e}. See https://kirujs.dev/keys-warning for more information.\`;console.error(t)}var ut=new WeakMap;function lr(e){if(ut.has(e))return ut.get(e);let t=e.parent,r;for(;!r&&t;)typeof t.type=="function"&&(r=t.type),t=t.parent;let n=\`<\${r?.displayName||r?.name||"Anonymous Function"} />\`;return ut.set(e,n),n}function W(e,t,r,n=null,o=0){let i=Re(t,e,r,n,o);return i.flags|=L,typeof t=="function"&<(t)&&(i.flags|=Ce,i.arePropsEqual=t[_e].arePropsEqual),l&&"window"in globalThis&&window.__kiru.profilingContext?.emit("createNode",ft),i}var G,q=[],de=!1,mt=[],Ve=[],gt=!1,ht=!1,wt=!1,bt=0,ur=[],yt=[],cr=-1;function xt(e){if(de){mt.push(e);return}e()}function $e(){de&&(window.cancelAnimationFrame(cr),fr())}function Et(e){e.flags|=ae,q.push(e),de=!0,$e()}function O(e){if(M.current==="hydrate")return xt(()=>vt(e));vt(e)}function hn(){de||(de=!0,cr=window.requestAnimationFrame(fr))}function wn(){for(de=!1;mt.length;)mt.shift()()}function vt(e){if(gt&&(ht=!0),C.current===e){l&&window.__kiru.profilingContext?.emit("updateDirtied",G),wt=!0;return}if(!(e.flags&(ae|fe))){if(e.flags|=ae,!q.length)return q.push(e),hn();q.push(e)}}function bn(e){Q(e,t=>t.flags|=fe),Ve.push(e)}var yn=(e,t)=>t.depth-e.depth,re=null;function fr(){if(l){let t=Ve[0]??q[0];t?(G=N(t),window.__kiru.profilingContext?.beginTick(G)):G=null}let e=1;for(Ht();q.length;){q.length>e&&q.sort(yn),re=q.shift(),e=q.length;let t=re.flags;if(!(t&fe)&&t&ae){let r=re;for(;r=vn(r););for(;Ve.length;)Yt(Ve.pop());qt(re),re.flags&=~ae}}if(Ft(),gt=!0,dt(ur),gt=!1,ht)return kn(),dt(yt),ht=!1,bt++,l&&(window.__kiru.profilingContext?.endTick(G),window.__kiru.profilingContext?.emit("updateDirtied",G)),$e();bt=0,wn(),dt(yt),l&&(window.__kiru.emit("update",G),window.__kiru.profilingContext?.emit("update",G),window.__kiru.profilingContext?.endTick(G))}function vn(e){let t=!0;try{typeof e.type=="string"?Sn(e):St(e.type)?xn(e):t=En(e)}catch(n){l&&window.__kiru.emit("error",G,n instanceof Error?n:new Error(String(n)));let o=pr(e);if(o){let i=o.error=n instanceof Error?n:new Error(String(n));return o.props.onError?.(i),o.depth<re.depth&&(re=o),o}if(k.isKiruError(n)){if(n.customNodeStack&&setTimeout(()=>{throw new Error(n.customNodeStack)}),n.fatal)throw n;console.error(n);return}setTimeout(()=>{throw n})}if(e.deletions!==null&&(e.deletions.forEach(bn),e.deletions=null),t&&e.child)return e.child;let r=e;for(;r;){if(r.immediateEffects&&(ur.push(...r.immediateEffects),r.immediateEffects=void 0),r.effects&&(yt.push(...r.effects),r.effects=void 0),r===re)return;if(r.sibling)return r.sibling;r=r.parent,M.current==="hydrate"&&r?.dom&&te.pop()}}function xn(e){let{props:t,type:r}=e,n=t.children;if(r===ie){let{props:{dependents:o,value:i},prev:s}=e;o.size&&s&&s.props.value!==i&&o.forEach(vt)}else if(r===se){let o=e,{error:i}=o;i&&(n=typeof t.fallback=="function"?t.fallback(i):t.fallback,delete o.error)}e.child=Pe(e,n)}function En(e){let{type:t,props:r,subs:n,prev:o,flags:i}=e;if(i&Ce){if(e.memoizedProps=r,o?.memoizedProps&&e.arePropsEqual(o.memoizedProps,r)&&!e.hmrUpdated)return e.flags|=we,!1;e.flags&=~we}try{C.current=e;let s,a=0;do{if(e.flags&=~ae,wt=!1,Z.current=0,n&&(n.forEach(u=>u()),n.clear()),l){if(s=_(t)(r),e.hmrUpdated&&e.hooks&&e.hookSig){let u=e.hooks.length;if(Z.current<u){for(let c=Z.current;c<u;c++)e.hooks[c].cleanup?.();e.hooks.length=Z.current,e.hookSig.length=Z.current}}if(delete e.hmrUpdated,++a>Je)throw new k({message:"Too many re-renders. Kiru limits the number of renders to prevent an infinite loop.",fatal:!0,vNode:e});continue}s=t(r)}while(wt);return e.child=Pe(e,s),!0}finally{C.current=null}}function Sn(e){let{props:t,type:r}=e;l&&kt(e),e.dom||(M.current==="hydrate"?Bt(e):e.dom=zt(e),l&&e.dom instanceof Element&&(e.dom.__kiruNode=e)),r!=="#text"&&(e.child=Pe(e,t.children),e.child&&M.current==="hydrate"&&te.push(e.dom))}function kn(){if(bt>Je)throw new k("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function dt(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var dr;(function(e){e.Start="start",e.End="end"})(dr||(dr={}));var me=null,mr=new Set;function h(e,t,r){let n=_n(e);if(l&&me!==null&&!mr.has(e+me))throw mr.add(e+me),new k({message:\`Nested primitive "useHook" calls are not supported. "\${e}" was called inside "\${me}". Strange will most certainly happen.\`,vNode:n});let o=(a,u)=>{if(u?.immediate){(n.immediateEffects??(n.immediateEffects=[])).push(a);return}(n.effects??(n.effects=[])).push(a)},i=Z.current++,s=n.hooks?.at(i);if(l){me=e,n.hooks??(n.hooks=[]),n.hookSig??(n.hookSig=[]),n.hookSig[i]?n.hookSig[i]!==e&&(console.warn(\`[kiru]: hooks must be called in the same order. Hook "\${e}" was called in place of "\${n.hookSig[i]}". Strange things may happen.\`),s?.cleanup?.(),n.hooks.length=i,n.hookSig.length=i,s=void 0):n.hookSig[i]=e;let a;s?a=s:(a=typeof t=="function"?t():{...t},a.name=e),n.hooks[i]=a;try{return r({hook:a,isInit:!s,isHMR:n.hmrUpdated,update:()=>O(n),queueEffect:o,vNode:n,index:i})}catch(u){throw u}finally{me=null}}try{let a=s??(typeof t=="function"?t():{...t});return n.hooks??(n.hooks=[]),n.hooks[i]=a,r({hook:a,isInit:!s,update:()=>O(n),queueEffect:o,vNode:n,index:i})}catch(a){throw a}}function _n(e){let t=C.current;if(!t)throw new k(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`);return t}function H(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function A(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((r,n)=>!Object.is(r,e[n]))}var ve={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},F=new Map,z=new Map;var gr,b=class e{constructor(t,r){this[gr]=!0,this.$id=Ne(),this.$value=t,r&&(this.displayName=r),l?(z.set(this.$id,new Set),this.$initialValue=_t(t),this[Y]={provide:()=>this,inject:n=>{z.get(this.$id)?.clear?.(),z.delete(this.$id),this.$id=n.$id,n.__next=this,this.$initialValue===n.$initialValue?this.$value=n.$value:this.notify()},destroy:()=>{}}):this.$subs=new Set}get value(){if(this.onBeforeRead?.(),l){let t=_(this);return e.entangle(t),t.$value}return e.entangle(this),this.$value}set value(t){if(l){let r=_(this);if(Object.is(r.$value,t))return;r.$prevValue=r.$value,r.$value=t,r.notify();return}Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),l?_(this).$value:this.$value}sneak(t){if(l){let r=_(this);r.$prevValue=r.$value,r.$value=t;return}this.$prevValue=this.$value,this.$value=t}toString(){if(this.onBeforeRead?.(),l){let t=_(this);return e.entangle(t),\`\${t.$value}\`}return e.entangle(this),\`\${this.$value}\`}subscribe(t){return l?(z.get(this.$id).add(t),()=>z.get(this.$id)?.delete(t)):(this.$subs.add(t),()=>this.$subs.delete(t))}notify(t){if(l)return z.get(this.$id)?.forEach(r=>{if(t&&!t(r))return;let{$value:n,$prevValue:o}=_(this);return r(n,o)});this.$subs.forEach(r=>{if(!(t&&!t(r)))return r(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&Xe in t}static subscribers(t){return l?z.get(t.$id):t.$subs}static makeReadonly(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&!r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},configurable:!0})}static makeWritable(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},set:function(n){this.$value=n,this.notify()},configurable:!0})}static entangle(t){let r=C.current,n=ve.current();if(n){(!r||r&&g())&&n.set(t.$id,t);return}if(!r||!g())return;let o=t.subscribe(()=>O(r));(r.subs??(r.subs=new Set)).add(o)}static configure(t,r){t.onBeforeRead=r}static dispose(t){if(t.$isDisposed=!0,l){z.delete(t.$id);return}t.$subs.clear()}};gr=Xe;var Ie=(e,t)=>new b(e,t),x=(e,t)=>h("useSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&(n&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()}),set:({value:i})=>{r.signal.value=i}},initialArgs:[e,t]}),o)){let[i,s]=r.dev.initialArgs;(i!==e||s!==t)&&(r.cleanup?.(),n=!0,r.dev.initialArgs=[e,t])}return n&&(r.cleanup=()=>b.dispose(r.signal),r.signal=new b(e,t)),r.signal});function J(e,t=!1){return b.isSignal(e)?t?e.value:e.peek():e}var Ct=()=>{F.forEach(e=>e()),F.clear()};var hr=new Set(["children","ref","key","innerHTML"]),Te={isInternalProp:e=>hr.has(e),isEvent:e=>e.startsWith("on"),isStringRenderableProperty:e=>!hr.has(e)&&!Te.isEvent(e)};function Jt(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():Lt.get(e)||e}}function _t(e,t={functions:!0}){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[CIRCULAR]";r.add(o)}return typeof o=="function"?t.functions?o.toString():\`[FUNCTION (\${o.name||"anonymous"})]\`:o})}var B=Object.freeze(()=>{});function _(e){let t=e;if(l)for(;"__next"in t;)t=t.__next;return t}function Me(e,t){if(typeof e=="function"){e(t);return}if(b.isSignal(e)){e.value=t;return}e.current=t}function g(){return M.current==="dom"||M.current==="hydrate"}function pe(e){return typeof e=="object"&&e!==null&&"type"in e}function Le(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function St(e){return e===T||e===ie||e===se}function wr(e){return e.type===T}function N(e){let t=e;for(;t;){if(t.app)return e.app=t.app;t=t.parent}return null}function be(e){let{props:{children:t,...r},key:n,memoizedProps:o,index:i}=e;e.prev={props:r,key:n,memoizedProps:o,index:i},e.flags&=~(P|L|fe)}function br(e,t){if(t.depth<e.depth)return!1;if(e===t)return!0;let r=!1,n=[e];for(;n.length;){let o=n.pop();if(o===t)return!0;o.child&&n.push(o.child),r&&o.sibling&&n.push(o.sibling),r=!0}return!1}function Q(e,t){t(e);let r=e.child;for(;r;)t(r),r.child&&Q(r,t),r=r.sibling}function tt(e,t){let r=e.parent;for(;r;){if(t(r))return r;r=r.parent}return null}function pr(e){return tt(e,t=>t.type===se)}function kt(e){if("children"in e.props&&e.props.innerHTML)throw new k({message:"Cannot use both children and innerHTML on an element",vNode:e});for(let t in e.props)if("bind:"+t in e.props)throw new k({message:\`Cannot use both bind:\${t} and \${t} on an element\`,vNode:e})}function at(e){return e===void 0?null:typeof e=="string"||typeof e=="number"?e:null}var Cn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Ne(e=10,t=Cn){let r="";for(let n=0;n<e;n++)r+=t[Math.random()*t.length|0];return r}function He(e){let{id:t,subs:r,fn:n,deps:o=[],onDepChanged:i}=e,s;F.delete(t);let a=!!C.current&&!g();a||(s=new Map,ve.stack.push(s));let u=n(...o.map(c=>c.value));if(!a){for(let[d,p]of r)s.has(d)||(p(),r.delete(d));let c=()=>{F.size||queueMicrotask(Ct),F.set(t,i)};for(let[d,p]of s){if(r.has(d))continue;let v=p.subscribe(c);r.set(d,v)}ve.stack.pop()}return u}var ge=class e extends b{constructor(t,r){if(super(void 0,r),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,l){let n=this[Y].inject;this[Y]={provide:()=>this,inject:o=>{n(o),e.stop(o),this.$isDirty=o.$isDirty},destroy:()=>{}}}b.configure(this,()=>{this.$isDirty&&(l&&this.$isDisposed||e.run(this))})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&e.run(this),super.subscribe(t)}static dispose(t){e.stop(t),b.dispose(t)}static updateGetter(t,r){let n=_(t);n.$getter=r,n.$isDirty=!0,e.run(n),!Object.is(n.$value,n.$prevValue)&&n.notify()}static stop(t){let{$id:r,$unsubs:n}=_(t);F.delete(r),n.forEach(o=>o()),n.clear(),t.$isDirty=!0}static run(t){let r=_(t),{$id:n,$getter:o,$unsubs:i}=r,s=He({id:n,subs:i,fn:()=>o(r.$value),onDepChanged:()=>{if(r.$isDirty=!0,l){if(!z?.get(n)?.size)return}else if(!t.$subs.size)return;e.run(r),!Object.is(r.$value,r.$prevValue)&&r.notify()}});r.sneak(s),r.$isDirty=!1}};function yr(e,t){return new ge(e,t)}function At(e,t,r){return h("useComputedSignal",{signal:null,deps:void 0},({hook:n,isInit:o,isHMR:i})=>(l&&(n.dev={devtools:{get:()=>({displayName:n.signal.displayName,value:n.signal.peek()})}},i&&(n.cleanup?.(),o=!0)),o?(typeof t=="string"&&(r=t,t=void 0),n.deps=t,n.cleanup=()=>ge.dispose(n.signal),n.signal=yr(e,r)):n.deps&&typeof t!="string"&&A(n.deps,t)&&(n.deps=t,ge.updateGetter(n.signal,e)),n.signal))}var xe=class e{constructor(t,r){if(this.id=Ne(),this.getter=t,this.deps=r,this.unsubs=new Map,this.isRunning=!1,this.cleanup=null,l&&"window"in globalThis){let n=window.__kiru.HMRContext.signals;n.isWaitingForNextWatchCall()&&n.pushWatch(this)}this.start()}start(){if(!this.isRunning){if(this.isRunning=!0,l&&"window"in globalThis&&window.__kiru.HMRContext?.isReplacement())return queueMicrotask(()=>{this.isRunning&&e.run(this)});e.run(this)}}stop(){F.delete(this.id),this.unsubs.forEach(t=>t()),this.unsubs.clear(),this.cleanup?.(),this.cleanup=null,this.isRunning=!1}static run(t){let r=_(t),{id:n,getter:o,unsubs:i,deps:s}=r;r.cleanup=He({id:n,subs:i,fn:o,deps:s,onDepChanged:()=>{r.cleanup?.(),e.run(r)}})??null}};function vr(e,t){if(typeof e=="function")return new xe(e);let r=e,n=t;return new xe(n,r)}function Ee(e,t){if(g())return h("useWatch",{watcher:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&o&&(r.cleanup?.(),n=!0),n){let i=r.watcher=vr(e,t);r.cleanup=()=>i.stop()}return r.watcher})}var An=0;function xr(e,t,r){if(l&&t.__kiruNode)throw new Error("[kiru]: container in use - call unmount on the previous app first.");let n=Tn(t),o=An++,i={id:o,name:r?.name??\`App-\${o}\`,rootNode:n,render:s,unmount:a};function s(u){n.props.children=u,Et(n)}function a(){n.props.children=null,Et(n),l&&(delete t.__kiruNode,delete n.app),window.__kiru.emit("unmount",i)}return l&&(n.app=i),s(e),window.__kiru.emit("mount",i,O),l&&queueMicrotask(()=>{window.dispatchEvent(new Event("kiru:ready"))}),i}function Tn(e){let t=Re(e.nodeName.toLowerCase());return t.flags|=I,t.dom=e,l&&(e.__kiruNode=t),t}function ce(e){return g()?h("useState",{state:void 0,dispatch:B},({hook:t,isInit:r,update:n,isHMR:o})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.state}),set:({value:i})=>t.state=i},initialArgs:[e]}),o)){let[i]=t.dev.initialArgs;i!==e&&(r=!0,t.dev.initialArgs=[e])}return r&&(t.state=typeof e=="function"?e():e,t.dispatch=i=>{let s=typeof i=="function"?i(t.state):i;Object.is(t.state,s)||(t.state=s,n())}),[t.state,t.dispatch]}):[typeof e=="function"?e():e,B]}function Er(e){let t={[Dt]:!0,Provider:({value:r,children:n})=>{let[o]=ce(()=>new Set);return m(ie,{value:r,ctx:t,dependents:o},typeof n=="function"?n(r):n)},default:()=>e,set displayName(r){this.Provider.displayName=r},get displayName(){return this.Provider.displayName||"Anonymous Context"}};if(l){let r=t;r[Y]={inject:n=>{let o=t.Provider;window.__kiru.apps.forEach(i=>{Q(i.rootNode,s=>{s.type===n.Provider&&(s.type=o,s.hmrUpdated=!0,O(s))})})},destroy:()=>{},provide:()=>t}}return t}function ee(e,t){return g()?h("useCallback",{callback:e,deps:t},({hook:r,isHMR:n})=>(l&&(r.dev={devtools:{get:()=>({callback:r.callback,dependencies:r.deps})}},n&&(r.deps=[])),A(t,r.deps)&&(r.deps=t,r.callback=e),r.callback)):e}function j(e,t){if(g())return h("useEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:i})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,H(r),i(()=>{let s=e();typeof s=="function"&&(r.cleanup=s)}))})}function ne(e,t){if(g())return h("useLayoutEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:i})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,H(r),i(()=>{let s=e();typeof s=="function"&&(r.cleanup=s)},{immediate:!0}))})}function Se(e,t){return g()?h("useMemo",{deps:t,value:void 0},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({value:r.value,dependencies:r.deps})}},o&&(n=!0)),(n||A(t,r.deps))&&(r.deps=t,r.value=e()),r.value)):e()}function V(e){return g()?h("useRef",{ref:{current:e}},({hook:t,isInit:r,isHMR:n})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.ref.current}),set:({value:o})=>t.ref.current=o},initialArgs:[t.ref.current]}),n)){let[o]=t.dev.initialArgs;o!==e&&(t.ref={current:e},t.dev.initialArgs=[e])}return t.ref}):{current:e}}var sl="window"in globalThis?window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map):new Map;function _r(e){let[t,r]=ce(e.initialState||"exited"),n=V(null);ne(()=>{e.in&&t!=="entered"&&t!=="entering"?(o("entering"),i("entered")):!e.in&&t!=="exited"&&t!=="exiting"&&(o("exiting"),i("exited"))},[e.in,t]),j(()=>()=>kr(n.current),[]);let o=ee(s=>{kr(n.current),r(s),(s==="entered"||s==="exited")&&e.onTransitionEnd&&e.onTransitionEnd(s)},[]),i=ee(s=>{n.current=window.setTimeout(()=>o(s),Dn(s,e.duration))},[e.duration]);return e.element(t)}var Sr=150;function Dn(e,t){if(typeof t=="number")return t;switch(e){case"entered":return t?.in??Sr;case"exited":return t?.out??Sr}}function kr(e){e!=null&&window.clearTimeout(e)}"window"in globalThis;var Cr=()=>m("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},m("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"}));var Fe="kiru.devtools.anchorPosition",Ar={x:-16,y:-16};var Tt=(e,t,r)=>{if(!t.current)return{...Ar};let n=window.innerWidth/e.width,o=window.innerHeight/e.height,i=null,s=null;return e.snapSide==="left"?i=(t.current.offsetWidth-r.width.value)*-1+16:e.snapSide==="right"?i=-16:e.snapSide==="bottom"?s=-16:e.snapSide==="top"&&(s=(window.innerHeight-r.height.value)*-1+16),{x:i??e.x*n,y:s??e.y*o}},Tr=e=>{if(e==null)return null;let t=null,r=e?.__kiruNode?.parent;for(;r;){if(typeof r.type=="function"&&!wr(r)){t=r;break}r=r.parent}return t},Mr=(e,t)=>{let r=[],n=[t.__kiruNode];for(;n.length;){let i=n.pop();if(i===e)break;i?.dom&&r.push(i),i?.parent&&n.push(i.parent)}if(r.length===0)return;let o=r[r.length-1].dom;return o instanceof Element?o:void 0};function ze(e,t){if(!e)throw new Error(t)}var Dr={arrayChunkSize:10,objectKeysChunkSize:100};function Or(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let n in r)if(typeof t[n]!=typeof e[n]||typeof e[n]=="object"&&!Or(e[n],t[n]))return!1;return!0}var Ln={...Dr},Rr=localStorage.getItem("kiru.devtools.userSettings");if(Rr)try{let e=JSON.parse(Rr);Or(Dr,e)&&(Ln=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}var ec=Er({userSettings:null,saveUserSettings:()=>{}});var lc=Object.freeze(()=>{});var In="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??(window.__devtoolsSelection=null),window.__devtoolsNodeUpdatePtr??(window.__devtoolsNodeUpdatePtr=null));var Mt=class extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}},R=new Mt(In);var Oc=Symbol.for("devtools.hookGroup");var $=(e,t,r={})=>{j(()=>{let n=window,o=r?.ref?.();return o?n=o:r.ref&&console.warn("useEventListener ref failed, using window"),n.addEventListener(e,t,r),()=>{n.removeEventListener(e,t,r)}},[t])};var je=()=>{let e=x({x:0,y:0}),t=x({x:0,y:0}),r=x({x:0,y:0});return $("mousemove",n=>{e.value={x:n.x,y:n.y},t.value={x:n.movementX,y:n.movementY},r.value={x:n.clientX,y:n.clientY}}),{mouse:e,delta:t,client:r}};var Ke="window"in globalThis&&"ResizeObserver"in globalThis.window,Pr=(e,t,r=void 0)=>g()?Ke?h("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:i})=>(n&&(o.resizeObserver=new ResizeObserver(t),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null}),i(()=>{A([e.current],o.deps)&&(o.deps=[e.current],o.resizeObserver?.disconnect?.(),e.current&&o.resizeObserver?.observe(e.current,r))}),{isSupported:Ke,start:()=>{o.resizeObserver==null&&(o.resizeObserver=new ResizeObserver(t),e.current&&o.resizeObserver.observe(e.current,r),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null})},stop:()=>{H(o)}})):{isSupported:Ke,start:()=>{},stop:()=>{}}:{isSupported:Ke,start:()=>{},stop:()=>{}};var Ue="window"in globalThis&&"MutationObserver"in globalThis.window,Lr=(e,t,r=void 0)=>g()?Ue?h("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:i})=>(n?(i(()=>{o.deps=[e.current],o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r)}),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null}):A([e.current],o.deps)&&(o.deps=[e.current],o.mutationObserver?.disconnect?.(),e.current&&o.mutationObserver?.observe(e.current,r)),{isSupported:Ue,start:()=>{o.mutationObserver==null&&(o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null})},stop:()=>{H(o)}})):{isSupported:Ue,start:()=>{},stop:()=>{}}:{isSupported:Ue,start:()=>{},stop:()=>{}};var Be=(e,t={windowScroll:!0,windowResize:!0})=>{let r=t?.windowScroll??!0,n=t?.windowResize??!0,o=t.immediate??!0,i=x(0),s=x(0),a=x(0),u=x(0),c=x(0),d=x(0),p=x(0),v=x(0),f=()=>{let y=e.current;if(!y){i.value=0,s.value=0,a.value=0,u.value=0,c.value=0,d.value=0,p.value=0,v.value=0;return}let E=y.getBoundingClientRect();i.value=E.width,s.value=E.height,a.value=E.top,u.value=E.right,c.value=E.bottom,d.value=E.left,p.value=E.x,v.value=E.y};return Pr(e,f),Lr(e,f,{attributeFilter:["style","class"]}),$("scroll",()=>{r&&f()},{capture:!0,passive:!0}),$("resize",()=>{n&&f()},{passive:!0}),ne(()=>{o&&f()},[]),{width:i,height:s,top:a,right:u,bottom:c,left:d,x:p,y:v,update:f}};var Vr=(e,t)=>{if(!g())return{isActive:t?.immediate??!1,start:()=>null,stop:()=>null};let r=t?.fpsLimit?1e3/t.fpsLimit:null;return h("useRafFn",()=>({callback:e,refId:null,previousFrameTimestamp:0,isActive:t?.immediate??!1,rafLoop:()=>{}}),({isInit:n,hook:o,update:i})=>(o.callback=e,n&&(o.rafLoop=s=>{if(o.isActive===!1)return;o.previousFrameTimestamp||(o.previousFrameTimestamp=s);let a=s-o.previousFrameTimestamp;if(r&&a<r){o.refId=window.requestAnimationFrame(o.rafLoop);return}o.previousFrameTimestamp=s,o.callback({delta:a,timestamp:s}),o.refId=window.requestAnimationFrame(o.rafLoop)}),n&&t?.immediate&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},i()),{isActive:o.isActive,start:()=>{o.isActive!==!0&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},i())},stop:()=>{H(o),i()}}))};var $r=e=>{let{x:t,y:r,multiple:n,immediate:o=!0}=e,i=x(null),a=Vr(()=>{i.value=n?document.elementsFromPoint(t,r)??[]:document.elementFromPoint(t,r)??null},{immediate:o});return{element:i,...a}};var Ir=()=>{let{mouse:e}=je(),t=x(null),r=V(null),n=V(null),o=Be(r),i=x({x:-16,y:-16}),s=x({x:-16,y:-16}),a=x({width:window.innerWidth,height:window.innerHeight}),u=x("bottom"),c=V(null);ne(()=>{let f=localStorage.getItem(Fe);if(f==null)return;let y=JSON.parse(f);a.value.width=window.innerWidth,a.value.height=window.innerHeight,u.value=y.snapSide,s.value=Tt(y,n,o)},[]);let d=At(()=>{let{x:f,y}=e.value;if(t.value===null)return null;let{x:E,y:U}=t.value;return{x:f-E,y:y-U}});$("dragstart",f=>{f.preventDefault(),t.value={x:f.x,y:f.y},i.value=s.value},{ref:()=>r.current}),$("mouseup",()=>{c.current&&(clearTimeout(c.current),c.current=null),t.peek()&&(t.value=null,localStorage.setItem(Fe,JSON.stringify({...s.value,...a.value,snapSide:u.value})))});let p=ee(()=>{if(n.current==null)return;let f=n.current.offsetWidth;if(u.value==="right"){let y=Math.min(-16,s.value.y);s.value={x:-16,y:Math.max(y,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="left"){let y=Math.min(0,s.value.y);s.value={x:(f-o.width.value)*-1+16,y:Math.max(y,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="top"){let y=Math.min(-16,s.value.x);s.value={x:Math.max(y,(f-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}else{let y=Math.min(-16,s.value.x);s.value={x:Math.max(y,(f-o.width.value)*-1+16),y:-16}}},[]);Ee([d,e],(f,y)=>{if(f===null||!n.current)return;let{x:E,y:U}=y,S=n.current.offsetWidth,D=U>=window.innerHeight-100,he=U<=100;if(!he&&!D){let oe=E>window.innerWidth/2;u.value=oe?"right":"left"}else u.value=he?"top":"bottom";if(u.value==="right"){let oe=Math.min(-16,i.value.y+f.y);s.value={x:-16,y:Math.max(oe,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="left"){let oe=Math.min(0,i.value.y+f.y);s.value={x:(S-o.width.value)*-1+16,y:Math.max(oe,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="top"){let oe=Math.min(-16,i.value.x+f.x);s.value={x:Math.max(oe,(S-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}let Kr=Math.min(-16,i.value.x+f.x);s.value={y:-16,x:Math.max(Kr,(S-o.width.value)*-1+16)}});let v=ee(()=>{n.current!==null&&(s.value=Tt({width:a.value.width,height:a.value.height,x:s.value.x,y:s.value.y,snapSide:u.value},n,o),a.value.width=window.innerWidth,a.value.height=window.innerHeight,localStorage.setItem(Fe,JSON.stringify({...s.value,...a.value,snapSide:u.value})))},[Math.round(o.width.value),Math.round(o.height.value)]);return $("resize",v),{anchorRef:r,anchorCoords:s,viewPortRef:n,startMouse:t,elementBound:o,snapSide:u,updateAnchorPos:p}};var K=Ie(!1);"window"in globalThis&&R.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(K.value=e.data.value)});var X=Ie(null);var Nr="kiru-devtools-popup-size",We=()=>{let e=X.value;return ee(()=>new Promise((r,n)=>{if(e)if(e.closed)X.value=null;else return e.focus(),r(e);let o=sessionStorage.getItem(Nr),i=o?JSON.parse(o):{width:Math.floor(Math.min(1920,window.screen.width)/2),height:Math.floor(Math.min(1080,window.screen.height)/2)},s=\`popup,width=\${i.width},height=\${i.height};\`,a=window.open(window.__KIRU_DEVTOOLS_PATHNAME__,"_blank",s);if(!a)return console.error("[kiru]: Unable to open devtools window"),n();let u=c=>{c.data.type==="ready"&&(R.removeEventListener(u),console.debug("[kiru]: devtools window opened"),r(a),X.value=a,a.onbeforeunload=()=>{console.debug("[kiru]: devtools window closed"),X.value=null})};R.addEventListener(u),a.onresize=()=>{sessionStorage.setItem(Nr,JSON.stringify({width:a.innerWidth,height:a.innerHeight}))}}),[e])};var Hr=()=>{let e=We(),{mouse:t}=je(),r=$r({x:t.value.x,y:t.value.y,immediate:!1}),n=r.element.value,o=K.value?n:null,i=Se(()=>{if(o&&window.__kiru){let c=window.__kiru.apps.find(d=>d.rootNode==null||o.__kiruNode==null?!1:br(d.rootNode,o.__kiruNode));return c?.rootNode==null?null:c}return null},[o]),s=Se(()=>o?Tr(o):null,[o]),a=V(null),u=Be(a);return j(()=>K.subscribe(d=>{r[d?"start":"stop"]()}),[]),j(()=>{s&&o?a.current=Mr(s,o)??null:a.current=null},[s,o]),$("click",c=>{if(K.value===!0&&s&&i){c.preventDefault();let d=p=>{p.__devtoolsSelection={node:s,app:i},R.send({type:"select-node"}),R.send({type:"set-inspect-enabled",value:!1}),K.value=!1,a.current=null,p.focus()};X.value?d(X.value):e().then(p=>d(p))}}),s&&m("div",{className:"bg-[crimson]/80 fixed grid place-content-center pointer-events-none z-10 top-0 left-0",style:{width:\`\${u?.width}px\`,height:\`\${u?.height}px\`,transform:\`translate(\${u.x}px, \${u.y}px)\`}},m("p",null,s.type.name))};function Fr(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 -960 960 960",fill:"currentColor",...e},m("path",{d:"M710-150q-63 0-106.5-43.5T560-300q0-63 43.5-106.5T710-450q63 0 106.5 43.5T860-300q0 63-43.5 106.5T710-150Zm0-80q29 0 49.5-20.5T780-300q0-29-20.5-49.5T710-370q-29 0-49.5 20.5T640-300q0 29 20.5 49.5T710-230Zm-270-30H200q-17 0-28.5-11.5T160-300q0-17 11.5-28.5T200-340h240q17 0 28.5 11.5T480-300q0 17-11.5 28.5T440-260ZM250-510q-63 0-106.5-43.5T100-660q0-63 43.5-106.5T250-810q63 0 106.5 43.5T400-660q0 63-43.5 106.5T250-510Zm0-80q29 0 49.5-20.5T320-660q0-29-20.5-49.5T250-730q-29 0-49.5 20.5T180-660q0 29 20.5 49.5T250-590Zm510-30H520q-17 0-28.5-11.5T480-660q0-17 11.5-28.5T520-700h240q17 0 28.5 11.5T800-660q0 17-11.5 28.5T760-620Zm-50 320ZM250-660Z"}))}function zr(e){return m("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer",...e},m("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),m("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}))}var Nn=()=>{K.value=!K.value,R.send({type:"set-inspect-enabled",value:K.value})};function Hn(e,t){let{damping:r}=t,n=x(e),o=V(e);return j(()=>{let i=null,s=()=>{if(Math.sqrt(Math.pow(o.current.x-n.value.x,2)+Math.pow(o.current.y-n.value.y,2))<5)return;let u=n.value.x+(o.current.x-n.value.x)*r,c=n.value.y+(o.current.y-n.value.y)*r;n.value={x:u,y:c},i=window.requestAnimationFrame(s)};return i=window.requestAnimationFrame(s),()=>{i!=null&&window.cancelAnimationFrame(i)}},[e.x,e.y]),Object.assign(n,{set:(i,s)=>{o.current=i,s?.hard&&(n.value=i)}})}function Rt(){let e=x(!1),t=We(),{anchorCoords:r,anchorRef:n,viewPortRef:o,startMouse:i,snapSide:s}=Ir(),a=s.value==="left"||s.value==="right",u=V(!1),c=Hn(r.value,{damping:.4});return Ee([r],c.set),ne(()=>{u.current===!1&&c.set(r.value,{hard:!0}),u.current=!0},[]),m(ue,null,m("div",{ref:o,className:"w-full h-0 fixed top-0 left-0 z-[-9999] overflow-scroll pointer-events-none"}),m("div",{ref:n,draggable:!0,className:\`flex \${a?"flex-col":""} \${e.value?"rounded-3xl":"rounded-full"} p-1 gap-1 items-center will-change-transform bg-crimson\`,style:{transform:\`translate3d(\${Math.round(c.value.x)}px, \${Math.round(c.value.y)}px, 0)\`}},m(_r,{in:e.value,duration:{in:40,out:150},element:d=>{if(d==="exited")return null;let p=d==="entered"?"1":"0.5",v=d==="entered"?"1":"0";return m(ue,null,m("button",{title:"Open Devtools",onclick:t,style:{transform:\`scale(\${p})\`,opacity:v},className:"transition text-white rounded-full p-1 hover:bg-[#0003]"},m(Fr,{width:16,height:16})),m("button",{title:"Toggle Component Inspection",onclick:Nn,style:{transform:\`scale(\${p})\`,opacity:v},className:\`transition text-white rounded-full p-1 hover:bg-[#0003] \${K.value?"bg-[#0003]":""}\`},m(zr,{width:16,height:16})))}}),m("button",{className:"bg-crimson rounded-full p-1"+(i.value?" pointer-events-none":""),onclick:()=>e.value=!e.value,tabIndex:-1},m(Cr,null))),m(Hr,null))}var jr=\`*, ::before, ::after {
|
|
9791
|
+
\`}function qr(e){let t=It(e);if(l){let r=Xr(e);r&&(t=\`\${t} (\${r})\`)}return t}function It(e){return e.displayName??(e.name||"Anonymous Function")}function Xr(e){return e.toString().match(/\\/\\/ \\[kiru_devtools\\]:(.*)/)?.[1]??null}var xe=[],ae=[],$={bumpChildIndex(){ae[ae.length-1]++},getCurrentChild(){let e=ae[ae.length-1];return this.getCurrentParent().childNodes[e]},getCurrentParent(){return xe[xe.length-1]},clear(){xe.length=0,ae.length=0},pop(){xe.pop(),ae.pop()},push(e){xe.push(e),ae.push(0)}};var at=!1,nt=!1,Ft=e=>{e.preventDefault(),e.stopPropagation(),nt=!0},le=null;function zt(){at=!0,le=document.activeElement,le&&le!==document.body&&le.addEventListener("blur",Ft)}function jt(){nt&&(le.removeEventListener("blur",Ft),le.isConnected&&le.focus(),nt=!1),at=!1}function Kt(e){let t=e.type;return t=="#text"?Yr(e):et.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Yr(e){let{nodeValue:t}=e.props;return b.isSignal(t)?Ut(e,t):document.createTextNode(t)}function Ut(e,t){let r=t.peek()??"",n=document.createTextNode(r);return ot(e,n,t),n}function Zr(e){return t=>{if(at){t.preventDefault(),t.stopPropagation();return}e(t)}}var Ht=new WeakMap;function Gt(e){let{dom:t,prev:r,props:n,cleanups:o}=e,i=r?.props??{},s=n??{},a=M.current==="hydrate";if(t instanceof Text){let v=s.nodeValue;!b.isSignal(v)&&t.nodeValue!==v&&(t.nodeValue=v);return}let u=[];for(let v in i)u.push(v);for(let v in s)v in i||u.push(v);let c;for(let v=0;v<u.length;v++){let p=u[v],x=i[p],E=s[p];if(Oe.isEvent(p)){if(c??(c=Ht.get(e)),c||Ht.set(e,c={}),x!==E||a){let T=p.replace(Vt,""),Z=c[T];if(!E){Z&&(t.removeEventListener(T,Z),delete c[T]);continue}let de=E.bind(void 0);if((T==="focus"||T==="blur")&&(de=Zr(de)),Z){Z.handleEvent=de;continue}t.addEventListener(T,c[T]={handleEvent:de})}continue}if(!(Oe.isInternalProp(p)&&p!=="innerHTML")&&x!==E){if(b.isSignal(x)&&o){let T=o[p];T&&(T(),delete o[p])}if(b.isSignal(E)){tn(e,t,p,E,x);continue}it(t,p,E,x)}}let f=i.ref,w=s.ref;f!==w&&(f&&Pe(f,null),w&&Pe(w,t))}function Jr(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Wt(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(r=>{r.selected=t.indexOf(r.value)>-1})}var Qr={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},en=new Set(["progress","meter","number","range"]);function tn(e,t,r,n,o){let[i,s]=r.split(":"),a=e.cleanups??(e.cleanups={});if(i!=="bind")a[r]=n.subscribe((f,w)=>{f!==w&&(it(t,r,f,w),l&&Bt(e))});else{let f=Qr[s];if(!f){l&&console.error(\`[kiru]: \${s} is not a valid element binding attribute.\`);return}a[r]=nn(e,t,s,f,n)}let u=n.peek(),c=Q(o);u!==c&&it(t,s??i,u,c)}function rn(e,t){return e instanceof HTMLInputElement?on(e,t):e instanceof HTMLSelectElement?()=>Jr(e):()=>e.value}function nn(e,t,r,n,o){let i=f=>{o.sneak(f),o.notify(w=>w!==a)},s=t instanceof HTMLSelectElement&&r==="value"?f=>Wt(t,f):f=>t[r]=f,a=f=>{s(f),l&&Bt(e)},u;if(r==="value"){let f=rn(t,o);u=()=>i(f())}else u=()=>{let f=t[r];r==="currentTime"&&o.peek()===f||i(f)};t.addEventListener(n,u);let c=o.subscribe(a);return()=>{t.removeEventListener(n,u),c()}}function on(e,t){let r=e.type,n=t.peek();return r==="date"&&n instanceof Date?()=>e.valueAsDate:en.has(r)&&typeof n=="number"?()=>e.valueAsNumber:()=>e.value}function Bt(e){window.__kiru.profilingContext?.emit("signalAttrUpdate",U(e))}function ot(e,t,r){(e.cleanups??(e.cleanups={})).nodeValue=r.subscribe((n,o)=>{n!==o&&(t.nodeValue=n,l&&window.__kiru.profilingContext?.emit("signalTextUpdate",U(e)))})}function sn(e){let t=e.props.nodeValue;if(!b.isSignal(t))return $.getCurrentChild();let r=t.peek();if(ue(r))return $.getCurrentChild();let n=Ut(e,t),o=$.getCurrentChild();return o?(o.before(n),n):$.getCurrentParent().appendChild(n)}function qt(e){let t=e.type==="#text"?sn(e):$.getCurrentChild();if($.bumpChildIndex(),!t)throw new S({message:"Hydration mismatch - no node found",vNode:e});let r=t.nodeName;if(et.has(r)||(r=r.toLowerCase()),e.type!==r)throw new S({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${r}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&V)){Gt(e);return}b.isSignal(e.props.nodeValue)&&ot(e,t,e.props.nodeValue);let n=e,o=e.sibling;for(;o&&o.type==="#text";){let i=o;$.bumpChildIndex();let s=String(Q(n.props.nodeValue)??""),a=n.dom.splitText(s.length);i.dom=a,b.isSignal(i.props.nodeValue)&&ot(i,a,i.props.nodeValue),n=o,o=o.sibling}}function Xt(e,t,r,n=!1){if(r===null)return e.removeAttribute(t),!0;switch(typeof r){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(n&&!r)return e.removeAttribute(t),!0}return!1}function an(e,t,r){let n=tt.has(t);Xt(e,t,r,n)||e.setAttribute(t,n&&typeof r=="boolean"?"":String(r))}var ln=["INPUT","TEXTAREA"],un=e=>ln.indexOf(e.nodeName)>-1;function it(e,t,r,n){switch(t){case"style":return pn(e,r,n);case"className":return fn(e,r);case"innerHTML":return cn(e,r);case"muted":e.muted=!!r;return;case"value":if(e.nodeName==="SELECT")return Wt(e,r);let o=r==null?"":String(r);if(un(e)){e.value=o;return}e.setAttribute("value",o);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!r;return}e.setAttribute("checked",String(r));return;default:return an(e,tr(t),r)}}function cn(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function fn(e,t){let r=Q(t);if(!r)return e.removeAttribute("class");e.setAttribute("class",r)}function pn(e,t,r){if(Xt(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let n={};typeof r=="string"?e.setAttribute("style",""):typeof r=="object"&&r&&(n=r);let o=t;new Set([...Object.keys(n),...Object.keys(o)]).forEach(s=>{let a=n[s],u=o[s];if(a!==u){if(u===void 0){e.style[s]="";return}e.style[s]=u}})}function dn(e){let t=e.parent,r=t?.dom;for(;t&&!r;)t=t.parent,r=t?.dom;if(!r||!t){if(!e.parent&&e.dom)return e;throw new S({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function mn(e,t){let{node:r,lastChild:n}=t,o=e.dom;if(n){n.after(o);return}let i=Yt(e,r);if(i){r.dom.insertBefore(o,i);return}r.dom.appendChild(o)}function Yt(e,t){let r=e;for(;r;){let n=r.sibling;for(;n;){if(!(n.flags&(O|V))){let o=gn(n);if(o?.isConnected)return o}n=n.sibling}if(r=r.parent,!r||r.flags&V||r===t)return}}function gn(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&V)return;t=t.child}}function Zt(e){if(M.current==="hydrate")return ce(e,Ee);let t={node:e.dom?e:dn(e)};st(e,t,(e.flags&O)>0),e.dom&&!(e.flags&V)&&Jt(e,t,!1),Ee(e)}function st(e,t,r){let n=e.child;for(;n;){if(n.flags&ve){n.flags&O&&hn(n,t),Ee(n),n=n.sibling;continue}n.dom?(st(n,{node:n},!1),n.flags&V||Jt(n,t,r)):st(n,t,(n.flags&O)>0||r),Ee(n),n=n.sibling}}function Jt(e,t,r){(r||!e.dom.isConnected||e.flags&O)&&mn(e,t),(!e.prev||e.flags&D)&&Gt(e),t.lastChild=e.dom}function Qt(e){e===e.parent?.child&&(e.parent.child=e.sibling);let t;l&&(t=U(e)),ce(e,r=>{let{hooks:n,subs:o,cleanups:i,dom:s,props:{ref:a}}=r;for(o?.forEach(u=>u()),i&&Object.values(i).forEach(u=>u());n?.length;)n.pop().cleanup?.();l&&(window.__kiru.profilingContext?.emit("removeNode",t),s instanceof Element&&delete s.__kiruNode),s&&(s.isConnected&&!(r.flags&V)&&s.remove(),a&&Pe(a,null),delete r.dom)}),e.parent=null}function hn(e,t){if(!e.child)return;let r=[];if(er(e.child,r),r.length===0)return;let{node:n,lastChild:o}=t;if(o)o.after(...r);else{let i=Yt(e,n),s=n.dom;i?i.before(...r):s.append(...r)}t.lastChild=r[r.length-1]}function er(e,t){let r=e;for(;r;)r.dom?t.push(r.dom):r.child&&er(r.child,t),r=r.sibling}function d(e,t=null,...r){e===fe&&(e=A);let n=t===null?{}:t,o=lt(n.key),i=r.length;return i===1?n.children=r[0]:i>1&&(n.children=r),{type:e,key:o,props:n}}function fe({children:e,key:t}){return{type:A,key:lt(t),props:{children:e}}}function ut(e){return typeof e[Re]=="function"}function Le(e,t=null,r={},n=null,o=0){e===fe&&(e=A);let i=t?t.depth+1:0;return{type:e,key:n,props:r,parent:t,index:o,depth:i,flags:0,child:null,sibling:null,prev:null,deletions:null}}var pt;function Ne(e,t){return l&&(pt=U(e)),Array.isArray(t)?(l&&(lr in t&&xn(e,t),vn(e,t)),bn(e,t)):wn(e,t)}function wn(e,t){let r=e.child;if(r===null)return ir(e,t);let n=r.sibling,o=nr(e,r,t);if(o!==null)return r&&r!==o&&!o.prev?ft(e,r):n&&ft(e,n),o;{let i=ur(r),s=sr(i,e,0,t);if(s!==null){let a=s.prev;if(a!==null){let u=a.key;i.delete(u===null?a.index:u)}Ve(s,0,0)}return i.forEach(a=>$e(e,a)),s}}function bn(e,t){let r=null,n=null,o=e.child,i=null,s=0,a=0;for(;o!==null&&a<t.length;a++){o.index>a?(i=o,o=null):i=o.sibling;let c=nr(e,o,t[a]);if(c===null){o===null&&(o=i);break}o&&!c.prev&&$e(e,o),s=Ve(c,s,a),n===null?r=c:n.sibling=c,n=c,o=i}if(a===t.length)return ft(e,o),r;if(o===null){for(;a<t.length;a++){let c=ir(e,t[a]);c!==null&&(s=Ve(c,s,a),n===null?r=c:n.sibling=c,n=c)}return r}let u=ur(o);for(;a<t.length;a++){let c=sr(u,e,a,t[a]);if(c!==null){let f=c.prev;if(f!==null){let w=f.key;u.delete(w===null?f.index:w)}s=Ve(c,s,a),n===null?r=c:n.sibling=c,n=c}}return u.forEach(c=>$e(e,c)),r}function nr(e,t,r){let n=t===null?null:t.key;return ue(r)?n!==null||t?.type==="#text"&&b.isSignal(t.props.nodeValue)?null:rr(e,t,""+r):b.isSignal(r)?t&&t.props.nodeValue!==r?null:rr(e,t,r):ge(r)?r.key!==n?null:yn(e,t,r):Array.isArray(r)?n!==null?null:(l&&dt(r),or(e,t,r)):null}function rr(e,t,r){return t===null||t.type!=="#text"?G(e,"#text",{nodeValue:r}):(l&&Se(),t.props.nodeValue!==r&&(t.props.nodeValue=r,t.flags|=D),t.sibling=null,t)}function yn(e,t,r){let{type:n,props:o,key:i}=r;return l&&typeof n=="function"&&(n=k(n)),n===A?or(e,t,o.children||[],o):t?.type===n?(l&&Se(),t.index=0,t.sibling=null,typeof n=="string"?ar(t.props,o)&&(t.flags|=D):t.flags|=D,t.props=o,t):G(e,n,o,i)}function or(e,t,r,n={}){return t===null||t.type!==A?G(e,A,{children:r,...n}):(l&&Se(),t.props={...t.props,...n,children:r},t.flags|=D,t.sibling=null,t)}function ir(e,t){return ue(t)?G(e,"#text",{nodeValue:""+t}):b.isSignal(t)?G(e,"#text",{nodeValue:t}):ge(t)?G(e,t.type,t.props,t.key):Array.isArray(t)?(l&&dt(t),G(e,A,{children:t})):null}function Ve(e,t,r){e.index=r;let n=e.prev;if(n!==null){let o=n.index;return o<t?(e.flags|=O,t):o}else return e.flags|=O,t}function sr(e,t,r,n){if(b.isSignal(n)||ue(n)){let i=e.get(r);if(i){if(i.props.nodeValue===n)return i;i.type==="#text"&&b.isSignal(i.props.nodeValue)&&i.cleanups?.nodeValue?.()}return G(t,"#text",{nodeValue:n},null,r)}if(ge(n)){let{type:i,props:s,key:a}=n,u=e.get(a===null?r:a);return u?.type===i?(l&&Se(),typeof i=="string"?ar(u.props,s)&&(u.flags|=D):u.flags|=D,u.props=s,u.sibling=null,u.index=r,u):G(t,i,s,a,r)}if(Array.isArray(n)){let i=e.get(r);return l&&dt(n),i?(l&&Se(),i.flags|=D,i.props.children=n,i):G(t,A,{children:n},null,r)}return null}function ar(e,t){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!0;for(let o of r)if(!(o==="children"||o==="key")&&e[o]!==t[o])return!0;return!1}function Se(){"window"in globalThis&&window.__kiru.profilingContext?.emit("updateNode",pt)}var lr=Symbol("kiru:marked-list-child");function dt(e){Object.assign(e,{[lr]:!0})}function ur(e){let t=new Map;for(;e;){let r=e.key;t.set(r===null?e.index:r,e),e=e.sibling}return t}function $e(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function ft(e,t){for(;t;)$e(e,t),t=t.sibling}function vn(e,t){let r=new Set,n=!1;for(let o of t){if(!ge(o))continue;let i=o.key;if(typeof i=="string"){if(!n&&r.has(i)){let s=fr(e);cr(\`\${s} component produced a child in a list with a duplicate key prop: "\${i}". Keys should be unique so that components maintain their identity across updates\`),n=!0}r.add(i)}}}function xn(e,t){let r=!1,n=!1;for(let o of t)ge(o)&&(typeof o.key=="string"?r=!0:n=!0);if(n&&r){let o=fr(e);cr(\`\${o} component produced a child in a list without a valid key prop\`)}}function cr(e){let t=\`[kiru]: \${e}. See https://kirujs.dev/keys-warning for more information.\`;console.error(t)}var ct=new WeakMap;function fr(e){if(ct.has(e))return ct.get(e);let t=e.parent,r;for(;!r&&t;)typeof t.type=="function"&&(r=t.type),t=t.parent;let n=\`<\${r?.displayName||r?.name||"Anonymous Function"} />\`;return ct.set(e,n),n}function G(e,t,r,n=null,o=0){let i=Le(t,e,r,n,o);return i.flags|=O,typeof t=="function"&&ut(t)&&(i.flags|=De),l&&"window"in globalThis&&window.__kiru.profilingContext?.emit("createNode",pt),i}var W,B=[],he=!1,gt=[],Ie=[],ht=!1,wt=!1,bt=!1,yt=0,pr=[],vt=[],dr=-1;function Et(e){if(he){gt.push(e);return}e()}function ke(){he&&(window.cancelAnimationFrame(dr),mr())}function St(e){e.flags|=J,B.push(e),he=!0,ke()}function N(e){if(M.current==="hydrate")return Et(()=>xt(e));xt(e)}function En(){he||(he=!0,dr=window.requestAnimationFrame(mr))}function Sn(){for(he=!1;gt.length;)gt.shift()()}function xt(e){if(ht&&(wt=!0),_.current===e){l&&window.__kiru.profilingContext?.emit("updateDirtied",W),bt=!0;return}if(!(e.flags&(J|me))){if(e.flags|=J,!B.length)return B.push(e),En();B.push(e)}}function kn(e){ce(e,t=>t.flags|=me),Ie.push(e)}var _n=(e,t)=>t.depth-e.depth,ee=null;function mr(){if(l){let t=Ie[0]??B[0];t?(W=U(t),window.__kiru.profilingContext?.beginTick(W)):W=null}let e=1;for(zt();B.length;){B.length>e&&B.sort(_n),ee=B.shift(),e=B.length;let t=ee.flags;if(!(t&me)&&t&J){let r=ee;for(;r=Cn(r););for(;Ie.length;)Qt(Ie.pop());Zt(ee),ee.flags&=~J}}if(jt(),ht=!0,mt(pr),ht=!1,wt)return Dn(),mt(vt),wt=!1,yt++,l&&(window.__kiru.profilingContext?.endTick(W),window.__kiru.profilingContext?.emit("updateDirtied",W)),ke();yt=0,Sn(),queueMicrotask(()=>mt(vt)),l&&(window.__kiru.emit("update",W),window.__kiru.profilingContext?.emit("update",W),window.__kiru.profilingContext?.endTick(W))}function Cn(e){let t=Tn(e);if(e.deletions!==null&&(e.deletions.forEach(kn),e.deletions=null),t)return t;let r=e;for(;r;){if(r.immediateEffects&&(pr.push(...r.immediateEffects),r.immediateEffects=void 0),r.effects&&(vt.push(...r.effects),r.effects=void 0),r===ee)return null;if(r.sibling)return r.sibling;r=r.parent,M.current==="hydrate"&&r?.dom&&$.pop()}return null}function Tn(e){let{type:t,props:r,prev:n,flags:o}=e;if(!(l&&we())){if(!(o&J)&&r===n?.props)return null}try{return typeof t=="string"?Rn(e):kt(t)?An(e):Mn(e)}catch(i){l&&window.__kiru.emit("error",W,i instanceof Error?i:new Error(String(i)));let s=gr(e);if(s){let a=s.error=i instanceof Error?i:new Error(String(i));return s.props.onError?.(a),s.depth<ee.depth&&(ee=s),s}if(S.isKiruError(i)){if(i.customNodeStack&&setTimeout(()=>{throw new Error(i.customNodeStack)}),i.fatal)throw i;return console.error(i),e.child}setTimeout(()=>{throw i})}return null}function An(e){let{props:t,type:r}=e,n=t.children;if(r===oe){let{props:{dependents:o,value:i},prev:s}=e;o.size&&s&&s.props.value!==i&&o.forEach(xt)}else if(r===se){let o=e,{error:i}=o;i&&(n=typeof t.fallback=="function"?t.fallback(i):t.fallback,delete o.error)}return e.child=Ne(e,n)}function Mn(e){let{type:t,props:r,subs:n,prev:o,flags:i}=e;if(i&De){if(o&&t[Re](o.props,r)&&!(l&&we()))return e.flags|=ve,null;e.flags&=~ve}try{_.current=e;let s,a=0;do{if(e.flags&=~J,bt=!1,X.current=0,n&&(n.forEach(te),n.clear()),l){if(s=k(t)(r),we()&&e.hooks&&e.hookSig){let u=e.hooks.length;if(X.current<u){for(let c=X.current;c<u;c++)e.hooks[c].cleanup?.();e.hooks.length=X.current,e.hookSig.length=X.current}}if(++a>Qe)throw new S({message:"Too many re-renders. Kiru limits the number of renders to prevent an infinite loop.",fatal:!0,vNode:e});continue}s=t(r)}while(bt);return e.child=Ne(e,s)}finally{_.current=null}}function Rn(e){let{props:t,type:r}=e;return l&&_t(e),e.dom||(M.current==="hydrate"?qt(e):e.dom=Kt(e),l&&e.dom instanceof Element&&(e.dom.__kiruNode=e)),r!=="#text"&&(e.child=Ne(e,t.children),e.child&&M.current==="hydrate"&&$.push(e.dom)),e.child}function Dn(){if(yt>Qe)throw new S("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function mt(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var hr;(function(e){e.Start="start",e.End="end"})(hr||(hr={}));var be=null,wr=new Set;function g(e,t,r){let n=On(e);if(l&&be!==null&&!wr.has(e+be))throw wr.add(e+be),new S({message:\`Nested primitive "useHook" calls are not supported. "\${e}" was called inside "\${be}". Strange will most certainly happen.\`,vNode:n});let o=(a,u)=>{if(u?.immediate){(n.immediateEffects??(n.immediateEffects=[])).push(a);return}(n.effects??(n.effects=[])).push(a)},i=X.current++,s=n.hooks?.at(i);if(l){be=e,n.hooks??(n.hooks=[]),n.hookSig??(n.hookSig=[]),n.hookSig[i]?n.hookSig[i]!==e&&(console.warn(\`[kiru]: hooks must be called in the same order. Hook "\${e}" was called in place of "\${n.hookSig[i]}". Strange things may happen.\`),s?.cleanup?.(),n.hooks.length=i,n.hookSig.length=i,s=void 0):n.hookSig[i]=e;let a;s?a=s:(a=typeof t=="function"?t():{...t},a.name=e),n.hooks[i]=a;try{return r({hook:a,isInit:!s,isHMR:we(),update:()=>N(n),queueEffect:o,vNode:n,index:i})}catch(u){throw u}finally{be=null}}try{let a=s??(typeof t=="function"?t():{...t});return n.hooks??(n.hooks=[]),n.hooks[i]=a,r({hook:a,isInit:!s,update:()=>N(n),queueEffect:o,vNode:n,index:i})}catch(a){throw a}}function On(e){let t=_.current;if(!t)throw new S(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`);return t}function I(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function C(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((r,n)=>!Object.is(r,e[n]))}var _e={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},H=new Map,F=new Map;var br,b=class e{constructor(t,r){this[br]=!0,this.$id=Fe(),this.$value=t,r&&(this.displayName=r),l?(F.set(this.$id,new Set),this.$initialValue=Ct(t),this[ie]={provide:()=>this,inject:n=>{F.get(this.$id)?.clear?.(),F.delete(this.$id),this.$id=n.$id,n.__next=this,this.$initialValue===n.$initialValue?this.$value=n.$value:this.notify()},destroy:()=>{}}):this.$subs=new Set}get value(){if(l){let t=k(this);return e.entangle(t),t.$value}return e.entangle(this),this.$value}set value(t){if(l){let r=k(this);if(Object.is(r.$value,t))return;r.$prevValue=r.$value,r.$value=t,r.notify();return}Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return l?k(this).$value:this.$value}sneak(t){if(l){let r=k(this);r.$prevValue=r.$value,r.$value=t;return}this.$prevValue=this.$value,this.$value=t}toString(){if(l){let t=k(this);return e.entangle(t),\`\${t.$value}\`}return e.entangle(this),\`\${this.$value}\`}subscribe(t){return l?(F.get(this.$id).add(t),()=>F.get(this.$id)?.delete(t)):(this.$subs.add(t),()=>this.$subs.delete(t))}notify(t){if(l)return F.get(this.$id)?.forEach(r=>{if(t&&!t(r))return;let{$value:n,$prevValue:o}=k(this);return r(n,o)});this.$subs.forEach(r=>{if(!(t&&!t(r)))return r(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&Ye in t}static subscribers(t){return l?F.get(t.$id):t.$subs}static makeReadonly(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&!r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},configurable:!0})}static makeWritable(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},set:function(n){this.$value=n,this.notify()},configurable:!0})}static entangle(t){let r=_.current,n=_e.current();if(n){(!r||r&&m())&&n.set(t.$id,t);return}if(!r||!m())return;let o=t.subscribe(()=>N(r));(r.subs??(r.subs=new Set)).add(o)}static dispose(t){if(t.$isDisposed=!0,l){F.delete(t.$id);return}t.$subs.clear()}};br=Ye;var He=(e,t)=>new b(e,t),y=(e,t)=>g("useSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&(n&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()}),set:({value:i})=>{r.signal.value=i}},initialArgs:[e,t]}),o)){let[i,s]=r.dev.initialArgs;(i!==e||s!==t)&&(r.cleanup?.(),n=!0,r.dev.initialArgs=[e,t])}return n&&(r.cleanup=()=>b.dispose(r.signal),r.signal=new b(e,t)),r.signal});function Q(e,t=!1){return b.isSignal(e)?t?e.value:e.peek():e}var Tt=()=>{H.forEach(te),H.clear()};var yr=new Set(["children","ref","key","innerHTML"]),Oe={isInternalProp:e=>yr.has(e),isEvent:e=>e.startsWith("on"),isStringRenderableProperty:e=>!yr.has(e)&&!Oe.isEvent(e)};function tr(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():$t.get(e)||e}}function Ct(e,t={functions:!0}){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[CIRCULAR]";r.add(o)}return typeof o=="function"?t.functions?o.toString():\`[FUNCTION (\${o.name||"anonymous"})]\`:o})}function te(e){e()}var K=Object.freeze(()=>{});function k(e){let t=e;if(l)for(;"__next"in t;)t=t.__next;return t}function Pe(e,t){if(typeof e=="function"){e(t);return}if(b.isSignal(e)){e.value=t;return}e.current=t}function m(){return M.current==="dom"||M.current==="hydrate"}function ge(e){return typeof e=="object"&&e!==null&&"type"in e}function ue(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function kt(e){return e===A||e===oe||e===se}function vr(e){return e.type===A}function U(e){let t=e;for(;t;){if(t.app)return e.app=t.app;t=t.parent}return null}function Ee(e){let{props:t,key:r,index:n}=e;e.prev={props:t,key:r,index:n},e.flags&=~(D|O|me)}function xr(e,t){if(t.depth<e.depth)return!1;if(e===t)return!0;let r=!1,n=[e];for(;n.length;){let o=n.pop();if(o===t)return!0;o.child&&n.push(o.child),r&&o.sibling&&n.push(o.sibling),r=!0}return!1}function ce(e,t){t(e);let r=e.child;for(;r;)t(r),r.child&&ce(r,t),r=r.sibling}function rt(e,t){let r=e.parent;for(;r;){if(t(r))return r;r=r.parent}return null}function gr(e){return rt(e,t=>t.type===se)}function _t(e){if("children"in e.props&&e.props.innerHTML)throw new S({message:"Cannot use both children and innerHTML on an element",vNode:e});for(let t in e.props)if("bind:"+t in e.props)throw new S({message:\`Cannot use both bind:\${t} and \${t} on an element\`,vNode:e})}function lt(e){return e===void 0?null:typeof e=="string"||typeof e=="number"?e:null}var Pn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Fe(e=10,t=Pn){let r="";for(let n=0;n<e;n++)r+=t[Math.random()*t.length|0];return r}var Ln=!1;function we(){return Ln}function ze(e){let{id:t,subs:r,fn:n,deps:o=[],onDepChanged:i}=e,s;H.delete(t);let a=!!_.current&&!m();a||(s=new Map,_e.stack.push(s));let u=n(...o.map(c=>c.value));if(!a){for(let[f,w]of r)s.has(f)||(w(),r.delete(f));let c=()=>{H.size||queueMicrotask(Tt),H.set(t,i)};for(let[f,w]of s){if(r.has(f))continue;let v=w.subscribe(c);r.set(f,v)}_e.stack.pop()}return u}var ye=class e extends b{constructor(t,r){if(super(void 0,r),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,l){let n=this[ie].inject;this[ie]={provide:()=>this,inject:o=>{n(o),e.stop(o),this.$isDirty=o.$isDirty},destroy:()=>{}}}}get value(){return this.ensureNotDirty(),super.value}toString(){return this.ensureNotDirty(),super.toString()}peek(){return this.ensureNotDirty(),super.peek()}set value(t){}subscribe(t){return this.$isDirty&&e.run(this),super.subscribe(t)}static dispose(t){e.stop(t),b.dispose(t)}static updateGetter(t,r){let n=k(t);n.$getter=r,n.$isDirty=!0,e.run(n),!Object.is(n.$value,n.$prevValue)&&n.notify()}static stop(t){let{$id:r,$unsubs:n}=k(t);H.delete(r),n.forEach(te),n.clear(),t.$isDirty=!0}static run(t){let r=k(t),{$id:n,$getter:o,$unsubs:i}=r,s=ze({id:n,subs:i,fn:()=>o(r.$value),onDepChanged:()=>{if(r.$isDirty=!0,l){if(!F?.get(n)?.size)return}else if(!t.$subs.size)return;e.run(r),!Object.is(r.$value,r.$prevValue)&&r.notify()}});r.sneak(s),r.$isDirty=!1}ensureNotDirty(){this.$isDirty&&(l&&this.$isDisposed||e.run(this))}};function Er(e,t){return new ye(e,t)}function At(e,t,r){return g("useComputedSignal",{signal:null,deps:void 0},({hook:n,isInit:o,isHMR:i})=>(l&&(n.dev={devtools:{get:()=>({displayName:n.signal.displayName,value:n.signal.peek()})}},i&&(n.cleanup?.(),o=!0)),o?(typeof t=="string"&&(r=t,t=void 0),n.deps=t,n.cleanup=()=>ye.dispose(n.signal),n.signal=Er(e,r)):n.deps&&typeof t!="string"&&C(n.deps,t)&&(n.deps=t,ye.updateGetter(n.signal,e)),n.signal))}var Ce=class e{constructor(t,r){if(this.id=Fe(),this.getter=t,this.deps=r,this.unsubs=new Map,this.isRunning=!1,this.cleanup=null,l&&"window"in globalThis){let{isWaitingForNextWatchCall:n,pushWatch:o}=window.__kiru.HMRContext.signals;n()&&o(this)}this.start()}start(){if(!this.isRunning){if(this.isRunning=!0,l&&"window"in globalThis&&window.__kiru.HMRContext?.isReplacement())return queueMicrotask(()=>{this.isRunning&&e.run(this)});e.run(this)}}stop(){H.delete(this.id),this.unsubs.forEach(te),this.unsubs.clear(),this.cleanup?.(),this.cleanup=null,this.isRunning=!1}static run(t){let r=k(t),{id:n,getter:o,unsubs:i,deps:s}=r;r.cleanup=ze({id:n,subs:i,fn:o,deps:s,onDepChanged:()=>{r.cleanup?.(),e.run(r)}})??null}};function Sr(e,t){if(typeof e=="function")return new Ce(e);let r=e,n=t;return new Ce(n,r)}function Te(e,t){if(m())return g("useWatch",{watcher:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&o&&(r.cleanup?.(),n=!0),n){let i=r.watcher=Sr(e,t);r.cleanup=()=>i.stop()}return r.watcher})}var Vn=0;function kr(e,t,r){if(l&&t.__kiruNode)throw new Error("[kiru]: container in use - call unmount on the previous app first.");let n=$n(t),o=Vn++,i={id:o,name:r?.name??\`App-\${o}\`,rootNode:n,render:s,unmount:a};function s(u){n.props.children=u,St(n)}function a(){n.props.children=null,St(n),l&&(delete t.__kiruNode,delete n.app),window.__kiru.emit("unmount",i)}return l&&(n.app=i),s(e),window.__kiru.emit("mount",i,N),l&&queueMicrotask(()=>{window.dispatchEvent(new Event("kiru:ready"))}),i}function $n(e){let t=Le(e.nodeName.toLowerCase());return t.flags|=V,t.dom=e,l&&(e.__kiruNode=t),t}function pe(e){return m()?g("useState",{state:void 0,dispatch:K},({hook:t,isInit:r,update:n,isHMR:o})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.state}),set:({value:i})=>t.state=i},initialArgs:[e]}),o)){let[i]=t.dev.initialArgs;i!==e&&(r=!0,t.dev.initialArgs=[e])}return r&&(t.state=typeof e=="function"?e():e,t.dispatch=i=>{let s=typeof i=="function"?i(t.state):i;Object.is(t.state,s)||(t.state=s,n())}),[t.state,t.dispatch]}):[typeof e=="function"?e():e,K]}function _r(e){let t={[Pt]:!0,Provider:({value:r,children:n})=>{let[o]=pe(()=>new Set);return d(oe,{value:r,ctx:t,dependents:o},typeof n=="function"?n(r):n)},default:()=>e,set displayName(r){this.Provider.displayName=r},get displayName(){return this.Provider.displayName||"Anonymous Context"}};return t}function Y(e,t){return m()?g("useCallback",{callback:e,deps:t},({hook:r,isHMR:n})=>(l&&(r.dev={devtools:{get:()=>({callback:r.callback,dependencies:r.deps})}},n&&(r.deps=[])),C(t,r.deps)&&(r.deps=t,r.callback=e),r.callback)):e}function z(e,t){if(m())return g("useEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:i})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||C(t,r.deps))&&(r.deps=t,I(r),i(()=>{let s=e();typeof s=="function"&&(r.cleanup=s)}))})}function re(e,t){if(m())return g("useLayoutEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:i})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||C(t,r.deps))&&(r.deps=t,I(r),i(()=>{let s=e();typeof s=="function"&&(r.cleanup=s)},{immediate:!0}))})}function Ae(e,t){return m()?g("useMemo",{deps:t,value:void 0},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({value:r.value,dependencies:r.deps})}},o&&(n=!0)),(n||C(t,r.deps))&&(r.deps=t,r.value=e()),r.value)):e()}function P(e){return m()?g("useRef",{ref:{current:e}},({hook:t,isInit:r,isHMR:n})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.ref.current}),set:({value:o})=>t.ref.current=o},initialArgs:[t.ref.current]}),n)){let[o]=t.dev.initialArgs;o!==e&&(t.ref={current:e},t.dev.initialArgs=[e])}return t.ref}):{current:e}}var hl="window"in globalThis?window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map):new Map;function Ar(e){let[t,r]=pe(e.initialState||"exited"),n=P(null);re(()=>{e.in&&t!=="entered"&&t!=="entering"?(o("entering"),i("entered")):!e.in&&t!=="exited"&&t!=="exiting"&&(o("exiting"),i("exited"))},[e.in,t]),z(()=>()=>Tr(n.current),[]);let o=Y(s=>{Tr(n.current),r(s),(s==="entered"||s==="exited")&&e.onTransitionEnd&&e.onTransitionEnd(s)},[]),i=Y(s=>{n.current=window.setTimeout(()=>o(s),Hn(s,e.duration))},[e.duration]);return e.element(t)}var Cr=150;function Hn(e,t){if(typeof t=="number")return t;switch(e){case"entered":return t?.in??Cr;case"exited":return t?.out??Cr}}function Tr(e){e!=null&&window.clearTimeout(e)}"window"in globalThis;var Mr=()=>d("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},d("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"}));var je="kiru.devtools.anchorPosition",Rr={x:-16,y:-16};var Mt=(e,t,r)=>{if(!t.current)return{...Rr};let n=window.innerWidth/e.width,o=window.innerHeight/e.height,i=null,s=null;return e.snapSide==="left"?i=(t.current.offsetWidth-r.width.value)*-1+16:e.snapSide==="right"?i=-16:e.snapSide==="bottom"?s=-16:e.snapSide==="top"&&(s=(window.innerHeight-r.height.value)*-1+16),{x:i??e.x*n,y:s??e.y*o}},Dr=e=>{if(e==null)return null;let t=null,r=e?.__kiruNode?.parent;for(;r;){if(typeof r.type=="function"&&!vr(r)){t=r;break}r=r.parent}return t},Or=(e,t)=>{let r=[],n=[t.__kiruNode];for(;n.length;){let i=n.pop();if(i===e)break;i?.dom&&r.push(i),i?.parent&&n.push(i.parent)}if(r.length===0)return;let o=r[r.length-1].dom;return o instanceof Element?o:void 0};function Ke(e,t){if(!e)throw new Error(t)}var Lr={arrayChunkSize:10,objectKeysChunkSize:100};function Vr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let n in r)if(typeof t[n]!=typeof e[n]||typeof e[n]=="object"&&!Vr(e[n],t[n]))return!1;return!0}var jn={...Lr},Pr=localStorage.getItem("kiru.devtools.userSettings");if(Pr)try{let e=JSON.parse(Pr);Vr(Lr,e)&&(jn=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}var cc=_r({userSettings:null,saveUserSettings:()=>{}});var bc=Object.freeze(()=>{});var Gn="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??(window.__devtoolsSelection=null),window.__devtoolsNodeUpdatePtr??(window.__devtoolsNodeUpdatePtr=null));var Rt=class extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}},R=new Rt(Gn);var jc=Symbol.for("devtools.hookGroup");var L=(e,t,r={})=>{z(()=>{let n=window,o=r?.ref?.();return o?n=o:r.ref&&console.warn("useEventListener ref failed, using window"),n.addEventListener(e,t,r),()=>{n.removeEventListener(e,t,r)}},[t])};var Ue=()=>{let e=y({x:0,y:0}),t=y({x:0,y:0}),r=y({x:0,y:0});return L("mousemove",n=>{e.value={x:n.x,y:n.y},t.value={x:n.movementX,y:n.movementY},r.value={x:n.clientX,y:n.clientY}}),{mouse:e,delta:t,client:r}};var Ge="window"in globalThis&&"ResizeObserver"in globalThis.window,$r=(e,t,r=void 0)=>m()?Ge?g("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:i})=>(n&&(o.resizeObserver=new ResizeObserver(t),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null}),i(()=>{C([e.current],o.deps)&&(o.deps=[e.current],o.resizeObserver?.disconnect?.(),e.current&&o.resizeObserver?.observe(e.current,r))}),{isSupported:Ge,start:()=>{o.resizeObserver==null&&(o.resizeObserver=new ResizeObserver(t),e.current&&o.resizeObserver.observe(e.current,r),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null})},stop:()=>{I(o)}})):{isSupported:Ge,start:()=>{},stop:()=>{}}:{isSupported:Ge,start:()=>{},stop:()=>{}};var We="window"in globalThis&&"MutationObserver"in globalThis.window,Nr=(e,t,r=void 0)=>m()?We?g("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:i})=>(n?(i(()=>{o.deps=[e.current],o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r)}),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null}):C([e.current],o.deps)&&(o.deps=[e.current],o.mutationObserver?.disconnect?.(),e.current&&o.mutationObserver?.observe(e.current,r)),{isSupported:We,start:()=>{o.mutationObserver==null&&(o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null})},stop:()=>{I(o)}})):{isSupported:We,start:()=>{},stop:()=>{}}:{isSupported:We,start:()=>{},stop:()=>{}};var Be=(e,t={windowScroll:!0,windowResize:!0})=>{let r=t?.windowScroll??!0,n=t?.windowResize??!0,o=t.immediate??!0,i=y(0),s=y(0),a=y(0),u=y(0),c=y(0),f=y(0),w=y(0),v=y(0),p=()=>{let x=e.current;if(!x){i.value=0,s.value=0,a.value=0,u.value=0,c.value=0,f.value=0,w.value=0,v.value=0;return}let E=x.getBoundingClientRect();i.value=E.width,s.value=E.height,a.value=E.top,u.value=E.right,c.value=E.bottom,f.value=E.left,w.value=E.x,v.value=E.y};return $r(e,p),Nr(e,p,{attributeFilter:["style","class"]}),L("scroll",()=>{r&&p()},{capture:!0,passive:!0}),L("resize",()=>{n&&p()},{passive:!0}),re(()=>{o&&p()},[]),{width:i,height:s,top:a,right:u,bottom:c,left:f,x:w,y:v,update:p}};var Ir=(e,t)=>{if(!m())return{isActive:t?.immediate??!1,start:()=>null,stop:()=>null};let r=t?.fpsLimit?1e3/t.fpsLimit:null;return g("useRafFn",()=>({callback:e,refId:null,previousFrameTimestamp:0,isActive:t?.immediate??!1,rafLoop:()=>{}}),({isInit:n,hook:o,update:i})=>(o.callback=e,n&&(o.rafLoop=s=>{if(o.isActive===!1)return;o.previousFrameTimestamp||(o.previousFrameTimestamp=s);let a=s-o.previousFrameTimestamp;if(r&&a<r){o.refId=window.requestAnimationFrame(o.rafLoop);return}o.previousFrameTimestamp=s,o.callback({delta:a,timestamp:s}),o.refId=window.requestAnimationFrame(o.rafLoop)}),n&&t?.immediate&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},i()),{isActive:o.isActive,start:()=>{o.isActive!==!0&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},i())},stop:()=>{I(o),i()}}))};var Hr=e=>{let{x:t,y:r,multiple:n,immediate:o=!0}=e,i=y(null),a=Ir(()=>{i.value=n?document.elementsFromPoint(t,r)??[]:document.elementFromPoint(t,r)??null},{immediate:o});return{element:i,...a}};var Fr=()=>{let{mouse:e}=Ue(),t=y(null),r=P(null),n=P(null),o=Be(r),i=y({x:-16,y:-16}),s=y({x:-16,y:-16}),a=y({width:window.innerWidth,height:window.innerHeight}),u=y("bottom"),c=P(null);re(()=>{let p=localStorage.getItem(je);if(p==null)return;let x=JSON.parse(p);a.value.width=window.innerWidth,a.value.height=window.innerHeight,u.value=x.snapSide,s.value=Mt(x,n,o)},[]);let f=At(()=>{let{x:p,y:x}=e.value;if(t.value===null)return null;let{x:E,y:T}=t.value;return{x:p-E,y:x-T}});L("dragstart",p=>{p.preventDefault(),t.value={x:p.x,y:p.y},i.value=s.value},{ref:()=>r.current}),L("mouseup",()=>{c.current&&(clearTimeout(c.current),c.current=null),t.peek()&&(t.value=null,localStorage.setItem(je,JSON.stringify({...s.value,...a.value,snapSide:u.value})))});let w=Y(()=>{if(n.current==null)return;let p=n.current.offsetWidth;if(u.value==="right"){let x=Math.min(-16,s.value.y);s.value={x:-16,y:Math.max(x,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="left"){let x=Math.min(0,s.value.y);s.value={x:(p-o.width.value)*-1+16,y:Math.max(x,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="top"){let x=Math.min(-16,s.value.x);s.value={x:Math.max(x,(p-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}else{let x=Math.min(-16,s.value.x);s.value={x:Math.max(x,(p-o.width.value)*-1+16),y:-16}}},[]);Te([f,e],(p,x)=>{if(p===null||!n.current)return;let{x:E,y:T}=x,Z=n.current.offsetWidth,de=T>=window.innerHeight-100,Ot=T<=100;if(!Ot&&!de){let ne=E>window.innerWidth/2;u.value=ne?"right":"left"}else u.value=Ot?"top":"bottom";if(u.value==="right"){let ne=Math.min(-16,i.value.y+p.y);s.value={x:-16,y:Math.max(ne,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="left"){let ne=Math.min(0,i.value.y+p.y);s.value={x:(Z-o.width.value)*-1+16,y:Math.max(ne,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="top"){let ne=Math.min(-16,i.value.x+p.x);s.value={x:Math.max(ne,(Z-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}let Wr=Math.min(-16,i.value.x+p.x);s.value={y:-16,x:Math.max(Wr,(Z-o.width.value)*-1+16)}});let v=Y(()=>{n.current!==null&&(s.value=Mt({width:a.value.width,height:a.value.height,x:s.value.x,y:s.value.y,snapSide:u.value},n,o),a.value.width=window.innerWidth,a.value.height=window.innerHeight,localStorage.setItem(je,JSON.stringify({...s.value,...a.value,snapSide:u.value})))},[Math.round(o.width.value),Math.round(o.height.value)]);return L("resize",v),{anchorRef:r,anchorCoords:s,viewPortRef:n,startMouse:t,elementBound:o,snapSide:u,updateAnchorPos:w}};var j=He(!1);"window"in globalThis&&R.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(j.value=e.data.value)});var q=He(null);var zr="kiru-devtools-popup-size",qe=()=>{let e=q.value;return Y(()=>new Promise((r,n)=>{if(e)if(e.closed)q.value=null;else return e.focus(),r(e);let o=sessionStorage.getItem(zr),i=o?JSON.parse(o):{width:Math.floor(Math.min(1920,window.screen.width)/2),height:Math.floor(Math.min(1080,window.screen.height)/2)},s=\`popup,width=\${i.width},height=\${i.height};\`,a=window.open(window.__KIRU_DEVTOOLS_PATHNAME__,"_blank",s);if(!a)return console.error("[kiru]: Unable to open devtools window"),n();let u=c=>{c.data.type==="ready"&&(R.removeEventListener(u),console.debug("[kiru]: devtools window opened"),r(a),q.value=a,a.onbeforeunload=()=>{console.debug("[kiru]: devtools window closed"),q.value=null})};R.addEventListener(u),a.onresize=()=>{sessionStorage.setItem(zr,JSON.stringify({width:a.innerWidth,height:a.innerHeight}))}}),[e])};var jr=()=>{let e=qe(),{mouse:t}=Ue(),r=Hr({x:t.value.x,y:t.value.y,immediate:!1}),n=r.element.value,o=j.value?n:null,i=Ae(()=>{if(o&&window.__kiru){let c=window.__kiru.apps.find(f=>f.rootNode==null||o.__kiruNode==null?!1:xr(f.rootNode,o.__kiruNode));return c?.rootNode==null?null:c}return null},[o]),s=Ae(()=>o?Dr(o):null,[o]),a=P(null),u=Be(a);return z(()=>j.subscribe(f=>{r[f?"start":"stop"]()}),[]),z(()=>{s&&o?a.current=Or(s,o)??null:a.current=null},[s,o]),L("click",c=>{if(j.value===!0&&s&&i){c.preventDefault();let f=w=>{w.__devtoolsSelection={node:s,app:i},R.send({type:"select-node"}),R.send({type:"set-inspect-enabled",value:!1}),j.value=!1,a.current=null,w.focus()};q.value?f(q.value):e().then(w=>f(w))}}),s&&d("div",{className:"bg-[crimson]/80 fixed grid place-content-center pointer-events-none z-10 top-0 left-0",style:{width:\`\${u?.width}px\`,height:\`\${u?.height}px\`,transform:\`translate(\${u.x}px, \${u.y}px)\`}},d("p",null,s.type.name))};function Kr(e){return d("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 -960 960 960",fill:"currentColor",...e},d("path",{d:"M710-150q-63 0-106.5-43.5T560-300q0-63 43.5-106.5T710-450q63 0 106.5 43.5T860-300q0 63-43.5 106.5T710-150Zm0-80q29 0 49.5-20.5T780-300q0-29-20.5-49.5T710-370q-29 0-49.5 20.5T640-300q0 29 20.5 49.5T710-230Zm-270-30H200q-17 0-28.5-11.5T160-300q0-17 11.5-28.5T200-340h240q17 0 28.5 11.5T480-300q0 17-11.5 28.5T440-260ZM250-510q-63 0-106.5-43.5T100-660q0-63 43.5-106.5T250-810q63 0 106.5 43.5T400-660q0 63-43.5 106.5T250-510Zm0-80q29 0 49.5-20.5T320-660q0-29-20.5-49.5T250-730q-29 0-49.5 20.5T180-660q0 29 20.5 49.5T250-590Zm510-30H520q-17 0-28.5-11.5T480-660q0-17 11.5-28.5T520-700h240q17 0 28.5 11.5T800-660q0 17-11.5 28.5T760-620Zm-50 320ZM250-660Z"}))}function Ur(e){return d("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer",...e},d("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),d("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}))}var Wn=()=>{j.value=!j.value,R.send({type:"set-inspect-enabled",value:j.value})};function Bn(e,t){let{damping:r}=t,n=y(e),o=P(e);return z(()=>{let i=null,s=()=>{if(Math.sqrt(Math.pow(o.current.x-n.value.x,2)+Math.pow(o.current.y-n.value.y,2))<5)return;let u=n.value.x+(o.current.x-n.value.x)*r,c=n.value.y+(o.current.y-n.value.y)*r;n.value={x:u,y:c},i=window.requestAnimationFrame(s)};return i=window.requestAnimationFrame(s),()=>{i!=null&&window.cancelAnimationFrame(i)}},[e.x,e.y]),Object.assign(n,{set:(i,s)=>{o.current=i,s?.hard&&(n.value=i)}})}function Dt(){let e=y(!1),t=qe(),{anchorCoords:r,anchorRef:n,viewPortRef:o,startMouse:i,snapSide:s}=Fr(),a=s.value==="left"||s.value==="right",u=P(!1),c=Bn(r.value,{damping:.4});return Te([r],c.set),re(()=>{u.current===!1&&c.set(r.value,{hard:!0}),u.current=!0},[]),d(fe,null,d("div",{ref:o,className:"w-full h-0 fixed top-0 left-0 z-[-9999] overflow-scroll pointer-events-none"}),d("div",{ref:n,draggable:!0,className:\`flex \${a?"flex-col":""} \${e.value?"rounded-3xl":"rounded-full"} p-1 gap-1 items-center will-change-transform bg-crimson\`,style:{transform:\`translate3d(\${Math.round(c.value.x)}px, \${Math.round(c.value.y)}px, 0)\`}},d(Ar,{in:e.value,duration:{in:40,out:150},element:f=>{if(f==="exited")return null;let w=f==="entered"?"1":"0.5",v=f==="entered"?"1":"0";return d(fe,null,d("button",{title:"Open Devtools",onclick:t,style:{transform:\`scale(\${w})\`,opacity:v},className:"transition text-white rounded-full p-1 hover:bg-[#0003]"},d(Kr,{width:16,height:16})),d("button",{title:"Toggle Component Inspection",onclick:Wn,style:{transform:\`scale(\${w})\`,opacity:v},className:\`transition text-white rounded-full p-1 hover:bg-[#0003] \${j.value?"bg-[#0003]":""}\`},d(Ur,{width:16,height:16})))}}),d("button",{className:"bg-crimson rounded-full p-1"+(i.value?" pointer-events-none":""),onclick:()=>e.value=!e.value,tabIndex:-1},d(Mr,null))),d(jr,null))}var Gr=\`*, ::before, ::after {
|
|
9170
9792
|
--tw-border-spacing-x: 0;
|
|
9171
9793
|
--tw-border-spacing-y: 0;
|
|
9172
9794
|
--tw-translate-x: 0;
|
|
@@ -9933,7 +10555,7 @@ video {
|
|
|
9933
10555
|
.focus\\\\:outline:focus {
|
|
9934
10556
|
outline-style: solid;
|
|
9935
10557
|
}
|
|
9936
|
-
\`;if("window"in globalThis){let e=function(){let t=document.createElement("kiru-devtools");t.setAttribute("style","display: contents"),document.body.appendChild(t);let r=t.attachShadow({mode:"open"}),n=new CSSStyleSheet;n.replaceSync(
|
|
10558
|
+
\`;if("window"in globalThis){let e=function(){let t=document.createElement("kiru-devtools");t.setAttribute("style","display: contents"),document.body.appendChild(t);let r=t.attachShadow({mode:"open"}),n=new CSSStyleSheet;n.replaceSync(Gr),r.adoptedStyleSheets=[n];let o=Object.assign(document.createElement("div"),{id:"devtools-root",className:"fixed flex bottom-0 right-0 z-[9999999]"});r.appendChild(o),kr(d(Dt,{}),o,{name:"kiru.devtools"});let i=()=>q.value?.close();window.addEventListener("close",i),window.addEventListener("beforeunload",i),R.addEventListener(s=>{switch(s.data.type){case"update-node":{let a=window.__devtoolsNodeUpdatePtr;Ke(a,"failed to get node ptr");let u=U(a);Ke(u,"failed to get app context");let c=window.__kiru.getSchedulerInterface(u);Ke(c,"failed to get scheduler interface"),c.requestUpdate(a),window.__devtoolsNodeUpdatePtr=null;break}case"open-editor":{window.open(s.data.fileLink);break}}})};Xn=e,window.addEventListener("kiru:ready",e,{once:!0})}var Xn;
|
|
9937
10559
|
|
|
9938
10560
|
`;
|
|
9939
10561
|
|
|
@@ -11339,7 +11961,7 @@ async function getClientAssets(clientOutDirAbs, manifestPath) {
|
|
|
11339
11961
|
const clientManifestPath = path6.resolve(clientOutDirAbs, manifestPath);
|
|
11340
11962
|
if (fs3.existsSync(clientManifestPath)) {
|
|
11341
11963
|
const manifest = JSON.parse(fs3.readFileSync(clientManifestPath, "utf-8"));
|
|
11342
|
-
const clientEntryKey =
|
|
11964
|
+
const clientEntryKey = "virtual:kiru:entry-client";
|
|
11343
11965
|
if (manifest[clientEntryKey]?.file) {
|
|
11344
11966
|
clientEntry = manifest[clientEntryKey].file;
|
|
11345
11967
|
}
|
|
@@ -11365,7 +11987,7 @@ function collectCssForModules(manifest, moduleIds, projectRoot) {
|
|
|
11365
11987
|
(it.css || []).forEach((c) => cssFiles.add(c));
|
|
11366
11988
|
(it.imports || []).forEach((imp) => collectCss(imp));
|
|
11367
11989
|
};
|
|
11368
|
-
const entryClientKey =
|
|
11990
|
+
const entryClientKey = "virtual:kiru:entry-client";
|
|
11369
11991
|
if (manifest[entryClientKey] && !seen.has(entryClientKey)) {
|
|
11370
11992
|
collectCss(entryClientKey);
|
|
11371
11993
|
}
|
|
@@ -11428,10 +12050,10 @@ async function renderRoute(state, mod, route, srcFilePath, clientEntry, manifest
|
|
|
11428
12050
|
const documentModuleId = documentPath.replace(/\\/g, "/");
|
|
11429
12051
|
moduleIds.push(documentModuleId);
|
|
11430
12052
|
const ctx = {
|
|
11431
|
-
registerModule(moduleId) {
|
|
12053
|
+
registerModule: (moduleId) => {
|
|
11432
12054
|
moduleIds.push(moduleId);
|
|
11433
12055
|
},
|
|
11434
|
-
|
|
12056
|
+
registerPreloadedPageProps: (props) => {
|
|
11435
12057
|
;
|
|
11436
12058
|
(state.staticProps[srcFilePath] ??= {})[route] = props;
|
|
11437
12059
|
}
|
|
@@ -11584,7 +12206,7 @@ async function appendStaticPropsToClientModules(state, clientOutDirAbs, log) {
|
|
|
11584
12206
|
Object.keys(manifest).length,
|
|
11585
12207
|
"entries"
|
|
11586
12208
|
);
|
|
11587
|
-
const clientEntryChunk = manifest[
|
|
12209
|
+
const clientEntryChunk = manifest["virtual:kiru:entry-client"];
|
|
11588
12210
|
if (!clientEntryChunk) {
|
|
11589
12211
|
throw new Error("Client entry chunk not found in manifest");
|
|
11590
12212
|
}
|
|
@@ -11613,36 +12235,6 @@ ${code}`, "utf-8");
|
|
|
11613
12235
|
|
|
11614
12236
|
// src/index.ts
|
|
11615
12237
|
import { build } from "vite";
|
|
11616
|
-
|
|
11617
|
-
// src/globals.ts
|
|
11618
|
-
var $KIRU_HEADLESS_GLOBAL = Symbol.for("kiru.headlessGlobal");
|
|
11619
|
-
var global = globalThis[$KIRU_HEADLESS_GLOBAL] ??= {
|
|
11620
|
-
viteDevServer: null,
|
|
11621
|
-
server: null
|
|
11622
|
-
};
|
|
11623
|
-
var VITE_DEV_SERVER_INSTANCE = {
|
|
11624
|
-
get current() {
|
|
11625
|
-
return global.viteDevServer;
|
|
11626
|
-
},
|
|
11627
|
-
set current(server) {
|
|
11628
|
-
global.viteDevServer = server;
|
|
11629
|
-
}
|
|
11630
|
-
};
|
|
11631
|
-
var entryServerResolvers = [];
|
|
11632
|
-
var KIRU_SERVER_ENTRY = {
|
|
11633
|
-
get current() {
|
|
11634
|
-
return global.serverEntry;
|
|
11635
|
-
},
|
|
11636
|
-
set current(server) {
|
|
11637
|
-
global.serverEntry = server;
|
|
11638
|
-
if (server) {
|
|
11639
|
-
entryServerResolvers.forEach((fn) => fn());
|
|
11640
|
-
entryServerResolvers = [];
|
|
11641
|
-
}
|
|
11642
|
-
}
|
|
11643
|
-
};
|
|
11644
|
-
|
|
11645
|
-
// src/index.ts
|
|
11646
12238
|
function kiru(opts = {}) {
|
|
11647
12239
|
let state;
|
|
11648
12240
|
let log;
|
|
@@ -11658,17 +12250,10 @@ function kiru(opts = {}) {
|
|
|
11658
12250
|
const initialState = createPluginState(opts);
|
|
11659
12251
|
state = updatePluginState(initialState, config, opts);
|
|
11660
12252
|
log = createLogger(state);
|
|
11661
|
-
if (state.
|
|
11662
|
-
virtualModules = await createVirtualModules(
|
|
11663
|
-
state.projectRoot,
|
|
11664
|
-
state.ssrOptions,
|
|
11665
|
-
"ssr"
|
|
11666
|
-
);
|
|
11667
|
-
} else if (state.ssgOptions) {
|
|
12253
|
+
if (state.ssgOptions) {
|
|
11668
12254
|
virtualModules = await createVirtualModules(
|
|
11669
12255
|
state.projectRoot,
|
|
11670
|
-
state.ssgOptions
|
|
11671
|
-
"ssg"
|
|
12256
|
+
state.ssgOptions
|
|
11672
12257
|
);
|
|
11673
12258
|
}
|
|
11674
12259
|
},
|
|
@@ -11685,12 +12270,10 @@ function kiru(opts = {}) {
|
|
|
11685
12270
|
createPreviewMiddleware(state.projectRoot, state.baseOutDir)
|
|
11686
12271
|
);
|
|
11687
12272
|
},
|
|
11688
|
-
|
|
11689
|
-
VITE_DEV_SERVER_INSTANCE.current = server;
|
|
12273
|
+
configureServer(server) {
|
|
11690
12274
|
if (state.isProduction || state.isBuild) return;
|
|
11691
12275
|
const {
|
|
11692
12276
|
ssgOptions,
|
|
11693
|
-
ssrOptions,
|
|
11694
12277
|
devtoolsEnabled,
|
|
11695
12278
|
dtClientPathname,
|
|
11696
12279
|
dtHostScriptPath,
|
|
@@ -11711,40 +12294,26 @@ function kiru(opts = {}) {
|
|
|
11711
12294
|
const url = req.originalUrl || req.url || "/";
|
|
11712
12295
|
const filePath = path7.join(state.baseOutDir, "client", url);
|
|
11713
12296
|
const extName = path7.extname(filePath);
|
|
11714
|
-
|
|
11715
|
-
const shouldHandle = typeof accept === "string" && accept.includes("text/html") && !url.startsWith("/node_modules/") && !url.startsWith("/@") && !url.startsWith(dtHostScriptPath) && !url.startsWith(dtClientPathname) && (extName === ".html" || !extName);
|
|
11716
|
-
if (!shouldHandle) {
|
|
12297
|
+
if (extName && extName !== ".html") {
|
|
11717
12298
|
return next();
|
|
11718
12299
|
}
|
|
11719
|
-
const
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
ANSI.red("[SSG] Middleware Error"),
|
|
11732
|
-
`
|
|
11733
|
-
${ANSI.yellow("URL:")} ${req.url}`,
|
|
11734
|
-
`
|
|
11735
|
-
${ANSI.yellow("Error:")} ${error.message}`
|
|
11736
|
-
);
|
|
11737
|
-
if (error.stack) {
|
|
11738
|
-
console.error(ANSI.black_bright(error.stack));
|
|
12300
|
+
const accept = req.headers["accept"] || "";
|
|
12301
|
+
if (typeof accept === "string" && accept.includes("text/html") && !url.startsWith("/node_modules/") && !url.startsWith("/@") && !url.startsWith(dtHostScriptPath) && !url.startsWith(dtClientPathname)) {
|
|
12302
|
+
const { status, html } = await handleSSR(
|
|
12303
|
+
server,
|
|
12304
|
+
url,
|
|
12305
|
+
state.projectRoot,
|
|
12306
|
+
() => resolveUserDocument(projectRoot, ssgOptions)
|
|
12307
|
+
);
|
|
12308
|
+
res.statusCode = status;
|
|
12309
|
+
res.setHeader("Content-Type", "text/html");
|
|
12310
|
+
res.end(html);
|
|
12311
|
+
return;
|
|
11739
12312
|
}
|
|
11740
|
-
|
|
12313
|
+
} catch (e) {
|
|
12314
|
+
console.error(e);
|
|
11741
12315
|
}
|
|
11742
|
-
|
|
11743
|
-
} else if (ssrOptions) {
|
|
11744
|
-
queueMicrotask(() => {
|
|
11745
|
-
server.ssrLoadModule(VIRTUAL_ENTRY_SERVER_ID).then((mod) => {
|
|
11746
|
-
KIRU_SERVER_ENTRY.current = mod;
|
|
11747
|
-
});
|
|
12316
|
+
next();
|
|
11748
12317
|
});
|
|
11749
12318
|
}
|
|
11750
12319
|
},
|
|
@@ -11793,6 +12362,9 @@ ${ANSI.yellow("Error:")} ${error.message}`
|
|
|
11793
12362
|
log
|
|
11794
12363
|
};
|
|
11795
12364
|
prepareDevOnlyHooks(ctx);
|
|
12365
|
+
if (state.features.staticHoisting) {
|
|
12366
|
+
prepareJSXHoisting(ctx);
|
|
12367
|
+
}
|
|
11796
12368
|
if (!state.isProduction && !state.isBuild) {
|
|
11797
12369
|
prepareHMR(ctx);
|
|
11798
12370
|
}
|
|
@@ -11814,14 +12386,15 @@ ${ANSI.yellow("Error:")} ${error.message}`
|
|
|
11814
12386
|
};
|
|
11815
12387
|
}
|
|
11816
12388
|
};
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
|
|
12389
|
+
return [
|
|
12390
|
+
mainPlugin,
|
|
12391
|
+
{
|
|
11820
12392
|
name: "vite-plugin-kiru:ssg",
|
|
11821
12393
|
apply: "build",
|
|
11822
12394
|
enforce: "post",
|
|
11823
12395
|
async closeBundle(error) {
|
|
11824
|
-
if (error || this.environment.config.build.ssr)
|
|
12396
|
+
if (error || this.environment.config.build.ssr || !state.ssgOptions)
|
|
12397
|
+
return;
|
|
11825
12398
|
log(ANSI.cyan("[SSG]"), "Starting SSG build...");
|
|
11826
12399
|
await build({
|
|
11827
12400
|
...inlineConfig,
|
|
@@ -11833,35 +12406,8 @@ ${ANSI.yellow("Error:")} ${error.message}`
|
|
|
11833
12406
|
});
|
|
11834
12407
|
log(ANSI.cyan("[SSG]"), "SSG build complete!");
|
|
11835
12408
|
}
|
|
11836
|
-
}
|
|
11837
|
-
|
|
11838
|
-
plugins.push({
|
|
11839
|
-
name: "vite-plugin-kiru:ssr",
|
|
11840
|
-
apply: "build",
|
|
11841
|
-
enforce: "post",
|
|
11842
|
-
async closeBundle(error) {
|
|
11843
|
-
if (error || this.environment.config.build.ssr || !state.ssrOptions)
|
|
11844
|
-
return;
|
|
11845
|
-
log(ANSI.cyan("[SSR]"), "Starting SSR build...");
|
|
11846
|
-
await build({
|
|
11847
|
-
...inlineConfig,
|
|
11848
|
-
configFile: false,
|
|
11849
|
-
build: {
|
|
11850
|
-
...inlineConfig?.build,
|
|
11851
|
-
ssr: true,
|
|
11852
|
-
rollupOptions: {
|
|
11853
|
-
input: [
|
|
11854
|
-
path7.resolve(state.projectRoot, state.ssrOptions.runtimeEntry),
|
|
11855
|
-
VIRTUAL_ENTRY_SERVER_ID
|
|
11856
|
-
]
|
|
11857
|
-
}
|
|
11858
|
-
}
|
|
11859
|
-
});
|
|
11860
|
-
log(ANSI.cyan("[SSR]"), "SSR build complete!");
|
|
11861
|
-
}
|
|
11862
|
-
});
|
|
11863
|
-
}
|
|
11864
|
-
return plugins;
|
|
12409
|
+
}
|
|
12410
|
+
];
|
|
11865
12411
|
}
|
|
11866
12412
|
function onHMR(callback) {
|
|
11867
12413
|
}
|