@luxonis/visualizer-protobuf 2.59.0 → 2.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-C9wMzZDk.js → index-ARAaT2z6.js} +35 -26
- package/dist/{index-CI2zZK-X.js → index-B-gepT8F.js} +1 -1
- package/dist/{index-fyAJLGvE.js → index-B1qRCM6r.js} +1 -1
- package/dist/{index-D-qPLo-v.js → index-B6sll9cE.js} +120 -878
- package/dist/{index-aaPkJ89x.js → index-B_lum5rP.js} +1 -1
- package/dist/{index-BsBXVJKE.js → index-Bi5xhlfD.js} +1 -1
- package/dist/{index-zT_WtqoY.js → index-Bw-FhjMs.js} +1 -1
- package/dist/{index-Bwm4wffR.js → index-By14OgoB.js} +1 -1
- package/dist/{index-CnY-kdiq.js → index-CF2jw9qi.js} +1 -1
- package/dist/{index-EUTQcO4-.js → index-CGutE1Wk.js} +1 -1
- package/dist/{index-CVmUnHhh.js → index-CZ7KcfuL.js} +2 -2
- package/dist/{index-BjqViT7W.js → index-CtllW0hO.js} +1 -1
- package/dist/{index-C9iHOlJb.js → index-CwjLzHD2.js} +1 -1
- package/dist/{index-3ExX-f1E.js → index-DHgbxJte.js} +1 -1
- package/dist/{index-DtBMt9at.js → index-DWI0HJUX.js} +1 -1
- package/dist/{index-Cm6yWP_C.js → index-Dhxo8T8s.js} +1 -1
- package/dist/{index-CuCto_Ml.js → index-DsEmfNSY.js} +1 -1
- package/dist/{index-Deq64LIh.js → index-I6OtZu_1.js} +1 -1
- package/dist/{index-h3xAfWxR.js → index-wp3rICMq.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/src/components/Panel.d.ts +1 -0
- package/dist/lib/src/components/Panel.d.ts.map +1 -1
- package/dist/lib/src/components/Panel.js +2 -2
- package/dist/lib/src/components/Panel.js.map +1 -1
- package/dist/lib/src/connection/foxglove-connection.d.ts +1 -1
- package/dist/lib/src/connection/foxglove-connection.d.ts.map +1 -1
- package/dist/lib/src/connection/foxglove-connection.js +14 -6
- package/dist/lib/src/connection/foxglove-connection.js.map +1 -1
- package/dist/lib/src/output.css +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import React__default, { useReducer, useRef, useCallback, useLayoutEffect, Compo
|
|
|
3
3
|
import ReactDOM__default from 'react-dom';
|
|
4
4
|
import { Z as isSymbol, $ as toString, a0 as keys, a1 as getSymbols$1, a2 as stubArray, a3 as arrayPush, a4 as baseGetAllKeys, g as getTag, a5 as getAllKeys, k as baseGet, c as baseIteratee, j as castPath, t as toKey, a6 as arrayMap$1, a7 as baseUniq, b as baseFlatten, a8 as useMustNotChange, a9 as useCurrentLayoutActions, aa as useCurrentLayoutSelector, r as reportError, A as AppError, L as Logger, u as useGuaranteedContext, ab as usePanelMosaicId, ac as useSelectedPanels, ad as PANEL_TITLE_CONFIG_KEY, ae as noop$4, o as getPanelTypeFromId, M as useShallowMemo, T as TAB_PANEL_TYPE, J as filterMap, d as dist$2, af as useAppConfiguration, ag as useValueChangedDebugLog, V as typescript, ah as useJsonTreeTheme } from './depth-CJRDcPfJ.js';
|
|
5
5
|
import { createStore, useStore } from 'zustand';
|
|
6
|
-
import { g as generateUtilityClass, c as createAggregator, f as flatRest, b as baseSet, A as AnalyticsContext, P as PropTypes, E as ErrorDisplay, S as Stack$1, m as makeStyles$1, _ as _extends$1, W as WorkspaceContext, u as useAnalytics, a as AppEvent, L as LeftSidebarItemKeys, R as RightSidebarItemKeys, d as useTranslation, e as usePanelCatalog, h as EmptyState, i as isEmpty, j as PanelContext, k as PanelCatalogContext, l as usePanelStateStore, n as useDefaultPanelTitle, o as useWorkspaceStore, p as WorkspaceStoreSelectors, q as difference, r as usePanelContext, s as useMessagePipeline, v as v4, t as useHoverValue, w as useSetHoverValue, x as useClearHoverValue, y as useMessagePipelineGetter, z as usePanelSettingsTreeUpdate, B as PlayerCapabilities, C as assertNever, D as PlayerPresence, F as isEqual, G as isDesktopApp, H as createTheme, I as propTypesExports, J as DEFAULT_CAMERA_STATE$1
|
|
6
|
+
import { g as generateUtilityClass, c as createAggregator, f as flatRest, b as baseSet, A as AnalyticsContext, P as PropTypes, E as ErrorDisplay, S as Stack$1, m as makeStyles$1, _ as _extends$1, W as WorkspaceContext, u as useAnalytics, a as AppEvent, L as LeftSidebarItemKeys, R as RightSidebarItemKeys, d as useTranslation, e as usePanelCatalog, h as EmptyState, i as isEmpty, j as PanelContext, k as PanelCatalogContext, l as usePanelStateStore, n as useDefaultPanelTitle, o as useWorkspaceStore, p as WorkspaceStoreSelectors, q as difference, r as usePanelContext, s as useMessagePipeline, v as v4, t as useHoverValue, w as useSetHoverValue, x as useClearHoverValue, y as useMessagePipelineGetter, z as usePanelSettingsTreeUpdate, B as PlayerCapabilities, C as assertNever, D as PlayerPresence, F as isEqual, G as isDesktopApp, H as createTheme, I as propTypesExports, J as DEFAULT_CAMERA_STATE$1 } from './index-ARAaT2z6.js';
|
|
7
7
|
import { MosaicDragType, MosaicContext, MosaicWindowContext, getOtherBranch, getNodeAtPath } from 'react-mosaic-component';
|
|
8
8
|
import { g as getDefaultExportFromCjs, c as commonjsGlobal, d as getAugmentedNamespace } from './protobuf-B55JS-Px.js';
|
|
9
9
|
import { Link, Button, alpha, IconButton, Card, CardActionArea, CardMedia, CardContent, Typography, Container, Tooltip, Fade, ListItem, ListItemButton, ListItemText, List, TextField, InputAdornment, Popper, Grow, Paper, ClickAwayListener, Menu, MenuItem, Divider, buttonClasses, Backdrop, Chip, useTheme, alertClasses, darken, lighten, inputBaseClasses, autocompleteClasses, inputClasses, Checkbox, dialogActionsClasses, filledInputClasses, inputAdornmentClasses, listSubheaderClasses, selectClasses, tableCellClasses, ThemeProvider as ThemeProvider$1, SvgIcon, tabsClasses as tabsClasses$1, tabClasses, Tabs, Tab, ListItemIcon } from '@mui/material';
|
|
@@ -37,6 +37,16 @@ import '@pandacss/dev';
|
|
|
37
37
|
import 'protobufjs/minimal';
|
|
38
38
|
import 'ms';
|
|
39
39
|
|
|
40
|
+
const useDebounce = (props) => {
|
|
41
|
+
const { effect, dependencies, debounceDelay } = props;
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
const callback = React__default.useCallback(effect, dependencies);
|
|
44
|
+
React__default.useEffect(() => {
|
|
45
|
+
const timeout = setTimeout(callback, debounceDelay);
|
|
46
|
+
return () => clearTimeout(timeout);
|
|
47
|
+
}, [callback, debounceDelay]);
|
|
48
|
+
};
|
|
49
|
+
|
|
40
50
|
/*
|
|
41
51
|
|
|
42
52
|
Based off glamor's StyleSheet, thanks Sunil ❤️
|
|
@@ -7514,7 +7524,7 @@ var useSnackbar = (function () {
|
|
|
7514
7524
|
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
7515
7525
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
7516
7526
|
|
|
7517
|
-
const log$
|
|
7527
|
+
const log$7 = Logger.getLogger("src/index.ts");
|
|
7518
7528
|
|
|
7519
7529
|
/**
|
|
7520
7530
|
* A version of React.useCallback() displaying any errors thrown from the function as toast notifications.
|
|
@@ -7528,7 +7538,7 @@ function useCallbackWithToast(callback, deps) {
|
|
|
7528
7538
|
await callback(...args);
|
|
7529
7539
|
return;
|
|
7530
7540
|
} catch (error) {
|
|
7531
|
-
log$
|
|
7541
|
+
log$7.error(error);
|
|
7532
7542
|
enqueueSnackbar(error.toString(), {
|
|
7533
7543
|
variant: "error"
|
|
7534
7544
|
});
|
|
@@ -7814,18 +7824,18 @@ var substr = 'ab'.substr(-1) === 'b' ?
|
|
|
7814
7824
|
;
|
|
7815
7825
|
|
|
7816
7826
|
var path$1 = /*#__PURE__*/Object.freeze({
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7827
|
+
__proto__: null,
|
|
7828
|
+
basename: basename,
|
|
7829
|
+
default: path,
|
|
7830
|
+
delimiter: delimiter,
|
|
7831
|
+
dirname: dirname,
|
|
7832
|
+
extname: extname,
|
|
7833
|
+
isAbsolute: isAbsolute,
|
|
7834
|
+
join: join,
|
|
7835
|
+
normalize: normalize$3,
|
|
7836
|
+
relative: relative,
|
|
7837
|
+
resolve: resolve,
|
|
7838
|
+
sep: sep
|
|
7829
7839
|
});
|
|
7830
7840
|
|
|
7831
7841
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -18492,8 +18502,8 @@ var draco_wasm_wrapper = {exports: {}};
|
|
|
18492
18502
|
var empty = {};
|
|
18493
18503
|
|
|
18494
18504
|
var empty$1 = /*#__PURE__*/Object.freeze({
|
|
18495
|
-
|
|
18496
|
-
|
|
18505
|
+
__proto__: null,
|
|
18506
|
+
default: empty
|
|
18497
18507
|
});
|
|
18498
18508
|
|
|
18499
18509
|
var require$$0 = /*@__PURE__*/getAugmentedNamespace(empty$1);
|
|
@@ -29726,7 +29736,7 @@ class STLLoader extends Loader {
|
|
|
29726
29736
|
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
29727
29737
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
29728
29738
|
|
|
29729
|
-
const log$
|
|
29739
|
+
const log$6 = Logger.getLogger("src/index.ts");
|
|
29730
29740
|
const DEFAULT_MESH_UP_AXIS = "y_up";
|
|
29731
29741
|
const DEFAULT_COLOR$4 = new Color(0x248eff);
|
|
29732
29742
|
const GLTF_MIME_TYPES = ["model/gltf", "model/gltf-binary", "model/gltf+json"];
|
|
@@ -29799,7 +29809,7 @@ class ModelCache {
|
|
|
29799
29809
|
async #loadGltf(url, reportError) {
|
|
29800
29810
|
const onError = assetUrl => {
|
|
29801
29811
|
const originalUrl = unrewriteUrl(assetUrl);
|
|
29802
|
-
log$
|
|
29812
|
+
log$6.error(`Failed to load GLTF asset "${originalUrl}" for "${url}"`);
|
|
29803
29813
|
reportError(new Error(`Failed to load GLTF asset "${originalUrl}"`));
|
|
29804
29814
|
};
|
|
29805
29815
|
const manager = new LoadingManager(undefined, undefined, onError);
|
|
@@ -29820,7 +29830,7 @@ class ModelCache {
|
|
|
29820
29830
|
// STL files do not reference any external assets, no LoadingManager needed
|
|
29821
29831
|
const stlLoader = new STLLoader();
|
|
29822
29832
|
const bufferGeometry = stlLoader.parse(buffer);
|
|
29823
|
-
log$
|
|
29833
|
+
log$6.debug(`Finished loading STL from ${url}`);
|
|
29824
29834
|
const material = new MeshStandardMaterial({
|
|
29825
29835
|
name: url.slice(-32),
|
|
29826
29836
|
// truncate to 32 characters
|
|
@@ -29845,7 +29855,7 @@ class ModelCache {
|
|
|
29845
29855
|
ignoreUpAxis, reportError) {
|
|
29846
29856
|
const onError = assetUrl => {
|
|
29847
29857
|
const originalUrl = unrewriteUrl(assetUrl);
|
|
29848
|
-
log$
|
|
29858
|
+
log$6.error(`Failed to load COLLADA asset "${originalUrl}" for "${url}"`);
|
|
29849
29859
|
reportError(new Error(`Failed to load COLLADA asset "${originalUrl}"`));
|
|
29850
29860
|
};
|
|
29851
29861
|
|
|
@@ -29877,7 +29887,7 @@ class ModelCache {
|
|
|
29877
29887
|
}));
|
|
29878
29888
|
this.#colladaTextureObjectUrls.set(textureUrl, objectUrl);
|
|
29879
29889
|
} catch (e) {
|
|
29880
|
-
log$
|
|
29890
|
+
log$6.error(e);
|
|
29881
29891
|
onError(node.textContent);
|
|
29882
29892
|
}
|
|
29883
29893
|
}
|
|
@@ -29898,7 +29908,7 @@ class ModelCache {
|
|
|
29898
29908
|
async #loadOBJ(url, text, meshUpAxis, reportError) {
|
|
29899
29909
|
const onError = assetUrl => {
|
|
29900
29910
|
const originalUrl = unrewriteUrl(assetUrl);
|
|
29901
|
-
log$
|
|
29911
|
+
log$6.error(`Failed to load OBJ asset "${originalUrl}" for "${url}"`);
|
|
29902
29912
|
reportError(new Error(`Failed to load OBJ asset "${originalUrl}"`));
|
|
29903
29913
|
};
|
|
29904
29914
|
const manager = new LoadingManager(undefined, undefined, onError);
|
|
@@ -30722,7 +30732,7 @@ function getOffset(maybeOffset) {
|
|
|
30722
30732
|
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
30723
30733
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
30724
30734
|
|
|
30725
|
-
const log$
|
|
30735
|
+
const log$5 = Logger.getLogger("src/index.ts");
|
|
30726
30736
|
const LAYER_ID$1 = "foxglove.Grid";
|
|
30727
30737
|
const DEFAULT_SIZE = 10;
|
|
30728
30738
|
const DEFAULT_DIVISIONS = 10;
|
|
@@ -30910,7 +30920,7 @@ class Grids extends SceneExtension {
|
|
|
30910
30920
|
this.#updateGrid(instanceId, settings);
|
|
30911
30921
|
};
|
|
30912
30922
|
#handleAddGrid = instanceId => {
|
|
30913
|
-
log$
|
|
30923
|
+
log$5.info(`Creating ${LAYER_ID$1} layer ${instanceId}`);
|
|
30914
30924
|
const config = {
|
|
30915
30925
|
...DEFAULT_SETTINGS$9,
|
|
30916
30926
|
instanceId
|
|
@@ -31558,7 +31568,7 @@ class WorkerImageDecoder {
|
|
|
31558
31568
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
31559
31569
|
|
|
31560
31570
|
const WORKER_COUNT = 4;
|
|
31561
|
-
const log$
|
|
31571
|
+
const log$4 = Logger.getLogger("src/index.ts");
|
|
31562
31572
|
const DEFAULT_DISTANCE = 1;
|
|
31563
31573
|
const DEFAULT_PLANAR_PROJECTION_FACTOR = 0;
|
|
31564
31574
|
const IMAGE_RENDERABLE_DEFAULT_SETTINGS = {
|
|
@@ -31682,7 +31692,7 @@ class ImageRenderable extends Renderable {
|
|
|
31682
31692
|
this.removeError(DECODE_IMAGE_ERR_KEY);
|
|
31683
31693
|
this.renderer.queueAnimationFrame();
|
|
31684
31694
|
}).catch(err => {
|
|
31685
|
-
log$
|
|
31695
|
+
log$4.error(err);
|
|
31686
31696
|
if (this.isDisposed()) {
|
|
31687
31697
|
return;
|
|
31688
31698
|
}
|
|
@@ -33912,7 +33922,7 @@ class ImageAnnotations extends Object3D {
|
|
|
33912
33922
|
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
33913
33923
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
33914
33924
|
|
|
33915
|
-
const log$
|
|
33925
|
+
const log$3 = Logger.getLogger("src/index.ts");
|
|
33916
33926
|
const CALIBRATION_TOPIC_PATH = ["imageMode", "calibrationTopic"];
|
|
33917
33927
|
const IMAGE_TOPIC_UNAVAILABLE = "IMAGE_TOPIC_UNAVAILABLE";
|
|
33918
33928
|
const CALIBRATION_TOPIC_UNAVAILABLE = "CALIBRATION_TOPIC_UNAVAILABLE";
|
|
@@ -34713,7 +34723,7 @@ class ImageMode extends SceneExtension {
|
|
|
34713
34723
|
}]);
|
|
34714
34724
|
}
|
|
34715
34725
|
} catch (error) {
|
|
34716
|
-
log$
|
|
34726
|
+
log$3.error(error);
|
|
34717
34727
|
if (this.renderer.displayTemporaryError) {
|
|
34718
34728
|
this.renderer.displayTemporaryError(error.toString());
|
|
34719
34729
|
}
|
|
@@ -45004,7 +45014,7 @@ class RenderableMeshResource extends RenderableMarker {
|
|
|
45004
45014
|
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
45005
45015
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
45006
45016
|
|
|
45007
|
-
const log$
|
|
45017
|
+
const log$2 = Logger.getLogger("src/index.ts");
|
|
45008
45018
|
const LAYER_ID = "foxglove.Urdf";
|
|
45009
45019
|
const TOPIC_NAME = "/robot_description";
|
|
45010
45020
|
|
|
@@ -45575,7 +45585,7 @@ class Urdfs extends SceneExtension {
|
|
|
45575
45585
|
}
|
|
45576
45586
|
};
|
|
45577
45587
|
#handleAddUrdf = instanceId => {
|
|
45578
|
-
log$
|
|
45588
|
+
log$2.info(`Creating ${LAYER_ID} layer ${instanceId}`);
|
|
45579
45589
|
const config = {
|
|
45580
45590
|
...DEFAULT_CUSTOM_SETTINGS,
|
|
45581
45591
|
instanceId
|
|
@@ -45622,7 +45632,7 @@ class Urdfs extends SceneExtension {
|
|
|
45622
45632
|
// Cancel the previous fetch
|
|
45623
45633
|
renderable.userData.fetching.control.abort();
|
|
45624
45634
|
}
|
|
45625
|
-
log$
|
|
45635
|
+
log$2.debug(`Fetching URDF from ${url}`);
|
|
45626
45636
|
renderable.userData.fetching = {
|
|
45627
45637
|
url,
|
|
45628
45638
|
control: new AbortController()
|
|
@@ -45630,7 +45640,7 @@ class Urdfs extends SceneExtension {
|
|
|
45630
45640
|
this.renderer.fetchAsset(url, {
|
|
45631
45641
|
signal: renderable.userData.fetching.control.signal
|
|
45632
45642
|
}).then(urdf => {
|
|
45633
|
-
log$
|
|
45643
|
+
log$2.debug(`Fetched ${urdf.data.length} byte URDF from ${url}`);
|
|
45634
45644
|
this.renderer.settings.errors.remove(["layers", instanceId], FETCH_URDF_ERR);
|
|
45635
45645
|
this.#loadUrdf({
|
|
45636
45646
|
instanceId,
|
|
@@ -45766,7 +45776,7 @@ class Urdfs extends SceneExtension {
|
|
|
45766
45776
|
this.renderer.queueAnimationFrame();
|
|
45767
45777
|
}).catch(unknown => {
|
|
45768
45778
|
const err = unknown;
|
|
45769
|
-
log$
|
|
45779
|
+
log$2.error(`Failed to parse URDF: ${err.message}`);
|
|
45770
45780
|
this.renderer.settings.errors.add(settingsPath, PARSE_URDF_ERR, `Failed to parse URDF: ${err.message}`);
|
|
45771
45781
|
});
|
|
45772
45782
|
}
|
|
@@ -45845,7 +45855,7 @@ class Urdfs extends SceneExtension {
|
|
|
45845
45855
|
}
|
|
45846
45856
|
async #getFileFetch(url, referenceUrl) {
|
|
45847
45857
|
try {
|
|
45848
|
-
log$
|
|
45858
|
+
log$2.debug(`fetch(${url}) requested`);
|
|
45849
45859
|
const asset = await this.renderer.fetchAsset(url, {
|
|
45850
45860
|
referenceUrl
|
|
45851
45861
|
});
|
|
@@ -45858,7 +45868,7 @@ class Urdfs extends SceneExtension {
|
|
|
45858
45868
|
async function parseUrdf(text, getFileContents, framePrefix) {
|
|
45859
45869
|
const applyFramePrefix = name => `${framePrefix}${name}`;
|
|
45860
45870
|
try {
|
|
45861
|
-
log$
|
|
45871
|
+
log$2.debug(`Parsing ${text.length} byte URDF`);
|
|
45862
45872
|
const robot = await parseRobot(text, getFileContents);
|
|
45863
45873
|
if (framePrefix) {
|
|
45864
45874
|
robot.links = new Map([...robot.links].map(([name, link]) => [applyFramePrefix(name), {
|
|
@@ -54585,57 +54595,57 @@ const MuiTypography = {
|
|
|
54585
54595
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
54586
54596
|
|
|
54587
54597
|
var components = /*#__PURE__*/Object.freeze({
|
|
54588
|
-
|
|
54589
|
-
|
|
54590
|
-
|
|
54591
|
-
|
|
54592
|
-
|
|
54593
|
-
|
|
54594
|
-
|
|
54595
|
-
|
|
54596
|
-
|
|
54597
|
-
|
|
54598
|
-
|
|
54599
|
-
|
|
54600
|
-
|
|
54601
|
-
|
|
54602
|
-
|
|
54603
|
-
|
|
54604
|
-
|
|
54605
|
-
|
|
54606
|
-
|
|
54607
|
-
|
|
54608
|
-
|
|
54609
|
-
|
|
54610
|
-
|
|
54611
|
-
|
|
54612
|
-
|
|
54613
|
-
|
|
54614
|
-
|
|
54615
|
-
|
|
54616
|
-
|
|
54617
|
-
|
|
54618
|
-
|
|
54619
|
-
|
|
54620
|
-
|
|
54621
|
-
|
|
54622
|
-
|
|
54623
|
-
|
|
54624
|
-
|
|
54625
|
-
|
|
54626
|
-
|
|
54627
|
-
|
|
54628
|
-
|
|
54629
|
-
|
|
54630
|
-
|
|
54631
|
-
|
|
54632
|
-
|
|
54633
|
-
|
|
54634
|
-
|
|
54635
|
-
|
|
54636
|
-
|
|
54637
|
-
|
|
54638
|
-
|
|
54598
|
+
__proto__: null,
|
|
54599
|
+
MuiAlert: MuiAlert,
|
|
54600
|
+
MuiAutocomplete: MuiAutocomplete,
|
|
54601
|
+
MuiAvatar: MuiAvatar,
|
|
54602
|
+
MuiBackdrop: MuiBackdrop,
|
|
54603
|
+
MuiBadge: MuiBadge,
|
|
54604
|
+
MuiButton: MuiButton,
|
|
54605
|
+
MuiButtonBase: MuiButtonBase,
|
|
54606
|
+
MuiButtonGroup: MuiButtonGroup,
|
|
54607
|
+
MuiCard: MuiCard,
|
|
54608
|
+
MuiCardActionArea: MuiCardActionArea,
|
|
54609
|
+
MuiCardContent: MuiCardContent,
|
|
54610
|
+
MuiCardHeader: MuiCardHeader,
|
|
54611
|
+
MuiCheckbox: MuiCheckbox,
|
|
54612
|
+
MuiChip: MuiChip,
|
|
54613
|
+
MuiCssBaseline: MuiCssBaseline,
|
|
54614
|
+
MuiDataGrid: MuiDataGrid,
|
|
54615
|
+
MuiDialog: MuiDialog,
|
|
54616
|
+
MuiDialogActions: MuiDialogActions,
|
|
54617
|
+
MuiDialogContent: MuiDialogContent,
|
|
54618
|
+
MuiDialogTitle: MuiDialogTitle,
|
|
54619
|
+
MuiFab: MuiFab,
|
|
54620
|
+
MuiFilledInput: MuiFilledInput,
|
|
54621
|
+
MuiFormControl: MuiFormControl,
|
|
54622
|
+
MuiFormLabel: MuiFormLabel,
|
|
54623
|
+
MuiIconButton: MuiIconButton,
|
|
54624
|
+
MuiInput: MuiInput,
|
|
54625
|
+
MuiInputAdornment: MuiInputAdornment,
|
|
54626
|
+
MuiInputBase: MuiInputBase,
|
|
54627
|
+
MuiInputLabel: MuiInputLabel,
|
|
54628
|
+
MuiLinearProgress: MuiLinearProgress,
|
|
54629
|
+
MuiLink: MuiLink,
|
|
54630
|
+
MuiListItemButton: MuiListItemButton,
|
|
54631
|
+
MuiListItemText: MuiListItemText,
|
|
54632
|
+
MuiListSubheader: MuiListSubheader,
|
|
54633
|
+
MuiMenu: MuiMenu,
|
|
54634
|
+
MuiMenuItem: MuiMenuItem,
|
|
54635
|
+
MuiOutlinedInput: MuiOutlinedInput,
|
|
54636
|
+
MuiPaper: MuiPaper,
|
|
54637
|
+
MuiPopover: MuiPopover,
|
|
54638
|
+
MuiRadio: MuiRadio,
|
|
54639
|
+
MuiSelect: MuiSelect,
|
|
54640
|
+
MuiTab: MuiTab,
|
|
54641
|
+
MuiTableCell: MuiTableCell,
|
|
54642
|
+
MuiTableRow: MuiTableRow,
|
|
54643
|
+
MuiTabs: MuiTabs,
|
|
54644
|
+
MuiTextField: MuiTextField,
|
|
54645
|
+
MuiToggleButton: MuiToggleButton,
|
|
54646
|
+
MuiToolbar: MuiToolbar,
|
|
54647
|
+
MuiTooltip: MuiTooltip,
|
|
54648
|
+
MuiTypography: MuiTypography
|
|
54639
54649
|
});
|
|
54640
54650
|
|
|
54641
54651
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -54752,9 +54762,9 @@ const light = {
|
|
|
54752
54762
|
};
|
|
54753
54763
|
|
|
54754
54764
|
var palette = /*#__PURE__*/Object.freeze({
|
|
54755
|
-
|
|
54756
|
-
|
|
54757
|
-
|
|
54765
|
+
__proto__: null,
|
|
54766
|
+
dark: dark,
|
|
54767
|
+
light: light
|
|
54758
54768
|
});
|
|
54759
54769
|
|
|
54760
54770
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -60896,7 +60906,7 @@ var bright = {exports: {}};
|
|
|
60896
60906
|
|
|
60897
60907
|
var brightExports = bright.exports;
|
|
60898
60908
|
|
|
60899
|
-
var chalk
|
|
60909
|
+
var chalk = {exports: {}};
|
|
60900
60910
|
|
|
60901
60911
|
(function (module, exports) {
|
|
60902
60912
|
|
|
@@ -60922,9 +60932,9 @@ var chalk$1 = {exports: {}};
|
|
|
60922
60932
|
base0F: '#deaf8f'
|
|
60923
60933
|
};
|
|
60924
60934
|
module.exports = exports['default'];
|
|
60925
|
-
} (chalk
|
|
60935
|
+
} (chalk, chalk.exports));
|
|
60926
60936
|
|
|
60927
|
-
var chalkExports = chalk
|
|
60937
|
+
var chalkExports = chalk.exports;
|
|
60928
60938
|
|
|
60929
60939
|
var codeschool = {exports: {}};
|
|
60930
60940
|
|
|
@@ -71788,9 +71798,9 @@ var moment$1 = /*@__PURE__*/getDefaultExportFromCjs(momentTimezoneExports);
|
|
|
71788
71798
|
// There is some miss-match between the moment we import and the one the type declarations expect
|
|
71789
71799
|
momentDurationFormatSetup(moment$1);
|
|
71790
71800
|
function format(stamp, timezone) {
|
|
71791
|
-
return `${formatDate
|
|
71801
|
+
return `${formatDate(stamp, timezone)} ${formatTime(stamp, timezone)}`;
|
|
71792
71802
|
}
|
|
71793
|
-
function formatDate
|
|
71803
|
+
function formatDate(stamp, timezone) {
|
|
71794
71804
|
if (stamp.sec < 0 || stamp.nsec < 0) {
|
|
71795
71805
|
console.error("Times are not allowed to be negative");
|
|
71796
71806
|
return "(invalid negative time)";
|
|
@@ -73729,7 +73739,7 @@ class MarkerPool {
|
|
|
73729
73739
|
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
73730
73740
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|
|
73731
73741
|
|
|
73732
|
-
const log$
|
|
73742
|
+
const log$1 = Logger.getLogger("src/index.ts");
|
|
73733
73743
|
|
|
73734
73744
|
/** Menu item entry and callback for the "Custom Layers" menu */
|
|
73735
73745
|
|
|
@@ -73935,7 +73945,7 @@ class Renderer extends EventEmitter {
|
|
|
73935
73945
|
this.#selectionBackdropScene.add(this.#selectionBackdrop);
|
|
73936
73946
|
const samples = msaaSamples(this.gl.capabilities);
|
|
73937
73947
|
const renderSize = this.gl.getDrawingBufferSize(tempVec2);
|
|
73938
|
-
log$
|
|
73948
|
+
log$1.debug(`Initialized ${renderSize.width}x${renderSize.height} renderer (${samples}x MSAA)`);
|
|
73939
73949
|
const {
|
|
73940
73950
|
reserved
|
|
73941
73951
|
} = args.sceneExtensionConfig;
|
|
@@ -73976,7 +73986,7 @@ class Renderer extends EventEmitter {
|
|
|
73976
73986
|
this.#addSceneExtension(extensionItem.init(this));
|
|
73977
73987
|
}
|
|
73978
73988
|
}
|
|
73979
|
-
log$
|
|
73989
|
+
log$1.debug(`Renderer initialized with scene extensions ${Array.from(this.sceneExtensions.keys()).join(", ")}`);
|
|
73980
73990
|
if (interfaceMode === "image" && config.imageMode.calibrationTopic == undefined) {
|
|
73981
73991
|
this.enableImageOnlySubscriptionMode();
|
|
73982
73992
|
} else {
|
|
@@ -73992,7 +74002,7 @@ class Renderer extends EventEmitter {
|
|
|
73992
74002
|
this.emit("hudItemsChanged", this);
|
|
73993
74003
|
};
|
|
73994
74004
|
#onDevicePixelRatioChange = () => {
|
|
73995
|
-
log$
|
|
74005
|
+
log$1.debug(`devicePixelRatio changed to ${window.devicePixelRatio}`);
|
|
73996
74006
|
this.#resizeHandler(this.input.canvasSize);
|
|
73997
74007
|
this.#watchDevicePixelRatio();
|
|
73998
74008
|
};
|
|
@@ -74003,7 +74013,7 @@ class Renderer extends EventEmitter {
|
|
|
74003
74013
|
});
|
|
74004
74014
|
}
|
|
74005
74015
|
dispose() {
|
|
74006
|
-
log$
|
|
74016
|
+
log$1.warn(`Disposing renderer`);
|
|
74007
74017
|
this.#devicePixelRatioMediaQuery?.removeEventListener("change", this.#onDevicePixelRatioChange);
|
|
74008
74018
|
this.removeAllListeners();
|
|
74009
74019
|
this.settings.removeAllListeners();
|
|
@@ -74457,13 +74467,13 @@ class Renderer extends EventEmitter {
|
|
|
74457
74467
|
if (prevSelected) {
|
|
74458
74468
|
// Deselect the previously selected renderable
|
|
74459
74469
|
deselectObject(prevSelected.renderable);
|
|
74460
|
-
log$
|
|
74470
|
+
log$1.debug(`Deselected ${prevSelected.renderable.id} (${prevSelected.renderable.name})`);
|
|
74461
74471
|
}
|
|
74462
74472
|
this.#selectedRenderable = selection;
|
|
74463
74473
|
if (selection) {
|
|
74464
74474
|
// Select the newly selected renderable
|
|
74465
74475
|
selectObject(selection.renderable);
|
|
74466
|
-
log$
|
|
74476
|
+
log$1.debug(`Selected ${selection.renderable.id} (${selection.renderable.name}) (instance=${selection.instanceIndex})`, selection.renderable);
|
|
74467
74477
|
}
|
|
74468
74478
|
this.emit("selectedRenderable", selection, this);
|
|
74469
74479
|
if (!this.debugPicking) {
|
|
@@ -74608,7 +74618,7 @@ class Renderer extends EventEmitter {
|
|
|
74608
74618
|
}
|
|
74609
74619
|
setFollowFrameId(frameId) {
|
|
74610
74620
|
if (this.followFrameId !== frameId) {
|
|
74611
|
-
log$
|
|
74621
|
+
log$1.debug(`Setting followFrameId to ${frameId}`);
|
|
74612
74622
|
}
|
|
74613
74623
|
this.followFrameId = frameId;
|
|
74614
74624
|
}
|
|
@@ -74689,9 +74699,9 @@ class Renderer extends EventEmitter {
|
|
|
74689
74699
|
const fixedFrameId = fixedFrame.id;
|
|
74690
74700
|
if (this.fixedFrameId !== fixedFrameId) {
|
|
74691
74701
|
if (this.fixedFrameId == undefined) {
|
|
74692
|
-
log$
|
|
74702
|
+
log$1.debug(`Setting fixed frame to ${fixedFrameId}`);
|
|
74693
74703
|
} else {
|
|
74694
|
-
log$
|
|
74704
|
+
log$1.debug(`Changing fixed frame from "${this.fixedFrameId}" to "${fixedFrameId}"`);
|
|
74695
74705
|
}
|
|
74696
74706
|
this.fixedFrameId = fixedFrameId;
|
|
74697
74707
|
}
|
|
@@ -74701,7 +74711,7 @@ class Renderer extends EventEmitter {
|
|
|
74701
74711
|
this.gl.setSize(size.width, size.height);
|
|
74702
74712
|
this.cameraHandler.handleResize(size.width, size.height, window.devicePixelRatio);
|
|
74703
74713
|
const renderSize = this.gl.getDrawingBufferSize(tempVec2);
|
|
74704
|
-
log$
|
|
74714
|
+
log$1.debug(`Resized renderer to ${renderSize.width}x${renderSize.height}`);
|
|
74705
74715
|
this.animationFrame();
|
|
74706
74716
|
};
|
|
74707
74717
|
#clickHandler = cursorCoords => {
|
|
@@ -74741,7 +74751,7 @@ class Renderer extends EventEmitter {
|
|
|
74741
74751
|
if (!this.debugPicking) {
|
|
74742
74752
|
this.animationFrame();
|
|
74743
74753
|
}
|
|
74744
|
-
log$
|
|
74754
|
+
log$1.debug(`Clicked ${selections.length} renderable(s)`);
|
|
74745
74755
|
this.emit("renderablesClicked", selections, cursorCoords, this);
|
|
74746
74756
|
};
|
|
74747
74757
|
handleClickEvent = cursorCoords => {
|
|
@@ -74806,7 +74816,7 @@ class Renderer extends EventEmitter {
|
|
|
74806
74816
|
if (action.action !== "perform-node-action" || path.length !== 1 || path[0] !== "topics") {
|
|
74807
74817
|
return;
|
|
74808
74818
|
}
|
|
74809
|
-
log$
|
|
74819
|
+
log$1.debug(`handleTopicsAction(${action.payload.id})`);
|
|
74810
74820
|
|
|
74811
74821
|
// eslint-disable-next-line @foxglove/no-boolean-parameters
|
|
74812
74822
|
const toggleTopicVisibility = value => {
|
|
@@ -74838,7 +74848,7 @@ class Renderer extends EventEmitter {
|
|
|
74838
74848
|
if (action.action !== "perform-node-action" || path.length !== 1 || path[0] !== "layers") {
|
|
74839
74849
|
return;
|
|
74840
74850
|
}
|
|
74841
|
-
log$
|
|
74851
|
+
log$1.debug(`handleCustomLayersAction(${action.payload.id})`);
|
|
74842
74852
|
|
|
74843
74853
|
// Remove `-{uuid}` from the actionId to get the layerId
|
|
74844
74854
|
const actionId = action.payload.id;
|
|
@@ -74893,7 +74903,7 @@ class Renderer extends EventEmitter {
|
|
|
74893
74903
|
maybeRenderable = maybeRenderable.parent ?? undefined;
|
|
74894
74904
|
}
|
|
74895
74905
|
if (!renderable) {
|
|
74896
|
-
log$
|
|
74906
|
+
log$1.warn(`No Renderable found for objectId ${objectId} (name="${pickedObject?.name}" uuid=${pickedObject?.uuid})`);
|
|
74897
74907
|
return undefined;
|
|
74898
74908
|
}
|
|
74899
74909
|
|
|
@@ -78240,774 +78250,6 @@ function makePoseEstimateMessage(pose, frameId, xDev, yDev, thetaDev) {
|
|
|
78240
78250
|
};
|
|
78241
78251
|
}
|
|
78242
78252
|
|
|
78243
|
-
function formatDate(date, format) {
|
|
78244
|
-
switch (format) {
|
|
78245
|
-
case 'iso':
|
|
78246
|
-
return date.toISOString();
|
|
78247
|
-
case 'time-dayofyear':
|
|
78248
|
-
return format$1(date, 'D HH:mm:ss', { useAdditionalDayOfYearTokens: true });
|
|
78249
|
-
case 'full':
|
|
78250
|
-
return format$1(date, 'yyyy/MM/dd, hh:mm a');
|
|
78251
|
-
}
|
|
78252
|
-
}
|
|
78253
|
-
|
|
78254
|
-
z.string().min(6);
|
|
78255
|
-
z
|
|
78256
|
-
.string()
|
|
78257
|
-
.regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?$/, { message: 'Version must be in the format X.Y or X.Y.Z' });
|
|
78258
|
-
|
|
78259
|
-
const ANSI_BACKGROUND_OFFSET = 10;
|
|
78260
|
-
|
|
78261
|
-
const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
|
|
78262
|
-
|
|
78263
|
-
const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
|
|
78264
|
-
|
|
78265
|
-
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
78266
|
-
|
|
78267
|
-
const styles$1 = {
|
|
78268
|
-
modifier: {
|
|
78269
|
-
reset: [0, 0],
|
|
78270
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
78271
|
-
bold: [1, 22],
|
|
78272
|
-
dim: [2, 22],
|
|
78273
|
-
italic: [3, 23],
|
|
78274
|
-
underline: [4, 24],
|
|
78275
|
-
overline: [53, 55],
|
|
78276
|
-
inverse: [7, 27],
|
|
78277
|
-
hidden: [8, 28],
|
|
78278
|
-
strikethrough: [9, 29],
|
|
78279
|
-
},
|
|
78280
|
-
color: {
|
|
78281
|
-
black: [30, 39],
|
|
78282
|
-
red: [31, 39],
|
|
78283
|
-
green: [32, 39],
|
|
78284
|
-
yellow: [33, 39],
|
|
78285
|
-
blue: [34, 39],
|
|
78286
|
-
magenta: [35, 39],
|
|
78287
|
-
cyan: [36, 39],
|
|
78288
|
-
white: [37, 39],
|
|
78289
|
-
|
|
78290
|
-
// Bright color
|
|
78291
|
-
blackBright: [90, 39],
|
|
78292
|
-
gray: [90, 39], // Alias of `blackBright`
|
|
78293
|
-
grey: [90, 39], // Alias of `blackBright`
|
|
78294
|
-
redBright: [91, 39],
|
|
78295
|
-
greenBright: [92, 39],
|
|
78296
|
-
yellowBright: [93, 39],
|
|
78297
|
-
blueBright: [94, 39],
|
|
78298
|
-
magentaBright: [95, 39],
|
|
78299
|
-
cyanBright: [96, 39],
|
|
78300
|
-
whiteBright: [97, 39],
|
|
78301
|
-
},
|
|
78302
|
-
bgColor: {
|
|
78303
|
-
bgBlack: [40, 49],
|
|
78304
|
-
bgRed: [41, 49],
|
|
78305
|
-
bgGreen: [42, 49],
|
|
78306
|
-
bgYellow: [43, 49],
|
|
78307
|
-
bgBlue: [44, 49],
|
|
78308
|
-
bgMagenta: [45, 49],
|
|
78309
|
-
bgCyan: [46, 49],
|
|
78310
|
-
bgWhite: [47, 49],
|
|
78311
|
-
|
|
78312
|
-
// Bright color
|
|
78313
|
-
bgBlackBright: [100, 49],
|
|
78314
|
-
bgGray: [100, 49], // Alias of `bgBlackBright`
|
|
78315
|
-
bgGrey: [100, 49], // Alias of `bgBlackBright`
|
|
78316
|
-
bgRedBright: [101, 49],
|
|
78317
|
-
bgGreenBright: [102, 49],
|
|
78318
|
-
bgYellowBright: [103, 49],
|
|
78319
|
-
bgBlueBright: [104, 49],
|
|
78320
|
-
bgMagentaBright: [105, 49],
|
|
78321
|
-
bgCyanBright: [106, 49],
|
|
78322
|
-
bgWhiteBright: [107, 49],
|
|
78323
|
-
},
|
|
78324
|
-
};
|
|
78325
|
-
|
|
78326
|
-
Object.keys(styles$1.modifier);
|
|
78327
|
-
const foregroundColorNames = Object.keys(styles$1.color);
|
|
78328
|
-
const backgroundColorNames = Object.keys(styles$1.bgColor);
|
|
78329
|
-
[...foregroundColorNames, ...backgroundColorNames];
|
|
78330
|
-
|
|
78331
|
-
function assembleStyles() {
|
|
78332
|
-
const codes = new Map();
|
|
78333
|
-
|
|
78334
|
-
for (const [groupName, group] of Object.entries(styles$1)) {
|
|
78335
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
78336
|
-
styles$1[styleName] = {
|
|
78337
|
-
open: `\u001B[${style[0]}m`,
|
|
78338
|
-
close: `\u001B[${style[1]}m`,
|
|
78339
|
-
};
|
|
78340
|
-
|
|
78341
|
-
group[styleName] = styles$1[styleName];
|
|
78342
|
-
|
|
78343
|
-
codes.set(style[0], style[1]);
|
|
78344
|
-
}
|
|
78345
|
-
|
|
78346
|
-
Object.defineProperty(styles$1, groupName, {
|
|
78347
|
-
value: group,
|
|
78348
|
-
enumerable: false,
|
|
78349
|
-
});
|
|
78350
|
-
}
|
|
78351
|
-
|
|
78352
|
-
Object.defineProperty(styles$1, 'codes', {
|
|
78353
|
-
value: codes,
|
|
78354
|
-
enumerable: false,
|
|
78355
|
-
});
|
|
78356
|
-
|
|
78357
|
-
styles$1.color.close = '\u001B[39m';
|
|
78358
|
-
styles$1.bgColor.close = '\u001B[49m';
|
|
78359
|
-
|
|
78360
|
-
styles$1.color.ansi = wrapAnsi16();
|
|
78361
|
-
styles$1.color.ansi256 = wrapAnsi256();
|
|
78362
|
-
styles$1.color.ansi16m = wrapAnsi16m();
|
|
78363
|
-
styles$1.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
78364
|
-
styles$1.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
78365
|
-
styles$1.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
78366
|
-
|
|
78367
|
-
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
|
|
78368
|
-
Object.defineProperties(styles$1, {
|
|
78369
|
-
rgbToAnsi256: {
|
|
78370
|
-
value(red, green, blue) {
|
|
78371
|
-
// We use the extended greyscale palette here, with the exception of
|
|
78372
|
-
// black and white. normal palette only has 4 greyscale shades.
|
|
78373
|
-
if (red === green && green === blue) {
|
|
78374
|
-
if (red < 8) {
|
|
78375
|
-
return 16;
|
|
78376
|
-
}
|
|
78377
|
-
|
|
78378
|
-
if (red > 248) {
|
|
78379
|
-
return 231;
|
|
78380
|
-
}
|
|
78381
|
-
|
|
78382
|
-
return Math.round(((red - 8) / 247) * 24) + 232;
|
|
78383
|
-
}
|
|
78384
|
-
|
|
78385
|
-
return 16
|
|
78386
|
-
+ (36 * Math.round(red / 255 * 5))
|
|
78387
|
-
+ (6 * Math.round(green / 255 * 5))
|
|
78388
|
-
+ Math.round(blue / 255 * 5);
|
|
78389
|
-
},
|
|
78390
|
-
enumerable: false,
|
|
78391
|
-
},
|
|
78392
|
-
hexToRgb: {
|
|
78393
|
-
value(hex) {
|
|
78394
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
78395
|
-
if (!matches) {
|
|
78396
|
-
return [0, 0, 0];
|
|
78397
|
-
}
|
|
78398
|
-
|
|
78399
|
-
let [colorString] = matches;
|
|
78400
|
-
|
|
78401
|
-
if (colorString.length === 3) {
|
|
78402
|
-
colorString = [...colorString].map(character => character + character).join('');
|
|
78403
|
-
}
|
|
78404
|
-
|
|
78405
|
-
const integer = Number.parseInt(colorString, 16);
|
|
78406
|
-
|
|
78407
|
-
return [
|
|
78408
|
-
/* eslint-disable no-bitwise */
|
|
78409
|
-
(integer >> 16) & 0xFF,
|
|
78410
|
-
(integer >> 8) & 0xFF,
|
|
78411
|
-
integer & 0xFF,
|
|
78412
|
-
/* eslint-enable no-bitwise */
|
|
78413
|
-
];
|
|
78414
|
-
},
|
|
78415
|
-
enumerable: false,
|
|
78416
|
-
},
|
|
78417
|
-
hexToAnsi256: {
|
|
78418
|
-
value: hex => styles$1.rgbToAnsi256(...styles$1.hexToRgb(hex)),
|
|
78419
|
-
enumerable: false,
|
|
78420
|
-
},
|
|
78421
|
-
ansi256ToAnsi: {
|
|
78422
|
-
value(code) {
|
|
78423
|
-
if (code < 8) {
|
|
78424
|
-
return 30 + code;
|
|
78425
|
-
}
|
|
78426
|
-
|
|
78427
|
-
if (code < 16) {
|
|
78428
|
-
return 90 + (code - 8);
|
|
78429
|
-
}
|
|
78430
|
-
|
|
78431
|
-
let red;
|
|
78432
|
-
let green;
|
|
78433
|
-
let blue;
|
|
78434
|
-
|
|
78435
|
-
if (code >= 232) {
|
|
78436
|
-
red = (((code - 232) * 10) + 8) / 255;
|
|
78437
|
-
green = red;
|
|
78438
|
-
blue = red;
|
|
78439
|
-
} else {
|
|
78440
|
-
code -= 16;
|
|
78441
|
-
|
|
78442
|
-
const remainder = code % 36;
|
|
78443
|
-
|
|
78444
|
-
red = Math.floor(code / 36) / 5;
|
|
78445
|
-
green = Math.floor(remainder / 6) / 5;
|
|
78446
|
-
blue = (remainder % 6) / 5;
|
|
78447
|
-
}
|
|
78448
|
-
|
|
78449
|
-
const value = Math.max(red, green, blue) * 2;
|
|
78450
|
-
|
|
78451
|
-
if (value === 0) {
|
|
78452
|
-
return 30;
|
|
78453
|
-
}
|
|
78454
|
-
|
|
78455
|
-
// eslint-disable-next-line no-bitwise
|
|
78456
|
-
let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
|
|
78457
|
-
|
|
78458
|
-
if (value === 2) {
|
|
78459
|
-
result += 60;
|
|
78460
|
-
}
|
|
78461
|
-
|
|
78462
|
-
return result;
|
|
78463
|
-
},
|
|
78464
|
-
enumerable: false,
|
|
78465
|
-
},
|
|
78466
|
-
rgbToAnsi: {
|
|
78467
|
-
value: (red, green, blue) => styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(red, green, blue)),
|
|
78468
|
-
enumerable: false,
|
|
78469
|
-
},
|
|
78470
|
-
hexToAnsi: {
|
|
78471
|
-
value: hex => styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(hex)),
|
|
78472
|
-
enumerable: false,
|
|
78473
|
-
},
|
|
78474
|
-
});
|
|
78475
|
-
|
|
78476
|
-
return styles$1;
|
|
78477
|
-
}
|
|
78478
|
-
|
|
78479
|
-
const ansiStyles = assembleStyles();
|
|
78480
|
-
|
|
78481
|
-
/* eslint-env browser */
|
|
78482
|
-
|
|
78483
|
-
const level = (() => {
|
|
78484
|
-
if (navigator.userAgentData) {
|
|
78485
|
-
const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
|
|
78486
|
-
if (brand && brand.version > 93) {
|
|
78487
|
-
return 3;
|
|
78488
|
-
}
|
|
78489
|
-
}
|
|
78490
|
-
|
|
78491
|
-
if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) {
|
|
78492
|
-
return 1;
|
|
78493
|
-
}
|
|
78494
|
-
|
|
78495
|
-
return 0;
|
|
78496
|
-
})();
|
|
78497
|
-
|
|
78498
|
-
const colorSupport = level !== 0 && {
|
|
78499
|
-
level,
|
|
78500
|
-
hasBasic: true,
|
|
78501
|
-
has256: level >= 2,
|
|
78502
|
-
has16m: level >= 3,
|
|
78503
|
-
};
|
|
78504
|
-
|
|
78505
|
-
const supportsColor = {
|
|
78506
|
-
stdout: colorSupport,
|
|
78507
|
-
stderr: colorSupport,
|
|
78508
|
-
};
|
|
78509
|
-
|
|
78510
|
-
// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.
|
|
78511
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
78512
|
-
let index = string.indexOf(substring);
|
|
78513
|
-
if (index === -1) {
|
|
78514
|
-
return string;
|
|
78515
|
-
}
|
|
78516
|
-
|
|
78517
|
-
const substringLength = substring.length;
|
|
78518
|
-
let endIndex = 0;
|
|
78519
|
-
let returnValue = '';
|
|
78520
|
-
do {
|
|
78521
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
78522
|
-
endIndex = index + substringLength;
|
|
78523
|
-
index = string.indexOf(substring, endIndex);
|
|
78524
|
-
} while (index !== -1);
|
|
78525
|
-
|
|
78526
|
-
returnValue += string.slice(endIndex);
|
|
78527
|
-
return returnValue;
|
|
78528
|
-
}
|
|
78529
|
-
|
|
78530
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
78531
|
-
let endIndex = 0;
|
|
78532
|
-
let returnValue = '';
|
|
78533
|
-
do {
|
|
78534
|
-
const gotCR = string[index - 1] === '\r';
|
|
78535
|
-
returnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
|
78536
|
-
endIndex = index + 1;
|
|
78537
|
-
index = string.indexOf('\n', endIndex);
|
|
78538
|
-
} while (index !== -1);
|
|
78539
|
-
|
|
78540
|
-
returnValue += string.slice(endIndex);
|
|
78541
|
-
return returnValue;
|
|
78542
|
-
}
|
|
78543
|
-
|
|
78544
|
-
const {stdout: stdoutColor, stderr: stderrColor} = supportsColor;
|
|
78545
|
-
|
|
78546
|
-
const GENERATOR = Symbol('GENERATOR');
|
|
78547
|
-
const STYLER = Symbol('STYLER');
|
|
78548
|
-
const IS_EMPTY = Symbol('IS_EMPTY');
|
|
78549
|
-
|
|
78550
|
-
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
|
78551
|
-
const levelMapping = [
|
|
78552
|
-
'ansi',
|
|
78553
|
-
'ansi',
|
|
78554
|
-
'ansi256',
|
|
78555
|
-
'ansi16m',
|
|
78556
|
-
];
|
|
78557
|
-
|
|
78558
|
-
const styles = Object.create(null);
|
|
78559
|
-
|
|
78560
|
-
const applyOptions = (object, options = {}) => {
|
|
78561
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
78562
|
-
throw new Error('The `level` option should be an integer from 0 to 3');
|
|
78563
|
-
}
|
|
78564
|
-
|
|
78565
|
-
// Detect level if not set manually
|
|
78566
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
78567
|
-
object.level = options.level === undefined ? colorLevel : options.level;
|
|
78568
|
-
};
|
|
78569
|
-
|
|
78570
|
-
const chalkFactory = options => {
|
|
78571
|
-
const chalk = (...strings) => strings.join(' ');
|
|
78572
|
-
applyOptions(chalk, options);
|
|
78573
|
-
|
|
78574
|
-
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
78575
|
-
|
|
78576
|
-
return chalk;
|
|
78577
|
-
};
|
|
78578
|
-
|
|
78579
|
-
function createChalk(options) {
|
|
78580
|
-
return chalkFactory(options);
|
|
78581
|
-
}
|
|
78582
|
-
|
|
78583
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
78584
|
-
|
|
78585
|
-
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
78586
|
-
styles[styleName] = {
|
|
78587
|
-
get() {
|
|
78588
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
78589
|
-
Object.defineProperty(this, styleName, {value: builder});
|
|
78590
|
-
return builder;
|
|
78591
|
-
},
|
|
78592
|
-
};
|
|
78593
|
-
}
|
|
78594
|
-
|
|
78595
|
-
styles.visible = {
|
|
78596
|
-
get() {
|
|
78597
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
78598
|
-
Object.defineProperty(this, 'visible', {value: builder});
|
|
78599
|
-
return builder;
|
|
78600
|
-
},
|
|
78601
|
-
};
|
|
78602
|
-
|
|
78603
|
-
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
78604
|
-
if (model === 'rgb') {
|
|
78605
|
-
if (level === 'ansi16m') {
|
|
78606
|
-
return ansiStyles[type].ansi16m(...arguments_);
|
|
78607
|
-
}
|
|
78608
|
-
|
|
78609
|
-
if (level === 'ansi256') {
|
|
78610
|
-
return ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));
|
|
78611
|
-
}
|
|
78612
|
-
|
|
78613
|
-
return ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));
|
|
78614
|
-
}
|
|
78615
|
-
|
|
78616
|
-
if (model === 'hex') {
|
|
78617
|
-
return getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));
|
|
78618
|
-
}
|
|
78619
|
-
|
|
78620
|
-
return ansiStyles[type][model](...arguments_);
|
|
78621
|
-
};
|
|
78622
|
-
|
|
78623
|
-
const usedModels = ['rgb', 'hex', 'ansi256'];
|
|
78624
|
-
|
|
78625
|
-
for (const model of usedModels) {
|
|
78626
|
-
styles[model] = {
|
|
78627
|
-
get() {
|
|
78628
|
-
const {level} = this;
|
|
78629
|
-
return function (...arguments_) {
|
|
78630
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);
|
|
78631
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
78632
|
-
};
|
|
78633
|
-
},
|
|
78634
|
-
};
|
|
78635
|
-
|
|
78636
|
-
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
|
78637
|
-
styles[bgModel] = {
|
|
78638
|
-
get() {
|
|
78639
|
-
const {level} = this;
|
|
78640
|
-
return function (...arguments_) {
|
|
78641
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);
|
|
78642
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
78643
|
-
};
|
|
78644
|
-
},
|
|
78645
|
-
};
|
|
78646
|
-
}
|
|
78647
|
-
|
|
78648
|
-
const proto = Object.defineProperties(() => {}, {
|
|
78649
|
-
...styles,
|
|
78650
|
-
level: {
|
|
78651
|
-
enumerable: true,
|
|
78652
|
-
get() {
|
|
78653
|
-
return this[GENERATOR].level;
|
|
78654
|
-
},
|
|
78655
|
-
set(level) {
|
|
78656
|
-
this[GENERATOR].level = level;
|
|
78657
|
-
},
|
|
78658
|
-
},
|
|
78659
|
-
});
|
|
78660
|
-
|
|
78661
|
-
const createStyler = (open, close, parent) => {
|
|
78662
|
-
let openAll;
|
|
78663
|
-
let closeAll;
|
|
78664
|
-
if (parent === undefined) {
|
|
78665
|
-
openAll = open;
|
|
78666
|
-
closeAll = close;
|
|
78667
|
-
} else {
|
|
78668
|
-
openAll = parent.openAll + open;
|
|
78669
|
-
closeAll = close + parent.closeAll;
|
|
78670
|
-
}
|
|
78671
|
-
|
|
78672
|
-
return {
|
|
78673
|
-
open,
|
|
78674
|
-
close,
|
|
78675
|
-
openAll,
|
|
78676
|
-
closeAll,
|
|
78677
|
-
parent,
|
|
78678
|
-
};
|
|
78679
|
-
};
|
|
78680
|
-
|
|
78681
|
-
const createBuilder = (self, _styler, _isEmpty) => {
|
|
78682
|
-
// Single argument is hot path, implicit coercion is faster than anything
|
|
78683
|
-
// eslint-disable-next-line no-implicit-coercion
|
|
78684
|
-
const builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
|
78685
|
-
|
|
78686
|
-
// We alter the prototype because we must return a function, but there is
|
|
78687
|
-
// no way to create a function with a different prototype
|
|
78688
|
-
Object.setPrototypeOf(builder, proto);
|
|
78689
|
-
|
|
78690
|
-
builder[GENERATOR] = self;
|
|
78691
|
-
builder[STYLER] = _styler;
|
|
78692
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
78693
|
-
|
|
78694
|
-
return builder;
|
|
78695
|
-
};
|
|
78696
|
-
|
|
78697
|
-
const applyStyle = (self, string) => {
|
|
78698
|
-
if (self.level <= 0 || !string) {
|
|
78699
|
-
return self[IS_EMPTY] ? '' : string;
|
|
78700
|
-
}
|
|
78701
|
-
|
|
78702
|
-
let styler = self[STYLER];
|
|
78703
|
-
|
|
78704
|
-
if (styler === undefined) {
|
|
78705
|
-
return string;
|
|
78706
|
-
}
|
|
78707
|
-
|
|
78708
|
-
const {openAll, closeAll} = styler;
|
|
78709
|
-
if (string.includes('\u001B')) {
|
|
78710
|
-
while (styler !== undefined) {
|
|
78711
|
-
// Replace any instances already present with a re-opening code
|
|
78712
|
-
// otherwise only the part of the string until said closing code
|
|
78713
|
-
// will be colored, and the rest will simply be 'plain'.
|
|
78714
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
78715
|
-
|
|
78716
|
-
styler = styler.parent;
|
|
78717
|
-
}
|
|
78718
|
-
}
|
|
78719
|
-
|
|
78720
|
-
// We can move both next actions out of loop, because remaining actions in loop won't have
|
|
78721
|
-
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
|
78722
|
-
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
|
78723
|
-
const lfIndex = string.indexOf('\n');
|
|
78724
|
-
if (lfIndex !== -1) {
|
|
78725
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
78726
|
-
}
|
|
78727
|
-
|
|
78728
|
-
return openAll + string + closeAll;
|
|
78729
|
-
};
|
|
78730
|
-
|
|
78731
|
-
Object.defineProperties(createChalk.prototype, styles);
|
|
78732
|
-
|
|
78733
|
-
const chalk = createChalk();
|
|
78734
|
-
createChalk({level: stderrColor ? stderrColor.level : 0});
|
|
78735
|
-
|
|
78736
|
-
/* eslint-disable no-var */
|
|
78737
|
-
var LogLevel;
|
|
78738
|
-
(function (LogLevel) {
|
|
78739
|
-
LogLevel[LogLevel["trace"] = 10] = "trace";
|
|
78740
|
-
LogLevel[LogLevel["debug"] = 20] = "debug";
|
|
78741
|
-
LogLevel[LogLevel["info"] = 30] = "info";
|
|
78742
|
-
LogLevel[LogLevel["warn"] = 40] = "warn";
|
|
78743
|
-
LogLevel[LogLevel["error"] = 50] = "error";
|
|
78744
|
-
LogLevel[LogLevel["fatal"] = 60] = "fatal";
|
|
78745
|
-
})(LogLevel || (LogLevel = {}));
|
|
78746
|
-
function isLogFnParamsCtx(params) {
|
|
78747
|
-
return typeof params[0] !== 'string' && typeof params[1] !== 'undefined';
|
|
78748
|
-
}
|
|
78749
|
-
function parseLogFormat(value) {
|
|
78750
|
-
switch (value) {
|
|
78751
|
-
case 'pretty':
|
|
78752
|
-
case 'plain':
|
|
78753
|
-
case 'json':
|
|
78754
|
-
return value;
|
|
78755
|
-
default:
|
|
78756
|
-
return 'json';
|
|
78757
|
-
}
|
|
78758
|
-
}
|
|
78759
|
-
function logLevelName(level) {
|
|
78760
|
-
switch (level) {
|
|
78761
|
-
case 10:
|
|
78762
|
-
return ' T ';
|
|
78763
|
-
case 20:
|
|
78764
|
-
return ' D ';
|
|
78765
|
-
case 30:
|
|
78766
|
-
return ' I ';
|
|
78767
|
-
case 40:
|
|
78768
|
-
return ' W ';
|
|
78769
|
-
case 50:
|
|
78770
|
-
return ' E ';
|
|
78771
|
-
case 60:
|
|
78772
|
-
return ' F ';
|
|
78773
|
-
}
|
|
78774
|
-
return '?????';
|
|
78775
|
-
}
|
|
78776
|
-
function colorize(level) {
|
|
78777
|
-
switch (level) {
|
|
78778
|
-
case 10:
|
|
78779
|
-
return { color: chalk.gray, bgcolor: chalk.bgGray.black };
|
|
78780
|
-
case 20:
|
|
78781
|
-
return { color: chalk.gray, bgcolor: chalk.bgGray.black };
|
|
78782
|
-
case 30:
|
|
78783
|
-
return { color: chalk.white, bgcolor: chalk.bgWhite.black };
|
|
78784
|
-
case 40:
|
|
78785
|
-
return { color: chalk.yellow, bgcolor: chalk.bgYellow.black };
|
|
78786
|
-
case 50:
|
|
78787
|
-
return { color: chalk.red, bgcolor: chalk.bgRed.black };
|
|
78788
|
-
case 60:
|
|
78789
|
-
return { color: chalk.red, bgcolor: chalk.bgRed.black };
|
|
78790
|
-
}
|
|
78791
|
-
return { color: chalk.gray, bgcolor: chalk.bgGray.black };
|
|
78792
|
-
}
|
|
78793
|
-
function customStringify(data, useSpaces = true) {
|
|
78794
|
-
return (stringify$1(data, (_key, value) => {
|
|
78795
|
-
if (typeof Buffer !== 'undefined' && value instanceof Buffer) {
|
|
78796
|
-
return value.toString('base64');
|
|
78797
|
-
}
|
|
78798
|
-
return value;
|
|
78799
|
-
}, useSpaces ? 2 : undefined) ?? '');
|
|
78800
|
-
}
|
|
78801
|
-
function prettyMessage(message) {
|
|
78802
|
-
const logLevel = message.level ?? 30;
|
|
78803
|
-
const { color, bgcolor } = colorize(logLevel);
|
|
78804
|
-
const component = message.component ? `/${message.component}` : '';
|
|
78805
|
-
const baseMsg = [
|
|
78806
|
-
chalk.gray(formatDate(new Date(message.when), 'time-dayofyear')),
|
|
78807
|
-
bgcolor(logLevelName(logLevel)),
|
|
78808
|
-
color(`${message.logger.name}${component}`),
|
|
78809
|
-
color(':'),
|
|
78810
|
-
color(message.message),
|
|
78811
|
-
];
|
|
78812
|
-
if (Object.keys(message.context).length > 0) {
|
|
78813
|
-
for (const [key, value] of Object.entries(message.context)) {
|
|
78814
|
-
if (value instanceof Error) {
|
|
78815
|
-
try {
|
|
78816
|
-
baseMsg.push(`\n\n[key = ${key} contains Error]\n\n${customStringify(serializeError(value))}`);
|
|
78817
|
-
}
|
|
78818
|
-
catch {
|
|
78819
|
-
baseMsg.push(`\n\n[key = ${key} contains Error]\n\n${value.name}\n${value.message}`);
|
|
78820
|
-
}
|
|
78821
|
-
delete message.context[key];
|
|
78822
|
-
}
|
|
78823
|
-
}
|
|
78824
|
-
baseMsg.push(chalk.gray(`\n${customStringify(message.context)}`));
|
|
78825
|
-
}
|
|
78826
|
-
return baseMsg.join(' ');
|
|
78827
|
-
}
|
|
78828
|
-
function buildSerializeMessage(config) {
|
|
78829
|
-
if (config.format === 'pretty' || config.runtime === 'development') {
|
|
78830
|
-
chalk.level = typeof document !== 'undefined' ? 0 : 3;
|
|
78831
|
-
return prettyMessage;
|
|
78832
|
-
}
|
|
78833
|
-
else if (config.format === 'json') {
|
|
78834
|
-
return (message) => customStringify({ ...message, when: formatDate(message.when, 'iso') }, false);
|
|
78835
|
-
}
|
|
78836
|
-
else if (config.format === 'plain') {
|
|
78837
|
-
return (message) => {
|
|
78838
|
-
const logLevel = message.context.logLevel ?? 30;
|
|
78839
|
-
const component = message.context.component ? `/${JSON.stringify(message.context.component)}` : '';
|
|
78840
|
-
const baseMsg = [
|
|
78841
|
-
formatDate(message.when, 'time-dayofyear'),
|
|
78842
|
-
logLevelName(logLevel),
|
|
78843
|
-
`${message.logger.name}${component}`,
|
|
78844
|
-
':',
|
|
78845
|
-
message.message,
|
|
78846
|
-
];
|
|
78847
|
-
if (Object.keys(message.context).length > 0) {
|
|
78848
|
-
baseMsg.push(`\n${customStringify(message.context)}`);
|
|
78849
|
-
}
|
|
78850
|
-
return baseMsg.join(' ');
|
|
78851
|
-
};
|
|
78852
|
-
}
|
|
78853
|
-
else {
|
|
78854
|
-
throw new Error(`invalid configuration provided ${JSON.stringify(config, undefined, 2)}`);
|
|
78855
|
-
}
|
|
78856
|
-
}
|
|
78857
|
-
const writeMessage = (msg) => {
|
|
78858
|
-
if (msg.level < msg.logger.config.level)
|
|
78859
|
-
return;
|
|
78860
|
-
const message = msg.logger.serializeMessage(msg);
|
|
78861
|
-
if (typeof document !== 'undefined') {
|
|
78862
|
-
// eslint-disable-next-line no-console
|
|
78863
|
-
console.log(message);
|
|
78864
|
-
}
|
|
78865
|
-
else if (typeof process !== 'undefined') {
|
|
78866
|
-
process.stdout.write(`${message}\n`);
|
|
78867
|
-
}
|
|
78868
|
-
else {
|
|
78869
|
-
// eslint-disable-next-line no-console
|
|
78870
|
-
console.log(message);
|
|
78871
|
-
}
|
|
78872
|
-
};
|
|
78873
|
-
const buildLogger = (name, initialConfig) => {
|
|
78874
|
-
const _config = { ...initialConfig };
|
|
78875
|
-
let serializeMessage = buildSerializeMessage(_config);
|
|
78876
|
-
const configure = (config) => {
|
|
78877
|
-
Object.assign(_config, config);
|
|
78878
|
-
// logger.trace({ config: logger.config }, `reconfigured logger: ${name}`);
|
|
78879
|
-
serializeMessage = buildSerializeMessage(_config);
|
|
78880
|
-
};
|
|
78881
|
-
const buildBoundFns = (opts) => {
|
|
78882
|
-
const { component } = opts;
|
|
78883
|
-
return {
|
|
78884
|
-
trace: log.bind({ level: LogLevel.trace, component }),
|
|
78885
|
-
debug: log.bind({ level: LogLevel.debug, component }),
|
|
78886
|
-
info: log.bind({ level: LogLevel.info, component }),
|
|
78887
|
-
warn: log.bind({ level: LogLevel.warn, component }),
|
|
78888
|
-
error: log.bind({ level: LogLevel.error, component }),
|
|
78889
|
-
fatal: log.bind({ level: LogLevel.fatal, component }),
|
|
78890
|
-
};
|
|
78891
|
-
};
|
|
78892
|
-
function log(...params) {
|
|
78893
|
-
const ctxIndex = isLogFnParamsCtx(params) ? 0 : -1;
|
|
78894
|
-
const message = params.slice(ctxIndex + 1).join(' ');
|
|
78895
|
-
writeMessage({
|
|
78896
|
-
logger,
|
|
78897
|
-
when: new Date(),
|
|
78898
|
-
level: this.level,
|
|
78899
|
-
context: ctxIndex !== -1 ? params[ctxIndex] : {},
|
|
78900
|
-
component: this.component,
|
|
78901
|
-
message,
|
|
78902
|
-
});
|
|
78903
|
-
}
|
|
78904
|
-
const child = (component) => {
|
|
78905
|
-
const parent = logger;
|
|
78906
|
-
return {
|
|
78907
|
-
...parent,
|
|
78908
|
-
...buildBoundFns({ component }),
|
|
78909
|
-
};
|
|
78910
|
-
};
|
|
78911
|
-
const canLogLevel = (level) => {
|
|
78912
|
-
return _config.level <= level;
|
|
78913
|
-
};
|
|
78914
|
-
const logger = {
|
|
78915
|
-
get config() {
|
|
78916
|
-
return _config;
|
|
78917
|
-
},
|
|
78918
|
-
get name() {
|
|
78919
|
-
return _config.rootComponent;
|
|
78920
|
-
},
|
|
78921
|
-
serializeMessage: msg => {
|
|
78922
|
-
if (_config.format !== 'pretty') {
|
|
78923
|
-
const newContext = { ...msg.context };
|
|
78924
|
-
for (const entry of Object.entries(msg.context)) {
|
|
78925
|
-
let value = msg.context[entry[0]];
|
|
78926
|
-
if (value instanceof Error) {
|
|
78927
|
-
try {
|
|
78928
|
-
value = serializeError(value, {
|
|
78929
|
-
maxDepth: 3,
|
|
78930
|
-
});
|
|
78931
|
-
}
|
|
78932
|
-
catch (e) {
|
|
78933
|
-
logger.warn({ error: e }, `serialize of error failed`);
|
|
78934
|
-
// serialize failed, keep original value
|
|
78935
|
-
}
|
|
78936
|
-
}
|
|
78937
|
-
newContext[entry[0]] = value;
|
|
78938
|
-
}
|
|
78939
|
-
Object.assign(msg, { context: newContext });
|
|
78940
|
-
}
|
|
78941
|
-
return serializeMessage(msg);
|
|
78942
|
-
},
|
|
78943
|
-
child,
|
|
78944
|
-
configure,
|
|
78945
|
-
canLogLevel,
|
|
78946
|
-
...buildBoundFns({ component: null }),
|
|
78947
|
-
};
|
|
78948
|
-
// logger.trace({ config: logger.config }, `built logger: ${name}`);
|
|
78949
|
-
return logger;
|
|
78950
|
-
};
|
|
78951
|
-
const LOG_LEVEL_ENV = globalThis.ENV?.LOG_LEVEL ?? 'info';
|
|
78952
|
-
const defaultLogger = buildLogger('default', {
|
|
78953
|
-
level: (typeof LOG_LEVEL_ENV === 'string' ? parseInt(LOG_LEVEL_ENV) : LOG_LEVEL_ENV) ?? 10,
|
|
78954
|
-
rootComponent: globalThis.ENV?.LOG_ROOT_COMPONENT ?? 'logger',
|
|
78955
|
-
format: parseLogFormat(globalThis.ENV?.LOG_FORMAT),
|
|
78956
|
-
runtime: globalThis.ENV?.RUNTIME ?? 'development',
|
|
78957
|
-
});
|
|
78958
|
-
const log$1 = defaultLogger;
|
|
78959
|
-
globalThis.log = defaultLogger;
|
|
78960
|
-
|
|
78961
|
-
const customFormats = {
|
|
78962
|
-
number: {
|
|
78963
|
-
bytes: {
|
|
78964
|
-
style: 'decimal',
|
|
78965
|
-
maximumFractionDigits: 1,
|
|
78966
|
-
},
|
|
78967
|
-
temperature: {
|
|
78968
|
-
style: 'decimal',
|
|
78969
|
-
maximumFractionDigits: 0,
|
|
78970
|
-
},
|
|
78971
|
-
},
|
|
78972
|
-
date: {
|
|
78973
|
-
log: {
|
|
78974
|
-
dateStyle: undefined,
|
|
78975
|
-
timeStyle: 'medium',
|
|
78976
|
-
hourCycle: 'h24',
|
|
78977
|
-
},
|
|
78978
|
-
short: {
|
|
78979
|
-
dateStyle: 'short',
|
|
78980
|
-
timeStyle: 'short',
|
|
78981
|
-
},
|
|
78982
|
-
long: {
|
|
78983
|
-
dateStyle: 'long',
|
|
78984
|
-
timeStyle: 'long',
|
|
78985
|
-
},
|
|
78986
|
-
},
|
|
78987
|
-
};
|
|
78988
|
-
const onIntlError = (error) => {
|
|
78989
|
-
if (typeof window !== 'undefined') {
|
|
78990
|
-
log$1.fatal(error);
|
|
78991
|
-
}
|
|
78992
|
-
};
|
|
78993
|
-
const cache = createIntlCache();
|
|
78994
|
-
createIntl({
|
|
78995
|
-
locale: 'en-US',
|
|
78996
|
-
defaultLocale: 'en-US',
|
|
78997
|
-
formats: customFormats,
|
|
78998
|
-
onError: onIntlError,
|
|
78999
|
-
}, cache);
|
|
79000
|
-
|
|
79001
|
-
const useDebounce = (props) => {
|
|
79002
|
-
const { effect, dependencies, debounceDelay } = props;
|
|
79003
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79004
|
-
const callback = React__default.useCallback(effect, dependencies);
|
|
79005
|
-
React__default.useEffect(() => {
|
|
79006
|
-
const timeout = setTimeout(callback, debounceDelay);
|
|
79007
|
-
return () => clearTimeout(timeout);
|
|
79008
|
-
}, [callback, debounceDelay]);
|
|
79009
|
-
};
|
|
79010
|
-
|
|
79011
78253
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
79012
78254
|
// License, v2.0. If a copy of the MPL was not distributed with this
|
|
79013
78255
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/
|