// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/Identifiable ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass".split(" "),function(h,f,u,k,w,x,y,v){var p;f=p=class extends u.NumericIdentifiableMixin(f){constructor(a){super(a);this._lodByScale={};this._scales=[];this.effectiveLODs=null;this.effectiveMaxZoom=this.effectiveMinZoom=-1;this.effectiveMaxScale=this.effectiveMinScale= 0;this.lods=null;this.maxZoom=this.minZoom=-1;this.maxScale=this.minScale=0;this.snapToZoom=!0}initialize(){let {lods:a,minScale:b,maxScale:c,minZoom:e,maxZoom:d}=this,l=-1,m=-1,q=!1,r=!1;0!==b&&0!==c&&bg.clone());a.sort((g,n)=>n.scale-g.scale);a.forEach((g,n)=>g.level=n);for(const g of a){!q&&0=g.scale&&(l=g.level,q=!0);!r&&0=g.scale&&(m=t?t.level:-1,r=!0);var t=g}-1===e&&(e=0===b?0:l);-1===d&&(d=0===c?a.length-1:m);e=Math.max(e,0);e=Math.min(e, a.length-1);d=Math.max(d,0);d=Math.min(d,a.length-1);e>d&&([e,d]=[d,e]);b=a[e].scale;c=a[d].scale;a.splice(0,e);a.splice(d-e+1,a.length);a.forEach((g,n)=>{this._lodByScale[g.scale]=g;this._scales[n]=g.scale});this._set("effectiveLODs",a);this._set("effectiveMinZoom",e);this._set("effectiveMaxZoom",d)}this._set("effectiveMinScale",b);this._set("effectiveMaxScale",c)}constrain(a,b){if(b&&a.scale===b.scale)return a;var c=this.effectiveMinScale;const e=this.effectiveMaxScale,d=a.targetGeometry,l=b&&b.targetGeometry, m=0!==c&&a.scale>c;if(0!==e&&a.scale=a)return b[0];if(a>=b.length)return b[b.length-1];const c=Math.floor(a);return b[c]+(a-c)*(b[Math.ceil(a)]-b[c])}scaleToZoom(a){if(!this.effectiveLODs)return-1;const b=this._scales;let c,e;if(a>=b[0])return this.effectiveMinZoom;if(a<=b[b.length-1])return this.effectiveMaxZoom;for(let d=0;da&&eMath.abs(c-a)<=Math.abs(b-a)?c:b,this._scales[0]);return this._lodByScale[a].scale}};h.__decorate([k.property({readOnly:!0})],f.prototype,"effectiveLODs",void 0);h.__decorate([k.property({readOnly:!0})],f.prototype,"effectiveMinZoom",void 0);h.__decorate([k.property({readOnly:!0})],f.prototype,"effectiveMaxZoom",void 0);h.__decorate([k.property({readOnly:!0})],f.prototype,"effectiveMinScale",void 0);h.__decorate([k.property({readOnly:!0})],f.prototype,"effectiveMaxScale", void 0);h.__decorate([k.property()],f.prototype,"lods",void 0);h.__decorate([k.property()],f.prototype,"minZoom",void 0);h.__decorate([k.property()],f.prototype,"maxZoom",void 0);h.__decorate([k.property()],f.prototype,"minScale",void 0);h.__decorate([k.property()],f.prototype,"maxScale",void 0);h.__decorate([k.property()],f.prototype,"snapToZoom",void 0);return f=p=h.__decorate([v.subclass("esri.views.2d.constraints.ZoomConstraint")],f)});