omnigateway 0.4.10 → 0.4.12
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/bin/omni.js +198 -25
- package/gateway.js +225 -29
- package/package.json +1 -1
- package/public/assets/{CopyValue-CcE2vXiA.js → CopyValue-By5BAgv7.js} +1 -1
- package/public/assets/{Rack-Bbk1hAor.js → Rack-fDZClWZL.js} +1 -1
- package/public/assets/{Toggle-DGsa7LWV.js → Toggle-ClEeOh0F.js} +1 -1
- package/public/assets/{TokenBreakdown-Do_4AmfF.js → TokenBreakdown-D70VeZ2N.js} +1 -1
- package/public/assets/{_app-UpbTpRCt.js → _app-CDPKnQ72.js} +1 -1
- package/public/assets/{_app.accounts-CPG3iaDT.js → _app.accounts-Dz0ox4Br.js} +1 -1
- package/public/assets/{_app.console-BaGTRPEe.js → _app.console-hPUmmYjp.js} +1 -1
- package/public/assets/{_app.database-DA2aB-ij.js → _app.database-DGtP4NdG.js} +1 -1
- package/public/assets/{_app.index-CDjVA5Ix.js → _app.index-COcCAmbH.js} +1 -1
- package/public/assets/{_app.keys-Bf8HiloS.js → _app.keys-yTXTbKTA.js} +1 -1
- package/public/assets/{_app.logs-DTF9RDhN.js → _app.logs-BhMvO_Fx.js} +1 -1
- package/public/assets/{_app.models-B6_6bC3z.js → _app.models-0S3rurIl.js} +1 -1
- package/public/assets/{_app.plugins._pluginId-Dl_jYunC.js → _app.plugins._pluginId-B-ZDQNPU.js} +1 -1
- package/public/assets/_app.settings-DTnFwTeA.js +46 -0
- package/public/assets/{_app.usage-D4TLCm9J.js → _app.usage-C2-VLiq9.js} +1 -1
- package/public/assets/{index-CJZIRJ43.js → index-COwhxKU7.js} +2 -2
- package/public/assets/{login-Bu6texfZ.js → login-DjfMomJJ.js} +1 -1
- package/public/assets/plus-UDQ_BTEr.js +1 -0
- package/public/assets/{trash-2-5CCUKFQ0.js → trash-2-U2ViYZum.js} +1 -1
- package/public/index.html +1 -1
- package/public/assets/_app.settings-Dh6lrqws.js +0 -46
- package/public/assets/plus-Z1kRC6KA.js +0 -1
package/gateway.js
CHANGED
|
@@ -5354,6 +5354,7 @@ var RETRYABLE = {
|
|
|
5354
5354
|
BAD_REQUEST: false,
|
|
5355
5355
|
CONFLICT: false,
|
|
5356
5356
|
CONTENT_FILTER: false,
|
|
5357
|
+
FINGERPRINT_REFUSED: false,
|
|
5357
5358
|
NO_CANDIDATES: false,
|
|
5358
5359
|
ALL_CANDIDATES_FAILED: false,
|
|
5359
5360
|
INTERNAL: false
|
|
@@ -5367,6 +5368,7 @@ var HTTP_STATUS = {
|
|
|
5367
5368
|
CONFLICT: 409,
|
|
5368
5369
|
CONTENT_FILTER: 400,
|
|
5369
5370
|
CAPABILITY_MISMATCH: 400,
|
|
5371
|
+
FINGERPRINT_REFUSED: 400,
|
|
5370
5372
|
MODEL_UNAVAILABLE: 404,
|
|
5371
5373
|
UPSTREAM: 502,
|
|
5372
5374
|
TIMEOUT: 504,
|
|
@@ -5387,6 +5389,7 @@ class GatewayError extends Error {
|
|
|
5387
5389
|
provider;
|
|
5388
5390
|
upstreamStatus;
|
|
5389
5391
|
retryAfterMs;
|
|
5392
|
+
degradations;
|
|
5390
5393
|
constructor(code, message, opts) {
|
|
5391
5394
|
super(message, opts?.cause === undefined ? undefined : { cause: opts.cause });
|
|
5392
5395
|
this.name = "GatewayError";
|
|
@@ -5395,6 +5398,7 @@ class GatewayError extends Error {
|
|
|
5395
5398
|
this.provider = opts?.provider;
|
|
5396
5399
|
this.upstreamStatus = opts?.status;
|
|
5397
5400
|
this.retryAfterMs = opts?.retryAfterMs;
|
|
5401
|
+
this.degradations = [...opts?.degradations ?? []];
|
|
5398
5402
|
}
|
|
5399
5403
|
}
|
|
5400
5404
|
// packages/ir/src/logger.ts
|
|
@@ -5427,6 +5431,7 @@ var FIELD_ORDER = [
|
|
|
5427
5431
|
"rawCount",
|
|
5428
5432
|
"dailyCount",
|
|
5429
5433
|
"quotaSampleCount",
|
|
5434
|
+
"cloakedTools",
|
|
5430
5435
|
"sizeBytes",
|
|
5431
5436
|
"host",
|
|
5432
5437
|
"port",
|
|
@@ -6634,6 +6639,82 @@ function parseRecord(record) {
|
|
|
6634
6639
|
`) };
|
|
6635
6640
|
}
|
|
6636
6641
|
|
|
6642
|
+
// packages/providers/src/anthropic/cloak.ts
|
|
6643
|
+
var ALREADY_CLOAKED = /^[A-Z][A-Za-z0-9]*$/;
|
|
6644
|
+
var MCP_PREFIX = "mcp__";
|
|
6645
|
+
function isExempt(name) {
|
|
6646
|
+
return ALREADY_CLOAKED.test(name) || name.startsWith(MCP_PREFIX);
|
|
6647
|
+
}
|
|
6648
|
+
var MAX_ALIAS = 128;
|
|
6649
|
+
var SUFFIX_LENGTH = 6;
|
|
6650
|
+
function aliasFor(name) {
|
|
6651
|
+
const joined = name.split(/[^A-Za-z0-9]+/).filter((s) => s.length > 0).map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("");
|
|
6652
|
+
if (joined === "")
|
|
6653
|
+
return { base: "Tool", forced: true };
|
|
6654
|
+
if (joined.length > MAX_ALIAS) {
|
|
6655
|
+
return { base: joined.slice(0, MAX_ALIAS - SUFFIX_LENGTH), forced: true };
|
|
6656
|
+
}
|
|
6657
|
+
return { base: joined, forced: false };
|
|
6658
|
+
}
|
|
6659
|
+
function clientToolNames(request2) {
|
|
6660
|
+
const renamable = new Set;
|
|
6661
|
+
const reserved = new Set;
|
|
6662
|
+
const add = (name) => {
|
|
6663
|
+
(isExempt(name) ? reserved : renamable).add(name);
|
|
6664
|
+
};
|
|
6665
|
+
for (const tool of request2.tools ?? []) {
|
|
6666
|
+
if (tool.provider === "custom")
|
|
6667
|
+
add(tool.name);
|
|
6668
|
+
}
|
|
6669
|
+
for (const message of request2.messages) {
|
|
6670
|
+
for (const block of message.content) {
|
|
6671
|
+
if (block.type === "toolUse")
|
|
6672
|
+
add(block.name);
|
|
6673
|
+
}
|
|
6674
|
+
}
|
|
6675
|
+
if (request2.toolChoice?.type === "tool")
|
|
6676
|
+
add(request2.toolChoice.name);
|
|
6677
|
+
return { renamable: [...renamable], reserved: [...reserved] };
|
|
6678
|
+
}
|
|
6679
|
+
function suffixFor(name) {
|
|
6680
|
+
const digest = Bun.hash.xxHash64(Buffer.from(name, "utf8")) & 0xffffffn;
|
|
6681
|
+
const hex = digest.toString(16).padStart(SUFFIX_LENGTH, "0");
|
|
6682
|
+
return hex.charAt(0).toUpperCase() + hex.slice(1);
|
|
6683
|
+
}
|
|
6684
|
+
function buildToolCloak(request2) {
|
|
6685
|
+
const { renamable, reserved } = clientToolNames(request2);
|
|
6686
|
+
const claims = new Map;
|
|
6687
|
+
const claim = (name) => {
|
|
6688
|
+
claims.set(name, (claims.get(name) ?? 0) + 1);
|
|
6689
|
+
};
|
|
6690
|
+
for (const tool of request2.tools ?? []) {
|
|
6691
|
+
if (tool.provider === "anthropic" && tool.name !== "")
|
|
6692
|
+
claim(tool.name);
|
|
6693
|
+
}
|
|
6694
|
+
for (const name of reserved)
|
|
6695
|
+
claim(name);
|
|
6696
|
+
const bases = new Map;
|
|
6697
|
+
for (const name of renamable) {
|
|
6698
|
+
const derived = aliasFor(name);
|
|
6699
|
+
bases.set(name, derived);
|
|
6700
|
+
claim(derived.base);
|
|
6701
|
+
}
|
|
6702
|
+
const toWire = new Map;
|
|
6703
|
+
const fromWire = new Map;
|
|
6704
|
+
for (const [name, { base, forced }] of bases) {
|
|
6705
|
+
const alias = forced || (claims.get(base) ?? 0) > 1 ? base + suffixFor(name) : base;
|
|
6706
|
+
toWire.set(name, alias);
|
|
6707
|
+
fromWire.set(alias, name);
|
|
6708
|
+
}
|
|
6709
|
+
return toWire.size === 0 ? null : { toWire, fromWire };
|
|
6710
|
+
}
|
|
6711
|
+
function cloakName(cloak, name) {
|
|
6712
|
+
return cloak?.toWire.get(name) ?? name;
|
|
6713
|
+
}
|
|
6714
|
+
function uncloakName(cloak, name) {
|
|
6715
|
+
return cloak?.fromWire.get(name) ?? name;
|
|
6716
|
+
}
|
|
6717
|
+
|
|
6637
6718
|
// packages/providers/src/anthropic/tools.ts
|
|
6638
6719
|
var COMMON = ["cache_control", "strict", "defer_loading", "allowed_callers"];
|
|
6639
6720
|
var COMMON_WITH_EXAMPLES = [...COMMON, "input_examples"];
|
|
@@ -6884,6 +6965,14 @@ var ERROR_TYPE = {
|
|
|
6884
6965
|
invalid_request_error: "BAD_REQUEST",
|
|
6885
6966
|
api_error: "UPSTREAM"
|
|
6886
6967
|
};
|
|
6968
|
+
var FINGERPRINT_PHRASES = ["out of extra usage", "draw from extra usage"];
|
|
6969
|
+
function isFingerprintMessage(message) {
|
|
6970
|
+
const lowered = message.toLowerCase();
|
|
6971
|
+
return FINGERPRINT_PHRASES.some((phrase) => lowered.includes(phrase));
|
|
6972
|
+
}
|
|
6973
|
+
function isFingerprintRefusal(type, message) {
|
|
6974
|
+
return type === "invalid_request_error" && isFingerprintMessage(message);
|
|
6975
|
+
}
|
|
6887
6976
|
function json(data) {
|
|
6888
6977
|
try {
|
|
6889
6978
|
const v = JSON.parse(data);
|
|
@@ -6892,7 +6981,8 @@ function json(data) {
|
|
|
6892
6981
|
return null;
|
|
6893
6982
|
}
|
|
6894
6983
|
}
|
|
6895
|
-
async function* decodeAnthropic(messages) {
|
|
6984
|
+
async function* decodeAnthropic(messages, opts = {}) {
|
|
6985
|
+
const cloak = opts.cloak ?? null;
|
|
6896
6986
|
let inputTokens = 0;
|
|
6897
6987
|
let cacheReadTokens = 0;
|
|
6898
6988
|
let cacheWriteTokens = 0;
|
|
@@ -6938,7 +7028,11 @@ async function* decodeAnthropic(messages) {
|
|
|
6938
7028
|
yield {
|
|
6939
7029
|
type: "blockStart",
|
|
6940
7030
|
index,
|
|
6941
|
-
block: {
|
|
7031
|
+
block: {
|
|
7032
|
+
type: "toolUse",
|
|
7033
|
+
id: String(cb.id),
|
|
7034
|
+
name: uncloakName(cloak, String(cb.name))
|
|
7035
|
+
}
|
|
6942
7036
|
};
|
|
6943
7037
|
else if (cb.type !== undefined && ANTHROPIC_NATIVE_BLOCK_TYPES.has(cb.type)) {
|
|
6944
7038
|
nativeBlocks.add(index);
|
|
@@ -7041,13 +7135,10 @@ async function* decodeAnthropic(messages) {
|
|
|
7041
7135
|
break;
|
|
7042
7136
|
case "error": {
|
|
7043
7137
|
terminal = true;
|
|
7044
|
-
const
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
message: String(d.error?.message ?? "upstream error"),
|
|
7049
|
-
retryable: RETRYABLE[code]
|
|
7050
|
-
};
|
|
7138
|
+
const type = String(d.error?.type);
|
|
7139
|
+
const message = String(d.error?.message ?? "upstream error");
|
|
7140
|
+
const code = isFingerprintRefusal(type, message) ? "FINGERPRINT_REFUSED" : ERROR_TYPE[type] ?? "UPSTREAM";
|
|
7141
|
+
yield { type: "error", code, message, retryable: RETRYABLE[code] };
|
|
7051
7142
|
break;
|
|
7052
7143
|
}
|
|
7053
7144
|
default:
|
|
@@ -7074,7 +7165,7 @@ function wireCacheControl(c) {
|
|
|
7074
7165
|
function isReplayableThinking(b) {
|
|
7075
7166
|
return b.type !== "thinking" || b.signature !== undefined && b.signature !== "";
|
|
7076
7167
|
}
|
|
7077
|
-
function encodeBlock(b) {
|
|
7168
|
+
function encodeBlock(b, cloak) {
|
|
7078
7169
|
const cache = wireCacheControl(cacheControlOf(b));
|
|
7079
7170
|
switch (b.type) {
|
|
7080
7171
|
case "text":
|
|
@@ -7093,7 +7184,13 @@ function encodeBlock(b) {
|
|
|
7093
7184
|
case "thinking":
|
|
7094
7185
|
return { type: "thinking", thinking: b.text, signature: b.signature };
|
|
7095
7186
|
case "toolUse":
|
|
7096
|
-
return {
|
|
7187
|
+
return {
|
|
7188
|
+
type: "tool_use",
|
|
7189
|
+
id: b.id,
|
|
7190
|
+
name: cloakName(cloak, b.name),
|
|
7191
|
+
input: b.input,
|
|
7192
|
+
...cache
|
|
7193
|
+
};
|
|
7097
7194
|
case "toolResult":
|
|
7098
7195
|
return {
|
|
7099
7196
|
type: "tool_result",
|
|
@@ -7106,12 +7203,12 @@ function encodeBlock(b) {
|
|
|
7106
7203
|
return { ...b.data, type: b.blockType, ...cache };
|
|
7107
7204
|
}
|
|
7108
7205
|
}
|
|
7109
|
-
function encodeSystemTurn(content) {
|
|
7206
|
+
function encodeSystemTurn(content, cloak) {
|
|
7110
7207
|
if (content.every((block) => block.type === "text")) {
|
|
7111
7208
|
return content.map((block) => block.text).join(`
|
|
7112
7209
|
`);
|
|
7113
7210
|
}
|
|
7114
|
-
return content.map(encodeBlock);
|
|
7211
|
+
return content.map((block) => encodeBlock(block, cloak));
|
|
7115
7212
|
}
|
|
7116
7213
|
function systemCacheControl(req) {
|
|
7117
7214
|
const cacheable = req.messages.flatMap((message) => message.content.flatMap((block) => block.type === "thinking" ? [] : [{ role: message.role, block }]));
|
|
@@ -7123,7 +7220,7 @@ function systemCacheControl(req) {
|
|
|
7123
7220
|
lost: markedSystemBlocks.length > (promoted === undefined ? 0 : 1)
|
|
7124
7221
|
};
|
|
7125
7222
|
}
|
|
7126
|
-
function encodeTool(t) {
|
|
7223
|
+
function encodeTool(t, cloak) {
|
|
7127
7224
|
if (t.provider === "anthropic") {
|
|
7128
7225
|
return {
|
|
7129
7226
|
type: t.type,
|
|
@@ -7133,14 +7230,14 @@ function encodeTool(t) {
|
|
|
7133
7230
|
};
|
|
7134
7231
|
}
|
|
7135
7232
|
return {
|
|
7136
|
-
name: t.name,
|
|
7233
|
+
name: cloakName(cloak, t.name),
|
|
7137
7234
|
...t.description === undefined ? {} : { description: t.description },
|
|
7138
7235
|
input_schema: t.inputSchema,
|
|
7139
7236
|
...t.options ?? {},
|
|
7140
7237
|
...wireCacheControl(t.cacheControl)
|
|
7141
7238
|
};
|
|
7142
7239
|
}
|
|
7143
|
-
function encodeToolChoice(c) {
|
|
7240
|
+
function encodeToolChoice(c, cloak) {
|
|
7144
7241
|
switch (c.type) {
|
|
7145
7242
|
case "auto":
|
|
7146
7243
|
return { type: "auto" };
|
|
@@ -7149,7 +7246,7 @@ function encodeToolChoice(c) {
|
|
|
7149
7246
|
case "none":
|
|
7150
7247
|
return { type: "none" };
|
|
7151
7248
|
case "tool":
|
|
7152
|
-
return { type: "tool", name: c.name };
|
|
7249
|
+
return { type: "tool", name: cloakName(cloak, c.name) };
|
|
7153
7250
|
}
|
|
7154
7251
|
}
|
|
7155
7252
|
function isRecord(value) {
|
|
@@ -7191,7 +7288,59 @@ function stripUnsupportedEdits(body, note) {
|
|
|
7191
7288
|
}
|
|
7192
7289
|
body.context_management = { ...config, edits: kept };
|
|
7193
7290
|
}
|
|
7291
|
+
var AUTO_CACHE_MIN_TOKENS = 1024;
|
|
7292
|
+
function hasVendorCacheControl(req) {
|
|
7293
|
+
const anthropic2 = req.vendor?.anthropic;
|
|
7294
|
+
return typeof anthropic2 === "object" && anthropic2 !== null && "cache_control" in anthropic2;
|
|
7295
|
+
}
|
|
7296
|
+
var CACHEABLE_WIRE_BLOCKS = new Set(["text", "image", "tool_use", "tool_result", "document"]);
|
|
7297
|
+
function lastCacheableHistoryBlock(messages) {
|
|
7298
|
+
for (let m = messages.length - 1;m >= 0; m--) {
|
|
7299
|
+
const message = messages[m];
|
|
7300
|
+
if (!isRecord(message) || !Array.isArray(message.content))
|
|
7301
|
+
continue;
|
|
7302
|
+
for (let b = message.content.length - 1;b >= 0; b--) {
|
|
7303
|
+
const block = message.content[b];
|
|
7304
|
+
if (!isRecord(block))
|
|
7305
|
+
continue;
|
|
7306
|
+
if (typeof block.type === "string" && CACHEABLE_WIRE_BLOCKS.has(block.type))
|
|
7307
|
+
return block;
|
|
7308
|
+
}
|
|
7309
|
+
}
|
|
7310
|
+
return;
|
|
7311
|
+
}
|
|
7312
|
+
function addAutoCacheBreakpoints(body, req, note) {
|
|
7313
|
+
if (estimateCachedInputTokens(req) !== 0 || hasVendorCacheControl(req))
|
|
7314
|
+
return;
|
|
7315
|
+
let markedPrefix = 0;
|
|
7316
|
+
const worthAMarker = (prefix) => prefix - markedPrefix >= AUTO_CACHE_MIN_TOKENS;
|
|
7317
|
+
let stablePrefixMarked = false;
|
|
7318
|
+
const toolsPrefix = estimateInputTokens({ ...req, messages: [], system: [] });
|
|
7319
|
+
const lastTool = body.tools?.at(-1);
|
|
7320
|
+
if (lastTool !== undefined && worthAMarker(toolsPrefix)) {
|
|
7321
|
+
lastTool.cache_control = { type: "ephemeral" };
|
|
7322
|
+
markedPrefix = toolsPrefix;
|
|
7323
|
+
stablePrefixMarked = true;
|
|
7324
|
+
}
|
|
7325
|
+
const systemPrefix = estimateInputTokens({ ...req, messages: [] });
|
|
7326
|
+
const lastSystem = body.system?.at(-1);
|
|
7327
|
+
if (lastSystem !== undefined && worthAMarker(systemPrefix)) {
|
|
7328
|
+
lastSystem.cache_control = { type: "ephemeral" };
|
|
7329
|
+
markedPrefix = systemPrefix;
|
|
7330
|
+
stablePrefixMarked = true;
|
|
7331
|
+
}
|
|
7332
|
+
if (stablePrefixMarked)
|
|
7333
|
+
note("anthropic:cache-breakpoint-added");
|
|
7334
|
+
if (!worthAMarker(estimateInputTokens(req)))
|
|
7335
|
+
return;
|
|
7336
|
+
const lastHistory = lastCacheableHistoryBlock(body.messages);
|
|
7337
|
+
if (lastHistory === undefined)
|
|
7338
|
+
return;
|
|
7339
|
+
lastHistory.cache_control = { type: "ephemeral" };
|
|
7340
|
+
note("anthropic:history-cache-breakpoint-added");
|
|
7341
|
+
}
|
|
7194
7342
|
function toWire(req, model, opts) {
|
|
7343
|
+
const cloak = opts.cloak ?? null;
|
|
7195
7344
|
const degradations = [];
|
|
7196
7345
|
const note = (d) => {
|
|
7197
7346
|
if (!degradations.includes(d))
|
|
@@ -7202,6 +7351,8 @@ function toWire(req, model, opts) {
|
|
|
7202
7351
|
system = [{ type: "text", text: OAUTH_IDENTITY }, ...system ?? []];
|
|
7203
7352
|
note("anthropic:oauth-system-prefix");
|
|
7204
7353
|
}
|
|
7354
|
+
if (cloak !== null)
|
|
7355
|
+
note("anthropic:tool-names-cloaked");
|
|
7205
7356
|
const systemCache = systemCacheControl(req);
|
|
7206
7357
|
if (systemCache.lost)
|
|
7207
7358
|
note("anthropic:system-turn-cache-control-dropped");
|
|
@@ -7214,9 +7365,9 @@ function toWire(req, model, opts) {
|
|
|
7214
7365
|
note("anthropic:unsigned-thinking-dropped");
|
|
7215
7366
|
if (replayable.length === 0)
|
|
7216
7367
|
return [];
|
|
7217
|
-
return [{ role: m.role, content: replayable.map(encodeBlock) }];
|
|
7368
|
+
return [{ role: m.role, content: replayable.map((b) => encodeBlock(b, cloak)) }];
|
|
7218
7369
|
}
|
|
7219
|
-
return [{ role: m.role, content: encodeSystemTurn(m.content) }];
|
|
7370
|
+
return [{ role: m.role, content: encodeSystemTurn(m.content, cloak) }];
|
|
7220
7371
|
}),
|
|
7221
7372
|
max_tokens: req.maxTokens ?? 4096,
|
|
7222
7373
|
stream: req.stream,
|
|
@@ -7234,9 +7385,11 @@ function toWire(req, model, opts) {
|
|
|
7234
7385
|
if (req.stopSequences !== undefined)
|
|
7235
7386
|
body.stop_sequences = req.stopSequences;
|
|
7236
7387
|
if (req.tools !== undefined)
|
|
7237
|
-
body.tools = req.tools.map(encodeTool);
|
|
7388
|
+
body.tools = req.tools.map((t) => encodeTool(t, cloak));
|
|
7238
7389
|
if (req.toolChoice !== undefined)
|
|
7239
|
-
body.tool_choice = encodeToolChoice(req.toolChoice);
|
|
7390
|
+
body.tool_choice = encodeToolChoice(req.toolChoice, cloak);
|
|
7391
|
+
if (opts.autoCache === true)
|
|
7392
|
+
addAutoCacheBreakpoints(body, req, note);
|
|
7240
7393
|
if (req.reasoning !== undefined) {
|
|
7241
7394
|
switch (req.reasoning.mode) {
|
|
7242
7395
|
case "adaptive":
|
|
@@ -7279,7 +7432,12 @@ var anthropicAdapter = {
|
|
|
7279
7432
|
capabilities: PROVIDER_CAPABILITIES.anthropic,
|
|
7280
7433
|
async send(req) {
|
|
7281
7434
|
const oauth = req.credentials.accessToken !== null;
|
|
7282
|
-
const
|
|
7435
|
+
const cloak = oauth ? buildToolCloak(req.request) : null;
|
|
7436
|
+
const { body, degradations } = toWire(req.request, req.model, {
|
|
7437
|
+
oauth,
|
|
7438
|
+
cloak,
|
|
7439
|
+
autoCache: req.autoCache === true
|
|
7440
|
+
});
|
|
7283
7441
|
const withSystem = {
|
|
7284
7442
|
...body,
|
|
7285
7443
|
system: applyAnthropicSystem(body.system ?? []),
|
|
@@ -7323,11 +7481,25 @@ var anthropicAdapter = {
|
|
|
7323
7481
|
body: bodyString,
|
|
7324
7482
|
signal: req.signal
|
|
7325
7483
|
});
|
|
7326
|
-
if (res.status < 200 || res.status >= 300)
|
|
7327
|
-
|
|
7484
|
+
if (res.status < 200 || res.status >= 300) {
|
|
7485
|
+
const error = await httpError(res, "anthropic");
|
|
7486
|
+
if (res.status === 400 && isFingerprintMessage(error.message)) {
|
|
7487
|
+
throw new GatewayError("FINGERPRINT_REFUSED", error.message, {
|
|
7488
|
+
provider: "anthropic",
|
|
7489
|
+
degradations: notes,
|
|
7490
|
+
...error.upstreamStatus === undefined ? {} : { status: error.upstreamStatus },
|
|
7491
|
+
...error.retryAfterMs === undefined ? {} : { retryAfterMs: error.retryAfterMs }
|
|
7492
|
+
});
|
|
7493
|
+
}
|
|
7494
|
+
throw error;
|
|
7495
|
+
}
|
|
7328
7496
|
if (res.body === null)
|
|
7329
7497
|
throw new GatewayError("UPSTREAM", "empty response body", { provider: "anthropic" });
|
|
7330
|
-
return {
|
|
7498
|
+
return {
|
|
7499
|
+
events: decodeAnthropic(parseSse(res.body), { cloak }),
|
|
7500
|
+
degradations: notes,
|
|
7501
|
+
...cloak === null ? {} : { cloakedTools: cloak.toWire.size }
|
|
7502
|
+
};
|
|
7331
7503
|
}
|
|
7332
7504
|
};
|
|
7333
7505
|
// packages/providers/src/kimi/decode.ts
|
|
@@ -23367,6 +23539,7 @@ var settingsSchema = exports_external.object({
|
|
|
23367
23539
|
logRetentionDays: exports_external.number().int().min(1),
|
|
23368
23540
|
quotaPollIntervalMs: exports_external.number().int().min(0),
|
|
23369
23541
|
rtkEnabled: exports_external.boolean(),
|
|
23542
|
+
autoCacheEnabled: exports_external.boolean(),
|
|
23370
23543
|
bodyLoggingEnabled: exports_external.boolean(),
|
|
23371
23544
|
bodyLoggingCaptureStreamChunks: exports_external.boolean(),
|
|
23372
23545
|
snapshotKeepLatest: retentionSchema.shape.keepLatest.optional(),
|
|
@@ -23583,6 +23756,7 @@ var DEFAULT_SETTINGS = {
|
|
|
23583
23756
|
logRetentionDays: 30,
|
|
23584
23757
|
quotaPollIntervalMs: 300000,
|
|
23585
23758
|
rtkEnabled: false,
|
|
23759
|
+
autoCacheEnabled: true,
|
|
23586
23760
|
bodyLoggingEnabled: false,
|
|
23587
23761
|
bodyLoggingCaptureStreamChunks: false,
|
|
23588
23762
|
snapshotKeepLatest: 5,
|
|
@@ -23688,6 +23862,7 @@ var PENALTY = {
|
|
|
23688
23862
|
CONFLICT: "none",
|
|
23689
23863
|
CONTENT_FILTER: "none",
|
|
23690
23864
|
CAPABILITY_MISMATCH: "none",
|
|
23865
|
+
FINGERPRINT_REFUSED: "none",
|
|
23691
23866
|
NO_CANDIDATES: "none",
|
|
23692
23867
|
ALL_CANDIDATES_FAILED: "none",
|
|
23693
23868
|
INTERNAL: "none"
|
|
@@ -24294,6 +24469,7 @@ function createConfigRepo(db, emit = () => {}) {
|
|
|
24294
24469
|
...DEFAULT_SETTINGS,
|
|
24295
24470
|
...stored,
|
|
24296
24471
|
rtkEnabled: stored.rtkEnabled === true,
|
|
24472
|
+
autoCacheEnabled: stored.autoCacheEnabled === undefined ? true : stored.autoCacheEnabled === true,
|
|
24297
24473
|
bodyLoggingEnabled: stored.bodyLoggingEnabled === true,
|
|
24298
24474
|
bodyLoggingCaptureStreamChunks: stored.bodyLoggingCaptureStreamChunks === true,
|
|
24299
24475
|
weights: knownWeights(stored.weights)
|
|
@@ -43085,6 +43261,7 @@ var ERROR_TYPE2 = {
|
|
|
43085
43261
|
CONFLICT: "invalid_request_error",
|
|
43086
43262
|
CONTENT_FILTER: "invalid_request_error",
|
|
43087
43263
|
CAPABILITY_MISMATCH: "invalid_request_error",
|
|
43264
|
+
FINGERPRINT_REFUSED: "invalid_request_error",
|
|
43088
43265
|
MODEL_UNAVAILABLE: "not_found_error",
|
|
43089
43266
|
UPSTREAM: "api_error",
|
|
43090
43267
|
TIMEOUT: "api_error",
|
|
@@ -43264,6 +43441,7 @@ var ERROR_TYPE3 = {
|
|
|
43264
43441
|
CONFLICT: { type: "invalid_request_error", code: "conflict" },
|
|
43265
43442
|
CONTENT_FILTER: { type: "invalid_request_error", code: "content_policy_violation" },
|
|
43266
43443
|
CAPABILITY_MISMATCH: { type: "invalid_request_error", code: "invalid_request" },
|
|
43444
|
+
FINGERPRINT_REFUSED: { type: "invalid_request_error", code: "invalid_request" },
|
|
43267
43445
|
MODEL_UNAVAILABLE: { type: "invalid_request_error", code: "model_not_found" },
|
|
43268
43446
|
UPSTREAM: { type: "server_error", code: "server_error" },
|
|
43269
43447
|
TIMEOUT: { type: "server_error", code: "timeout" },
|
|
@@ -46250,7 +46428,8 @@ async function attempt(opts) {
|
|
|
46250
46428
|
},
|
|
46251
46429
|
http,
|
|
46252
46430
|
signal,
|
|
46253
|
-
...opts.requestId === undefined ? {} : { requestId: opts.requestId }
|
|
46431
|
+
...opts.requestId === undefined ? {} : { requestId: opts.requestId },
|
|
46432
|
+
...opts.autoCache === undefined ? {} : { autoCache: opts.autoCache }
|
|
46254
46433
|
});
|
|
46255
46434
|
}
|
|
46256
46435
|
|
|
@@ -46333,6 +46512,12 @@ async function dispatch(request2, deps, signal, requestId) {
|
|
|
46333
46512
|
const reject = (error51) => {
|
|
46334
46513
|
reportRejection(logger2, requestId, log, error51);
|
|
46335
46514
|
};
|
|
46515
|
+
const noteDegradations = (entries) => {
|
|
46516
|
+
for (const d of entries) {
|
|
46517
|
+
if (!log.degradations.includes(d))
|
|
46518
|
+
log.degradations.push(d);
|
|
46519
|
+
}
|
|
46520
|
+
};
|
|
46336
46521
|
const isClientAbort = (error51) => signal.aborted && error51 === signal.reason;
|
|
46337
46522
|
const rewrap = (classified, message) => new GatewayError(classified.code, message, {
|
|
46338
46523
|
...classified.retryAfterMs === undefined ? {} : { retryAfterMs: classified.retryAfterMs },
|
|
@@ -46501,10 +46686,19 @@ async function dispatch(request2, deps, signal, requestId) {
|
|
|
46501
46686
|
refreshLeadMs: DISPATCH_REFRESH_LEAD_MS,
|
|
46502
46687
|
...retrySecrets === undefined ? {} : { secrets: retrySecrets },
|
|
46503
46688
|
logger: logger2,
|
|
46504
|
-
requestId
|
|
46689
|
+
requestId,
|
|
46690
|
+
autoCache: snapshot.settings.autoCacheEnabled
|
|
46505
46691
|
}), dispatchSignal);
|
|
46506
|
-
|
|
46507
|
-
|
|
46692
|
+
noteDegradations(result.degradations);
|
|
46693
|
+
if (result.cloakedTools !== undefined) {
|
|
46694
|
+
logger2.debug("tool names cloaked", {
|
|
46695
|
+
requestId,
|
|
46696
|
+
provider: candidate.target.provider,
|
|
46697
|
+
credentialId: candidate.credential.id,
|
|
46698
|
+
attempt: i + 1,
|
|
46699
|
+
cloakedTools: result.cloakedTools
|
|
46700
|
+
});
|
|
46701
|
+
}
|
|
46508
46702
|
let terminal = false;
|
|
46509
46703
|
const pending = [];
|
|
46510
46704
|
for await (const event of result.events) {
|
|
@@ -46593,6 +46787,8 @@ async function dispatch(request2, deps, signal, requestId) {
|
|
|
46593
46787
|
const { code: code2 } = classifiedError;
|
|
46594
46788
|
const message2 = describeError(error51, "attempt failed");
|
|
46595
46789
|
lastError = rewrap(classifiedError, message2);
|
|
46790
|
+
if (error51 instanceof GatewayError)
|
|
46791
|
+
noteDegradations(error51.degradations);
|
|
46596
46792
|
if (code2 === "AUTH" && !committed && !authRefreshRetried && !preemptiveRefreshRequired && candidate.credential.authType === "oauth" && candidate.credential.hasRefreshToken) {
|
|
46597
46793
|
authRefreshRetried = true;
|
|
46598
46794
|
logger2.warn("attempt authentication failed; refreshing credential", {
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{at as e,ut as t}from"./queries-CX9mStps.js";import{g as n}from"./Rack-
|
|
1
|
+
import{at as e,ut as t}from"./queries-CX9mStps.js";import{g as n}from"./Rack-fDZClWZL.js";import{useCallback as r,useEffect as i,useRef as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import l from"styled-components";var u=n(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),d=n(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),f=n(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),p=n(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]);function m(e){if(e===null||typeof getSelection!=`function`)return!1;let t=getSelection();if(t===null)return!1;try{let n=document.createRange();return n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n),!0}catch{return!1}}async function h(e,t){if(typeof navigator<`u`&&navigator.clipboard!==void 0)try{return await navigator.clipboard.writeText(e),`copied`}catch{}let n=m(t??null);if(n&&typeof document.execCommand==`function`)try{if(document.execCommand(`copy`))return`copied`}catch{}return n?`selected`:`failed`}var g=l.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: stretch;
|
|
4
4
|
gap: 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,D as t,E as n,M as r,V as i,at as a,ct as o,dt as s,et as c,ft as l,it as u,k as d,lt as f,nt as p,st as m,ut as h,w as g}from"./queries-CX9mStps.js";import{t as _}from"./index-CJZIRJ43.js";import{A as v,N as y,a as ee,i as b,j as x,s as te,x as ne}from"./States-DtkkMzEu.js";import*as S from"react";import{createContext as C,createElement as w,forwardRef as re,useContext as ie,useEffect as ae,useId as oe,useMemo as se,useState as T}from"react";import{Fragment as ce,jsx as E,jsxs as D}from"react/jsx-runtime";import*as le from"react-dom";import O,{css as ue}from"styled-components";import{LiveProvider as de,useLive as fe}from"@omnigateway/dashboard-sdk";var pe=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),me=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),he=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ge=e=>{let t=he(e);return t.charAt(0).toUpperCase()+t.slice(1)},_e={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`},ve=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ye=C({}),be=()=>ie(ye),xe=re(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=be()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return w(`svg`,{ref:c,..._e,width:t??l??_e.width,height:t??l??_e.height,stroke:e??f,strokeWidth:m,className:pe(`lucide`,p,i),...!a&&!ve(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>w(e,t)),...Array.isArray(a)?a:[a]])}),k=(e,t)=>{let n=re(({className:n,...r},i)=>w(xe,{ref:i,iconNode:t,className:pe(`lucide-${me(ge(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ge(e),n},Se=k(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ce=k(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),we=k(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Te=k(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),Ee=k(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),De=k(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Oe=k(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),ke=k(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Ae=k(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),je=k(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Me=k(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ne=k(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Pe=k(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Fe=k(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Ie=k(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Le=k(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Re=k(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ze=Object.defineProperty,Be=(e,t)=>ze(e,`name`,{value:t,configurable:!0});function Ve(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Be(Ve,`setRef`);function He(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ve(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Ve(e[t],null)}}}}Be(He,`composeRefs`);function A(...e){return S.useCallback(He(...e),e)}Be(A,`useComposedRefs`);var Ue=Object.defineProperty,j=(e,t)=>Ue(e,`name`,{value:t,configurable:!0});function We(e){let t=S.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Qe(r)&&typeof nt==`function`&&(r=nt(r._payload)),S.Children.forEach(r,e=>{if(Xe(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Qe(n)&&typeof nt==`function`&&(n=nt(n._payload)),a=qe(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=S.cloneElement(a,void 0,s):!o&&S.Children.count(r)===1&&S.isValidElement(r)&&(a=r);let c=a?Ye(a):void 0,l=A(n,c);if(!a){if(r||r===0)throw Error(o?tt(e):et(e));return r}let u=Je(i,a.props??{});return a.type!==S.Fragment&&(u.ref=n?l:c),S.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}j(We,`createSlot`);var Ge=Symbol.for(`radix.slottable`);function Ke(e){let t=j(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Ge,t}j(Ke,`createSlottable`);var qe=j((e,t)=>{if(`child`in e.props){let t=e.props.child;return S.isValidElement(t)?S.cloneElement(t,void 0,e.props.children(t.props.children)):null}return S.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Je(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}j(Je,`mergeProps`);function Ye(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}j(Ye,`getElementRef`);function Xe(e){return S.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ge}j(Xe,`isSlottable`);var Ze=Symbol.for(`react.lazy`);function Qe(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Ze&&`_payload`in e&&$e(e._payload)}j(Qe,`isLazyComponent`);function $e(e){return typeof e==`object`&&!!e&&`then`in e}j($e,`isPromiseLike`);var et=j(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),tt=j(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),nt=S.use,rt=Object.defineProperty,it=(e,t)=>rt(e,`name`,{value:t,configurable:!0}),M=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=We(`Primitive.${t}`),r=S.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),E(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function at(e,t){e&&le.flushSync(()=>e.dispatchEvent(t))}it(at,`dispatchDiscreteCustomEvent`);var ot=Object.defineProperty,N=(e,t)=>ot(e,`name`,{value:t,configurable:!0});function st(e,t){let n=S.createContext(t);n.displayName=e+`Context`;let r=N(e=>{let{children:t,...r}=e,i=S.useMemo(()=>r,Object.values(r));return E(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=S.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return N(i,`useContext`),[r,i]}N(st,`createContext`);function ct(e,t=[]){let n=[];function r(t,r){let i=S.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=N(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=S.useMemo(()=>o,Object.values(o));return E(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=S.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return N(s,`useContext`),[o,s]}N(r,`createContext`);let i=N(()=>{let t=n.map(e=>S.createContext(e));return N(function(n){let r=n?.[e]||t;return S.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,lt(i,...t)]}N(ct,`createContextScope`);function lt(...e){let t=e[0];if(e.length===1)return t;let n=N(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return N(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}N(lt,`composeContextScopes`);var ut=Object.defineProperty,P=(e,t)=>ut(e,`name`,{value:t,configurable:!0}),dt=!!(typeof window<`u`&&window.document&&window.document.createElement);function F(e,t,{checkForDefaultPrevented:n=!0}={}){return P(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}P(F,`composeEventHandlers`);function ft(e){if(!dt)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}P(ft,`getOwnerWindow`);function pt(e){if(!dt)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}P(pt,`getOwnerDocument`);function mt(e,t=!1){let{activeElement:n}=pt(e);if(!n?.nodeName)return null;if(ht(n)&&n.contentDocument)return mt(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=pt(n).getElementById(e);if(t)return t}}return n}P(mt,`getActiveElement`);function ht(e){return e.tagName===`IFRAME`}P(ht,`isFrame`);var I=globalThis?.document?S.useLayoutEffect:()=>{},gt=Object.defineProperty,_t=(e,t)=>gt(e,`name`,{value:t,configurable:!0}),vt=S.useEffectEvent,yt=S.useInsertionEffect;function bt(e){if(typeof vt==`function`)return vt(e);let t=S.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof yt==`function`?yt(()=>{t.current=e}):I(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}_t(bt,`useEffectEvent`);var xt=Object.defineProperty,L=(e,t)=>xt(e,`name`,{value:t,configurable:!0}),St=S.useInsertionEffect||I;function Ct({prop:e,defaultProp:t,onChange:n=L(()=>{},`onChange`),caller:r}){let[i,a,o]=wt({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,S.useCallback(t=>{if(s){let n=Tt(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}L(Ct,`useControllableState`);function wt({defaultProp:e,onChange:t}){let[n,r]=S.useState(e),i=S.useRef(n),a=S.useRef(t);return St(()=>{a.current=t},[t]),S.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}L(wt,`useUncontrolledState`);function Tt(e){return typeof e==`function`}L(Tt,`isFunction`);var Et=Symbol(`RADIX:SYNC_STATE`);function Dt(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=bt(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=S.useReducer((t,n)=>{if(n.type===Et)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=S.useRef(p);S.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=S.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return S.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Et,state:i})},[i,d.state,c]),[h,f]}L(Dt,`useControllableStateReducer`);var Ot=Object.defineProperty,R=(e,t)=>Ot(e,`name`,{value:t,configurable:!0});function kt(e,t){return S.useReducer((e,n)=>t[e][n]??e,e)}R(kt,`useStateMachine`);var At=R(e=>{let{present:t,children:n}=e,r=jt(t),i=typeof n==`function`?n({present:r.isPresent}):S.Children.only(n),a=Nt(r.ref,Pt(i));return typeof n==`function`||r.isPresent?S.cloneElement(i,{ref:a}):null},`Presence`);function jt(e){let[t,n]=S.useState(),r=S.useRef(null),i=S.useRef(e),a=S.useRef(`none`),o=S.useRef(void 0),[s,c]=kt(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return S.useEffect(()=>{s===`mounted`?(a.current=o.current??z(r.current),o.current=void 0):a.current=`none`},[s]),I(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=z(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),I(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=R(a=>{let o=z(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=R(e=>{e.target===t&&(a.current=z(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:S.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=z(t)}else r.current=null;n(e)},[])}}R(jt,`usePresence`);function Mt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}R(Mt,`setRef`);function Nt(...e){let t=S.useRef(e);return t.current=e,S.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Mt(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Mt(n[e],null)}}},[])}R(Nt,`useStableComposedRefs`);function z(e){return e?.animationName||`none`}R(z,`getAnimationName`);function Pt(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}R(Pt,`getElementRef`);var Ft=Object.defineProperty,It=(e,t)=>Ft(e,`name`,{value:t,configurable:!0}),Lt=S.useId||(()=>void 0),Rt=0;function zt(e){let[t,n]=S.useState(Lt());return I(()=>{e||n(e=>e??String(Rt++))},[e]),e||(t?`radix-${t}`:``)}It(zt,`useId`);var Bt=Object.defineProperty,Vt=(e,t)=>Bt(e,`name`,{value:t,configurable:!0});function B(e){let t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}Vt(B,`useCallbackRef`);var Ht=Object.defineProperty,V=(e,t)=>Ht(e,`name`,{value:t,configurable:!0}),Ut=`dismissableLayer.update`,Wt=`dismissableLayer.pointerDownOutside`,Gt=`dismissableLayer.focusOutside`,Kt,qt=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Jt=S.forwardRef(V(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=S.useContext(qt),[d,f]=S.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=S.useState({}),h=A(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,ee=u.layersWithOutsidePointerEventsDisabled.size>0,b=y>=v,x=S.useRef(!1),te=Zt(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:x,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return b&&!t},[u.branches,b])}),ne=Qt(e=>{if(r&&x.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),C=d?y===g.length-1:!1,w=B(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return S.useEffect(()=>{if(C)return p.addEventListener(`keydown`,w,{capture:!0}),()=>p.removeEventListener(`keydown`,w,{capture:!0})},[p,C,w]),S.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Kt=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),$t(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Kt))}},[d,p,n,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),$t())},[d,u]),S.useEffect(()=>{let e=V(()=>m({}),`handleUpdate`);return document.addEventListener(Ut,e),()=>document.removeEventListener(Ut,e)},[]),E(M.div,{...l,ref:h,style:{pointerEvents:ee?b?`auto`:`none`:void 0,...e.style},onFocusCapture:F(e.onFocusCapture,ne.onFocusCapture),onBlurCapture:F(e.onBlurCapture,ne.onBlurCapture),onPointerDownCapture:F(e.onPointerDownCapture,te.onPointerDownCapture)})},`DismissableLayer`));function Yt(){let e=S.useContext(qt),[t,n]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}V(Yt,`useDismissableLayerSurface`);var Xt=V(()=>!0,`IS_TRUE`);function Zt(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Xt}=t,s=B(e),c=S.useRef(!1),l=S.useRef(!1),u=S.useRef(new Map),d=S.useRef(()=>{});return S.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}V(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}V(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}V(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}V(p,`handleInteractionBubble`);let m=V(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||en(Wt,s,p,{discrete:!0})};if(V(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:V(()=>c.current=!0,`onPointerDownCapture`)}}V(Zt,`usePointerDownOutside`);function Qt(e,t=globalThis?.document){let n=B(e),r=S.useRef(!1);return S.useEffect(()=>{let e=V(e=>{e.target&&!r.current&&en(Gt,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:V(()=>r.current=!0,`onFocusCapture`),onBlurCapture:V(()=>r.current=!1,`onBlurCapture`)}}V(Qt,`useFocusOutside`);function $t(){let e=new CustomEvent(Ut);document.dispatchEvent(e)}V($t,`dispatchUpdate`);function en(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?at(i,a):i.dispatchEvent(a)}V(en,`handleAndDispatchCustomEvent`);var tn=Object.defineProperty,H=(e,t)=>tn(e,`name`,{value:t,configurable:!0}),nn=`focusScope.autoFocusOnMount`,rn=`focusScope.autoFocusOnUnmount`,an={bubbles:!1,cancelable:!0},on=S.forwardRef(H(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=S.useState(null),l=B(i),u=B(a),d=S.useRef(null),f=A(t,c),p=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:U(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||U(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&U(s)};H(e,`handleFocusIn`),H(t,`handleFocusOut`),H(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),S.useEffect(()=>{if(s){pn.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(nn,an);s.addEventListener(nn,l),s.dispatchEvent(t),t.defaultPrevented||(sn(gn(ln(s)),{select:!0}),document.activeElement===e&&U(s))}return()=>{s.removeEventListener(nn,l),setTimeout(()=>{let t=new CustomEvent(rn,an);s.addEventListener(rn,u),s.dispatchEvent(t),t.defaultPrevented||U(e??document.body,{select:!0}),s.removeEventListener(rn,u),pn.remove(p)},0)}}},[s,l,u,p]);let m=S.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=cn(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&U(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&U(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return E(M.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function sn(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(U(r,{select:t}),document.activeElement!==n)return}H(sn,`focusFirst`);function cn(e){let t=ln(e);return[un(t,e),un(t.reverse(),e)]}H(cn,`getTabbableEdges`);function ln(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:H(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}H(ln,`getTabbableCandidates`);function un(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):dn(r,{upTo:t})))return r}H(un,`findVisible`);function dn(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}H(dn,`isHidden`);function fn(e){return e instanceof HTMLInputElement&&`select`in e}H(fn,`isSelectableInput`);function U(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fn(e)&&t&&e.select()}}H(U,`focus`);var pn=mn();function mn(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=hn(e,t),e.unshift(t)},remove(t){e=hn(e,t),e[0]?.resume()}}}H(mn,`createFocusScopesStack`);function hn(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}H(hn,`arrayRemove`);function gn(e){return e.filter(e=>e.tagName!==`A`)}H(gn,`removeLinks`);var _n=Object.defineProperty,vn=S.forwardRef(((e,t)=>_n(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=S.useState(!1);I(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?le.createPortal(E(M.div,{...r,ref:t}),o):null},`Portal`)),yn=Object.defineProperty,bn=(e,t)=>yn(e,`name`,{value:t,configurable:!0}),xn=0,W=null;function Sn(e){return Cn(),e.children}bn(Sn,`FocusGuards`);function Cn(){S.useEffect(()=>{W||={start:wn(),end:wn()};let{start:e,end:t}=W;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),xn++,()=>{xn===1&&(W?.start.remove(),W?.end.remove(),W=null),xn=Math.max(0,xn-1)}},[])}bn(Cn,`useFocusGuards`);function wn(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}bn(wn,`createFocusGuard`);var G=function(){return G=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},G.apply(this,arguments)};function Tn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function En(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Dn=`right-scroll-bar-position`,On=`width-before-scroll-bar`,kn=`with-scroll-bars-hidden`,An=`--removed-body-scroll-bar-size`;function jn(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Mn(e,t){var n=T(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Nn=typeof window<`u`?S.useLayoutEffect:S.useEffect,Pn=new WeakMap;function Fn(e,t){var n=Mn(t||null,function(t){return e.forEach(function(e){return jn(e,t)})});return Nn(function(){var t=Pn.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||jn(e,null)}),i.forEach(function(e){r.has(e)||jn(e,a)})}Pn.set(n,e)},[e]),n}function In(e){return e}function Ln(e,t){t===void 0&&(t=In);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Rn(e){e===void 0&&(e={});var t=Ln(null);return t.options=G({async:!0,ssr:!1},e),t}var zn=function(e){var t=e.sideCar,n=Tn(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return S.createElement(r,G({},n))};zn.isSideCarExport=!0;function Bn(e,t){return e.useMedium(t),zn}var Vn=Rn(),Hn=function(){},Un=S.forwardRef(function(e,t){var n=S.useRef(null),r=S.useState({onScrollCapture:Hn,onWheelCapture:Hn,onTouchMoveCapture:Hn}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,ee=Tn(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),b=f,x=Fn([n,t]),te=G(G({},ee),i);return S.createElement(S.Fragment,null,u&&S.createElement(b,{sideCar:Vn,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?S.cloneElement(S.Children.only(s),G(G({},te),{ref:x})):S.createElement(v,G({},te,{className:c,ref:x}),s))});Un.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Un.classNames={fullWidth:On,zeroRight:Dn};var Wn,Gn=function(){if(Wn)return Wn;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Kn(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Gn();return t&&e.setAttribute(`nonce`,t),e}function qn(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Jn(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Yn=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Kn())&&(qn(t,n),Jn(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xn=function(){var e=Yn();return function(t,n){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Zn=function(){var e=Xn();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Qn={left:0,top:0,right:0,gap:0},$n=function(e){return parseInt(e||``,10)||0},er=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[$n(n),$n(r),$n(i)]},tr=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Qn;var t=er(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},nr=Zn(),K=`data-scroll-locked`,rr=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
1
|
+
import{$ as e,D as t,E as n,M as r,V as i,at as a,ct as o,dt as s,et as c,ft as l,it as u,k as d,lt as f,nt as p,st as m,ut as h,w as g}from"./queries-CX9mStps.js";import{t as _}from"./index-COwhxKU7.js";import{A as v,N as y,a as ee,i as b,j as x,s as te,x as ne}from"./States-DtkkMzEu.js";import*as S from"react";import{createContext as C,createElement as w,forwardRef as re,useContext as ie,useEffect as ae,useId as oe,useMemo as se,useState as T}from"react";import{Fragment as ce,jsx as E,jsxs as D}from"react/jsx-runtime";import*as le from"react-dom";import O,{css as ue}from"styled-components";import{LiveProvider as de,useLive as fe}from"@omnigateway/dashboard-sdk";var pe=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),me=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),he=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ge=e=>{let t=he(e);return t.charAt(0).toUpperCase()+t.slice(1)},_e={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`},ve=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ye=C({}),be=()=>ie(ye),xe=re(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=be()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return w(`svg`,{ref:c,..._e,width:t??l??_e.width,height:t??l??_e.height,stroke:e??f,strokeWidth:m,className:pe(`lucide`,p,i),...!a&&!ve(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>w(e,t)),...Array.isArray(a)?a:[a]])}),k=(e,t)=>{let n=re(({className:n,...r},i)=>w(xe,{ref:i,iconNode:t,className:pe(`lucide-${me(ge(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ge(e),n},Se=k(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ce=k(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),we=k(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Te=k(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),Ee=k(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),De=k(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Oe=k(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),ke=k(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Ae=k(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),je=k(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Me=k(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ne=k(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Pe=k(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Fe=k(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Ie=k(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Le=k(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Re=k(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ze=Object.defineProperty,Be=(e,t)=>ze(e,`name`,{value:t,configurable:!0});function Ve(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Be(Ve,`setRef`);function He(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ve(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Ve(e[t],null)}}}}Be(He,`composeRefs`);function A(...e){return S.useCallback(He(...e),e)}Be(A,`useComposedRefs`);var Ue=Object.defineProperty,j=(e,t)=>Ue(e,`name`,{value:t,configurable:!0});function We(e){let t=S.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Qe(r)&&typeof nt==`function`&&(r=nt(r._payload)),S.Children.forEach(r,e=>{if(Xe(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Qe(n)&&typeof nt==`function`&&(n=nt(n._payload)),a=qe(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=S.cloneElement(a,void 0,s):!o&&S.Children.count(r)===1&&S.isValidElement(r)&&(a=r);let c=a?Ye(a):void 0,l=A(n,c);if(!a){if(r||r===0)throw Error(o?tt(e):et(e));return r}let u=Je(i,a.props??{});return a.type!==S.Fragment&&(u.ref=n?l:c),S.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}j(We,`createSlot`);var Ge=Symbol.for(`radix.slottable`);function Ke(e){let t=j(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Ge,t}j(Ke,`createSlottable`);var qe=j((e,t)=>{if(`child`in e.props){let t=e.props.child;return S.isValidElement(t)?S.cloneElement(t,void 0,e.props.children(t.props.children)):null}return S.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Je(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}j(Je,`mergeProps`);function Ye(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}j(Ye,`getElementRef`);function Xe(e){return S.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ge}j(Xe,`isSlottable`);var Ze=Symbol.for(`react.lazy`);function Qe(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Ze&&`_payload`in e&&$e(e._payload)}j(Qe,`isLazyComponent`);function $e(e){return typeof e==`object`&&!!e&&`then`in e}j($e,`isPromiseLike`);var et=j(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),tt=j(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),nt=S.use,rt=Object.defineProperty,it=(e,t)=>rt(e,`name`,{value:t,configurable:!0}),M=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=We(`Primitive.${t}`),r=S.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),E(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function at(e,t){e&&le.flushSync(()=>e.dispatchEvent(t))}it(at,`dispatchDiscreteCustomEvent`);var ot=Object.defineProperty,N=(e,t)=>ot(e,`name`,{value:t,configurable:!0});function st(e,t){let n=S.createContext(t);n.displayName=e+`Context`;let r=N(e=>{let{children:t,...r}=e,i=S.useMemo(()=>r,Object.values(r));return E(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=S.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return N(i,`useContext`),[r,i]}N(st,`createContext`);function ct(e,t=[]){let n=[];function r(t,r){let i=S.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=N(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=S.useMemo(()=>o,Object.values(o));return E(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=S.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return N(s,`useContext`),[o,s]}N(r,`createContext`);let i=N(()=>{let t=n.map(e=>S.createContext(e));return N(function(n){let r=n?.[e]||t;return S.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,lt(i,...t)]}N(ct,`createContextScope`);function lt(...e){let t=e[0];if(e.length===1)return t;let n=N(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return N(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}N(lt,`composeContextScopes`);var ut=Object.defineProperty,P=(e,t)=>ut(e,`name`,{value:t,configurable:!0}),dt=!!(typeof window<`u`&&window.document&&window.document.createElement);function F(e,t,{checkForDefaultPrevented:n=!0}={}){return P(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}P(F,`composeEventHandlers`);function ft(e){if(!dt)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}P(ft,`getOwnerWindow`);function pt(e){if(!dt)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}P(pt,`getOwnerDocument`);function mt(e,t=!1){let{activeElement:n}=pt(e);if(!n?.nodeName)return null;if(ht(n)&&n.contentDocument)return mt(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=pt(n).getElementById(e);if(t)return t}}return n}P(mt,`getActiveElement`);function ht(e){return e.tagName===`IFRAME`}P(ht,`isFrame`);var I=globalThis?.document?S.useLayoutEffect:()=>{},gt=Object.defineProperty,_t=(e,t)=>gt(e,`name`,{value:t,configurable:!0}),vt=S.useEffectEvent,yt=S.useInsertionEffect;function bt(e){if(typeof vt==`function`)return vt(e);let t=S.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof yt==`function`?yt(()=>{t.current=e}):I(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}_t(bt,`useEffectEvent`);var xt=Object.defineProperty,L=(e,t)=>xt(e,`name`,{value:t,configurable:!0}),St=S.useInsertionEffect||I;function Ct({prop:e,defaultProp:t,onChange:n=L(()=>{},`onChange`),caller:r}){let[i,a,o]=wt({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,S.useCallback(t=>{if(s){let n=Tt(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}L(Ct,`useControllableState`);function wt({defaultProp:e,onChange:t}){let[n,r]=S.useState(e),i=S.useRef(n),a=S.useRef(t);return St(()=>{a.current=t},[t]),S.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}L(wt,`useUncontrolledState`);function Tt(e){return typeof e==`function`}L(Tt,`isFunction`);var Et=Symbol(`RADIX:SYNC_STATE`);function Dt(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=bt(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=S.useReducer((t,n)=>{if(n.type===Et)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=S.useRef(p);S.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=S.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return S.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Et,state:i})},[i,d.state,c]),[h,f]}L(Dt,`useControllableStateReducer`);var Ot=Object.defineProperty,R=(e,t)=>Ot(e,`name`,{value:t,configurable:!0});function kt(e,t){return S.useReducer((e,n)=>t[e][n]??e,e)}R(kt,`useStateMachine`);var At=R(e=>{let{present:t,children:n}=e,r=jt(t),i=typeof n==`function`?n({present:r.isPresent}):S.Children.only(n),a=Nt(r.ref,Pt(i));return typeof n==`function`||r.isPresent?S.cloneElement(i,{ref:a}):null},`Presence`);function jt(e){let[t,n]=S.useState(),r=S.useRef(null),i=S.useRef(e),a=S.useRef(`none`),o=S.useRef(void 0),[s,c]=kt(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return S.useEffect(()=>{s===`mounted`?(a.current=o.current??z(r.current),o.current=void 0):a.current=`none`},[s]),I(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=z(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),I(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=R(a=>{let o=z(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=R(e=>{e.target===t&&(a.current=z(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:S.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=z(t)}else r.current=null;n(e)},[])}}R(jt,`usePresence`);function Mt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}R(Mt,`setRef`);function Nt(...e){let t=S.useRef(e);return t.current=e,S.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Mt(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Mt(n[e],null)}}},[])}R(Nt,`useStableComposedRefs`);function z(e){return e?.animationName||`none`}R(z,`getAnimationName`);function Pt(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}R(Pt,`getElementRef`);var Ft=Object.defineProperty,It=(e,t)=>Ft(e,`name`,{value:t,configurable:!0}),Lt=S.useId||(()=>void 0),Rt=0;function zt(e){let[t,n]=S.useState(Lt());return I(()=>{e||n(e=>e??String(Rt++))},[e]),e||(t?`radix-${t}`:``)}It(zt,`useId`);var Bt=Object.defineProperty,Vt=(e,t)=>Bt(e,`name`,{value:t,configurable:!0});function B(e){let t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>((...e)=>t.current?.(...e)),[])}Vt(B,`useCallbackRef`);var Ht=Object.defineProperty,V=(e,t)=>Ht(e,`name`,{value:t,configurable:!0}),Ut=`dismissableLayer.update`,Wt=`dismissableLayer.pointerDownOutside`,Gt=`dismissableLayer.focusOutside`,Kt,qt=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Jt=S.forwardRef(V(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=S.useContext(qt),[d,f]=S.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=S.useState({}),h=A(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,ee=u.layersWithOutsidePointerEventsDisabled.size>0,b=y>=v,x=S.useRef(!1),te=Zt(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:x,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return b&&!t},[u.branches,b])}),ne=Qt(e=>{if(r&&x.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),C=d?y===g.length-1:!1,w=B(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return S.useEffect(()=>{if(C)return p.addEventListener(`keydown`,w,{capture:!0}),()=>p.removeEventListener(`keydown`,w,{capture:!0})},[p,C,w]),S.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Kt=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),$t(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Kt))}},[d,p,n,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),$t())},[d,u]),S.useEffect(()=>{let e=V(()=>m({}),`handleUpdate`);return document.addEventListener(Ut,e),()=>document.removeEventListener(Ut,e)},[]),E(M.div,{...l,ref:h,style:{pointerEvents:ee?b?`auto`:`none`:void 0,...e.style},onFocusCapture:F(e.onFocusCapture,ne.onFocusCapture),onBlurCapture:F(e.onBlurCapture,ne.onBlurCapture),onPointerDownCapture:F(e.onPointerDownCapture,te.onPointerDownCapture)})},`DismissableLayer`));function Yt(){let e=S.useContext(qt),[t,n]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}V(Yt,`useDismissableLayerSurface`);var Xt=V(()=>!0,`IS_TRUE`);function Zt(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Xt}=t,s=B(e),c=S.useRef(!1),l=S.useRef(!1),u=S.useRef(new Map),d=S.useRef(()=>{});return S.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}V(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}V(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}V(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}V(p,`handleInteractionBubble`);let m=V(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||en(Wt,s,p,{discrete:!0})};if(V(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:V(()=>c.current=!0,`onPointerDownCapture`)}}V(Zt,`usePointerDownOutside`);function Qt(e,t=globalThis?.document){let n=B(e),r=S.useRef(!1);return S.useEffect(()=>{let e=V(e=>{e.target&&!r.current&&en(Gt,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:V(()=>r.current=!0,`onFocusCapture`),onBlurCapture:V(()=>r.current=!1,`onBlurCapture`)}}V(Qt,`useFocusOutside`);function $t(){let e=new CustomEvent(Ut);document.dispatchEvent(e)}V($t,`dispatchUpdate`);function en(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?at(i,a):i.dispatchEvent(a)}V(en,`handleAndDispatchCustomEvent`);var tn=Object.defineProperty,H=(e,t)=>tn(e,`name`,{value:t,configurable:!0}),nn=`focusScope.autoFocusOnMount`,rn=`focusScope.autoFocusOnUnmount`,an={bubbles:!1,cancelable:!0},on=S.forwardRef(H(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=S.useState(null),l=B(i),u=B(a),d=S.useRef(null),f=A(t,c),p=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:U(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||U(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&U(s)};H(e,`handleFocusIn`),H(t,`handleFocusOut`),H(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),S.useEffect(()=>{if(s){pn.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(nn,an);s.addEventListener(nn,l),s.dispatchEvent(t),t.defaultPrevented||(sn(gn(ln(s)),{select:!0}),document.activeElement===e&&U(s))}return()=>{s.removeEventListener(nn,l),setTimeout(()=>{let t=new CustomEvent(rn,an);s.addEventListener(rn,u),s.dispatchEvent(t),t.defaultPrevented||U(e??document.body,{select:!0}),s.removeEventListener(rn,u),pn.remove(p)},0)}}},[s,l,u,p]);let m=S.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=cn(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&U(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&U(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return E(M.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function sn(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(U(r,{select:t}),document.activeElement!==n)return}H(sn,`focusFirst`);function cn(e){let t=ln(e);return[un(t,e),un(t.reverse(),e)]}H(cn,`getTabbableEdges`);function ln(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:H(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}H(ln,`getTabbableCandidates`);function un(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):dn(r,{upTo:t})))return r}H(un,`findVisible`);function dn(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}H(dn,`isHidden`);function fn(e){return e instanceof HTMLInputElement&&`select`in e}H(fn,`isSelectableInput`);function U(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fn(e)&&t&&e.select()}}H(U,`focus`);var pn=mn();function mn(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=hn(e,t),e.unshift(t)},remove(t){e=hn(e,t),e[0]?.resume()}}}H(mn,`createFocusScopesStack`);function hn(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}H(hn,`arrayRemove`);function gn(e){return e.filter(e=>e.tagName!==`A`)}H(gn,`removeLinks`);var _n=Object.defineProperty,vn=S.forwardRef(((e,t)=>_n(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=S.useState(!1);I(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?le.createPortal(E(M.div,{...r,ref:t}),o):null},`Portal`)),yn=Object.defineProperty,bn=(e,t)=>yn(e,`name`,{value:t,configurable:!0}),xn=0,W=null;function Sn(e){return Cn(),e.children}bn(Sn,`FocusGuards`);function Cn(){S.useEffect(()=>{W||={start:wn(),end:wn()};let{start:e,end:t}=W;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),xn++,()=>{xn===1&&(W?.start.remove(),W?.end.remove(),W=null),xn=Math.max(0,xn-1)}},[])}bn(Cn,`useFocusGuards`);function wn(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}bn(wn,`createFocusGuard`);var G=function(){return G=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},G.apply(this,arguments)};function Tn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function En(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Dn=`right-scroll-bar-position`,On=`width-before-scroll-bar`,kn=`with-scroll-bars-hidden`,An=`--removed-body-scroll-bar-size`;function jn(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Mn(e,t){var n=T(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Nn=typeof window<`u`?S.useLayoutEffect:S.useEffect,Pn=new WeakMap;function Fn(e,t){var n=Mn(t||null,function(t){return e.forEach(function(e){return jn(e,t)})});return Nn(function(){var t=Pn.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||jn(e,null)}),i.forEach(function(e){r.has(e)||jn(e,a)})}Pn.set(n,e)},[e]),n}function In(e){return e}function Ln(e,t){t===void 0&&(t=In);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Rn(e){e===void 0&&(e={});var t=Ln(null);return t.options=G({async:!0,ssr:!1},e),t}var zn=function(e){var t=e.sideCar,n=Tn(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return S.createElement(r,G({},n))};zn.isSideCarExport=!0;function Bn(e,t){return e.useMedium(t),zn}var Vn=Rn(),Hn=function(){},Un=S.forwardRef(function(e,t){var n=S.useRef(null),r=S.useState({onScrollCapture:Hn,onWheelCapture:Hn,onTouchMoveCapture:Hn}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,ee=Tn(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),b=f,x=Fn([n,t]),te=G(G({},ee),i);return S.createElement(S.Fragment,null,u&&S.createElement(b,{sideCar:Vn,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?S.cloneElement(S.Children.only(s),G(G({},te),{ref:x})):S.createElement(v,G({},te,{className:c,ref:x}),s))});Un.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Un.classNames={fullWidth:On,zeroRight:Dn};var Wn,Gn=function(){if(Wn)return Wn;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Kn(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Gn();return t&&e.setAttribute(`nonce`,t),e}function qn(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Jn(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Yn=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Kn())&&(qn(t,n),Jn(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xn=function(){var e=Yn();return function(t,n){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Zn=function(){var e=Xn();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Qn={left:0,top:0,right:0,gap:0},$n=function(e){return parseInt(e||``,10)||0},er=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[$n(n),$n(r),$n(i)]},tr=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Qn;var t=er(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},nr=Zn(),K=`data-scroll-locked`,rr=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
2
|
.${kn} {
|
|
3
3
|
overflow: hidden ${r};
|
|
4
4
|
padding-right: ${s}px ${r};
|