@arcgis/core 4.31.0-next.20241019 → 4.31.0-next.20241021
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/applications/MapViewer/templateUtils.d.ts +4 -0
- package/applications/MapViewer/templateUtils.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/67018ef25736f0722f6e.js +1 -0
- package/interfaces.d.ts +118 -0
- package/layers/SceneLayer.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/support/columnUtils.js +1 -1
- package/widgets/FeatureTable/support/tableUtils.js +1 -1
- package/widgets/FeatureTable/support/templateUtils.js +5 -0
- package/assets/esri/core/workers/chunks/a5675c989d00b7400f98.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Collection.js";import{referenceSetter as i}from"../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../core/deprecate.js";import o from"../../core/Error.js";import l from"../../core/Handles.js";import n from"../../core/Logger.js";import{debounce as a,ignoreAbortErrors as r,createResolver as h}from"../../core/promiseUtils.js";import{watch as d,initial as c,on as m}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{getLowerCaseDefaultHiddenFields as u}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as b,isSubtypeGroupLayer as f}from"../../layers/support/layerUtils.js";import{highlightsSupported as y}from"../../views/support/layerViewUtils.js";import{isSelectableLayer as w}from"../../views/support/selectionUtils.js";import T from"./ActionColumn.js";import _ from"./AttachmentsColumn.js";import I from"./FieldColumn.js";import C from"./RelationshipColumn.js";import v from"./Grid/Column.js";import E from"./Grid/Grid.js";import j from"./Grid/GridViewModel.js";import S from"./Grid/GroupColumn.js";import A from"./support/AttachmentsColumnTemplate.js";import F from"./support/AttachmentsViewOptions.js";import{downloadAttachmentInfo as R,exportToCSV as x}from"./support/exportUtils.js";import O from"./support/FeatureStore.js";import U from"./support/FieldColumnTemplate.js";import V from"./support/RelationshipColumnTemplate.js";import z from"./support/TableTemplate.js";import{findRelationship as P,uniqueColumnNames as W,getRelationshipIdsToShow as L}from"./support/tableUtils.js";import"../support/widgetUtils.js";import{messageBundle as B}from"../support/decorators/messageBundle.js";import{onLocaleChange as G}from"../../intl/locale.js";import{substitute as Z}from"../../intl/substitute.js";import{fetchMessageBundle as k}from"../../intl/messages.js";const M="80px";let H=class extends j{constructor(e){super(e),this._debounceRefresh=a((()=>this._refresh())),this._highlights=new l,this.actionColumnConfig=null,this.attachmentsViewOptions=new F,this.autoRefreshEnabled=!0,this.columns=new t,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:o}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===o.length&&-1===o.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const l=this.paginationEnabled?this.pageIndex:e.page,n=await s.fetchItems({...e,page:l});t&&t(n)},this.editingEnabled=!1,this.grid=null,this.highlightEnabled=!0,this.itemIdPath="objectId",this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new t,this.relationshipColumnConfigs=null,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,this.tableController=null,this.tableParent=null,this.tableTemplate=null,this.tableTemplateOverride=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._onShowPromptCallback=this._onShowPromptCallback.bind(this),this._set("store",new O),this._set("grid",new E({itemIdPath:this.itemIdPath,viewModel:this}))}initialize(){const e=async()=>{this.messages=await k("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await k("esri/t9n/common"),this.messagesUnits=await k("esri/core/t9n/Units"),this.messagesURIUtils=await k("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([G((()=>{e(),this._generateColumns()})),d((()=>[this.messages,this.messagesCommon,this.messagesURIUtils]),(()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.allColumns.forEach((t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils})),this.refreshCellContent()}),c),m((()=>this.highlightIds),"change",(e=>this._onHighlightIdsChange(e)),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),d((()=>this.attachmentsEnabled),(()=>this.layer?.loaded&&this._generateColumns())),d((()=>this._viewSelection),(()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)})),d((()=>[this._tableHighlightsReady,this._viewSelectionReady]),(()=>this._syncSelection())),d((()=>this.layer),(async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch((()=>{})))})),d((()=>this.layer?.loaded),(e=>e&&this._onLayerLoad())),d((()=>this.store.state),(e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())})),d((()=>this._effectiveTableTemplate),(()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()})),d((()=>this.editingEnabled),(e=>{this.editableColumns.forEach((t=>t.tableEditingEnabled=e)),this.refreshCellContent()})),d((()=>this.timeZone??this.view?.timeZone),(()=>this.refreshCellContent())),d((()=>this.layer?.definitionExpression),((e,t)=>(e||t)&&"loaded"===this.store.state&&this.reset())),d((()=>this.layer?.timeExtent),((e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset())),m((()=>this.layer),"refresh",(e=>this._onLayerRefresh(e))),m((()=>this.grid),["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],(({index:e,item:t,native:i,path:s,type:o})=>{const l=t?.feature,n=l?.getObjectId(),a="cell-keydown"===o&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(o,{feature:l,index:e,native:i,type:o,fieldName:s??void 0,objectId:n}),(a||"cell-click"===o)&&this._onCellInteraction(n)})),d((()=>this.actionColumnConfig),(e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())})),d((()=>this.relatedRecordsEnabled),(()=>this.layer?.loaded&&this._generateColumns())),m((()=>this.objectIds),"change",(()=>this._onObjectIdsChange()),{onListenerAdd:()=>this._onObjectIdsChange()}),d((()=>[this.paginationEnabled,this.pageIndex]),(()=>this.refreshPageCache())),d((()=>this.activeSortOrders),(e=>this.store.sortOrders=e)),d((()=>this.pageCount),(()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)})),d((()=>this.state),(e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()})),m((()=>this.tableParent?.highlightIds),"change",(({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:o}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:o}})),m((()=>this.tableParent),"cell-click",(e=>{const{tableParent:t}=this,{objectId:i}=e;t&&null!=i&&t.highlightIds.add(i)})),d((()=>this.attachmentsViewOptions.objectId),((e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}))])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return u(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _highlightableLayerView(){const e=this.layerView;return y(e)?e:null}get _relationshipInfos(){return this.store.relationshipInfos}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;return w(e)&&this._selectionManager?.sources.includes(e)?e:null}get _subtypes(){return b(this.layer)}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get activeFilters(){const{filterGeometry:e,objectIds:i,filterBySelectionEnabled:s,highlightIds:o}=this,l=new t;return e&&l.push({type:"geometry",geometry:e}),s?l.push({type:"selection",objectIds:o.toArray()}):i.length&&l.push({type:"objectId",objectIds:i.toArray()}),l}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map((({path:e,direction:t})=>({fieldName:e,direction:t}))).filter((e=>e.fieldName&&e.direction)):[]}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get hiddenFields(){return this._get("hiddenFields")??new t}set hiddenFields(e){this._set("hiddenFields",i(e,this._get("hiddenFields"),t))}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isQueryingOrSyncing(){const{store:e}=this;return e?.syncing||e?.querying||this.relatedTables.some((e=>!!e.isQueryingOrSyncing))}get isSyncingAttachments(){return this.store.syncingAttachmentEdits||this.relatedTables.some((e=>!!e.isSyncingAttachments))}get layer(){return this._get("layer")}set layer(e){this.drainRelatedTables(),this._set("layer",e)}get layerView(){return this.store.layerView}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find((({id:t})=>t===e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.highlightIds.removeAll(),this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get showAllRelatedTables(){return this._get("showAllRelatedTables")}set showAllRelatedTables(e){const{relatedTable:t}=this;this._set("showAllRelatedTables",e),t&&(e?this._showAllRelatedTables(t):this._hideAllRelatedTables(t))}get showPrompt(){return e=>{this.prompt?.cancel?.(),this.prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){const{store:{supportsAddingAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){const{store:{supportsDeletingAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){const{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this._get("timeZone")}set timeZone(e){this.allColumns.forEach((t=>t.tableTimeZone=e)),this._set("timeZone",e)}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach((t=>t.view=e)),this.refreshCellContent()}async addAttachment(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.addAttachment(e,t).catch((e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)})),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.deleteAttachments(e,t).catch((e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)})),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}collapseRelatedTable(e,i){const{relatedLayer:s,objectId:o,relationshipId:l}=i,{objectIdField:n}=s,a=P(s,l),r=s.displayField||a?.keyField||n;e.set({highlightIds:new t([o]),multipleSelectionEnabled:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,r,l)});const h=e.hiddenFields;h.includes(W.action)||h.add(W.action),h.includes(W.attachments)||h.add(W.attachments),e.scrollLeft()}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter((e=>!e.error)).map((e=>e.objectId));i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find((e=>e.id===t));R(i)}drainRelatedTables(){this.relatedTables.drain((e=>e.destroy())),this.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([W.action,W.attachments])}drainRelatedTablesAboveIndex(e){const{relatedTables:t}=this,i=t.slice(e+1);t.removeMany(i).forEach((e=>e.destroy()));const s=t.at(-1);s&&(s.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(s):this._hideAllRelatedTables(s))}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await x({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(s(n.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}hideAttachmentsView(){this.attachmentsViewOptions.objectId=null,this.set({relationshipColumnConfigs:null,multipleSelectionEnabled:!0,tableTemplateOverride:null}),this.hiddenFields.remove(W.action)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){return this.relatedTables.forEach((async e=>await e.refresh())),r(this._debounceRefresh())}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning("Row not found. Associated data may not be loaded yet.")}scrollToTop(){this.grid?.scrollToTop()}async saveAttachmentsViewForm(){const{attachmentId:e,form:t,objectId:i}=this.attachmentsViewOptions;null!=i&&t&&(null!=e?await this.updateAttachment(i,e,t):await this.addAttachment(i,t))}async showAttachmentsView({index:e,objectId:i}){const{attachmentsViewOptions:s,hiddenFields:o,layer:l}=this;if(!this.attachmentsEnabled||!l)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await l.load();const n=l.displayField||l.objectIdField,a=await this.store.getAttachmentsByObjectId(i,!0);s.set({attachmentInfos:a,mode:a.length?"list":"file",objectId:i}),this.set({highlightIds:new t([i]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(n)}),o.includes(W.action)||o.add(W.action),null!=e&&this.scrollToIndex(e)}clearSelectionFilter(){s(n.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:l}=this,n=s.objectId===e;await l.updateAttachment(e,t,i).catch((e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)})),n&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await l.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const o=await e.queryFeatures(s);try{await t.goTo(o.features)}catch(l){"AbortError"!==l.name&&console.error(l)}}async _refresh(){await this.store.refresh();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach(((t,i)=>{t||this.highlightIds.remove(e[i])}))}this.refreshPageCache()}async _onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;e.parent&&f(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,o=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=o),this.grid?.set("pageSize",o),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const e=this._effectiveTableTemplate?.columnTemplates,t=e?this._generateColumnsFromTemplates(e):this._generateDefaultFieldColumns();t.length&&(this.attachmentsEnabled&&!t.some((e=>"onShowAttachments"in e))&&t.push(this._generateDefaultAttachmentsColumn()),this.relatedRecordsEnabled&&this._relationshipInfos.length&&!t.some((e=>"relationshipId"in e))&&t.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&t.push(this._generateActionColumn()),t.sort(((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0)),this.columns.addMany(t))}_generateColumnsFromTemplates(e){const{editingEnabled:t,grid:i,layer:s,messages:o,messagesCommon:l,messagesURIUtils:n,store:a,timeZone:r,view:h}=this;if(!s)return[];const d=s.fields??[],c=[],m=e=>d.find((t=>e.fieldName.toLowerCase()===t.name?.toLowerCase()));return e.forEach(((e,d)=>{const{autoWidth:p,description:g,direction:u,flexGrow:b,fieldName:f,formatFunction:y,frozen:w,frozenToEnd:T,icon:_,initialSortPriority:C,invalid:E,label:j,menuConfig:A,resizable:F,sortable:R,textAlign:x,textWrap:O,timeZone:U,type:V,width:z}=e;if(!V)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(w&&T)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const P=!1===e.visible;if("group"===V){if(!e.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!e.label)return void this._logTemplateWarning("Group columns require a label.");const t=this._generateColumnsFromTemplates(e.columnTemplates),s=P||this._isFieldHidden(e.label);c.push(new S({autoWidth:p,columns:t,description:g,flexGrow:b,frozen:w,frozenToEnd:T,grid:i,hidden:s,icon:_,invalid:E,label:j,menuConfig:A,messages:o,messagesCommon:l,messagesURIUtils:n,resizable:F,tableTimeZone:r,textAlign:x,textWrap:O,timeZone:U,width:z}))}else if("attachment"===V){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");c.push(this._generateAttachmentsColumnFromTemplate(e,d))}else if("relationship"===V){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:t}=e;if(null==t)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this._relationshipInfos.find((e=>e.relationshipId===t));if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");c.push(this._generateRelationshipColumnFromTemplate(i,e,d))}else if(!f)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const W=P||this._isFieldHidden(f);if("column"===V)c.push(new v({autoWidth:p,description:g,direction:u,fieldName:f,flexGrow:b,formatFunction:y,frozen:w,frozenToEnd:T,grid:i,hidden:W,icon:_,initialSortPriority:C,invalid:E,label:j,menuConfig:A,messages:o,messagesCommon:l,messagesURIUtils:n,resizable:F,sortable:R,tableTimeZone:r,textAlign:x,textWrap:O,timeZone:U,width:z}));else if("field"===V){const d=m(e);if(!d)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:f,required:v}=e;c.push(new I({autoWidth:p,description:g,direction:u,editable:f,field:d,fieldName:d.name,flexGrow:b,formatFunction:y,frozen:w,frozenToEnd:T,grid:i,hidden:W,icon:_,initialSortPriority:C,invalid:E,label:j,layer:s,messages:o,messagesCommon:l,messagesURIUtils:n,menuConfig:A,required:v,resizable:F,sortable:R,store:a,tableEditingEnabled:t,tableTimeZone:r,template:e,textAlign:x,textWrap:O,timeZone:U,width:z,view:h,onShowPromptCallback:this._onShowPromptCallback}))}})),c}_generateDefaultFieldColumns(){const{editingEnabled:e,grid:t,layer:i,messages:s,messagesCommon:o,messagesURIUtils:l,store:n,timeZone:a,view:r}=this,h=[];return i?.fields.length?(i.fields.forEach((d=>{if(!d.visible||"geometry"===d.type)return;const c=d.name;h.push(new I({field:d,fieldName:c,grid:t,hidden:this._isFieldHidden(c),layer:i,messages:s,messagesCommon:o,messagesURIUtils:l,store:n,tableEditingEnabled:e,tableTimeZone:a,view:r,onShowPromptCallback:this._onShowPromptCallback}))})),h):h}_generateAttachmentsColumnFromTemplate(e,t){const{grid:i,layer:s,messages:o,messagesCommon:l,messagesURIUtils:n,store:a,timeZone:r}=this,{attachmentsViewEnabled:h,autoWidth:d,description:c,flexGrow:m,fieldName:p,formatFunction:g,frozen:u,frozenToEnd:b,icon:f,invalid:y,label:w,menuConfig:T,resizable:I,textAlign:C,textWrap:v,thumbnailAppearance:E,thumbnailCount:j,thumbnailIconScale:S,thumbnailsEnabled:A,timeZone:F,width:R}=e;return new _({attachmentsViewEnabled:h,autoWidth:d,description:c,fieldName:`${W.attachments}-${t}`,flexGrow:m,formatFunction:g,frozen:u,frozenToEnd:b,grid:i,hidden:!1===e.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,invalid:y,label:w,layer:s,menuConfig:T,messages:o,messagesCommon:l,messagesURIUtils:n,resizable:I,store:a,tableTimeZone:r,textAlign:C,textWrap:v,thumbnailAppearance:E,thumbnailCount:j,thumbnailIconScale:S,thumbnailsEnabled:A,timeZone:F,width:R,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(){const{grid:e,layer:t,messages:i,messagesCommon:s,messagesURIUtils:o,store:l,timeZone:n}=this,a=W.attachments,r=this._isFieldHidden(a);return new _({fieldName:a,grid:e,hidden:r,layer:t,messages:i,messagesCommon:s,messagesURIUtils:o,store:l,tableTimeZone:n,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:o,messagesCommon:l,messagesURIUtils:n,store:a,timeZone:r}=this,{autoWidth:h,collapsed:d,description:c,flexGrow:m,fieldName:p,formatFunction:g,frozen:u,frozenToEnd:b,icon:f,invalid:y,label:w,menuConfig:T,relationshipId:_,resizable:I,textAlign:v,textWrap:E,timeZone:j,width:S}=t;return new C({autoWidth:h,collapsed:d,description:c,fieldName:`${W.relationship}-${_}-${i}`,flexGrow:m,formatFunction:g,frozen:u,frozenToEnd:b,grid:s,hidden:!1===t.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,invalid:y,label:w,menuConfig:T,messages:o,messagesCommon:l,messagesURIUtils:n,relationshipId:_,resizable:I,store:a,tableTimeZone:r,textAlign:v,textWrap:E,timeZone:j,width:S,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){const{_relationshipInfos:e,grid:t,messages:i,messagesCommon:s,messagesURIUtils:o,relationshipColumnConfigs:l}=this,n=[];if(!e?.length)return n;const a={grid:t,messages:i,messagesCommon:s,messagesURIUtils:o};return l?l.forEach(((t,i)=>{const{relationshipId:s}=t,o=e.find((e=>e.relationshipId===s));o&&n.push(new C({...t,...a,fieldName:`${W.relationship}-${s}-${i}`,layer:o.relatedLayer,relatedLayer:o.layer,relationshipId:s,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})):e.forEach((({layer:e,relatedLayer:t,relationshipId:i},s)=>{n.push(new C({...a,fieldName:`${W.relationship}-${i}-${s}`,layer:t,relatedLayer:e,relationshipId:i,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})),n}_generateActionColumn(){return new T({hidden:this._isFieldHidden(W.action),...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some((e=>e.toLowerCase()===t))}_addTableHighlight(e){const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),o=s?.feature??e;this._highlights.add(t.highlight(o),`${i.id}-${e}`)}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(`${t.id}-${e}`)}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach((e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._tableHighlightsReady?(i.forEach((e=>this._removeTableHighlight(e))),t.forEach((e=>this._addTableHighlight(e)))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),null!=s.objectId){const e=this.highlightIds.at(0);if(null!=e){const t=await this.store.getAttachmentsByObjectId(e,!0);s.set({attachmentInfos:t,objectId:e,mode:t.length?"list":"file"})}}}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain((e=>!e.destroyed&&e.destroy()))}_showAllRelatedTables(e){const t=e.layer;if(!t)return;const i=t.displayField||t.objectIdField;e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,i)});const s=e.hiddenFields;s.includes(W.action)||s.add(W.action),s.includes(W.attachments)||s.add(W.attachments)}_hideAllRelatedTables(e){const{layer:t,relationship:i}=e;if(t&&null!=i?.id)if(null!=e.attachmentsViewOptions.objectId){const t=e.layer?.displayField||e.layer?.objectIdField||"";e.set({multipleSelectionEnabled:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(t)})}else e.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:L(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([W.action,W.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new z({columnTemplates:[new U({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map((([s,o])=>({selected:s===t,label:o||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}})))},resizable:!1}),new V({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:M})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new U({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map((([i,s])=>({selected:i===t,label:s||i,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,i)}})))},resizable:!1})];return null!=e.attachmentsViewOptions.objectId&&i.push(new A({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:M})),new z({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:o}=e,{_subtypes:l,layer:n}=this;if(!n||!l.length)return void t.cancel();const a=l.find((e=>e.code===o));if(!a)return void t.cancel();const r=h(),d=this._createSubtypeEditPrompt(s,a,r),c=!!n.parent;try{this.showPrompt(d);const e=await r.promise,s=[{fieldName:t.fieldName,value:o}];switch(e){case"update-fields":for(const[e,t]of Object.entries(a.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),c&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),c&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,i){const{_subtypes:s,messages:o,messagesCommon:l}=this,n=s.find((t=>t.code===e))?.name??`${e}`;let a="update-fields";const r=[{label:o.subtypes.useDefaultValuesOption,value:"update-fields"},{label:o.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:o.subtypes.changeWarningTitle,message:Z(o.subtypes.changeWarning,{originalType:n,newType:t.name}),radios:r,defaultRadioSelection:"update-fields",onRadioSelection:e=>{a=e},actions:{primary:{label:l.apply,action:()=>i.resolve(a),type:"positive"},secondary:{label:l.cancel,type:"neutral",action:()=>i.resolve("undo")}},cancel:()=>i.reject()}}_onShowAttachments({objectId:e}){this.attachmentsViewOptions.objectId=e}_getTableTemplateForAttachmentsView(e){return new z({columnTemplates:[new U({fieldName:e,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(this).map((([t,i])=>({selected:t===e,label:i||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}})))},resizable:!1}),new A({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:M})]})}_extractFieldColumnInfosFromTableTemplate(e){const t=e??this,{layer:i,tableTemplate:s}=t;return s?s.columnTemplates.filter((({type:e})=>"field"===e||"column"===e)).map((({fieldName:e,label:t})=>[e,t])):i?.fields.map((e=>[e.name,e.alias]))??[]}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex((e=>e.frozenToEnd));return e>-1?e:void 0}_logWarning(e){n.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`)}_onCellInteraction(e){null!=e&&null!=this.attachmentsViewOptions.objectId&&this.highlightIds.add(e)}};e([p()],H.prototype,"_defaultHiddenFields",null),e([p()],H.prototype,"_effectiveTableTemplate",null),e([p()],H.prototype,"_highlights",void 0),e([p()],H.prototype,"_highlightableLayerView",null),e([p()],H.prototype,"_relationshipInfos",null),e([p()],H.prototype,"_selectionManager",null),e([p()],H.prototype,"_selectableLayer",null),e([p()],H.prototype,"_subtypes",null),e([p()],H.prototype,"_tableHighlightsReady",null),e([p()],H.prototype,"_viewSelection",null),e([p()],H.prototype,"_viewSelectionReady",null),e([p()],H.prototype,"actionColumnConfig",void 0),e([p()],H.prototype,"allRelatedTablesVisible",null),e([p()],H.prototype,"activeFilters",null),e([p({readOnly:!0})],H.prototype,"activeSortOrders",null),e([p()],H.prototype,"attachmentsEnabled",null),e([p()],H.prototype,"attachmentsViewOptions",void 0),e([p()],H.prototype,"autoRefreshEnabled",void 0),e([p()],H.prototype,"clearPrompt",null),e([p({readOnly:!0})],H.prototype,"columns",void 0),e([p()],H.prototype,"dataProvider",void 0),e([p()],H.prototype,"editingEnabled",void 0),e([p()],H.prototype,"filterGeometry",null),e([p()],H.prototype,"filterBySelectionEnabled",null),e([p({readOnly:!0})],H.prototype,"grid",void 0),e([p()],H.prototype,"hiddenFields",null),e([p()],H.prototype,"highlightEnabled",void 0),e([p()],H.prototype,"initialSize",null),e([p()],H.prototype,"isQueryingOrSyncing",null),e([p()],H.prototype,"isSyncingAttachments",null),e([p({readOnly:!0})],H.prototype,"itemIdPath",void 0),e([p()],H.prototype,"layer",null),e([p()],H.prototype,"layerView",null),e([p()],H.prototype,"messages",void 0),e([p(),B("esri/t9n/common")],H.prototype,"messagesCommon",void 0),e([p(),B("esri/core/t9n/Units")],H.prototype,"messagesUnits",void 0),e([p(),B("esri/widgets/support/t9n/uriUtils")],H.prototype,"messagesURIUtils",void 0),e([p()],H.prototype,"outFields",null),e([p()],H.prototype,"prompt",void 0),e([p()],H.prototype,"relatedRecordsEnabled",null),e([p()],H.prototype,"relatedTable",null),e([p()],H.prototype,"relatedTables",void 0),e([p()],H.prototype,"relationship",null),e([p()],H.prototype,"relationshipColumnConfigs",void 0),e([p()],H.prototype,"relationshipConfig",null),e([p()],H.prototype,"relationships",null),e([p()],H.prototype,"returnGeometryEnabled",null),e([p()],H.prototype,"returnMEnabled",null),e([p()],H.prototype,"returnZEnabled",null),e([p()],H.prototype,"selectionSource",void 0),e([p()],H.prototype,"showAllRelatedTables",null),e([p()],H.prototype,"showPrompt",null),e([p()],H.prototype,"showRelatedTableCallback",void 0),e([p({readOnly:!0,type:O})],H.prototype,"store",void 0),e([p()],H.prototype,"supportsAttachments",null),e([p()],H.prototype,"supportsAddAttachments",null),e([p()],H.prototype,"supportsDeleteAttachments",null),e([p()],H.prototype,"supportsResizeAttachments",null),e([p()],H.prototype,"supportsUpdateAttachments",null),e([p()],H.prototype,"tableController",void 0),e([p()],H.prototype,"tableParent",void 0),e([p({type:z})],H.prototype,"tableTemplate",void 0),e([p()],H.prototype,"tableTemplateOverride",void 0),e([p()],H.prototype,"timeExtent",null),e([p()],H.prototype,"timeZone",null),e([p()],H.prototype,"view",null),H=e([g("esri.widgets.FeatureTable.FeatureTableViewModel")],H);const N=H;export{N as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Collection.js";import{referenceSetter as i}from"../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../core/deprecate.js";import o from"../../core/Error.js";import l from"../../core/Handles.js";import n from"../../core/Logger.js";import{debounce as a,ignoreAbortErrors as r,createResolver as h}from"../../core/promiseUtils.js";import{watch as d,initial as c,on as m}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{getLowerCaseDefaultHiddenFields as u}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as b,isSubtypeGroupLayer as f}from"../../layers/support/layerUtils.js";import{highlightsSupported as y}from"../../views/support/layerViewUtils.js";import{isSelectableLayer as w}from"../../views/support/selectionUtils.js";import T from"./ActionColumn.js";import _ from"./AttachmentsColumn.js";import I from"./FieldColumn.js";import C from"./RelationshipColumn.js";import v from"./Grid/Column.js";import E from"./Grid/Grid.js";import j from"./Grid/GridViewModel.js";import S from"./Grid/GroupColumn.js";import A from"./support/AttachmentsColumnTemplate.js";import F from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as R,isRelationshipColumn as x}from"./support/columnUtils.js";import{downloadAttachmentInfo as O,exportToCSV as U}from"./support/exportUtils.js";import V from"./support/FeatureStore.js";import z from"./support/FieldColumnTemplate.js";import P from"./support/RelationshipColumnTemplate.js";import W from"./support/TableTemplate.js";import{findRelationship as L,uniqueColumnNames as B,getRelationshipIdsToShow as G}from"./support/tableUtils.js";import"../support/widgetUtils.js";import{messageBundle as Z}from"../support/decorators/messageBundle.js";import{onLocaleChange as k}from"../../intl/locale.js";import{substitute as M}from"../../intl/substitute.js";import{fetchMessageBundle as H}from"../../intl/messages.js";const N="80px";let $=class extends j{constructor(e){super(e),this._debounceRefresh=a((()=>this._refresh())),this._highlights=new l,this.actionColumnConfig=null,this.attachmentsViewOptions=new F,this.autoRefreshEnabled=!0,this.columns=new t,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:o}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===o.length&&-1===o.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const l=this.paginationEnabled?this.pageIndex:e.page,n=await s.fetchItems({...e,page:l});t&&t(n)},this.editingEnabled=!1,this.grid=null,this.highlightEnabled=!0,this.itemIdPath="objectId",this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new t,this.relationshipColumnConfigs=null,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,this.tableController=null,this.tableParent=null,this.tableTemplate=null,this.tableTemplateOverride=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._onShowPromptCallback=this._onShowPromptCallback.bind(this),this._set("store",new V),this._set("grid",new E({itemIdPath:this.itemIdPath,viewModel:this}))}initialize(){const e=async()=>{this.messages=await H("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await H("esri/t9n/common"),this.messagesUnits=await H("esri/core/t9n/Units"),this.messagesURIUtils=await H("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([k((()=>{e(),this._generateColumns()})),d((()=>[this.messages,this.messagesCommon,this.messagesURIUtils]),(()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.allColumns.forEach((t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils})),this.refreshCellContent()}),c),m((()=>this.highlightIds),"change",(e=>this._onHighlightIdsChange(e)),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),d((()=>this.attachmentsEnabled),(()=>this.layer?.loaded&&this._generateColumns())),d((()=>this._viewSelection),(()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)})),d((()=>[this._tableHighlightsReady,this._viewSelectionReady]),(()=>this._syncSelection())),d((()=>this.layer),(async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch((()=>{})))})),d((()=>this.layer?.loaded),(e=>e&&this._onLayerLoad())),d((()=>this.store.state),(e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())})),d((()=>this._effectiveTableTemplate),(()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()})),d((()=>this.editingEnabled),(e=>{this.editableColumns.forEach((t=>t.tableEditingEnabled=e)),this.refreshCellContent()})),d((()=>this.timeZone??this.view?.timeZone),(()=>this.refreshCellContent())),d((()=>this.layer?.definitionExpression),((e,t)=>(e||t)&&"loaded"===this.store.state&&this.reset())),d((()=>this.layer?.timeExtent),((e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset())),m((()=>this.layer),"refresh",(e=>this._onLayerRefresh(e))),m((()=>this.grid),["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],(({index:e,item:t,native:i,path:s,type:o})=>{const l=t?.feature,n=l?.getObjectId(),a="cell-keydown"===o&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(o,{feature:l,index:e,native:i,type:o,fieldName:s??void 0,objectId:n}),(a||"cell-click"===o)&&this._onCellInteraction(n)})),d((()=>this.actionColumnConfig),(e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())})),d((()=>this.relatedRecordsEnabled),(()=>this.layer?.loaded&&this._generateColumns())),m((()=>this.objectIds),"change",(()=>this._onObjectIdsChange()),{onListenerAdd:()=>this._onObjectIdsChange()}),d((()=>[this.paginationEnabled,this.pageIndex]),(()=>this.refreshPageCache())),d((()=>this.activeSortOrders),(e=>this.store.sortOrders=e)),d((()=>this.pageCount),(()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)})),d((()=>this.state),(e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()})),m((()=>this.tableParent?.highlightIds),"change",(({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:o}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:o}})),m((()=>this.tableParent),"cell-click",(e=>{const{tableParent:t}=this,{objectId:i}=e;t&&null!=i&&t.highlightIds.add(i)})),d((()=>this.attachmentsViewOptions.objectId),((e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}))])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return u(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _highlightableLayerView(){const e=this.layerView;return y(e)?e:null}get _relationshipInfos(){return this.store.relationshipInfos}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;return w(e)&&this._selectionManager?.sources.includes(e)?e:null}get _subtypes(){return b(this.layer)}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get activeFilters(){const{filterGeometry:e,objectIds:i,filterBySelectionEnabled:s,highlightIds:o}=this,l=new t;return e&&l.push({type:"geometry",geometry:e}),s?l.push({type:"selection",objectIds:o.toArray()}):i.length&&l.push({type:"objectId",objectIds:i.toArray()}),l}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map((({path:e,direction:t})=>({fieldName:e,direction:t}))).filter((e=>e.fieldName&&e.direction)):[]}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get hiddenFields(){return this._get("hiddenFields")??new t}set hiddenFields(e){this._set("hiddenFields",i(e,this._get("hiddenFields"),t))}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isQueryingOrSyncing(){const{store:e}=this;return e?.syncing||e?.querying||this.relatedTables.some((e=>!!e.isQueryingOrSyncing))}get isSyncingAttachments(){return this.store.syncingAttachmentEdits||this.relatedTables.some((e=>!!e.isSyncingAttachments))}get layer(){return this._get("layer")}set layer(e){this.drainRelatedTables(),this._set("layer",e)}get layerView(){return this.store.layerView}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find((({id:t})=>t===e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.highlightIds.removeAll(),this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get showAllRelatedTables(){return this._get("showAllRelatedTables")}set showAllRelatedTables(e){const{relatedTable:t}=this;this._set("showAllRelatedTables",e),t&&(e?this._showAllRelatedTables(t):this._hideAllRelatedTables(t))}get showPrompt(){return e=>{this.prompt?.cancel?.(),this.prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){const{store:{supportsAddingAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){const{store:{supportsDeletingAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){const{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this._get("timeZone")}set timeZone(e){this.allColumns.forEach((t=>t.tableTimeZone=e)),this._set("timeZone",e)}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach((t=>t.view=e)),this.refreshCellContent()}async addAttachment(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.addAttachment(e,t).catch((e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)})),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.deleteAttachments(e,t).catch((e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)})),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}collapseRelatedTable(e,i){const{relatedLayer:s,objectId:o,relationshipId:l}=i,{objectIdField:n}=s,a=L(s,l),r=s.displayField||a?.keyField||n;e.set({highlightIds:new t([o]),multipleSelectionEnabled:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,r,l)});const h=e.hiddenFields;h.includes(B.action)||h.add(B.action),h.includes(B.attachments)||h.add(B.attachments),e.scrollLeft()}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter((e=>!e.error)).map((e=>e.objectId));i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find((e=>e.id===t));O(i)}drainRelatedTables(){this.relatedTables.drain((e=>e.destroy())),this.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([B.action,B.attachments])}drainRelatedTablesAboveIndex(e){const{relatedTables:t}=this,i=t.slice(e+1);t.removeMany(i).forEach((e=>e.destroy()));const s=t.at(-1);s&&(s.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(s):this._hideAllRelatedTables(s))}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await U({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(s(n.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}hideAttachmentsView(){this.attachmentsViewOptions.objectId=null,this.set({relationshipColumnConfigs:null,multipleSelectionEnabled:!0,tableTemplateOverride:null}),this.hiddenFields.remove(B.action)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){return this.relatedTables.forEach((async e=>await e.refresh())),r(this._debounceRefresh())}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning("Row not found. Associated data may not be loaded yet.")}scrollToTop(){this.grid?.scrollToTop()}async saveAttachmentsViewForm(){const{attachmentId:e,form:t,objectId:i}=this.attachmentsViewOptions;null!=i&&t&&(null!=e?await this.updateAttachment(i,e,t):await this.addAttachment(i,t))}async showAttachmentsView({index:e,objectId:i}){const{attachmentsViewOptions:s,hiddenFields:o,layer:l}=this;if(!this.attachmentsEnabled||!l)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await l.load();const n=l.displayField||l.objectIdField,a=await this.store.getAttachmentsByObjectId(i,!0);s.set({attachmentInfos:a,mode:a.length?"list":"file",objectId:i}),this.set({highlightIds:new t([i]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(n)}),o.includes(B.action)||o.add(B.action),null!=e&&this.scrollToIndex(e)}clearSelectionFilter(){s(n.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:l}=this,n=s.objectId===e;await l.updateAttachment(e,t,i).catch((e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)})),n&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await l.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const o=await e.queryFeatures(s);try{await t.goTo(o.features)}catch(l){"AbortError"!==l.name&&console.error(l)}}async _refresh(){await this.store.refresh();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach(((t,i)=>{t||this.highlightIds.remove(e[i])}))}this.refreshPageCache()}async _onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;e.parent&&f(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,o=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=o),this.grid?.set("pageSize",o),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const e=this._effectiveTableTemplate?.columnTemplates,t=e?this._generateColumnsFromTemplates(e):this._generateDefaultFieldColumns();t.length&&(this.attachmentsEnabled&&!t.some((e=>R(e)))&&t.push(this._generateDefaultAttachmentsColumn()),this.relatedRecordsEnabled&&this._relationshipInfos.length&&!t.some((e=>x(e)))&&t.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&t.push(this._generateActionColumn()),t.sort(((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0)),this.columns.addMany(t))}_generateColumnsFromTemplates(e){const{editingEnabled:t,grid:i,layer:s,messages:o,messagesCommon:l,messagesURIUtils:n,store:a,timeZone:r,view:h}=this;if(!s)return[];const d=s.fields??[],c=[],m=e=>d.find((t=>e.fieldName.toLowerCase()===t.name?.toLowerCase()));return e.forEach(((e,d)=>{const{autoWidth:p,description:g,direction:u,flexGrow:b,fieldName:f,formatFunction:y,frozen:w,frozenToEnd:T,icon:_,initialSortPriority:C,invalid:E,label:j,menuConfig:A,resizable:F,sortable:R,textAlign:x,textWrap:O,timeZone:U,type:V,width:z}=e;if(!V)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(w&&T)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const P=!1===e.visible;if("group"===V){if(!e.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!e.label)return void this._logTemplateWarning("Group columns require a label.");const t=this._generateColumnsFromTemplates(e.columnTemplates),s=P||this._isFieldHidden(e.label);c.push(new S({autoWidth:p,columns:t,description:g,flexGrow:b,frozen:w,frozenToEnd:T,grid:i,hidden:s,icon:_,invalid:E,label:j,menuConfig:A,messages:o,messagesCommon:l,messagesURIUtils:n,resizable:F,tableTimeZone:r,textAlign:x,textWrap:O,timeZone:U,width:z}))}else if("attachment"===V){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");c.push(this._generateAttachmentsColumnFromTemplate(e,d))}else if("relationship"===V){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:t}=e;if(null==t)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this._relationshipInfos.find((e=>e.relationshipId===t));if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");c.push(this._generateRelationshipColumnFromTemplate(i,e,d))}else if(!f)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const W=P||this._isFieldHidden(f);if("column"===V)c.push(new v({autoWidth:p,description:g,direction:u,fieldName:f,flexGrow:b,formatFunction:y,frozen:w,frozenToEnd:T,grid:i,hidden:W,icon:_,initialSortPriority:C,invalid:E,label:j,menuConfig:A,messages:o,messagesCommon:l,messagesURIUtils:n,resizable:F,sortable:R,tableTimeZone:r,textAlign:x,textWrap:O,timeZone:U,width:z}));else if("field"===V){const d=m(e);if(!d)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:f,required:v}=e;c.push(new I({autoWidth:p,description:g,direction:u,editable:f,field:d,fieldName:d.name,flexGrow:b,formatFunction:y,frozen:w,frozenToEnd:T,grid:i,hidden:W,icon:_,initialSortPriority:C,invalid:E,label:j,layer:s,messages:o,messagesCommon:l,messagesURIUtils:n,menuConfig:A,required:v,resizable:F,sortable:R,store:a,tableEditingEnabled:t,tableTimeZone:r,template:e,textAlign:x,textWrap:O,timeZone:U,width:z,view:h,onShowPromptCallback:this._onShowPromptCallback}))}})),c}_generateDefaultFieldColumns(){const{editingEnabled:e,grid:t,layer:i,messages:s,messagesCommon:o,messagesURIUtils:l,store:n,timeZone:a,view:r}=this,h=[];return i?.fields.length?(i.fields.forEach((d=>{if(!d.visible||"geometry"===d.type)return;const c=d.name;h.push(new I({field:d,fieldName:c,grid:t,hidden:this._isFieldHidden(c),layer:i,messages:s,messagesCommon:o,messagesURIUtils:l,store:n,tableEditingEnabled:e,tableTimeZone:a,view:r,onShowPromptCallback:this._onShowPromptCallback}))})),h):h}_generateAttachmentsColumnFromTemplate(e,t){const{grid:i,layer:s,messages:o,messagesCommon:l,messagesURIUtils:n,store:a,timeZone:r}=this,{attachmentsViewEnabled:h,autoWidth:d,description:c,flexGrow:m,fieldName:p,formatFunction:g,frozen:u,frozenToEnd:b,icon:f,invalid:y,label:w,menuConfig:T,resizable:I,textAlign:C,textWrap:v,thumbnailAppearance:E,thumbnailCount:j,thumbnailIconScale:S,thumbnailsEnabled:A,timeZone:F,width:R}=e;return new _({attachmentsViewEnabled:h,autoWidth:d,description:c,fieldName:`${B.attachments}-${t}`,flexGrow:m,formatFunction:g,frozen:u,frozenToEnd:b,grid:i,hidden:!1===e.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,invalid:y,label:w,layer:s,menuConfig:T,messages:o,messagesCommon:l,messagesURIUtils:n,resizable:I,store:a,tableTimeZone:r,textAlign:C,textWrap:v,thumbnailAppearance:E,thumbnailCount:j,thumbnailIconScale:S,thumbnailsEnabled:A,timeZone:F,width:R,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(){const{grid:e,layer:t,messages:i,messagesCommon:s,messagesURIUtils:o,store:l,timeZone:n}=this,a=B.attachments,r=this._isFieldHidden(a);return new _({fieldName:a,grid:e,hidden:r,layer:t,messages:i,messagesCommon:s,messagesURIUtils:o,store:l,tableTimeZone:n,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:o,messagesCommon:l,messagesURIUtils:n,store:a,timeZone:r}=this,{autoWidth:h,collapsed:d,description:c,flexGrow:m,fieldName:p,formatFunction:g,frozen:u,frozenToEnd:b,icon:f,invalid:y,label:w,menuConfig:T,relationshipId:_,resizable:I,textAlign:v,textWrap:E,timeZone:j,width:S}=t;return new C({autoWidth:h,collapsed:d,description:c,fieldName:`${B.relationship}-${_}-${i}`,flexGrow:m,formatFunction:g,frozen:u,frozenToEnd:b,grid:s,hidden:!1===t.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,invalid:y,label:w,menuConfig:T,messages:o,messagesCommon:l,messagesURIUtils:n,relationshipId:_,resizable:I,store:a,tableTimeZone:r,textAlign:v,textWrap:E,timeZone:j,width:S,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){const{_relationshipInfos:e,grid:t,messages:i,messagesCommon:s,messagesURIUtils:o,relationshipColumnConfigs:l}=this,n=[];if(!e?.length)return n;const a={grid:t,messages:i,messagesCommon:s,messagesURIUtils:o};return l?l.forEach(((t,i)=>{const{relationshipId:s}=t,o=e.find((e=>e.relationshipId===s));o&&n.push(new C({...t,...a,fieldName:`${B.relationship}-${s}-${i}`,layer:o.relatedLayer,relatedLayer:o.layer,relationshipId:s,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})):e.forEach((({layer:e,relatedLayer:t,relationshipId:i},s)=>{n.push(new C({...a,fieldName:`${B.relationship}-${i}-${s}`,layer:t,relatedLayer:e,relationshipId:i,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})),n}_generateActionColumn(){return new T({hidden:this._isFieldHidden(B.action),...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some((e=>e.toLowerCase()===t))}_addTableHighlight(e){const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),o=s?.feature??e;this._highlights.add(t.highlight(o),`${i.id}-${e}`)}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(`${t.id}-${e}`)}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach((e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._tableHighlightsReady?(i.forEach((e=>this._removeTableHighlight(e))),t.forEach((e=>this._addTableHighlight(e)))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),null!=s.objectId){const e=this.highlightIds.at(0);if(null!=e){const t=await this.store.getAttachmentsByObjectId(e,!0);s.set({attachmentInfos:t,objectId:e,mode:t.length?"list":"file"})}}}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain((e=>!e.destroyed&&e.destroy()))}_showAllRelatedTables(e){const t=e.layer;if(!t)return;const i=t.displayField||t.objectIdField;e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,i)});const s=e.hiddenFields;s.includes(B.action)||s.add(B.action),s.includes(B.attachments)||s.add(B.attachments)}_hideAllRelatedTables(e){const{layer:t,relationship:i}=e;if(t&&null!=i?.id)if(null!=e.attachmentsViewOptions.objectId){const t=e.layer?.displayField||e.layer?.objectIdField||"";e.set({multipleSelectionEnabled:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(t)})}else e.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:G(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([B.action,B.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new W({columnTemplates:[new z({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map((([s,o])=>({selected:s===t,label:o||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}})))},resizable:!1}),new P({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:N})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new z({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map((([i,s])=>({selected:i===t,label:s||i,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,i)}})))},resizable:!1})];return null!=e.attachmentsViewOptions.objectId&&i.push(new A({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:N})),new W({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:o}=e,{_subtypes:l,layer:n}=this;if(!n||!l.length)return void t.cancel();const a=l.find((e=>e.code===o));if(!a)return void t.cancel();const r=h(),d=this._createSubtypeEditPrompt(s,a,r),c=!!n.parent;try{this.showPrompt(d);const e=await r.promise,s=[{fieldName:t.fieldName,value:o}];switch(e){case"update-fields":for(const[e,t]of Object.entries(a.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),c&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),c&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,i){const{_subtypes:s,messages:o,messagesCommon:l}=this,n=s.find((t=>t.code===e))?.name??`${e}`;let a="update-fields";const r=[{label:o.subtypes.useDefaultValuesOption,value:"update-fields"},{label:o.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:o.subtypes.changeWarningTitle,message:M(o.subtypes.changeWarning,{originalType:n,newType:t.name}),radios:r,defaultRadioSelection:"update-fields",onRadioSelection:e=>{a=e},actions:{primary:{label:l.apply,action:()=>i.resolve(a),type:"positive"},secondary:{label:l.cancel,type:"neutral",action:()=>i.resolve("undo")}},cancel:()=>i.reject()}}_onShowAttachments({objectId:e}){this.attachmentsViewOptions.objectId=e}_getTableTemplateForAttachmentsView(e){return new W({columnTemplates:[new z({fieldName:e,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(this).map((([t,i])=>({selected:t===e,label:i||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}})))},resizable:!1}),new A({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:N})]})}_extractFieldColumnInfosFromTableTemplate(e){const t=e??this,{layer:i,tableTemplate:s}=t;return s?s.columnTemplates.filter((({type:e})=>"field"===e||"column"===e)).map((({fieldName:e,label:t})=>[e,t])):i?.fields.map((e=>[e.name,e.alias]))??[]}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex((e=>e.frozenToEnd));return e>-1?e:void 0}_logWarning(e){n.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`)}_onCellInteraction(e){null!=e&&null!=this.attachmentsViewOptions.objectId&&this.highlightIds.add(e)}};e([p()],$.prototype,"_defaultHiddenFields",null),e([p()],$.prototype,"_effectiveTableTemplate",null),e([p()],$.prototype,"_highlights",void 0),e([p()],$.prototype,"_highlightableLayerView",null),e([p()],$.prototype,"_relationshipInfos",null),e([p()],$.prototype,"_selectionManager",null),e([p()],$.prototype,"_selectableLayer",null),e([p()],$.prototype,"_subtypes",null),e([p()],$.prototype,"_tableHighlightsReady",null),e([p()],$.prototype,"_viewSelection",null),e([p()],$.prototype,"_viewSelectionReady",null),e([p()],$.prototype,"actionColumnConfig",void 0),e([p()],$.prototype,"allRelatedTablesVisible",null),e([p()],$.prototype,"activeFilters",null),e([p({readOnly:!0})],$.prototype,"activeSortOrders",null),e([p()],$.prototype,"attachmentsEnabled",null),e([p()],$.prototype,"attachmentsViewOptions",void 0),e([p()],$.prototype,"autoRefreshEnabled",void 0),e([p()],$.prototype,"clearPrompt",null),e([p({readOnly:!0})],$.prototype,"columns",void 0),e([p()],$.prototype,"dataProvider",void 0),e([p()],$.prototype,"editingEnabled",void 0),e([p()],$.prototype,"filterGeometry",null),e([p()],$.prototype,"filterBySelectionEnabled",null),e([p({readOnly:!0})],$.prototype,"grid",void 0),e([p()],$.prototype,"hiddenFields",null),e([p()],$.prototype,"highlightEnabled",void 0),e([p()],$.prototype,"initialSize",null),e([p()],$.prototype,"isQueryingOrSyncing",null),e([p()],$.prototype,"isSyncingAttachments",null),e([p({readOnly:!0})],$.prototype,"itemIdPath",void 0),e([p()],$.prototype,"layer",null),e([p()],$.prototype,"layerView",null),e([p()],$.prototype,"messages",void 0),e([p(),Z("esri/t9n/common")],$.prototype,"messagesCommon",void 0),e([p(),Z("esri/core/t9n/Units")],$.prototype,"messagesUnits",void 0),e([p(),Z("esri/widgets/support/t9n/uriUtils")],$.prototype,"messagesURIUtils",void 0),e([p()],$.prototype,"outFields",null),e([p()],$.prototype,"prompt",void 0),e([p()],$.prototype,"relatedRecordsEnabled",null),e([p()],$.prototype,"relatedTable",null),e([p()],$.prototype,"relatedTables",void 0),e([p()],$.prototype,"relationship",null),e([p()],$.prototype,"relationshipColumnConfigs",void 0),e([p()],$.prototype,"relationshipConfig",null),e([p()],$.prototype,"relationships",null),e([p()],$.prototype,"returnGeometryEnabled",null),e([p()],$.prototype,"returnMEnabled",null),e([p()],$.prototype,"returnZEnabled",null),e([p()],$.prototype,"selectionSource",void 0),e([p()],$.prototype,"showAllRelatedTables",null),e([p()],$.prototype,"showPrompt",null),e([p()],$.prototype,"showRelatedTableCallback",void 0),e([p({readOnly:!0,type:V})],$.prototype,"store",void 0),e([p()],$.prototype,"supportsAttachments",null),e([p()],$.prototype,"supportsAddAttachments",null),e([p()],$.prototype,"supportsDeleteAttachments",null),e([p()],$.prototype,"supportsResizeAttachments",null),e([p()],$.prototype,"supportsUpdateAttachments",null),e([p()],$.prototype,"tableController",void 0),e([p()],$.prototype,"tableParent",void 0),e([p({type:W})],$.prototype,"tableTemplate",void 0),e([p()],$.prototype,"tableTemplateOverride",void 0),e([p()],$.prototype,"timeExtent",null),e([p()],$.prototype,"timeZone",null),e([p()],$.prototype,"view",null),$=e([g("esri.widgets.FeatureTable.FeatureTableViewModel")],$);const D=$;export{D as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Collection.js";import{referenceSetter as o}from"../../../core/collectionUtils.js";import i from"../../../core/Evented.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Collection.js";import{referenceSetter as o}from"../../../core/collectionUtils.js";import i from"../../../core/Evented.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{isGroupColumn as s,isFieldColumn as r,isRelationshipColumn as d}from"../support/columnUtils.js";import{uniqueColumnNames as h,isPageIndexValid as a}from"../support/tableUtils.js";let u=class extends i.EventedAccessor{constructor(t){super(t),this.cellPartNameGenerator=(t,e)=>{let o="";e?.item&&this.rowHighlightIds.includes(e.item.objectId)&&(o+=" highlight");const i=this.findColumn(t?.path);return i?(i.invalid&&(o+=" invalid"),i.textWrap&&(o+=" text-wrap"),"editInfo"in i&&i.editInfo&&i.editInfo.rowData?.index===e.index&&(o+=" editing"),o):o},this.columnPerformanceModeEnabled=!0,this.columnReorderingEnabled=!0,this.columns=new e,this.dataProvider=async(t,e)=>{const{store:o}=this;if(!e)return;if(!o)return void(e&&e([]));e(await o.fetchItems(t))},this.maxSize=null,this.multipleSelectionEnabled=!0,this.multiSortEnabled=!1,this.paginationEnabled=!1,this.rowDetailsRenderer=null,this.store=null}get actionColumn(){return this.allColumns.find((t=>t.fieldName===h.action))}get allColumns(){return this.columns.toArray().flatMap((t=>[t,...s(t)&&t.columns?.length?t.columns:[]]))}get columnMenuIsOpen(){return this.allColumns.some((t=>t.menuIsOpen))}get editing(){return this.editableColumns.some((t=>t.editInfo))}get editableColumns(){return this.allColumns.filter((t=>"editable"in t))}get effectiveSize(){const{filterBySelectionEnabled:t,highlightIds:e,objectIds:o,pageSize:i,size:n}=this;if(this.paginationEnabled){const l=this.pageCount===this.pageIndex+1?n%i:i;return t?Math.min(e.length,l):o.length?Math.min(o.length,l):l}return t?e.length:o.length?o.length:n}get fieldColumns(){return this.allColumns.filter((t=>r(t)))}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(t){this._set("filterBySelectionEnabled",t)}get groupColumns(){return this.columns.toArray().filter((t=>s(t)))}get highlightIds(){return this._get("highlightIds")||new e}set highlightIds(t){const i=Array.isArray(t)?new e(t):t;this.multipleSelectionEnabled||i.splice(1,i.length-1),this._set("highlightIds",o(i,this._get("highlightIds"),e))}get objectIds(){return this._get("objectIds")??new e}set objectIds(t){this._set("objectIds",o(t,this._get("objectIds"),e))}get pageCount(){const{pageSize:t,size:e}=this;return 0===e||0===t?1:Math.ceil(e/t)}get pageIndex(){return this._get("pageIndex")||0}set pageIndex(t){const{pageCount:e}=this;a(t,e)&&this._set("pageIndex",t)}get pageSize(){return this._get("pageSize")??50}set pageSize(t){this.store?.set("pageSize",t),this._set("pageSize",t)}get relationshipColumns(){return this.allColumns.filter((t=>d(t)))}get rowHighlightIds(){return this._get("rowHighlightIds")||new e}set rowHighlightIds(t){this._set("rowHighlightIds",o(t,this._get("rowHighlightIds"),e))}get size(){const t=this.store?.count??0,{maxSize:e}=this;return null!=t&&null!=e?Math.min(e,t):t}get state(){return this.store?.state??"disabled"}closeColumnMenus(){this.allColumns.forEach((t=>t.closeMenu()))}sortColumn(t,e){if(!t)return;const o=this.findColumn(t);o&&(o.direction=e)}hideColumn(t){const e=this.findColumn(t);!1===e?.hidden&&(e.hidden=!0)}showColumn(t){const e=this.findColumn(t);e?.hidden&&(e.hidden=!1)}showAllColumns(){this.allColumns.forEach((t=>{t.hidden&&(t.hidden=!1)}))}findColumn(t){return this.allColumns.find((e=>e.fieldName===t))}refresh(){this.store&&(this.store.reset(),this.store.load())}toggleColumnVisibility(t){const e=this.findColumn(t);e&&(e.hidden=!e.hidden)}};t([n()],u.prototype,"actionColumn",null),t([n()],u.prototype,"allColumns",null),t([n()],u.prototype,"cellPartNameGenerator",void 0),t([n()],u.prototype,"columnMenuIsOpen",null),t([n()],u.prototype,"columnPerformanceModeEnabled",void 0),t([n()],u.prototype,"columnReorderingEnabled",void 0),t([n()],u.prototype,"columns",void 0),t([n()],u.prototype,"dataProvider",void 0),t([n()],u.prototype,"editing",null),t([n()],u.prototype,"editableColumns",null),t([n()],u.prototype,"effectiveSize",null),t([n()],u.prototype,"fieldColumns",null),t([n()],u.prototype,"filterBySelectionEnabled",null),t([n()],u.prototype,"groupColumns",null),t([n()],u.prototype,"highlightIds",null),t([n()],u.prototype,"maxSize",void 0),t([n()],u.prototype,"multipleSelectionEnabled",void 0),t([n()],u.prototype,"multiSortEnabled",void 0),t([n()],u.prototype,"objectIds",null),t([n()],u.prototype,"pageCount",null),t([n()],u.prototype,"pageIndex",null),t([n()],u.prototype,"pageSize",null),t([n()],u.prototype,"paginationEnabled",void 0),t([n()],u.prototype,"relationshipColumns",null),t([n()],u.prototype,"rowHighlightIds",null),t([n()],u.prototype,"rowDetailsRenderer",void 0),t([n({readOnly:!0})],u.prototype,"size",null),t([n()],u.prototype,"store",void 0),t([n({readOnly:!0})],u.prototype,"state",null),u=t([l("esri.widgets.FeatureTable.Grid.GridViewModel")],u);const p=u;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
function
|
|
5
|
+
function n(n){return null!=n&&"object"==typeof n&&"type"in n&&null!==n.type&&("column"===n.type||"field"===n.type||"group"===n.type||"attachment"===n.type||"relationship"===n.type)}function t(n){return!(!n||!("field"in n))}function e(n){return!(!n||!("columns"in n))}function i(n){return!(!n||!("relationshipId"in n))}function o(n){return!(!n||!("onShowAttachments"in n))}export{o as isAttachmentsColumn,t as isFieldColumn,e as isGroupColumn,i as isRelationshipColumn,n as isTemplateObjectWithType};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{loadCalciteComponents as t}from"../../support/componentsUtils.js";const e={action:"EsriFeatureTableActionColumn",attachments:"EsriFeatureTableAttachmentsColumn",relationship:"EsriFeatureTableRelationshipColumn"},n=()=>t({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown.js"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item.js"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js")}),i=()=>Promise.all([t({input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),option:()=>import("@esri/calcite-components/dist/components/calcite-option.js"),select:()=>import("@esri/calcite-components/dist/components/calcite-select.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js")}),n()]),o=()=>Promise.all([t({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js")}),i()]);function c(t){return t&&"selection"===t.type}function r(t){return null!=t&&"object"==typeof t&&"createQuery"in t&&"getField"in t&&"queryFeatureCount"in t&&"queryFeatures"in t&&"queryObjectIds"in t&&"capabilities"in t&&"fields"in t&&"fieldsIndex"in t&&"id"in t&&"load"in t&&"objectIdField"in t&&"type"in t&&"when"in t}function s(t){return r(t)&&"queryAttachments"in t}function a(t){return s(t)&&"addAttachment"in t&&"deleteAttachments"in t&&"updateAttachment"in t}function l(t){return r(t)&&"editingEnabled"in t&&"applyEdits"in t}function p(t){return r(t)&&"relationships"in t&&"queryRelatedFeatures"in t&&"queryRelatedFeaturesCount"in t}function u(t){return null!=t&&"object"==typeof t&&"type"in t&&"map-image"===t.type}function
|
|
5
|
+
import{loadCalciteComponents as t}from"../../support/componentsUtils.js";const e={action:"EsriFeatureTableActionColumn",attachments:"EsriFeatureTableAttachmentsColumn",relationship:"EsriFeatureTableRelationshipColumn"},n=()=>t({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown.js"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item.js"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js")}),i=()=>Promise.all([t({input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),option:()=>import("@esri/calcite-components/dist/components/calcite-option.js"),select:()=>import("@esri/calcite-components/dist/components/calcite-select.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js")}),n()]),o=()=>Promise.all([t({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js")}),i()]);function c(t){return t&&"selection"===t.type}function r(t){return null!=t&&"object"==typeof t&&"createQuery"in t&&"getField"in t&&"queryFeatureCount"in t&&"queryFeatures"in t&&"queryObjectIds"in t&&"capabilities"in t&&"fields"in t&&"fieldsIndex"in t&&"id"in t&&"load"in t&&"objectIdField"in t&&"type"in t&&"when"in t}function s(t){return r(t)&&"queryAttachments"in t}function a(t){return s(t)&&"addAttachment"in t&&"deleteAttachments"in t&&"updateAttachment"in t}function l(t){return r(t)&&"editingEnabled"in t&&"applyEdits"in t}function p(t){return r(t)&&"relationships"in t&&"queryRelatedFeatures"in t&&"queryRelatedFeaturesCount"in t}function u(t){return null!=t&&"object"==typeof t&&"type"in t&&"map-image"===t.type}function m(t,e,{relatedTableId:n}){if(!e?.map)return;const i="scene"===t.type&&t.associatedLayer?t.associatedLayer.url:t.url,o=e=>!(!p(e)||e===t)&&("sublayer"===e.type&&e.layer?.url===t.url?e.id===n:i===e.url&&e.layerId===n);if("sublayer"===t.type&&u(t.parent)){const e=e=>p(e)&&e!==t&&e.id===n,i=t.parent,o=i.sublayers?.find(e)||i.subtables?.find(e);if(p(o))return o}const c=[...e.map.allLayers,...e.map.allTables];let r=null;for(const s of c)if(u(s)){const t=s.sublayers?.find(o)||s.subtables?.find(o);if(t){r=t;break}}else if(o(s)){r=s;break}return p(r)?r:void 0}function d(t,e){return null!=t&&Number.isInteger(t)&&t>-1&&t<e}function f(t){return null==t||0===t.trim().length}function y(t,e){return(t.relationships??[]).filter((t=>!(t.id===e&&"one-to-one"===t.cardinality))).map((({id:t})=>({relationshipId:t})))}function b(t,e){return t.relationships?.find((({id:t})=>t===e))}function j(t,e){return e.some((e=>!("group"!==e.type||!j(t,e.columnTemplates))||e.fieldName===t))}export{m as findRelatedLayer,b as findRelationship,y as getRelationshipIdsToShow,j as hasTemplateForField,f as isEmptyStringOrWhitespace,r as isIFeatureTableSupportedLayer,s as isIFeatureTableSupportedLayerWithAttachments,a as isIFeatureTableSupportedLayerWithAttachmentsEditing,l as isIFeatureTableSupportedLayerWithEditing,p as isIFeatureTableSupportedLayerWithRelationships,u as isMapImageLayer,d as isPageIndexValid,c as isSelectionFilter,n as loadColumnComponents,i as loadEditorColumnComponents,o as loadFieldColumnComponents,e as uniqueColumnNames};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../tables/elements/AttributeTableAttachmentElement.js";import i from"../../../tables/elements/AttributeTableFieldElement.js";import n from"../../../tables/elements/AttributeTableGroupElement.js";import r from"../../../tables/elements/AttributeTableRelationshipElement.js";import l from"./AttachmentsColumnTemplate.js";import{isGroupColumn as o,isFieldColumn as s,isRelationshipColumn as m,isAttachmentsColumn as a}from"./columnUtils.js";import p from"./FieldColumnTemplate.js";import f from"./GroupColumnTemplate.js";import c from"./RelationshipColumnTemplate.js";function d(t,i){const n=[];return t?.forEach((t=>{const{description:r,label:l,type:o}=t;if("group"===o){const o=t.elements.map((e=>u(e,i))).filter(e);if(!o?.length)return;n.push(new f({description:r,columnTemplates:o,label:l}))}else{const e=u(t,i);if(!e)return;n.push(e)}})),n}function u(e,t){const{description:i,label:n,type:r}=e;if("field"===r){const r=e.fieldName??void 0,l=t.findIndex((e=>e.field&&e.field===r)),o=l>-1?t.at(l)?.order:void 0;return new p({description:i,direction:o,fieldName:r,initialSortPriority:l,label:n})}return"attachment"===r?new l({description:i,label:n}):"relationship"===r?new c({description:i,label:n,relationshipId:e.relationshipId}):void 0}function b(t){const i=[];return t.forEach((t=>{const{description:r,label:l,hidden:s}=t;if(o(t)){if(s)return;const o=t.columns?.map((e=>h(e))).filter(e);if(!o?.length)return;i.push(new n({description:r,elements:o,label:l}))}else{const e=h(t);if(!e)return;i.push(e)}})),i}function h(e){const{fieldName:n,description:l,hidden:o,label:p}=e;if(s(e)){if(!o)return new i({description:l,fieldName:n,label:p})}else if(m(e)){if(!o)return new r({description:l,label:p,relationshipId:e.relationshipId})}else if(a(e)&&!o)return new t({description:l,label:p})}export{b as createAttributeTableElements,d as createColumnTemplates,h as createNestedElement,u as createNestedTemplate};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1737],{4902:(e,t,r)=>{r.d(t,{PH:()=>a,sA:()=>o});var i=r(90237),s=r(40608);let n=0;const o=e=>{let t=class extends e{constructor(...e){super(...e),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:Date.now().toString(16)+"-object-"+n++})}};return t=(0,i._)([(0,s.$)("esri.core.Identifiable")],t),t},a=e=>{let t=class extends e{constructor(...e){super(...e),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:n++})}};return t=(0,i._)([(0,s.$)("esri.core.Identifiable.NumericIdentifiable")],t),t};let l=class extends(o(class{})){};l=(0,i._)([(0,s.$)("esri.core.Identifiable")],l)},80200:(e,t,r)=>{r.d(t,{T:()=>i,d:()=>f});const i={Base64:0,Hex:1,String:2,Raw:3},s=8,n=(1<<s)-1;function o(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function a(e){const t=[];for(let r=0,i=e.length*s;r<i;r+=s)t[r>>5]|=(e.charCodeAt(r/s)&n)<<r%32;return t}function l(e){const t=[];for(let r=0,i=32*e.length;r<i;r+=s)t.push(String.fromCharCode(e[r>>5]>>>r%32&n));return t.join("")}function d(e,t,r,i,s,n){return o(function(e,t){return e<<t|e>>>32-t}(o(o(t,e),o(i,n)),s),r)}function u(e,t,r,i,s,n,o){return d(t&r|~t&i,e,t,s,n,o)}function p(e,t,r,i,s,n,o){return d(t&i|r&~i,e,t,s,n,o)}function c(e,t,r,i,s,n,o){return d(t^r^i,e,t,s,n,o)}function h(e,t,r,i,s,n,o){return d(r^(t|~i),e,t,s,n,o)}function y(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;let r=1732584193,i=-271733879,s=-1732584194,n=271733878;for(let t=0;t<e.length;t+=16){const a=r,l=i,d=s,y=n;r=u(r,i,s,n,e[t],7,-680876936),n=u(n,r,i,s,e[t+1],12,-389564586),s=u(s,n,r,i,e[t+2],17,606105819),i=u(i,s,n,r,e[t+3],22,-1044525330),r=u(r,i,s,n,e[t+4],7,-176418897),n=u(n,r,i,s,e[t+5],12,1200080426),s=u(s,n,r,i,e[t+6],17,-1473231341),i=u(i,s,n,r,e[t+7],22,-45705983),r=u(r,i,s,n,e[t+8],7,1770035416),n=u(n,r,i,s,e[t+9],12,-1958414417),s=u(s,n,r,i,e[t+10],17,-42063),i=u(i,s,n,r,e[t+11],22,-1990404162),r=u(r,i,s,n,e[t+12],7,1804603682),n=u(n,r,i,s,e[t+13],12,-40341101),s=u(s,n,r,i,e[t+14],17,-1502002290),i=u(i,s,n,r,e[t+15],22,1236535329),r=p(r,i,s,n,e[t+1],5,-165796510),n=p(n,r,i,s,e[t+6],9,-1069501632),s=p(s,n,r,i,e[t+11],14,643717713),i=p(i,s,n,r,e[t],20,-373897302),r=p(r,i,s,n,e[t+5],5,-701558691),n=p(n,r,i,s,e[t+10],9,38016083),s=p(s,n,r,i,e[t+15],14,-660478335),i=p(i,s,n,r,e[t+4],20,-405537848),r=p(r,i,s,n,e[t+9],5,568446438),n=p(n,r,i,s,e[t+14],9,-1019803690),s=p(s,n,r,i,e[t+3],14,-187363961),i=p(i,s,n,r,e[t+8],20,1163531501),r=p(r,i,s,n,e[t+13],5,-1444681467),n=p(n,r,i,s,e[t+2],9,-51403784),s=p(s,n,r,i,e[t+7],14,1735328473),i=p(i,s,n,r,e[t+12],20,-1926607734),r=c(r,i,s,n,e[t+5],4,-378558),n=c(n,r,i,s,e[t+8],11,-2022574463),s=c(s,n,r,i,e[t+11],16,1839030562),i=c(i,s,n,r,e[t+14],23,-35309556),r=c(r,i,s,n,e[t+1],4,-1530992060),n=c(n,r,i,s,e[t+4],11,1272893353),s=c(s,n,r,i,e[t+7],16,-155497632),i=c(i,s,n,r,e[t+10],23,-1094730640),r=c(r,i,s,n,e[t+13],4,681279174),n=c(n,r,i,s,e[t],11,-358537222),s=c(s,n,r,i,e[t+3],16,-722521979),i=c(i,s,n,r,e[t+6],23,76029189),r=c(r,i,s,n,e[t+9],4,-640364487),n=c(n,r,i,s,e[t+12],11,-421815835),s=c(s,n,r,i,e[t+15],16,530742520),i=c(i,s,n,r,e[t+2],23,-995338651),r=h(r,i,s,n,e[t],6,-198630844),n=h(n,r,i,s,e[t+7],10,1126891415),s=h(s,n,r,i,e[t+14],15,-1416354905),i=h(i,s,n,r,e[t+5],21,-57434055),r=h(r,i,s,n,e[t+12],6,1700485571),n=h(n,r,i,s,e[t+3],10,-1894986606),s=h(s,n,r,i,e[t+10],15,-1051523),i=h(i,s,n,r,e[t+1],21,-2054922799),r=h(r,i,s,n,e[t+8],6,1873313359),n=h(n,r,i,s,e[t+15],10,-30611744),s=h(s,n,r,i,e[t+6],15,-1560198380),i=h(i,s,n,r,e[t+13],21,1309151649),r=h(r,i,s,n,e[t+4],6,-145523070),n=h(n,r,i,s,e[t+11],10,-1120210379),s=h(s,n,r,i,e[t+2],15,718787259),i=h(i,s,n,r,e[t+9],21,-343485551),r=o(r,a),i=o(i,l),s=o(s,d),n=o(n,y)}return[r,i,s,n]}function f(e,t=i.Hex){const r=t||i.Base64,n=y(a(e),e.length*s);switch(r){case i.Raw:return n;case i.Hex:return function(e){const t="0123456789abcdef",r=[];for(let i=0,s=4*e.length;i<s;i++)r.push(t.charAt(e[i>>2]>>i%4*8+4&15)+t.charAt(e[i>>2]>>i%4*8&15));return r.join("")}(n);case i.String:return l(n);case i.Base64:return function(e){const t=[];for(let r=0,i=4*e.length;r<i;r+=3){const i=(e[r>>2]>>r%4*8&255)<<16|(e[r+1>>2]>>(r+1)%4*8&255)<<8|e[r+2>>2]>>(r+2)%4*8&255;for(let s=0;s<4;s++)8*r+6*s>32*e.length?t.push("="):t.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>6*(3-s)&63))}return t.join("")}(n)}}},92071:(e,t,r)=>{r.d(t,{P:()=>w,L:()=>b});var i=r(90237),s=r(69622),n=r(76953),o=r(4718),a=r(35666);class l{constructor(){this._propertyOriginMap=new Map,this._originStores=new Array(a.AU),this._values=new Map,this.multipleOriginsSupported=!0}clone(e){const t=new l,r=this._originStores[a.Gr.DEFAULTS];r&&r.forEach(((e,r)=>{t.set(r,(0,o.o8)(e),a.Gr.DEFAULTS)}));for(let r=a.Gr.SERVICE;r<a.AU;r++){const i=this._originStores[r];i&&i.forEach(((i,s)=>{e&&e.has(s)||t.set(s,(0,o.o8)(i),r)}))}return t}get(e,t){const r=void 0===t?this._values:this._originStores[t];return r?r.get(e):void 0}keys(e){const t=null==e?this._values:this._originStores[e];return t?[...t.keys()]:[]}set(e,t,r=a.Gr.USER){let i=this._originStores[r];if(i||(i=new Map,this._originStores[r]=i),i.set(e,t),!this._values.has(e)||this._propertyOriginMap.get(e)<=r){const i=this._values.get(e);return this._values.set(e,t),this._propertyOriginMap.set(e,r),i!==t}return!1}delete(e,t=a.Gr.USER){const r=this._originStores[t];if(!r)return;const i=r.get(e);if(r.delete(e),this._values.has(e)&&this._propertyOriginMap.get(e)===t){this._values.delete(e);for(let r=t-1;r>=0;r--){const t=this._originStores[r];if(t&&t.has(e)){this._values.set(e,t.get(e)),this._propertyOriginMap.set(e,r);break}}}return i}has(e,t){const r=void 0===t?this._values:this._originStores[t];return!!r&&r.has(e)}revert(e,t){for(;t>0&&!this.has(e,t);)--t;const r=this._originStores[t],i=r?.get(e),s=this._values.get(e);return this._values.set(e,i),this._propertyOriginMap.set(e,t),s!==i}originOf(e){return this._propertyOriginMap.get(e)||a.Gr.DEFAULTS}forEach(e){this._values.forEach(e)}}var d=r(45917),u=r(88620),p=r(40608);const c=e=>{let t=class extends e{constructor(...e){super(...e);const t=(0,u.oY)(this),r=t.store,i=new l;t.store=i,(0,n.k)(t,r,i)}read(e,t){(0,d.L)(this,e,t)}getAtOrigin(e,t){const r=h(this),i=(0,a.aB)(t);if("string"==typeof e)return r.get(e,i);const s={};return e.forEach((e=>{s[e]=r.get(e,i)})),s}originOf(e){return(0,a.OL)(this.originIdOf(e))}originIdOf(e){return h(this).originOf(e)}revert(e,t){const r=h(this),i=(0,a.aB)(t),s=(0,u.oY)(this);let n;n="string"==typeof e?"*"===e?r.keys(i):[e]:e,n.forEach((e=>{s.invalidate(e),r.revert(e,i),s.commit(e)}))}};return t=(0,i._)([(0,p.$)("esri.core.ReadOnlyMultiOriginJSONSupport")],t),t};function h(e){return(0,u.oY)(e).store}let y=class extends(c(s.A)){};y=(0,i._)([(0,p.$)("esri.core.ReadOnlyMultiOriginJSONSupport")],y);var f=r(16649),m=r(49422);const g=e=>{let t=class extends e{constructor(...e){super(...e)}clear(e,t="user"){return v(this).delete(e,(0,a.aB)(t))}write(e,t){return(0,m.M)(this,e=e||{},t),e}setAtOrigin(e,t,r){(0,u.oY)(this).setAtOrigin(e,t,(0,a.aB)(r))}removeOrigin(e){const t=v(this),r=(0,a.aB)(e),i=t.keys(r);for(const e of i)t.originOf(e)===r&&t.set(e,t.get(e,r),a.Gr.USER)}updateOrigin(e,t){const r=v(this),i=(0,a.aB)(t),s=(0,f.Jt)(this,e);for(let t=i+1;t<a.AU;++t)r.delete(e,t);r.set(e,s,i)}toJSON(e){return this.write({},e)}};return t=(0,i._)([(0,p.$)("esri.core.MultiOriginJSONSupport.WriteableMultiOriginJSONSupport")],t),t.prototype.toJSON.isDefaultToJSON=!0,t};function v(e){return(0,u.oY)(e).store}const w=e=>{let t=class extends(g(c(e))){constructor(...e){super(...e)}};return t=(0,i._)([(0,p.$)("esri.core.MultiOriginJSONSupport")],t),t};let b=class extends(w(s.A)){};b=(0,i._)([(0,p.$)("esri.core.MultiOriginJSONSupport")],b)},87024:(e,t,r)=>{r.d(t,{P:()=>h});var i=r(49186),s=r(80200),n=r(76553),o=r(84952),a=r(13069),l=r(96156),d=r(35666),u=r(10107),p=r(85648),c=r(97159);function h(e){const t=e?.origins??[void 0];return(r,i)=>{const s=function(e,t,r){if("resource"===e?.type)return function(e,t,r){const i=(0,l.z4)(t,r);return{type:String,read:(e,t,r)=>{const s=(0,c.r)(e,t,r);return i.type===String?s:"function"==typeof i.type?new i.type({url:s}):void 0},write:{writer(t,s,a,l){if(!l?.resources)return"string"==typeof t?void(s[a]=(0,c.t)(t,l)):void(s[a]=t.write({},l));const u=function(e){return null==e?null:"string"==typeof e?e:e.url}(t),h=(0,c.t)(u,{...l,verifyItemRelativeUrls:l?.verifyItemRelativeUrls?{writtenUrls:l.verifyItemRelativeUrls.writtenUrls,rootPath:void 0}:void 0},c.M.NO),g=i.type!==String&&(!(0,n.H)(this)||l?.origin&&this.originIdOf(r)>(0,d.aB)(l.origin)),v={object:this,propertyName:r,value:t,targetUrl:h,dest:s,targetPropertyName:a,context:l,params:e};l?.portalItem&&h&&!(0,o.oP)(h)?g&&e?.contentAddressed?y(v):g?function(e){const{context:t,targetUrl:r,params:i,value:s,dest:n,targetPropertyName:a}=e;if(!t.portalItem)return;const l=t.portalItem.resourceFromPath(r),d=m(s,r,t),u=(0,p.n)(d),c=(0,o.Zo)(l.path),h=i?.compress??!1;u===c?(t.resources&&f({...e,resource:l,content:d,compress:h,updates:t.resources.toUpdate}),n[a]=r):y(e)}(v):function({context:e,targetUrl:t,dest:r,targetPropertyName:i}){e.portalItem&&e.resources&&(e.resources.toKeep.push({resource:e.portalItem.resourceFromPath(t),compress:!1}),r[i]=t)}(v):l?.portalItem&&(null==h||null!=(0,c.i)(h)||(0,o.w8)(h)||g)?y(v):s[a]=h}}}}(e,t,r);switch(e?.type??"other"){case"other":return{read:!0,write:!0};case"url":{const{read:e,write:t}=c.b;return{read:e,write:t}}}}(e,r,i);for(const e of t){const t=(0,u.rM)(r,e,i);for(const e in s)t[e]=s[e]}}}function y(e){const{targetUrl:t,params:r,value:n,context:l,dest:d,targetPropertyName:u}=e;if(!l.portalItem)return;const h=(0,c.p)(t),y=m(n,t,l);if(r?.contentAddressed&&"json"!==y.type)return void l.messages?.push(new i.A("persistable:contentAddressingUnsupported",`Property "${u}" is trying to serializing a resource with content of type ${y.type} with content addressing. Content addressing is only supported for json resources.`,{content:y}));const g=r?.contentAddressed&&"json"===y.type?(0,s.d)(y.jsonString):h?.filename??(0,a.lk)(),v=(0,o.fj)(r?.prefix??h?.prefix,g),w=`${v}.${(0,p.n)(y)}`;if(r?.contentAddressed&&l.resources&&"json"===y.type){const e=l.resources.toKeep.find((({resource:e})=>e.path===w))??l.resources.toAdd.find((({resource:e})=>e.path===w));if(e)return void(d[u]=e.resource.itemRelativeUrl)}const b=l.portalItem.resourceFromPath(w);(0,o.w8)(t)&&l.resources&&l.resources.pendingOperations.push((0,o.tk)(t).then((e=>{b.path=`${v}.${(0,p.n)({type:"blob",blob:e})}`,d[u]=b.itemRelativeUrl})).catch((()=>{})));const _=r?.compress??!1;l.resources&&f({...e,resource:b,content:y,compress:_,updates:l.resources.toAdd}),d[u]=b.itemRelativeUrl}function f({object:e,propertyName:t,updates:r,resource:i,content:s,compress:n}){r.push({resource:i,content:s,compress:n,finish:r=>{!function(e,t,r){"string"==typeof e[t]?e[t]=r.url:e[t].url=r.url}(e,t,r)}})}function m(e,t,r){return"string"==typeof e?{type:"url",url:t}:{type:"json",jsonString:JSON.stringify(e.toJSON(r))}}},54239:(e,t,r)=>{r.d(t,{A:()=>w});var i,s=r(90237),n=r(4576),o=r(66552),a=r(25482),l=r(83047),d=r(67076),u=r(10107),p=(r(44208),r(53966),r(36005)),c=r(40608),h=r(43937);const y=(0,o.O)()({orthometric:"gravity-related-height",gravity_related_height:"gravity-related-height",ellipsoidal:"ellipsoidal"}),f=y.jsonValues.slice();(0,n.Xy)(f,"orthometric");const m=(0,o.O)()({meter:"meters",foot:"feet","us-foot":"us-feet","clarke-foot":"clarke-feet","clarke-yard":"clarke-yards","clarke-link":"clarke-links","sears-yard":"sears-yards","sears-foot":"sears-feet","sears-chain":"sears-chains","benoit-1895-b-chain":"benoit-1895-b-chains","indian-yard":"indian-yards","indian-1937-yard":"indian-1937-yards","gold-coast-foot":"gold-coast-feet","sears-1922-truncated-chain":"sears-1922-truncated-chains","50-kilometers":"50-kilometers","150-kilometers":"150-kilometers"});let g=i=class extends a.oY{constructor(e){super(e),this.heightModel="gravity-related-height",this.heightUnit="meters",this.vertCRS=null}writeHeightModel(e,t,r){return y.write(e,t,r)}readHeightModel(e,t,r){return y.read(e)||(r?.messages&&r.messages.push(function(e,t){return new d.A("height-model:unsupported",`Height model of value '${e}' is not supported`,t)}(e,{context:r})),null)}readHeightUnit(e,t,r){return m.read(e)||(r?.messages&&r.messages.push(v(e,{context:r})),null)}readHeightUnitService(e,t,r){return(0,l.LA)(e)||m.read(e)||(r?.messages&&r.messages.push(v(e,{context:r})),null)}readVertCRS(e,t){return t.vertCRS||t.ellipsoid||t.geoid}clone(){return new i({heightModel:this.heightModel,heightUnit:this.heightUnit,vertCRS:this.vertCRS})}equals(e){return!!e&&(this===e||this.heightModel===e.heightModel&&this.heightUnit===e.heightUnit&&this.vertCRS===e.vertCRS)}static deriveUnitFromSR(e,t){const r=(0,l.k1)(t);return new i({heightModel:e.heightModel,heightUnit:r??void 0,vertCRS:e.vertCRS})}write(e,t){return t={origin:"web-scene",...t},super.write(e,t)}static fromJSON(e){if(!e)return null;const t=new i;return t.read(e,{origin:"web-scene"}),t}};function v(e,t){return new d.A("height-unit:unsupported",`Height unit of value '${e}' is not supported`,t)}(0,s._)([(0,u.MZ)({type:y.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:f,default:"ellipsoidal"}}}})],g.prototype,"heightModel",void 0),(0,s._)([(0,h.K)("web-scene","heightModel")],g.prototype,"writeHeightModel",null),(0,s._)([(0,p.w)(["web-scene","service"],"heightModel")],g.prototype,"readHeightModel",null),(0,s._)([(0,u.MZ)({type:m.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:m.jsonValues,write:m.write}}}})],g.prototype,"heightUnit",void 0),(0,s._)([(0,p.w)("web-scene","heightUnit")],g.prototype,"readHeightUnit",null),(0,s._)([(0,p.w)("service","heightUnit")],g.prototype,"readHeightUnitService",null),(0,s._)([(0,u.MZ)({type:String,constructOnly:!0,json:{origins:{"web-scene":{write:!0}}}})],g.prototype,"vertCRS",void 0),(0,s._)([(0,p.w)("service","vertCRS",["vertCRS","ellipsoid","geoid"])],g.prototype,"readVertCRS",null),g=i=(0,s._)([(0,c.$)("esri.geometry.HeightModelInfo")],g);const w=g},4146:(e,t,r)=>{r.d(t,{A:()=>b});var i=r(90237),s=(r(59456),r(78888)),n=r(49186),o=r(65529),a=r(4902),l=r(92474),d=r(53966),u=r(74887),p=r(84952),c=r(10107),h=(r(44208),r(87811),r(40608)),y=r(92602),f=r(79677),m=r(5443),g=r(16930);let v=0,w=class extends(o.A.EventedMixin((0,a.sA)(l.A))){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new m.A(-180,-90,180,90,g.A.WGS84),this.id=Date.now().toString(16)+"-layer-"+v++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.persistenceEnabled=!1,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=g.A.WGS84,this.title=null,this.type=null,this.url=null,this.visibilityTimeExtent=null,this.visible=!0}static async fromArcGISServerUrl(e){const t="string"==typeof e?{url:e}:e;return(await r.e(7982).then(r.bind(r,27982))).fromUrl(t)}static fromPortalItem(e){return async function(e){const t="portalItem"in e?e:{portalItem:e},{fromItem:i}=await r.e(5613).then(r.bind(r,45613));try{return await i(t)}catch(e){const r=t?.portalItem,i=r?.id||"unset",s=r?.portal?.url||y.A.portalUrl;throw d.A.getLogger("esri.layers.support.fromPortalItem").error("#fromPortalItem()","Failed to create layer from portal item (portal: '"+s+"', id: '"+i+"')",e),e}}(e)}initialize(){this.when().catch((e=>{(0,u.zf)(e)||d.A.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}destroy(){const e=this.parent;if(e){const t=this;"layers"in e&&e.layers.includes(t)?e.layers.remove(t):"tables"in e&&e.tables.includes(t)?e.tables.remove(t):"baseLayers"in e&&e.baseLayers.includes(t)?e.baseLayers.remove(t):"referenceLayers"in e&&e.referenceLayers.includes(t)&&e.referenceLayers.remove(t),this._set("parent",null)}}get effectiveVisible(){let e=this.visible;const t=this.parent;return e&&t&&"effectiveVisible"in t&&(e&&=t.effectiveVisible),e}get hasAttributionData(){return null!=this.attributionDataUrl}get parsedUrl(){return(0,p.An)(this.url)}async fetchAttributionData(){const e=this.attributionDataUrl;if(this.hasAttributionData&&e)return(await(0,s.A)(e,{query:{f:"json"},responseType:"json"})).data;throw new n.A("layer:no-attribution-data","Layer does not have attribution data")}};(0,i._)([(0,c.MZ)({type:String})],w.prototype,"attributionDataUrl",void 0),(0,i._)([(0,c.MZ)({readOnly:!0})],w.prototype,"effectiveVisible",null),(0,i._)([(0,c.MZ)({type:m.A})],w.prototype,"fullExtent",void 0),(0,i._)([(0,c.MZ)({readOnly:!0})],w.prototype,"hasAttributionData",null),(0,i._)([(0,c.MZ)({type:String,clonable:!1})],w.prototype,"id",void 0),(0,i._)([(0,c.MZ)({type:Boolean,nonNullable:!0})],w.prototype,"legendEnabled",void 0),(0,i._)([(0,c.MZ)({type:["show","hide","hide-children"]})],w.prototype,"listMode",void 0),(0,i._)([(0,c.MZ)({type:Number,range:{min:0,max:1},nonNullable:!0})],w.prototype,"opacity",void 0),(0,i._)([(0,c.MZ)({clonable:!1})],w.prototype,"parent",void 0),(0,i._)([(0,c.MZ)({readOnly:!0})],w.prototype,"parsedUrl",null),(0,i._)([(0,c.MZ)({type:Boolean,readOnly:!0})],w.prototype,"persistenceEnabled",void 0),(0,i._)([(0,c.MZ)({type:Boolean})],w.prototype,"popupEnabled",void 0),(0,i._)([(0,c.MZ)({type:Boolean})],w.prototype,"attributionVisible",void 0),(0,i._)([(0,c.MZ)({type:g.A})],w.prototype,"spatialReference",void 0),(0,i._)([(0,c.MZ)({type:String})],w.prototype,"title",void 0),(0,i._)([(0,c.MZ)({readOnly:!0,json:{read:!1}})],w.prototype,"type",void 0),(0,i._)([(0,c.MZ)()],w.prototype,"url",void 0),(0,i._)([(0,c.MZ)({type:f.A})],w.prototype,"visibilityTimeExtent",void 0),(0,i._)([(0,c.MZ)({type:Boolean,nonNullable:!0})],w.prototype,"visible",void 0),w=(0,i._)([(0,h.$)("esri.layers.Layer")],w);const b=w},13899:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Ee});var i=r(90237),s=r(52106),n=r(13874),o=(r(86162),r(94409),r(65345),r(42980),r(20917),r(92438),r(96576),r(93618),r(65494),r(15036)),a=r(69540),l=r(5503),d=r(49186),u=r(53966),p=r(92071),c=r(74887),h=r(36708),y=r(10107),f=(r(44208),r(87811),r(88620)),m=r(36005),g=r(40608),v=r(35666),w=r(40036),b=r(86738),_=r(4146),I=r(55726),S=r(52136),A=r(18768),M=r(69208),F=r(47685),x=r(16131),L=r(8303),O=r(25036),E=r(58947),j=r(82935),T=r(25482),Z=r(30524);function U({associatedLayer:e,serviceUpdateTimeStamp:t}){const r=e?.editingInfo?.lastEditDate,i=e?.serverGens,s=null!=r,n=null!=t,o=s&&n&&t.lastUpdate!==r.getTime();return s&&(o||!n&&i?.minServerGen!==i?.serverGen)}var P=r(96184),R=r(79677),$=r(10184);const N=e=>{let t=class extends e{constructor(){super(...arguments),this.serviceTimeInfo=null}get timeInfo(){const e=this.associatedLayer?.timeInfo;if(null==e)return null;const t=e.clone();return(0,Z.sv)(t,this.fieldsIndex),t}set timeInfo(e){(0,Z.sv)(e,this.fieldsIndex),this._override("timeInfo",e)}get timeExtent(){return this.associatedLayer?.timeExtent}set timeExtent(e){this._override("timeExtent",e)}get timeOffset(){return this.associatedLayer?.timeOffset}set timeOffset(e){this._override("timeOffset",e)}get datesInUnknownTimezone(){return this.associatedLayer?.datesInUnknownTimezone??!1}set datesInUnknownTimezone(e){this._override("datesInUnknownTimezone",e)}async loadTimeInfoFromService(e){const{serviceTimeInfo:t}=this;if(null==t)return;const{startTimeField:r,endTimeField:i}=t;if(null==r&&null==i)return;if(U({associatedLayer:this.associatedLayer,serviceUpdateTimeStamp:this.serviceUpdateTimeStamp}))return;const s=async t=>{let i=null;try{const r=await(this.fetchStatistics?.(t,e));i=r?.stats}catch{}if(null==i)return null;const{minTimeStr:s,min:n,maxTimeStr:o,max:a}=i,l=t===r?s??n:o??a;return null!=l?new Date(l):null},[n,o]=await Promise.all([s(r),s(i)]);if(null!=r&&null==n||null!=i&&null==o)return;const a=new R.A({start:n,end:o});this.setAtOrigin("timeInfo",new P.A({endField:i,startField:r,fullTimeExtent:a}),"service")}};return(0,i._)([(0,y.MZ)({type:P.A,json:{read:!1,write:!1}})],t.prototype,"timeInfo",null),(0,i._)([(0,y.MZ)({type:R.A,json:{read:!1,write:!1}})],t.prototype,"timeExtent",null),(0,i._)([(0,y.MZ)({type:$.A,json:{read:!1,write:!1}})],t.prototype,"timeOffset",null),(0,i._)([(0,y.MZ)({type:Boolean,nonNullable:!0,json:{read:!1,write:!1}})],t.prototype,"datesInUnknownTimezone",null),(0,i._)([(0,y.MZ)({type:D,readOnly:!0,json:{read:{source:"timeInfo"}}})],t.prototype,"serviceTimeInfo",void 0),t=(0,i._)([(0,g.$)("esri.layers.mixins.TemporalSceneLayer")],t),t};let D=class extends T.oY{constructor(){super(...arguments),this.endTimeField=null,this.startTimeField=null}};(0,i._)([(0,y.MZ)({type:String})],D.prototype,"endTimeField",void 0),(0,i._)([(0,y.MZ)({type:String})],D.prototype,"startTimeField",void 0),D=(0,i._)([(0,g.$)("esri.layers.mixins.TemporalSceneLayer.SceneServiceTimeInfo")],D);var C=r(60694),k=r(92009),H=r(4071),V=r(10873),q=r(15426),G=r(40530),J=r(67202),B=r(17036),K=r(95466),Q=r(50805),W=r(20557),z=r(81457),Y=r(39383),X=r(37352),ee=r(4513);let te=class extends T.oY{constructor(){super(...arguments),this.name=null,this.field=null,this.currentRangeExtent=null,this.fullRangeExtent=null,this.type="rangeInfo"}};(0,i._)([(0,y.MZ)({type:String,json:{read:!0,write:!0}})],te.prototype,"name",void 0),(0,i._)([(0,y.MZ)({type:String,json:{read:!0,write:!0}})],te.prototype,"field",void 0),(0,i._)([(0,y.MZ)({type:[Number],json:{read:!0,write:!0}})],te.prototype,"currentRangeExtent",void 0),(0,i._)([(0,y.MZ)({type:[Number],json:{read:!0,write:!0}})],te.prototype,"fullRangeExtent",void 0),(0,i._)([(0,y.MZ)({type:["rangeInfo"],readOnly:!0,json:{read:!1,write:!0}})],te.prototype,"type",void 0),te=(0,i._)([(0,g.$)("esri.layers.support.RangeInfo")],te);var re,ie=r(78888),se=r(4718),ne=r(87024),oe=r(67076),ae=r(39829),le=r(57251);let de=re=class extends((0,T.Te)(l.A.ofType(ae.A))){constructor(e){super(e)}clone(){return new re(this.items.map((e=>e.clone())))}write(e,t){return this.toJSON(t)}toJSON(e){const t=e?.layer?.spatialReference;return t?this.toArray().map((r=>{if(!t.equals(r.spatialReference)){if(!(0,le.canProjectWithoutEngine)(r.spatialReference,t))return e?.messages?.push(new oe.A("scenefilter:unsupported","Scene filters with incompatible spatial references are not supported",{modification:this,spatialReference:e.layer.spatialReference,context:e})),null;const i=new ae.A;(0,le.projectPolygon)(r,i,t),r=i}const i=r.toJSON(e);return delete i.spatialReference,i})).filter((e=>null!=e)):(e?.messages?.push(new oe.A("scenefilter:unsupported","Writing Scene filters without context layer is not supported",{modification:this,spatialReference:e.layer.spatialReference,context:e})),this.toArray().map((t=>t.toJSON(e))))}static fromJSON(e,t){const r=new re;return e.forEach((e=>r.add(ae.A.fromJSON(e,t)))),r}};de=re=(0,i._)([(0,g.$)("esri.layers.support.PolygonCollection")],de);const ue=de;var pe,ce=r(97159);let he=pe=class extends T.oY{constructor(e){super(e),this.spatialRelationship="disjoint",this.geometries=new ue,this._geometriesSource=null}initialize(){this.addHandles((0,h.on)((()=>this.geometries),"after-changes",(()=>this.geometries=this.geometries),h.OH))}readGeometries(e,t,r){Array.isArray(e)?this.geometries=ue.fromJSON(e,r):this._geometriesSource={url:(0,ce.f)(e,r),context:r}}async loadGeometries(e,t){if(null==this._geometriesSource)return;const{url:r,context:i}=this._geometriesSource,s=await(0,ie.A)(r,{responseType:"json",signal:t?.signal}),n=e.toJSON(),o=s.data.map((e=>({...e,spatialReference:n})));this.geometries=ue.fromJSON(o,i),this._geometriesSource=null}clone(){const e=new pe({geometries:(0,se.o8)(this.geometries),spatialRelationship:this.spatialRelationship});return e._geometriesSource=this._geometriesSource,e}};(0,i._)([(0,y.MZ)({type:["disjoint","contains"],nonNullable:!0,json:{write:!0}})],he.prototype,"spatialRelationship",void 0),(0,i._)([(0,y.MZ)({type:ue,nonNullable:!0,json:{write:!0}}),(0,ne.P)({origins:["web-scene","portal-item"],type:"resource",prefix:"geometries",contentAddressed:!0})],he.prototype,"geometries",void 0),(0,i._)([(0,m.w)(["web-scene","portal-item"],"geometries")],he.prototype,"readGeometries",null),he=pe=(0,i._)([(0,g.$)("esri.layers.support.SceneFilter")],he);const ye=he;var fe=r(84952),me=r(8947),ge=r(61956),ve=r(24212),we=r(30291);async function be(e){const t=[];for(const r of e)r.name.toLowerCase().endsWith(".zip")?t.push(_e(r)):t.push(Promise.resolve(r));return(await Promise.all(t)).flat()}async function _e(e){const{BlobReader:t,ZipReader:i,BlobWriter:s}=await Promise.all([r.e(8392),r.e(9588)]).then(r.bind(r,9588)),n=[],o=new i(new t(e));return(await o.getEntries()).forEach((e=>{if(e.directory||/^__MACOS/i.test(e.filename))return;const t=new s,r=e.getData?.(t).then((t=>new File([t],e.filename)));r&&n.push(r)})),Promise.all(n)}var Ie=r(4654),Se=r(45671),Ae=r(78553);const Me=new Set(["3DObject","Point"]),Fe=(0,B.p)();let xe=class extends(N((0,F.w6)((0,E.w6)((0,A.b)((0,x.q)((0,L.A)((0,O.j)((0,p.P)((0,M.d)((0,S.p)((0,a.O)(_.A)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new l.A,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getFeatureType(t?.feature)?.domains?.[e];return r&&"inherited"!==r.type?r:this.getField(e)?.domain??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get attributeTableTemplate(){return this.associatedLayer?.attributeTableTemplate??null}get fieldsIndex(){return new K.A(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:Q.W4.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&(0,q.C$)(this.associatedLayer)}get geometryType(){return Oe[this.profile]||"mesh"}set renderer(e){(0,Z.yp)(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:H.P;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:n,supportsGeometryUpdate:o,supportsReturnServiceEditsInSourceSpatialReference:a},data:{supportsZ:l,supportsM:d,isVersioned:u,supportsAttachment:p},operations:{supportsEditing:c,supportsAdd:h,supportsUpdate:y,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,w=e.operations.supportsChangeTracking,b=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:a,supportsRollbackOnFailure:s,supportsGeometryUpdate:b&&o,supportsUploadWithItemId:n},data:{supportsAttachment:p,supportsZ:l,supportsM:d,isVersioned:u},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:c&&w,supportsAdd:b&&h&&w,supportsDelete:b&&f&&w,supportsUpdate:y&&w,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&Le[r]?Le[r]:(u.A.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override("useViewTime",e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(c.QP),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await(0,me.L)(this,{origin:"service"},t),(0,Z.yp)(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){u.A.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new ge.A;return"mesh"===this.geometryType?this.associatedLayer?.infoFor3D&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new d.A("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new d.A("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=(0,Z.hL)(this.fieldsIndex,await(0,Se.TO)(this,(0,Se.D8)(this)));return(0,Ie.s1)(this.parsedUrl?.path??"",this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,t){const r=await this.queryCachedAttributes(e,[t]);if(!r||0===r.length)throw new d.A("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const i=new s.A;return i.attributes=r[0],i.layer=this,i.sourceLayer=this,i}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(u.A.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return(0,we.tn)(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new d.A("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new d.A("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(E.Xh.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(E.Xh.SAVE,e)}async applyEdits(e,t){const{applyEdits:i}=await r.e(6247).then(r.bind(r,78628));let s=t;await this.load();const n=this.associatedLayer;if(!n)throw new d.A(`${this.type}-layer:not-editable`,"Service is not editable");await n.load();const{globalIdField:o}=n,a=!!n.infoFor3D,l=s?.globalIdUsed??!0;if(a&&null==o)throw new d.A(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(a&&!l)throw new d.A(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return(0,C.Wo)(n.url)&&a&&null!=e.deleteFeatures&&null!=o&&(s={...s,globalIdToObjectId:await(0,q.GA)(n,e.deleteFeatures,o)}),i(this,n.source,e,s)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new d.A(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}async convertMesh(e,t){t??={};const r=e=>{throw u.A.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||r(new d.A("invalid:layer","SceneLayer has no capability for mesh conversion"));const i=await this.extractAndFilterFiles(e),s=i.reduce(((e,t)=>(0,W.oF)(this.infoFor3D,t)?e+1:e),0);0===s&&r(new I.VP),s>1&&r(new I.XQ);const n=this.spatialReference,o=t.location??new b.A({x:0,y:0,z:0,spatialReference:n}),a=o.spatialReference.isGeographic?"local":"georeferenced",l=w.A.createWithExternalSource(o,i,{vertexSpace:a}),[p]=await this.uploadAssets([l],{...t,useAssetOrigin:!t.location});return p}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;return t?(await be(e)).filter((e=>(0,W.fu)(t,e))):e}validateLayer(e){if(e.layerType&&!Me.has(e.layerType))throw new d.A("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new d.A("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new d.A("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});!function(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new d.A("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new d.A("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new d.A("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!!this.attributeStorageInfo?.some((t=>t.name===e.name)),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=(0,f.oY)(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),n=this.associatedLayer.originIdOf(i);s<n&&(n===v.Gr.SERVICE||n===v.Gr.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],n)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.getAtOrigin("fullExtent","service");null!=this.associatedLayer?.infoFor3D&&e&&(0,C.Wo)(this.associatedLayer?.url)&&U(this)&&(0,f.oY)(this).setAtOrigin("fullExtent",e.clone(),v.Gr.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await(0,k.L)(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await ee.S.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(e){(0,c.zf)(e)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await(0,h.C_)((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?u.A.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):u.A.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&(0,ve.XF)(u.A.getLogger(this),(0,ve.$7)("Mesh scene layers","relative-to-scene",e)),(0,ve.XF)(u.A.getLogger(this),(0,ve.tW)("Scene layers",e))}async fetchStatistics(e,t){return await async function({fieldName:e,statisticsInfo:t,errorContext:r,fieldsIndex:i,path:s,customParameters:n,apiKey:o,signal:a}){if(null==t)throw new d.A(`${r}:no-cached-statistics`,"Cached statistics are not available for this layer");const l=i.get(e);if(null==l)throw new d.A(`${r}:field-unexisting`,`Field '${e}' does not exist on the layer`);const u=t.find((e=>e.name===l.name));if(null==u)throw new d.A(`${r}:no-cached-statistics`,"Cached statistics for this attribute are not available");const p=(0,fe.fj)(s,u.href),{data:c}=await(0,ie.A)(p,{query:{f:"json",...n,token:o},responseType:"json",signal:a});return c}({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:"scenelayer",fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??"",customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}};(0,i._)([(0,y.MZ)({types:{key:"type",base:G.c,typeMap:{selection:J.A}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],xe.prototype,"featureReduction",void 0),(0,i._)([(0,y.MZ)({type:[te],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],xe.prototype,"rangeInfos",void 0),(0,i._)([(0,y.MZ)({json:{read:!1}})],xe.prototype,"associatedLayer",void 0),(0,i._)([(0,y.MZ)({type:["show","hide"]})],xe.prototype,"listMode",void 0),(0,i._)([(0,y.MZ)({type:["ArcGISSceneServiceLayer"]})],xe.prototype,"operationalLayerType",void 0),(0,i._)([(0,y.MZ)({json:{read:!1},readOnly:!0})],xe.prototype,"type",void 0),(0,i._)([(0,y.MZ)({...Fe.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],xe.prototype,"fields",void 0),(0,i._)([(0,y.MZ)()],xe.prototype,"types",null),(0,i._)([(0,y.MZ)()],xe.prototype,"typeIdField",null),(0,i._)([(0,y.MZ)()],xe.prototype,"templates",null),(0,i._)([(0,y.MZ)()],xe.prototype,"formTemplate",null),(0,i._)([(0,y.MZ)()],xe.prototype,"attributeTableTemplate",null),(0,i._)([(0,y.MZ)({readOnly:!0,clonable:!1})],xe.prototype,"fieldsIndex",null),(0,i._)([(0,y.MZ)({type:X.A,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],xe.prototype,"floorInfo",void 0),(0,i._)([(0,y.MZ)(Fe.outFields)],xe.prototype,"outFields",void 0),(0,i._)([(0,y.MZ)({type:Q.W4,readOnly:!0,json:{read:!1}})],xe.prototype,"nodePages",void 0),(0,i._)([(0,m.w)("service","nodePages",["nodePages","pointNodePages"])],xe.prototype,"readNodePages",null),(0,i._)([(0,y.MZ)({type:[Q.uV],readOnly:!0})],xe.prototype,"materialDefinitions",void 0),(0,i._)([(0,y.MZ)({type:[Q.Ot],readOnly:!0})],xe.prototype,"textureSetDefinitions",void 0),(0,i._)([(0,y.MZ)({type:[Q.L0],readOnly:!0})],xe.prototype,"geometryDefinitions",void 0),(0,i._)([(0,y.MZ)({readOnly:!0})],xe.prototype,"serviceUpdateTimeStamp",void 0),(0,i._)([(0,y.MZ)({readOnly:!0})],xe.prototype,"attributeStorageInfo",void 0),(0,i._)([(0,y.MZ)({readOnly:!0})],xe.prototype,"statisticsInfo",void 0),(0,i._)([(0,y.MZ)({type:l.A.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],xe.prototype,"excludeObjectIds",void 0),(0,i._)([(0,y.MZ)({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],xe.prototype,"definitionExpression",void 0),(0,i._)([(0,y.MZ)({type:ye,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],xe.prototype,"filter",void 0),(0,i._)([(0,y.MZ)({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],xe.prototype,"path",void 0),(0,i._)([(0,y.MZ)(V.Yj)],xe.prototype,"elevationInfo",null),(0,i._)([(0,y.MZ)({readOnly:!0,json:{read:!1}})],xe.prototype,"effectiveCapabilities",null),(0,i._)([(0,y.MZ)({readOnly:!0})],xe.prototype,"effectiveEditingEnabled",null),(0,i._)([(0,y.MZ)({type:String})],xe.prototype,"geometryType",null),(0,i._)([(0,y.MZ)(V.kF)],xe.prototype,"labelsVisible",void 0),(0,i._)([(0,y.MZ)({type:[z.A],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:Y.w},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:Y.w},write:!0}})],xe.prototype,"labelingInfo",void 0),(0,i._)([(0,y.MZ)(V.fV)],xe.prototype,"legendEnabled",void 0),(0,i._)([(0,y.MZ)({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?(0,Ae.D)(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],xe.prototype,"opacity",void 0),(0,i._)([(0,y.MZ)({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],xe.prototype,"priority",void 0),(0,i._)([(0,y.MZ)({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],xe.prototype,"semantic",void 0),(0,i._)([(0,y.MZ)({types:o.X,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],xe.prototype,"renderer",null),(0,i._)([(0,y.MZ)({json:{read:!1}})],xe.prototype,"cachedDrawingInfo",void 0),(0,i._)([(0,m.w)("service","cachedDrawingInfo")],xe.prototype,"readCachedDrawingInfo",null),(0,i._)([(0,y.MZ)({readOnly:!0,json:{read:!1}})],xe.prototype,"capabilities",null),(0,i._)([(0,y.MZ)({type:Boolean,json:{read:!1}})],xe.prototype,"editingEnabled",null),(0,i._)([(0,y.MZ)({readOnly:!0,json:{write:!1,read:!1}})],xe.prototype,"infoFor3D",null),(0,i._)([(0,y.MZ)({readOnly:!0,json:{write:!1,read:!1}})],xe.prototype,"relationships",null),(0,i._)([(0,y.MZ)(V.M6)],xe.prototype,"popupEnabled",void 0),(0,i._)([(0,y.MZ)({type:n.A,json:{name:"popupInfo",write:!0}})],xe.prototype,"popupTemplate",void 0),(0,i._)([(0,y.MZ)({readOnly:!0,json:{read:!1}})],xe.prototype,"defaultPopupTemplate",null),(0,i._)([(0,y.MZ)({type:String,json:{read:!1}})],xe.prototype,"objectIdField",void 0),(0,i._)([(0,m.w)("service","objectIdField",["objectIdField","fields"])],xe.prototype,"readObjectIdField",null),(0,i._)([(0,y.MZ)({type:String,json:{read:!1}})],xe.prototype,"globalIdField",void 0),(0,i._)([(0,m.w)("service","globalIdField",["globalIdField","fields"])],xe.prototype,"readGlobalIdField",null),(0,i._)([(0,y.MZ)({readOnly:!0,type:String,json:{read:!1}})],xe.prototype,"displayField",null),(0,i._)([(0,y.MZ)({type:String,json:{read:!1}})],xe.prototype,"profile",void 0),(0,i._)([(0,m.w)("service","profile",["store.profile"])],xe.prototype,"readProfile",null),(0,i._)([(0,y.MZ)({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],xe.prototype,"normalReferenceFrame",void 0),(0,i._)([(0,y.MZ)(V.PY)],xe.prototype,"screenSizePerspectiveEnabled",void 0),(0,i._)([(0,y.MZ)({json:{read:!1,origins:{service:{read:!0}}}})],xe.prototype,"serviceItemId",void 0),(0,i._)([(0,y.MZ)(j.B)],xe.prototype,"useViewTime",null),xe=(0,i._)([(0,g.$)("esri.layers.SceneLayer")],xe);const Le={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},Oe={"mesh-pyramids":"mesh",points:"point"},Ee=xe},55726:(e,t,r)=>{r.d(t,{$1:()=>d,H2:()=>h,MT:()=>y,VP:()=>f,WF:()=>u,Wt:()=>o,XQ:()=>m,hK:()=>c,nS:()=>p,uh:()=>a,xY:()=>l});var i=r(49186);const s="upload-assets",n=()=>new Error;class o extends i.A{constructor(){super(`${s}:unsupported`,"Layer does not support asset uploads.",n())}}class a extends i.A{constructor(){super(`${s}:no-glb-support`,"Layer does not support glb.",n())}}class l extends i.A{constructor(){super(`${s}:no-supported-source`,"No supported external source found",n())}}class d extends i.A{constructor(){super(`${s}:not-base-64`,"Expected gltf data in base64 format after conversion.",n())}}class u extends i.A{constructor(){super(`${s}:unable-to-prepare-options`,"Unable to prepare uploadAsset request options.",n())}}class p extends i.A{constructor(e,t){super(`${s}:bad-response`,`Bad response. Uploaded ${e} items and received ${t} results.`,n())}}class c extends i.A{constructor(e,t){super(`${s}-layer:upload-failed`,`Failed to upload mesh file ${e}. Error code: ${t?.code??"-1"}. Error message: ${t?.messages??"unknown"}`,n())}}class h extends i.A{constructor(e){super(`${s}-layer:unsupported-format`,`The service allowed us to upload an asset of FormatID ${e}, but it does not list it in its supported formats.`,n())}}class y extends i.A{constructor(){super(`${s}:convert3D-failed`,"convert3D failed.")}}class f extends i.A{constructor(){super("invalid-input:no-model","No supported model found")}}class m extends i.A{constructor(){super("invalid-input:multiple-models","Multiple supported models found")}}},52136:(e,t,r)=>{r.d(t,{p:()=>o});var i=r(90237),s=r(10107),n=(r(44208),r(53966),r(87811),r(40608));const o=e=>{let t=class extends e{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(e){null!=e?this._override("apiKey",e):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return(0,i._)([(0,s.MZ)({type:String})],t.prototype,"apiKey",null),t=(0,i._)([(0,n.$)("esri.layers.mixins.APIKeyMixin")],t),t}},18768:(e,t,r)=>{r.d(t,{b:()=>l});var i=r(90237),s=r(53966),n=r(10107),o=(r(44208),r(87811),r(40608)),a=r(60694);const l=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,a.qg)(this.url);if(null!=e&&e.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,a.Jf)(e,s.A.getLogger(this)))}};return(0,i._)([(0,n.MZ)()],t.prototype,"title",null),(0,i._)([(0,n.MZ)({type:String})],t.prototype,"url",null),t=(0,i._)([(0,o.$)("esri.layers.mixins.ArcGISService")],t),t}},69208:(e,t,r)=>{r.d(t,{d:()=>o});var i=r(90237),s=r(10107),n=(r(44208),r(53966),r(87811),r(40608));const o=e=>{let t=class extends e{constructor(){super(...arguments),this.customParameters=null}};return(0,i._)([(0,s.MZ)({type:Object,json:{write:{overridePolicy:e=>({enabled:!!(e&&Object.keys(e).length>0)})}}})],t.prototype,"customParameters",void 0),t=(0,i._)([(0,n.$)("esri.layers.mixins.CustomParametersMixin")],t),t}},47685:(e,t,r)=>{r.d(t,{Mk:()=>h,Zk:()=>p,w6:()=>m});var i=r(90237),s=r(65529),n=r(4718),o=r(74887),a=r(10107),l=(r(44208),r(53966),r(40608)),d=r(20816);const u=new s.A.EventEmitter;function p(e,t,r=null,i=!1){const s=(0,o.Tw)();return i=null==t||i,u.emit("apply-edits",{serviceUrl:e,layerId:t,gdbVersion:r,mayReceiveServiceEdits:i,result:s.promise}),s}const c=Symbol();function h(e){return null!=e&&"object"==typeof e&&c in e}function y(e){return null!=e&&"object"==typeof e&&"gdbVersion"in e}function f(e,t,r){const i=new URL(e).host,s=d.Z3.get(i),n=e=>!e||e===s;return n(t)&&n(r)||t===r}const m=e=>{var t;let r=class extends e{constructor(...e){super(...e),this[t]=!0,this._applyEditsHandler=e=>{const{serviceUrl:t,layerId:r,gdbVersion:i,mayReceiveServiceEdits:s,result:o}=e,a=t===this.url,l=null!=r&&null!=this.layerId&&r===this.layerId,d=y(this),u=y(this)&&f(t,i,this.gdbVersion);if(!a||d&&!u||!l&&!s)return;const p=o.then((e=>{if(this.lastEditsEventDate=new Date,l&&(e.addedFeatures.length||e.updatedFeatures.length||e.deletedFeatures.length||e.addedAttachments.length||e.updatedAttachments.length||e.deletedAttachments.length))return this.emit("edits",(0,n.o8)(e)),e;const r=e.editedFeatures?.find((({layerId:e})=>e===this.layerId));if(r){const{adds:t,updates:i,deletes:s}=r.editedFeatures,o={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:t?t.map((({attributes:e})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],deletedFeatures:s?s.map((({attributes:e})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],updatedFeatures:i?i.map((({current:{attributes:e}})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],editedFeatures:(0,n.o8)(e.editedFeatures),exceededTransferLimit:!1,historicMoment:(0,n.o8)(e.historicMoment)};return this.emit("edits",o),o}const s={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:[],deletedFeatures:[],updatedFeatures:[],editedFeatures:(0,n.o8)(e.editedFeatures),exceededTransferLimit:!1,historicMoment:(0,n.o8)(e.historicMoment)};return"historicMoment"in this&&this._shouldUpdateHistoricMoment(t,i,s.historicMoment)&&this.emit("edits",s),s})).then((e=>("historicMoment"in this&&this._shouldUpdateHistoricMoment(t,i,e.historicMoment)&&(this.historicMoment=e.historicMoment),e)));this.emit("apply-edits",{result:p})},this._updateMomentHandler=e=>{const{serviceUrl:t,gdbVersion:r,moment:i}=e,s=t===this.url,n=y(this),o=y(this)&&f(t,r,this.gdbVersion),a=y(this)&&!f(t,this.gdbVersion,null);s&&n&&o&&a&&"historicMoment"in this&&this.historicMoment!==i&&(this.historicMoment=i)},this.when().then((()=>{this.addHandles(function(e){return u.on("apply-edits",new WeakRef(e))}(this._applyEditsHandler)),"historicMoment"in this&&this.addHandles(function(e){return u.on("update-moment",new WeakRef(e))}(this._updateMomentHandler))}),(()=>{}))}_shouldUpdateHistoricMoment(e,t,r){return"historicMoment"in this&&this.historicMoment!==r&&(0,d.w5)(e,t)}};return t=c,(0,i._)([(0,a.MZ)()],r.prototype,"lastEditsEventDate",void 0),r=(0,i._)([(0,l.$)("esri.layers.mixins.EditBusLayer")],r),r}},8303:(e,t,r)=>{r.d(t,{A:()=>I});var i=r(90237),s=r(92602),n=r(70333),o=r(78888),a=r(60999),l=r(49186),d=r(53966),u=r(97768),p=r(74887),c=r(84952),h=r(10107),y=(r(44208),r(87811),r(36005)),f=r(40608),m=r(43937),g=r(83531),v=r(20655),w=r(80812),b=r(41318),_=r(10407);const I=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=(0,u.pR)(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,r){if(t.itemId)return new w.default({id:t.itemId,portal:r?.portal})}writePortalItem(e,t){e?.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem?.id)try{const{load:i}=await Promise.all([r.e(5356),r.e(1204)]).then(r.bind(r,41204));return(0,p.Te)(t),await i({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap},t)}catch(e){throw(0,p.zf)(e)||d.A.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,p.QP)(e),!0))))}async setUserPrivileges(e,t){if(!s.A.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(t);if(this.url)try{const{features:{edit:r,fullEdit:i},content:{updateItem:s}}=await this._fetchUserPrivileges(e,t);this._set("userHasEditingPrivileges",r),this._set("userHasFullEditingPrivileges",i),this._set("userHasUpdateItemPrivileges",s)}catch(e){(0,p.QP)(e)}}async _fetchUserPrivileges(e,t){let r=this.portalItem;if(!e||!r||!r.loaded||r.sourceUrl)return this._fetchFallbackUserPrivileges(t);const i=e===r.id;if(i&&r.portal.user)return(0,_.It)(r);let s,o;if(i)s=r.portal.url;else try{s=await(0,g.wI)(this.url,t)}catch(e){(0,p.QP)(e)}if(!s||!(0,c.b8)(s,r.portal.url))return this._fetchFallbackUserPrivileges(t);try{const e=null!=t?t.signal:null;o=await(n.id?.getCredential(`${s}/sharing`,{prompt:!1,signal:e}))}catch(e){(0,p.QP)(e)}const a=!0,l=!1,d=!1;if(!o)return{features:{edit:a,fullEdit:l},content:{updateItem:d}};try{if(i?await r.reload():(r=new w.default({id:e,portal:{url:s}}),await r.load(t)),r.portal.user)return(0,_.It)(r)}catch(e){(0,p.QP)(e)}return{features:{edit:a,fullEdit:l},content:{updateItem:d}}}async _fetchFallbackUserPrivileges(e){let t=!0;try{t=await this._fetchUserHasEditingPrivileges(e)}catch(e){(0,p.QP)(e)}return{features:{edit:t,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(e){const t=this.url?n.id?.findCredential(this.url):null;if(!t)return!0;const r=S.credential===t?S.user:await this._fetchEditingUser(e);return S.credential=t,S.user=r,null==r?.privileges||r.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const r=n.id?.findServerInfo(this.url??"");if(!r?.owningSystemUrl)return null;const i=`${r.owningSystemUrl}/sharing/rest`,s=v.A.getDefault();if(s&&s.loaded&&(0,c.S8)(s.restUrl)===(0,c.S8)(i))return s.user;const l=`${i}/community/self`,d=null!=e?e.signal:null,u=await(0,a.Ke)((0,o.A)(l,{authMode:"no-prompt",query:{f:"json"},signal:d}));return u.ok?b.A.fromJSON(u.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const r=t?.portal,i=this.portalItem?.id&&(this.portalItem.portal||v.A.getDefault());return r&&i&&!(0,c.ut)(i.restUrl,r.restUrl)?(t.messages&&t.messages.push(new l.A("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,i._)([(0,h.MZ)({type:w.default})],t.prototype,"portalItem",null),(0,i._)([(0,y.w)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,i._)([(0,m.K)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,i._)([(0,h.MZ)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,i._)([(0,h.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),(0,i._)([(0,h.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasFullEditingPrivileges",void 0),(0,i._)([(0,h.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasUpdateItemPrivileges",void 0),t=(0,i._)([(0,f.$)("esri.layers.mixins.PortalLayer")],t),t},S={credential:null,user:null}},25036:(e,t,r)=>{r.d(t,{j:()=>o});var i=r(90237),s=r(10107),n=(r(44208),r(53966),r(87811),r(40608));const o=e=>{let t=class extends e{constructor(){super(...arguments),this.minScale=0,this.maxScale=0}get effectiveScaleRange(){const e={minScale:this.minScale,maxScale:this.maxScale},t=this.parent;t&&"effectiveScaleRange"in t&&function(e,t){e.minScale=e.minScale>0?t.minScale>0?Math.min(e.minScale,t.minScale):e.minScale:t.minScale,e.maxScale=e.maxScale>0?t.maxScale>0?Math.max(e.maxScale,t.maxScale):e.maxScale:t.maxScale}(e,t.effectiveScaleRange);const r=this._get("effectiveScaleRange");return r&&r.minScale===e.minScale&&r.maxScale===e.maxScale?r:e}};return(0,i._)([(0,s.MZ)({type:Number,nonNullable:!0,json:{write:!0}})],t.prototype,"minScale",void 0),(0,i._)([(0,s.MZ)({type:Number,nonNullable:!0,json:{write:!0}})],t.prototype,"maxScale",void 0),(0,i._)([(0,s.MZ)({readOnly:!0})],t.prototype,"effectiveScaleRange",null),t=(0,i._)([(0,n.$)("esri.layers.mixins.ScaleRangeLayer")],t),t}},82935:(e,t,r)=>{r.d(t,{B:()=>h,e:()=>y});var i=r(90237),s=r(10107),n=(r(44208),r(53966),r(87811),r(36005)),o=r(40608),a=r(89317),l=r(30524),d=r(96184),u=r(73133),p=r(79677),c=r(10184);const h={type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation",layerContainerTypes:a.K}}},y=e=>{let t=class extends e{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(e,t){const r=t.timeInfo.exportOptions;if(!r)return null;const i=r.timeOffset,s=u.j.fromJSON(r.timeOffsetUnits);return i&&s?new c.A({value:i,unit:s}):null}set timeInfo(e){(0,l.sv)(e,this.fieldsIndex),this._set("timeInfo",e)}};return(0,i._)([(0,s.MZ)({type:p.A,json:{write:!1}})],t.prototype,"timeExtent",void 0),(0,i._)([(0,s.MZ)({type:c.A})],t.prototype,"timeOffset",void 0),(0,i._)([(0,n.w)("service","timeOffset",["timeInfo.exportOptions"])],t.prototype,"readOffset",null),(0,i._)([(0,s.MZ)({value:null,type:d.A,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],t.prototype,"timeInfo",null),(0,i._)([(0,s.MZ)(h)],t.prototype,"useViewTime",void 0),t=(0,i._)([(0,o.$)("esri.layers.mixins.TemporalLayer")],t),t}},40530:(e,t,r)=>{r.d(t,{c:()=>a});var i=r(90237),s=r(25482),n=r(10107),o=(r(44208),r(53966),r(87811),r(40608));let a=class extends s.oY{constructor(){super(...arguments),this.type=null}};(0,i._)([(0,n.MZ)({type:["selection","cluster","binning"],readOnly:!0,json:{read:!1,write:!0}})],a.prototype,"type",void 0),a=(0,i._)([(0,o.$)("esri.layers.support.FeatureReduction")],a)},67202:(e,t,r)=>{r.d(t,{A:()=>d});var i,s=r(90237),n=r(10107),o=(r(44208),r(53966),r(87811),r(40608)),a=r(40530);let l=i=class extends a.c{constructor(e){super(e),this.type="selection"}clone(){return new i}};(0,s._)([(0,n.MZ)({type:["selection"]})],l.prototype,"type",void 0),l=i=(0,s._)([(0,o.$)("esri.layers.support.FeatureReductionSelection")],l);const d=l},37352:(e,t,r)=>{r.d(t,{A:()=>u});var i,s=r(90237),n=r(5503),o=r(25482),a=r(10107),l=(r(44208),r(53966),r(87811),r(40608));let d=i=class extends o.oY{constructor(e){super(e),this.floorField=null,this.viewAllMode=!1,this.viewAllLevelIds=new n.A}clone(){return new i({floorField:this.floorField,viewAllMode:this.viewAllMode,viewAllLevelIds:this.viewAllLevelIds})}};(0,s._)([(0,a.MZ)({type:String,json:{write:!0}})],d.prototype,"floorField",void 0),(0,s._)([(0,a.MZ)({json:{read:!1,write:!1}})],d.prototype,"viewAllMode",void 0),(0,s._)([(0,a.MZ)({json:{read:!1,write:!1}})],d.prototype,"viewAllLevelIds",void 0),d=i=(0,s._)([(0,l.$)("esri.layers.support.LayerFloorInfo")],d);const u=d},96184:(e,t,r)=>{r.d(t,{A:()=>f});var i=r(90237),s=r(69540),n=r(25482),o=r(10107),a=(r(44208),r(53966),r(87811),r(36005)),l=r(40608),d=r(43937),u=r(79677),p=r(10184),c=r(56400);function h(e,t){return p.A.fromJSON({value:e,unit:t})}let y=class extends((0,s.O)(n.oY)){constructor(e){super(e),this.cumulative=!1,this.endField=null,this.fullTimeExtent=null,this.hasLiveData=!1,this.interval=null,this.startField=null,this.timeZone=null,this.trackIdField=null,this.useTime=!0,this.stops=null}readFullTimeExtent(e,t){return t.timeExtent&&Array.isArray(t.timeExtent)&&2===t.timeExtent.length?u.A.fromArray(t.timeExtent):null}writeFullTimeExtent(e,t){null!=e?.start&&null!=e.end?t.timeExtent=e.toArray():t.timeExtent=null}readInterval(e,t){return t.timeInterval&&t.timeIntervalUnits?h(t.timeInterval,t.timeIntervalUnits):t.defaultTimeInterval&&t.defaultTimeIntervalUnits?h(t.defaultTimeInterval,t.defaultTimeIntervalUnits):null}writeInterval(e,t){t.timeInterval=e?.toJSON().value??null,t.timeIntervalUnits=e?.toJSON().unit??null}};(0,i._)([(0,o.MZ)({type:Boolean,json:{name:"exportOptions.timeDataCumulative",write:!0}})],y.prototype,"cumulative",void 0),(0,i._)([(0,o.MZ)({type:String,json:{name:"endTimeField",write:{enabled:!0,allowNull:!0}}})],y.prototype,"endField",void 0),(0,i._)([(0,o.MZ)({type:u.A,json:{write:{enabled:!0,allowNull:!0}}})],y.prototype,"fullTimeExtent",void 0),(0,i._)([(0,a.w)("fullTimeExtent",["timeExtent"])],y.prototype,"readFullTimeExtent",null),(0,i._)([(0,d.K)("fullTimeExtent")],y.prototype,"writeFullTimeExtent",null),(0,i._)([(0,o.MZ)({type:Boolean,json:{write:!0}})],y.prototype,"hasLiveData",void 0),(0,i._)([(0,o.MZ)({type:p.A,json:{write:{enabled:!0,allowNull:!0}}})],y.prototype,"interval",void 0),(0,i._)([(0,a.w)("interval",["timeInterval","timeIntervalUnits","defaultTimeInterval","defaultTimeIntervalUnits"])],y.prototype,"readInterval",null),(0,i._)([(0,d.K)("interval")],y.prototype,"writeInterval",null),(0,i._)([(0,o.MZ)({type:String,json:{name:"startTimeField",write:{enabled:!0,allowNull:!0}}})],y.prototype,"startField",void 0),(0,i._)([(0,o.MZ)((0,c.P6)("timeReference",!0))],y.prototype,"timeZone",void 0),(0,i._)([(0,o.MZ)({type:String,json:{write:{enabled:!0,allowNull:!0}}})],y.prototype,"trackIdField",void 0),(0,i._)([(0,o.MZ)({type:Boolean,json:{name:"exportOptions.useTime",write:!0}})],y.prototype,"useTime",void 0),(0,i._)([(0,o.MZ)({type:[Date],json:{read:!1}})],y.prototype,"stops",void 0),y=(0,i._)([(0,l.$)("esri.layers.support.TimeInfo")],y);const f=y},17036:(e,t,r)=>{r.d(t,{p:()=>l});var i=r(44208),s=r(53966),n=r(20437),o=r(95466),a=r(30524);function l(){return{fields:{type:[n.A],value:null,set:function(e){if(e&&(0,i.A)("big-integer-warning-enabled")){const t=e.filter((e=>"big-integer"===e.type||"oid"===e.type&&(e.length||0)>=8));if(t.length){const e=t.map((e=>`'${e.name}'`)).join(", ");s.A.getLogger(this).warn("#fields",`Layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}') references big-integer field(s): ${e}, support for which is experimental. Only integers less than ${Number.MAX_SAFE_INTEGER} (Number.MAX_SAFE_INTEGER) are supported.`)}}this._set("fields",e)}},fieldsIndex:{readOnly:!0,get(){return o.A.fromLayer(this)}},outFields:{type:[String],json:{read:!1},set:function(e){this._userOutFields=e,this.notifyChange("outFields")},get:function(){const e=this._userOutFields;if(!e?.length)return null;if(e.includes("*"))return["*"];if(!this.fields)return e;for(const t of e){const r=this.fieldsIndex?.has(t);r||s.A.getLogger("esri.layers.support.fieldProperties").error("field-attributes-layer:invalid-field",`Invalid field ${t} found in outFields`,{layer:this,outFields:e})}return(0,a.DB)(this.fieldsIndex,e)}}}}},20557:(e,t,r)=>{r.d(t,{CW:()=>h,Fm:()=>l,JQ:()=>c,JZ:()=>b,ND:()=>f,R_:()=>o,U9:()=>p,fu:()=>s,nr:()=>y,oF:()=>n,rq:()=>d,z$:()=>u});const i=[["binary","application/octet-stream","bin",""]];function s(e,t){return null!=g(t.name,e?.supportedFormats??[])}function n(e,t){if(!e)return!1;const r=d(t,e.supportedFormats??[]);return null!=r&&e.editFormats.includes(r)}function o(e,t){return v(function(e,t){const r=e.toLowerCase();return m(t).find((e=>w(e)===r))}(e,t))}function a(e,t){return v(g(e,t))}function l(e,t){return w(function(e,t){return m(t).find((t=>v(t)===e))}(e,t))}function d(e,t){return a(e.name,t)??o(e.type,t)}function u(e,t,r){return o(e,r)??a(t,r)}function p({supportedFormats:e}){return u("model/gltf-binary","glb",e)}function c(e){const t=p(e);return null!=t&&e.editFormats.includes(t)}function h({supportedFormats:e}){return u("model/gltf+json","gltf",e)}function y({supportedFormats:e}){return u("application/esri3do-SR_world","wld",e)}function f({supportedFormats:e}){return u("application/esri3do-SR_prj","prj",e)}function m(e){return[...i,...e]}function g(e,t){const r=e.toLowerCase();return m(t).find((e=>function(e){return e?.[2].split(",").map((e=>e.toLowerCase()))??[]}(e).some((e=>r.endsWith(e)))))}function v(e){return e?.[0]}function w(e){return e?.[1].toLowerCase()}function b(e){return e.tables?.find((e=>"assetMaps"===e.role))}},85648:(e,t,r)=>{r.d(t,{n:()=>s});var i=r(84952);function s(e){return n[function(e){return"json"===e.type?"application/json":"blob"===e.type?e.blob.type:function(e){const t=(0,i.Zo)(e);return l[t]||o}(e.url)}(e)]||a}const n={},o="text/plain",a=n[o],l={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpg",bmp:"image/bmp",gif:"image/gif",json:"application/json",txt:"text/plain",xml:"application/xml",svg:"image/svg+xml",zip:"application/zip",pbf:"application/vnd.mapbox-vector-tile",gz:"application/gzip","bin.gz":"application/octet-stream"};for(const e in l)n[l[e]]=e},73133:(e,t,r)=>{r.d(t,{j:()=>i});const i=(0,r(66552).O)()({esriTimeUnitsMilliseconds:"milliseconds",esriTimeUnitsSeconds:"seconds",esriTimeUnitsMinutes:"minutes",esriTimeUnitsHours:"hours",esriTimeUnitsDays:"days",esriTimeUnitsWeeks:"weeks",esriTimeUnitsMonths:"months",esriTimeUnitsYears:"years",esriTimeUnitsDecades:"decades",esriTimeUnitsCenturies:"centuries",esriTimeUnitsUnknown:void 0})},8947:(e,t,r)=>{r.d(t,{L:()=>o});var i=r(60999),s=r(74887),n=r(67076);async function o(e,t,r){const o=e&&e.getAtOrigin&&e.getAtOrigin("renderer",t.origin);if(o&&"unique-value"===o.type&&o.styleOrigin){const a=await(0,i.Ke)(o.populateFromStyle());if((0,s.Te)(r),!1===a.ok){const r=a.error;t?.messages&&t.messages.push(new n.A("renderer:style-reference",`Failed to create unique value renderer from style reference: ${r.message}`,{error:r,context:t})),e.clear("renderer",t?.origin)}}}},10184:(e,t,r)=>{r.d(t,{A:()=>c});var i=r(90237),s=r(69540),n=r(25482),o=r(88930),a=r(10107),l=(r(44208),r(53966),r(87811),r(93223)),d=r(40608),u=r(73133);let p=class extends((0,s.O)(n.oY)){constructor(e){super(e),this.unit="milliseconds",this.value=0}toMilliseconds(){return(0,o.t)(this.value,this.unit,"milliseconds")}};(0,i._)([(0,l.e)(u.j,{nonNullable:!0})],p.prototype,"unit",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{write:!0},nonNullable:!0})],p.prototype,"value",void 0),p=(0,i._)([(0,d.$)("esri.time.TimeInterval")],p);const c=p},20816:(e,t,r)=>{r.d(t,{TA:()=>s,We:()=>a,Z3:()=>n,ZJ:()=>l,w5:()=>d});var i=r(78888);const s=(0,r(13069).vD)(),n=new Map,o=new Map;async function a(e,t,r){if(!e||!r)return!1;if(!t)return!0;const s=new URL(e).host;let o=n.get(s);if(!o){const t=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,"");o=(await(0,i.A)(t,{responseType:"json",query:{f:"json"}})).data.defaultVersionName}return o===t}async function l(e,t,i=!1){if(!e||!t)return!0;const n=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),a=o.get(n)?.entries();if(a)for(const[e,o]of a)if(o.name===t){const t=!o.stack?.hasForwardEdits();if(!t&&i){const[{deleteForwardEdits:t},{default:i}]=await Promise.all([r.e(2186).then(r.bind(r,32186)),r.e(2558).then(r.bind(r,32558))]),a=await t(n,e,new i({sessionId:s,moment:o.moment}));return a.success&&o.stack?.clearForwardEdits(),a.success}return t}return!0}function d(e,t){if(!e)return!1;const r=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),i=o.get(r)?.entries();if(i)for(const[e,r]of i)if(r.name===t)return"edit"===r.lockType;return!1}new Map}}]);
|