/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as t}from"tslib";import{property as e,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{getTimeOperator as i}from"../../../../layers/graphics/data/timeSupport.js";import n from"../../../../layers/support/FeatureFilter.js";import{combineTimeExtent as s}from"../../../../layers/support/timeSupport.js";import{getCachedAttributeValue as l}from"../i3s/I3SBinaryReader.js";import{filterInPlace as o}from"../i3s/I3SUtil.js";const u=i=>{const l=i;let o=class extends l{get timeExtent(){return s(this.i3slayer,this.view?.timeExtent,this._get("timeExtent"))}get mergedFilter(){const{filter:t,timeExtent:e}=this;if(null==e)return t;const r=t?.clone()??new n;return null!=e&&(r.timeExtent=r.timeExtent?.intersection(e)??e),r}getTimeFilterDependencies(){const{timeInfo:t}=this.i3slayer;if(null==t)return[];const{startField:e,endField:r}=t;return[e,r]}addTimeFilter(t,e){if(null==e)return;const{timeInfo:r}=this.i3slayer;if(null==r)return;const{startField:i,endField:n,useTime:s}=r;if(!s||null==i&&null==n)return;const l=r.toJSON(),o=e.toJSON();t.push((t,e)=>a(t,e,l,o))}};return t([e({readOnly:!0})],o.prototype,"timeExtent",null),t([e()],o.prototype,"mergedFilter",null),o=t([r("esri.views.3d.layers.support.TemporalSceneLayerView")],o),o};function a(t,e,r,n){const s=e.attributeInfo?.attributeData;if(null==s)return;const{startTimeField:l,endTimeField:u}=r;if(!!(null!=l&&null==s[l]||null!=u&&null==s[u]))return;const a=i(r,n,new m(s));if(null==a)return;const{featureIds:p}=e;o(t,p,a)}class m{constructor(t){this.attributeData=t}getAttribute(t,e){return l(this.attributeData[e],t)}getAttributeAsTimestamp(t,e){const r=this.getAttribute(t,e);return"string"==typeof r?new Date(r).getTime():"number"==typeof r||null==r?r:null}}export{u as TemporalSceneLayerView};
