@esri/solutions-components 5.1.0-next.129 → 5.1.0-next.130

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 (52) hide show
  1. package/dist/cdn/CSS4AELA.js +2 -0
  2. package/dist/cdn/EVGXFAJU.js +2 -0
  3. package/dist/cdn/J5K2SIY6.js +4 -0
  4. package/dist/cdn/{HZOBBQYW.js → JSQHZGE3.js} +91 -91
  5. package/dist/cdn/RMCQZMLA.js +2 -0
  6. package/dist/cdn/U4A4FLFF.js +2 -0
  7. package/dist/cdn/{N2UNOXJ6.js → W5L4RUZC.js} +1 -1
  8. package/dist/cdn/{DYCGZ67C.js → WK7CB4GW.js} +1 -1
  9. package/dist/cdn/{6IMLSV3Z.js → YZVDT3ZT.js} +1 -1
  10. package/dist/cdn/Z4BCFJUQ.js +88 -0
  11. package/dist/cdn/ZTO4S3BZ.js +2 -0
  12. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.en.json +1 -1
  13. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.json +1 -1
  14. package/dist/cdn/assets/create-feature/t9n/messages.en.json +1 -1
  15. package/dist/cdn/assets/create-feature/t9n/messages.json +1 -1
  16. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.en.json +1 -1
  17. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.json +1 -1
  18. package/dist/cdn/index.js +1 -1
  19. package/dist/chunks/updateDesign.js +1 -1
  20. package/dist/components/arcgis-solutions-assistant/customElement.d.ts +6 -0
  21. package/dist/components/arcgis-solutions-assistant/customElement.js +340 -340
  22. package/dist/components/create-feature/customElement.d.ts +35 -3
  23. package/dist/components/create-feature/customElement.js +176 -76
  24. package/dist/components/create-feature/index.js +2 -1
  25. package/dist/components/create-related-feature/customElement.d.ts +4 -4
  26. package/dist/components/create-related-feature/customElement.js +60 -80
  27. package/dist/components/create-related-feature/index.js +1 -0
  28. package/dist/components/crowdsource-reporter/customElement.d.ts +16 -2
  29. package/dist/components/crowdsource-reporter/customElement.js +75 -49
  30. package/dist/components/feature-list/customElement.d.ts +1 -1
  31. package/dist/components/feature-list/customElement.js +2 -2
  32. package/dist/components/layer-list/customElement.d.ts +1 -1
  33. package/dist/components/solution-builder-assistant/customElement.js +97 -98
  34. package/dist/docs/api.json +1 -1
  35. package/dist/docs/docs.json +1 -1
  36. package/dist/docs/vscode.html-custom-data.json +1 -1
  37. package/dist/docs/web-types.json +1 -1
  38. package/dist/loader.js +2 -2
  39. package/dist/solutions-components_commit.txt +7 -7
  40. package/dist/types/lumina.d.ts +2 -2
  41. package/dist/types/preact.d.ts +2 -2
  42. package/dist/types/react.d.ts +2 -2
  43. package/dist/types/stencil.d.ts +2 -2
  44. package/dist/utils/interfaces.d.ts +17 -0
  45. package/package.json +1 -1
  46. package/dist/cdn/53MDMQSB.js +0 -88
  47. package/dist/cdn/H4YPSJ5G.js +0 -2
  48. package/dist/cdn/KLCBAO3U.js +0 -4
  49. package/dist/cdn/NSKVOAA7.js +0 -2
  50. package/dist/cdn/ODB4CELR.js +0 -2
  51. package/dist/cdn/QYWT7Y5Q.js +0 -2
  52. package/dist/cdn/UYOTCDME.js +0 -2
@@ -1,6 +1,6 @@
1
1
  /// <reference path="../../index.d.ts" />
2
2
  import type MapView from "@arcgis/core/views/MapView.js";
3
- import type { IImageExtraction, ISearchConfiguration } from "../../utils/interfaces.js";
3
+ import type { IImageExtraction, ISearchConfiguration, ITextExtraction } from "../../utils/interfaces.js";
4
4
  import type { PublicLitElement as LitElement } from "@arcgis/lumina";
5
5
  import type { T9nMeta } from "@arcgis/lumina/controllers";
6
6
 
