@rubytech/create-maxy-code 0.1.116 → 0.1.117
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/package.json +1 -1
- package/payload/platform/neo4j/schema.cypher +73 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-cypher-drift.test.d.ts +2 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-cypher-drift.test.d.ts.map +1 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-cypher-drift.test.js +62 -0
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-cypher-drift.test.js.map +1 -0
- package/payload/platform/plugins/memory/mcp/vitest.config.ts +2 -0
- package/payload/server/public/assets/{admin-DloKrK2i.js → admin-D6IfAzYY.js} +1 -1
- package/payload/server/public/assets/{data-NMvGx6jm.js → data-BGbQyufe.js} +1 -1
- package/payload/server/public/assets/{graph-CN60KyTy.js → graph-D-1lRTeL.js} +1 -1
- package/payload/server/public/assets/{graph-labels-h39S93Xo.js → graph-labels-BRXJHNYE.js} +1 -1
- package/payload/server/public/assets/{page-B0iMmY6t.js → page-B4oirCvn.js} +1 -1
- package/payload/server/public/assets/{page-CFRU-BdJ.js → page-FmJ7PIYx.js} +1 -1
- package/payload/server/public/data.html +3 -3
- package/payload/server/public/graph.html +3 -3
- package/payload/server/public/index.html +4 -4
- package/payload/server/server.js +13 -0
package/package.json
CHANGED
|
@@ -1100,3 +1100,76 @@ FOR (h:CloudflareHostname) REQUIRE (h.accountId, h.hostnameValue) IS UNIQUE;
|
|
|
1100
1100
|
|
|
1101
1101
|
CREATE INDEX cloudflare_hostname_account IF NOT EXISTS
|
|
1102
1102
|
FOR (h:CloudflareHostname) ON (h.accountId);
|
|
1103
|
+
|
|
1104
|
+
// ----------------------------------------------------------
|
|
1105
|
+
// Estate-agent ontology (Task 358) — Listing-centric model
|
|
1106
|
+
// documented at platform/plugins/memory/references/schema-estate-agent.md.
|
|
1107
|
+
//
|
|
1108
|
+
// These declarations exist primarily so the memory-write validator's
|
|
1109
|
+
// parseLabelsFromSchemaCypher() registers each label on a fresh deploy
|
|
1110
|
+
// where no node of the label has yet landed — without them, the first
|
|
1111
|
+
// :Listing write from the listing-curator agent is rejected as "unknown
|
|
1112
|
+
// label" against an empty db.labels() set.
|
|
1113
|
+
//
|
|
1114
|
+
// Idempotency contracts mirror schema-estate-agent.md:
|
|
1115
|
+
// :Listing / :Viewing / :Offer — (accountId, sourceSystem, sourceId)
|
|
1116
|
+
// :Property — (accountId, slug)
|
|
1117
|
+
// :ImageObject — (accountId, listingSlug, url) for the
|
|
1118
|
+
// estate-agent variant, (accountId, name,
|
|
1119
|
+
// contentUrl) for the brand-asset variant.
|
|
1120
|
+
// Because the two writers use different
|
|
1121
|
+
// natural keys, only an accountId index is
|
|
1122
|
+
// declared at the schema level — uniqueness
|
|
1123
|
+
// is enforced at write time by the curator
|
|
1124
|
+
// / brand-asset writer's MERGE clause.
|
|
1125
|
+
// ----------------------------------------------------------
|
|
1126
|
+
|
|
1127
|
+
CREATE CONSTRAINT listing_account_source_unique IF NOT EXISTS
|
|
1128
|
+
FOR (l:Listing) REQUIRE (l.accountId, l.sourceSystem, l.sourceId) IS UNIQUE;
|
|
1129
|
+
|
|
1130
|
+
CREATE INDEX listing_account IF NOT EXISTS
|
|
1131
|
+
FOR (l:Listing) ON (l.accountId);
|
|
1132
|
+
|
|
1133
|
+
CREATE INDEX listing_status IF NOT EXISTS
|
|
1134
|
+
FOR (l:Listing) ON (l.status);
|
|
1135
|
+
|
|
1136
|
+
CREATE INDEX listing_type IF NOT EXISTS
|
|
1137
|
+
FOR (l:Listing) ON (l.listingType);
|
|
1138
|
+
|
|
1139
|
+
CREATE VECTOR INDEX listing_embedding IF NOT EXISTS
|
|
1140
|
+
FOR (l:Listing) ON (l.embedding)
|
|
1141
|
+
OPTIONS {
|
|
1142
|
+
indexConfig: {
|
|
1143
|
+
`vector.dimensions`: 768,
|
|
1144
|
+
`vector.similarity_function`: 'cosine'
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
CREATE CONSTRAINT property_account_slug_unique IF NOT EXISTS
|
|
1149
|
+
FOR (p:Property) REQUIRE (p.accountId, p.slug) IS UNIQUE;
|
|
1150
|
+
|
|
1151
|
+
CREATE INDEX property_account IF NOT EXISTS
|
|
1152
|
+
FOR (p:Property) ON (p.accountId);
|
|
1153
|
+
|
|
1154
|
+
CREATE CONSTRAINT viewing_account_source_unique IF NOT EXISTS
|
|
1155
|
+
FOR (v:Viewing) REQUIRE (v.accountId, v.sourceSystem, v.sourceId) IS UNIQUE;
|
|
1156
|
+
|
|
1157
|
+
CREATE INDEX viewing_account IF NOT EXISTS
|
|
1158
|
+
FOR (v:Viewing) ON (v.accountId);
|
|
1159
|
+
|
|
1160
|
+
CREATE CONSTRAINT offer_account_source_unique IF NOT EXISTS
|
|
1161
|
+
FOR (o:Offer) REQUIRE (o.accountId, o.sourceSystem, o.sourceId) IS UNIQUE;
|
|
1162
|
+
|
|
1163
|
+
CREATE INDEX offer_account IF NOT EXISTS
|
|
1164
|
+
FOR (o:Offer) ON (o.accountId);
|
|
1165
|
+
|
|
1166
|
+
CREATE INDEX image_object_account IF NOT EXISTS
|
|
1167
|
+
FOR (i:ImageObject) ON (i.accountId);
|
|
1168
|
+
|
|
1169
|
+
// :PostalAddress (schema:PostalAddress) — shared address nodes documented in
|
|
1170
|
+
// schema-base.md. Address rows are deliberately accountId-free (one address
|
|
1171
|
+
// can be shared across customers / orders / listings); writers MERGE on the
|
|
1172
|
+
// formatted address triple. Declared here so a fresh deploy registers the
|
|
1173
|
+
// label before the first :PostalAddress write lands.
|
|
1174
|
+
CREATE INDEX postal_address_postcode IF NOT EXISTS
|
|
1175
|
+
FOR (a:PostalAddress) ON (a.postalCode);
|
package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-cypher-drift.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-cypher-drift.test.d.ts","sourceRoot":"","sources":["../../../src/lib/__tests__/schema-cypher-drift.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { test, expect } from "vitest";
|
|
2
|
+
import { readFileSync, readdirSync } from "node:fs";
|
|
3
|
+
import { resolve, join } from "node:path";
|
|
4
|
+
import { parseLabelsFromSchemaCypher } from "../../../../../../lib/graph-mcp/dist/schema-cypher-parser.js";
|
|
5
|
+
// Task 358 — schema-doc / schema-cypher drift guard.
|
|
6
|
+
//
|
|
7
|
+
// Every label declared in prose by an ontology doc under
|
|
8
|
+
// platform/plugins/memory/references/schema-*.md must also be declared
|
|
9
|
+
// in platform/neo4j/schema.cypher so that
|
|
10
|
+
// parseLabelsFromSchemaCypher() registers it before the first node of
|
|
11
|
+
// that label has landed. Without this guard, a label written in the prose
|
|
12
|
+
// model survives review even when its CREATE CONSTRAINT / CREATE INDEX
|
|
13
|
+
// line is missing — and the first memory-write referencing it fails
|
|
14
|
+
// against a fresh, label-empty graph (the symptom that produced this
|
|
15
|
+
// task, and Task 352 before it).
|
|
16
|
+
const REFERENCES_DIR = resolve(import.meta.dirname, "../../../../references");
|
|
17
|
+
const SCHEMA_CYPHER_PATH = resolve(import.meta.dirname, "../../../../../../neo4j/schema.cypher");
|
|
18
|
+
// Labels named in prose that are deliberately NOT first-class graph
|
|
19
|
+
// nodes — they are sub-labels stacked on a base node by the writer, or
|
|
20
|
+
// schema.org aliases that never reach the graph as their own label.
|
|
21
|
+
// Adding to this set is an intentional exception, not a silent omission.
|
|
22
|
+
const PROSE_ONLY_LABELS = new Set([
|
|
23
|
+
// schema-estate-agent.md treats Applicant as an additional label on a
|
|
24
|
+
// base :Person node; there is no standalone :Applicant.
|
|
25
|
+
"Applicant",
|
|
26
|
+
]);
|
|
27
|
+
function backtickedLabels(text) {
|
|
28
|
+
const labels = new Set();
|
|
29
|
+
// Match `:Label` inside backticks — the convention used by every
|
|
30
|
+
// schema-*.md prose doc to name a Neo4j label.
|
|
31
|
+
for (const match of text.matchAll(/`:([A-Z][A-Za-z0-9]*)`/g)) {
|
|
32
|
+
labels.add(match[1]);
|
|
33
|
+
}
|
|
34
|
+
return labels;
|
|
35
|
+
}
|
|
36
|
+
test("schema-*.md prose labels all appear in schema.cypher", () => {
|
|
37
|
+
const declared = new Set(parseLabelsFromSchemaCypher(readFileSync(SCHEMA_CYPHER_PATH, "utf-8")));
|
|
38
|
+
const files = readdirSync(REFERENCES_DIR).filter((name) => name.startsWith("schema-") && name.endsWith(".md"));
|
|
39
|
+
expect(files.length).toBeGreaterThan(0);
|
|
40
|
+
const missing = [];
|
|
41
|
+
for (const file of files) {
|
|
42
|
+
const text = readFileSync(join(REFERENCES_DIR, file), "utf-8");
|
|
43
|
+
for (const label of backtickedLabels(text)) {
|
|
44
|
+
if (PROSE_ONLY_LABELS.has(label))
|
|
45
|
+
continue;
|
|
46
|
+
if (!declared.has(label)) {
|
|
47
|
+
missing.push({ label, file });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
expect(missing, `Labels named in prose but missing from schema.cypher (add a CREATE CONSTRAINT or CREATE INDEX FOR (x:Label) line, or add to PROSE_ONLY_LABELS with a justification):\n${missing
|
|
52
|
+
.map((m) => ` :${m.label} (${m.file})`)
|
|
53
|
+
.join("\n")}`).toEqual([]);
|
|
54
|
+
});
|
|
55
|
+
test("estate-agent labels are declared in schema.cypher", () => {
|
|
56
|
+
// Task 358 acceptance — explicit assertion against regression.
|
|
57
|
+
const declared = new Set(parseLabelsFromSchemaCypher(readFileSync(SCHEMA_CYPHER_PATH, "utf-8")));
|
|
58
|
+
for (const label of ["Listing", "Property", "Viewing", "Offer", "ImageObject"]) {
|
|
59
|
+
expect(declared.has(label), `expected :${label} in schema.cypher`).toBe(true);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=schema-cypher-drift.test.js.map
|
package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/schema-cypher-drift.test.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-cypher-drift.test.js","sourceRoot":"","sources":["../../../src/lib/__tests__/schema-cypher-drift.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,8DAA8D,CAAC;AAE3G,qDAAqD;AACrD,EAAE;AACF,yDAAyD;AACzD,uEAAuE;AACvE,0CAA0C;AAC1C,sEAAsE;AACtE,0EAA0E;AAC1E,uEAAuE;AACvE,oEAAoE;AACpE,qEAAqE;AACrE,iCAAiC;AAEjC,MAAM,cAAc,GAAG,OAAO,CAC5B,MAAM,CAAC,IAAI,CAAC,OAAO,EACnB,wBAAwB,CACzB,CAAC;AACF,MAAM,kBAAkB,GAAG,OAAO,CAChC,MAAM,CAAC,IAAI,CAAC,OAAO,EACnB,uCAAuC,CACxC,CAAC;AAEF,oEAAoE;AACpE,uEAAuE;AACvE,oEAAoE;AACpE,yEAAyE;AACzE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS;IACxC,sEAAsE;IACtE,wDAAwD;IACxD,WAAW;CACZ,CAAC,CAAC;AAEH,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,iEAAiE;IACjE,+CAA+C;IAC/C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC;QAC7D,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,IAAI,CAAC,sDAAsD,EAAE,GAAG,EAAE;IAChE,MAAM,QAAQ,GAAG,IAAI,GAAG,CACtB,2BAA2B,CAAC,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CACvE,CAAC;IACF,MAAM,KAAK,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC,MAAM,CAC9C,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAC7D,CAAC;IACF,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAExC,MAAM,OAAO,GAA2C,EAAE,CAAC;IAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QAC/D,KAAK,MAAM,KAAK,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC;gBAAE,SAAS;YAC3C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,CACJ,OAAO,EACP,yKAAyK,OAAO;SAC7K,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC;SACvC,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAChB,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;IAC7D,+DAA+D;IAC/D,MAAM,QAAQ,GAAG,IAAI,GAAG,CACtB,2BAA2B,CAAC,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CACvE,CAAC;IACF,KAAK,MAAM,KAAK,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,CAAC;QAC/E,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,aAAa,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChF,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -18,6 +18,8 @@ export default defineConfig({
|
|
|
18
18
|
"src/lib/__tests__/live-schema-source.test.ts",
|
|
19
19
|
// Task 207 — Vitest-style test for `readPassword()` fallback path math.
|
|
20
20
|
"src/lib/__tests__/neo4j-password-path.test.ts",
|
|
21
|
+
// Task 358 — schema-doc / schema.cypher drift guard.
|
|
22
|
+
"src/lib/__tests__/schema-cypher-drift.test.ts",
|
|
21
23
|
],
|
|
22
24
|
testTimeout: 10_000,
|
|
23
25
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-DD-I1_y5.js";import{_ as n,a as r,d as i,f as a,g as o,l as s,m as c,p as l,r as u,u as d,v as f,y as p}from"./ChatInput-CJo_77bp.js";import{C as m,S as h,_ as g,a as _,b as v,c as y,d as b,f as x,g as S,l as C,p as w,s as T,u as ee,v as E,x as te,y as ne}from"./graph-labels-h39S93Xo.js";import{a as D,i as re,r as O,t as ie}from"./page-CFRU-BdJ.js";import{i as ae,n as oe,r as se}from"./page-B0iMmY6t.js";import{t as ce}from"./Checkbox-YrQovXpN.js";import{n as le,r as k,t as ue}from"./lib-Bnh57com.js";var de=n(),A=e(p(),1);new Set(`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/zip,application/x-zip-compressed,audio/ogg,audio/opus,audio/mp4,audio/mpeg,audio/webm,audio/wav,.opus,.ogg,.m4a,.mp3,.wav,.webm`.split(`,`).filter(e=>!e.startsWith(`.`)));function fe(e){switch(e){case`expanded`:return!0;case`collapsed`:return!1;default:return}}var pe=`admin-landing-redirected`,me=`/graph`;function he(e){return e.appState===`chat`&&!e.alreadyRedirected}function ge(){let[e,t]=(0,A.useState)(`loading`),[n,r]=(0,A.useState)(``),[i,a]=(0,A.useState)(``),[o,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(!1),[g,_]=(0,A.useState)(!1),[v,y]=(0,A.useState)(null),[b,x]=(0,A.useState)(null),[S,C]=(0,A.useState)(void 0),[w,T]=(0,A.useState)(null),[ee,E]=(0,A.useState)(void 0),[te,ne]=(0,A.useState)(null),[D,re]=(0,A.useState)(null),[O,ie]=(0,A.useState)([]),[ae,oe]=(0,A.useState)(!1),[se,ce]=(0,A.useState)(void 0),le=(0,A.useRef)(void 0),[k,ue]=(0,A.useState)(!1);(0,A.useEffect)(()=>{typeof window>`u`||window.location.hostname.startsWith(`admin.`)&&fetch(`/api/remote-auth/status`).then(e=>e.ok?e.json():null).then(e=>{e?.configured&&ue(!0)}).catch(()=>{})},[]);let de=(0,A.useRef)(null),ge=(0,A.useRef)(null);(0,A.useEffect)(()=>{async function e(){let e=null;try{e=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!e)return!1;try{let n=await fetch(`/api/admin/session?session_key=${encodeURIComponent(e)}`);if(n.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}return!1}if(!n.ok)return!1;let r=await n.json();y(r.session_key),re(r.conversationId??null),C(r.businessName),T(r.role??null),E(r.userName===void 0?null:r.userName),ne(r.avatar??null);let i=fe(r.thinkingView);return le.current=i,ce(i),t(`chat`),!0}catch(e){return console.error(`[admin] session restore failed:`,e),!1}}async function n(r=2){try{let i=await fetch(`/api/health`);if(!i.ok){if(r>0)return await new Promise(e=>setTimeout(e,1500)),n(r-1);console.error(`[admin] health check returned ${i.status} after retries`),t(`set-pin`);return}let a=await i.json();if(!a.pin_configured){t(`set-pin`);return}if(!a.claude_authenticated){t(`connect-claude`);return}if(await e())return;t(`enter-pin`)}catch(e){if(r>0)return await new Promise(e=>setTimeout(e,1500)),n(r-1);console.error(`[admin] health check failed:`,e),t(`set-pin`)}}n()},[]),(0,A.useEffect)(()=>{e===`chat`&&fetch(`/api/admin/claude-info`).then(e=>{if(e.ok)return e.json()}).then(e=>{e&&x(e)}).catch(()=>{})},[e]),(0,A.useEffect)(()=>{if(typeof window>`u`)return;let t=!1;try{t=sessionStorage.getItem(pe)===`1`}catch{}if(he({appState:e,alreadyRedirected:t})){try{sessionStorage.setItem(pe,`1`)}catch{}console.info(`[admin-ui] landing-redirect target=${me}`),window.location.replace(me)}},[e]),(0,A.useEffect)(()=>{if(e!==`chat`)return;let n=setInterval(async()=>{try{let e=await fetch(`/api/health`);if(!e.ok)return;let n=await e.json();(n.auth_status===`dead`||n.auth_status===`missing`)&&t(`connect-claude`)}catch{}},300*1e3);return()=>clearInterval(n)},[e]),(0,A.useEffect)(()=>{e===`connect-claude`&&fetch(`/api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.claude_authenticated&&t(`enter-pin`)}).catch(()=>{})},[e]);async function _e(e,n){d(!0);try{let i=await fetch(`/api/admin/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:e,...n?{accountId:n}:{}})});if(!i.ok){s((await i.json().catch(()=>({}))).error||`Invalid PIN`);return}let a=await i.json();if(a.accounts&&!a.session_key){console.log(`[admin] account picker shown: userId=${a.userId} accountCount=${a.accounts.length}`),ie(a.accounts),t(`account-picker`);return}y(a.session_key),re(a.conversationId??null),C(a.businessName),T(a.role??null),E(a.userName===void 0?null:a.userName),ne(a.avatar??null);let o=fe(a.thinkingView);if(le.current=o,ce(o),n)try{sessionStorage.setItem(`maxy-account-id`,n)}catch{}try{sessionStorage.setItem(`maxy-admin-session-key`,a.session_key)}catch{}r(``),t(`chat`)}catch(e){console.error(`[admin] connection error:`,e),s(`Could not connect.`)}finally{d(!1),oe(!1)}}let ve=(0,A.useCallback)(async e=>{if(e.preventDefault(),u)return;s(``);let a=i.trim();if(!a){s(`Please enter your name.`);return}if(n.length<4){s(`PIN must be at least 4 characters.`);return}let o=n;d(!0);try{let e=await fetch(`/api/onboarding/set-pin`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:o,name:a})});if(!e.ok){let n=await e.json().catch(()=>({}));if(e.status===409){console.log(`[admin] PIN already configured — re-checking health`);try{let e=await fetch(`/api/health`);if(e.ok){let r=await e.json();r.pin_configured&&r.claude_authenticated?t(`enter-pin`):r.pin_configured?t(`connect-claude`):s(n.error||`Failed to set PIN.`)}else t(`enter-pin`)}catch{t(`enter-pin`)}return}s(n.error||`Failed to set PIN.`);return}let n=await fetch(`/api/health`);if((n.ok?await n.json():null)?.claude_authenticated){await _e(o);return}r(``),t(`connect-claude`)}catch(e){console.error(`[admin] connection error:`,e),s(`Could not connect.`)}finally{d(!1)}},[n,u,i]),ye=(0,A.useCallback)(async e=>{e.preventDefault(),s(``),await _e(n)},[n]),be=(0,A.useCallback)(async()=>{_(!0);try{await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`logout`})}),y(null),T(null),E(void 0),ne(null);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}t(`connect-claude`)}finally{_(!1)}},[]),xe=(0,A.useCallback)(()=>{y(null),T(null),E(void 0),ne(null);try{sessionStorage.removeItem(`maxy-admin-session-key`),sessionStorage.removeItem(pe)}catch{}r(``),s(``),t(`enter-pin`)},[]);return{appState:e,setAppState:t,pin:n,setPin:r,operatorName:i,setOperatorName:a,pinError:o,setPinError:s,showPin:c,setShowPin:l,pinLoading:u,authPolling:f,setAuthPolling:p,authLoading:m,setAuthLoading:h,disconnecting:g,cacheKey:v,setCacheKey:y,claudeInfo:b,setClaudeInfo:x,businessName:S,role:w,userName:ee,userAvatar:te,conversationId:D,setConversationId:re,accounts:O,accountPickerLoading:ae,expandAll:se,setExpandAll:ce,expandAllDefaultRef:le,remoteAuthEnabled:k,pinInputRef:de,setPinFormRef:ge,handleSetPin:ve,handleLogin:ye,handleAccountSelect:(0,A.useCallback)(async e=>{oe(!0),s(``),await _e(n,e)},[n]),handleDisconnect:be,handleLogout:xe,handleChangePin:(0,A.useCallback)(async()=>{if(!n){s(`Enter your current PIN first.`);return}d(!0),s(``);try{let e=await fetch(`/api/onboarding/set-pin`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPin:n})});if(!e.ok){s((await e.json().catch(()=>({error:`Incorrect PIN.`}))).error||`Incorrect PIN.`);return}r(``),s(``),t(`set-pin`)}catch(e){console.error(`[admin-auth] change pin failed:`,e),s(e instanceof Error?e.message:String(e))}finally{d(!1)}},[n])}}var _e=o(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),ve=o(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),ye=o(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),be=o(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),xe=o(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),Se=o(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Ce=o(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),we=o(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),Te=o(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Ee=o(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),De=o(`square-arrow-down-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m16 8-8 8`,key:`166keh`}],[`path`,{d:`M16 16H8V8`,key:`1w2ppm`}]]),Oe=o(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),j=d();function ke({inputRef:e,value:t,onChange:n,onComplete:r,showPin:i,autoFocus:a}){let o=(0,A.useRef)([]);function s(e,r){r.key===`Backspace`?(r.preventDefault(),t[e]?n(t.slice(0,e)+t.slice(e+1)):e>0&&(n(t.slice(0,e-1)+t.slice(e)),o.current[e-1]?.focus())):r.key===`ArrowLeft`&&e>0?o.current[e-1]?.focus():r.key===`ArrowRight`&&e<5?o.current[e+1]?.focus():r.key===`Enter`&&(r.preventDefault(),r.currentTarget.form?.requestSubmit())}function c(e,i){let a=i.nativeEvent.data;if(!a||!/^\d$/.test(a))return;let s=t.split(``);for(s[e]=a;s.length<e;)s.push(``);let c=s.join(``).replace(/\D/g,``).slice(0,6);n(c),c.length===6?r?.(c):e<5&&o.current[e+1]?.focus()}function l(e){e.preventDefault();let t=e.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,6);t&&(n(t),t.length===6?r?.(t):o.current[t.length]?.focus())}return(0,j.jsx)(`div`,{className:`pin-field`,children:Array.from({length:6}).map((n,r)=>(0,j.jsx)(`input`,{ref:t=>{o.current[r]=t,r===0&&e&&(e.current=t)},type:`text`,inputMode:`numeric`,className:`pin-box${t[r]?` pin-box-filled`:``}`,value:t[r]?i?t[r]:`•`:``,onKeyDown:e=>s(r,e),onInput:e=>c(r,e),onPaste:l,onFocus:e=>e.target.select(),autoFocus:a&&r===0,autoComplete:`off`,maxLength:1,"aria-label":`PIN digit ${r+1}`},r))})}function Ae(e){let{pin:t,setPin:n,showPin:i,setShowPin:a,pinLoading:o,pinError:c,pinInputRef:l,setPinFormRef:u,onSubmit:d,operatorName:f,setOperatorName:p}=e;return(0,j.jsx)(`div`,{className:`connect-page`,children:(0,j.jsxs)(`div`,{className:`connect-content`,children:[(0,j.jsx)(`img`,{src:s,alt:r.productName,className:`connect-logo connect-logo--maxy`}),!r.logoContainsName&&(0,j.jsxs)(`h1`,{className:`connect-title`,children:[`Welcome to `,r.productName]}),(0,j.jsxs)(`p`,{className:`connect-subtitle`,children:[`Tell `,r.productName,` who you are, then choose a PIN.`]}),(0,j.jsxs)(`form`,{ref:u,onSubmit:d,className:`connect-pin-form`,children:[(0,j.jsxs)(`div`,{className:`pin-input-row`,children:[(0,j.jsx)(`input`,{type:`text`,className:`connect-name-input`,placeholder:`Your full name`,value:f,onChange:e=>p(e.target.value),autoComplete:`name`,autoFocus:!0,required:!0,"aria-label":`Your full name`}),(0,j.jsx)(`div`,{style:{width:38,flexShrink:0},"aria-hidden":`true`})]}),(0,j.jsxs)(`div`,{className:`pin-input-row`,children:[(0,j.jsx)(ke,{inputRef:l,value:t,onChange:n,onComplete:()=>{},showPin:i}),(0,j.jsx)(k,{variant:`send`,type:`submit`,disabled:!t||!f.trim(),loading:o,"aria-label":`Set PIN`,children:(0,j.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,j.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,j.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,j.jsx)(ce,{checked:i,onChange:()=>a(e=>!e),label:`Show PIN`})]}),c&&(0,j.jsx)(`p`,{className:`admin-pin-error`,children:c})]})})}function je(e){let{pin:t,setPin:n,showPin:i,setShowPin:a,pinLoading:o,pinError:c,pinInputRef:l,onSubmit:u,onChangePin:d,remoteAuthEnabled:f,onSignOutRemote:p}=e;return(0,j.jsxs)(`div`,{className:`connect-page`,children:[f&&p&&(0,j.jsx)(`button`,{type:`button`,className:`connect-signout`,onClick:p,children:`Sign out`}),(0,j.jsxs)(`div`,{className:`connect-content`,children:[(0,j.jsx)(`img`,{src:s,alt:r.productName,className:`connect-logo connect-logo--maxy`}),!r.logoContainsName&&(0,j.jsx)(`h1`,{className:`connect-title`,children:r.productName}),(0,j.jsxs)(`form`,{onSubmit:u,className:`connect-pin-form`,children:[(0,j.jsxs)(`div`,{className:`pin-input-row`,children:[(0,j.jsx)(ke,{inputRef:l,value:t,onChange:n,onComplete:()=>{},showPin:i,autoFocus:!0}),(0,j.jsx)(k,{variant:`send`,type:`submit`,disabled:!t,loading:o,children:(0,j.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,j.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,j.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,j.jsxs)(`div`,{className:`pin-options`,children:[(0,j.jsx)(ce,{checked:i,onChange:()=>a(e=>!e),label:`Show PIN`}),(0,j.jsx)(k,{type:`button`,variant:`ghost`,onClick:d,children:`Change PIN`})]})]}),c&&(0,j.jsx)(`p`,{className:`admin-pin-error`,children:c})]})]})}function Me(e){let{accounts:t,loading:n,error:i,onSelect:a}=e;return(0,j.jsx)(`div`,{className:`connect-page`,children:(0,j.jsxs)(`div`,{className:`connect-content`,children:[(0,j.jsx)(`img`,{src:s,alt:r.productName,className:`connect-logo connect-logo--maxy`}),!r.logoContainsName&&(0,j.jsx)(`h1`,{className:`connect-title`,children:r.productName}),(0,j.jsx)(`p`,{className:`connect-subtitle`,children:`Select an account`}),(0,j.jsx)(`div`,{className:`account-picker-list`,children:t.map(e=>(0,j.jsxs)(`button`,{className:`account-picker-card`,onClick:()=>a(e.accountId),disabled:n,type:`button`,children:[(0,j.jsx)(`span`,{className:`account-picker-name`,children:e.businessName||e.accountId}),(0,j.jsx)(`span`,{className:`account-picker-role`,children:e.role}),n&&(0,j.jsx)(E,{className:`account-picker-spinner`,size:16})]},e.accountId))}),i&&(0,j.jsx)(`p`,{className:`admin-pin-error`,children:i})]})})}function Ne(e){let{authPolling:t,setAuthPolling:n,authLoading:i,setAuthLoading:a,pinError:o,setPinError:c,setAppState:l}=e,[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(!1);async function m(){p(!0),c(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`launch-browser`})})).json();e.launched?d(!0):e.error&&c(e.error)}catch(e){console.error(`[admin] browser launch error:`,e),c(`Could not launch browser.`)}p(!1)}async function h(){a(!0),c(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`})).json();if(e.started){n(!0),d(!0),a(!1);for(let e=0;e<120;e++)if(await new Promise(e=>setTimeout(e,2e3)),(await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`wait`})})).json()).authenticated){await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),l(`enter-pin`);return}c(`Timed out waiting for sign-in. Try again.`),n(!1)}else e.error&&c(e.error)}catch(e){console.error(`[admin] auth flow error:`,e),c(`Could not start auth flow.`)}a(!1)}async function g(){await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),n(!1),c(``)}return t||u?(0,j.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100dvh`,overflow:`auto`},children:[(0,j.jsxs)(`header`,{className:`chat-header`,style:{paddingBottom:`12px`,flexShrink:0,position:`relative`,maxWidth:`680px`,width:`100%`,margin:`0 auto`,padding:`24px 20px 12px`},children:[t?(0,j.jsx)(`button`,{onClick:g,style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Cancel`,children:`✕`}):(0,j.jsx)(`button`,{onClick:()=>d(!1),style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Close browser`,children:`✕`}),(0,j.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`chat-logo`}),(0,j.jsx)(`h1`,{className:`chat-tagline`,children:`Connect Claude`}),(0,j.jsx)(`p`,{className:`chat-intro`,children:t?`Sign in and authorize in the browser below.`:`Open your email or prepare your accounts, then sign in.`}),!t&&(0,j.jsx)(`div`,{style:{marginTop:`12px`},children:(0,j.jsx)(k,{variant:`primary`,onClick:h,disabled:i,children:i?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`})})]}),(0,j.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0,gap:`10px`,padding:`0 0 16px`},children:(0,j.jsx)(`iframe`,{src:`/vnc-viewer.html`,style:{flex:1,width:`100%`,minHeight:0,border:`none`,background:`#111`,display:`block`},title:`Claude Sign-in`})}),o&&(0,j.jsx)(`p`,{className:`admin-pin-error`,style:{textAlign:`center`,padding:`0 20px 16px`},children:o})]}):(0,j.jsx)(`div`,{className:`connect-page`,children:(0,j.jsxs)(`div`,{className:`connect-content`,children:[(0,j.jsxs)(`div`,{className:`connect-logos`,children:[(0,j.jsx)(`div`,{className:`connect-logo-wrap`,children:(0,j.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`connect-logo`})}),(0,j.jsx)(`svg`,{className:`connect-arrow`,viewBox:`0 0 48 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,j.jsx)(`path`,{d:`M0 12h44m0 0l-8-8m8 8l-8 8`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,j.jsxs)(`div`,{className:`connect-logo-wrap`,children:[(0,j.jsx)(`img`,{src:s,alt:r.productName,className:`connect-logo connect-logo--maxy`}),!r.logoContainsName&&(0,j.jsx)(`span`,{className:`connect-logo-label`,children:r.productName})]})]}),(0,j.jsxs)(`h1`,{className:`connect-title`,children:[`Connect Claude to power `,r.productName]}),(0,j.jsx)(`p`,{className:`connect-subtitle`,children:`Sign in with your Anthropic account to get started.`}),(0,j.jsx)(k,{variant:`primary`,onClick:h,disabled:i,children:i?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`}),(0,j.jsx)(`p`,{style:{marginTop:`6px`,fontSize:`11px`,color:`#999`,maxWidth:`300px`,textAlign:`center`,lineHeight:`1.4`},children:`First time? You may need to sign into your email and Anthropic account in the browser before connecting.`}),(0,j.jsx)(`button`,{onClick:m,disabled:f,style:{marginTop:`12px`,background:`none`,border:`none`,color:`var(--color-primary, #666)`,fontSize:`13px`,cursor:`pointer`,textDecoration:`underline`,textUnderlineOffset:`3px`},children:f?`Launching…`:`Open browser first`}),o&&(0,j.jsx)(`p`,{className:`admin-pin-error`,children:o})]})})}var Pe=`maxy-shell-artefact-px`;function Fe(){if(typeof window>`u`)return 320;let e=window.innerWidth,t=document.querySelector(`.platform > .side`)?.getBoundingClientRect(),n=t?t.right:Math.round(e*.3);return Le(Math.round((e-n)*(2/3)))}function Ie(){if(typeof window>`u`)return 320;try{let e=window.localStorage.getItem(Pe);if(!e)return Fe();let t=parseInt(e,10);if(Number.isFinite(t)&&t>=320)return t}catch{}return Fe()}function Le(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=document.querySelector(`.platform > .side`)?.getBoundingClientRect(),r=n?n.right:Math.round(t*.3),i=Math.max(320,t-r-480);return Math.min(Math.max(e,320),i)}function Re({targetSelector:e=`.platform`}){let t=(0,A.useRef)(null),[n,r]=(0,A.useState)(()=>Ie()),i=(0,A.useRef)(n);(0,A.useEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--artefact-px`,`${n}px`),i.current=n)},[n,e]);let a=(0,A.useCallback)(()=>{r(e=>{let t=Le(e);return t===e?e:t})},[]);(0,A.useEffect)(()=>(a(),window.addEventListener(`resize`,a),()=>window.removeEventListener(`resize`,a)),[a]);let o=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let a=!1,o=e=>{a=!0,r(Le(Math.round(window.innerWidth-e.clientX)))},s=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),!a)return;let t=i.current;try{window.localStorage.setItem(Pe,String(t))}catch{}console.info(`[admin-ui] artefact-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=Fe();r(e);try{window.localStorage.removeItem(Pe)}catch{}console.info(`[admin-ui] artefact-resize px=${e}`)};return(0,j.jsx)(`div`,{ref:t,className:`art-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize artefact pane`,onPointerDown:o,onDoubleClick:s})}async function*ze(e,t){let n=await fetch(e,{signal:t});if(n.status===202)throw Error(`transcript not yet on disk; reopen after first turn`);if(!n.ok)throw Error(`stream-failed status=${n.status}`);let r=n.body;if(!r)throw Error(`stream-failed no-body`);let i=r.getReader(),a=new TextDecoder(`utf-8`),o=``,s=0,c=new Promise(e=>{let n={value:void 0,done:!0};if(t.aborted){e(n);return}t.addEventListener(`abort`,()=>e(n),{once:!0})});try{for(;;){if(t.aborted)return;let{value:e,done:n}=await Promise.race([i.read(),c]);if(t.aborted)return;if(n)break;o+=a.decode(e,{stream:!0});let r=o.split(`
|
|
1
|
+
import{o as e,t}from"./chunk-DD-I1_y5.js";import{_ as n,a as r,d as i,f as a,g as o,l as s,m as c,p as l,r as u,u as d,v as f,y as p}from"./ChatInput-CJo_77bp.js";import{C as m,S as h,_ as g,a as _,b as v,c as y,d as b,f as x,g as S,l as C,p as w,s as T,u as ee,v as E,x as te,y as ne}from"./graph-labels-BRXJHNYE.js";import{a as D,i as re,r as O,t as ie}from"./page-FmJ7PIYx.js";import{i as ae,n as oe,r as se}from"./page-B4oirCvn.js";import{t as ce}from"./Checkbox-YrQovXpN.js";import{n as le,r as k,t as ue}from"./lib-Bnh57com.js";var de=n(),A=e(p(),1);new Set(`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/zip,application/x-zip-compressed,audio/ogg,audio/opus,audio/mp4,audio/mpeg,audio/webm,audio/wav,.opus,.ogg,.m4a,.mp3,.wav,.webm`.split(`,`).filter(e=>!e.startsWith(`.`)));function fe(e){switch(e){case`expanded`:return!0;case`collapsed`:return!1;default:return}}var pe=`admin-landing-redirected`,me=`/graph`;function he(e){return e.appState===`chat`&&!e.alreadyRedirected}function ge(){let[e,t]=(0,A.useState)(`loading`),[n,r]=(0,A.useState)(``),[i,a]=(0,A.useState)(``),[o,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(!1),[g,_]=(0,A.useState)(!1),[v,y]=(0,A.useState)(null),[b,x]=(0,A.useState)(null),[S,C]=(0,A.useState)(void 0),[w,T]=(0,A.useState)(null),[ee,E]=(0,A.useState)(void 0),[te,ne]=(0,A.useState)(null),[D,re]=(0,A.useState)(null),[O,ie]=(0,A.useState)([]),[ae,oe]=(0,A.useState)(!1),[se,ce]=(0,A.useState)(void 0),le=(0,A.useRef)(void 0),[k,ue]=(0,A.useState)(!1);(0,A.useEffect)(()=>{typeof window>`u`||window.location.hostname.startsWith(`admin.`)&&fetch(`/api/remote-auth/status`).then(e=>e.ok?e.json():null).then(e=>{e?.configured&&ue(!0)}).catch(()=>{})},[]);let de=(0,A.useRef)(null),ge=(0,A.useRef)(null);(0,A.useEffect)(()=>{async function e(){let e=null;try{e=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!e)return!1;try{let n=await fetch(`/api/admin/session?session_key=${encodeURIComponent(e)}`);if(n.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}return!1}if(!n.ok)return!1;let r=await n.json();y(r.session_key),re(r.conversationId??null),C(r.businessName),T(r.role??null),E(r.userName===void 0?null:r.userName),ne(r.avatar??null);let i=fe(r.thinkingView);return le.current=i,ce(i),t(`chat`),!0}catch(e){return console.error(`[admin] session restore failed:`,e),!1}}async function n(r=2){try{let i=await fetch(`/api/health`);if(!i.ok){if(r>0)return await new Promise(e=>setTimeout(e,1500)),n(r-1);console.error(`[admin] health check returned ${i.status} after retries`),t(`set-pin`);return}let a=await i.json();if(!a.pin_configured){t(`set-pin`);return}if(!a.claude_authenticated){t(`connect-claude`);return}if(await e())return;t(`enter-pin`)}catch(e){if(r>0)return await new Promise(e=>setTimeout(e,1500)),n(r-1);console.error(`[admin] health check failed:`,e),t(`set-pin`)}}n()},[]),(0,A.useEffect)(()=>{e===`chat`&&fetch(`/api/admin/claude-info`).then(e=>{if(e.ok)return e.json()}).then(e=>{e&&x(e)}).catch(()=>{})},[e]),(0,A.useEffect)(()=>{if(typeof window>`u`)return;let t=!1;try{t=sessionStorage.getItem(pe)===`1`}catch{}if(he({appState:e,alreadyRedirected:t})){try{sessionStorage.setItem(pe,`1`)}catch{}console.info(`[admin-ui] landing-redirect target=${me}`),window.location.replace(me)}},[e]),(0,A.useEffect)(()=>{if(e!==`chat`)return;let n=setInterval(async()=>{try{let e=await fetch(`/api/health`);if(!e.ok)return;let n=await e.json();(n.auth_status===`dead`||n.auth_status===`missing`)&&t(`connect-claude`)}catch{}},300*1e3);return()=>clearInterval(n)},[e]),(0,A.useEffect)(()=>{e===`connect-claude`&&fetch(`/api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.claude_authenticated&&t(`enter-pin`)}).catch(()=>{})},[e]);async function _e(e,n){d(!0);try{let i=await fetch(`/api/admin/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:e,...n?{accountId:n}:{}})});if(!i.ok){s((await i.json().catch(()=>({}))).error||`Invalid PIN`);return}let a=await i.json();if(a.accounts&&!a.session_key){console.log(`[admin] account picker shown: userId=${a.userId} accountCount=${a.accounts.length}`),ie(a.accounts),t(`account-picker`);return}y(a.session_key),re(a.conversationId??null),C(a.businessName),T(a.role??null),E(a.userName===void 0?null:a.userName),ne(a.avatar??null);let o=fe(a.thinkingView);if(le.current=o,ce(o),n)try{sessionStorage.setItem(`maxy-account-id`,n)}catch{}try{sessionStorage.setItem(`maxy-admin-session-key`,a.session_key)}catch{}r(``),t(`chat`)}catch(e){console.error(`[admin] connection error:`,e),s(`Could not connect.`)}finally{d(!1),oe(!1)}}let ve=(0,A.useCallback)(async e=>{if(e.preventDefault(),u)return;s(``);let a=i.trim();if(!a){s(`Please enter your name.`);return}if(n.length<4){s(`PIN must be at least 4 characters.`);return}let o=n;d(!0);try{let e=await fetch(`/api/onboarding/set-pin`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:o,name:a})});if(!e.ok){let n=await e.json().catch(()=>({}));if(e.status===409){console.log(`[admin] PIN already configured — re-checking health`);try{let e=await fetch(`/api/health`);if(e.ok){let r=await e.json();r.pin_configured&&r.claude_authenticated?t(`enter-pin`):r.pin_configured?t(`connect-claude`):s(n.error||`Failed to set PIN.`)}else t(`enter-pin`)}catch{t(`enter-pin`)}return}s(n.error||`Failed to set PIN.`);return}let n=await fetch(`/api/health`);if((n.ok?await n.json():null)?.claude_authenticated){await _e(o);return}r(``),t(`connect-claude`)}catch(e){console.error(`[admin] connection error:`,e),s(`Could not connect.`)}finally{d(!1)}},[n,u,i]),ye=(0,A.useCallback)(async e=>{e.preventDefault(),s(``),await _e(n)},[n]),be=(0,A.useCallback)(async()=>{_(!0);try{await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`logout`})}),y(null),T(null),E(void 0),ne(null);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}t(`connect-claude`)}finally{_(!1)}},[]),xe=(0,A.useCallback)(()=>{y(null),T(null),E(void 0),ne(null);try{sessionStorage.removeItem(`maxy-admin-session-key`),sessionStorage.removeItem(pe)}catch{}r(``),s(``),t(`enter-pin`)},[]);return{appState:e,setAppState:t,pin:n,setPin:r,operatorName:i,setOperatorName:a,pinError:o,setPinError:s,showPin:c,setShowPin:l,pinLoading:u,authPolling:f,setAuthPolling:p,authLoading:m,setAuthLoading:h,disconnecting:g,cacheKey:v,setCacheKey:y,claudeInfo:b,setClaudeInfo:x,businessName:S,role:w,userName:ee,userAvatar:te,conversationId:D,setConversationId:re,accounts:O,accountPickerLoading:ae,expandAll:se,setExpandAll:ce,expandAllDefaultRef:le,remoteAuthEnabled:k,pinInputRef:de,setPinFormRef:ge,handleSetPin:ve,handleLogin:ye,handleAccountSelect:(0,A.useCallback)(async e=>{oe(!0),s(``),await _e(n,e)},[n]),handleDisconnect:be,handleLogout:xe,handleChangePin:(0,A.useCallback)(async()=>{if(!n){s(`Enter your current PIN first.`);return}d(!0),s(``);try{let e=await fetch(`/api/onboarding/set-pin`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPin:n})});if(!e.ok){s((await e.json().catch(()=>({error:`Incorrect PIN.`}))).error||`Incorrect PIN.`);return}r(``),s(``),t(`set-pin`)}catch(e){console.error(`[admin-auth] change pin failed:`,e),s(e instanceof Error?e.message:String(e))}finally{d(!1)}},[n])}}var _e=o(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),ve=o(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),ye=o(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),be=o(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),xe=o(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),Se=o(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Ce=o(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),we=o(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),Te=o(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Ee=o(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),De=o(`square-arrow-down-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m16 8-8 8`,key:`166keh`}],[`path`,{d:`M16 16H8V8`,key:`1w2ppm`}]]),Oe=o(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),j=d();function ke({inputRef:e,value:t,onChange:n,onComplete:r,showPin:i,autoFocus:a}){let o=(0,A.useRef)([]);function s(e,r){r.key===`Backspace`?(r.preventDefault(),t[e]?n(t.slice(0,e)+t.slice(e+1)):e>0&&(n(t.slice(0,e-1)+t.slice(e)),o.current[e-1]?.focus())):r.key===`ArrowLeft`&&e>0?o.current[e-1]?.focus():r.key===`ArrowRight`&&e<5?o.current[e+1]?.focus():r.key===`Enter`&&(r.preventDefault(),r.currentTarget.form?.requestSubmit())}function c(e,i){let a=i.nativeEvent.data;if(!a||!/^\d$/.test(a))return;let s=t.split(``);for(s[e]=a;s.length<e;)s.push(``);let c=s.join(``).replace(/\D/g,``).slice(0,6);n(c),c.length===6?r?.(c):e<5&&o.current[e+1]?.focus()}function l(e){e.preventDefault();let t=e.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,6);t&&(n(t),t.length===6?r?.(t):o.current[t.length]?.focus())}return(0,j.jsx)(`div`,{className:`pin-field`,children:Array.from({length:6}).map((n,r)=>(0,j.jsx)(`input`,{ref:t=>{o.current[r]=t,r===0&&e&&(e.current=t)},type:`text`,inputMode:`numeric`,className:`pin-box${t[r]?` pin-box-filled`:``}`,value:t[r]?i?t[r]:`•`:``,onKeyDown:e=>s(r,e),onInput:e=>c(r,e),onPaste:l,onFocus:e=>e.target.select(),autoFocus:a&&r===0,autoComplete:`off`,maxLength:1,"aria-label":`PIN digit ${r+1}`},r))})}function Ae(e){let{pin:t,setPin:n,showPin:i,setShowPin:a,pinLoading:o,pinError:c,pinInputRef:l,setPinFormRef:u,onSubmit:d,operatorName:f,setOperatorName:p}=e;return(0,j.jsx)(`div`,{className:`connect-page`,children:(0,j.jsxs)(`div`,{className:`connect-content`,children:[(0,j.jsx)(`img`,{src:s,alt:r.productName,className:`connect-logo connect-logo--maxy`}),!r.logoContainsName&&(0,j.jsxs)(`h1`,{className:`connect-title`,children:[`Welcome to `,r.productName]}),(0,j.jsxs)(`p`,{className:`connect-subtitle`,children:[`Tell `,r.productName,` who you are, then choose a PIN.`]}),(0,j.jsxs)(`form`,{ref:u,onSubmit:d,className:`connect-pin-form`,children:[(0,j.jsxs)(`div`,{className:`pin-input-row`,children:[(0,j.jsx)(`input`,{type:`text`,className:`connect-name-input`,placeholder:`Your full name`,value:f,onChange:e=>p(e.target.value),autoComplete:`name`,autoFocus:!0,required:!0,"aria-label":`Your full name`}),(0,j.jsx)(`div`,{style:{width:38,flexShrink:0},"aria-hidden":`true`})]}),(0,j.jsxs)(`div`,{className:`pin-input-row`,children:[(0,j.jsx)(ke,{inputRef:l,value:t,onChange:n,onComplete:()=>{},showPin:i}),(0,j.jsx)(k,{variant:`send`,type:`submit`,disabled:!t||!f.trim(),loading:o,"aria-label":`Set PIN`,children:(0,j.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,j.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,j.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,j.jsx)(ce,{checked:i,onChange:()=>a(e=>!e),label:`Show PIN`})]}),c&&(0,j.jsx)(`p`,{className:`admin-pin-error`,children:c})]})})}function je(e){let{pin:t,setPin:n,showPin:i,setShowPin:a,pinLoading:o,pinError:c,pinInputRef:l,onSubmit:u,onChangePin:d,remoteAuthEnabled:f,onSignOutRemote:p}=e;return(0,j.jsxs)(`div`,{className:`connect-page`,children:[f&&p&&(0,j.jsx)(`button`,{type:`button`,className:`connect-signout`,onClick:p,children:`Sign out`}),(0,j.jsxs)(`div`,{className:`connect-content`,children:[(0,j.jsx)(`img`,{src:s,alt:r.productName,className:`connect-logo connect-logo--maxy`}),!r.logoContainsName&&(0,j.jsx)(`h1`,{className:`connect-title`,children:r.productName}),(0,j.jsxs)(`form`,{onSubmit:u,className:`connect-pin-form`,children:[(0,j.jsxs)(`div`,{className:`pin-input-row`,children:[(0,j.jsx)(ke,{inputRef:l,value:t,onChange:n,onComplete:()=>{},showPin:i,autoFocus:!0}),(0,j.jsx)(k,{variant:`send`,type:`submit`,disabled:!t,loading:o,children:(0,j.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,j.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,j.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,j.jsxs)(`div`,{className:`pin-options`,children:[(0,j.jsx)(ce,{checked:i,onChange:()=>a(e=>!e),label:`Show PIN`}),(0,j.jsx)(k,{type:`button`,variant:`ghost`,onClick:d,children:`Change PIN`})]})]}),c&&(0,j.jsx)(`p`,{className:`admin-pin-error`,children:c})]})]})}function Me(e){let{accounts:t,loading:n,error:i,onSelect:a}=e;return(0,j.jsx)(`div`,{className:`connect-page`,children:(0,j.jsxs)(`div`,{className:`connect-content`,children:[(0,j.jsx)(`img`,{src:s,alt:r.productName,className:`connect-logo connect-logo--maxy`}),!r.logoContainsName&&(0,j.jsx)(`h1`,{className:`connect-title`,children:r.productName}),(0,j.jsx)(`p`,{className:`connect-subtitle`,children:`Select an account`}),(0,j.jsx)(`div`,{className:`account-picker-list`,children:t.map(e=>(0,j.jsxs)(`button`,{className:`account-picker-card`,onClick:()=>a(e.accountId),disabled:n,type:`button`,children:[(0,j.jsx)(`span`,{className:`account-picker-name`,children:e.businessName||e.accountId}),(0,j.jsx)(`span`,{className:`account-picker-role`,children:e.role}),n&&(0,j.jsx)(E,{className:`account-picker-spinner`,size:16})]},e.accountId))}),i&&(0,j.jsx)(`p`,{className:`admin-pin-error`,children:i})]})})}function Ne(e){let{authPolling:t,setAuthPolling:n,authLoading:i,setAuthLoading:a,pinError:o,setPinError:c,setAppState:l}=e,[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(!1);async function m(){p(!0),c(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`launch-browser`})})).json();e.launched?d(!0):e.error&&c(e.error)}catch(e){console.error(`[admin] browser launch error:`,e),c(`Could not launch browser.`)}p(!1)}async function h(){a(!0),c(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`})).json();if(e.started){n(!0),d(!0),a(!1);for(let e=0;e<120;e++)if(await new Promise(e=>setTimeout(e,2e3)),(await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`wait`})})).json()).authenticated){await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),l(`enter-pin`);return}c(`Timed out waiting for sign-in. Try again.`),n(!1)}else e.error&&c(e.error)}catch(e){console.error(`[admin] auth flow error:`,e),c(`Could not start auth flow.`)}a(!1)}async function g(){await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),n(!1),c(``)}return t||u?(0,j.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100dvh`,overflow:`auto`},children:[(0,j.jsxs)(`header`,{className:`chat-header`,style:{paddingBottom:`12px`,flexShrink:0,position:`relative`,maxWidth:`680px`,width:`100%`,margin:`0 auto`,padding:`24px 20px 12px`},children:[t?(0,j.jsx)(`button`,{onClick:g,style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Cancel`,children:`✕`}):(0,j.jsx)(`button`,{onClick:()=>d(!1),style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Close browser`,children:`✕`}),(0,j.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`chat-logo`}),(0,j.jsx)(`h1`,{className:`chat-tagline`,children:`Connect Claude`}),(0,j.jsx)(`p`,{className:`chat-intro`,children:t?`Sign in and authorize in the browser below.`:`Open your email or prepare your accounts, then sign in.`}),!t&&(0,j.jsx)(`div`,{style:{marginTop:`12px`},children:(0,j.jsx)(k,{variant:`primary`,onClick:h,disabled:i,children:i?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`})})]}),(0,j.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0,gap:`10px`,padding:`0 0 16px`},children:(0,j.jsx)(`iframe`,{src:`/vnc-viewer.html`,style:{flex:1,width:`100%`,minHeight:0,border:`none`,background:`#111`,display:`block`},title:`Claude Sign-in`})}),o&&(0,j.jsx)(`p`,{className:`admin-pin-error`,style:{textAlign:`center`,padding:`0 20px 16px`},children:o})]}):(0,j.jsx)(`div`,{className:`connect-page`,children:(0,j.jsxs)(`div`,{className:`connect-content`,children:[(0,j.jsxs)(`div`,{className:`connect-logos`,children:[(0,j.jsx)(`div`,{className:`connect-logo-wrap`,children:(0,j.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`connect-logo`})}),(0,j.jsx)(`svg`,{className:`connect-arrow`,viewBox:`0 0 48 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,j.jsx)(`path`,{d:`M0 12h44m0 0l-8-8m8 8l-8 8`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,j.jsxs)(`div`,{className:`connect-logo-wrap`,children:[(0,j.jsx)(`img`,{src:s,alt:r.productName,className:`connect-logo connect-logo--maxy`}),!r.logoContainsName&&(0,j.jsx)(`span`,{className:`connect-logo-label`,children:r.productName})]})]}),(0,j.jsxs)(`h1`,{className:`connect-title`,children:[`Connect Claude to power `,r.productName]}),(0,j.jsx)(`p`,{className:`connect-subtitle`,children:`Sign in with your Anthropic account to get started.`}),(0,j.jsx)(k,{variant:`primary`,onClick:h,disabled:i,children:i?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`}),(0,j.jsx)(`p`,{style:{marginTop:`6px`,fontSize:`11px`,color:`#999`,maxWidth:`300px`,textAlign:`center`,lineHeight:`1.4`},children:`First time? You may need to sign into your email and Anthropic account in the browser before connecting.`}),(0,j.jsx)(`button`,{onClick:m,disabled:f,style:{marginTop:`12px`,background:`none`,border:`none`,color:`var(--color-primary, #666)`,fontSize:`13px`,cursor:`pointer`,textDecoration:`underline`,textUnderlineOffset:`3px`},children:f?`Launching…`:`Open browser first`}),o&&(0,j.jsx)(`p`,{className:`admin-pin-error`,children:o})]})})}var Pe=`maxy-shell-artefact-px`;function Fe(){if(typeof window>`u`)return 320;let e=window.innerWidth,t=document.querySelector(`.platform > .side`)?.getBoundingClientRect(),n=t?t.right:Math.round(e*.3);return Le(Math.round((e-n)*(2/3)))}function Ie(){if(typeof window>`u`)return 320;try{let e=window.localStorage.getItem(Pe);if(!e)return Fe();let t=parseInt(e,10);if(Number.isFinite(t)&&t>=320)return t}catch{}return Fe()}function Le(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=document.querySelector(`.platform > .side`)?.getBoundingClientRect(),r=n?n.right:Math.round(t*.3),i=Math.max(320,t-r-480);return Math.min(Math.max(e,320),i)}function Re({targetSelector:e=`.platform`}){let t=(0,A.useRef)(null),[n,r]=(0,A.useState)(()=>Ie()),i=(0,A.useRef)(n);(0,A.useEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--artefact-px`,`${n}px`),i.current=n)},[n,e]);let a=(0,A.useCallback)(()=>{r(e=>{let t=Le(e);return t===e?e:t})},[]);(0,A.useEffect)(()=>(a(),window.addEventListener(`resize`,a),()=>window.removeEventListener(`resize`,a)),[a]);let o=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let a=!1,o=e=>{a=!0,r(Le(Math.round(window.innerWidth-e.clientX)))},s=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),!a)return;let t=i.current;try{window.localStorage.setItem(Pe,String(t))}catch{}console.info(`[admin-ui] artefact-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=Fe();r(e);try{window.localStorage.removeItem(Pe)}catch{}console.info(`[admin-ui] artefact-resize px=${e}`)};return(0,j.jsx)(`div`,{ref:t,className:`art-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize artefact pane`,onPointerDown:o,onDoubleClick:s})}async function*ze(e,t){let n=await fetch(e,{signal:t});if(n.status===202)throw Error(`transcript not yet on disk; reopen after first turn`);if(!n.ok)throw Error(`stream-failed status=${n.status}`);let r=n.body;if(!r)throw Error(`stream-failed no-body`);let i=r.getReader(),a=new TextDecoder(`utf-8`),o=``,s=0,c=new Promise(e=>{let n={value:void 0,done:!0};if(t.aborted){e(n);return}t.addEventListener(`abort`,()=>e(n),{once:!0})});try{for(;;){if(t.aborted)return;let{value:e,done:n}=await Promise.race([i.read(),c]);if(t.aborted)return;if(n)break;o+=a.decode(e,{stream:!0});let r=o.split(`
|
|
2
2
|
`);o=r.pop()??``;for(let e of r)s++,yield Be(e,s)}let e=o+a.decode();e.length>0&&(s++,yield Be(e,s))}finally{try{await i.cancel()}catch{}}}function Be(e,t){try{return{kind:`json`,raw:e,parsed:JSON.parse(e),lineNumber:t}}catch(n){return{kind:`parse-error`,raw:e,lineNumber:t,error:n instanceof Error?n.message:String(n)}}}var Ve=28,He=240,Ue=16,We=8;function Ge(e,t){switch(t.type){case`append`:{let n=e.lines.length>=5e4?[...e.lines.slice(1),t.line]:[...e.lines,t.line],r=e.lines.length>=5e4?e.droppedCount+1:e.droppedCount;return{...e,lines:n,droppedCount:r}}case`complete`:return{...e,streamStatus:`complete`};case`error`:return{...e,streamStatus:`error`,errorMessage:t.message}}}var Ke={lines:[],droppedCount:0,streamStatus:`streaming`,errorMessage:null};function qe(e){if(e.kind===`parse-error`)return{label:`parse-error`,tone:`error`};let t=e.parsed;if(!t||typeof t!=`object`)return{label:`raw`,tone:`raw`};let n=typeof t.type==`string`?t.type:null,r=typeof t.role==`string`?t.role:null;return n===`user`||r===`user`?{label:`user`,tone:`user`}:n===`assistant`||r===`assistant`?{label:`assistant`,tone:`assistant`}:n===`tool_use`?{label:`tool_use`,tone:`tool`}:n===`tool_result`?{label:`tool_result`,tone:`tool`}:n===`system`?{label:`system`,tone:`system`}:{label:`raw`,tone:`raw`}}function Je(e,t,n){let r=He-Ve,i=0,a=Math.max(0,e-1);for(;i<a;){let e=i+a+1>>1,o=0;for(;o<t.length&&t[o]<e;)o++;e*Ve+o*r<=n?i=e:a=e-1}return i}function Ye(e){let{sessionId:t,cacheKey:n,displayName:r,liveStatus:i,onClose:a}=e,[o,s]=(0,A.useReducer)(Ge,Ke),[l,d]=(0,A.useState)(``),[f,p]=(0,A.useState)(()=>new Set),[m,h]=(0,A.useState)(0),[g,_]=(0,A.useState)(0),v=(0,A.useRef)(null),y=(0,A.useRef)(Date.now()),x=(0,A.useRef)(!0),S=(0,A.useRef)(0);(0,A.useEffect)(()=>(console.info(`[admin-ui] jsonl-viewer-open sessionId=${t.slice(0,8)} alive=${i===`alive`}`),()=>{let e=Date.now()-y.current;console.info(`[admin-ui] jsonl-viewer-close sessionId=${t.slice(0,8)} reason=unmount linesRendered=${S.current} ms=${e}`)}),[]),(0,A.useEffect)(()=>{let e=new AbortController,r=`/api/admin/claude-sessions/${encodeURIComponent(t)}/log?session_key=${encodeURIComponent(n)}&follow=1`,i=0;return(async()=>{try{for await(let n of ze(r,e.signal))n.kind===`parse-error`&&i<100&&(i++,console.warn(`[admin-ui] jsonl-viewer parse-error sessionId=${t.slice(0,8)} lineNumber=${n.lineNumber}`)),s({type:`append`,line:n});e.signal.aborted||s({type:`complete`})}catch(t){if(e.signal.aborted)return;s({type:`error`,message:t instanceof Error?t.message:String(t)})}})(),()=>e.abort()},[t,n]),(0,A.useEffect)(()=>{let e=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let C=(0,A.useMemo)(()=>{if(l.length===0)return o.lines;let e=l.toLowerCase();return o.lines.filter(t=>(t.kind===`json`?JSON.stringify(t.parsed):t.raw).toLowerCase().includes(e))},[o.lines,l]),w=(0,A.useMemo)(()=>[...f].sort((e,t)=>e-t),[f]),T=C.length*Ve+Math.min(w.length,C.length)*(He-Ve),ee=Math.max(0,Je(C.length,w,m)-We),E=g===0?Math.min(C.length,30):Math.ceil(g/Ve)+2*We,te=Math.min(C.length,ee+E);(0,A.useLayoutEffect)(()=>{let e=v.current;e&&x.current&&(e.scrollTop=e.scrollHeight)},[C.length,T]);let ne=(0,A.useCallback)(e=>{let t=e.currentTarget;h(t.scrollTop),_(t.clientHeight),x.current=t.scrollHeight-t.scrollTop-t.clientHeight<Ue},[]),D=(0,A.useCallback)(e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),re=(0,A.useCallback)(async e=>{await u(e)},[]),O=(0,A.useCallback)(e=>{let t=0;for(;t<w.length&&w[t]<e;)t++;return e*Ve+t*(He-Ve)},[w]),ie=Xe(o,i),ae=C.length===o.lines.length?0:o.lines.length-C.length;return S.current=o.lines.length,(0,j.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`JSONL viewer`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&a()},children:(0,j.jsxs)(`div`,{className:`modal-card jsonl-viewer-card`,children:[(0,j.jsxs)(`header`,{className:`jsonl-viewer-header`,children:[(0,j.jsxs)(`div`,{className:`jsonl-viewer-title`,children:[(0,j.jsx)(`strong`,{children:r??`session`}),(0,j.jsx)(`span`,{"data-mono":!0,className:`jsonl-viewer-sid`,children:t.slice(0,8)})]}),(0,j.jsx)(`input`,{type:`text`,className:`jsonl-viewer-search`,placeholder:`search…`,value:l,onChange:e=>d(e.target.value),"aria-label":`Filter visible lines`}),(0,j.jsxs)(`div`,{className:`jsonl-viewer-counts`,children:[(0,j.jsxs)(`span`,{children:[C.length.toLocaleString(),` lines`]}),ae>0&&(0,j.jsxs)(`span`,{children:[` · `,ae.toLocaleString(),` hidden`]}),o.droppedCount>0&&(0,j.jsxs)(`span`,{children:[` · `,o.droppedCount.toLocaleString(),` older dropped`]})]}),(0,j.jsx)(`button`,{type:`button`,className:`action-btn`,"aria-label":`Close JSONL viewer`,onClick:a,children:(0,j.jsx)(b,{size:14})})]}),(0,j.jsx)(`div`,{ref:v,className:`jsonl-viewer-scroll`,onScroll:ne,children:(0,j.jsx)(`div`,{className:`jsonl-viewer-inner`,style:{height:T},children:C.slice(ee,te).map((e,t)=>{let n=ee+t,r=f.has(n),i=O(n),a=qe(e),o={position:`absolute`,top:i,left:0,right:0,height:r?He:Ve},s=(e.kind,e.raw.slice(0,200));return(0,j.jsxs)(`div`,{className:`jsonl-viewer-row`,"data-expanded":r||void 0,"data-tone":a.tone,style:o,children:[(0,j.jsxs)(`button`,{type:`button`,className:`jsonl-viewer-row__main`,onClick:()=>D(n),"aria-expanded":r,children:[(0,j.jsx)(`span`,{className:`jsonl-viewer-badge`,"data-tone":a.tone,children:a.label}),(0,j.jsx)(`span`,{className:`jsonl-viewer-line-no`,"data-mono":!0,children:e.lineNumber}),r?(0,j.jsxs)(`pre`,{className:`jsonl-viewer-pre`,"data-mono":!0,children:[e.kind===`json`?Ze(e.parsed):e.raw,e.kind===`parse-error`&&(0,j.jsx)(`span`,{className:`jsonl-viewer-error`,children:`\n\n[parse-error] ${e.error}`})]}):(0,j.jsx)(`span`,{className:`jsonl-viewer-preview`,"data-mono":!0,children:s})]}),(0,j.jsx)(`button`,{type:`button`,className:`jsonl-viewer-copy`,title:`Copy raw line`,onClick:()=>void re(e.raw),children:(0,j.jsx)(c,{size:12})})]},`${e.lineNumber}-${n}`)})})}),(0,j.jsx)(`footer`,{className:`jsonl-viewer-footer`,children:(0,j.jsx)(`span`,{className:`jsonl-viewer-status`,"data-tone":ie.tone,children:ie.label})})]})})}function Xe(e,t){return e.streamStatus===`error`?{label:`error: ${e.errorMessage??`stream failed`}`,tone:`error`}:t===`alive`?{label:`streaming`,tone:`streaming`}:{label:`complete`,tone:`complete`}}function Ze(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Qe(e){return{pid:e.pid,url:e.url,startedAt:e.startedAt,accountId:e.senderId,role:e.role,channel:e.channel,jsonlPath:e.jsonlPath,status:e.status,archived:e.archived===!0,displayName:e.displayName,titleSource:e.titleSource===`user`||e.titleSource===`ai`?e.titleSource:null,lastMessageAt:e.lastMessageAt,turnCount:e.turnCount,capped:e.capped,sizeBytes:e.sizeBytes,sessionId:e.sessionId,specialist:e.specialist,model:e.model,permissionMode:typeof e.permissionMode==`string`?e.permissionMode:null,effectivePermissionMode:typeof e.effectivePermissionMode==`string`?e.effectivePermissionMode:null}}function $e(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.round(n/1e3);if(r<60)return`${r}s ago`;let i=Math.round(r/60);if(i<60)return`${i}m ago`;let a=Math.round(i/60);return a<24?`${a}h ago`:`${Math.round(a/24)}d ago`}function et(e){return e==null?`—`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function tt(e,t,n){let r=e.permissionMode,i=e.effectivePermissionMode;return r===null&&i===null?`—`:i===null||i===r?r??i??`—`:(n.current!==t&&(n.current=t,console.warn(`[admin-ui] permission-mode-downgraded sessionId=${t.slice(0,8)} requested=${r??`null`} effective=${i}`)),(0,j.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6},children:[(0,j.jsx)(Oe,{size:14,"aria-label":`Permission mode downgraded`,style:{color:`var(--text-warn, #b8860b)`}}),(0,j.jsx)(`span`,{children:i}),(0,j.jsxs)(`span`,{className:`text-tertiary`,children:[`(requested: `,r??`null`,`, downgraded)`]})]}))}function nt({sessionId:e,cacheKey:t,onClose:n,recentsActions:o,liveRow:s,onSessionNotFound:d}){let[f,p]=(0,A.useState)(null),[_,v]=(0,A.useState)(!0),[S,w]=(0,A.useState)(null),[ee,te]=(0,A.useState)(!1),[re,O]=(0,A.useState)(null),[ie,ae]=(0,A.useState)(null),[oe,se]=(0,A.useState)(null),[ce,le]=(0,A.useState)(!1),[k,ue]=(0,A.useState)(!1),de=(0,A.useRef)(null),fe=C(t,o,`pane`),{isPinned:pe,togglePin:me}=T(r.hostname),[he,ge]=(0,A.useState)(!1),[_e,ve]=(0,A.useState)(``),be=(0,A.useRef)(s?.status),xe=s?.status,Se=(0,A.useRef)(null),Ce=(0,A.useCallback)(async()=>{v(!0),w(null);try{let n=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(e)}/meta?session_key=${encodeURIComponent(t)}`);if(n.status===404){let t=be.current??`alive`;console.info(`[admin-ui] sidebar-meta-pane-reconcile sessionId=${e.slice(0,8)} from=${t} to=gone trigger=404`),te(!0),p(null),d&&d(e);return}if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`meta returned ${n.status} ${e.slice(0,200)}`)}p(Qe(await n.json())),te(!1)}catch(e){w(e instanceof Error?e.message:String(e)),console.error(`[admin-ui] sidebar-meta-pane fetch failed:`,e)}finally{v(!1)}},[e,t,d]);(0,A.useEffect)(()=>{console.info(`[admin-ui] sidebar-meta-pane sessionId=${e.slice(0,8)}`),Ce()},[Ce,e]),(0,A.useEffect)(()=>{let t=be.current;if(be.current=xe,!(t===void 0&&xe!==void 0)&&t!==xe){if(t===`alive`&&xe===`ended`){console.info(`[admin-ui] sidebar-meta-pane-reconcile sessionId=${e.slice(0,8)} from=alive to=ended trigger=list-flip`),Ce();return}if(t!==void 0&&xe===void 0){console.info(`[admin-ui] sidebar-meta-pane-reconcile sessionId=${e.slice(0,8)} from=${t} to=gone trigger=list-flip`),Ce();return}}},[xe,Ce,e]),(0,A.useEffect)(()=>{if(!ce)return;let e=e=>{de.current&&!de.current.contains(e.target)&&le(!1)},t=e=>{e.key===`Escape`&&le(!1)};return document.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[ce]);let we=(0,A.useCallback)(async(e,t)=>{O(await u(t)?`Copied ${e}`:`Copy failed`),window.setTimeout(()=>O(null),1500)},[]),Te=(0,A.useCallback)(()=>{let n=`/api/admin/claude-sessions/${encodeURIComponent(e)}/log?session_key=${encodeURIComponent(t)}&download=1`;try{let t=document.createElement(`a`);t.href=n,t.download=``,t.rel=`noopener`,document.body.appendChild(t),t.click(),document.body.removeChild(t),console.info(`[admin-ui] pane-download-jsonl sessionId=${e.slice(0,8)} outcome=initiated`)}catch(t){let n=t instanceof Error?t.message:String(t);console.error(`[admin-ui] pane-download-jsonl sessionId=${e.slice(0,8)} outcome=error reason=${n}`),ae(`Download failed: ${n}`)}},[e,t]),De=(0,A.useCallback)(async(e,t,r)=>{ae(null);let i=e===`resume`?await fe.resume(t):e===`end`?await fe.end(t):e===`purge`?await fe.purge(t):e===`archive`?await fe.archive(t):await fe.unarchive(t);if(!i.ok){ae(i.error??`action failed`);return}r&&n()},[fe,n]);if(ee&&s===void 0)return(0,j.jsxs)(`main`,{className:`session-meta-pane`,style:{padding:24,display:`flex`,flexDirection:`column`,gap:12},children:[(0,j.jsx)(`p`,{style:{margin:0,fontSize:13,color:`var(--text-secondary)`},children:`Session ended without a transcript. Close this pane.`}),(0,j.jsx)(`div`,{children:(0,j.jsxs)(`button`,{type:`button`,className:`action-btn`,onClick:n,children:[(0,j.jsx)(b,{size:14}),` Close`]})})]});if(_&&!f)return(0,j.jsx)(`main`,{className:`session-meta-pane`,style:{padding:24},children:(0,j.jsx)(E,{size:16,className:`spinning`})});if(S&&!f)return(0,j.jsxs)(`main`,{className:`session-meta-pane`,style:{padding:24},children:[(0,j.jsx)(`p`,{style:{color:`var(--text-tertiary)`},children:S}),(0,j.jsx)(`button`,{type:`button`,className:`action-btn`,onClick:()=>void Ce(),children:`Retry`})]});if(!f)return null;let Oe=f.status===`alive`,ke=pe(e),Ae=fe.inFlight,je=f.url?f.url.match(/session_[A-Za-z0-9]+/)?.[0]??null:null;return(0,j.jsxs)(`main`,{className:`session-meta-pane`,style:{padding:24,display:`flex`,flexDirection:`column`,gap:20,overflowY:`auto`},children:[(0,j.jsxs)(`header`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[he?(0,j.jsx)(`input`,{type:`text`,value:_e,autoFocus:!0,maxLength:200,onChange:e=>ve(e.target.value),onKeyDown:async t=>{if(t.key===`Enter`){t.preventDefault();let n=_e.trim();if(n.length===0||!y(n)){ge(!1);return}if(n===(f.displayName??``)){ge(!1);return}let r=await fe.rename(e,n);r.ok?p(e=>e&&{...e,displayName:n,titleSource:`user`}):console.error(`[admin-ui] pane-rename failed: ${r.error}`),ge(!1)}else t.key===`Escape`&&(t.preventDefault(),ge(!1))},onBlur:async()=>{let t=_e.trim();if(t.length===0||!y(t)||t===(f.displayName??``)){ge(!1);return}let n=await fe.rename(e,t);n.ok?p(e=>e&&{...e,displayName:t,titleSource:`user`}):console.error(`[admin-ui] pane-rename failed: ${n.error}`),ge(!1)},"aria-label":`Rename session`,style:{fontSize:22,fontWeight:600,flex:1,background:`transparent`,border:`1px solid var(--border, #888)`,borderRadius:4,padding:`2px 6px`,color:`inherit`,font:`inherit`,minWidth:0}}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`h2`,{style:{fontSize:22,fontWeight:600,margin:0,flex:1},children:f.displayName??(0,j.jsx)(`span`,{style:{color:`var(--text-tertiary)`},children:`(unnamed)`})}),f.titleSource&&(0,j.jsx)(`span`,{style:{fontSize:11,color:`var(--text-tertiary)`},children:f.titleSource===`user`?`set by you`:`set by Claude`}),(0,j.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`Rename session`,title:`Rename`,onClick:()=>{ve(f.displayName??``),ge(!0)},children:(0,j.jsx)(g,{size:16})})]}),(0,j.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`Close pane`,onClick:n,children:(0,j.jsx)(b,{size:18})})]}),(0,j.jsx)(`section`,{children:(0,j.jsxs)(`dl`,{className:`meta-dl`,children:[(0,j.jsx)(`dt`,{children:`Status`}),(0,j.jsx)(`dd`,{children:Oe?`alive · pid ${f.pid??`?`}`:`ended`}),(0,j.jsx)(`dt`,{children:`Agent`}),(0,j.jsx)(`dd`,{children:f.specialist??`admin`}),(0,j.jsx)(`dt`,{title:`Permission mode. The operator's spawn-time choice is the requested mode; the binary may downgrade auto to default at runtime if the auto-mode opt-in isn't satisfied.`,children:`Mode`}),(0,j.jsx)(`dd`,{children:tt(f,e,Se)}),(0,j.jsx)(`dt`,{title:`Model id from the most recent assistant turn in the JSONL tail. Null until the first assistant turn flushes; reflects the latest model used (claude can downgrade mid-session).`,children:`Model`}),(0,j.jsx)(`dd`,{children:f.model??`—`}),(0,j.jsx)(`dt`,{title:`Claude's session — one identity, two phases: bridge suffix from claude.ai/code/<session_xxx> and the JSONL basename UUID on disk. Both reconcile to the same row.`,children:`sessionId`}),(0,j.jsxs)(`dd`,{"data-mono":!0,children:[(0,j.jsx)(`span`,{children:e}),(0,j.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`Copy sessionId`,onClick:()=>void we(`sessionId`,e),children:(0,j.jsx)(c,{size:12})})]}),(0,j.jsx)(`dt`,{children:`Started at`}),(0,j.jsxs)(`dd`,{children:[f.startedAt,` `,(0,j.jsxs)(`span`,{className:`text-tertiary`,children:[`(`,$e(f.startedAt),`)`]})]}),(0,j.jsx)(`dt`,{children:`Last message`}),(0,j.jsx)(`dd`,{children:f.lastMessageAt?(0,j.jsxs)(j.Fragment,{children:[f.lastMessageAt,` `,(0,j.jsxs)(`span`,{className:`text-tertiary`,children:[`(`,$e(f.lastMessageAt),`)`]})]}):`—`}),(0,j.jsx)(`dt`,{children:`Turns`}),(0,j.jsxs)(`dd`,{children:[f.turnCount,f.capped?(0,j.jsx)(`span`,{className:`text-tertiary`,children:` (≥, JSONL exceeds tail-read cap)`}):null]}),(0,j.jsx)(`dt`,{children:`JSONL size`}),(0,j.jsx)(`dd`,{children:et(f.sizeBytes)}),(0,j.jsx)(`dt`,{children:`JSONL path`}),(0,j.jsxs)(`dd`,{"data-mono":!0,children:[(0,j.jsx)(`span`,{children:f.jsonlPath??`—`}),f.jsonlPath&&(0,j.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`Copy JSONL path`,onClick:()=>void we(`path`,f.jsonlPath),children:(0,j.jsx)(c,{size:12})})]}),(0,j.jsx)(`dt`,{children:`Session URL`}),(0,j.jsxs)(`dd`,{"data-mono":!0,children:[(0,j.jsx)(`span`,{children:f.url??`—`}),f.url&&(0,j.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`Copy URL`,onClick:()=>void we(`URL`,f.url),children:(0,j.jsx)(c,{size:12})})]}),(0,j.jsx)(`dt`,{title:"Cross-surface identifier — the `session_xxx` segment from the claude.ai/code URL. Operators use this to map a browser URL back to a row.",children:`Bridge id`}),(0,j.jsxs)(`dd`,{"data-mono":!0,children:[(0,j.jsx)(`span`,{children:je??`—`}),je&&(0,j.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`Copy Bridge id`,onClick:()=>void we(`Bridge id`,je),children:(0,j.jsx)(c,{size:12})})]}),(0,j.jsx)(`dt`,{children:`Channel`}),(0,j.jsx)(`dd`,{children:f.channel??`—`}),(0,j.jsx)(`dt`,{children:`Role`}),(0,j.jsx)(`dd`,{children:f.role??`—`}),(0,j.jsx)(`dt`,{title:"Account / workspace UUID. Manager API still calls this `senderId` on the wire (channel-agnostic field).",children:`accountId`}),(0,j.jsx)(`dd`,{"data-mono":!0,children:(0,j.jsx)(`span`,{children:f.accountId||`—`})})]})}),(()=>{let t=[];return f.url&&t.push((0,j.jsxs)(`button`,{type:`button`,className:`action-btn`,onClick:()=>window.open(f.url,`_blank`,`noopener,noreferrer`),children:[(0,j.jsx)(ne,{size:14}),` Open in new tab`]},`open-tab`)),f.jsonlPath&&t.push((0,j.jsxs)(`button`,{type:`button`,className:`action-btn`,title:`Download the JSONL transcript file`,onClick:()=>Te(),children:[(0,j.jsx)(l,{size:14}),` Download JSONL`]},`download-jsonl`),(0,j.jsxs)(`button`,{type:`button`,className:`action-btn`,title:`View the JSONL transcript in-app`,onClick:()=>ue(!0),children:[(0,j.jsx)(D,{size:14}),` View JSONL`]},`view-jsonl`)),Oe||t.push((0,j.jsxs)(`button`,{type:`button`,className:`action-btn`,"data-variant":`primary`,disabled:Ae===`resume`,onClick:()=>void De(`resume`,e,!1),children:[Ae===`resume`?(0,j.jsx)(E,{size:14,className:`spinning`}):(0,j.jsx)(a,{size:14}),` Resume`]},`resume`)),t.push((0,j.jsxs)(`button`,{type:`button`,className:`action-btn`,"data-active":ke?`true`:void 0,onClick:()=>me(e),children:[(0,j.jsx)(Ee,{size:14}),` `,ke?`Unpin`:`Pin`]},`pin`),f.archived?(0,j.jsxs)(`button`,{type:`button`,className:`action-btn`,disabled:Ae===`unarchive`,onClick:()=>void De(`unarchive`,e,!0),children:[Ae===`unarchive`?(0,j.jsx)(E,{size:14,className:`spinning`}):(0,j.jsx)(m,{size:14}),` Unarchive`]},`archive`):(0,j.jsxs)(`button`,{type:`button`,className:`action-btn`,disabled:Ae===`archive`,onClick:()=>{Oe?se({action:`archive-alive`,sessionId:e,displayName:f.displayName}):De(`archive`,e,!0)},children:[Ae===`archive`?(0,j.jsx)(E,{size:14,className:`spinning`}):(0,j.jsx)(h,{size:14}),` Archive`]},`archive`)),t.push(Oe?(0,j.jsxs)(`button`,{type:`button`,className:`action-btn`,"data-variant":`danger`,disabled:Ae===`end`,onClick:()=>se({action:`end`,sessionId:e,displayName:f.displayName}),children:[(0,j.jsx)(x,{size:14}),` End session`]},`end`):(0,j.jsxs)(`button`,{type:`button`,className:`action-btn`,"data-variant":`danger`,disabled:Ae===`purge`,onClick:()=>se({action:`purge`,sessionId:e,displayName:f.displayName}),children:[(0,j.jsx)(i,{size:14}),` Purge JSONL`]},`purge`)),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`section`,{className:`action-bar`,children:t}),(0,j.jsxs)(`section`,{className:`session-actions-overflow`,ref:de,children:[(0,j.jsx)(`button`,{type:`button`,className:`session-actions-overflow__trigger`,"aria-label":`Actions`,"aria-haspopup":`menu`,"aria-expanded":ce,onClick:()=>{le(t=>{let n=!t;return n&&console.info(`[admin-ui] pane-actions-overflow-open sessionId=${e.slice(0,8)}`),n})},children:(0,j.jsx)(ye,{size:14})}),ce&&(0,j.jsx)(`div`,{className:`overflow-popover`,role:`menu`,onClick:()=>le(!1),children:t})]})]})})(),re&&(0,j.jsx)(`div`,{style:{color:`var(--text-tertiary)`,fontSize:12},children:re}),ie&&(0,j.jsx)(it,{message:ie,onClose:()=>ae(null)}),k&&f.jsonlPath&&(0,j.jsx)(Ye,{sessionId:e,cacheKey:t,displayName:f.displayName,liveStatus:f.status,onClose:()=>ue(!1)}),S&&(0,j.jsx)(`div`,{style:{color:`var(--text-tertiary)`,fontSize:12},children:S}),oe&&(0,j.jsx)(rt,{confirm:oe,busy:oe.action===`archive-alive`?Ae===`end`||Ae===`archive`:Ae===oe.action,onCancel:()=>se(null),onConfirm:async()=>{if(oe.action===`archive-alive`){ae(null);let e=await fe.end(oe.sessionId);if(!e.ok){ae(e.error??`failed to end session`),se(null);return}let t=await fe.archive(oe.sessionId);if(!t.ok){ae(t.error??`failed to archive session`),se(null);return}se(null),n();return}await De(oe.action,oe.sessionId,oe.action===`purge`),se(null)}})]})}function rt({confirm:e,busy:t,onCancel:n,onConfirm:r}){let i,a,o,s=e.displayName??e.sessionId.slice(0,8);switch(e.action){case`end`:i=`End live session?`,a=`This kills the PTY for ${s}. The JSONL is kept on disk and can be resumed later.`,o=`End session`;break;case`purge`:i=`Purge session JSONL?`,a=`This hard-deletes the transcript for ${s}. The action cannot be undone.`,o=`Purge`;break;case`archive-alive`:i=`Session is still running`,a=`End ${s} before archiving? The JSONL is kept and the row moves to the archive.`,o=`End and archive`;break}return(0,j.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&!t&&n()},children:(0,j.jsxs)(`div`,{className:`modal-card`,children:[(0,j.jsx)(`h3`,{style:{margin:0,marginBottom:8,fontSize:16,fontWeight:600},children:i}),(0,j.jsx)(`p`,{style:{margin:0,marginBottom:12,fontSize:13},children:a}),(0,j.jsxs)(`div`,{className:`modal-action-row`,children:[(0,j.jsx)(`button`,{type:`button`,className:`modal-action-btn`,disabled:t,onClick:n,children:`Cancel`}),(0,j.jsx)(`button`,{type:`button`,className:`modal-action-btn`,"data-variant":`danger`,disabled:t,onClick:()=>r(),children:t?(0,j.jsx)(E,{size:13,className:`spinning`}):o})]})]})})}function it({message:e,onClose:t}){return(0,j.jsx)(`div`,{role:`alertdialog`,"aria-modal":`true`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,j.jsxs)(`div`,{className:`modal-card`,children:[(0,j.jsx)(`h3`,{style:{margin:0,marginBottom:8,fontSize:16,fontWeight:600},children:`Action failed`}),(0,j.jsx)(`p`,{style:{margin:0,marginBottom:12,fontSize:13,wordBreak:`break-word`},children:e}),(0,j.jsx)(`div`,{className:`modal-action-row`,children:(0,j.jsx)(`button`,{type:`button`,className:`modal-action-btn`,onClick:t,children:`OK`})})]})})}function at({onOpen:e}){return(0,j.jsx)(`footer`,{className:`admin-footer`,children:(0,j.jsxs)(`div`,{className:`powered-by`,role:`button`,tabIndex:0,onClick:e,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())},"aria-label":`Powered by Claude Code — show details`,children:[(0,j.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`powered-by-icon`}),(0,j.jsx)(`span`,{children:`Powered by Claude Code`})]})})}var ot=t((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),st=t(((e,t)=>{t.exports=ot()})),ct=st(),lt=e(f(),1);function ut(e){this.content=e}ut.prototype={constructor:ut,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new ut(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new ut(n)},addToStart:function(e,t){return new ut([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new ut(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new ut(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=ut.from(e),e.size?new ut(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=ut.from(e),e.size?new ut(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ut.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},ut.from=function(e){if(e instanceof ut)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new ut(t)};function dt(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=dt(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function ft(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=ft(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var M=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return dt(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return ft(this,e,t,n)}findIndex(e){if(e==0)return mt(0,e);if(e==this.size)return mt(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?mt(t+1,i):mt(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};M.empty=new M([],0);var pt={index:0,offset:0};function mt(e,t){return pt.index=e,pt.offset=t,pt}function ht(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!ht(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!ht(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var N=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ht(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};N.none=[];var gt=class extends Error{},P=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=vt(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(_t(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(M.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};P.empty=new P(M.empty,0,0);function _t(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(_t(a.content,t-i-1,n-i-1)))}function vt(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=vt(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function yt(e,t,n){if(n.openStart>e.depth)throw new gt(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new gt(`Inconsistent open depths`);return bt(e,t,n,0)}function bt(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=bt(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Tt(a,Dt(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Tt(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Ot(n,e);return Tt(a,Et(e,i,o,t,r))}}function xt(e,t){if(!t.type.compatibleContent(e.type))throw new gt(`Cannot join `+t.type.name+` onto `+e.type.name)}function St(e,t,n){let r=e.node(n);return xt(r,t.node(n)),r}function Ct(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function wt(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Ct(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Ct(i.child(e),r);t&&t.depth==n&&t.textOffset&&Ct(t.nodeBefore,r)}function Tt(e,t){return e.type.checkContent(t),e.copy(t)}function Et(e,t,n,r,i){let a=e.depth>i&&St(e,t,i+1),o=r.depth>i&&St(n,r,i+1),s=[];return wt(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(xt(a,o),Ct(Tt(a,Et(e,t,n,r,i+1)),s)):(a&&Ct(Tt(a,Dt(e,t,i+1)),s),wt(t,n,i,s),o&&Ct(Tt(o,Dt(n,r,i+1)),s)),wt(r,null,i,s),new M(s)}function Dt(e,t,n){let r=[];return wt(null,e,n,r),e.depth>n&&Ct(Tt(St(e,t,n+1),Dt(e,t,n+1)),r),wt(t,null,n,r),new M(r)}function Ot(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(M.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var kt=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return N.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Nt(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Mt.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Mt.set(t,r=new At);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%jt,i}},At=class{constructor(){this.elts=[],this.i=0}},jt=12,Mt=new WeakMap,Nt=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},Pt=Object.create(null),Ft=class e{constructor(e,t,n,r=N.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&ht(this.attrs,t||e.defaultAttrs||Pt)&&N.sameSet(this.marks,n||N.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return P.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new P(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return yt(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return kt.resolveCached(this,e)}resolveNoCache(e){return kt.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),Lt(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=M.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=N.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!N.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=M.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Ft.prototype.text=void 0;var It=class e extends Ft{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Lt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Lt(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Rt=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new zt(t,n);if(r.next==null)return e.empty;let i=Bt(r);r.next&&r.err(`Unexpected trailing text`);let a=Xt(qt(i));return Zt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return M.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
3
3
|
`)}};Rt.empty=new Rt(!0);var zt=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Bt(e){let t=[];do t.push(Vt(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Vt(e){let t=[];do t.push(Ht(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Ht(e){let t=Kt(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Wt(e,t);else break;return t}function Ut(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Wt(e,t){let n=Ut(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Ut(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Gt(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Kt(e){if(e.eat(`(`)){let t=Bt(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Gt(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function qt(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Jt(e,t){return t-e}function Yt(e,t){let n=[];return r(t),n.sort(Jt);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Xt(e){let t=Object.create(null);return n(Yt(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Yt(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Rt(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Jt);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Zt(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Qt(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function $t(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function en(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function tn(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new an(e,r,t[r]);return n}var nn=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=tn(e,n.attrs),this.defaultAttrs=Qt(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Rt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:$t(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Ft(this,this.computeAttrs(e),M.from(t),N.setFrom(n))}createChecked(e=null,t,n){return t=M.from(t),this.checkContent(t),new Ft(this,this.computeAttrs(e),t,N.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=M.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(M.empty,!0);return i?new Ft(this,e,t.append(i),N.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){en(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:N.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function rn(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var an=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?rn(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},on=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=tn(e,r.attrs),this.excluded=null;let i=Qt(this.attrs);this.instance=i?new N(this,i):null}create(e=null){return!e&&this.instance?this.instance:new N(this,$t(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){en(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},sn=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=ut.from(e.nodes),t.marks=ut.from(e.marks||{}),this.nodes=nn.compile(this.spec.nodes,this),this.marks=on.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Rt.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?cn(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:cn(this,n.split(` `))}this.nodeFromJSON=e=>Ft.fromJSON(this,e),this.markFromJSON=e=>N.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof nn))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new It(n,n.defaultAttrs,e,N.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function cn(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function ln(e){return e.tag!=null}function un(e){return e.style!=null}var dn=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ln(e))this.tags.push(e);else if(un(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new bn(this,t,!1);return n.addAll(e,N.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new bn(this,t,!0);return n.addAll(e,N.none,t.from,t.to),P.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Sn(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Cn(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Cn(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},fn={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},pn={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},mn={ol:!0,ul:!0},hn=1,gn=2,_n=4;function vn(e,t,n){return t==null?e&&e.whitespace==`pre`?hn|gn:n&~_n:(t?hn:0)|(t===`full`?gn:0)}var yn=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=N.none,this.match=i||(a&_n?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(M.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&hn)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=M.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!fn.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},bn=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=vn(null,t.preserveWhitespace,0)|(n?_n:0);i=r?new yn(r.type,r.attrs,N.none,!0,t.topMatch||r.type.contentMatch,a):n?new yn(null,null,N.none,!0,null,a):new yn(e.schema.topNodeType,null,N.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&gn?`full`:this.localPreserveWS||(r.options&hn)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
4
4
|
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;mn.hasOwnProperty(a)&&this.parser.normalizeLists&&xn(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:pn.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(fn.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,u as t}from"./ChatInput-CJo_77bp.js";import"./graph-labels-
|
|
1
|
+
import{_ as e,u as t}from"./ChatInput-CJo_77bp.js";import"./graph-labels-BRXJHNYE.js";import{t as n}from"./page-B4oirCvn.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,u as t}from"./ChatInput-CJo_77bp.js";import"./graph-labels-
|
|
1
|
+
import{_ as e,u as t}from"./ChatInput-CJo_77bp.js";import"./graph-labels-BRXJHNYE.js";import{n}from"./page-FmJ7PIYx.js";import"./Checkbox-YrQovXpN.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DD-I1_y5.js";import{a as t,c as n,d as r,f as i,g as a,h as o,m as s,p as c,r as l,t as u,u as d,y as f}from"./ChatInput-CJo_77bp.js";var p=a(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),m=a(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),h=a(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),g=a(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),_=a(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),v=a(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),y=a(`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`}]]),b=a(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),x=a(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),S=a(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),C=a(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),w=a(`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`}]]),T=a(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),E=a(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),ee=a(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),D=a(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),O=a(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),k=a(`refresh-cw`,[[`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`}]]),te=a(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ne=a(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),re=a(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ie=a(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ae=a(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),oe=a(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),A=e(f(),1),j=d(),M=`maxy-shell-side-px`;function N(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function P(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-N());return Math.min(Math.max(e,248),n)}function se(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(M);if(!e)return 264;let t=parseInt(e,10);if(Number.isFinite(t)&&t>=248)return P(t)}catch{}return 264}function ce({targetSelector:e=`.platform`}){let t=(0,A.useRef)(null),[n,r]=(0,A.useState)(()=>se()),i=(0,A.useRef)(n);(0,A.useEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--side-px`,`${n}px`),i.current=n)},[n,e]);let a=(0,A.useCallback)(()=>{r(e=>{let t=P(e);return t===e?e:t})},[]);(0,A.useEffect)(()=>{a(),window.addEventListener(`resize`,a);let t=document.querySelector(e),n=null;return t instanceof HTMLElement&&(n=new MutationObserver(a),n.observe(t,{attributes:!0,attributeFilter:[`data-artefact`,`class`]})),()=>{window.removeEventListener(`resize`,a),n?.disconnect()}},[a,e]);let o=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let a=!1,o=e=>{a=!0,r(P(Math.round(e.clientX)))},s=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),!a)return;let t=i.current;try{window.localStorage.setItem(M,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=P(264);r(e);try{window.localStorage.removeItem(M)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,j.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var le=!1;function ue(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function de(){let e=typeof crypto<`u`&&typeof crypto.randomUUID==`function`;if(!le){le=!0;let t=typeof window<`u`&&`isSecureContext`in window?window.isSecureContext:!1;console.info(`[idempotency] uuid-source=${e?`native`:`getRandomValues`} secureContext=${t}`)}return e?crypto.randomUUID():ue()}function fe(e){let t=e.trim();return t.length>=1&&t.length<=200}function F(e,t,n,r){let i=e===`pane`?`pane-action`:`sidebar-${t}`;console.info(`[admin-ui] ${i} sessionId=${n.slice(0,8)} action=${t} outcome=${r}`)}var pe=/session_([A-Za-z0-9_-]+)/;function me(e){if(!e)return null;let t=e.match(pe);return t?t[1]:null}async function he(e,t,n,r,i){let a=me(r)??`unknown`,o=e=>e.slice(0,8),s=t===`pane`?`pane-action action=resume-archive`:`sidebar-resume-archive`,c;try{let t=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(n)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:`archive`})});c=t.ok?`ok`:t.status===409?`409`:`error`;let r=`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=${c}`;c===`error`?console.error(r):console.info(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=error detail=${t}`)}finally{i.refetch()}}function ge(e,t,n=`pane`){let[r,i]=(0,A.useState)(null),a=(0,A.useRef)(!1),o=(0,A.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};if(a.current)return F(n,`resume`,r,`skipped-in-flight`),{ok:!1,error:`in-flight`};a.current=!0,i(`resume`);let o=de();try{let i=await fetch(`/api/admin/claude-sessions/resume?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:r,channel:`browser`,idempotencyKey:o})}),a=await i.json();if(!i.ok||!(`sessionId`in a)){let e=a.error??`POST returned ${i.status}`;return F(n,`resume`,r,String(i.status)),{ok:!1,error:e}}return t.setSessions(e=>[a,...e.filter(e=>e.sessionId!==r)]),F(n,`resume`,r,`200`),he(e,n,r,a.url,t),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return F(n,`resume`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{a.current=!1,i(null)}},[e,t,n]),s=(0,A.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`end`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/stop?session_key=${encodeURIComponent(e)}`,{method:`POST`});if(!i.ok){let e=await i.text().catch(()=>``);return F(n,`end`,r,String(i.status)),t.refetch(),{ok:!1,error:`POST /stop ${i.status} ${e.slice(0,200)}`}}return F(n,`end`,r,`204`),t.refetch(),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return F(n,`end`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{i(null)}},[e,t,n]),c=(0,A.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`purge`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}?purge=1&session_key=${encodeURIComponent(e)}`,{method:`DELETE`});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`DELETE ?purge=1 ${i.status}`;return F(n,`purge`,r,String(i.status)),{ok:!1,error:t}}return t.setSessions(e=>e.filter(e=>e.sessionId!==r)),F(n,`purge`,r,`200`),t.refetch(),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return F(n,`purge`,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]),l=(0,A.useCallback)(async(r,a)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(a);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:a})});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`POST /archive ${i.status}`;return F(n,a,r,String(i.status)),{ok:!1,error:t}}return a===`archive`&&t.setSessions(e=>e.filter(e=>e.sessionId!==r)),t.refetch(),F(n,a,r,`200`),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return F(n,a,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]);return{inFlight:r,resume:o,end:s,purge:c,archive:(0,A.useCallback)(e=>l(e,`archive`),[l]),unarchive:(0,A.useCallback)(e=>l(e,`unarchive`),[l]),rename:(0,A.useCallback)(async(t,r)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`rename`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(t)}/rename?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({title:r})});if(!i.ok){let e=await i.json().catch(()=>({})),r=e.detail||e.error||`POST /rename ${i.status}`;return F(n,`rename`,t,String(i.status)),{ok:!1,error:r,reason:e.reason}}return F(n,`rename`,t,`200`),{ok:!0}}catch(e){let r=e instanceof Error?e.message:String(e);return F(n,`rename`,t,`threw`),{ok:!1,error:r}}finally{i(null)}},[e,n])}}function _e(e){return`code.session.pinned.${e}`}function ve(e){if(typeof window>`u`)return new Set;try{let t=window.localStorage.getItem(_e(e));if(!t)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function I(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(_e(e),JSON.stringify([...t]))}catch{}}function ye(e){let[t,n]=(0,A.useState)(()=>ve(e));(0,A.useEffect)(()=>{n(ve(e))},[e]);let r=(0,A.useCallback)(t=>{n(n=>{let r=new Set(n);return r.has(t)?r.delete(t):r.add(t),I(e,r),r})},[e]);return{pinned:t,isPinned:(0,A.useCallback)(e=>t.has(e),[t]),togglePin:r}}function be(e){let{businessName:i,onNavigate:a,onToggleSidebar:o,sidebarOpen:s,onLogout:c}=e,[l,u]=(0,A.useState)(!1),d=(0,A.useRef)(null),f=(0,A.useRef)(null),[p,m]=(0,A.useState)(null),[h,g]=(0,A.useState)(!1),[v,S]=(0,A.useState)(null),[D,O]=(0,A.useState)(null),[k,te]=(0,A.useState)(null),[re,ie]=(0,A.useState)(``);(0,A.useEffect)(()=>{ie(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,A.useEffect)(()=>{if(!l)return;let e=e=>{d.current&&!d.current.contains(e.target)&&u(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[l]),(0,A.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&u(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l]),(0,A.useEffect)(()=>{l&&f.current?.focus()},[l]),(0,A.useEffect)(()=>{if(!l)return;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||te(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[l]);let ae=(0,A.useCallback)(()=>{u(e=>{let t=!e;return t&&console.info(`[admin-ui] header-menu-open`),t})},[]),M=(0,A.useCallback)(e=>{u(!1),a(e)},[a]),N=(0,A.useCallback)(async()=>{if(p!==null){m(null),O(null);return}g(!0),S(null);try{let e=await fetch(`/api/admin/agents`);if(!e.ok)throw Error(`Failed to load agents`);m((await e.json()).agents??[])}catch(e){console.error(`[admin/agents] list failed:`,e),S(e instanceof Error?e.message:String(e)),m([])}finally{g(!1)}},[p]),P=(0,A.useCallback)(e=>{O(null),m(t=>t?.filter(t=>t.slug!==e)??null),fetch(`/api/admin/agents/${encodeURIComponent(e)}`,{method:`DELETE`}).catch(e=>console.error(`[admin/agents] delete failed:`,e))},[]),se=(0,A.useCallback)(()=>{u(!1),c()},[c]),ce=i||t.productName;return(0,j.jsxs)(`header`,{className:`admin-header`,children:[(0,j.jsx)(`button`,{type:`button`,className:`admin-sidebar-toggle`,"aria-label":s?`Hide sidebar`:`Show sidebar`,title:s?`Hide sidebar`:`Show sidebar`,"aria-expanded":s,onClick:o,children:s?(0,j.jsx)(E,{size:20,strokeWidth:1.5}):(0,j.jsx)(ee,{size:20,strokeWidth:1.5})}),(0,j.jsxs)(`div`,{className:`chat-header-label`,children:[(0,j.jsx)(`span`,{className:`chat-logo-btn`,"aria-hidden":`true`,children:(0,j.jsx)(`img`,{src:n,alt:``,className:`chat-logo`})}),(0,j.jsx)(`h1`,{className:`chat-tagline`,children:ce})]}),(0,j.jsxs)(`div`,{className:`chat-burger-wrap`,ref:d,children:[(0,j.jsx)(`button`,{type:`button`,className:`admin-burger`,onClick:ae,"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":l,children:(0,j.jsx)(T,{size:20})}),l&&(0,j.jsxs)(`div`,{className:`admin-menu`,role:`menu`,children:[(0,j.jsxs)(`button`,{ref:f,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>M(`data`),children:[(0,j.jsx)(y,{size:14}),` Data`]}),(0,j.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>M(`graph`),children:[(0,j.jsx)(ne,{size:14}),` Graph`]}),(0,j.jsx)(`div`,{className:`chat-menu-divider`}),(0,j.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:N,children:[(0,j.jsx)(b,{size:14}),` Public`,h&&(0,j.jsx)(C,{size:12,className:`spin`})]}),p!==null&&(0,j.jsxs)(`div`,{className:`chat-menu-agents`,children:[v&&(0,j.jsx)(`span`,{className:`chat-menu-agent-error`,children:v}),p.length===0&&!v&&(0,j.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),p.map(e=>(0,j.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,j.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,j.jsxs)(`span`,{className:`agent-text`,children:[(0,j.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,j.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),D===e.slug?(0,j.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,j.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>P(e.slug),children:(0,j.jsx)(_,{size:12})}),(0,j.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>O(null),children:(0,j.jsx)(oe,{size:12})})]}):(0,j.jsxs)(`span`,{className:`agent-actions`,children:[(0,j.jsx)(`a`,{href:`${re}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>u(!1),children:(0,j.jsx)(b,{size:12})}),(0,j.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>O(e.slug),children:(0,j.jsx)(r,{size:12})})]})]},e.slug))]}),(0,j.jsx)(`div`,{className:`chat-menu-divider`}),(0,j.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,j.jsx)(x,{size:14}),(0,j.jsxs)(`span`,{className:`version-installed`,children:[k?`v${k.installed}`:`…`,k&&!k.updateAvailable&&(0,j.jsx)(`span`,{className:`version-uptodate-dot`}),k?.updateAvailable&&(0,j.jsx)(`span`,{className:`version-update-dot`})]})]}),(0,j.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:se,children:[(0,j.jsx)(w,{size:14}),` Log out`]})]})]})]})}var L=`maxy-admin-session`,R=typeof BroadcastChannel<`u`;function xe(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`rotation`&&typeof t.newKey==`string`&&t.newKey.length>0&&(t.surface===`chat`||t.surface===`graph`||t.surface===`data`||t.surface===`sessions`)&&typeof t.ts==`number`}function Se(e){if(!R)return()=>{};let t=new BroadcastChannel(L),n=t=>{if(!xe(t.data)){console.warn(`[admin-session-broadcast] outcome=received-malformed payload=${JSON.stringify(t.data)}`);return}e(t.data)};return t.addEventListener(`message`,n),()=>{t.removeEventListener(`message`,n),t.close()}}var z=`maxy-admin-session-key`;function Ce(e,t){return`${e}${e.includes(`?`)?`&`:`?`}session_key=${encodeURIComponent(t)}`}async function B(e){let t;try{t=await e.clone().json()}catch{return`parse-failed`}if(typeof t!=`object`||!t)return`unknown-401`;let n=t.code;return n===`session-missing`||n===`session-not-registered`||n===`session-expired-age`||n===`grant-expired`?n:`unknown-401`}function we(){try{return sessionStorage.getItem(z)}catch{return null}}function Te(e){let{initialCacheKey:t,surface:n}=e,[r,i]=(0,A.useState)(t),a=(0,A.useRef)(t);(0,A.useEffect)(()=>{a.current=r},[r]),(0,A.useEffect)(()=>{t!==a.current&&(i(t),a.current=t,s(e=>e+1))},[t]);let[o,s]=(0,A.useState)(0),[c,l]=(0,A.useState)(null);(0,A.useEffect)(()=>Se(e=>{let t=a.current.slice(0,8),r=e.newKey.slice(0,8);e.newKey!==a.current&&(console.log(`[admin-session-broadcast] outcome=received oldKey=${t} newKey=${r} surface=${n} senderSurface=${e.surface}`),i(e.newKey),s(e=>e+1),l(null))}),[n]);let u=(0,A.useCallback)(()=>{try{sessionStorage.removeItem(z)}catch{}window.location.href=`/`},[]);return{adminFetch:(0,A.useCallback)(async(e,t)=>{let r=a.current,o=Ce(e,r),c=await fetch(o,t);if(c.status!==401)return c;let d=await B(c);if(d===`session-missing`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),u(),c;if(d!==`session-not-registered`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:d}),c;let f=we();if(!f||f===r)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=session-not-registered-no-fresh-key surface=${n} path=${e}`),l({message:`Your admin session was renewed in another tab. Click to reload.`,reason:`session-not-registered`}),c;i(f),a.current=f,s(e=>e+1),console.log(`[useAdminFetch] outcome=retry-after-rotation oldKey=${r.slice(0,8)} newKey=${f.slice(0,8)} surface=${n} path=${e}`);let p=Ce(e,f),m=await fetch(p,t);return m.status===401&&(console.warn(`[useAdminFetch] outcome=redirect-to-login reason=second-401-after-retry surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:`session-not-registered`})),m},[u,n]),cacheKey:r,sessionRefetchNonce:o,banner:c,reloadToLogin:u}}var V=`/api/admin/claude-sessions/events`,H=`admin-session-list-view`,Ee=`admin-session-list-include-subagents`,U=`admin-session-list-include-background`;function De(e){return e===`active`||e===`archived`||e===`all`}function Oe(){let e={rows:[],view:`active`,includeBackground:!1,connected:!1},t=new Map,n=new Set,r=null,i=null,a=0,o=0,s=null,c=!1,l=!1;function u(){let n=[...t.values()].sort((e,t)=>t.updatedAt===e.updatedAt?e.sessionId<t.sessionId?-1:1:t.updatedAt-e.updatedAt);e={...e,rows:n}}function d(){for(let e of n)e()}function f(e,n){if(e===`row-removed`){let e=n?.sessionId;if(typeof e!=`string`||!t.delete(e))return;u(),d();return}let r=n;if(typeof r.sessionId!=`string`)return;let i={sessionId:r.sessionId,live:r.live===!0,status:r.status===`busy`?`busy`:r.status===`idle`?`idle`:r.status===`detached`?`detached`:`gone`,agentLabel:typeof r.agentLabel==`string`&&r.agentLabel.length>0?r.agentLabel:null,cwd:typeof r.cwd==`string`?r.cwd:null,firstPrompt:typeof r.firstPrompt==`string`&&r.firstPrompt.length>0?r.firstPrompt:null,titleSource:r.titleSource===`user`||r.titleSource===`ai`?r.titleSource:null,updatedAt:typeof r.updatedAt==`number`?r.updatedAt:0,url:typeof r.url==`string`&&r.url.length>0?r.url:null,archived:r.archived===!0};t.set(i.sessionId,i),u(),d()}function p(t){if(r&&s===t||(r&&=(r.close(),null),!t))return;s=t,c=!1,l=!1;let n=Ce(V,t);try{r=new EventSource(n)}catch(e){console.error(`[admin-ui] session-row-store EventSource construct failed:`,e),h(`auto`);return}r.addEventListener(`open`,()=>{c=!0,a=0,e={...e,connected:!0},d(),console.info(`[admin-ui] session-row-store connected events-received=${o}`)});for(let e of[`row-created`,`row-updated`,`row-archived`,`row-removed`])r.addEventListener(e,t=>{o+=1;try{f(e,JSON.parse(t.data))}catch(t){console.error(`[admin-ui] session-row-store parse failed kind=${e}:`,t)}});r.addEventListener(`error`,()=>{r&&=(r.close(),null),e={...e,connected:!1},d(),!c&&!l&&(l=!0,m(n)),h(`auto`)})}async function m(e){let t=a+1,n=0,r=`unknown`;try{let t=await fetch(e,{method:`GET`});n=t.status,r=t.status>=400&&t.status<500?await B(t):`unknown`}catch(e){console.error(`[admin-ui] session-row-store sse-error-probe-failed:`,e);return}console.error(`[admin-ui] session-row-store sse-error status=${n} code=${r} attempt=${t}`)}function h(e){if(i)return;a+=1;let t=Math.min(1e3*2**Math.min(a,5),3e4);console.info(`[admin-ui] session-row-store reconnect trigger=${e} attempt=${a} delay-ms=${t}`),i=setTimeout(()=>{i=null,s&&p(s)},t)}function g(){i&&=(clearTimeout(i),null),a=0,r&&=(r.close(),null),console.info(`[admin-ui] session-row-store reconnect trigger=manual attempt=0 delay-ms=0`),s&&p(s)}function _(){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(H);De(t)&&(e={...e,view:t});let n=window.localStorage.getItem(Ee);if(n===null){let e=window.localStorage.getItem(U);e!==null&&(window.localStorage.setItem(Ee,e),window.localStorage.removeItem(U),n=e,console.info(`[admin-ui] session-list-storage-migrated from=${U} to=${Ee} value=${e}`))}n===`1`&&(e={...e,includeBackground:!0})}catch{}}function v(t){e={...e,view:t};try{window.localStorage.setItem(H,t)}catch{}d()}function y(t){e={...e,includeBackground:t};try{window.localStorage.setItem(Ee,t?`1`:`0`)}catch{}d()}function b(e){return n.add(e),()=>{n.delete(e)}}function x(){return e}function S(){r&&=(r.close(),null),i&&=(clearTimeout(i),null),s=null,e={...e,connected:!1}}function C(e,t){f(e,t)}function w(t){e={...e,connected:t},d()}function T(){t.clear(),u(),d()}function E(e){let n=new Set(e),r=0;for(let e of[...t.keys()])n.has(e)||(t.delete(e),r+=1);r!==0&&(console.info(`[admin-ui] session-row-store reconcile evicted=${r} kept=${t.size}`),u(),d())}return _(),{subscribe:b,getSnapshot:x,connect:p,disconnect:S,setView:v,setIncludeBackground:y,reconnectNow:g,reconcileFromList:E,_injectEventForTesting:C,_setConnectedForTesting:w,_clearRowsForTesting:T}}var W=Oe();W._injectEventForTesting,W.connect,W._setConnectedForTesting,W.getSnapshot,W.reconcileFromList;function ke(e){let t=(0,A.useSyncExternalStore)(W.subscribe,W.getSnapshot,W.getSnapshot);(0,A.useEffect)(()=>{e&&W.connect(e)},[e]);let n=(0,A.useCallback)(e=>W.setView(e),[]),r=(0,A.useCallback)(e=>W.setIncludeBackground(e),[]),i=(0,A.useCallback)(()=>W.reconnectNow(),[]),a=(0,A.useCallback)(e=>W.reconcileFromList(e),[]);return{rows:t.rows,view:t.view,includeBackground:t.includeBackground,connected:t.connected,setView:n,setIncludeBackground:r,reconnectNow:i,reconcileFromList:a}}function Ae(e,t,n){return e.filter(e=>!(t===`active`&&e.archived||t===`archived`&&!e.archived||!n&&e.agentLabel!==null&&e.agentLabel!==`admin`))}var G=6e4,je=60*G,Me=24*je,K=G,Ne=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],q=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Pe(e){return e<10?`0${e}`:String(e)}function Fe(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Ie(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t))return`—`;let n=t-e;if(n<-K)return`—`;let r=n<0?0:n;if(r<G)return`just now`;if(r<je)return`${Math.floor(r/G)}m`;if(r<Me)return`${Math.floor(r/je)}h`;let i=new Date(t),a=new Date(e),o=Math.round((Fe(i)-Fe(a))/Me);if(o===1)return`yesterday`;if(o>=2&&o<=6)return q[a.getDay()];let s=Pe(a.getDate()),c=Ne[a.getMonth()];return a.getFullYear()===i.getFullYear()?`${s} ${c}`:`${s} ${c} ${a.getFullYear()}`}function Le(e=3e4){let[t,n]=(0,A.useState)(()=>Date.now());return(0,A.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Re={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},ze=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],Be=`Plan does not include auto mode`,Ve=[{value:void 0,label:`Default`},{value:`claude-opus-4-7`,label:`Opus 4.7`},{value:`claude-sonnet-4-6`,label:`Sonnet 4.6`},{value:`claude-haiku-4-5`,label:`Haiku 4.5`}];function He({seedMode:e,seedModel:t,submitting:n,error:r,onSubmit:i,onCancel:a,onErrorClear:s}){let[c,l]=(0,A.useState)(``),[d,f]=(0,A.useState)(e),[p,m]=(0,A.useState)(t),[h,g]=(0,A.useState)(!1),[y,b]=(0,A.useState)(!1),[x,S]=(0,A.useState)(null),w=(0,A.useRef)(null),T=(0,A.useRef)(null),E=(0,A.useRef)(null);(0,A.useEffect)(()=>{w.current?.focus()},[]),(0,A.useEffect)(()=>{let e=!1,t=Date.now();return(async()=>{try{let n=await fetch(`/api/admin/claude-capabilities`);if(!n.ok)throw Error(`status ${n.status}`);let r=await n.json();if(e)return;S(r.autoModeAvailable),console.info(`[admin-ui] capability-fetch ok=true autoModeAvailable=${r.autoModeAvailable} seatTier=${r.seatTier??`null`} ms=${Date.now()-t}`)}catch(n){if(e)return;let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] capability-fetch ok=false reason="${r}" ms=${Date.now()-t}`)}})(),()=>{e=!0}},[]);let ee=(0,A.useMemo)(()=>e=>e===`auto`&&x===!1,[x]);(0,A.useEffect)(()=>{function e(e){if(e.key===`Escape`){if(h){g(!1),e.stopPropagation();return}if(y){b(!1),e.stopPropagation();return}a(`esc`)}}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[h,y,a]),(0,A.useEffect)(()=>{if(!h&&!y)return;function e(e){h&&T.current&&!T.current.contains(e.target)&&g(!1),y&&E.current&&!E.current.contains(e.target)&&b(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[h,y]);let D=c.trim(),O=D.length>0&&!n,k=(0,A.useCallback)(()=>{if(D.length===0||n)return;let e=window.open(`about:blank`,`_blank`);console.info(`[admin-ui] new-session-modal-placeholder-open outcome=${e===null?`blocked`:`ok`}`),i({message:c,permissionMode:d,model:p,placeholder:e})},[c,d,p,D,n,i]);function te(e){e.preventDefault(),k()}let ne=Ve.find(e=>e.value===p)?.label??`Default`;return(0,j.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-modal-title`,className:`new-session-modal-overlay`,onClick:e=>{e.target===e.currentTarget&&a(`backdrop`)},children:(0,j.jsxs)(`div`,{className:`new-session-modal`,children:[(0,j.jsx)(`h2`,{id:`new-session-modal-title`,className:`new-session-modal-title`,children:`New session`}),(0,j.jsxs)(`form`,{className:`new-session-modal-form`,onSubmit:te,children:[(0,j.jsx)(`div`,{className:`chat-form`,children:(0,j.jsx)(u,{ref:w,value:c,onChange:e=>{l(e),r&&s()},placeholder:`What should this session do?`,disabled:n})}),r&&(0,j.jsx)(`div`,{className:`tunnel-route__error`,role:`alert`,children:r}),(0,j.jsxs)(`div`,{className:`new-session-modal-actions`,children:[(0,j.jsxs)(`div`,{className:`new-session-modal-pickers`,children:[(0,j.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:T,children:[(0,j.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!h;console.info(`[admin-ui] new-session-modal-mode-picker action=${e?`open`:`close`} current=${d}`),g(e)},disabled:n,"aria-haspopup":`menu`,"aria-expanded":h,"aria-label":`Permission mode for this session`,children:[Re[d],(0,j.jsx)(o,{size:12,"aria-hidden":`true`})]}),h&&(0,j.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,j.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,j.jsx)(`span`,{children:`Mode`})}),ze.map((e,t)=>{let n=ee(e);return(0,j.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,disabled:n,title:n?Be:void 0,"aria-disabled":n||void 0,onClick:()=>{n||(console.info(`[admin-ui] new-session-modal-mode-change from=${d} to=${e} trigger=click`),f(e),g(!1))},children:[(0,j.jsx)(`span`,{children:Re[e]}),(0,j.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===d&&(0,j.jsx)(_,{size:12}),(0,j.jsx)(`span`,{children:t+1})]})]},e)})]})]}),(0,j.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:E,children:[(0,j.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!y;console.info(`[admin-ui] new-session-modal-model-picker action=${e?`open`:`close`} current=${p??`default`}`),b(e)},disabled:n,"aria-haspopup":`menu`,"aria-expanded":y,"aria-label":`Model for this session`,children:[ne,(0,j.jsx)(o,{size:12,"aria-hidden":`true`})]}),y&&(0,j.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Model`,children:[(0,j.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,j.jsx)(`span`,{children:`Model`})}),Ve.map(e=>(0,j.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] new-session-modal-model-change from=${p??`default`} to=${e.value??`default`} trigger=click`),m(e.value),b(!1)},children:[(0,j.jsx)(`span`,{children:e.label}),(0,j.jsx)(`span`,{className:`side-mode-popover-shortcut`,children:e.value===p&&(0,j.jsx)(_,{size:12})})]},e.label))]})]})]}),(0,j.jsxs)(`div`,{className:`new-session-modal-buttons`,children:[(0,j.jsx)(`button`,{type:`button`,className:`modal-action-btn`,onClick:()=>a(`button`),disabled:n,children:`Cancel`}),(0,j.jsx)(`button`,{type:`submit`,className:`new-session-modal-submit`,disabled:!O,"aria-label":`Send`,children:n?(0,j.jsx)(C,{size:14,className:`spinning`}):(0,j.jsx)(v,{size:14})})]})]})]})]})})}var Ue=1e4,We=(0,A.forwardRef)(function(e,n){let{businessName:a,cacheKey:u,role:d,userName:f,userAvatar:v,sessions:y,sessionsLoading:x,sessionsError:w,ensureSessionsLoaded:T,refetchSessions:E,onSelectArtefact:ee,onSelectProjects:te,onSelectPeople:ne,onSelectTasks:oe,onSelectAgents:M,onCloseMobileDrawer:N,onSelectSession:P,selectedSessionId:se,collapsed:ce,mobileDrawerOpen:le,recentsActions:ue}=e,[de,F]=(0,A.useState)(null),[pe,me]=(0,A.useState)(null),[he,_e]=(0,A.useState)(!1);(0,A.useEffect)(()=>{T()},[T]);let ve=(0,A.useRef)(null),[I,be]=(0,A.useState)(!1),[L,R]=(0,A.useState)(`default`),[xe,Se]=(0,A.useState)(void 0),z=(0,A.useRef)(null),[Ce,B]=(0,A.useState)(null),[we,Te]=(0,A.useState)(!1),V=(0,A.useRef)(0),H=(0,A.useRef)(new Map),Ee=t.productName,U=typeof f==`string`?f:f===null?`name unavailable`:a||Ee,De=(U.trim().charAt(0)||`?`).toUpperCase(),Oe=ye(t.hostname),W=ke(u),G=(0,A.useMemo)(()=>{let e=Ae(W.rows,W.view,W.includeBackground);if(Oe.pinned.size===0)return e;let t=[],n=[];for(let r of e)(Oe.pinned.has(r.sessionId)?t:n).push(r);return[...t,...n]},[W.rows,W.view,W.includeBackground,Oe.pinned]),je=G.length,Me=Le(3e4);(0,A.useEffect)(()=>{if(H.current.size!==0)for(let e of W.rows){let t=H.current.get(e.sessionId);if(!t||e.url===null)continue;H.current.delete(e.sessionId),clearTimeout(t.timeoutId);let n=e.sessionId.slice(0,8);if(t.placeholder.closed){console.info(`[admin-ui] new-session-auto-open outcome=timeout sessionId=${n}`);continue}t.placeholder.location.href=e.url,console.info(`[admin-ui] new-session-auto-open outcome=ok sessionId=${n}`)}},[W.rows]),(0,A.useEffect)(()=>{let e=H.current;return()=>{for(let{timeoutId:t}of e.values())clearTimeout(t);e.clear()}},[]);let[K,Ne]=(0,A.useState)(`chat`),[q,Pe]=(0,A.useState)([]),[Fe,Re]=(0,A.useState)(!1),[ze,Be]=(0,A.useState)(null),[Ve,We]=(0,A.useState)(!1);(0,A.useImperativeHandle)(n,()=>({patchArtefact(e,t){Pe(n=>n.map(n=>n.id===e?{...n,...t}:n))}}),[]);let[J,Y]=(0,A.useState)(!1),Ye=(0,A.useRef)(null),Xe={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},Ze=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`];(0,A.useEffect)(()=>{if(!u)return;let e=!1,t=Date.now();return(async()=>{try{let n=await fetch(`/api/admin/session-defaults?session_key=${encodeURIComponent(u)}`);if(!n.ok)throw Error(`status ${n.status}`);let r=await n.json();if(e)return;let i=r.permissionMode,a=r.model??void 0;R(i),Se(a),z.current={permissionMode:i,model:a},console.info(`[admin-ui] session-defaults-hydrate permissionMode=${i} model=${a??`default`} ms=${Date.now()-t}`)}catch(n){if(e)return;let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] session-defaults-hydrate-failed reason="${r}" ms=${Date.now()-t}`)}})(),()=>{e=!0}},[u]);let X=(0,A.useCallback)(async(e,t)=>{if(!u||!z.current)return;let n=z.current,r=Date.now();console.info(`[admin-ui] session-defaults-put from={mode:${n.permissionMode},model:${n.model??`default`}} to={mode:${e.permissionMode},model:${e.model??`default`}} trigger=${t}`);try{let t=await fetch(`/api/admin/session-defaults?session_key=${encodeURIComponent(u)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({permissionMode:e.permissionMode,model:e.model??null})});if(!t.ok)throw Error(`status ${t.status}`);z.current=e,console.info(`[admin-ui] session-defaults-put-ok ms=${Date.now()-r}`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] session-defaults-put-failed reason="${t}" ms=${Date.now()-r}`),R(n.permissionMode),Se(n.model)}},[u]);(0,A.useEffect)(()=>{if(!J)return;function e(e){Ye.current&&!Ye.current.contains(e.target)&&(console.info(`[admin-ui] sidebar-mode-picker action=close mode=${L}`),Y(!1))}function t(e){if(e.key===`Escape`){console.info(`[admin-ui] sidebar-mode-picker action=close mode=${L}`),Y(!1);return}let t=[`1`,`2`,`3`,`4`,`5`].indexOf(e.key);if(t>=0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let n=Ze[t];n&&(e.preventDefault(),console.info(`[admin-ui] sidebar-mode-picker action=select mode=${n} via=shortcut`),R(n),Y(!1),X({permissionMode:n,model:xe},`sidebar`))}}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[J,L,xe,X]),(0,A.useEffect)(()=>{function e(e){e.shiftKey&&(e.metaKey||e.ctrlKey)&&(e.key===`m`||e.key===`M`)&&(e.preventDefault(),Y(e=>{let t=!e;return console.info(`[admin-ui] sidebar-mode-picker action=${t?`open`:`close`} mode=${L} via=shortcut`),t}))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[L]);let Z=(0,A.useCallback)(async()=>{if(u){We(!0),Be(null);try{let e=await fetch(`/api/admin/sidebar-artefacts?session_key=${encodeURIComponent(u)}`);if(!e.ok)throw Error(`status ${e.status}`);Pe((await e.json()).artefacts??[]),Re(!0)}catch(e){let t=e instanceof Error?e.message:String(e);Be(`Failed to load artefacts: ${t}`),console.error(`[admin-ui] sidebar-artefacts fetch failed: ${t}`)}finally{We(!1)}}},[u]),Qe=()=>{Ne(`chat`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${je}`)},$e=()=>{Ne(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${Fe?q.length:0} collapsed=${ce}`),Fe||Z()},Q=1.5,et=K===`chat`?`Sessions`:`Artefacts`,tt=K===`chat`?x?`…`:String(je):Ve?`…`:String(q.length),nt=K===`chat`?x:Ve,rt=()=>{console.info(`[admin-ui] sidebar-refresh surface=${K}`),K===`chat`?E().then(e=>{e!==null&&W.reconcileFromList(e.map(e=>e.sessionId))}):Z()},it=(0,A.useCallback)(()=>{if(I||!u){console.info(`[admin-ui] sidebar-new-session-click-ignored startingSession=${I} cacheKey=${u?`set`:`missing`}`);return}B(null),V.current=Date.now(),console.info(`[admin-ui] sidebar-new-session-modal-open seedMode=${L} cacheKey-prefix=${u.slice(0,8)}`),Te(!0)},[u,I,L]),at=(0,A.useCallback)(e=>{let t=V.current?Date.now()-V.current:0;console.info(`[admin-ui] sidebar-new-session-modal-cancel reason=${e} dwell-ms=${t}`),B(null),Te(!1)},[]),ot=(0,A.useCallback)(async e=>{if(I||!u)return;let t=V.current?Date.now()-V.current:0,n=Date.now();console.info(`[admin-ui] sidebar-new-session-modal-submit permissionMode=${e.permissionMode} model=${e.model??`default`} messageChars=${e.message.length} dwell-ms=${t}`),be(!0),B(null);try{console.info(`[admin-ui] sidebar-new-session-fetch-start permissionMode=${e.permissionMode} model=${e.model??`default`} messageChars=${e.message.length}`);let t={channel:`browser`,permissionMode:e.permissionMode,initialMessage:e.message};e.model!==void 0&&(t.model=e.model);let r=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(u)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),i=Date.now()-n;console.info(`[admin-ui] sidebar-new-session-fetch-done status=${r.status} ok=${r.ok} ms=${i}`);let a=await r.json();if(!r.ok||!(`sessionId`in a)){let e=a,t=e.error??`POST returned ${r.status}`,i=e.reason?`${t}: ${e.reason}`:t;console.error(`[admin-ui] sidebar-new-session-failed status=${r.status} ms=${Date.now()-n} error=${t} reason=${e.reason??`none`} tail=${JSON.stringify(e.stderrTail??``)}`),B(i);return}console.info(`[admin-ui] sidebar-new-session-ok pid=${a.pid} sessionId=${a.sessionId.slice(0,8)} permissionMode=${e.permissionMode} model=${e.model??`default`} ms=${Date.now()-n}`),ue.setSessions(e=>[a,...e]),Te(!1);let o=a.sessionId,s=o.slice(0,8);if(e.placeholder===null)console.info(`[admin-ui] new-session-auto-open outcome=fallback sessionId=${s}`),P(o);else{let t=setTimeout(()=>{let e=H.current.get(o);e&&(H.current.delete(o),e.placeholder.closed||e.placeholder.close(),console.info(`[admin-ui] new-session-auto-open outcome=timeout sessionId=${s}`))},Ue);H.current.set(o,{placeholder:e.placeholder,timeoutId:t})}}catch(e){let t=e instanceof Error?e.message:String(e);B(t),console.error(`[admin-ui] sidebar-new-session-threw ms=${Date.now()-n} message=${t}`)}finally{be(!1)}},[u,I,ue,P]),$=ge(u,ue,`sidebar`),st=(0,A.useCallback)(async e=>{let t=await $.resume(e);t.ok||console.error(`[admin-ui] sidebar-resume failed: ${t.error}`)},[$]),ct=(0,A.useCallback)(async e=>{_e(!0),me(null);let t=await $.purge(e);t.ok?F(null):me(t.error??`purge failed`),_e(!1)},[$]),lt=(0,A.useCallback)(async e=>{let t=await $.end(e);t.ok||console.error(`[admin-ui] sidebar-end-session failed: ${t.error}`)},[$]),ut=(0,A.useCallback)(async e=>{let t=await $.archive(e);t.ok||console.error(`[admin-ui] sidebar-archive failed: ${t.error}`)},[$]),dt=(0,A.useCallback)(async e=>{let t=await $.unarchive(e);t.ok||console.error(`[admin-ui] sidebar-unarchive failed: ${t.error}`)},[$]),[ft,pt]=(0,A.useState)(null),[mt,ht]=(0,A.useState)(``),gt=(0,A.useCallback)(async(e,t)=>{let n=mt.trim();if(n.length===0||!fe(n)){pt(null);return}if(n===(t??``)){pt(null);return}let r=await $.rename(e,n);r.ok||console.error(`[admin-ui] sidebar-rename failed: ${r.error}`),pt(null)},[mt,$]),_t=(0,A.useCallback)(()=>{pt(null)},[]),[vt,yt]=(0,A.useState)(null),bt=(0,A.useCallback)(async(e,t)=>{try{await l(t),yt(e),window.setTimeout(()=>{yt(t=>t===e?null:t)},1200)}catch(e){console.error(`[admin-ui] sidebar-copy-label failed: ${String(e)}`)}},[]);return(0,j.jsxs)(`aside`,{className:`side`,children:[K===`chat`&&(0,j.jsxs)(`div`,{className:`side-new-session-row`,ref:Ye,children:[(0,j.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:it,disabled:I||!u,children:[I?(0,j.jsx)(C,{size:14,className:`spinning`}):(0,j.jsx)(O,{size:14}),(0,j.jsx)(`span`,{children:`New session`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!J;console.info(`[admin-ui] sidebar-mode-picker action=${e?`open`:`close`} mode=${L}`),Y(e)},disabled:I,"aria-haspopup":`menu`,"aria-expanded":J,"aria-label":`Permission mode for the next session`,title:`Shift+Cmd+M`,children:[Xe[L],(0,j.jsx)(o,{size:12,"aria-hidden":`true`})]}),J&&(0,j.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,j.jsxs)(`div`,{className:`side-mode-popover-head`,children:[(0,j.jsx)(`span`,{children:`Mode`}),(0,j.jsx)(`span`,{className:`side-mode-popover-shortcut`,"aria-hidden":`true`,children:`⇧⌘M`})]}),Ze.map((e,t)=>(0,j.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] sidebar-mode-picker action=select mode=${e}`),R(e),Y(!1),X({permissionMode:e,model:xe},`sidebar`)},children:[(0,j.jsx)(`span`,{children:Xe[e]}),(0,j.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===L&&(0,j.jsx)(_,{size:12}),(0,j.jsx)(`span`,{children:t+1})]})]},e))]})]}),(0,j.jsxs)(`nav`,{className:`side-nav`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`nav-row${K===`chat`?` active`:``}`,onClick:Qe,children:[(0,j.jsx)(ie,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,j.jsx)(`span`,{className:`kbd`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),ne(),N()},children:[(0,j.jsx)(ae,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`People`}),(0,j.jsx)(`span`,{className:`kbd`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),M(),N()},children:[(0,j.jsx)(h,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`Agents`}),(0,j.jsx)(`span`,{className:`kbd`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),te(),N()},children:[(0,j.jsx)(g,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`Projects`}),(0,j.jsx)(`span`,{className:`kbd`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),oe(),N()},children:[(0,j.jsx)(S,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,j.jsx)(`span`,{className:`kbd`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`nav-row${K===`artefacts`?` active`:``}`,onClick:$e,children:[(0,j.jsx)(c,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,j.jsx)(`span`,{className:`kbd`})]})]}),(0,j.jsxs)(`div`,{className:`side-list`,ref:ve,children:[(0,j.jsxs)(`div`,{className:`group-head`,children:[(0,j.jsx)(`span`,{children:et}),(0,j.jsxs)(`span`,{className:`group-head-meta`,children:[(0,j.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh ${et.toLowerCase()}`,"aria-label":`Refresh ${et.toLowerCase()}`,onClick:rt,disabled:nt,children:(0,j.jsx)(k,{size:12,className:nt?`spinning`:void 0})}),(0,j.jsx)(`span`,{children:tt})]})]}),K===`chat`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ke,{view:W.view,setView:e=>{console.info(`[admin-ui] sidebar-view-change view=${e}`),W.setView(e)},connected:W.connected,reconnectNow:W.reconnectNow}),w&&(0,j.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:w}),G.map(e=>{let t=se===e.sessionId,n=ft===e.sessionId;return(0,j.jsxs)(`div`,{className:`conv${t?` active`:``}`,children:[n?(0,j.jsxs)(`span`,{className:`conv-name-line`,style:{flex:1,minWidth:0},children:[(0,j.jsx)(ie,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,j.jsx)(qe,{live:e.live,status:e.status}),(0,j.jsx)(`input`,{type:`text`,value:mt,autoFocus:!0,maxLength:200,onChange:e=>ht(e.target.value),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),gt(e.sessionId,e.firstPrompt)):t.key===`Escape`&&(t.preventDefault(),_t())},onBlur:()=>{gt(e.sessionId,e.firstPrompt)},className:`conv-name`,"aria-label":`Rename session`,style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`inherit`,font:`inherit`}})]}):(0,j.jsxs)(`button`,{type:`button`,className:`conv-name-button`,onClick:()=>{P(e.sessionId),N()},title:`Show metadata`,children:[(0,j.jsxs)(`span`,{className:`conv-name-line`,children:[(0,j.jsx)(ie,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,j.jsx)(qe,{live:e.live,status:e.status}),e.firstPrompt?(0,j.jsx)(`span`,{className:`conv-name`,children:e.firstPrompt}):(0,j.jsxs)(`span`,{className:`conv-name`,style:{fontStyle:`italic`,opacity:.6},children:[`(unnamed · `,e.sessionId.slice(0,8),`)`]})]}),(0,j.jsx)(`span`,{className:`conv-timestamp`,children:Ie(e.updatedAt,Me)})]}),!n&&(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Rename`,"aria-label":`Rename session`,onClick:()=>{ht(e.firstPrompt??``),pt(e.sessionId)},children:(0,j.jsx)(D,{size:13})}),!n&&(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Copy label`,"aria-label":`Copy session label`,onClick:()=>void bt(e.sessionId,e.firstPrompt??`(unnamed · ${e.sessionId.slice(0,8)})`),children:vt===e.sessionId?(0,j.jsx)(_,{size:13}):(0,j.jsx)(s,{size:13})}),e.url!==null&&(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Open in new tab`,"aria-label":`Open in new tab`,onClick:()=>Je(e.url,e.sessionId),children:(0,j.jsx)(b,{size:13})}),e.live?(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`End session`,"aria-label":`End session`,onClick:()=>void lt(e.sessionId),disabled:$.inFlight===`end`,children:$.inFlight===`end`?(0,j.jsx)(C,{size:13,className:`spinning`}):(0,j.jsx)(re,{size:13})}):e.archived?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Unarchive session`,"aria-label":`Unarchive session`,onClick:()=>void dt(e.sessionId),disabled:$.inFlight===`unarchive`,children:$.inFlight===`unarchive`?(0,j.jsx)(C,{size:13,className:`spinning`}):(0,j.jsx)(p,{size:13})}),(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{me(null),F({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,j.jsx)(r,{size:13})})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Resume session`,"aria-label":`Resume session`,onClick:()=>void st(e.sessionId),disabled:$.inFlight===`resume`,children:$.inFlight===`resume`?(0,j.jsx)(C,{size:13,className:`spinning`}):(0,j.jsx)(i,{size:13})}),(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Archive session`,"aria-label":`Archive session`,onClick:()=>void ut(e.sessionId),disabled:$.inFlight===`archive`,children:$.inFlight===`archive`?(0,j.jsx)(C,{size:13,className:`spinning`}):(0,j.jsx)(m,{size:13})}),(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{me(null),F({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,j.jsx)(r,{size:13})})]})]},e.sessionId)})]}),K===`artefacts`&&(0,j.jsxs)(j.Fragment,{children:[ze&&(0,j.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:ze}),Fe&&!ze&&q.length===0&&(0,j.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),q.map(e=>(0,j.jsxs)(`button`,{type:`button`,className:`conv`,onClick:()=>{ee({docId:e.id,name:e.name,content:e.content,editable:e.editable,mimeType:e.mimeType,skipReason:e.skipReason},`sidebar-artefacts`),N()},children:[(0,j.jsx)(`span`,{className:`conv-name`,children:e.name}),(0,j.jsx)(`span`,{className:`conv-kind`,"data-kind":e.kind===`agent-template`?`agent`:`doc`,children:e.kind===`agent-template`?`agent`:`doc`})]},e.id))]})]}),(0,j.jsx)(Ge,{}),(0,j.jsxs)(`div`,{className:`side-foot`,children:[(0,j.jsx)(`div`,{className:`avatar`,children:v?(0,j.jsx)(`img`,{src:v,alt:U}):De}),(0,j.jsxs)(`div`,{className:`who`,children:[(0,j.jsx)(`span`,{className:`name`,children:U}),(0,j.jsx)(`span`,{className:`role`,children:d??`operator`})]})]}),we&&(0,j.jsx)(He,{seedMode:L,seedModel:xe,submitting:I,error:Ce,onSubmit:e=>void ot(e),onCancel:at,onErrorClear:()=>B(null)}),de&&(0,j.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`purge-confirm-title`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&!he&&F(null)},children:(0,j.jsxs)(`div`,{className:`modal-card`,children:[(0,j.jsx)(`h3`,{id:`purge-confirm-title`,style:{margin:0,marginBottom:8,fontSize:16,fontWeight:600},children:`Purge session JSONL?`}),(0,j.jsxs)(`p`,{style:{margin:0,marginBottom:8,fontSize:13},children:[`This hard-deletes the transcript for `,(0,j.jsx)(`strong`,{children:de.displayName??de.sessionId.slice(0,8)}),`. The action cannot be undone.`]}),pe&&(0,j.jsx)(`p`,{style:{margin:0,marginBottom:8,fontSize:12,color:`var(--text-tertiary)`},children:pe}),(0,j.jsxs)(`div`,{className:`modal-action-row`,children:[(0,j.jsx)(`button`,{type:`button`,className:`modal-action-btn`,disabled:he,onClick:()=>F(null),children:`Cancel`}),(0,j.jsx)(`button`,{type:`button`,className:`modal-action-btn`,"data-variant":`danger`,disabled:he,onClick:()=>void ct(de.sessionId),children:he?(0,j.jsx)(C,{size:13,className:`spinning`}):`Purge`})]})]})})]})}),J=5e3;function Ge(){let[e,t]=(0,A.useState)(null);if((0,A.useEffect)(()=>{let e=!1,n=null;async function r(){try{let n=await fetch(`/api/admin/system-stats`);if(!n.ok){console.error(`[admin-ui] system-stats-fetch-failed status=${n.status}`);return}let r=await n.json();e||t(r)}catch(e){console.error(`[admin-ui] system-stats-fetch-failed reason=${e instanceof Error?e.message:String(e)}`)}}function i(){n===null&&(r(),n=setInterval(()=>{r()},J))}function a(){n!==null&&(clearInterval(n),n=null)}function o(){document.hidden?a():i()}return document.hidden||i(),document.addEventListener(`visibilitychange`,o),()=>{e=!0,a(),document.removeEventListener(`visibilitychange`,o)}},[]),!e)return null;let n=e.cpuPct,r=e.memUsedPct,i=n!==null&&n>=.9,a=n!==null&&n>=.98,o=r!==null&&r>=.9,s=r!==null&&r>=.98,c=i||o,l=a||s,u=e=>e===null?`—`:`${Math.round(e*100)}%`,d=e=>{if(e===null)return{width:`0%`,background:`var(--text-tertiary)`};let t=Math.min(1,Math.max(0,e)),n=Math.round(140*(1-t));return{width:`${Math.round(t*100)}%`,background:`hsl(${n}, 65%, 45%)`}},f=[`system-stats`];return c&&f.push(`system-stats--warn`),l&&f.push(`system-stats--crit`),(0,j.jsxs)(`div`,{className:f.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,j.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,j.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),(0,j.jsx)(`div`,{className:`system-stats__bar`,children:(0,j.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(n)})})]}),(0,j.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,j.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]}),(0,j.jsx)(`div`,{className:`system-stats__bar`,children:(0,j.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(r)})})]})]})}var Y=[{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`all`,label:`All`}];function Ke(e){let{view:t,setView:n,connected:r,reconnectNow:i}=e;return(0,j.jsx)(`div`,{className:`session-view-controls`,children:(0,j.jsxs)(`div`,{className:`session-view-segmented`,role:`tablist`,"aria-label":`Session view`,children:[Y.map(e=>(0,j.jsx)(`button`,{type:`button`,role:`tab`,className:`session-view-tab${t===e.value?` active`:``}`,"aria-selected":t===e.value,onClick:()=>n(e.value),children:e.label},e.value)),r?(0,j.jsx)(`span`,{className:`session-view-connection connected`,"aria-label":`Live updates connected.`,title:`Live updates connected.`}):(0,j.jsx)(`button`,{type:`button`,className:`session-view-connection disconnected`,"aria-label":`Live updates paused. Click to retry.`,title:`Live updates paused. Click to retry.`,onClick:i})]})})}function qe({live:e,status:t}){return e?t===`busy`?(0,j.jsxs)(`span`,{className:`session-status session-status-busy`,"aria-label":`session busy`,children:[(0,j.jsx)(`span`,{className:`session-status-dot`}),(0,j.jsx)(`span`,{className:`session-status-dot`}),(0,j.jsx)(`span`,{className:`session-status-dot`})]}):t===`detached`?(0,j.jsx)(`span`,{className:`session-status session-status-detached`,"aria-label":`session detached — manager restart survivor`}):(0,j.jsx)(`span`,{className:`session-status session-status-idle`,"aria-label":`session idle`}):(0,j.jsx)(`span`,{className:`session-status session-status-archived`,"aria-label":`session archived`})}function Je(e,t){let n=t.slice(0,8),r=window.open(e,`_blank`,`noopener,noreferrer`)===null?`blocked`:`ok`;console.info(`[admin-ui] sidebar-open-in-new-tab outcome=${r} sessionId=${n}`)}function Ye(e){return e.map(e=>[e.sessionId,e.displayName,e.lastMessageAt,e.status])}function Xe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r[0]!==i[0]||r[1]!==i[1]||r[2]!==i[2]||r[3]!==i[3])return!1}return!0}function Ze(e){let[t,n]=(0,A.useState)([]),[r,i]=(0,A.useState)(!1),[a,o]=(0,A.useState)(null),[s,c]=(0,A.useState)(null),l=(0,A.useRef)([]),u=(0,A.useCallback)(async t=>{if(!e||!t&&s===e)return null;i(!0),o(null);try{let t=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`claude-sessions fetch returned ${t.status}`);let r=await t.json(),i=Array.isArray(r)?r:r.sessions??[],a=Ye(i),o=Xe(l.current,a);return o||(n(i),l.current=a),c(e),console.info(`[admin-ui] sessions-poll outcome=${o?`unchanged`:`changed`} count=${i.length} cacheKey=${e.slice(0,8)}`),i}catch(t){return console.info(`[admin-ui] sessions-poll outcome=error count=0 cacheKey=${e.slice(0,8)}`),console.error(`[admin/claude-sessions] fetch failed:`,t),o(t instanceof Error?t.message:String(t)),null}finally{i(!1)}},[e,s]);(0,A.useEffect)(()=>{e||(c(null),n([]),o(null),l.current=[])},[e]);let d=(0,A.useCallback)(()=>u(!1),[u]),f=(0,A.useCallback)(()=>u(!0),[u]);return{sessions:t,setSessions:n,loading:r,loaded:s!==null&&s===e,error:a,ensureLoaded:d,refetch:f}}var X=`admin-sidebar-collapsed`,Z=`admin-sidebar-drawer-open`;function Qe(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(X)===`1`}catch{return!1}}function $e(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(X,`1`):window.sessionStorage.removeItem(X)}catch{}}function Q(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(Z)===`1`}catch{return!1}}function et(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(Z,`1`):window.sessionStorage.removeItem(Z)}catch{}}var tt=720;function nt(e){let{cacheKey:t,businessName:n,onLogout:r,userName:i,userAvatar:a,role:o,selectedSessionId:s,onSelectSession:c,onSelectArtefact:l,dataArtefact:u=`closed`,children:d,footer:f}=e,[p,m]=(0,A.useState)(()=>Qe()),[h,g]=(0,A.useState)(()=>Q()),[_,v]=(0,A.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${tt}px)`).matches);(0,A.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${tt}px)`),t=e=>v(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let y=(0,A.useCallback)(e=>{$e(e),m(e)},[]),b=(0,A.useCallback)(e=>{et(e),g(e)},[]);(0,A.useEffect)(()=>{if(typeof window>`u`)return;let e=window.location?.pathname??``;console.info(`[admin-ui] shell-mount route=${e} collapsed=${p} drawer=${h}`)},[]);let x=_?h:!p,S=(0,A.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${tt}px)`).matches){let e=h;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),b(!e)}else{let e=p;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),y(!e)}},[p,h,y,b]),C=(0,A.useCallback)(e=>{console.info(`[admin-ui] header-menu-nav target=${e}`),window.location.href=e===`data`?`/data`:`/graph`},[]),w=Ze(t),T=ke(t),E=(0,A.useMemo)(()=>T.rows.map(e=>e.sessionId),[T.rows]),ee=(0,A.useCallback)(e=>{if(c){c(e);return}window.location.assign(`/?sessionId=${encodeURIComponent(e)}`)},[c]),D=(0,A.useCallback)(e=>{l&&l(e)},[l]),O={collapsed:p,mobileDrawerOpen:h,sidebarOpen:x,onToggleSidebar:S,setMobileDrawerOpen:b,sessionsState:w,sessionRowIds:E,sessionRowsConnected:T.connected};return(0,j.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,j.jsx)(be,{businessName:n,onNavigate:C,onToggleSidebar:S,sidebarOpen:x,onLogout:r}),(0,j.jsxs)(`div`,{className:`platform${h?` menu-open`:``}${p?` sidebar-collapsed`:``}`,"data-artefact":u,children:[(0,j.jsx)(We,{businessName:n,cacheKey:t,role:o??null,userName:i,userAvatar:a??null,sessions:w.sessions,sessionsLoading:w.loading,sessionsError:w.error,ensureSessionsLoaded:w.ensureLoaded,refetchSessions:w.refetch,onSelectArtefact:D,onSelectProjects:()=>{window.location.href=`/graph?label=Project`},onSelectPeople:()=>{window.location.href=`/graph?label=Person`},onSelectTasks:()=>{window.location.href=`/graph?label=Task`},onSelectAgents:()=>{window.location.href=`/graph?label=Agent`},onCloseMobileDrawer:()=>b(!1),onSelectSession:ee,selectedSessionId:s??null,collapsed:p,mobileDrawerOpen:h,recentsActions:{setSessions:w.setSessions,refetch:w.refetch}}),typeof d==`function`?d(O):d]}),h&&(0,j.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>b(!1)}),f]})}var rt={LocalBusiness:`#4F6B8A`,Service:`#6B85A0`,PriceSpecification:`#8AA0B8`,OpeningHoursSpecification:`#A8BACE`,Organization:`#8A6B47`,Person:`#B86E4A`,UserProfile:`#D08960`,Preference:`#DFA67A`,AdminUser:`#8C5230`,AccessGrant:`#66381F`,KnowledgeDocument:`#6E8A5A`,ConversationArchive:`#82A06A`,Section:`#8AA876`,Chunk:`#A6C194`,DigitalDocument:`#5A7548`,CreativeWork:`#B5C9A2`,Question:`#C7D6B5`,FAQPage:`#95B385`,DefinedTerm:`#76906A`,Review:`#3F5A2E`,ImageObject:`#A0BB8C`,Conversation:`#6B5A85`,AdminConversation:`#4F4070`,PublicConversation:`#8A75A8`,Message:`#6B7280`,UserMessage:`#DFA67A`,AssistantMessage:`#C9A876`,ToolCall:`#B5ABCB`,Task:`#B0617A`,Project:`#8E4A60`,Event:`#C68095`,Workflow:`#3A6F77`,WorkflowStep:`#5A8E96`,WorkflowRun:`#7AAAB2`,StepResult:`#9CC4CB`,Email:`#6F7F4A`,EmailAccount:`#91A063`,Agent:`#B8893D`},it=`#94A3B8`;Object.freeze(Object.keys(rt)),Object.freeze(new Set([`Chunk`,`GraphPreference`]));var at=Object.freeze(new Set(`LocalBusiness.Service.PriceSpecification.OpeningHoursSpecification.Organization.Person.UserProfile.Preference.AdminUser.AccessGrant.KnowledgeDocument.DigitalDocument.CreativeWork.Question.FAQPage.DefinedTerm.Review.ImageObject.AdminConversation.PublicConversation.Task.Project.Event.Workflow.Email.EmailAccount.Agent`.split(`.`)));Object.freeze(new Set([`ToolCall`,`StepResult`,`WorkflowStep`,`WorkflowRun`])),Object.freeze(new Set([`HAS_TOOL_CALL`,`RUN_OF`,`HAS_STEP`,`HAS_RESULT`]));function ot(e){for(let t=1;t<e.length;t++)if(Object.prototype.hasOwnProperty.call(rt,e[t]))return e[t];return e[0]??null}function $(e){return rt[e]??`#94A3B8`}function st(e){let t=ot(e),n=t?$(t):it,r=0;for(let t=1;t<e.length;t++)Object.prototype.hasOwnProperty.call(rt,e[t])&&r++;return{displayLabel:t,colour:n,driftCandidates:r}}export{p as C,m as S,D as _,nt as a,y as b,fe as c,oe as d,re as f,O as g,k as h,st as i,ge as l,te as m,$ as n,Te as o,ne as p,ot as r,ye as s,at as t,ce as u,C as v,_ as x,b as y};
|
|
1
|
+
import{o as e}from"./chunk-DD-I1_y5.js";import{a as t,c as n,d as r,f as i,g as a,h as o,m as s,p as c,r as l,t as u,u as d,y as f}from"./ChatInput-CJo_77bp.js";var p=a(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),m=a(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),h=a(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),g=a(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),_=a(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),v=a(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),y=a(`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`}]]),b=a(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),x=a(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),S=a(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),C=a(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),w=a(`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`}]]),T=a(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),E=a(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),ee=a(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),D=a(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),O=a(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),k=a(`refresh-cw`,[[`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`}]]),te=a(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ne=a(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),re=a(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ie=a(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ae=a(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),oe=a(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),A=e(f(),1),j=d(),M=`maxy-shell-side-px`;function N(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function P(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-N());return Math.min(Math.max(e,248),n)}function se(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(M);if(!e)return 264;let t=parseInt(e,10);if(Number.isFinite(t)&&t>=248)return P(t)}catch{}return 264}function ce({targetSelector:e=`.platform`}){let t=(0,A.useRef)(null),[n,r]=(0,A.useState)(()=>se()),i=(0,A.useRef)(n);(0,A.useEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--side-px`,`${n}px`),i.current=n)},[n,e]);let a=(0,A.useCallback)(()=>{r(e=>{let t=P(e);return t===e?e:t})},[]);(0,A.useEffect)(()=>{a(),window.addEventListener(`resize`,a);let t=document.querySelector(e),n=null;return t instanceof HTMLElement&&(n=new MutationObserver(a),n.observe(t,{attributes:!0,attributeFilter:[`data-artefact`,`class`]})),()=>{window.removeEventListener(`resize`,a),n?.disconnect()}},[a,e]);let o=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let a=!1,o=e=>{a=!0,r(P(Math.round(e.clientX)))},s=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),!a)return;let t=i.current;try{window.localStorage.setItem(M,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},s=()=>{let e=P(264);r(e);try{window.localStorage.removeItem(M)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,j.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:o,onDoubleClick:s})}var le=!1;function ue(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function de(){let e=typeof crypto<`u`&&typeof crypto.randomUUID==`function`;if(!le){le=!0;let t=typeof window<`u`&&`isSecureContext`in window?window.isSecureContext:!1;console.info(`[idempotency] uuid-source=${e?`native`:`getRandomValues`} secureContext=${t}`)}return e?crypto.randomUUID():ue()}function fe(e){let t=e.trim();return t.length>=1&&t.length<=200}function F(e,t,n,r){let i=e===`pane`?`pane-action`:`sidebar-${t}`;console.info(`[admin-ui] ${i} sessionId=${n.slice(0,8)} action=${t} outcome=${r}`)}var pe=/session_([A-Za-z0-9_-]+)/;function me(e){if(!e)return null;let t=e.match(pe);return t?t[1]:null}async function he(e,t,n,r,i){let a=me(r)??`unknown`,o=e=>e.slice(0,8),s=t===`pane`?`pane-action action=resume-archive`:`sidebar-resume-archive`,c;try{let t=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(n)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:`archive`})});c=t.ok?`ok`:t.status===409?`409`:`error`;let r=`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=${c}`;c===`error`?console.error(r):console.info(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=error detail=${t}`)}finally{i.refetch()}}function ge(e,t,n=`pane`){let[r,i]=(0,A.useState)(null),a=(0,A.useRef)(!1),o=(0,A.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};if(a.current)return F(n,`resume`,r,`skipped-in-flight`),{ok:!1,error:`in-flight`};a.current=!0,i(`resume`);let o=de();try{let i=await fetch(`/api/admin/claude-sessions/resume?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:r,channel:`browser`,idempotencyKey:o})}),a=await i.json();if(!i.ok||!(`sessionId`in a)){let e=a.error??`POST returned ${i.status}`;return F(n,`resume`,r,String(i.status)),{ok:!1,error:e}}return t.setSessions(e=>[a,...e.filter(e=>e.sessionId!==r)]),F(n,`resume`,r,`200`),he(e,n,r,a.url,t),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return F(n,`resume`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{a.current=!1,i(null)}},[e,t,n]),s=(0,A.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`end`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/stop?session_key=${encodeURIComponent(e)}`,{method:`POST`});if(!i.ok){let e=await i.text().catch(()=>``);return F(n,`end`,r,String(i.status)),t.refetch(),{ok:!1,error:`POST /stop ${i.status} ${e.slice(0,200)}`}}return F(n,`end`,r,`204`),t.refetch(),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return F(n,`end`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{i(null)}},[e,t,n]),c=(0,A.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`purge`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}?purge=1&session_key=${encodeURIComponent(e)}`,{method:`DELETE`});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`DELETE ?purge=1 ${i.status}`;return F(n,`purge`,r,String(i.status)),{ok:!1,error:t}}return t.setSessions(e=>e.filter(e=>e.sessionId!==r)),F(n,`purge`,r,`200`),t.refetch(),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return F(n,`purge`,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]),l=(0,A.useCallback)(async(r,a)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(a);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:a})});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`POST /archive ${i.status}`;return F(n,a,r,String(i.status)),{ok:!1,error:t}}return a===`archive`&&t.setSessions(e=>e.filter(e=>e.sessionId!==r)),t.refetch(),F(n,a,r,`200`),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return F(n,a,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]);return{inFlight:r,resume:o,end:s,purge:c,archive:(0,A.useCallback)(e=>l(e,`archive`),[l]),unarchive:(0,A.useCallback)(e=>l(e,`unarchive`),[l]),rename:(0,A.useCallback)(async(t,r)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`rename`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(t)}/rename?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({title:r})});if(!i.ok){let e=await i.json().catch(()=>({})),r=e.detail||e.error||`POST /rename ${i.status}`;return F(n,`rename`,t,String(i.status)),{ok:!1,error:r,reason:e.reason}}return F(n,`rename`,t,`200`),{ok:!0}}catch(e){let r=e instanceof Error?e.message:String(e);return F(n,`rename`,t,`threw`),{ok:!1,error:r}}finally{i(null)}},[e,n])}}function _e(e){return`code.session.pinned.${e}`}function ve(e){if(typeof window>`u`)return new Set;try{let t=window.localStorage.getItem(_e(e));if(!t)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function I(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(_e(e),JSON.stringify([...t]))}catch{}}function ye(e){let[t,n]=(0,A.useState)(()=>ve(e));(0,A.useEffect)(()=>{n(ve(e))},[e]);let r=(0,A.useCallback)(t=>{n(n=>{let r=new Set(n);return r.has(t)?r.delete(t):r.add(t),I(e,r),r})},[e]);return{pinned:t,isPinned:(0,A.useCallback)(e=>t.has(e),[t]),togglePin:r}}function be(e){let{businessName:i,onNavigate:a,onToggleSidebar:o,sidebarOpen:s,onLogout:c}=e,[l,u]=(0,A.useState)(!1),d=(0,A.useRef)(null),f=(0,A.useRef)(null),[p,m]=(0,A.useState)(null),[h,g]=(0,A.useState)(!1),[v,S]=(0,A.useState)(null),[D,O]=(0,A.useState)(null),[k,te]=(0,A.useState)(null),[re,ie]=(0,A.useState)(``);(0,A.useEffect)(()=>{ie(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,A.useEffect)(()=>{if(!l)return;let e=e=>{d.current&&!d.current.contains(e.target)&&u(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[l]),(0,A.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&u(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l]),(0,A.useEffect)(()=>{l&&f.current?.focus()},[l]),(0,A.useEffect)(()=>{if(!l)return;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||te(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[l]);let ae=(0,A.useCallback)(()=>{u(e=>{let t=!e;return t&&console.info(`[admin-ui] header-menu-open`),t})},[]),M=(0,A.useCallback)(e=>{u(!1),a(e)},[a]),N=(0,A.useCallback)(async()=>{if(p!==null){m(null),O(null);return}g(!0),S(null);try{let e=await fetch(`/api/admin/agents`);if(!e.ok)throw Error(`Failed to load agents`);m((await e.json()).agents??[])}catch(e){console.error(`[admin/agents] list failed:`,e),S(e instanceof Error?e.message:String(e)),m([])}finally{g(!1)}},[p]),P=(0,A.useCallback)(e=>{O(null),m(t=>t?.filter(t=>t.slug!==e)??null),fetch(`/api/admin/agents/${encodeURIComponent(e)}`,{method:`DELETE`}).catch(e=>console.error(`[admin/agents] delete failed:`,e))},[]),se=(0,A.useCallback)(()=>{u(!1),c()},[c]),ce=i||t.productName;return(0,j.jsxs)(`header`,{className:`admin-header`,children:[(0,j.jsx)(`button`,{type:`button`,className:`admin-sidebar-toggle`,"aria-label":s?`Hide sidebar`:`Show sidebar`,title:s?`Hide sidebar`:`Show sidebar`,"aria-expanded":s,onClick:o,children:s?(0,j.jsx)(E,{size:20,strokeWidth:1.5}):(0,j.jsx)(ee,{size:20,strokeWidth:1.5})}),(0,j.jsxs)(`div`,{className:`chat-header-label`,children:[(0,j.jsx)(`span`,{className:`chat-logo-btn`,"aria-hidden":`true`,children:(0,j.jsx)(`img`,{src:n,alt:``,className:`chat-logo`})}),(0,j.jsx)(`h1`,{className:`chat-tagline`,children:ce})]}),(0,j.jsxs)(`div`,{className:`chat-burger-wrap`,ref:d,children:[(0,j.jsx)(`button`,{type:`button`,className:`admin-burger`,onClick:ae,"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":l,children:(0,j.jsx)(T,{size:20})}),l&&(0,j.jsxs)(`div`,{className:`admin-menu`,role:`menu`,children:[(0,j.jsxs)(`button`,{ref:f,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>M(`data`),children:[(0,j.jsx)(y,{size:14}),` Data`]}),(0,j.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>M(`graph`),children:[(0,j.jsx)(ne,{size:14}),` Graph`]}),(0,j.jsx)(`div`,{className:`chat-menu-divider`}),(0,j.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:N,children:[(0,j.jsx)(b,{size:14}),` Public`,h&&(0,j.jsx)(C,{size:12,className:`spin`})]}),p!==null&&(0,j.jsxs)(`div`,{className:`chat-menu-agents`,children:[v&&(0,j.jsx)(`span`,{className:`chat-menu-agent-error`,children:v}),p.length===0&&!v&&(0,j.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),p.map(e=>(0,j.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,j.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,j.jsxs)(`span`,{className:`agent-text`,children:[(0,j.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,j.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),D===e.slug?(0,j.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,j.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>P(e.slug),children:(0,j.jsx)(_,{size:12})}),(0,j.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>O(null),children:(0,j.jsx)(oe,{size:12})})]}):(0,j.jsxs)(`span`,{className:`agent-actions`,children:[(0,j.jsx)(`a`,{href:`${re}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>u(!1),children:(0,j.jsx)(b,{size:12})}),(0,j.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>O(e.slug),children:(0,j.jsx)(r,{size:12})})]})]},e.slug))]}),(0,j.jsx)(`div`,{className:`chat-menu-divider`}),(0,j.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,j.jsx)(x,{size:14}),(0,j.jsxs)(`span`,{className:`version-installed`,children:[k?`v${k.installed}`:`…`,k&&!k.updateAvailable&&(0,j.jsx)(`span`,{className:`version-uptodate-dot`}),k?.updateAvailable&&(0,j.jsx)(`span`,{className:`version-update-dot`})]})]}),(0,j.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:se,children:[(0,j.jsx)(w,{size:14}),` Log out`]})]})]})]})}var L=`maxy-admin-session`,R=typeof BroadcastChannel<`u`;function xe(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`rotation`&&typeof t.newKey==`string`&&t.newKey.length>0&&(t.surface===`chat`||t.surface===`graph`||t.surface===`data`||t.surface===`sessions`)&&typeof t.ts==`number`}function Se(e){if(!R)return()=>{};let t=new BroadcastChannel(L),n=t=>{if(!xe(t.data)){console.warn(`[admin-session-broadcast] outcome=received-malformed payload=${JSON.stringify(t.data)}`);return}e(t.data)};return t.addEventListener(`message`,n),()=>{t.removeEventListener(`message`,n),t.close()}}var z=`maxy-admin-session-key`;function Ce(e,t){return`${e}${e.includes(`?`)?`&`:`?`}session_key=${encodeURIComponent(t)}`}async function B(e){let t;try{t=await e.clone().json()}catch{return`parse-failed`}if(typeof t!=`object`||!t)return`unknown-401`;let n=t.code;return n===`session-missing`||n===`session-not-registered`||n===`session-expired-age`||n===`grant-expired`?n:`unknown-401`}function we(){try{return sessionStorage.getItem(z)}catch{return null}}function Te(e){let{initialCacheKey:t,surface:n}=e,[r,i]=(0,A.useState)(t),a=(0,A.useRef)(t);(0,A.useEffect)(()=>{a.current=r},[r]),(0,A.useEffect)(()=>{t!==a.current&&(i(t),a.current=t,s(e=>e+1))},[t]);let[o,s]=(0,A.useState)(0),[c,l]=(0,A.useState)(null);(0,A.useEffect)(()=>Se(e=>{let t=a.current.slice(0,8),r=e.newKey.slice(0,8);e.newKey!==a.current&&(console.log(`[admin-session-broadcast] outcome=received oldKey=${t} newKey=${r} surface=${n} senderSurface=${e.surface}`),i(e.newKey),s(e=>e+1),l(null))}),[n]);let u=(0,A.useCallback)(()=>{try{sessionStorage.removeItem(z)}catch{}window.location.href=`/`},[]);return{adminFetch:(0,A.useCallback)(async(e,t)=>{let r=a.current,o=Ce(e,r),c=await fetch(o,t);if(c.status!==401)return c;let d=await B(c);if(d===`session-missing`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),u(),c;if(d!==`session-not-registered`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:d}),c;let f=we();if(!f||f===r)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=session-not-registered-no-fresh-key surface=${n} path=${e}`),l({message:`Your admin session was renewed in another tab. Click to reload.`,reason:`session-not-registered`}),c;i(f),a.current=f,s(e=>e+1),console.log(`[useAdminFetch] outcome=retry-after-rotation oldKey=${r.slice(0,8)} newKey=${f.slice(0,8)} surface=${n} path=${e}`);let p=Ce(e,f),m=await fetch(p,t);return m.status===401&&(console.warn(`[useAdminFetch] outcome=redirect-to-login reason=second-401-after-retry surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:`session-not-registered`})),m},[u,n]),cacheKey:r,sessionRefetchNonce:o,banner:c,reloadToLogin:u}}var V=`/api/admin/claude-sessions/events`,H=`admin-session-list-view`,Ee=`admin-session-list-include-subagents`,U=`admin-session-list-include-background`;function De(e){return e===`active`||e===`archived`||e===`all`}function Oe(){let e={rows:[],view:`active`,includeBackground:!1,connected:!1},t=new Map,n=new Set,r=null,i=null,a=0,o=0,s=null,c=!1,l=!1;function u(){let n=[...t.values()].sort((e,t)=>t.updatedAt===e.updatedAt?e.sessionId<t.sessionId?-1:1:t.updatedAt-e.updatedAt);e={...e,rows:n}}function d(){for(let e of n)e()}function f(e,n){if(e===`row-removed`){let e=n?.sessionId;if(typeof e!=`string`||!t.delete(e))return;u(),d();return}let r=n;if(typeof r.sessionId!=`string`)return;let i={sessionId:r.sessionId,live:r.live===!0,status:r.status===`busy`?`busy`:r.status===`idle`?`idle`:r.status===`detached`?`detached`:`gone`,agentLabel:typeof r.agentLabel==`string`&&r.agentLabel.length>0?r.agentLabel:null,cwd:typeof r.cwd==`string`?r.cwd:null,firstPrompt:typeof r.firstPrompt==`string`&&r.firstPrompt.length>0?r.firstPrompt:null,titleSource:r.titleSource===`user`||r.titleSource===`ai`?r.titleSource:null,updatedAt:typeof r.updatedAt==`number`?r.updatedAt:0,url:typeof r.url==`string`&&r.url.length>0?r.url:null,archived:r.archived===!0};t.set(i.sessionId,i),u(),d()}function p(t){if(r&&s===t||(r&&=(r.close(),null),!t))return;s=t,c=!1,l=!1;let n=Ce(V,t);try{r=new EventSource(n)}catch(e){console.error(`[admin-ui] session-row-store EventSource construct failed:`,e),h(`auto`);return}r.addEventListener(`open`,()=>{c=!0,a=0,e={...e,connected:!0},d(),console.info(`[admin-ui] session-row-store connected events-received=${o}`)});for(let e of[`row-created`,`row-updated`,`row-archived`,`row-removed`])r.addEventListener(e,t=>{o+=1;try{f(e,JSON.parse(t.data))}catch(t){console.error(`[admin-ui] session-row-store parse failed kind=${e}:`,t)}});r.addEventListener(`error`,()=>{r&&=(r.close(),null),e={...e,connected:!1},d(),!c&&!l&&(l=!0,m(n)),h(`auto`)})}async function m(e){let t=a+1,n=0,r=`unknown`;try{let t=await fetch(e,{method:`GET`});n=t.status,r=t.status>=400&&t.status<500?await B(t):`unknown`}catch(e){console.error(`[admin-ui] session-row-store sse-error-probe-failed:`,e);return}console.error(`[admin-ui] session-row-store sse-error status=${n} code=${r} attempt=${t}`)}function h(e){if(i)return;a+=1;let t=Math.min(1e3*2**Math.min(a,5),3e4);console.info(`[admin-ui] session-row-store reconnect trigger=${e} attempt=${a} delay-ms=${t}`),i=setTimeout(()=>{i=null,s&&p(s)},t)}function g(){i&&=(clearTimeout(i),null),a=0,r&&=(r.close(),null),console.info(`[admin-ui] session-row-store reconnect trigger=manual attempt=0 delay-ms=0`),s&&p(s)}function _(){if(!(typeof window>`u`))try{let t=window.localStorage.getItem(H);De(t)&&(e={...e,view:t});let n=window.localStorage.getItem(Ee);if(n===null){let e=window.localStorage.getItem(U);e!==null&&(window.localStorage.setItem(Ee,e),window.localStorage.removeItem(U),n=e,console.info(`[admin-ui] session-list-storage-migrated from=${U} to=${Ee} value=${e}`))}n===`1`&&(e={...e,includeBackground:!0})}catch{}}function v(t){e={...e,view:t};try{window.localStorage.setItem(H,t)}catch{}d()}function y(t){e={...e,includeBackground:t};try{window.localStorage.setItem(Ee,t?`1`:`0`)}catch{}d()}function b(e){return n.add(e),()=>{n.delete(e)}}function x(){return e}function S(){r&&=(r.close(),null),i&&=(clearTimeout(i),null),s=null,e={...e,connected:!1}}function C(e,t){f(e,t)}function w(t){e={...e,connected:t},d()}function T(){t.clear(),u(),d()}function E(e){let n=new Set(e),r=0;for(let e of[...t.keys()])n.has(e)||(t.delete(e),r+=1);r!==0&&(console.info(`[admin-ui] session-row-store reconcile evicted=${r} kept=${t.size}`),u(),d())}return _(),{subscribe:b,getSnapshot:x,connect:p,disconnect:S,setView:v,setIncludeBackground:y,reconnectNow:g,reconcileFromList:E,_injectEventForTesting:C,_setConnectedForTesting:w,_clearRowsForTesting:T}}var W=Oe();W._injectEventForTesting,W.connect,W._setConnectedForTesting,W.getSnapshot,W.reconcileFromList;function ke(e){let t=(0,A.useSyncExternalStore)(W.subscribe,W.getSnapshot,W.getSnapshot);(0,A.useEffect)(()=>{e&&W.connect(e)},[e]);let n=(0,A.useCallback)(e=>W.setView(e),[]),r=(0,A.useCallback)(e=>W.setIncludeBackground(e),[]),i=(0,A.useCallback)(()=>W.reconnectNow(),[]),a=(0,A.useCallback)(e=>W.reconcileFromList(e),[]);return{rows:t.rows,view:t.view,includeBackground:t.includeBackground,connected:t.connected,setView:n,setIncludeBackground:r,reconnectNow:i,reconcileFromList:a}}function Ae(e,t,n){return e.filter(e=>!(t===`active`&&e.archived||t===`archived`&&!e.archived||!n&&e.agentLabel!==null&&e.agentLabel!==`admin`))}var G=6e4,je=60*G,Me=24*je,K=G,Ne=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],q=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Pe(e){return e<10?`0${e}`:String(e)}function Fe(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Ie(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t))return`—`;let n=t-e;if(n<-K)return`—`;let r=n<0?0:n;if(r<G)return`just now`;if(r<je)return`${Math.floor(r/G)}m`;if(r<Me)return`${Math.floor(r/je)}h`;let i=new Date(t),a=new Date(e),o=Math.round((Fe(i)-Fe(a))/Me);if(o===1)return`yesterday`;if(o>=2&&o<=6)return q[a.getDay()];let s=Pe(a.getDate()),c=Ne[a.getMonth()];return a.getFullYear()===i.getFullYear()?`${s} ${c}`:`${s} ${c} ${a.getFullYear()}`}function Le(e=3e4){let[t,n]=(0,A.useState)(()=>Date.now());return(0,A.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Re={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},ze=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`],Be=`Plan does not include auto mode`,Ve=[{value:void 0,label:`Default`},{value:`claude-opus-4-7`,label:`Opus 4.7`},{value:`claude-sonnet-4-6`,label:`Sonnet 4.6`},{value:`claude-haiku-4-5`,label:`Haiku 4.5`}];function He({seedMode:e,seedModel:t,submitting:n,error:r,onSubmit:i,onCancel:a,onErrorClear:s}){let[c,l]=(0,A.useState)(``),[d,f]=(0,A.useState)(e),[p,m]=(0,A.useState)(t),[h,g]=(0,A.useState)(!1),[y,b]=(0,A.useState)(!1),[x,S]=(0,A.useState)(null),w=(0,A.useRef)(null),T=(0,A.useRef)(null),E=(0,A.useRef)(null);(0,A.useEffect)(()=>{w.current?.focus()},[]),(0,A.useEffect)(()=>{let e=!1,t=Date.now();return(async()=>{try{let n=await fetch(`/api/admin/claude-capabilities`);if(!n.ok)throw Error(`status ${n.status}`);let r=await n.json();if(e)return;S(r.autoModeAvailable),console.info(`[admin-ui] capability-fetch ok=true autoModeAvailable=${r.autoModeAvailable} seatTier=${r.seatTier??`null`} ms=${Date.now()-t}`)}catch(n){if(e)return;let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] capability-fetch ok=false reason="${r}" ms=${Date.now()-t}`)}})(),()=>{e=!0}},[]);let ee=(0,A.useMemo)(()=>e=>e===`auto`&&x===!1,[x]);(0,A.useEffect)(()=>{function e(e){if(e.key===`Escape`){if(h){g(!1),e.stopPropagation();return}if(y){b(!1),e.stopPropagation();return}a(`esc`)}}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[h,y,a]),(0,A.useEffect)(()=>{if(!h&&!y)return;function e(e){h&&T.current&&!T.current.contains(e.target)&&g(!1),y&&E.current&&!E.current.contains(e.target)&&b(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[h,y]);let D=c.trim(),O=D.length>0&&!n,k=(0,A.useCallback)(()=>{if(D.length===0||n)return;let e=window.open(`about:blank`,`_blank`);console.info(`[admin-ui] new-session-modal-placeholder-open outcome=${e===null?`blocked`:`ok`}`),i({message:c,permissionMode:d,model:p,placeholder:e})},[c,d,p,D,n,i]);function te(e){e.preventDefault(),k()}let ne=Ve.find(e=>e.value===p)?.label??`Default`;return(0,j.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-modal-title`,className:`new-session-modal-overlay`,onClick:e=>{e.target===e.currentTarget&&a(`backdrop`)},children:(0,j.jsxs)(`div`,{className:`new-session-modal`,children:[(0,j.jsx)(`h2`,{id:`new-session-modal-title`,className:`new-session-modal-title`,children:`New session`}),(0,j.jsxs)(`form`,{className:`new-session-modal-form`,onSubmit:te,children:[(0,j.jsx)(`div`,{className:`chat-form`,children:(0,j.jsx)(u,{ref:w,value:c,onChange:e=>{l(e),r&&s()},placeholder:`What should this session do?`,disabled:n})}),r&&(0,j.jsx)(`div`,{className:`tunnel-route__error`,role:`alert`,children:r}),(0,j.jsxs)(`div`,{className:`new-session-modal-actions`,children:[(0,j.jsxs)(`div`,{className:`new-session-modal-pickers`,children:[(0,j.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:T,children:[(0,j.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!h;console.info(`[admin-ui] new-session-modal-mode-picker action=${e?`open`:`close`} current=${d}`),g(e)},disabled:n,"aria-haspopup":`menu`,"aria-expanded":h,"aria-label":`Permission mode for this session`,children:[Re[d],(0,j.jsx)(o,{size:12,"aria-hidden":`true`})]}),h&&(0,j.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,j.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,j.jsx)(`span`,{children:`Mode`})}),ze.map((e,t)=>{let n=ee(e);return(0,j.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,disabled:n,title:n?Be:void 0,"aria-disabled":n||void 0,onClick:()=>{n||(console.info(`[admin-ui] new-session-modal-mode-change from=${d} to=${e} trigger=click`),f(e),g(!1))},children:[(0,j.jsx)(`span`,{children:Re[e]}),(0,j.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===d&&(0,j.jsx)(_,{size:12}),(0,j.jsx)(`span`,{children:t+1})]})]},e)})]})]}),(0,j.jsxs)(`div`,{className:`new-session-modal-picker-wrap`,ref:E,children:[(0,j.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!y;console.info(`[admin-ui] new-session-modal-model-picker action=${e?`open`:`close`} current=${p??`default`}`),b(e)},disabled:n,"aria-haspopup":`menu`,"aria-expanded":y,"aria-label":`Model for this session`,children:[ne,(0,j.jsx)(o,{size:12,"aria-hidden":`true`})]}),y&&(0,j.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Model`,children:[(0,j.jsx)(`div`,{className:`side-mode-popover-head`,children:(0,j.jsx)(`span`,{children:`Model`})}),Ve.map(e=>(0,j.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] new-session-modal-model-change from=${p??`default`} to=${e.value??`default`} trigger=click`),m(e.value),b(!1)},children:[(0,j.jsx)(`span`,{children:e.label}),(0,j.jsx)(`span`,{className:`side-mode-popover-shortcut`,children:e.value===p&&(0,j.jsx)(_,{size:12})})]},e.label))]})]})]}),(0,j.jsxs)(`div`,{className:`new-session-modal-buttons`,children:[(0,j.jsx)(`button`,{type:`button`,className:`modal-action-btn`,onClick:()=>a(`button`),disabled:n,children:`Cancel`}),(0,j.jsx)(`button`,{type:`submit`,className:`new-session-modal-submit`,disabled:!O,"aria-label":`Send`,children:n?(0,j.jsx)(C,{size:14,className:`spinning`}):(0,j.jsx)(v,{size:14})})]})]})]})]})})}var Ue=1e4,We=(0,A.forwardRef)(function(e,n){let{businessName:a,cacheKey:u,role:d,userName:f,userAvatar:v,sessions:y,sessionsLoading:x,sessionsError:w,ensureSessionsLoaded:T,refetchSessions:E,onSelectArtefact:ee,onSelectProjects:te,onSelectPeople:ne,onSelectTasks:oe,onSelectAgents:M,onCloseMobileDrawer:N,onSelectSession:P,selectedSessionId:se,collapsed:ce,mobileDrawerOpen:le,recentsActions:ue}=e,[de,F]=(0,A.useState)(null),[pe,me]=(0,A.useState)(null),[he,_e]=(0,A.useState)(!1);(0,A.useEffect)(()=>{T()},[T]);let ve=(0,A.useRef)(null),[I,be]=(0,A.useState)(!1),[L,R]=(0,A.useState)(`default`),[xe,Se]=(0,A.useState)(void 0),z=(0,A.useRef)(null),[Ce,B]=(0,A.useState)(null),[we,Te]=(0,A.useState)(!1),V=(0,A.useRef)(0),H=(0,A.useRef)(new Map),Ee=t.productName,U=typeof f==`string`?f:f===null?`name unavailable`:a||Ee,De=(U.trim().charAt(0)||`?`).toUpperCase(),Oe=ye(t.hostname),W=ke(u),G=(0,A.useMemo)(()=>{let e=Ae(W.rows,W.view,W.includeBackground);if(Oe.pinned.size===0)return e;let t=[],n=[];for(let r of e)(Oe.pinned.has(r.sessionId)?t:n).push(r);return[...t,...n]},[W.rows,W.view,W.includeBackground,Oe.pinned]),je=G.length,Me=Le(3e4);(0,A.useEffect)(()=>{if(H.current.size!==0)for(let e of W.rows){let t=H.current.get(e.sessionId);if(!t||e.url===null)continue;H.current.delete(e.sessionId),clearTimeout(t.timeoutId);let n=e.sessionId.slice(0,8);if(t.placeholder.closed){console.info(`[admin-ui] new-session-auto-open outcome=timeout sessionId=${n}`);continue}t.placeholder.location.href=e.url,console.info(`[admin-ui] new-session-auto-open outcome=ok sessionId=${n}`)}},[W.rows]),(0,A.useEffect)(()=>{let e=H.current;return()=>{for(let{timeoutId:t}of e.values())clearTimeout(t);e.clear()}},[]);let[K,Ne]=(0,A.useState)(`chat`),[q,Pe]=(0,A.useState)([]),[Fe,Re]=(0,A.useState)(!1),[ze,Be]=(0,A.useState)(null),[Ve,We]=(0,A.useState)(!1);(0,A.useImperativeHandle)(n,()=>({patchArtefact(e,t){Pe(n=>n.map(n=>n.id===e?{...n,...t}:n))}}),[]);let[J,Y]=(0,A.useState)(!1),Ye=(0,A.useRef)(null),Xe={default:`Ask`,acceptEdits:`Accept edits`,plan:`Plan`,auto:`Auto`,bypassPermissions:`Bypass permissions`},Ze=[`default`,`acceptEdits`,`plan`,`auto`,`bypassPermissions`];(0,A.useEffect)(()=>{if(!u)return;let e=!1,t=Date.now();return(async()=>{try{let n=await fetch(`/api/admin/session-defaults?session_key=${encodeURIComponent(u)}`);if(!n.ok)throw Error(`status ${n.status}`);let r=await n.json();if(e)return;let i=r.permissionMode,a=r.model??void 0;R(i),Se(a),z.current={permissionMode:i,model:a},console.info(`[admin-ui] session-defaults-hydrate permissionMode=${i} model=${a??`default`} ms=${Date.now()-t}`)}catch(n){if(e)return;let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] session-defaults-hydrate-failed reason="${r}" ms=${Date.now()-t}`)}})(),()=>{e=!0}},[u]);let X=(0,A.useCallback)(async(e,t)=>{if(!u||!z.current)return;let n=z.current,r=Date.now();console.info(`[admin-ui] session-defaults-put from={mode:${n.permissionMode},model:${n.model??`default`}} to={mode:${e.permissionMode},model:${e.model??`default`}} trigger=${t}`);try{let t=await fetch(`/api/admin/session-defaults?session_key=${encodeURIComponent(u)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({permissionMode:e.permissionMode,model:e.model??null})});if(!t.ok)throw Error(`status ${t.status}`);z.current=e,console.info(`[admin-ui] session-defaults-put-ok ms=${Date.now()-r}`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] session-defaults-put-failed reason="${t}" ms=${Date.now()-r}`),R(n.permissionMode),Se(n.model)}},[u]);(0,A.useEffect)(()=>{if(!J)return;function e(e){Ye.current&&!Ye.current.contains(e.target)&&(console.info(`[admin-ui] sidebar-mode-picker action=close mode=${L}`),Y(!1))}function t(e){if(e.key===`Escape`){console.info(`[admin-ui] sidebar-mode-picker action=close mode=${L}`),Y(!1);return}let t=[`1`,`2`,`3`,`4`,`5`].indexOf(e.key);if(t>=0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let n=Ze[t];n&&(e.preventDefault(),console.info(`[admin-ui] sidebar-mode-picker action=select mode=${n} via=shortcut`),R(n),Y(!1),X({permissionMode:n,model:xe},`sidebar`))}}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[J,L,xe,X]),(0,A.useEffect)(()=>{function e(e){e.shiftKey&&(e.metaKey||e.ctrlKey)&&(e.key===`m`||e.key===`M`)&&(e.preventDefault(),Y(e=>{let t=!e;return console.info(`[admin-ui] sidebar-mode-picker action=${t?`open`:`close`} mode=${L} via=shortcut`),t}))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[L]);let Z=(0,A.useCallback)(async()=>{if(u){We(!0),Be(null);try{let e=await fetch(`/api/admin/sidebar-artefacts?session_key=${encodeURIComponent(u)}`);if(!e.ok)throw Error(`status ${e.status}`);Pe((await e.json()).artefacts??[]),Re(!0)}catch(e){let t=e instanceof Error?e.message:String(e);Be(`Failed to load artefacts: ${t}`),console.error(`[admin-ui] sidebar-artefacts fetch failed: ${t}`)}finally{We(!1)}}},[u]),Qe=()=>{Ne(`chat`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${je}`)},$e=()=>{Ne(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${Fe?q.length:0} collapsed=${ce}`),Fe||Z()},Q=1.5,et=K===`chat`?`Sessions`:`Artefacts`,tt=K===`chat`?x?`…`:String(je):Ve?`…`:String(q.length),nt=K===`chat`?x:Ve,rt=()=>{console.info(`[admin-ui] sidebar-refresh surface=${K}`),K===`chat`?E().then(e=>{e!==null&&W.reconcileFromList(e.map(e=>e.sessionId))}):Z()},it=(0,A.useCallback)(()=>{if(I||!u){console.info(`[admin-ui] sidebar-new-session-click-ignored startingSession=${I} cacheKey=${u?`set`:`missing`}`);return}B(null),V.current=Date.now(),console.info(`[admin-ui] sidebar-new-session-modal-open seedMode=${L} cacheKey-prefix=${u.slice(0,8)}`),Te(!0)},[u,I,L]),at=(0,A.useCallback)(e=>{let t=V.current?Date.now()-V.current:0;console.info(`[admin-ui] sidebar-new-session-modal-cancel reason=${e} dwell-ms=${t}`),B(null),Te(!1)},[]),ot=(0,A.useCallback)(async e=>{if(I||!u)return;let t=V.current?Date.now()-V.current:0,n=Date.now();console.info(`[admin-ui] sidebar-new-session-modal-submit permissionMode=${e.permissionMode} model=${e.model??`default`} messageChars=${e.message.length} dwell-ms=${t}`),be(!0),B(null);try{console.info(`[admin-ui] sidebar-new-session-fetch-start permissionMode=${e.permissionMode} model=${e.model??`default`} messageChars=${e.message.length}`);let t={channel:`browser`,permissionMode:e.permissionMode,initialMessage:e.message};e.model!==void 0&&(t.model=e.model);let r=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(u)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),i=Date.now()-n;console.info(`[admin-ui] sidebar-new-session-fetch-done status=${r.status} ok=${r.ok} ms=${i}`);let a=await r.json();if(!r.ok||!(`sessionId`in a)){let e=a,t=e.error??`POST returned ${r.status}`,i=e.reason?`${t}: ${e.reason}`:t;console.error(`[admin-ui] sidebar-new-session-failed status=${r.status} ms=${Date.now()-n} error=${t} reason=${e.reason??`none`} tail=${JSON.stringify(e.stderrTail??``)}`),B(i);return}console.info(`[admin-ui] sidebar-new-session-ok pid=${a.pid} sessionId=${a.sessionId.slice(0,8)} permissionMode=${e.permissionMode} model=${e.model??`default`} ms=${Date.now()-n}`),ue.setSessions(e=>[a,...e]),Te(!1);let o=a.sessionId,s=o.slice(0,8);if(e.placeholder===null)console.info(`[admin-ui] new-session-auto-open outcome=fallback sessionId=${s}`),P(o);else{let t=setTimeout(()=>{let e=H.current.get(o);e&&(H.current.delete(o),e.placeholder.closed||e.placeholder.close(),console.info(`[admin-ui] new-session-auto-open outcome=timeout sessionId=${s}`))},Ue);H.current.set(o,{placeholder:e.placeholder,timeoutId:t})}}catch(e){let t=e instanceof Error?e.message:String(e);B(t),console.error(`[admin-ui] sidebar-new-session-threw ms=${Date.now()-n} message=${t}`)}finally{be(!1)}},[u,I,ue,P]),$=ge(u,ue,`sidebar`),st=(0,A.useCallback)(async e=>{let t=await $.resume(e);t.ok||console.error(`[admin-ui] sidebar-resume failed: ${t.error}`)},[$]),ct=(0,A.useCallback)(async e=>{_e(!0),me(null);let t=await $.purge(e);t.ok?F(null):me(t.error??`purge failed`),_e(!1)},[$]),lt=(0,A.useCallback)(async e=>{let t=await $.end(e);t.ok||console.error(`[admin-ui] sidebar-end-session failed: ${t.error}`)},[$]),ut=(0,A.useCallback)(async e=>{let t=await $.archive(e);t.ok||console.error(`[admin-ui] sidebar-archive failed: ${t.error}`)},[$]),dt=(0,A.useCallback)(async e=>{let t=await $.unarchive(e);t.ok||console.error(`[admin-ui] sidebar-unarchive failed: ${t.error}`)},[$]),[ft,pt]=(0,A.useState)(null),[mt,ht]=(0,A.useState)(``),gt=(0,A.useCallback)(async(e,t)=>{let n=mt.trim();if(n.length===0||!fe(n)){pt(null);return}if(n===(t??``)){pt(null);return}let r=await $.rename(e,n);r.ok||console.error(`[admin-ui] sidebar-rename failed: ${r.error}`),pt(null)},[mt,$]),_t=(0,A.useCallback)(()=>{pt(null)},[]),[vt,yt]=(0,A.useState)(null),bt=(0,A.useCallback)(async(e,t)=>{try{await l(t),yt(e),window.setTimeout(()=>{yt(t=>t===e?null:t)},1200)}catch(e){console.error(`[admin-ui] sidebar-copy-label failed: ${String(e)}`)}},[]);return(0,j.jsxs)(`aside`,{className:`side`,children:[K===`chat`&&(0,j.jsxs)(`div`,{className:`side-new-session-row`,ref:Ye,children:[(0,j.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:it,disabled:I||!u,children:[I?(0,j.jsx)(C,{size:14,className:`spinning`}):(0,j.jsx)(O,{size:14}),(0,j.jsx)(`span`,{children:`New session`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`side-mode-trigger`,onClick:()=>{let e=!J;console.info(`[admin-ui] sidebar-mode-picker action=${e?`open`:`close`} mode=${L}`),Y(e)},disabled:I,"aria-haspopup":`menu`,"aria-expanded":J,"aria-label":`Permission mode for the next session`,title:`Shift+Cmd+M`,children:[Xe[L],(0,j.jsx)(o,{size:12,"aria-hidden":`true`})]}),J&&(0,j.jsxs)(`div`,{className:`side-mode-popover`,role:`menu`,"aria-label":`Mode`,children:[(0,j.jsxs)(`div`,{className:`side-mode-popover-head`,children:[(0,j.jsx)(`span`,{children:`Mode`}),(0,j.jsx)(`span`,{className:`side-mode-popover-shortcut`,"aria-hidden":`true`,children:`⇧⌘M`})]}),Ze.map((e,t)=>(0,j.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`side-mode-popover-item`,onClick:()=>{console.info(`[admin-ui] sidebar-mode-picker action=select mode=${e}`),R(e),Y(!1),X({permissionMode:e,model:xe},`sidebar`)},children:[(0,j.jsx)(`span`,{children:Xe[e]}),(0,j.jsxs)(`span`,{className:`side-mode-popover-shortcut`,children:[e===L&&(0,j.jsx)(_,{size:12}),(0,j.jsx)(`span`,{children:t+1})]})]},e))]})]}),(0,j.jsxs)(`nav`,{className:`side-nav`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`nav-row${K===`chat`?` active`:``}`,onClick:Qe,children:[(0,j.jsx)(ie,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,j.jsx)(`span`,{className:`kbd`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),ne(),N()},children:[(0,j.jsx)(ae,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`People`}),(0,j.jsx)(`span`,{className:`kbd`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),M(),N()},children:[(0,j.jsx)(h,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`Agents`}),(0,j.jsx)(`span`,{className:`kbd`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),te(),N()},children:[(0,j.jsx)(g,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`Projects`}),(0,j.jsx)(`span`,{className:`kbd`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),oe(),N()},children:[(0,j.jsx)(S,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,j.jsx)(`span`,{className:`kbd`})]}),(0,j.jsxs)(`button`,{type:`button`,className:`nav-row${K===`artefacts`?` active`:``}`,onClick:$e,children:[(0,j.jsx)(c,{size:20,strokeWidth:Q}),(0,j.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,j.jsx)(`span`,{className:`kbd`})]})]}),(0,j.jsxs)(`div`,{className:`side-list`,ref:ve,children:[(0,j.jsxs)(`div`,{className:`group-head`,children:[(0,j.jsx)(`span`,{children:et}),(0,j.jsxs)(`span`,{className:`group-head-meta`,children:[(0,j.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh ${et.toLowerCase()}`,"aria-label":`Refresh ${et.toLowerCase()}`,onClick:rt,disabled:nt,children:(0,j.jsx)(k,{size:12,className:nt?`spinning`:void 0})}),(0,j.jsx)(`span`,{children:tt})]})]}),K===`chat`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ke,{view:W.view,setView:e=>{console.info(`[admin-ui] sidebar-view-change view=${e}`),W.setView(e)},connected:W.connected,reconnectNow:W.reconnectNow}),w&&(0,j.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:w}),G.map(e=>{let t=se===e.sessionId,n=ft===e.sessionId;return(0,j.jsxs)(`div`,{className:`conv${t?` active`:``}`,children:[n?(0,j.jsxs)(`span`,{className:`conv-name-line`,style:{flex:1,minWidth:0},children:[(0,j.jsx)(ie,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,j.jsx)(qe,{live:e.live,status:e.status}),(0,j.jsx)(`input`,{type:`text`,value:mt,autoFocus:!0,maxLength:200,onChange:e=>ht(e.target.value),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),gt(e.sessionId,e.firstPrompt)):t.key===`Escape`&&(t.preventDefault(),_t())},onBlur:()=>{gt(e.sessionId,e.firstPrompt)},className:`conv-name`,"aria-label":`Rename session`,style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`inherit`,font:`inherit`}})]}):(0,j.jsxs)(`button`,{type:`button`,className:`conv-name-button`,onClick:()=>{P(e.sessionId),N()},title:`Show metadata`,children:[(0,j.jsxs)(`span`,{className:`conv-name-line`,children:[(0,j.jsx)(ie,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,j.jsx)(qe,{live:e.live,status:e.status}),e.firstPrompt?(0,j.jsx)(`span`,{className:`conv-name`,children:e.firstPrompt}):(0,j.jsxs)(`span`,{className:`conv-name`,style:{fontStyle:`italic`,opacity:.6},children:[`(unnamed · `,e.sessionId.slice(0,8),`)`]})]}),(0,j.jsx)(`span`,{className:`conv-timestamp`,children:Ie(e.updatedAt,Me)})]}),!n&&(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Rename`,"aria-label":`Rename session`,onClick:()=>{ht(e.firstPrompt??``),pt(e.sessionId)},children:(0,j.jsx)(D,{size:13})}),!n&&(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Copy label`,"aria-label":`Copy session label`,onClick:()=>void bt(e.sessionId,e.firstPrompt??`(unnamed · ${e.sessionId.slice(0,8)})`),children:vt===e.sessionId?(0,j.jsx)(_,{size:13}):(0,j.jsx)(s,{size:13})}),e.url!==null&&(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Open in new tab`,"aria-label":`Open in new tab`,onClick:()=>Je(e.url,e.sessionId),children:(0,j.jsx)(b,{size:13})}),e.live?(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`End session`,"aria-label":`End session`,onClick:()=>void lt(e.sessionId),disabled:$.inFlight===`end`,children:$.inFlight===`end`?(0,j.jsx)(C,{size:13,className:`spinning`}):(0,j.jsx)(re,{size:13})}):e.archived?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Unarchive session`,"aria-label":`Unarchive session`,onClick:()=>void dt(e.sessionId),disabled:$.inFlight===`unarchive`,children:$.inFlight===`unarchive`?(0,j.jsx)(C,{size:13,className:`spinning`}):(0,j.jsx)(p,{size:13})}),(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{me(null),F({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,j.jsx)(r,{size:13})})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Resume session`,"aria-label":`Resume session`,onClick:()=>void st(e.sessionId),disabled:$.inFlight===`resume`,children:$.inFlight===`resume`?(0,j.jsx)(C,{size:13,className:`spinning`}):(0,j.jsx)(i,{size:13})}),(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Archive session`,"aria-label":`Archive session`,onClick:()=>void ut(e.sessionId),disabled:$.inFlight===`archive`,children:$.inFlight===`archive`?(0,j.jsx)(C,{size:13,className:`spinning`}):(0,j.jsx)(m,{size:13})}),(0,j.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{me(null),F({sessionId:e.sessionId,displayName:e.firstPrompt})},children:(0,j.jsx)(r,{size:13})})]})]},e.sessionId)})]}),K===`artefacts`&&(0,j.jsxs)(j.Fragment,{children:[ze&&(0,j.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:ze}),Fe&&!ze&&q.length===0&&(0,j.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),q.map(e=>(0,j.jsxs)(`button`,{type:`button`,className:`conv`,onClick:()=>{ee({docId:e.id,name:e.name,content:e.content,editable:e.editable,mimeType:e.mimeType,skipReason:e.skipReason},`sidebar-artefacts`),N()},children:[(0,j.jsx)(`span`,{className:`conv-name`,children:e.name}),(0,j.jsx)(`span`,{className:`conv-kind`,"data-kind":e.kind===`agent-template`?`agent`:`doc`,children:e.kind===`agent-template`?`agent`:`doc`})]},e.id))]})]}),(0,j.jsx)(Ge,{}),(0,j.jsxs)(`div`,{className:`side-foot`,children:[(0,j.jsx)(`div`,{className:`avatar`,children:v?(0,j.jsx)(`img`,{src:v,alt:U}):De}),(0,j.jsxs)(`div`,{className:`who`,children:[(0,j.jsx)(`span`,{className:`name`,children:U}),(0,j.jsx)(`span`,{className:`role`,children:d??`operator`})]})]}),we&&(0,j.jsx)(He,{seedMode:L,seedModel:xe,submitting:I,error:Ce,onSubmit:e=>void ot(e),onCancel:at,onErrorClear:()=>B(null)}),de&&(0,j.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`purge-confirm-title`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&!he&&F(null)},children:(0,j.jsxs)(`div`,{className:`modal-card`,children:[(0,j.jsx)(`h3`,{id:`purge-confirm-title`,style:{margin:0,marginBottom:8,fontSize:16,fontWeight:600},children:`Purge session JSONL?`}),(0,j.jsxs)(`p`,{style:{margin:0,marginBottom:8,fontSize:13},children:[`This hard-deletes the transcript for `,(0,j.jsx)(`strong`,{children:de.displayName??de.sessionId.slice(0,8)}),`. The action cannot be undone.`]}),pe&&(0,j.jsx)(`p`,{style:{margin:0,marginBottom:8,fontSize:12,color:`var(--text-tertiary)`},children:pe}),(0,j.jsxs)(`div`,{className:`modal-action-row`,children:[(0,j.jsx)(`button`,{type:`button`,className:`modal-action-btn`,disabled:he,onClick:()=>F(null),children:`Cancel`}),(0,j.jsx)(`button`,{type:`button`,className:`modal-action-btn`,"data-variant":`danger`,disabled:he,onClick:()=>void ct(de.sessionId),children:he?(0,j.jsx)(C,{size:13,className:`spinning`}):`Purge`})]})]})})]})}),J=5e3;function Ge(){let[e,t]=(0,A.useState)(null);if((0,A.useEffect)(()=>{let e=!1,n=null;async function r(){try{let n=await fetch(`/api/admin/system-stats`);if(!n.ok){console.error(`[admin-ui] system-stats-fetch-failed status=${n.status}`);return}let r=await n.json();e||t(r)}catch(e){console.error(`[admin-ui] system-stats-fetch-failed reason=${e instanceof Error?e.message:String(e)}`)}}function i(){n===null&&(r(),n=setInterval(()=>{r()},J))}function a(){n!==null&&(clearInterval(n),n=null)}function o(){document.hidden?a():i()}return document.hidden||i(),document.addEventListener(`visibilitychange`,o),()=>{e=!0,a(),document.removeEventListener(`visibilitychange`,o)}},[]),!e)return null;let n=e.cpuPct,r=e.memUsedPct,i=n!==null&&n>=.9,a=n!==null&&n>=.98,o=r!==null&&r>=.9,s=r!==null&&r>=.98,c=i||o,l=a||s,u=e=>e===null?`—`:`${Math.round(e*100)}%`,d=e=>{if(e===null)return{width:`0%`,background:`var(--text-tertiary)`};let t=Math.min(1,Math.max(0,e)),n=Math.round(140*(1-t));return{width:`${Math.round(t*100)}%`,background:`hsl(${n}, 65%, 45%)`}},f=[`system-stats`];return c&&f.push(`system-stats--warn`),l&&f.push(`system-stats--crit`),(0,j.jsxs)(`div`,{className:f.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,j.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,j.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),(0,j.jsx)(`div`,{className:`system-stats__bar`,children:(0,j.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(n)})})]}),(0,j.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,j.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]}),(0,j.jsx)(`div`,{className:`system-stats__bar`,children:(0,j.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(r)})})]})]})}var Y=[{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`all`,label:`All`}];function Ke(e){let{view:t,setView:n,connected:r,reconnectNow:i}=e;return(0,j.jsx)(`div`,{className:`session-view-controls`,children:(0,j.jsxs)(`div`,{className:`session-view-segmented`,role:`tablist`,"aria-label":`Session view`,children:[Y.map(e=>(0,j.jsx)(`button`,{type:`button`,role:`tab`,className:`session-view-tab${t===e.value?` active`:``}`,"aria-selected":t===e.value,onClick:()=>n(e.value),children:e.label},e.value)),r?(0,j.jsx)(`span`,{className:`session-view-connection connected`,"aria-label":`Live updates connected.`,title:`Live updates connected.`}):(0,j.jsx)(`button`,{type:`button`,className:`session-view-connection disconnected`,"aria-label":`Live updates paused. Click to retry.`,title:`Live updates paused. Click to retry.`,onClick:i})]})})}function qe({live:e,status:t}){return e?t===`busy`?(0,j.jsxs)(`span`,{className:`session-status session-status-busy`,"aria-label":`session busy`,children:[(0,j.jsx)(`span`,{className:`session-status-dot`}),(0,j.jsx)(`span`,{className:`session-status-dot`}),(0,j.jsx)(`span`,{className:`session-status-dot`})]}):t===`detached`?(0,j.jsx)(`span`,{className:`session-status session-status-detached`,"aria-label":`session detached — manager restart survivor`}):(0,j.jsx)(`span`,{className:`session-status session-status-idle`,"aria-label":`session idle`}):(0,j.jsx)(`span`,{className:`session-status session-status-archived`,"aria-label":`session archived`})}function Je(e,t){let n=t.slice(0,8),r=window.open(e,`_blank`,`noopener,noreferrer`)===null?`blocked`:`ok`;console.info(`[admin-ui] sidebar-open-in-new-tab outcome=${r} sessionId=${n}`)}function Ye(e){return e.map(e=>[e.sessionId,e.displayName,e.lastMessageAt,e.status])}function Xe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r[0]!==i[0]||r[1]!==i[1]||r[2]!==i[2]||r[3]!==i[3])return!1}return!0}function Ze(e){let[t,n]=(0,A.useState)([]),[r,i]=(0,A.useState)(!1),[a,o]=(0,A.useState)(null),[s,c]=(0,A.useState)(null),l=(0,A.useRef)([]),u=(0,A.useCallback)(async t=>{if(!e||!t&&s===e)return null;i(!0),o(null);try{let t=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`claude-sessions fetch returned ${t.status}`);let r=await t.json(),i=Array.isArray(r)?r:r.sessions??[],a=Ye(i),o=Xe(l.current,a);return o||(n(i),l.current=a),c(e),console.info(`[admin-ui] sessions-poll outcome=${o?`unchanged`:`changed`} count=${i.length} cacheKey=${e.slice(0,8)}`),i}catch(t){return console.info(`[admin-ui] sessions-poll outcome=error count=0 cacheKey=${e.slice(0,8)}`),console.error(`[admin/claude-sessions] fetch failed:`,t),o(t instanceof Error?t.message:String(t)),null}finally{i(!1)}},[e,s]);(0,A.useEffect)(()=>{e||(c(null),n([]),o(null),l.current=[])},[e]);let d=(0,A.useCallback)(()=>u(!1),[u]),f=(0,A.useCallback)(()=>u(!0),[u]);return{sessions:t,setSessions:n,loading:r,loaded:s!==null&&s===e,error:a,ensureLoaded:d,refetch:f}}var X=`admin-sidebar-collapsed`,Z=`admin-sidebar-drawer-open`;function Qe(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(X)===`1`}catch{return!1}}function $e(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(X,`1`):window.sessionStorage.removeItem(X)}catch{}}function Q(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(Z)===`1`}catch{return!1}}function et(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(Z,`1`):window.sessionStorage.removeItem(Z)}catch{}}var tt=720;function nt(e){let{cacheKey:t,businessName:n,onLogout:r,userName:i,userAvatar:a,role:o,selectedSessionId:s,onSelectSession:c,onSelectArtefact:l,dataArtefact:u=`closed`,children:d,footer:f}=e,[p,m]=(0,A.useState)(()=>Qe()),[h,g]=(0,A.useState)(()=>Q()),[_,v]=(0,A.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${tt}px)`).matches);(0,A.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${tt}px)`),t=e=>v(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let y=(0,A.useCallback)(e=>{$e(e),m(e)},[]),b=(0,A.useCallback)(e=>{et(e),g(e)},[]);(0,A.useEffect)(()=>{if(typeof window>`u`)return;let e=window.location?.pathname??``;console.info(`[admin-ui] shell-mount route=${e} collapsed=${p} drawer=${h}`)},[]);let x=_?h:!p,S=(0,A.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${tt}px)`).matches){let e=h;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),b(!e)}else{let e=p;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),y(!e)}},[p,h,y,b]),C=(0,A.useCallback)(e=>{console.info(`[admin-ui] header-menu-nav target=${e}`),window.location.href=e===`data`?`/data`:`/graph`},[]),w=Ze(t),T=ke(t),E=(0,A.useMemo)(()=>T.rows.map(e=>e.sessionId),[T.rows]),ee=(0,A.useCallback)(e=>{if(c){c(e);return}window.location.assign(`/?sessionId=${encodeURIComponent(e)}`)},[c]),D=(0,A.useCallback)(e=>{l&&l(e)},[l]),O={collapsed:p,mobileDrawerOpen:h,sidebarOpen:x,onToggleSidebar:S,setMobileDrawerOpen:b,sessionsState:w,sessionRowIds:E,sessionRowsConnected:T.connected};return(0,j.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,j.jsx)(be,{businessName:n,onNavigate:C,onToggleSidebar:S,sidebarOpen:x,onLogout:r}),(0,j.jsxs)(`div`,{className:`platform${h?` menu-open`:``}${p?` sidebar-collapsed`:``}`,"data-artefact":u,children:[(0,j.jsx)(We,{businessName:n,cacheKey:t,role:o??null,userName:i,userAvatar:a??null,sessions:w.sessions,sessionsLoading:w.loading,sessionsError:w.error,ensureSessionsLoaded:w.ensureLoaded,refetchSessions:w.refetch,onSelectArtefact:D,onSelectProjects:()=>{window.location.href=`/graph?label=Project`},onSelectPeople:()=>{window.location.href=`/graph?label=Person`},onSelectTasks:()=>{window.location.href=`/graph?label=Task`},onSelectAgents:()=>{window.location.href=`/graph?label=Agent`},onCloseMobileDrawer:()=>b(!1),onSelectSession:ee,selectedSessionId:s??null,collapsed:p,mobileDrawerOpen:h,recentsActions:{setSessions:w.setSessions,refetch:w.refetch}}),typeof d==`function`?d(O):d]}),h&&(0,j.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>b(!1)}),f]})}var rt={LocalBusiness:`#4F6B8A`,Service:`#6B85A0`,PriceSpecification:`#8AA0B8`,OpeningHoursSpecification:`#A8BACE`,Listing:`#3F5670`,Property:`#5C7A99`,Viewing:`#D4A574`,Offer:`#B08850`,Organization:`#8A6B47`,Person:`#B86E4A`,UserProfile:`#D08960`,Preference:`#DFA67A`,AdminUser:`#8C5230`,AccessGrant:`#66381F`,KnowledgeDocument:`#6E8A5A`,ConversationArchive:`#82A06A`,Section:`#8AA876`,Chunk:`#A6C194`,DigitalDocument:`#5A7548`,CreativeWork:`#B5C9A2`,Question:`#C7D6B5`,FAQPage:`#95B385`,DefinedTerm:`#76906A`,Review:`#3F5A2E`,ImageObject:`#A0BB8C`,Conversation:`#6B5A85`,AdminConversation:`#4F4070`,PublicConversation:`#8A75A8`,Message:`#6B7280`,UserMessage:`#DFA67A`,AssistantMessage:`#C9A876`,ToolCall:`#B5ABCB`,Task:`#B0617A`,Project:`#8E4A60`,Event:`#C68095`,Workflow:`#3A6F77`,WorkflowStep:`#5A8E96`,WorkflowRun:`#7AAAB2`,StepResult:`#9CC4CB`,Email:`#6F7F4A`,EmailAccount:`#91A063`,Agent:`#B8893D`},it=`#94A3B8`;Object.freeze(Object.keys(rt)),Object.freeze(new Set([`Chunk`,`GraphPreference`]));var at=Object.freeze(new Set(`LocalBusiness.Service.PriceSpecification.OpeningHoursSpecification.Organization.Person.UserProfile.Preference.AdminUser.AccessGrant.KnowledgeDocument.DigitalDocument.CreativeWork.Question.FAQPage.DefinedTerm.Review.ImageObject.Listing.Property.Viewing.Offer.AdminConversation.PublicConversation.Task.Project.Event.Workflow.Email.EmailAccount.Agent`.split(`.`)));Object.freeze(new Set([`ToolCall`,`StepResult`,`WorkflowStep`,`WorkflowRun`])),Object.freeze(new Set([`HAS_TOOL_CALL`,`RUN_OF`,`HAS_STEP`,`HAS_RESULT`]));function ot(e){for(let t=1;t<e.length;t++)if(Object.prototype.hasOwnProperty.call(rt,e[t]))return e[t];return e[0]??null}function $(e){return rt[e]??`#94A3B8`}function st(e){let t=ot(e),n=t?$(t):it,r=0;for(let t=1;t<e.length;t++)Object.prototype.hasOwnProperty.call(rt,e[t])&&r++;return{displayLabel:t,colour:n,driftCandidates:r}}export{p as C,m as S,D as _,nt as a,y as b,fe as c,oe as d,re as f,O as g,k as h,st as i,ge as l,te as m,$ as n,Te as o,ne as p,ot as r,ye as s,at as t,ce as u,C as v,_ as x,b as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DD-I1_y5.js";import{d as t,g as n,u as r,y as i}from"./ChatInput-CJo_77bp.js";import{a,b as o,m as s,o as c,t as l,u,v as d}from"./graph-labels-h39S93Xo.js";var f=n(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),p=n(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),m=n(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),h=n(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),g=n(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);function _(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||l.has(e)&&(t.add(e),n.push(e)));return n}var v=80;function y(e){let t=b(e.properties)??e.labels[0]??``,n=t.length>v?t.slice(0,v):t;return`/graph?${new URLSearchParams({nodeId:e.nodeId,label:n}).toString()}`}function b(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}var x=e(i(),1),S=r();function C(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(!1),[i,s]=(0,x.useState)(void 0),[c,l]=(0,x.useState)(null),[f,p]=(0,x.useState)(void 0),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(null);(0,x.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&s(e.businessName),e.conversationId!==void 0&&l(e.conversationId??null),_(e.role??null),p(e.userName===void 0?null:e.userName),h(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let v=(0,x.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]);return n?e?(0,S.jsxs)(a,{cacheKey:e,businessName:i,conversationId:c,onLogout:v,userName:f,userAvatar:m,role:g,children:[(0,S.jsx)(u,{}),(0,S.jsxs)(`div`,{className:`data-page`,children:[(0,S.jsx)(`header`,{className:`data-header`,children:(0,S.jsxs)(`h1`,{className:`data-title`,children:[(0,S.jsx)(o,{size:18}),` Data`]})}),(0,S.jsx)(w,{cacheKey:e})]})]}):(0,S.jsxs)(`div`,{className:`data-page`,children:[(0,S.jsx)(`header`,{className:`data-header`,children:(0,S.jsxs)(`h1`,{className:`data-title`,children:[(0,S.jsx)(o,{size:18}),` Data`]})}),(0,S.jsxs)(`div`,{className:`data-empty`,children:[(0,S.jsx)(`p`,{children:`You are not signed in.`}),(0,S.jsxs)(`p`,{children:[`Open the `,(0,S.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})]}):(0,S.jsx)(`div`,{className:`data-page`,children:(0,S.jsxs)(`div`,{className:`data-loading`,children:[(0,S.jsx)(d,{size:18,className:`spin`}),` Loading…`]})})}function w({cacheKey:e,onOpenInGraph:t}){let{adminFetch:n,cacheKey:r,sessionRefetchNonce:i,banner:a,reloadToLogin:o}=c({initialCacheKey:e,surface:`data`});return(0,S.jsxs)(`main`,{className:`data-main`,children:[a&&(0,S.jsx)(`button`,{type:`button`,className:`data-session-banner`,onClick:o,"data-reason":a.reason,children:a.message}),(0,S.jsx)(T,{adminFetch:n,sessionRefetchNonce:i,onOpenInGraph:t}),(0,S.jsx)(A,{adminFetch:n,cacheKey:r,sessionRefetchNonce:i})]})}function T({adminFetch:e,sessionRefetchNonce:t,onOpenInGraph:n}){let[r,i]=(0,x.useState)(``),[a,o]=(0,x.useState)(``),[c,l]=(0,x.useState)(null),[u,f]=(0,x.useState)(`hybrid`),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(null),[v,b]=(0,x.useState)(null),[C,w]=(0,x.useState)(0),[T,O]=(0,x.useState)(!1);(0,x.useEffect)(()=>{let e=r.trim();if(!e){o(``),l(null);return}O(!1);let t=setTimeout(()=>o(e),300);return()=>clearTimeout(t)},[r]),(0,x.useEffect)(()=>{if(!a)return;let t=!1;return m(!0),g(null),e(`/api/admin/graph-search?q=${encodeURIComponent(a)}&labels=*&limit=20${T?`&threshold=0`:``}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(l(e.results),f(e.mode??`hybrid`),w(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||g(e instanceof Error?e.message:String(e))}).finally(()=>{t||m(!1)}),()=>{t=!0}},[a,e,t,T]);let k=(0,x.useMemo)(()=>c?_(c):[],[c]),A=v&&k.includes(v)?v:null,j=(0,x.useMemo)(()=>c?A?c.filter(e=>e.labels.includes(A)):c:null,[c,A]),M=(0,x.useCallback)(e=>{if(n){n(e);return}window.location.href=y(e)},[n]);return(0,S.jsxs)(`section`,{className:`data-panel`,children:[(0,S.jsx)(`h2`,{className:`data-panel-title`,children:`Search`}),(0,S.jsx)(`p`,{className:`data-panel-subtitle`,children:`Find anything in your knowledge base by keyword.`}),(0,S.jsxs)(`div`,{className:`data-search-input`,children:[(0,S.jsx)(s,{size:14}),(0,S.jsx)(`input`,{type:`text`,placeholder:`Search your knowledge…`,value:r,onChange:e=>i(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),p&&(0,S.jsx)(d,{size:14,className:`spin`})]}),h&&(0,S.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,h]}),k.length>0&&(0,S.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:k.map(e=>{let t=e===A;return(0,S.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>b(t?null:e),children:D([e])??e},e)})}),c&&!p&&(0,S.jsxs)(`div`,{className:`data-results-meta`,children:[j.length,` of `,c.length,` result`,c.length===1?``:`s`]}),c&&!p&&!A&&C>0&&!T&&(0,S.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>O(!0),children:[C,` low-confidence result`,C===1?``:`s`,` hidden — show all`]}),c&&!p&&!A&&T&&(0,S.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>O(!1),children:`Showing all results — hide low-confidence`}),c&&c.length===0&&!p&&(0,S.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),j&&j.length>0&&(0,S.jsx)(`ul`,{className:`data-results`,children:j.map(e=>(0,S.jsx)(E,{hit:e,mode:u,onOpenInGraph:M},e.nodeId))})]})}function E({hit:e,mode:t,onOpenInGraph:n}){let r=O(e.properties),i=k(e.properties),a=D(e.labels),[o,s]=(0,x.useState)(!1),c=i&&i.length>280,l=o||!c?i:i?.slice(0,280)+`…`,u=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`;return(0,S.jsxs)(`li`,{className:`data-result`,children:[(0,S.jsxs)(`div`,{role:`button`,tabIndex:0,className:`data-result-open`,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},"aria-label":`Open ${r??a??`node`} in graph`,children:[a&&(0,S.jsx)(`div`,{className:`data-result-header`,children:(0,S.jsx)(`span`,{className:`data-result-labels`,children:a})}),r&&(0,S.jsx)(`div`,{className:`data-result-title`,children:r}),i&&(0,S.jsx)(`pre`,{className:`data-result-body`,children:l}),(0,S.jsx)(`div`,{className:`data-result-scores`,children:u})]}),c&&(0,S.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>s(e=>!e),children:o?`Show less`:`Show more`})]})}function D(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function O(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function k(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function A({adminFetch:e,cacheKey:n,sessionRefetchNonce:r}){let[i,a]=(0,x.useState)(`.`),[o,s]=(0,x.useState)(null),[c,l]=(0,x.useState)([]),[u,_]=(0,x.useState)(!1),[v,y]=(0,x.useState)(null),[b,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(null),[A,N]=(0,x.useState)(null),P=(0,x.useRef)(null),[F,I]=(0,x.useState)(0);(0,x.useEffect)(()=>{let t=!1;return _(!0),y(null),e(`/api/admin/files?path=${encodeURIComponent(i===`.`?``:i)}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(s(e.entries),l(e.displayPath??[]))}).catch(e=>{t||(s([]),l([]),y(e instanceof Error?e.message:String(e)))}).finally(()=>{t||_(!1)}),()=>{t=!0}},[e,i,F,r]);let L=(0,x.useCallback)(e=>{a(e)},[]),R=(0,x.useCallback)(()=>{if(i===`.`||i===``)return;let e=i.split(`/`).filter(Boolean);e.pop(),a(e.length===0?`.`:e.join(`/`))},[i]),z=(0,x.useCallback)(e=>{let t=i===`.`?e.name:`${i}/${e.name}`,r=`/api/admin/files/download?session_key=${encodeURIComponent(n)}&path=${encodeURIComponent(t)}`,a=document.createElement(`a`);a.href=r,a.rel=`noopener noreferrer`,document.body.appendChild(a),a.click(),a.remove()},[i,n]),B=(0,x.useCallback)(()=>{P.current?.click()},[]),V=(0,x.useCallback)(e=>{D(null),N(e.name)},[]),H=(0,x.useCallback)(()=>{N(null)},[]),U=(0,x.useCallback)(async t=>{let n=i===`.`?t.name:`${i}/${t.name}`;D(null),N(null),k(t.name);try{let t=await e(`/api/admin/files?path=${encodeURIComponent(n)}`,{method:`DELETE`}),r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));if(!t.ok)throw Error(r.error??`HTTP ${t.status}`);I(e=>e+1)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}},[i,e]);(0,x.useEffect)(()=>{if(!A)return;let e=e=>{e.key===`Escape`&&N(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[A]);let W=(0,x.useCallback)(async e=>{T(null),C(!0);try{let t=new FormData;t.append(`session_key`,n),t.append(`file`,e);let r=await fetch(`/api/admin/files/upload`,{method:`POST`,body:t}),i=await r.json().catch(()=>({error:`HTTP ${r.status}`}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);a(i.path.split(`/`).slice(0,-1).join(`/`)||`.`),I(e=>e+1)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1),P.current&&(P.current.value=``)}},[n]);return(0,S.jsxs)(`section`,{className:`data-panel`,children:[(0,S.jsxs)(`div`,{className:`data-panel-heading`,children:[(0,S.jsx)(`h2`,{className:`data-panel-title`,children:`Files`}),(0,S.jsxs)(`div`,{className:`data-file-actions`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`data-btn`,onClick:B,disabled:b,children:[b?(0,S.jsx)(d,{size:14,className:`spin`}):(0,S.jsx)(g,{size:14}),` Upload`]}),(0,S.jsx)(`input`,{type:`file`,ref:P,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&W(t)}})]})]}),(0,S.jsxs)(`p`,{className:`data-panel-subtitle`,children:[`Everything under your install's `,(0,S.jsx)(`code`,{children:`data/`}),` directory. Click a folder to open it, a file to download it. Uploads go to `,(0,S.jsx)(`code`,{children:`data/uploads/`}),`.`]}),(0,S.jsxs)(`div`,{className:`data-breadcrumbs`,children:[(0,S.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>L(`.`),children:`data`}),c.map((e,t)=>{let n=c.slice(0,t+1).map(e=>e.name).join(`/`);return(0,S.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,S.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,S.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>L(n),title:e.name,children:e.displayName??e.name})]},n)}),i!==`.`&&(0,S.jsxs)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-up-btn`,onClick:R,children:[(0,S.jsx)(f,{size:14}),` Up`]})]}),w&&(0,S.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,w]}),E&&(0,S.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,E]}),v&&(0,S.jsx)(`div`,{className:`data-error`,children:v}),u&&(0,S.jsxs)(`div`,{className:`data-loading`,children:[(0,S.jsx)(d,{size:14,className:`spin`}),` Loading…`]}),!u&&o&&o.length===0&&!v&&(0,S.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!u&&o&&o.length>0&&(0,S.jsx)(`ul`,{className:`data-entries`,children:o.map(e=>{let n=e.displayName??e.name,r=O===e.name,a=A===e.name;return(0,S.jsx)(`li`,{className:`data-entry`,children:e.kind===`directory`?(0,S.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onClick:()=>L(i===`.`?e.name:`${i}/${e.name}`),children:[(0,S.jsx)(h,{size:14}),(0,S.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:n})]}):e.kind===`file`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onClick:()=>z(e),title:`Download ${n}`,disabled:a,children:[(0,S.jsx)(m,{size:14}),(0,S.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:n}),(0,S.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${M(e.modifiedAt)}`,children:[j(e.sizeBytes),` · `,M(e.modifiedAt)]}),(0,S.jsx)(p,{size:12,className:`data-entry-download-icon`})]}),a?(0,S.jsxs)(`div`,{className:`data-entry-confirm`,role:`group`,"aria-label":`Confirm delete ${n}`,children:[(0,S.jsx)(`span`,{className:`data-entry-confirm-label`,children:`Delete?`}),(0,S.jsx)(`button`,{type:`button`,className:`data-entry-confirm-yes`,onClick:()=>U(e),autoFocus:!0,children:`Yes`}),(0,S.jsx)(`button`,{type:`button`,className:`data-entry-confirm-no`,onClick:H,children:`No`})]}):(0,S.jsx)(`button`,{type:`button`,className:`data-entry-delete`,onClick:()=>V(e),disabled:r,title:`Delete ${n}`,"aria-label":`Delete ${n}`,children:r?(0,S.jsx)(d,{size:14,className:`spin`}):(0,S.jsx)(t,{size:14})})]}):(0,S.jsxs)(`div`,{className:`data-entry-btn data-entry-disabled`,children:[(0,S.jsx)(m,{size:14}),(0,S.jsx)(`span`,{className:`data-entry-name`,children:n}),(0,S.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})},e.name)})})]})}function j(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function M(e){try{let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n=typeof navigator<`u`?navigator.languages&&navigator.languages.length>0?[...navigator.languages]:[navigator.language]:void 0;return t.toLocaleString(n,{dateStyle:`medium`,timeStyle:`short`})}catch{return`—`}}export{p as i,w as n,b as r,C as t};
|
|
1
|
+
import{o as e}from"./chunk-DD-I1_y5.js";import{d as t,g as n,u as r,y as i}from"./ChatInput-CJo_77bp.js";import{a,b as o,m as s,o as c,t as l,u,v as d}from"./graph-labels-BRXJHNYE.js";var f=n(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),p=n(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),m=n(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),h=n(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),g=n(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);function _(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||l.has(e)&&(t.add(e),n.push(e)));return n}var v=80;function y(e){let t=b(e.properties)??e.labels[0]??``,n=t.length>v?t.slice(0,v):t;return`/graph?${new URLSearchParams({nodeId:e.nodeId,label:n}).toString()}`}function b(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}var x=e(i(),1),S=r();function C(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(!1),[i,s]=(0,x.useState)(void 0),[c,l]=(0,x.useState)(null),[f,p]=(0,x.useState)(void 0),[m,h]=(0,x.useState)(null),[g,_]=(0,x.useState)(null);(0,x.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&s(e.businessName),e.conversationId!==void 0&&l(e.conversationId??null),_(e.role??null),p(e.userName===void 0?null:e.userName),h(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let v=(0,x.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]);return n?e?(0,S.jsxs)(a,{cacheKey:e,businessName:i,conversationId:c,onLogout:v,userName:f,userAvatar:m,role:g,children:[(0,S.jsx)(u,{}),(0,S.jsxs)(`div`,{className:`data-page`,children:[(0,S.jsx)(`header`,{className:`data-header`,children:(0,S.jsxs)(`h1`,{className:`data-title`,children:[(0,S.jsx)(o,{size:18}),` Data`]})}),(0,S.jsx)(w,{cacheKey:e})]})]}):(0,S.jsxs)(`div`,{className:`data-page`,children:[(0,S.jsx)(`header`,{className:`data-header`,children:(0,S.jsxs)(`h1`,{className:`data-title`,children:[(0,S.jsx)(o,{size:18}),` Data`]})}),(0,S.jsxs)(`div`,{className:`data-empty`,children:[(0,S.jsx)(`p`,{children:`You are not signed in.`}),(0,S.jsxs)(`p`,{children:[`Open the `,(0,S.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})]}):(0,S.jsx)(`div`,{className:`data-page`,children:(0,S.jsxs)(`div`,{className:`data-loading`,children:[(0,S.jsx)(d,{size:18,className:`spin`}),` Loading…`]})})}function w({cacheKey:e,onOpenInGraph:t}){let{adminFetch:n,cacheKey:r,sessionRefetchNonce:i,banner:a,reloadToLogin:o}=c({initialCacheKey:e,surface:`data`});return(0,S.jsxs)(`main`,{className:`data-main`,children:[a&&(0,S.jsx)(`button`,{type:`button`,className:`data-session-banner`,onClick:o,"data-reason":a.reason,children:a.message}),(0,S.jsx)(T,{adminFetch:n,sessionRefetchNonce:i,onOpenInGraph:t}),(0,S.jsx)(A,{adminFetch:n,cacheKey:r,sessionRefetchNonce:i})]})}function T({adminFetch:e,sessionRefetchNonce:t,onOpenInGraph:n}){let[r,i]=(0,x.useState)(``),[a,o]=(0,x.useState)(``),[c,l]=(0,x.useState)(null),[u,f]=(0,x.useState)(`hybrid`),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(null),[v,b]=(0,x.useState)(null),[C,w]=(0,x.useState)(0),[T,O]=(0,x.useState)(!1);(0,x.useEffect)(()=>{let e=r.trim();if(!e){o(``),l(null);return}O(!1);let t=setTimeout(()=>o(e),300);return()=>clearTimeout(t)},[r]),(0,x.useEffect)(()=>{if(!a)return;let t=!1;return m(!0),g(null),e(`/api/admin/graph-search?q=${encodeURIComponent(a)}&labels=*&limit=20${T?`&threshold=0`:``}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(l(e.results),f(e.mode??`hybrid`),w(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||g(e instanceof Error?e.message:String(e))}).finally(()=>{t||m(!1)}),()=>{t=!0}},[a,e,t,T]);let k=(0,x.useMemo)(()=>c?_(c):[],[c]),A=v&&k.includes(v)?v:null,j=(0,x.useMemo)(()=>c?A?c.filter(e=>e.labels.includes(A)):c:null,[c,A]),M=(0,x.useCallback)(e=>{if(n){n(e);return}window.location.href=y(e)},[n]);return(0,S.jsxs)(`section`,{className:`data-panel`,children:[(0,S.jsx)(`h2`,{className:`data-panel-title`,children:`Search`}),(0,S.jsx)(`p`,{className:`data-panel-subtitle`,children:`Find anything in your knowledge base by keyword.`}),(0,S.jsxs)(`div`,{className:`data-search-input`,children:[(0,S.jsx)(s,{size:14}),(0,S.jsx)(`input`,{type:`text`,placeholder:`Search your knowledge…`,value:r,onChange:e=>i(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),p&&(0,S.jsx)(d,{size:14,className:`spin`})]}),h&&(0,S.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,h]}),k.length>0&&(0,S.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:k.map(e=>{let t=e===A;return(0,S.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>b(t?null:e),children:D([e])??e},e)})}),c&&!p&&(0,S.jsxs)(`div`,{className:`data-results-meta`,children:[j.length,` of `,c.length,` result`,c.length===1?``:`s`]}),c&&!p&&!A&&C>0&&!T&&(0,S.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>O(!0),children:[C,` low-confidence result`,C===1?``:`s`,` hidden — show all`]}),c&&!p&&!A&&T&&(0,S.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>O(!1),children:`Showing all results — hide low-confidence`}),c&&c.length===0&&!p&&(0,S.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),j&&j.length>0&&(0,S.jsx)(`ul`,{className:`data-results`,children:j.map(e=>(0,S.jsx)(E,{hit:e,mode:u,onOpenInGraph:M},e.nodeId))})]})}function E({hit:e,mode:t,onOpenInGraph:n}){let r=O(e.properties),i=k(e.properties),a=D(e.labels),[o,s]=(0,x.useState)(!1),c=i&&i.length>280,l=o||!c?i:i?.slice(0,280)+`…`,u=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`;return(0,S.jsxs)(`li`,{className:`data-result`,children:[(0,S.jsxs)(`div`,{role:`button`,tabIndex:0,className:`data-result-open`,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},"aria-label":`Open ${r??a??`node`} in graph`,children:[a&&(0,S.jsx)(`div`,{className:`data-result-header`,children:(0,S.jsx)(`span`,{className:`data-result-labels`,children:a})}),r&&(0,S.jsx)(`div`,{className:`data-result-title`,children:r}),i&&(0,S.jsx)(`pre`,{className:`data-result-body`,children:l}),(0,S.jsx)(`div`,{className:`data-result-scores`,children:u})]}),c&&(0,S.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>s(e=>!e),children:o?`Show less`:`Show more`})]})}function D(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function O(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function k(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function A({adminFetch:e,cacheKey:n,sessionRefetchNonce:r}){let[i,a]=(0,x.useState)(`.`),[o,s]=(0,x.useState)(null),[c,l]=(0,x.useState)([]),[u,_]=(0,x.useState)(!1),[v,y]=(0,x.useState)(null),[b,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(null),[A,N]=(0,x.useState)(null),P=(0,x.useRef)(null),[F,I]=(0,x.useState)(0);(0,x.useEffect)(()=>{let t=!1;return _(!0),y(null),e(`/api/admin/files?path=${encodeURIComponent(i===`.`?``:i)}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(s(e.entries),l(e.displayPath??[]))}).catch(e=>{t||(s([]),l([]),y(e instanceof Error?e.message:String(e)))}).finally(()=>{t||_(!1)}),()=>{t=!0}},[e,i,F,r]);let L=(0,x.useCallback)(e=>{a(e)},[]),R=(0,x.useCallback)(()=>{if(i===`.`||i===``)return;let e=i.split(`/`).filter(Boolean);e.pop(),a(e.length===0?`.`:e.join(`/`))},[i]),z=(0,x.useCallback)(e=>{let t=i===`.`?e.name:`${i}/${e.name}`,r=`/api/admin/files/download?session_key=${encodeURIComponent(n)}&path=${encodeURIComponent(t)}`,a=document.createElement(`a`);a.href=r,a.rel=`noopener noreferrer`,document.body.appendChild(a),a.click(),a.remove()},[i,n]),B=(0,x.useCallback)(()=>{P.current?.click()},[]),V=(0,x.useCallback)(e=>{D(null),N(e.name)},[]),H=(0,x.useCallback)(()=>{N(null)},[]),U=(0,x.useCallback)(async t=>{let n=i===`.`?t.name:`${i}/${t.name}`;D(null),N(null),k(t.name);try{let t=await e(`/api/admin/files?path=${encodeURIComponent(n)}`,{method:`DELETE`}),r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));if(!t.ok)throw Error(r.error??`HTTP ${t.status}`);I(e=>e+1)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}},[i,e]);(0,x.useEffect)(()=>{if(!A)return;let e=e=>{e.key===`Escape`&&N(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[A]);let W=(0,x.useCallback)(async e=>{T(null),C(!0);try{let t=new FormData;t.append(`session_key`,n),t.append(`file`,e);let r=await fetch(`/api/admin/files/upload`,{method:`POST`,body:t}),i=await r.json().catch(()=>({error:`HTTP ${r.status}`}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);a(i.path.split(`/`).slice(0,-1).join(`/`)||`.`),I(e=>e+1)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1),P.current&&(P.current.value=``)}},[n]);return(0,S.jsxs)(`section`,{className:`data-panel`,children:[(0,S.jsxs)(`div`,{className:`data-panel-heading`,children:[(0,S.jsx)(`h2`,{className:`data-panel-title`,children:`Files`}),(0,S.jsxs)(`div`,{className:`data-file-actions`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`data-btn`,onClick:B,disabled:b,children:[b?(0,S.jsx)(d,{size:14,className:`spin`}):(0,S.jsx)(g,{size:14}),` Upload`]}),(0,S.jsx)(`input`,{type:`file`,ref:P,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&W(t)}})]})]}),(0,S.jsxs)(`p`,{className:`data-panel-subtitle`,children:[`Everything under your install's `,(0,S.jsx)(`code`,{children:`data/`}),` directory. Click a folder to open it, a file to download it. Uploads go to `,(0,S.jsx)(`code`,{children:`data/uploads/`}),`.`]}),(0,S.jsxs)(`div`,{className:`data-breadcrumbs`,children:[(0,S.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>L(`.`),children:`data`}),c.map((e,t)=>{let n=c.slice(0,t+1).map(e=>e.name).join(`/`);return(0,S.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,S.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,S.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>L(n),title:e.name,children:e.displayName??e.name})]},n)}),i!==`.`&&(0,S.jsxs)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-up-btn`,onClick:R,children:[(0,S.jsx)(f,{size:14}),` Up`]})]}),w&&(0,S.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,w]}),E&&(0,S.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,E]}),v&&(0,S.jsx)(`div`,{className:`data-error`,children:v}),u&&(0,S.jsxs)(`div`,{className:`data-loading`,children:[(0,S.jsx)(d,{size:14,className:`spin`}),` Loading…`]}),!u&&o&&o.length===0&&!v&&(0,S.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!u&&o&&o.length>0&&(0,S.jsx)(`ul`,{className:`data-entries`,children:o.map(e=>{let n=e.displayName??e.name,r=O===e.name,a=A===e.name;return(0,S.jsx)(`li`,{className:`data-entry`,children:e.kind===`directory`?(0,S.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onClick:()=>L(i===`.`?e.name:`${i}/${e.name}`),children:[(0,S.jsx)(h,{size:14}),(0,S.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:n})]}):e.kind===`file`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onClick:()=>z(e),title:`Download ${n}`,disabled:a,children:[(0,S.jsx)(m,{size:14}),(0,S.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:n}),(0,S.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${M(e.modifiedAt)}`,children:[j(e.sizeBytes),` · `,M(e.modifiedAt)]}),(0,S.jsx)(p,{size:12,className:`data-entry-download-icon`})]}),a?(0,S.jsxs)(`div`,{className:`data-entry-confirm`,role:`group`,"aria-label":`Confirm delete ${n}`,children:[(0,S.jsx)(`span`,{className:`data-entry-confirm-label`,children:`Delete?`}),(0,S.jsx)(`button`,{type:`button`,className:`data-entry-confirm-yes`,onClick:()=>U(e),autoFocus:!0,children:`Yes`}),(0,S.jsx)(`button`,{type:`button`,className:`data-entry-confirm-no`,onClick:H,children:`No`})]}):(0,S.jsx)(`button`,{type:`button`,className:`data-entry-delete`,onClick:()=>V(e),disabled:r,title:`Delete ${n}`,"aria-label":`Delete ${n}`,children:r?(0,S.jsx)(d,{size:14,className:`spin`}):(0,S.jsx)(t,{size:14})})]}):(0,S.jsxs)(`div`,{className:`data-entry-btn data-entry-disabled`,children:[(0,S.jsx)(m,{size:14}),(0,S.jsx)(`span`,{className:`data-entry-name`,children:n}),(0,S.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})},e.name)})})]})}function j(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function M(e){try{let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n=typeof navigator<`u`?navigator.languages&&navigator.languages.length>0?[...navigator.languages]:[navigator.language]:void 0;return t.toLocaleString(n,{dateStyle:`medium`,timeStyle:`short`})}catch{return`—`}}export{p as i,w as n,b as r,C as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-DD-I1_y5.js";import{d as n,g as r,u as i,y as a}from"./ChatInput-CJo_77bp.js";import{a as o,d as s,g as c,h as l,i as u,m as d,n as f,o as p,p as m,r as h,u as g,v as _}from"./graph-labels-h39S93Xo.js";import{t as v}from"./Checkbox-YrQovXpN.js";var y=r(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),b=r(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),x=r(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),S=r(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ee=r(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),C=r(`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`}]]),te=t(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n.vis=n.vis||{}))})(e,(function(e){function t(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var n=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var i={exports:{}},a=function(e){return e&&e.Math===Math&&e},o=a(typeof globalThis==`object`&&globalThis)||a(typeof window==`object`&&window)||a(typeof self==`object`&&self)||a(typeof n==`object`&&n)||(function(){return this})()||n||Function(`return this`)(),s=function(e){try{return!!e()}catch{return!0}},c=!s(function(){var e=(function(){}).bind();return typeof e!=`function`||e.hasOwnProperty(`prototype`)}),l=c,u=Function.prototype,d=u.apply,f=u.call,p=typeof Reflect==`object`&&Reflect.apply||(l?f.bind(d):function(){return f.apply(d,arguments)}),m=c,h=Function.prototype,g=h.call,_=m&&h.bind.bind(g,g),v=m?_:function(e){return function(){return g.apply(e,arguments)}},y=v,b=y({}.toString),x=y(``.slice),S=function(e){return x(b(e),8,-1)},ee=S,C=v,te=function(e){if(ee(e)===`Function`)return C(e)},w=typeof document==`object`&&document.all,ne={all:w,IS_HTMLDDA:w===void 0&&w!==void 0},T=ne,E=T.all,D=T.IS_HTMLDDA?function(e){return typeof e==`function`||e===E}:function(e){return typeof e==`function`},O={},k=!s(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),re=c,A=Function.prototype.call,j=re?A.bind(A):function(){return A.apply(A,arguments)},ie={},ae={}.propertyIsEnumerable,oe=Object.getOwnPropertyDescriptor;ie.f=oe&&!ae.call({1:2},1)?function(e){var t=oe(this,e);return!!t&&t.enumerable}:ae;var se=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},ce=v,le=s,ue=S,de=Object,fe=ce(``.split),pe=le(function(){return!de(`z`).propertyIsEnumerable(0)})?function(e){return ue(e)===`String`?fe(e,``):de(e)}:de,me=function(e){return e==null},he=me,ge=TypeError,_e=function(e){if(he(e))throw new ge(`Can't call method on `+e);return e},ve=pe,ye=_e,be=function(e){return ve(ye(e))},xe=D,Se=ne,M=Se.all,N=Se.IS_HTMLDDA?function(e){return typeof e==`object`?e!==null:xe(e)||e===M}:function(e){return typeof e==`object`?e!==null:xe(e)},Ce={},we=Ce,Te=o,Ee=D,P=function(e){return Ee(e)?e:void 0},F=function(e,t){return arguments.length<2?P(we[e])||P(Te[e]):we[e]&&we[e][t]||Te[e]&&Te[e][t]},De=v({}.isPrototypeOf),Oe=typeof navigator<`u`&&String(navigator.userAgent)||``,I=o,ke=Oe,Ae=I.process,je=I.Deno,Me=Ae&&Ae.versions||je&&je.version,Ne=Me&&Me.v8,Pe,Fe;Ne&&(Pe=Ne.split(`.`),Fe=Pe[0]>0&&Pe[0]<4?1:+(Pe[0]+Pe[1])),!Fe&&ke&&(Pe=ke.match(/Edge\/(\d+)/),(!Pe||Pe[1]>=74)&&(Pe=ke.match(/Chrome\/(\d+)/),Pe&&(Fe=+Pe[1])));var Ie=Fe,Le=Ie,Re=s,ze=o.String,Be=!!Object.getOwnPropertySymbols&&!Re(function(){var e=Symbol(`symbol detection`);return!ze(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Le&&Le<41}),Ve=Be&&!Symbol.sham&&typeof Symbol.iterator==`symbol`,He=F,Ue=D,We=De,Ge=Ve,Ke=Object,qe=Ge?function(e){return typeof e==`symbol`}:function(e){var t=He(`Symbol`);return Ue(t)&&We(t.prototype,Ke(e))},Je=String,Ye=function(e){try{return Je(e)}catch{return`Object`}},Xe=D,Ze=Ye,Qe=TypeError,$e=function(e){if(Xe(e))return e;throw new Qe(Ze(e)+` is not a function`)},et=$e,tt=me,nt=function(e,t){var n=e[t];return tt(n)?void 0:et(n)},rt=j,it=D,at=N,ot=TypeError,st=function(e,t){var n,r;if(t===`string`&&it(n=e.toString)&&!at(r=rt(n,e))||it(n=e.valueOf)&&!at(r=rt(n,e))||t!==`string`&&it(n=e.toString)&&!at(r=rt(n,e)))return r;throw new ot(`Can't convert object to primitive value`)},ct={exports:{}},lt=!0,ut=o,dt=Object.defineProperty,ft=function(e,t){try{dt(ut,e,{value:t,configurable:!0,writable:!0})}catch{ut[e]=t}return t},pt=o,mt=ft,ht=`__core-js_shared__`,gt=pt[ht]||mt(ht,{}),_t=gt;(ct.exports=function(e,t){return _t[e]||(_t[e]=t===void 0?{}:t)})(`versions`,[]).push({version:`3.33.2`,mode:`pure`,copyright:`© 2014-2023 Denis Pushkarev (zloirock.ru)`,license:`https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE`,source:`https://github.com/zloirock/core-js`});var vt=ct.exports,yt=_e,bt=Object,xt=function(e){return bt(yt(e))},St=v,Ct=xt,wt=St({}.hasOwnProperty),Tt=Object.hasOwn||function(e,t){return wt(Ct(e),t)},Et=v,Dt=0,Ot=Math.random(),kt=Et(1 .toString),At=function(e){return`Symbol(`+(e===void 0?``:e)+`)_`+kt(++Dt+Ot,36)},jt=o,Mt=vt,Nt=Tt,Pt=At,Ft=Be,It=Ve,Lt=jt.Symbol,Rt=Mt(`wks`),zt=It?Lt.for||Lt:Lt&&Lt.withoutSetter||Pt,Bt=function(e){return Nt(Rt,e)||(Rt[e]=Ft&&Nt(Lt,e)?Lt[e]:zt(`Symbol.`+e)),Rt[e]},Vt=j,Ht=N,Ut=qe,Wt=nt,Gt=st,Kt=Bt,qt=TypeError,Jt=Kt(`toPrimitive`),Yt=function(e,t){if(!Ht(e)||Ut(e))return e;var n=Wt(e,Jt),r;if(n){if(t===void 0&&(t=`default`),r=Vt(n,e,t),!Ht(r)||Ut(r))return r;throw new qt(`Can't convert object to primitive value`)}return t===void 0&&(t=`number`),Gt(e,t)},Xt=qe,Zt=function(e){var t=Yt(e,`string`);return Xt(t)?t:t+``},Qt=o,$t=N,en=Qt.document,tn=$t(en)&&$t(en.createElement),nn=function(e){return tn?en.createElement(e):{}},rn=k,an=s,on=nn,sn=!rn&&!an(function(){return Object.defineProperty(on(`div`),`a`,{get:function(){return 7}}).a!==7}),cn=k,ln=j,un=ie,dn=se,fn=be,pn=Zt,mn=Tt,hn=sn,gn=Object.getOwnPropertyDescriptor;O.f=cn?gn:function(e,t){if(e=fn(e),t=pn(t),hn)try{return gn(e,t)}catch{}if(mn(e,t))return dn(!ln(un.f,e,t),e[t])};var _n=s,vn=D,yn=/#|\.prototype\./,bn=function(e,t){var n=Sn[xn(e)];return n===wn?!0:n===Cn?!1:vn(t)?_n(t):!!t},xn=bn.normalize=function(e){return String(e).replace(yn,`.`).toLowerCase()},Sn=bn.data={},Cn=bn.NATIVE=`N`,wn=bn.POLYFILL=`P`,Tn=bn,En=te,Dn=$e,On=c,kn=En(En.bind),An=function(e,t){return Dn(e),t===void 0?e:On?kn(e,t):function(){return e.apply(t,arguments)}},jn={},Mn=k&&s(function(){return Object.defineProperty(function(){},`prototype`,{value:42,writable:!1}).prototype!==42}),Nn=N,Pn=String,Fn=TypeError,In=function(e){if(Nn(e))return e;throw new Fn(Pn(e)+` is not an object`)},Ln=k,Rn=sn,zn=Mn,Bn=In,Vn=Zt,Hn=TypeError,Un=Object.defineProperty,Wn=Object.getOwnPropertyDescriptor,Gn=`enumerable`,L=`configurable`,R=`writable`;jn.f=Ln?zn?function(e,t,n){if(Bn(e),t=Vn(t),Bn(n),typeof e==`function`&&t===`prototype`&&`value`in n&&R in n&&!n[R]){var r=Wn(e,t);r&&r[R]&&(e[t]=n.value,n={configurable:L in n?n[L]:r[L],enumerable:Gn in n?n[Gn]:r[Gn],writable:!1})}return Un(e,t,n)}:Un:function(e,t,n){if(Bn(e),t=Vn(t),Bn(n),Rn)try{return Un(e,t,n)}catch{}if(`get`in n||`set`in n)throw new Hn(`Accessors not supported`);return`value`in n&&(e[t]=n.value),e};var Kn=k,qn=jn,Jn=se,Yn=Kn?function(e,t,n){return qn.f(e,t,Jn(1,n))}:function(e,t,n){return e[t]=n,e},Xn=o,Zn=p,Qn=te,$n=D,er=O.f,tr=Tn,nr=Ce,rr=An,ir=Yn,ar=Tt,or=function(e){var t=function(n,r,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(n);case 2:return new e(n,r)}return new e(n,r,i)}return Zn(e,this,arguments)};return t.prototype=e.prototype,t},z=function(e,t){var n=e.target,r=e.global,i=e.stat,a=e.proto,o=r?Xn:i?Xn[n]:(Xn[n]||{}).prototype,s=r?nr:nr[n]||ir(nr,n,{})[n],c=s.prototype,l,u,d,f,p,m,h,g,_;for(f in t)l=tr(r?f:n+(i?`.`:`#`)+f,e.forced),u=!l&&o&&ar(o,f),m=s[f],u&&(e.dontCallGetSet?(_=er(o,f),h=_&&_.value):h=o[f]),p=u&&h?h:t[f],!(u&&typeof m==typeof p)&&(g=e.bind&&u?rr(p,Xn):e.wrap&&u?or(p):a&&$n(p)?Qn(p):p,(e.sham||p&&p.sham||m&&m.sham)&&ir(g,`sham`,!0),ir(s,f,g),a&&(d=n+`Prototype`,ar(nr,d)||ir(nr,d,{}),ir(nr[d],f,p),e.real&&c&&(l||!c[f])&&ir(c,f,p)))},sr=z,cr=k,lr=jn.f;sr({target:`Object`,stat:!0,forced:Object.defineProperty!==lr,sham:!cr},{defineProperty:lr});var ur=Ce.Object,dr=i.exports=function(e,t,n){return ur.defineProperty(e,t,n)};ur.defineProperty.sham&&(dr.sham=!0);var fr=i.exports,pr=fr,mr=r(pr),hr=S,gr=Array.isArray||function(e){return hr(e)===`Array`},_r=Math.ceil,vr=Math.floor,yr=Math.trunc||function(e){var t=+e;return(t>0?vr:_r)(t)},br=function(e){var t=+e;return t!==t||t===0?0:yr(t)},xr=br,Sr=Math.min,Cr=function(e){return e>0?Sr(xr(e),9007199254740991):0},wr=function(e){return Cr(e.length)},Tr=TypeError,Er=9007199254740991,Dr=function(e){if(e>Er)throw Tr(`Maximum allowed index exceeded`);return e},Or=Zt,kr=jn,Ar=se,jr=function(e,t,n){var r=Or(t);r in e?kr.f(e,r,Ar(0,n)):e[r]=n},Mr=Bt(`toStringTag`),Nr={};Nr[Mr]=`z`;var Pr=String(Nr)===`[object z]`,Fr=Pr,Ir=D,Lr=S,Rr=Bt(`toStringTag`),zr=Object,Br=Lr(function(){return arguments}())===`Arguments`,Vr=function(e,t){try{return e[t]}catch{}},Hr=Fr?Lr:function(e){var t,n,r;return e===void 0?`Undefined`:e===null?`Null`:typeof(n=Vr(t=zr(e),Rr))==`string`?n:Br?Lr(t):(r=Lr(t))===`Object`&&Ir(t.callee)?`Arguments`:r},Ur=v,Wr=D,Gr=gt,Kr=Ur(Function.toString);Wr(Gr.inspectSource)||(Gr.inspectSource=function(e){return Kr(e)});var qr=Gr.inspectSource,Jr=v,Yr=s,Xr=D,Zr=Hr,Qr=F,B=qr,$r=function(){},ei=[],ti=Qr(`Reflect`,`construct`),ni=/^\s*(?:class|function)\b/,ri=Jr(ni.exec),ii=!ni.test($r),ai=function(e){if(!Xr(e))return!1;try{return ti($r,ei,e),!0}catch{return!1}},oi=function(e){if(!Xr(e))return!1;switch(Zr(e)){case`AsyncFunction`:case`GeneratorFunction`:case`AsyncGeneratorFunction`:return!1}try{return ii||!!ri(ni,B(e))}catch{return!0}};oi.sham=!0;var si=!ti||Yr(function(){var e;return ai(ai.call)||!ai(Object)||!ai(function(){e=!0})||e})?oi:ai,ci=gr,li=si,ui=N,di=Bt(`species`),fi=Array,pi=function(e){var t;return ci(e)&&(t=e.constructor,li(t)&&(t===fi||ci(t.prototype))?t=void 0:ui(t)&&(t=t[di],t===null&&(t=void 0))),t===void 0?fi:t},mi=function(e,t){return new(pi(e))(t===0?0:t)},hi=s,gi=Bt,_i=Ie,vi=gi(`species`),yi=function(e){return _i>=51||!hi(function(){var t=[],n=t.constructor={};return n[vi]=function(){return{foo:1}},t[e](Boolean).foo!==1})},bi=z,xi=s,Si=gr,Ci=N,wi=xt,Ti=wr,Ei=Dr,Di=jr,Oi=mi,ki=yi,Ai=Bt,ji=Ie,Mi=Ai(`isConcatSpreadable`),Ni=ji>=51||!xi(function(){var e=[];return e[Mi]=!1,e.concat()[0]!==e}),Pi=function(e){if(!Ci(e))return!1;var t=e[Mi];return t===void 0?Si(e):!!t};bi({target:`Array`,proto:!0,arity:1,forced:!Ni||!ki(`concat`)},{concat:function(e){var t=wi(this),n=Oi(t,0),r=0,i,a,o,s,c;for(i=-1,o=arguments.length;i<o;i++)if(c=i===-1?t:arguments[i],Pi(c))for(s=Ti(c),Ei(r+s),a=0;a<s;a++,r++)a in c&&Di(n,r,c[a]);else Ei(r+1),Di(n,r++,c);return n.length=r,n}});var Fi=Hr,Ii=String,Li=function(e){if(Fi(e)===`Symbol`)throw TypeError(`Cannot convert a Symbol value to a string`);return Ii(e)},Ri={},zi=br,Bi=Math.max,Vi=Math.min,Hi=function(e,t){var n=zi(e);return n<0?Bi(n+t,0):Vi(n,t)},Ui=be,Wi=Hi,Gi=wr,Ki=function(e){return function(t,n,r){var i=Ui(t),a=Gi(i),o=Wi(r,a),s;if(e&&n!==n){for(;a>o;)if(s=i[o++],s!==s)return!0}else for(;a>o;o++)if((e||o in i)&&i[o]===n)return e||o||0;return!e&&-1}},qi={includes:Ki(!0),indexOf:Ki(!1)},Ji={},Yi=v,Xi=Tt,Zi=be,Qi=qi.indexOf,$i=Ji,ea=Yi([].push),ta=function(e,t){var n=Zi(e),r=0,i=[],a;for(a in n)!Xi($i,a)&&Xi(n,a)&&ea(i,a);for(;t.length>r;)Xi(n,a=t[r++])&&(~Qi(i,a)||ea(i,a));return i},na=[`constructor`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`,`toString`,`valueOf`],ra=ta,ia=na,aa=Object.keys||function(e){return ra(e,ia)},oa=k,sa=Mn,ca=jn,la=In,ua=be,da=aa;Ri.f=oa&&!sa?Object.defineProperties:function(e,t){la(e);for(var n=ua(t),r=da(t),i=r.length,a=0,o;i>a;)ca.f(e,o=r[a++],n[o]);return e};var fa=F(`document`,`documentElement`),pa=vt,ma=At,ha=pa(`keys`),ga=function(e){return ha[e]||(ha[e]=ma(e))},_a=In,va=Ri,ya=na,ba=Ji,xa=fa,Sa=nn,Ca=ga,wa=`>`,Ta=`<`,Ea=`prototype`,Da=`script`,Oa=Ca(`IE_PROTO`),ka=function(){},Aa=function(e){return Ta+Da+wa+e+Ta+`/`+Da+wa},ja=function(e){e.write(Aa(``)),e.close();var t=e.parentWindow.Object;return e=null,t},Ma=function(){var e=Sa(`iframe`),t=`java`+Da+`:`,n;return e.style.display=`none`,xa.appendChild(e),e.src=String(t),n=e.contentWindow.document,n.open(),n.write(Aa(`document.F=Object`)),n.close(),n.F},Na,Pa=function(){try{Na=new ActiveXObject(`htmlfile`)}catch{}Pa=typeof document<`u`?document.domain&&Na?ja(Na):Ma():ja(Na);for(var e=ya.length;e--;)delete Pa[Ea][ya[e]];return Pa()};ba[Oa]=!0;var Fa=Object.create||function(e,t){var n;return e===null?n=Pa():(ka[Ea]=_a(e),n=new ka,ka[Ea]=null,n[Oa]=e),t===void 0?n:va.f(n,t)},Ia={},La=ta,Ra=na.concat(`length`,`prototype`);Ia.f=Object.getOwnPropertyNames||function(e){return La(e,Ra)};var za={},Ba=Hi,Va=wr,Ha=jr,Ua=Array,Wa=Math.max,Ga=function(e,t,n){for(var r=Va(e),i=Ba(t,r),a=Ba(n===void 0?r:n,r),o=Ua(Wa(a-i,0)),s=0;i<a;i++,s++)Ha(o,s,e[i]);return o.length=s,o},Ka=S,qa=be,Ja=Ia.f,Ya=Ga,Xa=typeof window==`object`&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Za=function(e){try{return Ja(e)}catch{return Ya(Xa)}};za.f=function(e){return Xa&&Ka(e)===`Window`?Za(e):Ja(qa(e))};var Qa={};Qa.f=Object.getOwnPropertySymbols;var $a=Yn,eo=function(e,t,n,r){return r&&r.enumerable?e[t]=n:$a(e,t,n),e},to=jn,no=function(e,t,n){return to.f(e,t,n)},ro={};ro.f=Bt;var io=Ce,ao=Tt,oo=ro,so=jn.f,co=function(e){var t=io.Symbol||={};ao(t,e)||so(t,e,{value:oo.f(e)})},lo=j,uo=F,fo=Bt,po=eo,mo=function(){var e=uo(`Symbol`),t=e&&e.prototype,n=t&&t.valueOf,r=fo(`toPrimitive`);t&&!t[r]&&po(t,r,function(e){return lo(n,this)},{arity:1})},ho=Pr,go=Hr,_o=ho?{}.toString:function(){return`[object `+go(this)+`]`},vo=Pr,yo=jn.f,bo=Yn,xo=Tt,So=_o,Co=Bt(`toStringTag`),wo=function(e,t,n,r){if(e){var i=n?e:e.prototype;xo(i,Co)||yo(i,Co,{configurable:!0,value:t}),r&&!vo&&bo(i,`toString`,So)}},To=o,Eo=D,Do=To.WeakMap,Oo=Eo(Do)&&/native code/.test(String(Do)),ko=o,Ao=N,jo=Yn,Mo=Tt,No=gt,Po=ga,Fo=Ji,Io=`Object already initialized`,Lo=ko.TypeError,Ro=ko.WeakMap,zo,Bo,Vo,Ho=function(e){return Vo(e)?Bo(e):zo(e,{})},Uo=function(e){return function(t){var n;if(!Ao(t)||(n=Bo(t)).type!==e)throw new Lo(`Incompatible receiver, `+e+` required`);return n}};if(Oo||No.state){var Wo=No.state||=new Ro;Wo.get=Wo.get,Wo.has=Wo.has,Wo.set=Wo.set,zo=function(e,t){if(Wo.has(e))throw new Lo(Io);return t.facade=e,Wo.set(e,t),t},Bo=function(e){return Wo.get(e)||{}},Vo=function(e){return Wo.has(e)}}else{var Go=Po(`state`);Fo[Go]=!0,zo=function(e,t){if(Mo(e,Go))throw new Lo(Io);return t.facade=e,jo(e,Go,t),t},Bo=function(e){return Mo(e,Go)?e[Go]:{}},Vo=function(e){return Mo(e,Go)}}var Ko={set:zo,get:Bo,has:Vo,enforce:Ho,getterFor:Uo},qo=An,Jo=v,Yo=pe,Xo=xt,Zo=wr,Qo=mi,$o=Jo([].push),es=function(e){var t=e===1,n=e===2,r=e===3,i=e===4,a=e===6,o=e===7,s=e===5||a;return function(c,l,u,d){for(var f=Xo(c),p=Yo(f),m=qo(l,u),h=Zo(p),g=0,_=d||Qo,v=t?_(c,h):n||o?_(c,0):void 0,y,b;h>g;g++)if((s||g in p)&&(y=p[g],b=m(y,g,f),e))if(t)v[g]=b;else if(b)switch(e){case 3:return!0;case 5:return y;case 6:return g;case 2:$o(v,y)}else switch(e){case 4:return!1;case 7:$o(v,y)}return a?-1:r||i?i:v}},ts={forEach:es(0),map:es(1),filter:es(2),some:es(3),every:es(4),find:es(5),findIndex:es(6),filterReject:es(7)},ns=z,rs=o,is=j,as=v,os=k,ss=Be,cs=s,ls=Tt,us=De,ds=In,fs=be,ps=Zt,ms=Li,hs=se,gs=Fa,_s=aa,vs=Ia,ys=za,bs=Qa,xs=O,Ss=jn,Cs=Ri,ws=ie,Ts=eo,Es=no,Ds=vt,Os=ga,ks=Ji,As=At,js=Bt,Ms=ro,Ns=co,Ps=mo,Fs=wo,Is=Ko,Ls=ts.forEach,Rs=Os(`hidden`),zs=`Symbol`,Bs=`prototype`,Vs=Is.set,Hs=Is.getterFor(zs),Us=Object[Bs],Ws=rs.Symbol,Gs=Ws&&Ws[Bs],Ks=rs.RangeError,qs=rs.TypeError,Js=rs.QObject,Ys=xs.f,Xs=Ss.f,Zs=ys.f,Qs=ws.f,$s=as([].push),ec=Ds(`symbols`),tc=Ds(`op-symbols`),nc=Ds(`wks`),rc=!Js||!Js[Bs]||!Js[Bs].findChild,ic=function(e,t,n){var r=Ys(Us,t);r&&delete Us[t],Xs(e,t,n),r&&e!==Us&&Xs(Us,t,r)},ac=os&&cs(function(){return gs(Xs({},`a`,{get:function(){return Xs(this,`a`,{value:7}).a}})).a!==7})?ic:Xs,oc=function(e,t){var n=ec[e]=gs(Gs);return Vs(n,{type:zs,tag:e,description:t}),os||(n.description=t),n},sc=function(e,t,n){e===Us&&sc(tc,t,n),ds(e);var r=ps(t);return ds(n),ls(ec,r)?(n.enumerable?(ls(e,Rs)&&e[Rs][r]&&(e[Rs][r]=!1),n=gs(n,{enumerable:hs(0,!1)})):(ls(e,Rs)||Xs(e,Rs,hs(1,{})),e[Rs][r]=!0),ac(e,r,n)):Xs(e,r,n)},cc=function(e,t){ds(e);var n=fs(t);return Ls(_s(n).concat(pc(n)),function(t){(!os||is(uc,n,t))&&sc(e,t,n[t])}),e},lc=function(e,t){return t===void 0?gs(e):cc(gs(e),t)},uc=function(e){var t=ps(e),n=is(Qs,this,t);return this===Us&&ls(ec,t)&&!ls(tc,t)?!1:n||!ls(this,t)||!ls(ec,t)||ls(this,Rs)&&this[Rs][t]?n:!0},dc=function(e,t){var n=fs(e),r=ps(t);if(!(n===Us&&ls(ec,r)&&!ls(tc,r))){var i=Ys(n,r);return i&&ls(ec,r)&&!(ls(n,Rs)&&n[Rs][r])&&(i.enumerable=!0),i}},fc=function(e){var t=Zs(fs(e)),n=[];return Ls(t,function(e){!ls(ec,e)&&!ls(ks,e)&&$s(n,e)}),n},pc=function(e){var t=e===Us,n=Zs(t?tc:fs(e)),r=[];return Ls(n,function(e){ls(ec,e)&&(!t||ls(Us,e))&&$s(r,ec[e])}),r};ss||(Ws=function(){if(us(Gs,this))throw new qs(`Symbol is not a constructor`);var e=!arguments.length||arguments[0]===void 0?void 0:ms(arguments[0]),t=As(e),n=function(e){var r=this===void 0?rs:this;r===Us&&is(n,tc,e),ls(r,Rs)&&ls(r[Rs],t)&&(r[Rs][t]=!1);var i=hs(1,e);try{ac(r,t,i)}catch(e){if(!(e instanceof Ks))throw e;ic(r,t,i)}};return os&&rc&&ac(Us,t,{configurable:!0,set:n}),oc(t,e)},Gs=Ws[Bs],Ts(Gs,`toString`,function(){return Hs(this).tag}),Ts(Ws,`withoutSetter`,function(e){return oc(As(e),e)}),ws.f=uc,Ss.f=sc,Cs.f=cc,xs.f=dc,vs.f=ys.f=fc,bs.f=pc,Ms.f=function(e){return oc(js(e),e)},os&&Es(Gs,`description`,{configurable:!0,get:function(){return Hs(this).description}})),ns({global:!0,constructor:!0,wrap:!0,forced:!ss,sham:!ss},{Symbol:Ws}),Ls(_s(nc),function(e){Ns(e)}),ns({target:zs,stat:!0,forced:!ss},{useSetter:function(){rc=!0},useSimple:function(){rc=!1}}),ns({target:`Object`,stat:!0,forced:!ss,sham:!os},{create:lc,defineProperty:sc,defineProperties:cc,getOwnPropertyDescriptor:dc}),ns({target:`Object`,stat:!0,forced:!ss},{getOwnPropertyNames:fc}),Ps(),Fs(Ws,zs),ks[Rs]=!0;var mc=Be&&!!Symbol.for&&!!Symbol.keyFor,hc=z,gc=F,_c=Tt,vc=Li,yc=vt,bc=mc,xc=yc(`string-to-symbol-registry`),V=yc(`symbol-to-string-registry`);hc({target:`Symbol`,stat:!0,forced:!bc},{for:function(e){var t=vc(e);if(_c(xc,t))return xc[t];var n=gc(`Symbol`)(t);return xc[t]=n,V[n]=t,n}});var Sc=z,Cc=Tt,wc=qe,Tc=Ye,Ec=vt,Dc=mc,Oc=Ec(`symbol-to-string-registry`);Sc({target:`Symbol`,stat:!0,forced:!Dc},{keyFor:function(e){if(!wc(e))throw TypeError(Tc(e)+` is not a symbol`);if(Cc(Oc,e))return Oc[e]}});var kc=v([].slice),Ac=v,jc=gr,Mc=D,Nc=S,Pc=Li,Fc=Ac([].push),Ic=function(e){if(Mc(e))return e;if(jc(e)){for(var t=e.length,n=[],r=0;r<t;r++){var i=e[r];typeof i==`string`?Fc(n,i):(typeof i==`number`||Nc(i)===`Number`||Nc(i)===`String`)&&Fc(n,Pc(i))}var a=n.length,o=!0;return function(e,t){if(o)return o=!1,t;if(jc(this))return t;for(var r=0;r<a;r++)if(n[r]===e)return t}}},Lc=z,Rc=F,zc=p,Bc=j,Vc=v,Hc=s,Uc=D,Wc=qe,Gc=kc,Kc=Ic,qc=Be,Jc=String,Yc=Rc(`JSON`,`stringify`),Xc=Vc(/./.exec),Zc=Vc(``.charAt),Qc=Vc(``.charCodeAt),$c=Vc(``.replace),el=Vc(1 .toString),tl=/[\uD800-\uDFFF]/g,nl=/^[\uD800-\uDBFF]$/,rl=/^[\uDC00-\uDFFF]$/,il=!qc||Hc(function(){var e=Rc(`Symbol`)(`stringify detection`);return Yc([e])!==`[null]`||Yc({a:e})!==`{}`||Yc(Object(e))!==`{}`}),al=Hc(function(){return Yc(`\udf06\ud834`)!==`"\\udf06\\ud834"`||Yc(`\udead`)!==`"\\udead"`}),ol=function(e,t){var n=Gc(arguments),r=Kc(t);if(!(!Uc(r)&&(e===void 0||Wc(e))))return n[1]=function(e,t){if(Uc(r)&&(t=Bc(r,this,Jc(e),t)),!Wc(t))return t},zc(Yc,null,n)},sl=function(e,t,n){var r=Zc(n,t-1),i=Zc(n,t+1);return Xc(nl,e)&&!Xc(rl,i)||Xc(rl,e)&&!Xc(nl,r)?`\\u`+el(Qc(e,0),16):e};Yc&&Lc({target:`JSON`,stat:!0,arity:3,forced:il||al},{stringify:function(e,t,n){var r=Gc(arguments),i=zc(il?ol:Yc,null,r);return al&&typeof i==`string`?$c(i,tl,sl):i}});var cl=z,ll=Be,ul=s,dl=Qa,fl=xt;cl({target:`Object`,stat:!0,forced:!ll||ul(function(){dl.f(1)})},{getOwnPropertySymbols:function(e){var t=dl.f;return t?t(fl(e)):[]}}),co(`asyncIterator`),co(`hasInstance`),co(`isConcatSpreadable`),co(`iterator`),co(`match`),co(`matchAll`),co(`replace`),co(`search`),co(`species`),co(`split`);var pl=co,ml=mo;pl(`toPrimitive`),ml();var hl=F,gl=co,_l=wo;gl(`toStringTag`),_l(hl(`Symbol`),`Symbol`),co(`unscopables`),wo(o.JSON,`JSON`,!0);var vl=Ce.Symbol,yl={},bl=k,xl=Tt,Sl=Function.prototype,Cl=bl&&Object.getOwnPropertyDescriptor,wl=xl(Sl,`name`),Tl={EXISTS:wl,PROPER:wl&&(function(){}).name===`something`,CONFIGURABLE:wl&&(!bl||bl&&Cl(Sl,`name`).configurable)},El=!s(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Dl=Tt,Ol=D,kl=xt,Al=ga,jl=El,Ml=Al(`IE_PROTO`),Nl=Object,Pl=Nl.prototype,Fl=jl?Nl.getPrototypeOf:function(e){var t=kl(e);if(Dl(t,Ml))return t[Ml];var n=t.constructor;return Ol(n)&&t instanceof n?n.prototype:t instanceof Nl?Pl:null},Il=s,Ll=D,Rl=N,zl=Fa,Bl=Fl,Vl=eo,Hl=Bt(`iterator`),Ul=!1,Wl,Gl,Kl;[].keys&&(Kl=[].keys(),`next`in Kl?(Gl=Bl(Bl(Kl)),Gl!==Object.prototype&&(Wl=Gl)):Ul=!0),Wl=!Rl(Wl)||Il(function(){var e={};return Wl[Hl].call(e)!==e})?{}:zl(Wl),Ll(Wl[Hl])||Vl(Wl,Hl,function(){return this});var ql={IteratorPrototype:Wl,BUGGY_SAFARI_ITERATORS:Ul},Jl=ql.IteratorPrototype,Yl=Fa,Xl=se,Zl=wo,Ql=yl,$l=function(){return this},eu=function(e,t,n,r){var i=t+` Iterator`;return e.prototype=Yl(Jl,{next:Xl(+!r,n)}),Zl(e,i,!1,!0),Ql[i]=$l,e},tu=v,nu=$e,ru=function(e,t,n){try{return tu(nu(Object.getOwnPropertyDescriptor(e,t)[n]))}catch{}},iu=D,au=String,ou=TypeError,su=function(e){if(typeof e==`object`||iu(e))return e;throw new ou(`Can't set `+au(e)+` as a prototype`)},cu=ru,lu=In,uu=su,du=Object.setPrototypeOf||(`__proto__`in{}?function(){var e=!1,t={},n;try{n=cu(Object.prototype,`__proto__`,`set`),n(t,[]),e=t instanceof Array}catch{}return function(t,r){return lu(t),uu(r),e?n(t,r):t.__proto__=r,t}}():void 0),fu=z,pu=j,mu=Tl,hu=eu,gu=Fl,_u=wo,vu=eo,yu=Bt,bu=yl,xu=ql,Su=mu.PROPER;mu.CONFIGURABLE,xu.IteratorPrototype;var Cu=xu.BUGGY_SAFARI_ITERATORS,wu=yu(`iterator`),Tu=`keys`,Eu=`values`,Du=`entries`,Ou=function(){return this},ku=function(e,t,n,r,i,a,o){hu(n,t,r);var s=function(e){if(e===i&&f)return f;if(!Cu&&e&&e in u)return u[e];switch(e){case Tu:return function(){return new n(this,e)};case Eu:return function(){return new n(this,e)};case Du:return function(){return new n(this,e)}}return function(){return new n(this)}},c=t+` Iterator`,l=!1,u=e.prototype,d=u[wu]||u[`@@iterator`]||i&&u[i],f=!Cu&&d||s(i),p=t===`Array`&&u.entries||d,m,h,g;if(p&&(m=gu(p.call(new e)),m!==Object.prototype&&m.next&&(_u(m,c,!0,!0),bu[c]=Ou)),Su&&i===Eu&&d&&d.name!==Eu&&(l=!0,f=function(){return pu(d,this)}),i)if(h={values:s(Eu),keys:a?f:s(Tu),entries:s(Du)},o)for(g in h)(Cu||l||!(g in u))&&vu(u,g,h[g]);else fu({target:t,proto:!0,forced:Cu||l},h);return o&&u[wu]!==f&&vu(u,wu,f,{name:i}),bu[t]=f,h},Au=function(e,t){return{value:e,done:t}},ju=be,Mu=yl,Nu=Ko;jn.f;var Pu=ku,Fu=Au,Iu=`Array Iterator`,Lu=Nu.set,Ru=Nu.getterFor(Iu);Pu(Array,`Array`,function(e,t){Lu(this,{type:Iu,target:ju(e),index:0,kind:t})},function(){var e=Ru(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=void 0,Fu(void 0,!0);switch(e.kind){case`keys`:return Fu(n,!1);case`values`:return Fu(t[n],!1)}return Fu([n,t[n]],!1)},`values`),Mu.Arguments=Mu.Array;var zu={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Bu=o,Vu=Hr,Hu=Yn,Uu=yl,Wu=Bt(`toStringTag`);for(var Gu in zu){var Ku=Bu[Gu],qu=Ku&&Ku.prototype;qu&&Vu(qu)!==Wu&&Hu(qu,Wu,Gu),Uu[Gu]=Uu.Array}var Ju=vl,Yu=Bt,Xu=jn.f,Zu=Yu(`metadata`),Qu=Function.prototype;Qu[Zu]===void 0&&Xu(Qu,Zu,{value:null}),co(`asyncDispose`),co(`dispose`),co(`metadata`);var $u=Ju,ed=F,td=v,nd=ed(`Symbol`),rd=nd.keyFor,id=td(nd.prototype.valueOf),ad=nd.isRegisteredSymbol||function(e){try{return rd(id(e))!==void 0}catch{return!1}};z({target:`Symbol`,stat:!0},{isRegisteredSymbol:ad});for(var od=vt,sd=F,cd=v,ld=qe,ud=Bt,dd=sd(`Symbol`),fd=dd.isWellKnownSymbol,pd=sd(`Object`,`getOwnPropertyNames`),md=cd(dd.prototype.valueOf),hd=od(`wks`),gd=0,_d=pd(dd),vd=_d.length;gd<vd;gd++)try{var yd=_d[gd];ld(dd[yd])&&ud(yd)}catch{}var bd=function(e){if(fd&&fd(e))return!0;try{for(var t=md(e),n=0,r=pd(hd),i=r.length;n<i;n++)if(hd[r[n]]==t)return!0}catch{}return!1};z({target:`Symbol`,stat:!0,forced:!0},{isWellKnownSymbol:bd}),co(`matcher`),co(`observable`),z({target:`Symbol`,stat:!0,name:`isRegisteredSymbol`},{isRegistered:ad}),z({target:`Symbol`,stat:!0,name:`isWellKnownSymbol`,forced:!0},{isWellKnown:bd}),co(`metadataKey`),co(`patternMatch`),co(`replaceAll`);var xd=$u,Sd=r(xd),Cd=v,wd=br,Td=Li,Ed=_e,Dd=Cd(``.charAt),Od=Cd(``.charCodeAt),kd=Cd(``.slice),Ad=function(e){return function(t,n){var r=Td(Ed(t)),i=wd(n),a=r.length,o,s;return i<0||i>=a?e?``:void 0:(o=Od(r,i),o<55296||o>56319||i+1===a||(s=Od(r,i+1))<56320||s>57343?e?Dd(r,i):o:e?kd(r,i,i+2):(o-55296<<10)+(s-56320)+65536)}},jd={codeAt:Ad(!1),charAt:Ad(!0)}.charAt,Md=Li,Nd=Ko,Pd=ku,Fd=Au,Id=`String Iterator`,Ld=Nd.set,Rd=Nd.getterFor(Id);Pd(String,`String`,function(e){Ld(this,{type:Id,string:Md(e),index:0})},function(){var e=Rd(this),t=e.string,n=e.index,r;return n>=t.length?Fd(void 0,!0):(r=jd(t,n),e.index+=r.length,Fd(r,!1))});var zd=ro.f(`iterator`),Bd=zd,Vd=r(Bd);function Hd(e){"@babel/helpers - typeof";return Hd=typeof Sd==`function`&&typeof Vd==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Sd==`function`&&e.constructor===Sd&&e!==Sd.prototype?`symbol`:typeof e},Hd(e)}var Ud=r(ro.f(`toPrimitive`));function Wd(e,t){if(Hd(e)!==`object`||e===null)return e;var n=e[Ud];if(n!==void 0){var r=n.call(e,t||`default`);if(Hd(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Gd(e){var t=Wd(e,`string`);return Hd(t)===`symbol`?t:String(t)}function Kd(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),mr(e,Gd(r.key),r)}}function qd(e,t,n){return t&&Kd(e.prototype,t),n&&Kd(e,n),mr(e,`prototype`,{writable:!1}),e}function Jd(e,t,n){return t=Gd(t),t in e?mr(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Yd=v,Xd=$e,Zd=N,Qd=Tt,$d=kc,ef=c,tf=Function,nf=Yd([].concat),rf=Yd([].join),af={},of=function(e,t,n){if(!Qd(af,t)){for(var r=[],i=0;i<t;i++)r[i]=`a[`+i+`]`;af[t]=tf(`C,a`,`return new C(`+rf(r,`,`)+`)`)}return af[t](e,n)},sf=ef?tf.bind:function(e){var t=Xd(this),n=t.prototype,r=$d(arguments,1),i=function(){var n=nf(r,$d(arguments));return this instanceof i?of(t,n.length,n):t.apply(e,n)};return Zd(n)&&(i.prototype=n),i},cf=z,lf=sf;cf({target:`Function`,proto:!0,forced:Function.bind!==lf},{bind:lf});var uf=o,df=Ce,ff=function(e,t){var n=df[e+`Prototype`],r=n&&n[t];if(r)return r;var i=uf[e],a=i&&i.prototype;return a&&a[t]},pf=ff(`Function`,`bind`),mf=De,hf=pf,gf=Function.prototype,_f=function(e){var t=e.bind;return e===gf||mf(gf,e)&&t===gf.bind?hf:t},vf=r(_f),yf=$e,bf=xt,xf=pe,Sf=wr,Cf=TypeError,wf=function(e){return function(t,n,r,i){yf(n);var a=bf(t),o=xf(a),s=Sf(a),c=e?s-1:0,l=e?-1:1;if(r<2)for(;;){if(c in o){i=o[c],c+=l;break}if(c+=l,e?c<0:s<=c)throw new Cf(`Reduce of empty array with no initial value`)}for(;e?c>=0:s>c;c+=l)c in o&&(i=n(i,o[c],c,a));return i}},Tf={left:wf(!1),right:wf(!0)},H=s,Ef=function(e,t){var n=[][e];return!!n&&H(function(){n.call(null,t||function(){return 1},1)})},Df=S(o.process)===`process`,Of=z,kf=Tf.left,Af=Ef,jf=Ie;Of({target:`Array`,proto:!0,forced:!Df&&jf>79&&jf<83||!Af(`reduce`)},{reduce:function(e){var t=arguments.length;return kf(this,e,t,t>1?arguments[1]:void 0)}});var Mf=ff(`Array`,`reduce`),Nf=De,Pf=Mf,Ff=Array.prototype,If=r(function(e){var t=e.reduce;return e===Ff||Nf(Ff,e)&&t===Ff.reduce?Pf:t}),Lf=z,Rf=ts.filter;Lf({target:`Array`,proto:!0,forced:!yi(`filter`)},{filter:function(e){return Rf(this,e,arguments.length>1?arguments[1]:void 0)}});var zf=ff(`Array`,`filter`),Bf=De,Vf=zf,Hf=Array.prototype,Uf=r(function(e){var t=e.filter;return e===Hf||Bf(Hf,e)&&t===Hf.filter?Vf:t}),Wf=z,Gf=ts.map;Wf({target:`Array`,proto:!0,forced:!yi(`map`)},{map:function(e){return Gf(this,e,arguments.length>1?arguments[1]:void 0)}});var Kf=ff(`Array`,`map`),qf=De,Jf=Kf,Yf=Array.prototype,Xf=r(function(e){var t=e.map;return e===Yf||qf(Yf,e)&&t===Yf.map?Jf:t}),Zf=gr,Qf=wr,$f=Dr,ep=An,tp=function(e,t,n,r,i,a,o,s){for(var c=i,l=0,u=o?ep(o,s):!1,d,f;l<r;)l in n&&(d=u?u(n[l],l,t):n[l],a>0&&Zf(d)?(f=Qf(d),c=tp(e,t,d,f,c,a-1)-1):($f(c+1),e[c]=d),c++),l++;return c},np=tp,rp=z,ip=np,ap=$e,op=xt,sp=wr,cp=mi;rp({target:`Array`,proto:!0},{flatMap:function(e){var t=op(this),n=sp(t),r;return ap(e),r=cp(t,0),r.length=ip(r,t,t,n,0,1,e,arguments.length>1?arguments[1]:void 0),r}});var lp=ff(`Array`,`flatMap`),up=De,dp=lp,fp=Array.prototype,pp=r(function(e){var t=e.flatMap;return e===fp||up(fp,e)&&t===fp.flatMap?dp:t});function mp(e){return new gp(e)}var hp=function(){function e(n,r,i){var a,o,s;t(this,e),Jd(this,`_listeners`,{add:vf(a=this._add).call(a,this),remove:vf(o=this._remove).call(o,this),update:vf(s=this._update).call(s,this)}),this._source=n,this._transformers=r,this._target=i}return qd(e,[{key:`all`,value:function(){return this._target.update(this._transformItems(this._source.get())),this}},{key:`start`,value:function(){return this._source.on(`add`,this._listeners.add),this._source.on(`remove`,this._listeners.remove),this._source.on(`update`,this._listeners.update),this}},{key:`stop`,value:function(){return this._source.off(`add`,this._listeners.add),this._source.off(`remove`,this._listeners.remove),this._source.off(`update`,this._listeners.update),this}},{key:`_transformItems`,value:function(e){var t;return If(t=this._transformers).call(t,function(e,t){return t(e)},e)}},{key:`_add`,value:function(e,t){t!=null&&this._target.add(this._transformItems(this._source.get(t.items)))}},{key:`_update`,value:function(e,t){t!=null&&this._target.update(this._transformItems(this._source.get(t.items)))}},{key:`_remove`,value:function(e,t){t!=null&&this._target.remove(this._transformItems(t.oldData))}}]),e}(),gp=function(){function e(n){t(this,e),Jd(this,`_transformers`,[]),this._source=n}return qd(e,[{key:`filter`,value:function(e){return this._transformers.push(function(t){return Uf(t).call(t,e)}),this}},{key:`map`,value:function(e){return this._transformers.push(function(t){return Xf(t).call(t,e)}),this}},{key:`flatMap`,value:function(e){return this._transformers.push(function(t){return pp(t).call(t,e)}),this}},{key:`to`,value:function(e){return new hp(this._source,this._transformers,e)}}]),e}(),_p=j,vp=In,yp=nt,bp=function(e,t,n){var r,i;vp(e);try{if(r=yp(e,`return`),!r){if(t===`throw`)throw n;return n}r=_p(r,e)}catch(e){i=!0,r=e}if(t===`throw`)throw n;if(i)throw r;return vp(r),n},xp=In,Sp=bp,Cp=function(e,t,n,r){try{return r?t(xp(n)[0],n[1]):t(n)}catch(t){Sp(e,`throw`,t)}},wp=Bt,Tp=yl,Ep=wp(`iterator`),Dp=Array.prototype,Op=function(e){return e!==void 0&&(Tp.Array===e||Dp[Ep]===e)},kp=Hr,Ap=nt,jp=me,Mp=yl,Np=Bt(`iterator`),Pp=function(e){if(!jp(e))return Ap(e,Np)||Ap(e,`@@iterator`)||Mp[kp(e)]},Fp=j,Ip=$e,Lp=In,Rp=Ye,zp=Pp,Bp=TypeError,Vp=function(e,t){var n=arguments.length<2?zp(e):t;if(Ip(n))return Lp(Fp(n,e));throw new Bp(Rp(e)+` is not iterable`)},Hp=An,Up=j,Wp=xt,Gp=Cp,Kp=Op,qp=si,Jp=wr,Yp=jr,Xp=Vp,Zp=Pp,Qp=Array,$p=function(e){var t=Wp(e),n=qp(this),r=arguments.length,i=r>1?arguments[1]:void 0,a=i!==void 0;a&&(i=Hp(i,r>2?arguments[2]:void 0));var o=Zp(t),s=0,c,l,u,d,f,p;if(o&&!(this===Qp&&Kp(o)))for(d=Xp(t,o),f=d.next,l=n?new this:[];!(u=Up(f,d)).done;s++)p=a?Gp(d,i,[u.value,s],!0):u.value,Yp(l,s,p);else for(c=Jp(t),l=n?new this(c):Qp(c);c>s;s++)p=a?i(t[s],s):t[s],Yp(l,s,p);return l.length=s,l},em=Bt(`iterator`),tm=!1;try{var nm=0,rm={next:function(){return{done:!!nm++}},return:function(){tm=!0}};rm[em]=function(){return this},Array.from(rm,function(){throw 2})}catch{}var im=function(e,t){try{if(!t&&!tm)return!1}catch{return!1}var n=!1;try{var r={};r[em]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch{}return n},am=z,om=$p;am({target:`Array`,stat:!0,forced:!im(function(e){Array.from(e)})},{from:om});var sm=Ce.Array.from,cm=r(sm),lm=Pp,um=r(lm),dm=r(lm);z({target:`Array`,stat:!0},{isArray:gr});var fm=Ce.Array.isArray,pm=r(fm);function mm(e){if(pm(e))return e}var hm=k,gm=gr,_m=TypeError,vm=Object.getOwnPropertyDescriptor,ym=hm&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],`length`,{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(gm(e)&&!vm(e,`length`).writable)throw new _m(`Cannot set read only .length`);return e.length=t}:function(e,t){return e.length=t},bm=z,xm=xt,Sm=wr,Cm=ym,wm=Dr;bm({target:`Array`,proto:!0,arity:1,forced:s(function(){return[].push.call({length:4294967296},1)!==4294967297})||!function(){try{Object.defineProperty([],`length`,{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=xm(this),n=Sm(t),r=arguments.length;wm(n+r);for(var i=0;i<r;i++)t[n]=arguments[i],n++;return Cm(t,n),n}});var Tm=ff(`Array`,`push`),Em=De,Dm=Tm,Om=Array.prototype,km=function(e){var t=e.push;return e===Om||Em(Om,e)&&t===Om.push?Dm:t},Am=r(km);function jm(e,t){var n=e==null?null:Sd!==void 0&&um(e)||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(Am(s).call(s,r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}var Mm=z,Nm=gr,Pm=si,Fm=N,Im=Hi,Lm=wr,Rm=be,zm=jr,Bm=Bt,Vm=yi,Hm=kc,Um=Vm(`slice`),Wm=Bm(`species`),Gm=Array,Km=Math.max;Mm({target:`Array`,proto:!0,forced:!Um},{slice:function(e,t){var n=Rm(this),r=Lm(n),i=Im(e,r),a=Im(t===void 0?r:t,r),o,s,c;if(Nm(n)&&(o=n.constructor,Pm(o)&&(o===Gm||Nm(o.prototype))?o=void 0:Fm(o)&&(o=o[Wm],o===null&&(o=void 0)),o===Gm||o===void 0))return Hm(n,i,a);for(s=new(o===void 0?Gm:o)(Km(a-i,0)),c=0;i<a;i++,c++)i in n&&zm(s,c,n[i]);return s.length=c,s}});var qm=ff(`Array`,`slice`),Jm=De,Ym=qm,Xm=Array.prototype,Zm=function(e){var t=e.slice;return e===Xm||Jm(Xm,e)&&t===Xm.slice?Ym:t},Qm=Zm,$m=r(Qm),eh=r(sm);function th(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nh(e,t){var n;if(e){if(typeof e==`string`)return th(e,t);var r=$m(n=Object.prototype.toString.call(e)).call(n,8,-1);if(r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`)return eh(e);if(r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return th(e,t)}}function rh(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{o as e,t}from"./chunk-DD-I1_y5.js";import{d as n,g as r,u as i,y as a}from"./ChatInput-CJo_77bp.js";import{a as o,d as s,g as c,h as l,i as u,m as d,n as f,o as p,p as m,r as h,u as g,v as _}from"./graph-labels-BRXJHNYE.js";import{t as v}from"./Checkbox-YrQovXpN.js";var y=r(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),b=r(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),x=r(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),S=r(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ee=r(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),C=r(`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`}]]),te=t(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n.vis=n.vis||{}))})(e,(function(e){function t(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var n=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var i={exports:{}},a=function(e){return e&&e.Math===Math&&e},o=a(typeof globalThis==`object`&&globalThis)||a(typeof window==`object`&&window)||a(typeof self==`object`&&self)||a(typeof n==`object`&&n)||(function(){return this})()||n||Function(`return this`)(),s=function(e){try{return!!e()}catch{return!0}},c=!s(function(){var e=(function(){}).bind();return typeof e!=`function`||e.hasOwnProperty(`prototype`)}),l=c,u=Function.prototype,d=u.apply,f=u.call,p=typeof Reflect==`object`&&Reflect.apply||(l?f.bind(d):function(){return f.apply(d,arguments)}),m=c,h=Function.prototype,g=h.call,_=m&&h.bind.bind(g,g),v=m?_:function(e){return function(){return g.apply(e,arguments)}},y=v,b=y({}.toString),x=y(``.slice),S=function(e){return x(b(e),8,-1)},ee=S,C=v,te=function(e){if(ee(e)===`Function`)return C(e)},w=typeof document==`object`&&document.all,ne={all:w,IS_HTMLDDA:w===void 0&&w!==void 0},T=ne,E=T.all,D=T.IS_HTMLDDA?function(e){return typeof e==`function`||e===E}:function(e){return typeof e==`function`},O={},k=!s(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),re=c,A=Function.prototype.call,j=re?A.bind(A):function(){return A.apply(A,arguments)},ie={},ae={}.propertyIsEnumerable,oe=Object.getOwnPropertyDescriptor;ie.f=oe&&!ae.call({1:2},1)?function(e){var t=oe(this,e);return!!t&&t.enumerable}:ae;var se=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},ce=v,le=s,ue=S,de=Object,fe=ce(``.split),pe=le(function(){return!de(`z`).propertyIsEnumerable(0)})?function(e){return ue(e)===`String`?fe(e,``):de(e)}:de,me=function(e){return e==null},he=me,ge=TypeError,_e=function(e){if(he(e))throw new ge(`Can't call method on `+e);return e},ve=pe,ye=_e,be=function(e){return ve(ye(e))},xe=D,Se=ne,M=Se.all,N=Se.IS_HTMLDDA?function(e){return typeof e==`object`?e!==null:xe(e)||e===M}:function(e){return typeof e==`object`?e!==null:xe(e)},Ce={},we=Ce,Te=o,Ee=D,P=function(e){return Ee(e)?e:void 0},F=function(e,t){return arguments.length<2?P(we[e])||P(Te[e]):we[e]&&we[e][t]||Te[e]&&Te[e][t]},De=v({}.isPrototypeOf),Oe=typeof navigator<`u`&&String(navigator.userAgent)||``,I=o,ke=Oe,Ae=I.process,je=I.Deno,Me=Ae&&Ae.versions||je&&je.version,Ne=Me&&Me.v8,Pe,Fe;Ne&&(Pe=Ne.split(`.`),Fe=Pe[0]>0&&Pe[0]<4?1:+(Pe[0]+Pe[1])),!Fe&&ke&&(Pe=ke.match(/Edge\/(\d+)/),(!Pe||Pe[1]>=74)&&(Pe=ke.match(/Chrome\/(\d+)/),Pe&&(Fe=+Pe[1])));var Ie=Fe,Le=Ie,Re=s,ze=o.String,Be=!!Object.getOwnPropertySymbols&&!Re(function(){var e=Symbol(`symbol detection`);return!ze(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Le&&Le<41}),Ve=Be&&!Symbol.sham&&typeof Symbol.iterator==`symbol`,He=F,Ue=D,We=De,Ge=Ve,Ke=Object,qe=Ge?function(e){return typeof e==`symbol`}:function(e){var t=He(`Symbol`);return Ue(t)&&We(t.prototype,Ke(e))},Je=String,Ye=function(e){try{return Je(e)}catch{return`Object`}},Xe=D,Ze=Ye,Qe=TypeError,$e=function(e){if(Xe(e))return e;throw new Qe(Ze(e)+` is not a function`)},et=$e,tt=me,nt=function(e,t){var n=e[t];return tt(n)?void 0:et(n)},rt=j,it=D,at=N,ot=TypeError,st=function(e,t){var n,r;if(t===`string`&&it(n=e.toString)&&!at(r=rt(n,e))||it(n=e.valueOf)&&!at(r=rt(n,e))||t!==`string`&&it(n=e.toString)&&!at(r=rt(n,e)))return r;throw new ot(`Can't convert object to primitive value`)},ct={exports:{}},lt=!0,ut=o,dt=Object.defineProperty,ft=function(e,t){try{dt(ut,e,{value:t,configurable:!0,writable:!0})}catch{ut[e]=t}return t},pt=o,mt=ft,ht=`__core-js_shared__`,gt=pt[ht]||mt(ht,{}),_t=gt;(ct.exports=function(e,t){return _t[e]||(_t[e]=t===void 0?{}:t)})(`versions`,[]).push({version:`3.33.2`,mode:`pure`,copyright:`© 2014-2023 Denis Pushkarev (zloirock.ru)`,license:`https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE`,source:`https://github.com/zloirock/core-js`});var vt=ct.exports,yt=_e,bt=Object,xt=function(e){return bt(yt(e))},St=v,Ct=xt,wt=St({}.hasOwnProperty),Tt=Object.hasOwn||function(e,t){return wt(Ct(e),t)},Et=v,Dt=0,Ot=Math.random(),kt=Et(1 .toString),At=function(e){return`Symbol(`+(e===void 0?``:e)+`)_`+kt(++Dt+Ot,36)},jt=o,Mt=vt,Nt=Tt,Pt=At,Ft=Be,It=Ve,Lt=jt.Symbol,Rt=Mt(`wks`),zt=It?Lt.for||Lt:Lt&&Lt.withoutSetter||Pt,Bt=function(e){return Nt(Rt,e)||(Rt[e]=Ft&&Nt(Lt,e)?Lt[e]:zt(`Symbol.`+e)),Rt[e]},Vt=j,Ht=N,Ut=qe,Wt=nt,Gt=st,Kt=Bt,qt=TypeError,Jt=Kt(`toPrimitive`),Yt=function(e,t){if(!Ht(e)||Ut(e))return e;var n=Wt(e,Jt),r;if(n){if(t===void 0&&(t=`default`),r=Vt(n,e,t),!Ht(r)||Ut(r))return r;throw new qt(`Can't convert object to primitive value`)}return t===void 0&&(t=`number`),Gt(e,t)},Xt=qe,Zt=function(e){var t=Yt(e,`string`);return Xt(t)?t:t+``},Qt=o,$t=N,en=Qt.document,tn=$t(en)&&$t(en.createElement),nn=function(e){return tn?en.createElement(e):{}},rn=k,an=s,on=nn,sn=!rn&&!an(function(){return Object.defineProperty(on(`div`),`a`,{get:function(){return 7}}).a!==7}),cn=k,ln=j,un=ie,dn=se,fn=be,pn=Zt,mn=Tt,hn=sn,gn=Object.getOwnPropertyDescriptor;O.f=cn?gn:function(e,t){if(e=fn(e),t=pn(t),hn)try{return gn(e,t)}catch{}if(mn(e,t))return dn(!ln(un.f,e,t),e[t])};var _n=s,vn=D,yn=/#|\.prototype\./,bn=function(e,t){var n=Sn[xn(e)];return n===wn?!0:n===Cn?!1:vn(t)?_n(t):!!t},xn=bn.normalize=function(e){return String(e).replace(yn,`.`).toLowerCase()},Sn=bn.data={},Cn=bn.NATIVE=`N`,wn=bn.POLYFILL=`P`,Tn=bn,En=te,Dn=$e,On=c,kn=En(En.bind),An=function(e,t){return Dn(e),t===void 0?e:On?kn(e,t):function(){return e.apply(t,arguments)}},jn={},Mn=k&&s(function(){return Object.defineProperty(function(){},`prototype`,{value:42,writable:!1}).prototype!==42}),Nn=N,Pn=String,Fn=TypeError,In=function(e){if(Nn(e))return e;throw new Fn(Pn(e)+` is not an object`)},Ln=k,Rn=sn,zn=Mn,Bn=In,Vn=Zt,Hn=TypeError,Un=Object.defineProperty,Wn=Object.getOwnPropertyDescriptor,Gn=`enumerable`,L=`configurable`,R=`writable`;jn.f=Ln?zn?function(e,t,n){if(Bn(e),t=Vn(t),Bn(n),typeof e==`function`&&t===`prototype`&&`value`in n&&R in n&&!n[R]){var r=Wn(e,t);r&&r[R]&&(e[t]=n.value,n={configurable:L in n?n[L]:r[L],enumerable:Gn in n?n[Gn]:r[Gn],writable:!1})}return Un(e,t,n)}:Un:function(e,t,n){if(Bn(e),t=Vn(t),Bn(n),Rn)try{return Un(e,t,n)}catch{}if(`get`in n||`set`in n)throw new Hn(`Accessors not supported`);return`value`in n&&(e[t]=n.value),e};var Kn=k,qn=jn,Jn=se,Yn=Kn?function(e,t,n){return qn.f(e,t,Jn(1,n))}:function(e,t,n){return e[t]=n,e},Xn=o,Zn=p,Qn=te,$n=D,er=O.f,tr=Tn,nr=Ce,rr=An,ir=Yn,ar=Tt,or=function(e){var t=function(n,r,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(n);case 2:return new e(n,r)}return new e(n,r,i)}return Zn(e,this,arguments)};return t.prototype=e.prototype,t},z=function(e,t){var n=e.target,r=e.global,i=e.stat,a=e.proto,o=r?Xn:i?Xn[n]:(Xn[n]||{}).prototype,s=r?nr:nr[n]||ir(nr,n,{})[n],c=s.prototype,l,u,d,f,p,m,h,g,_;for(f in t)l=tr(r?f:n+(i?`.`:`#`)+f,e.forced),u=!l&&o&&ar(o,f),m=s[f],u&&(e.dontCallGetSet?(_=er(o,f),h=_&&_.value):h=o[f]),p=u&&h?h:t[f],!(u&&typeof m==typeof p)&&(g=e.bind&&u?rr(p,Xn):e.wrap&&u?or(p):a&&$n(p)?Qn(p):p,(e.sham||p&&p.sham||m&&m.sham)&&ir(g,`sham`,!0),ir(s,f,g),a&&(d=n+`Prototype`,ar(nr,d)||ir(nr,d,{}),ir(nr[d],f,p),e.real&&c&&(l||!c[f])&&ir(c,f,p)))},sr=z,cr=k,lr=jn.f;sr({target:`Object`,stat:!0,forced:Object.defineProperty!==lr,sham:!cr},{defineProperty:lr});var ur=Ce.Object,dr=i.exports=function(e,t,n){return ur.defineProperty(e,t,n)};ur.defineProperty.sham&&(dr.sham=!0);var fr=i.exports,pr=fr,mr=r(pr),hr=S,gr=Array.isArray||function(e){return hr(e)===`Array`},_r=Math.ceil,vr=Math.floor,yr=Math.trunc||function(e){var t=+e;return(t>0?vr:_r)(t)},br=function(e){var t=+e;return t!==t||t===0?0:yr(t)},xr=br,Sr=Math.min,Cr=function(e){return e>0?Sr(xr(e),9007199254740991):0},wr=function(e){return Cr(e.length)},Tr=TypeError,Er=9007199254740991,Dr=function(e){if(e>Er)throw Tr(`Maximum allowed index exceeded`);return e},Or=Zt,kr=jn,Ar=se,jr=function(e,t,n){var r=Or(t);r in e?kr.f(e,r,Ar(0,n)):e[r]=n},Mr=Bt(`toStringTag`),Nr={};Nr[Mr]=`z`;var Pr=String(Nr)===`[object z]`,Fr=Pr,Ir=D,Lr=S,Rr=Bt(`toStringTag`),zr=Object,Br=Lr(function(){return arguments}())===`Arguments`,Vr=function(e,t){try{return e[t]}catch{}},Hr=Fr?Lr:function(e){var t,n,r;return e===void 0?`Undefined`:e===null?`Null`:typeof(n=Vr(t=zr(e),Rr))==`string`?n:Br?Lr(t):(r=Lr(t))===`Object`&&Ir(t.callee)?`Arguments`:r},Ur=v,Wr=D,Gr=gt,Kr=Ur(Function.toString);Wr(Gr.inspectSource)||(Gr.inspectSource=function(e){return Kr(e)});var qr=Gr.inspectSource,Jr=v,Yr=s,Xr=D,Zr=Hr,Qr=F,B=qr,$r=function(){},ei=[],ti=Qr(`Reflect`,`construct`),ni=/^\s*(?:class|function)\b/,ri=Jr(ni.exec),ii=!ni.test($r),ai=function(e){if(!Xr(e))return!1;try{return ti($r,ei,e),!0}catch{return!1}},oi=function(e){if(!Xr(e))return!1;switch(Zr(e)){case`AsyncFunction`:case`GeneratorFunction`:case`AsyncGeneratorFunction`:return!1}try{return ii||!!ri(ni,B(e))}catch{return!0}};oi.sham=!0;var si=!ti||Yr(function(){var e;return ai(ai.call)||!ai(Object)||!ai(function(){e=!0})||e})?oi:ai,ci=gr,li=si,ui=N,di=Bt(`species`),fi=Array,pi=function(e){var t;return ci(e)&&(t=e.constructor,li(t)&&(t===fi||ci(t.prototype))?t=void 0:ui(t)&&(t=t[di],t===null&&(t=void 0))),t===void 0?fi:t},mi=function(e,t){return new(pi(e))(t===0?0:t)},hi=s,gi=Bt,_i=Ie,vi=gi(`species`),yi=function(e){return _i>=51||!hi(function(){var t=[],n=t.constructor={};return n[vi]=function(){return{foo:1}},t[e](Boolean).foo!==1})},bi=z,xi=s,Si=gr,Ci=N,wi=xt,Ti=wr,Ei=Dr,Di=jr,Oi=mi,ki=yi,Ai=Bt,ji=Ie,Mi=Ai(`isConcatSpreadable`),Ni=ji>=51||!xi(function(){var e=[];return e[Mi]=!1,e.concat()[0]!==e}),Pi=function(e){if(!Ci(e))return!1;var t=e[Mi];return t===void 0?Si(e):!!t};bi({target:`Array`,proto:!0,arity:1,forced:!Ni||!ki(`concat`)},{concat:function(e){var t=wi(this),n=Oi(t,0),r=0,i,a,o,s,c;for(i=-1,o=arguments.length;i<o;i++)if(c=i===-1?t:arguments[i],Pi(c))for(s=Ti(c),Ei(r+s),a=0;a<s;a++,r++)a in c&&Di(n,r,c[a]);else Ei(r+1),Di(n,r++,c);return n.length=r,n}});var Fi=Hr,Ii=String,Li=function(e){if(Fi(e)===`Symbol`)throw TypeError(`Cannot convert a Symbol value to a string`);return Ii(e)},Ri={},zi=br,Bi=Math.max,Vi=Math.min,Hi=function(e,t){var n=zi(e);return n<0?Bi(n+t,0):Vi(n,t)},Ui=be,Wi=Hi,Gi=wr,Ki=function(e){return function(t,n,r){var i=Ui(t),a=Gi(i),o=Wi(r,a),s;if(e&&n!==n){for(;a>o;)if(s=i[o++],s!==s)return!0}else for(;a>o;o++)if((e||o in i)&&i[o]===n)return e||o||0;return!e&&-1}},qi={includes:Ki(!0),indexOf:Ki(!1)},Ji={},Yi=v,Xi=Tt,Zi=be,Qi=qi.indexOf,$i=Ji,ea=Yi([].push),ta=function(e,t){var n=Zi(e),r=0,i=[],a;for(a in n)!Xi($i,a)&&Xi(n,a)&&ea(i,a);for(;t.length>r;)Xi(n,a=t[r++])&&(~Qi(i,a)||ea(i,a));return i},na=[`constructor`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`,`toString`,`valueOf`],ra=ta,ia=na,aa=Object.keys||function(e){return ra(e,ia)},oa=k,sa=Mn,ca=jn,la=In,ua=be,da=aa;Ri.f=oa&&!sa?Object.defineProperties:function(e,t){la(e);for(var n=ua(t),r=da(t),i=r.length,a=0,o;i>a;)ca.f(e,o=r[a++],n[o]);return e};var fa=F(`document`,`documentElement`),pa=vt,ma=At,ha=pa(`keys`),ga=function(e){return ha[e]||(ha[e]=ma(e))},_a=In,va=Ri,ya=na,ba=Ji,xa=fa,Sa=nn,Ca=ga,wa=`>`,Ta=`<`,Ea=`prototype`,Da=`script`,Oa=Ca(`IE_PROTO`),ka=function(){},Aa=function(e){return Ta+Da+wa+e+Ta+`/`+Da+wa},ja=function(e){e.write(Aa(``)),e.close();var t=e.parentWindow.Object;return e=null,t},Ma=function(){var e=Sa(`iframe`),t=`java`+Da+`:`,n;return e.style.display=`none`,xa.appendChild(e),e.src=String(t),n=e.contentWindow.document,n.open(),n.write(Aa(`document.F=Object`)),n.close(),n.F},Na,Pa=function(){try{Na=new ActiveXObject(`htmlfile`)}catch{}Pa=typeof document<`u`?document.domain&&Na?ja(Na):Ma():ja(Na);for(var e=ya.length;e--;)delete Pa[Ea][ya[e]];return Pa()};ba[Oa]=!0;var Fa=Object.create||function(e,t){var n;return e===null?n=Pa():(ka[Ea]=_a(e),n=new ka,ka[Ea]=null,n[Oa]=e),t===void 0?n:va.f(n,t)},Ia={},La=ta,Ra=na.concat(`length`,`prototype`);Ia.f=Object.getOwnPropertyNames||function(e){return La(e,Ra)};var za={},Ba=Hi,Va=wr,Ha=jr,Ua=Array,Wa=Math.max,Ga=function(e,t,n){for(var r=Va(e),i=Ba(t,r),a=Ba(n===void 0?r:n,r),o=Ua(Wa(a-i,0)),s=0;i<a;i++,s++)Ha(o,s,e[i]);return o.length=s,o},Ka=S,qa=be,Ja=Ia.f,Ya=Ga,Xa=typeof window==`object`&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Za=function(e){try{return Ja(e)}catch{return Ya(Xa)}};za.f=function(e){return Xa&&Ka(e)===`Window`?Za(e):Ja(qa(e))};var Qa={};Qa.f=Object.getOwnPropertySymbols;var $a=Yn,eo=function(e,t,n,r){return r&&r.enumerable?e[t]=n:$a(e,t,n),e},to=jn,no=function(e,t,n){return to.f(e,t,n)},ro={};ro.f=Bt;var io=Ce,ao=Tt,oo=ro,so=jn.f,co=function(e){var t=io.Symbol||={};ao(t,e)||so(t,e,{value:oo.f(e)})},lo=j,uo=F,fo=Bt,po=eo,mo=function(){var e=uo(`Symbol`),t=e&&e.prototype,n=t&&t.valueOf,r=fo(`toPrimitive`);t&&!t[r]&&po(t,r,function(e){return lo(n,this)},{arity:1})},ho=Pr,go=Hr,_o=ho?{}.toString:function(){return`[object `+go(this)+`]`},vo=Pr,yo=jn.f,bo=Yn,xo=Tt,So=_o,Co=Bt(`toStringTag`),wo=function(e,t,n,r){if(e){var i=n?e:e.prototype;xo(i,Co)||yo(i,Co,{configurable:!0,value:t}),r&&!vo&&bo(i,`toString`,So)}},To=o,Eo=D,Do=To.WeakMap,Oo=Eo(Do)&&/native code/.test(String(Do)),ko=o,Ao=N,jo=Yn,Mo=Tt,No=gt,Po=ga,Fo=Ji,Io=`Object already initialized`,Lo=ko.TypeError,Ro=ko.WeakMap,zo,Bo,Vo,Ho=function(e){return Vo(e)?Bo(e):zo(e,{})},Uo=function(e){return function(t){var n;if(!Ao(t)||(n=Bo(t)).type!==e)throw new Lo(`Incompatible receiver, `+e+` required`);return n}};if(Oo||No.state){var Wo=No.state||=new Ro;Wo.get=Wo.get,Wo.has=Wo.has,Wo.set=Wo.set,zo=function(e,t){if(Wo.has(e))throw new Lo(Io);return t.facade=e,Wo.set(e,t),t},Bo=function(e){return Wo.get(e)||{}},Vo=function(e){return Wo.has(e)}}else{var Go=Po(`state`);Fo[Go]=!0,zo=function(e,t){if(Mo(e,Go))throw new Lo(Io);return t.facade=e,jo(e,Go,t),t},Bo=function(e){return Mo(e,Go)?e[Go]:{}},Vo=function(e){return Mo(e,Go)}}var Ko={set:zo,get:Bo,has:Vo,enforce:Ho,getterFor:Uo},qo=An,Jo=v,Yo=pe,Xo=xt,Zo=wr,Qo=mi,$o=Jo([].push),es=function(e){var t=e===1,n=e===2,r=e===3,i=e===4,a=e===6,o=e===7,s=e===5||a;return function(c,l,u,d){for(var f=Xo(c),p=Yo(f),m=qo(l,u),h=Zo(p),g=0,_=d||Qo,v=t?_(c,h):n||o?_(c,0):void 0,y,b;h>g;g++)if((s||g in p)&&(y=p[g],b=m(y,g,f),e))if(t)v[g]=b;else if(b)switch(e){case 3:return!0;case 5:return y;case 6:return g;case 2:$o(v,y)}else switch(e){case 4:return!1;case 7:$o(v,y)}return a?-1:r||i?i:v}},ts={forEach:es(0),map:es(1),filter:es(2),some:es(3),every:es(4),find:es(5),findIndex:es(6),filterReject:es(7)},ns=z,rs=o,is=j,as=v,os=k,ss=Be,cs=s,ls=Tt,us=De,ds=In,fs=be,ps=Zt,ms=Li,hs=se,gs=Fa,_s=aa,vs=Ia,ys=za,bs=Qa,xs=O,Ss=jn,Cs=Ri,ws=ie,Ts=eo,Es=no,Ds=vt,Os=ga,ks=Ji,As=At,js=Bt,Ms=ro,Ns=co,Ps=mo,Fs=wo,Is=Ko,Ls=ts.forEach,Rs=Os(`hidden`),zs=`Symbol`,Bs=`prototype`,Vs=Is.set,Hs=Is.getterFor(zs),Us=Object[Bs],Ws=rs.Symbol,Gs=Ws&&Ws[Bs],Ks=rs.RangeError,qs=rs.TypeError,Js=rs.QObject,Ys=xs.f,Xs=Ss.f,Zs=ys.f,Qs=ws.f,$s=as([].push),ec=Ds(`symbols`),tc=Ds(`op-symbols`),nc=Ds(`wks`),rc=!Js||!Js[Bs]||!Js[Bs].findChild,ic=function(e,t,n){var r=Ys(Us,t);r&&delete Us[t],Xs(e,t,n),r&&e!==Us&&Xs(Us,t,r)},ac=os&&cs(function(){return gs(Xs({},`a`,{get:function(){return Xs(this,`a`,{value:7}).a}})).a!==7})?ic:Xs,oc=function(e,t){var n=ec[e]=gs(Gs);return Vs(n,{type:zs,tag:e,description:t}),os||(n.description=t),n},sc=function(e,t,n){e===Us&&sc(tc,t,n),ds(e);var r=ps(t);return ds(n),ls(ec,r)?(n.enumerable?(ls(e,Rs)&&e[Rs][r]&&(e[Rs][r]=!1),n=gs(n,{enumerable:hs(0,!1)})):(ls(e,Rs)||Xs(e,Rs,hs(1,{})),e[Rs][r]=!0),ac(e,r,n)):Xs(e,r,n)},cc=function(e,t){ds(e);var n=fs(t);return Ls(_s(n).concat(pc(n)),function(t){(!os||is(uc,n,t))&&sc(e,t,n[t])}),e},lc=function(e,t){return t===void 0?gs(e):cc(gs(e),t)},uc=function(e){var t=ps(e),n=is(Qs,this,t);return this===Us&&ls(ec,t)&&!ls(tc,t)?!1:n||!ls(this,t)||!ls(ec,t)||ls(this,Rs)&&this[Rs][t]?n:!0},dc=function(e,t){var n=fs(e),r=ps(t);if(!(n===Us&&ls(ec,r)&&!ls(tc,r))){var i=Ys(n,r);return i&&ls(ec,r)&&!(ls(n,Rs)&&n[Rs][r])&&(i.enumerable=!0),i}},fc=function(e){var t=Zs(fs(e)),n=[];return Ls(t,function(e){!ls(ec,e)&&!ls(ks,e)&&$s(n,e)}),n},pc=function(e){var t=e===Us,n=Zs(t?tc:fs(e)),r=[];return Ls(n,function(e){ls(ec,e)&&(!t||ls(Us,e))&&$s(r,ec[e])}),r};ss||(Ws=function(){if(us(Gs,this))throw new qs(`Symbol is not a constructor`);var e=!arguments.length||arguments[0]===void 0?void 0:ms(arguments[0]),t=As(e),n=function(e){var r=this===void 0?rs:this;r===Us&&is(n,tc,e),ls(r,Rs)&&ls(r[Rs],t)&&(r[Rs][t]=!1);var i=hs(1,e);try{ac(r,t,i)}catch(e){if(!(e instanceof Ks))throw e;ic(r,t,i)}};return os&&rc&&ac(Us,t,{configurable:!0,set:n}),oc(t,e)},Gs=Ws[Bs],Ts(Gs,`toString`,function(){return Hs(this).tag}),Ts(Ws,`withoutSetter`,function(e){return oc(As(e),e)}),ws.f=uc,Ss.f=sc,Cs.f=cc,xs.f=dc,vs.f=ys.f=fc,bs.f=pc,Ms.f=function(e){return oc(js(e),e)},os&&Es(Gs,`description`,{configurable:!0,get:function(){return Hs(this).description}})),ns({global:!0,constructor:!0,wrap:!0,forced:!ss,sham:!ss},{Symbol:Ws}),Ls(_s(nc),function(e){Ns(e)}),ns({target:zs,stat:!0,forced:!ss},{useSetter:function(){rc=!0},useSimple:function(){rc=!1}}),ns({target:`Object`,stat:!0,forced:!ss,sham:!os},{create:lc,defineProperty:sc,defineProperties:cc,getOwnPropertyDescriptor:dc}),ns({target:`Object`,stat:!0,forced:!ss},{getOwnPropertyNames:fc}),Ps(),Fs(Ws,zs),ks[Rs]=!0;var mc=Be&&!!Symbol.for&&!!Symbol.keyFor,hc=z,gc=F,_c=Tt,vc=Li,yc=vt,bc=mc,xc=yc(`string-to-symbol-registry`),V=yc(`symbol-to-string-registry`);hc({target:`Symbol`,stat:!0,forced:!bc},{for:function(e){var t=vc(e);if(_c(xc,t))return xc[t];var n=gc(`Symbol`)(t);return xc[t]=n,V[n]=t,n}});var Sc=z,Cc=Tt,wc=qe,Tc=Ye,Ec=vt,Dc=mc,Oc=Ec(`symbol-to-string-registry`);Sc({target:`Symbol`,stat:!0,forced:!Dc},{keyFor:function(e){if(!wc(e))throw TypeError(Tc(e)+` is not a symbol`);if(Cc(Oc,e))return Oc[e]}});var kc=v([].slice),Ac=v,jc=gr,Mc=D,Nc=S,Pc=Li,Fc=Ac([].push),Ic=function(e){if(Mc(e))return e;if(jc(e)){for(var t=e.length,n=[],r=0;r<t;r++){var i=e[r];typeof i==`string`?Fc(n,i):(typeof i==`number`||Nc(i)===`Number`||Nc(i)===`String`)&&Fc(n,Pc(i))}var a=n.length,o=!0;return function(e,t){if(o)return o=!1,t;if(jc(this))return t;for(var r=0;r<a;r++)if(n[r]===e)return t}}},Lc=z,Rc=F,zc=p,Bc=j,Vc=v,Hc=s,Uc=D,Wc=qe,Gc=kc,Kc=Ic,qc=Be,Jc=String,Yc=Rc(`JSON`,`stringify`),Xc=Vc(/./.exec),Zc=Vc(``.charAt),Qc=Vc(``.charCodeAt),$c=Vc(``.replace),el=Vc(1 .toString),tl=/[\uD800-\uDFFF]/g,nl=/^[\uD800-\uDBFF]$/,rl=/^[\uDC00-\uDFFF]$/,il=!qc||Hc(function(){var e=Rc(`Symbol`)(`stringify detection`);return Yc([e])!==`[null]`||Yc({a:e})!==`{}`||Yc(Object(e))!==`{}`}),al=Hc(function(){return Yc(`\udf06\ud834`)!==`"\\udf06\\ud834"`||Yc(`\udead`)!==`"\\udead"`}),ol=function(e,t){var n=Gc(arguments),r=Kc(t);if(!(!Uc(r)&&(e===void 0||Wc(e))))return n[1]=function(e,t){if(Uc(r)&&(t=Bc(r,this,Jc(e),t)),!Wc(t))return t},zc(Yc,null,n)},sl=function(e,t,n){var r=Zc(n,t-1),i=Zc(n,t+1);return Xc(nl,e)&&!Xc(rl,i)||Xc(rl,e)&&!Xc(nl,r)?`\\u`+el(Qc(e,0),16):e};Yc&&Lc({target:`JSON`,stat:!0,arity:3,forced:il||al},{stringify:function(e,t,n){var r=Gc(arguments),i=zc(il?ol:Yc,null,r);return al&&typeof i==`string`?$c(i,tl,sl):i}});var cl=z,ll=Be,ul=s,dl=Qa,fl=xt;cl({target:`Object`,stat:!0,forced:!ll||ul(function(){dl.f(1)})},{getOwnPropertySymbols:function(e){var t=dl.f;return t?t(fl(e)):[]}}),co(`asyncIterator`),co(`hasInstance`),co(`isConcatSpreadable`),co(`iterator`),co(`match`),co(`matchAll`),co(`replace`),co(`search`),co(`species`),co(`split`);var pl=co,ml=mo;pl(`toPrimitive`),ml();var hl=F,gl=co,_l=wo;gl(`toStringTag`),_l(hl(`Symbol`),`Symbol`),co(`unscopables`),wo(o.JSON,`JSON`,!0);var vl=Ce.Symbol,yl={},bl=k,xl=Tt,Sl=Function.prototype,Cl=bl&&Object.getOwnPropertyDescriptor,wl=xl(Sl,`name`),Tl={EXISTS:wl,PROPER:wl&&(function(){}).name===`something`,CONFIGURABLE:wl&&(!bl||bl&&Cl(Sl,`name`).configurable)},El=!s(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Dl=Tt,Ol=D,kl=xt,Al=ga,jl=El,Ml=Al(`IE_PROTO`),Nl=Object,Pl=Nl.prototype,Fl=jl?Nl.getPrototypeOf:function(e){var t=kl(e);if(Dl(t,Ml))return t[Ml];var n=t.constructor;return Ol(n)&&t instanceof n?n.prototype:t instanceof Nl?Pl:null},Il=s,Ll=D,Rl=N,zl=Fa,Bl=Fl,Vl=eo,Hl=Bt(`iterator`),Ul=!1,Wl,Gl,Kl;[].keys&&(Kl=[].keys(),`next`in Kl?(Gl=Bl(Bl(Kl)),Gl!==Object.prototype&&(Wl=Gl)):Ul=!0),Wl=!Rl(Wl)||Il(function(){var e={};return Wl[Hl].call(e)!==e})?{}:zl(Wl),Ll(Wl[Hl])||Vl(Wl,Hl,function(){return this});var ql={IteratorPrototype:Wl,BUGGY_SAFARI_ITERATORS:Ul},Jl=ql.IteratorPrototype,Yl=Fa,Xl=se,Zl=wo,Ql=yl,$l=function(){return this},eu=function(e,t,n,r){var i=t+` Iterator`;return e.prototype=Yl(Jl,{next:Xl(+!r,n)}),Zl(e,i,!1,!0),Ql[i]=$l,e},tu=v,nu=$e,ru=function(e,t,n){try{return tu(nu(Object.getOwnPropertyDescriptor(e,t)[n]))}catch{}},iu=D,au=String,ou=TypeError,su=function(e){if(typeof e==`object`||iu(e))return e;throw new ou(`Can't set `+au(e)+` as a prototype`)},cu=ru,lu=In,uu=su,du=Object.setPrototypeOf||(`__proto__`in{}?function(){var e=!1,t={},n;try{n=cu(Object.prototype,`__proto__`,`set`),n(t,[]),e=t instanceof Array}catch{}return function(t,r){return lu(t),uu(r),e?n(t,r):t.__proto__=r,t}}():void 0),fu=z,pu=j,mu=Tl,hu=eu,gu=Fl,_u=wo,vu=eo,yu=Bt,bu=yl,xu=ql,Su=mu.PROPER;mu.CONFIGURABLE,xu.IteratorPrototype;var Cu=xu.BUGGY_SAFARI_ITERATORS,wu=yu(`iterator`),Tu=`keys`,Eu=`values`,Du=`entries`,Ou=function(){return this},ku=function(e,t,n,r,i,a,o){hu(n,t,r);var s=function(e){if(e===i&&f)return f;if(!Cu&&e&&e in u)return u[e];switch(e){case Tu:return function(){return new n(this,e)};case Eu:return function(){return new n(this,e)};case Du:return function(){return new n(this,e)}}return function(){return new n(this)}},c=t+` Iterator`,l=!1,u=e.prototype,d=u[wu]||u[`@@iterator`]||i&&u[i],f=!Cu&&d||s(i),p=t===`Array`&&u.entries||d,m,h,g;if(p&&(m=gu(p.call(new e)),m!==Object.prototype&&m.next&&(_u(m,c,!0,!0),bu[c]=Ou)),Su&&i===Eu&&d&&d.name!==Eu&&(l=!0,f=function(){return pu(d,this)}),i)if(h={values:s(Eu),keys:a?f:s(Tu),entries:s(Du)},o)for(g in h)(Cu||l||!(g in u))&&vu(u,g,h[g]);else fu({target:t,proto:!0,forced:Cu||l},h);return o&&u[wu]!==f&&vu(u,wu,f,{name:i}),bu[t]=f,h},Au=function(e,t){return{value:e,done:t}},ju=be,Mu=yl,Nu=Ko;jn.f;var Pu=ku,Fu=Au,Iu=`Array Iterator`,Lu=Nu.set,Ru=Nu.getterFor(Iu);Pu(Array,`Array`,function(e,t){Lu(this,{type:Iu,target:ju(e),index:0,kind:t})},function(){var e=Ru(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=void 0,Fu(void 0,!0);switch(e.kind){case`keys`:return Fu(n,!1);case`values`:return Fu(t[n],!1)}return Fu([n,t[n]],!1)},`values`),Mu.Arguments=Mu.Array;var zu={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Bu=o,Vu=Hr,Hu=Yn,Uu=yl,Wu=Bt(`toStringTag`);for(var Gu in zu){var Ku=Bu[Gu],qu=Ku&&Ku.prototype;qu&&Vu(qu)!==Wu&&Hu(qu,Wu,Gu),Uu[Gu]=Uu.Array}var Ju=vl,Yu=Bt,Xu=jn.f,Zu=Yu(`metadata`),Qu=Function.prototype;Qu[Zu]===void 0&&Xu(Qu,Zu,{value:null}),co(`asyncDispose`),co(`dispose`),co(`metadata`);var $u=Ju,ed=F,td=v,nd=ed(`Symbol`),rd=nd.keyFor,id=td(nd.prototype.valueOf),ad=nd.isRegisteredSymbol||function(e){try{return rd(id(e))!==void 0}catch{return!1}};z({target:`Symbol`,stat:!0},{isRegisteredSymbol:ad});for(var od=vt,sd=F,cd=v,ld=qe,ud=Bt,dd=sd(`Symbol`),fd=dd.isWellKnownSymbol,pd=sd(`Object`,`getOwnPropertyNames`),md=cd(dd.prototype.valueOf),hd=od(`wks`),gd=0,_d=pd(dd),vd=_d.length;gd<vd;gd++)try{var yd=_d[gd];ld(dd[yd])&&ud(yd)}catch{}var bd=function(e){if(fd&&fd(e))return!0;try{for(var t=md(e),n=0,r=pd(hd),i=r.length;n<i;n++)if(hd[r[n]]==t)return!0}catch{}return!1};z({target:`Symbol`,stat:!0,forced:!0},{isWellKnownSymbol:bd}),co(`matcher`),co(`observable`),z({target:`Symbol`,stat:!0,name:`isRegisteredSymbol`},{isRegistered:ad}),z({target:`Symbol`,stat:!0,name:`isWellKnownSymbol`,forced:!0},{isWellKnown:bd}),co(`metadataKey`),co(`patternMatch`),co(`replaceAll`);var xd=$u,Sd=r(xd),Cd=v,wd=br,Td=Li,Ed=_e,Dd=Cd(``.charAt),Od=Cd(``.charCodeAt),kd=Cd(``.slice),Ad=function(e){return function(t,n){var r=Td(Ed(t)),i=wd(n),a=r.length,o,s;return i<0||i>=a?e?``:void 0:(o=Od(r,i),o<55296||o>56319||i+1===a||(s=Od(r,i+1))<56320||s>57343?e?Dd(r,i):o:e?kd(r,i,i+2):(o-55296<<10)+(s-56320)+65536)}},jd={codeAt:Ad(!1),charAt:Ad(!0)}.charAt,Md=Li,Nd=Ko,Pd=ku,Fd=Au,Id=`String Iterator`,Ld=Nd.set,Rd=Nd.getterFor(Id);Pd(String,`String`,function(e){Ld(this,{type:Id,string:Md(e),index:0})},function(){var e=Rd(this),t=e.string,n=e.index,r;return n>=t.length?Fd(void 0,!0):(r=jd(t,n),e.index+=r.length,Fd(r,!1))});var zd=ro.f(`iterator`),Bd=zd,Vd=r(Bd);function Hd(e){"@babel/helpers - typeof";return Hd=typeof Sd==`function`&&typeof Vd==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Sd==`function`&&e.constructor===Sd&&e!==Sd.prototype?`symbol`:typeof e},Hd(e)}var Ud=r(ro.f(`toPrimitive`));function Wd(e,t){if(Hd(e)!==`object`||e===null)return e;var n=e[Ud];if(n!==void 0){var r=n.call(e,t||`default`);if(Hd(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Gd(e){var t=Wd(e,`string`);return Hd(t)===`symbol`?t:String(t)}function Kd(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),mr(e,Gd(r.key),r)}}function qd(e,t,n){return t&&Kd(e.prototype,t),n&&Kd(e,n),mr(e,`prototype`,{writable:!1}),e}function Jd(e,t,n){return t=Gd(t),t in e?mr(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Yd=v,Xd=$e,Zd=N,Qd=Tt,$d=kc,ef=c,tf=Function,nf=Yd([].concat),rf=Yd([].join),af={},of=function(e,t,n){if(!Qd(af,t)){for(var r=[],i=0;i<t;i++)r[i]=`a[`+i+`]`;af[t]=tf(`C,a`,`return new C(`+rf(r,`,`)+`)`)}return af[t](e,n)},sf=ef?tf.bind:function(e){var t=Xd(this),n=t.prototype,r=$d(arguments,1),i=function(){var n=nf(r,$d(arguments));return this instanceof i?of(t,n.length,n):t.apply(e,n)};return Zd(n)&&(i.prototype=n),i},cf=z,lf=sf;cf({target:`Function`,proto:!0,forced:Function.bind!==lf},{bind:lf});var uf=o,df=Ce,ff=function(e,t){var n=df[e+`Prototype`],r=n&&n[t];if(r)return r;var i=uf[e],a=i&&i.prototype;return a&&a[t]},pf=ff(`Function`,`bind`),mf=De,hf=pf,gf=Function.prototype,_f=function(e){var t=e.bind;return e===gf||mf(gf,e)&&t===gf.bind?hf:t},vf=r(_f),yf=$e,bf=xt,xf=pe,Sf=wr,Cf=TypeError,wf=function(e){return function(t,n,r,i){yf(n);var a=bf(t),o=xf(a),s=Sf(a),c=e?s-1:0,l=e?-1:1;if(r<2)for(;;){if(c in o){i=o[c],c+=l;break}if(c+=l,e?c<0:s<=c)throw new Cf(`Reduce of empty array with no initial value`)}for(;e?c>=0:s>c;c+=l)c in o&&(i=n(i,o[c],c,a));return i}},Tf={left:wf(!1),right:wf(!0)},H=s,Ef=function(e,t){var n=[][e];return!!n&&H(function(){n.call(null,t||function(){return 1},1)})},Df=S(o.process)===`process`,Of=z,kf=Tf.left,Af=Ef,jf=Ie;Of({target:`Array`,proto:!0,forced:!Df&&jf>79&&jf<83||!Af(`reduce`)},{reduce:function(e){var t=arguments.length;return kf(this,e,t,t>1?arguments[1]:void 0)}});var Mf=ff(`Array`,`reduce`),Nf=De,Pf=Mf,Ff=Array.prototype,If=r(function(e){var t=e.reduce;return e===Ff||Nf(Ff,e)&&t===Ff.reduce?Pf:t}),Lf=z,Rf=ts.filter;Lf({target:`Array`,proto:!0,forced:!yi(`filter`)},{filter:function(e){return Rf(this,e,arguments.length>1?arguments[1]:void 0)}});var zf=ff(`Array`,`filter`),Bf=De,Vf=zf,Hf=Array.prototype,Uf=r(function(e){var t=e.filter;return e===Hf||Bf(Hf,e)&&t===Hf.filter?Vf:t}),Wf=z,Gf=ts.map;Wf({target:`Array`,proto:!0,forced:!yi(`map`)},{map:function(e){return Gf(this,e,arguments.length>1?arguments[1]:void 0)}});var Kf=ff(`Array`,`map`),qf=De,Jf=Kf,Yf=Array.prototype,Xf=r(function(e){var t=e.map;return e===Yf||qf(Yf,e)&&t===Yf.map?Jf:t}),Zf=gr,Qf=wr,$f=Dr,ep=An,tp=function(e,t,n,r,i,a,o,s){for(var c=i,l=0,u=o?ep(o,s):!1,d,f;l<r;)l in n&&(d=u?u(n[l],l,t):n[l],a>0&&Zf(d)?(f=Qf(d),c=tp(e,t,d,f,c,a-1)-1):($f(c+1),e[c]=d),c++),l++;return c},np=tp,rp=z,ip=np,ap=$e,op=xt,sp=wr,cp=mi;rp({target:`Array`,proto:!0},{flatMap:function(e){var t=op(this),n=sp(t),r;return ap(e),r=cp(t,0),r.length=ip(r,t,t,n,0,1,e,arguments.length>1?arguments[1]:void 0),r}});var lp=ff(`Array`,`flatMap`),up=De,dp=lp,fp=Array.prototype,pp=r(function(e){var t=e.flatMap;return e===fp||up(fp,e)&&t===fp.flatMap?dp:t});function mp(e){return new gp(e)}var hp=function(){function e(n,r,i){var a,o,s;t(this,e),Jd(this,`_listeners`,{add:vf(a=this._add).call(a,this),remove:vf(o=this._remove).call(o,this),update:vf(s=this._update).call(s,this)}),this._source=n,this._transformers=r,this._target=i}return qd(e,[{key:`all`,value:function(){return this._target.update(this._transformItems(this._source.get())),this}},{key:`start`,value:function(){return this._source.on(`add`,this._listeners.add),this._source.on(`remove`,this._listeners.remove),this._source.on(`update`,this._listeners.update),this}},{key:`stop`,value:function(){return this._source.off(`add`,this._listeners.add),this._source.off(`remove`,this._listeners.remove),this._source.off(`update`,this._listeners.update),this}},{key:`_transformItems`,value:function(e){var t;return If(t=this._transformers).call(t,function(e,t){return t(e)},e)}},{key:`_add`,value:function(e,t){t!=null&&this._target.add(this._transformItems(this._source.get(t.items)))}},{key:`_update`,value:function(e,t){t!=null&&this._target.update(this._transformItems(this._source.get(t.items)))}},{key:`_remove`,value:function(e,t){t!=null&&this._target.remove(this._transformItems(t.oldData))}}]),e}(),gp=function(){function e(n){t(this,e),Jd(this,`_transformers`,[]),this._source=n}return qd(e,[{key:`filter`,value:function(e){return this._transformers.push(function(t){return Uf(t).call(t,e)}),this}},{key:`map`,value:function(e){return this._transformers.push(function(t){return Xf(t).call(t,e)}),this}},{key:`flatMap`,value:function(e){return this._transformers.push(function(t){return pp(t).call(t,e)}),this}},{key:`to`,value:function(e){return new hp(this._source,this._transformers,e)}}]),e}(),_p=j,vp=In,yp=nt,bp=function(e,t,n){var r,i;vp(e);try{if(r=yp(e,`return`),!r){if(t===`throw`)throw n;return n}r=_p(r,e)}catch(e){i=!0,r=e}if(t===`throw`)throw n;if(i)throw r;return vp(r),n},xp=In,Sp=bp,Cp=function(e,t,n,r){try{return r?t(xp(n)[0],n[1]):t(n)}catch(t){Sp(e,`throw`,t)}},wp=Bt,Tp=yl,Ep=wp(`iterator`),Dp=Array.prototype,Op=function(e){return e!==void 0&&(Tp.Array===e||Dp[Ep]===e)},kp=Hr,Ap=nt,jp=me,Mp=yl,Np=Bt(`iterator`),Pp=function(e){if(!jp(e))return Ap(e,Np)||Ap(e,`@@iterator`)||Mp[kp(e)]},Fp=j,Ip=$e,Lp=In,Rp=Ye,zp=Pp,Bp=TypeError,Vp=function(e,t){var n=arguments.length<2?zp(e):t;if(Ip(n))return Lp(Fp(n,e));throw new Bp(Rp(e)+` is not iterable`)},Hp=An,Up=j,Wp=xt,Gp=Cp,Kp=Op,qp=si,Jp=wr,Yp=jr,Xp=Vp,Zp=Pp,Qp=Array,$p=function(e){var t=Wp(e),n=qp(this),r=arguments.length,i=r>1?arguments[1]:void 0,a=i!==void 0;a&&(i=Hp(i,r>2?arguments[2]:void 0));var o=Zp(t),s=0,c,l,u,d,f,p;if(o&&!(this===Qp&&Kp(o)))for(d=Xp(t,o),f=d.next,l=n?new this:[];!(u=Up(f,d)).done;s++)p=a?Gp(d,i,[u.value,s],!0):u.value,Yp(l,s,p);else for(c=Jp(t),l=n?new this(c):Qp(c);c>s;s++)p=a?i(t[s],s):t[s],Yp(l,s,p);return l.length=s,l},em=Bt(`iterator`),tm=!1;try{var nm=0,rm={next:function(){return{done:!!nm++}},return:function(){tm=!0}};rm[em]=function(){return this},Array.from(rm,function(){throw 2})}catch{}var im=function(e,t){try{if(!t&&!tm)return!1}catch{return!1}var n=!1;try{var r={};r[em]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch{}return n},am=z,om=$p;am({target:`Array`,stat:!0,forced:!im(function(e){Array.from(e)})},{from:om});var sm=Ce.Array.from,cm=r(sm),lm=Pp,um=r(lm),dm=r(lm);z({target:`Array`,stat:!0},{isArray:gr});var fm=Ce.Array.isArray,pm=r(fm);function mm(e){if(pm(e))return e}var hm=k,gm=gr,_m=TypeError,vm=Object.getOwnPropertyDescriptor,ym=hm&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],`length`,{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(gm(e)&&!vm(e,`length`).writable)throw new _m(`Cannot set read only .length`);return e.length=t}:function(e,t){return e.length=t},bm=z,xm=xt,Sm=wr,Cm=ym,wm=Dr;bm({target:`Array`,proto:!0,arity:1,forced:s(function(){return[].push.call({length:4294967296},1)!==4294967297})||!function(){try{Object.defineProperty([],`length`,{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=xm(this),n=Sm(t),r=arguments.length;wm(n+r);for(var i=0;i<r;i++)t[n]=arguments[i],n++;return Cm(t,n),n}});var Tm=ff(`Array`,`push`),Em=De,Dm=Tm,Om=Array.prototype,km=function(e){var t=e.push;return e===Om||Em(Om,e)&&t===Om.push?Dm:t},Am=r(km);function jm(e,t){var n=e==null?null:Sd!==void 0&&um(e)||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(Am(s).call(s,r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}var Mm=z,Nm=gr,Pm=si,Fm=N,Im=Hi,Lm=wr,Rm=be,zm=jr,Bm=Bt,Vm=yi,Hm=kc,Um=Vm(`slice`),Wm=Bm(`species`),Gm=Array,Km=Math.max;Mm({target:`Array`,proto:!0,forced:!Um},{slice:function(e,t){var n=Rm(this),r=Lm(n),i=Im(e,r),a=Im(t===void 0?r:t,r),o,s,c;if(Nm(n)&&(o=n.constructor,Pm(o)&&(o===Gm||Nm(o.prototype))?o=void 0:Fm(o)&&(o=o[Wm],o===null&&(o=void 0)),o===Gm||o===void 0))return Hm(n,i,a);for(s=new(o===void 0?Gm:o)(Km(a-i,0)),c=0;i<a;i++,c++)i in n&&zm(s,c,n[i]);return s.length=c,s}});var qm=ff(`Array`,`slice`),Jm=De,Ym=qm,Xm=Array.prototype,Zm=function(e){var t=e.slice;return e===Xm||Jm(Xm,e)&&t===Xm.slice?Ym:t},Qm=Zm,$m=r(Qm),eh=r(sm);function th(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nh(e,t){var n;if(e){if(typeof e==`string`)return th(e,t);var r=$m(n=Object.prototype.toString.call(e)).call(n,8,-1);if(r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`)return eh(e);if(r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return th(e,t)}}function rh(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ih(e,t){return mm(e)||jm(e,t)||nh(e,t)||rh()}function ah(e){if(pm(e))return th(e)}function oh(e){if(Sd!==void 0&&um(e)!=null||e[`@@iterator`]!=null)return eh(e)}function sh(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ch(e){return ah(e)||oh(e)||nh(e)||sh()}var lh=r(Ju),uh=ff(`Array`,`concat`),dh=De,fh=uh,ph=Array.prototype,mh=r(function(e){var t=e.concat;return e===ph||dh(ph,e)&&t===ph.concat?fh:t}),hh=r(Zm),gh=F,_h=v,vh=Ia,yh=Qa,bh=In,xh=_h([].concat),Sh=gh(`Reflect`,`ownKeys`)||function(e){var t=vh.f(bh(e)),n=yh.f;return n?xh(t,n(e)):t};z({target:`Reflect`,stat:!0},{ownKeys:Sh});var Ch=Ce.Reflect.ownKeys,wh=r(Ch),Th=r(fm),Eh=z,Dh=xt,Oh=aa;Eh({target:`Object`,stat:!0,forced:s(function(){Oh(1)})},{keys:function(e){return Oh(Dh(e))}});var kh=Ce.Object.keys,Ah=r(kh),jh=ts.forEach,Mh=Ef(`forEach`)?[].forEach:function(e){return jh(this,e,arguments.length>1?arguments[1]:void 0)},Nh=z,Ph=Mh;Nh({target:`Array`,proto:!0,forced:[].forEach!==Ph},{forEach:Ph});var Fh=ff(`Array`,`forEach`),Ih=Hr,Lh=Tt,Rh=De,zh=Fh,Bh=Array.prototype,Vh={DOMTokenList:!0,NodeList:!0},Hh=function(e){var t=e.forEach;return e===Bh||Rh(Bh,e)&&t===Bh.forEach||Lh(Vh,Ih(e))?zh:t},Uh=r(Hh),Wh=z,Gh=v,Kh=gr,qh=Gh([].reverse),Jh=[1,2];Wh({target:`Array`,proto:!0,forced:String(Jh)===String(Jh.reverse())},{reverse:function(){return Kh(this)&&(this.length=this.length),qh(this)}});var Yh=ff(`Array`,`reverse`),Xh=De,Zh=Yh,Qh=Array.prototype,$h=function(e){var t=e.reverse;return e===Qh||Xh(Qh,e)&&t===Qh.reverse?Zh:t},eg=r($h),tg=Ye,ng=TypeError,rg=function(e,t){if(!delete e[t])throw new ng(`Cannot delete property `+tg(t)+` of `+tg(e))},ig=z,ag=xt,og=Hi,sg=br,cg=wr,lg=ym,ug=Dr,dg=mi,fg=jr,pg=rg,mg=yi(`splice`),hg=Math.max,gg=Math.min;ig({target:`Array`,proto:!0,forced:!mg},{splice:function(e,t){var n=ag(this),r=cg(n),i=og(e,r),a=arguments.length,o,s,c,l,u,d;for(a===0?o=s=0:a===1?(o=0,s=r-i):(o=a-2,s=gg(hg(sg(t),0),r-i)),ug(r+o-s),c=dg(n,s),l=0;l<s;l++)u=i+l,u in n&&fg(c,l,n[u]);if(c.length=s,o<s){for(l=i;l<r-s;l++)u=l+s,d=l+o,u in n?n[d]=n[u]:pg(n,d);for(l=r;l>r-s+o;l--)pg(n,l-1)}else if(o>s)for(l=r-s;l>i;l--)u=l+s-1,d=l+o-1,u in n?n[d]=n[u]:pg(n,d);for(l=0;l<o;l++)n[l+i]=arguments[l+2];return lg(n,r-s+o),c}});var _g=ff(`Array`,`splice`),vg=De,yg=_g,bg=Array.prototype,xg=r(function(e){var t=e.splice;return e===bg||vg(bg,e)&&t===bg.splice?yg:t}),Sg=k,Cg=v,wg=j,Tg=s,Eg=aa,Dg=Qa,Og=ie,kg=xt,Ag=pe,jg=Object.assign,Mg=Object.defineProperty,Ng=Cg([].concat),Pg=!jg||Tg(function(){if(Sg&&jg({b:1},jg(Mg({},`a`,{enumerable:!0,get:function(){Mg(this,`b`,{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var e={},t={},n=Symbol(`assign detection`),r=`abcdefghijklmnopqrst`;return e[n]=7,r.split(``).forEach(function(e){t[e]=e}),jg({},e)[n]!==7||Eg(jg({},t)).join(``)!==r})?function(e,t){for(var n=kg(e),r=arguments.length,i=1,a=Dg.f,o=Og.f;r>i;)for(var s=Ag(arguments[i++]),c=a?Ng(Eg(s),a(s)):Eg(s),l=c.length,u=0,d;l>u;)d=c[u++],(!Sg||wg(o,s,d))&&(n[d]=s[d]);return n}:jg,Fg=z,Ig=Pg;Fg({target:`Object`,stat:!0,arity:2,forced:Object.assign!==Ig},{assign:Ig});var Lg=Ce.Object.assign,Rg=r(Lg),zg=z,Bg=s,Vg=xt,Hg=Fl,Ug=El;zg({target:`Object`,stat:!0,forced:Bg(function(){Hg(1)}),sham:!Ug},{getPrototypeOf:function(e){return Hg(Vg(e))}});var Wg=Ce.Object.getPrototypeOf;z({target:`Object`,stat:!0,sham:!k},{create:Fa});var Gg=Ce.Object,Kg=function(e,t){return Gg.create(e,t)},qg=r(Kg),Jg=Ce,Yg=p;Jg.JSON||={stringify:JSON.stringify};var Xg=r(function(e,t,n){return Yg(Jg.JSON.stringify,null,arguments)}),Zg=typeof Bun==`function`&&Bun&&typeof Bun.version==`string`,Qg=TypeError,$g=function(e,t){if(e<t)throw new Qg(`Not enough arguments`);return e},e_=o,t_=p,n_=D,r_=Zg,i_=Oe,a_=kc,o_=$g,s_=e_.Function,c_=/MSIE .\./.test(i_)||r_&&(function(){var e=e_.Bun.version.split(`.`);return e.length<3||e[0]===`0`&&(e[1]<3||e[1]===`3`&&e[2]===`0`)})(),l_=function(e,t){var n=t?2:1;return c_?function(r,i){var a=o_(arguments.length,1)>n,o=n_(r)?r:s_(r),s=a?a_(arguments,n):[],c=a?function(){t_(o,this,s)}:o;return t?e(c,i):e(c)}:e},u_=z,d_=o,f_=l_(d_.setInterval,!0);u_({global:!0,bind:!0,forced:d_.setInterval!==f_},{setInterval:f_});var p_=z,m_=o,h_=l_(m_.setTimeout,!0);p_({global:!0,bind:!0,forced:m_.setTimeout!==h_},{setTimeout:h_});var g_=Ce.setTimeout,__=r(g_),v_={exports:{}};(function(e){function t(e){if(e)return n(e);this._callbacks=new Map}function n(e){return Object.assign(e,t.prototype),e._callbacks=new Map,e}t.prototype.on=function(e,t){let n=this._callbacks.get(e)??[];return n.push(t),this._callbacks.set(e,n),this},t.prototype.once=function(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return n.fn=t,this.on(e,n),this},t.prototype.off=function(e,t){if(e===void 0&&t===void 0)return this._callbacks.clear(),this;if(t===void 0)return this._callbacks.delete(e),this;let n=this._callbacks.get(e);if(n){for(let[e,r]of n.entries())if(r===t||r.fn===t){n.splice(e,1);break}n.length===0?this._callbacks.delete(e):this._callbacks.set(e,n)}return this},t.prototype.emit=function(e,...t){let n=this._callbacks.get(e);if(n){let e=[...n];for(let n of e)n.apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks.get(e)??[]},t.prototype.listenerCount=function(e){if(e)return this.listeners(e).length;let t=0;for(let e of this._callbacks.values())t+=e.length;return t},t.prototype.hasListeners=function(e){return this.listenerCount(e)>0},t.prototype.addEventListener=t.prototype.on,t.prototype.removeListener=t.prototype.off,t.prototype.removeEventListener=t.prototype.off,t.prototype.removeAllListeners=t.prototype.off,e.exports=t})(v_);var y_=v_.exports,b_=r(y_);function x_(){return x_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},x_.apply(this,arguments)}function S_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function C_(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}var w_=typeof Object.assign==`function`?Object.assign:function(e){if(e==null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!=null)for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])}return t},T_=[``,`webkit`,`Moz`,`MS`,`ms`,`o`],E_=typeof document>`u`?{style:{}}:document.createElement(`div`),D_=`function`,O_=Math.round,k_=Math.abs,A_=Date.now;function j_(e,t){for(var n,r,i=t[0].toUpperCase()+t.slice(1),a=0;a<T_.length;){if(n=T_[a],r=n?n+i:t,r in e)return r;a++}}var M_=typeof window>`u`?{}:window,N_=j_(E_.style,`touchAction`),P_=N_!==void 0;function F_(){if(!P_)return!1;var e={},t=M_.CSS&&M_.CSS.supports;return[`auto`,`manipulation`,`pan-y`,`pan-x`,`pan-x pan-y`,`none`].forEach(function(n){return e[n]=t?M_.CSS.supports(`touch-action`,n):!0}),e}var I_=`compute`,L_=`auto`,R_=`manipulation`,z_=`none`,B_=`pan-x`,V_=`pan-y`,H_=F_(),U_=/mobile|tablet|ip(ad|hone|od)|android/i,W_=`ontouchstart`in M_,G_=j_(M_,`PointerEvent`)!==void 0,K_=W_&&U_.test(navigator.userAgent),q_=`touch`,J_=`pen`,Y_=`mouse`,X_=`kinect`,Z_=25,Q_=1,$_=2,ev=4,tv=8,nv=1,rv=2,iv=4,av=8,ov=16,sv=rv|iv,cv=av|ov,lv=sv|cv,uv=[`x`,`y`],dv=[`clientX`,`clientY`];function fv(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==void 0)for(r=0;r<e.length;)t.call(n,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e)}function pv(e,t){return typeof e===D_?e.apply(t&&t[0]||void 0,t):e}function mv(e,t){return e.indexOf(t)>-1}function hv(e){if(mv(e,z_))return z_;var t=mv(e,B_),n=mv(e,V_);return t&&n?z_:t||n?t?B_:V_:mv(e,R_)?R_:L_}var gv=function(){function e(e,t){this.manager=e,this.set(t)}var t=e.prototype;return t.set=function(e){e===I_&&(e=this.compute()),P_&&this.manager.element.style&&H_[e]&&(this.manager.element.style[N_]=e),this.actions=e.toLowerCase().trim()},t.update=function(){this.set(this.manager.options.touchAction)},t.compute=function(){var e=[];return fv(this.manager.recognizers,function(t){pv(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),hv(e.join(` `))},t.preventDefaults=function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented){t.preventDefault();return}var r=this.actions,i=mv(r,z_)&&!H_[z_],a=mv(r,V_)&&!H_[V_],o=mv(r,B_)&&!H_[B_];if(i){var s=e.pointers.length===1,c=e.distance<2,l=e.deltaTime<250;if(s&&c&&l)return}if(!(o&&a)&&(i||a&&n&sv||o&&n&cv))return this.preventSrc(t)},t.preventSrc=function(e){this.manager.session.prevented=!0,e.preventDefault()},e}();function _v(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function vv(e){var t=e.length;if(t===1)return{x:O_(e[0].clientX),y:O_(e[0].clientY)};for(var n=0,r=0,i=0;i<t;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:O_(n/t),y:O_(r/t)}}function yv(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:O_(e.pointers[n].clientX),clientY:O_(e.pointers[n].clientY)},n++;return{timeStamp:A_(),pointers:t,center:vv(t),deltaX:e.deltaX,deltaY:e.deltaY}}function bv(e,t,n){n||=uv;var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function xv(e,t,n){n||=uv;var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.atan2(i,r)*180/Math.PI}function Sv(e,t){return e===t?nv:k_(e)>=k_(t)?e<0?rv:iv:t<0?av:ov}function Cv(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},a=e.prevInput||{};(t.eventType===Q_||a.eventType===ev)&&(i=e.prevDelta={x:a.deltaX||0,y:a.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function wv(e,t,n){return{x:t/e||0,y:n/e||0}}function Tv(e,t){return bv(t[0],t[1],dv)/bv(e[0],e[1],dv)}function Ev(e,t){return xv(t[1],t[0],dv)+xv(e[1],e[0],dv)}function Dv(e,t){var n=e.lastInterval||t,r=t.timeStamp-n.timeStamp,i,a,o,s;if(t.eventType!==tv&&(r>Z_||n.velocity===void 0)){var c=t.deltaX-n.deltaX,l=t.deltaY-n.deltaY,u=wv(r,c,l);a=u.x,o=u.y,i=k_(u.x)>k_(u.y)?u.x:u.y,s=Sv(c,l),e.lastInterval=t}else i=n.velocity,a=n.velocityX,o=n.velocityY,s=n.direction;t.velocity=i,t.velocityX=a,t.velocityY=o,t.direction=s}function Ov(e,t){var n=e.session,r=t.pointers,i=r.length;n.firstInput||=yv(t),i>1&&!n.firstMultiple?n.firstMultiple=yv(t):i===1&&(n.firstMultiple=!1);var a=n.firstInput,o=n.firstMultiple,s=o?o.center:a.center,c=t.center=vv(r);t.timeStamp=A_(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=xv(s,c),t.distance=bv(s,c),Cv(n,t),t.offsetDirection=Sv(t.deltaX,t.deltaY);var l=wv(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=l.x,t.overallVelocityY=l.y,t.overallVelocity=k_(l.x)>k_(l.y)?l.x:l.y,t.scale=o?Tv(o.pointers,r):1,t.rotation=o?Ev(o.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,Dv(n,t);var u=e.element,d=t.srcEvent,f=d.composedPath?d.composedPath()[0]:d.path?d.path[0]:d.target;_v(f,u)&&(u=f),t.target=u}function kv(e,t,n){var r=n.pointers.length,i=n.changedPointers.length,a=t&Q_&&r-i===0,o=t&(ev|tv)&&r-i===0;n.isFirst=!!a,n.isFinal=!!o,a&&(e.session={}),n.eventType=t,Ov(e,n),e.emit(`hammer.input`,n),e.recognize(n),e.session.prevInput=n}function Av(e){return e.trim().split(/\s+/g)}function jv(e,t,n){fv(Av(t),function(t){e.addEventListener(t,n,!1)})}function U(e,t,n){fv(Av(t),function(t){e.removeEventListener(t,n,!1)})}function Mv(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||window}var Nv=function(){function e(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){pv(e.options.enable,[e])&&n.handler(t)},this.init()}var t=e.prototype;return t.handler=function(){},t.init=function(){this.evEl&&jv(this.element,this.evEl,this.domHandler),this.evTarget&&jv(this.target,this.evTarget,this.domHandler),this.evWin&&jv(Mv(this.element),this.evWin,this.domHandler)},t.destroy=function(){this.evEl&&U(this.element,this.evEl,this.domHandler),this.evTarget&&U(this.target,this.evTarget,this.domHandler),this.evWin&&U(Mv(this.element),this.evWin,this.domHandler)},e}();function Pv(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}var Fv={pointerdown:Q_,pointermove:$_,pointerup:ev,pointercancel:tv,pointerout:tv},Iv={2:q_,3:J_,4:Y_,5:X_},Lv=`pointerdown`,Rv=`pointermove pointerup pointercancel`;M_.MSPointerEvent&&!M_.PointerEvent&&(Lv=`MSPointerDown`,Rv=`MSPointerMove MSPointerUp MSPointerCancel`);var zv=function(e){S_(t,e);function t(){var n,r=t.prototype;return r.evEl=Lv,r.evWin=Rv,n=e.apply(this,arguments)||this,n.store=n.manager.session.pointerEvents=[],n}var n=t.prototype;return n.handler=function(e){var t=this.store,n=!1,r=Fv[e.type.toLowerCase().replace(`ms`,``)],i=Iv[e.pointerType]||e.pointerType,a=i===q_,o=Pv(t,e.pointerId,`pointerId`);r&Q_&&(e.button===0||a)?o<0&&(t.push(e),o=t.length-1):r&(ev|tv)&&(n=!0),!(o<0)&&(t[o]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:i,srcEvent:e}),n&&t.splice(o,1))},t}(Nv);function Bv(e){return Array.prototype.slice.call(e,0)}function Vv(e,t,n){for(var r=[],i=[],a=0;a<e.length;){var o=t?e[a][t]:e[a];Pv(i,o)<0&&r.push(e[a]),i[a]=o,a++}return n&&(r=t?r.sort(function(e,n){return e[t]>n[t]}):r.sort()),r}var Hv={touchstart:Q_,touchmove:$_,touchend:ev,touchcancel:tv},Uv=`touchstart touchmove touchend touchcancel`,Wv=function(e){S_(t,e);function t(){var n;return t.prototype.evTarget=Uv,n=e.apply(this,arguments)||this,n.targetIds={},n}var n=t.prototype;return n.handler=function(e){var t=Hv[e.type],n=Gv.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:q_,srcEvent:e})},t}(Nv);function Gv(e,t){var n=Bv(e.touches),r=this.targetIds;if(t&(Q_|$_)&&n.length===1)return r[n[0].identifier]=!0,[n,n];var i,a,o=Bv(e.changedTouches),s=[],c=this.target;if(a=n.filter(function(e){return _v(e.target,c)}),t===Q_)for(i=0;i<a.length;)r[a[i].identifier]=!0,i++;for(i=0;i<o.length;)r[o[i].identifier]&&s.push(o[i]),t&(ev|tv)&&delete r[o[i].identifier],i++;if(s.length)return[Vv(a.concat(s),`identifier`,!0),s]}var Kv={mousedown:Q_,mousemove:$_,mouseup:ev},qv=`mousedown`,Jv=`mousemove mouseup`,Yv=function(e){S_(t,e);function t(){var n,r=t.prototype;return r.evEl=qv,r.evWin=Jv,n=e.apply(this,arguments)||this,n.pressed=!1,n}var n=t.prototype;return n.handler=function(e){var t=Kv[e.type];t&Q_&&e.button===0&&(this.pressed=!0),t&$_&&e.which!==1&&(t=ev),this.pressed&&(t&ev&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:Y_,srcEvent:e}))},t}(Nv),Xv=2500,Zv=25;function Qv(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY},r=this.lastTouches;this.lastTouches.push(n),setTimeout(function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)},Xv)}}function $v(e,t){e&Q_?(this.primaryTouch=t.changedPointers[0].identifier,Qv.call(this,t)):e&(ev|tv)&&Qv.call(this,t)}function ey(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var i=this.lastTouches[r],a=Math.abs(t-i.x),o=Math.abs(n-i.y);if(a<=Zv&&o<=Zv)return!0}return!1}var ty=function(){return function(e){S_(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.handler=function(e,t,n){var i=n.pointerType===q_,a=n.pointerType===Y_;if(!(a&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)$v.call(C_(C_(r)),t,n);else if(a&&ey.call(C_(C_(r)),n))return;r.callback(e,t,n)}},r.touch=new Wv(r.manager,r.handler),r.mouse=new Yv(r.manager,r.handler),r.primaryTouch=null,r.lastTouches=[],r}var n=t.prototype;return n.destroy=function(){this.touch.destroy(),this.mouse.destroy()},t}(Nv)}();function ny(e){var t;return t=e.options.inputClass||(G_?zv:K_?Wv:W_?ty:Yv),new t(e,kv)}function ry(e,t,n){return Array.isArray(e)?(fv(e,n[t],n),!0):!1}var iy=1,ay=2,oy=4,sy=8,cy=sy,ly=16,uy=32,dy=1;function fy(){return dy++}function W(e,t){var n=t.manager;return n?n.get(e):e}function G(e){return e&ly?`cancel`:e&sy?`end`:e&oy?`move`:e&ay?`start`:``}var py=function(){function e(e){e===void 0&&(e={}),this.options=x_({enable:!0},e),this.id=fy(),this.manager=null,this.state=iy,this.simultaneous={},this.requireFail=[]}var t=e.prototype;return t.set=function(e){return w_(this.options,e),this.manager&&this.manager.touchAction.update(),this},t.recognizeWith=function(e){if(ry(e,`recognizeWith`,this))return this;var t=this.simultaneous;return e=W(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},t.dropRecognizeWith=function(e){return ry(e,`dropRecognizeWith`,this)?this:(e=W(e,this),delete this.simultaneous[e.id],this)},t.requireFailure=function(e){if(ry(e,`requireFailure`,this))return this;var t=this.requireFail;return e=W(e,this),Pv(t,e)===-1&&(t.push(e),e.requireFailure(this)),this},t.dropRequireFailure=function(e){if(ry(e,`dropRequireFailure`,this))return this;e=W(e,this);var t=Pv(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},t.hasRequireFailures=function(){return this.requireFail.length>0},t.canRecognizeWith=function(e){return!!this.simultaneous[e.id]},t.emit=function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<sy&&r(t.options.event+G(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=sy&&r(t.options.event+G(n))},t.tryEmit=function(e){if(this.canEmit())return this.emit(e);this.state=uy},t.canEmit=function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(uy|iy)))return!1;e++}return!0},t.recognize=function(e){var t=w_({},e);if(!pv(this.options.enable,[this,t])){this.reset(),this.state=uy;return}this.state&(cy|ly|uy)&&(this.state=iy),this.state=this.process(t),this.state&(ay|oy|sy|ly)&&this.tryEmit(t)},t.process=function(e){},t.getTouchAction=function(){},t.reset=function(){},e}(),my=function(e){S_(t,e);function t(t){var n;return t===void 0&&(t={}),n=e.call(this,x_({event:`tap`,pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},t))||this,n.pTime=!1,n.pCenter=!1,n._timer=null,n._input=null,n.count=0,n}var n=t.prototype;return n.getTouchAction=function(){return[R_]},n.process=function(e){var t=this,n=this.options,r=e.pointers.length===n.pointers,i=e.distance<n.threshold,a=e.deltaTime<n.time;if(this.reset(),e.eventType&Q_&&this.count===0)return this.failTimeout();if(i&&a&&r){if(e.eventType!==ev)return this.failTimeout();var o=this.pTime?e.timeStamp-this.pTime<n.interval:!0,s=!this.pCenter||bv(this.pCenter,e.center)<n.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!s||!o?this.count=1:this.count+=1,this._input=e,this.count%n.taps===0)return this.hasRequireFailures()?(this._timer=setTimeout(function(){t.state=cy,t.tryEmit()},n.interval),ay):cy}return uy},n.failTimeout=function(){var e=this;return this._timer=setTimeout(function(){e.state=uy},this.options.interval),uy},n.reset=function(){clearTimeout(this._timer)},n.emit=function(){this.state===cy&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))},t}(py),hy=function(e){S_(t,e);function t(t){return t===void 0&&(t={}),e.call(this,x_({pointers:1},t))||this}var n=t.prototype;return n.attrTest=function(e){var t=this.options.pointers;return t===0||e.pointers.length===t},n.process=function(e){var t=this.state,n=e.eventType,r=t&(ay|oy),i=this.attrTest(e);return r&&(n&tv||!i)?t|ly:r||i?n&ev?t|sy:t&ay?t|oy:ay:uy},t}(py);function gy(e){return e===ov?`down`:e===av?`up`:e===rv?`left`:e===iv?`right`:``}var _y=function(e){S_(t,e);function t(t){var n;return t===void 0&&(t={}),n=e.call(this,x_({event:`pan`,threshold:10,pointers:1,direction:lv},t))||this,n.pX=null,n.pY=null,n}var n=t.prototype;return n.getTouchAction=function(){var e=this.options.direction,t=[];return e&sv&&t.push(V_),e&cv&&t.push(B_),t},n.directionTest=function(e){var t=this.options,n=!0,r=e.distance,i=e.direction,a=e.deltaX,o=e.deltaY;return i&t.direction||(t.direction&sv?(i=a===0?nv:a<0?rv:iv,n=a!==this.pX,r=Math.abs(e.deltaX)):(i=o===0?nv:o<0?av:ov,n=o!==this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},n.attrTest=function(e){return hy.prototype.attrTest.call(this,e)&&(this.state&ay||!(this.state&ay)&&this.directionTest(e))},n.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var n=gy(t.direction);n&&(t.additionalEvent=this.options.event+n),e.prototype.emit.call(this,t)},t}(hy),vy=function(e){S_(t,e);function t(t){return t===void 0&&(t={}),e.call(this,x_({event:`swipe`,threshold:10,velocity:.3,direction:sv|cv,pointers:1},t))||this}var n=t.prototype;return n.getTouchAction=function(){return _y.prototype.getTouchAction.call(this)},n.attrTest=function(t){var n=this.options.direction,r;return n&(sv|cv)?r=t.overallVelocity:n&sv?r=t.overallVelocityX:n&cv&&(r=t.overallVelocityY),e.prototype.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers===this.options.pointers&&k_(r)>this.options.velocity&&t.eventType&ev},n.emit=function(e){var t=gy(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)},t}(hy),yy=function(e){S_(t,e);function t(t){return t===void 0&&(t={}),e.call(this,x_({event:`pinch`,threshold:0,pointers:2},t))||this}var n=t.prototype;return n.getTouchAction=function(){return[z_]},n.attrTest=function(t){return e.prototype.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&ay)},n.emit=function(t){if(t.scale!==1){var n=t.scale<1?`in`:`out`;t.additionalEvent=this.options.event+n}e.prototype.emit.call(this,t)},t}(hy),by=function(e){S_(t,e);function t(t){return t===void 0&&(t={}),e.call(this,x_({event:`rotate`,threshold:0,pointers:2},t))||this}var n=t.prototype;return n.getTouchAction=function(){return[z_]},n.attrTest=function(t){return e.prototype.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&ay)},t}(hy),xy=function(e){S_(t,e);function t(t){var n;return t===void 0&&(t={}),n=e.call(this,x_({event:`press`,pointers:1,time:251,threshold:9},t))||this,n._timer=null,n._input=null,n}var n=t.prototype;return n.getTouchAction=function(){return[L_]},n.process=function(e){var t=this,n=this.options,r=e.pointers.length===n.pointers,i=e.distance<n.threshold,a=e.deltaTime>n.time;if(this._input=e,!i||!r||e.eventType&(ev|tv)&&!a)this.reset();else if(e.eventType&Q_)this.reset(),this._timer=setTimeout(function(){t.state=cy,t.tryEmit()},n.time);else if(e.eventType&ev)return cy;return uy},n.reset=function(){clearTimeout(this._timer)},n.emit=function(e){this.state===cy&&(e&&e.eventType&ev?this.manager.emit(this.options.event+`up`,e):(this._input.timeStamp=A_(),this.manager.emit(this.options.event,this._input)))},t}(py),Sy={domEvents:!1,touchAction:I_,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:`none`,touchSelect:`none`,touchCallout:`none`,contentZooming:`none`,userDrag:`none`,tapHighlightColor:`rgba(0,0,0,0)`}},Cy=[[by,{enable:!1}],[yy,{enable:!1},[`rotate`]],[vy,{direction:sv}],[_y,{direction:sv},[`swipe`]],[my],[my,{event:`doubletap`,taps:2},[`tap`]],[xy]],wy=1,Ty=2;function Ey(e,t){var n=e.element;if(n.style){var r;fv(e.options.cssProps,function(i,a){r=j_(n.style,a),t?(e.oldCssProps[r]=n.style[r],n.style[r]=i):n.style[r]=e.oldCssProps[r]||``}),t||(e.oldCssProps={})}}function Dy(e,t){var n=document.createEvent(`Event`);n.initEvent(e,!0,!0),n.gesture=t,t.target.dispatchEvent(n)}var Oy=function(){function e(e,t){var n=this;this.options=w_({},Sy,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=ny(this),this.touchAction=new gv(this,this.options.touchAction),Ey(this,!0),fv(this.options.recognizers,function(e){var t=n.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}var t=e.prototype;return t.set=function(e){return w_(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},t.stop=function(e){this.session.stopped=e?Ty:wy},t.recognize=function(e){var t=this.session;if(!t.stopped){this.touchAction.preventDefaults(e);var n,r=this.recognizers,i=t.curRecognizer;(!i||i&&i.state&cy)&&(t.curRecognizer=null,i=null);for(var a=0;a<r.length;)n=r[a],t.stopped!==Ty&&(!i||n===i||n.canRecognizeWith(i))?n.recognize(e):n.reset(),!i&&n.state&(ay|oy|sy)&&(t.curRecognizer=n,i=n),a++}},t.get=function(e){if(e instanceof py)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event===e)return t[n];return null},t.add=function(e){if(ry(e,`add`,this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},t.remove=function(e){if(ry(e,`remove`,this))return this;var t=this.get(e);if(e){var n=this.recognizers,r=Pv(n,t);r!==-1&&(n.splice(r,1),this.touchAction.update())}return this},t.on=function(e,t){if(e===void 0||t===void 0)return this;var n=this.handlers;return fv(Av(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this},t.off=function(e,t){if(e===void 0)return this;var n=this.handlers;return fv(Av(e),function(e){t?n[e]&&n[e].splice(Pv(n[e],t),1):delete n[e]}),this},t.emit=function(e,t){this.options.domEvents&&Dy(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(!(!n||!n.length)){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},t.destroy=function(){this.element&&Ey(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null},e}(),ky={touchstart:Q_,touchmove:$_,touchend:ev,touchcancel:tv},Ay=`touchstart`,jy=`touchstart touchmove touchend touchcancel`,My=function(e){S_(t,e);function t(){var n,r=t.prototype;return r.evTarget=Ay,r.evWin=jy,n=e.apply(this,arguments)||this,n.started=!1,n}var n=t.prototype;return n.handler=function(e){var t=ky[e.type];if(t===Q_&&(this.started=!0),this.started){var n=Ny.call(this,e,t);t&(ev|tv)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:q_,srcEvent:e})}},t}(Nv);function Ny(e,t){var n=Bv(e.touches),r=Bv(e.changedTouches);return t&(ev|tv)&&(n=Vv(n.concat(r),`identifier`,!0)),[n,r]}function Py(e,t,n){var r=`DEPRECATED METHOD: `+t+`
|
|
4
4
|
`+n+` AT
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Data — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/data-
|
|
8
|
+
<script type="module" crossorigin src="/assets/data-BGbQyufe.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-DD-I1_y5.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/ChatInput-CJo_77bp.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/graph-labels-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/graph-labels-BRXJHNYE.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/page-B4oirCvn.js">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="/assets/ChatInput-CJ50oqWt.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Graph — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/graph-
|
|
8
|
+
<script type="module" crossorigin src="/assets/graph-D-1lRTeL.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-DD-I1_y5.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/ChatInput-CJo_77bp.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/graph-labels-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/graph-labels-BRXJHNYE.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/Checkbox-YrQovXpN.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/page-FmJ7PIYx.js">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="/assets/ChatInput-CJ50oqWt.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/admin-
|
|
8
|
+
<script type="module" crossorigin src="/assets/admin-D6IfAzYY.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-DD-I1_y5.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/ChatInput-CJo_77bp.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/graph-labels-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/graph-labels-BRXJHNYE.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/lib-Bnh57com.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/Checkbox-YrQovXpN.js">
|
|
14
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
14
|
+
<link rel="modulepreload" crossorigin href="/assets/page-B4oirCvn.js">
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/page-FmJ7PIYx.js">
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/ChatInput-CJ50oqWt.css">
|
|
17
17
|
<link rel="stylesheet" crossorigin href="/assets/admin-CWMpccrR.css">
|
|
18
18
|
<link rel="stylesheet" href="/brand-defaults.css">
|
package/payload/server/server.js
CHANGED
|
@@ -9947,6 +9947,15 @@ var GRAPH_LABEL_COLOURS = {
|
|
|
9947
9947
|
Service: "#6B85A0",
|
|
9948
9948
|
PriceSpecification: "#8AA0B8",
|
|
9949
9949
|
OpeningHoursSpecification: "#A8BACE",
|
|
9950
|
+
// Estate-agent ontology (Task 358). :Listing and :Property
|
|
9951
|
+
// share the business slate-blue family (they describe a business's
|
|
9952
|
+
// inventory). :Viewing and :Offer are transactional events — placed in
|
|
9953
|
+
// a warm amber family distinct from Agent (#B8893D) and the dusty-rose
|
|
9954
|
+
// Task/Project/Event hues so the legend reads them as a separate band.
|
|
9955
|
+
Listing: "#3F5670",
|
|
9956
|
+
Property: "#5C7A99",
|
|
9957
|
+
Viewing: "#D4A574",
|
|
9958
|
+
Offer: "#B08850",
|
|
9950
9959
|
// External business entity — schema:Organization, written by memory-write
|
|
9951
9960
|
// as the Supplier label (per platform/plugins/memory/references/schema-base.md).
|
|
9952
9961
|
// Warm tobacco — distinct hue from internal-business slates so external
|
|
@@ -10046,6 +10055,10 @@ var FILTER_TOP_LEVEL_LABELS = Object.freeze(
|
|
|
10046
10055
|
"DefinedTerm",
|
|
10047
10056
|
"Review",
|
|
10048
10057
|
"ImageObject",
|
|
10058
|
+
"Listing",
|
|
10059
|
+
"Property",
|
|
10060
|
+
"Viewing",
|
|
10061
|
+
"Offer",
|
|
10049
10062
|
"AdminConversation",
|
|
10050
10063
|
"PublicConversation",
|
|
10051
10064
|
"Task",
|