@spscommerce/positioning 8.56.1 → 8.56.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,696 +1,649 @@
1
- import { onNextTick as j, lockedToAnimationFrames as U } from "@spscommerce/utils";
2
- var S = /* @__PURE__ */ ((d) => (d.TOP_LEFT = "top left", d.TOP_MIDDLE = "top middle", d.TOP_RIGHT = "top right", d.RIGHT_TOP = "right top", d.RIGHT_MIDDLE = "right middle", d.RIGHT_BOTTOM = "right bottom", d.BOTTOM_RIGHT = "bottom right", d.BOTTOM_MIDDLE = "bottom middle", d.BOTTOM_LEFT = "bottom left", d.LEFT_BOTTOM = "left bottom", d.LEFT_MIDDLE = "left middle", d.LEFT_TOP = "left top", d))(S || {}), M = /* @__PURE__ */ ((d) => (d.TOP_LEFT = "top left", d.TOP_RIGHT = "top right", d.BOTTOM_LEFT = "bottom left", d.BOTTOM_RIGHT = "bottom right", d))(M || {});
3
- const V = {
4
- anchor: M.TOP_LEFT,
5
- offsets: [],
6
- position: S.TOP_LEFT
1
+ import { lockedToAnimationFrames as e, onNextTick as t } from "@spscommerce/utils";
2
+ //#region \0rolldown/runtime.js
3
+ var n = Object.create, r = Object.defineProperty, i = Object.getOwnPropertyDescriptor, a = Object.getOwnPropertyNames, o = Object.getPrototypeOf, s = Object.prototype.hasOwnProperty, c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), l = (e, t, n, o) => {
4
+ if (t && typeof t == "object" || typeof t == "function") for (var c = a(t), l = 0, u = c.length, d; l < u; l++) d = c[l], !s.call(e, d) && d !== n && r(e, d, {
5
+ get: ((e) => t[e]).bind(null, d),
6
+ enumerable: !(o = i(t, d)) || o.enumerable
7
+ });
8
+ return e;
9
+ }, u = (e, t, i) => (i = e == null ? {} : n(o(e)), l(t || !e || !e.__esModule || !s.call(e, "default") ? r(i, "default", {
10
+ value: e,
11
+ enumerable: !0
12
+ }) : i, e)), d = /* @__PURE__ */ function(e) {
13
+ return e.TOP_LEFT = "top left", e.TOP_MIDDLE = "top middle", e.TOP_RIGHT = "top right", e.RIGHT_TOP = "right top", e.RIGHT_MIDDLE = "right middle", e.RIGHT_BOTTOM = "right bottom", e.BOTTOM_RIGHT = "bottom right", e.BOTTOM_MIDDLE = "bottom middle", e.BOTTOM_LEFT = "bottom left", e.LEFT_BOTTOM = "left bottom", e.LEFT_MIDDLE = "left middle", e.LEFT_TOP = "left top", e;
14
+ }({}), f = /* @__PURE__ */ function(e) {
15
+ return e.TOP_LEFT = "top left", e.TOP_RIGHT = "top right", e.BOTTOM_LEFT = "bottom left", e.BOTTOM_RIGHT = "bottom right", e;
16
+ }({}), p = {
17
+ anchor: f.TOP_LEFT,
18
+ offsets: [],
19
+ position: d.TOP_LEFT
7
20
  };