@@ -18,23 +18,35 @@ export abstract class CreateFeature extends LitElement {
18
18
  editLocationLabel: string;
19
19
  reportOutsideAreaMessage: string;
20
20
  enableFeatureTemplatesMessage: string;
21
- aiImgExtractionLabel: string;
21
+ usePhoto: string;
22
22
  aiAssistantDescription: string;
23
+ useDescription: string;
24
+ aiTextAssistantDescription: string;
23
25
  fillOutManually: string;
24
26
  startBlank: string;
25
27
  next: string;
26
28
  cancel: string;
27
29
  createReportHeading: string;
30
+ aiAssistedReport: string;
31
+ manualReport: string;
28
32
  aiAssistantProcessingHint: string;
33
+ aiTextProcessingHint: string;
29
34
  imageUploadLimitHint: string;
30
35
  replaceImage: string;
31
36
  analyzingImage: string;
37
+ description: string;
38
+ messageInputHint: string;
39
+ descriptionRequiredHint: string;
40
+ analyzingText: string;
32
41
  formReviewMsg: string;
42
+ textReviewMsg: string;
33
43
  skip: string;
34
44
  photo: string;
35
45
  error: string;
36
46
  imageExtractionError: string;
37
47
  imageExtractionPartialError: string;
48
+ textExtractionError: string;
49
+ textExtractionPartialError: string;
38
50
  } & T9nMeta<{
39
51
  chooseCategoryMsg: string;
40
52
  provideDetailsMsg: string;
@@ -42,26 +54,40 @@ export abstract class CreateFeature extends LitElement {
42
54
  editLocationLabel: string;
43
55
  reportOutsideAreaMessage: string;
44
56
  enableFeatureTemplatesMessage: string;
45
- aiImgExtractionLabel: string;
57
+ usePhoto: string;
46
58
  aiAssistantDescription: string;
59
+ useDescription: string;
60
+ aiTextAssistantDescription: string;
47
61
  fillOutManually: string;
48
62
  startBlank: string;
49
63
  next: string;
50
64
  cancel: string;
51
65
  createReportHeading: string;
66
+ aiAssistedReport: string;
67
+ manualReport: string;
52
68
  aiAssistantProcessingHint: string;
69
+ aiTextProcessingHint: string;
53
70
  imageUploadLimitHint: string;
54
71
  replaceImage: string;
55
72
  analyzingImage: string;
73
+ description: string;
74
+ messageInputHint: string;
75
+ descriptionRequiredHint: string;
76
+ analyzingText: string;
56
77
  formReviewMsg: string;
78
+ textReviewMsg: string;
57
79
  skip: string;
58
80
  photo: string;
59
81
  error: string;
60
82
  imageExtractionError: string;
61
83
  imageExtractionPartialError: string;
84
+ textExtractionError: string;
85
+ textExtractionPartialError: string;
62
86
  }>;
63
87
  /** array: Configured AI image extraction field and prompt for the selected LayerId */
64
88
  accessor aiImageExtraction: IImageExtraction[] | undefined;
89
+ /** array: Configured AI text extraction field and prompt for the selected LayerId */
90
+ accessor aiTextExtraction: ITextExtraction[] | undefined;
65
91
  /**
66
92
  * boolean: When true user can create multiple features
67
93
  *
@@ -77,6 +103,12 @@ export abstract class CreateFeature extends LitElement {
77
103
  * @default false
78
104
  */
79
105
  accessor customizeSubmit: boolean | undefined;
106
+ /**
107
+ * boolean: When true message analysis attempts to extract and geocode location text
108
+ *
109
+ * @default false
110
+ */
111
+ accessor enableMessageLocation: boolean | undefined;
80
112
  /**
81
113
  * boolean: When true photo get location from the photo selected for AI image Extraction
82
114
  *
@@ -1,35 +1,36 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { c as b } from "../../chunks/runtime.js";
3
- import { g as v, d as y } from "../../chunks/mapViewUtils.js";
4
- import { u as I } from "../../chunks/useT9n.js";
5
- import { css as A, html as l, nothing as f } from "lit";
6
- import { createRef as p, ref as m } from "lit-html/directives/ref.js";
7
- import { LitElement as M, createEvent as c, noShadowRoot as x, safeClassMap as w } from "@arcgis/lumina";
8
- import { p as k } from "../../chunks/queryUtils.js";
2
+ import { c as x } from "../../chunks/runtime.js";
3
+ import { g as I, d as w } from "../../chunks/mapViewUtils.js";
4
+ import { u as A } from "../../chunks/useT9n.js";
5
+ import { css as M, html as l, nothing as _ } from "lit";
6
+ import { createRef as u, ref as m } from "lit-html/directives/ref.js";
7
+ import { LitElement as k, createEvent as c, noShadowRoot as L, safeClassMap as v } from "@arcgis/lumina";
8
+ import { p as E } from "../../chunks/queryUtils.js";
9
9
  import C from "@arcgis/core/form/ExpressionInfo.js";
10
- import L from "@arcgis/core/layers/FeatureLayer.js";
11
- import S from "@arcgis/core/form/elements/FieldElement.js";
12
- import V from "@arcgis/core/form/FormTemplate.js";
13
- import P from "@arcgis/core/views/MapView.js";
14
- import E from "@arcgis/core/Graphic.js";
15
- import * as _ from "@arcgis/core/core/reactiveUtils.js";
16
- import $ from "@arcgis/core/request.js";
17
- import * as F from "exifr";
18
- import R from "@arcgis/core/geometry/Point.js";
19
- import U from "@arcgis/core/geometry/SpatialReference.js";
20
- const T = A`@layer{:host{display:block}.hide-editor-toolbar .esri-editor__panel-toolbar{display:none!important}.esri-editor__panel-content{padding-block:0px!important}.esri-editor .esri-item-list__group__header,.esri-editor__panel-content__section .esri-widget__heading{display:none!important}.esri-editor .esri-item-list__filter-container--sticky{padding-block:0px!important;padding-inline:10px!important}.search-widget{width:92%!important;margin:5px 14px 20px}.display-none{display:none!important}.hide-map{height:1%!important;visibility:hidden;position:static!important}.show-map{padding:10px!important;position:absolute!important;bottom:0;height:auto!important;width:calc(100% - 22px)}.notice-msg{padding:10px;width:calc(100% - 20px)}.edit-location-btn{margin:5px;display:flex}.esri-editor__panel-content{padding-block:10px!important}.image-preview-container{padding:10px}.esri-editor{height:auto!important}.height-fit-content{height:fit-content!important}.content-container{padding:1.5rem}.instruction-text{margin-bottom:1.5rem;font-size:1rem}.selected-card{border:2px solid var(--calcite-ui-brand)}.upload-img-footer-container{width:100%;gap:5px;display:grid}.info-container{display:flex;align-items:center;gap:6px;margin-bottom:10px}.info-container calcite-icon{--calcite-icon-color: var(--calcite-color-brand)}.info-container span{font-size:12px;color:var(--calcite-ui-text-3)}.padding-10{padding:10px}.report-selection-container{display:flex;flex-direction:column;padding:10px;--calcite-card-border-color: var(--calcite-color-border-1)}.pb-12{padding-bottom:12px!important}.pt-0{padding-top:0!important}.pt-15{padding-top:15px!important}.cursor-pointer{cursor:pointer;padding:6px 0}.card-body-content{display:flex;flex-direction:row;align-items:center;padding:10px 5px;gap:15px}.text-stack{display:flex;flex-direction:column;gap:2px}.option-title{font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-1);font-size:var(--calcite-font-size--1)}.option-description{color:var(--calcite-ui-text-3);font-size:var(--calcite-font-size--1)}.action-footer{display:flex;justify-content:center;margin-top:16px}.analysis-wrapper{display:flex;flex-direction:column;align-items:center;gap:5px;text-align:center;margin:auto}.analyzing-icon{--calcite-icon-color: var(--calcite-color-brand);animation:sparkle 2s infinite ease-in-out}.adjusted-height{height:30px!important;min-height:auto!important}@keyframes sparkle{0%,to{transform:scale(1)}50%{transform:scale(1.5)}}@media only screen and (max-width:600px){.esri-editor__panel-content{padding-block:0!important;min-height:0!important}}}`;
21
- class H extends M {
10
+ import S from "@arcgis/core/layers/FeatureLayer.js";
11
+ import P from "@arcgis/core/form/elements/FieldElement.js";
12
+ import $ from "@arcgis/core/form/FormTemplate.js";
13
+ import V from "@arcgis/core/views/MapView.js";
14
+ import F from "@arcgis/core/Graphic.js";
15
+ import * as y from "@arcgis/core/core/reactiveUtils.js";
16
+ import * as T from "@arcgis/core/rest/locator.js";
17
+ import b from "@arcgis/core/request.js";
18
+ import * as R from "exifr";
19
+ import U from "@arcgis/core/geometry/Point.js";
20
+ import z from "@arcgis/core/geometry/SpatialReference.js";
21
+ const H = M`@layer{:host{display:block}.hide-editor-toolbar .esri-editor__panel-toolbar{display:none!important}.esri-editor__panel-content{padding-block:0px!important}.esri-editor .esri-item-list__group__header,.esri-editor__panel-content__section .esri-widget__heading{display:none!important}.esri-editor .esri-item-list__filter-container--sticky{padding-block:0px!important;padding-inline:10px!important}.search-widget{width:92%!important;margin:5px 14px 20px}.display-none{display:none!important}.hide-map{height:1%!important;visibility:hidden;position:static!important}.show-map{padding:10px!important;position:absolute!important;bottom:0;height:auto!important;width:calc(100% - 22px)}.notice-msg{padding:10px;width:calc(100% - 20px)}.edit-location-btn{margin:5px;display:flex}.esri-editor__panel-content{padding-block:10px!important}.image-preview-container{padding:10px}.esri-editor{height:auto!important}.height-fit-content{height:fit-content!important}.content-container{padding:1.5rem}.instruction-text{margin-bottom:1.5rem;font-size:1rem}.selected-card{border:2px solid var(--calcite-ui-brand)}.upload-img-footer-container{width:100%;gap:5px;display:grid}.info-container{display:flex;align-items:center;gap:6px;margin-bottom:10px}.info-container calcite-icon{--calcite-icon-color: var(--calcite-color-brand)}.info-container span{font-size:12px;color:var(--calcite-ui-text-3)}.padding-10{padding:10px}.report-selection-container{display:flex;flex-direction:column;padding:10px;--calcite-card-border-color: var(--calcite-color-border-1)}.pb-12{padding-bottom:12px!important}.pt-0{padding-top:0!important}.pt-15{padding-top:15px!important}.option-description-container{display:flex;align-items:center;gap:6px}.cursor-pointer{cursor:pointer;padding:6px 0}.card-body-content{display:flex;flex-direction:row;align-items:center;padding:10px 5px;gap:15px}.text-stack{display:flex;flex-direction:column;gap:2px}.option-title{font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-1);font-size:var(--calcite-font-size--1)}.option-description{color:var(--calcite-ui-text-3);font-size:var(--calcite-font-size--1)}.action-footer{display:flex;justify-content:center;margin-top:16px}.analysis-wrapper{display:flex;flex-direction:column;align-items:center;gap:5px;text-align:center;margin:auto}.analyzing-icon{--calcite-icon-color: var(--calcite-color-brand);animation:sparkle 2s infinite ease-in-out}.adjusted-height{height:30px!important;min-height:auto!important}@keyframes sparkle{0%,to{transform:scale(1)}50%{transform:scale(1.5)}}@media only screen and (max-width:600px){.esri-editor__panel-content{padding-block:0!important;min-height:0!important}}}`, f = "geocodedLocation", D = `Extract the address from the user's message and return it in JSON format '{"address":"<address>"}'. If no address is found, return null.`;
22
+ class N extends k {
22
23
  constructor() {
23
- super(...arguments), this.customizeSubmit = !1, this.enableSearch = !1, this.enableSnapping = !1, this.floorLevel = "", this.isMobile = !1, this.selectedLayerId = "", this.showGuidingMsg = !0, this.submitNewReportsMessage = "", this.updateMapPosition = !1, this.reportingArea = !1, this.reportingAreaLayer = "", this.reportingAreaMessage = "", this.showSketchWidgets = !1, this.allowMultipleCreation = !1, this.popupEnabled = !1, this.showLayerVisibilityMsg = !1, this.enablePhotoLocation = !1, this._currentPage = "templatePicker", this._showSearchComponent = this.enableSearch, this._layerInfos = [], this._inValidGeometryDrawn = !1, this._selectedImageBase64 = "", this._analysisFailed = !1, this._translations = I({ name: "create-feature", blocking: !0 }), this._addingAttachment = !1, this._uploadedImage = null, this._calciteNotice = p(), this._editor = p(), this._isSubmitBtnClicked = !1, this._mapViewContainer = p(), this._searchRef = p(), this._inputImageForAI = p(), this._guidingMessageRefNode = p(), this._abortController = new AbortController(), this.success = c(), this.fail = c(), this.drawComplete = c(), this.editingLocation = c(), this.editingAttachment = c(), this.progressStatus = c(), this.modeChanged = c(), this.activeFeatureCountChange = c();
24
+ super(...arguments), this.customizeSubmit = !1, this.enableSearch = !1, this.enableSnapping = !1, this.floorLevel = "", this.isMobile = !1, this.selectedLayerId = "", this.showGuidingMsg = !0, this.submitNewReportsMessage = "", this.updateMapPosition = !1, this.reportingArea = !1, this.reportingAreaLayer = "", this.reportingAreaMessage = "", this.showSketchWidgets = !1, this.allowMultipleCreation = !1, this.popupEnabled = !1, this.showLayerVisibilityMsg = !1, this.enablePhotoLocation = !1, this.enableMessageLocation = !1, this._currentPage = "templatePicker", this._showSearchComponent = this.enableSearch, this._layerInfos = [], this._inValidGeometryDrawn = !1, this._selectedImageBase64 = "", this._enteredMessage = "", this._analysisFailed = !1, this._translations = A({ name: "create-feature", blocking: !0 }), this._addingAttachment = !1, this._uploadedImage = null, this._calciteNotice = u(), this._editor = u(), this._isSubmitBtnClicked = !1, this._mapViewContainer = u(), this._searchRef = u(), this._inputImageForAI = u(), this._guidingMessageRefNode = u(), this._abortController = new AbortController(), this.success = c(), this.fail = c(), this.drawComplete = c(), this.editingLocation = c(), this.editingAttachment = c(), this.progressStatus = c(), this.modeChanged = c(), this.activeFeatureCountChange = c();
24
25
  }
25
26
  static {
26
- this.properties = { appName: 1, customizeSubmit: 5, enableSearch: 5, enableSnapping: 5, floorLevel: 1, formElements: 1, isMobile: 5, mapView: 0, searchConfiguration: 0, selectedLayerId: 1, showGuidingMsg: 5, submitNewReportsMessage: 1, updateMapPosition: 5, reportingArea: 5, reportingAreaLayer: 1, reportingAreaMessage: 1, showSketchWidgets: 5, allowMultipleCreation: 5, popupEnabled: 5, showLayerVisibilityMsg: 5, enablePhotoLocation: 5, aiImageExtraction: 0, _currentPage: 16, _showSearchComponent: 16, _layerInfos: 16, _inValidGeometryDrawn: 16, _selectedImageBase64: 16, _analysisFailed: 16, _updatedMapView: 16, _translations: 16 };
27
+ this.properties = { appName: 1, customizeSubmit: 5, enableSearch: 5, enableSnapping: 5, floorLevel: 1, formElements: 1, isMobile: 5, mapView: 0, searchConfiguration: 0, selectedLayerId: 1, showGuidingMsg: 5, submitNewReportsMessage: 1, updateMapPosition: 5, reportingArea: 5, reportingAreaLayer: 1, reportingAreaMessage: 1, showSketchWidgets: 5, allowMultipleCreation: 5, popupEnabled: 5, showLayerVisibilityMsg: 5, enablePhotoLocation: 5, enableMessageLocation: 5, aiImageExtraction: 0, aiTextExtraction: 0, _currentPage: 16, _showSearchComponent: 16, _layerInfos: 16, _inValidGeometryDrawn: 16, _selectedImageBase64: 16, _enteredMessage: 16, _analysisFailed: 16, _updatedMapView: 16, _translations: 16 };
27
28
  }
28
29
  static {
29
- this.styles = T;
30
+ this.styles = H;
30
31
  }
31
32
  static {
32
- this.shadowRootOptions = x;
33
+ this.shadowRootOptions = L;
33
34
  }
34
35
  willUpdate(e) {
35
36
  e.has("mapView") && this.hasUpdated && this.mapViewWatchHandler(), e.has("isMobile") && this.hasUpdated && this.isMobileHandler(), e.has("enableSearch") && this.hasUpdated && this.searchHandler(), e.has("searchConfiguration") && this.hasUpdated && this.searchConfigurationHandler(this.searchConfiguration, e.get("searchConfiguration"));
@@ -79,18 +80,18 @@ class H extends M {
79
80
  super.disconnectedCallback(), this._editor.value && (this._editor.value.destroy(), this.enableSnapping && this.mapView?.ui.view && (this.mapView.ui.view.grid = null), this._removeHandlers());
80
81
  }
81
82
  render() {
82
- const e = this._currentPage === "loading" ? "" : "display-none", t = this.isMobile && this.updateMapPosition ? "show-map" : "display-none", i = this._inValidGeometryDrawn ? "danger" : "success", a = this._inValidGeometryDrawn ? "exclamation-mark-triangle" : "lightbulb", s = this.showLayerVisibilityMsg && this._currentPage === "templatePicker", r = (this.showGuidingMsg || s) && this._currentPage !== "loading" && this._currentPage !== "drawingMultipleFeatures";
83
+ const e = this._currentPage === "loading" ? "" : "display-none", t = this.isMobile && this.updateMapPosition ? "show-map" : "display-none", i = this._inValidGeometryDrawn ? "danger" : "success", a = this._inValidGeometryDrawn ? "exclamation-mark-triangle" : "lightbulb", s = this.showLayerVisibilityMsg && this._currentPage === "templatePicker", n = (this.showGuidingMsg || s) && this._currentPage !== "loading" && this._currentPage !== "drawingMultipleFeatures";
83
84
  let o = this._translations.chooseCategoryMsg;
84
- const n = this._aiAnalysisInfo?.results?.filter((g) => !g.success), h = n?.length ? !0 : this._analysisFailed, d = this._getAnalysisErrorMessage(n?.length), u = this._aiAnalysisInfo?.canUseAI && ["chooseReportType", "analyzingImage", "imageUpload", "messageInput"].includes(this._currentPage);
85
- return this._inValidGeometryDrawn ? o = this.reportingAreaMessage || this._translations.reportOutsideAreaMessage : this._currentPage === "drawing" || this._currentPage === "editing" ? o = this._translations.provideLocationMsg : this._currentPage === "featureForm" ? o = this._aiAnalysisInfo?.results?.filter((g) => g.success).length ? this._translations.formReviewMsg : this._translations.provideDetailsMsg : s && (o = this._translations.enableFeatureTemplatesMessage), l`${h && l`<calcite-alert auto-close icon=x-octagon kind=danger label @calciteAlertClose=${() => {
85
+ const r = this._aiAnalysisInfo?.results?.filter((p) => !p.success && p.key !== f), h = r?.length ? !0 : this._analysisFailed, d = this._getAnalysisErrorMessage(r?.length), g = this._aiAnalysisInfo?.canUseAI && ["chooseReportType", "analyzingImage", "analyzingMessage", "imageUpload", "messageInput"].includes(this._currentPage);
86
+ return this._inValidGeometryDrawn ? o = this.reportingAreaMessage || this._translations.reportOutsideAreaMessage : this._currentPage === "drawing" || this._currentPage === "editing" ? o = this._translations.provideLocationMsg : this._currentPage === "featureForm" ? o = this._aiAnalysisInfo?.results?.filter((p) => p.success).length ? this._analysisMode === "text" ? this._translations.textReviewMsg : this._translations.formReviewMsg : this._translations.provideDetailsMsg : s && (o = this._translations.enableFeatureTemplatesMessage), l`${h && l`<calcite-alert auto-close icon=x-octagon kind=danger label @calciteAlertClose=${() => {
86
87
  this._analysisFailed = !1;
87
- }} open placement=top><div slot=title>${this._translations.error}</div><div slot=message>${d}</div></calcite-alert>` || ""}${u && l`<calcite-panel>${this._currentPage === "chooseReportType" && this._getReportTypePage() || ""}${this._currentPage === "imageUpload" && this._aiImageExtractionPage() || ""}${this._currentPage === "analyzingImage" && this._getAnalyzingImagePage() || ""}</calcite-panel>` || ""}${!u && l`${r && l`<calcite-notice class="notice-msg" .icon=${a} .kind=${i} open ${m(this._calciteNotice)}><div slot=message .innerHTML=${o ?? ""} ${m(this._guidingMessageRefNode)}></div></calcite-notice>` || ""}${this._selectedImageBase64 && this._currentPage === "featureForm" && l`<div class="image-preview-container"><calcite-label>${this._translations.photo}</calcite-label><img class="width-full" src=${this._selectedImageBase64 ?? f}></div>` || ""}<calcite-loader class=${w(e)} label scale=s></calcite-loader>${this._currentPage === "featureForm" && this.isMobile && l`<calcite-button appearance=transparent class="edit-location-btn" icon-start=pin @click=${this.editLocation}>${this._translations.editLocationLabel}</calcite-button>` || ""}${this._showSearchComponent && this._updatedMapView && this._selectedLayer && this._getSearchComponent() || ""}${this._updatedMapView && this._selectedLayer && this._getEditor() || ""}` || ""}<div class=${w(t)} ${m(this._mapViewContainer)}></div>`;
88
+ }} open placement=top><div slot=title>${this._translations.error}</div><div slot=message>${d}</div></calcite-alert>` || ""}${g && l`<calcite-panel>${this._currentPage === "chooseReportType" && this._getReportTypePage() || ""}${this._currentPage === "imageUpload" && this._aiImageExtractionPage() || ""}${this._currentPage === "messageInput" && this._aiTextExtractionPage() || ""}${this._currentPage === "analyzingImage" && this._getAnalyzingImagePage() || ""}${this._currentPage === "analyzingMessage" && this._getAnalyzingMessagePage() || ""}</calcite-panel>` || ""}${!g && l`${n && l`<calcite-notice class="notice-msg" .icon=${a} .kind=${i} open ${m(this._calciteNotice)}><div slot=message .innerHTML=${o ?? ""} ${m(this._guidingMessageRefNode)}></div></calcite-notice>` || ""}${this._selectedImageBase64 && this._currentPage === "featureForm" && l`<div class="image-preview-container"><calcite-label>${this._translations.photo}</calcite-label><img class="width-full" src=${this._selectedImageBase64 ?? _}></div>` || ""}<calcite-loader class=${v(e)} label scale=s></calcite-loader>${this._currentPage === "featureForm" && this.isMobile && l`<calcite-button appearance=transparent class="edit-location-btn" icon-start=pin @click=${this.editLocation}>${this._translations.editLocationLabel}</calcite-button>` || ""}${this._showSearchComponent && this._updatedMapView && this._selectedLayer && this._getSearchComponent() || ""}${this._updatedMapView && this._selectedLayer && this._getEditor() || ""}` || ""}<div class=${v(t)} ${m(this._mapViewContainer)}></div>`;
88
89
  }
89
90
  async init() {
90
91
  this.mapView && this.selectedLayerId && (this._updatedMapView = this.mapView, await (this.isMobile && this.updateMapPosition ? this.createMobileMapView() : this._loadLayerInfos()));
91
92
  }
92
93
  async createMobileMapView() {
93
- this._mapViewContainer.value && this.mapView && (this._mapViewContainer.value.classList.add("hide-map"), await new P({
94
+ this._mapViewContainer.value && this.mapView && (this._mapViewContainer.value.classList.add("hide-map"), await new V({
94
95
  map: this.mapView.map,
95
96
  container: this._mapViewContainer.value,
96
97
  zoom: this.mapView.zoom,
@@ -105,7 +106,7 @@ class H extends M {
105
106
  }));
106
107
  }
107
108
  async _loadLayerInfos() {
108
- const e = [], t = this._updatedMapView && await v(this._updatedMapView), i = this.mapView && await y(this.mapView, this.selectedLayerId);
109
+ const e = [], t = this._updatedMapView && await I(this._updatedMapView), i = this.mapView && await w(this.mapView, this.selectedLayerId);
109
110
  i && (this._selectedLayer = i, !this._selectedLayer.isTable && t && t.forEach((a) => {
110
111
  e.push({
111
112
  layer: a,
@@ -117,10 +118,12 @@ class H extends M {
117
118
  })), this._layerInfos = e;
118
119
  }
119
120
  _getReportTypePage() {
120
- const e = this._hasImageExtraction();
121
- return l`<div class="report-selection-container"><calcite-label class="pb-12">${this._translations.createReportHeading}</calcite-label>${e && l`<calcite-card class="cursor-pointer" @click=${() => {
122
- this.progressStatus.emit(35), this._currentPage = "imageUpload";
123
- }}><div slot=description class="card-body-content"><calcite-icon aria-hidden=true icon=effects scale=m style="color: var(--calcite-ui-text-2)"></calcite-icon><div class="text-stack"><span class="option-title">${this._translations.aiImgExtractionLabel}</span><span class="option-description">${this._translations.aiAssistantDescription}</span></div></div></calcite-card>` || ""}<calcite-card class="cursor-pointer pt-0" @click=${() => {
121
+ const e = this._hasImageExtraction(), t = this._hasTextExtraction();
122
+ return l`<div class="report-selection-container"><calcite-label class="pb-12">${this._translations.createReportHeading}</calcite-label><div class="option-description-container"><span class="option-description">${this._translations.aiAssistedReport}</span><calcite-icon icon=effects scale=s></calcite-icon></div>${t && l`<calcite-card class="cursor-pointer pt-0" @click=${() => {
123
+ this._analysisMode = "text", this.progressStatus.emit(35), this._currentPage = "messageInput";
124
+ }}><div slot=description class="card-body-content"><calcite-icon icon=speech-bubble scale=m></calcite-icon><div class="text-stack"><span class="option-title">${this._translations.useDescription}</span><span class="option-description">${this._translations.aiTextAssistantDescription}</span></div></div></calcite-card>` || ""}${e && l`<calcite-card class="cursor-pointer" @click=${() => {
125
+ this._analysisMode = "image", this.progressStatus.emit(35), this._currentPage = "imageUpload";
126
+ }}><div slot=description class="card-body-content"><calcite-icon aria-hidden=true icon=camera scale=m style="color: var(--calcite-ui-text-2)"></calcite-icon><div class="text-stack"><span class="option-title">${this._translations.usePhoto}</span><span class="option-description">${this._translations.aiAssistantDescription}</span></div></div></calcite-card>` || ""}<span class="option-description pt-15">${this._translations.manualReport}</span><calcite-card class="cursor-pointer pt-0" @click=${() => {
124
127
  this._currentPage = "templatePicker", this.init();
125
128
  }}><div slot=description class="card-body-content"><calcite-icon aria-hidden=true icon=pencil scale=m></calcite-icon><div class="text-stack"><span class="option-title">${this._translations.fillOutManually}</span><span class="option-description">${this._translations.startBlank}</span></div></div></calcite-card></div>`;
126
129
  }
@@ -133,13 +136,24 @@ class H extends M {
133
136
  }
134
137
  _aiImageExtractionPage() {
135
138
  const e = this._selectedImageBase64 !== "", t = e ? this._translations.replaceImage : this._translations.imageUploadLimitHint;
136
- return l`<calcite-notice class="notice-msg" icon=effects kind=brand open><div slot=message>${this._translations.aiAssistantProcessingHint}</div></calcite-notice><div class="padding-10"><calcite-label><div>${this._translations.photo}<span style="color: var(--calcite-color-status-danger)">*</span></div><calcite-input type=file accept="image/*;capture=camera" @calciteInputInput=${this._onImageUpload} ${m(this._inputImageForAI)}></calcite-input></calcite-label><div class="info-container"><calcite-icon aria-hidden=true icon=information scale=s></calcite-icon><span>${t}</span></div>${e && l`<img alt=${this._translations.photo ?? f} class="width-full" src=${this._selectedImageBase64 ?? f}>` || ""}</div><div slot=footer class="upload-img-footer-container"><calcite-button width=full .disabled=${!e} id=next-btn @click=${this._analyzeImage}>${this._translations.next}</calcite-button><calcite-button width=full appearance=outline kind=brand @click=${() => this.modeChanged.emit()}>${this._translations.cancel}</calcite-button></div>`;
139
+ return l`<calcite-notice class="notice-msg" icon=effects kind=brand open><div slot=message>${this._translations.aiAssistantProcessingHint}</div></calcite-notice><div class="padding-10"><calcite-label><div>${this._translations.photo}<span style="color: var(--calcite-color-status-danger)">*</span></div><calcite-input type=file accept="image/*;capture=camera" @calciteInputInput=${this._onImageUpload} ${m(this._inputImageForAI)}></calcite-input></calcite-label><div class="info-container"><calcite-icon aria-hidden=true icon=information scale=s></calcite-icon><span>${t}</span></div>${e && l`<img alt=${this._translations.photo ?? _} class="width-full" src=${this._selectedImageBase64 ?? _}>` || ""}</div><div slot=footer class="upload-img-footer-container"><calcite-button width=full .disabled=${!e} id=next-btn @click=${this._analyzeImage}>${this._translations.next}</calcite-button><calcite-button width=full appearance=outline kind=brand @click=${() => this.modeChanged.emit()}>${this._translations.cancel}</calcite-button></div>`;
140
+ }
141
+ _aiTextExtractionPage() {
142
+ const e = this._enteredMessage.trim();
143
+ return l`<calcite-notice class="notice-msg" icon=effects kind=brand open><div slot=message>${this._translations.aiTextProcessingHint}</div></calcite-notice><div class="padding-10"><calcite-label><div>${this._translations.description}<span style="color: var(--calcite-color-status-danger)">*</span></div><calcite-text-area @input=${(t) => {
144
+ this._enteredMessage = t.target.value;
145
+ }} .placeholder=${this._translations.messageInputHint} resize=vertical rows=6 .value=${this._enteredMessage}></calcite-text-area></calcite-label><div class="info-container"><calcite-icon icon=information scale=s></calcite-icon><span>${this._translations.descriptionRequiredHint}</span></div></div><div slot=footer class="upload-img-footer-container"><calcite-button width=full .disabled=${!e} id=next-btn @click=${this._analyzeMessage}>${this._translations.next}</calcite-button><calcite-button width=full appearance=outline kind=brand @click=${() => this.modeChanged.emit()}>${this._translations.cancel}</calcite-button></div>`;
137
146
  }
138
147
  _getAnalyzingImagePage() {
139
148
  return l`<div class="analysis-wrapper"><calcite-label layout=inline><calcite-icon class="analyzing-icon" icon=effects scale=s></calcite-icon><span>${this._translations.analyzingImage}</span></calcite-label><calcite-button class="skip-btn" appearance=transparent @click=${() => {
140
149
  this._abortController.abort(), this._currentPage = "templatePicker";
141
150
  }}>${this._translations.skip}</calcite-button></div>`;
142
151
  }
152
+ _getAnalyzingMessagePage() {
153
+ return l`<div class="analysis-wrapper"><calcite-label layout=inline><calcite-icon class="analyzing-icon" icon=effects scale=s></calcite-icon><span>${this._translations.analyzingText}</span></calcite-label><calcite-button class="skip-btn" appearance=transparent @click=${() => {
154
+ this._abortController.abort(), this._currentPage = "templatePicker";
155
+ }}>${this._translations.skip}</calcite-button></div>`;
156
+ }
143
157
  _onImageUpload(e) {
144
158
  const t = e.target;
145
159
  if (t) {
@@ -157,35 +171,35 @@ class H extends M {
157
171
  return;
158
172
  }
159
173
  try {
160
- this._currentPage = "analyzingImage", this.progressStatus.emit(45);
161
- const i = this._inputImageForAI.value.files[0], a = await new Promise((r, o) => {
162
- const n = new FileReader();
163
- n.onloadend = () => r(n.result), n.onerror = o, this._inputImageForAI.value && n.readAsDataURL(i);
174
+ this._analysisMode = "image", this._currentPage = "analyzingImage", this.progressStatus.emit(45);
175
+ const i = this._inputImageForAI.value.files[0], a = await new Promise((n, o) => {
176
+ const r = new FileReader();
177
+ r.onloadend = () => n(r.result), r.onerror = o, this._inputImageForAI.value && r.readAsDataURL(i);
164
178
  });
165
179
  if (this.enablePhotoLocation) {
166
- const r = await F.gps(i);
167
- if (r?.longitude && r.latitude && this.mapView?.spatialReference) {
168
- const o = new R({
169
- longitude: r.longitude,
170
- latitude: r.latitude,
171
- spatialReference: new U({ wkid: 4326 })
172
- }), n = await k(o, this.mapView.spatialReference);
173
- this._aiAnalysisInfo && (this._aiAnalysisInfo.location = n);
180
+ const n = await R.gps(i);
181
+ if (n?.longitude && n.latitude && this.mapView?.spatialReference) {
182
+ const o = new U({
183
+ longitude: n.longitude,
184
+ latitude: n.latitude,
185
+ spatialReference: new z({ wkid: 4326 })
186
+ }), r = await E(o, this.mapView.spatialReference);
187
+ this._aiAnalysisInfo && (this._aiAnalysisInfo.location = r);
174
188
  }
175
189
  }
176
190
  const s = this._getImageExtractionData();
177
191
  if (s.length) {
178
- const r = {
192
+ const n = {
179
193
  input: a,
180
194
  data: s
181
- }, o = await $(t.imageUrl, {
195
+ }, o = await b(t.imageUrl, {
182
196
  method: "post",
183
197
  headers: {
184
198
  "Content-Type": "application/json",
185
199
  "x-esri-authorization": `Bearer ${t.token}`,
186
200
  "x-esri-request-source": `instantapps/${this.appName}`
187
201
  },
188
- body: JSON.stringify(r),
202
+ body: JSON.stringify(n),
189
203
  responseType: "json",
190
204
  signal: e
191
205
  });
@@ -196,6 +210,42 @@ class H extends M {
196
210
  i.name === "AbortError" ? console.error("Aborted", i) : (this._analysisFailed = !0, console.error("Analyzing failed", i)), this._resetAIAnalysisInfo(), this.init();
197
211
  }
198
212
  }
213
+ async _analyzeMessage() {
214
+ this._abortController = new AbortController();
215
+ const e = this._abortController.signal, t = await this._getAIAnalysisInfo(), i = this._enteredMessage.trim(), a = this._getTextExtractionData();
216
+ let s = { url: "", singleLineFieldName: "" };
217
+ if (this.enableMessageLocation && (s = this._getLocatorConfig(), this._shouldExtractLocationFromText() && s.url && a.push({ key: f, context: D })), !t.canUseAI || !t.textUrl || !i || !a.length) {
218
+ this._analysisFailed = !0, console.error(this._translations.error), this._resetAIAnalysisInfo(), await this.init();
219
+ return;
220
+ }
221
+ try {
222
+ this._analysisMode = "text", this._currentPage = "analyzingMessage", this.progressStatus.emit(45);
223
+ const n = await b(t.textUrl, {
224
+ method: "post",
225
+ headers: {
226
+ "Content-Type": "application/json",
227
+ "x-esri-authorization": `Bearer ${t.token}`,
228
+ "x-esri-request-source": `instantapps/${this.appName}`
229
+ },
230
+ body: JSON.stringify({
231
+ input: i,
232
+ data: a
233
+ }),
234
+ responseType: "json",
235
+ signal: e
236
+ });
237
+ if (this._aiAnalysisInfo && (this._aiAnalysisInfo.results = n.data.results, s.url)) {
238
+ const o = this._getExtractedAddress(n.data.results);
239
+ o && (this._aiAnalysisInfo.location = await this._geocodeExtractedAddress(o, {
240
+ url: s.url,
241
+ singleLineFieldName: s.singleLineFieldName
242
+ }));
243
+ }
244
+ this._currentPage = "loading", await this.init();
245
+ } catch (n) {
246
+ n.name === "AbortError" ? console.error("Aborted", n) : (this._analysisFailed = !0, console.error("Analyzing failed", n)), this._resetAIAnalysisInfo(), this.init();
247
+ }
248
+ }
199
249
  _resetAIAnalysisInfo() {
200
250
  const e = {
201
251
  imageUrl: "",
@@ -205,7 +255,7 @@ class H extends M {
205
255
  location: void 0,
206
256
  results: []
207
257
  };
208
- this._selectedImageBase64 = "", this._aiAnalysisInfo = e;
258
+ this._selectedImageBase64 = "", this._enteredMessage = "", this._aiAnalysisInfo = e;
209
259
  }
210
260
  async _getAIAnalysisInfo() {
211
261
  const e = {
@@ -214,7 +264,7 @@ class H extends M {
214
264
  token: "",
215
265
  canUseAI: !1
216
266
  };
217
- if (this._hasImageExtraction()) {
267
+ if (this._hasImageExtraction() || this._hasTextExtraction()) {
218
268
  const i = (this.mapView?.map).portalItem.portal;
219
269
  if (i) {
220
270
  const a = await i.fetchSettings(), s = i?.helperServices.aiUtilityServices;
@@ -224,7 +274,7 @@ class H extends M {
224
274
  return e;
225
275
  }
226
276
  async queryIntersectingFeatures() {
227
- const e = this.mapView && await y(this.mapView, this.reportingAreaLayer);
277
+ const e = this.mapView && await w(this.mapView, this.reportingAreaLayer);
228
278
  if (e) {
229
279
  const t = e.createQuery();
230
280
  t.geometry = this._drawnGeometry, t.spatialRelationship = "intersects";
@@ -247,14 +297,14 @@ class H extends M {
247
297
  }
248
298
  async _onEditorPropertyChange() {
249
299
  const e = this._editor.value;
250
- e?.state && (this._drawingHandler || (this._drawingHandler = _.watch(() => e.state, async (t) => {
300
+ e?.state && (this._drawingHandler || (this._drawingHandler = y.watch(() => e.state, async (t) => {
251
301
  const i = this._editor.value?.activeWorkflow;
252
302
  t === "creating-features" && i?.formViewModel?.state === "disabled" && (this._mapViewContainer.value?.classList.replace("hide-map", "show-map"), this._selectedLayer && !this._selectedLayer.isTable && (this._currentPage = "drawing", this.progressStatus.emit(50), i?.sketchViewModel?.createGraphic && this._aiAnalysisInfo?.location && (await this._updatedMapView?.goTo({ center: this._aiAnalysisInfo.location }), this._selectedLayer.geometryType === "point" && await this._initializeSketchPoint(this._aiAnalysisInfo.location.clone()))), this.isMobile && this._adjustPanelContentHeight()), t === "adding-attachment" || t === "editing-attachment" ? (this._addingAttachment = !0, this.editingAttachment.emit(!0)) : this._addingAttachment && (this.editingAttachment.emit(!1), this._addingAttachment = !1);
253
- })), this._featureFormHandler || (this._featureFormHandler = _.watch(() => e.activeWorkflow?.formViewModel?.state, (t) => {
303
+ })), this._featureFormHandler || (this._featureFormHandler = y.watch(() => e.activeWorkflow?.formViewModel?.state, (t) => {
254
304
  t === "ready" && this._currentPage !== "editing" ? (this._mapViewContainer.value?.classList?.replace("show-map", "hide-map"), e.activeWorkflow?.formViewModel?.addHandles(e.activeWorkflow?.formViewModel?.on("submit", this.submitted.bind(this))), setTimeout(() => {
255
305
  this._setFloorLevel(this.floorLevel), this._aiAnalysisInfo?.results && this._setAttributeValuesFromAIAnalysis();
256
306
  }, 500), !this.allowMultipleCreation && this._editor.value?.activeWorkflow && (this._editor.value.activeWorkflow.data.creationInfo.maxFeatures = 1), this._currentPage = "featureForm", this.progressStatus.emit(100), this.drawComplete.emit(!1)) : t === "disabled" && this.allowMultipleCreation && this._currentPage !== "editing" && (this._currentPage = "drawingMultipleFeatures");
257
- })), this.allowMultipleCreation && e.activeWorkflow && (this._activeFeatureCountHandler || (this._activeFeatureCountHandler = _.watch(() => e.activeWorkflow?.data?.viewModel?.activeFeatureCount, (t) => {
307
+ })), this.allowMultipleCreation && e.activeWorkflow && (this._activeFeatureCountHandler || (this._activeFeatureCountHandler = y.watch(() => e.activeWorkflow?.data?.viewModel?.activeFeatureCount, (t) => {
258
308
  t === 0 && (this._currentPage = "drawing"), this.activeFeatureCountChange.emit(t);
259
309
  }))), await this.hideEditorsElements());
260
310
  }
@@ -273,6 +323,8 @@ class H extends M {
273
323
  }, 50);
274
324
  }
275
325
  async searchComplete(e) {
326
+ if (!e?.detail?.results?.[0]?.results?.[0]?.feature)
327
+ return;
276
328
  const t = e.detail.results[0].results[0].feature;
277
329
  let i;
278
330
  t && (await this._updatedMapView?.goTo(t.geometry), this._selectedLayer?.geometryType === "point" && t?.geometry && (i = t.geometry));
@@ -297,15 +349,15 @@ class H extends M {
297
349
  const i = "includeDefaultSources", a = e.sources;
298
350
  return a && a?.length > 0 ? (e[i] = !1, a.forEach((s) => {
299
351
  if (s.hasOwnProperty("layer")) {
300
- const o = s, n = o.layer?.id, h = n ? t.map?.findLayerById(n) : "", d = o?.layer?.url;
301
- h ? o.layer = h : d && (o.layer = new L(d));
352
+ const o = s, r = o.layer?.id, h = r ? t.map?.findLayerById(r) : "", d = o?.layer?.url;
353
+ h ? o.layer = h : d && (o.layer = new S(d));
302
354
  }
303
355
  }), a?.forEach((s) => {
304
356
  if (s.hasOwnProperty("locator")) {
305
357
  const o = s;
306
358
  if (o?.name === "ArcGIS World Geocoding Service") {
307
- const n = o.outFields || ["Addr_type", "Match_addr", "StAddr", "City"];
308
- o.outFields = n, o.singleLineFieldName = "SingleLine";
359
+ const r = o.outFields || ["Addr_type", "Match_addr", "StAddr", "City"];
360
+ o.outFields = r, o.singleLineFieldName = "SingleLine";
309
361
  }
310
362
  o.url = o.url, delete o.url;
311
363
  }
@@ -329,7 +381,7 @@ class H extends M {
329
381
  name: "floor-info-test",
330
382
  title: "Floor Info",
331
383
  returnType: "string"
332
- }), r = new S({
384
+ }), n = new P({
333
385
  label: i,
334
386
  editableExpression: "false",
335
387
  fieldName: i,
@@ -341,15 +393,15 @@ class H extends M {
341
393
  valueExpression: s.name
342
394
  });
343
395
  this._updatedMapView?.map.editableLayers.forEach((o) => {
344
- const n = this.formElements.orgElements, h = this.formElements.orgExpressionInfos, d = [...n];
345
- if (d.push(r), o.type === "feature") {
346
- const u = o, g = new V({
347
- title: u?.formTemplate?.title,
348
- description: u?.formTemplate?.description,
396
+ const r = this.formElements.orgElements, h = this.formElements.orgExpressionInfos, d = [...r];
397
+ if (d.push(n), o.type === "feature") {
398
+ const g = o, p = new $({
399
+ title: g?.formTemplate?.title,
400
+ description: g?.formTemplate?.description,
349
401
  elements: d,
350
402
  expressionInfos: [s].concat(h)
351
403
  });
352
- o.formTemplate = g;
404
+ o.formTemplate = p;
353
405
  }
354
406
  });
355
407
  }
@@ -358,7 +410,7 @@ class H extends M {
358
410
  _setAttributeValuesFromAIAnalysis() {
359
411
  this._aiAnalysisInfo?.results && this._aiAnalysisInfo.results.forEach((e) => {
360
412
  const t = this._editor?.value?.activeWorkflow;
361
- t?.formViewModel && e.key && e.success && t.formViewModel.setValue(e.key, e.value);
413
+ t?.formViewModel && e.key && e.key !== f && e.success && t.formViewModel.setValue(e.key, e.value);
362
414
  });
363
415
  }
364
416
  _getImageExtractionData() {
@@ -367,12 +419,60 @@ class H extends M {
367
419
  t?.field && t.prompt && t.id === this.selectedLayerId && e.push({ key: t.field, context: t.prompt });
368
420
  }), e;
369
421
  }
422
+ _getTextExtractionData() {
423
+ const e = [];
424
+ return this.aiTextExtraction?.forEach((t) => {
425
+ t?.field && t.prompt && t.id === this.selectedLayerId && e.push({ key: t.field, context: t.prompt });
426
+ }), e;
427
+ }
370
428
  _hasImageExtraction() {
371
429
  return !!this.aiImageExtraction?.some((e) => e?.field && e.prompt && e.id === this.selectedLayerId);
372
430
  }
431
+ _hasTextExtraction() {
432
+ return !!this.aiTextExtraction?.some((e) => e?.field && e.prompt && e.id === this.selectedLayerId);
433
+ }
434
+ _shouldExtractLocationFromText() {
435
+ return !!this.aiTextExtraction?.some((e) => e.id === this.selectedLayerId);
436
+ }
373
437
  _getAnalysisErrorMessage(e) {
374
438
  const t = this._aiAnalysisInfo?.results?.length || 0;
375
- return e && e === t ? this._translations.imageExtractionError : this._translations.imageExtractionPartialError;
439
+ return this._analysisMode === "text" ? e && e === t ? this._translations.textExtractionError : this._translations.textExtractionPartialError : e && e === t ? this._translations.imageExtractionError : this._translations.imageExtractionPartialError;
440
+ }
441
+ _getExtractedAddress(e) {
442
+ const t = e.find((i) => i.key === f && i.success && i.value !== null);
443
+ if (t) {
444
+ if (typeof t.value == "string")
445
+ return t.value.trim() || void 0;
446
+ if (typeof t.value == "object" && typeof t.value.address == "string")
447
+ return t.value.address.trim() || void 0;
448
+ }
449
+ }
450
+ async _geocodeExtractedAddress(e, t) {
451
+ if (!(!this.mapView?.spatialReference || !e))
452
+ try {
453
+ const a = (await T.addressToLocations(t.url, {
454
+ address: { [t.singleLineFieldName]: e },
455
+ outSpatialReference: this.mapView.spatialReference,
456
+ maxLocations: 1
457
+ }))?.[0]?.location;
458
+ return a || void 0;
459
+ } catch (i) {
460
+ console.error("Address geocoding failed", i);
461
+ return;
462
+ }
463
+ }
464
+ _getLocatorConfig() {
465
+ const e = this.searchConfiguration?.sources?.find((a) => "url" in a && !!a.url);
466
+ if (e?.url)
467
+ return {
468
+ url: e.url,
469
+ singleLineFieldName: e.singleLineFieldName || "SingleLine"
470
+ };
471
+ const t = this.mapView?.map?.portalItem?.portal?.helperServices?.geocode;
472
+ return {
473
+ url: Array.isArray(t) ? t[0]?.url : t?.url,
474
+ singleLineFieldName: "SingleLine"
475
+ };
376
476
  }
377
477
  async hideEditorsElements() {
378
478
  if (!this.customizeSubmit || this._editor.value?.state === "editing-attachment" || this._editor.value?.state === "adding-attachment")
@@ -398,17 +498,17 @@ class H extends M {
398
498
  const s = a.addedFeatures[0].objectId;
399
499
  try {
400
500
  if (this._uploadedImage && this._selectedLayer) {
401
- const r = this._uploadedImage, o = new FormData();
402
- o.set("keywords", "ai-image"), o.set("attachment", r), o.append("f", "json");
403
- const n = new E({
501
+ const n = this._uploadedImage, o = new FormData();
502
+ o.set("keywords", "ai-image"), o.set("attachment", n), o.append("f", "json");
503
+ const r = new F({
404
504
  attributes: {
405
505
  [this._selectedLayer.objectIdField]: s
406
506
  }
407
507
  });
408
- await this._selectedLayer.addAttachment(n, o);
508
+ await this._selectedLayer.addAttachment(r, o);
409
509
  }
410
- } catch (r) {
411
- console.error("Attachment upload failed", r);
510
+ } catch (n) {
511
+ console.error("Attachment upload failed", n);
412
512
  }
413
513
  i?.remove(), this.success.emit();
414
514
  }
@@ -433,7 +533,7 @@ class H extends M {
433
533
  this._drawingHandler?.remove(), this._featureFormHandler?.remove(), this._activeFeatureCountHandler?.remove();
434
534
  }
435
535
  }
436
- b("create-feature", H);
536
+ x("create-feature", N);
437
537
  export {
438
- H as CreateFeature
538
+ N as CreateFeature
439
539
  };
@@ -4,9 +4,10 @@ import "@esri/calcite-components/components/calcite-notice";
4
4
  import "@esri/calcite-components/components/calcite-label";
5
5
  import "@esri/calcite-components/components/calcite-loader";
6
6
  import "@esri/calcite-components/components/calcite-button";
7
- import "@esri/calcite-components/components/calcite-card";
8
7
  import "@esri/calcite-components/components/calcite-icon";
8
+ import "@esri/calcite-components/components/calcite-card";
9
9
  import "@arcgis/map-components/components/arcgis-editor";
10
10
  import "@arcgis/map-components/components/arcgis-search";
11
11
  import "@esri/calcite-components/components/calcite-input";
12
+ import "@esri/calcite-components/components/calcite-text-area";
12
13
  export * from "./customElement.js";
@@ -1,7 +1,7 @@
1
1
  /// <reference path="../../index.d.ts" />
2
2
  import type Graphic from "@arcgis/core/Graphic.js";
3
- import type FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
4
3
  import type MapView from "@arcgis/core/views/MapView.js";
4
+ import type FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
5
5
  import type { PublicLitElement as LitElement } from "@arcgis/lumina";
6
6
  import type { T9nMeta } from "@arcgis/lumina/controllers";
7
7
 
@@ -32,9 +32,9 @@ export abstract class CreateRelatedFeature extends LitElement {
32
32
  * @default false
33
33
  */
34
34
  accessor enableSnapping: boolean;
35
- /** esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html */
35
+ /** esri/views/MapView: https://developers.arcgis.com/javascript/latest/references/core/views/MapView */
36
36
  accessor mapView: MapView | undefined;
37
- /** __esri.Graphic: https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html */
37
+ /** Graphic: https://developers.arcgis.com/javascript/latest/references/core/Graphic */
38
38
  accessor selectedFeature: Graphic | undefined;
39
39
  /**
40
40
  * boolean: When true the notice message should be shown
@@ -42,7 +42,7 @@ export abstract class CreateRelatedFeature extends LitElement {
42
42
  * @default true
43
43
  */
44
44
  accessor showGuidingMsg: boolean | undefined;
45
- /** __esri.FeatureLayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html */
45
+ /** FeatureLayer: https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer */
46
46
  accessor table: FeatureLayer | undefined;
47
47
  /** Submit the comment */
48
48
  submit(): Promise<void>;