{"version":3,"sources":["node_modules/@arcgis/core/layers/mixins/refresh.js","node_modules/@arcgis/core/layers/mixins/RefreshableLayer.js"],"sourcesContent":["/*\nAll material copyright ESRI, All Rights Reserved, unless otherwise specified.\nSee https://js.arcgis.com/4.31/esri/copyright.txt for details.\n*/\nimport e from \"../../core/Collection.js\";\nimport { sync as r } from \"../../core/reactiveUtils.js\";\nimport { autorun as t } from \"../../core/accessorSupport/trackingUtils.js\";\nconst n = new e(),\n o = new WeakMap();\nfunction f(e) {\n i(e) && n.push(new WeakRef(e));\n}\nfunction s(e) {\n const r = n.find(r => r.deref() === e);\n r && n.remove(r);\n}\nfunction i(e) {\n return null != e && \"object\" == typeof e && \"refreshInterval\" in e && \"refresh\" in e;\n}\nfunction c(e, r) {\n return Number.isFinite(e) && Number.isFinite(r) ? r <= 0 ? e : c(r, e % r) : 0;\n}\nlet l = 0,\n a = 0;\nfunction u() {\n const e = Date.now();\n let r = !1;\n for (const t of n) {\n const n = t.deref();\n if (n) {\n if (n.refreshInterval) {\n e - (o.get(n) ?? 0) + 5 >= 6e4 * n.refreshInterval && (o.set(n, e), n.refresh(e));\n }\n } else r = !0;\n }\n if (r) for (let t = n.length - 1; t >= 0; t--) {\n n.at(t).deref() || n.removeAt(t);\n }\n}\nt(() => {\n const e = Date.now();\n let r = 0;\n for (const t of n) {\n const n = t.deref();\n n && (r = c(Math.round(6e4 * n.refreshInterval), r), n.refreshInterval ? o.get(n) || o.set(n, e) : o.delete(n));\n }\n if (r !== a) {\n if (a = r, clearInterval(l), 0 === a) return void (l = 0);\n l = setInterval(u, a);\n }\n}, r);\nconst h = {\n get hasRefreshTimer() {\n return l > 0;\n },\n get tickInterval() {\n return a;\n },\n forceRefresh() {\n u();\n },\n hasLayer: e => i(e) && n.some(r => r.deref() === e),\n clear() {\n for (const e of n) {\n const r = e.deref();\n r && o.delete(r);\n }\n n.removeAll();\n }\n};\nexport { f as registerLayer, h as test, s as unregisterLayer };","/*\nAll material copyright ESRI, All Rights Reserved, unless otherwise specified.\nSee https://js.arcgis.com/4.31/esri/copyright.txt for details.\n*/\nimport { _ as e } from \"../../chunks/tslib.es6.js\";\nimport \"../../core/has.js\";\nimport r from \"../../core/Logger.js\";\nimport { debounce as s, ignoreAbortErrors as t } from \"../../core/promiseUtils.js\";\nimport { property as o } from \"../../core/accessorSupport/decorators/property.js\";\nimport { cast as a } from \"../../core/accessorSupport/decorators/cast.js\";\nimport \"../../core/RandomLCG.js\";\nimport { subclass as i } from \"../../core/accessorSupport/decorators/subclass.js\";\nimport { excludeTables as n } from \"../../core/accessorSupport/layerContainerType.js\";\nimport { registerLayer as h, unregisterLayer as p } from \"./refresh.js\";\nfunction m(e) {\n return null != e && \"object\" == typeof e && \"refreshTimestamp\" in e && \"refresh\" in e;\n}\nconst c = .1,\n f = m => {\n let f = class extends m {\n constructor(...e) {\n super(...e), this.refreshInterval = 0, this.refreshTimestamp = 0, this._debounceHasDataChanged = s(() => this.hasDataChanged()), this.when().then(() => {\n this.destroyed || h(this);\n }, () => {});\n }\n destroy() {\n p(this);\n }\n castRefreshInterval(e) {\n return e >= c ? e : e <= 0 ? 0 : c;\n }\n get refreshParameters() {\n return {\n _ts: this.refreshTimestamp || null\n };\n }\n refresh(e = Date.now()) {\n t(this._debounceHasDataChanged()).then(r => {\n r && this._set(\"refreshTimestamp\", e), this.emit(\"refresh\", {\n dataChanged: r\n });\n }, e => {\n r.getLogger(this).error(e), this.emit(\"refresh\", {\n dataChanged: !1,\n error: e\n });\n });\n }\n async hasDataChanged() {\n return !0;\n }\n get test() {}\n };\n return e([o({\n type: Number,\n json: {\n write: !0,\n origins: {\n \"web-scene\": {\n write: {\n enabled: !0,\n layerContainerTypes: n\n }\n }\n }\n }\n })], f.prototype, \"refreshInterval\", void 0), e([a(\"refreshInterval\")], f.prototype, \"castRefreshInterval\", null), e([o({\n readOnly: !0\n })], f.prototype, \"refreshTimestamp\", void 0), e([o({\n readOnly: !0\n })], f.prototype, \"refreshParameters\", null), f = e([i(\"esri.layers.mixins.RefreshableLayer\")], f), f;\n };\nexport { f as RefreshableLayer, m as isRefreshableLayer };"],"mappings":"yZAOA,IAAM,EAAI,IAAIA,EACZ,EAAI,IAAI,QACV,SAASC,EAAEC,EAAG,CACZC,EAAED,CAAC,GAAK,EAAE,KAAK,IAAI,QAAQA,CAAC,CAAC,CAC/B,CACA,SAASE,EAAEF,EAAG,CACZ,IAAMG,EAAI,EAAE,KAAKA,GAAKA,EAAE,MAAM,IAAMH,CAAC,EACrCG,GAAK,EAAE,OAAOA,CAAC,CACjB,CACA,SAASF,EAAED,EAAG,CACZ,OAAeA,GAAR,MAAyB,OAAOA,GAAnB,UAAwB,oBAAqBA,GAAK,YAAaA,CACrF,CACA,SAASI,EAAEJ,EAAGG,EAAG,CACf,OAAO,OAAO,SAASH,CAAC,GAAK,OAAO,SAASG,CAAC,EAAIA,GAAK,EAAIH,EAAII,EAAED,EAAGH,EAAIG,CAAC,EAAI,CAC/E,CACA,IAAIE,EAAI,EACNC,EAAI,EACN,SAASC,GAAI,CACX,IAAMP,EAAI,KAAK,IAAI,EACfG,EAAI,GACR,QAAWK,KAAK,EAAG,CACjB,IAAMC,EAAID,EAAE,MAAM,EACdC,EACEA,EAAE,iBACJT,GAAK,EAAE,IAAIS,CAAC,GAAK,GAAK,GAAK,IAAMA,EAAE,kBAAoB,EAAE,IAAIA,EAAGT,CAAC,EAAGS,EAAE,QAAQT,CAAC,GAE5EG,EAAI,EACb,CACA,GAAIA,EAAG,QAASK,EAAI,EAAE,OAAS,EAAGA,GAAK,EAAGA,IACxC,EAAE,GAAGA,CAAC,EAAE,MAAM,GAAK,EAAE,SAASA,CAAC,CAEnC,CACAP,EAAE,IAAM,CACN,IAAMD,EAAI,KAAK,IAAI,EACfG,EAAI,EACR,QAAWK,KAAK,EAAG,CACjB,IAAMC,EAAID,EAAE,MAAM,EAClBC,IAAMN,EAAIC,EAAE,KAAK,MAAM,IAAMK,EAAE,eAAe,EAAGN,CAAC,EAAGM,EAAE,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,CACL,QAAS,GACT,oBAAqBQ,CACvB,CACF,CACF,CACF,CACF,CAAC,CAAC,EAAGT,EAAE,UAAW,kBAAmB,MAAM,EAAGM,EAAE,CAACF,EAAE,iBAAiB,CAAC,EAAGJ,EAAE,UAAW,sBAAuB,IAAI,EAAGM,EAAE,CAACL,EAAE,CACtH,SAAU,EACZ,CAAC,CAAC,EAAGD,EAAE,UAAW,mBAAoB,MAAM,EAAGM,EAAE,CAACL,EAAE,CAClD,SAAU,EACZ,CAAC,CAAC,EAAGD,EAAE,UAAW,oBAAqB,IAAI,EAAGA,EAAIM,EAAE,CAACG,EAAE,qCAAqC,CAAC,EAAGT,CAAC,EAAGA,CACtG","names":["V","f","e","i","s","r","c","l","a","u","t","n","C","c","f","m","e","k","s","d","r","n","__async","a"],"x_google_ignoreList":[0,1]}