@esri/solutions-components 0.6.44 → 0.6.45

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,387 +0,0 @@
1
- {
2
- "operationalLayers": [
3
- {
4
- "id": "18a09252edc-layer-3",
5
- "title": "PN related records - Site Addresses",
6
- "url": "https://services6.arcgis.com/Pu6Fai10JE2L2xUd/arcgis/rest/services/PN_related_records/FeatureServer/0",
7
- "itemId": "e8549e36bdbd4b8d82e69172339d0224",
8
- "layerType": "ArcGISFeatureLayer",
9
- "popupInfo": {
10
- "popupElements": [
11
- {
12
- "type": "relationship",
13
- "description": "",
14
- "displayCount": 1,
15
- "displayType": "list",
16
- "orderByFields": [
17
- {
18
- "field": "OBJECTID",
19
- "order": "asc"
20
- }
21
- ],
22
- "relationshipId": 0,
23
- "title": ""
24
- }
25
- ],
26
- "relatedRecordsInfo": {
27
- "showRelatedRecords": true,
28
- "orderByFields": [
29
- {
30
- "field": "relationships/0/OBJECTID",
31
- "order": "asc"
32
- }
33
- ]
34
- },
35
- "expressionInfos": [
36
- {
37
- "name": "expr0",
38
- "title": "Get first record from the parent layer",
39
- "expression": "// Write a script to return a value to show in the pop-up. \n// For example, get the average of 4 fields:\n// Average($feature.SalesQ1, $feature.SalesQ2, $feature.SalesQ3, $feature.SalesQ4)\nvar relatedFeatures = FeatureSetByRelationshipName($feature, \"\", [\"*\"], false)\n//return relatedFeatures\nreturn First(relatedFeatures)['SITEADDkey']\n",
40
- "returnType": "string"
41
- }
42
- ],
43
- "fieldInfos": [
44
- {
45
- "fieldName": "OBJECTID",
46
- "format": {
47
- "digitSeparator": false,
48
- "places": 0
49
- },
50
- "isEditable": false,
51
- "label": "OBJECTID",
52
- "visible": true
53
- },
54
- {
55
- "fieldName": "SITEADDID",
56
- "isEditable": true,
57
- "label": "Site Address ID",
58
- "visible": true
59
- },
60
- {
61
- "fieldName": "ADDPTKEY",
62
- "isEditable": true,
63
- "label": "Address Point ID",
64
- "visible": true
65
- },
66
- {
67
- "fieldName": "PREADDRNUM",
68
- "isEditable": true,
69
- "label": "Address Number Prefix",
70
- "visible": true
71
- },
72
- {
73
- "fieldName": "ADDRNUMSUF",
74
- "isEditable": true,
75
- "label": "Address Number Suffix",
76
- "visible": true
77
- },
78
- {
79
- "fieldName": "ADDRNUM",
80
- "isEditable": true,
81
- "label": "Full Address Number",
82
- "visible": true
83
- },
84
- {
85
- "fieldName": "ADDRRANGE",
86
- "isEditable": true,
87
- "label": "Address Range",
88
- "visible": true
89
- },
90
- {
91
- "fieldName": "UNITTYPE",
92
- "isEditable": true,
93
- "label": "Address Unit Type",
94
- "visible": true
95
- },
96
- {
97
- "fieldName": "UNITID",
98
- "isEditable": true,
99
- "label": "Address Unit Number",
100
- "visible": true
101
- },
102
- {
103
- "fieldName": "ALTUNITTYPE",
104
- "isEditable": true,
105
- "label": "Alternate Address Unit Type",
106
- "visible": true
107
- },
108
- {
109
- "fieldName": "ALTUNITID",
110
- "isEditable": true,
111
- "label": "Alternate Address Unit Number",
112
- "visible": true
113
- },
114
- {
115
- "fieldName": "FULLNAME",
116
- "isEditable": true,
117
- "label": "Full Road Name",
118
- "visible": true
119
- },
120
- {
121
- "fieldName": "FULLADDR",
122
- "isEditable": true,
123
- "label": "Full Address",
124
- "visible": true
125
- },
126
- {
127
- "fieldName": "PLACENAME",
128
- "isEditable": true,
129
- "label": "Place Name",
130
- "visible": true
131
- },
132
- {
133
- "fieldName": "MUNICIPALITY",
134
- "isEditable": true,
135
- "label": "Municipality Name",
136
- "visible": true
137
- },
138
- {
139
- "fieldName": "ESN",
140
- "isEditable": true,
141
- "label": "Emergency Service Number",
142
- "visible": true
143
- },
144
- {
145
- "fieldName": "PSAP",
146
- "isEditable": true,
147
- "label": "Public Safety Answering Point",
148
- "visible": true
149
- },
150
- {
151
- "fieldName": "MSAG",
152
- "isEditable": true,
153
- "label": "MSAG Community",
154
- "visible": true
155
- },
156
- {
157
- "fieldName": "USNGCOORD",
158
- "isEditable": true,
159
- "label": "USNG Coordinate",
160
- "visible": true
161
- },
162
- {
163
- "fieldName": "ADDRCLASS",
164
- "format": {
165
- "digitSeparator": false,
166
- "places": 0
167
- },
168
- "isEditable": true,
169
- "label": "Description",
170
- "visible": true
171
- },
172
- {
173
- "fieldName": "POINTTYPE",
174
- "isEditable": true,
175
- "label": "Location",
176
- "visible": true
177
- },
178
- {
179
- "fieldName": "CAPTUREMETH",
180
- "isEditable": true,
181
- "label": "Capture Method",
182
- "visible": true
183
- },
184
- {
185
- "fieldName": "STATUS",
186
- "isEditable": true,
187
- "label": "Status",
188
- "visible": true
189
- },
190
- {
191
- "fieldName": "expression/expr0",
192
- "isEditable": true,
193
- "visible": false
194
- }
195
- ],
196
- "title": ""
197
- }
198
- }
199
- ],
200
- "tables": [
201
- {
202
- "id": "18a09252edd-layer-4",
203
- "title": "PN related records - Postal Addresses",
204
- "url": "https://services6.arcgis.com/Pu6Fai10JE2L2xUd/arcgis/rest/services/PN_related_records/FeatureServer/3",
205
- "itemId": "e8549e36bdbd4b8d82e69172339d0224",
206
- "popupInfo": {
207
- "popupElements": [
208
- {
209
- "type": "text",
210
- "text": "<p>{expression/expr0}&nbsp;&nbsp;&nbsp;<br />{OWNERNM1}&nbsp;&nbsp;&nbsp;<br />{PSTLADDRESS}&nbsp;&nbsp;&nbsp;<br />{PSTLCITY} , {PSTLSTATE}, {PSTLZIP5}&nbsp;<\/p>"
211
- }
212
- ],
213
- "description": "<p>{expression/expr0}&nbsp;&nbsp;&nbsp;<br />{OWNERNM1}&nbsp;&nbsp;&nbsp;<br />{PSTLADDRESS}&nbsp;&nbsp;&nbsp;<br />{PSTLCITY} , {PSTLSTATE}, {PSTLZIP5}&nbsp;<\/p>",
214
- "expressionInfos": [
215
- {
216
- "name": "expr0",
217
- "title": "New expression",
218
- "expression": "// Write a script to return a value to show in the pop-up. \n// For example, get the average of 4 fields:\n// Average($feature.SalesQ1, $feature.SalesQ2, $feature.SalesQ3, $feature.SalesQ4)\nvar relatedFeatures = FeatureSetByRelationshipName($feature, \"\", [\"*\"], false)\nreturn First(relatedFeatures)['SITEADDID']\n",
219
- "returnType": "string"
220
- }
221
- ],
222
- "fieldInfos": [
223
- {
224
- "fieldName": "OBJECTID",
225
- "format": {
226
- "digitSeparator": false,
227
- "places": 0
228
- },
229
- "isEditable": false,
230
- "label": "OBJECTID",
231
- "visible": true
232
- },
233
- {
234
- "fieldName": "PSTLADDID",
235
- "isEditable": true,
236
- "label": "Postal Address Identifier",
237
- "visible": true
238
- },
239
- {
240
- "fieldName": "SITEADDKEY",
241
- "isEditable": true,
242
- "label": "Site Address ID",
243
- "visible": true
244
- },
245
- {
246
- "fieldName": "OWNERNM1",
247
- "isEditable": true,
248
- "label": "Owner Name",
249
- "visible": true
250
- },
251
- {
252
- "fieldName": "OWNERNM2",
253
- "isEditable": true,
254
- "label": "Owner Name",
255
- "visible": true
256
- },
257
- {
258
- "fieldName": "PSTLADDRESS",
259
- "isEditable": true,
260
- "label": "Postal Address",
261
- "visible": true
262
- },
263
- {
264
- "fieldName": "PSTLCITY",
265
- "isEditable": true,
266
- "label": "Postal City",
267
- "visible": true
268
- },
269
- {
270
- "fieldName": "PSTLSTATE",
271
- "isEditable": true,
272
- "label": "Postal State",
273
- "visible": true
274
- },
275
- {
276
- "fieldName": "PSTLZIP5",
277
- "isEditable": true,
278
- "label": "Postal Zip 5",
279
- "visible": true
280
- },
281
- {
282
- "fieldName": "PSTLZIP4",
283
- "isEditable": true,
284
- "label": "Postal Zip +4",
285
- "visible": true
286
- },
287
- {
288
- "fieldName": "INTSTATE",
289
- "isEditable": true,
290
- "label": "International State",
291
- "visible": true
292
- },
293
- {
294
- "fieldName": "INTPSTLCD",
295
- "isEditable": true,
296
- "label": "International Postal Code",
297
- "visible": true
298
- },
299
- {
300
- "fieldName": "COUNTRY",
301
- "isEditable": true,
302
- "label": "Country",
303
- "visible": true
304
- },
305
- {
306
- "fieldName": "USPSBOXTYPE",
307
- "isEditable": true,
308
- "label": "USPS Box Type",
309
- "visible": true
310
- },
311
- {
312
- "fieldName": "USPSBOXID",
313
- "isEditable": true,
314
- "label": "USPS Box Identifier",
315
- "visible": true
316
- },
317
- {
318
- "fieldName": "USPSBOXGRP",
319
- "isEditable": true,
320
- "label": "USPS Box Group",
321
- "visible": true
322
- },
323
- {
324
- "fieldName": "REPRESENT",
325
- "isEditable": true,
326
- "label": "Owner / Occupant",
327
- "visible": true
328
- },
329
- {
330
- "fieldName": "STATUS",
331
- "isEditable": true,
332
- "label": "Status",
333
- "visible": true
334
- },
335
- {
336
- "fieldName": "expression/expr0",
337
- "isEditable": true,
338
- "visible": false
339
- }
340
- ],
341
- "title": ""
342
- }
343
- }
344
- ],
345
- "baseMap": {
346
- "baseMapLayers": [
347
- {
348
- "id": "World_Hillshade_3805",
349
- "opacity": 1,
350
- "title": "World Hillshade",
351
- "url": "https://services.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer",
352
- "visibility": true,
353
- "layerType": "ArcGISTiledMapServiceLayer"
354
- },
355
- {
356
- "id": "VectorTile_2333",
357
- "opacity": 1,
358
- "title": "World Topographic Map",
359
- "visibility": true,
360
- "layerType": "VectorTileLayer",
361
- "styleUrl": "https://cdn.arcgis.com/sharing/rest/content/items/7dc6cea0b1764a1f9af2e679f642f0f5/resources/styles/root.json"
362
- }
363
- ],
364
- "title": "Topographic"
365
- },
366
- "authoringApp": "ArcGISMapViewer",
367
- "authoringAppVersion": "2023.2",
368
- "initialState": {
369
- "viewpoint": {
370
- "targetGeometry": {
371
- "spatialReference": {
372
- "latestWkid": 3857,
373
- "wkid": 102100
374
- },
375
- "xmin": -9907730.599516412,
376
- "ymin": 5079172.794841483,
377
- "xmax": -9781762.376902392,
378
- "ymax": 5179916.798121383
379
- }
380
- }
381
- },
382
- "spatialReference": {
383
- "latestWkid": 3857,
384
- "wkid": 102100
385
- },
386
- "version": "2.28"
387
- }
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright 2022 Esri
3
- * Licensed under the Apache License, Version 2.0
4
- * http://www.apache.org/licenses/LICENSE-2.0
5
- */
6
- import{r as i,c as t,h as s,H as e,g as a}from"./p-f1782b8c.js";import{l}from"./p-eec708ad.js";import{g as h,h as n,c as o,d as r,e as d,f as c,i as p,j as g}from"./p-4807b2a1.js";import{c as b,e as u,f as v}from"./p-2a58e378.js";import{s as y}from"./p-dd4a1910.js";import{a as m,g as w}from"./p-a9154c5a.js";import{d as f,a as S}from"./p-02b1befe.js";import"./p-c3546866.js";import"./p-e1a4994d.js";import"./p-ff0d7712.js";import"./p-5856dc4f.js";const _=class{constructor(s){i(this,s),this.selectionSetChange=t(this,"selectionSetChange",7),this._selectedIds=[],this._selectionLabel="",this._graphics=[],this._featuresCollection={},this.bufferColor=[227,139,79,.8],this.bufferOutlineColor=[255,255,255],this.customLabelEnabled=void 0,this.enabledLayerIds=[],this.defaultBufferDistance=void 0,this.defaultBufferUnit=void 0,this.geometries=[],this.isUpdate=!1,this.layerViews=[],this.mapView=void 0,this.noResultText=void 0,this.searchConfiguration=void 0,this.selectionSet=void 0,this.selectionLayerIds=[],this.selectLayerView=void 0,this.sketchLineSymbol=void 0,this.sketchPointSymbol=void 0,this.sketchPolygonSymbol=void 0,this._numSelected=0,this._searchDistanceEnabled=!1,this._searchTerm=void 0,this._selectionLoading=!1,this._translations=void 0,this._useLayerFeaturesEnabled=!1}async watchGeometriesHandler(i,t){if(i!==t){const t=0===i.length;if(await this._clearResults(t,t),i.length>0)return this._highlightWithOIDsOrGeoms()}}async watchSearchConfigurationHandler(i,t){JSON.stringify(i)!==JSON.stringify(t)&&this._initSearchWidget()}async clearSelection(){return this._clearResults(!0,!0)}async getSelection(){return/\S+/gm.test(this._selectionLabel)||await this._updateLabel(),{id:this.isUpdate?this.selectionSet.id:Date.now(),searchResult:this._searchResult,buffer:this._bufferGeometry,distance:this._bufferTools.distance,download:!0,unit:this._bufferTools.unit,label:this._selectionLabel,selectedIds:this._selectedIds,layerView:this.selectLayerView,geometries:this.geometries,graphics:this._graphics,selectLayers:this.layerViews,skipGeomOIDs:this._skipGeomOIDs,searchDistanceEnabled:this._searchDistanceEnabled,workflowType:this._workflowType,useLayerFeaturesEnabled:this._useLayerFeaturesEnabled,sketchGraphic:this._sketchGraphic}}searchConfigurationChangeChanged(i){this.searchConfiguration=i.detail}async distanceChanged(i){await this._distanceChanged(i.detail)}async unitChanged(i){i.detail.newValue!==i.detail.oldValue&&(this._unit=i.detail.newValue,await this._updateLabel())}async componentWillLoad(){await this._getTranslations(),await this._initModules()}async componentDidLoad(){await this._init(),await this._searchWidget.when((()=>{this._searchWidget.allPlaceholder=this._translations.placeholder,this._searchWidget.defaultSources.forEach((i=>{i.placeholder=this._translations.placeholder}))}))}render(){return s(e,null,this._getMapLayerPicker(),s("div",{class:"border-bottom"}),s("div",{class:"padding-top-sides-1"},s("div",{class:"search-widget",ref:i=>{this._searchElement=i}}),s("div",{class:"padding-top-1"},s("map-draw-tools",{active:!0,editGraphicsEnabled:!this._useLayerFeaturesEnabled,graphics:this._graphics,mapView:this.mapView,onSketchGraphicsChange:i=>this._sketchGraphicsChanged(i),pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,ref:i=>{this._drawTools=i}})),this._getBufferOptions(),this._getUseLayerFeaturesOptions(),this._getNumSelected()),s("div",{class:"border-bottom"}),this._getNameInput())}_getBufferOptions(){var i,t;const e=this._searchDistanceEnabled?"search-distance":"div-not-visible",a="number"==typeof(null===(i=this.selectionSet)||void 0===i?void 0:i.distance)?this.selectionSet.distance:this.defaultBufferDistance;return s("div",null,s("div",{class:"padding-top-1 display-flex"},s("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},s("div",{class:"tooltip-container"},this._translations.searchDistance,s("calcite-icon",{class:"padding-start-1-2 icon",icon:"question",id:"search-distance-icon",scale:"s"}))),s("calcite-popover",{closable:!0,label:"",referenceElement:"search-distance-icon"},s("span",{class:"tooltip-message"},this._translations.useSearchDistanceTootip)),s("calcite-switch",{checked:this._searchDistanceEnabled,onCalciteSwitchChange:()=>this._searchDistanceEnabled=!this._searchDistanceEnabled})),s("div",{class:e},s("buffer-tools",{disabled:!this._searchDistanceEnabled,distance:a,geometries:this.geometries,onBufferComplete:i=>this._bufferComplete(i),ref:i=>this._bufferTools=i,unit:(null===(t=this.selectionSet)||void 0===t?void 0:t.unit)||this.defaultBufferUnit})))}_getUseLayerFeaturesOptions(){const i=this._useLayerFeaturesEnabled?"div-visible":"div-not-visible";return s("div",null,s("div",{class:"padding-top-1 display-flex"},s("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},s("div",{class:"tooltip-container"},this._translations.useLayerFeatures,s("calcite-icon",{class:"padding-start-1-2 icon",icon:"question",id:"use-layer-features-icon",scale:"s"}))),s("calcite-popover",{closable:!0,label:"",referenceElement:"use-layer-features-icon"},s("span",{class:"tooltip-message"},this._translations.useLayerFeaturesTooltip)),s("calcite-switch",{checked:this._useLayerFeaturesEnabled,onCalciteSwitchChange:()=>{this._useLayerFeaturesEnabledChanged()}})),s("div",{class:i+" padding-top-1"},s("map-layer-picker",{enabledLayerIds:this.selectionLayerIds,mapView:this.mapView,onLayerSelectionChange:i=>{this._layerSelectionChange(i)},selectedIds:this.layerViews.map((i=>i.layer.id)),showTables:!1})))}_getNumSelected(){const i=m(this.el),t=i&&"en"===i?`${this._translations.selectionLoading}...`:this._translations.selectionLoading;return s("div",{class:"padding-top-1 padding-bottom-1",style:{"align-items":"end",display:"flex"}},this._selectionLoading?s("div",null,s("calcite-loader",{class:"info-blue",inline:!0,label:t,scale:"m",type:"indeterminate"})):s("calcite-icon",{class:"info-blue padding-end-1-2",icon:"feature-layer",scale:"s"}),s("calcite-input-message",{class:"info-blue",scale:"m"},this._selectionLoading?t:this.noResultText&&0===this._numSelected?this.noResultText:this._translations.selectedFeatures.replace("{{n}}",this._numSelected.toString())))}_getNameInput(){return s("div",{class:"padding-sides-1 padding-top-1 "+(this.customLabelEnabled?"":"display-none")},s("calcite-label",{class:"font-bold"},this._translations.listName,s("calcite-input",{onInput:()=>{this._selectionLabel=this._labelName.value},placeholder:this._translations.listNamePlaceholder,ref:i=>{this._labelName=i},value:this._selectionLabel||""})))}_getMapLayerPicker(){return s("div",{class:"display-flex padding-sides-1 padding-bottom-1"},s("calcite-label",{class:"font-bold width-full label-margin-0"},this._translations.inputLayer,s("map-layer-picker",{enabledLayerIds:this.enabledLayerIds,mapView:this.mapView,onLayerSelectionChange:i=>this._inputLayerSelectionChange(i),selectedIds:this.selectLayerView?[this.selectLayerView.layer.id]:this.selectionSet?[this.selectionSet.layerView.layer.id]:[],showTables:!1})))}async _initModules(){const[i,t,s,e,a]=await l(["esri/layers/GraphicsLayer","esri/Graphic","esri/widgets/Search","esri/geometry/geometryEngine","esri/layers/FeatureLayer"]);this.GraphicsLayer=i,this.Graphic=t,this.Search=s,this._geometryEngine=e,this.FeatureLayer=a}async _init(){this._initGraphicsLayer(),await this._initSelectionSet(),this._initSearchWidget()}async _initSelectionSet(){var i,t,s,e;this.selectionSet&&(this._searchTerm=null===(i=this.selectionSet.searchResult)||void 0===i?void 0:i.name,this._searchResult=this.selectionSet.searchResult,this._selectLayers=this.selectionSet.selectLayers,this._selectedIds=this.selectionSet.selectedIds,this._skipGeomOIDs=this.selectionSet.skipGeomOIDs,this._searchDistanceEnabled=this.selectionSet.searchDistanceEnabled,this._useLayerFeaturesEnabled=this.selectionSet.useLayerFeaturesEnabled,this._distance=this.selectionSet.searchDistanceEnabled?this.selectionSet.distance:0,this._unit=this.selectionSet.unit,this._workflowType=this.selectionSet.workflowType,this.selectLayerView=this.selectionSet.layerView,this._sketchGraphic=this.selectionSet.sketchGraphic,this.geometries=[...(null===(t=this.selectionSet)||void 0===t?void 0:t.geometries)||[]],this._graphics=this.geometries.map((i=>new this.Graphic({geometry:i,symbol:"point"===i.type?this.sketchPointSymbol:"polyline"===i.type?this.sketchLineSymbol:this.sketchPolygonSymbol}))),this._selectionLabel=null===(s=this.selectionSet)||void 0===s?void 0:s.label,this._useLayerFeaturesEnabled||null===(e=this._drawTools)||void 0===e||e.updateGraphics(),await h(this.selectionSet.selectedIds,this.selectionSet.layerView,this.mapView,!1))}_initSearchWidget(){if(this.mapView&&this._searchElement){const i=this._getSearchConfig(this.searchConfiguration,this.mapView),t=Object.assign({view:this.mapView,container:this._searchElement,searchTerm:this._searchTerm},i);this._searchWidget=new this.Search(t),this._searchWidget.popupEnabled=!1,this._searchWidget.resultGraphicEnabled=!1,this._searchWidget.on("search-clear",(()=>{const i=this._searchClearLabel();this._clearResults(!1,i)})),this._searchWidget.on("select-result",(i=>{var t,s;if(i.result){this._searchResult=i.result;const e=(null===(s=null===(t=i.source)||void 0===t?void 0:t.layer)||void 0===s?void 0:s.id)&&i.source.layer.id===this.selectLayerView.layer.id,a=e?[i.result.feature.getObjectId()]:void 0;this._workflowType=b.SEARCH,this._updateLabel();const l=[i.result.feature];this._updateSelection(l,e,a),this._drawTools.graphics=l,this._searchWidget.resultGraphic.visible=!1}else{const i=this._searchClearLabel();this._clearResults(!1,i)}}))}}_searchClearLabel(){var i;return(null===(i=this._searchResult)||void 0===i?void 0:i.name)&&this._labelName.value.indexOf(this._searchResult.name)>-1}_getSearchConfig(i,t){const s=null==i?void 0:i.sources;return(null==s?void 0:s.length)>0?(i.includeDefaultSources=!1,s.forEach((i=>{var s,e;if(i.hasOwnProperty("layer")){const a=i,l=null===(s=a.layer)||void 0===s?void 0:s.id,h=l?t.map.findLayerById(l):null,n=null===(e=null==a?void 0:a.layer)||void 0===e?void 0:e.url;h?a.layer=h:n&&(a.layer=new this.FeatureLayer(n))}})),null==s||s.forEach((i=>{if(i.hasOwnProperty("locator")){const t=i;"ArcGIS World Geocoding Service"===(null==t?void 0:t.name)&&(t.outFields=t.outFields||["Addr_type","Match_addr","StAddr","City"],t.singleLineFieldName="SingleLine"),t.url=t.url,delete t.url}}))):i=Object.assign(Object.assign({},i),{includeDefaultSources:!0}),i}_initGraphicsLayer(){const i=this._translations.bufferLayer,t=this.mapView.map.layers.findIndex((t=>t.title===i));if(t>-1)this._bufferGraphicsLayer=this.mapView.map.layers.getItemAt(t);else{this._bufferGraphicsLayer=new this.GraphicsLayer({title:i,listMode:"hide"}),y.managedLayers.push(i);const t=this.mapView.map.layers.findIndex((i=>i.title===this._translations.sketchLayer));t>-1?this.mapView.map.layers.add(this._bufferGraphicsLayer,t):this.mapView.map.layers.add(this._bufferGraphicsLayer)}}async _sketchGraphicsChanged(i,t=!1){const s=i.detail.graphics;if(s.length>0&&s[0])if(t||(this._sketchGraphic=s[0]),this._workflowType=this._useLayerFeaturesEnabled?b.SELECT:b.SKETCH,this._workflowType===b.SKETCH&&this._drawTools.updateGraphics(),await this._updateLabel(),this._clearSearchWidget(),this._useLayerFeaturesEnabled&&!t){const i=Array.isArray(s)?s.map((i=>i.geometry)):this.geometries;await this._selectLayerFeatures(i[0])}else{const t=s.reduce(((i,t)=>{var s;return(null===(s=null==t?void 0:t.layer)||void 0===s?void 0:s.objectIdField)?i.push(t.attributes[t.layer.objectIdField]):t.getObjectId&&i.push(t.getObjectId()),i}),[]),e=i.detail.useOIDs&&t.length>0;this._updateSelection(s,e,t),e&&await this._highlightFeatures(t)}else await this._clearResults(!0,!0)}async _highlightWithOIDsOrGeoms(){var i;return(null===(i=this._skipGeomOIDs)||void 0===i?void 0:i.length)>0?(this._selectedIds=this._skipGeomOIDs,this._highlightFeatures(this._selectedIds)):this._geomQuery(this.geometries)}async _highlightFeatures(i){y.removeHandles(),i.length>0&&y.highlightHandles.push(await n(i,this.selectLayerView,this.mapView)),this._numSelected=i.length,this.selectionSetChange.emit(i.length)}async _selectFeatures(i){this._selectionLoading=!0,this._selectedIds=await o(i,this.selectLayerView.layer),this._selectionLoading=!1,this._drawTools.graphics=this._graphics,await this._highlightFeatures(this._selectedIds)}async _bufferComplete(i){this._bufferGeometry=Array.isArray(i.detail)?i.detail[0]:i.detail;let t=this._bufferTools.distance,s=0;if(this._bufferGeometry){const i=new this.Graphic({geometry:this._bufferGeometry,symbol:{type:"simple-fill",color:this.bufferColor,outline:{color:this.bufferOutlineColor,width:1}}});this._bufferGraphicsLayer.removeAll(),this._bufferGraphicsLayer.add(i),await this._selectFeatures([this._bufferGeometry]),await this.mapView.goTo(i.geometry.extent),s=t,t=0}else this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),await this._highlightWithOIDsOrGeoms();await this._distanceChanged({oldValue:t,newValue:s})}_geomQuery(i){const t=r(i,this._geometryEngine);return this._selectFeatures(t)}async _clearResults(i=!0,t=!1){var s;this._selectedIds=[],this._distance=void 0,this._unit=void 0,t&&(this._selectionLabel="",this._labelName.value=""),this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),i&&this._searchWidget&&this._clearSearchWidget(),y.removeHandles(),(null===(s=this._drawTools)||void 0===s?void 0:s.clear)&&(this._graphics=[],await this._drawTools.clear()),this.selectionSetChange.emit(this._selectedIds.length)}_clearSearchWidget(){this._searchWidget.clear(),this._searchResult=void 0}_updateSelection(i,t,s){this._selectedIds=t&&s?s:this._selectedIds,this._skipGeomOIDs=t?s:void 0,this.geometries=Array.isArray(i)?i.map((i=>i.geometry)):this.geometries,this._graphics=i}async _updateLabel(){var i,t;const s=this._selectionLabel.indexOf(this._translations.sketch)>-1,e=this._selectionLabel.indexOf(this._translations.select)>-1,a=this._selectionLabel.indexOf(null===(i=this._searchResult)||void 0===i?void 0:i.name)>-1,l=this._workflowType===b.SEARCH?null===(t=this._searchResult)||void 0===t?void 0:t.name:this._workflowType===b.SELECT?this._translations.select:this._translations.sketch,h=this._unit?this._unit:this._bufferTools.unit,n=await this._bufferTools.getTranslatedUnit(h),o=isNaN(this._distance)?this._bufferTools.distance:this._distance;this._selectionLabel=s||e||a||!this._selectionLabel?`${l} ${o} ${n}`:this._selectionLabel,this._labelName.value=this._selectionLabel}async _layerSelectionChange(i){if(Array.isArray(i.detail)&&i.detail.length>0){const t=i.detail.map((i=>d(this.mapView,i)));return Promise.all(t).then((i=>{this.layerViews=i,this._featuresCollection={},this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}))}}async _inputLayerSelectionChange(i){var t;const s=(null===(t=null==i?void 0:i.detail)||void 0===t?void 0:t.length)>0?i.detail[0]:"";this.selectLayerView&&s===this.selectLayerView.layer.id||(this.selectLayerView=await d(this.mapView,s),await this._updateLabel(),this._bufferGeometry?await this._selectFeatures([this._bufferGeometry]):await this._highlightWithOIDsOrGeoms())}async _distanceChanged(i){i.newValue!==i.oldValue&&(this._distance=i.newValue,await this._updateLabel())}async _selectLayerFeatures(i){this._selectionLoading=!0;const t=this.layerViews.map((t=>(this._featuresCollection[t.layer.id]=[],c(0,t.layer,i,this._featuresCollection))));return Promise.all(t).then((async i=>{this._selectionLoading=!1;let t=[];i.forEach((i=>{Object.keys(i).forEach((s=>{t=t.concat(i[s])}))}));let s=!1;t.forEach((i=>{var t;const e=i.geometry;i.symbol="point"===e.type?this.sketchPointSymbol:"polyline"===e.type?this.sketchLineSymbol:"polygon"===e.type?this.sketchPolygonSymbol:void 0,s=(null===(t=null==i?void 0:i.layer)||void 0===t?void 0:t.hasOwnProperty("objectIdField"))||i.hasOwnProperty("getObjectId")}));const e=this.layerViews[0].layer.title===this.selectLayerView.layer.title&&s;await this._sketchGraphicsChanged({detail:{graphics:t,useOIDs:e}},!0)}))}_useLayerFeaturesEnabledChanged(){this._useLayerFeaturesEnabled=!this._useLayerFeaturesEnabled,this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}async _getTranslations(){const i=await w(this.el);this._translations=i[0]}get el(){return a(this)}static get watchers(){return{geometries:["watchGeometriesHandler"],searchConfiguration:["watchSearchConfigurationHandler"]}}};_.style=':host{display:block}.div-visible{display:inherit}.div-visible-search{display:flex;height:44px;align-items:center;padding-bottom:0}.div-not-visible{display:none}.padding-bottom-1{padding-bottom:1rem}.padding-top-1{padding-top:1rem}.search-widget{width:100% !important;border:1px solid var(--calcite-ui-border-input)}.w-100{width:100%}.w-50{width:50%}.search-distance-container{padding-top:"1rem" !important}.end-border{border-inline-end:1px solid var(--calcite-ui-border-2)}.search-distance{display:flex;padding-top:1rem}.font-bold{font:bold}.border-bottom{border-bottom:1px solid var(--calcite-ui-border-2)}.tooltip-container{display:flex}.padding-start-1-2{padding-inline-start:0.5rem}.icon{--calcite-ui-icon-color:var(--calcite-ui-brand)}.tooltip-message{padding:5px 8px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2)}';const L=Object.freeze({__proto__:null,default:[{descriptionPDF:{labelWidthDisplay:"2-5/8",labelHeightDisplay:"1",labelsPerPageDisplay:"30",averyPartNumber:"*60"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.1875,rightMargin:.1875,topMargin:.5,bottomMargin:.5},numLabelsAcross:3,numLabelsDown:10,labelWidth:2.625,labelHeight:1,horizGapIn:.125,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:4}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"1",labelsPerPageDisplay:"20",averyPartNumber:"*61"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.47637821,bottomMargin:.5},numLabelsAcross:2,numLabelsDown:10,labelWidth:4,labelHeight:1.0025,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:4}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"1-1/3",labelsPerPageDisplay:"14",averyPartNumber:"*62"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.81889808,bottomMargin:.83464612},numLabelsAcross:2,numLabelsDown:7,labelWidth:4,labelHeight:1.3352,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:6}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"2",labelsPerPageDisplay:"10",averyPartNumber:"*63"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.5,bottomMargin:.5},numLabelsAcross:2,numLabelsDown:5,labelWidth:4,labelHeight:2,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:12,maxNumLabelLines:10}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"3-1/3",labelsPerPageDisplay:"6",averyPartNumber:"*64"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.4724412,bottomMargin:.50000027},numLabelsAcross:2,numLabelsDown:3,labelWidth:4,labelHeight:3.342,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:14,maxNumLabelLines:12}},{descriptionPDF:{labelWidthDisplay:"1-3/4",labelHeightDisplay:"1/2",labelsPerPageDisplay:"80",averyPartNumber:"*67"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.307086375,rightMargin:.307086375,topMargin:.4724412,bottomMargin:.49606326},numLabelsAcross:4,numLabelsDown:20,labelWidth:1.75,labelHeight:.50155,horizGapIn:.29527575,vertGapIn:0,labelPadding:.1,fontSizePx:8,maxNumLabelLines:3}},{descriptionPDF:{labelWidthDisplay:"1-3/4",labelHeightDisplay:"2/3",labelsPerPageDisplay:"60",averyPartNumber:"*95"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.28936983,rightMargin:.28936983,topMargin:.53937037,bottomMargin:.5511814},numLabelsAcross:4,numLabelsDown:15,labelWidth:1.75,labelHeight:.6605,horizGapIn:.30708678,vertGapIn:0,labelPadding:.1,fontSizePx:8,maxNumLabelLines:4}}]}),P=class{constructor(t){i(this,t),this.defaultNumLabelsPerPage=void 0,this.disabled=!1,this._translations=void 0}async downloadCSV(i,t,s,e=!0){return f(i,t,!0,s,e)}async downloadPDF(i,t,s=!1,e="",a=""){var l;return S(i,t,null===(l=this._labelInfoElement.selectedOption)||void 0===l?void 0:l.value,s,e,a)}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){return s(e,null,s("calcite-select",{disabled:this.disabled,label:"",ref:i=>{this._labelInfoElement=i}}))}componentDidLoad(){this._renderOptions()}async _initModules(){const[i]=await l(["esri/intl"]);this._intl=i}_getLabelSizeText(i){const t="&lrm;"+i.descriptionPDF.labelWidthDisplay+" x "+i.descriptionPDF.labelHeightDisplay+"&rlm;";return this._translations.pdfLabel.replace("{{n}}",i.descriptionPDF.labelsPerPageDisplay).replace("{{labelSize}}",t)}async _getTranslations(){const i=await w(this.el);this._translations=i[0]}_renderOptions(){(L.default||L).sort(((i,t)=>{const s=parseInt(i.descriptionPDF.labelsPerPageDisplay,10),e=parseInt(t.descriptionPDF.labelsPerPageDisplay,10);return s<e?-1:s>e?1:0})).forEach(((i,t)=>{const s=document.createElement("calcite-option");s.value=i,s.innerHTML=this._getLabelSizeText(i),this._labelInfoElement.appendChild(s),(this.defaultNumLabelsPerPage?parseInt(i.descriptionPDF.labelsPerPageDisplay,10)===this.defaultNumLabelsPerPage:0===t)&&(s.selected=!0,this._labelInfoElement.selectedOption=s)}))}get el(){return a(this)}};P.style=":host{display:block}";const x=class{constructor(s){i(this,s),this.selectionLoadingChange=t(this,"selectionLoadingChange",7),this.selectionSetsChanged=t(this,"selectionSetsChanged",7),this._addEnabled=!0,this._refineSets=[],this._enabledLayerIds=[],this._featuresCollection={},this.addresseeLayer=void 0,this.enabledLayerIds=[],this.mapView=void 0,this.selectionSets=[],this.sketchLineSymbol=void 0,this.sketchPointSymbol=void 0,this.sketchPolygonSymbol=void 0,this._translations=void 0,this._selectionMode=u.ADD,this._refineLayer=void 0}async componentWillLoad(){await this._getTranslations(),this._enabledLayerIds=this._getEnabledLayerIds(),await this._setRefineSet(this._enabledLayerIds[0])}render(){var i,t;return s(e,null,s("div",{class:(this._enabledLayerIds.length>1?"display-block":"display-none")+" padding-top-sides-1"},s("div",{class:"display-flex"},s("calcite-label",{class:"font-bold width-full label-margin-0"},s("div",{class:"display-flex"},this._translations.inputLayer,s("calcite-icon",{class:"padding-start-1-2 icon",icon:"question",id:"refine-input-layer",scale:"s"})),s("map-layer-picker",{enabledLayerIds:this._enabledLayerIds,mapView:this.mapView,onLayerSelectionChange:i=>{this._layerSelectionChange(i)},ref:i=>{this._layerPicker=i},selectedIds:[this._refineLayer.layer.id],showTables:!1})),s("calcite-popover",{closable:!0,label:"",referenceElement:"refine-input-layer"},s("span",{class:"tooltip-message"},this._translations.inputLayerTip)))),s("div",{class:"padding-1"},s("div",{class:"padding-bottom-1"},s("calcite-segmented-control",{class:"w-100"},s("calcite-segmented-control-item",{checked:this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(u.ADD),value:u.ADD},s("span",{class:"font-weight-500"},this._translations.add)),s("calcite-segmented-control-item",{checked:!this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(u.REMOVE),value:u.REMOVE},s("span",{class:"font-weight-500"},this._translations.remove)))),s("div",null,s("map-draw-tools",{active:!0,drawMode:v.REFINE,mapView:this.mapView,onDrawRedo:()=>this._redo(),onDrawUndo:()=>this._undo(),onSketchGraphicsChange:i=>this._sketchGraphicsChanged(i),pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,redoEnabled:(null===(i=this._refineSelectionSet)||void 0===i?void 0:i.redoStack.length)>0,ref:i=>{this._drawTools=i},undoEnabled:(null===(t=this._refineSelectionSet)||void 0===t?void 0:t.undoStack.length)>0})),s("br",null),s("calcite-list",{class:"list-border"},this._getRefineSelectionSetList())))}_layerSelectionChange(i){this._setRefineSet(i.detail[0])}_setSelectionMode(i){this._selectionMode=i}_sketchGraphicsChanged(i){var t;const s=null===(t=i.detail)||void 0===t?void 0:t.graphics[0].geometry;this._selectFeatures(s)}_getEnabledLayerIds(){return this.selectionSets.reduce(((i,t)=>{var s;const e=null===(s=null==t?void 0:t.layerView)||void 0===s?void 0:s.layer.id;return e&&i.indexOf(e)<0?i.push(e):t.workflowType===b.REFINE&&Object.keys(t.refineInfos).forEach((t=>{i.indexOf(t)<0&&i.push(t)})),i}),[])}async _setRefineSet(i){this.selectionSets.some((t=>{if(t.workflowType===b.REFINE)return this._refineSelectionSet=t,Object.keys(t.refineInfos).indexOf(i)>-1}))||await this._initRefineSet(i,this._refineSelectionSet),this._refineLayer=this._refineSelectionSet.refineInfos[i].layerView}async _initRefineSet(i,t){const s={};s[i]={addIds:[],removeIds:[],layerView:await d(this.mapView,i)},t?t.refineInfos=Object.assign(Object.assign({},t.refineInfos),s):(this._refineSelectionSet={id:Date.now(),searchResult:void 0,buffer:void 0,distance:0,download:!0,unit:"feet",label:"Refine",selectedIds:[],layerView:void 0,geometries:[],graphics:[],selectLayers:[],workflowType:b.REFINE,searchDistanceEnabled:!1,useLayerFeaturesEnabled:!1,refineInfos:s,redoStack:[],undoStack:[],sketchGraphic:void 0},this.selectionSets.push(this._refineSelectionSet))}_undo(){const i=this._refineSelectionSet.undoStack.pop();this._updateIds(i.ids,i.mode===u.ADD?u.REMOVE:u.ADD,this._refineSelectionSet.redoStack,i.layerView)}_redo(){const i=this._refineSelectionSet.redoStack.pop();this._updateIds(i.ids,i.mode===u.ADD?u.REMOVE:u.ADD,this._refineSelectionSet.undoStack,i.layerView)}_getRefineSelectionSetList(){const i=this._getTotal(this.selectionSets);let t;this.selectionSets.some((i=>{if(i.workflowType===b.REFINE)return t=i,!0}));let e=0,a=0;return Object.keys(t.refineInfos).forEach((i=>{e+=t.refineInfos[i].addIds.length,a+=t.refineInfos[i].removeIds.length})),[s("calcite-list-item",{label:this._translations.featuresAdded.replace("{{n}}",e.toString()),"non-interactive":!0}),s("calcite-list-item",{label:this._translations.featuresRemoved.replace("{{n}}",a.toString()),"non-interactive":!0}),s("calcite-list-item",{label:this._translations.totalSelected.replace("{{n}}",i.toString()),"non-interactive":!0})]}_getTotal(i){const t=p(i);return Object.keys(t).reduce(((i,s)=>i+t[s].ids.length),0)}async _getTranslations(){const i=await w(this.el);this._translations=i[0]}async _selectFeatures(i){var t,s;this.selectionLoadingChange.emit(!0),this._featuresCollection[null===(t=this._refineLayer)||void 0===t?void 0:t.layer.id]=[];const e=await c(0,null===(s=this._refineLayer)||void 0===s?void 0:s.layer,i,this._featuresCollection);this.selectionLoadingChange.emit(!1);let a=[];Object.keys(e).forEach((i=>{var t;i===(null===(t=this._refineLayer)||void 0===t?void 0:t.layer.id)&&(a=a.concat(e[i]))}));const l=Array.isArray(a)?a.map((i=>{var t;return i.attributes[null===(t=null==i?void 0:i.layer)||void 0===t?void 0:t.objectIdField]})):[];await this._updateIds(l,this._selectionMode,this._refineSelectionSet.undoStack,this._refineLayer),this._drawTools.clear()}async _highlightFeatures(){this._clearHighlight(),y.highlightHandles=await g(this.selectionSets)}_clearHighlight(){y.removeHandles()}async _updateIds(i,t,s,e){let a=!1;const l=this._refineSelectionSet.refineInfos,h=e.layer.id,n={};n[h]={addIds:[],removeIds:[],layerView:e};const o=Object.keys(l).indexOf(h)>-1?l[h]:n[h];if(t===u.ADD)o.addIds=[...new Set([...i,...o.addIds])],o.addIds.length>0&&s.push({ids:i,mode:t,layerView:e}),o.removeIds.length>0&&(o.removeIds=o.removeIds.filter((t=>i.indexOf(t)<0)));else{const l=this.selectionSets.reduce(((t,s)=>(i.forEach((i=>{s.workflowType!==b.REFINE?s.selectedIds.indexOf(i)>-1&&t.push(i):Object.keys(s.refineInfos).some((a=>{const l=s.refineInfos[a];if(l.layerView.layer.id===e.layer.id&&l.addIds.indexOf(i)>-1)return t.push(i),!0}))})),t)),[]);o.removeIds=[...new Set([...l,...o.removeIds])],o.addIds=o.addIds.filter((i=>l.indexOf(i)<0)),o.removeIds.length>0&&s.push({ids:l,mode:t,layerView:e}),this.selectionSets=this.selectionSets.reduce(((i,t)=>(t.workflowType!==b.REFINE&&t.layerView.layer.id===e.layer.id?(t.selectedIds=t.selectedIds.filter((i=>o.removeIds.indexOf(i)<0)),t.selectedIds.length>0?i.push(t):a=!0):i.push(t),i)),[])}this._refineSelectionSet.refineInfos[h]=o,this.selectionSets=[...this.selectionSets],a&&this.selectionSetsChanged.emit(this.selectionSets),await this._highlightFeatures()}get el(){return a(this)}};x.style=':host{display:block}.div-visible{display:inherit}.div-not-visible{display:none !important}.padding-top-1-2{padding-top:.5rem}.main-label{display:flex;float:left}html[dir="rtl"] .main-label{display:flex;float:right}.border{outline:1px solid var(--calcite-ui-border-input)}.margin-top-1{margin-top:1rem}.esri-sketch{display:flex;flex-flow:column wrap}.esri-widget{box-sizing:border-box;color:#323232;font-size:14px;font-family:"Avenir Next","Helvetica Neue",Helvetica,Arial,sans-serif;line-height:1.3em;background-color:var(--calcite-ui-foreground-1)}.esri-sketch__panel{align-items:center;display:flex;flex-flow:row nowrap;padding:0}*/ .esri-sketch__tool-section{border-right:1px solid rgba(110,110,110,.3)}.esri-sketch__section{align-items:center;display:flex;flex-flow:row nowrap;padding:0 7px;margin:6px 0;border-right:1px solid rgba(110,110,110,.3)}.display-flex{display:flex}.font-bold{font-weight:bold}.width-full{width:100%}.label-margin-0{--calcite-label-margin-bottom:0}.padding-start-1-2{padding-inline-start:0.5rem}.font-weight-500{font-weight:500}.word-wrap-anywhere{word-wrap:anywhere}';export{_ as map_select_tools,P as pdf_download,x as refine_selection}