@llmops/app 0.1.8 → 0.1.9-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +285 -366
- package/dist/assets/Form-DHA5ZPmK.js +1 -0
- package/dist/assets/_environment-Bj632BW3.js +1 -0
- package/dist/assets/_observability-Bsw31e8i.js +1 -0
- package/dist/assets/_settings-MuCcKpRb.js +1 -0
- package/dist/assets/{_tabs-DaucGqpx.js → _tabs-DR5WY23M.js} +1 -1
- package/dist/assets/{_tabs-D9USU0yw.js → _tabs-Osf37WI9.js} +1 -1
- package/dist/assets/_variant-DGrwitKk.js +30 -0
- package/dist/assets/{_variants-Bjp8ZEvO.js → _variants-C7fc4T8_.js} +1 -1
- package/dist/assets/{area.css-CSjofvHM.js → area.css-ByjMFuMe.js} +1 -1
- package/dist/assets/auth-BkNQi67-.css +1 -0
- package/dist/assets/auth.css-CbKu-iME.js +1 -0
- package/dist/assets/button-J5fxAIyE.js +1 -0
- package/dist/assets/check-BdOT-uCr.js +1 -0
- package/dist/assets/{chevron-right-fMWRsRLZ.js → chevron-right-CcvZen9O.js} +1 -1
- package/dist/assets/combobox-BKEpKROu.js +1 -0
- package/dist/assets/configs-BEKTOPIS.js +1 -0
- package/dist/assets/{copy-DADLeZ69.js → copy-Btrg1ewH.js} +1 -1
- package/dist/assets/{costs-Fh0OPnEw.js → costs-C0sD1amq.js} +1 -1
- package/dist/assets/environments-CZ6PX9PA.js +1 -0
- package/dist/assets/index-C1Qc7Z7W.js +27 -0
- package/dist/assets/index-C8Gwa2Ui.js +1 -0
- package/dist/assets/{index-DeuSY0Yv.js → index-CAScpK2G.js} +1 -1
- package/dist/assets/{index-DW-cTzEh.js → index-CPQ3xdGh.js} +1 -1
- package/dist/assets/index-CPokRl9v.js +1 -0
- package/dist/assets/index-CQALuvff.js +1 -0
- package/dist/assets/{index-BFe2NM3q.css → index-CgbnU9Zg.css} +1 -1
- package/dist/assets/{index-Cns5MLjo.js → index-ChLdrp-m.js} +1 -1
- package/dist/assets/{index.esm-oCSEvUVx.js → index.esm-BVbruXk6.js} +1 -1
- package/dist/assets/info-box.css-BzqwxgQm.js +1 -0
- package/dist/assets/logo-D4ybjOzp.css +1 -0
- package/dist/assets/logo.css-BHDDnlVa.js +1 -0
- package/dist/assets/new-config-state-B8sMe-TC.css +1 -0
- package/dist/assets/new-config-state.css-DccH1TI0.js +1 -0
- package/dist/assets/{observability.css-wgjHtY3p.js → observability.css-D5kKsJ4z.js} +1 -1
- package/dist/assets/{overview-D1QIYPBL.js → overview-Czui5UTZ.js} +5 -5
- package/dist/assets/plus-DqiZvCBU.js +1 -0
- package/dist/assets/popover-BndR7yWD.js +1 -0
- package/dist/assets/requests-DrSJLtrE.js +1 -0
- package/dist/assets/{route-Df57lqxl.js → route-22shZRiS.js} +1 -1
- package/dist/assets/route-7Tn2yELm.js +1 -0
- package/dist/assets/{route-CjAw8hSU.js → route-CqIm0KnA.js} +1 -1
- package/dist/assets/{route-timDYxX2.js → route-D_QnUz7-.js} +1 -1
- package/dist/assets/{route-DmWZbVk6.js → route-DwYQMwtZ.js} +1 -1
- package/dist/assets/secrets-DnWQ2F0V.js +1 -0
- package/dist/assets/settings-c6c9IYPa.js +1 -0
- package/dist/assets/settings-sisslKb5.js +1 -0
- package/dist/assets/setup-G_oS-RU-.js +1 -0
- package/dist/assets/signin-B-qadLup.js +1 -0
- package/dist/assets/table-jMzD3FNy.js +1 -0
- package/dist/assets/{tabs.css-CG5ugi0p.js → tabs.css-CkcP1Ksc.js} +1 -1
- package/dist/assets/targeting-CaE84Lx8.js +1 -0
- package/dist/assets/tooltip-BiUUXiGj.js +1 -0
- package/dist/assets/{update-or-create-name-B-M46wHl.js → update-or-create-name-DGt2MGEI.js} +1 -1
- package/dist/assets/useAnalytics-CHDelHQa.js +1 -0
- package/dist/assets/useConfigList-Bx9xKceA.js +1 -0
- package/dist/assets/{useConfigVariants-CLc_hPw1.js → useConfigVariants-CB0S5gfJ.js} +1 -1
- package/dist/assets/useEnvironments-DILRhv_b.js +1 -0
- package/dist/assets/{useMutation-D4JglXWk.js → useMutation-CNzYa4ST.js} +1 -1
- package/dist/assets/usePopupAutoResize-CaO9EPHk.js +1 -0
- package/dist/assets/{useSetTargeting-bk0Ixhqq.js → useSetTargeting-DY3jI95T.js} +1 -1
- package/dist/assets/useTargetingRules-D10mXxut.js +1 -0
- package/dist/assets/useValueChanged-8LsiEynk.js +1 -0
- package/dist/assets/{user-profile-BB3dPOc5.js → user-profile-8xq1f7_D.js} +1 -1
- package/dist/assets/variants-rQQlpgeF.js +1 -0
- package/dist/assets/variants.css-Dzb38Nu1.js +1 -0
- package/dist/assets/{workspace-general-DYXfOF9H.js → workspace-general-dH65Sm8D.js} +1 -1
- package/dist/index.cjs +136 -59
- package/dist/index.d.cts +8 -5
- package/dist/index.d.mts +8 -5
- package/dist/index.mjs +138 -61
- package/package.json +4 -3
- package/dist/assets/Form-Bh6BPtQ_.js +0 -1
- package/dist/assets/InternalBackdrop-Za9lpJi7.js +0 -12
- package/dist/assets/_environment-COxSWJ9w.js +0 -1
- package/dist/assets/_observability-C8wSXZk2.js +0 -1
- package/dist/assets/_settings-DOmj1R7I.js +0 -1
- package/dist/assets/_variant-DxME2BL0.js +0 -30
- package/dist/assets/button-CMZqhyXB.js +0 -1
- package/dist/assets/check-D9E8RKB4.js +0 -1
- package/dist/assets/chevron-down-BJFxhYkh.js +0 -1
- package/dist/assets/combobox-iSbUYz0A.js +0 -1
- package/dist/assets/configs-BflhBVlY.js +0 -1
- package/dist/assets/environments-ChldQPyq.js +0 -1
- package/dist/assets/getDisabledMountTransitionStyles-TZFYxPIU.js +0 -1
- package/dist/assets/index-BDsrc1Q7.js +0 -1
- package/dist/assets/index-BWU02PnY.js +0 -1
- package/dist/assets/index-DYoud8po.js +0 -1
- package/dist/assets/index-FrTQ7TcS.js +0 -16
- package/dist/assets/info-box.css-DuVI9M9-.js +0 -1
- package/dist/assets/llmops-B3IIte87.css +0 -1
- package/dist/assets/llmops-CdOQq40D.js +0 -1
- package/dist/assets/plus-JQ0TORpd.js +0 -1
- package/dist/assets/popover-DXj4s-ni.js +0 -1
- package/dist/assets/popupStateMapping-DolkyTT3.js +0 -1
- package/dist/assets/requests-CzvYwfwV.js +0 -1
- package/dist/assets/reselect-DVmmTZGf.js +0 -1
- package/dist/assets/secrets-BxFGEuKj.js +0 -1
- package/dist/assets/settings-DpSRw7LL.js +0 -1
- package/dist/assets/settings-pgWZnVf6.js +0 -1
- package/dist/assets/table-DggTSlPh.js +0 -1
- package/dist/assets/targeting-CkqRTjnZ.js +0 -1
- package/dist/assets/tooltip-BuSsMQ8P.js +0 -1
- package/dist/assets/useAnalytics-DTf81POS.js +0 -1
- package/dist/assets/useButton-CsZ8hBM8.js +0 -1
- package/dist/assets/useConfigList-CAf01_dV.js +0 -1
- package/dist/assets/useEnvironments-Bu_0SIUj.js +0 -1
- package/dist/assets/useFocus-9TCY0h5x.js +0 -1
- package/dist/assets/usePopupAutoResize-D6RSlB-m.js +0 -1
- package/dist/assets/useRole-CiSaVva3.js +0 -1
- package/dist/assets/useSyncedFloatingRootContext-BKbVh8Gq.js +0 -1
- package/dist/assets/useTargetingRules-BrgaEdxR.js +0 -1
- package/dist/assets/useValueChanged-CTjBqaGs.js +0 -1
- package/dist/assets/variants-BH682hHM.js +0 -1
- package/dist/assets/variants.css-rCWHZycz.js +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import { SupportedProviders, createDataLayer, generateId, logger, validateLLMOpsConfig, variantJsonDataSchema } from "@llmops/core";
|
|
2
|
+
import { SupportedProviders, createDataLayer, generateId, getAuthClientOptions, logger, validateLLMOpsConfig, variantJsonDataSchema } from "@llmops/core";
|
|
3
3
|
import reactServer from "react-dom/server";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -9,15 +9,15 @@ import { serveStatic } from "hono/serve-static";
|
|
|
9
9
|
import { fileURLToPath as fileURLToPath$1 } from "url";
|
|
10
10
|
import { dirname as dirname$1, join as join$1 } from "path";
|
|
11
11
|
import { readFile } from "fs/promises";
|
|
12
|
-
import {
|
|
12
|
+
import { HTTPException } from "hono/http-exception";
|
|
13
13
|
import { zValidator } from "@hono/zod-validator";
|
|
14
14
|
import { prettyJSON } from "hono/pretty-json";
|
|
15
|
-
import { HTTPException } from "hono/http-exception";
|
|
16
15
|
import { cors } from "hono/cors";
|
|
17
16
|
import { randomUUID } from "node:crypto";
|
|
18
17
|
import gateway from "@llmops/gateway";
|
|
19
18
|
import { env } from "node:process";
|
|
20
|
-
import { createDatabaseFromConnection } from "@llmops/core/db";
|
|
19
|
+
import { createDatabaseFromConnection, detectDatabaseType } from "@llmops/core/db";
|
|
20
|
+
import { betterAuth } from "better-auth";
|
|
21
21
|
|
|
22
22
|
//#region rolldown:runtime
|
|
23
23
|
var __defProp = Object.defineProperty;
|
|
@@ -37,7 +37,7 @@ var __export = (all, symbols) => {
|
|
|
37
37
|
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/client/index.tsx?url
|
|
40
|
-
var client_default = "/assets/index-
|
|
40
|
+
var client_default = "/assets/index-C1Qc7Z7W.js";
|
|
41
41
|
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/client/styles/styles.css?url
|
|
@@ -68,7 +68,7 @@ const ReactRefresh = () => {
|
|
|
68
68
|
const { renderToString } = reactServer;
|
|
69
69
|
const manifestPath = join(dirname(fileURLToPath(import.meta.url)), "./.vite/manifest.json");
|
|
70
70
|
const manifest = existsSync(manifestPath) ? JSON.parse(readFileSync(manifestPath, "utf-8")) : {};
|
|
71
|
-
const renderer = ({ basePath = "", dev = false, llmProviders, authType }) => {
|
|
71
|
+
const renderer = ({ basePath = "", dev = false, llmProviders, authType, setupComplete = false }) => {
|
|
72
72
|
const stylesPath = basePath === "/" ? styles_default : basePath + styles_default;
|
|
73
73
|
const clientPath = basePath === "/" ? client_default : basePath + client_default;
|
|
74
74
|
const faviconPath = basePath === "/" ? "/favicon.ico" : basePath + "/assets/favicon.ico";
|
|
@@ -77,7 +77,7 @@ const renderer = ({ basePath = "", dev = false, llmProviders, authType }) => {
|
|
|
77
77
|
});
|
|
78
78
|
return renderToString(/* @__PURE__ */ jsxs("html", {
|
|
79
79
|
lang: "en",
|
|
80
|
-
className: "
|
|
80
|
+
className: "",
|
|
81
81
|
children: [/* @__PURE__ */ jsxs("head", { children: [
|
|
82
82
|
/* @__PURE__ */ jsx("meta", {
|
|
83
83
|
name: "viewport",
|
|
@@ -332,7 +332,8 @@ const renderer = ({ basePath = "", dev = false, llmProviders, authType }) => {
|
|
|
332
332
|
window.bootstrapData = {
|
|
333
333
|
basePath: "${basePath}",
|
|
334
334
|
llmProviders: ${JSON.stringify(llmProviders || [])},
|
|
335
|
-
authType: "${authType || "basic"}"
|
|
335
|
+
authType: "${authType || "basic"}",
|
|
336
|
+
setupComplete: ${setupComplete}
|
|
336
337
|
};
|
|
337
338
|
` }),
|
|
338
339
|
dev && /* @__PURE__ */ jsx(ReactRefresh, {})
|
|
@@ -12789,7 +12790,7 @@ function parseTags(tagsJson) {
|
|
|
12789
12790
|
/**
|
|
12790
12791
|
* Analytics API routes for cost and usage tracking
|
|
12791
12792
|
*/
|
|
12792
|
-
const app$
|
|
12793
|
+
const app$11 = new Hono().get("/requests", zv("query", zod_default.object({
|
|
12793
12794
|
limit: zod_default.string().transform(Number).optional(),
|
|
12794
12795
|
offset: zod_default.string().transform(Number).optional(),
|
|
12795
12796
|
configId: zod_default.string().uuid().optional(),
|
|
@@ -12984,11 +12985,11 @@ const app$10 = new Hono().get("/requests", zv("query", zod_default.object({
|
|
|
12984
12985
|
return c.json(internalServerError("Failed to fetch tags", 500), 500);
|
|
12985
12986
|
}
|
|
12986
12987
|
});
|
|
12987
|
-
var analytics_default = app$
|
|
12988
|
+
var analytics_default = app$11;
|
|
12988
12989
|
|
|
12989
12990
|
//#endregion
|
|
12990
12991
|
//#region src/server/handlers/configs/index.ts
|
|
12991
|
-
const app$
|
|
12992
|
+
const app$10 = new Hono().post("/", zv("json", zod_default.object({ name: zod_default.string().min(1) })), async (c) => {
|
|
12992
12993
|
const db = c.get("db");
|
|
12993
12994
|
try {
|
|
12994
12995
|
const value = await db.createNewConfig({ name: c.req.valid("json").name });
|
|
@@ -13092,7 +13093,7 @@ const app$9 = new Hono().post("/", zv("json", zod_default.object({ name: zod_def
|
|
|
13092
13093
|
return c.json(internalServerError("Failed to delete config", 500), 500);
|
|
13093
13094
|
}
|
|
13094
13095
|
});
|
|
13095
|
-
var configs_default = app$
|
|
13096
|
+
var configs_default = app$10;
|
|
13096
13097
|
|
|
13097
13098
|
//#endregion
|
|
13098
13099
|
//#region src/server/handlers/environments/index.ts
|
|
@@ -13103,7 +13104,7 @@ var configs_default = app$9;
|
|
|
13103
13104
|
const generateSecretKey$1 = (slug) => {
|
|
13104
13105
|
return `sec_${slug.slice(0, 4).toLowerCase()}_${generateId(24)}`;
|
|
13105
13106
|
};
|
|
13106
|
-
const app$
|
|
13107
|
+
const app$9 = new Hono().post("/", zv("json", zod_default.object({
|
|
13107
13108
|
name: zod_default.string().min(1),
|
|
13108
13109
|
slug: zod_default.string().min(1),
|
|
13109
13110
|
isProd: zod_default.boolean().optional()
|
|
@@ -13188,7 +13189,7 @@ const app$8 = new Hono().post("/", zv("json", zod_default.object({
|
|
|
13188
13189
|
return c.json(internalServerError("Failed to fetch environment secrets", 500), 500);
|
|
13189
13190
|
}
|
|
13190
13191
|
});
|
|
13191
|
-
var environments_default = app$
|
|
13192
|
+
var environments_default = app$9;
|
|
13192
13193
|
|
|
13193
13194
|
//#endregion
|
|
13194
13195
|
//#region src/server/handlers/providers/index.ts
|
|
@@ -13208,7 +13209,7 @@ async function fetchModelsDevData() {
|
|
|
13208
13209
|
cacheTimestamp = now;
|
|
13209
13210
|
return modelsCache;
|
|
13210
13211
|
}
|
|
13211
|
-
const app$
|
|
13212
|
+
const app$8 = new Hono().get("/", async (c) => {
|
|
13212
13213
|
try {
|
|
13213
13214
|
const data = await fetchModelsDevData();
|
|
13214
13215
|
const providers = Object.values(data).map((provider) => ({
|
|
@@ -13316,11 +13317,11 @@ const app$7 = new Hono().get("/", async (c) => {
|
|
|
13316
13317
|
return c.json(internalServerError("Failed to fetch models", 500), 500);
|
|
13317
13318
|
}
|
|
13318
13319
|
});
|
|
13319
|
-
var providers_default = app$
|
|
13320
|
+
var providers_default = app$8;
|
|
13320
13321
|
|
|
13321
13322
|
//#endregion
|
|
13322
13323
|
//#region src/server/handlers/targeting/index.ts
|
|
13323
|
-
const app$
|
|
13324
|
+
const app$7 = new Hono().post("/", zv("json", zod_default.object({
|
|
13324
13325
|
environmentId: zod_default.string().uuid(),
|
|
13325
13326
|
configId: zod_default.string().uuid(),
|
|
13326
13327
|
configVariantId: zod_default.string().uuid(),
|
|
@@ -13447,11 +13448,11 @@ const app$6 = new Hono().post("/", zv("json", zod_default.object({
|
|
|
13447
13448
|
return c.json(internalServerError("Failed to set targeting for environment", 500), 500);
|
|
13448
13449
|
}
|
|
13449
13450
|
});
|
|
13450
|
-
var targeting_default = app$
|
|
13451
|
+
var targeting_default = app$7;
|
|
13451
13452
|
|
|
13452
13453
|
//#endregion
|
|
13453
13454
|
//#region src/server/handlers/variants.ts
|
|
13454
|
-
const app$
|
|
13455
|
+
const app$6 = new Hono().get("/:id", zv("param", zod_default.object({ id: zod_default.string().uuid() })), async (c) => {
|
|
13455
13456
|
const db = c.get("db");
|
|
13456
13457
|
const { id } = c.req.valid("param");
|
|
13457
13458
|
const versionParam = c.req.query("version");
|
|
@@ -13598,11 +13599,43 @@ const app$5 = new Hono().get("/:id", zv("param", zod_default.object({ id: zod_de
|
|
|
13598
13599
|
return c.json(internalServerError("Failed to fetch variant version", 500), 500);
|
|
13599
13600
|
}
|
|
13600
13601
|
});
|
|
13601
|
-
var variants_default = app$
|
|
13602
|
+
var variants_default = app$6;
|
|
13603
|
+
|
|
13604
|
+
//#endregion
|
|
13605
|
+
//#region src/server/middlewares/verifySession.ts
|
|
13606
|
+
let cachedSuperAdminId = void 0;
|
|
13607
|
+
/**
|
|
13608
|
+
* Middleware that verifies the user is the super admin.
|
|
13609
|
+
* Must be used after the auth client middleware has set user/session in context.
|
|
13610
|
+
*
|
|
13611
|
+
* SuperAdminId is cached in memory since it's set once during setup and never changes.
|
|
13612
|
+
*
|
|
13613
|
+
* @throws HTTPException 401 if no valid session exists
|
|
13614
|
+
* @throws HTTPException 403 if user is not the super admin
|
|
13615
|
+
*/
|
|
13616
|
+
const verifySuperAdmin = async (c, next) => {
|
|
13617
|
+
const user = c.get("user");
|
|
13618
|
+
const session = c.get("session");
|
|
13619
|
+
if (!user || !session) throw new HTTPException(401, { message: "Unauthorized - valid session required" });
|
|
13620
|
+
if (cachedSuperAdminId === void 0) cachedSuperAdminId = await c.get("db").getSuperAdminId();
|
|
13621
|
+
if (!cachedSuperAdminId) {
|
|
13622
|
+
await next();
|
|
13623
|
+
return;
|
|
13624
|
+
}
|
|
13625
|
+
if (user.id !== cachedSuperAdminId) throw new HTTPException(403, { message: "Forbidden - only the super admin can access this resource" });
|
|
13626
|
+
await next();
|
|
13627
|
+
};
|
|
13628
|
+
/**
|
|
13629
|
+
* Clear the cached superAdminId.
|
|
13630
|
+
* Call this after setting the superAdminId during setup.
|
|
13631
|
+
*/
|
|
13632
|
+
const clearSuperAdminCache = () => {
|
|
13633
|
+
cachedSuperAdminId = void 0;
|
|
13634
|
+
};
|
|
13602
13635
|
|
|
13603
13636
|
//#endregion
|
|
13604
13637
|
//#region src/server/handlers/workspace-settings/index.ts
|
|
13605
|
-
const app$
|
|
13638
|
+
const app$5 = new Hono().get("/", async (c) => {
|
|
13606
13639
|
const db = c.get("db");
|
|
13607
13640
|
try {
|
|
13608
13641
|
const settings = await db.getWorkspaceSettings();
|
|
@@ -13611,40 +13644,28 @@ const app$4 = new Hono().get("/", async (c) => {
|
|
|
13611
13644
|
console.error("Error fetching workspace settings:", error$45);
|
|
13612
13645
|
return c.json(internalServerError("Failed to fetch workspace settings", 500), 500);
|
|
13613
13646
|
}
|
|
13614
|
-
}).patch("/", zv("json", zod_default.object({
|
|
13647
|
+
}).patch("/", zv("json", zod_default.object({
|
|
13648
|
+
name: zod_default.string().nullable().optional(),
|
|
13649
|
+
setupComplete: zod_default.boolean().optional(),
|
|
13650
|
+
superAdminId: zod_default.string().nullable().optional()
|
|
13651
|
+
})), async (c) => {
|
|
13615
13652
|
const db = c.get("db");
|
|
13616
13653
|
const body = c.req.valid("json");
|
|
13617
13654
|
try {
|
|
13618
13655
|
const settings = await db.updateWorkspaceSettings(body);
|
|
13656
|
+
if (body.superAdminId !== void 0) clearSuperAdminCache();
|
|
13619
13657
|
return c.json(successResponse(settings, 200));
|
|
13620
13658
|
} catch (error$45) {
|
|
13621
13659
|
console.error("Error updating workspace settings:", error$45);
|
|
13622
13660
|
return c.json(internalServerError("Failed to update workspace settings", 500), 500);
|
|
13623
13661
|
}
|
|
13624
13662
|
});
|
|
13625
|
-
var workspace_settings_default = app$
|
|
13663
|
+
var workspace_settings_default = app$5;
|
|
13626
13664
|
|
|
13627
13665
|
//#endregion
|
|
13628
13666
|
//#region src/server/handlers/v1.ts
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
*/
|
|
13632
|
-
function isBasicAuth(auth) {
|
|
13633
|
-
return auth.type === "basic";
|
|
13634
|
-
}
|
|
13635
|
-
const app$3 = new Hono().use("*", async (c, next) => {
|
|
13636
|
-
if (c.get("authHandled")) return next();
|
|
13637
|
-
const config$1 = c.get("llmopsConfig");
|
|
13638
|
-
if (isBasicAuth(config$1.auth)) return basicAuth({
|
|
13639
|
-
username: config$1.auth.defaultUser,
|
|
13640
|
-
password: config$1.auth.defaultPassword
|
|
13641
|
-
})(c, next);
|
|
13642
|
-
return c.json({
|
|
13643
|
-
error: "Auth middleware not configured",
|
|
13644
|
-
message: `Auth type "${config$1.auth.type}" requires @llmops/enterprise middleware. Either use basicAuth() from @llmops/sdk or install @llmops/enterprise and add the auth middleware.`
|
|
13645
|
-
}, 501);
|
|
13646
|
-
}).route("/analytics", analytics_default).route("/configs", configs_default).route("/environments", environments_default).route("/providers", providers_default).route("/targeting", targeting_default).route("/variants", variants_default).route("/workspace-settings", workspace_settings_default);
|
|
13647
|
-
var v1_default = app$3;
|
|
13667
|
+
const app$4 = new Hono().use("*", verifySuperAdmin).route("/analytics", analytics_default).route("/configs", configs_default).route("/environments", environments_default).route("/providers", providers_default).route("/targeting", targeting_default).route("/variants", variants_default).route("/workspace-settings", workspace_settings_default);
|
|
13668
|
+
var v1_default = app$4;
|
|
13648
13669
|
|
|
13649
13670
|
//#endregion
|
|
13650
13671
|
//#region src/server/handlers/genai/requestValidator.ts
|
|
@@ -14343,8 +14364,8 @@ async function processUsageAndLog(params) {
|
|
|
14343
14364
|
|
|
14344
14365
|
//#endregion
|
|
14345
14366
|
//#region src/server/handlers/genai/index.ts
|
|
14346
|
-
const app$
|
|
14347
|
-
app$
|
|
14367
|
+
const app$3 = new Hono();
|
|
14368
|
+
app$3.use("*", prettyJSON()).get("/health", async (c) => {
|
|
14348
14369
|
return c.json({ status: "healthy" });
|
|
14349
14370
|
}).use("*", requestValidator).use("*", createRequestGuardMiddleware()).use("*", createCostTrackingMiddleware()).use("*", createGatewayAdapterMiddleware()).route("/", gateway).notFound((c) => c.json({ error: {
|
|
14350
14371
|
message: "Not Found",
|
|
@@ -14356,12 +14377,42 @@ app$2.use("*", prettyJSON()).get("/health", async (c) => {
|
|
|
14356
14377
|
type: "api_error"
|
|
14357
14378
|
} }, 500);
|
|
14358
14379
|
});
|
|
14359
|
-
var genai_default = app$
|
|
14380
|
+
var genai_default = app$3;
|
|
14381
|
+
|
|
14382
|
+
//#endregion
|
|
14383
|
+
//#region src/server/handlers/auth/index.ts
|
|
14384
|
+
const app$2 = new Hono().post("/complete-setup", async (c) => {
|
|
14385
|
+
const db = c.get("db");
|
|
14386
|
+
try {
|
|
14387
|
+
const settings = await db.markSetupComplete();
|
|
14388
|
+
return c.json(successResponse(settings, 200));
|
|
14389
|
+
} catch (error$45) {
|
|
14390
|
+
console.error("Error completing setup:", error$45);
|
|
14391
|
+
return c.json(internalServerError("Failed to complete setup", 500), 500);
|
|
14392
|
+
}
|
|
14393
|
+
});
|
|
14394
|
+
var auth_default = app$2;
|
|
14360
14395
|
|
|
14361
14396
|
//#endregion
|
|
14362
14397
|
//#region src/server/handlers/api.ts
|
|
14363
14398
|
const app$1 = new Hono();
|
|
14364
|
-
const routes = app$1.
|
|
14399
|
+
const routes = app$1.post("/auth/sign-up/*", async (c, next) => {
|
|
14400
|
+
if (c.get("setupComplete")) throw new HTTPException(403, { message: "Registration is disabled. Only one user is allowed." });
|
|
14401
|
+
await next();
|
|
14402
|
+
}).on(["POST", "GET"], "/auth/*", (c) => {
|
|
14403
|
+
return c.get("authClient").handler(c.req.raw);
|
|
14404
|
+
}).route("/auth", auth_default).use("*", async (c, next) => {
|
|
14405
|
+
const session = await c.get("authClient").api.getSession({ headers: c.req.raw.headers });
|
|
14406
|
+
if (!session) {
|
|
14407
|
+
c.set("user", null);
|
|
14408
|
+
c.set("session", null);
|
|
14409
|
+
await next();
|
|
14410
|
+
return;
|
|
14411
|
+
}
|
|
14412
|
+
c.set("user", session.user);
|
|
14413
|
+
c.set("session", session.session);
|
|
14414
|
+
await next();
|
|
14415
|
+
}).route("/genai", genai_default).route("/v1", v1_default);
|
|
14365
14416
|
var api_default = app$1;
|
|
14366
14417
|
|
|
14367
14418
|
//#endregion
|
|
@@ -14378,11 +14429,13 @@ app.use("/assets/*", serveStatic({
|
|
|
14378
14429
|
const basePath = c.var.llmopsConfig?.basePath || "";
|
|
14379
14430
|
const llmProviders = c.var.llmProviders || [];
|
|
14380
14431
|
const authType = c.var.llmopsConfig?.auth?.type || "basic";
|
|
14432
|
+
const setupComplete = c.var.setupComplete ?? false;
|
|
14381
14433
|
return c.html(renderer({
|
|
14382
14434
|
basePath,
|
|
14383
14435
|
dev: env.LLMOPS_DEV === "true",
|
|
14384
14436
|
llmProviders,
|
|
14385
|
-
authType
|
|
14437
|
+
authType,
|
|
14438
|
+
setupComplete
|
|
14386
14439
|
}));
|
|
14387
14440
|
}
|
|
14388
14441
|
await next();
|
|
@@ -14455,12 +14508,10 @@ const createSeedMiddleware = () => {
|
|
|
14455
14508
|
//#endregion
|
|
14456
14509
|
//#region src/server/middlewares/migration.ts
|
|
14457
14510
|
/**
|
|
14458
|
-
* Creates a middleware that handles auto-migration
|
|
14511
|
+
* Creates a middleware that handles auto-migration on startup
|
|
14459
14512
|
*
|
|
14460
|
-
* This middleware runs once on application startup and
|
|
14461
|
-
*
|
|
14462
|
-
* - autoMigrate: false - Never run migrations (default)
|
|
14463
|
-
* - autoMigrate: 'development' - Only run when NODE_ENV is 'development'
|
|
14513
|
+
* This middleware runs once on application startup and automatically
|
|
14514
|
+
* runs database migrations if needed.
|
|
14464
14515
|
*
|
|
14465
14516
|
* IMPORTANT: This middleware should run BEFORE the seed middleware
|
|
14466
14517
|
* but AFTER the database middleware creates the connection.
|
|
@@ -14469,16 +14520,15 @@ const createMigrationMiddleware = (config$1) => {
|
|
|
14469
14520
|
let migrationComplete = false;
|
|
14470
14521
|
let migrationPromise = null;
|
|
14471
14522
|
return async (c, next) => {
|
|
14472
|
-
|
|
14473
|
-
if (migrationComplete || autoMigrate === false) {
|
|
14523
|
+
if (migrationComplete) {
|
|
14474
14524
|
await next();
|
|
14475
14525
|
return;
|
|
14476
14526
|
}
|
|
14477
14527
|
if (!migrationPromise) migrationPromise = (async () => {
|
|
14478
14528
|
try {
|
|
14479
|
-
const { detectDatabaseType, runAutoMigrations, createDatabaseFromConnection: createDatabaseFromConnection$1 } = await import("@llmops/core/db");
|
|
14529
|
+
const { detectDatabaseType: detectDatabaseType$1, runAutoMigrations, createDatabaseFromConnection: createDatabaseFromConnection$1 } = await import("@llmops/core/db");
|
|
14480
14530
|
const rawConnection = config$1.database;
|
|
14481
|
-
const dbType = detectDatabaseType(rawConnection);
|
|
14531
|
+
const dbType = detectDatabaseType$1(rawConnection);
|
|
14482
14532
|
if (!dbType) {
|
|
14483
14533
|
console.warn("[Migration] Could not detect database type, skipping auto-migration");
|
|
14484
14534
|
return;
|
|
@@ -14489,7 +14539,10 @@ const createMigrationMiddleware = (config$1) => {
|
|
|
14489
14539
|
console.warn("[Migration] Could not create database connection, skipping auto-migration");
|
|
14490
14540
|
return;
|
|
14491
14541
|
}
|
|
14492
|
-
const result = await runAutoMigrations(db, dbType,
|
|
14542
|
+
const result = await runAutoMigrations(db, dbType, {
|
|
14543
|
+
rawConnection,
|
|
14544
|
+
schema
|
|
14545
|
+
});
|
|
14493
14546
|
if (result.ran) console.log(`[Migration] Auto-migration completed: ${result.tables.length} table(s) created, ${result.fields.length} field(s) added`);
|
|
14494
14547
|
} catch (error$45) {
|
|
14495
14548
|
console.error("[Migration] Auto-migration failed:", error$45);
|
|
@@ -14502,6 +14555,24 @@ const createMigrationMiddleware = (config$1) => {
|
|
|
14502
14555
|
};
|
|
14503
14556
|
};
|
|
14504
14557
|
|
|
14558
|
+
//#endregion
|
|
14559
|
+
//#region src/server/middlewares/auth.ts
|
|
14560
|
+
/**
|
|
14561
|
+
* Creates auth client middleware that uses the pre-configured Kysely instance
|
|
14562
|
+
* from context. This ensures Better Auth uses the same database connection
|
|
14563
|
+
* with the correct schema (search_path) configuration.
|
|
14564
|
+
*/
|
|
14565
|
+
const createAuthClientMiddleware = () => {
|
|
14566
|
+
return async (c, next) => {
|
|
14567
|
+
const authClient = betterAuth(getAuthClientOptions({
|
|
14568
|
+
db: c.get("kyselyDb"),
|
|
14569
|
+
type: c.get("dbType")
|
|
14570
|
+
}));
|
|
14571
|
+
c.set("authClient", authClient);
|
|
14572
|
+
await next();
|
|
14573
|
+
};
|
|
14574
|
+
};
|
|
14575
|
+
|
|
14505
14576
|
//#endregion
|
|
14506
14577
|
//#region src/index.ts
|
|
14507
14578
|
const MODELS_DEV_LOGOS = "https://models.dev/logos";
|
|
@@ -14520,10 +14591,16 @@ const setConfigMiddleware = (config$1) => {
|
|
|
14520
14591
|
};
|
|
14521
14592
|
const createDatabaseMiddleware = (validatedConfig) => {
|
|
14522
14593
|
return async (c, next) => {
|
|
14523
|
-
const
|
|
14524
|
-
if (!
|
|
14525
|
-
const
|
|
14594
|
+
const kyselyDb = await createDatabaseFromConnection(validatedConfig.database, { schema: validatedConfig.schema });
|
|
14595
|
+
if (!kyselyDb) throw new Error("Failed to create database connection");
|
|
14596
|
+
const dbType = detectDatabaseType(validatedConfig.database);
|
|
14597
|
+
if (!dbType) throw new Error("Failed to detect database type");
|
|
14598
|
+
const dataLayer = await createDataLayer(kyselyDb);
|
|
14526
14599
|
c.set("db", dataLayer);
|
|
14600
|
+
c.set("kyselyDb", kyselyDb);
|
|
14601
|
+
c.set("dbType", dbType);
|
|
14602
|
+
const setupComplete = await dataLayer.isSetupComplete();
|
|
14603
|
+
c.set("setupComplete", setupComplete);
|
|
14527
14604
|
await next();
|
|
14528
14605
|
};
|
|
14529
14606
|
};
|
|
@@ -14545,7 +14622,7 @@ const createLLMProvidersMiddleware = (config$1) => {
|
|
|
14545
14622
|
};
|
|
14546
14623
|
const createApp = (config$1) => {
|
|
14547
14624
|
const validatedConfig = validateLLMOpsConfig(config$1);
|
|
14548
|
-
return { app: new Hono().use("*", createEnvValidatorMiddleware()).use("*", setConfigMiddleware(validatedConfig)).use("*", createMigrationMiddleware(validatedConfig)).use("*", createDatabaseMiddleware(validatedConfig)).use("*", createSeedMiddleware()).use("*", createLLMProvidersMiddleware(validatedConfig)).route("/", server_default).basePath(validatedConfig.basePath) };
|
|
14625
|
+
return { app: new Hono().use("*", createEnvValidatorMiddleware()).use("*", setConfigMiddleware(validatedConfig)).use("*", createMigrationMiddleware(validatedConfig)).use("*", createDatabaseMiddleware(validatedConfig)).use("*", createSeedMiddleware()).use("*", createLLMProvidersMiddleware(validatedConfig)).use("*", createAuthClientMiddleware()).route("/", server_default).basePath(validatedConfig.basePath) };
|
|
14549
14626
|
};
|
|
14550
14627
|
var src_default = server_default;
|
|
14551
14628
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmops/app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9-beta.1",
|
|
4
4
|
"description": "LLMOps application with server and client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@vanilla-extract/recipes": "^0.5.7",
|
|
55
55
|
"@vanilla-extract/sprinkles": "^1.6.5",
|
|
56
56
|
"@vanilla-extract/vite-plugin": "^5.1.3",
|
|
57
|
+
"better-auth": "^1.4.10",
|
|
57
58
|
"clsx": "^2.1.1",
|
|
58
59
|
"date-fns": "^4.1.0",
|
|
59
60
|
"hono": "^4.10.7",
|
|
@@ -65,8 +66,8 @@
|
|
|
65
66
|
"react-aria-components": "^1.13.0",
|
|
66
67
|
"react-hook-form": "^7.68.0",
|
|
67
68
|
"recharts": "^3.6.0",
|
|
68
|
-
"@llmops/core": "^0.1.
|
|
69
|
-
"@llmops/gateway": "^0.1.
|
|
69
|
+
"@llmops/core": "^0.1.9-beta.1",
|
|
70
|
+
"@llmops/gateway": "^0.1.9-beta.1"
|
|
70
71
|
},
|
|
71
72
|
"peerDependencies": {
|
|
72
73
|
"react": "^19.2.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,j as k}from"./index-FrTQ7TcS.js";import{a as B,f as V,b as H,c as M,d as A,E as U}from"./useButton-CsZ8hBM8.js";import{u as J,a as $,F as q,I as z,i as Q,b as X}from"./InternalBackdrop-Za9lpJi7.js";import{c as K,m as Z,k as ee,l as W,g as te,a as ne,R as oe,P as se,d as O,r as _,v as G,w as re,o as j,C as F,s as ae,F as ie,x as le,p as ue,y as ce,n as de}from"./popupStateMapping-DolkyTT3.js";import{a as pe,b as fe,u as ge,p as me,c as Ce,d as Se}from"./useSyncedFloatingRootContext-BKbVh8Gq.js";import{u as Re,C as he}from"./useRole-CiSaVva3.js";import{u as xe,F as Ee}from"./useValueChanged-CTjBqaGs.js";function ve(t){const{store:e,parentContext:o,actionsRef:C}=t,l=e.useState("open"),r=e.useState("disablePointerDismissal"),u=e.useState("modal"),i=e.useState("popupElement"),{openMethod:n,triggerProps:g,reset:p}=J(l);pe(e);const{forceUnmount:f}=fe(l,e,()=>{p()}),a=B(E=>{const b=K(E);return b.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},b}),S=s.useCallback(()=>{e.setOpen(!1,a(Z))},[e,a]);s.useImperativeHandle(C,()=>({unmount:f,close:S}),[f,S]);const d=ge({popupStore:e,onOpenChange:e.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[R,v]=s.useState(0),h=R===0,y=Re(d),c=ee(d,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(E){if("button"in E&&E.button!==0||"touches"in E&&E.touches.length!==1)return!1;const b=te(E);if(h&&!r){const w=b;return u&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===w||e.context.backdropRef.current===w||ne(w,i)&&!w?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:h});$(l&&u===!0,i);const{getReferenceProps:m,getFloatingProps:I,getTriggerProps:x}=W([y,c]);e.useContextCallback("onNestedDialogOpen",E=>{v(E+1)}),e.useContextCallback("onNestedDialogClose",()=>{v(0)}),s.useEffect(()=>(o?.onNestedDialogOpen&&l&&o.onNestedDialogOpen(R),o?.onNestedDialogClose&&!l&&o.onNestedDialogClose(),()=>{o?.onNestedDialogClose&&l&&o.onNestedDialogClose()}),[l,o,R]);const D=s.useMemo(()=>m(g),[m,g]),P=s.useMemo(()=>x(g),[x,g]),N=s.useMemo(()=>I(),[I]);e.useSyncedValues({openMethod:n,activeTriggerProps:D,inactiveTriggerProps:P,popupProps:N,floatingRootContext:d,nestedOpenDialogCount:R})}const L=s.createContext(void 0);function T(t){const e=s.useContext(L);if(t===!1&&e===void 0)throw new Error(V(27));return e}const Pe={...me,modal:O(t=>t.modal),nested:O(t=>t.nested),nestedOpenDialogCount:O(t=>t.nestedOpenDialogCount),disablePointerDismissal:O(t=>t.disablePointerDismissal),openMethod:O(t=>t.openMethod),descriptionElementId:O(t=>t.descriptionElementId),titleElementId:O(t=>t.titleElementId),viewportElement:O(t=>t.viewportElement),role:O(t=>t.role)};class Ie extends oe{constructor(e){super(be(e),{popupRef:s.createRef(),backdropRef:s.createRef(),internalBackdropRef:s.createRef(),triggerElements:new se,onOpenChange:void 0,onOpenChangeComplete:void 0},Pe)}setOpen=(e,o)=>{if(o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!e&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,o),o.isCanceled)return;const C={open:e,nativeEvent:o.event,reason:o.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",C);const l={open:e},r=o.trigger?.id??null;(r||e)&&(l.activeTriggerId=r,l.activeTriggerElement=o.trigger??null),this.update(l)}}function be(t={}){return{...Ce(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function Ue(t){const{children:e,open:o,defaultOpen:C=!1,onOpenChange:l,onOpenChangeComplete:r,actionsRef:u,handle:i,triggerId:n,defaultTriggerId:g=null}=t,p=T(),f=!!p,a=H(()=>i?.store??new Ie({open:o??C,activeTriggerId:n!==void 0?n:g,modal:!0,disablePointerDismissal:!0,nested:f,role:"alertdialog"})).current;a.useControlledProp("open",o,C),a.useControlledProp("activeTriggerId",n,g),a.useSyncedValue("nested",f),a.useContextCallback("onOpenChange",l),a.useContextCallback("onOpenChangeComplete",r);const S=a.useState("payload");ve({store:a,actionsRef:u,parentContext:p?.store.context});const d=s.useMemo(()=>({store:a}),[a]);return k.jsx(L.Provider,{value:d,children:typeof e=="function"?e({payload:S}):e})}const Oe={..._,...G},Ae=s.forwardRef(function(e,o){const{render:C,className:l,forceRender:r=!1,...u}=e,{store:i}=T(),n=i.useState("open"),g=i.useState("nested"),p=i.useState("mounted"),f=i.useState("transitionStatus"),a=s.useMemo(()=>({open:n,transitionStatus:f}),[n,f]);return M("div",e,{state:a,ref:[i.context.backdropRef,o],stateAttributesMapping:Oe,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},u],enabled:r||!g})}),Ke=s.forwardRef(function(e,o){const{render:C,className:l,disabled:r=!1,nativeButton:u=!0,...i}=e,{store:n}=T(),g=n.useState("open");function p(d){g&&n.setOpen(!1,K(re,d.nativeEvent))}const{getButtonProps:f,buttonRef:a}=A({disabled:r,native:u}),S=s.useMemo(()=>({disabled:r}),[r]);return M("button",e,{state:S,ref:[o,a],props:[{onClick:p},i,f]})}),We=s.forwardRef(function(e,o){const{render:C,className:l,id:r,...u}=e,{store:i}=T(),n=j(r);return i.useSyncedValueWithCleanup("descriptionElementId",n),M("p",e,{ref:o,props:[{id:n},u]})});let De=(function(t){return t.nestedDialogs="--nested-dialogs",t})({}),Te=(function(t){return t[t.open=F.open]="open",t[t.closed=F.closed]="closed",t[t.startingStyle=F.startingStyle]="startingStyle",t[t.endingStyle=F.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const Y=s.createContext(void 0);function ye(){const t=s.useContext(Y);if(t===void 0)throw new Error(V(26));return t}const Me={..._,...G,nestedDialogOpen(t){return t?{[Te.nestedDialogOpen]:""}:null}},_e=s.forwardRef(function(e,o){const{className:C,finalFocus:l,initialFocus:r,render:u,...i}=e,{store:n}=T(),g=n.useState("descriptionElementId"),p=n.useState("disablePointerDismissal"),f=n.useState("floatingRootContext"),a=n.useState("popupProps"),S=n.useState("modal"),d=n.useState("mounted"),R=n.useState("nested"),v=n.useState("nestedOpenDialogCount"),h=n.useState("open"),y=n.useState("openMethod"),c=n.useState("titleElementId"),m=n.useState("transitionStatus"),I=n.useState("role");ye(),ae({open:h,ref:n.context.popupRef,onComplete(){h&&n.context.onOpenChangeComplete?.(!0)}});function x(b){return b==="touch"?n.context.popupRef.current:!0}const D=r===void 0?x:r,P=v>0,N=s.useMemo(()=>({open:h,nested:R,transitionStatus:m,nestedDialogOpen:P}),[h,R,m,P]),E=M("div",e,{state:N,props:[a,{"aria-labelledby":c??void 0,"aria-describedby":g??void 0,role:I,tabIndex:-1,hidden:!d,onKeyDown(b){he.has(b.key)&&b.stopPropagation()},style:{[De.nestedDialogs]:v}},i],ref:[o,n.context.popupRef,n.useStateSetter("popupElement")],stateAttributesMapping:Me});return k.jsx(q,{context:f,openInteractionType:y,disabled:!d,closeOnFocusOut:!p,initialFocus:D,returnFocus:l,modal:S!==!1,restoreFocus:"popup",children:E})}),Ge=s.forwardRef(function(e,o){const{keepMounted:C=!1,...l}=e,{store:r}=T(),u=r.useState("mounted"),i=r.useState("modal");return u||C?k.jsx(Y.Provider,{value:C,children:k.jsxs(ie,{ref:o,...l,children:[u&&i===!0&&k.jsx(z,{ref:r.context.internalBackdropRef,inert:Q(!open)}),e.children]})}):null}),Le=s.forwardRef(function(e,o){const{render:C,className:l,id:r,...u}=e,{store:i}=T(),n=j(r);return i.useSyncedValueWithCleanup("titleElementId",n),M("h2",e,{ref:o,props:[{id:n},u]})}),Ye=s.forwardRef(function(e,o){const{render:C,className:l,disabled:r=!1,nativeButton:u=!0,id:i,payload:n,handle:g,...p}=e,f=T(!0),a=g?.store??f?.store;if(!a)throw new Error(V(79));const S=j(i),d=a.useState("floatingRootContext"),R=a.useState("isOpenedByTrigger",S),v=s.useRef(null),{registerTrigger:h,isMountedByThisTrigger:y}=Se(S,v,a,{payload:n}),{getButtonProps:c,buttonRef:m}=A({disabled:r,native:u}),I=X(d,{enabled:d!=null}),x=W([I]),D=s.useMemo(()=>({disabled:r,open:R}),[r,R]),P=a.useState("triggerProps",y);return M("button",e,{state:D,ref:[m,o,h,v],props:[x.getReferenceProps(),P,{[le]:"",id:S},p,c],stateAttributesMapping:ue})}),He=s.forwardRef(function(e,o){const{render:C,className:l,validationMode:r="onSubmit",errors:u,onSubmit:i,onFormSubmit:n,...g}=e,p=s.useRef({fields:new Map}),f=s.useRef(!1),a=s.useRef(!1),S=B(c=>{c&&(c.focus(),c.tagName==="INPUT"&&c.select())}),[d,R]=s.useState(u);xe(u,()=>{R(u)}),s.useEffect(()=>{if(!f.current)return;f.current=!1;const c=Array.from(p.current.fields.values()).filter(m=>m.validityData.state.valid===!1);c.length&&S(c[0].controlRef.current)},[d,S]);const v=M("form",e,{ref:o,props:[{noValidate:!0,onSubmit(c){a.current=!0;let m=Array.from(p.current.fields.values());m.forEach(x=>{x.validate()}),m=Array.from(p.current.fields.values());const I=m.filter(x=>!x.validityData.state.valid);if(I.length)c.preventDefault(),S(I[0].controlRef.current);else if(f.current=!0,i?.(c),n){c.preventDefault();const x=m.reduce((D,P)=>(P.name&&(D[P.name]=P.getValue()),D),{});n(x,ce(de,c.nativeEvent))}}},g]}),h=B(c=>{if(c&&d&&U.hasOwnProperty.call(d,c)){const m={...d};delete m[c],R(m)}}),y=s.useMemo(()=>({formRef:p,validationMode:r,errors:d??U,clearErrors:h,submitAttemptedRef:a}),[p,r,d,h]);return k.jsx(Ee.Provider,{value:y,children:v})});export{Ue as A,Ye as D,He as F,Ge as a,Ae as b,_e as c,Le as d,We as e,Ke as f};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{u as J,g as ae,N as ct,z as Ue,y as Je,a as Q,j as _,e as Me,o as at,E as ut,B as lt}from"./useButton-CsZ8hBM8.js";import{T as Pe,Q as ue,aA as ft,aB as dt,aC as pt,ac as G,ap as De,a0 as ne,S as bt,aD as mt,u as ve,M as Qe,ah as Ne,aE as Ze,aF as ye,a9 as Be,aG as We,aH as j,a1 as U,a as L,a7 as ht,ag as Ve,t as gt,A as vt,aq as yt,ar as Et,_ as Ge,W as Ye,Y as kt,aI as Tt,al as wt,g as re,c as ie,K as Rt,aJ as et,x as xt,aK as Ct,i as qe,aL as St,f as be,aa as Ot}from"./popupStateMapping-DolkyTT3.js";import{r as h,j as ce}from"./index-FrTQ7TcS.js";let He={},$e={},je="";function Ft(e){if(typeof document>"u")return!1;const r=ue(e);return ae(r).innerWidth-r.documentElement.clientWidth>0}function Lt(e){const r=ue(e),t=r.documentElement,n=r.body,o=Ue(t)?t:n,c=o.style.overflow;return o.style.overflow="hidden",()=>{o.style.overflow=c}}function It(e){const r=ue(e),t=r.documentElement,n=r.body,o=ae(t);let c=0,d=0;const x=pt.create(),E=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(dt&&(o.visualViewport?.scale??1)!==1)return()=>{};function R(){const S=o.getComputedStyle(t),a=o.getComputedStyle(n),g=(S.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=t.scrollTop,d=t.scrollLeft,He={scrollbarGutter:t.style.scrollbarGutter,overflowY:t.style.overflowY,overflowX:t.style.overflowX},je=t.style.scrollBehavior,$e={position:n.style.position,height:n.style.height,width:n.style.width,boxSizing:n.style.boxSizing,overflowY:n.style.overflowY,overflowX:n.style.overflowX,scrollBehavior:n.style.scrollBehavior};const y=t.scrollHeight>t.clientHeight,f=t.scrollWidth>t.clientWidth,u=S.overflowY==="scroll"||a.overflowY==="scroll",N=S.overflowX==="scroll"||a.overflowX==="scroll",O=Math.max(0,o.innerWidth-t.clientWidth),A=Math.max(0,o.innerHeight-t.clientHeight),M=parseFloat(a.marginTop)+parseFloat(a.marginBottom),K=parseFloat(a.marginLeft)+parseFloat(a.marginRight),I=Ue(t)?t:n;if(E){t.style.scrollbarGutter=g,I.style.overflowY="hidden",I.style.overflowX="hidden";return}Object.assign(t.style,{scrollbarGutter:g,overflowY:"hidden",overflowX:"hidden"}),(y||u)&&(t.style.overflowY="scroll"),(f||N)&&(t.style.overflowX="scroll"),Object.assign(n.style,{position:"relative",height:M||A?`calc(100dvh - ${M+A}px)`:"100dvh",width:K||O?`calc(100vw - ${K+O}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),n.scrollTop=c,n.scrollLeft=d,t.setAttribute("data-base-ui-scroll-locked",""),t.style.scrollBehavior="unset"}function C(){Object.assign(t.style,He),Object.assign(n.style,$e),E||(t.scrollTop=c,t.scrollLeft=d,t.removeAttribute("data-base-ui-scroll-locked"),t.style.scrollBehavior=je)}function D(){C(),x.request(R)}return R(),o.addEventListener("resize",D),()=>{x.cancel(),C(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",D)}}class At{lockCount=0;restore=null;timeoutLock=Pe.create();timeoutUnlock=Pe.create();acquire(r){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(r)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(r){if(this.lockCount===0||this.restore!==null)return;const n=ue(r).documentElement,o=ae(n).getComputedStyle(n).overflowY;if(o==="hidden"||o==="clip"){this.restore=ct;return}const c=ft||!Ft(r);this.restore=c?Lt(r):It(r)}}const Mt=new At;function jt(e=!0,r=null){J(()=>{if(e)return Mt.acquire(r)},[e,r])}let Xe=0;function me(e,r={}){const{preventScroll:t=!1,cancelPrevious:n=!0,sync:o=!1}=r;n&&cancelAnimationFrame(Xe);const c=()=>e?.focus({preventScroll:t});o?c():Xe=requestAnimationFrame(c)}const X={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Ke(e){return e==="inert"?X.inert:e==="aria-hidden"?X["aria-hidden"]:X.none}let oe=new WeakSet,se={},he=0;const tt=e=>e&&(e.host||tt(e.parentNode)),Pt=(e,r)=>r.map(t=>{if(e.contains(t))return t;const n=tt(t);return e.contains(n)?n:null}).filter(t=>t!=null);function Dt(e,r,t,n){const o="data-base-ui-inert",c=n?"inert":t?"aria-hidden":null,d=Pt(r,e),x=new Set,E=new Set(d),R=[];se[o]||(se[o]=new WeakMap);const C=se[o];d.forEach(D),S(r),x.clear();function D(a){!a||x.has(a)||(x.add(a),a.parentNode&&D(a.parentNode))}function S(a){!a||E.has(a)||[].forEach.call(a.children,p=>{if(Je(p)!=="script")if(x.has(p))S(p);else{const F=c?p.getAttribute(c):null,g=F!==null&&F!=="false",y=Ke(c),f=(y.get(p)||0)+1,u=(C.get(p)||0)+1;y.set(p,f),C.set(p,u),R.push(p),f===1&&g&&oe.add(p),u===1&&p.setAttribute(o,""),!g&&c&&p.setAttribute(c,c==="inert"?"":"true")}})}return he+=1,()=>{R.forEach(a=>{const p=Ke(c),g=(p.get(a)||0)-1,y=(C.get(a)||0)-1;p.set(a,g),C.set(a,y),g||(!oe.has(a)&&c&&a.removeAttribute(c),oe.delete(a)),y||a.removeAttribute(o)}),he-=1,he||(X.inert=new WeakMap,X["aria-hidden"]=new WeakMap,X.none=new WeakMap,oe=new WeakSet,se={})}}function Nt(e,r=!1,t=!1){const n=G(e[0]).body;return Dt(e.concat(Array.from(n.querySelectorAll("[aria-live]"))),n,r,t)}function Bt(e,r){const t=ae(e.target);return e instanceof t.KeyboardEvent?"keyboard":e instanceof t.FocusEvent?r||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof t.MouseEvent?r||(e.detail===0?"keyboard":"mouse"):""}const ze=20;let Y=[];function Ee(){Y=Y.filter(e=>e.isConnected)}function Wt(e){Ee(),e&&Je(e)!=="body"&&(Y.push(e),Y.length>ze&&(Y=Y.slice(-ze)))}function ge(){return Ee(),Y[Y.length-1]}function Vt(e){if(!e)return null;const r=ye();return et(e,r)?e:Ze(e,r)[0]||e}function Gt(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():at(e).display!=="none"}function _e(e,r){if(!r.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const t=ye(),o=Ct(e,t).filter(d=>{const x=d.getAttribute("data-tabindex")||"";return et(d,t)||d.hasAttribute("data-tabindex")&&!x.startsWith("-")}),c=e.getAttribute("tabindex");r.current.includes("floating")||o.length===0?c!=="0"&&e.setAttribute("tabindex","0"):(c!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Xt(e){const{context:r,children:t,disabled:n=!1,order:o=["content"],initialFocus:c=!0,returnFocus:d=!0,restoreFocus:x=!1,modal:E=!0,closeOnFocusOut:R=!0,openInteractionType:C="",getInsideElements:D=()=>[],nextFocusableElement:S,previousFocusableElement:a,beforeContentFocusGuardRef:p,externalTree:F}=e,g="rootStore"in r?r.rootStore:r,y=g.useState("open"),f=g.useState("domReferenceElement"),u=g.useState("floatingElement"),{events:N,dataRef:O}=g.context,A=Q(()=>O.current.floatingContext?.nodeId),M=Q(D),K=c===!1,I=De(f)&&K,q=ne(o),ke=ne(c),Z=ne(d),Te=ne(C),B=bt(F),k=mt(),nt=h.useRef(null),rt=h.useRef(null),W=h.useRef(!1),ee=h.useRef(!1),le=h.useRef(!1),we=h.useRef(-1),Re=h.useRef(""),fe=h.useRef(""),xe=ve(),Ce=ve(),Se=Qe(),de=k!=null,l=Ne(u),H=Q((i=l)=>i?Ze(i,ye()):[]),z=Q(i=>{const b=H(i);return q.current.map(()=>b).filter(Boolean).flat()});h.useEffect(()=>{if(n||!E)return;function i(T){T.key==="Tab"&&L(l,U(G(l)))&&H().length===0&&!I&&wt(T)}const b=G(l);return b.addEventListener("keydown",i),()=>{b.removeEventListener("keydown",i)}},[n,f,l,E,q,I,H,z]),h.useEffect(()=>{if(n||!u)return;function i(b){const T=re(b),w=H().indexOf(T);w!==-1&&(we.current=w)}return u.addEventListener("focusin",i),()=>{u.removeEventListener("focusin",i)}},[n,u,H]),h.useEffect(()=>{if(n||!y)return;const i=G(l);function b(){le.current=!1}function T(w){const s=re(w),m=L(u,s)||L(f,s)||L(k?.portalNode,s);le.current=!m,fe.current=w.pointerType||"keyboard"}function v(){fe.current="keyboard"}return i.addEventListener("pointerdown",T,!0),i.addEventListener("pointerup",b,!0),i.addEventListener("pointercancel",b,!0),i.addEventListener("keydown",v,!0),()=>{i.removeEventListener("pointerdown",T,!0),i.removeEventListener("pointerup",b,!0),i.removeEventListener("pointercancel",b,!0),i.removeEventListener("keydown",v,!0)}},[n,u,f,l,y,k]),h.useEffect(()=>{if(n||!R)return;function i(){ee.current=!0,Ce.start(0,()=>{ee.current=!1})}function b(s){const m=s.relatedTarget,$=s.currentTarget,P=re(s);queueMicrotask(()=>{const te=A(),Ie=g.context.triggerElements,it=!(L(f,m)||L(u,m)||L(m,u)||L(k?.portalNode,m)||m!=null&&Ie.hasElement(m)||Ie.hasMatchingElement(V=>L(V,m))||m?.hasAttribute(Be("focus-guard"))||B&&(Ve(B.nodesRef.current,te).find(V=>L(V.context?.elements.floating,m)||L(V.context?.elements.domReference,m))||We(B.nodesRef.current,te).find(V=>[V.context?.elements.floating,Ne(V.context?.elements.floating)].includes(m)||V.context?.elements.domReference===m)));if($===f&&l&&_e(l,q),x&&$!==f&&!Gt(P)&&U(G(l))===G(l).body){if(_(l)&&(l.focus(),x==="popup")){Se.request(()=>{l.focus()});return}const V=we.current,pe=H(),Ae=pe[V]||pe[pe.length-1]||l;_(Ae)&&Ae.focus()}if(O.current.insideReactTree){O.current.insideReactTree=!1;return}(I||!E)&&m&&it&&!ee.current&&(I||m!==ge())&&(W.current=!0,g.setOpen(!1,ie(Rt,s)))})}function T(){le.current||(O.current.insideReactTree=!0,xe.start(0,()=>{O.current.insideReactTree=!1}))}const v=_(f)?f:null,w=[];if(!(!u&&!v))return v&&(v.addEventListener("focusout",b),v.addEventListener("pointerdown",i),w.push(()=>{v.removeEventListener("focusout",b),v.removeEventListener("pointerdown",i)})),u&&(u.addEventListener("focusout",b),k&&(u.addEventListener("focusout",T,!0),w.push(()=>{u.removeEventListener("focusout",T,!0)})),w.push(()=>{u.removeEventListener("focusout",b)})),()=>{w.forEach(s=>{s()})}},[n,f,u,l,E,B,k,g,R,x,H,I,A,q,O,xe,Ce,Se]);const Oe=h.useRef(null),Fe=h.useRef(null),ot=Me(Oe,p,k?.beforeInsideRef),st=Me(Fe,k?.afterInsideRef);h.useEffect(()=>{if(n||!u||!y)return;const i=Array.from(k?.portalNode?.querySelectorAll(`[${Be("portal")}]`)||[]),T=(B?We(B.nodesRef.current,A()):[]).find(s=>De(s.context?.elements.domReference||null))?.context?.elements.domReference,v=[u,T,...i,...M(),nt.current,rt.current,Oe.current,Fe.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,j(a),j(S),I?f:null].filter(s=>s!=null),w=Nt(v,E||I);return()=>{w()}},[y,n,f,u,E,q,k,I,B,A,M,S,a]),J(()=>{if(!y||n||!_(l))return;const i=G(l),b=U(i);queueMicrotask(()=>{const T=z(l),v=ke.current,w=typeof v=="function"?v(Te.current||""):v;if(w===void 0||w===!1)return;let s;w===!0||w===null?s=T[0]||l:s=j(w),s=s||T[0]||l,!L(l,b)&&me(s,{preventScroll:s===l})})},[n,y,l,K,z,ke,Te]),J(()=>{if(n||!l)return;const i=G(l),b=U(i);Wt(b);function T(s){if(s.open||(Re.current=Bt(s.nativeEvent,fe.current)),s.reason===gt&&s.nativeEvent.type==="mouseleave"&&(W.current=!0),s.reason===vt)if(s.nested)W.current=!1;else if(yt(s.nativeEvent)||Et(s.nativeEvent))W.current=!1;else{let m=!1;document.createElement("div").focus({get preventScroll(){return m=!0,!1}}),m?W.current=!1:W.current=!0}}N.on("openchange",T);const v=i.createElement("span");v.setAttribute("tabindex","-1"),v.setAttribute("aria-hidden","true"),Object.assign(v.style,ht),de&&f&&f.insertAdjacentElement("afterend",v);function w(){const s=Z.current;let m=typeof s=="function"?s(Re.current):s;if(m===void 0||m===!1)return null;if(m===null&&(m=!0),typeof m=="boolean"){const P=f||ge();return P&&P.isConnected?P:v}const $=f||ge()||v;return j(m)||$}return()=>{N.off("openchange",T);const s=U(i),m=L(u,s)||B&&Ve(B.nodesRef.current,A(),!1).some(P=>L(P.context?.elements.floating,s)),$=w();queueMicrotask(()=>{const P=Vt($),te=typeof Z.current!="boolean";Z.current&&!W.current&&_(P)&&(!(!te&&P!==s&&s!==i.body)||m)&&P.focus({preventScroll:!0}),v.remove()})}},[n,u,l,Z,O,N,B,de,f,A]),h.useEffect(()=>{queueMicrotask(()=>{W.current=!1})},[n]),h.useEffect(()=>{if(n||!y)return;function i(T){re(T)?.closest(`[${xt}]`)&&(ee.current=!0)}const b=G(l);return b.addEventListener("pointerdown",i,!0),()=>{b.removeEventListener("pointerdown",i,!0)}},[n,y,l]),J(()=>{if(!n&&k)return k.setFocusManagerState({modal:E,closeOnFocusOut:R,open:y,onOpenChange:g.setOpen,domReference:f}),()=>{k.setFocusManagerState(null)}},[n,k,E,y,g,R,f]),J(()=>{if(!(n||!l))return _e(l,q),()=>{queueMicrotask(Ee)}},[n,l,q]);const Le=!n&&(E?!I:!0)&&(de||E);return ce.jsxs(h.Fragment,{children:[Le&&ce.jsx(Ge,{"data-type":"inside",ref:ot,onFocus:i=>{if(E){const b=z();me(b[b.length-1])}else k?.portalNode&&(W.current=!1,Ye(i,k.portalNode)?kt(f)?.focus():j(a??k.beforeOutsideRef)?.focus())}}),t,Le&&ce.jsx(Ge,{"data-type":"inside",ref:st,onFocus:i=>{E?me(z()[0]):k?.portalNode&&(R&&(W.current=!0),Ye(i,k.portalNode)?Tt(f)?.focus():j(S??k.afterOutsideRef)?.focus())}})]})}function Kt(e,r={}){const t="rootStore"in e?e.rootStore:e,n=t.context.dataRef,{enabled:o=!0,event:c="click",toggle:d=!0,ignoreMouse:x=!1,stickIfOpen:E=!0,touchOpenDelay:R=0}=r,C=h.useRef(void 0),D=Qe(),S=ve(),a=h.useMemo(()=>({onPointerDown(p){C.current=p.pointerType},onMouseDown(p){const F=C.current,g=p.nativeEvent,y=t.select("open");if(p.button!==0||c==="click"||qe(F,!0)&&x)return;const f=n.current.openEvent,u=f?.type,N=t.select("domReferenceElement")!==p.currentTarget,O=y&&N||!(y&&d&&(!(f&&E)||u==="click"||u==="mousedown"));if(Ot(g.target)){const M=ie(be,g,g.target);O&&F==="touch"&&R>0?S.start(R,()=>{t.setOpen(!0,M)}):t.setOpen(O,M);return}const A=p.currentTarget;D.request(()=>{const M=ie(be,g,A);O&&F==="touch"&&R>0?S.start(R,()=>{t.setOpen(!0,M)}):t.setOpen(O,M)})},onClick(p){if(c==="mousedown-only")return;const F=C.current;if(c==="mousedown"&&F){C.current=void 0;return}if(qe(F,!0)&&x)return;const g=t.select("open"),y=n.current.openEvent,f=t.select("domReferenceElement")!==p.currentTarget,u=g&&f||!(g&&d&&(!(y&&E)||St(y))),N=ie(be,p.nativeEvent,p.currentTarget);u&&F==="touch"&&R>0?S.start(R,()=>{t.setOpen(!0,N)}):t.setOpen(u,N)},onKeyDown(){C.current=void 0}}),[n,c,x,t,E,d,D,S,R]);return h.useMemo(()=>o?{reference:a}:ut,[o,a])}function Yt(e){const r=h.useRef(""),t=h.useCallback(o=>{o.defaultPrevented||(r.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:h.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o&&e(o,o.pointerType),e(o,r.current),r.current=""},[e]),onPointerDown:t}}function zt(e){const[r,t]=h.useState(null),n=Q((x,E)=>{e||t(E)}),o=h.useCallback(()=>{t(null)},[]),{onClick:c,onPointerDown:d}=Yt(n);return h.useMemo(()=>({openMethod:r,reset:o,triggerProps:{onClick:c,onPointerDown:d}}),[r,o,c,d])}function _t(e){return lt(19)?e:e?"true":void 0}const Ut=h.forwardRef(function(r,t){const{cutout:n,...o}=r;let c;if(n){const d=n?.getBoundingClientRect();c=`polygon(
|
|
2
|
-
0% 0%,
|
|
3
|
-
100% 0%,
|
|
4
|
-
100% 100%,
|
|
5
|
-
0% 100%,
|
|
6
|
-
0% 0%,
|
|
7
|
-
${d.left}px ${d.top}px,
|
|
8
|
-
${d.left}px ${d.bottom}px,
|
|
9
|
-
${d.right}px ${d.bottom}px,
|
|
10
|
-
${d.right}px ${d.top}px,
|
|
11
|
-
${d.left}px ${d.top}px
|
|
12
|
-
)`}return ce.jsx("div",{ref:t,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});export{Xt as F,Ut as I,jt as a,Kt as b,me as e,_t as i,zt as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Q,a5 as X,j as i,d as Y,r as D,I as Z}from"./index-FrTQ7TcS.js";import{B as ee}from"./button-CMZqhyXB.js";import{j as G}from"./combobox-iSbUYz0A.js";import{u as te}from"./useEnvironments-Bu_0SIUj.js";import{u as ne}from"./useConfigVariants-CLc_hPw1.js";import{u as ie}from"./useTargetingRules-BrgaEdxR.js";import{u as se,e as ae,a as J,v as K,b as M,S as re,f as oe,i as le}from"./useSetTargeting-bk0Ixhqq.js";import{i as ce,a as de}from"./info-box.css-DuVI9M9-.js";/* empty css */import"./useButton-CsZ8hBM8.js";import"./popupStateMapping-DolkyTT3.js";import"./reselect-DVmmTZGf.js";import"./getDisabledMountTransitionStyles-TZFYxPIU.js";import"./InternalBackdrop-Za9lpJi7.js";import"./useValueChanged-CTjBqaGs.js";import"./useMutation-D4JglXWk.js";function Ee(){const t=Q.c(17),{id:e,environment:a}=X.useParams(),{data:c,isLoading:j}=te(),{data:o,isLoading:y}=ne(e),{data:L,isLoading:I}=ie(e);if(j||y||I){let s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx("div",{children:"Loading..."}),t[0]=s):s=t[0],s}let n;t[1]!==a||t[2]!==c?(n=c?.find(s=>s.id===a),t[1]=a,t[2]=c,t[3]=n):n=t[3];const S=n;if(!S){let s;return t[4]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsx("div",{children:"Environment not found"}),t[4]=s):s=t[4],s}let r;t[5]!==a||t[6]!==L?(r=L?.find(s=>s.environmentId===a),t[5]=a,t[6]=L,t[7]=r):r=t[7];const R=r;let l;t[8]!==o?(l=o??[],t[8]=o,t[9]=l):l=t[9];const B=R?.configVariantId??null,E=R?.variantVersionId??null;let g;return t[10]!==e||t[11]!==S||t[12]!==a||t[13]!==l||t[14]!==B||t[15]!==E?(g=i.jsx(me,{configId:e,environmentId:a,environment:S,variants:l,initialVariantId:B,initialVariantVersionId:E}),t[10]=e,t[11]=S,t[12]=a,t[13]=l,t[14]=B,t[15]=E,t[16]=g):g=t[16],g}function me(t){const e=Q.c(67),{configId:a,environmentId:c,environment:j,variants:o,initialVariantId:y,initialVariantVersionId:L}=t,I=Y(),v=se(),[n,S]=D.useState(y),[r,R]=D.useState(L??null);let l;if(e[0]!==n||e[1]!==o){let m;e[3]!==n?(m=P=>P.id===n,e[3]=n,e[4]=m):m=e[4],l=o.find(m),e[0]=n,e[1]=o,e[2]=l}else l=e[2];const E=l?.variantId??"",{data:g,isLoading:s}=ae(E);let $,w;e[5]!==y||e[6]!==n?($=()=>{n!==y&&R(null)},w=[n,y],e[5]=y,e[6]=n,e[7]=$,e[8]=w):($=e[7],w=e[8]),D.useEffect($,w);let z;e[9]!==o?(z=o.map(ge),e[9]=o,e[10]=z):z=e[10];const u=z;let p,b,h,x,V,N,d;if(e[11]!==a||e[12]!==j.name||e[13]!==c||e[14]!==s||e[15]!==I||e[16]!==n||e[17]!==r||e[18]!==v||e[19]!==u||e[20]!==o||e[21]!==g){d=g?.map(ve)??[];let m;e[29]!==a||e[30]!==c||e[31]!==I||e[32]!==n||e[33]!==r||e[34]!==v?(m=async()=>{if(!(!n||!r))try{await v.mutateAsync({environmentId:c,configId:a,configVariantId:n,variantVersionId:r}),I({to:"/configs/$id/targeting",params:{id:a}})}catch(f){console.error("Error setting targeting:",f)}},e[29]=a,e[30]=c,e[31]=I,e[32]=n,e[33]=r,e[34]=v,e[35]=m):m=e[35];const P=m;let H;e[36]===Symbol.for("react.memo_cache_sentinel")?(H={justifyContent:"flex-end"},e[36]=H):H=e[36];const q=!n||!r||v.isPending;let W;e[37]===Symbol.for("react.memo_cache_sentinel")?(W=i.jsx(Z,{icon:re,size:"sm"}),e[37]=W):W=e[37];const A=v.isPending?"Saving...":"Save";e[38]!==P||e[39]!==q||e[40]!==A?(p=i.jsx("div",{className:oe,style:H,children:i.jsxs(ee,{variant:"primary",onClick:P,disabled:q,children:[W,A]})}),e[38]=P,e[39]=q,e[40]=A,e[41]=p):p=e[41],b=le,e[42]!==j.name?(h=i.jsxs("div",{className:ce,children:["The selected variant will be served to all requests in the"," ",i.jsx("span",{className:de,children:j.name})," ","environment"]}),e[42]=j.name,e[43]=h):h=e[43];let k;e[44]===Symbol.for("react.memo_cache_sentinel")?(k=i.jsx("div",{className:K,style:{minWidth:"120px"},children:"Variant"}),e[44]=k):k=e[44];let T;e[45]!==o?(T=f=>{if(!f)return"";const O=o.find(U=>U.id===f);return O?O.name:f},e[45]=o,e[46]=T):T=e[46],e[47]!==n||e[48]!==T||e[49]!==u?(x=i.jsxs("div",{className:J,children:[k,i.jsx("div",{className:M,children:i.jsx(G,{items:u,value:n,onValueChange:S,placeholder:"Select a variant...",itemToString:T})})]}),e[47]=n,e[48]=T,e[49]=u,e[50]=x):x=e[50],e[51]!==u.length?(V=u.length===0&&i.jsx("div",{style:{marginTop:"1rem",opacity:.6},children:"No variants available. Create a variant first to configure targeting."}),e[51]=u.length,e[52]=V):V=e[52],N=n&&i.jsxs("div",{className:J,children:[i.jsx("div",{className:K,style:{minWidth:"120px"},children:"Version"}),i.jsx("div",{className:M,children:s?i.jsx("span",{style:{opacity:.6},children:"Loading versions..."}):d.length===0?i.jsx("span",{style:{opacity:.6},children:"No versions available"}):i.jsx(G,{items:d,value:d.find(f=>f.id===r)??null,onValueChange:f=>R(f?.id??null),placeholder:"Select version...",itemToString:fe})})]}),e[11]=a,e[12]=j.name,e[13]=c,e[14]=s,e[15]=I,e[16]=n,e[17]=r,e[18]=v,e[19]=u,e[20]=o,e[21]=g,e[22]=p,e[23]=b,e[24]=h,e[25]=x,e[26]=V,e[27]=N,e[28]=d}else p=e[22],b=e[23],h=e[24],x=e[25],V=e[26],N=e[27],d=e[28];let C;e[53]!==n||e[54]!==r||e[55]!==d?(C=n&&!r&&d.length>0&&i.jsx("div",{style:{marginTop:"0.5rem",fontSize:"0.75rem",color:"var(--gray9)"},children:"Select a version to deploy to this environment."}),e[53]=n,e[54]=r,e[55]=d,e[56]=C):C=e[56];let _;e[57]!==C||e[58]!==b||e[59]!==h||e[60]!==x||e[61]!==V||e[62]!==N?(_=i.jsxs("div",{className:b,children:[h,x,V,N,C]}),e[57]=C,e[58]=b,e[59]=h,e[60]=x,e[61]=V,e[62]=N,e[63]=_):_=e[63];let F;return e[64]!==p||e[65]!==_?(F=i.jsxs("div",{children:[p,_]}),e[64]=p,e[65]=_,e[66]=F):F=e[66],F}function fe(t){return t?.label??""}function ve(t){return{id:t.id,label:`Version ${t.version}`,version:t.version}}function ge(t){return t.id}export{Ee as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as ke,a as fe,p as ue,j as s,I as me,C as Ee,L as ge,D as Ae,q as Fe,d as ye,r as de,u as Me,b as ze,e as He,O as qe}from"./index-FrTQ7TcS.js";import{w as Ve,b as Ue,C as Je,c as We,B as Ge,h as je,H as Ye,a as Ke,g as Qe}from"./area.css-CSjofvHM.js";import{B as Xe}from"./button-CMZqhyXB.js";import{P as Le,a as Oe,b as Pe}from"./popover-DXj4s-ni.js";import{C as Re}from"./chevron-down-BJFxhYkh.js";import{C as Ze}from"./combobox-iSbUYz0A.js";import{u as et}from"./useEnvironments-Bu_0SIUj.js";import{u as tt}from"./useConfigList-CAf01_dV.js";import{u as st}from"./useConfigVariants-CLc_hPw1.js";import{u as at}from"./useAnalytics-DTf81POS.js";import{C as lt}from"./chevron-right-fMWRsRLZ.js";/* empty css */import"./useButton-CsZ8hBM8.js";import"./InternalBackdrop-Za9lpJi7.js";import"./popupStateMapping-DolkyTT3.js";import"./reselect-DVmmTZGf.js";import"./useSyncedFloatingRootContext-BKbVh8Gq.js";import"./useRole-CiSaVva3.js";import"./usePopupAutoResize-D6RSlB-m.js";import"./getDisabledMountTransitionStyles-TZFYxPIU.js";import"./useValueChanged-CTjBqaGs.js";const nt=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],it=ke("calendar",nt);const rt=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],ot=ke("funnel",rt);const ct=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],mt=ke("refresh-cw",ct);var dt="_5mtmrw0",ft="_5mtmrw2 _5mtmrw1 _1lg22bks0 _1lg22bksi _1lg22bktr _1lg22bk6 _1lg22bkpr",Se="_5mtmrw4 _5mtmrw3 _1lg22bks0 _1lg22bksi _1lg22bkto",Ne="_5mtmrw6 _5mtmrw5 _1lg22bkux _1lg22bkw0 _1lg22bkj3 _1lg22bk3",_e="_5mtmrw8 _5mtmrw7 _1lg22bks0 _1lg22bk3 _1lg22bkv0 _1lg22bkj9 _1lg22bkw0",bt="_5mtmrwa _5mtmrw9 _1lg22bk9";function gt(){const e=fe.c(18);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/(app)/observability"},e[0]=a):a=e[0];const t=ue(a);let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("span",{className:Ne,children:"Analytics"}),e[1]=l):l=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(me,{icon:Ee}),e[2]=u):u=e[2];let h;e[3]!==t?(h=s.jsxs(ge,{to:"/observability/overview",search:t,className:_e,children:[u,"Overview"]}),e[3]=t,e[4]=h):h=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(me,{icon:Ae}),e[5]=o):o=e[5];let i;e[6]!==t?(i=s.jsxs(ge,{to:"/observability/costs",search:t,className:_e,children:[o,"Costs"]}),e[6]=t,e[7]=i):i=e[7];let d;e[8]!==h||e[9]!==i?(d=s.jsxs("div",{className:Se,children:[l,h,i]}),e[8]=h,e[9]=i,e[10]=d):d=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("span",{className:Ne,children:"Logs"}),e[11]=c):c=e[11];let r;e[12]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(me,{icon:Fe}),e[12]=r):r=e[12];let b;e[13]!==t?(b=s.jsxs("div",{className:Se,children:[c,s.jsxs(ge,{to:"/observability/requests",search:t,className:_e,children:[r,"Requests"]})]}),e[13]=t,e[14]=b):b=e[14];let f;return e[15]!==d||e[16]!==b?(f=s.jsxs("nav",{className:ft,children:[d,b]}),e[15]=d,e[16]=b,e[17]=f):f=e[17],f}var ut="_1ey9mxp0",ht="_1ey9mxp2 _1ey9mxp1 _1lg22bks0 _1lg22bkto _1lg22bkv0 _1lg22bkw0 _1lg22bk3 _1lg22bkuc",Ie="_1ey9mxp3",_t="_1ey9mxp4",vt="_1ey9mxp6 _1ey9mxp5 _1lg22bkuf",pt="_1ey9mxp8 _1ey9mxp7 _1lg22bk6 _1lg22bkux _1lg22bkw0",xt="_1ey9mxp9",kt="_1ey9mxpb _1ey9mxpa _1lg22bkv0 _1lg22bkw0 _1lg22bk3 _1lg22bkuc",yt="_1ey9mxpd",jt="_1ey9mxpf _1ey9mxpe _1lg22bkux _1lg22bkw0 _1lg22bkj3",St="_1ey9mxpg",we="_1ey9mxpi _1ey9mxph _1lg22bkv0 _1lg22bkw0 _1lg22bk3 _1lg22bkuc",Nt="_1ey9mxpk _1ey9mxpj _1lg22bkv0 _1lg22bkw0 _1lg22bkj3",It="_1ey9mxpm _1ey9mxpl _1lg22bkv0 _1lg22bkw0 _1lg22bk3 _1lg22bkuc",wt="_1ey9mxpo _1ey9mxpn _1lg22bk3 _1lg22bkuc",Ct="_1ey9mxpq";const Ce=[{label:"Last 15 minutes",value:"15m"},{label:"Last 1 hour",value:"1h"},{label:"Last 3 hours",value:"3h"},{label:"Last 6 hours",value:"6h"},{label:"Last 12 hours",value:"12h"},{label:"Last 24 hours",value:"24h"},{label:"Last 2 days",value:"2d"},{label:"Last 7 days",value:"7d"},{label:"Last 30 days",value:"30d"},{label:"Last 90 days",value:"90d"}],Be=e=>{const a=new Date;let t=new Date;switch(e){case"15m":t=new Date(a.getTime()-900*1e3);break;case"1h":t=new Date(a.getTime()-3600*1e3);break;case"3h":t=new Date(a.getTime()-10800*1e3);break;case"6h":t=new Date(a.getTime()-360*60*1e3);break;case"12h":t=new Date(a.getTime()-720*60*1e3);break;case"24h":t=new Date(a.getTime()-1440*60*1e3);break;case"2d":t=new Date(a.getTime()-2880*60*1e3);break;case"7d":t=new Date(a.getTime()-10080*60*1e3);break;case"30d":t=new Date(a.getTime()-720*60*60*1e3);break;case"90d":t=new Date(a.getTime()-2160*60*60*1e3);break;default:t=new Date(a.getTime()-10080*60*1e3)}return{from:t.toISOString(),to:a.toISOString()}},Te=e=>e?new Date(e).toISOString().split("T")[0]:"",Tt=e=>new Date(e+"T00:00:00").toISOString(),Dt=e=>new Date(e+"T23:59:59.999").toISOString();function Lt(){const e=fe.c(83);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/(app)/observability"},e[0]=a):a=e[0];const t=ue(a),l=ye(),[u,h]=de.useState(!1);let o;e[1]!==t.from?(o=Te(t.from),e[1]=t.from,e[2]=o):o=e[2];const[i,d]=de.useState(o);let c;e[3]!==t.to?(c=Te(t.to),e[3]=t.to,e[4]=c):c=e[4];const[r,b]=de.useState(c),f=t.range??"7d";let g,x,k,L,v,O,V,P,U,R,J,B,T,$;if(e[5]!==r||e[6]!==i||e[7]!==u||e[8]!==l||e[9]!==t.from||e[10]!==t.to||e[11]!==f){const p=Ce.find(C=>C.value===f)?.label??"Custom";let H;e[26]!==l?(H=C=>{const ae=Be(C);l({to:".",search:D=>({...D,range:C,from:ae.from,to:ae.to}),replace:!0}),h(!1)},e[26]=l,e[27]=H):H=e[27],L=H;let se;e[28]!==r||e[29]!==i||e[30]!==l?(se=()=>{i&&r&&(l({to:".",search:C=>({...C,range:"custom",from:Tt(i),to:Dt(r)}),replace:!0}),h(!1))},e[28]=r,e[29]=i,e[30]=l,e[31]=se):se=e[31],k=se;const ce=()=>{if(f!=="custom")return p;const C=t.from,ae=t.to;if(!C||!ae)return"Custom";const D=new Date(C),K=new Date(ae),q={month:"short",day:"numeric"};return D.getFullYear()!==K.getFullYear()?`${D.toLocaleDateString("en-US",{...q,year:"numeric"})} - ${K.toLocaleDateString("en-US",{...q,year:"numeric"})}`:`${D.toLocaleDateString("en-US",q)} - ${K.toLocaleDateString("en-US",q)}`};V=ut,x=Le,v=u,O=h,g=Oe,$=!0,R="button",J=ht,B=u?"open":"closed",e[32]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx(it,{size:14,className:Ie}),e[32]=T):T=e[32],P=_t,U=ce(),e[5]=r,e[6]=i,e[7]=u,e[8]=l,e[9]=t.from,e[10]=t.to,e[11]=f,e[12]=g,e[13]=x,e[14]=k,e[15]=L,e[16]=v,e[17]=O,e[18]=V,e[19]=P,e[20]=U,e[21]=R,e[22]=J,e[23]=B,e[24]=T,e[25]=$}else g=e[12],x=e[13],k=e[14],L=e[15],v=e[16],O=e[17],V=e[18],P=e[19],U=e[20],R=e[21],J=e[22],B=e[23],T=e[24],$=e[25];let W;e[33]!==P||e[34]!==U?(W=s.jsx("span",{className:P,children:U}),e[33]=P,e[34]=U,e[35]=W):W=e[35];let Q;e[36]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(Re,{size:14,className:Ie}),e[36]=Q):Q=e[36];let G;e[37]!==W||e[38]!==R||e[39]!==J||e[40]!==B||e[41]!==T?(G=s.jsxs("button",{type:R,className:J,"data-state":B,children:[T,W,Q]}),e[37]=W,e[38]=R,e[39]=J,e[40]=B,e[41]=T,e[42]=G):G=e[42];let Y;e[43]!==g||e[44]!==G||e[45]!==$?(Y=s.jsx(g,{asChild:$,children:G}),e[43]=g,e[44]=G,e[45]=$,e[46]=Y):Y=e[46];let X;e[47]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx("div",{className:pt,children:"Time range"}),e[47]=X):X=e[47];let y;e[48]!==L||e[49]!==f?(y=Ce.map(p=>s.jsx("button",{type:"button",className:kt,"data-selected":f===p.value,onClick:()=>L(p.value),children:p.label},p.value)),e[48]=L,e[49]=f,e[50]=y):y=e[50];let j;e[51]!==y?(j=s.jsx("div",{className:xt,children:y}),e[51]=y,e[52]=j):j=e[52];let E;e[53]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("span",{className:jt,children:"Custom range"}),e[53]=E):E=e[53];let Z;e[54]===Symbol.for("react.memo_cache_sentinel")?(Z=p=>d(p.target.value),e[54]=Z):Z=e[54];let S;e[55]!==i?(S=s.jsx("input",{type:"date",className:we,value:i,onChange:Z}),e[55]=i,e[56]=S):S=e[56];let ee;e[57]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx("span",{className:Nt,children:"to"}),e[57]=ee):ee=e[57];let A;e[58]===Symbol.for("react.memo_cache_sentinel")?(A=p=>b(p.target.value),e[58]=A):A=e[58];let N;e[59]!==r?(N=s.jsx("input",{type:"date",className:we,value:r,onChange:A}),e[59]=r,e[60]=N):N=e[60];let F;e[61]!==S||e[62]!==N?(F=s.jsxs("div",{className:St,children:[S,ee,N]}),e[61]=S,e[62]=N,e[63]=F):F=e[63];const ne=!i||!r;let M;e[64]!==k||e[65]!==ne?(M=s.jsx("button",{type:"button",className:It,onClick:k,disabled:ne,children:"Apply"}),e[64]=k,e[65]=ne,e[66]=M):M=e[66];let I;e[67]!==F||e[68]!==M?(I=s.jsxs("div",{className:yt,children:[E,F,M]}),e[67]=F,e[68]=M,e[69]=I):I=e[69];let w;e[70]!==j||e[71]!==I?(w=s.jsxs(Pe,{align:"end",sideOffset:4,className:vt,children:[X,j,I]}),e[70]=j,e[71]=I,e[72]=w):w=e[72];let z;e[73]!==x||e[74]!==v||e[75]!==O||e[76]!==Y||e[77]!==w?(z=s.jsxs(x,{open:v,onOpenChange:O,children:[Y,w]}),e[73]=x,e[74]=v,e[75]=O,e[76]=Y,e[77]=w,e[78]=z):z=e[78];let le;e[79]===Symbol.for("react.memo_cache_sentinel")?(le=s.jsx(Ot,{}),e[79]=le):le=e[79];let te;return e[80]!==V||e[81]!==z?(te=s.jsxs("div",{className:V,children:[z,le]}),e[80]=V,e[81]=z,e[82]=te):te=e[82],te}function Ot(){const e=fe.c(9);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/(app)/observability"},e[0]=a):a=e[0];const t=ue(a),l=ye(),[u,h]=de.useState(!1);let o;e[1]!==l||e[2]!==t.range?(o=()=>{h(!0);const b=t.range??"7d";if(b!=="custom"){const f=Be(b);l({to:".",search:g=>({...g,from:f.from,to:f.to}),replace:!0})}setTimeout(()=>h(!1),500)},e[1]=l,e[2]=t.range,e[3]=o):o=e[3];const i=o,d=u?Ct:void 0;let c;e[4]!==d?(c=s.jsx(mt,{size:14,className:d}),e[4]=d,e[5]=c):c=e[5];let r;return e[6]!==i||e[7]!==c?(r=s.jsx("button",{type:"button",className:wt,onClick:i,title:"Refresh data",children:c}),e[6]=i,e[7]=c,e[8]=r):r=e[8],r}var Pt="nieb1c1 nieb1c0 _1lg22bks0 _1lg22bkto _1lg22bkv0 _1lg22bkw0 _1lg22bk3 _1lg22bkuc",De="nieb1c2",Rt="nieb1c3",Bt="nieb1c5 nieb1c4 _1lg22bkux _1lg22bkw0 _1lg22bkuc",$t="nieb1c7 nieb1c6 _1lg22bkuf",Et="nieb1c9 nieb1c8 _1lg22bk6 _1lg22bkux _1lg22bkw0",At="nieb1cb nieb1ca _1lg22bkux _1lg22bkw0",Ft="nieb1cc",ve="nieb1cd",pe="nieb1cf nieb1ce _1lg22bkux _1lg22bkw0",xe="nieb1ch nieb1cg _1lg22bkv0 _1lg22bkw0 _1lg22bk3 _1lg22bkuc",Mt="nieb1ci",zt="nieb1ck nieb1cj _1lg22bkux _1lg22bkw0",Ht="nieb1cl";function qt(){const e=fe.c(94);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/(app)/observability"},e[0]=a):a=e[0];const t=ue(a),l=ye(),[u,h]=de.useState(!1),{data:o}=et(),{data:i}=tt(),{data:d}=st(t.configId||""),{data:c}=at();let r;e:{if(!c){let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m={},e[1]=m):m=e[1],r=m;break e}let n;e[2]!==c?(n=c.reduce(Kt,{}),e[2]=c,e[3]=n):n=e[3],r=n}const b=r;let f;e:{if(!t.tags){let n;e[4]===Symbol.for("react.memo_cache_sentinel")?(n={},e[4]=n):n=e[4],f=n;break e}try{let n;e[5]!==t.tags?(n=JSON.parse(t.tags),e[5]=t.tags,e[6]=n):n=e[6],f=n}catch{let n;e[7]===Symbol.for("react.memo_cache_sentinel")?(n={},e[7]=n):n=e[7],f=n}}const g=f;let x;e[8]!==g?(x=Object.values(g).reduce(Yt,0),e[8]=g,e[9]=x):x=e[9];const k=x;let L;e[10]!==t.configId||e[11]!==t.environmentId||e[12]!==t.variantId?(L=[t.environmentId,t.configId,t.variantId].filter(Boolean),e[10]=t.configId,e[11]=t.environmentId,e[12]=t.variantId,e[13]=L):L=e[13];const v=L.length+k;let O;e[14]!==l?(O=n=>{const m=n.target.value||void 0;l({to:".",search:_=>({..._,environmentId:m}),replace:!0})},e[14]=l,e[15]=O):O=e[15];const V=O;let P;e[16]!==l?(P=n=>{const m=n.target.value||void 0;l({to:".",search:_=>({..._,configId:m,variantId:void 0}),replace:!0})},e[16]=l,e[17]=P):P=e[17];const U=P;let R;e[18]!==l?(R=n=>{const m=n.target.value||void 0;l({to:".",search:_=>({..._,variantId:m}),replace:!0})},e[18]=l,e[19]=R):R=e[19];const J=R;let B;e[20]!==l||e[21]!==g?(B=(n,m)=>{const _={...g};m.length===0?delete _[n]:_[n]=m;const he=Object.keys(_).length>0?JSON.stringify(_):void 0;l({to:".",search:$e=>({...$e,tags:he}),replace:!0})},e[20]=l,e[21]=g,e[22]=B):B=e[22];const T=B;let $;e[23]!==l?($=()=>{l({to:".",search:Gt,replace:!0})},e[23]=l,e[24]=$):$=e[24];const W=$;let Q;e[25]!==v||e[26]!==d||e[27]!==i||e[28]!==o||e[29]!==t.configId||e[30]!==t.environmentId||e[31]!==t.variantId?(Q=()=>{if(v===0)return"Filters";const n=[];if(t.environmentId){const m=o?.find(_=>_.id===t.environmentId);m&&n.push(m.name)}if(t.configId){const m=i?.find(_=>_.id===t.configId);m&&n.push(m.name)}if(t.variantId&&d){const m=d.find(_=>_.variantId===t.variantId);m&&n.push(m.name)}return n.length===1?n[0]:n.length>1?`${n.length} filters`:"Filters"},e[25]=v,e[26]=d,e[27]=i,e[28]=o,e[29]=t.configId,e[30]=t.environmentId,e[31]=t.variantId,e[32]=Q):Q=e[32];const G=Q,Y=u?"open":"closed";let X;e[33]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(ot,{size:14,className:De}),e[33]=X):X=e[33];let y;e[34]!==G?(y=G(),e[34]=G,e[35]=y):y=e[35];let j;e[36]!==y?(j=s.jsx("span",{className:Rt,children:y}),e[36]=y,e[37]=j):j=e[37];let E;e[38]!==v?(E=v>0&&s.jsx("span",{className:Bt,children:v}),e[38]=v,e[39]=E):E=e[39];let Z;e[40]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(Re,{size:14,className:De}),e[40]=Z):Z=e[40];let S;e[41]!==Y||e[42]!==j||e[43]!==E?(S=s.jsx(Oe,{asChild:!0,children:s.jsxs("button",{type:"button",className:Pt,"data-state":Y,children:[X,j,E,Z]})}),e[41]=Y,e[42]=j,e[43]=E,e[44]=S):S=e[44];let ee;e[45]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx("span",{children:"Filters"}),e[45]=ee):ee=e[45];let A;e[46]!==v||e[47]!==W?(A=v>0&&s.jsx("button",{type:"button",className:At,onClick:W,children:"Clear all"}),e[46]=v,e[47]=W,e[48]=A):A=e[48];let N;e[49]!==A?(N=s.jsxs("div",{className:Et,children:[ee,A]}),e[49]=A,e[50]=N):N=e[50];let F;e[51]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx("label",{className:pe,children:"Environment"}),e[51]=F):F=e[51];const ne=t.environmentId||"";let M;e[52]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx("option",{value:"",children:"All environments"}),e[52]=M):M=e[52];let I;e[53]!==o?(I=o?.map(Wt),e[53]=o,e[54]=I):I=e[54];let w;e[55]!==V||e[56]!==ne||e[57]!==I?(w=s.jsxs("div",{className:ve,children:[F,s.jsxs("select",{className:xe,value:ne,onChange:V,children:[M,I]})]}),e[55]=V,e[56]=ne,e[57]=I,e[58]=w):w=e[58];let z;e[59]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx("label",{className:pe,children:"Config"}),e[59]=z):z=e[59];const le=t.configId||"";let te;e[60]===Symbol.for("react.memo_cache_sentinel")?(te=s.jsx("option",{value:"",children:"All configs"}),e[60]=te):te=e[60];let p;e[61]!==i?(p=i?.map(Jt),e[61]=i,e[62]=p):p=e[62];let H;e[63]!==U||e[64]!==le||e[65]!==p?(H=s.jsxs("div",{className:ve,children:[z,s.jsxs("select",{className:xe,value:le,onChange:U,children:[te,p]})]}),e[63]=U,e[64]=le,e[65]=p,e[66]=H):H=e[66];let se;e[67]===Symbol.for("react.memo_cache_sentinel")?(se=s.jsx("label",{className:pe,children:"Variant"}),e[67]=se):se=e[67];const ce=t.variantId||"",C=!t.configId,ae=t.configId?"All variants":"Select a config first";let D;e[68]!==ae?(D=s.jsx("option",{value:"",children:ae}),e[68]=ae,e[69]=D):D=e[69];let K;e[70]!==d?(K=d?.map(Ut),e[70]=d,e[71]=K):K=e[71];let q;e[72]!==J||e[73]!==ce||e[74]!==C||e[75]!==D||e[76]!==K?(q=s.jsxs("div",{className:ve,children:[se,s.jsxs("select",{className:xe,value:ce,onChange:J,disabled:C,children:[D,K]})]}),e[72]=J,e[73]=ce,e[74]=C,e[75]=D,e[76]=K,e[77]=q):q=e[77];let ie;e[78]!==T||e[79]!==g||e[80]!==b?(ie=Object.keys(b).length>0&&s.jsxs("div",{className:Mt,children:[s.jsx("div",{className:zt,children:"Tags"}),Object.entries(b).map(n=>{const[m,_]=n;return s.jsx("div",{className:Ht,children:s.jsx(Ze,{items:_,label:m,placeholder:`Select ${m}...`,value:g[m]||[],onValueChange:he=>T(m,he),itemToString:Vt,multiple:!0})},m)})]}),e[78]=T,e[79]=g,e[80]=b,e[81]=ie):ie=e[81];let re;e[82]!==w||e[83]!==H||e[84]!==q||e[85]!==ie?(re=s.jsxs("div",{className:Ft,children:[w,H,q,ie]}),e[82]=w,e[83]=H,e[84]=q,e[85]=ie,e[86]=re):re=e[86];let oe;e[87]!==N||e[88]!==re?(oe=s.jsxs(Pe,{align:"end",sideOffset:4,className:$t,children:[N,re]}),e[87]=N,e[88]=re,e[89]=oe):oe=e[89];let be;return e[90]!==u||e[91]!==S||e[92]!==oe?(be=s.jsxs(Le,{open:u,onOpenChange:h,children:[S,oe]}),e[90]=u,e[91]=S,e[92]=oe,e[93]=be):be=e[93],be}function Vt(e){return e||""}function Ut(e){return s.jsx("option",{value:e.variantId,children:e.name},e.variantId)}function Jt(e){return s.jsx("option",{value:e.id,children:e.name},e.id)}function Wt(e){return s.jsxs("option",{value:e.id,children:[e.name,e.isProd?" (prod)":""]},e.id)}function Gt(e){return{...e,environmentId:void 0,configId:void 0,variantId:void 0,tags:void 0}}function Yt(e,a){return e+a.length}function Kt(e,a){const{key:t,value:l}=a;return e[t]||(e[t]=[]),e[t].push(l),e}function xs(){const e=fe.c(19),{toggleSidebar:a}=Me(),t=ze();let l;e[0]!==t?(l=t.filter(Xt).map(Qt),e[0]=t,e[1]=l):l=e[1];const u=l;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(me,{icon:Je}),e[2]=h):h=e[2];let o;e[3]!==a?(o=s.jsx(Xe,{onClick:a,size:"icon",variant:"ghost",scheme:"gray",children:h}),e[3]=a,e[4]=o):o=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(me,{icon:lt,className:We}),e[5]=i):i=e[5];let d;e[6]!==u?(d=s.jsx(Ge,{items:u}),e[6]=u,e[7]=d):d=e[7];let c;e[8]!==o||e[9]!==d?(c=s.jsxs("div",{className:je,children:[o,i,d]}),e[8]=o,e[9]=d,e[10]=c):c=e[10];let r;e[11]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:je,children:[s.jsx(qt,{}),s.jsx(Lt,{})]}),e[11]=r):r=e[11];let b;e[12]!==c?(b=s.jsxs(Ye,{className:Ke,children:[c,r]}),e[12]=c,e[13]=b):b=e[13];let f,g;e[14]===Symbol.for("react.memo_cache_sentinel")?(f=He(Ve,dt),g=s.jsx(gt,{}),e[14]=f,e[15]=g):(f=e[14],g=e[15]);let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("div",{className:Qe,children:s.jsxs("div",{className:f,children:[g,s.jsx("div",{className:bt,children:s.jsx(qe,{})})]})}),e[16]=x):x=e[16];let k;return e[17]!==b?(k=s.jsxs(s.Fragment,{children:[b,x]}),e[17]=b,e[18]=k):k=e[18],k}function Qt(e){const a=e.loaderData?.title,t=e.staticData.customData?.title,l=a??t;return{key:e.id,label:s.jsx(ge,{to:e.pathname,className:Ue,children:l}),prefix:e.staticData.customData?.icon}}function Xt(e){return!!e.staticData.customData?.title||!!e.loaderData?.title}export{xs as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as u,j as s,L as f,I as p,U as j,B as S,u as v,b as N,e as y,O as B}from"./index-FrTQ7TcS.js";import{w as D,b as C,C as w,c as I,B as L,H as R,a as E,h as T,g as U}from"./area.css-CSjofvHM.js";import{B as G}from"./button-CMZqhyXB.js";import{C as H}from"./chevron-right-fMWRsRLZ.js";/* empty css */import"./useButton-CsZ8hBM8.js";var O="iks4pd0",W="iks4pd2 iks4pd1 _1lg22bks0 _1lg22bksi _1lg22bktr _1lg22bk6 _1lg22bkpr",_="iks4pd4 iks4pd3 _1lg22bks0 _1lg22bksi _1lg22bkto",h="iks4pd6 iks4pd5 _1lg22bkux _1lg22bkw0 _1lg22bkj3 _1lg22bk3",x="iks4pd8 iks4pd7 _1lg22bks0 _1lg22bk3 _1lg22bkv0 _1lg22bkj9 _1lg22bkw0",$="iks4pda iks4pd9 _1lg22bk9";function z(){const e=u.c(4);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("span",{className:h,children:"User"}),e[0]=a):a=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{className:_,children:[a,s.jsxs(f,{to:"/settings/user-profile",className:x,children:[s.jsx(p,{icon:j}),"Profile"]})]}),e[1]=i):i=e[1];let t;e[2]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx("span",{className:h,children:"Workspace"}),e[2]=t):t=e[2];let l;return e[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("nav",{className:W,children:[i,s.jsxs("div",{className:_,children:[t,s.jsxs(f,{to:"/settings/workspace-general",className:x,children:[s.jsx(p,{icon:S}),"General"]})]})]}),e[3]=l):l=e[3],l}function V(){const e=u.c(16),{toggleSidebar:a}=v(),i=N();let t;e[0]!==i?(t=i.filter(F).map(A),e[0]=i,e[1]=t):t=e[1];const l=t;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(p,{icon:w}),e[2]=c):c=e[2];let r;e[3]!==a?(r=s.jsx(G,{onClick:a,size:"icon",variant:"ghost",scheme:"gray",children:c}),e[3]=a,e[4]=r):r=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(p,{icon:H,className:I}),e[5]=m):m=e[5];let n;e[6]!==l?(n=s.jsx(L,{items:l}),e[6]=l,e[7]=n):n=e[7];let o;e[8]!==r||e[9]!==n?(o=s.jsx(R,{className:E,children:s.jsxs("div",{className:T,children:[r,m,n]})}),e[8]=r,e[9]=n,e[10]=o):o=e[10];let d,b;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=y(D,O),b=s.jsx(z,{}),e[11]=d,e[12]=b):(d=e[11],b=e[12]);let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx("div",{className:U,children:s.jsxs("div",{className:d,children:[b,s.jsx("div",{className:$,children:s.jsx(B,{})})]})}),e[13]=g):g=e[13];let k;return e[14]!==o?(k=s.jsxs(s.Fragment,{children:[o,g]}),e[14]=o,e[15]=k):k=e[15],k}function A(e){const a=e.loaderData?.title,i=e.staticData.customData?.title,t=a??i;return{key:e.id,label:s.jsx(f,{to:e.pathname,className:C,children:t}),prefix:e.staticData.customData?.icon}}function F(e){return!!e.staticData.customData?.title||!!e.loaderData?.title}export{V as component};
|