local-operator-ui 0.1.2-beta.8 → 0.1.2

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.
@@ -1,4 +1,4 @@
1
- import { c as createStyled, r as resolveProps, u as useTheme, a as reactExports, b as clsx, d as useForkRef, j as jsxRuntimeExports, e as capitalize, f as composeClasses, g as createTheme, h as generateUtilityClass, i as generateUtilityClasses, k as useDefaultProps, s as styled$1, m as memoTheme, l as getDefaultExportFromCjs, n as requireReactDom, _ as _inheritsLoose, o as _objectWithoutPropertiesLoose$1, R as React, T as TransitionGroupContext, p as duration, q as useTheme$1, t as useTimeout, v as useId, B as ButtonBase, w as alpha, x as createSimplePaletteValueFilter, C as CircularProgress, P as Paper, y as darken, z as lighten, A as useEventCallback, D as setRef, E as useEnhancedEffect, F as useRtl, G as globalCss, H as formatMuiErrorMessage, I as rootShouldForwardProp, J as Typography, K as deepmerge, L as extendSxProp, M as resolveBreakpointValues, N as handleBreakpoints, O as getPath, Q as isFocusVisible, S as typographyClasses, U as slotShouldForwardProp, V as clamp, W as emphasize, X as Timeout, Y as React$1, Z as Box, $ as FontAwesomeIcon, a0 as faRobot, a1 as faSliders, a2 as Button, a3 as faExclamationTriangle, a4 as faCheck, a5 as faTimes, a6 as faEraser, a7 as faPen, a8 as faInfoCircle, a9 as faGear, aa as faServer, ab as faStar, ac as faTrash, ad as faCommentDots, ae as faCode, af as faHome, ag as faDownload, ah as faFileAlt, ai as faDesktop, aj as faImage, ak as faMusic, al as faVideo, am as faLaptop, an as faUsers, ao as faDatabase, ap as faBoxOpen, aq as faBook, ar as faHdd, as as faBox, at as faArchive, au as faNetworkWired, av as faFolder, aw as faFolderOpen, ax as faClock, ay as faChevronDown, az as faTools, aA as faArrowDown, aB as faPaperclip, aC as faStop, aD as faPaperPlane, aE as faUser, aF as faFile, aG as faEllipsisVertical, aH as faComment, aI as faChevronLeft, aJ as faChevronRight, aK as faPlus, aL as faSearch, aM as faCommentSlash, aN as faArrowRight, aO as faComments, aP as faTag, aQ as faIdCard, aR as faCalendarAlt, aS as faCodeBranch, aT as faShieldAlt, aU as faArrowLeft, aV as LinearProgress, aW as keyframes, aX as faShield, aY as faSignOut, aZ as faLightbulb, a_ as faMagicWandSparkles, a$ as faBrain, b0 as faWandMagicSparkles, b1 as faExternalLinkAlt, b2 as faKey, b3 as faGlobe, b4 as faLock, b5 as faEdit, b6 as faSave, b7 as faEnvelope, b8 as faCloudUploadAlt, b9 as faHistory, ba as faListAlt, bb as library$1, bc as icons$1, bd as CssBaseline, be as ReactDOM$1, bf as ThemeProvider, bg as theme, bh as ErrorBoundary } from "./theme-C9zRS1f0.js";
1
+ import { c as createStyled, r as resolveProps, u as useTheme, a as reactExports, b as clsx, d as useForkRef, j as jsxRuntimeExports, e as capitalize, f as composeClasses, g as createTheme, h as generateUtilityClass, i as generateUtilityClasses, k as useDefaultProps, s as styled$1, m as memoTheme, l as getDefaultExportFromCjs, n as requireReactDom, _ as _inheritsLoose, o as _objectWithoutPropertiesLoose$1, R as React, T as TransitionGroupContext, p as duration, q as useTheme$1, t as useTimeout, v as useId, B as ButtonBase, w as alpha, x as createSimplePaletteValueFilter, C as CircularProgress, P as Paper, y as darken, z as lighten, A as useEventCallback, D as setRef, E as useEnhancedEffect, F as useRtl, G as globalCss, H as formatMuiErrorMessage, I as rootShouldForwardProp, J as Typography, K as deepmerge, L as extendSxProp, M as resolveBreakpointValues, N as handleBreakpoints, O as getPath, Q as isFocusVisible, S as typographyClasses, U as slotShouldForwardProp, V as clamp, W as emphasize, X as Timeout, Y as React$1, Z as Box, $ as FontAwesomeIcon, a0 as faRobot, a1 as faSliders, a2 as Button, a3 as faExclamationTriangle, a4 as faCheck, a5 as faTimes, a6 as faEraser, a7 as faPen, a8 as faInfoCircle, a9 as faGear, aa as faServer, ab as faStar, ac as faTrash, ad as faCommentDots, ae as faCode, af as faHome, ag as faDownload, ah as faFileAlt, ai as faDesktop, aj as faImage, ak as faMusic, al as faVideo, am as faLaptop, an as faUsers, ao as faDatabase, ap as faBoxOpen, aq as faBook, ar as faHdd, as as faBox, at as faArchive, au as faNetworkWired, av as faFolder, aw as faFolderOpen, ax as faClock, ay as faChevronDown, az as faTools, aA as faArrowDown, aB as faPaperclip, aC as faStop, aD as faPaperPlane, aE as faUser, aF as faFile, aG as faEllipsisVertical, aH as faComment, aI as faChevronLeft, aJ as faChevronRight, aK as faPlus, aL as faSearch, aM as faCommentSlash, aN as faArrowRight, aO as faComments, aP as faTag, aQ as faIdCard, aR as faCalendarAlt, aS as faCodeBranch, aT as faShieldAlt, aU as faArrowLeft, aV as requireReact, aW as LinearProgress, aX as keyframes, aY as faShield, aZ as faSignOut, a_ as faLightbulb, a$ as faMagicWandSparkles, b0 as faBrain, b1 as faWandMagicSparkles, b2 as faExternalLinkAlt, b3 as faKey, b4 as faGlobe, b5 as faLock, b6 as faEdit, b7 as faSave, b8 as faEnvelope, b9 as faCloudUploadAlt, ba as faHistory, bb as faListAlt, bc as library$1, bd as icons$1, be as CssBaseline, bf as ReactDOM$1, bg as ThemeProvider, bh as theme, bi as ErrorBoundary } from "./theme-D7qnOAQJ.js";
2
2
  const styled = createStyled();
3
3
  function getThemeProps(params) {
4
4
  const {
@@ -22178,7 +22178,10 @@ const queryClient = new QueryClient({
22178
22178
  // Default refetch configuration
22179
22179
  refetchOnWindowFocus: true,
22180
22180
  refetchOnMount: true,
22181
- refetchOnReconnect: true
22181
+ // Don't wait for reconnect to refetch - we handle offline status separately
22182
+ refetchOnReconnect: false,
22183
+ // Continue to run queries even when offline
22184
+ networkMode: "always"
22182
22185
  }
22183
22186
  }
22184
22187
  });
@@ -30047,9 +30050,279 @@ const config = loadConfig();
30047
30050
  const apiConfig = {
30048
30051
  baseUrl: config.VITE_LOCAL_OPERATOR_API_URL
30049
30052
  };
30053
+ const activeToasts = /* @__PURE__ */ new Map();
30054
+ const lastErrorShownTime = /* @__PURE__ */ new Map();
30055
+ const errorCountInPeriod = /* @__PURE__ */ new Map();
30056
+ const DEFAULT_ERROR_COOLDOWN = 5e3;
30057
+ const MAX_SIMILAR_ERRORS = 1;
30058
+ const ERROR_GROUPS = {
30059
+ CONNECTION: [
30060
+ "Failed to fetch",
30061
+ "Network error",
30062
+ "ERR_CONNECTION_REFUSED",
30063
+ "Server is offline",
30064
+ "Connection failed"
30065
+ ]
30066
+ // Add other error groups as needed
30067
+ };
30068
+ const getErrorGroup = (message2) => {
30069
+ for (const [group, patterns] of Object.entries(ERROR_GROUPS)) {
30070
+ if (patterns.some((pattern) => message2.includes(pattern))) {
30071
+ return group;
30072
+ }
30073
+ }
30074
+ return null;
30075
+ };
30076
+ const showErrorToast = (message2, options) => {
30077
+ const now = Date.now();
30078
+ const errorGroup = getErrorGroup(message2);
30079
+ const key = errorGroup || message2;
30080
+ const lastShown = lastErrorShownTime.get(key);
30081
+ if (lastShown && now - lastShown < DEFAULT_ERROR_COOLDOWN) {
30082
+ return null;
30083
+ }
30084
+ const errorCount = errorCountInPeriod.get(key) || 0;
30085
+ if (errorCount >= MAX_SIMILAR_ERRORS) {
30086
+ return null;
30087
+ }
30088
+ if (activeToasts.has(key)) {
30089
+ lastErrorShownTime.set(key, now);
30090
+ return activeToasts.get(key);
30091
+ }
30092
+ const id = y$1.error(message2, {
30093
+ ...options,
30094
+ onClose: () => {
30095
+ activeToasts.delete(key);
30096
+ }
30097
+ });
30098
+ activeToasts.set(key, id);
30099
+ lastErrorShownTime.set(key, now);
30100
+ errorCountInPeriod.set(key, errorCount + 1);
30101
+ setTimeout(() => {
30102
+ errorCountInPeriod.set(key, 0);
30103
+ }, DEFAULT_ERROR_COOLDOWN);
30104
+ return id;
30105
+ };
30106
+ const configQueryKey = ["config"];
30107
+ const useConfig = () => {
30108
+ return useQuery({
30109
+ // Always enable this query since it's needed for connectivity checks
30110
+ enabled: true,
30111
+ queryKey: configQueryKey,
30112
+ queryFn: async () => {
30113
+ try {
30114
+ const client = createLocalOperatorClient(apiConfig.baseUrl);
30115
+ const response = await client.config.getConfig();
30116
+ if (response.status >= 400) {
30117
+ throw new Error(response.message || "Failed to fetch configuration");
30118
+ }
30119
+ return response.result;
30120
+ } catch (error) {
30121
+ const errorMessage = error instanceof Error ? error.message : "An unknown error occurred while fetching configuration";
30122
+ showErrorToast(errorMessage);
30123
+ throw error;
30124
+ }
30125
+ },
30126
+ // Prevent automatic refetches on window focus
30127
+ refetchOnWindowFocus: false,
30128
+ // Prevent stale time to avoid unnecessary refetches
30129
+ staleTime: 5e3
30130
+ });
30131
+ };
30132
+ const serverHealthQueryKey = ["server-health"];
30133
+ const internetConnectivityQueryKey = ["internet-connectivity"];
30134
+ const useServerHealth = (refetchInterval = 5e3) => {
30135
+ return useQuery({
30136
+ queryKey: serverHealthQueryKey,
30137
+ queryFn: async () => {
30138
+ try {
30139
+ await HealthApi.healthCheck(apiConfig.baseUrl);
30140
+ return true;
30141
+ } catch (error) {
30142
+ return false;
30143
+ }
30144
+ },
30145
+ // Refetch at specified interval
30146
+ refetchInterval,
30147
+ // Enable background refetching
30148
+ refetchIntervalInBackground: true,
30149
+ // Don't retry on failure as this is expected when server is down
30150
+ retry: false,
30151
+ // Always refetch on window focus to get latest status
30152
+ refetchOnWindowFocus: true,
30153
+ // Use placeholderData instead of keepPreviousData (which is deprecated)
30154
+ placeholderData: (previousData) => previousData
30155
+ });
30156
+ };
30157
+ const useInternetConnectivity = (refetchInterval = 5e3) => {
30158
+ const [isOnlineState, setIsOnlineState] = reactExports.useState(navigator.onLine);
30159
+ reactExports.useEffect(() => {
30160
+ const handleOnline = () => {
30161
+ setIsOnlineState(true);
30162
+ };
30163
+ const handleOffline = () => {
30164
+ setIsOnlineState(false);
30165
+ };
30166
+ window.addEventListener("online", handleOnline);
30167
+ window.addEventListener("offline", handleOffline);
30168
+ return () => {
30169
+ window.removeEventListener("online", handleOnline);
30170
+ window.removeEventListener("offline", handleOffline);
30171
+ };
30172
+ }, []);
30173
+ return useQuery({
30174
+ queryKey: internetConnectivityQueryKey,
30175
+ queryFn: async () => {
30176
+ return isOnlineState && navigator.onLine;
30177
+ },
30178
+ // Refetch at specified interval
30179
+ refetchInterval,
30180
+ // Enable background refetching
30181
+ refetchIntervalInBackground: true,
30182
+ // Don't retry on failure as this is expected when internet is down
30183
+ retry: false,
30184
+ // Always refetch on window focus to get latest status
30185
+ refetchOnWindowFocus: true,
30186
+ // Use placeholderData instead of keepPreviousData (which is deprecated)
30187
+ placeholderData: (previousData) => previousData
30188
+ });
30189
+ };
30190
+ const useConnectivityStatus = (serverRefetchInterval = 5e3) => {
30191
+ const {
30192
+ data: isServerOnline = true,
30193
+ // Default to true to avoid false positives on initial load
30194
+ isLoading: isServerStatusLoading,
30195
+ refetch: refetchServerStatus
30196
+ } = useServerHealth(serverRefetchInterval);
30197
+ const { data: config2, isLoading: isConfigLoading } = useConfig();
30198
+ const hostingProvider = config2?.values.hosting || "";
30199
+ const shouldCheckInternet = hostingProvider.toLowerCase() !== "ollama";
30200
+ const {
30201
+ data: isOnline = true,
30202
+ // Default to true to avoid false positives on initial load
30203
+ isLoading: isInternetStatusLoading,
30204
+ refetch: refetchInternetStatus
30205
+ } = useInternetConnectivity(serverRefetchInterval);
30206
+ reactExports.useEffect(() => {
30207
+ const handleOnline = () => {
30208
+ refetchInternetStatus();
30209
+ };
30210
+ const handleOffline = () => {
30211
+ refetchInternetStatus();
30212
+ };
30213
+ window.addEventListener("online", handleOnline);
30214
+ window.addEventListener("offline", handleOffline);
30215
+ return () => {
30216
+ window.removeEventListener("online", handleOnline);
30217
+ window.removeEventListener("offline", handleOffline);
30218
+ };
30219
+ }, [refetchInternetStatus]);
30220
+ const hasConnectivityIssue = !isServerOnline || shouldCheckInternet && !isOnline;
30221
+ const connectivityIssue = !isServerOnline ? "server_offline" : shouldCheckInternet && !isOnline ? "internet_offline" : null;
30222
+ return {
30223
+ isServerOnline,
30224
+ isOnline,
30225
+ hostingProvider,
30226
+ shouldCheckInternet,
30227
+ hasConnectivityIssue,
30228
+ connectivityIssue,
30229
+ isLoading: isServerStatusLoading || shouldCheckInternet && isInternetStatusLoading || isConfigLoading,
30230
+ refetchServerStatus,
30231
+ refetchInternetStatus
30232
+ };
30233
+ };
30234
+ const useConnectivityGate = () => {
30235
+ const {
30236
+ isServerOnline,
30237
+ isOnline,
30238
+ hostingProvider,
30239
+ shouldCheckInternet,
30240
+ hasConnectivityIssue,
30241
+ connectivityIssue,
30242
+ isLoading,
30243
+ refetchInternetStatus
30244
+ } = useConnectivityStatus();
30245
+ const queryClient2 = useQueryClient();
30246
+ reactExports.useEffect(() => {
30247
+ const handleOnline = () => {
30248
+ refetchInternetStatus();
30249
+ queryClient2.invalidateQueries({
30250
+ // Force refetch to ensure queries are updated with new connectivity status
30251
+ refetchType: "all"
30252
+ });
30253
+ };
30254
+ const handleOffline = () => {
30255
+ refetchInternetStatus();
30256
+ queryClient2.invalidateQueries({
30257
+ predicate: (query) => {
30258
+ const queryKey = query.queryKey[0];
30259
+ return queryKey !== "server-health" && queryKey !== "internet-connectivity" && queryKey !== "config";
30260
+ },
30261
+ // Force refetch to ensure queries are updated with new connectivity status
30262
+ refetchType: "active"
30263
+ });
30264
+ };
30265
+ window.addEventListener("online", handleOnline);
30266
+ window.addEventListener("offline", handleOffline);
30267
+ return () => {
30268
+ window.removeEventListener("online", handleOnline);
30269
+ window.removeEventListener("offline", handleOffline);
30270
+ };
30271
+ }, [refetchInternetStatus, queryClient2]);
30272
+ reactExports.useEffect(() => {
30273
+ if (!isLoading && !isServerOnline) {
30274
+ queryClient2.invalidateQueries({
30275
+ predicate: (query) => {
30276
+ const queryKey = query.queryKey[0];
30277
+ return queryKey !== "server-health" && queryKey !== "internet-connectivity" && queryKey !== "config";
30278
+ },
30279
+ // Force refetch to ensure queries are updated with new connectivity status
30280
+ refetchType: "active"
30281
+ });
30282
+ }
30283
+ }, [isServerOnline, isLoading, queryClient2]);
30284
+ const shouldEnableQuery = (options) => {
30285
+ if (isLoading) {
30286
+ return false;
30287
+ }
30288
+ if (!options?.bypassServerCheck && !isServerOnline) {
30289
+ return false;
30290
+ }
30291
+ return true;
30292
+ };
30293
+ const getConnectivityError = () => {
30294
+ if (isLoading) {
30295
+ return null;
30296
+ }
30297
+ if (!isServerOnline) {
30298
+ return new Error("Server is offline. Please check your connection.");
30299
+ }
30300
+ return null;
30301
+ };
30302
+ return {
30303
+ shouldEnableQuery,
30304
+ getConnectivityError,
30305
+ isServerOnline,
30306
+ isOnline,
30307
+ hostingProvider,
30308
+ shouldCheckInternet,
30309
+ hasConnectivityIssue,
30310
+ connectivityIssue,
30311
+ isLoading
30312
+ };
30313
+ };
30050
30314
  const agentsQueryKey = ["agents"];
