/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import a from"./WV7QX3ED.js";export default $arcgis.t(([{e:c}])=>{async function p(a,e){let t;return await a.when(()=>{t=a.map.allLayers.toArray().reduce((n,r)=>((r.type==="feature"||r?.type==="subtype-group")&&(n[r.id]={name:r.title,supportsUpdate:void 0}),n),{})}),l(e,t,a)}async function m(a,e){let t;return await a.when(()=>{t=a.map.allTables.toArray().reduce((n,r)=>(n[r.id]={name:r.title,supportsUpdate:void 0},n),{})}),l(e,t,a)}async function l(a,e,t){let n={},r=Object.keys(e);for(let s of r)try{let i=await d(t,s);await i.load(),await i.when();let o=i.editingEnabled&&i.capabilities?.operations.supportsUpdate;(!a||a&&o)&&(n[s]={name:e[s].name,supportsUpdate:o})}catch(i){console.log(i);continue}return n}async function h(a,e){let t=await d(a,e);return t?await a.whenLayerView(t):void 0}async function d(a,e){let t=[];return await a?.when(()=>{t=[...a.map.allLayers.toArray(),...a.map.allTables.toArray()].filter(n=>n.id===e)}),t.length>0?t[0]:void 0}async function b(a){let e=a.map.allLayers.filter(n=>n.type==="feature").toArray().map(n=>n),t=[];return await a.when(()=>{t=e.map(n=>a.whenLayerView(n))}),await Promise.allSettled(t),e}async function g(a){let e=a.map.allTables.toArray(),t=[];return await a.when(()=>{t=e.map(n=>n.load())}),await Promise.allSettled(t),e}async function I(a,e,t,n=!1,r=0){return n&&(await f(a,e,t,!1,void 0,r),await new Promise(s=>setTimeout(s,1e3))),e.highlight(a)}async function T(a){let e=u(a);return Object.keys(e).reduce((t,n)=>{let r=e[n];return t.push(r.layerView.highlight(r.ids)),t},[])}function u(a){return a.reduce((e,t)=>{let n=t.layerView,r=n?.layer.id;return r&&Object.keys(e).indexOf(r)>-1?e[r].ids=[...new Set([...t.selectedIds,...e[r].ids])]:r&&(e[r]={layerView:n,ids:t.selectedIds}),t.workflowType==="REFINE"&&Object.keys(t.refineInfos).forEach(s=>{let i=t.refineInfos[s];Object.keys(e).indexOf(s)>-1&&(e[s].ids=[...new Set([...i.addIds,...e[s].ids])],e[s].ids=e[s].ids.filter(o=>i.removeIds.indexOf(o)<0))}),e},{})}async function y(a,e,t){let n={objectIds:a};e.featureEffect={...t,filter:n},setTimeout(()=>{e.featureEffect=void 0},1300)}async function f(a,e,t,n=!0,r,s=0){let i=await c(a,e.layer),o={target:i.extent};i.count===1&&e.layer.geometryType==="point"&&s&&(o.scale=s),await t.goTo(o),n&&await y(a,e,r)}return{a:p,b:m,c:h,d:d,e:b,f:g,g:I,h:T,i:u,j:f}},a)