@esri/solutions-components 0.10.35 → 0.10.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/dist/cjs/basemap-gallery_7.cjs.entry.js +1 -0
  2. package/dist/cjs/calcite-alert_5.cjs.entry.js +3 -3
  3. package/dist/cjs/card-manager_3.cjs.entry.js +2 -2
  4. package/dist/cjs/crowdsource-manager.cjs.entry.js +25 -29
  5. package/dist/cjs/{downloadUtils-20637f89.js → downloadUtils-76bc7e30.js} +6 -5
  6. package/dist/cjs/feature-list.cjs.entry.js +3 -3
  7. package/dist/cjs/{index.es-a242cb45.js → index.es-8336efed.js} +2 -2
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
  10. package/dist/cjs/{popupUtils-d477705b.js → popupUtils-bc762034.js} +1 -1
  11. package/dist/cjs/public-notification.cjs.entry.js +2 -2
  12. package/dist/cjs/solutions-components.cjs.js +1 -1
  13. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +27 -29
  14. package/dist/collection/components/map-legend/map-legend.js +1 -0
  15. package/dist/collection/utils/downloadUtils.js +5 -3
  16. package/dist/collection/utils/downloadUtils.ts +6 -3
  17. package/dist/collection/utils/test/downloadUtils.spec.tsx +10 -12
  18. package/dist/components/crowdsource-manager.js +26 -29
  19. package/dist/components/downloadUtils.js +5 -4
  20. package/dist/components/map-legend2.js +1 -0
  21. package/dist/esm/basemap-gallery_7.entry.js +1 -0
  22. package/dist/esm/calcite-alert_5.entry.js +3 -3
  23. package/dist/esm/card-manager_3.entry.js +2 -2
  24. package/dist/esm/crowdsource-manager.entry.js +25 -29
  25. package/dist/esm/{downloadUtils-e266e98d.js → downloadUtils-bc7a4ba1.js} +6 -5
  26. package/dist/esm/feature-list.entry.js +3 -3
  27. package/dist/esm/{index.es-c5f258e2.js → index.es-0d189a34.js} +2 -2
  28. package/dist/esm/loader.js +1 -1
  29. package/dist/esm/map-select-tools_3.entry.js +2 -2
  30. package/dist/esm/{popupUtils-4570096e.js → popupUtils-03dc398a.js} +1 -1
  31. package/dist/esm/public-notification.entry.js +2 -2
  32. package/dist/esm/solutions-components.js +1 -1
  33. package/dist/solutions-components/{p-cb3199f9.entry.js → p-04ab956c.entry.js} +1 -1
  34. package/dist/solutions-components/{p-a568af9f.js → p-6f606cdb.js} +1 -1
  35. package/dist/solutions-components/p-720de4db.entry.js +6 -0
  36. package/dist/solutions-components/p-97fe6ec5.entry.js +6 -0
  37. package/dist/solutions-components/{p-b4c49411.entry.js → p-9c4fef09.entry.js} +1 -1
  38. package/dist/solutions-components/{p-89046451.entry.js → p-aac0c89c.entry.js} +1 -1
  39. package/dist/solutions-components/p-cd482a33.js +21 -0
  40. package/dist/solutions-components/{p-b86b2664.entry.js → p-d2612c30.entry.js} +1 -1
  41. package/dist/solutions-components/{p-588adf13.entry.js → p-e345f9c4.entry.js} +1 -1
  42. package/dist/solutions-components/{p-46c8015c.js → p-ff9e28d1.js} +30 -30
  43. package/dist/solutions-components/solutions-components.esm.js +1 -1
  44. package/dist/solutions-components/utils/downloadUtils.ts +6 -3
  45. package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +10 -12
  46. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +4 -7
  47. package/package.json +2 -1
  48. package/dist/solutions-components/p-2360802a.js +0 -21
  49. package/dist/solutions-components/p-5eb9a413.entry.js +0 -6
  50. package/dist/solutions-components/p-ecf642c2.entry.js +0 -6
