// ==UserScript== // @name Bili-LiveDT // @namespace flowingink/bili-livedt // @version 0.0.1 // @description 为 Bilibili 直播间打造的弹幕辅助用户脚本,集弹幕收藏、可控连发与快捷 +1 于一体。 // @icon data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2216%22%20fill%3D%22%23ff6b9d%22%2F%3E%3Cpath%20d%3D%22M17%2023h30v24H17z%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-width%3D%224%22%2F%3E%3Cpath%20d%3D%22m24%2017%208%206%208-6%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%224%22%2F%3E%3Ccircle%20cx%3D%2226%22%20cy%3D%2234%22%20r%3D%222.5%22%20fill%3D%22%23fff%22%2F%3E%3Ccircle%20cx%3D%2238%22%20cy%3D%2234%22%20r%3D%222.5%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E // @match https://live.bilibili.com/* // @require https://unpkg.com/vue@3.5.40/dist/vue.global.prod.js // @require data:text/javascript;charset=utf-8,%3Bwindow.Vue%3DVue%3Bwindow.VueDemi%3DVue%3B // @require https://unpkg.com/element-plus@2.14.3/dist/index.full.min.js // @require https://unpkg.com/@element-plus/icons-vue@2.3.2/dist/index.iife.min.js // @require https://unpkg.com/pinia@3.0.4/dist/pinia.iife.prod.js // @require https://unpkg.com/mitt@3.0.1/dist/mitt.umd.js // @require https://unpkg.com/crypto-js@4.2.0/crypto-js.js // @resource element-plus/dist/index.css https://unpkg.com/element-plus@2.14.3/dist/index.css // @grant GM_addStyle // @grant GM_addValueChangeListener // @grant GM_deleteValue // @grant GM_deleteValues // @grant GM_getResourceText // @grant GM_getValue // @grant GM_getValues // @grant GM_listValues // @grant GM_removeValueChangeListener // @grant GM_setValue // @grant GM_setValues // @grant unsafeWindow // @noframes // @license MIT // ==/UserScript== (function (ElementPlusIconsVue, ElementPlus, vue, pinia$1, mitt, cryptoJs) { 'use strict'; function _interopNamespaceDefault(e) { const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } }); if (e) { for (const k in e) { if (k !== 'default') { const d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: () => e[k] }); } } } n.default = e; return Object.freeze(n); } const ElementPlusIconsVue__namespace = _interopNamespaceDefault(ElementPlusIconsVue); const d$1=new Set;const e$1 = async e=>{d$1.has(e)||(d$1.add(e),(t=>{typeof GM_addStyle=="function"?GM_addStyle(t):(document.head||document.documentElement).appendChild(document.createElement("style")).append(t);})(e));}; e$1(' .danmaku-actions-popper{color-scheme:dark;--capsule-surface: rgba(42, 42, 48, .88);--capsule-text: #f3f4f7;--capsule-muted: #a7adba;--capsule-border: rgba(255, 190, 215, .22);--capsule-shadow: rgba(0, 0, 0, .38);--capsule-accent: #ff78a8;--capsule-accent-soft: rgba(255, 120, 168, .18);z-index:2147483647!important;min-width:88px!important;height:30px;padding:0!important;overflow:visible;border:1px solid var(--capsule-border)!important;border-radius:999px!important;background:var(--capsule-surface)!important;box-shadow:0 8px 24px var(--capsule-shadow);line-height:normal}.danmaku-actions-popper>.el-popper__arrow:before{border:1px solid var(--capsule-border)!important;background:var(--capsule-surface)!important}.danmaku-actions[data-v-fdd417c4]{width:100%;height:30px;display:grid;grid-template-columns:1fr 1fr;align-items:center;overflow:hidden;border-radius:999px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;pointer-events:auto}.danmaku-actions[data-v-fdd417c4],.danmaku-actions[data-v-fdd417c4] *{box-sizing:border-box}.action-segment[data-v-fdd417c4]{width:100%;height:100%;padding:0 2px;margin:0;display:flex;align-items:center;justify-content:center;border:0;border-radius:0;appearance:none;background:transparent;color:var(--capsule-text);font-size:11px;font-weight:740;line-height:1;white-space:nowrap;cursor:pointer;transition:background-color .14s ease,color .14s ease,opacity .14s ease}.action-segment+.action-segment[data-v-fdd417c4]{border-left:1px solid var(--capsule-border)}.action-segment[data-v-fdd417c4]:hover:not(:disabled){background:var(--capsule-accent-soft);color:var(--capsule-accent)}.action-segment[data-v-fdd417c4]:disabled{cursor:default;color:var(--capsule-muted);opacity:.7}.danmaku-plus-one-button[data-v-08354053]{cursor:pointer;padding:10px;width:100%}.danmaku-plus-one-button[data-v-08354053]:hover{background:var(--float-bg-2-float, #f6f7f8)!important}.danmaku-plus-one-content[data-v-08354053]{display:block;color:#61666d!important;text-decoration:none}.danmaku-plus-one-content[data-v-08354053]:hover{color:var(--norm-brand-pink, #f69)!important}:root{--swiper-theme-color: #007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translateZ(0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-slides-offset-before);scroll-margin-inline-start:var(--swiper-slides-offset-before)}.swiper-css-mode.swiper-horizontal>.swiper-wrapper>.swiper-slide:last-child{margin-inline-end:var(--swiper-slides-offset-after)}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-slides-offset-before);scroll-margin-block-start:var(--swiper-slides-offset-before)}.swiper-css-mode.swiper-vertical>.swiper-wrapper>.swiper-slide:last-child{margin-block-end:var(--swiper-slides-offset-after)}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper:before{content:"";flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper:before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper:before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:#00000026}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom,#00000080,#0000)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}:is(.swiper:not(.swiper-watch-progress),.swiper-watch-progress .swiper-slide-visible) .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color: #fff}.swiper-lazy-preloader-black{--swiper-preloader-color: #000}@keyframes swiper-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.swiper-pagination{position:absolute;text-align:center;transition:.3s opacity;transform:translateZ(0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-pagination-disabled>.swiper-pagination,.swiper-pagination.swiper-pagination-disabled{display:none!important}.swiper-pagination-fraction,.swiper-pagination-custom,.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-bullets.swiper-pagination-horizontal{bottom:var(--swiper-pagination-bottom, 8px);top:var(--swiper-pagination-top, auto);left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transform:scale(.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active,.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{transform:scale(.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{transform:scale(.33)}.swiper-pagination-bullet{width:var(--swiper-pagination-bullet-width, var(--swiper-pagination-bullet-size, 8px));height:var(--swiper-pagination-bullet-height, var(--swiper-pagination-bullet-size, 8px));display:inline-block;border-radius:var(--swiper-pagination-bullet-border-radius, 50%);background:var(--swiper-pagination-bullet-inactive-color, #000);opacity:var(--swiper-pagination-bullet-inactive-opacity, .2)}button.swiper-pagination-bullet{border:none;margin:0;padding:0;box-shadow:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet:only-child{display:none!important}.swiper-pagination-bullet-active{opacity:var(--swiper-pagination-bullet-opacity, 1);background:var(--swiper-pagination-color, var(--swiper-theme-color))}.swiper-vertical>.swiper-pagination-bullets,.swiper-pagination-vertical.swiper-pagination-bullets{right:var(--swiper-pagination-right, 8px);left:var(--swiper-pagination-left, auto);top:50%;transform:translate3d(0,-50%,0)}:is(.swiper-vertical>.swiper-pagination-bullets,.swiper-pagination-vertical.swiper-pagination-bullets) .swiper-pagination-bullet{margin:var(--swiper-pagination-bullet-vertical-gap, 6px) 0;display:block}:is(.swiper-vertical>.swiper-pagination-bullets,.swiper-pagination-vertical.swiper-pagination-bullets).swiper-pagination-bullets-dynamic{top:50%;transform:translateY(-50%);width:8px}:is(.swiper-vertical>.swiper-pagination-bullets,.swiper-pagination-vertical.swiper-pagination-bullets).swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;transition:.2s transform,.2s top}:is(.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-horizontal.swiper-pagination-bullets) .swiper-pagination-bullet{margin:0 var(--swiper-pagination-bullet-horizontal-gap, 4px)}:is(.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-horizontal.swiper-pagination-bullets).swiper-pagination-bullets-dynamic{left:50%;transform:translate(-50%);white-space:nowrap}:is(.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-horizontal.swiper-pagination-bullets).swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:.2s transform,.2s left}.swiper-horizontal.swiper-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:.2s transform,.2s right}.swiper-pagination-fraction{color:var(--swiper-pagination-fraction-color, inherit)}.swiper-pagination-progressbar{background:var(--swiper-pagination-progressbar-bg-color, rgba(0, 0, 0, .25));position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:var(--swiper-pagination-color, var(--swiper-theme-color));position:absolute;left:0;top:0;width:100%;height:100%;transform:scale(0);transform-origin:left top}.swiper-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{transform-origin:right top}.swiper-horizontal>.swiper-pagination-progressbar,.swiper-pagination-progressbar.swiper-pagination-horizontal,.swiper-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-vertical.swiper-pagination-progressbar-opposite{width:100%;height:var(--swiper-pagination-progressbar-size, 4px);left:0;top:0}.swiper-vertical>.swiper-pagination-progressbar,.swiper-pagination-progressbar.swiper-pagination-vertical,.swiper-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-horizontal.swiper-pagination-progressbar-opposite{width:var(--swiper-pagination-progressbar-size, 4px);height:100%;left:0;top:0}.swiper-pagination-lock{display:none}.emoji-trigger[data-v-c6f56ffa]{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;margin:0 -7px 0 3px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--prompt-muted);font:700 18px/1 -apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;cursor:pointer}.emoji-trigger[data-v-c6f56ffa]:hover,.emoji-trigger[data-v-c6f56ffa]:focus-visible{background:var(--prompt-accent-soft);color:var(--prompt-accent-strong)}.emoji-trigger[data-v-c6f56ffa]:focus-visible{outline:2px solid var(--prompt-accent);outline-offset:1px}.emoji-picker[data-v-c6f56ffa]{min-height:210px}.emoji-feedback[data-v-c6f56ffa]{min-height:210px;display:flex;align-items:center;justify-content:center;color:#8b7481;font-size:13px}.emoji-grid[data-v-c6f56ffa]{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px;padding:6px}.emoji-item[data-v-c6f56ffa]{width:42px;height:42px;display:flex;align-items:center;justify-content:center;padding:5px;border:0;border-radius:9px;background:transparent;cursor:pointer;transition:background-color .14s ease,transform .14s ease}.emoji-item[data-v-c6f56ffa]:hover,.emoji-item[data-v-c6f56ffa]:focus-visible{background:#ff6b9d24;transform:translateY(-1px)}.emoji-item[data-v-c6f56ffa]:focus-visible{outline:2px solid #ff6b9d;outline-offset:1px}.emoji-item .el-image{width:100%;height:100%}.danmaku-emoji-popover.el-popover.el-popper{box-sizing:border-box;padding:8px;border-color:#e8d8e2f2;border-radius:14px;background:#fffffffc;box-shadow:0 12px 34px #582a4133}@media(prefers-color-scheme:dark){.danmaku-emoji-popover.el-popover.el-popper{border-color:#ffbed733;background:#1f2025fc}.emoji-feedback[data-v-c6f56ffa]{color:#a7adba}}.add-danmaku-prompt[data-v-2ff4aeef]{width:100%}.prompt-description[data-v-2ff4aeef]{margin:0 0 14px;color:var(--prompt-muted);font-size:13px;font-weight:560;line-height:1.55}.danmaku-input .el-input__wrapper{min-height:42px;padding:0 14px;border-radius:999px;background:var(--prompt-surface-soft);box-shadow:0 0 0 1px var(--prompt-border) inset;transition:box-shadow .14s ease,background-color .14s ease}.danmaku-input .el-input__wrapper.is-focus{background:var(--prompt-surface-solid);box-shadow:0 0 0 1px var(--prompt-accent) inset,0 0 0 3px var(--prompt-accent-soft)}.danmaku-input .el-input__inner{font-size:14px;font-weight:650}.prompt-error[data-v-2ff4aeef]{min-height:20px;padding:4px 8px 0;color:var(--prompt-accent-strong);font-size:12px;font-weight:650;visibility:hidden}.prompt-error.visible[data-v-2ff4aeef]{visibility:visible}.manager-item[data-v-6e8c9874]{flex:0 0 auto;min-width:0;padding:11px 12px 8px;border:1px solid var(--border);border-radius:12px;background:var(--surface-solid);transition:border-color .14s ease,box-shadow .14s ease}.manager-item[data-v-6e8c9874]:hover{border-color:color-mix(in srgb,var(--accent) 38%,var(--border));box-shadow:0 5px 16px color-mix(in srgb,var(--shadow) 55%,transparent)}.manager-item-content[data-v-6e8c9874]{display:-webkit-box;overflow:hidden;color:var(--text);font-size:13px;font-weight:650;line-height:1.5;-webkit-box-orient:vertical;-webkit-line-clamp:2}.manager-item-footer[data-v-6e8c9874]{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:8px}.manager-item-meta[data-v-6e8c9874]{display:inline-flex;align-items:center;min-height:20px;padding:2px 7px;border-radius:999px;background:var(--surface-soft);color:var(--muted);font-size:11px;font-weight:620}.manager-item-actions[data-v-6e8c9874]{display:flex;align-items:center;gap:4px}.manager-copy-button.el-button[data-v-6e8c9874],.manager-delete-button.el-button[data-v-6e8c9874]{height:26px;margin:0;padding:0 7px;border-radius:999px;font-size:11px;font-weight:650}.manager-copy-button.el-button[data-v-6e8c9874]{color:var(--accent-strong)}.manager-delete-button.el-button[data-v-6e8c9874]{color:var(--muted)}.manager-copy-button.el-button[data-v-6e8c9874]:hover,.manager-copy-button.el-button[data-v-6e8c9874]:focus-visible,.manager-delete-button.el-button[data-v-6e8c9874]:hover,.manager-delete-button.el-button[data-v-6e8c9874]:focus-visible{background:var(--accent-soft);color:var(--accent-strong)}.danmaku-manager-overlay[data-v-e58b40b7]{position:fixed;inset:0;z-index:2147483000;color-scheme:light dark;--surface: rgba(255, 255, 255, .98);--surface-solid: #ffffff;--surface-soft: #fff7fb;--text: #252b36;--muted: #7a8494;--border: rgba(232, 216, 226, .95);--shadow: rgba(88, 42, 65, .2);--accent: #ff6b9d;--accent-strong: #f04483;--accent-soft: rgba(255, 107, 157, .14);--el-color-primary: var(--accent);--el-color-primary-light-3: var(--accent-strong);--el-color-primary-light-9: var(--accent-soft);--el-bg-color: var(--surface);--el-bg-color-overlay: var(--surface);--el-fill-color-blank: var(--surface-solid);--el-border-color: var(--border);--el-border-color-light: var(--border);--el-text-color-primary: var(--text);--el-text-color-regular: var(--text);display:flex;align-items:center;justify-content:center;padding:16px;overflow-y:auto;background:#351e2b47;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.danmaku-manager-dialog[data-v-e58b40b7]{box-sizing:border-box;width:min(580px,calc(100vw - 32px));max-height:calc(100vh - 32px);display:flex;flex-direction:column;gap:0;margin:0;padding:0;overflow:hidden;border:1px solid var(--border);border-radius:22px;background:var(--surface);box-shadow:0 18px 48px var(--shadow);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}.manager-header[data-v-e58b40b7]{min-height:72px;display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:18px 20px 15px;border-bottom:1px solid var(--border)}.manager-close-button[data-v-e58b40b7]{width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;flex:0 0 28px;margin:0;padding:0;border:0;border-radius:50%;background:transparent;color:var(--muted);font:inherit;cursor:pointer}.manager-close-button[data-v-e58b40b7]:hover,.manager-close-button[data-v-e58b40b7]:focus-visible{background:var(--accent-soft);color:var(--accent-strong)}.manager-close-button[data-v-e58b40b7]:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.manager-heading[data-v-e58b40b7]{display:flex;flex-direction:column;gap:4px}.manager-title[data-v-e58b40b7]{color:var(--text);font-size:17px;font-weight:820;line-height:1.25}.manager-subtitle[data-v-e58b40b7]{color:var(--muted);font-size:12px;font-weight:560;line-height:1.45}.manager-toolbar[data-v-e58b40b7]{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 20px}.manager-summary[data-v-e58b40b7]{min-width:0;display:flex;align-items:center;gap:8px}.manager-summary-label[data-v-e58b40b7]{color:var(--text);font-size:13px;font-weight:760}.manager-count[data-v-e58b40b7]{display:inline-flex;align-items:center;min-height:22px;padding:2px 8px;border-radius:999px;background:var(--accent-soft);color:var(--accent-strong);font-size:11px;font-weight:720}.manager-actions[data-v-e58b40b7]{display:flex;align-items:center;justify-content:flex-end;gap:8px}.manager-action.el-button[data-v-e58b40b7]{height:32px;min-width:auto;margin:0;padding:0 12px;font-size:12px;font-weight:720}.manager-restore-action.el-button[data-v-e58b40b7]{border-color:var(--border);background:var(--surface-solid);color:var(--muted)}.manager-restore-action.el-button[data-v-e58b40b7]:hover,.manager-restore-action.el-button[data-v-e58b40b7]:focus-visible{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-strong)}.manager-add-action.el-button[data-v-e58b40b7]{border-color:var(--accent-strong);box-shadow:0 5px 14px #ff6b9d3d}.manager-list[data-v-e58b40b7]{height:min(320px,50vh);display:flex;flex-direction:column;gap:6px;margin:0 14px 16px;padding:6px;overflow-y:auto;border:0;border-radius:16px;background:var(--surface-soft);scrollbar-width:thin;scrollbar-color:var(--accent-soft) transparent}.manager-empty[data-v-e58b40b7]{min-height:180px;height:100%;display:flex;align-items:center;justify-content:center;padding:20px;color:var(--muted);font-size:13px;font-weight:620;text-align:center}@media(max-width:520px){.manager-header[data-v-e58b40b7]{padding:16px 16px 14px}.manager-toolbar[data-v-e58b40b7]{align-items:stretch;flex-direction:column;gap:10px;padding:12px 16px}.manager-actions[data-v-e58b40b7]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.manager-action.el-button[data-v-e58b40b7]{width:100%}.manager-list[data-v-e58b40b7]{height:min(360px,50vh);margin:0 10px 12px}}@media(prefers-color-scheme:dark){.danmaku-manager-overlay[data-v-e58b40b7]{--surface: rgba(28, 28, 32, .97);--surface-solid: #1f2025;--surface-soft: #2a2028;--text: #f3f4f7;--muted: #a7adba;--border: rgba(255, 190, 215, .2);--shadow: rgba(0, 0, 0, .44);--accent: #ff78a8;--accent-strong: #ff5d99;--accent-soft: rgba(255, 120, 168, .18);background:#00000080}}.danmaku-prompt-overlay{z-index:2147483100!important;background:#351e2b47!important;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.danmaku-prompt{color-scheme:light dark;--prompt-surface: rgba(255, 255, 255, .98);--prompt-surface-solid: #ffffff;--prompt-surface-soft: #fff7fb;--prompt-text: #252b36;--prompt-muted: #7a8494;--prompt-border: rgba(232, 216, 226, .95);--prompt-shadow: rgba(88, 42, 65, .2);--prompt-accent: #ff6b9d;--prompt-accent-strong: #f04483;--prompt-accent-soft: rgba(255, 107, 157, .14);--el-color-primary: var(--prompt-accent);--el-color-primary-light-3: var(--prompt-accent-strong);--el-color-primary-light-9: var(--prompt-accent-soft);--el-bg-color: var(--prompt-surface);--el-fill-color-blank: var(--prompt-surface-solid);--el-border-color: var(--prompt-border);--el-text-color-primary: var(--prompt-text);--el-text-color-regular: var(--prompt-text);--el-text-color-placeholder: var(--prompt-muted);--el-messagebox-width: 420px;--el-messagebox-border-radius: 20px;--el-messagebox-padding-primary: 18px;border:1px solid var(--prompt-border);box-shadow:0 18px 48px var(--prompt-shadow);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.danmaku-prompt .el-message-box__header{padding-bottom:10px}.danmaku-prompt .el-message-box__title{font-size:16px;font-weight:820}.danmaku-prompt .el-message-box__headerbtn{top:8px;right:8px;border-radius:50%}.danmaku-prompt .el-message-box__headerbtn:hover{background:var(--prompt-accent-soft)}.danmaku-prompt .el-message-box__close{color:var(--prompt-muted)}.danmaku-prompt .el-message-box__content{color:var(--prompt-muted);font-size:13px;font-weight:560;line-height:1.55}.danmaku-prompt .el-message-box__container,.danmaku-prompt .el-message-box__message{width:100%}.danmaku-prompt .el-message-box__message{flex:1}.danmaku-prompt .el-message-box__btns{gap:10px;padding-top:18px}.danmaku-prompt .el-message-box__btns .el-button{min-width:72px;height:36px;margin:0;border-radius:999px;font-size:13px;font-weight:780}.danmaku-prompt .el-message-box__btns .el-button--primary{border-color:var(--prompt-accent-strong);box-shadow:0 5px 14px #ff6b9d47}@media(prefers-color-scheme:dark){.danmaku-prompt-overlay{background:#00000080!important}.danmaku-prompt{--prompt-surface: rgba(28, 28, 32, .97);--prompt-surface-solid: #1f2025;--prompt-surface-soft: #2a2028;--prompt-text: #f3f4f7;--prompt-muted: #a7adba;--prompt-border: rgba(255, 190, 215, .2);--prompt-shadow: rgba(0, 0, 0, .44);--prompt-accent: #ff78a8;--prompt-accent-strong: #ff5d99;--prompt-accent-soft: rgba(255, 120, 168, .18)}}.setting-row[data-v-c8818322]{min-height:38px;display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--text);font-size:14px;font-weight:650}.settings-section[data-v-77ee4703]{padding:12px 0;border-top:1px solid var(--border)}.settings-section.is-first[data-v-77ee4703]{padding-top:0;border-top:0}.section-title[data-v-77ee4703]{margin-bottom:8px;color:var(--muted);font-size:12px;font-weight:820}.setting-input-number[data-v-e498fb4d]{width:70px;min-width:70px;flex:0 0 70px;--el-border: 1px solid var(--border);--el-border-color-lighter: var(--border);--el-fill-color-blank: var(--surface-soft);--el-fill-color-light: var(--accent-soft)}.setting-input-number .el-input__wrapper{height:24px;background:var(--surface-soft);box-shadow:0 0 0 1px var(--border) inset}.setting-input-number .el-input__inner{color:var(--text);font-weight:720}.setting-input-number .el-input-number__increase,.setting-input-number .el-input-number__decrease{border-color:var(--border);background:var(--accent-soft);color:var(--accent-strong)}.manage-danmaku-button.el-button[data-v-e498fb4d]{min-width:58px;font-weight:720}.quick-ability-settings-page .el-switch{--el-switch-on-color: var(--accent);--el-switch-off-color: color-mix(in srgb, var(--muted) 34%, transparent);flex:0 0 auto}.settings-popover[data-v-7d1c3981]{width:100%;padding:14px}.popover-title[data-v-7d1c3981]{margin-bottom:16px;color:var(--text);font-size:15px;font-weight:820}.settings-carousel[data-v-7d1c3981]{--swiper-pagination-color: var(--accent);--swiper-pagination-bullet-inactive-color: var(--muted);--swiper-pagination-bullet-inactive-opacity: .28;--swiper-pagination-bullet-horizontal-gap: 3.5px;--swiper-pagination-bullet-size: 7px;--swiper-pagination-bullet-border-radius: 999px;width:100%;height:220px;display:flex;flex-direction:column;border-radius:8px}.settings-carousel .swiper-wrapper{height:auto;min-height:0;flex:1 1 auto}.settings-carousel .swiper-pagination{position:static;flex:0 0 28px;display:flex;align-items:center;justify-content:center}.settings-carousel .swiper-pagination-bullet{transition:width .18s ease,background-color .18s ease,box-shadow .18s ease}.settings-carousel .swiper-pagination-bullet-active{width:18px;box-shadow:0 2px 7px var(--accent-soft)}.settings-carousel .swiper-pagination-bullet:focus-visible{outline:2px solid var(--accent);outline-offset:3px}@media(prefers-reduced-motion:reduce){.settings-carousel .swiper-wrapper,.settings-carousel .swiper-pagination-bullet{transition-duration:.01ms!important}}.capsule-actions[data-v-f7bc9024]{display:flex;align-items:center;gap:10px}.capsule-action-button[data-v-f7bc9024],.settings-action[data-v-f7bc9024]{font-size:13px;font-weight:780}.capsule-action-button.el-button.is-round[data-v-f7bc9024]{height:38px!important;flex:0 0 auto!important;padding:0 18px!important;border-radius:999px!important;margin-left:0!important}.capsule-actions .el-button+.el-button{margin-left:0}.primary-action[data-v-f7bc9024]{min-width:60px;border:1px solid var(--accent-strong);background:var(--accent);color:#fff;box-shadow:0 5px 14px #ff6b9d47}.outline-action[data-v-f7bc9024]{min-width:54px;border:1px solid var(--border);background:var(--surface-solid);color:var(--accent-strong)}.settings-action.el-button.is-circle[data-v-f7bc9024]{width:38px!important;flex:0 0 38px!important;height:38px!important;padding:0!important;border:1px solid var(--border);background:var(--surface-solid);color:var(--text)}.settings-action.is-active[data-v-f7bc9024]{border-color:var(--border);color:var(--accent-strong);background:color-mix(in srgb,var(--accent) 16%,var(--surface-solid));box-shadow:none}.capsule-settings-popper{padding:0;border-color:var(--border);border-radius:8px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.capsule-settings-popper .el-popper__arrow:before{border-color:var(--border);background:var(--surface)}@media(max-width:720px){.capsule-actions[data-v-f7bc9024]{grid-column:1 / -1;justify-content:flex-end}}.batch-send-capsule-root[data-v-e815c65d]{color-scheme:light dark;--surface: rgba(255, 255, 255, .96);--surface-solid: #ffffff;--surface-soft: #fff7fb;--text: #252b36;--muted: #7a8494;--border: rgba(232, 216, 226, .9);--shadow: rgba(88, 42, 65, .18);--accent: #ff6b9d;--accent-strong: #f04483;--accent-soft: rgba(255, 107, 157, .14);--danmaku-select-width: 190px;--el-color-primary: var(--accent);--el-color-primary-light-3: var(--accent-strong);--el-color-primary-light-5: color-mix(in srgb, var(--accent) 54%, white);--el-color-primary-light-7: color-mix(in srgb, var(--accent) 32%, white);--el-color-primary-light-9: var(--accent-soft);--el-border-color: var(--border);--el-border-color-light: var(--border);--el-border-radius-base: 999px;--el-fill-color-blank: var(--surface-solid);--el-bg-color-overlay: var(--surface);--el-box-shadow-light: 0 18px 44px var(--shadow);--el-text-color-primary: var(--text);--el-text-color-regular: var(--text);--el-text-color-placeholder: var(--muted);position:fixed;right:28px;bottom:24px;z-index:1000;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.batch-send-capsule-root[data-v-e815c65d],.batch-send-capsule-root[data-v-e815c65d] *{box-sizing:border-box}@media(prefers-color-scheme:dark){.batch-send-capsule-root[data-v-e815c65d]{--surface: rgba(28, 28, 32, .94);--surface-solid: #1f2025;--surface-soft: #2a2028;--text: #f3f4f7;--muted: #a7adba;--border: rgba(255, 190, 215, .18);--shadow: rgba(0, 0, 0, .38);--accent: #ff78a8;--accent-strong: #ff5d99;--accent-soft: rgba(255, 120, 168, .18)}}button[data-v-e815c65d]{font:inherit;cursor:pointer}.batch-send-capsule[data-v-e815c65d]{min-height:56px;display:grid;grid-template-columns:40px var(--danmaku-select-width) max-content;align-items:center;gap:10px;padding:8px 16px 8px 10px;border:1px solid var(--border);border-radius:999px;background:var(--surface);box-shadow:0 12px 34px var(--shadow);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.collapsed-capsule[data-v-e815c65d]{grid-template-columns:40px;padding:8px 10px}.collapse-handle[data-v-e815c65d]{width:40px;height:40px;display:inline-flex;align-items:center;justify-content:center;padding:0;overflow:hidden;border:1px solid var(--border);border-radius:50%;background:var(--surface-soft);color:var(--accent-strong);font-size:19px;font-weight:900;line-height:1}.capsule-toggle-icon[data-v-e815c65d]{width:100%;height:100%;display:block;object-fit:cover;pointer-events:none}.capsule-toggle-icon.is-collapse[data-v-e815c65d]{transform:rotate(180deg)}.danmaku-select.el-select[data-v-e815c65d]{--el-fill-color-light: var(--surface-solid);--el-select-disabled-border: var(--border);--el-select-disabled-color: var(--muted);width:var(--danmaku-select-width);min-width:var(--danmaku-select-width);max-width:var(--danmaku-select-width)}@media(max-width:720px){.batch-send-capsule-root[data-v-e815c65d]{left:16px;right:16px;bottom:18px}.batch-send-capsule[data-v-e815c65d]{grid-template-columns:auto minmax(0,1fr);border-radius:26px}.danmaku-select.el-select[data-v-e815c65d]{width:100%;min-width:0;max-width:none}}.batch-send-capsule-root .danmaku-select .el-select__wrapper{width:100%;min-height:38px;height:38px;border-radius:999px;background:var(--surface-solid);box-shadow:0 0 0 1px var(--border) inset;padding:0 14px}.batch-send-capsule-root .danmaku-select .el-select__selected-item{color:var(--text);font-size:14px;font-weight:680}.batch-send-capsule-root .danmaku-select .el-select__placeholder{color:var(--muted);font-weight:560}.batch-send-capsule-root .danmaku-select .el-select__caret{color:var(--accent-strong)}.batch-send-capsule-root .danmaku-select-popper .el-select-dropdown__wrap{scrollbar-width:none}.batch-send-capsule-root .danmaku-select-popper .el-select-dropdown__wrap::-webkit-scrollbar,.batch-send-capsule-root .danmaku-select-popper .el-scrollbar__bar{display:none}.batch-send-capsule-root .danmaku-select-popper .el-select-dropdown__item{padding-right:14px} '); var _GM_addStyle = (() => typeof GM_addStyle != "undefined" ? GM_addStyle : void 0)(); var _GM_addValueChangeListener = (() => typeof GM_addValueChangeListener != "undefined" ? GM_addValueChangeListener : void 0)(); var _GM_deleteValue = (() => typeof GM_deleteValue != "undefined" ? GM_deleteValue : void 0)(); var _GM_deleteValues = (() => typeof GM_deleteValues != "undefined" ? GM_deleteValues : void 0)(); var _GM_getResourceText = (() => typeof GM_getResourceText != "undefined" ? GM_getResourceText : void 0)(); var _GM_getValue = (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)(); var _GM_getValues = (() => typeof GM_getValues != "undefined" ? GM_getValues : void 0)(); var _GM_listValues = (() => typeof GM_listValues != "undefined" ? GM_listValues : void 0)(); var _GM_removeValueChangeListener = (() => typeof GM_removeValueChangeListener != "undefined" ? GM_removeValueChangeListener : void 0)(); var _GM_setValue = (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)(); var _GM_setValues = (() => typeof GM_setValues != "undefined" ? GM_setValues : void 0)(); var _unsafeWindow = (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)(); var L$1 = { get: _GM_getValue, getMany: _GM_getValues, set: _GM_setValue, setMany: _GM_setValues, remove: _GM_deleteValue, removeMany: _GM_deleteValues, keys: _GM_listValues, watch: _GM_addValueChangeListener, unwatch: _GM_removeValueChangeListener }; var e = { UNKNOWN: "MAKOO_UNKNOWN", ADAPTER_NOT_FOUND: "MAKOO_ADAPTER_NOT_FOUND", ADAPTER_MOUNT_FAIL: "MAKOO_ADAPTER_MOUNT_FAIL", ADAPTER_UNMOUNT_FAIL: "MAKOO_ADAPTER_UNMOUNT_FAIL", TASK_NO_REGISTERED: "MAKOO_TASK_NO_REGISTERED", TASK_NOT_FOUND: "MAKOO_TASK_NOT_FOUND", TASK_INJECT_FAIL: "MAKOO_TASK_INJECT_FAIL", TASK_ALREADY_MOUNTED: "MAKOO_TASK_ALREADY_MOUNTED", TASK_TARGET_DETACHED: "MAKOO_TASK_TARGET_DETACHED", TASK_LISTENER_ATTACH_FAIL: "MAKOO_TASK_LISTENER_ATTACH_FAIL", TASK_SIGNAL_INVALID: "MAKOO_TASK_SIGNAL_INVALID", TASK_SIGNAL_BIND_FAIL: "MAKOO_TASK_SIGNAL_BIND_FAIL" }; function t$1(e3) { let t2 = [], n2 = e3; for (; n2; ) t2.push(` cause: ${n2.message}`), n2 = n2.cause; return t2; } var n = class extends Error { code; issues; cause; constructor(n2, r3, i3 = e.UNKNOWN, a3) { let o2 = [`[makoo] ${n2}`]; if (r3?.length) for (let e3 of r3) o2.push(` - ${e3.path}: ${e3.message}`); for (let e3 of t$1(a3)) o2.push(e3); super(o2.join("\n")), this.name = "MakooError", this.code = i3, this.issues = r3 ?? [], a3 && (this.cause = a3); } }, r$1 = class r extends n { constructor(t2, n2, r3 = e.ADAPTER_NOT_FOUND, i3) { super(t2, n2, r3, i3), this.name = "AdapterError"; } }, i$1 = class i extends n { constructor(t2, n2, r3 = e.TASK_SIGNAL_INVALID, i3) { super(t2, n2, r3, i3), this.name = "SignalError"; } }, a$1 = class a extends n { constructor(t2, n2, r3 = e.TASK_NO_REGISTERED, i3) { super(t2, n2, r3, i3), this.name = "TaskError"; } }, o$1 = class e2 { static LEVELS = [ "debug", "info", "warn", "error" ]; level; static PREFIX = "[Makoo]"; constructor(e3 = "info") { this.level = e3; } setLevel(e3) { this.level = e3; } getLevel() { return this.level; } log(t2, n2, ...r3) { let i3 = ( new Date()).toISOString(), a3 = e2.LEVELS.indexOf(t2), o2 = e2.LEVELS.indexOf(this.level); a3 === -1 || o2 === -1 || a3 < o2 || console[t2](`${e2.PREFIX}[${t2.toUpperCase()}][${i3}] ${n2}`, ...r3); } info(e3, ...t2) { this.log("info", e3, ...t2); } error(e3, ...t2) { this.log("error", e3, ...t2); } warn(e3, ...t2) { this.log("warn", e3, ...t2); } debug(e3, ...t2) { this.log("debug", e3, ...t2); } }, s = () => { }; function c(e3) { return e3 ? (t2, n2 = {}) => { e3.emit({ name: t2, ts: Date.now(), ...n2 }); } : s; } function l(e3, t2, n2) { if (t2) for (let [r3, i3] of Object.entries(t2)) { if (!i3) continue; let t3 = Array.isArray(i3) ? i3 : [i3]; for (let i4 of t3) n2 ? e3.onTask(n2, r3, i4) : e3.on(r3, i4); } } function u() { let e3 = false, t2 = false; return { ctrl: { stopPropagation() { e3 = true; }, stopImmediatePropagation() { e3 = true, t2 = true; } }, isPropagationStopped() { return e3; }, isImmediatePropagationStopped() { return t2; } }; } function d(e3 = new o$1()) { let t2 = new Map(), n2 = new Map(), r3 = new Set(); function i3(e4, n3) { if (n3) { let r4 = t2.get(e4); if (!r4) return; r4.delete(n3), r4.size === 0 && t2.delete(e4); } else t2.delete(e4); } function a3(e4, t3, r4) { let i4 = n2.get(e4); if (!i4) return; if (!t3) { n2.delete(e4); return; } if (!r4) { i4.delete(t3), i4.size === 0 && n2.delete(e4); return; } let a4 = i4.get(t3); a4 && (a4.delete(r4), a4.size === 0 && i4.delete(t3), i4.size === 0 && n2.delete(e4)); } function s2(e4) { r3.delete(e4); } function c2(e4, t3, n3) { if (!(!e4 || e4.size === 0)) for (let r4 of [...e4]) { if (n3.isImmediatePropagationStopped()) return; l2(r4, t3, n3.ctrl); } } function l2(t3, n3, r4) { try { t3(n3, r4); } catch (t4) { e3.error(`Hook execution failed for event "${n3.name}".`, t4); } } function d2(e4, i4) { let a4 = i4.taskId === e4 ? i4 : { ...i4, taskId: e4 }, o2 = n2.get(e4)?.get(a4.name), s3 = t2.get(a4.name), l3 = !!(o2 && o2.size > 0), d3 = !!(s3 && s3.size > 0); if (!l3 && !d3 && r3.size === 0) return; let f = u(); c2(o2, a4, f), !f.isPropagationStopped() && (c2(s3, a4, f), !f.isPropagationStopped() && c2(r3, a4, f)); } return { on(e4, n3) { return t2.has(e4) || t2.set(e4, new Set()), t2.get(e4)?.add(n3), () => { i3(e4, n3); }; }, onTask(e4, t3, r4) { n2.has(e4) || n2.set(e4, new Map()); let i4 = n2.get(e4); return i4?.has(t3) || i4?.set(t3, new Set()), i4?.get(t3)?.add(r4), () => { a3(e4, t3, r4); }; }, onAny(e4) { return r3.add(e4), () => { s2(e4); }; }, off: i3, offTask: a3, offAny: s2, clear() { t2.clear(), r3.clear(), n2.clear(); }, hasHooks(e4) { if (e4) { let i4 = t2.get(e4); if (i4 && i4.size > 0 || r3.size > 0) return true; for (let t3 of n2.values()) { let n3 = t3.get(e4); if (n3 && n3.size > 0) return true; } return false; } if (r3.size > 0) return true; for (let e5 of t2.values()) if (e5.size > 0) return true; for (let e5 of n2.values()) for (let t3 of e5.values()) if (t3.size > 0) return true; return false; }, emit(e4) { if (e4.taskId) { d2(e4.taskId, e4); return; } let n3 = u(); c2(t2.get(e4.name), e4, n3), !n3.isPropagationStopped() && c2(r3, e4, n3); }, emitOnTask: d2 }; } function p() { let e3 = []; return { resolve(t2) { return e3.find((e4) => e4.matches(t2)); }, use(t2) { e3.includes(t2) || e3.push(t2); } }; } function m(e3, t2, n2) { return n2[e3](t2); } var h = { "signal:watcherReleased": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { resource: "watcher" } }), "resource:listenerReleased": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { resource: "listener", listenerEvent: e3.listenerEvent, listenAt: e3.listenAt } }), "artifact:unmounted": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { resource: "component", artifactName: e3.artifactName } }) }; function g(e3, t2) { return m(e3, t2, h); } var _ = { "task:statusChange": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, preStatus: e3.preStatus }), "task:beforeReset": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status }), "task:afterReset": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, preStatus: e3.preStatus }), "task:beforeDestroy": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status }), "task:afterDestroy": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, preStatus: e3.preStatus }) }; function v(e3, t2) { return m(e3, t2, _); } function ee(e3) { return typeof e3 == "object" && !!e3; } function y(e3) { return ee(e3) && "get" in e3 && "subscribe" in e3 && typeof e3.get == "function" && typeof e3.subscribe == "function"; } function b(t2) { if (y(t2)) return t2; throw new i$1("Invalid activity signal source", [{ path: "activitySignal", message: "must provide get() and subscribe() methods" }], e.TASK_SIGNAL_INVALID); } function ne(e3, t2) { let n2 = b(e3); return t2(n2.get()), n2.subscribe(t2); } function x(e3) { if (typeof e3 == "function") { e3(); return; } e3.unsubscribe(); } var S = new WeakMap(), C = 0; function w(e3) { return e3.kind === "component"; } function T(e3) { return w(e3) ? e3.injectAt : e3.listenAt; } function E(e3) { if (!e3.withEvent) return; let t2 = w(e3) ? e3.listener : e3; if (!(!t2?.listenAt || !t2.event || !t2.callback)) return t2; } function re(e3, t2) { if (t2.id) return t2.id; let n2 = t2.artifactName ? `${t2.artifactName}@${t2.injectAt}` : `artifact-${t2.injectAt}`, r3 = e3.taskContext.get(n2); if (r3 && w(r3) && r3.artifact === t2.artifact) return n2; let i3 = S.get(t2.artifact); if (i3) { let n3 = `${t2.artifactName}#${i3}@${t2.injectAt}`, r4 = e3.taskContext.get(n3); if (r4 && w(r4) && r4.artifact === t2.artifact) return n3; } if (!r3) return n2; let a3 = ie(t2.artifact), o2 = `${t2.artifactName}#${a3}@${t2.injectAt}`, s2 = 2; for (; ; ) { let n3 = e3.taskContext.get(o2); if (!n3 || w(n3) && n3.artifact === t2.artifact) return o2; o2 = `${t2.artifactName}#${a3}-${s2}@${t2.injectAt}`, s2++; } } function ie(e3) { if (typeof e3 != "object" && typeof e3 != "function" || e3 === null) return C++, `artifact-${C}`; let t2 = e3, n2 = S.get(t2); if (n2) return n2; C++; let r3 = `artifact-${C}`; return S.set(t2, r3), r3; } function D(e3 = s, t2 = new o$1()) { let n2 = new Map(); function r3(e4, t3) { let r4 = n2.get(e4); if (r4) return t3 ? r4.kind === t3 ? r4 : void 0 : r4; } let i3 = { taskErrorMessages: [], taskRecords: [], set(e4, t3) { n2.set(e4, t3); }, get: r3, has(e4) { return n2.has(e4); }, keys() { return n2.keys(); }, getTaskStatus(e4) { let t3 = n2.get(e4); return t3 ? t3.taskStatus : void 0; }, setTaskStatus(r4, i4) { let a3 = n2.get(r4); if (!a3) { t2.warn(`Task "${r4}" not found, may already be destroyed`); return; } if (a3.taskStatus === i4) return; let o2 = a3.taskStatus; a3.taskStatus = i4; let s2 = T(a3); e3("task:statusChange", v("task:statusChange", { taskId: r4, kind: a3.kind, injectAt: s2, status: i4, preStatus: o2 })); }, destroy(e4) { let r4 = n2.get(e4); if (!r4) { t2.warn(`Task "${e4}" not found, may already be destroyed`); return; } i3.setTaskStatus(e4, "idle"), i3.taskRecords = i3.taskRecords.filter((t3) => t3.taskId !== e4), i3.taskErrorMessages = i3.taskErrorMessages.filter((t3) => t3.taskId !== e4), i3.releaseWatcher(e4), i3.releaseListener(e4), w(r4) && (i3.releaseComponentInstance(e4), i3.releaseDomElement(e4)), n2.delete(e4); }, destroyAll() { let e4 = Array.from(n2.keys()); for (let t3 of e4) i3.releaseWatcher(t3); for (let t3 of e4) { i3.releaseListener(t3); let e5 = n2.get(t3); e5 && w(e5) && (i3.releaseComponentInstance(t3), i3.releaseDomElement(t3)); } n2.clear(), i3.taskRecords = [], i3.taskErrorMessages = [], t2.info("All tasks destroyed"); }, releaseComponentInstance(r4) { let i4 = n2.get(r4); if (i4 && w(i4) && i4.mountHandle && i4.appRoot) try { i4.adapter.unmount({ host: i4.hostElement, mountPoint: i4.appRoot, handle: i4.mountHandle, taskId: r4, injectAt: i4.injectAt, reason: "destroy" }), i4.mountHandle = void 0, i4.instance = void 0, e3("artifact:unmounted", g("artifact:unmounted", { taskId: r4, kind: "component", injectAt: i4.injectAt, status: i4.taskStatus, artifactName: i4.artifactName })); } catch (e4) { t2.error(`Failed to unmount component for task "${r4}":`, e4); } else t2.warn(`Component for task "${r4}" already unmounted`); }, releaseDomElement(e4) { let r4 = n2.get(e4); if (!r4 || !w(r4)) { t2.warn(`Task "${e4}" context not found, unable to remove root element`); return; } if (!r4.appRoot) { t2.warn(`Root element for task "${e4}" not found, may already be removed`); return; } try { r4.appRoot.remove(), r4.appRoot = void 0, r4.hostElement = void 0; } catch (n3) { t2.error(`Failed to remove root element for task "${e4}":`, n3); } }, releaseListener(r4) { let i4 = n2.get(r4); if (!i4) return; let a3 = E(i4), o2 = a3?.event ?? (w(i4) ? i4.listener?.event : i4.event), s2 = a3?.listenAt ?? (w(i4) ? i4.listener?.listenAt : i4.listenAt); if (a3?.controller) try { a3.controller.abort(); } catch (e4) { t2.error(`Failed to abort listener for task "${r4}":`, e4); } a3 && (a3.controller = void 0), w(i4) && (i4.listener = void 0), i4.withEvent = false, e3("resource:listenerReleased", g("resource:listenerReleased", { taskId: r4, kind: i4.kind, injectAt: T(i4), status: i4.taskStatus, listenerEvent: o2, listenAt: s2 })); }, releaseWatcher(r4) { let i4 = n2.get(r4); if (i4?.watcher) try { x(i4.watcher.watcher), i4.watcher = void 0, e3("signal:watcherReleased", g("signal:watcherReleased", { taskId: r4, kind: i4.kind, injectAt: T(i4), status: i4.taskStatus })); } catch (e4) { t2.error(`Failed to stop watcher for task "${r4}":`, e4); } }, reset(r4) { let a3 = n2.get(r4); if (!a3) return; let o2 = false; if (w(a3) && a3.mountHandle && a3.appRoot) try { a3.adapter.unmount({ host: a3.hostElement, mountPoint: a3.appRoot, handle: a3.mountHandle, taskId: r4, injectAt: a3.injectAt, reason: "reset" }), o2 = true; } catch (e4) { t2.warn(`Failed to unmount component for task "${r4}" during reset:`, e4); } i3.setTaskStatus(r4, "idle"), o2 && w(a3) && e3("artifact:unmounted", g("artifact:unmounted", { taskId: r4, kind: "component", injectAt: a3.injectAt, status: a3.taskStatus, artifactName: a3.artifactName })), w(a3) && (a3.mountHandle = void 0, a3.instance = void 0, a3.hostElement = void 0, a3.appRoot?.remove(), a3.appRoot = void 0, a3.isObserver = false), a3.watcher && i3.releaseWatcher(r4); let s2 = E(a3), c2 = s2?.event, l2 = s2?.listenAt; s2?.controller && (s2.controller.abort(), s2.controller = void 0), s2 && e3("resource:listenerReleased", g("resource:listenerReleased", { taskId: r4, kind: a3.kind, injectAt: T(a3), status: a3.taskStatus, listenerEvent: c2, listenAt: l2 })); }, resetAll() { for (let e4 of n2.keys()) i3.reset(e4); } }; return i3; } var O = { "alive:enabled": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { scope: e3.scope } }), "alive:disabled": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { scope: e3.scope } }), "alive:observerStarted": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { scope: e3.scope, observerMode: e3.observerMode } }), "alive:observerStopped": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { scope: e3.scope, observerMode: e3.observerMode } }) }; function k(e3, t2) { return m(e3, t2, O); } var A = { "dom:targetFound": (e3) => ({ injectAt: e3.injectAt, taskId: e3.taskId, kind: e3.kind, durationMs: e3.durationMs, meta: { root: e3.root } }), "dom:targetTimeout": (e3) => ({ injectAt: e3.injectAt, taskId: e3.taskId, kind: e3.kind, durationMs: e3.durationMs, meta: { root: e3.root } }), "dom:targetRemoved": (e3) => ({ injectAt: e3.injectAt, taskId: e3.taskId, kind: e3.kind, meta: { phase: "removed" } }), "dom:targetRestored": (e3) => ({ injectAt: e3.injectAt, taskId: e3.taskId, kind: e3.kind, durationMs: e3.durationMs }) }; function j(e3, t2) { return m(e3, t2, A); } function M(e3) { let t2 = Date.now(), n2, r3 = e3.root instanceof Document ? "document" : "element"; return (i3) => { if (i3 === "dom:targetFound") { e3.emit("dom:targetFound", j("dom:targetFound", { injectAt: e3.injectAt, taskId: e3.taskId, kind: e3.kind, durationMs: Date.now() - t2, root: r3 })); return; } if (i3 === "dom:targetTimeout") { e3.emit("dom:targetTimeout", j("dom:targetTimeout", { injectAt: e3.injectAt, taskId: e3.taskId, kind: e3.kind, durationMs: Date.now() - t2, root: r3 })); return; } if (i3 === "dom:targetRemoved") { n2 = Date.now(), e3.emit("dom:targetRemoved", j("dom:targetRemoved", { injectAt: e3.injectAt, taskId: e3.taskId, kind: e3.kind })); return; } e3.emit("dom:targetRestored", j("dom:targetRestored", { injectAt: e3.injectAt, taskId: e3.taskId, kind: e3.kind, durationMs: Date.now() - (n2 ?? t2) })); }; } function N(e3, t2, n2 = document, r3, i3 = { logger: new o$1(), emit: s }) { let a3 = [], c2 = false, l2 = () => { if (!c2) { c2 = true; for (let e4 of a3) e4.disconnect(); a3.length = 0; } }, u2 = (n3, a4) => { i3.emit("dom:targetFound"), t2(n3, a4), r3?.once && (l2(), i3.logger.info(`Element "${e3}" found, observer disconnected`)); }; return ((t3) => { c2 || (oe(t3, e3, u2), !c2 && se(t3, e3, a3, u2)); })(n2), r3?.timeout && setTimeout(() => { c2 || (l2(), i3.emit("dom:targetTimeout"), i3.logger.warn(`Element "${e3}" not found within ${r3.timeout}ms, observer disconnected`)); }, r3.timeout), l2; } function ae(e3, t2, n2, r3, i3 = document, a3, c2 = { logger: new o$1(), emit: s }) { let l2 = true, u2, d2 = ce(e3, () => { c2.emit("dom:targetRemoved"), n2(), l2 && (u2 = N(t2, (e4) => { l2 && (c2.emit("dom:targetRestored"), r3(e4)); }, document, a3, c2)); }, i3, c2.logger); return () => { l2 && (l2 = false, d2?.disconnect(), u2?.(), c2.logger.info(`Alive observer for "${t2}" stopped`)); }; } var P = { onDomReady: N, onDomAlive: ae }; function oe(e3, t2, n2) { let r3 = (e3 instanceof Document ? e3 : e3.ownerDocument).querySelector(t2); r3 && n2(r3, void 0); } function se(e3, t2, n2, r3) { let i3 = new MutationObserver((e4, n3) => { for (let i4 of e4) i4.addedNodes.forEach((e5) => { e5.nodeType === 1 && le(e5, t2, n3, r3); }); }), a3 = F(e3); a3 && (i3.observe(a3, { childList: true, subtree: true }), n2.push(i3)); } function ce(e3, t2, n2, r3) { let i3 = F(n2), a3 = i3 instanceof HTMLBodyElement; if (i3 === null) return r3.error("Failed to set up removal observer: no valid observation target found"), null; if (!a3 && !i3.isConnected) return r3.error("Failed to set up removal observer: observation target is detached from DOM"), null; let o2 = a3 ? i3 : i3.parentElement || i3; if (!o2) return t2(), null; let s2 = new MutationObserver((n3, r4) => { for (let i4 of n3) i4.removedNodes.forEach((n4) => { n4 === e3 && (t2(r4), r4.disconnect()); }); }); return s2.observe(o2, { childList: true, subtree: !!a3 }), r3.info("Removal observer started", o2), s2; } function le(e3, t2, n2, r3) { let i3 = e3.matches(t2) ? e3 : e3.querySelector(t2); i3 && r3(i3, n2); } function F(e3) { return (e3 instanceof Document ? e3.body : e3) || document.body; } var I = (function(e3) { return e3.OPEN = "OPEN", e3.CLOSE = "CLOSE", e3; })({}), ue = { "artifact:mountStart": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { artifactName: e3.artifactName, alive: e3.alive, scope: e3.scope, withEvent: e3.withEvent } }), "artifact:mountSuccess": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { artifactName: e3.artifactName, alive: e3.alive, scope: e3.scope } }), "artifact:mountFail": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: "idle", error: e3.error, meta: { artifactName: e3.artifactName } }) }; function L(e3, t2) { return m(e3, t2, ue); } var R = { "listener:attached": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { listenerEvent: e3.listenerEvent, listenAt: e3.listenAt } }), "listener:detached": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { listenerEvent: e3.listenerEvent, listenAt: e3.listenAt } }), "listener:attachFail": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, error: e3.error, meta: { listenerEvent: e3.listenerEvent, listenAt: e3.listenAt } }) }; function z(e3, t2) { return m(e3, t2, R); } var B = { "start:requested": (e3) => ({ meta: { totalTasks: e3.totalTasks, idleTasks: e3.idleTasks, pendingTasks: e3.pendingTasks, activeTasks: e3.activeTasks } }), "start:taskScheduled": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, preStatus: e3.preStatus, meta: { timeout: e3.timeout } }), "start:taskSkipped": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { skipReason: e3.skipReason } }), "task:targetReady": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status }) }; function V(e3, t2) { return m(e3, t2, B); } function H() { return "xxxxxxxx".replace(/[xy]/g, (e3) => { let t2 = Math.random() * 16 | 0; return (e3 === "x" ? t2 : t2 & 3 | 8).toString(16); }); } function U(t2, n2) { let r3 = new Set(n2), i3 = t2.taskContext.taskRecords.filter(({ taskId: e3 }) => r3.has(e3)), o2 = i3.reduce((e3, { taskId: n3 }) => { let r4 = t2.taskContext.getTaskStatus(n3); return r4 === "idle" && (e3.idleTasks += 1), r4 === "pending" && (e3.pendingTasks += 1), r4 === "active" && (e3.activeTasks += 1), e3; }, { totalTasks: i3.length, idleTasks: 0, pendingTasks: 0, activeTasks: 0 }); if (t2.emit("start:requested", V("start:requested", o2)), i3.length === 0) throw new a$1("No registered tasks found, call start() with tasks before starting", [], e.TASK_NO_REGISTERED); i3.forEach(({ taskId: e3, injectAt: n3 }) => { let r4 = t2.taskContext.getTaskStatus(e3), i4 = t2.taskContext.get(e3); if (!(!i4 || !r4)) { if (r4 === "active" || r4 === "pending") { t2.emit("start:taskSkipped", V("start:taskSkipped", { taskId: e3, kind: i4.kind, injectAt: n3, status: r4, skipReason: r4 === "active" ? "already-active" : "already-pending" })); return; } P.onDomReady(n3, (n4) => W(t2, n4, e3), document, { once: true, timeout: i4.timeout }, { logger: t2.logger, emit: M({ emit: t2.emit, taskId: e3, kind: i4.kind, injectAt: n3, root: document }) }), t2.taskContext.getTaskStatus(e3) !== "active" && (t2.taskContext.setTaskStatus(e3, "pending"), t2.emit("start:taskScheduled", V("start:taskScheduled", { taskId: e3, kind: i4.kind, injectAt: n3, status: "pending", preStatus: "idle", timeout: i4.timeout }))); } }); } function W(t2, n2, r3) { let i3 = t2.taskContext.get(r3); if (!i3) { t2.logger.error(`Task "${r3}" not found, unable to proceed with injection`); return; } if (t2.emit("task:targetReady", V("task:targetReady", { taskId: r3, kind: i3.kind, injectAt: T(i3), status: i3.taskStatus })), i3.taskStatus === "active") return; let o2 = T(i3); if (w(i3)) { t2.emit("artifact:mountStart", L("artifact:mountStart", { taskId: r3, kind: "component", injectAt: i3.injectAt, status: i3.taskStatus, artifactName: i3.artifactName, alive: i3.alive, scope: i3.scope, withEvent: i3.withEvent })); let o3 = fe(t2, n2, r3); if (!o3.isSuccess) { t2.taskContext.setTaskStatus(r3, "idle"), t2.emit("artifact:mountFail", L("artifact:mountFail", { taskId: r3, kind: "component", injectAt: i3.injectAt, status: "idle", error: o3.error ?? new a$1(`Component inject failed for task "${r3}"`, [{ path: "taskId", message: r3 }], e.TASK_INJECT_FAIL), artifactName: i3.artifactName })); return; } t2.emit("artifact:mountSuccess", L("artifact:mountSuccess", { taskId: r3, kind: "component", injectAt: i3.injectAt, status: i3.taskStatus, artifactName: i3.artifactName, alive: i3.alive, scope: i3.scope })); } if (i3.withEvent) { let n3 = null, s2 = E(i3); if (n3 = s2?.activitySignal ? G(t2, r3, s2.activitySignal()) : K(t2, r3, I.OPEN), n3 === false) { t2.taskContext.setTaskStatus(r3, "idle"); let n4 = E(i3); t2.emit("listener:attachFail", z("listener:attachFail", { taskId: r3, kind: i3.kind, injectAt: o2, status: "idle", error: new a$1(`Listener attach failed for task "${r3}"`, [{ path: "taskId", message: r3 }], e.TASK_LISTENER_ATTACH_FAIL), listenerEvent: n4?.event, listenAt: n4?.listenAt })); return; } } t2.taskContext.setTaskStatus(r3, "active"); } function G(t2, n2, r3) { let a3 = t2.taskContext.get(n2); if (!a3) return t2.logger.error(`Task "${n2}" not found, unable to bind activity signal`), false; a3.watcher &&= (x(a3.watcher.watcher), void 0); try { return a3.watcher = { watcher: ne(r3, (e3) => { K(t2, n2, e3 ? I.OPEN : I.CLOSE); }), watchSource: r3 }, true; } catch (r4) { let a4 = r4 instanceof i$1 ? r4 : new i$1(`Failed to bind activity signal for task "${n2}"`, [{ path: "taskId", message: n2 }], e.TASK_SIGNAL_BIND_FAIL, r4 instanceof Error ? r4 : void 0); return t2.logger.error(`Failed to bind activity signal for task "${n2}":`, a4), false; } } function K(t2, n2, r3) { let i3 = t2.taskContext.get(n2); if (!i3) return t2.logger.error(`Task "${n2}" not found, unable to manage listener state`), false; let o2 = E(i3); if (!o2) return t2.logger.warn(`Task "${n2}" has no event binding configured`), false; switch (r3) { case I.OPEN: { if (o2.controller) return false; let r4 = de(t2, n2, i3.kind, o2.listenAt, o2.event, o2.callback, o2.capture); if (r4) o2.controller = r4, t2.emit("listener:attached", z("listener:attached", { taskId: n2, kind: i3.kind, injectAt: o2.listenAt, status: i3.taskStatus, listenerEvent: o2.event, listenAt: o2.listenAt })); else { let r5 = new a$1(`Failed to attach event "${o2.event}" for task "${n2}"`, [ { path: "taskId", message: n2 }, { path: "listener.event", message: o2.event }, { path: "listener.listenAt", message: o2.listenAt } ], e.TASK_LISTENER_ATTACH_FAIL); return t2.logger.error(r5.message), t2.emit("listener:attachFail", z("listener:attachFail", { taskId: n2, kind: i3.kind, injectAt: o2.listenAt, status: i3.taskStatus, error: r5, listenerEvent: o2.event, listenAt: o2.listenAt })), false; } break; } case I.CLOSE: if (!o2.controller) return false; o2.controller.abort(), o2.controller = void 0, t2.logger.info(`Event "${o2.event}" detached from task "${n2}"`), t2.emit("listener:detached", z("listener:detached", { taskId: n2, kind: i3.kind, injectAt: o2.listenAt, status: i3.taskStatus, listenerEvent: o2.event, listenAt: o2.listenAt })); break; default: return t2.logger.warn(`Unknown action type "${r3}" for task "${n2}"`), false; } return true; } function de(e3, t2, n2, r3, i3, a3, o2 = false) { let s2 = document.querySelector(r3); if (s2) { let n3 = new AbortController(); return s2.addEventListener(i3, a3, { capture: o2, signal: n3.signal }), e3.logger.info(`Event "${i3}" attached at "${r3}" (task: ${t2})`), n3; } let c2 = new AbortController(); return P.onDomReady(r3, (n3) => { c2.signal.aborted || (n3.addEventListener(i3, a3, { capture: o2, signal: c2.signal }), e3.logger.info(`Event "${i3}" attached at "${r3}" (task: ${t2})`)); }, document, { once: true, timeout: e3.config.timeout }, { logger: e3.logger, emit: M({ emit: e3.emit, taskId: t2, kind: n2, injectAt: r3, root: document }) }), c2; } function fe(t2, n2, i3) { let o2 = t2.taskContext.get(i3); if (!o2 || !w(o2)) { let n3 = new a$1(`Task "${i3}" context missing, injection aborted`, [{ path: "taskId", message: i3 }], e.TASK_NOT_FOUND); return t2.logger.error(n3.message), { isSuccess: false, error: n3 }; } if (!o2.taskId) { let n3 = new a$1(`No artifact found for task "${i3}", injection aborted`, [{ path: "taskId", message: i3 }], e.TASK_INJECT_FAIL); return t2.logger.error(n3.message), { isSuccess: false, error: n3 }; } if (o2.mountHandle) { let n3 = new a$1(`Task "${i3}" is already mounted, skipping`, [{ path: "taskId", message: i3 }], e.TASK_ALREADY_MOUNTED); return t2.logger.warn(n3.message), { isSuccess: false, error: n3 }; } let s2 = o2.injectAt, c2 = n2.ownerDocument || document, l2 = c2.createElement("div"); if (l2.id = `implant-root-${H()}`, l2.style.display = "contents", l2.style.zIndex = "999999", n2.isConnected) n2.appendChild(l2); else { let n3 = new a$1(`Target element for task "${i3}" is detached from DOM, injection skipped`, [{ path: "taskId", message: i3 }], e.TASK_TARGET_DETACHED); return t2.logger.warn(n3.message), { isSuccess: false, error: n3 }; } try { let e3 = o2.adapter.mount({ host: n2, mountPoint: l2, artifact: o2.artifact, taskId: i3, injectAt: s2, makoo: t2.makooContext(i3, s2) }); if (o2.mountHandle = e3.handle, o2.hostElement = n2, o2.instance = e3.instance, o2.appRoot = l2, t2.logger.info(`Artifact "${o2.artifactName}" injected at "${s2}"`), o2.alive && !o2.isObserver) { let r3 = P.onDomAlive(n2, s2, () => { t2.taskContext.reset(i3); }, (e4) => W(t2, e4, i3), o2.scope === "global" ? c2 : n2, { once: true, timeout: t2.config.timeout }, { logger: t2.logger, emit: M({ emit: t2.emit, taskId: i3, kind: o2.kind, injectAt: s2, root: o2.scope === "global" ? c2 : n2 }) }); !o2.alive || o2.mountHandle !== e3.handle ? r3() : (o2.disableAlive = r3, o2.isObserver = true, t2.emit("alive:observerStarted", k("alive:observerStarted", { taskId: i3, kind: "component", injectAt: s2, status: o2.taskStatus, scope: o2.scope, observerMode: "mounted" })), t2.logger.info(`Task "${i3}" alive observer activated`)); } return { isSuccess: true }; } catch (n3) { let a3 = new r$1(`Artifact mount failed for task "${i3}"`, [{ path: "taskId", message: i3 }], e.ADAPTER_MOUNT_FAIL, n3 instanceof Error ? n3 : void 0); return t2.logger.error(`Artifact mount failed for task "${i3}":`, a3), l2.remove(), { isSuccess: false, error: a3 }; } } function q(e3, t2) { let n2 = e3.taskContext.get(t2); if (!n2) { e3.logger.error(`Task "${t2}" not found`); return; } if (!w(n2)) { e3.logger.warn(`enableAlive is not applicable to non-component task "${t2}"`); return; } if (n2.alive && n2.isObserver) { e3.logger.warn(`Task "${t2}" already has an active alive observer`); return; } if (n2.alive = true, n2.isObserver = false, e3.emit("alive:enabled", k("alive:enabled", { taskId: t2, kind: "component", injectAt: n2.injectAt, status: n2.taskStatus, scope: n2.scope })), n2.disableAlive = () => { }, n2.mountHandle && n2.appRoot?.isConnected) { let r3 = n2.hostElement ?? n2.appRoot.parentElement; if (!r3) { e3.logger.warn(`Task "${t2}": host element not found, unable to activate alive observer`); return; } let i3 = r3.ownerDocument || document, a3 = n2.injectAt, o2 = P.onDomAlive(r3, a3, () => { e3.taskContext.reset(t2); }, (n3) => W(e3, n3, t2), n2.scope === "global" ? i3 : r3, { once: true, timeout: e3.config.timeout }, { logger: e3.logger, emit: M({ emit: e3.emit, taskId: t2, kind: "component", injectAt: a3, root: n2.scope === "global" ? i3 : r3 }) }); if (!n2.alive) { o2(); return; } n2.disableAlive = o2, n2.isObserver = true, e3.emit("alive:observerStarted", k("alive:observerStarted", { taskId: t2, kind: "component", injectAt: a3, status: n2.taskStatus, scope: n2.scope, observerMode: "mounted" })), e3.logger.info(`Task "${t2}" alive observer activated`); return; } if (n2.mountHandle && !n2.appRoot?.isConnected && e3.taskContext.reset(t2), !n2.mountHandle) { let r3 = false, i3 = P.onDomReady(n2.injectAt, (i4) => { if (r3 || !n2.alive) { e3.logger.warn(`Task "${t2}" alive state changed before element appears`); return; } W(e3, i4, t2); }, document, { once: true, timeout: e3.config.timeout }, { logger: e3.logger, emit: M({ emit: e3.emit, taskId: t2, kind: "component", injectAt: n2.injectAt, root: document }) }); n2.disableAlive = () => { r3 || (r3 = true, e3.emit("alive:observerStopped", k("alive:observerStopped", { taskId: t2, kind: "component", injectAt: n2.injectAt, status: n2.taskStatus, scope: n2.scope, observerMode: "await-target" })), i3()); }, n2.isObserver = true, e3.emit("alive:observerStarted", k("alive:observerStarted", { taskId: t2, kind: "component", injectAt: n2.injectAt, status: n2.taskStatus, scope: n2.scope, observerMode: "await-target" })), e3.logger.info(`Task "${t2}" awaiting target element for re-injection`); } } function J(e3, t2) { let n2 = e3.taskContext.get(t2); if (!n2) { e3.logger.error(`Task "${t2}" not found`); return; } if (!w(n2)) { e3.logger.warn(`disableAlive is not applicable to non-component task "${t2}"`); return; } if (!n2.alive) { e3.logger.warn(`Task "${t2}" has no active alive observer to stop`); return; } let r3 = n2.disableAlive; n2.alive = false, n2.isObserver = false, n2.disableAlive = void 0, r3?.(), e3.emit("alive:disabled", k("alive:disabled", { taskId: t2, kind: "component", injectAt: n2.injectAt, status: n2.taskStatus, scope: n2.scope })), e3.emit("alive:observerStopped", k("alive:observerStopped", { taskId: t2, kind: "component", injectAt: n2.injectAt, status: n2.taskStatus, scope: n2.scope, observerMode: n2.mountHandle ? "mounted" : "await-target" })); } function Y(e3, t2) { let n2 = e3.taskContext.get(t2); if (!n2) { e3.logger.error(`Task ${t2} not found`); return; } let r3 = n2.taskStatus, i3 = T(n2); e3.emit("task:beforeDestroy", v("task:beforeDestroy", { taskId: t2, kind: n2.kind, injectAt: i3, status: r3 })), w(n2) && n2.alive && J(e3, t2), e3.taskContext.destroy(t2), e3.emit("task:afterDestroy", v("task:afterDestroy", { taskId: t2, kind: n2.kind, injectAt: i3, preStatus: r3 })); } function pe(e3) { for (let t2 of e3.taskContext.keys()) { let n2 = e3.taskContext.get(t2); n2 && w(n2) && n2.alive && J(e3, t2); } e3.taskContext.destroyAll(); } function X(e3, t2) { let n2 = e3.taskContext.get(t2); if (!n2) { e3.logger.error(`Task ${t2} not found`); return; } let r3 = n2.taskStatus, i3 = T(n2); e3.emit("task:beforeReset", v("task:beforeReset", { taskId: t2, kind: n2.kind, injectAt: i3, status: r3 })), w(n2) && n2.alive && J(e3, t2), e3.taskContext.reset(t2), e3.emit("task:afterReset", v("task:afterReset", { taskId: t2, kind: n2.kind, injectAt: i3, status: n2.taskStatus, preStatus: r3 })); } function me(e3) { for (let t2 of e3.taskContext.keys()) { let n2 = e3.taskContext.get(t2); n2 && w(n2) && n2.alive && J(e3, t2); } e3.taskContext.resetAll(); } var he = { alive: false, scope: "local", timeout: 5e3 }; function ge(e3 = {}) { let t2 = e3.logger ?? new o$1(), n2 = e3.observer ?? d(t2), r3 = c(n2), i3 = D(r3, t2), a3 = p(); for (let t3 of e3.adapters ?? []) a3.use(t3); let s2 = { config: { ...he, ...e3.defaults, logger: t2, observer: n2, hooks: e3.hooks }, logger: t2, emit: r3, taskContext: i3, adapterRegistry: a3, makooContext(e4, t3) { return _e(s2, e4, t3); } }; return l(n2, e3.hooks), s2; } function _e(e3, t2, n2) { return { taskId: t2, injectAt: n2, enableAlive: () => q(e3, t2), disableAlive: () => J(e3, t2), reset: () => X(e3, t2), destroy: () => Y(e3, t2), on: (t3, n3) => e3.config.observer?.on(t3, n3) ?? (() => { }), onTask: (n3, r3) => e3.config.observer?.onTask(t2, n3, r3) ?? (() => { }), off: (t3, n3) => e3.config.observer?.off(t3, n3), offTask: (n3, r3) => e3.config.observer?.offTask(t2, n3, r3), getLogger: () => e3.logger, bindListenerSignal: (n3) => G(e3, t2, n3), controlListener: (n3) => K(e3, t2, n3) }; } var ve = { "register:start": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { artifactName: e3.artifactName, listenerEvent: e3.listenerEvent, listenAt: e3.listenAt, alive: e3.alive, scope: e3.scope, timeout: e3.timeout, withEvent: e3.withEvent } }), "register:success": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: { artifactName: e3.artifactName, listenerEvent: e3.listenerEvent, listenAt: e3.listenAt, alive: e3.alive, scope: e3.scope, timeout: e3.timeout, withEvent: e3.withEvent } }), "register:duplicate": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, meta: Z(e3) }), "register:error": (e3) => ({ taskId: e3.taskId, kind: e3.kind, injectAt: e3.injectAt, status: e3.status, error: e3.error, meta: Z(e3) }) }; function Z(e3) { return e3.artifactName === void 0 ? e3.listenerEvent === void 0 ? {} : { listenerEvent: e3.listenerEvent } : { artifactName: e3.artifactName }; } function Q(e3, t2) { return m(e3, t2, ve); } var ye = new WeakMap(); function be(e3, t2, n2, r3) { let i3 = e3?.name || e3?.__name; if (i3) return i3; if (typeof e3 == "string") return e3; if (typeof e3 == "object" || typeof e3 == "function") { let r4 = e3, i4 = t2.get(r4); if (i4) return i4; let a3 = `${n2}-${H()}`; return t2.set(r4, a3), a3; } return r3; } function xe(e3) { return be(e3, ye, "artifact", "artifact-anonymous"); } function Se(e3, t2) { let { id: n2, listenAt: r3, event: i3, callback: a3, capture: o2, activitySignal: s2 } = t2, c2 = n2 ?? `listener-${r3}-${i3}`; e3.emit("register:start", Q("register:start", { taskId: c2, kind: "listener", injectAt: r3, status: "idle", listenerEvent: i3, listenAt: r3, withEvent: true })); try { if (e3.taskContext.has(c2)) return e3.logger.warn(`Listener "${c2}" is already registered, skipping`), e3.emit("register:duplicate", Q("register:duplicate", { taskId: c2, kind: "listener", injectAt: r3, status: e3.taskContext.getTaskStatus(c2) ?? "idle", listenerEvent: i3 })), { taskId: c2, isSuccess: true, isDuplicate: true }; let t3 = { taskId: c2, kind: "listener", taskStatus: "idle", timeout: e3.config.timeout, withEvent: true, listenAt: r3, event: i3, callback: a3 }; return o2 !== void 0 && (t3.capture = o2), s2 && (t3.activitySignal = s2), e3.taskContext.set(c2, t3), e3.taskContext.taskRecords.push({ taskId: c2, injectAt: r3 }), e3.logger.info(`Listener "${c2}" registered`), e3.emit("register:success", Q("register:success", { taskId: c2, kind: "listener", injectAt: r3, status: "idle", listenerEvent: i3, listenAt: r3, withEvent: true })), { taskId: c2, isSuccess: true }; } catch (t3) { return e3.emit("register:error", Q("register:error", { taskId: c2, kind: "listener", injectAt: r3, status: e3.taskContext.getTaskStatus(c2) ?? "idle", error: t3, listenerEvent: i3 })), { taskId: c2, isSuccess: false }; } } function Ce(t2, n2) { let { id: i3, injectAt: a3, artifact: o2, options: s2 } = n2, c2 = xe(o2), u2 = re(t2, { id: i3, artifactName: c2, injectAt: a3, artifact: o2 }), d2 = !!s2?.on, f = s2?.on?.type, p2 = s2?.on?.listenAt, m2 = s2?.alive ?? t2.config.alive, h2 = s2?.scope ?? t2.config.scope, g2 = s2?.timeout ?? t2.config.timeout, _2 = t2.adapterRegistry.resolve(o2); if (!_2) throw new r$1(`No adapter found for artifact: ${c2}`, [{ path: "artifact", message: c2 }], e.ADAPTER_NOT_FOUND); t2.emit("register:start", Q("register:start", { taskId: u2, kind: "component", injectAt: a3, status: "idle", artifactName: c2, listenerEvent: f, listenAt: p2, alive: m2, scope: h2, timeout: g2, withEvent: d2 })); try { if (t2.taskContext.has(u2)) return t2.logger.warn(`Task "${u2}" is already registered, skipping`), t2.emit("register:duplicate", Q("register:duplicate", { taskId: u2, kind: "component", injectAt: a3, status: t2.taskContext.getTaskStatus(u2) ?? "idle", artifactName: c2 })), { taskId: u2, isSuccess: true, isDuplicate: true }; let e3 = { taskId: u2, taskStatus: "idle", kind: "component", artifactName: c2, injectAt: a3, artifact: o2, adapter: _2, withEvent: false, alive: m2, scope: h2, timeout: g2, isObserver: false, hooks: s2?.hooks }; if (s2?.on) { let t3 = { listenAt: s2.on.listenAt, event: s2.on.type, callback: s2.on.callback }; e3.withEvent = true, s2.on.capture !== void 0 && (t3.capture = s2.on.capture), s2.on.activitySignal && (t3.activitySignal = s2.on.activitySignal), e3.listener = t3; } return t2.config.observer && s2?.hooks && l(t2.config.observer, s2.hooks, u2), t2.taskContext.set(u2, e3), t2.taskContext.taskRecords.push({ taskId: u2, injectAt: a3 }), t2.logger.info(`Task "${u2}" registered`), t2.emit("register:success", Q("register:success", { taskId: u2, kind: "component", injectAt: a3, status: "idle", artifactName: c2, listenerEvent: f, listenAt: p2, alive: m2, scope: h2, timeout: g2, withEvent: d2 })), { taskId: u2, isSuccess: true }; } catch (e3) { return t2.emit("register:error", Q("register:error", { taskId: u2, kind: "component", injectAt: a3, status: t2.taskContext.getTaskStatus(u2) ?? "idle", error: e3, artifactName: c2 })), { taskId: u2, isSuccess: false }; } } function $(e3 = {}) { let t2 = ge(e3); return { start(e4) { e4.length === 0 && U(t2, []); let n2 = Ee(t2, e4); return n2.length > 0 && U(t2, n2.map((e5) => e5.taskId)), De(t2, n2); }, reset: (e4) => X(t2, e4), destroy: (e4) => Y(t2, e4), resetAll: () => me(t2), destroyAll: () => pe(t2), enableAlive: (e4) => q(t2, e4), disableAlive: (e4) => J(t2, e4), on: (e4, n2) => t2.config.observer?.on(e4, n2) ?? (() => { }), onTask: (e4, n2, r3) => t2.config.observer?.onTask(e4, n2, r3) ?? (() => { }), onAny: (e4) => t2.config.observer?.onAny(e4) ?? (() => { }), off: (e4, n2) => t2.config.observer?.off(e4, n2), offTask: (e4, n2, r3) => t2.config.observer?.offTask(e4, n2, r3), offAny: (e4) => t2.config.observer?.offAny(e4), getLogger: () => t2.logger }; } function we(e3) { return { kind: "component", ...e3.id ? { id: e3.id } : {}, injectAt: e3.injectAt, artifact: e3.artifact, ...e3.options ? { options: e3.options } : {} }; } function Te(e3) { return { kind: "listener", ...e3.id ? { id: e3.id } : {}, listenAt: e3.listenAt, event: e3.type, type: e3.type, callback: e3.callback, ...e3.capture === void 0 ? {} : { capture: e3.capture }, ...e3.activitySignal ? { activitySignal: e3.activitySignal } : {} }; } function Ee(e3, t2) { let n2 = []; for (let r3 of t2) { if (r3.kind === "component") { let t4 = Ce(e3, { ...r3.id ? { id: r3.id } : {}, injectAt: r3.injectAt, artifact: r3.artifact, ...r3.options ? { options: r3.options } : {} }); t4.isSuccess && !t4.isDuplicate && n2.push(Oe(e3, t4.taskId)); continue; } let t3 = Se(e3, r3); t3.isSuccess && !t3.isDuplicate && n2.push(ke(e3, t3.taskId)); } return n2; } function De(e3, t2) { let n2 = new Map(t2.map((e4) => [e4.taskId, e4])); return { tasks: t2, get(t3) { return e3.taskContext.has(t3) ? n2.get(t3) : void 0; }, resetAll() { for (let n3 of t2) e3.taskContext.has(n3.taskId) && X(e3, n3.taskId); }, destroyAll() { for (let n3 of t2) e3.taskContext.has(n3.taskId) && Y(e3, n3.taskId); } }; } function Oe(e3, t2) { return { kind: "component", taskId: t2, enableAlive: () => q(e3, t2), disableAlive: () => J(e3, t2), reset: () => X(e3, t2), destroy: () => Y(e3, t2) }; } function ke(e3, t2) { return { kind: "listener", taskId: t2, open: () => K(e3, t2, I.OPEN), close: () => K(e3, t2, I.CLOSE), destroy: () => Y(e3, t2) }; } let bootstrapped = false; function bootstrapSetPointerEvents() { if (bootstrapped) return; bootstrapped = true; P.onDomReady( "div.web-player-danmaku", (containerEL) => { containerEL.style.pointerEvents = "auto"; }, document, { once: false } ); } let runtimeStorage = null; function configureRuntimeStorage(storage) { runtimeStorage = storage; } function getRuntimeStorageValue(key, defaultValue) { if (!runtimeStorage) { throw new Error("Runtime storage is not initialized"); } return runtimeStorage.get(key, defaultValue); } function setRuntimeStorageValue(key, value) { if (!runtimeStorage) { throw new Error("Runtime storage is not initialized"); } runtimeStorage.set(key, value); } const cssLoader = (e3) => _GM_addStyle(_GM_getResourceText(e3)); cssLoader("element-plus/dist/index.css"); var r2 = class extends r$1 { constructor(e$1, n2, r3, i3) { super(e$1, n2, r3 ?? e.ADAPTER_MOUNT_FAIL, i3), this.name = "VueAdapterError"; } }; function i2(e3) { return (typeof e3 == "object" && !!e3 || typeof e3 == "function") && ("setup" in e3 || "render" in e3 || "template" in e3 || "__vccOpts" in e3 || "__asyncLoader" in e3); } var a2 = new class { plugins = []; getPlugins() { return [...this.plugins]; } use(e3) { this.plugins.includes(e3) || this.plugins.push(e3); } usePlugins(...e3) { for (let t2 of e3) this.use(t2); } clear() { this.plugins = []; } }(); function o() { return { name: "vue", matches: i2, mount({ mountPoint: e$1, artifact: i3, makoo: o2 }) { try { let t2 = vue.createApp(i3, { makoo: o2 }), r3 = a2.getPlugins(); for (let e3 of r3) t2.use(e3); return { handle: t2, instance: t2.mount(e$1) }; } catch (n2) { throw new r2(`Failed to mount Vue component at "${e$1}"`, [{ path: "(mount)", message: n2 instanceof Error ? n2.message : String(n2) }], e.ADAPTER_MOUNT_FAIL, n2 instanceof Error ? n2 : void 0); } }, unmount({ handle: e$1 }) { try { e$1.unmount(); } catch (e$12) { throw new r2("Failed to unmount Vue component", [{ path: "(unmount)", message: e$12 instanceof Error ? e$12.message : String(e$12) }], e.ADAPTER_UNMOUNT_FAIL, e$12 instanceof Error ? e$12 : void 0); } } }; } const pinia = pinia$1.createPinia(); const elementPlusIconsPlugin = { install(app) { for (const [name, component] of Object.entries(ElementPlusIconsVue__namespace)) { app.component(name, component); } } }; a2.usePlugins(ElementPlus, elementPlusIconsPlugin, pinia); configureRuntimeStorage(L$1); bootstrapSetPointerEvents(); function t(e3) { return e3; } const PLAYER_DANMAKU_LAYER_SELECTOR = "div.web-player-danmaku"; const PLAYER_DANMAKU_ITEM_SELECTOR = ".bili-danmaku-x-dm"; const FREEZE_LAYER_ID = "bili-livedt-freeze-layer"; const FROZEN_ITEM_CLASS = "bili-livedt-frozen-item"; const FALLBACK_ROLL_SPEED_PX_PER_SECOND = 100; const POINTER_LEAVE_RESUME_DELAY_MS = 500; const SOURCE_POSITION_CHANGED_DATA_KEY = "freezeSourcePositionChanged"; const SOURCE_POSITION_DATA_KEY = "freezeSourcePosition"; const freezeLayerSources = new WeakMap(); function createFreezeLayer(sourceLayer) { const existing = sourceLayer.querySelector(`#${FREEZE_LAYER_ID}`); if (existing) return existing; const layer = document.createElement("div"); layer.id = FREEZE_LAYER_ID; layer.style.position = "absolute"; layer.style.inset = "0"; layer.style.overflow = "hidden"; layer.style.pointerEvents = "none"; layer.style.zIndex = "2147483647"; const sourceLayerStyle = getComputedStyle(sourceLayer); if (sourceLayerStyle.position === "static") { layer.dataset[SOURCE_POSITION_CHANGED_DATA_KEY] = "true"; layer.dataset[SOURCE_POSITION_DATA_KEY] = sourceLayer.style.position; sourceLayer.style.position = "relative"; } sourceLayer.append(layer); freezeLayerSources.set(layer, sourceLayer); return layer; } function removeFreezeLayer(layer) { const sourceLayer = freezeLayerSources.get(layer) ?? layer.parentElement; if (sourceLayer instanceof HTMLElement && layer.dataset[SOURCE_POSITION_CHANGED_DATA_KEY] === "true" && sourceLayer.style.position === "relative") { const originalPosition = layer.dataset[SOURCE_POSITION_DATA_KEY] ?? ""; if (originalPosition) { sourceLayer.style.position = originalPosition; } else { sourceLayer.style.removeProperty("position"); } } freezeLayerSources.delete(layer); layer.remove(); } function setImportantStyle(element, property, value) { element.style.setProperty(property, value, "important"); } function parseCssTimeToMs(value) { const durations = value.split(",").map((part) => part.trim()).map((time) => { const amount = Number.parseFloat(time); if (!Number.isFinite(amount)) return 0; if (time.endsWith("ms")) return amount; if (time.endsWith("s")) return amount * 1e3; return 0; }); const duration = Math.max(...durations); return duration > 0 ? duration : null; } function getElementOffsetInsideContainer(element, container) { const elementRect = element.getBoundingClientRect(); const containerRect = container.getBoundingClientRect(); return { left: elementRect.left - containerRect.left, top: elementRect.top - containerRect.top }; } function isPointInsideElement(clientX, clientY, element) { const rect = element.getBoundingClientRect(); return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom; } const HIDDEN_STYLE_PROPERTIES = ["display", "opacity", "visibility", "pointer-events"]; const sourceStyleSnapshots = new Map(); function hideSourceDanmaku(source) { if (!sourceStyleSnapshots.has(source)) { const snapshot = Object.fromEntries( HIDDEN_STYLE_PROPERTIES.map((property) => [ property, { value: source.style.getPropertyValue(property), priority: source.style.getPropertyPriority(property) } ]) ); sourceStyleSnapshots.set(source, snapshot); } setImportantStyle(source, "display", "none"); setImportantStyle(source, "opacity", "0"); setImportantStyle(source, "visibility", "hidden"); setImportantStyle(source, "pointer-events", "none"); } function restoreSourceDanmaku(source) { const snapshot = sourceStyleSnapshots.get(source); if (!snapshot) return; for (const property of HIDDEN_STYLE_PROPERTIES) { const { value, priority } = snapshot[property]; if (value) { source.style.setProperty(property, value, priority); } else { source.style.removeProperty(property); } } sourceStyleSnapshots.delete(source); } function restoreAllSourceDanmakus() { for (const source of [...sourceStyleSnapshots.keys()]) { restoreSourceDanmaku(source); } } function restoreRemovedSourceDanmakus(node) { if (node instanceof HTMLElement) restoreSourceDanmaku(node); if (!(node instanceof Element)) return; node.querySelectorAll("*").forEach(restoreSourceDanmaku); } const freezeBus = mitt(); let actionId = 0; function getActionId(clone) { if (clone.dataset.frozenDanmakuId) return clone.dataset.frozenDanmakuId; actionId += 1; const id = `frozen-danmaku-${actionId}`; clone.dataset.frozenDanmakuId = id; return id; } function showDanmakuActions(clone) { const rect = clone.getBoundingClientRect(); const id = getActionId(clone); freezeBus.emit("show", { id, content: clone.dataset.frozenDanmakuText ?? clone.textContent?.trim() ?? "", rect: { left: rect.left, top: rect.top, width: rect.width, height: rect.height } }); } function hideAction(clone) { const id = clone.dataset.frozenDanmakuId; if (!id) return; freezeBus.emit("hide", id); } const frozenDanmakuStates = new WeakMap(); function clearLeaveTimer(state) { if (state.leaveTimer === void 0) return; clearTimeout(state.leaveTimer); state.leaveTimer = void 0; } function clearFrozenPointerState(clone) { const state = frozenDanmakuStates.get(clone); if (!state) return; clearLeaveTimer(state); state.offHover?.(); state.offHover = void 0; frozenDanmakuStates.delete(clone); } function getFrozenDanmakuState(source, clone) { const existing = frozenDanmakuStates.get(clone); if (existing) return existing; const state = { pointerBound: false, hovered: false, source }; frozenDanmakuStates.set(clone, state); return state; } function getFrozenDanmakuSource(clone) { return frozenDanmakuStates.get(clone)?.source ?? null; } const frozenMotionStates = new WeakMap(); function getFrozenMotionState(clone) { const existing = frozenMotionStates.get(clone); if (existing) return existing; const state = { runId: 0 }; frozenMotionStates.set(clone, state); return state; } function clearFrozenCleanupTimer(state) { if (state.cleanupTimer !== void 0) { window.clearTimeout(state.cleanupTimer); state.cleanupTimer = void 0; } } function clearFrozenTransitionListener(clone, state) { if (!state.transitionHandler) return; clone.removeEventListener("transitionend", state.transitionHandler); state.transitionHandler = void 0; } function clearFrozenMotionState(clone) { const state = frozenMotionStates.get(clone); if (!state) return; state.runId += 1; clearFrozenCleanupTimer(state); clearFrozenTransitionListener(clone, state); frozenMotionStates.delete(clone); } function removeFrozenDanmaku(clone) { hideAction(clone); clearFrozenMotionState(clone); clearFrozenPointerState(clone); const freezeLayer = clone.closest(`#${FREEZE_LAYER_ID}`); clone.remove(); if (freezeLayer && !freezeLayer.querySelector(`.${FROZEN_ITEM_CLASS}`)) { removeFreezeLayer(freezeLayer); } } function clearFrozenDanmakus(sourceLayer) { const freezeLayer = sourceLayer.querySelector(`#${FREEZE_LAYER_ID}`); if (!freezeLayer) return; freezeLayer.querySelectorAll(`.${FROZEN_ITEM_CLASS}`).forEach(removeFrozenDanmaku); if (freezeLayer.isConnected) removeFreezeLayer(freezeLayer); } function clearAllFrozenDanmakus() { document.querySelectorAll(PLAYER_DANMAKU_LAYER_SELECTOR).forEach(clearFrozenDanmakus); restoreAllSourceDanmakus(); } function cleanupRemovedFrozenDanmakus(node) { restoreRemovedSourceDanmakus(node); if (!(node instanceof Element)) return; if (node instanceof HTMLElement && node.classList.contains(FROZEN_ITEM_CLASS)) { removeFrozenDanmaku(node); } node.querySelectorAll(`.${FROZEN_ITEM_CLASS}`).forEach(removeFrozenDanmaku); } function copyComputedTextStyle(source, target) { const style = getComputedStyle(source); target.style.alignItems = style.alignItems; target.style.backgroundColor = style.backgroundColor; target.style.borderRadius = style.borderRadius; target.style.color = style.color; target.style.display = style.display === "none" ? "flex" : style.display; target.style.fontFamily = style.fontFamily; target.style.fontSize = style.fontSize; target.style.fontWeight = style.fontWeight; target.style.lineHeight = style.lineHeight; target.style.opacity = style.opacity === "0" ? "1" : style.opacity; target.style.overflow = style.overflow; target.style.textShadow = style.textShadow; target.style.whiteSpace = style.whiteSpace; target.style.zIndex = style.zIndex === "auto" ? "200" : style.zIndex; } function frozenDanmaku(sourceLayer, source) { const freezeLayer = createFreezeLayer(sourceLayer); const sourceRect = source.getBoundingClientRect(); const sourceOffset = getElementOffsetInsideContainer(source, sourceLayer); const clone = source.cloneNode(true); clone.classList.remove( "bili-danmaku-x-roll", "bili-danmaku-x-show", "bili-danmaku-x-disable", "bili-danmaku-x-paused" ); clone.classList.add(FROZEN_ITEM_CLASS); clone.dataset.frozenDanmakuText = source.textContent.trim() ?? ""; clone.style.cssText = ""; clone.style.position = "absolute"; clone.style.left = `${Math.round(sourceOffset.left)}px`; clone.style.top = `${Math.round(sourceOffset.top)}px`; clone.style.width = `${Math.round(sourceRect.width)}px`; clone.style.height = `${Math.round(sourceRect.height)}px`; clone.style.pointerEvents = "auto"; clone.style.cursor = "pointer"; clone.style.userSelect = "none"; copyComputedTextStyle(source, clone); setImportantStyle(clone, "animation", "none"); setImportantStyle(clone, "-webkit-animation", "none"); setImportantStyle(clone, "animation-play-state", "paused"); setImportantStyle(clone, "-webkit-animation-play-state", "paused"); setImportantStyle(clone, "transform", "none"); setImportantStyle(clone, "transition", "none"); freezeLayer.append(clone); return clone; } function findDanmakuItem(target) { if (!(target instanceof Element)) return null; return target.closest(PLAYER_DANMAKU_ITEM_SELECTOR); } function findFrozenDanmakuItem(target) { if (!(target instanceof Element)) return null; return target.closest(`.${FROZEN_ITEM_CLASS}`); } function pauseFrozenDanmaku(sourceLayer, clone) { const state = getFrozenMotionState(clone); state.runId += 1; clearFrozenCleanupTimer(state); clearFrozenTransitionListener(clone, state); const { left: currentLeft } = getElementOffsetInsideContainer(clone, sourceLayer); clone.style.removeProperty("transform"); clone.style.removeProperty("-webkit-transform"); setImportantStyle(clone, "transition", "none"); setImportantStyle(clone, "-webkit-transition", "none"); setImportantStyle(clone, "left", `${Math.round(currentLeft)}px`); } function getSourceRollDurationMs(source) { const duration = parseCssTimeToMs(getComputedStyle(source).animationDuration); if (!duration || duration <= 0) return null; return duration; } function getResumeDurationMs(source, remainingDistance, fullDistance) { const sourceDuration = getSourceRollDurationMs(source); if (sourceDuration && fullDistance > 0) { return Math.max(300, Math.round(sourceDuration * (remainingDistance / fullDistance))); } return Math.max( 300, Math.round(remainingDistance / FALLBACK_ROLL_SPEED_PX_PER_SECOND * 1e3) ); } function resumeFrozenDanmaku(sourceLayer, source, clone) { const state = getFrozenMotionState(clone); state.runId += 1; clearFrozenCleanupTimer(state); clearFrozenTransitionListener(clone, state); const runId = state.runId; const layerRect = sourceLayer.getBoundingClientRect(); const cloneRect = clone.getBoundingClientRect(); const { left: currentLeft } = getElementOffsetInsideContainer(clone, sourceLayer); const itemWidth = cloneRect.width; const remainingDistance = Math.max(0, currentLeft + itemWidth); const fullDistance = Math.max(1, layerRect.width + itemWidth); const duration = getResumeDurationMs(source, remainingDistance, fullDistance); if (!clone.isConnected) return; hideAction(clone); clone.style.removeProperty("transform"); clone.style.removeProperty("-webkit-transform"); clone.style.removeProperty("transition"); clone.style.removeProperty("-webkit-transition"); setImportantStyle(clone, "left", `${Math.round(currentLeft)}px`); state.cleanupTimer = window.setTimeout(() => { if (state.runId === runId) removeFrozenDanmaku(clone); }, duration + 100); const handleTransitionEnd = (event) => { if (event.target !== clone || event.propertyName !== "left") return; clone.removeEventListener("transitionend", handleTransitionEnd); if (state.transitionHandler === handleTransitionEnd) { state.transitionHandler = void 0; } if (state.runId !== runId) return; clearFrozenCleanupTimer(state); removeFrozenDanmaku(clone); }; state.transitionHandler = handleTransitionEnd; clone.addEventListener("transitionend", handleTransitionEnd); window.requestAnimationFrame(() => { if (state.runId !== runId || !clone.isConnected) return; setImportantStyle(clone, "transition", `left ${duration}ms linear`); setImportantStyle(clone, "left", `${Math.floor(-itemWidth)}px`); }); } function scheduleResumeAction(sourceLayer, clone, state) { clearLeaveTimer(state); state.leaveTimer = window.setTimeout(() => { state.leaveTimer = void 0; if (state.hovered || !clone.isConnected) return; resumeFrozenDanmaku(sourceLayer, state.source, clone); }, POINTER_LEAVE_RESUME_DELAY_MS); } function freezeRoll(sourceLayer, clone, state) { state.hovered = true; clearLeaveTimer(state); pauseFrozenDanmaku(sourceLayer, clone); } function resumeRoll(sourceLayer, clone, state) { state.hovered = false; scheduleResumeAction(sourceLayer, clone, state); } function bindFrozenDanmakuControl(sourceLayer, clone, state) { if (state.pointerBound) return; clone.addEventListener("mouseenter", () => { freezeRoll(sourceLayer, clone, state); }); clone.addEventListener("mouseleave", () => { resumeRoll(sourceLayer, clone, state); }); const onHover = ({ id, hovered }) => { if (clone.dataset.frozenDanmakuId !== id) return; if (hovered) { freezeRoll(sourceLayer, clone, state); return; } resumeRoll(sourceLayer, clone, state); }; freezeBus.on("hover", onHover); state.offHover = () => freezeBus.off("hover", onHover); state.pointerBound = true; } function holdFrozenDanmaku({ sourceLayer, source, clone, event }) { const state = getFrozenDanmakuState(source, clone); pauseFrozenDanmaku(sourceLayer, clone); clearLeaveTimer(state); state.hovered = isPointInsideElement(event.clientX, event.clientY, clone); bindFrozenDanmakuControl(sourceLayer, clone, state); if (!state.hovered) { scheduleResumeAction(sourceLayer, clone, state); } } function handleDanmakuFreezeClick(playerDanmakuLayer, event) { if (event.type !== "click" || event.button !== 0) return; const frozenItem = findFrozenDanmakuItem(event.target); if (frozenItem) { event.preventDefault(); holdFrozenDanmaku({ sourceLayer: playerDanmakuLayer, source: getFrozenDanmakuSource(frozenItem) ?? frozenItem, clone: frozenItem, event }); showDanmakuActions(frozenItem); return; } const sourceItem = findDanmakuItem(event.target); if (!sourceItem || sourceItem.closest(`#${FREEZE_LAYER_ID}`)) return; const sourceRect = sourceItem.getBoundingClientRect(); if (sourceRect.width === 0 || sourceRect.height === 0) return; event.preventDefault(); const frozenClone = frozenDanmaku(playerDanmakuLayer, sourceItem); holdFrozenDanmaku({ sourceLayer: playerDanmakuLayer, source: sourceItem, clone: frozenClone, event }); showDanmakuActions(frozenClone); hideSourceDanmaku(sourceItem); } function refGM(key, defaultValue) { const data = vue.ref(getRuntimeStorageValue(key, defaultValue)); vue.watch( data, (newVal) => { setRuntimeStorageValue(key, newVal); }, { deep: true } ); return data; } const useConfigStore = pinia$1.defineStore("config", () => { const isInjectPlusOneComponent = refGM("isInjectPlusOneComponent", false); const isFreezeDanmakuOnClick = refGM("isFreezeDanmakuOnClick", false); return { isInjectPlusOneComponent, isFreezeDanmakuOnClick }; }); function observeFrozenDanmakuRemoval() { const observer = new MutationObserver((records) => { for (const record of records) { record.removedNodes.forEach(cleanupRemovedFrozenDanmakus); } }); observer.observe(document.documentElement, { childList: true, subtree: true }); return observer; } function onDanmakuFreezeClick(event) { if (!(event instanceof MouseEvent) || !(event.target instanceof Element)) return; const playerDanmakuLayer = event.target.closest(PLAYER_DANMAKU_LAYER_SELECTOR); if (!playerDanmakuLayer) return; handleDanmakuFreezeClick(playerDanmakuLayer, event); } function freezeSignal() { const { isFreezeDanmakuOnClick } = pinia$1.storeToRefs(useConfigStore(pinia)); return { get: () => isFreezeDanmakuOnClick.value, subscribe(listener) { let removalObserver = isFreezeDanmakuOnClick.value ? observeFrozenDanmakuRemoval() : null; const stopActivitySubscription = vue.watch(isFreezeDanmakuOnClick, (enabled) => { listener(enabled); if (enabled) { removalObserver ??= observeFrozenDanmakuRemoval(); return; } removalObserver?.disconnect(); removalObserver = null; clearAllFrozenDanmakus(); }); return () => { stopActivitySubscription(); removalObserver?.disconnect(); clearAllFrozenDanmakus(); }; } }; } function onDanmakuMenuClick(e3) { if (!(e3 instanceof MouseEvent)) return; if (!(e3.target instanceof HTMLElement)) return; const clickedElement = e3.target; const danmakuContent = clickedElement.innerText; setRuntimeStorageValue("currentDanmakuContent", danmakuContent); } const CHAT_ITEMS_SELECTOR = "#chat-items"; function onChatItemsClick(event) { const chatItems = document.querySelector(CHAT_ITEMS_SELECTOR); const target = event.target; if (!(target instanceof Node) || !chatItems?.contains(target)) return; onDanmakuMenuClick(event); } function menuSignal() { const { isInjectPlusOneComponent } = pinia$1.storeToRefs(useConfigStore(pinia)); return { get: () => isInjectPlusOneComponent.value, subscribe: (listener) => vue.watch(isInjectPlusOneComponent, listener) }; } const Manifest_0 = t({ injectionDefaults: { alive: false, scope: "local", timeout: 5e3 }, injections: { "main-panel": { injectAt: "body", component: "./mainPanel/app.vue", framework: "Vue", alive: false }, "danmaku-plus-one": { injectAt: "div.danmaku-menu>.none-select", component: "./danmakuPlusOne/app.vue", framework: "Vue", alive: true, scope: "global" }, "danmaku-actions": { injectAt: "body", component: "./danmakuActions/app.vue", framework: "Vue", alive: false } }, listeners: { "danmaku-freeze-click": { listenAt: "body", type: "click", callback: onDanmakuFreezeClick, capture: true, activitySignal: freezeSignal }, "danmaku-menu-click": { listenAt: "body", type: "click", callback: onChatItemsClick, capture: true, activitySignal: menuSignal } } }); function getSESSDATA() { const SESSDATA2 = document.cookie.match(/SESSDATA=([^;]+)/); return SESSDATA2 ? SESSDATA2[1] : ""; } const mixinKeyEncTab = [ 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11, 36, 20, 34, 44, 52 ]; const getMixinKey = (orig) => mixinKeyEncTab.map((n2) => orig[n2]).join("").slice(0, 32); const SESSDATA = getSESSDATA(); function encWbi(params, img_key, sub_key) { const mixin_key = getMixinKey(img_key + sub_key); const wts = Math.round(Date.now() / 1e3); const chr_filter = /[!'()*]/g; const t_param = { ...params, wts }; const query = Object.keys(t_param).sort().map((key) => { const value = t_param[key].toString().replace(chr_filter, ""); return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`; }).join("&"); return { wts, w_rid: cryptoJs.MD5(query + mixin_key).toString() }; } async function getWbiKey() { const res = await fetch("https://api.bilibili.com/x/web-interface/nav", { headers: { Cookie: `SESSDATA=${SESSDATA}`, "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3", Referer: "https://www.bilibili.com/" } }); const { data: { wbi_img: { img_url, sub_url } } } = await res.json(); return { img_key: img_url.slice(img_url.lastIndexOf("/") + 1, img_url.lastIndexOf(".")), sub_key: sub_url.slice(sub_url.lastIndexOf("/") + 1, sub_url.lastIndexOf(".")) }; } async function setWbiSign(params) { const { img_key, sub_key } = await getWbiKey(); return encWbi(params, img_key, sub_key); } async function sendDanmaku({ content, roomId, csrf }) { if (roomId === "") { throw new Error("未找到直播间ID"); } if (csrf === "") { throw new Error("未找到CSRF Token"); } const paramsData = { roomid: roomId, room_type: "0", bubble: "0", jumpform: "0", msg: content, fontsize: "25", color: "16777215", mode: "1", rnd: Date.now().toString(), reply_mid: "0", reply_attr: "0", reply_dmid: "0", reply_type: "0", reply_name: "", statistics: '{"appId":100,"platform":5}', csrf, csrf_token: csrf }; const { wts, w_rid } = await setWbiSign(paramsData); const params = new URLSearchParams(paramsData); try { const resp = await fetch( `https://api.live.bilibili.com/msg/send?w_rid=${w_rid}&wts=${wts}`, { method: "POST", credentials: "include", headers: { "Content-Type": "application/x-www-form-urlencoded", Referer: `https://live.bilibili.com/${roomId}` }, body: params } ); if (!resp.ok) { throw new Error(`HTTP error! status: ${resp.status}`); } const data = await resp.json(); if (data.code === 0) { console.log("✅ 直播弹幕发送成功"); } else { throw new Error(data.message || data.msg || "发送失败"); } } catch (err) { console.error("弹幕发送失败:", err); throw err; } } function formatLocalDate(date) { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, "0"); const day = String(date.getDate()).padStart(2, "0"); return `${year}-${month}-${day}`; } const useDanmakuLibraryStore = pinia$1.defineStore("danmaku-library", () => { const initialDataList = []; const danmakuList = refGM("danmakuList", initialDataList); const currentDanmaku = refGM("currentDanmaku", ""); const danmakuMenuOptions = vue.computed( () => danmakuList.value.map((item) => ({ id: item.id, value: item.content, label: item.content })) ); function hasDanmaku(content) { const value = content.trim(); if (!value) return false; return danmakuList.value.some((danmaku) => danmaku.content.trim() === value); } function addDanmaku(content) { const value = content.trim(); if (!value) return "empty"; if (hasDanmaku(value)) return "exists"; danmakuList.value = [ ...danmakuList.value, { id: `dm_${globalThis.crypto.randomUUID()}`, date: formatLocalDate( new Date()), content: value } ]; return "added"; } function removeDanmaku(id) { const target = danmakuList.value.find((danmaku) => danmaku.id === id); if (!target) return false; danmakuList.value = danmakuList.value.filter((danmaku) => danmaku.id !== id); if (currentDanmaku.value === target.content) currentDanmaku.value = ""; return true; } function restoreInitialDanmaku() { danmakuList.value = initialDataList.map((danmaku) => ({ ...danmaku })); currentDanmaku.value = ""; } function setCurrentDanmaku(danmaku) { currentDanmaku.value = danmaku; } return { currentDanmaku, danmakuList, danmakuMenuOptions, hasDanmaku, addDanmaku, removeDanmaku, restoreInitialDanmaku, setCurrentDanmaku }; }); function getBiliJCT() { const match = document.cookie.match(/bili_jct=([^;]+)/); return match ? match[1] : ""; } async function getLongRoomId() { const neptuneRoomId = _unsafeWindow.__NEPTUNE_IS_MY_WAIFU__?.roomInitRes?.data?.room_id; if (neptuneRoomId) { return String(neptuneRoomId); } const url = _unsafeWindow.location.href; const shortRoomId = url.match(/live\.bilibili\.com\/(\d+)/); if (shortRoomId?.[1]) { const response = await fetch( `https://api.live.bilibili.com/room/v1/Room/get_info?room_id=${shortRoomId[1]}` ); if (response.ok) { const data = await response.json(); return data.data?.room_id ? String(data.data.room_id) : null; } } return null; } const useLiverStore = pinia$1.defineStore("Liver", () => { const csrf = vue.ref(getBiliJCT()); const roomId = vue.ref(null); let roomContextPromise = null; async function roomContext() { csrf.value = getBiliJCT(); if (!roomContextPromise) { roomContextPromise = getLongRoomId().then((nextRoomId) => { roomId.value = nextRoomId; }).finally(() => { roomContextPromise = null; }); } await roomContextPromise; } return { csrf, roomId, roomContext }; }); const _hoisted_1$a = ["disabled"]; const _hoisted_2$4 = ["disabled", "aria-label"]; const CAPSULE_WIDTH = 88; const CAPSULE_OFFSET = 8; const POPPER_Z_INDEX = 2147483647; const _sfc_main$d = vue.defineComponent({ ...{ name: "DanmakuActions" }, __name: "app", setup(__props) { const liverStore = useLiverStore(); const danmakuLibraryStore = useDanmakuLibraryStore(); const { csrf, roomId } = pinia$1.storeToRefs(liverStore); const isVisible = vue.ref(false); const isSending = vue.ref(false); const hovered = vue.ref(false); const popoverRef = vue.ref(null); const action = vue.reactive({ id: "", content: "", rect: { left: 0, top: 0, width: 0, height: 0 } }); const isFavorite = vue.computed(() => danmakuLibraryStore.hasDanmaku(action.content)); const virtualReference = { getBoundingClientRect: () => new DOMRect( action.rect.left, action.rect.top, action.rect.width, action.rect.height ) }; function updatePopoverPosition() { requestAnimationFrame(() => { popoverRef.value?.popperRef?.popperInstanceRef?.update?.(); }); } function setHover(value) { if (!action.id || hovered.value === value) return; hovered.value = value; freezeBus.emit("hover", { id: action.id, hovered: value }); } function showDanmakuActions2(data) { if (hovered.value && action.id !== data.id) { setHover(false); } action.id = data.id; action.content = data.content; action.rect.left = data.rect.left; action.rect.top = data.rect.top; action.rect.width = data.rect.width; action.rect.height = data.rect.height; isVisible.value = data.content !== ""; updatePopoverPosition(); } function hideAction2(id) { if (id && id !== action.id) return; setHover(false); isVisible.value = false; action.id = ""; action.content = ""; } function handlePopoverVisibleUpdate(visible) { if (!visible) hideAction2(); } function hideOnOutsidePointerDown(event) { if (!isVisible.value) return; if (event.target instanceof Element && event.target.closest(".danmaku-actions")) return; hideAction2(); } async function handlePlusOneClick() { if (!action.content || isSending.value) return; const content = action.content; isSending.value = true; try { await liverStore.roomContext(); if (roomId.value === null) throw new Error("未找到直播间ID"); await sendDanmaku({ content, roomId: roomId.value, csrf: csrf.value }); } catch (err) { console.error("冻结弹幕 +1 发送失败:", err); } finally { isSending.value = false; } } function handleFavoriteClick() { const id = action.id; const content = action.content; if (!id || !content) return; const result = danmakuLibraryStore.addDanmaku(content); if (result === "empty") { ElementPlus.ElMessage.warning("弹幕内容为空,无法收藏"); return; } ElementPlus.ElMessage({ message: result === "added" ? "已加入收藏" : "这条弹幕已收藏", type: result === "added" ? "success" : "info" }); if (!hovered.value) { freezeBus.emit("hover", { id, hovered: false }); } hideAction2(id); } vue.onMounted(() => { freezeBus.on("show", showDanmakuActions2); freezeBus.on("hide", hideAction2); document.addEventListener("pointerdown", hideOnOutsidePointerDown); }); vue.onBeforeUnmount(() => { setHover(false); freezeBus.off("show", showDanmakuActions2); freezeBus.off("hide", hideAction2); document.removeEventListener("pointerdown", hideOnOutsidePointerDown); }); return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElPopover), { ref_key: "popoverRef", ref: popoverRef, visible: isVisible.value, "virtual-ref": virtualReference, width: CAPSULE_WIDTH, offset: CAPSULE_OFFSET, "z-index": POPPER_Z_INDEX, "show-arrow": true, teleported: false, "virtual-triggering": "", trigger: "click", placement: "top", "popper-class": "danmaku-actions-popper", "onUpdate:visible": handlePopoverVisibleUpdate }, { default: vue.withCtx(() => [ vue.createElementVNode("div", { class: "danmaku-actions", role: "toolbar", "aria-label": "冻结弹幕操作", onMouseenter: _cache[0] || (_cache[0] = ($event) => setHover(true)), onMouseleave: _cache[1] || (_cache[1] = ($event) => setHover(false)) }, [ vue.createElementVNode("button", { class: "action-segment", type: "button", disabled: isSending.value, "aria-label": "发送相同弹幕", onClick: handlePlusOneClick }, " +1 ", 8, _hoisted_1$a), vue.createElementVNode("button", { class: "action-segment", type: "button", disabled: !action.content || isFavorite.value, "aria-label": isFavorite.value ? "弹幕已收藏" : "收藏弹幕", onClick: handleFavoriteClick }, vue.toDisplayString(isFavorite.value ? "已收藏" : "收藏"), 9, _hoisted_2$4) ], 32) ]), _: 1 }, 8, ["visible"]); }; } }); const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; const Injection_danmaku_actions = _export_sfc(_sfc_main$d, [["__scopeId", "data-v-fdd417c4"]]); const _sfc_main$c = vue.defineComponent({ __name: "app", setup(__props) { const configStore = useConfigStore(); const liverStore = useLiverStore(); const { isInjectPlusOneComponent } = pinia$1.storeToRefs(configStore); const { csrf, roomId } = pinia$1.storeToRefs(liverStore); const handlePlusOneClick = async () => { const content = L$1.get("currentDanmakuContent", ""); try { await liverStore.roomContext(); if (roomId.value === null) throw new Error("未找到直播间ID"); await sendDanmaku({ content, roomId: roomId.value, csrf: csrf.value }); } catch (err) { console.error("弹幕 +1 发送失败:", err); } }; return (_ctx, _cache) => { return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { class: "danmaku-plus-one-button", onClick: handlePlusOneClick }, [..._cache[0] || (_cache[0] = [ vue.createElementVNode("a", { class: "danmaku-plus-one-content" }, "+1", -1) ])], 512)), [ [vue.vShow, vue.unref(isInjectPlusOneComponent)] ]); }; } }); const Injection_danmaku_plus_one = _export_sfc(_sfc_main$c, [["__scopeId", "data-v-08354053"]]); const useDanmakuBatchSendStore = pinia$1.defineStore("danmaku-batch-send", () => { const batchSendStatus = vue.reactive({ isStarting: false, isRunning: false, isPaused: false }); const batchSendInterval = refGM("danmakuInterval", 5); const batchSendTotalCount = refGM("danmakuSendCount", 1); const batchSendRemainingCount = vue.ref(1); const batchSendControl = vue.ref(null); const batchSendErrorMessages = vue.ref([]); function resetBatchSendProgress(totalCount) { batchSendRemainingCount.value = totalCount; batchSendErrorMessages.value = []; } return { batchSendStatus, batchSendInterval, batchSendTotalCount, batchSendRemainingCount, batchSendControl, batchSendErrorMessages, resetBatchSendProgress }; }); const capsuleIconUrl = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1781138685903'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='2022'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M665.941175%20382.461671h-42.821442l39.104396-53.296312c12.306634-16.410467%208.838931-39.848778-8.048329-54.574655-6.381983-4.763074-13.991225-7.278405-22.011579-7.278404-12.107159%200-24.041602%205.715445-32.758902%2015.684329l-72.029933%2098.003036h-19.180007l-111.941959-69.6338a45.13%2045.13%200%200%200-7.294216-3.078483l-3.0797-0.864797a40.658841%2040.658841%200%200%200-8.298889-1.128737l-4.681581%200.147174a38.426911%2038.426911%200%200%200-5.01485%200.7979c-10.4846%202.208821-19.272447%208.307404-23.545346%2016.322892l-0.128929%200.214071c-8.185772%2012.148513-7.657894%2022.612436-6.059661%2031.244595%201.626208%208.664999%206.783366%2016.654945%2014.913188%2023.103826l4.882272%203.872734-6.214133%200.458549c-40.009331%202.960501-71.26244%2036.703398-71.151756%2076.822198v193.904287c0%2042.36046%2034.462954%2076.823414%2076.823414%2076.823414h308.539159c42.359244%200%2076.822198-34.462954%2076.822197-76.823414V459.283868c-0.001216-42.36046-34.46417-76.822198-76.823414-76.822197z%20m44.838086%20270.720403c0%2024.560966-19.983988%2044.544955-44.546171%2044.544954H357.402017c-24.563399%200-44.547387-19.983988-44.547388-44.544954V459.283868c0-24.562183%2019.983988-44.546171%2044.547388-44.546171h55.271601c9.776707%200%2015.160099-6.811341%2016.79847-12.643552%201.650534-5.875998%200.591127-14.560458-7.828177-19.695722l-48.403093-29.342285c-2.578579-1.842711-3.200114-3.555277-3.327827-4.488187-0.754113-3.113756-0.406248-4.38845%202.134626-8.199152l0.301645-0.369759c0.261507-0.261507%200.884258-0.760194%202.12003-1.17374l0.294347-0.077844a9.183147%209.183147%200%200%201%201.798924-0.169067c1.078868%200%202.582228%200.177581%203.569872%200.67262l0.199475%200.111901%20109.087278%2068.141386c7.358681%205.091478%2012.465971%205.478264%2018.889308%205.478265l17.005243%200.295563c0.282184%200.006082%200.549773%200.010947%200.816145%200.010947%2010.713267%200%2021.146782-5.329874%2027.910687-14.25638l70.587388-96.35007c2.696561-3.083348%206.458611-3.758401%207.67857-3.7584h0.925613l0.690865%200.615453c3.468919%203.083348%204.117212%207.980216%202.377887%2010.296072l-52.041079%2071.047153c-4.780102%206.527941-5.458803%2015.060362-1.773381%2022.267004a21.197867%2021.197867%200%200%200%2018.946475%2011.589011l0.150823-0.001217h64.648142c24.562183%200%2044.546171%2019.983988%2044.546171%2044.546171v193.898206z'%20p-id='2023'%3e%3c/path%3e%3cpath%20d='M580.45033%20589.717403c0-2.936175-0.062032-4.418858-1.443761-5.998846l-0.211639-0.279751c-2.318289-3.582036-6.788231-6.183725-10.628124-6.183725a7.845205%207.845205%200%200%200-2.610204%200.430574c-4.305741%201.435247-8.900963%205.803019-8.900963%2012.032964%200%205.668009-1.395109%2010.721781-3.931117%2014.244217-3.156327%204.887137-6.714036%207.429227-10.873819%207.775876-0.317457%200.024326-0.620319%200.035273-0.920748%200.035273-4.255872%200-8.390113-2.228282-11.958769-6.444016-3.484731-4.519811-5.326226-10.043079-5.255679-15.641758%200-7.138529-6.621597-10.403107-12.774914-10.403107-6.152101%200-12.772481%203.264579-12.772481%2010.433515v2.633313c0%206.414824-2.47276%2011.418727-7.558156%2015.290245l-0.1715%200.171499c-2.863196%202.863196-6.525508%204.285063-10.156196%203.921387-3.557709-0.322322-6.785799-2.340182-9.84482-6.164264l-0.532745-0.666538v-0.16177c-2.900902-3.242685-4.680364-8.920424-4.680364-15.023872%200-6.720118-5.468534-12.187435-12.189868-12.187436-6.720118%200-12.188652%205.466101-12.188652%2012.187436%200%2011.365209%203.342422%2021.168675%2010.834898%2031.766392l0.287049%200.299213c7.496124%208.885151%2017.887068%2014.082448%2029.260792%2014.637085%200.640996%200.031624%201.277126%200.048652%201.909608%200.048653%2010.079569%200%2019.654368-4.02234%2026.959532-11.327504l1.857306-1.857307%201.708917%201.99475c6.479288%207.560589%2014.756284%2011.725237%2023.304518%2011.725237%2011.675369%200%2018.953773-3.350937%2025.081547-6.971894l0.572882-0.33935h0.186096c13.086289-9.359513%2019.023103-22.738933%2017.648671-39.778233l-0.007297-0.198258zM450.047203%20507.635876l-1.741757-8.993403a12.575439%2012.575439%200%200%200-5.155942-8.128605c-1.903527-1.382946-4.30939-2.103002-6.984057-2.103002-0.776006%200-1.569041%200.062032-2.357211%200.182447l-70.698072%2013.147104c-6.863643%201.227258-11.265472%207.56667-10.03943%2014.435178l1.747838%209.033542c0.778439%203.361883%202.626015%206.283462%205.185134%208.145634%201.875551%201.403623%204.265602%202.16625%206.757823%202.16625%200.729787%200%201.359836%200%201.867038-0.169068l0.322322-0.082709%2070.773484-13.160484c6.806476-1.184687%2011.427241-7.674922%2010.32283-14.472884zM660.29506%20501.753797l-70.835515-13.170215c-0.766276-0.147174-1.541066-0.218936-2.308559-0.218936-2.517764%200-4.941871%200.757762-7.00595%202.193009a12.356503%2012.356503%200%200%200-5.097559%208.031301l-1.763651%209.121115c-0.72857%203.161192-0.004865%206.575377%201.918122%209.219637%202.161385%202.975097%204.861595%204.711989%208.026436%205.164456l71.041072%2013.207921%200.159336%200.053517c0.503553%200.167851%201.133602%200.167851%201.862172%200.167851%205.878431%200%2011.025858-4.229113%2012.240953-10.054026l1.747839-9.034757c0.492606-3.282823-0.21772-6.750526-2.01786-9.661158-1.795275-2.64426-4.719286-4.505216-7.966836-5.019715z'%20p-id='2024'%3e%3c/path%3e%3c/svg%3e"; const MIN_BATCH_SEND_COUNT = 1; const MAX_BATCH_SEND_COUNT = 100; const MIN_BATCH_SEND_INTERVAL_SECONDS = 5; const MAX_BATCH_SEND_INTERVAL_SECONDS = 3600; function isValidBatchSendSettings(totalSendCount, intervalSeconds) { return totalSendCount !== null && intervalSeconds !== null && Number.isInteger(totalSendCount) && Number.isInteger(intervalSeconds) && totalSendCount >= MIN_BATCH_SEND_COUNT && totalSendCount <= MAX_BATCH_SEND_COUNT && intervalSeconds >= MIN_BATCH_SEND_INTERVAL_SECONDS && intervalSeconds <= MAX_BATCH_SEND_INTERVAL_SECONDS; } function sendDanmakuBatch({ content, totalSendCount, intervalSeconds, send, onStart, onProgress, onFailure, onComplete }) { if (!isValidBatchSendSettings(totalSendCount, intervalSeconds)) { throw new Error("Invalid batch send settings"); } let sentCount = 0; let timeoutId = null; let isRunning = false; let isPaused = false; const sendInterval = intervalSeconds * 1e3; const scheduleNext = async () => { if (isPaused) return; if (!isRunning) { isRunning = true; onStart?.(); } try { await send(content); } catch (err) { const message = err instanceof Error ? err.message : String(err); onFailure?.(message); } if (!isRunning) return; ++sentCount; onProgress?.(totalSendCount - sentCount); if (sentCount >= totalSendCount) { isRunning = false; onComplete?.(); } else if (!isPaused) { timeoutId = window.setTimeout(scheduleNext, sendInterval); } }; if (totalSendCount > 0) { timeoutId = window.setTimeout(scheduleNext, 0); } return { pause() { isPaused = true; if (timeoutId !== null) { clearTimeout(timeoutId); timeoutId = null; } }, resume() { if (!isRunning) return; isPaused = false; if (timeoutId === null && sentCount < totalSendCount) { scheduleNext(); } }, stop() { isRunning = false; isPaused = false; if (timeoutId !== null) { clearTimeout(timeoutId); timeoutId = null; } onComplete?.(); } }; } function useDanmakuBatchSend() { const danmakuLibraryStore = useDanmakuLibraryStore(); const danmakuBatchSendStore = useDanmakuBatchSendStore(); const liverStore = useLiverStore(); const { currentDanmaku, danmakuMenuOptions } = pinia$1.storeToRefs(danmakuLibraryStore); const { batchSendStatus, batchSendInterval, batchSendTotalCount, batchSendRemainingCount, batchSendControl, batchSendErrorMessages } = pinia$1.storeToRefs(danmakuBatchSendStore); const { csrf, roomId } = pinia$1.storeToRefs(liverStore); const isEmptyContent = vue.computed(() => currentDanmaku.value.trim().length === 0); const canSend = vue.computed( () => !isEmptyContent.value && !batchSendStatus.value.isStarting && !batchSendStatus.value.isRunning && isValidBatchSendSettings(batchSendTotalCount.value, batchSendInterval.value) ); const selectOptions = vue.computed(() => { const options = danmakuMenuOptions.value; const hasCurrentOption = options.some((option) => option.value === currentDanmaku.value); if (isEmptyContent.value || hasCurrentOption) { return options; } return [ { id: null, value: currentDanmaku.value, label: currentDanmaku.value }, ...options ]; }); async function startBatchSend() { if (!canSend.value) return; const content = currentDanmaku.value; const totalSendCount = batchSendTotalCount.value; const intervalSeconds = batchSendInterval.value; if (totalSendCount === null || intervalSeconds === null) return; if (!isValidBatchSendSettings(totalSendCount, intervalSeconds)) return; batchSendStatus.value.isStarting = true; try { await liverStore.roomContext(); if (roomId.value === null) throw new Error("未找到直播间ID"); const targetRoomId = roomId.value; const targetCsrf = csrf.value; danmakuBatchSendStore.resetBatchSendProgress(totalSendCount); batchSendControl.value = vue.markRaw( sendDanmakuBatch({ content, totalSendCount, intervalSeconds, async send(content2) { await sendDanmaku({ content: content2, roomId: targetRoomId, csrf: targetCsrf }); }, onStart() { batchSendStatus.value.isStarting = false; batchSendStatus.value.isRunning = true; batchSendStatus.value.isPaused = false; }, onProgress(remainingCount) { batchSendRemainingCount.value = remainingCount; }, onFailure(message) { batchSendErrorMessages.value.push(message); }, onComplete() { batchSendStatus.value.isStarting = false; batchSendStatus.value.isRunning = false; batchSendStatus.value.isPaused = false; batchSendRemainingCount.value = totalSendCount; batchSendControl.value = null; } }) ); } catch (error) { batchSendStatus.value.isStarting = false; batchSendStatus.value.isRunning = false; batchSendStatus.value.isPaused = false; batchSendControl.value = null; console.error("批量发送初始化失败:", error); } } function pauseBatchSend() { batchSendStatus.value.isPaused = true; batchSendControl.value?.pause(); } function resumeBatchSend() { batchSendStatus.value.isPaused = false; batchSendControl.value?.resume(); } function stopBatchSend() { batchSendControl.value?.stop(); } return { currentDanmaku, selectOptions, batchSendStatus, batchSendInterval, batchSendTotalCount, canSend, startBatchSend, pauseBatchSend, resumeBatchSend, stopBatchSend }; } function classesToTokens(classes2 = "") { return classes2.trim().split(" ").filter((c2) => !!c2.trim()); } function deleteProps(obj) { Object.keys(obj).forEach((key) => { try { obj[key] = null; } catch { } try { delete obj[key]; } catch { } }); } function nextTick(callback, delay = 0) { return setTimeout(callback, delay); } function now() { return Date.now(); } function getComputedStyle$1(el) { return window.getComputedStyle(el, null); } function getTranslate(el, axis = "x") { const style = getComputedStyle$1(el); const transform = style.transform || style.webkitTransform; if (!transform || transform === "none") return 0; const matrix = new DOMMatrixReadOnly(transform); return axis === "x" ? matrix.m41 : matrix.m42; } function isObject$1(o2) { return typeof o2 === "object" && o2 !== null && !!o2.constructor && Object.prototype.toString.call(o2).slice(8, -1) === "Object"; } function isNode(node) { if (typeof HTMLElement !== "undefined" && node instanceof HTMLElement) return true; return !!node && typeof node === "object" && (node.nodeType === 1 || node.nodeType === 11); } function extend$1(target, ...sources) { const to = Object(target); for (let i3 = 0; i3 < sources.length; i3 += 1) { const nextSource = sources[i3]; if (nextSource === void 0 || nextSource === null || isNode(nextSource)) continue; const sourceObj = nextSource; const keysArray = Object.keys(Object(sourceObj)).filter((key) => key !== "__proto__" && key !== "constructor" && key !== "prototype"); for (const nextKey of keysArray) { const desc = Object.getOwnPropertyDescriptor(sourceObj, nextKey); if (!desc || !desc.enumerable) continue; const sourceVal = sourceObj[nextKey]; if (isObject$1(to[nextKey]) && isObject$1(sourceVal)) { if (sourceVal.__swiper__) { to[nextKey] = sourceVal; } else { extend$1(to[nextKey], sourceVal); } } else if (!isObject$1(to[nextKey]) && isObject$1(sourceVal)) { to[nextKey] = {}; if (sourceVal.__swiper__) { to[nextKey] = sourceVal; } else { extend$1(to[nextKey], sourceVal); } } else { to[nextKey] = sourceVal; } } } return to; } function setCSSProperty(el, varName, varValue) { el.style.setProperty(varName, varValue); } function elementChildren(element, selector = "") { const children = [...element.children]; if (element instanceof HTMLSlotElement) { children.push(...element.assignedElements()); } return selector ? children.filter((el) => el.matches(selector)) : children; } function elementIsChildOfSlot(el, slot) { const queue = [slot]; while (queue.length > 0) { const cur = queue.shift(); if (el === cur) return true; queue.push(...cur.children, ...cur.shadowRoot ? cur.shadowRoot.children : [], ...cur.assignedElements ? cur.assignedElements() : []); } return false; } function elementIsChildOf(el, parent) { let isChild = parent.contains(el); if (!isChild && parent instanceof HTMLSlotElement) { const children = [...parent.assignedElements()]; isChild = children.includes(el); if (!isChild) isChild = elementIsChildOfSlot(el, parent); } return isChild; } function showWarning(text) { try { console.warn(text); } catch { } } function createElement(tag, classes2 = []) { const el = document.createElement(tag); el.classList.add(...Array.isArray(classes2) ? classes2 : classesToTokens(classes2)); return el; } function elementPrevAll(el, selector) { const prevEls = []; let prev = el.previousElementSibling; while (prev) { if (!selector || prev.matches(selector)) prevEls.push(prev); prev = prev.previousElementSibling; } return prevEls; } function elementNextAll(el, selector) { const nextEls = []; let next = el.nextElementSibling; while (next) { if (!selector || next.matches(selector)) nextEls.push(next); next = next.nextElementSibling; } return nextEls; } function elementStyle(el, prop) { return window.getComputedStyle(el, null).getPropertyValue(prop); } function elementIndex(el) { if (!el || !el.parentNode) return void 0; return [...el.parentNode.children].indexOf(el); } function elementParents(el, selector) { const parents = []; let parent = el.parentElement; while (parent) { if (!selector || parent.matches(selector)) parents.push(parent); parent = parent.parentElement; } return parents; } function elementOuterSize(el, size, includeMargins) { { const style = window.getComputedStyle(el, null); return el[size === "width" ? "offsetWidth" : "offsetHeight"] + parseFloat(style.getPropertyValue(size === "width" ? "margin-right" : "margin-top")) + parseFloat(style.getPropertyValue(size === "width" ? "margin-left" : "margin-bottom")); } } function makeElementsArray(el) { return (Array.isArray(el) ? el : [el]).filter((e3) => !!e3); } function setInnerHTML(el, html = "") { const tt = globalThis.trustedTypes; if (typeof tt !== "undefined") { el.innerHTML = tt.createPolicy("html", { createHTML: (s2) => s2 }).createHTML(html); } else { el.innerHTML = html; } } const Mousewheel = ({ swiper, extendParams, on, emit }) => { extendParams({ mousewheel: { enabled: false, releaseOnEdges: false, invert: false, forceToAxis: false, sensitivity: 1, eventsTarget: "container", thresholdDelta: null, thresholdTime: null, noMousewheelClass: "swiper-no-mousewheel" } }); let timeout; let lastScrollTime = now(); let lastEventBeforeSnap; let mouseEntered = false; const recentWheelEvents = []; function getParams2() { return swiper.params.mousewheel; } function normalize(e3) { const PIXEL_STEP = 10; const LINE_HEIGHT = 40; const PAGE_HEIGHT = 800; const ev = e3; let sX = 0; let sY = 0; let pX = 0; let pY = 0; if (ev.detail !== void 0) { sY = ev.detail; } if (ev.wheelDelta !== void 0) { sY = -ev.wheelDelta / 120; } if (ev.wheelDeltaY !== void 0) { sY = -ev.wheelDeltaY / 120; } if (ev.wheelDeltaX !== void 0) { sX = -ev.wheelDeltaX / 120; } if (ev.axis !== void 0 && ev.HORIZONTAL_AXIS !== void 0 && ev.axis === ev.HORIZONTAL_AXIS) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if (ev.deltaY !== void 0) { pY = ev.deltaY; } if (ev.deltaX !== void 0) { pX = ev.deltaX; } if (ev.shiftKey && !pX) { pX = pY; pY = 0; } if ((pX || pY) && ev.deltaMode) { if (ev.deltaMode === 1) { pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } if (pX && !sX) { sX = pX < 1 ? -1 : 1; } if (pY && !sY) { sY = pY < 1 ? -1 : 1; } return { spinX: sX, spinY: sY, pixelX: pX, pixelY: pY }; } function handleMouseEnter() { if (!swiper.enabled) return; mouseEntered = true; } function handleMouseLeave() { if (!swiper.enabled) return; mouseEntered = false; } function animateSlider(newEvent) { const params = getParams2(); if (params.thresholdDelta && newEvent.delta < params.thresholdDelta) { return false; } if (params.thresholdTime && now() - lastScrollTime < params.thresholdTime) { return false; } if (newEvent.delta >= 6 && now() - lastScrollTime < 60) { return true; } if (newEvent.direction < 0) { if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { swiper.slideNext(); emit("scroll", newEvent.raw); } } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { swiper.slidePrev(); emit("scroll", newEvent.raw); } lastScrollTime = new window.Date().getTime(); return false; } function releaseScroll(newEvent) { const params = getParams2(); if (newEvent.direction < 0) { if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { return true; } } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { return true; } return false; } function handle(event) { let e3 = "originalEvent" in event && event.originalEvent ? event.originalEvent : event; let disableParentSwiper = true; if (!swiper.enabled) return false; const params = getParams2(); if (event.target.closest(`.${params.noMousewheelClass}`)) return false; if (swiper.params.cssMode) { e3.preventDefault(); } let targetEl = swiper.el; if (params.eventsTarget !== "container") { targetEl = document.querySelector(params.eventsTarget); } const targetElContainsTarget = targetEl && targetEl.contains(e3.target); if (!mouseEntered && !targetElContainsTarget && !params.releaseOnEdges) return true; let delta = 0; const rtlFactor = swiper.rtlTranslate ? -1 : 1; const data = normalize(e3); if (params.forceToAxis) { if (swiper.isHorizontal()) { if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor; else return true; } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY; else return true; } else { delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; } if (delta === 0) return true; if (params.invert) delta = -delta; let positions = swiper.getTranslate() + delta * (params.sensitivity ?? 1); if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); if (disableParentSwiper && swiper.params.nested) e3.stopPropagation(); const freeModeParams = swiper.params.freeMode; if (!swiper.params.freeMode || !freeModeParams?.enabled) { const newEvent = { time: now(), delta: Math.abs(delta), direction: Math.sign(delta), raw: event }; if (recentWheelEvents.length >= 2) { recentWheelEvents.shift(); } const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : void 0; recentWheelEvents.push(newEvent); if (prevEvent) { if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) { animateSlider(newEvent); } } else { animateSlider(newEvent); } if (releaseScroll(newEvent)) { return true; } } else { const newEvent = { time: now(), delta: Math.abs(delta), direction: Math.sign(delta) }; const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction; if (!ignoreWheelEvents) { lastEventBeforeSnap = void 0; let position = swiper.getTranslate() + delta * (params.sensitivity ?? 1); const wasBeginning = swiper.isBeginning; const wasEnd = swiper.isEnd; if (position >= swiper.minTranslate()) position = swiper.minTranslate(); if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); swiper.setTransition(0); swiper.setTranslate(position); swiper.updateProgress(); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) { swiper.updateSlidesClasses(); } if (swiper.params.loop) { swiper.loopFix({ direction: newEvent.direction < 0 ? "next" : "prev", byMousewheel: true }); } if (freeModeParams?.sticky) { clearTimeout(timeout); timeout = void 0; if (recentWheelEvents.length >= 15) { recentWheelEvents.shift(); } const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : void 0; const firstEvent = recentWheelEvents[0]; recentWheelEvents.push(newEvent); if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) { recentWheelEvents.splice(0); } else if (recentWheelEvents.length >= 15 && firstEvent && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) { const snapToThreshold = delta > 0 ? 0.8 : 0.2; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); timeout = nextTick(() => { if (swiper.destroyed || !swiper.params) return; swiper.slideToClosest(swiper.params.speed, true, void 0, snapToThreshold); }, 0); } if (!timeout) { timeout = nextTick(() => { if (swiper.destroyed || !swiper.params) return; const snapToThreshold = 0.5; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); swiper.slideToClosest(swiper.params.speed, true, void 0, snapToThreshold); }, 500); } } if (!ignoreWheelEvents) emit("scroll", e3); const autoplayParams = swiper.params.autoplay; if (swiper.params.autoplay && autoplayParams?.disableOnInteraction) { swiper.autoplay.stop(); } if (params.releaseOnEdges && (position === swiper.minTranslate() || position === swiper.maxTranslate())) { return true; } } } if (e3.cancelable) e3.preventDefault(); return false; } function events2(method) { const params = getParams2(); let targetEl = swiper.el; if (params.eventsTarget !== "container") { targetEl = document.querySelector(params.eventsTarget); } targetEl[method]("mouseenter", handleMouseEnter); targetEl[method]("mouseleave", handleMouseLeave); targetEl[method]("wheel", handle); } function enable() { if (swiper.params.cssMode) { swiper.wrapperEl.removeEventListener("wheel", handle); return true; } if (swiper.mousewheel.enabled) return false; events2("addEventListener"); swiper.mousewheel.enabled = true; return true; } function disable() { if (swiper.params.cssMode) { swiper.wrapperEl.addEventListener("wheel", handle); return true; } if (!swiper.mousewheel.enabled) return false; events2("removeEventListener"); swiper.mousewheel.enabled = false; return true; } on("init", () => { const params = getParams2(); if (!params.enabled && swiper.params.cssMode) { disable(); } if (params.enabled) enable(); }); swiper.mousewheel = { enabled: false, enable, disable }; on("destroy", () => { if (swiper.params.cssMode) { enable(); } if (swiper.mousewheel.enabled) disable(); }); }; function createElementIfNotDefined(swiper, originalParams, params, checkProps) { const target = params ?? {}; const original = originalParams ?? {}; if (swiper.params.createElements) { Object.keys(checkProps).forEach((key) => { if (!target[key] && target.auto === true) { let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0]; if (!element) { element = createElement("div", checkProps[key]); element.className = checkProps[key]; swiper.el.append(element); } target[key] = element; original[key] = element; } }); } return target; } function classesToSelector(classes2 = "") { return `.${classes2.trim().replace(/([.:!+/()[\]#>~*^$|=,'"@{}\\])/g, "\\$1").replace(/ /g, ".")}`; } const isVirtualEnabled$1 = (swiper) => !!swiper.virtual && !!swiper.params.virtual?.enabled; const isFreeModeEnabled = (swiper) => !!swiper.params.freeMode?.enabled; const getSlidesLength = (swiper) => { if (isVirtualEnabled$1(swiper)) return swiper.virtual.slides.length; const gridRows = swiper.params.grid?.rows; if (swiper.grid && gridRows && gridRows > 1) { return swiper.slides.length / Math.ceil(gridRows); } return swiper.slides.length; }; const Pagination = ({ swiper, extendParams, on, emit }) => { const pfx = "swiper-pagination"; extendParams({ pagination: { el: null, bulletElement: "span", clickable: false, hideOnClick: false, renderBullet: null, renderProgressbar: null, renderFraction: null, renderCustom: null, progressbarOpposite: false, type: "bullets", dynamicBullets: false, dynamicMainBullets: 1, formatFractionCurrent: (number) => number, formatFractionTotal: (number) => number, bulletClass: `${pfx}-bullet`, bulletActiveClass: `${pfx}-bullet-active`, modifierClass: `${pfx}-`, currentClass: `${pfx}-current`, totalClass: `${pfx}-total`, hiddenClass: `${pfx}-hidden`, progressbarFillClass: `${pfx}-progressbar-fill`, progressbarOppositeClass: `${pfx}-progressbar-opposite`, clickableClass: `${pfx}-clickable`, lockClass: `${pfx}-lock`, horizontalClass: `${pfx}-horizontal`, verticalClass: `${pfx}-vertical`, paginationDisabledClass: `${pfx}-disabled` } }); swiper.pagination = { el: null, bullets: [] }; let bulletSize; let dynamicBulletIndex = 0; function getParams2() { return swiper.params.pagination; } function isPaginationDisabled() { const elParam = getParams2().el; return !elParam || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0; } function setSideBullets(bulletEl, position) { const { bulletActiveClass } = getParams2(); if (!bulletEl) return; let current = bulletEl[`${position === "prev" ? "previous" : "next"}ElementSibling`]; if (current) { current.classList.add(`${bulletActiveClass}-${position}`); current = current[`${position === "prev" ? "previous" : "next"}ElementSibling`]; if (current) { current.classList.add(`${bulletActiveClass}-${position}-${position}`); } } } function getMoveDirection(prevIndex, nextIndex, length) { prevIndex = prevIndex % length; nextIndex = nextIndex % length; if (nextIndex === prevIndex + 1) { return "next"; } else if (nextIndex === prevIndex - 1) { return "previous"; } return void 0; } function onBulletClick(e3) { const targetEl = e3.target; const bulletEl = targetEl.closest(classesToSelector(getParams2().bulletClass)); if (!bulletEl) { return; } e3.preventDefault(); const index = (elementIndex(bulletEl) ?? 0) * (swiper.params.slidesPerGroup ?? 1); if (swiper.params.loop) { if (swiper.realIndex === index) return; const moveDirection = getMoveDirection(swiper.realIndex, index, swiper.slides.length); if (moveDirection === "next") { swiper.slideNext(); } else if (moveDirection === "previous") { swiper.slidePrev(); } else { swiper.slideToLoop(index); } } else { swiper.slideTo(index); } } function update2() { const rtl = swiper.rtl; const params = getParams2(); if (isPaginationDisabled()) return; const els = makeElementsArray(swiper.pagination.el); let current; let previousIndex; const slidesLength = getSlidesLength(swiper); const total = swiper.params.loop ? Math.ceil(slidesLength / (swiper.params.slidesPerGroup ?? 1)) : swiper.snapGrid.length; if (swiper.params.loop) { previousIndex = swiper.previousRealIndex || 0; current = (swiper.params.slidesPerGroup ?? 1) > 1 ? Math.floor(swiper.realIndex / (swiper.params.slidesPerGroup ?? 1)) : swiper.realIndex; } else if (typeof swiper.snapIndex !== "undefined") { current = swiper.snapIndex; previousIndex = swiper.previousSnapIndex; } else { previousIndex = swiper.previousIndex || 0; current = swiper.activeIndex || 0; } if (params.type === "bullets" && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { const bullets = swiper.pagination.bullets; let firstIndex = 0; let lastIndex = 0; let midIndex = 0; if (params.dynamicBullets) { bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? "width" : "height"); const dim = swiper.isHorizontal() ? "width" : "height"; els.forEach((subEl) => { subEl.style[dim] = `${(bulletSize ?? 0) * (params.dynamicMainBullets + 4)}px`; }); if (params.dynamicMainBullets > 1 && previousIndex !== void 0) { dynamicBulletIndex += current - (previousIndex || 0); if (dynamicBulletIndex > params.dynamicMainBullets - 1) { dynamicBulletIndex = params.dynamicMainBullets - 1; } else if (dynamicBulletIndex < 0) { dynamicBulletIndex = 0; } } firstIndex = Math.max(current - dynamicBulletIndex, 0); lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); midIndex = (lastIndex + firstIndex) / 2; } bullets.forEach((bulletEl) => { const classesToRemove = [ "", "-next", "-next-next", "-prev", "-prev-prev", "-main" ].map((suffix) => `${params.bulletActiveClass}${suffix}`).flatMap((s2) => typeof s2 === "string" && s2.includes(" ") ? s2.split(" ") : [s2]); bulletEl.classList.remove(...classesToRemove); }); if (els.length > 1) { bullets.forEach((bullet) => { const bulletIndex = elementIndex(bullet); if (bulletIndex === current) { bullet.classList.add(...params.bulletActiveClass.split(" ")); } else if (swiper.isElement) { bullet.setAttribute("part", "bullet"); } if (params.dynamicBullets && bulletIndex !== void 0) { if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { bullet.classList.add(...`${params.bulletActiveClass}-main`.split(" ")); } if (bulletIndex === firstIndex) { setSideBullets(bullet, "prev"); } if (bulletIndex === lastIndex) { setSideBullets(bullet, "next"); } } }); } else { const bullet = bullets[current]; if (bullet) { bullet.classList.add(...params.bulletActiveClass.split(" ")); } if (swiper.isElement) { bullets.forEach((bulletEl, bulletIndex) => { bulletEl.setAttribute("part", bulletIndex === current ? "bullet-active" : "bullet"); }); } if (params.dynamicBullets) { const firstDisplayedBullet = bullets[firstIndex]; const lastDisplayedBullet = bullets[lastIndex]; for (let i3 = firstIndex; i3 <= lastIndex; i3 += 1) { if (bullets[i3]) { bullets[i3].classList.add(...`${params.bulletActiveClass}-main`.split(" ")); } } setSideBullets(firstDisplayedBullet, "prev"); setSideBullets(lastDisplayedBullet, "next"); } } if (params.dynamicBullets) { const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); const bulletsOffset = ((bulletSize ?? 0) * dynamicBulletsLength - (bulletSize ?? 0)) / 2 - midIndex * (bulletSize ?? 0); const offsetProp = rtl ? "right" : "left"; const positionDim = swiper.isHorizontal() ? offsetProp : "top"; bullets.forEach((bullet) => { bullet.style[positionDim] = `${bulletsOffset}px`; }); } } els.forEach((subEl, subElIndex) => { if (params.type === "fraction") { subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach((fractionEl) => { fractionEl.textContent = String(params.formatFractionCurrent(current + 1)); }); subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach((totalEl) => { totalEl.textContent = String(params.formatFractionTotal(total)); }); } if (params.type === "progressbar") { let progressbarDirection; if (params.progressbarOpposite) { progressbarDirection = swiper.isHorizontal() ? "vertical" : "horizontal"; } else { progressbarDirection = swiper.isHorizontal() ? "horizontal" : "vertical"; } const scale = (current + 1) / total; let scaleX = 1; let scaleY = 1; if (progressbarDirection === "horizontal") { scaleX = scale; } else { scaleY = scale; } subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach((progressEl) => { progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`; progressEl.style.transitionDuration = `${swiper.params.speed}ms`; }); } if (params.type === "custom" && params.renderCustom) { setInnerHTML(subEl, params.renderCustom(swiper, current + 1, total)); if (subElIndex === 0) emit("paginationRender", subEl); } else { if (subElIndex === 0) emit("paginationRender", subEl); emit("paginationUpdate", subEl); } if (swiper.params.watchOverflow && swiper.enabled) { subEl.classList[swiper.isLocked ? "add" : "remove"](params.lockClass); } }); } function render() { const params = getParams2(); if (isPaginationDisabled()) return; const slidesLength = getSlidesLength(swiper); const els = makeElementsArray(swiper.pagination.el); let paginationHTML = ""; if (params.type === "bullets") { let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / (swiper.params.slidesPerGroup ?? 1)) : swiper.snapGrid.length; if (swiper.params.freeMode && isFreeModeEnabled(swiper) && numberOfBullets > slidesLength) { numberOfBullets = slidesLength; } for (let i3 = 0; i3 < numberOfBullets; i3 += 1) { if (params.renderBullet) { paginationHTML += params.renderBullet.call(swiper, i3, params.bulletClass); } else { paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ""} class="${params.bulletClass}">`; } } } if (params.type === "fraction") { if (params.renderFraction) { paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); } else { paginationHTML = ` / `; } } if (params.type === "progressbar") { if (params.renderProgressbar) { paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); } else { paginationHTML = ``; } } swiper.pagination.bullets = []; els.forEach((subEl) => { if (params.type !== "custom") { setInnerHTML(subEl, paginationHTML || ""); } if (params.type === "bullets") { swiper.pagination.bullets.push(...Array.from(subEl.querySelectorAll(classesToSelector(params.bulletClass)))); } }); if (params.type !== "custom") { emit("paginationRender", els[0]); } } function init() { swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, { el: "swiper-pagination" }); const params = getParams2(); if (!params.el) return; let el; if (typeof params.el === "string" && swiper.isElement) { el = swiper.el.querySelector(params.el); } if (!el && typeof params.el === "string") { el = [...document.querySelectorAll(params.el)]; } if (!el) { el = params.el; } if (!el || Array.isArray(el) && el.length === 0) return; if (swiper.params.uniqueNavElements && typeof params.el === "string" && Array.isArray(el) && el.length > 1) { el = [...swiper.el.querySelectorAll(params.el)]; if (el.length > 1) { const found = el.find((subEl) => { if (elementParents(subEl, ".swiper")[0] !== swiper.el) return false; return true; }); if (found) el = found; } } if (Array.isArray(el) && el.length === 1) el = el[0]; Object.assign(swiper.pagination, { el }); const els = makeElementsArray(el); els.forEach((subEl) => { if (params.type === "bullets" && params.clickable) { subEl.classList.add(...(params.clickableClass || "").split(" ")); } subEl.classList.add(params.modifierClass + params.type); subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); if (params.type === "bullets" && params.dynamicBullets) { subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`); dynamicBulletIndex = 0; if (params.dynamicMainBullets < 1) { params.dynamicMainBullets = 1; } } if (params.type === "progressbar" && params.progressbarOpposite) { subEl.classList.add(params.progressbarOppositeClass); } if (params.clickable) { subEl.addEventListener("click", onBulletClick); } if (!swiper.enabled) { subEl.classList.add(params.lockClass); } }); } function destroy() { const params = getParams2(); if (isPaginationDisabled()) return; const el = swiper.pagination.el; if (el) { const els = makeElementsArray(el); els.forEach((subEl) => { subEl.classList.remove(params.hiddenClass); subEl.classList.remove(params.modifierClass + params.type); subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); if (params.clickable) { subEl.classList.remove(...(params.clickableClass || "").split(" ")); subEl.removeEventListener("click", onBulletClick); } }); } if (swiper.pagination.bullets) swiper.pagination.bullets.forEach((subEl) => subEl.classList.remove(...params.bulletActiveClass.split(" "))); } on("changeDirection", () => { if (!swiper.pagination || !swiper.pagination.el) return; const params = getParams2(); const els = makeElementsArray(swiper.pagination.el); els.forEach((subEl) => { subEl.classList.remove(params.horizontalClass, params.verticalClass); subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); }); }); on("init", () => { if (getParams2().enabled === false) { disable(); } else { init(); render(); update2(); } }); on("activeIndexChange", () => { if (typeof swiper.snapIndex === "undefined") { update2(); } }); on("snapIndexChange", () => { update2(); }); on("snapGridLengthChange", () => { render(); update2(); }); on("destroy", () => { destroy(); }); on("enable disable", () => { const { el } = swiper.pagination; if (el) { const params = getParams2(); const els = makeElementsArray(el); els.forEach((subEl) => subEl.classList[swiper.enabled ? "remove" : "add"](params.lockClass)); } }); on("lock unlock", () => { update2(); }); on("click", (_s, e3) => { const targetEl = e3.target; const els = makeElementsArray(swiper.pagination.el); const params = getParams2(); if (params.el && params.hideOnClick && els && els.length > 0 && !targetEl.classList.contains(params.bulletClass)) { if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; const isHidden = els[0].classList.contains(params.hiddenClass); if (isHidden === true) { emit("paginationShow"); } else { emit("paginationHide"); } els.forEach((subEl) => subEl.classList.toggle(params.hiddenClass)); } }); const enable = () => { const params = getParams2(); swiper.el.classList.remove(params.paginationDisabledClass); const { el } = swiper.pagination; if (el) { const els = makeElementsArray(el); els.forEach((subEl) => subEl.classList.remove(params.paginationDisabledClass)); } init(); render(); update2(); }; const disable = () => { const params = getParams2(); swiper.el.classList.add(params.paginationDisabledClass); const { el } = swiper.pagination; if (el) { const els = makeElementsArray(el); els.forEach((subEl) => subEl.classList.add(params.paginationDisabledClass)); } destroy(); }; Object.assign(swiper.pagination, { enable, disable, render, update: update2, init, destroy }); }; const isVirtualEnabled = (swiper) => !!swiper.virtual && !!swiper.params.virtual?.enabled; const A11y = ({ swiper, extendParams, on }) => { extendParams({ a11y: { enabled: true, notificationClass: "swiper-notification", prevSlideMessage: "Previous slide", nextSlideMessage: "Next slide", firstSlideMessage: "This is the first slide", lastSlideMessage: "This is the last slide", paginationBulletMessage: "Go to slide {{index}}", slideLabelMessage: "{{index}} / {{slidesLength}}", containerMessage: null, containerRoleDescriptionMessage: null, containerRole: null, itemRoleDescriptionMessage: null, slideRole: "group", id: null, scrollOnFocus: true, wrapperLiveRegion: true } }); swiper.a11y = { clicked: false }; let liveRegion = null; let preventFocusHandler = false; let focusTargetSlideEl; let visibilityChangedTimestamp = ( new Date()).getTime(); function getParams2() { return swiper.params.a11y; } function notify(message) { const notification = liveRegion; if (!notification || !message) return; setInnerHTML(notification, message); } function getRandomNumber(size = 16) { const randomChar = () => Math.round(16 * Math.random()).toString(16); return "x".repeat(size).replace(/x/g, randomChar); } function makeElFocusable(el) { const els = makeElementsArray(el); els.forEach((subEl) => { subEl.setAttribute("tabIndex", "0"); }); } function makeElNotFocusable(el) { const els = makeElementsArray(el); els.forEach((subEl) => { subEl.setAttribute("tabIndex", "-1"); }); } function addElRole(el, role) { const els = makeElementsArray(el); els.forEach((subEl) => { subEl.setAttribute("role", role); }); } function addElRoleDescription(el, description) { const els = makeElementsArray(el); els.forEach((subEl) => { subEl.setAttribute("aria-roledescription", description); }); } function addElLabel(el, label) { const els = makeElementsArray(el); els.forEach((subEl) => { subEl.setAttribute("aria-label", label); }); } function addElId(el, id) { const els = makeElementsArray(el); els.forEach((subEl) => { subEl.setAttribute("id", id); }); } function addElLive(el, live) { const els = makeElementsArray(el); els.forEach((subEl) => { subEl.setAttribute("aria-live", live); }); } function disableEl(el) { const els = makeElementsArray(el); els.forEach((subEl) => { subEl.setAttribute("aria-disabled", "true"); }); } function enableEl(el) { const els = makeElementsArray(el); els.forEach((subEl) => { subEl.removeAttribute("aria-disabled"); }); } function onEnterOrSpaceKey(e3) { if (e3.keyCode !== 13 && e3.keyCode !== 32) return; const params = getParams2(); const paginationParams = swiper.params.pagination; const targetEl = e3.target; if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(targetEl))) { if (!targetEl.matches(classesToSelector(paginationParams?.bulletClass))) return; } if (swiper.navigation && swiper.navigation.prevEl && swiper.navigation.nextEl) { const prevEls = makeElementsArray(swiper.navigation.prevEl); const nextEls = makeElementsArray(swiper.navigation.nextEl); if (nextEls.includes(targetEl)) { if (!(swiper.isEnd && !swiper.params.loop)) { swiper.slideNext(); } if (swiper.isEnd) { notify(params.lastSlideMessage); } else { notify(params.nextSlideMessage); } } if (prevEls.includes(targetEl)) { if (!(swiper.isBeginning && !swiper.params.loop)) { swiper.slidePrev(); } if (swiper.isBeginning) { notify(params.firstSlideMessage); } else { notify(params.prevSlideMessage); } } } if (swiper.pagination && targetEl.matches(classesToSelector(paginationParams?.bulletClass))) { targetEl.click(); } } function updateNavigation() { if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return; const { nextEl, prevEl } = swiper.navigation; if (prevEl) { if (swiper.isBeginning) { disableEl(prevEl); makeElNotFocusable(prevEl); } else { enableEl(prevEl); makeElFocusable(prevEl); } } if (nextEl) { if (swiper.isEnd) { disableEl(nextEl); makeElNotFocusable(nextEl); } else { enableEl(nextEl); makeElFocusable(nextEl); } } } function hasPagination() { return !!(swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length); } function hasClickablePagination() { const paginationParams = swiper.params.pagination; return hasPagination() && !!paginationParams?.clickable; } function updatePagination() { const params = getParams2(); if (!hasPagination()) return; const paginationParams = swiper.params.pagination; swiper.pagination.bullets.forEach((bulletEl) => { if (paginationParams.clickable) { makeElFocusable(bulletEl); if (!paginationParams.renderBullet) { addElRole(bulletEl, "button"); addElLabel(bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, String((elementIndex(bulletEl) ?? 0) + 1))); } } if (bulletEl.matches(classesToSelector(paginationParams.bulletActiveClass))) { bulletEl.setAttribute("aria-current", "true"); } else { bulletEl.removeAttribute("aria-current"); } }); } const initNavEl = (el, _wrapperId, message) => { makeElFocusable(el); if (el.tagName !== "BUTTON") { addElRole(el, "button"); el.addEventListener("keydown", onEnterOrSpaceKey); } addElLabel(el, message); }; const handlePointerDown = (e3) => { if (focusTargetSlideEl && focusTargetSlideEl !== e3.target && !focusTargetSlideEl.contains(e3.target)) { preventFocusHandler = true; } swiper.a11y.clicked = true; }; const handlePointerUp = () => { preventFocusHandler = false; requestAnimationFrame(() => { requestAnimationFrame(() => { if (!swiper.destroyed) { swiper.a11y.clicked = false; } }); }); }; const onVisibilityChange = (_e2) => { visibilityChangedTimestamp = ( new Date()).getTime(); }; const handleFocus = (e3) => { const params = getParams2(); if (swiper.a11y.clicked || !params.scrollOnFocus) return; if (( new Date()).getTime() - visibilityChangedTimestamp < 100) return; const target = e3.target; const slideEl = target.closest(`.${swiper.params.slideClass}, swiper-slide`); if (!slideEl || !swiper.slides.includes(slideEl)) return; focusTargetSlideEl = slideEl; const isVirtual = isVirtualEnabled(swiper); const isActive = (isVirtual ? parseInt(slideEl.getAttribute("data-swiper-slide-index") || "0", 10) : swiper.slides.indexOf(slideEl)) === swiper.activeIndex; const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl); if (isActive || isVisible) return; const sourceCapabilities = e3.sourceCapabilities; if (sourceCapabilities && sourceCapabilities.firesTouchEvents) return; if (swiper.isHorizontal()) { swiper.el.scrollLeft = 0; } else { swiper.el.scrollTop = 0; } requestAnimationFrame(() => { if (preventFocusHandler) return; if (swiper.params.loop) { swiper.slideToLoop(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute("data-swiper-slide-index") || "0", 10)), 0); } else if (isVirtual) { swiper.slideTo(swiper.getSlideIndexWhenGrid(parseInt(slideEl.getAttribute("data-swiper-slide-index") || "0", 10)), 0); } else { swiper.slideTo(swiper.getSlideIndexWhenGrid(swiper.slides.indexOf(slideEl)), 0); } preventFocusHandler = false; }); }; const initSlides = () => { const params = getParams2(); if (params.itemRoleDescriptionMessage) { addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage); } if (params.slideRole) { addElRole(swiper.slides, params.slideRole); } const slidesLength = swiper.slides.length; const slideLabelMessage = params.slideLabelMessage; if (slideLabelMessage) { swiper.slides.forEach((slideEl, index) => { const slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute("data-swiper-slide-index") || "0", 10) : index; const ariaLabelMessage = slideLabelMessage.replace(/\{\{index\}\}/, String(slideIndex + 1)).replace(/\{\{slidesLength\}\}/, String(slidesLength)); addElLabel(slideEl, ariaLabelMessage); }); } }; const init = () => { const params = getParams2(); if (liveRegion) swiper.el.append(liveRegion); const containerEl = swiper.el; if (params.containerRoleDescriptionMessage) { addElRoleDescription(containerEl, params.containerRoleDescriptionMessage); } if (params.containerMessage) { addElLabel(containerEl, params.containerMessage); } if (params.containerRole) { addElRole(containerEl, params.containerRole); } const wrapperEl = swiper.wrapperEl; const wrapperId = String(params.id || wrapperEl.getAttribute("id") || `swiper-wrapper-${getRandomNumber(16)}`); addElId(wrapperEl, wrapperId); if (params.wrapperLiveRegion) { const autoplayParams = swiper.params.autoplay; const live = swiper.params.autoplay && autoplayParams?.enabled ? "off" : "polite"; addElLive(wrapperEl, live); } initSlides(); const nav = swiper.navigation ? swiper.navigation : { nextEl: void 0, prevEl: void 0 }; const nextEls = makeElementsArray(nav.nextEl); const prevEls = makeElementsArray(nav.prevEl); if (nextEls) { nextEls.forEach((el) => initNavEl(el, wrapperId, params.nextSlideMessage)); } if (prevEls) { prevEls.forEach((el) => initNavEl(el, wrapperId, params.prevSlideMessage)); } if (hasClickablePagination()) { const paginationEl = makeElementsArray(swiper.pagination.el); paginationEl.forEach((el) => { el.addEventListener("keydown", onEnterOrSpaceKey); }); } document.addEventListener("visibilitychange", onVisibilityChange); swiper.el.addEventListener("focus", handleFocus, true); swiper.el.addEventListener("pointerdown", handlePointerDown, true); swiper.el.addEventListener("pointerup", handlePointerUp, true); }; function destroy() { if (liveRegion) liveRegion.remove(); const nav = swiper.navigation ? swiper.navigation : { nextEl: void 0, prevEl: void 0 }; const nextEls = makeElementsArray(nav.nextEl); const prevEls = makeElementsArray(nav.prevEl); if (nextEls) { nextEls.forEach((el) => el.removeEventListener("keydown", onEnterOrSpaceKey)); } if (prevEls) { prevEls.forEach((el) => el.removeEventListener("keydown", onEnterOrSpaceKey)); } if (hasClickablePagination()) { const paginationEl = makeElementsArray(swiper.pagination.el); paginationEl.forEach((el) => { el.removeEventListener("keydown", onEnterOrSpaceKey); }); } document.removeEventListener("visibilitychange", onVisibilityChange); if (swiper.el && typeof swiper.el !== "string") { swiper.el.removeEventListener("focus", handleFocus, true); swiper.el.removeEventListener("pointerdown", handlePointerDown, true); swiper.el.removeEventListener("pointerup", handlePointerUp, true); } } on("beforeInit", () => { liveRegion = createElement("span", getParams2().notificationClass); liveRegion.setAttribute("aria-live", "assertive"); liveRegion.setAttribute("aria-atomic", "true"); }); on("afterInit", () => { if (!getParams2().enabled) return; init(); }); on("slidesLengthChange snapGridLengthChange slidesGridLengthChange", () => { if (!getParams2().enabled) return; initSlides(); }); on("fromEdge toEdge afterInit lock unlock", () => { if (!getParams2().enabled) return; updateNavigation(); }); on("paginationUpdate", () => { if (!getParams2().enabled) return; updatePagination(); }); on("destroy", () => { if (!getParams2().enabled) return; destroy(); }); }; const paramsList = [ "eventsPrefix", "injectStyles", "injectStylesUrls", "modules", "init", "_direction", "oneWayMovement", "swiperElementNodeName", "touchEventsTarget", "initialSlide", "_speed", "cssMode", "updateOnWindowResize", "resizeObserver", "nested", "focusableElements", "_enabled", "_width", "_height", "preventInteractionOnTransition", "userAgent", "url", "_edgeSwipeDetection", "_edgeSwipeThreshold", "_freeMode", "_autoHeight", "setWrapperSize", "virtualTranslate", "_effect", "breakpoints", "breakpointsBase", "_spaceBetween", "_slidesPerView", "maxBackfaceHiddenSlides", "_grid", "_slidesPerGroup", "_slidesPerGroupSkip", "_slidesPerGroupAuto", "_centeredSlides", "_centeredSlidesBounds", "_slidesOffsetBefore", "_slidesOffsetAfter", "normalizeSlideIndex", "_centerInsufficientSlides", "_snapToSlideEdge", "_watchOverflow", "roundLengths", "touchRatio", "touchAngle", "simulateTouch", "_shortSwipes", "_longSwipes", "longSwipesRatio", "longSwipesMs", "_followFinger", "allowTouchMove", "_threshold", "touchMoveStopPropagation", "touchStartPreventDefault", "touchStartForcePreventDefault", "touchReleaseOnEdges", "uniqueNavElements", "_resistance", "_resistanceRatio", "_watchSlidesProgress", "_grabCursor", "preventClicks", "preventClicksPropagation", "_slideToClickedSlide", "_loop", "loopAdditionalSlides", "loopAddBlankSlides", "loopPreventsSliding", "_rewind", "_allowSlidePrev", "_allowSlideNext", "_swipeHandler", "_noSwiping", "noSwipingClass", "noSwipingSelector", "passiveListeners", "containerModifierClass", "slideClass", "slideActiveClass", "slideVisibleClass", "slideFullyVisibleClass", "slideNextClass", "slidePrevClass", "slideBlankClass", "wrapperClass", "lazyPreloaderClass", "lazyPreloadPrevNext", "runCallbacksOnInit", "observer", "observeParents", "observeSlideChildren", "a11y", "_autoplay", "_controller", "coverflowEffect", "cubeEffect", "fadeEffect", "flipEffect", "creativeEffect", "cardsEffect", "hashNavigation", "history", "keyboard", "mousewheel", "_navigation", "_pagination", "parallax", "_scrollbar", "_thumbs", "virtual", "zoom", "control" ]; function isObject(o2) { if (typeof o2 !== "object" || o2 === null) return false; const obj = o2; return !!obj.constructor && Object.prototype.toString.call(obj).slice(8, -1) === "Object" && !obj.__swiper__; } function extend(target, src) { const noExtend = ["__proto__", "constructor", "prototype"]; const t2 = target; const s2 = src; Object.keys(s2).filter((key) => noExtend.indexOf(key) < 0).forEach((key) => { const srcVal = s2[key]; const targetVal = t2[key]; if (typeof targetVal === "undefined") { t2[key] = srcVal; } else if (isObject(srcVal) && isObject(targetVal) && Object.keys(srcVal).length > 0) { if (srcVal.__swiper__) { t2[key] = srcVal; } else { extend(targetVal, srcVal); } } else { t2[key] = srcVal; } }); return target; } function needsNavigation(params = {}) { const nav = params.navigation; if (!nav) return false; if (nav === true) return true; return typeof nav.nextEl === "undefined" && typeof nav.prevEl === "undefined"; } function needsPagination(params = {}) { const pag = params.pagination; if (!pag) return false; if (pag === true) return true; return typeof pag.el === "undefined"; } function needsScrollbar(params = {}) { const sb = params.scrollbar; if (!sb) return false; if (sb === true) return true; return typeof sb.el === "undefined"; } function uniqueClasses(classNames = "") { const classes2 = classNames.split(" ").map((c2) => c2.trim()).filter((c2) => !!c2); const unique = []; classes2.forEach((c2) => { if (unique.indexOf(c2) < 0) unique.push(c2); }); return unique.join(" "); } function wrapperClass(className = "") { if (!className) return "swiper-wrapper"; if (!className.includes("swiper-wrapper")) return `swiper-wrapper ${className}`; return className; } function updateSwiper(args) { let { nextEl, prevEl, scrollbarEl, paginationEl } = args; const { swiper, slides, passedParams, changedParams } = args; const updateParams = changedParams.filter((key) => key !== "children" && key !== "direction" && key !== "wrapperClass"); const { params: currentParams, pagination, navigation, scrollbar, virtual, thumbs } = swiper; const passed = passedParams; const current = currentParams; let needThumbsInit; let needControllerInit; let needPaginationInit; let needScrollbarInit; let needNavigationInit; let loopNeedDestroy; let loopNeedEnable; let loopNeedReloop; const passedThumbs = passed.thumbs; const currentThumbs = current.thumbs; if (changedParams.includes("thumbs") && isObject(passedThumbs) && passedThumbs.swiper && !passedThumbs.swiper.destroyed && isObject(currentThumbs) && (!currentThumbs.swiper || currentThumbs.swiper.destroyed)) { needThumbsInit = true; } const passedController = passed.controller; const currentController = current.controller; if (changedParams.includes("controller") && isObject(passedController) && passedController.control && isObject(currentController) && !currentController.control) { needControllerInit = true; } const passedPagination = passed.pagination; if (changedParams.includes("pagination") && isObject(passedPagination) && (passedPagination.el || paginationEl) && (current.pagination || current.pagination === false) && pagination && !pagination.el) { needPaginationInit = true; } const passedScrollbar = passed.scrollbar; if (changedParams.includes("scrollbar") && isObject(passedScrollbar) && (passedScrollbar.el || scrollbarEl) && (current.scrollbar || current.scrollbar === false) && scrollbar && !scrollbar.el) { needScrollbarInit = true; } const passedNavigation = passed.navigation; if (changedParams.includes("navigation") && isObject(passedNavigation) && (passedNavigation.prevEl || prevEl) && (passedNavigation.nextEl || nextEl) && (current.navigation || current.navigation === false) && navigation && !navigation.prevEl && !navigation.nextEl) { needNavigationInit = true; } const destroyModule = (mod) => { const moduleInstance = swiper[mod]; if (!moduleInstance) return; moduleInstance.destroy(); const currentModule = current[mod]; const currentObj = isObject(currentModule) ? currentModule : void 0; if (mod === "navigation") { if (swiper.isElement) { moduleInstance.prevEl?.remove(); moduleInstance.nextEl?.remove(); } if (currentObj) { currentObj.prevEl = void 0; currentObj.nextEl = void 0; } moduleInstance.prevEl = void 0; moduleInstance.nextEl = void 0; } else { if (swiper.isElement) { moduleInstance.el?.remove(); } if (currentObj) currentObj.el = void 0; moduleInstance.el = void 0; } }; if (changedParams.includes("loop") && swiper.isElement) { if (currentParams.loop && !passedParams.loop) { loopNeedDestroy = true; } else if (!currentParams.loop && passedParams.loop) { loopNeedEnable = true; } else { loopNeedReloop = true; } } updateParams.forEach((key) => { const currentValue = current[key]; const passedValue = passed[key]; if (isObject(currentValue) && isObject(passedValue)) { Object.assign(currentValue, passedValue); if ((key === "navigation" || key === "pagination" || key === "scrollbar") && "enabled" in passedValue && !passedValue.enabled) { destroyModule(key); } } else { if ((passedValue === true || passedValue === false) && (key === "navigation" || key === "pagination" || key === "scrollbar")) { if (passedValue === false) { destroyModule(key); } } else { current[key] = passedValue; } } }); if (updateParams.includes("controller") && !needControllerInit && swiper.controller && swiper.controller.control && isObject(currentController) && currentController.control) { swiper.controller.control = currentController.control; } if (changedParams.includes("children") && slides && virtual && currentParams.virtual?.enabled) { virtual.slides = slides; virtual.update(true); } else if (changedParams.includes("virtual") && virtual && currentParams.virtual?.enabled) { if (slides) virtual.slides = slides; virtual.update(true); } if (changedParams.includes("children") && slides && currentParams.loop) { loopNeedReloop = true; } if (needThumbsInit && thumbs) { const initialized = thumbs.init(); if (initialized) thumbs.update(true); } if (needControllerInit && swiper.controller && isObject(currentController)) { swiper.controller.control = currentController.control; } if (needPaginationInit && pagination) { if (swiper.isElement && (!paginationEl || typeof paginationEl === "string")) { const el = document.createElement("div"); el.classList.add("swiper-pagination"); el.part.add("pagination"); swiper.el.appendChild(el); paginationEl = el; } const paginationParams = current.pagination; if (paginationEl && isObject(paginationParams)) paginationParams.el = paginationEl; pagination.init(); pagination.render(); pagination.update(); } if (needScrollbarInit && scrollbar) { if (swiper.isElement && (!scrollbarEl || typeof scrollbarEl === "string")) { const el = document.createElement("div"); el.classList.add("swiper-scrollbar"); el.part.add("scrollbar"); swiper.el.appendChild(el); scrollbarEl = el; } const scrollbarParams = current.scrollbar; if (scrollbarEl && isObject(scrollbarParams)) scrollbarParams.el = scrollbarEl; scrollbar.init(); scrollbar.updateSize(); scrollbar.setTranslate(); } if (needNavigationInit && navigation) { if (swiper.isElement) { if (!nextEl || typeof nextEl === "string") { const el = document.createElement("div"); el.classList.add("swiper-button-next"); setInnerHTML(el, navigation.arrowSvg); el.part.add("button-next"); swiper.el.appendChild(el); nextEl = el; } if (!prevEl || typeof prevEl === "string") { const el = document.createElement("div"); el.classList.add("swiper-button-prev"); setInnerHTML(el, navigation.arrowSvg); el.part.add("button-prev"); swiper.el.appendChild(el); prevEl = el; } } const navigationParams = current.navigation; if (nextEl && isObject(navigationParams)) navigationParams.nextEl = nextEl; if (prevEl && isObject(navigationParams)) navigationParams.prevEl = prevEl; navigation.init(); navigation.update(); } if (changedParams.includes("allowSlideNext")) { swiper.allowSlideNext = passed.allowSlideNext; } if (changedParams.includes("allowSlidePrev")) { swiper.allowSlidePrev = passed.allowSlidePrev; } if (changedParams.includes("direction")) { swiper.changeDirection(passed.direction, false); } if (loopNeedDestroy || loopNeedReloop) { swiper.loopDestroy(); } if (loopNeedEnable || loopNeedReloop) { swiper.loopCreate(); } swiper.update(); } let supportCached; function calcSupport() { if (typeof window === "undefined") return { touch: false }; return { touch: "ontouchstart" in window || navigator.maxTouchPoints > 0 }; } function getSupport() { if (!supportCached) supportCached = calcSupport(); return supportCached; } let deviceCached; function calcDevice({ userAgent } = {}) { if (typeof window === "undefined") return { ios: false, android: false }; const support = getSupport(); const platform = navigator.platform; const ua = userAgent || navigator.userAgent; const device = { ios: false, android: false }; const isAndroid = /(Android);?[\s/]+([\d.]+)?/.test(ua); const isIPhoneOrIPod = /(iPhone\sOS|iOS|iPod)/.test(ua); const isIPadDirect = /iPad/.test(ua); const isIPadMasquerade = platform === "MacIntel" && support.touch && navigator.maxTouchPoints > 1; const isIPad = isIPadDirect || isIPadMasquerade; const isWindows = platform === "Win32"; if (isAndroid && !isWindows) { device.os = "android"; device.android = true; } if (isIPad || isIPhoneOrIPod) { device.os = "ios"; device.ios = true; } return device; } function getDevice(overrides = {}) { if (!deviceCached) deviceCached = calcDevice(overrides); return deviceCached; } let browserCached; function calcBrowser() { if (typeof window === "undefined") { return { isSafari: false, isWebView: false, need3dFix: false }; } const device = getDevice(); const ua = navigator.userAgent; const uaLower = ua.toLowerCase(); const isSafari = uaLower.includes("safari") && !uaLower.includes("chrome") && !uaLower.includes("android"); const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(ua); const need3dFix = isSafari || isWebView && device.ios; return { isSafari, isWebView, need3dFix }; } function getBrowser() { if (!browserCached) browserCached = calcBrowser(); return browserCached; } const processLazyPreloader = (swiper, imageEl) => { if (!swiper || swiper.destroyed || !swiper.params) return; const slideSelector = () => swiper.isElement ? "swiper-slide" : `.${swiper.params.slideClass}`; const slideEl = imageEl.closest(slideSelector()); if (slideEl) { let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`); if (!lazyEl && swiper.isElement) { if (slideEl.shadowRoot) { lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`); } else { requestAnimationFrame(() => { if (slideEl.shadowRoot) { const innerLazy = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`); if (innerLazy && !innerLazy.lazyPreloaderManaged) innerLazy.remove(); } }); } } if (lazyEl && !lazyEl.lazyPreloaderManaged) lazyEl.remove(); } }; const unlazy = (swiper, index) => { if (!swiper.slides[index]) return; const imageEl = swiper.slides[index].querySelector('[loading="lazy"]'); if (imageEl) imageEl.removeAttribute("loading"); }; const preload = (swiper) => { if (!swiper || swiper.destroyed || !swiper.params) return; let amount = swiper.params.lazyPreloadPrevNext; const len = swiper.slides.length; if (!len || !amount || amount < 0) return; amount = Math.min(amount, len); const slidesPerView = swiper.params.slidesPerView === "auto" ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView); const activeIndex = swiper.activeIndex; if (swiper.params.grid && (swiper.params.grid.rows ?? 1) > 1) { const activeColumn = activeIndex; const preloadColumns = [activeColumn - amount]; preloadColumns.push(...Array.from({ length: amount }).map((_2, i3) => activeColumn + slidesPerView + i3)); swiper.slides.forEach((slideEl, i3) => { if (slideEl.column !== void 0 && preloadColumns.includes(slideEl.column)) unlazy(swiper, i3); }); return; } const slideIndexLastInView = activeIndex + slidesPerView - 1; if (swiper.params.rewind || swiper.params.loop) { for (let i3 = activeIndex - amount; i3 <= slideIndexLastInView + amount; i3 += 1) { const realIndex = (i3 % len + len) % len; if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex); } } else { for (let i3 = Math.max(activeIndex - amount, 0); i3 <= Math.min(slideIndexLastInView + amount, len - 1); i3 += 1) { if (i3 !== activeIndex && (i3 > slideIndexLastInView || i3 < activeIndex)) { unlazy(swiper, i3); } } } }; function getBreakpoint(breakpoints2, base = "window", containerEl) { if (!breakpoints2 || base === "container" && !containerEl) return void 0; let breakpoint = false; const currentHeight = base === "window" ? window.innerHeight : containerEl.clientHeight; const points = Object.keys(breakpoints2).map((point) => { if (typeof point === "string" && point.indexOf("@") === 0) { const minRatio = parseFloat(point.substr(1)); const value = currentHeight * minRatio; return { value, point }; } return { value: point, point }; }); points.sort((a3, b2) => parseInt(String(a3.value), 10) - parseInt(String(b2.value), 10)); for (let i3 = 0; i3 < points.length; i3 += 1) { const { point, value } = points[i3]; if (base === "window") { if (window.matchMedia(`(min-width: ${value}px)`).matches) { breakpoint = point; } } else if (value <= containerEl.clientWidth) { breakpoint = point; } } return breakpoint || "max"; } const isGridEnabled = (swiper, params) => { return !!(swiper.grid && params.grid && params.grid.rows > 1); }; function setBreakpoint() { const swiper = this; const { realIndex, initialized, params, el } = swiper; const breakpoints2 = params.breakpoints; if (!breakpoints2 || breakpoints2 && Object.keys(breakpoints2).length === 0) return; const breakpointsBase = params.breakpointsBase === "window" || !params.breakpointsBase ? params.breakpointsBase : "container"; const breakpointContainer = ["window", "container"].includes(params.breakpointsBase) || !params.breakpointsBase ? swiper.el : document.querySelector(params.breakpointsBase); const breakpoint = swiper.getBreakpoint(breakpoints2, breakpointsBase, breakpointContainer); if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; const breakpointsRecord = breakpoints2; const breakpointOnlyParams = breakpoint in breakpointsRecord ? breakpointsRecord[breakpoint] : void 0; const breakpointParams = breakpointOnlyParams || swiper.originalParams; const wasMultiRow = isGridEnabled(swiper, params); const isMultiRow = isGridEnabled(swiper, breakpointParams); const wasGrabCursor = swiper.params.grabCursor; const isGrabCursor = breakpointParams.grabCursor; const wasEnabled = params.enabled; if (wasMultiRow && !isMultiRow) { el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`); swiper.emitContainerClasses(); } else if (!wasMultiRow && isMultiRow) { el.classList.add(`${params.containerModifierClass}grid`); if (breakpointParams.grid.fill && breakpointParams.grid.fill === "column" || !breakpointParams.grid.fill && params.grid.fill === "column") { el.classList.add(`${params.containerModifierClass}grid-column`); } swiper.emitContainerClasses(); } if (wasGrabCursor && !isGrabCursor) { swiper.unsetGrabCursor(); } else if (!wasGrabCursor && isGrabCursor) { swiper.setGrabCursor(); } const moduleOpt = (opts, prop) => opts[prop]; ["navigation", "pagination", "scrollbar"].forEach((prop) => { const bpOpts = moduleOpt(breakpointParams, prop); if (typeof bpOpts === "undefined") return; const paramsOpts = moduleOpt(params, prop); const wasModuleEnabled = typeof paramsOpts === "object" && paramsOpts !== null && paramsOpts.enabled; const isModuleEnabled = typeof bpOpts === "object" && bpOpts !== null && bpOpts.enabled; const moduleApi = swiper[prop]; if (wasModuleEnabled && !isModuleEnabled) moduleApi?.disable?.(); if (!wasModuleEnabled && isModuleEnabled) moduleApi?.enable?.(); }); const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); const wasLoop = params.loop; if (directionChanged && initialized) { swiper.changeDirection(); } extend$1(swiper.params, breakpointParams); const isEnabled = swiper.params.enabled; const hasLoop = swiper.params.loop; Object.assign(swiper, { allowTouchMove: swiper.params.allowTouchMove, allowSlideNext: swiper.params.allowSlideNext, allowSlidePrev: swiper.params.allowSlidePrev }); if (wasEnabled && !isEnabled) { swiper.disable(); } else if (!wasEnabled && isEnabled) { swiper.enable(); } swiper.currentBreakpoint = breakpoint; swiper.emit("_beforeBreakpoint", breakpointParams); if (initialized) { if (needsReLoop) { swiper.loopDestroy(); swiper.loopCreate(realIndex); swiper.updateSlides(); } else if (!wasLoop && hasLoop) { swiper.loopCreate(realIndex); swiper.updateSlides(); } else if (wasLoop && !hasLoop) { swiper.loopDestroy(); } } swiper.emit("breakpoint", breakpointParams); } var breakpoints = { setBreakpoint, getBreakpoint }; function checkOverflow() { const swiper = this; const { isLocked: wasLocked, params } = swiper; const { slidesOffsetBefore } = params; if (slidesOffsetBefore) { const lastSlideIndex = swiper.slides.length - 1; const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; swiper.isLocked = swiper.size > lastSlideRightEdge; } else { swiper.isLocked = swiper.snapGrid.length === 1; } if (params.allowSlideNext === true) { swiper.allowSlideNext = !swiper.isLocked; } if (params.allowSlidePrev === true) { swiper.allowSlidePrev = !swiper.isLocked; } if (wasLocked && wasLocked !== swiper.isLocked) { swiper.isEnd = false; } if (wasLocked !== swiper.isLocked) { swiper.emit(swiper.isLocked ? "lock" : "unlock"); } } var checkOverflow$1 = { checkOverflow }; function prepareClasses(entries, prefix) { const resultClasses = []; entries.forEach((item) => { if (typeof item === "object") { Object.keys(item).forEach((classNames) => { if (item[classNames]) { resultClasses.push(prefix + classNames); } }); } else if (typeof item === "string") { resultClasses.push(prefix + item); } }); return resultClasses; } function addClasses() { const swiper = this; const { classNames, params, rtl, el, device } = swiper; const suffixes = prepareClasses([ "initialized", params.direction, { "free-mode": swiper.params.freeMode && params.freeMode.enabled }, { "autoheight": params.autoHeight }, { "rtl": rtl }, { "grid": params.grid && params.grid.rows > 1 }, { "grid-column": params.grid && params.grid.rows > 1 && params.grid.fill === "column" }, { "android": device.android }, { "ios": device.ios }, { "css-mode": params.cssMode }, { "centered": params.cssMode && params.centeredSlides }, { "watch-progress": params.watchSlidesProgress } ], params.containerModifierClass); classNames.push(...suffixes); el.classList.add(...classNames); swiper.emitContainerClasses(); } function removeClasses() { const swiper = this; const { el, classNames } = swiper; if (!el || typeof el === "string") return; el.classList.remove(...classNames); swiper.emitContainerClasses(); } var classes = { addClasses, removeClasses }; const defaults = { init: true, direction: "horizontal", oneWayMovement: false, swiperElementNodeName: "SWIPER-CONTAINER", touchEventsTarget: "wrapper", initialSlide: 0, speed: 300, cssMode: false, updateOnWindowResize: true, resizeObserver: true, nested: false, createElements: false, eventsPrefix: "swiper", enabled: true, focusableElements: "input, select, option, textarea, button, video, label", width: null, height: null, preventInteractionOnTransition: false, userAgent: null, url: null, edgeSwipeDetection: false, edgeSwipeThreshold: 20, autoHeight: false, setWrapperSize: false, virtualTranslate: false, effect: "slide", breakpoints: void 0, breakpointsBase: "window", spaceBetween: 0, slidesPerView: 1, slidesPerGroup: 1, slidesPerGroupSkip: 0, slidesPerGroupAuto: false, centeredSlides: false, centeredSlidesBounds: false, slidesOffsetBefore: 0, slidesOffsetAfter: 0, normalizeSlideIndex: true, centerInsufficientSlides: false, snapToSlideEdge: false, watchOverflow: true, roundLengths: false, touchRatio: 1, touchAngle: 45, simulateTouch: true, shortSwipes: true, longSwipes: true, longSwipesRatio: 0.5, longSwipesMs: 300, followFinger: true, allowTouchMove: true, threshold: 5, touchMoveStopPropagation: false, touchStartPreventDefault: true, touchStartForcePreventDefault: false, touchReleaseOnEdges: false, uniqueNavElements: true, resistance: true, resistanceRatio: 0.85, watchSlidesProgress: false, grabCursor: false, preventClicks: true, preventClicksPropagation: true, slideToClickedSlide: false, loop: false, loopAddBlankSlides: true, loopAdditionalSlides: 0, loopPreventsSliding: true, rewind: false, allowSlidePrev: true, allowSlideNext: true, swipeHandler: null, noSwiping: true, noSwipingClass: "swiper-no-swiping", noSwipingSelector: null, passiveListeners: true, maxBackfaceHiddenSlides: 10, containerModifierClass: "swiper-", slideClass: "swiper-slide", slideBlankClass: "swiper-slide-blank", slideActiveClass: "swiper-slide-active", slideVisibleClass: "swiper-slide-visible", slideFullyVisibleClass: "swiper-slide-fully-visible", slideNextClass: "swiper-slide-next", slidePrevClass: "swiper-slide-prev", wrapperClass: "swiper-wrapper", lazyPreloaderClass: "swiper-lazy-preloader", lazyPreloadPrevNext: 0, runCallbacksOnInit: true, _emitClasses: false }; var eventsEmitter = { on(events2, handler, priority) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (typeof handler !== "function") return self; const method = priority ? "unshift" : "push"; events2.split(" ").forEach((event) => { if (!self.eventsListeners[event]) self.eventsListeners[event] = []; self.eventsListeners[event][method](handler); }); return self; }, once(events2, handler, priority) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (typeof handler !== "function") return self; const onceHandler = function onceHandlerFn(...args) { self.off(events2, onceHandler); if (onceHandler.__emitterProxy) { delete onceHandler.__emitterProxy; } handler.apply(self, args); }; onceHandler.__emitterProxy = handler; return self.on(events2, onceHandler, priority); }, onAny(handler, priority) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (typeof handler !== "function") return self; const method = priority ? "unshift" : "push"; if (self.eventsAnyListeners.indexOf(handler) < 0) { self.eventsAnyListeners[method](handler); } return self; }, offAny(handler) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (!self.eventsAnyListeners) return self; const index = self.eventsAnyListeners.indexOf(handler); if (index >= 0) { self.eventsAnyListeners.splice(index, 1); } return self; }, off(events2, handler) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (!self.eventsListeners) return self; events2.split(" ").forEach((event) => { if (typeof handler === "undefined") { self.eventsListeners[event] = []; } else if (self.eventsListeners[event]) { self.eventsListeners[event].forEach((eventHandler, index) => { if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) { self.eventsListeners[event].splice(index, 1); } }); } }); return self; }, emit(...args) { const self = this; if (!self.eventsListeners || self.destroyed) return self; if (!self.eventsListeners) return self; let events2; let data; let context; if (typeof args[0] === "string" || Array.isArray(args[0])) { events2 = args[0]; data = args.slice(1, args.length); context = self; } else { const opts = args[0]; events2 = opts.events; data = opts.data ?? []; context = opts.context || self; } data.unshift(context); const eventsArray = Array.isArray(events2) ? events2 : events2.split(" "); eventsArray.forEach((event) => { if (self.eventsAnyListeners && self.eventsAnyListeners.length) { self.eventsAnyListeners.forEach((eventHandler) => { eventHandler.apply(context, [event, ...data]); }); } if (self.eventsListeners && self.eventsListeners[event]) { self.eventsListeners[event].forEach((eventHandler) => { eventHandler.apply(context, data); }); } }); return self; } }; function onClick(e3) { const swiper = this; if (swiper.destroyed) return; if (!swiper.enabled) return; if (!swiper.allowClick) { if (swiper.params.preventClicks) e3.preventDefault(); if (swiper.params.preventClicksPropagation && swiper.animating) { e3.stopPropagation(); e3.stopImmediatePropagation(); } } } function onDocumentTouchStart() { const swiper = this; if (swiper.destroyed) return; if (swiper.documentTouchHandlerProceeded) return; swiper.documentTouchHandlerProceeded = true; if (swiper.params.touchReleaseOnEdges) { swiper.el.style.touchAction = "auto"; } } function onLoad(e3) { const swiper = this; if (swiper.destroyed) return; processLazyPreloader(swiper, e3.target); if (swiper.params.cssMode || swiper.params.slidesPerView !== "auto" && !swiper.params.autoHeight) { return; } swiper.update(); } function onResize() { const swiper = this; const { params, el } = swiper; if (el && el.offsetWidth === 0) return; if (params.breakpoints) { swiper.setBreakpoint(); } const { allowSlideNext, allowSlidePrev, snapGrid } = swiper; const isVirtual = swiper.virtual && swiper.params.virtual?.enabled; swiper.allowSlideNext = true; swiper.allowSlidePrev = true; swiper.updateSize(); swiper.updateSlides(); swiper.updateSlidesClasses(); const isVirtualLoop = isVirtual && params.loop; if ((params.slidesPerView === "auto" || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) { const slidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; swiper.slideTo(slidesLength - 1, 0, false, true); } else { if (swiper.params.loop && !isVirtual) { swiper.slideToLoop(swiper.realIndex, 0, false, true); } else { swiper.slideTo(swiper.activeIndex, 0, false, true); } } if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { const autoplay = swiper.autoplay; clearTimeout(autoplay.resizeTimeout); autoplay.resizeTimeout = setTimeout(() => { if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { swiper.autoplay.resume(); } }, 500); } swiper.allowSlidePrev = allowSlidePrev; swiper.allowSlideNext = allowSlideNext; if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { swiper.checkOverflow(); } } function onScroll() { const swiper = this; if (swiper.destroyed) return; const { wrapperEl, rtlTranslate, enabled } = swiper; if (!enabled) return; swiper.previousTranslate = swiper.translate; if (swiper.isHorizontal()) { swiper.translate = -wrapperEl.scrollLeft; } else { swiper.translate = -wrapperEl.scrollTop; } if (swiper.translate === 0) swiper.translate = 0; swiper.updateActiveIndex(); swiper.updateSlidesClasses(); let newProgress; const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); if (translatesDiff === 0) { newProgress = 0; } else { newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; } if (newProgress !== swiper.progress) { swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); } swiper.emit("setTranslate", swiper.translate, false); } function onTouchEnd(event) { const swiper = this; if (swiper.destroyed) return; const data = swiper.touchEventsData; let e3 = event.originalEvent ?? event; const isTouchEvent = e3.type === "touchend" || e3.type === "touchcancel"; if (!isTouchEvent) { if (data.touchId !== null) return; const pe2 = e3; if (pe2.pointerId !== data.pointerId) return; } else { const te = e3; const found = [...te.changedTouches].find((t2) => t2.identifier === data.touchId); if (!found || found.identifier !== data.touchId) return; } if (["pointercancel", "pointerout", "pointerleave", "contextmenu"].includes(e3.type)) { const proceed = ["pointercancel", "contextmenu"].includes(e3.type) && (swiper.browser.isSafari || swiper.browser.isWebView); if (!proceed) { return; } } data.pointerId = null; data.touchId = null; const { params, touches, rtlTranslate: rtl, slidesGrid, enabled } = swiper; if (!enabled) return; if (!params.simulateTouch && e3.pointerType === "mouse") return; if (data.allowTouchCallbacks) { swiper.emit("touchEnd", e3); } data.allowTouchCallbacks = false; if (!data.isTouched) { if (data.isMoved && params.grabCursor) { swiper.setGrabCursor(false); } data.isMoved = false; data.startMoving = false; return; } if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { swiper.setGrabCursor(false); } const touchEndTime = now(); const timeDiff = touchEndTime - data.touchStartTime; if (swiper.allowClick) { const pathTree = e3.path ?? (e3.composedPath && e3.composedPath()); swiper.updateClickedSlide(pathTree && pathTree[0], pathTree); swiper.emit("tap click", e3); if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) { swiper.emit("doubleTap doubleClick", e3); } } data.lastClickTime = now(); nextTick(() => { if (!swiper.destroyed) swiper.allowClick = true; }); if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) { data.isTouched = false; data.isMoved = false; data.startMoving = false; return; } data.isTouched = false; data.isMoved = false; data.startMoving = false; let currentPos; if (params.followFinger) { currentPos = rtl ? swiper.translate : -swiper.translate; } else { currentPos = -(data.currentTranslate ?? 0); } if (params.cssMode) { return; } if (params.freeMode && params.freeMode.enabled) { swiper.freeMode.onTouchEnd({ currentPos }); return; } const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop; let stopIndex = 0; let groupSize = swiper.slidesSizesGrid[0]; for (let i3 = 0; i3 < slidesGrid.length; i3 += i3 < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) { const increment2 = i3 < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; if (typeof slidesGrid[i3 + increment2] !== "undefined") { if (swipeToLast || currentPos >= slidesGrid[i3] && currentPos < slidesGrid[i3 + increment2]) { stopIndex = i3; groupSize = slidesGrid[i3 + increment2] - slidesGrid[i3]; } } else if (swipeToLast || currentPos >= slidesGrid[i3]) { stopIndex = i3; groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; } } let rewindFirstIndex = null; let rewindLastIndex = null; if (params.rewind) { if (swiper.isBeginning) { rewindLastIndex = params.virtual?.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; } else if (swiper.isEnd) { rewindFirstIndex = 0; } } const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; if (timeDiff > params.longSwipesMs) { if (!params.longSwipes) { swiper.slideTo(swiper.activeIndex); return; } if (swiper.swipeDirection === "next") { if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment); else swiper.slideTo(stopIndex); } if (swiper.swipeDirection === "prev") { if (ratio > 1 - params.longSwipesRatio) { swiper.slideTo(stopIndex + increment); } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) { swiper.slideTo(rewindLastIndex); } else { swiper.slideTo(stopIndex); } } } else { if (!params.shortSwipes) { swiper.slideTo(swiper.activeIndex); return; } const isNavButtonTarget = swiper.navigation && (e3.target === swiper.navigation.nextEl || e3.target === swiper.navigation.prevEl); if (!isNavButtonTarget) { if (swiper.swipeDirection === "next") { swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment); } if (swiper.swipeDirection === "prev") { swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex); } } else if (e3.target === swiper.navigation.nextEl) { swiper.slideTo(stopIndex + increment); } else { swiper.slideTo(stopIndex); } } } function onTouchMove(event) { const swiper = this; if (swiper.destroyed) return; const data = swiper.touchEventsData; const { params, touches, rtlTranslate: rtl, enabled } = swiper; if (!enabled) return; if (!params.simulateTouch && event.pointerType === "mouse") return; const wrapped = event; const e3 = wrapped.originalEvent ?? wrapped; if (e3.type === "pointermove") { if (data.touchId !== null) return; const pe2 = e3; if (pe2.pointerId !== data.pointerId) return; } let targetTouch; if (e3.type === "touchmove") { const te = e3; const found = [...te.changedTouches].find((t2) => t2.identifier === data.touchId); if (!found || found.identifier !== data.touchId) return; targetTouch = found; } else { targetTouch = e3; } if (!data.isTouched) { if (data.startMoving && data.isScrolling) { swiper.emit("touchMoveOpposite", e3); } return; } const pageX = targetTouch.pageX; const pageY = targetTouch.pageY; if (e3.preventedByNestedSwiper) { touches.startX = pageX; touches.startY = pageY; return; } if (!swiper.allowTouchMove) { if (!e3.target.matches(data.focusableElements)) { swiper.allowClick = false; } if (data.isTouched) { Object.assign(touches, { startX: pageX, startY: pageY, currentX: pageX, currentY: pageY }); data.touchStartTime = now(); } return; } if (params.touchReleaseOnEdges && !params.loop) { if (swiper.isVertical()) { if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { data.isTouched = false; data.isMoved = false; return; } } else if (rtl && (pageX > touches.startX && -swiper.translate <= swiper.maxTranslate() || pageX < touches.startX && -swiper.translate >= swiper.minTranslate())) { return; } else if (!rtl && (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate())) { return; } } if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== e3.target && e3.pointerType !== "mouse") { document.activeElement.blur(); } if (document.activeElement) { if (e3.target === document.activeElement && e3.target.matches(data.focusableElements)) { data.isMoved = true; swiper.allowClick = false; return; } } if (data.allowTouchCallbacks) { swiper.emit("touchMove", e3); } touches.previousX = touches.currentX; touches.previousY = touches.currentY; touches.currentX = pageX; touches.currentY = pageY; const diffX = touches.currentX - touches.startX; const diffY = touches.currentY - touches.startY; if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return; if (typeof data.isScrolling === "undefined") { let touchAngle; if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) { data.isScrolling = false; } else { if (diffX * diffX + diffY * diffY >= 25) { touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; } } } if (data.isScrolling) { swiper.emit("touchMoveOpposite", e3); } if (typeof data.startMoving === "undefined") { if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { data.startMoving = true; } } if (data.isScrolling || e3.type === "touchmove" && data.preventTouchMoveFromPointerMove) { data.isTouched = false; return; } if (!data.startMoving) { return; } swiper.allowClick = false; if (!params.cssMode && e3.cancelable) { e3.preventDefault(); } if (params.touchMoveStopPropagation && !params.nested) { e3.stopPropagation(); } let diff = swiper.isHorizontal() ? diffX : diffY; let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY; if (params.oneWayMovement) { diff = Math.abs(diff) * (rtl ? 1 : -1); touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1); } touches.diff = diff; diff *= params.touchRatio; if (rtl) { diff = -diff; touchesDiff = -touchesDiff; } const prevTouchesDirection = swiper.touchesDirection; swiper.swipeDirection = diff > 0 ? "prev" : "next"; swiper.touchesDirection = touchesDiff > 0 ? "prev" : "next"; const isLoop = swiper.params.loop && !params.cssMode; const allowLoopFix = swiper.touchesDirection === "next" && swiper.allowSlideNext || swiper.touchesDirection === "prev" && swiper.allowSlidePrev; if (!data.isMoved) { if (isLoop && allowLoopFix) { swiper.loopFix({ direction: swiper.swipeDirection }); } data.startTranslate = swiper.getTranslate(); swiper.setTransition(0); if (swiper.animating) { const evt = new window.CustomEvent("transitionend", { bubbles: true, cancelable: true, detail: { bySwiperTouchMove: true } }); swiper.wrapperEl.dispatchEvent(evt); } data.allowMomentumBounce = false; if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { swiper.setGrabCursor(true); } swiper.emit("sliderFirstMove", e3); } ( new Date()).getTime(); if (params._loopSwapReset !== false && data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) { Object.assign(touches, { startX: pageX, startY: pageY, currentX: pageX, currentY: pageY, startTranslate: data.currentTranslate }); data.loopSwapReset = true; data.startTranslate = data.currentTranslate; return; } swiper.emit("sliderMove", e3); data.isMoved = true; const startTranslate = data.startTranslate ?? 0; data.currentTranslate = diff + startTranslate; let disableParentSwiper = true; let resistanceRatio = params.resistanceRatio; if (params.touchReleaseOnEdges) { resistanceRatio = 0; } if (diff > 0) { if (isLoop && allowLoopFix && true && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] - (params.slidesPerView !== "auto" && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.activeIndex + 1] + swiper.params.spaceBetween : 0) - swiper.params.spaceBetween : swiper.minTranslate())) { swiper.loopFix({ direction: "prev", setTranslate: true, activeSlideIndex: 0 }); } if (data.currentTranslate > swiper.minTranslate()) { disableParentSwiper = false; if (params.resistance) { data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + startTranslate + diff) ** resistanceRatio; } } } else if (diff < 0) { if (isLoop && allowLoopFix && true && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween + (params.slidesPerView !== "auto" && swiper.slides.length - params.slidesPerView >= 2 ? swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] + swiper.params.spaceBetween : 0) : swiper.maxTranslate())) { swiper.loopFix({ direction: "next", setTranslate: true, activeSlideIndex: swiper.slides.length - (params.slidesPerView === "auto" ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(String(params.slidesPerView)))) }); } if (data.currentTranslate < swiper.maxTranslate()) { disableParentSwiper = false; if (params.resistance) { data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - startTranslate - diff) ** resistanceRatio; } } } if (disableParentSwiper) { e3.preventedByNestedSwiper = true; } if (!swiper.allowSlideNext && swiper.swipeDirection === "next" && (data.currentTranslate ?? 0) < startTranslate) { data.currentTranslate = startTranslate; } if (!swiper.allowSlidePrev && swiper.swipeDirection === "prev" && (data.currentTranslate ?? 0) > startTranslate) { data.currentTranslate = startTranslate; } if (!swiper.allowSlidePrev && !swiper.allowSlideNext) { data.currentTranslate = startTranslate; } if (params.threshold > 0) { if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { if (!data.allowThresholdMove) { data.allowThresholdMove = true; touches.startX = touches.currentX; touches.startY = touches.currentY; data.currentTranslate = data.startTranslate; touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; return; } } else { data.currentTranslate = data.startTranslate; return; } } if (!params.followFinger || params.cssMode) return; if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } if (params.freeMode && params.freeMode.enabled && swiper.freeMode) { swiper.freeMode.onTouchMove(); } swiper.updateProgress(data.currentTranslate); swiper.setTranslate(data.currentTranslate ?? 0); } function closestElement(selector, base) { function __closestFrom(el) { if (!el || el === document || el === window) return null; let cur = el; if (cur.assignedSlot) cur = cur.assignedSlot; const found = cur.closest(selector); if (!found && !cur.getRootNode) { return null; } const root = cur.getRootNode(); return found || __closestFrom(root.host); } return __closestFrom(base); } function preventEdgeSwipe(swiper, event, startX) { const { params } = swiper; const edgeSwipeDetection = params.edgeSwipeDetection; const edgeSwipeThreshold = params.edgeSwipeThreshold; if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) { if (edgeSwipeDetection === "prevent") { event.preventDefault(); return true; } return false; } return true; } function onTouchStart(event) { const swiper = this; if (swiper.destroyed) return; const e3 = event.originalEvent ?? event; const data = swiper.touchEventsData; if (e3.type === "pointerdown") { const pe3 = e3; if (data.pointerId !== null && data.pointerId !== pe3.pointerId) { return; } data.pointerId = pe3.pointerId; } else if (e3.type === "touchstart" && e3.targetTouches.length === 1) { data.touchId = e3.targetTouches[0].identifier; } if (e3.type === "touchstart") { preventEdgeSwipe(swiper, e3, e3.targetTouches[0].pageX); return; } const { params, touches, enabled } = swiper; if (!enabled) return; if (!params.simulateTouch && e3.pointerType === "mouse") return; if (swiper.animating && params.preventInteractionOnTransition) { return; } if (!swiper.animating && params.cssMode && params.loop) { swiper.loopFix(); } let targetEl = e3.target; if (params.touchEventsTarget === "wrapper") { if (!elementIsChildOf(targetEl, swiper.wrapperEl)) return; } const mouseLike = e3; if (typeof mouseLike.which === "number" && mouseLike.which === 3) return; if (typeof mouseLike.button === "number" && mouseLike.button > 0) return; if (data.isTouched && data.isMoved) return; const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ""; const eventPath = e3.composedPath ? e3.composedPath() : e3.path; if (swipingClassHasValue && e3.target && e3.target.shadowRoot && eventPath) { targetEl = eventPath[0]; } const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`; const isTargetShadow = !!(e3.target && e3.target.shadowRoot); if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) { swiper.allowClick = true; return; } if (params.swipeHandler) { if (typeof params.swipeHandler === "string" && !targetEl.closest(params.swipeHandler)) return; } const pe2 = e3; touches.currentX = pe2.pageX; touches.currentY = pe2.pageY; const startX = touches.currentX; const startY = touches.currentY; if (!preventEdgeSwipe(swiper, e3, startX)) { return; } Object.assign(data, { isTouched: true, isMoved: false, allowTouchCallbacks: true, isScrolling: void 0, startMoving: void 0 }); touches.startX = startX; touches.startY = startY; data.touchStartTime = now(); swiper.allowClick = true; swiper.updateSize(); swiper.swipeDirection = void 0; if (params.threshold > 0) data.allowThresholdMove = false; let preventDefault = true; if (targetEl.matches(data.focusableElements)) { preventDefault = false; if (targetEl.nodeName === "SELECT") { data.isTouched = false; } } if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl && (pe2.pointerType === "mouse" || pe2.pointerType !== "mouse" && !targetEl.matches(data.focusableElements))) { document.activeElement.blur(); } const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) { e3.preventDefault(); } if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) { swiper.freeMode.onTouchStart(); } swiper.emit("touchStart", e3); } const events = (swiper, method) => { const { params, el, wrapperEl, device } = swiper; const capture = !!params.nested; const domMethod = method === "on" ? "addEventListener" : "removeEventListener"; const swiperMethod = method; if (!el || typeof el === "string") return; document[domMethod]("touchstart", swiper.onDocumentTouchStart, { passive: false, capture }); el[domMethod]("touchstart", swiper.onTouchStart, { passive: false }); el[domMethod]("pointerdown", swiper.onTouchStart, { passive: false }); document[domMethod]("touchmove", swiper.onTouchMove, { passive: false, capture }); document[domMethod]("pointermove", swiper.onTouchMove, { passive: false, capture }); document[domMethod]("touchend", swiper.onTouchEnd, { passive: true }); document[domMethod]("pointerup", swiper.onTouchEnd, { passive: true }); document[domMethod]("pointercancel", swiper.onTouchEnd, { passive: true }); document[domMethod]("touchcancel", swiper.onTouchEnd, { passive: true }); document[domMethod]("pointerout", swiper.onTouchEnd, { passive: true }); document[domMethod]("pointerleave", swiper.onTouchEnd, { passive: true }); document[domMethod]("contextmenu", swiper.onTouchEnd, { passive: true }); if (params.preventClicks || params.preventClicksPropagation) { el[domMethod]("click", swiper.onClick, true); } if (params.cssMode) { wrapperEl[domMethod]("scroll", swiper.onScroll); } const subscribe = (events2) => { swiper[swiperMethod](events2, onResize, true); }; if (params.updateOnWindowResize) { subscribe(device.ios || device.android ? "resize orientationchange observerUpdate" : "resize observerUpdate"); } else { subscribe("observerUpdate"); } el[domMethod]("load", swiper.onLoad, { capture: true }); }; function attachEvents() { const swiper = this; const { params } = swiper; swiper.onTouchStart = onTouchStart.bind(swiper); swiper.onTouchMove = onTouchMove.bind(swiper); swiper.onTouchEnd = onTouchEnd.bind(swiper); swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper); if (params.cssMode) { swiper.onScroll = onScroll.bind(swiper); } swiper.onClick = onClick.bind(swiper); swiper.onLoad = onLoad.bind(swiper); events(swiper, "on"); } function detachEvents() { const swiper = this; events(swiper, "off"); } var events$1 = { attachEvents, detachEvents }; function setGrabCursor(moving) { const swiper = this; if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; const el = swiper.params.touchEventsTarget === "container" ? swiper.el : swiper.wrapperEl; if (swiper.isElement) { swiper.__preventObserver__ = true; } el.style.cursor = "move"; el.style.cursor = moving ? "grabbing" : "grab"; if (swiper.isElement) { requestAnimationFrame(() => { swiper.__preventObserver__ = false; }); } } function unsetGrabCursor() { const swiper = this; if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) { return; } if (swiper.isElement) { swiper.__preventObserver__ = true; } swiper[swiper.params.touchEventsTarget === "container" ? "el" : "wrapperEl"].style.cursor = ""; if (swiper.isElement) { requestAnimationFrame(() => { swiper.__preventObserver__ = false; }); } } var grabCursor = { setGrabCursor, unsetGrabCursor }; function loopCreate(slideRealIndex, initial) { const swiper = this; const { params, slidesEl } = swiper; if (!params.loop || swiper.virtual && swiper.params.virtual?.enabled) return; const initSlides = () => { const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); slides.forEach((el, index) => { el.setAttribute("data-swiper-slide-index", String(index)); }); }; const clearBlankSlides = () => { const slides = elementChildren(slidesEl, `.${params.slideBlankClass}`); slides.forEach((el) => { el.remove(); }); if (slides.length > 0) { swiper.recalcSlides(); swiper.updateSlides(); } }; const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; if (params.loopAddBlankSlides && (params.slidesPerGroup > 1 || gridEnabled)) { clearBlankSlides(); } const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1); const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0; const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0; const addBlankSlides = (amountOfSlides) => { for (let i3 = 0; i3 < amountOfSlides; i3 += 1) { const slideEl = swiper.isElement ? createElement("swiper-slide", [params.slideBlankClass]) : createElement("div", [params.slideClass, params.slideBlankClass]); swiper.slidesEl.append(slideEl); } }; if (shouldFillGroup) { if (params.loopAddBlankSlides) { const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup; addBlankSlides(slidesToAdd); swiper.recalcSlides(); swiper.updateSlides(); } else { showWarning("Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)"); } initSlides(); } else if (shouldFillGrid) { if (params.loopAddBlankSlides) { const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows; addBlankSlides(slidesToAdd); swiper.recalcSlides(); swiper.updateSlides(); } else { showWarning("Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)"); } initSlides(); } else { initSlides(); } const bothDirections = params.centeredSlides || !!params.slidesOffsetBefore || !!params.slidesOffsetAfter; swiper.loopFix({ slideRealIndex, direction: bothDirections ? void 0 : "next", initial }); } function loopDestroy() { const swiper = this; const { params, slidesEl } = swiper; if (!params.loop || !slidesEl || swiper.virtual && swiper.params.virtual?.enabled) return; swiper.recalcSlides(); const newSlidesOrder = []; swiper.slides.forEach((slideEl) => { const loopSlideEl = slideEl; const index = typeof loopSlideEl.swiperSlideIndex === "undefined" ? Number(slideEl.getAttribute("data-swiper-slide-index")) : loopSlideEl.swiperSlideIndex; newSlidesOrder[index] = slideEl; }); swiper.slides.forEach((slideEl) => { slideEl.removeAttribute("data-swiper-slide-index"); }); newSlidesOrder.forEach((slideEl) => { slidesEl.append(slideEl); }); swiper.recalcSlides(); swiper.slideTo(swiper.realIndex, 0); } function loopFix(options = {}) { const { slideRealIndex, slideTo: slideTo2 = true, direction, setTranslate: setTranslate2, activeSlideIndex: activeSlideIndexParam, initial, byController, byMousewheel } = options; let activeSlideIndex = activeSlideIndexParam; const swiper = this; if (!swiper.params.loop) return; swiper.emit("beforeLoopFix"); const { slides, allowSlidePrev, allowSlideNext, slidesEl, params } = swiper; const { centeredSlides, slidesOffsetBefore, slidesOffsetAfter, initialSlide } = params; const bothDirections = centeredSlides || !!slidesOffsetBefore || !!slidesOffsetAfter; swiper.allowSlidePrev = true; swiper.allowSlideNext = true; if (swiper.virtual && params.virtual?.enabled) { if (slideTo2) { const virtualSlidesLength = swiper.virtual.slides.length; const virtualSlidesBefore = swiper.virtual.slidesBefore ?? 0; if (!bothDirections && swiper.snapIndex === 0) { swiper.slideTo(virtualSlidesLength, 0, false, true); } else if (bothDirections && swiper.snapIndex < params.slidesPerView) { swiper.slideTo(virtualSlidesLength + swiper.snapIndex, 0, false, true); } else if (swiper.snapIndex === swiper.snapGrid.length - 1) { swiper.slideTo(virtualSlidesBefore, 0, false, true); } } swiper.allowSlidePrev = allowSlidePrev; swiper.allowSlideNext = allowSlideNext; swiper.emit("loopFix"); return; } let slidesPerView = params.slidesPerView; if (slidesPerView === "auto") { slidesPerView = swiper.slidesPerViewDynamic(); } else { slidesPerView = Math.ceil(parseFloat(String(params.slidesPerView))); if (bothDirections && slidesPerView % 2 === 0) { slidesPerView = slidesPerView + 1; } } const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup; let loopedSlides = bothDirections ? Math.max(slidesPerGroup, Math.ceil(slidesPerView / 2)) : slidesPerGroup; if (loopedSlides % slidesPerGroup !== 0) { loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup; } loopedSlides += params.loopAdditionalSlides; swiper.loopedSlides = loopedSlides; const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; if (slides.length < slidesPerView + loopedSlides || swiper.params.effect === "cards" && slides.length < slidesPerView + loopedSlides * 2) { showWarning("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters"); } else if (gridEnabled && params.grid.fill === "row") { showWarning("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`"); } const prependSlidesIndexes = []; const appendSlidesIndexes = []; const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length; const isInitialOverflow = initial && cols - initialSlide < slidesPerView && !bothDirections; let activeIndex = isInitialOverflow ? initialSlide : swiper.activeIndex; if (typeof activeSlideIndex === "undefined") { activeSlideIndex = swiper.getSlideIndex(slides.find((el) => el.classList.contains(params.slideActiveClass))); } else { activeIndex = activeSlideIndex; } const isNext = direction === "next" || !direction; const isPrev = direction === "prev" || !direction; let slidesPrepended = 0; let slidesAppended = 0; const activeColIndex = gridEnabled ? slides[activeSlideIndex].column ?? 0 : activeSlideIndex; const activeColIndexWithShift = activeColIndex + (bothDirections && typeof setTranslate2 === "undefined" ? -slidesPerView / 2 + 0.5 : 0); if (activeColIndexWithShift < loopedSlides) { slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup); for (let i3 = 0; i3 < loopedSlides - activeColIndexWithShift; i3 += 1) { const index = i3 - Math.floor(i3 / cols) * cols; if (gridEnabled) { const colIndexToPrepend = cols - index - 1; for (let j2 = slides.length - 1; j2 >= 0; j2 -= 1) { if (slides[j2].column === colIndexToPrepend) prependSlidesIndexes.push(j2); } } else { prependSlidesIndexes.push(cols - index - 1); } } } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) { slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup); if (isInitialOverflow) { slidesAppended = Math.max(slidesAppended, slidesPerView - cols + initialSlide + 1); } for (let i3 = 0; i3 < slidesAppended; i3 += 1) { const index = i3 - Math.floor(i3 / cols) * cols; if (gridEnabled) { slides.forEach((slide2, slideIndex) => { if (slide2.column === index) appendSlidesIndexes.push(slideIndex); }); } else { appendSlidesIndexes.push(index); } } } swiper.__preventObserver__ = true; requestAnimationFrame(() => { swiper.__preventObserver__ = false; }); if (swiper.params.effect === "cards" && slides.length < slidesPerView + loopedSlides * 2) { if (appendSlidesIndexes.includes(activeSlideIndex)) { appendSlidesIndexes.splice(appendSlidesIndexes.indexOf(activeSlideIndex), 1); } if (prependSlidesIndexes.includes(activeSlideIndex)) { prependSlidesIndexes.splice(prependSlidesIndexes.indexOf(activeSlideIndex), 1); } } if (isPrev) { prependSlidesIndexes.forEach((index) => { const slideEl = slides[index]; slideEl.swiperLoopMoveDOM = true; slidesEl.prepend(slideEl); slideEl.swiperLoopMoveDOM = false; }); } if (isNext) { appendSlidesIndexes.forEach((index) => { const slideEl = slides[index]; slideEl.swiperLoopMoveDOM = true; slidesEl.append(slideEl); slideEl.swiperLoopMoveDOM = false; }); } swiper.recalcSlides(); if (params.slidesPerView === "auto") { swiper.updateSlides(); } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) { swiper.slides.forEach((slide2, slideIndex) => { swiper.grid.updateSlide(slideIndex, slide2, swiper.slides); }); } if (params.watchSlidesProgress) { swiper.updateSlidesOffset(); } if (slideTo2) { if (prependSlidesIndexes.length > 0 && isPrev) { if (typeof slideRealIndex === "undefined") { const currentSlideTranslate = swiper.slidesGrid[activeIndex]; const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended]; const diff = newSlideTranslate - currentSlideTranslate; if (byMousewheel) { swiper.setTranslate(swiper.translate - diff); } else { swiper.slideTo(activeIndex + Math.ceil(slidesPrepended), 0, false, true); if (setTranslate2) { swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; } } } else { if (setTranslate2) { const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length; swiper.slideTo(swiper.activeIndex + shift, 0, false, true); swiper.touchEventsData.currentTranslate = swiper.translate; } } } else if (appendSlidesIndexes.length > 0 && isNext) { if (typeof slideRealIndex === "undefined") { const currentSlideTranslate = swiper.slidesGrid[activeIndex]; const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended]; const diff = newSlideTranslate - currentSlideTranslate; if (byMousewheel) { swiper.setTranslate(swiper.translate - diff); } else { swiper.slideTo(activeIndex - slidesAppended, 0, false, true); if (setTranslate2) { swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff; swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff; } } } else { const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length; swiper.slideTo(swiper.activeIndex - shift, 0, false, true); } } } swiper.allowSlidePrev = allowSlidePrev; swiper.allowSlideNext = allowSlideNext; const controlled = swiper.controller?.control; if (controlled && !byController) { const loopParams = { slideRealIndex, direction, setTranslate: setTranslate2, activeSlideIndex, byController: true }; if (Array.isArray(controlled)) { controlled.forEach((c2) => { if (!c2.destroyed && c2.params.loop) c2.loopFix({ ...loopParams, slideTo: c2.params.slidesPerView === params.slidesPerView ? slideTo2 : false }); }); } else if (controlled instanceof swiper.constructor && controlled.params.loop) { controlled.loopFix({ ...loopParams, slideTo: controlled.params.slidesPerView === params.slidesPerView ? slideTo2 : false }); } } swiper.emit("loopFix"); } var loop = { loopCreate, loopFix, loopDestroy }; function moduleExtendParams(params, allModulesParams) { return function extendParams(obj = {}) { const moduleParamName = Object.keys(obj)[0]; const moduleParams = obj[moduleParamName]; if (typeof moduleParams !== "object" || moduleParams === null) { extend$1(allModulesParams, obj); return; } if (params[moduleParamName] === true) { params[moduleParamName] = { enabled: true }; } if (moduleParamName === "navigation" && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) { params[moduleParamName].auto = true; } if (["pagination", "scrollbar"].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) { params[moduleParamName].auto = true; } if (!(moduleParamName in params && "enabled" in moduleParams)) { extend$1(allModulesParams, obj); return; } if (typeof params[moduleParamName] === "object" && !("enabled" in params[moduleParamName])) { params[moduleParamName].enabled = true; } if (!params[moduleParamName]) params[moduleParamName] = { enabled: false }; extend$1(allModulesParams, obj); }; } const Observer = ({ swiper, extendParams, on }) => { const observers = []; const attach = (target, options = {}) => { const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; if (!ObserverFunc) return; const observer = new ObserverFunc((mutations) => { if (swiper.__preventObserver__) return; if (mutations.length === 1) { swiper.emit("observerUpdate", mutations[0]); return; } const observerUpdate = function observerUpdate2() { swiper.emit("observerUpdate", mutations[0]); }; if (window.requestAnimationFrame) { window.requestAnimationFrame(observerUpdate); } else { window.setTimeout(observerUpdate, 0); } }); observer.observe(target, { attributes: typeof options.attributes === "undefined" ? true : options.attributes, childList: swiper.isElement || (typeof options.childList === "undefined" ? true : options.childList), characterData: typeof options.characterData === "undefined" ? true : options.characterData }); observers.push(observer); }; const init = () => { if (!swiper.params.observer) return; if (swiper.params.observeParents) { const containerParents = elementParents(swiper.hostEl); for (let i3 = 0; i3 < containerParents.length; i3 += 1) { attach(containerParents[i3]); } } attach(swiper.hostEl, { childList: swiper.params.observeSlideChildren }); attach(swiper.wrapperEl, { attributes: false }); }; const destroy = () => { observers.forEach((observer) => { observer.disconnect(); }); observers.splice(0, observers.length); }; extendParams({ observer: false, observeParents: false, observeSlideChildren: false }); on("init", init); on("destroy", destroy); }; const Resize = ({ swiper, on, emit }) => { let observer = null; let animationFrame = null; const resizeHandler = () => { if (!swiper || swiper.destroyed || !swiper.initialized) return; emit("beforeResize"); emit("resize"); }; const createObserver = () => { if (!swiper || swiper.destroyed || !swiper.initialized) return; observer = new ResizeObserver((entries) => { animationFrame = window.requestAnimationFrame(() => { const { width, height } = swiper; let newWidth = width; let newHeight = height; entries.forEach(({ contentBoxSize, contentRect, target }) => { if (target && target !== swiper.el) return; const box = Array.isArray(contentBoxSize) ? contentBoxSize[0] : contentBoxSize; newWidth = contentRect ? contentRect.width : box.inlineSize; newHeight = contentRect ? contentRect.height : box.blockSize; }); if (newWidth !== width || newHeight !== height) { resizeHandler(); } }); }); observer.observe(swiper.el); }; const removeObserver = () => { if (animationFrame) { window.cancelAnimationFrame(animationFrame); } if (observer && observer.unobserve && swiper.el) { observer.unobserve(swiper.el); observer = null; } }; const orientationChangeHandler = () => { if (!swiper || swiper.destroyed || !swiper.initialized) return; emit("orientationchange"); }; on("init", () => { if (swiper.params.resizeObserver && typeof window.ResizeObserver !== "undefined") { createObserver(); return; } window.addEventListener("resize", resizeHandler); window.addEventListener("orientationchange", orientationChangeHandler); }); on("destroy", () => { removeObserver(); window.removeEventListener("resize", resizeHandler); window.removeEventListener("orientationchange", orientationChangeHandler); }); }; function slideNext(speed, runCallbacks = true, internal) { const swiper = this; const { enabled, params, animating } = swiper; if (!enabled || swiper.destroyed) return swiper; if (typeof speed === "undefined") { speed = swiper.params.speed; } let perGroup = params.slidesPerGroup; if (params.slidesPerView === "auto" && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { perGroup = Math.max(swiper.slidesPerViewDynamic("current", true), 1); } const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; const isVirtual = swiper.virtual && params.virtual?.enabled; if (params.loop) { if (animating && !isVirtual && params.loopPreventsSliding) return false; swiper.loopFix({ direction: "next" }); swiper._clientLeft = swiper.wrapperEl.clientLeft; if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) { requestAnimationFrame(() => { swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); }); return true; } } if (params.rewind && swiper.isEnd) { return swiper.slideTo(0, speed, runCallbacks, internal); } return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); } function slidePrev(speed, runCallbacks = true, internal) { const swiper = this; const { params, snapGrid, slidesGrid, rtlTranslate, enabled, animating } = swiper; if (!enabled || swiper.destroyed) return swiper; if (typeof speed === "undefined") { speed = swiper.params.speed; } const isVirtual = swiper.virtual && params.virtual?.enabled; if (params.loop) { if (animating && !isVirtual && params.loopPreventsSliding) return false; swiper.loopFix({ direction: "prev" }); swiper._clientLeft = swiper.wrapperEl.clientLeft; } const translate2 = rtlTranslate ? swiper.translate : -swiper.translate; function normalize(val) { if (val < 0) return -Math.floor(Math.abs(val)); return Math.floor(val); } const normalizedTranslate = normalize(translate2); const normalizedSnapGrid = snapGrid.map((val) => normalize(val)); const isFreeMode = params.freeMode && params.freeMode.enabled; let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; if (typeof prevSnap === "undefined" && (params.cssMode || isFreeMode)) { let prevSnapIndex; snapGrid.forEach((snap, snapIndex) => { if (normalizedTranslate >= snap) { prevSnapIndex = snapIndex; } }); if (typeof prevSnapIndex !== "undefined") { prevSnap = isFreeMode ? snapGrid[prevSnapIndex] : snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; } } let prevIndex = 0; if (typeof prevSnap !== "undefined") { prevIndex = slidesGrid.indexOf(prevSnap); if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; if (params.slidesPerView === "auto" && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { prevIndex = prevIndex - swiper.slidesPerViewDynamic("previous", true) + 1; prevIndex = Math.max(prevIndex, 0); } } if (params.rewind && swiper.isBeginning) { const lastIndex = swiper.params.virtual?.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; return swiper.slideTo(lastIndex, speed, runCallbacks, internal); } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) { requestAnimationFrame(() => { swiper.slideTo(prevIndex, speed, runCallbacks, internal); }); return true; } return swiper.slideTo(prevIndex, speed, runCallbacks, internal); } function slideReset(speed, runCallbacks = true, internal) { const swiper = this; if (swiper.destroyed) return; if (typeof speed === "undefined") { speed = swiper.params.speed; } return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); } function slideTo(index = 0, speed, runCallbacks = true, internal, initial) { if (typeof index === "string") { index = parseInt(index, 10); } const swiper = this; let slideIndex = index; if (slideIndex < 0) slideIndex = 0; const { params, snapGrid, slidesGrid, previousIndex, activeIndex, rtlTranslate: rtl, wrapperEl, enabled } = swiper; if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) { return false; } if (typeof speed === "undefined") { speed = swiper.params.speed; } const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; const translate2 = -snapGrid[snapIndex]; if (params.normalizeSlideIndex) { for (let i3 = 0; i3 < slidesGrid.length; i3 += 1) { const normalizedTranslate = -Math.floor(translate2 * 100); const normalizedGrid = Math.floor(slidesGrid[i3] * 100); const normalizedGridNext = Math.floor(slidesGrid[i3 + 1] * 100); if (typeof slidesGrid[i3 + 1] !== "undefined") { if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) { slideIndex = i3; } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) { slideIndex = i3 + 1; } } else if (normalizedTranslate >= normalizedGrid) { slideIndex = i3; } } } if (swiper.initialized && slideIndex !== activeIndex) { if (!swiper.allowSlideNext && (rtl ? translate2 > swiper.translate && translate2 > swiper.minTranslate() : translate2 < swiper.translate && translate2 < swiper.minTranslate())) { return false; } if (!swiper.allowSlidePrev && translate2 > swiper.translate && translate2 > swiper.maxTranslate()) { if ((activeIndex || 0) !== slideIndex) { return false; } } } if (slideIndex !== (previousIndex || 0) && runCallbacks) { swiper.emit("beforeSlideChangeStart"); } swiper.updateProgress(translate2); let direction; if (slideIndex > activeIndex) direction = "next"; else if (slideIndex < activeIndex) direction = "prev"; else direction = "reset"; const isVirtual = swiper.virtual && swiper.params.virtual?.enabled; const isInitialVirtual = isVirtual && initial; if (!isInitialVirtual && (rtl && -translate2 === swiper.translate || !rtl && translate2 === swiper.translate)) { swiper.updateActiveIndex(slideIndex); if (params.autoHeight) { swiper.updateAutoHeight(); } swiper.updateSlidesClasses(); if (params.effect !== "slide") { swiper.setTranslate(translate2); } if (direction !== "reset") { swiper.transitionStart(runCallbacks, direction); swiper.transitionEnd(runCallbacks, direction); } return false; } if (params.cssMode) { const isH = swiper.isHorizontal(); const t2 = rtl ? translate2 : -translate2; if (speed === 0) { if (isVirtual) { swiper.wrapperEl.style.scrollSnapType = "none"; swiper._immediateVirtual = true; } if (isVirtual && !swiper._cssModeVirtualInitialSet && (swiper.params.initialSlide ?? 0) > 0) { swiper._cssModeVirtualInitialSet = true; requestAnimationFrame(() => { wrapperEl[isH ? "scrollLeft" : "scrollTop"] = t2; }); } else { wrapperEl[isH ? "scrollLeft" : "scrollTop"] = t2; } if (isVirtual) { requestAnimationFrame(() => { swiper.wrapperEl.style.scrollSnapType = ""; swiper._immediateVirtual = false; }); } } else { wrapperEl.scrollTo({ [isH ? "left" : "top"]: t2, behavior: "smooth" }); } return true; } const browser = getBrowser(); const isSafari = browser.isSafari; if (isVirtual && !initial && isSafari && swiper.isElement) { swiper.virtual.update(false, false, slideIndex); } swiper.setTransition(speed); swiper.setTranslate(translate2); swiper.updateActiveIndex(slideIndex); swiper.updateSlidesClasses(); swiper.emit("beforeTransitionStart", speed, internal); swiper.transitionStart(runCallbacks, direction); if (speed === 0) { swiper.transitionEnd(runCallbacks, direction); } else if (!swiper.animating) { swiper.animating = true; if (!swiper.onSlideToWrapperTransitionEnd) { swiper.onSlideToWrapperTransitionEnd = function transitionEnd2(e3) { if (!swiper || swiper.destroyed) return; if (e3.target !== this) return; swiper.wrapperEl.removeEventListener("transitionend", swiper.onSlideToWrapperTransitionEnd); swiper.onSlideToWrapperTransitionEnd = null; delete swiper.onSlideToWrapperTransitionEnd; swiper.transitionEnd(runCallbacks, direction); }; } swiper.wrapperEl.addEventListener("transitionend", swiper.onSlideToWrapperTransitionEnd); } return true; } function slideToClickedSlide() { const swiper = this; if (swiper.destroyed) return; const { params, slidesEl, clickedSlide, clickedIndex } = swiper; if (clickedSlide === void 0 || clickedIndex === void 0) return; const slidesPerView = params.slidesPerView === "auto" ? swiper.slidesPerViewDynamic() : params.slidesPerView; let slideToIndex = swiper.getSlideIndexWhenGrid(clickedIndex); let realIndex; const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`; const isGrid = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; if (params.loop) { if (swiper.animating) return; realIndex = parseInt(clickedSlide.getAttribute("data-swiper-slide-index"), 10); if (params.centeredSlides) { swiper.slideToLoop(realIndex); } else if (slideToIndex > (isGrid ? (swiper.slides.length - slidesPerView) / 2 - (swiper.params.grid.rows - 1) : swiper.slides.length - slidesPerView)) { swiper.loopFix(); slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]); nextTick(() => { swiper.slideTo(slideToIndex); }); } else { swiper.slideTo(slideToIndex); } } else { swiper.slideTo(slideToIndex); } } function slideToClosest(speed, runCallbacks = true, internal, threshold = 0.5) { const swiper = this; if (swiper.destroyed) return; if (typeof speed === "undefined") { speed = swiper.params.speed; } let index = swiper.activeIndex; const skip = Math.min(swiper.params.slidesPerGroupSkip, index); const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup); const translate2 = swiper.rtlTranslate ? swiper.translate : -swiper.translate; if (translate2 >= swiper.snapGrid[snapIndex]) { const currentSnap = swiper.snapGrid[snapIndex]; const nextSnap = swiper.snapGrid[snapIndex + 1]; if (translate2 - currentSnap > (nextSnap - currentSnap) * threshold) { index += swiper.params.slidesPerGroup; } } else { const prevSnap = swiper.snapGrid[snapIndex - 1]; const currentSnap = swiper.snapGrid[snapIndex]; if (translate2 - prevSnap <= (currentSnap - prevSnap) * threshold) { index -= swiper.params.slidesPerGroup; } } index = Math.max(index, 0); index = Math.min(index, swiper.slidesGrid.length - 1); return swiper.slideTo(index, speed, runCallbacks, internal); } function slideToLoop(index = 0, speed, runCallbacks = true, internal) { if (typeof index === "string") { const indexAsNumber = parseInt(index, 10); index = indexAsNumber; } const swiper = this; if (swiper.destroyed) return; if (typeof speed === "undefined") { speed = swiper.params.speed; } const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1; let newIndex = index; if (swiper.params.loop) { if (swiper.virtual && swiper.params.virtual?.enabled) { newIndex = newIndex + (swiper.virtual.slidesBefore ?? 0); } else { let targetSlideIndex; if (gridEnabled) { const slideIndex = newIndex * swiper.params.grid.rows; const targetSlideEl = swiper.slides.find((slideEl) => Number(slideEl.getAttribute("data-swiper-slide-index")) === slideIndex); targetSlideIndex = targetSlideEl?.column ?? 0; } else { targetSlideIndex = swiper.getSlideIndexByData(newIndex); } const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length; const { centeredSlides, slidesOffsetBefore, slidesOffsetAfter } = swiper.params; const bothDirections = centeredSlides || !!slidesOffsetBefore || !!slidesOffsetAfter; let slidesPerView; if (swiper.params.slidesPerView === "auto") { slidesPerView = swiper.slidesPerViewDynamic(); } else { slidesPerView = Math.ceil(parseFloat(String(swiper.params.slidesPerView))); if (bothDirections && slidesPerView % 2 === 0) { slidesPerView = slidesPerView + 1; } } let needLoopFix = cols - targetSlideIndex < slidesPerView; if (bothDirections) { needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2); } if (internal && bothDirections && swiper.params.slidesPerView !== "auto" && !gridEnabled) { needLoopFix = false; } if (needLoopFix) { const direction = bothDirections ? targetSlideIndex < swiper.activeIndex ? "prev" : "next" : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? "next" : "prev"; swiper.loopFix({ direction, slideTo: true, activeSlideIndex: direction === "next" ? targetSlideIndex + 1 : targetSlideIndex - cols + 1, slideRealIndex: direction === "next" ? swiper.realIndex : void 0 }); } if (gridEnabled) { const slideIndex = newIndex * swiper.params.grid.rows; const targetSlideEl = swiper.slides.find((slideEl) => Number(slideEl.getAttribute("data-swiper-slide-index")) === slideIndex); newIndex = targetSlideEl?.column ?? 0; } else { newIndex = swiper.getSlideIndexByData(newIndex); } } } requestAnimationFrame(() => { swiper.slideTo(newIndex, speed, runCallbacks, internal); }); return swiper; } var slide = { slideTo, slideToLoop, slideNext, slidePrev, slideReset, slideToClosest, slideToClickedSlide }; function setTransition(duration, byController) { const swiper = this; if (!swiper.params.cssMode) { swiper.wrapperEl.style.transitionDuration = `${duration}ms`; swiper.wrapperEl.style.transitionDelay = duration === 0 ? `0ms` : ""; } swiper.emit("setTransition", duration, byController); } function transitionEmit({ swiper, runCallbacks, direction, step }) { const { activeIndex, previousIndex } = swiper; let dir = direction; if (!dir) { if (activeIndex > previousIndex) dir = "next"; else if (activeIndex < previousIndex) dir = "prev"; else dir = "reset"; } swiper.emit(`transition${step}`); if (runCallbacks && dir === "reset") { swiper.emit(`slideResetTransition${step}`); } else if (runCallbacks && activeIndex !== previousIndex) { swiper.emit(`slideChangeTransition${step}`); if (dir === "next") { swiper.emit(`slideNextTransition${step}`); } else { swiper.emit(`slidePrevTransition${step}`); } } } function transitionEnd(runCallbacks = true, direction) { const swiper = this; const { params } = swiper; swiper.animating = false; if (params.cssMode) return; swiper.setTransition(0); transitionEmit({ swiper, runCallbacks, direction, step: "End" }); } function transitionStart(runCallbacks = true, direction) { const swiper = this; const { params } = swiper; if (params.cssMode) return; if (params.autoHeight) { swiper.updateAutoHeight(); } transitionEmit({ swiper, runCallbacks, direction, step: "Start" }); } var transition = { setTransition, transitionStart, transitionEnd }; function getSwiperTranslate(axis = this.isHorizontal() ? "x" : "y") { const swiper = this; const { params, rtlTranslate: rtl, translate: translate2, wrapperEl } = swiper; if (params.virtualTranslate) { return rtl ? -translate2 : translate2; } if (params.cssMode) { return translate2; } let currentTranslate = getTranslate(wrapperEl, axis); currentTranslate += swiper.cssOverflowAdjustment(); if (rtl) currentTranslate = -currentTranslate; return currentTranslate || 0; } function maxTranslate() { return -this.snapGrid[this.snapGrid.length - 1]; } function minTranslate() { return -this.snapGrid[0]; } function setTranslate(translate2, byController) { const swiper = this; const { rtlTranslate: rtl, params, wrapperEl, progress } = swiper; let x2 = 0; let y2 = 0; const z2 = 0; if (swiper.isHorizontal()) { x2 = rtl ? -translate2 : translate2; } else { y2 = translate2; } if (params.roundLengths) { x2 = Math.floor(x2); y2 = Math.floor(y2); } swiper.previousTranslate = swiper.translate; swiper.translate = swiper.isHorizontal() ? x2 : y2; if (params.cssMode) { wrapperEl[swiper.isHorizontal() ? "scrollLeft" : "scrollTop"] = swiper.isHorizontal() ? -x2 : -y2; } else if (!params.virtualTranslate) { if (swiper.isHorizontal()) { x2 -= swiper.cssOverflowAdjustment(); } else { y2 -= swiper.cssOverflowAdjustment(); } wrapperEl.style.transform = `translate3d(${x2}px, ${y2}px, ${z2}px)`; } let newProgress; const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); if (translatesDiff === 0) { newProgress = 0; } else { newProgress = (translate2 - swiper.minTranslate()) / translatesDiff; } if (newProgress !== progress) { swiper.updateProgress(translate2); } swiper.emit("setTranslate", swiper.translate, byController); } function translateTo(translate2 = 0, speed = this.params.speed, runCallbacks = true, translateBounds = true, internal) { const swiper = this; const { params, wrapperEl } = swiper; if (swiper.animating && params.preventInteractionOnTransition) { return false; } const minTranslate2 = swiper.minTranslate(); const maxTranslate2 = swiper.maxTranslate(); let newTranslate; if (translateBounds && translate2 > minTranslate2) newTranslate = minTranslate2; else if (translateBounds && translate2 < maxTranslate2) newTranslate = maxTranslate2; else newTranslate = translate2; swiper.updateProgress(newTranslate); if (params.cssMode) { const isH = swiper.isHorizontal(); if (speed === 0) { wrapperEl[isH ? "scrollLeft" : "scrollTop"] = -newTranslate; } else { wrapperEl.scrollTo({ [isH ? "left" : "top"]: -newTranslate, behavior: "smooth" }); } return true; } if (speed === 0) { swiper.setTransition(0); swiper.setTranslate(newTranslate); if (runCallbacks) { swiper.emit("beforeTransitionStart", speed, internal); swiper.emit("transitionEnd"); } } else { swiper.setTransition(speed); swiper.setTranslate(newTranslate); if (runCallbacks) { swiper.emit("beforeTransitionStart", speed, internal); swiper.emit("transitionStart"); } if (!swiper.animating) { swiper.animating = true; if (!swiper.onTranslateToWrapperTransitionEnd) { swiper.onTranslateToWrapperTransitionEnd = function transitionEnd2(e3) { if (!swiper || swiper.destroyed) return; if (e3.target !== this) return; swiper.wrapperEl.removeEventListener("transitionend", swiper.onTranslateToWrapperTransitionEnd); swiper.onTranslateToWrapperTransitionEnd = null; delete swiper.onTranslateToWrapperTransitionEnd; swiper.animating = false; if (runCallbacks) { swiper.emit("transitionEnd"); } }; } swiper.wrapperEl.addEventListener("transitionend", swiper.onTranslateToWrapperTransitionEnd); } } return true; } var translate = { getTranslate: getSwiperTranslate, setTranslate, minTranslate, maxTranslate, translateTo }; function getActiveIndexByTranslate(swiper) { const { slidesGrid, params } = swiper; const translate2 = swiper.rtlTranslate ? swiper.translate : -swiper.translate; let activeIndex; for (let i3 = 0; i3 < slidesGrid.length; i3 += 1) { if (typeof slidesGrid[i3 + 1] !== "undefined") { if (translate2 >= slidesGrid[i3] && translate2 < slidesGrid[i3 + 1] - (slidesGrid[i3 + 1] - slidesGrid[i3]) / 2) { activeIndex = i3; } else if (translate2 >= slidesGrid[i3] && translate2 < slidesGrid[i3 + 1]) { activeIndex = i3 + 1; } } else if (translate2 >= slidesGrid[i3]) { activeIndex = i3; } } if (params.normalizeSlideIndex) { if (activeIndex < 0 || typeof activeIndex === "undefined") activeIndex = 0; } return activeIndex; } function updateActiveIndex(newActiveIndex) { const swiper = this; const translate2 = swiper.rtlTranslate ? swiper.translate : -swiper.translate; const { snapGrid, params, activeIndex: previousIndex, realIndex: previousRealIndex, snapIndex: previousSnapIndex } = swiper; let activeIndex = newActiveIndex; let snapIndex; const getVirtualRealIndex = (aIndex) => { const virtualSlides = swiper.virtual.slides; let realIndex2 = aIndex - (swiper.virtual.slidesBefore ?? 0); if (realIndex2 < 0) { realIndex2 = virtualSlides.length + realIndex2; } if (realIndex2 >= virtualSlides.length) { realIndex2 -= virtualSlides.length; } return realIndex2; }; if (typeof activeIndex === "undefined") { activeIndex = getActiveIndexByTranslate(swiper); } if (snapGrid.indexOf(translate2) >= 0) { snapIndex = snapGrid.indexOf(translate2); } else { const skip = Math.min(params.slidesPerGroupSkip, activeIndex); snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); } if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; if (activeIndex === previousIndex && !swiper.params.loop) { if (snapIndex !== previousSnapIndex) { swiper.snapIndex = snapIndex; swiper.emit("snapIndexChange"); } return; } if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual?.enabled) { swiper.realIndex = getVirtualRealIndex(activeIndex); return; } const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; let realIndex; if (swiper.virtual && params.virtual?.enabled) { if (params.loop) { realIndex = getVirtualRealIndex(activeIndex); } else { realIndex = activeIndex; } } else if (gridEnabled) { const firstSlideInColumn = swiper.slides.find((slideEl) => slideEl.column === activeIndex); let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute("data-swiper-slide-index"), 10); if (Number.isNaN(activeSlideIndex)) { activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0); } realIndex = Math.floor(activeSlideIndex / params.grid.rows); } else if (swiper.slides[activeIndex]) { const slideIndex = swiper.slides[activeIndex].getAttribute("data-swiper-slide-index"); if (slideIndex) { realIndex = parseInt(slideIndex, 10); } else { realIndex = activeIndex; } } else { realIndex = activeIndex; } Object.assign(swiper, { previousSnapIndex, snapIndex, previousRealIndex, realIndex, previousIndex, activeIndex }); if (swiper.initialized) { preload(swiper); } swiper.emit("activeIndexChange"); swiper.emit("snapIndexChange"); if (swiper.initialized || swiper.params.runCallbacksOnInit) { if (previousRealIndex !== realIndex) { swiper.emit("realIndexChange"); } swiper.emit("slideChange"); } } function updateAutoHeight(speed) { const swiper = this; const activeSlides = []; const isVirtual = swiper.virtual && swiper.params.virtual?.enabled; let newHeight = 0; let i3; if (typeof speed === "number") { swiper.setTransition(speed); } else if (speed === true) { swiper.setTransition(swiper.params.speed); } const getSlideByIndex = (index) => { if (isVirtual) { return swiper.slides[swiper.getSlideIndexByData(index)]; } return swiper.slides[index]; }; if (swiper.params.slidesPerView !== "auto" && swiper.params.slidesPerView > 1) { if (swiper.params.centeredSlides) { (swiper.visibleSlides || []).forEach((slide2) => { activeSlides.push(slide2); }); } else { for (i3 = 0; i3 < Math.ceil(swiper.params.slidesPerView); i3 += 1) { const index = swiper.activeIndex + i3; if (index > swiper.slides.length && !isVirtual) break; const slide2 = getSlideByIndex(index); if (slide2) activeSlides.push(slide2); } } } else { const slide2 = getSlideByIndex(swiper.activeIndex); if (slide2) activeSlides.push(slide2); } for (i3 = 0; i3 < activeSlides.length; i3 += 1) { if (typeof activeSlides[i3] !== "undefined") { const height = activeSlides[i3].offsetHeight; newHeight = height > newHeight ? height : newHeight; } } if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`; } function updateClickedSlide(el, path) { const swiper = this; const params = swiper.params; let slide2 = el.closest(`.${params.slideClass}, swiper-slide`); if (!slide2 && swiper.isElement && path && path.length > 1 && path.includes(el)) { [...path.slice(path.indexOf(el) + 1, path.length)].forEach((pathEl) => { if (!slide2 && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) { slide2 = pathEl; } }); } let slideFound = false; let slideIndex; if (slide2) { for (let i3 = 0; i3 < swiper.slides.length; i3 += 1) { if (swiper.slides[i3] === slide2) { slideFound = true; slideIndex = i3; break; } } } if (slide2 && slideFound) { swiper.clickedSlide = slide2; if (swiper.virtual && swiper.params.virtual?.enabled) { swiper.clickedIndex = parseInt(slide2.getAttribute("data-swiper-slide-index"), 10); } else { swiper.clickedIndex = slideIndex; } } else { swiper.clickedSlide = void 0; swiper.clickedIndex = void 0; return; } if (params.slideToClickedSlide && swiper.clickedIndex !== void 0 && swiper.clickedIndex !== swiper.activeIndex) { swiper.slideToClickedSlide(); } } function updateProgress(translate2) { const swiper = this; if (typeof translate2 === "undefined") { const multiplier = swiper.rtlTranslate ? -1 : 1; translate2 = swiper && swiper.translate && swiper.translate * multiplier || 0; } const params = swiper.params; const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); let { progress, isBeginning, isEnd } = swiper; let progressLoop = swiper.progressLoop; const wasBeginning = isBeginning; const wasEnd = isEnd; if (translatesDiff === 0) { progress = 0; isBeginning = true; isEnd = true; } else { progress = (translate2 - swiper.minTranslate()) / translatesDiff; const isBeginningRounded = Math.abs(translate2 - swiper.minTranslate()) < 1; const isEndRounded = Math.abs(translate2 - swiper.maxTranslate()) < 1; isBeginning = isBeginningRounded || progress <= 0; isEnd = isEndRounded || progress >= 1; if (isBeginningRounded) progress = 0; if (isEndRounded) progress = 1; } if (params.loop) { const firstSlideIndex = swiper.getSlideIndexByData(0); const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1); const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex]; const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex]; const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1]; const translateAbs = Math.abs(translate2); if (translateAbs >= firstSlideTranslate) { progressLoop = (translateAbs - firstSlideTranslate) / translateMax; } else { progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax; } if (progressLoop > 1) progressLoop -= 1; } Object.assign(swiper, { progress, progressLoop, isBeginning, isEnd }); if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate2); if (isBeginning && !wasBeginning) { swiper.emit("reachBeginning toEdge"); } if (isEnd && !wasEnd) { swiper.emit("reachEnd toEdge"); } if (wasBeginning && !isBeginning || wasEnd && !isEnd) { swiper.emit("fromEdge"); } swiper.emit("progress", progress); } function updateSize() { const swiper = this; let width; let height; const el = swiper.el; if (typeof swiper.params.width !== "undefined" && swiper.params.width !== null) { width = swiper.params.width; } else { width = el.clientWidth; } if (typeof swiper.params.height !== "undefined" && swiper.params.height !== null) { height = swiper.params.height; } else { height = el.clientHeight; } if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) { return; } width = width - parseInt(elementStyle(el, "padding-left") || "0", 10) - parseInt(elementStyle(el, "padding-right") || "0", 10); height = height - parseInt(elementStyle(el, "padding-top") || "0", 10) - parseInt(elementStyle(el, "padding-bottom") || "0", 10); if (Number.isNaN(width)) width = 0; if (Number.isNaN(height)) height = 0; Object.assign(swiper, { width, height, size: swiper.isHorizontal() ? width : height }); } function updateSlides() { const swiper = this; function getDirectionPropertyValue(node, label) { return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || "0"); } const params = swiper.params; const { wrapperEl, slidesEl, rtlTranslate: rtl, wrongRTL } = swiper; const isVirtual = !!(swiper.virtual && params.virtual?.enabled); const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`); const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; let snapGrid = []; const slidesGrid = []; const slidesSizesGrid = []; const resolveOffset = (value) => typeof value === "function" ? value.call(swiper) : value; const offsetBefore = resolveOffset(params.slidesOffsetBefore); const offsetAfter = resolveOffset(params.slidesOffsetAfter); const previousSnapGridLength = swiper.snapGrid.length; const previousSlidesGridLength = swiper.slidesGrid.length; const swiperSize = swiper.size - offsetBefore - offsetAfter; let spaceBetween = params.spaceBetween; let slidePosition = -offsetBefore; let prevSlideSize = 0; let index = 0; if (typeof swiperSize === "undefined") { return; } if (typeof spaceBetween === "string" && spaceBetween.indexOf("%") >= 0) { spaceBetween = parseFloat(spaceBetween.replace("%", "")) / 100 * swiperSize; } else if (typeof spaceBetween === "string") { spaceBetween = parseFloat(spaceBetween); } swiper.virtualSize = -spaceBetween - offsetBefore - offsetAfter; slides.forEach((slideEl) => { if (rtl) { slideEl.style.marginLeft = ""; } else { slideEl.style.marginRight = ""; } slideEl.style.marginBottom = ""; slideEl.style.marginTop = ""; }); if (params.centeredSlides && params.cssMode) { setCSSProperty(wrapperEl, "--swiper-centered-offset-before", ""); setCSSProperty(wrapperEl, "--swiper-centered-offset-after", ""); } if (params.cssMode) { setCSSProperty(wrapperEl, "--swiper-slides-offset-before", `${offsetBefore}px`); setCSSProperty(wrapperEl, "--swiper-slides-offset-after", `${offsetAfter}px`); } const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; if (gridEnabled) { swiper.grid.initSlides(slides); } else if (swiper.grid) { swiper.grid.unsetSlides(); } let slideSize = 0; const shouldResetSlideSize = params.slidesPerView === "auto" && params.breakpoints && Object.keys(params.breakpoints).filter((key) => { const bp = params.breakpoints[key]; return typeof bp?.slidesPerView !== "undefined"; }).length > 0; for (let i3 = 0; i3 < slidesLength; i3 += 1) { slideSize = 0; const slide2 = slides[i3]; if (slide2) { if (gridEnabled) { swiper.grid.updateSlide(i3, slide2, slides); } if (elementStyle(slide2, "display") === "none") continue; } if (isVirtual && params.slidesPerView === "auto") { if (params.virtual?.slidesPerViewAutoSlideSize) { slideSize = params.virtual.slidesPerViewAutoSlideSize; } if (slideSize && slide2) { if (params.roundLengths) slideSize = Math.floor(slideSize); slide2.style[swiper.getDirectionLabel("width")] = `${slideSize}px`; } } else if (params.slidesPerView === "auto") { if (shouldResetSlideSize) { slide2.style[swiper.getDirectionLabel("width")] = ``; } const slideStyles = getComputedStyle(slide2); const currentTransform = slide2.style.transform; const currentWebKitTransform = slide2.style.webkitTransform; if (currentTransform) { slide2.style.transform = "none"; } if (currentWebKitTransform) { slide2.style.webkitTransform = "none"; } if (params.roundLengths) { slideSize = swiper.isHorizontal() ? elementOuterSize(slide2, "width") : elementOuterSize(slide2, "height"); } else { const width = getDirectionPropertyValue(slideStyles, "width"); const paddingLeft = getDirectionPropertyValue(slideStyles, "padding-left"); const paddingRight = getDirectionPropertyValue(slideStyles, "padding-right"); const marginLeft = getDirectionPropertyValue(slideStyles, "margin-left"); const marginRight = getDirectionPropertyValue(slideStyles, "margin-right"); const boxSizing = slideStyles.getPropertyValue("box-sizing"); if (boxSizing && boxSizing === "border-box") { slideSize = width + marginLeft + marginRight; } else { const { clientWidth, offsetWidth } = slide2; slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); } } if (currentTransform) { slide2.style.transform = currentTransform; } if (currentWebKitTransform) { slide2.style.webkitTransform = currentWebKitTransform; } if (params.roundLengths) slideSize = Math.floor(slideSize); } else { slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; if (params.roundLengths) slideSize = Math.floor(slideSize); if (slide2) { slide2.style[swiper.getDirectionLabel("width")] = `${slideSize}px`; } } if (slide2) { slide2.swiperSlideSize = slideSize; } slidesSizesGrid.push(slideSize); if (params.centeredSlides) { slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; if (prevSlideSize === 0 && i3 !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; if (i3 === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; if (Math.abs(slidePosition) < 1 / 1e3) slidePosition = 0; if (params.roundLengths) slidePosition = Math.floor(slidePosition); if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); slidesGrid.push(slidePosition); } else { if (params.roundLengths) slidePosition = Math.floor(slidePosition); if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); slidesGrid.push(slidePosition); slidePosition = slidePosition + slideSize + spaceBetween; } swiper.virtualSize += slideSize + spaceBetween; prevSlideSize = slideSize; index += 1; } swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; if (rtl && wrongRTL && (params.effect === "slide" || params.effect === "coverflow")) { wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`; } if (params.setWrapperSize) { wrapperEl.style[swiper.getDirectionLabel("width")] = `${swiper.virtualSize + spaceBetween}px`; } if (gridEnabled) { swiper.grid.updateWrapperSize(slideSize, snapGrid); } if (!params.centeredSlides) { const isFractionalSlidesPerView = params.slidesPerView !== "auto" && params.slidesPerView % 1 !== 0; const shouldSnapToSlideEdge = params.snapToSlideEdge && !params.loop && (params.slidesPerView === "auto" || isFractionalSlidesPerView); let lastAllowedSnapIndex = snapGrid.length; if (shouldSnapToSlideEdge) { let minVisibleSlides; if (params.slidesPerView === "auto") { minVisibleSlides = 1; let accumulatedSize = 0; for (let i3 = slidesSizesGrid.length - 1; i3 >= 0; i3 -= 1) { accumulatedSize += slidesSizesGrid[i3] + (i3 < slidesSizesGrid.length - 1 ? spaceBetween : 0); if (accumulatedSize <= swiperSize) { minVisibleSlides = slidesSizesGrid.length - i3; } else { break; } } } else { minVisibleSlides = Math.floor(params.slidesPerView); } lastAllowedSnapIndex = Math.max(slidesLength - minVisibleSlides, 0); } const newSlidesGrid = []; for (let i3 = 0; i3 < snapGrid.length; i3 += 1) { let slidesGridItem = snapGrid[i3]; if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem); if (shouldSnapToSlideEdge) { if (i3 <= lastAllowedSnapIndex) { newSlidesGrid.push(slidesGridItem); } } else if (snapGrid[i3] <= swiper.virtualSize - swiperSize) { newSlidesGrid.push(slidesGridItem); } } snapGrid = newSlidesGrid; if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { if (!shouldSnapToSlideEdge) { snapGrid.push(swiper.virtualSize - swiperSize); } } } if (isVirtual && params.loop) { const size = slidesSizesGrid[0] + spaceBetween; const slidesBefore = swiper.virtual.slidesBefore ?? 0; const slidesAfter = swiper.virtual.slidesAfter ?? 0; const virtualLoopCount = slidesBefore + slidesAfter; if (params.slidesPerGroup > 1) { const groups = Math.ceil(virtualLoopCount / params.slidesPerGroup); const groupSize = size * params.slidesPerGroup; for (let i3 = 0; i3 < groups; i3 += 1) { snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize); } } for (let i3 = 0; i3 < virtualLoopCount; i3 += 1) { if (params.slidesPerGroup === 1) { snapGrid.push(snapGrid[snapGrid.length - 1] + size); } slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size); swiper.virtualSize += size; } } if (snapGrid.length === 0) snapGrid = [0]; if (spaceBetween !== 0) { const key = swiper.isHorizontal() && rtl ? "marginLeft" : swiper.getDirectionLabel("marginRight"); slides.filter((_2, slideIndex) => { if (!params.cssMode || params.loop) return true; if (slideIndex === slides.length - 1) { return false; } return true; }).forEach((slideEl) => { slideEl.style[key] = `${spaceBetween}px`; }); } if (params.centeredSlides && params.centeredSlidesBounds) { let allSlidesSize = 0; slidesSizesGrid.forEach((slideSizeValue) => { allSlidesSize += slideSizeValue + (spaceBetween || 0); }); allSlidesSize -= spaceBetween; const maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0; snapGrid = snapGrid.map((snap) => { if (snap <= 0) return -offsetBefore; if (snap > maxSnap) return maxSnap + offsetAfter; return snap; }); } if (params.centerInsufficientSlides) { let allSlidesSize = 0; slidesSizesGrid.forEach((slideSizeValue) => { allSlidesSize += slideSizeValue + (spaceBetween || 0); }); allSlidesSize -= spaceBetween; if (allSlidesSize < swiperSize) { const allSlidesOffset = (swiperSize - allSlidesSize) / 2; snapGrid.forEach((snap, snapIndex) => { snapGrid[snapIndex] = snap - allSlidesOffset; }); slidesGrid.forEach((snap, snapIndex) => { slidesGrid[snapIndex] = snap + allSlidesOffset; }); } } Object.assign(swiper, { slides, snapGrid, slidesGrid, slidesSizesGrid }); if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { setCSSProperty(wrapperEl, "--swiper-centered-offset-before", `${-snapGrid[0]}px`); setCSSProperty(wrapperEl, "--swiper-centered-offset-after", `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`); const addToSnapGrid = -swiper.snapGrid[0]; const addToSlidesGrid = -swiper.slidesGrid[0]; swiper.snapGrid = swiper.snapGrid.map((v2) => v2 + addToSnapGrid); swiper.slidesGrid = swiper.slidesGrid.map((v2) => v2 + addToSlidesGrid); } if (slidesLength !== previousSlidesLength) { swiper.emit("slidesLengthChange"); } if (snapGrid.length !== previousSnapGridLength) { if (swiper.params.watchOverflow) swiper.checkOverflow(); swiper.emit("snapGridLengthChange"); } if (slidesGrid.length !== previousSlidesGridLength) { swiper.emit("slidesGridLengthChange"); } if (params.watchSlidesProgress) { swiper.updateSlidesOffset(); } swiper.emit("slidesUpdated"); if (!isVirtual && !params.cssMode && (params.effect === "slide" || params.effect === "fade")) { const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`; const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass); if (slidesLength <= params.maxBackfaceHiddenSlides) { if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass); } else if (hasClassBackfaceClassAdded) { swiper.el.classList.remove(backFaceHiddenClass); } } } const toggleSlideClasses$1 = (slideEl, condition, className) => { if (condition && !slideEl.classList.contains(className)) { slideEl.classList.add(className); } else if (!condition && slideEl.classList.contains(className)) { slideEl.classList.remove(className); } }; function updateSlidesClasses() { const swiper = this; const { slides, params, slidesEl, activeIndex } = swiper; const isVirtual = !!(swiper.virtual && params.virtual?.enabled); const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1; const getFilteredSlide = (selector) => { return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0]; }; let activeSlide; let prevSlide; let nextSlide; if (isVirtual) { if (params.loop) { const virtualSlides = swiper.virtual.slides; let slideIndex = activeIndex - (swiper.virtual.slidesBefore ?? 0); if (slideIndex < 0) slideIndex = virtualSlides.length + slideIndex; if (slideIndex >= virtualSlides.length) slideIndex -= virtualSlides.length; activeSlide = getFilteredSlide(`[data-swiper-slide-index="${slideIndex}"]`); } else { activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`); } } else if (gridEnabled) { activeSlide = slides.find((slideEl) => slideEl.column === activeIndex); nextSlide = slides.find((slideEl) => slideEl.column === activeIndex + 1); prevSlide = slides.find((slideEl) => slideEl.column === activeIndex - 1); } else { activeSlide = slides[activeIndex]; } if (activeSlide) { if (!gridEnabled) { nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0]; if (params.loop && !nextSlide) { nextSlide = slides[0]; } prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0]; if (params.loop && !prevSlide === 0) { prevSlide = slides[slides.length - 1]; } } } slides.forEach((slideEl) => { toggleSlideClasses$1(slideEl, slideEl === activeSlide, params.slideActiveClass); toggleSlideClasses$1(slideEl, slideEl === nextSlide, params.slideNextClass); toggleSlideClasses$1(slideEl, slideEl === prevSlide, params.slidePrevClass); }); swiper.emitSlidesClasses(); } function updateSlidesOffset() { const swiper = this; const slides = swiper.slides; const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0; for (let i3 = 0; i3 < slides.length; i3 += 1) { slides[i3].swiperSlideOffset = (swiper.isHorizontal() ? slides[i3].offsetLeft : slides[i3].offsetTop) - minusOffset - swiper.cssOverflowAdjustment(); } } const toggleSlideClasses = (slideEl, condition, className) => { if (condition && !slideEl.classList.contains(className)) { slideEl.classList.add(className); } else if (!condition && slideEl.classList.contains(className)) { slideEl.classList.remove(className); } }; function updateSlidesProgress(translate2 = this && this.translate || 0) { const swiper = this; const params = swiper.params; const { slides, rtlTranslate: rtl, snapGrid } = swiper; if (slides.length === 0) return; if (typeof slides[0].swiperSlideOffset === "undefined") swiper.updateSlidesOffset(); let offsetCenter = -translate2; if (rtl) offsetCenter = translate2; swiper.visibleSlidesIndexes = []; swiper.visibleSlides = []; let spaceBetween = params.spaceBetween; if (typeof spaceBetween === "string" && spaceBetween.indexOf("%") >= 0) { spaceBetween = parseFloat(spaceBetween.replace("%", "")) / 100 * swiper.size; } else if (typeof spaceBetween === "string") { spaceBetween = parseFloat(spaceBetween); } for (let i3 = 0; i3 < slides.length; i3 += 1) { const slide2 = slides[i3]; let slideOffset = slide2.swiperSlideOffset ?? 0; if (params.cssMode && params.centeredSlides) { slideOffset -= slides[0].swiperSlideOffset ?? 0; } const slideSize = slide2.swiperSlideSize ?? 0; const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slideSize + spaceBetween); const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slideSize + spaceBetween); const slideBefore = -(offsetCenter - slideOffset); const slideAfter = slideBefore + swiper.slidesSizesGrid[i3]; const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i3]; const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; if (isVisible) { swiper.visibleSlides.push(slide2); swiper.visibleSlidesIndexes.push(i3); } toggleSlideClasses(slide2, isVisible, params.slideVisibleClass); toggleSlideClasses(slide2, isFullyVisible, params.slideFullyVisibleClass); slide2.progress = rtl ? -slideProgress : slideProgress; slide2.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress; } } var update = { updateSize, updateSlides, updateAutoHeight, updateSlidesOffset, updateSlidesProgress, updateProgress, updateSlidesClasses, updateActiveIndex, updateClickedSlide }; const prototypes = { eventsEmitter, update, translate, transition, slide, loop, grabCursor, events: events$1, breakpoints, checkOverflow: checkOverflow$1, classes }; const extendedDefaults = {}; let Swiper$1 = class Swiper { static extendedDefaults; static defaults; constructor(...args) { let el; let params; if (args.length === 1 && args[0] !== null && typeof args[0] === "object" && Object.prototype.toString.call(args[0]).slice(8, -1) === "Object") { params = args[0]; } else { [el, params] = args; } if (!params) params = {}; params = extend$1({}, params); if (el && !params.el) params.el = el; if (params.el && typeof params.el === "string" && typeof document !== "undefined" && document.querySelectorAll(params.el).length > 1) { const swipers = []; document.querySelectorAll(params.el).forEach((containerEl) => { const newParams = extend$1({}, params, { el: containerEl }); swipers.push(new Swiper(newParams)); }); return swipers; } const swiper = this; swiper.__swiper__ = true; swiper.support = getSupport(); swiper.device = getDevice({ userAgent: params.userAgent ?? void 0 }); swiper.browser = getBrowser(); swiper.eventsListeners = {}; swiper.eventsAnyListeners = []; swiper.modules = [...swiper.__modules__ || []]; if (params.modules && Array.isArray(params.modules)) { params.modules.forEach((mod) => { const fn = mod; if (typeof fn === "function" && swiper.modules.indexOf(fn) < 0) { swiper.modules.push(fn); } }); } const allModulesParams = {}; swiper.modules.forEach((mod) => { mod({ params, swiper, extendParams: moduleExtendParams(params, allModulesParams), on: swiper.on.bind(swiper), once: swiper.once.bind(swiper), off: swiper.off.bind(swiper), emit: swiper.emit.bind(swiper) }); }); const swiperParams = extend$1({}, defaults, allModulesParams); swiper.params = extend$1({}, swiperParams, extendedDefaults, params); swiper.originalParams = extend$1({}, swiper.params); swiper.passedParams = extend$1({}, params); if (swiper.params && swiper.params.on) { const onHandlers = swiper.params.on; Object.keys(onHandlers).forEach((eventName) => { const handler = onHandlers[eventName]; if (handler) swiper.on(eventName, handler); }); } if (swiper.params && swiper.params.onAny) { swiper.onAny(swiper.params.onAny); } Object.assign(swiper, { enabled: swiper.params.enabled, el, classNames: [], slides: [], slidesGrid: [], snapGrid: [], slidesSizesGrid: [], isHorizontal() { return swiper.params.direction === "horizontal"; }, isVertical() { return swiper.params.direction === "vertical"; }, activeIndex: 0, realIndex: 0, isBeginning: true, isEnd: false, translate: 0, previousTranslate: 0, progress: 0, velocity: 0, animating: false, cssOverflowAdjustment() { return Math.trunc(this.translate / 2 ** 23) * 2 ** 23; }, allowSlideNext: swiper.params.allowSlideNext, allowSlidePrev: swiper.params.allowSlidePrev, touchEventsData: { isTouched: void 0, isMoved: void 0, allowTouchCallbacks: void 0, touchStartTime: void 0, isScrolling: void 0, currentTranslate: void 0, startTranslate: void 0, allowThresholdMove: void 0, focusableElements: swiper.params.focusableElements, lastClickTime: 0, clickTimeout: void 0, velocities: [], allowMomentumBounce: void 0, startMoving: void 0, pointerId: null, touchId: null }, allowClick: true, allowTouchMove: swiper.params.allowTouchMove, touches: { startX: 0, startY: 0, currentX: 0, currentY: 0, diff: 0 }, imagesToLoad: [], imagesLoaded: 0 }); swiper.emit("_swiper"); if (swiper.params.init) { swiper.init(); } return swiper; } getDirectionLabel(property) { if (this.isHorizontal()) { return property; } return { "width": "height", "margin-top": "margin-left", "margin-bottom ": "margin-right", "margin-left": "margin-top", "margin-right": "margin-bottom", "padding-left": "padding-top", "padding-right": "padding-bottom", "marginRight": "marginBottom" }[property]; } isHorizontal() { return this.params.direction === "horizontal"; } isVertical() { return this.params.direction === "vertical"; } cssOverflowAdjustment() { return Math.trunc(this.translate / 2 ** 23) * 2 ** 23; } getSlideIndex(slideEl) { const { slidesEl, params } = this; const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); const firstSlideIndex = elementIndex(slides[0]); return elementIndex(slideEl) - (firstSlideIndex ?? 0); } getSlideIndexByData(index) { return this.getSlideIndex(this.slides.find((slideEl) => Number(slideEl.getAttribute("data-swiper-slide-index")) === index)); } getSlideIndexWhenGrid(index) { if (this.grid && this.params.grid && this.params.grid.rows > 1) { if (this.params.grid.fill === "column") { index = Math.floor(index / this.params.grid.rows); } else if (this.params.grid.fill === "row") { index = index % Math.ceil(this.slides.length / this.params.grid.rows); } } return index; } recalcSlides() { const { slidesEl, params } = this; this.slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`); } enable() { if (this.enabled) return; this.enabled = true; if (this.params.grabCursor) { this.setGrabCursor(); } this.emit("enable"); } disable() { if (!this.enabled) return; this.enabled = false; if (this.params.grabCursor) { this.unsetGrabCursor(); } this.emit("disable"); } setProgress(progress, speed) { progress = Math.min(Math.max(progress, 0), 1); const min = this.minTranslate(); const max = this.maxTranslate(); const current = (max - min) * progress + min; this.translateTo(current, typeof speed === "undefined" ? 0 : speed); this.updateActiveIndex(); this.updateSlidesClasses(); } emitContainerClasses() { if (!this.params._emitClasses || !this.el) return; const cls = this.el.className.split(" ").filter((className) => { return className.indexOf("swiper") === 0 || className.indexOf(this.params.containerModifierClass) === 0; }); this.emit("_containerClasses", cls.join(" ")); } getSlideClasses(slideEl) { if (this.destroyed) return ""; return slideEl.className.split(" ").filter((className) => { return className.indexOf("swiper-slide") === 0 || className.indexOf(this.params.slideClass) === 0; }).join(" "); } emitSlidesClasses() { if (!this.params._emitClasses || !this.el) return; const updates = []; this.slides.forEach((slideEl) => { const classNames = this.getSlideClasses(slideEl); updates.push({ slideEl, classNames }); this.emit("_slideClass", slideEl, classNames); }); this.emit("_slideClasses", updates); } slidesPerViewDynamic(view = "current", exact = false) { const { params, slides, slidesGrid, slidesSizesGrid, size: swiperSize, activeIndex } = this; let spv = 1; if (typeof params.slidesPerView === "number") return params.slidesPerView; if (!swiperSize) return spv; if (params.centeredSlides) { let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize ?? 0) : 0; let breakLoop = false; for (let i3 = activeIndex + 1; i3 < slides.length; i3 += 1) { if (slides[i3] && !breakLoop) { slideSize += Math.ceil(slides[i3].swiperSlideSize ?? 0); spv += 1; if (slideSize > swiperSize) breakLoop = true; } } for (let i3 = activeIndex - 1; i3 >= 0; i3 -= 1) { if (slides[i3] && !breakLoop) { slideSize += slides[i3].swiperSlideSize ?? 0; spv += 1; if (slideSize > swiperSize) breakLoop = true; } } } else if (view === "current") { for (let i3 = activeIndex + 1; i3 < slides.length; i3 += 1) { const slideInView = exact ? slidesGrid[i3] + slidesSizesGrid[i3] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i3] - slidesGrid[activeIndex] < swiperSize; if (slideInView) { spv += 1; } } } else { for (let i3 = activeIndex - 1; i3 >= 0; i3 -= 1) { const slideInView = slidesGrid[activeIndex] - slidesGrid[i3] < swiperSize; if (slideInView) { spv += 1; } } } return spv; } update() { const swiper = this; if (!swiper || swiper.destroyed) return; const { snapGrid, params } = swiper; if (params.breakpoints) { swiper.setBreakpoint(); } [...swiper.el.querySelectorAll('[loading="lazy"]')].forEach((imageEl) => { if (imageEl.complete) { processLazyPreloader(swiper, imageEl); } }); swiper.updateSize(); swiper.updateSlides(); swiper.updateProgress(); swiper.updateSlidesClasses(); function setTranslate2() { const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); swiper.setTranslate(newTranslate); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } let translated; if (params.freeMode?.enabled && !params.cssMode) { setTranslate2(); if (params.autoHeight) { swiper.updateAutoHeight(); } } else { if ((params.slidesPerView === "auto" || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) { const slidesLength = swiper.virtual && params.virtual?.enabled ? swiper.virtual.slides.length : swiper.slides.length; translated = swiper.slideTo(slidesLength - 1, 0, false, true); } else { translated = swiper.slideTo(swiper.activeIndex, 0, false, true); } if (!translated) { setTranslate2(); } } if (params.watchOverflow && snapGrid !== swiper.snapGrid) { swiper.checkOverflow(); } swiper.emit("update"); } changeDirection(newDirection, needUpdate = true) { const swiper = this; const currentDirection = swiper.params.direction; if (!newDirection) { newDirection = currentDirection === "horizontal" ? "vertical" : "horizontal"; } if (newDirection === currentDirection || newDirection !== "horizontal" && newDirection !== "vertical") { return swiper; } swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`); swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`); swiper.emitContainerClasses(); swiper.params.direction = newDirection; swiper.slides.forEach((slideEl) => { if (newDirection === "vertical") { slideEl.style.width = ""; } else { slideEl.style.height = ""; } }); swiper.emit("changeDirection"); if (needUpdate) swiper.update(); return swiper; } changeLanguageDirection(direction) { const swiper = this; if (swiper.rtl && direction === "rtl" || !swiper.rtl && direction === "ltr") return; swiper.rtl = direction === "rtl"; swiper.rtlTranslate = swiper.params.direction === "horizontal" && swiper.rtl; if (swiper.rtl) { swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`); swiper.el.dir = "rtl"; } else { swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`); swiper.el.dir = "ltr"; } swiper.update(); } mount(element) { const swiper = this; if (swiper.mounted) return true; if (typeof document === "undefined") return false; const initialEl = element ?? swiper.params.el; let el = null; if (typeof initialEl === "string") { el = document.querySelector(initialEl); } else if (initialEl instanceof HTMLElement) { el = initialEl; } if (!el) { return false; } el.swiper = swiper; const parent = el.parentNode; if (parent && parent.host && parent.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) { swiper.isElement = true; } const getWrapperSelector = () => { return `.${(swiper.params.wrapperClass || "").trim().split(" ").join(".")}`; }; const getWrapper = () => { if (el && el.shadowRoot) { const res = el.shadowRoot.querySelector(getWrapperSelector()); return res; } return elementChildren(el, getWrapperSelector())[0]; }; let wrapperEl = getWrapper(); if (!wrapperEl && swiper.params.createElements) { wrapperEl = createElement("div", swiper.params.wrapperClass); el.append(wrapperEl); elementChildren(el, `.${swiper.params.slideClass}`).forEach((slideEl) => { wrapperEl.append(slideEl); }); } const host = swiper.isElement ? el.parentNode.host : null; Object.assign(swiper, { el, wrapperEl, slidesEl: swiper.isElement && !host.slideSlots ? host : wrapperEl, hostEl: swiper.isElement ? host : el, mounted: true, rtl: el.dir.toLowerCase() === "rtl" || elementStyle(el, "direction") === "rtl", rtlTranslate: swiper.params.direction === "horizontal" && (el.dir.toLowerCase() === "rtl" || elementStyle(el, "direction") === "rtl"), wrongRTL: elementStyle(wrapperEl, "display") === "-webkit-box" }); return true; } init(el) { const swiper = this; if (swiper.initialized) return swiper; const mounted = swiper.mount(el); if (mounted === false) return swiper; swiper.emit("beforeInit"); if (swiper.params.breakpoints) { swiper.setBreakpoint(); } swiper.addClasses(); swiper.updateSize(); swiper.updateSlides(); if (swiper.params.watchOverflow) { swiper.checkOverflow(); } if (swiper.params.grabCursor && swiper.enabled) { swiper.setGrabCursor(); } if (swiper.params.loop && swiper.virtual && swiper.params.virtual?.enabled) { swiper.slideTo((swiper.params.initialSlide ?? 0) + (swiper.virtual.slidesBefore ?? 0), 0, swiper.params.runCallbacksOnInit, false, true); } else { swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); } if (swiper.params.loop) { swiper.loopCreate(void 0, true); } swiper.attachEvents(); const lazyElements = [...swiper.el.querySelectorAll('[loading="lazy"]')]; if (swiper.isElement) { lazyElements.push(...swiper.hostEl.querySelectorAll('[loading="lazy"]')); } lazyElements.forEach((imageEl) => { if (imageEl.complete) { processLazyPreloader(swiper, imageEl); } else { imageEl.addEventListener("load", (e3) => { processLazyPreloader(swiper, e3.target); }); } }); preload(swiper); swiper.initialized = true; preload(swiper); swiper.emit("init"); swiper.emit("afterInit"); return swiper; } destroy(deleteInstance = true, cleanStyles = true) { const swiper = this; const { params, el, wrapperEl, slides } = swiper; if (typeof swiper.params === "undefined" || swiper.destroyed) { return null; } swiper.emit("beforeDestroy"); swiper.initialized = false; swiper.detachEvents(); if (params.loop) { swiper.loopDestroy(); } if (cleanStyles) { swiper.removeClasses(); if (el && typeof el !== "string") { el.removeAttribute("style"); } if (wrapperEl) { wrapperEl.removeAttribute("style"); } if (slides && slides.length) { slides.forEach((slideEl) => { slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass); slideEl.removeAttribute("style"); slideEl.removeAttribute("data-swiper-slide-index"); }); } } swiper.emit("destroy"); Object.keys(swiper.eventsListeners).forEach((eventName) => { swiper.off(eventName); }); if (deleteInstance !== false) { if (swiper.el && typeof swiper.el !== "string") { swiper.el.swiper = null; } deleteProps(swiper); } swiper.destroyed = true; return null; } static extendDefaults(newDefaults) { extend$1(extendedDefaults, newDefaults); } static installModule(mod) { if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = []; const modules = Swiper.prototype.__modules__; if (typeof mod === "function" && modules.indexOf(mod) < 0) { modules.push(mod); } } static use(module) { if (Array.isArray(module)) { module.forEach((m2) => Swiper.installModule(m2)); return Swiper; } Swiper.installModule(module); return Swiper; } }; Object.defineProperty(Swiper$1, "extendedDefaults", { get() { return extendedDefaults; } }); Object.defineProperty(Swiper$1, "defaults", { get() { return defaults; } }); const prototypeRecord = prototypes; const swiperProto = Swiper$1.prototype; Object.keys(prototypeRecord).forEach((prototypeGroup) => { const group = prototypeRecord[prototypeGroup]; Object.keys(group).forEach((protoMethod) => { swiperProto[protoMethod] = group[protoMethod]; }); }); Swiper$1.use([Resize, Observer]); function getChangedParams(swiperParams, oldParams, children, oldChildren, getKey) { const keys = []; if (!oldParams) return keys; const addKey = (key) => { if (keys.indexOf(key) < 0) keys.push(key); }; if (children && oldChildren) { const oldChildrenKeys = oldChildren.map(getKey); const childrenKeys = children.map(getKey); if (oldChildrenKeys.join("") !== childrenKeys.join("")) addKey("children"); if (oldChildren.length !== children.length) addKey("children"); } const watchParams = paramsList.filter((key) => key[0] === "_").map((key) => key.replace(/_/, "")); watchParams.forEach((key) => { if (key in swiperParams && key in oldParams) { const newVal = swiperParams[key]; const oldVal = oldParams[key]; if (isObject(newVal) && isObject(oldVal)) { const newKeys = Object.keys(newVal); const oldKeys = Object.keys(oldVal); if (newKeys.length !== oldKeys.length) { addKey(key); } else { newKeys.forEach((newKey) => { if (newVal[newKey] !== oldVal[newKey]) { addKey(key); } }); oldKeys.forEach((oldKey) => { if (newVal[oldKey] !== oldVal[oldKey]) addKey(key); }); } } else if (newVal !== oldVal) { addKey(key); } } }); return keys; } function getParams(obj = {}, splitEvents = true) { const params = { on: {} }; const events2 = {}; const passedParams = {}; extend(params, defaults); params._emitClasses = true; params.init = false; const rest = {}; const allowedParams = paramsList.map((key) => key.replace(/_/, "")); const plainObj = { ...obj }; Object.keys(plainObj).forEach((key) => { const value = obj[key]; if (typeof value === "undefined") return; if (allowedParams.indexOf(key) >= 0) { if (isObject(value)) { params[key] = {}; passedParams[key] = {}; extend(params[key], value); extend(passedParams[key], value); } else { params[key] = value; passedParams[key] = value; } } else if (key.search(/on[A-Z]/) === 0 && typeof value === "function") { const eventName = `${key[2].toLowerCase()}${key.substring(3)}`; const handler = value; if (splitEvents) { events2[eventName] = handler; } else { params.on[eventName] = handler; } } else { rest[key] = value; } }); ["navigation", "pagination", "scrollbar"].forEach((key) => { if (params[key] === true) params[key] = {}; if (params[key] === false) delete params[key]; }); return { params, passedParams, rest, events: events2 }; } function mountSwiper(refs, swiperParams) { const { el, nextEl, prevEl, paginationEl, scrollbarEl, swiper } = refs; if (needsNavigation(swiperParams) && nextEl && prevEl) { const params = swiper.params.navigation; const original = swiper.originalParams.navigation; params.nextEl = nextEl; original.nextEl = nextEl; params.prevEl = prevEl; original.prevEl = prevEl; } if (needsPagination(swiperParams) && paginationEl) { swiper.params.pagination.el = paginationEl; swiper.originalParams.pagination.el = paginationEl; } if (needsScrollbar(swiperParams) && scrollbarEl) { swiper.params.scrollbar.el = scrollbarEl; swiper.originalParams.scrollbar.el = scrollbarEl; } swiper.init(el); } const updateOnVirtualData = (swiper) => { if (!swiper || swiper.destroyed || !swiper.params.virtual || swiper.params.virtual && !swiper.params.virtual.enabled) return; swiper.updateSlides(); swiper.updateProgress(); swiper.updateSlidesClasses(); swiper.emit("_virtualUpdated"); if (swiper.parallax && swiper.params.parallax && swiper.params.parallax.enabled) { swiper.parallax.setTranslate?.(); } }; function getChildren(originalSlots = {}, slidesRef, oldSlidesRef) { const slides = []; const slots = { "container-start": [], "container-end": [], "wrapper-start": [], "wrapper-end": [] }; const getSlidesFromElements = (els, slotName) => { if (!Array.isArray(els)) return; let effectiveSlot = slotName === "default" ? "container-end" : slotName; els.forEach((vnode) => { const isFragment = typeof vnode.type === "symbol"; if (isFragment && vnode.children) { getSlidesFromElements(vnode.children, effectiveSlot); return; } const typeObj = vnode.type; const legacyTag = vnode.componentOptions?.tag; if (typeObj && (typeObj.name === "SwiperSlide" || typeObj.name === "AsyncComponentWrapper") || legacyTag === "SwiperSlide") { slides.push(vnode); } else if (slots[effectiveSlot]) { slots[effectiveSlot].push(vnode); } }); }; Object.keys(originalSlots).forEach((slotName) => { const slotFn = originalSlots[slotName]; if (typeof slotFn !== "function") return; const els = slotFn(); getSlidesFromElements(els, slotName); }); oldSlidesRef.value = slidesRef.value; slidesRef.value = slides; return { slides, slots }; } function renderVirtual(swiperRef, slides, virtualData) { if (!virtualData) return null; const swiper = swiperRef.value; if (!swiper) return null; const getSlideIndex = (index) => { let slideIndex = index; if (index < 0) { slideIndex = slides.length + index; } else if (slideIndex >= slides.length) { slideIndex -= slides.length; } return slideIndex; }; const style = swiper.isHorizontal() ? { [swiper.rtlTranslate ? "right" : "left"]: `${virtualData.offset}px` } : { top: `${virtualData.offset}px` }; const { from, to } = virtualData; const loopFrom = swiper.params.loop ? -slides.length : 0; const loopTo = swiper.params.loop ? slides.length * 2 : slides.length; const slidesToRender = []; for (let i3 = loopFrom; i3 < loopTo; i3 += 1) { if (i3 >= from && i3 <= to && slidesToRender.length < slides.length) { const slide2 = slides[getSlideIndex(i3)]; if (slide2) slidesToRender.push(slide2); } } return slidesToRender.map((slide2) => { const props = slide2.props ?? {}; props.style = props.style ?? {}; props.swiperRef = swiperRef; props.style = style; slide2.props = props; if (slide2.type) { return vue.h(slide2.type, { ...props }, slide2.children); } if (slide2.componentOptions) { return vue.h(slide2.componentOptions.Ctor, { ...props }, slide2.componentOptions.children); } return void 0; }); } const SWIPER_EVENTS = [ "_beforeBreakpoint", "_containerClasses", "_slideClass", "_slideClasses", "_swiper", "_freeModeNoMomentumRelease", "_virtualUpdated", "activeIndexChange", "afterInit", "autoplay", "autoplayStart", "autoplayStop", "autoplayPause", "autoplayResume", "autoplayTimeLeft", "beforeDestroy", "beforeInit", "beforeLoopFix", "beforeResize", "beforeSlideChangeStart", "beforeTransitionStart", "breakpoint", "changeDirection", "click", "disable", "doubleTap", "doubleClick", "destroy", "enable", "fromEdge", "hashChange", "hashSet", "init", "keyPress", "lock", "loopFix", "momentumBounce", "navigationHide", "navigationShow", "navigationPrev", "navigationNext", "observerUpdate", "orientationchange", "paginationHide", "paginationRender", "paginationShow", "paginationUpdate", "progress", "reachBeginning", "reachEnd", "realIndexChange", "resize", "scroll", "scrollbarDragEnd", "scrollbarDragMove", "scrollbarDragStart", "setTransition", "setTranslate", "slidesUpdated", "slideChange", "slideChangeTransitionEnd", "slideChangeTransitionStart", "slideNextTransitionEnd", "slideNextTransitionStart", "slidePrevTransitionEnd", "slidePrevTransitionStart", "slideResetTransitionStart", "slideResetTransitionEnd", "sliderMove", "sliderFirstMove", "slidesLengthChange", "slidesGridLengthChange", "snapGridLengthChange", "snapIndexChange", "swiper", "tap", "toEdge", "touchEnd", "touchMove", "touchMoveOpposite", "touchStart", "transitionEnd", "transitionStart", "unlock", "update", "virtualUpdate", "zoomChange" ]; const Swiper2 = vue.defineComponent({ name: "Swiper", props: { tag: { type: String, default: "div" }, wrapperTag: { type: String, default: "div" }, modules: { type: Array, default: void 0 }, init: { type: Boolean, default: void 0 }, direction: { type: String, default: void 0 }, oneWayMovement: { type: Boolean, default: void 0 }, swiperElementNodeName: { type: String, default: "SWIPER-CONTAINER" }, touchEventsTarget: { type: String, default: void 0 }, initialSlide: { type: Number, default: void 0 }, speed: { type: Number, default: void 0 }, cssMode: { type: Boolean, default: void 0 }, updateOnWindowResize: { type: Boolean, default: void 0 }, resizeObserver: { type: Boolean, default: void 0 }, nested: { type: Boolean, default: void 0 }, focusableElements: { type: String, default: void 0 }, width: { type: Number, default: void 0 }, height: { type: Number, default: void 0 }, preventInteractionOnTransition: { type: Boolean, default: void 0 }, userAgent: { type: String, default: void 0 }, url: { type: String, default: void 0 }, edgeSwipeDetection: { type: [Boolean, String], default: void 0 }, edgeSwipeThreshold: { type: Number, default: void 0 }, autoHeight: { type: Boolean, default: void 0 }, setWrapperSize: { type: Boolean, default: void 0 }, virtualTranslate: { type: Boolean, default: void 0 }, effect: { type: String, default: void 0 }, breakpoints: { type: Object, default: void 0 }, breakpointsBase: { type: String, default: void 0 }, spaceBetween: { type: [Number, String], default: void 0 }, slidesPerView: { type: [Number, String], default: void 0 }, maxBackfaceHiddenSlides: { type: Number, default: void 0 }, slidesPerGroup: { type: Number, default: void 0 }, slidesPerGroupSkip: { type: Number, default: void 0 }, slidesPerGroupAuto: { type: Boolean, default: void 0 }, centeredSlides: { type: Boolean, default: void 0 }, centeredSlidesBounds: { type: Boolean, default: void 0 }, slidesOffsetBefore: { type: Number, default: void 0 }, slidesOffsetAfter: { type: Number, default: void 0 }, normalizeSlideIndex: { type: Boolean, default: void 0 }, centerInsufficientSlides: { type: Boolean, default: void 0 }, watchOverflow: { type: Boolean, default: void 0 }, roundLengths: { type: Boolean, default: void 0 }, touchRatio: { type: Number, default: void 0 }, touchAngle: { type: Number, default: void 0 }, simulateTouch: { type: Boolean, default: void 0 }, shortSwipes: { type: Boolean, default: void 0 }, longSwipes: { type: Boolean, default: void 0 }, longSwipesRatio: { type: Number, default: void 0 }, longSwipesMs: { type: Number, default: void 0 }, followFinger: { type: Boolean, default: void 0 }, allowTouchMove: { type: Boolean, default: void 0 }, threshold: { type: Number, default: void 0 }, touchMoveStopPropagation: { type: Boolean, default: void 0 }, touchStartPreventDefault: { type: Boolean, default: void 0 }, touchStartForcePreventDefault: { type: Boolean, default: void 0 }, touchReleaseOnEdges: { type: Boolean, default: void 0 }, uniqueNavElements: { type: Boolean, default: void 0 }, resistance: { type: Boolean, default: void 0 }, resistanceRatio: { type: Number, default: void 0 }, watchSlidesProgress: { type: Boolean, default: void 0 }, grabCursor: { type: Boolean, default: void 0 }, preventClicks: { type: Boolean, default: void 0 }, preventClicksPropagation: { type: Boolean, default: void 0 }, slideToClickedSlide: { type: Boolean, default: void 0 }, loop: { type: Boolean, default: void 0 }, loopedSlides: { type: Number, default: void 0 }, loopPreventsSliding: { type: Boolean, default: void 0 }, loopAdditionalSlides: { type: Number, default: void 0 }, loopAddBlankSlides: { type: Boolean, default: void 0 }, rewind: { type: Boolean, default: void 0 }, allowSlidePrev: { type: Boolean, default: void 0 }, allowSlideNext: { type: Boolean, default: void 0 }, swipeHandler: { type: Boolean, default: void 0 }, noSwiping: { type: Boolean, default: void 0 }, noSwipingClass: { type: String, default: void 0 }, noSwipingSelector: { type: String, default: void 0 }, passiveListeners: { type: Boolean, default: void 0 }, containerModifierClass: { type: String, default: void 0 }, slideClass: { type: String, default: void 0 }, slideActiveClass: { type: String, default: void 0 }, slideVisibleClass: { type: String, default: void 0 }, slideFullyVisibleClass: { type: String, default: void 0 }, slideBlankClass: { type: String, default: void 0 }, slideNextClass: { type: String, default: void 0 }, slidePrevClass: { type: String, default: void 0 }, wrapperClass: { type: String, default: void 0 }, lazyPreloaderClass: { type: String, default: void 0 }, lazyPreloadPrevNext: { type: Number, default: void 0 }, runCallbacksOnInit: { type: Boolean, default: void 0 }, observer: { type: Boolean, default: void 0 }, observeParents: { type: Boolean, default: void 0 }, observeSlideChildren: { type: Boolean, default: void 0 }, a11y: { type: [Boolean, Object], default: void 0 }, autoplay: { type: [Boolean, Object], default: void 0 }, controller: { type: Object, default: void 0 }, coverflowEffect: { type: Object, default: void 0 }, cubeEffect: { type: Object, default: void 0 }, fadeEffect: { type: Object, default: void 0 }, flipEffect: { type: Object, default: void 0 }, creativeEffect: { type: Object, default: void 0 }, cardsEffect: { type: Object, default: void 0 }, hashNavigation: { type: [Boolean, Object], default: void 0 }, history: { type: [Boolean, Object], default: void 0 }, keyboard: { type: [Boolean, Object], default: void 0 }, mousewheel: { type: [Boolean, Object], default: void 0 }, navigation: { type: [Boolean, Object], default: void 0 }, pagination: { type: [Boolean, Object], default: void 0 }, parallax: { type: [Boolean, Object], default: void 0 }, scrollbar: { type: [Boolean, Object], default: void 0 }, thumbs: { type: Object, default: void 0 }, virtual: { type: [Boolean, Object], default: void 0 }, zoom: { type: [Boolean, Object], default: void 0 }, grid: { type: Object, default: void 0 }, freeMode: { type: [Boolean, Object], default: void 0 }, enabled: { type: Boolean, default: void 0 } }, emits: SWIPER_EVENTS, setup(props, { slots: originalSlots, emit }) { const { tag: Tag, wrapperTag: WrapperTag } = props; const containerClasses = vue.ref("swiper"); const virtualData = vue.ref(null); const breakpointChanged = vue.ref(false); const initializedRef = vue.ref(false); const swiperElRef = vue.ref(null); const swiperRef = vue.shallowRef(null); const oldPassedParamsRef = vue.ref(null); const slidesRef = { value: [] }; const oldSlidesRef = { value: [] }; const nextElRef = vue.ref(null); const prevElRef = vue.ref(null); const paginationElRef = vue.ref(null); const scrollbarElRef = vue.ref(null); const { params: swiperParams, passedParams } = getParams(props, false); getChildren(originalSlots, slidesRef, oldSlidesRef); oldPassedParamsRef.value = passedParams; oldSlidesRef.value = slidesRef.value; const onBeforeBreakpoint = () => { getChildren(originalSlots, slidesRef, oldSlidesRef); breakpointChanged.value = true; }; swiperParams.onAny = (event, ...args) => { emit(event, ...args); }; Object.assign(swiperParams.on, { _beforeBreakpoint: onBeforeBreakpoint, _containerClasses(_swiper, classes2) { containerClasses.value = classes2; } }); const passParams = { ...swiperParams }; delete passParams.wrapperClass; swiperRef.value = new Swiper$1(passParams); const instance = swiperRef.value; if (instance && instance.virtual && instance.params.virtual?.enabled) { instance.virtual.slides = slidesRef.value; const extendWith = { cache: false, slides: slidesRef.value, renderExternal: (data) => { virtualData.value = data; }, renderExternalUpdate: false }; extend(instance.params.virtual, extendWith); if (instance.originalParams.virtual) extend(instance.originalParams.virtual, extendWith); } vue.onUpdated(() => { if (!initializedRef.value && swiperRef.value) { swiperRef.value.emitSlidesClasses(); initializedRef.value = true; } const { passedParams: newPassedParams } = getParams(props, false); const changedParams = getChangedParams(newPassedParams, oldPassedParamsRef.value, slidesRef.value, oldSlidesRef.value, (c2) => c2.props ? c2.props.key : void 0); oldPassedParamsRef.value = newPassedParams; if ((changedParams.length || breakpointChanged.value) && swiperRef.value && !swiperRef.value.destroyed) { updateSwiper({ swiper: swiperRef.value, slides: slidesRef.value, passedParams: newPassedParams, changedParams, nextEl: nextElRef.value, prevEl: prevElRef.value, scrollbarEl: scrollbarElRef.value, paginationEl: paginationElRef.value }); } breakpointChanged.value = false; }); vue.provide("swiper", swiperRef); vue.watch(virtualData, () => { vue.nextTick(() => { updateOnVirtualData(swiperRef.value); }); }); vue.onMounted(() => { if (!swiperElRef.value || !swiperRef.value) return; mountSwiper({ el: swiperElRef.value, nextEl: nextElRef.value, prevEl: prevElRef.value, paginationEl: paginationElRef.value, scrollbarEl: scrollbarElRef.value, swiper: swiperRef.value }, swiperParams); emit("swiper", swiperRef.value); }); vue.onBeforeUnmount(() => { if (swiperRef.value && !swiperRef.value.destroyed) { swiperRef.value.destroy(true, false); } }); function renderSlides(slides) { if (swiperParams.virtual) { return renderVirtual(swiperRef, slides, virtualData.value); } slides.forEach((slide2, index) => { const slideProps = slide2.props ?? {}; slideProps.swiperRef = swiperRef; slideProps.swiperSlideIndex = index; slide2.props = slideProps; }); return slides; } return () => { const { slides, slots } = getChildren(originalSlots, slidesRef, oldSlidesRef); return vue.h(Tag, { ref: swiperElRef, class: uniqueClasses(containerClasses.value) }, [ slots["container-start"], vue.h(WrapperTag, { class: wrapperClass(swiperParams.wrapperClass) }, [ slots["wrapper-start"], renderSlides(slides), slots["wrapper-end"] ]), needsNavigation(props) && [ vue.h("div", { ref: prevElRef, class: "swiper-button-prev" }), vue.h("div", { ref: nextElRef, class: "swiper-button-next" }) ], needsScrollbar(props) && vue.h("div", { ref: scrollbarElRef, class: "swiper-scrollbar" }), needsPagination(props) && vue.h("div", { ref: paginationElRef, class: "swiper-pagination" }), slots["container-end"] ]); }; } }); const SwiperSlide = vue.defineComponent({ name: "SwiperSlide", props: { tag: { type: String, default: "div" }, swiperRef: { type: Object, required: false }, swiperSlideIndex: { type: Number, default: void 0, required: false }, zoom: { type: [Boolean, Number], default: void 0, required: false }, lazy: { type: Boolean, default: false, required: false }, virtualIndex: { type: [String, Number], default: void 0 } }, setup(props, { slots }) { let eventAttached = false; const { swiperRef } = props; const slideElRef = vue.ref(null); const slideClasses = vue.ref("swiper-slide"); const lazyLoaded = vue.ref(false); function updateClasses(_swiper, el, classNames) { if (el === slideElRef.value) { slideClasses.value = classNames; } } vue.onMounted(() => { if (!swiperRef || !swiperRef.value) return; swiperRef.value.on("_slideClass", updateClasses); eventAttached = true; }); vue.onBeforeUpdate(() => { if (eventAttached || !swiperRef || !swiperRef.value) return; swiperRef.value.on("_slideClass", updateClasses); eventAttached = true; }); vue.onUpdated(() => { if (!slideElRef.value || !swiperRef || !swiperRef.value) return; if (typeof props.swiperSlideIndex !== "undefined") { slideElRef.value.swiperSlideIndex = props.swiperSlideIndex; } if (swiperRef.value.destroyed) { if (slideClasses.value !== "swiper-slide") { slideClasses.value = "swiper-slide"; } } }); vue.onBeforeUnmount(() => { if (!swiperRef || !swiperRef.value) return; swiperRef.value.off("_slideClass", updateClasses); }); const slideData = vue.computed(() => ({ isActive: slideClasses.value.indexOf("swiper-slide-active") >= 0, isVisible: slideClasses.value.indexOf("swiper-slide-visible") >= 0, isPrev: slideClasses.value.indexOf("swiper-slide-prev") >= 0, isNext: slideClasses.value.indexOf("swiper-slide-next") >= 0 })); vue.provide("swiperSlide", slideData); const onLoad2 = () => { lazyLoaded.value = true; }; const lazyPreloaderHook = (vnode) => { const el = vnode.el; if (el) el.lazyPreloaderManaged = true; }; return () => vue.h(props.tag, { class: uniqueClasses(`${slideClasses.value}`), ref: slideElRef, "data-swiper-slide-index": typeof props.virtualIndex === "undefined" && swiperRef && swiperRef.value && swiperRef.value.params.loop ? props.swiperSlideIndex : props.virtualIndex, onLoadCapture: onLoad2 }, props.zoom ? vue.h("div", { class: "swiper-zoom-container", "data-swiper-zoom": typeof props.zoom === "number" ? props.zoom : void 0 }, [ slots.default && slots.default(slideData.value), props.lazy && !lazyLoaded.value && vue.h("div", { class: "swiper-lazy-preloader", onVnodeMounted: lazyPreloaderHook }) ]) : [ slots.default && slots.default(slideData.value), props.lazy && !lazyLoaded.value && vue.h("div", { class: "swiper-lazy-preloader", onVnodeMounted: lazyPreloaderHook }) ]); } }); const EMOJI_API = "https://api.live.bilibili.com/xlive/web-ucenter/v2/emoticon/GetEmoticons"; async function getEmojis(roomId) { if (roomId === "") throw new Error("未找到直播间ID"); const params = new URLSearchParams({ room_id: roomId, platform: "pc" }); const response = await fetch(`${EMOJI_API}?${params.toString()}`, { method: "GET", credentials: "include" }); if (!response.ok) throw new Error(`获取表情失败(HTTP ${response.status})`); const result = await response.json(); if (result.code !== 0) { throw new Error(result.message || result.msg || "获取表情失败"); } return (result.data?.data ?? []).map((group) => ({ current_cover: group.current_cover ?? "", name: group.pkg_name ?? "表情", emojicons: group.emoticons ?? [] })); } const _hoisted_1$9 = { class: "emoji-picker", "aria-label": "表情列表" }; const _hoisted_2$3 = { key: 0, class: "emoji-feedback" }; const _hoisted_3$3 = { key: 1, class: "emoji-feedback" }; const _hoisted_4$3 = { class: "emoji-grid" }; const _hoisted_5$3 = ["title", "aria-label", "onClick"]; const _sfc_main$b = vue.defineComponent({ __name: "DanmakuEmojiPicker", emits: ["select"], setup(__props, { emit: __emit }) { const emit = __emit; const liverStore = useLiverStore(); const { roomId } = pinia$1.storeToRefs(liverStore); const visible = vue.ref(false); const loading = vue.ref(false); const loaded = vue.ref(false); const errorMessage = vue.ref(""); const emojiGroup = vue.ref(null); async function loadEmojis() { if (loaded.value || loading.value) return; loading.value = true; errorMessage.value = ""; try { await liverStore.roomContext(); if (roomId.value === null) throw new Error("未找到直播间ID"); const [firstEmojiGroup] = await getEmojis(roomId.value); emojiGroup.value = firstEmojiGroup ?? null; loaded.value = true; if (!emojiGroup.value || emojiGroup.value.emojicons.length === 0) { errorMessage.value = "暂无可用表情"; } } catch (error) { errorMessage.value = error instanceof Error ? error.message : "获取表情失败"; } finally { loading.value = false; } } function selectEmoji(emoji) { emit("select", emoji); visible.value = false; } return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElPopover), { visible: visible.value, "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => visible.value = $event), placement: "bottom-end", trigger: "click", width: 320, "z-index": 2147483200, "popper-class": "danmaku-emoji-popover", onBeforeEnter: loadEmojis }, { reference: vue.withCtx(() => [..._cache[1] || (_cache[1] = [ vue.createElementVNode("button", { class: "emoji-trigger", type: "button", "aria-label": "查看表情", title: "查看表情" }, [ vue.createElementVNode("span", { "aria-hidden": "true" }, "☺") ], -1) ])]), default: vue.withCtx(() => [ vue.createElementVNode("div", _hoisted_1$9, [ loading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, "正在加载表情…")) : errorMessage.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, vue.toDisplayString(errorMessage.value), 1)) : emojiGroup.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElScrollbar), { key: 2, height: "210px" }, { default: vue.withCtx(() => [ vue.createElementVNode("div", _hoisted_4$3, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(emojiGroup.value.emojicons, (emoji) => { return vue.openBlock(), vue.createElementBlock("button", { key: emoji.emoticon_id, class: "emoji-item", type: "button", title: emoji.emoji, "aria-label": `插入表情 ${emoji.emoji}`, onClick: ($event) => selectEmoji(emoji) }, [ vue.createVNode(vue.unref(ElementPlus.ElImage), { src: emoji.url, alt: emoji.emoji, fit: "contain", lazy: "" }, null, 8, ["src", "alt"]) ], 8, _hoisted_5$3); }), 128)) ]) ]), _: 1 })) : vue.createCommentVNode("", true) ]) ]), _: 1 }, 8, ["visible"]); }; } }); const DanmakuEmojiPicker = _export_sfc(_sfc_main$b, [["__scopeId", "data-v-c6f56ffa"]]); const _hoisted_1$8 = { class: "add-danmaku-prompt" }; const _sfc_main$a = vue.defineComponent({ __name: "AddDanmakuPrompt", props: { isDuplicate: { type: Function } }, emits: ["submit"], setup(__props, { expose: __expose, emit: __emit }) { const props = __props; const emit = __emit; const inputRef = vue.ref(); const content = vue.ref(""); const errorMessage = vue.ref(""); function validate() { const normalizedContent = content.value.trim(); if (normalizedContent === "") { errorMessage.value = "请输入弹幕内容"; return false; } if (props.isDuplicate(normalizedContent)) { errorMessage.value = "该弹幕已存在"; return false; } errorMessage.value = ""; return true; } function getContent() { return content.value.trim(); } function clearError() { if (errorMessage.value !== "") errorMessage.value = ""; } async function insertEmoji(emoji) { const input = inputRef.value?.input; const selectionStart = input?.selectionStart ?? content.value.length; const selectionEnd = input?.selectionEnd ?? selectionStart; content.value = `${content.value.slice(0, selectionStart)}${emoji.emoji}${content.value.slice(selectionEnd)}`; clearError(); await vue.nextTick(); const nextCursor = selectionStart + emoji.emoji.length; inputRef.value?.focus(); inputRef.value?.input?.setSelectionRange(nextCursor, nextCursor); } function submitOnEnter(event) { if (!(event instanceof KeyboardEvent) || event.isComposing) return; event.preventDefault(); emit("submit"); } vue.onMounted(() => { vue.nextTick(() => inputRef.value?.focus()); }); __expose({ getContent, validate }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [ _cache[1] || (_cache[1] = vue.createElementVNode("p", { class: "prompt-description" }, "输入一条要收藏并用于连发的弹幕", -1)), vue.createVNode(vue.unref(ElementPlus.ElInput), { ref_key: "inputRef", ref: inputRef, modelValue: content.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => content.value = $event), class: "danmaku-input", placeholder: "请输入弹幕内容", "aria-invalid": errorMessage.value !== "", onInput: clearError, onKeydown: vue.withKeys(submitOnEnter, ["enter"]) }, { suffix: vue.withCtx(() => [ vue.createVNode(DanmakuEmojiPicker, { onSelect: insertEmoji }) ]), _: 1 }, 8, ["modelValue", "aria-invalid"]), vue.createElementVNode("div", { class: vue.normalizeClass(["prompt-error", { visible: errorMessage.value }]), role: "alert" }, vue.toDisplayString(errorMessage.value), 3) ]); }; } }); const AddDanmakuPrompt = _export_sfc(_sfc_main$a, [["__scopeId", "data-v-2ff4aeef"]]); const _hoisted_1$7 = { class: "manager-item", role: "listitem" }; const _hoisted_2$2 = { class: "manager-item-content" }; const _hoisted_3$2 = { class: "manager-item-footer" }; const _hoisted_4$2 = { class: "manager-item-meta" }; const _hoisted_5$2 = { class: "manager-item-actions" }; const _sfc_main$9 = vue.defineComponent({ __name: "DanmakuManagerItem", props: { danmaku: {} }, emits: ["delete"], setup(__props, { emit: __emit }) { const emit = __emit; async function copyDanmaku(content) { try { await navigator.clipboard.writeText(content); ElementPlus.ElMessage.success("已复制到剪贴板"); } catch { ElementPlus.ElMessage.error("复制失败,请手动复制"); } } return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [ vue.createElementVNode("div", _hoisted_2$2, vue.toDisplayString(__props.danmaku.content), 1), vue.createElementVNode("div", _hoisted_3$2, [ vue.createElementVNode("div", _hoisted_4$2, vue.toDisplayString(__props.danmaku.date), 1), vue.createElementVNode("div", _hoisted_5$2, [ vue.createVNode(vue.unref(ElementPlus.ElButton), { class: "manager-copy-button", text: "", size: "small", "aria-label": `复制弹幕:${__props.danmaku.content}`, onClick: _cache[0] || (_cache[0] = ($event) => copyDanmaku(__props.danmaku.content)) }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElIcon), { "aria-hidden": "true" }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlusIconsVue.DocumentCopy)) ]), _: 1 }), _cache[2] || (_cache[2] = vue.createTextVNode(" 复制 ", -1)) ]), _: 1 }, 8, ["aria-label"]), vue.createVNode(vue.unref(ElementPlus.ElButton), { class: "manager-delete-button", text: "", size: "small", "aria-label": `删除弹幕:${__props.danmaku.content}`, onClick: _cache[1] || (_cache[1] = ($event) => emit("delete", __props.danmaku.id)) }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElIcon), { "aria-hidden": "true" }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlusIconsVue.Delete)) ]), _: 1 }), _cache[3] || (_cache[3] = vue.createTextVNode(" 删除 ", -1)) ]), _: 1 }, 8, ["aria-label"]) ]) ]) ]); }; } }); const DanmakuManagerItem = _export_sfc(_sfc_main$9, [["__scopeId", "data-v-6e8c9874"]]); const _hoisted_1$6 = { class: "danmaku-manager-overlay", "data-testid": "danmaku-manager", role: "presentation" }; const _hoisted_2$1 = { class: "danmaku-manager-dialog", role: "dialog", "aria-modal": "true", "aria-labelledby": "danmaku-manager-title" }; const _hoisted_3$1 = { class: "manager-header" }; const _hoisted_4$1 = { class: "manager-toolbar" }; const _hoisted_5$1 = { class: "manager-summary" }; const _hoisted_6 = { class: "manager-count" }; const _hoisted_7 = { class: "manager-actions" }; const _hoisted_8 = { class: "manager-list", role: "list", "aria-label": "弹幕列表" }; const _hoisted_9 = { key: 0, class: "manager-empty" }; const _sfc_main$8 = vue.defineComponent({ __name: "DanmakuManagerDialog", emits: ["close"], setup(__props, { emit: __emit }) { const emit = __emit; const danmakuLibraryStore = useDanmakuLibraryStore(); const { danmakuList } = pinia$1.storeToRefs(danmakuLibraryStore); function isDismissReason(reason) { return reason === "cancel" || reason === "close"; } async function addCustomDanmaku(event) { const triggerButton = event.currentTarget instanceof HTMLButtonElement ? event.currentTarget : null; const clearFocusAfterClose = event.detail > 0; const promptRef = vue.ref(null); let content = ""; try { await ElementPlus.ElMessageBox({ title: "新增自定义弹幕", message: ({ confirm }) => vue.h(AddDanmakuPrompt, { ref: promptRef, isDuplicate: (value) => danmakuLibraryStore.hasDanmaku(value), onSubmit: confirm }), confirmButtonText: "新增", cancelButtonText: "取消", showConfirmButton: true, showCancelButton: true, closeOnClickModal: false, distinguishCancelAndClose: true, roundButton: true, customClass: "danmaku-prompt", modalClass: "danmaku-prompt-overlay", beforeClose(action, _instance, done) { if (action !== "confirm") { done(); return; } if (!promptRef.value?.validate()) return; content = promptRef.value.getContent(); done(); } }); const result = danmakuLibraryStore.addDanmaku(content); if (result !== "added") { ElementPlus.ElMessage({ message: result === "exists" ? "该弹幕已存在" : "弹幕内容不能为空", type: result === "exists" ? "info" : "warning" }); return; } danmakuLibraryStore.setCurrentDanmaku(content); ElementPlus.ElMessage.success("已新增并选中"); } catch (reason) { if (isDismissReason(reason)) return; throw reason; } finally { if (clearFocusAfterClose && triggerButton) { requestAnimationFrame(() => { if (document.activeElement === triggerButton) triggerButton.blur(); }); } } } async function restoreInitialDanmaku() { try { await ElementPlus.ElMessageBox.confirm( "当前弹幕库中的内容会被清空", "清空当前弹幕库", { confirmButtonText: "清空", cancelButtonText: "取消", closeOnClickModal: false, distinguishCancelAndClose: true, roundButton: true, type: "warning", customClass: "danmaku-prompt", modalClass: "danmaku-prompt-overlay" } ); danmakuLibraryStore.restoreInitialDanmaku(); ElementPlus.ElMessage.success("已恢复初始弹幕"); } catch (reason) { if (isDismissReason(reason)) return; throw reason; } } function removeManagedDanmaku(id) { if (!danmakuLibraryStore.removeDanmaku(id)) return; ElementPlus.ElMessage.success("已删除弹幕"); } return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [ vue.createElementVNode("div", _hoisted_1$6, [ vue.createElementVNode("section", _hoisted_2$1, [ vue.createElementVNode("header", _hoisted_3$1, [ _cache[1] || (_cache[1] = vue.createElementVNode("div", { class: "manager-heading" }, [ vue.createElementVNode("div", { id: "danmaku-manager-title", class: "manager-title" }, "管理弹幕"), vue.createElementVNode("div", { class: "manager-subtitle" }, "集中管理用于连发和快捷发送的弹幕") ], -1)), vue.createElementVNode("button", { class: "manager-close-button", type: "button", "aria-label": "关闭管理弹幕", onClick: _cache[0] || (_cache[0] = ($event) => emit("close")) }, [ vue.createVNode(vue.unref(ElementPlus.ElIcon), { "aria-hidden": "true" }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlusIconsVue.Close)) ]), _: 1 }) ]) ]), vue.createElementVNode("div", _hoisted_4$1, [ vue.createElementVNode("div", _hoisted_5$1, [ _cache[2] || (_cache[2] = vue.createElementVNode("span", { class: "manager-summary-label" }, "弹幕列表", -1)), vue.createElementVNode("span", _hoisted_6, vue.toDisplayString(vue.unref(danmakuList).length) + " 条", 1) ]), vue.createElementVNode("div", _hoisted_7, [ vue.createVNode(vue.unref(ElementPlus.ElButton), { class: "manager-action manager-restore-action", plain: "", round: "", size: "small", "data-testid": "restore-initial-danmaku", onClick: restoreInitialDanmaku }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElIcon), { "aria-hidden": "true" }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlusIconsVue.Refresh)) ]), _: 1 }), _cache[3] || (_cache[3] = vue.createTextVNode(" 清空 ", -1)) ]), _: 1 }), vue.createVNode(vue.unref(ElementPlus.ElButton), { class: "manager-action manager-add-action", type: "primary", round: "", size: "small", "data-testid": "add-custom-danmaku", onClick: addCustomDanmaku }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElIcon), { "aria-hidden": "true" }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlusIconsVue.Plus)) ]), _: 1 }), _cache[4] || (_cache[4] = vue.createTextVNode(" 新增弹幕 ", -1)) ]), _: 1 }) ]) ]), vue.createElementVNode("div", _hoisted_8, [ vue.unref(danmakuList).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9, " 还没有弹幕,先新增一条吧 ")) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(danmakuList), (danmaku) => { return vue.openBlock(), vue.createBlock(DanmakuManagerItem, { key: danmaku.id, danmaku, onDelete: removeManagedDanmaku }, null, 8, ["danmaku"]); }), 128)) ]) ]) ]) ]); }; } }); const DanmakuManagerDialog = _export_sfc(_sfc_main$8, [["__scopeId", "data-v-e58b40b7"]]); const _hoisted_1$5 = { class: "setting-row" }; const _sfc_main$7 = vue.defineComponent({ __name: "SettingRow", props: { label: {} }, setup(__props) { return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [ vue.createElementVNode("span", null, vue.toDisplayString(__props.label), 1), vue.renderSlot(_ctx.$slots, "default", {}, void 0, true) ]); }; } }); const SettingRow = _export_sfc(_sfc_main$7, [["__scopeId", "data-v-c8818322"]]); const _hoisted_1$4 = { class: "section-title" }; const _sfc_main$6 = vue.defineComponent({ __name: "SettingSection", props: { title: {}, first: { type: Boolean } }, setup(__props) { return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("section", { class: vue.normalizeClass(["settings-section", { "is-first": __props.first }]) }, [ vue.createElementVNode("div", _hoisted_1$4, vue.toDisplayString(__props.title), 1), vue.renderSlot(_ctx.$slots, "default", {}, void 0, true) ], 2); }; } }); const SettingSection = _export_sfc(_sfc_main$6, [["__scopeId", "data-v-77ee4703"]]); const _sfc_main$5 = vue.defineComponent({ __name: "BatchSendSettingsPage", emits: ["manageDanmaku"], setup(__props, { emit: __emit }) { const emit = __emit; const { batchSendInterval, batchSendTotalCount } = pinia$1.storeToRefs(useDanmakuBatchSendStore()); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", null, [ vue.createVNode(SettingSection, { title: "连发设置", first: "" }, { default: vue.withCtx(() => [ vue.createVNode(SettingRow, { label: "次数" }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElInputNumber), { modelValue: vue.unref(batchSendTotalCount), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(batchSendTotalCount) ? batchSendTotalCount.value = $event : null), class: "setting-input-number settings-control", "data-testid": "count-input", min: vue.unref(MIN_BATCH_SEND_COUNT), max: vue.unref(MAX_BATCH_SEND_COUNT), step: 1, precision: 0, "controls-position": "right", size: "small", "aria-label": "次数调节" }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }), vue.createVNode(SettingRow, { label: "间隔" }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElInputNumber), { modelValue: vue.unref(batchSendInterval), "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(batchSendInterval) ? batchSendInterval.value = $event : null), class: "setting-input-number settings-control", "data-testid": "interval-input", min: vue.unref(MIN_BATCH_SEND_INTERVAL_SECONDS), max: vue.unref(MAX_BATCH_SEND_INTERVAL_SECONDS), step: 1, precision: 0, "controls-position": "right", size: "small", "aria-label": "间隔调节" }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), vue.createVNode(SettingSection, { title: "弹幕内容" }, { default: vue.withCtx(() => [ vue.createVNode(SettingRow, { label: "管理弹幕" }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElButton), { class: "manage-danmaku-button settings-control", type: "primary", plain: "", round: "", size: "small", "data-testid": "manage-danmaku", "aria-label": "管理弹幕", onClick: _cache[2] || (_cache[2] = ($event) => emit("manageDanmaku")) }, { default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [ vue.createTextVNode(" 管理 ", -1) ])]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ]); }; } }); const BatchSendSettingsPage = _export_sfc(_sfc_main$5, [["__scopeId", "data-v-e498fb4d"]]); const _hoisted_1$3 = { class: "quick-ability-settings-page" }; const _sfc_main$4 = vue.defineComponent({ __name: "QuickAbilitySettingsPage", setup(__props) { const { isFreezeDanmakuOnClick, isInjectPlusOneComponent } = pinia$1.storeToRefs(useConfigStore()); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [ vue.createVNode(SettingSection, { title: "快捷能力", first: "" }, { default: vue.withCtx(() => [ vue.createVNode(SettingRow, { label: "弹幕 +1" }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElSwitch), { modelValue: vue.unref(isFreezeDanmakuOnClick), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(isFreezeDanmakuOnClick) ? isFreezeDanmakuOnClick.value = $event : null), class: "settings-control", "data-testid": "inline-plus-one-toggle", "aria-label": "弹幕 +1" }, null, 8, ["modelValue"]) ]), _: 1 }), vue.createVNode(SettingRow, { label: "侧边栏 +1" }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElSwitch), { modelValue: vue.unref(isInjectPlusOneComponent), "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(isInjectPlusOneComponent) ? isInjectPlusOneComponent.value = $event : null), class: "settings-control", "data-testid": "sidebar-plus-one-toggle", "aria-label": "侧边栏 +1" }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }) ]); }; } }); const QuickAbilitySettingsPage = _export_sfc(_sfc_main$4, [["__scopeId", "data-v-caf0acd7"]]); const _hoisted_1$2 = ["aria-label"]; const _sfc_main$3 = vue.defineComponent({ __name: "SettingsPopover", emits: ["managerVisibleChange"], setup(__props, { emit: __emit }) { const emit = __emit; const settingsSwiperModules = [A11y, Mousewheel, Pagination]; const isDanmakuManagerOpen = vue.ref(false); function openDanmakuManager() { isDanmakuManagerOpen.value = true; emit("managerVisibleChange", true); } function closeDanmakuManager() { isDanmakuManagerOpen.value = false; emit("managerVisibleChange", false); } return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", { class: "settings-popover", "data-testid": "settings-popover", "aria-label": isDanmakuManagerOpen.value ? "弹幕管理" : "弹幕工具设置" }, [ _cache[0] || (_cache[0] = vue.createElementVNode("div", { class: "popover-title" }, "设置", -1)), vue.createVNode(vue.unref(Swiper2), { class: "settings-carousel", modules: settingsSwiperModules, "slides-per-view": 1, speed: 260, threshold: 10, "no-swiping-selector": ".settings-control", mousewheel: { forceToAxis: true, releaseOnEdges: true, thresholdDelta: 6 }, pagination: { clickable: true, bulletElement: "button" }, a11y: { enabled: true, containerMessage: "弹幕工具设置分页", paginationBulletMessage: "切换到第 {{index}} 页" } }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(SwiperSlide), null, { default: vue.withCtx(() => [ vue.createVNode(BatchSendSettingsPage, { onManageDanmaku: openDanmakuManager }) ]), _: 1 }), vue.createVNode(vue.unref(SwiperSlide), null, { default: vue.withCtx(() => [ vue.createVNode(QuickAbilitySettingsPage) ]), _: 1 }) ]), _: 1 }), isDanmakuManagerOpen.value ? (vue.openBlock(), vue.createBlock(DanmakuManagerDialog, { key: 0, onClose: closeDanmakuManager })) : vue.createCommentVNode("", true) ], 8, _hoisted_1$2); }; } }); const SettingsPopover = _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7d1c3981"]]); const _sfc_main$2 = vue.defineComponent({ __name: "Actions", props: { isRunning: { type: Boolean }, isStarting: { type: Boolean }, isPaused: { type: Boolean }, canSend: { type: Boolean }, showRunControls: { type: Boolean }, isSettingsOpen: { type: Boolean } }, emits: ["update:isSettingsOpen", "start", "pause", "resume", "stop"], setup(__props, { emit: __emit }) { const props = __props; const emit = __emit; const actionsRoot = vue.ref(null); const isDanmakuManagerVisible = vue.ref(false); function setSettingsOpen(visible) { emit("update:isSettingsOpen", visible); } function toggleSettings() { setSettingsOpen(!props.isSettingsOpen); } function closeSettingsOnOutsidePointer(event) { if (!props.isSettingsOpen || isDanmakuManagerVisible.value) return; if (!(event.target instanceof Node)) return; if (actionsRoot.value?.contains(event.target)) return; setSettingsOpen(false); } function closeSettingsOnEscape(event) { if (event.key !== "Escape") return; if (!props.isSettingsOpen) return; setSettingsOpen(false); } vue.onMounted(() => { document.addEventListener("pointerdown", closeSettingsOnOutsidePointer, true); document.addEventListener("keydown", closeSettingsOnEscape); }); vue.onBeforeUnmount(() => { document.removeEventListener("pointerdown", closeSettingsOnOutsidePointer, true); document.removeEventListener("keydown", closeSettingsOnEscape); }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", { ref_key: "actionsRoot", ref: actionsRoot, class: "capsule-actions" }, [ !__props.isRunning || !__props.showRunControls ? (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElButton), { key: 0, class: "capsule-action-button primary-action", type: "primary", round: "", "data-testid": "batch-send-start", disabled: !__props.canSend, loading: __props.isStarting || __props.isRunning && !__props.showRunControls, onClick: _cache[0] || (_cache[0] = ($event) => emit("start")) }, { default: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(__props.showRunControls ? "连发" : "发送"), 1) ]), _: 1 }, 8, ["disabled", "loading"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ !__props.isPaused ? (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElButton), { key: 0, class: "capsule-action-button outline-action", round: "", "data-testid": "batch-send-pause", onClick: _cache[1] || (_cache[1] = ($event) => emit("pause")) }, { default: vue.withCtx(() => [..._cache[5] || (_cache[5] = [ vue.createTextVNode(" 暂停 ", -1) ])]), _: 1 })) : (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElButton), { key: 1, class: "capsule-action-button outline-action", round: "", "data-testid": "batch-send-resume", onClick: _cache[2] || (_cache[2] = ($event) => emit("resume")) }, { default: vue.withCtx(() => [..._cache[6] || (_cache[6] = [ vue.createTextVNode(" 继续 ", -1) ])]), _: 1 })), vue.createVNode(vue.unref(ElementPlus.ElButton), { class: "capsule-action-button outline-action", round: "", "data-testid": "batch-send-stop", onClick: _cache[3] || (_cache[3] = ($event) => emit("stop")) }, { default: vue.withCtx(() => [..._cache[7] || (_cache[7] = [ vue.createTextVNode(" 停止 ", -1) ])]), _: 1 }) ], 64)), vue.createVNode(vue.unref(ElementPlus.ElPopover), { visible: __props.isSettingsOpen, teleported: false, width: 286, "show-arrow": true, placement: "top-end", "popper-class": "capsule-settings-popper" }, { reference: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElButton), { class: vue.normalizeClass(["settings-action", { "is-active": __props.isSettingsOpen }]), circle: "", "data-testid": "settings-toggle", "aria-label": __props.isSettingsOpen ? "关闭设置" : "打开设置", "aria-expanded": __props.isSettingsOpen, onClick: toggleSettings }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlus.ElIcon), null, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(ElementPlusIconsVue.Setting)) ]), _: 1 }) ]), _: 1 }, 8, ["class", "aria-label", "aria-expanded"]) ]), default: vue.withCtx(() => [ vue.createVNode(SettingsPopover, { onManagerVisibleChange: _cache[4] || (_cache[4] = ($event) => isDanmakuManagerVisible.value = $event) }) ]), _: 1 }, 8, ["visible"]) ], 512); }; } }); const Actions = _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f7bc9024"]]); const _hoisted_1$1 = { class: "batch-send-capsule-root" }; const _hoisted_2 = { key: 0, class: "batch-send-capsule collapsed-capsule", "data-testid": "collapsed-capsule", "aria-label": "刷屏长胶囊已收起" }; const _hoisted_3 = ["src"]; const _hoisted_4 = { key: 1, class: "batch-send-capsule", "data-testid": "batch-send-capsule", "aria-label": "刷屏长胶囊" }; const _hoisted_5 = ["src"]; const _sfc_main$1 = vue.defineComponent({ __name: "Panel", setup(__props) { const { currentDanmaku, selectOptions, batchSendStatus, batchSendTotalCount, canSend, startBatchSend, pauseBatchSend, resumeBatchSend, stopBatchSend } = useDanmakuBatchSend(); const isCollapsed = vue.ref(true); const isSettingsOpen = vue.ref(false); const showRunControls = vue.computed(() => Number(batchSendTotalCount.value) > 1); function collapseCapsule() { isCollapsed.value = true; isSettingsOpen.value = false; } function expandCapsule() { isCollapsed.value = false; } return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [ isCollapsed.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [ vue.createElementVNode("button", { class: "collapse-handle", type: "button", "data-testid": "collapsed-bubble", "aria-label": "展开刷屏长胶囊", onClick: expandCapsule }, [ vue.createElementVNode("img", { class: "capsule-toggle-icon", src: vue.unref(capsuleIconUrl), alt: "", "aria-hidden": "true" }, null, 8, _hoisted_3) ]) ])) : vue.createCommentVNode("", true), !isCollapsed.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [ vue.createElementVNode("button", { class: "collapse-handle", type: "button", "data-testid": "collapse-handle", "aria-label": "收起刷屏长胶囊", onClick: collapseCapsule }, [ vue.createElementVNode("img", { class: "capsule-toggle-icon is-collapse", src: vue.unref(capsuleIconUrl), alt: "", "aria-hidden": "true" }, null, 8, _hoisted_5) ]), vue.createVNode(vue.unref(ElementPlus.ElSelect), { modelValue: vue.unref(currentDanmaku), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(currentDanmaku) ? currentDanmaku.value = $event : null), class: "danmaku-select", "data-testid": "danmaku-select", placeholder: "选择一条弹幕", disabled: vue.unref(batchSendStatus).isStarting || vue.unref(batchSendStatus).isRunning, teleported: false, "popper-class": "danmaku-select-popper", "fit-input-width": "" }, { default: vue.withCtx(() => [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(selectOptions), (option) => { return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElOption), { key: option.id ?? option.value, label: option.label, value: option.value }, null, 8, ["label", "value"]); }), 128)) ]), _: 1 }, 8, ["modelValue", "disabled"]), vue.createVNode(Actions, { "is-settings-open": isSettingsOpen.value, "onUpdate:isSettingsOpen": _cache[1] || (_cache[1] = ($event) => isSettingsOpen.value = $event), "is-running": vue.unref(batchSendStatus).isRunning, "is-starting": vue.unref(batchSendStatus).isStarting, "is-paused": vue.unref(batchSendStatus).isPaused, "can-send": vue.unref(canSend), "show-run-controls": showRunControls.value, onStart: vue.unref(startBatchSend), onPause: vue.unref(pauseBatchSend), onResume: vue.unref(resumeBatchSend), onStop: vue.unref(stopBatchSend) }, null, 8, ["is-settings-open", "is-running", "is-starting", "is-paused", "can-send", "show-run-controls", "onStart", "onPause", "onResume", "onStop"]) ])) : vue.createCommentVNode("", true) ]); }; } }); const BatchSendPanel = _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e815c65d"]]); const _hoisted_1 = { id: "bili-livedt" }; const _sfc_main = vue.defineComponent({ __name: "app", setup(__props) { function noticeResult() { const { batchSendErrorMessages, batchSendStatus } = pinia$1.storeToRefs(useDanmakuBatchSendStore()); vue.watch( () => batchSendStatus.value.isRunning, (isRunning, wasRunning) => { if (isRunning || !wasRunning) return; if (batchSendErrorMessages.value.length === 0) { ElementPlus.ElMessage({ message: "弹幕发送完毕", type: "success" }); return; } ElementPlus.ElMessage({ message: `弹幕发送完毕,但有 ${batchSendErrorMessages.value.length} 条发送失败`, type: "warning" }); } ); } vue.onMounted(noticeResult); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ vue.createVNode(BatchSendPanel) ]); }; } }); let makoo; try { makoo = $({ defaults: { "alive": false, "scope": "local", "timeout": 5e3 }, adapters: [o()] }); const makooTasks = []; makooTasks.push(we({ "id": "danmaku-actions", "injectAt": "body", "artifact": Injection_danmaku_actions, "options": { "alive": false, "scope": "local", "timeout": 5e3 } })); makooTasks.push(we({ "id": "danmaku-plus-one", "injectAt": "div.danmaku-menu>.none-select", "artifact": Injection_danmaku_plus_one, "options": { "alive": true, "scope": "global", "timeout": 5e3 } })); makooTasks.push(we({ "id": "main-panel", "injectAt": "body", "artifact": _sfc_main, "options": { "alive": false, "scope": "local", "timeout": 5e3 } })); makooTasks.push(Te({ "id": "danmaku-freeze-click", "listenAt": "body", "type": "click", "callback": Manifest_0["listeners"]["danmaku-freeze-click"]["callback"], "capture": true, "activitySignal": Manifest_0["listeners"]["danmaku-freeze-click"]["activitySignal"] })); makooTasks.push(Te({ "id": "danmaku-menu-click", "listenAt": "body", "type": "click", "callback": Manifest_0["listeners"]["danmaku-menu-click"]["callback"], "capture": true, "activitySignal": Manifest_0["listeners"]["danmaku-menu-click"]["activitySignal"] })); makoo.start(makooTasks); } catch (e3) { console.error("[makoo] Injection startup failed:", e3); throw e3; } })(ElementPlusIconsVue, ElementPlus, Vue, Pinia, mitt, CryptoJS);