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