8
- function q(d) {
9
- return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
21
+ //#endregion
22
+ //#region ../../node_modules/.pnpm/intersection-observer@0.12.0/node_modules/intersection-observer/intersection-observer.js
23
+ (function() {
24
+ if (typeof window != "object") return;
25
+ if ("IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype) {
26
+ "isIntersecting" in window.IntersectionObserverEntry.prototype || Object.defineProperty(window.IntersectionObserverEntry.prototype, "isIntersecting", { get: function() {
27
+ return this.intersectionRatio > 0;
28
+ } });
29
+ return;
30
+ }
31
+ function e(e) {
32
+ try {
33
+ return e.defaultView && e.defaultView.frameElement || null;
34
+ } catch {
35
+ return null;
36
+ }
37
+ }
38
+ var t = (function(t) {
39
+ for (var n = t, r = e(n); r;) n = r.ownerDocument, r = e(n);
40
+ return n;
41
+ })(window.document), n = [], r = null, i = null;
42
+ function a(e) {
43
+ this.time = e.time, this.target = e.target, this.rootBounds = m(e.rootBounds), this.boundingClientRect = m(e.boundingClientRect), this.intersectionRect = m(e.intersectionRect || p()), this.isIntersecting = !!e.intersectionRect;
44
+ var t = this.boundingClientRect, n = t.width * t.height, r = this.intersectionRect, i = r.width * r.height;
45
+ this.intersectionRatio = n ? Number((i / n).toFixed(4)) : +!!this.isIntersecting;
46
+ }
47
+ function o(e, t) {
48
+ var n = t || {};
49
+ if (typeof e != "function") throw Error("callback must be a function");
50
+ if (n.root && n.root.nodeType != 1 && n.root.nodeType != 9) throw Error("root must be a Document or Element");
51
+ this._checkForIntersections = c(this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT), this._callback = e, this._observationTargets = [], this._queuedEntries = [], this._rootMarginValues = this._parseRootMargin(n.rootMargin), this.thresholds = this._initThresholds(n.threshold), this.root = n.root || null, this.rootMargin = this._rootMarginValues.map(function(e) {
52
+ return e.value + e.unit;
53
+ }).join(" "), this._monitoringDocuments = [], this._monitoringUnsubscribes = [];
54
+ }
55
+ o.prototype.THROTTLE_TIMEOUT = 100, o.prototype.POLL_INTERVAL = null, o.prototype.USE_MUTATION_OBSERVER = !0, o._setupCrossOriginUpdater = function() {
56
+ return r ||= function(e, t) {
57
+ i = !e || !t ? p() : h(e, t), n.forEach(function(e) {
58
+ e._checkForIntersections();
59
+ });
60
+ }, r;
61
+ }, o._resetCrossOriginUpdater = function() {
62
+ r = null, i = null;
63
+ }, o.prototype.observe = function(e) {
64
+ if (!this._observationTargets.some(function(t) {
65
+ return t.element == e;
66
+ })) {
67
+ if (!(e && e.nodeType == 1)) throw Error("target must be an Element");
68
+ this._registerInstance(), this._observationTargets.push({
69
+ element: e,
70
+ entry: null
71
+ }), this._monitorIntersections(e.ownerDocument), this._checkForIntersections();
72
+ }
73
+ }, o.prototype.unobserve = function(e) {
74
+ this._observationTargets = this._observationTargets.filter(function(t) {
75
+ return t.element != e;
76
+ }), this._unmonitorIntersections(e.ownerDocument), this._observationTargets.length == 0 && this._unregisterInstance();
77
+ }, o.prototype.disconnect = function() {
78
+ this._observationTargets = [], this._unmonitorAllIntersections(), this._unregisterInstance();
79
+ }, o.prototype.takeRecords = function() {
80
+ var e = this._queuedEntries.slice();
81
+ return this._queuedEntries = [], e;
82
+ }, o.prototype._initThresholds = function(e) {
83
+ var t = e || [0];
84
+ return Array.isArray(t) || (t = [t]), t.sort().filter(function(e, t, n) {
85
+ if (typeof e != "number" || isNaN(e) || e < 0 || e > 1) throw Error("threshold must be a number between 0 and 1 inclusively");
86
+ return e !== n[t - 1];
87
+ });
88
+ }, o.prototype._parseRootMargin = function(e) {
89
+ var t = (e || "0px").split(/\s+/).map(function(e) {
90
+ var t = /^(-?\d*\.?\d+)(px|%)$/.exec(e);
91
+ if (!t) throw Error("rootMargin must be specified in pixels or percent");
92
+ return {
93
+ value: parseFloat(t[1]),
94
+ unit: t[2]
95
+ };
96
+ });
97
+ return t[1] = t[1] || t[0], t[2] = t[2] || t[0], t[3] = t[3] || t[1], t;
98
+ }, o.prototype._monitorIntersections = function(n) {
99
+ var r = n.defaultView;
100
+ if (r && this._monitoringDocuments.indexOf(n) == -1) {
101
+ var i = this._checkForIntersections, a = null, o = null;
102
+ if (this.POLL_INTERVAL ? a = r.setInterval(i, this.POLL_INTERVAL) : (l(r, "resize", i, !0), l(n, "scroll", i, !0), this.USE_MUTATION_OBSERVER && "MutationObserver" in r && (o = new r.MutationObserver(i), o.observe(n, {
103
+ attributes: !0,
104
+ childList: !0,
105
+ characterData: !0,
106
+ subtree: !0
107
+ }))), this._monitoringDocuments.push(n), this._monitoringUnsubscribes.push(function() {
108
+ var e = n.defaultView;
109
+ e && (a && e.clearInterval(a), u(e, "resize", i, !0)), u(n, "scroll", i, !0), o && o.disconnect();
110
+ }), n != (this.root && (this.root.ownerDocument || this.root) || t)) {
111
+ var s = e(n);
112
+ s && this._monitorIntersections(s.ownerDocument);
113
+ }
114
+ }
115
+ }, o.prototype._unmonitorIntersections = function(n) {
116
+ var r = this._monitoringDocuments.indexOf(n);
117
+ if (r != -1) {
118
+ var i = this.root && (this.root.ownerDocument || this.root) || t;
119
+ if (!this._observationTargets.some(function(t) {
120
+ var r = t.element.ownerDocument;
121
+ if (r == n) return !0;
122
+ for (; r && r != i;) {
123
+ var a = e(r);
124
+ if (r = a && a.ownerDocument, r == n) return !0;
125
+ }
126
+ return !1;
127
+ })) {
128
+ var a = this._monitoringUnsubscribes[r];
129
+ if (this._monitoringDocuments.splice(r, 1), this._monitoringUnsubscribes.splice(r, 1), a(), n != i) {
130
+ var o = e(n);
131
+ o && this._unmonitorIntersections(o.ownerDocument);
132
+ }
133
+ }
134
+ }
135
+ }, o.prototype._unmonitorAllIntersections = function() {
136
+ var e = this._monitoringUnsubscribes.slice(0);
137
+ this._monitoringDocuments.length = 0, this._monitoringUnsubscribes.length = 0;
138
+ for (var t = 0; t < e.length; t++) e[t]();
139
+ }, o.prototype._checkForIntersections = function() {
140
+ if (this.root || !r || i) {
141
+ var e = this._rootIsInDom(), t = e ? this._getRootRect() : p();
142
+ this._observationTargets.forEach(function(n) {
143
+ var i = n.element, o = f(i), c = this._rootContainsTarget(i), l = n.entry, u = e && c && this._computeTargetAndRootIntersection(i, o, t), d = null;
144
+ this._rootContainsTarget(i) ? (!r || this.root) && (d = t) : d = p();
145
+ var m = n.entry = new a({
146
+ time: s(),
147
+ target: i,
148
+ boundingClientRect: o,
149
+ rootBounds: d,
150
+ intersectionRect: u
151
+ });
152
+ l ? e && c ? this._hasCrossedThreshold(l, m) && this._queuedEntries.push(m) : l && l.isIntersecting && this._queuedEntries.push(m) : this._queuedEntries.push(m);
153
+ }, this), this._queuedEntries.length && this._callback(this.takeRecords(), this);
154
+ }
155
+ }, o.prototype._computeTargetAndRootIntersection = function(e, n, a) {
156
+ if (window.getComputedStyle(e).display != "none") {
157
+ for (var o = n, s = _(e), c = !1; !c && s;) {
158
+ var l = null, u = s.nodeType == 1 ? window.getComputedStyle(s) : {};
159
+ if (u.display == "none") return null;
160
+ if (s == this.root || s.nodeType == 9) {
161
+ if (c = !0, s == this.root || s == t) r && !this.root ? !i || i.width == 0 && i.height == 0 ? (s = null, l = null, o = null) : l = i : l = a;
162
+ else {
163
+ var p = _(s), m = p && f(p), g = p && this._computeTargetAndRootIntersection(p, m, a);
164
+ m && g ? (s = p, l = h(m, g)) : (s = null, o = null);
165
+ }
166
+ } else {
167
+ var v = s.ownerDocument;
168
+ s != v.body && s != v.documentElement && u.overflow != "visible" && (l = f(s));
169
+ }
170
+ if (l && (o = d(l, o)), !o) break;
171
+ s &&= _(s);
172
+ }
173
+ return o;
174
+ }
175
+ }, o.prototype._getRootRect = function() {
176
+ var e;
177
+ if (this.root && !v(this.root)) e = f(this.root);
178
+ else {
179
+ var n = v(this.root) ? this.root : t, r = n.documentElement, i = n.body;
180
+ e = {
181
+ top: 0,
182
+ left: 0,
183
+ right: r.clientWidth || i.clientWidth,
184
+ width: r.clientWidth || i.clientWidth,
185
+ bottom: r.clientHeight || i.clientHeight,
186
+ height: r.clientHeight || i.clientHeight
187
+ };
188
+ }
189
+ return this._expandRectByRootMargin(e);
190
+ }, o.prototype._expandRectByRootMargin = function(e) {
191
+ var t = this._rootMarginValues.map(function(t, n) {
192
+ return t.unit == "px" ? t.value : t.value * (n % 2 ? e.width : e.height) / 100;
193
+ }), n = {
194
+ top: e.top - t[0],
195
+ right: e.right + t[1],
196
+ bottom: e.bottom + t[2],
197
+ left: e.left - t[3]
198
+ };
199
+ return n.width = n.right - n.left, n.height = n.bottom - n.top, n;
200
+ }, o.prototype._hasCrossedThreshold = function(e, t) {
201
+ var n = e && e.isIntersecting ? e.intersectionRatio || 0 : -1, r = t.isIntersecting ? t.intersectionRatio || 0 : -1;
202
+ if (n !== r) for (var i = 0; i < this.thresholds.length; i++) {
203
+ var a = this.thresholds[i];
204
+ if (a == n || a == r || a < n != a < r) return !0;
205
+ }
206
+ }, o.prototype._rootIsInDom = function() {
207
+ return !this.root || g(t, this.root);
208
+ }, o.prototype._rootContainsTarget = function(e) {
209
+ var n = this.root && (this.root.ownerDocument || this.root) || t;
210
+ return g(n, e) && (!this.root || n == e.ownerDocument);
211
+ }, o.prototype._registerInstance = function() {
212
+ n.indexOf(this) < 0 && n.push(this);
213
+ }, o.prototype._unregisterInstance = function() {
214
+ var e = n.indexOf(this);
215
+ e != -1 && n.splice(e, 1);
216
+ };
217
+ function s() {
218
+ return window.performance && performance.now && performance.now();
219
+ }
220
+ function c(e, t) {
221
+ var n = null;
222
+ return function() {
223
+ n ||= setTimeout(function() {
224
+ e(), n = null;
225
+ }, t);
226
+ };
227
+ }
228
+ function l(e, t, n, r) {
229
+ typeof e.addEventListener == "function" ? e.addEventListener(t, n, r || !1) : typeof e.attachEvent == "function" && e.attachEvent("on" + t, n);
230
+ }
231
+ function u(e, t, n, r) {
232
+ typeof e.removeEventListener == "function" ? e.removeEventListener(t, n, r || !1) : typeof e.detatchEvent == "function" && e.detatchEvent("on" + t, n);
233
+ }
234
+ function d(e, t) {
235
+ var n = Math.max(e.top, t.top), r = Math.min(e.bottom, t.bottom), i = Math.max(e.left, t.left), a = Math.min(e.right, t.right), o = a - i, s = r - n;
236
+ return o >= 0 && s >= 0 && {
237
+ top: n,
238
+ bottom: r,
239
+ left: i,
240
+ right: a,
241
+ width: o,
242
+ height: s
243
+ } || null;
244
+ }
245
+ function f(e) {
246
+ var t;
247
+ try {
248
+ t = e.getBoundingClientRect();
249
+ } catch {}
250
+ return t ? (t.width && t.height || (t = {
251
+ top: t.top,
252
+ right: t.right,
253
+ bottom: t.bottom,
254
+ left: t.left,
255
+ width: t.right - t.left,
256
+ height: t.bottom - t.top
257
+ }), t) : p();
258
+ }
259
+ function p() {
260
+ return {
261
+ top: 0,
262
+ bottom: 0,
263
+ left: 0,
264
+ right: 0,
265
+ width: 0,
266
+ height: 0
267
+ };
268
+ }
269
+ function m(e) {
270
+ return !e || "x" in e ? e : {
271
+ top: e.top,
272
+ y: e.top,
273
+ bottom: e.bottom,
274
+ left: e.left,
275
+ x: e.left,
276
+ right: e.right,
277
+ width: e.width,
278
+ height: e.height
279
+ };
280
+ }
281
+ function h(e, t) {
282
+ var n = t.top - e.top, r = t.left - e.left;
283
+ return {
284
+ top: n,
285
+ left: r,
286
+ height: t.height,
287
+ width: t.width,
288
+ bottom: n + t.height,
289
+ right: r + t.width
290
+ };
291
+ }
292
+ function g(e, t) {
293
+ for (var n = t; n;) {
294
+ if (n == e) return !0;
295
+ n = _(n);
296
+ }
297
+ return !1;
298
+ }
299
+ function _(n) {
300
+ var r = n.parentNode;
301
+ return n.nodeType == 9 && n != t ? e(n) : (r && r.assignedSlot && (r = r.assignedSlot.parentNode), r && r.nodeType == 11 && r.host ? r.host : r);
302
+ }
303
+ function v(e) {
304
+ return e && e.nodeType === 9;
305
+ }
306
+ window.IntersectionObserver = o, window.IntersectionObserverEntry = a;
307
+ })();
308
+ //#endregion
309
+ //#region ../../node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.mjs
310
+ var m = /* @__PURE__ */ u((/* @__PURE__ */ c(((e, t) => {
311
+ var n = Object.prototype.hasOwnProperty, r = "~";
312
+ function i() {}
313
+ Object.create && (i.prototype = Object.create(null), new i().__proto__ || (r = !1));
314
+ function a(e, t, n) {
315
+ this.fn = e, this.context = t, this.once = n || !1;
316
+ }
317
+ function o(e, t, n, i, o) {
318
+ if (typeof n != "function") throw TypeError("The listener must be a function");
319
+ var s = new a(n, i || e, o), c = r ? r + t : t;
320
+ return e._events[c] ? e._events[c].fn ? e._events[c] = [e._events[c], s] : e._events[c].push(s) : (e._events[c] = s, e._eventsCount++), e;
321
+ }
322
+ function s(e, t) {
323
+ --e._eventsCount === 0 ? e._events = new i() : delete e._events[t];
324
+ }
325
+ function c() {
326
+ this._events = new i(), this._eventsCount = 0;
327
+ }
328
+ c.prototype.eventNames = function() {
329
+ var e = [], t, i;
330
+ if (this._eventsCount === 0) return e;
331
+ for (i in t = this._events) n.call(t, i) && e.push(r ? i.slice(1) : i);
332
+ return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(t)) : e;
333
+ }, c.prototype.listeners = function(e) {
334
+ var t = r ? r + e : e, n = this._events[t];
335
+ if (!n) return [];
336
+ if (n.fn) return [n.fn];
337
+ for (var i = 0, a = n.length, o = Array(a); i < a; i++) o[i] = n[i].fn;
338
+ return o;
339
+ }, c.prototype.listenerCount = function(e) {
340
+ var t = r ? r + e : e, n = this._events[t];
341
+ return n ? n.fn ? 1 : n.length : 0;
342
+ }, c.prototype.emit = function(e, t, n, i, a, o) {
343
+ var s = r ? r + e : e;
344
+ if (!this._events[s]) return !1;
345
+ var c = this._events[s], l = arguments.length, u, d;
346
+ if (c.fn) {
347
+ switch (c.once && this.removeListener(e, c.fn, void 0, !0), l) {
348
+ case 1: return c.fn.call(c.context), !0;
349
+ case 2: return c.fn.call(c.context, t), !0;
350
+ case 3: return c.fn.call(c.context, t, n), !0;
351
+ case 4: return c.fn.call(c.context, t, n, i), !0;
352
+ case 5: return c.fn.call(c.context, t, n, i, a), !0;
353
+ case 6: return c.fn.call(c.context, t, n, i, a, o), !0;
354
+ }
355
+ for (d = 1, u = Array(l - 1); d < l; d++) u[d - 1] = arguments[d];
356
+ c.fn.apply(c.context, u);
357
+ } else {
358
+ var f = c.length, p;
359
+ for (d = 0; d < f; d++) switch (c[d].once && this.removeListener(e, c[d].fn, void 0, !0), l) {
360
+ case 1:
361
+ c[d].fn.call(c[d].context);
362
+ break;
363
+ case 2:
364
+ c[d].fn.call(c[d].context, t);
365
+ break;
366
+ case 3:
367
+ c[d].fn.call(c[d].context, t, n);
368
+ break;
369
+ case 4:
370
+ c[d].fn.call(c[d].context, t, n, i);
371
+ break;
372
+ default:
373
+ if (!u) for (p = 1, u = Array(l - 1); p < l; p++) u[p - 1] = arguments[p];
374
+ c[d].fn.apply(c[d].context, u);
375
+ }
376
+ }
377
+ return !0;
378
+ }, c.prototype.on = function(e, t, n) {
379
+ return o(this, e, t, n, !1);
380
+ }, c.prototype.once = function(e, t, n) {
381
+ return o(this, e, t, n, !0);
382
+ }, c.prototype.removeListener = function(e, t, n, i) {
383
+ var a = r ? r + e : e;
384
+ if (!this._events[a]) return this;
385
+ if (!t) return s(this, a), this;
386
+ var o = this._events[a];
387
+ if (o.fn) o.fn === t && (!i || o.once) && (!n || o.context === n) && s(this, a);
388
+ else {
389
+ for (var c = 0, l = [], u = o.length; c < u; c++) (o[c].fn !== t || i && !o[c].once || n && o[c].context !== n) && l.push(o[c]);
390
+ l.length ? this._events[a] = l.length === 1 ? l[0] : l : s(this, a);
391
+ }
392
+ return this;
393
+ }, c.prototype.removeAllListeners = function(e) {
394
+ var t;
395
+ return e ? (t = r ? r + e : e, this._events[t] && s(this, t)) : (this._events = new i(), this._eventsCount = 0), this;
396
+ }, c.prototype.off = c.prototype.removeListener, c.prototype.addListener = c.prototype.on, c.prefixed = r, c.EventEmitter = c, t !== void 0 && (t.exports = c);
397
+ })))(), 1);
398
+ //#endregion
399
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateMetadata.js
400
+ function h(e, t) {
401
+ if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
10
402
  }
