@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
1 lines • 13 kB
JavaScript
;(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4654],{46851:(e,t,n)=>{n.d(t,{MA:()=>d,m0:()=>h,wH:()=>w});var o=n(49186),r=n(4718),i=n(53966),c=n(37203),s=n(46540);const u=()=>i.A.getLogger("esri.views.3d.layers.i3s.I3SBinaryReader");function a(e,t,n){let r="",i=0;for(;i<n;){const c=e[t+i];if(c<128)r+=String.fromCharCode(c),i++;else if(c>=192&&c<224){if(i+1>=n)throw new o.A("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const s=(31&c)<<6|63&e[t+i+1];r+=String.fromCharCode(s),i+=2}else if(c>=224&&c<240){if(i+2>=n)throw new o.A("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const s=(15&c)<<12|(63&e[t+i+1])<<6|63&e[t+i+2];r+=String.fromCharCode(s),i+=3}else{if(!(c>=240&&c<248))throw new o.A("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(i+3>=n)throw new o.A("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const s=(7&c)<<18|(63&e[t+i+1])<<12|(63&e[t+i+2])<<6|63&e[t+i+3];if(s>=65536){const e=55296+(s-65536>>10),t=56320+(1023&s);r+=String.fromCharCode(e,t)}else r+=String.fromCharCode(s);i+=4}}}return r}function f(e,t){const n={byteOffset:0,byteCount:0,fields:Object.create(null)};let o=0;for(let r=0;r<t.length;r++){const i=t[r],c=i.valueType||i.type,s=A[c];n.fields[i.property]=s(e,o),o+=p[c].BYTES_PER_ELEMENT}return n.byteCount=o,n}function l(e,t,n){const r=[];let i,c,s=0;for(c=0;c<e;c+=1){if(i=t[c],i>0){if(r.push(a(n,s,i-1)),0!==n[s+i-1])throw new o.A("string-array-error","Invalid string array: missing null termination.")}else r.push(null);s+=i}return r}function d(e,t){return new(0,p[t.valueType])(e,t.byteOffset,t.count*t.valuesPerElement)}function y(e,t,n){const i=null!=t.header?f(e,t.header):{byteOffset:0,byteCount:0,fields:{count:n}},c={header:i,byteOffset:i.byteCount,byteCount:0,entries:Object.create(null)};let s=i.byteCount;for(let e=0;e<t.ordering.length;e++){const n=t.ordering[e],u=(0,r.o8)(t[n]);if(u.count=i.fields.count??0,"String"===u.valueType){if(u.byteOffset=s,u.byteCount=i.fields[n+"ByteCount"],"UTF-8"!==u.encoding)throw new o.A("unsupported-encoding","Unsupported String encoding.",{encoding:u.encoding});if(u.timeEncoding&&"ECMA_ISO8601"!==u.timeEncoding)throw new o.A("unsupported-time-encoding","Unsupported time encoding.",{timeEncoding:u.timeEncoding})}else{if(!U(u.valueType))throw new o.A("unsupported-value-type","Unsupported binary valueType",{valueType:u.valueType});{const e=C(u.valueType);s+=s%e!=0?e-s%e:0,u.byteOffset=s,u.byteCount=e*u.valuesPerElement*u.count}}s+=u.byteCount??0,c.entries[n]=u}return c.byteCount=s-c.byteOffset,c}function g(e,t,n){if(t!==e&&u().error(`Invalid ${n} buffer size\n expected: ${e}, actual: ${t})`),t<e)throw new o.A("buffer-too-small","Binary buffer is too small",{expectedSize:e,actualSize:t})}function w(e,t){const n=f(e,t&&t.header);let o=n.byteCount;const r={isDraco:!1,header:n,byteOffset:n.byteCount,byteCount:0,vertexAttributes:{}},i=n.fields,c=null!=i.vertexCount?i.vertexCount:i.count;for(const e of t.ordering){if(!t.vertexAttributes[e])continue;const n={...t.vertexAttributes[e],byteOffset:o,count:c},i=b[e]||"_"+e;r.vertexAttributes[i]=n,o+=C(n.valueType)*n.valuesPerElement*c}const s=i.faceCount;if(t.faces&&s){r.faces={};for(const e of t.ordering){if(!t.faces[e])continue;const n={...t.faces[e],byteOffset:o,count:s};r.faces[e]=n,o+=C(n.valueType)*n.valuesPerElement*s}}const u=i.featureCount;if(t.featureAttributes&&t.featureAttributeOrder&&u){r.featureAttributes={};for(const e of t.featureAttributeOrder){if(!t.featureAttributes[e])continue;const n={...t.featureAttributes[e],byteOffset:o,count:u};r.featureAttributes[e]=n,o+=("UInt64"===n.valueType?8:C(n.valueType))*n.valuesPerElement*u}}return g(o,e.byteLength,"geometry"),r.byteCount=o-r.byteOffset,r}const b={position:s.r.POSITION,normal:s.r.NORMAL,color:s.r.COLOR,uv0:s.r.UV0,region:s.r.UVREGION};function h(e,t,n){if("lepcc-rgb"===e.encoding)return(0,c.mb)(t);if("lepcc-intensity"===e.encoding)return(0,c.Ax)(t);if(null!=e.encoding&&""!==e.encoding)throw new o.A("unknown-attribute-storage-info-encoding","Unknown Attribute Storage Info Encoding");e["attributeByteCounts "]&&!e.attributeByteCounts&&(u().warn("Warning: Trailing space in 'attributeByteCounts '."),e.attributeByteCounts=e["attributeByteCounts "]),"ObjectIds"===e.ordering[0]&&e.hasOwnProperty("objectIds")&&(u().warn("Warning: Case error in objectIds"),e.ordering[0]="objectIds");const r=y(t,e,n);g(r.byteOffset+r.byteCount,t.byteLength,"attribute");const i=r.entries.attributeValues||r.entries.objectIds;if(i){if("String"===i.valueType){const e=r.entries.attributeByteCounts,n=d(t,e),o=function(e,t){return new Uint8Array(e,t.byteOffset,t.byteCount)}(t,i);return i.timeEncoding?function(e,t,n){return l(e,t,n).map((e=>{const t=e?Date.parse(e):null;return null==t||Number.isNaN(t)?null:t}))}(e.count,n,o):l(e.count,n,o)}return d(t,i)}throw new o.A("bad-attribute-storage-info","Bad attributeStorageInfo specification.")}const p={Float32:Float32Array,Float64:Float64Array,UInt8:Uint8Array,Int8:Int8Array,UInt16:Uint16Array,Int16:Int16Array,UInt32:Uint32Array,Int32:Int32Array},A={Float32:(e,t)=>new DataView(e,0).getFloat32(t,!0),Float64:(e,t)=>new DataView(e,0).getFloat64(t,!0),UInt8:(e,t)=>new DataView(e,0).getUint8(t),Int8:(e,t)=>new DataView(e,0).getInt8(t),UInt16:(e,t)=>new DataView(e,0).getUint16(t,!0),Int16:(e,t)=>new DataView(e,0).getInt16(t,!0),UInt32:(e,t)=>new DataView(e,0).getUint32(t,!0),Int32:(e,t)=>new DataView(e,0).getInt32(t,!0)};function U(e){return p.hasOwnProperty(e)}function C(e){return U(e)?p[e].BYTES_PER_ELEMENT:0}},4654:(e,t,n)=>{n.d(t,{Q7:()=>m,s1:()=>p});var o=n(78888),r=(n(4576),n(49186),n(44208),n(34275)),i=(n(58083),n(9093)),c=(n(38954),n(51850)),s=(n(57251),n(16930),n(27993),n(19419)),u=(n(97937),n(61956),n(46851));n(73941),n(48353),n(68197);var a,f,l,d,y,g=n(91829);!function(e){e[e.TRANSPARENT=0]="TRANSPARENT",e[e.OPAQUE=1]="OPAQUE"}(a||(a={})),n(21818),n(40804),n(42583),n(49255),n(26835),n(81961),n(31821),n(69270),n(74333).n,n(15976),n(16943),n(46540),(l=f||(f={}))[l.Uniform=0]="Uniform",l[l.Varying=1]="Varying",l[l.COUNT=2]="COUNT",n(96336),n(26425),n(40710),n(33079),n(98353),n(35644),n(58029),function(e){e[e.Solid=0]="Solid",e[e.Sketch=1]="Sketch",e[e.Mixed=2]="Mixed",e[e.COUNT=3]="COUNT"}(d||(d={})),function(e){e[e.REGULAR=0]="REGULAR",e[e.SILHOUETTE=1]="SILHOUETTE"}(y||(y={}));(0,g.fA)(0,0,0,.2),a.OPAQUE;(0,g.fA)(0,0,0,.2),a.OPAQUE,n(66104);var w,b,h=n(57005);async function p(e,t,n,r,i,c,s,a){const f=[];for(const o of t)if(o&&i.includes(o.name)){const t=`${e}/nodes/${n}/attributes/${o.key}/0`;f.push({url:t,storageInfo:o})}const l=await Promise.allSettled(f.map((e=>(0,o.A)(e.url,{responseType:"array-buffer",query:{...s,token:c},signal:a?.signal}).then((t=>(0,u.m0)(e.storageInfo,t.data)))))),d=[];for(const e of r){const t={};for(let n=0;n<l.length;n++){const o=l[n];if("fulfilled"===o.status){const r=o.value;t[f[n].storageInfo.name]=C(r,e)}}d.push(t)}return d}(0,s.vt)(),(b=w||(w={}))[b.OUTSIDE=0]="OUTSIDE",b[b.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",b[b.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",b[b.INSIDE=3]="INSIDE";const A=-32768,U=-2147483648;function C(e,t){if(!e)return null;const n=e[t];return(0,r.IY)(e)?n===A?null:n:(0,r._G)(e)?n===U?null:n:n!=n?null:n}function m(e){null!=e&&(e[3]=-1)}!function(){d.Solid}({color:[0,0,0,0],opacity:0}),(0,c.vt)(),(0,c.vt)(),(0,c.vt)(),(0,c.vt)(),(0,c.vt)(),(0,c.vt)(),(0,c.vt)(),(0,c.vt)(),(0,s.vt)(),(0,s.vt)(),new h.ab,(0,c.vt)(),new Array(72),(0,i.vt)()},37203:(e,t,n)=>{n.d(t,{Ax:()=>h,Me:()=>a,mb:()=>g});var o=n(49186);const r=!0,i={identifierOffset:0,identifierLength:10,versionOffset:10,checksumOffset:12,byteCount:16};function c(e,t,n){return{identifier:String.fromCharCode.apply(null,new Uint8Array(e,n+i.identifierOffset,i.identifierLength)),version:t.getUint16(n+i.versionOffset,r),checksum:t.getUint32(n+i.checksumOffset,r)}}const s={sizeLo:0,sizeHi:4,minX:8,minY:16,minZ:24,maxX:32,maxY:40,maxZ:48,errorX:56,errorY:64,errorZ:72,count:80,reserved:84,byteCount:88};function u(e,t){return{sizeLo:e.getUint32(t+s.sizeLo,r),sizeHi:e.getUint32(t+s.sizeHi,r),minX:e.getFloat64(t+s.minX,r),minY:e.getFloat64(t+s.minY,r),minZ:e.getFloat64(t+s.minZ,r),maxX:e.getFloat64(t+s.maxX,r),maxY:e.getFloat64(t+s.maxY,r),maxZ:e.getFloat64(t+s.maxZ,r),errorX:e.getFloat64(t+s.errorX,r),errorY:e.getFloat64(t+s.errorY,r),errorZ:e.getFloat64(t+s.errorZ,r),count:e.getUint32(t+s.count,r),reserved:e.getUint32(t+s.reserved,r)}}function a(e){const t=new DataView(e,0);let n=0;const{identifier:r,version:a}=c(e,t,n);if(n+=i.byteCount,"LEPCC "!==r)throw new o.A("lepcc-decode-error","Bad identifier");if(a>1)throw new o.A("lepcc-decode-error","Unknown version");const l=u(t,n);if(n+=s.byteCount,l.sizeHi*2**32+l.sizeLo!==e.byteLength)throw new o.A("lepcc-decode-error","Bad size");const d=new Float64Array(3*l.count),y=[],g=[],w=[],b=[];if(n=f(e,n,y),n=f(e,n,g),n=f(e,n,w),n=f(e,n,b),n!==e.byteLength)throw new o.A("lepcc-decode-error","Bad length");let h=0,p=0;for(let e=0;e<y.length;e++){p+=y[e];let t=0;for(let n=0;n<g[e];n++){t+=w[h];const e=b[h];d[3*h]=Math.min(l.maxX,l.minX+2*l.errorX*t),d[3*h+1]=Math.min(l.maxY,l.minY+2*l.errorY*p),d[3*h+2]=Math.min(l.maxZ,l.minZ+2*l.errorZ*e),h++}}return{errorX:l.errorX,errorY:l.errorY,errorZ:l.errorZ,result:d}}function f(e,t,n){const o=[];t=l(e,t,o);const r=[];for(let i=0;i<o.length;i++){r.length=0,t=l(e,t,r);for(let e=0;e<r.length;e++)n.push(r[e]+o[i])}return t}function l(e,t,n){const i=new DataView(e,t),c=i.getUint8(0),s=31&c,u=!!(32&c),a=(192&c)>>6;let f=0;if(0===a)f=i.getUint32(1,r),t+=5;else if(1===a)f=i.getUint16(1,r),t+=3;else{if(2!==a)throw new o.A("lepcc-decode-error","Bad count type");f=i.getUint8(1),t+=2}if(u)throw new o.A("lepcc-decode-error","LUT not implemented");const l=Math.ceil(f*s/8),d=new Uint8Array(e,t,l);let y=0,g=0,w=0;const b=-1>>>32-s;for(let e=0;e<f;e++){for(;g<s;)y|=d[w]<<g,g+=8,w+=1;n[e]=y&b,y>>>=s,g-=s,g+s>32&&(y|=d[w-1]>>8-g)}return t+w}const d={sizeLo:0,sizeHi:4,count:8,colorMapCount:12,lookupMethod:14,compressionMethod:15,byteCount:16};function y(e,t){return{sizeLo:e.getUint32(t+d.sizeLo,r),sizeHi:e.getUint32(t+d.sizeHi,r),count:e.getUint32(t+d.count,r),colorMapCount:e.getUint16(t+d.colorMapCount,r),lookupMethod:e.getUint8(t+d.lookupMethod),compressionMethod:e.getUint8(t+d.compressionMethod)}}function g(e){const t=new DataView(e,0);let n=0;const{identifier:r,version:s}=c(e,t,n);if(n+=i.byteCount,"ClusterRGB"!==r)throw new o.A("lepcc-decode-error","Bad identifier");if(s>1)throw new o.A("lepcc-decode-error","Unknown version");const u=y(t,n);if(n+=d.byteCount,u.sizeHi*2**32+u.sizeLo!==e.byteLength)throw new o.A("lepcc-decode-error","Bad size");if((2===u.lookupMethod||1===u.lookupMethod)&&0===u.compressionMethod){if(3*u.colorMapCount+u.count+n!==e.byteLength||u.colorMapCount>256)throw new o.A("lepcc-decode-error","Bad count");const t=new Uint8Array(e,n,3*u.colorMapCount),r=new Uint8Array(e,n+3*u.colorMapCount,u.count),i=new Uint8Array(3*u.count);for(let e=0;e<u.count;e++){const n=r[e];i[3*e]=t[3*n],i[3*e+1]=t[3*n+1],i[3*e+2]=t[3*n+2]}return i}if(0===u.lookupMethod&&0===u.compressionMethod){if(3*u.count+n!==e.byteLength||0!==u.colorMapCount)throw new o.A("lepcc-decode-error","Bad count");return new Uint8Array(e,n).slice()}if(u.lookupMethod<=2&&1===u.compressionMethod){if(n+3!==e.byteLength||1!==u.colorMapCount)throw new o.A("lepcc-decode-error","Bad count");const r=t.getUint8(n),i=t.getUint8(n+1),c=t.getUint8(n+2),s=new Uint8Array(3*u.count);for(let e=0;e<u.count;e++)s[3*e]=r,s[3*e+1]=i,s[3*e+2]=c;return s}throw new o.A("lepcc-decode-error","Bad method "+u.lookupMethod+","+u.compressionMethod)}const w={sizeLo:0,sizeHi:4,count:8,scaleFactor:12,bitsPerPoint:14,reserved:15,byteCount:16};function b(e,t){return{sizeLo:e.getUint32(t+w.sizeLo,r),sizeHi:e.getUint32(t+w.sizeHi,r),count:e.getUint32(t+w.count,r),scaleFactor:e.getUint16(t+w.scaleFactor,r),bitsPerPoint:e.getUint8(t+w.bitsPerPoint),reserved:e.getUint8(t+w.reserved)}}function h(e){const t=new DataView(e,0);let n=0;const{identifier:r,version:s}=c(e,t,n);if(n+=i.byteCount,"Intensity "!==r)throw new o.A("lepcc-decode-error","Bad identifier");if(s>1)throw new o.A("lepcc-decode-error","Unknown version");const u=b(t,n);if(n+=w.byteCount,u.sizeHi*2**32+u.sizeLo!==e.byteLength)throw new o.A("lepcc-decode-error","Bad size");const a=new Uint16Array(u.count);if(8===u.bitsPerPoint){if(u.count+n!==e.byteLength)throw new o.A("lepcc-decode-error","Bad size");const t=new Uint8Array(e,n,u.count);for(let e=0;e<u.count;e++)a[e]=t[e]*u.scaleFactor}else if(16===u.bitsPerPoint){if(2*u.count+n!==e.byteLength)throw new o.A("lepcc-decode-error","Bad size");const t=new Uint16Array(e,n,u.count);for(let e=0;e<u.count;e++)a[e]=t[e]*u.scaleFactor}else{const t=[];if(l(e,n,t)!==e.byteLength)throw new o.A("lepcc-decode-error","Bad size");for(let e=0;e<u.count;e++)a[e]=t[e]*u.scaleFactor}return a}}}]);