liftie 4.0.1 → 4.0.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.
@@ -1,1558 +1,1590 @@
1
- (() => {
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __typeError = (msg) => {
8
+ throw TypeError(msg);
9
+ };
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
30
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
31
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
32
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
27
33
 
28
- // node_modules/.pnpm/transform-property@0.0.1/node_modules/transform-property/index.js
29
- var require_transform_property = __commonJS({
30
- "node_modules/.pnpm/transform-property@0.0.1/node_modules/transform-property/index.js"(exports, module) {
31
- var styles = [
32
- "webkitTransform",
33
- "MozTransform",
34
- "msTransform",
35
- "OTransform",
36
- "transform"
37
- ];
38
- var el = document.createElement("p");
39
- var style;
40
- for (i = 0; i < styles.length; i++) {
41
- style = styles[i];
42
- if (null != el.style[style]) {
43
- module.exports = style;
44
- break;
45
- }
34
+ // node_modules/.pnpm/component-emitter@2.0.0/node_modules/component-emitter/index.js
35
+ var require_component_emitter = __commonJS({
36
+ "node_modules/.pnpm/component-emitter@2.0.0/node_modules/component-emitter/index.js"(exports, module) {
37
+ function Emitter3(object) {
38
+ if (object) {
39
+ return mixin(object);
46
40
  }
47
- var i;
41
+ this._callbacks = /* @__PURE__ */ new Map();
48
42
  }
49
- });
50
-
51
- // node_modules/.pnpm/has-translate3d@0.0.3/node_modules/has-translate3d/index.js
52
- var require_has_translate3d = __commonJS({
53
- "node_modules/.pnpm/has-translate3d@0.0.3/node_modules/has-translate3d/index.js"(exports, module) {
54
- var prop = require_transform_property();
55
- if (!prop || !window.getComputedStyle) {
56
- module.exports = false;
57
- } else {
58
- map = {
59
- webkitTransform: "-webkit-transform",
60
- OTransform: "-o-transform",
61
- msTransform: "-ms-transform",
62
- MozTransform: "-moz-transform",
63
- transform: "transform"
64
- };
65
- el = document.createElement("div");
66
- el.style[prop] = "translate3d(1px,1px,1px)";
67
- document.body.insertBefore(el, null);
68
- val = getComputedStyle(el).getPropertyValue(map[prop]);
69
- document.body.removeChild(el);
70
- module.exports = null != val && val.length && "none" != val;
71
- }
72
- var map;
73
- var el;
74
- var val;
43
+ function mixin(object) {
44
+ Object.assign(object, Emitter3.prototype);
45
+ object._callbacks = /* @__PURE__ */ new Map();
46
+ return object;
75
47
  }
76
- });
77
-
78
- // node_modules/.pnpm/component-emitter@1.3.1/node_modules/component-emitter/index.js
79
- var require_component_emitter = __commonJS({
80
- "node_modules/.pnpm/component-emitter@1.3.1/node_modules/component-emitter/index.js"(exports, module) {
81
- if (typeof module !== "undefined") {
82
- module.exports = Emitter;
83
- }
84
- function Emitter(obj) {
85
- if (obj) return mixin(obj);
86
- }
87
- function mixin(obj) {
88
- for (var key in Emitter.prototype) {
89
- obj[key] = Emitter.prototype[key];
90
- }
91
- return obj;
92
- }
93
- Emitter.prototype.on = Emitter.prototype.addEventListener = function(event, fn) {
94
- this._callbacks = this._callbacks || {};
95
- (this._callbacks["$" + event] = this._callbacks["$" + event] || []).push(fn);
96
- return this;
97
- };
98
- Emitter.prototype.once = function(event, fn) {
99
- function on() {
100
- this.off(event, on);
101
- fn.apply(this, arguments);
102
- }
103
- on.fn = fn;
104
- this.on(event, on);
105
- return this;
106
- };
107
- Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function(event, fn) {
108
- this._callbacks = this._callbacks || {};
109
- if (0 == arguments.length) {
110
- this._callbacks = {};
111
- return this;
112
- }
113
- var callbacks = this._callbacks["$" + event];
114
- if (!callbacks) return this;
115
- if (1 == arguments.length) {
116
- delete this._callbacks["$" + event];
117
- return this;
118
- }
119
- var cb;
120
- for (var i = 0; i < callbacks.length; i++) {
121
- cb = callbacks[i];
122
- if (cb === fn || cb.fn === fn) {
123
- callbacks.splice(i, 1);
124
- break;
125
- }
126
- }
127
- if (callbacks.length === 0) {
128
- delete this._callbacks["$" + event];
129
- }
130
- return this;
48
+ Emitter3.prototype.on = function(event, listener) {
49
+ var _a;
50
+ const callbacks = (_a = this._callbacks.get(event)) != null ? _a : [];
51
+ callbacks.push(listener);
52
+ this._callbacks.set(event, callbacks);
53
+ return this;
54
+ };
55
+ Emitter3.prototype.once = function(event, listener) {
56
+ const on = (...arguments_) => {
57
+ this.off(event, on);
58
+ listener.apply(this, arguments_);
131
59
  };
132
- Emitter.prototype.emit = function(event) {
133
- this._callbacks = this._callbacks || {};
134
- var args = new Array(arguments.length - 1), callbacks = this._callbacks["$" + event];
135
- for (var i = 1; i < arguments.length; i++) {
136
- args[i - 1] = arguments[i];
137
- }
138
- if (callbacks) {
139
- callbacks = callbacks.slice(0);
140
- for (var i = 0, len = callbacks.length; i < len; ++i) {
141
- callbacks[i].apply(this, args);
142
- }
143
- }
60
+ on.fn = listener;
61
+ this.on(event, on);
62
+ return this;
63
+ };
64
+ Emitter3.prototype.off = function(event, listener) {
65
+ if (event === void 0 && listener === void 0) {
66
+ this._callbacks.clear();
144
67
  return this;
145
- };
146
- Emitter.prototype.listeners = function(event) {
147
- this._callbacks = this._callbacks || {};
148
- return this._callbacks["$" + event] || [];
149
- };
150
- Emitter.prototype.hasListeners = function(event) {
151
- return !!this.listeners(event).length;
152
- };
153
- }
154
- });
155
-
156
- // node_modules/.pnpm/@pirxpilot+events@1.0.1/node_modules/@pirxpilot/events/index.js
157
- var require_events = __commonJS({
158
- "node_modules/.pnpm/@pirxpilot+events@1.0.1/node_modules/@pirxpilot/events/index.js"(exports, module) {
159
- module.exports = events;
160
- function events(el, obj) {
161
- var handlers = {};
162
- function bind(name, handler, opts) {
163
- if (!handler) {
164
- handler = name;
165
- }
166
- if (typeof handler === "string") {
167
- handler = obj[handler].bind(obj);
168
- }
169
- el.addEventListener(name, handler, opts);
170
- handlers[name] = {
171
- handler,
172
- opts
173
- };
174
- }
175
- function do_unbind(name) {
176
- var h = handlers[name];
177
- if (!h) {
178
- return;
179
- }
180
- el.removeEventListener(name, h.handler, h.opts);
181
- delete handlers[name];
182
- }
183
- function unbind(name) {
184
- if (!name) {
185
- return unbindAll();
186
- }
187
- do_unbind(name);
188
- }
189
- function unbindAll() {
190
- Object.keys(handlers).forEach(do_unbind);
191
- }
192
- return {
193
- bind,
194
- unbind
195
- };
196
- }
197
- }
198
- });
199
-
200
- // node_modules/.pnpm/@pirxpilot+swipe@2.0.2/node_modules/@pirxpilot/swipe/index.js
201
- var require_swipe = __commonJS({
202
- "node_modules/.pnpm/@pirxpilot+swipe@2.0.2/node_modules/@pirxpilot/swipe/index.js"(exports, module) {
203
- var has3d = require_has_translate3d();
204
- var Emitter = require_component_emitter();
205
- var events = require_events();
206
- var min = Math.min;
207
- var max = Math.max;
208
- module.exports = Swipe;
209
- function Swipe(el) {
210
- if (!(this instanceof Swipe)) return new Swipe(el);
211
- if (!el) throw new TypeError("Swipe() requires an element");
212
- this.child = el.children[0];
213
- this.touchAction("none");
214
- this.currentEl = this.children().visible[0];
215
- this.currentVisible = 0;
216
- this.current = 0;
217
- this.el = el;
218
- this.refresh();
219
- this.interval(5e3);
220
- this.duration(300);
221
- this.fastThreshold(200);
222
- this.threshold(0.5);
223
- this.show(0, 0, { silent: true });
224
- this.bind();
225
68
  }
226
- Emitter(Swipe.prototype);
227
- Swipe.prototype.threshold = function(n) {
228
- this._threshold = n;
229
- };
230
- Swipe.prototype.fastThreshold = function(ms) {
231
- this._fastThreshold = ms;
232
- };
233
- Swipe.prototype.refresh = function() {
234
- var children = this.children();
235
- var visible2 = children.visible.length;
236
- var prev = this.visible || visible2;
237
- var i = indexOf(children.visible, this.currentEl);
238
- if (visible2 < prev && i <= this.currentVisible && i >= 0) {
239
- this.currentVisible -= this.currentVisible - i;
240
- } else if (visible2 > prev && i > this.currentVisible) {
241
- this.currentVisible += i - this.currentVisible;
242
- }
243
- this.visible = visible2;
244
- this.childWidth = this.el.getBoundingClientRect().width;
245
- this.width = Math.ceil(this.childWidth * visible2);
246
- this.child.style.width = this.width + "px";
247
- this.child.style.height = this.height + "px";
248
- this.show(this.currentVisible, 0, { silent: true });
249
- };
250
- Swipe.prototype.bind = function() {
251
- this.events = events(this.child, this);
252
- this.docEvents = events(document, this);
253
- if ("PointerEvent" in window) {
254
- this.events.bind("pointerdown", "ontouchstart");
255
- this.events.bind("pointermove", "ontouchmove");
256
- this.events.bind("pointerup", "ontouchend");
257
- this.events.bind("pointercancel", "ontouchend");
258
- } else {
259
- this.events.bind("mousedown", "ontouchstart");
260
- this.events.bind("mousemove", "ontouchmove");
261
- this.docEvents.bind("mouseup", "ontouchend");
262
- this.events.bind("touchstart", "ontouchstart");
263
- this.events.bind("touchmove", "ontouchmove");
264
- this.docEvents.bind("touchend", "ontouchend");
265
- }
266
- };
267
- Swipe.prototype.unbind = function() {
268
- this.events.unbind();
269
- this.docEvents.unbind();
270
- };
271
- Swipe.prototype.ontouchstart = function(e) {
272
- this.transitionDuration(0);
273
- this.dx = 0;
274
- this.updown = null;
275
- if ("PointerEvent" in window) {
276
- e.target.setPointerCapture(e.pointerId);
277
- }
278
- var touch = this.getTouch(e);
279
- this.down = {
280
- x: touch.pageX,
281
- y: touch.pageY,
282
- at: /* @__PURE__ */ new Date()
283
- };
284
- };
285
- Swipe.prototype.ontouchmove = function(e) {
286
- if (!this.down || this.updown) return;
287
- var touch = this.getTouch(e);
288
- if (!touch) return;
289
- var down = this.down;
290
- var x = touch.pageX;
291
- var w = this.childWidth;
292
- var i = this.currentVisible;
293
- this.dx = x - down.x;
294
- if (null == this.updown) {
295
- var y = touch.pageY;
296
- var dy = y - down.y;
297
- var slope = dy / this.dx;
298
- if (slope > 1 || slope < -1) {
299
- this.updown = true;
300
- return;
301
- } else {
302
- this.updown = false;
303
- }
304
- }
305
- e.preventDefault();
306
- var dir = this.dx < 0 ? 1 : 0;
307
- if (this.isFirst() && 0 === dir) this.dx /= 2;
308
- if (this.isLast() && 1 === dir) this.dx /= 2;
309
- this.translate(i * w + -this.dx);
310
- };
311
- Swipe.prototype.ontouchend = function(e) {
312
- e.stopPropagation();
313
- if (!this.down) return;
314
- if ("PointerEvent" in window) {
315
- e.target.releasePointerCapture(e.pointerId);
316
- }
317
- var dx = this.dx;
318
- var w = this.childWidth;
319
- var ms = /* @__PURE__ */ new Date() - this.down.at;
320
- var threshold = ms < this._fastThreshold ? w / 10 : w * this._threshold;
321
- var dir = dx < 0 ? 1 : 0;
322
- var half = Math.abs(dx) >= threshold;
323
- this.down = null;
324
- if (this.isFirst() && 1 == dir && half) return this.next();
325
- if (this.isFirst()) return this.prev();
326
- if (this.isLast() && 1 == dir) return this.next();
327
- if (1 === dir && half) return this.next();
328
- if (0 === dir && half) return this.prev();
329
- this.show(this.currentVisible);
330
- };
331
- Swipe.prototype.duration = function(ms) {
332
- this._duration = ms;
333
- return this;
334
- };
335
- Swipe.prototype.interval = function(ms) {
336
- this._interval = ms;
337
- return this;
338
- };
339
- Swipe.prototype.play = function() {
340
- if (this.timer) return;
341
- this.timer = setInterval(this.cycle.bind(this), this._interval);
342
- return this;
343
- };
344
- Swipe.prototype.stop = function() {
345
- clearInterval(this.timer);
346
- this.timer = null;
347
- return this;
348
- };
349
- Swipe.prototype.cycle = function() {
350
- if (this.isLast()) {
351
- this.currentVisible = -1;
352
- this.next();
353
- } else {
354
- this.next();
355
- }
356
- };
357
- Swipe.prototype.isFirst = function() {
358
- return this.currentVisible === 0;
359
- };
360
- Swipe.prototype.isLast = function() {
361
- return this.currentVisible == this.visible - 1;
362
- };
363
- Swipe.prototype.prev = function() {
364
- this.show(this.currentVisible - 1);
69
+ if (listener === void 0) {
70
+ this._callbacks.delete(event);
365
71
  return this;
366
- };
367
- Swipe.prototype.next = function() {
368
- this.show(this.currentVisible + 1);
369
- return this;
370
- };
371
- Swipe.prototype.show = function(i, ms, options) {
372
- options = options || {};
373
- if (null == ms) ms = this._duration;
374
- var self = this;
375
- var children = this.children();
376
- i = max(0, min(i, children.visible.length - 1));
377
- this.currentVisible = i;
378
- this.currentEl = children.visible[i];
379
- this.current = indexOf(children.all, this.currentEl);
380
- this.transitionDuration(ms);
381
- this.translate(this.childWidth * i);
382
- if (!options.silent) {
383
- this.emit("showing", this.current, this.currentEl);
384
- if (!ms) return this;
385
- this.child.addEventListener("transitionend", function shown() {
386
- if (self.current == i) self.emit("show", self.current, self.currentEl);
387
- self.child.removeEventListener("transitionend", shown);
388
- });
389
- }
390
- return this;
391
- };
392
- Swipe.prototype.children = function() {
393
- var els = this.child.children;
394
- var ret = {
395
- all: els,
396
- visible: [],
397
- hidden: []
398
- };
399
- for (var i = 0; i < els.length; i++) {
400
- var el = els[i];
401
- if (visible(el)) {
402
- ret.visible.push(el);
403
- } else {
404
- ret.hidden.push(el);
72
+ }
73
+ const callbacks = this._callbacks.get(event);
74
+ if (callbacks) {
75
+ for (const [index, callback] of callbacks.entries()) {
76
+ if (callback === listener || callback.fn === listener) {
77
+ callbacks.splice(index, 1);
78
+ break;
405
79
  }
406
80
  }
407
- return ret;
408
- };
409
- Swipe.prototype.transitionDuration = function(ms) {
410
- var s = this.child.style;
411
- s.transition = ms + "ms transform";
412
- };
413
- Swipe.prototype.translate = function(x) {
414
- var s = this.child.style;
415
- x = -x;
416
- if (has3d) {
417
- s.transform = "translate3d(" + x + "px, 0, 0)";
81
+ if (callbacks.length === 0) {
82
+ this._callbacks.delete(event);
418
83
  } else {
419
- s.transform = "translateX(" + x + "px)";
84
+ this._callbacks.set(event, callbacks);
420
85
  }
421
- };
422
- Swipe.prototype.touchAction = function(value) {
423
- var s = this.child.style;
424
- s.touchAction = value;
425
- };
426
- Swipe.prototype.getTouch = function(e) {
427
- var touch = e;
428
- if (e.changedTouches && e.changedTouches.length > 0) {
429
- touch = e.changedTouches[0];
430
- }
431
- return touch;
432
- };
433
- function indexOf(els, el) {
434
- for (var i = 0; i < els.length; i++) {
435
- if (els[i] == el) return i;
436
- }
437
- return -1;
438
- }
439
- function visible(el) {
440
- return getComputedStyle(el).display != "none";
441
86
  }
442
- }
443
- });
444
-
445
- // node_modules/.pnpm/el-component@1.0.1/node_modules/el-component/index.js
446
- var require_el_component = __commonJS({
447
- "node_modules/.pnpm/el-component@1.0.1/node_modules/el-component/index.js"(exports, module) {
448
- var voids = [
449
- "area",
450
- "base",
451
- "br",
452
- "col",
453
- "embed",
454
- "hr",
455
- "img",
456
- "input",
457
- "keygen",
458
- "link",
459
- "menuitem",
460
- "meta",
461
- "param",
462
- "source",
463
- "track",
464
- "wbr"
465
- ].reduce(function(o, v) {
466
- o[v] = true;
467
- return o;
468
- }, /* @__PURE__ */ Object.create(null));
469
- function htmlTag(tag2, content, attrStr) {
470
- var text = [
471
- "<",
472
- tag2,
473
- attrStr ? " " + attrStr : "",
474
- ">"
475
- ];
476
- if (!voids[tag2]) {
477
- text = text.concat([
478
- content || "",
479
- "</",
480
- tag2,
481
- ">"
482
- ]);
87
+ return this;
88
+ };
89
+ Emitter3.prototype.emit = function(event, ...arguments_) {
90
+ const callbacks = this._callbacks.get(event);
91
+ if (callbacks) {
92
+ const callbacksCopy = [...callbacks];
93
+ for (const callback of callbacksCopy) {
94
+ callback.apply(this, arguments_);
483
95
  }
484
- return text;
485
96
  }
486
- function xmlTag(tag2, content, attrStr) {
487
- var text = [
488
- "<",
489
- tag2,
490
- attrStr ? " " + attrStr : ""
491
- ];
492
- if (!content || !content.length) {
493
- text.push("/>");
494
- } else {
495
- text = text.concat([
496
- ">",
497
- content,
498
- "</",
499
- tag2,
500
- ">"
501
- ]);
502
- }
503
- return text;
97
+ return this;
98
+ };
99
+ Emitter3.prototype.listeners = function(event) {
100
+ var _a;
101
+ return (_a = this._callbacks.get(event)) != null ? _a : [];
102
+ };
103
+ Emitter3.prototype.listenerCount = function(event) {
104
+ if (event) {
105
+ return this.listeners(event).length;
504
106
  }
505
- function toStr(tagFn, tag2, content, attrs) {
506
- var attrStr, classes, ids;
507
- if (typeof content !== "string") {
508
- attrs = content;
509
- content = "";
510
- }
511
- tag2 = tag2 || "";
512
- attrs = attrs || {};
513
- classes = tag2.split(".");
514
- tag2 = classes.shift() || "div";
515
- if (classes.length) {
516
- classes = classes.join(" ");
517
- if (attrs["class"]) {
518
- attrs["class"] += " " + classes;
519
- } else {
520
- attrs["class"] = classes;
521
- }
522
- }
523
- ids = tag2.split("#");
524
- if (ids.length > 1) {
525
- tag2 = ids[0] || "div";
526
- attrs.id = ids[1];
527
- }
528
- attrStr = Object.keys(attrs).map(function(attr) {
529
- return attr + '="' + attrs[attr] + '"';
530
- }).join(" ");
531
- return tagFn(tag2, content, attrStr).join("");
107
+ let totalCount = 0;
108
+ for (const callbacks of this._callbacks.values()) {
109
+ totalCount += callbacks.length;
532
110
  }
533
- module.exports = toStr.bind(null, htmlTag);
534
- module.exports.xml = toStr.bind(null, xmlTag);
111
+ return totalCount;
112
+ };
113
+ Emitter3.prototype.hasListeners = function(event) {
114
+ return this.listenerCount(event) > 0;
115
+ };
116
+ Emitter3.prototype.addEventListener = Emitter3.prototype.on;
117
+ Emitter3.prototype.removeListener = Emitter3.prototype.off;
118
+ Emitter3.prototype.removeEventListener = Emitter3.prototype.off;
119
+ Emitter3.prototype.removeAllListeners = Emitter3.prototype.off;
120
+ if (typeof module !== "undefined") {
121
+ module.exports = Emitter3;
535
122
  }
536
- });
123
+ }
124
+ });
537
125
 
538
- // node_modules/.pnpm/tiny-pager@1.0.0/node_modules/tiny-pager/index.js
539
- var require_tiny_pager = __commonJS({
540
- "node_modules/.pnpm/tiny-pager@1.0.0/node_modules/tiny-pager/index.js"(exports, module) {
541
- var Emitter = require_component_emitter();
542
- var el = require_el_component();
543
- module.exports = Pager;
544
- function Pager(el2) {
545
- if (!(this instanceof Pager)) {
546
- return new Pager(el2);
547
- }
548
- this._total = 0;
549
- this._current = 0;
550
- this.el = el2;
551
- el2.addEventListener("click", this.onclick.bind(this));
126
+ // node_modules/.pnpm/yields-keycode@1.1.0/node_modules/yields-keycode/index.js
127
+ var require_yields_keycode = __commonJS({
128
+ "node_modules/.pnpm/yields-keycode@1.1.0/node_modules/yields-keycode/index.js"(exports, module) {
129
+ var map = {
130
+ backspace: 8,
131
+ command: 91,
132
+ tab: 9,
133
+ clear: 12,
134
+ enter: 13,
135
+ shift: 16,
136
+ ctrl: 17,
137
+ alt: 18,
138
+ capslock: 20,
139
+ escape: 27,
140
+ esc: 27,
141
+ space: 32,
142
+ pageup: 33,
143
+ pagedown: 34,
144
+ end: 35,
145
+ home: 36,
146
+ left: 37,
147
+ up: 38,
148
+ right: 39,
149
+ down: 40,
150
+ del: 46,
151
+ comma: 188,
152
+ f1: 112,
153
+ f2: 113,
154
+ f3: 114,
155
+ f4: 115,
156
+ f5: 116,
157
+ f6: 117,
158
+ f7: 118,
159
+ f8: 119,
160
+ f9: 120,
161
+ f10: 121,
162
+ f11: 122,
163
+ f12: 123,
164
+ ",": 188,
165
+ ".": 190,
166
+ "/": 191,
167
+ "`": 192,
168
+ "-": 189,
169
+ "=": 187,
170
+ ";": 186,
171
+ "[": 219,
172
+ "\\": 220,
173
+ "]": 221,
174
+ "'": 222
175
+ };
176
+ module.exports = function(name) {
177
+ return map[name.toLowerCase()] || name.toUpperCase().charCodeAt(0);
178
+ };
179
+ }
180
+ });
181
+
182
+ // node_modules/.pnpm/yields-k-sequence@0.1.0/node_modules/yields-k-sequence/index.js
183
+ var require_yields_k_sequence = __commonJS({
184
+ "node_modules/.pnpm/yields-k-sequence@0.1.0/node_modules/yields-k-sequence/index.js"(exports, module) {
185
+ var keycode = require_yields_keycode();
186
+ module.exports = sequence;
187
+ function sequence(keys, ms, fn) {
188
+ var codes = keys.split(/ +/).map(keycode), clen = codes.length, seq = [], i = 0, prev;
189
+ if (2 == arguments.length) {
190
+ fn = ms;
191
+ ms = 500;
552
192
  }
553
- Emitter(Pager.prototype);
554
- Pager.prototype.total = function total(t) {
555
- this._total = t;
556
- return this;
557
- };
558
- Pager.prototype.onclick = function onclick(e) {
559
- var page, target = e.target || e.srcElement;
560
- page = Array.prototype.indexOf.call(this.el.children, target);
561
- if (page < 0) {
562
- return;
563
- }
564
- e.preventDefault();
565
- e.stopPropagation();
566
- this.select(page);
567
- };
568
- Pager.prototype.select = function select(page, opts) {
569
- var silent = opts && opts.silent;
570
- if (page === this._current) {
571
- return;
572
- }
573
- Array.prototype.forEach.call(this.el.children, function(a, i) {
574
- a.className = i == page ? "active" : "inactive";
575
- });
576
- this._current = page;
577
- if (!silent) {
578
- this.emit("show", this._current);
579
- }
580
- return this;
581
- };
582
- Pager.prototype.render = function render6() {
583
- var i, html = [];
584
- for (i = 0; i < this._total; i++) {
585
- html.push(i !== this._current ? "a.inactive" : "a.active");
586
- }
587
- this.el.innerHTML = html.map(function(item) {
588
- return el(item);
589
- }).join("");
590
- return this;
193
+ return function(e) {
194
+ var code = codes[i++];
195
+ if (42 != code && code != e.which) return reset();
196
+ if (prev && /* @__PURE__ */ new Date() - prev > ms) return reset();
197
+ var len = seq.push(e.which);
198
+ prev = /* @__PURE__ */ new Date();
199
+ if (len != clen) return;
200
+ reset();
201
+ fn(e);
591
202
  };
203
+ function reset() {
204
+ prev = null;
205
+ seq = [];
206
+ i = 0;
207
+ }
592
208
  }
593
- });
209
+ }
210
+ });
594
211
 
595
- // node_modules/.pnpm/yields-keycode@1.1.0/node_modules/yields-keycode/index.js
596
- var require_yields_keycode = __commonJS({
597
- "node_modules/.pnpm/yields-keycode@1.1.0/node_modules/yields-keycode/index.js"(exports, module) {
598
- var map = {
599
- backspace: 8,
600
- command: 91,
601
- tab: 9,
602
- clear: 12,
603
- enter: 13,
604
- shift: 16,
605
- ctrl: 17,
606
- alt: 18,
607
- capslock: 20,
608
- escape: 27,
609
- esc: 27,
610
- space: 32,
611
- pageup: 33,
612
- pagedown: 34,
613
- end: 35,
614
- home: 36,
615
- left: 37,
616
- up: 38,
617
- right: 39,
618
- down: 40,
619
- del: 46,
620
- comma: 188,
621
- f1: 112,
622
- f2: 113,
623
- f3: 114,
624
- f4: 115,
625
- f5: 116,
626
- f6: 117,
627
- f7: 118,
628
- f8: 119,
629
- f9: 120,
630
- f10: 121,
631
- f11: 122,
632
- f12: 123,
633
- ",": 188,
634
- ".": 190,
635
- "/": 191,
636
- "`": 192,
637
- "-": 189,
638
- "=": 187,
639
- ";": 186,
640
- "[": 219,
641
- "\\": 220,
642
- "]": 221,
643
- "'": 222
644
- };
645
- module.exports = function(name) {
646
- return map[name.toLowerCase()] || name.toUpperCase().charCodeAt(0);
647
- };
212
+ // node_modules/.pnpm/component-os@0.0.1/node_modules/component-os/index.js
213
+ var require_component_os = __commonJS({
214
+ "node_modules/.pnpm/component-os@0.0.1/node_modules/component-os/index.js"(exports, module) {
215
+ module.exports = os();
216
+ function os() {
217
+ var ua = navigator.userAgent;
218
+ if (/mac/i.test(ua)) return "mac";
219
+ if (/win/i.test(ua)) return "windows";
220
+ if (/linux/i.test(ua)) return "linux";
648
221
  }
649
- });
222
+ }
223
+ });
650
224
 
651
- // node_modules/.pnpm/yields-k-sequence@0.1.0/node_modules/yields-k-sequence/index.js
652
- var require_yields_k_sequence = __commonJS({
653
- "node_modules/.pnpm/yields-k-sequence@0.1.0/node_modules/yields-k-sequence/index.js"(exports, module) {
654
- var keycode = require_yields_keycode();
655
- module.exports = sequence;
656
- function sequence(keys, ms, fn) {
657
- var codes = keys.split(/ +/).map(keycode), clen = codes.length, seq = [], i = 0, prev;
658
- if (2 == arguments.length) {
659
- fn = ms;
660
- ms = 500;
225
+ // node_modules/.pnpm/@pirxpilot+k@1.0.1/node_modules/@pirxpilot/k/lib/proto.js
226
+ var require_proto = __commonJS({
227
+ "node_modules/.pnpm/@pirxpilot+k@1.0.1/node_modules/@pirxpilot/k/lib/proto.js"(exports) {
228
+ var sequence = require_yields_k_sequence();
229
+ var keycode = require_yields_keycode();
230
+ var os = require_component_os();
231
+ var modifiers = {
232
+ 224: "command",
233
+ 91: "command",
234
+ 93: "command",
235
+ 16: "shift",
236
+ 17: "ctrl",
237
+ 18: "alt"
238
+ };
239
+ exports["super"] = "mac" == os ? "command" : "ctrl";
240
+ exports.handle = function(e, fn) {
241
+ var ignore = this.ignore;
242
+ var event = e.type;
243
+ var code = e.which;
244
+ if (fn) return this.bind(e, fn);
245
+ var mod = modifiers[code];
246
+ if ("keydown" == event && mod) {
247
+ this["super"] = exports["super"] == mod;
248
+ this[mod] = true;
249
+ this.modifiers = true;
250
+ this.active++;
251
+ return;
252
+ }
253
+ if (ignore && ignore(e)) return;
254
+ var all = this.listeners;
255
+ for (var i = 0; i < all.length; ++i) {
256
+ var invoke = true;
257
+ var obj = all[i];
258
+ var seq = obj.seq;
259
+ var mods = obj.mods;
260
+ fn = seq || obj.fn;
261
+ if (!seq && code != obj.code) continue;
262
+ if (event != obj.event) continue;
263
+ if (this.active != obj.mods.length) continue;
264
+ for (var j = 0; j < mods.length; ++j) {
265
+ if (!this[mods[j]]) {
266
+ invoke = null;
267
+ break;
268
+ }
661
269
  }
662
- return function(e) {
663
- var code = codes[i++];
664
- if (42 != code && code != e.which) return reset();
665
- if (prev && /* @__PURE__ */ new Date() - prev > ms) return reset();
666
- var len = seq.push(e.which);
667
- prev = /* @__PURE__ */ new Date();
668
- if (len != clen) return;
669
- reset();
270
+ if (invoke) {
670
271
  fn(e);
671
- };
672
- function reset() {
673
- prev = null;
674
- seq = [];
675
- i = 0;
676
272
  }
677
273
  }
678
- }
679
- });
680
-
681
- // node_modules/.pnpm/component-os@0.0.1/node_modules/component-os/index.js
682
- var require_component_os = __commonJS({
683
- "node_modules/.pnpm/component-os@0.0.1/node_modules/component-os/index.js"(exports, module) {
684
- module.exports = os();
685
- function os() {
686
- var ua = navigator.userAgent;
687
- if (/mac/i.test(ua)) return "mac";
688
- if (/win/i.test(ua)) return "windows";
689
- if (/linux/i.test(ua)) return "linux";
690
- }
691
- }
692
- });
693
-
694
- // node_modules/.pnpm/@pirxpilot+k@1.0.1/node_modules/@pirxpilot/k/lib/proto.js
695
- var require_proto = __commonJS({
696
- "node_modules/.pnpm/@pirxpilot+k@1.0.1/node_modules/@pirxpilot/k/lib/proto.js"(exports) {
697
- var sequence = require_yields_k_sequence();
698
- var keycode = require_yields_keycode();
699
- var os = require_component_os();
700
- var modifiers = {
701
- 224: "command",
702
- 91: "command",
703
- 93: "command",
704
- 16: "shift",
705
- 17: "ctrl",
706
- 18: "alt"
707
- };
708
- exports["super"] = "mac" == os ? "command" : "ctrl";
709
- exports.handle = function(e, fn) {
710
- var ignore = this.ignore;
711
- var event = e.type;
712
- var code = e.which;
713
- if (fn) return this.bind(e, fn);
714
- var mod = modifiers[code];
715
- if ("keydown" == event && mod) {
716
- this["super"] = exports["super"] == mod;
717
- this[mod] = true;
718
- this.modifiers = true;
719
- this.active++;
720
- return;
721
- }
722
- if (ignore && ignore(e)) return;
723
- var all = this.listeners;
724
- for (var i = 0; i < all.length; ++i) {
725
- var invoke = true;
726
- var obj = all[i];
727
- var seq = obj.seq;
728
- var mods = obj.mods;
729
- fn = seq || obj.fn;
730
- if (!seq && code != obj.code) continue;
731
- if (event != obj.event) continue;
732
- if (this.active != obj.mods.length) continue;
733
- for (var j = 0; j < mods.length; ++j) {
734
- if (!this[mods[j]]) {
735
- invoke = null;
736
- break;
737
- }
738
- }
739
- if (invoke) {
740
- fn(e);
741
- }
742
- }
743
- };
744
- exports.destroy = function() {
745
- this.el.removeEventListener("keydown", this._handle);
746
- this.el.removeEventListener("keyup", this._handle);
747
- this.el.removeEventListener("keyup", this._clear);
748
- this.el.removeEventListener("focus", this._clear);
274
+ };
275
+ exports.destroy = function() {
276
+ this.el.removeEventListener("keydown", this._handle);
277
+ this.el.removeEventListener("keyup", this._handle);
278
+ this.el.removeEventListener("keyup", this._clear);
279
+ this.el.removeEventListener("focus", this._clear);
280
+ this.listeners = [];
281
+ };
282
+ exports.unbind = function(keys, fn) {
283
+ var fns = this.listeners;
284
+ var len = fns.length;
285
+ var all;
286
+ if (0 === arguments.length) {
749
287
  this.listeners = [];
750
- };
751
- exports.unbind = function(keys, fn) {
752
- var fns = this.listeners;
753
- var len = fns.length;
754
- var all;
755
- if (0 === arguments.length) {
756
- this.listeners = [];
757
- return this;
758
- }
759
- all = parseKeys(keys);
760
- for (var i = 0; i < all.length; ++i) {
761
- for (var j = 0, obj; j < len; ++j) {
762
- obj = fns[j];
763
- if (!obj) continue;
764
- if (fn && obj.fn != fn) continue;
765
- if (obj.key != all[i].key) continue;
766
- if (!matches(obj, all[i])) continue;
767
- fns.splice(j--, 1);
768
- }
769
- }
770
288
  return this;
771
- };
772
- exports.bind = function(event, keys, fn) {
773
- var fns = this.listeners;
774
- var len;
775
- var all;
776
- if (2 == arguments.length) {
777
- fn = keys;
778
- keys = event;
779
- event = "keydown";
780
- }
781
- all = parseKeys(keys);
782
- len = all.length;
783
- for (var i = 0; i < len; ++i) {
784
- var obj = all[i];
785
- obj.seq = obj.seq && sequence(obj.key, fn);
786
- obj.event = event;
787
- obj.fn = fn;
788
- fns.push(obj);
789
- }
790
- return this;
791
- };
792
- exports.up = function(keys, fn) {
793
- return this.bind("keyup", keys, fn);
794
- };
795
- exports.down = function(keys, fn) {
796
- return this.bind("keydown", keys, fn);
797
- };
798
- exports.clear = function(e) {
799
- var code = e.keyCode || e.which;
800
- if (!(code in modifiers)) return;
801
- this.active--;
802
- this[modifiers[code]] = null;
803
- this.modifiers = this.command || this.shift || this.ctrl || this.alt;
804
- };
805
- exports.reset = function() {
806
- this.active = 0;
807
- this.modifiers = this.command = this.shift = this.ctrl = this.alt = null;
808
- };
809
- exports.ignore = function(e) {
810
- var el = e.target || e.srcElement;
811
- var name = el.tagName.toLowerCase();
812
- return "textarea" == name || "select" == name || "input" == name;
813
- };
814
- function parseKeys(keys) {
815
- keys = keys.replace("super", exports["super"]);
816
- var all = "," != keys ? keys.split(/ *, */) : [","];
817
- var ret = [];
818
- for (var i = 0; i < all.length; ++i) {
819
- if ("" === all[i]) continue;
820
- var mods = all[i].split(/ *\+ */);
821
- var key = mods.pop() || ",";
822
- ret.push({
823
- seq: !!(~key.indexOf(" ") || ~key.indexOf("*")),
824
- code: keycode(key),
825
- mods,
826
- key
827
- });
289
+ }
290
+ all = parseKeys(keys);
291
+ for (var i = 0; i < all.length; ++i) {
292
+ for (var j = 0, obj; j < len; ++j) {
293
+ obj = fns[j];
294
+ if (!obj) continue;
295
+ if (fn && obj.fn != fn) continue;
296
+ if (obj.key != all[i].key) continue;
297
+ if (!matches(obj, all[i])) continue;
298
+ fns.splice(j--, 1);
828
299
  }
829
- return ret;
830
300
  }
831
- function matches(a, b) {
832
- return 0 === b.mods.length || eql(a, b);
301
+ return this;
302
+ };
303
+ exports.bind = function(event, keys, fn) {
304
+ var fns = this.listeners;
305
+ var len;
306
+ var all;
307
+ if (2 == arguments.length) {
308
+ fn = keys;
309
+ keys = event;
310
+ event = "keydown";
833
311
  }
834
- function eql(a, b) {
835
- a = a.mods.sort().toString();
836
- b = b.mods.sort().toString();
837
- return a == b;
312
+ all = parseKeys(keys);
313
+ len = all.length;
314
+ for (var i = 0; i < len; ++i) {
315
+ var obj = all[i];
316
+ obj.seq = obj.seq && sequence(obj.key, fn);
317
+ obj.event = event;
318
+ obj.fn = fn;
319
+ fns.push(obj);
838
320
  }
839
- }
840
- });
841
-
842
- // node_modules/.pnpm/@pirxpilot+k@1.0.1/node_modules/@pirxpilot/k/lib/index.js
843
- var require_lib = __commonJS({
844
- "node_modules/.pnpm/@pirxpilot+k@1.0.1/node_modules/@pirxpilot/k/lib/index.js"(exports, module) {
845
- var proto = require_proto();
846
- module.exports = function(el) {
847
- function k2(e, fn) {
848
- k2.handle(e, fn);
849
- }
850
- k2._handle = proto.handle.bind(k2);
851
- k2._clear = proto.clear.bind(k2);
852
- k2._reset = proto.reset.bind(k2);
853
- el.addEventListener("keydown", k2._handle, false);
854
- el.addEventListener("keyup", k2._handle, false);
855
- el.addEventListener("keyup", k2._clear, false);
856
- el.addEventListener("focus", k2._reset, false);
857
- for (var p in proto) k2[p] = proto[p];
858
- k2.listeners = [];
859
- k2.active = 0;
860
- k2.el = el;
861
- return k2;
862
- };
863
- }
864
- });
865
-
866
- // node_modules/.pnpm/debounce@2.2.0/node_modules/debounce/index.js
867
- var require_debounce = __commonJS({
868
- "node_modules/.pnpm/debounce@2.2.0/node_modules/debounce/index.js"(exports, module) {
869
- function debounce2(function_, wait = 100, options = {}) {
870
- if (typeof function_ !== "function") {
871
- throw new TypeError(`Expected the first parameter to be a function, got \`${typeof function_}\`.`);
872
- }
873
- if (wait < 0) {
874
- throw new RangeError("`wait` must not be negative.");
875
- }
876
- const { immediate } = typeof options === "boolean" ? { immediate: options } : options;
877
- let storedContext;
878
- let storedArguments;
879
- let timeoutId;
880
- let timestamp;
881
- let result;
882
- function run() {
883
- const callContext = storedContext;
884
- const callArguments = storedArguments;
885
- storedContext = void 0;
886
- storedArguments = void 0;
887
- result = function_.apply(callContext, callArguments);
888
- return result;
889
- }
890
- function later() {
891
- const last = Date.now() - timestamp;
892
- if (last < wait && last >= 0) {
893
- timeoutId = setTimeout(later, wait - last);
894
- } else {
895
- timeoutId = void 0;
896
- if (!immediate) {
897
- result = run();
898
- }
899
- }
900
- }
901
- const debounced = function(...arguments_) {
902
- if (storedContext && this !== storedContext && Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)) {
903
- throw new Error("Debounced method called with different contexts of the same prototype.");
904
- }
905
- storedContext = this;
906
- storedArguments = arguments_;
907
- timestamp = Date.now();
908
- const callNow = immediate && !timeoutId;
909
- if (!timeoutId) {
910
- timeoutId = setTimeout(later, wait);
911
- }
912
- if (callNow) {
913
- result = run();
914
- }
915
- return result;
916
- };
917
- Object.defineProperty(debounced, "isPending", {
918
- get() {
919
- return timeoutId !== void 0;
920
- }
321
+ return this;
322
+ };
323
+ exports.up = function(keys, fn) {
324
+ return this.bind("keyup", keys, fn);
325
+ };
326
+ exports.down = function(keys, fn) {
327
+ return this.bind("keydown", keys, fn);
328
+ };
329
+ exports.clear = function(e) {
330
+ var code = e.keyCode || e.which;
331
+ if (!(code in modifiers)) return;
332
+ this.active--;
333
+ this[modifiers[code]] = null;
334
+ this.modifiers = this.command || this.shift || this.ctrl || this.alt;
335
+ };
336
+ exports.reset = function() {
337
+ this.active = 0;
338
+ this.modifiers = this.command = this.shift = this.ctrl = this.alt = null;
339
+ };
340
+ exports.ignore = function(e) {
341
+ var el = e.target || e.srcElement;
342
+ var name = el.tagName.toLowerCase();
343
+ return "textarea" == name || "select" == name || "input" == name;
344
+ };
345
+ function parseKeys(keys) {
346
+ keys = keys.replace("super", exports["super"]);
347
+ var all = "," != keys ? keys.split(/ *, */) : [","];
348
+ var ret = [];
349
+ for (var i = 0; i < all.length; ++i) {
350
+ if ("" === all[i]) continue;
351
+ var mods = all[i].split(/ *\+ */);
352
+ var key = mods.pop() || ",";
353
+ ret.push({
354
+ seq: !!(~key.indexOf(" ") || ~key.indexOf("*")),
355
+ code: keycode(key),
356
+ mods,
357
+ key
921
358
  });
922
- debounced.clear = () => {
923
- if (!timeoutId) {
924
- return;
925
- }
926
- clearTimeout(timeoutId);
927
- timeoutId = void 0;
928
- };
929
- debounced.flush = () => {
930
- if (!timeoutId) {
931
- return;
932
- }
933
- debounced.trigger();
934
- };
935
- debounced.trigger = () => {
936
- result = run();
937
- debounced.clear();
938
- };
939
- return debounced;
940
359
  }
941
- module.exports.debounce = debounce2;
942
- module.exports = debounce2;
360
+ return ret;
943
361
  }
944
- });
945
-
946
- // node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs
947
- function assign(target) {
948
- for (var i = 1; i < arguments.length; i++) {
949
- var source = arguments[i];
950
- for (var key in source) {
951
- target[key] = source[key];
952
- }
362
+ function matches(a, b) {
363
+ return 0 === b.mods.length || eql(a, b);
953
364
  }
954
- return target;
955
- }
956
- var defaultConverter = {
957
- read: function(value) {
958
- if (value[0] === '"') {
959
- value = value.slice(1, -1);
960
- }
961
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
962
- },
963
- write: function(value) {
964
- return encodeURIComponent(value).replace(
965
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
966
- decodeURIComponent
967
- );
365
+ function eql(a, b) {
366
+ a = a.mods.sort().toString();
367
+ b = b.mods.sort().toString();
368
+ return a == b;
968
369
  }
969
- };
970
- function init(converter, defaultAttributes) {
971
- function set(name, value, attributes) {
972
- if (typeof document === "undefined") {
973
- return;
974
- }
975
- attributes = assign({}, defaultAttributes, attributes);
976
- if (typeof attributes.expires === "number") {
977
- attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
978
- }
979
- if (attributes.expires) {
980
- attributes.expires = attributes.expires.toUTCString();
981
- }
982
- name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
983
- var stringifiedAttributes = "";
984
- for (var attributeName in attributes) {
985
- if (!attributes[attributeName]) {
986
- continue;
987
- }
988
- stringifiedAttributes += "; " + attributeName;
989
- if (attributes[attributeName] === true) {
990
- continue;
991
- }
992
- stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
370
+ }
371
+ });
372
+
373
+ // node_modules/.pnpm/@pirxpilot+k@1.0.1/node_modules/@pirxpilot/k/lib/index.js
374
+ var require_lib = __commonJS({
375
+ "node_modules/.pnpm/@pirxpilot+k@1.0.1/node_modules/@pirxpilot/k/lib/index.js"(exports, module) {
376
+ var proto = require_proto();
377
+ module.exports = function(el) {
378
+ function k2(e, fn) {
379
+ k2.handle(e, fn);
993
380
  }
994
- return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
381
+ k2._handle = proto.handle.bind(k2);
382
+ k2._clear = proto.clear.bind(k2);
383
+ k2._reset = proto.reset.bind(k2);
384
+ el.addEventListener("keydown", k2._handle, false);
385
+ el.addEventListener("keyup", k2._handle, false);
386
+ el.addEventListener("keyup", k2._clear, false);
387
+ el.addEventListener("focus", k2._reset, false);
388
+ for (var p in proto) k2[p] = proto[p];
389
+ k2.listeners = [];
390
+ k2.active = 0;
391
+ k2.el = el;
392
+ return k2;
393
+ };
394
+ }
395
+ });
396
+
397
+ // node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs
398
+ function assign(target) {
399
+ for (var i = 1; i < arguments.length; i++) {
400
+ var source = arguments[i];
401
+ for (var key in source) {
402
+ target[key] = source[key];
995
403
  }
996
- function get(name) {
997
- if (typeof document === "undefined" || arguments.length && !name) {
998
- return;
999
- }
1000
- var cookies = document.cookie ? document.cookie.split("; ") : [];
1001
- var jar = {};
1002
- for (var i = 0; i < cookies.length; i++) {
1003
- var parts = cookies[i].split("=");
1004
- var value = parts.slice(1).join("=");
1005
- try {
1006
- var found = decodeURIComponent(parts[0]);
1007
- jar[found] = converter.read(value, found);
1008
- if (name === found) {
1009
- break;
1010
- }
1011
- } catch (e) {
1012
- }
1013
- }
1014
- return name ? jar[name] : jar;
404
+ }
405
+ return target;
406
+ }
407
+ var defaultConverter = {
408
+ read: function(value) {
409
+ if (value[0] === '"') {
410
+ value = value.slice(1, -1);
1015
411
  }
1016
- return Object.create(
1017
- {
1018
- set,
1019
- get,
1020
- remove: function(name, attributes) {
1021
- set(
1022
- name,
1023
- "",
1024
- assign({}, attributes, {
1025
- expires: -1
1026
- })
1027
- );
1028
- },
1029
- withAttributes: function(attributes) {
1030
- return init(this.converter, assign({}, this.attributes, attributes));
1031
- },
1032
- withConverter: function(converter2) {
1033
- return init(assign({}, this.converter, converter2), this.attributes);
1034
- }
1035
- },
1036
- {
1037
- attributes: { value: Object.freeze(defaultAttributes) },
1038
- converter: { value: Object.freeze(converter) }
1039
- }
412
+ return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
413
+ },
414
+ write: function(value) {
415
+ return encodeURIComponent(value).replace(
416
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
417
+ decodeURIComponent
1040
418
  );
1041
419
  }
1042
- var api = init(defaultConverter, { path: "/" });
1043
-
1044
- // lib/client/about/index.js
1045
- function about() {
1046
- const s = document.querySelector(".hidden .about");
1047
- if (!s) {
420
+ };
421
+ function init(converter, defaultAttributes) {
422
+ function set(name, value, attributes) {
423
+ if (typeof document === "undefined") {
1048
424
  return;
1049
425
  }
1050
- if (!check()) {
1051
- return;
1052
- }
1053
- const section = s.parentNode;
1054
- const trigger = s.querySelector("a.close");
1055
- trigger.addEventListener("click", (e) => {
1056
- close();
1057
- e.preventDefault();
1058
- });
1059
- open();
1060
- function check() {
1061
- return window.parent === window && typeof api.get("resorts-open") === "undefined";
426
+ attributes = assign({}, defaultAttributes, attributes);
427
+ if (typeof attributes.expires === "number") {
428
+ attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
1062
429
  }
1063
- function close() {
1064
- section.classList.add("hidden");
430
+ if (attributes.expires) {
431
+ attributes.expires = attributes.expires.toUTCString();
1065
432
  }
1066
- function open() {
1067
- section.classList.remove("hidden");
433
+ name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
434
+ var stringifiedAttributes = "";
435
+ for (var attributeName in attributes) {
436
+ if (!attributes[attributeName]) {
437
+ continue;
438
+ }
439
+ stringifiedAttributes += "; " + attributeName;
440
+ if (attributes[attributeName] === true) {
441
+ continue;
442
+ }
443
+ stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
1068
444
  }
445
+ return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
1069
446
  }
1070
-
1071
- // lib/client/minimax/index.js
1072
- function minimax(node, selector) {
1073
- const my = {
1074
- trigger: node.querySelector(selector),
1075
- state: "open",
1076
- // by default trigger 'open' state
1077
- fn() {
1078
- }
1079
- };
1080
- const self = {
1081
- state: state2,
1082
- on
1083
- };
1084
- function onclick(e) {
1085
- e.preventDefault();
1086
- const state3 = node.classList.toggle(my.state);
1087
- my.fn.call(null, state3);
447
+ function get(name) {
448
+ if (typeof document === "undefined" || arguments.length && !name) {
449
+ return;
1088
450
  }
1089
- function state2(s) {
1090
- my.state = s;
1091
- return self;
451
+ var cookies = document.cookie ? document.cookie.split("; ") : [];
452
+ var jar = {};
453
+ for (var i = 0; i < cookies.length; i++) {
454
+ var parts = cookies[i].split("=");
455
+ var value = parts.slice(1).join("=");
456
+ try {
457
+ var found = decodeURIComponent(parts[0]);
458
+ jar[found] = converter.read(value, found);
459
+ if (name === found) {
460
+ break;
461
+ }
462
+ } catch (e) {
463
+ }
1092
464
  }
1093
- function on(fn) {
1094
- my.fn = fn;
1095
- return self;
465
+ return name ? jar[name] : jar;
466
+ }
467
+ return Object.create(
468
+ {
469
+ set,
470
+ get,
471
+ remove: function(name, attributes) {
472
+ set(
473
+ name,
474
+ "",
475
+ assign({}, attributes, {
476
+ expires: -1
477
+ })
478
+ );
479
+ },
480
+ withAttributes: function(attributes) {
481
+ return init(this.converter, assign({}, this.attributes, attributes));
482
+ },
483
+ withConverter: function(converter2) {
484
+ return init(assign({}, this.converter, converter2), this.attributes);
485
+ }
486
+ },
487
+ {
488
+ attributes: { value: Object.freeze(defaultAttributes) },
489
+ converter: { value: Object.freeze(converter) }
1096
490
  }
1097
- if (my.trigger) {
1098
- my.trigger.addEventListener("click", onclick);
491
+ );
492
+ }
493
+ var api = init(defaultConverter, { path: "/" });
494
+
495
+ // lib/client/about/index.js
496
+ function about() {
497
+ const s = document.querySelector(".hidden .about");
498
+ if (!s) {
499
+ return;
500
+ }
501
+ if (!check()) {
502
+ return;
503
+ }
504
+ const section = s.parentNode;
505
+ const trigger = s.querySelector("a.close");
506
+ trigger.addEventListener("click", (e) => {
507
+ close();
508
+ e.preventDefault();
509
+ });
510
+ open();
511
+ function check() {
512
+ return window.parent === window && typeof api.get("resorts-open") === "undefined";
513
+ }
514
+ function close() {
515
+ section.classList.add("hidden");
516
+ }
517
+ function open() {
518
+ section.classList.remove("hidden");
519
+ }
520
+ }
521
+
522
+ // lib/client/minimax/index.js
523
+ function minimax(node, selector) {
524
+ const my = {
525
+ trigger: node.querySelector(selector),
526
+ state: "open",
527
+ // by default trigger 'open' state
528
+ fn() {
1099
529
  }
530
+ };
531
+ const self = {
532
+ state: state2,
533
+ on
534
+ };
535
+ function onclick(e) {
536
+ e.preventDefault();
537
+ const state3 = node.classList.toggle(my.state);
538
+ my.fn.call(null, state3);
539
+ }
540
+ function state2(s) {
541
+ my.state = s;
542
+ return self;
543
+ }
544
+ function on(fn) {
545
+ my.fn = fn;
1100
546
  return self;
1101
547
  }
548
+ if (my.trigger) {
549
+ my.trigger.addEventListener("click", onclick);
550
+ }
551
+ return self;
552
+ }
1102
553
 
1103
- // lib/client/resort/dom.js
1104
- function removeAllChildren(node) {
1105
- while (node.hasChildNodes()) {
1106
- node.removeChild(node.lastChild);
1107
- }
554
+ // lib/client/resort/dom.js
555
+ function removeAllChildren(node) {
556
+ while (node.hasChildNodes()) {
557
+ node.removeChild(node.lastChild);
558
+ }
559
+ }
560
+ function next({ nextElementSibling, nextSibling }) {
561
+ return nextElementSibling || nextSibling;
562
+ }
563
+
564
+ // lib/client/resort/lifts.js
565
+ render.section = 0;
566
+ render.type = "lifts";
567
+ var states = ["open", "hold", "scheduled", "closed"];
568
+ function renderStatus(node, status) {
569
+ removeAllChildren(node);
570
+ if (status) {
571
+ node.innerHTML = Object.keys(status).map((name) => {
572
+ const klass = `status ls-${status[name]}`;
573
+ return `<li class="lift"><span class="name">${name}</span><span class="${klass}"></span></li>`;
574
+ }).join("");
1108
575
  }
1109
- function next({ nextElementSibling, nextSibling }) {
1110
- return nextElementSibling || nextSibling;
576
+ }
577
+ function renderStats(node, stats2) {
578
+ states.forEach((s) => node.querySelector(`.ls-${s}`).innerHTML = stats2 ? stats2[s] : 0);
579
+ }
580
+ function renderColorBar(node, percentage) {
581
+ states.forEach((state2) => {
582
+ const width = `width:${percentage ? percentage[state2] : 25}%;`;
583
+ node.querySelector(`.${state2}`).setAttribute("style", width);
584
+ });
585
+ }
586
+ function render(node, { status, stats: stats2 }) {
587
+ renderStatus(node.querySelector(".lifts"), status);
588
+ renderStats(node.querySelector(".summary"), stats2);
589
+ renderColorBar(node.querySelector(".summary-color-bar"), stats2.percentage);
590
+ }
591
+
592
+ // lib/client/resort/snow.js
593
+ var day = 24 * 60 * 60 * 1e3;
594
+ render2.section = 1;
595
+ render2.type = "snow";
596
+ function renderField(div, field, snow) {
597
+ const el = div.querySelector(`.${field}`);
598
+ const value = snow[field];
599
+ el.querySelector(".value").innerHTML = value || "";
600
+ el.classList.toggle("hidden", !value);
601
+ }
602
+ function render2(div, snow) {
603
+ if (Date.now() - snow.timestamp > day) {
604
+ return false;
1111
605
  }
606
+ renderField(div, "snowfall", snow);
607
+ renderField(div, "depth", snow);
608
+ renderField(div, "condition", snow);
609
+ div.querySelector(".notice").innerHTML = snow.notice || "";
610
+ return true;
611
+ }
1112
612
 
1113
- // lib/client/resort/lifts.js
1114
- render.section = 0;
1115
- render.type = "lifts";
1116
- var states = ["open", "hold", "scheduled", "closed"];
1117
- function renderStatus(node, status) {
1118
- removeAllChildren(node);
1119
- if (status) {
1120
- node.innerHTML = Object.keys(status).map((name) => {
1121
- const klass = `status ls-${status[name]}`;
1122
- return `<li class="lift"><span class="name">${name}</span><span class="${klass}"></span></li>`;
1123
- }).join("");
1124
- }
613
+ // lib/client/resort/weather.js
614
+ var day2 = 24 * 60 * 60 * 1e3;
615
+ render3.section = 1;
616
+ render3.type = "weather";
617
+ function renderIcon(li, icon) {
618
+ if (Array.isArray(icon)) {
619
+ icon.forEach((cl, i) => li.item(i).setAttribute("class", cl));
1125
620
  }
1126
- function renderStats(node, stats2) {
1127
- states.forEach((s) => node.querySelector(`.ls-${s}`).innerHTML = stats2 ? stats2[s] : 0);
621
+ }
622
+ function renderNotice(el, notice) {
623
+ if (!notice) {
624
+ return el.classList.add("hidden");
1128
625
  }
1129
- function renderColorBar(node, percentage) {
1130
- states.forEach((state2) => {
1131
- const width = `width:${percentage ? percentage[state2] : 25}%;`;
1132
- node.querySelector(`.${state2}`).setAttribute("style", width);
1133
- });
626
+ el.classList.remove("hidden");
627
+ el = el.querySelector("a");
628
+ el.setAttribute("href", notice.href);
629
+ el.setAttribute("title", `Go to ${notice.site}`);
630
+ el = el.querySelector("img");
631
+ el.setAttribute("src", notice.img);
632
+ el.setAttribute("style", `width:${notice.width}px;`);
633
+ el.setAttribute("alt", notice.site);
634
+ }
635
+ function render3(div, weather) {
636
+ if (Date.now() - weather.timestamp > day2) {
637
+ return false;
1134
638
  }
1135
- function render(node, { status, stats: stats2 }) {
1136
- renderStatus(node.querySelector(".lifts"), status);
1137
- renderStats(node.querySelector(".summary"), stats2);
1138
- renderColorBar(node.querySelector(".summary-color-bar"), stats2.percentage);
639
+ renderIcon(div.querySelectorAll(".weather-icon > ul > li"), weather.icon);
640
+ div.querySelector(".temperature").innerHTML = `${weather.temperature.max}&deg;F`;
641
+ const snowforecast = div.querySelector(".snowforecast");
642
+ snowforecast.classList.toggle("hidden", !weather.snow);
643
+ if (weather.snow) {
644
+ snowforecast.innerHTML = `${weather.snow}"`;
1139
645
  }
646
+ div.querySelector(".conditions").innerHTML = weather.conditions;
647
+ div.querySelector(".text").innerHTML = weather.text;
648
+ renderNotice(div.querySelector(".notice"), weather.notice);
649
+ return true;
650
+ }
1140
651
 
1141
- // lib/client/resort/snow.js
1142
- var day = 24 * 60 * 60 * 1e3;
1143
- render2.section = 1;
1144
- render2.type = "snow";
1145
- function renderField(div, field, snow) {
1146
- const el = div.querySelector(`.${field}`);
1147
- const value = snow[field];
1148
- el.querySelector(".value").innerHTML = value || "";
1149
- el.classList.toggle("hidden", !value);
1150
- }
1151
- function render2(div, snow) {
1152
- if (Date.now() - snow.timestamp > day) {
1153
- return false;
652
+ // node_modules/.pnpm/@pirxpilot+events@3.0.0/node_modules/@pirxpilot/events/index.js
653
+ function events(el, obj) {
654
+ const handlers = /* @__PURE__ */ new Map();
655
+ function bind(name, handler, opts) {
656
+ if (!handler) {
657
+ handler = name;
1154
658
  }
1155
- renderField(div, "snowfall", snow);
1156
- renderField(div, "depth", snow);
1157
- renderField(div, "condition", snow);
1158
- div.querySelector(".notice").innerHTML = snow.notice || "";
1159
- return true;
659
+ if (typeof handler === "string") {
660
+ handler = obj[handler].bind(obj);
661
+ }
662
+ el.addEventListener(name, handler, opts);
663
+ handlers.set(name, {
664
+ handler,
665
+ opts
666
+ });
667
+ }
668
+ function do_unbind(name) {
669
+ const h = handlers.get(name);
670
+ if (h) {
671
+ el.removeEventListener(name, h.handler, h.opts);
672
+ handlers.delete(name);
673
+ }
674
+ }
675
+ function unbind(name) {
676
+ return name ? do_unbind(name) : unbindAll();
1160
677
  }
678
+ function unbindAll() {
679
+ handlers.forEach((h, name) => el.removeEventListener(name, h.handler, h.opts));
680
+ handlers.clear();
681
+ }
682
+ return {
683
+ bind,
684
+ unbind
685
+ };
686
+ }
1161
687
 
1162
- // lib/client/resort/weather.js
1163
- var day2 = 24 * 60 * 60 * 1e3;
1164
- render3.section = 1;
1165
- render3.type = "weather";
1166
- function renderIcon(li, icon) {
1167
- if (Array.isArray(icon)) {
1168
- icon.forEach((cl, i) => li.item(i).setAttribute("class", cl));
688
+ // node_modules/.pnpm/@pirxpilot+swipe@3.0.0/node_modules/@pirxpilot/swipe/index.js
689
+ var import_component_emitter = __toESM(require_component_emitter(), 1);
690
+ var _duration, _interval, _threshold, _fastThreshold;
691
+ var Swipe = class extends import_component_emitter.default {
692
+ constructor(el) {
693
+ super();
694
+ __privateAdd(this, _duration, 300);
695
+ __privateAdd(this, _interval, 5e3);
696
+ __privateAdd(this, _threshold, 0.5);
697
+ __privateAdd(this, _fastThreshold, 200);
698
+ if (!el) throw new TypeError("Swipe() requires an element");
699
+ this.child = el.children[0];
700
+ this.touchAction("none");
701
+ this.currentEl = this.children().visible[0];
702
+ this.currentVisible = 0;
703
+ this.current = 0;
704
+ this.el = el;
705
+ this.refresh();
706
+ this.show(0, 0, { silent: true });
707
+ this.bind();
708
+ }
709
+ /**
710
+ * Set the swipe threshold to `n`.
711
+ *
712
+ * This is the factor required for swipe
713
+ * to detect when a slide has passed the
714
+ * given threshold, and may display the next
715
+ * or previous slide. For example the default
716
+ * of `.5` means that the user must swipe _beyond_
717
+ * half of the side width.
718
+ *
719
+ * @param {Number} n
720
+ * @api public
721
+ */
722
+ threshold(n) {
723
+ __privateSet(this, _threshold, n);
724
+ }
725
+ /**
726
+ * Set the "fast" swipe threshold to `ms`.
727
+ *
728
+ * This is the amount of time in milliseconds
729
+ * which determines if a swipe was "fast" or not. When
730
+ * the swipe's duration is less than `ms` only 1/10th of
731
+ * the slide's width must be exceeded to display the previous
732
+ * or next slide.
733
+ *
734
+ * @param {Number} n
735
+ * @api public
736
+ */
737
+ fastThreshold(ms) {
738
+ __privateSet(this, _fastThreshold, ms);
739
+ }
740
+ /**
741
+ * Refresh sizing data.
742
+ *
743
+ * @api public
744
+ */
745
+ refresh() {
746
+ const children = this.children();
747
+ const visible2 = children.visible.length;
748
+ const prev = this.visible || visible2;
749
+ const i = indexOf(children.visible, this.currentEl);
750
+ if (visible2 < prev && i <= this.currentVisible && i >= 0) {
751
+ this.currentVisible = i;
752
+ } else if (visible2 > prev && i > this.currentVisible) {
753
+ this.currentVisible = i;
1169
754
  }
755
+ this.visible = visible2;
756
+ this.childWidth = this.el.getBoundingClientRect().width;
757
+ this.width = Math.ceil(this.childWidth * visible2);
758
+ this.child.style.width = `${this.width}px`;
759
+ this.child.style.height = `${this.height}px`;
760
+ this.show(this.currentVisible, 0, { silent: true });
761
+ }
762
+ /**
763
+ * Bind event handlers.
764
+ *
765
+ * @api public
766
+ */
767
+ bind() {
768
+ this.events = events(this.child, this);
769
+ this.events.bind("pointerdown", "ontouchstart");
770
+ this.events.bind("pointermove", "ontouchmove");
771
+ this.events.bind("pointerup", "ontouchend");
772
+ this.events.bind("pointercancel", "ontouchend");
773
+ }
774
+ /**
775
+ * Unbind event handlers.
776
+ *
777
+ * @api public
778
+ */
779
+ unbind() {
780
+ this.events.unbind();
1170
781
  }
1171
- function renderNotice(el, notice) {
1172
- if (!notice) {
1173
- return el.classList.add("hidden");
782
+ /**
783
+ * Handle touchstart.
784
+ *
785
+ * @api private
786
+ */
787
+ ontouchstart(e) {
788
+ this.transitionDuration(0);
789
+ this.dx = 0;
790
+ this.updown = null;
791
+ e.target.setPointerCapture(e.pointerId);
792
+ this.down = {
793
+ x: e.pageX,
794
+ y: e.pageY,
795
+ at: /* @__PURE__ */ new Date()
796
+ };
797
+ }
798
+ /**
799
+ * Handle touchmove.
800
+ *
801
+ * For the first and last slides
802
+ * we apply some resistence to help
803
+ * indicate that you're at the edges.
804
+ *
805
+ * @api private
806
+ */
807
+ ontouchmove(e) {
808
+ if (!this.down || this.updown) return;
809
+ if (!e) return;
810
+ const down = this.down;
811
+ const x = e.pageX;
812
+ const w = this.childWidth;
813
+ const i = this.currentVisible;
814
+ this.dx = x - down.x;
815
+ if (null == this.updown) {
816
+ const y = e.pageY;
817
+ const dy = y - down.y;
818
+ const slope = dy / this.dx;
819
+ if (slope > 1 || slope < -1) {
820
+ this.updown = true;
821
+ return;
822
+ }
823
+ this.updown = false;
1174
824
  }
1175
- el.classList.remove("hidden");
1176
- el = el.querySelector("a");
1177
- el.setAttribute("href", notice.href);
1178
- el.setAttribute("title", `Go to ${notice.site}`);
1179
- el = el.querySelector("img");
1180
- el.setAttribute("src", notice.img);
1181
- el.setAttribute("style", `width:${notice.width}px;`);
1182
- el.setAttribute("alt", notice.site);
1183
- }
1184
- function render3(div, weather) {
1185
- if (Date.now() - weather.timestamp > day2) {
1186
- return false;
825
+ e.preventDefault();
826
+ const dir = this.dx < 0 ? 1 : 0;
827
+ if (this.isFirst() && 0 === dir) this.dx /= 2;
828
+ if (this.isLast() && 1 === dir) this.dx /= 2;
829
+ this.translate(i * w + -this.dx);
830
+ }
831
+ /**
832
+ * Handle touchend.
833
+ *
834
+ * @api private
835
+ */
836
+ ontouchend(e) {
837
+ e.stopPropagation();
838
+ if (!this.down) return;
839
+ e.target.releasePointerCapture(e.pointerId);
840
+ const dx = this.dx;
841
+ const w = this.childWidth;
842
+ const ms = Date.now() - this.down.at;
843
+ const threshold = ms < __privateGet(this, _fastThreshold) ? w / 10 : w * __privateGet(this, _threshold);
844
+ const dir = dx < 0 ? 1 : 0;
845
+ const half = Math.abs(dx) >= threshold;
846
+ this.down = null;
847
+ if (this.isFirst() && 1 === dir && half) return this.next();
848
+ if (this.isFirst()) return this.prev();
849
+ if (this.isLast() && 1 === dir) return this.next();
850
+ if (1 === dir && half) return this.next();
851
+ if (0 === dir && half) return this.prev();
852
+ this.show(this.currentVisible);
853
+ }
854
+ /**
855
+ * Set transition duration to `ms`.
856
+ *
857
+ * @param {Number} ms
858
+ * @return {Swipe} self
859
+ * @api public
860
+ */
861
+ duration(ms) {
862
+ __privateSet(this, _duration, ms);
863
+ return this;
864
+ }
865
+ /**
866
+ * Set cycle interval to `ms`.
867
+ *
868
+ * @param {Number} ms
869
+ * @return {Swipe} self
870
+ * @api public
871
+ */
872
+ interval(ms) {
873
+ __privateSet(this, _interval, ms);
874
+ return this;
875
+ }
876
+ /**
877
+ * Play through all the elements.
878
+ *
879
+ * @return {Swipe} self
880
+ * @api public
881
+ */
882
+ play() {
883
+ if (this.timer) return;
884
+ this.timer = setInterval(this.cycle.bind(this), __privateGet(this, _interval));
885
+ return this;
886
+ }
887
+ /**
888
+ * Stop playing.
889
+ *
890
+ * @return {Swipe} self
891
+ * @api public
892
+ */
893
+ stop() {
894
+ clearInterval(this.timer);
895
+ this.timer = null;
896
+ return this;
897
+ }
898
+ /**
899
+ * Show the next slide, when the end
900
+ * is reached start from the beginning.
901
+ *
902
+ * @api public
903
+ */
904
+ cycle() {
905
+ if (this.isLast()) {
906
+ this.currentVisible = -1;
907
+ this.next();
908
+ } else {
909
+ this.next();
1187
910
  }
1188
- renderIcon(div.querySelectorAll(".weather-icon > ul > li"), weather.icon);
1189
- div.querySelector(".temperature").innerHTML = `${weather.temperature.max}&deg;F`;
1190
- const snowforecast = div.querySelector(".snowforecast");
1191
- snowforecast.classList.toggle("hidden", !weather.snow);
1192
- if (weather.snow) {
1193
- snowforecast.innerHTML = `${weather.snow}"`;
911
+ }
912
+ /**
913
+ * Check if we're on the first visible slide.
914
+ *
915
+ * @return {Boolean}
916
+ * @api public
917
+ */
918
+ isFirst() {
919
+ return this.currentVisible === 0;
920
+ }
921
+ /**
922
+ * Check if we're on the last visible slide.
923
+ *
924
+ * @return {Boolean}
925
+ * @api public
926
+ */
927
+ isLast() {
928
+ return this.currentVisible === this.visible - 1;
929
+ }
930
+ /**
931
+ * Show the previous slide, if any.
932
+ *
933
+ * @return {Swipe} self
934
+ * @api public
935
+ */
936
+ prev() {
937
+ this.show(this.currentVisible - 1);
938
+ return this;
939
+ }
940
+ /**
941
+ * Show the next slide, if any.
942
+ *
943
+ * @return {Swipe} self
944
+ * @api public
945
+ */
946
+ next() {
947
+ this.show(this.currentVisible + 1);
948
+ return this;
949
+ }
950
+ /**
951
+ * Show slide `i`.
952
+ *
953
+ * Emits `show `event
954
+ *
955
+ * @param {Number} i
956
+ * @return {Swipe} self
957
+ * @api public
958
+ */
959
+ show(i, ms = __privateGet(this, _duration), { silent } = {}) {
960
+ const children = this.children();
961
+ i = Math.max(0, Math.min(i, children.visible.length - 1));
962
+ this.currentVisible = i;
963
+ this.currentEl = children.visible[i];
964
+ this.current = indexOf(children.all, this.currentEl);
965
+ this.transitionDuration(ms);
966
+ this.translate(this.childWidth * i);
967
+ if (!silent) {
968
+ this.emit("showing", this.current, this.currentEl);
969
+ if (!ms) return this;
970
+ this.child.addEventListener(
971
+ "transitionend",
972
+ () => {
973
+ if (this.current === i) this.emit("show", this.current, this.currentEl);
974
+ },
975
+ { once: true }
976
+ );
1194
977
  }
1195
- div.querySelector(".conditions").innerHTML = weather.conditions;
1196
- div.querySelector(".text").innerHTML = weather.text;
1197
- renderNotice(div.querySelector(".notice"), weather.notice);
1198
- return true;
978
+ return this;
1199
979
  }
1200
-
1201
- // lib/client/resort/webcams.js
1202
- var import_swipe = __toESM(require_swipe(), 1);
1203
- var import_tiny_pager = __toESM(require_tiny_pager(), 1);
1204
- render4.section = 1;
1205
- render4.type = "webcams";
1206
- var DELAY = 15 * 60 * 1e3;
1207
- function swiper(el) {
1208
- const ui = {
1209
- swipe: (0, import_swipe.default)(el.swipe),
1210
- pager: (0, import_tiny_pager.default)(el.pager)
980
+ /**
981
+ * Return children categorized by visibility.
982
+ *
983
+ * @return {Object}
984
+ * @api private
985
+ */
986
+ children() {
987
+ const els = this.child.children;
988
+ const ret = {
989
+ all: els,
990
+ visible: [],
991
+ hidden: []
1211
992
  };
1212
- function refresh(count) {
1213
- ui.swipe.refresh();
1214
- ui.pager.total(count).render();
1215
- el.pager.classList.toggle("hidden", count < 2);
993
+ for (let i = 0; i < els.length; i++) {
994
+ const el = els[i];
995
+ if (visible(el)) {
996
+ ret.visible.push(el);
997
+ } else {
998
+ ret.hidden.push(el);
999
+ }
1216
1000
  }
1217
- function current() {
1218
- return ui.swipe.currentVisible;
1001
+ return ret;
1002
+ }
1003
+ /**
1004
+ * Set transition duration.
1005
+ *
1006
+ * @api private
1007
+ */
1008
+ transitionDuration(ms) {
1009
+ this.child.style.transition = `${ms}ms transform`;
1010
+ }
1011
+ /**
1012
+ * Translate to `x`.
1013
+ *
1014
+ * TODO: use translate component
1015
+ *
1016
+ * @api private
1017
+ */
1018
+ translate(x) {
1019
+ this.child.style.transform = `translate3d(${-x}px, 0, 0)`;
1020
+ }
1021
+ /**
1022
+ * Sets the "touchAction" CSS style property to `value`.
1023
+ *
1024
+ * @api private
1025
+ */
1026
+ touchAction(value) {
1027
+ this.child.style.touchAction = value;
1028
+ }
1029
+ };
1030
+ _duration = new WeakMap();
1031
+ _interval = new WeakMap();
1032
+ _threshold = new WeakMap();
1033
+ _fastThreshold = new WeakMap();
1034
+ function indexOf(els, el) {
1035
+ for (let i = 0; i < els.length; i++) {
1036
+ if (els[i] === el) return i;
1037
+ }
1038
+ return -1;
1039
+ }
1040
+ function visible(el) {
1041
+ return getComputedStyle(el).display !== "none";
1042
+ }
1043
+
1044
+ // node_modules/.pnpm/tiny-pager@2.0.0/node_modules/tiny-pager/index.js
1045
+ var import_component_emitter2 = __toESM(require_component_emitter(), 1);
1046
+
1047
+ // node_modules/.pnpm/el-component@2.0.2/node_modules/el-component/index.js
1048
+ var voids = /* @__PURE__ */ new Set([
1049
+ "area",
1050
+ "base",
1051
+ "br",
1052
+ "col",
1053
+ "embed",
1054
+ "hr",
1055
+ "img",
1056
+ "input",
1057
+ "keygen",
1058
+ "link",
1059
+ "menuitem",
1060
+ "meta",
1061
+ "param",
1062
+ "source",
1063
+ "track",
1064
+ "wbr"
1065
+ ]);
1066
+ function htmlTag(tag2, content, attrStr) {
1067
+ const text = ["<", tag2, attrStr ? ` ${attrStr}` : "", ">"];
1068
+ if (!voids.has(tag2)) {
1069
+ text.push(content || "", "</", tag2, ">");
1070
+ }
1071
+ return text;
1072
+ }
1073
+ function xmlTag(tag2, content, attrStr) {
1074
+ const text = ["<", tag2, attrStr ? ` ${attrStr}` : ""];
1075
+ if (!content || !content.length) {
1076
+ text.push("/>");
1077
+ } else {
1078
+ text.push(">", content, "</", tag2, ">");
1079
+ }
1080
+ return text;
1081
+ }
1082
+ function toStr(tagFn, tagStr, content, attrs) {
1083
+ if (typeof content !== "string") {
1084
+ attrs = content;
1085
+ content = "";
1086
+ }
1087
+ attrs = attrs || {};
1088
+ let [tag2 = "div", ...classes] = (tagStr == null ? void 0 : tagStr.split(".")) || [];
1089
+ if (classes.length) {
1090
+ const classesStr = classes.join(" ");
1091
+ if (attrs["class"]) {
1092
+ attrs["class"] += ` ${classesStr}`;
1093
+ } else {
1094
+ attrs["class"] = classesStr;
1219
1095
  }
1220
- ui.pager.on("show", (n) => {
1221
- ui.swipe.show(n, null, {
1222
- silent: true
1223
- });
1224
- });
1225
- ui.swipe.on("show", (n) => {
1226
- ui.pager.select(n, {
1227
- silent: true
1228
- });
1229
- });
1230
- return {
1231
- refresh,
1232
- current
1233
- };
1234
1096
  }
1235
- function render4(div, webcams) {
1236
- let cams;
1237
- let timer;
1238
- let ui;
1239
- function refresh() {
1240
- cams.forEach((it) => {
1241
- const imgs = it.node.querySelectorAll("img");
1242
- const fn = swap.bind(null, imgs, it);
1243
- for (let i = 0; i < imgs.length; i++) {
1244
- imgs[i].onload = fn;
1245
- }
1246
- imgs[it.inactive].setAttribute("src", imgs[it.active].getAttribute("src"));
1247
- });
1097
+ const ids = tag2.split("#");
1098
+ if (ids.length > 1) {
1099
+ tag2 = ids[0] || "div";
1100
+ attrs.id = ids[1];
1101
+ }
1102
+ const attrStr = Object.entries(attrs).map(([attr, value]) => `${attr}="${value}"`).join(" ");
1103
+ return tagFn(tag2, content, attrStr).join("");
1104
+ }
1105
+ var el_component_default = toStr.bind(null, htmlTag);
1106
+ var xml = toStr.bind(null, xmlTag);
1107
+
1108
+ // node_modules/.pnpm/tiny-pager@2.0.0/node_modules/tiny-pager/index.js
1109
+ var _total, _current;
1110
+ var Pager = class extends import_component_emitter2.default {
1111
+ constructor(el) {
1112
+ super();
1113
+ __privateAdd(this, _total, 0);
1114
+ __privateAdd(this, _current, 0);
1115
+ this.el = el;
1116
+ el.addEventListener("click", this.onclick.bind(this));
1117
+ }
1118
+ total(t) {
1119
+ __privateSet(this, _total, t);
1120
+ return this;
1121
+ }
1122
+ onclick(e) {
1123
+ const target = e.target || e.srcElement;
1124
+ const page = Array.prototype.indexOf.call(this.el.children, target);
1125
+ if (page < 0) {
1126
+ return;
1248
1127
  }
1249
- function initCam(cam, { source, image, name, notice }) {
1250
- cam.querySelector("a").setAttribute("href", source);
1251
- cam.querySelector("img.active").setAttribute("src", image);
1252
- cam.querySelector("img.inactive").setAttribute("src", "");
1253
- cam.querySelector(".title").innerHTML = name;
1254
- cam.querySelector(".notice").innerHTML = notice || "";
1255
- cams.push({
1256
- node: cam,
1257
- active: 0,
1258
- inactive: 1
1259
- });
1128
+ e.preventDefault();
1129
+ e.stopPropagation();
1130
+ this.select(page);
1131
+ }
1132
+ select(page, opts) {
1133
+ if (page === __privateGet(this, _current)) {
1134
+ return;
1260
1135
  }
1261
- function init3() {
1262
- if (timer) {
1263
- clearInterval(timer);
1264
- timer = void 0;
1265
- }
1266
- cams = [];
1267
- const ul = div.querySelector("ul");
1268
- const li = ul.querySelectorAll("li");
1269
- webcams.forEach((webcam, i) => {
1270
- let cam;
1271
- if (i < li.length) {
1272
- cam = li[i];
1273
- } else {
1274
- cam = ul.appendChild(li[0].cloneNode(true));
1275
- }
1276
- initCam(cam.querySelector(".webcam"), webcam);
1277
- });
1278
- for (let i = Math.max(1, webcams.length); i < li.length; i++) {
1279
- ul.removeChild(li[i]);
1280
- }
1281
- if (!ui) {
1282
- ui = swiper({
1283
- swipe: div.querySelector(".swipe"),
1284
- pager: div.querySelector(".pager")
1285
- });
1286
- }
1287
- ui.refresh(webcams.length);
1288
- if (!cams.length) {
1289
- return false;
1290
- }
1291
- timer = setInterval(refresh, DELAY);
1292
- return true;
1136
+ Array.prototype.forEach.call(this.el.children, (a, i) => {
1137
+ a.className = i === page ? "active" : "inactive";
1138
+ });
1139
+ __privateSet(this, _current, page);
1140
+ if (!(opts == null ? void 0 : opts.silent)) {
1141
+ this.emit("show", __privateGet(this, _current));
1293
1142
  }
1294
- function swap(imgs, it) {
1295
- it.active = (it.active + 1) % 2;
1296
- it.inactive = (it.inactive + 1) % 2;
1297
- imgs[it.inactive].setAttribute("class", "inactive");
1298
- imgs[it.active].setAttribute("class", "active");
1299
- imgs[it.inactive].setAttribute("src", "");
1143
+ return this;
1144
+ }
1145
+ render() {
1146
+ const html = new Array(__privateGet(this, _total));
1147
+ for (let i = 0; i < __privateGet(this, _total); i++) {
1148
+ html[i] = el_component_default(i !== __privateGet(this, _current) ? "a.inactive" : "a.active");
1300
1149
  }
1301
- init3();
1150
+ this.el.innerHTML = html.join("");
1151
+ return this;
1302
1152
  }
1153
+ };
1154
+ _total = new WeakMap();
1155
+ _current = new WeakMap();
1303
1156
 
1304
- // lib/client/resort/index.js
1305
- function renderOpening(node, opening) {
1306
- if (opening) {
1307
- opening = opening.split("-");
1308
- if (new Date(opening[0], opening[1] - 1, opening[2]).getTime() <= Date.now()) {
1309
- node.dataset.opening = "";
1310
- node = node.querySelector(".opening-date");
1311
- node.parentNode.removeChild(node);
1312
- }
1313
- }
1157
+ // lib/client/resort/webcams.js
1158
+ render4.section = 1;
1159
+ render4.type = "webcams";
1160
+ var DELAY = 15 * 60 * 1e3;
1161
+ function swiper(el) {
1162
+ const ui = {
1163
+ swipe: new Swipe(el.swipe),
1164
+ pager: new Pager(el.pager)
1165
+ };
1166
+ function refresh(count) {
1167
+ ui.swipe.refresh();
1168
+ ui.pager.total(count).render();
1169
+ el.pager.classList.toggle("hidden", count < 2);
1314
1170
  }
1315
- var plugins = [render, render3, render4, render2];
1316
- function renderPlugins(node, getData) {
1317
- const sec = next(node);
1318
- plugins.forEach((plugin) => {
1319
- const data = getData(plugin.type);
1320
- if (!data) {
1321
- return;
1322
- }
1323
- const el = plugin.section ? sec.querySelector(`.${plugin.type}`) : node;
1324
- if (!el) {
1325
- return;
1326
- }
1327
- const show = plugin(el, data);
1328
- if (typeof show === "boolean") {
1329
- el.classList.toggle("visible", show);
1330
- el.classList.toggle("hiddent", !show);
1171
+ function current() {
1172
+ return ui.swipe.currentVisible;
1173
+ }
1174
+ ui.pager.on("show", (n) => {
1175
+ ui.swipe.show(n, null, {
1176
+ silent: true
1177
+ });
1178
+ });
1179
+ ui.swipe.on("show", (n) => {
1180
+ ui.pager.select(n, {
1181
+ silent: true
1182
+ });
1183
+ });
1184
+ return {
1185
+ refresh,
1186
+ current
1187
+ };
1188
+ }
1189
+ function render4(div, webcams) {
1190
+ let cams;
1191
+ let timer;
1192
+ let ui;
1193
+ function refresh() {
1194
+ cams.forEach((it) => {
1195
+ const imgs = it.node.querySelectorAll("img");
1196
+ const fn = swap.bind(null, imgs, it);
1197
+ for (let i = 0; i < imgs.length; i++) {
1198
+ imgs[i].onload = fn;
1331
1199
  }
1200
+ imgs[it.inactive].setAttribute("src", imgs[it.active].getAttribute("src"));
1332
1201
  });
1333
1202
  }
1334
- function render5(node, resort2) {
1335
- const tsPrev = JSON.parse(node.dataset.timestamp);
1336
- const tsCurr = resort2.timestamp;
1337
- renderPlugins(node, (plugin) => {
1338
- if (!resort2[plugin] || !tsCurr[plugin]) {
1339
- return;
1340
- }
1341
- if (tsPrev[plugin] && tsCurr[plugin] <= tsPrev[plugin]) {
1342
- return;
1343
- }
1344
- return resort2[plugin];
1203
+ function initCam(cam, { source, image, name, notice }) {
1204
+ cam.querySelector("a").setAttribute("href", source);
1205
+ cam.querySelector("img.active").setAttribute("src", image);
1206
+ cam.querySelector("img.inactive").setAttribute("src", "");
1207
+ cam.querySelector(".title").innerHTML = name;
1208
+ cam.querySelector(".notice").innerHTML = notice || "";
1209
+ cams.push({
1210
+ node: cam,
1211
+ active: 0,
1212
+ inactive: 1
1345
1213
  });
1346
- renderOpening(node, node.dataset.opening);
1347
- node.dataset.timestamp = JSON.stringify(tsCurr);
1348
- }
1349
- var MAX = 12;
1350
- function resort(node) {
1351
- let updateCounter = MAX;
1352
- function updateTimeToRefresh(counter) {
1353
- const ttr = node.querySelector(".time-to-refresh");
1354
- ttr.innerHTML = counter * 5;
1214
+ }
1215
+ function init3() {
1216
+ if (timer) {
1217
+ clearInterval(timer);
1218
+ timer = void 0;
1355
1219
  }
1356
- function refresh(now) {
1357
- const id = node.dataset.resort;
1358
- if (!node.classList.contains("open")) {
1359
- return;
1360
- }
1361
- if (now) {
1362
- updateCounter = 0;
1220
+ cams = [];
1221
+ const ul = div.querySelector("ul");
1222
+ const li = ul.querySelectorAll("li");
1223
+ webcams.forEach((webcam, i) => {
1224
+ let cam;
1225
+ if (i < li.length) {
1226
+ cam = li[i];
1363
1227
  } else {
1364
- updateCounter -= 1;
1365
- }
1366
- if (updateCounter > 0) {
1367
- updateTimeToRefresh(updateCounter);
1368
- return;
1228
+ cam = ul.appendChild(li[0].cloneNode(true));
1369
1229
  }
1370
- updateCounter = MAX;
1371
- updateTimeToRefresh(updateCounter);
1372
- fetch(`/api/resort/${id}`).then((res) => res.json()).then((resort2) => render5(node, resort2));
1230
+ initCam(cam.querySelector(".webcam"), webcam);
1231
+ });
1232
+ for (let i = Math.max(1, webcams.length); i < li.length; i++) {
1233
+ ul.removeChild(li[i]);
1373
1234
  }
1374
- function init3() {
1375
- const ds = node.dataset;
1376
- updateTimeToRefresh(MAX);
1377
- renderPlugins(node, (plugin) => {
1378
- const data = ds[plugin];
1379
- return data && JSON.parse(data);
1235
+ if (!ui) {
1236
+ ui = swiper({
1237
+ swipe: div.querySelector(".swipe"),
1238
+ pager: div.querySelector(".pager")
1380
1239
  });
1381
1240
  }
1382
- return {
1383
- init: init3,
1384
- refresh,
1385
- node
1386
- };
1241
+ ui.refresh(webcams.length);
1242
+ if (!cams.length) {
1243
+ return false;
1244
+ }
1245
+ timer = setInterval(refresh, DELAY);
1246
+ return true;
1387
1247
  }
1248
+ function swap(imgs, it) {
1249
+ it.active = (it.active + 1) % 2;
1250
+ it.inactive = (it.inactive + 1) % 2;
1251
+ imgs[it.inactive].setAttribute("class", "inactive");
1252
+ imgs[it.active].setAttribute("class", "active");
1253
+ imgs[it.inactive].setAttribute("src", "");
1254
+ }
1255
+ init3();
1256
+ }
1388
1257
 
1389
- // lib/client/state/index.js
1390
- var import_k = __toESM(require_lib(), 1);
1391
- var k = (0, import_k.default)(window);
1392
- function state(nodes, st, keys) {
1393
- const cookieName = `resorts-${st}`;
1394
- const self = {
1395
- load,
1396
- save,
1397
- update,
1398
- read
1399
- };
1400
- function find(id) {
1401
- return nodes.find((n) => n.dataset.resort === id);
1258
+ // lib/client/resort/index.js
1259
+ function renderOpening(node, opening) {
1260
+ if (opening) {
1261
+ opening = opening.split("-");
1262
+ if (new Date(opening[0], opening[1] - 1, opening[2]).getTime() <= Date.now()) {
1263
+ node.dataset.opening = "";
1264
+ node = node.querySelector(".opening-date");
1265
+ node.parentNode.removeChild(node);
1402
1266
  }
1403
- function read() {
1404
- const text = api.get(cookieName);
1405
- return (text == null ? void 0 : text.length) ? text.split(",") : [];
1267
+ }
1268
+ }
1269
+ var plugins = [render, render3, render4, render2];
1270
+ function renderPlugins(node, getData) {
1271
+ const sec = next(node);
1272
+ plugins.forEach((plugin) => {
1273
+ const data = getData(plugin.type);
1274
+ if (!data) {
1275
+ return;
1406
1276
  }
1407
- function write(arr) {
1408
- api.set(cookieName, arr.join(","), {
1409
- expires: 30,
1410
- path: "/",
1411
- secure: window.location.protocol === "https:",
1412
- sameSite: "strict"
1413
- });
1277
+ const el = plugin.section ? sec.querySelector(`.${plugin.type}`) : node;
1278
+ if (!el) {
1279
+ return;
1414
1280
  }
1415
- function update() {
1416
- const state2 = read().reduce((memo, id) => {
1417
- memo[id] = true;
1418
- return memo;
1419
- }, {});
1420
- nodes.forEach(({ dataset, classList }) => {
1421
- const id = dataset.resort;
1422
- state2[id] = classList.contains(st);
1423
- });
1424
- const selected = Object.keys(state2).filter((id) => state2[id]);
1425
- write(selected);
1426
- return selected;
1281
+ const show = plugin(el, data);
1282
+ if (typeof show === "boolean") {
1283
+ el.classList.toggle("visible", show);
1284
+ el.classList.toggle("hiddent", !show);
1427
1285
  }
1428
- function save() {
1429
- const selected = nodes.filter((n) => n.classList.contains(st)).map((n) => n.dataset.resort);
1430
- write(selected);
1431
- return selected;
1286
+ });
1287
+ }
1288
+ function render5(node, resort2) {
1289
+ const tsPrev = JSON.parse(node.dataset.timestamp);
1290
+ const tsCurr = resort2.timestamp;
1291
+ renderPlugins(node, (plugin) => {
1292
+ if (!resort2[plugin] || !tsCurr[plugin]) {
1293
+ return;
1432
1294
  }
1433
- function load() {
1434
- const selected = read();
1435
- selected.forEach((id) => {
1436
- const node = find(id);
1437
- if (node) {
1438
- node.classList.add(st);
1439
- }
1440
- });
1441
- return selected;
1295
+ if (tsPrev[plugin] && tsCurr[plugin] <= tsPrev[plugin]) {
1296
+ return;
1442
1297
  }
1443
- function all(on) {
1444
- nodes.forEach((n) => n.classList.toggle(st, on));
1445
- update();
1298
+ return resort2[plugin];
1299
+ });
1300
+ renderOpening(node, node.dataset.opening);
1301
+ node.dataset.timestamp = JSON.stringify(tsCurr);
1302
+ }
1303
+ var MAX = 12;
1304
+ function resort(node) {
1305
+ let updateCounter = MAX;
1306
+ function updateTimeToRefresh(counter) {
1307
+ const ttr = node.querySelector(".time-to-refresh");
1308
+ ttr.innerHTML = counter * 5;
1309
+ }
1310
+ function refresh(now) {
1311
+ const id = node.dataset.resort;
1312
+ if (!node.classList.contains("open")) {
1313
+ return;
1446
1314
  }
1447
- if (keys) {
1448
- k(keys.on, all.bind(null, true));
1449
- k(keys.off, all.bind(null, false));
1315
+ if (now) {
1316
+ updateCounter = 0;
1317
+ } else {
1318
+ updateCounter -= 1;
1450
1319
  }
1451
- return self;
1452
- }
1453
-
1454
- // lib/client/stats/index.js
1455
- function stats() {
1456
- const pie = document.querySelector(".stats .pie");
1457
- if (!pie) {
1320
+ if (updateCounter > 0) {
1321
+ updateTimeToRefresh(updateCounter);
1458
1322
  return;
1459
1323
  }
1460
- const data = JSON.parse(pie.dataset.stats);
1461
- let ac = 0;
1462
- const { style } = pie;
1463
- Object.entries(data.percentage).forEach(([key, value]) => style.setProperty(`--${key}`, `${ac += value}%`));
1324
+ updateCounter = MAX;
1325
+ updateTimeToRefresh(updateCounter);
1326
+ fetch(`/api/resort/${id}`).then((res) => res.json()).then((resort2) => render5(node, resort2));
1464
1327
  }
1328
+ function init3() {
1329
+ const ds = node.dataset;
1330
+ updateTimeToRefresh(MAX);
1331
+ renderPlugins(node, (plugin) => {
1332
+ const data = ds[plugin];
1333
+ return data && JSON.parse(data);
1334
+ });
1335
+ }
1336
+ return {
1337
+ init: init3,
1338
+ refresh,
1339
+ node
1340
+ };
1341
+ }
1465
1342
 
1466
- // lib/client/tag/index.js
1467
- function tag(node) {
1468
- let count;
1469
- function update(c) {
1470
- if (!count) {
1471
- return;
1343
+ // lib/client/state/index.js
1344
+ var import_k = __toESM(require_lib(), 1);
1345
+ var k = (0, import_k.default)(window);
1346
+ function state(nodes, st, keys) {
1347
+ const cookieName = `resorts-${st}`;
1348
+ const self = {
1349
+ load,
1350
+ save,
1351
+ update,
1352
+ read
1353
+ };
1354
+ function find(id) {
1355
+ return nodes.find((n) => n.dataset.resort === id);
1356
+ }
1357
+ function read() {
1358
+ const text = api.get(cookieName);
1359
+ return (text == null ? void 0 : text.length) ? text.split(",") : [];
1360
+ }
1361
+ function write(arr) {
1362
+ api.set(cookieName, arr.join(","), {
1363
+ expires: 30,
1364
+ path: "/",
1365
+ secure: window.location.protocol === "https:",
1366
+ sameSite: "strict"
1367
+ });
1368
+ }
1369
+ function update() {
1370
+ const state2 = read().reduce((memo, id) => {
1371
+ memo[id] = true;
1372
+ return memo;
1373
+ }, {});
1374
+ nodes.forEach(({ dataset, classList }) => {
1375
+ const id = dataset.resort;
1376
+ state2[id] = classList.contains(st);
1377
+ });
1378
+ const selected = Object.keys(state2).filter((id) => state2[id]);
1379
+ write(selected);
1380
+ return selected;
1381
+ }
1382
+ function save() {
1383
+ const selected = nodes.filter((n) => n.classList.contains(st)).map((n) => n.dataset.resort);
1384
+ write(selected);
1385
+ return selected;
1386
+ }
1387
+ function load() {
1388
+ const selected = read();
1389
+ selected.forEach((id) => {
1390
+ const node = find(id);
1391
+ if (node) {
1392
+ node.classList.add(st);
1472
1393
  }
1473
- count.innerHTML = c;
1474
- node.classList.toggle("hidden", c <= 0);
1475
- }
1476
- if (node) {
1477
- count = node.querySelector(".count");
1478
- }
1479
- return {
1480
- update
1481
- };
1394
+ });
1395
+ return selected;
1396
+ }
1397
+ function all(on) {
1398
+ nodes.forEach((n) => n.classList.toggle(st, on));
1399
+ update();
1482
1400
  }
1401
+ if (keys) {
1402
+ k(keys.on, all.bind(null, true));
1403
+ k(keys.off, all.bind(null, false));
1404
+ }
1405
+ return self;
1406
+ }
1483
1407
 
1484
- // lib/client/boot/height.js
1485
- var import_debounce = __toESM(require_debounce(), 1);
1486
- function notify() {
1487
- const widget = document.querySelector(".widget");
1488
- if (!widget) {
1489
- return;
1490
- }
1491
- window.parent.postMessage(
1492
- {
1493
- height: widget.scrollHeight,
1494
- resort: window.location.pathname.split("/").pop()
1495
- },
1496
- "*"
1497
- );
1408
+ // lib/client/stats/index.js
1409
+ function stats() {
1410
+ const pie = document.querySelector(".stats .pie");
1411
+ if (!pie) {
1412
+ return;
1498
1413
  }
1499
- function postHeight() {
1500
- if (window === window.parent) {
1414
+ const data = JSON.parse(pie.dataset.stats);
1415
+ let ac = 0;
1416
+ const { style } = pie;
1417
+ Object.entries(data.percentage).forEach(([key, value]) => style.setProperty(`--${key}`, `${ac += value}%`));
1418
+ }
1419
+
1420
+ // lib/client/tag/index.js
1421
+ function tag(node) {
1422
+ let count;
1423
+ function update(c) {
1424
+ if (!count) {
1501
1425
  return;
1502
1426
  }
1503
- notify();
1504
- window.addEventListener("resize", (0, import_debounce.default)(notify, 300), true);
1427
+ count.innerHTML = c;
1428
+ node.classList.toggle("hidden", c <= 0);
1429
+ }
1430
+ if (node) {
1431
+ count = node.querySelector(".count");
1505
1432
  }
1433
+ return {
1434
+ update
1435
+ };
1436
+ }
1506
1437
 
1507
- // lib/client/boot/service-worker.js
1508
- function registrationHandler({ scope, installing, waiting, active }) {
1509
- console.log("SW", scope);
1510
- if (installing) {
1511
- console.log("installing", installing.state);
1438
+ // node_modules/.pnpm/debounce@3.0.0/node_modules/debounce/index.js
1439
+ function debounce(function_, wait = 100, options = {}) {
1440
+ if (typeof function_ !== "function") {
1441
+ throw new TypeError(`Expected the first parameter to be a function, got \`${typeof function_}\`.`);
1442
+ }
1443
+ if (wait < 0) {
1444
+ throw new RangeError("`wait` must not be negative.");
1445
+ }
1446
+ if (typeof options === "boolean") {
1447
+ throw new TypeError("The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.");
1448
+ }
1449
+ const { immediate } = options;
1450
+ let storedContext;
1451
+ let storedArguments;
1452
+ let timeoutId;
1453
+ let timestamp;
1454
+ let result;
1455
+ function run() {
1456
+ const callContext = storedContext;
1457
+ const callArguments = storedArguments;
1458
+ storedContext = void 0;
1459
+ storedArguments = void 0;
1460
+ result = function_.apply(callContext, callArguments);
1461
+ return result;
1462
+ }
1463
+ function later() {
1464
+ const last = Date.now() - timestamp;
1465
+ if (last < wait && last >= 0) {
1466
+ timeoutId = setTimeout(later, wait - last);
1467
+ } else {
1468
+ timeoutId = void 0;
1469
+ if (!immediate) {
1470
+ result = run();
1471
+ }
1472
+ }
1473
+ }
1474
+ const debounced = function(...arguments_) {
1475
+ if (storedContext && this !== storedContext && Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)) {
1476
+ throw new Error("Debounced method called with different contexts of the same prototype.");
1512
1477
  }
1513
- if (waiting) {
1514
- console.log("waiting", waiting.state);
1478
+ storedContext = this;
1479
+ storedArguments = arguments_;
1480
+ timestamp = Date.now();
1481
+ const callNow = immediate && !timeoutId;
1482
+ if (!timeoutId) {
1483
+ timeoutId = setTimeout(later, wait);
1515
1484
  }
1516
- if (active) {
1517
- console.log("active", active.state);
1485
+ if (callNow) {
1486
+ result = run();
1487
+ return result;
1518
1488
  }
1519
- }
1520
- function register(url = "/sw.js") {
1521
- if (navigator.serviceWorker && document.documentElement.hasAttribute("data-service-worker")) {
1522
- return navigator.serviceWorker.register(url).then(registrationHandler).catch((reason) => console.log("SW registration failed!", reason));
1489
+ return void 0;
1490
+ };
1491
+ Object.defineProperty(debounced, "isPending", {
1492
+ get() {
1493
+ return timeoutId !== void 0;
1494
+ }
1495
+ });
1496
+ debounced.clear = () => {
1497
+ if (!timeoutId) {
1498
+ return;
1499
+ }
1500
+ clearTimeout(timeoutId);
1501
+ timeoutId = void 0;
1502
+ storedContext = void 0;
1503
+ storedArguments = void 0;
1504
+ };
1505
+ debounced.flush = () => {
1506
+ if (!timeoutId) {
1507
+ return;
1523
1508
  }
1509
+ debounced.trigger();
1510
+ };
1511
+ debounced.trigger = () => {
1512
+ result = run();
1513
+ debounced.clear();
1514
+ };
1515
+ return debounced;
1516
+ }
1517
+
1518
+ // lib/client/boot/height.js
1519
+ function notify() {
1520
+ const widget = document.querySelector(".widget");
1521
+ if (!widget) {
1522
+ return;
1524
1523
  }
1524
+ window.parent.postMessage(
1525
+ {
1526
+ height: widget.scrollHeight,
1527
+ resort: window.location.pathname.split("/").pop()
1528
+ },
1529
+ "*"
1530
+ );
1531
+ }
1532
+ function postHeight() {
1533
+ if (window === window.parent) {
1534
+ return;
1535
+ }
1536
+ notify();
1537
+ window.addEventListener("resize", debounce(notify, 300), true);
1538
+ }
1525
1539
 
1526
- // lib/client/boot/index.js
1527
- register();
1528
- init2();
1529
- function init2() {
1530
- const rnodes = Array.from(document.querySelectorAll(".resort"));
1531
- const opens = state(rnodes, "open", {
1532
- on: "shift + o",
1533
- off: "shift + x"
1534
- });
1535
- const starred = state(rnodes, "starred");
1536
- const starredTag = tag(document.querySelector(".tags .starred"));
1537
- const resorts = rnodes.map((r) => resort(r));
1538
- resorts.forEach((r) => {
1539
- minimax(r.node, ".minimax").state("open").on((open) => {
1540
- if (open) {
1541
- r.refresh(true);
1542
- }
1543
- opens.update();
1544
- });
1545
- minimax(r.node, ".star").state("starred").on(() => starredTag.update(starred.update().length));
1546
- r.init();
1540
+ // lib/client/boot/service-worker.js
1541
+ function registrationHandler({ scope, installing, waiting, active }) {
1542
+ console.log("SW", scope);
1543
+ if (installing) {
1544
+ console.log("installing", installing.state);
1545
+ }
1546
+ if (waiting) {
1547
+ console.log("waiting", waiting.state);
1548
+ }
1549
+ if (active) {
1550
+ console.log("active", active.state);
1551
+ }
1552
+ }
1553
+ function register(url = "/sw.js") {
1554
+ if (navigator.serviceWorker && document.documentElement.hasAttribute("data-service-worker")) {
1555
+ return navigator.serviceWorker.register(url).then(registrationHandler).catch((reason) => console.log("SW registration failed!", reason));
1556
+ }
1557
+ }
1558
+
1559
+ // lib/client/boot/index.js
1560
+ register();
1561
+ init2();
1562
+ function init2() {
1563
+ const rnodes = Array.from(document.querySelectorAll(".resort"));
1564
+ const opens = state(rnodes, "open", {
1565
+ on: "shift + o",
1566
+ off: "shift + x"
1567
+ });
1568
+ const starred = state(rnodes, "starred");
1569
+ const starredTag = tag(document.querySelector(".tags .starred"));
1570
+ const resorts = rnodes.map((r) => resort(r));
1571
+ resorts.forEach((r) => {
1572
+ minimax(r.node, ".minimax").state("open").on((open) => {
1573
+ if (open) {
1574
+ r.refresh(true);
1575
+ }
1576
+ opens.update();
1547
1577
  });
1548
- window.setInterval(() => resorts.forEach((r) => r.refresh()), 5 * 1e3);
1549
- about();
1550
- opens.update();
1551
- starredTag.update(starred.load().length);
1552
- stats();
1553
- postHeight();
1554
- }
1555
- })();
1578
+ minimax(r.node, ".star").state("starred").on(() => starredTag.update(starred.update().length));
1579
+ r.init();
1580
+ });
1581
+ window.setInterval(() => resorts.forEach((r) => r.refresh()), 5 * 1e3);
1582
+ about();
1583
+ opens.update();
1584
+ starredTag.update(starred.load().length);
1585
+ stats();
1586
+ postHeight();
1587
+ }
1556
1588
  /*! Bundled license information:
1557
1589
 
1558
1590
  js-cookie/dist/js.cookie.mjs: