123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- import {
- t as t2
- } from "./chunk-KOKTANE6.js";
- import {
- f,
- h as h2,
- l as l2
- } from "./chunk-TJV6ODRM.js";
- import {
- e,
- e3 as e2,
- l,
- m,
- n4 as n,
- n5 as n2,
- t2 as t,
- y3 as y
- } from "./chunk-2Z2TG5CU.js";
- import {
- $,
- C,
- a,
- p
- } from "./chunk-V6P2MAQQ.js";
- import {
- s2 as s
- } from "./chunk-E5O6P5I2.js";
- import {
- h,
- r
- } from "./chunk-YXWMMD76.js";
- // node_modules/@arcgis/core/layers/support/PromiseQueue.js
- var n3 = class {
- constructor() {
- this._tasks = new Array(), this._running = new t2(false);
- }
- get length() {
- return this._tasks.length;
- }
- get running() {
- return this._running.get();
- }
- destroy() {
- this.cancelAll();
- }
- runTask(s2) {
- for (; !s2.done && this._process(s2); )
- s2.madeProgress();
- }
- push(s2, t4, e3) {
- return this._running.set(true), new Promise((r2, n4) => this._tasks.push(new i(r2, n4, s2, t4, e3)));
- }
- unshift(s2, t4, e3) {
- return this._running.set(true), new Promise((r2, n4) => this._tasks.unshift(new i(r2, n4, s2, t4, e3)));
- }
- _process(r2) {
- var _a;
- if (0 === this._tasks.length)
- return false;
- const n4 = this._tasks.shift();
- try {
- const i2 = p(n4.signal);
- if (i2 && !n4.abortCallback)
- n4.reject(a());
- else {
- const s2 = i2 ? (_a = n4.abortCallback) == null ? void 0 : _a.call(n4, a()) : n4.callback(r2);
- C(s2) ? s2.then(n4.resolve, n4.reject) : n4.resolve(s2);
- }
- } catch (i2) {
- n4.reject(i2);
- }
- return this._running.set(this._tasks.length > 0), true;
- }
- cancelAll() {
- const s2 = a();
- for (const t4 of this._tasks)
- if (t4.abortCallback) {
- const e3 = t4.abortCallback(s2);
- t4.resolve(e3);
- } else
- t4.reject(s2);
- this._tasks.length = 0, this._running.set(false);
- }
- };
- var i = class {
- constructor(s2, t4, e3, r2, n4) {
- this.resolve = s2, this.reject = t4, this.callback = e3, this.signal = r2, this.abortCallback = n4;
- }
- };
- // node_modules/@arcgis/core/views/support/debugFlags.js
- var t3 = class extends m {
- constructor() {
- super(...arguments), this.SCHEDULER_LOG_SLOW_TASKS = false, this.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES = false;
- }
- };
- e([y()], t3.prototype, "SCHEDULER_LOG_SLOW_TASKS", void 0), e([y()], t3.prototype, "FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES", void 0), t3 = e([n2("esri.views.support.DebugFlags")], t3);
- var p2 = new t3();
- // node_modules/@arcgis/core/views/support/RenderState.js
- var I;
- !function(I3) {
- I3[I3.ANIMATING = 0] = "ANIMATING", I3[I3.INTERACTING = 1] = "INTERACTING", I3[I3.IDLE = 2] = "IDLE";
- }(I || (I = {}));
- // node_modules/@arcgis/core/views/support/Scheduler.js
- var I2;
- !function(e3) {
- e3.RESOURCE_CONTROLLER = "schedule", e3.SLIDE = "slide", e3.STREAM_DATA_LOADER = "stream loader", e3.ELEVATION_QUERY = "elevation query", e3.TERRAIN_SURFACE = "terrain", e3.SURFACE_GEOMETRY_UPDATES = "surface geometry updates", e3.GRAPHICS_CORE = "Graphics3D", e3.I3S_CONTROLLER = "I3S", e3.POINT_CLOUD_LAYER = "point cloud", e3.FEATURE_TILE_FETCHER = "feature fetcher", e3.OVERLAY = "overlay", e3.STAGE = "stage", e3.GRAPHICS_DECONFLICTOR = "graphics deconflictor", e3.FILTER_VISIBILITY = "Graphics3D filter visibility", e3.SCALE_VISIBILITY = "Graphics3D scale visibility", e3.FRUSTUM_VISIBILITY = "Graphics3D frustum visibility", e3.POINT_OF_INTEREST_FREQUENT = "POI frequent", e3.POINT_OF_INTEREST_INFREQUENT = "POI infrequent", e3.LABELER = "labeler", e3.FEATURE_QUERY_ENGINE = "feature query", e3.FEATURE_TILE_TREE = "feature tile tree", e3.FEATURE_TILE_TREE_ACTIVE = "fast feature tile tree", e3.ELEVATION_ALIGNMENT = "elevation alignment", e3.TEXT_TEXTURE_ATLAS = "text texture atlas", e3.TEXTURE_UNLOAD = "texture unload", e3.LINE_OF_SIGHT_TOOL = "line of sight tool", e3.LINE_OF_SIGHT_TOOL_INTERACTIVE = "interactive line of sight tool", e3.ELEVATION_PROFILE = "elevation profile", e3.SNAPPING = "snapping", e3.SHADOW_ACCUMULATOR = "shadow accumulator", e3.CLOUDS_GENERATOR = "cloud generator", e3[e3.TEST_PRIO = 1] = "TEST_PRIO";
- }(I2 || (I2 = {}));
- var R = 0;
- var p3 = /* @__PURE__ */ new Map([[I2.RESOURCE_CONTROLLER, R], [I2.SLIDE, R], [I2.STREAM_DATA_LOADER, R], [I2.ELEVATION_QUERY, R], [I2.TERRAIN_SURFACE, 1], [I2.SURFACE_GEOMETRY_UPDATES, 1], [I2.GRAPHICS_CORE, 2], [I2.I3S_CONTROLLER, 2], [I2.POINT_CLOUD_LAYER, 2], [I2.FEATURE_TILE_FETCHER, 2], [I2.OVERLAY, 4], [I2.STAGE, 4], [I2.GRAPHICS_DECONFLICTOR, 4], [I2.FILTER_VISIBILITY, 4], [I2.SCALE_VISIBILITY, 4], [I2.FRUSTUM_VISIBILITY, 4], [I2.CLOUDS_GENERATOR, 4], [I2.POINT_OF_INTEREST_FREQUENT, 6], [I2.POINT_OF_INTEREST_INFREQUENT, 30], [I2.LABELER, 8], [I2.FEATURE_QUERY_ENGINE, 8], [I2.FEATURE_TILE_TREE, 16], [I2.FEATURE_TILE_TREE_ACTIVE, R], [I2.ELEVATION_ALIGNMENT, 12], [I2.TEXT_TEXTURE_ATLAS, 12], [I2.TEXTURE_UNLOAD, 12], [I2.LINE_OF_SIGHT_TOOL, 16], [I2.LINE_OF_SIGHT_TOOL_INTERACTIVE, R], [I2.SNAPPING, R], [I2.SHADOW_ACCUMULATOR, 30]]);
- var f2 = 32;
- function A(e3) {
- return p3.has(e3) ? p3.get(e3) : "number" == typeof e3 ? e3 : 1;
- }
- var b = n(6.5);
- var L = n(1);
- var S = n(30);
- var k = n(1e3 / 30);
- var O = n(100);
- var U = 0.9;
- var N;
- var P;
- !function(n4) {
- class u {
- constructor() {
- this._updating = new t2(true), this._microTaskQueued = false, this._frameNumber = 0, this.performanceInfo = { total: new e2("total"), tasks: /* @__PURE__ */ new Map() }, this._frameTaskTimes = /* @__PURE__ */ new Map(), this._budget = new g(), this._state = I.INTERACTING, this._tasks = new l(), this._runQueue = new l(), this._load = 0, this._idleStateCallbacks = new l(), this._idleUpdatesStartFired = false, this._maxReschedule = f2, this._forceTask = false, this._debug = false, this._debugHandle = l2(() => p2.SCHEDULER_LOG_SLOW_TASKS, (e4) => this._debug = e4, h2);
- for (const t4 of Object.keys(I2))
- this.performanceInfo.tasks.set(I2[t4], new e2(I2[t4]));
- const e3 = this;
- this._test = { FRAME_SAFETY_BUDGET: b, INTERACTING_BUDGET: k, IDLE_BUDGET: O, get availableBudget() {
- return e3._budget.budget;
- }, usedBudget: 0, getBudget: () => e3._budget, setBudget: (t4) => e3._budget = t4, updateTask: (e4) => this._updateTask(e4), getState: (e4) => this._getState(e4), getRuntime: (e4) => this._getRuntime(e4), frameTaskTimes: this._frameTaskTimes, resetRuntimes: () => this._resetRuntimes(), getRunning: () => this._getRunning() };
- }
- get updating() {
- return this._updating.get();
- }
- set updating(e3) {
- this._updating.set(e3);
- }
- destroy() {
- this._tasks.toArray().forEach((e3) => e3.remove()), this._tasks.clear(), h(this._debugHandle), this._microTaskQueued = false, this._updating.set(false);
- }
- activate() {
- this._budget.done || this._microTaskQueued || (this._microTaskQueued = true, queueMicrotask(() => {
- this._microTaskQueued && (this._microTaskQueued = false, this._budget.done || (this._maxReschedule = f2, this._schedule(), this.frame()));
- }));
- }
- registerTask(e3, t4) {
- const s2 = A(e3), i2 = new _(this, e3, t4, s2);
- return this._tasks.push(i2), this.performanceInfo.tasks.has(e3) || this.performanceInfo.tasks.set(e3, new e2(e3)), i2;
- }
- registerIdleStateCallbacks(e3, t4) {
- const s2 = { idleBegin: e3, idleEnd: t4 };
- this._idleStateCallbacks.push(s2), this.state === I.IDLE && this._idleUpdatesStartFired && s2.idleBegin();
- const i2 = this;
- return { remove: () => this._removeIdleStateCallbacks(s2), set idleBegin(e4) {
- i2._idleUpdatesStartFired && (s2.idleEnd(), i2._state === I.IDLE && e4()), s2.idleBegin = e4;
- }, set idleEnd(e4) {
- s2.idleEnd = e4;
- } };
- }
- get load() {
- return this._load;
- }
- set state(e3) {
- this._state !== e3 && (this._state = e3, this.state !== I.IDLE && this._idleUpdatesStartFired && (this._idleUpdatesStartFired = false, this._idleStateCallbacks.forAll((e4) => e4.idleEnd())));
- }
- get state() {
- return this._state;
- }
- updateBudget(e3) {
- this._test.usedBudget = 0, ++this._frameNumber;
- let t4 = b, s2 = e3.frameDuration, i2 = L;
- switch (this.state) {
- case I.IDLE:
- t4 = n(0), s2 = n(Math.max(O, e3.frameDuration)), i2 = S;
- break;
- case I.INTERACTING:
- s2 = n(Math.max(k, e3.frameDuration));
- case I.ANIMATING:
- }
- return s2 = n(s2 - e3.elapsedFrameTime - t4), this.state !== I.IDLE && s2 < L && !this._forceTask ? (this._forceTask = true, false) : (s2 = n(Math.max(s2, i2)), this._budget.reset(s2, this.state), this._maxReschedule = f2, this._updateLoad(), this._schedule());
- }
- frame() {
- switch (this._forceTask = false, this._microTaskQueued = false, this.state) {
- case I.IDLE:
- this._idleUpdatesStartFired || (this._idleUpdatesStartFired = true, this._idleStateCallbacks.forAll((e3) => e3.idleBegin())), this._runIdle();
- break;
- case I.INTERACTING:
- this._runInteracting();
- break;
- default:
- this._runAnimating();
- }
- this._test.usedBudget = this._budget.elapsed;
- }
- stopFrame() {
- this._budget.reset(n(0), this._state), this._budget.madeProgress();
- }
- _removeIdleStateCallbacks(e3) {
- this._idleUpdatesStartFired && e3.idleEnd(), this._idleStateCallbacks.removeUnordered(e3);
- }
- removeTask(e3) {
- this._tasks.removeUnordered(e3), this._runQueue.removeUnordered(e3);
- }
- _updateTask(e3) {
- this._tasks.forAll((t4) => {
- t4.name === e3 && t4.setPriority(e3);
- });
- }
- _getState(e3) {
- if (this._runQueue.some((t5) => t5.name === e3))
- return P.SCHEDULED;
- let t4 = P.IDLE;
- return this._tasks.forAll((s2) => {
- s2.name === e3 && s2.needsUpdate && (s2.schedulePriority <= 1 ? t4 = P.READY : t4 !== P.READY && (t4 = P.WAITING));
- }), t4;
- }
- _getRuntime(e3) {
- let t4 = 0;
- return this._tasks.forAll((s2) => {
- s2.name === e3 && (t4 += s2.runtime);
- }), t4;
- }
- _resetRuntimes() {
- this._tasks.forAll((e3) => e3.runtime = 0);
- }
- _getRunning() {
- const e3 = /* @__PURE__ */ new Map();
- if (this._tasks.forAll((t5) => {
- t5.needsUpdate && e3.set(t5.name, (e3.get(t5.name) || 0) + 1);
- }), 0 === e3.size)
- return null;
- let t4 = "";
- return e3.forEach((e4, s2) => {
- t4 += e4 > 1 ? ` ${e4}x ${s2}` : ` ${s2}`;
- }), t4;
- }
- _runIdle() {
- this._run();
- }
- _runInteracting() {
- this._run();
- }
- _runAnimating() {
- this._run();
- }
- _updateLoad() {
- const e3 = this._tasks.reduce((e4, t4) => t4.needsUpdate ? ++e4 : e4, 0);
- this._load = this._load * U + e3 * (1 - U);
- }
- _schedule() {
- if (this._maxReschedule <= 0)
- return false;
- for (this._runQueue.filterInPlace((e3) => !!e3.needsUpdate || (e3.schedulePriority = e3.basePriority, false)), this._tasks.forAll((e3) => {
- e3.basePriority === R && e3.needsUpdate && !this._runQueue.includes(e3) && this._runQueue.unshift(e3);
- }); 0 === this._runQueue.length; ) {
- let e3 = false, t4 = 0;
- if (this._tasks.forAll((s2) => {
- if (s2.needsUpdate && 0 !== s2.schedulePriority && s2.basePriority !== R && (!s2.task.runOncePerFrame || s2.lastFrameRun !== this._frameNumber))
- if (e3 = true, t4 = Math.max(t4, s2.basePriority), 1 === s2.schedulePriority)
- s2.schedulePriority = 0, this._runQueue.push(s2);
- else
- --s2.schedulePriority;
- }), !e3)
- return this._updating.set(false), false;
- --this._maxReschedule;
- }
- return this._updating.set(true), true;
- }
- _run() {
- const e3 = this._budget.now();
- this._startFrameTaskTimes();
- do {
- for (; this._runQueue.length > 0; ) {
- const i2 = this._budget.now(), r2 = this._runQueue.pop();
- this._budget.resetProgress();
- try {
- r2.task.runTask(this._budget);
- } catch (s2) {
- s.getLogger("esri.views.support.Scheduler").error(`Exception in task "${r2.name}"`, s2);
- }
- r2.schedulePriority = r2.basePriority, r2.lastFrameRun = this._frameNumber;
- const a2 = this._budget.now() - i2;
- if (r2.runtime += a2, this._frameTaskTimes.set(r2.priority, this._frameTaskTimes.get(r2.priority) + a2), this._debug && this._budget.elapsed > 2 * this._budget.budget && console.log("Task", r2.name, "used", this._budget.elapsed, "of max", this._budget.budget, "ms"), this._budget.remaining <= 0)
- return this._updating.set(this._tasks.some((e4) => e4.needsUpdate)), void this._recordFrameTaskTimes(this._budget.now() - e3);
- }
- } while (this._schedule());
- this._updating.set(this._tasks.some((e4) => e4.needsUpdate)), this._recordFrameTaskTimes(this._budget.now() - e3);
- }
- _startFrameTaskTimes() {
- for (const e3 of Object.keys(I2))
- this._frameTaskTimes.set(I2[e3], 0);
- }
- _recordFrameTaskTimes(e3) {
- this._frameTaskTimes.forEach((e4, t4) => this.performanceInfo.tasks.get(t4).record(e4)), this.performanceInfo.total.record(e3);
- }
- get test() {
- return this._test;
- }
- }
- n4.Scheduler = u;
- class _ {
- constructor(t4, s2, r2, a2) {
- this._scheduler = t4, this.name = s2, this._basePriority = a2, this.lastFrameRun = 0, this.runtime = 0, this._queue = new n3(), this._handles = new t(), this.schedulePriority = this._basePriority, this._task = new t2(r(r2) ? r2 : this._queue), this._handles.add(f(() => this.task.running, () => t4.activate()));
- }
- get task() {
- return this._task.get();
- }
- get updating() {
- return this._queue.running;
- }
- remove() {
- this.processQueue(F), this._scheduler.removeTask(this), this.schedule = y2.schedule, this.reschedule = y2.reschedule, this._handles.destroy();
- }
- get basePriority() {
- return this._basePriority;
- }
- setPriority(e3) {
- this.name = e3;
- const t4 = A(e3);
- this._basePriority !== R && 0 === this.schedulePriority || (this.schedulePriority = t4), this._basePriority = t4;
- }
- get priority() {
- return this.name;
- }
- set priority(e3) {
- this.setPriority(e3);
- }
- get needsUpdate() {
- return this.updating || this.task.running;
- }
- schedule(e3, t4, s2) {
- return this._queue.push(e3, t4, s2);
- }
- reschedule(e3, t4, s2) {
- return this._queue.unshift(e3, t4, s2);
- }
- processQueue(e3) {
- this._queue.runTask(e3);
- }
- }
- class g {
- constructor() {
- this._begin = "undefined" != typeof performance ? performance.now() : 0, this._budget = 0, this._state = I.IDLE, this._done = false, this._enabled = true;
- }
- run(e3) {
- return !this.done && (true === e3() && this.madeProgress(), true);
- }
- get done() {
- return this._done;
- }
- get budget() {
- return this._budget;
- }
- madeProgress() {
- this._done = this.elapsed >= this._budget && this._enabled;
- }
- get state() {
- return this._state;
- }
- get enabled() {
- return this._enabled;
- }
- set enabled(e3) {
- this._enabled = e3;
- }
- reset(e3, t4) {
- this._begin = this.now(), this._budget = e3, this._state = t4, this._done = false;
- }
- get remaining() {
- return Math.max(this._budget - this.elapsed, 0);
- }
- now() {
- return performance.now();
- }
- get elapsed() {
- return performance.now() - this._begin;
- }
- resetProgress() {
- this._done = false;
- }
- get hasProgressed() {
- return this._done;
- }
- }
- n4.Budget = g;
- }(N || (N = {})), function(e3) {
- e3.SCHEDULED = "s", e3.READY = "r", e3.WAITING = "w", e3.IDLE = "i";
- }(P || (P = {}));
- var F = (() => {
- const e3 = new N.Budget();
- return e3.enabled = false, e3;
- })();
- var C2 = class {
- remove() {
- }
- processQueue() {
- }
- schedule(e3, t4, s2) {
- try {
- if (p(t4)) {
- const e4 = a();
- return s2 ? Promise.resolve(s2(e4)) : Promise.reject(e4);
- }
- return $(e3(F));
- } catch (i2) {
- return Promise.reject(i2);
- }
- }
- reschedule(e3, t4, s2) {
- return this.schedule(e3, t4, s2);
- }
- };
- var y2 = new C2();
- export {
- I2 as I,
- F,
- y2 as y
- };
- //# sourceMappingURL=chunk-B5O7N7PM.js.map
|