@arcgis/core 5.2.0-next.46 → 5.2.0-next.48

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 (187) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/003a87b16f8a4b476e14.js +1 -0
  3. package/assets/esri/core/workers/chunks/{2a4868acd546312aa6d8.js → 05f6887805d92da03122.js} +1 -1
  4. package/assets/esri/core/workers/chunks/069b6d8bdb34ee88d437.js +1 -0
  5. package/assets/esri/core/workers/chunks/{68f7eaa3122de7c00adb.js → 0ea374f7b16745b9bbc7.js} +1 -1
  6. package/assets/esri/core/workers/chunks/12e0c5b7cc5c3f9e6f0f.js +1 -0
  7. package/assets/esri/core/workers/chunks/1843a762f7051f61af43.js +1 -0
  8. package/assets/esri/core/workers/chunks/20c363a113dc068de9e0.js +1 -0
  9. package/assets/esri/core/workers/chunks/{f2c8122d31aedc2604ee.js → 24d936d459c538187af6.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{4d4710d57c72ec75cccc.js → 26f1fd3f2be5102aae1d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/285a5bd708f0fe1c620c.js +1 -0
  12. package/assets/esri/core/workers/chunks/2e121eac97ae72a8b49a.js +1 -0
  13. package/assets/esri/core/workers/chunks/{7777a79f26a06a6c5240.js → 304a22c580ce103480cb.js} +1 -1
  14. package/assets/esri/core/workers/chunks/327899182a4dace428eb.js +1 -0
  15. package/assets/esri/core/workers/chunks/32ca15d928d51b380068.js +1 -0
  16. package/assets/esri/core/workers/chunks/{383392c63202ac044b6c.js → 33bd9785bd0b6ccef21b.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{0f19bc532be24ca64755.js → 36fe6adf6517d8f80125.js} +1 -1
  18. package/assets/esri/core/workers/chunks/3e1a7e4c674057807e3a.js +1 -0
  19. package/assets/esri/core/workers/chunks/{d36f17d32c654b1ac7fa.js → 3f1a7f8a9ead64bf0b7b.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{cc637aec16918052548e.js → 47af3525396f890f2a6b.js} +1 -1
  21. package/assets/esri/core/workers/chunks/4d9433f127aef76f3449.js +1 -0
  22. package/assets/esri/core/workers/chunks/4e2baa60c5d5197b2271.js +1 -0
  23. package/assets/esri/core/workers/chunks/4ee900e5dbb130fa0c7b.js +1 -0
  24. package/assets/esri/core/workers/chunks/519c0b51b1ba42fb71d7.js +1 -0
  25. package/assets/esri/core/workers/chunks/{c4b13124a9cfc78c42a6.js → 57fa3c0e7892c2eef3ee.js} +1 -1
  26. package/assets/esri/core/workers/chunks/68b615bbd27fadcfcb66.js +1 -0
  27. package/assets/esri/core/workers/chunks/68d898037feb0aee3138.js +1 -0
  28. package/assets/esri/core/workers/chunks/69b9a327f23e052fced7.js +1 -0
  29. package/assets/esri/core/workers/chunks/69d740ab18510156f5d6.js +1 -0
  30. package/assets/esri/core/workers/chunks/6c2b5087a9df65267f4e.js +1 -0
  31. package/assets/esri/core/workers/chunks/6fbcf1b85461c6c6c127.js +1 -0
  32. package/assets/esri/core/workers/chunks/7659391f952d134164cf.js +1 -0
  33. package/assets/esri/core/workers/chunks/7759a489205a874e13bb.js +1 -0
  34. package/assets/esri/core/workers/chunks/78918035144c3c76df71.js +1 -0
  35. package/assets/esri/core/workers/chunks/{2b669473aa2c7cfb63c7.js → 7b0ed52363704cfce129.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{98f575c038da74ced2a6.js → 7d0ff52748fd4eb0334d.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{8f9fb4e8a7d73db41664.js → 851bcc75acac4a2f199b.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{6010b7be978698a642d0.js → 8977c85aecc7e08ab13c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/8c5726c7ce40a92901e6.js +1 -0
  40. package/assets/esri/core/workers/chunks/{f2adf1227a795604d3b8.js → 90ae80b797642bff0efa.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{dee4019338a79c1ecd26.js → 9d0a9d465ec3a8ba1ed2.js} +1 -1
  42. package/assets/esri/core/workers/chunks/aa3abc07de2921ef6ca1.js +1 -0
  43. package/assets/esri/core/workers/chunks/b03f09ee2224f0cc526a.js +1 -0
  44. package/assets/esri/core/workers/chunks/{728ea88e7d4733230e1f.js → b30237361d87cf982e41.js} +23 -24
  45. package/assets/esri/core/workers/chunks/{ee58f4bbc0a1f7d03df0.js → b32ede7805c7c6644e4c.js} +1 -1
  46. package/assets/esri/core/workers/chunks/b5d23efa584c74955d5b.js +1 -0
  47. package/assets/esri/core/workers/chunks/b83f2bbd634f57a5e8f9.js +1 -0
  48. package/assets/esri/core/workers/chunks/b8bdacebd4d24ba90f3f.js +1 -0
  49. package/assets/esri/core/workers/chunks/bab71e1b8b93d09d4809.js +1 -0
  50. package/assets/esri/core/workers/chunks/bb8e9b8343b83dd1ba3c.js +1 -0
  51. package/assets/esri/core/workers/chunks/bd8b180c61a80e60568c.js +1 -0
  52. package/assets/esri/core/workers/chunks/be6caade351e89f84251.js +680 -0
  53. package/assets/esri/core/workers/chunks/{8026cc0065f6520c4161.js → bef1990159c0e49e7d27.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{b3cd17daf5a297b96705.js → c3766d98f0a70897647f.js} +1 -1
  55. package/assets/esri/core/workers/chunks/cd1f1a72483b7c80bd9a.js +1 -0
  56. package/assets/esri/core/workers/chunks/{744f34e379484e63277c.js → cdb331b58e22f8c1c988.js} +2 -2
  57. package/assets/esri/core/workers/chunks/{b23d1e10fc4161d1f3eb.js → d021775cf747556660a5.js} +1 -1
  58. package/assets/esri/core/workers/chunks/d49e42f36bc3dc256b9f.js +1 -0
  59. package/assets/esri/core/workers/chunks/{7c2784ebbe17d79f669c.js → de50a19944617cd426b8.js} +1 -1
  60. package/assets/esri/core/workers/chunks/e232459f0b00110e07ac.js +1 -0
  61. package/assets/esri/core/workers/chunks/e7e3ea7af928b49b226c.js +1 -0
  62. package/assets/esri/core/workers/chunks/ee6bb6cd16f99421c76b.js +1 -0
  63. package/assets/esri/core/workers/chunks/fd2ba6f76645ba503cbb.js +1 -0
  64. package/assets/esri/core/workers/chunks/{85cd0cd721b27c497b18.js → fed6c75485601cd3afa1.js} +1 -1
  65. package/assets/esri/core/workers/chunks/ff2c4f648f77850922d5.js +1 -0
  66. package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
  67. package/assets/esri/libs/basisu/basis_transcoder.wasm +0 -0
  68. package/chunks/DefaultMaterial.glsl.js +1 -1
  69. package/chunks/basis_encoder.js +1 -1
  70. package/chunks/basis_transcoder.js +1 -1
  71. package/config.js +1 -1
  72. package/core/has.js +1 -1
  73. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  74. package/core/promiseUtils.js +1 -1
  75. package/core/workers/workerFactory.js +1 -1
  76. package/geometry/Mesh.d.ts +4 -4
  77. package/geometry/support/MeshMaterialMetallicRoughness.d.ts +13 -1
  78. package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
  79. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  80. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  81. package/geometry/support/meshUtils.d.ts +33 -5
  82. package/geometry/support/plane.js +1 -1
  83. package/kernel.js +1 -1
  84. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  85. package/layers/raster/formats/JpgPlus.js +1 -1
  86. package/layers/raster/formats/RasterCodec.js +1 -1
  87. package/layers/raster/formats/TiffDecoder.js +1 -1
  88. package/layers/raster/formats/Zlib.js +2 -0
  89. package/package.json +2 -2
  90. package/rest/featureService/FeatureService.d.ts +74 -1
  91. package/rest/featureService/FeatureService.js +1 -1
  92. package/support/revision.js +1 -1
  93. package/symbols/ObjectSymbol3DLayer.d.ts +10 -8
  94. package/symbols/support/ObjectSymbol3DLayerResource.d.ts +9 -4
  95. package/views/2d/analysis/AreaMeasurement/AreaMeasurementAreaVisualization.js +1 -1
  96. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  97. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  98. package/views/2d/engine/webgl/mesh/MultiTileMeshData.js +1 -1
  99. package/views/2d/layers/features/Processor.js +1 -1
  100. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  101. package/views/2d/layers/features/processor/AggregateStrategy.js +2 -0
  102. package/views/2d/layers/features/processor/bins/BinAdapter.js +2 -0
  103. package/views/2d/layers/features/processor/bins/BinLevelState.js +2 -0
  104. package/views/2d/layers/features/processor/bins/BinState.js +2 -0
  105. package/views/2d/layers/features/processor/bins/createBinningStrategy.js +2 -0
  106. package/views/2d/layers/features/processor/clusters/ClusterAdapter.js +2 -0
  107. package/views/2d/layers/features/processor/clusters/ClusterLevelState.js +2 -0
  108. package/views/2d/layers/features/processor/clusters/ClusterSendState.js +2 -0
  109. package/views/2d/layers/features/processor/clusters/createClusterStrategy.js +2 -0
  110. package/views/2d/layers/features/processor/createAggregateStrategy.js +2 -0
  111. package/views/2d/layers/features/processor/tracks/Track.js +2 -0
  112. package/views/2d/layers/features/processor/tracks/TrackAdapter.js +2 -0
  113. package/views/2d/layers/features/processor/tracks/TrackLevelState.js +2 -0
  114. package/views/2d/layers/features/processor/tracks/TrackSendState.js +2 -0
  115. package/views/2d/layers/features/processor/tracks/createTrackStrategy.js +2 -0
  116. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  117. package/views/3d/glTF/LoaderResult.js +1 -1
  118. package/views/3d/glTF/internal/Resource.js +1 -1
  119. package/views/3d/glTF/loader.js +1 -1
  120. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  121. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  122. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  123. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  124. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  125. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +19 -20
  126. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  127. package/views/3d/webgl-engine/lib/NavigationDepthCache.js +1 -1
  128. package/views/3d/webgl-engine/lib/NavigationDepthCacheStore.js +2 -0
  129. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  130. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  131. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  132. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  133. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  134. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  135. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  136. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  137. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  138. package/views/PopupView.js +1 -1
  139. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  140. package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
  141. package/views/support/AnalysisViewManager.js +1 -1
  142. package/assets/esri/core/workers/chunks/0115681a3de6df0aebdf.js +0 -1
  143. package/assets/esri/core/workers/chunks/025caafc70ac26f0a4ed.js +0 -1
  144. package/assets/esri/core/workers/chunks/08e18fb12533fc76e49c.js +0 -1
  145. package/assets/esri/core/workers/chunks/176c5eaaa23a479c88e0.js +0 -1
  146. package/assets/esri/core/workers/chunks/1f118d85d8271ad7690b.js +0 -1
  147. package/assets/esri/core/workers/chunks/268637fd6c50264acfc3.js +0 -1
  148. package/assets/esri/core/workers/chunks/296fa9fb80e521c30cb1.js +0 -1
  149. package/assets/esri/core/workers/chunks/354199a41de44902de84.js +0 -1
  150. package/assets/esri/core/workers/chunks/384b619854ef8a3f6e94.js +0 -1
  151. package/assets/esri/core/workers/chunks/3af923abeb6e65c4468f.js +0 -1
  152. package/assets/esri/core/workers/chunks/46d3ddf62fa7a76dd57d.js +0 -1
  153. package/assets/esri/core/workers/chunks/4b24f72b56edc28bb15e.js +0 -1
  154. package/assets/esri/core/workers/chunks/4f09f208ece2ec1db727.js +0 -1
  155. package/assets/esri/core/workers/chunks/57374213084bef59b776.js +0 -1
  156. package/assets/esri/core/workers/chunks/5f9c4dad6952c4c58ebf.js +0 -1
  157. package/assets/esri/core/workers/chunks/706230b70a36d2e038f7.js +0 -1
  158. package/assets/esri/core/workers/chunks/7cc729b57a6a52c8ac68.js +0 -1
  159. package/assets/esri/core/workers/chunks/804ab5f614efa12a131b.js +0 -1
  160. package/assets/esri/core/workers/chunks/81d55594cee124040565.js +0 -1
  161. package/assets/esri/core/workers/chunks/8d90bef1091204fba0f1.js +0 -1
  162. package/assets/esri/core/workers/chunks/8ec5e470583b75fceae1.js +0 -1
  163. package/assets/esri/core/workers/chunks/9114a575b78a7ea18d0f.js +0 -1
  164. package/assets/esri/core/workers/chunks/93e705c1147cc8ceca02.js +0 -1
  165. package/assets/esri/core/workers/chunks/a8033e606b2db1ee332d.js +0 -1
  166. package/assets/esri/core/workers/chunks/a9c641bcdef161c754bf.js +0 -1
  167. package/assets/esri/core/workers/chunks/ad5c2b0de6713d0a93a4.js +0 -680
  168. package/assets/esri/core/workers/chunks/ae50b2d5e63f62c088d2.js +0 -1
  169. package/assets/esri/core/workers/chunks/aea247138617e12b699b.js +0 -1
  170. package/assets/esri/core/workers/chunks/b03dcf3d55266745f3d1.js +0 -1
  171. package/assets/esri/core/workers/chunks/c01a121ebe571a848452.js +0 -1
  172. package/assets/esri/core/workers/chunks/c3cd38ca8690286d40d7.js +0 -1
  173. package/assets/esri/core/workers/chunks/c6042825f61cd70d54d8.js +0 -1
  174. package/assets/esri/core/workers/chunks/d8b67ca02cdc1e8191e3.js +0 -1
  175. package/assets/esri/core/workers/chunks/dadefe369f49e89a2610.js +0 -1
  176. package/assets/esri/core/workers/chunks/db416ba3132034e20642.js +0 -1
  177. package/assets/esri/core/workers/chunks/dfbdc72c7ea137e3841d.js +0 -1
  178. package/assets/esri/core/workers/chunks/e3e966777f18164afcd8.js +0 -1
  179. package/assets/esri/core/workers/chunks/e9c48630757bea465b7e.js +0 -1
  180. package/assets/esri/core/workers/chunks/f8f0de841be17cd05c8f.js +0 -1
  181. package/assets/esri/core/workers/chunks/ff089723a27859fe18d1.js +0 -1
  182. package/chunks/Zlib.js +0 -2
  183. package/views/2d/layers/features/processor/AAggregateStrategy.js +0 -2
  184. package/views/2d/layers/features/processor/BinningStrategy.js +0 -2
  185. package/views/2d/layers/features/processor/ClusterStrategy.js +0 -2
  186. package/views/2d/layers/features/processor/TrackStrategy.js +0 -2
  187. /package/assets/esri/core/workers/chunks/{744f34e379484e63277c.js.LICENSE.txt → cdb331b58e22f8c1c988.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getAssetUrl as e}from"../../assets.js";import r from"../../config.js";import{getLocale as t}from"../../intl.js";import{fullVersion as o}from"../../kernel.js";import has from"../has.js";import s from"../Logger.js";import{makeAbsolute as a}from"../urlUtils.js";import{loaderConfig as n}from"./loaderConfig.js";import{receiveMessage as i,MessageType as l}from"./utils.js";import f from"./WorkerFallback.js";import{commitHash as u,buildDate as c}from"../../support/revision.js";const d=()=>s.getLogger("esri.core.workers.workerFactory"),{HANDSHAKE:m}=l,p='"use strict";let globalId=0;const outgoing=new Map,configuration={CONFIGURATION};self.esriConfig=configuration.esriConfig;const workerPath=self.esriConfig.workers.workerPath,HANDSHAKE=0,OPEN=1,OPENED=2,RESPONSE=3,INVOKE=4,ABORT=5;function createAbortError(){const e=new Error("Aborted");return e.name="AbortError",e}function receiveMessage(e){return e&&e.data?"string"==typeof e.data?JSON.parse(e.data):e.data:null}self.invokeStaticMessage=(e,o,r)=>{const t=r&&r.signal,n=globalId++;let s=null;return new Promise((r,i)=>{if(t){if(t.aborted)return i(createAbortError());s=()=>{outgoing.get(n)&&(outgoing.delete(n),self.postMessage({type:5,jobId:n}),i(createAbortError()))},t.addEventListener("abort",s)}outgoing.set(n,{resolve:r,reject:i}),self.postMessage({type:4,jobId:n,methodName:e,abortable:null!=t,data:o})}).finally(()=>{t&&t.removeEventListener("abort",s)})};let workerRevisionChecked=!1;function checkWorkerRevision(e){if(!workerRevisionChecked&&e.kernelInfo){workerRevisionChecked=!0;const{revision:o,fullVersion:r}=configuration.kernelInfo,{revision:t,fullVersion:n,version:s}=e.kernelInfo;esriConfig.assetsPath!==esriConfig.defaultAssetsPath&&o!==t&&console.warn(`Version mismatch detected between ArcGIS Maps SDK for JavaScript modules and assets. For more information visit https://esriurl.com/using-local-assets.\nModules version: ${r}\nAssets version: ${n??s}\nAssets path: ${esriConfig.assetsPath}`)}}function messageHandler(e){const o=receiveMessage(e);if(!o)return;const r=o.jobId;switch(o.type){case 1:let t;function n(e){const o=t.connect(e);self.postMessage({type:2,jobId:r,data:o},[o])}"function"==typeof define&&define.amd?require([workerPath],e=>{t=e.default||e,checkWorkerRevision(t),t.loadWorker(o.modulePath).then(e=>e||new Promise(e=>{require([o.modulePath],e)})).then(n)}):"System"in self&&"function"==typeof System.import?System.import(workerPath).then(e=>(t=e.default,checkWorkerRevision(t),t.loadWorker(o.modulePath))).then(e=>e||System.import(o.modulePath)).then(n):esriConfig.workers.useDynamicImport?import(workerPath).then(e=>{t=e.default||e,checkWorkerRevision(t),t.loadWorker(o.modulePath).then(e=>e||import(o.modulePath)).then(n)}):(self.RemoteClient||importScripts(workerPath),t=self.RemoteClient.default||self.RemoteClient,checkWorkerRevision(t),t.loadWorker(o.modulePath).then(n));break;case 3:if(outgoing.has(r)){const s=outgoing.get(r);outgoing.delete(r),o.error?s.reject(JSON.parse(o.error)):s.resolve(o.data)}}}self.dojoConfig=configuration.loaderConfig,esriConfig.workers.loaderUrl&&(self.importScripts(esriConfig.workers.loaderUrl),"function"==typeof require&&"function"==typeof require.config&&require.config(configuration.loaderConfig)),self.addEventListener("message",messageHandler),self.postMessage({type:0});';let g,y;const h="Failed to create Worker. Fallback to execute module in main thread";async function k(){if(!has("esri-workers"))return w(new f);if(!g&&!y)try{const e=p.split("{CONFIGURATION}").join(b());g=URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}catch(r){y=r||{}}let e;if(g)try{e=new Worker(g,{name:"esri-worker-"+v++})}catch(r){d().warn(h,y),e=new f}else d().warn(h,y),e=new f;return w(e)}async function w(e){return new Promise(r=>{function t(s){const a=i(s);a&&a.type===m&&(e.removeEventListener("message",t),e.removeEventListener("error",o),r(e))}function o(r){r.preventDefault(),e.removeEventListener("message",t),e.removeEventListener("error",o),d().warn("Failed to create Worker. Fallback to execute module in main thread",r),(e=new f).addEventListener("message",t),e.addEventListener("error",o)}e.addEventListener("message",t),e.addEventListener("error",o)})}function b(){let s;if(null!=r.default){const e={...r};delete e.default,s=JSON.parse(JSON.stringify(e))}else s=JSON.parse(JSON.stringify(r));s.assetsPath=a(s.assetsPath),s.defaultAssetsPath=s.defaultAssetsPath?a(s.defaultAssetsPath):void 0,s.request.interceptors=[],s.log.interceptors=[],s.locale=t(),s.has={"esri-csp-restrictions":has("esri-csp-restrictions"),"esri-2d-debug":!1,"esri-2d-update-debug":has("esri-2d-update-debug"),"esri-2d-annotation-dimension-debug":has("esri-2d-annotation-dimension-debug"),"esri-2d-log-updating":!1,"featurelayer-pbf":has("featurelayer-pbf"),"featurelayer-simplify-thresholds":has("featurelayer-simplify-thresholds"),"featurelayer-simplify-payload-size-factors":has("featurelayer-simplify-payload-size-factors"),"featurelayer-simplify-mobile-factor":has("featurelayer-simplify-mobile-factor"),"featurelayer-query-max-depth":has("featurelayer-query-max-depth"),"featurelayer-query-max-page-size":has("featurelayer-query-max-page-size"),"featurelayer-query-tile-max-features":has("featurelayer-query-tile-max-features"),"featurelayer-query-tile-concurrency":has("featurelayer-query-tile-concurrency"),"featurelayer-query-pausing-enabled":has("featurelayer-query-pausing-enabled"),"featurelayer-snapshot-concurrency":has("featurelayer-snapshot-concurrency"),"featurelayer-snapshot-enabled":has("featurelayer-snapshot-enabled"),"parquetlayer-full-query-feature-count":has("parquetlayer-full-query-feature-count"),"parquetlayer-cache-enabled":has("parquetlayer-cache-enabled"),"parquetlayer-legacy-field-overrides-enabled":has("parquetlayer-legacy-field-overrides-enabled"),"esri-atomics":has("esri-atomics"),"esri-shared-array-buffer":has("esri-shared-array-buffer"),"esri-tiles-debug":has("esri-tiles-debug"),"esri-workers-arraybuffer-transfer":has("esri-workers-arraybuffer-transfer"),"feature-polyline-generalization-factor":has("feature-polyline-generalization-factor"),"host-webworker":1},s.workers.loaderUrl&&(s.workers.loaderUrl=a(s.workers.loaderUrl)),s.workers.workerPath?s.workers.workerPath=a(s.workers.workerPath):s.workers.workerPath=a(e("esri/core/workers/RemoteClient.js")),s.workers.useDynamicImport=has("esri-esbuild-build");const i=r.workers.loaderConfig,l=n({baseUrl:i?.baseUrl,locale:t(),has:{"csp-restrictions":1,"dojo-test-sniff":0,"host-webworker":1,...i?.has},map:{...i?.map},paths:{...i?.paths},packages:i?.packages||[]}),f={buildDate:c,fullVersion:o,revision:u};return JSON.stringify({esriConfig:s,loaderConfig:l,kernelInfo:f})}let v=0;export{k as createWorker};
2
+ import{getAssetUrl as e}from"../../assets.js";import r from"../../config.js";import{getLocale as t}from"../../intl.js";import{fullVersion as o}from"../../kernel.js";import has from"../has.js";import s from"../Logger.js";import{makeAbsolute as a}from"../urlUtils.js";import{loaderConfig as n}from"./loaderConfig.js";import{receiveMessage as i,MessageType as l}from"./utils.js";import f from"./WorkerFallback.js";import{commitHash as u,buildDate as c}from"../../support/revision.js";const d=()=>s.getLogger("esri.core.workers.workerFactory"),{HANDSHAKE:m}=l,p='"use strict";let globalId=0;const outgoing=new Map,configuration={CONFIGURATION};self.esriConfig=configuration.esriConfig;const workerPath=self.esriConfig.workers.workerPath,HANDSHAKE=0,OPEN=1,OPENED=2,RESPONSE=3,INVOKE=4,ABORT=5;function createAbortError(){const e=new Error("Aborted");return e.name="AbortError",e}function receiveMessage(e){return e&&e.data?"string"==typeof e.data?JSON.parse(e.data):e.data:null}self.invokeStaticMessage=(e,o,r)=>{const t=r&&r.signal,n=globalId++;let s=null;return new Promise((r,i)=>{if(t){if(t.aborted)return i(createAbortError());s=()=>{outgoing.get(n)&&(outgoing.delete(n),self.postMessage({type:5,jobId:n}),i(createAbortError()))},t.addEventListener("abort",s)}outgoing.set(n,{resolve:r,reject:i}),self.postMessage({type:4,jobId:n,methodName:e,abortable:null!=t,data:o})}).finally(()=>{t&&t.removeEventListener("abort",s)})};let workerRevisionChecked=!1;function checkWorkerRevision(e){if(!workerRevisionChecked&&e.kernelInfo){workerRevisionChecked=!0;const{revision:o,fullVersion:r}=configuration.kernelInfo,{revision:t,fullVersion:n,version:s}=e.kernelInfo;esriConfig.assetsPath!==esriConfig.defaultAssetsPath&&o!==t&&console.warn(`Version mismatch detected between ArcGIS Maps SDK for JavaScript modules and assets. For more information visit https://esriurl.com/using-local-assets.\nModules version: ${r}\nAssets version: ${n??s}\nAssets path: ${esriConfig.assetsPath}`)}}function messageHandler(e){const o=receiveMessage(e);if(!o)return;const r=o.jobId;switch(o.type){case 1:let t;function n(e){const o=t.connect(e);self.postMessage({type:2,jobId:r,data:o},[o])}"function"==typeof define&&define.amd?require([workerPath],e=>{t=e.default||e,checkWorkerRevision(t),t.loadWorker(o.modulePath).then(e=>e||new Promise(e=>{require([o.modulePath],e)})).then(n)}):"System"in self&&"function"==typeof System.import?System.import(workerPath).then(e=>(t=e.default,checkWorkerRevision(t),t.loadWorker(o.modulePath))).then(e=>e||System.import(o.modulePath)).then(n):esriConfig.workers.useDynamicImport?import(workerPath).then(e=>{t=e.default||e,checkWorkerRevision(t),t.loadWorker(o.modulePath).then(e=>e||import(o.modulePath)).then(n)}):(self.RemoteClient||importScripts(workerPath),t=self.RemoteClient.default||self.RemoteClient,checkWorkerRevision(t),t.loadWorker(o.modulePath).then(n));break;case 3:if(outgoing.has(r)){const s=outgoing.get(r);outgoing.delete(r),o.error?s.reject(JSON.parse(o.error)):s.resolve(o.data)}}}self.dojoConfig=configuration.loaderConfig,esriConfig.workers.loaderUrl&&(self.importScripts(esriConfig.workers.loaderUrl),"function"==typeof require&&"function"==typeof require.config&&require.config(configuration.loaderConfig)),self.addEventListener("message",messageHandler),self.postMessage({type:0});';let g,y;const h="Failed to create Worker. Fallback to execute module in main thread";async function k(){if(!has("esri-workers"))return b(new f);if(!g&&!y)try{const e=p.split("{CONFIGURATION}").join(w());g=URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}catch(r){y=r||{}}let e;if(g)try{e=new Worker(g,{name:"esri-worker-"+v++})}catch(r){d().warn(h,y),e=new f}else d().warn(h,y),e=new f;return b(e)}async function b(e){return new Promise(r=>{function t(s){const a=i(s);a&&a.type===m&&(e.removeEventListener("message",t),e.removeEventListener("error",o),r(e))}function o(r){r.preventDefault(),e.removeEventListener("message",t),e.removeEventListener("error",o),d().warn("Failed to create Worker. Fallback to execute module in main thread",r),(e=new f).addEventListener("message",t),e.addEventListener("error",o)}e.addEventListener("message",t),e.addEventListener("error",o)})}function w(){let s;if(null!=r.default){const e={...r};delete e.default,s=JSON.parse(JSON.stringify(e))}else s=JSON.parse(JSON.stringify(r));s.assetsPath=a(s.assetsPath),s.defaultAssetsPath=s.defaultAssetsPath?a(s.defaultAssetsPath):void 0,s.request.interceptors=[],s.log.interceptors=[],s.locale=t(),s.has={"esri-csp-restrictions":has("esri-csp-restrictions"),"esri-2d-debug":!1,"esri-2d-update-debug":has("esri-2d-update-debug"),"esri-2d-annotation-dimension-debug":has("esri-2d-annotation-dimension-debug"),"esri-2d-log-updating":!1,"featurelayer-pbf":has("featurelayer-pbf"),"featurelayer-simplify-thresholds":has("featurelayer-simplify-thresholds"),"featurelayer-simplify-payload-size-factors":has("featurelayer-simplify-payload-size-factors"),"featurelayer-simplify-mobile-factor":has("featurelayer-simplify-mobile-factor"),"featurelayer-query-max-depth":has("featurelayer-query-max-depth"),"featurelayer-query-max-page-size":has("featurelayer-query-max-page-size"),"featurelayer-query-tile-max-features":has("featurelayer-query-tile-max-features"),"featurelayer-query-tile-concurrency":has("featurelayer-query-tile-concurrency"),"featurelayer-query-pausing-enabled":has("featurelayer-query-pausing-enabled"),"featurelayer-snapshot-concurrency":has("featurelayer-snapshot-concurrency"),"featurelayer-snapshot-enabled":has("featurelayer-snapshot-enabled"),"featurelayer-pixel-buffering-enabled":has("featurelayer-pixel-buffering-enabled"),"parquetlayer-full-query-feature-count":has("parquetlayer-full-query-feature-count"),"parquetlayer-cache-enabled":has("parquetlayer-cache-enabled"),"parquetlayer-legacy-field-overrides-enabled":has("parquetlayer-legacy-field-overrides-enabled"),"esri-atomics":has("esri-atomics"),"esri-shared-array-buffer":has("esri-shared-array-buffer"),"esri-tiles-debug":has("esri-tiles-debug"),"esri-workers-arraybuffer-transfer":has("esri-workers-arraybuffer-transfer"),"feature-polyline-generalization-factor":has("feature-polyline-generalization-factor"),"host-webworker":1},s.workers.loaderUrl&&(s.workers.loaderUrl=a(s.workers.loaderUrl)),s.workers.workerPath?s.workers.workerPath=a(s.workers.workerPath):s.workers.workerPath=a(e("esri/core/workers/RemoteClient.js")),s.workers.useDynamicImport=has("esri-esbuild-build");const i=r.workers.loaderConfig,l=n({baseUrl:i?.baseUrl,locale:t(),has:{"csp-restrictions":1,"dojo-test-sniff":0,"host-webworker":1,...i?.has},map:{...i?.map},paths:{...i?.paths},packages:i?.packages||[]}),f={buildDate:c,fullVersion:o,revision:u};return JSON.stringify({esriConfig:s,loaderConfig:l,kernelInfo:f})}let v=0;export{k as createWorker};
@@ -453,11 +453,11 @@ export default class Mesh extends MeshSuperclass {
453
453
  */
454
454
  static createCylinder(location: Point, parameters?: CreateCylinderParameters): Mesh;
455
455
  /**
456
- * Creates a new mesh geometry from a glTF model referenced by the `url` parameter.
456
+ * Creates a new mesh geometry from a glTF model referenced by the `url` parameter. The spatial reference of the
457
+ * resulting mesh is the same as the spatial reference of the `location` parameter.
457
458
  *
458
- * The spatial reference of the resulting mesh is the same as the spatial reference of the `location` parameter. For
459
- * more information on the supported glTF features you can read the
460
- * [Visualizing points with 3D symbols](https://developers.arcgis.com/javascript/latest/visualizing-points-3d/) guide topic. Animations are currently unsupported.
459
+ * See section [Supported GLTF features](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#supported-gltf-features)
460
+ * for details.
461
461
  *
462
462
  * @deprecated since version 5.1. Use [createFromGLTF()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#createFromGLTF) instead.
463
463
  * @param location - The location of the origin of the model. If the location does not
@@ -8,7 +8,7 @@ import type { ColorLike } from "../../Color.js";
8
8
  import type { MeshTextureProperties } from "./MeshTexture.js";
9
9
  import type { MeshTextureTransformProperties } from "./MeshTextureTransform.js";
10
10
 
11
- export interface MeshMaterialMetallicRoughnessProperties extends MeshMaterialProperties, Partial<Pick<MeshMaterialMetallicRoughness, "emissiveStrength" | "metallic" | "roughness">> {
11
+ export interface MeshMaterialMetallicRoughnessProperties extends MeshMaterialProperties, Partial<Pick<MeshMaterialMetallicRoughness, "emissiveStrength" | "metallic" | "roughness" | "unlit">> {
12
12
  /**
13
13
  * Specifies a single, uniform emissive color for the [MeshComponent](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/MeshComponent/).
14
14
  * The emissiveColor is added to the base color of the component.
@@ -147,4 +147,16 @@ export default class MeshMaterialMetallicRoughness extends MeshMaterial {
147
147
  * @default 1
148
148
  */
149
149
  accessor roughness: number;
150
+ /**
151
+ * Specifies whether the material is lit or unlit. If this flag is true the material will be rendered with
152
+ * [MeshMaterial.color](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/MeshMaterial/#color), [MeshMaterial.colorTexture](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/MeshMaterial/#colorTexture) or with vertex
153
+ * colors. All other lighting or color properties will be ignored. Alpha coverage and alpha values apply to unlit
154
+ * materials.
155
+ *
156
+ * This flag is equivalent to the flag introduced by the GLTF extension [KHR_materials_unlit](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_unlit)
157
+ * and will be exported and imported when reading or writing GLTFs.
158
+ *
159
+ * @default false
160
+ */
161
+ accessor unlit: boolean;
150
162
  }
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Color.js";import{property as s,subclass as r}from"../../core/accessorSupport/decorators.js";import o from"./MeshMaterial.js";import i from"./MeshTexture.js";import l from"./MeshTextureTransform.js";let u=class extends o{constructor(e){super(e),this.emissiveColor=null,this.emissiveStrength=null,this.emissiveTextureTransform=void 0,this.occlusionTextureTransform=void 0,this.metallic=1,this.roughness=1,this.metallicRoughnessTextureTransform=void 0}get emissiveTexture(){return this._get("emissiveTexture")}set emissiveTexture(e){this._set("emissiveTexture",null==e?null:i.from(e))}get occlusionTexture(){return this._get("occlusionTexture")}set occlusionTexture(e){this._set("occlusionTexture",null==e?null:i.from(e))}get metallicRoughnessTexture(){return this._get("metallicRoughnessTexture")}set metallicRoughnessTexture(e){this._set("metallicRoughnessTexture",null==e?null:i.from(e))}getMemoryUsage(){let e=super.getMemoryUsage();return e+=null!=this.emissiveColor?16:0,null!=this.emissiveTexture&&(e+=this.emissiveTexture.memoryUsage),e+=null!=this.emissiveTextureTransform?20:0,null!=this.occlusionTexture&&(e+=this.occlusionTexture.memoryUsage),e+=null!=this.occlusionTextureTransform?20:0,null!=this.metallicRoughnessTexture&&(e+=this.metallicRoughnessTexture.memoryUsage),e+=null!=this.metallicRoughnessTextureTransform?20:0,e}};e([s({type:t,json:{write:!0}})],u.prototype,"emissiveColor",void 0),e([s({json:{write:!0}})],u.prototype,"emissiveStrength",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"emissiveTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"emissiveTextureTransform",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"occlusionTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"occlusionTextureTransform",void 0),e([s({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],u.prototype,"metallic",void 0),e([s({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],u.prototype,"roughness",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"metallicRoughnessTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"metallicRoughnessTextureTransform",void 0),u=e([r("esri.geometry.support.MeshMaterialMetallicRoughness")],u);export{u as default};
2
+ import{__decorate as e}from"tslib";import t from"../../Color.js";import{property as s,subclass as o}from"../../core/accessorSupport/decorators.js";import r from"./MeshMaterial.js";import i from"./MeshTexture.js";import l from"./MeshTextureTransform.js";let u=class extends r{constructor(e){super(e),this.emissiveColor=null,this.emissiveStrength=null,this.emissiveTextureTransform=void 0,this.occlusionTextureTransform=void 0,this.metallic=1,this.roughness=1,this.metallicRoughnessTextureTransform=void 0,this.unlit=!1}get emissiveTexture(){return this._get("emissiveTexture")}set emissiveTexture(e){this._set("emissiveTexture",null==e?null:i.from(e))}get occlusionTexture(){return this._get("occlusionTexture")}set occlusionTexture(e){this._set("occlusionTexture",null==e?null:i.from(e))}get metallicRoughnessTexture(){return this._get("metallicRoughnessTexture")}set metallicRoughnessTexture(e){this._set("metallicRoughnessTexture",null==e?null:i.from(e))}getMemoryUsage(){let e=super.getMemoryUsage();return e+=null!=this.emissiveColor?16:0,null!=this.emissiveTexture&&(e+=this.emissiveTexture.memoryUsage),e+=null!=this.emissiveTextureTransform?20:0,null!=this.occlusionTexture&&(e+=this.occlusionTexture.memoryUsage),e+=null!=this.occlusionTextureTransform?20:0,null!=this.metallicRoughnessTexture&&(e+=this.metallicRoughnessTexture.memoryUsage),e+=null!=this.metallicRoughnessTextureTransform?20:0,e}};e([s({type:t,json:{write:!0}})],u.prototype,"emissiveColor",void 0),e([s({json:{write:!0}})],u.prototype,"emissiveStrength",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"emissiveTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"emissiveTextureTransform",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"occlusionTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"occlusionTextureTransform",void 0),e([s({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],u.prototype,"metallic",void 0),e([s({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],u.prototype,"roughness",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"metallicRoughnessTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"metallicRoughnessTextureTransform",void 0),e([s({type:Boolean,nonNullable:!0,json:{write:!0}})],u.prototype,"unlit",void 0),u=e([o("esri.geometry.support.MeshMaterialMetallicRoughness")],u);export{u as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{colorGamma as e}from"../../../../../colorUtils.js";import t from"../../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{deg2rad as r}from"../../../../../core/mathUtils.js";import{exactEquals as i}from"../../../../../core/libs/gl-matrix-2/math/quat.js";import{clone as o,IDENTITY as a}from"../../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{exactEquals as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as l,clone as c,ONES as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../../MeshMaterialMetallicRoughness.js";import{convertVertexSpace as f}from"../../vertexSpaceConversion.js";import{Buffer as m}from"./buffer.js";import{smoothNormals as p}from"./geometry.js";import{imageToArrayBuffer as d,imageToDataURI as g}from"./imageutils.js";import{isEncodedMeshTexture as x}from"../../../../../views/3d/glTF/internal/resourceUtils.js";import{DataType as b}from"../../../../../views/webgl/enums.js";const T=()=>t.getLogger("esri.geometry.support.meshUtils.exporters.gltf.gltf");class _{constructor(e,t){this.options=t,this._materialMap=new Array,this._imageMap=new Map,this._textureMap=new Map,this.gltf={asset:{version:"2.0",copyright:e.copyright,generator:e.generator},extras:{output:t.output,binChunkBuffer:null,promises:[]}},this._addScenes(e)}_addScenes(e){this.gltf.scene=e.defaultScene;const t=this.gltf.extras,s=2===t.output.buffer||2===t.output.image;s&&(t.binChunkBuffer=new m(this.gltf)),e.forEachScene(e=>{this._addScene(e)}),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode(e=>{t.nodes||(t.nodes=[]),t.nodes.push(...this._addNodes(e))}),this.gltf.scenes.push(t)}_addNodes(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;n(s,l)||(t.translation=c(s));const r=e.rotation;i(r,a)||(t.rotation=o(r));const h=e.scale;n(h,u)||(t.scale=c(h));const f=this.gltf.nodes.length;if(this.gltf.nodes.push(t),e.mesh&&e.mesh.vertexAttributes.position){const s=this._createMeshes(e.mesh),r=[f];if(1===s.length)this._addMesh(t,s[0]);else for(const e of s){const t={};this._addMesh(t,e),r.push(this.gltf.nodes.length),this.gltf.nodes.push(t)}return r}return e.forEachNode(e=>{t.children||(t.children=[]),t.children.push(...this._addNodes(e))}),[f]}_addMesh(e,t){this.gltf.meshes??=[];const s=this.gltf.meshes.length;this.gltf.meshes.push(t),e.mesh=s}_createMeshes(e){const t=this.gltf.extras,s=2===t.output.buffer;let r;r=s?t.binChunkBuffer:new m(this.gltf);const i=this.options.origin,o=e.vertexSpace.clone();o.origin=[i.x,i.y,i.z??0];const a=f({vertexAttributes:e.vertexAttributes,vertexSpace:e.vertexSpace,transform:this.options?.ignoreLocalTransform?null:e.transform,spatialReference:e.spatialReference},o,{targetUnit:this.options.unitConversionDisabled?void 0:"meters"});if(!a)return[];p(e,a),M(a);const{position:n,normal:l,tangent:c}=a,{uv:u,color:h}=e.vertexAttributes,d=r.addBufferView(b.FLOAT,"VEC3",34962);let g,x,T,_;l&&(g=r.addBufferView(b.FLOAT,"VEC3",34962)),u&&(x=r.addBufferView(b.FLOAT,"VEC2",34962)),c&&(T=r.addBufferView(b.FLOAT,"VEC4",34962)),h&&(_=r.addBufferView(b.FLOAT,"VEC4",34962)),d.startAccessor("POSITION"),g&&g.startAccessor("NORMAL"),x&&x.startAccessor("TEXCOORD_0"),T&&T.startAccessor("TANGENT"),_&&_.startAccessor("COLOR_0");const A=a.position.length/3;for(let f=0;f<A;++f)d.push(n[3*f]),d.push(n[3*f+1]),d.push(n[3*f+2]),g&&null!=l&&(g.push(l[3*f]),g.push(l[3*f+1]),g.push(l[3*f+2])),x&&null!=u&&(x.push(u[2*f]),x.push(u[2*f+1])),T&&null!=c&&(T.push(c[4*f]),T.push(c[4*f+1]),T.push(c[4*f+2]),T.push(c[4*f+3])),_&&null!=h&&(_.push(w(h[4*f]/255)),_.push(w(h[4*f+1]/255)),_.push(w(h[4*f+2]/255)),_.push(h[4*f+3]/255));const v=d.endAccessor(),O=this._addAccessor(d.index,v);let R,S,N,C,I;if(g){const e=g.endAccessor();R=this._addAccessor(g.index,e)}if(x){const e=x.endAccessor();S=this._addAccessor(x.index,e)}if(T){const e=T.endAccessor();N=this._addAccessor(T.index,e)}if(_){const e=_.endAccessor();C=this._addAccessor(_.index,e)}const y=[];return e.components&&e.components.length>0&&e.components[0].faces?(I=r.addBufferView(b.UNSIGNED_INT,"SCALAR",34963),this._addMeshVertexIndexed(I,e.components,y,O,R,S,N,C)):this._addMeshVertexNonIndexed(e.components,y,O,R,S,N,C),d.finalize(),g?.finalize(),x?.finalize(),T?.finalize(),I?.finalize(),_?.finalize(),s||r.finalize(),y}_addMaterial(e){if(null==e)return;const t=this._materialMap.indexOf(e);if(-1!==t)return t;this.gltf.materials||(this.gltf.materials=[]);const s={};switch(e.alphaMode){case"mask":s.alphaMode="MASK";break;case"auto":case"blend":s.alphaMode="BLEND"}s.alphaCutoff=e.alphaCutoff,e.doubleSided&&(s.doubleSided=e.doubleSided),s.pbrMetallicRoughness={};const r=e=>{const t=e.toRgba();return t[0]=w(t[0]/255),t[1]=w(t[1]/255),t[2]=w(t[2]/255),t};if(null!=e.color&&(s.pbrMetallicRoughness.baseColorFactor=r(e.color)),null!=e.colorTexture&&(s.pbrMetallicRoughness.baseColorTexture=this._createTextureInfo(e.colorTexture,e.colorTextureTransform)),null!=e.normalTexture&&(s.normalTexture=this._createTextureInfo(e.normalTexture,e.normalTextureTransform)),e instanceof h){if(null!=e.emissiveTexture&&(s.emissiveTexture=this._createTextureInfo(e.emissiveTexture,e.emissiveTextureTransform)),null!=e.emissiveColor){const t=r(e.emissiveColor);s.emissiveFactor=[t[0],t[1],t[2]]}null!=e.emissiveStrength&&(s.extensions??={},s.extensions.KHR_materials_emissive_strength={emissiveStrength:e.emissiveStrength}),null!=e.occlusionTexture&&(s.occlusionTexture=this._createTextureInfo(e.occlusionTexture,e.occlusionTextureTransform)),null!=e.metallicRoughnessTexture&&(s.pbrMetallicRoughness.metallicRoughnessTexture=this._createTextureInfo(e.metallicRoughnessTexture,e.metallicRoughnessTextureTransform)),s.pbrMetallicRoughness.metallicFactor=e.metallic,s.pbrMetallicRoughness.roughnessFactor=e.roughness}else s.pbrMetallicRoughness.metallicFactor=1,s.pbrMetallicRoughness.roughnessFactor=1,T().warnOnce("Meshes exported to GLTF without MeshMaterialMetallicRoughness material will appear different when imported back.");const i=this.gltf.materials.length;return this.gltf.materials.push(s),this._materialMap.push(e),i}_createTextureInfo(e,t){const s={index:this._addTexture(e)};return t?(s.extensions||(s.extensions={}),s.extensions.KHR_texture_transform={scale:t.scale,offset:t.offset,rotation:r(t.rotation)},s):s}_addTexture(e){const t=this.gltf.textures??[];return this.gltf.textures=t,s(this._textureMap,e,()=>{const s={sampler:this._addSampler(e),source:this._addImage(e)},r=t.length;return t.push(s),r})}_addImage(e){const t=this._imageMap.get(e);if(null!=t)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const t=e.data;s.extras=t;for(let e=0;e<this.gltf.images.length;++e)if(t===this.gltf.images[e].extras)return e;const r=this.gltf.extras;switch(r.output.image){case 2:{const e=r.binChunkBuffer.addBufferView(b.UNSIGNED_BYTE,"SCALAR");if(x(t))null!=t.data&&e.writeOutToBuffer(t.data.buffer,0);else{const i=d(t,this.options.signal).then(({data:e,type:t})=>(s.mimeType=t,e));r.promises.push(e.writeAsync(i).then(()=>e.finalize()))}s.bufferView=e.index;break}case 1:if(x(t)){T().warnOnce("Image export for basis compressed textures not available.");break}s.uri=g(t);break;default:if(x(t)){T().warnOnce("Image export for basis compressed textures not available.");break}r.promises.push(d(t,this.options.signal).then(({data:e,type:t})=>{s.uri=e,s.mimeType=t}))}}const r=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,r),r}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=10497,s=10497;if("string"==typeof e.wrap)switch(e.wrap){case"clamp":t=33071,s=33071;break;case"mirror":t=33648,s=33648}else{switch(e.wrap.vertical){case"clamp":s=33071;break;case"mirror":s=33648}switch(e.wrap.horizontal){case"clamp":t=33071;break;case"mirror":t=33648}}const r={wrapS:t,wrapT:s};for(let o=0;o<this.gltf.samplers.length;++o)if(JSON.stringify(r)===JSON.stringify(this.gltf.samplers[o]))return o;const i=this.gltf.samplers.length;return this.gltf.samplers.push(r),i}_addAccessor(e,t){this.gltf.accessors||(this.gltf.accessors=[]);const s={bufferView:e,byteOffset:t.byteOffset,componentType:t.componentType,count:t.count,type:t.type,min:t.min,max:t.max,name:t.name};t.normalized&&(s.normalized=!0);const r=this.gltf.accessors.length;return this.gltf.accessors.push(s),r}_addMeshVertexIndexed(e,t,s,r,i,o,a,n){const l=new Map;for(const c of t){if(e.startAccessor("INDICES"),c.faces)for(let s=0;s<c.faces.length;++s)e.push(c.faces[s]);const t=e.endAccessor(),u={attributes:{POSITION:r},indices:this._addAccessor(e.index,t),material:this._addMaterial(c.material)};i&&"flat"!==c.shading&&(u.attributes.NORMAL=i),o&&(u.attributes.TEXCOORD_0=o),a&&"flat"!==c.shading&&(u.attributes.TANGENT=a),n&&(u.attributes.COLOR_0=n);const h=l.get(c.name);if(h)h.primitives.push(u);else{const e={name:c.name,primitives:[u]};l.set(c.name,e),s.push(e)}}}_addMeshVertexNonIndexed(e,t,s,r,i,o,a){const n={primitives:[]};t.push(n);const l={attributes:{POSITION:s}};r&&(l.attributes.NORMAL=r),i&&(l.attributes.TEXCOORD_0=i),o&&(l.attributes.TANGENT=o),a&&(l.attributes.COLOR_0=a),e&&(l.material=this._addMaterial(e[0].material)),n.primitives.push(l)}}function M({position:e,normal:t,tangent:s}){A(e,3),A(t,3),A(s,4)}function A(e,t){if(null!=e)for(let s=1,r=2;s<e.length;s+=t,r+=t){const t=e[s],i=e[r];e[s]=i,e[r]=-t}}function w(t){return t**e}export{_ as GLTF};
2
+ import{colorGamma as e}from"../../../../../colorUtils.js";import t from"../../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{deg2rad as r}from"../../../../../core/mathUtils.js";import{exactEquals as i}from"../../../../../core/libs/gl-matrix-2/math/quat.js";import{clone as o,IDENTITY as a}from"../../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{exactEquals as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as l,clone as c,ONES as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../../MeshMaterialMetallicRoughness.js";import{convertVertexSpace as f}from"../../vertexSpaceConversion.js";import{Buffer as m}from"./buffer.js";import{smoothNormals as p}from"./geometry.js";import{imageToArrayBuffer as d,imageToDataURI as g}from"./imageutils.js";import{isEncodedMeshTexture as x}from"../../../../../views/3d/glTF/internal/resourceUtils.js";import{DataType as b}from"../../../../../views/webgl/enums.js";const T=()=>t.getLogger("esri.geometry.support.meshUtils.exporters.gltf.gltf");class _{constructor(e,t){this.options=t,this._materialMap=new Array,this._imageMap=new Map,this._textureMap=new Map,this.gltf={asset:{version:"2.0",copyright:e.copyright,generator:e.generator},extras:{output:t.output,binChunkBuffer:null,promises:[]}},this._addScenes(e)}_addScenes(e){this.gltf.scene=e.defaultScene;const t=this.gltf.extras,s=2===t.output.buffer||2===t.output.image;s&&(t.binChunkBuffer=new m(this.gltf)),e.forEachScene(e=>{this._addScene(e)}),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode(e=>{t.nodes||(t.nodes=[]),t.nodes.push(...this._addNodes(e))}),this.gltf.scenes.push(t)}_addNodes(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;n(s,l)||(t.translation=c(s));const r=e.rotation;i(r,a)||(t.rotation=o(r));const h=e.scale;n(h,u)||(t.scale=c(h));const f=this.gltf.nodes.length;if(this.gltf.nodes.push(t),e.mesh&&e.mesh.vertexAttributes.position){const s=this._createMeshes(e.mesh),r=[f];if(1===s.length)this._addMesh(t,s[0]);else for(const e of s){const t={};this._addMesh(t,e),r.push(this.gltf.nodes.length),this.gltf.nodes.push(t)}return r}return e.forEachNode(e=>{t.children||(t.children=[]),t.children.push(...this._addNodes(e))}),[f]}_addMesh(e,t){this.gltf.meshes??=[];const s=this.gltf.meshes.length;this.gltf.meshes.push(t),e.mesh=s}_createMeshes(e){const t=this.gltf.extras,s=2===t.output.buffer;let r;r=s?t.binChunkBuffer:new m(this.gltf);const i=this.options.origin,o=e.vertexSpace.clone();o.origin=[i.x,i.y,i.z??0];const a=f({vertexAttributes:e.vertexAttributes,vertexSpace:e.vertexSpace,transform:this.options?.ignoreLocalTransform?null:e.transform,spatialReference:e.spatialReference},o,{targetUnit:this.options.unitConversionDisabled?void 0:"meters"});if(!a)return[];p(e,a),M(a);const{position:n,normal:l,tangent:c}=a,{uv:u,color:h}=e.vertexAttributes,d=r.addBufferView(b.FLOAT,"VEC3",34962);let g,x,T,_;l&&(g=r.addBufferView(b.FLOAT,"VEC3",34962)),u&&(x=r.addBufferView(b.FLOAT,"VEC2",34962)),c&&(T=r.addBufferView(b.FLOAT,"VEC4",34962)),h&&(_=r.addBufferView(b.FLOAT,"VEC4",34962)),d.startAccessor("POSITION"),g&&g.startAccessor("NORMAL"),x&&x.startAccessor("TEXCOORD_0"),T&&T.startAccessor("TANGENT"),_&&_.startAccessor("COLOR_0");const A=a.position.length/3;for(let f=0;f<A;++f)d.push(n[3*f]),d.push(n[3*f+1]),d.push(n[3*f+2]),g&&null!=l&&(g.push(l[3*f]),g.push(l[3*f+1]),g.push(l[3*f+2])),x&&null!=u&&(x.push(u[2*f]),x.push(u[2*f+1])),T&&null!=c&&(T.push(c[4*f]),T.push(c[4*f+1]),T.push(c[4*f+2]),T.push(c[4*f+3])),_&&null!=h&&(_.push(w(h[4*f]/255)),_.push(w(h[4*f+1]/255)),_.push(w(h[4*f+2]/255)),_.push(h[4*f+3]/255));const v=d.endAccessor(),O=this._addAccessor(d.index,v);let R,S,N,C,I;if(g){const e=g.endAccessor();R=this._addAccessor(g.index,e)}if(x){const e=x.endAccessor();S=this._addAccessor(x.index,e)}if(T){const e=T.endAccessor();N=this._addAccessor(T.index,e)}if(_){const e=_.endAccessor();C=this._addAccessor(_.index,e)}const y=[];return e.components&&e.components.length>0&&e.components[0].faces?(I=r.addBufferView(b.UNSIGNED_INT,"SCALAR",34963),this._addMeshVertexIndexed(I,e.components,y,O,R,S,N,C)):this._addMeshVertexNonIndexed(e.components,y,O,R,S,N,C),d.finalize(),g?.finalize(),x?.finalize(),T?.finalize(),I?.finalize(),_?.finalize(),s||r.finalize(),y}_addMaterial(e){if(null==e)return;const t=this._materialMap.indexOf(e);if(-1!==t)return t;this.gltf.materials||(this.gltf.materials=[]);const s={};switch(e.alphaMode){case"mask":s.alphaMode="MASK";break;case"auto":case"blend":s.alphaMode="BLEND"}s.alphaCutoff=e.alphaCutoff,e.doubleSided&&(s.doubleSided=e.doubleSided),s.pbrMetallicRoughness={};const r=e=>{const t=e.toRgba();return t[0]=w(t[0]/255),t[1]=w(t[1]/255),t[2]=w(t[2]/255),t};if(null!=e.color&&(s.pbrMetallicRoughness.baseColorFactor=r(e.color)),null!=e.colorTexture&&(s.pbrMetallicRoughness.baseColorTexture=this._createTextureInfo(e.colorTexture,e.colorTextureTransform)),null!=e.normalTexture&&(s.normalTexture=this._createTextureInfo(e.normalTexture,e.normalTextureTransform)),e instanceof h){if(null!=e.emissiveTexture&&(s.emissiveTexture=this._createTextureInfo(e.emissiveTexture,e.emissiveTextureTransform)),e.unlit&&(s.extensions??={},s.extensions.KHR_materials_unlit={}),null!=e.emissiveColor){const t=r(e.emissiveColor);s.emissiveFactor=[t[0],t[1],t[2]]}null!=e.emissiveStrength&&(s.extensions??={},s.extensions.KHR_materials_emissive_strength={emissiveStrength:e.emissiveStrength}),null!=e.occlusionTexture&&(s.occlusionTexture=this._createTextureInfo(e.occlusionTexture,e.occlusionTextureTransform)),null!=e.metallicRoughnessTexture&&(s.pbrMetallicRoughness.metallicRoughnessTexture=this._createTextureInfo(e.metallicRoughnessTexture,e.metallicRoughnessTextureTransform)),s.pbrMetallicRoughness.metallicFactor=e.metallic,s.pbrMetallicRoughness.roughnessFactor=e.roughness}else s.pbrMetallicRoughness.metallicFactor=1,s.pbrMetallicRoughness.roughnessFactor=1,T().warnOnce("Meshes exported to GLTF without MeshMaterialMetallicRoughness material will appear different when imported back.");const i=this.gltf.materials.length;return this.gltf.materials.push(s),this._materialMap.push(e),i}_createTextureInfo(e,t){const s={index:this._addTexture(e)};return t?(s.extensions||(s.extensions={}),s.extensions.KHR_texture_transform={scale:t.scale,offset:t.offset,rotation:r(t.rotation)},s):s}_addTexture(e){const t=this.gltf.textures??[];return this.gltf.textures=t,s(this._textureMap,e,()=>{const s={sampler:this._addSampler(e),source:this._addImage(e)},r=t.length;return t.push(s),r})}_addImage(e){const t=this._imageMap.get(e);if(null!=t)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const t=e.data;s.extras=t;for(let e=0;e<this.gltf.images.length;++e)if(t===this.gltf.images[e].extras)return e;const r=this.gltf.extras;switch(r.output.image){case 2:{const e=r.binChunkBuffer.addBufferView(b.UNSIGNED_BYTE,"SCALAR");if(x(t))null!=t.data&&e.writeOutToBuffer(t.data.buffer,0);else{const i=d(t,this.options.signal).then(({data:e,type:t})=>(s.mimeType=t,e));r.promises.push(e.writeAsync(i).then(()=>e.finalize()))}s.bufferView=e.index;break}case 1:if(x(t)){T().warnOnce("Image export for basis compressed textures not available.");break}s.uri=g(t);break;default:if(x(t)){T().warnOnce("Image export for basis compressed textures not available.");break}r.promises.push(d(t,this.options.signal).then(({data:e,type:t})=>{s.uri=e,s.mimeType=t}))}}const r=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,r),r}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=10497,s=10497;if("string"==typeof e.wrap)switch(e.wrap){case"clamp":t=33071,s=33071;break;case"mirror":t=33648,s=33648}else{switch(e.wrap.vertical){case"clamp":s=33071;break;case"mirror":s=33648}switch(e.wrap.horizontal){case"clamp":t=33071;break;case"mirror":t=33648}}const r={wrapS:t,wrapT:s};for(let o=0;o<this.gltf.samplers.length;++o)if(JSON.stringify(r)===JSON.stringify(this.gltf.samplers[o]))return o;const i=this.gltf.samplers.length;return this.gltf.samplers.push(r),i}_addAccessor(e,t){this.gltf.accessors||(this.gltf.accessors=[]);const s={bufferView:e,byteOffset:t.byteOffset,componentType:t.componentType,count:t.count,type:t.type,min:t.min,max:t.max,name:t.name};t.normalized&&(s.normalized=!0);const r=this.gltf.accessors.length;return this.gltf.accessors.push(s),r}_addMeshVertexIndexed(e,t,s,r,i,o,a,n){const l=new Map;for(const c of t){if(e.startAccessor("INDICES"),c.faces)for(let s=0;s<c.faces.length;++s)e.push(c.faces[s]);const t=e.endAccessor(),u={attributes:{POSITION:r},indices:this._addAccessor(e.index,t),material:this._addMaterial(c.material)};i&&"flat"!==c.shading&&(u.attributes.NORMAL=i),o&&(u.attributes.TEXCOORD_0=o),a&&"flat"!==c.shading&&(u.attributes.TANGENT=a),n&&(u.attributes.COLOR_0=n);const h=l.get(c.name);if(h)h.primitives.push(u);else{const e={name:c.name,primitives:[u]};l.set(c.name,e),s.push(e)}}}_addMeshVertexNonIndexed(e,t,s,r,i,o,a){const n={primitives:[]};t.push(n);const l={attributes:{POSITION:s}};r&&(l.attributes.NORMAL=r),i&&(l.attributes.TEXCOORD_0=i),o&&(l.attributes.TANGENT=o),a&&(l.attributes.COLOR_0=a),e&&(l.material=this._addMaterial(e[0].material)),n.primitives.push(l)}}function M({position:e,normal:t,tangent:s}){A(e,3),A(t,3),A(s,4)}function A(e,t){if(null!=e)for(let s=1,r=2;s<e.length;s+=t,r+=t){const t=e[s],i=e[r];e[s]=i,e[r]=-t}}function w(t){return t**e}export{_ as GLTF};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../Color.js";import{colorGamma as t}from"../../../colorUtils.js";import r from"../../../core/Error.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{rad2deg as n,hasScaling as s}from"../../../core/mathUtils.js";import{normalFromMat4 as i,fromMat4 as a}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromValues as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import u from"../MeshComponent.js";import m from"../MeshMaterialMetallicRoughness.js";import p from"../MeshTexture.js";import d from"../MeshTextureTransform.js";import x from"../MeshVertexAttributes.js";import{selectVertexSpace as g}from"../meshVertexSpaceUtils.js";import{BufferViewVec4f as h,BufferViewVec4u8 as T,BufferViewVec4u16 as v,BufferViewVec3u8 as w,BufferViewVec3f as j,BufferViewVec3u16 as b,BufferViewVec2f as y,BufferViewVec3f64 as C}from"../buffer/BufferView.js";import{c as M,d as R,e as S,l as B}from"../../../chunks/vec3.js";import{a as F,n as $,l as A}from"../../../chunks/vec4.js";import{createBuffer as U}from"../buffer/utils.js";import{convertVertexSpace as k}from"./vertexSpaceConversion.js";import{DefaultLoadingContext as V}from"../../../views/3d/glTF/DefaultLoadingContext.js";import{loadGLTF as E}from"../../../views/3d/glTF/loader.js";import{convertPrimitiveToTriangles as D}from"../../../views/3d/glTF/internal/indexUtils.js";import{isEncodedMeshTexture as I}from"../../../views/3d/glTF/internal/resourceUtils.js";import{f as L}from"../../../chunks/vec32.js";import{f as z}from"../../../chunks/vec42.js";import{n as K,f as N}from"../../../chunks/vec2.js";async function O(e,t,o){const n=new V(o?.resolveFile),s=await E(n,t,o),i=s.model,a=i.lods.shift(),l=new Map,c=new Map;i.textures.forEach((e,t)=>l.set(t,P(e))),i.materials.forEach((e,t)=>c.set(t,Q(e,l)));const f=H(a);for(const r of f.parts)J(f,r,c);const{position:u,normal:m,tangent:p,color:d,texCoord0:h}=f.vertexAttributes,T=g(e,o),v=e.spatialReference.isGeographic?g(e):T,w=k({vertexAttributes:{position:u.typedBuffer,normal:m?.typedBuffer,tangent:p?.typedBuffer},vertexSpace:v,spatialReference:e.spatialReference},T,{allowBufferReuse:!0,sourceUnit:o?.unitConversionDisabled?void 0:"meters"});if(!w)throw new r("load-gltf-mesh:vertex-space-projection",`Failed to load mesh from glTF because we could not convert the vertex space from ${v.type} to ${T.type}`);return{mesh:{transform:null,vertexSpace:T,components:f.components,spatialReference:e.spatialReference,vertexAttributes:new x({...w,color:d?.typedBuffer,uv:h?.typedBuffer})},meta:s.meta}}function q(e,t){if(null==e)return"-";const r=e.typedBuffer;return`${o(t,r.buffer,()=>t.size)}/${r.byteOffset}/${r.byteLength}`}function G(e){return null!=e?e.toString():"-"}function H(e){let t=0;const has={color:!1,tangent:!1,normal:!1,texCoord0:!1},r=new Map,n=new Map,s=[];for(const i of e.parts){const{position:e,normal:a,color:l,tangent:c,texCoord0:f}=i.attributes,u=`\n ${q(e,r)}/\n ${q(a,r)}/\n ${q(l,r)}/\n ${q(c,r)}/\n ${q(f,r)}/\n ${G(i.transform)}\n `;let m=!1;const p=o(n,u,()=>(m=!0,{start:t,length:e.count}));m&&(t+=e.count),a&&(has.normal=!0),l&&(has.color=!0),c&&(has.tangent=!0),f&&(has.texCoord0=!0),s.push({gltf:i,writeVertices:m,region:p})}return{vertexAttributes:{position:U(C,t),normal:has.normal?U(j,t):null,tangent:has.tangent?U(h,t):null,color:has.color?U(T,t):null,texCoord0:has.texCoord0?U(y,t):null},parts:s,components:[]}}function P(e){return new p({data:(I(e.data),e.data),wrap:Y(e.parameters.wrap)})}function Q(t,r){const o=new e(ee(t.color,t.opacity)),s=t.emissiveFactor?new e(te(t.emissiveFactor)):null,i=e=>e?new d({scale:e.scale?[e.scale[0],e.scale[1]]:[1,1],rotation:n(e.rotation??0),offset:e.offset?[e.offset[0],e.offset[1]]:[0,0]}):null;return new m({color:o,colorTexture:r.get(t.colorTexture),normalTexture:r.get(t.normalTexture),emissiveColor:s,emissiveStrength:t.emissiveStrengthKHR,emissiveTexture:r.get(t.emissiveTexture),occlusionTexture:r.get(t.occlusionTexture),alphaMode:X(t.alphaMode),alphaCutoff:t.alphaCutoff,doubleSided:t.doubleSided,metallic:t.metallicFactor,roughness:t.roughnessFactor,metallicRoughnessTexture:r.get(t.metallicRoughnessTexture),colorTextureTransform:i(t.colorTextureTransform),normalTextureTransform:i(t.normalTextureTransform),occlusionTextureTransform:i(t.occlusionTextureTransform),emissiveTextureTransform:i(t.emissiveTextureTransform),metallicRoughnessTextureTransform:i(t.metallicRoughnessTextureTransform)})}function J(e,t,r){t.writeVertices&&W(e,t);const{indices:o,attributes:n,primitiveType:s,material:i}=t.gltf;let a=D(o||n.position.count,s);const l=t.region.start;if(l){const e=new Uint32Array(a);for(let t=0;t<a.length;t++)e[t]+=l;a=e}e.components.push(new u({name:t.gltf.name,faces:a,material:r.get(i),shading:n.normal?"source":"flat",trustSourceNormals:!0}))}function W(e,t){const{position:r,normal:o,tangent:n,color:c,texCoord0:f}=e.vertexAttributes,u=t.region.start,{attributes:m,transform:p}=t.gltf,d=m.position.count;if(M(r.slice(u,d),m.position,p),null!=m.normal&&null!=o){const e=i(l(),p),t=o.slice(u,d);R(t,m.normal,e),s(e)&&S(t,t)}else null!=o&&L(o,0,0,1,{dstIndex:u,count:d});if(null!=m.tangent&&null!=n){const e=a(l(),p),t=n.slice(u,d);F(t,m.tangent,e),s(e)&&$(t,t)}else null!=n&&z(n,0,0,1,1,{dstIndex:u,count:d});if(null!=m.texCoord0&&null!=f?K(f.slice(u,d),m.texCoord0):null!=f&&N(f,0,0,{dstIndex:u,count:d}),null!=m.color&&null!=c){const e=m.color,t=c.slice(u,d);if(4===e.elementCount)e instanceof h?A(t,e,1,255):(e instanceof T||e instanceof v)&&A(t,e,1/255,255);else{z(t,255,255,255,255);const r=w.fromTypedArray(t.typedBuffer,t.typedBufferStride);e instanceof j?B(r,e,1,255):(e instanceof w||e instanceof b)&&B(r,e,1/255,255)}}else null!=c&&z(c.slice(u,d),255,255,255,255)}function X(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend"}}function Y(e){return{horizontal:Z(e.s),vertical:Z(e.t)}}function Z(e){switch(e){case 33071:return"clamp";case 33648:return"mirror";case 10497:return"repeat"}}function _(e){return e**(1/t)*255}function ee(e,t){return f(_(e[0]),_(e[1]),_(e[2]),t)}function te(e){return c(_(e[0]),_(e[1]),_(e[2]))}export{O as loadGLTFMesh};
2
+ import e from"../../../Color.js";import{colorGamma as t}from"../../../colorUtils.js";import r from"../../../core/Error.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{rad2deg as n,hasScaling as s}from"../../../core/mathUtils.js";import{normalFromMat4 as i,fromMat4 as a}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromValues as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import f from"../MeshComponent.js";import m from"../MeshMaterialMetallicRoughness.js";import p from"../MeshTexture.js";import d from"../MeshTextureTransform.js";import x from"../MeshVertexAttributes.js";import{selectVertexSpace as g}from"../meshVertexSpaceUtils.js";import{BufferViewVec4f as h,BufferViewVec4u8 as T,BufferViewVec4u16 as v,BufferViewVec3u8 as w,BufferViewVec3f as j,BufferViewVec3u16 as b,BufferViewVec2f as y,BufferViewVec3f64 as C}from"../buffer/BufferView.js";import{c as M,d as R,e as S,l as B}from"../../../chunks/vec3.js";import{a as F,n as $,l as A}from"../../../chunks/vec4.js";import{createBuffer as U}from"../buffer/utils.js";import{convertVertexSpace as k}from"./vertexSpaceConversion.js";import{DefaultLoadingContext as V}from"../../../views/3d/glTF/DefaultLoadingContext.js";import{loadGLTF as E}from"../../../views/3d/glTF/loader.js";import{convertPrimitiveToTriangles as D}from"../../../views/3d/glTF/internal/indexUtils.js";import{isEncodedMeshTexture as I}from"../../../views/3d/glTF/internal/resourceUtils.js";import{f as L}from"../../../chunks/vec32.js";import{f as z}from"../../../chunks/vec42.js";import{n as K,f as N}from"../../../chunks/vec2.js";async function O(e,t,o){const n=new V(o?.resolveFile),s=await E(n,t,o),i=s.model,a=i.lods.shift(),l=new Map,c=new Map;i.textures.forEach((e,t)=>l.set(t,P(e))),i.materials.forEach((e,t)=>c.set(t,Q(e,l)));const u=H(a);for(const r of u.parts)J(u,r,c);const{position:f,normal:m,tangent:p,color:d,texCoord0:h}=u.vertexAttributes,T=g(e,o),v=e.spatialReference.isGeographic?g(e):T,w=k({vertexAttributes:{position:f.typedBuffer,normal:m?.typedBuffer,tangent:p?.typedBuffer},vertexSpace:v,spatialReference:e.spatialReference},T,{allowBufferReuse:!0,sourceUnit:o?.unitConversionDisabled?void 0:"meters"});if(!w)throw new r("load-gltf-mesh:vertex-space-projection",`Failed to load mesh from glTF because we could not convert the vertex space from ${v.type} to ${T.type}`);return{mesh:{transform:null,vertexSpace:T,components:u.components,spatialReference:e.spatialReference,vertexAttributes:new x({...w,color:d?.typedBuffer,uv:h?.typedBuffer})},meta:s.meta}}function q(e,t){if(null==e)return"-";const r=e.typedBuffer;return`${o(t,r.buffer,()=>t.size)}/${r.byteOffset}/${r.byteLength}`}function G(e){return null!=e?e.toString():"-"}function H(e){let t=0;const has={color:!1,tangent:!1,normal:!1,texCoord0:!1},r=new Map,n=new Map,s=[];for(const i of e.parts){const{position:e,normal:a,color:l,tangent:c,texCoord0:u}=i.attributes,f=`\n ${q(e,r)}/\n ${q(a,r)}/\n ${q(l,r)}/\n ${q(c,r)}/\n ${q(u,r)}/\n ${G(i.transform)}\n `;let m=!1;const p=o(n,f,()=>(m=!0,{start:t,length:e.count}));m&&(t+=e.count),a&&(has.normal=!0),l&&(has.color=!0),c&&(has.tangent=!0),u&&(has.texCoord0=!0),s.push({gltf:i,writeVertices:m,region:p})}return{vertexAttributes:{position:U(C,t),normal:has.normal?U(j,t):null,tangent:has.tangent?U(h,t):null,color:has.color?U(T,t):null,texCoord0:has.texCoord0?U(y,t):null},parts:s,components:[]}}function P(e){return new p({data:(I(e.data),e.data),wrap:Y(e.parameters.wrap)})}function Q(t,r){const o=new e(ee(t.color,t.opacity)),s=t.emissiveFactor?new e(te(t.emissiveFactor)):null,i=e=>e?new d({scale:e.scale?[e.scale[0],e.scale[1]]:[1,1],rotation:n(e.rotation??0),offset:e.offset?[e.offset[0],e.offset[1]]:[0,0]}):null;return new m({color:o,colorTexture:r.get(t.colorTexture),normalTexture:r.get(t.normalTexture),emissiveColor:s,emissiveStrength:t.emissiveStrengthKHR,emissiveTexture:r.get(t.emissiveTexture),occlusionTexture:r.get(t.occlusionTexture),alphaMode:X(t.alphaMode),alphaCutoff:t.alphaCutoff,doubleSided:t.doubleSided,metallic:t.metallicFactor,roughness:t.roughnessFactor,metallicRoughnessTexture:r.get(t.metallicRoughnessTexture),colorTextureTransform:i(t.colorTextureTransform),normalTextureTransform:i(t.normalTextureTransform),occlusionTextureTransform:i(t.occlusionTextureTransform),emissiveTextureTransform:i(t.emissiveTextureTransform),metallicRoughnessTextureTransform:i(t.metallicRoughnessTextureTransform),unlit:t.unlit})}function J(e,t,r){t.writeVertices&&W(e,t);const{indices:o,attributes:n,primitiveType:s,material:i}=t.gltf;let a=D(o||n.position.count,s);const l=t.region.start;if(l){const e=new Uint32Array(a);for(let t=0;t<a.length;t++)e[t]+=l;a=e}e.components.push(new f({name:t.gltf.name,faces:a,material:r.get(i),shading:n.normal?"source":"flat",trustSourceNormals:!0}))}function W(e,t){const{position:r,normal:o,tangent:n,color:c,texCoord0:u}=e.vertexAttributes,f=t.region.start,{attributes:m,transform:p}=t.gltf,d=m.position.count;if(M(r.slice(f,d),m.position,p),null!=m.normal&&null!=o){const e=i(l(),p),t=o.slice(f,d);R(t,m.normal,e),s(e)&&S(t,t)}else null!=o&&L(o,0,0,1,{dstIndex:f,count:d});if(null!=m.tangent&&null!=n){const e=a(l(),p),t=n.slice(f,d);F(t,m.tangent,e),s(e)&&$(t,t)}else null!=n&&z(n,0,0,1,1,{dstIndex:f,count:d});if(null!=m.texCoord0&&null!=u?K(u.slice(f,d),m.texCoord0):null!=u&&N(u,0,0,{dstIndex:f,count:d}),null!=m.color&&null!=c){const e=m.color,t=c.slice(f,d);if(4===e.elementCount)e instanceof h?A(t,e,1,255):(e instanceof T||e instanceof v)&&A(t,e,1/255,255);else{z(t,255,255,255,255);const r=w.fromTypedArray(t.typedBuffer,t.typedBufferStride);e instanceof j?B(r,e,1,255):(e instanceof w||e instanceof b)&&B(r,e,1/255,255)}}else null!=c&&z(c.slice(f,d),255,255,255,255)}function X(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend"}}function Y(e){return{horizontal:Z(e.s),vertical:Z(e.t)}}function Z(e){switch(e){case 33071:return"clamp";case 33648:return"mirror";case 10497:return"repeat"}}function _(e){return e**(1/t)*255}function ee(e,t){return u(_(e[0]),_(e[1]),_(e[2]),t)}function te(e){return c(_(e[0]),_(e[1]),_(e[2]))}export{O as loadGLTFMesh};
@@ -1,5 +1,23 @@
1
1
  /**
2
- * Various utilities and convenience functions for working with [Mesh](https://developers.arcgis.com/javascript/latest/references/core/geometry/Mesh/) objects.
2
+ * Various utilities and convenience functions for working with [Mesh](https://developers.arcgis.com/javascript/latest/references/core/geometry/Mesh/) objects. When using the
3
+ * [createFromGLTF()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#createFromGLTF) method to create a mesh from a GLTF source, the following sections
4
+ * will provide information on the supported features and limitations.
5
+ *
6
+ * <span id="supported-gltf-features"></span>
7
+ * ### Supported GLTF features
8
+ *
9
+ * - Only glTF version 2.0 is supported.
10
+ * - The glTF file must contain a single scene.
11
+ * - The scene can contain an arbitrary number of nodes, meshes and primitives of type `TRIANGLE`, `TRIANGLE_STRIP` or
12
+ * `TRIANGLE_FAN`. `POINTS` and `LINES` are not supported.
13
+ * - Only materials of type Metallic-Roughness are supported.
14
+ * - Animations, skinning and camera definitions are not supported.
15
+ * - The following glTF extensions are supported:
16
+ * - [KHR_texture_transform](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform) for texture space transformation of uv coordinates.
17
+ * - [KHR_texture_basisu](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_basisu) to support textures with KTX V2 images and Basis Universal compression.
18
+ * - [KHR_draco_mesh_compression](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_draco_mesh_compression) for loading Draco-compressed mesh geometry.
19
+ * - [KHR_materials_emissive_strength](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_emissive_strength) to define emissive strength values over 1.
20
+ * - [KHR_materials_unlit](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_unlit) to define unlit materials.
3
21
  *
4
22
  * @since 4.7
5
23
  */
@@ -207,11 +225,11 @@ export function createPlane(location: Point, parameters?: CreatePlaneParameters)
207
225
  export function createFromPolygon(polygon: Polygon, parameters?: CreateFromPolygonParameters): Promise<Mesh>;
208
226
 
209
227
  /**
210
- * Creates a new mesh geometry from a glTF model referenced by the `url` parameter.
228
+ * Creates a new mesh geometry from a glTF model referenced by the `url` parameter. The spatial reference of the
229
+ * resulting mesh is the same as the spatial reference of the `location` parameter.
211
230
  *
212
- * The spatial reference of the resulting mesh is the same as the spatial reference of the `location` parameter. For
213
- * more information on the supported glTF features you can read the
214
- * [Visualizing points with 3D symbols](https://developers.arcgis.com/javascript/latest/visualizing-points-3d/) guide topic. Animations are currently unsupported.
231
+ * See section [Supported GLTF features](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/meshUtils/#supported-gltf-features)
232
+ * for details.
215
233
  *
216
234
  * @param location - The location of the origin of the model. If the location does not
217
235
  * contain a z-value, z is assumed to be `0`.
@@ -221,6 +239,16 @@ export function createFromPolygon(polygon: Polygon, parameters?: CreateFromPolyg
221
239
  * @returns A promise that resolves to a mesh geometry representing the loaded
222
240
  * glTF model.
223
241
  * @since 5.1
242
+ * @example
243
+ * // geographic location where the origin of the model will be placed
244
+ * const location = new Point({ x: 8.540446, y: 47.377887, z: 50 });
245
+ *
246
+ * // Create a mesh and add to view
247
+ * meshUtils.createFromGLTF(location, "../3d-model.gltf")
248
+ * .then(function(geometry) {
249
+ * const graphic = new Graphic({ geometry, ... });
250
+ * view.graphics.add(graphic);
251
+ * });
224
252
  */
225
253
  export function createFromGLTF(location: Point, url: string, parameters?: CreateFromGLTFParameters): Promise<Mesh>;
226
254
 
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../core/mathUtils.js";import{exactEquals as n,subtract as r,normalize as o,dot as c,lerp as e,copy as u,add as i,scale as f,cross as s,set as a,scaleAndAdd as m}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as g,exactEquals as h}from"../../core/libs/gl-matrix-2/math/vec4.js";import{projectPointSignedLength as p}from"./vector.js";import{sv3d as M,sv4d as v}from"./vectorStacks.js";import{tangentFrame as b}from"../../views/3d/support/mathUtils.js";function j(t=ct){return[t[0],t[1],t[2],t[3]]}const x=h,q=g;function y(t=ct[0],n=ct[1],r=ct[2],o=ct[3]){return U(t,n,r,o,v.get())}function d(t,n){return U(n[0],n[1],n[2],n[3],t)}function E(t){return t}function U(t,n,r,o,c=j()){return c[0]=t,c[1]=n,c[2]=r,c[3]=o,c}function k(t,n,r){return u(r,t),r[3]=n,r}function w(t,n,r){const o=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],c=Math.abs(o-1)>1e-5&&o>1e-12?1/Math.sqrt(o):1;return r[0]=n[0]*c,r[1]=n[1]*c,r[2]=n[2]*c,r[3]=-(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]),r}function S(t,n,r,o=j()){const c=r[0]-n[0],e=r[1]-n[1],u=r[2]-n[2],i=t[0]-n[0],f=t[1]-n[1],s=t[2]-n[2],a=e*s-u*f,m=u*i-c*s,l=c*f-e*i,g=a*a+m*m+l*l,h=Math.abs(g-1)>1e-5&&g>1e-12?1/Math.sqrt(g):1;return o[0]=a*h,o[1]=m*h,o[2]=l*h,o[3]=-(o[0]*t[0]+o[1]*t[1]+o[2]*t[2]),o}function z(t,e,u,i=0,f=Math.floor(u*(1/3)),s=Math.floor(u*(2/3))){if(u<3)return!1;e(C,i);let a=f,m=!1;for(;a<u-1&&!m;)e(D,a),a++,m=!n(C,D);if(!m)return!1;for(a=Math.max(a,s),m=!1;a<u&&!m;)e(F,a),a++,r(G,C,D),o(G,G),r(H,D,F),o(H,H),m=!n(C,F)&&!n(D,F)&&Math.abs(c(G,H))<B;return m?(S(C,D,F,t),!0):(0!==i||1!==f||2!==s)&&z(t,e,u,0,1,2)}function A(t,n,r=!0){const o=n.length/3;return z(t,(t,r)=>a(t,n[3*r+0],n[3*r+1],n[3*r+2]),r?o-1:o)}const B=.99619469809,C=l(),D=l(),F=l(),G=l(),H=l();function I(t,n,r){return n!==t&&d(t,n),t[3]=-c(E(t),r),t}function J(t,n){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=-t[3],n}function K(t,n,r,o){return s(F,n,t),w(r,F,o)}function L(t,n,o,c){return rt(ot(t,n,r(M.get(),o,n),et,c))}function N(t,n,r){return null!=n&&rt(ot(t,n.origin,n.direction,ut,r))}function O(t,n,r){return rt(ot(t,n.origin,n.vector,0,r))}function P(t,n,r){return rt(ot(t,n.origin,n.vector,1,r))}function Q(t,n){return nt(t,n)>=0}function R(t,n){return V(t,n.ray.origin,n.ray.direction,n,!1,!1,!0)}function T(t,n){return V(t,n.ray.origin,n.ray.direction,n,!1,!1,!1)}function V(t,n,r,o,e,u,i){const f=c(E(t),r),s=nt(t,n);if(f>-1e-6&&f<1e-6)return W(s,e,u);const a=-s/f,m=W(f,e,!1);return!(i&&!m&&!W(s,e,u))&&(m?a>o.c0&&(o.c0=a):a<o.c1&&(o.c1=a),o.c0<=o.c1)}function W(t,n,r){return r?n?t>=0:t<=0:n?t>0:t<0}function X(t,n,r,o,c=!1){let i=0,f=n[r-1],s=nt(t,f),a=c?s>0:s<=0;for(let m=0;m<r;m++){const r=n[m],l=nt(t,r),g=c?l>0:l<=0;a!==g&&e(o[i++],f,r,s/(s-l)),g&&u(o[i++],r),f=r,s=l,a=g}return i}function Y(t,n,o,c,e,u=!1){return r(it,o,n),ft.c0=0,ft.c1=1,!!V(t,n,it,ft,u,!u,!1)&&(m(c,n,it,ft.c0),m(e,n,it,ft.c1),!0)}function Z(t,n,o){const c=f(M.get(),E(t),-t[3]),e=_(t,r(M.get(),n,c),M.get());return i(o,e,c),o}function $(t,n,o,c){const e=E(t),u=M.get(),i=M.get();b(e,u,i);const f=r(M.get(),o,n),s=p(u,f),m=p(i,f),l=p(e,f);return a(c,s,m,l)}function _(t,n,o){const e=f(M.get(),E(t),c(E(t),n));return r(o,n,e),o}function tt(t,n){return Math.abs(nt(t,n))}function nt(t,n){return c(E(t),n)+t[3]}function rt(t){return 0===t||1===t}function ot(n,r,o,e,u){const s=c(E(n),o),a=nt(n,r);if(0===s)return a>=0?2:3;let m=-a/s;return 1&e&&(m=t(m,0,1)),!(4&e)&&m<0||!(8&e)&&m>1?a>=0?2:3:(i(u,r,f(u,o,m)),a>=0?0:1)}const ct=[0,0,1,0],et=12,ut=8,it=l(),ft={c0:0,c1:1};export{R as clip,T as clipInfinite,Y as clipLineSegment,X as clipPolygon,d as copy,j as create,tt as distance,q as equals,x as exactEquals,A as fromArray,z as fromManyPoints,k as fromNormalAndOffset,S as fromPoints,w as fromPositionAndNormal,U as fromValues,K as fromVectorsAndPoint,E as getNormal,L as intersectLine,ot as intersectLineOrRay,O as intersectLineSegment,P as intersectLineSegmentClamp,N as intersectRay,Q as isPointInside,J as negate,Z as projectPoint,$ as projectPointLocal,_ as projectVector,I as setOffsetFromPoint,nt as signedDistance,ct as up,y as wrap};
2
+ import{clamp as t}from"../../core/mathUtils.js";import{exactEquals as n,subtract as r,normalize as o,dot as c,lerp as e,copy as u,add as i,scale as f,cross as s,set as a,scaleAndAdd as m}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as g,exactEquals as h}from"../../core/libs/gl-matrix-2/math/vec4.js";import{projectPointSignedLength as p}from"./vector.js";import{sv3d as M,sv4d as v}from"./vectorStacks.js";import{tangentFrame as b}from"../../views/3d/support/mathUtils.js";function j(t=ct){return[t[0],t[1],t[2],t[3]]}const x=h,q=g;function y(t=ct[0],n=ct[1],r=ct[2],o=ct[3]){return U(t,n,r,o,v.get())}function d(t,n){return U(n[0],n[1],n[2],n[3],t)}function E(t){return t}function U(t,n,r,o,c=j()){return c[0]=t,c[1]=n,c[2]=r,c[3]=o,c}function k(t,n,r){return u(r,t),r[3]=n,r}function w(t,n,r){const o=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],c=Math.abs(o-1)>1e-5&&o>1e-12?1/Math.sqrt(o):1;return r[0]=n[0]*c,r[1]=n[1]*c,r[2]=n[2]*c,r[3]=-(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]),r}function S(t,n,r,o=j()){const c=r[0]-n[0],e=r[1]-n[1],u=r[2]-n[2],i=t[0]-n[0],f=t[1]-n[1],s=t[2]-n[2],a=e*s-u*f,m=u*i-c*s,l=c*f-e*i,g=a*a+m*m+l*l,h=Math.abs(g-1)>1e-5&&g>1e-12?1/Math.sqrt(g):1;return o[0]=a*h,o[1]=m*h,o[2]=l*h,o[3]=-(o[0]*t[0]+o[1]*t[1]+o[2]*t[2]),o}function z(t,e,u,i=0,f=Math.floor(u*(1/3)),s=Math.floor(u*(2/3))){if(u<3)return!1;e(C,i);let a=f,m=!1;for(;a<u-1&&!m;)e(D,a),a++,m=!n(C,D);if(!m)return!1;for(a=Math.max(a,s),m=!1;a<u&&!m;)e(F,a),a++,r(G,C,D),o(G,G),r(H,D,F),o(H,H),m=!n(C,F)&&!n(D,F)&&Math.abs(c(G,H))<B;return m?(S(C,D,F,t),!0):(0!==i||1!==f||2!==s)&&z(t,e,u,0,1,2)}function A(t,n,r=!0){const o=n.length/3;return z(t,(t,r)=>a(t,n[3*r+0],n[3*r+1],n[3*r+2]),r?o-1:o)}const B=.99619469809,C=l(),D=l(),F=l(),G=l(),H=l();function I(t,n,r){return n!==t&&d(t,n),t[3]=-c(E(t),r),t}function J(t,n){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=-t[3],n}function K(t,n,r,o){return s(F,n,t),w(r,F,o)}function L(t,n,o,c){return rt(ot(t,n,r(M.get(),o,n),et,c))}function N(t,n,r){return null!=n&&rt(ot(t,n.origin,n.direction,ut,r))}function O(t,n,r){return rt(ot(t,n.origin,n.vector,0,r))}function P(t,n,r){return rt(ot(t,n.origin,n.vector,1,r))}function Q(t,n){return nt(t,n)>=0}function R(t,n){return V(t,n.ray.origin,n.ray.direction,n,!1,!1,!0)}function T(t,n){return V(t,n.ray.origin,n.ray.direction,n,!1,!1,!1)}function V(t,n,r,o,e,u,i){const f=c(E(t),r),s=nt(t,n);if(f>-1e-6&&f<1e-6)return W(s,e,u);const a=-s/f,m=W(f,e,!1);return!(i&&!m&&!W(s,e,u))&&(m?a>o.c0&&(o.c0=a):a<o.c1&&(o.c1=a),o.c0<=o.c1)}function W(t,n,r){return r?n?t>=0:t<=0:n?t>0:t<0}function X(t,n,r,o=!1){let c=n.at(-1),i=nt(t,c),f=o?i>0:i<=0;for(let s=0;s<n.length;s++){const a=n.at(s),m=nt(t,a),l=o?m>0:m<=0;f!==l&&e(r(),c,a,i/(i-m)),l&&u(r(),a),c=a,i=m,f=l}}function Y(t,n,o,c,e,u=!1){return r(it,o,n),ft.c0=0,ft.c1=1,!!V(t,n,it,ft,u,!u,!1)&&(m(c,n,it,ft.c0),m(e,n,it,ft.c1),!0)}function Z(t,n,o){const c=f(M.get(),E(t),-t[3]),e=_(t,r(M.get(),n,c),M.get());return i(o,e,c),o}function $(t,n,o,c){const e=E(t),u=M.get(),i=M.get();b(e,u,i);const f=r(M.get(),o,n),s=p(u,f),m=p(i,f),l=p(e,f);return a(c,s,m,l)}function _(t,n,o){const e=f(M.get(),E(t),c(E(t),n));return r(o,n,e),o}function tt(t,n){return Math.abs(nt(t,n))}function nt(t,n){return c(E(t),n)+t[3]}function rt(t){return 0===t||1===t}function ot(n,r,o,e,u){const s=c(E(n),o),a=nt(n,r);if(0===s)return a>=0?2:3;let m=-a/s;return 1&e&&(m=t(m,0,1)),!(4&e)&&m<0||!(8&e)&&m>1?a>=0?2:3:(i(u,r,f(u,o,m)),a>=0?0:1)}const ct=[0,0,1,0],et=12,ut=8,it=l(),ft={c0:0,c1:1};export{R as clip,T as clipInfinite,Y as clipLineSegment,X as clipPolygon,d as copy,j as create,tt as distance,q as equals,x as exactEquals,A as fromArray,z as fromManyPoints,k as fromNormalAndOffset,S as fromPoints,w as fromPositionAndNormal,U as fromValues,K as fromVectorsAndPoint,E as getNormal,L as intersectLine,ot as intersectLineOrRay,O as intersectLineSegment,P as intersectLineSegmentClamp,N as intersectRay,Q as isPointInside,J as negate,Z as projectPoint,$ as projectPointLocal,_ as projectVector,I as setOffsetFromPoint,nt as signedDistance,ct as up,y as wrap};
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.46",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.48",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../core/Error.js";import{throwIfAborted as t,throwIfAbortError as n}from"../../../core/promiseUtils.js";import{F as a}from"../../../chunks/Zlib.js";async function r(a,r,h){if(!a||a.byteLength<10)throw new e("imagecanvasdecoder: decode","required a valid encoded data as input.");const{width:s,height:g,format:w}=r,{applyJpegMask:u}=r;if(u&&(!s||!g))throw new e("imagecanvasdecoder: decode","image width and height are needed to apply jpeg mask directly to canvas");let f=null;"jpg"===w&&u&&s&&g&&(f=d(a,{width:s,height:g}));try{const e=new Blob([new Uint8Array(a)],{type:l(w)}),d=await createImageBitmap(e);t(h);const{useTiledDecoding:s,tileIndex:g,tileSize:u}=r;if(s&&null==g)return o(d,f,u);if(null!=g&&null!=u)return c(d,g,u);try{return i(d,f)}catch(m){if(n(m),d.width>4096||d.height>4096)return o(d,f);throw m}}catch(m){throw n(m),new e("imagecanvasdecoder: decode","cannot load image")}}function i(t,n){const{width:a,height:r}=t,i=new OffscreenCanvas(a,r),o=i.getContext("2d");if(!o)throw new e("imagecanvasdecoder: decode","cannot create canvas context");o.drawImage(t,0,0,a,r);const c=h(o.getImageData(0,0,a,r),a,r,n);return i.width=0,i.height=0,c}function o(t,n,a=[2048,2048]){const[r,i]=a,o=new OffscreenCanvas(r,i),c=o.getContext("2d",{willReadFrequently:!0});if(!c)throw new e("imagecanvasdecoder: decode","cannot create canvas context");const{width:h,height:l}=t,d=h*l,s=new Uint8Array(d),g=new Uint8Array(d),w=new Uint8Array(d),u=null==n;n||(n=new Uint8Array(d));for(let e=0;e<l;e+=i){const a=Math.min(i,l-e);for(let i=0;i<h;i+=r){const o=Math.min(r,h-i);c.clearRect(0,0,o,a),c.drawImage(t,i,e,o,a,0,0,o,a);const{data:l}=c.getImageData(0,0,o,a);for(let t=0;t<a;t++){let a=t*o*4,r=(e+t)*h+i;for(let e=0;e<o;e++,a+=4,r++)s[r]=l[a],g[r]=l[a+1],w[r]=l[a+2],u&&(n[r]=l[a+3])}}}const f={width:h,height:l,pixels:[s,g,w],mask:n,pixelType:"u8"};return o.width=0,o.height=0,console.log(`decodeFullImageTiled: ${h}x${l} using tile ${r}x${i}`,f),f}function c(t,n,a){const[r,i,o]=n,[c,l]=a,d=Math.ceil(t.width/2**r),s=Math.ceil(t.height/2**r),g=Math.ceil(s/l),w=Math.ceil(d/c);if(i>=g||o>=w)return null;const u=new OffscreenCanvas(d,s),f=u.getContext("2d");if(!f)throw new e("imagecanvasdecoder: decode","cannot create canvas context");f.drawImage(t,0,0,d,s);const m=o*c,y=i*l,p=Math.min(c,d-m),v=Math.min(l,s-y),x=h(f.getImageData(m,y,p,v),c,l);return u.width=0,u.height=0,x}function h(e,t,n,a){const r=t*n,i=new Uint8Array(r),o=new Uint8Array(r),c=new Uint8Array(r),h=null==a;a||(a=new Uint8Array(r));const l={width:t,height:n,pixels:[i,o,c],mask:a,pixelType:"u8"},{width:d,height:s,data:g}=e;if(d===t&&s===n){for(let e=0,t=0;e<r;e++,t+=4)i[e]=g[t],o[e]=g[t+1],c[e]=g[t+2],h&&(a[e]=g[t+3]);return l}for(let w=0;w<s;w++){const e=w*d*4;for(let n=0;n<d;n++){const r=w*t+n;i[r]=g[e+4*n],o[r]=g[e+4*n+1],c[r]=g[e+4*n+2],h&&(a[r]=g[e+4*n+3])}}return l}function l(e){return`image/${"jpg"===e?"jpeg":e}`}function d(e,t){try{const n=new Uint8Array(e);let r=Math.ceil(n.length/2);const i=n.length-2;for(;r<i&&(255!==n[r]||217!==n[r+1]);r++);r+=2;let o=null;if(r<n.length-1){const e=new a(n.subarray(r)).getBytes();o=new Uint8Array(t.width*t.height);let i=0;for(let t=0;t<e.length;t++)for(let n=7;n>=0;n--)o[i++]=e[t]>>n&1}return o}catch{return null}}export{r as decode};
2
+ import e from"../../../core/Error.js";import{throwIfAborted as t,throwIfAbortError as n}from"../../../core/promiseUtils.js";import{inflate as a}from"./Zlib.js";async function r(a,r,h){if(!a||a.byteLength<10)throw new e("imagecanvasdecoder: decode","required a valid encoded data as input.");const{width:s,height:g,format:w}=r,{applyJpegMask:u}=r;if(u&&(!s||!g))throw new e("imagecanvasdecoder: decode","image width and height are needed to apply jpeg mask directly to canvas");let f=null;"jpg"===w&&u&&s&&g&&(f=await d(a,{width:s,height:g}));try{const e=new Blob([new Uint8Array(a)],{type:l(w)}),d=await createImageBitmap(e);t(h);const{useTiledDecoding:s,tileIndex:g,tileSize:u}=r;if(s&&null==g)return c(d,f,u);if(null!=g&&null!=u)return o(d,g,u);try{return i(d,f)}catch(m){if(n(m),d.width>4096||d.height>4096)return c(d,f);throw m}}catch(m){throw n(m),new e("imagecanvasdecoder: decode","cannot load image")}}function i(t,n){const{width:a,height:r}=t,i=new OffscreenCanvas(a,r),c=i.getContext("2d");if(!c)throw new e("imagecanvasdecoder: decode","cannot create canvas context");c.drawImage(t,0,0,a,r);const o=h(c.getImageData(0,0,a,r),a,r,n);return i.width=0,i.height=0,o}function c(t,n,a=[2048,2048]){const[r,i]=a,c=new OffscreenCanvas(r,i),o=c.getContext("2d",{willReadFrequently:!0});if(!o)throw new e("imagecanvasdecoder: decode","cannot create canvas context");const{width:h,height:l}=t,d=h*l,s=new Uint8Array(d),g=new Uint8Array(d),w=new Uint8Array(d),u=null==n;n||(n=new Uint8Array(d));for(let e=0;e<l;e+=i){const a=Math.min(i,l-e);for(let i=0;i<h;i+=r){const c=Math.min(r,h-i);o.clearRect(0,0,c,a),o.drawImage(t,i,e,c,a,0,0,c,a);const{data:l}=o.getImageData(0,0,c,a);for(let t=0;t<a;t++){let a=t*c*4,r=(e+t)*h+i;for(let e=0;e<c;e++,a+=4,r++)s[r]=l[a],g[r]=l[a+1],w[r]=l[a+2],u&&(n[r]=l[a+3])}}}const f={width:h,height:l,pixels:[s,g,w],mask:n,pixelType:"u8"};return c.width=0,c.height=0,console.log(`decodeFullImageTiled: ${h}x${l} using tile ${r}x${i}`,f),f}function o(t,n,a){const[r,i,c]=n,[o,l]=a,d=Math.ceil(t.width/2**r),s=Math.ceil(t.height/2**r),g=Math.ceil(s/l),w=Math.ceil(d/o);if(i>=g||c>=w)return null;const u=new OffscreenCanvas(d,s),f=u.getContext("2d");if(!f)throw new e("imagecanvasdecoder: decode","cannot create canvas context");f.drawImage(t,0,0,d,s);const m=c*o,y=i*l,p=Math.min(o,d-m),v=Math.min(l,s-y),x=h(f.getImageData(m,y,p,v),o,l);return u.width=0,u.height=0,x}function h(e,t,n,a){const r=t*n,i=new Uint8Array(r),c=new Uint8Array(r),o=new Uint8Array(r),h=null==a;a||(a=new Uint8Array(r));const l={width:t,height:n,pixels:[i,c,o],mask:a,pixelType:"u8"},{width:d,height:s,data:g}=e;if(d===t&&s===n){for(let e=0,t=0;e<r;e++,t+=4)i[e]=g[t],c[e]=g[t+1],o[e]=g[t+2],h&&(a[e]=g[t+3]);return l}for(let w=0;w<s;w++){const e=w*d*4;for(let n=0;n<d;n++){const r=w*t+n;i[r]=g[e+4*n],c[r]=g[e+4*n+1],o[r]=g[e+4*n+2],h&&(a[r]=g[e+4*n+3])}}return l}function l(e){return`image/${"jpg"===e?"jpeg":e}`}async function d(e,t){try{const n=new Uint8Array(e);let a=Math.ceil(n.length/2);const r=n.length-2;for(;a<r&&(255!==n[a]||217!==n[a+1]);a++);a+=2;let i=null;return a<n.length-1&&(i=await s(n.subarray(a,-4),t.width*t.height)),i}catch{return null}}async function s(e,t){try{const n=await a(e),r=new Uint8Array(t);for(let e=0,t=0;e<n.length;e++)for(let a=7;a>=0;a--)r[t++]=n[e]>>a&1;return r}catch(n){return null}}export{r as decode,s as decodeBitMask};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{J as t}from"../../../chunks/Jpg.js";import{F as e}from"../../../chunks/Zlib.js";class r{static decode(r,n=!1){const s=new Uint8Array(r),o=new t;o.parse(s);const{width:a,height:l,numComponents:i,eof:f}=o,h=o.getData(a,l,1!==i),c=a*l;let u,g=null;if(n&&f<s.length-1)try{const t=new e(s.subarray(f)).getBytes();g=new Uint8Array(c);for(let e=0,r=0;e<t.length;e++)for(let n=7;n>=0;n--)g[r++]=t[e]>>n&1}catch{}if(1===i&&h.length===a*l){const t=new Uint8Array(h.buffer);u=[t,t,t]}else{u=[];for(let t=0;t<3;t++)u.push(new Uint8Array(c));for(let t=0,e=0;t<c;t++)for(let r=0;r<3;r++)u[r][t]=h[e++]}return{width:a,height:l,pixels:u,mask:g}}}export{r as default};
2
+ import{decodeBitMask as e}from"./ImageCanvasDecoder.js";import{J as t}from"../../../chunks/Jpg.js";class r{static async decode(r,a=!1){const n=new Uint8Array(r),s=new t;s.parse(n);const{width:o,height:i,numComponents:l,eof:f}=s,h=s.getData(o,i,1!==l),c=o*i;let m,p=null;if(a&&f<n.length-1&&(p=await e(n.subarray(f,-4),c)),1===l&&h.length===o*i){const e=new Uint8Array(h.buffer);m=[e,e,e]}else{m=[];for(let e=0;e<3;e++)m.push(new Uint8Array(c));for(let e=0,t=0;e<c;e++)for(let r=0;r<3;r++)m[r][e]=h[t++]}return{width:o,height:i,pixels:m,mask:p}}}export{r as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../core/Error.js";import{assertIsSome as t}from"../../../core/maybe.js";import{isAbortError as a}from"../../../core/promiseUtils.js";import{decode as i}from"./ImageCanvasDecoder.js";import r from"./JpgPlus.js";import{load as s,decode as n}from"./Lerc.js";import{decode as o}from"./Lzw.js";import{convertNoDataToMask as l}from"./pixelRangeUtils.js";import{load as c,decode as p}from"./Qb3.js";import f from"./Raw.js";import{decodeTileOrStrip as d,decode as u}from"./TiffDecoder.js";import{isPlatformLittleEndian as h}from"./utils.js";import{F as w}from"../../../chunks/Zlib.js";import m from"../../support/PixelBlock.js";import g from"../../support/SimpleBandStatistics.js";async function y(t,a){if(!h)throw new e("rasterCoded:decode","lerc decoder is not supported on big endian platform");await s();const{width:i,height:r,pixelType:o,statistics:l,depthCount:c,noDataValues:p,bandMasks:f,pixels:d,mask:u,validPixelCount:w}=n(t,{inputOffset:a.offset,returnInterleaved:a.returnInterleaved});return new m({width:i,height:r,pixelType:o.toLowerCase(),pixels:d,mask:u,validPixelCount:w,statistics:l.map(({minValue:e,maxValue:t})=>new g(e,t)),bandMasks:f,depthCount:c,noDataValues:p})}async function x(t,a){await c();const i=p(t);if(!i)throw new e("rasterCodec:decode","failed to decode the input data.");const{width:r,height:s,pixels:n,pixelType:o}=i;return new m({width:r,height:s,pixelType:o,pixels:n})}async function k(e,a){const i=await u(e,{...a,noDataValue:a.tiffNoDataValue,matchAllNoData:a.matchAllNoData});t(i);return new m({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,bandMasks:i.bandMasks})}async function b(e,t){const a=await d(e,t.customOptions),i=new m({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask});return t.skipStatistics||i.updateStatistics(),i}function C(e,t){const a=t.pixelType||"u8",i=m.getPixelArrayConstructor(a),r="u8"===a?e:new i(e.buffer),s=[],n=t.planes||1;if(1===n)s.push(r);else for(let o=0;o<n;o++){const a=(t.width||1)*(t.height||e.length),l=new i(a);for(let e=0;e<a;e++)l[e]=r[e*n+o];s.push(l)}return new m({width:t.width||1,height:t.height||e.length,pixels:s,pixelType:a})}function T(e,t){return C(new w(new Uint8Array(e)).getBytes(),t)}function j(e,t){return C(o(e,t.offset,t.eof,!t.isInputBigEndian),t)}function A(e,t){const a=t.format,{pixelTypeCtor:i}=V(t.pixelType),r=(0,f.decode)(e,{width:t.width,height:t.height,pixelType:i,format:a});return new m({width:t.width,height:t.height,pixels:r.pixels,pixelType:t.pixelType,mask:r.mask})}function U(e,t){const a=r.decode(e,t.applyJpegMask);return new m({width:a.width,height:a.height,pixels:a.pixels,pixelType:"u8",mask:a.mask})}async function D(e,t,a){const r=await i(e,t,a);return new m(r)}async function v(t,i,r){const s=i.format||M(t),n={...i,format:s},{canvasUsage:o}=i;if("no-canvas"!==o||"png"===s)try{return await D(t,n,r)}catch(l){if(a(l))throw l;if("canvas-only"===o)throw new e("rasterCodec:decode",`failed to decode the input data with canvas for format ${s}`)}return U(t,n)}function P(t){let a=null;switch(t){case"lerc":a=y;break;case"jpg":case"png":a=v;break;case"bmp":case"gif":a=D;break;case"bsq":case"bip":a=A;break;case"tiff":a=k;break;case"deflate":a=T;break;case"lzw":a=j;break;case"qb3":a=x;break;default:a=()=>{throw new e("rasterCodec:decode",`unsupported raster format ${t}`)}}return a}function V(e){let t=null,a=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,t=Uint8Array;break;case"u16":a=a||65535,t=Uint16Array;break;case"u32":a=a||2**32-1,t=Uint32Array;break;case"s8":a=a||-128,t=Int8Array;break;case"s16":a=a||-32768,t=Int16Array;break;case"s32":a=a||0-2**31,t=Int32Array;break;default:t=Float32Array}return{pixelTypeCtor:t,noDataValue:a}}function L(e,t="bilinear"){if(!e)return;const{pixels:a,width:i,height:r,mask:s}=e;if(!a||0===a.length)return;const n=i-1,o=r-1,l=[];let c=null;const p=m.getPixelArrayConstructor(e.pixelType);if("nearest"===t){for(const e of a){const t=new p(n*o);for(let a=0;a<o;a++){const r=a*i;for(let i=0;i<n;i++)t[a*n+i]=e[r+i]}l.push(t)}if(null!=s){c=new Uint8Array(n*o);for(let e=0;e<o;e++){const t=e*i;for(let a=0;a<n;a++)c[e*n+a]=s[t+a]}}}else{for(const e of a){const t=new p(n*o);for(let a=0;a<o;a++){const r=a*i;for(let s=0;s<n;s++)t[a*n+s]=(e[r+s]+e[r+s+1]+e[r+i+s]+e[r+i+s+1])/4}l.push(t)}if(s){c=new Uint8Array(n*o);for(let e=0;e<o;e++){const t=e*i;for(let a=0;a<n;a++)c[e*n+a]=Math.min.apply(null,[s[t+a],s[t+a+1],s[t+i+a],s[t+i+a+1]])}}}e.width=n,e.height=o,e.mask=c,e.pixels=l}function M(e){if(!e)return;const t=new Uint8Array(e,0,10);let a;return 255===t[0]&&216===t[1]?a="jpg":137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]?a="png":67===t[0]&&110===t[1]&&116===t[2]&&90===t[3]&&73===t[4]&&109===t[5]&&97===t[6]&&103===t[7]&&101===t[8]&&32===t[9]||76===t[0]&&101===t[1]&&114===t[2]&&99===t[3]&&50===t[4]&&32===t[5]?a="lerc":73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3]||73===t[0]&&73===t[1]&&43===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&43===t[3]?a="tiff":71===t[0]&&73===t[1]&&70===t[2]?a="gif":66===t[0]&&77===t[1]?a="bmp":81===t[0]&&66===t[1]&&51===t[2]&&(a="qb3"),a}async function I(t,a={},i){if(null==t)throw new e("rasterCodec:decode","missing encodeddata parameter.");let r=a.format?.toLowerCase();if(!("bsq"!==r&&"bip"!==r||null!=a.width&&null!=a.height))throw new e("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===r&&a.customOptions)return b(t,a);if(!r||"bsq"!==r&&"bip"!==r&&"deflate"!==r&&"lzw"!==r){if(r=M(t),!r){throw String.fromCharCode.apply(null,[...new Uint8Array(t,0,10)]).toLowerCase().includes("error")?new e("rasterCodec:decode","input data contains error"):new e("rasterCodec:decode","unsupported raster format")}a={...a,format:r}}const s=P(r);let n;a.isPoint&&(null!=(a={...a}).width&&a.width++,null!=a.height&&a.height++);const{offsets:o}=a;if(o&&o.length>1){const e=o.map((e,r)=>s(t.slice(e,o[r+1]),a,i)),r=await Promise.all(e);n=r[0],n.pixels=r.map(e=>e.pixels[0]);const l=r.map(e=>e.mask);l.some(e=>null!=e)&&(l.forEach((e,t)=>{l[t]??=new Uint8Array(n.width*n.height).fill(255)}),n.bandMasks=l,n.mask=m.combineBandMasks(l))}else n=await s(t,{...a,offset:o?.[0]??a.offset},i);return"jpg"!==r&&null!=a.noDataValue&&1===n.depthCount&&l(n,a.noDataValue,{customFloatTolerance:a.tolerance}),a.isPoint&&L(n),n.statistics?.length||a.skipStatistics||n.updateStatistics(),n}export{I as decode,M as getFormat};
2
+ import e from"../../../core/Error.js";import{assertIsSome as t}from"../../../core/maybe.js";import{isAbortError as a}from"../../../core/promiseUtils.js";import{decode as i}from"./ImageCanvasDecoder.js";import r from"./JpgPlus.js";import{load as s,decode as n}from"./Lerc.js";import{decode as o}from"./Lzw.js";import{convertNoDataToMask as l}from"./pixelRangeUtils.js";import{load as c,decode as p}from"./Qb3.js";import f from"./Raw.js";import{decodeTileOrStrip as d,decode as u}from"./TiffDecoder.js";import{isPlatformLittleEndian as h}from"./utils.js";import{inflate as w}from"./Zlib.js";import m from"../../support/PixelBlock.js";import g from"../../support/SimpleBandStatistics.js";async function y(t,a){if(!h)throw new e("rasterCoded:decode","lerc decoder is not supported on big endian platform");await s();const{width:i,height:r,pixelType:o,statistics:l,depthCount:c,noDataValues:p,bandMasks:f,pixels:d,mask:u,validPixelCount:w}=n(t,{inputOffset:a.offset,returnInterleaved:a.returnInterleaved});return new m({width:i,height:r,pixelType:o.toLowerCase(),pixels:d,mask:u,validPixelCount:w,statistics:l.map(({minValue:e,maxValue:t})=>new g(e,t)),bandMasks:f,depthCount:c,noDataValues:p})}async function x(t,a){await c();const i=p(t);if(!i)throw new e("rasterCodec:decode","failed to decode the input data.");const{width:r,height:s,pixels:n,pixelType:o}=i;return new m({width:r,height:s,pixelType:o,pixels:n})}async function k(e,a){const i=await u(e,{...a,noDataValue:a.tiffNoDataValue,matchAllNoData:a.matchAllNoData});t(i);return new m({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,bandMasks:i.bandMasks})}async function b(e,t){const a=await d(e,t.customOptions),i=new m({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask});return t.skipStatistics||i.updateStatistics(),i}function C(e,t){const a=t.pixelType||"u8",i=m.getPixelArrayConstructor(a),r="u8"===a?e:new i(e.buffer),s=[],n=t.planes||1;if(1===n)s.push(r);else for(let o=0;o<n;o++){const a=(t.width||1)*(t.height||e.length),l=new i(a);for(let e=0;e<a;e++)l[e]=r[e*n+o];s.push(l)}return new m({width:t.width||1,height:t.height||e.length,pixels:s,pixelType:a})}async function T(e,t){return C(await w(new Uint8Array(e)),t)}function j(e,t){return C(o(e,t.offset,t.eof,!t.isInputBigEndian),t)}function A(e,t){const a=t.format,{pixelTypeCtor:i}=V(t.pixelType),r=(0,f.decode)(e,{width:t.width,height:t.height,pixelType:i,format:a});return new m({width:t.width,height:t.height,pixels:r.pixels,pixelType:t.pixelType,mask:r.mask})}async function U(e,t){const a=await r.decode(e,t.applyJpegMask);return new m({width:a.width,height:a.height,pixels:a.pixels,pixelType:"u8",mask:a.mask})}async function D(e,t,a){const r=await i(e,t,a);return new m(r)}async function v(t,i,r){const s=i.format||M(t),n={...i,format:s},{canvasUsage:o}=i;if("no-canvas"!==o||"png"===s)try{return await D(t,n,r)}catch(l){if(a(l))throw l;if("canvas-only"===o)throw new e("rasterCodec:decode",`failed to decode the input data with canvas for format ${s}`)}return await U(t,n)}function P(t){let a=null;switch(t){case"lerc":a=y;break;case"jpg":case"png":a=v;break;case"bmp":case"gif":a=D;break;case"bsq":case"bip":a=A;break;case"tiff":a=k;break;case"deflate":a=T;break;case"lzw":a=j;break;case"qb3":a=x;break;default:a=()=>{throw new e("rasterCodec:decode",`unsupported raster format ${t}`)}}return a}function V(e){let t=null,a=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,t=Uint8Array;break;case"u16":a=a||65535,t=Uint16Array;break;case"u32":a=a||2**32-1,t=Uint32Array;break;case"s8":a=a||-128,t=Int8Array;break;case"s16":a=a||-32768,t=Int16Array;break;case"s32":a=a||0-2**31,t=Int32Array;break;default:t=Float32Array}return{pixelTypeCtor:t,noDataValue:a}}function L(e,t="bilinear"){if(!e)return;const{pixels:a,width:i,height:r,mask:s}=e;if(!a||0===a.length)return;const n=i-1,o=r-1,l=[];let c=null;const p=m.getPixelArrayConstructor(e.pixelType);if("nearest"===t){for(const e of a){const t=new p(n*o);for(let a=0;a<o;a++){const r=a*i;for(let i=0;i<n;i++)t[a*n+i]=e[r+i]}l.push(t)}if(null!=s){c=new Uint8Array(n*o);for(let e=0;e<o;e++){const t=e*i;for(let a=0;a<n;a++)c[e*n+a]=s[t+a]}}}else{for(const e of a){const t=new p(n*o);for(let a=0;a<o;a++){const r=a*i;for(let s=0;s<n;s++)t[a*n+s]=(e[r+s]+e[r+s+1]+e[r+i+s]+e[r+i+s+1])/4}l.push(t)}if(s){c=new Uint8Array(n*o);for(let e=0;e<o;e++){const t=e*i;for(let a=0;a<n;a++)c[e*n+a]=Math.min.apply(null,[s[t+a],s[t+a+1],s[t+i+a],s[t+i+a+1]])}}}e.width=n,e.height=o,e.mask=c,e.pixels=l}function M(e){if(!e)return;const t=new Uint8Array(e,0,10);let a;return 255===t[0]&&216===t[1]?a="jpg":137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]?a="png":67===t[0]&&110===t[1]&&116===t[2]&&90===t[3]&&73===t[4]&&109===t[5]&&97===t[6]&&103===t[7]&&101===t[8]&&32===t[9]||76===t[0]&&101===t[1]&&114===t[2]&&99===t[3]&&50===t[4]&&32===t[5]?a="lerc":73===t[0]&&73===t[1]&&42===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&42===t[3]||73===t[0]&&73===t[1]&&43===t[2]&&0===t[3]||77===t[0]&&77===t[1]&&0===t[2]&&43===t[3]?a="tiff":71===t[0]&&73===t[1]&&70===t[2]?a="gif":66===t[0]&&77===t[1]?a="bmp":81===t[0]&&66===t[1]&&51===t[2]&&(a="qb3"),a}async function I(t,a={},i){if(null==t)throw new e("rasterCodec:decode","missing encodeddata parameter.");let r=a.format?.toLowerCase();if(!("bsq"!==r&&"bip"!==r||null!=a.width&&null!=a.height))throw new e("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===r&&a.customOptions)return b(t,a);if(!r||"bsq"!==r&&"bip"!==r&&"deflate"!==r&&"lzw"!==r){if(r=M(t),!r){throw String.fromCharCode.apply(null,[...new Uint8Array(t,0,10)]).toLowerCase().includes("error")?new e("rasterCodec:decode","input data contains error"):new e("rasterCodec:decode","unsupported raster format")}a={...a,format:r}}const s=P(r);let n;a.isPoint&&(null!=(a={...a}).width&&a.width++,null!=a.height&&a.height++);const{offsets:o}=a;if(o&&o.length>1){const e=o.map((e,r)=>s(t.slice(e,o[r+1]),a,i)),r=await Promise.all(e);n=r[0],n.pixels=r.map(e=>e.pixels[0]);const l=r.map(e=>e.mask);l.some(e=>null!=e)&&(l.forEach((e,t)=>{l[t]??=new Uint8Array(n.width*n.height).fill(255)}),n.bandMasks=l,n.mask=m.combineBandMasks(l))}else n=await s(t,{...a,offset:o?.[0]??a.offset},i);return"jpg"!==r&&null!=a.noDataValue&&1===n.depthCount&&l(n,a.noDataValue,{customFloatTolerance:a.tolerance}),a.isPoint&&L(n),n.statistics?.length||a.skipStatistics||n.updateStatistics(),n}export{I as decode,M as getFormat};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../core/Error.js";import"../../../core/has.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as r}from"./Lerc.js";import{decode as l}from"./Lzw.js";import{convertNoDataToMask as a}from"./pixelRangeUtils.js";import{isBSQConfig as o,getTagFirstNumericValue as i,getCompressionType as s,parseHeader as f,checkRequiredArraySize as c,getTagNumericValues as u,getImageInfo as h}from"./tiffParser.js";import{isPlatformLittleEndian as w}from"./utils.js";import{F as A}from"../../../chunks/Zlib.js";function E(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function y(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}async function p(e,t){await n();return r(e,{inputOffset:t}).pixels[0]}function T(e,t){if(t%8==0)return e;const n=t>16?32:t>8?16:8;n>8&&(e=m(e,32===n?4:2));const r=32===n?Uint32Array:16===n?Uint16Array:Uint8Array,l=new r(e),a=Math.floor(8*e.byteLength/t+1e-6),o=new r(a),i=(1<<t)-1;let s=0,f=0,c=0;for(let u=0;u<a;u++)if(0===f&&(c=l[s++],f=n),f>=t)o[u]=c>>>f-t&i,f-=t;else{const e=t-f;let r=(c&i)<<e&i;c=l[s++],f=n-e,r+=c>>>f,o[u]=r}return o.buffer}function d(e,n,r){const l=new t;l.parse(e),l.colorTransform=6===r?-1:0;const a=l.getData(l.width,l.height,1!==n&&4!==n);return new Uint8Array(a.buffer)}function g(e){const t=new A(e).getBytes(),n=new ArrayBuffer(t.length),r=new Uint8Array(n);return r.set(t),r}function m(e,t){const n=new Uint8Array(e),r=new Uint8Array(n.length);if(2===t)for(let l=0;l<n.length;l+=2)r[l]=n[l+1],r[l+1]=n[l];else if(4===t)for(let l=0;l<n.length;l+=4)r[l]=n[l+3],r[l+1]=n[l+2],r[l+2]=n[l+1],r[l+3]=n[l];else for(let l=0;l<n.length;l+=8)r[l]=n[l+7],r[l+1]=n[l+6],r[l+2]=n[l+5],r[l+3]=n[l+4],r[l+4]=n[l+3],r[l+5]=n[l+2],r[l+6]=n[l+1],r[l+7]=n[l];return r.buffer}async function P(t,n,r,a,f){const c=w===n,u=i(r,"BITSPERSAMPLE"),h=i(r,"SAMPLESPERPIXEL")??1,A=i(r,"PHOTOMETRICINTERPRETATION"),P=i(r,"SAMPLEFORMAT")??1,I=E(P,u),b=s(r);if(34887===b)return await p(t,a);const L=y(I);let U,M,R;switch(b){case 1:U=t.slice(a,a+f),M=new Uint8Array(U);break;case 8:case 32946:M=g(new Uint8Array(t,a,f)),U=M.buffer;break;case 6:M=d(new Uint8Array(t,a,f),h,A),U=M.buffer;break;case 7:{const e=r.get("JPEGTABLES").values,n=e.length-2,l=new Uint8Array(n+f-2);for(let t=0;t<n;t++)l[t]=e[t];const o=new Uint8Array(t,a+2,f-2);for(let t=0;t<o.length;t++)l[n+t]=o[t];M=d(l,h,A),U=M.buffer}break;case 5:M=l(t,a,f,n),U=M.buffer;break;default:throw new e("tiff-reader:decode-data","unsupported compression "+b)}if(U=T(U,u),c||u<=8)R=new L(U);else{const e=u>32?8:u>16?4:2;R=new L(m(M.buffer,e))}const k=i(r,"PREDICTOR")??1,O=i(r,"TILEWIDTH"),D=i(r,"TILELENGTH");if(k>1&&(5===b||8===b||32946===b)&&O&&D){const e=o(r),t=new L(R.length);t.set(R),R=S(t,D,O,3===P&&3===k,e?1:h)}return R}async function I(e,t,n){const r=u(n,"TILEOFFSETS"),l=u(n,"TILEBYTECOUNTS");if(null==r||null==l)return null;const{width:a,height:f,pixelType:c,tileWidth:w,tileHeight:A}=h([n]),E=o(n,t),p=i(n,"SAMPLESPERPIXEL")||t.planes,T=a*f,d=i(n,"BITSPERSAMPLE"),g=34887===s(n),m=y(c),I=[];for(let o=0;o<p;o++)I.push(new m(T));const b=Math.ceil(a/w),L=new Uint8Array(T).fill(255);let S=null,U=!1;if(d%8==0)if(g&&E&&p>1){const o=Math.round(r.length/p);for(let i=0;i<o;i++){const o=Math.floor(i/b)*A,s=i%b*w,c=o*a+s;for(let u=0;u<p;u++){const h=i*p+u;0===l[h]?(S=null,U=!0):S=await P(e,t.littleEndian,n,r[h],l[h]);const E=Math.min(w,a-s),y=Math.min(A,f-o),T=I[u];for(let e=0;e<y;e++){let t=c+e*a,n=e*w;for(let e=0;e<E;e++,t++,n++)S?T[t]=S[n]:L[t]=0}}}}else for(let o=0;o<r.length;o++){const i=Math.floor(o/b)*A,s=o%b*w,c=i*a+s;0===l[o]?(S=null,U=!0):S=await P(e,t.littleEndian,n,r[o],l[o]);const u=Math.min(w,a-s),h=Math.min(A,f-i);for(let e=0;e<p;e++){const t=I[e];if(E||g)for(let n=0;n<h;n++){let r=c+n*a,l=w*A*e+n*w;for(let e=0;e<u;e++,r++,l++)S?t[r]=S[l]:L[r]=0}else for(let n=0;n<h;n++){let r=c+n*a,l=n*w*p+e;for(let e=0;e<u;e++,r++,l+=p)S?t[r]=S[l]:L[r]=0}}}return{width:a,height:f,pixelType:c,pixels:I,mask:U?L:void 0}}function b(e,t,n){const r=w===t.littleEndian,a=u(n,"STRIPOFFSETS"),o=u(n,"STRIPBYTECOUNTS");if(null==a||null==o)return null;const{width:f,height:c,pixelType:A}=h([n]),E=i(n,"SAMPLESPERPIXEL")||t.planes,p=i(n,"PHOTOMETRICINTERPRETATION"),m=f*c,P=i(n,"BITSPERSAMPLE"),I=y(A),b=new I(m*E),L=i(n,"ROWSPERSTRIP"),S=s(n);let U,M,R,k;if(P%8==0)for(let i=0;i<a.length;i++){const n=i*(L*f)*E;if("u8"===A||"s8"===A||r)8===S||32946===S?(R=new Uint8Array(e,a[i],o[i]),R=g(R),M=R.buffer):6===S?(R=new Uint8Array(e,a[i],o[i]),R=d(R,E,p),M=R.buffer):5===S?(R=l(e,a[i],o[i],t.littleEndian),M=R.buffer):M=e.slice(a[i],a[i]+o[i]),M=T(M,P),U=new I(M);else{switch(6===S||8===S||32946===S?(R=new Uint8Array(e,a[i],o[i]),k=g(R),M=k.buffer):(M=new ArrayBuffer(o[i]),R=new Uint8Array(e,a[i],o[i]),k=new Uint8Array(M)),A){case"u16":case"s16":for(let e=0;e<R.length;e+=2)k[e]=R[e+1],k[e+1]=R[e];break;case"u32":case"s32":case"f32":for(let e=0;e<R.length;e+=4)k[e]=R[e+3],k[e+1]=R[e+2],k[e+2]=R[e+1],k[e+3]=R[e]}M=T(M,P),U=new I(M)}b.set(U,n)}const O=[];if(1===E)O.push(b);else for(let l=0;l<E;l++){const e=new I(m);for(let t=0;t<m;t++)e[t]=b[t*E+l];O.push(e)}return{width:f,height:c,pixelType:A,pixels:O}}function L(e,t,n){if(!(e&&e.length>0&&t&&n))return null;let r,l,a;const o=e[0].length,i=e.length,s=new Uint8Array(o);for(let f=0;f<i;f++)if(r=e[f],l=t[f],a=n[f],0===f)for(let e=0;e<o;e++)s[e]=r[e]<l||r[e]>a?0:1;else for(let e=0;e<o;e++)s[e]&&(s[e]=r[e]<l||r[e]>a?0:1);return s}function S(e,t,n,r,l){const a=r?4:1,o=n*a*l;r&&(e=new Uint8Array(e.buffer));for(let f=0;f<t;f++){const t=f*o;for(let n=l;n<o;n++)e[t+n]+=e[t+n-l]}if(!r)return e;const i=new Uint8Array(e.length),s=n*l;for(let f=0;f<t;f++){const t=f*o;for(let n=0;n<s;n++)for(let r=0;r<a;r++)i[t+n*a+r]=e[t+n+(a-r-1)*s]}return new Float32Array(i.buffer)}async function U(e,t){const{headerInfo:n,ifd:r,offsets:l,sizes:f}=t,c=[];for(let a=0;a<l.length;a++){f[a];const t=await P(e,n.littleEndian,r,l[a],f[a]||e.byteLength);c.push(t)}const u=o(r,n),h=i(r,"BITSPERSAMPLE"),w=E(i(r,"SAMPLEFORMAT")??1,h),A=i(r,"SAMPLESPERPIXEL")||n.planes,p=y(w),T=i(r,"TILEWIDTH"),d=i(r,"TILELENGTH"),g=34887===s(r),m=T*d;let I;const b=[];let S=c[0];for(let a=0;a<A;a++){if(I=new p(m),c.length===A)S=c[a],S.length===m&&(I=S);else if(S.length)if(u||g)I=S.length===m?S:S.slice(m*a,m*(a+1));else for(let e=0;e<m;e++)I[e]=S[e*A+a];b.push(I)}const U=n.noData?n.noData[0]:t.noDataValue,M=n.metadata?n.metadata.statistics:null,R=M?M.map(e=>e.min):null,k=M?M.map(e=>e.max):null,O={pixelType:w,width:T,height:d,pixels:b,noDataValue:U};return null!=U?a(O,U,{matchAllNoData:t?.matchAllNoData}):R&&k&&t.applyMinMaxConstraint&&(O.mask=L(b,R,k)),O}async function M(t,n={}){const r=n.pyramidLevel||0,l=n.headerInfo||f(t),{ifds:o,noData:i}=l;if(0===o.length)throw new e("tiff-reader:decode","no valid image file directory");const s=c(l);if(s)throw new e("tiff-reader:decode",s);let u=null;const h=-1===r?o[o.length-1]:o[r],w=i??n.noDataValue;if(u=l.tileWidth?await I(t,l,h):b(t,l,h),!u)return u;if(null!=w){a(u,w,{matchAllNoData:null==i&&n?.matchAllNoData})}return u}export{M as decode,U as decodeTileOrStrip};
2
+ import e from"../../../core/Error.js";import"../../../core/has.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as r}from"./Lerc.js";import{decode as a}from"./Lzw.js";import{convertNoDataToMask as l}from"./pixelRangeUtils.js";import{isBSQConfig as i,getTagFirstNumericValue as o,getCompressionType as s,parseHeader as f,checkRequiredArraySize as c,getTagNumericValues as u,getImageInfo as h}from"./tiffParser.js";import{isPlatformLittleEndian as w}from"./utils.js";import{inflate as E}from"./Zlib.js";function A(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function y(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}async function p(e,t){await n();return r(e,{inputOffset:t}).pixels[0]}function T(e,t){if(t%8==0)return e;const n=t>16?32:t>8?16:8;n>8&&(e=g(e,32===n?4:2));const r=32===n?Uint32Array:16===n?Uint16Array:Uint8Array,a=new r(e),l=Math.floor(8*e.byteLength/t+1e-6),i=new r(l),o=(1<<t)-1;let s=0,f=0,c=0;for(let u=0;u<l;u++)if(0===f&&(c=a[s++],f=n),f>=t)i[u]=c>>>f-t&o,f-=t;else{const e=t-f;let r=(c&o)<<e&o;c=a[s++],f=n-e,r+=c>>>f,i[u]=r}return i.buffer}function d(e,n,r){const a=new t;a.parse(e),a.colorTransform=6===r?-1:0;const l=a.getData(a.width,a.height,1!==n&&4!==n);return new Uint8Array(l.buffer)}function g(e,t){const n=new Uint8Array(e),r=new Uint8Array(n.length);if(2===t)for(let a=0;a<n.length;a+=2)r[a]=n[a+1],r[a+1]=n[a];else if(4===t)for(let a=0;a<n.length;a+=4)r[a]=n[a+3],r[a+1]=n[a+2],r[a+2]=n[a+1],r[a+3]=n[a];else for(let a=0;a<n.length;a+=8)r[a]=n[a+7],r[a+1]=n[a+6],r[a+2]=n[a+5],r[a+3]=n[a+4],r[a+4]=n[a+3],r[a+5]=n[a+2],r[a+6]=n[a+1],r[a+7]=n[a];return r.buffer}async function m(t,n,r,l,f){const c=w===n,u=o(r,"BITSPERSAMPLE"),h=o(r,"SAMPLESPERPIXEL")??1,m=o(r,"PHOTOMETRICINTERPRETATION"),P=o(r,"SAMPLEFORMAT")??1,I=A(P,u),b=s(r);if(34887===b)return await p(t,l);const S=y(I);let U,M,R;switch(b){case 1:U=t.slice(l,l+f),M=new Uint8Array(U);break;case 8:case 32946:M=await E(new Uint8Array(t,l,f)),U=M.buffer;break;case 6:M=d(new Uint8Array(t,l,f),h,m),U=M.buffer;break;case 7:{const e=r.get("JPEGTABLES").values,n=e.length-2,a=new Uint8Array(n+f-2);for(let t=0;t<n;t++)a[t]=e[t];const i=new Uint8Array(t,l+2,f-2);for(let t=0;t<i.length;t++)a[n+t]=i[t];M=d(a,h,m),U=M.buffer}break;case 5:M=a(t,l,f,n),U=M.buffer;break;default:throw new e("tiff-reader:decode-data","unsupported compression "+b)}if(U=T(U,u),c||u<=8)R=new S(U);else{const e=u>32?8:u>16?4:2;R=new S(g(M.buffer,e))}const k=o(r,"PREDICTOR")??1,O=o(r,"TILEWIDTH"),D=o(r,"TILELENGTH");if(k>1&&(5===b||8===b||32946===b)&&O&&D){const e=i(r),t=new S(R.length);t.set(R),R=L(t,D,O,3===P&&3===k,e?1:h)}return R}async function P(e,t,n){const r=u(n,"TILEOFFSETS"),a=u(n,"TILEBYTECOUNTS");if(null==r||null==a)return null;const{width:l,height:f,pixelType:c,tileWidth:w,tileHeight:E}=h([n]),A=i(n,t),p=o(n,"SAMPLESPERPIXEL")||t.planes,T=l*f,d=o(n,"BITSPERSAMPLE"),g=34887===s(n),P=y(c),I=[];for(let i=0;i<p;i++)I.push(new P(T));const b=Math.ceil(l/w),L=new Uint8Array(T).fill(255);let S=null,U=!1;if(d%8==0)if(g&&A&&p>1){const i=Math.round(r.length/p);for(let o=0;o<i;o++){const i=Math.floor(o/b)*E,s=o%b*w,c=i*l+s;for(let u=0;u<p;u++){const h=o*p+u;0===a[h]?(S=null,U=!0):S=await m(e,t.littleEndian,n,r[h],a[h]);const A=Math.min(w,l-s),y=Math.min(E,f-i),T=I[u];for(let e=0;e<y;e++){let t=c+e*l,n=e*w;for(let e=0;e<A;e++,t++,n++)S?T[t]=S[n]:L[t]=0}}}}else for(let i=0;i<r.length;i++){const o=Math.floor(i/b)*E,s=i%b*w,c=o*l+s;0===a[i]?(S=null,U=!0):S=await m(e,t.littleEndian,n,r[i],a[i]);const u=Math.min(w,l-s),h=Math.min(E,f-o);for(let e=0;e<p;e++){const t=I[e];if(A||g)for(let n=0;n<h;n++){let r=c+n*l,a=w*E*e+n*w;for(let e=0;e<u;e++,r++,a++)S?t[r]=S[a]:L[r]=0}else for(let n=0;n<h;n++){let r=c+n*l,a=n*w*p+e;for(let e=0;e<u;e++,r++,a+=p)S?t[r]=S[a]:L[r]=0}}}return{width:l,height:f,pixelType:c,pixels:I,mask:U?L:void 0}}async function I(e,t,n){const r=w===t.littleEndian,l=u(n,"STRIPOFFSETS"),i=u(n,"STRIPBYTECOUNTS");if(null==l||null==i)return null;const{width:f,height:c,pixelType:A}=h([n]),p=o(n,"SAMPLESPERPIXEL")||t.planes,g=o(n,"PHOTOMETRICINTERPRETATION"),m=f*c,P=o(n,"BITSPERSAMPLE"),I=y(A),b=new I(m*p),L=o(n,"ROWSPERSTRIP"),S=s(n);let U,M,R,k;if(P%8==0)for(let o=0;o<l.length;o++){const n=o*(L*f)*p;if("u8"===A||"s8"===A||r)8===S||32946===S?(R=new Uint8Array(e,l[o],i[o]),R=await E(R),M=R.buffer):6===S?(R=new Uint8Array(e,l[o],i[o]),R=d(R,p,g),M=R.buffer):5===S?(R=a(e,l[o],i[o],t.littleEndian),M=R.buffer):M=e.slice(l[o],l[o]+i[o]),M=T(M,P),U=new I(M);else{switch(6===S||8===S||32946===S?(R=new Uint8Array(e,l[o],i[o]),k=await E(R),M=k.buffer):(M=new ArrayBuffer(i[o]),R=new Uint8Array(e,l[o],i[o]),k=new Uint8Array(M)),A){case"u16":case"s16":for(let e=0;e<R.length;e+=2)k[e]=R[e+1],k[e+1]=R[e];break;case"u32":case"s32":case"f32":for(let e=0;e<R.length;e+=4)k[e]=R[e+3],k[e+1]=R[e+2],k[e+2]=R[e+1],k[e+3]=R[e]}M=T(M,P),U=new I(M)}b.set(U,n)}const O=[];if(1===p)O.push(b);else for(let a=0;a<p;a++){const e=new I(m);for(let t=0;t<m;t++)e[t]=b[t*p+a];O.push(e)}return{width:f,height:c,pixelType:A,pixels:O}}function b(e,t,n){if(!(e&&e.length>0&&t&&n))return null;let r,a,l;const i=e[0].length,o=e.length,s=new Uint8Array(i);for(let f=0;f<o;f++)if(r=e[f],a=t[f],l=n[f],0===f)for(let e=0;e<i;e++)s[e]=r[e]<a||r[e]>l?0:1;else for(let e=0;e<i;e++)s[e]&&(s[e]=r[e]<a||r[e]>l?0:1);return s}function L(e,t,n,r,a){const l=r?4:1,i=n*l*a;r&&(e=new Uint8Array(e.buffer));for(let f=0;f<t;f++){const t=f*i;for(let n=a;n<i;n++)e[t+n]+=e[t+n-a]}if(!r)return e;const o=new Uint8Array(e.length),s=n*a;for(let f=0;f<t;f++){const t=f*i;for(let n=0;n<s;n++)for(let r=0;r<l;r++)o[t+n*l+r]=e[t+n+(l-r-1)*s]}return new Float32Array(o.buffer)}async function S(e,t){const{headerInfo:n,ifd:r,offsets:a,sizes:f}=t,c=[];for(let l=0;l<a.length;l++){f[l];const t=await m(e,n.littleEndian,r,a[l],f[l]||e.byteLength);c.push(t)}const u=i(r,n),h=o(r,"BITSPERSAMPLE"),w=A(o(r,"SAMPLEFORMAT")??1,h),E=o(r,"SAMPLESPERPIXEL")||n.planes,p=y(w),T=o(r,"TILEWIDTH"),d=o(r,"TILELENGTH"),g=34887===s(r),P=T*d;let I;const L=[];let S=c[0];for(let l=0;l<E;l++){if(I=new p(P),c.length===E)S=c[l],S.length===P&&(I=S);else if(S.length)if(u||g)I=S.length===P?S:S.slice(P*l,P*(l+1));else for(let e=0;e<P;e++)I[e]=S[e*E+l];L.push(I)}const U=n.noData?n.noData[0]:t.noDataValue,M=n.metadata?n.metadata.statistics:null,R=M?M.map(e=>e.min):null,k=M?M.map(e=>e.max):null,O={pixelType:w,width:T,height:d,pixels:L,noDataValue:U};return null!=U?l(O,U,{matchAllNoData:t?.matchAllNoData}):R&&k&&t.applyMinMaxConstraint&&(O.mask=b(L,R,k)),O}async function U(t,n={}){const r=n.pyramidLevel||0,a=n.headerInfo||f(t),{ifds:i,noData:o}=a;if(0===i.length)throw new e("tiff-reader:decode","no valid image file directory");const s=c(a);if(s)throw new e("tiff-reader:decode",s);const u=-1===r?i[i.length-1]:i[r],h=o??n.noDataValue,w=a.tileWidth?await P(t,a,u):await I(t,a,u);if(!w)return w;if(null!=h){l(w,h,{matchAllNoData:null==o&&n?.matchAllNoData})}return w}export{U as decode,S as decodeTileOrStrip};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ function n(n){if(n.length<2)return!1;const[e,r]=n.subarray(0,2);return!(8!==(15&e)||e>>4>7)&&(65535&(e<<8|r))%31==0}function e(n){return n.length>=2&&31===n[0]&&139===n[1]}function r(r){return e(r)?"gzip":n(r)?"deflate":null}async function t(n,e){e??=r(n)??"deflate-raw";const t=new Response(n).body.pipeThrough(new DecompressionStream(e)),o=await new Response(t).arrayBuffer();return new Uint8Array(o)}export{t as inflate};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.46",
3
+ "version": "5.2.0-next.48",
4
4
  "type": "module",
5
5
  "homepage": "https://js.arcgis.com",
6
6
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
@@ -20,7 +20,7 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.19.1",
23
- "@arcgis/toolkit": "^5.2.0-next.42",
23
+ "@arcgis/toolkit": "^5.2.0-next.44",
24
24
  "@esri/arcgis-html-sanitizer": "~4.1.0",
25
25
  "@esri/calcite-components": "^5.1.1",
26
26
  "@vaadin/grid": "~25.2.4",
@@ -1,11 +1,19 @@
1
+ import type { EventedMixin } from "../../core/Evented.js";
1
2
  import type { IdentifiableMixin, IdentifiableMixinProperties } from "../../core/Identifiable.js";
2
3
  import type { JSONSupportMixin } from "../../core/JSONSupport.js";
3
4
  import type { Loadable, LoadableMixinProperties } from "../../core/Loadable.js";
4
5
  import type { AbortOptions } from "../../core/promiseUtils.js";
5
6
  import type { ServiceCapabilities, LayerInfo, TableInfo, ServiceEdits, ServiceEditsResult, ServiceEditOptions, ServiceContents } from "./types.js";
7
+ import type { VersionIdentifier } from "../../versionManagement/support/jsonTypes.js";
6
8
 
7
9
  export interface FeatureServiceProperties extends LoadableMixinProperties, IdentifiableMixinProperties, Partial<Pick<FeatureService, "layerInfos" | "tableInfos" | "url" | "userTypeExtensions">> {}
8
10
 
11
+ export interface FeatureServiceApplyEditsEvent {}
12
+
13
+ export interface FeatureServiceUpdateMomentEvent {}
14
+
15
+ export interface FeatureServiceEvents {}
16
+
9
17
  /**
10
18
  * This class contains metadata about the feature service.
11
19
  * The class can be constructed via a url to a feature service or
@@ -14,6 +22,12 @@ export interface FeatureServiceProperties extends LoadableMixinProperties, Ident
14
22
  * @since 4.28
15
23
  */
16
24
  export default class FeatureService extends FeatureServiceSuperclass {
25
+ /**
26
+ * @deprecated
27
+ * Do not directly reference this property.
28
+ * Use EventNames and EventTypes helpers from \@arcgis/core/Evented
29
+ */
30
+ "@eventTypes": FeatureServiceEvents;
17
31
  /**
18
32
  * @example
19
33
  * // Create a FeatureService from a url
@@ -59,6 +73,34 @@ export default class FeatureService extends FeatureServiceSuperclass {
59
73
  get utilityNetworkUrl(): string | null;
60
74
  /** The url to the version management service, if the data is versioned. */
61
75
  get versionManagementServiceUrl(): string | null;
76
+ /**
77
+ * Adds edit operation results to the feature service and emits the corresponding edit operation event.
78
+ *
79
+ * @param serviceEditResults - Results to associate with the edit operation.
80
+ * @param versionIdentifier - Identifier of the branch version associated with the edit operation.
81
+ * @example
82
+ * ```ts
83
+ * const serviceEditResults = await featureService.applyEdits([
84
+ * {
85
+ * id: 0,
86
+ * identifierFields: { objectIdField: "OBJECTID" },
87
+ * addFeatures: [graphic],
88
+ * },
89
+ * ]);
90
+ *
91
+ * featureService.addEditOperation(serviceEditResults);
92
+ * ```
93
+ * @example
94
+ * ```ts
95
+ * const versionIdentifier: VersionIdentifier = {
96
+ * name: "user.version",
97
+ * guid: "{6F5C18F2-6A3E-4C65-9C8D-538CF93D3D0D}",
98
+ * };
99
+ *
100
+ * featureService.addEditOperation(serviceEditResults, versionIdentifier);
101
+ * ```
102
+ */
103
+ addEditOperation(serviceEditResults: ServiceEditsResult[], versionIdentifier?: VersionIdentifier): void;
62
104
  /**
63
105
  * Applies edits to features in the feature service layers. New features can be created and existing features can be updated or deleted. Feature geometries and/or attributes may be modified.
64
106
  * Only applicable to layers in a [feature service](https://developers.arcgis.com/rest/services-reference/feature-service.htm).
@@ -191,6 +233,37 @@ export default class FeatureService extends FeatureServiceSuperclass {
191
233
  * @returns Resolves when the Feature Service is [loaded](https://developers.arcgis.com/javascript/latest/references/core/rest/featureService/FeatureService/#loaded).
192
234
  */
193
235
  fetchAllLayersAndTables(options?: AbortOptions | null | undefined): Promise<ServiceContents>;
236
+ /**
237
+ * Returns the current edit moment for a branch version.
238
+ *
239
+ * @param versionIdentifier - Identifier of the branch version.
240
+ * @returns The current edit moment for the specified version, or `null` if unavailable.
241
+ * @example
242
+ * ```ts
243
+ * const versionIdentifier: VersionIdentifier = {
244
+ * name: "user.version",
245
+ * guid: "{6F5C18F2-6A3E-4C65-9C8D-538CF93D3D0D}",
246
+ * };
247
+ *
248
+ * const moment = featureService.getMoment(versionIdentifier);
249
+ *
250
+ * if (moment) {
251
+ * console.log(moment.toISOString());
252
+ * }
253
+ * ```
254
+ */
255
+ getMoment(versionIdentifier: VersionIdentifier): Date | null | undefined;
256
+ /**
257
+ * Returns the current edit session ID.
258
+ *
259
+ * @returns The current edit session ID.
260
+ * @example
261
+ * ```ts
262
+ * const sessionId = featureService.getSessionId();
263
+ * console.log(sessionId);
264
+ * ```
265
+ */
266
+ getSessionId(): string;
194
267
  /**
195
268
  * Triggers the loading of the feature service instance.
196
269
  *
@@ -201,4 +274,4 @@ export default class FeatureService extends FeatureServiceSuperclass {
201
274
  */
202
275
  load(options?: AbortOptions | null | undefined): Promise<this>;
203
276
  }
204
- declare const FeatureServiceSuperclass: typeof Loadable & typeof IdentifiableMixin & typeof JSONSupportMixin
277
+ declare const FeatureServiceSuperclass: typeof Loadable & typeof IdentifiableMixin & typeof JSONSupportMixin & typeof EventedMixin