@mailwoman/react 9.3.0 → 10.0.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/fonts.css +59 -0
- package/lib/common/About.tsx +105 -0
- package/lib/common/KindBadge.tsx +2 -7
- package/lib/common/confidence-tiers.ts +50 -0
- package/lib/common/index.ts +22 -0
- package/lib/common/text-tokens.ts +88 -0
- package/lib/index.ts +10 -103
- package/lib/map/BackendControl.tsx +7 -3
- package/lib/map/CompareToggle.tsx +5 -4
- package/lib/map/{GeocoderDemo.tsx → Geocoder.tsx} +81 -61
- package/lib/map/GeocoderControls.tsx +352 -0
- package/lib/map/{DemoMap.tsx → MapCanvas.tsx} +15 -15
- package/lib/map/MapChipRow.tsx +77 -0
- package/lib/map/MapCompass.tsx +77 -0
- package/lib/map/MapControlStack.tsx +98 -0
- package/lib/map/MapFooter.tsx +115 -0
- package/lib/map/MapProgressBar.tsx +58 -0
- package/lib/map/MapSearchBar.tsx +68 -0
- package/lib/map/MapSheet.tsx +62 -0
- package/lib/map/PlaceMarker.tsx +1 -1
- package/lib/map/ResolvedPlaceLayers.tsx +3 -3
- package/lib/map/ResultCamera.tsx +1 -1
- package/lib/map/ResultPanel.tsx +2 -2
- package/lib/map/VersionPicker.tsx +3 -3
- package/lib/map/fake-runtime.ts +122 -0
- package/lib/map/index.ts +35 -16
- package/lib/map/map-debug.ts +51 -0
- package/lib/map/place-render.ts +3 -2
- package/lib/map/types.ts +58 -42
- package/lib/map/{useDemoGeocode.ts → useGeocode.ts} +8 -8
- package/lib/map/useMapBearing.ts +56 -0
- package/lib/map/useMapLabelPick.ts +123 -0
- package/lib/pipeline/CandidatePicker.tsx +1 -1
- package/lib/pipeline/ComponentTable.tsx +1 -2
- package/lib/pipeline/ConfidenceCell.tsx +7 -19
- package/lib/pipeline/FailureDiagnostic.tsx +56 -0
- package/lib/pipeline/ResolvedPlace.tsx +17 -4
- package/lib/pipeline/SpanHighlight.tsx +97 -0
- package/lib/pipeline/TimingPanel.tsx +65 -0
- package/lib/pipeline/TreeView.tsx +55 -0
- package/lib/pipeline/copy.ts +1 -1
- package/lib/pipeline/index.ts +36 -0
- package/lib/pipeline/types.ts +2 -75
- package/lib/pipeline/useParsePipeline.ts +31 -19
- package/lib/poi/index.ts +39 -0
- package/lib/poi/types.ts +2 -1
- package/lib/runtime/index.ts +16 -0
- package/lib/runtime/{useDemoRuntime.ts → useReleaseRuntime.ts} +22 -24
- package/out/common/About.d.ts +21 -0
- package/out/common/About.d.ts.map +1 -0
- package/out/common/About.js +8 -0
- package/out/common/About.js.map +1 -0
- package/out/common/KindBadge.d.ts +2 -9
- package/out/common/KindBadge.d.ts.map +1 -1
- package/out/common/KindBadge.js.map +1 -1
- package/out/common/confidence-tiers.d.ts +36 -0
- package/out/common/confidence-tiers.d.ts.map +1 -0
- package/out/common/confidence-tiers.js +42 -0
- package/out/common/confidence-tiers.js.map +1 -0
- package/out/common/index.d.ts +22 -0
- package/out/common/index.d.ts.map +1 -0
- package/out/common/index.js +15 -0
- package/out/common/index.js.map +1 -0
- package/out/common/text-tokens.d.ts +46 -0
- package/out/common/text-tokens.d.ts.map +1 -0
- package/out/common/text-tokens.js +52 -0
- package/out/common/text-tokens.js.map +1 -0
- package/out/index.d.ts +5 -51
- package/out/index.d.ts.map +1 -1
- package/out/index.js +4 -30
- package/out/index.js.map +1 -1
- package/out/map/BackendControl.d.ts.map +1 -1
- package/out/map/BackendControl.js +1 -1
- package/out/map/BackendControl.js.map +1 -1
- package/out/map/CompareToggle.d.ts +2 -2
- package/out/map/CompareToggle.d.ts.map +1 -1
- package/out/map/CompareToggle.js +1 -1
- package/out/map/CompareToggle.js.map +1 -1
- package/out/map/Geocoder.d.ts +67 -0
- package/out/map/Geocoder.d.ts.map +1 -0
- package/out/map/Geocoder.js +98 -0
- package/out/map/Geocoder.js.map +1 -0
- package/out/map/GeocoderControls.d.ts +81 -0
- package/out/map/GeocoderControls.d.ts.map +1 -0
- package/out/map/GeocoderControls.js +79 -0
- package/out/map/GeocoderControls.js.map +1 -0
- package/out/map/{DemoMap.d.ts → MapCanvas.d.ts} +15 -15
- package/out/map/MapCanvas.d.ts.map +1 -0
- package/out/map/{DemoMap.js → MapCanvas.js} +2 -2
- package/out/map/MapCanvas.js.map +1 -0
- package/out/map/MapChipRow.d.ts +47 -0
- package/out/map/MapChipRow.d.ts.map +1 -0
- package/out/map/MapChipRow.js +12 -0
- package/out/map/MapChipRow.js.map +1 -0
- package/out/map/MapCompass.d.ts +42 -0
- package/out/map/MapCompass.d.ts.map +1 -0
- package/out/map/MapCompass.js +11 -0
- package/out/map/MapCompass.js.map +1 -0
- package/out/map/MapControlStack.d.ts +57 -0
- package/out/map/MapControlStack.d.ts.map +1 -0
- package/out/map/MapControlStack.js +15 -0
- package/out/map/MapControlStack.js.map +1 -0
- package/out/map/MapFooter.d.ts +40 -0
- package/out/map/MapFooter.d.ts.map +1 -0
- package/out/map/MapFooter.js +51 -0
- package/out/map/MapFooter.js.map +1 -0
- package/out/map/MapProgressBar.d.ts +34 -0
- package/out/map/MapProgressBar.d.ts.map +1 -0
- package/out/map/MapProgressBar.js +8 -0
- package/out/map/MapProgressBar.js.map +1 -0
- package/out/map/MapSearchBar.d.ts +49 -0
- package/out/map/MapSearchBar.d.ts.map +1 -0
- package/out/map/MapSearchBar.js +6 -0
- package/out/map/MapSearchBar.js.map +1 -0
- package/out/map/MapSheet.d.ts +32 -0
- package/out/map/MapSheet.d.ts.map +1 -0
- package/out/map/MapSheet.js +33 -0
- package/out/map/MapSheet.js.map +1 -0
- package/out/map/OverlayLayers.js +1 -1
- package/out/map/PlaceMarker.d.ts +1 -1
- package/out/map/ResolvedPlaceLayers.d.ts +3 -3
- package/out/map/ResolvedPlaceLayers.js +1 -1
- package/out/map/ResultCamera.d.ts +1 -1
- package/out/map/ResultCamera.js +1 -1
- package/out/map/ResultPanel.d.ts +2 -2
- package/out/map/ResultPanel.d.ts.map +1 -1
- package/out/map/ResultPanel.js +1 -1
- package/out/map/ResultPanel.js.map +1 -1
- package/out/map/VersionPicker.d.ts +3 -3
- package/out/map/VersionPicker.d.ts.map +1 -1
- package/out/map/fake-runtime.d.ts +38 -0
- package/out/map/fake-runtime.d.ts.map +1 -0
- package/out/map/fake-runtime.js +107 -0
- package/out/map/fake-runtime.js.map +1 -0
- package/out/map/index.d.ts +27 -10
- package/out/map/index.d.ts.map +1 -1
- package/out/map/index.js +16 -6
- package/out/map/index.js.map +1 -1
- package/out/map/map-debug.d.ts +31 -0
- package/out/map/map-debug.d.ts.map +1 -0
- package/out/map/map-debug.js +31 -0
- package/out/map/map-debug.js.map +1 -0
- package/out/map/place-render.d.ts +2 -2
- package/out/map/place-render.d.ts.map +1 -1
- package/out/map/place-render.js +1 -1
- package/out/map/place-render.js.map +1 -1
- package/out/map/types.d.ts +60 -42
- package/out/map/types.d.ts.map +1 -1
- package/out/map/types.js +5 -5
- package/out/map/{useDemoGeocode.d.ts → useGeocode.d.ts} +9 -9
- package/out/map/useGeocode.d.ts.map +1 -0
- package/out/map/{useDemoGeocode.js → useGeocode.js} +4 -4
- package/out/map/useGeocode.js.map +1 -0
- package/out/map/useMapBearing.d.ts +28 -0
- package/out/map/useMapBearing.d.ts.map +1 -0
- package/out/map/useMapBearing.js +35 -0
- package/out/map/useMapBearing.js.map +1 -0
- package/out/map/useMapLabelPick.d.ts +23 -0
- package/out/map/useMapLabelPick.d.ts.map +1 -0
- package/out/map/useMapLabelPick.js +104 -0
- package/out/map/useMapLabelPick.js.map +1 -0
- package/out/pipeline/CandidatePicker.d.ts +1 -1
- package/out/pipeline/CandidatePicker.d.ts.map +1 -1
- package/out/pipeline/CandidatePicker.js +1 -1
- package/out/pipeline/CandidatePicker.js.map +1 -1
- package/out/pipeline/ComponentTable.d.ts +1 -1
- package/out/pipeline/ComponentTable.d.ts.map +1 -1
- package/out/pipeline/ComponentTable.js.map +1 -1
- package/out/pipeline/ConfidenceCell.d.ts +2 -2
- package/out/pipeline/ConfidenceCell.d.ts.map +1 -1
- package/out/pipeline/ConfidenceCell.js +4 -16
- package/out/pipeline/ConfidenceCell.js.map +1 -1
- package/out/pipeline/FailureDiagnostic.d.ts +15 -0
- package/out/pipeline/FailureDiagnostic.d.ts.map +1 -0
- package/out/pipeline/FailureDiagnostic.js +21 -0
- package/out/pipeline/FailureDiagnostic.js.map +1 -0
- package/out/pipeline/PipelineExplorer.js +1 -1
- package/out/pipeline/QueryForm.js +1 -1
- package/out/pipeline/ResolvedPlace.d.ts +1 -1
- package/out/pipeline/ResolvedPlace.d.ts.map +1 -1
- package/out/pipeline/ResolvedPlace.js +4 -10
- package/out/pipeline/ResolvedPlace.js.map +1 -1
- package/out/pipeline/SpanHighlight.d.ts +23 -0
- package/out/pipeline/SpanHighlight.d.ts.map +1 -0
- package/out/pipeline/SpanHighlight.js +31 -0
- package/out/pipeline/SpanHighlight.js.map +1 -0
- package/out/pipeline/TimingPanel.d.ts +16 -0
- package/out/pipeline/TimingPanel.d.ts.map +1 -0
- package/out/pipeline/TimingPanel.js +20 -0
- package/out/pipeline/TimingPanel.js.map +1 -0
- package/out/pipeline/TreeView.d.ts +17 -0
- package/out/pipeline/TreeView.d.ts.map +1 -0
- package/out/pipeline/TreeView.js +15 -0
- package/out/pipeline/TreeView.js.map +1 -0
- package/out/pipeline/copy.d.ts +1 -1
- package/out/pipeline/copy.d.ts.map +1 -1
- package/out/pipeline/index.d.ts +33 -0
- package/out/pipeline/index.d.ts.map +1 -0
- package/out/pipeline/index.js +21 -0
- package/out/pipeline/index.js.map +1 -0
- package/out/pipeline/types.d.ts +2 -68
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +1 -1
- package/out/pipeline/useParsePipeline.d.ts +7 -3
- package/out/pipeline/useParsePipeline.d.ts.map +1 -1
- package/out/pipeline/useParsePipeline.js +6 -2
- package/out/pipeline/useParsePipeline.js.map +1 -1
- package/out/poi/LiveResultsBlock.js +1 -1
- package/out/poi/POIExplorer.js +1 -1
- package/out/poi/SubjectPanel.js +1 -1
- package/out/poi/index.d.ts +23 -0
- package/out/poi/index.d.ts.map +1 -0
- package/out/poi/index.js +15 -0
- package/out/poi/index.js.map +1 -0
- package/out/poi/runtime.d.ts.map +1 -1
- package/out/poi/types.d.ts +2 -1
- package/out/poi/types.d.ts.map +1 -1
- package/out/runtime/index.d.ts +9 -0
- package/out/runtime/index.d.ts.map +1 -0
- package/out/runtime/index.js +8 -0
- package/out/runtime/index.js.map +1 -0
- package/out/runtime/{useDemoRuntime.d.ts → useReleaseRuntime.d.ts} +18 -20
- package/out/runtime/useReleaseRuntime.d.ts.map +1 -0
- package/out/runtime/{useDemoRuntime.js → useReleaseRuntime.js} +4 -4
- package/out/runtime/useReleaseRuntime.js.map +1 -0
- package/package.json +222 -31
- package/styleframe.config.ts +329 -0
- package/styles.css +1995 -663
- package/tokens/index.css +116 -0
- package/tokens/tokens.json +528 -0
- package/tokens/tokens.resolver.json +185 -0
- package/lib/map/DemoControls.tsx +0 -194
- package/out/map/DemoControls.d.ts +0 -64
- package/out/map/DemoControls.d.ts.map +0 -1
- package/out/map/DemoControls.js +0 -30
- package/out/map/DemoControls.js.map +0 -1
- package/out/map/DemoMap.d.ts.map +0 -1
- package/out/map/DemoMap.js.map +0 -1
- package/out/map/GeocoderDemo.d.ts +0 -57
- package/out/map/GeocoderDemo.d.ts.map +0 -1
- package/out/map/GeocoderDemo.js +0 -98
- package/out/map/GeocoderDemo.js.map +0 -1
- package/out/map/useDemoGeocode.d.ts.map +0 -1
- package/out/map/useDemoGeocode.js.map +0 -1
- package/out/runtime/useDemoRuntime.d.ts.map +0 -1
- package/out/runtime/useDemoRuntime.js.map +0 -1
package/out/index.d.ts
CHANGED
|
@@ -15,55 +15,9 @@
|
|
|
15
15
|
* Styling ships separately as `@mailwoman/react/styles.css` (plain, `mw-`-prefixed, Infima-token
|
|
16
16
|
* aware) — no CSS is imported by the component modules, so the bare package import is node-safe.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export {
|
|
23
|
-
export type { ClassValue } from "#common/cx";
|
|
24
|
-
export { KindBadge } from "./common/KindBadge.tsx";
|
|
25
|
-
export type { KindBadgeProps, KindBadgeResult } from "./common/KindBadge.tsx";
|
|
26
|
-
export { LoadingIndicator } from "./common/LoadingIndicator.tsx";
|
|
27
|
-
export type { LoadingIndicatorProps, LoadingMode } from "./common/LoadingIndicator.tsx";
|
|
28
|
-
export { PresetChips } from "./common/PresetChips.tsx";
|
|
29
|
-
export type { Preset, PresetChipsProps } from "./common/PresetChips.tsx";
|
|
30
|
-
export { useClipboard } from "#common/useClipboard";
|
|
31
|
-
export type { UseClipboard } from "#common/useClipboard";
|
|
32
|
-
export { useDebouncedValue } from "#common/useDebouncedValue";
|
|
33
|
-
export { AbstainPanel } from "./poi/AbstainPanel.tsx";
|
|
34
|
-
export type { AbstainPanelProps } from "./poi/AbstainPanel.tsx";
|
|
35
|
-
export { LiveResultsBlock } from "./poi/LiveResultsBlock.tsx";
|
|
36
|
-
export type { LiveResultsBlockProps } from "./poi/LiveResultsBlock.tsx";
|
|
37
|
-
export { OverpassBlock } from "./poi/OverpassBlock.tsx";
|
|
38
|
-
export type { OverpassBlockProps } from "./poi/OverpassBlock.tsx";
|
|
39
|
-
export { POIExplorer } from "./poi/POIExplorer.tsx";
|
|
40
|
-
export type { POIExplorerProps } from "./poi/POIExplorer.tsx";
|
|
41
|
-
export { QueryInput } from "./poi/QueryInput.tsx";
|
|
42
|
-
export type { QueryInputProps } from "./poi/QueryInput.tsx";
|
|
43
|
-
export { formatDistance, loadPOIRuntime, POI_DEFAULT_TEXT, POI_PRESETS } from "#poi/runtime";
|
|
44
|
-
export { SubjectPanel } from "./poi/SubjectPanel.tsx";
|
|
45
|
-
export type { SubjectPanelProps } from "./poi/SubjectPanel.tsx";
|
|
46
|
-
export type { CategoryRecord, LiveSearchState, LoadPOIRuntime, POIBrandSubject, POICategorySubject, POIExplorerResult, POILiveSearch, POILiveSearchResult, POIRuntime, POISearchHit, POISubject, POISubjectBase, TaxonomyLookup, } from "#poi/types";
|
|
47
|
-
export { usePOISearch } from "#poi/usePOISearch";
|
|
48
|
-
export type { UsePOISearch, UsePOISearchOptions } from "#poi/usePOISearch";
|
|
49
|
-
export { CandidatePicker } from "./pipeline/CandidatePicker.tsx";
|
|
50
|
-
export type { CandidatePickerProps } from "./pipeline/CandidatePicker.tsx";
|
|
51
|
-
export { ComponentTable } from "./pipeline/ComponentTable.tsx";
|
|
52
|
-
export type { ComponentTableProps } from "./pipeline/ComponentTable.tsx";
|
|
53
|
-
export { ConfidenceCell } from "./pipeline/ConfidenceCell.tsx";
|
|
54
|
-
export type { ConfidenceCellProps } from "./pipeline/ConfidenceCell.tsx";
|
|
55
|
-
export { buildParsePayload } from "#pipeline/copy";
|
|
56
|
-
export { PIPELINE_DEFAULT_ADDRESS, PIPELINE_PRESETS } from "#pipeline/presets";
|
|
57
|
-
export { PipelineExplorer } from "./pipeline/PipelineExplorer.tsx";
|
|
58
|
-
export type { PipelineExplorerProps } from "./pipeline/PipelineExplorer.tsx";
|
|
59
|
-
export { QueryForm } from "./pipeline/QueryForm.tsx";
|
|
60
|
-
export type { QueryFormProps } from "./pipeline/QueryForm.tsx";
|
|
61
|
-
export { ResolvedPlace } from "./pipeline/ResolvedPlace.tsx";
|
|
62
|
-
export type { ResolvedPlaceProps } from "./pipeline/ResolvedPlace.tsx";
|
|
63
|
-
export type { DualRoleView, FSTProvenance, ParsedComponent, ParseResult, PipelineLoadingState, PipelinePanels, PipelineRuntime, ResolvedPlaceView, StageTiming, } from "#pipeline/types";
|
|
64
|
-
export { useParsePipeline } from "#pipeline/useParsePipeline";
|
|
65
|
-
export type { UseParsePipeline, UseParsePipelineOptions } from "#pipeline/useParsePipeline";
|
|
66
|
-
export { useDemoRuntime } from "#runtime/useDemoRuntime";
|
|
67
|
-
export type { DemoAssetsLoadContext, DemoLoaderState, DemoManifest, DemoReleaseBase, DemoRuntimeConfig, } from "#runtime/useDemoRuntime";
|
|
68
|
-
export type { DemoBackend, DemoMapExtraProps, DemoMapProps, DemoMapStyle, DemoRuntime, DemoVersionOption, LngLatTuple, MapBias, OverlaySpec, Suggestion, } from "#map/index";
|
|
18
|
+
export * from "#common/index";
|
|
19
|
+
export * from "#poi/index";
|
|
20
|
+
export * from "#pipeline/index";
|
|
21
|
+
export * from "#runtime/index";
|
|
22
|
+
export type { GeocoderRuntime, InferenceBackend, LngLatTuple, MapBias, MapCanvasExtraProps, MapCanvasProps, MapCanvasStyle, OverlaySpec, Suggestion, VersionOption, } from "#map/index";
|
|
69
23
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAE9B,YAAY,EACX,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,WAAW,EACX,UAAU,EACV,aAAa,GACb,MAAM,YAAY,CAAA"}
|
package/out/index.js
CHANGED
|
@@ -15,34 +15,8 @@
|
|
|
15
15
|
* Styling ships separately as `@mailwoman/react/styles.css` (plain, `mw-`-prefixed, Infima-token
|
|
16
16
|
* aware) — no CSS is imported by the component modules, so the bare package import is node-safe.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export { KindBadge } from "./common/KindBadge.js";
|
|
23
|
-
export { LoadingIndicator } from "./common/LoadingIndicator.js";
|
|
24
|
-
export { PresetChips } from "./common/PresetChips.js";
|
|
25
|
-
export { useClipboard } from "#common/useClipboard";
|
|
26
|
-
export { useDebouncedValue } from "#common/useDebouncedValue";
|
|
27
|
-
// ── POI explorer ───────────────────────────────────────────────────────────
|
|
28
|
-
export { AbstainPanel } from "./poi/AbstainPanel.js";
|
|
29
|
-
export { LiveResultsBlock } from "./poi/LiveResultsBlock.js";
|
|
30
|
-
export { OverpassBlock } from "./poi/OverpassBlock.js";
|
|
31
|
-
export { POIExplorer } from "./poi/POIExplorer.js";
|
|
32
|
-
export { QueryInput } from "./poi/QueryInput.js";
|
|
33
|
-
export { formatDistance, loadPOIRuntime, POI_DEFAULT_TEXT, POI_PRESETS } from "#poi/runtime";
|
|
34
|
-
export { SubjectPanel } from "./poi/SubjectPanel.js";
|
|
35
|
-
export { usePOISearch } from "#poi/usePOISearch";
|
|
36
|
-
// ── Pipeline explorer ──────────────────────────────────────────────────────
|
|
37
|
-
export { CandidatePicker } from "./pipeline/CandidatePicker.js";
|
|
38
|
-
export { ComponentTable } from "./pipeline/ComponentTable.js";
|
|
39
|
-
export { ConfidenceCell } from "./pipeline/ConfidenceCell.js";
|
|
40
|
-
export { buildParsePayload } from "#pipeline/copy";
|
|
41
|
-
export { PIPELINE_DEFAULT_ADDRESS, PIPELINE_PRESETS } from "#pipeline/presets";
|
|
42
|
-
export { PipelineExplorer } from "./pipeline/PipelineExplorer.js";
|
|
43
|
-
export { QueryForm } from "./pipeline/QueryForm.js";
|
|
44
|
-
export { ResolvedPlace } from "./pipeline/ResolvedPlace.js";
|
|
45
|
-
export { useParsePipeline } from "#pipeline/useParsePipeline";
|
|
46
|
-
// ── Demo runtime (shared load orchestration; node-safe — no onnx/httpvfs/maplibre) ──
|
|
47
|
-
export { useDemoRuntime } from "#runtime/useDemoRuntime";
|
|
18
|
+
export * from "#common/index";
|
|
19
|
+
export * from "#poi/index";
|
|
20
|
+
export * from "#pipeline/index";
|
|
21
|
+
export * from "#runtime/index";
|
|
48
22
|
//# sourceMappingURL=index.js.map
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackendControl.d.ts","sourceRoot":"","sources":["../../lib/map/BackendControl.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,iBAAiB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;CAC/C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,mBAAmB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"BackendControl.d.ts","sourceRoot":"","sources":["../../lib/map/BackendControl.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,iBAAiB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;CAC/C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,mBAAmB,GAAG,SAAS,CAiB9G"}
|
|
@@ -3,6 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
* The backend indicator + WASM opt-out.
|
|
4
4
|
*/
|
|
5
5
|
export function BackendControl({ activeBackend, forceWASM, onForceWASMChange }) {
|
|
6
|
-
return (_jsxs("div", { className: "mw-demo-backend", children: [activeBackend ? (_jsxs("span", { className: "mw-demo-backend__active", children: ["
|
|
6
|
+
return (_jsxs("div", { className: "mw-demo-backend", children: [_jsx("span", { className: "mw-map-sheet__label", children: "Inference backend" }), activeBackend ? (_jsxs("span", { className: "mw-demo-backend__active", children: ["Running on ", _jsx("code", { children: activeBackend })] })) : null, _jsxs("label", { className: "mw-map-sheet__check mw-demo-backend__toggle", children: [_jsx("input", { type: "checkbox", checked: forceWASM, onChange: (event) => onForceWASMChange(event.target.checked) }), "Force WASM"] })] }));
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=BackendControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackendControl.js","sourceRoot":"","sources":["../../lib/map/BackendControl.tsx"],"names":[],"mappings":";AA8BA;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,iBAAiB,EAAuB;IAClG,OAAO,CACN,eAAK,SAAS,EAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"BackendControl.js","sourceRoot":"","sources":["../../lib/map/BackendControl.tsx"],"names":[],"mappings":";AA8BA;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,iBAAiB,EAAuB;IAClG,OAAO,CACN,eAAK,SAAS,EAAC,iBAAiB,aAC/B,eAAM,SAAS,EAAC,qBAAqB,kCAAyB,EAE7D,aAAa,CAAC,CAAC,CAAC,CAChB,gBAAM,SAAS,EAAC,yBAAyB,4BAC7B,yBAAO,aAAa,GAAQ,IACjC,CACP,CAAC,CAAC,CAAC,IAAI,EAER,iBAAO,SAAS,EAAC,6CAA6C,aAC7D,gBAAO,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAI,kBAEpG,IACH,CACN,CAAA;AACF,CAAC"}
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
* NODE-SAFE: pure React, no maplibre.
|
|
12
12
|
*/
|
|
13
13
|
import type { ReactNode } from "react";
|
|
14
|
-
import type {
|
|
14
|
+
import type { VersionOption } from "#map/types";
|
|
15
15
|
export interface CompareToggleProps {
|
|
16
16
|
/**
|
|
17
17
|
* The selectable model bundles (the primary version is filtered out of the compare list).
|
|
18
18
|
*/
|
|
19
|
-
versions: ReadonlyArray<
|
|
19
|
+
versions: ReadonlyArray<VersionOption>;
|
|
20
20
|
/**
|
|
21
21
|
* The primary version, excluded from the compare options.
|
|
22
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompareToggle.d.ts","sourceRoot":"","sources":["../../lib/map/CompareToggle.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CompareToggle.d.ts","sourceRoot":"","sources":["../../lib/map/CompareToggle.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,CAAA;IACtC;;OAEG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,mBAAmB,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAA;IACnD;;OAEG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;OAEG;IACH,sBAAsB,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACxD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAA;CAClB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC7B,QAAQ,EACR,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACR,MAAM,GACN,EAAE,kBAAkB,GAAG,SAAS,CAmChC"}
|
package/out/map/CompareToggle.js
CHANGED
|
@@ -6,6 +6,6 @@ export function CompareToggle({ versions, primaryVersion, compareMode, onCompare
|
|
|
6
6
|
if (versions.length < 2)
|
|
7
7
|
return null;
|
|
8
8
|
const options = versions.filter((v) => v.version !== primaryVersion);
|
|
9
|
-
return (_jsxs("div", { className: "mw-demo-compare", children: [_jsxs("label", { className: "mw-demo-compare__toggle", children: [_jsx("input", { type: "checkbox", checked: compareMode, onChange: (
|
|
9
|
+
return (_jsxs("div", { className: "mw-demo-compare", children: [_jsxs("label", { className: "mw-map-sheet__check mw-demo-compare__toggle", children: [_jsx("input", { type: "checkbox", checked: compareMode, onChange: (event) => onCompareModeChange(event.target.checked) }), "Compare two model versions"] }), compareMode ? (_jsxs("div", { className: "mw-demo-control", children: [_jsx("label", { className: "mw-demo-control__label", htmlFor: "mw-demo-compare-version", children: "Compare with" }), _jsxs("select", { id: "mw-demo-compare-version", className: "mw-demo-control__select", value: compareVersion ?? "", onChange: (e) => onCompareVersionChange(e.target.value || null), disabled: disabled, children: [_jsx("option", { value: "", children: "Select version\u2026" }), options.map((v) => (_jsx("option", { value: v.version, children: v.label ?? v.version }, v.version)))] }), status ? _jsx("p", { className: "mw-demo-compare__status", children: status }) : null] })) : null] }));
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=CompareToggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompareToggle.js","sourceRoot":"","sources":["../../lib/map/CompareToggle.tsx"],"names":[],"mappings":";AAoDA;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,EAC7B,QAAQ,EACR,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACR,MAAM,GACc;IACpB,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IAEpC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,cAAc,CAAC,CAAA;IAEpE,OAAO,CACN,eAAK,SAAS,EAAC,iBAAiB,aAC/B,iBAAO,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"CompareToggle.js","sourceRoot":"","sources":["../../lib/map/CompareToggle.tsx"],"names":[],"mappings":";AAoDA;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,EAC7B,QAAQ,EACR,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACR,MAAM,GACc;IACpB,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IAEpC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,cAAc,CAAC,CAAA;IAEpE,OAAO,CACN,eAAK,SAAS,EAAC,iBAAiB,aAC/B,iBAAO,SAAS,EAAC,6CAA6C,aAC7D,gBAAO,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAI,kCAExG,EACP,WAAW,CAAC,CAAC,CAAC,CACd,eAAK,SAAS,EAAC,iBAAiB,aAC/B,gBAAO,SAAS,EAAC,wBAAwB,EAAC,OAAO,EAAC,yBAAyB,6BAEnE,EACR,kBACC,EAAE,EAAC,yBAAyB,EAC5B,SAAS,EAAC,yBAAyB,EACnC,KAAK,EAAE,cAAc,IAAI,EAAE,EAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,EAC/D,QAAQ,EAAE,QAAQ,aAElB,iBAAQ,KAAK,EAAC,EAAE,qCAAyB,EACxC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACnB,iBAAwB,KAAK,EAAE,CAAC,CAAC,OAAO,YACtC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,IADT,CAAC,CAAC,OAAO,CAEb,CACT,CAAC,IACM,EACR,MAAM,CAAC,CAAC,CAAC,YAAG,SAAS,EAAC,yBAAyB,YAAE,MAAM,GAAK,CAAC,CAAC,CAAC,IAAI,IAC/D,CACN,CAAC,CAAC,CAAC,IAAI,IACH,CACN,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `<Geocoder>` — the WHOLE geocoder, composed. It is the map analogue of `PipelineExplorer`
|
|
7
|
+
* and takes the SAME DI shape: an injected {@link GeocoderRuntime} (the host owns ONNX / httpvfs / R2 /
|
|
8
|
+
* the composed map style) plus a {@link GeocoderPanels} bag (the host's ModelVisualizer / VersionCompare /
|
|
9
|
+
* About / Permalink). Everything here is composition + a `ClientOnly` boundary:
|
|
10
|
+
*
|
|
11
|
+
* - the floating {@link GeocoderControls} panel (version / compare / backend / query+autocomplete / result),
|
|
12
|
+
* - the declarative {@link MapCanvas} with the phase-2 overlays ({@link OverlayLayers}) and the
|
|
13
|
+
* resolved-place marker/outline/camera ({@link ResolvedPlaceLayers}) driven by the parse state,
|
|
14
|
+
* - the hooks that wire them: {@link useGeocode} (parse + viewport bias + map place),
|
|
15
|
+
* {@link usePlaceAutocomplete}, {@link useCompareState}.
|
|
16
|
+
*
|
|
17
|
+
* Because it pulls {@link MapCanvas} (→ `react-map-gl` → `maplibre-gl`, WebGL + DOM at import), it lives on
|
|
18
|
+
* the `@mailwoman/react/map` subpath ONLY — never the package root. The whole thing renders in Storybook
|
|
19
|
+
* over a fake runtime (offline stub style + canned geocode) with no network, no ONNX, no gazetteer.
|
|
20
|
+
*/
|
|
21
|
+
import { type ReactNode } from "react";
|
|
22
|
+
import type { GeocoderPanels, GeocoderRuntime } from "#map/types";
|
|
23
|
+
import type { Preset } from "../common/PresetChips.tsx";
|
|
24
|
+
export interface GeocoderProps {
|
|
25
|
+
/**
|
|
26
|
+
* The injected geocoder runtime (map style + overlays + parse + version/backend).
|
|
27
|
+
*/
|
|
28
|
+
runtime: GeocoderRuntime;
|
|
29
|
+
/**
|
|
30
|
+
* Host-injected panels (about, release blurb, compare, permalink, debug drawer, map controls, …).
|
|
31
|
+
*/
|
|
32
|
+
panels?: GeocoderPanels;
|
|
33
|
+
/**
|
|
34
|
+
* Address to pre-fill.
|
|
35
|
+
*/
|
|
36
|
+
defaultAddress?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Example chips. @default the empty set (host supplies its own).
|
|
39
|
+
*/
|
|
40
|
+
presets?: ReadonlyArray<Preset>;
|
|
41
|
+
/**
|
|
42
|
+
* Open the developer disclosure on mount — the model version, the backend readout and compare. Collapsed by default
|
|
43
|
+
* so the address field is the first thing a visitor meets. @default false
|
|
44
|
+
*/
|
|
45
|
+
developer?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Fired with the query each time one is submitted. The host writes it into its own URL — this package never touches
|
|
48
|
+
* `location`, because which parameter carries a query is the app's decision.
|
|
49
|
+
*/
|
|
50
|
+
onSubmitQuery?: (query: string) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Only hint the viewport bias once the visitor has zoomed past the global view — a whole-globe center is noise.
|
|
53
|
+
* Matches the `map.getZoom() >= 4` threshold. @default 4
|
|
54
|
+
*/
|
|
55
|
+
minBiasZoom?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Fly/fit the map to the resolved place on each result (via {@link ResolvedPlaceLayers}). @default true. Set false
|
|
58
|
+
* for a host that drives the camera itself (a controlled `<MapCanvas viewState>`), or to keep a headless test
|
|
59
|
+
* deterministic — the marker + outline still render, only the animated camera move is skipped.
|
|
60
|
+
*/
|
|
61
|
+
applyResultCamera?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The composed geocoder, behind a `ClientOnly` SSR boundary (the map is intrinsically a client component).
|
|
65
|
+
*/
|
|
66
|
+
export declare function Geocoder({ runtime, panels, defaultAddress, presets, minBiasZoom, applyResultCamera, developer, onSubmitQuery, }: GeocoderProps): ReactNode;
|
|
67
|
+
//# sourceMappingURL=Geocoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Geocoder.d.ts","sourceRoot":"","sources":["../../lib/map/Geocoder.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,SAAS,EAA4C,MAAM,OAAO,CAAA;AAGhF,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAW,MAAM,YAAY,CAAA;AAO1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAMvD,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,OAAO,EAAE,eAAe,CAAA;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAgID;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EACxB,OAAO,EACP,MAAkB,EAClB,cAAmB,EACnB,OAAoB,EACpB,WAAe,EACf,iBAAwB,EACxB,SAAiB,EACjB,aAAa,GACb,EAAE,aAAa,GAAG,SAAS,CAuB3B"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @copyright Sister Software
|
|
4
|
+
* @license AGPL-3.0
|
|
5
|
+
* @author Teffen Ellis, et al.
|
|
6
|
+
*
|
|
7
|
+
* `<Geocoder>` — the WHOLE geocoder, composed. It is the map analogue of `PipelineExplorer`
|
|
8
|
+
* and takes the SAME DI shape: an injected {@link GeocoderRuntime} (the host owns ONNX / httpvfs / R2 /
|
|
9
|
+
* the composed map style) plus a {@link GeocoderPanels} bag (the host's ModelVisualizer / VersionCompare /
|
|
10
|
+
* About / Permalink). Everything here is composition + a `ClientOnly` boundary:
|
|
11
|
+
*
|
|
12
|
+
* - the floating {@link GeocoderControls} panel (version / compare / backend / query+autocomplete / result),
|
|
13
|
+
* - the declarative {@link MapCanvas} with the phase-2 overlays ({@link OverlayLayers}) and the
|
|
14
|
+
* resolved-place marker/outline/camera ({@link ResolvedPlaceLayers}) driven by the parse state,
|
|
15
|
+
* - the hooks that wire them: {@link useGeocode} (parse + viewport bias + map place),
|
|
16
|
+
* {@link usePlaceAutocomplete}, {@link useCompareState}.
|
|
17
|
+
*
|
|
18
|
+
* Because it pulls {@link MapCanvas} (→ `react-map-gl` → `maplibre-gl`, WebGL + DOM at import), it lives on
|
|
19
|
+
* the `@mailwoman/react/map` subpath ONLY — never the package root. The whole thing renders in Storybook
|
|
20
|
+
* over a fake runtime (offline stub style + canned geocode) with no network, no ONNX, no gazetteer.
|
|
21
|
+
*/
|
|
22
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
23
|
+
import { useCompareState } from "#map/useCompareState";
|
|
24
|
+
import { useGeocode } from "#map/useGeocode";
|
|
25
|
+
import { useMapPlaceRender } from "#map/useMapPlaceRender";
|
|
26
|
+
import { usePlaceAutocomplete } from "#map/usePlaceAutocomplete";
|
|
27
|
+
import { ClientOnly } from "../common/ClientOnly.js";
|
|
28
|
+
import { GeocoderControls } from "./GeocoderControls.js";
|
|
29
|
+
import { MapCanvas } from "./MapCanvas.js";
|
|
30
|
+
import { OverlayLayers } from "./OverlayLayers.js";
|
|
31
|
+
import { ResolvedPlaceLayers } from "./ResolvedPlaceLayers.js";
|
|
32
|
+
function GeocoderInner({ runtime, panels, defaultAddress, presets, minBiasZoom, applyResultCamera, developer, onSubmitQuery, }) {
|
|
33
|
+
const mapRef = useRef(null);
|
|
34
|
+
// The chrome sits OUTSIDE `<MapCanvas>`, so it cannot take the handle from `useMap()`. A ref alone does not
|
|
35
|
+
// re-render the compass or the layer control when the map arrives, so the same poll that publishes the test
|
|
36
|
+
// handle also puts it in state — one poll, two consumers.
|
|
37
|
+
const [map, setMap] = useState(null);
|
|
38
|
+
// The map announces itself; nothing polls for it. `onLoad` carries the instance, so the compass and the layer
|
|
39
|
+
// control render on the frame the map is ready rather than up to an interval later.
|
|
40
|
+
//
|
|
41
|
+
// TEST INJECTION POINT: the e2e viewport-bias suite drives the REAL map (pan + zoom past the bias threshold)
|
|
42
|
+
// before submitting, and a browser test cannot reach a React ref — so the same handle is republished on
|
|
43
|
+
// `globalThis.__mailwomanMapCanvas`, and cleared on unmount so a torn-down geocoder leaves no stale handle.
|
|
44
|
+
const onMapLoad = useCallback((event) => {
|
|
45
|
+
;
|
|
46
|
+
globalThis.__mailwomanMapCanvas = event.target;
|
|
47
|
+
setMap(event.target);
|
|
48
|
+
}, []);
|
|
49
|
+
useEffect(() => () => {
|
|
50
|
+
setMap(null);
|
|
51
|
+
delete globalThis.__mailwomanMapCanvas;
|
|
52
|
+
}, []);
|
|
53
|
+
// Read the viewport bias at submit time — through the map handle, never a threaded state value, so granting/zooming
|
|
54
|
+
// mid-session doesn't re-create the parse callback. Below the min-bias zoom, a whole-globe center is noise → null.
|
|
55
|
+
const getBias = useCallback(() => {
|
|
56
|
+
const live = mapRef.current?.getMap();
|
|
57
|
+
if (!live)
|
|
58
|
+
return null;
|
|
59
|
+
const zoom = live.getZoom();
|
|
60
|
+
if (zoom < minBiasZoom)
|
|
61
|
+
return null;
|
|
62
|
+
const center = live.getCenter();
|
|
63
|
+
return { center: [center.lng, center.lat], zoom };
|
|
64
|
+
}, [minBiasZoom]);
|
|
65
|
+
const geocode = useGeocode({ runtime, defaultText: defaultAddress, getBias });
|
|
66
|
+
const compare = useCompareState();
|
|
67
|
+
const autocomplete = usePlaceAutocomplete({
|
|
68
|
+
text: geocode.text,
|
|
69
|
+
setText: geocode.setText,
|
|
70
|
+
autocomplete: runtime.autocomplete,
|
|
71
|
+
});
|
|
72
|
+
const spec = useMapPlaceRender(geocode.mapPlace);
|
|
73
|
+
const onSelectVersion = useCallback((version) => {
|
|
74
|
+
runtime.selectVersion?.(version);
|
|
75
|
+
compare.clearIfPrimary(version);
|
|
76
|
+
}, [runtime, compare]);
|
|
77
|
+
const onForceWASMChange = useCallback((forceWASM) => runtime.setForceWASM?.(forceWASM), [runtime]);
|
|
78
|
+
return (_jsxs("div", { className: "mw-geocoder-demo", children: [_jsx("div", { className: "mw-geocoder-demo__map", children: _jsxs(MapCanvas, { mapStyle: runtime.mapStyle, mapRef: mapRef, initialViewState: {
|
|
79
|
+
longitude: runtime.initialCenter[0],
|
|
80
|
+
latitude: runtime.initialCenter[1],
|
|
81
|
+
zoom: runtime.initialZoom ?? 3,
|
|
82
|
+
}, style: { width: "100%", height: "100%" },
|
|
83
|
+
// One compact attribution pill (the map's own default is a wide, always-open "MapLibre | © …" bar), no
|
|
84
|
+
// maplibre wordmark logo.
|
|
85
|
+
mapProps: { attributionControl: { compact: true }, maplibreLogo: false, onLoad: onMapLoad }, children: [_jsx(OverlayLayers, { overlays: runtime.overlays }), _jsx(ResolvedPlaceLayers, { spec: spec, applyCamera: applyResultCamera }), panels.mapControls] }) }), _jsx(GeocoderControls, { runtime: runtime, geocode: geocode, autocomplete: autocomplete, compare: compare, panels: panels, presets: presets, placeholder: defaultAddress, map: map, onSubmitQuery: onSubmitQuery, onSelectVersion: onSelectVersion, onForceWASMChange: onForceWASMChange, developer: developer }), panels.debugDrawer ? panels.debugDrawer({ result: geocode.result }) : null] }));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Stable empty defaults — a fresh `{}`/`[]` per render would churn every downstream memo dep.
|
|
89
|
+
*/
|
|
90
|
+
const NO_PANELS = {};
|
|
91
|
+
const NO_PRESETS = [];
|
|
92
|
+
/**
|
|
93
|
+
* The composed geocoder, behind a `ClientOnly` SSR boundary (the map is intrinsically a client component).
|
|
94
|
+
*/
|
|
95
|
+
export function Geocoder({ runtime, panels = NO_PANELS, defaultAddress = "", presets = NO_PRESETS, minBiasZoom = 4, applyResultCamera = true, developer = false, onSubmitQuery, }) {
|
|
96
|
+
return (_jsx(ClientOnly, { fallback: _jsx("div", { className: "mw-geocoder-demo", children: _jsx("p", { children: "Loading the geocoder\u2026" }) }), children: () => (_jsx(GeocoderInner, { runtime: runtime, panels: panels, defaultAddress: defaultAddress, presets: presets, minBiasZoom: minBiasZoom, applyResultCamera: applyResultCamera, developer: developer, onSubmitQuery: onSubmitQuery })) }));
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=Geocoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Geocoder.js","sourceRoot":"","sources":["../../lib/map/Geocoder.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAkB,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIhF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAA0B,CAAA;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAwB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAiB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA2B,CAAA;AAkD/D,SAAS,aAAa,CAAC,EACtB,OAAO,EACP,MAAM,EACN,cAAc,EACd,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,aAAa,GACO;IACpB,MAAM,MAAM,GAAG,MAAM,CAAS,IAAI,CAAC,CAAA;IACnC,4GAA4G;IAC5G,4GAA4G;IAC5G,0DAA0D;IAC1D,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAsC,IAAI,CAAC,CAAA;IAEzE,8GAA8G;IAC9G,oFAAoF;IACpF,EAAE;IACF,6GAA6G;IAC7G,wGAAwG;IACxG,4GAA4G;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
+
* The geocoder's chrome over the map: a search pill on top, example chips on one line beneath it, a control column
|
|
7
|
+
* down the right edge, and a result sheet that rises from the bottom when there is something to show.
|
|
8
|
+
*
|
|
9
|
+
* It replaces a 400px full-height panel that carried every control at once. The layout is the one the reference
|
|
10
|
+
* map apps use, and the reason is the map: chrome that floats over it leaves the map the page, where a slab makes
|
|
11
|
+
* the map the leftover third.
|
|
12
|
+
*
|
|
13
|
+
* NODE-SAFE: pure React + the shared units, no maplibre.
|
|
14
|
+
*/
|
|
15
|
+
import { type ReactNode } from "react";
|
|
16
|
+
import type { MapInstance } from "react-map-gl/maplibre";
|
|
17
|
+
import type { GeocoderPanels, GeocoderRuntime } from "#map/types";
|
|
18
|
+
import type { UseCompareState } from "#map/useCompareState";
|
|
19
|
+
import type { UseGeocode } from "#map/useGeocode";
|
|
20
|
+
import type { UsePlaceAutocomplete } from "#map/usePlaceAutocomplete";
|
|
21
|
+
import type { Preset } from "../common/PresetChips.tsx";
|
|
22
|
+
export interface GeocoderControlsProps {
|
|
23
|
+
/**
|
|
24
|
+
* The injected geocoder runtime.
|
|
25
|
+
*/
|
|
26
|
+
runtime: GeocoderRuntime;
|
|
27
|
+
/**
|
|
28
|
+
* The parse+resolve state machine.
|
|
29
|
+
*/
|
|
30
|
+
geocode: UseGeocode;
|
|
31
|
+
/**
|
|
32
|
+
* The place-autocomplete combobox state.
|
|
33
|
+
*/
|
|
34
|
+
autocomplete: UsePlaceAutocomplete;
|
|
35
|
+
/**
|
|
36
|
+
* The compare-mode state.
|
|
37
|
+
*/
|
|
38
|
+
compare: UseCompareState;
|
|
39
|
+
/**
|
|
40
|
+
* Host-injected panels (about, release blurb, compare, permalink, extras, failure).
|
|
41
|
+
*/
|
|
42
|
+
panels: GeocoderPanels;
|
|
43
|
+
/**
|
|
44
|
+
* Example chips.
|
|
45
|
+
*/
|
|
46
|
+
presets: ReadonlyArray<Preset>;
|
|
47
|
+
/**
|
|
48
|
+
* Input placeholder.
|
|
49
|
+
*/
|
|
50
|
+
placeholder: string;
|
|
51
|
+
/**
|
|
52
|
+
* The live map, for the controls that read it: the compass takes its bearing, the host's layer control reads its
|
|
53
|
+
* style. `null` until react-map-gl instantiates the map.
|
|
54
|
+
*/
|
|
55
|
+
map?: MapInstance | null;
|
|
56
|
+
/**
|
|
57
|
+
* Fired with the query whenever one is submitted, before the parse starts. The host writes it into the URL; this
|
|
58
|
+
* package never touches `location`, because the address bar is the app's state, not a control's.
|
|
59
|
+
*/
|
|
60
|
+
onSubmitQuery?: (query: string) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Select a model version (the composed geocoder also clears a now-colliding compare selection).
|
|
63
|
+
*/
|
|
64
|
+
onSelectVersion: (version: string) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Toggle the forced WASM backend.
|
|
67
|
+
*/
|
|
68
|
+
onForceWASMChange: (forceWASM: boolean) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Open the developer panel on mount. The model version, the backend readout and compare live inside it: they read on
|
|
71
|
+
* the model rather than on an address, and above the query field they were the first thing every visitor met.
|
|
72
|
+
*
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
developer?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The chrome. Everything positioned here floats over the map; nothing occupies a column of the page.
|
|
79
|
+
*/
|
|
80
|
+
export declare function GeocoderControls({ runtime, geocode, autocomplete, compare, panels, presets, placeholder, map, onSubmitQuery, onSelectVersion, onForceWASMChange, developer, }: GeocoderControlsProps): ReactNode;
|
|
81
|
+
//# sourceMappingURL=GeocoderControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeocoderControls.d.ts","sourceRoot":"","sources":["../../lib/map/GeocoderControls.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAyB,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,u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-0,0 +1,79 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @copyright Sister Software
|
|
4
|
+
* @license AGPL-3.0
|
|
5
|
+
* @author Teffen Ellis, et al.
|
|
6
|
+
*
|
|
7
|
+
* The geocoder's chrome over the map: a search pill on top, example chips on one line beneath it, a control column
|
|
8
|
+
* down the right edge, and a result sheet that rises from the bottom when there is something to show.
|
|
9
|
+
*
|
|
10
|
+
* It replaces a 400px full-height panel that carried every control at once. The layout is the one the reference
|
|
11
|
+
* map apps use, and the reason is the map: chrome that floats over it leaves the map the page, where a slab makes
|
|
12
|
+
* the map the leftover third.
|
|
13
|
+
*
|
|
14
|
+
* NODE-SAFE: pure React + the shared units, no maplibre.
|
|
15
|
+
*/
|
|
16
|
+
import { useCallback, useState } from "react";
|
|
17
|
+
import { useMapBearing } from "#map/useMapBearing";
|
|
18
|
+
import { useMapLabelPick } from "#map/useMapLabelPick";
|
|
19
|
+
import { LoadingIndicator } from "../common/LoadingIndicator.js";
|
|
20
|
+
import { BackendControl } from "./BackendControl.js";
|
|
21
|
+
import { CompareToggle } from "./CompareToggle.js";
|
|
22
|
+
import { MapChipRow } from "./MapChipRow.js";
|
|
23
|
+
import { MapCompass } from "./MapCompass.js";
|
|
24
|
+
import { MapControlButton, MapControlGroup, MapControlStack } from "./MapControlStack.js";
|
|
25
|
+
import { MapProgressBar } from "./MapProgressBar.js";
|
|
26
|
+
import { MapSearchBar } from "./MapSearchBar.js";
|
|
27
|
+
import { MapSheet } from "./MapSheet.js";
|
|
28
|
+
import { PlaceAutocomplete } from "./PlaceAutocomplete.js";
|
|
29
|
+
import { ResultPanel } from "./ResultPanel.js";
|
|
30
|
+
import { VersionPicker } from "./VersionPicker.js";
|
|
31
|
+
/**
|
|
32
|
+
* The chrome. Everything positioned here floats over the map; nothing occupies a column of the page.
|
|
33
|
+
*/
|
|
34
|
+
export function GeocoderControls({ runtime, geocode, autocomplete, compare, panels, presets, placeholder, map = null, onSubmitQuery, onSelectVersion, onForceWASMChange, developer = false, }) {
|
|
35
|
+
const versions = runtime.availableVersions ?? [];
|
|
36
|
+
const { busy, result, selectedCandidate } = geocode;
|
|
37
|
+
const loading = runtime.loading;
|
|
38
|
+
const errorMessage = geocode.parseError ?? runtime.errorMessage ?? null;
|
|
39
|
+
// One sheet at a time. Two open at once stack on the same edge, and on a phone each is the full panel.
|
|
40
|
+
const [openSheet, setOpenSheet] = useState(developer ? "developer" : null);
|
|
41
|
+
const { bearing, resetNorth } = useMapBearing(map);
|
|
42
|
+
const toggleSheet = (name) => setOpenSheet((current) => (current === name ? null : name));
|
|
43
|
+
const closeSheet = useCallback(() => setOpenSheet(null), []);
|
|
44
|
+
// Every path that starts a query goes through here, so the URL is written in exactly one place — the event that
|
|
45
|
+
// caused it, rather than an effect watching the result after the fact.
|
|
46
|
+
const runQuery = useCallback((query) => {
|
|
47
|
+
onSubmitQuery?.(query);
|
|
48
|
+
void geocode.submit(query);
|
|
49
|
+
}, [onSubmitQuery, geocode]);
|
|
50
|
+
// A label on the map is a search a visitor already typed by pointing at it.
|
|
51
|
+
const pickLabel = useCallback((name) => {
|
|
52
|
+
geocode.setText(name);
|
|
53
|
+
geocode.reset();
|
|
54
|
+
runQuery(name);
|
|
55
|
+
}, [geocode, runQuery]);
|
|
56
|
+
useMapLabelPick(map, pickLabel);
|
|
57
|
+
const chips = presets.map((preset) => ({ label: preset.label, value: preset.value }));
|
|
58
|
+
// The bundle load no longer opens the result sheet: it reports on the bar at the top of the viewport and in the
|
|
59
|
+
// footer, so an empty sheet does not sit over the map for the length of a 38 MB download.
|
|
60
|
+
const showSheet = Boolean(busy || result || errorMessage);
|
|
61
|
+
const bundleLoading = Boolean(loading && !runtime.ready);
|
|
62
|
+
const steps = loading?.stepLabels.length ?? 0;
|
|
63
|
+
return (_jsxs(_Fragment, { children: [_jsx(MapProgressBar, { active: bundleLoading, fraction: steps ? ((loading?.stepIndex ?? 0) + 1) / steps : null, label: "Loading the geocoder" }), _jsxs("div", { className: "mw-map-chrome mw-map-chrome--top", children: [_jsx("form", { className: "mw-map-chrome__search", onSubmit: (event) => {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
runQuery(geocode.text);
|
|
66
|
+
}, children: _jsx(MapSearchBar, { label: "Search addresses", leading: _jsx("span", { "aria-hidden": "true", children: "\u2315" }), busy: busy, children: _jsx("input", { id: "mw-pipeline-input", type: "search", "aria-label": "Address", value: geocode.text, onChange: (event) => geocode.setText(event.target.value), disabled: !runtime.ready, placeholder: placeholder, onKeyDown: autocomplete.onInputKeyDown, ...autocomplete.inputProps }) }) }), _jsx(PlaceAutocomplete, { suggestions: autocomplete.suggestions, activeIndex: autocomplete.activeIndex, onPick: autocomplete.pick, onHover: autocomplete.setActiveIndex, listboxID: autocomplete.listboxID, optionID: autocomplete.optionID }), _jsx(MapChipRow, { chips: chips, label: "Example addresses", activeValue: geocode.text, disabled: !runtime.ready || busy, onPick: (value) => {
|
|
67
|
+
geocode.setText(value);
|
|
68
|
+
geocode.reset();
|
|
69
|
+
runQuery(value);
|
|
70
|
+
} }), panels.bias] }), _jsxs(MapControlStack, { label: "Map controls", children: [_jsxs(MapControlGroup, { children: [_jsx(MapControlButton, { label: "About this geocoder", active: openSheet === "about", onPress: () => toggleSheet("about"), children: _jsx("span", { "aria-hidden": "true", children: "i" }) }), panels.layers ? (_jsx(MapControlButton, { label: "Map layers", active: openSheet === "layers", onPress: () => toggleSheet("layers"), children: _jsx("span", { "aria-hidden": "true", children: "\u2261" }) })) : null, _jsx(MapControlButton, { label: "Developer controls", active: openSheet === "developer", onPress: () => toggleSheet("developer"), children: _jsx("span", { "aria-hidden": "true", children: "\u2699" }) })] }), _jsx(MapControlGroup, { className: "mw-map-control-group--compass", children: _jsx(MapCompass, { bearing: bearing, onResetNorth: resetNorth }) })] }), openSheet === "about" ? (_jsx(MapSheet, { title: "About", onClose: closeSheet, children: panels.header })) : null, openSheet === "layers" ? (_jsx(MapSheet, { title: "Layers", onClose: closeSheet, children: panels.layers?.({ map }) })) : null, openSheet === "developer" ? (_jsxs(MapSheet, { title: "Developer", onClose: closeSheet, children: [panels.releaseInfo ? (_jsxs("div", { className: "mw-map-sheet__row", children: [_jsx("span", { className: "mw-map-sheet__label", children: "This release" }), panels.releaseInfo] })) : null, _jsx("div", { className: "mw-map-sheet__row", children: _jsx(VersionPicker, { versions: versions, selected: runtime.selectedVersion ?? null, onSelect: onSelectVersion, disabled: busy }) }), _jsx("div", { className: "mw-map-sheet__row", children: _jsx(BackendControl, { activeBackend: runtime.activeBackend, forceWASM: runtime.forceWASM ?? false, onForceWASMChange: onForceWASMChange }) }), _jsx("div", { className: "mw-map-sheet__row", children: _jsx(CompareToggle, { versions: versions, primaryVersion: runtime.selectedVersion ?? null, compareMode: compare.compareMode, onCompareModeChange: compare.setCompareMode, compareVersion: compare.compareVersion, onCompareVersionChange: compare.setCompareVersion, disabled: busy }) }), panels.developerExtras] })) : null, showSheet ? (_jsxs("section", { className: "mw-map-sheet mw-map-sheet--bottom", "aria-label": "Result", children: [_jsx("div", { className: "mw-map-sheet__handle", "aria-hidden": "true" }), errorMessage ? _jsx("p", { className: "mw-error", children: errorMessage }) : null, panels.aboveResult ? panels.aboveResult({ result }) : null, busy ? (_jsx("div", { className: "mw-result", children: _jsx(LoadingIndicator, { mode: "staged", steps: runtime.parseStageLabels, activeStep: geocode.parseStage }) })) : result ? (panels.result ? (panels.result({
|
|
71
|
+
result,
|
|
72
|
+
selectedCandidate,
|
|
73
|
+
selectedCandidateIndex: geocode.selectedCandidateIndex,
|
|
74
|
+
onSelectCandidate: geocode.selectCandidate,
|
|
75
|
+
})) : (_jsx(ResultPanel, { result: result, selectedCandidate: selectedCandidate, selectedCandidateIndex: geocode.selectedCandidateIndex, onSelectCandidate: geocode.selectCandidate, extras: panels.extras, failure: panels.failure }))) : null, panels.compare
|
|
76
|
+
? panels.compare({ result, compareMode: compare.compareMode, compareVersion: compare.compareVersion })
|
|
77
|
+
: null, panels.permalink ? _jsx("div", { className: "mw-map-sheet__actions", children: panels.permalink(geocode.text) }) : null] })) : null, panels.footer] }));
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=GeocoderControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeocoderControls.js","sourceRoot":"","sources":["../../lib/map/GeocoderControls.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAkB,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAM7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAAgC,CAAA;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAuB,CAAA;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAsB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAgB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAyB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAA;AA+DnD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAChC,OAAO,EACP,OAAO,EACP,YAAY,EACZ,OAAO,EACP,MAAM,EACN,OAAO,EACP,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