@adstore/templates 2.14.24 → 2.14.25

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.
@@ -0,0 +1,515 @@
1
+ var resizeObservers = [];
2
+ var hasActiveObservations = function() {
3
+ return resizeObservers.some(function(ro) {
4
+ return ro.activeTargets.length > 0;
5
+ });
6
+ };
7
+ var hasSkippedObservations = function() {
8
+ return resizeObservers.some(function(ro) {
9
+ return ro.skippedTargets.length > 0;
10
+ });
11
+ };
12
+ var msg = "ResizeObserver loop completed with undelivered notifications.";
13
+ var deliverResizeLoopError = function() {
14
+ var event;
15
+ if (typeof ErrorEvent === "function") {
16
+ event = new ErrorEvent("error", {
17
+ message: msg
18
+ });
19
+ } else {
20
+ event = document.createEvent("Event");
21
+ event.initEvent("error", false, false);
22
+ event.message = msg;
23
+ }
24
+ window.dispatchEvent(event);
25
+ };
26
+ var ResizeObserverBoxOptions;
27
+ (function(ResizeObserverBoxOptions2) {
28
+ ResizeObserverBoxOptions2["BORDER_BOX"] = "border-box";
29
+ ResizeObserverBoxOptions2["CONTENT_BOX"] = "content-box";
30
+ ResizeObserverBoxOptions2["DEVICE_PIXEL_CONTENT_BOX"] = "device-pixel-content-box";
31
+ })(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));
32
+ var freeze = function(obj) {
33
+ return Object.freeze(obj);
34
+ };
35
+ var ResizeObserverSize = function() {
36
+ function ResizeObserverSize2(inlineSize, blockSize) {
37
+ this.inlineSize = inlineSize;
38
+ this.blockSize = blockSize;
39
+ freeze(this);
40
+ }
41
+ return ResizeObserverSize2;
42
+ }();
43
+ var DOMRectReadOnly = function() {
44
+ function DOMRectReadOnly2(x, y, width, height) {
45
+ this.x = x;
46
+ this.y = y;
47
+ this.width = width;
48
+ this.height = height;
49
+ this.top = this.y;
50
+ this.left = this.x;
51
+ this.bottom = this.top + this.height;
52
+ this.right = this.left + this.width;
53
+ return freeze(this);
54
+ }
55
+ DOMRectReadOnly2.prototype.toJSON = function() {
56
+ var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left, width = _a.width, height = _a.height;
57
+ return { x, y, top, right, bottom, left, width, height };
58
+ };
59
+ DOMRectReadOnly2.fromRect = function(rectangle) {
60
+ return new DOMRectReadOnly2(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
61
+ };
62
+ return DOMRectReadOnly2;
63
+ }();
64
+ var isSVG = function(target) {
65
+ return target instanceof SVGElement && "getBBox" in target;
66
+ };
67
+ var isHidden = function(target) {
68
+ if (isSVG(target)) {
69
+ var _a = target.getBBox(), width = _a.width, height = _a.height;
70
+ return !width && !height;
71
+ }
72
+ var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;
73
+ return !(offsetWidth || offsetHeight || target.getClientRects().length);
74
+ };
75
+ var isElement = function(obj) {
76
+ var _a;
77
+ if (obj instanceof Element) {
78
+ return true;
79
+ }
80
+ var scope = (_a = obj === null || obj === void 0 ? void 0 : obj.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
81
+ return !!(scope && obj instanceof scope.Element);
82
+ };
83
+ var isReplacedElement = function(target) {
84
+ switch (target.tagName) {
85
+ case "INPUT":
86
+ if (target.type !== "image") {
87
+ break;
88
+ }
89
+ case "VIDEO":
90
+ case "AUDIO":
91
+ case "EMBED":
92
+ case "OBJECT":
93
+ case "CANVAS":
94
+ case "IFRAME":
95
+ case "IMG":
96
+ return true;
97
+ }
98
+ return false;
99
+ };
100
+ var global = typeof window !== "undefined" ? window : {};
101
+ var cache = /* @__PURE__ */ new WeakMap();
102
+ var scrollRegexp = /auto|scroll/;
103
+ var verticalRegexp = /^tb|vertical/;
104
+ var IE = /msie|trident/i.test(global.navigator && global.navigator.userAgent);
105
+ var parseDimension = function(pixel) {
106
+ return parseFloat(pixel || "0");
107
+ };
108
+ var size = function(inlineSize, blockSize, switchSizes) {
109
+ if (inlineSize === void 0) {
110
+ inlineSize = 0;
111
+ }
112
+ if (blockSize === void 0) {
113
+ blockSize = 0;
114
+ }
115
+ if (switchSizes === void 0) {
116
+ switchSizes = false;
117
+ }
118
+ return new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0);
119
+ };
120
+ var zeroBoxes = freeze({
121
+ devicePixelContentBoxSize: size(),
122
+ borderBoxSize: size(),
123
+ contentBoxSize: size(),
124
+ contentRect: new DOMRectReadOnly(0, 0, 0, 0)
125
+ });
126
+ var calculateBoxSizes = function(target, forceRecalculation) {
127
+ if (forceRecalculation === void 0) {
128
+ forceRecalculation = false;
129
+ }
130
+ if (cache.has(target) && !forceRecalculation) {
131
+ return cache.get(target);
132
+ }
133
+ if (isHidden(target)) {
134
+ cache.set(target, zeroBoxes);
135
+ return zeroBoxes;
136
+ }
137
+ var cs = getComputedStyle(target);
138
+ var svg = isSVG(target) && target.ownerSVGElement && target.getBBox();
139
+ var removePadding = !IE && cs.boxSizing === "border-box";
140
+ var switchSizes = verticalRegexp.test(cs.writingMode || "");
141
+ var canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || "");
142
+ var canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || "");
143
+ var paddingTop = svg ? 0 : parseDimension(cs.paddingTop);
144
+ var paddingRight = svg ? 0 : parseDimension(cs.paddingRight);
145
+ var paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom);
146
+ var paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft);
147
+ var borderTop = svg ? 0 : parseDimension(cs.borderTopWidth);
148
+ var borderRight = svg ? 0 : parseDimension(cs.borderRightWidth);
149
+ var borderBottom = svg ? 0 : parseDimension(cs.borderBottomWidth);
150
+ var borderLeft = svg ? 0 : parseDimension(cs.borderLeftWidth);
151
+ var horizontalPadding = paddingLeft + paddingRight;
152
+ var verticalPadding = paddingTop + paddingBottom;
153
+ var horizontalBorderArea = borderLeft + borderRight;
154
+ var verticalBorderArea = borderTop + borderBottom;
155
+ var horizontalScrollbarThickness = !canScrollHorizontally ? 0 : target.offsetHeight - verticalBorderArea - target.clientHeight;
156
+ var verticalScrollbarThickness = !canScrollVertically ? 0 : target.offsetWidth - horizontalBorderArea - target.clientWidth;
157
+ var widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0;
158
+ var heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0;
159
+ var contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness;
160
+ var contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness;
161
+ var borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea;
162
+ var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea;
163
+ var boxes = freeze({
164
+ devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
165
+ borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes),
166
+ contentBoxSize: size(contentWidth, contentHeight, switchSizes),
167
+ contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)
168
+ });
169
+ cache.set(target, boxes);
170
+ return boxes;
171
+ };
172
+ var calculateBoxSize = function(target, observedBox, forceRecalculation) {
173
+ var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;
174
+ switch (observedBox) {
175
+ case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:
176
+ return devicePixelContentBoxSize;
177
+ case ResizeObserverBoxOptions.BORDER_BOX:
178
+ return borderBoxSize;
179
+ default:
180
+ return contentBoxSize;
181
+ }
182
+ };
183
+ var ResizeObserverEntry = function() {
184
+ function ResizeObserverEntry2(target) {
185
+ var boxes = calculateBoxSizes(target);
186
+ this.target = target;
187
+ this.contentRect = boxes.contentRect;
188
+ this.borderBoxSize = freeze([boxes.borderBoxSize]);
189
+ this.contentBoxSize = freeze([boxes.contentBoxSize]);
190
+ this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);
191
+ }
192
+ return ResizeObserverEntry2;
193
+ }();
194
+ var calculateDepthForNode = function(node) {
195
+ if (isHidden(node)) {
196
+ return Infinity;
197
+ }
198
+ var depth = 0;
199
+ var parent = node.parentNode;
200
+ while (parent) {
201
+ depth += 1;
202
+ parent = parent.parentNode;
203
+ }
204
+ return depth;
205
+ };
206
+ var broadcastActiveObservations = function() {
207
+ var shallowestDepth = Infinity;
208
+ var callbacks2 = [];
209
+ resizeObservers.forEach(function processObserver(ro) {
210
+ if (ro.activeTargets.length === 0) {
211
+ return;
212
+ }
213
+ var entries = [];
214
+ ro.activeTargets.forEach(function processTarget(ot) {
215
+ var entry = new ResizeObserverEntry(ot.target);
216
+ var targetDepth = calculateDepthForNode(ot.target);
217
+ entries.push(entry);
218
+ ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox);
219
+ if (targetDepth < shallowestDepth) {
220
+ shallowestDepth = targetDepth;
221
+ }
222
+ });
223
+ callbacks2.push(function resizeObserverCallback() {
224
+ ro.callback.call(ro.observer, entries, ro.observer);
225
+ });
226
+ ro.activeTargets.splice(0, ro.activeTargets.length);
227
+ });
228
+ for (var _i = 0, callbacks_1 = callbacks2; _i < callbacks_1.length; _i++) {
229
+ var callback = callbacks_1[_i];
230
+ callback();
231
+ }
232
+ return shallowestDepth;
233
+ };
234
+ var gatherActiveObservationsAtDepth = function(depth) {
235
+ resizeObservers.forEach(function processObserver(ro) {
236
+ ro.activeTargets.splice(0, ro.activeTargets.length);
237
+ ro.skippedTargets.splice(0, ro.skippedTargets.length);
238
+ ro.observationTargets.forEach(function processTarget(ot) {
239
+ if (ot.isActive()) {
240
+ if (calculateDepthForNode(ot.target) > depth) {
241
+ ro.activeTargets.push(ot);
242
+ } else {
243
+ ro.skippedTargets.push(ot);
244
+ }
245
+ }
246
+ });
247
+ });
248
+ };
249
+ var process = function() {
250
+ var depth = 0;
251
+ gatherActiveObservationsAtDepth(depth);
252
+ while (hasActiveObservations()) {
253
+ depth = broadcastActiveObservations();
254
+ gatherActiveObservationsAtDepth(depth);
255
+ }
256
+ if (hasSkippedObservations()) {
257
+ deliverResizeLoopError();
258
+ }
259
+ return depth > 0;
260
+ };
261
+ var trigger;
262
+ var callbacks = [];
263
+ var notify = function() {
264
+ return callbacks.splice(0).forEach(function(cb) {
265
+ return cb();
266
+ });
267
+ };
268
+ var queueMicroTask = function(callback) {
269
+ if (!trigger) {
270
+ var toggle_1 = 0;
271
+ var el_1 = document.createTextNode("");
272
+ var config = { characterData: true };
273
+ new MutationObserver(function() {
274
+ return notify();
275
+ }).observe(el_1, config);
276
+ trigger = function() {
277
+ el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
278
+ };
279
+ }
280
+ callbacks.push(callback);
281
+ trigger();
282
+ };
283
+ var queueResizeObserver = function(cb) {
284
+ queueMicroTask(function ResizeObserver2() {
285
+ requestAnimationFrame(cb);
286
+ });
287
+ };
288
+ var watching = 0;
289
+ var isWatching = function() {
290
+ return !!watching;
291
+ };
292
+ var CATCH_PERIOD = 250;
293
+ var observerConfig = { attributes: true, characterData: true, childList: true, subtree: true };
294
+ var events = [
295
+ "resize",
296
+ "load",
297
+ "transitionend",
298
+ "animationend",
299
+ "animationstart",
300
+ "animationiteration",
301
+ "keyup",
302
+ "keydown",
303
+ "mouseup",
304
+ "mousedown",
305
+ "mouseover",
306
+ "mouseout",
307
+ "blur",
308
+ "focus"
309
+ ];
310
+ var time = function(timeout) {
311
+ if (timeout === void 0) {
312
+ timeout = 0;
313
+ }
314
+ return Date.now() + timeout;
315
+ };
316
+ var scheduled = false;
317
+ var Scheduler = function() {
318
+ function Scheduler2() {
319
+ var _this = this;
320
+ this.stopped = true;
321
+ this.listener = function() {
322
+ return _this.schedule();
323
+ };
324
+ }
325
+ Scheduler2.prototype.run = function(timeout) {
326
+ var _this = this;
327
+ if (timeout === void 0) {
328
+ timeout = CATCH_PERIOD;
329
+ }
330
+ if (scheduled) {
331
+ return;
332
+ }
333
+ scheduled = true;
334
+ var until = time(timeout);
335
+ queueResizeObserver(function() {
336
+ var elementsHaveResized = false;
337
+ try {
338
+ elementsHaveResized = process();
339
+ } finally {
340
+ scheduled = false;
341
+ timeout = until - time();
342
+ if (!isWatching()) {
343
+ return;
344
+ }
345
+ if (elementsHaveResized) {
346
+ _this.run(1e3);
347
+ } else if (timeout > 0) {
348
+ _this.run(timeout);
349
+ } else {
350
+ _this.start();
351
+ }
352
+ }
353
+ });
354
+ };
355
+ Scheduler2.prototype.schedule = function() {
356
+ this.stop();
357
+ this.run();
358
+ };
359
+ Scheduler2.prototype.observe = function() {
360
+ var _this = this;
361
+ var cb = function() {
362
+ return _this.observer && _this.observer.observe(document.body, observerConfig);
363
+ };
364
+ document.body ? cb() : global.addEventListener("DOMContentLoaded", cb);
365
+ };
366
+ Scheduler2.prototype.start = function() {
367
+ var _this = this;
368
+ if (this.stopped) {
369
+ this.stopped = false;
370
+ this.observer = new MutationObserver(this.listener);
371
+ this.observe();
372
+ events.forEach(function(name) {
373
+ return global.addEventListener(name, _this.listener, true);
374
+ });
375
+ }
376
+ };
377
+ Scheduler2.prototype.stop = function() {
378
+ var _this = this;
379
+ if (!this.stopped) {
380
+ this.observer && this.observer.disconnect();
381
+ events.forEach(function(name) {
382
+ return global.removeEventListener(name, _this.listener, true);
383
+ });
384
+ this.stopped = true;
385
+ }
386
+ };
387
+ return Scheduler2;
388
+ }();
389
+ var scheduler = new Scheduler();
390
+ var updateCount = function(n) {
391
+ !watching && n > 0 && scheduler.start();
392
+ watching += n;
393
+ !watching && scheduler.stop();
394
+ };
395
+ var skipNotifyOnElement = function(target) {
396
+ return !isSVG(target) && !isReplacedElement(target) && getComputedStyle(target).display === "inline";
397
+ };
398
+ var ResizeObservation = function() {
399
+ function ResizeObservation2(target, observedBox) {
400
+ this.target = target;
401
+ this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX;
402
+ this.lastReportedSize = {
403
+ inlineSize: 0,
404
+ blockSize: 0
405
+ };
406
+ }
407
+ ResizeObservation2.prototype.isActive = function() {
408
+ var size2 = calculateBoxSize(this.target, this.observedBox, true);
409
+ if (skipNotifyOnElement(this.target)) {
410
+ this.lastReportedSize = size2;
411
+ }
412
+ if (this.lastReportedSize.inlineSize !== size2.inlineSize || this.lastReportedSize.blockSize !== size2.blockSize) {
413
+ return true;
414
+ }
415
+ return false;
416
+ };
417
+ return ResizeObservation2;
418
+ }();
419
+ var ResizeObserverDetail = function() {
420
+ function ResizeObserverDetail2(resizeObserver, callback) {
421
+ this.activeTargets = [];
422
+ this.skippedTargets = [];
423
+ this.observationTargets = [];
424
+ this.observer = resizeObserver;
425
+ this.callback = callback;
426
+ }
427
+ return ResizeObserverDetail2;
428
+ }();
429
+ var observerMap = /* @__PURE__ */ new WeakMap();
430
+ var getObservationIndex = function(observationTargets, target) {
431
+ for (var i = 0; i < observationTargets.length; i += 1) {
432
+ if (observationTargets[i].target === target) {
433
+ return i;
434
+ }
435
+ }
436
+ return -1;
437
+ };
438
+ var ResizeObserverController = function() {
439
+ function ResizeObserverController2() {
440
+ }
441
+ ResizeObserverController2.connect = function(resizeObserver, callback) {
442
+ var detail = new ResizeObserverDetail(resizeObserver, callback);
443
+ observerMap.set(resizeObserver, detail);
444
+ };
445
+ ResizeObserverController2.observe = function(resizeObserver, target, options) {
446
+ var detail = observerMap.get(resizeObserver);
447
+ var firstObservation = detail.observationTargets.length === 0;
448
+ if (getObservationIndex(detail.observationTargets, target) < 0) {
449
+ firstObservation && resizeObservers.push(detail);
450
+ detail.observationTargets.push(new ResizeObservation(target, options && options.box));
451
+ updateCount(1);
452
+ scheduler.schedule();
453
+ }
454
+ };
455
+ ResizeObserverController2.unobserve = function(resizeObserver, target) {
456
+ var detail = observerMap.get(resizeObserver);
457
+ var index = getObservationIndex(detail.observationTargets, target);
458
+ var lastObservation = detail.observationTargets.length === 1;
459
+ if (index >= 0) {
460
+ lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1);
461
+ detail.observationTargets.splice(index, 1);
462
+ updateCount(-1);
463
+ }
464
+ };
465
+ ResizeObserverController2.disconnect = function(resizeObserver) {
466
+ var _this = this;
467
+ var detail = observerMap.get(resizeObserver);
468
+ detail.observationTargets.slice().forEach(function(ot) {
469
+ return _this.unobserve(resizeObserver, ot.target);
470
+ });
471
+ detail.activeTargets.splice(0, detail.activeTargets.length);
472
+ };
473
+ return ResizeObserverController2;
474
+ }();
475
+ var ResizeObserver = function() {
476
+ function ResizeObserver2(callback) {
477
+ if (arguments.length === 0) {
478
+ throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
479
+ }
480
+ if (typeof callback !== "function") {
481
+ throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
482
+ }
483
+ ResizeObserverController.connect(this, callback);
484
+ }
485
+ ResizeObserver2.prototype.observe = function(target, options) {
486
+ if (arguments.length === 0) {
487
+ throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
488
+ }
489
+ if (!isElement(target)) {
490
+ throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
491
+ }
492
+ ResizeObserverController.observe(this, target, options);
493
+ };
494
+ ResizeObserver2.prototype.unobserve = function(target) {
495
+ if (arguments.length === 0) {
496
+ throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
497
+ }
498
+ if (!isElement(target)) {
499
+ throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
500
+ }
501
+ ResizeObserverController.unobserve(this, target);
502
+ };
503
+ ResizeObserver2.prototype.disconnect = function() {
504
+ ResizeObserverController.disconnect(this);
505
+ };
506
+ ResizeObserver2.toString = function() {
507
+ return "function ResizeObserver () { [polyfill code] }";
508
+ };
509
+ return ResizeObserver2;
510
+ }();
511
+ export {
512
+ ResizeObserver,
513
+ ResizeObserverEntry,
514
+ ResizeObserverSize
515
+ };