14 | {{ props.desc }} 15 |
16 |点击有奇效
15 |52 | hometown-h5-template 是一个基于前端前沿技术栈、干净、开箱即用的前端H5解决方案。 53 | 提供完善的前端H5开发环境,快速启动项目,为专注业务实现与开发,提高开发效率而生,也可用于学习参考。 54 |
55 |{{ index + 1 }}. {{ item }}。
73 |
2 |
3 |
轻松,简单,开箱即用 📦
6 |English | 中文
7 | 8 | ## 简介 9 | 10 | [hometown-h5-template](https://github.com/HoMeTownSoCool/hometown-h5-template) 是一个基于前端前沿技术栈、干净、开箱即用的前端H5解决方案。 提供完善的前端H5开发环境,快速启动项目,为专注业务实现与开发,提高开发效率而生,也可用于学习参考。 11 | 12 | ## 预览 13 | [在线预览](https://hh5t.hometownjs.top/about/home) 14 | 15 | ## 技术栈 16 | 17 | - **Vue3** `v3.2.31` 18 | - **TypeScript** `v4.9.5` 19 | - **Vite** `v4.1.1` 20 | - **VantUI** `v4.0.10` 21 | - **Pinia** `v2.0.13` 22 | - **UnoCSS** `v0.49.4` 23 | - **sass** `v1.49.11` 24 | - **HoMeTownJS** `*.**.**` 25 | 26 | ## 特性 27 | 28 | - **最新技术栈:** Vue3、TypeScirpt、Vite4、UnoCSS、Pinia 等前沿技术开发。 29 | - **高效包管理工具:** 使用pnpm作为首选包管理工具。 30 | - **TypeScript:** 应用程序级 JavaScript。 31 | - **灵活的 CSS:** 单一主题配置入口,强大的 CssVar。 32 | - **开箱即用:** 配置丰富,易上手,开箱即用。 33 | - **monorepo架构** 内置monorepo架构,你可以不用,我不能没有。 34 | - **现代移动端自适应方案:** 使用viewport 35 | 36 | ## 开发环境推荐 37 | 38 | - **node** `v14.21.2` 39 | - **npm** `v6.14.17` 40 | - **pnpm** `v7.26.3` 41 | - **vscode** `v1.75.1` 42 | 43 | ## 安装和使用 44 | 45 | ### 克隆代码 46 | 47 | ```bash 48 | git clone https://github.com/HoMeTownSoCool/hometown-h5-template.git 49 | ``` 50 | 51 | ### 安装依赖 52 | 53 | ```bash 54 | pnpm install 55 | ``` 56 | 57 | ### 运行 58 | 59 | ```bash 60 | pnpm dev 61 | ``` 62 | 63 | ### 打包 64 | 65 | ```bash 66 | pnpm build 67 | ``` 68 | 69 | ## 目录 70 | 71 | ```text 72 | ├── LICENSE 73 | ├── README.md 74 | ├── README.zh_CN.md 75 | ├── auto-imports.d.ts # 自动导入文件 76 | ├── build # 打包相关 77 | ├── components.d.ts # 组件自动注册文件 78 | ├── dist # 打包的产物 79 | ├── index.html 80 | ├── node_modules 81 | ├── package.json 82 | ├── pnpm-lock.yaml 83 | ├── public # 静态文件 84 | ├── src 85 | ├── App.vue 86 | ├── assets # 资源 87 | ├── components # 组件 88 | ├── const # 常量 89 | ├── enum # 枚举 90 | ├── hooks # 钩子 91 | ├── main.ts # 入口 92 | ├── plugins # 插件 93 | ├── router # 路由 94 | ├── service # 服务 95 | ├── store # 状态 96 | ├── style # 样式 97 | ├── typings # 类型 98 | ├── utils # 工具 99 | └── views # 页面 100 | ├── stats.html 101 | ├── tsconfig.json # ts配置文件 102 | ├── unocss.config.ts # unocss配置文件 103 | └── vite.config.ts # vite配置文件 104 | ``` 105 | 106 | ## 代码提交 107 | 108 | 项目已经内置 angular 提交规范,直接执行 commit 命令即可。 109 | 110 | 代码提交 111 | 112 | ```bash 113 | git add . 114 | 115 | pnpm commit 116 | 117 | git push origin xx 118 | ``` 119 | 120 | ## 浏览器支持 121 | 122 | 推荐使用`Chrome 90+` 浏览器 123 | 124 | | [
](http://godban.github.io/browsers-support-badges/) | [
](http://godban.github.io/browsers-support-badges/) | [
](http://godban.github.io/browsers-support-badges/) | [
](http://godban.github.io/browsers-support-badges/) | [
](http://godban.github.io/browsers-support-badges/) |
125 | | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
126 | | not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
127 |
128 | ## 许可证
129 | [MIT](./LICENSE)
130 | ## 作者
131 |
132 | [HoMeTown](https://juejin.cn/user/4116184668057390) 🙊
133 |
134 | ## Thanks
135 | [Soybean](https://github.com/honghuangdc)
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
A Vue 3 h5 template.
6 |Be easy. Be simple. Out of the box📦
7 |English | 中文
8 | 9 |
10 |
11 |
](http://godban.github.io/browsers-support-badges/) | [
](http://godban.github.io/browsers-support-badges/) | [
](http://godban.github.io/browsers-support-badges/) | [
](http://godban.github.io/browsers-support-badges/) | [
](http://godban.github.io/browsers-support-badges/) |
128 | | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
129 | | not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
130 |
131 | ## License
132 |
133 | [MIT](./LICENSE)
134 |
135 | ## CHANGELOG
136 |
137 | [CHANGELOG]('./CHANGELOG')
138 |
139 | ## Author
140 |
141 | [HoMeTown](https://juejin.cn/user/4116184668057390) 🙊
142 |
143 | ## Thanks
144 |
145 | [Soybean](https://github.com/honghuangdc)
146 |
--------------------------------------------------------------------------------
/src/assets/js/confetti.browser.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Minified by jsDelivr using Terser v5.10.0.
3 | * Original file: /npm/canvas-confetti@1.5.1/dist/confetti.browser.js
4 | *
5 | * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6 | */
7 | !(function (t, e) {
8 | !(function t(e, n, a, i) {
9 | var o = !!(
10 | e.Worker &&
11 | e.Blob &&
12 | e.Promise &&
13 | e.OffscreenCanvas &&
14 | e.OffscreenCanvasRenderingContext2D &&
15 | e.HTMLCanvasElement &&
16 | e.HTMLCanvasElement.prototype.transferControlToOffscreen &&
17 | e.URL &&
18 | e.URL.createObjectURL
19 | );
20 | function r() {}
21 | function l(t) {
22 | var a = n.exports.Promise,
23 | i = void 0 !== a ? a : e.Promise;
24 | return 'function' == typeof i ? new i(t) : (t(r, r), null);
25 | }
26 | var c,
27 | s,
28 | u,
29 | d,
30 | f,
31 | h,
32 | m,
33 | g,
34 | b,
35 | v =
36 | ((u = Math.floor(1e3 / 60)),
37 | (d = {}),
38 | (f = 0),
39 | 'function' == typeof requestAnimationFrame &&
40 | 'function' == typeof cancelAnimationFrame
41 | ? ((c = function (t) {
42 | var e = Math.random();
43 | return (
44 | (d[e] = requestAnimationFrame(function n(a) {
45 | f === a || f + u - 1 < a
46 | ? ((f = a), delete d[e], t())
47 | : (d[e] = requestAnimationFrame(n));
48 | })),
49 | e
50 | );
51 | }),
52 | (s = function (t) {
53 | d[t] && cancelAnimationFrame(d[t]);
54 | }))
55 | : ((c = function (t) {
56 | return setTimeout(t, u);
57 | }),
58 | (s = function (t) {
59 | return clearTimeout(t);
60 | })),
61 | { frame: c, cancel: s }),
62 | p =
63 | ((g = {}),
64 | function () {
65 | if (h) return h;
66 | if (!a && o) {
67 | var e = [
68 | 'var CONFETTI, SIZE = {}, module = {};',
69 | '(' + t.toString() + ')(this, module, true, SIZE);',
70 | 'onmessage = function(msg) {',
71 | ' if (msg.data.options) {',
72 | ' CONFETTI(msg.data.options).then(function () {',
73 | ' if (msg.data.callback) {',
74 | ' postMessage({ callback: msg.data.callback });',
75 | ' }',
76 | ' });',
77 | ' } else if (msg.data.reset) {',
78 | ' CONFETTI.reset();',
79 | ' } else if (msg.data.resize) {',
80 | ' SIZE.width = msg.data.resize.width;',
81 | ' SIZE.height = msg.data.resize.height;',
82 | ' } else if (msg.data.canvas) {',
83 | ' SIZE.width = msg.data.canvas.width;',
84 | ' SIZE.height = msg.data.canvas.height;',
85 | ' CONFETTI = module.exports.create(msg.data.canvas);',
86 | ' }',
87 | '}',
88 | ].join('\n');
89 | try {
90 | h = new Worker(URL.createObjectURL(new Blob([e])));
91 | } catch (t) {
92 | return (
93 | void 0 !== typeof console &&
94 | 'function' == typeof console.warn &&
95 | console.warn('🎊 Could not load worker', t),
96 | null
97 | );
98 | }
99 | !(function (t) {
100 | function e(e, n) {
101 | t.postMessage({
102 | options: e || {},
103 | callback: n,
104 | });
105 | }
106 | (t.init = function (e) {
107 | var n = e.transferControlToOffscreen();
108 | t.postMessage({ canvas: n }, [n]);
109 | }),
110 | (t.fire = function (n, a, i) {
111 | if (m) return e(n, null), m;
112 | var o = Math.random().toString(36).slice(2);
113 | return (m = l(function (a) {
114 | function r(e) {
115 | e.data.callback === o &&
116 | (delete g[o],
117 | t.removeEventListener(
118 | 'message',
119 | r
120 | ),
121 | (m = null),
122 | i(),
123 | a());
124 | }
125 | t.addEventListener('message', r),
126 | e(n, o),
127 | (g[o] = r.bind(null, {
128 | data: { callback: o },
129 | }));
130 | }));
131 | }),
132 | (t.reset = function () {
133 | for (var e in (t.postMessage({ reset: !0 }),
134 | g))
135 | g[e](), delete g[e];
136 | });
137 | })(h);
138 | }
139 | return h;
140 | }),
141 | y = {
142 | particleCount: 50,
143 | angle: 90,
144 | spread: 45,
145 | startVelocity: 45,
146 | decay: 0.9,
147 | gravity: 1,
148 | drift: 0,
149 | ticks: 200,
150 | x: 0.5,
151 | y: 0.5,
152 | shapes: ['square', 'circle'],
153 | zIndex: 100,
154 | colors: [
155 | '#26ccff',
156 | '#a25afd',
157 | '#ff5e7e',
158 | '#88ff5a',
159 | '#fcff42',
160 | '#ffa62d',
161 | '#ff36ff',
162 | ],
163 | disableForReducedMotion: !1,
164 | scalar: 1,
165 | };
166 | function M(t, e, n) {
167 | return (function (t, e) {
168 | return e ? e(t) : t;
169 | })(t && null != t[e] ? t[e] : y[e], n);
170 | }
171 | function w(t) {
172 | return t < 0 ? 0 : Math.floor(t);
173 | }
174 | function x(t) {
175 | return parseInt(t, 16);
176 | }
177 | function C(t) {
178 | return t.map(k);
179 | }
180 | function k(t) {
181 | var e = String(t).replace(/[^0-9a-f]/gi, '');
182 | return (
183 | e.length < 6 && (e = e[0] + e[0] + e[1] + e[1] + e[2] + e[2]),
184 | {
185 | r: x(e.substring(0, 2)),
186 | g: x(e.substring(2, 4)),
187 | b: x(e.substring(4, 6)),
188 | }
189 | );
190 | }
191 | function I(t) {
192 | (t.width = document.documentElement.clientWidth),
193 | (t.height = document.documentElement.clientHeight);
194 | }
195 | function S(t) {
196 | var e = t.getBoundingClientRect();
197 | (t.width = e.width), (t.height = e.height);
198 | }
199 | function T(t, e, n, o, r) {
200 | var c,
201 | s,
202 | u = e.slice(),
203 | d = t.getContext('2d'),
204 | f = l(function (e) {
205 | function l() {
206 | (c = s = null),
207 | d.clearRect(0, 0, o.width, o.height),
208 | r(),
209 | e();
210 | }
211 | (c = v.frame(function e() {
212 | !a ||
213 | (o.width === i.width && o.height === i.height) ||
214 | ((o.width = t.width = i.width),
215 | (o.height = t.height = i.height)),
216 | o.width ||
217 | o.height ||
218 | (n(t),
219 | (o.width = t.width),
220 | (o.height = t.height)),
221 | d.clearRect(0, 0, o.width, o.height),
222 | (u = u.filter(function (t) {
223 | return (function (t, e) {
224 | (e.x +=
225 | Math.cos(e.angle2D) * e.velocity +
226 | e.drift),
227 | (e.y +=
228 | Math.sin(e.angle2D) * e.velocity +
229 | e.gravity),
230 | (e.wobble += e.wobbleSpeed),
231 | (e.velocity *= e.decay),
232 | (e.tiltAngle += 0.1),
233 | (e.tiltSin = Math.sin(e.tiltAngle)),
234 | (e.tiltCos = Math.cos(e.tiltAngle)),
235 | (e.random = Math.random() + 2),
236 | (e.wobbleX =
237 | e.x +
238 | 10 * e.scalar * Math.cos(e.wobble)),
239 | (e.wobbleY =
240 | e.y +
241 | 10 * e.scalar * Math.sin(e.wobble));
242 | var n = e.tick++ / e.totalTicks,
243 | a = e.x + e.random * e.tiltCos,
244 | i = e.y + e.random * e.tiltSin,
245 | o = e.wobbleX + e.random * e.tiltCos,
246 | r = e.wobbleY + e.random * e.tiltSin;
247 | return (
248 | (t.fillStyle =
249 | 'rgba(' +
250 | e.color.r +
251 | ', ' +
252 | e.color.g +
253 | ', ' +
254 | e.color.b +
255 | ', ' +
256 | (1 - n) +
257 | ')'),
258 | t.beginPath(),
259 | 'circle' === e.shape
260 | ? t.ellipse
261 | ? t.ellipse(
262 | e.x,
263 | e.y,
264 | Math.abs(o - a) *
265 | e.ovalScalar,
266 | Math.abs(r - i) *
267 | e.ovalScalar,
268 | (Math.PI / 10) * e.wobble,
269 | 0,
270 | 2 * Math.PI
271 | )
272 | : (function (
273 | t,
274 | e,
275 | n,
276 | a,
277 | i,
278 | o,
279 | r,
280 | l,
281 | c
282 | ) {
283 | t.save(),
284 | t.translate(e, n),
285 | t.rotate(o),
286 | t.scale(a, i),
287 | t.arc(
288 | 0,
289 | 0,
290 | 1,
291 | r,
292 | l,
293 | c
294 | ),
295 | t.restore();
296 | })(
297 | t,
298 | e.x,
299 | e.y,
300 | Math.abs(o - a) *
301 | e.ovalScalar,
302 | Math.abs(r - i) *
303 | e.ovalScalar,
304 | (Math.PI / 10) * e.wobble,
305 | 0,
306 | 2 * Math.PI
307 | )
308 | : (t.moveTo(
309 | Math.floor(e.x),
310 | Math.floor(e.y)
311 | ),
312 | t.lineTo(
313 | Math.floor(e.wobbleX),
314 | Math.floor(i)
315 | ),
316 | t.lineTo(
317 | Math.floor(o),
318 | Math.floor(r)
319 | ),
320 | t.lineTo(
321 | Math.floor(a),
322 | Math.floor(e.wobbleY)
323 | )),
324 | t.closePath(),
325 | t.fill(),
326 | e.tick < e.totalTicks
327 | );
328 | })(d, t);
329 | })),
330 | u.length ? (c = v.frame(e)) : l();
331 | })),
332 | (s = l);
333 | });
334 | return {
335 | addFettis: function (t) {
336 | return (u = u.concat(t)), f;
337 | },
338 | canvas: t,
339 | promise: f,
340 | reset: function () {
341 | c && v.cancel(c), s && s();
342 | },
343 | };
344 | }
345 | function E(t, n) {
346 | var a,
347 | i = !t,
348 | r = !!M(n || {}, 'resize'),
349 | c = M(n, 'disableForReducedMotion', Boolean),
350 | s = o && !!M(n || {}, 'useWorker') ? p() : null,
351 | u = i ? I : S,
352 | d = !(!t || !s) && !!t.__confetti_initialized,
353 | f =
354 | 'function' == typeof matchMedia &&
355 | matchMedia('(prefers-reduced-motion)').matches;
356 | function h(e, n, i) {
357 | for (
358 | var o,
359 | r,
360 | l,
361 | c,
362 | s,
363 | d = M(e, 'particleCount', w),
364 | f = M(e, 'angle', Number),
365 | h = M(e, 'spread', Number),
366 | m = M(e, 'startVelocity', Number),
367 | g = M(e, 'decay', Number),
368 | b = M(e, 'gravity', Number),
369 | v = M(e, 'drift', Number),
370 | p = M(e, 'colors', C),
371 | y = M(e, 'ticks', Number),
372 | x = M(e, 'shapes'),
373 | k = M(e, 'scalar'),
374 | I = (function (t) {
375 | var e = M(t, 'origin', Object);
376 | return (
377 | (e.x = M(e, 'x', Number)),
378 | (e.y = M(e, 'y', Number)),
379 | e
380 | );
381 | })(e),
382 | S = d,
383 | E = [],
384 | F = t.width * I.x,
385 | N = t.height * I.y;
386 | S--;
387 |
388 | )
389 | E.push(
390 | ((o = {
391 | x: F,
392 | y: N,
393 | angle: f,
394 | spread: h,
395 | startVelocity: m,
396 | color: p[S % p.length],
397 | shape: x[
398 | ((c = 0),
399 | (s = x.length),
400 | Math.floor(Math.random() * (s - c)) + c)
401 | ],
402 | ticks: y,
403 | decay: g,
404 | gravity: b,
405 | drift: v,
406 | scalar: k,
407 | }),
408 | (r = void 0),
409 | (l = void 0),
410 | (r = o.angle * (Math.PI / 180)),
411 | (l = o.spread * (Math.PI / 180)),
412 | {
413 | x: o.x,
414 | y: o.y,
415 | wobble: 10 * Math.random(),
416 | wobbleSpeed: Math.min(
417 | 0.11,
418 | 0.1 * Math.random() + 0.05
419 | ),
420 | velocity:
421 | 0.5 * o.startVelocity +
422 | Math.random() * o.startVelocity,
423 | angle2D: -r + (0.5 * l - Math.random() * l),
424 | tiltAngle: (0.5 * Math.random() + 0.25) * Math.PI,
425 | color: o.color,
426 | shape: o.shape,
427 | tick: 0,
428 | totalTicks: o.ticks,
429 | decay: o.decay,
430 | drift: o.drift,
431 | random: Math.random() + 2,
432 | tiltSin: 0,
433 | tiltCos: 0,
434 | wobbleX: 0,
435 | wobbleY: 0,
436 | gravity: 3 * o.gravity,
437 | ovalScalar: 0.6,
438 | scalar: o.scalar,
439 | })
440 | );
441 | return a ? a.addFettis(E) : (a = T(t, E, u, n, i)).promise;
442 | }
443 | function m(n) {
444 | var o = c || M(n, 'disableForReducedMotion', Boolean),
445 | m = M(n, 'zIndex', Number);
446 | if (o && f)
447 | return l(function (t) {
448 | t();
449 | });
450 | i && a
451 | ? (t = a.canvas)
452 | : i &&
453 | !t &&
454 | ((t = (function (t) {
455 | var e = document.createElement('canvas');
456 | return (
457 | (e.style.position = 'fixed'),
458 | (e.style.top = '0px'),
459 | (e.style.left = '0px'),
460 | (e.style.pointerEvents = 'none'),
461 | (e.style.zIndex = t),
462 | e
463 | );
464 | })(m)),
465 | document.body.appendChild(t)),
466 | r && !d && u(t);
467 | var g = { width: t.width, height: t.height };
468 | function b() {
469 | if (s) {
470 | var e = {
471 | getBoundingClientRect: function () {
472 | if (!i) return t.getBoundingClientRect();
473 | },
474 | };
475 | return (
476 | u(e),
477 | void s.postMessage({
478 | resize: { width: e.width, height: e.height },
479 | })
480 | );
481 | }
482 | g.width = g.height = null;
483 | }
484 | function v() {
485 | (a = null),
486 | r && e.removeEventListener('resize', b),
487 | i &&
488 | t &&
489 | (document.body.removeChild(t),
490 | (t = null),
491 | (d = !1));
492 | }
493 | return (
494 | s && !d && s.init(t),
495 | (d = !0),
496 | s && (t.__confetti_initialized = !0),
497 | r && e.addEventListener('resize', b, !1),
498 | s ? s.fire(n, g, v) : h(n, g, v)
499 | );
500 | }
501 | return (
502 | (m.reset = function () {
503 | s && s.reset(), a && a.reset();
504 | }),
505 | m
506 | );
507 | }
508 | function F() {
509 | return b || (b = E(null, { useWorker: !0, resize: !0 })), b;
510 | }
511 | (n.exports = function () {
512 | return F().apply(this, arguments);
513 | }),
514 | (n.exports.reset = function () {
515 | F().reset();
516 | }),
517 | (n.exports.create = E);
518 | })(
519 | (function () {
520 | return void 0 !== t
521 | ? t
522 | : 'undefined' != typeof self
523 | ? self
524 | : this || {};
525 | })(),
526 | e,
527 | !1
528 | ),
529 | (t.confetti = e.exports);
530 | })(window, {});
531 | //# sourceMappingURL=/sm/ab60d7fb9bf5b5ded42c77782b65b071de85f56c21da42948364d6b2b1961762.map
532 |
--------------------------------------------------------------------------------
/packages/cofetti/assets/confetti.browser.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Minified by jsDelivr using Terser v5.10.0.
3 | * Original file: /npm/canvas-confetti@1.5.1/dist/confetti.browser.js
4 | *
5 | * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6 | */
7 | !(function (t, e) {
8 | !(function t(e, n, a, i) {
9 | var o = !!(
10 | e.Worker &&
11 | e.Blob &&
12 | e.Promise &&
13 | e.OffscreenCanvas &&
14 | e.OffscreenCanvasRenderingContext2D &&
15 | e.HTMLCanvasElement &&
16 | e.HTMLCanvasElement.prototype.transferControlToOffscreen &&
17 | e.URL &&
18 | e.URL.createObjectURL
19 | );
20 | function r() {}
21 | function l(t) {
22 | var a = n.exports.Promise,
23 | i = void 0 !== a ? a : e.Promise;
24 | return 'function' == typeof i ? new i(t) : (t(r, r), null);
25 | }
26 | var c,
27 | s,
28 | u,
29 | d,
30 | f,
31 | h,
32 | m,
33 | g,
34 | b,
35 | v =
36 | ((u = Math.floor(1e3 / 60)),
37 | (d = {}),
38 | (f = 0),
39 | 'function' == typeof requestAnimationFrame &&
40 | 'function' == typeof cancelAnimationFrame
41 | ? ((c = function (t) {
42 | var e = Math.random();
43 | return (
44 | (d[e] = requestAnimationFrame(function n(a) {
45 | f === a || f + u - 1 < a
46 | ? ((f = a), delete d[e], t())
47 | : (d[e] = requestAnimationFrame(n));
48 | })),
49 | e
50 | );
51 | }),
52 | (s = function (t) {
53 | d[t] && cancelAnimationFrame(d[t]);
54 | }))
55 | : ((c = function (t) {
56 | return setTimeout(t, u);
57 | }),
58 | (s = function (t) {
59 | return clearTimeout(t);
60 | })),
61 | { frame: c, cancel: s }),
62 | p =
63 | ((g = {}),
64 | function () {
65 | if (h) return h;
66 | if (!a && o) {
67 | var e = [
68 | 'var CONFETTI, SIZE = {}, module = {};',
69 | '(' + t.toString() + ')(this, module, true, SIZE);',
70 | 'onmessage = function(msg) {',
71 | ' if (msg.data.options) {',
72 | ' CONFETTI(msg.data.options).then(function () {',
73 | ' if (msg.data.callback) {',
74 | ' postMessage({ callback: msg.data.callback });',
75 | ' }',
76 | ' });',
77 | ' } else if (msg.data.reset) {',
78 | ' CONFETTI.reset();',
79 | ' } else if (msg.data.resize) {',
80 | ' SIZE.width = msg.data.resize.width;',
81 | ' SIZE.height = msg.data.resize.height;',
82 | ' } else if (msg.data.canvas) {',
83 | ' SIZE.width = msg.data.canvas.width;',
84 | ' SIZE.height = msg.data.canvas.height;',
85 | ' CONFETTI = module.exports.create(msg.data.canvas);',
86 | ' }',
87 | '}',
88 | ].join('\n');
89 | try {
90 | h = new Worker(URL.createObjectURL(new Blob([e])));
91 | } catch (t) {
92 | return (
93 | void 0 !== typeof console &&
94 | 'function' == typeof console.warn &&
95 | console.warn('🎊 Could not load worker', t),
96 | null
97 | );
98 | }
99 | !(function (t) {
100 | function e(e, n) {
101 | t.postMessage({
102 | options: e || {},
103 | callback: n,
104 | });
105 | }
106 | (t.init = function (e) {
107 | var n = e.transferControlToOffscreen();
108 | t.postMessage({ canvas: n }, [n]);
109 | }),
110 | (t.fire = function (n, a, i) {
111 | if (m) return e(n, null), m;
112 | var o = Math.random().toString(36).slice(2);
113 | return (m = l(function (a) {
114 | function r(e) {
115 | e.data.callback === o &&
116 | (delete g[o],
117 | t.removeEventListener(
118 | 'message',
119 | r
120 | ),
121 | (m = null),
122 | i(),
123 | a());
124 | }
125 | t.addEventListener('message', r),
126 | e(n, o),
127 | (g[o] = r.bind(null, {
128 | data: { callback: o },
129 | }));
130 | }));
131 | }),
132 | (t.reset = function () {
133 | for (var e in (t.postMessage({ reset: !0 }),
134 | g))
135 | g[e](), delete g[e];
136 | });
137 | })(h);
138 | }
139 | return h;
140 | }),
141 | y = {
142 | particleCount: 50,
143 | angle: 90,
144 | spread: 45,
145 | startVelocity: 45,
146 | decay: 0.9,
147 | gravity: 1,
148 | drift: 0,
149 | ticks: 200,
150 | x: 0.5,
151 | y: 0.5,
152 | shapes: ['square', 'circle'],
153 | zIndex: 100,
154 | colors: [
155 | '#26ccff',
156 | '#a25afd',
157 | '#ff5e7e',
158 | '#88ff5a',
159 | '#fcff42',
160 | '#ffa62d',
161 | '#ff36ff',
162 | ],
163 | disableForReducedMotion: !1,
164 | scalar: 1,
165 | };
166 | function M(t, e, n) {
167 | return (function (t, e) {
168 | return e ? e(t) : t;
169 | })(t && null != t[e] ? t[e] : y[e], n);
170 | }
171 | function w(t) {
172 | return t < 0 ? 0 : Math.floor(t);
173 | }
174 | function x(t) {
175 | return parseInt(t, 16);
176 | }
177 | function C(t) {
178 | return t.map(k);
179 | }
180 | function k(t) {
181 | var e = String(t).replace(/[^0-9a-f]/gi, '');
182 | return (
183 | e.length < 6 && (e = e[0] + e[0] + e[1] + e[1] + e[2] + e[2]),
184 | {
185 | r: x(e.substring(0, 2)),
186 | g: x(e.substring(2, 4)),
187 | b: x(e.substring(4, 6)),
188 | }
189 | );
190 | }
191 | function I(t) {
192 | (t.width = document.documentElement.clientWidth),
193 | (t.height = document.documentElement.clientHeight);
194 | }
195 | function S(t) {
196 | var e = t.getBoundingClientRect();
197 | (t.width = e.width), (t.height = e.height);
198 | }
199 | function T(t, e, n, o, r) {
200 | var c,
201 | s,
202 | u = e.slice(),
203 | d = t.getContext('2d'),
204 | f = l(function (e) {
205 | function l() {
206 | (c = s = null),
207 | d.clearRect(0, 0, o.width, o.height),
208 | r(),
209 | e();
210 | }
211 | (c = v.frame(function e() {
212 | !a ||
213 | (o.width === i.width && o.height === i.height) ||
214 | ((o.width = t.width = i.width),
215 | (o.height = t.height = i.height)),
216 | o.width ||
217 | o.height ||
218 | (n(t),
219 | (o.width = t.width),
220 | (o.height = t.height)),
221 | d.clearRect(0, 0, o.width, o.height),
222 | (u = u.filter(function (t) {
223 | return (function (t, e) {
224 | (e.x +=
225 | Math.cos(e.angle2D) * e.velocity +
226 | e.drift),
227 | (e.y +=
228 | Math.sin(e.angle2D) * e.velocity +
229 | e.gravity),
230 | (e.wobble += e.wobbleSpeed),
231 | (e.velocity *= e.decay),
232 | (e.tiltAngle += 0.1),
233 | (e.tiltSin = Math.sin(e.tiltAngle)),
234 | (e.tiltCos = Math.cos(e.tiltAngle)),
235 | (e.random = Math.random() + 2),
236 | (e.wobbleX =
237 | e.x +
238 | 10 * e.scalar * Math.cos(e.wobble)),
239 | (e.wobbleY =
240 | e.y +
241 | 10 * e.scalar * Math.sin(e.wobble));
242 | var n = e.tick++ / e.totalTicks,
243 | a = e.x + e.random * e.tiltCos,
244 | i = e.y + e.random * e.tiltSin,
245 | o = e.wobbleX + e.random * e.tiltCos,
246 | r = e.wobbleY + e.random * e.tiltSin;
247 | return (
248 | (t.fillStyle =
249 | 'rgba(' +
250 | e.color.r +
251 | ', ' +
252 | e.color.g +
253 | ', ' +
254 | e.color.b +
255 | ', ' +
256 | (1 - n) +
257 | ')'),
258 | t.beginPath(),
259 | 'circle' === e.shape
260 | ? t.ellipse
261 | ? t.ellipse(
262 | e.x,
263 | e.y,
264 | Math.abs(o - a) *
265 | e.ovalScalar,
266 | Math.abs(r - i) *
267 | e.ovalScalar,
268 | (Math.PI / 10) * e.wobble,
269 | 0,
270 | 2 * Math.PI
271 | )
272 | : (function (
273 | t,
274 | e,
275 | n,
276 | a,
277 | i,
278 | o,
279 | r,
280 | l,
281 | c
282 | ) {
283 | t.save(),
284 | t.translate(e, n),
285 | t.rotate(o),
286 | t.scale(a, i),
287 | t.arc(
288 | 0,
289 | 0,
290 | 1,
291 | r,
292 | l,
293 | c
294 | ),
295 | t.restore();
296 | })(
297 | t,
298 | e.x,
299 | e.y,
300 | Math.abs(o - a) *
301 | e.ovalScalar,
302 | Math.abs(r - i) *
303 | e.ovalScalar,
304 | (Math.PI / 10) * e.wobble,
305 | 0,
306 | 2 * Math.PI
307 | )
308 | : (t.moveTo(
309 | Math.floor(e.x),
310 | Math.floor(e.y)
311 | ),
312 | t.lineTo(
313 | Math.floor(e.wobbleX),
314 | Math.floor(i)
315 | ),
316 | t.lineTo(
317 | Math.floor(o),
318 | Math.floor(r)
319 | ),
320 | t.lineTo(
321 | Math.floor(a),
322 | Math.floor(e.wobbleY)
323 | )),
324 | t.closePath(),
325 | t.fill(),
326 | e.tick < e.totalTicks
327 | );
328 | })(d, t);
329 | })),
330 | u.length ? (c = v.frame(e)) : l();
331 | })),
332 | (s = l);
333 | });
334 | return {
335 | addFettis: function (t) {
336 | return (u = u.concat(t)), f;
337 | },
338 | canvas: t,
339 | promise: f,
340 | reset: function () {
341 | c && v.cancel(c), s && s();
342 | },
343 | };
344 | }
345 | function E(t, n) {
346 | var a,
347 | i = !t,
348 | r = !!M(n || {}, 'resize'),
349 | c = M(n, 'disableForReducedMotion', Boolean),
350 | s = o && !!M(n || {}, 'useWorker') ? p() : null,
351 | u = i ? I : S,
352 | d = !(!t || !s) && !!t.__confetti_initialized,
353 | f =
354 | 'function' == typeof matchMedia &&
355 | matchMedia('(prefers-reduced-motion)').matches;
356 | function h(e, n, i) {
357 | for (
358 | var o,
359 | r,
360 | l,
361 | c,
362 | s,
363 | d = M(e, 'particleCount', w),
364 | f = M(e, 'angle', Number),
365 | h = M(e, 'spread', Number),
366 | m = M(e, 'startVelocity', Number),
367 | g = M(e, 'decay', Number),
368 | b = M(e, 'gravity', Number),
369 | v = M(e, 'drift', Number),
370 | p = M(e, 'colors', C),
371 | y = M(e, 'ticks', Number),
372 | x = M(e, 'shapes'),
373 | k = M(e, 'scalar'),
374 | I = (function (t) {
375 | var e = M(t, 'origin', Object);
376 | return (
377 | (e.x = M(e, 'x', Number)),
378 | (e.y = M(e, 'y', Number)),
379 | e
380 | );
381 | })(e),
382 | S = d,
383 | E = [],
384 | F = t.width * I.x,
385 | N = t.height * I.y;
386 | S--;
387 |
388 | )
389 | E.push(
390 | ((o = {
391 | x: F,
392 | y: N,
393 | angle: f,
394 | spread: h,
395 | startVelocity: m,
396 | color: p[S % p.length],
397 | shape: x[
398 | ((c = 0),
399 | (s = x.length),
400 | Math.floor(Math.random() * (s - c)) + c)
401 | ],
402 | ticks: y,
403 | decay: g,
404 | gravity: b,
405 | drift: v,
406 | scalar: k,
407 | }),
408 | (r = void 0),
409 | (l = void 0),
410 | (r = o.angle * (Math.PI / 180)),
411 | (l = o.spread * (Math.PI / 180)),
412 | {
413 | x: o.x,
414 | y: o.y,
415 | wobble: 10 * Math.random(),
416 | wobbleSpeed: Math.min(
417 | 0.11,
418 | 0.1 * Math.random() + 0.05
419 | ),
420 | velocity:
421 | 0.5 * o.startVelocity +
422 | Math.random() * o.startVelocity,
423 | angle2D: -r + (0.5 * l - Math.random() * l),
424 | tiltAngle: (0.5 * Math.random() + 0.25) * Math.PI,
425 | color: o.color,
426 | shape: o.shape,
427 | tick: 0,
428 | totalTicks: o.ticks,
429 | decay: o.decay,
430 | drift: o.drift,
431 | random: Math.random() + 2,
432 | tiltSin: 0,
433 | tiltCos: 0,
434 | wobbleX: 0,
435 | wobbleY: 0,
436 | gravity: 3 * o.gravity,
437 | ovalScalar: 0.6,
438 | scalar: o.scalar,
439 | })
440 | );
441 | return a ? a.addFettis(E) : (a = T(t, E, u, n, i)).promise;
442 | }
443 | function m(n) {
444 | var o = c || M(n, 'disableForReducedMotion', Boolean),
445 | m = M(n, 'zIndex', Number);
446 | if (o && f)
447 | return l(function (t) {
448 | t();
449 | });
450 | i && a
451 | ? (t = a.canvas)
452 | : i &&
453 | !t &&
454 | ((t = (function (t) {
455 | var e = document.createElement('canvas');
456 | return (
457 | (e.style.position = 'fixed'),
458 | (e.style.top = '0px'),
459 | (e.style.left = '0px'),
460 | (e.style.pointerEvents = 'none'),
461 | (e.style.zIndex = t),
462 | e
463 | );
464 | })(m)),
465 | document.body.appendChild(t)),
466 | r && !d && u(t);
467 | var g = { width: t.width, height: t.height };
468 | function b() {
469 | if (s) {
470 | var e = {
471 | getBoundingClientRect: function () {
472 | if (!i) return t.getBoundingClientRect();
473 | },
474 | };
475 | return (
476 | u(e),
477 | void s.postMessage({
478 | resize: { width: e.width, height: e.height },
479 | })
480 | );
481 | }
482 | g.width = g.height = null;
483 | }
484 | function v() {
485 | (a = null),
486 | r && e.removeEventListener('resize', b),
487 | i &&
488 | t &&
489 | (document.body.removeChild(t),
490 | (t = null),
491 | (d = !1));
492 | }
493 | return (
494 | s && !d && s.init(t),
495 | (d = !0),
496 | s && (t.__confetti_initialized = !0),
497 | r && e.addEventListener('resize', b, !1),
498 | s ? s.fire(n, g, v) : h(n, g, v)
499 | );
500 | }
501 | return (
502 | (m.reset = function () {
503 | s && s.reset(), a && a.reset();
504 | }),
505 | m
506 | );
507 | }
508 | function F() {
509 | return b || (b = E(null, { useWorker: !0, resize: !0 })), b;
510 | }
511 | (n.exports = function () {
512 | return F().apply(this, arguments);
513 | }),
514 | (n.exports.reset = function () {
515 | F().reset();
516 | }),
517 | (n.exports.create = E);
518 | })(
519 | (function () {
520 | return void 0 !== t
521 | ? t
522 | : 'undefined' != typeof self
523 | ? self
524 | : this || {};
525 | })(),
526 | e,
527 | !1
528 | ),
529 | (t.confetti = e.exports);
530 | })(window, {});
531 | //# sourceMappingURL=/sm/ab60d7fb9bf5b5ded42c77782b65b071de85f56c21da42948364d6b2b1961762.map
532 |
--------------------------------------------------------------------------------