30051
30315
  const useAgents = (page = 1, perPage = 50, refetchInterval = 0, name2) => {
30316
+ const { shouldEnableQuery, getConnectivityError } = useConnectivityGate();
30317
+ const connectivityError = getConnectivityError();
30318
+ reactExports.useEffect(() => {
30319
+ if (connectivityError) {
30320
+ console.error("Agents connectivity error:", connectivityError.message);
30321
+ }
30322
+ }, [connectivityError]);
30052
30323
  return useQuery({
30324
+ // Only enable the query if server is online (bypass internet check)
30325
+ enabled: shouldEnableQuery({ bypassInternetCheck: true }),
30053
30326
  queryKey: [...agentsQueryKey, page, perPage, name2],
30054
30327
  queryFn: async () => {
30055
30328
  try {
@@ -30061,7 +30334,7 @@ const useAgents = (page = 1, perPage = 50, refetchInterval = 0, name2) => {
30061
30334
  return response.result?.agents || [];
30062
30335
  } catch (error) {
30063
30336
  const errorMessage = error instanceof Error ? error.message : "An unknown error occurred while fetching agents";
30064
- y$1.error(errorMessage);
30337
+ showErrorToast(errorMessage);
30065
30338
  throw error;
30066
30339
  }
30067
30340
  },
@@ -30076,7 +30349,16 @@ const useAgents = (page = 1, perPage = 50, refetchInterval = 0, name2) => {
30076
30349
  });
30077
30350
  };
30078
30351
  const useAgent = (agentId) => {
30352
+ const { shouldEnableQuery, getConnectivityError } = useConnectivityGate();
30353
+ const connectivityError = getConnectivityError();
30354
+ reactExports.useEffect(() => {
30355
+ if (connectivityError) {
30356
+ console.error("Agent connectivity error:", connectivityError.message);
30357
+ }
30358
+ }, [connectivityError]);
30079
30359
  return useQuery({
30360
+ // Only enable the query if server is online and agentId is provided (bypass internet check)
30361
+ enabled: shouldEnableQuery({ bypassInternetCheck: true }) && !!agentId,
30080
30362
  queryKey: [...agentsQueryKey, agentId],
30081
30363
  queryFn: async () => {
30082
30364
  if (!agentId) return null;
@@ -30093,12 +30375,11 @@ const useAgent = (agentId) => {
30093
30375
  const is404Error = error instanceof Error && (error.message.includes("404") || error.message.includes("not found"));
30094
30376
  if (!is404Error) {
30095
30377
  const errorMessage = error instanceof Error ? error.message : `An unknown error occurred while fetching agent ${agentId}`;
30096
- y$1.error(errorMessage);
30378
+ showErrorToast(errorMessage);
30097
30379
  }
30098
30380
  throw error;
30099
30381
  }
30100
- },
30101
- enabled: !!agentId
30382
+ }
30102
30383
  });
30103
30384
  };
30104
30385
  const createStoreImpl = (createState2) => {
@@ -30296,6 +30577,16 @@ const useConversationMessages = (conversationId, pageSize2 = 20) => {
30296
30577
  updateScrollPosition,
30297
30578
  getScrollPosition
30298
30579
  } = useChatStore();
30580
+ const { shouldEnableQuery, getConnectivityError } = useConnectivityGate();
30581
+ const connectivityError = getConnectivityError();
30582
+ reactExports.useEffect(() => {
30583
+ if (connectivityError) {
30584
+ console.error(
30585
+ "Conversation messages connectivity error:",
30586
+ connectivityError.message
30587
+ );
30588
+ }
30589
+ }, [connectivityError]);
30299
30590
  const {
30300
30591
  data,
30301
30592
  fetchNextPage,
@@ -30306,6 +30597,8 @@ const useConversationMessages = (conversationId, pageSize2 = 20) => {
30306
30597
  error,
30307
30598
  refetch
30308
30599
  } = useInfiniteQuery({
30600
+ // Only enable the query if server is online (bypass internet check)
30601
+ enabled: shouldEnableQuery({ bypassInternetCheck: true }) && !!conversationId,
30309
30602
  queryKey: [...conversationMessagesQueryKey, conversationId],
30310
30603
  queryFn: async ({ pageParam }) => {
30311
30604
  try {
@@ -30354,7 +30647,7 @@ const useConversationMessages = (conversationId, pageSize2 = 20) => {
30354
30647
  };
30355
30648
  } catch (error2) {
30356
30649
  const errorMessage = error2 instanceof Error ? error2.message : "An unknown error occurred while fetching conversation messages";
30357
- y$1.error(errorMessage);
30650
+ showErrorToast(errorMessage);
30358
30651
  throw error2;
30359
30652
  }
30360
30653
  },
@@ -30362,9 +30655,7 @@ const useConversationMessages = (conversationId, pageSize2 = 20) => {
30362
30655
  getNextPageParam: (lastPage) => {
30363
30656
  if (!lastPage.hasMore) return void 0;
30364
30657
  return lastPage.page + 1;
30365
- },
30366
- // Only enable the query if we have a conversation ID
30367
- enabled: !!conversationId
30658
+ }
30368
30659
  });
30369
30660
  const handleScroll = reactExports.useCallback(() => {
30370
30661
  if (!messagesContainerRef.current || !conversationId) return;
@@ -30479,9 +30770,20 @@ const useJobPolling = ({
30479
30770
  const lastProcessedJobDataRef = reactExports.useRef(null);
30480
30771
  const client = createLocalOperatorClient(apiConfig.baseUrl);
30481
30772
  const previousConversationIdRef = reactExports.useRef(conversationId);
30773
+ const { shouldEnableQuery, getConnectivityError } = useConnectivityGate();
30482
30774
  const checkForActiveJobs = reactExports.useCallback(
30483
30775
  async (agentId) => {
30484
30776
  if (!agentId) return false;
30777
+ if (!shouldEnableQuery({ bypassInternetCheck: true })) {
30778
+ const error2 = getConnectivityError();
30779
+ if (error2) {
30780
+ console.error(
30781
+ "Cannot check for active jobs due to connectivity issue:",
30782
+ error2.message
30783
+ );
30784
+ }
30785
+ return false;
30786
+ }
30485
30787
  try {
30486
30788
  const pendingResponse = await client.jobs.listJobs(agentId, "pending");
30487
30789
  const processingResponse = await client.jobs.listJobs(
@@ -30509,7 +30811,7 @@ const useJobPolling = ({
30509
30811
  return false;
30510
30812
  }
30511
30813
  },
30512
- [client.jobs, currentJobId]
30814
+ [client.jobs, currentJobId, shouldEnableQuery, getConnectivityError]
30513
30815
  );
30514
30816
  reactExports.useEffect(() => {
30515
30817
  if (conversationId !== previousConversationIdRef.current) {
@@ -30517,6 +30819,16 @@ const useJobPolling = ({
30517
30819
  setCurrentJobId(null);
30518
30820
  if (conversationId) {
30519
30821
  const checkNewAgentJobs = async () => {
30822
+ if (!shouldEnableQuery({ bypassInternetCheck: true })) {
30823
+ const error2 = getConnectivityError();
30824
+ if (error2) {
30825
+ console.error(
30826
+ "Cannot check for active jobs due to connectivity issue:",
30827
+ error2.message
30828
+ );
30829
+ }
30830
+ return;
30831
+ }
30520
30832
  try {
30521
30833
  const pendingResponse = await client.jobs.listJobs(
30522
30834
  conversationId,
@@ -30546,10 +30858,20 @@ const useJobPolling = ({
30546
30858
  }
30547
30859
  }
30548
30860
  previousConversationIdRef.current = conversationId;
30549
- }, [conversationId, client.jobs]);
30861
+ }, [conversationId, client.jobs, shouldEnableQuery, getConnectivityError]);
30550
30862
  const updateConversationMessages = reactExports.useCallback(
30551
30863
  async (agentId) => {
30552
30864
  if (!agentId) return;
30865
+ if (!shouldEnableQuery({ bypassInternetCheck: true })) {
30866
+ const error2 = getConnectivityError();
30867
+ if (error2) {
30868
+ console.error(
30869
+ "Cannot update conversation messages due to connectivity issue:",
30870
+ error2.message
30871
+ );
30872
+ }
30873
+ return false;
30874
+ }
30553
30875
  try {
30554
30876
  const client2 = createLocalOperatorClient(apiConfig.baseUrl);
30555
30877
  const response = await client2.agents.getAgentExecutionHistory(
@@ -30585,7 +30907,13 @@ const useJobPolling = ({
30585
30907
  return false;
30586
30908
  }
30587
30909
  },
30588
- [getMessages, setMessages, queryClient2]
30910
+ [
30911
+ getMessages,
30912
+ setMessages,
30913
+ queryClient2,
30914
+ shouldEnableQuery,
30915
+ getConnectivityError
30916
+ ]
30589
30917
  );
30590
30918
  const handleJobCompletion = reactExports.useCallback(
30591
30919
  async (job) => {
@@ -30633,8 +30961,8 @@ const useJobPolling = ({
30633
30961
  const response = await client2.jobs.getJobStatus(currentJobId);
30634
30962
  return response.result;
30635
30963
  },
30636
- // Only run the query if we have a job ID
30637
- enabled: !!currentJobId,
30964
+ // Only run the query if we have a job ID and server is online (bypass internet check)
30965
+ enabled: shouldEnableQuery({ bypassInternetCheck: true }) && !!currentJobId,
30638
30966
  // Poll every 1 second while job is active
30639
30967
  refetchInterval: currentJobId ? 1e3 : false,
30640
30968
  // Force refetch on interval regardless of window focus
@@ -32615,7 +32943,19 @@ const getAvailableHostingProviders = (userCredentials) => {
32615
32943
  };
32616
32944
  const credentialsQueryKey = ["credentials"];
32617
32945
  const useCredentials = () => {
32946
+ const { shouldEnableQuery, getConnectivityError } = useConnectivityGate();
32947
+ const connectivityError = getConnectivityError();
32948
+ reactExports.useEffect(() => {
32949
+ if (connectivityError) {
32950
+ console.error(
32951
+ "Credentials connectivity error:",
32952
+ connectivityError.message
32953
+ );
32954
+ }
32955
+ }, [connectivityError]);
32618
32956
  return useQuery({
32957
+ // Only enable the query if server is online (bypass internet check)
32958
+ enabled: shouldEnableQuery({ bypassInternetCheck: true }),
32619
32959
  queryKey: credentialsQueryKey,
32620
32960
  queryFn: async () => {
32621
32961
  try {
@@ -32627,7 +32967,7 @@ const useCredentials = () => {
32627
32967
  return response.result;
32628
32968
  } catch (error) {
32629
32969
  const errorMessage = error instanceof Error ? error.message : "An unknown error occurred while fetching credentials";
32630
- y$1.error(errorMessage);
32970
+ showErrorToast(errorMessage);
32631
32971
  throw error;
32632
32972
  }
32633
32973
  },
@@ -32888,6 +33228,8 @@ const HostingSelect = ({
32888
33228
  };
32889
33229
  const useModels = ({ autoFetch = true } = {}) => {
32890
33230
  const baseUrl = apiConfig.baseUrl;
33231
+ const intervalRef = reactExports.useRef(null);
33232
+ const { shouldEnableQuery, getConnectivityError, hasConnectivityIssue } = useConnectivityGate();
32891
33233
  const {
32892
33234
  providers,
32893
33235
  models,
@@ -32899,20 +33241,43 @@ const useModels = ({ autoFetch = true } = {}) => {
32899
33241
  getModelsForProvider
32900
33242
  } = useModelsStore();
32901
33243
  reactExports.useEffect(() => {
32902
- if (autoFetch) {
33244
+ if (intervalRef.current) {
33245
+ clearInterval(intervalRef.current);
33246
+ intervalRef.current = null;
33247
+ }
33248
+ if (autoFetch && shouldEnableQuery({ bypassInternetCheck: true })) {
32903
33249
  fetchModels(baseUrl);
32904
- const intervalId = setInterval(
33250
+ intervalRef.current = window.setInterval(
32905
33251
  () => {
32906
- fetchModels(baseUrl);
33252
+ if (shouldEnableQuery({ bypassInternetCheck: true })) {
33253
+ fetchModels(baseUrl);
33254
+ }
32907
33255
  },
32908
33256
  15 * 60 * 1e3
32909
33257
  );
32910
- return () => clearInterval(intervalId);
33258
+ return () => {
33259
+ if (intervalRef.current) {
33260
+ clearInterval(intervalRef.current);
33261
+ intervalRef.current = null;
33262
+ }
33263
+ };
32911
33264
  }
32912
33265
  return void 0;
32913
- }, [autoFetch, baseUrl, fetchModels]);
33266
+ }, [autoFetch, baseUrl, fetchModels, shouldEnableQuery]);
33267
+ reactExports.useEffect(() => {
33268
+ if (!hasConnectivityIssue && autoFetch && isInitialized) {
33269
+ fetchModels(baseUrl);
33270
+ }
33271
+ }, [hasConnectivityIssue, autoFetch, isInitialized, baseUrl, fetchModels]);
32914
33272
  const refreshModels = async () => {
32915
- await fetchModels(baseUrl, true);
33273
+ if (shouldEnableQuery({ bypassInternetCheck: true })) {
33274
+ await fetchModels(baseUrl, true);
33275
+ } else {
33276
+ const error2 = getConnectivityError();
33277
+ if (error2) {
33278
+ throw error2;
33279
+ }
33280
+ }
32916
33281
  };
32917
33282
  const getModelById = (modelId) => {
32918
33283
  return models.find((model) => model.id === modelId);
@@ -34333,13 +34698,13 @@ function requireCjs$1() {
34333
34698
  }
34334
34699
  return cjs$1;
34335
34700
  }
34336
- var utilities = {};
34337
- var hasRequiredUtilities;
34338
- function requireUtilities() {
34339
- if (hasRequiredUtilities) return utilities;
34340
- hasRequiredUtilities = 1;
34341
- Object.defineProperty(utilities, "__esModule", { value: true });
34342
- utilities.camelCase = void 0;
34701
+ var utilities$2 = {};
34702
+ var hasRequiredUtilities$2;
34703
+ function requireUtilities$2() {
34704
+ if (hasRequiredUtilities$2) return utilities$2;
34705
+ hasRequiredUtilities$2 = 1;
34706
+ Object.defineProperty(utilities$2, "__esModule", { value: true });
34707
+ utilities$2.camelCase = void 0;
34343
34708
  var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
34344
34709
  var HYPHEN_REGEX = /-([a-z])/g;
34345
34710
  var NO_HYPHEN_REGEX = /^[^-]+$/;
@@ -34369,8 +34734,8 @@ function requireUtilities() {
34369
34734
  }
34370
34735
  return property.replace(HYPHEN_REGEX, capitalize2);
34371
34736
  };
34372
- utilities.camelCase = camelCase;
34373
- return utilities;
34737
+ utilities$2.camelCase = camelCase;
34738
+ return utilities$2;
34374
34739
  }
34375
34740
  var cjs;
34376
34741
  var hasRequiredCjs;
@@ -34381,7 +34746,7 @@ function requireCjs() {
34381
34746
  return mod && mod.__esModule ? mod : { "default": mod };
34382
34747
  };
34383
34748
  var style_to_object_1 = __importDefault(requireCjs$1());
34384
- var utilities_1 = requireUtilities();
34749
+ var utilities_1 = requireUtilities$2();
34385
34750
  function StyleToJS(style, options) {
34386
34751
  var output = {};
34387
34752
  if (!style || typeof style !== "string") {
@@ -34987,7 +35352,7 @@ function toString$1(value, options) {
34987
35352
  return one(value, includeImageAlt, includeHtml);
34988
35353
  }
34989
35354
  function one(value, includeImageAlt, includeHtml) {
34990
- if (node$1(value)) {
35355
+ if (node$2(value)) {
34991
35356
  if ("value" in value) {
34992
35357
  return value.type === "html" && !includeHtml ? "" : value.value;
34993
35358
  }
@@ -35011,7 +35376,7 @@ function all(values, includeImageAlt, includeHtml) {
35011
35376
  }
35012
35377
  return result.join("");
35013
35378
  }
35014
- function node$1(value) {
35379
+ function node$2(value) {
35015
35380
  return Boolean(value && typeof value === "object");
35016
35381
  }
35017
35382
  const element = document.createElement("i");
@@ -38866,7 +39231,7 @@ function serializeChunks(chunks, expandTabs) {
38866
39231
  }
38867
39232
  return result.join("");
38868
39233
  }
38869
- function parse$1(options) {
39234
+ function parse$2(options) {
38870
39235
  const settings = options || {};
38871
39236
  const constructs2 = (
38872
39237
  /** @type {FullNormalizedExtension} */
@@ -38994,7 +39359,7 @@ function fromMarkdown(value, encoding, options) {
38994
39359
  options = encoding;
38995
39360
  encoding = void 0;
38996
39361
  }
38997
- return compiler(options)(postprocess(parse$1(options).document().write(preprocess()(value, encoding, true))));
39362
+ return compiler(options)(postprocess(parse$2(options).document().write(preprocess()(value, encoding, true))));
38998
39363
  }
38999
39364
  function compiler(options) {
39000
39365
  const config2 = {
@@ -80459,11 +80824,11 @@ var length = 0;
80459
80824
  var position = 0;
80460
80825
  var character = 0;
80461
80826
  var characters = "";
80462
- function node(value, root2, parent, type, props, children, length2, siblings) {
80827
+ function node$1(value, root2, parent, type, props, children, length2, siblings) {
80463
80828
  return { value, root: root2, parent, type, props, children, line, column, length: length2, return: "", siblings };
80464
80829
  }
80465
80830
  function copy(root2, props) {
80466
- return assign(node("", null, null, "", null, null, 0, root2.siblings), root2, { length: -root2.length }, props);
80831
+ return assign(node$1("", null, null, "", null, null, 0, root2.siblings), root2, { length: -root2.length }, props);
80467
80832
  }
80468
80833
  function lift(root2) {
80469
80834
  while (root2.root)
@@ -80593,9 +80958,9 @@ function identifier(index2) {
80593
80958
  return slice(index2, position);
80594
80959
  }
80595
80960
  function compile(value) {
80596
- return dealloc(parse("", null, null, null, [""], value = alloc(value), 0, [0], value));
80961
+ return dealloc(parse$1("", null, null, null, [""], value = alloc(value), 0, [0], value));
80597
80962
  }
80598
- function parse(value, root2, parent, rule, rules, rulesets, pseudo, points, declarations) {
80963
+ function parse$1(value, root2, parent, rule, rules, rulesets, pseudo, points, declarations) {
80599
80964
  var index2 = 0;
80600
80965
  var offset2 = 0;
80601
80966
  var length2 = pseudo;
@@ -80674,7 +81039,7 @@ function parse(value, root2, parent, rule, rules, rulesets, pseudo, points, decl
80674
81039
  append(reference2 = ruleset(characters2, root2, parent, index2, offset2, rules, points, type, props = [], children = [], length2, rulesets), rulesets);
80675
81040
  if (character2 === 123)
80676
81041
  if (offset2 === 0)
80677
- parse(characters2, root2, reference2, reference2, props, rulesets, length2, points, children);
81042
+ parse$1(characters2, root2, reference2, reference2, props, rulesets, length2, points, children);
80678
81043
  else
80679
81044
  switch (atrule === 99 && charat(characters2, 3) === 110 ? 100 : atrule) {
80680
81045
  // d l m s
@@ -80682,10 +81047,10 @@ function parse(value, root2, parent, rule, rules, rulesets, pseudo, points, decl
80682
81047
  case 108:
80683
81048
  case 109:
80684
81049
  case 115:
80685
- parse(value, reference2, reference2, rule && append(ruleset(value, reference2, reference2, 0, 0, rules, points, type, rules, props = [], length2, children), children), rules, children, length2, points, rule ? props : children);
81050
+ parse$1(value, reference2, reference2, rule && append(ruleset(value, reference2, reference2, 0, 0, rules, points, type, rules, props = [], length2, children), children), rules, children, length2, points, rule ? props : children);
80686
81051
  break;
80687
81052
  default:
80688
- parse(characters2, reference2, reference2, reference2, [""], children, 0, points, children);
81053
+ parse$1(characters2, reference2, reference2, reference2, [""], children, 0, points, children);
80689
81054
  }
80690
81055
  }
80691
81056
  index2 = offset2 = property = 0, variable = ampersand = 1, type = characters2 = "", length2 = pseudo;
@@ -80731,13 +81096,13 @@ function ruleset(value, root2, parent, index2, offset2, rules, points, type, pro
80731
81096
  for (var x2 = 0, y2 = substr(value, post2 + 1, post2 = abs(j2 = points[i])), z2 = value; x2 < size; ++x2)
80732
81097
  if (z2 = trim(j2 > 0 ? rule[x2] + " " + y2 : replace(y2, /&\f/g, rule[x2])))
80733
81098
  props[k2++] = z2;
80734
- return node(value, root2, parent, offset2 === 0 ? RULESET : type, props, children, length2, siblings);
81099
+ return node$1(value, root2, parent, offset2 === 0 ? RULESET : type, props, children, length2, siblings);
80735
81100
  }
80736
81101
  function comment(value, root2, parent, siblings) {
80737
- return node(value, root2, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings);
81102
+ return node$1(value, root2, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings);
80738
81103
  }
80739
81104
  function declaration(value, root2, parent, length2, siblings) {
80740
- return node(value, root2, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2, siblings);
81105
+ return node$1(value, root2, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2, siblings);
80741
81106
  }
80742
81107
  function prefix(value, length2, children) {
80743
81108
  switch (hash(value, length2)) {
@@ -81046,8 +81411,8 @@ var unitlessKeys = {
81046
81411
  strokeOpacity: 1,
81047
81412
  strokeWidth: 1
81048
81413
  };
81049
- var define_process_env_default$1 = {};
81050
- var f = "undefined" != typeof process && void 0 !== define_process_env_default$1 && (define_process_env_default$1.REACT_APP_SC_ATTR || define_process_env_default$1.SC_ATTR) || "data-styled", m = "active", y = "data-styled-version", v = "6.1.15", g = "/*!sc*/\n", S = "undefined" != typeof window && "HTMLElement" in window, w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== define_process_env_default$1 && void 0 !== define_process_env_default$1.REACT_APP_SC_DISABLE_SPEEDY && "" !== define_process_env_default$1.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== define_process_env_default$1.REACT_APP_SC_DISABLE_SPEEDY && define_process_env_default$1.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== define_process_env_default$1 && void 0 !== define_process_env_default$1.SC_DISABLE_SPEEDY && "" !== define_process_env_default$1.SC_DISABLE_SPEEDY ? "false" !== define_process_env_default$1.SC_DISABLE_SPEEDY && define_process_env_default$1.SC_DISABLE_SPEEDY : false), b = {}, _ = Object.freeze([]), C = Object.freeze({});
81414
+ var define_process_env_default = {};
81415
+ var f = "undefined" != typeof process && void 0 !== define_process_env_default && (define_process_env_default.REACT_APP_SC_ATTR || define_process_env_default.SC_ATTR) || "data-styled", m = "active", y = "data-styled-version", v = "6.1.15", g = "/*!sc*/\n", S = "undefined" != typeof window && "HTMLElement" in window, w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== define_process_env_default && void 0 !== define_process_env_default.REACT_APP_SC_DISABLE_SPEEDY && "" !== define_process_env_default.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== define_process_env_default.REACT_APP_SC_DISABLE_SPEEDY && define_process_env_default.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== define_process_env_default && void 0 !== define_process_env_default.SC_DISABLE_SPEEDY && "" !== define_process_env_default.SC_DISABLE_SPEEDY ? "false" !== define_process_env_default.SC_DISABLE_SPEEDY && define_process_env_default.SC_DISABLE_SPEEDY : false), b = {}, _ = Object.freeze([]), C = Object.freeze({});
81051
81416
  function I(e2, t2, n2) {
81052
81417
  return void 0 === n2 && (n2 = C), e2.theme !== n2.theme && e2.theme || t2 || n2.theme;
81053
81418
  }
@@ -84312,7 +84677,7 @@ const AgentAvatar$1 = styled$1(Avatar)(({ theme: theme2 }) => ({
84312
84677
  backgroundColor: "rgba(56, 201, 106, 0.2)",
84313
84678
  color: theme2.palette.primary.main
84314
84679
  }));
84315
- const MessagePreview = styled$1(Typography)({
84680
+ const MessagePreview = styled$1("span")({
84316
84681
  display: "block",
84317
84682
  color: "text.secondary",
84318
84683
  maxWidth: "100%",
@@ -84484,7 +84849,7 @@ const ChatSidebar = ({
84484
84849
  placement: "bottom-start",
84485
84850
  enterDelay: 1500,
84486
84851
  leaveDelay: 200,
84487
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(MessagePreview, { variant: "body2", children: truncateMessage(agent.last_message, 60) })
84852
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(MessagePreview, { children: truncateMessage(agent.last_message, 60) })
84488
84853
  }
84489
84854
  ),
84490
84855
  agent.last_message_datetime && /* @__PURE__ */ jsxRuntimeExports.jsxs(TimeStampContainer, { children: [
@@ -85626,12 +85991,14 @@ const CardIcon = styled$1(FontAwesomeIcon)({
85626
85991
  opacity: 0.8,
85627
85992
  color: "#f2f2f3"
85628
85993
  });
85629
- const LabelText$1 = styled$1(Box)(({ theme: theme2 }) => ({
85994
+ const LabelText$1 = styled$1("span")(({ theme: theme2 }) => ({
85630
85995
  color: theme2.palette.text.secondary,
85631
- marginRight: theme2.spacing(1)
85996
+ marginRight: theme2.spacing(1),
85997
+ display: "inline-block"
85632
85998
  }));
85633
- const ValueText = styled$1(Box)({
85634
- fontWeight: 500
85999
+ const ValueText = styled$1("span")({
86000
+ fontWeight: 500,
86001
+ display: "inline-block"
85635
86002
  });
85636
86003
  const MonospaceValueText = styled$1(ValueText)({
85637
86004
  fontFamily: "monospace"
@@ -86046,7 +86413,7 @@ const AgentAvatar = styled$1(Avatar)(({ theme: theme2 }) => ({
86046
86413
  backgroundColor: "rgba(56, 201, 106, 0.2)",
86047
86414
  color: theme2.palette.primary.main
86048
86415
  }));
86049
- const CreationDateText = styled$1(Typography)({
86416
+ const CreationDateText = styled$1("span")({
86050
86417
  display: "flex",
86051
86418
  alignItems: "center",
86052
86419
  fontSize: "0.75rem",
@@ -86054,9 +86421,11 @@ const CreationDateText = styled$1(Typography)({
86054
86421
  marginTop: 4,
86055
86422
  gap: 4
86056
86423
  });
86057
- const DescriptionText$1 = styled$1(Typography)({
86424
+ const DescriptionText$1 = styled$1("span")({
86058
86425
  maxWidth: "100%",
86059
- fontSize: "0.75rem"
86426
+ fontSize: "0.75rem",
86427
+ display: "block",
86428
+ color: "text.secondary"
86060
86429
  });
86061
86430
  const formatDate = (dateString) => {
86062
86431
  if (!dateString) return "Unknown date";
@@ -86394,6 +86763,107 @@ const AgentsPage = () => {
86394
86763
  ] }) })
86395
86764
  ] });
86396
86765
  };
86766
+ const BannerContainer = styled$1(Box)(() => ({
86767
+ position: "fixed",
86768
+ top: 0,
86769
+ left: 0,
86770
+ right: 0,
86771
+ zIndex: 2200,
86772
+ // High z-index to ensure it's above other content
86773
+ width: "100%"
86774
+ }));
86775
+ const ConnectivityBanner = ({
86776
+ autoCheck = true
86777
+ }) => {
86778
+ const {
86779
+ hostingProvider,
86780
+ shouldCheckInternet,
86781
+ hasConnectivityIssue,
86782
+ connectivityIssue,
86783
+ refetchServerStatus,
86784
+ refetchInternetStatus
86785
+ } = useConnectivityStatus();
86786
+ const [showBanner, setShowBanner] = reactExports.useState(false);
86787
+ const [internetBannerDismissed, setInternetBannerDismissed] = reactExports.useState(false);
86788
+ reactExports.useEffect(() => {
86789
+ if (connectivityIssue === "internet_offline") {
86790
+ setShowBanner(hasConnectivityIssue && !internetBannerDismissed);
86791
+ } else {
86792
+ setShowBanner(hasConnectivityIssue);
86793
+ }
86794
+ }, [hasConnectivityIssue, connectivityIssue, internetBannerDismissed]);
86795
+ reactExports.useEffect(() => {
86796
+ if (!hasConnectivityIssue || connectivityIssue !== "internet_offline") {
86797
+ setInternetBannerDismissed(false);
86798
+ }
86799
+ }, [hasConnectivityIssue, connectivityIssue]);
86800
+ reactExports.useEffect(() => {
86801
+ const handleOffline = () => {
86802
+ if (shouldCheckInternet) {
86803
+ setShowBanner(true);
86804
+ setInternetBannerDismissed(false);
86805
+ }
86806
+ };
86807
+ const handleOnline = () => {
86808
+ setShowBanner(false);
86809
+ setInternetBannerDismissed(false);
86810
+ };
86811
+ window.addEventListener("offline", handleOffline);
86812
+ window.addEventListener("online", handleOnline);
86813
+ return () => {
86814
+ window.removeEventListener("offline", handleOffline);
86815
+ window.removeEventListener("online", handleOnline);
86816
+ };
86817
+ }, [shouldCheckInternet]);
86818
+ reactExports.useEffect(() => {
86819
+ if (autoCheck) {
86820
+ refetchServerStatus();
86821
+ const intervalId = setInterval(() => {
86822
+ refetchServerStatus();
86823
+ }, 3e3);
86824
+ return () => clearInterval(intervalId);
86825
+ }
86826
+ return void 0;
86827
+ }, [autoCheck, refetchServerStatus]);
86828
+ const handleRetry = () => {
86829
+ refetchServerStatus();
86830
+ if (shouldCheckInternet) {
86831
+ refetchInternetStatus();
86832
+ }
86833
+ };
86834
+ const handleDismiss = () => {
86835
+ setInternetBannerDismissed(true);
86836
+ setShowBanner(false);
86837
+ };
86838
+ if (!showBanner) {
86839
+ return null;
86840
+ }
86841
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BannerContainer, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
86842
+ Alert,
86843
+ {
86844
+ severity: connectivityIssue === "internet_offline" ? "warning" : "error",
86845
+ action: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
86846
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "inherit", size: "small", onClick: handleRetry, children: "Retry" }),
86847
+ connectivityIssue === "internet_offline" && /* @__PURE__ */ jsxRuntimeExports.jsx(
86848
+ Button,
86849
+ {
86850
+ "aria-label": "dismiss",
86851
+ color: "inherit",
86852
+ size: "small",
86853
+ onClick: handleDismiss,
86854
+ children: "Dismiss"
86855
+ }
86856
+ )
86857
+ ] }),
86858
+ sx: { borderRadius: 0 },
86859
+ children: connectivityIssue === "server_offline" ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "The server is offline. The interface will not function properly until the server is back online." }) : connectivityIssue === "internet_offline" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
86860
+ "You are offline. Your configured hosting provider (",
86861
+ hostingProvider,
86862
+ ") requires an internet connection."
86863
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "A connectivity issue has been detected." })
86864
+ }
86865
+ ) });
86866
+ };
86397
86867
  const useInitializeModels = () => {
86398
86868
  const { isLoading, error, refreshModels } = useModels();
86399
86869
  reactExports.useEffect(() => {
@@ -86408,19 +86878,2195 @@ const ModelsInitializer = () => {
86408
86878
  useInitializeModels();
86409
86879
  return null;
86410
86880
  };
86411
- var define_process_env_default = {};
86881
+ var lib$3 = {};
86882
+ var htmlToDom = {};
86883
+ var domparser = {};
86884
+ var utilities$1 = {};
86885
+ var lib$2 = {};
86886
+ var lib$1 = {};
86887
+ var hasRequiredLib$3;
86888
+ function requireLib$3() {
86889
+ if (hasRequiredLib$3) return lib$1;
86890
+ hasRequiredLib$3 = 1;
86891
+ (function(exports) {
86892
+ Object.defineProperty(exports, "__esModule", { value: true });
86893
+ exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = exports.ElementType = void 0;
86894
+ var ElementType;
86895
+ (function(ElementType2) {
86896
+ ElementType2["Root"] = "root";
86897
+ ElementType2["Text"] = "text";
86898
+ ElementType2["Directive"] = "directive";
86899
+ ElementType2["Comment"] = "comment";
86900
+ ElementType2["Script"] = "script";
86901
+ ElementType2["Style"] = "style";
86902
+ ElementType2["Tag"] = "tag";
86903
+ ElementType2["CDATA"] = "cdata";
86904
+ ElementType2["Doctype"] = "doctype";
86905
+ })(ElementType = exports.ElementType || (exports.ElementType = {}));
86906
+ function isTag(elem) {
86907
+ return elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style;
86908
+ }
86909
+ exports.isTag = isTag;
86910
+ exports.Root = ElementType.Root;
86911
+ exports.Text = ElementType.Text;
86912
+ exports.Directive = ElementType.Directive;
86913
+ exports.Comment = ElementType.Comment;
86914
+ exports.Script = ElementType.Script;
86915
+ exports.Style = ElementType.Style;
86916
+ exports.Tag = ElementType.Tag;
86917
+ exports.CDATA = ElementType.CDATA;
86918
+ exports.Doctype = ElementType.Doctype;
86919
+ })(lib$1);
86920
+ return lib$1;
86921
+ }
86922
+ var node = {};
86923
+ var hasRequiredNode;
86924
+ function requireNode() {
86925
+ if (hasRequiredNode) return node;
86926
+ hasRequiredNode = 1;
86927
+ var __extends = node && node.__extends || /* @__PURE__ */ function() {
86928
+ var extendStatics = function(d, b2) {
86929
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b3) {
86930
+ d2.__proto__ = b3;
86931
+ } || function(d2, b3) {
86932
+ for (var p in b3) if (Object.prototype.hasOwnProperty.call(b3, p)) d2[p] = b3[p];
86933
+ };
86934
+ return extendStatics(d, b2);
86935
+ };
86936
+ return function(d, b2) {
86937
+ if (typeof b2 !== "function" && b2 !== null)
86938
+ throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
86939
+ extendStatics(d, b2);
86940
+ function __() {
86941
+ this.constructor = d;
86942
+ }
86943
+ d.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
86944
+ };
86945
+ }();
86946
+ var __assign2 = node && node.__assign || function() {
86947
+ __assign2 = Object.assign || function(t) {
86948
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
86949
+ s = arguments[i];
86950
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
86951
+ t[p] = s[p];
86952
+ }
86953
+ return t;
86954
+ };
86955
+ return __assign2.apply(this, arguments);
86956
+ };
86957
+ Object.defineProperty(node, "__esModule", { value: true });
86958
+ node.cloneNode = node.hasChildren = node.isDocument = node.isDirective = node.isComment = node.isText = node.isCDATA = node.isTag = node.Element = node.Document = node.CDATA = node.NodeWithChildren = node.ProcessingInstruction = node.Comment = node.Text = node.DataNode = node.Node = void 0;
86959
+ var domelementtype_1 = /* @__PURE__ */ requireLib$3();
86960
+ var Node = (
86961
+ /** @class */
86962
+ function() {
86963
+ function Node2() {
86964
+ this.parent = null;
86965
+ this.prev = null;
86966
+ this.next = null;
86967
+ this.startIndex = null;
86968
+ this.endIndex = null;
86969
+ }
86970
+ Object.defineProperty(Node2.prototype, "parentNode", {
86971
+ // Read-write aliases for properties
86972
+ /**
86973
+ * Same as {@link parent}.
86974
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
86975
+ */
86976
+ get: function() {
86977
+ return this.parent;
86978
+ },
86979
+ set: function(parent) {
86980
+ this.parent = parent;
86981
+ },
86982
+ enumerable: false,
86983
+ configurable: true
86984
+ });
86985
+ Object.defineProperty(Node2.prototype, "previousSibling", {
86986
+ /**
86987
+ * Same as {@link prev}.
86988
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
86989
+ */
86990
+ get: function() {
86991
+ return this.prev;
86992
+ },
86993
+ set: function(prev2) {
86994
+ this.prev = prev2;
86995
+ },
86996
+ enumerable: false,
86997
+ configurable: true
86998
+ });
86999
+ Object.defineProperty(Node2.prototype, "nextSibling", {
87000
+ /**
87001
+ * Same as {@link next}.
87002
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
87003
+ */
87004
+ get: function() {
87005
+ return this.next;
87006
+ },
87007
+ set: function(next2) {
87008
+ this.next = next2;
87009
+ },
87010
+ enumerable: false,
87011
+ configurable: true
87012
+ });
87013
+ Node2.prototype.cloneNode = function(recursive) {
87014
+ if (recursive === void 0) {
87015
+ recursive = false;
87016
+ }
87017
+ return cloneNode(this, recursive);
87018
+ };
87019
+ return Node2;
87020
+ }()
87021
+ );
87022
+ node.Node = Node;
87023
+ var DataNode = (
87024
+ /** @class */
87025
+ function(_super) {
87026
+ __extends(DataNode2, _super);
87027
+ function DataNode2(data) {
87028
+ var _this = _super.call(this) || this;
87029
+ _this.data = data;
87030
+ return _this;
87031
+ }
87032
+ Object.defineProperty(DataNode2.prototype, "nodeValue", {
87033
+ /**
87034
+ * Same as {@link data}.
87035
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
87036
+ */
87037
+ get: function() {
87038
+ return this.data;
87039
+ },
87040
+ set: function(data) {
87041
+ this.data = data;
87042
+ },
87043
+ enumerable: false,
87044
+ configurable: true
87045
+ });
87046
+ return DataNode2;
87047
+ }(Node)
87048
+ );
87049
+ node.DataNode = DataNode;
87050
+ var Text = (
87051
+ /** @class */
87052
+ function(_super) {
87053
+ __extends(Text2, _super);
87054
+ function Text2() {
87055
+ var _this = _super !== null && _super.apply(this, arguments) || this;
87056
+ _this.type = domelementtype_1.ElementType.Text;
87057
+ return _this;
87058
+ }
87059
+ Object.defineProperty(Text2.prototype, "nodeType", {
87060
+ get: function() {
87061
+ return 3;
87062
+ },
87063
+ enumerable: false,
87064
+ configurable: true
87065
+ });
87066
+ return Text2;
87067
+ }(DataNode)
87068
+ );
87069
+ node.Text = Text;
87070
+ var Comment = (
87071
+ /** @class */
87072
+ function(_super) {
87073
+ __extends(Comment2, _super);
87074
+ function Comment2() {
87075
+ var _this = _super !== null && _super.apply(this, arguments) || this;
87076
+ _this.type = domelementtype_1.ElementType.Comment;
87077
+ return _this;
87078
+ }
87079
+ Object.defineProperty(Comment2.prototype, "nodeType", {
87080
+ get: function() {
87081
+ return 8;
87082
+ },
87083
+ enumerable: false,
87084
+ configurable: true
87085
+ });
87086
+ return Comment2;
87087
+ }(DataNode)
87088
+ );
87089
+ node.Comment = Comment;
87090
+ var ProcessingInstruction = (
87091
+ /** @class */
87092
+ function(_super) {
87093
+ __extends(ProcessingInstruction2, _super);
87094
+ function ProcessingInstruction2(name2, data) {
87095
+ var _this = _super.call(this, data) || this;
87096
+ _this.name = name2;
87097
+ _this.type = domelementtype_1.ElementType.Directive;
87098
+ return _this;
87099
+ }
87100
+ Object.defineProperty(ProcessingInstruction2.prototype, "nodeType", {
87101
+ get: function() {
87102
+ return 1;
87103
+ },
87104
+ enumerable: false,
87105
+ configurable: true
87106
+ });
87107
+ return ProcessingInstruction2;
87108
+ }(DataNode)
87109
+ );
87110
+ node.ProcessingInstruction = ProcessingInstruction;
87111
+ var NodeWithChildren = (
87112
+ /** @class */
87113
+ function(_super) {
87114
+ __extends(NodeWithChildren2, _super);
87115
+ function NodeWithChildren2(children) {
87116
+ var _this = _super.call(this) || this;
87117
+ _this.children = children;
87118
+ return _this;
87119
+ }
87120
+ Object.defineProperty(NodeWithChildren2.prototype, "firstChild", {
87121
+ // Aliases
87122
+ /** First child of the node. */
87123
+ get: function() {
87124
+ var _a;
87125
+ return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null;
87126
+ },
87127
+ enumerable: false,
87128
+ configurable: true
87129
+ });
87130
+ Object.defineProperty(NodeWithChildren2.prototype, "lastChild", {
87131
+ /** Last child of the node. */
87132
+ get: function() {
87133
+ return this.children.length > 0 ? this.children[this.children.length - 1] : null;
87134
+ },
87135
+ enumerable: false,
87136
+ configurable: true
87137
+ });
87138
+ Object.defineProperty(NodeWithChildren2.prototype, "childNodes", {
87139
+ /**
87140
+ * Same as {@link children}.
87141
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
87142
+ */
87143
+ get: function() {
87144
+ return this.children;
87145
+ },
87146
+ set: function(children) {
87147
+ this.children = children;
87148
+ },
87149
+ enumerable: false,
87150
+ configurable: true
87151
+ });
87152
+ return NodeWithChildren2;
87153
+ }(Node)
87154
+ );
87155
+ node.NodeWithChildren = NodeWithChildren;
87156
+ var CDATA = (
87157
+ /** @class */
87158
+ function(_super) {
87159
+ __extends(CDATA2, _super);
87160
+ function CDATA2() {
87161
+ var _this = _super !== null && _super.apply(this, arguments) || this;
87162
+ _this.type = domelementtype_1.ElementType.CDATA;
87163
+ return _this;
87164
+ }
87165
+ Object.defineProperty(CDATA2.prototype, "nodeType", {
87166
+ get: function() {
87167
+ return 4;
87168
+ },
87169
+ enumerable: false,
87170
+ configurable: true
87171
+ });
87172
+ return CDATA2;
87173
+ }(NodeWithChildren)
87174
+ );
87175
+ node.CDATA = CDATA;
87176
+ var Document = (
87177
+ /** @class */
87178
+ function(_super) {
87179
+ __extends(Document2, _super);
87180
+ function Document2() {
87181
+ var _this = _super !== null && _super.apply(this, arguments) || this;
87182
+ _this.type = domelementtype_1.ElementType.Root;
87183
+ return _this;
87184
+ }
87185
+ Object.defineProperty(Document2.prototype, "nodeType", {
87186
+ get: function() {
87187
+ return 9;
87188
+ },
87189
+ enumerable: false,
87190
+ configurable: true
87191
+ });
87192
+ return Document2;
87193
+ }(NodeWithChildren)
87194
+ );
87195
+ node.Document = Document;
87196
+ var Element2 = (
87197
+ /** @class */
87198
+ function(_super) {
87199
+ __extends(Element3, _super);
87200
+ function Element3(name2, attribs, children, type) {
87201
+ if (children === void 0) {
87202
+ children = [];
87203
+ }
87204
+ if (type === void 0) {
87205
+ type = name2 === "script" ? domelementtype_1.ElementType.Script : name2 === "style" ? domelementtype_1.ElementType.Style : domelementtype_1.ElementType.Tag;
87206
+ }
87207
+ var _this = _super.call(this, children) || this;
87208
+ _this.name = name2;
87209
+ _this.attribs = attribs;
87210
+ _this.type = type;
87211
+ return _this;
87212
+ }
87213
+ Object.defineProperty(Element3.prototype, "nodeType", {
87214
+ get: function() {
87215
+ return 1;
87216
+ },
87217
+ enumerable: false,
87218
+ configurable: true
87219
+ });
87220
+ Object.defineProperty(Element3.prototype, "tagName", {
87221
+ // DOM Level 1 aliases
87222
+ /**
87223
+ * Same as {@link name}.
87224
+ * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
87225
+ */
87226
+ get: function() {
87227
+ return this.name;
87228
+ },
87229
+ set: function(name2) {
87230
+ this.name = name2;
87231
+ },
87232
+ enumerable: false,
87233
+ configurable: true
87234
+ });
87235
+ Object.defineProperty(Element3.prototype, "attributes", {
87236
+ get: function() {
87237
+ var _this = this;
87238
+ return Object.keys(this.attribs).map(function(name2) {
87239
+ var _a, _b;
87240
+ return {
87241
+ name: name2,
87242
+ value: _this.attribs[name2],
87243
+ namespace: (_a = _this["x-attribsNamespace"]) === null || _a === void 0 ? void 0 : _a[name2],
87244
+ prefix: (_b = _this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name2]
87245
+ };
87246
+ });
87247
+ },
87248
+ enumerable: false,
87249
+ configurable: true
87250
+ });
87251
+ return Element3;
87252
+ }(NodeWithChildren)
87253
+ );
87254
+ node.Element = Element2;
87255
+ function isTag(node2) {
87256
+ return (0, domelementtype_1.isTag)(node2);
87257
+ }
87258
+ node.isTag = isTag;
87259
+ function isCDATA(node2) {
87260
+ return node2.type === domelementtype_1.ElementType.CDATA;
87261
+ }
87262
+ node.isCDATA = isCDATA;
87263
+ function isText(node2) {
87264
+ return node2.type === domelementtype_1.ElementType.Text;
87265
+ }
87266
+ node.isText = isText;
87267
+ function isComment(node2) {
87268
+ return node2.type === domelementtype_1.ElementType.Comment;
87269
+ }
87270
+ node.isComment = isComment;
87271
+ function isDirective(node2) {
87272
+ return node2.type === domelementtype_1.ElementType.Directive;
87273
+ }
87274
+ node.isDirective = isDirective;
87275
+ function isDocument(node2) {
87276
+ return node2.type === domelementtype_1.ElementType.Root;
87277
+ }
87278
+ node.isDocument = isDocument;
87279
+ function hasChildren(node2) {
87280
+ return Object.prototype.hasOwnProperty.call(node2, "children");
87281
+ }
87282
+ node.hasChildren = hasChildren;
87283
+ function cloneNode(node2, recursive) {
87284
+ if (recursive === void 0) {
87285
+ recursive = false;
87286
+ }
87287
+ var result;
87288
+ if (isText(node2)) {
87289
+ result = new Text(node2.data);
87290
+ } else if (isComment(node2)) {
87291
+ result = new Comment(node2.data);
87292
+ } else if (isTag(node2)) {
87293
+ var children = recursive ? cloneChildren(node2.children) : [];
87294
+ var clone_1 = new Element2(node2.name, __assign2({}, node2.attribs), children);
87295
+ children.forEach(function(child) {
87296
+ return child.parent = clone_1;
87297
+ });
87298
+ if (node2.namespace != null) {
87299
+ clone_1.namespace = node2.namespace;
87300
+ }
87301
+ if (node2["x-attribsNamespace"]) {
87302
+ clone_1["x-attribsNamespace"] = __assign2({}, node2["x-attribsNamespace"]);
87303
+ }
87304
+ if (node2["x-attribsPrefix"]) {
87305
+ clone_1["x-attribsPrefix"] = __assign2({}, node2["x-attribsPrefix"]);
87306
+ }
87307
+ result = clone_1;
87308
+ } else if (isCDATA(node2)) {
87309
+ var children = recursive ? cloneChildren(node2.children) : [];
87310
+ var clone_2 = new CDATA(children);
87311
+ children.forEach(function(child) {
87312
+ return child.parent = clone_2;
87313
+ });
87314
+ result = clone_2;
87315
+ } else if (isDocument(node2)) {
87316
+ var children = recursive ? cloneChildren(node2.children) : [];
87317
+ var clone_3 = new Document(children);
87318
+ children.forEach(function(child) {
87319
+ return child.parent = clone_3;
87320
+ });
87321
+ if (node2["x-mode"]) {
87322
+ clone_3["x-mode"] = node2["x-mode"];
87323
+ }
87324
+ result = clone_3;
87325
+ } else if (isDirective(node2)) {
87326
+ var instruction = new ProcessingInstruction(node2.name, node2.data);
87327
+ if (node2["x-name"] != null) {
87328
+ instruction["x-name"] = node2["x-name"];
87329
+ instruction["x-publicId"] = node2["x-publicId"];
87330
+ instruction["x-systemId"] = node2["x-systemId"];
87331
+ }
87332
+ result = instruction;
87333
+ } else {
87334
+ throw new Error("Not implemented yet: ".concat(node2.type));
87335
+ }
87336
+ result.startIndex = node2.startIndex;
87337
+ result.endIndex = node2.endIndex;
87338
+ if (node2.sourceCodeLocation != null) {
87339
+ result.sourceCodeLocation = node2.sourceCodeLocation;
87340
+ }
87341
+ return result;
87342
+ }
87343
+ node.cloneNode = cloneNode;
87344
+ function cloneChildren(childs) {
87345
+ var children = childs.map(function(child) {
87346
+ return cloneNode(child, true);
87347
+ });
87348
+ for (var i = 1; i < children.length; i++) {
87349
+ children[i].prev = children[i - 1];
87350
+ children[i - 1].next = children[i];
87351
+ }
87352
+ return children;
87353
+ }
87354
+ return node;
87355
+ }
87356
+ var hasRequiredLib$2;
87357
+ function requireLib$2() {
87358
+ if (hasRequiredLib$2) return lib$2;
87359
+ hasRequiredLib$2 = 1;
87360
+ (function(exports) {
87361
+ var __createBinding = lib$2 && lib$2.__createBinding || (Object.create ? function(o, m2, k2, k22) {
87362
+ if (k22 === void 0) k22 = k2;
87363
+ var desc = Object.getOwnPropertyDescriptor(m2, k2);
87364
+ if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
87365
+ desc = { enumerable: true, get: function() {
87366
+ return m2[k2];
87367
+ } };
87368
+ }
87369
+ Object.defineProperty(o, k22, desc);
87370
+ } : function(o, m2, k2, k22) {
87371
+ if (k22 === void 0) k22 = k2;
87372
+ o[k22] = m2[k2];
87373
+ });
87374
+ var __exportStar = lib$2 && lib$2.__exportStar || function(m2, exports2) {
87375
+ for (var p in m2) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m2, p);
87376
+ };
87377
+ Object.defineProperty(exports, "__esModule", { value: true });
87378
+ exports.DomHandler = void 0;
87379
+ var domelementtype_1 = /* @__PURE__ */ requireLib$3();
87380
+ var node_js_1 = /* @__PURE__ */ requireNode();
87381
+ __exportStar(/* @__PURE__ */ requireNode(), exports);
87382
+ var defaultOpts = {
87383
+ withStartIndices: false,
87384
+ withEndIndices: false,
87385
+ xmlMode: false
87386
+ };
87387
+ var DomHandler = (
87388
+ /** @class */
87389
+ function() {
87390
+ function DomHandler2(callback, options, elementCB) {
87391
+ this.dom = [];
87392
+ this.root = new node_js_1.Document(this.dom);
87393
+ this.done = false;
87394
+ this.tagStack = [this.root];
87395
+ this.lastNode = null;
87396
+ this.parser = null;
87397
+ if (typeof options === "function") {
87398
+ elementCB = options;
87399
+ options = defaultOpts;
87400
+ }
87401
+ if (typeof callback === "object") {
87402
+ options = callback;
87403
+ callback = void 0;
87404
+ }
87405
+ this.callback = callback !== null && callback !== void 0 ? callback : null;
87406
+ this.options = options !== null && options !== void 0 ? options : defaultOpts;
87407
+ this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null;
87408
+ }
87409
+ DomHandler2.prototype.onparserinit = function(parser) {
87410
+ this.parser = parser;
87411
+ };
87412
+ DomHandler2.prototype.onreset = function() {
87413
+ this.dom = [];
87414
+ this.root = new node_js_1.Document(this.dom);
87415
+ this.done = false;
87416
+ this.tagStack = [this.root];
87417
+ this.lastNode = null;
87418
+ this.parser = null;
87419
+ };
87420
+ DomHandler2.prototype.onend = function() {
87421
+ if (this.done)
87422
+ return;
87423
+ this.done = true;
87424
+ this.parser = null;
87425
+ this.handleCallback(null);
87426
+ };
87427
+ DomHandler2.prototype.onerror = function(error) {
87428
+ this.handleCallback(error);
87429
+ };
87430
+ DomHandler2.prototype.onclosetag = function() {
87431
+ this.lastNode = null;
87432
+ var elem = this.tagStack.pop();
87433
+ if (this.options.withEndIndices) {
87434
+ elem.endIndex = this.parser.endIndex;
87435
+ }
87436
+ if (this.elementCB)
87437
+ this.elementCB(elem);
87438
+ };
87439
+ DomHandler2.prototype.onopentag = function(name2, attribs) {
87440
+ var type = this.options.xmlMode ? domelementtype_1.ElementType.Tag : void 0;
87441
+ var element2 = new node_js_1.Element(name2, attribs, void 0, type);
87442
+ this.addNode(element2);
87443
+ this.tagStack.push(element2);
87444
+ };
87445
+ DomHandler2.prototype.ontext = function(data) {
87446
+ var lastNode = this.lastNode;
87447
+ if (lastNode && lastNode.type === domelementtype_1.ElementType.Text) {
87448
+ lastNode.data += data;
87449
+ if (this.options.withEndIndices) {
87450
+ lastNode.endIndex = this.parser.endIndex;
87451
+ }
87452
+ } else {
87453
+ var node2 = new node_js_1.Text(data);
87454
+ this.addNode(node2);
87455
+ this.lastNode = node2;
87456
+ }
87457
+ };
87458
+ DomHandler2.prototype.oncomment = function(data) {
87459
+ if (this.lastNode && this.lastNode.type === domelementtype_1.ElementType.Comment) {
87460
+ this.lastNode.data += data;
87461
+ return;
87462
+ }
87463
+ var node2 = new node_js_1.Comment(data);
87464
+ this.addNode(node2);
87465
+ this.lastNode = node2;
87466
+ };
87467
+ DomHandler2.prototype.oncommentend = function() {
87468
+ this.lastNode = null;
87469
+ };
87470
+ DomHandler2.prototype.oncdatastart = function() {
87471
+ var text2 = new node_js_1.Text("");
87472
+ var node2 = new node_js_1.CDATA([text2]);
87473
+ this.addNode(node2);
87474
+ text2.parent = node2;
87475
+ this.lastNode = text2;
87476
+ };
87477
+ DomHandler2.prototype.oncdataend = function() {
87478
+ this.lastNode = null;
87479
+ };
87480
+ DomHandler2.prototype.onprocessinginstruction = function(name2, data) {
87481
+ var node2 = new node_js_1.ProcessingInstruction(name2, data);
87482
+ this.addNode(node2);
87483
+ };
87484
+ DomHandler2.prototype.handleCallback = function(error) {
87485
+ if (typeof this.callback === "function") {
87486
+ this.callback(error, this.dom);
87487
+ } else if (error) {
87488
+ throw error;
87489
+ }
87490
+ };
87491
+ DomHandler2.prototype.addNode = function(node2) {
87492
+ var parent = this.tagStack[this.tagStack.length - 1];
87493
+ var previousSibling = parent.children[parent.children.length - 1];
87494
+ if (this.options.withStartIndices) {
87495
+ node2.startIndex = this.parser.startIndex;
87496
+ }
87497
+ if (this.options.withEndIndices) {
87498
+ node2.endIndex = this.parser.endIndex;
87499
+ }
87500
+ parent.children.push(node2);
87501
+ if (previousSibling) {
87502
+ node2.prev = previousSibling;
87503
+ previousSibling.next = node2;
87504
+ }
87505
+ node2.parent = parent;
87506
+ this.lastNode = null;
87507
+ };
87508
+ return DomHandler2;
87509
+ }()
87510
+ );
87511
+ exports.DomHandler = DomHandler;
87512
+ exports.default = DomHandler;
87513
+ })(lib$2);
87514
+ return lib$2;
87515
+ }
87516
+ var constants = {};
87517
+ var hasRequiredConstants;
87518
+ function requireConstants() {
87519
+ if (hasRequiredConstants) return constants;
87520
+ hasRequiredConstants = 1;
87521
+ (function(exports) {
87522
+ Object.defineProperty(exports, "__esModule", { value: true });
87523
+ exports.CARRIAGE_RETURN_PLACEHOLDER_REGEX = exports.CARRIAGE_RETURN_PLACEHOLDER = exports.CARRIAGE_RETURN_REGEX = exports.CARRIAGE_RETURN = exports.CASE_SENSITIVE_TAG_NAMES_MAP = exports.CASE_SENSITIVE_TAG_NAMES = void 0;
87524
+ exports.CASE_SENSITIVE_TAG_NAMES = [
87525
+ "animateMotion",
87526
+ "animateTransform",
87527
+ "clipPath",
87528
+ "feBlend",
87529
+ "feColorMatrix",
87530
+ "feComponentTransfer",
87531
+ "feComposite",
87532
+ "feConvolveMatrix",
87533
+ "feDiffuseLighting",
87534
+ "feDisplacementMap",
87535
+ "feDropShadow",
87536
+ "feFlood",
87537
+ "feFuncA",
87538
+ "feFuncB",
87539
+ "feFuncG",
87540
+ "feFuncR",
87541
+ "feGaussianBlur",
87542
+ "feImage",
87543
+ "feMerge",
87544
+ "feMergeNode",
87545
+ "feMorphology",
87546
+ "feOffset",
87547
+ "fePointLight",
87548
+ "feSpecularLighting",
87549
+ "feSpotLight",
87550
+ "feTile",
87551
+ "feTurbulence",
87552
+ "foreignObject",
87553
+ "linearGradient",
87554
+ "radialGradient",
87555
+ "textPath"
87556
+ ];
87557
+ exports.CASE_SENSITIVE_TAG_NAMES_MAP = exports.CASE_SENSITIVE_TAG_NAMES.reduce(function(accumulator, tagName) {
87558
+ accumulator[tagName.toLowerCase()] = tagName;
87559
+ return accumulator;
87560
+ }, {});
87561
+ exports.CARRIAGE_RETURN = "\r";
87562
+ exports.CARRIAGE_RETURN_REGEX = new RegExp(exports.CARRIAGE_RETURN, "g");
87563
+ exports.CARRIAGE_RETURN_PLACEHOLDER = "__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(), "__");
87564
+ exports.CARRIAGE_RETURN_PLACEHOLDER_REGEX = new RegExp(exports.CARRIAGE_RETURN_PLACEHOLDER, "g");
87565
+ })(constants);
87566
+ return constants;
87567
+ }
87568
+ var hasRequiredUtilities$1;
87569
+ function requireUtilities$1() {
87570
+ if (hasRequiredUtilities$1) return utilities$1;
87571
+ hasRequiredUtilities$1 = 1;
87572
+ Object.defineProperty(utilities$1, "__esModule", { value: true });
87573
+ utilities$1.formatAttributes = formatAttributes;
87574
+ utilities$1.escapeSpecialCharacters = escapeSpecialCharacters;
87575
+ utilities$1.revertEscapedCharacters = revertEscapedCharacters;
87576
+ utilities$1.formatDOM = formatDOM;
87577
+ var domhandler_1 = /* @__PURE__ */ requireLib$2();
87578
+ var constants_1 = requireConstants();
87579
+ function getCaseSensitiveTagName(tagName) {
87580
+ return constants_1.CASE_SENSITIVE_TAG_NAMES_MAP[tagName];
87581
+ }
87582
+ function formatAttributes(attributes) {
87583
+ var map = {};
87584
+ var index2 = 0;
87585
+ var attributesLength = attributes.length;
87586
+ for (; index2 < attributesLength; index2++) {
87587
+ var attribute = attributes[index2];
87588
+ map[attribute.name] = attribute.value;
87589
+ }
87590
+ return map;
87591
+ }
87592
+ function formatTagName(tagName) {
87593
+ tagName = tagName.toLowerCase();
87594
+ var caseSensitiveTagName = getCaseSensitiveTagName(tagName);
87595
+ if (caseSensitiveTagName) {
87596
+ return caseSensitiveTagName;
87597
+ }
87598
+ return tagName;
87599
+ }
87600
+ function escapeSpecialCharacters(html2) {
87601
+ return html2.replace(constants_1.CARRIAGE_RETURN_REGEX, constants_1.CARRIAGE_RETURN_PLACEHOLDER);
87602
+ }
87603
+ function revertEscapedCharacters(text2) {
87604
+ return text2.replace(constants_1.CARRIAGE_RETURN_PLACEHOLDER_REGEX, constants_1.CARRIAGE_RETURN);
87605
+ }
87606
+ function formatDOM(nodes, parent, directive) {
87607
+ if (parent === void 0) {
87608
+ parent = null;
87609
+ }
87610
+ var domNodes = [];
87611
+ var current;
87612
+ var index2 = 0;
87613
+ var nodesLength = nodes.length;
87614
+ for (; index2 < nodesLength; index2++) {
87615
+ var node2 = nodes[index2];
87616
+ switch (node2.nodeType) {
87617
+ case 1: {
87618
+ var tagName = formatTagName(node2.nodeName);
87619
+ current = new domhandler_1.Element(tagName, formatAttributes(node2.attributes));
87620
+ current.children = formatDOM(
87621
+ // template children are on content
87622
+ tagName === "template" ? node2.content.childNodes : node2.childNodes,
87623
+ current
87624
+ );
87625
+ break;
87626
+ }
87627
+ case 3:
87628
+ current = new domhandler_1.Text(revertEscapedCharacters(node2.nodeValue));
87629
+ break;
87630
+ case 8:
87631
+ current = new domhandler_1.Comment(node2.nodeValue);
87632
+ break;
87633
+ default:
87634
+ continue;
87635
+ }
87636
+ var prev2 = domNodes[index2 - 1] || null;
87637
+ if (prev2) {
87638
+ prev2.next = current;
87639
+ }
87640
+ current.parent = parent;
87641
+ current.prev = prev2;
87642
+ current.next = null;
87643
+ domNodes.push(current);
87644
+ }
87645
+ if (directive) {
87646
+ current = new domhandler_1.ProcessingInstruction(directive.substring(0, directive.indexOf(" ")).toLowerCase(), directive);
87647
+ current.next = domNodes[0] || null;
87648
+ current.parent = parent;
87649
+ domNodes.unshift(current);
87650
+ if (domNodes[1]) {
87651
+ domNodes[1].prev = domNodes[0];
87652
+ }
87653
+ }
87654
+ return domNodes;
87655
+ }
87656
+ return utilities$1;
87657
+ }
87658
+ var hasRequiredDomparser;
87659
+ function requireDomparser() {
87660
+ if (hasRequiredDomparser) return domparser;
87661
+ hasRequiredDomparser = 1;
87662
+ Object.defineProperty(domparser, "__esModule", { value: true });
87663
+ domparser.default = domparser$1;
87664
+ var utilities_1 = requireUtilities$1();
87665
+ var HTML = "html";
87666
+ var HEAD = "head";
87667
+ var BODY = "body";
87668
+ var FIRST_TAG_REGEX = /<([a-zA-Z]+[0-9]?)/;
87669
+ var HEAD_TAG_REGEX = /<head[^]*>/i;
87670
+ var BODY_TAG_REGEX = /<body[^]*>/i;
87671
+ var parseFromDocument = function(html2, tagName) {
87672
+ throw new Error("This browser does not support `document.implementation.createHTMLDocument`");
87673
+ };
87674
+ var parseFromString = function(html2, tagName) {
87675
+ throw new Error("This browser does not support `DOMParser.prototype.parseFromString`");
87676
+ };
87677
+ var DOMParser = typeof window === "object" && window.DOMParser;
87678
+ if (typeof DOMParser === "function") {
87679
+ var domParser_1 = new DOMParser();
87680
+ var mimeType_1 = "text/html";
87681
+ parseFromString = function(html2, tagName) {
87682
+ if (tagName) {
87683
+ html2 = "<".concat(tagName, ">").concat(html2, "</").concat(tagName, ">");
87684
+ }
87685
+ return domParser_1.parseFromString(html2, mimeType_1);
87686
+ };
87687
+ parseFromDocument = parseFromString;
87688
+ }
87689
+ if (typeof document === "object" && document.implementation) {
87690
+ var htmlDocument_1 = document.implementation.createHTMLDocument();
87691
+ parseFromDocument = function(html2, tagName) {
87692
+ if (tagName) {
87693
+ var element2 = htmlDocument_1.documentElement.querySelector(tagName);
87694
+ if (element2) {
87695
+ element2.innerHTML = html2;
87696
+ }
87697
+ return htmlDocument_1;
87698
+ }
87699
+ htmlDocument_1.documentElement.innerHTML = html2;
87700
+ return htmlDocument_1;
87701
+ };
87702
+ }
87703
+ var template = typeof document === "object" && document.createElement("template");
87704
+ var parseFromTemplate;
87705
+ if (template && template.content) {
87706
+ parseFromTemplate = function(html2) {
87707
+ template.innerHTML = html2;
87708
+ return template.content.childNodes;
87709
+ };
87710
+ }
87711
+ function domparser$1(html2) {
87712
+ var _a, _b;
87713
+ html2 = (0, utilities_1.escapeSpecialCharacters)(html2);
87714
+ var match2 = html2.match(FIRST_TAG_REGEX);
87715
+ var firstTagName = match2 && match2[1] ? match2[1].toLowerCase() : "";
87716
+ switch (firstTagName) {
87717
+ case HTML: {
87718
+ var doc = parseFromString(html2);
87719
+ if (!HEAD_TAG_REGEX.test(html2)) {
87720
+ var element2 = doc.querySelector(HEAD);
87721
+ (_a = element2 === null || element2 === void 0 ? void 0 : element2.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(element2);
87722
+ }
87723
+ if (!BODY_TAG_REGEX.test(html2)) {
87724
+ var element2 = doc.querySelector(BODY);
87725
+ (_b = element2 === null || element2 === void 0 ? void 0 : element2.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(element2);
87726
+ }
87727
+ return doc.querySelectorAll(HTML);
87728
+ }
87729
+ case HEAD:
87730
+ case BODY: {
87731
+ var elements = parseFromDocument(html2).querySelectorAll(firstTagName);
87732
+ if (BODY_TAG_REGEX.test(html2) && HEAD_TAG_REGEX.test(html2)) {
87733
+ return elements[0].parentNode.childNodes;
87734
+ }
87735
+ return elements;
87736
+ }
87737
+ // low-level tag or text
87738
+ default: {
87739
+ if (parseFromTemplate) {
87740
+ return parseFromTemplate(html2);
87741
+ }
87742
+ var element2 = parseFromDocument(html2, BODY).querySelector(BODY);
87743
+ return element2.childNodes;
87744
+ }
87745
+ }
87746
+ }
87747
+ return domparser;
87748
+ }
87749
+ var hasRequiredHtmlToDom;
87750
+ function requireHtmlToDom() {
87751
+ if (hasRequiredHtmlToDom) return htmlToDom;
87752
+ hasRequiredHtmlToDom = 1;
87753
+ var __importDefault = htmlToDom && htmlToDom.__importDefault || function(mod) {
87754
+ return mod && mod.__esModule ? mod : { "default": mod };
87755
+ };
87756
+ Object.defineProperty(htmlToDom, "__esModule", { value: true });
87757
+ htmlToDom.default = HTMLDOMParser;
87758
+ var domparser_1 = __importDefault(requireDomparser());
87759
+ var utilities_1 = requireUtilities$1();
87760
+ var DIRECTIVE_REGEX = /<(![a-zA-Z\s]+)>/;
87761
+ function HTMLDOMParser(html2) {
87762
+ if (typeof html2 !== "string") {
87763
+ throw new TypeError("First argument must be a string");
87764
+ }
87765
+ if (!html2) {
87766
+ return [];
87767
+ }
87768
+ var match2 = html2.match(DIRECTIVE_REGEX);
87769
+ var directive = match2 ? match2[1] : void 0;
87770
+ return (0, utilities_1.formatDOM)((0, domparser_1.default)(html2), null, directive);
87771
+ }
87772
+ return htmlToDom;
87773
+ }
87774
+ var attributesToProps = {};
87775
+ var lib = {};
87776
+ var possibleStandardNamesOptimized = {};
87777
+ var hasRequiredPossibleStandardNamesOptimized;
87778
+ function requirePossibleStandardNamesOptimized() {
87779
+ if (hasRequiredPossibleStandardNamesOptimized) return possibleStandardNamesOptimized;
87780
+ hasRequiredPossibleStandardNamesOptimized = 1;
87781
+ var SAME = 0;
87782
+ possibleStandardNamesOptimized.SAME = SAME;
87783
+ var CAMELCASE = 1;
87784
+ possibleStandardNamesOptimized.CAMELCASE = CAMELCASE;
87785
+ possibleStandardNamesOptimized.possibleStandardNames = {
87786
+ accept: 0,
87787
+ acceptCharset: 1,
87788
+ "accept-charset": "acceptCharset",
87789
+ accessKey: 1,
87790
+ action: 0,
87791
+ allowFullScreen: 1,
87792
+ alt: 0,
87793
+ as: 0,
87794
+ async: 0,
87795
+ autoCapitalize: 1,
87796
+ autoComplete: 1,
87797
+ autoCorrect: 1,
87798
+ autoFocus: 1,
87799
+ autoPlay: 1,
87800
+ autoSave: 1,
87801
+ capture: 0,
87802
+ cellPadding: 1,
87803
+ cellSpacing: 1,
87804
+ challenge: 0,
87805
+ charSet: 1,
87806
+ checked: 0,
87807
+ children: 0,
87808
+ cite: 0,
87809
+ class: "className",
87810
+ classID: 1,
87811
+ className: 1,
87812
+ cols: 0,
87813
+ colSpan: 1,
87814
+ content: 0,
87815
+ contentEditable: 1,
87816
+ contextMenu: 1,
87817
+ controls: 0,
87818
+ controlsList: 1,
87819
+ coords: 0,
87820
+ crossOrigin: 1,
87821
+ dangerouslySetInnerHTML: 1,
87822
+ data: 0,
87823
+ dateTime: 1,
87824
+ default: 0,
87825
+ defaultChecked: 1,
87826
+ defaultValue: 1,
87827
+ defer: 0,
87828
+ dir: 0,
87829
+ disabled: 0,
87830
+ disablePictureInPicture: 1,
87831
+ disableRemotePlayback: 1,
87832
+ download: 0,
87833
+ draggable: 0,
87834
+ encType: 1,
87835
+ enterKeyHint: 1,
87836
+ for: "htmlFor",
87837
+ form: 0,
87838
+ formMethod: 1,
87839
+ formAction: 1,
87840
+ formEncType: 1,
87841
+ formNoValidate: 1,
87842
+ formTarget: 1,
87843
+ frameBorder: 1,
87844
+ headers: 0,
87845
+ height: 0,
87846
+ hidden: 0,
87847
+ high: 0,
87848
+ href: 0,
87849
+ hrefLang: 1,
87850
+ htmlFor: 1,
87851
+ httpEquiv: 1,
87852
+ "http-equiv": "httpEquiv",
87853
+ icon: 0,
87854
+ id: 0,
87855
+ innerHTML: 1,
87856
+ inputMode: 1,
87857
+ integrity: 0,
87858
+ is: 0,
87859
+ itemID: 1,
87860
+ itemProp: 1,
87861
+ itemRef: 1,
87862
+ itemScope: 1,
87863
+ itemType: 1,
87864
+ keyParams: 1,
87865
+ keyType: 1,
87866
+ kind: 0,
87867
+ label: 0,
87868
+ lang: 0,
87869
+ list: 0,
87870
+ loop: 0,
87871
+ low: 0,
87872
+ manifest: 0,
87873
+ marginWidth: 1,
87874
+ marginHeight: 1,
87875
+ max: 0,
87876
+ maxLength: 1,
87877
+ media: 0,
87878
+ mediaGroup: 1,
87879
+ method: 0,
87880
+ min: 0,
87881
+ minLength: 1,
87882
+ multiple: 0,
87883
+ muted: 0,
87884
+ name: 0,
87885
+ noModule: 1,
87886
+ nonce: 0,
87887
+ noValidate: 1,
87888
+ open: 0,
87889
+ optimum: 0,
87890
+ pattern: 0,
87891
+ placeholder: 0,
87892
+ playsInline: 1,
87893
+ poster: 0,
87894
+ preload: 0,
87895
+ profile: 0,
87896
+ radioGroup: 1,
87897
+ readOnly: 1,
87898
+ referrerPolicy: 1,
87899
+ rel: 0,
87900
+ required: 0,
87901
+ reversed: 0,
87902
+ role: 0,
87903
+ rows: 0,
87904
+ rowSpan: 1,
87905
+ sandbox: 0,
87906
+ scope: 0,
87907
+ scoped: 0,
87908
+ scrolling: 0,
87909
+ seamless: 0,
87910
+ selected: 0,
87911
+ shape: 0,
87912
+ size: 0,
87913
+ sizes: 0,
87914
+ span: 0,
87915
+ spellCheck: 1,
87916
+ src: 0,
87917
+ srcDoc: 1,
87918
+ srcLang: 1,
87919
+ srcSet: 1,
87920
+ start: 0,
87921
+ step: 0,
87922
+ style: 0,
87923
+ summary: 0,
87924
+ tabIndex: 1,
87925
+ target: 0,
87926
+ title: 0,
87927
+ type: 0,
87928
+ useMap: 1,
87929
+ value: 0,
87930
+ width: 0,
87931
+ wmode: 0,
87932
+ wrap: 0,
87933
+ about: 0,
87934
+ accentHeight: 1,
87935
+ "accent-height": "accentHeight",
87936
+ accumulate: 0,
87937
+ additive: 0,
87938
+ alignmentBaseline: 1,
87939
+ "alignment-baseline": "alignmentBaseline",
87940
+ allowReorder: 1,
87941
+ alphabetic: 0,
87942
+ amplitude: 0,
87943
+ arabicForm: 1,
87944
+ "arabic-form": "arabicForm",
87945
+ ascent: 0,
87946
+ attributeName: 1,
87947
+ attributeType: 1,
87948
+ autoReverse: 1,
87949
+ azimuth: 0,
87950
+ baseFrequency: 1,
87951
+ baselineShift: 1,
87952
+ "baseline-shift": "baselineShift",
87953
+ baseProfile: 1,
87954
+ bbox: 0,
87955
+ begin: 0,
87956
+ bias: 0,
87957
+ by: 0,
87958
+ calcMode: 1,
87959
+ capHeight: 1,
87960
+ "cap-height": "capHeight",
87961
+ clip: 0,
87962
+ clipPath: 1,
87963
+ "clip-path": "clipPath",
87964
+ clipPathUnits: 1,
87965
+ clipRule: 1,
87966
+ "clip-rule": "clipRule",
87967
+ color: 0,
87968
+ colorInterpolation: 1,
87969
+ "color-interpolation": "colorInterpolation",
87970
+ colorInterpolationFilters: 1,
87971
+ "color-interpolation-filters": "colorInterpolationFilters",
87972
+ colorProfile: 1,
87973
+ "color-profile": "colorProfile",
87974
+ colorRendering: 1,
87975
+ "color-rendering": "colorRendering",
87976
+ contentScriptType: 1,
87977
+ contentStyleType: 1,
87978
+ cursor: 0,
87979
+ cx: 0,
87980
+ cy: 0,
87981
+ d: 0,
87982
+ datatype: 0,
87983
+ decelerate: 0,
87984
+ descent: 0,
87985
+ diffuseConstant: 1,
87986
+ direction: 0,
87987
+ display: 0,
87988
+ divisor: 0,
87989
+ dominantBaseline: 1,
87990
+ "dominant-baseline": "dominantBaseline",
87991
+ dur: 0,
87992
+ dx: 0,
87993
+ dy: 0,
87994
+ edgeMode: 1,
87995
+ elevation: 0,
87996
+ enableBackground: 1,
87997
+ "enable-background": "enableBackground",
87998
+ end: 0,
87999
+ exponent: 0,
88000
+ externalResourcesRequired: 1,
88001
+ fill: 0,
88002
+ fillOpacity: 1,
88003
+ "fill-opacity": "fillOpacity",
88004
+ fillRule: 1,
88005
+ "fill-rule": "fillRule",
88006
+ filter: 0,
88007
+ filterRes: 1,
88008
+ filterUnits: 1,
88009
+ floodOpacity: 1,
88010
+ "flood-opacity": "floodOpacity",
88011
+ floodColor: 1,
88012
+ "flood-color": "floodColor",
88013
+ focusable: 0,
88014
+ fontFamily: 1,
88015
+ "font-family": "fontFamily",
88016
+ fontSize: 1,
88017
+ "font-size": "fontSize",
88018
+ fontSizeAdjust: 1,
88019
+ "font-size-adjust": "fontSizeAdjust",
88020
+ fontStretch: 1,
88021
+ "font-stretch": "fontStretch",
88022
+ fontStyle: 1,
88023
+ "font-style": "fontStyle",
88024
+ fontVariant: 1,
88025
+ "font-variant": "fontVariant",
88026
+ fontWeight: 1,
88027
+ "font-weight": "fontWeight",
88028
+ format: 0,
88029
+ from: 0,
88030
+ fx: 0,
88031
+ fy: 0,
88032
+ g1: 0,
88033
+ g2: 0,
88034
+ glyphName: 1,
88035
+ "glyph-name": "glyphName",
88036
+ glyphOrientationHorizontal: 1,
88037
+ "glyph-orientation-horizontal": "glyphOrientationHorizontal",
88038
+ glyphOrientationVertical: 1,
88039
+ "glyph-orientation-vertical": "glyphOrientationVertical",
88040
+ glyphRef: 1,
88041
+ gradientTransform: 1,
88042
+ gradientUnits: 1,
88043
+ hanging: 0,
88044
+ horizAdvX: 1,
88045
+ "horiz-adv-x": "horizAdvX",
88046
+ horizOriginX: 1,
88047
+ "horiz-origin-x": "horizOriginX",
88048
+ ideographic: 0,
88049
+ imageRendering: 1,
88050
+ "image-rendering": "imageRendering",
88051
+ in2: 0,
88052
+ in: 0,
88053
+ inlist: 0,
88054
+ intercept: 0,
88055
+ k1: 0,
88056
+ k2: 0,
88057
+ k3: 0,
88058
+ k4: 0,
88059
+ k: 0,
88060
+ kernelMatrix: 1,
88061
+ kernelUnitLength: 1,
88062
+ kerning: 0,
88063
+ keyPoints: 1,
88064
+ keySplines: 1,
88065
+ keyTimes: 1,
88066
+ lengthAdjust: 1,
88067
+ letterSpacing: 1,
88068
+ "letter-spacing": "letterSpacing",
88069
+ lightingColor: 1,
88070
+ "lighting-color": "lightingColor",
88071
+ limitingConeAngle: 1,
88072
+ local: 0,
88073
+ markerEnd: 1,
88074
+ "marker-end": "markerEnd",
88075
+ markerHeight: 1,
88076
+ markerMid: 1,
88077
+ "marker-mid": "markerMid",
88078
+ markerStart: 1,
88079
+ "marker-start": "markerStart",
88080
+ markerUnits: 1,
88081
+ markerWidth: 1,
88082
+ mask: 0,
88083
+ maskContentUnits: 1,
88084
+ maskUnits: 1,
88085
+ mathematical: 0,
88086
+ mode: 0,
88087
+ numOctaves: 1,
88088
+ offset: 0,
88089
+ opacity: 0,
88090
+ operator: 0,
88091
+ order: 0,
88092
+ orient: 0,
88093
+ orientation: 0,
88094
+ origin: 0,
88095
+ overflow: 0,
88096
+ overlinePosition: 1,
88097
+ "overline-position": "overlinePosition",
88098
+ overlineThickness: 1,
88099
+ "overline-thickness": "overlineThickness",
88100
+ paintOrder: 1,
88101
+ "paint-order": "paintOrder",
88102
+ panose1: 0,
88103
+ "panose-1": "panose1",
88104
+ pathLength: 1,
88105
+ patternContentUnits: 1,
88106
+ patternTransform: 1,
88107
+ patternUnits: 1,
88108
+ pointerEvents: 1,
88109
+ "pointer-events": "pointerEvents",
88110
+ points: 0,
88111
+ pointsAtX: 1,
88112
+ pointsAtY: 1,
88113
+ pointsAtZ: 1,
88114
+ prefix: 0,
88115
+ preserveAlpha: 1,
88116
+ preserveAspectRatio: 1,
88117
+ primitiveUnits: 1,
88118
+ property: 0,
88119
+ r: 0,
88120
+ radius: 0,
88121
+ refX: 1,
88122
+ refY: 1,
88123
+ renderingIntent: 1,
88124
+ "rendering-intent": "renderingIntent",
88125
+ repeatCount: 1,
88126
+ repeatDur: 1,
88127
+ requiredExtensions: 1,
88128
+ requiredFeatures: 1,
88129
+ resource: 0,
88130
+ restart: 0,
88131
+ result: 0,
88132
+ results: 0,
88133
+ rotate: 0,
88134
+ rx: 0,
88135
+ ry: 0,
88136
+ scale: 0,
88137
+ security: 0,
88138
+ seed: 0,
88139
+ shapeRendering: 1,
88140
+ "shape-rendering": "shapeRendering",
88141
+ slope: 0,
88142
+ spacing: 0,
88143
+ specularConstant: 1,
88144
+ specularExponent: 1,
88145
+ speed: 0,
88146
+ spreadMethod: 1,
88147
+ startOffset: 1,
88148
+ stdDeviation: 1,
88149
+ stemh: 0,
88150
+ stemv: 0,
88151
+ stitchTiles: 1,
88152
+ stopColor: 1,
88153
+ "stop-color": "stopColor",
88154
+ stopOpacity: 1,
88155
+ "stop-opacity": "stopOpacity",
88156
+ strikethroughPosition: 1,
88157
+ "strikethrough-position": "strikethroughPosition",
88158
+ strikethroughThickness: 1,
88159
+ "strikethrough-thickness": "strikethroughThickness",
88160
+ string: 0,
88161
+ stroke: 0,
88162
+ strokeDasharray: 1,
88163
+ "stroke-dasharray": "strokeDasharray",
88164
+ strokeDashoffset: 1,
88165
+ "stroke-dashoffset": "strokeDashoffset",
88166
+ strokeLinecap: 1,
88167
+ "stroke-linecap": "strokeLinecap",
88168
+ strokeLinejoin: 1,
88169
+ "stroke-linejoin": "strokeLinejoin",
88170
+ strokeMiterlimit: 1,
88171
+ "stroke-miterlimit": "strokeMiterlimit",
88172
+ strokeWidth: 1,
88173
+ "stroke-width": "strokeWidth",
88174
+ strokeOpacity: 1,
88175
+ "stroke-opacity": "strokeOpacity",
88176
+ suppressContentEditableWarning: 1,
88177
+ suppressHydrationWarning: 1,
88178
+ surfaceScale: 1,
88179
+ systemLanguage: 1,
88180
+ tableValues: 1,
88181
+ targetX: 1,
88182
+ targetY: 1,
88183
+ textAnchor: 1,
88184
+ "text-anchor": "textAnchor",
88185
+ textDecoration: 1,
88186
+ "text-decoration": "textDecoration",
88187
+ textLength: 1,
88188
+ textRendering: 1,
88189
+ "text-rendering": "textRendering",
88190
+ to: 0,
88191
+ transform: 0,
88192
+ typeof: 0,
88193
+ u1: 0,
88194
+ u2: 0,
88195
+ underlinePosition: 1,
88196
+ "underline-position": "underlinePosition",
88197
+ underlineThickness: 1,
88198
+ "underline-thickness": "underlineThickness",
88199
+ unicode: 0,
88200
+ unicodeBidi: 1,
88201
+ "unicode-bidi": "unicodeBidi",
88202
+ unicodeRange: 1,
88203
+ "unicode-range": "unicodeRange",
88204
+ unitsPerEm: 1,
88205
+ "units-per-em": "unitsPerEm",
88206
+ unselectable: 0,
88207
+ vAlphabetic: 1,
88208
+ "v-alphabetic": "vAlphabetic",
88209
+ values: 0,
88210
+ vectorEffect: 1,
88211
+ "vector-effect": "vectorEffect",
88212
+ version: 0,
88213
+ vertAdvY: 1,
88214
+ "vert-adv-y": "vertAdvY",
88215
+ vertOriginX: 1,
88216
+ "vert-origin-x": "vertOriginX",
88217
+ vertOriginY: 1,
88218
+ "vert-origin-y": "vertOriginY",
88219
+ vHanging: 1,
88220
+ "v-hanging": "vHanging",
88221
+ vIdeographic: 1,
88222
+ "v-ideographic": "vIdeographic",
88223
+ viewBox: 1,
88224
+ viewTarget: 1,
88225
+ visibility: 0,
88226
+ vMathematical: 1,
88227
+ "v-mathematical": "vMathematical",
88228
+ vocab: 0,
88229
+ widths: 0,
88230
+ wordSpacing: 1,
88231
+ "word-spacing": "wordSpacing",
88232
+ writingMode: 1,
88233
+ "writing-mode": "writingMode",
88234
+ x1: 0,
88235
+ x2: 0,
88236
+ x: 0,
88237
+ xChannelSelector: 1,
88238
+ xHeight: 1,
88239
+ "x-height": "xHeight",
88240
+ xlinkActuate: 1,
88241
+ "xlink:actuate": "xlinkActuate",
88242
+ xlinkArcrole: 1,
88243
+ "xlink:arcrole": "xlinkArcrole",
88244
+ xlinkHref: 1,
88245
+ "xlink:href": "xlinkHref",
88246
+ xlinkRole: 1,
88247
+ "xlink:role": "xlinkRole",
88248
+ xlinkShow: 1,
88249
+ "xlink:show": "xlinkShow",
88250
+ xlinkTitle: 1,
88251
+ "xlink:title": "xlinkTitle",
88252
+ xlinkType: 1,
88253
+ "xlink:type": "xlinkType",
88254
+ xmlBase: 1,
88255
+ "xml:base": "xmlBase",
88256
+ xmlLang: 1,
88257
+ "xml:lang": "xmlLang",
88258
+ xmlns: 0,
88259
+ "xml:space": "xmlSpace",
88260
+ xmlnsXlink: 1,
88261
+ "xmlns:xlink": "xmlnsXlink",
88262
+ xmlSpace: 1,
88263
+ y1: 0,
88264
+ y2: 0,
88265
+ y: 0,
88266
+ yChannelSelector: 1,
88267
+ z: 0,
88268
+ zoomAndPan: 1
88269
+ };
88270
+ return possibleStandardNamesOptimized;
88271
+ }
88272
+ var hasRequiredLib$1;
88273
+ function requireLib$1() {
88274
+ if (hasRequiredLib$1) return lib;
88275
+ hasRequiredLib$1 = 1;
88276
+ const RESERVED = 0;
88277
+ const STRING = 1;
88278
+ const BOOLEANISH_STRING = 2;
88279
+ const BOOLEAN = 3;
88280
+ const OVERLOADED_BOOLEAN = 4;
88281
+ const NUMERIC = 5;
88282
+ const POSITIVE_NUMERIC = 6;
88283
+ function getPropertyInfo(name2) {
88284
+ return properties.hasOwnProperty(name2) ? properties[name2] : null;
88285
+ }
88286
+ function PropertyInfoRecord(name2, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
88287
+ this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
88288
+ this.attributeName = attributeName;
88289
+ this.attributeNamespace = attributeNamespace;
88290
+ this.mustUseProperty = mustUseProperty;
88291
+ this.propertyName = name2;
88292
+ this.type = type;
88293
+ this.sanitizeURL = sanitizeURL;
88294
+ this.removeEmptyString = removeEmptyString;
88295
+ }
88296
+ const properties = {};
88297
+ const reservedProps = [
88298
+ "children",
88299
+ "dangerouslySetInnerHTML",
88300
+ // TODO: This prevents the assignment of defaultValue to regular
88301
+ // elements (not just inputs). Now that ReactDOMInput assigns to the
88302
+ // defaultValue property -- do we need this?
88303
+ "defaultValue",
88304
+ "defaultChecked",
88305
+ "innerHTML",
88306
+ "suppressContentEditableWarning",
88307
+ "suppressHydrationWarning",
88308
+ "style"
88309
+ ];
88310
+ reservedProps.forEach((name2) => {
88311
+ properties[name2] = new PropertyInfoRecord(
88312
+ name2,
88313
+ RESERVED,
88314
+ false,
88315
+ // mustUseProperty
88316
+ name2,
88317
+ // attributeName
88318
+ null,
88319
+ // attributeNamespace
88320
+ false,
88321
+ // sanitizeURL
88322
+ false
88323
+ // removeEmptyString
88324
+ );
88325
+ });
88326
+ [
88327
+ ["acceptCharset", "accept-charset"],
88328
+ ["className", "class"],
88329
+ ["htmlFor", "for"],
88330
+ ["httpEquiv", "http-equiv"]
88331
+ ].forEach(([name2, attributeName]) => {
88332
+ properties[name2] = new PropertyInfoRecord(
88333
+ name2,
88334
+ STRING,
88335
+ false,
88336
+ // mustUseProperty
88337
+ attributeName,
88338
+ // attributeName
88339
+ null,
88340
+ // attributeNamespace
88341
+ false,
88342
+ // sanitizeURL
88343
+ false
88344
+ // removeEmptyString
88345
+ );
88346
+ });
88347
+ ["contentEditable", "draggable", "spellCheck", "value"].forEach((name2) => {
88348
+ properties[name2] = new PropertyInfoRecord(
88349
+ name2,
88350
+ BOOLEANISH_STRING,
88351
+ false,
88352
+ // mustUseProperty
88353
+ name2.toLowerCase(),
88354
+ // attributeName
88355
+ null,
88356
+ // attributeNamespace
88357
+ false,
88358
+ // sanitizeURL
88359
+ false
88360
+ // removeEmptyString
88361
+ );
88362
+ });
88363
+ [
88364
+ "autoReverse",
88365
+ "externalResourcesRequired",
88366
+ "focusable",
88367
+ "preserveAlpha"
88368
+ ].forEach((name2) => {
88369
+ properties[name2] = new PropertyInfoRecord(
88370
+ name2,
88371
+ BOOLEANISH_STRING,
88372
+ false,
88373
+ // mustUseProperty
88374
+ name2,
88375
+ // attributeName
88376
+ null,
88377
+ // attributeNamespace
88378
+ false,
88379
+ // sanitizeURL
88380
+ false
88381
+ // removeEmptyString
88382
+ );
88383
+ });
88384
+ [
88385
+ "allowFullScreen",
88386
+ "async",
88387
+ // Note: there is a special case that prevents it from being written to the DOM
88388
+ // on the client side because the browsers are inconsistent. Instead we call focus().
88389
+ "autoFocus",
88390
+ "autoPlay",
88391
+ "controls",
88392
+ "default",
88393
+ "defer",
88394
+ "disabled",
88395
+ "disablePictureInPicture",
88396
+ "disableRemotePlayback",
88397
+ "formNoValidate",
88398
+ "hidden",
88399
+ "loop",
88400
+ "noModule",
88401
+ "noValidate",
88402
+ "open",
88403
+ "playsInline",
88404
+ "readOnly",
88405
+ "required",
88406
+ "reversed",
88407
+ "scoped",
88408
+ "seamless",
88409
+ // Microdata
88410
+ "itemScope"
88411
+ ].forEach((name2) => {
88412
+ properties[name2] = new PropertyInfoRecord(
88413
+ name2,
88414
+ BOOLEAN,
88415
+ false,
88416
+ // mustUseProperty
88417
+ name2.toLowerCase(),
88418
+ // attributeName
88419
+ null,
88420
+ // attributeNamespace
88421
+ false,
88422
+ // sanitizeURL
88423
+ false
88424
+ // removeEmptyString
88425
+ );
88426
+ });
88427
+ [
88428
+ "checked",
88429
+ // Note: `option.selected` is not updated if `select.multiple` is
88430
+ // disabled with `removeAttribute`. We have special logic for handling this.
88431
+ "multiple",
88432
+ "muted",
88433
+ "selected"
88434
+ // NOTE: if you add a camelCased prop to this list,
88435
+ // you'll need to set attributeName to name.toLowerCase()
88436
+ // instead in the assignment below.
88437
+ ].forEach((name2) => {
88438
+ properties[name2] = new PropertyInfoRecord(
88439
+ name2,
88440
+ BOOLEAN,
88441
+ true,
88442
+ // mustUseProperty
88443
+ name2,
88444
+ // attributeName
88445
+ null,
88446
+ // attributeNamespace
88447
+ false,
88448
+ // sanitizeURL
88449
+ false
88450
+ // removeEmptyString
88451
+ );
88452
+ });
88453
+ [
88454
+ "capture",
88455
+ "download"
88456
+ // NOTE: if you add a camelCased prop to this list,
88457
+ // you'll need to set attributeName to name.toLowerCase()
88458
+ // instead in the assignment below.
88459
+ ].forEach((name2) => {
88460
+ properties[name2] = new PropertyInfoRecord(
88461
+ name2,
88462
+ OVERLOADED_BOOLEAN,
88463
+ false,
88464
+ // mustUseProperty
88465
+ name2,
88466
+ // attributeName
88467
+ null,
88468
+ // attributeNamespace
88469
+ false,
88470
+ // sanitizeURL
88471
+ false
88472
+ // removeEmptyString
88473
+ );
88474
+ });
88475
+ [
88476
+ "cols",
88477
+ "rows",
88478
+ "size",
88479
+ "span"
88480
+ // NOTE: if you add a camelCased prop to this list,
88481
+ // you'll need to set attributeName to name.toLowerCase()
88482
+ // instead in the assignment below.
88483
+ ].forEach((name2) => {
88484
+ properties[name2] = new PropertyInfoRecord(
88485
+ name2,
88486
+ POSITIVE_NUMERIC,
88487
+ false,
88488
+ // mustUseProperty
88489
+ name2,
88490
+ // attributeName
88491
+ null,
88492
+ // attributeNamespace
88493
+ false,
88494
+ // sanitizeURL
88495
+ false
88496
+ // removeEmptyString
88497
+ );
88498
+ });
88499
+ ["rowSpan", "start"].forEach((name2) => {
88500
+ properties[name2] = new PropertyInfoRecord(
88501
+ name2,
88502
+ NUMERIC,
88503
+ false,
88504
+ // mustUseProperty
88505
+ name2.toLowerCase(),
88506
+ // attributeName
88507
+ null,
88508
+ // attributeNamespace
88509
+ false,
88510
+ // sanitizeURL
88511
+ false
88512
+ // removeEmptyString
88513
+ );
88514
+ });
88515
+ const CAMELIZE = /[\-\:]([a-z])/g;
88516
+ const capitalize2 = (token2) => token2[1].toUpperCase();
88517
+ [
88518
+ "accent-height",
88519
+ "alignment-baseline",
88520
+ "arabic-form",
88521
+ "baseline-shift",
88522
+ "cap-height",
88523
+ "clip-path",
88524
+ "clip-rule",
88525
+ "color-interpolation",
88526
+ "color-interpolation-filters",
88527
+ "color-profile",
88528
+ "color-rendering",
88529
+ "dominant-baseline",
88530
+ "enable-background",
88531
+ "fill-opacity",
88532
+ "fill-rule",
88533
+ "flood-color",
88534
+ "flood-opacity",
88535
+ "font-family",
88536
+ "font-size",
88537
+ "font-size-adjust",
88538
+ "font-stretch",
88539
+ "font-style",
88540
+ "font-variant",
88541
+ "font-weight",
88542
+ "glyph-name",
88543
+ "glyph-orientation-horizontal",
88544
+ "glyph-orientation-vertical",
88545
+ "horiz-adv-x",
88546
+ "horiz-origin-x",
88547
+ "image-rendering",
88548
+ "letter-spacing",
88549
+ "lighting-color",
88550
+ "marker-end",
88551
+ "marker-mid",
88552
+ "marker-start",
88553
+ "overline-position",
88554
+ "overline-thickness",
88555
+ "paint-order",
88556
+ "panose-1",
88557
+ "pointer-events",
88558
+ "rendering-intent",
88559
+ "shape-rendering",
88560
+ "stop-color",
88561
+ "stop-opacity",
88562
+ "strikethrough-position",
88563
+ "strikethrough-thickness",
88564
+ "stroke-dasharray",
88565
+ "stroke-dashoffset",
88566
+ "stroke-linecap",
88567
+ "stroke-linejoin",
88568
+ "stroke-miterlimit",
88569
+ "stroke-opacity",
88570
+ "stroke-width",
88571
+ "text-anchor",
88572
+ "text-decoration",
88573
+ "text-rendering",
88574
+ "underline-position",
88575
+ "underline-thickness",
88576
+ "unicode-bidi",
88577
+ "unicode-range",
88578
+ "units-per-em",
88579
+ "v-alphabetic",
88580
+ "v-hanging",
88581
+ "v-ideographic",
88582
+ "v-mathematical",
88583
+ "vector-effect",
88584
+ "vert-adv-y",
88585
+ "vert-origin-x",
88586
+ "vert-origin-y",
88587
+ "word-spacing",
88588
+ "writing-mode",
88589
+ "xmlns:xlink",
88590
+ "x-height"
88591
+ // NOTE: if you add a camelCased prop to this list,
88592
+ // you'll need to set attributeName to name.toLowerCase()
88593
+ // instead in the assignment below.
88594
+ ].forEach((attributeName) => {
88595
+ const name2 = attributeName.replace(CAMELIZE, capitalize2);
88596
+ properties[name2] = new PropertyInfoRecord(
88597
+ name2,
88598
+ STRING,
88599
+ false,
88600
+ // mustUseProperty
88601
+ attributeName,
88602
+ null,
88603
+ // attributeNamespace
88604
+ false,
88605
+ // sanitizeURL
88606
+ false
88607
+ // removeEmptyString
88608
+ );
88609
+ });
88610
+ [
88611
+ "xlink:actuate",
88612
+ "xlink:arcrole",
88613
+ "xlink:role",
88614
+ "xlink:show",
88615
+ "xlink:title",
88616
+ "xlink:type"
88617
+ // NOTE: if you add a camelCased prop to this list,
88618
+ // you'll need to set attributeName to name.toLowerCase()
88619
+ // instead in the assignment below.
88620
+ ].forEach((attributeName) => {
88621
+ const name2 = attributeName.replace(CAMELIZE, capitalize2);
88622
+ properties[name2] = new PropertyInfoRecord(
88623
+ name2,
88624
+ STRING,
88625
+ false,
88626
+ // mustUseProperty
88627
+ attributeName,
88628
+ "http://www.w3.org/1999/xlink",
88629
+ false,
88630
+ // sanitizeURL
88631
+ false
88632
+ // removeEmptyString
88633
+ );
88634
+ });
88635
+ [
88636
+ "xml:base",
88637
+ "xml:lang",
88638
+ "xml:space"
88639
+ // NOTE: if you add a camelCased prop to this list,
88640
+ // you'll need to set attributeName to name.toLowerCase()
88641
+ // instead in the assignment below.
88642
+ ].forEach((attributeName) => {
88643
+ const name2 = attributeName.replace(CAMELIZE, capitalize2);
88644
+ properties[name2] = new PropertyInfoRecord(
88645
+ name2,
88646
+ STRING,
88647
+ false,
88648
+ // mustUseProperty
88649
+ attributeName,
88650
+ "http://www.w3.org/XML/1998/namespace",
88651
+ false,
88652
+ // sanitizeURL
88653
+ false
88654
+ // removeEmptyString
88655
+ );
88656
+ });
88657
+ ["tabIndex", "crossOrigin"].forEach((attributeName) => {
88658
+ properties[attributeName] = new PropertyInfoRecord(
88659
+ attributeName,
88660
+ STRING,
88661
+ false,
88662
+ // mustUseProperty
88663
+ attributeName.toLowerCase(),
88664
+ // attributeName
88665
+ null,
88666
+ // attributeNamespace
88667
+ false,
88668
+ // sanitizeURL
88669
+ false
88670
+ // removeEmptyString
88671
+ );
88672
+ });
88673
+ const xlinkHref = "xlinkHref";
88674
+ properties[xlinkHref] = new PropertyInfoRecord(
88675
+ "xlinkHref",
88676
+ STRING,
88677
+ false,
88678
+ // mustUseProperty
88679
+ "xlink:href",
88680
+ "http://www.w3.org/1999/xlink",
88681
+ true,
88682
+ // sanitizeURL
88683
+ false
88684
+ // removeEmptyString
88685
+ );
88686
+ ["src", "href", "action", "formAction"].forEach((attributeName) => {
88687
+ properties[attributeName] = new PropertyInfoRecord(
88688
+ attributeName,
88689
+ STRING,
88690
+ false,
88691
+ // mustUseProperty
88692
+ attributeName.toLowerCase(),
88693
+ // attributeName
88694
+ null,
88695
+ // attributeNamespace
88696
+ true,
88697
+ // sanitizeURL
88698
+ true
88699
+ // removeEmptyString
88700
+ );
88701
+ });
88702
+ const {
88703
+ CAMELCASE,
88704
+ SAME,
88705
+ possibleStandardNames: possibleStandardNamesOptimized2
88706
+ } = requirePossibleStandardNamesOptimized();
88707
+ const ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
88708
+ const ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
88709
+ const isCustomAttribute = RegExp.prototype.test.bind(
88710
+ // eslint-disable-next-line no-misleading-character-class
88711
+ new RegExp("^(data|aria)-[" + ATTRIBUTE_NAME_CHAR + "]*$")
88712
+ );
88713
+ const possibleStandardNames = Object.keys(
88714
+ possibleStandardNamesOptimized2
88715
+ ).reduce((accumulator, standardName) => {
88716
+ const propName = possibleStandardNamesOptimized2[standardName];
88717
+ if (propName === SAME) {
88718
+ accumulator[standardName] = standardName;
88719
+ } else if (propName === CAMELCASE) {
88720
+ accumulator[standardName.toLowerCase()] = standardName;
88721
+ } else {
88722
+ accumulator[standardName] = propName;
88723
+ }
88724
+ return accumulator;
88725
+ }, {});
88726
+ lib.BOOLEAN = BOOLEAN;
88727
+ lib.BOOLEANISH_STRING = BOOLEANISH_STRING;
88728
+ lib.NUMERIC = NUMERIC;
88729
+ lib.OVERLOADED_BOOLEAN = OVERLOADED_BOOLEAN;
88730
+ lib.POSITIVE_NUMERIC = POSITIVE_NUMERIC;
88731
+ lib.RESERVED = RESERVED;
88732
+ lib.STRING = STRING;
88733
+ lib.getPropertyInfo = getPropertyInfo;
88734
+ lib.isCustomAttribute = isCustomAttribute;
88735
+ lib.possibleStandardNames = possibleStandardNames;
88736
+ return lib;
88737
+ }
88738
+ var utilities = {};
88739
+ var hasRequiredUtilities;
88740
+ function requireUtilities() {
88741
+ if (hasRequiredUtilities) return utilities;
88742
+ hasRequiredUtilities = 1;
88743
+ (function(exports) {
88744
+ var __importDefault = utilities && utilities.__importDefault || function(mod) {
88745
+ return mod && mod.__esModule ? mod : { "default": mod };
88746
+ };
88747
+ Object.defineProperty(exports, "__esModule", { value: true });
88748
+ exports.returnFirstArg = exports.canTextBeChildOfNode = exports.ELEMENTS_WITH_NO_TEXT_CHILDREN = exports.PRESERVE_CUSTOM_ATTRIBUTES = void 0;
88749
+ exports.isCustomComponent = isCustomComponent;
88750
+ exports.setStyleProp = setStyleProp;
88751
+ var react_1 = requireReact();
88752
+ var style_to_js_1 = __importDefault(requireCjs());
88753
+ var RESERVED_SVG_MATHML_ELEMENTS = /* @__PURE__ */ new Set([
88754
+ "annotation-xml",
88755
+ "color-profile",
88756
+ "font-face",
88757
+ "font-face-src",
88758
+ "font-face-uri",
88759
+ "font-face-format",
88760
+ "font-face-name",
88761
+ "missing-glyph"
88762
+ ]);
88763
+ function isCustomComponent(tagName, props) {
88764
+ if (!tagName.includes("-")) {
88765
+ return Boolean(props && typeof props.is === "string");
88766
+ }
88767
+ if (RESERVED_SVG_MATHML_ELEMENTS.has(tagName)) {
88768
+ return false;
88769
+ }
88770
+ return true;
88771
+ }
88772
+ var styleOptions = {
88773
+ reactCompat: true
88774
+ };
88775
+ function setStyleProp(style, props) {
88776
+ if (typeof style !== "string") {
88777
+ return;
88778
+ }
88779
+ if (!style.trim()) {
88780
+ props.style = {};
88781
+ return;
88782
+ }
88783
+ try {
88784
+ props.style = (0, style_to_js_1.default)(style, styleOptions);
88785
+ } catch (error) {
88786
+ props.style = {};
88787
+ }
88788
+ }
88789
+ exports.PRESERVE_CUSTOM_ATTRIBUTES = Number(react_1.version.split(".")[0]) >= 16;
88790
+ exports.ELEMENTS_WITH_NO_TEXT_CHILDREN = /* @__PURE__ */ new Set([
88791
+ "tr",
88792
+ "tbody",
88793
+ "thead",
88794
+ "tfoot",
88795
+ "colgroup",
88796
+ "table",
88797
+ "head",
88798
+ "html",
88799
+ "frameset"
88800
+ ]);
88801
+ var canTextBeChildOfNode = function(node2) {
88802
+ return !exports.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(node2.name);
88803
+ };
88804
+ exports.canTextBeChildOfNode = canTextBeChildOfNode;
88805
+ var returnFirstArg = function(arg) {
88806
+ return arg;
88807
+ };
88808
+ exports.returnFirstArg = returnFirstArg;
88809
+ })(utilities);
88810
+ return utilities;
88811
+ }
88812
+ var hasRequiredAttributesToProps;
88813
+ function requireAttributesToProps() {
88814
+ if (hasRequiredAttributesToProps) return attributesToProps;
88815
+ hasRequiredAttributesToProps = 1;
88816
+ Object.defineProperty(attributesToProps, "__esModule", { value: true });
88817
+ attributesToProps.default = attributesToProps$1;
88818
+ var react_property_1 = requireLib$1();
88819
+ var utilities_1 = requireUtilities();
88820
+ var UNCONTROLLED_COMPONENT_ATTRIBUTES = ["checked", "value"];
88821
+ var UNCONTROLLED_COMPONENT_NAMES = ["input", "select", "textarea"];
88822
+ var valueOnlyInputs = {
88823
+ reset: true,
88824
+ submit: true
88825
+ };
88826
+ function attributesToProps$1(attributes, nodeName) {
88827
+ if (attributes === void 0) {
88828
+ attributes = {};
88829
+ }
88830
+ var props = {};
88831
+ var isInputValueOnly = Boolean(attributes.type && valueOnlyInputs[attributes.type]);
88832
+ for (var attributeName in attributes) {
88833
+ var attributeValue = attributes[attributeName];
88834
+ if ((0, react_property_1.isCustomAttribute)(attributeName)) {
88835
+ props[attributeName] = attributeValue;
88836
+ continue;
88837
+ }
88838
+ var attributeNameLowerCased = attributeName.toLowerCase();
88839
+ var propName = getPropName(attributeNameLowerCased);
88840
+ if (propName) {
88841
+ var propertyInfo = (0, react_property_1.getPropertyInfo)(propName);
88842
+ if (UNCONTROLLED_COMPONENT_ATTRIBUTES.includes(propName) && UNCONTROLLED_COMPONENT_NAMES.includes(nodeName) && !isInputValueOnly) {
88843
+ propName = getPropName("default" + attributeNameLowerCased);
88844
+ }
88845
+ props[propName] = attributeValue;
88846
+ switch (propertyInfo && propertyInfo.type) {
88847
+ case react_property_1.BOOLEAN:
88848
+ props[propName] = true;
88849
+ break;
88850
+ case react_property_1.OVERLOADED_BOOLEAN:
88851
+ if (attributeValue === "") {
88852
+ props[propName] = true;
88853
+ }
88854
+ break;
88855
+ }
88856
+ continue;
88857
+ }
88858
+ if (utilities_1.PRESERVE_CUSTOM_ATTRIBUTES) {
88859
+ props[attributeName] = attributeValue;
88860
+ }
88861
+ }
88862
+ (0, utilities_1.setStyleProp)(attributes.style, props);
88863
+ return props;
88864
+ }
88865
+ function getPropName(attributeName) {
88866
+ return react_property_1.possibleStandardNames[attributeName];
88867
+ }
88868
+ return attributesToProps;
88869
+ }
88870
+ var domToReact = {};
88871
+ var hasRequiredDomToReact;
88872
+ function requireDomToReact() {
88873
+ if (hasRequiredDomToReact) return domToReact;
88874
+ hasRequiredDomToReact = 1;
88875
+ var __importDefault = domToReact && domToReact.__importDefault || function(mod) {
88876
+ return mod && mod.__esModule ? mod : { "default": mod };
88877
+ };
88878
+ Object.defineProperty(domToReact, "__esModule", { value: true });
88879
+ domToReact.default = domToReact$1;
88880
+ var react_1 = requireReact();
88881
+ var attributes_to_props_1 = __importDefault(requireAttributesToProps());
88882
+ var utilities_1 = requireUtilities();
88883
+ var React2 = {
88884
+ cloneElement: react_1.cloneElement,
88885
+ createElement: react_1.createElement,
88886
+ isValidElement: react_1.isValidElement
88887
+ };
88888
+ function domToReact$1(nodes, options) {
88889
+ if (options === void 0) {
88890
+ options = {};
88891
+ }
88892
+ var reactElements = [];
88893
+ var hasReplace = typeof options.replace === "function";
88894
+ var transform = options.transform || utilities_1.returnFirstArg;
88895
+ var _a = options.library || React2, cloneElement = _a.cloneElement, createElement2 = _a.createElement, isValidElement = _a.isValidElement;
88896
+ var nodesLength = nodes.length;
88897
+ for (var index2 = 0; index2 < nodesLength; index2++) {
88898
+ var node2 = nodes[index2];
88899
+ if (hasReplace) {
88900
+ var replaceElement = options.replace(node2, index2);
88901
+ if (isValidElement(replaceElement)) {
88902
+ if (nodesLength > 1) {
88903
+ replaceElement = cloneElement(replaceElement, {
88904
+ key: replaceElement.key || index2
88905
+ });
88906
+ }
88907
+ reactElements.push(transform(replaceElement, node2, index2));
88908
+ continue;
88909
+ }
88910
+ }
88911
+ if (node2.type === "text") {
88912
+ var isWhitespace = !node2.data.trim().length;
88913
+ if (isWhitespace && node2.parent && !(0, utilities_1.canTextBeChildOfNode)(node2.parent)) {
88914
+ continue;
88915
+ }
88916
+ if (options.trim && isWhitespace) {
88917
+ continue;
88918
+ }
88919
+ reactElements.push(transform(node2.data, node2, index2));
88920
+ continue;
88921
+ }
88922
+ var element2 = node2;
88923
+ var props = {};
88924
+ if (skipAttributesToProps(element2)) {
88925
+ (0, utilities_1.setStyleProp)(element2.attribs.style, element2.attribs);
88926
+ props = element2.attribs;
88927
+ } else if (element2.attribs) {
88928
+ props = (0, attributes_to_props_1.default)(element2.attribs, element2.name);
88929
+ }
88930
+ var children = void 0;
88931
+ switch (node2.type) {
88932
+ case "script":
88933
+ case "style":
88934
+ if (node2.children[0]) {
88935
+ props.dangerouslySetInnerHTML = {
88936
+ __html: node2.children[0].data
88937
+ };
88938
+ }
88939
+ break;
88940
+ case "tag":
88941
+ if (node2.name === "textarea" && node2.children[0]) {
88942
+ props.defaultValue = node2.children[0].data;
88943
+ } else if (node2.children && node2.children.length) {
88944
+ children = domToReact$1(node2.children, options);
88945
+ }
88946
+ break;
88947
+ // skip all other cases (e.g., comment)
88948
+ default:
88949
+ continue;
88950
+ }
88951
+ if (nodesLength > 1) {
88952
+ props.key = index2;
88953
+ }
88954
+ reactElements.push(transform(createElement2(node2.name, props, children), node2, index2));
88955
+ }
88956
+ return reactElements.length === 1 ? reactElements[0] : reactElements;
88957
+ }
88958
+ function skipAttributesToProps(node2) {
88959
+ return utilities_1.PRESERVE_CUSTOM_ATTRIBUTES && node2.type === "tag" && (0, utilities_1.isCustomComponent)(node2.name, node2.attribs);
88960
+ }
88961
+ return domToReact;
88962
+ }
88963
+ var hasRequiredLib;
88964
+ function requireLib() {
88965
+ if (hasRequiredLib) return lib$3;
88966
+ hasRequiredLib = 1;
88967
+ (function(exports) {
88968
+ var __importDefault = lib$3 && lib$3.__importDefault || function(mod) {
88969
+ return mod && mod.__esModule ? mod : { "default": mod };
88970
+ };
88971
+ Object.defineProperty(exports, "__esModule", { value: true });
88972
+ exports.htmlToDOM = exports.domToReact = exports.attributesToProps = exports.Text = exports.ProcessingInstruction = exports.Element = exports.Comment = void 0;
88973
+ exports.default = HTMLReactParser2;
88974
+ var html_dom_parser_1 = __importDefault(requireHtmlToDom());
88975
+ exports.htmlToDOM = html_dom_parser_1.default;
88976
+ var attributes_to_props_1 = __importDefault(requireAttributesToProps());
88977
+ exports.attributesToProps = attributes_to_props_1.default;
88978
+ var dom_to_react_1 = __importDefault(requireDomToReact());
88979
+ exports.domToReact = dom_to_react_1.default;
88980
+ var domhandler_1 = /* @__PURE__ */ requireLib$2();
88981
+ Object.defineProperty(exports, "Comment", { enumerable: true, get: function() {
88982
+ return domhandler_1.Comment;
88983
+ } });
88984
+ Object.defineProperty(exports, "Element", { enumerable: true, get: function() {
88985
+ return domhandler_1.Element;
88986
+ } });
88987
+ Object.defineProperty(exports, "ProcessingInstruction", { enumerable: true, get: function() {
88988
+ return domhandler_1.ProcessingInstruction;
88989
+ } });
88990
+ Object.defineProperty(exports, "Text", { enumerable: true, get: function() {
88991
+ return domhandler_1.Text;
88992
+ } });
88993
+ var domParserOptions = { lowerCaseAttributeNames: false };
88994
+ function HTMLReactParser2(html2, options) {
88995
+ if (typeof html2 !== "string") {
88996
+ throw new TypeError("First argument must be a string");
88997
+ }
88998
+ if (!html2) {
88999
+ return [];
89000
+ }
89001
+ return (0, dom_to_react_1.default)((0, html_dom_parser_1.default)(html2, (options === null || options === void 0 ? void 0 : options.htmlparser2) || domParserOptions), options);
89002
+ }
89003
+ })(lib$3);
89004
+ return lib$3;
89005
+ }
89006
+ var libExports = requireLib();
89007
+ const HTMLReactParser = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
89008
+ const parse = HTMLReactParser.default || HTMLReactParser;
89009
+ const DEFAULT_DEFER_TIMELINE_MS = 48 * 60 * 60 * 1e3;
89010
+ const useDeferredUpdatesStore = create$1()(
89011
+ persist(
89012
+ (set, get) => ({
89013
+ deferredVersion: null,
89014
+ deferredAt: null,
89015
+ deferUpdate: (version) => {
89016
+ set({
89017
+ deferredVersion: version,
89018
+ deferredAt: Date.now()
89019
+ });
89020
+ },
89021
+ shouldShowUpdate: (version) => {
89022
+ const { deferredVersion, deferredAt } = get();
89023
+ if (!deferredVersion || !deferredAt) {
89024
+ return true;
89025
+ }
89026
+ if (deferredVersion !== version) {
89027
+ return true;
89028
+ }
89029
+ const now = Date.now();
89030
+ const timeElapsed = now - deferredAt;
89031
+ return timeElapsed > DEFAULT_DEFER_TIMELINE_MS;
89032
+ },
89033
+ clearDeferredUpdate: () => {
89034
+ set({
89035
+ deferredVersion: null,
89036
+ deferredAt: null
89037
+ });
89038
+ }
89039
+ }),
89040
+ {
89041
+ name: "deferred-updates-storage"
89042
+ }
89043
+ )
89044
+ );
86412
89045
  const UpdateContainer = styled$1("div")(({ theme: theme2 }) => ({
86413
- padding: 16,
89046
+ padding: 24,
86414
89047
  borderRadius: 8,
86415
89048
  backgroundColor: theme2.palette.background.paper,
86416
- boxShadow: "0 2px 10px rgba(0, 0, 0, 0.1)",
86417
- marginBottom: 16
89049
+ boxShadow: "0 4px 20px rgba(0, 0, 0, 0.15)",
89050
+ position: "fixed",
89051
+ top: 20,
89052
+ right: 20,
89053
+ zIndex: 1300,
89054
+ // Higher than most components but below modal dialogs
89055
+ width: 560,
89056
+ // Responsive width with margins
89057
+ "& a": {
89058
+ color: theme2.palette.primary.main,
89059
+ textDecoration: "none",
89060
+ "&:hover": {
89061
+ textDecoration: "underline"
89062
+ }
89063
+ }
86418
89064
  }));
86419
89065
  const UpdateActions = styled$1("div")({
86420
89066
  display: "flex",
86421
89067
  justifyContent: "flex-end",
86422
89068
  gap: 8,
86423
- marginTop: 16
89069
+ marginTop: 24
86424
89070
  });
86425
89071
  const ProgressContainer = styled$1("div")({
86426
89072
  marginTop: 16,
@@ -86430,6 +89076,7 @@ const UpdateNotification = ({
86430
89076
  autoCheck = true
86431
89077
  }) => {
86432
89078
  const [checking, setChecking] = reactExports.useState(false);
89079
+ const [updatingBackend, setUpdatingBackend] = reactExports.useState(false);
86433
89080
  const [updateAvailable, setUpdateAvailable] = reactExports.useState(false);
86434
89081
  const [updateInfo, setUpdateInfo] = reactExports.useState(null);
86435
89082
  const [downloading, setDownloading] = reactExports.useState(false);
@@ -86439,6 +89086,16 @@ const UpdateNotification = ({
86439
89086
  const [updateDownloaded, setUpdateDownloaded] = reactExports.useState(false);
86440
89087
  const [error, setError] = reactExports.useState(null);
86441
89088
  const [snackbarOpen, setSnackbarOpen] = reactExports.useState(false);
89089
+ const [appVersion, setAppVersion] = reactExports.useState("unknown");
89090
+ const [backendUpdateAvailable, setBackendUpdateAvailable] = reactExports.useState(false);
89091
+ const [backendUpdateInfo, setBackendUpdateInfo] = reactExports.useState(null);
89092
+ const [backendUpdateCompleted, setBackendUpdateCompleted] = reactExports.useState(false);
89093
+ const [manualUpdateRequired, setManualUpdateRequired] = reactExports.useState(false);
89094
+ const [manualUpdateInfo, setManualUpdateInfo] = reactExports.useState(null);
89095
+ const { shouldShowUpdate, deferUpdate } = useDeferredUpdatesStore();
89096
+ reactExports.useEffect(() => {
89097
+ window.api.systemInfo.getAppVersion().then((version) => setAppVersion(version)).catch(() => setAppVersion("unknown"));
89098
+ }, []);
86442
89099
  const checkForUpdates = reactExports.useCallback(async () => {
86443
89100
  try {
86444
89101
  setChecking(true);
@@ -86469,12 +89126,45 @@ const UpdateNotification = ({
86469
89126
  const installUpdate = reactExports.useCallback(() => {
86470
89127
  window.api.updater.quitAndInstall();
86471
89128
  }, []);
89129
+ const updateBackend = reactExports.useCallback(async () => {
89130
+ try {
89131
+ setChecking(true);
89132
+ setUpdatingBackend(true);
89133
+ setError(null);
89134
+ await window.api.updater.updateBackend();
89135
+ } catch (err) {
89136
+ setError(
89137
+ `Error updating server: ${err instanceof Error ? err.message : String(err)}`
89138
+ );
89139
+ setSnackbarOpen(true);
89140
+ setChecking(false);
89141
+ setUpdatingBackend(false);
89142
+ }
89143
+ }, []);
89144
+ const handleDeferBackendUpdate = reactExports.useCallback(() => {
89145
+ if (backendUpdateInfo) {
89146
+ deferUpdate(backendUpdateInfo.latestVersion);
89147
+ setSnackbarOpen(false);
89148
+ setBackendUpdateAvailable(false);
89149
+ setBackendUpdateInfo(null);
89150
+ }
89151
+ }, [deferUpdate, backendUpdateInfo]);
89152
+ const handleDeferUpdate = reactExports.useCallback(() => {
89153
+ if (updateInfo) {
89154
+ deferUpdate(updateInfo.version);
89155
+ setSnackbarOpen(false);
89156
+ setUpdateAvailable(false);
89157
+ setUpdateDownloaded(false);
89158
+ }
89159
+ }, [deferUpdate, updateInfo]);
86472
89160
  reactExports.useEffect(() => {
86473
89161
  const removeUpdateAvailableListener = window.api.updater.onUpdateAvailable(
86474
89162
  (info) => {
86475
- setUpdateAvailable(true);
86476
- setUpdateInfo(info);
86477
- setSnackbarOpen(true);
89163
+ if (shouldShowUpdate(info.version)) {
89164
+ setUpdateAvailable(true);
89165
+ setUpdateInfo(info);
89166
+ setSnackbarOpen(true);
89167
+ }
86478
89168
  }
86479
89169
  );
86480
89170
  const removeUpdateNotAvailableListener = window.api.updater.onUpdateNotAvailable(() => {
@@ -86483,16 +89173,27 @@ const UpdateNotification = ({
86483
89173
  });
86484
89174
  const removeUpdateDownloadedListener = window.api.updater.onUpdateDownloaded((info) => {
86485
89175
  setDownloading(false);
86486
- setUpdateDownloaded(true);
86487
- setUpdateInfo(info);
86488
- setSnackbarOpen(true);
89176
+ if (shouldShowUpdate(info.version)) {
89177
+ setUpdateDownloaded(true);
89178
+ setUpdateInfo(info);
89179
+ setSnackbarOpen(true);
89180
+ }
86489
89181
  });
86490
89182
  const removeUpdateErrorListener = window.api.updater.onUpdateError(
86491
89183
  (errorMessage) => {
86492
- setError(errorMessage);
86493
- setChecking(false);
86494
- setDownloading(false);
86495
- setSnackbarOpen(true);
89184
+ if (errorMessage.includes("manually")) {
89185
+ setManualUpdateRequired(true);
89186
+ setManualUpdateInfo({
89187
+ message: "Please update the local-operator package manually using pip.",
89188
+ command: "pip install --upgrade local-operator"
89189
+ });
89190
+ setSnackbarOpen(true);
89191
+ } else {
89192
+ setError(errorMessage);
89193
+ setChecking(false);
89194
+ setDownloading(false);
89195
+ setSnackbarOpen(true);
89196
+ }
86496
89197
  }
86497
89198
  );
86498
89199
  const removeUpdateProgressListener = window.api.updater.onUpdateProgress(
@@ -86500,6 +89201,32 @@ const UpdateNotification = ({
86500
89201
  setDownloadProgress(progressObj);
86501
89202
  }
86502
89203
  );
89204
+ const removeBackendUpdateAvailableListener = window.api.updater.onBackendUpdateAvailable((info) => {
89205
+ if (shouldShowUpdate(info.latestVersion)) {
89206
+ const enhancedInfo = {
89207
+ ...info,
89208
+ canManageUpdate: !info.updateCommand.includes("manually")
89209
+ };
89210
+ setBackendUpdateAvailable(true);
89211
+ setBackendUpdateInfo(enhancedInfo);
89212
+ setSnackbarOpen(true);
89213
+ }
89214
+ });
89215
+ const removeBackendUpdateNotAvailableListener = window.api.updater.onBackendUpdateNotAvailable(() => {
89216
+ setBackendUpdateAvailable(false);
89217
+ setBackendUpdateInfo(null);
89218
+ });
89219
+ const removeBackendUpdateCompletedListener = window.api.updater.onBackendUpdateCompleted(() => {
89220
+ setBackendUpdateAvailable(false);
89221
+ setBackendUpdateInfo(null);
89222
+ setChecking(false);
89223
+ setUpdatingBackend(false);
89224
+ setBackendUpdateCompleted(true);
89225
+ setSnackbarOpen(true);
89226
+ setTimeout(() => {
89227
+ setBackendUpdateCompleted(false);
89228
+ }, 6e3);
89229
+ });
86503
89230
  if (autoCheck) {
86504
89231
  checkForUpdates();
86505
89232
  }
@@ -86509,15 +89236,18 @@ const UpdateNotification = ({
86509
89236
  removeUpdateDownloadedListener();
86510
89237
  removeUpdateErrorListener();
86511
89238
  removeUpdateProgressListener();
89239
+ removeBackendUpdateAvailableListener();
89240
+ removeBackendUpdateNotAvailableListener();
89241
+ removeBackendUpdateCompletedListener();
86512
89242
  };
86513
- }, [autoCheck, checkForUpdates]);
89243
+ }, [autoCheck, checkForUpdates, shouldShowUpdate]);
86514
89244
  const handleSnackbarClose = () => {
86515
89245
  setSnackbarOpen(false);
86516
89246
  };
86517
89247
  if (checking) {
86518
89248
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(UpdateContainer, { children: [
86519
- /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h6", children: "Checking for Updates" }),
86520
- /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", children: "Please wait while we check for available updates..." }),
89249
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h6", children: updatingBackend ? "Updating Server" : "Checking for Updates" }),
89250
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", children: updatingBackend ? "Please wait while the server is being updated. The server will temporarily go offline while it restarts to apply the update." : "Please wait while we check for available updates..." }),
86521
89251
  /* @__PURE__ */ jsxRuntimeExports.jsx(ProgressContainer, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(LinearProgress, {}) })
86522
89252
  ] });
86523
89253
  }
@@ -86541,13 +89271,33 @@ const UpdateNotification = ({
86541
89271
  "Version ",
86542
89272
  updateInfo.version,
86543
89273
  " is available. You are currently using version ",
86544
- define_process_env_default.npm_package_version || "unknown",
89274
+ appVersion,
86545
89275
  "."
86546
89276
  ] }),
86547
89277
  updateInfo.releaseNotes && /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", sx: { mt: 1 }, children: [
86548
89278
  "Release Notes:",
86549
89279
  " ",
86550
- typeof updateInfo.releaseNotes === "string" ? updateInfo.releaseNotes : "See release notes on GitHub"
89280
+ typeof updateInfo.releaseNotes === "string" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
89281
+ parse(truncateText(updateInfo.releaseNotes, 400)),
89282
+ updateInfo.releaseNotes.length > 400 && /* @__PURE__ */ jsxRuntimeExports.jsx(
89283
+ Link,
89284
+ {
89285
+ href: getReleaseUrl(updateInfo),
89286
+ target: "_blank",
89287
+ rel: "noopener noreferrer",
89288
+ sx: { ml: 1 },
89289
+ children: "View full release notes"
89290
+ }
89291
+ )
89292
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
89293
+ Link,
89294
+ {
89295
+ href: getReleaseUrl(updateInfo),
89296
+ target: "_blank",
89297
+ rel: "noopener noreferrer",
89298
+ children: "See release notes on GitHub"
89299
+ }
89300
+ )
86551
89301
  ] }),
86552
89302
  downloading && downloadProgress && /* @__PURE__ */ jsxRuntimeExports.jsxs(ProgressContainer, { children: [
86553
89303
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", children: [
@@ -86571,16 +89321,27 @@ const UpdateNotification = ({
86571
89321
  " KB"
86572
89322
  ] })
86573
89323
  ] }),
86574
- /* @__PURE__ */ jsxRuntimeExports.jsx(UpdateActions, { children: !downloading && /* @__PURE__ */ jsxRuntimeExports.jsx(
86575
- Button,
86576
- {
86577
- variant: "contained",
86578
- color: "primary",
86579
- onClick: downloadUpdate,
86580
- disabled: downloading,
86581
- children: "Download Update"
86582
- }
86583
- ) })
89324
+ /* @__PURE__ */ jsxRuntimeExports.jsx(UpdateActions, { children: !downloading && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
89325
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
89326
+ Button,
89327
+ {
89328
+ variant: "contained",
89329
+ color: "primary",
89330
+ onClick: downloadUpdate,
89331
+ disabled: downloading,
89332
+ children: "Download Update"
89333
+ }
89334
+ ),
89335
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
89336
+ Button,
89337
+ {
89338
+ variant: "outlined",
89339
+ onClick: handleDeferUpdate,
89340
+ disabled: downloading,
89341
+ children: "Update Later"
89342
+ }
89343
+ )
89344
+ ] }) })
86584
89345
  ] }),
86585
89346
  /* @__PURE__ */ jsxRuntimeExports.jsx(
86586
89347
  Snackbar,
@@ -86604,12 +89365,14 @@ const UpdateNotification = ({
86604
89365
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body1", children: [
86605
89366
  "Version ",
86606
89367
  updateInfo.version,
86607
- " has been downloaded and is ready to install."
89368
+ " is available. You are currently using version ",
89369
+ appVersion,
89370
+ "."
86608
89371
  ] }),
86609
89372
  /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", sx: { mt: 1 }, children: "The application will restart to apply the update." }),
86610
89373
  /* @__PURE__ */ jsxRuntimeExports.jsxs(UpdateActions, { children: [
86611
89374
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "contained", color: "primary", onClick: installUpdate, children: "Install Now" }),
86612
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "outlined", onClick: () => setSnackbarOpen(false), children: "Install Later" })
89375
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "outlined", onClick: handleDeferUpdate, children: "Update Later" })
86613
89376
  ] })
86614
89377
  ] }),
86615
89378
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -86624,224 +89387,148 @@ const UpdateNotification = ({
86624
89387
  )
86625
89388
  ] });
86626
89389
  }
86627
- return null;
86628
- };
86629
- const CheckForUpdatesButton = () => {
86630
- const [checking, setChecking] = reactExports.useState(false);
86631
- const [error, setError] = reactExports.useState(null);
86632
- const [snackbarOpen, setSnackbarOpen] = reactExports.useState(false);
86633
- const [noUpdateAvailable, setNoUpdateAvailable] = reactExports.useState(false);
86634
- const [devModeMessage, setDevModeMessage] = reactExports.useState(null);
86635
- const [npxUpdateInfo, setNpxUpdateInfo] = reactExports.useState(
86636
- null
86637
- );
86638
- const [backendUpdateInfo, setBackendUpdateInfo] = reactExports.useState(null);
86639
- const [backendUpdateCompleted, setBackendUpdateCompleted] = reactExports.useState(false);
86640
- const [updatingBackend, setUpdatingBackend] = reactExports.useState(false);
86641
- const checkForUpdates = async () => {
86642
- try {
86643
- setChecking(true);
86644
- setError(null);
86645
- setDevModeMessage(null);
86646
- setNpxUpdateInfo(null);
86647
- setBackendUpdateInfo(null);
86648
- setBackendUpdateCompleted(false);
86649
- await window.api.updater.checkForAllUpdates();
86650
- setNoUpdateAvailable(true);
86651
- setSnackbarOpen(true);
86652
- } catch (err) {
86653
- setError(
86654
- `Error checking for updates: ${err instanceof Error ? err.message : String(err)}`
86655
- );
86656
- setSnackbarOpen(true);
86657
- } finally {
86658
- setChecking(false);
86659
- }
86660
- };
86661
- const updateBackend = async () => {
86662
- try {
86663
- setUpdatingBackend(true);
86664
- setError(null);
86665
- await window.api.updater.updateBackend();
86666
- } catch (err) {
86667
- setError(
86668
- `Error updating backend: ${err instanceof Error ? err.message : String(err)}`
86669
- );
86670
- setSnackbarOpen(true);
86671
- } finally {
86672
- setUpdatingBackend(false);
86673
- }
86674
- };
86675
- reactExports.useEffect(() => {
86676
- const removeUpdateNotAvailableListener = window.api.updater.onUpdateNotAvailable(() => {
86677
- setNoUpdateAvailable(true);
86678
- setSnackbarOpen(true);
86679
- });
86680
- const removeUpdateDevModeListener = window.api.updater.onUpdateDevMode(
86681
- (message2) => {
86682
- setDevModeMessage(message2);
86683
- setChecking(false);
86684
- setSnackbarOpen(true);
86685
- }
86686
- );
86687
- const removeUpdateNpxAvailableListener = window.api.updater.onUpdateNpxAvailable((info) => {
86688
- setNpxUpdateInfo(info);
86689
- setChecking(false);
86690
- setSnackbarOpen(true);
86691
- });
86692
- const removeBackendUpdateAvailableListener = window.api.updater.onBackendUpdateAvailable((info) => {
86693
- setBackendUpdateInfo(info);
86694
- setChecking(false);
86695
- setSnackbarOpen(true);
86696
- });
86697
- const removeBackendUpdateNotAvailableListener = window.api.updater.onBackendUpdateNotAvailable(() => {
86698
- });
86699
- const removeBackendUpdateCompletedListener = window.api.updater.onBackendUpdateCompleted(() => {
86700
- setBackendUpdateCompleted(true);
86701
- setBackendUpdateInfo(null);
86702
- setUpdatingBackend(false);
86703
- setSnackbarOpen(true);
86704
- });
86705
- const removeUpdateErrorListener = window.api.updater.onUpdateError(
86706
- (errorMessage) => {
86707
- setError(errorMessage);
86708
- setChecking(false);
86709
- setUpdatingBackend(false);
86710
- setSnackbarOpen(true);
86711
- }
86712
- );
86713
- return () => {
86714
- removeUpdateNotAvailableListener();
86715
- removeUpdateDevModeListener();
86716
- removeUpdateNpxAvailableListener();
86717
- removeBackendUpdateAvailableListener();
86718
- removeBackendUpdateNotAvailableListener();
86719
- removeBackendUpdateCompletedListener();
86720
- removeUpdateErrorListener();
86721
- };
86722
- }, []);
86723
- const handleSnackbarClose = () => {
86724
- setSnackbarOpen(false);
86725
- setNoUpdateAvailable(false);
86726
- setDevModeMessage(null);
86727
- setNpxUpdateInfo(null);
86728
- setBackendUpdateCompleted(false);
86729
- };
86730
- const handleCopyCommand = (command) => {
86731
- navigator.clipboard.writeText(command);
86732
- setError("Command copied to clipboard!");
86733
- setTimeout(() => {
86734
- setError(null);
86735
- }, 2e3);
86736
- };
86737
- let snackbarContent = null;
86738
- if (error) {
86739
- snackbarContent = /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { onClose: handleSnackbarClose, severity: "error", children: error });
86740
- } else if (backendUpdateCompleted) {
86741
- snackbarContent = /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { onClose: handleSnackbarClose, severity: "success", children: "Backend updated successfully" });
86742
- } else if (backendUpdateInfo) {
86743
- snackbarContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(
86744
- Alert,
86745
- {
86746
- onClose: handleSnackbarClose,
86747
- severity: "info",
86748
- action: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
89390
+ if (backendUpdateAvailable && backendUpdateInfo) {
89391
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
89392
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(UpdateContainer, { children: [
89393
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "h6", children: "Server Update Available" }),
89394
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body1", children: [
89395
+ "Server version ",
89396
+ backendUpdateInfo.latestVersion,
89397
+ " is available. You are currently using version ",
89398
+ backendUpdateInfo.currentVersion,
89399
+ "."
89400
+ ] }),
89401
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", sx: { mt: 1 }, children: "Updating the server will improve AI functionality, improve security, and fix bugs." }),
89402
+ backendUpdateInfo.canManageUpdate ? /* @__PURE__ */ jsxRuntimeExports.jsxs(UpdateActions, { children: [
86749
89403
  /* @__PURE__ */ jsxRuntimeExports.jsx(
86750
89404
  Button,
86751
89405
  {
86752
- color: "inherit",
86753
- size: "small",
86754
- onClick: () => handleCopyCommand(backendUpdateInfo.updateCommand),
86755
- sx: { mr: 1 },
86756
- children: "Copy"
89406
+ variant: "contained",
89407
+ color: "primary",
89408
+ onClick: updateBackend,
89409
+ disabled: checking,
89410
+ children: checking ? "Updating..." : "Update Server"
86757
89411
  }
86758
89412
  ),
86759
89413
  /* @__PURE__ */ jsxRuntimeExports.jsx(
86760
89414
  Button,
86761
89415
  {
86762
- color: "primary",
86763
- size: "small",
86764
- onClick: updateBackend,
86765
- disabled: updatingBackend,
86766
- children: updatingBackend ? "Updating..." : "Update"
89416
+ variant: "outlined",
89417
+ onClick: handleDeferBackendUpdate,
89418
+ disabled: checking,
89419
+ children: "Update Later"
86767
89420
  }
86768
89421
  )
86769
- ] }),
86770
- children: [
86771
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", sx: { mb: 1 }, children: [
86772
- "Backend update available: ",
86773
- backendUpdateInfo.latestVersion,
86774
- " (current:",
86775
- " ",
86776
- backendUpdateInfo.currentVersion,
86777
- ")"
86778
- ] }),
86779
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", children: [
86780
- "To update manually, run:",
86781
- " ",
86782
- /* @__PURE__ */ jsxRuntimeExports.jsx("code", { children: backendUpdateInfo.updateCommand })
89422
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
89423
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", sx: { mt: 2, color: "warning.main" }, children: "The backend server is running externally and cannot be updated automatically. Please update it manually using the following command:" }),
89424
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
89425
+ Typography,
89426
+ {
89427
+ variant: "body2",
89428
+ sx: {
89429
+ mt: 1,
89430
+ p: 1,
89431
+ backgroundColor: "background.default",
89432
+ borderRadius: 1,
89433
+ fontFamily: "monospace"
89434
+ },
89435
+ children: backendUpdateInfo.updateCommand
89436
+ }
89437
+ ),
89438
+ /* @__PURE__ */ jsxRuntimeExports.jsx(UpdateActions, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
89439
+ Button,
89440
+ {
89441
+ variant: "outlined",
89442
+ onClick: handleDeferBackendUpdate,
89443
+ disabled: checking,
89444
+ children: "Dismiss"
89445
+ }
89446
+ ) })
89447
+ ] })
89448
+ ] }),
89449
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
89450
+ Snackbar,
89451
+ {
89452
+ open: snackbarOpen,
89453
+ autoHideDuration: 6e3,
89454
+ onClose: handleSnackbarClose,
89455
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
89456
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { onClose: handleSnackbarClose, severity: "info", children: [
89457
+ "A new server update is available: v",
89458
+ backendUpdateInfo.latestVersion
86783
89459
  ] })
86784
- ]
86785
- }
86786
- );
86787
- } else if (npxUpdateInfo) {
86788
- snackbarContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(
86789
- Alert,
89460
+ }
89461
+ )
89462
+ ] });
89463
+ }
89464
+ if (manualUpdateRequired && manualUpdateInfo) {
89465
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
89466
+ Snackbar,
86790
89467
  {
89468
+ open: snackbarOpen,
89469
+ autoHideDuration: 1e4,
86791
89470
  onClose: handleSnackbarClose,
86792
- severity: "info",
86793
- action: /* @__PURE__ */ jsxRuntimeExports.jsx(
86794
- Button,
89471
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
89472
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
89473
+ Alert,
86795
89474
  {
86796
- color: "inherit",
86797
- size: "small",
86798
- onClick: () => handleCopyCommand(npxUpdateInfo.updateCommand),
86799
- children: "Copy"
89475
+ onClose: handleSnackbarClose,
89476
+ severity: "warning",
89477
+ sx: { width: "100%" },
89478
+ children: [
89479
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", children: manualUpdateInfo.message }),
89480
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
89481
+ Typography,
89482
+ {
89483
+ variant: "body2",
89484
+ sx: {
89485
+ mt: 1,
89486
+ p: 1,
89487
+ backgroundColor: "background.default",
89488
+ borderRadius: 1,
89489
+ fontFamily: "monospace"
89490
+ },
89491
+ children: manualUpdateInfo.command
89492
+ }
89493
+ )
89494
+ ]
86800
89495
  }
86801
- ),
86802
- children: [
86803
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", sx: { mb: 1 }, children: [
86804
- "UI update available: ",
86805
- npxUpdateInfo.latestVersion,
86806
- " (current:",
86807
- " ",
86808
- npxUpdateInfo.currentVersion,
86809
- ")"
86810
- ] }),
86811
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", children: [
86812
- "To update, run: ",
86813
- /* @__PURE__ */ jsxRuntimeExports.jsx("code", { children: npxUpdateInfo.updateCommand })
86814
- ] })
86815
- ]
89496
+ )
86816
89497
  }
86817
- );
86818
- } else if (devModeMessage) {
86819
- snackbarContent = /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { onClose: handleSnackbarClose, severity: "info", children: devModeMessage });
86820
- } else if (noUpdateAvailable) {
86821
- snackbarContent = /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { onClose: handleSnackbarClose, severity: "info", children: "You're using the latest version" });
89498
+ ) });
86822
89499
  }
