/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","../../chunks/tslib.es6","../../core/Error","../../core/maybe","../../core/promiseUtils","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","../../renderers/support/clickToleranceUtils"],(function(e,r,t,o,a,n,s,c,i,u,l){"use strict";const p=s=>{let c=function(r){function n(){return r.apply(this,arguments)||this}return e._inheritsLoose(n,r),n.prototype.fetchPopupFeatures=function(){var r=e._asyncToGenerator((function*(r,n){var s=this;const{layer:c}=this;if(!r)throw new t("tilelayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:c});if("tile"!==c.type)throw new t("tilelayerview:fetchPopupFeatures","Layer type should be 'tile'",{type:c.type});const i=this.get("view.scale"),u=c.allSublayers.toArray().filter((e=>{const r=0===e.minScale||i<=e.minScale,t=0===e.maxScale||i>=e.maxScale;return e.popupTemplate&&e.popupEnabled&&e.visible&&r&&t}));return a.eachAlways(u.map(function(){var t=e._asyncToGenerator((function*(e){const t=e.createQuery(),a=o.isSome(n)?n.event:null,c=l.calculateTolerance({renderer:e.renderer,event:a});t.geometry=s.createFetchPopupFeaturesQueryGeometry(r,c),t.outFields=yield e.popupTemplate.getRequiredFields();return(yield e.queryFeatures(t)).features}));return function(e){return t.apply(this,arguments)}}())).then((e=>[].concat(...e.map((e=>e.value)).filter(Boolean))))}));function n(e,t){return r.apply(this,arguments)}return n}(),n}(s);return r.__decorate([n.property()],c.prototype,"layer",void 0),c=r.__decorate([u.subclass("esri.layers.mixins.TileLayerView")],c),c};return p}));
