@cesium/engine 22.0.0 → 22.2.0

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 (152) hide show
  1. package/Build/ThirdParty/Workers/zip-web-worker.js +10 -7
  2. package/Build/Workers/{chunk-AARZSH4V.js → chunk-2JNPWPLE.js} +8 -6
  3. package/Build/Workers/{chunk-M7HRE4QR.js → chunk-2YVTOY5Z.js} +15 -11
  4. package/Build/Workers/{chunk-QSMIHPUM.js → chunk-35J4D6PX.js} +3 -3
  5. package/Build/Workers/{chunk-XQ347YWU.js → chunk-3HUEBDFC.js} +16 -14
  6. package/Build/Workers/chunk-3JB2X2PR.js +2058 -0
  7. package/Build/Workers/{chunk-N52ZRKUE.js → chunk-4I7BCCNU.js} +6 -6
  8. package/Build/Workers/{chunk-NE5JTQJP.js → chunk-4MCPC4TE.js} +10 -8
  9. package/Build/Workers/{chunk-SZN34LQ5.js → chunk-4ZQN7M7E.js} +10 -10
  10. package/Build/Workers/{chunk-AOM3FHBN.js → chunk-64PJ4MTB.js} +69 -7
  11. package/Build/Workers/{chunk-LEFQBK6H.js → chunk-72LZ3FN6.js} +14 -12
  12. package/Build/Workers/{chunk-3GL53OCU.js → chunk-7CDQUIP5.js} +276 -2277
  13. package/Build/Workers/{chunk-ECHAJNQJ.js → chunk-7MGTX4WP.js} +12 -12
  14. package/Build/Workers/{chunk-5B7VZQZY.js → chunk-7OPRTZBT.js} +9 -7
  15. package/Build/Workers/{chunk-A4DPJIWS.js → chunk-A3NUMZBG.js} +8 -6
  16. package/Build/Workers/{chunk-FA3SCJDX.js → chunk-AMWXJ5A7.js} +2 -2
  17. package/Build/Workers/{chunk-NGKF5NTR.js → chunk-BKYJBTHW.js} +13 -5
  18. package/Build/Workers/{chunk-QCMRUVVF.js → chunk-C35SJ4QP.js} +15 -13
  19. package/Build/Workers/{chunk-LWJXCI3F.js → chunk-C6FTHSJA.js} +8 -6
  20. package/Build/Workers/{chunk-2D3GLFZD.js → chunk-CQCEPC6N.js} +15 -13
  21. package/Build/Workers/{chunk-KGLDJRSO.js → chunk-DCR62BCO.js} +19 -13
  22. package/Build/Workers/{chunk-KUB64XW6.js → chunk-DIJ7IG5D.js} +12 -10
  23. package/Build/Workers/{chunk-NHZNMTIR.js → chunk-ED4UXMYY.js} +5 -5
  24. package/Build/Workers/{chunk-JZFU2LEM.js → chunk-FM5XPC2E.js} +4 -4
  25. package/Build/Workers/chunk-FPRM6PCE.js +1460 -0
  26. package/Build/Workers/{chunk-34YXP222.js → chunk-G6WQA27G.js} +5 -5
  27. package/Build/Workers/{chunk-5ZF53EY6.js → chunk-GMHDOQPH.js} +4 -4
  28. package/Build/Workers/{chunk-MXHRZHDF.js → chunk-I45CATZK.js} +16 -36
  29. package/Build/Workers/{chunk-OUBBMEWX.js → chunk-I4D5IP46.js} +9 -7
  30. package/Build/Workers/{chunk-A6JAFSZT.js → chunk-IVN5HSOI.js} +8 -6
  31. package/Build/Workers/{chunk-RCCYW6E7.js → chunk-IWOSJVFQ.js} +19 -15
  32. package/Build/Workers/{chunk-JDJAPBZP.js → chunk-JERDRSEI.js} +1 -1
  33. package/Build/Workers/{chunk-H7B7FU2U.js → chunk-JFN2DQHY.js} +5 -5
  34. package/Build/Workers/chunk-JONWM4IO.js +55 -0
  35. package/Build/Workers/{chunk-EJO3NKMS.js → chunk-JUOSYFXT.js} +1 -1
  36. package/Build/Workers/{chunk-726NINF5.js → chunk-K64RQCRK.js} +20 -18
  37. package/Build/Workers/{chunk-L7U26FFD.js → chunk-K6BXEBAF.js} +20 -18
  38. package/Build/Workers/{chunk-YLXWC7OW.js → chunk-L2FSBEW2.js} +7 -5
  39. package/Build/Workers/{chunk-OE22564R.js → chunk-LDSQMLRC.js} +3 -3
  40. package/Build/Workers/{chunk-U7CX3HHE.js → chunk-MSTAVM2N.js} +15 -11
  41. package/Build/Workers/{chunk-IGX772ZQ.js → chunk-MWGB6DLR.js} +1 -1
  42. package/Build/Workers/{chunk-5T5SY63I.js → chunk-N5MNKWED.js} +2 -2
  43. package/Build/Workers/{chunk-XPVZWY4A.js → chunk-NY3CWLIZ.js} +12 -8
  44. package/Build/Workers/{chunk-XZO6F23E.js → chunk-O3GWUTWM.js} +1 -1
  45. package/Build/Workers/{chunk-VCVA7BMD.js → chunk-P7ISUYLW.js} +4 -4
  46. package/Build/Workers/{chunk-U4XMLGSR.js → chunk-PMDPP22G.js} +7 -7
  47. package/Build/Workers/{chunk-P2H75UV5.js → chunk-PSHZAHFE.js} +16 -11
  48. package/Build/Workers/{chunk-YLILBDWK.js → chunk-QO6Z5UJE.js} +2 -2
  49. package/Build/Workers/{chunk-EZ7NJXQN.js → chunk-SDUH3N6G.js} +4 -4
  50. package/Build/Workers/{chunk-GYRDA3XK.js → chunk-UBJYWGMV.js} +20 -16
  51. package/Build/Workers/{chunk-7XEJGXX2.js → chunk-V26Y7ZQL.js} +886 -50
  52. package/Build/Workers/{chunk-6HBKE43B.js → chunk-VGH2CSC7.js} +13 -9
  53. package/Build/Workers/{chunk-75HAJIDT.js → chunk-VSZ5DB2W.js} +1 -1
  54. package/Build/Workers/{chunk-W4PIP5PG.js → chunk-WH4HDRGN.js} +2 -2
  55. package/Build/Workers/{chunk-VVZ667H6.js → chunk-XPNY2VY3.js} +2 -2
  56. package/Build/Workers/{chunk-7KAXDKRU.js → chunk-YFEZPDAY.js} +13 -11
  57. package/Build/Workers/{chunk-RQRODXVN.js → chunk-ZGWX2R5I.js} +5 -1424
  58. package/Build/Workers/{chunk-BJSNGGBM.js → chunk-ZUWF63QU.js} +4 -4
  59. package/Build/Workers/combineGeometry.js +24 -21
  60. package/Build/Workers/createBoxGeometry.js +18 -15
  61. package/Build/Workers/createBoxOutlineGeometry.js +16 -13
  62. package/Build/Workers/createCircleGeometry.js +28 -24
  63. package/Build/Workers/createCircleOutlineGeometry.js +21 -17
  64. package/Build/Workers/createCoplanarPolygonGeometry.js +35 -31
  65. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +33 -29
  66. package/Build/Workers/createCorridorGeometry.js +32 -28
  67. package/Build/Workers/createCorridorOutlineGeometry.js +30 -26
  68. package/Build/Workers/createCylinderGeometry.js +20 -17
  69. package/Build/Workers/createCylinderOutlineGeometry.js +20 -16
  70. package/Build/Workers/createEllipseGeometry.js +28 -24
  71. package/Build/Workers/createEllipseOutlineGeometry.js +21 -17
  72. package/Build/Workers/createEllipsoidGeometry.js +19 -16
  73. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -15
  74. package/Build/Workers/createFrustumGeometry.js +18 -15
  75. package/Build/Workers/createFrustumOutlineGeometry.js +18 -15
  76. package/Build/Workers/createGeometry.js +25 -21
  77. package/Build/Workers/createGroundPolylineGeometry.js +25 -21
  78. package/Build/Workers/createPlaneGeometry.js +16 -13
  79. package/Build/Workers/createPlaneOutlineGeometry.js +15 -12
  80. package/Build/Workers/createPolygonGeometry.js +35 -31
  81. package/Build/Workers/createPolygonOutlineGeometry.js +32 -28
  82. package/Build/Workers/createPolylineGeometry.js +27 -23
  83. package/Build/Workers/createPolylineVolumeGeometry.js +33 -29
  84. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +29 -25
  85. package/Build/Workers/createRectangleGeometry.js +30 -26
  86. package/Build/Workers/createRectangleOutlineGeometry.js +23 -19
  87. package/Build/Workers/createSimplePolylineGeometry.js +25 -21
  88. package/Build/Workers/createSphereGeometry.js +19 -16
  89. package/Build/Workers/createSphereOutlineGeometry.js +18 -15
  90. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  91. package/Build/Workers/createVectorTileClampedPolylines.js +16 -13
  92. package/Build/Workers/createVectorTileGeometries.js +24 -21
  93. package/Build/Workers/createVectorTilePoints.js +15 -12
  94. package/Build/Workers/createVectorTilePolygons.js +24 -20
  95. package/Build/Workers/createVectorTilePolylines.js +16 -13
  96. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -22
  97. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +26 -21
  98. package/Build/Workers/createVerticesFromHeightmap.js +26 -21
  99. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +24 -19
  100. package/Build/Workers/createWallGeometry.js +26 -22
  101. package/Build/Workers/createWallOutlineGeometry.js +25 -21
  102. package/Build/Workers/decodeDraco.js +10 -10
  103. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  104. package/Build/Workers/decodeI3S.js +13 -11
  105. package/Build/Workers/gaussianSplatSorter.js +4 -4
  106. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  107. package/Build/Workers/incrementallyBuildTerrainPicker.js +121 -0
  108. package/Build/Workers/transcodeKTX2.js +6 -6
  109. package/Build/Workers/transferTypedArrayTest.js +1 -1
  110. package/Build/Workers/upsampleQuantizedTerrainMesh.js +24 -20
  111. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -22
  112. package/Source/Core/AxisAlignedBoundingBox.js +36 -0
  113. package/Source/Core/Cesium3DTilesTerrainData.js +2 -0
  114. package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +2 -0
  115. package/Source/Core/GoogleEarthEnterpriseTerrainData.js +1 -0
  116. package/Source/Core/HeightmapTerrainData.js +2 -0
  117. package/Source/Core/IntersectionTests.js +80 -0
  118. package/Source/Core/Ion.js +1 -1
  119. package/Source/Core/QuantizedMeshTerrainData.js +1 -0
  120. package/Source/Core/TerrainMesh.js +207 -0
  121. package/Source/Core/TerrainPicker.js +607 -0
  122. package/Source/Core/TexturePacker.js +27 -12
  123. package/Source/Core/Transforms.js +28 -19
  124. package/Source/DataSources/BillboardGraphics.js +1 -1
  125. package/Source/DataSources/BillboardVisualizer.js +7 -4
  126. package/Source/Renderer/Buffer.js +32 -0
  127. package/Source/Renderer/BufferUsage.js +3 -1
  128. package/Source/Renderer/Context.js +85 -7
  129. package/Source/Renderer/Sync.js +104 -0
  130. package/Source/Renderer/TextureAtlas.js +75 -44
  131. package/Source/Scene/ArcGisMapService.js +1 -1
  132. package/Source/Scene/Azure2DImageryProvider.js +103 -20
  133. package/Source/Scene/Billboard.js +75 -28
  134. package/Source/Scene/BillboardCollection.js +21 -2
  135. package/Source/Scene/BillboardTexture.js +56 -7
  136. package/Source/Scene/Globe.js +3 -1
  137. package/Source/Scene/GlobeSurfaceTile.js +18 -66
  138. package/Source/Scene/GlobeSurfaceTileProvider.js +11 -0
  139. package/Source/Scene/Google2DImageryProvider.js +10 -15
  140. package/Source/Scene/LabelCollection.js +1 -0
  141. package/Source/Scene/PickFramebuffer.js +124 -36
  142. package/Source/Scene/Picking.js +99 -17
  143. package/Source/Scene/Scene.js +36 -4
  144. package/Source/Scene/TerrainFillMesh.js +1 -0
  145. package/Source/Shaders/BillboardCollectionFS.glsl +22 -9
  146. package/Source/Shaders/BillboardCollectionFS.js +22 -9
  147. package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
  148. package/Source/ThirdParty/zip-module.wasm +0 -0
  149. package/Source/Workers/incrementallyBuildTerrainPicker.js +108 -0
  150. package/index.d.ts +204 -4
  151. package/index.js +65 -63
  152. package/package.json +4 -4