@@ -3,4 +3,4 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as t,c as i,g as s,h as e}from"./p-4e6eb06e.js";import{l as a,g as h}from"./p-f4aadb3b.js";import{P as n}from"./p-2360802a.js";import{g as l,c as o,h as c}from"./p-d572627c.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-46c8015c.js";import"./p-d0d020a5.js";import"./p-7530a02f.js";import"./p-9bb44f57.js";import"./p-80cb7c73.js";const r=class{constructor(s){t(this,s),this.featureSelect=i(this,"featureSelect",7),this.selectedLayerId=void 0,this.mapView=void 0,this.noFeaturesFoundMsg=void 0,this.pageSize=100,this.highlightOnMap=!1,this.highlightOnHover=!1,this.sortingInfo=void 0,this.whereClause=void 0,this.textSize="large",this.showInitialLoading=!0,this.showErrorWhenNoFeatures=!0,this.showUserImageInList=!1,this.showFeatureSymbol=!1,this.applyLayerViewFilter=!1,this.reportingOptions=void 0,this._featureItems=[],this._featuresCount=0,this._isLoading=!1,this._translations=void 0}get el(){return s(this)}Color;esriConfig;symbolUtils;_popupUtils;_selectedLayer;_highlightHandle;_highlights;_pagination;_validFieldTypes=["small-integer","integer","big-integer","single","long"];_abbreviatedLikeCount;_likeFieldAvailable=!1;async selectedLayerWatchHandler(){this._selectedLayer=await l(this.mapView,this.selectedLayerId),await this.initializeFeatureItems()}async sortingInfoWatchHandler(){await this.initializeFeatureItems()}async whereClauseHandler(){await this.initializeFeatureItems()}async refresh(t){if(t&&this._pagination){const t={target:{startItem:this._pagination.startItem}};await this.pageChanged(t)}else await this.initializeFeatureItems()}featureSelect;async componentWillLoad(){await this.initModules(),await this._getTranslations(),this._isLoading=this.showInitialLoading,this._popupUtils=new n,this.mapView&&this.selectedLayerId&&(this._selectedLayer=await l(this.mapView,this.selectedLayerId))}async componentDidLoad(){await this.initializeFeatureItems()}render(){return e("calcite-panel",{key:"59289a87561105e3edcbd52bac96b974b1387a16","full-height":!0,"full-width":!0},this._isLoading&&e("calcite-loader",{key:"59629285e49227209761d2f16bdd62a90750538f",label:"",scale:"m"}),this.showErrorWhenNoFeatures&&0===this._featureItems.length&&!this._isLoading&&e("calcite-notice",{key:"bc6c2e6e0fdf959374caf79f2027784e2fdaca15",class:"error-msg",icon:"feature-details",kind:"info",open:!0},e("div",{key:"052207ce0b0e2d8030ac7a4a7985c718371a9667",slot:"message"},this.noFeaturesFoundMsg?this.noFeaturesFoundMsg:this._translations.featureErrorMsg)),e("calcite-list",{key:"3f17ea85f2265717aa13c9c71f19c259470c9fcc","selection-appearance":"border","selection-mode":"none"},!this._isLoading&&this._featureItems.length>0&&this._featureItems),this._featuresCount>this.pageSize&&e("div",{key:"ce3179bcdc7af254488dea909034c58db17ec565",class:"width-full",slot:"footer"},e("calcite-pagination",{key:"d6a4b8c7a940918388b3b9891a666c4a142edae7",class:"pagination","full-width":!0,onCalcitePaginationChange:this.pageChanged.bind(this),"page-size":this.pageSize,ref:t=>this._pagination=t,"start-item":"1","total-items":this._featuresCount})))}async initModules(){const[t,i,s]=await a(["esri/Color","esri/config","esri/symbols/support/symbolUtils"]);this.Color=t,this.esriConfig=i,this.symbolUtils=s}async getWhereCondition(){let t="1=1";if(this.whereClause&&(t=this.whereClause),this._selectedLayer?.definitionExpression&&(t=t+" AND "+this._selectedLayer.definitionExpression),this.applyLayerViewFilter){const i=await o(this.mapView,this.selectedLayerId);i?.filter?.where&&(t=t+" AND "+i.filter.where)}return t}async initializeFeatureItems(){if(this._selectedLayer){this._pagination?.goTo("start"),this._isLoading=this.showInitialLoading,this._featureItems=await this.queryPage(0);const t={where:await this.getWhereCondition()};this._featuresCount=await this._selectedLayer.queryFeatureCount(t),this._isLoading=!1}}async pageChanged(t){this._isLoading=!0,this._highlightHandle&&(this._highlightHandle.remove(),this._highlightHandle=null);const i=t.target.startItem-1;this._featureItems=await this.queryPage(i),this._isLoading=!1}async featureClicked(t,i){if(this.clearHighlights(),this.highlightOnMap){const i=Number(t.target.value),s=await o(this.mapView,this.selectedLayerId);this._highlightHandle=await c([i],s,this.mapView,!0)}await this.emitSelectedFeature(i)}async emitSelectedFeature(t){const i=t.layer,s=i.createQuery();s.returnGeometry=!0,s.objectIds=[t.getObjectId()];const e=await i.queryFeatures(s);this.featureSelect.emit(e.features[0])}async onFeatureHover(t){if(this.clearHighlights(),this.highlightOnHover){const i=t.getObjectId(),s=await o(this.mapView,this.selectedLayerId);this._highlights&&(s.highlights=JSON.parse(this._highlights)),s.highlightOptions={color:new this.Color("#FFFF00")},this._highlights=JSON.stringify(s.highlights),this._highlightHandle=s.highlight([i])}}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}async queryPage(t){const i=this._selectedLayer,s=this.sortingInfo?.field?this.sortingInfo.field:i.objectIdField,e=this.sortingInfo?.order?this.sortingInfo.order:"desc",a=await this.getWhereCondition(),h={start:t,num:this.pageSize,outFields:["*"],returnGeometry:!0,where:a,outSpatialReference:this.mapView.spatialReference.toJSON()};s&&e&&(h.orderByFields=[s.toString()+" "+e]);const n=await i.queryFeatures(h);return await this.createFeatureItem(n)}async createFeatureItem(t){const i=t?.features,s=this.reportingOptions&&this.reportingOptions[this.selectedLayerId].like,e=i.map((async t=>{const i=await this._popupUtils.getPopupTitle(t,this.mapView.map);let e,a;if(this.showUserImageInList){const i=this._selectedLayer.editFieldsInfo?.creatorField;i&&(e=await this.getUserInformation(t))}return this.showFeatureSymbol&&(a=await this.getFeatureSymbol(t)),s&&this.getAbbreviatedLikeCount(t),this.getFeatureItem(t,i,a,e)}));return Promise.all(e)}getAbbreviatedLikeCount(t){const i=this._selectedLayer,s=this.reportingOptions[i.id].likeField;i.fields.forEach((e=>{if(this._validFieldTypes.indexOf(e.type)>-1&&e.name===s&&this.reportingOptions[i.id].like){this._likeFieldAvailable=!0;let i=t.attributes[s]||0;i>999&&(i=i>999999?this._translations.millionsAbbreviation.replace("{{abbreviated_value}}",Math.floor(i/1e6).toString()):this._translations.thousandsAbbreviation.replace("{{abbreviated_value}}",Math.floor(i/1e3).toString())),this._abbreviatedLikeCount=i}}))}getFeatureItem(t,i,s,a){const h=t.attributes[this._selectedLayer.objectIdField].toString();i=i??h;const n=Number(t.attributes[this.reportingOptions?.[this._selectedLayer.id].likeField]).toLocaleString(),l="small"===this.textSize?"feature-list-popup-title-small":"feature-list-popup-title",o=this.showUserImageInList||this.showFeatureSymbol?"feature-list-popup-title-padding-reduced":"feature-list-popup-title-padding";return e("calcite-list-item",{onCalciteListItemSelect:i=>{this.featureClicked(i,t)},onMouseLeave:()=>{this.clearHighlights()},onMouseOver:()=>{this.onFeatureHover(t)},value:h},this.showUserImageInList&&e("calcite-avatar",{class:"profile-img","full-name":a?.fullName,scale:"m",slot:"content-start",thumbnail:a?.userProfileUrl,userId:a?.id,username:a?.fullName?a.username:void 0}),this.showFeatureSymbol&&e("div",{class:"feature-symbol",ref:t=>t&&t.replaceChildren(s),slot:"content-start"}),e("div",{class:`${l} ${o}`,slot:"content-start"},i),this._likeFieldAvailable&&e("div",{class:"like-container",id:h.concat("like"),slot:"content-end"},e("span",null,this._abbreviatedLikeCount),e("calcite-icon",{icon:"thumbs-up",scale:"s"}),e("calcite-tooltip",{overlayPositioning:"fixed",placement:"top","reference-element":h.concat("like")},n)),e("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}async getUserInformation(t){let i=this._selectedLayer.editFieldsInfo?.creatorField;t.attributes.hasOwnProperty(i.toLowerCase())?i=i.toLowerCase():t.attributes.hasOwnProperty(i.toUpperCase())&&(i=i.toUpperCase());let s=`${this.esriConfig.portalUrl}/sharing/rest/community/users/${t.attributes[i]}?f=json&returnUserLicensedItems=true`;const e=this.mapView.map.portalItem.portal?.credential?.token;e&&(s+=`&token=${e}`);const a=await fetch(s),h=await a.json();let n=`${this.esriConfig.portalUrl}/sharing/rest/community/users/${h?.username??t.attributes[i]}/info/blob.png`;return h?.access&&e&&(n+=`?token=${e}`),h.userProfileUrl=n,h}async getFeatureSymbol(t){const i=document.createElement("div");return await this.symbolUtils.getDisplayedSymbol(t).then((async t=>{if(t&&await(this.symbolUtils?.renderPreviewHTML(t,{node:i})),i.children?.length){const t=i.children[0];if(t){const i=Number(t.getAttribute("height")),s=Number(t.getAttribute("width"));s>30?t.setAttribute("width","30"):s<19&&t.setAttribute("width","20"),t.setAttribute("viewBox",`0 0 ${s} ${i}`)}}})),i}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}static get watchers(){return{selectedLayerId:["selectedLayerWatchHandler"],sortingInfo:["sortingInfoWatchHandler"],whereClause:["whereClauseHandler"]}}};r.style=":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.feature-list-popup-title{font-weight:500;white-space:pre-line}.feature-list-popup-title-small{font-size:small;white-space:pre-line}.feature-list-popup-title-padding{padding:10px 12px}.feature-list-popup-title-padding-reduced{padding:10px 0}.profile-img{margin:0 0.75rem;min-width:32px}.like-container{display:flex;align-items:center;gap:5px;color:gray !important;font-style:italic}.feature-symbol{padding:3px 10px;min-width:30px;display:flex;justify-content:center}";export{r as feature_list}
6
+ import{r as t,c as i,g as s,h as e}from"./p-4e6eb06e.js";import{l as a,g as h}from"./p-f4aadb3b.js";import{P as n}from"./p-cd482a33.js";import{g as l,c as o,h as r}from"./p-d572627c.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-ff9e28d1.js";import"./p-7530a02f.js";import"./p-d0d020a5.js";import"./p-9bb44f57.js";import"./p-80cb7c73.js";const c=class{constructor(s){t(this,s),this.featureSelect=i(this,"featureSelect",7),this.selectedLayerId=void 0,this.mapView=void 0,this.noFeaturesFoundMsg=void 0,this.pageSize=100,this.highlightOnMap=!1,this.highlightOnHover=!1,this.sortingInfo=void 0,this.whereClause=void 0,this.textSize="large",this.showInitialLoading=!0,this.showErrorWhenNoFeatures=!0,this.showUserImageInList=!1,this.showFeatureSymbol=!1,this.applyLayerViewFilter=!1,this.reportingOptions=void 0,this._featureItems=[],this._featuresCount=0,this._isLoading=!1,this._translations=void 0}get el(){return s(this)}Color;esriConfig;symbolUtils;_popupUtils;_selectedLayer;_highlightHandle;_highlights;_pagination;_validFieldTypes=["small-integer","integer","big-integer","single","long"];_abbreviatedLikeCount;_likeFieldAvailable=!1;async selectedLayerWatchHandler(){this._selectedLayer=await l(this.mapView,this.selectedLayerId),await this.initializeFeatureItems()}async sortingInfoWatchHandler(){await this.initializeFeatureItems()}async whereClauseHandler(){await this.initializeFeatureItems()}async refresh(t){if(t&&this._pagination){const t={target:{startItem:this._pagination.startItem}};await this.pageChanged(t)}else await this.initializeFeatureItems()}featureSelect;async componentWillLoad(){await this.initModules(),await this._getTranslations(),this._isLoading=this.showInitialLoading,this._popupUtils=new n,this.mapView&&this.selectedLayerId&&(this._selectedLayer=await l(this.mapView,this.selectedLayerId))}async componentDidLoad(){await this.initializeFeatureItems()}render(){return e("calcite-panel",{key:"59289a87561105e3edcbd52bac96b974b1387a16","full-height":!0,"full-width":!0},this._isLoading&&e("calcite-loader",{key:"59629285e49227209761d2f16bdd62a90750538f",label:"",scale:"m"}),this.showErrorWhenNoFeatures&&0===this._featureItems.length&&!this._isLoading&&e("calcite-notice",{key:"bc6c2e6e0fdf959374caf79f2027784e2fdaca15",class:"error-msg",icon:"feature-details",kind:"info",open:!0},e("div",{key:"052207ce0b0e2d8030ac7a4a7985c718371a9667",slot:"message"},this.noFeaturesFoundMsg?this.noFeaturesFoundMsg:this._translations.featureErrorMsg)),e("calcite-list",{key:"3f17ea85f2265717aa13c9c71f19c259470c9fcc","selection-appearance":"border","selection-mode":"none"},!this._isLoading&&this._featureItems.length>0&&this._featureItems),this._featuresCount>this.pageSize&&e("div",{key:"ce3179bcdc7af254488dea909034c58db17ec565",class:"width-full",slot:"footer"},e("calcite-pagination",{key:"d6a4b8c7a940918388b3b9891a666c4a142edae7",class:"pagination","full-width":!0,onCalcitePaginationChange:this.pageChanged.bind(this),"page-size":this.pageSize,ref:t=>this._pagination=t,"start-item":"1","total-items":this._featuresCount})))}async initModules(){const[t,i,s]=await a(["esri/Color","esri/config","esri/symbols/support/symbolUtils"]);this.Color=t,this.esriConfig=i,this.symbolUtils=s}async getWhereCondition(){let t="1=1";if(this.whereClause&&(t=this.whereClause),this._selectedLayer?.definitionExpression&&(t=t+" AND "+this._selectedLayer.definitionExpression),this.applyLayerViewFilter){const i=await o(this.mapView,this.selectedLayerId);i?.filter?.where&&(t=t+" AND "+i.filter.where)}return t}async initializeFeatureItems(){if(this._selectedLayer){this._pagination?.goTo("start"),this._isLoading=this.showInitialLoading,this._featureItems=await this.queryPage(0);const t={where:await this.getWhereCondition()};this._featuresCount=await this._selectedLayer.queryFeatureCount(t),this._isLoading=!1}}async pageChanged(t){this._isLoading=!0,this._highlightHandle&&(this._highlightHandle.remove(),this._highlightHandle=null);const i=t.target.startItem-1;this._featureItems=await this.queryPage(i),this._isLoading=!1}async featureClicked(t,i){if(this.clearHighlights(),this.highlightOnMap){const i=Number(t.target.value),s=await o(this.mapView,this.selectedLayerId);this._highlightHandle=await r([i],s,this.mapView,!0)}await this.emitSelectedFeature(i)}async emitSelectedFeature(t){const i=t.layer,s=i.createQuery();s.returnGeometry=!0,s.objectIds=[t.getObjectId()];const e=await i.queryFeatures(s);this.featureSelect.emit(e.features[0])}async onFeatureHover(t){if(this.clearHighlights(),this.highlightOnHover){const i=t.getObjectId(),s=await o(this.mapView,this.selectedLayerId);this._highlights&&(s.highlights=JSON.parse(this._highlights)),s.highlightOptions={color:new this.Color("#FFFF00")},this._highlights=JSON.stringify(s.highlights),this._highlightHandle=s.highlight([i])}}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}async queryPage(t){const i=this._selectedLayer,s=this.sortingInfo?.field?this.sortingInfo.field:i.objectIdField,e=this.sortingInfo?.order?this.sortingInfo.order:"desc",a=await this.getWhereCondition(),h={start:t,num:this.pageSize,outFields:["*"],returnGeometry:!0,where:a,outSpatialReference:this.mapView.spatialReference.toJSON()};s&&e&&(h.orderByFields=[s.toString()+" "+e]);const n=await i.queryFeatures(h);return await this.createFeatureItem(n)}async createFeatureItem(t){const i=t?.features,s=this.reportingOptions&&this.reportingOptions[this.selectedLayerId].like,e=i.map((async t=>{const i=await this._popupUtils.getPopupTitle(t,this.mapView.map);let e,a;if(this.showUserImageInList){const i=this._selectedLayer.editFieldsInfo?.creatorField;i&&(e=await this.getUserInformation(t))}return this.showFeatureSymbol&&(a=await this.getFeatureSymbol(t)),s&&this.getAbbreviatedLikeCount(t),this.getFeatureItem(t,i,a,e)}));return Promise.all(e)}getAbbreviatedLikeCount(t){const i=this._selectedLayer,s=this.reportingOptions[i.id].likeField;i.fields.forEach((e=>{if(this._validFieldTypes.indexOf(e.type)>-1&&e.name===s&&this.reportingOptions[i.id].like){this._likeFieldAvailable=!0;let i=t.attributes[s]||0;i>999&&(i=i>999999?this._translations.millionsAbbreviation.replace("{{abbreviated_value}}",Math.floor(i/1e6).toString()):this._translations.thousandsAbbreviation.replace("{{abbreviated_value}}",Math.floor(i/1e3).toString())),this._abbreviatedLikeCount=i}}))}getFeatureItem(t,i,s,a){const h=t.attributes[this._selectedLayer.objectIdField].toString();i=i??h;const n=Number(t.attributes[this.reportingOptions?.[this._selectedLayer.id].likeField]).toLocaleString(),l="small"===this.textSize?"feature-list-popup-title-small":"feature-list-popup-title",o=this.showUserImageInList||this.showFeatureSymbol?"feature-list-popup-title-padding-reduced":"feature-list-popup-title-padding";return e("calcite-list-item",{onCalciteListItemSelect:i=>{this.featureClicked(i,t)},onMouseLeave:()=>{this.clearHighlights()},onMouseOver:()=>{this.onFeatureHover(t)},value:h},this.showUserImageInList&&e("calcite-avatar",{class:"profile-img","full-name":a?.fullName,scale:"m",slot:"content-start",thumbnail:a?.userProfileUrl,userId:a?.id,username:a?.fullName?a.username:void 0}),this.showFeatureSymbol&&e("div",{class:"feature-symbol",ref:t=>t&&t.replaceChildren(s),slot:"content-start"}),e("div",{class:`${l} ${o}`,slot:"content-start"},i),this._likeFieldAvailable&&e("div",{class:"like-container",id:h.concat("like"),slot:"content-end"},e("span",null,this._abbreviatedLikeCount),e("calcite-icon",{icon:"thumbs-up",scale:"s"}),e("calcite-tooltip",{overlayPositioning:"fixed",placement:"top","reference-element":h.concat("like")},n)),e("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}async getUserInformation(t){let i=this._selectedLayer.editFieldsInfo?.creatorField;t.attributes.hasOwnProperty(i.toLowerCase())?i=i.toLowerCase():t.attributes.hasOwnProperty(i.toUpperCase())&&(i=i.toUpperCase());let s=`${this.esriConfig.portalUrl}/sharing/rest/community/users/${t.attributes[i]}?f=json&returnUserLicensedItems=true`;const e=this.mapView.map.portalItem.portal?.credential?.token;e&&(s+=`&token=${e}`);const a=await fetch(s),h=await a.json();let n=`${this.esriConfig.portalUrl}/sharing/rest/community/users/${h?.username??t.attributes[i]}/info/blob.png`;return h?.access&&e&&(n+=`?token=${e}`),h.userProfileUrl=n,h}async getFeatureSymbol(t){const i=document.createElement("div");return await this.symbolUtils.getDisplayedSymbol(t).then((async t=>{if(t&&await(this.symbolUtils?.renderPreviewHTML(t,{node:i})),i.children?.length){const t=i.children[0];if(t){const i=Number(t.getAttribute("height")),s=Number(t.getAttribute("width"));s>30?t.setAttribute("width","30"):s<19&&t.setAttribute("width","20"),t.setAttribute("viewBox",`0 0 ${s} ${i}`)}}})),i}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}static get watchers(){return{selectedLayerId:["selectedLayerWatchHandler"],sortingInfo:["sortingInfoWatchHandler"],whereClause:["whereClauseHandler"]}}};c.style=":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.feature-list-popup-title{font-weight:500;white-space:pre-line}.feature-list-popup-title-small{font-size:small;white-space:pre-line}.feature-list-popup-title-padding{padding:10px 12px}.feature-list-popup-title-padding-reduced{padding:10px 0}.profile-img{margin:0 0.75rem;min-width:32px}.like-container{display:flex;align-items:center;gap:5px;color:gray !important;font-style:italic}.feature-symbol{padding:3px 10px;min-width:30px;display:flex;justify-content:center}";export{c as feature_list}
@@ -0,0 +1,21 @@
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{_ as t}from"./p-ff9e28d1.js";import{l as s}from"./p-f4aadb3b.js";
7
+ /** @license
8
+ * Copyright 2022 Esri
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */class e{arcade;intl;async getPopupTitle(s,e){this.arcade||await this._initModules();let i={};for(const[t,e]of Object.entries(s.attributes))i={...i,[`{${t.toUpperCase()}}`]:e};const a=s.layer,o=this._removeTags(a?.popupTemplate?.title);if(o.includes("{expression/expr")&&null!=a?.popupTemplate?.expressionInfos)for(let t=0;t<a.popupTemplate?.expressionInfos.length;t++){const o=a.popupTemplate.expressionInfos[t],n=this.arcade.createArcadeProfile("popup");try{const t=await this.arcade.createArcadeExecutor(o.expression,n),r=await t.executeAsync({$feature:s,$layer:a,$map:e});null==r&&""===r||(i[`{expression/${o.name}}`.toUpperCase()]=r)}catch(t){console.error(t);continue}}return a.popupTemplate?.fieldInfos&&a.fields.forEach((e=>{const o=s.attributes[e.name],n=a.popupTemplate.fieldInfos.find((t=>t.fieldName.toLowerCase()===e.name.toLowerCase())),r=t(o,e.type,e.domain,n?.format,this.intl);i[`{${e.name.toUpperCase()}}`]=r??o})),o?.replace(/{.*?}/g,(t=>null!=i[t.toUpperCase()]?i[t.toUpperCase()]:""))}_removeTags(t){return null==t||""===t?"":t.toString().replace(/(<([^>]+)>)/gi,"")}async _initModules(){const[t,e]=await s(["esri/arcade","esri/intl"]);this.arcade=t,this.intl=e}}export{e as P}
@@ -3,4 +3,4 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as t,c as i,g as s,h as e,H as h}from"./p-4e6eb06e.js";import{g as a,l as o}from"./p-f4aadb3b.js";import{g as l,q as n,e as c,f as d,i as r,j as p,c as b}from"./p-d572627c.js";import{d as f}from"./p-46c8015c.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";import"./p-d0d020a5.js";import"./p-7530a02f.js";import"./p-9bb44f57.js";const u=class{constructor(s){t(this,s),this.createWorkFlowStarted=i(this,"createWorkFlowStarted",7),this.backFromCreateWorkFlow=i(this,"backFromCreateWorkFlow",7),this.featureOrRecordSubmitted=i(this,"featureOrRecordSubmitted",7),this.customInfoText=void 0,this.enableEditGeometry=!1,this.isMobile=void 0,this.layer=void 0,this.mapView=void 0,this.zoomAndScrollToSelected=void 0,this.selectedFeaturesIds=void 0,this.enableCreateFeatures=!0,this.selectingFeatureFromMap=void 0,this._cardLoading=!1,this._graphics=void 0,this._showCreateFeatureComponent=!1,this._showSubmitBtn=!1,this._translations=void 0}get el(){return s(this)}_isFeatureCreated=!1;_createFeature;createWorkFlowStarted;backFromCreateWorkFlow;featureOrRecordSubmitted;async featureSelectionChange(t){this._showCreateFeatureComponent&&!this._isFeatureCreated&&this._backFromCreateFeature();const i=t.detail;this._graphics=await this._getFeaturesByIds(i)}async layerSelectionChange(t){this._showCreateFeatureComponent&&this._backFromCreateFeature();const i=t.detail[0];this.layer=await l(this.mapView,i)}async componentWillLoad(){await this._getTranslations(),this.selectedFeaturesIds?.length>0&&(this._graphics=await this._getFeaturesByIds(this.selectedFeaturesIds))}render(){const t=this._graphics?.length>0?"":"display-none",i=0===this._graphics?.length&&this._showCreateFeatureComponent?"":"display-none",s=this._graphics?.length>0||this._showCreateFeatureComponent?"display-none":"",a=this.layer?.isTable,o=a?this._translations.createRecord:this._translations.createFeature,l=this.customInfoText?this.customInfoText:this.selectingFeatureFromMap?this._translations.selectFeaturesFromMapToStart:this._translations.selectFeaturesToStart,n=this.enableCreateFeatures&&this.layer?.capabilities?.operations?.supportsAdd;return e(h,{key:"7360aa9c48dd0c3e4a14fe0833b99c301388f93c"},e("div",{key:"9d610f0c4728c238eceb790e97a4e06b77f1a2d1",class:"overflow-auto height-full"},e("calcite-shell",{key:"4b6a02205a971c7ff61aab567b2f2a3c5d288f8d",class:"position-relative "+t},e("div",{key:"96ee8ce138265dd4b562ac0a33b79a0db4497842",class:"position-static z-index-500"},e("info-card",{key:"7db359bc1016281fd01b737dc5c424fe78995422",enableEditGeometry:this.enableEditGeometry,graphics:this._graphics,isLoading:this._cardLoading,isMobile:this.isMobile,mapView:this.mapView}))),e("calcite-shell",{key:"afc8d06e9aa3213a9ca10c929497ed4618a28e91",class:"position-relative "+s},e("calcite-flow-item",{key:"46db92a6e259eefea3293310e3e2f43d7639db97"},e("calcite-panel",{key:"d2bc23ae7bcf2b7b7b48a35efc0697e0d1f9e23e"},e("div",{key:"8f7fd13f9ec99beec1d7231dda03eba403a70a69",class:"padding-1"},e("calcite-notice",{key:"2fbe94292c1dd91ee1691b8e3d295225ff5b534b",icon:this.selectingFeatureFromMap?"map":"table",iconFlipRtl:!0,open:!0},e("div",{key:"9f91099e4bfa0675c5b098a73b2f132b80ee76b0",slot:"message"},l))),!this.isMobile&&n&&e("calcite-button",{key:"c1b04e776f3750712992d736e09726cc26eae5db",disabled:!this.layer,onClick:()=>this._createFeatureBtnClicked(),slot:"footer",width:"full"},a?this._translations.createRecord:this._translations.createFeature)))),e("calcite-shell",{key:"a71d4b0abd1ec1a4ed14a2cb3dcb10a075f54bf0",class:"position-relative "+i},e("calcite-flow-item",{key:"85047b527f5995a912b527325f287c3596caf630"},e("calcite-panel",{key:"d335be81502e0feb803ee9ad4e501d4c85f184f5",heading:o},e("calcite-action",{key:"b179c3185dbada3bd052d38b98b75cf29240655c",class:"back-button hydrated",icon:"chevron-left",onClick:this._backFromCreateFeature.bind(this),scale:"s",slot:"header-actions-start",text:""}),this.getEditorComponent(),this._showSubmitBtn&&e("calcite-button",{key:"f3b6655e3effdb6b09e64acd651a09d6028a6df9",appearance:"solid",class:"footer-top-button footer-button",onClick:()=>{this._createFeature.submit()},slot:"footer",width:"full"},this._translations.create))))))}getEditorComponent(){return e("div",null,this._showCreateFeatureComponent&&e("create-feature",{customizeSubmit:!0,mapView:this.mapView,onDrawComplete:()=>{this._showSubmitBtn=!0},onEditingAttachment:t=>{this._showSubmitBtn=!t.detail},onProgressStatus:()=>{setTimeout((()=>{this._isFeatureCreated=!1}),2e3)},onSuccess:this._featureCreated.bind(this),ref:t=>this._createFeature=t,selectedLayerId:this.layer?.id,showGuidingMsgWhileDrawing:!1}))}async _getFeaturesByIds(t){return(t.length>0?await n(t,this.layer,[],!0,this.mapView.spatialReference):[]).sort(((i,s)=>t.indexOf(i.getObjectId())-t.indexOf(s.getObjectId())))}_createFeatureBtnClicked(){this._showCreateFeatureComponent=!0,this.createWorkFlowStarted.emit()}async _backFromCreateFeature(){this._createFeature&&(this._showCreateFeatureComponent=!1,this.backFromCreateWorkFlow.emit()),this._showSubmitBtn=!1}_featureCreated(){this._showCreateFeatureComponent=!1,this._showSubmitBtn=!1,this._isFeatureCreated=!0,this.featureOrRecordSubmitted.emit(),setTimeout((()=>{this._showCreateFeatureComponent=!0}),50)}async _getTranslations(){const t=await a(this.el);this._translations=t[0]}};u.style=":host{display:block !important}.display-flex{display:flex}.display-none{display:none}.w-100{width:100%}.padding-bottom-1{padding-bottom:1rem}.padding-1{padding:1rem}.position-relative{position:relative}.focus-margin{margin:1px 1px 0px 1px}.overflow-auto{overflow:auto}.height-full{height:100%}.position-static{position:static !important}.z-index-500{z-index:500 !important}card-manager{display:block}";const m=class{constructor(s){t(this,s),this.featureSelectionChange=i(this,"featureSelectionChange",7),this.toggleFilter=i(this,"toggleFilter",7),this.appLayout=void 0,this.defaultGlobalId=void 0,this.defaultLayerId=void 0,this.defaultOid=void 0,this.enableAutoRefresh=void 0,this.enableColumnReorder=!0,this.enableCSV=void 0,this.enableInlineEdit=void 0,this.enableShare=void 0,this.isMobile=void 0,this.mapHidden=void 0,this.mapInfo=void 0,this.mapView=void 0,this.onlyShowUpdatableLayers=void 0,this.selectedIds=[],this.shareIncludeEmbed=void 0,this.shareIncludeSocial=void 0,this.showNewestFirst=void 0,this.zoomAndScrollToSelected=void 0,this.zoomToScale=void 0,this.createFilterModal=!0,this._allIds=[],this._controlsThatFit=void 0,this._csvExporting=!1,this._fetchingData=!1,this._filterActive=!1,this._filterOpen=!1,this._layer=void 0,this._selectAllActive=!1,this._deleteDialogOpen=!1,this._showHideOpen=!1,this._showOnlySelected=!1,this._toolInfos=void 0,this._translations=void 0,this._fullTextSearchInfo=void 0,this._searchPlaceHolder="",this._size=0}get el(){return s(this)}FeatureTable;TableTemplate;_columnsInfo;_ctrlIsPressed=!1;_currentId;_editEnabled;_defaultFilterHonored=!1;_defaultGlobalIdHonored=!1;_defaultOidHonored=!1;_defaultVisibleToolSizeInfos;_definitionExpression;_deleteEnabled;_filterList;_floorExpression;_floorField;_floorFacility;_floorLevel;_floorSite;_layerExpressions;_loaded=!1;_mapClickHandle;_observerSet=!1;_previousCurrentId;reactiveUtils;_refreshHandle;_resizeObserver;_selectAllElement;_selectionFromMap=!1;_shareNode;_shiftIsPressed=!1;_showHideDropdown;_skipOnChange=!1;_moreDropdown;_table;_tableNode;_timeout;_toolbar;_toolbarSizeInfos;_searchExpression;appLayoutWatchHandler(){this._updateShareUrl()}async defaultOidWatchHandler(){await this._handleDefaults()}async defaultGlobalIdWatchHandler(){await this._handleDefaults()}enableCSVWatchHandler(){this._toolInfos?.length>0&&this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}enableShareWatchHandler(){this._toolbar&&this._updateToolbar()}_controlsThatFitWatchHandler(){const t=this._controlsThatFit?this._controlsThatFit.reduce(((t,i)=>(t.push(i.id),t)),[]):[];this._toolInfos=this._toolInfos?.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}mapHiddenWatchHandler(){this._toolInfos?.length>0&&this._initToolInfos()}isMobileWatchHandler(){this._toolInfos||this.isMobile||this._initToolInfos()}async mapInfoWatchHandler(){this._resetColumnTemplates(),this.createFilterModal&&this._initLayerExpressions(),this._initToolInfos(),this._updateToolbar(),await this._sortTable()}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._floorExpression=void 0,this._searchExpression=void 0,this._updateShareUrl(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(t=>{this._mapClicked(t)})))}async _layerWatchHandler(){this._fetchingData=!0,await(this._layer?.when((async()=>{this._definitionExpression=this._layer.definitionExpression,this._floorField=this._layer.floorInfo?.floorField,this._updateFloorDefinitionExpression(),await this._resetTable(),this.createFilterModal&&this._initLayerExpressions(),this._updateShareUrl(),this._fetchingData=!1})))}async selectedIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions(),this._selectAllActive&&this.selectedIds.length!==this._allIds.length&&(this._selectAllActive=!1),this.selectedIds.length>0&&(this._table.rowHighlightIds.removeAll(),this._table.rowHighlightIds.add(this.selectedIds[0]))}async filterReset(){await this._handleFilterListReset()}async filterUpdate(){await this._handleFilterUpdate()}async closeFilter(){await this._closeFilter()}async refresh(){this._table&&await this._refresh()}featureSelectionChange;toggleFilter;async selectionChanged(t){const i=t.detail.selectedFeature[0],s=i.getObjectId(),e=this._table;if(e.rowHighlightIds.length&&e.rowHighlightIds.removeAll(),e.rowHighlightIds.add(s),this.zoomAndScrollToSelected){const t=this._table.viewModel.getObjectIdIndex(s);this._table.scrollToIndex(t);const e=i.layer;let h;this.mapView.allLayerViews.toArray().some((t=>{if(t.layer.title===e.title&&"feature"===t.layer.type)return h=t,!0})),h&&await c([s],h,this.mapView,!0,void 0,this.zoomToScale)}}async layerSelectionChange(t){await this._layerSelectionChanged(t)}async editsComplete(t){const i=t.detail;"delete"!==i&&"add"!==i||(this._allIds=await d(this._layer)),await this._refresh()}async facilityChanged(t){this._floorFacility=t.detail,this._updateFloorDefinitionExpression()}async levelChanged(t){this._floorLevel=t.detail,this._updateFloorDefinitionExpression()}async siteChanged(t){this._floorSite=t.detail,this._updateFloorDefinitionExpression()}noLayersFound(){this._layer=void 0,this._allIds=[],this._clearSelection()}clearSelection(){this._clearSelection()}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initToolInfos(),this._resizeObserver||(this._resizeObserver=new ResizeObserver((()=>this._onResize())))}render(){const t=this._fetchingData?"display-none":"",i=this._fetchingData?"":"display-none",s=this._size.toString(),a=this.selectedIds.length.toString(),o=this.isMobile?"height-full":"height-full-adjusted",l=this._canShowFullTextSearch();return this._validateActiveActions(),e(h,{key:"04fccaaa9862ed315d99ad74f7e1135dd5656613"},e("calcite-shell",{key:"e332d781be1499857a5e17e37ad2e058bba453b1"},this._getTableControlRow("header"),e("div",{key:"6337e494f879c250494c5f5859daec627fdd0700",class:`width-full ${o}`},e("calcite-panel",{key:"d0d437997906fd15f97765cb89c3917f66b20c37",class:"height-full width-full"},l&&e("div",{key:"596a2d54fd707941d9e2ec167598313d9ee9b295",class:"search-container"},e("calcite-input",{key:"31cd1ffb09bc2c6c9c1f9daf39f3e9549cbceeb2",class:"search",clearable:!0,icon:"search",onCalciteInputChange:t=>{this._searchTextChanged(t)},placeholder:this._searchPlaceHolder,title:this._searchPlaceHolder,type:"search"})),e("calcite-loader",{key:"b4ba3d32fb346134672e08d55428bd38ac43f40d",class:i,label:this._translations.fetchingData,scale:"l"}),e("div",{key:"4fbac73935be7a1163643543e6d77a200534e5e3",class:t,ref:this.onTableNodeCreate}))),this.isMobile?void 0:e("div",{class:"bottom-left text-color height-19"},this._translations.recordsSelected.replace("{{total}}",s).replace("{{selected}}",a))),this.createFilterModal&&this._filterModal(),e("delete-dialog",{key:"3b0dba8bc391d777f4687ad6f4e905aeb1eb580b",id:"deleteDialogId",ids:this._getIds(),layer:this._layer,onDeleteDialogClose:()=>this._deleteDialogOpen=!1,open:this._deleteDialogOpen,ref:t=>this._deleteDialog=t}))}_deleteDialog;async componentDidLoad(){this.isMobile||this._observerSet||(this._resizeObserver.observe(this._toolbar),this._observerSet=!0)}componentDidRender(){document.onclick=t=>this._handleDocumentClick(t),document.onkeydown=t=>this._handleKeyDown(t),document.onkeyup=t=>this._handleKeyUp(t),this._updateToolbar()}async _initModules(){const[t,i,s]=await o(["esri/widgets/FeatureTable","esri/core/reactiveUtils","esri/widgets/FeatureTable/support/TableTemplate"]);this.FeatureTable=t,this.reactiveUtils=i,this.TableTemplate=s}async _searchTextChanged(t){this._fullTextSearchInfo.forEach((i=>{i.searchTerm=t.target.value})),this._searchFullText()}async _searchFullText(){if(this._searchExpression&&this._clearSearchDefinitionExpression(),this._fullTextSearchInfo.length&&this._fullTextSearchInfo[0].searchTerm){const t=this._layer.createQuery();t.fullText=this._fullTextSearchInfo;const i=await this._layer.queryObjectIds(t);await this._updateSearchDefinitionExpression(i?.length?i:[-1])}await new Promise((t=>setTimeout(t,800))),await this._updateAllIds()}_clearSearchDefinitionExpression(){const t=this._layer.definitionExpression;this._searchExpression&&t?.indexOf(this._searchExpression)>-1&&(this._layer.definitionExpression=t?.indexOf(" AND ("+this._searchExpression)>-1?t.replace(` AND (${this._searchExpression})`,""):t.replace(this._searchExpression,"")),this._searchExpression=void 0}async _updateSearchDefinitionExpression(t){const i=this._layer.definitionExpression;if(t?.length){const s=`objectId in(${t})`;this._layer.definitionExpression=i?.indexOf(this._searchExpression)>-1?i.replace(this._searchExpression,s):i?`${i} AND (${s})`:s,this._searchExpression=s}else this._clearSearchDefinitionExpression()}_canShowFullTextSearch(){return((this._layer?.capabilities)?.query)?.supportsFullTextSearch&&this._layer.indexes.items.filter((t=>"FullText"==t.indexType)).length>0}_getFullTextSearchInfo(){if(this._fullTextSearchInfo=[],((this._layer?.capabilities)?.query)?.supportsFullTextSearch){const t=this._layer.indexes?.filter((t=>"FullText"==t.indexType));if(t?.length){const i=[];t.forEach((t=>{i.push(...t.fields.split(","))}));const s=[];i.forEach((t=>{const i=this._layer.getField(t.trim());s.push(i.alias)})),this._searchPlaceHolder=this._translations.searchPlaceholder.replace("{{fields}}",s.join(", ")),this._fullTextSearchInfo.push({onFields:["*"],searchTerm:"",searchType:"prefix"})}}}_onResize(){this._updateToolbar()}_getTableControlRow(t){const i=this._canShowFullTextSearch()?"border-bottom":"";return e("div",{class:`display-flex height-51-px ${i}`,ref:t=>this._toolbar=t,slot:t},this._getActionBar(),this.isMobile?void 0:this._getDropdown("more-table-options"),this.enableShare&&!this.isMobile?this._getShare("share"):void 0)}_getActionBar(){const t=this.isMobile?"width-full":"",i=this.isMobile?"border-top":"";return e("calcite-action-bar",{class:t,expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},e("div",{class:`border-end ${t} ${i}`,id:"solutions-map-layer-picker-container"},e("map-layer-picker",{appearance:"transparent",defaultLayerId:this.defaultLayerId,display:"inline-flex",height:50,isMobile:this.isMobile,mapView:this.mapView,onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",scale:"l",selectedIds:this._layer?[this._layer?.id]:[],showSingleLayerAsLabel:!0,showTables:!0,type:"dropdown"})),this.isMobile?void 0:this._getActions())}_getActions(){const t=this._getActionItems();return t?.reduce(((t,i)=>(i&&!i.isOverflow&&t.push(i.isDanger?this._getDangerAction(i.icon,i.label,i.func,i.disabled):i.isSublist?e("calcite-dropdown",{closeOnSelectDisabled:!0,id:this._getId(i.icon),onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:t=>this._showHideDropdown=t},this._getAction(i.active,this._showHideOpen?"chevron-down":i.icon,i.indicator,i.label,i.func,i.disabled,i.loading,"trigger"),this._showHideOpen?this._getFieldlist():void 0):this._getAction(i.active,i.icon,i.indicator,i.label,i.func,i.disabled,i.loading)),t)),[])}_getFieldlist(){return this._columnsInfo?e("calcite-dropdown-group",{"selection-mode":"multiple"},Object.keys(this._columnsInfo).map((t=>{const i=this._columnsInfo[t];return e("calcite-dropdown-item",{id:`layer-table-${t.toLowerCase().replaceAll(" ","")}`,label:t,onClick:t=>{const i=t.target;this._columnsInfo[i.label]=i.selected,i.selected?this._table.showColumn(i.label):this._table.hideColumn(i.label)},selected:i},t)}))):void 0}_validateEnabledActions(){const t=this._featuresSelected(),i=this.selectedIds.length>1&&this._layer?.capabilities?.operations?.supportsUpdate,s=["zoom-to-object","pencil","trash","erase","selected-items-filter"];this._toolInfos?.forEach((e=>{e&&s.indexOf(e.icon)>-1&&(e.disabled="pencil"===e.icon?!i:!t)}))}_validateActiveActions(){const t=["filter","list-check-all","selected-items-filter"];this._toolInfos?.forEach((i=>{i&&t.indexOf(i.icon)>-1&&("filter"===i.icon&&(i.indicator=this._filterActive),"list-check-all"===i.icon&&(i.active=this._selectAllActive),"selected-items-filter"===i.icon&&(i.active=this._showOnlySelected))}))}_initToolInfos(){const t=this._featuresSelected(),i=this.selectedIds.length>1&&this._layer?.capabilities?.operations?.supportsUpdate&&!1,s=this._featuresEmpty(),e=this._hasFilterExpressions();this._translations&&(this._toolInfos=[this.mapHidden?void 0:{active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>this._zoom(),disabled:!t,isOverflow:!1},e?{active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this.createFilterModal?this._toggleFilter():this.toggleFilter.emit(),disabled:!1,isOverflow:!1}:void 0,i?{active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>alert(this._translations.editMultiple),disabled:!i,isOverflow:!1}:void 0,this._deleteEnabled?{active:void 0,icon:"trash",indicator:void 0,label:this._translations.delete,func:()=>this._showDelete(),disabled:!t,isDanger:!0,isOverflow:!1}:void 0,{active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>this._clearSelection(),disabled:!t,isOverflow:!1},{active:!1,icon:"selected-items-filter",indicator:!1,label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!t,isOverflow:!1},{active:!1,icon:"list-check-all",indicator:!1,func:()=>this._selectAll(),label:this._translations.selectAll,disabled:s,isOverflow:!1},{active:!1,icon:"compare",indicator:!1,func:()=>this._switchSelected(),label:this._translations.switchSelected,disabled:s,isOverflow:!1},{active:!1,icon:"refresh",indicator:!1,func:()=>this._refresh(),label:this._translations.refresh,disabled:!1,isOverflow:!1},this.enableCSV?{active:!1,icon:"export",indicator:!1,func:()=>{this._exportToCSV()},label:this._translations.exportCSV,loading:this._csvExporting,disabled:s,isOverflow:!1}:void 0,{active:!1,icon:this._showHideOpen?"chevron-down":"chevron-right",indicator:!1,func:()=>this._toggleShowHide(),label:this._translations.showHideColumns,disabled:!1,isOverflow:!1,isSublist:!0}],this._defaultVisibleToolSizeInfos=void 0)}_updateFloorDefinitionExpression(){if(this._floorField&&this._floorLevel){const t=`${this._floorField} = '${this._floorLevel}'`,i=this._layer.definitionExpression;this._layer.definitionExpression=i?.indexOf(this._floorExpression)>-1?i.replace(this._floorExpression,t):i?`${i} AND (${t})`:t,this._floorExpression=t}}_featuresSelected(){return this.selectedIds.length>0}_featuresEmpty(){return 0===this._allIds.length}_hasFilterExpressions(){let t;return this.mapInfo?.filterConfig?.layerExpressions&&this._layer?.id&&(t=this.mapInfo.filterConfig.layerExpressions.filter((t=>t.id===this._layer.id))),t?.length>0}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),!this.isMobile&&this._toolbar&&this._toolInfos&&(this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const t=this._toolbar.offsetWidth;let i=this._toolbarSizeInfos.reduce(((t,i)=>t+i.width),0);const s=["solutions-more","solutions-map-layer-picker-container","solutions-action-share"];if(i>t){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,h)=>(s.indexOf(h.id)<0&&(i>t?i-=h.width:e.push(h)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((t,i)=>(t.push(i.id),t)),[]);let h=!1;const a=[...this._defaultVisibleToolSizeInfos].reduce(((a,o)=>(!h&&s.indexOf(o.id)<0&&(e.indexOf(o.id)>-1||i+o.width<=t)?(e.indexOf(o.id)<0&&(i+=o.width),a.push(o)):s.indexOf(o.id)<0&&i+o.width>t&&(h=!0),a)),[]);this._setControlsThatFit(a,s)}}),250))}_setControlsThatFit(t,i){let s=JSON.stringify(t)!==JSON.stringify(this._controlsThatFit);const e=document.getElementById("solutions-action-bar");e?.childNodes?.forEach((t=>{i.indexOf(t.id)<0&&!s&&(s=this._controlsThatFit.map((t=>t.id)).indexOf(t.id)<0)})),s&&(this._controlsThatFit=[...t])}_setToolbarSizeInfos(){let t=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((i,s)=>{0===s?i.childNodes.forEach((i=>{this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0)})):i.referenceElement||(this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0))})),t&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionItems(){return this._toolInfos?.filter((t=>t&&!t.isOverflow))}_getDropdown(t){const i=this._getDropdownItems();return i.length>0?e("calcite-dropdown",{closeOnSelectDisabled:!0,disabled:void 0===this._layer,id:"solutions-more",onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:t=>this._moreDropdown=t},e("calcite-action",{appearance:"solid",id:t,label:"",onClick:()=>this._closeShowHide(),slot:"trigger",text:""},e("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),e("calcite-dropdown-group",{"selection-mode":"none"},i.map((t=>e("calcite-dropdown-group",{class:`${t.disabled?"disabled":""} ${"trash"===t.icon?"delete-red":""}`,selectionMode:"none"},e("calcite-dropdown-item",{disabled:t.loading,iconStart:t.isSublist&&this._showHideOpen?"chevron-down":t.loading?"":t.icon,id:`layer-table-${t.icon}`,onClick:t.func},t.loading?e("div",{class:"display-flex"},e("calcite-loader",{inline:!0,label:t.label,scale:"m"}),t.label):t.label))))),this._showHideOpen?this._getFieldlist():void 0):void 0}_getDropdownItems(){return this._toolInfos?.filter((t=>t&&t.isOverflow))}_getAction(t,i,s,h,a,o,l,n){const c=void 0===this._layer||o;return e("div",{class:"display-flex",id:this._getId(i),slot:n},e("calcite-action",{active:t,appearance:"solid",disabled:c,icon:i,id:`layer-table-${i}`,indicator:s,label:h,loading:l,onClick:a,text:h,textEnabled:!0}),this._getToolTip("bottom",i,h))}_showDelete(){this._deleteDialogOpen=!0}_getShare(t){return e("div",{class:"share-action",id:this._getId(t)},e("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"instant-app-share",embed:this.shareIncludeEmbed,popoverButtonIconScale:"s",ref:t=>this._shareNode=t,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",socialMedia:this.shareIncludeSocial,view:this.mapView}),this._getToolTip("bottom",t,this._translations.share))}_updateShareUrl(){const t=this._shareNode?.shareUrl;if(!t)return;const i=new URL(t);this.mapInfo?.id?i.searchParams.set("webmap",this.mapInfo.id):i.searchParams.delete("webmap"),this._layer?.id?i.searchParams.set("layer",this._layer.id):i.searchParams.delete("layer"),this.selectedIds?.length>0?i.searchParams.set("oid",this.selectedIds.join(",")):i.searchParams.delete("oid"),i.searchParams.set("applayout",this.appLayout),this._shareNode.shareUrl=i.href}_getToolTip(t,i,s){return document.getElementById(i)?e("calcite-tooltip",{placement:t,"reference-element":i},e("span",null,s)):void 0}_getId(t){return`solutions-action-${t}`}_getDangerAction(t,i,s,h){const a=void 0===this._layer||h;return e("div",{class:"display-flex",id:this._getId(t)},"trash"===t?e("delete-button",{buttonType:"action",class:"display-flex",disabled:a,icon:t,id:"solutions-delete",ids:this._getIds(),layer:this._layer}):e("calcite-action",{appearance:"solid",disabled:a,id:t,onClick:s,text:i},e("calcite-button",{appearance:"transparent",iconStart:t,kind:"danger"},i)),this._getToolTip("bottom",t,i))}_getIds(){return this._table?.highlightIds?.toArray()}onTableNodeCreate=t=>{this._tableNode=t};async _getTable(t,i){this._layer&&(await this._layer.when((()=>{this._table=new this.FeatureTable({autoRefreshEnabled:this.enableAutoRefresh,layer:this._layer,view:this.mapView,columnReorderingEnabled:this.enableColumnReorder,editingEnabled:this._editEnabled&&this.enableInlineEdit,highlightEnabled:!0,multiSortEnabled:!1,visibleElements:{header:!1,menu:!1},tableTemplate:{columnTemplates:i},container:t})})),await this._table.when((()=>{this._table.highlightIds.on("change",(t=>{this._handleOnChange(t)}));const t=this.reactiveUtils.watch((()=>this._table.size),(t=>{this._size=t}));this._table.viewModel.addHandles(t)})))}async _handleOnChange(t){const i=[...this._table.highlightIds.toArray()];if(this._skipOnChange)this._skipOnChange=!1;else{if(!this._ctrlIsPressed&&!this._shiftIsPressed||this._selectionFromMap&&this._shiftIsPressed)if(this.selectedIds.length>0){this._skipOnChange=!0;const s=this.selectedIds.length>1&&1===t.removed.length?t.removed:i.filter((t=>this.selectedIds.indexOf(t)<0));this._clearSelection(),this.selectedIds=[...s],s.length>0?this._table.highlightIds.add(s[0]):this._skipOnChange=!1}else this.selectedIds=i.reverse();else if(this._ctrlIsPressed)this.selectedIds=i.reverse();else if(this._shiftIsPressed&&i?.length>0)if(this._skipOnChange=!0,this._previousCurrentId=this._currentId,this._currentId=[...i].reverse()[0],1===i.length)this._skipOnChange=!1;else if(this._previousCurrentId!==this._currentId){const t=this._table.activeSortOrders.reduce(((t,i)=>(t.push(`${i.fieldName} ${i.direction}`),t)),[]),s=await r(0,this._layer,[],t);let e=!1;const h=this._table.viewModel.getObjectIdIndex(this._previousCurrentId),a=this._table.viewModel.getObjectIdIndex(this._currentId);this._skipOnChange=(h<a?h:a)+1!==(a>h?a:h);const o=s.reduce(((t,i)=>{const s=i;return s===this._currentId||s===this._previousCurrentId?(e=!e,t.indexOf(s)<0&&t.push(s)):e&&t.indexOf(s)<0&&t.push(s),t}),[]),l=h<a?o.reverse():o;this.selectedIds=[...new Set([...l,...this.selectedIds])],this._table.highlightIds.addMany(this.selectedIds.filter((t=>i.indexOf(t)<0)))}this._finishOnChange()}this._currentId=[...this._table.highlightIds.toArray()].reverse()[0],this._selectionFromMap=!1}_finishOnChange(){this._showOnlySelected&&(this._featuresSelected()?this._table.filterBySelection():this._toggleShowSelected()),this.featureSelectionChange.emit(this.selectedIds)}_resetColumnTemplates(){const t=this._getColumnTemplates(this._layer?.id,this._layer?.fields),i=t?.some(((t,i)=>JSON.stringify(this._table?.tableTemplate.columnTemplates[i])!==JSON.stringify(t)));if(this._table&&t&&(i||!this._columnsInfo)){this._table.tableTemplate=new this.TableTemplate({columnTemplates:t});const i=t.map((t=>t.fieldName));this._initColumnsInfo(i)}}async _resetTable(){if(this._loaded=!1,this._clearSelection(),this._allIds=await d(this._layer),this._table)this._table.view=this.mapView,this._table.layer=this._layer;else{const t=this._getColumnTemplates(this._layer.id,this._layer?.fields);await this._getTable(this._tableNode,t)}await this._initLayerRefresh(),this._checkEditEnabled(),this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,await this._table.when(),setTimeout((()=>{this._loaded||(console.log(`table.state: ${this._table.state}`),this.finishLoading())}),1e3),await this.reactiveUtils.once((()=>"loaded"===this._table.state)).then((async()=>{await this.finishLoading()}))}async finishLoading(){try{this._loaded=!0,this._table.highlightIds.removeAll(),this._table.clearSelectionFilter(),this._resetColumnTemplates(),this._showOnlySelected=!1,await this._handleDefaults(),await this._sortTable(),this._initToolInfos(),this._updateToolbar()}catch(t){console.log(t)}}async _initLayerRefresh(){this._refreshHandle&&this._refreshHandle.remove(),this._refreshHandle=this._layer.on("refresh",(t=>{t.dataChanged&&(this._skipOnChange=!0,this._updateAllIds())}))}async _updateAllIds(){this._allIds=await d(this._layer),this.selectedIds=this.selectedIds.filter((t=>this._allIds.indexOf(t)>-1)),await this._refresh()}async _handleDefaults(){if(!this._defaultOidHonored&&this.defaultOid?.length>0&&this.defaultOid[0]>-1&&this._table&&(await this._selectDefaultFeature(this.defaultOid),this._defaultOidHonored=!0,this.defaultOid=void 0,this._showOnlySelected=!1,this._toggleShowSelected()),!this._defaultGlobalIdHonored&&this.defaultGlobalId?.length>0&&this._table){const t=await p(this.defaultGlobalId,this._layer),i=t?.length>0?t.map((t=>t.getObjectId())):void 0;i&&await this._selectDefaultFeature(i),this._defaultGlobalIdHonored=!0,this.defaultGlobalId=void 0,this._showOnlySelected=!1,this._toggleShowSelected()}}_initColumnsInfo(t){const i=this._table?.columns.reduce(((i,s)=>((!t||t?.indexOf(s.name)>-1)&&(i[s.name]=!s.hidden),i)),{}),s=this._table?.columns.map((t=>t.name));(t?t.filter((t=>s.indexOf(t)<0)):[]).forEach((t=>{i[t]=!0})),this._columnsInfo=t?t.reduce(((t,s)=>(t[s]=i[s],t)),{}):i}async _selectDefaultFeature(t){t.length>0&&this._table.highlightIds.addMany(t)}_checkEditEnabled(){this._editEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsUpdate,this._deleteEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsDelete}async _sortTable(){let t,i=this._layer?.objectIdField,s="desc";this.mapInfo?.layerOptions?.layers?.length>0&&this._layer?.id&&(t=this.mapInfo.layerOptions.layers.filter((t=>t.id===this._layer.id)),t&&t.length>0&&(t=t[0],t.sortField&&t.fields?.includes(t.sortField)&&(i=t.sortField),s=t?.sortOrder?t.sortOrder:"desc")),this._table&&this._layer&&(await this._table.when(),await this._layer.when((()=>{this._table.sortColumn(i,s)})))}_forceShowHide(){this._showHideDropdown&&(this._showHideDropdown.open=this._showHideOpen),this._moreDropdown&&(this._moreDropdown.open=this._showHideOpen)}_toggleShowHide(){this._showHideOpen=!this._showHideOpen}_closeShowHide(){this._showHideOpen=!1}_handleDocumentClick(t){const i=t.target?.id;i.startsWith("layer-table-")?this._moreDropdown.open=!0:this._showHideOpen&&Object.keys(this._columnsInfo).indexOf(i)<0&&"chevron-right"!==i&&(this._closeShowHide(),this._moreDropdown&&(this._moreDropdown.open=!1),this._showHideDropdown&&(this._showHideDropdown.open=!1))}_handleKeyDown(t){this._ctrlIsPressed=t.ctrlKey,this._shiftIsPressed=t.shiftKey}_handleKeyUp(t){this._ctrlIsPressed=t.ctrlKey,this._shiftIsPressed=t.shiftKey}_filterModal(){return e("calcite-modal",{"aria-labelledby":"modal-title",class:"modal",kind:"brand",onCalciteModalClose:()=>{this._closeFilter()},open:this._filterOpen,widthScale:"s"},e("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},this._translations?.filter?.replace("{{title}}",this._layer?.title)),e("div",{slot:"content"},e("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtn:!0,closeBtnOnClick:async()=>this._closeFilter(),comboboxOverlayPositioning:"fixed",layerExpressions:this._layerExpressions,onFilterListReset:()=>{this._handleFilterListReset()},onFilterUpdate:()=>{this._handleFilterUpdate()},ref:t=>this._filterList=t,view:this.mapView,zoomBtn:!1})))}async _handleFilterListReset(){this._filterActive=!1,this._updateShareUrl(),await this._searchFullText()}async _handleFilterUpdate(){const t=this._layer.definitionExpression;if(this._floorExpression){const i=new RegExp(`${this._floorField} = ['].+[']`,"gm");this._layer.definitionExpression=t&&this._floorField&&t.indexOf(`${this._floorField} = '`)>-1?t.replace(i,this._floorExpression):t?`${t} AND (${this._floorExpression})`:this._floorExpression}this._filterActive=this._definitionExpression!==this._layer.definitionExpression&&(!this._floorExpression||this._layer.definitionExpression!==this._floorExpression),this._updateShareUrl(),await this._searchFullText()}async _closeFilter(){this._filterOpen&&(this._allIds=await d(this._layer),this._filterOpen=!1)}async _mapClicked(t){const i={include:this._layer},s=await this.mapView.hitTest(t.screenPoint,i);s.results.length>0?(s.results.forEach((t=>{const i=t.graphic.getObjectId();this._table.highlightIds.indexOf(i)<0&&(this._selectionFromMap=!0,this._table.highlightIds.add(i))})),this._showOnlySelected&&this._table.filterBySelection()):this._clearSelection()}_selectAll(){const t=this._allIds;this._table.highlightIds.removeAll(),this._skipOnChange=!0,this._table.highlightIds.addMany(t),this.selectedIds=t,this._finishOnChange(),this._selectAllActive=!0}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){this.selectedIds=[],this._table?.highlightIds.removeAll(),this._table?.rowHighlightIds.removeAll(),this._finishOnChange()}_toggleFilter(){this._filterOpen=!this._filterOpen}_initLayerExpressions(){const t=this.mapInfo?.filterConfig?.layerExpressions;this._layerExpressions=t?t.filter((t=>t.id===this._layer?.id)):[],this._filterList.layerExpressions=this._layerExpressions,this._filterActive=this._layerExpressions.filter((t=>t.expressions.filter((t=>t.active)).length>0)).length>0}_switchSelected(){const t=[...this.selectedIds];this._table.highlightIds.removeAll();const i=this._allIds.reduce(((i,s)=>(t.indexOf(s)<0&&i.push(s),i)),[]).sort(((t,i)=>t-i));this._skipOnChange=!0,this._table.highlightIds.addMany(i),this.selectedIds=i,this._finishOnChange()}async _exportToCSV(){const t={},i=this._table.highlightIds.toArray();t[this._layer.id]={selectionSetNames:[this._layer.title],ids:i,layer:this._layer};const s=this._table.columns.toArray().reduce(((t,i)=>(i.hidden||t.push(i.name.toLocaleLowerCase()),t)),[]);this._updateToolInfoLoading("export",!0),this._csvExporting=!0,await f(null,t,!1,!1,!0,s,!0,!0),this._updateToolInfoLoading("export",!1),this._csvExporting=!1}_updateToolInfoLoading(t,i){this._toolInfos.some((s=>{if(s?.icon===t)return s.loading=i,!0}))}async _refresh(){await this._table.refresh(),this._allIds=await d(this._layer),this.featureSelectionChange.emit(this.selectedIds)}async _zoom(){if(this._layer){const t=await b(this.mapView,this._layer.id);await c(this.selectedIds,t,this.mapView,!0,void 0,this.zoomToScale)}}async _layerSelectionChanged(t){const i=t.detail[0];if(i!==this._layer?.id||this._featuresEmpty()){this._fetchingData=!0;const t=await l(this.mapView,i);t&&await t.when((()=>{this._layer=t,this._getFullTextSearchInfo()}))}this._fetchingData=!1}_getColumnTemplates(t,i){let s;this.mapInfo?.layerOptions?.layers.some((i=>{if(i.id===t)return s=i,!0}));const e=s?.fields&&s?.fieldOrder?s.fieldOrder.filter((t=>s.fields.indexOf(t)>-1)):void 0;let h;return i&&(h=s&&s?.fields?i.reduce(((t,i)=>{if(s.fields.indexOf(i.name)>-1){const s={type:"field",fieldName:i.name,label:i.alias,menuConfig:this._getMenuConfig(i.name)};t.push(s)}return t}),[]).sort(this._sortFields.bind(this,s?.fieldOrder)):i.map((t=>({type:"field",fieldName:t.name,label:t.alias,menuConfig:this._getMenuConfig(t.name)})))),e?h?.sort(this._sortFields.bind(this,e)):h}_sortFields(t,i,s){return t?.indexOf(i.fieldName)-t.indexOf(s.fieldName)}_getMenuConfig(t){return{items:[{label:this._translations.hideField,icon:"view-hide",autoCloseMenu:!0,clickFunction:()=>{this._handleHideClick(t)}}]}}_handleHideClick(t){this._columnsInfo[t]=!1,this._table.hideColumn(t),this._table.tableTemplate.columnTemplates.forEach((i=>{i.fieldName===t&&(i.visible=!1)}))}async _getTranslations(){const t=await a(this.el);this._translations=t[0]}static get watchers(){return{appLayout:["appLayoutWatchHandler"],defaultOid:["defaultOidWatchHandler"],defaultGlobalId:["defaultGlobalIdWatchHandler"],enableCSV:["enableCSVWatchHandler"],enableInlineEdit:["enableInlineEditWatchHandler"],enableShare:["enableShareWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"],mapHidden:["mapHiddenWatchHandler"],isMobile:["isMobileWatchHandler"],mapInfo:["mapInfoWatchHandler"],mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],selectedIds:["selectedIdsWatchHandler"]}}};function v(t){return function(t){return-1!==t?.indexOf("http://")}(t)?t.replace(/^http:\/\//,"https://"):t}m.style=':host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.table-border{border:1px solid var(--calcite-color-border-2)}.border-end{border-inline-end:1px solid var(--calcite-color-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51-px{height:51px}.height-50-px{height:50px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir="rtl"] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-color-background)}.text-color{color:var(--calcite-color-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-color-status-danger)}.esri-feature-table vaadin-grid{border:none !important}vaadin-grid-cell-content{font-size:14px !important;color:var(--calcite-color-text-3) !important}.share-action{position:absolute;right:0}html[dir="rtl"] .share-action{left:0}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.instant-app-share{height:50px !important;display:inline-flex}.border-top{border-top:1px solid var(--calcite-color-border-2)}.modal{--calcite-modal-content-padding:0}.esri-feature-table__table-container{height:100%}.search-container{background-color:var(--calcite-color-foreground-1) !important}.search{--calcite-color-border-input:var(--calcite-color-border-3);width:60%;padding:10px}.delete-red{--calcite-icon-color:var(--calcite-color-status-danger);--calcite-color-text-1:var(--calcite-color-status-danger);--calcite-color-text-3:var(--calcite-color-status-danger)}';const y=class{constructor(s){t(this,s),this.mapChanged=i(this,"mapChanged",7),this.beforeMapChanged=i(this,"beforeMapChanged",7),this.toggleFilter=i(this,"toggleFilter",7),this.clearSelection=i(this,"clearSelection",7),this.appLayout=void 0,this.appProxies=void 0,this.defaultWebmapId="",this.defaultLayerId=void 0,this.enableHome=void 0,this.enableLegend=void 0,this.enableFloorFilter=void 0,this.enableFullscreen=void 0,this.enableShare=!1,this.enableSingleExpand=!0,this.enableSearch=void 0,this.enableBasemap=void 0,this.basemapConfig=void 0,this.hidden=void 0,this.homeZoomIndex=3,this.homeZoomPosition="top-left",this.homeZoomToolsSize="m",this.mapInfos=[],this.mapWidgetsIndex=0,this.mapWidgetsPosition="top-right",this.mapWidgetsSize="m",this.mapView=void 0,this.stackTools=!0,this.theme=void 0,this.toolOrder=void 0,this.isMapLayout=void 0,this.shareIncludeEmbed=void 0,this.shareIncludeSocial=void 0,this.selectedFeaturesIds=void 0,this.selectedLayer=void 0,this.zoomToScale=void 0,this.onlyShowUpdatableLayers=void 0,this.isMobile=void 0,this.mapInfo=void 0,this._translations=void 0,this._searchConfiguration=void 0,this._webMapInfo=void 0,this._showHideOpen=!1,this._toolInfos=void 0,this._controlsThatFit=void 0}get el(){return s(this)}esriConfig;Home;MapView;WebMap;_defaultWebmapHonored=!1;_homeWidget;_loadedId="";_mapDiv;_mapPicker;_mapTools;_moreDropdown;_mapListExpanded=!1;_filterActive=!1;_definitionExpression;_mapLayerPicker;_resizeObserver;_shareNode;_showHideDropdown;_toolbar;_timeout;_toolbarSizeInfos;_defaultVisibleToolSizeInfos;_observerSet=!1;appLayoutWatchHandler(){this._updateShareUrl()}enableHomeWatchHandler(){this._initHome()}enableShareWatchHandler(){this._toolbar&&this._updateToolbar()}async mapViewWatchHandler(){this.mapView&&this._updateShareUrl()}async selectedLayerWatchHandler(){await(this.selectedLayer?.when((async()=>{this._definitionExpression=this.selectedLayer.definitionExpression})))}async selectedFeaturesIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions()}_controlsThatFitWatchHandler(){const t=this._controlsThatFit?this._controlsThatFit.reduce(((t,i)=>(t.push(i.id),t)),[]):[];this._toolInfos=this._toolInfos?.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}async resetFilter(){this._filterActive=!1,this._updateShareUrl()}async updateFilterState(){this._filterActive=this._definitionExpression!==this.selectedLayer.definitionExpression,this._updateShareUrl()}async updateLayer(){this._mapLayerPicker.updateLayer()}mapChanged;beforeMapChanged;toggleFilter;clearSelection;async mapInfoChange(t){await this._loadMap(t.detail)}noLayersFound(){this.selectedLayer=void 0,this.selectedFeaturesIds=[]}layerSelectionChange(){setTimeout((()=>{this._initToolInfos()}),50)}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initToolInfos(),this._resizeObserver||(this._resizeObserver=new ResizeObserver((()=>this._updateToolbar())))}render(){const t=this.isMapLayout?"display-flex height-49-px":"",i=this.hidden?"visibility-hidden-1":"",s="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light",a=this.mapInfos?.length>1||this.isMapLayout?"map-height":"height-full",o=this.isMapLayout?"":"display-none";return this._validateActiveActions(),e(h,{key:"d4e5ff9c4aa08a4effe19a54a1a48463cb8b3774"},e("div",{key:"51ee35d267d5ef081a4c160de3e03b1790d328c8",class:`${t} width-full`,ref:t=>this._toolbar=t},this._getActionBar(),!this.isMobile&&this.isMapLayout&&this._getDropdown("more-table-options"),this.enableShare&&!this.isMobile&&this.isMapLayout?this._getShare("share"):void 0),e("calcite-progress",{key:"70a5c232aae8a9ff6740fd326e6ba6fe61936541",class:o,value:0}),e("div",{key:"c399acc019d7f0a16dbb644eee4cfdd1e6e83c7c",class:`${a} ${i}`,ref:t=>this._mapDiv=t}),e("map-tools",{key:"c6a88ccfa140fe9b0d059f74b9254af6ef0997ce",basemapConfig:this.basemapConfig,class:`box-shadow ${s}`,enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableHome:this.enableHome,enableLegend:this.enableLegend,enableSearch:this.enableSearch,enableSingleExpand:this.enableSingleExpand,homeZoomToolsSize:this.homeZoomToolsSize,mapView:this.mapView,mapWidgetsSize:this.mapWidgetsSize,position:this.mapWidgetsPosition,ref:t=>this._mapTools=t,searchConfiguration:this._searchConfiguration,stackTools:this.stackTools,toolOrder:this.toolOrder}))}async componentDidRender(){this.isMapLayout&&this._updateToolbar(),document.onclick=t=>this._handleDocumentClick(t)}async componentDidLoad(){this.isMobile||this._observerSet||(this._resizeObserver.observe(this._toolbar),this._observerSet=!0),this._updateShareUrl()}async _initModules(){const[t,i,s,e]=await o(["esri/WebMap","esri/views/MapView","esri/widgets/Home","esri/config"]);this.WebMap=t,this.MapView=i,this.Home=s,this.esriConfig=e}async _loadMap(t){const i=!this._defaultWebmapHonored&&this.defaultWebmapId,s=this.mapInfos?.filter((t=>t.id===this.defaultWebmapId)),e=JSON.stringify(t)!==JSON.stringify(this._webMapInfo);this._webMapInfo=i&&s?s[0]:!t?.id&&this.mapInfos.length>0?this.mapInfos[0]:t;const h=this._webMapInfo.id,a=i&&t?.id===this.defaultWebmapId;if(this._loadedId!==h&&!i||a){const t=new this.WebMap({portalItem:{id:h}});this.appProxies&&(await t.load(),await(o=t,l=this.esriConfig,n=this.appProxies,n&&n.forEach((t=>{o.allLayers.forEach((i=>{i&&i.url===t.sourceUrl&&(i.url=v(t.proxyUrl),i.portalItem&&i.portalItem.when((()=>{i.portalItem.url=v(t.proxyUrl)})),l.request?.interceptors?.push({urls:t.sourceUrl,before:i=>{i.url&&i.url===t.sourceUrl&&(i.url=v(t.proxyUrl))}}))}))})),o)),this.mapView=new this.MapView({container:this._mapDiv,map:t,resizeAlign:"center"}),this._loadedId=h,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),await this.mapView.when((()=>{this._initHome(),this.mapView.ui.add(this._mapTools,{position:this.mapWidgetsPosition,index:this.mapWidgetsIndex}),this._defaultWebmapHonored=!!a||this._defaultWebmapHonored,this.mapChanged.emit({id:h,mapView:this.mapView})}))}else i?(this._defaultWebmapHonored=!0,this._mapPicker.setMapByID(h)):e&&(this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapChanged.emit({id:h,mapView:this.mapView}));var o,l,n;this._updateShareUrl()}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),!this.isMobile&&this._toolbar&&this._toolInfos&&(this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const t=this._toolbar.offsetWidth;let i=this._toolbarSizeInfos.reduce(((t,i)=>t+i.width),0);const s=["solutions-more","solutions-map-layer-picker-container","map-picker","solutions-action-share"];if(i>t){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,h)=>(s.indexOf(h.id)<0&&(i>t?i-=h.width:e.push(h)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((t,i)=>(t.push(i.id),t)),[]);let h=!1;const a=[...this._defaultVisibleToolSizeInfos].reduce(((a,o)=>(!h&&s.indexOf(o.id)<0&&(e.indexOf(o.id)>-1||i+o.width<=t)?(e.indexOf(o.id)<0&&(i+=o.width),a.push(o)):s.indexOf(o.id)<0&&i+o.width>t&&(h=!0),a)),[]);this._setControlsThatFit(a,s)}}),250))}_setControlsThatFit(t,i){let s=JSON.stringify(t)!==JSON.stringify(this._controlsThatFit);const e=document.getElementById("solutions-action-bar");e?.childNodes?.forEach((t=>{i.indexOf(t.id)<0&&!s&&(s=this._controlsThatFit.map((t=>t.id)).indexOf(t.id)<0)})),s&&(this._controlsThatFit=[...t])}_setToolbarSizeInfos(){let t=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((i,s)=>{0===s?i.childNodes.forEach((i=>{this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0)})):i.referenceElement||(this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0))})),t&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionBar(){const t=this.mapInfos?.length>1?"":"display-none",i=this.isMapLayout?"display-flex":"display-block",s=this.isMobile?"border-top":"",h=this.isMapLayout?"":"display-none";return e("calcite-action-bar",{class:i,expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},e("map-picker",{class:t,isMapLayout:this.isMapLayout,mapInfos:this.mapInfos,ref:t=>this._mapPicker=t}),e("div",{class:`mapView-header display-flex ${h}`},e("div",{class:`border-end ${i} ${s}`,id:"solutions-map-layer-picker-container"},this.mapView&&e("map-layer-picker",{appearance:"transparent",defaultLayerId:this.defaultLayerId,display:"inline-flex",height:50,isMobile:this.isMobile,mapView:this.mapView,onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",ref:t=>this._mapLayerPicker=t,scale:"l",selectedIds:this.selectedLayer?[this.selectedLayer.id]:[],showSingleLayerAsLabel:!0,showTables:!0,showTablesDisabled:!0,type:"dropdown"}))),!this.isMobile&&this.isMapLayout?this._getActions():void 0)}_getDropdown(t){const i=this._getDropdownItems();return i.length>0?e("calcite-dropdown",{closeOnSelectDisabled:!0,disabled:void 0===this.selectedLayer,id:"solutions-more",onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:t=>this._moreDropdown=t},e("calcite-action",{appearance:"solid",id:t,label:"",onClick:()=>this._closeShowHide(),slot:"trigger",text:""},e("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),e("calcite-dropdown-group",{"selection-mode":"none"},i.map((t=>e("calcite-dropdown-group",{class:t.disabled?"disabled":"",selectionMode:"none"},e("calcite-dropdown-item",{disabled:t.loading,iconStart:t.icon,id:"solutions-subset-list",onClick:t.func},t.loading?e("div",{class:"display-flex"},e("calcite-loader",{inline:!0,label:t.label,scale:"m"}),t.label):t.label)))))):void 0}_getShare(t){return e("div",{class:"share-action",id:this._getId(t)},e("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"instant-app-share",embed:this.shareIncludeEmbed,popoverButtonIconScale:"s",ref:t=>{this._shareNode=t,this._updateShareUrl()},scale:"m",shareButtonColor:"neutral",shareButtonType:"action",socialMedia:this.shareIncludeSocial,view:this.mapView}),this._getToolTip("bottom",t,this._translations.share))}_updateShareUrl(){const t=this._shareNode?.shareUrl;if(!t)return;const i=new URL(t);this._loadedId?i.searchParams.set("webmap",this._loadedId):i.searchParams.delete("webmap"),this.selectedLayer?.id?i.searchParams.set("layer",this.selectedLayer.id):i.searchParams.delete("layer"),this.selectedFeaturesIds?.length>0?i.searchParams.set("oid",this.selectedFeaturesIds.join(",")):i.searchParams.delete("oid"),i.searchParams.set("applayout",this.appLayout),this._shareNode.shareUrl=i.href}_closeShowHide(){this._showHideOpen=!1}_getDropdownItems(){return this._toolInfos?.filter((t=>t&&t.isOverflow))}_initToolInfos(){const t=this.selectedFeaturesIds?.length>0,i=this._hasFilterExpressions(),s=this.selectedFeaturesIds?.length>1&&!1;this._translations&&(this._toolInfos=[{active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>this._zoom(),disabled:!t,isOverflow:!1},i?{active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this._toggleFilter(),disabled:!1,isOverflow:!1}:void 0,s?{active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>alert(this._translations.editMultiple),disabled:!s,isOverflow:!1}:void 0,{active:!1,icon:"refresh",indicator:!1,label:this._translations.refresh,func:()=>this.selectedLayer.refresh(),disabled:!1,isOverflow:!1},{active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>this.clearSelection.emit(),disabled:!t,isOverflow:!1}],this._defaultVisibleToolSizeInfos=void 0)}_validateActiveActions(){const t=["filter"];this._toolInfos?.forEach((i=>{i&&t.indexOf(i.icon)>-1&&"filter"===i.icon&&(i.indicator=this._filterActive)}))}_validateEnabledActions(){const t=this.selectedFeaturesIds?.length>0,i=this.selectedFeaturesIds?.length>1&&this.selectedLayer?.capabilities?.operations?.supportsUpdate,s=["zoom-to-object","pencil","erase"];this._toolInfos?.forEach((e=>{e&&s.indexOf(e.icon)>-1&&(e.disabled="pencil"===e.icon?!i:!t)}))}_initHome(){if(this.enableHome){this._homeWidget=new this.Home({view:this.mapView}),this.mapView.ui.add(this._homeWidget,{position:this.homeZoomPosition,index:this.homeZoomIndex});const t="s"===this.homeZoomToolsSize?"32px":"m"===this.homeZoomToolsSize?"40px":"48px";this._homeWidget.domNode.style.height=t,this._homeWidget.domNode.style.width=t}else this._homeWidget&&this.mapView.ui.remove(this._homeWidget)}_toggleShowHide(){this._showHideOpen=!this._showHideOpen}_forceShowHide(){this._moreDropdown&&(this._moreDropdown.open=this._showHideOpen)}_handleDocumentClick(t){const i=t.target?.id;"solutions-subset-list"===i?this._moreDropdown.open=!0:this._showHideOpen&&"solutions-subset-list"!==i&&"solutions-more"!==i&&"chevron-down"!==i&&this._moreDropdown&&(this._showHideOpen=!1,this._moreDropdown.open=!1),"MAP-PICKER"===t.target.tagName&&(this._mapListExpanded=!this._mapListExpanded,this._mapPicker.toggle(this._mapListExpanded)),"MAP-PICKER"!==t.target.tagName&&(this._mapListExpanded=!1,this._mapPicker.close())}async _zoom(){if(this.selectedLayer){const t=await b(this.mapView,this.selectedLayer.id);await c(this.selectedFeaturesIds,t,this.mapView,!0,void 0,this.zoomToScale)}}async _toggleFilter(){this.toggleFilter.emit()}_hasFilterExpressions(){let t;return this.mapInfo?.filterConfig?.layerExpressions&&this.selectedLayer?.id&&(t=this.mapInfo.filterConfig.layerExpressions.filter((t=>t.id===this.selectedLayer.id))),t?.length>0}_getActions(){const t=this._getActionItems();return t?.reduce(((t,i)=>(i&&!i.isOverflow&&t.push(this._getAction(i.active,i.icon,i.indicator,i.label,i.func,i.disabled,i.loading)),t)),[])}_getToolTip(t,i,s){return document.getElementById(i)?e("calcite-tooltip",{placement:t,"reference-element":"map-"+i},e("span",null,s)):void 0}_getActionItems(){return this._toolInfos?.filter((t=>t&&!t.isOverflow))}_getAction(t,i,s,h,a,o,l,n){const c=void 0===this.selectedLayer||o;return e("div",{class:"display-flex",id:this._getId(i),slot:n},e("calcite-action",{active:t,appearance:"solid",disabled:c,icon:i,id:"map-"+i,indicator:s,label:h,loading:l,onClick:a,text:h,textEnabled:!0}),this._getToolTip("bottom",i,h))}_getId(t){return`solutions-action-${t}`}async _getTranslations(){const t=await a(this.el);this._translations=t[0]}static get watchers(){return{appLayout:["appLayoutWatchHandler"],enableHome:["enableHomeWatchHandler"],enableShare:["enableShareWatchHandler"],mapView:["mapViewWatchHandler"],selectedLayer:["selectedLayerWatchHandler"],selectedFeaturesIds:["selectedFeaturesIdsWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"]}}};y.style=":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 53px)}.height-full{height:100%}.height-49-px{height:49px}.box-shadow{box-shadow:none !important}.visibility-hidden-1{visibility:hidden;height:1px;}.display-none{display:none}.display-block{display:block}";export{u as card_manager,m as layer_table,y as map_card}
6
+ import{r as t,c as i,g as s,h as e,H as h}from"./p-4e6eb06e.js";import{g as a,l as o}from"./p-f4aadb3b.js";import{g as l,q as n,e as c,f as d,i as r,j as p,c as b}from"./p-d572627c.js";import{d as f}from"./p-ff9e28d1.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";import"./p-7530a02f.js";import"./p-d0d020a5.js";import"./p-9bb44f57.js";const u=class{constructor(s){t(this,s),this.createWorkFlowStarted=i(this,"createWorkFlowStarted",7),this.backFromCreateWorkFlow=i(this,"backFromCreateWorkFlow",7),this.featureOrRecordSubmitted=i(this,"featureOrRecordSubmitted",7),this.customInfoText=void 0,this.enableEditGeometry=!1,this.isMobile=void 0,this.layer=void 0,this.mapView=void 0,this.zoomAndScrollToSelected=void 0,this.selectedFeaturesIds=void 0,this.enableCreateFeatures=!0,this.selectingFeatureFromMap=void 0,this._cardLoading=!1,this._graphics=void 0,this._showCreateFeatureComponent=!1,this._showSubmitBtn=!1,this._translations=void 0}get el(){return s(this)}_isFeatureCreated=!1;_createFeature;createWorkFlowStarted;backFromCreateWorkFlow;featureOrRecordSubmitted;async featureSelectionChange(t){this._showCreateFeatureComponent&&!this._isFeatureCreated&&this._backFromCreateFeature();const i=t.detail;this._graphics=await this._getFeaturesByIds(i)}async layerSelectionChange(t){this._showCreateFeatureComponent&&this._backFromCreateFeature();const i=t.detail[0];this.layer=await l(this.mapView,i)}async componentWillLoad(){await this._getTranslations(),this.selectedFeaturesIds?.length>0&&(this._graphics=await this._getFeaturesByIds(this.selectedFeaturesIds))}render(){const t=this._graphics?.length>0?"":"display-none",i=0===this._graphics?.length&&this._showCreateFeatureComponent?"":"display-none",s=this._graphics?.length>0||this._showCreateFeatureComponent?"display-none":"",a=this.layer?.isTable,o=a?this._translations.createRecord:this._translations.createFeature,l=this.customInfoText?this.customInfoText:this.selectingFeatureFromMap?this._translations.selectFeaturesFromMapToStart:this._translations.selectFeaturesToStart,n=this.enableCreateFeatures&&this.layer?.capabilities?.operations?.supportsAdd;return e(h,{key:"7360aa9c48dd0c3e4a14fe0833b99c301388f93c"},e("div",{key:"9d610f0c4728c238eceb790e97a4e06b77f1a2d1",class:"overflow-auto height-full"},e("calcite-shell",{key:"4b6a02205a971c7ff61aab567b2f2a3c5d288f8d",class:"position-relative "+t},e("div",{key:"96ee8ce138265dd4b562ac0a33b79a0db4497842",class:"position-static z-index-500"},e("info-card",{key:"7db359bc1016281fd01b737dc5c424fe78995422",enableEditGeometry:this.enableEditGeometry,graphics:this._graphics,isLoading:this._cardLoading,isMobile:this.isMobile,mapView:this.mapView}))),e("calcite-shell",{key:"afc8d06e9aa3213a9ca10c929497ed4618a28e91",class:"position-relative "+s},e("calcite-flow-item",{key:"46db92a6e259eefea3293310e3e2f43d7639db97"},e("calcite-panel",{key:"d2bc23ae7bcf2b7b7b48a35efc0697e0d1f9e23e"},e("div",{key:"8f7fd13f9ec99beec1d7231dda03eba403a70a69",class:"padding-1"},e("calcite-notice",{key:"2fbe94292c1dd91ee1691b8e3d295225ff5b534b",icon:this.selectingFeatureFromMap?"map":"table",iconFlipRtl:!0,open:!0},e("div",{key:"9f91099e4bfa0675c5b098a73b2f132b80ee76b0",slot:"message"},l))),!this.isMobile&&n&&e("calcite-button",{key:"c1b04e776f3750712992d736e09726cc26eae5db",disabled:!this.layer,onClick:()=>this._createFeatureBtnClicked(),slot:"footer",width:"full"},a?this._translations.createRecord:this._translations.createFeature)))),e("calcite-shell",{key:"a71d4b0abd1ec1a4ed14a2cb3dcb10a075f54bf0",class:"position-relative "+i},e("calcite-flow-item",{key:"85047b527f5995a912b527325f287c3596caf630"},e("calcite-panel",{key:"d335be81502e0feb803ee9ad4e501d4c85f184f5",heading:o},e("calcite-action",{key:"b179c3185dbada3bd052d38b98b75cf29240655c",class:"back-button hydrated",icon:"chevron-left",onClick:this._backFromCreateFeature.bind(this),scale:"s",slot:"header-actions-start",text:""}),this.getEditorComponent(),this._showSubmitBtn&&e("calcite-button",{key:"f3b6655e3effdb6b09e64acd651a09d6028a6df9",appearance:"solid",class:"footer-top-button footer-button",onClick:()=>{this._createFeature.submit()},slot:"footer",width:"full"},this._translations.create))))))}getEditorComponent(){return e("div",null,this._showCreateFeatureComponent&&e("create-feature",{customizeSubmit:!0,mapView:this.mapView,onDrawComplete:()=>{this._showSubmitBtn=!0},onEditingAttachment:t=>{this._showSubmitBtn=!t.detail},onProgressStatus:()=>{setTimeout((()=>{this._isFeatureCreated=!1}),2e3)},onSuccess:this._featureCreated.bind(this),ref:t=>this._createFeature=t,selectedLayerId:this.layer?.id,showGuidingMsgWhileDrawing:!1}))}async _getFeaturesByIds(t){return(t.length>0?await n(t,this.layer,[],!0,this.mapView.spatialReference):[]).sort(((i,s)=>t.indexOf(i.getObjectId())-t.indexOf(s.getObjectId())))}_createFeatureBtnClicked(){this._showCreateFeatureComponent=!0,this.createWorkFlowStarted.emit()}async _backFromCreateFeature(){this._createFeature&&(this._showCreateFeatureComponent=!1,this.backFromCreateWorkFlow.emit()),this._showSubmitBtn=!1}_featureCreated(){this._showCreateFeatureComponent=!1,this._showSubmitBtn=!1,this._isFeatureCreated=!0,this.featureOrRecordSubmitted.emit(),setTimeout((()=>{this._showCreateFeatureComponent=!0}),50)}async _getTranslations(){const t=await a(this.el);this._translations=t[0]}};u.style=":host{display:block !important}.display-flex{display:flex}.display-none{display:none}.w-100{width:100%}.padding-bottom-1{padding-bottom:1rem}.padding-1{padding:1rem}.position-relative{position:relative}.focus-margin{margin:1px 1px 0px 1px}.overflow-auto{overflow:auto}.height-full{height:100%}.position-static{position:static !important}.z-index-500{z-index:500 !important}card-manager{display:block}";const m=class{constructor(s){t(this,s),this.featureSelectionChange=i(this,"featureSelectionChange",7),this.toggleFilter=i(this,"toggleFilter",7),this.appLayout=void 0,this.defaultGlobalId=void 0,this.defaultLayerId=void 0,this.defaultOid=void 0,this.enableAutoRefresh=void 0,this.enableColumnReorder=!0,this.enableCSV=void 0,this.enableInlineEdit=void 0,this.enableShare=void 0,this.isMobile=void 0,this.mapHidden=void 0,this.mapInfo=void 0,this.mapView=void 0,this.onlyShowUpdatableLayers=void 0,this.selectedIds=[],this.shareIncludeEmbed=void 0,this.shareIncludeSocial=void 0,this.showNewestFirst=void 0,this.zoomAndScrollToSelected=void 0,this.zoomToScale=void 0,this.createFilterModal=!0,this._allIds=[],this._controlsThatFit=void 0,this._csvExporting=!1,this._fetchingData=!1,this._filterActive=!1,this._filterOpen=!1,this._layer=void 0,this._selectAllActive=!1,this._deleteDialogOpen=!1,this._showHideOpen=!1,this._showOnlySelected=!1,this._toolInfos=void 0,this._translations=void 0,this._fullTextSearchInfo=void 0,this._searchPlaceHolder="",this._size=0}get el(){return s(this)}FeatureTable;TableTemplate;_columnsInfo;_ctrlIsPressed=!1;_currentId;_editEnabled;_defaultFilterHonored=!1;_defaultGlobalIdHonored=!1;_defaultOidHonored=!1;_defaultVisibleToolSizeInfos;_definitionExpression;_deleteEnabled;_filterList;_floorExpression;_floorField;_floorFacility;_floorLevel;_floorSite;_layerExpressions;_loaded=!1;_mapClickHandle;_observerSet=!1;_previousCurrentId;reactiveUtils;_refreshHandle;_resizeObserver;_selectAllElement;_selectionFromMap=!1;_shareNode;_shiftIsPressed=!1;_showHideDropdown;_skipOnChange=!1;_moreDropdown;_table;_tableNode;_timeout;_toolbar;_toolbarSizeInfos;_searchExpression;appLayoutWatchHandler(){this._updateShareUrl()}async defaultOidWatchHandler(){await this._handleDefaults()}async defaultGlobalIdWatchHandler(){await this._handleDefaults()}enableCSVWatchHandler(){this._toolInfos?.length>0&&this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}enableShareWatchHandler(){this._toolbar&&this._updateToolbar()}_controlsThatFitWatchHandler(){const t=this._controlsThatFit?this._controlsThatFit.reduce(((t,i)=>(t.push(i.id),t)),[]):[];this._toolInfos=this._toolInfos?.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}mapHiddenWatchHandler(){this._toolInfos?.length>0&&this._initToolInfos()}isMobileWatchHandler(){this._toolInfos||this.isMobile||this._initToolInfos()}async mapInfoWatchHandler(){this._resetColumnTemplates(),this.createFilterModal&&this._initLayerExpressions(),this._initToolInfos(),this._updateToolbar(),await this._sortTable()}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._floorExpression=void 0,this._searchExpression=void 0,this._updateShareUrl(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(t=>{this._mapClicked(t)})))}async _layerWatchHandler(){this._fetchingData=!0,await(this._layer?.when((async()=>{this._definitionExpression=this._layer.definitionExpression,this._floorField=this._layer.floorInfo?.floorField,this._updateFloorDefinitionExpression(),await this._resetTable(),this.createFilterModal&&this._initLayerExpressions(),this._updateShareUrl(),this._fetchingData=!1})))}async selectedIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions(),this._selectAllActive&&this.selectedIds.length!==this._allIds.length&&(this._selectAllActive=!1),this.selectedIds.length>0&&(this._table.rowHighlightIds.removeAll(),this._table.rowHighlightIds.add(this.selectedIds[0]))}async filterReset(){await this._handleFilterListReset()}async filterUpdate(){await this._handleFilterUpdate()}async closeFilter(){await this._closeFilter()}async refresh(){this._table&&await this._refresh()}featureSelectionChange;toggleFilter;async selectionChanged(t){const i=t.detail.selectedFeature[0],s=i.getObjectId(),e=this._table;if(e.rowHighlightIds.length&&e.rowHighlightIds.removeAll(),e.rowHighlightIds.add(s),this.zoomAndScrollToSelected){const t=this._table.viewModel.getObjectIdIndex(s);this._table.scrollToIndex(t);const e=i.layer;let h;this.mapView.allLayerViews.toArray().some((t=>{if(t.layer.title===e.title&&"feature"===t.layer.type)return h=t,!0})),h&&await c([s],h,this.mapView,!0,void 0,this.zoomToScale)}}async layerSelectionChange(t){await this._layerSelectionChanged(t)}async editsComplete(t){const i=t.detail;"delete"!==i&&"add"!==i||(this._allIds=await d(this._layer)),await this._refresh()}async facilityChanged(t){this._floorFacility=t.detail,this._updateFloorDefinitionExpression()}async levelChanged(t){this._floorLevel=t.detail,this._updateFloorDefinitionExpression()}async siteChanged(t){this._floorSite=t.detail,this._updateFloorDefinitionExpression()}noLayersFound(){this._layer=void 0,this._allIds=[],this._clearSelection()}clearSelection(){this._clearSelection()}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initToolInfos(),this._resizeObserver||(this._resizeObserver=new ResizeObserver((()=>this._onResize())))}render(){const t=this._fetchingData?"display-none":"",i=this._fetchingData?"":"display-none",s=this._size.toString(),a=this.selectedIds.length.toString(),o=this.isMobile?"height-full":"height-full-adjusted",l=this._canShowFullTextSearch();return this._validateActiveActions(),e(h,{key:"04fccaaa9862ed315d99ad74f7e1135dd5656613"},e("calcite-shell",{key:"e332d781be1499857a5e17e37ad2e058bba453b1"},this._getTableControlRow("header"),e("div",{key:"6337e494f879c250494c5f5859daec627fdd0700",class:`width-full ${o}`},e("calcite-panel",{key:"d0d437997906fd15f97765cb89c3917f66b20c37",class:"height-full width-full"},l&&e("div",{key:"596a2d54fd707941d9e2ec167598313d9ee9b295",class:"search-container"},e("calcite-input",{key:"31cd1ffb09bc2c6c9c1f9daf39f3e9549cbceeb2",class:"search",clearable:!0,icon:"search",onCalciteInputChange:t=>{this._searchTextChanged(t)},placeholder:this._searchPlaceHolder,title:this._searchPlaceHolder,type:"search"})),e("calcite-loader",{key:"b4ba3d32fb346134672e08d55428bd38ac43f40d",class:i,label:this._translations.fetchingData,scale:"l"}),e("div",{key:"4fbac73935be7a1163643543e6d77a200534e5e3",class:t,ref:this.onTableNodeCreate}))),this.isMobile?void 0:e("div",{class:"bottom-left text-color height-19"},this._translations.recordsSelected.replace("{{total}}",s).replace("{{selected}}",a))),this.createFilterModal&&this._filterModal(),e("delete-dialog",{key:"3b0dba8bc391d777f4687ad6f4e905aeb1eb580b",id:"deleteDialogId",ids:this._getIds(),layer:this._layer,onDeleteDialogClose:()=>this._deleteDialogOpen=!1,open:this._deleteDialogOpen,ref:t=>this._deleteDialog=t}))}_deleteDialog;async componentDidLoad(){this.isMobile||this._observerSet||(this._resizeObserver.observe(this._toolbar),this._observerSet=!0)}componentDidRender(){document.onclick=t=>this._handleDocumentClick(t),document.onkeydown=t=>this._handleKeyDown(t),document.onkeyup=t=>this._handleKeyUp(t),this._updateToolbar()}async _initModules(){const[t,i,s]=await o(["esri/widgets/FeatureTable","esri/core/reactiveUtils","esri/widgets/FeatureTable/support/TableTemplate"]);this.FeatureTable=t,this.reactiveUtils=i,this.TableTemplate=s}async _searchTextChanged(t){this._fullTextSearchInfo.forEach((i=>{i.searchTerm=t.target.value})),this._searchFullText()}async _searchFullText(){if(this._searchExpression&&this._clearSearchDefinitionExpression(),this._fullTextSearchInfo.length&&this._fullTextSearchInfo[0].searchTerm){const t=this._layer.createQuery();t.fullText=this._fullTextSearchInfo;const i=await this._layer.queryObjectIds(t);await this._updateSearchDefinitionExpression(i?.length?i:[-1])}await new Promise((t=>setTimeout(t,800))),await this._updateAllIds()}_clearSearchDefinitionExpression(){const t=this._layer.definitionExpression;this._searchExpression&&t?.indexOf(this._searchExpression)>-1&&(this._layer.definitionExpression=t?.indexOf(" AND ("+this._searchExpression)>-1?t.replace(` AND (${this._searchExpression})`,""):t.replace(this._searchExpression,"")),this._searchExpression=void 0}async _updateSearchDefinitionExpression(t){const i=this._layer.definitionExpression;if(t?.length){const s=`objectId in(${t})`;this._layer.definitionExpression=i?.indexOf(this._searchExpression)>-1?i.replace(this._searchExpression,s):i?`${i} AND (${s})`:s,this._searchExpression=s}else this._clearSearchDefinitionExpression()}_canShowFullTextSearch(){return((this._layer?.capabilities)?.query)?.supportsFullTextSearch&&this._layer.indexes.items.filter((t=>"FullText"==t.indexType)).length>0}_getFullTextSearchInfo(){if(this._fullTextSearchInfo=[],((this._layer?.capabilities)?.query)?.supportsFullTextSearch){const t=this._layer.indexes?.filter((t=>"FullText"==t.indexType));if(t?.length){const i=[];t.forEach((t=>{i.push(...t.fields.split(","))}));const s=[];i.forEach((t=>{const i=this._layer.getField(t.trim());s.push(i.alias)})),this._searchPlaceHolder=this._translations.searchPlaceholder.replace("{{fields}}",s.join(", ")),this._fullTextSearchInfo.push({onFields:["*"],searchTerm:"",searchType:"prefix"})}}}_onResize(){this._updateToolbar()}_getTableControlRow(t){const i=this._canShowFullTextSearch()?"border-bottom":"";return e("div",{class:`display-flex height-51-px ${i}`,ref:t=>this._toolbar=t,slot:t},this._getActionBar(),this.isMobile?void 0:this._getDropdown("more-table-options"),this.enableShare&&!this.isMobile?this._getShare("share"):void 0)}_getActionBar(){const t=this.isMobile?"width-full":"",i=this.isMobile?"border-top":"";return e("calcite-action-bar",{class:t,expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},e("div",{class:`border-end ${t} ${i}`,id:"solutions-map-layer-picker-container"},e("map-layer-picker",{appearance:"transparent",defaultLayerId:this.defaultLayerId,display:"inline-flex",height:50,isMobile:this.isMobile,mapView:this.mapView,onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",scale:"l",selectedIds:this._layer?[this._layer?.id]:[],showSingleLayerAsLabel:!0,showTables:!0,type:"dropdown"})),this.isMobile?void 0:this._getActions())}_getActions(){const t=this._getActionItems();return t?.reduce(((t,i)=>(i&&!i.isOverflow&&t.push(i.isDanger?this._getDangerAction(i.icon,i.label,i.func,i.disabled):i.isSublist?e("calcite-dropdown",{closeOnSelectDisabled:!0,id:this._getId(i.icon),onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:t=>this._showHideDropdown=t},this._getAction(i.active,this._showHideOpen?"chevron-down":i.icon,i.indicator,i.label,i.func,i.disabled,i.loading,"trigger"),this._showHideOpen?this._getFieldlist():void 0):this._getAction(i.active,i.icon,i.indicator,i.label,i.func,i.disabled,i.loading)),t)),[])}_getFieldlist(){return this._columnsInfo?e("calcite-dropdown-group",{"selection-mode":"multiple"},Object.keys(this._columnsInfo).map((t=>{const i=this._columnsInfo[t];return e("calcite-dropdown-item",{id:`layer-table-${t.toLowerCase().replaceAll(" ","")}`,label:t,onClick:t=>{const i=t.target;this._columnsInfo[i.label]=i.selected,i.selected?this._table.showColumn(i.label):this._table.hideColumn(i.label)},selected:i},t)}))):void 0}_validateEnabledActions(){const t=this._featuresSelected(),i=this.selectedIds.length>1&&this._layer?.capabilities?.operations?.supportsUpdate,s=["zoom-to-object","pencil","trash","erase","selected-items-filter"];this._toolInfos?.forEach((e=>{e&&s.indexOf(e.icon)>-1&&(e.disabled="pencil"===e.icon?!i:!t)}))}_validateActiveActions(){const t=["filter","list-check-all","selected-items-filter"];this._toolInfos?.forEach((i=>{i&&t.indexOf(i.icon)>-1&&("filter"===i.icon&&(i.indicator=this._filterActive),"list-check-all"===i.icon&&(i.active=this._selectAllActive),"selected-items-filter"===i.icon&&(i.active=this._showOnlySelected))}))}_initToolInfos(){const t=this._featuresSelected(),i=this.selectedIds.length>1&&this._layer?.capabilities?.operations?.supportsUpdate&&!1,s=this._featuresEmpty(),e=this._hasFilterExpressions();this._translations&&(this._toolInfos=[this.mapHidden?void 0:{active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>this._zoom(),disabled:!t,isOverflow:!1},e?{active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this.createFilterModal?this._toggleFilter():this.toggleFilter.emit(),disabled:!1,isOverflow:!1}:void 0,i?{active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>alert(this._translations.editMultiple),disabled:!i,isOverflow:!1}:void 0,this._deleteEnabled?{active:void 0,icon:"trash",indicator:void 0,label:this._translations.delete,func:()=>this._showDelete(),disabled:!t,isDanger:!0,isOverflow:!1}:void 0,{active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>this._clearSelection(),disabled:!t,isOverflow:!1},{active:!1,icon:"selected-items-filter",indicator:!1,label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!t,isOverflow:!1},{active:!1,icon:"list-check-all",indicator:!1,func:()=>this._selectAll(),label:this._translations.selectAll,disabled:s,isOverflow:!1},{active:!1,icon:"compare",indicator:!1,func:()=>this._switchSelected(),label:this._translations.switchSelected,disabled:s,isOverflow:!1},{active:!1,icon:"refresh",indicator:!1,func:()=>this._refresh(),label:this._translations.refresh,disabled:!1,isOverflow:!1},this.enableCSV?{active:!1,icon:"export",indicator:!1,func:()=>{this._exportToCSV()},label:this._translations.exportCSV,loading:this._csvExporting,disabled:s,isOverflow:!1}:void 0,{active:!1,icon:this._showHideOpen?"chevron-down":"chevron-right",indicator:!1,func:()=>this._toggleShowHide(),label:this._translations.showHideColumns,disabled:!1,isOverflow:!1,isSublist:!0}],this._defaultVisibleToolSizeInfos=void 0)}_updateFloorDefinitionExpression(){if(this._floorField&&this._floorLevel){const t=`${this._floorField} = '${this._floorLevel}'`,i=this._layer.definitionExpression;this._layer.definitionExpression=i?.indexOf(this._floorExpression)>-1?i.replace(this._floorExpression,t):i?`${i} AND (${t})`:t,this._floorExpression=t}}_featuresSelected(){return this.selectedIds.length>0}_featuresEmpty(){return 0===this._allIds.length}_hasFilterExpressions(){let t;return this.mapInfo?.filterConfig?.layerExpressions&&this._layer?.id&&(t=this.mapInfo.filterConfig.layerExpressions.filter((t=>t.id===this._layer.id))),t?.length>0}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),!this.isMobile&&this._toolbar&&this._toolInfos&&(this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const t=this._toolbar.offsetWidth;let i=this._toolbarSizeInfos.reduce(((t,i)=>t+i.width),0);const s=["solutions-more","solutions-map-layer-picker-container","solutions-action-share"];if(i>t){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,h)=>(s.indexOf(h.id)<0&&(i>t?i-=h.width:e.push(h)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((t,i)=>(t.push(i.id),t)),[]);let h=!1;const a=[...this._defaultVisibleToolSizeInfos].reduce(((a,o)=>(!h&&s.indexOf(o.id)<0&&(e.indexOf(o.id)>-1||i+o.width<=t)?(e.indexOf(o.id)<0&&(i+=o.width),a.push(o)):s.indexOf(o.id)<0&&i+o.width>t&&(h=!0),a)),[]);this._setControlsThatFit(a,s)}}),250))}_setControlsThatFit(t,i){let s=JSON.stringify(t)!==JSON.stringify(this._controlsThatFit);const e=document.getElementById("solutions-action-bar");e?.childNodes?.forEach((t=>{i.indexOf(t.id)<0&&!s&&(s=this._controlsThatFit.map((t=>t.id)).indexOf(t.id)<0)})),s&&(this._controlsThatFit=[...t])}_setToolbarSizeInfos(){let t=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((i,s)=>{0===s?i.childNodes.forEach((i=>{this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0)})):i.referenceElement||(this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0))})),t&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionItems(){return this._toolInfos?.filter((t=>t&&!t.isOverflow))}_getDropdown(t){const i=this._getDropdownItems();return i.length>0?e("calcite-dropdown",{closeOnSelectDisabled:!0,disabled:void 0===this._layer,id:"solutions-more",onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:t=>this._moreDropdown=t},e("calcite-action",{appearance:"solid",id:t,label:"",onClick:()=>this._closeShowHide(),slot:"trigger",text:""},e("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),e("calcite-dropdown-group",{"selection-mode":"none"},i.map((t=>e("calcite-dropdown-group",{class:`${t.disabled?"disabled":""} ${"trash"===t.icon?"delete-red":""}`,selectionMode:"none"},e("calcite-dropdown-item",{disabled:t.loading,iconStart:t.isSublist&&this._showHideOpen?"chevron-down":t.loading?"":t.icon,id:`layer-table-${t.icon}`,onClick:t.func},t.loading?e("div",{class:"display-flex"},e("calcite-loader",{inline:!0,label:t.label,scale:"m"}),t.label):t.label))))),this._showHideOpen?this._getFieldlist():void 0):void 0}_getDropdownItems(){return this._toolInfos?.filter((t=>t&&t.isOverflow))}_getAction(t,i,s,h,a,o,l,n){const c=void 0===this._layer||o;return e("div",{class:"display-flex",id:this._getId(i),slot:n},e("calcite-action",{active:t,appearance:"solid",disabled:c,icon:i,id:`layer-table-${i}`,indicator:s,label:h,loading:l,onClick:a,text:h,textEnabled:!0}),this._getToolTip("bottom",i,h))}_showDelete(){this._deleteDialogOpen=!0}_getShare(t){return e("div",{class:"share-action",id:this._getId(t)},e("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"instant-app-share",embed:this.shareIncludeEmbed,popoverButtonIconScale:"s",ref:t=>this._shareNode=t,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",socialMedia:this.shareIncludeSocial,view:this.mapView}),this._getToolTip("bottom",t,this._translations.share))}_updateShareUrl(){const t=this._shareNode?.shareUrl;if(!t)return;const i=new URL(t);this.mapInfo?.id?i.searchParams.set("webmap",this.mapInfo.id):i.searchParams.delete("webmap"),this._layer?.id?i.searchParams.set("layer",this._layer.id):i.searchParams.delete("layer"),this.selectedIds?.length>0?i.searchParams.set("oid",this.selectedIds.join(",")):i.searchParams.delete("oid"),i.searchParams.set("applayout",this.appLayout),this._shareNode.shareUrl=i.href}_getToolTip(t,i,s){return document.getElementById(i)?e("calcite-tooltip",{placement:t,"reference-element":i},e("span",null,s)):void 0}_getId(t){return`solutions-action-${t}`}_getDangerAction(t,i,s,h){const a=void 0===this._layer||h;return e("div",{class:"display-flex",id:this._getId(t)},"trash"===t?e("delete-button",{buttonType:"action",class:"display-flex",disabled:a,icon:t,id:"solutions-delete",ids:this._getIds(),layer:this._layer}):e("calcite-action",{appearance:"solid",disabled:a,id:t,onClick:s,text:i},e("calcite-button",{appearance:"transparent",iconStart:t,kind:"danger"},i)),this._getToolTip("bottom",t,i))}_getIds(){return this._table?.highlightIds?.toArray()}onTableNodeCreate=t=>{this._tableNode=t};async _getTable(t,i){this._layer&&(await this._layer.when((()=>{this._table=new this.FeatureTable({autoRefreshEnabled:this.enableAutoRefresh,layer:this._layer,view:this.mapView,columnReorderingEnabled:this.enableColumnReorder,editingEnabled:this._editEnabled&&this.enableInlineEdit,highlightEnabled:!0,multiSortEnabled:!1,visibleElements:{header:!1,menu:!1},tableTemplate:{columnTemplates:i},container:t})})),await this._table.when((()=>{this._table.highlightIds.on("change",(t=>{this._handleOnChange(t)}));const t=this.reactiveUtils.watch((()=>this._table.size),(t=>{this._size=t}));this._table.viewModel.addHandles(t)})))}async _handleOnChange(t){const i=[...this._table.highlightIds.toArray()];if(this._skipOnChange)this._skipOnChange=!1;else{if(!this._ctrlIsPressed&&!this._shiftIsPressed||this._selectionFromMap&&this._shiftIsPressed)if(this.selectedIds.length>0){this._skipOnChange=!0;const s=this.selectedIds.length>1&&1===t.removed.length?t.removed:i.filter((t=>this.selectedIds.indexOf(t)<0));this._clearSelection(),this.selectedIds=[...s],s.length>0?this._table.highlightIds.add(s[0]):this._skipOnChange=!1}else this.selectedIds=i.reverse();else if(this._ctrlIsPressed)this.selectedIds=i.reverse();else if(this._shiftIsPressed&&i?.length>0)if(this._skipOnChange=!0,this._previousCurrentId=this._currentId,this._currentId=[...i].reverse()[0],1===i.length)this._skipOnChange=!1;else if(this._previousCurrentId!==this._currentId){const t=this._table.activeSortOrders.reduce(((t,i)=>(t.push(`${i.fieldName} ${i.direction}`),t)),[]),s=await r(0,this._layer,[],t);let e=!1;const h=this._table.viewModel.getObjectIdIndex(this._previousCurrentId),a=this._table.viewModel.getObjectIdIndex(this._currentId);this._skipOnChange=(h<a?h:a)+1!==(a>h?a:h);const o=s.reduce(((t,i)=>{const s=i;return s===this._currentId||s===this._previousCurrentId?(e=!e,t.indexOf(s)<0&&t.push(s)):e&&t.indexOf(s)<0&&t.push(s),t}),[]),l=h<a?o.reverse():o;this.selectedIds=[...new Set([...l,...this.selectedIds])],this._table.highlightIds.addMany(this.selectedIds.filter((t=>i.indexOf(t)<0)))}this._finishOnChange()}this._currentId=[...this._table.highlightIds.toArray()].reverse()[0],this._selectionFromMap=!1}_finishOnChange(){this._showOnlySelected&&(this._featuresSelected()?this._table.filterBySelection():this._toggleShowSelected()),this.featureSelectionChange.emit(this.selectedIds)}_resetColumnTemplates(){const t=this._getColumnTemplates(this._layer?.id,this._layer?.fields),i=t?.some(((t,i)=>JSON.stringify(this._table?.tableTemplate.columnTemplates[i])!==JSON.stringify(t)));if(this._table&&t&&(i||!this._columnsInfo)){this._table.tableTemplate=new this.TableTemplate({columnTemplates:t});const i=t.map((t=>t.fieldName));this._initColumnsInfo(i)}}async _resetTable(){if(this._loaded=!1,this._clearSelection(),this._allIds=await d(this._layer),this._table)this._table.view=this.mapView,this._table.layer=this._layer;else{const t=this._getColumnTemplates(this._layer.id,this._layer?.fields);await this._getTable(this._tableNode,t)}await this._initLayerRefresh(),this._checkEditEnabled(),this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,await this._table.when(),setTimeout((()=>{this._loaded||(console.log(`table.state: ${this._table.state}`),this.finishLoading())}),1e3),await this.reactiveUtils.once((()=>"loaded"===this._table.state)).then((async()=>{await this.finishLoading()}))}async finishLoading(){try{this._loaded=!0,this._table.highlightIds.removeAll(),this._table.clearSelectionFilter(),this._resetColumnTemplates(),this._showOnlySelected=!1,await this._handleDefaults(),await this._sortTable(),this._initToolInfos(),this._updateToolbar()}catch(t){console.log(t)}}async _initLayerRefresh(){this._refreshHandle&&this._refreshHandle.remove(),this._refreshHandle=this._layer.on("refresh",(t=>{t.dataChanged&&(this._skipOnChange=!0,this._updateAllIds())}))}async _updateAllIds(){this._allIds=await d(this._layer),this.selectedIds=this.selectedIds.filter((t=>this._allIds.indexOf(t)>-1)),await this._refresh()}async _handleDefaults(){if(!this._defaultOidHonored&&this.defaultOid?.length>0&&this.defaultOid[0]>-1&&this._table&&(await this._selectDefaultFeature(this.defaultOid),this._defaultOidHonored=!0,this.defaultOid=void 0,this._showOnlySelected=!1,this._toggleShowSelected()),!this._defaultGlobalIdHonored&&this.defaultGlobalId?.length>0&&this._table){const t=await p(this.defaultGlobalId,this._layer),i=t?.length>0?t.map((t=>t.getObjectId())):void 0;i&&await this._selectDefaultFeature(i),this._defaultGlobalIdHonored=!0,this.defaultGlobalId=void 0,this._showOnlySelected=!1,this._toggleShowSelected()}}_initColumnsInfo(t){const i=this._table?.columns.reduce(((i,s)=>((!t||t?.indexOf(s.name)>-1)&&(i[s.name]=!s.hidden),i)),{}),s=this._table?.columns.map((t=>t.name));(t?t.filter((t=>s.indexOf(t)<0)):[]).forEach((t=>{i[t]=!0})),this._columnsInfo=t?t.reduce(((t,s)=>(t[s]=i[s],t)),{}):i}async _selectDefaultFeature(t){t.length>0&&this._table.highlightIds.addMany(t)}_checkEditEnabled(){this._editEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsUpdate,this._deleteEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsDelete}async _sortTable(){let t,i=this._layer?.objectIdField,s="desc";this.mapInfo?.layerOptions?.layers?.length>0&&this._layer?.id&&(t=this.mapInfo.layerOptions.layers.filter((t=>t.id===this._layer.id)),t&&t.length>0&&(t=t[0],t.sortField&&t.fields?.includes(t.sortField)&&(i=t.sortField),s=t?.sortOrder?t.sortOrder:"desc")),this._table&&this._layer&&(await this._table.when(),await this._layer.when((()=>{this._table.sortColumn(i,s)})))}_forceShowHide(){this._showHideDropdown&&(this._showHideDropdown.open=this._showHideOpen),this._moreDropdown&&(this._moreDropdown.open=this._showHideOpen)}_toggleShowHide(){this._showHideOpen=!this._showHideOpen}_closeShowHide(){this._showHideOpen=!1}_handleDocumentClick(t){const i=t.target?.id;i.startsWith("layer-table-")?this._moreDropdown.open=!0:this._showHideOpen&&Object.keys(this._columnsInfo).indexOf(i)<0&&"chevron-right"!==i&&(this._closeShowHide(),this._moreDropdown&&(this._moreDropdown.open=!1),this._showHideDropdown&&(this._showHideDropdown.open=!1))}_handleKeyDown(t){this._ctrlIsPressed=t.ctrlKey,this._shiftIsPressed=t.shiftKey}_handleKeyUp(t){this._ctrlIsPressed=t.ctrlKey,this._shiftIsPressed=t.shiftKey}_filterModal(){return e("calcite-modal",{"aria-labelledby":"modal-title",class:"modal",kind:"brand",onCalciteModalClose:()=>{this._closeFilter()},open:this._filterOpen,widthScale:"s"},e("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},this._translations?.filter?.replace("{{title}}",this._layer?.title)),e("div",{slot:"content"},e("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtn:!0,closeBtnOnClick:async()=>this._closeFilter(),comboboxOverlayPositioning:"fixed",layerExpressions:this._layerExpressions,onFilterListReset:()=>{this._handleFilterListReset()},onFilterUpdate:()=>{this._handleFilterUpdate()},ref:t=>this._filterList=t,view:this.mapView,zoomBtn:!1})))}async _handleFilterListReset(){this._filterActive=!1,this._updateShareUrl(),await this._searchFullText()}async _handleFilterUpdate(){const t=this._layer.definitionExpression;if(this._floorExpression){const i=new RegExp(`${this._floorField} = ['].+[']`,"gm");this._layer.definitionExpression=t&&this._floorField&&t.indexOf(`${this._floorField} = '`)>-1?t.replace(i,this._floorExpression):t?`${t} AND (${this._floorExpression})`:this._floorExpression}this._filterActive=this._definitionExpression!==this._layer.definitionExpression&&(!this._floorExpression||this._layer.definitionExpression!==this._floorExpression),this._updateShareUrl(),await this._searchFullText()}async _closeFilter(){this._filterOpen&&(this._allIds=await d(this._layer),this._filterOpen=!1)}async _mapClicked(t){const i={include:this._layer},s=await this.mapView.hitTest(t.screenPoint,i);s.results.length>0?(s.results.forEach((t=>{const i=t.graphic.getObjectId();this._table.highlightIds.indexOf(i)<0&&(this._selectionFromMap=!0,this._table.highlightIds.add(i))})),this._showOnlySelected&&this._table.filterBySelection()):this._clearSelection()}_selectAll(){const t=this._allIds;this._table.highlightIds.removeAll(),this._skipOnChange=!0,this._table.highlightIds.addMany(t),this.selectedIds=t,this._finishOnChange(),this._selectAllActive=!0}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){this.selectedIds=[],this._table?.highlightIds.removeAll(),this._table?.rowHighlightIds.removeAll(),this._finishOnChange()}_toggleFilter(){this._filterOpen=!this._filterOpen}_initLayerExpressions(){const t=this.mapInfo?.filterConfig?.layerExpressions;this._layerExpressions=t?t.filter((t=>t.id===this._layer?.id)):[],this._filterList.layerExpressions=this._layerExpressions,this._filterActive=this._layerExpressions.filter((t=>t.expressions.filter((t=>t.active)).length>0)).length>0}_switchSelected(){const t=[...this.selectedIds];this._table.highlightIds.removeAll();const i=this._allIds.reduce(((i,s)=>(t.indexOf(s)<0&&i.push(s),i)),[]).sort(((t,i)=>t-i));this._skipOnChange=!0,this._table.highlightIds.addMany(i),this.selectedIds=i,this._finishOnChange()}async _exportToCSV(){const t={},i=this._table.highlightIds.toArray();t[this._layer.id]={selectionSetNames:[this._layer.title],ids:i,layer:this._layer};const s=this._table.columns.toArray().reduce(((t,i)=>(i.hidden||t.push(i.name.toLocaleLowerCase()),t)),[]);this._updateToolInfoLoading("export",!0),this._csvExporting=!0,await f(null,t,!1,!1,!0,s,!0,!0),this._updateToolInfoLoading("export",!1),this._csvExporting=!1}_updateToolInfoLoading(t,i){this._toolInfos.some((s=>{if(s?.icon===t)return s.loading=i,!0}))}async _refresh(){await this._table.refresh(),this._allIds=await d(this._layer),this.featureSelectionChange.emit(this.selectedIds)}async _zoom(){if(this._layer){const t=await b(this.mapView,this._layer.id);await c(this.selectedIds,t,this.mapView,!0,void 0,this.zoomToScale)}}async _layerSelectionChanged(t){const i=t.detail[0];if(i!==this._layer?.id||this._featuresEmpty()){this._fetchingData=!0;const t=await l(this.mapView,i);t&&await t.when((()=>{this._layer=t,this._getFullTextSearchInfo()}))}this._fetchingData=!1}_getColumnTemplates(t,i){let s;this.mapInfo?.layerOptions?.layers.some((i=>{if(i.id===t)return s=i,!0}));const e=s?.fields&&s?.fieldOrder?s.fieldOrder.filter((t=>s.fields.indexOf(t)>-1)):void 0;let h;return i&&(h=s&&s?.fields?i.reduce(((t,i)=>{if(s.fields.indexOf(i.name)>-1){const s={type:"field",fieldName:i.name,label:i.alias,menuConfig:this._getMenuConfig(i.name)};t.push(s)}return t}),[]).sort(this._sortFields.bind(this,s?.fieldOrder)):i.map((t=>({type:"field",fieldName:t.name,label:t.alias,menuConfig:this._getMenuConfig(t.name)})))),e?h?.sort(this._sortFields.bind(this,e)):h}_sortFields(t,i,s){return t?.indexOf(i.fieldName)-t.indexOf(s.fieldName)}_getMenuConfig(t){return{items:[{label:this._translations.hideField,icon:"view-hide",autoCloseMenu:!0,clickFunction:()=>{this._handleHideClick(t)}}]}}_handleHideClick(t){this._columnsInfo[t]=!1,this._table.hideColumn(t),this._table.tableTemplate.columnTemplates.forEach((i=>{i.fieldName===t&&(i.visible=!1)}))}async _getTranslations(){const t=await a(this.el);this._translations=t[0]}static get watchers(){return{appLayout:["appLayoutWatchHandler"],defaultOid:["defaultOidWatchHandler"],defaultGlobalId:["defaultGlobalIdWatchHandler"],enableCSV:["enableCSVWatchHandler"],enableInlineEdit:["enableInlineEditWatchHandler"],enableShare:["enableShareWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"],mapHidden:["mapHiddenWatchHandler"],isMobile:["isMobileWatchHandler"],mapInfo:["mapInfoWatchHandler"],mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],selectedIds:["selectedIdsWatchHandler"]}}};function v(t){return function(t){return-1!==t?.indexOf("http://")}(t)?t.replace(/^http:\/\//,"https://"):t}m.style=':host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.table-border{border:1px solid var(--calcite-color-border-2)}.border-end{border-inline-end:1px solid var(--calcite-color-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51-px{height:51px}.height-50-px{height:50px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir="rtl"] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-color-background)}.text-color{color:var(--calcite-color-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-color-status-danger)}.esri-feature-table vaadin-grid{border:none !important}vaadin-grid-cell-content{font-size:14px !important;color:var(--calcite-color-text-3) !important}.share-action{position:absolute;right:0}html[dir="rtl"] .share-action{left:0}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.instant-app-share{height:50px !important;display:inline-flex}.border-top{border-top:1px solid var(--calcite-color-border-2)}.modal{--calcite-modal-content-padding:0}.esri-feature-table__table-container{height:100%}.search-container{background-color:var(--calcite-color-foreground-1) !important}.search{--calcite-color-border-input:var(--calcite-color-border-3);width:60%;padding:10px}.delete-red{--calcite-icon-color:var(--calcite-color-status-danger);--calcite-color-text-1:var(--calcite-color-status-danger);--calcite-color-text-3:var(--calcite-color-status-danger)}';const y=class{constructor(s){t(this,s),this.mapChanged=i(this,"mapChanged",7),this.beforeMapChanged=i(this,"beforeMapChanged",7),this.toggleFilter=i(this,"toggleFilter",7),this.clearSelection=i(this,"clearSelection",7),this.appLayout=void 0,this.appProxies=void 0,this.defaultWebmapId="",this.defaultLayerId=void 0,this.enableHome=void 0,this.enableLegend=void 0,this.enableFloorFilter=void 0,this.enableFullscreen=void 0,this.enableShare=!1,this.enableSingleExpand=!0,this.enableSearch=void 0,this.enableBasemap=void 0,this.basemapConfig=void 0,this.hidden=void 0,this.homeZoomIndex=3,this.homeZoomPosition="top-left",this.homeZoomToolsSize="m",this.mapInfos=[],this.mapWidgetsIndex=0,this.mapWidgetsPosition="top-right",this.mapWidgetsSize="m",this.mapView=void 0,this.stackTools=!0,this.theme=void 0,this.toolOrder=void 0,this.isMapLayout=void 0,this.shareIncludeEmbed=void 0,this.shareIncludeSocial=void 0,this.selectedFeaturesIds=void 0,this.selectedLayer=void 0,this.zoomToScale=void 0,this.onlyShowUpdatableLayers=void 0,this.isMobile=void 0,this.mapInfo=void 0,this._translations=void 0,this._searchConfiguration=void 0,this._webMapInfo=void 0,this._showHideOpen=!1,this._toolInfos=void 0,this._controlsThatFit=void 0}get el(){return s(this)}esriConfig;Home;MapView;WebMap;_defaultWebmapHonored=!1;_homeWidget;_loadedId="";_mapDiv;_mapPicker;_mapTools;_moreDropdown;_mapListExpanded=!1;_filterActive=!1;_definitionExpression;_mapLayerPicker;_resizeObserver;_shareNode;_showHideDropdown;_toolbar;_timeout;_toolbarSizeInfos;_defaultVisibleToolSizeInfos;_observerSet=!1;appLayoutWatchHandler(){this._updateShareUrl()}enableHomeWatchHandler(){this._initHome()}enableShareWatchHandler(){this._toolbar&&this._updateToolbar()}async mapViewWatchHandler(){this.mapView&&this._updateShareUrl()}async selectedLayerWatchHandler(){await(this.selectedLayer?.when((async()=>{this._definitionExpression=this.selectedLayer.definitionExpression})))}async selectedFeaturesIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions()}_controlsThatFitWatchHandler(){const t=this._controlsThatFit?this._controlsThatFit.reduce(((t,i)=>(t.push(i.id),t)),[]):[];this._toolInfos=this._toolInfos?.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}async resetFilter(){this._filterActive=!1,this._updateShareUrl()}async updateFilterState(){this._filterActive=this._definitionExpression!==this.selectedLayer.definitionExpression,this._updateShareUrl()}async updateLayer(){this._mapLayerPicker.updateLayer()}mapChanged;beforeMapChanged;toggleFilter;clearSelection;async mapInfoChange(t){await this._loadMap(t.detail)}noLayersFound(){this.selectedLayer=void 0,this.selectedFeaturesIds=[]}layerSelectionChange(){setTimeout((()=>{this._initToolInfos()}),50)}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initToolInfos(),this._resizeObserver||(this._resizeObserver=new ResizeObserver((()=>this._updateToolbar())))}render(){const t=this.isMapLayout?"display-flex height-49-px":"",i=this.hidden?"visibility-hidden-1":"",s="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light",a=this.mapInfos?.length>1||this.isMapLayout?"map-height":"height-full",o=this.isMapLayout?"":"display-none";return this._validateActiveActions(),e(h,{key:"d4e5ff9c4aa08a4effe19a54a1a48463cb8b3774"},e("div",{key:"51ee35d267d5ef081a4c160de3e03b1790d328c8",class:`${t} width-full`,ref:t=>this._toolbar=t},this._getActionBar(),!this.isMobile&&this.isMapLayout&&this._getDropdown("more-table-options"),this.enableShare&&!this.isMobile&&this.isMapLayout?this._getShare("share"):void 0),e("calcite-progress",{key:"70a5c232aae8a9ff6740fd326e6ba6fe61936541",class:o,value:0}),e("div",{key:"c399acc019d7f0a16dbb644eee4cfdd1e6e83c7c",class:`${a} ${i}`,ref:t=>this._mapDiv=t}),e("map-tools",{key:"c6a88ccfa140fe9b0d059f74b9254af6ef0997ce",basemapConfig:this.basemapConfig,class:`box-shadow ${s}`,enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableHome:this.enableHome,enableLegend:this.enableLegend,enableSearch:this.enableSearch,enableSingleExpand:this.enableSingleExpand,homeZoomToolsSize:this.homeZoomToolsSize,mapView:this.mapView,mapWidgetsSize:this.mapWidgetsSize,position:this.mapWidgetsPosition,ref:t=>this._mapTools=t,searchConfiguration:this._searchConfiguration,stackTools:this.stackTools,toolOrder:this.toolOrder}))}async componentDidRender(){this.isMapLayout&&this._updateToolbar(),document.onclick=t=>this._handleDocumentClick(t)}async componentDidLoad(){this.isMobile||this._observerSet||(this._resizeObserver.observe(this._toolbar),this._observerSet=!0),this._updateShareUrl()}async _initModules(){const[t,i,s,e]=await o(["esri/WebMap","esri/views/MapView","esri/widgets/Home","esri/config"]);this.WebMap=t,this.MapView=i,this.Home=s,this.esriConfig=e}async _loadMap(t){const i=!this._defaultWebmapHonored&&this.defaultWebmapId,s=this.mapInfos?.filter((t=>t.id===this.defaultWebmapId)),e=JSON.stringify(t)!==JSON.stringify(this._webMapInfo);this._webMapInfo=i&&s?s[0]:!t?.id&&this.mapInfos.length>0?this.mapInfos[0]:t;const h=this._webMapInfo.id,a=i&&t?.id===this.defaultWebmapId;if(this._loadedId!==h&&!i||a){const t=new this.WebMap({portalItem:{id:h}});this.appProxies&&(await t.load(),await(o=t,l=this.esriConfig,n=this.appProxies,n&&n.forEach((t=>{o.allLayers.forEach((i=>{i&&i.url===t.sourceUrl&&(i.url=v(t.proxyUrl),i.portalItem&&i.portalItem.when((()=>{i.portalItem.url=v(t.proxyUrl)})),l.request?.interceptors?.push({urls:t.sourceUrl,before:i=>{i.url&&i.url===t.sourceUrl&&(i.url=v(t.proxyUrl))}}))}))})),o)),this.mapView=new this.MapView({container:this._mapDiv,map:t,resizeAlign:"center"}),this._loadedId=h,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),await this.mapView.when((()=>{this._initHome(),this.mapView.ui.add(this._mapTools,{position:this.mapWidgetsPosition,index:this.mapWidgetsIndex}),this._defaultWebmapHonored=!!a||this._defaultWebmapHonored,this.mapChanged.emit({id:h,mapView:this.mapView})}))}else i?(this._defaultWebmapHonored=!0,this._mapPicker.setMapByID(h)):e&&(this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapChanged.emit({id:h,mapView:this.mapView}));var o,l,n;this._updateShareUrl()}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),!this.isMobile&&this._toolbar&&this._toolInfos&&(this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const t=this._toolbar.offsetWidth;let i=this._toolbarSizeInfos.reduce(((t,i)=>t+i.width),0);const s=["solutions-more","solutions-map-layer-picker-container","map-picker","solutions-action-share"];if(i>t){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,h)=>(s.indexOf(h.id)<0&&(i>t?i-=h.width:e.push(h)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((t,i)=>(t.push(i.id),t)),[]);let h=!1;const a=[...this._defaultVisibleToolSizeInfos].reduce(((a,o)=>(!h&&s.indexOf(o.id)<0&&(e.indexOf(o.id)>-1||i+o.width<=t)?(e.indexOf(o.id)<0&&(i+=o.width),a.push(o)):s.indexOf(o.id)<0&&i+o.width>t&&(h=!0),a)),[]);this._setControlsThatFit(a,s)}}),250))}_setControlsThatFit(t,i){let s=JSON.stringify(t)!==JSON.stringify(this._controlsThatFit);const e=document.getElementById("solutions-action-bar");e?.childNodes?.forEach((t=>{i.indexOf(t.id)<0&&!s&&(s=this._controlsThatFit.map((t=>t.id)).indexOf(t.id)<0)})),s&&(this._controlsThatFit=[...t])}_setToolbarSizeInfos(){let t=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((i,s)=>{0===s?i.childNodes.forEach((i=>{this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0)})):i.referenceElement||(this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0))})),t&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionBar(){const t=this.mapInfos?.length>1?"":"display-none",i=this.isMapLayout?"display-flex":"display-block",s=this.isMobile?"border-top":"",h=this.isMapLayout?"":"display-none";return e("calcite-action-bar",{class:i,expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},e("map-picker",{class:t,isMapLayout:this.isMapLayout,mapInfos:this.mapInfos,ref:t=>this._mapPicker=t}),e("div",{class:`mapView-header display-flex ${h}`},e("div",{class:`border-end ${i} ${s}`,id:"solutions-map-layer-picker-container"},this.mapView&&e("map-layer-picker",{appearance:"transparent",defaultLayerId:this.defaultLayerId,display:"inline-flex",height:50,isMobile:this.isMobile,mapView:this.mapView,onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",ref:t=>this._mapLayerPicker=t,scale:"l",selectedIds:this.selectedLayer?[this.selectedLayer.id]:[],showSingleLayerAsLabel:!0,showTables:!0,showTablesDisabled:!0,type:"dropdown"}))),!this.isMobile&&this.isMapLayout?this._getActions():void 0)}_getDropdown(t){const i=this._getDropdownItems();return i.length>0?e("calcite-dropdown",{closeOnSelectDisabled:!0,disabled:void 0===this.selectedLayer,id:"solutions-more",onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:t=>this._moreDropdown=t},e("calcite-action",{appearance:"solid",id:t,label:"",onClick:()=>this._closeShowHide(),slot:"trigger",text:""},e("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),e("calcite-dropdown-group",{"selection-mode":"none"},i.map((t=>e("calcite-dropdown-group",{class:t.disabled?"disabled":"",selectionMode:"none"},e("calcite-dropdown-item",{disabled:t.loading,iconStart:t.icon,id:"solutions-subset-list",onClick:t.func},t.loading?e("div",{class:"display-flex"},e("calcite-loader",{inline:!0,label:t.label,scale:"m"}),t.label):t.label)))))):void 0}_getShare(t){return e("div",{class:"share-action",id:this._getId(t)},e("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"instant-app-share",embed:this.shareIncludeEmbed,popoverButtonIconScale:"s",ref:t=>{this._shareNode=t,this._updateShareUrl()},scale:"m",shareButtonColor:"neutral",shareButtonType:"action",socialMedia:this.shareIncludeSocial,view:this.mapView}),this._getToolTip("bottom",t,this._translations.share))}_updateShareUrl(){const t=this._shareNode?.shareUrl;if(!t)return;const i=new URL(t);this._loadedId?i.searchParams.set("webmap",this._loadedId):i.searchParams.delete("webmap"),this.selectedLayer?.id?i.searchParams.set("layer",this.selectedLayer.id):i.searchParams.delete("layer"),this.selectedFeaturesIds?.length>0?i.searchParams.set("oid",this.selectedFeaturesIds.join(",")):i.searchParams.delete("oid"),i.searchParams.set("applayout",this.appLayout),this._shareNode.shareUrl=i.href}_closeShowHide(){this._showHideOpen=!1}_getDropdownItems(){return this._toolInfos?.filter((t=>t&&t.isOverflow))}_initToolInfos(){const t=this.selectedFeaturesIds?.length>0,i=this._hasFilterExpressions(),s=this.selectedFeaturesIds?.length>1&&!1;this._translations&&(this._toolInfos=[{active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>this._zoom(),disabled:!t,isOverflow:!1},i?{active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this._toggleFilter(),disabled:!1,isOverflow:!1}:void 0,s?{active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>alert(this._translations.editMultiple),disabled:!s,isOverflow:!1}:void 0,{active:!1,icon:"refresh",indicator:!1,label:this._translations.refresh,func:()=>this.selectedLayer.refresh(),disabled:!1,isOverflow:!1},{active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>this.clearSelection.emit(),disabled:!t,isOverflow:!1}],this._defaultVisibleToolSizeInfos=void 0)}_validateActiveActions(){const t=["filter"];this._toolInfos?.forEach((i=>{i&&t.indexOf(i.icon)>-1&&"filter"===i.icon&&(i.indicator=this._filterActive)}))}_validateEnabledActions(){const t=this.selectedFeaturesIds?.length>0,i=this.selectedFeaturesIds?.length>1&&this.selectedLayer?.capabilities?.operations?.supportsUpdate,s=["zoom-to-object","pencil","erase"];this._toolInfos?.forEach((e=>{e&&s.indexOf(e.icon)>-1&&(e.disabled="pencil"===e.icon?!i:!t)}))}_initHome(){if(this.enableHome){this._homeWidget=new this.Home({view:this.mapView}),this.mapView.ui.add(this._homeWidget,{position:this.homeZoomPosition,index:this.homeZoomIndex});const t="s"===this.homeZoomToolsSize?"32px":"m"===this.homeZoomToolsSize?"40px":"48px";this._homeWidget.domNode.style.height=t,this._homeWidget.domNode.style.width=t}else this._homeWidget&&this.mapView.ui.remove(this._homeWidget)}_toggleShowHide(){this._showHideOpen=!this._showHideOpen}_forceShowHide(){this._moreDropdown&&(this._moreDropdown.open=this._showHideOpen)}_handleDocumentClick(t){const i=t.target?.id;"solutions-subset-list"===i?this._moreDropdown.open=!0:this._showHideOpen&&"solutions-subset-list"!==i&&"solutions-more"!==i&&"chevron-down"!==i&&this._moreDropdown&&(this._showHideOpen=!1,this._moreDropdown.open=!1),"MAP-PICKER"===t.target.tagName&&(this._mapListExpanded=!this._mapListExpanded,this._mapPicker.toggle(this._mapListExpanded)),"MAP-PICKER"!==t.target.tagName&&(this._mapListExpanded=!1,this._mapPicker.close())}async _zoom(){if(this.selectedLayer){const t=await b(this.mapView,this.selectedLayer.id);await c(this.selectedFeaturesIds,t,this.mapView,!0,void 0,this.zoomToScale)}}async _toggleFilter(){this.toggleFilter.emit()}_hasFilterExpressions(){let t;return this.mapInfo?.filterConfig?.layerExpressions&&this.selectedLayer?.id&&(t=this.mapInfo.filterConfig.layerExpressions.filter((t=>t.id===this.selectedLayer.id))),t?.length>0}_getActions(){const t=this._getActionItems();return t?.reduce(((t,i)=>(i&&!i.isOverflow&&t.push(this._getAction(i.active,i.icon,i.indicator,i.label,i.func,i.disabled,i.loading)),t)),[])}_getToolTip(t,i,s){return document.getElementById(i)?e("calcite-tooltip",{placement:t,"reference-element":"map-"+i},e("span",null,s)):void 0}_getActionItems(){return this._toolInfos?.filter((t=>t&&!t.isOverflow))}_getAction(t,i,s,h,a,o,l,n){const c=void 0===this.selectedLayer||o;return e("div",{class:"display-flex",id:this._getId(i),slot:n},e("calcite-action",{active:t,appearance:"solid",disabled:c,icon:i,id:"map-"+i,indicator:s,label:h,loading:l,onClick:a,text:h,textEnabled:!0}),this._getToolTip("bottom",i,h))}_getId(t){return`solutions-action-${t}`}async _getTranslations(){const t=await a(this.el);this._translations=t[0]}static get watchers(){return{appLayout:["appLayoutWatchHandler"],enableHome:["enableHomeWatchHandler"],enableShare:["enableShareWatchHandler"],mapView:["mapViewWatchHandler"],selectedLayer:["selectedLayerWatchHandler"],selectedFeaturesIds:["selectedFeaturesIdsWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"]}}};y.style=":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 53px)}.height-full{height:100%}.height-49-px{height:49px}.box-shadow{box-shadow:none !important}.visibility-hidden-1{visibility:hidden;height:1px;}.display-none{display:none}.display-block{display:block}";export{u as card_manager,m as layer_table,y as map_card}
@@ -3,4 +3,4 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as t,c as i,g as s,a as e,h as a,H as l}from"./p-4e6eb06e.js";import{b as o,c as n,a as h}from"./p-80cb7c73.js";import{l as c,g as r}from"./p-f4aadb3b.js";import{e as d,h as p}from"./p-d572627c.js";import{s as g}from"./p-51c6e6fe.js";import{c as b,r as m}from"./p-46c8015c.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-dc9d4be3.js";import"./p-d0d020a5.js";import"./p-7530a02f.js";import"./p-9bb44f57.js";const u=class{constructor(s){t(this,s),this.searchConfigurationChange=i(this,"searchConfigurationChange",7),this.addresseeLayerIds=[],this.bufferColor=[227,139,79,.8],this.bufferOutlineColor=[255,255,255],this.customLabelEnabled=void 0,this.defaultBufferDistance=void 0,this.defaultBufferUnit=void 0,this.defaultExportTitle="",this.defaultNumLabelsPerPage=6,this.enableLayerFeatures=!0,this.enableLayerFeaturesOnLoad=!1,this.enableSearchDistance=!0,this.enableSearchDistanceOnLoad=!1,this.enableSketchTools=!0,this.featureEffect=void 0,this.featureHighlightEnabled=void 0,this.locale=void 0,this.mapView=void 0,this.noResultText=void 0,this.searchConfiguration=void 0,this.selectionLayerIds=[],this.showRefineSelection=!1,this.showSearchSettings=!0,this.sketchLineSymbol=void 0,this.sketchPointSymbol=void 0,this.sketchPolygonSymbol=void 0,this._exportGraphics=!1,this._addMap=!1,this._addResults=!0,this._addTitle=!1,this._downloadActive=!0,this._exportType=o.PDF,this._fetchingData=!1,this._isMobile=void 0,this._numDuplicates=0,this._pageType=n.LIST,this._saveEnabled=!1,this._selectionSets=[],this._translations=void 0}get el(){return s(this)}_activeSelection;_downloadTools;_geometryEngine;Graphic;_jsonUtils;_onboardingImageUrl="";_popupsEnabled;_removeDuplicates;_searchConfiguration;_selectTools;_mediaQuery;_titleElement;_titleValue=void 0;_numSelected=0;async mapViewWatchHandler(t){t?.popup&&(this._popupsEnabled=t?.popup.autoOpenEnabled),this._initSearchConfiguration(this.searchConfiguration)}async watchSearchConfigurationHandler(t,i){const s=JSON.stringify(t);this.mapView&&(s!==JSON.stringify(i)||s&&!this._searchConfiguration)&&(this._searchConfiguration=JSON.parse(s),this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}async sketchLineSymbolWatchHandler(t,i){t&&JSON.stringify(t)!==JSON.stringify(i)&&this._setLineSymbol(t)}async sketchPointSymbolWatchHandler(t,i){t&&JSON.stringify(t)!==JSON.stringify(i)&&this._setPointSymbol(t)}async sketchPolygonSymbolWatchHandler(t,i){t&&JSON.stringify(t)!==JSON.stringify(i)&&this._setPolygonSymbol(t)}async pageTypeWatchHandler(t,i){if(this._checkPopups(),this.mapView?.popup&&(this.mapView.popupEnabled=t===n.LIST&&this._popupsEnabled),t===n.EXPORT&&(this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._updateExportGraphics(),this._fetchingData=!1),this._clearHighlight(),i!==n.SELECT&&i!==n.REFINE||await this._clearSelection(),i===n.EXPORT&&this._removeExportGraphics(),t!==n.SELECT)return this._highlightFeatures()}searchConfigurationChange;selectionSetsChanged(t){this._selectionSets=[...t.detail]}connectedCallback(){this._mediaQuery=window.matchMedia("(max-width: 600px)"),this._mediaQuery.addEventListener("change",(t=>this._setIsMobile(t)))}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initSymbols(),this._onboardingImageUrl=e("assets/data/images/onboarding.png")}render(){return a(l,{key:"8b22f6b45144705e9ff5b230ca8075f68985165b"},a("calcite-shell",{key:"774731e643edb5b52bf565349fdfe58dae1e845e"},a("calcite-action-bar",{key:"5e3bcc6ba2f53d25ee2bd972ce67108c0ab808f4",class:"border-bottom-1 action-bar-size","expand-disabled":!0,layout:"horizontal",slot:this._isMobile?"footer":"header"},this._getActionGroup("list-check",n.LIST,this._translations.myLists),this.showRefineSelection?this._getActionGroup("test-data",n.REFINE,this._translations.refineSelection):null,this._getActionGroup("export",n.EXPORT,this._translations.export)),this._getPage(this._pageType)))}async componentDidLoad(){this._initSearchConfiguration(this.searchConfiguration)}disconnectedCallback(){this._mediaQuery.removeEventListener("change",(t=>this._setIsMobile(t)))}async _initModules(){const[t,i,s]=await c(["esri/geometry/geometryEngine","esri/symbols/support/jsonUtils","esri/Graphic"]);this._geometryEngine=t,this._jsonUtils=i,this.Graphic=s}_initSearchConfiguration(t){this.searchConfiguration&&!this._searchConfiguration&&this.mapView&&(this._searchConfiguration=t,this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}_initSymbols(){this._setLineSymbol(this.sketchLineSymbol),this._setPointSymbol(this.sketchPointSymbol),this._setPolygonSymbol(this.sketchPolygonSymbol)}_setLineSymbol(t){this.sketchLineSymbol="simple-line"===t?.type?t:this._jsonUtils.fromJSON(t||{type:"esriSLS",color:[130,130,130,255],width:2,style:"esriSLSSolid"})}_setPointSymbol(t){this.sketchPointSymbol="simple-marker"===t?.type?t:this._jsonUtils.fromJSON(t||{type:"esriSMS",color:[255,255,255,255],angle:0,xoffset:0,yoffset:0,size:6,style:"esriSMSCircle",outline:{type:"esriSLS",color:[50,50,50,255],width:1,style:"esriSLSSolid"}})}_setPolygonSymbol(t){this.sketchPolygonSymbol="simple-fill"===t?.type?t:this._jsonUtils.fromJSON(t||{type:"esriSFS",color:[150,150,150,51],outline:{type:"esriSLS",color:[50,50,50,255],width:2,style:"esriSLSSolid"},style:"esriSFSSolid"})}_setIsMobile(t){this._isMobile=t.matches}_getActionGroup(t,i,s){return a("calcite-action-group",{class:this.showRefineSelection?"w-1-3":"w-1-2",layout:"horizontal"},a("div",{class:"background-override"},a("calcite-action",{active:this._pageType===i,alignment:"center",class:"width-full height-full",compact:!1,icon:t,id:t,onClick:()=>{this._setPageType(i)},text:""})),a("calcite-tooltip",{label:"",placement:"bottom","reference-element":t},a("span",null,s)))}_setPageType(t){this._pageType=t}_getPage(t){let i;switch(t){case n.LIST:i=this._getListPage();break;case n.SELECT:i=this._getSelectPage();break;case n.EXPORT:i=this._getExportPage();break;case n.REFINE:i=this._getRefinePage()}return i}_getListPage(){const t=this._hasSelections();return a("calcite-panel",null,this._getLabel(this._translations.myLists),this._getNotice(t?this._translations.listHasSetsTip:this._translations.selectLayerAndAdd,"padding-sides-1 padding-bottom-1","word-wrap-anywhere"),t?this._getSelectionSetList():this._getOnboardingImage(),a("div",{class:"display-flex padding-1"},a("calcite-button",{onClick:()=>{this._setPageType(n.SELECT)},width:"full"},a("span",{class:"font-weight-500"},this._translations.add))))}_getOnboardingImage(){return a("div",{class:"display-flex padding-sides-1"},a("img",{class:"img-container",role:"presentation",src:this._onboardingImageUrl}))}_getSelectionSetList(){return a("div",{class:"padding-top-1-2 padding-bottom-1-2"},a("calcite-list",{class:"list-border margin-sides-1"},this._selectionSets.reduce(((t,i,s)=>{const e=this._getSelectionSetIds(i);let l=!0;return i.workflowType===h.REFINE&&(l=Object.keys(i.refineInfos).reduce(((t,s)=>{const e=i.refineInfos[s];return t+(e.addIds.length+e.removeIds.length)}),0)>0),l&&t.push(a("calcite-list-item",{label:i.label,onClick:()=>this._gotoSelection(i,this.mapView)},a("div",{slot:"content"},a("div",{class:"list-label"},i.label),a("div",{class:"list-description"},i?.layerView?.layer.title),a("div",{class:"list-description"},this._translations.selectedFeatures.replace("{{n}}",e.length.toString()))),this._getAction(!0,"pencil","",(t=>this._openSelection(i,t)),!1,"actions-end"),this._getAction(!0,"x","",(t=>this._deleteSelection(s,t)),!1,"actions-end"))),t}),[])))}_getSelectionSetIds(t){return t.workflowType!==h.REFINE?t.selectedIds:Object.keys(t.refineInfos).reduce(((i,s)=>[...i,...t.refineInfos[s].addIds]),[])}_hasSelections(t=!1){let i=[];const s=this._selectionSets.some((t=>{if(t.workflowType===h.REFINE)return i=this._getSelectionSetIds(t),!0}));return t&&s?i.length>0||this._selectionSets.length>1:this._selectionSets.length>0}async _getNumDuplicates(){const t=this._getExportInfos(),i=await b(this.mapView.map,t),s=m(i);return i.length-s.length}_getExportInfos(){return this._selectionSets.reduce(((t,i)=>(i.download&&(i.workflowType!==h.REFINE?this._updateIds(i.layerView.layer.id,i.layerView,i.selectedIds,t):Object.keys(i.refineInfos).forEach((s=>{const e=i.refineInfos[s];e.addIds.length>0&&this._updateIds(s,e.layerView,e.addIds,t)}))),t)),{})}_updateIds(t,i,s,e){return e[t]?e[t].ids=e[t].ids.concat(s):e[t]={layerView:i,ids:s},e}_getSelectPage(){const t=this._translations.selectSearchTip;return a("calcite-panel",null,this._getLabel(this._translations.stepTwoFull,!0),this._getNotice(t,"padding-1","word-wrap-anywhere"),a("div",null,a("map-select-tools",{bufferColor:this.bufferColor,bufferOutlineColor:this.bufferOutlineColor,class:"font-bold",customLabelEnabled:this.customLabelEnabled,defaultBufferDistance:this.defaultBufferDistance,defaultBufferUnit:this.defaultBufferUnit,enableLayerFeatures:this.enableLayerFeatures,enableLayerFeaturesOnLoad:this.enableLayerFeaturesOnLoad,enableSearchDistance:this.enableSearchDistance,enableSearchDistanceOnLoad:this.enableSearchDistanceOnLoad,enableSketchTools:this.enableSketchTools,enabledLayerIds:this.addresseeLayerIds,isUpdate:!!this._activeSelection,locale:this.locale,mapView:this.mapView,noResultText:this.noResultText,onSelectionSetChange:t=>this._updateForSelection(t),ref:t=>{this._selectTools=t},searchConfiguration:this._searchConfiguration,selectionLayerIds:this.selectionLayerIds,selectionSet:this._activeSelection,sketchLineSymbol:this.sketchLineSymbol,sketchPointSymbol:this.sketchPointSymbol,sketchPolygonSymbol:this.sketchPolygonSymbol})),this._getPageNavButtons(this._translations.done,0===this._numSelected,(()=>{this._saveSelection()}),this._translations.cancel,!1,(()=>{this._home()})))}_getExportPage(){const t=this._hasSelections(this.showRefineSelection),i=this._numDuplicates>0?"display-block":"display-none";return a("calcite-panel",null,a("div",null,this._getLabel(this._translations.export,!1),t?a("div",null,this._getNotice(this._translations.exportTip,"padding-sides-1"),this._getLabel(this._translations.exportListsLabel),this._getExportSelectionLists(),a("div",{class:"padding-sides-1 "+i},a("div",{class:"display-flex"},a("calcite-label",{layout:"inline"},a("calcite-checkbox",{ref:t=>{this._removeDuplicates=t}}),a("div",{class:"display-flex"},this._translations.removeDuplicate,a("div",{class:"info-message padding-start-1-2"},a("calcite-input-message",{class:"info-blue margin-top-0",scale:"m"},` ${this._translations.numDuplicates.replace("{{n}}",this._numDuplicates.toString())}`)))),a("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"remove-duplicates-icon",scale:"s"})),a("calcite-popover",{closable:!0,label:"",referenceElement:"remove-duplicates-icon"},a("span",{class:"tooltip-message"},this._translations.duplicatesTip))),a("div",{class:"border-bottom"}),a("div",{class:"padding-top-sides-1"},a("calcite-segmented-control",{class:"w-100",onCalciteSegmentedControlChange:t=>this._exportTypeChange(t),width:"full"},a("calcite-segmented-control-item",{checked:this._exportType===o.PDF,class:"w-50 end-border",value:o.PDF},a("span",{class:"font-weight-500"},this._translations.pdf)),a("calcite-segmented-control-item",{checked:this._exportType===o.CSV,class:"w-50",value:o.CSV},a("span",{class:"font-weight-500"},this._translations.csv)))),a("div",{class:"padding-bottom-1"},this._getExportOptions()),a("div",{class:"padding-1 display-flex"},a("calcite-button",{disabled:!this._downloadActive||this._fetchingData||!this._addMap&&!this._addResults,loading:this._fetchingData,onClick:()=>{this._export()},width:"full"},a("span",{class:"font-weight-500"},this._translations.export)))):this._getNotice(this._translations.downloadNoLists,"padding-sides-1 padding-bottom-1")))}_exportTypeChange(t){this._exportType=t.target.value}_getExportOptions(){const t=this._addTitle?"display-block":"display-none",i=this._addMap?"display-flex":"display-none",s=this._titleValue?this._titleValue:this.defaultExportTitle?this.defaultExportTitle:"",e=this._addResults?"":"display-none";return a("div",{class:this._exportType===o.PDF?"display-block":"display-none"},this._getLabel(this._translations.pdfOptions,!0),a("div",{class:"padding-top-sides-1"},a("calcite-label",{class:"label-margin-0",layout:"inline"},a("calcite-checkbox",{checked:this._addResults,onCalciteCheckboxChange:()=>this._addResults=!this._addResults}),this._translations.addResults)),a("div",{class:`padding-top-sides-1 ${e}`},a("calcite-label",{class:"label-margin-0"},this._translations.selectPDFLabelOption)),a("div",{class:`padding-sides-1 ${e}`},a("pdf-download",{defaultNumLabelsPerPage:parseInt(this.defaultNumLabelsPerPage.toString(),10),disabled:!this._downloadActive,ref:t=>{this._downloadTools=t}})),a("div",{class:"padding-top-sides-1"},a("calcite-label",{class:"label-margin-0",layout:"inline"},a("calcite-checkbox",{checked:this._addTitle,onCalciteCheckboxChange:()=>this._addTitle=!this._addTitle}),this._translations.title)),a("div",{class:t},this._getLabel(this._translations.title,!0,""),a("calcite-input-text",{class:"padding-sides-1",onCalciteInputTextInput:()=>this._changeTitle(),placeholder:this._translations.titlePlaceholder,ref:t=>{this._titleElement=t},value:s})),a("div",{class:"padding-top-sides-1"},a("calcite-label",{class:"label-margin-0",layout:"inline"},a("calcite-checkbox",{checked:this._addMap,onCalciteCheckboxChange:()=>this._handleAddMapChange()}),this._translations.includeMap)),a("div",{class:`padding-top-sides-1 ${i}`},a("calcite-label",{class:"label-margin-0",layout:"inline"},a("calcite-checkbox",{checked:this._exportGraphics,onCalciteCheckboxChange:()=>this._handleExportGraphicsChange()}),this._translations.listGraphics),a("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"list-graphics-icon",scale:"s"}),a("calcite-popover",{closable:!0,label:"",referenceElement:"list-graphics-icon"},a("span",{class:"tooltip-message"},this._translations.listGraphicsTip))))}_handleAddMapChange(){this._addMap=!this._addMap,this._updateExportGraphics()}_handleExportGraphicsChange(){this._exportGraphics=!this._exportGraphics,this._updateExportGraphics()}_getManagedLayer(t){let i;return Object.keys(g.managedLayers).some((s=>{const e=this.mapView.map.layers.findIndex((t=>t.title===s));if(g.managedLayers[s]===t)return i=this.mapView.map.layers.getItemAt(e),!0})),i}_updateExportGraphics(t=!1){!t&&this._exportGraphics&&this._addMap||this._removeExportGraphics(),this._exportGraphics&&this._addMap&&this._addExportGraphics()}_removeExportGraphics(){const t=this._getManagedLayer("sketch"),i=this._getManagedLayer("buffer");t&&t.graphics.removeAll(),i&&i.graphics.removeAll()}_addExportGraphics(){const t=this._getManagedLayer("sketch"),i=this._getManagedLayer("buffer");this._selectionSets.forEach((s=>{if(s.download&&(t&&t.graphics.add(s.sketchGraphic),i)){const t=new this.Graphic({geometry:s.buffer,symbol:{type:"simple-fill",color:this.bufferColor,outline:{color:this.bufferOutlineColor,width:1}}});i.graphics.add(t)}}))}_getRefinePage(){const t=this._hasSelections();return a("calcite-panel",null,this._getLabel(this._translations.refineSelection),t?a("div",null,this._getNotice(this._translations.refineTip,"padding-sides-1"),a("refine-selection",{enabledLayerIds:this.selectionLayerIds,locale:this.locale,mapView:this.mapView,selectionSets:this._selectionSets,sketchLineSymbol:this.sketchLineSymbol,sketchPointSymbol:this.sketchPointSymbol,sketchPolygonSymbol:this.sketchPolygonSymbol})):this._getNotice(this._translations.refineTipNoSelections,"padding-sides-1"))}_getPageNavButtons(t,i,s,e,l,o){return a("div",{class:"padding-bottom-1"},a("div",{class:"display-flex padding-top-sides-1"},a("calcite-button",{disabled:i,onClick:s,width:"full"},a("span",{class:"font-weight-500"},t))),a("div",{class:"display-flex padding-top-1-2 padding-sides-1"},a("calcite-button",{appearance:"outline",disabled:l,onClick:o,width:"full"},a("span",{class:"font-weight-500"},e))))}_changeTitle(){this._titleValue=this._titleElement.value}_getNotice(t,i="padding-1",s=""){return a("calcite-notice",{class:i,icon:"lightbulb",kind:"success",open:!0},a("div",{class:s,slot:"message"},t))}_getLabel(t,i=!1,s="font-bold"){return a("div",{class:"padding-top-sides-1"},a("calcite-label",{class:s+=i?" label-margin-0":""},t))}_getExportSelectionLists(){return this._selectionSets.reduce(((t,i)=>{const s=this._getSelectionSetIds(i),e=i.workflowType!==h.REFINE||s.length>0;return!this._downloadActive&&i.download&&e&&(this._downloadActive=!0),e&&t.push(a("div",{class:"display-flex padding-sides-1 padding-bottom-1"},a("calcite-checkbox",{checked:i.download,class:"align-center",onClick:()=>{this._toggleDownload(i.id)}}),a("calcite-list",{class:"list-border margin-start-1-2 width-full",id:"download-list"},a("calcite-list-item",{disabled:!i.download,label:i.label,onClick:()=>{this._toggleDownload(i.id)}},a("div",{slot:"content"},a("div",{class:"list-label"},i.label),a("div",{class:"list-description"},i?.layerView?.layer.title),a("div",{class:"list-description"},this._translations.selectedFeatures.replace("{{n}}",s.length.toString()))))))),t}),[])||a("div",null)}async _toggleDownload(t){let i=!1;this._selectionSets=this._selectionSets.map((s=>(s.download=s.id===t?!s.download:s.download,i=!!s.download||i,s))),this._updateExportGraphics(!0),this._downloadActive=i,this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._fetchingData=!1,await this._highlightFeatures()}async _export(){const t=this._addResults?this._getSelectionIdsAndViews(this._selectionSets,!0):{};if(this._exportType===o.PDF){let i="";if(this._addMap&&this.mapView){const t=await this.mapView.takeScreenshot({width:1500,height:2e3});i=t?.dataUrl}this._fetchingData=!0,await this._downloadTools.downloadPDF(this.mapView.map,t,this._removeDuplicates.checked,this._addTitle?this._titleElement.value:"",i),this._fetchingData=!1}this._exportType===o.CSV&&(this._fetchingData=!0,await this._downloadTools.downloadCSV(this.mapView.map,t,this._removeDuplicates.checked),this._fetchingData=!1)}_getSelectionIdsAndViews(t,i=!1){return(i?t.filter((t=>t.download)):t).reduce(((t,i)=>{if(i.workflowType===h.REFINE)Object.keys(i.refineInfos).forEach((s=>{const e=i.refineInfos[s];e.addIds&&(t=this._updateExportInfos(t,e.layerView.layer.id,i.label,e.addIds,e.layerView))}));else{const s=i?.layerView?.layer.id;t=this._updateExportInfos(t,s,i.label,i.selectedIds,i.layerView)}return t}),{})}_updateExportInfos(t,i,s,e,a){return i&&Object.keys(t).indexOf(i)>-1?(t[i].ids=[...new Set([...t[i].ids,...e])],t[i].selectionSetNames.push(s)):i&&(t[i]={ids:e,layerView:a,selectionSetNames:[s]}),t}_getAction(t,i,s,e,l=!1,o=""){return a("calcite-action",{disabled:!t,icon:i,iconFlipRtl:!0,indicator:l,onClick:e,slot:o,text:s})}_updateForSelection(t){this._numSelected=t.detail,this._saveEnabled=this._numSelected>0}async _home(){await this._clearSelection(),this._setPageType(n.LIST)}async _saveSelection(){const t=await(this._selectTools?.getSelection()),i=this._selectTools?.isUpdate;return this._selectionSets=i?this._selectionSets.map((i=>i.id===t.id?t:i)):[...this._selectionSets,t],this._home()}async _clearSelection(){await(this._selectTools?.clearSelection()),this._numSelected=0,this._activeSelection=void 0}_deleteSelection(t,i){return i.stopPropagation(),this._selectionSets=this._selectionSets.filter(((i,s)=>{if(s!==t)return i})),this._highlightFeatures()}_gotoSelection(t,i){d(t.selectedIds,t.layerView,i,this.featureHighlightEnabled,this.featureEffect)}_openSelection(t,i){i.stopPropagation(),this._activeSelection=t,this._pageType=t.workflowType===h.REFINE?n.REFINE:n.SELECT}async _highlightFeatures(){this._clearHighlight();const t=this._getSelectionIdsAndViews(this._selectionSets,this._pageType===n.EXPORT),i=Object.keys(t);if(i.length>0)for(let s=0;s<i.length;s++){const e=t[i[s]];g.highlightHandles.push(await p(e.ids,e.layerView,this.mapView))}}_checkPopups(){"boolean"!=typeof this._popupsEnabled&&(this._popupsEnabled=this.mapView?.popupEnabled)}_clearHighlight(){g&&g.highlightHandles&&g.removeHandles()}async _getTranslations(){const t=await r(this.el);this._translations=t[0]}static get watchers(){return{mapView:["mapViewWatchHandler"],searchConfiguration:["watchSearchConfigurationHandler"],sketchLineSymbol:["sketchLineSymbolWatchHandler"],sketchPointSymbol:["sketchPointSymbolWatchHandler"],sketchPolygonSymbol:["sketchPolygonSymbolWatchHandler"],_pageType:["pageTypeWatchHandler"]}}};u.style=':host{display:block;--calcite-input-message-spacing-value:0}.align-center{align-items:center}.border-bottom-1{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-color-border-3)}.action-bar-size{height:3.5rem;width:100%}.w-1-2{width:50%}.w-1-3{width:33.33%}.width-full{width:100%}.height-full{height:100%}.padding-1{padding:1rem}.padding-top-sides-1{padding-block-start:1rem;padding-inline-start:1rem;padding-inline-end:1rem}.padding-sides-1{padding-inline-start:1rem;padding-inline-end:1rem}.padding-end-1-2{padding-inline-end:.5rem}.padding-top-1-2{padding-block-start:.5rem}.padding-top-1{padding-top:1rem}.padding-bottom-1{padding-bottom:1rem}.padding-bottom-1-2{padding-bottom:.5rem}.info-blue{color:#00A0FF}.info-message{justify-content:center;display:grid}.font-bold{font-weight:bold}.display-flex{display:flex}.display-block{display:block}.display-none{display:none}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-start-1-2{padding-inline-start:0.5rem}.list-border{border:1px solid var(--calcite-color-border-2)}.margin-sides-1{margin-inline-start:1rem;margin-inline-end:1rem}.margin-start-1-2{margin-inline-start:0.5rem}.float-right{float:right}.float-right[dir="rtl"]{float:left}.float-left{float:left}.float-left[dir="rtl"]{float:right}.margin-top-0{margin-block-start:0 !important}.height-1-1-2{height:1.5rem}.main-background{background-color:var(--calcite-color-foreground-2)}.position-right{position:absolute;right:1rem}.position-right[dir="rtl"]{position:absolute;left:1rem}.label-margin-0{--calcite-label-margin-bottom:0}.list-label{color:var(--calcite-color-text-1)}.list-label,.list-description{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);overflow-wrap:break-word;word-break:break-word}.list-description{margin-block-start:0.125rem;color:var(--calcite-color-text-3)}.img-container{width:100%;height:100%}.font-weight-500{font-weight:500}.background-override{height:100%;width:100%;--calcite-color-foreground-3:var(--calcite-color-brand);--calcite-color-foreground-2:var(--calcite-color-brand-hover);--calcite-color-text-1:var(--calcite-color-text-inverse)}.word-wrap-anywhere{word-wrap:anywhere}';export{u as public_notification}
6
+ import{r as t,c as i,g as s,a as e,h as a,H as l}from"./p-4e6eb06e.js";import{b as o,c as n,a as h}from"./p-80cb7c73.js";import{l as c,g as r}from"./p-f4aadb3b.js";import{e as d,h as p}from"./p-d572627c.js";import{s as g}from"./p-51c6e6fe.js";import{c as b,r as m}from"./p-ff9e28d1.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-dc9d4be3.js";import"./p-7530a02f.js";import"./p-d0d020a5.js";import"./p-9bb44f57.js";const u=class{constructor(s){t(this,s),this.searchConfigurationChange=i(this,"searchConfigurationChange",7),this.addresseeLayerIds=[],this.bufferColor=[227,139,79,.8],this.bufferOutlineColor=[255,255,255],this.customLabelEnabled=void 0,this.defaultBufferDistance=void 0,this.defaultBufferUnit=void 0,this.defaultExportTitle="",this.defaultNumLabelsPerPage=6,this.enableLayerFeatures=!0,this.enableLayerFeaturesOnLoad=!1,this.enableSearchDistance=!0,this.enableSearchDistanceOnLoad=!1,this.enableSketchTools=!0,this.featureEffect=void 0,this.featureHighlightEnabled=void 0,this.locale=void 0,this.mapView=void 0,this.noResultText=void 0,this.searchConfiguration=void 0,this.selectionLayerIds=[],this.showRefineSelection=!1,this.showSearchSettings=!0,this.sketchLineSymbol=void 0,this.sketchPointSymbol=void 0,this.sketchPolygonSymbol=void 0,this._exportGraphics=!1,this._addMap=!1,this._addResults=!0,this._addTitle=!1,this._downloadActive=!0,this._exportType=o.PDF,this._fetchingData=!1,this._isMobile=void 0,this._numDuplicates=0,this._pageType=n.LIST,this._saveEnabled=!1,this._selectionSets=[],this._translations=void 0}get el(){return s(this)}_activeSelection;_downloadTools;_geometryEngine;Graphic;_jsonUtils;_onboardingImageUrl="";_popupsEnabled;_removeDuplicates;_searchConfiguration;_selectTools;_mediaQuery;_titleElement;_titleValue=void 0;_numSelected=0;async mapViewWatchHandler(t){t?.popup&&(this._popupsEnabled=t?.popup.autoOpenEnabled),this._initSearchConfiguration(this.searchConfiguration)}async watchSearchConfigurationHandler(t,i){const s=JSON.stringify(t);this.mapView&&(s!==JSON.stringify(i)||s&&!this._searchConfiguration)&&(this._searchConfiguration=JSON.parse(s),this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}async sketchLineSymbolWatchHandler(t,i){t&&JSON.stringify(t)!==JSON.stringify(i)&&this._setLineSymbol(t)}async sketchPointSymbolWatchHandler(t,i){t&&JSON.stringify(t)!==JSON.stringify(i)&&this._setPointSymbol(t)}async sketchPolygonSymbolWatchHandler(t,i){t&&JSON.stringify(t)!==JSON.stringify(i)&&this._setPolygonSymbol(t)}async pageTypeWatchHandler(t,i){if(this._checkPopups(),this.mapView?.popup&&(this.mapView.popupEnabled=t===n.LIST&&this._popupsEnabled),t===n.EXPORT&&(this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._updateExportGraphics(),this._fetchingData=!1),this._clearHighlight(),i!==n.SELECT&&i!==n.REFINE||await this._clearSelection(),i===n.EXPORT&&this._removeExportGraphics(),t!==n.SELECT)return this._highlightFeatures()}searchConfigurationChange;selectionSetsChanged(t){this._selectionSets=[...t.detail]}connectedCallback(){this._mediaQuery=window.matchMedia("(max-width: 600px)"),this._mediaQuery.addEventListener("change",(t=>this._setIsMobile(t)))}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initSymbols(),this._onboardingImageUrl=e("assets/data/images/onboarding.png")}render(){return a(l,{key:"8b22f6b45144705e9ff5b230ca8075f68985165b"},a("calcite-shell",{key:"774731e643edb5b52bf565349fdfe58dae1e845e"},a("calcite-action-bar",{key:"5e3bcc6ba2f53d25ee2bd972ce67108c0ab808f4",class:"border-bottom-1 action-bar-size","expand-disabled":!0,layout:"horizontal",slot:this._isMobile?"footer":"header"},this._getActionGroup("list-check",n.LIST,this._translations.myLists),this.showRefineSelection?this._getActionGroup("test-data",n.REFINE,this._translations.refineSelection):null,this._getActionGroup("export",n.EXPORT,this._translations.export)),this._getPage(this._pageType)))}async componentDidLoad(){this._initSearchConfiguration(this.searchConfiguration)}disconnectedCallback(){this._mediaQuery.removeEventListener("change",(t=>this._setIsMobile(t)))}async _initModules(){const[t,i,s]=await c(["esri/geometry/geometryEngine","esri/symbols/support/jsonUtils","esri/Graphic"]);this._geometryEngine=t,this._jsonUtils=i,this.Graphic=s}_initSearchConfiguration(t){this.searchConfiguration&&!this._searchConfiguration&&this.mapView&&(this._searchConfiguration=t,this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}_initSymbols(){this._setLineSymbol(this.sketchLineSymbol),this._setPointSymbol(this.sketchPointSymbol),this._setPolygonSymbol(this.sketchPolygonSymbol)}_setLineSymbol(t){this.sketchLineSymbol="simple-line"===t?.type?t:this._jsonUtils.fromJSON(t||{type:"esriSLS",color:[130,130,130,255],width:2,style:"esriSLSSolid"})}_setPointSymbol(t){this.sketchPointSymbol="simple-marker"===t?.type?t:this._jsonUtils.fromJSON(t||{type:"esriSMS",color:[255,255,255,255],angle:0,xoffset:0,yoffset:0,size:6,style:"esriSMSCircle",outline:{type:"esriSLS",color:[50,50,50,255],width:1,style:"esriSLSSolid"}})}_setPolygonSymbol(t){this.sketchPolygonSymbol="simple-fill"===t?.type?t:this._jsonUtils.fromJSON(t||{type:"esriSFS",color:[150,150,150,51],outline:{type:"esriSLS",color:[50,50,50,255],width:2,style:"esriSLSSolid"},style:"esriSFSSolid"})}_setIsMobile(t){this._isMobile=t.matches}_getActionGroup(t,i,s){return a("calcite-action-group",{class:this.showRefineSelection?"w-1-3":"w-1-2",layout:"horizontal"},a("div",{class:"background-override"},a("calcite-action",{active:this._pageType===i,alignment:"center",class:"width-full height-full",compact:!1,icon:t,id:t,onClick:()=>{this._setPageType(i)},text:""})),a("calcite-tooltip",{label:"",placement:"bottom","reference-element":t},a("span",null,s)))}_setPageType(t){this._pageType=t}_getPage(t){let i;switch(t){case n.LIST:i=this._getListPage();break;case n.SELECT:i=this._getSelectPage();break;case n.EXPORT:i=this._getExportPage();break;case n.REFINE:i=this._getRefinePage()}return i}_getListPage(){const t=this._hasSelections();return a("calcite-panel",null,this._getLabel(this._translations.myLists),this._getNotice(t?this._translations.listHasSetsTip:this._translations.selectLayerAndAdd,"padding-sides-1 padding-bottom-1","word-wrap-anywhere"),t?this._getSelectionSetList():this._getOnboardingImage(),a("div",{class:"display-flex padding-1"},a("calcite-button",{onClick:()=>{this._setPageType(n.SELECT)},width:"full"},a("span",{class:"font-weight-500"},this._translations.add))))}_getOnboardingImage(){return a("div",{class:"display-flex padding-sides-1"},a("img",{class:"img-container",role:"presentation",src:this._onboardingImageUrl}))}_getSelectionSetList(){return a("div",{class:"padding-top-1-2 padding-bottom-1-2"},a("calcite-list",{class:"list-border margin-sides-1"},this._selectionSets.reduce(((t,i,s)=>{const e=this._getSelectionSetIds(i);let l=!0;return i.workflowType===h.REFINE&&(l=Object.keys(i.refineInfos).reduce(((t,s)=>{const e=i.refineInfos[s];return t+(e.addIds.length+e.removeIds.length)}),0)>0),l&&t.push(a("calcite-list-item",{label:i.label,onClick:()=>this._gotoSelection(i,this.mapView)},a("div",{slot:"content"},a("div",{class:"list-label"},i.label),a("div",{class:"list-description"},i?.layerView?.layer.title),a("div",{class:"list-description"},this._translations.selectedFeatures.replace("{{n}}",e.length.toString()))),this._getAction(!0,"pencil","",(t=>this._openSelection(i,t)),!1,"actions-end"),this._getAction(!0,"x","",(t=>this._deleteSelection(s,t)),!1,"actions-end"))),t}),[])))}_getSelectionSetIds(t){return t.workflowType!==h.REFINE?t.selectedIds:Object.keys(t.refineInfos).reduce(((i,s)=>[...i,...t.refineInfos[s].addIds]),[])}_hasSelections(t=!1){let i=[];const s=this._selectionSets.some((t=>{if(t.workflowType===h.REFINE)return i=this._getSelectionSetIds(t),!0}));return t&&s?i.length>0||this._selectionSets.length>1:this._selectionSets.length>0}async _getNumDuplicates(){const t=this._getExportInfos(),i=await b(this.mapView.map,t),s=m(i);return i.length-s.length}_getExportInfos(){return this._selectionSets.reduce(((t,i)=>(i.download&&(i.workflowType!==h.REFINE?this._updateIds(i.layerView.layer.id,i.layerView,i.selectedIds,t):Object.keys(i.refineInfos).forEach((s=>{const e=i.refineInfos[s];e.addIds.length>0&&this._updateIds(s,e.layerView,e.addIds,t)}))),t)),{})}_updateIds(t,i,s,e){return e[t]?e[t].ids=e[t].ids.concat(s):e[t]={layerView:i,ids:s},e}_getSelectPage(){const t=this._translations.selectSearchTip;return a("calcite-panel",null,this._getLabel(this._translations.stepTwoFull,!0),this._getNotice(t,"padding-1","word-wrap-anywhere"),a("div",null,a("map-select-tools",{bufferColor:this.bufferColor,bufferOutlineColor:this.bufferOutlineColor,class:"font-bold",customLabelEnabled:this.customLabelEnabled,defaultBufferDistance:this.defaultBufferDistance,defaultBufferUnit:this.defaultBufferUnit,enableLayerFeatures:this.enableLayerFeatures,enableLayerFeaturesOnLoad:this.enableLayerFeaturesOnLoad,enableSearchDistance:this.enableSearchDistance,enableSearchDistanceOnLoad:this.enableSearchDistanceOnLoad,enableSketchTools:this.enableSketchTools,enabledLayerIds:this.addresseeLayerIds,isUpdate:!!this._activeSelection,locale:this.locale,mapView:this.mapView,noResultText:this.noResultText,onSelectionSetChange:t=>this._updateForSelection(t),ref:t=>{this._selectTools=t},searchConfiguration:this._searchConfiguration,selectionLayerIds:this.selectionLayerIds,selectionSet:this._activeSelection,sketchLineSymbol:this.sketchLineSymbol,sketchPointSymbol:this.sketchPointSymbol,sketchPolygonSymbol:this.sketchPolygonSymbol})),this._getPageNavButtons(this._translations.done,0===this._numSelected,(()=>{this._saveSelection()}),this._translations.cancel,!1,(()=>{this._home()})))}_getExportPage(){const t=this._hasSelections(this.showRefineSelection),i=this._numDuplicates>0?"display-block":"display-none";return a("calcite-panel",null,a("div",null,this._getLabel(this._translations.export,!1),t?a("div",null,this._getNotice(this._translations.exportTip,"padding-sides-1"),this._getLabel(this._translations.exportListsLabel),this._getExportSelectionLists(),a("div",{class:"padding-sides-1 "+i},a("div",{class:"display-flex"},a("calcite-label",{layout:"inline"},a("calcite-checkbox",{ref:t=>{this._removeDuplicates=t}}),a("div",{class:"display-flex"},this._translations.removeDuplicate,a("div",{class:"info-message padding-start-1-2"},a("calcite-input-message",{class:"info-blue margin-top-0",scale:"m"},` ${this._translations.numDuplicates.replace("{{n}}",this._numDuplicates.toString())}`)))),a("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"remove-duplicates-icon",scale:"s"})),a("calcite-popover",{closable:!0,label:"",referenceElement:"remove-duplicates-icon"},a("span",{class:"tooltip-message"},this._translations.duplicatesTip))),a("div",{class:"border-bottom"}),a("div",{class:"padding-top-sides-1"},a("calcite-segmented-control",{class:"w-100",onCalciteSegmentedControlChange:t=>this._exportTypeChange(t),width:"full"},a("calcite-segmented-control-item",{checked:this._exportType===o.PDF,class:"w-50 end-border",value:o.PDF},a("span",{class:"font-weight-500"},this._translations.pdf)),a("calcite-segmented-control-item",{checked:this._exportType===o.CSV,class:"w-50",value:o.CSV},a("span",{class:"font-weight-500"},this._translations.csv)))),a("div",{class:"padding-bottom-1"},this._getExportOptions()),a("div",{class:"padding-1 display-flex"},a("calcite-button",{disabled:!this._downloadActive||this._fetchingData||!this._addMap&&!this._addResults,loading:this._fetchingData,onClick:()=>{this._export()},width:"full"},a("span",{class:"font-weight-500"},this._translations.export)))):this._getNotice(this._translations.downloadNoLists,"padding-sides-1 padding-bottom-1")))}_exportTypeChange(t){this._exportType=t.target.value}_getExportOptions(){const t=this._addTitle?"display-block":"display-none",i=this._addMap?"display-flex":"display-none",s=this._titleValue?this._titleValue:this.defaultExportTitle?this.defaultExportTitle:"",e=this._addResults?"":"display-none";return a("div",{class:this._exportType===o.PDF?"display-block":"display-none"},this._getLabel(this._translations.pdfOptions,!0),a("div",{class:"padding-top-sides-1"},a("calcite-label",{class:"label-margin-0",layout:"inline"},a("calcite-checkbox",{checked:this._addResults,onCalciteCheckboxChange:()=>this._addResults=!this._addResults}),this._translations.addResults)),a("div",{class:`padding-top-sides-1 ${e}`},a("calcite-label",{class:"label-margin-0"},this._translations.selectPDFLabelOption)),a("div",{class:`padding-sides-1 ${e}`},a("pdf-download",{defaultNumLabelsPerPage:parseInt(this.defaultNumLabelsPerPage.toString(),10),disabled:!this._downloadActive,ref:t=>{this._downloadTools=t}})),a("div",{class:"padding-top-sides-1"},a("calcite-label",{class:"label-margin-0",layout:"inline"},a("calcite-checkbox",{checked:this._addTitle,onCalciteCheckboxChange:()=>this._addTitle=!this._addTitle}),this._translations.title)),a("div",{class:t},this._getLabel(this._translations.title,!0,""),a("calcite-input-text",{class:"padding-sides-1",onCalciteInputTextInput:()=>this._changeTitle(),placeholder:this._translations.titlePlaceholder,ref:t=>{this._titleElement=t},value:s})),a("div",{class:"padding-top-sides-1"},a("calcite-label",{class:"label-margin-0",layout:"inline"},a("calcite-checkbox",{checked:this._addMap,onCalciteCheckboxChange:()=>this._handleAddMapChange()}),this._translations.includeMap)),a("div",{class:`padding-top-sides-1 ${i}`},a("calcite-label",{class:"label-margin-0",layout:"inline"},a("calcite-checkbox",{checked:this._exportGraphics,onCalciteCheckboxChange:()=>this._handleExportGraphicsChange()}),this._translations.listGraphics),a("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"list-graphics-icon",scale:"s"}),a("calcite-popover",{closable:!0,label:"",referenceElement:"list-graphics-icon"},a("span",{class:"tooltip-message"},this._translations.listGraphicsTip))))}_handleAddMapChange(){this._addMap=!this._addMap,this._updateExportGraphics()}_handleExportGraphicsChange(){this._exportGraphics=!this._exportGraphics,this._updateExportGraphics()}_getManagedLayer(t){let i;return Object.keys(g.managedLayers).some((s=>{const e=this.mapView.map.layers.findIndex((t=>t.title===s));if(g.managedLayers[s]===t)return i=this.mapView.map.layers.getItemAt(e),!0})),i}_updateExportGraphics(t=!1){!t&&this._exportGraphics&&this._addMap||this._removeExportGraphics(),this._exportGraphics&&this._addMap&&this._addExportGraphics()}_removeExportGraphics(){const t=this._getManagedLayer("sketch"),i=this._getManagedLayer("buffer");t&&t.graphics.removeAll(),i&&i.graphics.removeAll()}_addExportGraphics(){const t=this._getManagedLayer("sketch"),i=this._getManagedLayer("buffer");this._selectionSets.forEach((s=>{if(s.download&&(t&&t.graphics.add(s.sketchGraphic),i)){const t=new this.Graphic({geometry:s.buffer,symbol:{type:"simple-fill",color:this.bufferColor,outline:{color:this.bufferOutlineColor,width:1}}});i.graphics.add(t)}}))}_getRefinePage(){const t=this._hasSelections();return a("calcite-panel",null,this._getLabel(this._translations.refineSelection),t?a("div",null,this._getNotice(this._translations.refineTip,"padding-sides-1"),a("refine-selection",{enabledLayerIds:this.selectionLayerIds,locale:this.locale,mapView:this.mapView,selectionSets:this._selectionSets,sketchLineSymbol:this.sketchLineSymbol,sketchPointSymbol:this.sketchPointSymbol,sketchPolygonSymbol:this.sketchPolygonSymbol})):this._getNotice(this._translations.refineTipNoSelections,"padding-sides-1"))}_getPageNavButtons(t,i,s,e,l,o){return a("div",{class:"padding-bottom-1"},a("div",{class:"display-flex padding-top-sides-1"},a("calcite-button",{disabled:i,onClick:s,width:"full"},a("span",{class:"font-weight-500"},t))),a("div",{class:"display-flex padding-top-1-2 padding-sides-1"},a("calcite-button",{appearance:"outline",disabled:l,onClick:o,width:"full"},a("span",{class:"font-weight-500"},e))))}_changeTitle(){this._titleValue=this._titleElement.value}_getNotice(t,i="padding-1",s=""){return a("calcite-notice",{class:i,icon:"lightbulb",kind:"success",open:!0},a("div",{class:s,slot:"message"},t))}_getLabel(t,i=!1,s="font-bold"){return a("div",{class:"padding-top-sides-1"},a("calcite-label",{class:s+=i?" label-margin-0":""},t))}_getExportSelectionLists(){return this._selectionSets.reduce(((t,i)=>{const s=this._getSelectionSetIds(i),e=i.workflowType!==h.REFINE||s.length>0;return!this._downloadActive&&i.download&&e&&(this._downloadActive=!0),e&&t.push(a("div",{class:"display-flex padding-sides-1 padding-bottom-1"},a("calcite-checkbox",{checked:i.download,class:"align-center",onClick:()=>{this._toggleDownload(i.id)}}),a("calcite-list",{class:"list-border margin-start-1-2 width-full",id:"download-list"},a("calcite-list-item",{disabled:!i.download,label:i.label,onClick:()=>{this._toggleDownload(i.id)}},a("div",{slot:"content"},a("div",{class:"list-label"},i.label),a("div",{class:"list-description"},i?.layerView?.layer.title),a("div",{class:"list-description"},this._translations.selectedFeatures.replace("{{n}}",s.length.toString()))))))),t}),[])||a("div",null)}async _toggleDownload(t){let i=!1;this._selectionSets=this._selectionSets.map((s=>(s.download=s.id===t?!s.download:s.download,i=!!s.download||i,s))),this._updateExportGraphics(!0),this._downloadActive=i,this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._fetchingData=!1,await this._highlightFeatures()}async _export(){const t=this._addResults?this._getSelectionIdsAndViews(this._selectionSets,!0):{};if(this._exportType===o.PDF){let i="";if(this._addMap&&this.mapView){const t=await this.mapView.takeScreenshot({width:1500,height:2e3});i=t?.dataUrl}this._fetchingData=!0,await this._downloadTools.downloadPDF(this.mapView.map,t,this._removeDuplicates.checked,this._addTitle?this._titleElement.value:"",i),this._fetchingData=!1}this._exportType===o.CSV&&(this._fetchingData=!0,await this._downloadTools.downloadCSV(this.mapView.map,t,this._removeDuplicates.checked),this._fetchingData=!1)}_getSelectionIdsAndViews(t,i=!1){return(i?t.filter((t=>t.download)):t).reduce(((t,i)=>{if(i.workflowType===h.REFINE)Object.keys(i.refineInfos).forEach((s=>{const e=i.refineInfos[s];e.addIds&&(t=this._updateExportInfos(t,e.layerView.layer.id,i.label,e.addIds,e.layerView))}));else{const s=i?.layerView?.layer.id;t=this._updateExportInfos(t,s,i.label,i.selectedIds,i.layerView)}return t}),{})}_updateExportInfos(t,i,s,e,a){return i&&Object.keys(t).indexOf(i)>-1?(t[i].ids=[...new Set([...t[i].ids,...e])],t[i].selectionSetNames.push(s)):i&&(t[i]={ids:e,layerView:a,selectionSetNames:[s]}),t}_getAction(t,i,s,e,l=!1,o=""){return a("calcite-action",{disabled:!t,icon:i,iconFlipRtl:!0,indicator:l,onClick:e,slot:o,text:s})}_updateForSelection(t){this._numSelected=t.detail,this._saveEnabled=this._numSelected>0}async _home(){await this._clearSelection(),this._setPageType(n.LIST)}async _saveSelection(){const t=await(this._selectTools?.getSelection()),i=this._selectTools?.isUpdate;return this._selectionSets=i?this._selectionSets.map((i=>i.id===t.id?t:i)):[...this._selectionSets,t],this._home()}async _clearSelection(){await(this._selectTools?.clearSelection()),this._numSelected=0,this._activeSelection=void 0}_deleteSelection(t,i){return i.stopPropagation(),this._selectionSets=this._selectionSets.filter(((i,s)=>{if(s!==t)return i})),this._highlightFeatures()}_gotoSelection(t,i){d(t.selectedIds,t.layerView,i,this.featureHighlightEnabled,this.featureEffect)}_openSelection(t,i){i.stopPropagation(),this._activeSelection=t,this._pageType=t.workflowType===h.REFINE?n.REFINE:n.SELECT}async _highlightFeatures(){this._clearHighlight();const t=this._getSelectionIdsAndViews(this._selectionSets,this._pageType===n.EXPORT),i=Object.keys(t);if(i.length>0)for(let s=0;s<i.length;s++){const e=t[i[s]];g.highlightHandles.push(await p(e.ids,e.layerView,this.mapView))}}_checkPopups(){"boolean"!=typeof this._popupsEnabled&&(this._popupsEnabled=this.mapView?.popupEnabled)}_clearHighlight(){g&&g.highlightHandles&&g.removeHandles()}async _getTranslations(){const t=await r(this.el);this._translations=t[0]}static get watchers(){return{mapView:["mapViewWatchHandler"],searchConfiguration:["watchSearchConfigurationHandler"],sketchLineSymbol:["sketchLineSymbolWatchHandler"],sketchPointSymbol:["sketchPointSymbolWatchHandler"],sketchPolygonSymbol:["sketchPolygonSymbolWatchHandler"],_pageType:["pageTypeWatchHandler"]}}};u.style=':host{display:block;--calcite-input-message-spacing-value:0}.align-center{align-items:center}.border-bottom-1{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-color-border-3)}.action-bar-size{height:3.5rem;width:100%}.w-1-2{width:50%}.w-1-3{width:33.33%}.width-full{width:100%}.height-full{height:100%}.padding-1{padding:1rem}.padding-top-sides-1{padding-block-start:1rem;padding-inline-start:1rem;padding-inline-end:1rem}.padding-sides-1{padding-inline-start:1rem;padding-inline-end:1rem}.padding-end-1-2{padding-inline-end:.5rem}.padding-top-1-2{padding-block-start:.5rem}.padding-top-1{padding-top:1rem}.padding-bottom-1{padding-bottom:1rem}.padding-bottom-1-2{padding-bottom:.5rem}.info-blue{color:#00A0FF}.info-message{justify-content:center;display:grid}.font-bold{font-weight:bold}.display-flex{display:flex}.display-block{display:block}.display-none{display:none}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-start-1-2{padding-inline-start:0.5rem}.list-border{border:1px solid var(--calcite-color-border-2)}.margin-sides-1{margin-inline-start:1rem;margin-inline-end:1rem}.margin-start-1-2{margin-inline-start:0.5rem}.float-right{float:right}.float-right[dir="rtl"]{float:left}.float-left{float:left}.float-left[dir="rtl"]{float:right}.margin-top-0{margin-block-start:0 !important}.height-1-1-2{height:1.5rem}.main-background{background-color:var(--calcite-color-foreground-2)}.position-right{position:absolute;right:1rem}.position-right[dir="rtl"]{position:absolute;left:1rem}.label-margin-0{--calcite-label-margin-bottom:0}.list-label{color:var(--calcite-color-text-1)}.list-label,.list-description{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);overflow-wrap:break-word;word-break:break-word}.list-description{margin-block-start:0.125rem;color:var(--calcite-color-text-3)}.img-container{width:100%;height:100%}.font-weight-500{font-weight:500}.background-override{height:100%;width:100%;--calcite-color-foreground-3:var(--calcite-color-brand);--calcite-color-foreground-2:var(--calcite-color-brand-hover);--calcite-color-text-1:var(--calcite-color-text-inverse)}.word-wrap-anywhere{word-wrap:anywhere}';export{u as public_notification}