11
- var A = {}, F;
12
- function G() {
13
- return F || (F = 1, (function() {
14
- if (typeof window != "object")
15
- return;
16
- if ("IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype) {
17
- "isIntersecting" in window.IntersectionObserverEntry.prototype || Object.defineProperty(
18
- window.IntersectionObserverEntry.prototype,
19
- "isIntersecting",
20
- {
21
- get: function() {
22
- return this.intersectionRatio > 0;
23
- }
24
- }
25
- );
26
- return;
27
- }
28
- function d(t) {
29
- try {
30
- return t.defaultView && t.defaultView.frameElement || null;
31
- } catch {
32
- return null;
33
- }
34
- }
35
- var n = (function(t) {
36
- for (var e = t, o = d(e); o; )
37
- e = o.ownerDocument, o = d(e);
38
- return e;
39
- })(window.document), i = [], p = null, f = null;
40
- function w(t) {
41
- this.time = t.time, this.target = t.target, this.rootBounds = b(t.rootBounds), this.boundingClientRect = b(t.boundingClientRect), this.intersectionRect = b(t.intersectionRect || y()), this.isIntersecting = !!t.intersectionRect;
42
- var e = this.boundingClientRect, o = e.width * e.height, s = this.intersectionRect, u = s.width * s.height;
43
- o ? this.intersectionRatio = Number((u / o).toFixed(4)) : this.intersectionRatio = this.isIntersecting ? 1 : 0;
44
- }
45
- function a(t, e) {
46
- var o = e || {};
47
- if (typeof t != "function")
48
- throw new Error("callback must be a function");
49
- if (o.root && o.root.nodeType != 1 && o.root.nodeType != 9)
50
- throw new Error("root must be a Document or Element");
51
- this._checkForIntersections = g(
52
- this._checkForIntersections.bind(this),
53
- this.THROTTLE_TIMEOUT
54
- ), this._callback = t, this._observationTargets = [], this._queuedEntries = [], this._rootMarginValues = this._parseRootMargin(o.rootMargin), this.thresholds = this._initThresholds(o.threshold), this.root = o.root || null, this.rootMargin = this._rootMarginValues.map(function(s) {
55
- return s.value + s.unit;
56
- }).join(" "), this._monitoringDocuments = [], this._monitoringUnsubscribes = [];
57
- }
58
- a.prototype.THROTTLE_TIMEOUT = 100, a.prototype.POLL_INTERVAL = null, a.prototype.USE_MUTATION_OBSERVER = !0, a._setupCrossOriginUpdater = function() {
59
- return p || (p = function(t, e) {
60
- !t || !e ? f = y() : f = R(t, e), i.forEach(function(o) {
61
- o._checkForIntersections();
62
- });
63
- }), p;
64
- }, a._resetCrossOriginUpdater = function() {
65
- p = null, f = null;
66
- }, a.prototype.observe = function(t) {
67
- var e = this._observationTargets.some(function(o) {
68
- return o.element == t;
69
- });
70
- if (!e) {
71
- if (!(t && t.nodeType == 1))
72
- throw new Error("target must be an Element");
73
- this._registerInstance(), this._observationTargets.push({ element: t, entry: null }), this._monitorIntersections(t.ownerDocument), this._checkForIntersections();
74
- }
75
- }, a.prototype.unobserve = function(t) {
76
- this._observationTargets = this._observationTargets.filter(function(e) {
77
- return e.element != t;
78
- }), this._unmonitorIntersections(t.ownerDocument), this._observationTargets.length == 0 && this._unregisterInstance();
79
- }, a.prototype.disconnect = function() {
80
- this._observationTargets = [], this._unmonitorAllIntersections(), this._unregisterInstance();
81
- }, a.prototype.takeRecords = function() {
82
- var t = this._queuedEntries.slice();
83
- return this._queuedEntries = [], t;
84
- }, a.prototype._initThresholds = function(t) {
85
- var e = t || [0];
86
- return Array.isArray(e) || (e = [e]), e.sort().filter(function(o, s, u) {
87
- if (typeof o != "number" || isNaN(o) || o < 0 || o > 1)
88
- throw new Error("threshold must be a number between 0 and 1 inclusively");
89
- return o !== u[s - 1];
90
- });
91
- }, a.prototype._parseRootMargin = function(t) {
92
- var e = t || "0px", o = e.split(/\s+/).map(function(s) {
93
- var u = /^(-?\d*\.?\d+)(px|%)$/.exec(s);
94
- if (!u)
95
- throw new Error("rootMargin must be specified in pixels or percent");
96
- return { value: parseFloat(u[1]), unit: u[2] };
97
- });
98
- return o[1] = o[1] || o[0], o[2] = o[2] || o[0], o[3] = o[3] || o[1], o;
99
- }, a.prototype._monitorIntersections = function(t) {
100
- var e = t.defaultView;
101
- if (e && this._monitoringDocuments.indexOf(t) == -1) {
102
- var o = this._checkForIntersections, s = null, u = null;
103
- this.POLL_INTERVAL ? s = e.setInterval(o, this.POLL_INTERVAL) : (c(e, "resize", o, !0), c(t, "scroll", o, !0), this.USE_MUTATION_OBSERVER && "MutationObserver" in e && (u = new e.MutationObserver(o), u.observe(t, {
104
- attributes: !0,
105
- childList: !0,
106
- characterData: !0,
107
- subtree: !0
108
- }))), this._monitoringDocuments.push(t), this._monitoringUnsubscribes.push(function() {
109
- var I = t.defaultView;
110
- I && (s && I.clearInterval(s), l(I, "resize", o, !0)), l(t, "scroll", o, !0), u && u.disconnect();
111
- });
112
- var O = this.root && (this.root.ownerDocument || this.root) || n;
113
- if (t != O) {
114
- var E = d(t);
115
- E && this._monitorIntersections(E.ownerDocument);
116
- }
117
- }
118
- }, a.prototype._unmonitorIntersections = function(t) {
119
- var e = this._monitoringDocuments.indexOf(t);
120
- if (e != -1) {
121
- var o = this.root && (this.root.ownerDocument || this.root) || n, s = this._observationTargets.some(function(E) {
122
- var I = E.element.ownerDocument;
123
- if (I == t)
124
- return !0;
125
- for (; I && I != o; ) {
126
- var L = d(I);
127
- if (I = L && L.ownerDocument, I == t)
128
- return !0;
129
- }
130
- return !1;
131
- });
132
- if (!s) {
133
- var u = this._monitoringUnsubscribes[e];
134
- if (this._monitoringDocuments.splice(e, 1), this._monitoringUnsubscribes.splice(e, 1), u(), t != o) {
135
- var O = d(t);
136
- O && this._unmonitorIntersections(O.ownerDocument);
137
- }
138
- }
139
- }
140
- }, a.prototype._unmonitorAllIntersections = function() {
141
- var t = this._monitoringUnsubscribes.slice(0);
142
- this._monitoringDocuments.length = 0, this._monitoringUnsubscribes.length = 0;
143
- for (var e = 0; e < t.length; e++)
144
- t[e]();
145
- }, a.prototype._checkForIntersections = function() {
146
- if (!(!this.root && p && !f)) {
147
- var t = this._rootIsInDom(), e = t ? this._getRootRect() : y();
148
- this._observationTargets.forEach(function(o) {
149
- var s = o.element, u = T(s), O = this._rootContainsTarget(s), E = o.entry, I = t && O && this._computeTargetAndRootIntersection(s, u, e), L = null;
150
- this._rootContainsTarget(s) ? (!p || this.root) && (L = e) : L = y();
151
- var D = o.entry = new w({
152
- time: m(),
153
- target: s,
154
- boundingClientRect: u,
155
- rootBounds: L,
156
- intersectionRect: I
157
- });
158
- E ? t && O ? this._hasCrossedThreshold(E, D) && this._queuedEntries.push(D) : E && E.isIntersecting && this._queuedEntries.push(D) : this._queuedEntries.push(D);
159
- }, this), this._queuedEntries.length && this._callback(this.takeRecords(), this);
160
- }
161
- }, a.prototype._computeTargetAndRootIntersection = function(t, e, o) {
162
- if (window.getComputedStyle(t).display != "none") {
163
- for (var s = e, u = _(t), O = !1; !O && u; ) {
164
- var E = null, I = u.nodeType == 1 ? window.getComputedStyle(u) : {};
165
- if (I.display == "none") return null;
166
- if (u == this.root || u.nodeType == /* DOCUMENT */
167
- 9)
168
- if (O = !0, u == this.root || u == n)
169
- p && !this.root ? !f || f.width == 0 && f.height == 0 ? (u = null, E = null, s = null) : E = f : E = o;
170
- else {
171
- var L = _(u), D = L && T(L), B = L && this._computeTargetAndRootIntersection(L, D, o);
172
- D && B ? (u = L, E = R(D, B)) : (u = null, s = null);
173
- }
174
- else {
175
- var C = u.ownerDocument;
176
- u != C.body && u != C.documentElement && I.overflow != "visible" && (E = T(u));
177
- }
178
- if (E && (s = v(E, s)), !s) break;
179
- u = u && _(u);
180
- }
181
- return s;
182
- }
183
- }, a.prototype._getRootRect = function() {
184
- var t;
185
- if (this.root && !x(this.root))
186
- t = T(this.root);
187
- else {
188
- var e = x(this.root) ? this.root : n, o = e.documentElement, s = e.body;
189
- t = {
190
- top: 0,
191
- left: 0,
192
- right: o.clientWidth || s.clientWidth,
193
- width: o.clientWidth || s.clientWidth,
194
- bottom: o.clientHeight || s.clientHeight,
195
- height: o.clientHeight || s.clientHeight
196
- };
197
- }
198
- return this._expandRectByRootMargin(t);
199
- }, a.prototype._expandRectByRootMargin = function(t) {
200
- var e = this._rootMarginValues.map(function(s, u) {
201
- return s.unit == "px" ? s.value : s.value * (u % 2 ? t.width : t.height) / 100;
202
- }), o = {
203
- top: t.top - e[0],
204
- right: t.right + e[1],
205
- bottom: t.bottom + e[2],
206
- left: t.left - e[3]
207
- };
208
- return o.width = o.right - o.left, o.height = o.bottom - o.top, o;
209
- }, a.prototype._hasCrossedThreshold = function(t, e) {
210
- var o = t && t.isIntersecting ? t.intersectionRatio || 0 : -1, s = e.isIntersecting ? e.intersectionRatio || 0 : -1;
211
- if (o !== s)
212
- for (var u = 0; u < this.thresholds.length; u++) {
213
- var O = this.thresholds[u];
214
- if (O == o || O == s || O < o != O < s)
215
- return !0;
216
- }
217
- }, a.prototype._rootIsInDom = function() {
218
- return !this.root || h(n, this.root);
219
- }, a.prototype._rootContainsTarget = function(t) {
220
- var e = this.root && (this.root.ownerDocument || this.root) || n;
221
- return h(e, t) && (!this.root || e == t.ownerDocument);
222
- }, a.prototype._registerInstance = function() {
223
- i.indexOf(this) < 0 && i.push(this);
224
- }, a.prototype._unregisterInstance = function() {
225
- var t = i.indexOf(this);
226
- t != -1 && i.splice(t, 1);
227
- };
228
- function m() {
229
- return window.performance && performance.now && performance.now();
230
- }
231
- function g(t, e) {
232
- var o = null;
233
- return function() {
234
- o || (o = setTimeout(function() {
235
- t(), o = null;
236
- }, e));
237
- };
238
- }
239
- function c(t, e, o, s) {
240
- typeof t.addEventListener == "function" ? t.addEventListener(e, o, s) : typeof t.attachEvent == "function" && t.attachEvent("on" + e, o);
241
- }
242
- function l(t, e, o, s) {
243
- typeof t.removeEventListener == "function" ? t.removeEventListener(e, o, s) : typeof t.detatchEvent == "function" && t.detatchEvent("on" + e, o);
244
- }
245
- function v(t, e) {
246
- var o = Math.max(t.top, e.top), s = Math.min(t.bottom, e.bottom), u = Math.max(t.left, e.left), O = Math.min(t.right, e.right), E = O - u, I = s - o;
247
- return E >= 0 && I >= 0 && {
248
- top: o,
249
- bottom: s,
250
- left: u,
251
- right: O,
252
- width: E,
253
- height: I
254
- } || null;
255
- }
256
- function T(t) {
257
- var e;
258
- try {
259
- e = t.getBoundingClientRect();
260
- } catch {
261
- }
262
- return e ? (e.width && e.height || (e = {
263
- top: e.top,
264
- right: e.right,
265
- bottom: e.bottom,
266
- left: e.left,
267
- width: e.right - e.left,
268
- height: e.bottom - e.top
269
- }), e) : y();
270
- }
271
- function y() {
272
- return {
273
- top: 0,
274
- bottom: 0,
275
- left: 0,
276
- right: 0,
277
- width: 0,
278
- height: 0
279
- };
280
- }
281
- function b(t) {
282
- return !t || "x" in t ? t : {
283
- top: t.top,
284
- y: t.top,
285
- bottom: t.bottom,
286
- left: t.left,
287
- x: t.left,
288
- right: t.right,
289
- width: t.width,
290
- height: t.height
291
- };
292
- }
293
- function R(t, e) {
294
- var o = e.top - t.top, s = e.left - t.left;
295
- return {
296
- top: o,
297
- left: s,
298
- height: e.height,
299
- width: e.width,
300
- bottom: o + e.height,
301
- right: s + e.width
302
- };
303
- }
304
- function h(t, e) {
305
- for (var o = e; o; ) {
306
- if (o == t) return !0;
307
- o = _(o);
308
- }
309
- return !1;
310
- }
311
- function _(t) {
312
- var e = t.parentNode;
313
- return t.nodeType == /* DOCUMENT */
314
- 9 && t != n ? d(t) : (e && e.assignedSlot && (e = e.assignedSlot.parentNode), e && e.nodeType == 11 && e.host ? e.host : e);
315
- }
316
- function x(t) {
317
- return t && t.nodeType === 9;
318
- }
319
- window.IntersectionObserver = a, window.IntersectionObserverEntry = w;
320
- })()), A;
403
+ //#endregion
404
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
405
+ function g(e, t, n, r) {
406
+ var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
407
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
408
+ else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
409
+ return i > 3 && a && Object.defineProperty(t, n, a), a;
321
410
  }
322
- G();
323
- var P = { exports: {} }, H;
324
- function z() {
325
- return H || (H = 1, (function(d) {
326
- var n = Object.prototype.hasOwnProperty, i = "~";
327
- function p() {
328
- }
329
- Object.create && (p.prototype = /* @__PURE__ */ Object.create(null), new p().__proto__ || (i = !1));
330
- function f(g, c, l) {
331
- this.fn = g, this.context = c, this.once = l || !1;
332
- }
333
- function w(g, c, l, v, T) {
334
- if (typeof l != "function")
335
- throw new TypeError("The listener must be a function");
336
- var y = new f(l, v || g, T), b = i ? i + c : c;
337
- return g._events[b] ? g._events[b].fn ? g._events[b] = [g._events[b], y] : g._events[b].push(y) : (g._events[b] = y, g._eventsCount++), g;
338
- }
339
- function a(g, c) {
340
- --g._eventsCount === 0 ? g._events = new p() : delete g._events[c];
341
- }
342
- function m() {
343
- this._events = new p(), this._eventsCount = 0;
344
- }
345
- m.prototype.eventNames = function() {
346
- var c = [], l, v;
347
- if (this._eventsCount === 0) return c;
348
- for (v in l = this._events)
349
- n.call(l, v) && c.push(i ? v.slice(1) : v);
350
- return Object.getOwnPropertySymbols ? c.concat(Object.getOwnPropertySymbols(l)) : c;
351
- }, m.prototype.listeners = function(c) {
352
- var l = i ? i + c : c, v = this._events[l];
353
- if (!v) return [];
354
- if (v.fn) return [v.fn];
355
- for (var T = 0, y = v.length, b = new Array(y); T < y; T++)
356
- b[T] = v[T].fn;
357
- return b;
358
- }, m.prototype.listenerCount = function(c) {
359
- var l = i ? i + c : c, v = this._events[l];
360
- return v ? v.fn ? 1 : v.length : 0;
361
- }, m.prototype.emit = function(c, l, v, T, y, b) {
362
- var R = i ? i + c : c;
363
- if (!this._events[R]) return !1;
364
- var h = this._events[R], _ = arguments.length, x, t;
365
- if (h.fn) {
366
- switch (h.once && this.removeListener(c, h.fn, void 0, !0), _) {
367
- case 1:
368
- return h.fn.call(h.context), !0;
369
- case 2:
370
- return h.fn.call(h.context, l), !0;
371
- case 3:
372
- return h.fn.call(h.context, l, v), !0;
373
- case 4:
374
- return h.fn.call(h.context, l, v, T), !0;
375
- case 5:
376
- return h.fn.call(h.context, l, v, T, y), !0;
377
- case 6:
378
- return h.fn.call(h.context, l, v, T, y, b), !0;
379
- }
380
- for (t = 1, x = new Array(_ - 1); t < _; t++)
381
- x[t - 1] = arguments[t];
382
- h.fn.apply(h.context, x);
383
- } else {
384
- var e = h.length, o;
385
- for (t = 0; t < e; t++)
386
- switch (h[t].once && this.removeListener(c, h[t].fn, void 0, !0), _) {
387
- case 1:
388
- h[t].fn.call(h[t].context);
389
- break;
390
- case 2:
391
- h[t].fn.call(h[t].context, l);
392
- break;
393
- case 3:
394
- h[t].fn.call(h[t].context, l, v);
395
- break;
396
- case 4:
397
- h[t].fn.call(h[t].context, l, v, T);
398
- break;
399
- default:
400
- if (!x) for (o = 1, x = new Array(_ - 1); o < _; o++)
401
- x[o - 1] = arguments[o];
402
- h[t].fn.apply(h[t].context, x);
403
- }
404
- }
405
- return !0;
406
- }, m.prototype.on = function(c, l, v) {
407
- return w(this, c, l, v, !1);
408
- }, m.prototype.once = function(c, l, v) {
409
- return w(this, c, l, v, !0);
410
- }, m.prototype.removeListener = function(c, l, v, T) {
411
- var y = i ? i + c : c;
412
- if (!this._events[y]) return this;
413
- if (!l)
414
- return a(this, y), this;
415
- var b = this._events[y];
416
- if (b.fn)
417
- b.fn === l && (!T || b.once) && (!v || b.context === v) && a(this, y);
418
- else {
419
- for (var R = 0, h = [], _ = b.length; R < _; R++)
420
- (b[R].fn !== l || T && !b[R].once || v && b[R].context !== v) && h.push(b[R]);
421
- h.length ? this._events[y] = h.length === 1 ? h[0] : h : a(this, y);
422
- }
423
- return this;
424
- }, m.prototype.removeAllListeners = function(c) {
425
- var l;
426
- return c ? (l = i ? i + c : c, this._events[l] && a(this, l)) : (this._events = new p(), this._eventsCount = 0), this;
427
- }, m.prototype.off = m.prototype.removeListener, m.prototype.addListener = m.prototype.on, m.prefixed = i, m.EventEmitter = m, d.exports = m;
428
- })(P)), P.exports;
429
- }
430
- var W = z();
431
- const $ = /* @__PURE__ */ q(W);
432
- var Y = Object.defineProperty, J = Object.getOwnPropertyDescriptor, K = (d, n, i, p) => {
433
- for (var f = J(n, i), w = d.length - 1, a; w >= 0; w--)
434
- (a = d[w]) && (f = a(n, i, f) || f);
435
- return f && Y(n, i, f), f;
436
- };
437
- const k = 60;
438
- var r;
439
- const N = (r = class {
440
- static on(n, i) {
441
- r.events.on(n, i);
442
- }
443
- static off(n, i) {
444
- r.events.off(n, i);
445
- }
446
- static once(n, i) {
447
- r.events.once(n, i);
448
- }
449
- static checkCollisions(n, i) {
450
- const p = i || Array.from(r.elements.keys()), f = n.getBoundingClientRect(), w = [];
451
- for (const a of p)
452
- if (a !== n) {
453
- const m = a.getBoundingClientRect();
454
- m.left <= f.right && m.right >= f.left && m.top <= f.bottom && m.bottom >= f.top && w.push(a);
455
- }
456
- w.length && r.onElementIntersection(n, w);
457
- }
458
- /**
459
- * Returns `true` if the element is currently being positioned by the service
460
- * and `false` otherwise.
461
- */
462
- static isPositioned(n) {
463
- return r.elements.has(n);
464
- }
465
- /**
466
- * Returns the options currently beinng used for positioning the element,
467
- * if it is indeed being positioned by the service.
468
- */
469
- static getPositioningOptions(n) {
470
- return r.elements.has(n) ? r.elements.get(n) : null;
471
- }
472
- /** PositioningService will start controlling the position of the given element. */
473
- static position(n, i = {}) {
474
- const p = {
475
- ...V,
476
- ...i
477
- };
478
- let f = n;
479
- for (; f !== document.body; )
480
- if (f = f.parentElement, f.classList.contains("sps-focused-task")) {
481
- p.scrollParent = f, r.registeredScrollParents.has(f) || (r.registeredScrollParents.add(f), f.addEventListener("scroll", r.update));
482
- break;
483
- }
484
- if (n.style.visibility = "hidden", r.elements.size === 0 && (window.addEventListener("resize", r.update), window.addEventListener("scroll", r.update)), !p.relativeTo)
485
- throw new Error(
486
- "You must provide an element for the relativeTo option to position an element."
487
- );
488
- r.elements.set(n, p), j(() => {
489
- r.fixElementPosition(n), r.viewportObserver.observe(n), n.style.visibility = "", r.checkCollisions(n);
490
- });
491
- }
492
- /** PositioningService will stop controlling the position of the given element. */
493
- static release(n) {
494
- if (r.elements.has(n)) {
495
- r.clearStyles(n);
496
- const i = r.elements.get(n);
497
- i.scrollParent && (i.scrollParent.removeEventListener("scroll", r.update), r.registeredScrollParents.delete(i.scrollParent)), r.elements.delete(n), r.elements.size === 0 && (window.removeEventListener("resize", r.update), window.removeEventListener("scroll", r.update)), r.viewportObserver.unobserve(n);
498
- }
499
- }
500
- static releaseAll() {
501
- for (const n of r.elements.keys())
502
- r.release(n);
503
- }
504
- /** PositioningService will refresh the positioning of the given element */
505
- static refresh(n) {
506
- r.elements.has(n) && (r.clearStyles(n), r.fixElementPosition(n), r.checkCollisions(n));
507
- }
508
- static refreshAll() {
509
- for (const n of r.elements.keys())
510
- r.refresh(n);
511
- }
512
- /** Update the positioning options of a currently positioned element */
513
- static reposition(n, i) {
514
- if (r.elements.has(n)) {
515
- const p = r.elements.get(n);
516
- r.elements.set(n, Object.assign(p, i)), r.refresh(n);
517
- }
518
- }
519
- static onViewportIntersection(n) {
520
- for (const i of n) {
521
- const p = Object.keys(IntersectionObserverEntry.prototype).reduce(
522
- (f, w) => ({
523
- ...f,
524
- [w]: i[w]
525
- }),
526
- {}
527
- );
528
- p.rootBounds = p.rootBounds || r.getRootBounds(), r.events.emit("viewportIntersection", Object.freeze(p));
529
- }
530
- }
531
- static onElementIntersection(n, i) {
532
- r.events.emit("elementIntersection", { target: n, intersectingWith: i });
533
- }
534
- static getRootBounds() {
535
- const n = Math.max(document.documentElement.clientWidth, window.innerWidth || 0), i = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
536
- return {
537
- x: 0,
538
- y: k,
539
- left: 0,
540
- top: k,
541
- right: n,
542
- bottom: i,
543
- height: i - k,
544
- width: n
545
- };
546
- }
547
- static clearStyles(n) {
548
- Object.assign(n.style, {
549
- position: "",
550
- width: "",
551
- top: "",
552
- left: "",
553
- right: "",
554
- bottom: "",
555
- visibility: "",
556
- zIndex: ""
557
- });
558
- }
559
- static fixElementPosition(n, i) {
560
- if (!this.elements.has(n))
561
- return;
562
- const p = i || this.elements.get(n), f = this.getRootBounds(), w = n.getBoundingClientRect(), a = p.relativeTo.getBoundingClientRect(), { width: m } = p.useRelativeTargetWidth ? a : w;
563
- Object.assign(n.style, {
564
- minWidth: `${m}px`,
565
- position: "fixed",
566
- zIndex: p.zIndex || ""
567
- });
568
- let g, c;
569
- const l = p.position.split(" "), v = p.offsets[0] || 0, T = p.offsets[1] || 0;
570
- switch (g = 0, c = 0, l[0]) {
571
- case "top":
572
- g = a.top - w.height - v;
573
- break;
574
- case "left":
575
- c = a.left - m - v;
576
- break;
577
- case "right":
578
- c = a.right + v;
579
- break;
580
- case "bottom":
581
- g = a.bottom + v;
582
- break;
583
- default:
584
- throw new Error(`${p.position} is not a valid position`);
585
- }
586
- switch (l[1]) {
587
- case "left":
588
- c = a.left - T;
589
- break;
590
- case "top":
591
- g = a.top - T;
592
- break;
593
- case "middle":
594
- l[0] === "top" || l[0] === "bottom" ? c = a.left + a.width / 2 - m / 2 + T : (l[0] === "left" || l[0] === "right") && (g = a.top + a.height / 2 - w.height / 2 + T);
595
- break;
596
- case "bottom":
597
- g = a.bottom - w.height + T;
598
- break;
599
- case "right":
600
- c = a.right - m + T;
601
- break;
602
- default:
603
- throw new Error(`${p.position} is not a valid position`);
604
- }
605
- const y = g + w.height, b = c + w.width, R = `${Math.round(g)}px`, h = `${Math.round(f.bottom - y)}px`, _ = `${Math.round(c)}px`, x = `${Math.round(f.right - b)}px`;
606
- switch (p.anchor) {
607
- case M.TOP_LEFT:
608
- Object.assign(n.style, {
609
- top: R,
610
- bottom: "auto",
611
- left: _,
612
- right: "auto"
613
- });
614
- break;
615
- case M.TOP_RIGHT:
616
- Object.assign(n.style, {
617
- top: R,
618
- bottom: "auto",
619
- left: "auto",
620
- right: x
621
- });
622
- break;
623
- case M.BOTTOM_LEFT:
624
- Object.assign(n.style, {
625
- top: "auto",
626
- bottom: h,
627
- left: _,
628
- right: "auto"
629
- });
630
- break;
631
- case M.BOTTOM_RIGHT:
632
- Object.assign(n.style, {
633
- top: "auto",
634
- bottom: h,
635
- left: "auto",
636
- right: x
637
- });
638
- break;
639
- }
640
- }
641
- static update(n) {
642
- const i = r.elements.entries(), p = [];
643
- for (const [f, w] of i)
644
- (!n || n.target === document || n.target === w.scrollParent || n.target === window) && (r.fixElementPosition(f, w), r.checkCollisions(f, p), p.push(f));
645
- }
646
- /* eslint class-methods-use-this: "off" */
647
- on(n, i) {
648
- r.on(n, i);
649
- }
650
- off(n, i) {
651
- r.off(n, i);
652
- }
653
- once(n, i) {
654
- r.once(n, i);
655
- }
656
- isPositioned(n) {
657
- return r.isPositioned(n);
658
- }
659
- getPositioningOptions(n) {
660
- return r.getPositioningOptions(n);
661
- }
662
- position(n, i = {}) {
663
- r.position(n, i);
664
- }
665
- release(n) {
666
- r.release(n);
667
- }
668
- releaseAll() {
669
- r.releaseAll();
670
- }
671
- refresh(n) {
672
- r.refresh(n);
673
- }
674
- refreshAll() {
675
- r.refreshAll();
676
- }
677
- reposition(n, i) {
678
- r.reposition(n, i);
679
- }
680
- }, r.elements = /* @__PURE__ */ new Map(), r.registeredScrollParents = /* @__PURE__ */ new Set(), r.events = new $(), r.viewportObserver = new IntersectionObserver(
681
- r.onViewportIntersection,
682
- {
683
- rootMargin: `-${k}px 0px 0px`,
684
- threshold: 1
685
- }
686
- ), r);
687
- K([
688
- U
689
- ], N, "update");
690
- let X = N;
691
- export {
692
- V as DEFAULT_POSITIONING_OPTIONS,
693
- S as Position,
694
- M as PositionAnchor,
695
- X as PositioningService
411
+ //#endregion
412
+ //#region src/positioning.service.ts
413
+ var _ = 60, v = class e {
414
+ static {
415
+ this.elements = /* @__PURE__ */ new Map();
416
+ }
417
+ static {
418
+ this.registeredScrollParents = /* @__PURE__ */ new Set();
419
+ }
420
+ static {
421
+ this.events = new m.default();
422
+ }
423
+ static {
424
+ this.viewportObserver = new IntersectionObserver(e.onViewportIntersection, {
425
+ rootMargin: `-${_}px 0px 0px`,
426
+ threshold: 1
427
+ });
428
+ }
429
+ static on(t, n) {
430
+ e.events.on(t, n);
431
+ }
432
+ static off(t, n) {
433
+ e.events.off(t, n);
434
+ }
435
+ static once(t, n) {
436
+ e.events.once(t, n);
437
+ }
438
+ static checkCollisions(t, n) {
439
+ let r = n || Array.from(e.elements.keys()), i = t.getBoundingClientRect(), a = [];
440
+ for (let e of r) if (e !== t) {
441
+ let t = e.getBoundingClientRect();
442
+ t.left <= i.right && t.right >= i.left && t.top <= i.bottom && t.bottom >= i.top && a.push(e);
443
+ }
444
+ a.length && e.onElementIntersection(t, a);
445
+ }
446
+ static isPositioned(t) {
447
+ return e.elements.has(t);
448
+ }
449
+ static getPositioningOptions(t) {
450
+ return e.elements.has(t) ? e.elements.get(t) : null;
451
+ }
452
+ static position(n, r = {}) {
453
+ let i = {
454
+ ...p,
455
+ ...r
456
+ }, a = n;
457
+ for (; a !== document.body;) if (a = a.parentElement, a.classList.contains("sps-focused-task")) {
458
+ i.scrollParent = a, e.registeredScrollParents.has(a) || (e.registeredScrollParents.add(a), a.addEventListener("scroll", e.update));
459
+ break;
460
+ }
461
+ if (n.style.visibility = "hidden", e.elements.size === 0 && (window.addEventListener("resize", e.update), window.addEventListener("scroll", e.update)), !i.relativeTo) throw Error("You must provide an element for the relativeTo option to position an element.");
462
+ e.elements.set(n, i), t(() => {
463
+ e.fixElementPosition(n), e.viewportObserver.observe(n), n.style.visibility = "", e.checkCollisions(n);
464
+ });
465
+ }
466
+ static release(t) {
467
+ if (e.elements.has(t)) {
468
+ e.clearStyles(t);
469
+ let n = e.elements.get(t);
470
+ n.scrollParent && (n.scrollParent.removeEventListener("scroll", e.update), e.registeredScrollParents.delete(n.scrollParent)), e.elements.delete(t), e.elements.size === 0 && (window.removeEventListener("resize", e.update), window.removeEventListener("scroll", e.update)), e.viewportObserver.unobserve(t);
471
+ }
472
+ }
473
+ static releaseAll() {
474
+ for (let t of e.elements.keys()) e.release(t);
475
+ }
476
+ static refresh(t) {
477
+ e.elements.has(t) && (e.clearStyles(t), e.fixElementPosition(t), e.checkCollisions(t));
478
+ }
479
+ static refreshAll() {
480
+ for (let t of e.elements.keys()) e.refresh(t);
481
+ }
482
+ static reposition(t, n) {
483
+ if (e.elements.has(t)) {
484
+ let r = e.elements.get(t);
485
+ e.elements.set(t, Object.assign(r, n)), e.refresh(t);
486
+ }
487
+ }
488
+ static onViewportIntersection(t) {
489
+ for (let n of t) {
490
+ let t = Object.keys(IntersectionObserverEntry.prototype).reduce((e, t) => ({
491
+ ...e,
492
+ [t]: n[t]
493
+ }), {});
494
+ t.rootBounds = t.rootBounds || e.getRootBounds(), e.events.emit("viewportIntersection", Object.freeze(t));
495
+ }
496
+ }
497
+ static onElementIntersection(t, n) {
498
+ e.events.emit("elementIntersection", {
499
+ target: t,
500
+ intersectingWith: n
501
+ });
502
+ }
503
+ static getRootBounds() {
504
+ let e = Math.max(document.documentElement.clientWidth, window.innerWidth || 0), t = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
505
+ return {
506
+ x: 0,
507
+ y: _,
508
+ left: 0,
509
+ top: _,
510
+ right: e,
511
+ bottom: t,
512
+ height: t - _,
513
+ width: e
514
+ };
515
+ }
516
+ static clearStyles(e) {
517
+ Object.assign(e.style, {
518
+ position: "",
519
+ width: "",
520
+ top: "",
521
+ left: "",
522
+ right: "",
523
+ bottom: "",
524
+ visibility: "",
525
+ zIndex: ""
526
+ });
527
+ }
528
+ static fixElementPosition(e, t) {
529
+ if (!this.elements.has(e)) return;
530
+ let n = t || this.elements.get(e), r = this.getRootBounds(), i = e.getBoundingClientRect(), a = n.relativeTo.getBoundingClientRect(), { width: o } = n.useRelativeTargetWidth ? a : i;
531
+ Object.assign(e.style, {
532
+ minWidth: `${o}px`,
533
+ position: "fixed",
534
+ zIndex: n.zIndex || ""
535
+ });
536
+ let s, c, l = n.position.split(" "), u = n.offsets[0] || 0, d = n.offsets[1] || 0;
537
+ switch (s = 0, c = 0, l[0]) {
538
+ case "top":
539
+ s = a.top - i.height - u;
540
+ break;
541
+ case "left":
542
+ c = a.left - o - u;
543
+ break;
544
+ case "right":
545
+ c = a.right + u;
546
+ break;
547
+ case "bottom":
548
+ s = a.bottom + u;
549
+ break;
550
+ default: throw Error(`${n.position} is not a valid position`);
551
+ }
552
+ switch (l[1]) {
553
+ case "left":
554
+ c = a.left - d;
555
+ break;
556
+ case "top":
557
+ s = a.top - d;
558
+ break;
559
+ case "middle":
560
+ l[0] === "top" || l[0] === "bottom" ? c = a.left + a.width / 2 - o / 2 + d : (l[0] === "left" || l[0] === "right") && (s = a.top + a.height / 2 - i.height / 2 + d);
561
+ break;
562
+ case "bottom":
563
+ s = a.bottom - i.height + d;
564
+ break;
565
+ case "right":
566
+ c = a.right - o + d;
567
+ break;
568
+ default: throw Error(`${n.position} is not a valid position`);
569
+ }
570
+ let p = s + i.height, m = c + i.width, h = `${Math.round(s)}px`, g = `${Math.round(r.bottom - p)}px`, _ = `${Math.round(c)}px`, v = `${Math.round(r.right - m)}px`;
571
+ switch (n.anchor) {
572
+ case f.TOP_LEFT:
573
+ Object.assign(e.style, {
574
+ top: h,
575
+ bottom: "auto",
576
+ left: _,
577
+ right: "auto"
578
+ });
579
+ break;
580
+ case f.TOP_RIGHT:
581
+ Object.assign(e.style, {
582
+ top: h,
583
+ bottom: "auto",
584
+ left: "auto",
585
+ right: v
586
+ });
587
+ break;
588
+ case f.BOTTOM_LEFT:
589
+ Object.assign(e.style, {
590
+ top: "auto",
591
+ bottom: g,
592
+ left: _,
593
+ right: "auto"
594
+ });
595
+ break;
596
+ case f.BOTTOM_RIGHT: Object.assign(e.style, {
597
+ top: "auto",
598
+ bottom: g,
599
+ left: "auto",
600
+ right: v
601
+ });
602
+ }
603
+ }
604
+ static update(t) {
605
+ let n = e.elements.entries(), r = [];
606
+ for (let [i, a] of n) (!t || t.target === document || t.target === a.scrollParent || t.target === window) && (e.fixElementPosition(i, a), e.checkCollisions(i, r), r.push(i));
607
+ }
608
+ on(t, n) {
609
+ e.on(t, n);
610
+ }
611
+ off(t, n) {
612
+ e.off(t, n);
613
+ }
614
+ once(t, n) {
615
+ e.once(t, n);
616
+ }
617
+ isPositioned(t) {
618
+ return e.isPositioned(t);
619
+ }
620
+ getPositioningOptions(t) {
621
+ return e.getPositioningOptions(t);
622
+ }
623
+ position(t, n = {}) {
624
+ e.position(t, n);
625
+ }
626
+ release(t) {
627
+ e.release(t);
628
+ }
629
+ releaseAll() {
630
+ e.releaseAll();
631
+ }
632
+ refresh(t) {
633
+ e.refresh(t);
634
+ }
635
+ refreshAll() {
636
+ e.refreshAll();
637
+ }
638
+ reposition(t, n) {
639
+ e.reposition(t, n);
640
+ }
696
641
  };
642
+ g([
643
+ e,
644
+ h("design:type", Function),
645
+ h("design:paramtypes", [typeof Event > "u" ? Object : Event]),
646
+ h("design:returntype", void 0)
647
+ ], v, "update", null);
648
+ //#endregion
649
+ export { p as DEFAULT_POSITIONING_OPTIONS, d as Position, f as PositionAnchor, v as PositioningService };