@arcgis/map-components 5.2.0-next.70 → 5.2.0-next.71

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.
Files changed (67) hide show
  1. package/dist/cdn/2O6GHHUY.js +2 -0
  2. package/dist/cdn/3RKTUDSL.js +2 -0
  3. package/dist/cdn/AXEUVRDP.js +2 -0
  4. package/dist/cdn/CQV2TQUQ.js +2 -0
  5. package/dist/cdn/{3MGDX726.js → KTCKSRJG.js} +1 -1
  6. package/dist/cdn/MGL4QBFB.js +2 -0
  7. package/dist/cdn/NTODRT2V.js +2 -0
  8. package/dist/cdn/{U257QRYB.js → PPZFYY4R.js} +1 -1
  9. package/dist/cdn/{MCKFNVHF.js → QM3KT7SZ.js} +1 -1
  10. package/dist/cdn/T6ONYBEY.js +2 -0
  11. package/dist/cdn/WXNDZFDX.js +2 -0
  12. package/dist/cdn/{LI7PGPU4.js → YPDSLXD2.js} +1 -1
  13. package/dist/cdn/{M7P6P7TR.js → ZS7I5TA6.js} +1 -1
  14. package/dist/cdn/assets/basemap-layer-list-next/t9n/messages.en.json +1 -1
  15. package/dist/cdn/assets/catalog-layer-list-next/t9n/messages.en.json +1 -1
  16. package/dist/cdn/assets/layer-list-next/t9n/messages.en.json +1 -1
  17. package/dist/cdn/assets/utility-network-aggregated-geometry-next/t9n/messages.en.json +1 -0
  18. package/dist/cdn/assets/utility-network-subnetwork-info-next/t9n/messages.en.json +1 -0
  19. package/dist/cdn/assets/utility-network-trace-analysis-next/t9n/messages.en.json +1 -0
  20. package/dist/cdn/assets/utility-network-trace-inputs-next/t9n/messages.en.json +1 -0
  21. package/dist/cdn/assets/utility-network-trace-location-list-next/t9n/messages.en.json +1 -0
  22. package/dist/cdn/assets/utility-network-trace-location-next/t9n/messages.en.json +1 -0
  23. package/dist/cdn/assets/utility-network-trace-results-next/t9n/messages.en.json +1 -0
  24. package/dist/cdn/index.js +1 -1
  25. package/dist/cdn/main.css +1 -1
  26. package/dist/chunks/slots.js +1 -1
  27. package/dist/components/arcgis-utility-network-aggregated-geometry-next/customElement.d.ts +63 -0
  28. package/dist/components/arcgis-utility-network-aggregated-geometry-next/customElement.js +109 -0
  29. package/dist/components/arcgis-utility-network-aggregated-geometry-next/index.d.ts +1 -0
  30. package/dist/components/arcgis-utility-network-aggregated-geometry-next/index.js +2 -0
  31. package/dist/components/arcgis-utility-network-subnetwork-info-next/customElement.d.ts +29 -0
  32. package/dist/components/arcgis-utility-network-subnetwork-info-next/customElement.js +35 -0
  33. package/dist/components/arcgis-utility-network-subnetwork-info-next/index.d.ts +1 -0
  34. package/dist/components/arcgis-utility-network-subnetwork-info-next/index.js +1 -0
  35. package/dist/components/arcgis-utility-network-trace-analysis-next/customElement.d.ts +383 -0
  36. package/dist/components/arcgis-utility-network-trace-analysis-next/customElement.js +186 -0
  37. package/dist/components/arcgis-utility-network-trace-analysis-next/index.d.ts +1 -0
  38. package/dist/components/arcgis-utility-network-trace-analysis-next/index.js +11 -0
  39. package/dist/components/arcgis-utility-network-trace-analysis-next/types.d.ts +26 -0
  40. package/dist/components/arcgis-utility-network-trace-inputs-next/customElement.d.ts +197 -0
  41. package/dist/components/arcgis-utility-network-trace-inputs-next/customElement.js +401 -0
  42. package/dist/components/arcgis-utility-network-trace-inputs-next/index.d.ts +1 -0
  43. package/dist/components/arcgis-utility-network-trace-inputs-next/index.js +16 -0
  44. package/dist/components/arcgis-utility-network-trace-location-list-next/customElement.d.ts +43 -0
  45. package/dist/components/arcgis-utility-network-trace-location-list-next/customElement.js +70 -0
  46. package/dist/components/arcgis-utility-network-trace-location-list-next/index.d.ts +1 -0
  47. package/dist/components/arcgis-utility-network-trace-location-list-next/index.js +9 -0
  48. package/dist/components/arcgis-utility-network-trace-location-next/customElement.d.ts +159 -0
  49. package/dist/components/arcgis-utility-network-trace-location-next/customElement.js +292 -0
  50. package/dist/components/arcgis-utility-network-trace-location-next/index.d.ts +1 -0
  51. package/dist/components/arcgis-utility-network-trace-location-next/index.js +4 -0
  52. package/dist/components/arcgis-utility-network-trace-results-next/customElement.d.ts +191 -0
  53. package/dist/components/arcgis-utility-network-trace-results-next/customElement.js +210 -0
  54. package/dist/components/arcgis-utility-network-trace-results-next/index.d.ts +1 -0
  55. package/dist/components/arcgis-utility-network-trace-results-next/index.js +15 -0
  56. package/dist/docs/api.json +1 -1
  57. package/dist/docs/docs.json +1 -1
  58. package/dist/docs/vscode.html-custom-data.json +1 -1
  59. package/dist/docs/web-types.json +1 -1
  60. package/dist/index.d.ts +58 -0
  61. package/dist/loader.js +7 -0
  62. package/dist/types/lumina.d.ts +55 -0
  63. package/dist/types/preact.d.ts +62 -0
  64. package/dist/types/react.d.ts +69 -0
  65. package/dist/types/stencil.d.ts +55 -0
  66. package/package.json +4 -4
  67. package/dist/cdn/2MNCEI34.js +0 -2
@@ -0,0 +1,70 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { c as m } from "../../chunks/runtime.js";
3
+ import { css as p, html as a } from "lit";
4
+ import h from "@arcgis/core/core/Collection.js";
5
+ import { substitute as u } from "@arcgis/core/intl.js";
6
+ import { LitElement as g } from "@arcgis/lumina";
7
+ import { log as l, composeEmptyPropertyMessage as b } from "@arcgis/toolkit/log";
8
+ import { u as f } from "../../chunks/useT9n.js";
9
+ const v = p`:host{padding:0 var(--calcite-spacing-sm) var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}calcite-list{border:solid 1px var(--calcite-color-border-3);border-radius:var(--calcite-corner-radius-sm);overflow:hidden}calcite-list-item[selected] [slot=content-bottom]{display:block}.warning{color:var(--calcite-color-status-danger)}.terminals{padding:var(--calcite-spacing-sm) var(--calcite-spacing-md);display:flex;flex-direction:column}.filter-barrier{display:flex;justify-content:space-between;align-items:center;width:100%}`;
10
+ class $ extends g {
11
+ constructor() {
12
+ super(...arguments), this._messages = f({ blocking: !0 }), this.traceLocations = new h(), this.traceLocationType = "starting-point";
13
+ }
14
+ static {
15
+ this.properties = { traceLocations: 0, traceLocationType: 1, view: 0 };
16
+ }
17
+ static {
18
+ this.styles = v;
19
+ }
20
+ loaded() {
21
+ this.traceLocations.length || l("warn", this, b("traceLocations"));
22
+ }
23
+ #e(e) {
24
+ const { traceLocations: i, view: t } = this;
25
+ e.spatialProperties.flagGraphic && t && t.graphics.remove(e.spatialProperties.flagGraphic), i?.remove(e);
26
+ }
27
+ #t(e, i) {
28
+ const { flagProperties: t } = e, { selectedTerminals: r } = t, { name: s, id: c } = i, n = r?.has(c) ?? !1;
29
+ return a`<calcite-label layout=inline><calcite-checkbox .value=${c} .checked=${n} @calciteCheckboxChange=${(o) => {
30
+ o.target.checked ? r?.add(c) : r?.delete(c), this.requestUpdate();
31
+ }}></calcite-checkbox>${s}</calcite-label>`;
32
+ }
33
+ #i() {
34
+ return a`<calcite-notice kind=danger open scale=s width=auto><div slot=message>${this._messages.errors.noTerminalSelected}</div></calcite-notice>`;
35
+ }
36
+ #r(e) {
37
+ const { traceLocation: i } = e;
38
+ return a`<calcite-label layout=inline><div class="filter-barrier">${this._messages.labels.filterBarrier}<calcite-switch .checked=${i.isFilterBarrier} @calciteSwitchChange=${(t) => {
39
+ i.isFilterBarrier = t.target.checked;
40
+ }}></calcite-switch></div></calcite-label>`;
41
+ }
42
+ #c(e) {
43
+ const { flagProperties: i } = e, { terminalConfiguration: t, selectedTerminals: r } = i, s = e.traceLocation.type === "barrier", c = t && t.terminals.length > 0 && r?.size === 0;
44
+ return a`<calcite-action .icon=${i.expanded ? "chevron-up" : "chevron-down"} slot=actions-end scale=s text @click=${() => {
45
+ i.expanded = !i.expanded, this.requestUpdate();
46
+ }}></calcite-action>${c && a`<calcite-icon class="warning" icon=exclamation-mark-triangle scale=s slot=content-start></calcite-icon>` || ""}${i.expanded && a`<div class="terminals" slot=content-bottom>${s && this.#r(e) || ""}${t && this.#a(e) || ""}${c && this.#i() || ""}</div>` || ""}`;
47
+ }
48
+ #a(e) {
49
+ const { flagProperties: i } = e, { terminalConfiguration: t } = i;
50
+ if (!t)
51
+ return l("warn", this, "One or more locations are missing the required flag property `terminalConfiguration`."), [];
52
+ const r = t.terminals;
53
+ return r.length ? r.length === 1 ? [] : r.map((c) => this.#t(e, c)) : (l("warn", this, "`terminalConfiguration.terminals` is required but either missing or empty.`"), []);
54
+ }
55
+ #s(e) {
56
+ const { flagProperties: i } = e, { terminalConfiguration: t, expanded: r, title: s } = i, c = t && t.id !== 0, n = e.traceLocation.type === "barrier", o = c || n, d = t?.name ?? void 0;
57
+ return a`<calcite-list-item .label=${s} .description=${d} .value=${s} .expanded=${r}>${o ? this.#c(e) : a`<div slot=content-bottom></div>`}<calcite-action icon=x slot=actions-end scale=s text @click=${() => this.#e(e)}></calcite-action></calcite-list-item>`;
58
+ }
59
+ render() {
60
+ const e = this.traceLocations.map((t) => this.#s(t)).toArray();
61
+ if (!e.length)
62
+ return null;
63
+ const i = u(this._messages.labels.list, { traceLocationType: this.traceLocationType });
64
+ return a`<div><calcite-list interaction-mode=static selection-mode=none .label=${i}>${e}</calcite-list></div>`;
65
+ }
66
+ }
67
+ m("arcgis-utility-network-trace-location-list-next", $);
68
+ export {
69
+ $ as ArcgisUtilityNetworkTraceLocationListNext
70
+ };
@@ -0,0 +1 @@
1
+ export * from "./customElement.js";
@@ -0,0 +1,9 @@
1
+ import "@esri/calcite-components/components/calcite-label";
2
+ import "@esri/calcite-components/components/calcite-checkbox";
3
+ import "@esri/calcite-components/components/calcite-notice";
4
+ import "@esri/calcite-components/components/calcite-switch";
5
+ import "@esri/calcite-components/components/calcite-action";
6
+ import "@esri/calcite-components/components/calcite-icon";
7
+ import "@esri/calcite-components/components/calcite-list-item";
8
+ import "@esri/calcite-components/components/calcite-list";
9
+ export * from "./customElement.js";
@@ -0,0 +1,159 @@
1
+ /// <reference path="../../index.d.ts" />
2
+ import type Collection from "@arcgis/core/core/Collection.js";
3
+ import type Point from "@arcgis/core/geometry/Point.js";
4
+ import type Graphic from "@arcgis/core/Graphic.js";
5
+ import type Layer from "@arcgis/core/layers/Layer.js";
6
+ import type TerminalConfiguration from "@arcgis/core/networks/support/TerminalConfiguration.js";
7
+ import type UtilityNetwork from "@arcgis/core/networks/UtilityNetwork.js";
8
+ import type TraceLocation from "@arcgis/core/rest/networks/support/TraceLocation.js";
9
+ import type MapView from "@arcgis/core/views/MapView.js";
10
+ import type SketchViewModel from "@arcgis/core/widgets/Sketch/SketchViewModel.js";
11
+ import type { PublicLitElement as LitElement } from "@arcgis/lumina";
12
+ import type { T9nMeta } from "@arcgis/lumina/controllers";
13
+
14
+ /**
15
+ * This is a sub-component used by the **ArcgisUtilityNetworkTraceAnalysis** component.
16
+ * It allows users to select locations on the map to use as trace inputs.
17
+ *
18
+ * @since 4.34
19
+ * @internal
20
+ */
21
+ export abstract class ArcgisUtilityNetworkTraceLocationNext extends LitElement {
22
+ /** @internal */
23
+ protected _messages: {
24
+ buttons: { clear: string; };
25
+ componentLabel: string;
26
+ errors: {};
27
+ labels: { close: string; };
28
+ unknown: string;
29
+ types: {
30
+ barrier: {
31
+ buttonText: string;
32
+ description: string;
33
+ heading: string;
34
+ message: string;
35
+ };
36
+ startingPoint: {
37
+ buttonText: string;
38
+ description: string;
39
+ heading: string;
40
+ message: string;
41
+ };
42
+ stoppingPoint: {
43
+ buttonText: string;
44
+ description: string;
45
+ heading: string;
46
+ message: string;
47
+ };
48
+ };
49
+ } & T9nMeta<{
50
+ buttons: { clear: string; };
51
+ componentLabel: string;
52
+ errors: {};
53
+ labels: { close: string; };
54
+ unknown: string;
55
+ types: {
56
+ barrier: {
57
+ buttonText: string;
58
+ description: string;
59
+ heading: string;
60
+ message: string;
61
+ };
62
+ startingPoint: {
63
+ buttonText: string;
64
+ description: string;
65
+ heading: string;
66
+ message: string;
67
+ };
68
+ stoppingPoint: {
69
+ buttonText: string;
70
+ description: string;
71
+ heading: string;
72
+ message: string;
73
+ };
74
+ };
75
+ }>;
76
+ /**
77
+ * A function to run after a hit test is performed to select a trace location. If left empty, the first graphic from the hit test results will be used as the trace location.
78
+ * This function allows for modification of the selected graphic before it is added as a trace location, such as changing its attributes or geometry.
79
+ * If the promise is rejected, the selection process will be cancelled.
80
+ *
81
+ * @internal
82
+ */
83
+ accessor afterHitTest: ((graphics: Graphic[]) => Promise<Graphic>) | undefined;
84
+ /**
85
+ * If true, the component will not be destroyed automatically when it is
86
+ * disconnected from the document. This is useful when you want to move the
87
+ * component to a different place on the page, or temporarily hide it. If this
88
+ * is set, make sure to call the [destroy()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-utility-network-trace-location-next/#destroy) method when you are done to
89
+ * prevent memory leaks.
90
+ *
91
+ * @default false
92
+ */
93
+ accessor autoDestroyDisabled: boolean;
94
+ /**
95
+ * A function to run before trace location selection starts.
96
+ *
97
+ * @internal
98
+ */
99
+ accessor beforeTraceLocationSelectStart: (() => Promise<void>) | undefined;
100
+ accessor filterLayers: Collection<Layer> | undefined;
101
+ accessor sketchViewModel: SketchViewModel | undefined;
102
+ /** @default 0.05 */
103
+ accessor spatialTolerance: number;
104
+ accessor traceLocations: Collection<FlagInfo> | undefined;
105
+ /** @default "starting-point" */
106
+ accessor traceLocationType: TraceLocationType;
107
+ /** @required */
108
+ accessor utilityNetwork: UtilityNetwork | undefined;
109
+ /**
110
+ * The view associated with the component.
111
+ * > **Note:** The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this `view` property which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the arcgis-utility-network-trace-location-next component will be associated with a map or scene component rather than using the `view` property.
112
+ */
113
+ accessor view: MapView | undefined;
114
+ /** Permanently destroy the component. */
115
+ destroy(): Promise<void>;
116
+ readonly arcgisTraceLocationChange: import("@arcgis/lumina").TargetedEvent<this, void>;
117
+ /**
118
+ * Fires when the user completes the selection of a trace location.
119
+ *
120
+ * @internal
121
+ */
122
+ readonly arcgisTraceLocationSelectEnd: import("@arcgis/lumina").TargetedEvent<this, void>;
123
+ /**
124
+ * Fires when the user begins selection of a trace location.
125
+ * Can be prevented to stop the selection.
126
+ *
127
+ * @internal
128
+ */
129
+ readonly arcgisTraceLocationSelectStart: import("@arcgis/lumina").TargetedEvent<this, SelectStartPayload>;
130
+ readonly "@eventTypes": {
131
+ arcgisTraceLocationChange: ArcgisUtilityNetworkTraceLocationNext["arcgisTraceLocationChange"]["detail"];
132
+ arcgisTraceLocationSelectEnd: ArcgisUtilityNetworkTraceLocationNext["arcgisTraceLocationSelectEnd"]["detail"];
133
+ arcgisTraceLocationSelectStart: ArcgisUtilityNetworkTraceLocationNext["arcgisTraceLocationSelectStart"]["detail"];
134
+ };
135
+ }
136
+
137
+ /** @internal */
138
+ export interface FlagInfo {
139
+ traceLocation: TraceLocation;
140
+ flagProperties: {
141
+ title: string;
142
+ expanded?: boolean;
143
+ terminalConfiguration?: TerminalConfiguration;
144
+ selectedTerminals?: Set<number>;
145
+ };
146
+ spatialProperties: {
147
+ mapPoint?: Point;
148
+ mapGraphic?: Graphic;
149
+ flagGraphic?: Graphic;
150
+ };
151
+ }
152
+
153
+ /** @internal */
154
+ export type TraceLocationType = "barrier" | "starting-point" | "stopping-point";
155
+
156
+ /** @internal */
157
+ export interface SelectStartPayload {
158
+ cancelSelect: () => void;
159
+ }
@@ -0,0 +1,292 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { c as k } from "../../chunks/runtime.js";
3
+ import { css as I, html as b } from "lit";
4
+ import * as C from "@arcgis/core/geometry/operators/cutOperator.js";
5
+ import * as T from "@arcgis/core/geometry/operators/lengthOperator.js";
6
+ import * as L from "@arcgis/core/geometry/operators/projectOperator.js";
7
+ import * as v from "@arcgis/core/geometry/operators/proximityOperator.js";
8
+ import A from "@arcgis/core/geometry/Polyline.js";
9
+ import N from "@arcgis/core/Graphic.js";
10
+ import w from "@arcgis/core/rest/networks/support/TraceLocation.js";
11
+ import S from "@arcgis/core/symbols/SimpleMarkerSymbol.js";
12
+ import { LitElement as E, createEvent as x } from "@arcgis/lumina";
13
+ import { log as l, composeMissingPropertyMessage as m } from "@arcgis/toolkit/log";
14
+ import { u as F } from "../../chunks/useT9n.js";
15
+ import { d as G, b as P } from "../../chunks/layer-utils.js";
16
+ const R = I`calcite-block{--calcite-block-content-space: 0;--calcite-block-border-color: transparent;margin:0}.add-location-button{--calcite-button-border-color: var(--calcite-color-border-1);--calcite-button-icon-color: var(--calcite-color-text-1);--calcite-button-text-color: var(--calcite-color-text-1)}.button-container{display:flex;justify-content:center}`;
17
+ class $ extends E {
18
+ constructor() {
19
+ super(...arguments), this._messages = F({ blocking: !0 }), this._isSelectWaiting = !1, this.traceLocationType = "starting-point", this.spatialTolerance = 0.05, this.autoDestroyDisabled = !1, this.arcgisTraceLocationChange = x(), this.arcgisTraceLocationSelectEnd = x(), this.arcgisTraceLocationSelectStart = x();
20
+ }
21
+ static {
22
+ this.properties = { _isSelectWaiting: 16, beforeTraceLocationSelectStart: 0, afterHitTest: 0, view: 0, traceLocationType: 1, traceLocations: 0, filterLayers: 0, sketchViewModel: 0, spatialTolerance: 9, autoDestroyDisabled: 5, utilityNetwork: 0 };
23
+ }
24
+ static {
25
+ this.styles = R;
26
+ }
27
+ #e;
28
+ async destroy() {
29
+ this.#r(), await this.manager.destroy();
30
+ }
31
+ async load() {
32
+ L.isLoaded() || await L.load();
33
+ }
34
+ #a(t, e) {
35
+ const r = t.clone(), o = r.spatialReference, i = e.spatialReference;
36
+ if (!o || !i)
37
+ return l("warn", this, "Unable to calculate percent along because geometry is missing a spatial reference."), -1;
38
+ let s = e;
39
+ if (!o.equals(i)) {
40
+ const d = L.execute(e, o);
41
+ if (!d)
42
+ return l("warn", this, "Unable to project flag point to source geometry spatial reference."), -1;
43
+ s = d;
44
+ }
45
+ const n = v.getNearestCoordinate(r, s);
46
+ if (n.isEmpty)
47
+ return l("warn", this, "Unable to compute nearest coordinate for polyline flag."), -1;
48
+ const a = n.coordinate, c = a.x - 0.5, u = a.y - 0.5, p = a.x + 0.5, h = a.y + 0.5, g = new A({
49
+ hasZ: !1,
50
+ hasM: !0,
51
+ paths: [
52
+ [
53
+ [c, u],
54
+ [p, h]
55
+ ]
56
+ ],
57
+ spatialReference: r.spatialReference
58
+ }), f = C.execute(r, g);
59
+ if (f.length > 0) {
60
+ const d = T.execute(r, { unit: "feet" });
61
+ let y;
62
+ return f[0].paths[0][0][0] === r.paths[0][0][0] ? y = T.execute(f[0], { unit: "feet" }) : f.length > 1 ? y = T.execute(f[1], { unit: "feet" }) : y = 0, y / d;
63
+ }
64
+ return l("warn", this, "Unable to cut the source geometry with the flag geometry."), -1;
65
+ }
66
+ get #i() {
67
+ const t = this.utilityNetwork?.dataElement?.domainNetworks;
68
+ return t ? t.flatMap((e) => e.edgeSources).map((e) => e.layerId).filter(Boolean) : [];
69
+ }
70
+ async #s() {
71
+ const { view: t, sketchViewModel: e } = this;
72
+ if (!(t && e)) {
73
+ l("error", this, "Cannot add trace location."), e || l("error", this, m("sketchViewModel")), t || l("error", this, m("view"));
74
+ return;
75
+ }
76
+ if (this.beforeTraceLocationSelectStart) {
77
+ this._isSelectWaiting = !0;
78
+ try {
79
+ await this.beforeTraceLocationSelectStart();
80
+ } finally {
81
+ this._isSelectWaiting = !1;
82
+ }
83
+ }
84
+ await this.#t(t, e);
85
+ }
86
+ async #t(t, e) {
87
+ this.arcgisTraceLocationSelectStart.emit({ cancelSelect: () => e.cancel() }).defaultPrevented || (this.#e?.remove(), this.#e = e.on("create", (o) => this.#o(o, t, e)), "acquireCursor" in t && t.acquireCursor("crosshair"), e.snappingOptions.enabled = !0, e.create("point"));
88
+ }
89
+ #o(t, e, r) {
90
+ if (t.state === "complete" && t.graphic) {
91
+ r.layer.remove(t.graphic), this.#n(t, e, r);
92
+ return;
93
+ }
94
+ t.state === "cancel" && (this.#r(), this.arcgisTraceLocationSelectEnd.emit());
95
+ }
96
+ async #n(t, e, r) {
97
+ const { utilityNetwork: o } = this, { graphic: i } = t;
98
+ if (!o) {
99
+ l("error", this, m("utilityNetwork")), this.#r(), this.arcgisTraceLocationSelectEnd.emit();
100
+ return;
101
+ }
102
+ if (i?.geometry?.type !== "point") {
103
+ l("warn", this, "No screen point available for hit test."), this.#t(e, r);
104
+ return;
105
+ }
106
+ const s = i.geometry, n = e.toScreen(s);
107
+ if (!n) {
108
+ l("warn", this, "No screen point available for hit test."), this.#t(e, r);
109
+ return;
110
+ }
111
+ const c = (await e.hitTest(n, {
112
+ include: this.filterLayers
113
+ })).results.filter((p) => p.type === "graphic" && p?.layer && p.graphic);
114
+ if (!c.length) {
115
+ l("info", this, "No usable hit test results found."), this.#t(e, r);
116
+ return;
117
+ }
118
+ this.#r(), await this.#c(c, s, e) ? this.arcgisTraceLocationSelectEnd.emit() : this.#t(e, r);
119
+ }
120
+ #r() {
121
+ const { view: t, sketchViewModel: e } = this;
122
+ if (!t) {
123
+ l("error", this, m("view"));
124
+ return;
125
+ }
126
+ e && (e.snappingOptions.enabled = !1), this.#e?.remove(), this.#e = void 0, "acquireCursor" in t && t.acquireCursor("default");
127
+ }
128
+ async #c(t, e, r) {
129
+ if (!t.length)
130
+ return l("error", this, "There are no hit test results to process."), !1;
131
+ let i = t[0].graphic;
132
+ if (this.afterHitTest) {
133
+ const n = t.map((a) => {
134
+ const c = a, u = c.graphic;
135
+ return u.origin = c.layer, u.sourceLayer = c.layer, u;
136
+ });
137
+ try {
138
+ i = await this.afterHitTest(n);
139
+ } catch {
140
+ i = null;
141
+ }
142
+ }
143
+ if (!i)
144
+ return l("error", this, "No graphic available from hit test results."), this.arcgisTraceLocationSelectEnd.emit(), !0;
145
+ const s = await this.#l(i);
146
+ return s ? await this.#u(s, e, r) : (l("error", this, "Unable to ensure necessary attributes on the selected graphic."), this.arcgisTraceLocationSelectEnd.emit(), !0);
147
+ }
148
+ async #l(t) {
149
+ const e = (G(t.layer), t.layer), r = e.geometryType === null, o = e.fieldsIndex?.get("assetgroup") ?? !1, i = e.fieldsIndex?.get("assetgroup")?.name ?? "assetgroup", s = e.fieldsIndex?.get("assettype") ?? !1, n = e.fieldsIndex?.get("assettype")?.name ?? "assettype", a = t.getGlobalId(), c = t.getObjectId(), u = o ? !!t.getAttribute(i) : !0, p = s ? !!t.getAttribute(n) : !0, h = !!t.geometry;
150
+ if (a && c && u && p && (h || r))
151
+ return t;
152
+ const g = e.createQuery();
153
+ return g.objectIds = [c], (await e.queryFeatures(g)).features[0] || null;
154
+ }
155
+ async #u(t, e, r) {
156
+ const { traceLocations: o } = this, i = t.getGlobalId() ?? "", s = t.geometry?.type, n = await this.#p(t, e);
157
+ if (!n)
158
+ return l("error", this, "Unable to generate flag info for trace location."), !1;
159
+ const a = o?.filter((u) => u.spatialProperties.mapGraphic?.getGlobalId() === i) ?? [];
160
+ if (a.length > 0) {
161
+ if (s !== "polyline")
162
+ return l("warn", this, "A flag with the same globalId already exists."), !1;
163
+ if (a.some((u) => Math.abs(u.traceLocation.percentAlong - n.traceLocation.percentAlong) <= this.spatialTolerance))
164
+ return l("warn", this, "A flag with the same globalId already exists within tolerance."), !1;
165
+ }
166
+ const c = this.#h(t, e, r);
167
+ return c ? (n.spatialProperties.flagGraphic = c, o?.add(n), !0) : (l("warn", this, "Unable to add flag graphic."), !1);
168
+ }
169
+ async #p(t, e) {
170
+ const { traceLocationType: r, utilityNetwork: o } = this, i = t.getGlobalId() ?? "", s = t.geometry?.type, n = await this.#f(t);
171
+ if (s === "point" || s === "polygon") {
172
+ const a = o?.getTerminalConfiguration(t), c = a ? a.terminals[0].id : 1;
173
+ return {
174
+ traceLocation: new w({
175
+ type: r,
176
+ isFilterBarrier: !1,
177
+ globalId: i,
178
+ terminalId: c
179
+ }),
180
+ flagProperties: {
181
+ title: n,
182
+ expanded: !1,
183
+ terminalConfiguration: a ?? void 0,
184
+ selectedTerminals: a ? /* @__PURE__ */ new Set([c]) : void 0
185
+ },
186
+ spatialProperties: {
187
+ mapPoint: e,
188
+ mapGraphic: t
189
+ }
190
+ };
191
+ } else if (s === "polyline") {
192
+ const a = this.#a(t.geometry, e);
193
+ return a < 0 ? (l("warn", this, "Unable to calculate percent along for polyline flag."), null) : {
194
+ traceLocation: new w({
195
+ type: r,
196
+ isFilterBarrier: !1,
197
+ globalId: i,
198
+ percentAlong: a
199
+ }),
200
+ flagProperties: {
201
+ title: n,
202
+ expanded: !1,
203
+ terminalConfiguration: void 0,
204
+ selectedTerminals: void 0
205
+ },
206
+ spatialProperties: {
207
+ mapPoint: e,
208
+ mapGraphic: t
209
+ }
210
+ };
211
+ } else if (!s) {
212
+ const a = P(t.layer) ? t.layer.parent : t.layer, c = a && this.#i.includes(a.layerId), u = o?.getTerminalConfiguration(t), p = u ? u.terminals[0].id : c ? -1 : 1, h = c ? 0.5 : -1;
213
+ return {
214
+ traceLocation: new w({
215
+ type: r,
216
+ isFilterBarrier: !1,
217
+ globalId: i,
218
+ terminalId: p,
219
+ percentAlong: h
220
+ }),
221
+ flagProperties: {
222
+ title: n,
223
+ expanded: !1,
224
+ terminalConfiguration: u ?? void 0,
225
+ selectedTerminals: u ? /* @__PURE__ */ new Set([p]) : void 0
226
+ },
227
+ spatialProperties: {
228
+ mapPoint: e,
229
+ mapGraphic: t
230
+ }
231
+ };
232
+ }
233
+ return null;
234
+ }
235
+ async #f(t) {
236
+ const e = (G(t.layer), t.layer);
237
+ return ("getFeatureTitle" in e ? await e.getFeatureTitle(t) : null) || t.getObjectId()?.toString() || this._messages.unknown;
238
+ }
239
+ #h(t, e, r) {
240
+ const o = t.geometry ? t.geometry.type === "point" ? t.geometry : e : null, i = this.#d(), s = new N({
241
+ geometry: o,
242
+ symbol: i,
243
+ attributes: t.attributes
244
+ });
245
+ return r.graphics.add(s), s;
246
+ }
247
+ #d() {
248
+ const { traceLocationType: t } = this, e = [244, 21, 21, 0.6], r = [21, 244, 21, 0.6];
249
+ return t === "stopping-point" ? new S({
250
+ color: e,
251
+ style: "x",
252
+ size: 12,
253
+ outline: {
254
+ color: e,
255
+ width: 2
256
+ }
257
+ }) : t === "barrier" ? new S({
258
+ color: e,
259
+ style: "square",
260
+ size: 12,
261
+ outline: {
262
+ color: e,
263
+ width: 0
264
+ }
265
+ }) : new S({
266
+ color: r,
267
+ style: "circle",
268
+ size: 12,
269
+ outline: {
270
+ color: r,
271
+ width: 0
272
+ }
273
+ });
274
+ }
275
+ #g() {
276
+ const { view: t, traceLocations: e } = this;
277
+ e?.forEach((r) => {
278
+ r.spatialProperties.flagGraphic && t && t.graphics.remove(r.spatialProperties.flagGraphic);
279
+ }), e?.removeAll();
280
+ }
281
+ #y() {
282
+ const { traceLocationType: t, _messages: e, traceLocations: r, view: o } = this, i = t === "starting-point" ? e.types.startingPoint : t === "barrier" ? e.types.barrier : e.types.stoppingPoint, s = i.heading, n = i.description, a = i.buttonText;
283
+ return b`<calcite-block .heading=${s} .label=${s} expanded .description=${n}>${r?.length ? b`<calcite-button slot=actions-end appearance=transparent .label=${e.buttons.clear} @click=${() => this.#g()}>${e.buttons.clear}</calcite-button><arcgis-utility-network-trace-location-list-next .traceLocations=${r} .traceLocationType=${t} .view=${o}></arcgis-utility-network-trace-location-list-next>` : null}<div class="button-container"><calcite-button .loading=${this._isSelectWaiting} class="add-location-button" icon-start=select appearance=outline .label=${a} @click=${() => this.#s()}>${a}</calcite-button></div></calcite-block>`;
284
+ }
285
+ render() {
286
+ return b`<div class="root">${this.#y()}</div>`;
287
+ }
288
+ }
289
+ k("arcgis-utility-network-trace-location-next", $);
290
+ export {
291
+ $ as ArcgisUtilityNetworkTraceLocationNext
292
+ };
@@ -0,0 +1 @@
1
+ export * from "./customElement.js";
@@ -0,0 +1,4 @@
1
+ import "@esri/calcite-components/components/calcite-block";
2
+ import "@esri/calcite-components/components/calcite-button";
3
+ import "../arcgis-utility-network-trace-location-list-next/index.js";
4
+ export * from "./customElement.js";