// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("require exports ../../core/Error ../../core/has ../../core/promiseUtils ../../layers/support/infoFor3D ../../layers/support/source/DataLayerSource ./executeQueryJSON ./executeQueryPBF ../support/FeatureSet ../support/Query".split(" "),function(r,k,t,u,v,l,w,x,y,z,A){async function n(d,b,c,e){e={...e};var a=A.from(b);a.sourceSpatialReference=a.sourceSpatialReference??c?.sourceSpatialReference??null;if(c?.gdbVersion||c?.dynamicDataSource)a=a===b?a.clone():a,a.gdbVersion=b.gdbVersion||c.gdbVersion, a.dynamicDataSource=b.dynamicDataSource?w.DataLayerSource.from(b.dynamicDataSource):c.dynamicDataSource;const h=c?.infoFor3D;if(null!=h&&p(b,h)){a=a===b?a.clone():a;a.formatOf3DObjects=null;const {supportedFormats:f,queryFormats:B}=h,C=l.getMimeTypeFormatId("model/gltf-binary",f)??l.getFilenameFormatId("glb",f),D=l.getMimeTypeFormatId("model/gltf+json",f)??l.getFilenameFormatId("gtlf",f);for(g of B){if(g===C){a.formatOf3DObjects=g;break}g!==D||a.formatOf3DObjects||(a.formatOf3DObjects=g)}if(!a.formatOf3DObjects)throw new t("query:unsupported-3d-query-formats", "Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(null==a.outFields||!a.outFields.includes("*")){a=a===b?a.clone():a;null==a.outFields&&(a.outFields=[]);const {originX:E,originY:F,originZ:G,translationX:H,translationY:I,translationZ:J,scaleX:K,scaleY:L,scaleZ:M,rotationX:N,rotationY:O,rotationZ:P,rotationDeg:Q}=h.transformFieldRoles;a.outFields.push(E,F,G,H,I,J,K,L,M,N,O,P,Q)}}var g=a;b=null!=b.outStatistics?.[0];a=u("featurelayer-pbf-statistics"); b=!b||a;let m;if("pbf"===c?.format&&b)try{m=await y.executeRawQueryPBF(d,g,e)}catch(f){if("query:parsing-pbf"===f.name)c.format="json";else throw f;}"json"!==c?.format&&b||(m=await x.executeRawQueryJSON(d,g,e));q(c?.fieldsIndex,m.fields);return m}function q(d,b){if(null!=d&&null!=b)for(const c of b)(b=d.get(c.name))&&Object.assign(c,b.toJSON())}async function R(d,b,c,e){c=c?.infoFor3D;if(!p(d,c)||null==c||!b.assetMaps||!b.features?.length)return z.fromJSON(b);({meshFeatureSetFromJSON:e}=await v.whenOrAbort(new Promise((a, h)=>r(["../support/meshFeatureSet"],a,h)),e));return e(d,c,b)}function p(d,b){return null!=b&&!0===d.returnGeometry&&"xyFootprint"!==d.multipatchOption&&!d.outStatistics}k.executeQuery=async function(d,b,c,e){d=await n(d,b,c,e);return R(b,d,c,e)};k.executeRawQuery=n;k.normalizeFields=q;Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});