/** * Cesium - https://github.com/CesiumGS/cesium * * Copyright 2011-2020 Cesium Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Columbus View (Pat. Pend.) * * Portions licensed separately. * See https://github.com/CesiumGS/cesium/blob/master/LICENSE.md for full licensing details. */ define(["exports"],function(t){var i=function(t,i,r,e,s){var n,o,h=8*s-e-1,a=(1<>1,f=-7,p=r?s-1:0,d=r?-1:1,c=t[i+p];for(p+=d,n=c&(1<<-f)-1,c>>=-f,f+=h;0>=-f,f+=e;0>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,c=e?0:n-1,l=e?1:-1,w=i<0||0===i&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(h=isNaN(i)?1:0,o=f):(o=Math.floor(Math.log(i)/Math.LN2),i*(a=Math.pow(2,-o))<1&&(o--,a*=2),2<=(i+=1<=o+p?d/a:d*Math.pow(2,1-p))*a&&(o++,a/=2),f<=o+p?(h=0,o=f):1<=o+p?(h=(i*a-1)*Math.pow(2,s),o+=p):(h=i*Math.pow(2,p-1)*Math.pow(2,s),o=0));8<=s;t[r+c]=255&h,c+=l,h/=256,s-=8);for(o=o<>>0):4294967296*(i>>>0)+(t>>>0)}function a(t,i,r){var e=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.ceil(Math.log(i)/(7*Math.LN2));r.realloc(e);for(var s=r.pos-1;t<=s;s--)r.buf[s+e]=r.buf[s]}function u(t,i){for(var r=0;r>>8,t[r+2]=i>>>16,t[r+3]=i>>>24}function x(t,i){return(t[i]|t[i+1]<<8|t[i+2]<<16)+(t[i+3]<<24)}e.prototype={destroy:function(){this.buf=null},readFields:function(t,i,r){for(r=r||this.length;this.pos>3,n=this.pos;this.type=7&e,t(s,i,this),this.pos===n&&this.skip(e)}return i},readMessage:function(t,i){return this.readFields(t,i,this.readVarint()+this.pos)},readFixed32:function(){var t=g(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=x(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=g(this.buf,this.pos)+g(this.buf,this.pos+4)*s;return this.pos+=8,t},readSFixed64:function(){var t=g(this.buf,this.pos)+x(this.buf,this.pos+4)*s;return this.pos+=8,t},readFloat:function(){var t=i(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=i(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var i,r,e=this.buf;return i=127&(r=e[this.pos++]),r<128?i:(i|=(127&(r=e[this.pos++]))<<7,r<128?i:(i|=(127&(r=e[this.pos++]))<<14,r<128?i:(i|=(127&(r=e[this.pos++]))<<21,r<128?i:function(t,i,r){var e,s,n=r.buf;if(s=n[r.pos++],e=(112&s)>>4,s<128)return h(t,e,i);if(s=n[r.pos++],e|=(127&s)<<3,s<128)return h(t,e,i);if(s=n[r.pos++],e|=(127&s)<<10,s<128)return h(t,e,i);if(s=n[r.pos++],e|=(127&s)<<17,s<128)return h(t,e,i);if(s=n[r.pos++],e|=(127&s)<<24,s<128)return h(t,e,i);if(s=n[r.pos++],e|=(1&s)<<31,s<128)return h(t,e,i);throw new Error("Expected varint not more than 10 bytes")}(i|=(15&(r=e[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,i=function(t,i,r){var e="",s=i;for(;s>>10&1023|55296),u=56320|1023&u),e+=String.fromCharCode(u),s+=f}return e}(this.buf,this.pos,t);return this.pos=t,i},readBytes:function(){var t=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,t);return this.pos=t,i},readPackedVarint:function(t,i){var r=o(this);for(t=t||[];this.pos>>=7,n.buf[n.pos++]=127&s|128,s>>>=7,n.buf[n.pos++]=127&s|128,s>>>=7,n.buf[n.pos++]=127&s|128,s>>>=7,n.buf[n.pos]=127&s,function(t,i){var r=(7&t)<<4;if(i.buf[i.pos++]|=r|((t>>>=3)?128:0),!t)return;if(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),!t)return;i.buf[i.pos++]=127&t}(e,i);var s,n}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(127>>=7)|(127>>=7)|(127>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var i=this.pos;this.pos=function(t,i,r){for(var e,s,n=0;n>6|192:(t[r++]=e<65536?e>>12|224:(t[r++]=e>>18|240,e>>12&63|128),e>>6&63|128),63&e|128)}return r}(this.buf,t,this.pos);var r=this.pos-i;128<=r&&a(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),r(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),r(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var i=t.length;this.writeVarint(i),this.realloc(i);for(var r=0;r