/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
export default $arcgis.t(([d,a,p])=>{async function F(t,e){let r=[],n=t?t.map(o=>w(o,e)):[Promise.resolve()];return(await Promise.all(n)).forEach(o=>{r=[...r,...o||[]]}),r}async function j(t,e,r,n,s,o){let c=e.capabilities?.query.maxRecordCount||1e3,y=0;t.length===0&&(t=await e.queryObjectIds());let u=e.createQuery();if(u.returnGeometry=n,u.objectIds=t.slice(y,c),s&&(u.outSpatialReference=s),o){let q=e.fields.map(i=>i.name.toLowerCase());u.outFields=o.filter(i=>q.indexOf(i.toLowerCase())>-1)}let m=await e.queryFeatures(u);r=r.concat(m.features);let l=t.slice(c,t.length);return l.length>0?j(l,e,r,n,s,o):Promise.resolve(r)}async function I(t,e){let r=e.globalIdField;if(!r)return[];let n=e.createQuery();return n.returnGeometry=!1,n.outFields=[e.objectIdField],n.where=t.map(o=>`${r} = '${o}'`).join(" or "),(await e.queryFeatures(n)).features}async function b(t,e,r,n){let s=e.capabilities?.query.maxRecordCount||1e3,o=e.createQuery();o.start=t,o.num=s,o.geometry=r;let c=await e.queryFeatures(o);return n[e.id]=n[e.id].concat(c.features),c.exceededTransferLimit?b(t+=s,e,r,n):Promise.resolve(n)}async function x(t,e){let r=e.createQuery();return r.objectIds=t,e.queryExtent(r)}function O(t){let e=[],r=f(t,"polygon");r&&e.push(r);let n=f(t,"polyline");n&&e.push(n);let s=f(t,"point");return s&&e.push(s),e}function f(t,e){let r=(t||[]).filter(n=>n.type===e);return r.length<=1?r[0]:d.executeMany(r)}async function w(t,e){let r=e.createQuery();return r.spatialRelationship="intersects",r.geometry=t,e.queryObjectIds(r)}async function h(t,e){return e?t.spatialReference?t.spatialReference.equals(e)||e.isWGS84||e.wkid===4326?t:t.spatialReference.isWGS84||t.spatialReference.wkid===4326?p.project(t,e):(await a.load(),a.execute(t,e)):(console.error("Input geometry does not have a spatial reference"),t):(console.error("Target spatial reference is undefined"),t)}return{a:F,b:j,c:I,d:b,e:x,f:O,g:h}},"geometry/operators/unionOperator","geometry/operators/projectOperator","geometry/support/webMercatorUtils")