@@ -1 +1 @@
1
- !function(){"use strict";const{Array:e,Object:t,Number:n,Math:s,Error:r,Uint8Array:i,Uint16Array:a,Uint32Array:o,Int32Array:c,Map:l,DataView:u,Promise:h,TextEncoder:f,crypto:p,postMessage:d,TransformStream:w,ReadableStream:g,WritableStream:m,CompressionStream:_,DecompressionStream:y}=self,b=void 0,S="undefined",z="function",k=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;k[e]=t}class v{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let n=0,s=0|e.length;s>n;n++)t=t>>>8^k[255&(t^e[n])];this.crc=t}get(){return~this.crc}}class H extends w{constructor(){let e;const t=new v;super({transform(e,n){t.append(e),n.enqueue(e)},flush(){const n=new i(4);new u(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}const C={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],s=C.getPartial(n);return 32===s?e.concat(t):C._shiftRight(t,s,0|n,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+C.getPartial(n)},clamp(e,t){if(32*e.length<t)return e;const n=(e=e.slice(0,s.ceil(t/32))).length;return t&=31,n>0&&t&&(e[n-1]=C.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,getPartial:e=>s.round(e/1099511627776)||32,_shiftRight(e,t,n,s){for(void 0===s&&(s=[]);t>=32;t-=32)s.push(n),n=0;if(0===t)return s.concat(e);for(let r=0;r<e.length;r++)s.push(n|e[r]>>>t),n=e[r]<<32-t;const r=e.length?e[e.length-1]:0,i=C.getPartial(r);return s.push(C.partial(t+i&31,t+i>32?n:s.pop(),1)),s}},B={bytes:{fromBits(e){const t=C.bitLength(e)/8,n=new i(t);let s;for(let r=0;t>r;r++)3&r||(s=e[r/4]),n[r]=s>>>24,s<<=8;return n},toBits(e){const t=[];let n,s=0;for(n=0;n<e.length;n++)s=s<<8|e[n],3&~n||(t.push(s),s=0);return 3&n&&t.push(C.partial(8*(3&n),s)),t}}},A=class{constructor(e){const t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],e?(t._h=e._h.slice(0),t._buffer=e._buffer.slice(0),t._length=e._length):t.reset()}reset(){const e=this;return e._h=e._init.slice(0),e._buffer=[],e._length=0,e}update(e){const t=this;"string"==typeof e&&(e=B.utf8String.toBits(e));const n=t._buffer=C.concat(t._buffer,e),s=t._length,i=t._length=s+C.bitLength(e);if(i>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const a=new o(n);let c=0;for(let e=t.blockSize+s-(t.blockSize+s&t.blockSize-1);i>=e;e+=t.blockSize)t._block(a.subarray(16*c,16*(c+1))),c+=1;return n.splice(0,16*c),t}finalize(){const e=this;let t=e._buffer;const n=e._h;t=C.concat(t,[C.partial(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(s.floor(e._length/4294967296)),t.push(0|e._length);t.length;)e._block(t.splice(0,16));return e.reset(),n}_f(e,t,n,s){return e>19?e>39?e>59?e>79?void 0:t^n^s:t&n|t&s|n&s:t^n^s:t&n|~t&s}_S(e,t){return t<<e|t>>>32-e}_block(t){const n=this,r=n._h,i=e(80);for(let e=0;16>e;e++)i[e]=t[e];let a=r[0],o=r[1],c=r[2],l=r[3],u=r[4];for(let e=0;79>=e;e++){16>e||(i[e]=n._S(1,i[e-3]^i[e-8]^i[e-14]^i[e-16]));const t=n._S(5,a)+n._f(e,o,c,l)+u+i[e]+n._key[s.floor(e/20)]|0;u=l,l=c,c=n._S(30,o),o=a,a=t}r[0]=r[0]+a|0,r[1]=r[1]+o|0,r[2]=r[2]+c|0,r[3]=r[3]+l|0,r[4]=r[4]+u|0}},R={getRandomValues(e){const t=new o(e.buffer),n=e=>{let t=987654321;const n=4294967295;return()=>(t=36969*(65535&t)+(t>>16)&n,(((t<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,i=0;i<e.length;i+=4){const e=n(4294967296*(r||s.random()));r=987654071*e(),t[i/4]=4294967296*e()|0}return e}},I={importKey:e=>new I.hmacSha1(B.bytes.toBits(e)),pbkdf2(e,t,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const i=1+(s>>5)<<2;let a,o,c,l,h;const f=new ArrayBuffer(i),p=new u(f);let d=0;const w=C;for(t=B.bytes.toBits(t),h=1;(i||1)>d;h++){for(a=o=e.encrypt(w.concat(t,[h])),c=1;n>c;c++)for(o=e.encrypt(o),l=0;l<o.length;l++)a[l]^=o[l];for(c=0;(i||1)>d&&c<a.length;c++)p.setInt32(d,a[c]),d+=4}return f.slice(0,s/8)},hmacSha1:class{constructor(e){const t=this,n=t._hash=A,s=[[],[]];t._baseHash=[new n,new n];const r=t._baseHash[0].blockSize/32;e.length>r&&(e=(new n).update(e).finalize());for(let t=0;r>t;t++)s[0][t]=909522486^e[t],s[1][t]=1549556828^e[t];t._baseHash[0].update(s[0]),t._baseHash[1].update(s[1]),t._resultHash=new n(t._baseHash[0])}reset(){const e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){this._updated=!0,this._resultHash.update(e)}digest(){const e=this,t=e._resultHash.finalize(),n=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),n}encrypt(e){if(this._updated)throw new r("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}}},q=typeof p!=S&&typeof p.getRandomValues==z,K="Invalid password",P="Invalid signature",T="zipjs-abort-check-password";function V(e){return q?p.getRandomValues(e):R.getRandomValues(e)}const x=16,U={name:"PBKDF2"},W=t.assign({hash:{name:"HMAC"}},U),M=t.assign({iterations:1e3,hash:{name:"SHA-1"}},U),E=["deriveBits"],D=[8,12,16],L=[16,24,32],Z=10,F=[0,0,0,0],N=typeof p!=S,O=N&&p.subtle,j=N&&typeof O!=S,G=B.bytes,X=class{constructor(e){const t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();const n=t._tables[0][4],s=t._tables[1],i=e.length;let a,o,c,l=1;if(4!==i&&6!==i&&8!==i)throw new r("invalid aes key size");for(t._key=[o=e.slice(0),c=[]],a=i;4*i+28>a;a++){let e=o[a-1];(a%i===0||8===i&&a%i===4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[255&e],a%i===0&&(e=e<<8^e>>>24^l<<24,l=l<<1^283*(l>>7))),o[a]=o[a-i]^e}for(let e=0;a;e++,a--){const t=o[3&e?a:a-4];c[e]=4>=a||4>e?t:s[0][n[t>>>24]]^s[1][n[t>>16&255]]^s[2][n[t>>8&255]]^s[3][n[255&t]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){const e=this._tables[0],t=this._tables[1],n=e[4],s=t[4],r=[],i=[];let a,o,c,l;for(let e=0;256>e;e++)i[(r[e]=e<<1^283*(e>>7))^e]=e;for(let u=a=0;!n[u];u^=o||1,a=i[a]||1){let i=a^a<<1^a<<2^a<<3^a<<4;i=i>>8^255&i^99,n[u]=i,s[i]=u,l=r[c=r[o=r[u]]];let h=16843009*l^65537*c^257*o^16843008*u,f=257*r[i]^16843008*i;for(let n=0;4>n;n++)e[n][u]=f=f<<24^f>>>8,t[n][i]=h=h<<24^h>>>8}for(let n=0;5>n;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}_crypt(e,t){if(4!==e.length)throw new r("invalid aes block size");const n=this._key[t],s=n.length/4-2,i=[0,0,0,0],a=this._tables[t],o=a[0],c=a[1],l=a[2],u=a[3],h=a[4];let f,p,d,w=e[0]^n[0],g=e[t?3:1]^n[1],m=e[2]^n[2],_=e[t?1:3]^n[3],y=4;for(let e=0;s>e;e++)f=o[w>>>24]^c[g>>16&255]^l[m>>8&255]^u[255&_]^n[y],p=o[g>>>24]^c[m>>16&255]^l[_>>8&255]^u[255&w]^n[y+1],d=o[m>>>24]^c[_>>16&255]^l[w>>8&255]^u[255&g]^n[y+2],_=o[_>>>24]^c[w>>16&255]^l[g>>8&255]^u[255&m]^n[y+3],y+=4,w=f,g=p,m=d;for(let e=0;4>e;e++)i[t?3&-e:e]=h[w>>>24]<<24^h[g>>16&255]<<16^h[m>>8&255]<<8^h[255&_]^n[y++],f=w,w=g,g=m,m=_,_=f;return i}},J=class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if(255&~(e>>24))e+=1<<24;else{let t=e>>16&255,n=e>>8&255,s=255&e;255===t?(t=0,255===n?(n=0,255===s?s=0:++s):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=s}return e}incCounter(e){0===(e[0]=this.incWord(e[0]))&&(e[1]=this.incWord(e[1]))}calculate(e,t,n){let s;if(!(s=t.length))return[];const r=C.bitLength(t);for(let r=0;s>r;r+=4){this.incCounter(n);const s=e.encrypt(n);t[r]^=s[0],t[r+1]^=s[1],t[r+2]^=s[2],t[r+3]^=s[3]}return C.clamp(t,r)}},Q=I.hmacSha1;let Y=N&&j&&typeof O.importKey==z,$=N&&j&&typeof O.deriveBits==z;class ee extends w{constructor({password:e,rawPassword:n,signed:s,encryptionStrength:a,checkPasswordOnly:o}){super({start(){t.assign(this,{ready:new h(e=>this.resolveReady=e),password:re(e,n),signed:s,strength:a-1,pending:new i})},async transform(e,t){const n=this,{password:s,strength:a,resolveReady:c,ready:l}=n;s?(await(async(e,t,n,s)=>{const i=await se(e,t,n,ae(s,0,D[t])),a=ae(s,D[t]);if(i[0]!=a[0]||i[1]!=a[1])throw new r(K)})(n,a,s,ae(e,0,D[a]+2)),e=ae(e,D[a]+2),o?t.error(new r(T)):c()):await l;const u=new i(e.length-Z-(e.length-Z)%x);t.enqueue(ne(n,e,u,0,Z,!0))},async flush(e){const{signed:t,ctr:n,hmac:s,pending:a,ready:o}=this;if(s&&n){await o;const c=ae(a,0,a.length-Z),l=ae(a,a.length-Z);let u=new i;if(c.length){const e=ce(G,c);s.update(e);const t=n.update(e);u=oe(G,t)}if(t){const e=ae(oe(G,s.digest()),0,Z);for(let t=0;Z>t;t++)if(e[t]!=l[t])throw new r(P)}e.enqueue(u)}}})}}class te extends w{constructor({password:e,rawPassword:n,encryptionStrength:s}){let r;super({start(){t.assign(this,{ready:new h(e=>this.resolveReady=e),password:re(e,n),strength:s-1,pending:new i})},async transform(e,t){const n=this,{password:s,strength:r,resolveReady:a,ready:o}=n;let c=new i;s?(c=await(async(e,t,n)=>{const s=V(new i(D[t]));return ie(s,await se(e,t,n,s))})(n,r,s),a()):await o;const l=new i(c.length+e.length-e.length%x);l.set(c,0),t.enqueue(ne(n,e,l,c.length,0))},async flush(e){const{ctr:t,hmac:n,pending:s,ready:a}=this;if(n&&t){await a;let o=new i;if(s.length){const e=t.update(ce(G,s));n.update(e),o=oe(G,e)}r.signature=oe(G,n.digest()).slice(0,Z),e.enqueue(ie(o,r.signature))}}}),r=this}}function ne(e,t,n,s,r,a){const{ctr:o,hmac:c,pending:l}=e,u=t.length-r;let h;for(l.length&&(t=ie(l,t),n=((e,t)=>{if(t&&t>e.length){const n=e;(e=new i(t)).set(n,0)}return e})(n,u-u%x)),h=0;u-x>=h;h+=x){const e=ce(G,ae(t,h,h+x));a&&c.update(e);const r=o.update(e);a||c.update(r),n.set(oe(G,r),h+s)}return e.pending=ae(t,h),n}async function se(n,s,r,a){n.password=null;const o=await(async(e,t,n,s,r)=>{if(!Y)return I.importKey(t);try{return await O.importKey("raw",t,n,!1,r)}catch{return Y=!1,I.importKey(t)}})(0,r,W,0,E),c=await(async(e,t,n)=>{if(!$)return I.pbkdf2(t,e.salt,M.iterations,n);try{return await O.deriveBits(e,t,n)}catch{return $=!1,I.pbkdf2(t,e.salt,M.iterations,n)}})(t.assign({salt:a},M),o,8*(2*L[s]+2)),l=new i(c),u=ce(G,ae(l,0,L[s])),h=ce(G,ae(l,L[s],2*L[s])),f=ae(l,2*L[s]);return t.assign(n,{keys:{key:u,authentication:h,passwordVerification:f},ctr:new J(new X(u),e.from(F)),hmac:new Q(h)}),f}function re(e,t){return t===b?(e=>{if(typeof f==S){const t=new i((e=unescape(encodeURIComponent(e))).length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}return(new f).encode(e)})(e):t}function ie(e,t){let n=e;return e.length+t.length&&(n=new i(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function ae(e,t,n){return e.subarray(t,n)}function oe(e,t){return e.fromBits(t)}function ce(e,t){return e.toBits(t)}class le extends w{constructor({password:e,passwordVerification:n,checkPasswordOnly:s}){super({start(){t.assign(this,{password:e,passwordVerification:n}),pe(this,e)},transform(e,t){const n=this;if(n.password){const t=he(n,e.subarray(0,12));if(n.password=null,t.at(-1)!=n.passwordVerification)throw new r(K);e=e.subarray(12)}s?t.error(new r(T)):t.enqueue(he(n,e))}})}}class ue extends w{constructor({password:e,passwordVerification:n}){super({start(){t.assign(this,{password:e,passwordVerification:n}),pe(this,e)},transform(e,t){const n=this;let s,r;if(n.password){n.password=null;const t=V(new i(12));t[11]=n.passwordVerification,s=new i(e.length+t.length),s.set(fe(n,t),0),r=12}else s=new i(e.length),r=0;s.set(fe(n,e),r),t.enqueue(s)}})}}function he(e,t){const n=new i(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],de(e,n[s]);return n}function fe(e,t){const n=new i(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],de(e,t[s]);return n}function pe(e,n){const s=[305419896,591751049,878082192];t.assign(e,{keys:s,crcKey0:new v(s[0]),crcKey2:new v(s[2])});for(let t=0;t<n.length;t++)de(e,n.charCodeAt(t))}function de(e,t){let[n,r,i]=e.keys;e.crcKey0.append([t]),n=~e.crcKey0.get(),r=me(s.imul(me(r+ge(n)),134775813)+1),e.crcKey2.append([r>>>24]),i=~e.crcKey2.get(),e.keys=[n,r,i]}function we(e){const t=2|e.keys[2];return ge(s.imul(t,1^t)>>>8)}function ge(e){return 255&e}function me(e){return 4294967295&e}class _e extends w{constructor(e,{chunkSize:t,CompressionStreamZlib:n,CompressionStream:s}){super({});const{compressed:r,encrypted:i,useCompressionStream:a,zipCrypto:o,signed:c,level:l}=e,h=this;let f,p,d=super.readable;i&&!o||!c||(f=new H,d=ze(d,f)),r&&(d=Se(d,a,{level:l,chunkSize:t},s,n,s)),i&&(o?d=ze(d,new ue(e)):(p=new te(e),d=ze(d,p))),be(h,d,()=>{let e;i&&!o&&(e=p.signature),i&&!o||!c||(e=new u(f.value.buffer).getUint32(0)),h.signature=e})}}class ye extends w{constructor(e,{chunkSize:t,DecompressionStreamZlib:n,DecompressionStream:s}){super({});const{zipCrypto:i,encrypted:a,signed:o,signature:c,compressed:l,useCompressionStream:h,deflate64:f}=e;let p,d,w=super.readable;a&&(i?w=ze(w,new le(e)):(d=new ee(e),w=ze(w,d))),l&&(w=Se(w,h,{chunkSize:t,deflate64:f},s,n,s)),a&&!i||!o||(p=new H,w=ze(w,p)),be(this,w,()=>{if((!a||i)&&o){const e=new u(p.value.buffer);if(c!=e.getUint32(0,!1))throw new r(P)}})}}function be(e,n,s){n=ze(n,new w({flush:s})),t.defineProperty(e,"readable",{get:()=>n})}function Se(e,t,n,s,r,i){const a=t&&s?s:r||i,o=n.deflate64?"deflate64-raw":"deflate-raw";try{e=ze(e,new a(o,n))}catch(s){if(!t)throw s;if(r)e=ze(e,new r(o,n));else{if(!i)throw s;e=ze(e,new i(o,n))}}return e}function ze(e,t){return e.pipeThrough(t)}const ke="data",ve="close";class He extends w{constructor(e,n){super({});const s=this,{codecType:i}=e;let a;i.startsWith("deflate")?a=_e:i.startsWith("inflate")&&(a=ye),s.outputSize=0;let o=0;const c=new a(e,n),l=super.readable,u=new w({transform(e,t){e&&e.length&&(o+=e.length,t.enqueue(e))},flush(){t.assign(s,{inputSize:o})}}),h=new w({transform(t,n){if(t&&t.length&&(n.enqueue(t),s.outputSize+=t.length,e.outputSize!==b&&s.outputSize>e.outputSize))throw new r("Invalid uncompressed size")},flush(){const{signature:e}=c;t.assign(s,{signature:e,inputSize:o})}});t.defineProperty(s,"readable",{get:()=>l.pipeThrough(u).pipeThrough(c).pipeThrough(h)})}}class Ce extends w{constructor(e){let t;super({transform:function n(s,r){if(t){const e=new i(t.length+s.length);e.set(t),e.set(s,t.length),s=e,t=null}s.length>e?(r.enqueue(s.slice(0,e)),n(s.slice(e),r)):t=s},flush(e){t&&t.length&&e.enqueue(t)}})}}const Be=new l,Ae=new l;let Re,Ie,qe,Ke,Pe,Te=0;async function Ve(e){try{const{options:t,config:s}=e;if(!t.useCompressionStream)try{await self.initModule(e.config)}catch{t.useCompressionStream=!0}s.CompressionStream=self.CompressionStream,s.DecompressionStream=self.DecompressionStream;const r={highWaterMark:1},i=e.readable||new g({async pull(e){const t=new h(e=>Be.set(Te,e));xe({type:"pull",messageId:Te}),Te=(Te+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await t;e.enqueue(s),r&&e.close()}},r),a=e.writable||new m({async write(e){let t;const s=new h(e=>t=e);Ae.set(Te,t),xe({type:ke,value:e,messageId:Te}),Te=(Te+1)%n.MAX_SAFE_INTEGER,await s}},r),o=new He(t,s);Re=new AbortController;const{signal:c}=Re;await i.pipeThrough(o).pipeThrough(new Ce(s.chunkSize)).pipeTo(a,{signal:c,preventClose:!0,preventAbort:!0}),await a.getWriter().close();const{signature:l,inputSize:u,outputSize:f}=o;xe({type:ve,result:{signature:l,inputSize:u,outputSize:f}})}catch(e){e.outputSize=0,Ue(e)}}function xe(e){let{value:t}=e;if(t)if(t.length)try{t=new i(t),e.value=t.buffer,d(e,[e.value])}catch{d(e)}else d(e);else d(e)}function Ue(e=new r("Unknown error")){const{message:t,stack:n,code:s,name:i,outputSize:a}=e;d({error:{message:t,stack:n,code:s,name:i,outputSize:a}})}function We(e,t,n={}){const a="number"==typeof n.level?n.level:-1,o="number"==typeof n.outBuffer?n.outBuffer:65536,c="number"==typeof n.inBufferSize?n.inBufferSize:65536;return new w({start(){let n;if(this.out=qe(o),this.in=qe(c),this.inBufferSize=c,this._scratch=new i(o),e?(this._process=Ie.deflate_process,this._last_consumed=Ie.deflate_last_consumed,this._end=Ie.deflate_end,this.streamHandle=Ie.deflate_new(),n="gzip"===t?Ie.deflate_init_gzip(this.streamHandle,a):"deflate-raw"===t?Ie.deflate_init_raw(this.streamHandle,a):Ie.deflate_init(this.streamHandle,a)):"deflate64-raw"===t?(this._process=Ie.inflate9_process,this._last_consumed=Ie.inflate9_last_consumed,this._end=Ie.inflate9_end,this.streamHandle=Ie.inflate9_new(),n=Ie.inflate9_init_raw(this.streamHandle)):(this._process=Ie.inflate_process,this._last_consumed=Ie.inflate_last_consumed,this._end=Ie.inflate_end,this.streamHandle=Ie.inflate_new(),n="deflate-raw"===t?Ie.inflate_init_raw(this.streamHandle):"gzip"===t?Ie.inflate_init_gzip(this.streamHandle):Ie.inflate_init(this.streamHandle)),0!==n)throw new r("init failed:"+n)},transform(t,n){try{const a=t,c=new i(Pe.buffer),l=this._process,u=this._last_consumed,h=this.out,f=this._scratch;let p=0;for(;p<a.length;){const t=s.min(a.length-p,32768);this.in&&this.inBufferSize>=t||(this.in&&Ke&&Ke(this.in),this.in=qe(t),this.inBufferSize=t),c.set(a.subarray(p,p+t),this.in);const i=l(this.streamHandle,this.in,t,h,o,0);if(!e&&0>i)throw new r("process error:"+i);const d=16777215&i;d&&(f.set(c.subarray(h,h+d),0),n.enqueue(f.slice(0,d)));const w=u(this.streamHandle);if(0===w)break;p+=w}}catch(e){this._end&&this.streamHandle&&this._end(this.streamHandle),this.in&&Ke&&Ke(this.in),this.out&&Ke&&Ke(this.out),n.error(e)}},flush(t){try{const n=new i(Pe.buffer),s=this._process,a=this.out,c=this._scratch;for(;;){const i=s(this.streamHandle,0,0,a,o,4);if(!e&&0>i)throw new r("process error:"+i);const l=16777215&i,u=i>>24&255;if(l&&(c.set(n.subarray(a,a+l),0),t.enqueue(c.slice(0,l))),1===u||0===l)break}}catch(e){t.error(e)}finally{if(this._end&&this.streamHandle){const e=this._end(this.streamHandle);0!==e&&t.error(new r("end error:"+e))}this.in&&Ke&&Ke(this.in),this.out&&Ke&&Ke(this.out)}}})}addEventListener("message",({data:e})=>{const{type:t,messageId:n,value:s,done:r}=e;try{if("start"==t&&Ve(e),t==ke){const e=Be.get(n);Be.delete(n),e({value:new i(s),done:r})}if("ack"==t){const e=Ae.get(n);Ae.delete(n),e()}t==ve&&Re.abort()}catch(e){Ue(e)}});class Me{constructor(e="deflate",t){return We(!0,e,t)}}class Ee{constructor(e="deflate",t){return We(!1,e,t)}}let De=!1;self.initModule=async e=>{try{const t=await(async(e,{baseURI:t})=>{if(!De){let n,s;try{try{s=new URL(e,t)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(t){if(!e.startsWith("data:application/wasm;base64,"))throw t;n=(e=>{const t=e.split(",")[1],n=atob(t),s=n.length,r=new i(s);for(let e=0;s>e;++e)r[e]=n.charCodeAt(e);return r.buffer})(e)}(e=>{if(Ie=e,({malloc:qe,free:Ke,memory:Pe}=Ie),"function"!=typeof qe||"function"!=typeof Ke||!Pe)throw Ie=qe=Ke=Pe=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports),De=!0}})(e.wasmURI,e);return e.CompressionStreamZlib=Me,e.DecompressionStreamZlib=Ee,t}catch{}}}();
1
+ !function(){"use strict";const{Array:e,Object:t,Number:n,Math:s,Error:r,Uint8Array:i,Uint16Array:a,Uint32Array:o,Int32Array:c,Map:l,DataView:u,Promise:h,TextEncoder:f,crypto:p,postMessage:d,TransformStream:w,ReadableStream:g,WritableStream:m,CompressionStream:_,DecompressionStream:y}=self,b=void 0,S="undefined",z="function",k=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;k[e]=t}class v{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let n=0,s=0|e.length;s>n;n++)t=t>>>8^k[255&(t^e[n])];this.crc=t}get(){return~this.crc}}class H extends w{constructor(){let e;const t=new v;super({transform(e,n){t.append(e),n.enqueue(e)},flush(){const n=new i(4);new u(n.buffer).setUint32(0,t.get()),e.value=n}}),e=this}}const C={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],s=C.getPartial(n);return 32===s?e.concat(t):C._shiftRight(t,s,0|n,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+C.getPartial(n)},clamp(e,t){if(32*e.length<t)return e;const n=(e=e.slice(0,s.ceil(t/32))).length;return t&=31,n>0&&t&&(e[n-1]=C.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,getPartial:e=>s.round(e/1099511627776)||32,_shiftRight(e,t,n,s){for(void 0===s&&(s=[]);t>=32;t-=32)s.push(n),n=0;if(0===t)return s.concat(e);for(let r=0;r<e.length;r++)s.push(n|e[r]>>>t),n=e[r]<<32-t;const r=e.length?e[e.length-1]:0,i=C.getPartial(r);return s.push(C.partial(t+i&31,t+i>32?n:s.pop(),1)),s}},B={bytes:{fromBits(e){const t=C.bitLength(e)/8,n=new i(t);let s;for(let r=0;t>r;r++)3&r||(s=e[r/4]),n[r]=s>>>24,s<<=8;return n},toBits(e){const t=[];let n,s=0;for(n=0;n<e.length;n++)s=s<<8|e[n],3&~n||(t.push(s),s=0);return 3&n&&t.push(C.partial(8*(3&n),s)),t}}},A=class{constructor(e){const t=this;t.blockSize=512,t._init=[1732584193,4023233417,2562383102,271733878,3285377520],t._key=[1518500249,1859775393,2400959708,3395469782],e?(t._h=e._h.slice(0),t._buffer=e._buffer.slice(0),t._length=e._length):t.reset()}reset(){const e=this;return e._h=e._init.slice(0),e._buffer=[],e._length=0,e}update(e){const t=this;"string"==typeof e&&(e=B.utf8String.toBits(e));const n=t._buffer=C.concat(t._buffer,e),s=t._length,i=t._length=s+C.bitLength(e);if(i>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const a=new o(n);let c=0;for(let e=t.blockSize+s-(t.blockSize+s&t.blockSize-1);i>=e;e+=t.blockSize)t._block(a.subarray(16*c,16*(c+1))),c+=1;return n.splice(0,16*c),t}finalize(){const e=this;let t=e._buffer;const n=e._h;t=C.concat(t,[C.partial(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(s.floor(e._length/4294967296)),t.push(0|e._length);t.length;)e._block(t.splice(0,16));return e.reset(),n}_f(e,t,n,s){return e>19?e>39?e>59?e>79?void 0:t^n^s:t&n|t&s|n&s:t^n^s:t&n|~t&s}_S(e,t){return t<<e|t>>>32-e}_block(t){const n=this,r=n._h,i=e(80);for(let e=0;16>e;e++)i[e]=t[e];let a=r[0],o=r[1],c=r[2],l=r[3],u=r[4];for(let e=0;79>=e;e++){16>e||(i[e]=n._S(1,i[e-3]^i[e-8]^i[e-14]^i[e-16]));const t=n._S(5,a)+n._f(e,o,c,l)+u+i[e]+n._key[s.floor(e/20)]|0;u=l,l=c,c=n._S(30,o),o=a,a=t}r[0]=r[0]+a|0,r[1]=r[1]+o|0,r[2]=r[2]+c|0,r[3]=r[3]+l|0,r[4]=r[4]+u|0}},R={getRandomValues(e){const t=new o(e.buffer),n=e=>{let t=987654321;const n=4294967295;return()=>(t=36969*(65535&t)+(t>>16)&n,(((t<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,i=0;i<e.length;i+=4){const e=n(4294967296*(r||s.random()));r=987654071*e(),t[i/4]=4294967296*e()|0}return e}},I={importKey:e=>new I.hmacSha1(B.bytes.toBits(e)),pbkdf2(e,t,n,s){if(n=n||1e4,0>s||0>n)throw new r("invalid params to pbkdf2");const i=1+(s>>5)<<2;let a,o,c,l,h;const f=new ArrayBuffer(i),p=new u(f);let d=0;const w=C;for(t=B.bytes.toBits(t),h=1;(i||1)>d;h++){for(a=o=e.encrypt(w.concat(t,[h])),c=1;n>c;c++)for(o=e.encrypt(o),l=0;l<o.length;l++)a[l]^=o[l];for(c=0;(i||1)>d&&c<a.length;c++)p.setInt32(d,a[c]),d+=4}return f.slice(0,s/8)},hmacSha1:class{constructor(e){const t=this,n=t._hash=A,s=[[],[]];t._baseHash=[new n,new n];const r=t._baseHash[0].blockSize/32;e.length>r&&(e=(new n).update(e).finalize());for(let t=0;r>t;t++)s[0][t]=909522486^e[t],s[1][t]=1549556828^e[t];t._baseHash[0].update(s[0]),t._baseHash[1].update(s[1]),t._resultHash=new n(t._baseHash[0])}reset(){const e=this;e._resultHash=new e._hash(e._baseHash[0]),e._updated=!1}update(e){this._updated=!0,this._resultHash.update(e)}digest(){const e=this,t=e._resultHash.finalize(),n=new e._hash(e._baseHash[1]).update(t).finalize();return e.reset(),n}encrypt(e){if(this._updated)throw new r("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}}},q=typeof p!=S&&typeof p.getRandomValues==z,K="Invalid password",P="Invalid signature",T="zipjs-abort-check-password";function V(e){return q?p.getRandomValues(e):R.getRandomValues(e)}const x=16,U={name:"PBKDF2"},W=t.assign({hash:{name:"HMAC"}},U),M=t.assign({iterations:1e3,hash:{name:"SHA-1"}},U),E=["deriveBits"],D=[8,12,16],L=[16,24,32],Z=10,F=[0,0,0,0],N=typeof p!=S,O=N&&p.subtle,j=N&&typeof O!=S,G=B.bytes,X=class{constructor(e){const t=this;t._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],t._tables[0][0][0]||t._precompute();const n=t._tables[0][4],s=t._tables[1],i=e.length;let a,o,c,l=1;if(4!==i&&6!==i&&8!==i)throw new r("invalid aes key size");for(t._key=[o=e.slice(0),c=[]],a=i;4*i+28>a;a++){let e=o[a-1];(a%i===0||8===i&&a%i===4)&&(e=n[e>>>24]<<24^n[e>>16&255]<<16^n[e>>8&255]<<8^n[255&e],a%i===0&&(e=e<<8^e>>>24^l<<24,l=l<<1^283*(l>>7))),o[a]=o[a-i]^e}for(let e=0;a;e++,a--){const t=o[3&e?a:a-4];c[e]=4>=a||4>e?t:s[0][n[t>>>24]]^s[1][n[t>>16&255]]^s[2][n[t>>8&255]]^s[3][n[255&t]]}}encrypt(e){return this._crypt(e,0)}decrypt(e){return this._crypt(e,1)}_precompute(){const e=this._tables[0],t=this._tables[1],n=e[4],s=t[4],r=[],i=[];let a,o,c,l;for(let e=0;256>e;e++)i[(r[e]=e<<1^283*(e>>7))^e]=e;for(let u=a=0;!n[u];u^=o||1,a=i[a]||1){let i=a^a<<1^a<<2^a<<3^a<<4;i=i>>8^255&i^99,n[u]=i,s[i]=u,l=r[c=r[o=r[u]]];let h=16843009*l^65537*c^257*o^16843008*u,f=257*r[i]^16843008*i;for(let n=0;4>n;n++)e[n][u]=f=f<<24^f>>>8,t[n][i]=h=h<<24^h>>>8}for(let n=0;5>n;n++)e[n]=e[n].slice(0),t[n]=t[n].slice(0)}_crypt(e,t){if(4!==e.length)throw new r("invalid aes block size");const n=this._key[t],s=n.length/4-2,i=[0,0,0,0],a=this._tables[t],o=a[0],c=a[1],l=a[2],u=a[3],h=a[4];let f,p,d,w=e[0]^n[0],g=e[t?3:1]^n[1],m=e[2]^n[2],_=e[t?1:3]^n[3],y=4;for(let e=0;s>e;e++)f=o[w>>>24]^c[g>>16&255]^l[m>>8&255]^u[255&_]^n[y],p=o[g>>>24]^c[m>>16&255]^l[_>>8&255]^u[255&w]^n[y+1],d=o[m>>>24]^c[_>>16&255]^l[w>>8&255]^u[255&g]^n[y+2],_=o[_>>>24]^c[w>>16&255]^l[g>>8&255]^u[255&m]^n[y+3],y+=4,w=f,g=p,m=d;for(let e=0;4>e;e++)i[t?3&-e:e]=h[w>>>24]<<24^h[g>>16&255]<<16^h[m>>8&255]<<8^h[255&_]^n[y++],f=w,w=g,g=m,m=_,_=f;return i}},J=class{constructor(e,t){this._prf=e,this._initIv=t,this._iv=t}reset(){this._iv=this._initIv}update(e){return this.calculate(this._prf,e,this._iv)}incWord(e){if(255&~(e>>24))e+=1<<24;else{let t=e>>16&255,n=e>>8&255,s=255&e;255===t?(t=0,255===n?(n=0,255===s?s=0:++s):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=s}return e}incCounter(e){0===(e[0]=this.incWord(e[0]))&&(e[1]=this.incWord(e[1]))}calculate(e,t,n){let s;if(!(s=t.length))return[];const r=C.bitLength(t);for(let r=0;s>r;r+=4){this.incCounter(n);const s=e.encrypt(n);t[r]^=s[0],t[r+1]^=s[1],t[r+2]^=s[2],t[r+3]^=s[3]}return C.clamp(t,r)}},Q=I.hmacSha1;let Y=N&&j&&typeof O.importKey==z,$=N&&j&&typeof O.deriveBits==z;class ee extends w{constructor({password:e,rawPassword:n,signed:s,encryptionStrength:a,checkPasswordOnly:o}){super({start(){t.assign(this,{ready:new h(e=>this.resolveReady=e),password:re(e,n),signed:s,strength:a-1,pending:new i})},async transform(e,t){const n=this,{password:s,strength:a,resolveReady:c,ready:l}=n;s?(await(async(e,t,n,s)=>{const i=await se(e,t,n,ae(s,0,D[t])),a=ae(s,D[t]);if(i[0]!=a[0]||i[1]!=a[1])throw new r(K)})(n,a,s,ae(e,0,D[a]+2)),e=ae(e,D[a]+2),o?t.error(new r(T)):c()):await l;const u=new i(e.length-Z-(e.length-Z)%x);t.enqueue(ne(n,e,u,0,Z,!0))},async flush(e){const{signed:t,ctr:n,hmac:s,pending:a,ready:o}=this;if(s&&n){await o;const c=ae(a,0,a.length-Z),l=ae(a,a.length-Z);let u=new i;if(c.length){const e=ce(G,c);s.update(e);const t=n.update(e);u=oe(G,t)}if(t){const e=ae(oe(G,s.digest()),0,Z);for(let t=0;Z>t;t++)if(e[t]!=l[t])throw new r(P)}e.enqueue(u)}}})}}class te extends w{constructor({password:e,rawPassword:n,encryptionStrength:s}){let r;super({start(){t.assign(this,{ready:new h(e=>this.resolveReady=e),password:re(e,n),strength:s-1,pending:new i})},async transform(e,t){const n=this,{password:s,strength:r,resolveReady:a,ready:o}=n;let c=new i;s?(c=await(async(e,t,n)=>{const s=V(new i(D[t]));return ie(s,await se(e,t,n,s))})(n,r,s),a()):await o;const l=new i(c.length+e.length-e.length%x);l.set(c,0),t.enqueue(ne(n,e,l,c.length,0))},async flush(e){const{ctr:t,hmac:n,pending:s,ready:a}=this;if(n&&t){await a;let o=new i;if(s.length){const e=t.update(ce(G,s));n.update(e),o=oe(G,e)}r.signature=oe(G,n.digest()).slice(0,Z),e.enqueue(ie(o,r.signature))}}}),r=this}}function ne(e,t,n,s,r,a){const{ctr:o,hmac:c,pending:l}=e,u=t.length-r;let h;for(l.length&&(t=ie(l,t),n=((e,t)=>{if(t&&t>e.length){const n=e;(e=new i(t)).set(n,0)}return e})(n,u-u%x)),h=0;u-x>=h;h+=x){const e=ce(G,ae(t,h,h+x));a&&c.update(e);const r=o.update(e);a||c.update(r),n.set(oe(G,r),h+s)}return e.pending=ae(t,h),n}async function se(n,s,r,a){n.password=null;const o=await(async(e,t,n,s,r)=>{if(!Y)return I.importKey(t);try{return await O.importKey("raw",t,n,!1,r)}catch{return Y=!1,I.importKey(t)}})(0,r,W,0,E),c=await(async(e,t,n)=>{if(!$)return I.pbkdf2(t,e.salt,M.iterations,n);try{return await O.deriveBits(e,t,n)}catch{return $=!1,I.pbkdf2(t,e.salt,M.iterations,n)}})(t.assign({salt:a},M),o,8*(2*L[s]+2)),l=new i(c),u=ce(G,ae(l,0,L[s])),h=ce(G,ae(l,L[s],2*L[s])),f=ae(l,2*L[s]);return t.assign(n,{keys:{key:u,authentication:h,passwordVerification:f},ctr:new J(new X(u),e.from(F)),hmac:new Q(h)}),f}function re(e,t){return t===b?(e=>{if(typeof f==S){const t=new i((e=unescape(encodeURIComponent(e))).length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}return(new f).encode(e)})(e):t}function ie(e,t){let n=e;return e.length+t.length&&(n=new i(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function ae(e,t,n){return e.subarray(t,n)}function oe(e,t){return e.fromBits(t)}function ce(e,t){return e.toBits(t)}class le extends w{constructor({password:e,passwordVerification:n,checkPasswordOnly:s}){super({start(){t.assign(this,{password:e,passwordVerification:n}),pe(this,e)},transform(e,t){const n=this;if(n.password){const t=he(n,e.subarray(0,12));if(n.password=null,t.at(-1)!=n.passwordVerification)throw new r(K);e=e.subarray(12)}s?t.error(new r(T)):t.enqueue(he(n,e))}})}}class ue extends w{constructor({password:e,passwordVerification:n}){super({start(){t.assign(this,{password:e,passwordVerification:n}),pe(this,e)},transform(e,t){const n=this;let s,r;if(n.password){n.password=null;const t=V(new i(12));t[11]=n.passwordVerification,s=new i(e.length+t.length),s.set(fe(n,t),0),r=12}else s=new i(e.length),r=0;s.set(fe(n,e),r),t.enqueue(s)}})}}function he(e,t){const n=new i(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],de(e,n[s]);return n}function fe(e,t){const n=new i(t.length);for(let s=0;s<t.length;s++)n[s]=we(e)^t[s],de(e,t[s]);return n}function pe(e,n){const s=[305419896,591751049,878082192];t.assign(e,{keys:s,crcKey0:new v(s[0]),crcKey2:new v(s[2])});for(let t=0;t<n.length;t++)de(e,n.charCodeAt(t))}function de(e,t){let[n,r,i]=e.keys;e.crcKey0.append([t]),n=~e.crcKey0.get(),r=me(s.imul(me(r+ge(n)),134775813)+1),e.crcKey2.append([r>>>24]),i=~e.crcKey2.get(),e.keys=[n,r,i]}function we(e){const t=2|e.keys[2];return ge(s.imul(t,1^t)>>>8)}function ge(e){return 255&e}function me(e){return 4294967295&e}class _e extends w{constructor(e,{chunkSize:t,CompressionStreamZlib:n,CompressionStream:s}){super({});const{compressed:r,encrypted:i,useCompressionStream:a,zipCrypto:o,signed:c,level:l}=e,h=this;let f,p,d=super.readable;i&&!o||!c||(f=new H,d=ze(d,f)),r&&(d=Se(d,a,{level:l,chunkSize:t},s,n,s)),i&&(o?d=ze(d,new ue(e)):(p=new te(e),d=ze(d,p))),be(h,d,()=>{let e;i&&!o&&(e=p.signature),i&&!o||!c||(e=new u(f.value.buffer).getUint32(0)),h.signature=e})}}class ye extends w{constructor(e,{chunkSize:t,DecompressionStreamZlib:n,DecompressionStream:s}){super({});const{zipCrypto:i,encrypted:a,signed:o,signature:c,compressed:l,useCompressionStream:h,deflate64:f}=e;let p,d,w=super.readable;a&&(i?w=ze(w,new le(e)):(d=new ee(e),w=ze(w,d))),l&&(w=Se(w,h,{chunkSize:t,deflate64:f},s,n,s)),a&&!i||!o||(p=new H,w=ze(w,p)),be(this,w,()=>{if((!a||i)&&o){const e=new u(p.value.buffer);if(c!=e.getUint32(0,!1))throw new r(P)}})}}function be(e,n,s){n=ze(n,new w({flush:s})),t.defineProperty(e,"readable",{get:()=>n})}function Se(e,t,n,s,r,i){const a=t&&s?s:r||i,o=n.deflate64?"deflate64-raw":"deflate-raw";try{e=ze(e,new a(o,n))}catch(s){if(!t)throw s;if(r)e=ze(e,new r(o,n));else{if(!i)throw s;e=ze(e,new i(o,n))}}return e}function ze(e,t){return e.pipeThrough(t)}const ke="data",ve="close";class He extends w{constructor(e,n){super({});const s=this,{codecType:i}=e;let a;i.startsWith("deflate")?a=_e:i.startsWith("inflate")&&(a=ye),s.outputSize=0;let o=0;const c=new a(e,n),l=super.readable,u=new w({transform(e,t){e&&e.length&&(o+=e.length,t.enqueue(e))},flush(){t.assign(s,{inputSize:o})}}),h=new w({transform(t,n){if(t&&t.length&&(n.enqueue(t),s.outputSize+=t.length,e.outputSize!==b&&s.outputSize>e.outputSize))throw new r("Invalid uncompressed size")},flush(){const{signature:e}=c;t.assign(s,{signature:e,inputSize:o})}});t.defineProperty(s,"readable",{get:()=>l.pipeThrough(u).pipeThrough(c).pipeThrough(h)})}}class Ce extends w{constructor(e){let t;super({transform:function n(s,r){if(t){const e=new i(t.length+s.length);e.set(t),e.set(s,t.length),s=e,t=null}s.length>e?(r.enqueue(s.slice(0,e)),n(s.slice(e),r)):t=s},flush(e){t&&t.length&&e.enqueue(t)}})}}const Be=new l,Ae=new l;let Re,Ie,qe,Ke,Pe,Te=0;async function Ve(e){try{const{options:t,config:s}=e;if(!t.useCompressionStream)try{await self.initModule(e.config)}catch{t.useCompressionStream=!0}s.CompressionStream=self.CompressionStream,s.DecompressionStream=self.DecompressionStream;const r={highWaterMark:1},i=e.readable||new g({async pull(e){const t=new h(e=>Be.set(Te,e));xe({type:"pull",messageId:Te}),Te=(Te+1)%n.MAX_SAFE_INTEGER;const{value:s,done:r}=await t;e.enqueue(s),r&&e.close()}},r),a=e.writable||new m({async write(e){let t;const s=new h(e=>t=e);Ae.set(Te,t),xe({type:ke,value:e,messageId:Te}),Te=(Te+1)%n.MAX_SAFE_INTEGER,await s}},r),o=new He(t,s);Re=new AbortController;const{signal:c}=Re;await i.pipeThrough(o).pipeThrough(new Ce(s.chunkSize)).pipeTo(a,{signal:c,preventClose:!0,preventAbort:!0}),await a.getWriter().close();const{signature:l,inputSize:u,outputSize:f}=o;xe({type:ve,result:{signature:l,inputSize:u,outputSize:f}})}catch(e){e.outputSize=0,Ue(e)}}function xe(e){let{value:t}=e;if(t)if(t.length)try{t=new i(t),e.value=t.buffer,d(e,[e.value])}catch{d(e)}else d(e);else d(e)}function Ue(e=new r("Unknown error")){const{message:t,stack:n,code:s,name:i,outputSize:a}=e;d({error:{message:t,stack:n,code:s,name:i,outputSize:a}})}function We(e,t,n={}){const a="number"==typeof n.level?n.level:-1,o="number"==typeof n.outBuffer?n.outBuffer:65536,c="number"==typeof n.inBufferSize?n.inBufferSize:65536;return new w({start(){let n;if(this.out=qe(o),this.in=qe(c),this.inBufferSize=c,this._scratch=new i(o),e?(this._process=Ie.deflate_process,this._last_consumed=Ie.deflate_last_consumed,this._end=Ie.deflate_end,this.streamHandle=Ie.deflate_new(),n="gzip"===t?Ie.deflate_init_gzip(this.streamHandle,a):"deflate-raw"===t?Ie.deflate_init_raw(this.streamHandle,a):Ie.deflate_init(this.streamHandle,a)):"deflate64-raw"===t?(this._process=Ie.inflate9_process,this._last_consumed=Ie.inflate9_last_consumed,this._end=Ie.inflate9_end,this.streamHandle=Ie.inflate9_new(),n=Ie.inflate9_init_raw(this.streamHandle)):(this._process=Ie.inflate_process,this._last_consumed=Ie.inflate_last_consumed,this._end=Ie.inflate_end,this.streamHandle=Ie.inflate_new(),n="deflate-raw"===t?Ie.inflate_init_raw(this.streamHandle):"gzip"===t?Ie.inflate_init_gzip(this.streamHandle):Ie.inflate_init(this.streamHandle)),0!==n)throw new r("init failed:"+n)},transform(t,n){try{const a=t,c=new i(Pe.buffer),l=this._process,u=this._last_consumed,h=this.out,f=this._scratch;let p=0;for(;p<a.length;){const t=s.min(a.length-p,32768);this.in&&this.inBufferSize>=t||(this.in&&Ke&&Ke(this.in),this.in=qe(t),this.inBufferSize=t),c.set(a.subarray(p,p+t),this.in);const i=l(this.streamHandle,this.in,t,h,o,0),d=16777215&i;if(d&&(f.set(c.subarray(h,h+d),0),n.enqueue(f.slice(0,d))),!e){const e=i>>24&255,t=128&e?e-256:e;if(0>t)throw new r("process error:"+t)}const w=u(this.streamHandle);if(0===w)break;p+=w}}catch(e){this._end&&this.streamHandle&&this._end(this.streamHandle),this.in&&Ke&&Ke(this.in),this.out&&Ke&&Ke(this.out),n.error(e)}},flush(t){try{const n=new i(Pe.buffer),s=this._process,a=this.out,c=this._scratch;for(;;){const i=s(this.streamHandle,0,0,a,o,4),l=16777215&i,u=i>>24&255;if(!e){const e=128&u?u-256:u;if(0>e)throw new r("process error:"+e)}if(l&&(c.set(n.subarray(a,a+l),0),t.enqueue(c.slice(0,l))),1===u||0===l)break}}catch(e){t.error(e)}finally{if(this._end&&this.streamHandle){const e=this._end(this.streamHandle);0!==e&&t.error(new r("end error:"+e))}this.in&&Ke&&Ke(this.in),this.out&&Ke&&Ke(this.out)}}})}addEventListener("message",({data:e})=>{const{type:t,messageId:n,value:s,done:r}=e;try{if("start"==t&&Ve(e),t==ke){const e=Be.get(n);Be.delete(n),e({value:new i(s),done:r})}if("ack"==t){const e=Ae.get(n);Ae.delete(n),e()}t==ve&&Re.abort()}catch(e){Ue(e)}});class Me{constructor(e="deflate",t){return We(!0,e,t)}}class Ee{constructor(e="deflate",t){return We(!1,e,t)}}let De=!1;self.initModule=async e=>{try{const t=await(async(e,{baseURI:t})=>{if(!De){let n,s;try{try{s=new URL(e,t)}catch{}const r=await fetch(s);n=await r.arrayBuffer()}catch(t){if(!e.startsWith("data:application/wasm;base64,"))throw t;n=(e=>{const t=e.split(",")[1],n=atob(t),s=n.length,r=new i(s);for(let e=0;s>e;++e)r[e]=n.charCodeAt(e);return r.buffer})(e)}(e=>{if(Ie=e,({malloc:qe,free:Ke,memory:Pe}=Ie),"function"!=typeof qe||"function"!=typeof Ke||!Pe)throw Ie=qe=Ke=Pe=null,new r("Invalid WASM module")})((await WebAssembly.instantiate(n)).instance.exports),De=!0}})(e.wasmURI,e);return e.CompressionStreamZlib=Me,e.DecompressionStreamZlib=Ee,t}catch{}}}();
Binary file
@@ -0,0 +1,108 @@
1
+ import createTaskProcessorWorker from "./createTaskProcessorWorker.js";
2
+ import Matrix4 from "../Core/Matrix4.js";
3
+ import Cartesian3 from "../Core/Cartesian3.js";
4
+ import AxisAlignedBoundingBox from "../Core/AxisAlignedBoundingBox.js";
5
+
6
+ const scratchAABBCornerMin = new Cartesian3();
7
+ const scratchAABBCornerMax = new Cartesian3();
8
+ const scratchTrianglePoints = [
9
+ new Cartesian3(),
10
+ new Cartesian3(),
11
+ new Cartesian3(),
12
+ ];
13
+ const scratchTriangleAABB = new AxisAlignedBoundingBox();
14
+
15
+ /**
16
+ * Builds the next layer of the terrain picker's quadtree by determining which triangles intersect
17
+ * each of the four child nodes. (Essentially distributing the parent's triangles to its children.)
18
+ *
19
+ * Takes in the AABBs of the four child nodes in the tree's local space, an inverse transform
20
+ * to convert triangle positions to the tree's local space, and the parent node's triangle indices and positions.
21
+ *
22
+ * Returns an four arrays - one for each child node - containing the indices of the triangles that intersect each node.
23
+ */
24
+ function incrementallyBuildTerrainPicker(parameters, transferableObjects) {
25
+ // Rehydrate worker inputs
26
+ const aabbs = new Float64Array(parameters.aabbs);
27
+ const nodeAABBs = Array.from({ length: 4 }, (_, i) => {
28
+ const min = Cartesian3.unpack(aabbs, i * 6, scratchAABBCornerMin);
29
+ const max = Cartesian3.unpack(aabbs, i * 6 + 3, scratchAABBCornerMax);
30
+ return AxisAlignedBoundingBox.fromCorners(
31
+ min,
32
+ max,
33
+ new AxisAlignedBoundingBox(),
34
+ );
35
+ });
36
+
37
+ const inverseTransformArray = new Float64Array(parameters.inverseTransform);
38
+ const inverseTransform = Matrix4.unpack(
39
+ inverseTransformArray,
40
+ 0,
41
+ new Matrix4(),
42
+ );
43
+
44
+ const triangleIndices = new Uint32Array(parameters.triangleIndices);
45
+ const trianglePositions = new Float32Array(parameters.trianglePositions);
46
+ const intersectingTrianglesArrays = Array.from({ length: 4 }, () => []);
47
+
48
+ for (let j = 0; j < triangleIndices.length; j++) {
49
+ Cartesian3.unpack(trianglePositions, j * 9, scratchTrianglePoints[0]);
50
+ Cartesian3.unpack(trianglePositions, j * 9 + 3, scratchTrianglePoints[1]);
51
+ Cartesian3.unpack(trianglePositions, j * 9 + 6, scratchTrianglePoints[2]);
52
+
53
+ const triangleAABB = createAABBFromTriangle(
54
+ inverseTransform,
55
+ scratchTrianglePoints,
56
+ );
57
+
58
+ for (let i = 0; i < 4; i++) {
59
+ const aabbsIntersect =
60
+ nodeAABBs[i].intersectAxisAlignedBoundingBox(triangleAABB);
61
+ if (!aabbsIntersect) {
62
+ continue;
63
+ }
64
+
65
+ intersectingTrianglesArrays[i].push(triangleIndices[j]);
66
+ }
67
+ }
68
+
69
+ const intersectingTrianglesTypedArrays = intersectingTrianglesArrays.map(
70
+ (array) => {
71
+ const uintArray = new Uint32Array(array);
72
+ transferableObjects.push(uintArray.buffer);
73
+ return uintArray.buffer;
74
+ },
75
+ );
76
+
77
+ return {
78
+ intersectingTrianglesArrays: intersectingTrianglesTypedArrays,
79
+ };
80
+ }
81
+
82
+ /**
83
+ * Creates a tree-space axis-aligned bounding box from the given triangle points and inverse transform (from world to tree space).
84
+ * @param {Matrix4} inverseTransform transform from world space to tree local space
85
+ * @param {Cartesian3[]} trianglePoints array of 3 Cartesian3 points representing the triangle
86
+ * @returns {AxisAlignedBoundingBox} the axis-aligned bounding box enclosing the triangle in tree local space
87
+ */
88
+ function createAABBFromTriangle(inverseTransform, trianglePoints) {
89
+ Matrix4.multiplyByPoint(
90
+ inverseTransform,
91
+ trianglePoints[0],
92
+ trianglePoints[0],
93
+ );
94
+ Matrix4.multiplyByPoint(
95
+ inverseTransform,
96
+ trianglePoints[1],
97
+ trianglePoints[1],
98
+ );
99
+ Matrix4.multiplyByPoint(
100
+ inverseTransform,
101
+ trianglePoints[2],
102
+ trianglePoints[2],
103
+ );
104
+
105
+ return AxisAlignedBoundingBox.fromPoints(trianglePoints, scratchTriangleAABB);
106
+ }
107
+
108
+ export default createTaskProcessorWorker(incrementallyBuildTerrainPicker);
package/index.d.ts CHANGED
@@ -834,6 +834,13 @@ export class AxisAlignedBoundingBox {
834
834
  * intersects the plane.
835
835
  */
836
836
  static intersectPlane(box: AxisAlignedBoundingBox, plane: Plane): Intersect;
837
+ /**
838
+ * Determines whether two axis aligned bounding boxes intersect.
839
+ * @param box - first box
840
+ * @param other - second box
841
+ * @returns <code>true</code> if the boxes intersect; otherwise, <code>false</code>.
842
+ */
843
+ static intersectAxisAlignedBoundingBox(box: AxisAlignedBoundingBox, other: AxisAlignedBoundingBox): boolean;
837
844
  /**
838
845
  * Duplicates this AxisAlignedBoundingBox instance.
839
846
  * @param [result] - The object onto which to store the result.
@@ -849,6 +856,12 @@ export class AxisAlignedBoundingBox {
849
856
  * intersects the plane.
850
857
  */
851
858
  intersectPlane(plane: Plane): Intersect;
859
+ /**
860
+ * Determines whether some other axis aligned bounding box intersects this box.
861
+ * @param other - The other axis aligned bounding box.
862
+ * @returns <code>true</code> if the boxes intersect; otherwise, <code>false</code>.
863
+ */
864
+ intersectAxisAlignedBoundingBox(other: AxisAlignedBoundingBox): boolean;
852
865
  /**
853
866
  * Compares this AxisAlignedBoundingBox against the provided AxisAlignedBoundingBox componentwise and returns
854
867
  * <code>true</code> if they are equal, <code>false</code> otherwise.
@@ -8851,6 +8864,13 @@ export namespace IntersectionTests {
8851
8864
  * @returns The interval containing scalar points along the ray or undefined if there are no intersections.
8852
8865
  */
8853
8866
  function rayEllipsoid(ray: Ray, ellipsoid: Ellipsoid): Interval;
8867
+ /**
8868
+ * Computes the intersection points of a ray with an axis-aligned bounding box. (axis-aligned in the same space as the ray)
8869
+ * @param ray - The ray.
8870
+ * @param box - The axis-aligned bounding box.
8871
+ * @param result - The interval containing scalar points along the ray or undefined if there are no intersections.
8872
+ */
8873
+ function rayAxisAlignedBoundingBox(ray: Ray, box: AxisAlignedBoundingBox, result: Interval | undefined): void;
8854
8874
  /**
8855
8875
  * Provides the point along the ray which is nearest to the ellipsoid.
8856
8876
  * @param ray - The ray.
@@ -16743,6 +16763,21 @@ export class TerrainData {
16743
16763
  wasCreatedByUpsampling(): boolean;
16744
16764
  }
16745
16765
 
16766
+ /**
16767
+ * Indicates whether the terrain picker needs to be rebuilt due to changes in the underlying terrain mesh's vertices or indices.
16768
+ */
16769
+ export var needsRebuild: boolean;
16770
+
16771
+ /**
16772
+ * Creates an axis-aligned bounding box for a quadtree node at the given tree-space coordinates and level.
16773
+ * This AABB is in the tree's local space (where the root node of the tree is a unit cube in its own local space).
16774
+ * @param x - The x coordinate of the node.
16775
+ * @param y - The y coordinate of the node.
16776
+ * @param level - The level of the node.
16777
+ * @returns The axis-aligned bounding box for the node.
16778
+ */
16779
+ export function createAABBForNode(x: number, y: number, level: number): AxisAlignedBoundingBox;
16780
+
16746
16781
  export namespace TerrainProvider {
16747
16782
  /**
16748
16783
  * A function that is called when an error occurs.
@@ -19085,7 +19120,7 @@ export namespace BillboardGraphics {
19085
19120
  */
19086
19121
  type ConstructorOptions = {
19087
19122
  show?: Property | boolean;
19088
- image?: Property | string | HTMLCanvasElement;
19123
+ image?: Property | string | HTMLImageElement | HTMLCanvasElement;
19089
19124
  scale?: Property | number;
19090
19125
  pixelOffset?: Property | Cartesian2;
19091
19126
  eyeOffset?: Property | Cartesian3;
@@ -26389,6 +26424,134 @@ export enum Axis {
26389
26424
  Z = 2
26390
26425
  }
26391
26426
 
26427
+ export namespace Azure2DImageryProvider {
26428
+ /**
26429
+ * Initialization options for the Azure2DImageryProvider constructor
26430
+ * @property subscriptionKey - The public subscription key for the imagery.
26431
+ * @property [url = "https://atlas.microsoft.com/"] - The Azure server url.
26432
+ * @property [tilesetId = "microsoft.imagery"] - The Azure tileset ID. Valid options are {@link microsoft.imagery}, {@link microsoft.base.road}, and {@link microsoft.base.labels.road}
26433
+ * @property [ellipsoid = Ellipsoid.default] - The ellipsoid. If not specified, the default ellipsoid is used.
26434
+ * @property [minimumLevel = 0] - The minimum level-of-detail supported by the imagery provider. Take care when specifying
26435
+ * this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely
26436
+ * to result in rendering problems.
26437
+ * @property [maximumLevel = 22] - The maximum level-of-detail supported by the imagery provider.
26438
+ * @property [rectangle = Rectangle.MAX_VALUE] - The rectangle, in radians, covered by the image.
26439
+ */
26440
+ type ConstructorOptions = {
26441
+ subscriptionKey: string;
26442
+ url?: string;
26443
+ tilesetId?: string;
26444
+ ellipsoid?: Ellipsoid;
26445
+ minimumLevel?: number;
26446
+ maximumLevel?: number;
26447
+ rectangle?: Rectangle;
26448
+ };
26449
+ }
26450
+
26451
+ /**
26452
+ * Provides 2D image tiles from Azure.
26453
+ * @example
26454
+ * // Azure 2D imagery provider
26455
+ * const azureImageryProvider = new Cesium.Azure2DImageryProvider({
26456
+ * subscriptionKey: "subscription-key",
26457
+ * tilesetId: "microsoft.base.road"
26458
+ * });
26459
+ * @param options - Object describing initialization options
26460
+ */
26461
+ export class Azure2DImageryProvider {
26462
+ constructor(options: Azure2DImageryProvider.ConstructorOptions);
26463
+ /**
26464
+ * Gets the URL of the Azure 2D Imagery server.
26465
+ */
26466
+ readonly url: string;
26467
+ /**
26468
+ * Gets the rectangle, in radians, of the imagery provided by the instance.
26469
+ */
26470
+ readonly rectangle: Rectangle;
26471
+ /**
26472
+ * Gets the width of each tile, in pixels.
26473
+ */
26474
+ readonly tileWidth: number;
26475
+ /**
26476
+ * Gets the height of each tile, in pixels.
26477
+ */
26478
+ readonly tileHeight: number;
26479
+ /**
26480
+ * Gets the maximum level-of-detail that can be requested.
26481
+ */
26482
+ readonly maximumLevel: number | undefined;
26483
+ /**
26484
+ * Gets the minimum level-of-detail that can be requested. Generally,
26485
+ * a minimum level should only be used when the rectangle of the imagery is small
26486
+ * enough that the number of tiles at the minimum level is small. An imagery
26487
+ * provider with more than a few tiles at the minimum level will lead to
26488
+ * rendering problems.
26489
+ */
26490
+ readonly minimumLevel: number;
26491
+ /**
26492
+ * Gets the tiling scheme used by the provider.
26493
+ */
26494
+ readonly tilingScheme: TilingScheme;
26495
+ /**
26496
+ * Gets the tile discard policy. If not undefined, the discard policy is responsible
26497
+ * for filtering out "missing" tiles via its shouldDiscardImage function. If this function
26498
+ * returns undefined, no tiles are filtered.
26499
+ */
26500
+ readonly tileDiscardPolicy: TileDiscardPolicy;
26501
+ /**
26502
+ * Gets an event that is raised when the imagery provider encounters an asynchronous error.. By subscribing
26503
+ * to the event, you will be notified of the error and can potentially recover from it. Event listeners
26504
+ * are passed an instance of {@link TileProviderError}.
26505
+ */
26506
+ readonly errorEvent: Event;
26507
+ /**
26508
+ * Gets the credit to display when this imagery provider is active. Typically this is used to credit
26509
+ * the source of the imagery.
26510
+ */
26511
+ readonly credit: Credit;
26512
+ /**
26513
+ * Gets the proxy used by this provider.
26514
+ */
26515
+ readonly proxy: Proxy;
26516
+ /**
26517
+ * Gets a value indicating whether or not the images provided by this imagery provider
26518
+ * include an alpha channel. If this property is false, an alpha channel, if present, will
26519
+ * be ignored. If this property is true, any images without an alpha channel will be treated
26520
+ * as if their alpha is 1.0 everywhere. When this property is false, memory usage
26521
+ * and texture upload time are reduced.
26522
+ */
26523
+ readonly hasAlphaChannel: boolean;
26524
+ /**
26525
+ * Gets the credits to be displayed when a given tile is displayed.
26526
+ * @param x - The tile X coordinate.
26527
+ * @param y - The tile Y coordinate.
26528
+ * @param level - The tile level;
26529
+ * @returns The credits to be displayed when the tile is displayed.
26530
+ */
26531
+ getTileCredits(x: number, y: number, level: number): Credit[] | undefined;
26532
+ /**
26533
+ * Requests the image for a given tile.
26534
+ * @param x - The tile X coordinate.
26535
+ * @param y - The tile Y coordinate.
26536
+ * @param level - The tile level.
26537
+ * @param [request] - The request object. Intended for internal use only.
26538
+ * @returns A promise for the image that will resolve when the image is available, or
26539
+ * undefined if there are too many active requests to the server, and the request should be retried later.
26540
+ */
26541
+ requestImage(x: number, y: number, level: number, request?: Request): Promise<ImageryTypes> | undefined;
26542
+ /**
26543
+ * Picking features is not currently supported by this imagery provider, so this function simply returns
26544
+ * undefined.
26545
+ * @param x - The tile X coordinate.
26546
+ * @param y - The tile Y coordinate.
26547
+ * @param level - The tile level.
26548
+ * @param longitude - The longitude at which to pick features.
26549
+ * @param latitude - The latitude at which to pick features.
26550
+ * @returns Undefined since picking is not supported.
26551
+ */
26552
+ pickFeatures(x: number, y: number, level: number, longitude: number, latitude: number): undefined;
26553
+ }
26554
+
26392
26555
  export namespace Billboard {
26393
26556
  /**
26394
26557
  * Initialization options for the first param of Billboard constructor
@@ -26420,7 +26583,7 @@ export namespace Billboard {
26420
26583
  position: Cartesian3;
26421
26584
  id?: any;
26422
26585
  show?: boolean;
26423
- image?: string | HTMLCanvasElement;
26586
+ image?: string | HTMLImageElement | HTMLCanvasElement;
26424
26587
  scale?: number;
26425
26588
  pixelOffset?: Cartesian2;
26426
26589
  eyeOffset?: Cartesian3;
@@ -26771,6 +26934,11 @@ export class Billboard {
26771
26934
  equals(other?: Billboard): boolean;
26772
26935
  }
26773
26936
 
26937
+ /**
26938
+ * Arbitrary limit on allocated SVG size, in pixels. Raster images use image resolution.
26939
+ */
26940
+ export const SVG_MAX_SIZE_PX = 512;
26941
+
26774
26942
  /**
26775
26943
  * A renderable collection of billboards. Billboards are viewport-aligned
26776
26944
  * images positioned in the 3D scene.
@@ -33228,7 +33396,7 @@ export class Google2DImageryProvider {
33228
33396
  * });
33229
33397
  * @example
33230
33398
  * // Google 2D roadmap overlay with custom styles
33231
- * const googleTileProvider = Cesium.Google2DImageryProvider.fromIonAssetId({
33399
+ * const googleTilesProvider = Cesium.Google2DImageryProvider.fromIonAssetId({
33232
33400
  * assetId: 3830184,
33233
33401
  * overlayLayerType: "layerRoadmap",
33234
33402
  * styles: [
@@ -33284,7 +33452,7 @@ export class Google2DImageryProvider {
33284
33452
  * // Google 2D roadmap overlay with custom styles
33285
33453
  * Cesium.GoogleMaps.defaultApiKey = "your-api-key";
33286
33454
  *
33287
- * const googleTileProvider = Cesium.Google2DImageryProvider.fromUrl({
33455
+ * const googleTilesProvider = Cesium.Google2DImageryProvider.fromUrl({
33288
33456
  * overlayLayerType: "layerRoadmap",
33289
33457
  * styles: [
33290
33458
  * {
@@ -39956,6 +40124,20 @@ export var metadataProperty: any;
39956
40124
  */
39957
40125
  export function computePickingDrawingBufferRectangle(drawingBufferHeight: number, position: Cartesian2, width: number | undefined, height: number | undefined, result: BoundingRectangle): BoundingRectangle;
39958
40126
 
40127
+ /**
40128
+ * Setup needed before picking.
40129
+ * @param windowPosition - Window coordinates to perform picking on.
40130
+ * @param drawingBufferRectangle - The output drawing buffer recangle.
40131
+ * @param [width = 3] - Width of the pick rectangle.
40132
+ * @param [height = 3] - Height of the pick rectangle.
40133
+ */
40134
+ export function pickBegin(scene: Scene, windowPosition: Cartesian2, drawingBufferRectangle: BoundingRectangle, width?: number, height?: number): void;
40135
+
40136
+ /**
40137
+ * Teardown needed after picking.
40138
+ */
40139
+ export function pickEnd(scene: Scene): void;
40140
+
39959
40141
  /**
39960
40142
  * Information about metadata that is supposed to be picked
39961
40143
  * @property schemaId - The optional ID of the metadata schema
@@ -42367,6 +42549,24 @@ export class Scene {
42367
42549
  * @returns Object containing the picked primitive or <code>undefined</code> if nothing is at the location.
42368
42550
  */
42369
42551
  pick(windowPosition: Cartesian2, width?: number, height?: number): any | undefined;
42552
+ /**
42553
+ * Performs the same operation as Scene.pick but asynchonosly without blocking the main render thread.
42554
+ * Requires WebGL2 else using fallback.
42555
+ * @example
42556
+ * // On mouse over, color the feature yellow.
42557
+ * handler.setInputAction(function(movement) {
42558
+ * const feature = scene.pickAsync(movement.endPosition).then(function(feature) {
42559
+ * if (feature instanceof Cesium.Cesium3DTileFeature) {
42560
+ * feature.color = Cesium.Color.YELLOW;
42561
+ * }
42562
+ * });
42563
+ * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
42564
+ * @param windowPosition - Window coordinates to perform picking on.
42565
+ * @param [width = 3] - Width of the pick rectangle.
42566
+ * @param [height = 3] - Height of the pick rectangle.
42567
+ * @returns Object containing the picked primitive or <code>undefined</code> if nothing is at the location.
42568
+ */
42569
+ pickAsync(windowPosition: Cartesian2, width?: number, height?: number): Promise<object | undefined>;
42370
42570
  /**
42371
42571
  * Returns a {@link VoxelCell} for the voxel sample rendered at a particular window coordinate,
42372
42572
  * or <code>undefined</code> if no voxel is rendered at that position.