86823
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
86824
- /* @__PURE__ */ jsxRuntimeExports.jsx(
86825
- Button,
86826
- {
86827
- variant: "outlined",
86828
- onClick: checkForUpdates,
86829
- disabled: checking,
86830
- startIcon: checking ? /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { sx: { width: 16, height: 16 } }) : void 0,
86831
- children: checking ? "Checking..." : "Check for Updates"
86832
- }
86833
- ),
86834
- snackbarOpen && snackbarContent && /* @__PURE__ */ jsxRuntimeExports.jsx(
89500
+ if (backendUpdateCompleted) {
89501
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
86835
89502
  Snackbar,
86836
89503
  {
86837
- open: snackbarOpen,
89504
+ open: true,
86838
89505
  autoHideDuration: 6e3,
86839
- onClose: handleSnackbarClose,
89506
+ onClose: () => setBackendUpdateCompleted(false),
86840
89507
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
86841
- children: snackbarContent
89508
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
89509
+ Alert,
89510
+ {
89511
+ onClose: () => setBackendUpdateCompleted(false),
89512
+ severity: "success",
89513
+ children: "Server update completed successfully"
89514
+ }
89515
+ )
86842
89516
  }
86843
- )
86844
- ] });
89517
+ );
89518
+ }
89519
+ return null;
89520
+ };
89521
+ const truncateText = (text2, maxLength) => {
89522
+ if (text2.length <= maxLength) return text2;
89523
+ return `${text2.substring(0, maxLength)}...`;
89524
+ };
89525
+ const getReleaseUrl = (updateInfo) => {
89526
+ if (updateInfo.releaseNotes && typeof updateInfo.releaseNotes !== "string") {
89527
+ const releaseNotesObj = updateInfo.releaseNotes;
89528
+ const defaultUrl = `https://github.com/local-operator/local-operator-ui/releases/tag/v${updateInfo.version}`;
89529
+ return releaseNotesObj.path || defaultUrl;
89530
+ }
89531
+ return `https://github.com/local-operator/local-operator-ui/releases/tag/v${updateInfo.version}`;
86845
89532
  };
