@esri/solutions-components 5.1.0-next.95 → 5.1.0-next.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/cdn/{XAW6KPKL.js → 2BUUN32T.js} +1 -1
  2. package/dist/cdn/{ZGEMIOB5.js → 2NVL4Z5G.js} +1 -1
  3. package/dist/cdn/{WVRKV5SS.js → 3CDDDNHX.js} +1 -1
  4. package/dist/cdn/{4B7NJE47.js → 3EVMNCX6.js} +1 -1
  5. package/dist/cdn/{2VXTMCRJ.js → 3JQP6RGM.js} +1 -1
  6. package/dist/cdn/5K6B2WSQ.js +2 -0
  7. package/dist/cdn/{QYDGCI2P.js → 63RUMXWC.js} +1 -1
  8. package/dist/cdn/{UHPN75WT.js → 6HZIF7DC.js} +1 -1
  9. package/dist/cdn/{C7ASL3A4.js → 6ZRRFBIZ.js} +1 -1
  10. package/dist/cdn/{NPOHA56R.js → 7RK7YWYV.js} +1 -1
  11. package/dist/cdn/{4QZ7WHXA.js → AG22WAP3.js} +1 -1
  12. package/dist/cdn/{DI7PQSFH.js → AMEUOI76.js} +1 -1
  13. package/dist/cdn/{ZP6VPBP4.js → BGXRCU7G.js} +1 -1
  14. package/dist/cdn/{5OF3YOO7.js → BIVYOKLF.js} +1 -1
  15. package/dist/cdn/{WRSVJIPA.js → BSXTZCNH.js} +1 -1
  16. package/dist/cdn/DRXERUDE.js +2 -0
  17. package/dist/cdn/{3ZZ726LQ.js → DSLOJFRD.js} +1 -1
  18. package/dist/cdn/{5LTIZSXG.js → EN6E35NY.js} +1 -1
  19. package/dist/cdn/{FVXS4LF5.js → ESBPGZRY.js} +1 -1
  20. package/dist/cdn/{R3MCMOLS.js → EVEXF6IH.js} +2 -2
  21. package/dist/cdn/{55NRVFJ5.js → FZBIZBOO.js} +1 -1
  22. package/dist/cdn/{KYFNXHOH.js → G7N3V3YJ.js} +1 -1
  23. package/dist/cdn/{ELPH6EFW.js → I2GXCEQM.js} +1 -1
  24. package/dist/cdn/{4HPFDUTJ.js → IC2D4LPZ.js} +1 -1
  25. package/dist/cdn/{FGWGYIBZ.js → KLLT6LQO.js} +1 -1
  26. package/dist/cdn/{KW6YOUWC.js → MWMNRIUD.js} +1 -1
  27. package/dist/cdn/{CWXOH2PC.js → NBX7J6DU.js} +1 -1
  28. package/dist/cdn/{JC5EXPFH.js → NEM3F44J.js} +1 -1
  29. package/dist/cdn/{2HUG6L4M.js → OF33IXBV.js} +1 -1
  30. package/dist/cdn/{2O3HAXKG.js → OZE4W3UQ.js} +1 -1
  31. package/dist/cdn/PVM4ETZ7.js +2 -0
  32. package/dist/cdn/QADMFYXT.js +2 -0
  33. package/dist/cdn/QKJ4PGBO.js +2 -0
  34. package/dist/cdn/RTA6KNSK.js +2 -0
  35. package/dist/cdn/{SJCXI4TB.js → RX3VLQGY.js} +1 -1
  36. package/dist/cdn/{CHZWEULM.js → SAI5O6SI.js} +1 -1
  37. package/dist/cdn/{3J47AYBV.js → TRBSV6ZY.js} +100 -100
  38. package/dist/cdn/{5BU6XZAD.js → TTV5UYNT.js} +1 -1
  39. package/dist/cdn/{2B2ANB2N.js → U6CZXWSF.js} +1 -1
  40. package/dist/cdn/{GJTXLQOS.js → URVOLZIY.js} +1 -1
  41. package/dist/cdn/{XXT542UR.js → UYY6JODL.js} +1 -1
  42. package/dist/cdn/VFZ2J4EW.js +2 -0
  43. package/dist/cdn/VRM54VB2.js +2 -0
  44. package/dist/cdn/{IGSOHYV3.js → XGZCGPHU.js} +1 -1
  45. package/dist/cdn/{JJ7JB2ZP.js → Y5N6ESUO.js} +1 -1
  46. package/dist/cdn/YDNNXKDK.js +2 -0
  47. package/dist/cdn/{O3SWSZQE.js → ZKGLAGUM.js} +1 -1
  48. package/dist/cdn/ZPWKF5SM.js +2 -0
  49. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.en.json +1 -1
  50. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.json +1 -1
  51. package/dist/cdn/assets/solution-details-card/t9n/messages.ar.json +1 -1
  52. package/dist/cdn/assets/solution-details-card/t9n/messages.bg.json +1 -1
  53. package/dist/cdn/assets/solution-details-card/t9n/messages.bs.json +1 -1
  54. package/dist/cdn/assets/solution-details-card/t9n/messages.ca.json +1 -1
  55. package/dist/cdn/assets/solution-details-card/t9n/messages.cs.json +1 -1
  56. package/dist/cdn/assets/solution-details-card/t9n/messages.da.json +1 -1
  57. package/dist/cdn/assets/solution-details-card/t9n/messages.de.json +1 -1
  58. package/dist/cdn/assets/solution-details-card/t9n/messages.el.json +1 -1
  59. package/dist/cdn/assets/solution-details-card/t9n/messages.es.json +1 -1
  60. package/dist/cdn/assets/solution-details-card/t9n/messages.et.json +1 -1
  61. package/dist/cdn/assets/solution-details-card/t9n/messages.fi.json +1 -1
  62. package/dist/cdn/assets/solution-details-card/t9n/messages.fr.json +1 -1
  63. package/dist/cdn/assets/solution-details-card/t9n/messages.he.json +1 -1
  64. package/dist/cdn/assets/solution-details-card/t9n/messages.hr.json +1 -1
  65. package/dist/cdn/assets/solution-details-card/t9n/messages.hu.json +1 -1
  66. package/dist/cdn/assets/solution-details-card/t9n/messages.id.json +1 -1
  67. package/dist/cdn/assets/solution-details-card/t9n/messages.it.json +1 -1
  68. package/dist/cdn/assets/solution-details-card/t9n/messages.ja.json +1 -1
  69. package/dist/cdn/assets/solution-details-card/t9n/messages.ko.json +1 -1
  70. package/dist/cdn/assets/solution-details-card/t9n/messages.lt.json +1 -1
  71. package/dist/cdn/assets/solution-details-card/t9n/messages.lv.json +1 -1
  72. package/dist/cdn/assets/solution-details-card/t9n/messages.nl.json +1 -1
  73. package/dist/cdn/assets/solution-details-card/t9n/messages.no.json +1 -1
  74. package/dist/cdn/assets/solution-details-card/t9n/messages.pl.json +1 -1
  75. package/dist/cdn/assets/solution-details-card/t9n/messages.pt-BR.json +1 -1
  76. package/dist/cdn/assets/solution-details-card/t9n/messages.pt-PT.json +1 -1
  77. package/dist/cdn/assets/solution-details-card/t9n/messages.ro.json +1 -1
  78. package/dist/cdn/assets/solution-details-card/t9n/messages.ru.json +1 -1
  79. package/dist/cdn/assets/solution-details-card/t9n/messages.sk.json +1 -1
  80. package/dist/cdn/assets/solution-details-card/t9n/messages.sl.json +1 -1
  81. package/dist/cdn/assets/solution-details-card/t9n/messages.sr.json +1 -1
  82. package/dist/cdn/assets/solution-details-card/t9n/messages.sv.json +1 -1
  83. package/dist/cdn/assets/solution-details-card/t9n/messages.th.json +1 -1
  84. package/dist/cdn/assets/solution-details-card/t9n/messages.tr.json +1 -1
  85. package/dist/cdn/assets/solution-details-card/t9n/messages.uk.json +1 -1
  86. package/dist/cdn/assets/solution-details-card/t9n/messages.vi.json +1 -1
  87. package/dist/cdn/assets/solution-details-card/t9n/messages.zh-CN.json +1 -1
  88. package/dist/cdn/assets/solution-details-card/t9n/messages.zh-HK.json +1 -1
  89. package/dist/cdn/assets/solution-details-card/t9n/messages.zh-TW.json +1 -1
  90. package/dist/cdn/assets/solution-item-accordion/t9n/messages.en.json +1 -1
  91. package/dist/cdn/assets/solution-item-accordion/t9n/messages.json +1 -1
  92. package/dist/cdn/index.js +1 -1
  93. package/dist/chunks/cardFetchingUtils.js +1 -1
  94. package/dist/chunks/converter.js +5 -4
  95. package/dist/chunks/helpers.js +61 -39
  96. package/dist/chunks/solution-deploy-dialog.js +1 -1
  97. package/dist/chunks/solutions-deploy-app-nav.js +1 -1
  98. package/dist/components/arcgis-solutions-assistant/customElement.js +4962 -4647
  99. package/dist/components/solution-configure-titles/customElement.js +36 -38
  100. package/dist/components/solution-delete-dialog/customElement.js +49 -51
  101. package/dist/components/solution-deployed-card-panel/customElement.js +35 -38
  102. package/dist/components/solution-details-card/customElement.js +24 -32
  103. package/dist/components/solution-details-panel/customElement.js +1 -1
  104. package/dist/components/solution-item-accordion/customElement.d.ts +2 -0
  105. package/dist/components/solution-item-accordion/customElement.js +25 -32
  106. package/dist/components/solution-item-accordion/index.js +0 -1
  107. package/dist/components/solutions-all-panel/customElement.d.ts +2 -0
  108. package/dist/components/solutions-all-panel/customElement.js +48 -33
  109. package/dist/components/solutions-all-shell/customElement.js +94 -40
  110. package/dist/components/solutions-deployed-list/customElement.d.ts +9 -9
  111. package/dist/components/solutions-deployed-list/customElement.js +3 -3
  112. package/dist/components/solutions-deployed-panel/customElement.js +1 -1
  113. package/dist/components/solutions-deployed-shell/customElement.js +1 -1
  114. package/dist/docs/api.json +1 -1
  115. package/dist/docs/docs.json +1 -1
  116. package/dist/docs/vscode.html-custom-data.json +1 -1
  117. package/dist/docs/web-types.json +1 -1
  118. package/dist/loader.js +2 -2
  119. package/dist/solutions-components_commit.txt +5 -8
  120. package/dist/types/lumina.d.ts +1 -1
  121. package/dist/types/preact.d.ts +1 -1
  122. package/dist/types/react.d.ts +1 -1
  123. package/dist/types/stencil.d.ts +1 -1
  124. package/dist/utils/interfaces.d.ts +9 -1
  125. package/package.json +1 -1
  126. package/dist/cdn/2ID55IJB.js +0 -2
  127. package/dist/cdn/2SGR44DX.js +0 -2
  128. package/dist/cdn/74MDW73I.js +0 -2
  129. package/dist/cdn/ADPYDJG6.js +0 -2
  130. package/dist/cdn/AJZHT4GA.js +0 -2
  131. package/dist/cdn/ITLTQWCX.js +0 -2
  132. package/dist/cdn/IYUTLV2O.js +0 -2
  133. package/dist/cdn/K6WLYYPH.js +0 -2
  134. package/dist/cdn/R4VHCXKS.js +0 -2
  135. package/dist/cdn/X5EABWHE.js +0 -2
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import g from"./2NVL4Z5G.js";import e from"./7RK7YWYV.js";import d from"./BGXRCU7G.js";import c from"./UYY6JODL.js";import b from"./QKJ4PGBO.js";import{b as x}from"./2B4SGB3I.js";import{b as w}from"./YKQDHR27.js";import"./J75MHJID.js";import{a as v}from"./R67EKKSL.js";import"./BVWAUO73.js";import"./K3DQKY7V.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import{b as f}from"./KIUBUHVM.js";import{G as S,h as y,i as a,j as C,q as h}from"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([{n:T,q:b},,{g:I,h:A,k:D,l:u,o:_},{c:E},{a:g,b:L}])=>{var O=y`calcite-panel{width:100%;height:100%;--calcite-panel-background-color: var(--calcite-color-surface-3)}.card-group{overflow:hidden;padding:.25rem var(--calcite-spacing-md) var(--calcite-spacing-md)}solution-details-card{width:calc(25% - .6rem)}@container (max-width: 1234px){solution-details-card{width:calc(33.333% - .6rem)}}@container (max-width: 1010px){solution-details-card{width:calc(50% - .6rem)}}@container (max-width: 800px){.card-group{padding-left:0;padding-right:0}solution-details-card{width:calc(33.33% - .6rem)}}@container (max-width: 680px){solution-details-card{width:calc(50% - .6rem)}}@container (max-width: 440px){solution-details-card{width:calc(100% - .75rem)}}.text-center{text-align:center}.leader-1{margin-top:var(--calcite-spacing-xxl)}.trailer-1{margin-bottom:var(--calcite-spacing-xxl)}.warning-text{max-width:35em;margin-left:auto;margin-right:auto;font-size:var(--calcite-font-size-md)}.no-solutions{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;min-height:calc(100vh - 190px)}.margin-top-half{margin-top:.5rem}.margin-top-1{margin-top:1rem}.no-solutions-prompt{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}`,F=5,p=class extends S{constructor(){super(),this.sortType="relevance",this._cards=[],this._isLoading=!0,this._modifiedCheckTry=0,this._translations=v({name:"solutions-all-panel",blocking:!0}),this._agoTerms=`${u}`,this._allCards=[],this._baseAgoTerms=u,this._categories=[],this._configContextConsumer=w({context:x,subscribe:!0,callback:async t=>{t&&(this._isDisconnectedEnvironment?this._isLoading=!1:await this._loadUpdateProcedures())}}),this._delay=!1,this._getSuggested=!1,this._relatedSolutions=new Set,this._sortField="relevance",this._sortOrder="desc",this._assistantSolutionIds=new Set,this.cardsFetched=h(),this.allCardsFetched=h(),this.searchTermSet=h(),this.sortTypeSet=h(),this.detailsCardSelected=h(),this._handleOpenAssistant=()=>{this._telemetry?.logEvent({category:_.ASSISTANT,action:"Open"}),window.dispatchEvent(new CustomEvent("openAssistant"))},this.listenOn(window,"deployProgressEnd",()=>{this._modifiedCheckTry=F,this._loadUpdateProcedures()}),this.listenOn(window,"solutionDeleted",()=>{this._modifiedCheckTry=F,this._loadUpdateProcedures()}),this.listenOn(window,"sortTypeChanged",t=>{t.detail&&t.detail.scope==="all-solutions"&&(this.sortType=t.detail.sortType,this._telemetry?.logEvent({category:_.ALL_SOLUTIONS,action:"Sort",dimensions:[T(t.detail.sortType)]}),this.sortType==="suggested"&&this._deployedSolutions?.cards.length===0?this._getDeployedSolutions().then(()=>{this.searchSolutions(t.detail)}):this.searchSolutions(t.detail))}),this.listenOn(window,"solutionIDFromAssistant",t=>{this._lookupSolutionById(t.detail)}),this.listenOn(window,"solutionMatchesFromAssistant",t=>{this._applyAssistantSolutionMatches(t.detail)})}static{this.properties={sortType:1,_cards:16,_isLoading:16,_modifiedCheckTry:16,_translations:16}}static{this.styles=O}get _isEnterprise(){return this._configContextConsumer.value?.isEnterprise}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}get _isDisconnectedEnvironment(){return this._configContextConsumer.value?.isEnterprise===!0&&this._configContextConsumer.value?.authentication?.CanSearchArcGISOnline===!1}async searchSolutions(t){this._isDisconnectedEnvironment||(t?"searchTerm"in t?this._textSearch(t.searchTerm):"sortType"in t?this._sortCards(t):Array.isArray(t)&&this._filterCards(t):(this._agoTerms=this._baseAgoTerms,this._clearFilterCategories()),this._cards=await this._getSolutions())}async setSearchOptions(t){t&&("searchTerm"in t&&(this._textSearch(t.searchTerm),this.searchTermSet.emit({searchTerm:t.searchTerm,scope:"all-solutions"})),"sortType"in t&&(this._sortCards(t),this.sortTypeSet.emit({sortType:t.sortType,scope:"all-solutions"})))}getDisplayedSolutionIds(){return this._cards.map(t=>t.deployCommonId)}render(){let t=this._configContextConsumer.value?.authentication?.IsSignedIn&&this._configContextConsumer.value?.authentication?.CanUseAI;return this._isDisconnectedEnvironment?a`<div class="no-solutions">${this._getMeridianSearch()}<div class="no-solutions-prompt"><div class="text-center leader-1 warning-text trailer-1"><div>${this._translations.disconnectedEnvironment}</div></div></div></div>`:this._isLoading||this._cards.length?a`<calcite-panel>${this._isLoading?a`<calcite-loader id=solutions-all-panel-loader .label=${this._translations.fetchingSolutions}></calcite-loader>`:a`<calcite-card-group class="card-group" .label=${this._translations.allSolutionCards}>${this._renderCards()}</calcite-card-group>`}</calcite-panel>`:a`<div class="no-solutions">${this._getMeridianSearch()}<div class="no-solutions-prompt"><div class="text-center leader-1 warning-text trailer-1"><div>${this._translations.noSolutionsFound}</div><div class="margin-top-half">${!this._isEnterprise&&t?this._translations.assistantHelp:this._translations.changeSearchTerm}</div></div>${!this._isEnterprise&&t&&a`<calcite-button appearance=outline icon-start=speech-bubbles @click=${this._handleOpenAssistant} @keydown=${e=>b(e,()=>this._handleOpenAssistant())} scale=l>${this._translations.askAssistant}</calcite-button>`||""}</div></div>`}_renderCards(){return this._cards.map(t=>a`<solution-details-card .card=${t}></solution-details-card>`)}async _getSolutions(){if(this._isDisconnectedEnvironment)return this._isLoading=!1,[];if(this._configContextConsumer.value){this._isLoading=!0,this._abortController?(this._abortController.abort(),this._abortController=new AbortController):this._abortController=new AbortController;let t=await this._cardsFetcher?.requestAvailableSolutionCards({q:this._agoTerms,filter:"type:Solution",sortField:this._sortField,sortOrder:this._sortOrder,nextStart:-1,categories:this._categories,delay:this._delay,getSuggested:this._getSuggested,num:100},this._configContextConsumer.value?.primarySolutionsGroupId,this._configContextConsumer.value?.agoBasedEnterpriseSolutionsGroupId,this._configContextConsumer.value?.userSession,this._configContextConsumer.value?.isEnterprise,this._abortController.signal,{num:1e3});this._abortController=void 0;let e=t?.cards.length?t.cards:[];if(this.sortType==="new"||this.sortType==="updated"){let s="/Categories/New Release";this.sortType==="updated"&&(s="/Categories/Updated"),e.sort((l,d)=>l.categories.includes(s)&&!d.categories.includes(s)?-1:!l.categories.includes(s)&&d.categories.includes(s)?1:l.categories.includes(s)&&d.categories.includes(s)?l.categories.length-d.categories.length:0)}else if(this.sortType==="suggested"&&this._relatedSolutions.size>0&&this._deployedSolutions?.cards?.length){let s=new Map;for(let i of e){let n=s.get(i.deployCommonId),r=Number(i.deployVersion);(!n||r>n)&&s.set(i.deployCommonId,r)}let l=this._deployedSolutions.cards.filter(i=>{let n=s.get(i.deployCommonId);return n!==void 0&&Number(i.deployVersion)>=n}),d=new Set(l.map(i=>i.deployCommonId));this._relatedSolutions=new Set([...this._relatedSolutions].filter(i=>!d.has(i))),e.sort((i,n)=>{let r=this._relatedSolutions.has(i.deployCommonId),m=this._relatedSolutions.has(n.deployCommonId);return r&&!m?-1:!r&&m?1:0})}let o=e.map(s=>{let l=s.categories.indexOf("/Categories/New Release")>-1,d=s.categories.indexOf("/Categories/Updated")>-1,i=!1,n=!0;this._deployedSolutions&&(i=this._isSolutionDeployed(s.deployCommonId),n=this._isLatestVersion(s));let r=[];return l?r.push("new"):d&&r.push("updated"),i&&(n?r.push("deployed"):r.push("deployedOlderVersion")),s.chips=r.length>0?r:void 0,s.supportReuse=i?!!(i&&!n):!0,s});this._allCards.length===0&&t?.cards&&(this._allCards=t?.cards,this._deployedSolutions&&(this._relatedSolutions=E(this._deployedSolutions.cards,this._allCards)));let c=this._assistantSolutionIds.size>0?o.filter(s=>this._assistantSolutionIds.has(s.deployCommonId)):o;return this.cardsFetched.emit(c.length),this._isLoading=!1,c}else return this._isLoading=!1,[]}async _loadUpdateProcedures(){if(this._isDisconnectedEnvironment){this._isLoading=!1;return}this._isLoading=!0;let t=this._configContextConsumer.value;this._cardsFetcher=new g(t.locale,t.orgUrl,t.portalURL),this._cardsFetcherDeployed=new g(t.locale,t.orgUrl,t.portalURL),await this._getDeployedSolutions(),this._cards=await this._getSolutions(),this.allCardsFetched.emit(this._cards),this._isLoading=!1}async _getDeployedSolutions(){let t=this._configContextConsumer.value.authentication,e=this._configContextConsumer.value.userSession;if(t&&e&&t.IsSignedIn){this._abortControllerDeployed?(this._abortControllerDeployed.abort(),this._abortControllerDeployed=new AbortController):this._abortControllerDeployed=new AbortController;let o=await L(t,e,this._cardsFetcher,this._cardsFetcherDeployed,D,"created",this._sortOrder,void 0,this._categories,void 0,this._abortControllerDeployed.signal);if(this._abortControllerDeployed=void 0,o){if(this._modifiedCheckTry>0){if(this._deployedSolutions?.cards.length===o?.cards.length)return this._modifiedCheckTry--,await this._getDeployedSolutions();this._modifiedCheckTry=0}this._deployedSolutions=o}}}_getMeridianSearch(){return a`<div><svg viewBox="0 0 64 64" width=140 height=140 xmlns=http://www.w3.org/2000/svg fill=var(--calcite-color-text-3)>${C`<path d="M60.217 54.937l-15.77-15.77-1.414 1.415-3.801-3.8a19.94 19.94 0 1 0-2.451 2.45l3.802 3.802-1.413 1.415 15.767 15.767a1.739 1.739 0 0 0 2.459 0l2.82-2.821a1.742 1.742 0 0 0 0-2.458zM4.9 24A19.1 19.1 0 1 1 24 43.1 19.121 19.121 0 0 1 4.9 24zm32.474 14.693q.69-.63 1.32-1.32l3.774 3.775-1.32 1.32zM59.65 56.83l-2.82 2.82a.97.97 0 0 1-1.327 0L40.3 44.45l4.145-4.15L59.65 55.501a.939.939 0 0 1 0 1.328zM22.343 9.62l.097.795q-.31.038-.619.086a13.635 13.635 0 0 0-11.353 11.775l-.026.217-.795-.084.026-.228a14.44 14.44 0 0 1 12.022-12.47c.215-.034.431-.064.648-.09z" />`}</svg></div>`}_textSearch(t){this._agoTerms=this._baseAgoTerms+` ${t}`}_sortCards(t){let e=t.sortType;this._getSuggested=!1,this._sortOrder="desc",e==="suggested"?this._getSuggested=!0:e==="new"?this._sortField="relevance":e==="relevance"||e==="title"?(e==="title"&&(this._sortOrder="asc"),this._sortField=e):e==="updated"&&(this._sortField="relevance"),this.sortType=e}_filterCards(t){this._categories=[],t.forEach(e=>{if(e.industry){let o=this._getIndustryValue(e.industry);if(e.domain){let c=this._getDomainValue(e.domain);this._categories.push(`/Categories/${o}/${c}`)}else this._categories.push(`/Categories/${o}`)}})}_getDomainValue(t){return A[t]}_getIndustryValue(t){return t==="AEC"?"AEC":I[t]}_clearFilterCategories(){this._categories=[]}_isSolutionDeployed(t){return!!this._deployedSolutions?.cards?.some(e=>e?.typeKeywords?.some(o=>o.includes("solutionid")&&o.includes(t)))}_isLatestVersion(t){let e=this._deployedSolutions?.cards?.filter(o=>o?.typeKeywords?.some(c=>c.includes("solutionid")&&c.includes(t.deployCommonId)));return!(e&&e.length>0&&e[0].deployVersion!==t.deployVersion)}_lookupSolutionById(t){let e=this._allCards.filter(o=>o.deployCommonId===t);e.length>0&&this.detailsCardSelected.emit(e[0])}async _applyAssistantSolutionMatches(t){let e=Array.isArray(t?.solutionIds)?t.solutionIds.filter(Boolean):[];if(this._agoTerms=this._baseAgoTerms,this._clearFilterCategories(),this._getSuggested=!1,this._assistantSolutionIds=new Set(e),this._allCards.length===0){await this._loadUpdateProcedures();return}this._cards=await this._getSolutions()}};f("solutions-all-panel",p);return p},b,c,d,e,g)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import c from"./JC5EXPFH.js";import b from"./XXT542UR.js";import a from"./X5EABWHE.js";import"./2B4SGB3I.js";import"./YKQDHR27.js";import"./J75MHJID.js";import"./R67EKKSL.js";import"./BVWAUO73.js";import"./K3DQKY7V.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import"./KIUBUHVM.js";import"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
2
+ import c from"./NEM3F44J.js";import b from"./UYY6JODL.js";import a from"./QKJ4PGBO.js";import"./2B4SGB3I.js";import"./YKQDHR27.js";import"./J75MHJID.js";import"./R67EKKSL.js";import"./BVWAUO73.js";import"./K3DQKY7V.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import"./KIUBUHVM.js";import"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import b from"./DI7PQSFH.js";import"./ZYCAAXQF.js";import"./FVXS4LF5.js";import a from"./X5EABWHE.js";import"./2B4SGB3I.js";import"./YKQDHR27.js";import"./J75MHJID.js";import"./R67EKKSL.js";import"./BVWAUO73.js";import"./K3DQKY7V.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import"./KIUBUHVM.js";import"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([,{c:o}])=>{return o},a,b)
2
+ import b from"./AMEUOI76.js";import"./ZYCAAXQF.js";import"./ESBPGZRY.js";import a from"./QKJ4PGBO.js";import"./2B4SGB3I.js";import"./YKQDHR27.js";import"./J75MHJID.js";import"./R67EKKSL.js";import"./BVWAUO73.js";import"./K3DQKY7V.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import"./KIUBUHVM.js";import"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([,{c:o}])=>{return o},a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import h from"./NBPM6OJQ.js";import{a as H}from"./BU5PIAGS.js";import e from"./ZP6VPBP4.js";import d from"./X5EABWHE.js";import c from"./CEP54NLT.js";import a from"./YVNP437O.js";import{a as S}from"./R67EKKSL.js";import{b as E}from"./KIUBUHVM.js";import{E as g,F as f,G as x,I as b,h as v,i as o,l as _,q as p,t as T}from"./H5E6ISYP.js";export default $arcgis.t(([L,c,M,w,{c:O},{c:C,d:A,j:y},{l:F},{f:m},{b:$}])=>{var R=v`@layer{:host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.display-none{display:none}.table-border{border:1px solid var(--calcite-color-border-2)}.border-end{border-inline-end:1px solid var(--calcite-color-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51-px{height:51px}.height-50-px{height:50px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir=rtl] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-color-surface-1)}.text-color{color:var(--calcite-color-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-color-status-danger)}.esri-feature-table vaadin-grid{border:none!important}vaadin-grid-cell-content{font-size:14px!important;color:var(--calcite-color-text-3)!important}.absolute-right{position:absolute;right:0;left:unset}html[dir=rtl] .absolute-right{left:0;right:unset}.disabled{cursor:default!important;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.actions-end{height:50px!important;display:inline-flex}.border-top{border-top:1px solid var(--calcite-color-border-2)}.modal{--calcite-dialog-content-space: 0}.esri-feature-table__table-container{height:100%}.search-container{background-color:var(--calcite-color-surface-2)!important}.search{--calcite-color-border-input: var(--calcite-color-border-3);width:60%;padding:10px}.delete-red{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-color-text-1: var(--calcite-color-status-danger);--calcite-color-text-3: var(--calcite-color-status-danger)}.label-override{white-space:nowrap}.padding-start-1-4{padding-inline-start:.5rem}.panel-header-override{--calcite-panel-header-content-space: 0px}.danger-label-color{color:var(--calcite-color-status-danger)}.danger-icon-color{--calcite-icon-color: var(--calcite-color-status-danger)}.width-51{width:51px}.height-51{height:51px}calcite-action-bar{--calcite-internal-action-bar-gap: 0px;--calcite-internal-action-bar-padding: 0px}}`,I=class extends x{constructor(){super(),this.defaultGlobalId=[],this.defaultLayerId="",this.defaultOid=[],this.enableAutoRefresh=!1,this.enableColumnReorder=!0,this.enableCSV=!1,this.enableInlineEdit=!1,this.enableShare=!1,this.enableTableAutosave=!0,this.featureSelectionMode="multiple",this.selectedRelatedIds=[],this.honorMapFieldSettings=!1,this.isMobile=!1,this.mapHidden=!1,this.showOnlyUpdatableLayers=!1,this.selectedIds=[],this.shareIncludeEmbed=!1,this.shareIncludeSocial=!1,this.showNewestFirst=!1,this.zoomAndScrollToSelected=!1,this._allIds=[],this._configLayerOrderDefined=!1,this._csvExporting=!1,this._fetchingData=!1,this._hideTable=!1,this._filterActive=!1,this._selectAllActive=!1,this._showHideOpen=!1,this._showOnlySelected=!1,this._toolInfos=[],this._translations=S({name:"layer-table",blocking:!0}),this._fullTextSearchInfo=[],this._searchPlaceHolder="",this._size=0,this._queryingData=!1,this._editEnabled=!1,this._enabledLayerIds=[],this._defaultGlobalIdHonored=!1,this._defaultOidHonored=!1,this._deleteEnabled=!1,this._floorExpression="",this._floorField="",this._floorLevel="",this._loaded=!1,this._shareNode=g(),this._toolbar=g(),this._searchExpression="",this._skipEditCheck=!1,this._tempSelectedIds=[],this._outOFExtentOids=[],this._shouldUpdateTableOnExtentChange=!0,this._creatingFeature=!1,this._searchNode=g(),this.columnReorder=p(),this.featureSelectionChange=p(),this.toggleFilter=p(),this.showDelete=p(),this.relatedRecordToggled=p(),this.editMultipleFeatures=p(),this.listenOn(window,"beforeMapInfoChange",this.beforeMapInfoChange,{capture:!0}),this.listenOn(window,"editorInitialized",this.editorInitialized),this.listenOn(window,"closeEdit",this.closeEdit),this.listenOn(window,"selectionChanged",this.selectionChanged),this.listenOn(window,"beforeLayerSelectionChange",this.beforeLayerSelectionChange),this.listenOn(window,"layerSelectionChange",this.layerSelectionChange),this.listenOn(window,"editsComplete",this.editsComplete),this.listenOn(window,"facilityChanged",this.facilityChanged),this.listenOn(window,"levelChanged",this.levelChanged),this.listenOn(window,"siteChanged",this.siteChanged),this.listenOn(window,"noLayersFound",this.noLayersFound),this.listenOn(window,"clearSelection",this.clearSelection),this.listenOn(window,"mapChanged",this.mapChanged),this.listenOn(window,"featuresSelected",this.featuresSelected),this.listenOn(window,"createWorkFlowStarted",this.createWorkFlowStarted),this.listenOn(window,"backFromCreateWorkFlow",this.backFromCreateWorkFlow),H(window)}static{this.properties={appLayout:1,defaultGlobalId:0,defaultLayerId:1,defaultOid:0,enableAutoRefresh:5,enableColumnReorder:5,enableCSV:5,enableInlineEdit:5,enableShare:5,enableTableAutosave:5,featureSelectionMode:1,selectedRelatedIds:0,honorMapFieldSettings:5,isMobile:5,mapHidden:5,mapInfo:0,mapView:0,showOnlyUpdatableLayers:5,selectedIds:0,shareIncludeEmbed:5,shareIncludeSocial:5,showNewestFirst:5,zoomAndScrollToSelected:5,zoomToScale:9,_allIds:16,_configLayerOrderDefined:16,_csvExporting:16,_fetchingData:16,_hideTable:16,_filterActive:16,_layer:16,_selectAllActive:16,_showHideOpen:16,_showOnlySelected:16,_toolInfos:16,_translations:16,_fullTextSearchInfo:16,_searchPlaceHolder:16,_size:16,_queryingData:16}}static{this.styles=R}static{this.shadowRootOptions=T}willUpdate(e){if(e.has("appLayout")&&this.appLayoutWatchHandler(),e.has("defaultOid")&&this.defaultOidWatchHandler(),e.has("defaultGlobalId")&&this.defaultGlobalIdWatchHandler(),e.has("enableCSV")&&this.enableCSVWatchHandler(),e.has("enableInlineEdit")&&this.enableInlineEditWatchHandler(),e.has("mapHidden")&&this.mapHiddenWatchHandler(),e.has("isMobile")&&this.isMobileWatchHandler(),e.has("mapInfo")&&this.mapInfoWatchHandler(),e.has("mapView")&&this.mapViewWatchHandler(),e.has("_layer")&&this._layerWatchHandler(),e.has("selectedIds")&&(this.hasUpdated||JSON.stringify(e.get("selectedIds"))!==JSON.stringify(this.selectedIds))&&this.selectedIdsWatchHandler(),e.has("selectedRelatedIds")&&(this.hasUpdated||JSON.stringify(e.get("selectedRelatedIds"))!==JSON.stringify(this.selectedRelatedIds))&&this.selectedRelatedIdsWatchHandler(),e.has("enableTableAutosave")&&this.hasUpdated&&this._table&&(this._table.autoSaveEnabled=this.enableTableAutosave),e.has("_translations")){let t=this._translations._lang,i=e.get("_translations")?._lang;t&&i&&t!==i&&this._initToolInfos()}}async appLayoutWatchHandler(){await this._initToolInfos(),this._updateShareUrl()}async defaultOidWatchHandler(){await this._handleDefaults()}async defaultGlobalIdWatchHandler(){await this._handleDefaults()}async enableCSVWatchHandler(){this._toolInfos?.length>0&&await this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}async mapHiddenWatchHandler(){this._toolInfos?.length>0&&await this._initToolInfos()}async isMobileWatchHandler(){!this._toolInfos&&!this.isMobile&&await this._initToolInfos()}async mapInfoWatchHandler(){this._configLayerOrderDefined="configLayerOrder"in(this.mapInfo?.layerOptions||{}),this._enabledLayerIds=F(this.mapInfo?.layerOptions?.layers||[],this.mapInfo?.layerOptions?.configLayerOrder),this._table&&(this._resetColumnTemplates(),this._sortTable(),await this._initToolInfos())}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._floorExpression="",this._searchExpression="undefined",this.mapView.highlights=[{name:"default",color:"#00FFFF"},{name:"current-selection",color:"#ff00ff"},{name:"temporary",color:"#FFFF00"}],this._updateShareUrl(),this._mapClickHandle=c.on(()=>this.mapView,"click",e=>{this._creatingFeature||this._mapClicked(e)}))}async _layerWatchHandler(){if(this._hideTable=!1,this._fetchingData=!0,!this._layer){this._fetchingData=!1,this._hideTable=!0;return}try{await this._layer.when(),this._floorField=this._layer.floorInfo?.floorField||"",this._updateFloorDefinitionExpression(),await this._resetTable(),this._updateShareUrl()}catch(e){console.error(e),this._hideTable=!0}finally{this._fetchingData=!1}}async selectedIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions(),this._selectAllActive&&this.selectedIds.length!==this._allIds.length&&(this._selectAllActive=!1),this.selectedIds.length>0&&(this._table.rowHighlightIds.removeAll(),this._table.rowHighlightIds.add(this.selectedIds[0])),this.selectedIds.length===0&&setTimeout(()=>{this.featureSelectionChange.emit(this.selectedIds)},700)}async selectedRelatedIdsWatchHandler(){this._validateEnabledActions(),this.selectedRelatedIds.length>0&&(this._relatedFeatureTable?.rowHighlightIds.removeAll(),this._relatedFeatureTable?.rowHighlightIds.add(this.selectedRelatedIds[0]))}async closeFilter(){await this._closeFilter()}async filterReset(){this._filterByExtentHandle&&(this._table&&(this._table.filterGeometry=void 0),this._filterByExtentHandle.remove(),this._filterByExtentHandle=void 0),await this._handleFilterListReset()}async filterUpdate(e,t){await this._handleFilterUpdate(e),t?(this._shouldUpdateTableOnExtentChange=!0,this._handleTableOnMapExtent()):t===!1&&(this._table&&(this._table.filterGeometry=void 0),this._filterByExtentHandle?.remove(),this._filterByExtentHandle=void 0,await this._updateAllIds())}async validateTableUpdate(e){this._shouldUpdateTableOnExtentChange=e}async validateActiveEdits(){return this._validateActiveEdits([],this.selectedIds)}async refresh(){this._table&&await this._refresh()}async setColumnOrder(e){this._setColumnTemplates(e)}async beforeMapInfoChange(e){let t=e.detail.ref,i=e.detail.mapInfo;if(this._hasPendingEdits()){e.preventDefault();let s=await this._validateActiveEdits([],this.selectedIds);await t.setMapByID(s?i.id:e.detail.currentId,!s)}}async editorInitialized(e){this._shouldUpdateTableOnExtentChange=!1,this._editor=e.detail}async closeEdit(){this._shouldUpdateTableOnExtentChange=!0,this._filterByExtentHandle&&this._handleTableOnMapExtent()}async selectionChanged(e){let t=e.detail.selectedFeature[0],i=Number(t.getObjectId()),s=this._table;if(s.rowHighlightIds.length&&s.rowHighlightIds.removeAll(),s.rowHighlightIds.add(i),this._highlightFeatures(i),this.zoomAndScrollToSelected&&s&&this.mapView){let a=s.viewModel.getObjectIdIndex(i);s.scrollToIndex(a);let l=t.layer,h=this.mapView.allLayerViews.toArray(),n;h.some(async r=>r.layer.title===l?.title&&r.layer.type==="feature"?(n=r,this.mapView&&await y([i],n,this.mapView,!0,void 0,this.zoomToScale),!0):!1)}}async beforeLayerSelectionChange(e){if(this._hasPendingEdits()){e.preventDefault();let t=e.detail.ref,i=await this._validateActiveEdits([],this.selectedIds);return e.detail.selectedIds?await t.setLayerByIds(i?e.detail.newIds:e.detail.currentIds,!0):await t.setLayerById(i?e.detail.newId:e.detail.currentId,!0)}}async layerSelectionChange(e){await this._layerSelectionChanged(e)}async editsComplete(e){let t=e.detail;(t==="delete"||t==="add")&&(this._allIds=await this.queryAllIds()),await this._refresh()}async facilityChanged(e){this._updateFloorDefinitionExpression()}async levelChanged(e){this._floorLevel=e.detail,this._updateFloorDefinitionExpression()}async siteChanged(e){this._updateFloorDefinitionExpression()}async noLayersFound(){this._layer=void 0,this._allIds=[],this._size=0,this._clearSelection()}async clearSelection(){await this._validateActiveEdits([],this.selectedIds)&&this._clearSelection()}async mapChanged(){this._queryingData=!1,this._creatingFeature=!1,this._clearSelection()}async featuresSelected(e){e.detail.forEach(t=>{let i=this._table?.highlightIds.indexOf(t);i&&i<0&&this._table?.highlightIds.add(t)})}createWorkFlowStarted(){this._creatingFeature=!0}backFromCreateWorkFlow(){this._creatingFeature=!1}async load(){await this._initToolInfos()}render(){let e=this._fetchingData||this._hideTable?"display-none":"",t=this._fetchingData?"":"display-none",i=this._queryingData?"":"display-none",s=this._size.toString(),a=this.selectedIds.length.toString(),l=this.isMobile?"height-full":"height-full-adjusted",h=this._canShowFullTextSearch();return this._validateActiveActions(),o`<div><calcite-scrim class=${b(i)} .loading=${this._queryingData}></calcite-scrim><calcite-shell><div class=${`width-full ${l}`}><calcite-panel class="height-full width-full panel-header-override">${this._getMapLayerPicker("header-actions-start")}${!this.isMobile&&o`${this._getTableControlRow("header-content")}${this._getActionsEnd("header-actions-end")}`||""}${h&&o`<div class="search-container border-bottom"><calcite-input class=search clearable icon=search @calciteInputChange=${n=>{this._searchTextChanged(n)}} .placeholder=${this._searchPlaceHolder} title=${this._searchPlaceHolder??_} type=search ${f(this._searchNode)}></calcite-input></div>`||""}<calcite-loader class=${b(t)} .label=${this._translations.fetchingData} scale=l></calcite-loader><div class=${b(e)} ${f(this.onTableNodeCreate)}></div></calcite-panel></div>${this.isMobile?void 0:o`<div class="bottom-left text-color height-19" id=solutions-selected-count-div>${(this._translations.recordsTotal?.replace("{{total-number-of-records}}",s)+" | "+this._translations.recordsSelected.replace("{{selected-number-of-records}}",a)).replace("{{total}}",s).replace("{{selected}}",a)}</div>`}</calcite-shell></div>`}updated(){this._table&&this.updateRelatedAttachmentColumns()}async _searchTextChanged(e){this._fullTextSearchInfo.forEach(t=>{t.searchTerm=e.target.value}),this._searchFullText()}async _searchFullText(){let e=[],t=!1;if(this._showOnlySelected)e=this._tempSelectedIds,t=!0;else if(await this._validateActiveEdits([],this.selectedIds))this._clearSelection(),this._tempSelectedIds=[];else return;this._searchExpression&&this._clearSearchDefinitionExpression();let i=[];if(this._fullTextSearchInfo?.length&&this._fullTextSearchInfo[0].searchTerm){let s=this._layer?.createQuery();s.fullText=this._fullTextSearchInfo,i=this._layer?await this._layer.queryObjectIds(s):[],t&&e?.length&&(i=i.filter(a=>e.includes(a))),await this._updateSearchDefinitionExpression(i?.length?i:[-1])}t&&i?.length&&(this._showOnlySelected=!0,this._table?.highlightIds.addMany(i.reverse())),await new Promise(s=>setTimeout(s,800)),await this._updateAllIds()}_clearSearchDefinitionExpression(){let e=this._layer?.definitionExpression;this._searchExpression&&e&&e?.indexOf(this._searchExpression)>-1&&this._layer&&(e?.indexOf(" AND ("+this._searchExpression)>-1?this._layer.definitionExpression=e.replace(` AND (${this._searchExpression})`,""):this._layer.definitionExpression=e.replace(this._searchExpression,"")),this._searchExpression=""}async _updateSearchDefinitionExpression(e){let t=this._layer?.definitionExpression;if(this._layer)if(e?.length){let i=`objectId in(${e})`;this._layer.definitionExpression=this._searchExpression&&t&&t.includes(this._searchExpression)?t.replace(this._searchExpression,i):t?`${t} AND (${i})`:i,this._searchExpression=i}else this._clearSearchDefinitionExpression()}_canShowFullTextSearch(){return this._layer?.capabilities?.query?.supportsFullTextSearch&&this._layer.indexes.items.filter(e=>e.indexType=="FullText").length>0}_getFullTextSearchInfo(){if(this._fullTextSearchInfo=[],this._layer?.capabilities?.query?.supportsFullTextSearch){let e=this._layer.indexes?.filter(t=>t.indexType=="FullText");if(e?.length){let t=[];e.forEach(s=>{t.push(...s.fields.split(","))});let i=[];t.forEach(s=>{let a=this._layer?.getField(s.trim());a?.alias&&i.push(a.alias)}),this._searchPlaceHolder=this._translations.searchPlaceholder.replace("{{field_names}}",i.join(", ")),this._fullTextSearchInfo.push({onFields:["*"],searchTerm:"",searchType:"prefix"})}}}_getMapLayerPicker(e){let t=this.isMobile?"display-none":"";return o`<div class=${`border-end ${t}`} id=solutions-map-layer-picker-container slot=${e??_}><map-layer-picker appearance=transparent .configLayerOrderDefined=${this._configLayerOrderDefined} .defaultLayerId=${this.defaultLayerId} display=inline-flex .enabledLayerIds=${this._enabledLayerIds} height=50 .isMobile=${this.isMobile} .mapView=${this.mapView} .showOnlyUpdatableLayers=${this.showOnlyUpdatableLayers} placeholder-icon=layers scale=l .selectedIds=${this._layer?[this._layer?.id]:[]} show-single-layer-as-label show-tables type=dropdown></map-layer-picker></div>`}_getLayerOption(e){let t;return this.mapInfo?.layerOptions?.layers.some(i=>i.id===e?(t=i,!0):!1),t}_getActionsEnd(e){let t=this._relatedFeatureTable?this._relatedFeatureTable.layer:this._layer,i=this._relatedFeatureTable||this._table,s=this._getLayerOption(t?.id||"");return o`<div class="display-flex" slot=${e??_}><field-selection .configExtraFields=${s?.extraFields} .layer=${t} .mapView=${this.mapView} .table=${i} .tableRef=${this.el}></field-selection>${this.enableShare&&!this.isMobile?this._getShare("share"):void 0}</div>`}_getTableControlRow(e){return o`<div class=${"height-51-px width-full display-flex"} slot=${e??_} ${f(this._toolbar)}>${this._getActionBar()}</div>`}_getActionBar(){return o`<calcite-action-bar class=width-full expand-disabled id=${this._getId("bar")??_} layout=horizontal><calcite-action-group>${this.isMobile?void 0:this._getActions()}</calcite-action-group></calcite-action-bar>`}_getActions(){return this._toolInfos?.reduce((e,t)=>(t&&e.push(t.isDanger?this._getDangerAction(t.icon,t.label,t.func,t.disabled):this._getAction(t.active,t.icon,t.indicator,t.label,t.func,t.disabled,!!t.loading,t.toolTip)),e),[])}_validateEnabledActions(){let e=this._getIds().length,t=["zoom-to-object","pencil","trash","erase","selected-items-filter"];this._toolInfos?.forEach(i=>{i&&t.indexOf(i.icon)>-1&&(i.disabled=i.icon==="pencil"?e<2||e>m:e<1,i.toolTip=i.icon==="pencil"?e>m?this._translations.featureEditLimitNotice:this._translations.editMultiple:i.toolTip)})}_validateActiveActions(){let e=["filter","list-check-all","selected-items-filter"];this._toolInfos?.forEach(t=>{t&&e.indexOf(t.icon)>-1&&(t.icon==="filter"&&(t.indicator=this._filterActive),t.icon==="list-check-all"&&(t.active=this._selectAllActive),t.icon==="selected-items-filter"&&(t.active=this._showOnlySelected,t.label=this._showOnlySelected?this._translations.showAll:this._translations.showSelected))})}async _initToolInfos(){let e=this._getIds().length>0,t=this._relatedFeatureTable?this._relatedFeatureTable.layer.isTable:this._layer?.isTable,i=this.featureSelectionMode==="multiple"&&this._layer?.capabilities?.operations.supportsUpdate,s=this._getSelectedIds().length<2||this._getSelectedIds().length>m,a=!this.mapHidden&&!t,l=!this._relatedFeatureTable&&(!this._layer?.isTable||this._hasFilterExpressions()),h=this._featuresEmpty(),n=this.featureSelectionMode==="single",r=this.enableCSV;if(this._relatedFeatureTable){let u=await this._queryRelatedFeatures();r=u&&Object.keys(u).length>0}let d=[];l&&d.push({active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this.toggleFilter.emit(),disabled:!1,toolTip:this._translations.filters}),a&&d.push({active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>this._zoom(),disabled:!e,toolTip:this._translations.zoom}),i&&d.push({active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>this.editMultipleFeatures.emit(this._getSelectedIds()),disabled:s,toolTip:this._translations.editMultiple}),this._deleteEnabled&&d.push({active:!1,icon:"trash",indicator:!1,label:this._translations.delete,func:()=>this._showDelete(),disabled:!e,isDanger:!0,toolTip:this._translations.delete}),d.push({active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>{this.clearSelection()},disabled:!e,toolTip:this._translations.clearSelection}),this._relatedFeatureTable||d.push({active:!1,icon:"selected-items-filter",indicator:!1,label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!e,toolTip:this._showOnlySelected?this._translations.showAll:this._translations.showSelected}),!n&&!this._relatedFeatureTable&&d.push({active:!1,icon:"list-check-all",indicator:!1,func:async()=>await this._selectAll(),label:this._translations.selectAll,disabled:h,toolTip:this._translations.selectAll}),!n&&!this._relatedFeatureTable&&d.push({active:!1,icon:"compare",indicator:!1,func:async()=>await this._switchSelected(),label:this._translations.switchSelected,disabled:h,toolTip:this._translations.switchSelected}),d.push({active:!1,icon:"refresh",indicator:!1,func:()=>{this._refresh()},label:this._translations.refresh,disabled:!1,toolTip:this._translations.refresh}),r&&d.push({active:!1,icon:"export",indicator:!1,func:()=>{this._exportToCSV()},label:this._translations.exportCSV,loading:this._csvExporting,disabled:h,toolTip:this._translations.exportCSV}),this._toolInfos=[...d]}_updateFloorDefinitionExpression(){if(this._floorField&&this._floorLevel){let e=`${this._floorField} = '${this._floorLevel}'`,t=this._layer?.definitionExpression;this._layer&&(this._layer.definitionExpression=t&&this._floorExpression&&t?.indexOf(this._floorExpression)>-1?t.replace(this._floorExpression,e):t?`${t} AND (${e})`:e),this._floorExpression=e}}_featuresEmpty(){return this._allIds?.length===0}_hasFilterExpressions(){let e=[],t=this._layer?.id;return this.mapInfo?.filterConfig?.layerExpressions&&t!==void 0&&(e=this.mapInfo.filterConfig.layerExpressions.filter(i=>i.id===t)),e.length>0}_getAction(e,t,i,s,a,l,h,n){let r=this._layer===void 0?!0:l;return o`<calcite-action .active=${e} appearance=solid .disabled=${r} .icon=${t} .id=${`layer-table-${t}`} .indicator=${i} .label=${s} .loading=${h} @click=${a} text text-enabled><div class="display-flex"><span class="label-override padding-start-1-4">${s}</span></div></calcite-action>${this._getToolTip("auto",`layer-table-${t}`,n)}`}_showDelete(){this.showDelete.emit({ids:this._getIds()})}_getShare(e){return o`<div id=${this._getId(e)??_}><instant-apps-social-share class="height-51 width-51 display-flex" .embed=${this.shareIncludeEmbed} flip-rtl popover-button-icon-scale=s scale=m share-button-color=neutral share-button-type=action .socialMedia=${this.shareIncludeSocial} .view=${this.mapView} ${f(this._shareNode)}></instant-apps-social-share>${this._getToolTip("bottom",e,this._translations.share)}</div>`}_updateShareUrl(){let e=this._shareNode.value?.shareUrl;if(!e)return;let t=new URL(e);this.mapInfo?.id?t.searchParams.set("webmap",this.mapInfo.id):t.searchParams.delete("webmap"),this._layer?.id?t.searchParams.set("layer",this._layer.id):t.searchParams.delete("layer"),this.selectedIds?.length>0?t.searchParams.set("oid",this.selectedIds.reverse().join(",")):t.searchParams.delete("oid"),this.appLayout&&t.searchParams.set("applayout",this.appLayout),this.selectedRelatedIds?.length>0&&this._relatedFeatureTable?.layer?.id&&(t.searchParams.set("oid",this.selectedRelatedIds.join(",")),t.searchParams.set("layer",this._relatedFeatureTable?.layer?.id.toString())),this._shareNode.value&&(this._shareNode.value.autoUpdateShareUrl=!1,this._shareNode.value.shareUrl=t.href)}_getToolTip(e,t,i){return o`<calcite-tooltip .placement=${e} .referenceElement=${t}><span>${i}</span></calcite-tooltip>`}_getId(e){return`solutions-action-${e}`}_getDangerAction(e,t,i,s){let a=this._layer===void 0?!0:s;return o`<div class="display-flex" id=${this._getId(e)??_}>${o`<calcite-action appearance=solid .disabled=${a} .id=${`layer-table-${e}`} @click=${i} text><calcite-icon class="danger-icon-color" .icon=${e} scale=s></calcite-icon><span class="label-override padding-start-1-4 danger-label-color">${t}</span></calcite-action>`}${this._getToolTip("bottom",`layer-table-${e}`,t)}</div>`}_getIds(){let e=this._relatedFeatureTable??this._table;return this._relatedFeatureTable&&this._table&&this._table.highlightIds.getItemAt(0)!==this.selectedIds[0]&&(e=this._table),e?.highlightIds.map(t=>Number.parseInt(t.toString(),10)).toArray()??[]}onTableNodeCreate(e){this._tableNode=e}async _getTable(e,t){this._layer&&(await this._layer.when(()=>{this._table=new L({autoRefreshEnabled:this.enableAutoRefresh,autoSaveEnabled:this.enableTableAutosave,layer:this._layer,view:this.mapView,columnReorderingEnabled:this.enableColumnReorder,editingEnabled:this._editEnabled&&this.enableInlineEdit,relatedRecordsEnabled:!0,attachmentsEnabled:!0,highlightEnabled:!1,multiSortEnabled:!1,visibleElements:{columnDescriptions:!1,header:!1,menu:!1,progress:!1},tableTemplate:{columnTemplates:t},container:e})}),await this._table?.when(()=>{this._table?.viewModel.addHandles(this._table.highlightIds.on("change",i=>{this._handleOnChange(i)})),this._table?.viewModel.addHandles(this._table.on("cell-pointerover",this.tempHighlightOnHover.bind(this))),this._table?.viewModel.addHandles(this._table.on("cell-pointerout",this._removeTempHighlight.bind(this))),this._table?.viewModel.addHandles(this._table.on("column-reorder",this._handleColumnReorder.bind(this))),this.listenOn(this._tableNode,"mouseleave",this._removeTempHighlight),this._table?.viewModel.addHandles(c.watch(()=>this._table.size,i=>{this._size=i})),c?.watch(()=>this._table?.relatedTable,async i=>{if(i){if(i.rowHighlightIds.length){let a={added:[i.rowHighlightIds.getItemAt(0)],removed:[]};this._handleOnChange(a)}let s=i.layer;if(this._layerEditHandle=s.on("edits",async()=>{await new Promise(a=>setTimeout(a,50)),await this._refresh(!0)}),this._checkEditEnabled(s),i.editingEnabled=this._editEnabled&&this.enableInlineEdit,i.autoSaveEnabled=this.enableTableAutosave,this._relatedFeatureTable=i,typeof i.layer?.id=="string"&&i.layer?.fields){let a=i.layer.popupTemplate?.fieldInfos,l=this._getColumnTemplates(i.layer.id,i.layer.fields,a);this._relatedFeatureTable.tableTemplate=new w({columnTemplates:l})}i.highlightIds.on("change",a=>{this._handleRelatedRecordsChange(a)})}else{this.selectedRelatedIds=[],this._relatedFeatureTable=void 0,this._layerEditHandle&&this._layerEditHandle.remove();let s=this._layer;this._refresh(),s&&this.relatedRecordToggled.emit(s),this._finishOnChange()}await this._initToolInfos()})}))}async _handleRelatedRecordsChange(e){await this._handleOnChange(e),this._updateShareUrl()}hasAttachmentsEnabled(e){if(!e?.capabilities)return!1;let{capabilities:{data:{supportsAttachment:t},operations:{supportsQueryAttachments:i}}}=e;return t&&i}async _handleOnChange(e){if(!await this._validateActiveEdits([...e.added],[...e.removed]))return;let t=[...this._getIds()],i=this._getSelectedLayer(t);this._relatedFeatureTable&&this._table?.highlightIds.getItemAt(0)!==this.selectedIds[0]&&(i=this._layer,await this._initToolInfos()),i&&this.relatedRecordToggled.emit(i),this.featureSelectionMode==="single"&&(this._relatedFeatureTable&&t.length>1?(this._relatedFeatureTable.highlightIds.remove(t[0]),t.shift()):t.length>1&&!this._selectAllActive&&(this._table?.highlightIds.remove(t[0]),t.shift())),!this._relatedFeatureTable||this._relatedFeatureTable&&this._table?.highlightIds.getItemAt(0)!==this.selectedIds[0]?(this.selectedRelatedIds=[],this.selectedIds=t.reverse(),this._tempSelectedIds=[...this.selectedIds],this._highlightFeatures(this.selectedIds[0])):this.selectedRelatedIds=t.reverse(),this._finishOnChange()}async _validateActiveEdits(e,t){let i=!0;if(this._editor&&!this._skipEditCheck){if(this._hasPendingEdits()){let s=!1;try{this._editor.viewModel.activeWorkflow&&await this._editor.viewModel.activeWorkflow.cancel({force:!1})}catch(a){s=a?.name==="workflow:cancel-denied"}if(s){let a=this._relatedFeatureTable&&this._relatedFeatureTable.highlightIds.length>0?this._relatedFeatureTable:this._table;i=!1,this._skipEditCheck=!0,e.length>0?a?.highlightIds.removeMany(e):t.length>0&&a?.highlightIds.addMany(t)}}}else i=!this._skipEditCheck,this._skipEditCheck=!1;return this._shouldUpdateTableOnExtentChange=i,i}_hasPendingEdits(){let e=this._editor?.viewModel?.hasPendingEdits,t=this._editor?.activeWorkflow?.activeWorkflow?.hasPendingEdits;return e||t}_finishOnChange(){this._showOnlySelected&&!this._relatedFeatureTable&&(this._table&&this._getSelectedIds().length>0?this._table.filterBySelectionEnabled=!0:this._toggleShowSelected());let e=this._getSelectedIds();setTimeout(()=>{this.featureSelectionChange.emit(e)},50)}_handleColumnReorder(){this.columnReorder.emit()}tempHighlightOnHover(e){if(this._removeTempHighlight(),this._selectedLayerView){let t=e.feature;this._temporaryFeatureHandle=this._selectedLayerView?.highlight([t],{name:"temporary"})}}_removeTempHighlight(){this._temporaryFeatureHandle&&this._temporaryFeatureHandle.remove()}_highlightFeatures(e){if(this._clearHighlights(),this.selectedIds.length>0&&this._selectedLayerView&&(this._currentFeatureHighlightHandle=this._selectedLayerView?.highlight([e],{name:"current-selection"}),this.selectedIds.length>1)){let t=this.selectedIds.filter(i=>i!==e);this._defaultFeaturesHandle=this._selectedLayerView?.highlight(t,{name:"default"})}}_clearHighlights(){this._removeTempHighlight(),this._currentFeatureHighlightHandle&&this._currentFeatureHighlightHandle.remove(),this._defaultFeaturesHandle&&this._defaultFeaturesHandle.remove()}_resetColumnTemplates(){if(this._layer){let e=this._layer.popupTemplate?.fieldInfos,t=this._getColumnTemplates(this._layer.id,this._layer.fields,e);t?.length===0?this._tableNode?.classList.add("display-none"):this._tableNode?.classList.remove("display-none");let i=this._table?.tableTemplate?.columnTemplates,s=i&&t&&i.length!==t.length||t?.some((a,l)=>i&&i[l]?JSON.stringify(i[l])!==JSON.stringify(a):!1);if(this._table&&t&&(s||!this._columnsInfo)){this._table.tableTemplate=new w({columnTemplates:t});let a=t.map(l=>l.fieldName);this._initColumnsInfo(a)}}}_setColumnTemplates(e){this._table&&e&&(this._table.tableTemplate=new w({columnTemplates:e}))}async _resetTable(){if(this._loaded=!1,this._clearSelection(),this._allIds=await this.queryAllIds(),!this._table&&this._layer){let e=this._layer.popupTemplate?.fieldInfos,t=this._getColumnTemplates(this._layer.id,this._layer.fields,e);this._tableNode&&await this._getTable(this._tableNode,t)}else this._table&&(this._table.view=this.mapView,this._table.layer=this._layer);await this._initLayerRefresh(),this._checkEditEnabled(this._layer),this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,this._table.autoSaveEnabled=this.enableTableAutosave,await this._table.when(),setTimeout(()=>{this._loaded||this.finishLoading()},1e3),await c.once(()=>this._table?.state==="loaded").then(async()=>{await this.finishLoading()}))}async finishLoading(){try{this._loaded=!0,this._table?.highlightIds.removeAll(),this._table.objectIds.removeAll(),this._resetColumnTemplates(),this._showOnlySelected=!1,await this._handleDefaults(),await this._sortTable(),await this._initToolInfos(),["esri-feature-table","esri-widget"].forEach(e=>{this._tableNode&&!this._tableNode.classList.contains(e)&&this._tableNode.classList.add(e)})}catch(e){console.log(e)}}async _initLayerRefresh(){this._refreshHandle&&this._refreshHandle.remove(),this._layer&&(this._refreshHandle=this._layer.on("refresh",e=>{e.dataChanged&&this._updateAllIds()}))}async _updateAllIds(){let e=await this.queryAllIds(),t=this.selectedIds.filter(i=>this._allIds.indexOf(i)>-1);(JSON.stringify(e)!==JSON.stringify(this._allIds)||JSON.stringify(this.selectedIds)!==JSON.stringify(t))&&(this._allIds=e,this.selectedIds=t,await this._refresh())}async _handleDefaults(){if(!this._defaultOidHonored&&this.defaultOid?.length>0&&this.defaultOid[0]>-1&&this._table&&(await this._selectDefaultFeature(this.defaultOid),this._defaultOidHonored=!0,this.defaultOid=[],this._showOnlySelected=!1,this._toggleShowSelected()),!this._defaultGlobalIdHonored&&this.defaultGlobalId&&this.defaultGlobalId?.length>0&&this._table&&this._layer){let e=await O(this.defaultGlobalId,this._layer),t=e?.length>0?e.map(i=>Number(i.getObjectId())):void 0;t&&await this._selectDefaultFeature(t),this._defaultGlobalIdHonored=!0,this.defaultGlobalId=[],this._showOnlySelected=!1,this._toggleShowSelected()}}_initColumnsInfo(e){let t=this._table?.columns.reduce((s,a)=>((!e||e?.indexOf(a.name)>-1)&&(s[a.name]=!a.hidden),s),{}),i=this._table?.columns.map(s=>s.name);(e&&i?e.filter(s=>i.indexOf(s)<0):[]).forEach(s=>{t[s]=!0}),this._columnsInfo=e?e.reduce((s,a)=>(s[a]=t[a],s),{}):t}async _selectDefaultFeature(e){e.length>0&&this._table?.highlightIds.addMany(e)}_checkEditEnabled(e){this._editEnabled=!!(e?.editingEnabled&&e?.capabilities?.operations.supportsUpdate),this._deleteEnabled=!!(e?.editingEnabled&&e?.capabilities?.operations.supportsDelete)}async _sortTable(){let e=this._layer?.objectIdField,t="desc",i,s=this.mapInfo?.layerOptions?.layers,a=this._layer?.id;s&&s.length>0&&a!==void 0&&(i=s.filter(l=>l.id===a),i&&i.length>0&&(i=i[0],i.sortField&&i.fields?.includes(i.sortField)&&(e=i.sortField),t=i?.sortOrder?i.sortOrder:"desc")),this._table&&this._layer&&(await this._table.when(),await this._layer.when(()=>{e&&this._table?.sortColumn(e,t)}))}async _handleFilterListReset(){this._filterActive=!1,this._updateShareUrl(),await this._searchFullText()}async _handleFilterUpdate(e){if(this._floorExpression&&this._layer){let t=this._layer.definitionExpression,i=new RegExp(`${this._floorField} = ['].+[']`,"gm");this._layer.definitionExpression=t&&this._floorField&&t.indexOf(`${this._floorField} = '`)>-1?t.replace(i,this._floorExpression):t?`${t} AND (${this._floorExpression})`:this._floorExpression}this._filterActive=e,this._updateShareUrl(),await this._searchFullText()}_handleTableOnMapExtent(){this._table&&(this._filterByExtentHandle=c.when(()=>this.mapView?.stationary,async()=>{if(this._shouldUpdateTableOnExtentChange&&this.appLayout==="splitView"){if(await new Promise(e=>setTimeout(e,800)),this._table&&this.mapView){this._table.filterGeometry=this.mapView.extent;let e={geometry:this.mapView.extent},t=this._layer&&await this._layer.queryObjectIds(e),i=this.selectedIds.filter(a=>!t?.includes(a)),s=this._outOFExtentOids.filter(a=>t?.includes(a));i.length>0&&(this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._table.highlightIds.removeMany(i),this._outOFExtentOids=[...this._outOFExtentOids,...i]),s.length>0&&(this.selectedIds=[...new Set([...this.selectedIds,...s])],this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(this.selectedIds.reverse()),this._outOFExtentOids=this._outOFExtentOids.filter(a=>!s.includes(a)))}this._allIds=await this.queryAllIds()}},{initial:!0}))}async _closeFilter(){this._allIds=await this.queryAllIds()}async queryAllIds(){if(this._layer){let e=this._layer.createQuery();return e.geometry=this._filterByExtentHandle&&this.mapView?this.mapView.extent:null,e.where=this._layer.definitionExpression||"1=1",await this._layer.queryObjectIds(e)}else return[]}async _mapClicked(e){let t={include:this._layer},i=await this.mapView?.hitTest(e.screenPoint,t);if(i&&i.results.length>0){let s=i.results;if(this.featureSelectionMode==="single"){this._table?.highlightIds.removeAll();let a=s[0].graphic.getObjectId();if(a){let l=this._table?.highlightIds.indexOf(a);l!==void 0&&l<0&&this._table?.highlightIds.add(a)}}else s.forEach(a=>{let l=Number(a.graphic.getObjectId()),h=this._table?.highlightIds.indexOf(l);h&&h<0&&l&&this._table?.highlightIds.add(l)});this._showOnlySelected&&this._table&&(this._table.filterBySelectionEnabled=!0)}else await this.clearSelection()}async _selectAll(){let e=this._allIds,t=e.filter(i=>this.selectedIds.indexOf(i)<0);await this._validateActiveEdits(t,this.selectedIds)&&this._table?(this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(e),this.selectedIds=e,this._finishOnChange(),this._selectAllActive=!0):this._skipEditCheck=!1}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._table&&(this._table.filterBySelectionEnabled=this._showOnlySelected)}_clearSelection(){this._relatedFeatureTable||(this.selectedIds=[],this._outOFExtentOids=[],this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._table?.highlightIds.removeAll(),this._clearHighlights(),this._table?.rowHighlightIds.removeAll()),this._relatedFeatureTable&&(this._relatedFeatureTable?.highlightIds.removeAll(),this.selectedRelatedIds=[]),this._finishOnChange()}async _switchSelected(){let e=[...this.selectedIds],t=this._allIds.reduce((i,s)=>(e.indexOf(s)<0&&i.push(s),i),[]).sort((i,s)=>i-s);await this._validateActiveEdits(t,e)&&this._table?(this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(t),this.selectedIds=t,this._finishOnChange()):this._skipEditCheck=!1}async _exportToCSV(){let e=this._relatedFeatureTable?this._relatedFeatureTable.layer:this._layer;if(!e)return;let t={},i=this._getIds();if(this._relatedFeatureTable?.tableParent&&this._relatedFeatureTable.highlightIds.length===0){let l=this._relatedFeatureTable.tableParent.highlightIds?.getItemAt(0);if(l!==void 0){let h=await this._queryRelatedFeatures(),n=[];h&&h[l]?.features&&(h[l].features.forEach(r=>{r.attributes&&n.push(r.attributes[e.objectIdField])}),i=n.length>0?n:[])}}t[e.id]={selectionSetNames:[e.title||""],ids:i,layer:e};let s=this._relatedFeatureTable??this._table;if(!s)return;let a=s&&s.columns.toArray().reduce((l,h)=>{if(!h.hidden){let n=h?.name||h?.fieldName;n&&l.push(n.toLocaleLowerCase())}return l},[]);this._updateToolInfoLoading("export",!0),this._csvExporting=!0,this.mapView?.map&&await $(this.mapView.map,t,!1,!1,!0,a,!0,!0),this._updateToolInfoLoading("export",!1),this._csvExporting=!1}async _queryRelatedFeatures(){let e=this._relatedFeatureTable?this._relatedFeatureTable?this._relatedFeatureTable.layer:this._relatedFeatureTable.tableParent?.layer:this._layer,t=this._relatedFeatureTable?.tableParent?.highlightIds?.items[0],i=this._relatedFeatureTable?.tableParent?.layer,s=e?.relationships?.find(l=>i.relationships?.some(h=>h.id===l.id)),a=new M({objectIds:[t],outFields:["*"],relationshipId:s?.id});return t&&a&&await i.queryRelatedFeatures(a).catch(async l=>{console.error(l)})}_updateToolInfoLoading(e,t){this._toolInfos.some(i=>i?.icon===e?(i.loading=t,!0):!1)}async _refresh(e){if(await this._validateActiveEdits([],this.selectedIds)){this._table&&await this._table.refresh(),this._relatedFeatureTable&&await this._relatedFeatureTable.refresh(),this._allIds=await this.queryAllIds();let t=this._getSelectedLayer(this.selectedRelatedIds);if(t&&this.relatedRecordToggled.emit(t),!e){let i=this._getSelectedIds();this.featureSelectionChange.emit(i)}}}_getSelectedIds(){let e;return this._relatedFeatureTable?this.selectedRelatedIds.length>0?e=this.selectedRelatedIds:e=this._relatedFeatureTable.tableParent?.highlightIds.toArray()??[]:e=this.selectedIds,e}_getSelectedLayer(e){let t;return this._relatedFeatureTable?e.length>0?t=this._relatedFeatureTable.layer:t=this._relatedFeatureTable.tableParent?.layer:t=this._layer,t}async _clearSearchText(){if(this._searchNode.value){this._searchNode.value.value="";let e={target:{value:""}};await this._searchTextChanged(e)}}async _zoom(){this._layer&&this.mapView&&await y(this.selectedIds,this._selectedLayerView,this.mapView,!0,void 0,this.zoomToScale)}async _layerSelectionChanged(e){let t=e.detail[0];if(t!==this._layer?.id||this._featuresEmpty()){this._fetchingData=!0,await this._clearSearchText();let i=this.mapView&&await A(this.mapView,t);i&&await i.when(async()=>{this._selectedLayerView=!i.isTable&&this.mapView?await C(this.mapView,i.id):null,this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._shouldUpdateTableOnExtentChange=!0,this._layer=i,await this._initToolInfos(),this._getFullTextSearchInfo()})}this._creatingFeature=!1,this._fetchingData=!1}_getColumnTemplates(e,t,i){let s=this._getLayerOption(e),a=this._layer?.attributeTableTemplate?.elements,l=[];a?.length>0&&this.honorMapFieldSettings&&(l=a.map(r=>r.fieldName));let h=s?.fields&&s?.fieldOrder?s.fieldOrder.filter(r=>s?.fields&&s.fields.indexOf(r)>-1):l.length>0?l:void 0,n;return t&&(n=t.reduce((r,d)=>{let u={type:"field",fieldName:d.name,label:this.getFieldLabel(d,i),menuConfig:this._getMenuConfig(d.name)};return s&&s.fields&&s?.fields?.length>0?s.fields.indexOf(d.name)>-1&&r.push(u):l.length>0?l.indexOf(d.name)>-1&&r.push(u):r.push(u),r},[])),n?h?n?.sort(this._sortFields.bind(this,h)):n:[]}updateRelatedAttachmentColumns(){let e=this._getLayerOption(this._layer?.id||""),t=this.hasAttachmentsEnabled(this._layer),i=!0,s="attachments",a=(e?.extraFields||[]).reduce((h,n)=>(n.startsWith("related:")?h.related.push(n.split("related:")[1]):h.extra.push(n),h),{related:[],extra:[]}),l=a.extra.some(h=>h.toLowerCase()===s);a&&(t=l&&t,i=a.related.length>0,this._table?.columns.forEach(h=>{h.fieldName.startsWith("EsriFeatureTableRelationshipColumn")&&(h.hidden=!a.related.includes(h.effectiveLabel)),h.fieldName.startsWith("EsriFeatureTableAttachmentsColumn")&&(h.hidden=!a.extra.some(n=>n.toLowerCase()===h.effectiveLabel.toLowerCase()))})),this._table.relatedRecordsEnabled=i,this._table.attachmentsEnabled=t}getFieldLabel(e,t){let i=e.alias?e.alias:e.name;return t?.some(s=>s.fieldName===e.name?(i=s.label,!0):!1),i||e.name}_sortFields(e,t,i){return e?.indexOf(t.fieldName)-e.indexOf(i.fieldName)}_getMenuConfig(e){return{items:[{label:this._translations.hideField,icon:"view-hide",autoCloseMenu:!0,clickFunction:()=>{this._handleHideClick(e)}}]}}_handleHideClick(e){this._columnsInfo&&this._table&&(this._columnsInfo[e]=!1,this._table.hideColumn(e),this._table.tableTemplate&&this._table.tableTemplate.columnTemplates.forEach(t=>{t.fieldName===e&&(t.visible=!1)}))}};E("layer-table",I);return I},"widgets/FeatureTable","core/reactiveUtils","rest/support/RelationshipQuery","widgets/FeatureTable/support/TableTemplate",a,c,d,e,h)
2
+ import h from"./NBPM6OJQ.js";import{a as H}from"./BU5PIAGS.js";import e from"./BGXRCU7G.js";import d from"./QKJ4PGBO.js";import c from"./CEP54NLT.js";import a from"./YVNP437O.js";import{a as S}from"./R67EKKSL.js";import{b as E}from"./KIUBUHVM.js";import{E as g,F as f,G as x,I as b,h as v,i as o,l as _,q as p,t as T}from"./H5E6ISYP.js";export default $arcgis.t(([L,c,M,w,{c:O},{c:C,d:A,j:y},{l:F},{f:m},{b:$}])=>{var R=v`@layer{:host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.display-none{display:none}.table-border{border:1px solid var(--calcite-color-border-2)}.border-end{border-inline-end:1px solid var(--calcite-color-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51-px{height:51px}.height-50-px{height:50px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir=rtl] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-color-surface-1)}.text-color{color:var(--calcite-color-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-color-status-danger)}.esri-feature-table vaadin-grid{border:none!important}vaadin-grid-cell-content{font-size:14px!important;color:var(--calcite-color-text-3)!important}.absolute-right{position:absolute;right:0;left:unset}html[dir=rtl] .absolute-right{left:0;right:unset}.disabled{cursor:default!important;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.actions-end{height:50px!important;display:inline-flex}.border-top{border-top:1px solid var(--calcite-color-border-2)}.modal{--calcite-dialog-content-space: 0}.esri-feature-table__table-container{height:100%}.search-container{background-color:var(--calcite-color-surface-2)!important}.search{--calcite-color-border-input: var(--calcite-color-border-3);width:60%;padding:10px}.delete-red{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-color-text-1: var(--calcite-color-status-danger);--calcite-color-text-3: var(--calcite-color-status-danger)}.label-override{white-space:nowrap}.padding-start-1-4{padding-inline-start:.5rem}.panel-header-override{--calcite-panel-header-content-space: 0px}.danger-label-color{color:var(--calcite-color-status-danger)}.danger-icon-color{--calcite-icon-color: var(--calcite-color-status-danger)}.width-51{width:51px}.height-51{height:51px}calcite-action-bar{--calcite-internal-action-bar-gap: 0px;--calcite-internal-action-bar-padding: 0px}}`,I=class extends x{constructor(){super(),this.defaultGlobalId=[],this.defaultLayerId="",this.defaultOid=[],this.enableAutoRefresh=!1,this.enableColumnReorder=!0,this.enableCSV=!1,this.enableInlineEdit=!1,this.enableShare=!1,this.enableTableAutosave=!0,this.featureSelectionMode="multiple",this.selectedRelatedIds=[],this.honorMapFieldSettings=!1,this.isMobile=!1,this.mapHidden=!1,this.showOnlyUpdatableLayers=!1,this.selectedIds=[],this.shareIncludeEmbed=!1,this.shareIncludeSocial=!1,this.showNewestFirst=!1,this.zoomAndScrollToSelected=!1,this._allIds=[],this._configLayerOrderDefined=!1,this._csvExporting=!1,this._fetchingData=!1,this._hideTable=!1,this._filterActive=!1,this._selectAllActive=!1,this._showHideOpen=!1,this._showOnlySelected=!1,this._toolInfos=[],this._translations=S({name:"layer-table",blocking:!0}),this._fullTextSearchInfo=[],this._searchPlaceHolder="",this._size=0,this._queryingData=!1,this._editEnabled=!1,this._enabledLayerIds=[],this._defaultGlobalIdHonored=!1,this._defaultOidHonored=!1,this._deleteEnabled=!1,this._floorExpression="",this._floorField="",this._floorLevel="",this._loaded=!1,this._shareNode=g(),this._toolbar=g(),this._searchExpression="",this._skipEditCheck=!1,this._tempSelectedIds=[],this._outOFExtentOids=[],this._shouldUpdateTableOnExtentChange=!0,this._creatingFeature=!1,this._searchNode=g(),this.columnReorder=p(),this.featureSelectionChange=p(),this.toggleFilter=p(),this.showDelete=p(),this.relatedRecordToggled=p(),this.editMultipleFeatures=p(),this.listenOn(window,"beforeMapInfoChange",this.beforeMapInfoChange,{capture:!0}),this.listenOn(window,"editorInitialized",this.editorInitialized),this.listenOn(window,"closeEdit",this.closeEdit),this.listenOn(window,"selectionChanged",this.selectionChanged),this.listenOn(window,"beforeLayerSelectionChange",this.beforeLayerSelectionChange),this.listenOn(window,"layerSelectionChange",this.layerSelectionChange),this.listenOn(window,"editsComplete",this.editsComplete),this.listenOn(window,"facilityChanged",this.facilityChanged),this.listenOn(window,"levelChanged",this.levelChanged),this.listenOn(window,"siteChanged",this.siteChanged),this.listenOn(window,"noLayersFound",this.noLayersFound),this.listenOn(window,"clearSelection",this.clearSelection),this.listenOn(window,"mapChanged",this.mapChanged),this.listenOn(window,"featuresSelected",this.featuresSelected),this.listenOn(window,"createWorkFlowStarted",this.createWorkFlowStarted),this.listenOn(window,"backFromCreateWorkFlow",this.backFromCreateWorkFlow),H(window)}static{this.properties={appLayout:1,defaultGlobalId:0,defaultLayerId:1,defaultOid:0,enableAutoRefresh:5,enableColumnReorder:5,enableCSV:5,enableInlineEdit:5,enableShare:5,enableTableAutosave:5,featureSelectionMode:1,selectedRelatedIds:0,honorMapFieldSettings:5,isMobile:5,mapHidden:5,mapInfo:0,mapView:0,showOnlyUpdatableLayers:5,selectedIds:0,shareIncludeEmbed:5,shareIncludeSocial:5,showNewestFirst:5,zoomAndScrollToSelected:5,zoomToScale:9,_allIds:16,_configLayerOrderDefined:16,_csvExporting:16,_fetchingData:16,_hideTable:16,_filterActive:16,_layer:16,_selectAllActive:16,_showHideOpen:16,_showOnlySelected:16,_toolInfos:16,_translations:16,_fullTextSearchInfo:16,_searchPlaceHolder:16,_size:16,_queryingData:16}}static{this.styles=R}static{this.shadowRootOptions=T}willUpdate(e){if(e.has("appLayout")&&this.appLayoutWatchHandler(),e.has("defaultOid")&&this.defaultOidWatchHandler(),e.has("defaultGlobalId")&&this.defaultGlobalIdWatchHandler(),e.has("enableCSV")&&this.enableCSVWatchHandler(),e.has("enableInlineEdit")&&this.enableInlineEditWatchHandler(),e.has("mapHidden")&&this.mapHiddenWatchHandler(),e.has("isMobile")&&this.isMobileWatchHandler(),e.has("mapInfo")&&this.mapInfoWatchHandler(),e.has("mapView")&&this.mapViewWatchHandler(),e.has("_layer")&&this._layerWatchHandler(),e.has("selectedIds")&&(this.hasUpdated||JSON.stringify(e.get("selectedIds"))!==JSON.stringify(this.selectedIds))&&this.selectedIdsWatchHandler(),e.has("selectedRelatedIds")&&(this.hasUpdated||JSON.stringify(e.get("selectedRelatedIds"))!==JSON.stringify(this.selectedRelatedIds))&&this.selectedRelatedIdsWatchHandler(),e.has("enableTableAutosave")&&this.hasUpdated&&this._table&&(this._table.autoSaveEnabled=this.enableTableAutosave),e.has("_translations")){let t=this._translations._lang,i=e.get("_translations")?._lang;t&&i&&t!==i&&this._initToolInfos()}}async appLayoutWatchHandler(){await this._initToolInfos(),this._updateShareUrl()}async defaultOidWatchHandler(){await this._handleDefaults()}async defaultGlobalIdWatchHandler(){await this._handleDefaults()}async enableCSVWatchHandler(){this._toolInfos?.length>0&&await this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}async mapHiddenWatchHandler(){this._toolInfos?.length>0&&await this._initToolInfos()}async isMobileWatchHandler(){!this._toolInfos&&!this.isMobile&&await this._initToolInfos()}async mapInfoWatchHandler(){this._configLayerOrderDefined="configLayerOrder"in(this.mapInfo?.layerOptions||{}),this._enabledLayerIds=F(this.mapInfo?.layerOptions?.layers||[],this.mapInfo?.layerOptions?.configLayerOrder),this._table&&(this._resetColumnTemplates(),this._sortTable(),await this._initToolInfos())}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._floorExpression="",this._searchExpression="undefined",this.mapView.highlights=[{name:"default",color:"#00FFFF"},{name:"current-selection",color:"#ff00ff"},{name:"temporary",color:"#FFFF00"}],this._updateShareUrl(),this._mapClickHandle=c.on(()=>this.mapView,"click",e=>{this._creatingFeature||this._mapClicked(e)}))}async _layerWatchHandler(){if(this._hideTable=!1,this._fetchingData=!0,!this._layer){this._fetchingData=!1,this._hideTable=!0;return}try{await this._layer.when(),this._floorField=this._layer.floorInfo?.floorField||"",this._updateFloorDefinitionExpression(),await this._resetTable(),this._updateShareUrl()}catch(e){console.error(e),this._hideTable=!0}finally{this._fetchingData=!1}}async selectedIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions(),this._selectAllActive&&this.selectedIds.length!==this._allIds.length&&(this._selectAllActive=!1),this.selectedIds.length>0&&(this._table.rowHighlightIds.removeAll(),this._table.rowHighlightIds.add(this.selectedIds[0])),this.selectedIds.length===0&&setTimeout(()=>{this.featureSelectionChange.emit(this.selectedIds)},700)}async selectedRelatedIdsWatchHandler(){this._validateEnabledActions(),this.selectedRelatedIds.length>0&&(this._relatedFeatureTable?.rowHighlightIds.removeAll(),this._relatedFeatureTable?.rowHighlightIds.add(this.selectedRelatedIds[0]))}async closeFilter(){await this._closeFilter()}async filterReset(){this._filterByExtentHandle&&(this._table&&(this._table.filterGeometry=void 0),this._filterByExtentHandle.remove(),this._filterByExtentHandle=void 0),await this._handleFilterListReset()}async filterUpdate(e,t){await this._handleFilterUpdate(e),t?(this._shouldUpdateTableOnExtentChange=!0,this._handleTableOnMapExtent()):t===!1&&(this._table&&(this._table.filterGeometry=void 0),this._filterByExtentHandle?.remove(),this._filterByExtentHandle=void 0,await this._updateAllIds())}async validateTableUpdate(e){this._shouldUpdateTableOnExtentChange=e}async validateActiveEdits(){return this._validateActiveEdits([],this.selectedIds)}async refresh(){this._table&&await this._refresh()}async setColumnOrder(e){this._setColumnTemplates(e)}async beforeMapInfoChange(e){let t=e.detail.ref,i=e.detail.mapInfo;if(this._hasPendingEdits()){e.preventDefault();let s=await this._validateActiveEdits([],this.selectedIds);await t.setMapByID(s?i.id:e.detail.currentId,!s)}}async editorInitialized(e){this._shouldUpdateTableOnExtentChange=!1,this._editor=e.detail}async closeEdit(){this._shouldUpdateTableOnExtentChange=!0,this._filterByExtentHandle&&this._handleTableOnMapExtent()}async selectionChanged(e){let t=e.detail.selectedFeature[0],i=Number(t.getObjectId()),s=this._table;if(s.rowHighlightIds.length&&s.rowHighlightIds.removeAll(),s.rowHighlightIds.add(i),this._highlightFeatures(i),this.zoomAndScrollToSelected&&s&&this.mapView){let a=s.viewModel.getObjectIdIndex(i);s.scrollToIndex(a);let l=t.layer,h=this.mapView.allLayerViews.toArray(),n;h.some(async r=>r.layer.title===l?.title&&r.layer.type==="feature"?(n=r,this.mapView&&await y([i],n,this.mapView,!0,void 0,this.zoomToScale),!0):!1)}}async beforeLayerSelectionChange(e){if(this._hasPendingEdits()){e.preventDefault();let t=e.detail.ref,i=await this._validateActiveEdits([],this.selectedIds);return e.detail.selectedIds?await t.setLayerByIds(i?e.detail.newIds:e.detail.currentIds,!0):await t.setLayerById(i?e.detail.newId:e.detail.currentId,!0)}}async layerSelectionChange(e){await this._layerSelectionChanged(e)}async editsComplete(e){let t=e.detail;(t==="delete"||t==="add")&&(this._allIds=await this.queryAllIds()),await this._refresh()}async facilityChanged(e){this._updateFloorDefinitionExpression()}async levelChanged(e){this._floorLevel=e.detail,this._updateFloorDefinitionExpression()}async siteChanged(e){this._updateFloorDefinitionExpression()}async noLayersFound(){this._layer=void 0,this._allIds=[],this._size=0,this._clearSelection()}async clearSelection(){await this._validateActiveEdits([],this.selectedIds)&&this._clearSelection()}async mapChanged(){this._queryingData=!1,this._creatingFeature=!1,this._clearSelection()}async featuresSelected(e){e.detail.forEach(t=>{let i=this._table?.highlightIds.indexOf(t);i&&i<0&&this._table?.highlightIds.add(t)})}createWorkFlowStarted(){this._creatingFeature=!0}backFromCreateWorkFlow(){this._creatingFeature=!1}async load(){await this._initToolInfos()}render(){let e=this._fetchingData||this._hideTable?"display-none":"",t=this._fetchingData?"":"display-none",i=this._queryingData?"":"display-none",s=this._size.toString(),a=this.selectedIds.length.toString(),l=this.isMobile?"height-full":"height-full-adjusted",h=this._canShowFullTextSearch();return this._validateActiveActions(),o`<div><calcite-scrim class=${b(i)} .loading=${this._queryingData}></calcite-scrim><calcite-shell><div class=${`width-full ${l}`}><calcite-panel class="height-full width-full panel-header-override">${this._getMapLayerPicker("header-actions-start")}${!this.isMobile&&o`${this._getTableControlRow("header-content")}${this._getActionsEnd("header-actions-end")}`||""}${h&&o`<div class="search-container border-bottom"><calcite-input class=search clearable icon=search @calciteInputChange=${n=>{this._searchTextChanged(n)}} .placeholder=${this._searchPlaceHolder} title=${this._searchPlaceHolder??_} type=search ${f(this._searchNode)}></calcite-input></div>`||""}<calcite-loader class=${b(t)} .label=${this._translations.fetchingData} scale=l></calcite-loader><div class=${b(e)} ${f(this.onTableNodeCreate)}></div></calcite-panel></div>${this.isMobile?void 0:o`<div class="bottom-left text-color height-19" id=solutions-selected-count-div>${(this._translations.recordsTotal?.replace("{{total-number-of-records}}",s)+" | "+this._translations.recordsSelected.replace("{{selected-number-of-records}}",a)).replace("{{total}}",s).replace("{{selected}}",a)}</div>`}</calcite-shell></div>`}updated(){this._table&&this.updateRelatedAttachmentColumns()}async _searchTextChanged(e){this._fullTextSearchInfo.forEach(t=>{t.searchTerm=e.target.value}),this._searchFullText()}async _searchFullText(){let e=[],t=!1;if(this._showOnlySelected)e=this._tempSelectedIds,t=!0;else if(await this._validateActiveEdits([],this.selectedIds))this._clearSelection(),this._tempSelectedIds=[];else return;this._searchExpression&&this._clearSearchDefinitionExpression();let i=[];if(this._fullTextSearchInfo?.length&&this._fullTextSearchInfo[0].searchTerm){let s=this._layer?.createQuery();s.fullText=this._fullTextSearchInfo,i=this._layer?await this._layer.queryObjectIds(s):[],t&&e?.length&&(i=i.filter(a=>e.includes(a))),await this._updateSearchDefinitionExpression(i?.length?i:[-1])}t&&i?.length&&(this._showOnlySelected=!0,this._table?.highlightIds.addMany(i.reverse())),await new Promise(s=>setTimeout(s,800)),await this._updateAllIds()}_clearSearchDefinitionExpression(){let e=this._layer?.definitionExpression;this._searchExpression&&e&&e?.indexOf(this._searchExpression)>-1&&this._layer&&(e?.indexOf(" AND ("+this._searchExpression)>-1?this._layer.definitionExpression=e.replace(` AND (${this._searchExpression})`,""):this._layer.definitionExpression=e.replace(this._searchExpression,"")),this._searchExpression=""}async _updateSearchDefinitionExpression(e){let t=this._layer?.definitionExpression;if(this._layer)if(e?.length){let i=`objectId in(${e})`;this._layer.definitionExpression=this._searchExpression&&t&&t.includes(this._searchExpression)?t.replace(this._searchExpression,i):t?`${t} AND (${i})`:i,this._searchExpression=i}else this._clearSearchDefinitionExpression()}_canShowFullTextSearch(){return this._layer?.capabilities?.query?.supportsFullTextSearch&&this._layer.indexes.items.filter(e=>e.indexType=="FullText").length>0}_getFullTextSearchInfo(){if(this._fullTextSearchInfo=[],this._layer?.capabilities?.query?.supportsFullTextSearch){let e=this._layer.indexes?.filter(t=>t.indexType=="FullText");if(e?.length){let t=[];e.forEach(s=>{t.push(...s.fields.split(","))});let i=[];t.forEach(s=>{let a=this._layer?.getField(s.trim());a?.alias&&i.push(a.alias)}),this._searchPlaceHolder=this._translations.searchPlaceholder.replace("{{field_names}}",i.join(", ")),this._fullTextSearchInfo.push({onFields:["*"],searchTerm:"",searchType:"prefix"})}}}_getMapLayerPicker(e){let t=this.isMobile?"display-none":"";return o`<div class=${`border-end ${t}`} id=solutions-map-layer-picker-container slot=${e??_}><map-layer-picker appearance=transparent .configLayerOrderDefined=${this._configLayerOrderDefined} .defaultLayerId=${this.defaultLayerId} display=inline-flex .enabledLayerIds=${this._enabledLayerIds} height=50 .isMobile=${this.isMobile} .mapView=${this.mapView} .showOnlyUpdatableLayers=${this.showOnlyUpdatableLayers} placeholder-icon=layers scale=l .selectedIds=${this._layer?[this._layer?.id]:[]} show-single-layer-as-label show-tables type=dropdown></map-layer-picker></div>`}_getLayerOption(e){let t;return this.mapInfo?.layerOptions?.layers.some(i=>i.id===e?(t=i,!0):!1),t}_getActionsEnd(e){let t=this._relatedFeatureTable?this._relatedFeatureTable.layer:this._layer,i=this._relatedFeatureTable||this._table,s=this._getLayerOption(t?.id||"");return o`<div class="display-flex" slot=${e??_}><field-selection .configExtraFields=${s?.extraFields} .layer=${t} .mapView=${this.mapView} .table=${i} .tableRef=${this.el}></field-selection>${this.enableShare&&!this.isMobile?this._getShare("share"):void 0}</div>`}_getTableControlRow(e){return o`<div class=${"height-51-px width-full display-flex"} slot=${e??_} ${f(this._toolbar)}>${this._getActionBar()}</div>`}_getActionBar(){return o`<calcite-action-bar class=width-full expand-disabled id=${this._getId("bar")??_} layout=horizontal><calcite-action-group>${this.isMobile?void 0:this._getActions()}</calcite-action-group></calcite-action-bar>`}_getActions(){return this._toolInfos?.reduce((e,t)=>(t&&e.push(t.isDanger?this._getDangerAction(t.icon,t.label,t.func,t.disabled):this._getAction(t.active,t.icon,t.indicator,t.label,t.func,t.disabled,!!t.loading,t.toolTip)),e),[])}_validateEnabledActions(){let e=this._getIds().length,t=["zoom-to-object","pencil","trash","erase","selected-items-filter"];this._toolInfos?.forEach(i=>{i&&t.indexOf(i.icon)>-1&&(i.disabled=i.icon==="pencil"?e<2||e>m:e<1,i.toolTip=i.icon==="pencil"?e>m?this._translations.featureEditLimitNotice:this._translations.editMultiple:i.toolTip)})}_validateActiveActions(){let e=["filter","list-check-all","selected-items-filter"];this._toolInfos?.forEach(t=>{t&&e.indexOf(t.icon)>-1&&(t.icon==="filter"&&(t.indicator=this._filterActive),t.icon==="list-check-all"&&(t.active=this._selectAllActive),t.icon==="selected-items-filter"&&(t.active=this._showOnlySelected,t.label=this._showOnlySelected?this._translations.showAll:this._translations.showSelected))})}async _initToolInfos(){let e=this._getIds().length>0,t=this._relatedFeatureTable?this._relatedFeatureTable.layer.isTable:this._layer?.isTable,i=this.featureSelectionMode==="multiple"&&this._layer?.capabilities?.operations.supportsUpdate,s=this._getSelectedIds().length<2||this._getSelectedIds().length>m,a=!this.mapHidden&&!t,l=!this._relatedFeatureTable&&(!this._layer?.isTable||this._hasFilterExpressions()),h=this._featuresEmpty(),n=this.featureSelectionMode==="single",r=this.enableCSV;if(this._relatedFeatureTable){let u=await this._queryRelatedFeatures();r=u&&Object.keys(u).length>0}let d=[];l&&d.push({active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this.toggleFilter.emit(),disabled:!1,toolTip:this._translations.filters}),a&&d.push({active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>this._zoom(),disabled:!e,toolTip:this._translations.zoom}),i&&d.push({active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>this.editMultipleFeatures.emit(this._getSelectedIds()),disabled:s,toolTip:this._translations.editMultiple}),this._deleteEnabled&&d.push({active:!1,icon:"trash",indicator:!1,label:this._translations.delete,func:()=>this._showDelete(),disabled:!e,isDanger:!0,toolTip:this._translations.delete}),d.push({active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>{this.clearSelection()},disabled:!e,toolTip:this._translations.clearSelection}),this._relatedFeatureTable||d.push({active:!1,icon:"selected-items-filter",indicator:!1,label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!e,toolTip:this._showOnlySelected?this._translations.showAll:this._translations.showSelected}),!n&&!this._relatedFeatureTable&&d.push({active:!1,icon:"list-check-all",indicator:!1,func:async()=>await this._selectAll(),label:this._translations.selectAll,disabled:h,toolTip:this._translations.selectAll}),!n&&!this._relatedFeatureTable&&d.push({active:!1,icon:"compare",indicator:!1,func:async()=>await this._switchSelected(),label:this._translations.switchSelected,disabled:h,toolTip:this._translations.switchSelected}),d.push({active:!1,icon:"refresh",indicator:!1,func:()=>{this._refresh()},label:this._translations.refresh,disabled:!1,toolTip:this._translations.refresh}),r&&d.push({active:!1,icon:"export",indicator:!1,func:()=>{this._exportToCSV()},label:this._translations.exportCSV,loading:this._csvExporting,disabled:h,toolTip:this._translations.exportCSV}),this._toolInfos=[...d]}_updateFloorDefinitionExpression(){if(this._floorField&&this._floorLevel){let e=`${this._floorField} = '${this._floorLevel}'`,t=this._layer?.definitionExpression;this._layer&&(this._layer.definitionExpression=t&&this._floorExpression&&t?.indexOf(this._floorExpression)>-1?t.replace(this._floorExpression,e):t?`${t} AND (${e})`:e),this._floorExpression=e}}_featuresEmpty(){return this._allIds?.length===0}_hasFilterExpressions(){let e=[],t=this._layer?.id;return this.mapInfo?.filterConfig?.layerExpressions&&t!==void 0&&(e=this.mapInfo.filterConfig.layerExpressions.filter(i=>i.id===t)),e.length>0}_getAction(e,t,i,s,a,l,h,n){let r=this._layer===void 0?!0:l;return o`<calcite-action .active=${e} appearance=solid .disabled=${r} .icon=${t} .id=${`layer-table-${t}`} .indicator=${i} .label=${s} .loading=${h} @click=${a} text text-enabled><div class="display-flex"><span class="label-override padding-start-1-4">${s}</span></div></calcite-action>${this._getToolTip("auto",`layer-table-${t}`,n)}`}_showDelete(){this.showDelete.emit({ids:this._getIds()})}_getShare(e){return o`<div id=${this._getId(e)??_}><instant-apps-social-share class="height-51 width-51 display-flex" .embed=${this.shareIncludeEmbed} flip-rtl popover-button-icon-scale=s scale=m share-button-color=neutral share-button-type=action .socialMedia=${this.shareIncludeSocial} .view=${this.mapView} ${f(this._shareNode)}></instant-apps-social-share>${this._getToolTip("bottom",e,this._translations.share)}</div>`}_updateShareUrl(){let e=this._shareNode.value?.shareUrl;if(!e)return;let t=new URL(e);this.mapInfo?.id?t.searchParams.set("webmap",this.mapInfo.id):t.searchParams.delete("webmap"),this._layer?.id?t.searchParams.set("layer",this._layer.id):t.searchParams.delete("layer"),this.selectedIds?.length>0?t.searchParams.set("oid",this.selectedIds.reverse().join(",")):t.searchParams.delete("oid"),this.appLayout&&t.searchParams.set("applayout",this.appLayout),this.selectedRelatedIds?.length>0&&this._relatedFeatureTable?.layer?.id&&(t.searchParams.set("oid",this.selectedRelatedIds.join(",")),t.searchParams.set("layer",this._relatedFeatureTable?.layer?.id.toString())),this._shareNode.value&&(this._shareNode.value.autoUpdateShareUrl=!1,this._shareNode.value.shareUrl=t.href)}_getToolTip(e,t,i){return o`<calcite-tooltip .placement=${e} .referenceElement=${t}><span>${i}</span></calcite-tooltip>`}_getId(e){return`solutions-action-${e}`}_getDangerAction(e,t,i,s){let a=this._layer===void 0?!0:s;return o`<div class="display-flex" id=${this._getId(e)??_}>${o`<calcite-action appearance=solid .disabled=${a} .id=${`layer-table-${e}`} @click=${i} text><calcite-icon class="danger-icon-color" .icon=${e} scale=s></calcite-icon><span class="label-override padding-start-1-4 danger-label-color">${t}</span></calcite-action>`}${this._getToolTip("bottom",`layer-table-${e}`,t)}</div>`}_getIds(){let e=this._relatedFeatureTable??this._table;return this._relatedFeatureTable&&this._table&&this._table.highlightIds.getItemAt(0)!==this.selectedIds[0]&&(e=this._table),e?.highlightIds.map(t=>Number.parseInt(t.toString(),10)).toArray()??[]}onTableNodeCreate(e){this._tableNode=e}async _getTable(e,t){this._layer&&(await this._layer.when(()=>{this._table=new L({autoRefreshEnabled:this.enableAutoRefresh,autoSaveEnabled:this.enableTableAutosave,layer:this._layer,view:this.mapView,columnReorderingEnabled:this.enableColumnReorder,editingEnabled:this._editEnabled&&this.enableInlineEdit,relatedRecordsEnabled:!0,attachmentsEnabled:!0,highlightEnabled:!1,multiSortEnabled:!1,visibleElements:{columnDescriptions:!1,header:!1,menu:!1,progress:!1},tableTemplate:{columnTemplates:t},container:e})}),await this._table?.when(()=>{this._table?.viewModel.addHandles(this._table.highlightIds.on("change",i=>{this._handleOnChange(i)})),this._table?.viewModel.addHandles(this._table.on("cell-pointerover",this.tempHighlightOnHover.bind(this))),this._table?.viewModel.addHandles(this._table.on("cell-pointerout",this._removeTempHighlight.bind(this))),this._table?.viewModel.addHandles(this._table.on("column-reorder",this._handleColumnReorder.bind(this))),this.listenOn(this._tableNode,"mouseleave",this._removeTempHighlight),this._table?.viewModel.addHandles(c.watch(()=>this._table.size,i=>{this._size=i})),c?.watch(()=>this._table?.relatedTable,async i=>{if(i){if(i.rowHighlightIds.length){let a={added:[i.rowHighlightIds.getItemAt(0)],removed:[]};this._handleOnChange(a)}let s=i.layer;if(this._layerEditHandle=s.on("edits",async()=>{await new Promise(a=>setTimeout(a,50)),await this._refresh(!0)}),this._checkEditEnabled(s),i.editingEnabled=this._editEnabled&&this.enableInlineEdit,i.autoSaveEnabled=this.enableTableAutosave,this._relatedFeatureTable=i,typeof i.layer?.id=="string"&&i.layer?.fields){let a=i.layer.popupTemplate?.fieldInfos,l=this._getColumnTemplates(i.layer.id,i.layer.fields,a);this._relatedFeatureTable.tableTemplate=new w({columnTemplates:l})}i.highlightIds.on("change",a=>{this._handleRelatedRecordsChange(a)})}else{this.selectedRelatedIds=[],this._relatedFeatureTable=void 0,this._layerEditHandle&&this._layerEditHandle.remove();let s=this._layer;this._refresh(),s&&this.relatedRecordToggled.emit(s),this._finishOnChange()}await this._initToolInfos()})}))}async _handleRelatedRecordsChange(e){await this._handleOnChange(e),this._updateShareUrl()}hasAttachmentsEnabled(e){if(!e?.capabilities)return!1;let{capabilities:{data:{supportsAttachment:t},operations:{supportsQueryAttachments:i}}}=e;return t&&i}async _handleOnChange(e){if(!await this._validateActiveEdits([...e.added],[...e.removed]))return;let t=[...this._getIds()],i=this._getSelectedLayer(t);this._relatedFeatureTable&&this._table?.highlightIds.getItemAt(0)!==this.selectedIds[0]&&(i=this._layer,await this._initToolInfos()),i&&this.relatedRecordToggled.emit(i),this.featureSelectionMode==="single"&&(this._relatedFeatureTable&&t.length>1?(this._relatedFeatureTable.highlightIds.remove(t[0]),t.shift()):t.length>1&&!this._selectAllActive&&(this._table?.highlightIds.remove(t[0]),t.shift())),!this._relatedFeatureTable||this._relatedFeatureTable&&this._table?.highlightIds.getItemAt(0)!==this.selectedIds[0]?(this.selectedRelatedIds=[],this.selectedIds=t.reverse(),this._tempSelectedIds=[...this.selectedIds],this._highlightFeatures(this.selectedIds[0])):this.selectedRelatedIds=t.reverse(),this._finishOnChange()}async _validateActiveEdits(e,t){let i=!0;if(this._editor&&!this._skipEditCheck){if(this._hasPendingEdits()){let s=!1;try{this._editor.viewModel.activeWorkflow&&await this._editor.viewModel.activeWorkflow.cancel({force:!1})}catch(a){s=a?.name==="workflow:cancel-denied"}if(s){let a=this._relatedFeatureTable&&this._relatedFeatureTable.highlightIds.length>0?this._relatedFeatureTable:this._table;i=!1,this._skipEditCheck=!0,e.length>0?a?.highlightIds.removeMany(e):t.length>0&&a?.highlightIds.addMany(t)}}}else i=!this._skipEditCheck,this._skipEditCheck=!1;return this._shouldUpdateTableOnExtentChange=i,i}_hasPendingEdits(){let e=this._editor?.viewModel?.hasPendingEdits,t=this._editor?.activeWorkflow?.activeWorkflow?.hasPendingEdits;return e||t}_finishOnChange(){this._showOnlySelected&&!this._relatedFeatureTable&&(this._table&&this._getSelectedIds().length>0?this._table.filterBySelectionEnabled=!0:this._toggleShowSelected());let e=this._getSelectedIds();setTimeout(()=>{this.featureSelectionChange.emit(e)},50)}_handleColumnReorder(){this.columnReorder.emit()}tempHighlightOnHover(e){if(this._removeTempHighlight(),this._selectedLayerView){let t=e.feature;this._temporaryFeatureHandle=this._selectedLayerView?.highlight([t],{name:"temporary"})}}_removeTempHighlight(){this._temporaryFeatureHandle&&this._temporaryFeatureHandle.remove()}_highlightFeatures(e){if(this._clearHighlights(),this.selectedIds.length>0&&this._selectedLayerView&&(this._currentFeatureHighlightHandle=this._selectedLayerView?.highlight([e],{name:"current-selection"}),this.selectedIds.length>1)){let t=this.selectedIds.filter(i=>i!==e);this._defaultFeaturesHandle=this._selectedLayerView?.highlight(t,{name:"default"})}}_clearHighlights(){this._removeTempHighlight(),this._currentFeatureHighlightHandle&&this._currentFeatureHighlightHandle.remove(),this._defaultFeaturesHandle&&this._defaultFeaturesHandle.remove()}_resetColumnTemplates(){if(this._layer){let e=this._layer.popupTemplate?.fieldInfos,t=this._getColumnTemplates(this._layer.id,this._layer.fields,e);t?.length===0?this._tableNode?.classList.add("display-none"):this._tableNode?.classList.remove("display-none");let i=this._table?.tableTemplate?.columnTemplates,s=i&&t&&i.length!==t.length||t?.some((a,l)=>i&&i[l]?JSON.stringify(i[l])!==JSON.stringify(a):!1);if(this._table&&t&&(s||!this._columnsInfo)){this._table.tableTemplate=new w({columnTemplates:t});let a=t.map(l=>l.fieldName);this._initColumnsInfo(a)}}}_setColumnTemplates(e){this._table&&e&&(this._table.tableTemplate=new w({columnTemplates:e}))}async _resetTable(){if(this._loaded=!1,this._clearSelection(),this._allIds=await this.queryAllIds(),!this._table&&this._layer){let e=this._layer.popupTemplate?.fieldInfos,t=this._getColumnTemplates(this._layer.id,this._layer.fields,e);this._tableNode&&await this._getTable(this._tableNode,t)}else this._table&&(this._table.view=this.mapView,this._table.layer=this._layer);await this._initLayerRefresh(),this._checkEditEnabled(this._layer),this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,this._table.autoSaveEnabled=this.enableTableAutosave,await this._table.when(),setTimeout(()=>{this._loaded||this.finishLoading()},1e3),await c.once(()=>this._table?.state==="loaded").then(async()=>{await this.finishLoading()}))}async finishLoading(){try{this._loaded=!0,this._table?.highlightIds.removeAll(),this._table.objectIds.removeAll(),this._resetColumnTemplates(),this._showOnlySelected=!1,await this._handleDefaults(),await this._sortTable(),await this._initToolInfos(),["esri-feature-table","esri-widget"].forEach(e=>{this._tableNode&&!this._tableNode.classList.contains(e)&&this._tableNode.classList.add(e)})}catch(e){console.log(e)}}async _initLayerRefresh(){this._refreshHandle&&this._refreshHandle.remove(),this._layer&&(this._refreshHandle=this._layer.on("refresh",e=>{e.dataChanged&&this._updateAllIds()}))}async _updateAllIds(){let e=await this.queryAllIds(),t=this.selectedIds.filter(i=>this._allIds.indexOf(i)>-1);(JSON.stringify(e)!==JSON.stringify(this._allIds)||JSON.stringify(this.selectedIds)!==JSON.stringify(t))&&(this._allIds=e,this.selectedIds=t,await this._refresh())}async _handleDefaults(){if(!this._defaultOidHonored&&this.defaultOid?.length>0&&this.defaultOid[0]>-1&&this._table&&(await this._selectDefaultFeature(this.defaultOid),this._defaultOidHonored=!0,this.defaultOid=[],this._showOnlySelected=!1,this._toggleShowSelected()),!this._defaultGlobalIdHonored&&this.defaultGlobalId&&this.defaultGlobalId?.length>0&&this._table&&this._layer){let e=await O(this.defaultGlobalId,this._layer),t=e?.length>0?e.map(i=>Number(i.getObjectId())):void 0;t&&await this._selectDefaultFeature(t),this._defaultGlobalIdHonored=!0,this.defaultGlobalId=[],this._showOnlySelected=!1,this._toggleShowSelected()}}_initColumnsInfo(e){let t=this._table?.columns.reduce((s,a)=>((!e||e?.indexOf(a.name)>-1)&&(s[a.name]=!a.hidden),s),{}),i=this._table?.columns.map(s=>s.name);(e&&i?e.filter(s=>i.indexOf(s)<0):[]).forEach(s=>{t[s]=!0}),this._columnsInfo=e?e.reduce((s,a)=>(s[a]=t[a],s),{}):t}async _selectDefaultFeature(e){e.length>0&&this._table?.highlightIds.addMany(e)}_checkEditEnabled(e){this._editEnabled=!!(e?.editingEnabled&&e?.capabilities?.operations.supportsUpdate),this._deleteEnabled=!!(e?.editingEnabled&&e?.capabilities?.operations.supportsDelete)}async _sortTable(){let e=this._layer?.objectIdField,t="desc",i,s=this.mapInfo?.layerOptions?.layers,a=this._layer?.id;s&&s.length>0&&a!==void 0&&(i=s.filter(l=>l.id===a),i&&i.length>0&&(i=i[0],i.sortField&&i.fields?.includes(i.sortField)&&(e=i.sortField),t=i?.sortOrder?i.sortOrder:"desc")),this._table&&this._layer&&(await this._table.when(),await this._layer.when(()=>{e&&this._table?.sortColumn(e,t)}))}async _handleFilterListReset(){this._filterActive=!1,this._updateShareUrl(),await this._searchFullText()}async _handleFilterUpdate(e){if(this._floorExpression&&this._layer){let t=this._layer.definitionExpression,i=new RegExp(`${this._floorField} = ['].+[']`,"gm");this._layer.definitionExpression=t&&this._floorField&&t.indexOf(`${this._floorField} = '`)>-1?t.replace(i,this._floorExpression):t?`${t} AND (${this._floorExpression})`:this._floorExpression}this._filterActive=e,this._updateShareUrl(),await this._searchFullText()}_handleTableOnMapExtent(){this._table&&(this._filterByExtentHandle=c.when(()=>this.mapView?.stationary,async()=>{if(this._shouldUpdateTableOnExtentChange&&this.appLayout==="splitView"){if(await new Promise(e=>setTimeout(e,800)),this._table&&this.mapView){this._table.filterGeometry=this.mapView.extent;let e={geometry:this.mapView.extent},t=this._layer&&await this._layer.queryObjectIds(e),i=this.selectedIds.filter(a=>!t?.includes(a)),s=this._outOFExtentOids.filter(a=>t?.includes(a));i.length>0&&(this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._table.highlightIds.removeMany(i),this._outOFExtentOids=[...this._outOFExtentOids,...i]),s.length>0&&(this.selectedIds=[...new Set([...this.selectedIds,...s])],this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(this.selectedIds.reverse()),this._outOFExtentOids=this._outOFExtentOids.filter(a=>!s.includes(a)))}this._allIds=await this.queryAllIds()}},{initial:!0}))}async _closeFilter(){this._allIds=await this.queryAllIds()}async queryAllIds(){if(this._layer){let e=this._layer.createQuery();return e.geometry=this._filterByExtentHandle&&this.mapView?this.mapView.extent:null,e.where=this._layer.definitionExpression||"1=1",await this._layer.queryObjectIds(e)}else return[]}async _mapClicked(e){let t={include:this._layer},i=await this.mapView?.hitTest(e.screenPoint,t);if(i&&i.results.length>0){let s=i.results;if(this.featureSelectionMode==="single"){this._table?.highlightIds.removeAll();let a=s[0].graphic.getObjectId();if(a){let l=this._table?.highlightIds.indexOf(a);l!==void 0&&l<0&&this._table?.highlightIds.add(a)}}else s.forEach(a=>{let l=Number(a.graphic.getObjectId()),h=this._table?.highlightIds.indexOf(l);h&&h<0&&l&&this._table?.highlightIds.add(l)});this._showOnlySelected&&this._table&&(this._table.filterBySelectionEnabled=!0)}else await this.clearSelection()}async _selectAll(){let e=this._allIds,t=e.filter(i=>this.selectedIds.indexOf(i)<0);await this._validateActiveEdits(t,this.selectedIds)&&this._table?(this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(e),this.selectedIds=e,this._finishOnChange(),this._selectAllActive=!0):this._skipEditCheck=!1}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._table&&(this._table.filterBySelectionEnabled=this._showOnlySelected)}_clearSelection(){this._relatedFeatureTable||(this.selectedIds=[],this._outOFExtentOids=[],this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._table?.highlightIds.removeAll(),this._clearHighlights(),this._table?.rowHighlightIds.removeAll()),this._relatedFeatureTable&&(this._relatedFeatureTable?.highlightIds.removeAll(),this.selectedRelatedIds=[]),this._finishOnChange()}async _switchSelected(){let e=[...this.selectedIds],t=this._allIds.reduce((i,s)=>(e.indexOf(s)<0&&i.push(s),i),[]).sort((i,s)=>i-s);await this._validateActiveEdits(t,e)&&this._table?(this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(t),this.selectedIds=t,this._finishOnChange()):this._skipEditCheck=!1}async _exportToCSV(){let e=this._relatedFeatureTable?this._relatedFeatureTable.layer:this._layer;if(!e)return;let t={},i=this._getIds();if(this._relatedFeatureTable?.tableParent&&this._relatedFeatureTable.highlightIds.length===0){let l=this._relatedFeatureTable.tableParent.highlightIds?.getItemAt(0);if(l!==void 0){let h=await this._queryRelatedFeatures(),n=[];h&&h[l]?.features&&(h[l].features.forEach(r=>{r.attributes&&n.push(r.attributes[e.objectIdField])}),i=n.length>0?n:[])}}t[e.id]={selectionSetNames:[e.title||""],ids:i,layer:e};let s=this._relatedFeatureTable??this._table;if(!s)return;let a=s&&s.columns.toArray().reduce((l,h)=>{if(!h.hidden){let n=h?.name||h?.fieldName;n&&l.push(n.toLocaleLowerCase())}return l},[]);this._updateToolInfoLoading("export",!0),this._csvExporting=!0,this.mapView?.map&&await $(this.mapView.map,t,!1,!1,!0,a,!0,!0),this._updateToolInfoLoading("export",!1),this._csvExporting=!1}async _queryRelatedFeatures(){let e=this._relatedFeatureTable?this._relatedFeatureTable?this._relatedFeatureTable.layer:this._relatedFeatureTable.tableParent?.layer:this._layer,t=this._relatedFeatureTable?.tableParent?.highlightIds?.items[0],i=this._relatedFeatureTable?.tableParent?.layer,s=e?.relationships?.find(l=>i.relationships?.some(h=>h.id===l.id)),a=new M({objectIds:[t],outFields:["*"],relationshipId:s?.id});return t&&a&&await i.queryRelatedFeatures(a).catch(async l=>{console.error(l)})}_updateToolInfoLoading(e,t){this._toolInfos.some(i=>i?.icon===e?(i.loading=t,!0):!1)}async _refresh(e){if(await this._validateActiveEdits([],this.selectedIds)){this._table&&await this._table.refresh(),this._relatedFeatureTable&&await this._relatedFeatureTable.refresh(),this._allIds=await this.queryAllIds();let t=this._getSelectedLayer(this.selectedRelatedIds);if(t&&this.relatedRecordToggled.emit(t),!e){let i=this._getSelectedIds();this.featureSelectionChange.emit(i)}}}_getSelectedIds(){let e;return this._relatedFeatureTable?this.selectedRelatedIds.length>0?e=this.selectedRelatedIds:e=this._relatedFeatureTable.tableParent?.highlightIds.toArray()??[]:e=this.selectedIds,e}_getSelectedLayer(e){let t;return this._relatedFeatureTable?e.length>0?t=this._relatedFeatureTable.layer:t=this._relatedFeatureTable.tableParent?.layer:t=this._layer,t}async _clearSearchText(){if(this._searchNode.value){this._searchNode.value.value="";let e={target:{value:""}};await this._searchTextChanged(e)}}async _zoom(){this._layer&&this.mapView&&await y(this.selectedIds,this._selectedLayerView,this.mapView,!0,void 0,this.zoomToScale)}async _layerSelectionChanged(e){let t=e.detail[0];if(t!==this._layer?.id||this._featuresEmpty()){this._fetchingData=!0,await this._clearSearchText();let i=this.mapView&&await A(this.mapView,t);i&&await i.when(async()=>{this._selectedLayerView=!i.isTable&&this.mapView?await C(this.mapView,i.id):null,this._table&&this._table?.viewModel?.attachmentsViewOptions?.objectId&&this._table.viewModel.hideAttachmentsView(),this._shouldUpdateTableOnExtentChange=!0,this._layer=i,await this._initToolInfos(),this._getFullTextSearchInfo()})}this._creatingFeature=!1,this._fetchingData=!1}_getColumnTemplates(e,t,i){let s=this._getLayerOption(e),a=this._layer?.attributeTableTemplate?.elements,l=[];a?.length>0&&this.honorMapFieldSettings&&(l=a.map(r=>r.fieldName));let h=s?.fields&&s?.fieldOrder?s.fieldOrder.filter(r=>s?.fields&&s.fields.indexOf(r)>-1):l.length>0?l:void 0,n;return t&&(n=t.reduce((r,d)=>{let u={type:"field",fieldName:d.name,label:this.getFieldLabel(d,i),menuConfig:this._getMenuConfig(d.name)};return s&&s.fields&&s?.fields?.length>0?s.fields.indexOf(d.name)>-1&&r.push(u):l.length>0?l.indexOf(d.name)>-1&&r.push(u):r.push(u),r},[])),n?h?n?.sort(this._sortFields.bind(this,h)):n:[]}updateRelatedAttachmentColumns(){let e=this._getLayerOption(this._layer?.id||""),t=this.hasAttachmentsEnabled(this._layer),i=!0,s="attachments",a=(e?.extraFields||[]).reduce((h,n)=>(n.startsWith("related:")?h.related.push(n.split("related:")[1]):h.extra.push(n),h),{related:[],extra:[]}),l=a.extra.some(h=>h.toLowerCase()===s);a&&(t=l&&t,i=a.related.length>0,this._table?.columns.forEach(h=>{h.fieldName.startsWith("EsriFeatureTableRelationshipColumn")&&(h.hidden=!a.related.includes(h.effectiveLabel)),h.fieldName.startsWith("EsriFeatureTableAttachmentsColumn")&&(h.hidden=!a.extra.some(n=>n.toLowerCase()===h.effectiveLabel.toLowerCase()))})),this._table.relatedRecordsEnabled=i,this._table.attachmentsEnabled=t}getFieldLabel(e,t){let i=e.alias?e.alias:e.name;return t?.some(s=>s.fieldName===e.name?(i=s.label,!0):!1),i||e.name}_sortFields(e,t,i){return e?.indexOf(t.fieldName)-e.indexOf(i.fieldName)}_getMenuConfig(e){return{items:[{label:this._translations.hideField,icon:"view-hide",autoCloseMenu:!0,clickFunction:()=>{this._handleHideClick(e)}}]}}_handleHideClick(e){this._columnsInfo&&this._table&&(this._columnsInfo[e]=!1,this._table.hideColumn(e),this._table.tableTemplate&&this._table.tableTemplate.columnTemplates.forEach(t=>{t.fieldName===e&&(t.visible=!1)}))}};E("layer-table",I);return I},"widgets/FeatureTable","core/reactiveUtils","rest/support/RelationshipQuery","widgets/FeatureTable/support/TableTemplate",a,c,d,e,h)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import a from"./X5EABWHE.js";export default $arcgis.t(([{k:i}])=>{function w(e,t){let r=[];return e.forEach(n=>{t.has(n.id)&&r.push(n)}),r}function m(e,t,r){if(t<1||e.length<t)return{cards:[],paging:{start:t,num:0,nextStart:-1,total:e.length}};let n=Math.min(t+r,e.length+1),s=n<e.length?n:-1;return{cards:e.slice(t-1,n-1),paging:{start:t,num:n-t,nextStart:s,total:e.length}}}function g(e,t){let r=d(e);return l(r,t)}function l(e,t){let r=[];return t.forEach(n=>{let s=c(n);s&&e.indexOf(s)>=0&&n.relatedSolutions&&(r=r.concat(n.relatedSolutions))}),new Set(r)}function c(e){let t="solutionid-",r=e.typeKeywords.filter(s=>s.startsWith(t)),n=null;return Array.isArray(r)&&r.length>0&&(n=r[0].substring(t.length)),n}function d(e){let t=[];return e?(e.forEach(r=>{let n=c(r);n&&t.push(n)}),t=Array.from(new Set(t)),t):[]}function p(e){let t="solutionversion-",r=(e.typeKeywords||[]).reduce((n,s)=>(s.startsWith(t)&&(n=Number(s.replace(t,""))),n),-1);return isNaN(r)?-1:r}function y(e,t,r){let n,s=r==="asc"?1:-1;switch(t){case"created":n=(a,o)=>s*(a.createdMs<o.createdMs?-1:a.createdMs>o.createdMs?1:0);break;case"numviews":n=(a,o)=>s*(a.numViews<o.numViews?-1:a.numViews>o.numViews?1:0);break;case"title":n=(a,o)=>s*(a.title.toLowerCase()<o.title.toLowerCase()?-1:a.title.toLowerCase()>o.title.toLowerCase()?1:0);break;default:n=()=>0;break}return e.sort(n),e}function u(e){return e.toLowerCase().replace(/\s+/g,"-")}function b(e,t){return e.find(r=>u(r.title)===t||t===r.id)}function C(e,t){let r="solutionid-";return e.find(n=>i(n.typeKeywords,r)===t)}function S(e,t){let r=e.find(n=>t===n.deployCommonId);return u(r.title)}return{a:w,b:m,c:g,d:p,e:y,f:u,g:b,h:C,i:S}},a)
2
+ import a from"./QKJ4PGBO.js";export default $arcgis.t(([{k:i}])=>{function w(e,t){let r=[];return e.forEach(n=>{t.has(n.id)&&r.push(n)}),r}function m(e,t,r){if(t<1||e.length<t)return{cards:[],paging:{start:t,num:0,nextStart:-1,total:e.length}};let n=Math.min(t+r,e.length+1),s=n<e.length?n:-1;return{cards:e.slice(t-1,n-1),paging:{start:t,num:n-t,nextStart:s,total:e.length}}}function g(e,t){let r=d(e);return l(r,t)}function l(e,t){let r=[];return t.forEach(n=>{let s=c(n);s&&e.indexOf(s)>=0&&n.relatedSolutions&&(r=r.concat(n.relatedSolutions))}),new Set(r)}function c(e){let t="solutionid-",r=e.typeKeywords.filter(s=>s.startsWith(t)),n=null;return Array.isArray(r)&&r.length>0&&(n=r[0].substring(t.length)),n}function d(e){let t=[];return e?(e.forEach(r=>{let n=c(r);n&&t.push(n)}),t=Array.from(new Set(t)),t):[]}function p(e){let t="solutionversion-",r=(e.typeKeywords||[]).reduce((n,s)=>(s.startsWith(t)&&(n=Number(s.replace(t,""))),n),-1);return isNaN(r)?-1:r}function y(e,t,r){let n,s=r==="asc"?1:-1;switch(t){case"created":n=(a,o)=>s*(a.createdMs<o.createdMs?-1:a.createdMs>o.createdMs?1:0);break;case"numviews":n=(a,o)=>s*(a.numViews<o.numViews?-1:a.numViews>o.numViews?1:0);break;case"title":n=(a,o)=>s*(a.title.toLowerCase()<o.title.toLowerCase()?-1:a.title.toLowerCase()>o.title.toLowerCase()?1:0);break;default:n=()=>0;break}return e.sort(n),e}function u(e){return e.toLowerCase().replace(/\s+/g,"-")}function b(e,t){return e.find(r=>u(r.title)===t||t===r.id)}function C(e,t){let r="solutionid-";return e.find(n=>i(n.typeKeywords,r)===t)}function S(e,t){let r=e.find(n=>t===n.deployCommonId);return u(r.title)}return{a:w,b:m,c:g,d:p,e:y,f:u,g:b,h:C,i:S}},a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as S}from"./BU5PIAGS.js";import"./NP7POZTI.js";import h from"./ZP6VPBP4.js";import e from"./XXT542UR.js";import c from"./X5EABWHE.js";import"./2B4SGB3I.js";import"./YKQDHR27.js";import"./J75MHJID.js";import b from"./CEP54NLT.js";import a from"./YVNP437O.js";import{a as $}from"./R67EKKSL.js";import"./BVWAUO73.js";import"./K3DQKY7V.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import{b as v}from"./KIUBUHVM.js";import{E as p,F as r,G as I,I as f,h as y,i as l,l as m,q as d,t as g}from"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([F,x,P,,{c:w,j:M},{l:L},,{f:u}])=>{function k(n){return n?.indexOf("http://")!==-1}function b(n){return k(n)?n.replace(/^http:\/\//,"https://"):n}function T(n,e,i){return i&&i.forEach(a=>{n.allLayers.forEach(t=>{t&&t.url===a.sourceUrl&&(t.url=b(a.proxyUrl),t.portalItem&&t.portalItem.when(()=>{t.portalItem.url=b(a.proxyUrl)}),e.request?.interceptors?.push({urls:a.sourceUrl,before:s=>{s.url&&s.url===a.sourceUrl&&(s.url=b(a.proxyUrl))}}))})}),n}var V=y`@layer{:host{display:block;--calcite-label-margin-bottom: 0;--calcite-block-padding: 0}.map-height{height:calc(100% - 53px)}.height-full{height:100%}.height-49-px{height:49px}.box-shadow{box-shadow:none!important}.visibility-hidden-1{visibility:hidden;height:1px}.hidden{visibility:hidden!important}.display-flex{display:flex}.display-none{display:none}.display-block{display:block}.absolute-right{position:absolute;right:0;left:unset}.esri-ui-inner-container.esri-ui-corner-container{direction:ltr}html[dir=rtl] .absolute-right{left:0;right:unset}.panel-header-override{--calcite-panel-header-content-space: 0px;--calcite-internal-panel-action-spacing: 0px !important}@media only screen and (max-width:1024px){.esri-zoom{display:none!important}}calcite-action-bar{--calcite-internal-action-bar-gap: 0px;--calcite-internal-action-bar-padding: 0px}}`,_=class extends I{constructor(){super(),this.defaultWebmapId="",this.defaultLayerId="",this.enableHome=!1,this.enableLegend=!1,this.enableLayerList=!0,this.enableFloorFilter=!1,this.enableFullscreen=!1,this.enableShare=!1,this.enableMapLayerPicker=!1,this.enableMapPicker=!1,this.enableSingleExpand=!1,this.enableSearch=!1,this.enableBasemap=!1,this.featureSelectionMode="multiple",this.hide=!1,this.zoomToolsSize="m",this.mapInfos=[],this.mapWidgetsIndex=0,this.mapWidgetsPosition="top-leading",this.mobileMapWidgetsPosition="top-right",this.mapWidgetsSize="m",this.stackTools=!1,this.mapToolsOrder=[],this.mobileToolsOrder=[],this.isMapLayout=!1,this.shareIncludeEmbed=!1,this.shareIncludeSocial=!1,this.selectedFeaturesIds=[],this.showOnlyUpdatableLayers=!1,this.isMobile=!1,this.enableSelectionTool=!1,this.visibilityIcon="eyeball",this._configLayerOrderDefined=!1,this._translations=$({name:"map-card",blocking:!0}),this._toolInfos=[],this._filterActive=!1,this._layerIds=[],this._enabledLayerIds=[],this._defaultWebmapHonored=!1,this._loadedId="",this._mapDiv=p(),this._mapPicker=p(),this._mapTools=p(),this._mobMapTools=p(),this._mapLayerPicker=p(),this._selectedWebMapId="",this._isValidWebMap=!0,this.mapChanged=d(),this.beforeMapChanged=d(),this.toggleFilter=d(),this.clearSelection=d(),this.editMultipleFeatures=d(),this.listenOn(window,"mapInfoChange",this.mapInfoChange),this.listenOn(window,"noLayersFound",this.noLayersFound),this.listenOn(window,"layerSelectionChange",this.layerSelectionChange),this.listenOn(window,"idsFound",this._idsFound),this.enableSingleExpand=!0,this.stackTools=!0,S(window)}static{this.properties={appLayout:1,appProxies:1,defaultWebmapId:1,defaultLayerId:1,enableHome:5,enableLegend:5,enableLayerList:5,enableFloorFilter:5,enableFullscreen:5,enableShare:5,enableMapLayerPicker:5,enableMapPicker:5,enableSingleExpand:5,enableSearch:5,enableBasemap:5,featureSelectionMode:1,basemapConfig:0,hide:5,zoomToolsSize:1,mapInfos:0,mapWidgetsIndex:9,mapWidgetsPosition:1,mobileMapWidgetsPosition:1,mapWidgetsSize:1,mapView:0,stackTools:5,theme:1,mapToolsOrder:0,mobileToolsOrder:0,isMapLayout:5,shareIncludeEmbed:5,shareIncludeSocial:5,selectedFeaturesIds:0,selectedLayer:0,zoomToScale:9,showOnlyUpdatableLayers:5,isMobile:5,mapInfo:0,enableSelectionTool:5,visibilityIcon:1,_configLayerOrderDefined:16,_translations:16,_searchConfiguration:16,_webMapInfo:16,_toolInfos:16,_filterActive:16,_mapDivHeight:16,_mapDivWidth:16,_layerIds:16}}static{this.styles=V}static{this.shadowRootOptions=g}willUpdate(e){e.has("appLayout")&&this.appLayoutWatchHandler(),e.has("mapView")&&this.mapViewWatchHandler(),e.has("mapInfo")&&this.mapInfoWatchHandler(),e.has("selectedFeaturesIds")&&this.selectedFeaturesIdsWatchHandler()}appLayoutWatchHandler(){this._updateShareUrl()}async mapInfoWatchHandler(){this._configLayerOrderDefined="configLayerOrder"in(this.mapInfo?.layerOptions||{}),this._enabledLayerIds=L(this.mapInfo?.layerOptions?.layers||[],this.mapInfo?.layerOptions?.configLayerOrder)}async mapViewWatchHandler(){this.mapView&&this._updateShareUrl()}async selectedFeaturesIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions()}async resetFilter(){this._filterActive=!1,this._updateShareUrl()}async updateFilterState(e){this._filterActive=e,this._updateShareUrl()}async updateLayer(){this._mapLayerPicker.value&&this._mapLayerPicker.value.updateLayer()}async mapInfoChange(e){this._selectedWebMapId=e.detail.id,await this._loadMap(e.detail)}noLayersFound(){this.selectedLayer=void 0,this.selectedFeaturesIds=[]}layerSelectionChange(){setTimeout(()=>{this._initToolInfos()},50)}_idsFound(e){this._layerIds=e.detail}async load(){this._initToolInfos(),this._mapSizeObserver||(this._mapSizeObserver=new ResizeObserver(()=>{this._mapDivWidth&&this._mapDiv.value&&(this._mapDivWidth=this._mapDiv.value.offsetWidth)}))}render(){let e=this.hide?"visibility-hidden-1":"",i=this.theme==="dark"?"calcite-mode-dark":"calcite-mode-light",a="height-full",t=this.isMapLayout?"":"display-none",s=this._isValidWebMap?"":"hidden",h=this.isMobile?"":"hidden",o=this.enableMapPicker&&this.mapInfos.length>1,c=this.enableMapLayerPicker&&this._layerIds.length>1;return this._handleMapVisibility(),this._validateActiveActions(),l`<calcite-panel class="height-full width-full panel-header-override">${this._getMapLayerPicker()}${this._getHeaderActions()}<div slot=header-actions-end>${this.enableShare&&this.isMapLayout?this._getShare("share"):void 0}</div><calcite-progress class=${f(t)} value=0></calcite-progress><div class=${`${e} ${a}`}><div class="height-full" ${r(this._mapDiv)}></div></div>${l`<map-tools .basemapConfig=${this.basemapConfig} class=${`box-shadow ${i} ${s}`} .defaultLayerId=${this.defaultLayerId} .enableBasemap=${this.enableBasemap} .enableFloorFilter=${this.enableFloorFilter} .enableFullscreen=${this.enableFullscreen} .enableHome=${this.enableHome} .enableLegend=${this.enableLegend} .enableLayerList=${this.enableLayerList} .enableSearch=${this.enableSearch} .enableSingleExpand=${this.enableSingleExpand} .enableSelectionTool=${this.enableSelectionTool} .isMobile=${this.isMobile} .parentComponentHeight=${this._mapDivHeight} .parentComponentWidth=${this._mapDivWidth} .zoomToolsSize=${this.zoomToolsSize} layout=horizontal .mapView=${this.mapView} .mapWidgetsSize=${this.mapWidgetsSize} .position=${this.mapWidgetsPosition} .selectedFeaturesIds=${this.selectedFeaturesIds} .selectedLayer=${this.selectedLayer} .searchConfiguration=${this._searchConfiguration} .stackTools=${this.stackTools} .toolOrder=${this.mapToolsOrder} .visibilityIcon=${this.visibilityIcon} ${r(this._mapTools)}></map-tools><map-tools class=${`box-shadow ${i} ${h}`} .defaultLayerId=${this.defaultLayerId} .enabledLayerIds=${this._enabledLayerIds} .enableMapLayerPicker=${c} .enableMapPicker=${o} .isMobile=${this.isMobile} .zoomToolsSize=${this.zoomToolsSize} layout=vertical .mapInfos=${this.mapInfos} .mapView=${this.mapView} .mapWidgetsSize=${this.mapWidgetsSize} .parentComponentHeight=${this._mapDivHeight} .position=${this.mobileMapWidgetsPosition} .selectedLayer=${this.selectedLayer} .selectedWebMapId=${this._selectedWebMapId} .showOnlyUpdatableLayers=${this.showOnlyUpdatableLayers} .stackTools=${this.stackTools} .toolOrder=${this.mobileToolsOrder} ${r(this._mobMapTools)}></map-tools>`}</calcite-panel>`}updated(){this._mapDivHeight=this._mapDiv.value?.offsetHeight??0,document.onclick=e=>this._handleDocumentClick(e)}loaded(){this._mapDiv.value&&this._mapSizeObserver?.observe(this._mapDiv.value),this._updateShareUrl()}async _loadMap(e){let i=!this._defaultWebmapHonored&&this.defaultWebmapId,a=this.mapInfos?.filter(o=>o.id===this.defaultWebmapId),t=JSON.stringify(e)!==JSON.stringify(this._webMapInfo);this._webMapInfo=i&&a?a[0]:!e?.id&&this.mapInfos.length>0?this.mapInfos[0]:e;let s=this._webMapInfo.id,h=i&&e?.id===this.defaultWebmapId;if(this._loadedId!==s&&!i||h){let o=new P({portalItem:{id:s}});try{o&&await o.load(),this.appProxies&&o&&await T(o,F,this.appProxies),this.mapView=new x({container:this._mapDiv.value,map:o,resizeAlign:"center"}),this._loadedId=s,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapView&&await this.mapView.when(()=>{this.mapView&&(this._mapDivWidth=this._mapDiv.value&&this._mapDiv.value.offsetWidth,this._mapTools.value&&this.mapView.ui.add(this._mapTools.value,{position:this.mapWidgetsPosition,index:this.mapWidgetsIndex}),this._mobMapTools.value&&this.mapView.ui.add(this._mobMapTools.value,{position:this.mobileMapWidgetsPosition,index:this.mapWidgetsIndex}),this._defaultWebmapHonored=h?!0:this._defaultWebmapHonored,this._isValidWebMap=!0,this.mapChanged.emit({id:s,mapView:this.mapView,isValid:!0}),this.isMobile||document.getElementsByClassName("esri-zoom")[0]?.classList.remove("display-none"))})}catch(c){console.error(c),this._loadedId=s,this._isValidWebMap=!1,this.mapChanged.emit({id:s,mapView:void 0,isValid:!1}),document.getElementsByClassName("esri-zoom")[0]?.classList.add("display-none");return}}else i?(this._defaultWebmapHonored=!0,this._mapPicker.value&&this._mapPicker.value.setMapByID(s)):t&&this.mapView&&(this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapChanged.emit({id:s,mapView:this.mapView,isValid:!0}));this._updateShareUrl()}_getMapLayerPicker(){let e=this.isMapLayout?"header-actions-start":"",i=this.mapInfos?.length>1?"":"display-none",a=this.isMapLayout?"height-0":"width-full",t="display-flex",s=this.isMapLayout?"":"display-none";return l`${!this.isMobile&&l`<div slot=${e??m}><map-picker class=${`${i} ${a}`} id=map-picker .isMapLayout=${this.isMapLayout} .mapInfos=${this.mapInfos} .selectedWebMapId=${this._selectedWebMapId} ${r(this._mapPicker)}></map-picker></div>`||""}<div slot=header-actions-start class=${`mapView-header display-flex ${s}`} id=solutions-map-layer-picker-container><div class=${`border-end ${t}`}>${this.mapView&&l`<map-layer-picker appearance=transparent .configLayerOrderDefined=${this._configLayerOrderDefined} .defaultLayerId=${this.defaultLayerId} display=inline-flex .enabledLayerIds=${this._enabledLayerIds} height=50 .isMobile=${this.isMobile} .mapView=${this.mapView} .showOnlyUpdatableLayers=${this.showOnlyUpdatableLayers} placeholder-icon=layers scale=l .selectedIds=${this.selectedLayer?[this.selectedLayer.id]:[]} show-single-layer-as-label show-tables show-tables-disabled type=dropdown ${r(this._mapLayerPicker)}></map-layer-picker>`||""}</div></div>`}_getHeaderActions(){return l`<div slot=header-content><calcite-action-bar class=${f("display-flex")} expand-disabled expanded id=${this._getId("bar")??m} layout=horizontal><calcite-action-group>${this.isMapLayout?this._getActions():void 0}</calcite-action-group></calcite-action-bar></div>`}_getShare(e){return l`<div class="share-action" id=${this._getId(e)??m}>${this.mapView&&l`<instant-apps-social-share class="instant-app-share" .embed=${this.shareIncludeEmbed} flip-rtl popover-button-icon-scale=s scale=m share-button-color=neutral share-button-type=action .socialMedia=${this.shareIncludeSocial} .view=${this.mapView} ${r(i=>{i&&(this._shareNode=i,this._updateShareUrl())})}></instant-apps-social-share>`||""}${this._getToolTip("bottom",`map-${e}`,this._translations?.share)}</div>`}_updateShareUrl(){let e=this._shareNode?.shareUrl;if(!e)return;let i=new URL(e);this._loadedId?i.searchParams.set("webmap",this._loadedId):i.searchParams.delete("webmap"),this.selectedLayer?.id?i.searchParams.set("layer",this.selectedLayer.id):i.searchParams.delete("layer"),this.selectedFeaturesIds?.length>0?i.searchParams.set("oid",this.selectedFeaturesIds.join(",")):i.searchParams.delete("oid"),this.appLayout&&i.searchParams.set("applayout",this.appLayout),this._shareNode&&(this._shareNode.autoUpdateShareUrl=!1,this._shareNode.shareUrl=i.href)}_initToolInfos(){let e=this.selectedFeaturesIds.length>0,i=this.selectedFeaturesIds.length<2||this.selectedFeaturesIds.length>u,a=this.featureSelectionMode==="multiple"&&this.selectedLayer?.capabilities?.operations.supportsUpdate,t=[];t.push({active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>{this._toggleFilter()},disabled:!1,toolTip:this._translations.filters}),t.push({active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>{this._zoom()},disabled:!e,toolTip:this._translations.zoom}),a&&t.push({active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>this.editMultipleFeatures.emit(this.selectedFeaturesIds),disabled:i,toolTip:this._translations.editMultiple}),t.push({active:!1,icon:"refresh",indicator:!1,label:this._translations.refresh,func:()=>this.selectedLayer?.refresh(),disabled:!1,toolTip:this._translations.refresh}),t.push({active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>this.clearSelection.emit(),disabled:!e,toolTip:this._translations.clearSelection}),this._toolInfos=[...t]}_validateActiveActions(){let e=["filter"];this._toolInfos?.forEach(i=>{i&&e.indexOf(i.icon)>-1&&i.icon==="filter"&&(i.indicator=this._filterActive)})}_handleMapVisibility(){if(this._mapDiv.value){let e=this._mapDiv.value.getElementsByClassName("esri-view-surface")[0],i=this._mapDiv.value.getElementsByClassName("esri-attribution")[0];this._isValidWebMap?(e?.classList.remove("hidden"),i?.classList.remove("hidden")):(e?.classList.add("hidden"),i?.classList.add("hidden"))}}_validateEnabledActions(){let e=this.selectedFeaturesIds.length>0,i=this.selectedFeaturesIds.length<2||this.selectedFeaturesIds.length>u,a=["zoom-to-object","pencil","erase"];this._toolInfos?.forEach(t=>{t&&a.indexOf(t.icon)>-1&&(t.disabled=t.icon==="pencil"?i:!e,t.toolTip=t.icon==="pencil"?this.selectedFeaturesIds.length>u?this._translations.featureEditLimitNotice:this._translations.editMultiple:t.toolTip)})}_handleDocumentClick(e){e.target.tagName!=="MAP-PICKER"&&this._mapPicker.value&&this._mapPicker.value.close()}async _zoom(){if(this.selectedLayer&&this.mapView){let e=await w(this.mapView,this.selectedLayer.id);e&&await M(this.selectedFeaturesIds,e,this.mapView,!0,void 0,this.zoomToScale)}}async _toggleFilter(){this.toggleFilter.emit()}_getActions(){return this._toolInfos?.reduce((e,i)=>(i&&e.push(this._getAction(i.active,i.icon,i.indicator,i.label,i.func,i.disabled,i.loading,i.toolTip)),e),[])}_getToolTip(e,i,a){return l`<calcite-tooltip .placement=${e} .referenceElement=${i}><span>${a}</span></calcite-tooltip>`}_getAction(e,i,a,t,s,h,o,c){let W=this.selectedLayer===void 0?!0:h;return l`<calcite-action .active=${e} appearance=solid .disabled=${W} .icon=${i} .id=${`map-${i}`} .indicator=${a} .label=${t} .loading=${o} @click=${s} .text=${t} text-enabled></calcite-action>${this._getToolTip("auto",`map-${i}`,c)}`}_getId(e){return`solutions-action-${e}`}};v("map-card",_);return _},"config","views/MapView","WebMap",a,b,c,e,h)
2
+ import{a as S}from"./BU5PIAGS.js";import"./NP7POZTI.js";import h from"./BGXRCU7G.js";import e from"./UYY6JODL.js";import c from"./QKJ4PGBO.js";import"./2B4SGB3I.js";import"./YKQDHR27.js";import"./J75MHJID.js";import b from"./CEP54NLT.js";import a from"./YVNP437O.js";import{a as $}from"./R67EKKSL.js";import"./BVWAUO73.js";import"./K3DQKY7V.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import{b as v}from"./KIUBUHVM.js";import{E as p,F as r,G as I,I as f,h as y,i as l,l as m,q as d,t as g}from"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([F,x,P,,{c:w,j:M},{l:L},,{f:u}])=>{function k(n){return n?.indexOf("http://")!==-1}function b(n){return k(n)?n.replace(/^http:\/\//,"https://"):n}function T(n,e,i){return i&&i.forEach(a=>{n.allLayers.forEach(t=>{t&&t.url===a.sourceUrl&&(t.url=b(a.proxyUrl),t.portalItem&&t.portalItem.when(()=>{t.portalItem.url=b(a.proxyUrl)}),e.request?.interceptors?.push({urls:a.sourceUrl,before:s=>{s.url&&s.url===a.sourceUrl&&(s.url=b(a.proxyUrl))}}))})}),n}var V=y`@layer{:host{display:block;--calcite-label-margin-bottom: 0;--calcite-block-padding: 0}.map-height{height:calc(100% - 53px)}.height-full{height:100%}.height-49-px{height:49px}.box-shadow{box-shadow:none!important}.visibility-hidden-1{visibility:hidden;height:1px}.hidden{visibility:hidden!important}.display-flex{display:flex}.display-none{display:none}.display-block{display:block}.absolute-right{position:absolute;right:0;left:unset}.esri-ui-inner-container.esri-ui-corner-container{direction:ltr}html[dir=rtl] .absolute-right{left:0;right:unset}.panel-header-override{--calcite-panel-header-content-space: 0px;--calcite-internal-panel-action-spacing: 0px !important}@media only screen and (max-width:1024px){.esri-zoom{display:none!important}}calcite-action-bar{--calcite-internal-action-bar-gap: 0px;--calcite-internal-action-bar-padding: 0px}}`,_=class extends I{constructor(){super(),this.defaultWebmapId="",this.defaultLayerId="",this.enableHome=!1,this.enableLegend=!1,this.enableLayerList=!0,this.enableFloorFilter=!1,this.enableFullscreen=!1,this.enableShare=!1,this.enableMapLayerPicker=!1,this.enableMapPicker=!1,this.enableSingleExpand=!1,this.enableSearch=!1,this.enableBasemap=!1,this.featureSelectionMode="multiple",this.hide=!1,this.zoomToolsSize="m",this.mapInfos=[],this.mapWidgetsIndex=0,this.mapWidgetsPosition="top-leading",this.mobileMapWidgetsPosition="top-right",this.mapWidgetsSize="m",this.stackTools=!1,this.mapToolsOrder=[],this.mobileToolsOrder=[],this.isMapLayout=!1,this.shareIncludeEmbed=!1,this.shareIncludeSocial=!1,this.selectedFeaturesIds=[],this.showOnlyUpdatableLayers=!1,this.isMobile=!1,this.enableSelectionTool=!1,this.visibilityIcon="eyeball",this._configLayerOrderDefined=!1,this._translations=$({name:"map-card",blocking:!0}),this._toolInfos=[],this._filterActive=!1,this._layerIds=[],this._enabledLayerIds=[],this._defaultWebmapHonored=!1,this._loadedId="",this._mapDiv=p(),this._mapPicker=p(),this._mapTools=p(),this._mobMapTools=p(),this._mapLayerPicker=p(),this._selectedWebMapId="",this._isValidWebMap=!0,this.mapChanged=d(),this.beforeMapChanged=d(),this.toggleFilter=d(),this.clearSelection=d(),this.editMultipleFeatures=d(),this.listenOn(window,"mapInfoChange",this.mapInfoChange),this.listenOn(window,"noLayersFound",this.noLayersFound),this.listenOn(window,"layerSelectionChange",this.layerSelectionChange),this.listenOn(window,"idsFound",this._idsFound),this.enableSingleExpand=!0,this.stackTools=!0,S(window)}static{this.properties={appLayout:1,appProxies:1,defaultWebmapId:1,defaultLayerId:1,enableHome:5,enableLegend:5,enableLayerList:5,enableFloorFilter:5,enableFullscreen:5,enableShare:5,enableMapLayerPicker:5,enableMapPicker:5,enableSingleExpand:5,enableSearch:5,enableBasemap:5,featureSelectionMode:1,basemapConfig:0,hide:5,zoomToolsSize:1,mapInfos:0,mapWidgetsIndex:9,mapWidgetsPosition:1,mobileMapWidgetsPosition:1,mapWidgetsSize:1,mapView:0,stackTools:5,theme:1,mapToolsOrder:0,mobileToolsOrder:0,isMapLayout:5,shareIncludeEmbed:5,shareIncludeSocial:5,selectedFeaturesIds:0,selectedLayer:0,zoomToScale:9,showOnlyUpdatableLayers:5,isMobile:5,mapInfo:0,enableSelectionTool:5,visibilityIcon:1,_configLayerOrderDefined:16,_translations:16,_searchConfiguration:16,_webMapInfo:16,_toolInfos:16,_filterActive:16,_mapDivHeight:16,_mapDivWidth:16,_layerIds:16}}static{this.styles=V}static{this.shadowRootOptions=g}willUpdate(e){e.has("appLayout")&&this.appLayoutWatchHandler(),e.has("mapView")&&this.mapViewWatchHandler(),e.has("mapInfo")&&this.mapInfoWatchHandler(),e.has("selectedFeaturesIds")&&this.selectedFeaturesIdsWatchHandler()}appLayoutWatchHandler(){this._updateShareUrl()}async mapInfoWatchHandler(){this._configLayerOrderDefined="configLayerOrder"in(this.mapInfo?.layerOptions||{}),this._enabledLayerIds=L(this.mapInfo?.layerOptions?.layers||[],this.mapInfo?.layerOptions?.configLayerOrder)}async mapViewWatchHandler(){this.mapView&&this._updateShareUrl()}async selectedFeaturesIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions()}async resetFilter(){this._filterActive=!1,this._updateShareUrl()}async updateFilterState(e){this._filterActive=e,this._updateShareUrl()}async updateLayer(){this._mapLayerPicker.value&&this._mapLayerPicker.value.updateLayer()}async mapInfoChange(e){this._selectedWebMapId=e.detail.id,await this._loadMap(e.detail)}noLayersFound(){this.selectedLayer=void 0,this.selectedFeaturesIds=[]}layerSelectionChange(){setTimeout(()=>{this._initToolInfos()},50)}_idsFound(e){this._layerIds=e.detail}async load(){this._initToolInfos(),this._mapSizeObserver||(this._mapSizeObserver=new ResizeObserver(()=>{this._mapDivWidth&&this._mapDiv.value&&(this._mapDivWidth=this._mapDiv.value.offsetWidth)}))}render(){let e=this.hide?"visibility-hidden-1":"",i=this.theme==="dark"?"calcite-mode-dark":"calcite-mode-light",a="height-full",t=this.isMapLayout?"":"display-none",s=this._isValidWebMap?"":"hidden",h=this.isMobile?"":"hidden",o=this.enableMapPicker&&this.mapInfos.length>1,c=this.enableMapLayerPicker&&this._layerIds.length>1;return this._handleMapVisibility(),this._validateActiveActions(),l`<calcite-panel class="height-full width-full panel-header-override">${this._getMapLayerPicker()}${this._getHeaderActions()}<div slot=header-actions-end>${this.enableShare&&this.isMapLayout?this._getShare("share"):void 0}</div><calcite-progress class=${f(t)} value=0></calcite-progress><div class=${`${e} ${a}`}><div class="height-full" ${r(this._mapDiv)}></div></div>${l`<map-tools .basemapConfig=${this.basemapConfig} class=${`box-shadow ${i} ${s}`} .defaultLayerId=${this.defaultLayerId} .enableBasemap=${this.enableBasemap} .enableFloorFilter=${this.enableFloorFilter} .enableFullscreen=${this.enableFullscreen} .enableHome=${this.enableHome} .enableLegend=${this.enableLegend} .enableLayerList=${this.enableLayerList} .enableSearch=${this.enableSearch} .enableSingleExpand=${this.enableSingleExpand} .enableSelectionTool=${this.enableSelectionTool} .isMobile=${this.isMobile} .parentComponentHeight=${this._mapDivHeight} .parentComponentWidth=${this._mapDivWidth} .zoomToolsSize=${this.zoomToolsSize} layout=horizontal .mapView=${this.mapView} .mapWidgetsSize=${this.mapWidgetsSize} .position=${this.mapWidgetsPosition} .selectedFeaturesIds=${this.selectedFeaturesIds} .selectedLayer=${this.selectedLayer} .searchConfiguration=${this._searchConfiguration} .stackTools=${this.stackTools} .toolOrder=${this.mapToolsOrder} .visibilityIcon=${this.visibilityIcon} ${r(this._mapTools)}></map-tools><map-tools class=${`box-shadow ${i} ${h}`} .defaultLayerId=${this.defaultLayerId} .enabledLayerIds=${this._enabledLayerIds} .enableMapLayerPicker=${c} .enableMapPicker=${o} .isMobile=${this.isMobile} .zoomToolsSize=${this.zoomToolsSize} layout=vertical .mapInfos=${this.mapInfos} .mapView=${this.mapView} .mapWidgetsSize=${this.mapWidgetsSize} .parentComponentHeight=${this._mapDivHeight} .position=${this.mobileMapWidgetsPosition} .selectedLayer=${this.selectedLayer} .selectedWebMapId=${this._selectedWebMapId} .showOnlyUpdatableLayers=${this.showOnlyUpdatableLayers} .stackTools=${this.stackTools} .toolOrder=${this.mobileToolsOrder} ${r(this._mobMapTools)}></map-tools>`}</calcite-panel>`}updated(){this._mapDivHeight=this._mapDiv.value?.offsetHeight??0,document.onclick=e=>this._handleDocumentClick(e)}loaded(){this._mapDiv.value&&this._mapSizeObserver?.observe(this._mapDiv.value),this._updateShareUrl()}async _loadMap(e){let i=!this._defaultWebmapHonored&&this.defaultWebmapId,a=this.mapInfos?.filter(o=>o.id===this.defaultWebmapId),t=JSON.stringify(e)!==JSON.stringify(this._webMapInfo);this._webMapInfo=i&&a?a[0]:!e?.id&&this.mapInfos.length>0?this.mapInfos[0]:e;let s=this._webMapInfo.id,h=i&&e?.id===this.defaultWebmapId;if(this._loadedId!==s&&!i||h){let o=new P({portalItem:{id:s}});try{o&&await o.load(),this.appProxies&&o&&await T(o,F,this.appProxies),this.mapView=new x({container:this._mapDiv.value,map:o,resizeAlign:"center"}),this._loadedId=s,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapView&&await this.mapView.when(()=>{this.mapView&&(this._mapDivWidth=this._mapDiv.value&&this._mapDiv.value.offsetWidth,this._mapTools.value&&this.mapView.ui.add(this._mapTools.value,{position:this.mapWidgetsPosition,index:this.mapWidgetsIndex}),this._mobMapTools.value&&this.mapView.ui.add(this._mobMapTools.value,{position:this.mobileMapWidgetsPosition,index:this.mapWidgetsIndex}),this._defaultWebmapHonored=h?!0:this._defaultWebmapHonored,this._isValidWebMap=!0,this.mapChanged.emit({id:s,mapView:this.mapView,isValid:!0}),this.isMobile||document.getElementsByClassName("esri-zoom")[0]?.classList.remove("display-none"))})}catch(c){console.error(c),this._loadedId=s,this._isValidWebMap=!1,this.mapChanged.emit({id:s,mapView:void 0,isValid:!1}),document.getElementsByClassName("esri-zoom")[0]?.classList.add("display-none");return}}else i?(this._defaultWebmapHonored=!0,this._mapPicker.value&&this._mapPicker.value.setMapByID(s)):t&&this.mapView&&(this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapChanged.emit({id:s,mapView:this.mapView,isValid:!0}));this._updateShareUrl()}_getMapLayerPicker(){let e=this.isMapLayout?"header-actions-start":"",i=this.mapInfos?.length>1?"":"display-none",a=this.isMapLayout?"height-0":"width-full",t="display-flex",s=this.isMapLayout?"":"display-none";return l`${!this.isMobile&&l`<div slot=${e??m}><map-picker class=${`${i} ${a}`} id=map-picker .isMapLayout=${this.isMapLayout} .mapInfos=${this.mapInfos} .selectedWebMapId=${this._selectedWebMapId} ${r(this._mapPicker)}></map-picker></div>`||""}<div slot=header-actions-start class=${`mapView-header display-flex ${s}`} id=solutions-map-layer-picker-container><div class=${`border-end ${t}`}>${this.mapView&&l`<map-layer-picker appearance=transparent .configLayerOrderDefined=${this._configLayerOrderDefined} .defaultLayerId=${this.defaultLayerId} display=inline-flex .enabledLayerIds=${this._enabledLayerIds} height=50 .isMobile=${this.isMobile} .mapView=${this.mapView} .showOnlyUpdatableLayers=${this.showOnlyUpdatableLayers} placeholder-icon=layers scale=l .selectedIds=${this.selectedLayer?[this.selectedLayer.id]:[]} show-single-layer-as-label show-tables show-tables-disabled type=dropdown ${r(this._mapLayerPicker)}></map-layer-picker>`||""}</div></div>`}_getHeaderActions(){return l`<div slot=header-content><calcite-action-bar class=${f("display-flex")} expand-disabled expanded id=${this._getId("bar")??m} layout=horizontal><calcite-action-group>${this.isMapLayout?this._getActions():void 0}</calcite-action-group></calcite-action-bar></div>`}_getShare(e){return l`<div class="share-action" id=${this._getId(e)??m}>${this.mapView&&l`<instant-apps-social-share class="instant-app-share" .embed=${this.shareIncludeEmbed} flip-rtl popover-button-icon-scale=s scale=m share-button-color=neutral share-button-type=action .socialMedia=${this.shareIncludeSocial} .view=${this.mapView} ${r(i=>{i&&(this._shareNode=i,this._updateShareUrl())})}></instant-apps-social-share>`||""}${this._getToolTip("bottom",`map-${e}`,this._translations?.share)}</div>`}_updateShareUrl(){let e=this._shareNode?.shareUrl;if(!e)return;let i=new URL(e);this._loadedId?i.searchParams.set("webmap",this._loadedId):i.searchParams.delete("webmap"),this.selectedLayer?.id?i.searchParams.set("layer",this.selectedLayer.id):i.searchParams.delete("layer"),this.selectedFeaturesIds?.length>0?i.searchParams.set("oid",this.selectedFeaturesIds.join(",")):i.searchParams.delete("oid"),this.appLayout&&i.searchParams.set("applayout",this.appLayout),this._shareNode&&(this._shareNode.autoUpdateShareUrl=!1,this._shareNode.shareUrl=i.href)}_initToolInfos(){let e=this.selectedFeaturesIds.length>0,i=this.selectedFeaturesIds.length<2||this.selectedFeaturesIds.length>u,a=this.featureSelectionMode==="multiple"&&this.selectedLayer?.capabilities?.operations.supportsUpdate,t=[];t.push({active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>{this._toggleFilter()},disabled:!1,toolTip:this._translations.filters}),t.push({active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>{this._zoom()},disabled:!e,toolTip:this._translations.zoom}),a&&t.push({active:!1,icon:"pencil",indicator:!1,label:this._translations.editMultiple,func:()=>this.editMultipleFeatures.emit(this.selectedFeaturesIds),disabled:i,toolTip:this._translations.editMultiple}),t.push({active:!1,icon:"refresh",indicator:!1,label:this._translations.refresh,func:()=>this.selectedLayer?.refresh(),disabled:!1,toolTip:this._translations.refresh}),t.push({active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>this.clearSelection.emit(),disabled:!e,toolTip:this._translations.clearSelection}),this._toolInfos=[...t]}_validateActiveActions(){let e=["filter"];this._toolInfos?.forEach(i=>{i&&e.indexOf(i.icon)>-1&&i.icon==="filter"&&(i.indicator=this._filterActive)})}_handleMapVisibility(){if(this._mapDiv.value){let e=this._mapDiv.value.getElementsByClassName("esri-view-surface")[0],i=this._mapDiv.value.getElementsByClassName("esri-attribution")[0];this._isValidWebMap?(e?.classList.remove("hidden"),i?.classList.remove("hidden")):(e?.classList.add("hidden"),i?.classList.add("hidden"))}}_validateEnabledActions(){let e=this.selectedFeaturesIds.length>0,i=this.selectedFeaturesIds.length<2||this.selectedFeaturesIds.length>u,a=["zoom-to-object","pencil","erase"];this._toolInfos?.forEach(t=>{t&&a.indexOf(t.icon)>-1&&(t.disabled=t.icon==="pencil"?i:!e,t.toolTip=t.icon==="pencil"?this.selectedFeaturesIds.length>u?this._translations.featureEditLimitNotice:this._translations.editMultiple:t.toolTip)})}_handleDocumentClick(e){e.target.tagName!=="MAP-PICKER"&&this._mapPicker.value&&this._mapPicker.value.close()}async _zoom(){if(this.selectedLayer&&this.mapView){let e=await w(this.mapView,this.selectedLayer.id);e&&await M(this.selectedFeaturesIds,e,this.mapView,!0,void 0,this.zoomToScale)}}async _toggleFilter(){this.toggleFilter.emit()}_getActions(){return this._toolInfos?.reduce((e,i)=>(i&&e.push(this._getAction(i.active,i.icon,i.indicator,i.label,i.func,i.disabled,i.loading,i.toolTip)),e),[])}_getToolTip(e,i,a){return l`<calcite-tooltip .placement=${e} .referenceElement=${i}><span>${a}</span></calcite-tooltip>`}_getAction(e,i,a,t,s,h,o,c){let W=this.selectedLayer===void 0?!0:h;return l`<calcite-action .active=${e} appearance=solid .disabled=${W} .icon=${i} .id=${`map-${i}`} .indicator=${a} .label=${t} .loading=${o} @click=${s} .text=${t} text-enabled></calcite-action>${this._getToolTip("auto",`map-${i}`,c)}`}_getId(e){return`solutions-action-${e}`}};v("map-card",_);return _},"config","views/MapView","WebMap",a,b,c,e,h)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as S3,b as f3}from"./ZYCAAXQF.js";import{a as r3}from"./FVXS4LF5.js";import a from"./X5EABWHE.js";import{b as w2}from"./2B4SGB3I.js";import{b as k2}from"./YKQDHR27.js";import{$ as Y1,$a as E7,$b as Z9,A as M2,Aa as J2,Ab as p7,B as F2,Ba as $2,Bb as g7,C as E1,Ca as q2,Cb as h7,D as Z,Da as F9,E as R2,Ea as R9,Eb as T7,F as $1,Fa as Y2,G as I1,Ga as X2,Gb as Z7,H as A,Ha as w1,Hb as U7,I as I9,Ia as p9,Ib as W7,J as p2,Ja as Q2,Jb as O7,K as u,Ka as e7,Kb as n1,L as g2,La as a7,Lb as K7,Ma as x7,Mb as H7,N as c1,Na as t7,Nb as v7,O as D,Oa as n7,Ob as B7,P as C1,Pa as m7,Pb as L7,Q as h2,Qa as i7,Qb as j7,R as c9,Ra as l7,Rb as _7,S as C9,Sa as d7,Sb as V7,T as q1,Ta as y7,Tb as z7,U as J,Ua as o7,Ub as J7,V as T2,Va as u7,Vb as $7,W as Z2,Wa as r7,Wb as q7,X as U2,Xa as g9,Xb as Y7,Y as v,Ya as a9,Yb as X7,Z as W2,Za as S7,Zb as Q7,_ as j,_a as f7,_b as e3,a as K1,aa as O2,ab as t1,ac as t9,ba as G9,bb as k7,bc as U9,c as O,ca as x1,cb as w7,cc as M1,da as N,db as b7,dc as n9,e as e1,ea as c,eb as s7,ec as a3,f as P2,fa as X,fb as N7,fc as x3,g as d1,ga as X1,gb as A7,gc as t3,h as S,ha as K2,hb as P7,hc as n3,i as P9,ia as H2,ib as D7,ic as m3,j as u1,ja as M9,jb as I7,jc as i3,k as L1,ka as v2,kb as c7,kc as l3,l as S1,lb as G1,lc as F1,m as j1,ma as B2,mb as M,mc as m9,n as _1,na as L2,nb as x9,nc as i9,o as D9,oa as j2,oc as d3,p as I2,pa as _2,pc as l9,qa as V2,qb as C7,qc as y3,r as V1,ra as g,rb as G7,s as c2,sa as k1,sb as B,t as z1,ta as $,tb as M7,u as J1,ub as b1,v as a1,va as Q1,vb as q,w as C2,wa as e9,wb as F7,x as f1,xa as z2,xb as h9,y as G2,yb as R7,z as k,zb as T9}from"./J75MHJID.js";import{a as E2}from"./R67EKKSL.js";import{a as r1,g as D1}from"./ALSK2SPM.js";import{a as K}from"./ZCU2WWVN.js";import{a as z,b as H1,c as v1,d as B1}from"./KOIDWEP3.js";import{e as V,f as N2,j as U1,l as W1,o as A2,s as O1}from"./XQQ52NKX.js";import{a as b2,g as s2}from"./JUUVYK2H.js";import{a as D2}from"./4HFHJOS3.js";import{a as H}from"./45M33Q5G.js";import{b as f2}from"./KIUBUHVM.js";import{E as T1,F as Z1,G as r2,K as S2,h as u2,i as _,q as o1}from"./H5E6ISYP.js";import{c as W}from"./QPIMTXPL.js";export default $arcgis.t(([{g:o3,h:u3}])=>{function s1(e,a="application/octet-stream"){if(typeof Blob<"u"){let x=[];for(let n=0;n<e.length;n++)x[n]=e.charCodeAt(n);let t=new Uint8Array(x);return new Blob([t],{type:a})}else throw new Error("stringToBlob is not currently supported on Node")}function E3(e){if(typeof Blob<"u")return new Blob([JSON.stringify(e)],{type:"application/json"});throw new Error("objectToJsonBlob is not currently supported on Node")}var d9={};W(d9,{_mostRecentlyEditedLayer:()=>W9,convertItemToTemplate:()=>x0,createItemFromTemplate:()=>t0,postProcess:()=>n0});function x0(e,a,x,t){return new Promise((n,m)=>{let i=j(e);I7(e.groupDesignations)?a7(i,x).then(d=>n(d),d=>m(A(d))):(i.estimatedDeploymentCostFactor=10,$(i.item.id,x).then(d=>{i.data=d,A7(i,x).then(y=>{y.item.modified=Math.max(y.item.modified,W9(i.properties.layers),W9(i.properties.tables)),b7(y,x).then(o=>{y.dependencies=o.map(r=>r.id),n(Y2(y,o,!1,t))},o=>m(A(o)))},y=>m(A(y)))}))})}function t0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),delete m.item.thumbnail,$1(m,"properties.service.size");let i=X2(m.data);E7(m,x,a).then(l=>{l.success?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.serviceItemId)?(m=p9(m,a,l),n7(m,a,i,x).then(()=>{m=p9(m,a,l),b1({...m.item,url:void 0},m.data,x,e.item.thumbnail,void 0,a).then(()=>{t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,l.serviceItemId)?g(m.itemId,x).then(d=>{m.item=d,u(m,"item.url")&&!m.item.url.endsWith("/")&&(m.item.url+="/"),n({item:m,id:l.serviceItemId,type:m.type,postProcess:x1({item:m.item,data:m.data})||g9(m)})},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))}):(t(e.itemId,S.Cancelled,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type))))},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))})},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))})):(t(e.itemId,S.Cancelled,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}function n0(e,a,x,t,n,m,i){return new Promise((l,d)=>{q(e,m,i).then(y=>{g9(t)?(t=N(t,m),a9(t,i,t.item.url,m).then(l,d)):l(y)},d)})}function W9(e){let a=0;return e.forEach(x=>{a=x.editingInfo?.lastEditDate?Math.max(a,x.editingInfo.lastEditDate):a}),a}var f={};W(f,{convertItemToTemplate:()=>m0,createItemFromTemplate:()=>i0});function m0(e,a,x){return new Promise(t=>{let n=j(e);n.item.id=c(n.item.id,n.item.id,".itemId");let m=new Promise(l=>{k1(n.itemId,n.item.name,x).then(d=>{!d||d.size===0?l(null):l(d)})}),i=Promise.resolve({});Promise.all([m,i]).then(l=>{let[d]=l;if(d){let y=a3(d,n.item.name);n.properties[y.filename]=y.mimeType;let o=n9(n.itemId,y.blob.name,1,y.blob.name===y.filename?M1.data:M1.fakezip),r={itemId:n.itemId,file:y.blob,folder:o.folder,filename:o.filename};n.dataFile=r,n.resources.push(o.folder+"/"+o.filename),t(n)}else t(n)})})}function i0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),e.item.thumbnail&&(m.item.thumbnail=e.item.thumbnail),t1(m.item,m.data,x,a.folderId).then(i=>{t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,i.id)?(m.itemId=i.id,a[e.itemId]={itemId:i.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,i.id),n({item:m,id:i.id,type:m.type,postProcess:!1})):(t(e.itemId,S.Cancelled,0),M(i.id,x).then(()=>n(k(e.type)),()=>n(k(e.type))))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}var Q9={};W(Q9,{_getFormDataFilename:()=>Q3,_replaceFeatureServiceURLs:()=>V3,_replaceItemIds:()=>z3,_replacePortalBaseUrls:()=>J3,_replaceWorkflowManagerBaseUrls:()=>$3,_updateZipObjectTextContent:()=>q3,convertItemToTemplate:()=>B0,createItemFromTemplate:()=>L0,postProcess:()=>X3,postProcessFormItems:()=>_0,swizzleFormObject:()=>Y9,templatizeFormData:()=>X9});function b3(e,a){return l0(e,a)}function l0(e,a){return["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"].forEach(t=>{let n=u(e,t);Array.isArray(n)&&n.forEach(m=>{m.type==="mapWidget"&&(e.dependencies.indexOf(m.itemId)<0&&e.dependencies.push(m.itemId),m.itemId=c(m.itemId,m.itemId,".itemId")),Array.isArray(m.datasets)&&d0(m,e,a)})}),e}function d0(e,a,x){e.datasets.forEach(t=>{if(u(t,"dataSource.type")!=="arcadeDataSource"){let m=u(t,"dataSource.itemId");if(m){a.dependencies.indexOf(m)<0&&a.dependencies.push(m);let i=u(t,"dataSource.layerId");w1(i?.toString(),m,"",x),t.dataSource.itemId=c(m,m,".itemId")}}})}function s3(e,a){let x=["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"];return x.forEach(t=>{let n=u(e,t);y0(n,a)}),x.forEach(t=>{o0(e,t,a)}),e}function y0(e,a){e&&Array.isArray(e)&&e.forEach(x=>{Array.isArray(x.datasets)&&x.datasets.forEach(t=>{let n=c9(u(t,"dataSource.itemId"));if(n){let m=C9(u(t,"dataSource.layerId"));a.some(i=>i.itemId===n&&i.layerId===m?(w3(i,x.id),!0):!1)}else{let m=u(t,"dataSource.id");if(m){let i=m.split("#")[1];a.some(l=>l.ids.indexOf(i)>-1?(w3(l,x.id),!0):!1)}}})})}function o0(e,a,x){let t=u(e,a);t&&D(e,a,u0(t,x))}function u0(e,a){return Array.isArray(e)?e.map(x=>{let t=x;return Array.isArray(t.events)&&(t.events=t.events.map(n=>{let m=n;return Array.isArray(m.actions)&&(m.actions=m.actions.map(i=>{let l=i;if(l.fieldMap&&l.targetId&&l.targetId.indexOf("#")>-1){let d=k3(l,a);if(d){let y=u(d,"fields"),o=u(d,"basePath");Array.isArray(y)&&o&&(l.fieldMap=l.fieldMap.map(r=>{let E=r;return E.targetName=X(E.targetName,y,o),E}))}}return l})),m})),Array.isArray(t.datasets)&&(t.datasets=t.datasets.map(n=>{let m=n;if(m.type==="serviceDataset"){let i=k3(n,a);if(i){let l=u(i,"fields"),d=u(i,"basePath");Array.isArray(l)&&d&&(t=X(t,l,d),m=X(m,l,d))}}return m})),t}):e}function k3(e,a){let x,t=u(e,"dataSource.id")||u(e,"targetId");if(t){let n=t.split("#")[1];if(!a.some(m=>(x=m.ids.indexOf(n)>-1?m:x,m.ids.indexOf(n)>-1))){let m=t.split("#")[0];a.some(i=>{let d=(i.references||[]).indexOf(m)>-1;return x=d?i:x,d})}}else{let n=c9(u(e,"dataSource.itemId")),m=C9(u(e,"dataSource.layerId"));n&&a.some(i=>{let l=n===i.itemId&&m===i.layerId;return x=l?i:x,l})}return x}function w3(e,a){e.references=Array.isArray(e.references)?e.references:[],e.references.indexOf(a)<0&&e.references.push(a)}var N1={};W(N1,{convertItemToTemplate:()=>A0,convertNotebookToTemplate:()=>z9,createItemFromTemplate:()=>P0,deleteProps:()=>R3,fineTuneCreatedItem:()=>V9,postProcess:()=>I0,postProcessNotebookTemplates:()=>D0});function P3(e,a,x,t){return new Promise((n,m)=>{let i="";if(e.item.url){let l=e.item.url,d=l.indexOf("//");e.item.url=v(J)+l.substring(l.indexOf("/",d+2),l.lastIndexOf("=")+1)+e.item.id,i=l.replace(l.substring(l.indexOf("/",d+2)),"")}e.dependencies=f0(e),D(e,"data.folderId","{{folderId}}"),w0(e,["data.map.itemId","data.map.appProxy.mapItemId","data.values.webmap","data.values.group"]),I3(e,"data.appItemId",e.itemId),j9(e,["data.logo","data.map.portalUrl","data.portalUrl","data.httpProxy.url"],v(J)),D(e,"data.geometryService",v(T2)),r0(e,x,i,t).then(()=>{A3(e,x,i,"data.widgetPool.widgets").then(l=>{A3(l,x,i,"data.widgetOnScreen.widgets",!0).then(d=>{S0(d,x,i,"data.values").then(y=>{n(y)},y=>m(A(y)))},d=>m(A(d)))},l=>m(A(l)))},l=>m(A(l)))})}function r0(e,a,x,t){return new Promise((n,m)=>{let i=u(e,"data.dataSource.dataSources");if(i&&Object.keys(i).length>0){let l=new Array;Object.keys(i).forEach(d=>{let y=i[d];D(y,"portalUrl",v(J));let o=u(y,"itemId");if(u(y,"url")){if(o){let E=y.url.substr(y.url.lastIndexOf("/")+1);w1(E.toString(),o,y.url,t),y.itemId=c(o,o,".layer"+E+".itemId")}let r=L9(y.url,x,[],[],a);l.push(new Promise((E,w)=>{B9(r.serviceRequests,r.requestUrls,r.testString).then(s=>{y.url=s,E()},s=>w(A(s)))}))}else o&&(y.itemId=c(o,o,".itemId"))}),Promise.all(l).then(()=>n(e),d=>m(A(d)))}else n(e)})}function A3(e,a,x,t,n=!1){return new Promise((m,i)=>{let l=u(e,t)||[],d=[],y=[];if(l.forEach(o=>{!n&&u(o,"icon")&&j9(o,["icon"],v(J));let r=o.config;if(r){let E=JSON.stringify(r),w=L9(E,x,y,d,a);o.config=JSON.parse(w.testString),d=w.serviceRequests,y=w.requestUrls}}),d.length>0){let o=JSON.stringify(l);B9(d,y,o).then(r=>{D(e,t,JSON.parse(r)),m(e)},r=>i(A(r)))}else m(e)})}function S0(e,a,x,t){return new Promise((n,m)=>{let i=u(e,t),l=[],d=[];if(i){u(i,"icon")&&j9(i,["icon"],v(J));let y=JSON.stringify(i),o=L9(y,x,d,l,a);i=JSON.parse(o.testString),l=o.serviceRequests,d=o.requestUrls}if(l.length>0){let y=JSON.stringify(i);B9(l,d,y).then(o=>{D(e,t,JSON.parse(o)),n(e)},o=>m(A(o)))}else n(e)})}function B9(e,a,x){return new Promise((t,n)=>{if(e&&e.length>0){let m=0;Promise.all(e).then(i=>{i.forEach(l=>{if(u(l,"serviceItemId")){let d="{{"+l.serviceItemId+(l.hasOwnProperty("id")?".layer"+l.id:"")+".url}}";x=y9(x,a[m],d,!0)}m++}),t(x)},i=>n(A(i)))}else t(x)})}function L9(e,a,x,t,n){let m={f:"json",authentication:n},i=e.match(/(\bhttps?:\/\/[-A-Z0-9/._]*)/gim);return i&&i.length&&i.forEach(l=>{l.indexOf("NAServer")>-1?e=y9(e,l,v(U2)):l.indexOf("GeocodeServer")>-1?e=y9(e,l,v(Z2)):a&&l.indexOf(a)>-1?e=y9(e,a,v(J)):l.indexOf("FeatureServer")>-1&&x.indexOf(l)===-1&&(x.push(l),t.push(O(l,m)))}),{testString:e,requestUrls:x,serviceRequests:t}}function y9(e,a,x,t=!1){let n=t&&e.indexOf('"')>-1,m=new RegExp(n?'"'+a+'"':a,"gmi");return e.replace(m,n?'"'+x+'"':x)}function j9(e,a,x){a.forEach(t=>{let n=u(e,t);if(n){let m=n.substring(n.indexOf("/",n.indexOf("//")+2));D(e,t,m!==n?x+m:x)}})}function D3(e,a,x,t){return new Promise(n=>{if(C1(e,["WAB2D","WAB3D","Web AppBuilder"])){let m={id:a.itemId,url:a.item.url,data:a.data},i=B(m,t),l={tags:e.item.tags,title:e.item.title,type:"Code Attachment",typeKeywords:["Code","Javascript","Web Mapping Application"],relationshipType:"WMA2Code",originItemId:a.itemId,url:J1(N(v(J),x))+"sharing/rest/content/items/"+a.itemId+"/package"},d=t1(l,{},t,x.folderId);Promise.all([i,d]).then(()=>n(null),()=>n(null))}else n(null)})}function f0(e){let a=E0;return C1(e,["WAB2D","WAB3D","Web AppBuilder"])&&(a=k0),a(e)}function E0(e){return g2(e,["data.values.webmap","data.values.group"])}function k0(e){let a=[],x=u(e,"data.map.itemId");x&&a.push(x);let t=u(e,"data.dataSource.dataSources");return t&&Object.keys(t).forEach(n=>{let m=t[n];m.itemId&&a.push(m.itemId)}),a}function w0(e,a){a.forEach(x=>{let t=u(e,x);I3(e,x,t)})}function I3(e,a,x){D(e,a,c(x,x,".itemId"))}function c3(e,a){let x=u(e,"data.dataSource.dataSources");x&&Object.keys(x).length>0&&(Object.keys(x).forEach(m=>{let i=x[m];x[m]=H9(i,a)}),D(e,"data.dataSource.dataSources",x)),["data.widgetPool.widgets","data.widgetOnScreen.widgets"].forEach(m=>{let i=u(e,m);i&&D(e,m,b0(i,a))});let n=u(e,"data.values");return n&&D(e,"data.values",H9(n,a)),e}function H9(e,a,x=!1){return e=N0(e,a,x),s0(e,a).forEach(n=>{e=X(e,n.fields,n.basePath,x)}),e}function b0(e,a){let x=["SmartEditor","Screening"];return e.map(t=>{if(t.config){let n=x.indexOf(t.name)>-1;t.config=H9(t.config,a,n)}return t})}function s0(e,a){let x=JSON.stringify(e);return a.filter(n=>K9(n,x)<4).sort((n,m)=>K9(n,x)-K9(m,x))}function K9(e,a){let x=e.url,t=e.itemId,n=e.layerId,m;return x&&!isNaN(n)&&(m=new RegExp(x.replace(/[.]/,".layer"+n+"."),"gm")),m&&m.test(a)||e.ids.length>0&&e.ids.some(i=>new RegExp(i,"gm").test(a))?1:x&&new RegExp(x,"gm").test(a)?2:t&&new RegExp(t,"gm").test(a)?3:4}function N0(e,a,x){let t=JSON.stringify(e),n=a.filter(m=>{let i;m.url&&!isNaN(m.layerId)&&(i=new RegExp(m.url.replace(/[.]/,".layer"+m.layerId+"."),"gm"));let l=!1;if(m.ids.length>0&&(l=m.ids.some(d=>new RegExp(d,"gm").test(t))),l||i&&i.test(t))return m});return n.length>0&&n.forEach(m=>{e=v9(e,m,x),m.ids.length>0&&m.ids.forEach(i=>{e=o9(e,m,i,x)})}),e}function v9(e,a,x){let t={},n=a.url,m=a.layerId,i;if(n&&!isNaN(m)&&(i=new RegExp(n.replace(/[.]/,".layer"+m+"."),"gm")),Array.isArray(e))t=e.map(l=>v9(l,a,x));else if(typeof e=="object")for(let l in e)e[l]!=null&&typeof e[l]=="object"?t[l]=v9(e[l],a,x):(i&&i.test(e[l])&&(e=X(e,a.fields,a.basePath,x)),t[l]=e[l]);else t=e;return t}function o9(e,a,x,t){let n={},m=new RegExp(x,"gm");if(Array.isArray(e))n=e.map(i=>o9(i,a,x,t));else if(typeof e=="object")for(let i in e)if(e[i]!==null){let l;try{l=JSON.parse(e[i])}catch{l=void 0}l&&typeof l=="object"?n[i]=JSON.stringify(o9(l,a,x,t)):typeof e[i]=="object"?(m.test(i)&&t&&(e[i]=X(e[i],a.fields,a.basePath,t)),n[i]=o9(e[i],a,x,t)):(m.test(e[i])&&(e=X(e,a.fields,a.basePath,t)),n[i]=e[i])}else n[i]=e[i];else n=e;return n}function C3(e,a,x,t){return r7(e,x,t)}function G3(e,a,x){return a9(e,a,"",x)}function Y(e,a,x,t,n){return new Promise((m,i)=>{function l(){n&&n.signal.aborted&&i(new Error("Operation was cancelled"))}if(l(),!t(e.itemId,S.Started,0))t(e.itemId,S.Ignored,0),m(k(e.type));else{let d=Z(e);d=N(d,a);let y;e.type==="Web Mapping Application"&&e.data?d=JSON.parse(N(JSON.stringify(d),a)):e.type==="QuickCapture Project"&&e.data&&(y=JSON.stringify(d.data.application),delete d.data),e.item.thumbnail&&(d.item.thumbnail=e.item.thumbnail),t1(d.item,d.data,x,a.folderId).then(o=>{if(l(),!t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,o.id))t(e.itemId,S.Cancelled,0),M(o.id,x).then(()=>m(k(e.type)),()=>m(k(e.type)));else{a[e.itemId]={itemId:o.id,itemUrl:a.portalBaseUrl+"/sharing/rest/content/items/"+o.id},d.itemId=o.id,d.type==="Web Mapping Application"&&e.data&&D(d,"data.appItemId",o.id);let r=x1(d.data),E=d.item.url;d=N(d,a),l();let w=Promise.resolve([]);if(d.relatedItems){let P=N(X1(d.relatedItems),a);w=S7(d.itemId,P,x)}l();let s;if(e.type==="Web Mapping Application"&&e.data&&C1(e,["WAB2D","WAB3D","Web AppBuilder"]))s=D3(e,d,a,x);else if(e.type==="Workforce Project")s=G3(d,x,a);else if(e.type==="QuickCapture Project"){if(y){let P=E1(N(JSON.parse(y),a),"qc.project.json");s=l3(P,d.itemId,"",P.name,x)}}else e.type==="Notebook"?s=V9(e,d,a,x):E!==d.item.url?(l(),s=new Promise((P,b)=>{F7(o.id,d.item.url,x).then(()=>P(),b)})):s=Promise.resolve(null);l(),Promise.all([w,s]).then(()=>{t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,o.id)?m({item:d,id:o.id,type:d.type,postProcess:r}):(t(e.itemId,S.Cancelled,0),M(o.id,x).then(()=>m(k(e.type)),()=>m(k(e.type))))},()=>{t(e.itemId,S.Failed,0),m(k(e.type))})}},()=>{t(e.itemId,S.Failed,0),m(k(e.type))})}})}function A0(e,a,x,t){return Q(e,a,x,t)}function P0(e,a,x,t){return Y(e,a,x,t)}function z9(e){return new Promise(a=>{R3(e.data),a(e)})}function D0(e,a){if(e.some(t=>t.type==="Notebook")){let t=Object.keys(a).filter(m=>m.indexOf("FeatureServer")>-1).sort().reverse(),n=e.reduce((m,i)=>(m=[...new Set([...m,...i.dependencies,i.itemId])],m),[]);e=e.map(m=>{if(m.type==="Notebook"){let i=m.data&&JSON.stringify(m.data);return n.forEach(l=>{new RegExp(l,"gim").test(i)&&(i=i.replace(l,"{{"+l+".itemId}}"),m.dependencies.indexOf(l)<0&&m.dependencies.push(l))}),t.forEach(l=>{let d=new RegExp(l,"gim");if(d.test(i)){let y=a[l];i=i.replace(d,y);let o=/[0-9A-F]{32}/gim,r=y.match(o)[0];m.dependencies.indexOf(r)<0&&m.dependencies.push(r)}}),m.data=JSON.parse(i),m}})}return e}function R3(e){if(e){let a=["metadata.interpreter","metadata.papermill"];I1(e,a),(e.cells||[]).forEach(x=>{I1(x,a)})}}function V9(e,a,x,t){return new Promise((n,m)=>{let i={id:a.itemId,url:a.item.url,data:E1(a.data,a.itemId+".ipynb")};B(i,t).then(()=>n(null),m)})}function I0(e,a,x,t,n,m,i){return q(e,m,i)}function g3(e,a,x){return new Promise((t,n)=>{c0(e,x).then(m=>{e.dependencies=m.dependencies,e.data?.properties&&(e.data.properties.ServiceURL=p3(e.data.properties.ServiceURL,m.urlHash),e.data.properties.OverviewURL=p3(e.data.properties.OverviewURL,m.urlHash)),t(e)},m=>n(A(m)))})}function c0(e,a){return new Promise((x,t)=>{let n=[];if(e.data?.properties){let m=[];e.data.properties.ServiceURL&&m.push(e.data.properties.ServiceURL),e.data.properties.OverviewURL&&e.data.properties.OverviewURL!==e.data.properties.ServiceURL&&m.push(e.data.properties.OverviewURL),C0(m,n,a).then(i=>{x(i)},i=>t(A(i)))}else x({dependencies:n,urlHash:{}})})}function C0(e,a,x){return new Promise((t,n)=>{let m={},i={f:"json",authentication:x},l=[],d={},y=e.filter(o=>{if(o){let r=/.+FeatureServer/g.exec(o),E=Array.isArray(r)&&r.length>0?r[0]:void 0;return E?(Object.keys(d).indexOf(E)<0&&(d[E]=O(o,i)),l.push(d[E]),!0):!1}else return!1});l.length>0?Promise.all(l).then(o=>{o.forEach((r,E)=>{if(u(r,"serviceItemId")){let w=r.serviceItemId;a.indexOf(w)<0&&a.push(w),m[y[E]]=w}}),t({dependencies:a,urlHash:m})},o=>n(A(o))):t({dependencies:a,urlHash:m})})}function p3(e,a){let x=e;if(e){let t=a[e];if(t){let n=e.substr(e.lastIndexOf("/")+1);x=c(t,t,".layer"+n+".url")}x=X1(x.replace(/.+?(?=\/home)/,"{{portalBaseUrl}}"))}return x}var R1={};W(R1,{_templatizeAdminEmail:()=>Z3,_templatizeApplication:()=>T3,_templatizeId:()=>J9,_templatizeUrl:()=>W3,_updateDependencies:()=>U3,convertItemToTemplate:()=>M0,convertQuickCaptureToTemplate:()=>$9,createItemFromTemplate:()=>F0});function M0(e,a,x,t){return Q(e,a,x,t)}function $9(e){return D(e,"data.application",T3(e.data.application,e)),e}function T3(e,a){J9(e,"itemId"),Z3(e);let x=e?.dataSources;return x&&Array.isArray(x)&&x.forEach(t=>{let n=t.featureServiceItemId;n&&(U3(n,a),W3(t,"featureServiceItemId","url"),J9(t,"featureServiceItemId"))}),e}function Z3(e){u(e,"preferences.adminEmail")&&D(e,"preferences.adminEmail","{{user.email}}")}function U3(e,a){a.dependencies.indexOf(e)===-1&&a.dependencies.push(e)}function W3(e,a,x){let t=u(e,a),n=u(e,x);if(n){let m=n.substr(n.lastIndexOf("/")+1);D(e,x,c(t,t,".layer"+m+".url"))}}function J9(e,a){let x=u(e,a);x&&D(e,a,c(x,x,".itemId"))}function F0(e,a,x,t){return Y(e,a,x,t)}var R0="home/webmap/viewer.html?webmap=";function O3(e,a,x,t){return new Promise((n,m)=>{e.type!=="Vector Tile Service"&&(e.item.url=e.item.url?J1(v(J))+R0+e.item.id:e.item.url),p0(e,x).then(i=>{e.dependencies=i.dependencies,e.data&&(e.data.baseMap?.baseMapLayers&&q9(e.data.baseMap.baseMapLayers,i.urlHash,t),e.data.operationalLayers&&q9(e.data.operationalLayers,i.urlHash,t),q9(e.data.tables,i.urlHash,t),g0(e.data)),n(e)},i=>m(A(i)))})}function p0(e,a){return new Promise((x,t)=>{let n=[];if(e.data){let m=e.data.baseMap?.baseMapLayers||[],i=e.data.operationalLayers||[],l=e.data.tables||[],d=m.concat(i).concat(l);h0(d,n,a).then(y=>{x(y)},y=>t(A(y)))}else x({dependencies:n,urlHash:{}})})}function g0(e){$1(e,"initialState")}function h0(e,a,x){return new Promise((t,n)=>{let m={},i={f:"json",authentication:x},l=[],d={},y=e.filter(o=>{if(o.itemId&&o.layerType==="VectorTileLayer")return l.push(g(o.itemId,x)),!0;if(o.url&&o.url.indexOf("{{velocityUrl}}")<0){let r=/.+FeatureServer/g.exec(o.url),E=Array.isArray(r)&&r.length>0?r[0]:void 0;return E?(Object.keys(d).indexOf(E)<0&&(d[E]=O(o.url,i)),l.push(d[E]),!0):!1}else return!1});l.length>0?Promise.all(l).then(o=>{o.forEach((r,E)=>{if(y[E].layerType==="VectorTileLayer"){let w=u(r,"typeKeywords");if(w&&w.includes("Vector Tile Style Editor")){a.indexOf(r.id)<0&&a.push(r.id),y[E].templatizeId=!0;let s=y[E].styleUrl.indexOf(r.id)+r.id.length;y[E].styleUrl=c(y[E].styleUrl.replace(y[E].styleUrl.substring(0,s),r.id),r.id,".itemUrl")}}else if(u(r,"serviceItemId")){let w=r.serviceItemId;a.indexOf(w)<0&&a.push(w),m[y[E].url]=w}}),t({dependencies:a,urlHash:m})},o=>n(A(o))):t({dependencies:a,urlHash:m})})}function q9(e=[],a,x){e.forEach(t=>{if(t.itemId&&t.layerType==="VectorTileLayer")t.templatizeId&&(t.itemId=c(t.itemId,t.itemId,".itemId"),delete t.templatizeId);else if(t.url){let n=t.url.substr(t.url.lastIndexOf("/")+1),m=Object.keys(a).indexOf(t.url)>-1?a[t.url]:void 0;m&&(w1(n,m,t.url,x),t.url=c(m,m,".layer"+n+".url"),t.itemId=c(m,m,".layer"+n+".itemId"))}})}function K3(e,a){return["data.operationalLayers","data.tables","data.applicationProperties.viewing.search.layers"].forEach(t=>T0(e,a,t)),e}function T0(e,a,x){let t=u(e,x);t&&D(e,x,Z0(t,a))}function Z0(e,a){return e.forEach(x=>{let t=U0(x,a);if(t){let n=t.fields.map(i=>i.name);l7(x,t,t.basePath,t.itemId,n),y7(x,t.basePath,n),x.layerDefinition&&(u7(x.layerDefinition,t.basePath,n),o7(x.layerDefinition,t.basePath,n));let m=u(x,"field.name");m&&D(x,"field.name",d7(m,x,t.itemId,t.basePath))}}),e}function U0(e,a){let x;return a.some(t=>t.ids.indexOf(e.id)>-1?(x=t,!0):!1),x}function Q(e,a,x,t){return new Promise((n,m)=>{let i=j(e);i.item.id=c(i.item.id,i.item.id,".itemId");let l=Q1(i.itemId,"forward",x),d=Promise.resolve({}),y=Promise.resolve([]);switch(e.type){case"Dashboard":case"Data Pipeline":case"Feature Collection":case"Feature Service":case"Hub Initiative":case"Hub Page":case"Hub Site Application":case"Insights Model":case"Oriented Imagery Catalog":case"Project Package":case"Style":case"Workforce Project":case"Web Map":case"Web Mapping Application":case"Web Scene":case"Notebook":d=new Promise(o=>{$(i.itemId,x).then(r=>o(r))});break;case"Form":d=k1(i.itemId,i.item.name,x);break;case"QuickCapture Project":y=e9(i.itemId,x);break}Promise.all([d,l,y]).then(o=>{let[r,E,w]=o;y3(i,t),i.data=l9(r,e.type,t);let s=E;i.dependencies=[],i.relatedItems=[],s.forEach(b=>{b.relationshipType!=="WMA2Code"&&(i.relatedItems.push(b),b.relatedItemIds.forEach(C=>{i.dependencies.indexOf(C)<0&&i.dependencies.push(C)}))}),e.type==="Data Pipeline"&&(i.dependencies=i.dependencies.concat(W0(r)));let P=Promise.resolve(i);switch(e.type){case"Dashboard":b3(i,t);break;case"Notebook":P=z9(i);break;case"Oriented Imagery Catalog":P=g3(i,a,x);break;case"QuickCapture Project":i.resources=w,P=new Promise(async b=>{let C=null,I=-1;w&&(w.some((y1,m1)=>{let i1=y1.name==="qc.project.json";return i1&&(C=y1,I=m1),i1}),I>=0&&w.splice(I,1)),C&&(i.data={application:{...await z1(C)},name:"qc.project.json"}),i.data.application?.basemap?.type==="Web Map"&&i.dependencies.push(i.data.application.basemap.itemId);let L=$9(i);b(L)});break;case"Vector Tile Service":case"Web Map":case"Web Scene":P=O3(i,a,x,t);break;case"Web Mapping Application":r&&(P=P3(i,a,x,t));break;case"Workforce Project":P=C3(i,a,x,t);break}P.then(n,b=>m(A(b)))})})}function W0(e){let a=[];return(e?.inputs??[]).concat(e?.outputs??[]).forEach(t=>{if(t.type==="FeatureServiceSource"||t.type==="FeatureServiceSink"){let n=u(t,"parameters.layer.value.itemId");n&&a.push(n)}}),a}var R={};W(R,{convertItemToTemplate:()=>O0,createItemFromTemplate:()=>K0,postProcess:()=>v0,postProcessFieldReferences:()=>H0});function O0(e,a,x,t){return Q(e,a,x,t)}function K0(e,a,x,t,n){return n?Y(e,a,x,t,n):Y(e,a,x,t)}function H0(e,a,x){switch(x){case"Web Mapping Application":c3(e,a);break;case"Dashboard":s3(e,a);break;case"Web Map":K3(e,a);break}return e}async function v0(e,a,x,t,n,m,i){if(a==="Web Map"&&t.resources.some(l=>l.indexOf(d1)>-1)){let l=t3(`${m.portalBaseUrl}/sharing/rest`,t.itemId,d1),d={httpMethod:"GET",authentication:i,params:{f:"json"},headers:{Accept:"application/json",Authorization:`Bearer ${i.token}`,"Content-Type":"application/json","X-Esri-Authorization":`Bearer ${i.token}`}};await O(l,d).then(async y=>{let o=JSON.stringify(y),r=N(o,m);if(o!==r){let E=JSON.parse(r),w={id:e,resource:E1(E,d1),name:d1,authentication:i,params:{}};await P2(w)}})}return q(e,m,i)}function B0(e,a,x,t){return R.convertItemToTemplate(e,a,x,t)}function u9(e){return!!u(e,"properties.services")}function B3(e,a="https://survey123.arcgis.com"){let x=`${a}/api/survey/create`,t={credentials:"same-origin",method:"POST",body:b2({f:"json",...e},!0)};return fetch(x,t).then(n=>n.json()).then(n=>{if(!n.success)throw new Error(`Failed to create survey: ${n.error.message}`);return{formId:n.id,featureServiceId:n.featureService.source.itemId,folderId:n.formItemInfo.ownerFolder}})}var L3=function(a){let x=Z(a),t=[["header","content"],["subHeader","content"],["footer","content"],["settings","thankYouScreenContent"]],n=(i,l)=>(i&&i[l]&&(i[l]=encodeURIComponent(i[l])),i);t.forEach(([i,l])=>n(x[i],l));let m=i=>n(i,"description");return x.questions=(x.questions||[]).map(i=>i.questions?{...i,questions:i.questions.map(m)}:m(i)),x};function j3(e,a,x){let{item:{title:t,description:n,tags:m,typeKeywords:i},properties:{form:l}}=e,{user:{username:d},portalBaseUrl:y,organization:{basemapGalleryGroupQuery:o,defaultBasemap:{title:r}}}=a,{token:E}=x.toCredential();return J2(o,r,x).then(w=>{let s="Survey-",P=h2(`${s}${t}`,a,"user.folders").replace(s,"");if(l.questions){let C=I=>(I.maps&&(I.maps=I.maps.map(L=>({...L,itemId:w.id}))),I);l.questions=l.questions.map(I=>I.questions?{...I,questions:I.questions.map(C)}:C(I))}let b=L3(l);return{description:n,form:b,portalUrl:y,tags:m,title:P,token:E,typeKeywords:i,username:d}})}function _3(e,a,x,t){let n=N(e,a),{survey123Url:m}=a;return j3(n,a,x).then(i=>B3(i,m)).then(i=>{let{formId:l,featureServiceId:d}=i,y=Promise.resolve(null);return e.item.thumbnail&&(y=b1({id:l},null,x,e.item.thumbnail)),y.then(()=>g(l,x)).then(o=>(a[n.itemId]={itemId:l},a[n.properties.info.serviceInfo.itemId]={itemId:d},t(n.itemId,S.Finished,n.estimatedDeploymentCostFactor,l),{item:{...e,item:o,itemId:l},id:l,type:"Form",postProcess:!0}))}).catch(i=>{throw t(n.itemId,S.Failed,0),i})}function L0(e,a,x,t){return u9(e)?_3(e,a,x,t):R.createItemFromTemplate(e,a,x,t)}async function Y9(e,a){let x=await T9(e),t=new Date;return t=new Date(t.valueOf()-864e5-t.getTimezoneOffset()*1e3*60),x.forEach(n=>{if(typeof n.content=="string"){let m=q3(n,a);e.file(n.file,m,{date:t})}else n.file.endsWith(".xlsx")&&e.file(n.file,n.content,{date:t})}),Promise.resolve(e)}async function X9(e,a){return(await T9(e)).forEach(t=>{if(t.file.endsWith(".info")||t.file.endsWith(".itemInfo")||t.file.endsWith(".json")||t.file.endsWith(".webform")||t.file.endsWith(".xml")){let n=t.content,m=/\b([0-9A-Fa-f]){32}_type/g;n=z3(n,a,m),n=V3(n,a,m),n=J3(n,a),n=$3(n,a),e.file(t.file,n)}}),Promise.resolve(e)}function V3(e,a,x){let t=e;return Object.keys(a).filter(m=>m.match(x)&&a[m].type==="Feature Service").forEach(m=>{let i=a[m].url,l=a[i];l&&(t=t.replace(new RegExp(i,"g"),l))}),t}function z3(e,a,x){let t=e;return Object.keys(a).filter(m=>m.match(x)&&a[m].type!=="Feature Service").map(m=>m.replace("_type","")).forEach(m=>{t=t.replace(new RegExp(m,"g"),`{{${m}.itemId}}`)}),t}function J3(e,a){let x=e;return a.portalBaseUrl&&(x=x.replace(new RegExp(a.portalBaseUrl,"g"),"{{portalBaseUrl}}")),x}function $3(e,a){let x=e;return a.workflowBaseUrl&&(x=x.replace(new RegExp(a.workflowBaseUrl,"g"),"{{workflowBaseUrl}}")),x}function q3(e,a){let x=M2(),t=e.content;return t=N(e.content,a),f1(t.match(x)??[]).forEach(m=>{let i=a[m];typeof i?.itemId=="string"&&(t=t.replace(new RegExp(m,"g"),`${i.itemId}`))}),t}function Y3(e,a,x,t,n,m,i){let l=t.properties.info.serviceInfo.itemId,{itemId:d}=m[l],y=N(t,m);return g(d,i).then(o=>{let r=[{id:e,title:y.item.title,snippet:y.item.snippet,extent:y.item.extent,culture:y.item.culture},{id:d,extent:y.item.extent,typeKeywords:[`source-${l}`].concat(o.typeKeywords)}],E=s=>B(s,i),w=r.map(E);return Promise.all(w).then(()=>{let s=[e,d],P=C=>V({itemId:C,folderId:m.folderId,authentication:i}),b=s.map(P);return Promise.all(b)}).then(()=>c7(o.ownerFolder,i)).then(()=>{let s=j(o);return n.push(s),t.dependencies.push(o.id),!0})})}async function X3(e,a,x,t,n,m,i){let l=await k1(e,"Form",i);if(l){let d=await h9(l),y=await Y9(d,m);t9(y,e,i)}else return await G2(5e3),X3(e,a,x,t,n,m,i);return u9(t)?Y3(e,a,x,t,n,m,i):q(e,m,i)}async function _0(e,a){for(let x of e)if(x.type==="Form"){let t=x.data;if(x.data=null,t){let n=await h9(t);n=await X9(n,a),x.item.name=Q3(x.item.name,t.name,`${x.itemId}.zip`);let m=await p7(n,x.item.name),i=n9(x.itemId,x.item.name,1,M1.data),l={itemId:x.itemId,file:m,folder:i.folder,filename:x.item.name};x.dataFile=l,x.resources.push(i.folder+"/"+i.filename)}}return Promise.resolve(e)}function Q3(e,a,x){let t=e||a;return t&&t!=="undefined"?t:x}var e2={};W(e2,{_initializeNewGroup:()=>e6,convertItemToTemplate:()=>V0,createItemFromTemplate:()=>z0,postProcess:()=>J0});function V0(e,a,x){return new Promise(t=>{let n=W2(e);n.item.id=c(n.item.id,n.item.id,".itemId"),V2(e.id,x).then(m=>{n.type="Group",_2(e.id,x).then(i=>{i.id=n.item.id,n.item={...i,type:"Group"},n.dependencies=m.concat(p2(i.tags)),t(n)},()=>t(n))},()=>t(n))})}function z0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),m.item.thumbnail=e.item.thumbnail;let i=e6(m.item);w7(i.title,i,a,x,R9(m)?a.locationTracking.owner:void 0).then(l=>{if(l.success)if(!t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id))t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)));else if(m.itemId=l.group.id,a[e.itemId]={itemId:l.group.id},m=N(m,a),a[e.itemId].itemId=l.group.id,!t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,l.group.id))t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)));else if(R9(m)){let d=a.locationTracking.owner;C7(l.group.id,d,x).then(y=>{y.success?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id)?G7(l.group.id,[x.username],x).then(o=>{Array.isArray(o.notRemoved)&&o.notRemoved.length===0?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id)?n({item:m,id:l.group.id,type:m.type,postProcess:x1(m)}):(t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))}):(t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))})}else n({item:m,id:l.group.id,type:m.type,postProcess:x1(m)});else t(e.itemId,S.Failed,0),n(k(e.type))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}function J0(e,a,x,t,n,m,i){let l=Promise.resolve({success:!0});return x.some(d=>{if(d.id===e){let y=d.item.item;return x1(y)&&(y=N(y,m),l=M7(y,i)),!0}}),l}function e6(e){let a={access:"private",description:e.description,owner:e.owner,snippet:e.snippet,tags:e.tags,thumbnail:e.thumbnail,title:e.title||"",typeKeywords:e.typeKeywords};return["autoJoin","displaySettings","isInvitationOnly","isOpenData","isViewOnly","membershipAccess","properties","sortField","sortOrder"].forEach(t=>{e.hasOwnProperty(t)&&(a[t]=e[t])}),a}var p1={};W(p1,{convertItemToTemplate:()=>$0,createItemFromTemplate:()=>q0,isAPage:()=>X0,postProcess:()=>Y0});function a6(e,a,x,t){return e=S1(e,x,{}),B7(e,{...t,allowList:[]}).then(()=>!0)}function r9(e){let a=z(e);return(e.dependencies||[]).forEach(t=>{let n=new RegExp(t,"g"),m=`{{${t}.itemId}}`;a.item=u1(a.item,n,m),a.data=u1(a.data,n,m),e.properties&&(a.properties=u1(a.properties,n,m))}),a}function S9(e,a,x){let t=K(V,{success:!0}),n=[t({itemId:e.item.id,folderId:a,authentication:x})];return H(e,"item.properties.parentInitiativeId")&&n.push(t({itemId:e.item.properties.parentInitiativeId,folderId:a,authentication:x})),Promise.all(n)}function $0(e,a,x=null){let t=0,n=0;return Promise.all([D1(e.id,{authentication:a}),n1(a)]).then(([m,i])=>(t=m.item.created,n=m.item.modified,j7(m,i))).then(m=>(m.item.created=t,m.item.modified=n,m.item.typeKeywords=H1(m.item.typeKeywords,"doNotDelete"),m.groups=[],m.estimatedDeploymentCostFactor=2,m.resources=[],H(m,"properties")||(m.properties={}),m=r9(m),m))}function q0(e,a,x,t){if(!t(e.itemId,S.Started,0))return Promise.resolve(k(e.type));if(e.assets&&e.resources&&delete e.assets,a.solutionItemExtent){let y=a.solutionItemExtent.split(",");a.organization.defaultExtentBBox=[[y[0],y[1]],[y[2],y[3]]]}let m={},i,l,d=e.item.thumbnail;return n1(x,a).then(y=>(l=y,_7(e,a,m,l))).then(y=>{let o=y,r={assets:o.assets||[]};return L7(o,r,l)}).then(y=>(i=y,S9(y,a.folderId,x))).then(()=>{let y={item:{id:i.item.id},params:{thumbnail:d},authentication:x};return e1(y)}).then(()=>{if(a[e.itemId]={itemId:i.item.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor||2,i.item.id)){let o={item:{...e,...a1(i)},id:i.item.id,type:e.type,postProcess:!0};return o.item.itemId=i.item.id,o}else return K(v7,{success:!0})(i,l).then(()=>Promise.resolve(k(e.type)))}).catch(y=>{throw t(e.itemId,S.Failed,0),y})}function Y0(e,a,x,t,n,m,i){let l;return n1(i).then(d=>(l=d,D1(e,{authentication:i}))).then(d=>a6(d,x,m,l))}function X0(e){let a=!1;return(e==="Hub Page"||e==="Site Page")&&(a=!0),a}var g1={};W(g1,{convertItemToTemplate:()=>Q0,createItemFromTemplate:()=>e5,isASite:()=>x5,postProcess:()=>a5});function x6(e,a,x){let t=a.filter(n=>n.type.indexOf("Page")>-1).map(n=>n.id);return Promise.all(t.map(n=>D1(n,x))).then(n=>Q7(e,n,x))}function t6(e,a,x,t){let n=a.filter(d=>d.id!==e.item.id),m=n.map(d=>({item:{id:d.id,type:d.type}})),i=[];i=i.concat(X7(e,m,t)),i=i.concat(x6(e,n,t));let l=n.map(d=>d.id);return e.item.properties.children=l,e=$7(e,x,{}),i.push(V7(e,{...t,allowList:void 0})),Promise.all(i).then(()=>!0)}function Q0(e,a,x=null){let t=0,n=0,m,i,l;return n1(a).then(d=>(l=d,D9(e.id,l))).then(d=>(t=d.item.created,n=d.item.modified,m=d.item.title,i=d.data.values.title,Y7(d,l))).then(d=>(d.item.created=t,d.item.modified=n,d.item.title=m,d.item.typeKeywords=H1(d.item.typeKeywords,"doNotDelete"),d.data.values.title=i,d.groups=[],d.estimatedDeploymentCostFactor=2,d.resources=[],u(d,"properties")||(d.properties={}),d.dependencies=f1(d.dependencies),d=r9(d),d))}function e5(e,a,x,t){if(!t(e.itemId,S.Started,0))return Promise.resolve(k(e.type));e.assets&&e.resources&&delete e.assets,a.solution||(a.solution={}),a.solution.title=a.title;let m={},i,l,d=e.item.thumbnail;return n1(x,a).then(y=>(l=y,q7(e,a,m,l))).then(y=>{let o={assets:y.assets||[]};return J7(y,o,l)}).then(y=>(i=y,S9(y,a.folderId,x))).then(()=>{let y={item:{id:i.item.id},params:{thumbnail:d},authentication:x};return e1(y)}).then(()=>{if(a[e.itemId]={itemId:i.item.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor||2,i.item.id)){let o={item:{...e,...a1(i)},id:i.item.id,type:e.type,postProcess:!0};return o.item.itemId=i.item.id,o}else return K(z7,{success:!0})(i,l).then(()=>Promise.resolve(k(e.type)))}).catch(y=>{throw t(e.itemId,S.Failed,0),y})}function a5(e,a,x,t,n,m,i){let l;return n1(i,m).then(d=>(l=d,D9(e,l))).then(d=>t6(d,x,m,l)).then(()=>Promise.resolve(!0))}function x5(e){let a=!1;return(e==="Hub Site Application"||e==="Site Application")&&(a=!0),a}var E9={};W(E9,{convertItemToTemplate:()=>m5,createItemFromTemplate:()=>i5,isAStoryMap:()=>l5});function n6(e={}){let a=0;return Object.keys(e).reduce((x,t)=>(H(e,`${t}.type`)==="webmap"&&t!==`webmap${a}`&&(x.push({original:t,updated:`webmap${a}`}),a++),x),[])}function m6(e){let a=H(e,"data.resources")||{};return Object.keys(a).reduce((x,t)=>(H(a,`${t}.type`)==="webmap"&&x.push(H(a,`${t}.data.itemId`)),x),[])}function l6(e){let a=Y1(e.item.id,e.item.type);a.key=`${L1(e.item.title)}_${v1("i")}`;let x=z(e);a.data=x.data;let t=x.item.created,n=x.item.modified;return a.item=_1(x.item),a.item.created=t,a.item.modified=n,a.item.url="{{storyMapTemplateUrl}}",n6(a.data.resources).forEach(l=>{a.data.resources[l.updated]=z(a.data.resources[l.original]),delete a.data.resources[l.original],a.data.nodes=u1(a.data.nodes,l.original,l.updated)}),a.item.typeKeywords.indexOf(i6)!==-1&&(a.item.typeKeywords=[t5].concat(a.item.typeKeywords.filter(l=>l!==i6))),a.properties={},a.properties.draftFileName="draft_{{timestamp}}.json",Object.assign(a.properties,n5),a.dependencies=m6(e),Promise.resolve(a)}var i6="smstatusunpublishedchanges",t5="smstatuspublished",n5={oembed:{version:"1.0",type:"rich",title:"Example StoryMap",url:"{{storyMapTemplateUrl}}",provider_name:"ArcGIS StoryMaps",provider_url:"{{storyMapBaseUrl}}",width:800,height:600,thumbnail_url:"{{storyMapThumbnailUrl}}",thumbnail_height:"100.5",thumbnail_width:"400",html:'<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',cache_age:86400},oembedXML:`<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2
+ import{a as S3,b as f3}from"./ZYCAAXQF.js";import{a as r3}from"./ESBPGZRY.js";import a from"./QKJ4PGBO.js";import{b as w2}from"./2B4SGB3I.js";import{b as k2}from"./YKQDHR27.js";import{$ as Y1,$a as E7,$b as Z9,A as M2,Aa as J2,Ab as p7,B as F2,Ba as $2,Bb as g7,C as E1,Ca as q2,Cb as h7,D as Z,Da as F9,E as R2,Ea as R9,Eb as T7,F as $1,Fa as Y2,G as I1,Ga as X2,Gb as Z7,H as A,Ha as w1,Hb as U7,I as I9,Ia as p9,Ib as W7,J as p2,Ja as Q2,Jb as O7,K as u,Ka as e7,Kb as n1,L as g2,La as a7,Lb as K7,Ma as x7,Mb as H7,N as c1,Na as t7,Nb as v7,O as D,Oa as n7,Ob as B7,P as C1,Pa as m7,Pb as L7,Q as h2,Qa as i7,Qb as j7,R as c9,Ra as l7,Rb as _7,S as C9,Sa as d7,Sb as V7,T as q1,Ta as y7,Tb as z7,U as J,Ua as o7,Ub as J7,V as T2,Va as u7,Vb as $7,W as Z2,Wa as r7,Wb as q7,X as U2,Xa as g9,Xb as Y7,Y as v,Ya as a9,Yb as X7,Z as W2,Za as S7,Zb as Q7,_ as j,_a as f7,_b as e3,a as K1,aa as O2,ab as t1,ac as t9,ba as G9,bb as k7,bc as U9,c as O,ca as x1,cb as w7,cc as M1,da as N,db as b7,dc as n9,e as e1,ea as c,eb as s7,ec as a3,f as P2,fa as X,fb as N7,fc as x3,g as d1,ga as X1,gb as A7,gc as t3,h as S,ha as K2,hb as P7,hc as n3,i as P9,ia as H2,ib as D7,ic as m3,j as u1,ja as M9,jb as I7,jc as i3,k as L1,ka as v2,kb as c7,kc as l3,l as S1,lb as G1,lc as F1,m as j1,ma as B2,mb as M,mc as m9,n as _1,na as L2,nb as x9,nc as i9,o as D9,oa as j2,oc as d3,p as I2,pa as _2,pc as l9,qa as V2,qb as C7,qc as y3,r as V1,ra as g,rb as G7,s as c2,sa as k1,sb as B,t as z1,ta as $,tb as M7,u as J1,ub as b1,v as a1,va as Q1,vb as q,w as C2,wa as e9,wb as F7,x as f1,xa as z2,xb as h9,y as G2,yb as R7,z as k,zb as T9}from"./J75MHJID.js";import{a as E2}from"./R67EKKSL.js";import{a as r1,g as D1}from"./ALSK2SPM.js";import{a as K}from"./ZCU2WWVN.js";import{a as z,b as H1,c as v1,d as B1}from"./KOIDWEP3.js";import{e as V,f as N2,j as U1,l as W1,o as A2,s as O1}from"./XQQ52NKX.js";import{a as b2,g as s2}from"./JUUVYK2H.js";import{a as D2}from"./4HFHJOS3.js";import{a as H}from"./45M33Q5G.js";import{b as f2}from"./KIUBUHVM.js";import{E as T1,F as Z1,G as r2,K as S2,h as u2,i as _,q as o1}from"./H5E6ISYP.js";import{c as W}from"./QPIMTXPL.js";export default $arcgis.t(([{g:o3,h:u3}])=>{function s1(e,a="application/octet-stream"){if(typeof Blob<"u"){let x=[];for(let n=0;n<e.length;n++)x[n]=e.charCodeAt(n);let t=new Uint8Array(x);return new Blob([t],{type:a})}else throw new Error("stringToBlob is not currently supported on Node")}function E3(e){if(typeof Blob<"u")return new Blob([JSON.stringify(e)],{type:"application/json"});throw new Error("objectToJsonBlob is not currently supported on Node")}var d9={};W(d9,{_mostRecentlyEditedLayer:()=>W9,convertItemToTemplate:()=>x0,createItemFromTemplate:()=>t0,postProcess:()=>n0});function x0(e,a,x,t){return new Promise((n,m)=>{let i=j(e);I7(e.groupDesignations)?a7(i,x).then(d=>n(d),d=>m(A(d))):(i.estimatedDeploymentCostFactor=10,$(i.item.id,x).then(d=>{i.data=d,A7(i,x).then(y=>{y.item.modified=Math.max(y.item.modified,W9(i.properties.layers),W9(i.properties.tables)),b7(y,x).then(o=>{y.dependencies=o.map(r=>r.id),n(Y2(y,o,!1,t))},o=>m(A(o)))},y=>m(A(y)))}))})}function t0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),delete m.item.thumbnail,$1(m,"properties.service.size");let i=X2(m.data);E7(m,x,a).then(l=>{l.success?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.serviceItemId)?(m=p9(m,a,l),n7(m,a,i,x).then(()=>{m=p9(m,a,l),b1({...m.item,url:void 0},m.data,x,e.item.thumbnail,void 0,a).then(()=>{t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,l.serviceItemId)?g(m.itemId,x).then(d=>{m.item=d,u(m,"item.url")&&!m.item.url.endsWith("/")&&(m.item.url+="/"),n({item:m,id:l.serviceItemId,type:m.type,postProcess:x1({item:m.item,data:m.data})||g9(m)})},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))}):(t(e.itemId,S.Cancelled,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type))))},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))})},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))})):(t(e.itemId,S.Cancelled,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}function n0(e,a,x,t,n,m,i){return new Promise((l,d)=>{q(e,m,i).then(y=>{g9(t)?(t=N(t,m),a9(t,i,t.item.url,m).then(l,d)):l(y)},d)})}function W9(e){let a=0;return e.forEach(x=>{a=x.editingInfo?.lastEditDate?Math.max(a,x.editingInfo.lastEditDate):a}),a}var f={};W(f,{convertItemToTemplate:()=>m0,createItemFromTemplate:()=>i0});function m0(e,a,x){return new Promise(t=>{let n=j(e);n.item.id=c(n.item.id,n.item.id,".itemId");let m=new Promise(l=>{k1(n.itemId,n.item.name,x).then(d=>{!d||d.size===0?l(null):l(d)})}),i=Promise.resolve({});Promise.all([m,i]).then(l=>{let[d]=l;if(d){let y=a3(d,n.item.name);n.properties[y.filename]=y.mimeType;let o=n9(n.itemId,y.blob.name,1,y.blob.name===y.filename?M1.data:M1.fakezip),r={itemId:n.itemId,file:y.blob,folder:o.folder,filename:o.filename};n.dataFile=r,n.resources.push(o.folder+"/"+o.filename),t(n)}else t(n)})})}function i0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),e.item.thumbnail&&(m.item.thumbnail=e.item.thumbnail),t1(m.item,m.data,x,a.folderId).then(i=>{t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,i.id)?(m.itemId=i.id,a[e.itemId]={itemId:i.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,i.id),n({item:m,id:i.id,type:m.type,postProcess:!1})):(t(e.itemId,S.Cancelled,0),M(i.id,x).then(()=>n(k(e.type)),()=>n(k(e.type))))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}var Q9={};W(Q9,{_getFormDataFilename:()=>Q3,_replaceFeatureServiceURLs:()=>V3,_replaceItemIds:()=>z3,_replacePortalBaseUrls:()=>J3,_replaceWorkflowManagerBaseUrls:()=>$3,_updateZipObjectTextContent:()=>q3,convertItemToTemplate:()=>B0,createItemFromTemplate:()=>L0,postProcess:()=>X3,postProcessFormItems:()=>_0,swizzleFormObject:()=>Y9,templatizeFormData:()=>X9});function b3(e,a){return l0(e,a)}function l0(e,a){return["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"].forEach(t=>{let n=u(e,t);Array.isArray(n)&&n.forEach(m=>{m.type==="mapWidget"&&(e.dependencies.indexOf(m.itemId)<0&&e.dependencies.push(m.itemId),m.itemId=c(m.itemId,m.itemId,".itemId")),Array.isArray(m.datasets)&&d0(m,e,a)})}),e}function d0(e,a,x){e.datasets.forEach(t=>{if(u(t,"dataSource.type")!=="arcadeDataSource"){let m=u(t,"dataSource.itemId");if(m){a.dependencies.indexOf(m)<0&&a.dependencies.push(m);let i=u(t,"dataSource.layerId");w1(i?.toString(),m,"",x),t.dataSource.itemId=c(m,m,".itemId")}}})}function s3(e,a){let x=["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"];return x.forEach(t=>{let n=u(e,t);y0(n,a)}),x.forEach(t=>{o0(e,t,a)}),e}function y0(e,a){e&&Array.isArray(e)&&e.forEach(x=>{Array.isArray(x.datasets)&&x.datasets.forEach(t=>{let n=c9(u(t,"dataSource.itemId"));if(n){let m=C9(u(t,"dataSource.layerId"));a.some(i=>i.itemId===n&&i.layerId===m?(w3(i,x.id),!0):!1)}else{let m=u(t,"dataSource.id");if(m){let i=m.split("#")[1];a.some(l=>l.ids.indexOf(i)>-1?(w3(l,x.id),!0):!1)}}})})}function o0(e,a,x){let t=u(e,a);t&&D(e,a,u0(t,x))}function u0(e,a){return Array.isArray(e)?e.map(x=>{let t=x;return Array.isArray(t.events)&&(t.events=t.events.map(n=>{let m=n;return Array.isArray(m.actions)&&(m.actions=m.actions.map(i=>{let l=i;if(l.fieldMap&&l.targetId&&l.targetId.indexOf("#")>-1){let d=k3(l,a);if(d){let y=u(d,"fields"),o=u(d,"basePath");Array.isArray(y)&&o&&(l.fieldMap=l.fieldMap.map(r=>{let E=r;return E.targetName=X(E.targetName,y,o),E}))}}return l})),m})),Array.isArray(t.datasets)&&(t.datasets=t.datasets.map(n=>{let m=n;if(m.type==="serviceDataset"){let i=k3(n,a);if(i){let l=u(i,"fields"),d=u(i,"basePath");Array.isArray(l)&&d&&(t=X(t,l,d),m=X(m,l,d))}}return m})),t}):e}function k3(e,a){let x,t=u(e,"dataSource.id")||u(e,"targetId");if(t){let n=t.split("#")[1];if(!a.some(m=>(x=m.ids.indexOf(n)>-1?m:x,m.ids.indexOf(n)>-1))){let m=t.split("#")[0];a.some(i=>{let d=(i.references||[]).indexOf(m)>-1;return x=d?i:x,d})}}else{let n=c9(u(e,"dataSource.itemId")),m=C9(u(e,"dataSource.layerId"));n&&a.some(i=>{let l=n===i.itemId&&m===i.layerId;return x=l?i:x,l})}return x}function w3(e,a){e.references=Array.isArray(e.references)?e.references:[],e.references.indexOf(a)<0&&e.references.push(a)}var N1={};W(N1,{convertItemToTemplate:()=>A0,convertNotebookToTemplate:()=>z9,createItemFromTemplate:()=>P0,deleteProps:()=>R3,fineTuneCreatedItem:()=>V9,postProcess:()=>I0,postProcessNotebookTemplates:()=>D0});function P3(e,a,x,t){return new Promise((n,m)=>{let i="";if(e.item.url){let l=e.item.url,d=l.indexOf("//");e.item.url=v(J)+l.substring(l.indexOf("/",d+2),l.lastIndexOf("=")+1)+e.item.id,i=l.replace(l.substring(l.indexOf("/",d+2)),"")}e.dependencies=f0(e),D(e,"data.folderId","{{folderId}}"),w0(e,["data.map.itemId","data.map.appProxy.mapItemId","data.values.webmap","data.values.group"]),I3(e,"data.appItemId",e.itemId),j9(e,["data.logo","data.map.portalUrl","data.portalUrl","data.httpProxy.url"],v(J)),D(e,"data.geometryService",v(T2)),r0(e,x,i,t).then(()=>{A3(e,x,i,"data.widgetPool.widgets").then(l=>{A3(l,x,i,"data.widgetOnScreen.widgets",!0).then(d=>{S0(d,x,i,"data.values").then(y=>{n(y)},y=>m(A(y)))},d=>m(A(d)))},l=>m(A(l)))},l=>m(A(l)))})}function r0(e,a,x,t){return new Promise((n,m)=>{let i=u(e,"data.dataSource.dataSources");if(i&&Object.keys(i).length>0){let l=new Array;Object.keys(i).forEach(d=>{let y=i[d];D(y,"portalUrl",v(J));let o=u(y,"itemId");if(u(y,"url")){if(o){let E=y.url.substr(y.url.lastIndexOf("/")+1);w1(E.toString(),o,y.url,t),y.itemId=c(o,o,".layer"+E+".itemId")}let r=L9(y.url,x,[],[],a);l.push(new Promise((E,w)=>{B9(r.serviceRequests,r.requestUrls,r.testString).then(s=>{y.url=s,E()},s=>w(A(s)))}))}else o&&(y.itemId=c(o,o,".itemId"))}),Promise.all(l).then(()=>n(e),d=>m(A(d)))}else n(e)})}function A3(e,a,x,t,n=!1){return new Promise((m,i)=>{let l=u(e,t)||[],d=[],y=[];if(l.forEach(o=>{!n&&u(o,"icon")&&j9(o,["icon"],v(J));let r=o.config;if(r){let E=JSON.stringify(r),w=L9(E,x,y,d,a);o.config=JSON.parse(w.testString),d=w.serviceRequests,y=w.requestUrls}}),d.length>0){let o=JSON.stringify(l);B9(d,y,o).then(r=>{D(e,t,JSON.parse(r)),m(e)},r=>i(A(r)))}else m(e)})}function S0(e,a,x,t){return new Promise((n,m)=>{let i=u(e,t),l=[],d=[];if(i){u(i,"icon")&&j9(i,["icon"],v(J));let y=JSON.stringify(i),o=L9(y,x,d,l,a);i=JSON.parse(o.testString),l=o.serviceRequests,d=o.requestUrls}if(l.length>0){let y=JSON.stringify(i);B9(l,d,y).then(o=>{D(e,t,JSON.parse(o)),n(e)},o=>m(A(o)))}else n(e)})}function B9(e,a,x){return new Promise((t,n)=>{if(e&&e.length>0){let m=0;Promise.all(e).then(i=>{i.forEach(l=>{if(u(l,"serviceItemId")){let d="{{"+l.serviceItemId+(l.hasOwnProperty("id")?".layer"+l.id:"")+".url}}";x=y9(x,a[m],d,!0)}m++}),t(x)},i=>n(A(i)))}else t(x)})}function L9(e,a,x,t,n){let m={f:"json",authentication:n},i=e.match(/(\bhttps?:\/\/[-A-Z0-9/._]*)/gim);return i&&i.length&&i.forEach(l=>{l.indexOf("NAServer")>-1?e=y9(e,l,v(U2)):l.indexOf("GeocodeServer")>-1?e=y9(e,l,v(Z2)):a&&l.indexOf(a)>-1?e=y9(e,a,v(J)):l.indexOf("FeatureServer")>-1&&x.indexOf(l)===-1&&(x.push(l),t.push(O(l,m)))}),{testString:e,requestUrls:x,serviceRequests:t}}function y9(e,a,x,t=!1){let n=t&&e.indexOf('"')>-1,m=new RegExp(n?'"'+a+'"':a,"gmi");return e.replace(m,n?'"'+x+'"':x)}function j9(e,a,x){a.forEach(t=>{let n=u(e,t);if(n){let m=n.substring(n.indexOf("/",n.indexOf("//")+2));D(e,t,m!==n?x+m:x)}})}function D3(e,a,x,t){return new Promise(n=>{if(C1(e,["WAB2D","WAB3D","Web AppBuilder"])){let m={id:a.itemId,url:a.item.url,data:a.data},i=B(m,t),l={tags:e.item.tags,title:e.item.title,type:"Code Attachment",typeKeywords:["Code","Javascript","Web Mapping Application"],relationshipType:"WMA2Code",originItemId:a.itemId,url:J1(N(v(J),x))+"sharing/rest/content/items/"+a.itemId+"/package"},d=t1(l,{},t,x.folderId);Promise.all([i,d]).then(()=>n(null),()=>n(null))}else n(null)})}function f0(e){let a=E0;return C1(e,["WAB2D","WAB3D","Web AppBuilder"])&&(a=k0),a(e)}function E0(e){return g2(e,["data.values.webmap","data.values.group"])}function k0(e){let a=[],x=u(e,"data.map.itemId");x&&a.push(x);let t=u(e,"data.dataSource.dataSources");return t&&Object.keys(t).forEach(n=>{let m=t[n];m.itemId&&a.push(m.itemId)}),a}function w0(e,a){a.forEach(x=>{let t=u(e,x);I3(e,x,t)})}function I3(e,a,x){D(e,a,c(x,x,".itemId"))}function c3(e,a){let x=u(e,"data.dataSource.dataSources");x&&Object.keys(x).length>0&&(Object.keys(x).forEach(m=>{let i=x[m];x[m]=H9(i,a)}),D(e,"data.dataSource.dataSources",x)),["data.widgetPool.widgets","data.widgetOnScreen.widgets"].forEach(m=>{let i=u(e,m);i&&D(e,m,b0(i,a))});let n=u(e,"data.values");return n&&D(e,"data.values",H9(n,a)),e}function H9(e,a,x=!1){return e=N0(e,a,x),s0(e,a).forEach(n=>{e=X(e,n.fields,n.basePath,x)}),e}function b0(e,a){let x=["SmartEditor","Screening"];return e.map(t=>{if(t.config){let n=x.indexOf(t.name)>-1;t.config=H9(t.config,a,n)}return t})}function s0(e,a){let x=JSON.stringify(e);return a.filter(n=>K9(n,x)<4).sort((n,m)=>K9(n,x)-K9(m,x))}function K9(e,a){let x=e.url,t=e.itemId,n=e.layerId,m;return x&&!isNaN(n)&&(m=new RegExp(x.replace(/[.]/,".layer"+n+"."),"gm")),m&&m.test(a)||e.ids.length>0&&e.ids.some(i=>new RegExp(i,"gm").test(a))?1:x&&new RegExp(x,"gm").test(a)?2:t&&new RegExp(t,"gm").test(a)?3:4}function N0(e,a,x){let t=JSON.stringify(e),n=a.filter(m=>{let i;m.url&&!isNaN(m.layerId)&&(i=new RegExp(m.url.replace(/[.]/,".layer"+m.layerId+"."),"gm"));let l=!1;if(m.ids.length>0&&(l=m.ids.some(d=>new RegExp(d,"gm").test(t))),l||i&&i.test(t))return m});return n.length>0&&n.forEach(m=>{e=v9(e,m,x),m.ids.length>0&&m.ids.forEach(i=>{e=o9(e,m,i,x)})}),e}function v9(e,a,x){let t={},n=a.url,m=a.layerId,i;if(n&&!isNaN(m)&&(i=new RegExp(n.replace(/[.]/,".layer"+m+"."),"gm")),Array.isArray(e))t=e.map(l=>v9(l,a,x));else if(typeof e=="object")for(let l in e)e[l]!=null&&typeof e[l]=="object"?t[l]=v9(e[l],a,x):(i&&i.test(e[l])&&(e=X(e,a.fields,a.basePath,x)),t[l]=e[l]);else t=e;return t}function o9(e,a,x,t){let n={},m=new RegExp(x,"gm");if(Array.isArray(e))n=e.map(i=>o9(i,a,x,t));else if(typeof e=="object")for(let i in e)if(e[i]!==null){let l;try{l=JSON.parse(e[i])}catch{l=void 0}l&&typeof l=="object"?n[i]=JSON.stringify(o9(l,a,x,t)):typeof e[i]=="object"?(m.test(i)&&t&&(e[i]=X(e[i],a.fields,a.basePath,t)),n[i]=o9(e[i],a,x,t)):(m.test(e[i])&&(e=X(e,a.fields,a.basePath,t)),n[i]=e[i])}else n[i]=e[i];else n=e;return n}function C3(e,a,x,t){return r7(e,x,t)}function G3(e,a,x){return a9(e,a,"",x)}function Y(e,a,x,t,n){return new Promise((m,i)=>{function l(){n&&n.signal.aborted&&i(new Error("Operation was cancelled"))}if(l(),!t(e.itemId,S.Started,0))t(e.itemId,S.Ignored,0),m(k(e.type));else{let d=Z(e);d=N(d,a);let y;e.type==="Web Mapping Application"&&e.data?d=JSON.parse(N(JSON.stringify(d),a)):e.type==="QuickCapture Project"&&e.data&&(y=JSON.stringify(d.data.application),delete d.data),e.item.thumbnail&&(d.item.thumbnail=e.item.thumbnail),t1(d.item,d.data,x,a.folderId).then(o=>{if(l(),!t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,o.id))t(e.itemId,S.Cancelled,0),M(o.id,x).then(()=>m(k(e.type)),()=>m(k(e.type)));else{a[e.itemId]={itemId:o.id,itemUrl:a.portalBaseUrl+"/sharing/rest/content/items/"+o.id},d.itemId=o.id,d.type==="Web Mapping Application"&&e.data&&D(d,"data.appItemId",o.id);let r=x1(d.data),E=d.item.url;d=N(d,a),l();let w=Promise.resolve([]);if(d.relatedItems){let P=N(X1(d.relatedItems),a);w=S7(d.itemId,P,x)}l();let s;if(e.type==="Web Mapping Application"&&e.data&&C1(e,["WAB2D","WAB3D","Web AppBuilder"]))s=D3(e,d,a,x);else if(e.type==="Workforce Project")s=G3(d,x,a);else if(e.type==="QuickCapture Project"){if(y){let P=E1(N(JSON.parse(y),a),"qc.project.json");s=l3(P,d.itemId,"",P.name,x)}}else e.type==="Notebook"?s=V9(e,d,a,x):E!==d.item.url?(l(),s=new Promise((P,b)=>{F7(o.id,d.item.url,x).then(()=>P(),b)})):s=Promise.resolve(null);l(),Promise.all([w,s]).then(()=>{t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,o.id)?m({item:d,id:o.id,type:d.type,postProcess:r}):(t(e.itemId,S.Cancelled,0),M(o.id,x).then(()=>m(k(e.type)),()=>m(k(e.type))))},()=>{t(e.itemId,S.Failed,0),m(k(e.type))})}},()=>{t(e.itemId,S.Failed,0),m(k(e.type))})}})}function A0(e,a,x,t){return Q(e,a,x,t)}function P0(e,a,x,t){return Y(e,a,x,t)}function z9(e){return new Promise(a=>{R3(e.data),a(e)})}function D0(e,a){if(e.some(t=>t.type==="Notebook")){let t=Object.keys(a).filter(m=>m.indexOf("FeatureServer")>-1).sort().reverse(),n=e.reduce((m,i)=>(m=[...new Set([...m,...i.dependencies,i.itemId])],m),[]);e=e.map(m=>{if(m.type==="Notebook"){let i=m.data&&JSON.stringify(m.data);return n.forEach(l=>{new RegExp(l,"gim").test(i)&&(i=i.replace(l,"{{"+l+".itemId}}"),m.dependencies.indexOf(l)<0&&m.dependencies.push(l))}),t.forEach(l=>{let d=new RegExp(l,"gim");if(d.test(i)){let y=a[l];i=i.replace(d,y);let o=/[0-9A-F]{32}/gim,r=y.match(o)[0];m.dependencies.indexOf(r)<0&&m.dependencies.push(r)}}),m.data=JSON.parse(i),m}})}return e}function R3(e){if(e){let a=["metadata.interpreter","metadata.papermill"];I1(e,a),(e.cells||[]).forEach(x=>{I1(x,a)})}}function V9(e,a,x,t){return new Promise((n,m)=>{let i={id:a.itemId,url:a.item.url,data:E1(a.data,a.itemId+".ipynb")};B(i,t).then(()=>n(null),m)})}function I0(e,a,x,t,n,m,i){return q(e,m,i)}function g3(e,a,x){return new Promise((t,n)=>{c0(e,x).then(m=>{e.dependencies=m.dependencies,e.data?.properties&&(e.data.properties.ServiceURL=p3(e.data.properties.ServiceURL,m.urlHash),e.data.properties.OverviewURL=p3(e.data.properties.OverviewURL,m.urlHash)),t(e)},m=>n(A(m)))})}function c0(e,a){return new Promise((x,t)=>{let n=[];if(e.data?.properties){let m=[];e.data.properties.ServiceURL&&m.push(e.data.properties.ServiceURL),e.data.properties.OverviewURL&&e.data.properties.OverviewURL!==e.data.properties.ServiceURL&&m.push(e.data.properties.OverviewURL),C0(m,n,a).then(i=>{x(i)},i=>t(A(i)))}else x({dependencies:n,urlHash:{}})})}function C0(e,a,x){return new Promise((t,n)=>{let m={},i={f:"json",authentication:x},l=[],d={},y=e.filter(o=>{if(o){let r=/.+FeatureServer/g.exec(o),E=Array.isArray(r)&&r.length>0?r[0]:void 0;return E?(Object.keys(d).indexOf(E)<0&&(d[E]=O(o,i)),l.push(d[E]),!0):!1}else return!1});l.length>0?Promise.all(l).then(o=>{o.forEach((r,E)=>{if(u(r,"serviceItemId")){let w=r.serviceItemId;a.indexOf(w)<0&&a.push(w),m[y[E]]=w}}),t({dependencies:a,urlHash:m})},o=>n(A(o))):t({dependencies:a,urlHash:m})})}function p3(e,a){let x=e;if(e){let t=a[e];if(t){let n=e.substr(e.lastIndexOf("/")+1);x=c(t,t,".layer"+n+".url")}x=X1(x.replace(/.+?(?=\/home)/,"{{portalBaseUrl}}"))}return x}var R1={};W(R1,{_templatizeAdminEmail:()=>Z3,_templatizeApplication:()=>T3,_templatizeId:()=>J9,_templatizeUrl:()=>W3,_updateDependencies:()=>U3,convertItemToTemplate:()=>M0,convertQuickCaptureToTemplate:()=>$9,createItemFromTemplate:()=>F0});function M0(e,a,x,t){return Q(e,a,x,t)}function $9(e){return D(e,"data.application",T3(e.data.application,e)),e}function T3(e,a){J9(e,"itemId"),Z3(e);let x=e?.dataSources;return x&&Array.isArray(x)&&x.forEach(t=>{let n=t.featureServiceItemId;n&&(U3(n,a),W3(t,"featureServiceItemId","url"),J9(t,"featureServiceItemId"))}),e}function Z3(e){u(e,"preferences.adminEmail")&&D(e,"preferences.adminEmail","{{user.email}}")}function U3(e,a){a.dependencies.indexOf(e)===-1&&a.dependencies.push(e)}function W3(e,a,x){let t=u(e,a),n=u(e,x);if(n){let m=n.substr(n.lastIndexOf("/")+1);D(e,x,c(t,t,".layer"+m+".url"))}}function J9(e,a){let x=u(e,a);x&&D(e,a,c(x,x,".itemId"))}function F0(e,a,x,t){return Y(e,a,x,t)}var R0="home/webmap/viewer.html?webmap=";function O3(e,a,x,t){return new Promise((n,m)=>{e.type!=="Vector Tile Service"&&(e.item.url=e.item.url?J1(v(J))+R0+e.item.id:e.item.url),p0(e,x).then(i=>{e.dependencies=i.dependencies,e.data&&(e.data.baseMap?.baseMapLayers&&q9(e.data.baseMap.baseMapLayers,i.urlHash,t),e.data.operationalLayers&&q9(e.data.operationalLayers,i.urlHash,t),q9(e.data.tables,i.urlHash,t),g0(e.data)),n(e)},i=>m(A(i)))})}function p0(e,a){return new Promise((x,t)=>{let n=[];if(e.data){let m=e.data.baseMap?.baseMapLayers||[],i=e.data.operationalLayers||[],l=e.data.tables||[],d=m.concat(i).concat(l);h0(d,n,a).then(y=>{x(y)},y=>t(A(y)))}else x({dependencies:n,urlHash:{}})})}function g0(e){$1(e,"initialState")}function h0(e,a,x){return new Promise((t,n)=>{let m={},i={f:"json",authentication:x},l=[],d={},y=e.filter(o=>{if(o.itemId&&o.layerType==="VectorTileLayer")return l.push(g(o.itemId,x)),!0;if(o.url&&o.url.indexOf("{{velocityUrl}}")<0){let r=/.+FeatureServer/g.exec(o.url),E=Array.isArray(r)&&r.length>0?r[0]:void 0;return E?(Object.keys(d).indexOf(E)<0&&(d[E]=O(o.url,i)),l.push(d[E]),!0):!1}else return!1});l.length>0?Promise.all(l).then(o=>{o.forEach((r,E)=>{if(y[E].layerType==="VectorTileLayer"){let w=u(r,"typeKeywords");if(w&&w.includes("Vector Tile Style Editor")){a.indexOf(r.id)<0&&a.push(r.id),y[E].templatizeId=!0;let s=y[E].styleUrl.indexOf(r.id)+r.id.length;y[E].styleUrl=c(y[E].styleUrl.replace(y[E].styleUrl.substring(0,s),r.id),r.id,".itemUrl")}}else if(u(r,"serviceItemId")){let w=r.serviceItemId;a.indexOf(w)<0&&a.push(w),m[y[E].url]=w}}),t({dependencies:a,urlHash:m})},o=>n(A(o))):t({dependencies:a,urlHash:m})})}function q9(e=[],a,x){e.forEach(t=>{if(t.itemId&&t.layerType==="VectorTileLayer")t.templatizeId&&(t.itemId=c(t.itemId,t.itemId,".itemId"),delete t.templatizeId);else if(t.url){let n=t.url.substr(t.url.lastIndexOf("/")+1),m=Object.keys(a).indexOf(t.url)>-1?a[t.url]:void 0;m&&(w1(n,m,t.url,x),t.url=c(m,m,".layer"+n+".url"),t.itemId=c(m,m,".layer"+n+".itemId"))}})}function K3(e,a){return["data.operationalLayers","data.tables","data.applicationProperties.viewing.search.layers"].forEach(t=>T0(e,a,t)),e}function T0(e,a,x){let t=u(e,x);t&&D(e,x,Z0(t,a))}function Z0(e,a){return e.forEach(x=>{let t=U0(x,a);if(t){let n=t.fields.map(i=>i.name);l7(x,t,t.basePath,t.itemId,n),y7(x,t.basePath,n),x.layerDefinition&&(u7(x.layerDefinition,t.basePath,n),o7(x.layerDefinition,t.basePath,n));let m=u(x,"field.name");m&&D(x,"field.name",d7(m,x,t.itemId,t.basePath))}}),e}function U0(e,a){let x;return a.some(t=>t.ids.indexOf(e.id)>-1?(x=t,!0):!1),x}function Q(e,a,x,t){return new Promise((n,m)=>{let i=j(e);i.item.id=c(i.item.id,i.item.id,".itemId");let l=Q1(i.itemId,"forward",x),d=Promise.resolve({}),y=Promise.resolve([]);switch(e.type){case"Dashboard":case"Data Pipeline":case"Feature Collection":case"Feature Service":case"Hub Initiative":case"Hub Page":case"Hub Site Application":case"Insights Model":case"Oriented Imagery Catalog":case"Project Package":case"Style":case"Workforce Project":case"Web Map":case"Web Mapping Application":case"Web Scene":case"Notebook":d=new Promise(o=>{$(i.itemId,x).then(r=>o(r))});break;case"Form":d=k1(i.itemId,i.item.name,x);break;case"QuickCapture Project":y=e9(i.itemId,x);break}Promise.all([d,l,y]).then(o=>{let[r,E,w]=o;y3(i,t),i.data=l9(r,e.type,t);let s=E;i.dependencies=[],i.relatedItems=[],s.forEach(b=>{b.relationshipType!=="WMA2Code"&&(i.relatedItems.push(b),b.relatedItemIds.forEach(C=>{i.dependencies.indexOf(C)<0&&i.dependencies.push(C)}))}),e.type==="Data Pipeline"&&(i.dependencies=i.dependencies.concat(W0(r)));let P=Promise.resolve(i);switch(e.type){case"Dashboard":b3(i,t);break;case"Notebook":P=z9(i);break;case"Oriented Imagery Catalog":P=g3(i,a,x);break;case"QuickCapture Project":i.resources=w,P=new Promise(async b=>{let C=null,I=-1;w&&(w.some((y1,m1)=>{let i1=y1.name==="qc.project.json";return i1&&(C=y1,I=m1),i1}),I>=0&&w.splice(I,1)),C&&(i.data={application:{...await z1(C)},name:"qc.project.json"}),i.data.application?.basemap?.type==="Web Map"&&i.dependencies.push(i.data.application.basemap.itemId);let L=$9(i);b(L)});break;case"Vector Tile Service":case"Web Map":case"Web Scene":P=O3(i,a,x,t);break;case"Web Mapping Application":r&&(P=P3(i,a,x,t));break;case"Workforce Project":P=C3(i,a,x,t);break}P.then(n,b=>m(A(b)))})})}function W0(e){let a=[];return(e?.inputs??[]).concat(e?.outputs??[]).forEach(t=>{if(t.type==="FeatureServiceSource"||t.type==="FeatureServiceSink"){let n=u(t,"parameters.layer.value.itemId");n&&a.push(n)}}),a}var R={};W(R,{convertItemToTemplate:()=>O0,createItemFromTemplate:()=>K0,postProcess:()=>v0,postProcessFieldReferences:()=>H0});function O0(e,a,x,t){return Q(e,a,x,t)}function K0(e,a,x,t,n){return n?Y(e,a,x,t,n):Y(e,a,x,t)}function H0(e,a,x){switch(x){case"Web Mapping Application":c3(e,a);break;case"Dashboard":s3(e,a);break;case"Web Map":K3(e,a);break}return e}async function v0(e,a,x,t,n,m,i){if(a==="Web Map"&&t.resources.some(l=>l.indexOf(d1)>-1)){let l=t3(`${m.portalBaseUrl}/sharing/rest`,t.itemId,d1),d={httpMethod:"GET",authentication:i,params:{f:"json"},headers:{Accept:"application/json",Authorization:`Bearer ${i.token}`,"Content-Type":"application/json","X-Esri-Authorization":`Bearer ${i.token}`}};await O(l,d).then(async y=>{let o=JSON.stringify(y),r=N(o,m);if(o!==r){let E=JSON.parse(r),w={id:e,resource:E1(E,d1),name:d1,authentication:i,params:{}};await P2(w)}})}return q(e,m,i)}function B0(e,a,x,t){return R.convertItemToTemplate(e,a,x,t)}function u9(e){return!!u(e,"properties.services")}function B3(e,a="https://survey123.arcgis.com"){let x=`${a}/api/survey/create`,t={credentials:"same-origin",method:"POST",body:b2({f:"json",...e},!0)};return fetch(x,t).then(n=>n.json()).then(n=>{if(!n.success)throw new Error(`Failed to create survey: ${n.error.message}`);return{formId:n.id,featureServiceId:n.featureService.source.itemId,folderId:n.formItemInfo.ownerFolder}})}var L3=function(a){let x=Z(a),t=[["header","content"],["subHeader","content"],["footer","content"],["settings","thankYouScreenContent"]],n=(i,l)=>(i&&i[l]&&(i[l]=encodeURIComponent(i[l])),i);t.forEach(([i,l])=>n(x[i],l));let m=i=>n(i,"description");return x.questions=(x.questions||[]).map(i=>i.questions?{...i,questions:i.questions.map(m)}:m(i)),x};function j3(e,a,x){let{item:{title:t,description:n,tags:m,typeKeywords:i},properties:{form:l}}=e,{user:{username:d},portalBaseUrl:y,organization:{basemapGalleryGroupQuery:o,defaultBasemap:{title:r}}}=a,{token:E}=x.toCredential();return J2(o,r,x).then(w=>{let s="Survey-",P=h2(`${s}${t}`,a,"user.folders").replace(s,"");if(l.questions){let C=I=>(I.maps&&(I.maps=I.maps.map(L=>({...L,itemId:w.id}))),I);l.questions=l.questions.map(I=>I.questions?{...I,questions:I.questions.map(C)}:C(I))}let b=L3(l);return{description:n,form:b,portalUrl:y,tags:m,title:P,token:E,typeKeywords:i,username:d}})}function _3(e,a,x,t){let n=N(e,a),{survey123Url:m}=a;return j3(n,a,x).then(i=>B3(i,m)).then(i=>{let{formId:l,featureServiceId:d}=i,y=Promise.resolve(null);return e.item.thumbnail&&(y=b1({id:l},null,x,e.item.thumbnail)),y.then(()=>g(l,x)).then(o=>(a[n.itemId]={itemId:l},a[n.properties.info.serviceInfo.itemId]={itemId:d},t(n.itemId,S.Finished,n.estimatedDeploymentCostFactor,l),{item:{...e,item:o,itemId:l},id:l,type:"Form",postProcess:!0}))}).catch(i=>{throw t(n.itemId,S.Failed,0),i})}function L0(e,a,x,t){return u9(e)?_3(e,a,x,t):R.createItemFromTemplate(e,a,x,t)}async function Y9(e,a){let x=await T9(e),t=new Date;return t=new Date(t.valueOf()-864e5-t.getTimezoneOffset()*1e3*60),x.forEach(n=>{if(typeof n.content=="string"){let m=q3(n,a);e.file(n.file,m,{date:t})}else n.file.endsWith(".xlsx")&&e.file(n.file,n.content,{date:t})}),Promise.resolve(e)}async function X9(e,a){return(await T9(e)).forEach(t=>{if(t.file.endsWith(".info")||t.file.endsWith(".itemInfo")||t.file.endsWith(".json")||t.file.endsWith(".webform")||t.file.endsWith(".xml")){let n=t.content,m=/\b([0-9A-Fa-f]){32}_type/g;n=z3(n,a,m),n=V3(n,a,m),n=J3(n,a),n=$3(n,a),e.file(t.file,n)}}),Promise.resolve(e)}function V3(e,a,x){let t=e;return Object.keys(a).filter(m=>m.match(x)&&a[m].type==="Feature Service").forEach(m=>{let i=a[m].url,l=a[i];l&&(t=t.replace(new RegExp(i,"g"),l))}),t}function z3(e,a,x){let t=e;return Object.keys(a).filter(m=>m.match(x)&&a[m].type!=="Feature Service").map(m=>m.replace("_type","")).forEach(m=>{t=t.replace(new RegExp(m,"g"),`{{${m}.itemId}}`)}),t}function J3(e,a){let x=e;return a.portalBaseUrl&&(x=x.replace(new RegExp(a.portalBaseUrl,"g"),"{{portalBaseUrl}}")),x}function $3(e,a){let x=e;return a.workflowBaseUrl&&(x=x.replace(new RegExp(a.workflowBaseUrl,"g"),"{{workflowBaseUrl}}")),x}function q3(e,a){let x=M2(),t=e.content;return t=N(e.content,a),f1(t.match(x)??[]).forEach(m=>{let i=a[m];typeof i?.itemId=="string"&&(t=t.replace(new RegExp(m,"g"),`${i.itemId}`))}),t}function Y3(e,a,x,t,n,m,i){let l=t.properties.info.serviceInfo.itemId,{itemId:d}=m[l],y=N(t,m);return g(d,i).then(o=>{let r=[{id:e,title:y.item.title,snippet:y.item.snippet,extent:y.item.extent,culture:y.item.culture},{id:d,extent:y.item.extent,typeKeywords:[`source-${l}`].concat(o.typeKeywords)}],E=s=>B(s,i),w=r.map(E);return Promise.all(w).then(()=>{let s=[e,d],P=C=>V({itemId:C,folderId:m.folderId,authentication:i}),b=s.map(P);return Promise.all(b)}).then(()=>c7(o.ownerFolder,i)).then(()=>{let s=j(o);return n.push(s),t.dependencies.push(o.id),!0})})}async function X3(e,a,x,t,n,m,i){let l=await k1(e,"Form",i);if(l){let d=await h9(l),y=await Y9(d,m);t9(y,e,i)}else return await G2(5e3),X3(e,a,x,t,n,m,i);return u9(t)?Y3(e,a,x,t,n,m,i):q(e,m,i)}async function _0(e,a){for(let x of e)if(x.type==="Form"){let t=x.data;if(x.data=null,t){let n=await h9(t);n=await X9(n,a),x.item.name=Q3(x.item.name,t.name,`${x.itemId}.zip`);let m=await p7(n,x.item.name),i=n9(x.itemId,x.item.name,1,M1.data),l={itemId:x.itemId,file:m,folder:i.folder,filename:x.item.name};x.dataFile=l,x.resources.push(i.folder+"/"+i.filename)}}return Promise.resolve(e)}function Q3(e,a,x){let t=e||a;return t&&t!=="undefined"?t:x}var e2={};W(e2,{_initializeNewGroup:()=>e6,convertItemToTemplate:()=>V0,createItemFromTemplate:()=>z0,postProcess:()=>J0});function V0(e,a,x){return new Promise(t=>{let n=W2(e);n.item.id=c(n.item.id,n.item.id,".itemId"),V2(e.id,x).then(m=>{n.type="Group",_2(e.id,x).then(i=>{i.id=n.item.id,n.item={...i,type:"Group"},n.dependencies=m.concat(p2(i.tags)),t(n)},()=>t(n))},()=>t(n))})}function z0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),m.item.thumbnail=e.item.thumbnail;let i=e6(m.item);w7(i.title,i,a,x,R9(m)?a.locationTracking.owner:void 0).then(l=>{if(l.success)if(!t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id))t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)));else if(m.itemId=l.group.id,a[e.itemId]={itemId:l.group.id},m=N(m,a),a[e.itemId].itemId=l.group.id,!t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,l.group.id))t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)));else if(R9(m)){let d=a.locationTracking.owner;C7(l.group.id,d,x).then(y=>{y.success?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id)?G7(l.group.id,[x.username],x).then(o=>{Array.isArray(o.notRemoved)&&o.notRemoved.length===0?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id)?n({item:m,id:l.group.id,type:m.type,postProcess:x1(m)}):(t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))}):(t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))})}else n({item:m,id:l.group.id,type:m.type,postProcess:x1(m)});else t(e.itemId,S.Failed,0),n(k(e.type))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}function J0(e,a,x,t,n,m,i){let l=Promise.resolve({success:!0});return x.some(d=>{if(d.id===e){let y=d.item.item;return x1(y)&&(y=N(y,m),l=M7(y,i)),!0}}),l}function e6(e){let a={access:"private",description:e.description,owner:e.owner,snippet:e.snippet,tags:e.tags,thumbnail:e.thumbnail,title:e.title||"",typeKeywords:e.typeKeywords};return["autoJoin","displaySettings","isInvitationOnly","isOpenData","isViewOnly","membershipAccess","properties","sortField","sortOrder"].forEach(t=>{e.hasOwnProperty(t)&&(a[t]=e[t])}),a}var p1={};W(p1,{convertItemToTemplate:()=>$0,createItemFromTemplate:()=>q0,isAPage:()=>X0,postProcess:()=>Y0});function a6(e,a,x,t){return e=S1(e,x,{}),B7(e,{...t,allowList:[]}).then(()=>!0)}function r9(e){let a=z(e);return(e.dependencies||[]).forEach(t=>{let n=new RegExp(t,"g"),m=`{{${t}.itemId}}`;a.item=u1(a.item,n,m),a.data=u1(a.data,n,m),e.properties&&(a.properties=u1(a.properties,n,m))}),a}function S9(e,a,x){let t=K(V,{success:!0}),n=[t({itemId:e.item.id,folderId:a,authentication:x})];return H(e,"item.properties.parentInitiativeId")&&n.push(t({itemId:e.item.properties.parentInitiativeId,folderId:a,authentication:x})),Promise.all(n)}function $0(e,a,x=null){let t=0,n=0;return Promise.all([D1(e.id,{authentication:a}),n1(a)]).then(([m,i])=>(t=m.item.created,n=m.item.modified,j7(m,i))).then(m=>(m.item.created=t,m.item.modified=n,m.item.typeKeywords=H1(m.item.typeKeywords,"doNotDelete"),m.groups=[],m.estimatedDeploymentCostFactor=2,m.resources=[],H(m,"properties")||(m.properties={}),m=r9(m),m))}function q0(e,a,x,t){if(!t(e.itemId,S.Started,0))return Promise.resolve(k(e.type));if(e.assets&&e.resources&&delete e.assets,a.solutionItemExtent){let y=a.solutionItemExtent.split(",");a.organization.defaultExtentBBox=[[y[0],y[1]],[y[2],y[3]]]}let m={},i,l,d=e.item.thumbnail;return n1(x,a).then(y=>(l=y,_7(e,a,m,l))).then(y=>{let o=y,r={assets:o.assets||[]};return L7(o,r,l)}).then(y=>(i=y,S9(y,a.folderId,x))).then(()=>{let y={item:{id:i.item.id},params:{thumbnail:d},authentication:x};return e1(y)}).then(()=>{if(a[e.itemId]={itemId:i.item.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor||2,i.item.id)){let o={item:{...e,...a1(i)},id:i.item.id,type:e.type,postProcess:!0};return o.item.itemId=i.item.id,o}else return K(v7,{success:!0})(i,l).then(()=>Promise.resolve(k(e.type)))}).catch(y=>{throw t(e.itemId,S.Failed,0),y})}function Y0(e,a,x,t,n,m,i){let l;return n1(i).then(d=>(l=d,D1(e,{authentication:i}))).then(d=>a6(d,x,m,l))}function X0(e){let a=!1;return(e==="Hub Page"||e==="Site Page")&&(a=!0),a}var g1={};W(g1,{convertItemToTemplate:()=>Q0,createItemFromTemplate:()=>e5,isASite:()=>x5,postProcess:()=>a5});function x6(e,a,x){let t=a.filter(n=>n.type.indexOf("Page")>-1).map(n=>n.id);return Promise.all(t.map(n=>D1(n,x))).then(n=>Q7(e,n,x))}function t6(e,a,x,t){let n=a.filter(d=>d.id!==e.item.id),m=n.map(d=>({item:{id:d.id,type:d.type}})),i=[];i=i.concat(X7(e,m,t)),i=i.concat(x6(e,n,t));let l=n.map(d=>d.id);return e.item.properties.children=l,e=$7(e,x,{}),i.push(V7(e,{...t,allowList:void 0})),Promise.all(i).then(()=>!0)}function Q0(e,a,x=null){let t=0,n=0,m,i,l;return n1(a).then(d=>(l=d,D9(e.id,l))).then(d=>(t=d.item.created,n=d.item.modified,m=d.item.title,i=d.data.values.title,Y7(d,l))).then(d=>(d.item.created=t,d.item.modified=n,d.item.title=m,d.item.typeKeywords=H1(d.item.typeKeywords,"doNotDelete"),d.data.values.title=i,d.groups=[],d.estimatedDeploymentCostFactor=2,d.resources=[],u(d,"properties")||(d.properties={}),d.dependencies=f1(d.dependencies),d=r9(d),d))}function e5(e,a,x,t){if(!t(e.itemId,S.Started,0))return Promise.resolve(k(e.type));e.assets&&e.resources&&delete e.assets,a.solution||(a.solution={}),a.solution.title=a.title;let m={},i,l,d=e.item.thumbnail;return n1(x,a).then(y=>(l=y,q7(e,a,m,l))).then(y=>{let o={assets:y.assets||[]};return J7(y,o,l)}).then(y=>(i=y,S9(y,a.folderId,x))).then(()=>{let y={item:{id:i.item.id},params:{thumbnail:d},authentication:x};return e1(y)}).then(()=>{if(a[e.itemId]={itemId:i.item.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor||2,i.item.id)){let o={item:{...e,...a1(i)},id:i.item.id,type:e.type,postProcess:!0};return o.item.itemId=i.item.id,o}else return K(z7,{success:!0})(i,l).then(()=>Promise.resolve(k(e.type)))}).catch(y=>{throw t(e.itemId,S.Failed,0),y})}function a5(e,a,x,t,n,m,i){let l;return n1(i,m).then(d=>(l=d,D9(e,l))).then(d=>t6(d,x,m,l)).then(()=>Promise.resolve(!0))}function x5(e){let a=!1;return(e==="Hub Site Application"||e==="Site Application")&&(a=!0),a}var E9={};W(E9,{convertItemToTemplate:()=>m5,createItemFromTemplate:()=>i5,isAStoryMap:()=>l5});function n6(e={}){let a=0;return Object.keys(e).reduce((x,t)=>(H(e,`${t}.type`)==="webmap"&&t!==`webmap${a}`&&(x.push({original:t,updated:`webmap${a}`}),a++),x),[])}function m6(e){let a=H(e,"data.resources")||{};return Object.keys(a).reduce((x,t)=>(H(a,`${t}.type`)==="webmap"&&x.push(H(a,`${t}.data.itemId`)),x),[])}function l6(e){let a=Y1(e.item.id,e.item.type);a.key=`${L1(e.item.title)}_${v1("i")}`;let x=z(e);a.data=x.data;let t=x.item.created,n=x.item.modified;return a.item=_1(x.item),a.item.created=t,a.item.modified=n,a.item.url="{{storyMapTemplateUrl}}",n6(a.data.resources).forEach(l=>{a.data.resources[l.updated]=z(a.data.resources[l.original]),delete a.data.resources[l.original],a.data.nodes=u1(a.data.nodes,l.original,l.updated)}),a.item.typeKeywords.indexOf(i6)!==-1&&(a.item.typeKeywords=[t5].concat(a.item.typeKeywords.filter(l=>l!==i6))),a.properties={},a.properties.draftFileName="draft_{{timestamp}}.json",Object.assign(a.properties,n5),a.dependencies=m6(e),Promise.resolve(a)}var i6="smstatusunpublishedchanges",t5="smstatuspublished",n5={oembed:{version:"1.0",type:"rich",title:"Example StoryMap",url:"{{storyMapTemplateUrl}}",provider_name:"ArcGIS StoryMaps",provider_url:"{{storyMapBaseUrl}}",width:800,height:600,thumbnail_url:"{{storyMapThumbnailUrl}}",thumbnail_height:"100.5",thumbnail_width:"400",html:'<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',cache_age:86400},oembedXML:`<?xml version="1.0" encoding="utf-8" standalone="yes"?>
3
3
  <oembed>
4
4
  <version>1.0</version>
5
5
  <type>rich</type>