86846
89533
  const localOperatorIcon = "" + new URL("icon-ngVHF_bZ.png", import.meta.url).href;
86847
89534
  const pulse$1 = keyframes`
@@ -87604,30 +90291,6 @@ const EmojiContainer = styled$1(Box)(({ theme: theme2 }) => ({
87604
90291
  marginRight: theme2.spacing(1),
87605
90292
  fontSize: "1em"
87606
90293
  }));
87607
- const configQueryKey = ["config"];
87608
- const useConfig = () => {
87609
- return useQuery({
87610
- queryKey: configQueryKey,
87611
- queryFn: async () => {
87612
- try {
87613
- const client = createLocalOperatorClient(apiConfig.baseUrl);
87614
- const response = await client.config.getConfig();
87615
- if (response.status >= 400) {
87616
- throw new Error(response.message || "Failed to fetch configuration");
87617
- }
87618
- return response.result;
87619
- } catch (error) {
87620
- const errorMessage = error instanceof Error ? error.message : "An unknown error occurred while fetching configuration";
87621
- y$1.error(errorMessage);
87622
- throw error;
87623
- }
87624
- },
87625
- // Prevent automatic refetches on window focus
87626
- refetchOnWindowFocus: false,
87627
- // Prevent stale time to avoid unnecessary refetches
87628
- staleTime: 5e3
87629
- });
87630
- };
87631
90294
  const CreateAgentStep = () => {
87632
90295
  const [name2, setName] = reactExports.useState("");
87633
90296
  const [description, setDescription] = reactExports.useState("");
@@ -89318,6 +91981,88 @@ const ToggleSetting = ({
89318
91981
  ) })
89319
91982
  ] });
89320
91983
  };
91984
+ const CheckForUpdatesButton = () => {
91985
+ const [checking, setChecking] = reactExports.useState(false);
91986
+ const [snackbarOpen, setSnackbarOpen] = reactExports.useState(false);
91987
+ const [manualUpdateInfo, setManualUpdateInfo] = reactExports.useState(null);
91988
+ const { clearDeferredUpdate } = useDeferredUpdatesStore();
91989
+ reactExports.useEffect(() => {
91990
+ const removeManualUpdateListener = window.api.updater.onUpdateError(
91991
+ (message2) => {
91992
+ if (message2.includes("manually")) {
91993
+ setManualUpdateInfo({
91994
+ message: "Please update the local-operator package manually using pip.",
91995
+ command: "pip install --upgrade local-operator"
91996
+ });
91997
+ setSnackbarOpen(true);
91998
+ }
91999
+ }
92000
+ );
92001
+ return () => {
92002
+ removeManualUpdateListener();
92003
+ };
92004
+ }, []);
92005
+ const checkForUpdates = async () => {
92006
+ try {
92007
+ setChecking(true);
92008
+ clearDeferredUpdate();
92009
+ await window.api.updater.checkForAllUpdates();
92010
+ } catch (error) {
92011
+ console.error("Error checking for updates:", error);
92012
+ } finally {
92013
+ setChecking(false);
92014
+ }
92015
+ };
92016
+ const handleSnackbarClose = () => {
92017
+ setSnackbarOpen(false);
92018
+ };
92019
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
92020
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
92021
+ Button,
92022
+ {
92023
+ variant: "outlined",
92024
+ onClick: checkForUpdates,
92025
+ disabled: checking,
92026
+ startIcon: checking ? /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { sx: { width: 16, height: 16 } }) : void 0,
92027
+ children: checking ? "Checking..." : "Check for Updates"
92028
+ }
92029
+ ),
92030
+ manualUpdateInfo && /* @__PURE__ */ jsxRuntimeExports.jsx(
92031
+ Snackbar,
92032
+ {
92033
+ open: snackbarOpen,
92034
+ autoHideDuration: 1e4,
92035
+ onClose: handleSnackbarClose,
92036
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
92037
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
92038
+ Alert,
92039
+ {
92040
+ onClose: handleSnackbarClose,
92041
+ severity: "warning",
92042
+ sx: { width: "100%" },
92043
+ children: [
92044
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", children: manualUpdateInfo.message }),
92045
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
92046
+ Typography,
92047
+ {
92048
+ variant: "body2",
92049
+ sx: {
92050
+ mt: 1,
92051
+ p: 1,
92052
+ backgroundColor: "background.default",
92053
+ borderRadius: 1,
92054
+ fontFamily: "monospace"
92055
+ },
92056
+ children: manualUpdateInfo.command
92057
+ }
92058
+ )
92059
+ ]
92060
+ }
92061
+ )
92062
+ }
92063
+ )
92064
+ ] });
92065
+ };
89321
92066
  const StyledCard$3 = styled$1(Card)(() => ({
89322
92067
  marginBottom: 32,
89323
92068
  backgroundColor: "background.paper",
@@ -90068,7 +92813,10 @@ const DEFAULT_SETTINGS_SECTIONS = [
90068
92813
  ];
90069
92814
  const systemPromptQueryKey = ["system-prompt"];
90070
92815
  const useSystemPrompt = () => {
92816
+ const { shouldEnableQuery } = useConnectivityGate();
90071
92817
  return useQuery({
92818
+ // Only enable the query if server is online (bypass internet check)
92819
+ enabled: shouldEnableQuery({ bypassInternetCheck: true }),
90072
92820
  queryKey: systemPromptQueryKey,
90073
92821
  queryFn: async () => {
90074
92822
  try {
@@ -90083,7 +92831,7 @@ const useSystemPrompt = () => {
90083
92831
  return response.result;
90084
92832
  } catch (error) {
90085
92833
  const errorMessage = error instanceof Error ? error.message : "An unknown error occurred while fetching system prompt";
90086
- y$1.error(errorMessage);
92834
+ showErrorToast(errorMessage);
90087
92835
  throw error;
90088
92836
  }
90089
92837
  },
@@ -90817,6 +93565,7 @@ const App = () => {
90817
93565
  /* @__PURE__ */ jsxRuntimeExports.jsx(CssBaseline, {}),
90818
93566
  /* @__PURE__ */ jsxRuntimeExports.jsx(ModelsInitializer, {}),
90819
93567
  /* @__PURE__ */ jsxRuntimeExports.jsx(OnboardingModal, { open: isOnboardingActive }),
93568
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ConnectivityBanner, {}),
90820
93569
  /* @__PURE__ */ jsxRuntimeExports.jsx(UpdateNotification, {}),
90821
93570
  /* @__PURE__ */ jsxRuntimeExports.jsx(SidebarNavigation, {}),
90822
93571
  /* @__PURE__ */ jsxRuntimeExports.jsx(MainContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Routes, { children: [