@banou/stub 0.0.87 → 0.0.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (() => { const s = document.createElement('style'); s.textContent = ".media-sr-only{white-space:nowrap;clip:rect(0, 0, 0, 0);border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.media-default-skin *,.media-default-skin :before,.media-default-skin :after{box-sizing:border-box}.media-default-skin img,.media-default-skin video,.media-default-skin svg{max-width:100%;display:block}.media-default-skin button{font:inherit}.media-default-skin [hidden][hidden]{display:none}@media (prefers-reduced-motion:no-preference){.media-default-skin{interpolate-size:allow-keywords}}.media-default-skin{--media-current-shadow-color:oklch(from currentColor 0 0 0 / clamp(0, calc((l - .5) * .5), .15));--media-current-shadow-color-subtle:oklch(from var(--media-current-shadow-color) l c h / calc(alpha * .4));--scrollbar-thumb-color:oklch(from currentColor l c h / .3);--scale:1;--base-size:1rem;--size:calc(var(--base-size) * var(--scale));--spacing:calc(var(--size) / 4);--font-size-medium:calc(.9375 * var(--size));--font-size-base:calc(.8125 * var(--size));--font-size-small:calc(.6875 * var(--size));--font-size-tiny:calc(.5625 * var(--size));--media-icon-size:calc(1.125 * var(--size));width:100%;height:100%;font-family:Inter Variable,Inter,ui-sans-serif,system-ui,sans-serif;font-size:var(--font-size-base);-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto;letter-spacing:normal;outline-offset:-4px;scrollbar-color:var(--scrollbar-thumb-color) transparent;scrollbar-width:thin;border-radius:var(--media-border-radius,1.75rem);isolation:isolate;outline:2px solid #0000;line-height:1.5;transition-property:outline-offset,outline-color;transition-duration:.1s;transition-timing-function:ease-out;display:block;position:relative;container:media-root/inline-size;&:focus-visible{outline-offset:2px;outline-color:currentColor}&::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb-color);border-radius:9999px}@media (prefers-reduced-transparency:reduce) or (prefers-contrast:more){--scrollbar-thumb-color:oklch(from currentColor l c h / .8);scrollbar-width:auto}}.media-default-skin .media-surface{background-color:var(--media-surface-background-color);box-shadow:0 0 0 1px var(--media-surface-outer-border-color), 0 1px 3px 0 var(--media-surface-shadow-color), 0 1px 2px -1px var(--media-surface-shadow-color);backdrop-filter:var(--media-surface-backdrop-filter);&:after{z-index:10;pointer-events:none;content:\"\";border-radius:inherit;box-shadow:inset 0 1px 0 0 var(--media-surface-inner-border-color), inset 0 0 0 1px oklch(from var(--media-surface-inner-border-color) l c h / calc(alpha * .5));position:absolute;inset:0}}.media-default-skin ::slotted(video),.media-default-skin video{object-fit:var(--media-object-fit,contain);object-position:var(--media-object-position,center);width:100%;height:100%;display:block}.media-default-skin ::slotted(video){border-radius:var(--media-video-border-radius)}.media-default-skin video{border-radius:inherit}.media-default-skin:fullscreen ::slotted(video),.media-default-skin:fullscreen video{object-fit:contain}.media-default-skin .media-overlay{pointer-events:none;border-radius:inherit;opacity:0;backdrop-filter:blur()saturate();transition-timing-function:ease-out;transition-duration:var(--media-controls-transition-duration);background-image:linear-gradient(oklch(0% 0 0/0),oklch(0% 0 0/.3) 75%,oklch(0% 0 0/.5));transition-property:opacity,backdrop-filter;position:absolute;inset:0}.media-default-skin .media-error~.media-overlay{transition-delay:var(--media-error-dialog-transition-delay);transition-duration:var(--media-error-dialog-transition-duration)}.media-default-skin .media-controls[data-visible]~.media-overlay,.media-default-skin .media-error[data-open]~.media-overlay{opacity:1}.media-default-skin .media-buffering-indicator[data-visible]~.media-overlay{opacity:1;backdrop-filter:blur(8px);background:oklch(0% 0 0/.35)}.media-default-skin .media-error[data-open]~.media-overlay{backdrop-filter:blur(16px)saturate(1.5)}.media-default-skin .media-buffering-indicator{z-index:10;color:oklch(100% 0 0);pointer-events:none;place-content:center;display:none;position:absolute;inset:0;&:not([data-visible]){--media-spinner-animation:none}&[data-visible]{display:grid}}.media-default-skin .media-error{outline:none}.media-default-skin .media-error:not([data-open]){display:none}.media-default-skin .media-error__title{font-weight:600;line-height:1.25}.media-default-skin .media-error__description{overflow-wrap:anywhere;opacity:.7}.media-default-skin .media-error__actions{gap:calc(var(--spacing) * 2);display:flex;&>*{flex:1}}.media-default-skin .media-error[data-open]~.media-controls *{visibility:hidden}.media-default-skin .media-controls{--media-popover-side-offset:calc(var(--spacing) * (var(--base-side-offset,2) + 1));--media-tooltip-side-offset:var(--media-popover-side-offset);--media-popover-boundary-offset:calc(var(--spacing) * var(--base-boundary-offset,2));--media-tooltip-boundary-offset:var(--media-popover-boundary-offset);padding:calc(var(--spacing) * 1);text-shadow:0 1px 0 var(--media-current-shadow-color);border-radius:3.40282e38px;align-items:center;display:flex;container:media-controls/inline-size}.media-default-skin .media-time-controls{gap:calc(var(--spacing) * 2.5);flex:1;align-items:center;display:flex;container:media-time-controls/inline-size;& .media-time:last-child{@container media-time-controls (width<10rem){display:none}}}.media-default-skin .media-time{font-variant-numeric:tabular-nums}.media-default-skin .media-time[role=button]{cursor:pointer;outline-offset:-2px;border-radius:calc(var(--spacing) * 1);outline:2px solid #0000;transition-property:outline-color,outline-offset;transition-duration:.1s;transition-timing-function:ease-out;&:focus-visible{outline-offset:2px;outline-color:currentColor}}.media-default-skin .media-button{height:calc(var(--spacing) * 9);min-height:0;padding:calc(var(--spacing) * 2) calc(var(--spacing) * 4);text-align:center;touch-action:manipulation;cursor:pointer;user-select:none;outline-offset:-2px;will-change:scale;border:none;border-radius:3.40282e38px;outline:2px solid #0000;flex-shrink:0;justify-content:center;align-items:center;transition-property:background-color,outline-offset,scale;transition-duration:.15s;transition-timing-function:ease-out;display:flex;&:focus-visible{outline-offset:2px;outline-color:currentColor}&:active:not([aria-disabled=true]){scale:.98}&[aria-disabled=true]{cursor:not-allowed;opacity:.5;filter:grayscale()}}.media-default-skin .media-button--primary{color:oklch(0% 0 0);text-shadow:none;background:oklch(100% 0 0);font-weight:500}.media-default-skin .media-button--subtle{color:inherit;text-shadow:inherit;background:0 0;&:hover,&:focus-visible,&[aria-expanded=true]{background-color:oklch(from currentColor l c h / .1);text-decoration:none}}.media-default-skin .media-button--icon{aspect-ratio:1;padding:0;display:grid;&:active:not([aria-disabled=true]){scale:.9}& .media-icon__container{display:grid}& .media-icon{transition-behavior:allow-discrete;filter:drop-shadow(0 1px 0 var(--media-current-shadow-color));grid-area:1/1;transition-property:display,opacity;transition-duration:.15s;transition-timing-function:ease-out}}.media-default-skin .media-button--seek{& .media-icon__label{font-variant-numeric:tabular-nums;letter-spacing:-.05em;font-size:.715em;font-weight:500;position:absolute;bottom:-3px;right:-1px}&:has(.media-icon--flipped) .media-icon__label{right:unset;left:-1px}}.media-default-skin .media-button--playback-rate{font-variant-numeric:tabular-nums;padding:0;&:after{content:attr(data-rate) \"×\";width:4ch}&[data-inline-rate-label]:after{content:none}}.media-default-skin .media-button--settings{& .media-icon--settings{transition:transform .15s ease-in-out;@media (prefers-reduced-motion:reduce){transition-duration:0s}}&[aria-expanded=true] .media-icon--settings{transform:rotate(90deg)}}.media-default-skin .media-button--live{gap:calc(var(--spacing) * 1.5);aspect-ratio:auto;width:auto;padding:calc(var(--spacing) * 2) calc(var(--spacing) * 3);font-size:var(--font-size-small);text-transform:uppercase;letter-spacing:.05em;align-items:center;font-weight:600;line-height:1;display:inline-flex;&:before{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2);content:\"\";background-color:oklch(from currentColor l c h / .4);border-radius:50%;flex-shrink:0;transition:background-color .15s ease-out;display:inline-block}&[data-live-edge]:before{background-color:oklch(65% .22 27)}}.media-default-skin .media-button-group{align-items:center;gap:1px;display:flex}.media-default-skin .media-badge{padding:calc(var(--spacing) * .5) calc(var(--spacing) * 1.5);font-size:var(--font-size-small);color:oklch(from currentColor l c h / .85);white-space:nowrap;background-color:oklch(from currentColor l c h / .1);border-radius:3.40282e38px;font-weight:500;line-height:1}.media-default-skin .media-icon__container{position:relative}.media-default-skin .media-icon{width:var(--media-icon-size);height:var(--media-icon-size);flex-shrink:0}.media-default-skin .media-icon--flipped{scale:-1 1}.media-default-skin media-poster,.media-default-skin>img{pointer-events:none;width:100%;height:100%;transition:opacity .25s;position:absolute;inset:0}.media-default-skin media-poster:not([data-visible]),.media-default-skin>img:not([data-visible]),.media-default-skin>img[data-visible]:not([data-loaded]){opacity:0}.media-default-skin media-poster ::slotted(img),.media-default-skin media-poster img{object-fit:var(--media-object-fit,contain);object-position:var(--media-object-position,center);border-radius:var(--media-video-border-radius);width:100%;height:100%;position:absolute;inset:0}.media-default-skin>img{object-fit:var(--media-object-fit,contain);object-position:var(--media-object-position,center);border-radius:inherit}.media-default-skin media-poster:before,.media-default-skin:before{pointer-events:none;content:\"\";background-image:var(--media-poster-placeholder,none);background-repeat:no-repeat;background-position:var(--media-object-position,center);background-size:var(--media-object-fit,contain);filter:blur(var(--media-poster-placeholder-blur,20px));position:absolute;inset:0}.media-default-skin:before{opacity:0;transition:opacity .25s}.media-default-skin:has(img[data-visible]:not([data-loaded])):before{opacity:1}.media-default-skin:fullscreen media-poster ::slotted(img),.media-default-skin:fullscreen media-poster img,.media-default-skin:fullscreen>img{object-fit:contain}.media-default-skin .media-thumbnail{pointer-events:none;border-radius:calc(var(--spacing) * 3);background-color:oklch(0% 0 0/.9);& .media-thumbnail__image{border-radius:inherit;display:block;position:relative;overflow:clip;&:after{content:\"\";border-radius:inherit;background-image:linear-gradient(oklch(0% 0 0/0),oklch(0% 0 0/.1),oklch(0% 0 0/.5));position:absolute;inset:0}}& .media-thumbnail__time{inset-inline:0;bottom:calc(var(--spacing) * 2);text-align:center;position:absolute}& .media-thumbnail__spinner{opacity:0;position:absolute;top:50%;left:50%;translate:-50% -50%}& .media-thumbnail__image,& .media-thumbnail__spinner{transition:opacity .15s ease-out}&:not(:has(.media-thumbnail__image[data-loading])){& .media-thumbnail__spinner{--media-spinner-animation:none}}&:has(.media-thumbnail__image[data-loading]){& .media-thumbnail__image{opacity:0}& .media-thumbnail__spinner{opacity:1}}}.media-default-skin .media-slider{cursor:pointer;border-radius:3.40282e38px;outline:none;flex:1;justify-content:center;align-items:center;display:flex;position:relative;&[data-orientation=horizontal]{width:var(--slider-width,100%);min-width:calc(var(--spacing) * 20);height:var(--slider-height,calc(var(--spacing) * 8))}&[data-orientation=vertical]{width:var(--slider-width,calc(var(--spacing) * 8));height:var(--slider-height,calc(var(--spacing) * 20))}& .media-slider__track{user-select:none;border-radius:inherit;isolation:isolate;position:relative;overflow:hidden;&[data-orientation=horizontal]{width:100%;height:calc(var(--spacing) * 1)}&[data-orientation=vertical]{width:calc(var(--spacing) * 1);height:100%}}& .media-slider__thumb{z-index:10;width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5);user-select:none;outline-offset:-4px;box-shadow:0 0 0 1px var(--media-current-shadow-color,oklch(0% 0 0/.1)), 0 1px 3px 0 oklch(0% 0 0/.35), 0 1px 2px -1px oklch(0% 0 0/.35);opacity:0;background-color:currentColor;border-radius:3.40282e38px;outline:4px solid #0000;transition-property:opacity,height,width,outline-offset;transition-duration:.15s;transition-timing-function:ease-out;position:absolute;translate:-50% -50%;&[data-orientation=horizontal]{top:50%;left:var(--media-slider-fill)}&[data-orientation=vertical]{top:calc(100% - var(--media-slider-fill));left:50%}&:hover,&:focus{outline-color:oklch(from currentColor l c h / .15);outline-offset:0}&:after{content:\"\";border-radius:inherit;transition-property:opacity,scale;transition-duration:.15s;transition-timing-function:ease-out;position:absolute;inset:-4px;box-shadow:0 0 0 2px}&:not(:focus-visible):after{opacity:0;scale:.5}}&:active .media-slider__thumb,&:focus-within .media-slider__thumb,& .media-slider__thumb--persistent{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}&:hover .media-slider__thumb,& .media-slider__thumb:focus-visible,& .media-slider__thumb--persistent{opacity:1}& .media-slider__preview{& .media-slider__value,&:before{opacity:0;transition-property:opacity,scale;transition-duration:.2s;transition-timing-function:ease-out;scale:.5}& .media-slider__value{bottom:calc(var(--spacing) * 9);text-shadow:0 1px 0 var(--media-current-shadow-color);filter:blur(8px);translate:-50% calc(var(--spacing) * 2);transition-property:filter,opacity,scale,translate;position:absolute}&:before{min-width:calc(var(--spacing) * 1);height:calc(var(--spacing) * 1);content:\"\";box-shadow:0 0 0 1px var(--media-current-shadow-color,oklch(0% 0 0/.15)), 0 1px 2px 0 oklch(0% 0 0/.35);background-color:currentColor;border-radius:100%;display:block}&[data-pointing] .media-slider__value,&[data-pointing]:not([data-dragging]):before{opacity:1;scale:1}&[data-pointing] .media-slider__value{filter:blur();translate:-50%}}& .media-slider__buffer,& .media-slider__fill{pointer-events:none;border-radius:inherit;position:absolute;&[data-orientation=horizontal],&[data-orientation=horizontal]{inset-block:0;left:0}&[data-orientation=vertical],&[data-orientation=vertical]{inset-inline:0;bottom:0}}& .media-slider__buffer{background-color:oklch(from currentColor l c h / .2);transition-duration:.25s;transition-timing-function:ease-out;&[data-orientation=horizontal]{width:var(--media-slider-buffer);transition-property:width}&[data-orientation=vertical]{height:var(--media-slider-buffer);transition-property:height}}& .media-slider__fill{background-color:currentColor;&[data-orientation=horizontal]{width:var(--media-slider-fill)}&[data-orientation=vertical]{height:var(--media-slider-fill)}}&[data-dragging]{& .media-slider__thumb[data-orientation=horizontal]{left:var(--media-slider-pointer)}& .media-slider__thumb[data-orientation=vertical]{top:calc(100% - var(--media-slider-pointer))}& .media-slider__fill[data-orientation=horizontal]{width:var(--media-slider-pointer)}& .media-slider__fill[data-orientation=vertical]{height:var(--media-slider-pointer)}}}.media-default-skin{--media-popup-transition:opacity var(--media-popup-transition-timing-function) var(--media-popup-transition-duration), filter var(--media-popup-transition-timing-function) var(--media-popup-transition-duration), transform var(--media-popup-transition-timing-function) var(--media-popup-transition-duration), scale var(--media-popup-transition-timing-function) var(--media-popup-transition-duration)}.media-default-skin .media-popover,.media-default-skin .media-tooltip{--popup-translate-distance:calc(.5 * var(--base-size));color:inherit;transition:var(--media-popup-transition);border:0;margin:0;overflow:visible;&[data-starting-style],&[data-ending-style]{opacity:0;filter:blur(4px);transform:translate(var(--popup-translate-x-distance,0), var(--popup-translate-y-distance,0));scale:.95}&[data-ending-style]{transition-duration:max(0s, calc(var(--media-popup-transition-duration) - 50ms));transform:none}&[data-side=top]{--popup-translate-y-distance:var(--popup-translate-distance);transform-origin:bottom}&[data-side=bottom]{--popup-translate-y-distance:calc(var(--popup-translate-distance) * -1);transform-origin:top}&[data-side=left]{--popup-translate-x-distance:var(--popup-translate-distance);transform-origin:100%}&[data-side=right]{--popup-translate-x-distance:calc(var(--popup-translate-distance) * -1);transform-origin:0}&:before{pointer-events:inherit;content:\"\";position:absolute}&[data-side=top]:before,&[data-side=bottom]:before{width:100%;inset-inline:0}&[data-side=top]:before{top:100%}&[data-side=bottom]:before{bottom:100%}&[data-side=left]:before,&[data-side=right]:before{height:100%;inset-block:0}&[data-side=left]:before{left:100%}&[data-side=right]:before{right:100%}}.media-default-skin .media-popover{&[data-side=top]:before,&[data-side=bottom]:before{height:var(--media-popover-side-offset)}&[data-side=left]:before,&[data-side=right]:before{width:var(--media-popover-side-offset)}}.media-default-skin .media-popover--volume{padding:calc(var(--spacing) * 3) 0;border-radius:3.40282e38px;&:has(media-volume-slider[data-availability=unsupported]){display:none}}.media-default-skin .media-tooltip{padding:calc(var(--spacing) * 1) calc(var(--spacing) * 2.5);font-size:var(--font-size-base);white-space:nowrap;border-radius:3.40282e38px;&[data-open]{column-gap:calc(var(--spacing) * 1);align-items:center;display:flex}&[data-side=top]:before,&[data-side=bottom]:before{height:var(--media-tooltip-side-offset)}&[data-side=left]:before,&[data-side=right]:before{width:var(--media-tooltip-side-offset)}& .media-tooltip__kbd{min-width:1.5em;font-family:inherit;font-size:var(--font-size-small);text-align:center;background-color:oklch(from currentColor l c h / .3);border-radius:calc(var(--spacing) * 1);padding:.1em;font-weight:600;line-height:1.25}}.media-default-skin .media-menu{--menu-transition-duration:.25s;--menu-max-height:calc(var(--spacing) * 56);--menu-padding:calc(var(--spacing) * 1);--menu-border-radius:calc(var(--spacing) * 3);--menu-item-border-radius:calc(var(--menu-border-radius) - var(--menu-padding));box-sizing:border-box;min-width:max-content;max-width:var(--media-popover-available-width,none);max-height:min(var(--media-popover-available-height,var(--menu-max-height)), var(--menu-max-height));padding:var(--menu-padding);overscroll-behavior:none;border-radius:var(--menu-border-radius);overflow:auto;@media (prefers-reduced-motion:reduce){--menu-transition-duration:0s}& .media-menu__panel{padding:var(--menu-padding);overscroll-behavior:none;transition-timing-function:ease-in-out;transition-duration:var(--menu-transition-duration);will-change:translate, filter;outline:none;transition-property:translate,filter;position:absolute;inset:0;overflow:auto;translate:0;&[data-starting-style],&[data-ending-style]{overflow:hidden}&[data-menu-root-view][data-menu-view-state=inactive]{filter:blur(8px);translate:-100%;& .media-menu__group:before{display:none}}&[data-submenu]{z-index:10;&:not([data-open],[data-ending-style]){transition-property:none;translate:-100%}&[data-starting-style],&[data-ending-style]{pointer-events:none;filter:blur(8px)}&[data-starting-style][data-direction=forward],&[data-ending-style][data-direction=back]{translate:100%}&[data-ending-style][data-direction=forward],&[data-starting-style][data-direction=back]{translate:-100%}}}& .media-menu__separator{margin-block:calc(var(--spacing) * 1);border-bottom:1px solid oklch(0% 0 0/.1);box-shadow:0 1px oklch(100% 0 0/.075)}& .media-menu__group{anchor-scope:--media-menu-item-highlight-anchor;gap:calc(var(--spacing) * .5);flex-direction:column;display:flex;@supports (top:anchor(top)){&:before{position-anchor:--media-menu-item-highlight-anchor;inset:anchor(inside);pointer-events:none;content:\"\";background-color:oklch(from currentColor l c h / .1);border-radius:var(--menu-item-border-radius);transition:inset .1s ease-in-out;position:absolute}}}& .media-menu__item,& .media-menu__back{gap:calc(var(--spacing) * 1.5);padding:calc(var(--spacing) * 1.5) calc(var(--spacing) * 2);text-align:left;text-shadow:0 1px 0 var(--media-current-shadow-color);cursor:pointer;user-select:none;outline-offset:-2px;border-radius:var(--menu-item-border-radius);outline:2px solid #0000;align-items:center;transition:background-color .1s ease-out,color .1s ease-out;display:flex;&:focus-visible{outline-offset:2px;outline-color:currentColor}&:hover,&[data-highlighted]{background-color:oklch(from currentColor l c h / .1)}& .media-icon{color:oklch(from currentColor l c h / .65);filter:drop-shadow(0 1px 0 var(--media-current-shadow-color));flex-shrink:0}}& .media-menu__indicator{margin-right:calc(var(--spacing) * -1);opacity:0;flex-shrink:0;margin-left:auto;& .media-icon{filter:drop-shadow(0 1px 0 var(--media-current-shadow-color))}}& .media-menu__item{font-variant-numeric:tabular-nums;color:inherit;justify-content:space-between;&[aria-disabled=true]{pointer-events:none;cursor:not-allowed;opacity:.5}&[aria-checked=true] .media-menu__indicator{opacity:1}&[data-availability=unavailable],&[data-availability=unsupported]{display:none}&:hover,&[data-highlighted]{@supports (top:anchor(top)){anchor-name:--media-menu-item-highlight-anchor;background-color:#0000}}}& .media-menu__tier{padding-top:1px;padding-left:calc(var(--spacing) * .5);font-size:var(--font-size-tiny);color:oklch(from currentColor l c h / .7);font-weight:600;line-height:1}& .media-menu__back{width:100%;margin-bottom:calc(var(--spacing) * .5)}& .media-menu__hint{gap:calc(var(--spacing) * 1);min-width:0;padding-left:calc(var(--spacing) * 2);color:oklch(from currentColor l c h / .65);align-items:center;margin-left:auto;display:inline-flex}& .media-menu__hint-label{max-width:calc(var(--spacing) * 24);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}& .media-menu__chevron{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}&.media-menu--settings{width:var(--media-menu-width);min-width:calc(var(--spacing) * 48);height:var(--media-menu-height);transition:var(--media-popup-transition), height var(--media-popup-transition-timing-function) var(--menu-transition-duration), width var(--media-popup-transition-timing-function) var(--menu-transition-duration);overflow:hidden;&[data-starting-style],&[data-ending-style]{transition:var(--media-popup-transition)}}}.media-default-skin{--media-caption-track-duration:var(--media-controls-transition-duration);--media-caption-track-delay:25ms;--media-caption-track-y:calc(var(--spacing) * -2);&:has(.media-controls[data-visible]){--media-caption-track-y:calc(var(--spacing) * -22)}@container media-root (width>42rem){&:has(.media-controls[data-visible])>*{--media-caption-track-y:calc(var(--spacing) * -14)}}}.media-default-skin video::-webkit-media-text-track-container{z-index:1;scale:.98;translate:0 var(--media-caption-track-y);transition:translate var(--media-caption-track-duration) ease-out;transition-delay:var(--media-caption-track-delay);font-family:inherit}.media-default-skin .media-input-feedback{color:var(--media-color-primary,oklch(100% 0 0));pointer-events:none;grid-template-columns:1fr 1fr 1fr;place-items:center;display:grid;position:absolute;inset:0}.media-default-skin .media-input-feedback-island{--media-surface-background-color:oklch(0% 0 0/.25);top:calc(var(--spacing) * 3);color:inherit;pointer-events:none;transform-origin:top;border-radius:3.40282e38px;font-weight:500;transition-duration:.1s;transition-timing-function:ease-out;position:absolute;& .media-input-feedback-island__content{gap:calc(var(--spacing) * 2);width:100%;padding:calc(var(--spacing) * 1) calc(var(--spacing) * 2.5);justify-content:space-between;align-items:center;display:flex;& *{mix-blend-mode:difference}}& .media-icon{flex-shrink:0;display:none}& .media-input-feedback-island__value{margin-left:auto}@media (pointer:coarse){will-change:scale, translate, opacity;transition-property:scale,translate,opacity}@media (pointer:fine) and (prefers-reduced-motion:no-preference){will-change:scale, translate, filter, opacity;transition-property:scale,translate,filter,opacity}@media (prefers-reduced-transparency:reduce) or (prefers-contrast:more){--media-surface-background-color:oklch(0% 0 0)}&[data-starting-style],&[data-ending-style]{opacity:0;transition-duration:.25s;transition-timing-function:ease-in;@media (pointer:fine) and (prefers-reduced-motion:no-preference){filter:blur(8px);scale:.9}@media (prefers-reduced-motion:no-preference){&[data-ending-style]{translate:0 -25%}}}}.media-default-skin .media-input-feedback-island--volume{width:min(80%, calc(var(--spacing) * 48));& .media-input-feedback-island__content{--media-progress-fill:var(--media-volume-fill);background-image:linear-gradient(to right, currentColor 0%, currentColor var(--media-progress-fill), transparent var(--media-progress-fill), transparent 100%);border-radius:inherit;transition:--media-progress-fill .2s linear}&[data-level=high] .media-icon--volume-high,&[data-level=low] .media-icon--volume-low,&[data-level=off] .media-icon--volume-off{display:block}@media (prefers-reduced-motion:no-preference){&[data-min],&[data-max]{animation:.3s ease-in-out media-shake}}}.media-default-skin .media-input-feedback-island--status{&[data-status=captions-on] .media-icon--captions-on,&[data-status=captions-off] .media-icon--captions-off,&[data-status=fullscreen] .media-icon--fullscreen-enter,&[data-status=exit-fullscreen] .media-icon--fullscreen-exit,&[data-status=pip] .media-icon--pip-enter,&[data-status=exit-pip] .media-icon--pip-exit{display:block}}.media-default-skin .media-input-feedback-bubble{padding:calc(var(--spacing) * 4);text-align:center;grid-area:1/2;place-content:center;display:grid;&:not([data-direction]){backdrop-filter:blur(8px);background:oklch(0% 0 0/.35);border-radius:100%;transition-property:opacity,scale;transition-duration:.2s;transition-timing-function:ease-out;&[data-starting-style],&[data-ending-style]{opacity:0;scale:.85}&[data-ending-style]{transition-duration:.1s;transition-timing-function:ease-in}@media (prefers-reduced-motion:reduce){transition-property:opacity;transition-duration:50ms}}&[data-direction]{gap:calc(var(--spacing) * 1);@container media-root (width>24rem){padding:calc(var(--spacing) * 6)}}&[data-direction=backward]{grid-column:1;justify-self:left}&[data-direction=forward]{grid-column:3;justify-self:right}& .media-icon{width:calc(var(--media-icon-size) * 1.5);height:calc(var(--media-icon-size) * 1.5);display:none;&.media-icon--play{translate:1px}}&[data-direction] .media-icon--seek,&[data-status=pause] .media-icon--pause,&[data-status=play] .media-icon--play{display:block}&[data-direction=backward] .media-icon--seek{scale:-1 1}@media (prefers-reduced-motion:no-preference){&[data-direction] .media-icon--seek{transition-property:translate,opacity;transition-duration:.2s;transition-timing-function:ease-in-out}&[data-starting-style] .media-icon--seek,&[data-ending-style] .media-icon--seek{opacity:0}&[data-direction=forward][data-starting-style] .media-icon--seek{translate:-60%}&[data-direction=backward][data-starting-style] .media-icon--seek{translate:60%}}}.media-button--play .media-icon--restart,.media-button--play .media-icon--play,.media-button--play .media-icon--pause,.media-button--mute .media-icon--volume-off,.media-button--mute .media-icon--volume-low,.media-button--mute .media-icon--volume-high,.media-button--fullscreen .media-icon--fullscreen-enter,.media-button--fullscreen .media-icon--fullscreen-exit,.media-button--pip .media-icon--pip-enter,.media-button--pip .media-icon--pip-exit,.media-button--cast .media-icon--cast-enter,.media-button--cast .media-icon--cast-exit,.media-button--airplay .media-icon--airplay-enter,.media-button--airplay .media-icon--airplay-exit,.media-button--captions .media-icon--captions-off,.media-button--captions .media-icon--captions-on{opacity:0;display:none}.media-button--play[data-ended] .media-icon--restart,.media-button--play:not([data-ended])[data-paused] .media-icon--play,.media-button--play:not([data-ended]):not([data-started]) .media-icon--play,.media-button--play[data-started]:not([data-paused]):not([data-ended]) .media-icon--pause,.media-button--mute[data-muted] .media-icon--volume-off,.media-button--mute:not([data-muted])[data-volume-level=low] .media-icon--volume-low,.media-button--mute:not([data-muted]):not([data-volume-level=low]) .media-icon--volume-high,.media-button--fullscreen:not([data-fullscreen]) .media-icon--fullscreen-enter,.media-button--fullscreen[data-fullscreen] .media-icon--fullscreen-exit,.media-button--pip:not([data-pip]) .media-icon--pip-enter,.media-button--pip[data-pip] .media-icon--pip-exit,.media-button--cast:not([data-cast-state=connected]) .media-icon--cast-enter,.media-button--cast[data-cast-state=connected] .media-icon--cast-exit,.media-button--airplay:not([data-airplay-state=connected]) .media-icon--airplay-enter,.media-button--airplay[data-airplay-state=connected] .media-icon--airplay-exit,.media-button--captions:not([data-active]) .media-icon--captions-off,.media-button--captions[data-active] .media-icon--captions-on{opacity:1;display:block}.media-button--airplay:not([data-airplay-state=connected]){--media-icon--airplay__fill-animation:none;--media-icon--airplay__triangle-animation:none}@keyframes media-shake{0%,to{translate:0}20%{translate:-6px}40%{translate:4px}60%{translate:-2px}80%{translate:1px}}@property --media-progress-fill{syntax:\"<percentage>\";inherits:true;initial-value:0%}.media-default-skin--video{--media-spring-timing-function:linear(0, .034 1.5%, .763 9.7%, 1.066 13.9%, 1.198 19.9%, 1.184 21.8%, .963 37.5%, .997 50.9%, 1);--media-border-color:oklch(0% 0 0/.1);--media-surface-background-color:oklch(100% 0 0/.1);--media-surface-inner-border-color:oklch(100% 0 0/.1);--media-surface-outer-border-color:oklch(0% 0 0/.1);--media-surface-shadow-color:oklch(0% 0 0/.15);--media-surface-backdrop-filter:blur(16px) saturate(1.5);--media-video-border-radius:var(--media-border-radius,1.75rem);--media-controls-transition-duration:.1s;--media-controls-transition-timing-function:ease-out;--media-error-dialog-transition-duration:.35s;--media-error-dialog-transition-delay:.1s;--media-error-dialog-transition-timing-function:var(--media-spring-timing-function);--media-popup-transition-duration:.1s;--media-popup-transition-timing-function:ease-out;background:oklch(0% 0 0);overflow:clip;@media (prefers-reduced-motion:reduce){--media-error-dialog-transition-duration:50ms;--media-error-dialog-transition-delay:0s;--media-error-dialog-transition-timing-function:ease-out;--media-popup-transition-duration:0s}@media (prefers-color-scheme:dark){--media-border-color:oklch(100% 0 0/.15)}@media (prefers-reduced-transparency:reduce) or (prefers-contrast:more){--media-surface-background-color:oklch(0% 0 0);--media-surface-inner-border-color:oklch(100% 0 0/.25);--media-surface-outer-border-color:transparent}&:has(.media-controls--root:not([data-visible])){@media (pointer:fine){--media-controls-transition-duration:.3s}@media (pointer:coarse){--media-controls-transition-duration:.15s}@media (prefers-reduced-motion:reduce){--media-controls-transition-duration:50ms}}&:after{z-index:10;pointer-events:none;content:\"\";border-radius:inherit;box-shadow:inset 0 0 0 1px var(--media-border-color);position:absolute;inset:0}&:fullscreen{--media-border-radius:0;&:after{display:none}@media (width>=1280px){--scale:1.25}@media (width>=1536px){--scale:1.5}@media (width>=1920px){--scale:1.75}}}.media-default-skin--video .media-error{z-index:20;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.media-default-skin--video .media-error__dialog{gap:calc(var(--spacing) * 3);width:100%;max-width:calc(var(--spacing) * 72);padding:calc(var(--spacing) * 3);color:oklch(100% 0 0);text-shadow:0 1px oklch(0% 0 0/.25);border-radius:calc(var(--spacing) * 7);transition-delay:var(--media-error-dialog-transition-delay);transition-timing-function:var(--media-error-dialog-transition-timing-function);transition-duration:var(--media-error-dialog-transition-duration);flex-direction:column;transition-property:opacity,scale;display:flex}.media-default-skin--video .media-error[data-starting-style] .media-error__dialog,.media-default-skin--video .media-error[data-ending-style] .media-error__dialog{opacity:0;scale:.5}.media-default-skin--video .media-error[data-ending-style] .media-error__dialog{transition-delay:0s}.media-default-skin--video .media-error__content{gap:calc(var(--spacing) * 2);padding:calc(var(--spacing) * 2) calc(var(--spacing) * 2) calc(var(--spacing) * 1.5);text-shadow:inherit;flex-direction:column;display:flex}.media-default-skin--video .media-error__title{font-size:var(--font-size-medium)}.media-default-skin--video .media-controls--root{--inset-factor:2;--inset:calc(var(--spacing) * var(--inset-factor));--base-boundary-offset:var(--inset-factor);z-index:10;color:var(--media-color-primary,oklch(100% 0 0));transition-timing-function:var(--media-controls-transition-timing-function);transition-duration:calc(var(--media-controls-transition-duration) / 2);display:contents;& .media-controls--primary,& .media-controls--secondary{z-index:10;position:absolute}& .media-controls--primary{inset-inline:var(--inset);bottom:var(--inset);transform-origin:bottom}& .media-controls--secondary{top:var(--inset);right:var(--inset);transform-origin:top;container-type:normal}@container media-root (width<32rem){& .media-controls--primary,& .media-controls--secondary{transition-timing-function:inherit;transition-duration:inherit;@media (pointer:fine){will-change:filter, opacity, scale, translate;transition-property:filter,opacity,scale,translate}@media (pointer:coarse){will-change:opacity, scale, translate;transition-property:opacity,scale,translate}}&:after{display:none}&:not([data-visible]){& .media-controls--primary,& .media-controls--secondary{pointer-events:none;opacity:0;transition-duration:var(--media-controls-transition-duration);scale:.95;@media (pointer:fine) and (prefers-reduced-motion:no-preference){filter:blur(8px)}@media (prefers-reduced-motion:reduce){scale:1}}& .media-controls--primary{@media (prefers-reduced-motion:no-preference){translate:0 4px}}& .media-controls--secondary{@media (prefers-reduced-motion:no-preference){translate:0 -4px}}}}@container media-root (width>=32rem){inset-inline:var(--inset);bottom:var(--inset);transform-origin:bottom;display:flex;position:absolute;& .media-controls--primary,& .media-controls--secondary{display:contents;&:after{display:none}}&:not([data-visible]){pointer-events:none;opacity:0;transition-duration:var(--media-controls-transition-duration);scale:.95;@media (pointer:fine) and (prefers-reduced-motion:no-preference){filter:blur(8px)}@media (prefers-reduced-motion:reduce){scale:1}@media (prefers-reduced-motion:no-preference){translate:0 4px}}}& .media-time-controls{padding-inline:calc(var(--spacing) * 3);flex:1}@media (pointer:fine){will-change:filter, opacity, scale, translate;transition-property:filter,opacity,scale,translate}@media (pointer:coarse){will-change:opacity, scale, translate;transition-property:opacity,scale,translate}@container media-root (width>42rem){--inset-factor:3}}.media-default-skin--video .media-error[data-open]~.media-controls{display:none}.media-default-skin--video:has(.media-controls--root:not([data-visible])){cursor:none}.media-default-skin--video .media-slider__track{background-color:oklch(100% 0 0/.2);box-shadow:0 0 0 1px oklch(0% 0 0/.05)}.media-default-skin--video .media-slider__thumbnail{--max-width:calc(var(--spacing) * 44);--max-height:calc(var(--spacing) * 32);--padding:calc(var(--spacing) * -4.5);--inset:calc((100cqi - 100%) / 2);bottom:calc(100% + calc(var(--spacing) * 4.8));left:clamp(calc(var(--max-width) / 2 + var(--padding) - var(--inset)), var(--media-slider-pointer), calc(100% - var(--max-width) / 2 - var(--padding) + var(--inset)));pointer-events:none;opacity:0;filter:blur(8px);transform-origin:bottom;transition-property:scale,opacity,filter;transition-duration:.15s;transition-timing-function:ease-out;position:absolute;translate:-50%;scale:.8;& .media-thumbnail__image{max-width:var(--max-width);max-height:var(--max-height)}}.media-default-skin--video .media-slider[data-pointing] .media-slider__thumbnail:has([role=img]:not([data-hidden])){opacity:1;filter:blur();scale:1}.media-default-skin--video .media-slider__thumbnail:has([role=img]:not([data-hidden]))+.media-slider__preview .media-slider__value{display:none}.react-flow{--xy-edge-stroke-default:#b1b1b7;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#555;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#ffffff80;--xy-minimap-background-color-default:#fff;--xy-minimap-mask-background-color-default:#f0f0f099;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#e2e2e2;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:transparent;--xy-background-pattern-dots-color-default:#91919a;--xy-background-pattern-lines-color-default:#eee;--xy-background-pattern-cross-color-default:#e2e2e2;background-color:var(--xy-background-color,var(--xy-background-color-default));--xy-node-color-default:inherit;--xy-node-border-default:1px solid #1a192b;--xy-node-background-color-default:#fff;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #00000014;--xy-node-boxshadow-selected-default:0 0 0 .5px #1a192b;--xy-node-border-radius-default:3px;--xy-handle-background-color-default:#1a192b;--xy-handle-border-color-default:#fff;--xy-selection-background-color-default:#0059dc14;--xy-selection-border-default:1px dotted #0059dccc;--xy-controls-button-background-color-default:#fefefe;--xy-controls-button-background-color-hover-default:#f4f4f4;--xy-controls-button-color-default:inherit;--xy-controls-button-color-hover-default:inherit;--xy-controls-button-border-color-default:#eee;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#fff;--xy-edge-label-color-default:inherit;--xy-resize-background-color-default:#3367d9;direction:ltr}.react-flow.dark{--xy-edge-stroke-default:#3e3e3e;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#727272;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#96969640;--xy-minimap-background-color-default:#141414;--xy-minimap-mask-background-color-default:#3c3c3c99;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#2b2b2b;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:#141414;--xy-background-pattern-dots-color-default:#555;--xy-background-pattern-lines-color-default:#333;--xy-background-pattern-cross-color-default:#333;--xy-node-color-default:#f8f8f8;--xy-node-border-default:1px solid #3c3c3c;--xy-node-background-color-default:#1e1e1e;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #ffffff14;--xy-node-boxshadow-selected-default:0 0 0 .5px #999;--xy-handle-background-color-default:#bebebe;--xy-handle-border-color-default:#1e1e1e;--xy-selection-background-color-default:#c8c8dc14;--xy-selection-border-default:1px dotted #c8c8dccc;--xy-controls-button-background-color-default:#2b2b2b;--xy-controls-button-background-color-hover-default:#3e3e3e;--xy-controls-button-color-default:#f8f8f8;--xy-controls-button-color-hover-default:#fff;--xy-controls-button-border-color-default:#5b5b5b;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#141414;--xy-edge-label-color-default:#f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props,var(--xy-background-color,var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width,var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke,var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width,var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{pointer-events:none;position:absolute;overflow:visible}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected,var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}svg.react-flow__connectionline{z-index:1001;position:absolute;overflow:visible}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.react-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.react-flow__handle{pointer-events:none;background-color:var(--xy-handle-background-color,var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color,var(--xy-handle-border-color-default));border-radius:100%;width:6px;min-width:5px;height:6px;min-height:5px;position:absolute}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;bottom:0;left:50%;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{z-index:5;margin:15px;position:absolute}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px)translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px)translateY(-50%)}.react-flow__attribution{background:var(--xy-attribution-background-color,var(--xy-attribution-background-color-default));margin:0;padding:2px 3px;font-size:10px}.react-flow__attribution a{color:#999;text-decoration:none}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.react-flow__edgelabel-renderer{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__viewport-portal{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__minimap{background:var(--xy-minimap-background-color-props,var(--xy-minimap-background-color,var(--xy-minimap-background-color-default)))}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var(--xy-minimap-mask-background-color-props,var(--xy-minimap-mask-background-color,var(--xy-minimap-mask-background-color-default)));stroke:var(--xy-minimap-mask-stroke-color-props,var(--xy-minimap-mask-stroke-color,var(--xy-minimap-mask-stroke-color-default)));stroke-width:var(--xy-minimap-mask-stroke-width-props,var(--xy-minimap-mask-stroke-width,var(--xy-minimap-mask-stroke-width-default)))}.react-flow__minimap-node{fill:var(--xy-minimap-node-background-color-props,var(--xy-minimap-node-background-color,var(--xy-minimap-node-background-color-default)));stroke:var(--xy-minimap-node-stroke-color-props,var(--xy-minimap-node-stroke-color,var(--xy-minimap-node-stroke-color-default)));stroke-width:var(--xy-minimap-node-stroke-width-props,var(--xy-minimap-node-stroke-width,var(--xy-minimap-node-stroke-width-default)))}.react-flow__background-pattern.dots{fill:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-dots-color-default)))}.react-flow__background-pattern.lines{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-lines-color-default)))}.react-flow__background-pattern.cross{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-cross-color-default)))}.react-flow__controls{box-shadow:var(--xy-controls-box-shadow,var(--xy-controls-box-shadow-default));flex-direction:column;display:flex}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{background:var(--xy-controls-button-background-color,var(--xy-controls-button-background-color-default));border:none;border-bottom:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)));width:26px;height:26px;color:var(--xy-controls-button-color-props,var(--xy-controls-button-color,var(--xy-controls-button-color-default)));cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;justify-content:center;align-items:center;padding:4px;display:flex}.react-flow__controls-button svg{fill:currentColor;width:100%;max-width:12px;max-height:12px}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{border-radius:var(--xy-node-border-radius,var(--xy-node-border-radius-default));width:150px;color:var(--xy-node-color,var(--xy-node-color-default));text-align:center;border:var(--xy-node-border,var(--xy-node-border-default));background-color:var(--xy-node-background-color,var(--xy-node-background-color-default));padding:10px;font-size:12px}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover,var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected,var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color,var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color,var(--xy-selection-background-color-default));border:var(--xy-selection-border,var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var(--xy-controls-button-background-color-hover-props,var(--xy-controls-button-background-color-hover,var(--xy-controls-button-background-color-hover-default)));color:var(--xy-controls-button-color-hover-props,var(--xy-controls-button-color-hover,var(--xy-controls-button-color-hover-default)))}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)))}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border:1px solid #fff;border-radius:1px;width:5px;height:5px;translate:-50% -50%}.react-flow__resize-control.handle.left{top:50%;left:0}.react-flow__resize-control.handle.right{top:50%;left:100%}.react-flow__resize-control.handle.top{top:0;left:50%}.react-flow__resize-control.handle.bottom{top:100%;left:50%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border-style:solid;border-width:0}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;height:100%;top:0;transform:translate(-50%)}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{width:100%;height:1px;left:0;transform:translateY(-50%)}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color,var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color,var(--xy-edge-label-color-default))}\n/*$vite$:1*/"; document.head.appendChild(s) })();
2
- import{c as e,d as t,f as n,r}from"./assets/lib-language-CNKEEyke.js";import{$ as i,A as a,B as o,C as s,D as c,Dt as l,E as u,Et as d,H as f,J as p,Mt as m,N as h,O as g,Ot as _,Q as v,S as y,St as b,T as x,Tt as S,U as C,V as w,W as T,Y as E,Z as D,_t as O,a as k,at as A,b as j,bt as M,d as N,dt as P,et as ee,f as te,ft as F,gt as ne,h as I,i as re,j as ie,k as ae,kt as oe,l as se,lt as ce,m as le,mt as ue,n as de,nt as fe,o as pe,ot as me,p as he,pt as ge,r as _e,s as ve,st as ye,t as be,tt as xe,u as Se,ut as Ce,v as we,vt as Te,w as Ee,wt as De,x as Oe,xt as ke,yt as Ae,z as je}from"./assets/lib-track-languages-Dzs__wrS.js";import{c as Me}from"./assets/lib-build-CGzjdmEV.js";import{m as Ne}from"./assets/lib-intl-_4f6zNc2.js";import{A as Pe,B as Fe,C as Ie,Ct as Le,D as Re,E as ze,F as Be,G as Ve,H as He,I as Ue,J as L,L as We,M as Ge,N as Ke,O as qe,P as Je,Q as Ye,R as Xe,S as Ze,St as Qe,T as $e,U as R,V as et,W as tt,X as nt,Y as z,Z as rt,_ as it,_t as B,at,b as ot,bt as st,c as V,ct,d as lt,dt as ut,et as dt,f as ft,ft as H,g as pt,gt as mt,h as ht,ht as U,i as gt,it as _t,j as vt,k as yt,l as W,lt as G,m as bt,mt as K,nt as xt,ot as St,p as Ct,pt as wt,q as Tt,rt as Et,s as q,st as Dt,tt as Ot,u as kt,ut as At,v as jt,wt as Mt,x as Nt,xt as Pt,y as Ft,yt as It,z as Lt}from"./assets/lib-chapters-EBYXcEml-BkEWlXg4.js";import{$ as Rt,A as zt,B as Bt,F as Vt,G as Ht,H as Ut,I as Wt,J as Gt,K as Kt,L as qt,M as Jt,N as Yt,O as Xt,P as Zt,Q as Qt,R as $t,S as en,T as tn,U as nn,W as rn,X as an,Y as on,Z as sn,_ as cn,a as ln,at as un,b as dn,c as fn,ct as pn,d as mn,et as hn,f as gn,it as _n,k as vn,lt as yn,n as bn,nt as xn,o as Sn,ot as Cn,q as wn,rt as Tn,st as J,t as En,tt as Dn,ut as On,v as kn,w as An,z as jn}from"./assets/lib-base-text-jWhx_ZWA.js";import{A as Mn,B as Nn,C as Pn,D as Fn,E as In,F as Ln,G as Rn,H as zn,I as Bn,J as Vn,K as Hn,L as Un,M as Wn,N as Gn,O as Kn,P as qn,R as Jn,S as Yn,T as Xn,U as Zn,V as Qn,W as $n,Y as er,_ as tr,a as nr,b as rr,c as ir,d as ar,f as or,g as sr,h as cr,i as lr,j as ur,k as dr,l as fr,m as pr,n as mr,o as hr,p as gr,q as _r,r as vr,s as yr,t as br,u as xr,w as Sr,x as Cr,z as wr}from"./assets/lib-worker-nohMXPb-.js";import{i as Tr}from"./assets/lib-remote-DGQnQwa6.js";var Er=[`title`,`media`,`watch`],Dr=/* @__PURE__ */ `.anilist.anizip.cr.jw.kitsu.mal.nf.nyaa.offline.simkl.amazon.disney.tvmaze.animethemes.ann.livechart.hoopla.plex.tubi.omdb.watchmode.imdb.tmdb.tvdb.trakt.fubo.anidb.appletv.hbo.hulu.hidive.paramount.peacock.philo.pluto.roku.starz.amcplus.unogs.yt.jikan.stub`.split(`.`),Or=[``,`https:stub.plugins.banou.dev`],kr=[``,`amzn1.dv.gti.`],Ar=[[1,1],[1,2],[2,3]],jr=8192,Mr=16384,Nr=/^(\/(?:title|media)\/[^/?]+)\/([^/?:]+)(\?.*)?$/,Pr=/^(?:[\w.~-]|%[\dA-F]{2})+$/i,Fr=/^ag:\((.*)\)$/,Ir=/^(?:0|[1-9]\d{0,14})$/,Lr=/^(.*?)([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/,Rr=/^[0-9a-f]{24}$/,zr=/(\d{4,15})/,Br=new TextEncoder,Vr=/* @__PURE__ */ Error(`not a share code`),Hr=(e,t)=>{do{let n=t%128;t=Math.floor(t/128),e.push(t?n+128:n)}while(t)},Ur=(e,t)=>{let n=Br.encode(t);Hr(e,n.length),e.push(...n)},Wr=(e,t)=>{let n=t.split(zr).filter(Boolean);Hr(e,n.length);for(let t of n)if(/^\d+$/.test(t)&&t.length>=4)Hr(e,t.length*2+1),Hr(e,Number(t));else{let n=Br.encode(t);Hr(e,n.length*2),e.push(...n)}},Gr=e=>e.match(/../g).map(e=>parseInt(e,16)),Kr=(e,t,n)=>{if(Ir.test(t))return Hr(e,Number(t)*4);let r=-1;if(n.forEach((e,i)=>{e.length>=3&&t.startsWith(e)&&(r<0||e.length>n[r].length)&&(r=i)}),r>=0)return Hr(e,r*4+1),Wr(e,t.slice(n[r].length));let i=Lr.exec(t),a=i?kr.indexOf(i[1]):-1;if(i&&a>=0)return Hr(e,a*2*4+2),e.push(...Gr(i.slice(2).join(``)));if(Rr.test(t))return Hr(e,6),e.push(...Gr(t));Hr(e,3),Wr(e,t)},qr=(e,t,n)=>{let r=Fr.exec(t)?.[1],i=[];for(let e of r===void 0?[t]:r.split(`,`)){let t=e.indexOf(`:`);if(t<0)throw Vr;let n=e.slice(0,t),r=e.slice(t+1),a=i.at(-1);a?.origin===n?a.ids.push(r):i.push({origin:n,ids:[r]})}Hr(e,i.length*2+(r===void 0?0:1));for(let{origin:t,ids:r}of i){let i=Dr.indexOf(t),a=i>0&&i<64?i:0,o=r.length>1&&r.every((e,t)=>Ir.test(e)&&(t===0||Number(e)>Number(r[t-1])));e.push(a+(r.length>1?64:0)+(o?128:0)),a||Ur(e,t),r.length>1&&Hr(e,r.length-2);let s=0;for(let i of r)o?(Hr(e,Number(i)-s),s=Number(i)):Kr(e,i,n),n.push(i,`${t}-${i}`)}},Jr=e=>{let t=e.indexOf(`?`),n=t<0?e:e.slice(0,t),r=t<0?void 0:e.slice(t+1),[i,a,...o]=n.split(`/`),s=Er.indexOf(a);if(i!==``||s<0||o.length<Ar[s][0]||o.length>Ar[s][1]||o.includes(``))throw Vr;let c=[s*4+o.length],l=[];for(let e of o)qr(c,e,l);for(let e of r===void 0?[]:r.split(`&`)){if(!e.startsWith(`plugins=`))throw Vr;let t=e.slice(8),n=Math.max(0,Or.indexOf(t));Hr(c,n),n||Ur(c,t)}return Uint8Array.from(c)},Yr=e=>{let t=0,n=0,r=new TextDecoder(`utf-8`,{fatal:!0}),i=()=>e.length-t,a=()=>{if(t>=e.length)throw Vr;return e[t++]},o=e=>{if(e>i())throw Vr;return e},s=()=>{let e=0;for(let t=1,n=0;;t*=128,n++){if(n===8)throw Vr;let r=a();if(e+=r%128*t,r<128)break}if(e>2**53-1)throw Vr;return e},c=n=>e.subarray(t,t+=o(n)),l=()=>r.decode(c(s())),u=e=>{if(n+=e.length+1,n>jr)throw Vr;return e},d=()=>{let e=``;for(let t=o(s());t>0;t--){let t=s();if(t%2){let n=(t-1)/2,r=String(s());if(n>15||r.length>n)throw Vr;e+=r.padStart(n,`0`)}else e+=r.decode(c(t/2))}return e},f=e=>Array.from(c(e),e=>e.toString(16).padStart(2,`0`)).join(``),p=e=>{let t=s(),n=t%4,r=(t-n)/4;if(n===0)return String(r);if(n===1){if(r>=e.length)throw Vr;return e[r]+d()}if(n===3)return d();if(r===1)return f(12);let i=kr[r/2];if(i===void 0)throw Vr;let a=f(16);return`${i}${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`},m=a(),h=Math.floor(m/4),g=m%4,_=Ar[h];if(!_||g<_[0]||g>_[1])throw Vr;let v=[],y=[];for(let e=0;e<g;e++){let e=s(),t=e%2==1,n=o((e-+!!t)/2);if(!n||!t&&n!==1)throw Vr;let r=[];for(let e=0;e<n;e++){let e=a(),n=e%64,i=n?Dr[n]:l();if(i===void 0)throw Vr;let c=!!(e&64),d=!!(e&128),f=c?o(s()+2):1;if(d&&!c||!t&&c)throw Vr;let m=0;for(let e=0;e<f;e++){let e=d?String(m+=s()):p(y);if(m>2**53-1)throw Vr;y.push(e,`${i}-${e}`),r.push(u(`${i}:${e}`))}}v.push(t?`ag:(${r.join(`,`)})`:r[0])}let b=[];for(;i();){let e=s(),t=e?Or[e]:l();if(t===void 0)throw Vr;b.push(u(`plugins=${t}`))}return`/${[Er[h],...v].join(`/`)}${b.length?`?${b.join(`&`)}`:``}`},Xr=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)},Zr=e=>{if(e.length>Mr||!/^[\w-]+$/.test(e))throw Vr;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`)),e=>e.charCodeAt(0))},Qr=e=>{if(e.length>jr||e.includes(`#`))return;let t=Nr.exec(e);try{let n=t?`${Xr(Jr(`${t[1]}${t[3]??``}`))}/${t[2]}`:Xr(Jr(e));return $r(n)===e?n:void 0}catch{return}},$r=e=>{let t=e.indexOf(`/`),n=t<0?``:e.slice(t+1);try{let r=Yr(Zr(t<0?e:e.slice(0,t))),i=r.indexOf(`?`),a=i<0?r:r.slice(0,i);return Pr.test(n)&&n.length<=jr&&/^\/(?:title|media)\/[^/]+$/.test(a)?`${a}/${n}${r.slice(a.length)}`:r}catch{return}};if(location.pathname.startsWith(`/s/`)){let e=$r(location.pathname.slice(3));e&&history.replaceState(history.state,``,e)}var ei=()=>`https://fkn.app/connect-button`,ti=[`ready`,`loading`,`away`],ni=[`play`,`seek`,`go`,`rate`,`subs`,`audio`],ri={subtitles:`subs`,audio:`audio`},ii={all:[],by:{}},ai=(e,t,n)=>e.by[t]?.[n]??e.all.includes(n),oi=/* @__PURE__ */ new Set([`nav`,`scroll`,`cursor`,`playback`,`state`,`pong`]),si=e=>oi.has(e.t),ci=e=>e.trim().slice(0,500)||void 0,li=e=>e.trim().replace(/\s+/g,` `).slice(0,32)||void 0,ui=e=>JSON.stringify({v:1,...e}),di=e=>{let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;let n=t;if(n.v===1)switch(n.t){case`nav`:return vi(n.path)?{t:`nav`,path:n.path}:void 0;case`scroll`:return Si(n.y)?{t:`scroll`,y:n.y}:void 0;case`cursor`:return Si(n.x)&&Si(n.y)?{t:`cursor`,x:n.x,y:n.y}:void 0;case`chat`:{let e=typeof n.text==`string`?ci(n.text):void 0;return e?{t:`chat`,text:e}:void 0}case`name`:{let e=typeof n.name==`string`?li(n.name):void 0;return e?{t:`name`,name:e}:void 0}case`ping`:return bi(n.n)&&bi(n.at)?{t:`ping`,n:n.n,at:n.at}:void 0;case`pong`:return bi(n.n)&&bi(n.at)&&bi(n.host)?{t:`pong`,n:n.n,at:n.at,host:n.host}:void 0;case`playback`:return Ci(n.s)?{t:`playback`,s:n.s}:void 0;case`state`:{if(!vi(n.path)||!Si(n.y)||n.s!==void 0&&!Ci(n.s))return;let e=pi(n.grants),t=hi(n.sub),r=hi(n.audio);return{t:`state`,path:n.path,y:n.y,...n.s?{s:n.s}:{},...e?{grants:e}:{},...t===void 0?{}:{sub:t},...r===void 0?{}:{audio:r}}}case`status`:{if(!ti.includes(n.s)||n.path!==void 0&&!yi(n.path))return;let e=xi(n.time)&&typeof n.rate==`number`&&n.rate>=0&&n.rate<=16;return!e&&(n.time!==void 0||n.rate!==void 0)?void 0:{t:`status`,s:n.s,...n.path===void 0?{}:{path:n.path},...e?{time:n.time,rate:n.rate}:{}}}case`ask`:if(n.c===`go`)return yi(n.path)?{t:`ask`,c:`go`,path:n.path}:void 0;if(n.c===`subs`){let e=hi(n.sub);return e===void 0?void 0:{t:`ask`,c:`subs`,sub:e}}if(n.c===`audio`){let e=hi(n.audio);return e===void 0?void 0:{t:`ask`,c:`audio`,audio:e}}return fi(n.c)&&vi(n.path)&&Ci(n.s)?{t:`ask`,c:n.c,path:n.path,s:n.s}:void 0;default:return}},fi=e=>ni.includes(e),pi=e=>{if(!e||typeof e!=`object`)return;let{all:t,by:n}=e;if(!Array.isArray(t)||!n||typeof n!=`object`||Array.isArray(n))return;let r=Object.entries(n);if(r.length>mi)return;let i={all:t.filter(fi),by:{}};for(let[e,t]of r){if(!e||e.length>128||!t||typeof t!=`object`)return;i.by[e]=Object.fromEntries(Object.entries(t).filter(([e,t])=>fi(e)&&typeof t==`boolean`))}return i},mi=100,hi=e=>{if(e===null)return null;if(typeof e!=`string`)return;let t=e.replace(/\s+/g,` `).trim();return t&&t.length<=64?t:void 0},gi=/* @__PURE__ */ new Map,_i=(e,t)=>{gi.has(t)||gi.set(t,[new Intl.DurationFormat(t,{minutes:`numeric`,seconds:`2-digit`}),new Intl.DurationFormat(t,{hours:`numeric`,minutes:`2-digit`,seconds:`2-digit`})]);let[n,r]=gi.get(t),i=Math.floor(e);return i>=3600?r.format({hours:Math.floor(i/3600),minutes:Math.floor(i/60)%60,seconds:i%60}):n.format({minutes:Math.floor(i/60),seconds:i%60})},vi=e=>typeof e==`string`&&e.length>0&&e.length<=2048&&e.startsWith(`/`)&&!e.startsWith(`//`)&&!e.startsWith(`/\\`)&&!/[\r\n\t]/.test(e),yi=e=>vi(e)&&new URL(e,`https://stub.invalid`).pathname.startsWith(`/watch/`),bi=e=>typeof e==`number`&&Number.isFinite(e),xi=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0,Si=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1,Ci=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.paused==`boolean`&&xi(t.time)&&typeof t.rate==`number`&&Number.isFinite(t.rate)&&t.rate>0&&t.rate<=16&&typeof t.at==`number`&&Number.isFinite(t.at)},wi=.5,Ti=5e3,Ei=(e,t,n=!1)=>{if(e.paused)return e.time;let r=Math.max(t-e.at,0),i=(n?r:Math.min(r,Di))/1e3;return e.time+i*e.rate},Di=2e3,Oi=(e,t,n,r=!1)=>{let i={},a=Ei(t,n,r);return Math.abs(a-e.time)>.5&&(i.seek=a),t.paused&&!e.paused&&(i.pause=!0),!t.paused&&e.paused&&(i.play=!0),Mi(e.rate,t.rate)||(i.rate=t.rate),i},ki=.05,Ai=e=>{let t=[...e].sort((e,t)=>e-t),n=t.length>>1;return t.length%2?t[n]:(t[n-1]+t[n])/2},ji=(e,t,n,r,i=!1)=>{let a=Ei(n,r,!0),o=(a-t.time)/n.rate,s=wi*n.rate,c={...n,time:a,at:r},l=i||!e||e.heard.paused!==n.paused||Math.abs(Ei(e.heard,r,!0)-a)>s||t.time<e.played.time-ki||t.time>Ei(e.played,r,!0)+s,u=Oi(t,n,r,!0);Math.abs(o)<=(l?.5:t.seeking?1/0:3)&&delete u.seek;let d=!l&&u.seek!==void 0&&e?.seek?Math.max(0,o+e.seek.aim):0;u.seek!==void 0&&(u.seek+=d*n.rate);let f;if(!e||l||!Mi(e.heard.rate,n.rate)||t.paused||t.seeking||u.seek!==void 0)f={heard:c,drifts:[]};else if(e.catchUp&&r<e.catchUp.until)f={...e,heard:c};else{let t=[...e.drifts,o].slice(-5),i=t.length===5?Ai(t):0;if(Math.abs(i)>.4){let e=Math.min(Math.abs(i)/10,.050000000000000044),t=n.rate*(i>0?1+e:1/(1+e));f={heard:c,drifts:[],catchUp:{rate:t,until:r+Math.abs(i*n.rate/(t-n.rate))*1e3}}}else f={heard:c,drifts:t}}let p=f.catchUp?.rate??n.rate;Mi(t.rate,p)?delete u.rate:u.rate=p;let m={paused:u.pause??(t.paused&&!u.play),time:u.seek??t.time,rate:p,at:r},h=u.seek===void 0?t.seeking?e?.seek:void 0:{aim:d};return{correction:u,follow:{...f,played:m,seek:h}}},Mi=(e,t)=>Math.abs(e-t)<=.001,Ni=(e,t)=>e<=t*1.05+.001&&e>=t/1.05-.001,Pi=(e,t,n)=>({...e,time:e.paused?e.time:e.time+Math.max(0,n-t)/1e3*e.rate,at:n}),Fi=2e3,Ii=3e3,Li=(e,t,n)=>{let r=[];return t.paused!==e.paused&&t.paused!==n.paused&&r.push(`play`),(t.time<e.time-ki||t.time>Ei(e,t.at,!0)+.5)&&Math.abs(t.time-n.time)>.5&&r.push(`seek`),!Ni(t.rate,e.rate)&&!Ni(t.rate,n.rate)&&r.push(`rate`),r},Ri=(e,t,n)=>{let r=Pi(e,e.at,n);if(t.c===`play`)return e.paused===t.s.paused?void 0:{...r,paused:t.s.paused};if(t.c===`rate`)return Mi(e.rate,t.s.rate)?void 0:{...r,rate:t.s.rate};let i=Ei(t.s,n);return Math.abs(i-r.time)<=.5?void 0:{...r,time:i}},zi=1e3,Bi=1,Vi=(e,t)=>{let n=e.find(([e,n])=>e-.5<=t&&t<n);return n?n[1]-t:0},Hi=(e,t,n,r=0)=>{if(!t||t.readyState<3)return`loading`;let i=e===`ready`?2:10,a=r>0&&Number.isFinite(r)?r-n:1/0;return Vi(t.ranges,n)>=Math.min(i,a)?`ready`:`loading`},Ui=(e,t)=>e.time===void 0?void 0:e.time+Math.max(0,t)/1e3*(e.rate??0),Wi=(e,t,n)=>{if(e.s!==t.s||e.path!==t.path||!e.rate!=!t.rate)return!0;let r=Ui(e,n);return r===void 0||t.time===void 0?r!==t.time:Math.abs(r-t.time)>Bi},Gi=(e,t,n)=>{if(e.path!==n)return{s:e.s===`away`?`away`:`loading`};let r=Ui(e,t);return r===void 0?{s:e.s}:{s:e.s,time:r}},Ki=(e,t,n)=>({rtt:n-e,offset:t-(e+n)/2}),qi=e=>e.length?e.reduce((e,t)=>t.rtt<e.rtt?t:e):void 0,Ji=(e,t)=>e-t,Yi=(e,t)=>e+t,Xi=4e3,Zi=`stub-party-invite`,Qi=`stub-party-name`,$i=1e4,ea=3e4,ta=2e3,na=1e4,ra=6e4,ia={subtitles:`party`,audio:`party`},aa=()=>{try{return globalThis.sessionStorage}catch{return}},oa=e=>e instanceof Error&&typeof e.code==`string`,sa=(e,t=aa())=>{let n={status:`idle`},r,i,a={path:`/`,y:0},o=/* @__PURE__ */ new Set,s=/* @__PURE__ */ new Set,c,l,u=/* @__PURE__ */ new Map,d=/* @__PURE__ */ new Map,f=[],p,m=ii,h=!0,g={},_={},v=ia,y,b,x,S,C=/* @__PURE__ */ new Map,w=1,T,E,D,O,k=/* @__PURE__ */ new Map,A=(()=>{try{return t?.getItem(`stub-party-name`)??void 0}catch{return}})(),j=e=>{n=e;for(let e of o)e(n)},M=e=>{try{t?.setItem(Zi,e)}catch{}},N=()=>{try{t?.removeItem(Zi)}catch{}},P=()=>{try{return t?.getItem(`stub-party-invite`)??void 0}catch{return}},ee=e=>e.owner===e.self.id?`host`:`guest`,te=(e,t)=>{for(let n of s)n(e,t)},F=async e=>{let t=await e.members().catch(()=>void 0);r===e&&n.status===`active`&&t&&j({...n,members:t.length})},ne=e=>{r&&n.status===`active`&&(si(e)&&n.role!==`host`||r.send(ui(e)).catch(()=>{}))},I=()=>{if(!r||n.status!==`active`||n.role!==`guest`)return;let e=r,t=[];x=t;for(let n=0;n<5;n++)setTimeout(()=>{if(x!==t||r!==e)return;let n=Date.now(),i=w++;C.set(i,n),setTimeout(()=>C.delete(i),Xi),ne({t:`ping`,n:i,at:n})},n*400);setTimeout(()=>{if(x!==t||r!==e)return;x=void 0;let n=qi(t);n&&(b=n)},2e3+Xi)},re=()=>({t:`state`,path:a.path,y:a.y,...a.playback?{s:Pi(a.playback,a.playbackAt??Date.now(),Date.now())}:{},...p?{grants:p}:{},...g.subtitles===void 0?{}:{sub:g.subtitles},...g.audio===void 0?{}:{audio:g.audio}}),ie=({grants:e=ii,sub:t,audio:r})=>{let i={subtitles:t,audio:r};JSON.stringify([e,i])!==JSON.stringify([m,_])&&(m=e,_=i,n.status===`active`&&j({...n}))},ae=(e,t)=>{g={...g,[e]:t},ne(re())},oe=()=>{if(D=void 0,!T)return;let e=Date.now(),t=Ui(T.status,e-T.at);E={status:t===void 0?T.status:{...T.status,time:t},at:e},ne({t:`status`,...E.status})},se=e=>{if(!T||D||!e&&E&&!Wi(E.status,T.status,T.at-E.at))return;let t=(E?.at??-1/0)+ta-Date.now();t<=0?oe():D=setTimeout(oe,t)},ce=()=>[...u.values()].filter(e=>`path`in e).at(-1)?.path,le=()=>{let e=u.get(`state`),t=u.get(`scroll`);if(e?.t!==`state`||t?.t!==`scroll`)return e;let n=[...u.keys()];return n.indexOf(`scroll`)>n.indexOf(`state`)?{...e,y:t.y}:e},ue=()=>{i?.(),i=void 0,r=void 0,c&&clearInterval(c),c=void 0,l&&clearInterval(l),l=void 0,S&&clearInterval(S),S=void 0,clearTimeout(D),D=void 0,clearInterval(O),O=void 0,T=void 0,E=void 0,k.clear(),x=void 0,b=void 0,C.clear(),v=ia},de=async e=>{r=e;let t=ee(e);d.clear(),f.length=0,p=void 0,m=ii,h=!0,g={},_={},j({status:`active`,role:t,invite:e.invite,members:1,self:e.self.id,owner:e.owner}),M(e.invite),i=await e.on(i=>{if(r===e)switch(i.type){case`message`:{let n=di(i.message.text);if(!n)return;let r=i.message.from,a=r===e.self.id;if(n.t===`ping`){t===`host`&&!a&&ne({t:`pong`,n:n.n,at:n.at,host:Date.now()});return}if(n.t===`pong`){if(t!==`guest`||r!==e.owner)return;let i=C.get(n.n);if(i===void 0||i!==n.at)return;C.delete(n.n);let a=Ki(i,n.host,Date.now());if(a.rtt>4e3)return;x?.push(a),b||=a;return}if(si(n)){if(r!==e.owner||(n.t===`state`&&ie(n),t===`host`))return;u.delete(n.t),u.set(n.t,n),te(n,{replayed:!1,from:r,self:a});return}if(n.t===`ask`){if(!ai(m,r,n.c))return;let e=f.at(-1);e?.from===r&&e.ask?.c===n.c&&f.pop(),t===`host`&&n.c===`subs`&&ae(`subtitles`,n.sub),t===`host`&&n.c===`audio`&&ae(`audio`,n.audio)}if(n.t===`name`&&d.set(r,n.name),n.t===`status`&&t===`host`&&!a){let{t:e,...t}=n;k.set(r,{status:t,at:Date.now()})}if(n.t===`chat`||n.t===`ask`){let e=n.t===`chat`?{text:n.text}:{ask:n};f.push({seq:i.message.seq,from:r,name:d.get(r),at:i.message.at,self:a,...e}),f.length>200&&f.splice(0,f.length-200)}te(n,{replayed:!1,from:r,self:a});return}case`joined`:t===`host`&&ne(re()),A&&ne({t:`name`,name:A}),F(e);return;case`left`:{if(t===`guest`&&i.id===e.owner){pe(`host-left`);return}k.delete(i.id);let r=p?.by[i.id];t===`host`&&p&&r&&!Object.values(r).includes(!1)&&(p={...p,by:Object.fromEntries(Object.entries(p.by).filter(([e])=>e!==i.id))},ne(re()),j({...n})),F(e);return}}}),r===e?(t===`host`&&(c=setInterval(()=>ne(re()),$i)),t===`guest`&&(I(),S=setInterval(I,ra),T={status:{s:`away`},at:Date.now()},O=setInterval(()=>{yi(ce())&&se(!0)},na)),l=setInterval(()=>{A&&ne({t:`name`,name:A})},ea),A&&ne({t:`name`,name:A}),F(e),e.closed.then(({reason:t})=>{r===e&&(ue(),N(),j({status:`ended`,reason:t}))})):(i(),i=void 0)},fe=e=>n.status===`active`&&(n.role===`host`||ai(m,n.self,e)),pe=async e=>{let t=r;ue(),N(),j({status:`ended`,reason:e}),await t?.leave().catch(()=>{})},me=(e,t)=>{N(),j(t?{status:`idle`}:{status:`failed`,code:oa(e)?e.code:`unknown`})},he=async(e,t,n=!1)=>{r&&await pe(`left`),u.clear(),j({status:`joining`,invite:e??``});try{let e=await t();await de(e)}catch(e){me(e,n)}};return{getState:()=>n,subscribe:e=>(o.add(e),()=>{o.delete(e)}),onMessage:e=>(s.add(e),()=>{s.delete(e)}),create:()=>he(void 0,()=>e.create()),join:t=>he(t,()=>e.join(t)),resume:async()=>{let t=P();t&&!r&&await he(t,()=>e.join(t),!0)},leave:async()=>{r&&await pe(`left`)},send:ne,setLocation:(e,t)=>{a.path=e,a.y=t},setPlayback:e=>{a.playback=e,a.playbackAt=Date.now()},issued:()=>p??ii,setGrants:e=>{n.status===`active`&&n.role===`host`&&(p=e,ne(re()),j({...n}))},may:fe,partyTrack:e=>_[e],setPartyTrack:(e,t)=>{n.status===`active`&&(n.role===`host`?ae(e,t):fe(ri[e])&&ne(e===`subtitles`?{t:`ask`,c:`subs`,sub:t}:{t:`ask`,c:`audio`,audio:t}))},mine:e=>v[e],setMine:(e,t)=>{v={...v,[e]:t},j({...n})},playerTracks:()=>y,setPlayerTracks:e=>{y=e,j({...n})},invite:()=>n.status===`active`?n.invite:void 0,hostClock:()=>b,hostPath:ce,following:()=>h,setFollowing:e=>{h=e,j({...n})},replay:()=>{for(let e of[`state`,`nav`,`scroll`,`playback`]){let t=e===`state`?le():u.get(e);t&&r&&te(t,{replayed:!0,from:r.owner,self:!1})}h||(h=!0,j({...n}))},nameOf:e=>d.get(e),roster:async()=>{if(!r)return[];let e=r;return(await e.members().catch(()=>[])).map(t=>({id:t.id,name:d.get(t.id),host:t.id===e.owner,self:t.id===e.self.id}))},chat:()=>f.slice(),setName:e=>{A=e;try{e?t?.setItem(Qi,e):t?.removeItem(Qi)}catch{}e&&ne({t:`name`,name:e})},name:()=>A,kick:async e=>{r&&n.status===`active`&&n.role===`host`&&await r.remove(e)},ban:async e=>{r&&n.status===`active`&&n.role===`host`&&await r.block(e)},playing:()=>!(!a.playback||a.playback.paused),setStatus:e=>{n.status===`active`&&n.role===`guest`&&(T={status:e,at:Date.now()},se(!1))},statuses:()=>k,dismiss:()=>{(n.status===`ended`||n.status===`failed`)&&j({status:`idle`})}}},ca=`/party`,la=(e,t)=>`${e}${ca}#${da(e,t)}`,ua=(e,t)=>{let n=e.startsWith(`#`)?e.slice(1):e,r;try{r=decodeURIComponent(n).trim()}catch{return}if(ma.test(r))return r;if(!ha.test(r))return;let i=r.indexOf(`.`),a=`${r.slice(0,i)}.${t}/${r.slice(i+1)}`;return ma.test(a)?a:void 0},da=(e,t)=>{let n=t.indexOf(`.`),r=t.slice(n+1),i=r.lastIndexOf(`/`);return i>0&&r.slice(0,i)===e?`${t.slice(0,n)}.${r.slice(i+1)}`:t},fa=`[A-Za-z0-9_-]{43}`,pa=`[a-z0-9][a-z0-9._-]{0,63}`,ma=RegExp(`^${fa}\\.[\\x21-\\x7e]{1,256}\\/${pa}$`),ha=RegExp(`^${fa}\\.${pa}$`),Y=sa(O),ga=/^(anime|movies|series|stub)\.(fkn\.app|localhost)$/,_a=e=>{let t=e.match(ga)?.[1];return t===`movies`?`movie`:t??`stub`},va=e=>ga.test(e),ya=_a(globalThis.location?.hostname??``),ba=[{site:`movie`,host:`movies`},{site:`series`,host:`series`},{site:`anime`,host:`anime`},{site:`stub`,host:`stub`}],xa=globalThis.location?(({protocol:e,hostname:t,port:n})=>{let r=t.match(ga)?.[2];return r?ba.map(({site:t,host:i})=>({site:t,href:`${e}//${i}.${r}${n?`:${n}`:``}/`})):[]})(globalThis.location):[],Sa=[`anilist`,`mal`,`kitsu`,`livechart`,`anizip`,`offline`,`cr`],Ca=(e,t=ya)=>t!==`movie`&&t!==`series`||!Sa.includes(e),wa=/^\/assets\//,Ta=e=>[...new Set([...e.querySelectorAll(`script[src], link[href]`)].map(e=>e.getAttribute(`src`)??e.getAttribute(`href`)??``).filter(e=>wa.test(e)))].sort(),Ea=e=>e.ok&&/javascript|css/.test(e.headers.get(`content-type`)??``),Da=async e=>{let t=await fetch(`/`,{cache:`no-store`}),n=Ta(new DOMParser().parseFromString(await t.text(),`text/html`)).filter(t=>!e.includes(t));return n.length!==0&&(await Promise.all(n.map(async e=>{let t=await fetch(e);return await t.arrayBuffer(),Ea(t)}))).every(Boolean)},Oa=9e5,ka=e=>{let t=!1,n=!1,r=async()=>{if(!(t||n)){t=!0;try{n=await Da(Ta(document))}catch{}t=!1,n&&(clearInterval(i),e())}},i=setInterval(r,Oa);document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&r()}),window.addEventListener(`vite:preloadError`,()=>{r()})},Aa={categoryBar:1,hoverCard:150,filterMenu:500,mediaModal:1e3,header:1100,headerPopup:1150,franchiseDialog:1200,pluginNotice:2e3,sourcePopup:2200,updating:2500,partyCursor:3e3},ja=`stub-update-reloads`,Ma=2,Na=3e5,Pa=1e3,Fa=`textarea:not([readonly]), input:not([type=checkbox]):not([type=radio]):not([readonly]), [contenteditable]:not([contenteditable=false])`,Ia=()=>{try{let e=Date.now(),t=JSON.parse(sessionStorage.getItem(`stub-update-reloads`)??`[]`).filter(t=>e-t<Na);return t.length>=Ma?!1:(sessionStorage.setItem(ja,JSON.stringify([...t,e])),!0)}catch{return!1}},La=/* @__PURE__ */ new Set,Ra=e=>{La.add(e)},za=e=>{let{status:t}=e.getState();return![...La].some(e=>e())&&navigator.onLine&&!location.pathname.startsWith(`/watch/`)&&t!==`joining`&&t!==`active`&&!document.activeElement?.matches(Fa)&&![...document.querySelectorAll(`video`)].some(e=>!e.paused&&!e.ended)},Ba=()=>{let e=document.createElement(`div`);e.textContent=J.formatMessage({id:`Updating Stub`,defaultMessage:`Updating Stub`}),e.style.cssText=`position: fixed; inset: 0; z-index: ${Aa.updating}; display: flex; align-items: center; justify-content: center; background: #0f0f0f; color: #fff; font-size: 2rem`,document.body.append(e)},Va=(({party:e})=>{let t,n=!1,r=()=>{!n&&za(e)&&Ia()&&(n=!0,Ba(),location.reload())};return{due:()=>{t??=setInterval(r,Pa),r()}}})({party:Y});ue.onUpdateTaken(Va.due),va(location.hostname)&&ka(Va.due),Qe();var Ha={NAME:`Name`,DOCUMENT:`Document`,OPERATION_DEFINITION:`OperationDefinition`,VARIABLE_DEFINITION:`VariableDefinition`,SELECTION_SET:`SelectionSet`,FIELD:`Field`,ARGUMENT:`Argument`,FRAGMENT_SPREAD:`FragmentSpread`,INLINE_FRAGMENT:`InlineFragment`,FRAGMENT_DEFINITION:`FragmentDefinition`,VARIABLE:`Variable`,INT:`IntValue`,FLOAT:`FloatValue`,STRING:`StringValue`,BOOLEAN:`BooleanValue`,NULL:`NullValue`,ENUM:`EnumValue`,LIST:`ListValue`,OBJECT:`ObjectValue`,OBJECT_FIELD:`ObjectField`,DIRECTIVE:`Directive`,NAMED_TYPE:`NamedType`,LIST_TYPE:`ListType`,NON_NULL_TYPE:`NonNullType`},Ua=class extends Error{constructor(e,t,n,r,i,a,o){super(e),this.name=`GraphQLError`,this.message=e,i&&(this.path=i),t&&(this.nodes=Array.isArray(t)?t:[t]),n&&(this.source=n),r&&(this.positions=r),a&&(this.originalError=a);var s=o;if(!s&&a){var c=a.extensions;c&&typeof c==`object`&&(s=c)}this.extensions=s||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return`GraphQLError`}},X,Z;function Wa(e){return new Ua(`Syntax Error: Unexpected token at ${Z} in ${e}`)}function Ga(e){if(e.lastIndex=Z,e.test(X))return X.slice(Z,Z=e.lastIndex)}var Ka=/ +(?=[^\s])/y;function qa(e){for(var t=e.split(`
2
+ import{c as e,d as t,f as n,r}from"./assets/lib-language-CNKEEyke.js";import{$ as i,A as a,B as o,C as s,D as c,Dt as l,E as u,Et as d,H as f,J as p,Mt as m,N as h,O as g,Ot as _,Q as v,S as y,St as b,T as x,Tt as S,U as C,V as w,W as T,Y as E,Z as D,_t as O,a as k,at as A,b as j,bt as M,d as N,dt as P,et as ee,f as te,ft as F,gt as ne,h as I,i as re,j as ie,k as ae,kt as oe,l as se,lt as ce,m as le,mt as ue,n as de,nt as fe,o as pe,ot as me,p as he,pt as ge,r as _e,s as ve,st as ye,t as be,tt as xe,u as Se,ut as Ce,v as we,vt as Te,w as Ee,wt as De,x as Oe,xt as ke,yt as Ae,z as je}from"./assets/lib-track-languages-Dzs__wrS.js";import{c as Me}from"./assets/lib-build-CGzjdmEV.js";import{m as Ne}from"./assets/lib-intl-_4f6zNc2.js";import{A as Pe,B as Fe,C as Ie,Ct as Le,D as Re,E as ze,F as Be,G as Ve,H as He,I as Ue,J as L,L as We,M as Ge,N as Ke,O as qe,P as Je,Q as Ye,R as Xe,S as Ze,St as Qe,T as $e,U as R,V as et,W as tt,X as nt,Y as z,Z as rt,_ as it,_t as B,at,b as ot,bt as st,c as V,ct,d as lt,dt as ut,et as dt,f as ft,ft as H,g as pt,gt as mt,h as ht,ht as U,i as gt,it as _t,j as vt,k as yt,l as W,lt as G,m as bt,mt as K,nt as xt,ot as St,p as Ct,pt as wt,q as Tt,rt as Et,s as q,st as Dt,tt as Ot,u as kt,ut as At,v as jt,wt as Mt,x as Nt,xt as Pt,y as Ft,yt as It,z as Lt}from"./assets/lib-chapters-EBYXcEml-BkEWlXg4.js";import{$ as Rt,A as zt,B as Bt,F as Vt,G as Ht,H as Ut,I as Wt,J as Gt,K as Kt,L as qt,M as Jt,N as Yt,O as Xt,P as Zt,Q as Qt,R as $t,S as en,T as tn,U as nn,W as rn,X as an,Y as on,Z as sn,_ as cn,a as ln,at as un,b as dn,c as fn,ct as pn,d as mn,et as hn,f as gn,it as _n,k as vn,lt as yn,n as bn,nt as xn,o as Sn,ot as Cn,q as wn,rt as Tn,st as J,t as En,tt as Dn,ut as On,v as kn,w as An,z as jn}from"./assets/lib-base-text-jWhx_ZWA.js";import{A as Mn,B as Nn,C as Pn,D as Fn,E as In,F as Ln,G as Rn,H as zn,I as Bn,J as Vn,K as Hn,L as Un,M as Wn,N as Gn,O as Kn,P as qn,R as Jn,S as Yn,T as Xn,U as Zn,V as Qn,W as $n,Y as er,_ as tr,a as nr,b as rr,c as ir,d as ar,f as or,g as sr,h as cr,i as lr,j as ur,k as dr,l as fr,m as pr,n as mr,o as hr,p as gr,q as _r,r as vr,s as yr,t as br,u as xr,w as Sr,x as Cr,z as wr}from"./assets/lib-worker-BusYrJW7.js";import{i as Tr}from"./assets/lib-remote-DGQnQwa6.js";var Er=[`title`,`media`,`watch`],Dr=/* @__PURE__ */ `.anilist.anizip.cr.jw.kitsu.mal.nf.nyaa.offline.simkl.amazon.disney.tvmaze.animethemes.ann.livechart.hoopla.plex.tubi.omdb.watchmode.imdb.tmdb.tvdb.trakt.fubo.anidb.appletv.hbo.hulu.hidive.paramount.peacock.philo.pluto.roku.starz.amcplus.unogs.yt.jikan.stub`.split(`.`),Or=[``,`https:stub.plugins.banou.dev`],kr=[``,`amzn1.dv.gti.`],Ar=[[1,1],[1,2],[2,3]],jr=8192,Mr=16384,Nr=/^(\/(?:title|media)\/[^/?]+)\/([^/?:]+)(\?.*)?$/,Pr=/^(?:[\w.~-]|%[\dA-F]{2})+$/i,Fr=/^ag:\((.*)\)$/,Ir=/^(?:0|[1-9]\d{0,14})$/,Lr=/^(.*?)([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/,Rr=/^[0-9a-f]{24}$/,zr=/(\d{4,15})/,Br=new TextEncoder,Vr=/* @__PURE__ */ Error(`not a share code`),Hr=(e,t)=>{do{let n=t%128;t=Math.floor(t/128),e.push(t?n+128:n)}while(t)},Ur=(e,t)=>{let n=Br.encode(t);Hr(e,n.length),e.push(...n)},Wr=(e,t)=>{let n=t.split(zr).filter(Boolean);Hr(e,n.length);for(let t of n)if(/^\d+$/.test(t)&&t.length>=4)Hr(e,t.length*2+1),Hr(e,Number(t));else{let n=Br.encode(t);Hr(e,n.length*2),e.push(...n)}},Gr=e=>e.match(/../g).map(e=>parseInt(e,16)),Kr=(e,t,n)=>{if(Ir.test(t))return Hr(e,Number(t)*4);let r=-1;if(n.forEach((e,i)=>{e.length>=3&&t.startsWith(e)&&(r<0||e.length>n[r].length)&&(r=i)}),r>=0)return Hr(e,r*4+1),Wr(e,t.slice(n[r].length));let i=Lr.exec(t),a=i?kr.indexOf(i[1]):-1;if(i&&a>=0)return Hr(e,a*2*4+2),e.push(...Gr(i.slice(2).join(``)));if(Rr.test(t))return Hr(e,6),e.push(...Gr(t));Hr(e,3),Wr(e,t)},qr=(e,t,n)=>{let r=Fr.exec(t)?.[1],i=[];for(let e of r===void 0?[t]:r.split(`,`)){let t=e.indexOf(`:`);if(t<0)throw Vr;let n=e.slice(0,t),r=e.slice(t+1),a=i.at(-1);a?.origin===n?a.ids.push(r):i.push({origin:n,ids:[r]})}Hr(e,i.length*2+(r===void 0?0:1));for(let{origin:t,ids:r}of i){let i=Dr.indexOf(t),a=i>0&&i<64?i:0,o=r.length>1&&r.every((e,t)=>Ir.test(e)&&(t===0||Number(e)>Number(r[t-1])));e.push(a+(r.length>1?64:0)+(o?128:0)),a||Ur(e,t),r.length>1&&Hr(e,r.length-2);let s=0;for(let i of r)o?(Hr(e,Number(i)-s),s=Number(i)):Kr(e,i,n),n.push(i,`${t}-${i}`)}},Jr=e=>{let t=e.indexOf(`?`),n=t<0?e:e.slice(0,t),r=t<0?void 0:e.slice(t+1),[i,a,...o]=n.split(`/`),s=Er.indexOf(a);if(i!==``||s<0||o.length<Ar[s][0]||o.length>Ar[s][1]||o.includes(``))throw Vr;let c=[s*4+o.length],l=[];for(let e of o)qr(c,e,l);for(let e of r===void 0?[]:r.split(`&`)){if(!e.startsWith(`plugins=`))throw Vr;let t=e.slice(8),n=Math.max(0,Or.indexOf(t));Hr(c,n),n||Ur(c,t)}return Uint8Array.from(c)},Yr=e=>{let t=0,n=0,r=new TextDecoder(`utf-8`,{fatal:!0}),i=()=>e.length-t,a=()=>{if(t>=e.length)throw Vr;return e[t++]},o=e=>{if(e>i())throw Vr;return e},s=()=>{let e=0;for(let t=1,n=0;;t*=128,n++){if(n===8)throw Vr;let r=a();if(e+=r%128*t,r<128)break}if(e>2**53-1)throw Vr;return e},c=n=>e.subarray(t,t+=o(n)),l=()=>r.decode(c(s())),u=e=>{if(n+=e.length+1,n>jr)throw Vr;return e},d=()=>{let e=``;for(let t=o(s());t>0;t--){let t=s();if(t%2){let n=(t-1)/2,r=String(s());if(n>15||r.length>n)throw Vr;e+=r.padStart(n,`0`)}else e+=r.decode(c(t/2))}return e},f=e=>Array.from(c(e),e=>e.toString(16).padStart(2,`0`)).join(``),p=e=>{let t=s(),n=t%4,r=(t-n)/4;if(n===0)return String(r);if(n===1){if(r>=e.length)throw Vr;return e[r]+d()}if(n===3)return d();if(r===1)return f(12);let i=kr[r/2];if(i===void 0)throw Vr;let a=f(16);return`${i}${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`},m=a(),h=Math.floor(m/4),g=m%4,_=Ar[h];if(!_||g<_[0]||g>_[1])throw Vr;let v=[],y=[];for(let e=0;e<g;e++){let e=s(),t=e%2==1,n=o((e-+!!t)/2);if(!n||!t&&n!==1)throw Vr;let r=[];for(let e=0;e<n;e++){let e=a(),n=e%64,i=n?Dr[n]:l();if(i===void 0)throw Vr;let c=!!(e&64),d=!!(e&128),f=c?o(s()+2):1;if(d&&!c||!t&&c)throw Vr;let m=0;for(let e=0;e<f;e++){let e=d?String(m+=s()):p(y);if(m>2**53-1)throw Vr;y.push(e,`${i}-${e}`),r.push(u(`${i}:${e}`))}}v.push(t?`ag:(${r.join(`,`)})`:r[0])}let b=[];for(;i();){let e=s(),t=e?Or[e]:l();if(t===void 0)throw Vr;b.push(u(`plugins=${t}`))}return`/${[Er[h],...v].join(`/`)}${b.length?`?${b.join(`&`)}`:``}`},Xr=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)},Zr=e=>{if(e.length>Mr||!/^[\w-]+$/.test(e))throw Vr;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`)),e=>e.charCodeAt(0))},Qr=e=>{if(e.length>jr||e.includes(`#`))return;let t=Nr.exec(e);try{let n=t?`${Xr(Jr(`${t[1]}${t[3]??``}`))}/${t[2]}`:Xr(Jr(e));return $r(n)===e?n:void 0}catch{return}},$r=e=>{let t=e.indexOf(`/`),n=t<0?``:e.slice(t+1);try{let r=Yr(Zr(t<0?e:e.slice(0,t))),i=r.indexOf(`?`),a=i<0?r:r.slice(0,i);return Pr.test(n)&&n.length<=jr&&/^\/(?:title|media)\/[^/]+$/.test(a)?`${a}/${n}${r.slice(a.length)}`:r}catch{return}};if(location.pathname.startsWith(`/s/`)){let e=$r(location.pathname.slice(3));e&&history.replaceState(history.state,``,e)}var ei=()=>`https://fkn.app/connect-button`,ti=[`ready`,`loading`,`away`],ni=[`play`,`seek`,`go`,`rate`,`subs`,`audio`],ri={subtitles:`subs`,audio:`audio`},ii={all:[],by:{}},ai=(e,t,n)=>e.by[t]?.[n]??e.all.includes(n),oi=/* @__PURE__ */ new Set([`nav`,`scroll`,`cursor`,`playback`,`state`,`pong`]),si=e=>oi.has(e.t),ci=e=>e.trim().slice(0,500)||void 0,li=e=>e.trim().replace(/\s+/g,` `).slice(0,32)||void 0,ui=e=>JSON.stringify({v:1,...e}),di=e=>{let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!=`object`)return;let n=t;if(n.v===1)switch(n.t){case`nav`:return vi(n.path)?{t:`nav`,path:n.path}:void 0;case`scroll`:return Si(n.y)?{t:`scroll`,y:n.y}:void 0;case`cursor`:return Si(n.x)&&Si(n.y)?{t:`cursor`,x:n.x,y:n.y}:void 0;case`chat`:{let e=typeof n.text==`string`?ci(n.text):void 0;return e?{t:`chat`,text:e}:void 0}case`name`:{let e=typeof n.name==`string`?li(n.name):void 0;return e?{t:`name`,name:e}:void 0}case`ping`:return bi(n.n)&&bi(n.at)?{t:`ping`,n:n.n,at:n.at}:void 0;case`pong`:return bi(n.n)&&bi(n.at)&&bi(n.host)?{t:`pong`,n:n.n,at:n.at,host:n.host}:void 0;case`playback`:return Ci(n.s)?{t:`playback`,s:n.s}:void 0;case`state`:{if(!vi(n.path)||!Si(n.y)||n.s!==void 0&&!Ci(n.s))return;let e=pi(n.grants),t=hi(n.sub),r=hi(n.audio);return{t:`state`,path:n.path,y:n.y,...n.s?{s:n.s}:{},...e?{grants:e}:{},...t===void 0?{}:{sub:t},...r===void 0?{}:{audio:r}}}case`status`:{if(!ti.includes(n.s)||n.path!==void 0&&!yi(n.path))return;let e=xi(n.time)&&typeof n.rate==`number`&&n.rate>=0&&n.rate<=16;return!e&&(n.time!==void 0||n.rate!==void 0)?void 0:{t:`status`,s:n.s,...n.path===void 0?{}:{path:n.path},...e?{time:n.time,rate:n.rate}:{}}}case`ask`:if(n.c===`go`)return yi(n.path)?{t:`ask`,c:`go`,path:n.path}:void 0;if(n.c===`subs`){let e=hi(n.sub);return e===void 0?void 0:{t:`ask`,c:`subs`,sub:e}}if(n.c===`audio`){let e=hi(n.audio);return e===void 0?void 0:{t:`ask`,c:`audio`,audio:e}}return fi(n.c)&&vi(n.path)&&Ci(n.s)?{t:`ask`,c:n.c,path:n.path,s:n.s}:void 0;default:return}},fi=e=>ni.includes(e),pi=e=>{if(!e||typeof e!=`object`)return;let{all:t,by:n}=e;if(!Array.isArray(t)||!n||typeof n!=`object`||Array.isArray(n))return;let r=Object.entries(n);if(r.length>mi)return;let i={all:t.filter(fi),by:{}};for(let[e,t]of r){if(!e||e.length>128||!t||typeof t!=`object`)return;i.by[e]=Object.fromEntries(Object.entries(t).filter(([e,t])=>fi(e)&&typeof t==`boolean`))}return i},mi=100,hi=e=>{if(e===null)return null;if(typeof e!=`string`)return;let t=e.replace(/\s+/g,` `).trim();return t&&t.length<=64?t:void 0},gi=/* @__PURE__ */ new Map,_i=(e,t)=>{gi.has(t)||gi.set(t,[new Intl.DurationFormat(t,{minutes:`numeric`,seconds:`2-digit`}),new Intl.DurationFormat(t,{hours:`numeric`,minutes:`2-digit`,seconds:`2-digit`})]);let[n,r]=gi.get(t),i=Math.floor(e);return i>=3600?r.format({hours:Math.floor(i/3600),minutes:Math.floor(i/60)%60,seconds:i%60}):n.format({minutes:Math.floor(i/60),seconds:i%60})},vi=e=>typeof e==`string`&&e.length>0&&e.length<=2048&&e.startsWith(`/`)&&!e.startsWith(`//`)&&!e.startsWith(`/\\`)&&!/[\r\n\t]/.test(e),yi=e=>vi(e)&&new URL(e,`https://stub.invalid`).pathname.startsWith(`/watch/`),bi=e=>typeof e==`number`&&Number.isFinite(e),xi=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0,Si=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1,Ci=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.paused==`boolean`&&xi(t.time)&&typeof t.rate==`number`&&Number.isFinite(t.rate)&&t.rate>0&&t.rate<=16&&typeof t.at==`number`&&Number.isFinite(t.at)},wi=.5,Ti=5e3,Ei=(e,t,n=!1)=>{if(e.paused)return e.time;let r=Math.max(t-e.at,0),i=(n?r:Math.min(r,Di))/1e3;return e.time+i*e.rate},Di=2e3,Oi=(e,t,n,r=!1)=>{let i={},a=Ei(t,n,r);return Math.abs(a-e.time)>.5&&(i.seek=a),t.paused&&!e.paused&&(i.pause=!0),!t.paused&&e.paused&&(i.play=!0),Mi(e.rate,t.rate)||(i.rate=t.rate),i},ki=.05,Ai=e=>{let t=[...e].sort((e,t)=>e-t),n=t.length>>1;return t.length%2?t[n]:(t[n-1]+t[n])/2},ji=(e,t,n,r,i=!1)=>{let a=Ei(n,r,!0),o=(a-t.time)/n.rate,s=wi*n.rate,c={...n,time:a,at:r},l=i||!e||e.heard.paused!==n.paused||Math.abs(Ei(e.heard,r,!0)-a)>s||t.time<e.played.time-ki||t.time>Ei(e.played,r,!0)+s,u=Oi(t,n,r,!0);Math.abs(o)<=(l?.5:t.seeking?1/0:3)&&delete u.seek;let d=!l&&u.seek!==void 0&&e?.seek?Math.max(0,o+e.seek.aim):0;u.seek!==void 0&&(u.seek+=d*n.rate);let f;if(!e||l||!Mi(e.heard.rate,n.rate)||t.paused||t.seeking||u.seek!==void 0)f={heard:c,drifts:[]};else if(e.catchUp&&r<e.catchUp.until)f={...e,heard:c};else{let t=[...e.drifts,o].slice(-5),i=t.length===5?Ai(t):0;if(Math.abs(i)>.4){let e=Math.min(Math.abs(i)/10,.050000000000000044),t=n.rate*(i>0?1+e:1/(1+e));f={heard:c,drifts:[],catchUp:{rate:t,until:r+Math.abs(i*n.rate/(t-n.rate))*1e3}}}else f={heard:c,drifts:t}}let p=f.catchUp?.rate??n.rate;Mi(t.rate,p)?delete u.rate:u.rate=p;let m={paused:u.pause??(t.paused&&!u.play),time:u.seek??t.time,rate:p,at:r},h=u.seek===void 0?t.seeking?e?.seek:void 0:{aim:d};return{correction:u,follow:{...f,played:m,seek:h}}},Mi=(e,t)=>Math.abs(e-t)<=.001,Ni=(e,t)=>e<=t*1.05+.001&&e>=t/1.05-.001,Pi=(e,t,n)=>({...e,time:e.paused?e.time:e.time+Math.max(0,n-t)/1e3*e.rate,at:n}),Fi=2e3,Ii=3e3,Li=(e,t,n)=>{let r=[];return t.paused!==e.paused&&t.paused!==n.paused&&r.push(`play`),(t.time<e.time-ki||t.time>Ei(e,t.at,!0)+.5)&&Math.abs(t.time-n.time)>.5&&r.push(`seek`),!Ni(t.rate,e.rate)&&!Ni(t.rate,n.rate)&&r.push(`rate`),r},Ri=(e,t,n)=>{let r=Pi(e,e.at,n);if(t.c===`play`)return e.paused===t.s.paused?void 0:{...r,paused:t.s.paused};if(t.c===`rate`)return Mi(e.rate,t.s.rate)?void 0:{...r,rate:t.s.rate};let i=Ei(t.s,n);return Math.abs(i-r.time)<=.5?void 0:{...r,time:i}},zi=1e3,Bi=1,Vi=(e,t)=>{let n=e.find(([e,n])=>e-.5<=t&&t<n);return n?n[1]-t:0},Hi=(e,t,n,r=0)=>{if(!t||t.readyState<3)return`loading`;let i=e===`ready`?2:10,a=r>0&&Number.isFinite(r)?r-n:1/0;return Vi(t.ranges,n)>=Math.min(i,a)?`ready`:`loading`},Ui=(e,t)=>e.time===void 0?void 0:e.time+Math.max(0,t)/1e3*(e.rate??0),Wi=(e,t,n)=>{if(e.s!==t.s||e.path!==t.path||!e.rate!=!t.rate)return!0;let r=Ui(e,n);return r===void 0||t.time===void 0?r!==t.time:Math.abs(r-t.time)>Bi},Gi=(e,t,n)=>{if(e.path!==n)return{s:e.s===`away`?`away`:`loading`};let r=Ui(e,t);return r===void 0?{s:e.s}:{s:e.s,time:r}},Ki=(e,t,n)=>({rtt:n-e,offset:t-(e+n)/2}),qi=e=>e.length?e.reduce((e,t)=>t.rtt<e.rtt?t:e):void 0,Ji=(e,t)=>e-t,Yi=(e,t)=>e+t,Xi=4e3,Zi=`stub-party-invite`,Qi=`stub-party-name`,$i=1e4,ea=3e4,ta=2e3,na=1e4,ra=6e4,ia={subtitles:`party`,audio:`party`},aa=()=>{try{return globalThis.sessionStorage}catch{return}},oa=e=>e instanceof Error&&typeof e.code==`string`,sa=(e,t=aa())=>{let n={status:`idle`},r,i,a={path:`/`,y:0},o=/* @__PURE__ */ new Set,s=/* @__PURE__ */ new Set,c,l,u=/* @__PURE__ */ new Map,d=/* @__PURE__ */ new Map,f=[],p,m=ii,h=!0,g={},_={},v=ia,y,b,x,S,C=/* @__PURE__ */ new Map,w=1,T,E,D,O,k=/* @__PURE__ */ new Map,A=(()=>{try{return t?.getItem(`stub-party-name`)??void 0}catch{return}})(),j=e=>{n=e;for(let e of o)e(n)},M=e=>{try{t?.setItem(Zi,e)}catch{}},N=()=>{try{t?.removeItem(Zi)}catch{}},P=()=>{try{return t?.getItem(`stub-party-invite`)??void 0}catch{return}},ee=e=>e.owner===e.self.id?`host`:`guest`,te=(e,t)=>{for(let n of s)n(e,t)},F=async e=>{let t=await e.members().catch(()=>void 0);r===e&&n.status===`active`&&t&&j({...n,members:t.length})},ne=e=>{r&&n.status===`active`&&(si(e)&&n.role!==`host`||r.send(ui(e)).catch(()=>{}))},I=()=>{if(!r||n.status!==`active`||n.role!==`guest`)return;let e=r,t=[];x=t;for(let n=0;n<5;n++)setTimeout(()=>{if(x!==t||r!==e)return;let n=Date.now(),i=w++;C.set(i,n),setTimeout(()=>C.delete(i),Xi),ne({t:`ping`,n:i,at:n})},n*400);setTimeout(()=>{if(x!==t||r!==e)return;x=void 0;let n=qi(t);n&&(b=n)},2e3+Xi)},re=()=>({t:`state`,path:a.path,y:a.y,...a.playback?{s:Pi(a.playback,a.playbackAt??Date.now(),Date.now())}:{},...p?{grants:p}:{},...g.subtitles===void 0?{}:{sub:g.subtitles},...g.audio===void 0?{}:{audio:g.audio}}),ie=({grants:e=ii,sub:t,audio:r})=>{let i={subtitles:t,audio:r};JSON.stringify([e,i])!==JSON.stringify([m,_])&&(m=e,_=i,n.status===`active`&&j({...n}))},ae=(e,t)=>{g={...g,[e]:t},ne(re())},oe=()=>{if(D=void 0,!T)return;let e=Date.now(),t=Ui(T.status,e-T.at);E={status:t===void 0?T.status:{...T.status,time:t},at:e},ne({t:`status`,...E.status})},se=e=>{if(!T||D||!e&&E&&!Wi(E.status,T.status,T.at-E.at))return;let t=(E?.at??-1/0)+ta-Date.now();t<=0?oe():D=setTimeout(oe,t)},ce=()=>[...u.values()].filter(e=>`path`in e).at(-1)?.path,le=()=>{let e=u.get(`state`),t=u.get(`scroll`);if(e?.t!==`state`||t?.t!==`scroll`)return e;let n=[...u.keys()];return n.indexOf(`scroll`)>n.indexOf(`state`)?{...e,y:t.y}:e},ue=()=>{i?.(),i=void 0,r=void 0,c&&clearInterval(c),c=void 0,l&&clearInterval(l),l=void 0,S&&clearInterval(S),S=void 0,clearTimeout(D),D=void 0,clearInterval(O),O=void 0,T=void 0,E=void 0,k.clear(),x=void 0,b=void 0,C.clear(),v=ia},de=async e=>{r=e;let t=ee(e);d.clear(),f.length=0,p=void 0,m=ii,h=!0,g={},_={},j({status:`active`,role:t,invite:e.invite,members:1,self:e.self.id,owner:e.owner}),M(e.invite),i=await e.on(i=>{if(r===e)switch(i.type){case`message`:{let n=di(i.message.text);if(!n)return;let r=i.message.from,a=r===e.self.id;if(n.t===`ping`){t===`host`&&!a&&ne({t:`pong`,n:n.n,at:n.at,host:Date.now()});return}if(n.t===`pong`){if(t!==`guest`||r!==e.owner)return;let i=C.get(n.n);if(i===void 0||i!==n.at)return;C.delete(n.n);let a=Ki(i,n.host,Date.now());if(a.rtt>4e3)return;x?.push(a),b||=a;return}if(si(n)){if(r!==e.owner||(n.t===`state`&&ie(n),t===`host`))return;u.delete(n.t),u.set(n.t,n),te(n,{replayed:!1,from:r,self:a});return}if(n.t===`ask`){if(!ai(m,r,n.c))return;let e=f.at(-1);e?.from===r&&e.ask?.c===n.c&&f.pop(),t===`host`&&n.c===`subs`&&ae(`subtitles`,n.sub),t===`host`&&n.c===`audio`&&ae(`audio`,n.audio)}if(n.t===`name`&&d.set(r,n.name),n.t===`status`&&t===`host`&&!a){let{t:e,...t}=n;k.set(r,{status:t,at:Date.now()})}if(n.t===`chat`||n.t===`ask`){let e=n.t===`chat`?{text:n.text}:{ask:n};f.push({seq:i.message.seq,from:r,name:d.get(r),at:i.message.at,self:a,...e}),f.length>200&&f.splice(0,f.length-200)}te(n,{replayed:!1,from:r,self:a});return}case`joined`:t===`host`&&ne(re()),A&&ne({t:`name`,name:A}),F(e);return;case`left`:{if(t===`guest`&&i.id===e.owner){pe(`host-left`);return}k.delete(i.id);let r=p?.by[i.id];t===`host`&&p&&r&&!Object.values(r).includes(!1)&&(p={...p,by:Object.fromEntries(Object.entries(p.by).filter(([e])=>e!==i.id))},ne(re()),j({...n})),F(e);return}}}),r===e?(t===`host`&&(c=setInterval(()=>ne(re()),$i)),t===`guest`&&(I(),S=setInterval(I,ra),T={status:{s:`away`},at:Date.now()},O=setInterval(()=>{yi(ce())&&se(!0)},na)),l=setInterval(()=>{A&&ne({t:`name`,name:A})},ea),A&&ne({t:`name`,name:A}),F(e),e.closed.then(({reason:t})=>{r===e&&(ue(),N(),j({status:`ended`,reason:t}))})):(i(),i=void 0)},fe=e=>n.status===`active`&&(n.role===`host`||ai(m,n.self,e)),pe=async e=>{let t=r;ue(),N(),j({status:`ended`,reason:e}),await t?.leave().catch(()=>{})},me=(e,t)=>{N(),j(t?{status:`idle`}:{status:`failed`,code:oa(e)?e.code:`unknown`})},he=async(e,t,n=!1)=>{r&&await pe(`left`),u.clear(),j({status:`joining`,invite:e??``});try{let e=await t();await de(e)}catch(e){me(e,n)}};return{getState:()=>n,subscribe:e=>(o.add(e),()=>{o.delete(e)}),onMessage:e=>(s.add(e),()=>{s.delete(e)}),create:()=>he(void 0,()=>e.create()),join:t=>he(t,()=>e.join(t)),resume:async()=>{let t=P();t&&!r&&await he(t,()=>e.join(t),!0)},leave:async()=>{r&&await pe(`left`)},send:ne,setLocation:(e,t)=>{a.path=e,a.y=t},setPlayback:e=>{a.playback=e,a.playbackAt=Date.now()},issued:()=>p??ii,setGrants:e=>{n.status===`active`&&n.role===`host`&&(p=e,ne(re()),j({...n}))},may:fe,partyTrack:e=>_[e],setPartyTrack:(e,t)=>{n.status===`active`&&(n.role===`host`?ae(e,t):fe(ri[e])&&ne(e===`subtitles`?{t:`ask`,c:`subs`,sub:t}:{t:`ask`,c:`audio`,audio:t}))},mine:e=>v[e],setMine:(e,t)=>{v={...v,[e]:t},j({...n})},playerTracks:()=>y,setPlayerTracks:e=>{y=e,j({...n})},invite:()=>n.status===`active`?n.invite:void 0,hostClock:()=>b,hostPath:ce,following:()=>h,setFollowing:e=>{h=e,j({...n})},replay:()=>{for(let e of[`state`,`nav`,`scroll`,`playback`]){let t=e===`state`?le():u.get(e);t&&r&&te(t,{replayed:!0,from:r.owner,self:!1})}h||(h=!0,j({...n}))},nameOf:e=>d.get(e),roster:async()=>{if(!r)return[];let e=r;return(await e.members().catch(()=>[])).map(t=>({id:t.id,name:d.get(t.id),host:t.id===e.owner,self:t.id===e.self.id}))},chat:()=>f.slice(),setName:e=>{A=e;try{e?t?.setItem(Qi,e):t?.removeItem(Qi)}catch{}e&&ne({t:`name`,name:e})},name:()=>A,kick:async e=>{r&&n.status===`active`&&n.role===`host`&&await r.remove(e)},ban:async e=>{r&&n.status===`active`&&n.role===`host`&&await r.block(e)},playing:()=>!(!a.playback||a.playback.paused),setStatus:e=>{n.status===`active`&&n.role===`guest`&&(T={status:e,at:Date.now()},se(!1))},statuses:()=>k,dismiss:()=>{(n.status===`ended`||n.status===`failed`)&&j({status:`idle`})}}},ca=`/party`,la=(e,t)=>`${e}${ca}#${da(e,t)}`,ua=(e,t)=>{let n=e.startsWith(`#`)?e.slice(1):e,r;try{r=decodeURIComponent(n).trim()}catch{return}if(ma.test(r))return r;if(!ha.test(r))return;let i=r.indexOf(`.`),a=`${r.slice(0,i)}.${t}/${r.slice(i+1)}`;return ma.test(a)?a:void 0},da=(e,t)=>{let n=t.indexOf(`.`),r=t.slice(n+1),i=r.lastIndexOf(`/`);return i>0&&r.slice(0,i)===e?`${t.slice(0,n)}.${r.slice(i+1)}`:t},fa=`[A-Za-z0-9_-]{43}`,pa=`[a-z0-9][a-z0-9._-]{0,63}`,ma=RegExp(`^${fa}\\.[\\x21-\\x7e]{1,256}\\/${pa}$`),ha=RegExp(`^${fa}\\.${pa}$`),Y=sa(O),ga=/^(anime|movies|series|stub)\.(fkn\.app|localhost)$/,_a=e=>{let t=e.match(ga)?.[1];return t===`movies`?`movie`:t??`stub`},va=e=>ga.test(e),ya=_a(globalThis.location?.hostname??``),ba=[{site:`movie`,host:`movies`},{site:`series`,host:`series`},{site:`anime`,host:`anime`},{site:`stub`,host:`stub`}],xa=globalThis.location?(({protocol:e,hostname:t,port:n})=>{let r=t.match(ga)?.[2];return r?ba.map(({site:t,host:i})=>({site:t,href:`${e}//${i}.${r}${n?`:${n}`:``}/`})):[]})(globalThis.location):[],Sa=[`anilist`,`mal`,`kitsu`,`livechart`,`anizip`,`offline`,`cr`],Ca=(e,t=ya)=>t!==`movie`&&t!==`series`||!Sa.includes(e),wa=/^\/assets\//,Ta=e=>[...new Set([...e.querySelectorAll(`script[src], link[href]`)].map(e=>e.getAttribute(`src`)??e.getAttribute(`href`)??``).filter(e=>wa.test(e)))].sort(),Ea=e=>e.ok&&/javascript|css/.test(e.headers.get(`content-type`)??``),Da=async e=>{let t=await fetch(`/`,{cache:`no-store`}),n=Ta(new DOMParser().parseFromString(await t.text(),`text/html`)).filter(t=>!e.includes(t));return n.length!==0&&(await Promise.all(n.map(async e=>{let t=await fetch(e);return await t.arrayBuffer(),Ea(t)}))).every(Boolean)},Oa=9e5,ka=e=>{let t=!1,n=!1,r=async()=>{if(!(t||n)){t=!0;try{n=await Da(Ta(document))}catch{}t=!1,n&&(clearInterval(i),e())}},i=setInterval(r,Oa);document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&r()}),window.addEventListener(`vite:preloadError`,()=>{r()})},Aa={categoryBar:1,hoverCard:150,filterMenu:500,mediaModal:1e3,header:1100,headerPopup:1150,franchiseDialog:1200,pluginNotice:2e3,sourcePopup:2200,updating:2500,partyCursor:3e3},ja=`stub-update-reloads`,Ma=2,Na=3e5,Pa=1e3,Fa=`textarea:not([readonly]), input:not([type=checkbox]):not([type=radio]):not([readonly]), [contenteditable]:not([contenteditable=false])`,Ia=()=>{try{let e=Date.now(),t=JSON.parse(sessionStorage.getItem(`stub-update-reloads`)??`[]`).filter(t=>e-t<Na);return t.length>=Ma?!1:(sessionStorage.setItem(ja,JSON.stringify([...t,e])),!0)}catch{return!1}},La=/* @__PURE__ */ new Set,Ra=e=>{La.add(e)},za=e=>{let{status:t}=e.getState();return![...La].some(e=>e())&&navigator.onLine&&!location.pathname.startsWith(`/watch/`)&&t!==`joining`&&t!==`active`&&!document.activeElement?.matches(Fa)&&![...document.querySelectorAll(`video`)].some(e=>!e.paused&&!e.ended)},Ba=()=>{let e=document.createElement(`div`);e.textContent=J.formatMessage({id:`Updating Stub`,defaultMessage:`Updating Stub`}),e.style.cssText=`position: fixed; inset: 0; z-index: ${Aa.updating}; display: flex; align-items: center; justify-content: center; background: #0f0f0f; color: #fff; font-size: 2rem`,document.body.append(e)},Va=(({party:e})=>{let t,n=!1,r=()=>{!n&&za(e)&&Ia()&&(n=!0,Ba(),location.reload())};return{due:()=>{t??=setInterval(r,Pa),r()}}})({party:Y});ue.onUpdateTaken(Va.due),va(location.hostname)&&ka(Va.due),Qe();var Ha={NAME:`Name`,DOCUMENT:`Document`,OPERATION_DEFINITION:`OperationDefinition`,VARIABLE_DEFINITION:`VariableDefinition`,SELECTION_SET:`SelectionSet`,FIELD:`Field`,ARGUMENT:`Argument`,FRAGMENT_SPREAD:`FragmentSpread`,INLINE_FRAGMENT:`InlineFragment`,FRAGMENT_DEFINITION:`FragmentDefinition`,VARIABLE:`Variable`,INT:`IntValue`,FLOAT:`FloatValue`,STRING:`StringValue`,BOOLEAN:`BooleanValue`,NULL:`NullValue`,ENUM:`EnumValue`,LIST:`ListValue`,OBJECT:`ObjectValue`,OBJECT_FIELD:`ObjectField`,DIRECTIVE:`Directive`,NAMED_TYPE:`NamedType`,LIST_TYPE:`ListType`,NON_NULL_TYPE:`NonNullType`},Ua=class extends Error{constructor(e,t,n,r,i,a,o){super(e),this.name=`GraphQLError`,this.message=e,i&&(this.path=i),t&&(this.nodes=Array.isArray(t)?t:[t]),n&&(this.source=n),r&&(this.positions=r),a&&(this.originalError=a);var s=o;if(!s&&a){var c=a.extensions;c&&typeof c==`object`&&(s=c)}this.extensions=s||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return`GraphQLError`}},X,Z;function Wa(e){return new Ua(`Syntax Error: Unexpected token at ${Z} in ${e}`)}function Ga(e){if(e.lastIndex=Z,e.test(X))return X.slice(Z,Z=e.lastIndex)}var Ka=/ +(?=[^\s])/y;function qa(e){for(var t=e.split(`
3
3
  `),n=``,r=0,i=0,a=t.length-1,o=0;o<t.length;o++)Ka.lastIndex=0,Ka.test(t[o])&&(o&&(!r||Ka.lastIndex<r)&&(r=Ka.lastIndex),i||=o,a=o);for(var s=i;s<=a;s++)s!==i&&(n+=`
4
4
  `),n+=t[s].slice(r).replace(/\\"""/g,`"""`);return n}function Ja(){for(var e=0|X.charCodeAt(Z++);e===9||e===10||e===13||e===32||e===35||e===44||e===65279;e=0|X.charCodeAt(Z++))if(e===35)for(;(e=0|X.charCodeAt(Z++))&&e!==10&&e!==13;);Z--}function Ya(){for(var e=Z,t=0|X.charCodeAt(Z++);t>=48&&t<=57||t>=65&&t<=90||t===95||t>=97&&t<=122;t=0|X.charCodeAt(Z++));if(e===Z-1)throw Wa(`Name`);var n=X.slice(e,--Z);return Ja(),n}function Xa(){return{kind:`Name`,value:Ya()}}var Za=/(?:"""|(?:[\s\S]*?[^\\])""")/y,Qa=/(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;function $a(e){var t;switch(X.charCodeAt(Z)){case 91:Z++,Ja();for(var n=[];X.charCodeAt(Z)!==93;)n.push($a(e));return Z++,Ja(),{kind:`ListValue`,values:n};case 123:Z++,Ja();for(var r=[];X.charCodeAt(Z)!==125;){var i=Xa();if(X.charCodeAt(Z++)!==58)throw Wa(`ObjectField`);Ja(),r.push({kind:`ObjectField`,name:i,value:$a(e)})}return Z++,Ja(),{kind:`ObjectValue`,fields:r};case 36:if(e)throw Wa(`Variable`);return Z++,{kind:`Variable`,name:Xa()};case 34:if(X.charCodeAt(Z+1)===34&&X.charCodeAt(Z+2)===34){if(Z+=3,(t=Ga(Za))==null)throw Wa(`StringValue`);return Ja(),{kind:`StringValue`,value:qa(t.slice(0,-3)),block:!0}}var a=Z,o;Z++;var s=!1;for(o=0|X.charCodeAt(Z++);o===92&&(Z++,s=!0)||o!==10&&o!==13&&o!==34&&o;o=0|X.charCodeAt(Z++));if(o!==34)throw Wa(`StringValue`);return t=X.slice(a,Z),Ja(),{kind:`StringValue`,value:s?JSON.parse(t):t.slice(1,-1),block:!1};case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:for(var c=Z++,l;(l=0|X.charCodeAt(Z++))>=48&&l<=57;);var u=X.slice(c,--Z);if((l=X.charCodeAt(Z))===46||l===69||l===101){if((t=Ga(Qa))==null)throw Wa(`FloatValue`);return Ja(),{kind:`FloatValue`,value:u+t}}return Ja(),{kind:`IntValue`,value:u};case 110:if(X.charCodeAt(Z+1)===117&&X.charCodeAt(Z+2)===108&&X.charCodeAt(Z+3)===108)return Z+=4,Ja(),{kind:`NullValue`};break;case 116:if(X.charCodeAt(Z+1)===114&&X.charCodeAt(Z+2)===117&&X.charCodeAt(Z+3)===101)return Z+=4,Ja(),{kind:`BooleanValue`,value:!0};break;case 102:if(X.charCodeAt(Z+1)===97&&X.charCodeAt(Z+2)===108&&X.charCodeAt(Z+3)===115&&X.charCodeAt(Z+4)===101)return Z+=5,Ja(),{kind:`BooleanValue`,value:!1}}return{kind:`EnumValue`,value:Ya()}}function eo(e){if(X.charCodeAt(Z)===40){var t=[];Z++,Ja();do{var n=Xa();if(X.charCodeAt(Z++)!==58)throw Wa(`Argument`);Ja(),t.push({kind:`Argument`,name:n,value:$a(e)})}while(X.charCodeAt(Z)!==41);return Z++,Ja(),t}}function to(e){if(X.charCodeAt(Z)===64){var t=[];do Z++,t.push({kind:`Directive`,name:Xa(),arguments:eo(e)});while(X.charCodeAt(Z)===64);return t}}function no(){for(var e=0;X.charCodeAt(Z)===91;)e++,Z++,Ja();var t={kind:`NamedType`,name:Xa()};do if(X.charCodeAt(Z)===33&&(Z++,Ja(),t={kind:`NonNullType`,type:t}),e){if(X.charCodeAt(Z++)!==93)throw Wa(`NamedType`);Ja(),t={kind:`ListType`,type:t}}while(e--);return t}function ro(){if(X.charCodeAt(Z++)!==123)throw Wa(`SelectionSet`);return Ja(),io()}function io(){var e=[];do if(X.charCodeAt(Z)===46){if(X.charCodeAt(++Z)!==46||X.charCodeAt(++Z)!==46)throw Wa(`SelectionSet`);switch(Z++,Ja(),X.charCodeAt(Z)){case 64:e.push({kind:`InlineFragment`,typeCondition:void 0,directives:to(!1),selectionSet:ro()});break;case 111:X.charCodeAt(Z+1)===110?(Z+=2,Ja(),e.push({kind:`InlineFragment`,typeCondition:{kind:`NamedType`,name:Xa()},directives:to(!1),selectionSet:ro()})):e.push({kind:`FragmentSpread`,name:Xa(),directives:to(!1)});break;case 123:Z++,Ja(),e.push({kind:`InlineFragment`,typeCondition:void 0,directives:void 0,selectionSet:io()});break;default:e.push({kind:`FragmentSpread`,name:Xa(),directives:to(!1)})}}else{var t=Xa(),n=void 0;X.charCodeAt(Z)===58&&(Z++,Ja(),n=t,t=Xa());var r=eo(!1),i=to(!1),a=void 0;X.charCodeAt(Z)===123&&(Z++,Ja(),a=io()),e.push({kind:`Field`,alias:n,name:t,arguments:r,directives:i,selectionSet:a})}while(X.charCodeAt(Z)!==125);return Z++,Ja(),{kind:`SelectionSet`,selections:e}}function ao(){if(Ja(),X.charCodeAt(Z)===40){var e=[];Z++,Ja();do{var t=void 0;if(X.charCodeAt(Z)===34&&(t=$a(!0)),X.charCodeAt(Z++)!==36)throw Wa(`Variable`);var n=Xa();if(X.charCodeAt(Z++)!==58)throw Wa(`VariableDefinition`);Ja();var r=no(),i=void 0;X.charCodeAt(Z)===61&&(Z++,Ja(),i=$a(!0)),Ja();var a={kind:`VariableDefinition`,variable:{kind:`Variable`,name:n},type:r,defaultValue:i,directives:to(!0)};t&&(a.description=t),e.push(a)}while(X.charCodeAt(Z)!==41);return Z++,Ja(),e}}function oo(e){var t=Xa();if(X.charCodeAt(Z++)!==111||X.charCodeAt(Z++)!==110)throw Wa(`FragmentDefinition`);Ja();var n={kind:`FragmentDefinition`,name:t,typeCondition:{kind:`NamedType`,name:Xa()},directives:to(!1),selectionSet:ro()};return e&&(n.description=e),n}function so(){var e=[];do{var t=void 0;if(X.charCodeAt(Z)===34&&(t=$a(!0)),X.charCodeAt(Z)===123){if(t)throw Wa(`Document`);Z++,Ja(),e.push({kind:`OperationDefinition`,operation:`query`,name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:io()})}else{var n=Ya();switch(n){case`fragment`:e.push(oo(t));break;case`query`:case`mutation`:case`subscription`:var r,i=void 0;(r=X.charCodeAt(Z))!==40&&r!==64&&r!==123&&(i=Xa());var a={kind:`OperationDefinition`,operation:n,name:i,variableDefinitions:ao(),directives:to(!1),selectionSet:ro()};t&&(a.description=t),e.push(a);break;default:throw Wa(`Document`)}}}while(Z<X.length);return e}function co(e,t){return X=e.body?e.body:e,Z=0,Ja(),t&&t.noLocation?{kind:`Document`,definitions:so()}:{kind:`Document`,definitions:so(),loc:{start:0,end:X.length,startToken:void 0,endToken:void 0,source:{body:X,name:`graphql.web`,locationOffset:{line:1,column:1}}}}}function lo(e,t,n){for(var r=``,i=0;i<e.length;i++)i&&(r+=t),r+=n(e[i]);return r}function uo(e){return JSON.stringify(e)}function fo(e){return`"""
5
5
  `+e.replace(/"""/g,`\\"""`)+`
@@ -1004,7 +1004,7 @@ https://bit.ly/2XbVrpR#`;function up(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
1004
1004
  gap: 1.2rem;
1005
1005
  padding: 2rem 1.5rem;
1006
1006
  }
1007
- `,jC=`stub`,MC=()=>{let e=L(),[t]=Rh(ig(Q.WATCH)),[n]=Rh(ig(Q.LOGIN_CALLBACK));return t||n?null:/* @__PURE__ */ W(`footer`,{css:AC,children:[/* @__PURE__ */ V(Uh,{to:ag(Q.HOME),className:`wordmark`,onClick:wS,children:jC}),/* @__PURE__ */ V(Uh,{to:ag(Q.LEGAL),className:`nav-link`,children:e.formatMessage({id:`Legal`,defaultMessage:`Legal`})}),/* @__PURE__ */ V(Uh,{to:ag(Q.PRIVACY),className:`nav-link`,children:e.formatMessage({id:`Privacy`,defaultMessage:`Privacy`})}),/* @__PURE__ */ W(`span`,{className:`version`,title:e.formatMessage({id:`stub v{version}, commit {commit}`,defaultMessage:`stub v{version}, commit {commit}`},{version:`0.0.87`,commit:`f169700`}),children:[`v0.0.87`,` `,/* @__PURE__ */ V(`span`,{className:`commit`,children:`f169700`})]})]})};U();var NC=(e,{uri:t,sources:n=[]})=>n.length?e.formatList(n.map(e=>e.name),Cn):t.replace(/^npm:/,``),PC=()=>{let[e,t]=K(wu);return H(()=>{let e=()=>t(wu());return e(),xu(e)},[]),e};U();var FC=R`
1007
+ `,jC=`stub`,MC=()=>{let e=L(),[t]=Rh(ig(Q.WATCH)),[n]=Rh(ig(Q.LOGIN_CALLBACK));return t||n?null:/* @__PURE__ */ W(`footer`,{css:AC,children:[/* @__PURE__ */ V(Uh,{to:ag(Q.HOME),className:`wordmark`,onClick:wS,children:jC}),/* @__PURE__ */ V(Uh,{to:ag(Q.LEGAL),className:`nav-link`,children:e.formatMessage({id:`Legal`,defaultMessage:`Legal`})}),/* @__PURE__ */ V(Uh,{to:ag(Q.PRIVACY),className:`nav-link`,children:e.formatMessage({id:`Privacy`,defaultMessage:`Privacy`})}),/* @__PURE__ */ W(`span`,{className:`version`,title:e.formatMessage({id:`stub v{version}, commit {commit}`,defaultMessage:`stub v{version}, commit {commit}`},{version:`0.0.89`,commit:`18dc5b4`}),children:[`v0.0.89`,` `,/* @__PURE__ */ V(`span`,{className:`commit`,children:`18dc5b4`})]})]})};U();var NC=(e,{uri:t,sources:n=[]})=>n.length?e.formatList(n.map(e=>e.name),Cn):t.replace(/^npm:/,``),PC=()=>{let[e,t]=K(wu);return H(()=>{let e=()=>t(wu());return e(),xu(e)},[]),e};U();var FC=R`
1008
1008
  --notice-top: calc(var(--fkn-inset-top, 0px) + var(--stub-header-height) + 1.6rem);
1009
1009
  position: fixed;
1010
1010
  top: var(--notice-top);
@@ -1256,7 +1256,7 @@ max-height: 100%;
1256
1256
 
1257
1257
  & > * { height: 1em; }
1258
1258
  & > :last-child { width: 60%; }
1259
- `,rw=({className:e})=>/* @__PURE__ */ V(`span`,{css:tw,className:e,"aria-hidden":`true`}),iw=({count:e,className:t})=>/* @__PURE__ */ V(`span`,{css:nw,className:t,"aria-hidden":`true`,children:Array.from({length:e},(e,t)=>/* @__PURE__ */ V(rw,{},t))}),aw=e=>e._id??e.uri??``,ow=(e,t,n)=>{let r=t.handles?.filter(e=>e.relation===`SAME_AS`).map(e=>e.node.uri)??[];return!!e.handles?.some(e=>e.relation===n&&r.includes(e.node.uri))},sw=(e,t)=>aw(e)===aw(t)||ow(e,t,`SAME_AS`),cw=(e,t)=>ow(e,t,`PART_OF`),lw=e=>{let t=e.filter(e=>e.titles?.length&&e.shortDescriptions?.length),n=t.filter(e=>e.trailers?.length);return n.length?n:t},uw=.07,dw=e=>!!e?.saveData||[`slow-2g`,`2g`].includes(e?.effectiveType??``)||!!e?.downlink&&e.downlink<=uw,fw=1e4,pw=.3,mw=e=>(e.shortDescriptions?.[0]?.score??0)>pw,hw=5e3,gw=(e,t,n=e=>Math.floor(Math.random()*e))=>{if(t){let n=e.find(e=>sw(e,t));if(n)return mw(t)?t:n;if(e.some(e=>cw(e,t)))return t}let r=e.slice(0,10);return r.length?r[Math.min(r.length-1,Math.max(0,n(r.length)))]:t};U();var _w=/* @__PURE__ */ new Map,vw=/* @__PURE__ */ new Map,yw=3e4,bw=e=>{let t=_w.get(e);if(t)return t;let n=new Promise(t=>{let n=new Image;n.onload=()=>{vw.set(e,{width:n.naturalWidth,height:n.naturalHeight}),t(!0)},n.onerror=()=>{setTimeout(()=>_w.delete(e),yw),t(!1)},n.src=e});return _w.set(e,n),n},xw=(e,t)=>{let n=vw.get(e);return n?Math.min(n.width/t.width,n.height/t.height):0},Sw=(e,t,n)=>xw(e,n)>=(globalThis.devicePixelRatio||1)||xw(t,n)<1.25*xw(e,n),Cw=e=>[...e?.banners??[],...e?.covers??[]],ww=(e,t,{standIn:n=!1,box:r}={})=>{let i=(e??[]).map(e=>e?.url).filter(e=>!!e),a=i.join(`|`),[o,s]=K({owner:t}),c=e=>!!t&&!!e&&sw(t,e),l=e=>c(e)||n&&!!t&&!!e&&cw(t,e),u=(l(o.owner)?o.url:void 0)??i.find(e=>vw.has(e))??i[0];return H(()=>{let e=!1;return s(e=>l(e.owner)?{...e,url:e.url??u}:{owner:t,url:u}),(async()=>{for(let n of i){let i=await bw(n);if(e)return;if(i){s(e=>({owner:t,url:r&&e.url&&c(e.owner)&&Sw(e.url,n,r)?e.url:n}));return}}})(),()=>{e=!0}},[a,t&&aw(t)]),u},Tw=R`
1259
+ `,rw=({className:e})=>/* @__PURE__ */ V(`span`,{css:tw,className:e,"aria-hidden":`true`}),iw=({count:e,className:t})=>/* @__PURE__ */ V(`span`,{css:nw,className:t,"aria-hidden":`true`,children:Array.from({length:e},(e,t)=>/* @__PURE__ */ V(rw,{},t))}),aw=e=>e._id??e.uri??``,ow=(e,t,n)=>{let r=t.handles?.filter(e=>e.relation===`SAME_AS`).map(e=>e.node.uri)??[];return!!e.handles?.some(e=>e.relation===n&&r.includes(e.node.uri))},sw=(e,t)=>aw(e)===aw(t)||ow(e,t,`SAME_AS`),cw=(e,t)=>ow(e,t,`PART_OF`),lw=e=>{let t=e.filter(e=>e.titles?.length&&e.shortDescriptions?.length),n=t.filter(e=>e.trailers?.length);return n.length?n:t},uw=.07,dw=e=>!!e?.saveData||[`slow-2g`,`2g`].includes(e?.effectiveType??``)||!!e?.downlink&&e.downlink<=uw,fw=1e4,pw=.3,mw=e=>(e.shortDescriptions?.[0]?.score??0)>pw,hw=5e3,gw=(e,t,n=e=>Math.floor(Math.random()*e),r=e)=>{if(t){let n=e.find(e=>sw(e,t));if(n)return mw(t)?t:n;if(r.some(e=>sw(e,t)||cw(e,t))&&(t.trailers?.length||!e.some(e=>e.trailers?.length)))return t}let i=e.slice(0,10);return i.length?i[Math.min(i.length-1,Math.max(0,n(i.length)))]:t};U();var _w=/* @__PURE__ */ new Map,vw=/* @__PURE__ */ new Map,yw=3e4,bw=e=>{let t=_w.get(e);if(t)return t;let n=new Promise(t=>{let n=new Image;n.onload=()=>{vw.set(e,{width:n.naturalWidth,height:n.naturalHeight}),t(!0)},n.onerror=()=>{setTimeout(()=>_w.delete(e),yw),t(!1)},n.src=e});return _w.set(e,n),n},xw=(e,t)=>{let n=vw.get(e);return n?Math.min(n.width/t.width,n.height/t.height):0},Sw=(e,t,n)=>xw(e,n)>=(globalThis.devicePixelRatio||1)||xw(t,n)<1.25*xw(e,n),Cw=e=>[...e?.banners??[],...e?.covers??[]],ww=(e,t,{standIn:n=!1,box:r}={})=>{let i=(e??[]).map(e=>e?.url).filter(e=>!!e),a=i.join(`|`),[o,s]=K({owner:t}),c=e=>!!t&&!!e&&sw(t,e),l=e=>c(e)||n&&!!t&&!!e&&cw(t,e),u=(l(o.owner)?o.url:void 0)??i.find(e=>vw.has(e))??i[0];return H(()=>{let e=!1;return s(e=>l(e.owner)?{...e,url:e.url??u}:{owner:t,url:u}),(async()=>{for(let n of i){let i=await bw(n);if(e)return;if(i){s(e=>({owner:t,url:r&&e.url&&c(e.owner)&&Sw(e.url,n,r)?e.url:n}));return}}})(),()=>{e=!0}},[a,t&&aw(t)]),u},Tw=R`
1260
1260
  & > h2 {
1261
1261
  margin: 0 0 1.2rem;
1262
1262
  font-size: 1.8rem;
@@ -2505,7 +2505,7 @@ height: 70vh;
2505
2505
  }
2506
2506
  }
2507
2507
  }
2508
- `,IE=()=>globalThis.navigator?.connection,LE=e=>{let t=IE();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},RE=({uri:e})=>{let[t]=Zs({query:fE,variables:{input:{uri:e},descriptionInput:{type:Nc.Html}}});return/* @__PURE__ */ V(gE,{media:iT(t,e)})},zE=({uri:e})=>{let[t]=Zs({query:fE,variables:{input:{uri:e},descriptionInput:{type:Nc.Html}}}),n=iT(t,e),r=n?[n.uri,...(n.handles??[]).map(e=>e.node.uri)]:[],i=Ew(n?.seasons,r);return i?/* @__PURE__ */ V(RE,{uri:Kt(i)},i):/* @__PURE__ */ V(gE,{media:n})},BE=({mediaNodes:e})=>{let t=L(),[n]=Rh(ig(Q.MEDIA)),[r,i]=K(!0);H(()=>{let e=setTimeout(()=>i(!1),hw);return()=>clearTimeout(e)},[]);let a=B(()=>lw(e).filter(e=>!r||mw(e)),[e,r]),o=G(void 0);o.current=gw(a,o.current);let s=o.current,c=s?.titles?.at(0)?.title,l=s?.shortDescriptions?.at(0)?.shortDescription,u=rt(LE,()=>dw(IE())),d=rt(xu,()=>wu().some(e=>e.state===`connecting`&&!e.retry)),[f,p]=K(!1);H(()=>{if(!d)return;let e=setTimeout(()=>p(!0),fw);return()=>{clearTimeout(e),p(!1)}},[d]);let m=s&&e.find(e=>sw(e,s)),[h,g]=K([]),_=m?.trailers?.filter(e=>!h.includes(e.uri))??[],v=G(void 0),y=u||d&&!f?void 0:s?.trailers?.find(e=>!h.includes(e.uri))??_.find(e=>e.uri===v.current)??_.at(0);v.current=y?.uri;let b=ww(y?.url?void 0:Cw(m??s),s,{box:{width:globalThis.innerWidth,height:globalThis.innerHeight}}),[x,S]=K(!1),[C,w]=K(!0),[T,E]=K(.25),D=wt(()=>{y&&g(e=>[...e,y.uri])},[y]);return/* @__PURE__ */ W(`div`,{css:FE,className:`theater`,children:[/* @__PURE__ */ W(`div`,{className:`player-wrapper`,style:!y?.url&&b?{backgroundImage:`url(${b})`}:void 0,children:[y?.url&&/* @__PURE__ */ V(JC,{url:y.url,paused:x||n,onError:D,volume:C?0:T,className:`player`}),/* @__PURE__ */ V(`div`,{className:`shadow`})]}),/* @__PURE__ */ W(`div`,{className:`information`,css:FE,children:[y?.url&&/* @__PURE__ */ W(`div`,{className:`player-controls`,children:[/* @__PURE__ */ W(`button`,{type:`button`,className:`playback`,"aria-label":x?t.formatMessage({id:`Play trailer`,defaultMessage:`Play trailer`}):t.formatMessage({id:`Pause trailer`,defaultMessage:`Pause trailer`}),onClick:()=>S(e=>!e),children:[V(x?pt:it,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,"aria-hidden":`true`}),V(x?pt:it,{className:`icon-body`,size:30,"aria-hidden":`true`})]}),/* @__PURE__ */ V(ZC,{defaultMuted:C,onMutedUpdate:w,defaultVolume:T,onVolumeUpdate:e=>E(e)})]}),/* @__PURE__ */ V(`h1`,{className:`title`,children:c??(s||!r?void 0:/* @__PURE__ */ V(rw,{className:`pending`}))}),s||!r?/* @__PURE__ */ V($C,{className:`short-description`,children:l}):/* @__PURE__ */ V(iw,{count:3,className:`short-description pending`}),/* @__PURE__ */ V(`div`,{className:`actions`,children:s?.uri?/* @__PURE__ */ V(zE,{uri:s.uri},aw(s)):void 0})]})]})},VE={width:250,height:350},HE=R`
2508
+ `,IE=()=>globalThis.navigator?.connection,LE=e=>{let t=IE();return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},RE=({uri:e})=>{let[t]=Zs({query:fE,variables:{input:{uri:e},descriptionInput:{type:Nc.Html}}});return/* @__PURE__ */ V(gE,{media:iT(t,e)})},zE=({uri:e})=>{let[t]=Zs({query:fE,variables:{input:{uri:e},descriptionInput:{type:Nc.Html}}}),n=iT(t,e),r=n?[n.uri,...(n.handles??[]).map(e=>e.node.uri)]:[],i=Ew(n?.seasons,r);return i?/* @__PURE__ */ V(RE,{uri:Kt(i)},i):/* @__PURE__ */ V(gE,{media:n})},BE=({mediaNodes:e})=>{let t=L(),[n]=Rh(ig(Q.MEDIA)),[r,i]=K(!0);H(()=>{let e=setTimeout(()=>i(!1),hw);return()=>clearTimeout(e)},[]);let a=B(()=>lw(e).filter(e=>!r||mw(e)),[e,r]),o=G(void 0);o.current=gw(a,o.current,void 0,e);let s=o.current,c=s?.titles?.at(0)?.title,l=s?.shortDescriptions?.at(0)?.shortDescription,u=rt(LE,()=>dw(IE())),d=rt(xu,()=>wu().some(e=>e.state===`connecting`&&!e.retry)),[f,p]=K(!1);H(()=>{if(!d)return;let e=setTimeout(()=>p(!0),fw);return()=>{clearTimeout(e),p(!1)}},[d]);let m=s&&e.find(e=>sw(e,s)),[h,g]=K([]),_=m?.trailers?.filter(e=>!h.includes(e.uri))??[],v=G(void 0),y=[...s?.trailers?.filter(e=>!h.includes(e.uri))??[],..._],b=u||d&&!f?void 0:y.find(e=>e.uri===v.current)??y.at(0);v.current=b?.uri;let x=ww(b?.url?void 0:Cw(m??s),s,{box:{width:globalThis.innerWidth,height:globalThis.innerHeight}}),[S,C]=K(!1),[w,T]=K(!0),[E,D]=K(.25),O=wt(()=>{b&&g(e=>[...e,b.uri])},[b]);return/* @__PURE__ */ W(`div`,{css:FE,className:`theater`,children:[/* @__PURE__ */ W(`div`,{className:`player-wrapper`,style:!b?.url&&x?{backgroundImage:`url(${x})`}:void 0,children:[b?.url&&/* @__PURE__ */ V(JC,{url:b.url,paused:S||n,onError:O,volume:w?0:E,className:`player`}),/* @__PURE__ */ V(`div`,{className:`shadow`})]}),/* @__PURE__ */ W(`div`,{className:`information`,css:FE,children:[b?.url&&/* @__PURE__ */ W(`div`,{className:`player-controls`,children:[/* @__PURE__ */ W(`button`,{type:`button`,className:`playback`,"aria-label":S?t.formatMessage({id:`Play trailer`,defaultMessage:`Play trailer`}):t.formatMessage({id:`Pause trailer`,defaultMessage:`Pause trailer`}),onClick:()=>C(e=>!e),children:[V(S?pt:it,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,"aria-hidden":`true`}),V(S?pt:it,{className:`icon-body`,size:30,"aria-hidden":`true`})]}),/* @__PURE__ */ V(ZC,{defaultMuted:w,onMutedUpdate:T,defaultVolume:E,onVolumeUpdate:e=>D(e)})]}),/* @__PURE__ */ V(`h1`,{className:`title`,children:c??(s||!r?void 0:/* @__PURE__ */ V(rw,{className:`pending`}))}),s||!r?/* @__PURE__ */ V($C,{className:`short-description`,children:l}):/* @__PURE__ */ V(iw,{count:3,className:`short-description pending`}),/* @__PURE__ */ V(`div`,{className:`actions`,children:s?.uri?/* @__PURE__ */ V(zE,{uri:s.uri},aw(s)):void 0})]})]})},VE={width:250,height:350},HE=R`
2509
2509
  &.card {
2510
2510
  background-color: #191919;
2511
2511
  background-size: cover;
@@ -2920,7 +2920,7 @@ position: relative;
2920
2920
  @media (max-width: 768px) {
2921
2921
  --card-gutter: 1.5rem;
2922
2922
  }
2923
- `,XD=({uri:e,onAnswer:t})=>{let[{data:n}]=Zs({query:qD,variables:{input:{uri:e}}}),r=n?.media;return H(()=>{r&&t(e,r)},[r]),null},ZD=()=>{let e=new Date(WT()),[{data:t}]=Zs({query:FD}),[n,r]=K({}),i=t?.viewerLists?.rows??[],a=B(()=>UD(i,e),[i]),o=(e,t)=>r(n=>({...n,[e]:{...t,settled:t.settled||n[e]?.settled}}));return{episodes:KD(i,t=>GD(t,n[t.uri],e),e).map(e=>({...e,stored:n[e.work.uri]})),asks:a.map(e=>/* @__PURE__ */ V(XD,{uri:e.uri,onAnswer:o},e.uri)),reading:!t||!!t.viewerLists?.lists.some(e=>e.state===`LOADING`)||a.some(e=>!n[e.uri]?.settled)}},QD=({episode:{work:e,next:t,count:n,stored:r},style:i})=>{let a=L();return/* @__PURE__ */ W(Uh,{to:ag(Q.MEDIA,{uri:e.uri,name:e.summary.title}),css:JD,className:`card`,style:i,children:[e.summary.cover?/* @__PURE__ */ V(`img`,{src:e.summary.cover,alt:``,loading:`lazy`}):void 0,/* @__PURE__ */ W(`div`,{className:`about`,children:[/* @__PURE__ */ V(`span`,{className:`title`,children:e.summary.title??e.uri}),/* @__PURE__ */ W(`span`,{className:`facts`,children:[/* @__PURE__ */ V(`span`,{children:a.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:t})}),/* @__PURE__ */ V(`span`,{className:`new`,children:a.formatMessage({id:`{count, plural, one {{count} new} other {{count} new}}#episodes out and not watched`,defaultMessage:`{count, plural, one {{count} new} other {{count} new}}`,description:`episodes out and not watched`},{count:n})})]})]}),/* @__PURE__ */ V(XE,{media:e.type?e:r??e})]})},$D=({style:e,columnIndex:t,card:n,episodes:r})=>{let i=r[t];return i?/* @__PURE__ */ V(QD,{episode:i,style:{...e,width:n.width,height:n.height,marginInlineStart:`var(--card-gutter, 100px)`}}):null},eO=()=>{let e=L(),{episodes:t,asks:n}=ZD();return/* @__PURE__ */ W(q,{children:[n,t.length?/* @__PURE__ */ W(`section`,{css:YD,className:`home-row`,children:[/* @__PURE__ */ V(eD,{title:e.formatMessage({id:`Continue watching`,defaultMessage:`Continue watching`}),to:ag(Q.CONTINUE)}),/* @__PURE__ */ V(jD,{name:`new-episodes`,count:Math.min(t.length,20),cell:$D,cellProps:{episodes:t}})]}):void 0]})},tO=`this build of the worker exposes no traceGraph, so there is nothing to read a trace from`,nO=async()=>await import(`./assets/lib-worker-BwYVdaU4.js`),rO=async e=>{let t=await nO();if(typeof t.traceGraph!=`function`)throw Error(tO);return t.traceGraph(e)},iO=async e=>{let t=await nO();if(typeof t.traceAnswer!=`function`)throw Error(tO);return t.traceAnswer(e)},aO=[`graph`,`store`],oO=({uri:e,search:t}={})=>{let n=ag(Q.DEBUG_TRACE),r=new URLSearchParams;e&&r.set(`uri`,e);let i=uO(t??``);for(let e of aO)for(let t of i.getAll(e))r.append(e,t);let a=r.toString();return a?`${n}?${a}`:n},sO=e=>{let t=uO(fO(e)),n=new URLSearchParams;for(let e of aO)for(let r of t.getAll(e))n.append(e,r);let r=n.toString();return r?`?${r}`:``},cO=(e,t=`graph`)=>{let n=uO(e);return n.set(t,`1`),`${ag(Q.DEBUG_TRACE)}?${n.toString()}`},lO=e=>{let t=uO(e);t.delete(`store`);let n=t.toString();return`${ag(Q.DEBUG_TRACE)}${n?`?${n}`:``}`},uO=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),dO=typeof location>`u`?``:location.search,fO=(e=``)=>{let t=uO(dO);for(let[n,r]of uO(e))t.set(n,r);return t.toString()},pO=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e).get(`uri`)??``,mO={PREQUEL:`SEQUEL`,ADAPTATION:`SOURCE`,COMPILATION:`CONTAINS`,SIDE_STORY:`PARENT`},hO=e=>{let t=/* @__PURE__ */ new Set,n=[];for(let r of e){if(!r?.from||!r?.to||r.from===r.to)continue;let e=mO[r.relation],i=e?{from:r.to,to:r.from,relation:e}:r,a=`${i.from}\u0000${i.to}\u0000${i.relation}`;t.has(a)||(t.add(a),n.push(i))}return n},gO=/* @__PURE__ */ new Set([`TV`,`TV_SHORT`,`MOVIE`,`SPECIAL`,`OVA`,`ONA`,`MUSIC`]),_O=e=>!e||gO.has(e),vO=e=>[...new Set((e.nodes??[]).map(e=>e.format??``).filter(Boolean))].sort(),yO=(e,t)=>{let n=(e.nodes??[]).filter(t),r=new Set(n.map(e=>e.uri));return{nodes:n,edges:(e.edges??[]).filter(e=>r.has(e.from)&&r.has(e.to))}},bO=e=>`${e.from}\u0000${e.to}\u0000${e.relation}`,xO=(e,t)=>{if(!e)return{nodes:/* @__PURE__ */ new Set,edges:/* @__PURE__ */ new Set};if(e.kind===`node`){let n=t.filter(t=>t.from===e.uri||t.to===e.uri);return{nodes:/* @__PURE__ */ new Set([e.uri]),edges:new Set(n.map(bO))}}let n=t.find(t=>bO(t)===e.key);return n?{nodes:/* @__PURE__ */ new Set([n.from,n.to]),edges:/* @__PURE__ */ new Set([e.key])}:{nodes:/* @__PURE__ */ new Set,edges:/* @__PURE__ */ new Set}},SO=e=>e.titles?.[0]?.title||e.uri,CO=e=>[...e].sort((e,t)=>(e.startDate??`9999`).localeCompare(t.startDate??`9999`)||SO(e).localeCompare(SO(t))),wO=(e,t)=>{let n=new Map(e.map(e=>[e.uri,0]));for(let r=0;r<e.length;r++){let e=!1;for(let r of t){let t=n.get(r.from),i=n.get(r.to);t!==void 0&&i!==void 0&&i<t+1&&(n.set(r.to,t+1),e=!0)}if(!e)break}let r=[...new Set(n.values())].sort((e,t)=>e-t),i=new Map(r.map((e,t)=>[e,t]));for(let[e,t]of n)n.set(e,i.get(t)??0);return n},TO=(e,t=`story`)=>{let n=hO(e.edges??[]),r=new Set((e.nodes??[]).map(e=>e.uri)),i=n.filter(e=>r.has(e.from)&&r.has(e.to)),a=CO(e.nodes??[]),o=t===`graph`?wO(a,i):void 0,s=[...new Set(a.map(e=>e.startDate??``))],c=new Map(s.map((e,t)=>[e,t])),l=/* @__PURE__ */ new Map,u=a.map(e=>{let t=o?o.get(e.uri)??0:c.get(e.startDate??``)??0,n=l.get(t)??0;return l.set(t,n+1),{...e,column:t,row:n}}),d=[];if(t===`story`)for(let e=0;e<u.length-1;e++){let t=u[e],n=u[e+1];n.column>t.column&&d.push({from:t.uri,to:n.uri})}return{nodes:u,edges:i,chain:d,columns:Math.max(0,...u.map(e=>e.column+1)),rows:Math.max(0,...l.values())}},EO=Ne({ADAPTATION:{id:`Adaptation`,defaultMessage:`Adaptation`},PREQUEL:{id:`Prequel`,defaultMessage:`Prequel`},SEQUEL:{id:`Sequel`,defaultMessage:`Sequel`},PARENT:{id:`Parent story`,defaultMessage:`Parent story`},SIDE_STORY:{id:`Side story`,defaultMessage:`Side story`},CHARACTER:{id:`Character#shares characters`,defaultMessage:`Character`,description:`shares characters`},SUMMARY:{id:`Summary`,defaultMessage:`Summary`},ALTERNATIVE:{id:`Alternative`,defaultMessage:`Alternative`},SPIN_OFF:{id:`Spin off`,defaultMessage:`Spin off`},SOURCE:{id:`Source#adapted from`,defaultMessage:`Source`,description:`adapted from`},COMPILATION:{id:`Compilation`,defaultMessage:`Compilation`},CONTAINS:{id:`Contains`,defaultMessage:`Contains`},OTHER:{id:`Related`,defaultMessage:`Related`}}),DO=[`SOURCE`,`PREQUEL`,`SEQUEL`,`PARENT`,`SIDE_STORY`,`SPIN_OFF`,`ALTERNATIVE`,`ADAPTATION`,`SUMMARY`,`COMPILATION`,`CONTAINS`,`CHARACTER`,`OTHER`],OO=e=>{let t=DO.indexOf(e);return t===-1?DO.length:t},kO=e=>J.formatMessage(e&&EO[e]||EO.OTHER),AO=Ne({TV:{id:`TV`,defaultMessage:`TV`},TV_SHORT:{id:`TV Short`,defaultMessage:`TV Short`},MOVIE:{id:`Movie`,defaultMessage:`Movie`},SPECIAL:{id:`Special`,defaultMessage:`Special`},OVA:{id:`OVA`,defaultMessage:`OVA`},ONA:{id:`ONA`,defaultMessage:`ONA`},MUSIC:{id:`Music`,defaultMessage:`Music`},MANGA:{id:`Manga`,defaultMessage:`Manga`},NOVEL:{id:`Light Novel`,defaultMessage:`Light Novel`},ONE_SHOT:{id:`One Shot`,defaultMessage:`One Shot`}}),jO=e=>{if(!e)return;let t=AO[e];return t?J.formatMessage(t):e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)},MO=e=>[...e].sort((e,t)=>OO(e.relation)-OO(t.relation)),NO=e=>e.filter(e=>_O(e.format)),PO=3,FO=R`
2923
+ `,XD=({uri:e,onAnswer:t})=>{let[{data:n}]=Zs({query:qD,variables:{input:{uri:e}}}),r=n?.media;return H(()=>{r&&t(e,r)},[r]),null},ZD=()=>{let e=new Date(WT()),[{data:t}]=Zs({query:FD}),[n,r]=K({}),i=t?.viewerLists?.rows??[],a=B(()=>UD(i,e),[i]),o=(e,t)=>r(n=>({...n,[e]:{...t,settled:t.settled||n[e]?.settled}}));return{episodes:KD(i,t=>GD(t,n[t.uri],e),e).map(e=>({...e,stored:n[e.work.uri]})),asks:a.map(e=>/* @__PURE__ */ V(XD,{uri:e.uri,onAnswer:o},e.uri)),reading:!t||!!t.viewerLists?.lists.some(e=>e.state===`LOADING`)||a.some(e=>!n[e.uri]?.settled)}},QD=({episode:{work:e,next:t,count:n,stored:r},style:i})=>{let a=L();return/* @__PURE__ */ W(Uh,{to:ag(Q.MEDIA,{uri:e.uri,name:e.summary.title}),css:JD,className:`card`,style:i,children:[e.summary.cover?/* @__PURE__ */ V(`img`,{src:e.summary.cover,alt:``,loading:`lazy`}):void 0,/* @__PURE__ */ W(`div`,{className:`about`,children:[/* @__PURE__ */ V(`span`,{className:`title`,children:e.summary.title??e.uri}),/* @__PURE__ */ W(`span`,{className:`facts`,children:[/* @__PURE__ */ V(`span`,{children:a.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:t})}),/* @__PURE__ */ V(`span`,{className:`new`,children:a.formatMessage({id:`{count, plural, one {{count} new} other {{count} new}}#episodes out and not watched`,defaultMessage:`{count, plural, one {{count} new} other {{count} new}}`,description:`episodes out and not watched`},{count:n})})]})]}),/* @__PURE__ */ V(XE,{media:e.type?e:r??e})]})},$D=({style:e,columnIndex:t,card:n,episodes:r})=>{let i=r[t];return i?/* @__PURE__ */ V(QD,{episode:i,style:{...e,width:n.width,height:n.height,marginInlineStart:`var(--card-gutter, 100px)`}}):null},eO=()=>{let e=L(),{episodes:t,asks:n}=ZD();return/* @__PURE__ */ W(q,{children:[n,t.length?/* @__PURE__ */ W(`section`,{css:YD,className:`home-row`,children:[/* @__PURE__ */ V(eD,{title:e.formatMessage({id:`Continue watching`,defaultMessage:`Continue watching`}),to:ag(Q.CONTINUE)}),/* @__PURE__ */ V(jD,{name:`new-episodes`,count:Math.min(t.length,20),cell:$D,cellProps:{episodes:t}})]}):void 0]})},tO=`this build of the worker exposes no traceGraph, so there is nothing to read a trace from`,nO=async()=>await import(`./assets/lib-worker-CEeb8mNR.js`),rO=async e=>{let t=await nO();if(typeof t.traceGraph!=`function`)throw Error(tO);return t.traceGraph(e)},iO=async e=>{let t=await nO();if(typeof t.traceAnswer!=`function`)throw Error(tO);return t.traceAnswer(e)},aO=[`graph`,`store`],oO=({uri:e,search:t}={})=>{let n=ag(Q.DEBUG_TRACE),r=new URLSearchParams;e&&r.set(`uri`,e);let i=uO(t??``);for(let e of aO)for(let t of i.getAll(e))r.append(e,t);let a=r.toString();return a?`${n}?${a}`:n},sO=e=>{let t=uO(fO(e)),n=new URLSearchParams;for(let e of aO)for(let r of t.getAll(e))n.append(e,r);let r=n.toString();return r?`?${r}`:``},cO=(e,t=`graph`)=>{let n=uO(e);return n.set(t,`1`),`${ag(Q.DEBUG_TRACE)}?${n.toString()}`},lO=e=>{let t=uO(e);t.delete(`store`);let n=t.toString();return`${ag(Q.DEBUG_TRACE)}${n?`?${n}`:``}`},uO=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),dO=typeof location>`u`?``:location.search,fO=(e=``)=>{let t=uO(dO);for(let[n,r]of uO(e))t.set(n,r);return t.toString()},pO=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e).get(`uri`)??``,mO={PREQUEL:`SEQUEL`,ADAPTATION:`SOURCE`,COMPILATION:`CONTAINS`,SIDE_STORY:`PARENT`},hO=e=>{let t=/* @__PURE__ */ new Set,n=[];for(let r of e){if(!r?.from||!r?.to||r.from===r.to)continue;let e=mO[r.relation],i=e?{from:r.to,to:r.from,relation:e}:r,a=`${i.from}\u0000${i.to}\u0000${i.relation}`;t.has(a)||(t.add(a),n.push(i))}return n},gO=/* @__PURE__ */ new Set([`TV`,`TV_SHORT`,`MOVIE`,`SPECIAL`,`OVA`,`ONA`,`MUSIC`]),_O=e=>!e||gO.has(e),vO=e=>[...new Set((e.nodes??[]).map(e=>e.format??``).filter(Boolean))].sort(),yO=(e,t)=>{let n=(e.nodes??[]).filter(t),r=new Set(n.map(e=>e.uri));return{nodes:n,edges:(e.edges??[]).filter(e=>r.has(e.from)&&r.has(e.to))}},bO=e=>`${e.from}\u0000${e.to}\u0000${e.relation}`,xO=(e,t)=>{if(!e)return{nodes:/* @__PURE__ */ new Set,edges:/* @__PURE__ */ new Set};if(e.kind===`node`){let n=t.filter(t=>t.from===e.uri||t.to===e.uri);return{nodes:/* @__PURE__ */ new Set([e.uri]),edges:new Set(n.map(bO))}}let n=t.find(t=>bO(t)===e.key);return n?{nodes:/* @__PURE__ */ new Set([n.from,n.to]),edges:/* @__PURE__ */ new Set([e.key])}:{nodes:/* @__PURE__ */ new Set,edges:/* @__PURE__ */ new Set}},SO=e=>e.titles?.[0]?.title||e.uri,CO=e=>[...e].sort((e,t)=>(e.startDate??`9999`).localeCompare(t.startDate??`9999`)||SO(e).localeCompare(SO(t))),wO=(e,t)=>{let n=new Map(e.map(e=>[e.uri,0]));for(let r=0;r<e.length;r++){let e=!1;for(let r of t){let t=n.get(r.from),i=n.get(r.to);t!==void 0&&i!==void 0&&i<t+1&&(n.set(r.to,t+1),e=!0)}if(!e)break}let r=[...new Set(n.values())].sort((e,t)=>e-t),i=new Map(r.map((e,t)=>[e,t]));for(let[e,t]of n)n.set(e,i.get(t)??0);return n},TO=(e,t=`story`)=>{let n=hO(e.edges??[]),r=new Set((e.nodes??[]).map(e=>e.uri)),i=n.filter(e=>r.has(e.from)&&r.has(e.to)),a=CO(e.nodes??[]),o=t===`graph`?wO(a,i):void 0,s=[...new Set(a.map(e=>e.startDate??``))],c=new Map(s.map((e,t)=>[e,t])),l=/* @__PURE__ */ new Map,u=a.map(e=>{let t=o?o.get(e.uri)??0:c.get(e.startDate??``)??0,n=l.get(t)??0;return l.set(t,n+1),{...e,column:t,row:n}}),d=[];if(t===`story`)for(let e=0;e<u.length-1;e++){let t=u[e],n=u[e+1];n.column>t.column&&d.push({from:t.uri,to:n.uri})}return{nodes:u,edges:i,chain:d,columns:Math.max(0,...u.map(e=>e.column+1)),rows:Math.max(0,...l.values())}},EO=Ne({ADAPTATION:{id:`Adaptation`,defaultMessage:`Adaptation`},PREQUEL:{id:`Prequel`,defaultMessage:`Prequel`},SEQUEL:{id:`Sequel`,defaultMessage:`Sequel`},PARENT:{id:`Parent story`,defaultMessage:`Parent story`},SIDE_STORY:{id:`Side story`,defaultMessage:`Side story`},CHARACTER:{id:`Character#shares characters`,defaultMessage:`Character`,description:`shares characters`},SUMMARY:{id:`Summary`,defaultMessage:`Summary`},ALTERNATIVE:{id:`Alternative`,defaultMessage:`Alternative`},SPIN_OFF:{id:`Spin off`,defaultMessage:`Spin off`},SOURCE:{id:`Source#adapted from`,defaultMessage:`Source`,description:`adapted from`},COMPILATION:{id:`Compilation`,defaultMessage:`Compilation`},CONTAINS:{id:`Contains`,defaultMessage:`Contains`},OTHER:{id:`Related`,defaultMessage:`Related`}}),DO=[`SOURCE`,`PREQUEL`,`SEQUEL`,`PARENT`,`SIDE_STORY`,`SPIN_OFF`,`ALTERNATIVE`,`ADAPTATION`,`SUMMARY`,`COMPILATION`,`CONTAINS`,`CHARACTER`,`OTHER`],OO=e=>{let t=DO.indexOf(e);return t===-1?DO.length:t},kO=e=>J.formatMessage(e&&EO[e]||EO.OTHER),AO=Ne({TV:{id:`TV`,defaultMessage:`TV`},TV_SHORT:{id:`TV Short`,defaultMessage:`TV Short`},MOVIE:{id:`Movie`,defaultMessage:`Movie`},SPECIAL:{id:`Special`,defaultMessage:`Special`},OVA:{id:`OVA`,defaultMessage:`OVA`},ONA:{id:`ONA`,defaultMessage:`ONA`},MUSIC:{id:`Music`,defaultMessage:`Music`},MANGA:{id:`Manga`,defaultMessage:`Manga`},NOVEL:{id:`Light Novel`,defaultMessage:`Light Novel`},ONE_SHOT:{id:`One Shot`,defaultMessage:`One Shot`}}),jO=e=>{if(!e)return;let t=AO[e];return t?J.formatMessage(t):e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)},MO=e=>[...e].sort((e,t)=>OO(e.relation)-OO(t.relation)),NO=e=>e.filter(e=>_O(e.format)),PO=3,FO=R`
2924
2924
  & > h2 {
2925
2925
  display: flex;
2926
2926
  align-items: center;
@@ -3648,7 +3648,7 @@ overflow-wrap: anywhere;
3648
3648
  .chip > label { margin: 0 -0.4rem; padding: 0 0.4rem; }
3649
3649
  .chip .login-button { padding: 0 0.6rem; }
3650
3650
  }
3651
- `,XH={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10},ZH=(e,t,n)=>{let r=n??`POINT_100`;return e.formatMessage({id:`{score, number} / {max, number}`,defaultMessage:`{score, number} / {max, number}`},{score:kd(t,r),max:XH[r]??100})},QH=`REMOVE`,$H=``,eU=({answer:e})=>/* @__PURE__ */ V(`span`,{className:`logo`,style:e.tracker.color?{color:e.tracker.color}:void 0,children:/* @__PURE__ */ V(Iw,{icon:e.tracker.icon,name:e.tracker.name})}),tU=e=>e.state===`PAUSED`||e.state===`ERROR`?On(Ld(e)):void 0,nU=(e,t,{busy:n,failed:r})=>t.kind===`check`?n?`busy`:r||e.state===`ERROR`?`error`:e.state===`PAUSED`?`paused`:t.checked?`on`:`off`:t.kind,rU=({answer:e,state:t})=>{let n=L().formatMessage({id:`{name}: {state, select, loading {loading} login {signed out} cannot {cannot track this media} busy {updating} error {error} paused {paused} on {connected} other {off}}`,defaultMessage:`{name}: {state, select, loading {loading} login {signed out} cannot {cannot track this media} busy {updating} error {error} paused {paused} on {connected} other {off}}`},{name:e.tracker.name,state:t});return/* @__PURE__ */ W(`span`,{className:`tile ${t}`,"data-tile":e.tracker.id,role:`img`,"aria-label":n,title:n,children:[/* @__PURE__ */ V(eU,{answer:e}),/* @__PURE__ */ V(`span`,{className:`mark`,children:t===`loading`||t===`busy`?/* @__PURE__ */ V(ox,{size:10,className:`spin`,"aria-hidden":`true`}):void 0})]})},iU=({outcome:e})=>e===`SAVED`||e===`QUEUED`,aU=({answer:e,failed:t})=>t||e.state===`ERROR`?/* @__PURE__ */ V(`span`,{className:`badge red`,"data-badge":`red`}):e.state===`PAUSED`?/* @__PURE__ */ V(`span`,{className:`badge amber`,"data-badge":`amber`}):null,oU=({name:e,shown:t,scale:n,mixed:r,disabled:i,listed:a,removable:o,onChange:s,dots:c={},movie:l=!1,statuses:u,clearable:d})=>{let f=L(),[p,m]=K(),h=G(void 0),g=G(()=>{}),_=t.total,v=()=>{if(clearTimeout(h.current),p===void 0)return;let e=Number(p);if(m(void 0),p.trim()===``||!Number.isFinite(e))return;let n=Math.max(0,Math.min(_??1/0,Math.floor(e)));n!==t.progress&&s({progress:n},!0)};g.current=v;let y=t.status===`COMPLETED`||t.progress>=(_??1);return/* @__PURE__ */ W(`div`,{className:`group edit`,children:[/* @__PURE__ */ V(GH,{score:t.score,scale:n,mixed:r,disabled:i||!a&&!t.status&&!t.progress,clearable:d,onPick:e=>s({score:e},!0)}),c.SCORE,/* @__PURE__ */ W(`select`,{name:`${e}-status`,"aria-label":f.formatMessage({id:`Status`,defaultMessage:`Status`}),value:t.status??``,disabled:i,onChange:e=>{let t=e.currentTarget.value;s(t===QH?{remove:!0}:{status:t},!0)},children:[t.status?void 0:/* @__PURE__ */ V(`option`,{value:``,disabled:!0,children:f.formatMessage({id:`Add to list`,defaultMessage:`Add to list`})}),Md.filter(e=>!u||u.includes(e)).map(e=>/* @__PURE__ */ V(`option`,{value:e,children:JH(f,e)},e)),o?/* @__PURE__ */ V(`option`,{value:QH,children:f.formatMessage({id:`Remove from list`,defaultMessage:`Remove from list`})}):void 0]}),c.STATUS,l?/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`button`,{type:`button`,className:`watched${y?` on`:``}`,"aria-pressed":y,disabled:i,onClick:()=>s(y?{progress:0,...t.status===`COMPLETED`?{status:`PLANNING`}:{}}:{progress:_??1,status:`COMPLETED`},!0),children:[/* @__PURE__ */ V(Nt,{size:14,"aria-hidden":`true`}),f.formatMessage({id:`Watched#marked as seen`,defaultMessage:`Watched`,description:`marked as seen`})]}),c.PROGRESS]}):/* @__PURE__ */ W(`span`,{className:`progress-field`,children:[/* @__PURE__ */ V(`label`,{for:`${e}-progress`,className:`word`,children:f.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),/* @__PURE__ */ V(`input`,{id:`${e}-progress`,type:`number`,inputMode:`numeric`,name:`${e}-progress`,min:0,max:_??void 0,disabled:i,value:p??t.progress,onInput:e=>{m(e.currentTarget.value),clearTimeout(h.current),h.current=setTimeout(()=>g.current(),1e3)},onBlur:v,onKeyDown:e=>{e.key===`Enter`&&v(),e.key===`Escape`&&(clearTimeout(h.current),m(void 0),e.stopPropagation())}}),_?/* @__PURE__ */ V(`span`,{className:`of`,children:f.formatMessage({id:`/ {total}`,defaultMessage:`/ {total}`},{total:_})}):void 0,c.PROGRESS,/* @__PURE__ */ V(`button`,{type:`button`,className:`more`,"aria-label":f.formatMessage({id:`One episode more`,defaultMessage:`One episode more`}),disabled:i||_!=null&&t.progress>=_,onClick:()=>s({progress:t.progress+1},!1),children:/* @__PURE__ */ V(fx,{size:14,"aria-hidden":`true`})})]}),!l&&!i&&_&&t.progress===_&&t.status!==`COMPLETED`&&(!u||u.includes(`COMPLETED`))?/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>s({status:`COMPLETED`},!0),children:f.formatMessage({id:`Mark completed`,defaultMessage:`Mark completed`})}):void 0,!l&&!i&&_&&t.status===`COMPLETED`&&t.progress<_?/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>s({progress:_},!0),children:f.formatMessage({id:`Set {total} / {total}`,defaultMessage:`Set {total} / {total}`},{total:_})}):void 0]})},sU=({answer:e,className:t,busy:n,open:r,onOpen:i,card:a,children:o})=>{let s=G(null);H(()=>{r&&s.current?.focus()},[]);let{refs:c,floatingStyles:l,context:u}=fb({open:r,onOpenChange:(e,t,n)=>{let r=c.floating.current?.contains(document.activeElement)??!1;(e||!r||n!==`hover`&&n!==`safe-polygon`)&&(e&&n===`hover`&&document.activeElement?.closest(`[data-card]`)||(!e&&r&&n===`escape-key`&&s.current?.focus(),i(e)))},placement:`bottom-end`,strategy:`fixed`,whileElementsMounted:$e,middleware:[Uv(8),Gv({padding:8}),Wv({padding:8})]}),{getReferenceProps:d}=gb([ob(u)]),{getReferenceProps:f,getFloatingProps:p}=gb([yy(u,{mouseOnly:!0,delay:{open:100},handleClose:Db()}),mb(u),ub(u)]),m=L().formatMessage({id:`{name} entry`,defaultMessage:`{name} entry`},{name:e.tracker.name});return/* @__PURE__ */ W(`span`,{ref:c.setReference,className:t,"data-chip":e.tracker.id,"aria-busy":n?`true`:void 0,...f(),children:[/* @__PURE__ */ V(`button`,{ref:s,type:`button`,className:`logo-button`,"aria-label":m,"aria-haspopup":`dialog`,"aria-expanded":r,...d(),children:/* @__PURE__ */ V(eU,{answer:e})}),o,r?/* @__PURE__ */ V(`div`,{ref:c.setFloating,style:l,className:`card`,role:`dialog`,"aria-label":m,"data-card":e.tracker.id,...p(),children:a()}):void 0]})},cU=({tracking:e,episodeCount:t,movie:n=!1,watched:r,counted:i,onSaveFields:a,onRemove:o,onActivity:s,signIns:c={},prefs:l,onPrefs:u})=>{let d=L(),[,f]=K(0),[p,m]=K({}),[h,g]=K(),[_,v]=K(),[y,b]=K(/* @__PURE__ */ new Set),[x,S]=K({}),[C,w]=K(),T=G({onSaveFields:a,onRemove:o,onActivity:s,tracking:e,episodeCount:t});T.current={onSaveFields:a,onRemove:o,onActivity:s,tracking:e,episodeCount:t};let E=G(void 0),D=B(()=>ef({send:async(e,t)=>{let n=await(t.remove?T.current.onRemove([e]):T.current.onSaveFields([e],t));return n.find(t=>t.tracker===e)??n[0]??{outcome:`FAILED`,error:Dc.formatMessage({id:`The write did not reach the trackers`,defaultMessage:`The write did not reach the trackers`})}},shape:(e,t)=>{let{tracking:n,episodeCount:r}=T.current,i=n?.answers.find(t=>t.tracker.id===e);return i&&Kd(i,t,{...Rd(n,r),...t})},steps:e=>Yd(T.current.tracking,e),onChange:e=>{if(f(e=>e+1),!e)return;let t=T.current.tracking?.answers.find(t=>t.tracker.id===e.tracker)?.tracker.name??e.tracker;if(v({...e,name:t}),iU(e)&&E.current){let t=Nd(E.current.from,E.current.to);(!t||Pd(e.fields,t))&&(E.current=void 0,t&&T.current.onActivity?.(t))}!iU(e)&&D.idle()&&m({})}}),[]),O=G(/* @__PURE__ */ new Map),k=G(/* @__PURE__ */ new Map),A=i??k.current,j=e?.answers.find(e=>e.tracker.id===`trakt`&&e.state!==`NO_ID`),M=j?Ud(j,l.targets.trakt):void 0,N=!!(M&&M.kind===`check`&&M.sendable),P=j?.entry?.progress??0;H(()=>{h&&(!N||h.targetProgress>=P)&&g(void 0)},[h,N,P]);let ee=(e,t,n)=>{for(let[t,{progress:n}]of Object.entries(e))n!==void 0&&O.current.set(t,n);D.stage(e,t,n)},te=(e,t,n)=>{let r=e.trakt;if(r&&!r.remove&&r.progress!==void 0&&r.progress!==null){if(r.progress<P){let{trakt:i,...a}=e;Object.keys(a).length&&ee(a,t,n),g({patch:r,targetProgress:r.progress,fromCard:n});return}g(void 0)}ee(e,t,n)},F=()=>{if(!h)return;let e=h;g(void 0),ee({trakt:e.patch},!0,e.fromCard)},ne=()=>{h&&(g(void 0),m(e=>{let t={...e};if(delete t.trakt,t[$H]?.progress!==void 0){let{progress:e,...n}=t[$H];Object.keys(n).length?t[$H]=n:delete t[$H]}return t}))};H(()=>{let e=()=>{document.visibilityState===`hidden`&&D.flush()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),D.flush()}},[]);let I=Rd(e,t),re=t=>{let n=e?.answers.find(e=>e.tracker.id===t);return n&&Bd(n,I.total)};H(()=>{m(e=>D.idle()?{}:Object.fromEntries(Object.entries(e).flatMap(([e,t])=>{let n=e===$H?I:re(e);return n?[[e,Hd(t,n)]]:[]})))},[e]);let ie=Vd(I,p[$H]),ae=e=>{E.current={from:E.current?.from??ie,to:e}},oe=r&&e&&ie.status!==`COMPLETED`?nf({...r,movie:n},e,l.targets,t):{},se=e=>A.has(e)&&A.get(e)===r?.episode,ce=e?.answers.filter(({tracker:{id:e}})=>oe[e]&&!se(e)&&oe[e].progress>(O.current.get(e)??0))??[];H(()=>{let t=ce.filter(Id);if(r&&e&&r.played>=.85)for(let t of e.answers){let e=Ud(t,l.targets[t.tracker.id]);e.kind===`check`&&e.sendable&&A.set(t.tracker.id,r.episode)}t.length&&(ae({...ie,...oe[t[0].tracker.id]}),te(Object.fromEntries(t.map(({tracker:{id:e}})=>[e,oe[e]])),!0))},[r,e,l]);let le=e?.answers.filter(e=>e.state!==`NO_ID`)??[];if(e!==void 0&&!le.length)return null;let ue=le.map(e=>({answer:e,target:Ud(e,l.targets[e.tracker.id])})),de=l.expanded===!0,fe=ue.filter(({target:e})=>e.kind===`check`&&e.sendable).map(({answer:e})=>e),pe=!fe.length,me=Zd(fe.map(e=>e.tracker.scoreScale)),he=le.length>1&&D.idle()?Jd(ue,I,me?.scale):{},ge=Object.keys(he).length>0,_e=()=>{ge&&(ae(I),te(he,!0))},ve=(e,t)=>{t.remove||m(n=>({...n,[e]:{...n[e],...t}}))},ye=(e,t)=>{ve($H,e);let n={...ie,...e};ae(n);let r={};for(let{answer:t,target:i}of ue){if(i.kind!==`check`||!i.checked)continue;let a=t.tracker.id;if(!Id(t)){D.fail(a,e,Ld(t));continue}let o=Kd(t,e,n);o&&(r[a]=o)}te(r,t)},be=(e,t,n)=>{let r=e.tracker.id,i=Vd(Bd(e,I.total),p[r]);ve(r,t);let a=Kd(e,t,{...i,...t});a&&te({[r]:a},n,!0)},xe=e=>{let t=D.state(e.tracker.id);return t.failed?.fields.remove&&e.state===`NOT_LISTED`?{...t,failed:void 0}:!t.failed&&ce.includes(e)&&!Id(e)?{...t,failed:{fields:oe[e.tracker.id],error:Ld(e)}}:t},Se=e=>{u({...l,expanded:!0}),w(e)},Ce=(e,t)=>{t||D.drop(e),!t&&!D.state(e).busy&&O.current.delete(e),u({...l,targets:{...l.targets,[e]:t}})},we=e=>{let t=c[e.tracker.id],n=e.tracker.id;if(!t||y.has(n))return;let r=t();b(e=>new Set(e).add(n)),S(({[n]:e,...t})=>t),r.then(t=>KH[t]?.(e.tracker.name),e=>e instanceof Error?e.message:String(e)).then(e=>{e&&S(t=>({...t,[n]:e})),b(e=>{let t=new Set(e);return t.delete(n),t})})},Te=(e,t)=>d.formatMessage({id:`{name} cannot track this media: {reason}`,defaultMessage:`{name} cannot track this media: {reason}`},{name:e,reason:On(t)}),Ee=d.formatMessage({id:`Trackers loading`,defaultMessage:`Trackers loading`}),De=({name:e,outcome:t,fields:n,error:r})=>iU({outcome:t})?n.remove?d.formatMessage({id:`Removed from {name}`,defaultMessage:`Removed from {name}`},{name:e}):d.formatMessage({id:`Saved to {name}`,defaultMessage:`Saved to {name}`},{name:e}):r?d.formatMessage({id:`{name} did not save: {error}`,defaultMessage:`{name} did not save: {error}`},{name:e,error:On(r)}):d.formatMessage({id:`{name} did not save: {outcome, select, REFUSED {refused} other {failed}}`,defaultMessage:`{name} did not save: {outcome, select, REFUSED {refused} other {failed}}`},{name:e,outcome:t}),Oe=(e,t)=>/* @__PURE__ */ V(`button`,{type:`button`,className:t,"aria-label":d.formatMessage({id:`Log in to {name}`,defaultMessage:`Log in to {name}`},{name:e.tracker.name}),disabled:!c[e.tracker.id]||y.has(e.tracker.id),onClick:()=>we(e),children:y.has(e.tracker.id)?d.formatMessage({id:`Logging in`,defaultMessage:`Logging in`}):d.formatMessage({id:`Log in`,defaultMessage:`Log in`})}),ke=(e,t)=>{let r=e.tracker.id,i=e.tracker.name,a=/* @__PURE__ */ W(`div`,{className:`head`,children:[/* @__PURE__ */ V(eU,{answer:e}),i,e.tracker.account?/* @__PURE__ */ V(`span`,{className:`account`,children:On(e.tracker.account)}):void 0]});if(t.kind===`loading`)return a;if(t.kind===`login`)return/* @__PURE__ */ W(q,{children:[a,/* @__PURE__ */ V(`span`,{className:`why`,children:d.formatMessage({id:`Signed out`,defaultMessage:`Signed out`})}),Oe(e)]});if(t.kind===`cannot`)return/* @__PURE__ */ W(q,{children:[a,/* @__PURE__ */ V(`span`,{className:`why`,children:Te(i,t.reason)})]});let o=Id(e),s=Bd(e,I.total),c=Zd([e.tracker.scoreScale]);return/* @__PURE__ */ W(q,{children:[a,/* @__PURE__ */ V(oU,{name:`card-${r}`,movie:n,statuses:e.tracker.statuses,clearable:e.tracker.canClearScore!==!1,shown:Vd(s,p[r]),scale:c.scale,mixed:!1,disabled:!o,listed:e.state===`LISTED`,removable:o&&Gd(e),onChange:(t,n)=>be(e,t,n)}),o?void 0:/* @__PURE__ */ V(`span`,{className:`why`,children:On(Ld(e))})]})},Ae=e=>d.formatList(le.filter(e=>e.state===`LISTED`).map(t=>{let n=e(t);return n===void 0?d.formatMessage({id:`{name} none`,defaultMessage:`{name} none`},{name:t.tracker.name}):d.formatMessage({id:`{name} {value}`,defaultMessage:`{name} {value}`},{name:t.tracker.name,value:n})}),Cn),je=(e,t)=>I.differs.includes(e)?/* @__PURE__ */ V(`span`,{className:`differs`,"data-differs":e,title:Ae(t)}):void 0;return/* @__PURE__ */ W(`section`,{css:YH,className:`tracking-compact`,"aria-label":d.formatMessage({id:`Quick tracking`,defaultMessage:`Quick tracking`}),children:[/* @__PURE__ */ W(`div`,{className:`row`,children:[/* @__PURE__ */ W(`div`,{className:`group platforms${de?` expanded`:``}`,children:[/* @__PURE__ */ V(`button`,{type:`button`,className:`expand`,"aria-expanded":de,"aria-label":de?d.formatMessage({id:`Trackers`,defaultMessage:`Trackers`}):void 0,title:de?d.formatMessage({id:`Collapse trackers`,defaultMessage:`Collapse trackers`}):void 0,onClick:()=>u({...l,expanded:!de}),children:de?/* @__PURE__ */ V(qb,{size:14,"aria-hidden":`true`}):/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`span`,{className:`tiles`,children:e===void 0?/* @__PURE__ */ V(`span`,{className:`tile loading`,role:`img`,"aria-label":Ee,title:Ee,children:/* @__PURE__ */ V(ox,{size:12,className:`spin`,"aria-hidden":`true`})}):ue.map(({answer:e,target:t})=>/* @__PURE__ */ V(rU,{answer:e,state:nU(e,t,xe(e))},e.tracker.id))}),/* @__PURE__ */ V(Kb,{size:12,"aria-hidden":`true`})]})}),de&&e===void 0?/* @__PURE__ */ V(`span`,{className:`chip loading`,children:/* @__PURE__ */ V(`span`,{className:`slot`,role:`img`,"aria-label":Ee,children:/* @__PURE__ */ V(ox,{size:14,className:`spin`,"aria-hidden":`true`})})}):void 0,de&&ue.map(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name,i={answer:e,open:C===n,onOpen:e=>w(t=>e?n:t===n?void 0:t),card:()=>ke(e,t)};if(t.kind===`loading`)return/* @__PURE__ */ V(sU,{...i,className:`chip loading`,busy:!0,children:/* @__PURE__ */ V(`span`,{className:`slot`,role:`img`,"aria-label":d.formatMessage({id:`{name} loading`,defaultMessage:`{name} loading`},{name:r}),children:/* @__PURE__ */ V(ox,{size:14,className:`spin`,"aria-hidden":`true`})})},n);if(t.kind===`login`)return/* @__PURE__ */ V(sU,{...i,className:`chip login`,children:Oe(e,`login-button`)},n);if(t.kind===`cannot`)return/* @__PURE__ */ V(sU,{...i,className:`chip cannot`,children:/* @__PURE__ */ V(`span`,{className:`slot`,role:`img`,"aria-label":Te(r,t.reason),children:/* @__PURE__ */ V(ux,{size:14,"aria-hidden":`true`})})},n);let{busy:a,failed:o}=xe(e),s=tU(e);return/* @__PURE__ */ W(sU,{...i,className:`chip${t.checked?``:` off`}`,busy:a,children:[/* @__PURE__ */ W(`label`,{children:[/* @__PURE__ */ V(`input`,{type:`checkbox`,className:`sr-only`,name:`compact-target-${n}`,"aria-label":d.formatMessage({id:`Save to {name}`,defaultMessage:`Save to {name}`},{name:r}),"aria-describedby":s?`compact-hint-${n}`:void 0,checked:t.checked,onChange:e=>Ce(n,e.currentTarget.checked)}),/* @__PURE__ */ V(`span`,{className:`slot`,children:a?/* @__PURE__ */ V(ox,{size:14,className:`spin`,"aria-hidden":`true`}):t.checked?/* @__PURE__ */ V(`span`,{className:`check`,children:/* @__PURE__ */ V(Nt,{size:11,"aria-hidden":`true`})}):/* @__PURE__ */ V(`span`,{className:`ring`})})]}),/* @__PURE__ */ V(aU,{answer:e,failed:o}),s?/* @__PURE__ */ V(`span`,{id:`compact-hint-${n}`,className:`sr-only`,children:s}):void 0]},n)}),!pe&&ge?/* @__PURE__ */ V(`button`,{type:`button`,className:`sync-all`,onClick:_e,children:d.formatMessage({id:`Sync all`,defaultMessage:`Sync all`})}):void 0]}),/* @__PURE__ */ V(oU,{name:`compact`,movie:n,shown:ie,scale:me?.scale??`POINT_100`,mixed:me?.mixed??!1,disabled:pe,listed:le.some(e=>e.state===`LISTED`),removable:fe.some(Gd),onChange:ye,dots:{SCORE:je(`SCORE`,e=>Od(e.entry?.score)?ZH(d,e.entry.score,e.tracker.scoreScale):void 0),STATUS:je(`STATUS`,e=>e.entry?.status?JH(d,e.entry.status):void 0),PROGRESS:je(`PROGRESS`,e=>e.entry?.progress==null?void 0:String(e.entry.progress))}})]}),/* @__PURE__ */ W(`div`,{className:`notes`,children:[ue.flatMap(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name;return[x[n]&&e.state===`SIGNED_OUT`?/* @__PURE__ */ W(`div`,{className:`note`,"data-note":n,children:[On(x[n]),de?void 0:Oe(e)]},`${n}-sign-in`):void 0,/* @__PURE__ */ V(zH,{answer:e,state:xe(e),queue:D},`${n}-problems`),t.kind===`check`&&t.sendable&&Wd(e,I.total)?/* @__PURE__ */ W(`div`,{className:`note`,"data-note":n,children:[d.formatMessage({id:`{name}: set progress on its card`,defaultMessage:`{name}: set progress on its card`},{name:r}),de?void 0:/* @__PURE__ */ V(`button`,{type:`button`,"aria-haspopup":`dialog`,onClick:()=>Se(n),children:d.formatMessage({id:`Open`,defaultMessage:`Open`})})]},`${n}-count`):void 0].filter(Boolean)}),h&&N&&h.targetProgress<P?/* @__PURE__ */ W(`div`,{className:`note`,"data-note":`trakt`,"data-confirm":`trakt-lower`,children:[/* @__PURE__ */ V(`span`,{children:d.formatMessage({id:`Lowering progress on Trakt to {target} deletes every recorded play above it, including rewatches.`,defaultMessage:`Lowering progress on Trakt to {target} deletes every recorded play above it, including rewatches.`},{target:h.targetProgress})}),/* @__PURE__ */ V(`button`,{type:`button`,onClick:F,children:d.formatMessage({id:`Remove Trakt plays`,defaultMessage:`Remove Trakt plays`})}),/* @__PURE__ */ V(`button`,{type:`button`,onClick:ne,children:d.formatMessage({id:`Cancel`,defaultMessage:`Cancel`})})]},`trakt-confirm-lower`):void 0]}),/* @__PURE__ */ V(`div`,{className:`sr-only`,role:`status`,children:_?De(_):``})]})};U();var lU=RC(`
3651
+ `,XH={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10},ZH=3e4,QH=4e3,$H=(e,t,n)=>{let r=n??`POINT_100`;return e.formatMessage({id:`{score, number} / {max, number}`,defaultMessage:`{score, number} / {max, number}`},{score:kd(t,r),max:XH[r]??100})},eU=`REMOVE`,tU=``,nU=({answer:e})=>/* @__PURE__ */ V(`span`,{className:`logo`,style:e.tracker.color?{color:e.tracker.color}:void 0,children:/* @__PURE__ */ V(Iw,{icon:e.tracker.icon,name:e.tracker.name})}),rU=e=>e.state===`PAUSED`||e.state===`ERROR`?On(Ld(e)):void 0,iU=(e,t,{busy:n,failed:r})=>t.kind===`check`?n?`busy`:r||e.state===`ERROR`?`error`:e.state===`PAUSED`?`paused`:t.checked?`on`:`off`:t.kind,aU=({answer:e,state:t})=>{let n=L().formatMessage({id:`{name}: {state, select, loading {loading} login {signed out} cannot {cannot track this media} busy {updating} error {error} paused {paused} on {connected} other {off}}`,defaultMessage:`{name}: {state, select, loading {loading} login {signed out} cannot {cannot track this media} busy {updating} error {error} paused {paused} on {connected} other {off}}`},{name:e.tracker.name,state:t});return/* @__PURE__ */ W(`span`,{className:`tile ${t}`,"data-tile":e.tracker.id,role:`img`,"aria-label":n,title:n,children:[/* @__PURE__ */ V(nU,{answer:e}),/* @__PURE__ */ V(`span`,{className:`mark`,children:t===`loading`||t===`busy`?/* @__PURE__ */ V(ox,{size:10,className:`spin`,"aria-hidden":`true`}):void 0})]})},oU=({outcome:e})=>e===`SAVED`||e===`QUEUED`,sU=({answer:e,failed:t})=>t||e.state===`ERROR`?/* @__PURE__ */ V(`span`,{className:`badge red`,"data-badge":`red`}):e.state===`PAUSED`?/* @__PURE__ */ V(`span`,{className:`badge amber`,"data-badge":`amber`}):null,cU=({name:e,shown:t,scale:n,mixed:r,disabled:i,listed:a,removable:o,onChange:s,dots:c={},movie:l=!1,statuses:u,clearable:d})=>{let f=L(),[p,m]=K(),h=G(void 0),g=G(()=>{}),_=t.total,v=()=>{if(clearTimeout(h.current),p===void 0)return;let e=Number(p);if(m(void 0),p.trim()===``||!Number.isFinite(e))return;let n=Math.max(0,Math.min(_??1/0,Math.floor(e)));n!==t.progress&&s({progress:n},!0)};g.current=v;let y=t.status===`COMPLETED`||t.progress>=(_??1);return/* @__PURE__ */ W(`div`,{className:`group edit`,children:[/* @__PURE__ */ V(GH,{score:t.score,scale:n,mixed:r,disabled:i||!a&&!t.status&&!t.progress,clearable:d,onPick:e=>s({score:e},!0)}),c.SCORE,/* @__PURE__ */ W(`select`,{name:`${e}-status`,"aria-label":f.formatMessage({id:`Status`,defaultMessage:`Status`}),value:t.status??``,disabled:i,onChange:e=>{let t=e.currentTarget.value;s(t===eU?{remove:!0}:{status:t},!0)},children:[t.status?void 0:/* @__PURE__ */ V(`option`,{value:``,disabled:!0,children:f.formatMessage({id:`Add to list`,defaultMessage:`Add to list`})}),Md.filter(e=>!u||u.includes(e)).map(e=>/* @__PURE__ */ V(`option`,{value:e,children:JH(f,e)},e)),o?/* @__PURE__ */ V(`option`,{value:eU,children:f.formatMessage({id:`Remove from list`,defaultMessage:`Remove from list`})}):void 0]}),c.STATUS,l?/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`button`,{type:`button`,className:`watched${y?` on`:``}`,"aria-pressed":y,disabled:i,onClick:()=>s(y?{progress:0,...t.status===`COMPLETED`?{status:`PLANNING`}:{}}:{progress:_??1,status:`COMPLETED`},!0),children:[/* @__PURE__ */ V(Nt,{size:14,"aria-hidden":`true`}),f.formatMessage({id:`Watched#marked as seen`,defaultMessage:`Watched`,description:`marked as seen`})]}),c.PROGRESS]}):/* @__PURE__ */ W(`span`,{className:`progress-field`,children:[/* @__PURE__ */ V(`label`,{for:`${e}-progress`,className:`word`,children:f.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),/* @__PURE__ */ V(`input`,{id:`${e}-progress`,type:`number`,inputMode:`numeric`,name:`${e}-progress`,min:0,max:_??void 0,disabled:i,value:p??t.progress,onInput:e=>{m(e.currentTarget.value),clearTimeout(h.current),h.current=setTimeout(()=>g.current(),1e3)},onBlur:v,onKeyDown:e=>{e.key===`Enter`&&v(),e.key===`Escape`&&(clearTimeout(h.current),m(void 0),e.stopPropagation())}}),_?/* @__PURE__ */ V(`span`,{className:`of`,children:f.formatMessage({id:`/ {total}`,defaultMessage:`/ {total}`},{total:_})}):void 0,c.PROGRESS,/* @__PURE__ */ V(`button`,{type:`button`,className:`more`,"aria-label":f.formatMessage({id:`One episode more`,defaultMessage:`One episode more`}),disabled:i||_!=null&&t.progress>=_,onClick:()=>s({progress:t.progress+1},!1),children:/* @__PURE__ */ V(fx,{size:14,"aria-hidden":`true`})})]}),!l&&!i&&_&&t.progress===_&&t.status!==`COMPLETED`&&(!u||u.includes(`COMPLETED`))?/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>s({status:`COMPLETED`},!0),children:f.formatMessage({id:`Mark completed`,defaultMessage:`Mark completed`})}):void 0,!l&&!i&&_&&t.status===`COMPLETED`&&t.progress<_?/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>s({progress:_},!0),children:f.formatMessage({id:`Set {total} / {total}`,defaultMessage:`Set {total} / {total}`},{total:_})}):void 0]})},lU=({answer:e,className:t,busy:n,open:r,onOpen:i,card:a,children:o})=>{let s=G(null);H(()=>{r&&s.current?.focus()},[]);let{refs:c,floatingStyles:l,context:u}=fb({open:r,onOpenChange:(e,t,n)=>{let r=c.floating.current?.contains(document.activeElement)??!1;(e||!r||n!==`hover`&&n!==`safe-polygon`)&&(e&&n===`hover`&&document.activeElement?.closest(`[data-card]`)||(!e&&r&&n===`escape-key`&&s.current?.focus(),i(e)))},placement:`bottom-end`,strategy:`fixed`,whileElementsMounted:$e,middleware:[Uv(8),Gv({padding:8}),Wv({padding:8})]}),{getReferenceProps:d}=gb([ob(u)]),{getReferenceProps:f,getFloatingProps:p}=gb([yy(u,{mouseOnly:!0,delay:{open:100},handleClose:Db()}),mb(u),ub(u)]),m=L().formatMessage({id:`{name} entry`,defaultMessage:`{name} entry`},{name:e.tracker.name});return/* @__PURE__ */ W(`span`,{ref:c.setReference,className:t,"data-chip":e.tracker.id,"aria-busy":n?`true`:void 0,...f(),children:[/* @__PURE__ */ V(`button`,{ref:s,type:`button`,className:`logo-button`,"aria-label":m,"aria-haspopup":`dialog`,"aria-expanded":r,...d(),children:/* @__PURE__ */ V(nU,{answer:e})}),o,r?/* @__PURE__ */ V(`div`,{ref:c.setFloating,style:l,className:`card`,role:`dialog`,"aria-label":m,"data-card":e.tracker.id,...p(),children:a()}):void 0]})},uU=({tracking:e,episodeCount:t,movie:n=!1,watched:r,counted:i,onSaveFields:a,onRemove:o,onActivity:s,signIns:c={},prefs:l,onPrefs:u})=>{let d=L(),[,f]=K(0),[p,m]=K({}),[h,g]=K(),[_,v]=K(),[y,b]=K({}),[x,S]=K({}),[C,w]=K(),T=G({onSaveFields:a,onRemove:o,onActivity:s,tracking:e,episodeCount:t});T.current={onSaveFields:a,onRemove:o,onActivity:s,tracking:e,episodeCount:t};let E=G(!0),D=G({});H(()=>(E.current=!0,()=>{E.current=!1,Object.values(D.current).forEach(clearTimeout),D.current={}}),[]),H(()=>{b(t=>{let n=!1,r={};for(let[i,a]of Object.entries(t)){let t=e?.answers.find(e=>e.tracker.id===i);a===`loading`&&t?.state!==`SIGNED_OUT`?(clearTimeout(D.current[i]),delete D.current[i],n=!0):r[i]=a}return n?r:t})},[e]);let O=G(void 0),k=B(()=>ef({send:async(e,t)=>{let n=await(t.remove?T.current.onRemove([e]):T.current.onSaveFields([e],t));return n.find(t=>t.tracker===e)??n[0]??{outcome:`FAILED`,error:Dc.formatMessage({id:`The write did not reach the trackers`,defaultMessage:`The write did not reach the trackers`})}},shape:(e,t)=>{let{tracking:n,episodeCount:r}=T.current,i=n?.answers.find(t=>t.tracker.id===e);return i&&Kd(i,t,{...Rd(n,r),...t})},steps:e=>Yd(T.current.tracking,e),onChange:e=>{if(f(e=>e+1),!e)return;let t=T.current.tracking?.answers.find(t=>t.tracker.id===e.tracker)?.tracker.name??e.tracker;if(v({...e,name:t}),oU(e)&&O.current){let t=Nd(O.current.from,O.current.to);(!t||Pd(e.fields,t))&&(O.current=void 0,t&&T.current.onActivity?.(t))}!oU(e)&&k.idle()&&m({})}}),[]),A=G(/* @__PURE__ */ new Map),j=G(/* @__PURE__ */ new Map),M=i??j.current,N=e?.answers.find(e=>e.tracker.id===`trakt`&&e.state!==`NO_ID`),P=N?Ud(N,l.targets.trakt):void 0,ee=!!(P&&P.kind===`check`&&P.sendable),te=N?.entry?.progress??0;H(()=>{h&&(!ee||h.targetProgress>=te)&&g(void 0)},[h,ee,te]);let F=(e,t,n)=>{for(let[t,{progress:n}]of Object.entries(e))n!==void 0&&A.current.set(t,n);k.stage(e,t,n)},ne=(e,t,n)=>{let r=e.trakt;if(r&&!r.remove&&r.progress!==void 0&&r.progress!==null){if(r.progress<te){let{trakt:i,...a}=e;Object.keys(a).length&&F(a,t,n),g({patch:r,targetProgress:r.progress,fromCard:n});return}g(void 0)}F(e,t,n)},I=()=>{if(!h)return;let e=h;g(void 0),F({trakt:e.patch},!0,e.fromCard)},re=()=>{h&&(g(void 0),m(e=>{let t={...e};if(delete t.trakt,t[tU]?.progress!==void 0){let{progress:e,...n}=t[tU];Object.keys(n).length?t[tU]=n:delete t[tU]}return t}))};H(()=>{let e=()=>{document.visibilityState===`hidden`&&k.flush()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),k.flush()}},[]);let ie=Rd(e,t),ae=t=>{let n=e?.answers.find(e=>e.tracker.id===t);return n&&Bd(n,ie.total)};H(()=>{m(e=>k.idle()?{}:Object.fromEntries(Object.entries(e).flatMap(([e,t])=>{let n=e===tU?ie:ae(e);return n?[[e,Hd(t,n)]]:[]})))},[e]);let oe=Vd(ie,p[tU]),se=e=>{O.current={from:O.current?.from??oe,to:e}},ce=r&&e&&oe.status!==`COMPLETED`?nf({...r,movie:n},e,l.targets,t):{},le=e=>M.has(e)&&M.get(e)===r?.episode,ue=e?.answers.filter(({tracker:{id:e}})=>ce[e]&&!le(e)&&ce[e].progress>(A.current.get(e)??0))??[];H(()=>{let t=ue.filter(Id);if(r&&e&&r.played>=.85)for(let t of e.answers){let e=Ud(t,l.targets[t.tracker.id]);e.kind===`check`&&e.sendable&&M.set(t.tracker.id,r.episode)}t.length&&(se({...oe,...ce[t[0].tracker.id]}),ne(Object.fromEntries(t.map(({tracker:{id:e}})=>[e,ce[e]])),!0))},[r,e,l]);let de=e?.answers.filter(e=>e.state!==`NO_ID`)??[];if(e!==void 0&&!de.length)return null;let fe=de.map(e=>({answer:e,target:Ud(e,l.targets[e.tracker.id])})),pe=l.expanded===!0,me=fe.filter(({target:e})=>e.kind===`check`&&e.sendable).map(({answer:e})=>e),he=!me.length,ge=Zd(me.map(e=>e.tracker.scoreScale)),_e=de.length>1&&k.idle()?Jd(fe,ie,ge?.scale):{},ve=Object.keys(_e).length>0,ye=()=>{ve&&(se(ie),ne(_e,!0))},be=(e,t)=>{t.remove||m(n=>({...n,[e]:{...n[e],...t}}))},xe=(e,t)=>{be(tU,e);let n={...oe,...e};se(n);let r={};for(let{answer:t,target:i}of fe){if(i.kind!==`check`||!i.checked)continue;let a=t.tracker.id;if(!Id(t)){k.fail(a,e,Ld(t));continue}let o=Kd(t,e,n);o&&(r[a]=o)}ne(r,t)},Se=(e,t,n)=>{let r=e.tracker.id,i=Vd(Bd(e,ie.total),p[r]);be(r,t);let a=Kd(e,t,{...i,...t});a&&ne({[r]:a},n,!0)},Ce=e=>{let t=k.state(e.tracker.id);return t.failed?.fields.remove&&e.state===`NOT_LISTED`?{...t,failed:void 0}:!t.failed&&ue.includes(e)&&!Id(e)?{...t,failed:{fields:ce[e.tracker.id],error:Ld(e)}}:t},we=e=>{u({...l,expanded:!0}),w(e)},Te=(e,t)=>{t||k.drop(e),!t&&!k.state(e).busy&&A.current.delete(e),u({...l,targets:{...l.targets,[e]:t}})},Ee=e=>{let t=c[e.tracker.id],n=e.tracker.id;if(!t||y[n])return;clearTimeout(D.current[n]),delete D.current[n];let r=t();b(e=>({...e,[n]:`window`})),S(({[n]:e,...t})=>t),r.then(t=>({note:KH[t]?.(e.tracker.name),outcome:t}),e=>({note:e instanceof Error?e.message:String(e)})).then(({note:e,outcome:t})=>{if(!E.current)return;e&&S(t=>({...t,[n]:e}));let r=T.current.tracking?.answers.find(e=>e.tracker.id===n)?.state;if((t===`authed`||t===`closed`)&&r===`SIGNED_OUT`){let e=t===`authed`?ZH:QH;b(e=>({...e,[n]:`loading`})),D.current[n]=setTimeout(()=>{delete D.current[n],E.current&&b(({[n]:e,...t})=>t)},e)}else b(({[n]:e,...t})=>t)})},De=(e,t)=>d.formatMessage({id:`{name} cannot track this media: {reason}`,defaultMessage:`{name} cannot track this media: {reason}`},{name:e,reason:On(t)}),Oe=d.formatMessage({id:`Trackers loading`,defaultMessage:`Trackers loading`}),ke=({name:e,outcome:t,fields:n,error:r})=>oU({outcome:t})?n.remove?d.formatMessage({id:`Removed from {name}`,defaultMessage:`Removed from {name}`},{name:e}):d.formatMessage({id:`Saved to {name}`,defaultMessage:`Saved to {name}`},{name:e}):r?d.formatMessage({id:`{name} did not save: {error}`,defaultMessage:`{name} did not save: {error}`},{name:e,error:On(r)}):d.formatMessage({id:`{name} did not save: {outcome, select, REFUSED {refused} other {failed}}`,defaultMessage:`{name} did not save: {outcome, select, REFUSED {refused} other {failed}}`},{name:e,outcome:t}),Ae=(e,t)=>{let n=y[e.tracker.id],r=n!==void 0,i=n===`loading`?d.formatMessage({id:`Loading...`,defaultMessage:`Loading...`}):n===`window`?d.formatMessage({id:`Logging in`,defaultMessage:`Logging in`}):d.formatMessage({id:`Log in`,defaultMessage:`Log in`});return/* @__PURE__ */ W(`button`,{type:`button`,className:t,"aria-label":d.formatMessage({id:`Log in to {name}`,defaultMessage:`Log in to {name}`},{name:e.tracker.name}),disabled:!c[e.tracker.id]||r,"aria-busy":r?`true`:void 0,onClick:()=>Ee(e),children:[r?/* @__PURE__ */ V(ox,{size:14,className:`spin`,"aria-hidden":`true`}):void 0,i]})},je=(e,t)=>{let r=e.tracker.id,i=e.tracker.name,a=/* @__PURE__ */ W(`div`,{className:`head`,children:[/* @__PURE__ */ V(nU,{answer:e}),i,e.tracker.account?/* @__PURE__ */ V(`span`,{className:`account`,children:On(e.tracker.account)}):void 0]});if(t.kind===`loading`)return a;if(t.kind===`login`)return/* @__PURE__ */ W(q,{children:[a,/* @__PURE__ */ V(`span`,{className:`why`,children:d.formatMessage({id:`Signed out`,defaultMessage:`Signed out`})}),Ae(e)]});if(t.kind===`cannot`)return/* @__PURE__ */ W(q,{children:[a,/* @__PURE__ */ V(`span`,{className:`why`,children:De(i,t.reason)})]});let o=Id(e),s=Bd(e,ie.total),c=Zd([e.tracker.scoreScale]);return/* @__PURE__ */ W(q,{children:[a,/* @__PURE__ */ V(cU,{name:`card-${r}`,movie:n,statuses:e.tracker.statuses,clearable:e.tracker.canClearScore!==!1,shown:Vd(s,p[r]),scale:c.scale,mixed:!1,disabled:!o,listed:e.state===`LISTED`,removable:o&&Gd(e),onChange:(t,n)=>Se(e,t,n)}),o?void 0:/* @__PURE__ */ V(`span`,{className:`why`,children:On(Ld(e))})]})},Me=e=>d.formatList(de.filter(e=>e.state===`LISTED`).map(t=>{let n=e(t);return n===void 0?d.formatMessage({id:`{name} none`,defaultMessage:`{name} none`},{name:t.tracker.name}):d.formatMessage({id:`{name} {value}`,defaultMessage:`{name} {value}`},{name:t.tracker.name,value:n})}),Cn),Ne=(e,t)=>ie.differs.includes(e)?/* @__PURE__ */ V(`span`,{className:`differs`,"data-differs":e,title:Me(t)}):void 0;return/* @__PURE__ */ W(`section`,{css:YH,className:`tracking-compact`,"aria-label":d.formatMessage({id:`Quick tracking`,defaultMessage:`Quick tracking`}),children:[/* @__PURE__ */ W(`div`,{className:`row`,children:[/* @__PURE__ */ W(`div`,{className:`group platforms${pe?` expanded`:``}`,children:[/* @__PURE__ */ V(`button`,{type:`button`,className:`expand`,"aria-expanded":pe,"aria-label":pe?d.formatMessage({id:`Trackers`,defaultMessage:`Trackers`}):void 0,title:pe?d.formatMessage({id:`Collapse trackers`,defaultMessage:`Collapse trackers`}):void 0,onClick:()=>u({...l,expanded:!pe}),children:pe?/* @__PURE__ */ V(qb,{size:14,"aria-hidden":`true`}):/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`span`,{className:`tiles`,children:e===void 0?/* @__PURE__ */ V(`span`,{className:`tile loading`,role:`img`,"aria-label":Oe,title:Oe,children:/* @__PURE__ */ V(ox,{size:12,className:`spin`,"aria-hidden":`true`})}):fe.map(({answer:e,target:t})=>{let n=y[e.tracker.id],r=n===`window`||n===`loading`&&e.state===`SIGNED_OUT`;return/* @__PURE__ */ V(aU,{answer:e,state:r?`loading`:iU(e,t,Ce(e))},e.tracker.id)})}),/* @__PURE__ */ V(Kb,{size:12,"aria-hidden":`true`})]})}),pe&&e===void 0?/* @__PURE__ */ V(`span`,{className:`chip loading`,children:/* @__PURE__ */ V(`span`,{className:`slot`,role:`img`,"aria-label":Oe,children:/* @__PURE__ */ V(ox,{size:14,className:`spin`,"aria-hidden":`true`})})}):void 0,pe&&fe.map(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name,i={answer:e,open:C===n,onOpen:e=>w(t=>e?n:t===n?void 0:t),card:()=>je(e,t)};if(t.kind===`loading`)return/* @__PURE__ */ V(lU,{...i,className:`chip loading`,busy:!0,children:/* @__PURE__ */ V(`span`,{className:`slot`,role:`img`,"aria-label":d.formatMessage({id:`{name} loading`,defaultMessage:`{name} loading`},{name:r}),children:/* @__PURE__ */ V(ox,{size:14,className:`spin`,"aria-hidden":`true`})})},n);if(t.kind===`login`){let t=!!y[n];return/* @__PURE__ */ V(lU,{...i,busy:t,className:`chip login${t?` loading`:``}`,children:Ae(e,`login-button`)},n)}if(t.kind===`cannot`)return/* @__PURE__ */ V(lU,{...i,className:`chip cannot`,children:/* @__PURE__ */ V(`span`,{className:`slot`,role:`img`,"aria-label":De(r,t.reason),children:/* @__PURE__ */ V(ux,{size:14,"aria-hidden":`true`})})},n);let{busy:a,failed:o}=Ce(e),s=rU(e);return/* @__PURE__ */ W(lU,{...i,className:`chip${t.checked?``:` off`}`,busy:a,children:[/* @__PURE__ */ W(`label`,{children:[/* @__PURE__ */ V(`input`,{type:`checkbox`,className:`sr-only`,name:`compact-target-${n}`,"aria-label":d.formatMessage({id:`Save to {name}`,defaultMessage:`Save to {name}`},{name:r}),"aria-describedby":s?`compact-hint-${n}`:void 0,checked:t.checked,onChange:e=>Te(n,e.currentTarget.checked)}),/* @__PURE__ */ V(`span`,{className:`slot`,children:a?/* @__PURE__ */ V(ox,{size:14,className:`spin`,"aria-hidden":`true`}):t.checked?/* @__PURE__ */ V(`span`,{className:`check`,children:/* @__PURE__ */ V(Nt,{size:11,"aria-hidden":`true`})}):/* @__PURE__ */ V(`span`,{className:`ring`})})]}),/* @__PURE__ */ V(sU,{answer:e,failed:o}),s?/* @__PURE__ */ V(`span`,{id:`compact-hint-${n}`,className:`sr-only`,children:s}):void 0]},n)}),!he&&ve?/* @__PURE__ */ V(`button`,{type:`button`,className:`sync-all`,onClick:ye,children:d.formatMessage({id:`Sync all`,defaultMessage:`Sync all`})}):void 0]}),/* @__PURE__ */ V(cU,{name:`compact`,movie:n,shown:oe,scale:ge?.scale??`POINT_100`,mixed:ge?.mixed??!1,disabled:he,listed:de.some(e=>e.state===`LISTED`),removable:me.some(Gd),onChange:xe,dots:{SCORE:Ne(`SCORE`,e=>Od(e.entry?.score)?$H(d,e.entry.score,e.tracker.scoreScale):void 0),STATUS:Ne(`STATUS`,e=>e.entry?.status?JH(d,e.entry.status):void 0),PROGRESS:Ne(`PROGRESS`,e=>e.entry?.progress==null?void 0:String(e.entry.progress))}})]}),/* @__PURE__ */ W(`div`,{className:`notes`,children:[fe.flatMap(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name;return[x[n]&&e.state===`SIGNED_OUT`?/* @__PURE__ */ W(`div`,{className:`note`,"data-note":n,children:[On(x[n]),pe?void 0:Ae(e)]},`${n}-sign-in`):void 0,/* @__PURE__ */ V(zH,{answer:e,state:Ce(e),queue:k},`${n}-problems`),t.kind===`check`&&t.sendable&&Wd(e,ie.total)?/* @__PURE__ */ W(`div`,{className:`note`,"data-note":n,children:[d.formatMessage({id:`{name}: set progress on its card`,defaultMessage:`{name}: set progress on its card`},{name:r}),pe?void 0:/* @__PURE__ */ V(`button`,{type:`button`,"aria-haspopup":`dialog`,onClick:()=>we(n),children:d.formatMessage({id:`Open`,defaultMessage:`Open`})})]},`${n}-count`):void 0].filter(Boolean)}),h&&ee&&h.targetProgress<te?/* @__PURE__ */ W(`div`,{className:`note`,"data-note":`trakt`,"data-confirm":`trakt-lower`,children:[/* @__PURE__ */ V(`span`,{children:d.formatMessage({id:`Lowering progress on Trakt to {target} deletes every recorded play above it, including rewatches.`,defaultMessage:`Lowering progress on Trakt to {target} deletes every recorded play above it, including rewatches.`},{target:h.targetProgress})}),/* @__PURE__ */ V(`button`,{type:`button`,onClick:I,children:d.formatMessage({id:`Remove Trakt plays`,defaultMessage:`Remove Trakt plays`})}),/* @__PURE__ */ V(`button`,{type:`button`,onClick:re,children:d.formatMessage({id:`Cancel`,defaultMessage:`Cancel`})})]},`trakt-confirm-lower`):void 0]}),/* @__PURE__ */ V(`div`,{className:`sr-only`,role:`status`,children:_?ke(_):``})]})};U();var dU=RC(`
3652
3652
  mutation DeleteListEntry($input: DeleteListEntryInput!) {
3653
3653
  deleteListEntry(input: $input) {
3654
3654
  tracker
@@ -3656,7 +3656,7 @@ overflow-wrap: anywhere;
3656
3656
  error
3657
3657
  }
3658
3658
  }
3659
- `),uU=RC(`
3659
+ `),fU=RC(`
3660
3660
  subscription StubTrackerStorage {
3661
3661
  stubTrackerStorage {
3662
3662
  location
@@ -3667,7 +3667,7 @@ overflow-wrap: anywhere;
3667
3667
  error
3668
3668
  }
3669
3669
  }
3670
- `),dU=RC(`
3670
+ `),pU=RC(`
3671
3671
  mutation AddHeldStubEntries {
3672
3672
  addHeldStubEntries {
3673
3673
  location
@@ -3678,7 +3678,7 @@ overflow-wrap: anywhere;
3678
3678
  error
3679
3679
  }
3680
3680
  }
3681
- `),fU=e=>[{tracker:``,outcome:`FAILED`,error:e??Dc.formatMessage({id:`The write did not reach the trackers`,defaultMessage:`The write did not reach the trackers`})}],pU=e=>e.state===`LOADING`,mU=e=>!pU(e)&&e.state!==`NO_ID`,hU=(e,t)=>e&&t?.answers.some(t=>pU(t)&&e.answers.some(e=>e.tracker.id===t.tracker.id&&mU(e)))?e:t??void 0,gU=e=>e.state===zc.Ambiguous,_U=(e,t)=>e&&e._id!==PH(t)&&e.answers.some(gU)?{...e,answers:e.answers.map(e=>gU(e)?{...e,state:zc.Loading}:e)}:e,vU=e=>e&&{...e,summary:null,disagreements:[],answers:e.answers.map(e=>e.state===zc.NoId?e:{...e,state:zc.Loading,entry:null})},yU=(e,t)=>{let[n,r]=K({episode:t,played:0});return H(()=>{if(!e)return;let n=!1;return e.onReport(({paused:i,time:a})=>{n||=!i;let o=e.duration?.()??0,s=o>0?i?0:a/o:e.ended?.()?Number(n):0;r(e=>e.episode!==t||s>e.played?{episode:t,played:s}:e)})},[e,t]),n},bU=({work:e,address:t,uri:n,title:r,cover:i,episodeCount:a,movie:o,prefsStore:s=yd,notice:c=!0,link:l,episode:u,sameWork:d,counted:f})=>{let p=L(),m=n??e,[{data:h}]=Zs({query:oT,variables:{input:{uri:m}},pause:!m}),g=B(()=>_U(h?.tracking,m),[h?.tracking,m]),_=G(void 0);_.current=hU(_U(_.current,m),g);let v=!!(n&&nT(e,t)),y=cT({uri:n,title:r,cover:i,episodeCount:a,type:o?Lc.Movie:void 0}),[,b]=Ys(lU),[{data:x}]=Zs({query:uU,pause:!c}),[,S]=Ys(dU),[C,w]=K(s.read),[T]=K(d?void 0:l),E=yU(l===T?void 0:l,u),D=h?.tracking?.answers;return H(()=>{D&&te(D,le,qn)},[D]),H(()=>bd(()=>w(s.read())),[s]),/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(cU,{tracking:v?_.current:vU(_.current),episodeCount:v?a:void 0,movie:o,watched:E,counted:f,onSaveFields:y,onRemove:async e=>{let t=await b({input:{uri:n,trackers:e}});return t.data?.deleteListEntry??fU(t.error?.message)},onActivity:({kind:e,episode:t})=>{n&&NH({kind:e,detail:t===void 0?void 0:p.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:t}),title:r,uri:n,cover:i})},signIns:Jn,prefs:C,onPrefs:e=>{s.write(e),w(e)}}),/* @__PURE__ */ V(IH,{storage:x?.stubTrackerStorage,onUnlock:async()=>{await su()&&await rr()},onAdd:()=>S({})})]})},xU=e=>{let t=lT(e.uri??e.work),n=G({work:e.work,uri:e.uri,counted:/* @__PURE__ */ new Map}),{work:r,uri:i,counted:a}=n.current,o=r===e.work||nT(r,e.work)||nT(i,e.work);return n.current={work:e.work,uri:e.uri,counted:o?a:/* @__PURE__ */ new Map},/* @__PURE__ */ V(bU,{...e,sameWork:o,counted:n.current.counted},`${e.work} ${t}`)};U();var SU=({label:e,labelledBy:t,onClose:n,children:r,...i})=>{let{refs:a,context:o,elements:s}=fb({open:!0,onOpenChange:(e,t)=>{t?.target===a.reference.current&&n()}}),c=G(n);c.current=n,H(()=>{let e=s.floating;if(!e)return;let t=e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),c.current())};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[s.floating]);let{getReferenceProps:l,getFloatingProps:u}=gb([ob(o,{keyboardHandlers:!1})]),{onKeyDown:d,onKeyUp:f,...p}=l();return/* @__PURE__ */ V(By,{children:/* @__PURE__ */ V(nb,{lockScroll:!0,...i,ref:a.setReference,...p,children:/* @__PURE__ */ V(Zy,{context:o,initialFocus:a.floating,children:/* @__PURE__ */ V(`div`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-label":e,"aria-labelledby":t,tabIndex:-1,ref:a.setFloating,...u(),children:r})})})})},CU=R`
3681
+ `),mU=e=>[{tracker:``,outcome:`FAILED`,error:e??Dc.formatMessage({id:`The write did not reach the trackers`,defaultMessage:`The write did not reach the trackers`})}],hU=e=>e.state===`LOADING`,gU=e=>!hU(e)&&e.state!==`NO_ID`,_U=(e,t)=>e&&t?.answers.some(t=>hU(t)&&e.answers.some(e=>e.tracker.id===t.tracker.id&&gU(e)))?e:t??void 0,vU=e=>e.state===zc.Ambiguous,yU=(e,t)=>e&&e._id!==PH(t)&&e.answers.some(vU)?{...e,answers:e.answers.map(e=>vU(e)?{...e,state:zc.Loading}:e)}:e,bU=e=>e&&{...e,summary:null,disagreements:[],answers:e.answers.map(e=>e.state===zc.NoId?e:{...e,state:zc.Loading,entry:null})},xU=(e,t)=>{let[n,r]=K({episode:t,played:0});return H(()=>{if(!e)return;let n=!1;return e.onReport(({paused:i,time:a})=>{n||=!i;let o=e.duration?.()??0,s=o>0?i?0:a/o:e.ended?.()?Number(n):0;r(e=>e.episode!==t||s>e.played?{episode:t,played:s}:e)})},[e,t]),n},SU=({work:e,address:t,uri:n,title:r,cover:i,episodeCount:a,movie:o,prefsStore:s=yd,notice:c=!0,link:l,episode:u,sameWork:d,counted:f})=>{let p=L(),m=n??e,[{data:h}]=Zs({query:oT,variables:{input:{uri:m}},pause:!m}),g=B(()=>yU(h?.tracking,m),[h?.tracking,m]),_=G(void 0);_.current=_U(yU(_.current,m),g);let v=!!(n&&nT(e,t)),y=cT({uri:n,title:r,cover:i,episodeCount:a,type:o?Lc.Movie:void 0}),[,b]=Ys(dU),[{data:x}]=Zs({query:fU,pause:!c}),[,S]=Ys(pU),[C,w]=K(s.read),[T]=K(d?void 0:l),E=xU(l===T?void 0:l,u),D=h?.tracking?.answers;return H(()=>{D&&te(D,le,qn)},[D]),H(()=>bd(()=>w(s.read())),[s]),/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(uU,{tracking:v?_.current:bU(_.current),episodeCount:v?a:void 0,movie:o,watched:E,counted:f,onSaveFields:y,onRemove:async e=>{let t=await b({input:{uri:n,trackers:e}});return t.data?.deleteListEntry??mU(t.error?.message)},onActivity:({kind:e,episode:t})=>{n&&NH({kind:e,detail:t===void 0?void 0:p.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:t}),title:r,uri:n,cover:i})},signIns:Jn,prefs:C,onPrefs:e=>{s.write(e),w(e)}}),/* @__PURE__ */ V(IH,{storage:x?.stubTrackerStorage,onUnlock:async()=>{await su()&&await rr()},onAdd:()=>S({})})]})},CU=e=>{let t=lT(e.uri??e.work),n=G({work:e.work,uri:e.uri,counted:/* @__PURE__ */ new Map}),{work:r,uri:i,counted:a}=n.current,o=r===e.work||nT(r,e.work)||nT(i,e.work);return n.current={work:e.work,uri:e.uri,counted:o?a:/* @__PURE__ */ new Map},/* @__PURE__ */ V(SU,{...e,sameWork:o,counted:n.current.counted},`${e.work} ${t}`)};U();var wU=({label:e,labelledBy:t,onClose:n,children:r,...i})=>{let{refs:a,context:o,elements:s}=fb({open:!0,onOpenChange:(e,t)=>{t?.target===a.reference.current&&n()}}),c=G(n);c.current=n,H(()=>{let e=s.floating;if(!e)return;let t=e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),c.current())};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[s.floating]);let{getReferenceProps:l,getFloatingProps:u}=gb([ob(o,{keyboardHandlers:!1})]),{onKeyDown:d,onKeyUp:f,...p}=l();return/* @__PURE__ */ V(By,{children:/* @__PURE__ */ V(nb,{lockScroll:!0,...i,ref:a.setReference,...p,children:/* @__PURE__ */ V(Zy,{context:o,initialFocus:a.floating,children:/* @__PURE__ */ V(`div`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-label":e,"aria-labelledby":t,tabIndex:-1,ref:a.setFloating,...u(),children:r})})})})},TU=R`
3682
3682
  font-size: 1.2rem;
3683
3683
  padding: 0.15rem 0.6rem;
3684
3684
  border: 1px solid rgba(255, 255, 255, 0.25);
@@ -3686,9 +3686,9 @@ overflow-wrap: anywhere;
3686
3686
  white-space: nowrap;
3687
3687
 
3688
3688
  &:hover { border-color: rgba(255, 255, 255, 0.5); }
3689
- `,wU=({uri:e})=>{let t=fO(Ih());return!e||!er(`?${t}`,`http://d/`)?null:/* @__PURE__ */ V(Uh,{css:CU,"data-trace-link":e,href:oO({uri:e,search:t}),title:`what the graph holds for this uri`,children:`graph trace`})},TU={nf:`207360008/s100/netflix`,amazon:`322992749/s100/amazonprime`,appletv:`338367329/s100/appletvplus`,disney:`313118777/s100/disneyplus`,hulu:`116305230/s100/hulu`,fubo:`316727345/s100/fubotv`,cr:`324213205/s100/crunchyroll`,paramount:`332803145/s100/paramountpluspremium`,philo:`327419079/s100/philo`,roku:`76972041/s100/rokuchannel`,amcplus:`277399832/s100/amcplus`,hoopla:`80212823/s100/hoopla`,pluto:`312204955/s100/plutotv`,hidive:`254161830/s100/hidive`,plex:`301832745/s100/plex`,hbo:`332884837/s100/max`,starz:`301254735/s100/starz`,peacock:`194173871/s100/peacocktvpremium`,tubi:`313528601/s100/tubitv`},EU=e=>TU[e]?`https://images.justwatch.com/icon/${TU[e]}.webp`:void 0;U();var DU=3,OU=({episode:e,mediaUri:t,sources:n,settled:r,startDate:i,status:a},o)=>{let{released:s,upcoming:c}=zT({startDate:i,status:a,episode:e},new Date(o)),l=!c&&e?.uri&&n.some(t=>!t.external||!!e?.handles?.some(({relation:e,node:n})=>e===`SAME_AS`&&n.origin===t.id&&JT(n.origin,n.url,`extension`)))?ag(Q.WATCH,{mediaUri:t,episodeUri:e.uri}):void 0,u=!c&&!n.length,d=u&&!s&&a===`NOT_YET_RELEASED`;return{released:s,upcoming:c,play:l,none:u,announced:d,holding:!c&&!d&&!r}},kU=e=>{try{return new URL(e??``).hostname.replace(/^www\./,``)}catch{return}},AU=({source:e})=>{let t=EU(e.id),n=[t,e.icon].filter(e=>!!e),[r,i]=K(0),a=n[r];return/* @__PURE__ */ V(`span`,{className:t&&a===t?`logo sharp`:`logo`,children:a?/* @__PURE__ */ V(`img`,{src:a,alt:``,onError:()=>i(r+1)}):e.name.charAt(0)})},jU=(e,t)=>e?.handles?.flatMap(({relation:e,node:n})=>e===`SAME_AS`&&n.origin===t?n.thumbnails??[]:[]),MU=({source:e,pictures:t})=>{let n=L(),[r,i]=K(/* @__PURE__ */ new Set),a=Lw(t,r),o=/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`span`,{className:a?`picture`:`picture logo-led`,children:[a?/* @__PURE__ */ V(`img`,{className:`still`,src:a,alt:``,loading:`lazy`,onError:()=>i(e=>new Set(e).add(a))}):void 0,/* @__PURE__ */ V(AU,{source:e}),/* @__PURE__ */ V(`span`,{className:`mark`,"aria-hidden":`true`,children:e.external?qw.external:qw.play})]}),/* @__PURE__ */ W(`span`,{className:`body`,children:[/* @__PURE__ */ W(`span`,{className:`head`,children:[/* @__PURE__ */ V(`span`,{className:`name`,children:e.name}),e.releases&&e.releases.length>1?/* @__PURE__ */ V(`span`,{className:`count`,children:e.releases.length}):void 0]}),/* @__PURE__ */ V(`span`,{className:`how`,children:e.external?kU(e.href):n.formatMessage({id:`Plays here`,defaultMessage:`Plays here`})})]})]}),s={title:e.name,style:{"--brand":Hw(e)}};return e.external||!e.href?/* @__PURE__ */ V(`a`,{className:`source`,href:e.href,target:`_blank`,rel:`noreferrer`,...s,children:o}):/* @__PURE__ */ V(Uh,{className:`source plays`,href:e.href,...s,children:o})},NU=({children:e,...t})=>{let n=L(),r=WT(),{released:i,upcoming:a,play:o,none:s,announced:c,holding:l}=OU(t,r),u=!o&&l&&(s||t.sources.some(e=>e.external&&JT(e.id,e.href,`extension`))),d=a?ST(i,new Date(r)):void 0;return/* @__PURE__ */ W(`div`,{className:`movie`,children:[d?/* @__PURE__ */ W(`div`,{className:`release`,children:[/* @__PURE__ */ V(`span`,{className:d.partial?`day partial`:`day`,children:d.day}),/* @__PURE__ */ V(`span`,{className:`date`,children:d.date}),d.count?/* @__PURE__ */ V(`span`,{className:`count`,children:d.count}):void 0]}):c?/* @__PURE__ */ W(`div`,{className:`release`,children:[/* @__PURE__ */ V(`span`,{className:`day partial`,children:n.formatMessage({id:`Coming soon`,defaultMessage:`Coming soon`})}),/* @__PURE__ */ V(`span`,{className:`date`,children:n.formatMessage({id:`No release date yet`,defaultMessage:`No release date yet`})})]}):void 0,/* @__PURE__ */ W(`div`,{className:`actions`,children:[o?/* @__PURE__ */ W(Uh,{className:`play`,href:o,children:[/* @__PURE__ */ V(pt,{size:20,fill:`currentColor`,"aria-hidden":`true`}),n.formatMessage({id:`Play`,defaultMessage:`Play`})]}):u?/* @__PURE__ */ V(rw,{className:`play-pending`}):void 0,e]})]})},PU=e=>{let t=L(),n=cd(),{none:r,announced:i,holding:a}=OU(e,WT()),o=e.sources.filter(e=>!n.has(e.id)),s=a?Math.max(0,DU-o.length):0;return o.length||s?/* @__PURE__ */ W(`ul`,{className:`sources`,children:[o.map(t=>/* @__PURE__ */ V(`li`,{children:/* @__PURE__ */ V(MU,{source:t,pictures:jU(e.episode,t.id)})},t.id)),Array.from({length:s},(e,t)=>/* @__PURE__ */ V(`li`,{children:/* @__PURE__ */ V(rw,{className:`source-pending`})},t))]}):r&&e.settled&&!i?/* @__PURE__ */ V(`p`,{className:`none`,children:t.formatMessage({id:`No sources yet`,defaultMessage:`No sources yet`})}):null},FU={sciencefiction:`scifi`},IU=e=>{let t=e.toLowerCase().replace(/[^\p{L}\p{N}]/gu,``);return(FU[t]??t).replace(/(ine|al|s)$/,``)},LU=()=>new Set(ya===`anime`?[`Animation`,`Anime`].map(IU):[]),RU=e=>e.split(/\s*(?:&|\/|\band\b)\s*/i).filter(Boolean).map(IU),zU=(e=[],t=[])=>{let n=LU(),r=new Set(e.map(RU).flatMap(e=>e.length===1?e:[])),i=/* @__PURE__ */ new Set,a=e.filter(e=>{let t=RU(e),a=t.join(`+`),o=i.has(a)||(t.length===1?n.has(a):t.some(e=>r.has(e)));return i.add(a),!o}),o=/* @__PURE__ */ new Set([...n,...a.flatMap(RU)]);return{genres:a,tags:t.filter(e=>{let t=!o.has(IU(e));return o.add(IU(e)),t}).slice(0,5)}},BU=e=>pn([e_(e.type),rE(e,{locale:J.locale}),QT(e)]),VU=(e,t=/* @__PURE__ */ new Date)=>{let n=e.episodes?.at(0),{released:r,upcoming:i}=zT({startDate:e.startDate,status:e.status,episode:n},t);return pn([J.formatMessage({id:`Movie`,defaultMessage:`Movie`}),i?void 0:_T(r,{locale:J.locale}),xT(n?.runtime??e.duration)])},HU=(e,t,n=/* @__PURE__ */ new Date)=>{let{genres:r,tags:i}=zU(e.genres??[],e.tags??[]);return{genres:r,tags:i,aired:t?void 0:rE(e,{locale:J.locale}),upcoming:!t&&zT({startDate:e.startDate,status:e.status},n).upcoming}},UU=R`
3689
+ `,EU=({uri:e})=>{let t=fO(Ih());return!e||!er(`?${t}`,`http://d/`)?null:/* @__PURE__ */ V(Uh,{css:TU,"data-trace-link":e,href:oO({uri:e,search:t}),title:`what the graph holds for this uri`,children:`graph trace`})},DU={nf:`207360008/s100/netflix`,amazon:`322992749/s100/amazonprime`,appletv:`338367329/s100/appletvplus`,disney:`313118777/s100/disneyplus`,hulu:`116305230/s100/hulu`,fubo:`316727345/s100/fubotv`,cr:`324213205/s100/crunchyroll`,paramount:`332803145/s100/paramountpluspremium`,philo:`327419079/s100/philo`,roku:`76972041/s100/rokuchannel`,amcplus:`277399832/s100/amcplus`,hoopla:`80212823/s100/hoopla`,pluto:`312204955/s100/plutotv`,hidive:`254161830/s100/hidive`,plex:`301832745/s100/plex`,hbo:`332884837/s100/max`,starz:`301254735/s100/starz`,peacock:`194173871/s100/peacocktvpremium`,tubi:`313528601/s100/tubitv`},OU=e=>DU[e]?`https://images.justwatch.com/icon/${DU[e]}.webp`:void 0;U();var kU=3,AU=({episode:e,mediaUri:t,sources:n,settled:r,startDate:i,status:a},o)=>{let{released:s,upcoming:c}=zT({startDate:i,status:a,episode:e},new Date(o)),l=!c&&e?.uri&&n.some(t=>!t.external||!!e?.handles?.some(({relation:e,node:n})=>e===`SAME_AS`&&n.origin===t.id&&JT(n.origin,n.url,`extension`)))?ag(Q.WATCH,{mediaUri:t,episodeUri:e.uri}):void 0,u=!c&&!n.length,d=u&&!s&&a===`NOT_YET_RELEASED`;return{released:s,upcoming:c,play:l,none:u,announced:d,holding:!c&&!d&&!r}},jU=e=>{try{return new URL(e??``).hostname.replace(/^www\./,``)}catch{return}},MU=({source:e})=>{let t=OU(e.id),n=[t,e.icon].filter(e=>!!e),[r,i]=K(0),a=n[r];return/* @__PURE__ */ V(`span`,{className:t&&a===t?`logo sharp`:`logo`,children:a?/* @__PURE__ */ V(`img`,{src:a,alt:``,onError:()=>i(r+1)}):e.name.charAt(0)})},NU=(e,t)=>e?.handles?.flatMap(({relation:e,node:n})=>e===`SAME_AS`&&n.origin===t?n.thumbnails??[]:[]),PU=({source:e,pictures:t})=>{let n=L(),[r,i]=K(/* @__PURE__ */ new Set),a=Lw(t,r),o=/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`span`,{className:a?`picture`:`picture logo-led`,children:[a?/* @__PURE__ */ V(`img`,{className:`still`,src:a,alt:``,loading:`lazy`,onError:()=>i(e=>new Set(e).add(a))}):void 0,/* @__PURE__ */ V(MU,{source:e}),/* @__PURE__ */ V(`span`,{className:`mark`,"aria-hidden":`true`,children:e.external?qw.external:qw.play})]}),/* @__PURE__ */ W(`span`,{className:`body`,children:[/* @__PURE__ */ W(`span`,{className:`head`,children:[/* @__PURE__ */ V(`span`,{className:`name`,children:e.name}),e.releases&&e.releases.length>1?/* @__PURE__ */ V(`span`,{className:`count`,children:e.releases.length}):void 0]}),/* @__PURE__ */ V(`span`,{className:`how`,children:e.external?jU(e.href):n.formatMessage({id:`Plays here`,defaultMessage:`Plays here`})})]})]}),s={title:e.name,style:{"--brand":Hw(e)}};return e.external||!e.href?/* @__PURE__ */ V(`a`,{className:`source`,href:e.href,target:`_blank`,rel:`noreferrer`,...s,children:o}):/* @__PURE__ */ V(Uh,{className:`source plays`,href:e.href,...s,children:o})},FU=({children:e,...t})=>{let n=L(),r=WT(),{released:i,upcoming:a,play:o,none:s,announced:c,holding:l}=AU(t,r),u=!o&&l&&(s||t.sources.some(e=>e.external&&JT(e.id,e.href,`extension`))),d=a?ST(i,new Date(r)):void 0;return/* @__PURE__ */ W(`div`,{className:`movie`,children:[d?/* @__PURE__ */ W(`div`,{className:`release`,children:[/* @__PURE__ */ V(`span`,{className:d.partial?`day partial`:`day`,children:d.day}),/* @__PURE__ */ V(`span`,{className:`date`,children:d.date}),d.count?/* @__PURE__ */ V(`span`,{className:`count`,children:d.count}):void 0]}):c?/* @__PURE__ */ W(`div`,{className:`release`,children:[/* @__PURE__ */ V(`span`,{className:`day partial`,children:n.formatMessage({id:`Coming soon`,defaultMessage:`Coming soon`})}),/* @__PURE__ */ V(`span`,{className:`date`,children:n.formatMessage({id:`No release date yet`,defaultMessage:`No release date yet`})})]}):void 0,/* @__PURE__ */ W(`div`,{className:`actions`,children:[o?/* @__PURE__ */ W(Uh,{className:`play`,href:o,children:[/* @__PURE__ */ V(pt,{size:20,fill:`currentColor`,"aria-hidden":`true`}),n.formatMessage({id:`Play`,defaultMessage:`Play`})]}):u?/* @__PURE__ */ V(rw,{className:`play-pending`}):void 0,e]})]})},IU=e=>{let t=L(),n=cd(),{none:r,announced:i,holding:a}=AU(e,WT()),o=e.sources.filter(e=>!n.has(e.id)),s=a?Math.max(0,kU-o.length):0;return o.length||s?/* @__PURE__ */ W(`ul`,{className:`sources`,children:[o.map(t=>/* @__PURE__ */ V(`li`,{children:/* @__PURE__ */ V(PU,{source:t,pictures:NU(e.episode,t.id)})},t.id)),Array.from({length:s},(e,t)=>/* @__PURE__ */ V(`li`,{children:/* @__PURE__ */ V(rw,{className:`source-pending`})},t))]}):r&&e.settled&&!i?/* @__PURE__ */ V(`p`,{className:`none`,children:t.formatMessage({id:`No sources yet`,defaultMessage:`No sources yet`})}):null},LU={sciencefiction:`scifi`},RU=e=>{let t=e.toLowerCase().replace(/[^\p{L}\p{N}]/gu,``);return(LU[t]??t).replace(/(ine|al|s)$/,``)},zU=()=>new Set(ya===`anime`?[`Animation`,`Anime`].map(RU):[]),BU=e=>e.split(/\s*(?:&|\/|\band\b)\s*/i).filter(Boolean).map(RU),VU=(e=[],t=[])=>{let n=zU(),r=new Set(e.map(BU).flatMap(e=>e.length===1?e:[])),i=/* @__PURE__ */ new Set,a=e.filter(e=>{let t=BU(e),a=t.join(`+`),o=i.has(a)||(t.length===1?n.has(a):t.some(e=>r.has(e)));return i.add(a),!o}),o=/* @__PURE__ */ new Set([...n,...a.flatMap(BU)]);return{genres:a,tags:t.filter(e=>{let t=!o.has(RU(e));return o.add(RU(e)),t}).slice(0,5)}},HU=e=>pn([e_(e.type),rE(e,{locale:J.locale}),QT(e)]),UU=(e,t=/* @__PURE__ */ new Date)=>{let n=e.episodes?.at(0),{released:r,upcoming:i}=zT({startDate:e.startDate,status:e.status,episode:n},t);return pn([J.formatMessage({id:`Movie`,defaultMessage:`Movie`}),i?void 0:_T(r,{locale:J.locale}),xT(n?.runtime??e.duration)])},WU=(e,t,n=/* @__PURE__ */ new Date)=>{let{genres:r,tags:i}=VU(e.genres??[],e.tags??[]);return{genres:r,tags:i,aired:t?void 0:rE(e,{locale:J.locale}),upcoming:!t&&zT({startDate:e.startDate,status:e.status},n).upcoming}},GU=R`
3690
3690
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
3691
- `,WU=()=>/* @__PURE__ */ V(`div`,{css:UU,children:L().formatMessage({id:`404 No page found`,defaultMessage:`404 No page found`})});U();var GU=(e,t)=>{H(()=>{if(!e||!t)return;let n=document.head.querySelector(`link[rel="canonical"]`)??document.createElement(`link`);return n.setAttribute(`rel`,`canonical`),n.setAttribute(`href`,new URL(ag(Q.TITLE,{uri:e,name:t}),location.origin).href),document.head.append(n),()=>n.remove()},[e,t])};U();var KU=document.title,qU=e=>{H(()=>(document.title=e?`${e} - ${KU}`:KU,()=>{document.title=KU}),[e])};U();var JU=R`
3691
+ `,KU=()=>/* @__PURE__ */ V(`div`,{css:GU,children:L().formatMessage({id:`404 No page found`,defaultMessage:`404 No page found`})});U();var qU=(e,t)=>{H(()=>{if(!e||!t)return;let n=document.head.querySelector(`link[rel="canonical"]`)??document.createElement(`link`);return n.setAttribute(`rel`,`canonical`),n.setAttribute(`href`,new URL(ag(Q.TITLE,{uri:e,name:t}),location.origin).href),document.head.append(n),()=>n.remove()},[e,t])};U();var JU=document.title,YU=e=>{H(()=>(document.title=e?`${e} - ${JU}`:JU,()=>{document.title=JU}),[e])};U();var XU=R`
3692
3692
  z-index: ${Aa.mediaModal};
3693
3693
  padding: 5rem 1rem;
3694
3694
  background-color: hsla(0, 0%, 0%, 0.439);
@@ -4411,7 +4411,7 @@ scrollbar-gutter: stable;
4411
4411
  }
4412
4412
  }
4413
4413
  }
4414
- `,YU=({media:e,movie:t,loading:n})=>{let r=WT();return/* @__PURE__ */ W(`span`,{className:`line`,children:[t?VU(e,new Date(r)):BU(e),n?/* @__PURE__ */ V(Fw,{}):void 0]})},XU=({media:e,movie:t})=>{let n=L(),{genres:r,tags:i,aired:a,upcoming:o}=HU(e,t);return/* @__PURE__ */ W(q,{children:[e.averageScore?/* @__PURE__ */ V(hk,{percent:e.averageScore}):void 0,/* @__PURE__ */ V(pk,{genres:r,tags:i,linked:!0}),a?/* @__PURE__ */ V(`dl`,{className:`facts`,children:/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`dt`,{children:o?n.formatMessage({id:`Releases#verb`,defaultMessage:`Releases`,description:`verb`}):n.formatMessage({id:`Aired`,defaultMessage:`Aired`})}),/* @__PURE__ */ V(`dd`,{children:a})]})}):void 0]})},ZU=({mediaNodes:e,closeTo:t=`/`})=>{let n=L(),r=At(),i=Nh(),a={...i,uri:Tn(i.uri)},[,o]=Fh(),s=rT(a.uri,e),[c,l]=K(a.uri);H(()=>{l(e=>e&&Dn(e,a.uri??``)?e:a.uri)},[a.uri]);let[{data:u,operation:d}]=Zs({query:fE,variables:{input:{uri:c},descriptionInput:{type:Nc.Html}},pause:!c}),f=u?.media??s,p=iT({data:u,operation:d},c),m=B(()=>f?.titles?.at(0)?.title,[f]);qU(m),GU(f?.uri??a.uri,m);let h=!!(u?.media&&CT(u.media)),g=h?u?.media?.episodes.at(0):void 0,{sources:_,answered:v}=xE(g,f?.uri??``,f?.handles),y=SE(c,p?.settled&&v),b=h&&u?.media?{episode:g,mediaUri:u.media.uri,sources:_,settled:y,startDate:u.media.startDate,status:u.media.status}:void 0,x=mE(u?.media?.uri),S=B(()=>f&&`descriptions`in f&&f.descriptions.sort((e,t)=>t.description.length-e.description.length)?.at(0)?.description,[f]),C=ww(f?.covers,f),w=G(null),[T,E]=K([]),[D,O]=K(),k=B(()=>{let e=(f?.trailers??[]).filter(e=>!T.includes(e.uri));return e.find(e=>e.uri===D)??e.at(0)},[f?.trailers,T,D]),A=ww(k?.url?void 0:Cw(f),f);H(()=>{k?.uri&&k.uri!==D&&O(k.uri)},[k?.uri,D]);let j=wt(()=>{k&&E([...T,k.uri])},[k,T]),[M,N]=K(!0),P=sO(Ih()),[ee,te]=K(!1),[F,ne]=K(!0),[I,re]=K(.25),ie=G(void 0),ae=u?.media?.handles.map(e=>e.node.uri)??[];H(()=>{let e=og(Q.MEDIA,i,f&&{uri:f.uri,name:m},ie.current);e&&!Ew(u?.media?.seasons,ae)&&(e.grown&&(ie.current=f.uri),o(`${e.path}${location.search}`,{replace:!0}))},[f?.uri,a.uri,m,i.slug]);let oe=/* @__PURE__ */ V(xU,{work:c,address:a.uri,uri:p?.uri,title:m,cover:C,episodeCount:p?.episodeCount,movie:h}),se=/* @__PURE__ */ W(`div`,{className:`links`,children:[/* @__PURE__ */ V(wU,{uri:f?.uri}),/* @__PURE__ */ V(DE,{uri:u?.media?.uri,handles:f?.handles,links:u?.media?.streamingLinks,except:bE(g,f?.handles)}),/* @__PURE__ */ V(KE,{path:ag(Q.TITLE,{uri:f?.uri??a.uri,name:m}),title:m}),/* @__PURE__ */ V(Uh,{className:`more`,href:`${ag(Q.TITLE,{uri:f?.uri??a.uri,name:m})}${P}`,children:n.formatMessage({id:`More details`,defaultMessage:`More details`})})]}),ce=m||y?/* @__PURE__ */ V(`h2`,{id:m?r:void 0,className:`title`,children:m}):/* @__PURE__ */ V(rw,{className:`title-pending`}),le=/* @__PURE__ */ V(`button`,{type:`button`,className:`close`,"aria-label":n.formatMessage({id:`Close`,defaultMessage:`Close`}),onClick:()=>N(!1),children:/* @__PURE__ */ V(Cx,{size:20,"aria-hidden":`true`})});if(!M)return/* @__PURE__ */ V(Kh,{to:t});if(aT({data:u,operation:d},c))return/* @__PURE__ */ W(SU,{css:JU,label:n.formatMessage({id:`404 No page found`,defaultMessage:`404 No page found`}),onClose:()=>N(!1),children:[le,/* @__PURE__ */ V(WU,{})]});let ue=m?void 0:f?.titles?.at(0)?.title||`Stub`;return/* @__PURE__ */ W(SU,{"data-party-scroll":!0,css:JU,labelledBy:m?r:void 0,label:ue,onClose:()=>N(!1),children:[le,/* @__PURE__ */ W(`div`,{className:b?`hero film`:`hero`,children:[/* @__PURE__ */ W(`div`,{className:`trailer`,style:!k?.url&&A?{backgroundImage:`url(${A})`}:{},children:[k?.url?/* @__PURE__ */ V(JC,{url:k.url,className:`player`,onError:j,paused:ee,volume:F?0:I},k.url):void 0,/* @__PURE__ */ W(`div`,{className:`player-controls ${k?.url?``:`hidden`}`,children:[/* @__PURE__ */ W(`button`,{type:`button`,className:`playback`,"aria-label":ee?n.formatMessage({id:`Play trailer`,defaultMessage:`Play trailer`}):n.formatMessage({id:`Pause trailer`,defaultMessage:`Pause trailer`}),onClick:()=>te(e=>!e),children:[V(ee?pt:it,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,"aria-hidden":`true`}),V(ee?pt:it,{className:`icon-body`,size:30,"aria-hidden":`true`})]}),/* @__PURE__ */ V(ZC,{defaultMuted:F,onMutedUpdate:ne,defaultVolume:I,onVolumeUpdate:e=>re(e)})]})]}),/* @__PURE__ */ W(`div`,{className:`over`,children:[C?/* @__PURE__ */ V(`img`,{className:`poster`,src:C,alt:``}):void 0,/* @__PURE__ */ W(`div`,{className:`stack`,children:[u?.media?/* @__PURE__ */ V(YU,{media:u.media,movie:h,loading:!y}):void 0,ce]}),b?/* @__PURE__ */ V(NU,{...b,children:oe}):void 0]})]}),/* @__PURE__ */ W(`div`,{className:`content`,children:[/* @__PURE__ */ W(`div`,{className:`columns`,children:[/* @__PURE__ */ W(`div`,{className:`main`,children:[b?/* @__PURE__ */ V(PU,{...b}):oe,S?/* @__PURE__ */ V(dk,{collapsedHeight:200,beside:w,className:`description`,children:/* @__PURE__ */ V(`div`,{dangerouslySetInnerHTML:{__html:S}})}):y?void 0:/* @__PURE__ */ V(iw,{count:5,className:`description pending`})]}),/* @__PURE__ */ W(`aside`,{ref:w,className:`side`,children:[u?.media?/* @__PURE__ */ V(XU,{media:u.media,movie:h}):void 0,se]})]}),/* @__PURE__ */ V(zO,{relations:f&&`relations`in f?f.relations??[]:[],action:/* @__PURE__ */ V(fH,{franchise:f&&`franchise`in f?f.franchise:void 0,currentUris:f?.handles?.map(e=>e.node.uri)??[]})},c),/* @__PURE__ */ V(Dw,{seasons:u?.media?.seasons,currentUris:ae,href:e=>`${ag(Q.MEDIA,{uri:e,name:m})}${P}`}),h||!u?.media?void 0:/* @__PURE__ */ V(`div`,{className:`episode-list`,children:p?/* @__PURE__ */ V(PE,{media:p,tracked:x,settled:y},c):/* @__PURE__ */ V(ME,{})})]})]})},QU=Ne({all:{id:`All#category`,defaultMessage:`All`,description:`category`},anime:{id:`Anime#category`,defaultMessage:`Anime`,description:`category`},series:{id:`Series#category`,defaultMessage:`Series`,description:`category`},movies:{id:`Movies#category`,defaultMessage:`Movies`,description:`category`}}),$U=[{label:QU.all,value:null},{label:QU.anime,value:Mc.Anime},{label:QU.series,value:Mc.Series},{label:QU.movies,value:Mc.Movie}],eW=R`
4414
+ `,ZU=({media:e,movie:t,loading:n})=>{let r=WT();return/* @__PURE__ */ W(`span`,{className:`line`,children:[t?UU(e,new Date(r)):HU(e),n?/* @__PURE__ */ V(Fw,{}):void 0]})},QU=({media:e,movie:t})=>{let n=L(),{genres:r,tags:i,aired:a,upcoming:o}=WU(e,t);return/* @__PURE__ */ W(q,{children:[e.averageScore?/* @__PURE__ */ V(hk,{percent:e.averageScore}):void 0,/* @__PURE__ */ V(pk,{genres:r,tags:i,linked:!0}),a?/* @__PURE__ */ V(`dl`,{className:`facts`,children:/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`dt`,{children:o?n.formatMessage({id:`Releases#verb`,defaultMessage:`Releases`,description:`verb`}):n.formatMessage({id:`Aired`,defaultMessage:`Aired`})}),/* @__PURE__ */ V(`dd`,{children:a})]})}):void 0]})},$U=({mediaNodes:e,closeTo:t=`/`})=>{let n=L(),r=At(),i=Nh(),a={...i,uri:Tn(i.uri)},[,o]=Fh(),s=rT(a.uri,e),[c,l]=K(a.uri);H(()=>{l(e=>e&&Dn(e,a.uri??``)?e:a.uri)},[a.uri]);let[{data:u,operation:d}]=Zs({query:fE,variables:{input:{uri:c},descriptionInput:{type:Nc.Html}},pause:!c}),f=u?.media??s,p=iT({data:u,operation:d},c),m=B(()=>f?.titles?.at(0)?.title,[f]);YU(m),qU(f?.uri??a.uri,m);let h=!!(u?.media&&CT(u.media)),g=h?u?.media?.episodes.at(0):void 0,{sources:_,answered:v}=xE(g,f?.uri??``,f?.handles),y=SE(c,p?.settled&&v),b=h&&u?.media?{episode:g,mediaUri:u.media.uri,sources:_,settled:y,startDate:u.media.startDate,status:u.media.status}:void 0,x=mE(u?.media?.uri),S=B(()=>f&&`descriptions`in f&&f.descriptions.sort((e,t)=>t.description.length-e.description.length)?.at(0)?.description,[f]),C=ww(f?.covers,f),w=G(null),[T,E]=K([]),[D,O]=K(),k=B(()=>{let e=(f?.trailers??[]).filter(e=>!T.includes(e.uri));return e.find(e=>e.uri===D)??e.at(0)},[f?.trailers,T,D]),A=ww(k?.url?void 0:Cw(f),f);H(()=>{k?.uri&&k.uri!==D&&O(k.uri)},[k?.uri,D]);let j=wt(()=>{k&&E([...T,k.uri])},[k,T]),[M,N]=K(!0),P=sO(Ih()),[ee,te]=K(!1),[F,ne]=K(!0),[I,re]=K(.25),ie=G(void 0),ae=u?.media?.handles.map(e=>e.node.uri)??[];H(()=>{let e=og(Q.MEDIA,i,f&&{uri:f.uri,name:m},ie.current);e&&!Ew(u?.media?.seasons,ae)&&(e.grown&&(ie.current=f.uri),o(`${e.path}${location.search}`,{replace:!0}))},[f?.uri,a.uri,m,i.slug]);let oe=/* @__PURE__ */ V(CU,{work:c,address:a.uri,uri:p?.uri,title:m,cover:C,episodeCount:p?.episodeCount,movie:h}),se=/* @__PURE__ */ W(`div`,{className:`links`,children:[/* @__PURE__ */ V(EU,{uri:f?.uri}),/* @__PURE__ */ V(DE,{uri:u?.media?.uri,handles:f?.handles,links:u?.media?.streamingLinks,except:bE(g,f?.handles)}),/* @__PURE__ */ V(KE,{path:ag(Q.TITLE,{uri:f?.uri??a.uri,name:m}),title:m}),/* @__PURE__ */ V(Uh,{className:`more`,href:`${ag(Q.TITLE,{uri:f?.uri??a.uri,name:m})}${P}`,children:n.formatMessage({id:`More details`,defaultMessage:`More details`})})]}),ce=m||y?/* @__PURE__ */ V(`h2`,{id:m?r:void 0,className:`title`,children:m}):/* @__PURE__ */ V(rw,{className:`title-pending`}),le=/* @__PURE__ */ V(`button`,{type:`button`,className:`close`,"aria-label":n.formatMessage({id:`Close`,defaultMessage:`Close`}),onClick:()=>N(!1),children:/* @__PURE__ */ V(Cx,{size:20,"aria-hidden":`true`})});if(!M)return/* @__PURE__ */ V(Kh,{to:t});if(aT({data:u,operation:d},c))return/* @__PURE__ */ W(wU,{css:XU,label:n.formatMessage({id:`404 No page found`,defaultMessage:`404 No page found`}),onClose:()=>N(!1),children:[le,/* @__PURE__ */ V(KU,{})]});let ue=m?void 0:f?.titles?.at(0)?.title||`Stub`;return/* @__PURE__ */ W(wU,{"data-party-scroll":!0,css:XU,labelledBy:m?r:void 0,label:ue,onClose:()=>N(!1),children:[le,/* @__PURE__ */ W(`div`,{className:b?`hero film`:`hero`,children:[/* @__PURE__ */ W(`div`,{className:`trailer`,style:!k?.url&&A?{backgroundImage:`url(${A})`}:{},children:[k?.url?/* @__PURE__ */ V(JC,{url:k.url,className:`player`,onError:j,paused:ee,volume:F?0:I},k.url):void 0,/* @__PURE__ */ W(`div`,{className:`player-controls ${k?.url?``:`hidden`}`,children:[/* @__PURE__ */ W(`button`,{type:`button`,className:`playback`,"aria-label":ee?n.formatMessage({id:`Play trailer`,defaultMessage:`Play trailer`}):n.formatMessage({id:`Pause trailer`,defaultMessage:`Pause trailer`}),onClick:()=>te(e=>!e),children:[V(ee?pt:it,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,"aria-hidden":`true`}),V(ee?pt:it,{className:`icon-body`,size:30,"aria-hidden":`true`})]}),/* @__PURE__ */ V(ZC,{defaultMuted:F,onMutedUpdate:ne,defaultVolume:I,onVolumeUpdate:e=>re(e)})]})]}),/* @__PURE__ */ W(`div`,{className:`over`,children:[C?/* @__PURE__ */ V(`img`,{className:`poster`,src:C,alt:``}):void 0,/* @__PURE__ */ W(`div`,{className:`stack`,children:[u?.media?/* @__PURE__ */ V(ZU,{media:u.media,movie:h,loading:!y}):void 0,ce]}),b?/* @__PURE__ */ V(FU,{...b,children:oe}):void 0]})]}),/* @__PURE__ */ W(`div`,{className:`content`,children:[/* @__PURE__ */ W(`div`,{className:`columns`,children:[/* @__PURE__ */ W(`div`,{className:`main`,children:[b?/* @__PURE__ */ V(IU,{...b}):oe,S?/* @__PURE__ */ V(dk,{collapsedHeight:200,beside:w,className:`description`,children:/* @__PURE__ */ V(`div`,{dangerouslySetInnerHTML:{__html:S}})}):y?void 0:/* @__PURE__ */ V(iw,{count:5,className:`description pending`})]}),/* @__PURE__ */ W(`aside`,{ref:w,className:`side`,children:[u?.media?/* @__PURE__ */ V(QU,{media:u.media,movie:h}):void 0,se]})]}),/* @__PURE__ */ V(zO,{relations:f&&`relations`in f?f.relations??[]:[],action:/* @__PURE__ */ V(fH,{franchise:f&&`franchise`in f?f.franchise:void 0,currentUris:f?.handles?.map(e=>e.node.uri)??[]})},c),/* @__PURE__ */ V(Dw,{seasons:u?.media?.seasons,currentUris:ae,href:e=>`${ag(Q.MEDIA,{uri:e,name:m})}${P}`}),h||!u?.media?void 0:/* @__PURE__ */ V(`div`,{className:`episode-list`,children:p?/* @__PURE__ */ V(PE,{media:p,tracked:x,settled:y},c):/* @__PURE__ */ V(ME,{})})]})]})},eW=Ne({all:{id:`All#category`,defaultMessage:`All`,description:`category`},anime:{id:`Anime#category`,defaultMessage:`Anime`,description:`category`},series:{id:`Series#category`,defaultMessage:`Series`,description:`category`},movies:{id:`Movies#category`,defaultMessage:`Movies`,description:`category`}}),tW=[{label:eW.all,value:null},{label:eW.anime,value:Mc.Anime},{label:eW.series,value:Mc.Series},{label:eW.movies,value:Mc.Movie}],nW=R`
4415
4415
  display: flex;
4416
4416
  flex-wrap: wrap;
4417
4417
  gap: 0.6rem;
@@ -4434,7 +4434,7 @@ scrollbar-gutter: stable;
4434
4434
  color: #000;
4435
4435
  border-color: #fff;
4436
4436
  }
4437
- `,tW=({value:e,onChange:t})=>{let n=L();return/* @__PURE__ */ V(`div`,{css:eW,children:$U.map(r=>/* @__PURE__ */ V(`button`,{className:e===r.value?`tab active`:`tab`,onClick:()=>t(r.value),children:n.formatMessage(r.label)},r.label.id))})},nW=e=>{let t=e.uri??``;return[e._id??``,...t.match(/^ag:\((.*)\)$/)?.[1]?.split(`,`)??[t]].filter(Boolean)},rW=(e,t)=>{let n=/* @__PURE__ */ new Map;t.forEach((e,t)=>{for(let r of e)n.has(r)||n.set(r,t)});let r=e=>Math.min(...nW(e).map(e=>n.get(e)??1/0)),i=[],a=[];for(let t of e)(r(t)<1/0?i:a).push(t);return i.sort((e,t)=>r(e)-r(t)),[...i,...a]},iW=e=>e.filter(e=>e.popularity!=null).map(nW).filter(e=>e.length);U();var aW=RC(`
4437
+ `,rW=({value:e,onChange:t})=>{let n=L();return/* @__PURE__ */ V(`div`,{css:nW,children:tW.map(r=>/* @__PURE__ */ V(`button`,{className:e===r.value?`tab active`:`tab`,onClick:()=>t(r.value),children:n.formatMessage(r.label)},r.label.id))})},iW=e=>{let t=e.uri??``;return[e._id??``,...t.match(/^ag:\((.*)\)$/)?.[1]?.split(`,`)??[t]].filter(Boolean)},aW=(e,t)=>{let n=/* @__PURE__ */ new Map;t.forEach((e,t)=>{for(let r of e)n.has(r)||n.set(r,t)});let r=e=>Math.min(...iW(e).map(e=>n.get(e)??1/0)),i=[],a=[];for(let t of e)(r(t)<1/0?i:a).push(t);return i.sort((e,t)=>r(e)-r(t)),[...i,...a]},oW=e=>e.filter(e=>e.popularity!=null).map(iW).filter(e=>e.length);U();var sW=RC(`
4438
4438
  subscription GetReleasingMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
4439
4439
  mediaPage(input: $input) {
4440
4440
  nodes {
@@ -4473,7 +4473,7 @@ scrollbar-gutter: stable;
4473
4473
  }
4474
4474
  }
4475
4475
  }
4476
- `),oW=R`
4476
+ `),cW=R`
4477
4477
  & > .home-row + .home-row {
4478
4478
  margin-top: 4rem;
4479
4479
  }
@@ -4489,7 +4489,7 @@ scrollbar-gutter: stable;
4489
4489
  z-index: ${Aa.categoryBar};
4490
4490
  padding: 1.5rem 3rem 0.5rem;
4491
4491
  }
4492
- `,sW=kl(),cW={season:Ig(sW.season),year:sW.year},lW=Jg(cW),uW={categories:[Mc.Movie]},dW={categories:[Mc.Series]},fW={anime:[`season`],movie:[`movies`],series:[`shows`],stub:[`season`,`movies`,`shows`]}[ya],pW=(e,t)=>{let[{data:n}]=Zs({query:aW,variables:{input:e,shortDescriptionInput:{count:1}},pause:!fW.includes(t)}),r=n?.mediaPage?.nodes,i=G([]);return B(()=>{if(!r?.length||t!==`season`)return r||[];let e=rW(r,i.current);return i.current=iW(e),e},[r])},mW=()=>{let e=L(),[t]=Rh(ig(Q.MEDIA)),[n,r]=K(null),i={season:pW({season:cW.season,seasonYear:cW.year,sorts:[Fc.PopularityDesc],...n?{categories:[n]}:{}},`season`),movies:pW(uW,`movies`),shows:pW(dW,`shows`)};return/* @__PURE__ */ W(`div`,{css:oW,children:[/* @__PURE__ */ V(BE,{mediaNodes:i[fW[0]]}),ya===`stub`?/* @__PURE__ */ V(`div`,{className:`category-bar`,children:/* @__PURE__ */ V(tW,{value:n,onChange:r})}):void 0,fW.includes(`season`)&&/* @__PURE__ */ V(PD,{name:`season`,title:e.formatMessage({id:`Current season`,defaultMessage:`Current season`}),titleTo:lW,mediaNodes:i.season}),ya===`anime`||ya===`stub`?/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(eO,{}),(!n||n===Mc.Anime)&&/* @__PURE__ */ V(ck,{})]}):void 0,fW.includes(`movies`)&&(!n||n===Mc.Movie)&&/* @__PURE__ */ V(PD,{name:`movies`,title:e.formatMessage({id:`Popular movies`,defaultMessage:`Popular movies`}),mediaNodes:i.movies}),fW.includes(`shows`)&&(!n||n===Mc.Series)&&/* @__PURE__ */ V(PD,{name:`shows`,title:e.formatMessage({id:`Popular shows`,defaultMessage:`Popular shows`}),mediaNodes:i.shows}),t&&/* @__PURE__ */ V(ZU,{mediaNodes:[...i.season,...i.movies,...i.shows]})]})},hW=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,gW=/\p{Script=Hangul}/u,_W=({language:e,title:t})=>{if(e){if(e===`jp`)return hW.test(t)?`ja`:gW.test(t)?`ko`:void 0;try{return new Intl.Locale(e===`jp-en`?`ja-Latn`:e).baseName}catch{return}}},vW=e=>{let t=/* @__PURE__ */ new Map;for(let n of e)for(let e of new Set(n.voiceActors.map(e=>e.language).filter(e=>!!e)))t.set(e,(t.get(e)??0)+1);let n=[...t.keys()].sort((e,n)=>Number(n===`ja`)-Number(e===`ja`)||t.get(n)-t.get(e)||e.localeCompare(n));return{options:n.length<2?[]:n,selected:n[0]}},yW=(e,t)=>e.map(e=>({...e,actors:e.voiceActors.filter(e=>(e.language??void 0)===t)})),bW=Ne({MAIN:{id:`Main#character role`,defaultMessage:`Main`,description:`character role`},SUPPORTING:{id:`Supporting#character role`,defaultMessage:`Supporting`,description:`character role`},BACKGROUND:{id:`Background#character role`,defaultMessage:`Background`,description:`character role`}}),xW=e=>e?bW[e]?J.formatMessage(bW[e]):e:void 0,SW=e=>{let t=/^[a-z]{2,3}$/.test(e)?J.formatDisplayName(e,{type:`language`})??e:e;return t===e?t:t.charAt(0).toLocaleUpperCase(J.locale)+t.slice(1)};U();var CW=12,wW=R`
4492
+ `,lW=kl(),uW={season:Ig(lW.season),year:lW.year},dW=Jg(uW),fW={categories:[Mc.Movie]},pW={categories:[Mc.Series]},mW={anime:[`season`],movie:[`movies`],series:[`shows`],stub:[`season`,`movies`,`shows`]}[ya],hW=(e,t)=>{let[{data:n}]=Zs({query:sW,variables:{input:e,shortDescriptionInput:{count:1}},pause:!mW.includes(t)}),r=n?.mediaPage?.nodes,i=G([]);return B(()=>{if(!r?.length||t!==`season`)return r||[];let e=aW(r,i.current);return i.current=oW(e),e},[r])},gW=()=>{let e=L(),[t]=Rh(ig(Q.MEDIA)),[n,r]=K(null),i={season:hW({season:uW.season,seasonYear:uW.year,sorts:[Fc.PopularityDesc],...n?{categories:[n]}:{}},`season`),movies:hW(fW,`movies`),shows:hW(pW,`shows`)};return/* @__PURE__ */ W(`div`,{css:cW,children:[/* @__PURE__ */ V(BE,{mediaNodes:i[mW[0]]}),ya===`stub`?/* @__PURE__ */ V(`div`,{className:`category-bar`,children:/* @__PURE__ */ V(rW,{value:n,onChange:r})}):void 0,mW.includes(`season`)&&/* @__PURE__ */ V(PD,{name:`season`,title:e.formatMessage({id:`Current season`,defaultMessage:`Current season`}),titleTo:dW,mediaNodes:i.season}),ya===`anime`||ya===`stub`?/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(eO,{}),(!n||n===Mc.Anime)&&/* @__PURE__ */ V(ck,{})]}):void 0,mW.includes(`movies`)&&(!n||n===Mc.Movie)&&/* @__PURE__ */ V(PD,{name:`movies`,title:e.formatMessage({id:`Popular movies`,defaultMessage:`Popular movies`}),mediaNodes:i.movies}),mW.includes(`shows`)&&(!n||n===Mc.Series)&&/* @__PURE__ */ V(PD,{name:`shows`,title:e.formatMessage({id:`Popular shows`,defaultMessage:`Popular shows`}),mediaNodes:i.shows}),t&&/* @__PURE__ */ V($U,{mediaNodes:[...i.season,...i.movies,...i.shows]})]})},_W=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,vW=/\p{Script=Hangul}/u,yW=({language:e,title:t})=>{if(e){if(e===`jp`)return _W.test(t)?`ja`:vW.test(t)?`ko`:void 0;try{return new Intl.Locale(e===`jp-en`?`ja-Latn`:e).baseName}catch{return}}},bW=e=>{let t=/* @__PURE__ */ new Map;for(let n of e)for(let e of new Set(n.voiceActors.map(e=>e.language).filter(e=>!!e)))t.set(e,(t.get(e)??0)+1);let n=[...t.keys()].sort((e,n)=>Number(n===`ja`)-Number(e===`ja`)||t.get(n)-t.get(e)||e.localeCompare(n));return{options:n.length<2?[]:n,selected:n[0]}},xW=(e,t)=>e.map(e=>({...e,actors:e.voiceActors.filter(e=>(e.language??void 0)===t)})),SW=Ne({MAIN:{id:`Main#character role`,defaultMessage:`Main`,description:`character role`},SUPPORTING:{id:`Supporting#character role`,defaultMessage:`Supporting`,description:`character role`},BACKGROUND:{id:`Background#character role`,defaultMessage:`Background`,description:`character role`}}),CW=e=>e?SW[e]?J.formatMessage(SW[e]):e:void 0,wW=e=>{let t=/^[a-z]{2,3}$/.test(e)?J.formatDisplayName(e,{type:`language`})??e:e;return t===e?t:t.charAt(0).toLocaleUpperCase(J.locale)+t.slice(1)};U();var TW=12,EW=R`
4493
4493
  /* the footer under it stays below the fold while the page fills, rather than being pushed off it */
4494
4494
  min-height: 100vh;
4495
4495
  padding-bottom: 6rem;
@@ -5009,7 +5009,7 @@ scrollbar-gutter: stable;
5009
5009
  }
5010
5010
  }
5011
5011
  }
5012
- `,TW=({person:e,detail:t,actor:n})=>/* @__PURE__ */ W(`div`,{className:n?`person actor`:`person`,children:[e.image?/* @__PURE__ */ V(`img`,{className:`face`,src:e.image,alt:``,loading:`lazy`}):void 0,/* @__PURE__ */ W(`div`,{children:[e.url?/* @__PURE__ */ V(`a`,{className:`name`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.name}):/* @__PURE__ */ V(`div`,{className:`name`,children:e.name}),t?/* @__PURE__ */ V(`div`,{className:`detail`,children:t}):void 0]})]}),EW=({characters:e})=>{let t=L(),n=t.formatMessage({id:`Characters`,defaultMessage:`Characters`}),r=vW(e),[i,a]=K(),o=yW(e,i??r.selected);return/* @__PURE__ */ W(`section`,{"data-characters":!0,children:[/* @__PURE__ */ W(`h2`,{children:[/* @__PURE__ */ V(`span`,{children:n}),r.options.length?/* @__PURE__ */ V(`select`,{"aria-label":t.formatMessage({id:`Language`,defaultMessage:`Language`}),value:i??r.selected,onChange:e=>a(e.currentTarget.value),children:r.options.map(e=>/* @__PURE__ */ V(`option`,{value:e,children:SW(e)},e))}):void 0]}),/* @__PURE__ */ V(jw,{items:o,size:CW,label:n,children:(e,t)=>/* @__PURE__ */ V(`ul`,{className:`credits`,children:e.map((e,n)=>/* @__PURE__ */ W(`li`,{children:[/* @__PURE__ */ V(TW,{person:e,detail:xW(e.role)}),e.actors.length?/* @__PURE__ */ V(`div`,{className:`actors`,children:e.actors.map(e=>/* @__PURE__ */ V(TW,{person:e,actor:!0},e.name))}):void 0]},`${e.name}:${t+n}`))})})]})},DW=({staff:e})=>{let t=L(),n=t.formatMessage({id:`Staff`,defaultMessage:`Staff`});return/* @__PURE__ */ W(`section`,{"data-staff":!0,children:[/* @__PURE__ */ V(`h2`,{children:n}),/* @__PURE__ */ V(jw,{items:e,size:CW,label:n,children:(e,n)=>/* @__PURE__ */ V(`ul`,{className:`credits`,children:e.map((e,r)=>/* @__PURE__ */ V(`li`,{children:/* @__PURE__ */ V(TW,{person:e,detail:e.roles?t.formatList(e.roles,Cn):void 0})},`${e.name}:${n+r}`))})})]})},OW=({url:e})=>{let[t,n]=K();return H(()=>{import(`./assets/lib-theme-player-J9RQNDH6.js`).then(e=>n(()=>e.default)).catch(()=>n(()=>({url:e})=>/* @__PURE__ */ V(`video`,{src:e,controls:!0,autoPlay:!0,playsInline:!0})))},[]),/* @__PURE__ */ V(`div`,{className:`player`,children:t?/* @__PURE__ */ V(t,{url:e}):void 0})},kW=({themes:e})=>{let t=L(),[n,r]=K();return/* @__PURE__ */ V(`ul`,{className:`themes`,children:e.map((e,i)=>{let a=e.video;return/* @__PURE__ */ W(`li`,{children:[/* @__PURE__ */ W(`div`,{className:`theme`,children:[a?/* @__PURE__ */ V(`button`,{type:`button`,className:`toggle`,"aria-label":n===i?t.formatMessage({id:`Stop`,defaultMessage:`Stop`}):t.formatMessage({id:`Play`,defaultMessage:`Play`}),onClick:()=>r(n===i?void 0:i),children:V(n===i?vx:pt,{size:14,fill:`currentColor`})}):/* @__PURE__ */ V(`span`,{className:`toggle`}),/* @__PURE__ */ W(`span`,{className:`kind`,children:[e.kind,e.sequence??``]}),e.group?/* @__PURE__ */ V(`span`,{className:`group`,dir:`auto`,children:e.group}):void 0,/* @__PURE__ */ V(`span`,{className:`song`,children:e.title}),/* @__PURE__ */ V(`span`,{className:`artists`,children:/* @__PURE__ */ V(`bdi`,{children:t.formatList(e.artists,Cn)})})]}),n===i&&a?/* @__PURE__ */ V(OW,{url:a}):void 0]},i)})})},AW=({themes:e})=>{let t=L().formatMessage({id:`Themes`,defaultMessage:`Themes`});return/* @__PURE__ */ W(`section`,{"data-themes":!0,children:[/* @__PURE__ */ V(`h2`,{children:t}),/* @__PURE__ */ V(jw,{items:e,size:CW,label:t,children:(e,t)=>/* @__PURE__ */ V(kW,{themes:e},t)})]})},jW=()=>{let e=L(),t=Nh(),n=Tn(t.uri),[,r]=Fh(),i=sO(Ih()),[a,o]=K(n);H(()=>{o(e=>e&&Dn(e,n??``)?e:n)},[n]);let[{data:s,operation:c}]=Zs({query:fE,variables:{input:{uri:a,details:!0},descriptionInput:{type:Nc.Html},details:!0},pause:!a}),l=s?.media,u=l?.handles.map(e=>e.node.uri)??[],d=iT({data:s,operation:c},a),f=mE(l?.uri),p=G(void 0),m=l?.titles.at(0);ct(()=>{let e=og(Q.TITLE,t,l&&{uri:l.uri,name:m?.title},p.current);e&&!Ew(l?.seasons,u)&&(e.grown&&(p.current=l.uri),r(`${e.path}${location.search}`,{replace:!0}))},[l?.uri,n,m?.title,t.slug]);let h=ww(l?.banners,l),g=ww(l?.covers,l);qU(m?.title),GU(l?.uri,m?.title);let _=nE(l?.titles),v=l?.descriptions.map(({description:e})=>e).sort((e,t)=>t.length-e.length).at(0),y=!!(l&&CT(l)),b=y?l.episodes.at(0):void 0,{sources:x,answered:S}=xE(b,l?.uri??``,l?.handles),C=SE(a,d?.settled&&S),w=xn(a??``).some(e=>Sa.includes(e)),T=y&&zT({startDate:l.startDate,status:l.status,episode:l.episodes.at(0)}).upcoming,E=sE(l??{},{locale:e.locale},w&&!C,T),D=l?iE(l):[],O=aE(l??{}),k=l?n_(l.season,l.seasonYear):void 0,[A,j]=K(!1),[M,N]=K(!1),P=G(null);ct(()=>{let e=P.current;e&&!A&&N(e.scrollHeight>e.clientHeight+1)},[v,A]),H(()=>{j(!1)},[a]);let ee=l?.trailers.at(0)?.url,te=e.formatMessage({id:`Trailer`,defaultMessage:`Trailer`});return aT({data:s,operation:c},a)?/* @__PURE__ */ V(WU,{}):/* @__PURE__ */ W(`div`,{css:wW,children:[/* @__PURE__ */ V(`div`,{className:`banner`,children:h??g?/* @__PURE__ */ V(`div`,{className:h?`image`:`image blurred`,style:{backgroundImage:`url(${h??g})`}}):void 0}),/* @__PURE__ */ W(`div`,{className:`body`,children:[g?/* @__PURE__ */ V(`img`,{className:`cover`,src:g,alt:``}):/* @__PURE__ */ V(`div`,{className:`cover`}),/* @__PURE__ */ W(`div`,{className:`heading`,children:[k?/* @__PURE__ */ V(`div`,{className:`season`,children:k}):C?void 0:/* @__PURE__ */ V(`div`,{className:`season`,children:/* @__PURE__ */ V(rw,{className:`pending`})}),/* @__PURE__ */ V(`h1`,{lang:m&&_W(m),children:m?.title??(C?void 0:/* @__PURE__ */ V(iw,{count:2,className:`pending`}))}),_?/* @__PURE__ */ V(`div`,{className:`second`,lang:_W(_),children:_.title}):w&&!C?/* @__PURE__ */ V(`div`,{className:`second`,children:/* @__PURE__ */ V(rw,{className:`pending`})}):void 0,D.length||l?.averageScore!=null||O.length?/* @__PURE__ */ W(`div`,{className:`chips`,children:[D.map(e=>/* @__PURE__ */ V(`span`,{className:`chip`,children:e},e)),l?.averageScore==null?void 0:/* @__PURE__ */ V(`span`,{className:`chip`,children:/* @__PURE__ */ V(hk,{percent:l.averageScore})}),O.map(e=>/* @__PURE__ */ V(`span`,{className:`chip`,children:e},e))]}):C?void 0:/* @__PURE__ */ V(`div`,{className:`chips`,children:/* @__PURE__ */ V(rw,{className:`pending`})}),v?/* @__PURE__ */ V(`div`,{ref:P,className:A?`description`:`description clamped`,dir:`auto`,dangerouslySetInnerHTML:{__html:v}}):C?void 0:/* @__PURE__ */ V(iw,{count:5,className:`description`}),v&&(M||A)?/* @__PURE__ */ V(`button`,{type:`button`,className:`expand`,onClick:()=>j(!A),children:A?e.formatMessage({id:`Collapse`,defaultMessage:`Collapse`}):e.formatMessage({id:`Expand`,defaultMessage:`Expand`})}):void 0,y?/* @__PURE__ */ V($w,{film:!0,sources:x,pending:!C}):void 0]}),/* @__PURE__ */ W(`div`,{className:`actions`,children:[l?/* @__PURE__ */ W(`div`,{className:`buttons`,children:[/* @__PURE__ */ V(gE,{media:l}),/* @__PURE__ */ V(KE,{className:`icon`,path:ag(Q.TITLE,{uri:l.uri,name:m?.title}),title:m?.title}),ee?/* @__PURE__ */ V(`a`,{className:`icon`,href:ee,target:`_blank`,rel:`noreferrer`,"aria-label":te,title:te,children:/* @__PURE__ */ V(Xb,{size:20})}):void 0,/* @__PURE__ */ V(DE,{uri:l.uri,handles:l.handles,links:l.streamingLinks,except:bE(b,l.handles)})]}):/* @__PURE__ */ V(`div`,{className:`buttons`,children:/* @__PURE__ */ V(rw,{className:`play-pending`})}),/* @__PURE__ */ V(`div`,{className:`tracking`,children:/* @__PURE__ */ V(xU,{work:a,address:n,uri:d?.uri,title:m?.title,cover:g,episodeCount:d?.episodeCount,movie:y})})]}),E.length?/* @__PURE__ */ V(`dl`,{className:`facts`,children:E.map(({label:e,value:t,pills:n})=>t?/* @__PURE__ */ W(`div`,{className:n&&`pills`,children:[/* @__PURE__ */ V(`dt`,{children:e}),/* @__PURE__ */ V(`dd`,{children:typeof t==`string`?t:/* @__PURE__ */ V(pk,{...n===`genre`?{genres:t,linked:!0}:{tags:t}})})]},e):/* @__PURE__ */ W(`div`,{className:n?`fact placeholder pills`:`fact placeholder`,"aria-hidden":`true`,children:[/* @__PURE__ */ V(`dt`,{children:e}),/* @__PURE__ */ V(`dd`,{children:/* @__PURE__ */ V(rw,{className:`pending`})})]},e))}):void 0,/* @__PURE__ */ W(`div`,{className:`main`,children:[/* @__PURE__ */ V(zO,{relations:l?.relations??[],action:/* @__PURE__ */ V(fH,{franchise:l?.franchise,currentUris:u,route:Q.TITLE}),route:Q.TITLE,pending:w&&!C}),/* @__PURE__ */ V(Dw,{seasons:l?.seasons,currentUris:u,href:e=>`${ag(Q.TITLE,{uri:e,name:m?.title})}${i}`}),l&&!y?/* @__PURE__ */ W(`section`,{"data-episodes":!0,children:[/* @__PURE__ */ V(`h2`,{children:e.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),d?/* @__PURE__ */ V(PE,{media:d,tracked:f}):/* @__PURE__ */ V(ME,{})]}):void 0,/* @__PURE__ */ V(BO,{recommendations:l?.recommendations??[],route:Q.TITLE}),l?.characters?.length?/* @__PURE__ */ V(EW,{characters:l.characters}):void 0,l?.staff?.length?/* @__PURE__ */ V(DW,{staff:l.staff}):void 0,l?.themes?.length?/* @__PURE__ */ V(AW,{themes:l.themes}):void 0]},a)]})]})},MW={...Object.fromEntries(`nbsp iexcl cent pound curren yen brvbar sect uml copy ordf laquo not shy reg macr deg plusmn sup2 sup3 acute micro para middot cedil sup1 ordm raquo frac14 frac12 frac34 iquest Agrave Aacute Acirc Atilde Auml Aring AElig Ccedil Egrave Eacute Ecirc Euml Igrave Iacute Icirc Iuml ETH Ntilde Ograve Oacute Ocirc Otilde Ouml times Oslash Ugrave Uacute Ucirc Uuml Yacute THORN szlig agrave aacute acirc atilde auml aring aelig ccedil egrave eacute ecirc euml igrave iacute icirc iuml eth ntilde ograve oacute ocirc otilde ouml divide oslash ugrave uacute ucirc uuml yacute thorn yuml`.split(` `).map((e,t)=>[e,String.fromCharCode(160+t)])),amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`,nbsp:` `,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,bull:`•`,hellip:`…`},NW=e=>e.replace(/&#x([0-9a-f]+);/gi,(e,t)=>String.fromCodePoint(parseInt(t,16))).replace(/&#(\d+);/g,(e,t)=>String.fromCodePoint(Number(t))).replace(/&([a-z]+\d*);/gi,(e,t)=>MW[t]??MW[t.toLowerCase()]??e),PW=e=>NW(e.replace(/<br\s*\/?>/gi,` `).replace(/<[^>]+>/g,` `)).replace(/\s+/g,` `).trim(),FW=e=>{let t=e.trim().split(`:`).map(Number);return t.some(e=>!Number.isFinite(e)||e<0)?null:t.length===2?t[0]*60+t[1]:t.length===3?t[0]*3600+t[1]*60+t[2]:null},IW=e=>{let t=/https?:\/\/anilist\.co\/anime\/(\d+)/i.exec(e)?.[1];if(t)return{uri:`anilist:${t}`,anilist:Number(t)};let n=/https?:\/\/myanimelist\.net\/anime\/(\d+)/i.exec(e)?.[1];if(n)return{uri:`mal:${n}`};let r=/https?:\/\/anidb\.net\/(?:anime\/|perl-bin\/animedb\.pl\?show=anime&(?:amp;)?aid=)(\d+)/i.exec(e)?.[1];if(r)return{uri:`anidb:${r}`};let i=/https?:\/\/(?:www\.)?imdb\.com\/title\/(tt\d+)/i.exec(e)?.[1];if(i)return{uri:`omdb:${i}`}},LW=(e,t)=>{for(let n of[e,t]){let e=/(?:^|\s|-)S(\d{1,2})E(\d{1,3})\b/i.exec(n);if(e)return{season:Number(e[1]),episode:Number(e[2])}}let n=/\s-\s*(\d{1,4})(?:\s|$)/.exec(e);if(n)return{season:null,episode:Number(n[1])};let r=/\bEpisode\s+(\d{1,4})\b/i.exec(`${e} ${t}`);return r?{season:null,episode:Number(r[1])}:{season:null,episode:null}},RW=(e,t)=>(e.season??null)===(t.season??null)&&e.episode===t.episode,zW=e=>{if(/Daily Search Limit Exceeded/i.test(e))return{error:`limit`};if(/Search Rate Too High|too many requests|slow down/i.test(e)||/cf-turnstile|challenge-platform|<title>\s*Just a moment/i.test(e))return{error:`busy`};if(/Problem with remote|error processing|invalid image|cannot determine image|You need to specify an image/i.test(e))return{error:`failed`};let t=/* @__PURE__ */ new Map,n=e.match(/<table\b[^>]*class=["'][^"']*\bresulttable\b[^"']*["'][^>]*>[\s\S]*?<\/table>/gi)??[];for(let e of n){let n=/class=["'][^"']*\bresultsimilarityinfo\b[^"']*["'][^>]*>\s*(\d+(?:\.\d+)?)%/i.exec(e)?.[1],r=n?Number(n)/100:0;if(!Number.isFinite(r)||r<.6)continue;let i=IW(e);if(!i)continue;let a=/class=["'][^"']*\bresulttitle\b[^"']*["'][^>]*>([\s\S]*?)<\/div>/i.exec(e)?.[1]??``,o=/class=["'][^"']*\bresultcontentcolumn\b[^"']*["'][^>]*>([\s\S]*?)<\/div>/i.exec(e)?.[1]??e,{season:s,episode:c}=LW(PW(a),PW(o)),l=/Est Time:\s*(?:<\/strong>\s*)?(\d{1,2}:\d{2}(?::\d{2})?)/i.exec(o)?.[1],u=l?FW(l):null,d=u===null?void 0:{...s===null?{}:{season:s},episode:c,from:u},f=t.get(i.uri);if(!f){t.set(i.uri,{uri:i.uri,...i.anilist===void 0?{}:{anilist:i.anilist},moments:d?[d]:[]});continue}if(!d)continue;let p=f.moments.find(e=>RW(e,d));p?d.from<p.from&&(p.from=d.from):f.moments.push(d)}return{matches:[...t.values()]}},BW=`https://saucenao.com`,VW=[`saucenao.com`],HW=`Search for a scene on saucenao.com using the picture you chose`,UW=640,WW={anime:[21],movie:[23],series:[24],stub:[21,23,24]},GW=async e=>{if(typeof createImageBitmap==`function`&&typeof OffscreenCanvas<`u`)try{let t=await createImageBitmap(e);try{let e=Math.min(1,UW/t.width),n=Math.max(1,Math.round(t.width*e)),r=Math.max(1,Math.round(t.height*e)),i=new OffscreenCanvas(n,r),a=i.getContext(`2d`);if(a){a.drawImage(t,0,0,n,r);let e=await i.convertToBlob({type:`image/jpeg`,quality:.85});return{bytes:new Uint8Array(await e.arrayBuffer()),mimeType:`image/jpeg`}}}finally{t.close()}}catch{}return{bytes:new Uint8Array(await e.arrayBuffer()),mimeType:e.type||`image/jpeg`}},KW=({frames:e,prepare:t=GW})=>{let n=Promise.resolve(),r=async(n,r)=>{try{let{bytes:i,mimeType:a}=await t(n),o=WW[r],{status:s,html:c}=await e.use(`saucenao`,e=>e.search({bytes:i,mimeType:a,dbs:o})),l=zW(c);return`error`in l?l:s===429||s===403?{error:`busy`}:s>=400?{error:`failed`}:l}catch{return{error:`busy`}}};return(e,t)=>{let i=n.then(()=>r(e,t));return n=i,i}},qW,JW=()=>(qW??=import(`./assets/lib-saucenao-page-B1kaLTJz.js`).then(({default:e})=>KW({frames:Nn([{id:`saucenao`,url:`${BW}/`,origin:BW,domains:VW,reason:HW,pageScript:e}],{attach:async({url:e,...t})=>{let n=await C();return ne({...t,cookies:w(n)})},mount:()=>Rn(`SauceNAO`),connect:e=>Me({},{transport:e}),appOrigin:location.origin,key:()=>crypto.randomUUID(),connectTimeoutMs:12e3,callTimeoutMs:2e4})})),qW),YW=async(e,t)=>{try{return await(await JW())(e,t)}catch{return{error:`busy`}}};U();var XW=`t`,ZW=(e,t)=>`${e}?${XW}=${Math.max(0,Math.floor(t))}`,QW=e=>{let t=new URLSearchParams(e).get(XW);return t&&/^\d+$/.test(t)?Number(t):void 0},$W=(e,t,n,r,i)=>{let a=G({uris:n,guest:r,start:i});a.current={uris:n,guest:r,start:i},H(()=>{if(!e||!t)return;let n=!1,r,i=!1,o=()=>{document.visibilityState===`hidden`&&uf.flush()};document.addEventListener(`visibilitychange`,o);let s=e.onReport(o=>{let s=e.duration?.();if(!n&&s!==0){n=!0;let{uris:t,guest:r,start:i}=a.current,c=i??ff(t)?.[1];c!==void 0&&!r&&(i!==void 0||o.time<30)&&(!s||c<s)&&e.seek(c)}let c=e.ended?.();(o.time!==r||c)&&mf(t,{time:o.time,duration:s,ended:c}),o.paused&&!i&&uf.flush(),r=o.time,i=o.paused});return()=>{s(),document.removeEventListener(`visibilitychange`,o),uf.flush()}},[e,t])};U();var eG=RC(`
5012
+ `,DW=({person:e,detail:t,actor:n})=>/* @__PURE__ */ W(`div`,{className:n?`person actor`:`person`,children:[e.image?/* @__PURE__ */ V(`img`,{className:`face`,src:e.image,alt:``,loading:`lazy`}):void 0,/* @__PURE__ */ W(`div`,{children:[e.url?/* @__PURE__ */ V(`a`,{className:`name`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.name}):/* @__PURE__ */ V(`div`,{className:`name`,children:e.name}),t?/* @__PURE__ */ V(`div`,{className:`detail`,children:t}):void 0]})]}),OW=({characters:e})=>{let t=L(),n=t.formatMessage({id:`Characters`,defaultMessage:`Characters`}),r=bW(e),[i,a]=K(),o=xW(e,i??r.selected);return/* @__PURE__ */ W(`section`,{"data-characters":!0,children:[/* @__PURE__ */ W(`h2`,{children:[/* @__PURE__ */ V(`span`,{children:n}),r.options.length?/* @__PURE__ */ V(`select`,{"aria-label":t.formatMessage({id:`Language`,defaultMessage:`Language`}),value:i??r.selected,onChange:e=>a(e.currentTarget.value),children:r.options.map(e=>/* @__PURE__ */ V(`option`,{value:e,children:wW(e)},e))}):void 0]}),/* @__PURE__ */ V(jw,{items:o,size:TW,label:n,children:(e,t)=>/* @__PURE__ */ V(`ul`,{className:`credits`,children:e.map((e,n)=>/* @__PURE__ */ W(`li`,{children:[/* @__PURE__ */ V(DW,{person:e,detail:CW(e.role)}),e.actors.length?/* @__PURE__ */ V(`div`,{className:`actors`,children:e.actors.map(e=>/* @__PURE__ */ V(DW,{person:e,actor:!0},e.name))}):void 0]},`${e.name}:${t+n}`))})})]})},kW=({staff:e})=>{let t=L(),n=t.formatMessage({id:`Staff`,defaultMessage:`Staff`});return/* @__PURE__ */ W(`section`,{"data-staff":!0,children:[/* @__PURE__ */ V(`h2`,{children:n}),/* @__PURE__ */ V(jw,{items:e,size:TW,label:n,children:(e,n)=>/* @__PURE__ */ V(`ul`,{className:`credits`,children:e.map((e,r)=>/* @__PURE__ */ V(`li`,{children:/* @__PURE__ */ V(DW,{person:e,detail:e.roles?t.formatList(e.roles,Cn):void 0})},`${e.name}:${n+r}`))})})]})},AW=({url:e})=>{let[t,n]=K();return H(()=>{import(`./assets/lib-theme-player-J9RQNDH6.js`).then(e=>n(()=>e.default)).catch(()=>n(()=>({url:e})=>/* @__PURE__ */ V(`video`,{src:e,controls:!0,autoPlay:!0,playsInline:!0})))},[]),/* @__PURE__ */ V(`div`,{className:`player`,children:t?/* @__PURE__ */ V(t,{url:e}):void 0})},jW=({themes:e})=>{let t=L(),[n,r]=K();return/* @__PURE__ */ V(`ul`,{className:`themes`,children:e.map((e,i)=>{let a=e.video;return/* @__PURE__ */ W(`li`,{children:[/* @__PURE__ */ W(`div`,{className:`theme`,children:[a?/* @__PURE__ */ V(`button`,{type:`button`,className:`toggle`,"aria-label":n===i?t.formatMessage({id:`Stop`,defaultMessage:`Stop`}):t.formatMessage({id:`Play`,defaultMessage:`Play`}),onClick:()=>r(n===i?void 0:i),children:V(n===i?vx:pt,{size:14,fill:`currentColor`})}):/* @__PURE__ */ V(`span`,{className:`toggle`}),/* @__PURE__ */ W(`span`,{className:`kind`,children:[e.kind,e.sequence??``]}),e.group?/* @__PURE__ */ V(`span`,{className:`group`,dir:`auto`,children:e.group}):void 0,/* @__PURE__ */ V(`span`,{className:`song`,children:e.title}),/* @__PURE__ */ V(`span`,{className:`artists`,children:/* @__PURE__ */ V(`bdi`,{children:t.formatList(e.artists,Cn)})})]}),n===i&&a?/* @__PURE__ */ V(AW,{url:a}):void 0]},i)})})},MW=({themes:e})=>{let t=L().formatMessage({id:`Themes`,defaultMessage:`Themes`});return/* @__PURE__ */ W(`section`,{"data-themes":!0,children:[/* @__PURE__ */ V(`h2`,{children:t}),/* @__PURE__ */ V(jw,{items:e,size:TW,label:t,children:(e,t)=>/* @__PURE__ */ V(jW,{themes:e},t)})]})},NW=()=>{let e=L(),t=Nh(),n=Tn(t.uri),[,r]=Fh(),i=sO(Ih()),[a,o]=K(n);H(()=>{o(e=>e&&Dn(e,n??``)?e:n)},[n]);let[{data:s,operation:c}]=Zs({query:fE,variables:{input:{uri:a,details:!0},descriptionInput:{type:Nc.Html},details:!0},pause:!a}),l=s?.media,u=l?.handles.map(e=>e.node.uri)??[],d=iT({data:s,operation:c},a),f=mE(l?.uri),p=G(void 0),m=l?.titles.at(0);ct(()=>{let e=og(Q.TITLE,t,l&&{uri:l.uri,name:m?.title},p.current);e&&!Ew(l?.seasons,u)&&(e.grown&&(p.current=l.uri),r(`${e.path}${location.search}`,{replace:!0}))},[l?.uri,n,m?.title,t.slug]);let h=ww(l?.banners,l),g=ww(l?.covers,l);YU(m?.title),qU(l?.uri,m?.title);let _=nE(l?.titles),v=l?.descriptions.map(({description:e})=>e).sort((e,t)=>t.length-e.length).at(0),y=!!(l&&CT(l)),b=y?l.episodes.at(0):void 0,{sources:x,answered:S}=xE(b,l?.uri??``,l?.handles),C=SE(a,d?.settled&&S),w=xn(a??``).some(e=>Sa.includes(e)),T=y&&zT({startDate:l.startDate,status:l.status,episode:l.episodes.at(0)}).upcoming,E=sE(l??{},{locale:e.locale},w&&!C,T),D=l?iE(l):[],O=aE(l??{}),k=l?n_(l.season,l.seasonYear):void 0,[A,j]=K(!1),[M,N]=K(!1),P=G(null);ct(()=>{let e=P.current;e&&!A&&N(e.scrollHeight>e.clientHeight+1)},[v,A]),H(()=>{j(!1)},[a]);let ee=l?.trailers.at(0)?.url,te=e.formatMessage({id:`Trailer`,defaultMessage:`Trailer`});return aT({data:s,operation:c},a)?/* @__PURE__ */ V(KU,{}):/* @__PURE__ */ W(`div`,{css:EW,children:[/* @__PURE__ */ V(`div`,{className:`banner`,children:h??g?/* @__PURE__ */ V(`div`,{className:h?`image`:`image blurred`,style:{backgroundImage:`url(${h??g})`}}):void 0}),/* @__PURE__ */ W(`div`,{className:`body`,children:[g?/* @__PURE__ */ V(`img`,{className:`cover`,src:g,alt:``}):/* @__PURE__ */ V(`div`,{className:`cover`}),/* @__PURE__ */ W(`div`,{className:`heading`,children:[k?/* @__PURE__ */ V(`div`,{className:`season`,children:k}):C?void 0:/* @__PURE__ */ V(`div`,{className:`season`,children:/* @__PURE__ */ V(rw,{className:`pending`})}),/* @__PURE__ */ V(`h1`,{lang:m&&yW(m),children:m?.title??(C?void 0:/* @__PURE__ */ V(iw,{count:2,className:`pending`}))}),_?/* @__PURE__ */ V(`div`,{className:`second`,lang:yW(_),children:_.title}):w&&!C?/* @__PURE__ */ V(`div`,{className:`second`,children:/* @__PURE__ */ V(rw,{className:`pending`})}):void 0,D.length||l?.averageScore!=null||O.length?/* @__PURE__ */ W(`div`,{className:`chips`,children:[D.map(e=>/* @__PURE__ */ V(`span`,{className:`chip`,children:e},e)),l?.averageScore==null?void 0:/* @__PURE__ */ V(`span`,{className:`chip`,children:/* @__PURE__ */ V(hk,{percent:l.averageScore})}),O.map(e=>/* @__PURE__ */ V(`span`,{className:`chip`,children:e},e))]}):C?void 0:/* @__PURE__ */ V(`div`,{className:`chips`,children:/* @__PURE__ */ V(rw,{className:`pending`})}),v?/* @__PURE__ */ V(`div`,{ref:P,className:A?`description`:`description clamped`,dir:`auto`,dangerouslySetInnerHTML:{__html:v}}):C?void 0:/* @__PURE__ */ V(iw,{count:5,className:`description`}),v&&(M||A)?/* @__PURE__ */ V(`button`,{type:`button`,className:`expand`,onClick:()=>j(!A),children:A?e.formatMessage({id:`Collapse`,defaultMessage:`Collapse`}):e.formatMessage({id:`Expand`,defaultMessage:`Expand`})}):void 0,y?/* @__PURE__ */ V($w,{film:!0,sources:x,pending:!C}):void 0]}),/* @__PURE__ */ W(`div`,{className:`actions`,children:[l?/* @__PURE__ */ W(`div`,{className:`buttons`,children:[/* @__PURE__ */ V(gE,{media:l}),/* @__PURE__ */ V(KE,{className:`icon`,path:ag(Q.TITLE,{uri:l.uri,name:m?.title}),title:m?.title}),ee?/* @__PURE__ */ V(`a`,{className:`icon`,href:ee,target:`_blank`,rel:`noreferrer`,"aria-label":te,title:te,children:/* @__PURE__ */ V(Xb,{size:20})}):void 0,/* @__PURE__ */ V(DE,{uri:l.uri,handles:l.handles,links:l.streamingLinks,except:bE(b,l.handles)})]}):/* @__PURE__ */ V(`div`,{className:`buttons`,children:/* @__PURE__ */ V(rw,{className:`play-pending`})}),/* @__PURE__ */ V(`div`,{className:`tracking`,children:/* @__PURE__ */ V(CU,{work:a,address:n,uri:d?.uri,title:m?.title,cover:g,episodeCount:d?.episodeCount,movie:y})})]}),E.length?/* @__PURE__ */ V(`dl`,{className:`facts`,children:E.map(({label:e,value:t,pills:n})=>t?/* @__PURE__ */ W(`div`,{className:n&&`pills`,children:[/* @__PURE__ */ V(`dt`,{children:e}),/* @__PURE__ */ V(`dd`,{children:typeof t==`string`?t:/* @__PURE__ */ V(pk,{...n===`genre`?{genres:t,linked:!0}:{tags:t}})})]},e):/* @__PURE__ */ W(`div`,{className:n?`fact placeholder pills`:`fact placeholder`,"aria-hidden":`true`,children:[/* @__PURE__ */ V(`dt`,{children:e}),/* @__PURE__ */ V(`dd`,{children:/* @__PURE__ */ V(rw,{className:`pending`})})]},e))}):void 0,/* @__PURE__ */ W(`div`,{className:`main`,children:[/* @__PURE__ */ V(zO,{relations:l?.relations??[],action:/* @__PURE__ */ V(fH,{franchise:l?.franchise,currentUris:u,route:Q.TITLE}),route:Q.TITLE,pending:w&&!C}),/* @__PURE__ */ V(Dw,{seasons:l?.seasons,currentUris:u,href:e=>`${ag(Q.TITLE,{uri:e,name:m?.title})}${i}`}),l&&!y?/* @__PURE__ */ W(`section`,{"data-episodes":!0,children:[/* @__PURE__ */ V(`h2`,{children:e.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),d?/* @__PURE__ */ V(PE,{media:d,tracked:f}):/* @__PURE__ */ V(ME,{})]}):void 0,/* @__PURE__ */ V(BO,{recommendations:l?.recommendations??[],route:Q.TITLE}),l?.characters?.length?/* @__PURE__ */ V(OW,{characters:l.characters}):void 0,l?.staff?.length?/* @__PURE__ */ V(kW,{staff:l.staff}):void 0,l?.themes?.length?/* @__PURE__ */ V(MW,{themes:l.themes}):void 0]},a)]})]})},PW={...Object.fromEntries(`nbsp iexcl cent pound curren yen brvbar sect uml copy ordf laquo not shy reg macr deg plusmn sup2 sup3 acute micro para middot cedil sup1 ordm raquo frac14 frac12 frac34 iquest Agrave Aacute Acirc Atilde Auml Aring AElig Ccedil Egrave Eacute Ecirc Euml Igrave Iacute Icirc Iuml ETH Ntilde Ograve Oacute Ocirc Otilde Ouml times Oslash Ugrave Uacute Ucirc Uuml Yacute THORN szlig agrave aacute acirc atilde auml aring aelig ccedil egrave eacute ecirc euml igrave iacute icirc iuml eth ntilde ograve oacute ocirc otilde ouml divide oslash ugrave uacute ucirc uuml yacute thorn yuml`.split(` `).map((e,t)=>[e,String.fromCharCode(160+t)])),amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`,nbsp:` `,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,bull:`•`,hellip:`…`},FW=e=>e.replace(/&#x([0-9a-f]+);/gi,(e,t)=>String.fromCodePoint(parseInt(t,16))).replace(/&#(\d+);/g,(e,t)=>String.fromCodePoint(Number(t))).replace(/&([a-z]+\d*);/gi,(e,t)=>PW[t]??PW[t.toLowerCase()]??e),IW=e=>FW(e.replace(/<br\s*\/?>/gi,` `).replace(/<[^>]+>/g,` `)).replace(/\s+/g,` `).trim(),LW=e=>{let t=e.trim().split(`:`).map(Number);return t.some(e=>!Number.isFinite(e)||e<0)?null:t.length===2?t[0]*60+t[1]:t.length===3?t[0]*3600+t[1]*60+t[2]:null},RW=e=>{let t=/https?:\/\/anilist\.co\/anime\/(\d+)/i.exec(e)?.[1];if(t)return{uri:`anilist:${t}`,anilist:Number(t)};let n=/https?:\/\/myanimelist\.net\/anime\/(\d+)/i.exec(e)?.[1];if(n)return{uri:`mal:${n}`};let r=/https?:\/\/anidb\.net\/(?:anime\/|perl-bin\/animedb\.pl\?show=anime&(?:amp;)?aid=)(\d+)/i.exec(e)?.[1];if(r)return{uri:`anidb:${r}`};let i=/https?:\/\/(?:www\.)?imdb\.com\/title\/(tt\d+)/i.exec(e)?.[1];if(i)return{uri:`omdb:${i}`}},zW=(e,t)=>{for(let n of[e,t]){let e=/(?:^|\s|-)S(\d{1,2})E(\d{1,3})\b/i.exec(n);if(e)return{season:Number(e[1]),episode:Number(e[2])}}let n=/\s-\s*(\d{1,4})(?:\s|$)/.exec(e);if(n)return{season:null,episode:Number(n[1])};let r=/\bEpisode\s+(\d{1,4})\b/i.exec(`${e} ${t}`);return r?{season:null,episode:Number(r[1])}:{season:null,episode:null}},BW=(e,t)=>(e.season??null)===(t.season??null)&&e.episode===t.episode,VW=e=>{if(/Daily Search Limit Exceeded/i.test(e))return{error:`limit`};if(/Search Rate Too High|too many requests|slow down/i.test(e)||/cf-turnstile|challenge-platform|<title>\s*Just a moment/i.test(e))return{error:`busy`};if(/Problem with remote|error processing|invalid image|cannot determine image|You need to specify an image/i.test(e))return{error:`failed`};let t=/* @__PURE__ */ new Map,n=e.match(/<table\b[^>]*class=["'][^"']*\bresulttable\b[^"']*["'][^>]*>[\s\S]*?<\/table>/gi)??[];for(let e of n){let n=/class=["'][^"']*\bresultsimilarityinfo\b[^"']*["'][^>]*>\s*(\d+(?:\.\d+)?)%/i.exec(e)?.[1],r=n?Number(n)/100:0;if(!Number.isFinite(r)||r<.6)continue;let i=RW(e);if(!i)continue;let a=/class=["'][^"']*\bresulttitle\b[^"']*["'][^>]*>([\s\S]*?)<\/div>/i.exec(e)?.[1]??``,o=/class=["'][^"']*\bresultcontentcolumn\b[^"']*["'][^>]*>([\s\S]*?)<\/div>/i.exec(e)?.[1]??e,{season:s,episode:c}=zW(IW(a),IW(o)),l=/Est Time:\s*(?:<\/strong>\s*)?(\d{1,2}:\d{2}(?::\d{2})?)/i.exec(o)?.[1],u=l?LW(l):null,d=u===null?void 0:{...s===null?{}:{season:s},episode:c,from:u},f=t.get(i.uri);if(!f){t.set(i.uri,{uri:i.uri,...i.anilist===void 0?{}:{anilist:i.anilist},moments:d?[d]:[]});continue}if(!d)continue;let p=f.moments.find(e=>BW(e,d));p?d.from<p.from&&(p.from=d.from):f.moments.push(d)}return{matches:[...t.values()]}},HW=`https://saucenao.com`,UW=[`saucenao.com`],WW=`Search for a scene on saucenao.com using the picture you chose`,GW=640,KW={anime:[21],movie:[23],series:[24],stub:[21,23,24]},qW=async e=>{if(typeof createImageBitmap==`function`&&typeof OffscreenCanvas<`u`)try{let t=await createImageBitmap(e);try{let e=Math.min(1,GW/t.width),n=Math.max(1,Math.round(t.width*e)),r=Math.max(1,Math.round(t.height*e)),i=new OffscreenCanvas(n,r),a=i.getContext(`2d`);if(a){a.drawImage(t,0,0,n,r);let e=await i.convertToBlob({type:`image/jpeg`,quality:.85});return{bytes:new Uint8Array(await e.arrayBuffer()),mimeType:`image/jpeg`}}}finally{t.close()}}catch{}return{bytes:new Uint8Array(await e.arrayBuffer()),mimeType:e.type||`image/jpeg`}},JW=({frames:e,prepare:t=qW})=>{let n=Promise.resolve(),r=async(n,r)=>{try{let{bytes:i,mimeType:a}=await t(n),o=KW[r],{status:s,html:c}=await e.use(`saucenao`,e=>e.search({bytes:i,mimeType:a,dbs:o})),l=VW(c);return`error`in l?l:s===429||s===403?{error:`busy`}:s>=400?{error:`failed`}:l}catch{return{error:`busy`}}};return(e,t)=>{let i=n.then(()=>r(e,t));return n=i,i}},YW,XW=()=>(YW??=import(`./assets/lib-saucenao-page-B1kaLTJz.js`).then(({default:e})=>JW({frames:Nn([{id:`saucenao`,url:`${HW}/`,origin:HW,domains:UW,reason:WW,pageScript:e}],{attach:async({url:e,...t})=>{let n=await C();return ne({...t,cookies:w(n)})},mount:()=>Rn(`SauceNAO`),connect:e=>Me({},{transport:e}),appOrigin:location.origin,key:()=>crypto.randomUUID(),connectTimeoutMs:12e3,callTimeoutMs:2e4})})),YW),ZW=async(e,t)=>{try{return await(await XW())(e,t)}catch{return{error:`busy`}}};U();var QW=`t`,$W=(e,t)=>`${e}?${QW}=${Math.max(0,Math.floor(t))}`,eG=e=>{let t=new URLSearchParams(e).get(QW);return t&&/^\d+$/.test(t)?Number(t):void 0},tG=(e,t,n,r,i)=>{let a=G({uris:n,guest:r,start:i});a.current={uris:n,guest:r,start:i},H(()=>{if(!e||!t)return;let n=!1,r,i=!1,o=()=>{document.visibilityState===`hidden`&&uf.flush()};document.addEventListener(`visibilitychange`,o);let s=e.onReport(o=>{let s=e.duration?.();if(!n&&s!==0){n=!0;let{uris:t,guest:r,start:i}=a.current,c=i??ff(t)?.[1];c!==void 0&&!r&&(i!==void 0||o.time<30)&&(!s||c<s)&&e.seek(c)}let c=e.ended?.();(o.time!==r||c)&&mf(t,{time:o.time,duration:s,ended:c}),o.paused&&!i&&uf.flush(),r=o.time,i=o.paused});return()=>{s(),document.removeEventListener(`visibilitychange`,o),uf.flush()}},[e,t])};U();var nG=RC(`
5013
5013
  subscription SceneMedia($input: MediaInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
5014
5014
  media(input: $input) {
5015
5015
  ...SearchCard
@@ -5021,7 +5021,7 @@ scrollbar-gutter: stable;
5021
5021
  }
5022
5022
  }
5023
5023
  }
5024
- `),tG=Ne({limit:{id:`trace.moe's daily limit is reached. Try again tomorrow.`,defaultMessage:`trace.moe's daily limit is reached. Try again tomorrow.`},busy:{id:`trace.moe is busy. Try again in a moment.`,defaultMessage:`trace.moe is busy. Try again in a moment.`},failed:{id:`trace.moe could not search this picture.`,defaultMessage:`trace.moe could not search this picture.`},reupload:{id:`Select or paste the picture again to search SauceNAO.`,defaultMessage:`Select or paste the picture again to search SauceNAO.`}}),nG=Ne({limit:{id:`SauceNAO's daily limit is reached. Try again tomorrow.`,defaultMessage:`SauceNAO's daily limit is reached. Try again tomorrow.`},busy:{id:`SauceNAO is busy. Try again in a moment.`,defaultMessage:`SauceNAO is busy. Try again in a moment.`},failed:{id:`SauceNAO could not search this picture.`,defaultMessage:`SauceNAO could not search this picture.`},reupload:{id:`Select or paste the picture again to search SauceNAO.`,defaultMessage:`Select or paste the picture again to search SauceNAO.`}}),rG=(e,t)=>t?.length===1&&t[0]===`saucenao`?nG[e]:tG[e],iG=e=>{let[t,n]=K(),r=ya,i=r===`movie`||r===`series`;return H(()=>{if(!e)return;let t=!0;if(i){let i=Qx(e);if(!i){n({code:e,answer:{error:`reupload`,engines:[`saucenao`]}});return}return YW(i,r).catch(()=>({error:`busy`})).then(r=>{t&&n({code:e,answer:{...r,engines:[`saucenao`]}})}),()=>{t=!1}}let a=Qx(e),o=cr(e).catch(()=>({error:`busy`}));if(!a)return o.then(r=>{t&&n({code:e,answer:{...r,engines:[`trace.moe`]}})}),()=>{t=!1};let s=YW(a,r).catch(()=>({error:`busy`})),c,l,u=()=>{if(!t||!c)return;let r=`matches`in c?c.matches:[];if(!l){r.length&&n({code:e,answer:{matches:r,engines:[`trace.moe`]}});return}let i=`matches`in l?l.matches:[],a=[...`matches`in c&&(r.length>0||!i.length)?[`trace.moe`]:[],...`matches`in l&&(i.length>0||!r.length)?[`saucenao`]:[]];r.length||i.length?n({code:e,answer:{matches:xg(r,i),engines:a.length?a:[`trace.moe`]}}):`matches`in c||`matches`in l?n({code:e,answer:{matches:[],engines:a.length?a:[`trace.moe`]}}):n({code:e,answer:{error:c.error,engines:[`trace.moe`]}})};return o.then(e=>{c=e,u()}),s.then(e=>{l=e,u()}),()=>{t=!1}},[e,r,i]),t&&t.code===e?t.answer:void 0},aG=({match:e,item:t})=>{let n=L(),[{data:r}]=Zs({query:eG,variables:{input:{uri:yg(e)},shortDescriptionInput:{count:1}}}),i=r?.media;if(!i)return/* @__PURE__ */ V(rw,{className:`pending`});let a=i.type===Lc.Movie;return/* @__PURE__ */ W(`div`,{className:`scene`,children:[t(i),/* @__PURE__ */ V(`div`,{className:`moments`,children:e.moments.map(e=>{if(e.episode==null&&!a)return;let t=Sg(e.from),r=a||e.episode==null?t:e.season==null?n.formatMessage({id:`Episode {number}, {time}`,defaultMessage:`Episode {number}, {time}`},{number:e.episode,time:t}):n.formatMessage({id:`Season {season}, Episode {number}, {time}`,defaultMessage:`Season {season}, Episode {number}, {time}`},{season:e.season,number:e.episode,time:t}),o=e.episode==null?a?i.episodes[0]:void 0:i.episodes.find(t=>t.episodeNumber===e.episode&&(e.season==null||t.seasonNumber==null||t.seasonNumber===e.season));return o?/* @__PURE__ */ W(Uh,{className:`moment`,href:ZW(ag(Q.WATCH,{mediaUri:i.uri,episodeUri:o.uri}),e.from),children:[/* @__PURE__ */ V(pt,{size:14,fill:`currentColor`,"aria-hidden":`true`}),r]},r):/* @__PURE__ */ V(`span`,{className:`moment`,children:r},r)})})]})},oG=(e,t)=>{let n=e.nextAiringEpisode?.airingAt;if(!n)return;let r=new Date(n).getTime();return Number.isFinite(r)?r-t:void 0},sG=e=>e.episodeCount==null||CT(e)?void 0:J.formatMessage({id:`{count, plural, one {{count} episode} other {{count} episodes}}`,defaultMessage:`{count, plural, one {{count} episode} other {{count} episodes}}`},{count:e.episodeCount}),cG=(e,t)=>{if(!e)return;let n=e.trim().replace(/^#/,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n.length===6?n:void 0;if(!r||!/^[0-9a-f]{6}$/i.test(r))return;let i=parseInt(r,16);return`rgba(${i>>16&255}, ${i>>8&255}, ${i&255}, ${t})`},lG=e=>({"--accent":cG(e,1)??`rgba(255, 255, 255, 0.75)`,"--accent-soft":cG(e,.18)??`rgba(255, 255, 255, 0.08)`,"--accent-wash":cG(e,.07)??`rgba(255, 255, 255, 0.03)`}),uG=R`
5024
+ `),rG=Ne({limit:{id:`trace.moe's daily limit is reached. Try again tomorrow.`,defaultMessage:`trace.moe's daily limit is reached. Try again tomorrow.`},busy:{id:`trace.moe is busy. Try again in a moment.`,defaultMessage:`trace.moe is busy. Try again in a moment.`},failed:{id:`trace.moe could not search this picture.`,defaultMessage:`trace.moe could not search this picture.`},reupload:{id:`Select or paste the picture again to search SauceNAO.`,defaultMessage:`Select or paste the picture again to search SauceNAO.`}}),iG=Ne({limit:{id:`SauceNAO's daily limit is reached. Try again tomorrow.`,defaultMessage:`SauceNAO's daily limit is reached. Try again tomorrow.`},busy:{id:`SauceNAO is busy. Try again in a moment.`,defaultMessage:`SauceNAO is busy. Try again in a moment.`},failed:{id:`SauceNAO could not search this picture.`,defaultMessage:`SauceNAO could not search this picture.`},reupload:{id:`Select or paste the picture again to search SauceNAO.`,defaultMessage:`Select or paste the picture again to search SauceNAO.`}}),aG=(e,t)=>t?.length===1&&t[0]===`saucenao`?iG[e]:rG[e],oG=e=>{let[t,n]=K(),r=ya,i=r===`movie`||r===`series`;return H(()=>{if(!e)return;let t=!0;if(i){let i=Qx(e);if(!i){n({code:e,answer:{error:`reupload`,engines:[`saucenao`]}});return}return ZW(i,r).catch(()=>({error:`busy`})).then(r=>{t&&n({code:e,answer:{...r,engines:[`saucenao`]}})}),()=>{t=!1}}let a=Qx(e),o=cr(e).catch(()=>({error:`busy`}));if(!a)return o.then(r=>{t&&n({code:e,answer:{...r,engines:[`trace.moe`]}})}),()=>{t=!1};let s=ZW(a,r).catch(()=>({error:`busy`})),c,l,u=()=>{if(!t||!c)return;let r=`matches`in c?c.matches:[];if(!l){r.length&&n({code:e,answer:{matches:r,engines:[`trace.moe`]}});return}let i=`matches`in l?l.matches:[],a=[...`matches`in c&&(r.length>0||!i.length)?[`trace.moe`]:[],...`matches`in l&&(i.length>0||!r.length)?[`saucenao`]:[]];r.length||i.length?n({code:e,answer:{matches:xg(r,i),engines:a.length?a:[`trace.moe`]}}):`matches`in c||`matches`in l?n({code:e,answer:{matches:[],engines:a.length?a:[`trace.moe`]}}):n({code:e,answer:{error:c.error,engines:[`trace.moe`]}})};return o.then(e=>{c=e,u()}),s.then(e=>{l=e,u()}),()=>{t=!1}},[e,r,i]),t&&t.code===e?t.answer:void 0},sG=({match:e,item:t})=>{let n=L(),[{data:r}]=Zs({query:nG,variables:{input:{uri:yg(e)},shortDescriptionInput:{count:1}}}),i=r?.media;if(!i)return/* @__PURE__ */ V(rw,{className:`pending`});let a=i.type===Lc.Movie;return/* @__PURE__ */ W(`div`,{className:`scene`,children:[t(i),/* @__PURE__ */ V(`div`,{className:`moments`,children:e.moments.map(e=>{if(e.episode==null&&!a)return;let t=Sg(e.from),r=a||e.episode==null?t:e.season==null?n.formatMessage({id:`Episode {number}, {time}`,defaultMessage:`Episode {number}, {time}`},{number:e.episode,time:t}):n.formatMessage({id:`Season {season}, Episode {number}, {time}`,defaultMessage:`Season {season}, Episode {number}, {time}`},{season:e.season,number:e.episode,time:t}),o=e.episode==null?a?i.episodes[0]:void 0:i.episodes.find(t=>t.episodeNumber===e.episode&&(e.season==null||t.seasonNumber==null||t.seasonNumber===e.season));return o?/* @__PURE__ */ W(Uh,{className:`moment`,href:$W(ag(Q.WATCH,{mediaUri:i.uri,episodeUri:o.uri}),e.from),children:[/* @__PURE__ */ V(pt,{size:14,fill:`currentColor`,"aria-hidden":`true`}),r]},r):/* @__PURE__ */ V(`span`,{className:`moment`,children:r},r)})})]})},cG=(e,t)=>{let n=e.nextAiringEpisode?.airingAt;if(!n)return;let r=new Date(n).getTime();return Number.isFinite(r)?r-t:void 0},lG=e=>e.episodeCount==null||CT(e)?void 0:J.formatMessage({id:`{count, plural, one {{count} episode} other {{count} episodes}}`,defaultMessage:`{count, plural, one {{count} episode} other {{count} episodes}}`},{count:e.episodeCount}),uG=(e,t)=>{if(!e)return;let n=e.trim().replace(/^#/,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n.length===6?n:void 0;if(!r||!/^[0-9a-f]{6}$/i.test(r))return;let i=parseInt(r,16);return`rgba(${i>>16&255}, ${i>>8&255}, ${i&255}, ${t})`},dG=e=>({"--accent":uG(e,1)??`rgba(255, 255, 255, 0.75)`,"--accent-soft":uG(e,.18)??`rgba(255, 255, 255, 0.08)`,"--accent-wash":uG(e,.07)??`rgba(255, 255, 255, 0.03)`}),fG=R`
5025
5025
  display: grid;
5026
5026
  grid-template-columns: 15rem minmax(0, 1fr);
5027
5027
  height: 23rem;
@@ -5135,7 +5135,7 @@ scrollbar-gutter: stable;
5135
5135
  .description { -webkit-line-clamp: 3; }
5136
5136
  .chips { display: none; }
5137
5137
  }
5138
- `,dG=({media:e,to:t})=>{let n=L(),r=WT(),i=ww(e.covers,e,{box:VE}),a=e.covers?.find(e=>e.color)?.color,o=US(oG(e,r)??0),s=e.nextAiringEpisode?.episodeNumber,c=e_(e.type),l=n_(e.season,e.seasonYear),u=pn([c,sG(e)],` • `),d=t_(e.status)??(l?void 0:_T(e.startDate?.slice(0,4),{locale:n.locale}));return/* @__PURE__ */ W(Uh,{to:t,css:uG,style:lG(a),children:[/* @__PURE__ */ V(`div`,{className:`cover`,style:i?{backgroundImage:`url(${i})`}:void 0,children:/* @__PURE__ */ W(`div`,{className:`cover-text`,children:[/* @__PURE__ */ V(`div`,{className:`title`,dir:`auto`,children:e.titles?.at(0)?.title}),l&&/* @__PURE__ */ V(`div`,{className:`season`,children:l})]})}),/* @__PURE__ */ W(`div`,{className:`detail`,children:[/* @__PURE__ */ W(`div`,{className:`detail-top`,children:[/* @__PURE__ */ V(`div`,{children:o&&s!=null?/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`div`,{className:`airing-label`,children:n.formatMessage({id:`Ep {episode} airing in`,defaultMessage:`Ep {episode} airing in`},{episode:s})}),/* @__PURE__ */ V(`div`,{className:`airing-value airing`,children:o})]}):d&&/* @__PURE__ */ V(`div`,{className:`airing-value`,children:d})}),e.averageScore!=null&&/* @__PURE__ */ V(hk,{percent:e.averageScore})]}),u&&/* @__PURE__ */ V(`div`,{className:`meta`,children:u}),/* @__PURE__ */ V(`div`,{className:`description`,dir:`auto`,children:e.shortDescriptions?.at(0)?.shortDescription}),/* @__PURE__ */ V(pk,{genres:e.genres?.slice(0,2)})]})]})},fG=R`
5138
+ `,pG=({media:e,to:t})=>{let n=L(),r=WT(),i=ww(e.covers,e,{box:VE}),a=e.covers?.find(e=>e.color)?.color,o=US(cG(e,r)??0),s=e.nextAiringEpisode?.episodeNumber,c=e_(e.type),l=n_(e.season,e.seasonYear),u=pn([c,lG(e)],` • `),d=t_(e.status)??(l?void 0:_T(e.startDate?.slice(0,4),{locale:n.locale}));return/* @__PURE__ */ W(Uh,{to:t,css:fG,style:dG(a),children:[/* @__PURE__ */ V(`div`,{className:`cover`,style:i?{backgroundImage:`url(${i})`}:void 0,children:/* @__PURE__ */ W(`div`,{className:`cover-text`,children:[/* @__PURE__ */ V(`div`,{className:`title`,dir:`auto`,children:e.titles?.at(0)?.title}),l&&/* @__PURE__ */ V(`div`,{className:`season`,children:l})]})}),/* @__PURE__ */ W(`div`,{className:`detail`,children:[/* @__PURE__ */ W(`div`,{className:`detail-top`,children:[/* @__PURE__ */ V(`div`,{children:o&&s!=null?/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`div`,{className:`airing-label`,children:n.formatMessage({id:`Ep {episode} airing in`,defaultMessage:`Ep {episode} airing in`},{episode:s})}),/* @__PURE__ */ V(`div`,{className:`airing-value airing`,children:o})]}):d&&/* @__PURE__ */ V(`div`,{className:`airing-value`,children:d})}),e.averageScore!=null&&/* @__PURE__ */ V(hk,{percent:e.averageScore})]}),u&&/* @__PURE__ */ V(`div`,{className:`meta`,children:u}),/* @__PURE__ */ V(`div`,{className:`description`,dir:`auto`,children:e.shortDescriptions?.at(0)?.shortDescription}),/* @__PURE__ */ V(pk,{genres:e.genres?.slice(0,2)})]})]})},mG=R`
5139
5139
  display: grid;
5140
5140
  grid-template-columns: 5rem minmax(0, 1fr) 11rem 11rem 17rem;
5141
5141
  align-items: center;
@@ -5206,7 +5206,7 @@ scrollbar-gutter: stable;
5206
5206
  .score { display: none; }
5207
5207
  .chips { display: none; }
5208
5208
  }
5209
- `,pG=({media:e,to:t})=>{let n=L(),r=WT(),i=ww(e.covers,e,{box:VE}),a=e.covers?.find(e=>e.color)?.color,o=US(oG(e,r)??0,1),s=e.nextAiringEpisode?.episodeNumber,c=sG(e);return/* @__PURE__ */ W(Uh,{to:t,css:fG,style:lG(a),children:[/* @__PURE__ */ V(`div`,{className:`cover`,style:i?{backgroundImage:`url(${i})`}:void 0}),/* @__PURE__ */ W(`div`,{className:`heading`,children:[/* @__PURE__ */ V(`div`,{className:`title`,children:e.titles?.at(0)?.title}),/* @__PURE__ */ V(pk,{genres:e.genres?.slice(0,5)})]}),/* @__PURE__ */ W(`div`,{className:`column score`,children:[e.averageScore!=null&&/* @__PURE__ */ V(hk,{percent:e.averageScore}),e.followers!=null&&/* @__PURE__ */ V(`span`,{className:`secondary`,children:n.formatMessage({id:`{count, plural, one {# user} other {# users}}`,defaultMessage:`{count, plural, one {# user} other {# users}}`},{count:e.followers})})]}),/* @__PURE__ */ W(`div`,{className:`column format`,children:[/* @__PURE__ */ V(`span`,{children:e_(e.type)}),c&&/* @__PURE__ */ V(`span`,{className:`secondary`,children:c})]}),/* @__PURE__ */ W(`div`,{className:`column`,children:[/* @__PURE__ */ V(`span`,{children:t_(e.status)}),o&&s!=null&&/* @__PURE__ */ V(`span`,{className:`secondary airing`,children:n.formatMessage({id:`Ep {episode} airing in {countdown}`,defaultMessage:`Ep {episode} airing in {countdown}`},{episode:s,countdown:o})})]})]})},mG={grid:nx,card:tx,list:ix},hG=Ne({grid:{id:`Covers#result layout`,defaultMessage:`Covers`,description:`result layout`},card:{id:`Cards#result layout`,defaultMessage:`Cards`,description:`result layout`},list:{id:`List#result layout`,defaultMessage:`List`,description:`result layout`}}),gG=R`
5209
+ `,hG=({media:e,to:t})=>{let n=L(),r=WT(),i=ww(e.covers,e,{box:VE}),a=e.covers?.find(e=>e.color)?.color,o=US(cG(e,r)??0,1),s=e.nextAiringEpisode?.episodeNumber,c=lG(e);return/* @__PURE__ */ W(Uh,{to:t,css:mG,style:dG(a),children:[/* @__PURE__ */ V(`div`,{className:`cover`,style:i?{backgroundImage:`url(${i})`}:void 0}),/* @__PURE__ */ W(`div`,{className:`heading`,children:[/* @__PURE__ */ V(`div`,{className:`title`,children:e.titles?.at(0)?.title}),/* @__PURE__ */ V(pk,{genres:e.genres?.slice(0,5)})]}),/* @__PURE__ */ W(`div`,{className:`column score`,children:[e.averageScore!=null&&/* @__PURE__ */ V(hk,{percent:e.averageScore}),e.followers!=null&&/* @__PURE__ */ V(`span`,{className:`secondary`,children:n.formatMessage({id:`{count, plural, one {# user} other {# users}}`,defaultMessage:`{count, plural, one {# user} other {# users}}`},{count:e.followers})})]}),/* @__PURE__ */ W(`div`,{className:`column format`,children:[/* @__PURE__ */ V(`span`,{children:e_(e.type)}),c&&/* @__PURE__ */ V(`span`,{className:`secondary`,children:c})]}),/* @__PURE__ */ W(`div`,{className:`column`,children:[/* @__PURE__ */ V(`span`,{children:t_(e.status)}),o&&s!=null&&/* @__PURE__ */ V(`span`,{className:`secondary airing`,children:n.formatMessage({id:`Ep {episode} airing in {countdown}`,defaultMessage:`Ep {episode} airing in {countdown}`},{episode:s,countdown:o})})]})]})},gG={grid:nx,card:tx,list:ix},_G=Ne({grid:{id:`Covers#result layout`,defaultMessage:`Covers`,description:`result layout`},card:{id:`Cards#result layout`,defaultMessage:`Cards`,description:`result layout`},list:{id:`List#result layout`,defaultMessage:`List`,description:`result layout`}}),vG=R`
5210
5210
  display: inline-flex;
5211
5211
  gap: 0.4rem;
5212
5212
  padding: 0.4rem;
@@ -5233,7 +5233,7 @@ scrollbar-gutter: stable;
5233
5233
  background: rgba(255, 255, 255, 0.12);
5234
5234
  color: #fff;
5235
5235
  }
5236
- `,_G=({mode:e,modes:t=hf,onChange:n})=>{let r=L();return/* @__PURE__ */ V(`div`,{css:gG,role:`group`,"aria-label":r.formatMessage({id:`Result layout`,defaultMessage:`Result layout`}),children:t.map(t=>{let i=mG[t],a=r.formatMessage(hG[t]);return/* @__PURE__ */ V(`button`,{type:`button`,title:a,"aria-label":a,"aria-pressed":e===t,onClick:()=>n(t),children:/* @__PURE__ */ V(i,{size:18})},t)})})};U();var vG=R`
5236
+ `,yG=({mode:e,modes:t=hf,onChange:n})=>{let r=L();return/* @__PURE__ */ V(`div`,{css:vG,role:`group`,"aria-label":r.formatMessage({id:`Result layout`,defaultMessage:`Result layout`}),children:t.map(t=>{let i=gG[t],a=r.formatMessage(_G[t]);return/* @__PURE__ */ V(`button`,{type:`button`,title:a,"aria-label":a,"aria-pressed":e===t,onClick:()=>n(t),children:/* @__PURE__ */ V(i,{size:18})},t)})})};U();var bG=R`
5237
5237
  display: flex;
5238
5238
  flex-direction: column;
5239
5239
  gap: 0.7rem;
@@ -5283,7 +5283,7 @@ scrollbar-gutter: stable;
5283
5283
  }
5284
5284
 
5285
5285
  .control.open .chevron { transform: rotate(180deg); }
5286
- `,yG=R`
5286
+ `,xG=R`
5287
5287
  z-index: ${Aa.filterMenu};
5288
5288
  width: max-content;
5289
5289
  min-width: 22rem;
@@ -5358,7 +5358,7 @@ scrollbar-gutter: stable;
5358
5358
  font-size: 1.4rem;
5359
5359
  color: rgba(255, 255, 255, 0.4);
5360
5360
  }
5361
- `,bG=({label:e,options:t,selected:n,onChange:r,multiple:i=!1,searchable:a,allowCustom:o=!1})=>{let s=L(),[c,l]=K(!1),[u,d]=K(``),[f,p]=K(-1),m=G([]),h=At(),g=e=>`${h}-option-${e}`;H(()=>{c||p(-1)},[c]),H(()=>{p(-1)},[u]),H(()=>{c&&f>=0&&m.current[f]?.scrollIntoView?.({block:`nearest`})},[c,f]);let{refs:_,floatingStyles:v,context:y}=fb({open:c,onOpenChange:e=>{l(e),e||d(``)},placement:`bottom-start`,whileElementsMounted:$e,middleware:[Uv(6),Gv({padding:8}),Wv({padding:8}),Kv({padding:8,apply:({availableHeight:e,elements:t})=>{t.floating.style.maxHeight=`${Math.max(160,e)}px`}})]}),{getReferenceProps:b,getFloatingProps:x}=gb([ob(y),ub(y),vb(y,{role:`listbox`})]),S=s.formatList(n.map(e=>t.find(t=>t.value===e)?.label??e),Cn),C=B(()=>{let e=u.trim().toLowerCase(),n=e?t.filter(t=>t.label.toLowerCase().includes(e)):t;return!o||!e||n.some(t=>t.label.toLowerCase()===e)?n:[{value:u.trim(),label:u.trim()},...n]},[t,u,o]),w=e=>{i?r(n.includes(e)?n.filter(t=>t!==e):[...n,e]):(r(n.includes(e)?[]:[e]),l(!1),d(``))},T=(e,t)=>{if(!c){if(t!==`trigger`)return;(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),e.stopPropagation(),l(!0),p(C.length?e.key===`ArrowDown`?0:C.length-1:-1))}else if(C.length){if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let n=f<0?0:(f+1)%C.length;p(n),t===`option`&&m.current[n]?.focus()}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let n=f<0?C.length-1:(f-1+C.length)%C.length;p(n),t===`option`&&m.current[n]?.focus()}else if(e.key===`Home`&&t!==`input`)e.preventDefault(),e.stopPropagation(),p(0),t===`option`&&m.current[0]?.focus();else if(e.key===`End`&&t!==`input`){e.preventDefault(),e.stopPropagation();let n=C.length-1;p(n),t===`option`&&m.current[n]?.focus()}else e.key===`Enter`&&t!==`option`&&f>=0&&C[f]&&(e.preventDefault(),e.stopPropagation(),w(C[f].value))}},E=c&&f>=0&&C[f]?g(f):void 0;return/* @__PURE__ */ W(`div`,{css:vG,children:[/* @__PURE__ */ V(`span`,{className:`label`,id:h,children:e}),/* @__PURE__ */ W(`button`,{ref:_.setReference,type:`button`,className:c?`control open`:`control`,"aria-labelledby":h,...b({onKeyDown:e=>T(e,`trigger`)}),"aria-activedescendant":a===void 0?E:void 0,children:[/* @__PURE__ */ V(`span`,{className:n.length?`value`:`value any`,children:n.length?S:s.formatMessage({id:`Any#no filter picked`,defaultMessage:`Any`,description:`no filter picked`})}),/* @__PURE__ */ V(Wb,{size:16,className:`chevron`})]}),c&&/* @__PURE__ */ V(By,{children:/* @__PURE__ */ V(Zy,{context:y,modal:!1,initialFocus:a===void 0?-1:0,children:/* @__PURE__ */ W(`div`,{ref:_.setFloating,css:yG,style:v,...x(),children:[a!==void 0&&/* @__PURE__ */ W(`div`,{className:`filter`,children:[/* @__PURE__ */ V(ht,{size:15}),/* @__PURE__ */ V(`input`,{type:`text`,value:u,placeholder:a,"aria-label":a,"aria-activedescendant":E,onInput:e=>d(e.currentTarget.value),onKeyDown:e=>T(e,`input`)})]}),/* @__PURE__ */ V(`div`,{className:`options`,children:C.length?C.map((e,t)=>/* @__PURE__ */ W(`button`,{id:g(t),ref:e=>{m.current[t]=e},type:`button`,role:`option`,"aria-selected":n.includes(e.value),className:`option${n.includes(e.value)?` selected`:``}${t===f?` active`:``}`,onMouseEnter:()=>p(t),onFocus:()=>p(t),onKeyDown:e=>T(e,`option`),onClick:()=>w(e.value),children:[/* @__PURE__ */ V(Nt,{size:16,className:n.includes(e.value)?`tick`:`tick hidden`}),/* @__PURE__ */ V(`span`,{children:e.label})]},e.value)):/* @__PURE__ */ V(`div`,{className:`empty`,children:s.formatMessage({id:`Nothing matches “{term}”.`,defaultMessage:`Nothing matches “{term}”.`},{term:u})})})]})})})]})},xG=({label:e,children:t})=>/* @__PURE__ */ W(`div`,{css:vG,children:[/* @__PURE__ */ V(`span`,{className:`label`,children:e}),t]});U();var SG=ya===`movie`||ya===`series`;RC(`
5361
+ `,SG=({label:e,options:t,selected:n,onChange:r,multiple:i=!1,searchable:a,allowCustom:o=!1})=>{let s=L(),[c,l]=K(!1),[u,d]=K(``),[f,p]=K(-1),m=G([]),h=At(),g=e=>`${h}-option-${e}`;H(()=>{c||p(-1)},[c]),H(()=>{p(-1)},[u]),H(()=>{c&&f>=0&&m.current[f]?.scrollIntoView?.({block:`nearest`})},[c,f]);let{refs:_,floatingStyles:v,context:y}=fb({open:c,onOpenChange:e=>{l(e),e||d(``)},placement:`bottom-start`,whileElementsMounted:$e,middleware:[Uv(6),Gv({padding:8}),Wv({padding:8}),Kv({padding:8,apply:({availableHeight:e,elements:t})=>{t.floating.style.maxHeight=`${Math.max(160,e)}px`}})]}),{getReferenceProps:b,getFloatingProps:x}=gb([ob(y),ub(y),vb(y,{role:`listbox`})]),S=s.formatList(n.map(e=>t.find(t=>t.value===e)?.label??e),Cn),C=B(()=>{let e=u.trim().toLowerCase(),n=e?t.filter(t=>t.label.toLowerCase().includes(e)):t;return!o||!e||n.some(t=>t.label.toLowerCase()===e)?n:[{value:u.trim(),label:u.trim()},...n]},[t,u,o]),w=e=>{i?r(n.includes(e)?n.filter(t=>t!==e):[...n,e]):(r(n.includes(e)?[]:[e]),l(!1),d(``))},T=(e,t)=>{if(!c){if(t!==`trigger`)return;(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),e.stopPropagation(),l(!0),p(C.length?e.key===`ArrowDown`?0:C.length-1:-1))}else if(C.length){if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let n=f<0?0:(f+1)%C.length;p(n),t===`option`&&m.current[n]?.focus()}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let n=f<0?C.length-1:(f-1+C.length)%C.length;p(n),t===`option`&&m.current[n]?.focus()}else if(e.key===`Home`&&t!==`input`)e.preventDefault(),e.stopPropagation(),p(0),t===`option`&&m.current[0]?.focus();else if(e.key===`End`&&t!==`input`){e.preventDefault(),e.stopPropagation();let n=C.length-1;p(n),t===`option`&&m.current[n]?.focus()}else e.key===`Enter`&&t!==`option`&&f>=0&&C[f]&&(e.preventDefault(),e.stopPropagation(),w(C[f].value))}},E=c&&f>=0&&C[f]?g(f):void 0;return/* @__PURE__ */ W(`div`,{css:bG,children:[/* @__PURE__ */ V(`span`,{className:`label`,id:h,children:e}),/* @__PURE__ */ W(`button`,{ref:_.setReference,type:`button`,className:c?`control open`:`control`,"aria-labelledby":h,...b({onKeyDown:e=>T(e,`trigger`)}),"aria-activedescendant":a===void 0?E:void 0,children:[/* @__PURE__ */ V(`span`,{className:n.length?`value`:`value any`,children:n.length?S:s.formatMessage({id:`Any#no filter picked`,defaultMessage:`Any`,description:`no filter picked`})}),/* @__PURE__ */ V(Wb,{size:16,className:`chevron`})]}),c&&/* @__PURE__ */ V(By,{children:/* @__PURE__ */ V(Zy,{context:y,modal:!1,initialFocus:a===void 0?-1:0,children:/* @__PURE__ */ W(`div`,{ref:_.setFloating,css:xG,style:v,...x(),children:[a!==void 0&&/* @__PURE__ */ W(`div`,{className:`filter`,children:[/* @__PURE__ */ V(ht,{size:15}),/* @__PURE__ */ V(`input`,{type:`text`,value:u,placeholder:a,"aria-label":a,"aria-activedescendant":E,onInput:e=>d(e.currentTarget.value),onKeyDown:e=>T(e,`input`)})]}),/* @__PURE__ */ V(`div`,{className:`options`,children:C.length?C.map((e,t)=>/* @__PURE__ */ W(`button`,{id:g(t),ref:e=>{m.current[t]=e},type:`button`,role:`option`,"aria-selected":n.includes(e.value),className:`option${n.includes(e.value)?` selected`:``}${t===f?` active`:``}`,onMouseEnter:()=>p(t),onFocus:()=>p(t),onKeyDown:e=>T(e,`option`),onClick:()=>w(e.value),children:[/* @__PURE__ */ V(Nt,{size:16,className:n.includes(e.value)?`tick`:`tick hidden`}),/* @__PURE__ */ V(`span`,{children:e.label})]},e.value)):/* @__PURE__ */ V(`div`,{className:`empty`,children:s.formatMessage({id:`Nothing matches “{term}”.`,defaultMessage:`Nothing matches “{term}”.`},{term:u})})})]})})})]})},CG=({label:e,children:t})=>/* @__PURE__ */ W(`div`,{css:bG,children:[/* @__PURE__ */ V(`span`,{className:`label`,children:e}),t]});U();var wG=ya===`movie`||ya===`series`;RC(`
5362
5362
  fragment SearchCard on Media {
5363
5363
  ...MediaFragment
5364
5364
  score
@@ -5404,7 +5404,7 @@ scrollbar-gutter: stable;
5404
5404
  airingAt
5405
5405
  }
5406
5406
  }
5407
- `);var CG=RC(`
5407
+ `);var TG=RC(`
5408
5408
  subscription SearchMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
5409
5409
  mediaPage(input: $input) {
5410
5410
  nodes {
@@ -5412,7 +5412,7 @@ scrollbar-gutter: stable;
5412
5412
  }
5413
5413
  }
5414
5414
  }
5415
- `),wG=R`
5415
+ `),EG=R`
5416
5416
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
5417
5417
  min-height: 100vh;
5418
5418
 
@@ -5606,7 +5606,7 @@ scrollbar-gutter: stable;
5606
5606
  .grid > .pending { width: 100%; height: auto; aspect-ratio: 5 / 7; }
5607
5607
  .cards > .pending { height: 17rem; }
5608
5608
  }
5609
- `,TG=(()=>{let e=[];for(let t=Hg();t>=Vg;t--)e.push({value:String(t),label:String(t)});return e})(),EG=e=>({...e.query?{search:e.query}:{sorts:[Fc.PopularityDesc]},...e.category?{categories:[e.category]}:{},...e.status?{status:e.status}:{},...e.season?{season:e.season}:{},...e.year?{seasonYear:e.year}:{},...e.formats.length?{formats:e.formats}:{},...e.genres.length?{genres:e.genres}:{},...e.tags.length?{tags:e.tags}:{}}),DG=({covered:e=!1})=>{let t=L(),n=Ih(),[,r]=Fh(),i=B(()=>Wg(n),[n]),a=ya===`movie`||ya===`series`,o=Zg(n),s=iG(o),c=!o&&i_(i),l=s?.engines??(a?[`saucenao`]:[`trace.moe`]),{searchPicture:u,unreadable:d}=rS();aS(u,!e);let f=e=>r(Jg({...i,...e}),{replace:!0}),[p,m]=K(i.query),h=G(null);H(()=>{document.activeElement!==h.current&&m(e=>e.trim()===i.query?e:i.query)},[i.query]);let[g,_]=K(()=>document.activeElement?.matches(`header input`)?``:i.query);H(()=>{let e=setTimeout(()=>_(i.query),350);return()=>clearTimeout(e)},[i.query]);let v=g!==i.query,y={...i,query:g},b=B(()=>EG(y),[Kg(y)]),[{data:x}]=Zs({query:CG,variables:{input:b,shortDescriptionInput:{count:1}},pause:!!o||!i_(y)}),[S,C]=K(yf),w=e=>{C(e),bf(e)},[T,E]=K(!1);H(()=>{E(!1);let e=setTimeout(()=>E(!0),5e3);return()=>clearTimeout(e)},[n,b]);let D=G(x),O=G(b);x!==D.current&&(D.current=x,O.current=b);let k=c&&!v&&O.current===b?x?.mediaPage?.nodes??[]:[],A=!!(i.season&&i.year),{genreOptions:j,tagOptions:M,genreKeys:N}=B(()=>{let e=new Map(Ag[ya].map(e=>[_g(e),e])),n=/* @__PURE__ */ new Map;for(let t of i.genres)e.set(_g(t),t);for(let e of i.tags)n.set(_g(e),e);let r=(t,r)=>{let i=_g(r);!e.has(i)&&!n.has(i)&&t.set(i,r)};if(A)for(let t of k)for(let n of t.genres??[])r(e,n);for(let e of k)for(let t of e.tags??[])r(n,t);let a=(e,n)=>e.label.localeCompare(n.label,t.locale);return{genreKeys:new Set(e.keys()),genreOptions:[...e.values()].map(e=>({value:e,label:Ng(e)})).sort(a),tagOptions:[...n.values()].map(e=>({value:e,label:e})).sort(a)}},[k,i.genres,i.tags,A]),P=[...i.genres,...i.tags],ee=e=>N.has(_g(e)),te=e=>f({genres:e.filter(ee),tags:e.filter(e=>!ee(e))}),F={grid:{className:`grid`,item:e=>/* @__PURE__ */ V(UE,{media:e,to:ag(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title}),ellipsis:!1})},card:{className:`cards`,item:e=>/* @__PURE__ */ V(dG,{media:e,to:ag(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title})})},list:{className:`rows`,item:e=>/* @__PURE__ */ V(pG,{media:e,to:ag(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title})})}}[S],ne=/* @__PURE__ */ V(`div`,{className:F.className,children:Array.from({length:12},(e,t)=>/* @__PURE__ */ V(rw,{className:`pending`},t))}),I=[...i.year?[{key:`year`,label:String(i.year),clear:{year:null}}]:[],...i.season?[{key:`season`,label:$g(Eg,i.season),clear:{season:null}}]:[],...i.status?[{key:`status`,label:$g(Tg,i.status),clear:{status:null}}]:[],...i.category?[{key:`category`,label:$g(Dg,i.category),clear:{category:null}}]:[],...i.formats.map(e=>({key:`format:${e}`,label:$g(wg,e),clear:{formats:i.formats.filter(t=>t!==e)}})),...i.genres.map(e=>({key:`genre:${e}`,label:Ng(e),clear:{genres:i.genres.filter(t=>t!==e)}})),...i.tags.map(e=>({key:`tag:${e}`,label:e,clear:{tags:i.tags.filter(t=>t!==e)}}))],re=e=>e.map(({value:e,label:n})=>({value:e,label:t.formatMessage(n)})),ie=/* @__PURE__ */ V(`div`,{className:`status`,children:t.formatMessage({id:`No results found.`,defaultMessage:`No results found.`})});return/* @__PURE__ */ W(`div`,{css:wG,children:[/* @__PURE__ */ W(`div`,{className:`heading-row`,children:[/* @__PURE__ */ V(`h1`,{className:`heading`,children:o?t.formatMessage({id:`Scene search`,defaultMessage:`Scene search`}):Qg(i)}),/* @__PURE__ */ V(_G,{mode:S,onChange:w})]}),o?/* @__PURE__ */ V(`div`,{className:`credit`,children:l.includes(`trace.moe`)&&l.includes(`saucenao`)?t.formatMessage({id:`Scenes found by <trace>trace.moe</trace> and <saucenao>SauceNAO</saucenao>`,defaultMessage:`Scenes found by <trace>trace.moe</trace> and <saucenao>SauceNAO</saucenao>`},{trace:e=>/* @__PURE__ */ V(`a`,{href:`https://trace.moe`,target:`_blank`,rel:`noreferrer noopener`,children:e}),saucenao:e=>/* @__PURE__ */ V(`a`,{href:BW,target:`_blank`,rel:`noreferrer noopener`,children:e})}):l[0]===`saucenao`?t.formatMessage({id:`Scenes found by <link>SauceNAO</link>`,defaultMessage:`Scenes found by <link>SauceNAO</link>`},{link:e=>/* @__PURE__ */ V(`a`,{href:BW,target:`_blank`,rel:`noreferrer noopener`,children:e})}):t.formatMessage({id:`Scenes found by <link>trace.moe</link>`,defaultMessage:`Scenes found by <link>trace.moe</link>`},{link:e=>/* @__PURE__ */ V(`a`,{href:`https://trace.moe`,target:`_blank`,rel:`noreferrer noopener`,children:e})})}):void 0,/* @__PURE__ */ W(`div`,{className:`filters`,children:[/* @__PURE__ */ V(xG,{label:t.formatMessage({id:`Search`,defaultMessage:`Search`}),children:/* @__PURE__ */ W(`div`,{className:`text-field`,children:[/* @__PURE__ */ V(ht,{size:17}),/* @__PURE__ */ V(`input`,{ref:h,type:`text`,value:p,placeholder:t.formatMessage({id:`Any title`,defaultMessage:`Any title`}),"aria-label":t.formatMessage({id:`Search by title`,defaultMessage:`Search by title`}),onInput:e=>{let t=e.currentTarget.value;m(t),f({query:t})}}),/* @__PURE__ */ V(oS,{onPicture:u,size:17})]})}),/* @__PURE__ */ V(bG,{label:SG?t.formatMessage({id:`Genres`,defaultMessage:`Genres`}):t.formatMessage({id:`Genres & Tags`,defaultMessage:`Genres & Tags`}),options:[...j,...M],selected:P,onChange:te,multiple:!0,searchable:SG?t.formatMessage({id:`Filter genres`,defaultMessage:`Filter genres`}):t.formatMessage({id:`Filter genres & tags`,defaultMessage:`Filter genres & tags`}),allowCustom:!SG}),/* @__PURE__ */ V(bG,{label:t.formatMessage({id:`Year`,defaultMessage:`Year`}),options:TG,selected:i.year?[String(i.year)]:[],onChange:e=>f({year:e.length?Number(e[0]):null}),searchable:t.formatMessage({id:`Filter year`,defaultMessage:`Filter year`})}),SG?void 0:/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(bG,{label:t.formatMessage({id:`Season#broadcast season`,defaultMessage:`Season`,description:`broadcast season`}),options:re(Eg),selected:i.season?[i.season]:[],onChange:e=>f({season:e[0]??null})}),/* @__PURE__ */ V(bG,{label:t.formatMessage({id:`Format`,defaultMessage:`Format`}),options:re(wg),selected:i.formats,onChange:e=>f({formats:e}),multiple:!0}),/* @__PURE__ */ V(bG,{label:t.formatMessage({id:`Airing Status`,defaultMessage:`Airing Status`}),options:re(Tg),selected:i.status?[i.status]:[],onChange:e=>f({status:e[0]??null})})]}),ya===`stub`?/* @__PURE__ */ V(bG,{label:t.formatMessage({id:`Category`,defaultMessage:`Category`}),options:re(Dg),selected:i.category?[i.category]:[],onChange:e=>f({category:e[0]??null})}):void 0]}),/* @__PURE__ */ W(`div`,{className:`chips`,children:[I.map(e=>/* @__PURE__ */ W(`button`,{type:`button`,className:`chip`,"aria-label":t.formatMessage({id:`Remove {filter}`,defaultMessage:`Remove {filter}`},{filter:e.label}),onClick:()=>f(e.clear),children:[e.label,/* @__PURE__ */ V(Cx,{size:14})]},e.key)),I.length>1&&/* @__PURE__ */ V(`button`,{type:`button`,className:`chip-clear`,onClick:()=>f({category:null,status:null,season:null,year:null,formats:[],genres:[],tags:[]}),children:t.formatMessage({id:`Clear filters`,defaultMessage:`Clear filters`})})]}),d?/* @__PURE__ */ V(`div`,{className:`status`,children:t.formatMessage({id:`This picture could not be read.`,defaultMessage:`This picture could not be read.`})}):o?s?`error`in s?/* @__PURE__ */ V(`div`,{className:`status`,children:t.formatMessage(rG(s.error,s.engines))}):s.matches.length?/* @__PURE__ */ V(`div`,{className:F.className,children:s.matches.map(e=>/* @__PURE__ */ V(aG,{match:e,item:F.item},yg(e)))}):ie:ne:k.length?/* @__PURE__ */ V(`div`,{className:F.className,children:k.map(F.item)}):c?T?ie:ne:/* @__PURE__ */ V(`div`,{className:`status`,children:r_(i)?t.formatMessage({id:`Add a title or another filter.`,defaultMessage:`Add a title or another filter.`}):t.formatMessage({id:`Search by title, or pick a filter.`,defaultMessage:`Search by title, or pick a filter.`})})]})},OG=R`
5609
+ `,DG=(()=>{let e=[];for(let t=Hg();t>=Vg;t--)e.push({value:String(t),label:String(t)});return e})(),OG=e=>({...e.query?{search:e.query}:{sorts:[Fc.PopularityDesc]},...e.category?{categories:[e.category]}:{},...e.status?{status:e.status}:{},...e.season?{season:e.season}:{},...e.year?{seasonYear:e.year}:{},...e.formats.length?{formats:e.formats}:{},...e.genres.length?{genres:e.genres}:{},...e.tags.length?{tags:e.tags}:{}}),kG=({covered:e=!1})=>{let t=L(),n=Ih(),[,r]=Fh(),i=B(()=>Wg(n),[n]),a=ya===`movie`||ya===`series`,o=Zg(n),s=oG(o),c=!o&&i_(i),l=s?.engines??(a?[`saucenao`]:[`trace.moe`]),{searchPicture:u,unreadable:d}=rS();aS(u,!e);let f=e=>r(Jg({...i,...e}),{replace:!0}),[p,m]=K(i.query),h=G(null);H(()=>{document.activeElement!==h.current&&m(e=>e.trim()===i.query?e:i.query)},[i.query]);let[g,_]=K(()=>document.activeElement?.matches(`header input`)?``:i.query);H(()=>{let e=setTimeout(()=>_(i.query),350);return()=>clearTimeout(e)},[i.query]);let v=g!==i.query,y={...i,query:g},b=B(()=>OG(y),[Kg(y)]),[{data:x}]=Zs({query:TG,variables:{input:b,shortDescriptionInput:{count:1}},pause:!!o||!i_(y)}),[S,C]=K(yf),w=e=>{C(e),bf(e)},[T,E]=K(!1);H(()=>{E(!1);let e=setTimeout(()=>E(!0),5e3);return()=>clearTimeout(e)},[n,b]);let D=G(x),O=G(b);x!==D.current&&(D.current=x,O.current=b);let k=c&&!v&&O.current===b?x?.mediaPage?.nodes??[]:[],A=!!(i.season&&i.year),{genreOptions:j,tagOptions:M,genreKeys:N}=B(()=>{let e=new Map(Ag[ya].map(e=>[_g(e),e])),n=/* @__PURE__ */ new Map;for(let t of i.genres)e.set(_g(t),t);for(let e of i.tags)n.set(_g(e),e);let r=(t,r)=>{let i=_g(r);!e.has(i)&&!n.has(i)&&t.set(i,r)};if(A)for(let t of k)for(let n of t.genres??[])r(e,n);for(let e of k)for(let t of e.tags??[])r(n,t);let a=(e,n)=>e.label.localeCompare(n.label,t.locale);return{genreKeys:new Set(e.keys()),genreOptions:[...e.values()].map(e=>({value:e,label:Ng(e)})).sort(a),tagOptions:[...n.values()].map(e=>({value:e,label:e})).sort(a)}},[k,i.genres,i.tags,A]),P=[...i.genres,...i.tags],ee=e=>N.has(_g(e)),te=e=>f({genres:e.filter(ee),tags:e.filter(e=>!ee(e))}),F={grid:{className:`grid`,item:e=>/* @__PURE__ */ V(UE,{media:e,to:ag(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title}),ellipsis:!1})},card:{className:`cards`,item:e=>/* @__PURE__ */ V(pG,{media:e,to:ag(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title})})},list:{className:`rows`,item:e=>/* @__PURE__ */ V(hG,{media:e,to:ag(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title})})}}[S],ne=/* @__PURE__ */ V(`div`,{className:F.className,children:Array.from({length:12},(e,t)=>/* @__PURE__ */ V(rw,{className:`pending`},t))}),I=[...i.year?[{key:`year`,label:String(i.year),clear:{year:null}}]:[],...i.season?[{key:`season`,label:$g(Eg,i.season),clear:{season:null}}]:[],...i.status?[{key:`status`,label:$g(Tg,i.status),clear:{status:null}}]:[],...i.category?[{key:`category`,label:$g(Dg,i.category),clear:{category:null}}]:[],...i.formats.map(e=>({key:`format:${e}`,label:$g(wg,e),clear:{formats:i.formats.filter(t=>t!==e)}})),...i.genres.map(e=>({key:`genre:${e}`,label:Ng(e),clear:{genres:i.genres.filter(t=>t!==e)}})),...i.tags.map(e=>({key:`tag:${e}`,label:e,clear:{tags:i.tags.filter(t=>t!==e)}}))],re=e=>e.map(({value:e,label:n})=>({value:e,label:t.formatMessage(n)})),ie=/* @__PURE__ */ V(`div`,{className:`status`,children:t.formatMessage({id:`No results found.`,defaultMessage:`No results found.`})});return/* @__PURE__ */ W(`div`,{css:EG,children:[/* @__PURE__ */ W(`div`,{className:`heading-row`,children:[/* @__PURE__ */ V(`h1`,{className:`heading`,children:o?t.formatMessage({id:`Scene search`,defaultMessage:`Scene search`}):Qg(i)}),/* @__PURE__ */ V(yG,{mode:S,onChange:w})]}),o?/* @__PURE__ */ V(`div`,{className:`credit`,children:l.includes(`trace.moe`)&&l.includes(`saucenao`)?t.formatMessage({id:`Scenes found by <trace>trace.moe</trace> and <saucenao>SauceNAO</saucenao>`,defaultMessage:`Scenes found by <trace>trace.moe</trace> and <saucenao>SauceNAO</saucenao>`},{trace:e=>/* @__PURE__ */ V(`a`,{href:`https://trace.moe`,target:`_blank`,rel:`noreferrer noopener`,children:e}),saucenao:e=>/* @__PURE__ */ V(`a`,{href:HW,target:`_blank`,rel:`noreferrer noopener`,children:e})}):l[0]===`saucenao`?t.formatMessage({id:`Scenes found by <link>SauceNAO</link>`,defaultMessage:`Scenes found by <link>SauceNAO</link>`},{link:e=>/* @__PURE__ */ V(`a`,{href:HW,target:`_blank`,rel:`noreferrer noopener`,children:e})}):t.formatMessage({id:`Scenes found by <link>trace.moe</link>`,defaultMessage:`Scenes found by <link>trace.moe</link>`},{link:e=>/* @__PURE__ */ V(`a`,{href:`https://trace.moe`,target:`_blank`,rel:`noreferrer noopener`,children:e})})}):void 0,/* @__PURE__ */ W(`div`,{className:`filters`,children:[/* @__PURE__ */ V(CG,{label:t.formatMessage({id:`Search`,defaultMessage:`Search`}),children:/* @__PURE__ */ W(`div`,{className:`text-field`,children:[/* @__PURE__ */ V(ht,{size:17}),/* @__PURE__ */ V(`input`,{ref:h,type:`text`,value:p,placeholder:t.formatMessage({id:`Any title`,defaultMessage:`Any title`}),"aria-label":t.formatMessage({id:`Search by title`,defaultMessage:`Search by title`}),onInput:e=>{let t=e.currentTarget.value;m(t),f({query:t})}}),/* @__PURE__ */ V(oS,{onPicture:u,size:17})]})}),/* @__PURE__ */ V(SG,{label:wG?t.formatMessage({id:`Genres`,defaultMessage:`Genres`}):t.formatMessage({id:`Genres & Tags`,defaultMessage:`Genres & Tags`}),options:[...j,...M],selected:P,onChange:te,multiple:!0,searchable:wG?t.formatMessage({id:`Filter genres`,defaultMessage:`Filter genres`}):t.formatMessage({id:`Filter genres & tags`,defaultMessage:`Filter genres & tags`}),allowCustom:!wG}),/* @__PURE__ */ V(SG,{label:t.formatMessage({id:`Year`,defaultMessage:`Year`}),options:DG,selected:i.year?[String(i.year)]:[],onChange:e=>f({year:e.length?Number(e[0]):null}),searchable:t.formatMessage({id:`Filter year`,defaultMessage:`Filter year`})}),wG?void 0:/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(SG,{label:t.formatMessage({id:`Season#broadcast season`,defaultMessage:`Season`,description:`broadcast season`}),options:re(Eg),selected:i.season?[i.season]:[],onChange:e=>f({season:e[0]??null})}),/* @__PURE__ */ V(SG,{label:t.formatMessage({id:`Format`,defaultMessage:`Format`}),options:re(wg),selected:i.formats,onChange:e=>f({formats:e}),multiple:!0}),/* @__PURE__ */ V(SG,{label:t.formatMessage({id:`Airing Status`,defaultMessage:`Airing Status`}),options:re(Tg),selected:i.status?[i.status]:[],onChange:e=>f({status:e[0]??null})})]}),ya===`stub`?/* @__PURE__ */ V(SG,{label:t.formatMessage({id:`Category`,defaultMessage:`Category`}),options:re(Dg),selected:i.category?[i.category]:[],onChange:e=>f({category:e[0]??null})}):void 0]}),/* @__PURE__ */ W(`div`,{className:`chips`,children:[I.map(e=>/* @__PURE__ */ W(`button`,{type:`button`,className:`chip`,"aria-label":t.formatMessage({id:`Remove {filter}`,defaultMessage:`Remove {filter}`},{filter:e.label}),onClick:()=>f(e.clear),children:[e.label,/* @__PURE__ */ V(Cx,{size:14})]},e.key)),I.length>1&&/* @__PURE__ */ V(`button`,{type:`button`,className:`chip-clear`,onClick:()=>f({category:null,status:null,season:null,year:null,formats:[],genres:[],tags:[]}),children:t.formatMessage({id:`Clear filters`,defaultMessage:`Clear filters`})})]}),d?/* @__PURE__ */ V(`div`,{className:`status`,children:t.formatMessage({id:`This picture could not be read.`,defaultMessage:`This picture could not be read.`})}):o?s?`error`in s?/* @__PURE__ */ V(`div`,{className:`status`,children:t.formatMessage(aG(s.error,s.engines))}):s.matches.length?/* @__PURE__ */ V(`div`,{className:F.className,children:s.matches.map(e=>/* @__PURE__ */ V(sG,{match:e,item:F.item},yg(e)))}):ie:ne:k.length?/* @__PURE__ */ V(`div`,{className:F.className,children:k.map(F.item)}):c?T?ie:ne:/* @__PURE__ */ V(`div`,{className:`status`,children:r_(i)?t.formatMessage({id:`Add a title or another filter.`,defaultMessage:`Add a title or another filter.`}):t.formatMessage({id:`Search by title, or pick a filter.`,defaultMessage:`Search by title, or pick a filter.`})})]})},AG=R`
5610
5610
  max-width: 72rem;
5611
5611
  margin: 0 auto;
5612
5612
  padding: calc(var(--stub-header-height) + 3rem) 3rem 6rem;
@@ -5645,7 +5645,7 @@ scrollbar-gutter: stable;
5645
5645
  color: #ff8a3d;
5646
5646
  }
5647
5647
  }
5648
- `,kG=({children:e})=>/* @__PURE__ */ V(`div`,{css:OG,lang:`en`,dir:`ltr`,children:e}),AG=()=>/* @__PURE__ */ W(kG,{children:[/* @__PURE__ */ V(`h1`,{children:`Legal & Terms`}),/* @__PURE__ */ V(`div`,{className:`updated`,children:`Last updated 31 October 2026`}),/* @__PURE__ */ V(`p`,{children:`stub is an independent, non-commercial personal project, provided “as is” without warranties of any kind.`}),/* @__PURE__ */ V(`h2`,{children:`No hosted content`}),/* @__PURE__ */ V(`p`,{children:`stub hosts, stores, and distributes no media of its own. Titles, descriptions, artwork, ratings, and playback streams are retrieved on demand from third-party services (including AniList, MyAnimeList, Crunchyroll, JustWatch, and Netflix). So that titles still show when those services are unreachable, stub’s files also carry titles, artwork addresses, and descriptions compiled from the anime-offline-database, AniDB, Kitsu, and those services. All of it remains the property of its respective owners. You access those services with your own accounts and are responsible for complying with their terms.`}),/* @__PURE__ */ W(`p`,{children:[`Contains information from`,` `,/* @__PURE__ */ V(`a`,{href:`https://github.com/cedya77/anime-offline-database`,target:`_blank`,rel:`noreferrer noopener`,children:`cedya77/anime-offline-database`}),`, continuing`,` `,/* @__PURE__ */ V(`a`,{href:`https://github.com/manami-project/anime-offline-database`,target:`_blank`,rel:`noreferrer noopener`,children:`manami-project/anime-offline-database`}),`, made available under the`,` `,/* @__PURE__ */ V(`a`,{href:`https://opendatacommons.org/licenses/odbl/1-0/`,target:`_blank`,rel:`noreferrer noopener`,children:`ODbL`}),`.`]}),/* @__PURE__ */ W(`p`,{children:[`Contains information from`,` `,/* @__PURE__ */ V(`a`,{href:`https://www.tvmaze.com/`,target:`_blank`,rel:`noreferrer noopener`,children:`TVmaze`}),`, made available under`,` `,/* @__PURE__ */ V(`a`,{href:`https://creativecommons.org/licenses/by-sa/4.0/`,target:`_blank`,rel:`noreferrer noopener`,children:`CC BY-SA`}),`.`]}),/* @__PURE__ */ V(`h2`,{children:`Personal use`}),/* @__PURE__ */ V(`p`,{children:`stub is a technical showcase of in-browser media aggregation, intended for personal, non-commercial use. It is not a content provider.`}),/* @__PURE__ */ V(`h2`,{children:`Privacy`}),/* @__PURE__ */ W(`p`,{children:[`stub keeps no accounts and stores no personal data. See the`,` `,/* @__PURE__ */ V(Uh,{href:ag(Q.PRIVACY),children:`Privacy page`}),` for what is and isn’t handled when you use it.`]}),/* @__PURE__ */ V(`h2`,{children:`Rights holders`}),/* @__PURE__ */ W(`p`,{children:[`Apart from the compiled titles, artwork addresses, and descriptions above, stub stores no content itself; anything you see lives on the third-party service it came from. If you are a rights holder with a concern, you can reach the maintainer through the project repository at`,` `,/* @__PURE__ */ V(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]}),/* @__PURE__ */ V(`h2`,{children:`Liability`}),/* @__PURE__ */ V(`p`,{children:`stub is provided without warranty of any kind. The maintainer is not liable for any damages arising from its use, or for the availability, accuracy, or legality of any third-party service it connects to.`})]}),jG=`This browser, in its storage for stub at this address`,MG=`This tab, in its storage for stub`,NG=`The account's copy is deleted with your FKN account, and this browser's copy of it when you sign out, or, on a stub site closed at that moment, the next time it opens`,PG=[{id:`added-sources`,title:`Added sources`,what:`The source packages you added from npm or that a link you opened named, installed for stub through FKN. Signed in to FKN, the list is your account's, so every stub site you sign in on gets it. Sources added while signed out join the list of the next FKN account signed in on this browser. A source you make temporary is not kept on this device, and neither are the sources a link added in the page you sign out on: FKN holds them for that tab alone.`,where:`${jG}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you remove them. ${NG}. A temporary source lasts as long as its tab, and a copy your browser makes of that tab, such as a duplicated tab, takes it along`,keys:{store:`local`,names:[$s,ec]}},{id:`source-settings`,title:`Source settings`,what:`What you enter in Settings for a source you added, such as a server address or an access key, as you typed it. stub hands it to that source each time the source connects and when you save it, and to no other source. Signed in to FKN, it is your account's, so every stub site and device you sign in on gets it. What you entered while signed out joins the next FKN account signed in on this browser, unless that account already set it.`,where:`${jG}, not encrypted, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you change it or remove the source, on any site or device. ${NG}`,keys:{store:`local`,names:[tc,nc]}},{id:`tab-source-settings`,title:`Temporary source settings`,what:`What you enter in Settings for a temporary source, which stub hands to that source alone. It never reaches your FKN account.`,where:MG,lasts:`Until you remove the source or close the tab. A copy your browser makes of the tab takes it along`,keys:{store:`session`,names:[rc]}},{id:`settings`,title:`Settings`,what:`Your choices in Settings and around stub: sources turned off, hidden icons, the country and the language you picked, autoplay, whether episodes open in a new tab, the search layout, the trackers you chose not to save to and whether you expanded them, the play order, the merge order, the audio and subtitle languages you picked in Settings or last picked in a player, and whether subtitles always show. Signed in to FKN, they are your account's, so every stub site and device you sign in on gets them. What you set while signed out joins the next FKN account signed in on this browser, unless that account already set it.`,where:`${jG}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you change them. ${NG}`,keys:{store:`local`,names:[...Tf,ce]}},{id:`connected-sites`,title:`Connected tracking sites`,what:`Which of AniList, MyAnimeList, Trakt and Crunchyroll you signed in to through stub on this device, so stub reaches only those.`,where:jG,lasts:`Until you sign out of them, or clear this site's data in your browser`,keys:{store:`local`,names:[h]}},{id:`site-status`,title:`Site sign-in states`,what:`Whether you were signed in to Crunchyroll, Prime Video, AniList, MyAnimeList and Trakt when stub last learned it, when, and whether you were signed in to it on this browser before. Never your name there.`,where:jG,lasts:`Until stub learns it again, or you clear this site's data in your browser. That you were signed in before stays through the sign outs stub finds after it, and goes when you sign out in stub's Settings`,keys:{store:`local`,names:[Se]}},{id:`party-name`,title:`Party name`,what:`The name you gave yourself in a watch party.`,where:MG,lasts:`Until you close the tab`,keys:{store:`session`,names:[Qi]}},{id:`party-invite`,title:`Party you are in`,what:`The watch party this tab is in, so a reload rejoins it.`,where:MG,lasts:`Until you leave the party or close the tab`,keys:{store:`session`,names:[Zi]}},{id:`update-reloads`,title:`Update reloads`,what:`When this tab last reloaded by itself onto a new version of stub, so it does so at most twice in five minutes.`,where:MG,lasts:`Until you close the tab`,keys:{store:`session`,names:[ja]}},{id:`language-carried`,title:`Language picked while FKN was not answering`,what:`The language you picked in Settings while your FKN account could not take it, so the reload that shows it still saves it to your account.`,where:MG,lasts:`Until that reload`,keys:{store:`session`,names:[v]}},{id:`stub-list`,title:`Stub's list`,what:`What you track with stub's own tracker: status, progress, score and dates, with each title's name and cover. Signed in to FKN, stub uses your account's list instead, encrypted in this browser before it is stored.`,where:`The browser's private files for stub at this address, on this device only, and your FKN account's storage once you use its list`,lasts:`As long as the list: a removed entry stays in it, with its title and last values, as a record that it was removed`},{id:`site-sign-ins`,title:`Site sign-ins`,what:`Your Crunchyroll, Prime Video, AniList, MyAnimeList and Trakt sessions, which stub plays and tracks with: the cookies each site sets, and for Trakt also the sign-in Trakt's own page keeps in its storage.`,where:`Without the FKN extension, FKN keeps them for every fkn.app app. With it, your browser does.`,lasts:`Until you sign out, or the site ends the session`},{id:`fkn-account`,title:`FKN account`,what:`Which FKN account you are signed in with.`,where:`FKN, not stub`,lasts:`Until you disconnect`},{id:`player`,title:`Player volume`,what:`The volume you last left a player at, and whether it was muted, so the next episode or theme starts the same. Speed is not kept.`,where:jG,lasts:`Until you clear this site's data in your browser`,keys:{store:`local`,names:[gt]}},{id:`positions`,title:`Where you stopped`,what:`The point you stopped at in each episode you have not finished, with the source it played on, its length and when you stopped, for your 200 most recent, and the source and time of the 200 you finished last. Signed in to FKN, they are your account's, so every stub site and device you sign in on resumes there. Those kept while signed out join the next FKN account signed in on this browser.`,where:`${jG}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until 200 newer ones replace them. ${NG}`,keys:{store:`local`,names:[rf,af]}},{id:`recommended`,title:`Recommended for you`,what:`The shows AniList recommends beside the ones on your lists, and the AniList ids of the shows it was asked about.`,where:jG,lasts:`Until home asks again, a day later or once those shows change, or you clear this site's data in your browser. Home removes it when no show on your lists is left to ask about, or when AniList is turned off`,keys:{store:`local`,names:[qO]}},{id:`fetched`,title:`Titles, artwork and streams`,what:`What stub fetched to show you.`,where:`Memory, in this tab`,lasts:`Until you refresh or close the tab`}],FG=R`
5648
+ `,jG=({children:e})=>/* @__PURE__ */ V(`div`,{css:AG,lang:`en`,dir:`ltr`,children:e}),MG=()=>/* @__PURE__ */ W(jG,{children:[/* @__PURE__ */ V(`h1`,{children:`Legal & Terms`}),/* @__PURE__ */ V(`div`,{className:`updated`,children:`Last updated 31 October 2026`}),/* @__PURE__ */ V(`p`,{children:`stub is an independent, non-commercial personal project, provided “as is” without warranties of any kind.`}),/* @__PURE__ */ V(`h2`,{children:`No hosted content`}),/* @__PURE__ */ V(`p`,{children:`stub hosts, stores, and distributes no media of its own. Titles, descriptions, artwork, ratings, and playback streams are retrieved on demand from third-party services (including AniList, MyAnimeList, Crunchyroll, JustWatch, and Netflix). So that titles still show when those services are unreachable, stub’s files also carry titles, artwork addresses, and descriptions compiled from the anime-offline-database, AniDB, Kitsu, and those services. All of it remains the property of its respective owners. You access those services with your own accounts and are responsible for complying with their terms.`}),/* @__PURE__ */ W(`p`,{children:[`Contains information from`,` `,/* @__PURE__ */ V(`a`,{href:`https://github.com/cedya77/anime-offline-database`,target:`_blank`,rel:`noreferrer noopener`,children:`cedya77/anime-offline-database`}),`, continuing`,` `,/* @__PURE__ */ V(`a`,{href:`https://github.com/manami-project/anime-offline-database`,target:`_blank`,rel:`noreferrer noopener`,children:`manami-project/anime-offline-database`}),`, made available under the`,` `,/* @__PURE__ */ V(`a`,{href:`https://opendatacommons.org/licenses/odbl/1-0/`,target:`_blank`,rel:`noreferrer noopener`,children:`ODbL`}),`.`]}),/* @__PURE__ */ W(`p`,{children:[`Contains information from`,` `,/* @__PURE__ */ V(`a`,{href:`https://www.tvmaze.com/`,target:`_blank`,rel:`noreferrer noopener`,children:`TVmaze`}),`, made available under`,` `,/* @__PURE__ */ V(`a`,{href:`https://creativecommons.org/licenses/by-sa/4.0/`,target:`_blank`,rel:`noreferrer noopener`,children:`CC BY-SA`}),`.`]}),/* @__PURE__ */ V(`h2`,{children:`Personal use`}),/* @__PURE__ */ V(`p`,{children:`stub is a technical showcase of in-browser media aggregation, intended for personal, non-commercial use. It is not a content provider.`}),/* @__PURE__ */ V(`h2`,{children:`Privacy`}),/* @__PURE__ */ W(`p`,{children:[`stub keeps no accounts and stores no personal data. See the`,` `,/* @__PURE__ */ V(Uh,{href:ag(Q.PRIVACY),children:`Privacy page`}),` for what is and isn’t handled when you use it.`]}),/* @__PURE__ */ V(`h2`,{children:`Rights holders`}),/* @__PURE__ */ W(`p`,{children:[`Apart from the compiled titles, artwork addresses, and descriptions above, stub stores no content itself; anything you see lives on the third-party service it came from. If you are a rights holder with a concern, you can reach the maintainer through the project repository at`,` `,/* @__PURE__ */ V(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]}),/* @__PURE__ */ V(`h2`,{children:`Liability`}),/* @__PURE__ */ V(`p`,{children:`stub is provided without warranty of any kind. The maintainer is not liable for any damages arising from its use, or for the availability, accuracy, or legality of any third-party service it connects to.`})]}),NG=`This browser, in its storage for stub at this address`,PG=`This tab, in its storage for stub`,FG=`The account's copy is deleted with your FKN account, and this browser's copy of it when you sign out, or, on a stub site closed at that moment, the next time it opens`,IG=[{id:`added-sources`,title:`Added sources`,what:`The source packages you added from npm or that a link you opened named, installed for stub through FKN. Signed in to FKN, the list is your account's, so every stub site you sign in on gets it. Sources added while signed out join the list of the next FKN account signed in on this browser. A source you make temporary is not kept on this device, and neither are the sources a link added in the page you sign out on: FKN holds them for that tab alone.`,where:`${NG}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you remove them. ${FG}. A temporary source lasts as long as its tab, and a copy your browser makes of that tab, such as a duplicated tab, takes it along`,keys:{store:`local`,names:[$s,ec]}},{id:`source-settings`,title:`Source settings`,what:`What you enter in Settings for a source you added, such as a server address or an access key, as you typed it. stub hands it to that source each time the source connects and when you save it, and to no other source. Signed in to FKN, it is your account's, so every stub site and device you sign in on gets it. What you entered while signed out joins the next FKN account signed in on this browser, unless that account already set it.`,where:`${NG}, not encrypted, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you change it or remove the source, on any site or device. ${FG}`,keys:{store:`local`,names:[tc,nc]}},{id:`tab-source-settings`,title:`Temporary source settings`,what:`What you enter in Settings for a temporary source, which stub hands to that source alone. It never reaches your FKN account.`,where:PG,lasts:`Until you remove the source or close the tab. A copy your browser makes of the tab takes it along`,keys:{store:`session`,names:[rc]}},{id:`settings`,title:`Settings`,what:`Your choices in Settings and around stub: sources turned off, hidden icons, the country and the language you picked, autoplay, whether episodes open in a new tab, the search layout, the trackers you chose not to save to and whether you expanded them, the play order, the merge order, the audio and subtitle languages you picked in Settings or last picked in a player, and whether subtitles always show. Signed in to FKN, they are your account's, so every stub site and device you sign in on gets them. What you set while signed out joins the next FKN account signed in on this browser, unless that account already set it.`,where:`${NG}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you change them. ${FG}`,keys:{store:`local`,names:[...Tf,ce]}},{id:`connected-sites`,title:`Connected tracking sites`,what:`Which of AniList, MyAnimeList, Trakt and Crunchyroll you signed in to through stub on this device, so stub reaches only those.`,where:NG,lasts:`Until you sign out of them, or clear this site's data in your browser`,keys:{store:`local`,names:[h]}},{id:`site-status`,title:`Site sign-in states`,what:`Whether you were signed in to Crunchyroll, Prime Video, AniList, MyAnimeList and Trakt when stub last learned it, when, and whether you were signed in to it on this browser before. Never your name there.`,where:NG,lasts:`Until stub learns it again, or you clear this site's data in your browser. That you were signed in before stays through the sign outs stub finds after it, and goes when you sign out in stub's Settings`,keys:{store:`local`,names:[Se]}},{id:`party-name`,title:`Party name`,what:`The name you gave yourself in a watch party.`,where:PG,lasts:`Until you close the tab`,keys:{store:`session`,names:[Qi]}},{id:`party-invite`,title:`Party you are in`,what:`The watch party this tab is in, so a reload rejoins it.`,where:PG,lasts:`Until you leave the party or close the tab`,keys:{store:`session`,names:[Zi]}},{id:`update-reloads`,title:`Update reloads`,what:`When this tab last reloaded by itself onto a new version of stub, so it does so at most twice in five minutes.`,where:PG,lasts:`Until you close the tab`,keys:{store:`session`,names:[ja]}},{id:`language-carried`,title:`Language picked while FKN was not answering`,what:`The language you picked in Settings while your FKN account could not take it, so the reload that shows it still saves it to your account.`,where:PG,lasts:`Until that reload`,keys:{store:`session`,names:[v]}},{id:`stub-list`,title:`Stub's list`,what:`What you track with stub's own tracker: status, progress, score and dates, with each title's name and cover. Signed in to FKN, stub uses your account's list instead, encrypted in this browser before it is stored.`,where:`The browser's private files for stub at this address, on this device only, and your FKN account's storage once you use its list`,lasts:`As long as the list: a removed entry stays in it, with its title and last values, as a record that it was removed`},{id:`site-sign-ins`,title:`Site sign-ins`,what:`Your Crunchyroll, Prime Video, AniList, MyAnimeList and Trakt sessions, which stub plays and tracks with: the cookies each site sets, and for Trakt also the sign-in Trakt's own page keeps in its storage.`,where:`Without the FKN extension, FKN keeps them for every fkn.app app. With it, your browser does.`,lasts:`Until you sign out, or the site ends the session`},{id:`fkn-account`,title:`FKN account`,what:`Which FKN account you are signed in with.`,where:`FKN, not stub`,lasts:`Until you disconnect`},{id:`player`,title:`Player volume`,what:`The volume you last left a player at, and whether it was muted, so the next episode or theme starts the same. Speed is not kept.`,where:NG,lasts:`Until you clear this site's data in your browser`,keys:{store:`local`,names:[gt]}},{id:`positions`,title:`Where you stopped`,what:`The point you stopped at in each episode you have not finished, with the source it played on, its length and when you stopped, for your 200 most recent, and the source and time of the 200 you finished last. Signed in to FKN, they are your account's, so every stub site and device you sign in on resumes there. Those kept while signed out join the next FKN account signed in on this browser.`,where:`${NG}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until 200 newer ones replace them. ${FG}`,keys:{store:`local`,names:[rf,af]}},{id:`recommended`,title:`Recommended for you`,what:`The shows AniList recommends beside the ones on your lists, and the AniList ids of the shows it was asked about.`,where:NG,lasts:`Until home asks again, a day later or once those shows change, or you clear this site's data in your browser. Home removes it when no show on your lists is left to ask about, or when AniList is turned off`,keys:{store:`local`,names:[qO]}},{id:`fetched`,title:`Titles, artwork and streams`,what:`What stub fetched to show you.`,where:`Memory, in this tab`,lasts:`Until you refresh or close the tab`}],LG=R`
5649
5649
  display: flex;
5650
5650
  flex-direction: column;
5651
5651
  gap: 1rem;
@@ -5660,7 +5660,7 @@ scrollbar-gutter: stable;
5660
5660
 
5661
5661
  strong { color: #fff; }
5662
5662
  .facts { color: rgba(255, 255, 255, 0.55); }
5663
- `,IG=R`
5663
+ `,RG=R`
5664
5664
  margin: 0 0 1.6rem;
5665
5665
  padding-left: 2rem;
5666
5666
 
@@ -5670,7 +5670,7 @@ scrollbar-gutter: stable;
5670
5670
  }
5671
5671
 
5672
5672
  .host { color: rgba(255, 255, 255, 0.55); }
5673
- `,LG=e=>e.endsWith(`.`)?e:`${e}.`,RG=()=>/* @__PURE__ */ W(kG,{children:[/* @__PURE__ */ V(`h1`,{children:`Privacy`}),/* @__PURE__ */ V(`div`,{className:`updated`,children:`Last updated 23 November 2026`}),/* @__PURE__ */ V(`p`,{children:`stub is an independent, non-commercial personal project. In short: it has no accounts and no server of its own, runs no analytics, and keeps your settings and your watch list in your browser, or in your own FKN account when you choose to.`}),/* @__PURE__ */ V(`h2`,{children:`What stub keeps`}),/* @__PURE__ */ W(`p`,{children:[`stub sets no advertising or tracking cookies and runs no analytics or telemetry. This is everything it keeps, where, and for how long. You sign out of a site and remove a source you added in`,` `,/* @__PURE__ */ V(Uh,{to:`/settings#sources`,children:`Settings, under Sources`}),`. Clearing this site's data in your browser removes everything stub keeps in this browser.`]}),/* @__PURE__ */ V(`ul`,{css:FG,children:PG.map(e=>/* @__PURE__ */ W(`li`,{children:[/* @__PURE__ */ W(`strong`,{children:[e.title,`.`]}),` `,e.what,` `,/* @__PURE__ */ W(`span`,{className:`facts`,children:[`Where: `,LG(e.where),` How long: `,LG(e.lasts)]})]},e.id))}),/* @__PURE__ */ V(`p`,{children:`About stub's list: signed out, it is saved in your browser's storage for stub, on this device only. Signed in to an FKN account, stub uses that account's list instead: your changes are saved on the device and in the account's storage, encrypted in your browser before they leave the device, so every device signed in to the same account shows them. A list you kept before signing in is added to the account only if you choose to. When you sign out, the account's list is removed from the device. Removing an entry keeps a record that it was removed, with the entry's title and last values, so that every device using the list removes it too. There is no way to clear these records yet.`}),/* @__PURE__ */ V(`h2`,{children:`Sign-ins to other sites`}),/* @__PURE__ */ W(`p`,{children:[`stub plays Crunchyroll and Prime Video and tracks your AniList, MyAnimeList and Trakt lists with your own accounts on those sites. Without the FKN browser extension, you sign in on each site's own page, in an FKN window, and the cookies that sign-in sets are kept by FKN, in a cookie jar every fkn.app app shares, and not by stub. Signing out in `,/* @__PURE__ */ V(Uh,{to:`/settings#sources`,children:`Settings, under Sources`}),`, removes that site's cookies from FKN. The site itself is not told, so its session stays valid there until it expires, held by nobody.`]}),/* @__PURE__ */ V(`p`,{children:`With the extension, stub uses your browser's own sessions for these sites and for Netflix. Those stay in your browser, and you sign in and out of them on the sites themselves.`}),/* @__PURE__ */ V(`h2`,{children:`FKN Social`}),/* @__PURE__ */ W(`p`,{children:[`If you turn on Post to FKN Social in `,/* @__PURE__ */ V(Uh,{to:`/settings#tracking`,children:`Settings, under Tracking`}),`, and allow it on FKN Social, stub posts to your FKN Social page each time a save in a title's tracking row starts it, raises its episode count or completes it: the title, its cover, the episode and a link to its page on stub. FKN Social keeps these posts and shows them to the people you chose there, where you can delete them. Turning the switch off stops new posts.`]}),/* @__PURE__ */ V(`h2`,{children:`Network requests & third parties`}),/* @__PURE__ */ W(`p`,{children:[`To fetch titles and streams, stub sends requests through the FKN platform proxy, which then reaches third-party services such as AniList (anilist.co), MyAnimeList, Crunchyroll, Prime Video, JustWatch and Xunlei subtitles (api-shoulei-ssl.xunlei.com and subtitle.v.geilijiasu.com). The proxy requires no account. It uses your IP address to rate-limit requests, and it keeps a copy of each answer for a while, under a key made from the whole request (its address, headers and body), so only an identical request is answered from that copy. How the FKN platform handles that data is described in the`,` `,/* @__PURE__ */ V(`a`,{href:`https://fkn.app/privacy`,target:`_blank`,rel:`noreferrer noopener`,children:`FKN platform privacy policy`}),`. Each third-party service receives the requests made to it and applies its own privacy policy, especially when you sign in to one (for example Crunchyroll) to watch.`]}),/* @__PURE__ */ V(`p`,{children:`The services that allow it are asked from your browser instead, not through the proxy, so each of them sees your IP address:`}),/* @__PURE__ */ W(`ul`,{css:IG,children:[/* @__PURE__ */ W(`li`,{children:[`AniList `,/* @__PURE__ */ V(`span`,{className:`host`,children:`graphql.anilist.co`}),`, which for Recommended for you gets the AniList ids of up to 50 shows on your lists`]}),/* @__PURE__ */ W(`li`,{children:[`Anime News Network `,/* @__PURE__ */ V(`span`,{className:`host`,children:`cdn.animenewsnetwork.com`})]}),/* @__PURE__ */ W(`li`,{children:[`AnimeThemes `,/* @__PURE__ */ V(`span`,{className:`host`,children:`graphql.animethemes.moe`})]}),/* @__PURE__ */ W(`li`,{children:[`AniSkip `,/* @__PURE__ */ V(`span`,{className:`host`,children:`api.aniskip.com`}),`, for where a torrent's ending starts: it gets the show's MyAnimeList id, the episode's number and its length`]}),/* @__PURE__ */ W(`li`,{children:[`AniZip `,/* @__PURE__ */ V(`span`,{className:`host`,children:`api.ani.zip`})]}),/* @__PURE__ */ W(`li`,{children:[`Apple TV `,/* @__PURE__ */ V(`span`,{className:`host`,children:`uts-api.itunes.apple.com`})]}),/* @__PURE__ */ W(`li`,{children:[`Kitsu `,/* @__PURE__ */ V(`span`,{className:`host`,children:`kitsu.io`})]}),/* @__PURE__ */ W(`li`,{children:[`Netflix `,/* @__PURE__ */ V(`span`,{className:`host`,children:`www.netflix.com`}),`, whose catalogue depends on your country`]}),/* @__PURE__ */ W(`li`,{children:[`OpenSubtitles `,/* @__PURE__ */ V(`span`,{className:`host`,children:`opensubtitles-v3.strem.io`}),`, for external subtitle listings`]}),/* @__PURE__ */ W(`li`,{children:[`OpenSubtitles downloads `,/* @__PURE__ */ V(`span`,{className:`host`,children:`subs5.strem.io`}),`, for external subtitle files`]}),/* @__PURE__ */ W(`li`,{children:[`TheTVDB `,/* @__PURE__ */ V(`span`,{className:`host`,children:`api4.thetvdb.com`})]}),/* @__PURE__ */ W(`li`,{children:[`trace.moe `,/* @__PURE__ */ V(`span`,{className:`host`,children:`api.trace.moe`}),`, for a search by picture: it gets a short color code of the picture, never the picture itself, and FKN stores neither the code nor your IP address`]}),/* @__PURE__ */ W(`li`,{children:[`Trakt `,/* @__PURE__ */ V(`span`,{className:`host`,children:`apiz.trakt.tv`})]}),/* @__PURE__ */ W(`li`,{children:[`TVmaze `,/* @__PURE__ */ V(`span`,{className:`host`,children:`api.tvmaze.com`})]})]}),/* @__PURE__ */ V(`p`,{children:`Artwork loads from each service's own image servers, theme videos from AnimeThemes (v.animethemes.moe), trailers from YouTube (www.youtube.com) and fonts from Google Fonts (fonts.googleapis.com and fonts.gstatic.com), and each of these sees your IP address too. When you pick, paste or drop a picture to search by scene, stub also opens SauceNAO (saucenao.com) in an attached frame and sends that picture there, so SauceNAO receives both your IP address and the picture itself under its own privacy policy.`}),/* @__PURE__ */ W(`p`,{children:[`JustWatch is asked for the streaming links of your country: the one you picked in`,` `,/* @__PURE__ */ V(Uh,{to:`/settings#sources`,children:`Settings`}),`, or else the one your device's time zone is in. Only the country is sent, never the time zone.`]}),/* @__PURE__ */ W(`p`,{children:[`Sources you add in `,/* @__PURE__ */ V(Uh,{to:`/settings#sources`,children:`Settings`}),`, or that a link adds, are told the language you picked there, or else your browser's, and the audio and subtitle languages you picked there or last picked in a player, so they can offer releases in them. A source also receives what you enter for it there, such as an access key, and its own code decides where that goes.`]}),/* @__PURE__ */ V(`p`,{children:`Playing a torrent uses Ripple, whose peer traffic goes through the FKN VPN by default. If you switch the player's VPN off, the player connects directly from your browser instead, so the torrent's other peers, the trackers tracker.openwebtorrent.com and tracker.webtorrent.dev (and any WebSocket tracker a torrent names), the STUN host stun.l.google.com, and your device's own DNS resolver see your IP address. That switch applies only inside stub's player and does not change Ripple's own site.`}),/* @__PURE__ */ V(`h2`,{children:`The optional browser extension`}),/* @__PURE__ */ V(`p`,{children:`If you install the FKN browser extension, it works with your own already-logged-in sessions locally on your device so you can play content you have access to. Those credentials stay in your browser; stub never receives them.`}),/* @__PURE__ */ V(`h2`,{children:`Your control`}),/* @__PURE__ */ V(`p`,{children:`Disconnecting from FKN, in the account menu at the top right, takes your account's list off the device. Your party name and the party you are in go when you close the tab. If you use the browser extension, you can review and revoke its access at any time from the extension itself.`}),/* @__PURE__ */ V(`h2`,{children:`Contact`}),/* @__PURE__ */ W(`p`,{children:[`Questions about privacy can be raised through the project repository at`,` `,/* @__PURE__ */ V(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]})]});U();var zG=(e,t=e)=>{let n=new Intl.DisplayNames([t],{type:`language`}).of(e)??e;return n.charAt(0).toLocaleUpperCase(t)+n.slice(1)},BG=({saved:e,reload:t=()=>location.reload()})=>{let n=L(),[r,i]=K(!1),a=B(()=>{let{compare:e}=new Intl.Collator(n.locale);return ee.map(e=>({tag:e,name:zG(e)})).sort((t,n)=>e(t.name,n.name))},[n]),o=xe();return/* @__PURE__ */ V(`div`,{className:`row`,"data-setting":`language`,children:/* @__PURE__ */ W(`select`,{"aria-labelledby":`settings-section-title`,value:me()??``,disabled:r,onChange:n=>{i(!0),A(n.currentTarget.value||void 0,{saved:e,reload:t})},children:[/* @__PURE__ */ V(`option`,{value:``,children:n.formatMessage({id:`Automatic ({language})`,defaultMessage:`Automatic ({language})`},{language:zG(o)})}),a.map(({tag:e,name:t})=>/* @__PURE__ */ V(`option`,{value:e,lang:e,children:t},e))]})})};U();var VG=R`
5673
+ `,zG=e=>e.endsWith(`.`)?e:`${e}.`,BG=()=>/* @__PURE__ */ W(jG,{children:[/* @__PURE__ */ V(`h1`,{children:`Privacy`}),/* @__PURE__ */ V(`div`,{className:`updated`,children:`Last updated 23 November 2026`}),/* @__PURE__ */ V(`p`,{children:`stub is an independent, non-commercial personal project. In short: it has no accounts and no server of its own, runs no analytics, and keeps your settings and your watch list in your browser, or in your own FKN account when you choose to.`}),/* @__PURE__ */ V(`h2`,{children:`What stub keeps`}),/* @__PURE__ */ W(`p`,{children:[`stub sets no advertising or tracking cookies and runs no analytics or telemetry. This is everything it keeps, where, and for how long. You sign out of a site and remove a source you added in`,` `,/* @__PURE__ */ V(Uh,{to:`/settings#sources`,children:`Settings, under Sources`}),`. Clearing this site's data in your browser removes everything stub keeps in this browser.`]}),/* @__PURE__ */ V(`ul`,{css:LG,children:IG.map(e=>/* @__PURE__ */ W(`li`,{children:[/* @__PURE__ */ W(`strong`,{children:[e.title,`.`]}),` `,e.what,` `,/* @__PURE__ */ W(`span`,{className:`facts`,children:[`Where: `,zG(e.where),` How long: `,zG(e.lasts)]})]},e.id))}),/* @__PURE__ */ V(`p`,{children:`About stub's list: signed out, it is saved in your browser's storage for stub, on this device only. Signed in to an FKN account, stub uses that account's list instead: your changes are saved on the device and in the account's storage, encrypted in your browser before they leave the device, so every device signed in to the same account shows them. A list you kept before signing in is added to the account only if you choose to. When you sign out, the account's list is removed from the device. Removing an entry keeps a record that it was removed, with the entry's title and last values, so that every device using the list removes it too. There is no way to clear these records yet.`}),/* @__PURE__ */ V(`h2`,{children:`Sign-ins to other sites`}),/* @__PURE__ */ W(`p`,{children:[`stub plays Crunchyroll and Prime Video and tracks your AniList, MyAnimeList and Trakt lists with your own accounts on those sites. Without the FKN browser extension, you sign in on each site's own page, in an FKN window, and the cookies that sign-in sets are kept by FKN, in a cookie jar every fkn.app app shares, and not by stub. Signing out in `,/* @__PURE__ */ V(Uh,{to:`/settings#sources`,children:`Settings, under Sources`}),`, removes that site's cookies from FKN. The site itself is not told, so its session stays valid there until it expires, held by nobody.`]}),/* @__PURE__ */ V(`p`,{children:`With the extension, stub uses your browser's own sessions for these sites and for Netflix. Those stay in your browser, and you sign in and out of them on the sites themselves.`}),/* @__PURE__ */ V(`h2`,{children:`FKN Social`}),/* @__PURE__ */ W(`p`,{children:[`If you turn on Post to FKN Social in `,/* @__PURE__ */ V(Uh,{to:`/settings#tracking`,children:`Settings, under Tracking`}),`, and allow it on FKN Social, stub posts to your FKN Social page each time a save in a title's tracking row starts it, raises its episode count or completes it: the title, its cover, the episode and a link to its page on stub. FKN Social keeps these posts and shows them to the people you chose there, where you can delete them. Turning the switch off stops new posts.`]}),/* @__PURE__ */ V(`h2`,{children:`Network requests & third parties`}),/* @__PURE__ */ W(`p`,{children:[`To fetch titles and streams, stub sends requests through the FKN platform proxy, which then reaches third-party services such as AniList (anilist.co), MyAnimeList, Crunchyroll, Prime Video, JustWatch and Xunlei subtitles (api-shoulei-ssl.xunlei.com and subtitle.v.geilijiasu.com). The proxy requires no account. It uses your IP address to rate-limit requests, and it keeps a copy of each answer for a while, under a key made from the whole request (its address, headers and body), so only an identical request is answered from that copy. How the FKN platform handles that data is described in the`,` `,/* @__PURE__ */ V(`a`,{href:`https://fkn.app/privacy`,target:`_blank`,rel:`noreferrer noopener`,children:`FKN platform privacy policy`}),`. Each third-party service receives the requests made to it and applies its own privacy policy, especially when you sign in to one (for example Crunchyroll) to watch.`]}),/* @__PURE__ */ V(`p`,{children:`The services that allow it are asked from your browser instead, not through the proxy, so each of them sees your IP address:`}),/* @__PURE__ */ W(`ul`,{css:RG,children:[/* @__PURE__ */ W(`li`,{children:[`AniList `,/* @__PURE__ */ V(`span`,{className:`host`,children:`graphql.anilist.co`}),`, which for Recommended for you gets the AniList ids of up to 50 shows on your lists`]}),/* @__PURE__ */ W(`li`,{children:[`Anime News Network `,/* @__PURE__ */ V(`span`,{className:`host`,children:`cdn.animenewsnetwork.com`})]}),/* @__PURE__ */ W(`li`,{children:[`AnimeThemes `,/* @__PURE__ */ V(`span`,{className:`host`,children:`graphql.animethemes.moe`})]}),/* @__PURE__ */ W(`li`,{children:[`AniSkip `,/* @__PURE__ */ V(`span`,{className:`host`,children:`api.aniskip.com`}),`, for where a torrent's ending starts: it gets the show's MyAnimeList id, the episode's number and its length`]}),/* @__PURE__ */ W(`li`,{children:[`AniZip `,/* @__PURE__ */ V(`span`,{className:`host`,children:`api.ani.zip`})]}),/* @__PURE__ */ W(`li`,{children:[`Apple TV `,/* @__PURE__ */ V(`span`,{className:`host`,children:`uts-api.itunes.apple.com`})]}),/* @__PURE__ */ W(`li`,{children:[`Kitsu `,/* @__PURE__ */ V(`span`,{className:`host`,children:`kitsu.io`})]}),/* @__PURE__ */ W(`li`,{children:[`Netflix `,/* @__PURE__ */ V(`span`,{className:`host`,children:`www.netflix.com`}),`, whose catalogue depends on your country`]}),/* @__PURE__ */ W(`li`,{children:[`OpenSubtitles `,/* @__PURE__ */ V(`span`,{className:`host`,children:`opensubtitles-v3.strem.io`}),`, for external subtitle listings`]}),/* @__PURE__ */ W(`li`,{children:[`OpenSubtitles downloads `,/* @__PURE__ */ V(`span`,{className:`host`,children:`subs5.strem.io`}),`, for external subtitle files`]}),/* @__PURE__ */ W(`li`,{children:[`TheTVDB `,/* @__PURE__ */ V(`span`,{className:`host`,children:`api4.thetvdb.com`})]}),/* @__PURE__ */ W(`li`,{children:[`trace.moe `,/* @__PURE__ */ V(`span`,{className:`host`,children:`api.trace.moe`}),`, for a search by picture: it gets a short color code of the picture, never the picture itself, and FKN stores neither the code nor your IP address`]}),/* @__PURE__ */ W(`li`,{children:[`Trakt `,/* @__PURE__ */ V(`span`,{className:`host`,children:`apiz.trakt.tv`})]}),/* @__PURE__ */ W(`li`,{children:[`TVmaze `,/* @__PURE__ */ V(`span`,{className:`host`,children:`api.tvmaze.com`})]})]}),/* @__PURE__ */ V(`p`,{children:`Artwork loads from each service's own image servers, theme videos from AnimeThemes (v.animethemes.moe), trailers from YouTube (www.youtube.com) and fonts from Google Fonts (fonts.googleapis.com and fonts.gstatic.com), and each of these sees your IP address too. When you pick, paste or drop a picture to search by scene, stub also opens SauceNAO (saucenao.com) in an attached frame and sends that picture there, so SauceNAO receives both your IP address and the picture itself under its own privacy policy.`}),/* @__PURE__ */ W(`p`,{children:[`JustWatch is asked for the streaming links of your country: the one you picked in`,` `,/* @__PURE__ */ V(Uh,{to:`/settings#sources`,children:`Settings`}),`, or else the one your device's time zone is in. Only the country is sent, never the time zone.`]}),/* @__PURE__ */ W(`p`,{children:[`Sources you add in `,/* @__PURE__ */ V(Uh,{to:`/settings#sources`,children:`Settings`}),`, or that a link adds, are told the language you picked there, or else your browser's, and the audio and subtitle languages you picked there or last picked in a player, so they can offer releases in them. A source also receives what you enter for it there, such as an access key, and its own code decides where that goes.`]}),/* @__PURE__ */ V(`p`,{children:`Playing a torrent uses Ripple, whose peer traffic goes through the FKN VPN by default. If you switch the player's VPN off, the player connects directly from your browser instead, so the torrent's other peers, the trackers tracker.openwebtorrent.com and tracker.webtorrent.dev (and any WebSocket tracker a torrent names), the STUN host stun.l.google.com, and your device's own DNS resolver see your IP address. That switch applies only inside stub's player and does not change Ripple's own site.`}),/* @__PURE__ */ V(`h2`,{children:`The optional browser extension`}),/* @__PURE__ */ V(`p`,{children:`If you install the FKN browser extension, it works with your own already-logged-in sessions locally on your device so you can play content you have access to. Those credentials stay in your browser; stub never receives them.`}),/* @__PURE__ */ V(`h2`,{children:`Your control`}),/* @__PURE__ */ V(`p`,{children:`Disconnecting from FKN, in the account menu at the top right, takes your account's list off the device. Your party name and the party you are in go when you close the tab. If you use the browser extension, you can review and revoke its access at any time from the extension itself.`}),/* @__PURE__ */ V(`h2`,{children:`Contact`}),/* @__PURE__ */ W(`p`,{children:[`Questions about privacy can be raised through the project repository at`,` `,/* @__PURE__ */ V(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]})]});U();var VG=(e,t=e)=>{let n=new Intl.DisplayNames([t],{type:`language`}).of(e)??e;return n.charAt(0).toLocaleUpperCase(t)+n.slice(1)},HG=({saved:e,reload:t=()=>location.reload()})=>{let n=L(),[r,i]=K(!1),a=B(()=>{let{compare:e}=new Intl.Collator(n.locale);return ee.map(e=>({tag:e,name:VG(e)})).sort((t,n)=>e(t.name,n.name))},[n]),o=xe();return/* @__PURE__ */ V(`div`,{className:`row`,"data-setting":`language`,children:/* @__PURE__ */ W(`select`,{"aria-labelledby":`settings-section-title`,value:me()??``,disabled:r,onChange:n=>{i(!0),A(n.currentTarget.value||void 0,{saved:e,reload:t})},children:[/* @__PURE__ */ V(`option`,{value:``,children:n.formatMessage({id:`Automatic ({language})`,defaultMessage:`Automatic ({language})`},{language:VG(o)})}),a.map(({tag:e,name:t})=>/* @__PURE__ */ V(`option`,{value:e,lang:e,children:t},e))]})})};U();var UG=R`
5674
5674
  display: flex;
5675
5675
  flex-direction: column;
5676
5676
  gap: 1rem;
@@ -5693,7 +5693,7 @@ scrollbar-gutter: stable;
5693
5693
 
5694
5694
  &:hover { border-color: rgba(255, 255, 255, 0.25); }
5695
5695
  }
5696
- `,HG=({children:e,on:t,set:n,disabled:r})=>/* @__PURE__ */ W(`label`,{className:`switch`,children:[e,/* @__PURE__ */ V(`input`,{type:`checkbox`,role:`switch`,css:pC,checked:t,disabled:r,onChange:e=>n(e.target.checked)})]}),UG=({title:e,setting:t,value:n,first:i,pick:a})=>{let o=L(),s=At(),c=e=>zG(e,o.locale),l=B(()=>{let{compare:e}=new Intl.Collator(o.locale);return ee.map(e=>({value:e,label:c(e)})).sort((t,n)=>e(t.label,n.label))},[o]),u=e=>e===i.value||ee.includes(e),d=r(n??void 0),f=n===null?``:u(n)?n:d&&ee.includes(d)?d:n,p=f===``||u(f)?[]:[{value:f,label:d?c(d):f}],m=fe();return/* @__PURE__ */ W(`div`,{className:`row`,"data-setting":t,children:[/* @__PURE__ */ V(`div`,{className:`head`,children:/* @__PURE__ */ V(`h3`,{id:s,children:e})}),/* @__PURE__ */ W(`select`,{"aria-labelledby":s,value:f,onChange:e=>a(e.currentTarget.value||void 0),children:[/* @__PURE__ */ V(`option`,{value:``,children:o.formatMessage({id:`Automatic ({language})`,defaultMessage:`Automatic ({language})`},{language:c(ge([m],ee)??m)})}),[i,...p,...l].map(e=>/* @__PURE__ */ V(`option`,{value:e.value,children:e.label},e.value))]})]})},WG=()=>{let e=L(),t=$t(nn,Ht),n=$t(Sd,wd),r=$t(()=>F.getItem(de),se),i=$t(()=>F.getItem(re),se),a=$t(()=>F.getItem(be)===`on`,se);return/* @__PURE__ */ W(`div`,{css:VG,children:[/* @__PURE__ */ V(HG,{on:t,set:rn,children:e.formatMessage({id:`Autoplay next episode`,defaultMessage:`Autoplay next episode`})}),/* @__PURE__ */ V(HG,{on:n,set:Cd,children:e.formatMessage({id:`Open episodes in a new tab`,defaultMessage:`Open episodes in a new tab`})}),/* @__PURE__ */ V(UG,{title:e.formatMessage({id:`Audio language`,defaultMessage:`Audio language`}),setting:`audio-language`,value:r,first:{value:_e,label:e.formatMessage({id:`Original#the audio language a work was made in`,defaultMessage:`Original`,description:`the audio language a work was made in`})},pick:pe}),/* @__PURE__ */ V(UG,{title:e.formatMessage({id:`Subtitle language`,defaultMessage:`Subtitle language`}),setting:`subtitle-language`,value:i,first:{value:`off`,label:e.formatMessage({id:`Off#subtitles turned off`,defaultMessage:`Off`,description:`subtitles turned off`})},pick:ve}),/* @__PURE__ */ V(HG,{on:a,set:k,children:e.formatMessage({id:`Always show subtitles`,defaultMessage:`Always show subtitles`})})]})},GG=Ne({sources:{id:`Sources`,defaultMessage:`Sources`},tracking:{id:`Tracking`,defaultMessage:`Tracking`},playback:{id:`Playback`,defaultMessage:`Playback`},language:{id:`Language`,defaultMessage:`Language`}}),KG=[{id:`sources`,title:GG.sources},{id:`tracking`,title:GG.tracking},{id:`playback`,title:GG.playback},{id:`language`,title:GG.language}],qG=e=>KG.find(t=>`#${t.id}`===e)?.id??`sources`;U();var JG=({label:e,name:t=e,confirmLabel:n,busyLabel:r,question:i,onConfirm:a,home:o})=>{let s=L(),[c,l]=K(!1),[u,d]=K(!1),f=G(null),p=G(null),m=G(null),h=G(!1),g=G(!0),_=At(),v=()=>{let e=document.activeElement;return!e||e===document.body||!!m.current?.contains(e)};return H(()=>()=>{g.current=!1,m.current&&v()&&o?.current?.focus()},[]),ct(()=>{c?p.current?.focus():h.current&&f.current?.focus(),h.current=!1},[c]),c?/* @__PURE__ */ W(`div`,{ref:m,className:`confirm`,role:`group`,"aria-label":t,children:[/* @__PURE__ */ V(`p`,{id:_,children:i}),/* @__PURE__ */ W(`div`,{className:`actions`,children:[/* @__PURE__ */ V(`button`,{type:`button`,className:`danger`,"aria-describedby":_,disabled:u,onClick:()=>{d(!0),Promise.resolve().then(a).catch(()=>{}).finally(()=>{if(!g.current)return;let e=v();d(!1),l(!1),e&&(o?.current?o.current.focus():h.current=!0)})},children:u?r:n}),/* @__PURE__ */ V(`button`,{ref:p,type:`button`,className:`secondary`,"aria-describedby":_,disabled:u,onClick:()=>{h.current=!0,l(!1)},children:s.formatMessage({id:`Cancel`,defaultMessage:`Cancel`})})]})]}):/* @__PURE__ */ V(`button`,{ref:f,type:`button`,className:`secondary`,"aria-label":t===e?void 0:t,onClick:()=>l(!0),children:e})};U();var YG=()=>{let[e,t]=K(g);return H(()=>(t(g()),a(()=>t(g()))),[]),e},XG=()=>(YG(),ae()),ZG=()=>{let e=L(),t=YG(),n=At(),r=t=>e.formatDisplayName(t,{type:`region`})??t,i=B(()=>{let{compare:t}=new Intl.Collator(e.locale);return x.map(e=>({country:e,name:r(e)})).sort((e,n)=>t(e.name,n.name))},[e]);return/* @__PURE__ */ W(`div`,{className:`row`,"data-setting":`country`,children:[/* @__PURE__ */ V(`div`,{className:`head`,children:/* @__PURE__ */ V(`h3`,{id:n,children:e.formatMessage({id:`Country`,defaultMessage:`Country`})})}),/* @__PURE__ */ W(`select`,{"aria-labelledby":n,value:t??``,onChange:e=>c(e.currentTarget.value||void 0),children:[/* @__PURE__ */ V(`option`,{value:``,children:e.formatMessage({id:`Automatic ({country})`,defaultMessage:`Automatic ({country})`},{country:r(ie())})}),i.map(({country:e,name:t})=>/* @__PURE__ */ V(`option`,{value:e,children:t},e))]})]})};U();var QG=e=>e instanceof Error?e.message:String(e),$G=(e,t,n)=>{switch(n){case`authed`:return{text:e.formatMessage({id:`Signed in to {name}.`,defaultMessage:`Signed in to {name}.`},{name:t})};case`closed`:return{text:e.formatMessage({id:`The sign-in window closed.`,defaultMessage:`The sign-in window closed.`})};case`blocked`:return{text:e.formatMessage({id:`The browser blocked the sign-in window. Allow pop-ups for this page and try again.`,defaultMessage:`The browser blocked the sign-in window. Allow pop-ups for this page and try again.`}),error:!0};case`unsupported`:return{text:e.formatMessage({id:`Connected to {name}.`,defaultMessage:`Connected to {name}.`},{name:t})}}},eK=Ne({"signed-in":{id:`Signed in`,defaultMessage:`Signed in`},"signed-out":{id:`Signed out`,defaultMessage:`Signed out`}}),tK=(e,t)=>({label:e.formatMessage({id:`Sign out`,defaultMessage:`Sign out`}),name:e.formatMessage({id:`Sign out of {name}`,defaultMessage:`Sign out of {name}`},{name:t}),confirmLabel:e.formatMessage({id:`Yes, sign out`,defaultMessage:`Yes, sign out`}),busyLabel:e.formatMessage({id:`Signing out...`,defaultMessage:`Signing out...`}),question:e.formatMessage({id:`Sign out of {name} in every fkn.app app?`,defaultMessage:`Sign out of {name} in every fkn.app app?`},{name:t})}),nK=(e,t)=>({label:e.formatMessage({id:`Disconnect`,defaultMessage:`Disconnect`}),name:e.formatMessage({id:`Disconnect {name}`,defaultMessage:`Disconnect {name}`},{name:t}),confirmLabel:e.formatMessage({id:`Yes, disconnect`,defaultMessage:`Yes, disconnect`}),busyLabel:e.formatMessage({id:`Disconnecting...`,defaultMessage:`Disconnecting...`}),question:e.formatMessage({id:`Disconnect {name} on this device?`,defaultMessage:`Disconnect {name} on this device?`},{name:t})}),rK=(e,t)=>e.formatMessage({id:`Open {host}`,defaultMessage:`Open {host}`},{host:t}),iK=(e,t)=>t?e.formatMessage({id:`Signing in...`,defaultMessage:`Signing in...`}):e.formatMessage({id:`Sign in`,defaultMessage:`Sign in`}),aK=e=>e.formatMessage({id:`Signed out.`,defaultMessage:`Signed out.`}),oK=(e,t)=>{let[,n]=K(0);return H(()=>e.watch(t,()=>n(e=>e+1)),[e,t]),e.read(t)},sK=(e,t,n)=>{H(()=>{if(!t||!n)return;let r=()=>{document.visibilityState!==`hidden`&&e.refresh(`crunchyroll`,t)};return r(),document.addEventListener(`visibilitychange`,r),()=>document.removeEventListener(`visibilitychange`,r)},[e,t,n])},cK=({id:e,state:t,on:n,children:r})=>/* @__PURE__ */ W(`div`,{className:`account`,"data-account":e,children:[t?/* @__PURE__ */ V(`span`,{className:`state${n?` on`:``}`,children:t}):void 0,r]}),lK=({note:e})=>/* @__PURE__ */ V(`p`,{className:`note${e?.error?` error`:``}`,role:`status`,children:e?.text}),uK=()=>{let e=G(!0);return H(()=>()=>{e.current=!1},[]),e},dK=[{site:`crunchyroll`,origin:`cr`,name:`Crunchyroll`,hostFor:()=>`crunchyroll.com`,signsInOnCloud:()=>!0,checked:!0},{site:`prime`,origin:`amazon`,name:`Prime Video`,hostFor:s,signsInOnCloud:j,checked:!1}].filter(e=>Ca(e.origin)),fK=(e,t,n)=>{let r=dK.find(t=>t.origin===e);return!!(r&&t===`cloud`&&r.signsInOnCloud(r.hostFor(ae()))&&n.read(r.site)?.state!==`signed-in`)},pK=(e,t)=>{let n=dK.find(t=>t.origin===e);return!!(n&&t.read(n.site)?.state===`signed-in`)},mK=(e,t)=>{let n=dK.find(t=>t.origin===e),r=n&&t.read(n.site);return!!n&&r?.state!==`signed-in`&&!r?.signedInBefore},hK=({site:e,name:t,hostFor:n,signsInOnCloud:r,checked:i,account:a,heading:o,backend:s,status:c})=>{let l=L(),u=n(XG()),[d,f]=K(!1),[p,m]=K(),h=uK(),g=oK(c,e);sK(c,s,i&&s===`cloud`&&g!==void 0);let _=()=>{let e=a.signIn();f(!0),m(void 0),e.then(e=>{h.current&&m($G(l,t,e))}).catch(e=>{h.current&&m({text:QG(e),error:!0})}).finally(()=>{h.current&&f(!1)})},v=()=>a.signOut().then(()=>{h.current&&m({text:aK(l)})},e=>{let n=l.formatMessage({id:`Could not sign out of {name}: {error}. Try again.`,defaultMessage:`Could not sign out of {name}: {error}. Try again.`},{name:t,error:QG(e)});h.current&&m({text:n,error:!0})}),y=s===`cloud`&&r(u),b=g?.state??(y?`signed-out`:void 0);return/* @__PURE__ */ W(cK,{id:e,state:b&&l.formatMessage(eK[b]),on:b===`signed-in`,children:[y?/* @__PURE__ */ V(`div`,{className:`actions`,children:b===`signed-in`?/* @__PURE__ */ V(JG,{...tK(l,t),home:o,onConfirm:v}):/* @__PURE__ */ V(`button`,{type:`button`,disabled:d,onClick:_,children:iK(l,d)})}):s?/* @__PURE__ */ V(`div`,{className:`actions`,children:/* @__PURE__ */ V(`a`,{className:`link`,href:`https://www.${u}`,target:`_blank`,rel:`noreferrer`,children:rK(l,u)})}):/* @__PURE__ */ V(`p`,{children:l.formatMessage({id:`Loading...`,defaultMessage:`Loading...`})}),/* @__PURE__ */ V(lK,{note:p})]})},gK=[{site:`anilist`,name:`AniList`,host:`anilist.co`},{site:`mal`,name:`MyAnimeList`,host:`myanimelist.net`},{site:`trakt`,name:`Trakt`,host:`app.trakt.tv`}].filter(e=>Ca(e.site)),_K=({site:e,name:t,host:n,heading:r,backend:i,sites:a,status:o})=>{let s=L(),[c,l]=K(()=>a.isConnected(e)),[u,d]=K(!1),[f,p]=K(),m=uK(),h=oK(o,e),g=c&&h?.state!==`signed-out`;H(()=>(l(a.isConnected(e)),a.watch(e,()=>{m.current&&l(a.isConnected(e))})),[a,e]);let _=()=>{m.current&&l(a.isConnected(e))},v=()=>{let n=a.signIn(e);d(!0),p(void 0),n.then(e=>{m.current&&p($G(s,t,e))}).catch(e=>{m.current&&p({text:QG(e),error:!0})}).finally(()=>{m.current&&d(!1),_()})},y=n=>a.signOut(e,n).then(()=>{m.current&&p({text:n===`cloud`?aK(s):s.formatMessage({id:`Disconnected.`,defaultMessage:`Disconnected.`})}),_()},e=>{let n=s.formatMessage({id:`Could not finish signing out of {name}: {error}. Sign in and out again to retry.`,defaultMessage:`Could not finish signing out of {name}: {error}. Sign in and out again to retry.`},{name:t,error:QG(e)});m.current&&p({text:n,error:!0}),_()});return/* @__PURE__ */ W(cK,{id:e,state:c?h&&s.formatMessage(eK[h.state]):s.formatMessage({id:`Not connected`,defaultMessage:`Not connected`}),on:g,children:[i?/* @__PURE__ */ V(`div`,{className:`actions`,children:g?/* @__PURE__ */ V(JG,{...i===`cloud`?tK(s,t):nK(s,t),home:r,onConfirm:()=>y(i)}):i===`extension`&&c?/* @__PURE__ */ V(`a`,{className:`link`,href:`https://${n}`,target:`_blank`,rel:`noreferrer`,children:rK(s,n)}):/* @__PURE__ */ V(`button`,{type:`button`,disabled:u,onClick:v,children:u||i===`cloud`?iK(s,u):s.formatMessage({id:`Connect`,defaultMessage:`Connect`})})}):void 0,/* @__PURE__ */ V(lK,{note:f})]})},vK=({backend:e})=>{let t=L();return/* @__PURE__ */ V(cK,{id:`netflix`,children:e===`extension`?/* @__PURE__ */ V(`div`,{className:`actions`,children:/* @__PURE__ */ V(`a`,{className:`link`,href:`https://www.netflix.com`,target:`_blank`,rel:`noreferrer`,children:rK(t,`netflix.com`)})}):/* @__PURE__ */ V(`p`,{children:t.formatMessage({id:`Needs the FKN browser extension.`,defaultMessage:`Needs the FKN browser extension.`})})})},yK=({origin:e,heading:t,backend:n,sites:r,status:i,...a})=>{let o=dK.find(t=>t.origin===e);if(o)return/* @__PURE__ */ V(hK,{...o,account:a[o.site],heading:t,backend:n,status:i});let s=gK.find(t=>t.site===e);return s?/* @__PURE__ */ V(_K,{...s,heading:t,backend:n,sites:r,status:i}):e===`nf`?/* @__PURE__ */ V(vK,{backend:n}):null},bK=4,xK=48,SK=8,CK=e=>t=>{if(t.button||!t.isPrimary)return;t.preventDefault();let n=t.currentTarget,r=n.closest(`li`),i=r.parentElement;n.setPointerCapture(t.pointerId);let a={x:t.clientX,y:t.clientY+scrollY},o=t,s,c=0,l=e=>{s?.removeAttribute(`data-over`),s=e,s?.setAttribute(`data-over`,``)},u=()=>{r.setAttribute(`data-dragging`,``),r.style.transform=`translate(${o.clientX-a.x}px, ${o.clientY+scrollY-a.y}px)`;let e=document.elementFromPoint(o.clientX,o.clientY)?.closest(`li`);l(e?.parentElement===i?e:void 0),cancelAnimationFrame(c);let t=o.clientY<xK?-8:o.clientY>innerHeight-xK?SK:0;t&&(c=requestAnimationFrame(()=>scrollBy(0,t)))},d=e=>{o=e,(r.hasAttribute(`data-dragging`)||Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)>bK)&&u()},f=()=>d(o),p=t=>{cancelAnimationFrame(c),removeEventListener(`scroll`,f),n.removeEventListener(`pointermove`,d),n.removeEventListener(`pointerup`,m),n.removeEventListener(`pointercancel`,h),n.removeEventListener(`lostpointercapture`,h),removeEventListener(`keydown`,g),r.removeAttribute(`data-dragging`),r.style.transform=``;let a=s?[...i.children].indexOf(s):-1;l(),t&&a>=0&&e(a)},m=()=>p(!0),h=()=>p(!1),g=e=>{e.key===`Escape`&&h()};n.addEventListener(`pointermove`,d),n.addEventListener(`pointerup`,m),n.addEventListener(`pointercancel`,h),n.addEventListener(`lostpointercapture`,h),addEventListener(`keydown`,g),addEventListener(`scroll`,f,{passive:!0})};U();var wK=R`
5696
+ `,WG=({children:e,on:t,set:n,disabled:r})=>/* @__PURE__ */ W(`label`,{className:`switch`,children:[e,/* @__PURE__ */ V(`input`,{type:`checkbox`,role:`switch`,css:pC,checked:t,disabled:r,onChange:e=>n(e.target.checked)})]}),GG=({title:e,setting:t,value:n,first:i,pick:a})=>{let o=L(),s=At(),c=e=>VG(e,o.locale),l=B(()=>{let{compare:e}=new Intl.Collator(o.locale);return ee.map(e=>({value:e,label:c(e)})).sort((t,n)=>e(t.label,n.label))},[o]),u=e=>e===i.value||ee.includes(e),d=r(n??void 0),f=n===null?``:u(n)?n:d&&ee.includes(d)?d:n,p=f===``||u(f)?[]:[{value:f,label:d?c(d):f}],m=fe();return/* @__PURE__ */ W(`div`,{className:`row`,"data-setting":t,children:[/* @__PURE__ */ V(`div`,{className:`head`,children:/* @__PURE__ */ V(`h3`,{id:s,children:e})}),/* @__PURE__ */ W(`select`,{"aria-labelledby":s,value:f,onChange:e=>a(e.currentTarget.value||void 0),children:[/* @__PURE__ */ V(`option`,{value:``,children:o.formatMessage({id:`Automatic ({language})`,defaultMessage:`Automatic ({language})`},{language:c(ge([m],ee)??m)})}),[i,...p,...l].map(e=>/* @__PURE__ */ V(`option`,{value:e.value,children:e.label},e.value))]})]})},KG=()=>{let e=L(),t=$t(nn,Ht),n=$t(Sd,wd),r=$t(()=>F.getItem(de),se),i=$t(()=>F.getItem(re),se),a=$t(()=>F.getItem(be)===`on`,se);return/* @__PURE__ */ W(`div`,{css:UG,children:[/* @__PURE__ */ V(WG,{on:t,set:rn,children:e.formatMessage({id:`Autoplay next episode`,defaultMessage:`Autoplay next episode`})}),/* @__PURE__ */ V(WG,{on:n,set:Cd,children:e.formatMessage({id:`Open episodes in a new tab`,defaultMessage:`Open episodes in a new tab`})}),/* @__PURE__ */ V(GG,{title:e.formatMessage({id:`Audio language`,defaultMessage:`Audio language`}),setting:`audio-language`,value:r,first:{value:_e,label:e.formatMessage({id:`Original#the audio language a work was made in`,defaultMessage:`Original`,description:`the audio language a work was made in`})},pick:pe}),/* @__PURE__ */ V(GG,{title:e.formatMessage({id:`Subtitle language`,defaultMessage:`Subtitle language`}),setting:`subtitle-language`,value:i,first:{value:`off`,label:e.formatMessage({id:`Off#subtitles turned off`,defaultMessage:`Off`,description:`subtitles turned off`})},pick:ve}),/* @__PURE__ */ V(WG,{on:a,set:k,children:e.formatMessage({id:`Always show subtitles`,defaultMessage:`Always show subtitles`})})]})},qG=Ne({sources:{id:`Sources`,defaultMessage:`Sources`},tracking:{id:`Tracking`,defaultMessage:`Tracking`},playback:{id:`Playback`,defaultMessage:`Playback`},language:{id:`Language`,defaultMessage:`Language`}}),JG=[{id:`sources`,title:qG.sources},{id:`tracking`,title:qG.tracking},{id:`playback`,title:qG.playback},{id:`language`,title:qG.language}],YG=e=>JG.find(t=>`#${t.id}`===e)?.id??`sources`;U();var XG=({label:e,name:t=e,confirmLabel:n,busyLabel:r,question:i,onConfirm:a,home:o})=>{let s=L(),[c,l]=K(!1),[u,d]=K(!1),f=G(null),p=G(null),m=G(null),h=G(!1),g=G(!0),_=At(),v=()=>{let e=document.activeElement;return!e||e===document.body||!!m.current?.contains(e)};return H(()=>()=>{g.current=!1,m.current&&v()&&o?.current?.focus()},[]),ct(()=>{c?p.current?.focus():h.current&&f.current?.focus(),h.current=!1},[c]),c?/* @__PURE__ */ W(`div`,{ref:m,className:`confirm`,role:`group`,"aria-label":t,children:[/* @__PURE__ */ V(`p`,{id:_,children:i}),/* @__PURE__ */ W(`div`,{className:`actions`,children:[/* @__PURE__ */ V(`button`,{type:`button`,className:`danger`,"aria-describedby":_,disabled:u,onClick:()=>{d(!0),Promise.resolve().then(a).catch(()=>{}).finally(()=>{if(!g.current)return;let e=v();d(!1),l(!1),e&&(o?.current?o.current.focus():h.current=!0)})},children:u?r:n}),/* @__PURE__ */ V(`button`,{ref:p,type:`button`,className:`secondary`,"aria-describedby":_,disabled:u,onClick:()=>{h.current=!0,l(!1)},children:s.formatMessage({id:`Cancel`,defaultMessage:`Cancel`})})]})]}):/* @__PURE__ */ V(`button`,{ref:f,type:`button`,className:`secondary`,"aria-label":t===e?void 0:t,onClick:()=>l(!0),children:e})};U();var ZG=()=>{let[e,t]=K(g);return H(()=>(t(g()),a(()=>t(g()))),[]),e},QG=()=>(ZG(),ae()),$G=()=>{let e=L(),t=ZG(),n=At(),r=t=>e.formatDisplayName(t,{type:`region`})??t,i=B(()=>{let{compare:t}=new Intl.Collator(e.locale);return x.map(e=>({country:e,name:r(e)})).sort((e,n)=>t(e.name,n.name))},[e]);return/* @__PURE__ */ W(`div`,{className:`row`,"data-setting":`country`,children:[/* @__PURE__ */ V(`div`,{className:`head`,children:/* @__PURE__ */ V(`h3`,{id:n,children:e.formatMessage({id:`Country`,defaultMessage:`Country`})})}),/* @__PURE__ */ W(`select`,{"aria-labelledby":n,value:t??``,onChange:e=>c(e.currentTarget.value||void 0),children:[/* @__PURE__ */ V(`option`,{value:``,children:e.formatMessage({id:`Automatic ({country})`,defaultMessage:`Automatic ({country})`},{country:r(ie())})}),i.map(({country:e,name:t})=>/* @__PURE__ */ V(`option`,{value:e,children:t},e))]})]})};U();var eK=e=>e instanceof Error?e.message:String(e),tK=(e,t,n)=>{switch(n){case`authed`:return{text:e.formatMessage({id:`Signed in to {name}.`,defaultMessage:`Signed in to {name}.`},{name:t})};case`closed`:return{text:e.formatMessage({id:`The sign-in window closed.`,defaultMessage:`The sign-in window closed.`})};case`blocked`:return{text:e.formatMessage({id:`The browser blocked the sign-in window. Allow pop-ups for this page and try again.`,defaultMessage:`The browser blocked the sign-in window. Allow pop-ups for this page and try again.`}),error:!0};case`unsupported`:return{text:e.formatMessage({id:`Connected to {name}.`,defaultMessage:`Connected to {name}.`},{name:t})}}},nK=Ne({"signed-in":{id:`Signed in`,defaultMessage:`Signed in`},"signed-out":{id:`Signed out`,defaultMessage:`Signed out`}}),rK=(e,t)=>({label:e.formatMessage({id:`Sign out`,defaultMessage:`Sign out`}),name:e.formatMessage({id:`Sign out of {name}`,defaultMessage:`Sign out of {name}`},{name:t}),confirmLabel:e.formatMessage({id:`Yes, sign out`,defaultMessage:`Yes, sign out`}),busyLabel:e.formatMessage({id:`Signing out...`,defaultMessage:`Signing out...`}),question:e.formatMessage({id:`Sign out of {name} in every fkn.app app?`,defaultMessage:`Sign out of {name} in every fkn.app app?`},{name:t})}),iK=(e,t)=>({label:e.formatMessage({id:`Disconnect`,defaultMessage:`Disconnect`}),name:e.formatMessage({id:`Disconnect {name}`,defaultMessage:`Disconnect {name}`},{name:t}),confirmLabel:e.formatMessage({id:`Yes, disconnect`,defaultMessage:`Yes, disconnect`}),busyLabel:e.formatMessage({id:`Disconnecting...`,defaultMessage:`Disconnecting...`}),question:e.formatMessage({id:`Disconnect {name} on this device?`,defaultMessage:`Disconnect {name} on this device?`},{name:t})}),aK=(e,t)=>e.formatMessage({id:`Open {host}`,defaultMessage:`Open {host}`},{host:t}),oK=(e,t)=>t?e.formatMessage({id:`Signing in...`,defaultMessage:`Signing in...`}):e.formatMessage({id:`Sign in`,defaultMessage:`Sign in`}),sK=e=>e.formatMessage({id:`Signed out.`,defaultMessage:`Signed out.`}),cK=(e,t)=>{let[,n]=K(0);return H(()=>e.watch(t,()=>n(e=>e+1)),[e,t]),e.read(t)},lK=(e,t,n)=>{H(()=>{if(!t||!n)return;let r=()=>{document.visibilityState!==`hidden`&&e.refresh(`crunchyroll`,t)};return r(),document.addEventListener(`visibilitychange`,r),()=>document.removeEventListener(`visibilitychange`,r)},[e,t,n])},uK=({id:e,state:t,on:n,children:r})=>/* @__PURE__ */ W(`div`,{className:`account`,"data-account":e,children:[t?/* @__PURE__ */ V(`span`,{className:`state${n?` on`:``}`,children:t}):void 0,r]}),dK=({note:e})=>/* @__PURE__ */ V(`p`,{className:`note${e?.error?` error`:``}`,role:`status`,children:e?.text}),fK=()=>{let e=G(!0);return H(()=>()=>{e.current=!1},[]),e},pK=[{site:`crunchyroll`,origin:`cr`,name:`Crunchyroll`,hostFor:()=>`crunchyroll.com`,signsInOnCloud:()=>!0,checked:!0},{site:`prime`,origin:`amazon`,name:`Prime Video`,hostFor:s,signsInOnCloud:j,checked:!1}].filter(e=>Ca(e.origin)),mK=(e,t,n)=>{let r=pK.find(t=>t.origin===e);return!!(r&&t===`cloud`&&r.signsInOnCloud(r.hostFor(ae()))&&n.read(r.site)?.state!==`signed-in`)},hK=(e,t)=>{let n=pK.find(t=>t.origin===e);return!!(n&&t.read(n.site)?.state===`signed-in`)},gK=(e,t)=>{let n=pK.find(t=>t.origin===e),r=n&&t.read(n.site);return!!n&&r?.state!==`signed-in`&&!r?.signedInBefore},_K=({site:e,name:t,hostFor:n,signsInOnCloud:r,checked:i,account:a,heading:o,backend:s,status:c})=>{let l=L(),u=n(QG()),[d,f]=K(!1),[p,m]=K(),h=fK(),g=cK(c,e);lK(c,s,i&&s===`cloud`&&g!==void 0);let _=()=>{let e=a.signIn();f(!0),m(void 0),e.then(e=>{h.current&&m(tK(l,t,e))}).catch(e=>{h.current&&m({text:eK(e),error:!0})}).finally(()=>{h.current&&f(!1)})},v=()=>a.signOut().then(()=>{h.current&&m({text:sK(l)})},e=>{let n=l.formatMessage({id:`Could not sign out of {name}: {error}. Try again.`,defaultMessage:`Could not sign out of {name}: {error}. Try again.`},{name:t,error:eK(e)});h.current&&m({text:n,error:!0})}),y=s===`cloud`&&r(u),b=g?.state??(y?`signed-out`:void 0);return/* @__PURE__ */ W(uK,{id:e,state:b&&l.formatMessage(nK[b]),on:b===`signed-in`,children:[y?/* @__PURE__ */ V(`div`,{className:`actions`,children:b===`signed-in`?/* @__PURE__ */ V(XG,{...rK(l,t),home:o,onConfirm:v}):/* @__PURE__ */ W(`button`,{type:`button`,disabled:d,"aria-busy":d?`true`:void 0,onClick:_,children:[d?/* @__PURE__ */ V(ox,{size:14,className:`spin`,"aria-hidden":`true`}):void 0,oK(l,d)]})}):s?/* @__PURE__ */ V(`div`,{className:`actions`,children:/* @__PURE__ */ V(`a`,{className:`link`,href:`https://www.${u}`,target:`_blank`,rel:`noreferrer`,children:aK(l,u)})}):/* @__PURE__ */ V(`p`,{children:l.formatMessage({id:`Loading...`,defaultMessage:`Loading...`})}),/* @__PURE__ */ V(dK,{note:p})]})},vK=[{site:`anilist`,name:`AniList`,host:`anilist.co`},{site:`mal`,name:`MyAnimeList`,host:`myanimelist.net`},{site:`trakt`,name:`Trakt`,host:`app.trakt.tv`}].filter(e=>Ca(e.site)),yK=({site:e,name:t,host:n,heading:r,backend:i,sites:a,status:o})=>{let s=L(),[c,l]=K(()=>a.isConnected(e)),[u,d]=K(!1),[f,p]=K(),m=fK(),h=cK(o,e),g=c&&h?.state!==`signed-out`;H(()=>(l(a.isConnected(e)),a.watch(e,()=>{m.current&&l(a.isConnected(e))})),[a,e]);let _=()=>{m.current&&l(a.isConnected(e))},v=()=>{let n=a.signIn(e);d(!0),p(void 0),n.then(e=>{m.current&&p(tK(s,t,e))}).catch(e=>{m.current&&p({text:eK(e),error:!0})}).finally(()=>{m.current&&d(!1),_()})},y=n=>a.signOut(e,n).then(()=>{m.current&&p({text:n===`cloud`?sK(s):s.formatMessage({id:`Disconnected.`,defaultMessage:`Disconnected.`})}),_()},e=>{let n=s.formatMessage({id:`Could not finish signing out of {name}: {error}. Sign in and out again to retry.`,defaultMessage:`Could not finish signing out of {name}: {error}. Sign in and out again to retry.`},{name:t,error:eK(e)});m.current&&p({text:n,error:!0}),_()});return/* @__PURE__ */ W(uK,{id:e,state:c?h&&s.formatMessage(nK[h.state]):s.formatMessage({id:`Not connected`,defaultMessage:`Not connected`}),on:g,children:[i?/* @__PURE__ */ V(`div`,{className:`actions`,children:g?/* @__PURE__ */ V(XG,{...i===`cloud`?rK(s,t):iK(s,t),home:r,onConfirm:()=>y(i)}):i===`extension`&&c?/* @__PURE__ */ V(`a`,{className:`link`,href:`https://${n}`,target:`_blank`,rel:`noreferrer`,children:aK(s,n)}):/* @__PURE__ */ W(`button`,{type:`button`,disabled:u,"aria-busy":u?`true`:void 0,onClick:v,children:[u?/* @__PURE__ */ V(ox,{size:14,className:`spin`,"aria-hidden":`true`}):void 0,u||i===`cloud`?oK(s,u):s.formatMessage({id:`Connect`,defaultMessage:`Connect`})]})}):void 0,/* @__PURE__ */ V(dK,{note:f})]})},bK=({backend:e})=>{let t=L();return/* @__PURE__ */ V(uK,{id:`netflix`,children:e===`extension`?/* @__PURE__ */ V(`div`,{className:`actions`,children:/* @__PURE__ */ V(`a`,{className:`link`,href:`https://www.netflix.com`,target:`_blank`,rel:`noreferrer`,children:aK(t,`netflix.com`)})}):/* @__PURE__ */ V(`p`,{children:t.formatMessage({id:`Needs the FKN browser extension.`,defaultMessage:`Needs the FKN browser extension.`})})})},xK=({origin:e,heading:t,backend:n,sites:r,status:i,...a})=>{let o=pK.find(t=>t.origin===e);if(o)return/* @__PURE__ */ V(_K,{...o,account:a[o.site],heading:t,backend:n,status:i});let s=vK.find(t=>t.site===e);return s?/* @__PURE__ */ V(yK,{...s,heading:t,backend:n,sites:r,status:i}):e===`nf`?/* @__PURE__ */ V(bK,{backend:n}):null},SK=4,CK=48,wK=8,TK=e=>t=>{if(t.button||!t.isPrimary)return;t.preventDefault();let n=t.currentTarget,r=n.closest(`li`),i=r.parentElement;n.setPointerCapture(t.pointerId);let a={x:t.clientX,y:t.clientY+scrollY},o=t,s,c=0,l=e=>{s?.removeAttribute(`data-over`),s=e,s?.setAttribute(`data-over`,``)},u=()=>{r.setAttribute(`data-dragging`,``),r.style.transform=`translate(${o.clientX-a.x}px, ${o.clientY+scrollY-a.y}px)`;let e=document.elementFromPoint(o.clientX,o.clientY)?.closest(`li`);l(e?.parentElement===i?e:void 0),cancelAnimationFrame(c);let t=o.clientY<CK?-8:o.clientY>innerHeight-CK?wK:0;t&&(c=requestAnimationFrame(()=>scrollBy(0,t)))},d=e=>{o=e,(r.hasAttribute(`data-dragging`)||Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)>SK)&&u()},f=()=>d(o),p=t=>{cancelAnimationFrame(c),removeEventListener(`scroll`,f),n.removeEventListener(`pointermove`,d),n.removeEventListener(`pointerup`,m),n.removeEventListener(`pointercancel`,h),n.removeEventListener(`lostpointercapture`,h),removeEventListener(`keydown`,g),r.removeAttribute(`data-dragging`),r.style.transform=``;let a=s?[...i.children].indexOf(s):-1;l(),t&&a>=0&&e(a)},m=()=>p(!0),h=()=>p(!1),g=e=>{e.key===`Escape`&&h()};n.addEventListener(`pointermove`,d),n.addEventListener(`pointerup`,m),n.addEventListener(`pointercancel`,h),n.addEventListener(`lostpointercapture`,h),addEventListener(`keydown`,g),addEventListener(`scroll`,f,{passive:!0})};U();var EK=R`
5697
5697
  h3.part {
5698
5698
  font-size: 1.3rem;
5699
5699
  font-weight: 700;
@@ -5831,12 +5831,16 @@ scrollbar-gutter: stable;
5831
5831
  .card .account .state { margin-inline-end: auto; font-size: 1.3rem; color: rgba(255, 255, 255, 0.55); }
5832
5832
  .card .account .state.on { color: #4ade80; }
5833
5833
  .card .account .actions { margin-inline-start: auto; }
5834
+ .card .account .actions button { display: inline-flex; align-items: center; gap: 0.6rem; }
5835
+ .card .account .spin { animation: sources-spin 1s linear infinite; }
5836
+ @keyframes sources-spin { to { transform: rotate(360deg); } }
5834
5837
  .card .account p { font-size: 1.3rem; }
5835
5838
  .card .account .note { flex-basis: 100%; }
5836
5839
  .card .account button:not(.small) { padding: 0.5rem 1.2rem; font-size: 1.3rem; }
5837
5840
 
5838
5841
  @media (prefers-reduced-motion: reduce) {
5839
5842
  .card .icon, .card h4 { transition: none; }
5843
+ .card .account .spin { animation: none; }
5840
5844
  }
5841
5845
 
5842
5846
  button.link-button {
@@ -6019,9 +6023,9 @@ scrollbar-gutter: stable;
6019
6023
  .group button:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.8); outline-offset: 0; }
6020
6024
 
6021
6025
  .by-address .note { font-size: 1.35rem; overflow-wrap: anywhere; }
6022
- `,TK=Ne({connected:{id:`Connected#state of an added source`,defaultMessage:`Connected`,description:`state of an added source`},connecting:{id:`Connecting#state of an added source`,defaultMessage:`Connecting`,description:`state of an added source`},error:{id:`Error#state of an added source`,defaultMessage:`Error`,description:`state of an added source`}}),EK=Ne({up:{id:`Move {name} up`,defaultMessage:`Move {name} up`},down:{id:`Move {name} down`,defaultMessage:`Move {name} down`},mergeUp:{id:`Move {name} up in the merge order`,defaultMessage:`Move {name} up in the merge order`},mergeDown:{id:`Move {name} down in the merge order`,defaultMessage:`Move {name} down in the merge order`}}),DK=`npm:@scope/package`,OK={text:`text`,url:`url`,secret:`password`},kK=({uri:e,name:t,fields:n})=>{let r=L(),[i,a]=K(()=>Tc(e)),[o,s]=K({}),c={...i,...o},l=Object.fromEntries(n.flatMap(({key:e})=>c[e]?.trim()?[[e,c[e].trim()]]:[])),u=n.some(({key:e})=>l[e]!==i[e]),d=n.filter(e=>e.required&&!i[e.key]).map(e=>e.label);return H(()=>{let t=()=>a(Tc(e));return t(),xu(t)},[e]),/* @__PURE__ */ W(`form`,{onSubmit:t=>{t.preventDefault(),u&&(a(l),s({}),nd(e,Object.fromEntries(Object.keys({...i,...l}).filter(e=>l[e]!==i[e]).map(e=>[e,l[e]??null]))))},children:[n.map(({key:e,label:t,kind:n,required:r})=>/* @__PURE__ */ W(`label`,{children:[t,/* @__PURE__ */ V(`input`,{type:OK[n],autoComplete:n===`secret`?`new-password`:`off`,spellcheck:!1,"aria-required":r?!0:void 0,value:c[e]??``,onInput:t=>s({...o,[e]:t.target.value})})]},e)),d.length?/* @__PURE__ */ V(`p`,{className:`failure`,children:r.formatMessage({id:`Required: {fields}`,defaultMessage:`Required: {fields}`},{fields:r.formatList(d,Cn)})}):void 0,/* @__PURE__ */ V(`button`,{type:`submit`,className:`secondary small`,"aria-label":r.formatMessage({id:`Save {name} settings`,defaultMessage:`Save {name} settings`},{name:t}),"aria-disabled":!u||void 0,children:r.formatMessage({id:`Save`,defaultMessage:`Save`})})]})},AK=({plugin:e,onRemove:t})=>{let n=L(),r=e.sources??[],i=NC(n,e),a=e.temporary?n.formatMessage({id:`Temporary`,defaultMessage:`Temporary`}):void 0,o=pn([a,r.length>1?n.formatMessage({id:`{count, plural, one {{count} source} other {{count} sources}}`,defaultMessage:`{count, plural, one {{count} source} other {{count} sources}}`},{count:r.length}):void 0,e.rejected?.length?n.formatMessage({id:`{count, plural, one {{count} unavailable} other {{count} unavailable}}`,defaultMessage:`{count, plural, one {{count} unavailable} other {{count} unavailable}}`},{count:e.rejected.length}):void 0]),s=o&&` · ${o}`;return/* @__PURE__ */ W(`li`,{className:`row plugin`,"data-plugin":e.uri,children:[/* @__PURE__ */ W(`div`,{className:`info`,children:[/* @__PURE__ */ V(`span`,{className:`name`,children:i}),r.length?/* @__PURE__ */ W(`span`,{className:`meta`,children:[/* @__PURE__ */ V(`span`,{className:`uri`,children:e.uri}),s]}):a&&/* @__PURE__ */ V(`span`,{className:`meta`,children:a})]}),/* @__PURE__ */ W(`span`,{className:`pill`,"data-state":e.state,children:[/* @__PURE__ */ V(`span`,{className:`dot`,"aria-hidden":`true`}),n.formatMessage(TK[e.state])]}),/* @__PURE__ */ V(`button`,{type:`button`,className:`secondary small`,"aria-label":n.formatMessage({id:`Remove {name}`,defaultMessage:`Remove {name}`},{name:i}),onClick:t,children:n.formatMessage({id:`Remove`,defaultMessage:`Remove`})}),e.state===`error`?/* @__PURE__ */ V(`p`,{className:`failure`,children:n.formatMessage({id:`Could not connect to this source.`,defaultMessage:`Could not connect to this source.`})}):void 0,e.settings?.length?/* @__PURE__ */ V(kK,{uri:e.uri,name:i,fields:e.settings}):void 0]})},jK=e=>{let{host:t,pathname:n}=new URL(e);return t.replace(/^www\./,``)+n.replace(/\/$/,``)},MK=qh.map(e=>({origin:e.origin,name:e.name,from:jK(e.url),icon:e.icon,drawn:Yh(e.origin),asked:Ca(e.origin)})).filter(e=>e.asked||e.drawn),NK=(e,t)=>e.flatMap(e=>e.state===`connected`?(e.sources??[]).filter(e=>!!e.subtitlesOnly===t).map(n=>({origin:n.origin,name:n.name,from:e.uri,icon:n.icon,drawn:t||n.isApiOnly?void 0:n.origin,asked:!0})):[]),PK=({card:e,on:t,shown:n,accounts:r,place:i,grab:a,brief:o,children:s})=>{let c=L(),l=G(null);return/* @__PURE__ */ W(`li`,{className:`card${o?` brief`:``}${t?``:` off`}`,"data-source":e.origin,children:[/* @__PURE__ */ W(`div`,{className:`top`,children:[a?/* @__PURE__ */ V(`span`,{className:`grip`,"aria-hidden":`true`,onPointerDown:a,children:/* @__PURE__ */ V(rx,{})}):void 0,i?/* @__PURE__ */ V(`span`,{className:`place`,"aria-hidden":`true`,children:i}):void 0,/* @__PURE__ */ V(`span`,{className:`icon`,children:e.icon?/* @__PURE__ */ V(Iw,{icon:e.icon,name:e.name}):/* @__PURE__ */ V(`span`,{className:`letter`,"aria-hidden":`true`,children:e.name.charAt(0)})}),/* @__PURE__ */ W(`div`,{className:`title`,children:[/* @__PURE__ */ V(`h4`,{ref:l,tabIndex:-1,children:e.name}),/* @__PURE__ */ V(`span`,{className:`from`,children:e.from})]}),s?/* @__PURE__ */ V(`div`,{className:`order`,children:s}):void 0]}),o?void 0:/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`div`,{className:`switches`,children:[e.asked?/* @__PURE__ */ W(`label`,{children:[c.formatMessage({id:`Source#switch using a source`,defaultMessage:`Source`,description:`switch using a source`}),/* @__PURE__ */ V(`input`,{type:`checkbox`,role:`switch`,css:pC,"aria-label":c.formatMessage({id:`{name} source`,defaultMessage:`{name} source`},{name:e.name}),checked:t,onChange:t=>ur(e.origin,t.target.checked)})]}):void 0,e.drawn?/* @__PURE__ */ W(`label`,{children:[c.formatMessage({id:`Icon#switch showing a source icon`,defaultMessage:`Icon`,description:`switch showing a source icon`}),/* @__PURE__ */ V(`input`,{type:`checkbox`,role:`switch`,css:pC,"aria-label":c.formatMessage({id:`{name} icon`,defaultMessage:`{name} icon`},{name:e.name}),checked:n,onChange:t=>od(e.drawn,t.target.checked)})]}):void 0]}),/* @__PURE__ */ V(yK,{origin:e.origin,heading:l,...r})]})]})},FK=e=>{let t=L(),[n,r]=K(wu),[i,a]=K(()=>new Set(Mn())),[o,s]=K(dd),[c,l]=K(In),u=cd(),[d,f]=K(``),[p,m]=K(!1),[h,g]=K(``),_=At(),v=()=>r(wu());H(()=>(v(),xu(v)),[]),H(()=>Gn(()=>a(new Set(Mn()))),[]),H(()=>pd(()=>s(dd())),[]),H(()=>Fn(()=>l(In())),[]);let y=NK(n,!1),b=NK(n,!0),x=[...MK.filter(e=>e.asked&&ud.includes(e.origin)),...y],S=md(o,y.map(e=>e.origin)),C=S.flatMap(e=>x.filter(t=>t.origin===e)),w=Xn(c),T=w.flatMap(e=>MK.filter(t=>t.origin===e&&t.asked)),E=MK.filter(e=>!x.includes(e)&&!T.includes(e)),D=[...C,...T.filter(e=>!x.includes(e)),...E,...b].filter(e=>e.asked),O=D.filter(e=>i.has(e.origin)).length,k=G(void 0);ct(()=>{k.current?.focus(),k.current=void 0});let A={cards:C,order:S,write:fd,up:EK.up,down:EK.down},j={cards:T,order:w,write:Kn,up:EK.mergeUp,down:EK.mergeDown},M=(e,n,r,i)=>{let a=n<0?r===0:r===i.cards.length-1;return/* @__PURE__ */ V(`button`,{type:`button`,className:`secondary`,"aria-label":t.formatMessage(n<0?i.up:i.down,{name:e.name}),"aria-disabled":a?!0:void 0,onClick:t=>{a||(k.current=t.currentTarget,i.write(hd(i.order,e.origin,n,i.cards.map(e=>e.origin))))},children:V(n<0?Gb:Wb,{})})},N=(e,t,n)=>CK(r=>n.write(hd(n.order,e.origin,r-t,n.cards.map(e=>e.origin)))),P=(t,n,r=0)=>/* @__PURE__ */ V(PK,{card:t,on:!t.asked||!i.has(t.origin),shown:!t.drawn||!u.has(t.drawn),accounts:e,place:n?r+1:void 0,grab:n?N(t,r,n):void 0,brief:n===j&&x.includes(t),children:n?/* @__PURE__ */ W(q,{children:[M(t,-1,r,n),M(t,1,r,n)]}):void 0},t.origin);return/* @__PURE__ */ W(`div`,{css:wK,children:[/* @__PURE__ */ V(`div`,{className:`rows`,children:/* @__PURE__ */ V(ZG,{})}),/* @__PURE__ */ W(`div`,{className:`part-head`,children:[/* @__PURE__ */ V(`span`,{className:`count`,children:O?t.formatMessage({id:`{on, plural, one {{on} of {count} on} other {{on} of {count} on}}`,defaultMessage:`{on, plural, one {{on} of {count} on} other {{on} of {count} on}}`},{on:D.length-O,count:D.length}):t.formatMessage({id:`{count, plural, one {All {count} on} other {All {count} on}}`,defaultMessage:`{count, plural, one {All {count} on} other {All {count} on}}`},{count:D.length})}),/* @__PURE__ */ V(`button`,{type:`button`,className:`link-button`,"aria-disabled":!O||void 0,onClick:()=>{O&&Wn(D.map(e=>e.origin))},children:t.formatMessage({id:`Turn all on`,defaultMessage:`Turn all on`})})]}),/* @__PURE__ */ V(`h3`,{className:`part`,children:t.formatMessage({id:`Play order`,defaultMessage:`Play order`})}),/* @__PURE__ */ V(`ol`,{className:`cards play-order`,children:C.map((e,t)=>P(e,A,t))}),/* @__PURE__ */ V(`h3`,{className:`part`,children:t.formatMessage({id:`Merge order`,defaultMessage:`Merge order`})}),/* @__PURE__ */ V(`ol`,{className:`cards merge-order`,children:T.map((e,t)=>P(e,j,t))}),/* @__PURE__ */ V(`h3`,{className:`part`,children:t.formatMessage({id:`Other sources`,defaultMessage:`Other sources`})}),/* @__PURE__ */ V(`ul`,{className:`cards`,children:E.map(e=>P(e))}),b.length?/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`h3`,{className:`part`,children:t.formatMessage({id:`Subtitles`,defaultMessage:`Subtitles`})}),/* @__PURE__ */ V(`ul`,{className:`cards subtitle-sources`,children:b.map(e=>P(e))})]}):void 0,/* @__PURE__ */ V(`h3`,{className:`part`,children:t.formatMessage({id:`Added#sources the viewer added`,defaultMessage:`Added`,description:`sources the viewer added`})}),n.length?/* @__PURE__ */ V(`ul`,{className:`rows`,children:n.map(e=>/* @__PURE__ */ V(AK,{plugin:e,onRemove:()=>{td(e.uri).then(v)}},e.uri))}):/* @__PURE__ */ V(`p`,{className:`row empty`,children:t.formatMessage({id:`No sources added yet.`,defaultMessage:`No sources added yet.`})}),/* @__PURE__ */ W(`div`,{className:`add`,children:[/* @__PURE__ */ V(`div`,{className:`browse`,children:/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>{rd().finally(v)},children:t.formatMessage({id:`Browse sources`,defaultMessage:`Browse sources`})})}),/* @__PURE__ */ W(`form`,{className:`by-address`,onSubmit:e=>{e.preventDefault();let n=d.trim();n&&!p&&(m(!0),g(``),Zu(n).then(e=>{e&&f(``)}).catch(e=>{console.warn(`Source '${n}' could not be added:`,e),g(t.formatMessage({id:`Could not add this source. Check the address.`,defaultMessage:`Could not add this source. Check the address.`}))}).finally(()=>{m(!1),v()}))},children:[/* @__PURE__ */ V(`label`,{for:`${_}-address`,children:t.formatMessage({id:`Or add one by its address`,defaultMessage:`Or add one by its address`})}),/* @__PURE__ */ W(`div`,{className:`group${h?` invalid`:``}`,children:[/* @__PURE__ */ V(`input`,{id:`${_}-address`,type:`text`,autoComplete:`off`,spellcheck:!1,placeholder:DK,"aria-invalid":h?!0:void 0,"aria-describedby":`${_}-error`,value:d,onInput:e=>f(e.target.value)}),/* @__PURE__ */ V(`button`,{type:`submit`,disabled:p,children:p?t.formatMessage({id:`Adding...`,defaultMessage:`Adding...`}):t.formatMessage({id:`Add`,defaultMessage:`Add`})})]}),/* @__PURE__ */ V(`p`,{className:`note error`,id:`${_}-error`,role:`alert`,children:h})]})]})]})};U();var IK=R`
6026
+ `,DK=Ne({connected:{id:`Connected#state of an added source`,defaultMessage:`Connected`,description:`state of an added source`},connecting:{id:`Connecting#state of an added source`,defaultMessage:`Connecting`,description:`state of an added source`},error:{id:`Error#state of an added source`,defaultMessage:`Error`,description:`state of an added source`}}),OK=Ne({up:{id:`Move {name} up`,defaultMessage:`Move {name} up`},down:{id:`Move {name} down`,defaultMessage:`Move {name} down`},mergeUp:{id:`Move {name} up in the merge order`,defaultMessage:`Move {name} up in the merge order`},mergeDown:{id:`Move {name} down in the merge order`,defaultMessage:`Move {name} down in the merge order`}}),kK=`npm:@scope/package`,AK={text:`text`,url:`url`,secret:`password`},jK=({uri:e,name:t,fields:n})=>{let r=L(),[i,a]=K(()=>Tc(e)),[o,s]=K({}),c={...i,...o},l=Object.fromEntries(n.flatMap(({key:e})=>c[e]?.trim()?[[e,c[e].trim()]]:[])),u=n.some(({key:e})=>l[e]!==i[e]),d=n.filter(e=>e.required&&!i[e.key]).map(e=>e.label);return H(()=>{let t=()=>a(Tc(e));return t(),xu(t)},[e]),/* @__PURE__ */ W(`form`,{onSubmit:t=>{t.preventDefault(),u&&(a(l),s({}),nd(e,Object.fromEntries(Object.keys({...i,...l}).filter(e=>l[e]!==i[e]).map(e=>[e,l[e]??null]))))},children:[n.map(({key:e,label:t,kind:n,required:r})=>/* @__PURE__ */ W(`label`,{children:[t,/* @__PURE__ */ V(`input`,{type:AK[n],autoComplete:n===`secret`?`new-password`:`off`,spellcheck:!1,"aria-required":r?!0:void 0,value:c[e]??``,onInput:t=>s({...o,[e]:t.target.value})})]},e)),d.length?/* @__PURE__ */ V(`p`,{className:`failure`,children:r.formatMessage({id:`Required: {fields}`,defaultMessage:`Required: {fields}`},{fields:r.formatList(d,Cn)})}):void 0,/* @__PURE__ */ V(`button`,{type:`submit`,className:`secondary small`,"aria-label":r.formatMessage({id:`Save {name} settings`,defaultMessage:`Save {name} settings`},{name:t}),"aria-disabled":!u||void 0,children:r.formatMessage({id:`Save`,defaultMessage:`Save`})})]})},MK=({plugin:e,onRemove:t})=>{let n=L(),r=e.sources??[],i=NC(n,e),a=e.temporary?n.formatMessage({id:`Temporary`,defaultMessage:`Temporary`}):void 0,o=pn([a,r.length>1?n.formatMessage({id:`{count, plural, one {{count} source} other {{count} sources}}`,defaultMessage:`{count, plural, one {{count} source} other {{count} sources}}`},{count:r.length}):void 0,e.rejected?.length?n.formatMessage({id:`{count, plural, one {{count} unavailable} other {{count} unavailable}}`,defaultMessage:`{count, plural, one {{count} unavailable} other {{count} unavailable}}`},{count:e.rejected.length}):void 0]),s=o&&` · ${o}`;return/* @__PURE__ */ W(`li`,{className:`row plugin`,"data-plugin":e.uri,children:[/* @__PURE__ */ W(`div`,{className:`info`,children:[/* @__PURE__ */ V(`span`,{className:`name`,children:i}),r.length?/* @__PURE__ */ W(`span`,{className:`meta`,children:[/* @__PURE__ */ V(`span`,{className:`uri`,children:e.uri}),s]}):a&&/* @__PURE__ */ V(`span`,{className:`meta`,children:a})]}),/* @__PURE__ */ W(`span`,{className:`pill`,"data-state":e.state,children:[/* @__PURE__ */ V(`span`,{className:`dot`,"aria-hidden":`true`}),n.formatMessage(DK[e.state])]}),/* @__PURE__ */ V(`button`,{type:`button`,className:`secondary small`,"aria-label":n.formatMessage({id:`Remove {name}`,defaultMessage:`Remove {name}`},{name:i}),onClick:t,children:n.formatMessage({id:`Remove`,defaultMessage:`Remove`})}),e.state===`error`?/* @__PURE__ */ V(`p`,{className:`failure`,children:n.formatMessage({id:`Could not connect to this source.`,defaultMessage:`Could not connect to this source.`})}):void 0,e.settings?.length?/* @__PURE__ */ V(jK,{uri:e.uri,name:i,fields:e.settings}):void 0]})},NK=e=>{let{host:t,pathname:n}=new URL(e);return t.replace(/^www\./,``)+n.replace(/\/$/,``)},PK=qh.map(e=>({origin:e.origin,name:e.name,from:NK(e.url),icon:e.icon,drawn:Yh(e.origin),asked:Ca(e.origin)})).filter(e=>e.asked||e.drawn),FK=(e,t)=>e.flatMap(e=>e.state===`connected`?(e.sources??[]).filter(e=>!!e.subtitlesOnly===t).map(n=>({origin:n.origin,name:n.name,from:e.uri,icon:n.icon,drawn:t||n.isApiOnly?void 0:n.origin,asked:!0})):[]),IK=({card:e,on:t,shown:n,accounts:r,place:i,grab:a,brief:o,children:s})=>{let c=L(),l=G(null);return/* @__PURE__ */ W(`li`,{className:`card${o?` brief`:``}${t?``:` off`}`,"data-source":e.origin,children:[/* @__PURE__ */ W(`div`,{className:`top`,children:[a?/* @__PURE__ */ V(`span`,{className:`grip`,"aria-hidden":`true`,onPointerDown:a,children:/* @__PURE__ */ V(rx,{})}):void 0,i?/* @__PURE__ */ V(`span`,{className:`place`,"aria-hidden":`true`,children:i}):void 0,/* @__PURE__ */ V(`span`,{className:`icon`,children:e.icon?/* @__PURE__ */ V(Iw,{icon:e.icon,name:e.name}):/* @__PURE__ */ V(`span`,{className:`letter`,"aria-hidden":`true`,children:e.name.charAt(0)})}),/* @__PURE__ */ W(`div`,{className:`title`,children:[/* @__PURE__ */ V(`h4`,{ref:l,tabIndex:-1,children:e.name}),/* @__PURE__ */ V(`span`,{className:`from`,children:e.from})]}),s?/* @__PURE__ */ V(`div`,{className:`order`,children:s}):void 0]}),o?void 0:/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`div`,{className:`switches`,children:[e.asked?/* @__PURE__ */ W(`label`,{children:[c.formatMessage({id:`Source#switch using a source`,defaultMessage:`Source`,description:`switch using a source`}),/* @__PURE__ */ V(`input`,{type:`checkbox`,role:`switch`,css:pC,"aria-label":c.formatMessage({id:`{name} source`,defaultMessage:`{name} source`},{name:e.name}),checked:t,onChange:t=>ur(e.origin,t.target.checked)})]}):void 0,e.drawn?/* @__PURE__ */ W(`label`,{children:[c.formatMessage({id:`Icon#switch showing a source icon`,defaultMessage:`Icon`,description:`switch showing a source icon`}),/* @__PURE__ */ V(`input`,{type:`checkbox`,role:`switch`,css:pC,"aria-label":c.formatMessage({id:`{name} icon`,defaultMessage:`{name} icon`},{name:e.name}),checked:n,onChange:t=>od(e.drawn,t.target.checked)})]}):void 0]}),/* @__PURE__ */ V(xK,{origin:e.origin,heading:l,...r})]})]})},LK=e=>{let t=L(),[n,r]=K(wu),[i,a]=K(()=>new Set(Mn())),[o,s]=K(dd),[c,l]=K(In),u=cd(),[d,f]=K(``),[p,m]=K(!1),[h,g]=K(``),_=At(),v=()=>r(wu());H(()=>(v(),xu(v)),[]),H(()=>Gn(()=>a(new Set(Mn()))),[]),H(()=>pd(()=>s(dd())),[]),H(()=>Fn(()=>l(In())),[]);let y=FK(n,!1),b=FK(n,!0),x=[...PK.filter(e=>e.asked&&ud.includes(e.origin)),...y],S=md(o,y.map(e=>e.origin)),C=S.flatMap(e=>x.filter(t=>t.origin===e)),w=Xn(c),T=w.flatMap(e=>PK.filter(t=>t.origin===e&&t.asked)),E=PK.filter(e=>!x.includes(e)&&!T.includes(e)),D=[...C,...T.filter(e=>!x.includes(e)),...E,...b].filter(e=>e.asked),O=D.filter(e=>i.has(e.origin)).length,k=G(void 0);ct(()=>{k.current?.focus(),k.current=void 0});let A={cards:C,order:S,write:fd,up:OK.up,down:OK.down},j={cards:T,order:w,write:Kn,up:OK.mergeUp,down:OK.mergeDown},M=(e,n,r,i)=>{let a=n<0?r===0:r===i.cards.length-1;return/* @__PURE__ */ V(`button`,{type:`button`,className:`secondary`,"aria-label":t.formatMessage(n<0?i.up:i.down,{name:e.name}),"aria-disabled":a?!0:void 0,onClick:t=>{a||(k.current=t.currentTarget,i.write(hd(i.order,e.origin,n,i.cards.map(e=>e.origin))))},children:V(n<0?Gb:Wb,{})})},N=(e,t,n)=>TK(r=>n.write(hd(n.order,e.origin,r-t,n.cards.map(e=>e.origin)))),P=(t,n,r=0)=>/* @__PURE__ */ V(IK,{card:t,on:!t.asked||!i.has(t.origin),shown:!t.drawn||!u.has(t.drawn),accounts:e,place:n?r+1:void 0,grab:n?N(t,r,n):void 0,brief:n===j&&x.includes(t),children:n?/* @__PURE__ */ W(q,{children:[M(t,-1,r,n),M(t,1,r,n)]}):void 0},t.origin);return/* @__PURE__ */ W(`div`,{css:EK,children:[/* @__PURE__ */ V(`div`,{className:`rows`,children:/* @__PURE__ */ V($G,{})}),/* @__PURE__ */ W(`div`,{className:`part-head`,children:[/* @__PURE__ */ V(`span`,{className:`count`,children:O?t.formatMessage({id:`{on, plural, one {{on} of {count} on} other {{on} of {count} on}}`,defaultMessage:`{on, plural, one {{on} of {count} on} other {{on} of {count} on}}`},{on:D.length-O,count:D.length}):t.formatMessage({id:`{count, plural, one {All {count} on} other {All {count} on}}`,defaultMessage:`{count, plural, one {All {count} on} other {All {count} on}}`},{count:D.length})}),/* @__PURE__ */ V(`button`,{type:`button`,className:`link-button`,"aria-disabled":!O||void 0,onClick:()=>{O&&Wn(D.map(e=>e.origin))},children:t.formatMessage({id:`Turn all on`,defaultMessage:`Turn all on`})})]}),/* @__PURE__ */ V(`h3`,{className:`part`,children:t.formatMessage({id:`Play order`,defaultMessage:`Play order`})}),/* @__PURE__ */ V(`ol`,{className:`cards play-order`,children:C.map((e,t)=>P(e,A,t))}),/* @__PURE__ */ V(`h3`,{className:`part`,children:t.formatMessage({id:`Merge order`,defaultMessage:`Merge order`})}),/* @__PURE__ */ V(`ol`,{className:`cards merge-order`,children:T.map((e,t)=>P(e,j,t))}),/* @__PURE__ */ V(`h3`,{className:`part`,children:t.formatMessage({id:`Other sources`,defaultMessage:`Other sources`})}),/* @__PURE__ */ V(`ul`,{className:`cards`,children:E.map(e=>P(e))}),b.length?/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`h3`,{className:`part`,children:t.formatMessage({id:`Subtitles`,defaultMessage:`Subtitles`})}),/* @__PURE__ */ V(`ul`,{className:`cards subtitle-sources`,children:b.map(e=>P(e))})]}):void 0,/* @__PURE__ */ V(`h3`,{className:`part`,children:t.formatMessage({id:`Added#sources the viewer added`,defaultMessage:`Added`,description:`sources the viewer added`})}),n.length?/* @__PURE__ */ V(`ul`,{className:`rows`,children:n.map(e=>/* @__PURE__ */ V(MK,{plugin:e,onRemove:()=>{td(e.uri).then(v)}},e.uri))}):/* @__PURE__ */ V(`p`,{className:`row empty`,children:t.formatMessage({id:`No sources added yet.`,defaultMessage:`No sources added yet.`})}),/* @__PURE__ */ W(`div`,{className:`add`,children:[/* @__PURE__ */ V(`div`,{className:`browse`,children:/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>{rd().finally(v)},children:t.formatMessage({id:`Browse sources`,defaultMessage:`Browse sources`})})}),/* @__PURE__ */ W(`form`,{className:`by-address`,onSubmit:e=>{e.preventDefault();let n=d.trim();n&&!p&&(m(!0),g(``),Zu(n).then(e=>{e&&f(``)}).catch(e=>{console.warn(`Source '${n}' could not be added:`,e),g(t.formatMessage({id:`Could not add this source. Check the address.`,defaultMessage:`Could not add this source. Check the address.`}))}).finally(()=>{m(!1),v()}))},children:[/* @__PURE__ */ V(`label`,{for:`${_}-address`,children:t.formatMessage({id:`Or add one by its address`,defaultMessage:`Or add one by its address`})}),/* @__PURE__ */ W(`div`,{className:`group${h?` invalid`:``}`,children:[/* @__PURE__ */ V(`input`,{id:`${_}-address`,type:`text`,autoComplete:`off`,spellcheck:!1,placeholder:kK,"aria-invalid":h?!0:void 0,"aria-describedby":`${_}-error`,value:d,onInput:e=>f(e.target.value)}),/* @__PURE__ */ V(`button`,{type:`submit`,disabled:p,children:p?t.formatMessage({id:`Adding...`,defaultMessage:`Adding...`}):t.formatMessage({id:`Add`,defaultMessage:`Add`})})]}),/* @__PURE__ */ V(`p`,{className:`note error`,id:`${_}-error`,role:`alert`,children:h})]})]})]})};U();var RK=R`
6023
6027
  .line { align-self: flex-start; padding: 0 1.6rem; font-size: 1.4rem; }
6024
- `,LK=()=>{let e=L(),[t,n]=K(),[r,i]=K();H(()=>{let e=!0,t=()=>{document.visibilityState!==`hidden`&&MH.publishing().then(t=>{e&&n(t)})};return t(),document.addEventListener(`visibilitychange`,t),()=>{e=!1,document.removeEventListener(`visibilitychange`,t)}},[]);let a=e=>{i(e),(e?MH.allowPublishing({kinds:pH}):MH.stopPublishing()).then(e=>{n(e),i(void 0)})},o=t?.state,s=o===`asked`?e.formatMessage({id:`Allow it on FKN Social.`,defaultMessage:`Allow it on FKN Social.`}):o===`no-name`?e.formatMessage({id:`Pick a name on FKN Social first.`,defaultMessage:`Pick a name on FKN Social first.`}):void 0,c=o===`locked`?e.formatMessage({id:`The FKN account's storage is locked on this device`,defaultMessage:`The FKN account's storage is locked on this device`}):o&&!s&&o!==`allowed`&&o!==`off`?e.formatMessage({id:`FKN Social is not available right now. Try again later.`,defaultMessage:`FKN Social is not available right now. Try again later.`}):void 0;return/* @__PURE__ */ W(`div`,{css:[VG,IK],"data-setting":`social`,children:[/* @__PURE__ */ V(HG,{on:r??(o===`allowed`||o===`asked`),set:a,disabled:r!==void 0,children:e.formatMessage({id:`Post to FKN Social`,defaultMessage:`Post to FKN Social`})}),s?/* @__PURE__ */ V(`a`,{className:`line link`,href:kH,target:`_blank`,rel:`noreferrer`,children:s}):void 0,c?/* @__PURE__ */ V(`p`,{className:`line note error`,children:c}):void 0]})},RK=R`
6028
+ `,zK=()=>{let e=L(),[t,n]=K(),[r,i]=K();H(()=>{let e=!0,t=()=>{document.visibilityState!==`hidden`&&MH.publishing().then(t=>{e&&n(t)})};return t(),document.addEventListener(`visibilitychange`,t),()=>{e=!1,document.removeEventListener(`visibilitychange`,t)}},[]);let a=e=>{i(e),(e?MH.allowPublishing({kinds:pH}):MH.stopPublishing()).then(e=>{n(e),i(void 0)})},o=t?.state,s=o===`asked`?e.formatMessage({id:`Allow it on FKN Social.`,defaultMessage:`Allow it on FKN Social.`}):o===`no-name`?e.formatMessage({id:`Pick a name on FKN Social first.`,defaultMessage:`Pick a name on FKN Social first.`}):void 0,c=o===`locked`?e.formatMessage({id:`The FKN account's storage is locked on this device`,defaultMessage:`The FKN account's storage is locked on this device`}):o&&!s&&o!==`allowed`&&o!==`off`?e.formatMessage({id:`FKN Social is not available right now. Try again later.`,defaultMessage:`FKN Social is not available right now. Try again later.`}):void 0;return/* @__PURE__ */ W(`div`,{css:[UG,RK],"data-setting":`social`,children:[/* @__PURE__ */ V(WG,{on:r??(o===`allowed`||o===`asked`),set:a,disabled:r!==void 0,children:e.formatMessage({id:`Post to FKN Social`,defaultMessage:`Post to FKN Social`})}),s?/* @__PURE__ */ V(`a`,{className:`line link`,href:kH,target:`_blank`,rel:`noreferrer`,children:s}):void 0,c?/* @__PURE__ */ V(`p`,{className:`line note error`,children:c}):void 0]})},BK=R`
6025
6029
  min-width: 0;
6026
6030
 
6027
6031
  & > h2 {
@@ -6158,7 +6162,7 @@ scrollbar-gutter: stable;
6158
6162
  }
6159
6163
 
6160
6164
  .confirm p { color: rgba(255, 255, 255, 0.9); }
6161
- `,zK={url:`${T}/auth/v1/token`,authorization:`Basic ${btoa(`${E}:`)}`,deviceType:`stub on FKN`},BK=async({url:e,authorization:t,deviceType:n},r=fetch,i)=>{let a=globalThis.location?.origin===new URL(e).origin?globalThis.document?.cookie??``:``,o=/(?:^|;\s*)device_id=([^;]+)/.exec(a)?.[1]??crypto.randomUUID(),s=await r(`${e}?_=${crypto.randomUUID()}`,{method:`POST`,credentials:`include`,headers:{authorization:t,"content-type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`etp_rt_cookie`,device_id:o,device_type:n}).toString()}),c=await s.json().catch(()=>null);return!s.ok||!i?{status:s.status,body:s.ok?null:c}:{status:s.status,body:null,read:await i(c)}},VK=e=>Oc(Dc.formatMessage({id:`Crunchyroll answered {status}`,defaultMessage:`Crunchyroll answered {status}`},{status:e}),`Crunchyroll answered ${e}`),HK=e=>(e?.context??[]).some(e=>e.field===`etp_rt`&&e.code===`auth.obtain_access_token.missing_required_field`),UK=({status:e,body:t})=>{if(e===200)return`signed-in`;if(e===400&&HK(t))return`signed-out`;throw VK(e)},WK=`Check whether you are signed in to crunchyroll.com`,GK=async(e,{attach:t,mount:n,fetch:r,settle:i=()=>new Promise(e=>setTimeout(e,2e3))})=>{if(e===`extension`)return UK(await BK(zK,r));let{iframe:a,remove:o}=n();try{let e=await(await t({iframe:a,blank:{url:p},cookies:`persistent`,permissions:[{category:`evaluation`,reason:WK}]})).evaluate(BK,zK);return e.status===200&&await i(),UK(e)}finally{o()}},KK={signIn:Ln,signOut:Bn},qK={signIn:()=>je({url:Oe(s(ae())),domains:I,isSignedIn:y}).then(he(le,`prime`)),signOut:()=>$n(I).then(()=>le.recordSignOut(`prime`))},JK={isConnected:qn,watch:wr,signIn:e=>Jn[e](),signOut:Un},YK={read:le.read,watch:le.watch,refresh:N(le,(e,t)=>GK(t,{attach:ne,mount:()=>Rn(`Sign-in check`),fetch:oe}))},XK=Ff;U();var ZK=R`
6165
+ `,VK={url:`${T}/auth/v1/token`,authorization:`Basic ${btoa(`${E}:`)}`,deviceType:`stub on FKN`},HK=async({url:e,authorization:t,deviceType:n},r=fetch,i)=>{let a=globalThis.location?.origin===new URL(e).origin?globalThis.document?.cookie??``:``,o=/(?:^|;\s*)device_id=([^;]+)/.exec(a)?.[1]??crypto.randomUUID(),s=await r(`${e}?_=${crypto.randomUUID()}`,{method:`POST`,credentials:`include`,headers:{authorization:t,"content-type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`etp_rt_cookie`,device_id:o,device_type:n}).toString()}),c=await s.json().catch(()=>null);return!s.ok||!i?{status:s.status,body:s.ok?null:c}:{status:s.status,body:null,read:await i(c)}},UK=e=>Oc(Dc.formatMessage({id:`Crunchyroll answered {status}`,defaultMessage:`Crunchyroll answered {status}`},{status:e}),`Crunchyroll answered ${e}`),WK=e=>(e?.context??[]).some(e=>e.field===`etp_rt`&&e.code===`auth.obtain_access_token.missing_required_field`),GK=({status:e,body:t})=>{if(e===200)return`signed-in`;if(e===400&&WK(t))return`signed-out`;throw UK(e)},KK=`Check whether you are signed in to crunchyroll.com`,qK=async(e,{attach:t,mount:n,fetch:r,settle:i=()=>new Promise(e=>setTimeout(e,2e3))})=>{if(e===`extension`)return GK(await HK(VK,r));let{iframe:a,remove:o}=n();try{let e=await(await t({iframe:a,blank:{url:p},cookies:`persistent`,permissions:[{category:`evaluation`,reason:KK}]})).evaluate(HK,VK);return e.status===200&&await i(),GK(e)}finally{o()}},JK={signIn:Ln,signOut:Bn},YK={signIn:()=>je({url:Oe(s(ae())),domains:I,isSignedIn:y}).then(he(le,`prime`)),signOut:()=>$n(I).then(()=>le.recordSignOut(`prime`))},XK={isConnected:qn,watch:wr,signIn:e=>Jn[e](),signOut:Un},ZK={read:le.read,watch:le.watch,refresh:N(le,(e,t)=>qK(t,{attach:ne,mount:()=>Rn(`Sign-in check`),fetch:oe}))},QK=Ff;U();var $K=R`
6162
6166
  display: grid;
6163
6167
  grid-template-columns: 17rem minmax(0, 1fr);
6164
6168
  column-gap: 4rem;
@@ -6219,7 +6223,7 @@ scrollbar-gutter: stable;
6219
6223
 
6220
6224
  .index a[aria-current='true'] { background: #fff; color: #000; border-color: #fff; }
6221
6225
  }
6222
- `,QK=()=>location.hash,$K=()=>{let e=L(),[t,n]=K(),r=qG(ph(QK)),i=KG.find(e=>e.id===r);return H(()=>{let e=!1;return C().then(t=>{e||n(t)}),()=>{e=!0}},[]),/* @__PURE__ */ W(`div`,{css:ZK,children:[/* @__PURE__ */ V(`h1`,{children:e.formatMessage({id:`Settings`,defaultMessage:`Settings`})}),/* @__PURE__ */ V(`nav`,{className:`index`,"aria-label":e.formatMessage({id:`Settings categories`,defaultMessage:`Settings categories`}),children:KG.map(t=>/* @__PURE__ */ V(`a`,{href:`#${t.id}`,"aria-current":i===t?`true`:void 0,onClick:yS,children:e.formatMessage(t.title)},t.id))}),/* @__PURE__ */ W(`section`,{css:RK,"data-section":i.id,"aria-labelledby":`settings-section-title`,children:[/* @__PURE__ */ V(`h2`,{id:`settings-section-title`,children:e.formatMessage(i.title)}),i.id===`sources`?/* @__PURE__ */ V(FK,{backend:t,crunchyroll:KK,prime:qK,sites:JK,status:YK}):i.id===`tracking`?/* @__PURE__ */ V(LK,{}):i.id===`playback`?/* @__PURE__ */ V(WG,{}):/* @__PURE__ */ V(BG,{saved:XK})]})]})},eq=[`WATCHING`,`PLANNING`,`COMPLETED`,`PAUSED`,`DROPPED`,`ALL`],tq=e=>e===`REWATCHING`?`WATCHING`:e&&e!==`ALL`&&eq.includes(e)?e:void 0,nq=e=>{let t=Object.fromEntries(eq.map(e=>[e,0]));for(let n of e){t.ALL++;let e=tq(n.summary.status);e&&t[e]++}return t},rq=[`updated`,`title`,`score`,`progress`],iq=(e,t)=>{let n=t===`updated`?Date.parse(e.summary.updatedAt??``):t===`score`?e.summary.score:e.summary.progress;return n==null||Number.isNaN(n)?void 0:n},aq=(e,{tab:t,term:n,sort:r,locale:i})=>{let a=n.trim().toLocaleLowerCase(i),o=new Intl.Collator(i),s=(e,t)=>{let[n,r]=[e.summary.title,t.summary.title];return!n||!r?Number(!n)-Number(!r):o.compare(n,r)};return e.filter(e=>(t===`ALL`||tq(e.summary.status)===t)&&(e.summary.title??``).toLocaleLowerCase(i).includes(a)).sort((e,t)=>{if(r===`title`)return s(e,t);let[n,i]=[iq(e,r),iq(t,r)];return n===void 0||i===void 0?Number(n===void 0)-Number(i===void 0)||s(e,t):i-n||s(e,t)})},oq=(e,t)=>{let n=Rd(e,e.episodeCount);return tq(e.summary.status)===`WATCHING`&&(n.total==null||(t??n.progress)<n.total)},sq=(e,t,n)=>{let r=Rd(e,e.episodeCount),i={progress:(n??r.progress)+1},a={};for(let n of e.answers){let e=Ud(n,t[n.tracker.id]);if(e.kind!==`check`||!e.sendable)continue;let o=Kd(n,i,{...r,...i});o&&(a[n.tracker.id]=o)}return a};U();var cq=Ne({WATCHING:{id:`Watching#list status`,defaultMessage:`Watching`,description:`list status`},REWATCHING:{id:`Rewatching#list status`,defaultMessage:`Rewatching`,description:`list status`},PLANNING:{id:`Plan to watch#list status`,defaultMessage:`Plan to watch`,description:`list status`},COMPLETED:{id:`Completed#list status`,defaultMessage:`Completed`,description:`list status`},PAUSED:{id:`Paused#list status`,defaultMessage:`Paused`,description:`list status`},DROPPED:{id:`Dropped#list status`,defaultMessage:`Dropped`,description:`list status`},ALL:{id:`All#list status`,defaultMessage:`All`,description:`list status`}}),lq=Ne({updated:{id:`Last updated`,defaultMessage:`Last updated`},title:{id:`Title`,defaultMessage:`Title`},score:{id:`Score`,defaultMessage:`Score`},progress:{id:`Progress`,defaultMessage:`Progress`}}),uq=[`grid`,`list`],dq=48,fq=R`
6226
+ `,eq=()=>location.hash,tq=()=>{let e=L(),[t,n]=K(),r=YG(ph(eq)),i=JG.find(e=>e.id===r);return H(()=>{let e=!1;return C().then(t=>{e||n(t)}),()=>{e=!0}},[]),/* @__PURE__ */ W(`div`,{css:$K,children:[/* @__PURE__ */ V(`h1`,{children:e.formatMessage({id:`Settings`,defaultMessage:`Settings`})}),/* @__PURE__ */ V(`nav`,{className:`index`,"aria-label":e.formatMessage({id:`Settings categories`,defaultMessage:`Settings categories`}),children:JG.map(t=>/* @__PURE__ */ V(`a`,{href:`#${t.id}`,"aria-current":i===t?`true`:void 0,onClick:yS,children:e.formatMessage(t.title)},t.id))}),/* @__PURE__ */ W(`section`,{css:BK,"data-section":i.id,"aria-labelledby":`settings-section-title`,children:[/* @__PURE__ */ V(`h2`,{id:`settings-section-title`,children:e.formatMessage(i.title)}),i.id===`sources`?/* @__PURE__ */ V(LK,{backend:t,crunchyroll:JK,prime:YK,sites:XK,status:ZK}):i.id===`tracking`?/* @__PURE__ */ V(zK,{}):i.id===`playback`?/* @__PURE__ */ V(KG,{}):/* @__PURE__ */ V(HG,{saved:QK})]})]})},nq=[`WATCHING`,`PLANNING`,`COMPLETED`,`PAUSED`,`DROPPED`,`ALL`],rq=e=>e===`REWATCHING`?`WATCHING`:e&&e!==`ALL`&&nq.includes(e)?e:void 0,iq=e=>{let t=Object.fromEntries(nq.map(e=>[e,0]));for(let n of e){t.ALL++;let e=rq(n.summary.status);e&&t[e]++}return t},aq=[`updated`,`title`,`score`,`progress`],oq=(e,t)=>{let n=t===`updated`?Date.parse(e.summary.updatedAt??``):t===`score`?e.summary.score:e.summary.progress;return n==null||Number.isNaN(n)?void 0:n},sq=(e,{tab:t,term:n,sort:r,locale:i})=>{let a=n.trim().toLocaleLowerCase(i),o=new Intl.Collator(i),s=(e,t)=>{let[n,r]=[e.summary.title,t.summary.title];return!n||!r?Number(!n)-Number(!r):o.compare(n,r)};return e.filter(e=>(t===`ALL`||rq(e.summary.status)===t)&&(e.summary.title??``).toLocaleLowerCase(i).includes(a)).sort((e,t)=>{if(r===`title`)return s(e,t);let[n,i]=[oq(e,r),oq(t,r)];return n===void 0||i===void 0?Number(n===void 0)-Number(i===void 0)||s(e,t):i-n||s(e,t)})},cq=(e,t)=>{let n=Rd(e,e.episodeCount);return rq(e.summary.status)===`WATCHING`&&(n.total==null||(t??n.progress)<n.total)},lq=(e,t,n)=>{let r=Rd(e,e.episodeCount),i={progress:(n??r.progress)+1},a={};for(let n of e.answers){let e=Ud(n,t[n.tracker.id]);if(e.kind!==`check`||!e.sendable)continue;let o=Kd(n,i,{...r,...i});o&&(a[n.tracker.id]=o)}return a};U();var uq=Ne({WATCHING:{id:`Watching#list status`,defaultMessage:`Watching`,description:`list status`},REWATCHING:{id:`Rewatching#list status`,defaultMessage:`Rewatching`,description:`list status`},PLANNING:{id:`Plan to watch#list status`,defaultMessage:`Plan to watch`,description:`list status`},COMPLETED:{id:`Completed#list status`,defaultMessage:`Completed`,description:`list status`},PAUSED:{id:`Paused#list status`,defaultMessage:`Paused`,description:`list status`},DROPPED:{id:`Dropped#list status`,defaultMessage:`Dropped`,description:`list status`},ALL:{id:`All#list status`,defaultMessage:`All`,description:`list status`}}),dq=Ne({updated:{id:`Last updated`,defaultMessage:`Last updated`},title:{id:`Title`,defaultMessage:`Title`},score:{id:`Score`,defaultMessage:`Score`},progress:{id:`Progress`,defaultMessage:`Progress`}}),fq=[`grid`,`list`],pq=48,mq=R`
6223
6227
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
6224
6228
  min-height: 100vh;
6225
6229
 
@@ -6436,8 +6440,8 @@ scrollbar-gutter: stable;
6436
6440
  .rows > .item { grid-template-columns: 4.5rem minmax(0, 1fr); }
6437
6441
  .rows > .item > .title, .rows > .item > .facts, .rows > .item > .bar { grid-column: 2; grid-row: auto; }
6438
6442
  }
6439
- `,pq=(e,t)=>{let n=(t,n)=>t===`STATUS`?n?.status?e.formatMessage(cq[n.status]):void 0:t===`PROGRESS`?n?.progress==null?void 0:e.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:n.progress}):n?.score==null?void 0:e.formatMessage({id:`{score, number} / {max, number}`,defaultMessage:`{score, number} / {max, number}`},{score:n.score/10,max:10});return t.disagreements.map(r=>e.formatList(t.answers.map(({tracker:{name:t},entry:i})=>{let a=n(r,i);return a===void 0?e.formatMessage({id:`{name} none`,defaultMessage:`{name} none`},{name:t}):e.formatMessage({id:`{name} {value}`,defaultMessage:`{name} {value}`},{name:t,value:a})}),Cn)).join(`
6440
- `)},mq=e=>{let t=/* @__PURE__ */ new Map;for(let[n,r]of Object.entries(e)){let e=JSON.stringify(r);t.set(e,{fields:r,trackers:[...t.get(e)?.trackers??[],n]})}return[...t.values()]},hq=({row:e})=>{let t=L(),n=cT({uri:e.uri,title:e.summary.title,cover:e.summary.cover,episodeCount:e.episodeCount}),r=e.summary.progress??0,[i,a]=K(),[o,s]=K([]);H(()=>{i!==void 0&&r>=i&&a(void 0)},[r,i]);let c=i??r,l=e.episodeCount,u=CT(e),d=ag(Q.MEDIA,{uri:e.uri,name:e.summary.title}),f=e.summary.title??e.uri,p=e.summary.score,m=sq(e,yd.read().targets,c);return/* @__PURE__ */ W(`div`,{className:`item`,children:[/* @__PURE__ */ V(Uh,{to:d,className:`cover`,tabIndex:-1,children:e.summary.cover?/* @__PURE__ */ V(`img`,{src:e.summary.cover,alt:``,loading:`lazy`}):void 0}),/* @__PURE__ */ V(Uh,{to:d,className:`title`,children:f}),/* @__PURE__ */ W(`div`,{className:`facts`,children:[u?void 0:/* @__PURE__ */ W(`span`,{className:`progress`,children:[/* @__PURE__ */ V(`span`,{children:c}),l==null?void 0:/* @__PURE__ */ V(`span`,{children:t.formatMessage({id:`/ {total}`,defaultMessage:`/ {total}`},{total:l})})]}),p==null?void 0:/* @__PURE__ */ W(`span`,{className:`score`,children:[/* @__PURE__ */ V(yx,{size:12,"aria-hidden":`true`}),t.formatNumber(p/10,{maximumFractionDigits:1})]}),e.type?/* @__PURE__ */ V(`span`,{children:e_(e.type)}):void 0,e.disagreements.length?/* @__PURE__ */ V(`span`,{className:`differs`,role:`img`,title:pq(t,e),"aria-label":pq(t,e)}):void 0,!u&&oq(e,c)?/* @__PURE__ */ V(`button`,{type:`button`,className:`more`,"aria-label":t.formatMessage({id:`One episode more`,defaultMessage:`One episode more`}),disabled:i!==void 0||!Object.keys(m).length,onClick:async()=>{a(c+1),s([]);let t=(await Promise.all(mq(m).map(async({fields:e,trackers:t})=>{let r=await n(t,e);return t.map(e=>({outcome:`FAILED`,...r.find(t=>t.tracker===e||!t.tracker),tracker:e}))}))).flat().filter(({outcome:e})=>e!==`SAVED`&&e!==`QUEUED`);t.length&&(a(void 0),s(t.map(t=>({...t,name:e.answers.find(e=>e.tracker.id===t.tracker)?.tracker.name??t.tracker}))))},children:/* @__PURE__ */ V(fx,{size:14,"aria-hidden":`true`})}):void 0]}),l&&!u?/* @__PURE__ */ V(`div`,{className:`bar`,children:/* @__PURE__ */ V(`span`,{style:{width:`${Math.min(100,c/l*100)}%`}})}):void 0,o.map(({name:e,outcome:n,error:r})=>/* @__PURE__ */ V(`div`,{className:`missed`,children:r?t.formatMessage({id:`{name} did not save: {error}`,defaultMessage:`{name} did not save: {error}`},{name:e,error:On(r)}):t.formatMessage({id:`{name} did not save: {outcome, select, REFUSED {refused} other {failed}}`,defaultMessage:`{name} did not save: {outcome, select, REFUSED {refused} other {failed}}`},{name:e,outcome:n})},e))]})},gq=()=>{let e=L(),[{data:t}]=Zs({query:FD}),[n,r]=K(`WATCHING`),[i,a]=K(``),[o,s]=K(`updated`),[c,l]=K(`grid`),u=t?.viewerLists?.rows??[],d=t?.viewerLists?.lists??[],f=B(()=>nq(u),[u]),p=B(()=>aq(u,{tab:n,term:i,sort:o,locale:e.locale}),[u,n,i,o,e.locale]),m=!t||d.some(e=>e.state===`LOADING`),h=c===`list`?`rows`:`grid`,g=e.formatMessage({id:`My list`,defaultMessage:`My list`});return/* @__PURE__ */ W(`div`,{css:fq,children:[/* @__PURE__ */ W(`div`,{className:`heading-row`,children:[/* @__PURE__ */ V(`h1`,{className:`heading`,children:g}),/* @__PURE__ */ V(_G,{mode:c,modes:uq,onChange:l})]}),/* @__PURE__ */ V(`div`,{className:`tabs`,children:eq.map(t=>/* @__PURE__ */ W(`button`,{type:`button`,className:`tab`,"aria-pressed":n===t,onClick:()=>r(t),children:[/* @__PURE__ */ V(`span`,{children:e.formatMessage(cq[t])}),/* @__PURE__ */ V(`span`,{className:`count`,children:f[t]})]},t))}),/* @__PURE__ */ W(`div`,{className:`filters`,children:[/* @__PURE__ */ V(xG,{label:e.formatMessage({id:`Search`,defaultMessage:`Search`}),children:/* @__PURE__ */ W(`div`,{className:`text-field`,children:[/* @__PURE__ */ V(ht,{size:17}),/* @__PURE__ */ V(`input`,{type:`text`,value:i,placeholder:e.formatMessage({id:`Any title`,defaultMessage:`Any title`}),"aria-label":e.formatMessage({id:`Search by title`,defaultMessage:`Search by title`}),onInput:e=>a(e.currentTarget.value)})]})}),/* @__PURE__ */ V(bG,{label:e.formatMessage({id:`Sort by`,defaultMessage:`Sort by`}),options:rq.map(t=>({value:t,label:e.formatMessage(lq[t])})),selected:[o],onChange:([e])=>s(e??`updated`)})]}),d.filter(e=>e.state===`ERROR`||e.state===`PAUSED`).map(t=>/* @__PURE__ */ V(`div`,{className:`unread`,children:e.formatMessage({id:`Could not read the list on {name}`,defaultMessage:`Could not read the list on {name}`},{name:t.tracker.name})},t._id)),p.length?/* @__PURE__ */ V(jw,{items:p,size:dq,label:g,children:e=>/* @__PURE__ */ V(`div`,{className:h,children:e.map(e=>/* @__PURE__ */ V(hq,{row:e},e._id))})},`${n} ${o} ${i}`):m?/* @__PURE__ */ V(`div`,{className:h,children:Array.from({length:12},(e,t)=>/* @__PURE__ */ V(rw,{className:`pending`},t))}):/* @__PURE__ */ V(`div`,{className:`status`,children:e.formatMessage({id:`No results found.`,defaultMessage:`No results found.`})})]})},_q=R`
6443
+ `,hq=(e,t)=>{let n=(t,n)=>t===`STATUS`?n?.status?e.formatMessage(uq[n.status]):void 0:t===`PROGRESS`?n?.progress==null?void 0:e.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:n.progress}):n?.score==null?void 0:e.formatMessage({id:`{score, number} / {max, number}`,defaultMessage:`{score, number} / {max, number}`},{score:n.score/10,max:10});return t.disagreements.map(r=>e.formatList(t.answers.map(({tracker:{name:t},entry:i})=>{let a=n(r,i);return a===void 0?e.formatMessage({id:`{name} none`,defaultMessage:`{name} none`},{name:t}):e.formatMessage({id:`{name} {value}`,defaultMessage:`{name} {value}`},{name:t,value:a})}),Cn)).join(`
6444
+ `)},gq=e=>{let t=/* @__PURE__ */ new Map;for(let[n,r]of Object.entries(e)){let e=JSON.stringify(r);t.set(e,{fields:r,trackers:[...t.get(e)?.trackers??[],n]})}return[...t.values()]},_q=({row:e})=>{let t=L(),n=cT({uri:e.uri,title:e.summary.title,cover:e.summary.cover,episodeCount:e.episodeCount}),r=e.summary.progress??0,[i,a]=K(),[o,s]=K([]);H(()=>{i!==void 0&&r>=i&&a(void 0)},[r,i]);let c=i??r,l=e.episodeCount,u=CT(e),d=ag(Q.MEDIA,{uri:e.uri,name:e.summary.title}),f=e.summary.title??e.uri,p=e.summary.score,m=lq(e,yd.read().targets,c);return/* @__PURE__ */ W(`div`,{className:`item`,children:[/* @__PURE__ */ V(Uh,{to:d,className:`cover`,tabIndex:-1,children:e.summary.cover?/* @__PURE__ */ V(`img`,{src:e.summary.cover,alt:``,loading:`lazy`}):void 0}),/* @__PURE__ */ V(Uh,{to:d,className:`title`,children:f}),/* @__PURE__ */ W(`div`,{className:`facts`,children:[u?void 0:/* @__PURE__ */ W(`span`,{className:`progress`,children:[/* @__PURE__ */ V(`span`,{children:c}),l==null?void 0:/* @__PURE__ */ V(`span`,{children:t.formatMessage({id:`/ {total}`,defaultMessage:`/ {total}`},{total:l})})]}),p==null?void 0:/* @__PURE__ */ W(`span`,{className:`score`,children:[/* @__PURE__ */ V(yx,{size:12,"aria-hidden":`true`}),t.formatNumber(p/10,{maximumFractionDigits:1})]}),e.type?/* @__PURE__ */ V(`span`,{children:e_(e.type)}):void 0,e.disagreements.length?/* @__PURE__ */ V(`span`,{className:`differs`,role:`img`,title:hq(t,e),"aria-label":hq(t,e)}):void 0,!u&&cq(e,c)?/* @__PURE__ */ V(`button`,{type:`button`,className:`more`,"aria-label":t.formatMessage({id:`One episode more`,defaultMessage:`One episode more`}),disabled:i!==void 0||!Object.keys(m).length,onClick:async()=>{a(c+1),s([]);let t=(await Promise.all(gq(m).map(async({fields:e,trackers:t})=>{let r=await n(t,e);return t.map(e=>({outcome:`FAILED`,...r.find(t=>t.tracker===e||!t.tracker),tracker:e}))}))).flat().filter(({outcome:e})=>e!==`SAVED`&&e!==`QUEUED`);t.length&&(a(void 0),s(t.map(t=>({...t,name:e.answers.find(e=>e.tracker.id===t.tracker)?.tracker.name??t.tracker}))))},children:/* @__PURE__ */ V(fx,{size:14,"aria-hidden":`true`})}):void 0]}),l&&!u?/* @__PURE__ */ V(`div`,{className:`bar`,children:/* @__PURE__ */ V(`span`,{style:{width:`${Math.min(100,c/l*100)}%`}})}):void 0,o.map(({name:e,outcome:n,error:r})=>/* @__PURE__ */ V(`div`,{className:`missed`,children:r?t.formatMessage({id:`{name} did not save: {error}`,defaultMessage:`{name} did not save: {error}`},{name:e,error:On(r)}):t.formatMessage({id:`{name} did not save: {outcome, select, REFUSED {refused} other {failed}}`,defaultMessage:`{name} did not save: {outcome, select, REFUSED {refused} other {failed}}`},{name:e,outcome:n})},e))]})},vq=()=>{let e=L(),[{data:t}]=Zs({query:FD}),[n,r]=K(`WATCHING`),[i,a]=K(``),[o,s]=K(`updated`),[c,l]=K(`grid`),u=t?.viewerLists?.rows??[],d=t?.viewerLists?.lists??[],f=B(()=>iq(u),[u]),p=B(()=>sq(u,{tab:n,term:i,sort:o,locale:e.locale}),[u,n,i,o,e.locale]),m=!t||d.some(e=>e.state===`LOADING`),h=c===`list`?`rows`:`grid`,g=e.formatMessage({id:`My list`,defaultMessage:`My list`});return/* @__PURE__ */ W(`div`,{css:mq,children:[/* @__PURE__ */ W(`div`,{className:`heading-row`,children:[/* @__PURE__ */ V(`h1`,{className:`heading`,children:g}),/* @__PURE__ */ V(yG,{mode:c,modes:fq,onChange:l})]}),/* @__PURE__ */ V(`div`,{className:`tabs`,children:nq.map(t=>/* @__PURE__ */ W(`button`,{type:`button`,className:`tab`,"aria-pressed":n===t,onClick:()=>r(t),children:[/* @__PURE__ */ V(`span`,{children:e.formatMessage(uq[t])}),/* @__PURE__ */ V(`span`,{className:`count`,children:f[t]})]},t))}),/* @__PURE__ */ W(`div`,{className:`filters`,children:[/* @__PURE__ */ V(CG,{label:e.formatMessage({id:`Search`,defaultMessage:`Search`}),children:/* @__PURE__ */ W(`div`,{className:`text-field`,children:[/* @__PURE__ */ V(ht,{size:17}),/* @__PURE__ */ V(`input`,{type:`text`,value:i,placeholder:e.formatMessage({id:`Any title`,defaultMessage:`Any title`}),"aria-label":e.formatMessage({id:`Search by title`,defaultMessage:`Search by title`}),onInput:e=>a(e.currentTarget.value)})]})}),/* @__PURE__ */ V(SG,{label:e.formatMessage({id:`Sort by`,defaultMessage:`Sort by`}),options:aq.map(t=>({value:t,label:e.formatMessage(dq[t])})),selected:[o],onChange:([e])=>s(e??`updated`)})]}),d.filter(e=>e.state===`ERROR`||e.state===`PAUSED`).map(t=>/* @__PURE__ */ V(`div`,{className:`unread`,children:e.formatMessage({id:`Could not read the list on {name}`,defaultMessage:`Could not read the list on {name}`},{name:t.tracker.name})},t._id)),p.length?/* @__PURE__ */ V(jw,{items:p,size:pq,label:g,children:e=>/* @__PURE__ */ V(`div`,{className:h,children:e.map(e=>/* @__PURE__ */ V(_q,{row:e},e._id))})},`${n} ${o} ${i}`):m?/* @__PURE__ */ V(`div`,{className:h,children:Array.from({length:12},(e,t)=>/* @__PURE__ */ V(rw,{className:`pending`},t))}):/* @__PURE__ */ V(`div`,{className:`status`,children:e.formatMessage({id:`No results found.`,defaultMessage:`No results found.`})})]})},yq=R`
6441
6445
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
6442
6446
  min-height: 100vh;
6443
6447
 
@@ -6475,7 +6479,7 @@ scrollbar-gutter: stable;
6475
6479
 
6476
6480
  .grid > * { width: 100%; }
6477
6481
  }
6478
- `,vq=()=>{let e=L(),{episodes:t,asks:n,reading:r}=ZD();return/* @__PURE__ */ W(`div`,{css:_q,children:[n,/* @__PURE__ */ V(`h1`,{className:`heading`,children:e.formatMessage({id:`Continue watching`,defaultMessage:`Continue watching`})}),t.length?/* @__PURE__ */ V(`div`,{className:`grid`,children:t.map(e=>/* @__PURE__ */ V(QD,{episode:e},e.work._id))}):r?void 0:/* @__PURE__ */ V(`div`,{className:`status`,children:e.formatMessage({id:`No new episodes`,defaultMessage:`No new episodes`})})]})},yq=(()=>{let e=/* @__PURE__ */ new Map,t=/* @__PURE__ */ new Set;return{record:(n,r)=>{e.set(n,r),r===`signed-in`&&t.add(n)},free:(t,n)=>n===`none`||e.get(t)===`signed-in`,neverSignedIn:(n,r)=>r!==`none`&&e.get(n)!==`signed-in`&&(e.get(n)===`no-plan`||!t.has(n))}})();U();var bq=R`
6482
+ `,bq=()=>{let e=L(),{episodes:t,asks:n,reading:r}=ZD();return/* @__PURE__ */ W(`div`,{css:yq,children:[n,/* @__PURE__ */ V(`h1`,{className:`heading`,children:e.formatMessage({id:`Continue watching`,defaultMessage:`Continue watching`})}),t.length?/* @__PURE__ */ V(`div`,{className:`grid`,children:t.map(e=>/* @__PURE__ */ V(QD,{episode:e},e.work._id))}):r?void 0:/* @__PURE__ */ V(`div`,{className:`status`,children:e.formatMessage({id:`No new episodes`,defaultMessage:`No new episodes`})})]})},xq=(()=>{let e=/* @__PURE__ */ new Map,t=/* @__PURE__ */ new Set;return{record:(n,r)=>{e.set(n,r),r===`signed-in`&&t.add(n)},free:(t,n)=>n===`none`||e.get(t)===`signed-in`,neverSignedIn:(n,r)=>r!==`none`&&e.get(n)!==`signed-in`&&(e.get(n)===`no-plan`||!t.has(n))}})();U();var Sq=R`
6479
6483
  position: absolute;
6480
6484
  inset: 0;
6481
6485
  display: flex;
@@ -6711,7 +6715,7 @@ scrollbar-gutter: stable;
6711
6715
  text-overflow: ellipsis;
6712
6716
  white-space: nowrap;
6713
6717
  }
6714
- `,xq=({source:e})=>{let[t,n]=K(!1);return/* @__PURE__ */ V(`span`,{className:`icon`,children:e.icon&&!t?/* @__PURE__ */ V(`img`,{src:e.icon,alt:``,onError:()=>n(!0)}):e.name.charAt(0)})},Sq=({sources:e,onSelectHref:t,onOpenPicker:n,onClose:r})=>{let i=L(),[a,o]=K({}),s=G(null),c=G(r);c.current=r,ct(()=>{let e=document.activeElement;window.focus?.(),s.current?.focus?.();let t=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),c.current())};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t),e?.focus?.()}},[]);let l=i.formatMessage({id:`Switch source`,defaultMessage:`Switch source`}),u=t=>a[t.id]??!!(t.active||e.length===1);return/* @__PURE__ */ V(`div`,{css:bq,role:`dialog`,"aria-modal":`true`,"aria-label":l,onClick:e=>{e.target===e.currentTarget&&r()},children:/* @__PURE__ */ W(`div`,{className:`panel`,children:[/* @__PURE__ */ W(`div`,{className:`header`,children:[/* @__PURE__ */ V(`span`,{className:`title`,children:l}),/* @__PURE__ */ V(`span`,{className:`spacer`}),/* @__PURE__ */ V(`button`,{type:`button`,ref:s,className:`close`,"aria-label":i.formatMessage({id:`Close`,defaultMessage:`Close`}),onClick:r,children:/* @__PURE__ */ V(Cx,{size:16,"aria-hidden":`true`})})]}),/* @__PURE__ */ V(`div`,{className:`list`,children:e.map(e=>{let a=Hw(e),s=e.videoQualities?.at(0);if(e.releases&&e.releases.length>1){let s=u(e);return/* @__PURE__ */ W(`div`,{className:`group`,style:{"--brand":a},children:[/* @__PURE__ */ W(`div`,{className:`head-row`,children:[/* @__PURE__ */ W(`button`,{type:`button`,className:`item${e.active?` active`:``}`,"aria-expanded":s,"aria-current":e.active?`true`:void 0,onClick:()=>o(t=>({...t,[e.id]:!s})),children:[/* @__PURE__ */ V(xq,{source:e}),/* @__PURE__ */ V(`span`,{className:`name`,children:e.name}),/* @__PURE__ */ V(`span`,{className:`tag`,children:e.releases.length}),/* @__PURE__ */ V(`span`,{className:`trailing`,children:s?/* @__PURE__ */ V(Wb,{size:14,"aria-hidden":`true`}):/* @__PURE__ */ V(Ft,{size:14,className:`chevron`,"aria-hidden":`true`})})]}),e.picker?/* @__PURE__ */ W(`button`,{type:`button`,className:`picker-btn`,"aria-label":i.formatMessage({id:`Choose a source from {name}`,defaultMessage:`Choose a source from {name}`},{name:e.name}),onClick:()=>n(e),children:[/* @__PURE__ */ V(Ct,{size:13,"aria-hidden":`true`}),/* @__PURE__ */ V(`span`,{children:i.formatMessage({id:`Release picker`,defaultMessage:`Release picker`})})]}):null]}),s?/* @__PURE__ */ V(`div`,{className:`releases`,children:e.releases.map(e=>{let n=/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`span`,{className:`release-label`,children:e.label}),/* @__PURE__ */ V(`span`,{className:`trailing`,children:e.external||!e.href?/* @__PURE__ */ V(Zb,{size:12,"aria-hidden":`true`}):/* @__PURE__ */ V(pt,{size:12,"aria-hidden":`true`})})]});return!e.external&&e.href?/* @__PURE__ */ V(`button`,{type:`button`,className:`release${e.active?` active`:``}`,"aria-current":e.active?`true`:void 0,title:e.label,onClick:()=>t(e.href),children:n},e.uri):/* @__PURE__ */ V(`a`,{className:`release${e.active?` active`:``}`,"aria-current":e.active?`true`:void 0,href:e.href,target:`_blank`,rel:`noreferrer`,title:e.label,onClick:r,children:n},e.uri)})}):null]},e.id)}let c=/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(xq,{source:e}),/* @__PURE__ */ V(`span`,{className:`name`,children:e.name}),s?/* @__PURE__ */ V(`span`,{className:`tag`,children:s}):null,/* @__PURE__ */ V(`span`,{className:`trailing`,children:e.external||!e.href?/* @__PURE__ */ V(Zb,{size:12,"aria-hidden":`true`}):/* @__PURE__ */ V(pt,{size:12,"aria-hidden":`true`})})]});return!e.external&&e.href?/* @__PURE__ */ V(`button`,{type:`button`,className:`item${e.active?` active`:``}`,"aria-current":e.active?`true`:void 0,style:{"--brand":a},title:e.name,onClick:()=>t(e.href),children:c},e.id):/* @__PURE__ */ V(`a`,{className:`item${e.active?` active`:``}`,"aria-current":e.active?`true`:void 0,style:{"--brand":a},href:e.href,target:`_blank`,rel:`noreferrer`,title:e.name,onClick:r,children:c},e.id)})})]})})},Cq={pob:`pt-BR`,spl:`es-419`,zho:`zh-Hans`,chi:`zh-Hans`,zh:`zh-Hans`,"zh-cn":`zh-Hans`,"zh-sg":`zh-Hans`,chs:`zh-Hans`,sc:`zh-Hans`,简体:`zh-Hans`,简中:`zh-Hans`,双语:`zh-Hans`,默认:`zh-Hans`,zht:`zh-Hant`,cht:`zh-Hant`,tc:`zh-Hant`,"zh-tw":`zh-Hant`,"zh-hk":`zh-Hant`,繁体:`zh-Hant`,繁中:`zh-Hant`,英文:`en`,日文:`ja`,韩文:`ko`};function wq(e){if(!e)return`und`;let t=e.trim();if(!t)return`und`;let n=Cq[t.toLowerCase()]??Cq[t];if(n)return n;let i=r(t);return!i||i===`und`?`und`:i===`zh`?`zh-Hans`:i}function Tq(e,t){let n=t.indexOf(e);if(n!==-1)return n*2;let r=e.split(`-`)[0],i=t.findIndex(e=>e.split(`-`)[0]===r);return i===-1?t.length*2:i*2+1}function Eq(e,t=`en`){let n=wq(e);if(n===`und`)return`Unknown`;try{let e=new Intl.DisplayNames([t],{type:`language`,fallback:`none`}).of(n);if(e)return e}catch{}return n.toUpperCase()}U();var Dq=R`
6718
+ `,Cq=({source:e})=>{let[t,n]=K(!1);return/* @__PURE__ */ V(`span`,{className:`icon`,children:e.icon&&!t?/* @__PURE__ */ V(`img`,{src:e.icon,alt:``,onError:()=>n(!0)}):e.name.charAt(0)})},wq=({sources:e,onSelectHref:t,onOpenPicker:n,onClose:r})=>{let i=L(),[a,o]=K({}),s=G(null),c=G(r);c.current=r,ct(()=>{let e=document.activeElement;window.focus?.(),s.current?.focus?.();let t=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),c.current())};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t),e?.focus?.()}},[]);let l=i.formatMessage({id:`Switch source`,defaultMessage:`Switch source`}),u=t=>a[t.id]??!!(t.active||e.length===1);return/* @__PURE__ */ V(`div`,{css:Sq,role:`dialog`,"aria-modal":`true`,"aria-label":l,onClick:e=>{e.target===e.currentTarget&&r()},children:/* @__PURE__ */ W(`div`,{className:`panel`,children:[/* @__PURE__ */ W(`div`,{className:`header`,children:[/* @__PURE__ */ V(`span`,{className:`title`,children:l}),/* @__PURE__ */ V(`span`,{className:`spacer`}),/* @__PURE__ */ V(`button`,{type:`button`,ref:s,className:`close`,"aria-label":i.formatMessage({id:`Close`,defaultMessage:`Close`}),onClick:r,children:/* @__PURE__ */ V(Cx,{size:16,"aria-hidden":`true`})})]}),/* @__PURE__ */ V(`div`,{className:`list`,children:e.map(e=>{let a=Hw(e),s=e.videoQualities?.at(0);if(e.releases&&e.releases.length>1){let s=u(e);return/* @__PURE__ */ W(`div`,{className:`group`,style:{"--brand":a},children:[/* @__PURE__ */ W(`div`,{className:`head-row`,children:[/* @__PURE__ */ W(`button`,{type:`button`,className:`item${e.active?` active`:``}`,"aria-expanded":s,"aria-current":e.active?`true`:void 0,onClick:()=>o(t=>({...t,[e.id]:!s})),children:[/* @__PURE__ */ V(Cq,{source:e}),/* @__PURE__ */ V(`span`,{className:`name`,children:e.name}),/* @__PURE__ */ V(`span`,{className:`tag`,children:e.releases.length}),/* @__PURE__ */ V(`span`,{className:`trailing`,children:s?/* @__PURE__ */ V(Wb,{size:14,"aria-hidden":`true`}):/* @__PURE__ */ V(Ft,{size:14,className:`chevron`,"aria-hidden":`true`})})]}),e.picker?/* @__PURE__ */ W(`button`,{type:`button`,className:`picker-btn`,"aria-label":i.formatMessage({id:`Choose a source from {name}`,defaultMessage:`Choose a source from {name}`},{name:e.name}),onClick:()=>n(e),children:[/* @__PURE__ */ V(Ct,{size:13,"aria-hidden":`true`}),/* @__PURE__ */ V(`span`,{children:i.formatMessage({id:`Release picker`,defaultMessage:`Release picker`})})]}):null]}),s?/* @__PURE__ */ V(`div`,{className:`releases`,children:e.releases.map(e=>{let n=/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`span`,{className:`release-label`,children:e.label}),/* @__PURE__ */ V(`span`,{className:`trailing`,children:e.external||!e.href?/* @__PURE__ */ V(Zb,{size:12,"aria-hidden":`true`}):/* @__PURE__ */ V(pt,{size:12,"aria-hidden":`true`})})]});return!e.external&&e.href?/* @__PURE__ */ V(`button`,{type:`button`,className:`release${e.active?` active`:``}`,"aria-current":e.active?`true`:void 0,title:e.label,onClick:()=>t(e.href),children:n},e.uri):/* @__PURE__ */ V(`a`,{className:`release${e.active?` active`:``}`,"aria-current":e.active?`true`:void 0,href:e.href,target:`_blank`,rel:`noreferrer`,title:e.label,onClick:r,children:n},e.uri)})}):null]},e.id)}let c=/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(Cq,{source:e}),/* @__PURE__ */ V(`span`,{className:`name`,children:e.name}),s?/* @__PURE__ */ V(`span`,{className:`tag`,children:s}):null,/* @__PURE__ */ V(`span`,{className:`trailing`,children:e.external||!e.href?/* @__PURE__ */ V(Zb,{size:12,"aria-hidden":`true`}):/* @__PURE__ */ V(pt,{size:12,"aria-hidden":`true`})})]});return!e.external&&e.href?/* @__PURE__ */ V(`button`,{type:`button`,className:`item${e.active?` active`:``}`,"aria-current":e.active?`true`:void 0,style:{"--brand":a},title:e.name,onClick:()=>t(e.href),children:c},e.id):/* @__PURE__ */ V(`a`,{className:`item${e.active?` active`:``}`,"aria-current":e.active?`true`:void 0,style:{"--brand":a},href:e.href,target:`_blank`,rel:`noreferrer`,title:e.name,onClick:r,children:c},e.id)})})]})})},Tq={pob:`pt-BR`,spl:`es-419`,zho:`zh-Hans`,chi:`zh-Hans`,zh:`zh-Hans`,"zh-cn":`zh-Hans`,"zh-sg":`zh-Hans`,chs:`zh-Hans`,sc:`zh-Hans`,简体:`zh-Hans`,简中:`zh-Hans`,双语:`zh-Hans`,默认:`zh-Hans`,zht:`zh-Hant`,cht:`zh-Hant`,tc:`zh-Hant`,"zh-tw":`zh-Hant`,"zh-hk":`zh-Hant`,繁体:`zh-Hant`,繁中:`zh-Hant`,英文:`en`,日文:`ja`,韩文:`ko`};function Eq(e){if(!e)return`und`;let t=e.trim();if(!t)return`und`;let n=Tq[t.toLowerCase()]??Tq[t];if(n)return n;let i=r(t);return!i||i===`und`?`und`:i===`zh`?`zh-Hans`:i}function Dq(e,t){let n=t.indexOf(e);if(n!==-1)return n*2;let r=e.split(`-`)[0],i=t.findIndex(e=>e.split(`-`)[0]===r);return i===-1?t.length*2:i*2+1}function Oq(e,t=`en`){let n=Eq(e);if(n===`und`)return`Unknown`;try{let e=new Intl.DisplayNames([t],{type:`language`,fallback:`none`}).of(n);if(e)return e}catch{}return n.toUpperCase()}U();var kq=R`
6715
6719
  position: absolute;
6716
6720
  inset: 0;
6717
6721
  display: flex;
@@ -6960,7 +6964,7 @@ scrollbar-gutter: stable;
6960
6964
  align-items: center;
6961
6965
  color: rgba(255, 255, 255, 0.65);
6962
6966
  }
6963
- `,Oq=e=>e.pluginOrigin?`plugin:${e.pluginOrigin}`:e.source,kq=e=>e.sourceName?e.sourceName:e.source===`opensubtitles`?`OpenSubtitles`:e.source===`xunlei`?`Xunlei`:e.pluginOrigin??`Plugin`,Aq=`HI`,jq=`button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])`,Mq=({initialQuery:e=``,locale:t,activeId:n,pluginPickers:r,search:i,onPick:a,onOpenPluginPicker:o,onClose:s})=>{let c=L(),[l,u]=K(e),[d,f]=K(e),[p,m]=K([]),[h,g]=K(!0),[_,v]=K(``),[y,b]=K(``),x=G(null),S=G(null),C=G(i);C.current=i;let w=G(s);w.current=s,ct(()=>{let e=document.activeElement;window.focus?.(),S.current?.focus?.();let t=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),w.current();return}if(e.key!==`Tab`)return;let t=x.current;if(!t)return;let n=[...t.querySelectorAll(jq)].filter(e=>e.getAttribute(`aria-disabled`)!==`true`);if(!n.length){e.preventDefault();return}let r=n[0],i=n[n.length-1],a=document.activeElement;t.contains(a)?e.shiftKey&&a===r?(e.preventDefault(),i.focus?.()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus?.()):(e.preventDefault(),(e.shiftKey?i:r).focus?.())};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t),e?.focus?.()}},[]),H(()=>{let e=setTimeout(()=>f(l),250);return()=>clearTimeout(e)},[l]),H(()=>{let e=new AbortController,t=!0;return g(!0),C.current(d,e.signal).then(n=>{t&&!e.signal.aborted&&(m(n),g(!1))}).catch(()=>{t&&!e.signal.aborted&&(m([]),g(!1))}),()=>{t=!1,e.abort()}},[d]);let T=B(()=>{let e=/* @__PURE__ */ new Map;for(let n of p)e.has(n.language)||e.set(n.language,Eq(n.language,t));return[...e.entries()].map(([e,t])=>({code:e,label:t}))},[p,t]),E=B(()=>{let e=/* @__PURE__ */ new Map;for(let t of p){let n=Oq(t);e.has(n)||e.set(n,kq(t))}return[...e.entries()].map(([e,t])=>({key:e,label:t}))},[p]),D=T.some(e=>e.code===_)?_:``,O=E.some(e=>e.key===y)?y:``,k=B(()=>p.filter(e=>(!D||e.language===D)&&(!O||Oq(e)===O)),[p,D,O]),A=c.formatMessage({id:`Subtitles`,defaultMessage:`Subtitles`}),j=c.formatMessage({id:`Search subtitles`,defaultMessage:`Search subtitles`}),M=c.formatMessage({id:`All languages`,defaultMessage:`All languages`}),N=c.formatMessage({id:`All sources`,defaultMessage:`All sources`});return/* @__PURE__ */ V(`div`,{css:Dq,role:`dialog`,"aria-modal":`true`,"aria-label":A,onClick:e=>{e.target===e.currentTarget&&s()},children:/* @__PURE__ */ W(`div`,{ref:x,className:`panel`,onKeyDown:e=>{e.key!==`Escape`&&e.key!==`Tab`&&e.stopPropagation()},children:[/* @__PURE__ */ W(`div`,{className:`header`,children:[/* @__PURE__ */ V(`span`,{className:`title`,children:A}),/* @__PURE__ */ V(`span`,{className:`spacer`}),/* @__PURE__ */ V(`button`,{type:`button`,className:`close`,"aria-label":c.formatMessage({id:`Close`,defaultMessage:`Close`}),onClick:s,children:/* @__PURE__ */ V(Cx,{size:16,"aria-hidden":`true`})})]}),/* @__PURE__ */ W(`div`,{className:`toolbar`,children:[/* @__PURE__ */ V(`form`,{className:`search-form`,onSubmit:e=>{e.preventDefault(),f(l)},children:/* @__PURE__ */ W(`label`,{className:`search-box`,children:[/* @__PURE__ */ V(ht,{size:14,"aria-hidden":`true`}),/* @__PURE__ */ V(`input`,{ref:S,type:`search`,className:`search-input`,"aria-label":j,placeholder:j,value:l,onInput:e=>u(e.target.value)})]})}),/* @__PURE__ */ W(`div`,{className:`filters`,children:[/* @__PURE__ */ W(`select`,{className:`select`,"aria-label":M,value:D,onChange:e=>v(e.target.value),children:[/* @__PURE__ */ V(`option`,{value:``,children:M}),T.map(e=>/* @__PURE__ */ V(`option`,{value:e.code,children:e.label},e.code))]}),/* @__PURE__ */ W(`select`,{className:`select`,"aria-label":N,value:O,onChange:e=>b(e.target.value),children:[/* @__PURE__ */ V(`option`,{value:``,children:N}),E.map(e=>/* @__PURE__ */ V(`option`,{value:e.key,children:e.label},e.key))]})]})]}),r.length>0?/* @__PURE__ */ V(`div`,{className:`pickers`,children:r.map(e=>/* @__PURE__ */ W(`button`,{type:`button`,className:`picker-btn`,onClick:()=>o(e),children:[/* @__PURE__ */ V(Ct,{size:13,"aria-hidden":`true`}),/* @__PURE__ */ V(`span`,{children:c.formatMessage({id:`Choose subtitles from {name}`,defaultMessage:`Choose subtitles from {name}`},{name:e.name})})]},e.origin))}):null,/* @__PURE__ */ V(`div`,{className:`list`,children:h?/* @__PURE__ */ V(`div`,{className:`empty`,children:c.formatMessage({id:`Loading`,defaultMessage:`Loading`})}):k.length===0?/* @__PURE__ */ V(`div`,{className:`empty`,children:c.formatMessage({id:`No subtitles found.`,defaultMessage:`No subtitles found.`})}):k.map(e=>{let r=e.id===n,i=e.release||e.label;return/* @__PURE__ */ W(`button`,{type:`button`,className:`item${r?` active`:``}`,title:i,"aria-pressed":r||void 0,onClick:()=>a(e),children:[/* @__PURE__ */ W(`div`,{className:`item-main`,children:[/* @__PURE__ */ V(`span`,{className:`item-title`,children:i}),/* @__PURE__ */ W(`span`,{className:`item-meta`,children:[/* @__PURE__ */ V(`span`,{children:Eq(e.language,t)}),/* @__PURE__ */ V(`span`,{className:`badge`,children:e.format}),/* @__PURE__ */ V(`span`,{children:kq(e)}),e.group?/* @__PURE__ */ V(`span`,{children:e.group}):null,e.hearingImpaired?/* @__PURE__ */ V(`span`,{className:`badge`,children:Aq}):null]})]}),/* @__PURE__ */ V(`span`,{className:`trailing`,children:V(r?Nt:Ze,{size:14,"aria-hidden":`true`})})]},e.id)})})]})})};U();var Nq=R`
6967
+ `,Aq=e=>e.pluginOrigin?`plugin:${e.pluginOrigin}`:e.source,jq=e=>e.sourceName?e.sourceName:e.source===`opensubtitles`?`OpenSubtitles`:e.source===`xunlei`?`Xunlei`:e.pluginOrigin??`Plugin`,Mq=`HI`,Nq=`button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])`,Pq=({initialQuery:e=``,locale:t,activeId:n,pluginPickers:r,search:i,onPick:a,onOpenPluginPicker:o,onClose:s})=>{let c=L(),[l,u]=K(e),[d,f]=K(e),[p,m]=K([]),[h,g]=K(!0),[_,v]=K(``),[y,b]=K(``),x=G(null),S=G(null),C=G(i);C.current=i;let w=G(s);w.current=s,ct(()=>{let e=document.activeElement;window.focus?.(),S.current?.focus?.();let t=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),w.current();return}if(e.key!==`Tab`)return;let t=x.current;if(!t)return;let n=[...t.querySelectorAll(Nq)].filter(e=>e.getAttribute(`aria-disabled`)!==`true`);if(!n.length){e.preventDefault();return}let r=n[0],i=n[n.length-1],a=document.activeElement;t.contains(a)?e.shiftKey&&a===r?(e.preventDefault(),i.focus?.()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus?.()):(e.preventDefault(),(e.shiftKey?i:r).focus?.())};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t),e?.focus?.()}},[]),H(()=>{let e=setTimeout(()=>f(l),250);return()=>clearTimeout(e)},[l]),H(()=>{let e=new AbortController,t=!0;return g(!0),C.current(d,e.signal).then(n=>{t&&!e.signal.aborted&&(m(n),g(!1))}).catch(()=>{t&&!e.signal.aborted&&(m([]),g(!1))}),()=>{t=!1,e.abort()}},[d]);let T=B(()=>{let e=/* @__PURE__ */ new Map;for(let n of p)e.has(n.language)||e.set(n.language,Oq(n.language,t));return[...e.entries()].map(([e,t])=>({code:e,label:t}))},[p,t]),E=B(()=>{let e=/* @__PURE__ */ new Map;for(let t of p){let n=Aq(t);e.has(n)||e.set(n,jq(t))}return[...e.entries()].map(([e,t])=>({key:e,label:t}))},[p]),D=T.some(e=>e.code===_)?_:``,O=E.some(e=>e.key===y)?y:``,k=B(()=>p.filter(e=>(!D||e.language===D)&&(!O||Aq(e)===O)),[p,D,O]),A=c.formatMessage({id:`Subtitles`,defaultMessage:`Subtitles`}),j=c.formatMessage({id:`Search subtitles`,defaultMessage:`Search subtitles`}),M=c.formatMessage({id:`All languages`,defaultMessage:`All languages`}),N=c.formatMessage({id:`All sources`,defaultMessage:`All sources`});return/* @__PURE__ */ V(`div`,{css:kq,role:`dialog`,"aria-modal":`true`,"aria-label":A,onClick:e=>{e.target===e.currentTarget&&s()},children:/* @__PURE__ */ W(`div`,{ref:x,className:`panel`,onKeyDown:e=>{e.key!==`Escape`&&e.key!==`Tab`&&e.stopPropagation()},children:[/* @__PURE__ */ W(`div`,{className:`header`,children:[/* @__PURE__ */ V(`span`,{className:`title`,children:A}),/* @__PURE__ */ V(`span`,{className:`spacer`}),/* @__PURE__ */ V(`button`,{type:`button`,className:`close`,"aria-label":c.formatMessage({id:`Close`,defaultMessage:`Close`}),onClick:s,children:/* @__PURE__ */ V(Cx,{size:16,"aria-hidden":`true`})})]}),/* @__PURE__ */ W(`div`,{className:`toolbar`,children:[/* @__PURE__ */ V(`form`,{className:`search-form`,onSubmit:e=>{e.preventDefault(),f(l)},children:/* @__PURE__ */ W(`label`,{className:`search-box`,children:[/* @__PURE__ */ V(ht,{size:14,"aria-hidden":`true`}),/* @__PURE__ */ V(`input`,{ref:S,type:`search`,className:`search-input`,"aria-label":j,placeholder:j,value:l,onInput:e=>u(e.target.value)})]})}),/* @__PURE__ */ W(`div`,{className:`filters`,children:[/* @__PURE__ */ W(`select`,{className:`select`,"aria-label":M,value:D,onChange:e=>v(e.target.value),children:[/* @__PURE__ */ V(`option`,{value:``,children:M}),T.map(e=>/* @__PURE__ */ V(`option`,{value:e.code,children:e.label},e.code))]}),/* @__PURE__ */ W(`select`,{className:`select`,"aria-label":N,value:O,onChange:e=>b(e.target.value),children:[/* @__PURE__ */ V(`option`,{value:``,children:N}),E.map(e=>/* @__PURE__ */ V(`option`,{value:e.key,children:e.label},e.key))]})]})]}),r.length>0?/* @__PURE__ */ V(`div`,{className:`pickers`,children:r.map(e=>/* @__PURE__ */ W(`button`,{type:`button`,className:`picker-btn`,onClick:()=>o(e),children:[/* @__PURE__ */ V(Ct,{size:13,"aria-hidden":`true`}),/* @__PURE__ */ V(`span`,{children:c.formatMessage({id:`Choose subtitles from {name}`,defaultMessage:`Choose subtitles from {name}`},{name:e.name})})]},e.origin))}):null,/* @__PURE__ */ V(`div`,{className:`list`,children:h?/* @__PURE__ */ V(`div`,{className:`empty`,children:c.formatMessage({id:`Loading`,defaultMessage:`Loading`})}):k.length===0?/* @__PURE__ */ V(`div`,{className:`empty`,children:c.formatMessage({id:`No subtitles found.`,defaultMessage:`No subtitles found.`})}):k.map(e=>{let r=e.id===n,i=e.release||e.label;return/* @__PURE__ */ W(`button`,{type:`button`,className:`item${r?` active`:``}`,title:i,"aria-pressed":r||void 0,onClick:()=>a(e),children:[/* @__PURE__ */ W(`div`,{className:`item-main`,children:[/* @__PURE__ */ V(`span`,{className:`item-title`,children:i}),/* @__PURE__ */ W(`span`,{className:`item-meta`,children:[/* @__PURE__ */ V(`span`,{children:Oq(e.language,t)}),/* @__PURE__ */ V(`span`,{className:`badge`,children:e.format}),/* @__PURE__ */ V(`span`,{children:jq(e)}),e.group?/* @__PURE__ */ V(`span`,{children:e.group}):null,e.hearingImpaired?/* @__PURE__ */ V(`span`,{className:`badge`,children:Mq}):null]})]}),/* @__PURE__ */ V(`span`,{className:`trailing`,children:V(r?Nt:Ze,{size:14,"aria-hidden":`true`})})]},e.id)})})]})})};U();var Fq=R`
6964
6968
  position: fixed;
6965
6969
  inset: 0;
6966
6970
  z-index: ${Aa.sourcePopup};
@@ -7023,7 +7027,7 @@ scrollbar-gutter: stable;
7023
7027
  color: rgba(255, 255, 255, 0.55);
7024
7028
  font-size: 1.4rem;
7025
7029
  }
7026
- `,Pq=({pluginUri:e,origin:t,name:n,context:r,onPick:i,onClose:a})=>{let o=L(),s=G(null),[c,l]=K(!1),u=G({context:r,onPick:i,onClose:a});return u.current={context:r,onPick:i,onClose:a},H(()=>{let n=s.current;if(!n)return;let r=!1,i;return(async()=>{try{i=await Ae.show(e,{element:n})}catch(t){console.warn(`Source '${e}' could not open its subtitle picker:`,t),l(!0);return}let a=[];try{a=await tr(t,u.current.context)}catch(t){console.warn(`Source '${e}' subtitle picker failed:`,t)}r||(a.length>0?u.current.onPick(a):u.current.onClose())})(),()=>{r=!0,i?.hide(),Ae.hide(e,{element:n}).catch(()=>{})}},[e,t,r.episodeUri]),H(()=>{let e=e=>{e.key===`Escape`&&a()};return addEventListener(`keydown`,e),()=>removeEventListener(`keydown`,e)},[a]),/* @__PURE__ */ V(`div`,{css:Nq,role:`dialog`,"aria-modal":`true`,"aria-label":o.formatMessage({id:`Choose subtitles from {name}`,defaultMessage:`Choose subtitles from {name}`},{name:n}),onClick:a,children:/* @__PURE__ */ W(`div`,{className:`wrap`,onClick:e=>e.stopPropagation(),children:[/* @__PURE__ */ W(`div`,{className:`bar`,children:[/* @__PURE__ */ V(`span`,{children:n}),/* @__PURE__ */ V(`span`,{className:`spacer`}),/* @__PURE__ */ V(`button`,{type:`button`,className:`close`,onClick:a,children:o.formatMessage({id:`Close`,defaultMessage:`Close`})})]}),c?/* @__PURE__ */ V(`div`,{className:`fallback`,children:o.formatMessage({id:`This source could not open its picker.`,defaultMessage:`This source could not open its picker.`})}):/* @__PURE__ */ V(`div`,{className:`slot`,ref:s})]})})},Fq=e=>typeof e!=`number`||e===1/0?void 0:e>0?e:0,Iq=e=>typeof e==`number`&&Number.isFinite(e),Lq=e=>{if(!e||typeof e!=`object`)return;let{time:t,readyState:n,ranges:r}=e;if(!(!Iq(t)||t<0||!Iq(n)||!Number.isInteger(n)||n<0||n>4))return Array.isArray(r)&&r.every(e=>Array.isArray(e)&&e.length===2&&Iq(e[0])&&Iq(e[1])&&e[0]<=e[1])?{time:t,readyState:n,ranges:r}:void 0},Rq=e=>{if(!Array.isArray(e))return;let t=e.map(e=>{let{start:t,end:n,title:r}=e??{};return Iq(t)&&Iq(n)&&t>=0&&n>=t&&typeof r==`string`?{start:t,end:n,title:r}:void 0});return t.every(e=>e!==void 0)?t:void 0},zq=e=>{if(!e||typeof e!=`object`)return;let{audio:t,subtitles:n,alwaysSubtitles:r}=e;typeof t==`string`&&pe(t),(typeof n==`string`||n===null)&&ve(n),typeof r==`boolean`&&k(r)},Bq=1e3,Vq=(e,t)=>{let{onPlayback:n,applyPlayback:r,buffer:i,focus:a,offerEnding:o,prepare:s}=e;if(!n||!r)return;let c=/* @__PURE__ */ new Set,l=!1,u=!1,d,f,p=!0,m=!0,h,g,_,v,y=e=>{if(l||!Ci(e))return;zq(e.picked),typeof e.autoplayNext==`boolean`&&rn(e.autoplayNext),u=e.ended===!0,d=Fq(e.duration),f=Rq(e.chapters),p=e.endingOffered!==!1;let{paused:t,time:n,rate:r,at:i}=e,a=e.seeking===!0;if(g!==void 0&&(a||Math.abs(n-g)<=.5)&&(g=void 0),h={paused:t,time:n,rate:r,at:i,seeking:a,standing:a||Iq(e.readyState)&&e.readyState<3},!a)for(let e of c)e({paused:t,time:n,rate:r,at:i})},b=()=>{n(y).catch(()=>{})};b();let x=e=>{if(!h)return;let{paused:t,rate:n,seeking:r,standing:i}=h;return g===void 0?{paused:t,time:i?h.time:Pi(h,h.at,e).time,rate:n,seeking:r}:{paused:t,time:g,rate:n,seeking:!0}},S=(e,t)=>{t.seek!==void 0&&(g=t.seek),r({...e,exact:t}).catch(()=>{})};return{apply:e=>{r(e).catch(()=>{})},seek:e=>{!l&&h&&S({paused:h.paused,time:e,rate:h.rate,at:Date.now()},{seek:e})},play:()=>{!l&&h&&h.paused&&S({...h,paused:!1,at:Date.now()},{play:!0})},follow:(e,t)=>{let n=Date.now(),r=x(n);if(l||!r)return{};let{correction:i,follow:a}=ji(_,r,e,n,t);_=a,clearTimeout(v);let{catchUp:o}=a;return o&&(v=setTimeout(()=>{h&&Mi(h.rate,o.rate)&&S(Pi(e,n,Date.now()),{rate:e.rate})},o.until-n)),u&&i.seek===void 0?{}:(S(e,i),i)},onReport:e=>(c.add(e),b(),()=>{c.delete(e)}),ended:()=>u,duration:()=>d,chapters:()=>f,...a||t?{focus:()=>{l||(t?.blur(),t?.focus(),a&&(t?setTimeout(()=>{l||a().catch(()=>{})},0):a().catch(()=>{})))}}:{},...o?{offerEnding:e=>{l||e===p&&e===m||(m=e,o(e).catch(()=>{}))},endingOffered:()=>p}:{},...s?{prepare:e=>l?Promise.resolve(!1):Promise.resolve(s(e)).catch(()=>!1)}:{},...i?{buffer:()=>Promise.race([i().then(Lq,()=>void 0),new Promise(e=>setTimeout(e,Bq))])}:{},dispose:()=>{l=!0,clearTimeout(v),c.clear()}}},Hq=(e,t,n=window,r)=>{let{document:i}=n,{onFullscreenRequest:a,applyFullscreen:o,focus:s}=e;if(!i.fullscreenEnabled||!a||!o)return()=>{};let c=!1,l=An(i,t,r,()=>{c||s?.().catch(()=>{})}),u=()=>{o(!!i.fullscreenElement).catch(()=>{})};return a(()=>{c||(i.fullscreenElement?i.exitFullscreen():t.requestFullscreen()).catch(()=>{})}).catch(()=>{}),i.addEventListener(`fullscreenchange`,u),u(),()=>{c=!0,l(),i.removeEventListener(`fullscreenchange`,u)}},Uq=e=>{let{applyAutoplay:t}=e;if(!t)return()=>{};let n=()=>{t(nn()).catch(()=>{})};return n(),Ht(n)},Wq=(e,t,n)=>{let{applyEpisodeNavigation:r,onEpisodeNavigation:i}=e;if(!r||!i)return()=>{};let a=!1,o=t.previous||!1,s=t.next||!1;return i(e=>{a||(e===`previous`&&o||e===`next`&&s)&&n(e)}).catch(()=>{}),r({previous:o,next:s}).catch(()=>{}),()=>{a=!0}},Gq=(e,t,n)=>{let{applySourceSwitch:r,onSourceSwitch:i}=e;if(!r||!i)return()=>{};let a=!1,o=t||!1;return i(()=>{!a&&o&&n()}).catch(()=>{}),r(o).catch(()=>{}),()=>{a=!0}},Kq=(e,t,n)=>{let{applyExternalSubtitles:r,onSubtitleLoadRequest:i,provideExternalSubtitle:a}=e;if(!r||!i||!a)return()=>{};let o=!1;return i(e=>{o||Promise.resolve().then(()=>n(e)).then(t=>{o||a(e,t).catch(()=>{})},t=>{o||a(e,null,t instanceof Error?t.message:String(t)).catch(()=>{})})}).catch(()=>{}),r(t).catch(()=>{}),()=>{o=!0}},qq=(e,t,n)=>{let{applyBrowseSubtitles:r,onBrowseSubtitles:i}=e;if(!r||!i)return()=>{};let a=!1,o=t||!1;return i(()=>{!a&&o&&n()}).catch(()=>{}),r(o).catch(()=>{}),()=>{a=!0}},Jq=3e3,Yq=(e,t)=>Promise.race([Promise.resolve().then(()=>e(t)).catch(()=>{}),new Promise(e=>setTimeout(e,Jq))]);U();var Xq=R`
7030
+ `,Iq=({pluginUri:e,origin:t,name:n,context:r,onPick:i,onClose:a})=>{let o=L(),s=G(null),[c,l]=K(!1),u=G({context:r,onPick:i,onClose:a});return u.current={context:r,onPick:i,onClose:a},H(()=>{let n=s.current;if(!n)return;let r=!1,i;return(async()=>{try{i=await Ae.show(e,{element:n})}catch(t){console.warn(`Source '${e}' could not open its subtitle picker:`,t),l(!0);return}let a=[];try{a=await tr(t,u.current.context)}catch(t){console.warn(`Source '${e}' subtitle picker failed:`,t)}r||(a.length>0?u.current.onPick(a):u.current.onClose())})(),()=>{r=!0,i?.hide(),Ae.hide(e,{element:n}).catch(()=>{})}},[e,t,r.episodeUri]),H(()=>{let e=e=>{e.key===`Escape`&&a()};return addEventListener(`keydown`,e),()=>removeEventListener(`keydown`,e)},[a]),/* @__PURE__ */ V(`div`,{css:Fq,role:`dialog`,"aria-modal":`true`,"aria-label":o.formatMessage({id:`Choose subtitles from {name}`,defaultMessage:`Choose subtitles from {name}`},{name:n}),onClick:a,children:/* @__PURE__ */ W(`div`,{className:`wrap`,onClick:e=>e.stopPropagation(),children:[/* @__PURE__ */ W(`div`,{className:`bar`,children:[/* @__PURE__ */ V(`span`,{children:n}),/* @__PURE__ */ V(`span`,{className:`spacer`}),/* @__PURE__ */ V(`button`,{type:`button`,className:`close`,onClick:a,children:o.formatMessage({id:`Close`,defaultMessage:`Close`})})]}),c?/* @__PURE__ */ V(`div`,{className:`fallback`,children:o.formatMessage({id:`This source could not open its picker.`,defaultMessage:`This source could not open its picker.`})}):/* @__PURE__ */ V(`div`,{className:`slot`,ref:s})]})})},Lq=e=>typeof e!=`number`||e===1/0?void 0:e>0?e:0,Rq=e=>typeof e==`number`&&Number.isFinite(e),zq=e=>{if(!e||typeof e!=`object`)return;let{time:t,readyState:n,ranges:r}=e;if(!(!Rq(t)||t<0||!Rq(n)||!Number.isInteger(n)||n<0||n>4))return Array.isArray(r)&&r.every(e=>Array.isArray(e)&&e.length===2&&Rq(e[0])&&Rq(e[1])&&e[0]<=e[1])?{time:t,readyState:n,ranges:r}:void 0},Bq=e=>{if(!Array.isArray(e))return;let t=e.map(e=>{let{start:t,end:n,title:r}=e??{};return Rq(t)&&Rq(n)&&t>=0&&n>=t&&typeof r==`string`?{start:t,end:n,title:r}:void 0});return t.every(e=>e!==void 0)?t:void 0},Vq=e=>{if(!e||typeof e!=`object`)return;let{audio:t,subtitles:n,alwaysSubtitles:r}=e;typeof t==`string`&&pe(t),(typeof n==`string`||n===null)&&ve(n),typeof r==`boolean`&&k(r)},Hq=1e3,Uq=(e,t)=>{let{onPlayback:n,applyPlayback:r,buffer:i,focus:a,offerEnding:o,prepare:s}=e;if(!n||!r)return;let c=/* @__PURE__ */ new Set,l=!1,u=!1,d,f,p=!0,m=!0,h,g,_,v,y=e=>{if(l||!Ci(e))return;Vq(e.picked),typeof e.autoplayNext==`boolean`&&rn(e.autoplayNext),u=e.ended===!0,d=Lq(e.duration),f=Bq(e.chapters),p=e.endingOffered!==!1;let{paused:t,time:n,rate:r,at:i}=e,a=e.seeking===!0;if(g!==void 0&&(a||Math.abs(n-g)<=.5)&&(g=void 0),h={paused:t,time:n,rate:r,at:i,seeking:a,standing:a||Rq(e.readyState)&&e.readyState<3},!a)for(let e of c)e({paused:t,time:n,rate:r,at:i})},b=()=>{n(y).catch(()=>{})};b();let x=e=>{if(!h)return;let{paused:t,rate:n,seeking:r,standing:i}=h;return g===void 0?{paused:t,time:i?h.time:Pi(h,h.at,e).time,rate:n,seeking:r}:{paused:t,time:g,rate:n,seeking:!0}},S=(e,t)=>{t.seek!==void 0&&(g=t.seek),r({...e,exact:t}).catch(()=>{})};return{apply:e=>{r(e).catch(()=>{})},seek:e=>{!l&&h&&S({paused:h.paused,time:e,rate:h.rate,at:Date.now()},{seek:e})},play:()=>{!l&&h&&h.paused&&S({...h,paused:!1,at:Date.now()},{play:!0})},follow:(e,t)=>{let n=Date.now(),r=x(n);if(l||!r)return{};let{correction:i,follow:a}=ji(_,r,e,n,t);_=a,clearTimeout(v);let{catchUp:o}=a;return o&&(v=setTimeout(()=>{h&&Mi(h.rate,o.rate)&&S(Pi(e,n,Date.now()),{rate:e.rate})},o.until-n)),u&&i.seek===void 0?{}:(S(e,i),i)},onReport:e=>(c.add(e),b(),()=>{c.delete(e)}),ended:()=>u,duration:()=>d,chapters:()=>f,...a||t?{focus:()=>{l||(t?.blur(),t?.focus(),a&&(t?setTimeout(()=>{l||a().catch(()=>{})},0):a().catch(()=>{})))}}:{},...o?{offerEnding:e=>{l||e===p&&e===m||(m=e,o(e).catch(()=>{}))},endingOffered:()=>p}:{},...s?{prepare:e=>l?Promise.resolve(!1):Promise.resolve(s(e)).catch(()=>!1)}:{},...i?{buffer:()=>Promise.race([i().then(zq,()=>void 0),new Promise(e=>setTimeout(e,Hq))])}:{},dispose:()=>{l=!0,clearTimeout(v),c.clear()}}},Wq=(e,t,n=window,r)=>{let{document:i}=n,{onFullscreenRequest:a,applyFullscreen:o,focus:s}=e;if(!i.fullscreenEnabled||!a||!o)return()=>{};let c=!1,l=An(i,t,r,()=>{c||s?.().catch(()=>{})}),u=()=>{o(!!i.fullscreenElement).catch(()=>{})};return a(()=>{c||(i.fullscreenElement?i.exitFullscreen():t.requestFullscreen()).catch(()=>{})}).catch(()=>{}),i.addEventListener(`fullscreenchange`,u),u(),()=>{c=!0,l(),i.removeEventListener(`fullscreenchange`,u)}},Gq=e=>{let{applyAutoplay:t}=e;if(!t)return()=>{};let n=()=>{t(nn()).catch(()=>{})};return n(),Ht(n)},Kq=(e,t,n)=>{let{applyEpisodeNavigation:r,onEpisodeNavigation:i}=e;if(!r||!i)return()=>{};let a=!1,o=t.previous||!1,s=t.next||!1;return i(e=>{a||(e===`previous`&&o||e===`next`&&s)&&n(e)}).catch(()=>{}),r({previous:o,next:s}).catch(()=>{}),()=>{a=!0}},qq=(e,t,n)=>{let{applySourceSwitch:r,onSourceSwitch:i}=e;if(!r||!i)return()=>{};let a=!1,o=t||!1;return i(()=>{!a&&o&&n()}).catch(()=>{}),r(o).catch(()=>{}),()=>{a=!0}},Jq=(e,t,n)=>{let{applyExternalSubtitles:r,onSubtitleLoadRequest:i,provideExternalSubtitle:a}=e;if(!r||!i||!a)return()=>{};let o=!1;return i(e=>{o||Promise.resolve().then(()=>n(e)).then(t=>{o||a(e,t).catch(()=>{})},t=>{o||a(e,null,t instanceof Error?t.message:String(t)).catch(()=>{})})}).catch(()=>{}),r(t).catch(()=>{}),()=>{o=!0}},Yq=(e,t,n)=>{let{applyBrowseSubtitles:r,onBrowseSubtitles:i}=e;if(!r||!i)return()=>{};let a=!1,o=t||!1;return i(()=>{!a&&o&&n()}).catch(()=>{}),r(o).catch(()=>{}),()=>{a=!0}},Xq=3e3,Zq=(e,t)=>Promise.race([Promise.resolve().then(()=>e(t)).catch(()=>{}),new Promise(e=>setTimeout(e,Xq))]);U();var Qq=R`
7027
7031
  position: relative;
7028
7032
  width: 100%;
7029
7033
  flex: 1;
@@ -7049,7 +7053,7 @@ scrollbar-gutter: stable;
7049
7053
  color: rgba(255, 255, 255, 0.55);
7050
7054
  font-size: 1.4rem;
7051
7055
  }
7052
- `,Zq=[],Qq=({pluginUri:e,release:t,onUnplayable:n,onPlayback:r,stage:i,episodeNavigation:a,sourceSwitch:o,browseSubtitles:s,externalSubtitles:c,externalSubtitleSelection:l})=>{let u=L(),d=G(null),[f,p]=K(!1),[m,h]=K(),g=G({onUnplayable:n,onPlayback:r,onStep:a?.onStep,onSourceSwitch:o?.onRequest,onBrowseSubtitles:s?.onRequest,loadSubtitle:c?.load});g.current={onUnplayable:n,onPlayback:r,onStep:a?.onStep,onSourceSwitch:o?.onRequest,onBrowseSubtitles:s?.onRequest,loadSubtitle:c?.load};let _=G(void 0);H(()=>{let n=d.current;if(!n)return;let r=!1,a,o,s;return p(!1),h(void 0),(async()=>{try{_.current??=Ae.mount(e,{iframe:n,protocol:Qs}).catch(e=>{throw _.current=void 0,e});let c=await _.current;if(r)return;let{origin:l}=an(t.uri),u=c.remote;if(u.configure&&await Yq(u.configure,Tc(e)),r)return;let d=u.sources?.find(e=>e.origin===l)??u,f=await d.play?.({uri:t.uri,url:t.url,languages:Pn()});if(r)return;if(!f){g.current.onUnplayable();return}a=Vq(d,n),a&&g.current.onPlayback?.(a),i?.current&&(o=Hq(d,i.current,window,n)),s=Uq(d),h({uri:t.uri,url:t.url,source:d})}catch(t){if(r)return;console.warn(`Source '${e}' could not start playback:`,t),p(!0)}})(),()=>{r=!0,h(void 0),o?.(),s?.(),a&&(a.dispose(),g.current.onPlayback?.(void 0))}},[e,t.uri,t.url]);let v=m&&m.uri===t.uri&&m.url===t.url?m.source:void 0,y=a?.previous,b=a?.next;H(()=>{if(v)return Wq(v,{previous:y??!1,next:b??!1},e=>g.current.onStep?.(e))},[v,y,b]);let x=!!o,S=o?.title;H(()=>{if(v)return Gq(v,x?S||!0:!1,()=>g.current.onSourceSwitch?.())},[v,x,S]);let C=!!s,w=s?.title;H(()=>{if(v)return qq(v,C?w||!0:!1,()=>g.current.onBrowseSubtitles?.())},[v,C,w]);let T=c?.tracks??Zq,E=G(void 0),D=G(null),O=l?.id,k=l?.seq;return O!==void 0&&k!==void 0&&E.current!==k&&(E.current=k,D.current=O),H(()=>{if(v)return Kq(v,T,e=>g.current.loadSubtitle?.(e)??Promise.reject(/* @__PURE__ */ Error(`No subtitle loader`)))},[v,T]),H(()=>{if(!v||!D.current)return;let e=D.current;T.some(t=>t.id===e)&&(D.current=null,v.selectExternalSubtitle?.(e)?.catch(()=>{}))},[v,T,O,k]),H(()=>()=>{_.current?.then(e=>e.unmount(),()=>{})},[]),/* @__PURE__ */ W(`div`,{css:Xq,children:[/* @__PURE__ */ V(`iframe`,{ref:d,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`,allow:`fullscreen; autoplay; encrypted-media; cross-origin-isolated`}),f?/* @__PURE__ */ V(`div`,{className:`failed`,children:u.formatMessage({id:`This source could not start playback.`,defaultMessage:`This source could not start playback.`})}):null]})},$q=(e,t,n)=>{let r=t===`party`?e:t;if(!(r===void 0||n.busy||r===n.selected)&&(r===null||n.ids.includes(r)))return r},eJ=(e,t,n,r,i)=>!n||r.selected===n.selected||r.selected===i?e:r.selected===t?`party`:r.selected;U();var tJ=()=>mu(location.pathname+location.search),nJ=()=>navigator.userActivation?.isActive??!0,rJ=({link:e,tracks:t})=>{let n=LS(),r=n.status===`active`?n.role:void 0,i=Y.following(),a=G(void 0),o=G(void 0),s=G(0),c=G(void 0),l=G(0),u=G(void 0),d=G(/* @__PURE__ */ new Map),f=G(void 0),p=G(void 0),m=G(/* @__PURE__ */ new Map),h=()=>p.current?.busy??!1,g=(t,n=!1)=>{if(!e||!Y.following()||h())return;let r=Date.now(),i=o.current&&Pi(o.current,o.current.at,r),a=i&&Oi(i,t,r,!0);if(e.ended?.()&&a?.seek===void 0)return;let s=e.follow?e.follow(t,n):(e.apply(t,!0),a);(!s||s.seek!==void 0||s.play||s.pause)&&(l.current=r+Fi),s?.seek!==void 0&&(u.current=s.seek)},_=(e=!1)=>{let t=a.current;t&&g(Pi(t,t.at,Date.now()),e)},v=(e,t)=>{let n=Y.hostClock(),r=n?{...t,at:Yi(t.at,n.offset)}:t;for(let t of e){let e=d.current.get(t)??{sentAt:0};if(d.current.set(t,e),e.next={t:`ask`,c:t,path:tJ(),s:r},e.timer)continue;let n=()=>{e.timer=void 0,e.sentAt=Date.now(),Y.send(e.next)},i=e.sentAt+250-Date.now();i<=0?n():e.timer=setTimeout(n,i)}s.current=Date.now()+Ii,clearTimeout(c.current),c.current=setTimeout(()=>_(),Ii)};H(()=>{if(a.current=void 0,o.current=void 0,f.current=void 0,u.current=void 0,!e||!r)return;let t=e.onReport(t=>{let n=o.current;if(o.current=t,r===`host`){if(h())return;f.current=t,Y.setPlayback(t),Y.send({t:`playback`,s:t});return}let i=a.current;if(!i||e.ended?.()||!Y.following()||h())return;let c=Date.now(),d=c<s.current,p=Pi(i,i.at,c),m=u.current!==void 0&&Math.abs(t.time-u.current)<=.5;m&&(u.current=void 0);let _=n&&nJ()&&(d||c>=l.current)?Li(n,t,d?n:p).filter(e=>Y.may(e)&&!(m&&e===`seek`)):[];_.length?v(_,t):d||g(p)});return()=>{t(),clearTimeout(c.current);for(let e of d.current.values())clearTimeout(e.timer);d.current.clear(),s.current=0,r===`host`&&Y.setPlayback(void 0)}},[r,e]),H(()=>{i&&_(!0)},[i]),H(()=>{if(r!==`guest`)return;let t,n=!0,i=async()=>{let r=tJ(),i=Y.hostPath();if(i===void 0)return;if(i!==r){Y.setStatus({s:`away`});return}let s=await e?.buffer?.();if(!n)return;let c=Date.now(),l=o.current&&Pi(o.current,o.current.at,c),u=s?.time??l?.time,d=l&&!l.paused&&(s?.readyState??3)>=3,f=u===void 0?{}:{time:u,rate:d?l.rate:0};if(!Y.following()){Y.setStatus({s:`away`,path:r,...f});return}let p=a.current;t=p?Hi(t,s,Pi(p,p.at,c).time,e?.duration?.()):`loading`,Y.setStatus({s:t,path:r,...f})};i();let s=setInterval(()=>{i()},zi);return()=>{n=!1,clearInterval(s)}},[r,e]),H(()=>()=>{r===`guest`&&Y.setStatus({s:`away`})},[r]);let y=()=>{let e=p.current;if(t&&e&&r)for(let n of jn){let r=e[n],i=r&&$q(Y.partyTrack(n),Y.mine(n),{...r,busy:e.busy});i===void 0&&!e.busy&&m.current.delete(n),i!==void 0&&m.current.get(n)!==i&&(m.current.set(n,i),t.select(n,i))}},b=()=>{if(r===`guest`){_();return}let t=f.current,n=o.current;if(!e||!t||!n)return;let i=Date.now(),a=Pi(t,t.at,i),s=Pi(n,n.at,i);Math.abs(a.time-s.time)>.5?e.apply({...s,time:a.time},!0):(f.current=n,Y.setPlayback(n),Y.send({t:`playback`,s:n}))};return H(()=>{if(p.current=void 0,m.current.clear(),!t||!r)return;let e=t.onTracks(e=>{let t=p.current;p.current=e;for(let n of jn){let r=e[n];if(!r)continue;let i=eJ(Y.mine(n),Y.partyTrack(n),t?.[n],r,m.current.get(n));i!==Y.mine(n)&&Y.setMine(n,i)}Y.setPlayerTracks(e),t?.busy&&!e.busy&&b(),y()});return()=>{e(),p.current=void 0,Y.setPlayerTracks(void 0)}},[r,t,e]),H(y),RS((t,{replayed:n})=>{if(r===`host`){if(t.t!==`ask`||!(`s`in t)||t.path!==tJ()||!e||!o.current)return;let n=Ri(o.current,t,Date.now());if(!n)return;h()&&(f.current=n),e.apply(n,!0);return}if(r!==`guest`)return;let i=t.t===`playback`||t.t===`state`?t.s:void 0;if(!i||Y.hostPath()!==tJ())return;let c=Y.hostClock(),l=c?{...i,at:Ji(i.at,c.offset)}:i,u=Date.now(),d={...l,time:Ei(l,u,!!c),at:u};a.current=d,u>=s.current&&g(d,n)}),null},iJ=[`play`,`pause`,`seeked`,`ratechange`,`ended`],aJ=e=>({paused:e.paused,time:e.currentTime,rate:e.playbackRate??1,at:Date.now()}),oJ=(e,t=()=>{})=>{let n=/* @__PURE__ */ new Set,r=()=>{let t=aJ(e);for(let e of n)e(t)};for(let t of iJ)e.addEventListener(t,r);let i=setInterval(()=>{e.paused||r()},Ti),a=t=>{t.seek!==void 0&&(e.currentTime=t.seek),t.rate!==void 0&&(e.playbackRate=t.rate),t.pause&&e.pause(),t.play&&(e.autoplay?e.autoplay():e.play()).catch(()=>{})},o,s;return{apply:(t,n)=>{a(Oi(aJ(e),t,Date.now(),n))},seek:t=>{e.currentTime=t},play:()=>{e.paused&&(e.autoplay?e.autoplay():e.play()).catch(()=>{})},follow:(t,n)=>{let r=Date.now(),{correction:i,follow:c}=ji(o,{...aJ(e),seeking:e.seeking},t,r,n);o=c,clearTimeout(s);let{catchUp:l}=c;return l&&(s=setTimeout(()=>{Mi(e.playbackRate??1,l.rate)&&(e.playbackRate=t.rate)},l.until-r)),e.ended&&i.seek===void 0?{}:(a(i),i)},onReport:e=>(n.add(e),queueMicrotask(r),()=>{n.delete(e)}),ended:()=>e.ended??!1,duration:()=>e.duration??0,buffer:async()=>{let{buffered:t}=e,n=[];for(let e=0;t&&e<t.length;e++)n.push([t.start(e),t.end(e)]);return{time:e.currentTime,readyState:e.readyState??0,ranges:n}},dispose:()=>{for(let t of iJ)e.removeEventListener(t,r);clearInterval(i),clearTimeout(s),n.clear(),t()}}},sJ=e=>{let t=Tr(e,{origin:location.origin});return oJ(t,()=>t.destroy())},cJ=(e,t)=>t?e==null?t:J.formatMessage({id:`E{number} - {title}`,defaultMessage:`E{number} - {title}`},{number:e,title:t}):e==null?void 0:J.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:e}),lJ=e=>!!(e&&CT(e)&&(e.episodes?.length??0)<=1),uJ=(e,t)=>{let n=t?.titles?.at(0)?.title;return lJ(e)?e?.titles?.at(0)?.title??n:cJ(t?.episodeNumber,n)},dJ=``,fJ=(e,t)=>{let n=t?.titles?.at(0)?.title;if(lJ(e)){let t=e?.titles?.at(0)?.title??n;return t?{prefix:``,title:t,suffix:``}:void 0}if(!n)return;if(t?.episodeNumber==null)return{prefix:``,title:n,suffix:``};let r=J.formatMessage({id:`E{number} - {title}`,defaultMessage:`E{number} - {title}`},{number:t.episodeNumber,title:dJ}),i=r.indexOf(dJ);if(i===-1)return;let a=r.slice(0,i),o=r.slice(i+1);return{prefix:a.endsWith(`⁨`)?a.slice(0,-1):a,title:n,suffix:o.startsWith(`⁩`)?o.slice(1):o}};U();var pJ=(e,t)=>!t.off(e.origin)&&(!!(e.url&&t.builtIn(e.origin,e.url))||!!(t.selfPlaying&&(e.embedUrl||t.selfPlaying(e.origin)))),mJ=(e,t)=>{let n=e=>{let n=t.order.indexOf(e);return n<0?t.order.length:n},r;for(let i of e)pJ(i,t)&&(!r||n(i.origin)<n(r.origin))&&(r=i);if(!r)return;let i=t.order.slice(0,n(r.origin)).every(e=>!t.possible(e)||t.settled(e));return{uri:r.uri,now:i}},hJ=(e,t,{plays:n,free:r,neverSignedIn:i},{answered:a,asked:o,moving:s,pending:c})=>{let l=mJ(e.filter(n),t),u=mJ(e,t),d=e.find(e=>e.uri===u?.uri),f=!!(d&&i(d));return{pick:(f?mJ(e.filter(r),t):void 0)??(f&&c?void 0:o?l:l||s?u:void 0),stuck:!l&&(a||o)}},gJ=(e,{mediaUri:t,episodeUri:n,sourceUri:r,guest:i,cannotPlay:a,search:o},s)=>{let c=G(void 0);H(()=>{r&&r!==c.current&&(c.current=void 0)},[r]);let l=(!r||a&&r===c.current)&&!i&&e?.now?e.uri:void 0;H(()=>{if(!l)return;c.current=l;let e=ag(Q.WATCH,{mediaUri:t,episodeUri:n,sourceUri:l});s(o?`${e}?${o}`:e,{replace:!0})},[l,t,n])},_J=(e,t,n)=>n.fetch(`https://api.ani.zip/mappings?${e}_id=${t}&specials=1`).then(e=>e.json()),vJ=new TextDecoder(`utf-8`,{fatal:!0}),yJ=new TextDecoder(`utf-16le`),bJ=new TextDecoder(`utf-16be`),xJ=/* @__PURE__ */ new Set([`zh-Hant`,`zh-TW`,`zh-HK`,`zh-MO`]),SJ=`zh`;function CJ(e){return e.startsWith(``)?e.slice(1):e}function wJ(e){return e?xJ.has(e)||e.toLowerCase().includes(`hant`)?`big5`:e===SJ||e.toLowerCase().startsWith(`zh-`)?`gb18030`:`windows-1252`:`windows-1252`}function TJ(e,t){if(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191)return CJ(new TextDecoder(`utf-8`).decode(e.subarray(3)));if(e.length>=2&&e[0]===255&&e[1]===254)return CJ(yJ.decode(e.subarray(2)));if(e.length>=2&&e[0]===254&&e[1]===255)return CJ(bJ.decode(e.subarray(2)));try{return CJ(vJ.decode(e))}catch{let n=wJ(t);return CJ(new TextDecoder(n).decode(e))}}var EJ=`https://opensubtitles-v3.strem.io`,DJ=2,OJ=50,kJ=/\.(?:zip|rar|7z|gz|tar|idx|sub|sup)$/i;function AJ(e){let t=encodeURIComponent(e.imdbId.trim());return e.kind===`movie`?`${EJ}/subtitles/movie/${t}.json`:`${EJ}/subtitles/series/${t}:${e.season}:${e.episode}.json`}function jJ(e){if(!e)return null;try{let t=new URL(e);return t.origin!==`https://subs5.strem.io`||kJ.test(t.pathname)?null:t.toString()}catch{return null}}function MJ(e,t){let n=(t?.trim()||new URL(e).pathname).toLowerCase();return kJ.test(n)?null:n.endsWith(`.ass`)||n.endsWith(`.ssa`)?`ass`:n.endsWith(`.vtt`)?`vtt`:`srt`}function NJ(e){return(e??``).replace(/[\u2013\u2014]/g,`-`).trim()}function PJ(e){return e?e.toLowerCase().split(/[^a-z0-9]+/).filter(e=>e.length>=2):[]}function FJ(e,t){if(!t.length)return 0;let n=`${e.subtitleFileName??``} ${e.movieReleaseName??``} ${e.releaseGroup??``}`.toLowerCase(),r=(e.releaseGroup??``).toLowerCase(),i=0;for(let e of t)n.includes(e)&&(i+=1),r&&r===e&&(i+=2);return i}async function IJ(e,t){let n;try{n=await t.fetch(AJ(e),{signal:t.signal})}catch{return[]}if(!n.ok)return[];let r;try{r=await n.json()}catch{return[]}let i=r?.subtitles;if(!Array.isArray(i))return[];let a=t.preferredLanguages??[],o=PJ(t.releaseName),s=[],c=/* @__PURE__ */ new Set;for(let e=0;e<i.length;e++){let t=i[e];if(!t||typeof t!=`object`)continue;let n=jJ(t.url);if(!n||c.has(n))continue;let r=MJ(n,t.subtitleFileName);if(!r)continue;c.add(n);let l=wq(t.lang),u=`opensubtitles:${l}:${t.id===void 0?String(e):String(t.id)}`;s.push({item:t,id:u,url:n,language:l,format:r,prefRank:Tq(l,a),score:FJ(t,o),index:e})}s.sort((e,t)=>e.prefRank===t.prefRank?e.score===t.score?e.index-t.index:t.score-e.score:e.prefRank-t.prefRank);let l=/* @__PURE__ */ new Map,u=[],d=/* @__PURE__ */ new Set,f=t.perLanguageLimit??DJ,p=t.totalLimit??OJ;for(let e of s){if(u.length>=p)break;let t=l.get(e.language)??0;if(t>=f)continue;l.set(e.language,t+1);let n=e.id;d.has(n)&&(n=`${e.id}:${e.index}`),d.add(n),u.push({...e,id:n})}let m=t.locale??`en`,h=/* @__PURE__ */ new Map;return u.map(e=>{let t=(h.get(e.language)??0)+1;h.set(e.language,t);let n=l.get(e.language)??1,r=Eq(e.language,m),i=NJ(e.item.releaseGroup),a=NJ(e.item.movieReleaseName||e.item.subtitleFileName),o=i?`OpenSubtitles · ${i}`:n>1?`OpenSubtitles #${t}`:`OpenSubtitles`;return{id:e.id,language:e.language,label:`${r} (${o})`,format:e.format,url:e.url,source:`opensubtitles`,sourceName:`OpenSubtitles`,...a?{release:a}:{},...i?{group:i}:{}}})}var LJ=`https://api-shoulei-ssl.xunlei.com/oracle/subtitle`,RJ=8;function zJ(e){return`${LJ}?name=${encodeURIComponent(e.trim())}`}function BJ(e){if(!e)return null;try{let t=new URL(e);return t.hostname!==`subtitle.v.geilijiasu.com`||t.protocol!==`https:`&&t.protocol!==`http:`?null:(t.protocol=`https:`,t.toString())}catch{return null}}function VJ(e,t){let n=(e??``).trim().toLowerCase()||(new URL(t).pathname.split(`.`).pop()?.toLowerCase()??``);return n===`srt`?`srt`:n===`vtt`?`vtt`:n===`ass`||n===`ssa`?`ass`:null}function HJ(e){return(e??``).replace(/[\u2013\u2014]/g,`-`).trim()}function UJ(e){let t=[];Array.isArray(e.languages)&&t.push(...e.languages),e.langs&&t.push(...e.langs.split(/[,/|&\s]+/));for(let e of t){let t=e.trim();if(t){if(/繁|cht|zht|big5/i.test(t))return`zh-Hant`;if(/简|双语|chs|默认/i.test(t))return`zh-Hans`}}for(let e of t){let t=e.trim();if(!t)continue;let n=wq(t);if(n!==`und`)return n}let n=e.name??``;return/繁|cht|big5/i.test(n)?`zh-Hant`:`zh-Hans`}async function WJ(e,t){let n=e.trim();if(!n)return[];let r;try{r=await t.fetch(zJ(n),{signal:t.signal})}catch{return[]}if(!r.ok)return[];let i;try{i=await r.json()}catch{return[]}let a=i?.data;if(!Array.isArray(a))return[];let o=t.preferredLanguages??[],s=/* @__PURE__ */ new Set,c=/* @__PURE__ */ new Set,l=[];for(let e=0;e<a.length;e++){let t=a[e];if(!t||typeof t!=`object`)continue;let n=BJ(t.url);if(!n||c.has(n))continue;let r=(t.cid??``).trim();if(r&&s.has(r))continue;let i=VJ(t.ext,n);if(!i)continue;c.add(n),r&&s.add(r);let u=UJ(t),d=typeof t.score==`number`?t.score:typeof t.fingerprintf_score==`number`?t.fingerprintf_score:0;l.push({item:t,id:`xunlei:${r||String(e)}`,url:n,language:u,format:i,prefRank:Tq(u,o),score:d,index:e})}l.sort((e,t)=>e.prefRank===t.prefRank?e.score===t.score?e.index-t.index:t.score-e.score:e.prefRank-t.prefRank);let u=l.slice(0,t.limit??RJ),d=t.locale??`en`,f=/* @__PURE__ */ new Map;for(let e of u)f.set(e.language,(f.get(e.language)??0)+1);let p=/* @__PURE__ */ new Map;return u.map(e=>{let t=(p.get(e.language)??0)+1;p.set(e.language,t);let n=f.get(e.language)??1,r=Eq(e.language,d),i=HJ(e.item.langs),a=HJ(e.item.name),o=i?`Xunlei · ${i}`:n>1?`Xunlei #${t}`:`Xunlei`;return{id:e.id,language:e.language,label:`${r} (${o})`,format:e.format,url:e.url,source:`xunlei`,sourceName:`Xunlei`,...a?{release:a}:{}}})}var GJ=/^tt\d+$/,KJ=/\/title\/(tt\d+)/;function qJ(e){let t=[],n=/* @__PURE__ */ new Set,r=e=>{if(!e)return;let r=e.uri??`${e.origin??``}:${e.id??``}`;if(!(r&&n.has(r))){r&&n.add(r),t.push(e);for(let r of e.handles??[])if(r?.node){let e=r.node.uri??`${r.node.origin??``}:${r.node.id??``}`;if(e&&n.has(e))continue;e&&n.add(e),t.push(r.node)}}};for(let t of e?.handles??[])r(t?.node);return t}function JJ(e){if(e){if(e.uri){let t=Gt(e.uri,`imdb`)?.id;if(t&&GJ.test(t))return t}if(e.origin===`imdb`&&e.id&&GJ.test(e.id))return e.id;for(let t of qJ(e)){let e=t.origin??(t.uri?.includes(`:`)?an(t.uri).origin:void 0),n=t.id??(t.uri?.includes(`:`)?an(t.uri).id:void 0);if(e===`imdb`&&n&&GJ.test(n))return n;let r=t.url?KJ.exec(t.url):null;if(r?.[1])return r[1]}}}function YJ(e){if(!e)return;let t=[`anilist`,`mal`,`anidb`];if(e.uri)for(let n of t){let t=Gt(e.uri,n)?.id;if(t&&/^\d+$/.test(t))return{providerId:n,id:t}}let n=qJ(e);for(let r of t){if(e.origin===r&&e.id&&/^\d+$/.test(e.id))return{providerId:r,id:e.id};for(let e of n){let t=e.origin??(e.uri?.includes(`:`)?an(e.uri).origin:void 0),n=e.id??(e.uri?.includes(`:`)?an(e.uri).id:void 0);if(t===r&&n&&/^\d+$/.test(n))return{providerId:r,id:n}}}}function XJ(e){let t=Kt(e);return sn(t)?t:void 0}function ZJ(e){if(!e)return 1;if(e.uri&&e.seasons?.length){let t=XJ(e.uri);for(let n of e.seasons)if(typeof n.number==`number`&&Number.isFinite(n.number)&&n.number>=0){let r=XJ(n.uri);if(n.uri===e.uri||r&&t&&Dn(r,t))return n.number}}return 1}function QJ(e){if(e?.startsWith(`magnet:`))try{let t=e.slice(e.indexOf(`?`)+1);return new URLSearchParams(t).get(`dn`)?.trim()||void 0}catch{return}}function $J(e,t){let n=e?.shortDescriptions?.at(0)?.shortDescription?.trim();if(n)return n;let r=e?.titles?.at(0)?.title?.trim();if(r)return r;let i=QJ(e?.url);if(i)return i;let a=t?.titles?.at(0)?.title?.trim();if(a)return a}function eY(e){let t=e.releaseName?.trim(),n=e.title?.trim();return t&&!/^(?:episode\s*\d+|\d+p|hevc|x26[45])$/i.test(t)&&t.length>=6||!n?t:e.film?n:e.episode!==void 0&&Number.isInteger(e.episode)?`${n} S${String(e.season??1).padStart(2,`0`)}E${String(e.episode).padStart(2,`0`)}`:n}function tY(e){return e.map(({id:e,language:t,label:n,format:r})=>({id:e,language:t,label:n,format:r}))}var nY=2,rY=20;function iY(e,t){let n=[...e].sort((e,n)=>Tq(e.language,t)-Tq(n.language,t)),r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=[];for(let e of n){let t=e.pluginOrigin??e.sourceName??`plugin`,n=r.get(t)??0;if(n>=rY)continue;let o=`${t}\0${e.language}`,s=i.get(o)??0;s>=nY||(r.set(t,n+1),i.set(o,s+1),a.push(e))}return a}async function aY(e){if(e.imdbId)return e.imdbId;if(e.aniId&&(e.isAnime??!0))try{let t=(await _J(e.aniId.providerId,e.aniId.id,{fetch:t=>e.fetch(String(t),{signal:e.signal})}))?.mappings?.imdb_id;return t&&GJ.test(t)?t:void 0}catch{return}}function oY(e,t){if(e){if(t.film)return{kind:`movie`,imdbId:e};if(t.episode!==void 0&&Number.isInteger(t.episode)&&t.episode>=0)return{kind:`series`,imdbId:e,season:t.season??1,episode:t.episode}}}async function sY(e){let t=(e.preferredLanguages??[]).map(e=>wq(e)).filter(e=>e!==`und`),n=await aY(e),r=oY(n,e),i=e.query?.trim(),a=i||eY({title:e.title,releaseName:e.releaseName,film:e.film,season:e.season,episode:e.episode});return{preferred:t,imdbId:n,context:{mediaUri:e.mediaUri??``,episodeUri:e.episodeUri??``,...n?{imdbId:n}:{},...e.aniId?{aniId:e.aniId}:{},isAnime:!!e.isAnime,film:!!e.film,...e.season===void 0?{}:{season:e.season},...e.episode===void 0?{}:{episode:e.episode},...e.title?{title:e.title}:{},...e.releaseName?{releaseName:e.releaseName}:{},...i?{query:i}:{},preferredLanguages:t,locale:e.locale??`en`},openTarget:r,xunleiQuery:a}}async function cY(e,t){if(e.content!==void 0)return e.content;if(e.pluginOrigin&&e.remoteTrackId!==void 0&&t.loadPluginSubtitle&&(e.hasLoader||!e.url))return t.loadPluginSubtitle(e.pluginOrigin,e.remoteTrackId);if(!e.url)throw Error(`External subtitle source unavailable: ${e.id}`);let n=await t.fetch(e.url,{signal:t.signal});if(!n.ok)throw Error(`Failed to fetch subtitle (${n.status})`);let r=await n.arrayBuffer();return TJ(new Uint8Array(r),e.language)}async function lY(e){let{preferred:t,imdbId:n,openTarget:r,xunleiQuery:i}=await sY(e),[a,o]=await Promise.all([r?IJ(r,{fetch:e.fetch,preferredLanguages:t,releaseName:e.releaseName,locale:e.locale,signal:e.signal}):Promise.resolve([]),i?WJ(i,{fetch:e.fetch,preferredLanguages:t,locale:e.locale,signal:e.signal}):Promise.resolve([])]);return{candidates:[...a,...o].sort((e,n)=>Tq(e.language,t)-Tq(n.language,t)),imdbId:n}}async function uY(e){let{preferred:t,context:n,openTarget:r,xunleiQuery:i}=await sY(e),[a,o,s]=await Promise.all([e.fetchOpenCandidates?e.fetchOpenCandidates().catch(()=>[]):r?IJ(r,{fetch:e.fetch,preferredLanguages:t,releaseName:e.releaseName,locale:e.locale,signal:e.signal,perLanguageLimit:50,totalLimit:200}):Promise.resolve([]),i?WJ(i,{fetch:e.fetch,preferredLanguages:t,locale:e.locale,signal:e.signal,limit:50}):Promise.resolve([]),e.findPluginSubtitles?e.findPluginSubtitles(n).catch(()=>[]):Promise.resolve([])]),c=e.query?.trim()?e.query.trim().toLowerCase().split(/\s+/).filter(Boolean):[],l=c.length>0?a.filter(t=>{let n=[t.release??``,t.label,t.group??``,t.language,Eq(t.language,e.locale),t.sourceName??`OpenSubtitles`].join(` `).toLowerCase();return c.every(e=>n.includes(e))}):a,u=/* @__PURE__ */ new Set;return{candidates:[...l,...o,...s].filter(e=>!u.has(e.id)&&(u.add(e.id),!0)).sort((e,n)=>Tq(e.language,t)-Tq(n.language,t)),load:t=>cY(t,e)}}var dY=/* @__PURE__ */ new Set([`https://api.ani.zip`,`https://api.aniskip.com`,`https://api.trace.moe`,`https://api.tvmaze.com`,`https://api4.thetvdb.com`,`https://apiz.trakt.tv`,`https://cdn.animenewsnetwork.com`,`https://graphql.anilist.co`,`https://graphql.animethemes.moe`,`https://kitsu.io`,`https://opensubtitles-v3.strem.io`,`https://subs5.strem.io`,`https://uts-api.itunes.apple.com`,`https://www.netflix.com`]),fY=e=>{let t=typeof e==`string`?e:e instanceof URL?e.href:typeof e?.url==`string`?e.url:void 0;if(t===void 0)return!1;try{return dY.has(new URL(t).origin)}catch{return!1}},pY=(e,t)=>(n,r)=>fY(n)?t(n,{...r,credentials:`omit`}):e(n,r);U();var mY=pY(D,KO);function hY(e){let{enabled:t,mediaUri:n=``,episodeUri:r=``,media:i,episode:a,selected:o,film:s,locale:c}=e,[l,u]=K([]),[d,f]=K(),[p,m]=K([]),[h,g]=K([]),[_,v]=K(),y=G(0),b=PC(),x=$t(Mn,Gn),S=b.flatMap(e=>e.state===`connected`?e.sources??[]:[]).filter(e=>e.hasSubtitles&&!x.includes(e.origin)).map(e=>e.origin).sort().join(`,`),C=JJ(i),w=C??d,T=YJ(i),E=T?.providerId,D=T?.id,O=!!(i?.categories?.some(e=>e===`ANIME`)||D),k=ZJ(i),A=a?.episodeNumber??void 0,j=i?.titles?.find(e=>e?.title?.trim())?.title?.trim()||void 0,M=$J(o,a),N=Pn(),P=[N.subtitles,N.language,N.audio].filter(e=>!!e).join(`,`),ee=B(()=>({mediaUri:n,episodeUri:r,...w?{imdbId:w}:{},...E&&D?{aniId:{providerId:E,id:D}}:{},isAnime:O,film:s,...k===void 0?{}:{season:k},...A===void 0?{}:{episode:A},...j?{title:j}:{},...M?{releaseName:M}:{},preferredLanguages:P?P.split(`,`):[],locale:c}),[n,r,w,E,D,O,s,k,A,j,M,P,c]),te=G(/* @__PURE__ */ new Map),F=G(null);H(()=>{g(e=>e.length?[]:e),v(e=>e&&void 0),f(void 0),te.current.clear(),F.current=null},[r]),H(()=>{if(u([]),!t||!C&&!D&&!j&&!M)return;let e=new AbortController,i=!0;return lY({fetch:mY,mediaUri:n,episodeUri:r,imdbId:C,aniId:E&&D?{providerId:E,id:D}:void 0,isAnime:O,film:s,season:k,episode:A,title:j,releaseName:M,preferredLanguages:P?P.split(`,`):[],locale:c,signal:e.signal}).then(t=>{i&&!e.signal.aborted&&(f(t.imdbId),u(t.candidates))}).catch(()=>{i&&!e.signal.aborted&&u([])}),()=>{i=!1,e.abort()}},[t,C,E,D,O,s,k,A,j,M,P,c]),H(()=>{if(!t||!S){m(e=>e.length?[]:e);return}let e=!0,n=(P?P.split(`,`):[]).map(e=>wq(e)).filter(e=>e!==`und`);return nr(ee).then(t=>{e&&m(iY(t,n))}).catch(()=>{e&&m([])}),()=>{e=!1}},[t,S,ee,P]);let ne=B(()=>{let e=/* @__PURE__ */ new Map;for(let t of l)e.set(t.id,t);for(let t of p)e.set(t.id,t);for(let t of h)e.set(t.id,t);if(e.size===0)return;let t=(P?P.split(`,`):[]).map(e=>wq(e)).filter(e=>e!==`und`),n=[...e.values()].sort((e,n)=>Tq(e.language,t)-Tq(n.language,t)),r=new Map(n.map(e=>[e.id,e]));return{tracks:tY(n),candidates:n,load:e=>{let t=te.current.get(e);if(t)return t;let n=r.get(e);if(!n)return Promise.reject(/* @__PURE__ */ Error(`Unknown external subtitle track: ${e}`));let i=cY(n,{fetch:mY,loadPluginSubtitle:(e,t)=>ir(e,t)}).catch(t=>{throw te.current.delete(e),t});return te.current.set(e,i),i}}},[l,p,h,P]),I=wt(e=>{e.length&&(g(t=>{let n=new Map(t.map(e=>[e.id,e]));for(let t of e)n.set(t.id,t);return[...n.values()]}),v({id:e[0].id,seq:++y.current}))},[]);return{bundle:ne,context:ee,selectRequest:_,pickSubtitle:wt(e=>{I([e])},[I]),pickSubtitles:I,search:wt(async(e,t)=>{let i=(P?P.split(`,`):[]).map(e=>wq(e)).filter(e=>e!==`und`),a=[r,w??``,E??``,D??``,s?`1`:`0`,k,A??``,M??``,P,c].join(`\0`),{candidates:o}=await uY({fetch:mY,mediaUri:n,episodeUri:r,imdbId:w,aniId:E&&D?{providerId:E,id:D}:void 0,isAnime:O,film:s,season:k,episode:A,title:j,releaseName:M,query:e,preferredLanguages:P?P.split(`,`):[],locale:c,signal:t,fetchOpenCandidates:()=>{if(F.current?.key===a)return F.current.promise;let e=(async()=>{let e=w??await aY({fetch:mY,imdbId:w,aniId:E&&D?{providerId:E,id:D}:void 0,isAnime:O});if(e&&f(t=>t??e),!e)return[];let t=s?{kind:`movie`,imdbId:e}:A!==void 0&&Number.isInteger(A)&&A>=0?{kind:`series`,imdbId:e,season:k,episode:A}:void 0;return t?IJ(t,{fetch:mY,preferredLanguages:i,releaseName:M,locale:c,perLanguageLimit:50,totalLimit:200}):[]})().catch(()=>(F.current?.promise===e&&(F.current=null),[]));return F.current={key:a,promise:e},e},findPluginSubtitles:e=>nr(e),loadPluginSubtitle:(e,t)=>ir(e,t)});return o},[n,r,w,E,D,O,s,k,A,j,M,P,c])}}var gY=(e,t,n)=>`https://api.aniskip.com/v2/skip-times/${encodeURIComponent(e)}/${t}?types=ed&episodeLength=${n}`,_Y=e=>typeof e==`number`&&Number.isFinite(e),vY=e=>{let t=e?.results,n=Array.isArray(t)?t.find(e=>e?.skipType===`ed`):void 0,{startTime:r,endTime:i}=n?.interval??{},a=n?.episodeLength;return _Y(r)&&_Y(i)&&_Y(a)&&i>r?{start:r,end:i,length:a}:void 0},yY=async(e,t,n,r)=>{let i=await r(gY(e,t,n),{credentials:`omit`});if(i.status!==404){if(!i.ok)throw Error(`aniskip answered ${i.status}`);return vY(await i.json())}};U();var bY=2,xY=.6,SY=(e,t)=>Math.abs(e-t)<bY,CY=async(e,t)=>{let n=await bn(e);return n===void 0||!SY(n,t)?[]:zt(await vn(Xt(e)),t)},wY=pY(D,KO),TY=async({id:e,episode:t},n)=>{let r=await yY(e,t,n,wY);return r&&SY(r.length,n)&&r.start>=n*xY?zt({credits:{start:r.start,end:r.end}},n):[]},EY=async(e,{crunchyroll:t,mal:n})=>{let r=t?await CY(t,e).catch(()=>[]):[];return Vt(r)?r:n?TY(n,e).catch(()=>[]):[]},DY=[],OY=(e,{crunchyroll:t,mal:n})=>{let[r,i]=K(DY);return H(()=>{if(i(DY),!e||!t&&!n)return;let r=!1,a=!1,o=e.onReport(({paused:o})=>{let s=e.duration?.(),c=e.chapters?.();r||o||!s||c&&Vt(c)||(r=!0,EY(s,{crunchyroll:t,mal:n}).then(e=>{a||i(e)}))});return()=>{a=!0,o()}},[e,t,n?.id,n?.episode]),r},kY=(e,t)=>{if(CT(e))return;let{handles:n,seasons:r,relations:i,type:a}=e,o=r?.findIndex(e=>n.some(t=>t.node.uri===e.uri))??-1;if(r&&o>=0){let e=r[o+t];return e&&Kt(e.uri)}let s=t>0?`SEQUEL`:`PREQUEL`,c=i?.filter(e=>e.relation===s&&_O(e.format))??[],l=c.find(e=>e.format===a)??c[0];return l&&Kt(l.node.uri)},AY=([e,t,n],r,i=/* @__PURE__ */ new Date)=>{let a=[e,t,n].filter(e=>e!==void 0),o=a.flatMap(({uri:e,episodes:t})=>t.map(t=>({episode:t,mediaUri:e}))),s=a.flatMap(e=>RT(e,i)),c=r<0?-1:r+(e?.episodes.length??0);return{previous:c>0?o[c-1]:void 0,next:c>=0&&!s[c+1]?o[c+1]:void 0}},jY=(e,t,n,r)=>{if(!t)return;let i=e.filter(e=>e.origin===t);return(r?mJ(i.filter(e=>e.url===r),n):void 0)?.uri??mJ(i,n)?.uri};U();var MY=R`
7056
+ `,$q=[],eJ=({pluginUri:e,release:t,onUnplayable:n,onPlayback:r,stage:i,episodeNavigation:a,sourceSwitch:o,browseSubtitles:s,externalSubtitles:c,externalSubtitleSelection:l})=>{let u=L(),d=G(null),[f,p]=K(!1),[m,h]=K(),g=G({onUnplayable:n,onPlayback:r,onStep:a?.onStep,onSourceSwitch:o?.onRequest,onBrowseSubtitles:s?.onRequest,loadSubtitle:c?.load});g.current={onUnplayable:n,onPlayback:r,onStep:a?.onStep,onSourceSwitch:o?.onRequest,onBrowseSubtitles:s?.onRequest,loadSubtitle:c?.load};let _=G(void 0);H(()=>{let n=d.current;if(!n)return;let r=!1,a,o,s;return p(!1),h(void 0),(async()=>{try{_.current??=Ae.mount(e,{iframe:n,protocol:Qs}).catch(e=>{throw _.current=void 0,e});let c=await _.current;if(r)return;let{origin:l}=an(t.uri),u=c.remote;if(u.configure&&await Zq(u.configure,Tc(e)),r)return;let d=u.sources?.find(e=>e.origin===l)??u,f=await d.play?.({uri:t.uri,url:t.url,languages:Pn()});if(r)return;if(!f){g.current.onUnplayable();return}a=Uq(d,n),a&&g.current.onPlayback?.(a),i?.current&&(o=Wq(d,i.current,window,n)),s=Gq(d),h({uri:t.uri,url:t.url,source:d})}catch(t){if(r)return;console.warn(`Source '${e}' could not start playback:`,t),p(!0)}})(),()=>{r=!0,h(void 0),o?.(),s?.(),a&&(a.dispose(),g.current.onPlayback?.(void 0))}},[e,t.uri,t.url]);let v=m&&m.uri===t.uri&&m.url===t.url?m.source:void 0,y=a?.previous,b=a?.next;H(()=>{if(v)return Kq(v,{previous:y??!1,next:b??!1},e=>g.current.onStep?.(e))},[v,y,b]);let x=!!o,S=o?.title;H(()=>{if(v)return qq(v,x?S||!0:!1,()=>g.current.onSourceSwitch?.())},[v,x,S]);let C=!!s,w=s?.title;H(()=>{if(v)return Yq(v,C?w||!0:!1,()=>g.current.onBrowseSubtitles?.())},[v,C,w]);let T=c?.tracks??$q,E=G(void 0),D=G(null),O=l?.id,k=l?.seq;return O!==void 0&&k!==void 0&&E.current!==k&&(E.current=k,D.current=O),H(()=>{if(v)return Jq(v,T,e=>g.current.loadSubtitle?.(e)??Promise.reject(/* @__PURE__ */ Error(`No subtitle loader`)))},[v,T]),H(()=>{if(!v||!D.current)return;let e=D.current;T.some(t=>t.id===e)&&(D.current=null,v.selectExternalSubtitle?.(e)?.catch(()=>{}))},[v,T,O,k]),H(()=>()=>{_.current?.then(e=>e.unmount(),()=>{})},[]),/* @__PURE__ */ W(`div`,{css:Qq,children:[/* @__PURE__ */ V(`iframe`,{ref:d,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`,allow:`fullscreen; autoplay; encrypted-media; cross-origin-isolated`}),f?/* @__PURE__ */ V(`div`,{className:`failed`,children:u.formatMessage({id:`This source could not start playback.`,defaultMessage:`This source could not start playback.`})}):null]})},tJ=(e,t,n)=>{let r=t===`party`?e:t;if(!(r===void 0||n.busy||r===n.selected)&&(r===null||n.ids.includes(r)))return r},nJ=(e,t,n,r,i)=>!n||r.selected===n.selected||r.selected===i?e:r.selected===t?`party`:r.selected;U();var rJ=()=>mu(location.pathname+location.search),iJ=()=>navigator.userActivation?.isActive??!0,aJ=({link:e,tracks:t})=>{let n=LS(),r=n.status===`active`?n.role:void 0,i=Y.following(),a=G(void 0),o=G(void 0),s=G(0),c=G(void 0),l=G(0),u=G(void 0),d=G(/* @__PURE__ */ new Map),f=G(void 0),p=G(void 0),m=G(/* @__PURE__ */ new Map),h=()=>p.current?.busy??!1,g=(t,n=!1)=>{if(!e||!Y.following()||h())return;let r=Date.now(),i=o.current&&Pi(o.current,o.current.at,r),a=i&&Oi(i,t,r,!0);if(e.ended?.()&&a?.seek===void 0)return;let s=e.follow?e.follow(t,n):(e.apply(t,!0),a);(!s||s.seek!==void 0||s.play||s.pause)&&(l.current=r+Fi),s?.seek!==void 0&&(u.current=s.seek)},_=(e=!1)=>{let t=a.current;t&&g(Pi(t,t.at,Date.now()),e)},v=(e,t)=>{let n=Y.hostClock(),r=n?{...t,at:Yi(t.at,n.offset)}:t;for(let t of e){let e=d.current.get(t)??{sentAt:0};if(d.current.set(t,e),e.next={t:`ask`,c:t,path:rJ(),s:r},e.timer)continue;let n=()=>{e.timer=void 0,e.sentAt=Date.now(),Y.send(e.next)},i=e.sentAt+250-Date.now();i<=0?n():e.timer=setTimeout(n,i)}s.current=Date.now()+Ii,clearTimeout(c.current),c.current=setTimeout(()=>_(),Ii)};H(()=>{if(a.current=void 0,o.current=void 0,f.current=void 0,u.current=void 0,!e||!r)return;let t=e.onReport(t=>{let n=o.current;if(o.current=t,r===`host`){if(h())return;f.current=t,Y.setPlayback(t),Y.send({t:`playback`,s:t});return}let i=a.current;if(!i||e.ended?.()||!Y.following()||h())return;let c=Date.now(),d=c<s.current,p=Pi(i,i.at,c),m=u.current!==void 0&&Math.abs(t.time-u.current)<=.5;m&&(u.current=void 0);let _=n&&iJ()&&(d||c>=l.current)?Li(n,t,d?n:p).filter(e=>Y.may(e)&&!(m&&e===`seek`)):[];_.length?v(_,t):d||g(p)});return()=>{t(),clearTimeout(c.current);for(let e of d.current.values())clearTimeout(e.timer);d.current.clear(),s.current=0,r===`host`&&Y.setPlayback(void 0)}},[r,e]),H(()=>{i&&_(!0)},[i]),H(()=>{if(r!==`guest`)return;let t,n=!0,i=async()=>{let r=rJ(),i=Y.hostPath();if(i===void 0)return;if(i!==r){Y.setStatus({s:`away`});return}let s=await e?.buffer?.();if(!n)return;let c=Date.now(),l=o.current&&Pi(o.current,o.current.at,c),u=s?.time??l?.time,d=l&&!l.paused&&(s?.readyState??3)>=3,f=u===void 0?{}:{time:u,rate:d?l.rate:0};if(!Y.following()){Y.setStatus({s:`away`,path:r,...f});return}let p=a.current;t=p?Hi(t,s,Pi(p,p.at,c).time,e?.duration?.()):`loading`,Y.setStatus({s:t,path:r,...f})};i();let s=setInterval(()=>{i()},zi);return()=>{n=!1,clearInterval(s)}},[r,e]),H(()=>()=>{r===`guest`&&Y.setStatus({s:`away`})},[r]);let y=()=>{let e=p.current;if(t&&e&&r)for(let n of jn){let r=e[n],i=r&&tJ(Y.partyTrack(n),Y.mine(n),{...r,busy:e.busy});i===void 0&&!e.busy&&m.current.delete(n),i!==void 0&&m.current.get(n)!==i&&(m.current.set(n,i),t.select(n,i))}},b=()=>{if(r===`guest`){_();return}let t=f.current,n=o.current;if(!e||!t||!n)return;let i=Date.now(),a=Pi(t,t.at,i),s=Pi(n,n.at,i);Math.abs(a.time-s.time)>.5?e.apply({...s,time:a.time},!0):(f.current=n,Y.setPlayback(n),Y.send({t:`playback`,s:n}))};return H(()=>{if(p.current=void 0,m.current.clear(),!t||!r)return;let e=t.onTracks(e=>{let t=p.current;p.current=e;for(let n of jn){let r=e[n];if(!r)continue;let i=nJ(Y.mine(n),Y.partyTrack(n),t?.[n],r,m.current.get(n));i!==Y.mine(n)&&Y.setMine(n,i)}Y.setPlayerTracks(e),t?.busy&&!e.busy&&b(),y()});return()=>{e(),p.current=void 0,Y.setPlayerTracks(void 0)}},[r,t,e]),H(y),RS((t,{replayed:n})=>{if(r===`host`){if(t.t!==`ask`||!(`s`in t)||t.path!==rJ()||!e||!o.current)return;let n=Ri(o.current,t,Date.now());if(!n)return;h()&&(f.current=n),e.apply(n,!0);return}if(r!==`guest`)return;let i=t.t===`playback`||t.t===`state`?t.s:void 0;if(!i||Y.hostPath()!==rJ())return;let c=Y.hostClock(),l=c?{...i,at:Ji(i.at,c.offset)}:i,u=Date.now(),d={...l,time:Ei(l,u,!!c),at:u};a.current=d,u>=s.current&&g(d,n)}),null},oJ=[`play`,`pause`,`seeked`,`ratechange`,`ended`],sJ=e=>({paused:e.paused,time:e.currentTime,rate:e.playbackRate??1,at:Date.now()}),cJ=(e,t=()=>{})=>{let n=/* @__PURE__ */ new Set,r=()=>{let t=sJ(e);for(let e of n)e(t)};for(let t of oJ)e.addEventListener(t,r);let i=setInterval(()=>{e.paused||r()},Ti),a=t=>{t.seek!==void 0&&(e.currentTime=t.seek),t.rate!==void 0&&(e.playbackRate=t.rate),t.pause&&e.pause(),t.play&&(e.autoplay?e.autoplay():e.play()).catch(()=>{})},o,s;return{apply:(t,n)=>{a(Oi(sJ(e),t,Date.now(),n))},seek:t=>{e.currentTime=t},play:()=>{e.paused&&(e.autoplay?e.autoplay():e.play()).catch(()=>{})},follow:(t,n)=>{let r=Date.now(),{correction:i,follow:c}=ji(o,{...sJ(e),seeking:e.seeking},t,r,n);o=c,clearTimeout(s);let{catchUp:l}=c;return l&&(s=setTimeout(()=>{Mi(e.playbackRate??1,l.rate)&&(e.playbackRate=t.rate)},l.until-r)),e.ended&&i.seek===void 0?{}:(a(i),i)},onReport:e=>(n.add(e),queueMicrotask(r),()=>{n.delete(e)}),ended:()=>e.ended??!1,duration:()=>e.duration??0,buffer:async()=>{let{buffered:t}=e,n=[];for(let e=0;t&&e<t.length;e++)n.push([t.start(e),t.end(e)]);return{time:e.currentTime,readyState:e.readyState??0,ranges:n}},dispose:()=>{for(let t of oJ)e.removeEventListener(t,r);clearInterval(i),clearTimeout(s),n.clear(),t()}}},lJ=e=>{let t=Tr(e,{origin:location.origin});return cJ(t,()=>t.destroy())},uJ=(e,t)=>t?e==null?t:J.formatMessage({id:`E{number} - {title}`,defaultMessage:`E{number} - {title}`},{number:e,title:t}):e==null?void 0:J.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:e}),dJ=e=>!!(e&&CT(e)&&(e.episodes?.length??0)<=1),fJ=(e,t)=>{let n=t?.titles?.at(0)?.title;return dJ(e)?e?.titles?.at(0)?.title??n:uJ(t?.episodeNumber,n)},pJ=``,mJ=(e,t)=>{let n=t?.titles?.at(0)?.title;if(dJ(e)){let t=e?.titles?.at(0)?.title??n;return t?{prefix:``,title:t,suffix:``}:void 0}if(!n)return;if(t?.episodeNumber==null)return{prefix:``,title:n,suffix:``};let r=J.formatMessage({id:`E{number} - {title}`,defaultMessage:`E{number} - {title}`},{number:t.episodeNumber,title:pJ}),i=r.indexOf(pJ);if(i===-1)return;let a=r.slice(0,i),o=r.slice(i+1);return{prefix:a.endsWith(`⁨`)?a.slice(0,-1):a,title:n,suffix:o.startsWith(`⁩`)?o.slice(1):o}};U();var hJ=(e,t)=>!t.off(e.origin)&&(!!(e.url&&t.builtIn(e.origin,e.url))||!!(t.selfPlaying&&(e.embedUrl||t.selfPlaying(e.origin)))),gJ=(e,t)=>{let n=e=>{let n=t.order.indexOf(e);return n<0?t.order.length:n},r;for(let i of e)hJ(i,t)&&(!r||n(i.origin)<n(r.origin))&&(r=i);if(!r)return;let i=t.order.slice(0,n(r.origin)).every(e=>!t.possible(e)||t.settled(e));return{uri:r.uri,now:i}},_J=(e,t,{plays:n,free:r,neverSignedIn:i},{answered:a,asked:o,moving:s,pending:c})=>{let l=gJ(e.filter(n),t),u=gJ(e,t),d=e.find(e=>e.uri===u?.uri),f=!!(d&&i(d));return{pick:(f?gJ(e.filter(r),t):void 0)??(f&&c?void 0:o?l:l||s?u:void 0),stuck:!l&&(a||o)}},vJ=(e,{mediaUri:t,episodeUri:n,sourceUri:r,guest:i,cannotPlay:a,search:o},s)=>{let c=G(void 0);H(()=>{r&&r!==c.current&&(c.current=void 0)},[r]);let l=(!r||a&&r===c.current)&&!i&&e?.now?e.uri:void 0;H(()=>{if(!l)return;c.current=l;let e=ag(Q.WATCH,{mediaUri:t,episodeUri:n,sourceUri:l});s(o?`${e}?${o}`:e,{replace:!0})},[l,t,n])},yJ=(e,t,n)=>n.fetch(`https://api.ani.zip/mappings?${e}_id=${t}&specials=1`).then(e=>e.json()),bJ=new TextDecoder(`utf-8`,{fatal:!0}),xJ=new TextDecoder(`utf-16le`),SJ=new TextDecoder(`utf-16be`),CJ=/* @__PURE__ */ new Set([`zh-Hant`,`zh-TW`,`zh-HK`,`zh-MO`]),wJ=`zh`;function TJ(e){return e.startsWith(``)?e.slice(1):e}function EJ(e){return e?CJ.has(e)||e.toLowerCase().includes(`hant`)?`big5`:e===wJ||e.toLowerCase().startsWith(`zh-`)?`gb18030`:`windows-1252`:`windows-1252`}function DJ(e,t){if(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191)return TJ(new TextDecoder(`utf-8`).decode(e.subarray(3)));if(e.length>=2&&e[0]===255&&e[1]===254)return TJ(xJ.decode(e.subarray(2)));if(e.length>=2&&e[0]===254&&e[1]===255)return TJ(SJ.decode(e.subarray(2)));try{return TJ(bJ.decode(e))}catch{let n=EJ(t);return TJ(new TextDecoder(n).decode(e))}}var OJ=`https://opensubtitles-v3.strem.io`,kJ=2,AJ=50,jJ=/\.(?:zip|rar|7z|gz|tar|idx|sub|sup)$/i;function MJ(e){let t=encodeURIComponent(e.imdbId.trim());return e.kind===`movie`?`${OJ}/subtitles/movie/${t}.json`:`${OJ}/subtitles/series/${t}:${e.season}:${e.episode}.json`}function NJ(e){if(!e)return null;try{let t=new URL(e);return t.origin!==`https://subs5.strem.io`||jJ.test(t.pathname)?null:t.toString()}catch{return null}}function PJ(e,t){let n=(t?.trim()||new URL(e).pathname).toLowerCase();return jJ.test(n)?null:n.endsWith(`.ass`)||n.endsWith(`.ssa`)?`ass`:n.endsWith(`.vtt`)?`vtt`:`srt`}function FJ(e){return(e??``).replace(/[\u2013\u2014]/g,`-`).trim()}function IJ(e){return e?e.toLowerCase().split(/[^a-z0-9]+/).filter(e=>e.length>=2):[]}function LJ(e,t){if(!t.length)return 0;let n=`${e.subtitleFileName??``} ${e.movieReleaseName??``} ${e.releaseGroup??``}`.toLowerCase(),r=(e.releaseGroup??``).toLowerCase(),i=0;for(let e of t)n.includes(e)&&(i+=1),r&&r===e&&(i+=2);return i}async function RJ(e,t){let n;try{n=await t.fetch(MJ(e),{signal:t.signal})}catch{return[]}if(!n.ok)return[];let r;try{r=await n.json()}catch{return[]}let i=r?.subtitles;if(!Array.isArray(i))return[];let a=t.preferredLanguages??[],o=IJ(t.releaseName),s=[],c=/* @__PURE__ */ new Set;for(let e=0;e<i.length;e++){let t=i[e];if(!t||typeof t!=`object`)continue;let n=NJ(t.url);if(!n||c.has(n))continue;let r=PJ(n,t.subtitleFileName);if(!r)continue;c.add(n);let l=Eq(t.lang),u=`opensubtitles:${l}:${t.id===void 0?String(e):String(t.id)}`;s.push({item:t,id:u,url:n,language:l,format:r,prefRank:Dq(l,a),score:LJ(t,o),index:e})}s.sort((e,t)=>e.prefRank===t.prefRank?e.score===t.score?e.index-t.index:t.score-e.score:e.prefRank-t.prefRank);let l=/* @__PURE__ */ new Map,u=[],d=/* @__PURE__ */ new Set,f=t.perLanguageLimit??kJ,p=t.totalLimit??AJ;for(let e of s){if(u.length>=p)break;let t=l.get(e.language)??0;if(t>=f)continue;l.set(e.language,t+1);let n=e.id;d.has(n)&&(n=`${e.id}:${e.index}`),d.add(n),u.push({...e,id:n})}let m=t.locale??`en`,h=/* @__PURE__ */ new Map;return u.map(e=>{let t=(h.get(e.language)??0)+1;h.set(e.language,t);let n=l.get(e.language)??1,r=Oq(e.language,m),i=FJ(e.item.releaseGroup),a=FJ(e.item.movieReleaseName||e.item.subtitleFileName),o=i?`OpenSubtitles · ${i}`:n>1?`OpenSubtitles #${t}`:`OpenSubtitles`;return{id:e.id,language:e.language,label:`${r} (${o})`,format:e.format,url:e.url,source:`opensubtitles`,sourceName:`OpenSubtitles`,...a?{release:a}:{},...i?{group:i}:{}}})}var zJ=`https://api-shoulei-ssl.xunlei.com/oracle/subtitle`,BJ=8;function VJ(e){return`${zJ}?name=${encodeURIComponent(e.trim())}`}function HJ(e){if(!e)return null;try{let t=new URL(e);return t.hostname!==`subtitle.v.geilijiasu.com`||t.protocol!==`https:`&&t.protocol!==`http:`?null:(t.protocol=`https:`,t.toString())}catch{return null}}function UJ(e,t){let n=(e??``).trim().toLowerCase()||(new URL(t).pathname.split(`.`).pop()?.toLowerCase()??``);return n===`srt`?`srt`:n===`vtt`?`vtt`:n===`ass`||n===`ssa`?`ass`:null}function WJ(e){return(e??``).replace(/[\u2013\u2014]/g,`-`).trim()}function GJ(e){let t=[];Array.isArray(e.languages)&&t.push(...e.languages),e.langs&&t.push(...e.langs.split(/[,/|&\s]+/));for(let e of t){let t=e.trim();if(t){if(/繁|cht|zht|big5/i.test(t))return`zh-Hant`;if(/简|双语|chs|默认/i.test(t))return`zh-Hans`}}for(let e of t){let t=e.trim();if(!t)continue;let n=Eq(t);if(n!==`und`)return n}let n=e.name??``;return/繁|cht|big5/i.test(n)?`zh-Hant`:`zh-Hans`}async function KJ(e,t){let n=e.trim();if(!n)return[];let r;try{r=await t.fetch(VJ(n),{signal:t.signal})}catch{return[]}if(!r.ok)return[];let i;try{i=await r.json()}catch{return[]}let a=i?.data;if(!Array.isArray(a))return[];let o=t.preferredLanguages??[],s=/* @__PURE__ */ new Set,c=/* @__PURE__ */ new Set,l=[];for(let e=0;e<a.length;e++){let t=a[e];if(!t||typeof t!=`object`)continue;let n=HJ(t.url);if(!n||c.has(n))continue;let r=(t.cid??``).trim();if(r&&s.has(r))continue;let i=UJ(t.ext,n);if(!i)continue;c.add(n),r&&s.add(r);let u=GJ(t),d=typeof t.score==`number`?t.score:typeof t.fingerprintf_score==`number`?t.fingerprintf_score:0;l.push({item:t,id:`xunlei:${r||String(e)}`,url:n,language:u,format:i,prefRank:Dq(u,o),score:d,index:e})}l.sort((e,t)=>e.prefRank===t.prefRank?e.score===t.score?e.index-t.index:t.score-e.score:e.prefRank-t.prefRank);let u=l.slice(0,t.limit??BJ),d=t.locale??`en`,f=/* @__PURE__ */ new Map;for(let e of u)f.set(e.language,(f.get(e.language)??0)+1);let p=/* @__PURE__ */ new Map;return u.map(e=>{let t=(p.get(e.language)??0)+1;p.set(e.language,t);let n=f.get(e.language)??1,r=Oq(e.language,d),i=WJ(e.item.langs),a=WJ(e.item.name),o=i?`Xunlei · ${i}`:n>1?`Xunlei #${t}`:`Xunlei`;return{id:e.id,language:e.language,label:`${r} (${o})`,format:e.format,url:e.url,source:`xunlei`,sourceName:`Xunlei`,...a?{release:a}:{}}})}var qJ=/^tt\d+$/,JJ=/\/title\/(tt\d+)/;function YJ(e){let t=[],n=/* @__PURE__ */ new Set,r=e=>{if(!e)return;let r=e.uri??`${e.origin??``}:${e.id??``}`;if(!(r&&n.has(r))){r&&n.add(r),t.push(e);for(let r of e.handles??[])if(r?.node){let e=r.node.uri??`${r.node.origin??``}:${r.node.id??``}`;if(e&&n.has(e))continue;e&&n.add(e),t.push(r.node)}}};for(let t of e?.handles??[])r(t?.node);return t}function XJ(e){if(e){if(e.uri){let t=Gt(e.uri,`imdb`)?.id;if(t&&qJ.test(t))return t}if(e.origin===`imdb`&&e.id&&qJ.test(e.id))return e.id;for(let t of YJ(e)){let e=t.origin??(t.uri?.includes(`:`)?an(t.uri).origin:void 0),n=t.id??(t.uri?.includes(`:`)?an(t.uri).id:void 0);if(e===`imdb`&&n&&qJ.test(n))return n;let r=t.url?JJ.exec(t.url):null;if(r?.[1])return r[1]}}}function ZJ(e){if(!e)return;let t=[`anilist`,`mal`,`anidb`];if(e.uri)for(let n of t){let t=Gt(e.uri,n)?.id;if(t&&/^\d+$/.test(t))return{providerId:n,id:t}}let n=YJ(e);for(let r of t){if(e.origin===r&&e.id&&/^\d+$/.test(e.id))return{providerId:r,id:e.id};for(let e of n){let t=e.origin??(e.uri?.includes(`:`)?an(e.uri).origin:void 0),n=e.id??(e.uri?.includes(`:`)?an(e.uri).id:void 0);if(t===r&&n&&/^\d+$/.test(n))return{providerId:r,id:n}}}}function QJ(e){let t=Kt(e);return sn(t)?t:void 0}function $J(e){if(!e)return 1;if(e.uri&&e.seasons?.length){let t=QJ(e.uri);for(let n of e.seasons)if(typeof n.number==`number`&&Number.isFinite(n.number)&&n.number>=0){let r=QJ(n.uri);if(n.uri===e.uri||r&&t&&Dn(r,t))return n.number}}return 1}function eY(e){if(e?.startsWith(`magnet:`))try{let t=e.slice(e.indexOf(`?`)+1);return new URLSearchParams(t).get(`dn`)?.trim()||void 0}catch{return}}function tY(e,t){let n=e?.shortDescriptions?.at(0)?.shortDescription?.trim();if(n)return n;let r=e?.titles?.at(0)?.title?.trim();if(r)return r;let i=eY(e?.url);if(i)return i;let a=t?.titles?.at(0)?.title?.trim();if(a)return a}function nY(e){let t=e.releaseName?.trim(),n=e.title?.trim();return t&&!/^(?:episode\s*\d+|\d+p|hevc|x26[45])$/i.test(t)&&t.length>=6||!n?t:e.film?n:e.episode!==void 0&&Number.isInteger(e.episode)?`${n} S${String(e.season??1).padStart(2,`0`)}E${String(e.episode).padStart(2,`0`)}`:n}function rY(e){return e.map(({id:e,language:t,label:n,format:r})=>({id:e,language:t,label:n,format:r}))}var iY=2,aY=20;function oY(e,t){let n=[...e].sort((e,n)=>Dq(e.language,t)-Dq(n.language,t)),r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=[];for(let e of n){let t=e.pluginOrigin??e.sourceName??`plugin`,n=r.get(t)??0;if(n>=aY)continue;let o=`${t}\0${e.language}`,s=i.get(o)??0;s>=iY||(r.set(t,n+1),i.set(o,s+1),a.push(e))}return a}async function sY(e){if(e.imdbId)return e.imdbId;if(e.aniId&&(e.isAnime??!0))try{let t=(await yJ(e.aniId.providerId,e.aniId.id,{fetch:t=>e.fetch(String(t),{signal:e.signal})}))?.mappings?.imdb_id;return t&&qJ.test(t)?t:void 0}catch{return}}function cY(e,t){if(e){if(t.film)return{kind:`movie`,imdbId:e};if(t.episode!==void 0&&Number.isInteger(t.episode)&&t.episode>=0)return{kind:`series`,imdbId:e,season:t.season??1,episode:t.episode}}}async function lY(e){let t=(e.preferredLanguages??[]).map(e=>Eq(e)).filter(e=>e!==`und`),n=await sY(e),r=cY(n,e),i=e.query?.trim(),a=i||nY({title:e.title,releaseName:e.releaseName,film:e.film,season:e.season,episode:e.episode});return{preferred:t,imdbId:n,context:{mediaUri:e.mediaUri??``,episodeUri:e.episodeUri??``,...n?{imdbId:n}:{},...e.aniId?{aniId:e.aniId}:{},isAnime:!!e.isAnime,film:!!e.film,...e.season===void 0?{}:{season:e.season},...e.episode===void 0?{}:{episode:e.episode},...e.title?{title:e.title}:{},...e.releaseName?{releaseName:e.releaseName}:{},...i?{query:i}:{},preferredLanguages:t,locale:e.locale??`en`},openTarget:r,xunleiQuery:a}}async function uY(e,t){if(e.content!==void 0)return e.content;if(e.pluginOrigin&&e.remoteTrackId!==void 0&&t.loadPluginSubtitle&&(e.hasLoader||!e.url))return t.loadPluginSubtitle(e.pluginOrigin,e.remoteTrackId);if(!e.url)throw Error(`External subtitle source unavailable: ${e.id}`);let n=await t.fetch(e.url,{signal:t.signal});if(!n.ok)throw Error(`Failed to fetch subtitle (${n.status})`);let r=await n.arrayBuffer();return DJ(new Uint8Array(r),e.language)}async function dY(e){let{preferred:t,imdbId:n,openTarget:r,xunleiQuery:i}=await lY(e),[a,o]=await Promise.all([r?RJ(r,{fetch:e.fetch,preferredLanguages:t,releaseName:e.releaseName,locale:e.locale,signal:e.signal}):Promise.resolve([]),i?KJ(i,{fetch:e.fetch,preferredLanguages:t,locale:e.locale,signal:e.signal}):Promise.resolve([])]);return{candidates:[...a,...o].sort((e,n)=>Dq(e.language,t)-Dq(n.language,t)),imdbId:n}}async function fY(e){let{preferred:t,context:n,openTarget:r,xunleiQuery:i}=await lY(e),[a,o,s]=await Promise.all([e.fetchOpenCandidates?e.fetchOpenCandidates().catch(()=>[]):r?RJ(r,{fetch:e.fetch,preferredLanguages:t,releaseName:e.releaseName,locale:e.locale,signal:e.signal,perLanguageLimit:50,totalLimit:200}):Promise.resolve([]),i?KJ(i,{fetch:e.fetch,preferredLanguages:t,locale:e.locale,signal:e.signal,limit:50}):Promise.resolve([]),e.findPluginSubtitles?e.findPluginSubtitles(n).catch(()=>[]):Promise.resolve([])]),c=e.query?.trim()?e.query.trim().toLowerCase().split(/\s+/).filter(Boolean):[],l=c.length>0?a.filter(t=>{let n=[t.release??``,t.label,t.group??``,t.language,Oq(t.language,e.locale),t.sourceName??`OpenSubtitles`].join(` `).toLowerCase();return c.every(e=>n.includes(e))}):a,u=/* @__PURE__ */ new Set;return{candidates:[...l,...o,...s].filter(e=>!u.has(e.id)&&(u.add(e.id),!0)).sort((e,n)=>Dq(e.language,t)-Dq(n.language,t)),load:t=>uY(t,e)}}var pY=/* @__PURE__ */ new Set([`https://api.ani.zip`,`https://api.aniskip.com`,`https://api.trace.moe`,`https://api.tvmaze.com`,`https://api4.thetvdb.com`,`https://apiz.trakt.tv`,`https://cdn.animenewsnetwork.com`,`https://graphql.anilist.co`,`https://graphql.animethemes.moe`,`https://kitsu.io`,`https://opensubtitles-v3.strem.io`,`https://subs5.strem.io`,`https://uts-api.itunes.apple.com`,`https://www.netflix.com`]),mY=e=>{let t=typeof e==`string`?e:e instanceof URL?e.href:typeof e?.url==`string`?e.url:void 0;if(t===void 0)return!1;try{return pY.has(new URL(t).origin)}catch{return!1}},hY=(e,t)=>(n,r)=>mY(n)?t(n,{...r,credentials:`omit`}):e(n,r);U();var gY=hY(D,KO);function _Y(e){let{enabled:t,mediaUri:n=``,episodeUri:r=``,media:i,episode:a,selected:o,film:s,locale:c}=e,[l,u]=K([]),[d,f]=K(),[p,m]=K([]),[h,g]=K([]),[_,v]=K(),y=G(0),b=PC(),x=$t(Mn,Gn),S=b.flatMap(e=>e.state===`connected`?e.sources??[]:[]).filter(e=>e.hasSubtitles&&!x.includes(e.origin)).map(e=>e.origin).sort().join(`,`),C=XJ(i),w=C??d,T=ZJ(i),E=T?.providerId,D=T?.id,O=!!(i?.categories?.some(e=>e===`ANIME`)||D),k=$J(i),A=a?.episodeNumber??void 0,j=i?.titles?.find(e=>e?.title?.trim())?.title?.trim()||void 0,M=tY(o,a),N=Pn(),P=[N.subtitles,N.language,N.audio].filter(e=>!!e).join(`,`),ee=B(()=>({mediaUri:n,episodeUri:r,...w?{imdbId:w}:{},...E&&D?{aniId:{providerId:E,id:D}}:{},isAnime:O,film:s,...k===void 0?{}:{season:k},...A===void 0?{}:{episode:A},...j?{title:j}:{},...M?{releaseName:M}:{},preferredLanguages:P?P.split(`,`):[],locale:c}),[n,r,w,E,D,O,s,k,A,j,M,P,c]),te=G(/* @__PURE__ */ new Map),F=G(null);H(()=>{g(e=>e.length?[]:e),v(e=>e&&void 0),f(void 0),te.current.clear(),F.current=null},[r]),H(()=>{if(u([]),!t||!C&&!D&&!j&&!M)return;let e=new AbortController,i=!0;return dY({fetch:gY,mediaUri:n,episodeUri:r,imdbId:C,aniId:E&&D?{providerId:E,id:D}:void 0,isAnime:O,film:s,season:k,episode:A,title:j,releaseName:M,preferredLanguages:P?P.split(`,`):[],locale:c,signal:e.signal}).then(t=>{i&&!e.signal.aborted&&(f(t.imdbId),u(t.candidates))}).catch(()=>{i&&!e.signal.aborted&&u([])}),()=>{i=!1,e.abort()}},[t,C,E,D,O,s,k,A,j,M,P,c]),H(()=>{if(!t||!S){m(e=>e.length?[]:e);return}let e=!0,n=(P?P.split(`,`):[]).map(e=>Eq(e)).filter(e=>e!==`und`);return nr(ee).then(t=>{e&&m(oY(t,n))}).catch(()=>{e&&m([])}),()=>{e=!1}},[t,S,ee,P]);let ne=B(()=>{let e=/* @__PURE__ */ new Map;for(let t of l)e.set(t.id,t);for(let t of p)e.set(t.id,t);for(let t of h)e.set(t.id,t);if(e.size===0)return;let t=(P?P.split(`,`):[]).map(e=>Eq(e)).filter(e=>e!==`und`),n=[...e.values()].sort((e,n)=>Dq(e.language,t)-Dq(n.language,t)),r=new Map(n.map(e=>[e.id,e]));return{tracks:rY(n),candidates:n,load:e=>{let t=te.current.get(e);if(t)return t;let n=r.get(e);if(!n)return Promise.reject(/* @__PURE__ */ Error(`Unknown external subtitle track: ${e}`));let i=uY(n,{fetch:gY,loadPluginSubtitle:(e,t)=>ir(e,t)}).catch(t=>{throw te.current.delete(e),t});return te.current.set(e,i),i}}},[l,p,h,P]),I=wt(e=>{e.length&&(g(t=>{let n=new Map(t.map(e=>[e.id,e]));for(let t of e)n.set(t.id,t);return[...n.values()]}),v({id:e[0].id,seq:++y.current}))},[]);return{bundle:ne,context:ee,selectRequest:_,pickSubtitle:wt(e=>{I([e])},[I]),pickSubtitles:I,search:wt(async(e,t)=>{let i=(P?P.split(`,`):[]).map(e=>Eq(e)).filter(e=>e!==`und`),a=[r,w??``,E??``,D??``,s?`1`:`0`,k,A??``,M??``,P,c].join(`\0`),{candidates:o}=await fY({fetch:gY,mediaUri:n,episodeUri:r,imdbId:w,aniId:E&&D?{providerId:E,id:D}:void 0,isAnime:O,film:s,season:k,episode:A,title:j,releaseName:M,query:e,preferredLanguages:P?P.split(`,`):[],locale:c,signal:t,fetchOpenCandidates:()=>{if(F.current?.key===a)return F.current.promise;let e=(async()=>{let e=w??await sY({fetch:gY,imdbId:w,aniId:E&&D?{providerId:E,id:D}:void 0,isAnime:O});if(e&&f(t=>t??e),!e)return[];let t=s?{kind:`movie`,imdbId:e}:A!==void 0&&Number.isInteger(A)&&A>=0?{kind:`series`,imdbId:e,season:k,episode:A}:void 0;return t?RJ(t,{fetch:gY,preferredLanguages:i,releaseName:M,locale:c,perLanguageLimit:50,totalLimit:200}):[]})().catch(()=>(F.current?.promise===e&&(F.current=null),[]));return F.current={key:a,promise:e},e},findPluginSubtitles:e=>nr(e),loadPluginSubtitle:(e,t)=>ir(e,t)});return o},[n,r,w,E,D,O,s,k,A,j,M,P,c])}}var vY=(e,t,n)=>`https://api.aniskip.com/v2/skip-times/${encodeURIComponent(e)}/${t}?types=ed&episodeLength=${n}`,yY=e=>typeof e==`number`&&Number.isFinite(e),bY=e=>{let t=e?.results,n=Array.isArray(t)?t.find(e=>e?.skipType===`ed`):void 0,{startTime:r,endTime:i}=n?.interval??{},a=n?.episodeLength;return yY(r)&&yY(i)&&yY(a)&&i>r?{start:r,end:i,length:a}:void 0},xY=async(e,t,n,r)=>{let i=await r(vY(e,t,n),{credentials:`omit`});if(i.status!==404){if(!i.ok)throw Error(`aniskip answered ${i.status}`);return bY(await i.json())}};U();var SY=2,CY=.6,wY=(e,t)=>Math.abs(e-t)<SY,TY=async(e,t)=>{let n=await bn(e);return n===void 0||!wY(n,t)?[]:zt(await vn(Xt(e)),t)},EY=hY(D,KO),DY=async({id:e,episode:t},n)=>{let r=await xY(e,t,n,EY);return r&&wY(r.length,n)&&r.start>=n*CY?zt({credits:{start:r.start,end:r.end}},n):[]},OY=async(e,{crunchyroll:t,mal:n})=>{let r=t?await TY(t,e).catch(()=>[]):[];return Vt(r)?r:n?DY(n,e).catch(()=>[]):[]},kY=[],AY=(e,{crunchyroll:t,mal:n})=>{let[r,i]=K(kY);return H(()=>{if(i(kY),!e||!t&&!n)return;let r=!1,a=!1,o=e.onReport(({paused:o})=>{let s=e.duration?.(),c=e.chapters?.();r||o||!s||c&&Vt(c)||(r=!0,OY(s,{crunchyroll:t,mal:n}).then(e=>{a||i(e)}))});return()=>{a=!0,o()}},[e,t,n?.id,n?.episode]),r},jY=(e,t)=>{if(CT(e))return;let{handles:n,seasons:r,relations:i,type:a}=e,o=r?.findIndex(e=>n.some(t=>t.node.uri===e.uri))??-1;if(r&&o>=0){let e=r[o+t];return e&&Kt(e.uri)}let s=t>0?`SEQUEL`:`PREQUEL`,c=i?.filter(e=>e.relation===s&&_O(e.format))??[],l=c.find(e=>e.format===a)??c[0];return l&&Kt(l.node.uri)},MY=([e,t,n],r,i=/* @__PURE__ */ new Date)=>{let a=[e,t,n].filter(e=>e!==void 0),o=a.flatMap(({uri:e,episodes:t})=>t.map(t=>({episode:t,mediaUri:e}))),s=a.flatMap(e=>RT(e,i)),c=r<0?-1:r+(e?.episodes.length??0);return{previous:c>0?o[c-1]:void 0,next:c>=0&&!s[c+1]?o[c+1]:void 0}},NY=(e,t,n,r)=>{if(!t)return;let i=e.filter(e=>e.origin===t);return(r?gJ(i.filter(e=>e.url===r),n):void 0)?.uri??gJ(i,n)?.uri};U();var PY=R`
7053
7057
  align-items: center;
7054
7058
  justify-content: center;
7055
7059
  gap: 1.6rem;
@@ -7135,7 +7139,7 @@ scrollbar-gutter: stable;
7135
7139
  }
7136
7140
 
7137
7141
  .account button { padding: 0.5rem 1.2rem; font-size: 1.3rem; }
7138
- `,NY=({signIns:e,accounts:t})=>{let n=L(),r=G(null);return/* @__PURE__ */ W(`div`,{className:`player-container no-source`,css:MY,children:[/* @__PURE__ */ V(`h2`,{ref:r,tabIndex:-1,children:n.formatMessage({id:`No source you can play here yet`,defaultMessage:`No source you can play here yet`})}),e.length?/* @__PURE__ */ V(`ul`,{children:e.map(e=>{let n=qh.find(t=>t.origin===e),i=n?.name??e;return/* @__PURE__ */ W(`li`,{"data-source":e,children:[/* @__PURE__ */ V(`span`,{className:`icon`,children:n?.icon?/* @__PURE__ */ V(Iw,{icon:n.icon,name:i}):/* @__PURE__ */ V(`span`,{className:`letter`,"aria-hidden":`true`,children:i.charAt(0)})}),/* @__PURE__ */ V(`span`,{className:`name`,children:i}),/* @__PURE__ */ V(yK,{origin:e,heading:r,...t})]},e)})}):void 0,/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>{rd()},children:n.formatMessage({id:`Browse sources`,defaultMessage:`Browse sources`})})]})},PY=({url:e,passed:t})=>je({url:e,domains:[new URL(e).hostname],cookies:`persistent`,isSignedIn:e=>e.locator(t).exists()});U();var FY=R`
7142
+ `,FY=({signIns:e,accounts:t})=>{let n=L(),r=G(null);return/* @__PURE__ */ W(`div`,{className:`player-container no-source`,css:PY,children:[/* @__PURE__ */ V(`h2`,{ref:r,tabIndex:-1,children:n.formatMessage({id:`No source you can play here yet`,defaultMessage:`No source you can play here yet`})}),e.length?/* @__PURE__ */ V(`ul`,{children:e.map(e=>{let n=qh.find(t=>t.origin===e),i=n?.name??e;return/* @__PURE__ */ W(`li`,{"data-source":e,children:[/* @__PURE__ */ V(`span`,{className:`icon`,children:n?.icon?/* @__PURE__ */ V(Iw,{icon:n.icon,name:i}):/* @__PURE__ */ V(`span`,{className:`letter`,"aria-hidden":`true`,children:i.charAt(0)})}),/* @__PURE__ */ V(`span`,{className:`name`,children:i}),/* @__PURE__ */ V(xK,{origin:e,heading:r,...t})]},e)})}):void 0,/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>{rd()},children:n.formatMessage({id:`Browse sources`,defaultMessage:`Browse sources`})})]})},IY=({url:e,passed:t})=>je({url:e,domains:[new URL(e).hostname],cookies:`persistent`,isSignedIn:e=>e.locator(t).exists()});U();var LY=R`
7139
7143
  display: flex;
7140
7144
  flex-wrap: wrap;
7141
7145
  gap: 1rem;
@@ -7188,9 +7192,9 @@ scrollbar-gutter: stable;
7188
7192
 
7189
7193
  &:disabled { opacity: 0.6; cursor: default; }
7190
7194
  }
7191
- `,IY=({sources:e})=>{let t=L(),[n,r]=K({}),[i,a]=K(),o=e=>ar(e).catch(()=>void 0).then(t=>{r(n=>{let r={...n};return t?r[e]=t:delete r[e],r})}),s=e.map(({origin:e})=>e).join(`,`);H(()=>{if(s)for(let e of s.split(`,`))o(e)},[s]);let c=(e,t)=>{let n=PY(t);a(e),n.catch(()=>void 0).then(async t=>{(t===`authed`||t===`closed`)&&(await pr(e).catch(()=>{}),await o(e)),a(void 0)})},l=e.filter(({origin:e})=>n[e]);return l.length?/* @__PURE__ */ V(`ul`,{css:FY,children:l.map(({origin:e,name:r,icon:a})=>/* @__PURE__ */ W(`li`,{"data-check":e,children:[/* @__PURE__ */ V(`span`,{className:`icon`,children:/* @__PURE__ */ V(Iw,{icon:a,name:r})}),/* @__PURE__ */ V(`span`,{className:`name`,id:`check-${e}`,children:r}),/* @__PURE__ */ V(`button`,{type:`button`,"aria-describedby":`check-${e}`,disabled:i===e,onClick:()=>c(e,n[e]),children:t.formatMessage({id:`Verify`,defaultMessage:`Verify`})})]},e))}):null};U();var LY=5e3,RY=.8,zY=tt`
7195
+ `,RY=({sources:e})=>{let t=L(),[n,r]=K({}),[i,a]=K(),o=e=>ar(e).catch(()=>void 0).then(t=>{r(n=>{let r={...n};return t?r[e]=t:delete r[e],r})}),s=e.map(({origin:e})=>e).join(`,`);H(()=>{if(s)for(let e of s.split(`,`))o(e)},[s]);let c=(e,t)=>{let n=IY(t);a(e),n.catch(()=>void 0).then(async t=>{(t===`authed`||t===`closed`)&&(await pr(e).catch(()=>{}),await o(e)),a(void 0)})},l=e.filter(({origin:e})=>n[e]);return l.length?/* @__PURE__ */ V(`ul`,{css:LY,children:l.map(({origin:e,name:r,icon:a})=>/* @__PURE__ */ W(`li`,{"data-check":e,children:[/* @__PURE__ */ V(`span`,{className:`icon`,children:/* @__PURE__ */ V(Iw,{icon:a,name:r})}),/* @__PURE__ */ V(`span`,{className:`name`,id:`check-${e}`,children:r}),/* @__PURE__ */ V(`button`,{type:`button`,"aria-describedby":`check-${e}`,disabled:i===e,onClick:()=>c(e,n[e]),children:t.formatMessage({id:`Verify`,defaultMessage:`Verify`})})]},e))}):null};U();var zY=5e3,BY=.8,VY=tt`
7192
7196
  to { background-size: 100% 100%; }
7193
- `,BY=R`
7197
+ `,HY=R`
7194
7198
  position: absolute;
7195
7199
  inset-inline-end: 2.4rem;
7196
7200
  bottom: 8rem;
@@ -7240,9 +7244,9 @@ scrollbar-gutter: stable;
7240
7244
  }
7241
7245
 
7242
7246
  .up-next.counting {
7243
- animation: ${zY} ${LY}ms linear forwards;
7247
+ animation: ${VY} ${zY}ms linear forwards;
7244
7248
  }
7245
- `,VY=(e,t,n)=>{let r=Yt(t,n).length<t.length;return e.offerEnding?.(!r),r&&e.endingOffered?.()!==!1?void 0:Wt(t,n)??qt(n)},HY=(e,t,n)=>{let r=e.chapters?e.chapters()??[]:t;return e.chapters&&e.endingOffered?.()!==!1?r:Yt(r,n)},UY=e=>`${e.uri}\0${e.url??``}`,WY=({link:e,next:t,chapters:n,stage:r,episode:i,release:a,onAdvance:o})=>{let s=L(),[,c]=Fh(),[l,u]=K(),[d,f]=K(!1),p=t?.href,m=()=>document.fullscreenElement&&document.fullscreenElement!==r.current?document.exitFullscreen().catch(()=>{}):void 0,h=e=>{o?.();let t=m();t?t.then(()=>c(e)):c(e)},g=()=>{u(void 0),e?.focus?e.focus():r.current?.querySelector(`iframe`)?.focus()},_=G(n);_.current=n;let v=G(a);v.current=a;let y=G(e=>{});return H(()=>{if(u(void 0),p||e?.offerEnding?.(!0),!e||!p)return;let t=!1,n,r,i,a,o,s,c=()=>u(`offered`),l=Zt(f),d=(f,p)=>{let h=p!==`report`,{paused:g,time:y,rate:b,at:x}=f;clearTimeout(o),clearTimeout(s);let S=h&&!g&&b>0?y+Math.max(0,(Date.now()-x)/1e3)*b:y;h||(a=f);let C=i;if(h||(i=y),l.hear(HY(e,_.current,e.duration?.()),h?{...f,time:S,at:Date.now()}:f),e.ended?.()){if(!t)return;t=!1,m(),u(nn()?`counting`:`offered`);return}t||=!g;let w=e.chapters?.(),T=e.duration?.(),E=v.current;if(E&&e.prepare&&T){let t=T*RY,i=UY(E);S>=t?n!==i&&(p!==`chapters`||r!==i)&&(n=i,r=void 0,Promise.resolve(e.prepare(E)).then(e=>{e===!1&&n===i&&(n=void 0,r=i)},()=>{n===i&&(n=void 0,r=i)})):!g&&b>0&&n!==i&&(s=setTimeout(()=>{a&&!e.ended?.()&&d(a,`timer`)},(t-S)/b*1e3))}let D=w&&Vt(w)?VY(e,w,T):Wt(_.current,T)??qt(T);D!==void 0&&S>=D?c():(D===void 0||C===void 0||g||h||y<C)&&u(void 0),D!==void 0&&S<D&&!g&&b>0&&(o=setTimeout(c,(D-S)/b*1e3))};y.current=t=>{a&&!e.ended?.()&&d(a,t)};let h=e.onReport(e=>d(e,`report`));return()=>{y.current=()=>{},h(),clearTimeout(o),clearTimeout(s),l.stop()}},[e,!!p,i]),H(()=>{y.current(`chapters`)},[n]),H(()=>{y.current(`release`)},[a?.uri,a?.url]),H(()=>{if(l!==`counting`||!p)return;let e=setTimeout(()=>h(p),LY),t=Ht(()=>{nn()||u(`offered`)});return()=>{clearTimeout(e),t()}},[l,p]),!l||!p?null:/* @__PURE__ */ W(`div`,{css:BY,className:d?`above-skip`:void 0,children:[/* @__PURE__ */ V(`button`,{type:`button`,className:`up-next ${l}`,title:t?.title,onClick:()=>h(p),children:s.formatMessage({id:`Next episode`,defaultMessage:`Next episode`})}),l===`counting`?/* @__PURE__ */ V(`button`,{type:`button`,className:`up-next-cancel`,onClick:g,children:s.formatMessage({id:`Cancel`,defaultMessage:`Cancel`})}):void 0]})};U();var GY=e=>(e??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node),KY={nf:e=>`https://www.netflix.com/watch/${e}`},qY=RC(`
7249
+ `,UY=(e,t,n)=>{let r=Yt(t,n).length<t.length;return e.offerEnding?.(!r),r&&e.endingOffered?.()!==!1?void 0:Wt(t,n)??qt(n)},WY=(e,t,n)=>{let r=e.chapters?e.chapters()??[]:t;return e.chapters&&e.endingOffered?.()!==!1?r:Yt(r,n)},GY=e=>`${e.uri}\0${e.url??``}`,KY=({link:e,next:t,chapters:n,stage:r,episode:i,release:a,onAdvance:o})=>{let s=L(),[,c]=Fh(),[l,u]=K(),[d,f]=K(!1),p=t?.href,m=()=>document.fullscreenElement&&document.fullscreenElement!==r.current?document.exitFullscreen().catch(()=>{}):void 0,h=e=>{o?.();let t=m();t?t.then(()=>c(e)):c(e)},g=()=>{u(void 0),e?.focus?e.focus():r.current?.querySelector(`iframe`)?.focus()},_=G(n);_.current=n;let v=G(a);v.current=a;let y=G(e=>{});return H(()=>{if(u(void 0),p||e?.offerEnding?.(!0),!e||!p)return;let t=!1,n,r,i,a,o,s,c=()=>u(`offered`),l=Zt(f),d=(f,p)=>{let h=p!==`report`,{paused:g,time:y,rate:b,at:x}=f;clearTimeout(o),clearTimeout(s);let S=h&&!g&&b>0?y+Math.max(0,(Date.now()-x)/1e3)*b:y;h||(a=f);let C=i;if(h||(i=y),l.hear(WY(e,_.current,e.duration?.()),h?{...f,time:S,at:Date.now()}:f),e.ended?.()){if(!t)return;t=!1,m(),u(nn()?`counting`:`offered`);return}t||=!g;let w=e.chapters?.(),T=e.duration?.(),E=v.current;if(E&&e.prepare&&T){let t=T*BY,i=GY(E);S>=t?n!==i&&(p!==`chapters`||r!==i)&&(n=i,r=void 0,Promise.resolve(e.prepare(E)).then(e=>{e===!1&&n===i&&(n=void 0,r=i)},()=>{n===i&&(n=void 0,r=i)})):!g&&b>0&&n!==i&&(s=setTimeout(()=>{a&&!e.ended?.()&&d(a,`timer`)},(t-S)/b*1e3))}let D=w&&Vt(w)?UY(e,w,T):Wt(_.current,T)??qt(T);D!==void 0&&S>=D?c():(D===void 0||C===void 0||g||h||y<C)&&u(void 0),D!==void 0&&S<D&&!g&&b>0&&(o=setTimeout(c,(D-S)/b*1e3))};y.current=t=>{a&&!e.ended?.()&&d(a,t)};let h=e.onReport(e=>d(e,`report`));return()=>{y.current=()=>{},h(),clearTimeout(o),clearTimeout(s),l.stop()}},[e,!!p,i]),H(()=>{y.current(`chapters`)},[n]),H(()=>{y.current(`release`)},[a?.uri,a?.url]),H(()=>{if(l!==`counting`||!p)return;let e=setTimeout(()=>h(p),zY),t=Ht(()=>{nn()||u(`offered`)});return()=>{clearTimeout(e),t()}},[l,p]),!l||!p?null:/* @__PURE__ */ W(`div`,{css:HY,className:d?`above-skip`:void 0,children:[/* @__PURE__ */ V(`button`,{type:`button`,className:`up-next ${l}`,title:t?.title,onClick:()=>h(p),children:s.formatMessage({id:`Next episode`,defaultMessage:`Next episode`})}),l===`counting`?/* @__PURE__ */ V(`button`,{type:`button`,className:`up-next-cancel`,onClick:g,children:s.formatMessage({id:`Cancel`,defaultMessage:`Cancel`})}):void 0]})};U();var qY=e=>(e??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node),JY={nf:e=>`https://www.netflix.com/watch/${e}`},YY=RC(`
7246
7250
  subscription GetWatchMedia($input: MediaInput!) {
7247
7251
  media(input: $input) {
7248
7252
  _id
@@ -7345,7 +7349,7 @@ scrollbar-gutter: stable;
7345
7349
  }
7346
7350
  }
7347
7351
  }
7348
- `),JY=RC(`
7352
+ `),XY=RC(`
7349
7353
  subscription GetWatchOrigins($input: OriginPageInput!) {
7350
7354
  originPage(input: $input) {
7351
7355
  nodes {
@@ -7358,7 +7362,7 @@ scrollbar-gutter: stable;
7358
7362
  }
7359
7363
  }
7360
7364
  }
7361
- `),YY=e=>{let[t]=Zs({query:qY,variables:{input:{uri:e??``}},pause:!e});return iT(t,e)},XY=R`
7365
+ `),ZY=e=>{let[t]=Zs({query:YY,variables:{input:{uri:e??``}},pause:!e});return iT(t,e)},QY=R`
7362
7366
  display: flex;
7363
7367
  flex-direction: column;
7364
7368
  /* The bar is fixed, so it takes no room in the flow and every other route pads itself out from
@@ -7672,13 +7676,13 @@ scrollbar-gutter: stable;
7672
7676
  }
7673
7677
  }
7674
7678
  }
7675
- `,ZY=({link:e,previous:t=!1})=>{let n=L();return/* @__PURE__ */ W(Uh,{className:`episode-step ${t?`previous`:`next`}`,href:e.href,title:e.title,children:[t?/* @__PURE__ */ V(ot,{}):void 0,/* @__PURE__ */ W(`span`,{className:`step`,children:[/* @__PURE__ */ V(`span`,{className:`step-label`,children:t?n.formatMessage({id:`Previous episode`,defaultMessage:`Previous episode`}):n.formatMessage({id:`Next episode`,defaultMessage:`Next episode`})}),e.title?/* @__PURE__ */ V(`span`,{className:`step-target`,children:e.parts?/* @__PURE__ */ W(q,{children:[e.parts.prefix?/* @__PURE__ */ V(`span`,{className:`step-prefix`,children:e.parts.prefix}):void 0,/* @__PURE__ */ V(`span`,{className:`step-title`,dir:`auto`,children:e.parts.title}),e.parts.suffix?/* @__PURE__ */ V(`span`,{className:`step-prefix`,children:e.parts.suffix}):void 0]}):e.title}):void 0]}),t?void 0:/* @__PURE__ */ V(Ft,{})]})},QY=()=>{let e=L(),t=Nh(),n={...t,mediaUri:Tn(t.mediaUri),episodeUri:wn(t.episodeUri),sourceUri:wn(t.sourceUri)},[,r]=Fh(),i=G(null),a=G(null),[s,c]=K(),[l,u]=K(void 0),[d]=Zs({query:qY,variables:{input:{uri:n.mediaUri}},pause:!n.mediaUri}),p=d.data?.media,m=B(()=>p?.episodes?.find(e=>e.uri&&n.episodeUri?Dn(Kt(e.uri),Kt(n.episodeUri)):!1)??p?.episodes?.find(e=>GY(e.handles).some(e=>e.uri===n.sourceUri)),[p?.episodes,n.episodeUri,n.sourceUri]),h=n.sourceUri,g=s?.sourceUri===h?s?.link:void 0,_=B(()=>{let e=GY(m?.handles);if(!h||m?.handles?.some(e=>e.node.uri===h))return e;let{origin:t,id:n}=an(h),r=KY[t]?.(n);return r?[...e,{uri:h,origin:t,url:r}]:e},[m?.handles,h]),v=B(()=>m?.uri?on(m.uri)?.handleUrisValues:void 0,[m?.uri]),y=B(()=>v&&[...new Set([...v,..._].map(e=>e.origin))],[v,_]),[{data:b}]=Zs({query:JY,variables:{input:{ids:y,filters:[Rc.IsNotApiOnly]}},pause:!y}),x=p?.titles?.at(0)?.title;qU(x);let S=!!(p&&CT(p)),w=lJ(p),T=x&&ag(Q.TITLE,{uri:n.mediaUri,name:x}),E=m?.episodeNumber,D=uJ(p,m),O=m?.thumbnails?.at(0)?.url,[k,A]=K();H(()=>{let e=!1;return C().then(t=>{e||A(t)}),()=>{e=!0}},[]);let j=B(()=>h?mn(h):{},[h]),M=B(()=>h?cn():{},[h]),N=B(()=>{if(!h)return;let e=_.find(e=>e.uri===h);if(!e)return;if(e.embedUrl)return e.embedUrl;let{origin:t}=an(h);if(!e.url||!JT(t,e.url,k)||k!==`extension`&&KT.has(t))return;let r=new URLSearchParams({mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:h,url:e.url,...j,...M});return`${new URL(`embed.html`,import.meta.url).href}?${r}`},[h,_,n.mediaUri,n.episodeUri,j,M,k]),P=PC(),ee=$t(Mn,Gn),te=P.flatMap(e=>e.state===`connected`?e.sources??[]:[]).filter(e=>!e.subtitlesOnly),F=B(()=>P.flatMap(e=>e.state===`connected`?(e.sources??[]).filter(e=>e.hasSubtitlePicker&&!ee.includes(e.origin)).map(t=>({origin:t.origin,name:t.name,icon:t.icon,pluginUri:e.uri})):[]),[P,ee]),ne=te.map(e=>e.origin),I=e=>te.find(t=>t.origin===e)?.access??`none`,re=ne.join(`,`),ie=$t(dd,pd),ae=B(()=>md(ie,ne),[ie,re]),[oe,se]=K({}),[ce,le]=K(),[ue,de]=K();H(()=>{let e=!1,t=re?re.split(`,`):[],n=async e=>Object.fromEntries((await Promise.all(t.map(async t=>[t,(await e(t))?.pluginUri]))).filter(e=>!!e[1]));return Promise.all([n(or),n(gr)]).then(([t,n])=>{e||(se(t),le(n),de(re))}).catch(()=>{e||de(re)}),()=>{e=!0}},[re]);let fe=ne.filter(e=>I(e)!==`none`).join(`,`),pe=`${n.episodeUri} ${fe}`,[me,he]=K(),ge=e=>I(e)===`none`||me===pe;H(()=>{if(!fe)return;let e=!1;return Promise.all(fe.split(`,`).map(e=>xr(e).catch(()=>void 0).then(t=>{yq.record(e,t)}))).then(()=>{e||he(pe)}),()=>{e=!0}},[pe]);let _e=G(void 0),ve=B(()=>{if(!h){_e.current=void 0;return}let{origin:e}=an(h),t=ce?.[e],n=_.find(e=>e.uri===h);if(t&&n){let e={pluginUri:t,release:{uri:h,url:n.url??void 0}};return _e.current=e,e}let r=_e.current;if(r&&r.release.uri===h&&P.some(e=>e.uri===r.pluginUri))return r;_e.current=void 0},[h,ce,_,P]),[ye,be]=K();H(()=>{be(void 0)},[h]);let xe=!!(ve&&ye!==h),Se=_.find(e=>e.uri===h),Ce=zn(),we=h?an(h).origin:void 0,Te=!xe&&N&&Se&&!Se.embedUrl?Zn(Se.origin,Se.url):void 0,Ee=!!(Ce&&N&&Te),[De,Oe]=K(),ke=N&&(!Ee||De===N)?N:void 0;H(()=>{let e=i.current;if(xe||!ke||!e)return;let t=sJ(e),n=Bt(e);return c({link:t,sourceUri:h}),u(n),()=>{t.dispose(),n.dispose(),c(void 0),u(void 0)}},[xe,ke]),H(()=>{let e=i.current;if(!xe&&ke&&e&&D)return ln(e,D)},[xe,ke,D]),H(()=>{let e=i.current;if(!xe&&ke&&e&&h)return fn(e,h)},[xe,ke,h]),H(()=>{let e=i.current;if(!xe&&ke&&e)return gn(e)},[xe,ke]),H(()=>{let e=i.current;if(!xe&&ke&&e&&a.current)return tn(e,a.current)},[xe,ke]);let Ae=G(!1),je=G(!1),Me=G(void 0),Ne=G(n.episodeUri),Pe=e=>!!(e&&(e.isContentEditable||/^(input|textarea|select)$/i.test(e.tagName)));H(()=>{let e=i.current;if(xe||!ke||!e)return;if(!Ae.current){Ae.current=!0;return}let t=()=>{let t=je.current;je.current=!1;let n=document.activeElement;(t?!Pe(n):!n||n===document.body)&&e.focus()};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[xe,ke]);let Fe=xe?g:void 0;H(()=>{if(!Fe)return;let e=Ae.current;if(Ae.current=!0,!e)return;let t=Fe.onReport(()=>{t();let e=je.current;je.current=!1;let n=document.activeElement;(e?!Pe(n):!n||n===document.body||a.current?.contains(n))&&(Fe.focus?Fe.focus():a.current?.querySelector(`iframe`)?.focus())});return t},[Fe,n.episodeUri,h]);let[Ie,Le]=K([]);H(()=>{let e=i.current;if(!xe&&ke&&e&&h)return Sn(e,()=>Le(e=>[...e,h]))},[xe,ke,h]);let Re=B(()=>{let e=e=>{let t=ae.indexOf(e);return t===-1?ae.length:t};return(b?.originPage?.nodes??[]).map(e=>{let t=_.filter(t=>t.origin===e.id),r=!!ce?.[e.id],i=t=>!!(t?.embedUrl||r||JT(e.id,t?.url,k)),a=e=>ag(Q.WATCH,{mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:e}),o=t.map(e=>({uri:e.uri,label:e.shortDescriptions?.at(0)?.shortDescription??e.titles?.at(0)?.title??an(e.uri).id,href:i(e)?a(e.uri):e.url??void 0,external:!i(e),active:h===e.uri})),s=t.at(0),c=t.find(e=>e.uri===h)??s;return{id:e.id,name:e.name??e.id,icon:e.icon,color:e.color,href:s?o.at(0)?.href:void 0,external:!s||!i(s),active:o.some(e=>e.active),releases:o.length>1?o:void 0,picker:oe[e.id]?{pluginUri:oe[e.id]}:void 0,thumbnails:[...c?.thumbnails??[],...m?.thumbnails??[]],videoQualities:c?.videoQualities,audioQualities:c?.audioQualities,audioLanguages:c?.audioLanguages,subtitleLanguages:c?.subtitleLanguages}}).filter(e=>e.href||e.releases).sort((t,n)=>e(t.id)-e(n.id))},[b,_,m?.thumbnails,n.mediaUri,n.episodeUri,h,oe,ce,k,ae]),ze=e=>k!==`extension`&&!e.embedUrl&&JT(e.origin,e.url,`extension`)&&(KT.has(e.origin)||!JT(e.origin,e.url,k)),Be=Jt(N&&Se?.origin===`cr`&&Se.url?Xt(Se.url):void 0),Ve=B(()=>zt(Be),[Be]),He=k===`cloud`&&Se&&ze(Se)?qh.find(e=>e.origin===Se.origin)?.name:void 0;H(()=>{He&&h&&!f()&&Le(e=>[...e,h])},[He,h]);let Ue=G(/* @__PURE__ */ new Map);for(let e of Ue.current.keys())ne.includes(e)||Ue.current.delete(e);for(let e of ne)Ue.current.has(e)||Ue.current.set(e,p);let We=!!p?.settled&&ue===re,Ge=P.some(e=>e.state===`connecting`),Ke=LS(),qe=k===`extension`||f(),Je=e=>Mn().includes(e),Ye={builtIn:(e,t)=>JT(e,t,`extension`),selfPlaying:ce&&(e=>!!ce[e]),off:Je,order:ae,possible:e=>!Je(e)&&(GT.has(e)?qe||!KT.has(e):Ge||ne.includes(e)),settled:e=>We&&(GT.has(e)||Ue.current.has(e)&&Ue.current.get(e)!==p)&&ge(e)},Xe=Ke.status===`joining`||Ke.status===`active`&&Ke.role===`guest`,Ze=Ih(),[,Qe]=K(0);H(()=>{let e=()=>Qe(e=>e+1),t=[`crunchyroll`,`prime`].map(t=>YK.watch(t,e));return()=>{for(let e of t)e()}},[]);let $e=e=>!!(e.url&&JT(e.origin,e.url,k)&&fK(e.origin,k??`cloud`,YK)),et=e=>!$e(e)&&(qe||!ze(e)),tt=e=>mK(e.origin,YK)&&!ze(e)||yq.neverSignedIn(e.origin,I(e.origin)),nt=e=>GT.has(e.origin)?pK(e.origin,YK)&&!ze(e):ge(e.origin)&&yq.free(e.origin,I(e.origin)),z=_.filter(e=>!Ie.includes(e.uri)),rt=!!(h&&(Ie.includes(h)||Se&&tt(Se)&&mJ(z.filter(nt),Ye))),it=!!(m&&k)&&We&&!Ge&&Ye.order.every(e=>!Ye.possible(e)||Ye.settled(e)),at=Ge||ne.some(e=>Ye.possible(e)&&!Ye.settled(e)),ot=G(void 0),{pick:st,stuck:ct}=hJ(z,Ye,{plays:et,free:nt,neverSignedIn:tt},{answered:it,asked:ot.current===n.episodeUri,moving:rt,pending:at});ct&&(ot.current=n.episodeUri);let lt=p?.episodes??[],ut=m?lt.indexOf(m):-1,dt=WT(),ft=!!(p&&ut>=0&&!BT(p,new Date(dt))[ut]),pt=ct&&!Xe&&!Se&&(Re.length?!h:ft),mt=!pt&&!xe&&!ke&&!He,ht=mt&&!(p?.settled&&!m)&&(Xe||!(h?it:ct)),U=Ce&&(!(xe||!N||!Te||k)||!xe&&!pt&&!He&&(!we||we===`amazon`||we===`cr`)&&!Te&&ht);H(()=>{if(U)return Qn.hold()},[U]),H(()=>{if(!Ee||!N||!Te||!k)return;let e=!1;return Qn.ask({...Te,backend:k}).finally(()=>{e||Oe(N)}),()=>{e=!0}},[Ee,N,k]);let gt=iT(d,n.mediaUri),_t=(gt?.handles??[]).map(e=>e.node.uri),vt=!Xe&&gt?Ew(gt.seasons,[gt.uri,..._t]):void 0;H(()=>{if(!vt)return;let e=ag(Q.WATCH,{mediaUri:Kt(vt),episodeUri:n.episodeUri,sourceUri:n.sourceUri});r(Ze?`${e}?${Ze}`:e,{replace:!0})},[vt,n.episodeUri,n.sourceUri,Ze,r]),gJ(vt?void 0:st,{...n,guest:Xe,cannotPlay:rt,search:Ze},r),$W(g,h,_.map(e=>e.uri),Xe,QW(Ze)),H(()=>{let e=Me.current,t=Ne.current;if(Ne.current=n.episodeUri,!e)return;if(n.episodeUri!==e){t!==n.episodeUri&&(Me.current=void 0);return}if(Xe||!g)return;let r=!1,i;return i=g.onReport(t=>{r||g.ended?.()||(r=!0,i?.(),Me.current===e&&(Me.current=void 0,t.paused&&g.play?.()))}),()=>{r=!0,i?.()}},[g,n.episodeUri,h,Xe]);let yt=YY(p&&ut===0?kY(p,-1):void 0),bt=YY(p&&ut>=0&&ut===lt.length-1?kY(p,1):void 0),{previous:xt,next:St}=AY([yt,p?{...p,uri:n.mediaUri}:void 0,bt],ut,new Date(dt)),Ct=h?an(h).origin:void 0,wt=_.find(e=>e.uri===h)?.url??void 0,Tt=e=>jY(e,Ct,Ye,wt),Et=e=>{if(!e?.episode.uri)return;let t=[yt,p,bt].find(t=>t?.episodes.includes(e.episode));return{href:ag(Q.WATCH,{mediaUri:e.mediaUri,episodeUri:e.episode.uri,sourceUri:Tt(GY(e.episode.handles))}),title:uJ(t,e.episode),parts:fJ(t,e.episode)}},q=Et(xt),Dt=Et(St),Ot=Xe||!q?void 0:q.title??e.formatMessage({id:`Previous episode`,defaultMessage:`Previous episode`}),kt=Xe||!Dt?void 0:Dt.title??e.formatMessage({id:`Next episode`,defaultMessage:`Next episode`}),At=e=>{let t=e===`previous`?q:Dt,n=e===`previous`?xt:St;if(!t)return;je.current=!0,Me.current=n?.episode.uri;let i=document.fullscreenElement&&document.fullscreenElement!==a.current?document.exitFullscreen().catch(()=>{}):void 0;i?i.then(()=>r(t.href)):r(t.href)},jt=G(At);jt.current=At;let Mt=B(()=>Ot||kt?{...Ot?{previous:Ot}:{},...kt?{next:kt}:{},onStep:e=>jt.current(e)}:void 0,[Ot,kt]);H(()=>{let e=i.current;if(!xe&&ke&&e)return en(e,{previous:Ot??!1,next:kt??!1},e=>jt.current(e))},[xe,ke,Ot,kt]);let Nt=!Xe&&(Re.length>1||Re.some(e=>(e.releases?.length??0)>1)),[Pt,Ft]=K(!1),[It,Lt]=K(null),[Rt,Ht]=K(!1),[Ut,Wt]=K(null);H(()=>{Ft(!1),Lt(null),Ht(!1),Wt(null)},[n.episodeUri,n.sourceUri]);let qt=`${n.episodeUri??``}\0${n.sourceUri??``}`,Yt=G(qt);Yt.current=qt;let Zt=()=>{Nt&&(!Pt&&document.fullscreenElement&&document.fullscreenElement!==a.current&&document.exitFullscreen().catch(()=>{}),Ht(!1),Ft(e=>!e))},Qt=G(Zt);Qt.current=Zt;let nn=()=>{!Rt&&document.fullscreenElement&&document.fullscreenElement!==a.current&&document.exitFullscreen().catch(()=>{}),Ft(!1),Ht(e=>!e)},rn=G(nn);rn.current=nn;let sn=e=>{if(Ft(!1),Ht(!1),!e.picker)return;let t=Yt.current,n=document.fullscreenElement?document.exitFullscreen().catch(()=>{}):void 0;n?n.then(()=>{Yt.current===t&&Lt(e)}):Lt(e)},un=e=>{Ht(!1);let t=F.find(t=>t.origin===e.origin);if(!t)return;let n=Yt.current,r=document.fullscreenElement?document.exitFullscreen().catch(()=>{}):void 0;r?r.then(()=>{Yt.current===n&&Wt(t)}):Wt(t)},pn=B(()=>Nt?{onRequest:()=>Qt.current()}:void 0,[Nt]),hn=B(()=>xe?{onRequest:()=>rn.current()}:void 0,[xe]);H(()=>{let e=i.current;if(!xe&&ke&&e)return kn(e,Nt,()=>Qt.current())},[xe,ke,Nt]);let _n=!Xe&&GY(St?.episode.handles).length?Dt:void 0,vn=_n&&xe?Tt(GY(St?.episode.handles)):void 0,yn=vn?GY(St?.episode.handles).find(e=>e.uri===vn):void 0,bn=yn?{uri:yn.uri,url:yn.url??void 0}:void 0,xn=p?.uri?Gt(p.uri,`mal`)?.id:void 0,Cn=OY(_n&&(xe||Se?.origin!==`cr`&&!Vt(Ve))?g:void 0,{crunchyroll:_.find(e=>e.origin===`cr`&&e.url)?.url??void 0,mal:xn&&Number.isInteger(E)?{id:xn,episode:E}:void 0}),J=hY({enabled:!!(xe||ke),mediaUri:n.mediaUri,episodeUri:n.episodeUri,media:p,episode:m,selected:Se,film:S,locale:e.locale});H(()=>{let e=i.current;if(!xe&&ke&&e)return dn(e,J.bundle,{browse:!0,onBrowse:()=>rn.current(),select:J.selectRequest})},[xe,ke,J.bundle,J.selectRequest]);let[En,On]=K(),An=En?.on===n.episodeUri?gt?.seasons?.find(e=>e.uri===En.uri&&!_t.includes(e.uri)):void 0,jn=An&&Kt(An.uri),Nn=YY(jn),Pn=An?Nn:gt,Fn=mE(Pn?.uri);return!vt&&(aT(d,n.mediaUri)||gt?.settled&&!at&&!m&&!Se)?/* @__PURE__ */ V(WU,{}):/* @__PURE__ */ W(`div`,{css:XY,children:[/* @__PURE__ */ W(`div`,{className:`watch-container`,children:[/* @__PURE__ */ W(`div`,{className:`stage`,ref:a,children:[/* @__PURE__ */ W(`div`,{className:`episode-card`,children:[O?/* @__PURE__ */ V(`img`,{src:O,alt:``}):void 0,D]}),pt?/* @__PURE__ */ V(NY,{signIns:Ye.order.filter(e=>z.some(t=>t.origin===e&&$e(t))),accounts:{backend:k,crunchyroll:KK,prime:qK,sites:JK,status:YK}}):xe&&ve||ke?/* @__PURE__ */ W(`div`,{className:`player-container`,children:[xe&&ve?/* @__PURE__ */ V(Qq,{pluginUri:ve.pluginUri,release:ve.release,onUnplayable:()=>be(h),onPlayback:e=>c(e&&{link:e,sourceUri:ve.release.uri}),stage:a,episodeNavigation:Mt,sourceSwitch:pn,browseSubtitles:hn,externalSubtitles:J.bundle,externalSubtitleSelection:J.selectRequest},ve.pluginUri):/* @__PURE__ */ V(`iframe`,{ref:i,src:ke,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`,css:R`
7679
+ `,$Y=({link:e,previous:t=!1})=>{let n=L();return/* @__PURE__ */ W(Uh,{className:`episode-step ${t?`previous`:`next`}`,href:e.href,title:e.title,children:[t?/* @__PURE__ */ V(ot,{}):void 0,/* @__PURE__ */ W(`span`,{className:`step`,children:[/* @__PURE__ */ V(`span`,{className:`step-label`,children:t?n.formatMessage({id:`Previous episode`,defaultMessage:`Previous episode`}):n.formatMessage({id:`Next episode`,defaultMessage:`Next episode`})}),e.title?/* @__PURE__ */ V(`span`,{className:`step-target`,children:e.parts?/* @__PURE__ */ W(q,{children:[e.parts.prefix?/* @__PURE__ */ V(`span`,{className:`step-prefix`,children:e.parts.prefix}):void 0,/* @__PURE__ */ V(`span`,{className:`step-title`,dir:`auto`,children:e.parts.title}),e.parts.suffix?/* @__PURE__ */ V(`span`,{className:`step-prefix`,children:e.parts.suffix}):void 0]}):e.title}):void 0]}),t?void 0:/* @__PURE__ */ V(Ft,{})]})},eX=()=>{let e=L(),t=Nh(),n={...t,mediaUri:Tn(t.mediaUri),episodeUri:wn(t.episodeUri),sourceUri:wn(t.sourceUri)},[,r]=Fh(),i=G(null),a=G(null),[s,c]=K(),[l,u]=K(void 0),[d]=Zs({query:YY,variables:{input:{uri:n.mediaUri}},pause:!n.mediaUri}),p=d.data?.media,m=B(()=>p?.episodes?.find(e=>e.uri&&n.episodeUri?Dn(Kt(e.uri),Kt(n.episodeUri)):!1)??p?.episodes?.find(e=>qY(e.handles).some(e=>e.uri===n.sourceUri)),[p?.episodes,n.episodeUri,n.sourceUri]),h=n.sourceUri,g=s?.sourceUri===h?s?.link:void 0,_=B(()=>{let e=qY(m?.handles);if(!h||m?.handles?.some(e=>e.node.uri===h))return e;let{origin:t,id:n}=an(h),r=JY[t]?.(n);return r?[...e,{uri:h,origin:t,url:r}]:e},[m?.handles,h]),v=B(()=>m?.uri?on(m.uri)?.handleUrisValues:void 0,[m?.uri]),y=B(()=>v&&[...new Set([...v,..._].map(e=>e.origin))],[v,_]),[{data:b}]=Zs({query:XY,variables:{input:{ids:y,filters:[Rc.IsNotApiOnly]}},pause:!y}),x=p?.titles?.at(0)?.title;YU(x);let S=!!(p&&CT(p)),w=dJ(p),T=x&&ag(Q.TITLE,{uri:n.mediaUri,name:x}),E=m?.episodeNumber,D=fJ(p,m),O=m?.thumbnails?.at(0)?.url,[k,A]=K();H(()=>{let e=!1;return C().then(t=>{e||A(t)}),()=>{e=!0}},[]);let j=B(()=>h?mn(h):{},[h]),M=B(()=>h?cn():{},[h]),N=B(()=>{if(!h)return;let e=_.find(e=>e.uri===h);if(!e)return;if(e.embedUrl)return e.embedUrl;let{origin:t}=an(h);if(!e.url||!JT(t,e.url,k)||k!==`extension`&&KT.has(t))return;let r=new URLSearchParams({mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:h,url:e.url,...j,...M});return`${new URL(`embed.html`,import.meta.url).href}?${r}`},[h,_,n.mediaUri,n.episodeUri,j,M,k]),P=PC(),ee=$t(Mn,Gn),te=P.flatMap(e=>e.state===`connected`?e.sources??[]:[]).filter(e=>!e.subtitlesOnly),F=B(()=>P.flatMap(e=>e.state===`connected`?(e.sources??[]).filter(e=>e.hasSubtitlePicker&&!ee.includes(e.origin)).map(t=>({origin:t.origin,name:t.name,icon:t.icon,pluginUri:e.uri})):[]),[P,ee]),ne=te.map(e=>e.origin),I=e=>te.find(t=>t.origin===e)?.access??`none`,re=ne.join(`,`),ie=$t(dd,pd),ae=B(()=>md(ie,ne),[ie,re]),[oe,se]=K({}),[ce,le]=K(),[ue,de]=K();H(()=>{let e=!1,t=re?re.split(`,`):[],n=async e=>Object.fromEntries((await Promise.all(t.map(async t=>[t,(await e(t))?.pluginUri]))).filter(e=>!!e[1]));return Promise.all([n(or),n(gr)]).then(([t,n])=>{e||(se(t),le(n),de(re))}).catch(()=>{e||de(re)}),()=>{e=!0}},[re]);let fe=ne.filter(e=>I(e)!==`none`).join(`,`),pe=`${n.episodeUri} ${fe}`,[me,he]=K(),ge=e=>I(e)===`none`||me===pe;H(()=>{if(!fe)return;let e=!1;return Promise.all(fe.split(`,`).map(e=>xr(e).catch(()=>void 0).then(t=>{xq.record(e,t)}))).then(()=>{e||he(pe)}),()=>{e=!0}},[pe]);let _e=G(void 0),ve=B(()=>{if(!h){_e.current=void 0;return}let{origin:e}=an(h),t=ce?.[e],n=_.find(e=>e.uri===h);if(t&&n){let e={pluginUri:t,release:{uri:h,url:n.url??void 0}};return _e.current=e,e}let r=_e.current;if(r&&r.release.uri===h&&P.some(e=>e.uri===r.pluginUri))return r;_e.current=void 0},[h,ce,_,P]),[ye,be]=K();H(()=>{be(void 0)},[h]);let xe=!!(ve&&ye!==h),Se=_.find(e=>e.uri===h),Ce=zn(),we=h?an(h).origin:void 0,Te=!xe&&N&&Se&&!Se.embedUrl?Zn(Se.origin,Se.url):void 0,Ee=!!(Ce&&N&&Te),[De,Oe]=K(),ke=N&&(!Ee||De===N)?N:void 0;H(()=>{let e=i.current;if(xe||!ke||!e)return;let t=lJ(e),n=Bt(e);return c({link:t,sourceUri:h}),u(n),()=>{t.dispose(),n.dispose(),c(void 0),u(void 0)}},[xe,ke]),H(()=>{let e=i.current;if(!xe&&ke&&e&&D)return ln(e,D)},[xe,ke,D]),H(()=>{let e=i.current;if(!xe&&ke&&e&&h)return fn(e,h)},[xe,ke,h]),H(()=>{let e=i.current;if(!xe&&ke&&e)return gn(e)},[xe,ke]),H(()=>{let e=i.current;if(!xe&&ke&&e&&a.current)return tn(e,a.current)},[xe,ke]);let Ae=G(!1),je=G(!1),Me=G(void 0),Ne=G(n.episodeUri),Pe=e=>!!(e&&(e.isContentEditable||/^(input|textarea|select)$/i.test(e.tagName)));H(()=>{let e=i.current;if(xe||!ke||!e)return;if(!Ae.current){Ae.current=!0;return}let t=()=>{let t=je.current;je.current=!1;let n=document.activeElement;(t?!Pe(n):!n||n===document.body)&&e.focus()};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[xe,ke]);let Fe=xe?g:void 0;H(()=>{if(!Fe)return;let e=Ae.current;if(Ae.current=!0,!e)return;let t=Fe.onReport(()=>{t();let e=je.current;je.current=!1;let n=document.activeElement;(e?!Pe(n):!n||n===document.body||a.current?.contains(n))&&(Fe.focus?Fe.focus():a.current?.querySelector(`iframe`)?.focus())});return t},[Fe,n.episodeUri,h]);let[Ie,Le]=K([]);H(()=>{let e=i.current;if(!xe&&ke&&e&&h)return Sn(e,()=>Le(e=>[...e,h]))},[xe,ke,h]);let Re=B(()=>{let e=e=>{let t=ae.indexOf(e);return t===-1?ae.length:t};return(b?.originPage?.nodes??[]).map(e=>{let t=_.filter(t=>t.origin===e.id),r=!!ce?.[e.id],i=t=>!!(t?.embedUrl||r||JT(e.id,t?.url,k)),a=e=>ag(Q.WATCH,{mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:e}),o=t.map(e=>({uri:e.uri,label:e.shortDescriptions?.at(0)?.shortDescription??e.titles?.at(0)?.title??an(e.uri).id,href:i(e)?a(e.uri):e.url??void 0,external:!i(e),active:h===e.uri})),s=t.at(0),c=t.find(e=>e.uri===h)??s;return{id:e.id,name:e.name??e.id,icon:e.icon,color:e.color,href:s?o.at(0)?.href:void 0,external:!s||!i(s),active:o.some(e=>e.active),releases:o.length>1?o:void 0,picker:oe[e.id]?{pluginUri:oe[e.id]}:void 0,thumbnails:[...c?.thumbnails??[],...m?.thumbnails??[]],videoQualities:c?.videoQualities,audioQualities:c?.audioQualities,audioLanguages:c?.audioLanguages,subtitleLanguages:c?.subtitleLanguages}}).filter(e=>e.href||e.releases).sort((t,n)=>e(t.id)-e(n.id))},[b,_,m?.thumbnails,n.mediaUri,n.episodeUri,h,oe,ce,k,ae]),ze=e=>k!==`extension`&&!e.embedUrl&&JT(e.origin,e.url,`extension`)&&(KT.has(e.origin)||!JT(e.origin,e.url,k)),Be=Jt(N&&Se?.origin===`cr`&&Se.url?Xt(Se.url):void 0),Ve=B(()=>zt(Be),[Be]),He=k===`cloud`&&Se&&ze(Se)?qh.find(e=>e.origin===Se.origin)?.name:void 0;H(()=>{He&&h&&!f()&&Le(e=>[...e,h])},[He,h]);let Ue=G(/* @__PURE__ */ new Map);for(let e of Ue.current.keys())ne.includes(e)||Ue.current.delete(e);for(let e of ne)Ue.current.has(e)||Ue.current.set(e,p);let We=!!p?.settled&&ue===re,Ge=P.some(e=>e.state===`connecting`),Ke=LS(),qe=k===`extension`||f(),Je=e=>Mn().includes(e),Ye={builtIn:(e,t)=>JT(e,t,`extension`),selfPlaying:ce&&(e=>!!ce[e]),off:Je,order:ae,possible:e=>!Je(e)&&(GT.has(e)?qe||!KT.has(e):Ge||ne.includes(e)),settled:e=>We&&(GT.has(e)||Ue.current.has(e)&&Ue.current.get(e)!==p)&&ge(e)},Xe=Ke.status===`joining`||Ke.status===`active`&&Ke.role===`guest`,Ze=Ih(),[,Qe]=K(0);H(()=>{let e=()=>Qe(e=>e+1),t=[`crunchyroll`,`prime`].map(t=>ZK.watch(t,e));return()=>{for(let e of t)e()}},[]);let $e=e=>!!(e.url&&JT(e.origin,e.url,k)&&mK(e.origin,k??`cloud`,ZK)),et=e=>!$e(e)&&(qe||!ze(e)),tt=e=>gK(e.origin,ZK)&&!ze(e)||xq.neverSignedIn(e.origin,I(e.origin)),nt=e=>GT.has(e.origin)?hK(e.origin,ZK)&&!ze(e):ge(e.origin)&&xq.free(e.origin,I(e.origin)),z=_.filter(e=>!Ie.includes(e.uri)),rt=!!(h&&(Ie.includes(h)||Se&&tt(Se)&&gJ(z.filter(nt),Ye))),it=!!(m&&k)&&We&&!Ge&&Ye.order.every(e=>!Ye.possible(e)||Ye.settled(e)),at=Ge||ne.some(e=>Ye.possible(e)&&!Ye.settled(e)),ot=G(void 0),{pick:st,stuck:ct}=_J(z,Ye,{plays:et,free:nt,neverSignedIn:tt},{answered:it,asked:ot.current===n.episodeUri,moving:rt,pending:at});ct&&(ot.current=n.episodeUri);let lt=p?.episodes??[],ut=m?lt.indexOf(m):-1,dt=WT(),ft=!!(p&&ut>=0&&!BT(p,new Date(dt))[ut]),pt=ct&&!Xe&&!Se&&(Re.length?!h:ft),mt=!pt&&!xe&&!ke&&!He,ht=mt&&!(p?.settled&&!m)&&(Xe||!(h?it:ct)),U=Ce&&(!(xe||!N||!Te||k)||!xe&&!pt&&!He&&(!we||we===`amazon`||we===`cr`)&&!Te&&ht);H(()=>{if(U)return Qn.hold()},[U]),H(()=>{if(!Ee||!N||!Te||!k)return;let e=!1;return Qn.ask({...Te,backend:k}).finally(()=>{e||Oe(N)}),()=>{e=!0}},[Ee,N,k]);let gt=iT(d,n.mediaUri),_t=(gt?.handles??[]).map(e=>e.node.uri),vt=!Xe&&gt?Ew(gt.seasons,[gt.uri,..._t]):void 0;H(()=>{if(!vt)return;let e=ag(Q.WATCH,{mediaUri:Kt(vt),episodeUri:n.episodeUri,sourceUri:n.sourceUri});r(Ze?`${e}?${Ze}`:e,{replace:!0})},[vt,n.episodeUri,n.sourceUri,Ze,r]),vJ(vt?void 0:st,{...n,guest:Xe,cannotPlay:rt,search:Ze},r),tG(g,h,_.map(e=>e.uri),Xe,eG(Ze)),H(()=>{let e=Me.current,t=Ne.current;if(Ne.current=n.episodeUri,!e)return;if(n.episodeUri!==e){t!==n.episodeUri&&(Me.current=void 0);return}if(Xe||!g)return;let r=!1,i;return i=g.onReport(t=>{r||g.ended?.()||(r=!0,i?.(),Me.current===e&&(Me.current=void 0,t.paused&&g.play?.()))}),()=>{r=!0,i?.()}},[g,n.episodeUri,h,Xe]);let yt=ZY(p&&ut===0?jY(p,-1):void 0),bt=ZY(p&&ut>=0&&ut===lt.length-1?jY(p,1):void 0),{previous:xt,next:St}=MY([yt,p?{...p,uri:n.mediaUri}:void 0,bt],ut,new Date(dt)),Ct=h?an(h).origin:void 0,wt=_.find(e=>e.uri===h)?.url??void 0,Tt=e=>NY(e,Ct,Ye,wt),Et=e=>{if(!e?.episode.uri)return;let t=[yt,p,bt].find(t=>t?.episodes.includes(e.episode));return{href:ag(Q.WATCH,{mediaUri:e.mediaUri,episodeUri:e.episode.uri,sourceUri:Tt(qY(e.episode.handles))}),title:fJ(t,e.episode),parts:mJ(t,e.episode)}},q=Et(xt),Dt=Et(St),Ot=Xe||!q?void 0:q.title??e.formatMessage({id:`Previous episode`,defaultMessage:`Previous episode`}),kt=Xe||!Dt?void 0:Dt.title??e.formatMessage({id:`Next episode`,defaultMessage:`Next episode`}),At=e=>{let t=e===`previous`?q:Dt,n=e===`previous`?xt:St;if(!t)return;je.current=!0,Me.current=n?.episode.uri;let i=document.fullscreenElement&&document.fullscreenElement!==a.current?document.exitFullscreen().catch(()=>{}):void 0;i?i.then(()=>r(t.href)):r(t.href)},jt=G(At);jt.current=At;let Mt=B(()=>Ot||kt?{...Ot?{previous:Ot}:{},...kt?{next:kt}:{},onStep:e=>jt.current(e)}:void 0,[Ot,kt]);H(()=>{let e=i.current;if(!xe&&ke&&e)return en(e,{previous:Ot??!1,next:kt??!1},e=>jt.current(e))},[xe,ke,Ot,kt]);let Nt=!Xe&&(Re.length>1||Re.some(e=>(e.releases?.length??0)>1)),[Pt,Ft]=K(!1),[It,Lt]=K(null),[Rt,Ht]=K(!1),[Ut,Wt]=K(null);H(()=>{Ft(!1),Lt(null),Ht(!1),Wt(null)},[n.episodeUri,n.sourceUri]);let qt=`${n.episodeUri??``}\0${n.sourceUri??``}`,Yt=G(qt);Yt.current=qt;let Zt=()=>{Nt&&(!Pt&&document.fullscreenElement&&document.fullscreenElement!==a.current&&document.exitFullscreen().catch(()=>{}),Ht(!1),Ft(e=>!e))},Qt=G(Zt);Qt.current=Zt;let nn=()=>{!Rt&&document.fullscreenElement&&document.fullscreenElement!==a.current&&document.exitFullscreen().catch(()=>{}),Ft(!1),Ht(e=>!e)},rn=G(nn);rn.current=nn;let sn=e=>{if(Ft(!1),Ht(!1),!e.picker)return;let t=Yt.current,n=document.fullscreenElement?document.exitFullscreen().catch(()=>{}):void 0;n?n.then(()=>{Yt.current===t&&Lt(e)}):Lt(e)},un=e=>{Ht(!1);let t=F.find(t=>t.origin===e.origin);if(!t)return;let n=Yt.current,r=document.fullscreenElement?document.exitFullscreen().catch(()=>{}):void 0;r?r.then(()=>{Yt.current===n&&Wt(t)}):Wt(t)},pn=B(()=>Nt?{onRequest:()=>Qt.current()}:void 0,[Nt]),hn=B(()=>xe?{onRequest:()=>rn.current()}:void 0,[xe]);H(()=>{let e=i.current;if(!xe&&ke&&e)return kn(e,Nt,()=>Qt.current())},[xe,ke,Nt]);let _n=!Xe&&qY(St?.episode.handles).length?Dt:void 0,vn=_n&&xe?Tt(qY(St?.episode.handles)):void 0,yn=vn?qY(St?.episode.handles).find(e=>e.uri===vn):void 0,bn=yn?{uri:yn.uri,url:yn.url??void 0}:void 0,xn=p?.uri?Gt(p.uri,`mal`)?.id:void 0,Cn=AY(_n&&(xe||Se?.origin!==`cr`&&!Vt(Ve))?g:void 0,{crunchyroll:_.find(e=>e.origin===`cr`&&e.url)?.url??void 0,mal:xn&&Number.isInteger(E)?{id:xn,episode:E}:void 0}),J=_Y({enabled:!!(xe||ke),mediaUri:n.mediaUri,episodeUri:n.episodeUri,media:p,episode:m,selected:Se,film:S,locale:e.locale});H(()=>{let e=i.current;if(!xe&&ke&&e)return dn(e,J.bundle,{browse:!0,onBrowse:()=>rn.current(),select:J.selectRequest})},[xe,ke,J.bundle,J.selectRequest]);let[En,On]=K(),An=En?.on===n.episodeUri?gt?.seasons?.find(e=>e.uri===En.uri&&!_t.includes(e.uri)):void 0,jn=An&&Kt(An.uri),Nn=ZY(jn),Pn=An?Nn:gt,Fn=mE(Pn?.uri);return!vt&&(aT(d,n.mediaUri)||gt?.settled&&!at&&!m&&!Se)?/* @__PURE__ */ V(KU,{}):/* @__PURE__ */ W(`div`,{css:QY,children:[/* @__PURE__ */ W(`div`,{className:`watch-container`,children:[/* @__PURE__ */ W(`div`,{className:`stage`,ref:a,children:[/* @__PURE__ */ W(`div`,{className:`episode-card`,children:[O?/* @__PURE__ */ V(`img`,{src:O,alt:``}):void 0,D]}),pt?/* @__PURE__ */ V(FY,{signIns:Ye.order.filter(e=>z.some(t=>t.origin===e&&$e(t))),accounts:{backend:k,crunchyroll:JK,prime:YK,sites:XK,status:ZK}}):xe&&ve||ke?/* @__PURE__ */ W(`div`,{className:`player-container`,children:[xe&&ve?/* @__PURE__ */ V(eJ,{pluginUri:ve.pluginUri,release:ve.release,onUnplayable:()=>be(h),onPlayback:e=>c(e&&{link:e,sourceUri:ve.release.uri}),stage:a,episodeNavigation:Mt,sourceSwitch:pn,browseSubtitles:hn,externalSubtitles:J.bundle,externalSubtitleSelection:J.selectRequest},ve.pluginUri):/* @__PURE__ */ V(`iframe`,{ref:i,src:ke,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`,css:R`
7676
7680
  width: 100%;
7677
7681
  border: none;
7678
7682
  background: #000;
7679
7683
  flex: 1;
7680
7684
  min-height: 0;
7681
- `},ke),/* @__PURE__ */ V(WY,{link:g,next:_n,chapters:xe?Cn:Vt(Ve)||!Cn.length?Ve:Cn,stage:a,episode:n.episodeUri,release:bn,onAdvance:()=>{je.current=!0,Me.current=St?.episode.uri}}),Pt&&Nt?/* @__PURE__ */ V(Sq,{sources:Re,onSelectHref:e=>{Ft(!1),r(e)},onOpenPicker:sn,onClose:()=>Ft(!1)}):void 0,Rt?/* @__PURE__ */ V(Mq,{locale:e.locale,activeId:J.selectRequest?.id,pluginPickers:F,search:J.search,onPick:e=>{Ht(!1),J.pickSubtitle(e)},onOpenPluginPicker:un,onClose:()=>Ht(!1)}):void 0]}):He?/* @__PURE__ */ V(`div`,{className:`player-container fix`,children:/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>{o().then(e=>{e&&A(`extension`)})},children:e.formatMessage({id:`Install the FKN extension to play {name}`,defaultMessage:`Install the FKN extension to play {name}`},{name:He})})}):void 0]}),ht?/* @__PURE__ */ V(rw,{className:`player-container holding`}):mt?/* @__PURE__ */ V(`div`,{className:`player-container still`,children:O?/* @__PURE__ */ V(`img`,{src:O,alt:``}):void 0},`still`):void 0,/* @__PURE__ */ V(rJ,{link:g,tracks:l}),/* @__PURE__ */ V(`div`,{className:`watch-info`,children:/* @__PURE__ */ W(`div`,{className:`episode-row`,children:[q?/* @__PURE__ */ V(ZY,{link:q,previous:!0}):void 0,/* @__PURE__ */ W(`div`,{className:`episode-main`,children:[/* @__PURE__ */ W(`div`,{className:`episode-info`,children:[/* @__PURE__ */ V(`div`,{className:`episode-title`,children:w&&T?/* @__PURE__ */ V(Uh,{href:T,children:D}):D??(m||p?.settled?n.episodeUri:/* @__PURE__ */ V(rw,{className:`pending`}))}),w?void 0:T?/* @__PURE__ */ V(Uh,{className:`media-title`,href:T,children:x}):p?.settled?void 0:/* @__PURE__ */ V(rw,{className:`media-title pending`}),/* @__PURE__ */ V(KE,{className:`share`,path:ag(Q.WATCH,n),title:x})]}),/* @__PURE__ */ V(`div`,{className:`tracking`,children:/* @__PURE__ */ V(xU,{work:n.mediaUri,address:n.mediaUri,uri:iT(d,n.mediaUri)?.uri,title:x,cover:p?.covers?.at(0)?.url,episodeCount:p?.episodeCount,movie:S,notice:!1,link:g,episode:E})})]}),Dt?/* @__PURE__ */ V(ZY,{link:Dt}):void 0]})})]}),/* @__PURE__ */ W(`div`,{className:`watch-info sources`,children:[/* @__PURE__ */ V(IY,{sources:te.filter(({origin:e})=>Ye.settled(e))}),/* @__PURE__ */ V($w,{sources:Re,onPickRelease:e=>r(ag(Q.WATCH,{mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:e}))})]}),It?.picker?/* @__PURE__ */ V(zw,{pluginUri:It.picker.pluginUri,origin:It.id,name:It.name,uris:(It.releases??[]).map(e=>e.uri),playing:It.releases?.find(e=>e.active)?.uri,onPick:e=>{Lt(null),r(ag(Q.WATCH,{mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:e}))},onClose:()=>Lt(null)}):void 0,Ut?/* @__PURE__ */ V(Pq,{pluginUri:Ut.pluginUri,origin:Ut.origin,name:Ut.name,context:J.context,onPick:e=>{Wt(null),J.pickSubtitles(e)},onClose:()=>Wt(null)}):void 0,p&&!S?/* @__PURE__ */ W(`div`,{className:`watch-info episodes`,children:[/* @__PURE__ */ V(Dw,{seasons:gt?.seasons,currentUris:An?[An.uri]:_t,onPick:e=>On({uri:e,on:n.episodeUri})}),/* @__PURE__ */ W(`section`,{"data-episodes":!0,children:[/* @__PURE__ */ V(`h2`,{children:e.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),Pn?/* @__PURE__ */ V(PE,{media:Pn,tracked:Fn,current:An||ut<0?void 0:ut,mediaUri:jn??n.mediaUri,sourceOf:e=>e===m?h:Tt(GY(e.handles))},jn??n.mediaUri):/* @__PURE__ */ V(ME,{})]})]}):void 0]})};U();var $Y=R`
7685
+ `},ke),/* @__PURE__ */ V(KY,{link:g,next:_n,chapters:xe?Cn:Vt(Ve)||!Cn.length?Ve:Cn,stage:a,episode:n.episodeUri,release:bn,onAdvance:()=>{je.current=!0,Me.current=St?.episode.uri}}),Pt&&Nt?/* @__PURE__ */ V(wq,{sources:Re,onSelectHref:e=>{Ft(!1),r(e)},onOpenPicker:sn,onClose:()=>Ft(!1)}):void 0,Rt?/* @__PURE__ */ V(Pq,{locale:e.locale,activeId:J.selectRequest?.id,pluginPickers:F,search:J.search,onPick:e=>{Ht(!1),J.pickSubtitle(e)},onOpenPluginPicker:un,onClose:()=>Ht(!1)}):void 0]}):He?/* @__PURE__ */ V(`div`,{className:`player-container fix`,children:/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>{o().then(e=>{e&&A(`extension`)})},children:e.formatMessage({id:`Install the FKN extension to play {name}`,defaultMessage:`Install the FKN extension to play {name}`},{name:He})})}):void 0]}),ht?/* @__PURE__ */ V(rw,{className:`player-container holding`}):mt?/* @__PURE__ */ V(`div`,{className:`player-container still`,children:O?/* @__PURE__ */ V(`img`,{src:O,alt:``}):void 0},`still`):void 0,/* @__PURE__ */ V(aJ,{link:g,tracks:l}),/* @__PURE__ */ V(`div`,{className:`watch-info`,children:/* @__PURE__ */ W(`div`,{className:`episode-row`,children:[q?/* @__PURE__ */ V($Y,{link:q,previous:!0}):void 0,/* @__PURE__ */ W(`div`,{className:`episode-main`,children:[/* @__PURE__ */ W(`div`,{className:`episode-info`,children:[/* @__PURE__ */ V(`div`,{className:`episode-title`,children:w&&T?/* @__PURE__ */ V(Uh,{href:T,children:D}):D??(m||p?.settled?n.episodeUri:/* @__PURE__ */ V(rw,{className:`pending`}))}),w?void 0:T?/* @__PURE__ */ V(Uh,{className:`media-title`,href:T,children:x}):p?.settled?void 0:/* @__PURE__ */ V(rw,{className:`media-title pending`}),/* @__PURE__ */ V(KE,{className:`share`,path:ag(Q.WATCH,n),title:x})]}),/* @__PURE__ */ V(`div`,{className:`tracking`,children:/* @__PURE__ */ V(CU,{work:n.mediaUri,address:n.mediaUri,uri:iT(d,n.mediaUri)?.uri,title:x,cover:p?.covers?.at(0)?.url,episodeCount:p?.episodeCount,movie:S,notice:!1,link:g,episode:E})})]}),Dt?/* @__PURE__ */ V($Y,{link:Dt}):void 0]})})]}),/* @__PURE__ */ W(`div`,{className:`watch-info sources`,children:[/* @__PURE__ */ V(RY,{sources:te.filter(({origin:e})=>Ye.settled(e))}),/* @__PURE__ */ V($w,{sources:Re,onPickRelease:e=>r(ag(Q.WATCH,{mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:e}))})]}),It?.picker?/* @__PURE__ */ V(zw,{pluginUri:It.picker.pluginUri,origin:It.id,name:It.name,uris:(It.releases??[]).map(e=>e.uri),playing:It.releases?.find(e=>e.active)?.uri,onPick:e=>{Lt(null),r(ag(Q.WATCH,{mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:e}))},onClose:()=>Lt(null)}):void 0,Ut?/* @__PURE__ */ V(Iq,{pluginUri:Ut.pluginUri,origin:Ut.origin,name:Ut.name,context:J.context,onPick:e=>{Wt(null),J.pickSubtitles(e)},onClose:()=>Wt(null)}):void 0,p&&!S?/* @__PURE__ */ W(`div`,{className:`watch-info episodes`,children:[/* @__PURE__ */ V(Dw,{seasons:gt?.seasons,currentUris:An?[An.uri]:_t,onPick:e=>On({uri:e,on:n.episodeUri})}),/* @__PURE__ */ W(`section`,{"data-episodes":!0,children:[/* @__PURE__ */ V(`h2`,{children:e.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),Pn?/* @__PURE__ */ V(PE,{media:Pn,tracked:Fn,current:An||ut<0?void 0:ut,mediaUri:jn??n.mediaUri,sourceOf:e=>e===m?h:Tt(qY(e.handles))},jn??n.mediaUri):/* @__PURE__ */ V(ME,{})]})]}):void 0]})};U();var tX=R`
7682
7686
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
7683
7687
  min-height: 100vh;
7684
7688
  max-width: 72rem;
@@ -7796,10 +7800,10 @@ scrollbar-gutter: stable;
7796
7800
  }
7797
7801
 
7798
7802
  .field input:focus { border-color: rgba(255, 255, 255, 0.4); }
7799
- `,eX=Ne({"not-found":{id:`That party has ended.`,defaultMessage:`That party has ended.`},"bad-key":{id:`The invite link is not valid.`,defaultMessage:`The invite link is not valid.`},invalid:{id:`The invite link is broken.`,defaultMessage:`The invite link is broken.`},full:{id:`The party is full.`,defaultMessage:`The party is full.`},blocked:{id:`You cannot join this party.`,defaultMessage:`You cannot join this party.`},unavailable:{id:`Parties are not available right now. Is FKN connected?`,defaultMessage:`Parties are not available right now. Is FKN connected?`}}),tX=()=>{let e=L(),t=LS(),[n]=K(()=>ua(location.hash,location.origin)),[r]=K(()=>location.hash.length>1&&!ua(location.hash,location.origin)),[i,a]=K([]),[o,s]=K(()=>Y.name()??``),[c,l]=K(!1),u=t.status===`active`;H(()=>{if(!n)return;let e=Y.getState();(e.status!==`joining`&&e.status!==`active`||e.invite!==n)&&Y.join(n)},[n]);let d=u?t.members:0;H(()=>{if(!u){a([]);return}let e=!1;return Y.roster().then(t=>{e||a(t)}),()=>{e=!0}},[u,d]),RS(e=>{e.t===`name`&&Y.roster().then(a)}),H(()=>{if(!c)return;let e=setTimeout(()=>l(!1),1500);return()=>clearTimeout(e)},[c]);let f=u?t.role===`host`?gu(la(location.origin,t.invite),pu(location.href),location.href):la(location.origin,t.invite):void 0,p=async()=>{if(f)try{await navigator.clipboard.writeText(f),l(!0)}catch{}},m=e.formatMessage({id:`Your name`,defaultMessage:`Your name`}),h=e.formatMessage({id:`Invite link`,defaultMessage:`Invite link`}),g=e=>{e.preventDefault(),Y.setName(li(o))},_=e.formatMessage({id:`This invite link is broken. Ask the host for a new one.`,defaultMessage:`This invite link is broken. Ask the host for a new one.`}),v=e.formatMessage({id:`Joining the party…`,defaultMessage:`Joining the party…`}),y=e.formatMessage({id:`The party ended.`,defaultMessage:`The party ended.`}),b=t.status===`failed`?e.formatMessage({id:`Could not join. {reason}`,defaultMessage:`Could not join. {reason}`},{reason:eX[t.code]?e.formatMessage(eX[t.code]):e.formatMessage({id:`Something went wrong.`,defaultMessage:`Something went wrong.`})}):void 0;return/* @__PURE__ */ W(`div`,{css:$Y,children:[/* @__PURE__ */ V(`h1`,{className:`heading`,children:e.formatMessage({id:`Watch party`,defaultMessage:`Watch party`})}),/* @__PURE__ */ W(`div`,{className:`status`,children:[r?_:!n&&!u&&t.status!==`joining`?t.status===`failed`?b:t.status===`ended`?y:e.formatMessage({id:`You are not in a party. Start one from the header.`,defaultMessage:`You are not in a party. Start one from the header.`}):!n&&t.status===`joining`?v:n&&!u?t.status===`joining`?v:t.status===`failed`?b:t.status===`ended`?y:_:u&&t.role===`guest`&&n?e.formatMessage({id:`You are in. Waiting for the host…`,defaultMessage:`You are in. Waiting for the host…`}):u&&t.role===`guest`?e.formatMessage({id:`You are following the host. <home>Go home</home>`,defaultMessage:`You are following the host. <home>Go home</home>`},{home:e=>/* @__PURE__ */ V(Uh,{to:ag(Q.HOME),children:e})}):e.formatMessage({id:`You are hosting.`,defaultMessage:`You are hosting.`}),!n&&!u&&t.status!==`joining`&&(t.status===`failed`||t.status===`ended`)?/* @__PURE__ */ W(q,{children:[` `,/* @__PURE__ */ V(`button`,{type:`button`,className:`action`,onClick:()=>Y.dismiss(),children:e.formatMessage({id:`OK`,defaultMessage:`OK`})})]}):null]}),u&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`div`,{className:`section`,children:[/* @__PURE__ */ V(`div`,{className:`label`,children:m}),/* @__PURE__ */ W(`form`,{className:`field`,onSubmit:g,children:[/* @__PURE__ */ V(`input`,{value:o,maxLength:32,placeholder:e.formatMessage({id:`What the party should call you`,defaultMessage:`What the party should call you`}),"aria-label":m,onInput:e=>s(e.currentTarget.value)}),/* @__PURE__ */ W(`button`,{type:`submit`,className:`action`,children:[/* @__PURE__ */ V(Nt,{size:14}),` `,e.formatMessage({id:`Save`,defaultMessage:`Save`})]})]})]}),/* @__PURE__ */ W(`div`,{className:`section`,children:[/* @__PURE__ */ V(`div`,{className:`label`,children:h}),/* @__PURE__ */ W(`div`,{className:`field`,children:[/* @__PURE__ */ V(`input`,{readOnly:!0,value:f,"aria-label":h,onFocus:e=>e.currentTarget.select()}),/* @__PURE__ */ W(`button`,{type:`button`,className:`action`,onClick:()=>{p()},children:[V(c?Nt:jt,{size:14}),` `,e.formatMessage({id:`Copy`,defaultMessage:`Copy`})]})]})]}),/* @__PURE__ */ W(`div`,{className:`section`,children:[/* @__PURE__ */ V(`div`,{className:`label`,children:e.formatMessage({id:`In the party ({count})`,defaultMessage:`In the party ({count})`},{count:i.length})}),i.map(n=>/* @__PURE__ */ W(`div`,{className:`row`,"data-member":n.id,children:[n.name?/* @__PURE__ */ V(`span`,{className:`name`,children:n.name}):null,/* @__PURE__ */ V(`span`,{className:`id`,title:n.id,children:n.id}),n.host&&/* @__PURE__ */ V(`span`,{className:`badge`,children:e.formatMessage({id:`host#the party's host`,defaultMessage:`host`,description:`the party's host`})}),n.self&&/* @__PURE__ */ V(`span`,{className:`badge you`,children:e.formatMessage({id:`you#the viewer, among the party`,defaultMessage:`you`,description:`the viewer, among the party`})}),t.role===`host`&&!n.self&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`button`,{type:`button`,className:`action danger`,onClick:()=>{Y.kick(n.id)},children:[/* @__PURE__ */ V(bx,{size:14}),` `,e.formatMessage({id:`Kick`,defaultMessage:`Kick`})]}),/* @__PURE__ */ W(`button`,{type:`button`,className:`action danger`,onClick:()=>{Y.ban(n.id)},children:[/* @__PURE__ */ V(Ub,{size:14}),` `,e.formatMessage({id:`Ban`,defaultMessage:`Ban`})]})]})]},n.id))]}),/* @__PURE__ */ V(`div`,{className:`section`,children:/* @__PURE__ */ W(`button`,{type:`button`,className:`action`,onClick:()=>{Y.leave()},children:[/* @__PURE__ */ V(sx,{size:14}),` `,t.role===`host`?e.formatMessage({id:`End party`,defaultMessage:`End party`}):e.formatMessage({id:`Leave party`,defaultMessage:`Leave party`})]})})]})]})},nX=e=>e.owned?`owned`:`placeholder`,rX=e=>{let t=[],n=/* @__PURE__ */ new Set;for(let r of e.members??[])r.uri&&!n.has(r.uri)&&(n.add(r.uri),t.push({uri:r.uri,kind:nX(r),origin:r.origin,scope:r.scope,title:r.title,episodeCount:r.episodeCount,startDate:r.startDate,member:r}));let r=[...(e.links??[]).flatMap(e=>[e.fromUri,e.toUri]),...(e.claims??[]).flatMap(e=>[e.fromUri,e.toUri])];for(let e of r)e&&!n.has(e)&&(n.add(e),t.push({uri:e,kind:`named`,origin:null,scope:null,title:null,episodeCount:null,startDate:null,member:null}));return t},iX=e=>{let t=rX(e),n=TO({nodes:t.map(e=>({uri:e.uri,titles:[{title:e.title??e.uri}],startDate:e.startDate})),edges:(e.links??[]).map(e=>({from:e.fromUri,to:e.toUri,relation:e.kind}))},`graph`),r=new Map(n.nodes.map(e=>[e.uri,e]));return{nodes:t.map(e=>({...e,column:r.get(e.uri)?.column??0,row:r.get(e.uri)?.row??0})),columns:n.columns,rows:n.rows}},aX=(e,t)=>[e,t].sort().join(` `),oX=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){let e=aX(n.fromUri,n.toUri),r=t.get(e)??[];r.push(n.key),t.set(e,r)}let n=/* @__PURE__ */ new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,{lane:r,lanes:e.length}));return n},sX=e=>{let t=/* @__PURE__ */ new Map;for(let n of e.links??[])t.set(n.key,{kind:`link`,row:n});for(let n of e.claims??[])t.set(n.key,{kind:`claim`,row:n});for(let n of e.episodeLinks??[])t.set(n.key,{kind:`episode-link`,row:n});for(let n of e.episodeClaims??[])t.set(n.key,{kind:`episode-claim`,row:n});for(let n of e.episodeSources??[])t.set(n.key,{kind:`episode-source`,row:n});return t},cX=/^[0-9a-f]{64}$/,lX=(e,t)=>(t??[]).map(t=>{let n=e.get(t)??null;return{key:t,ref:n,gap:n?null:cX.test(t)?`missing`:`not-an-edge-key`}}),uX=(e,t)=>(e.answers??[]).find(e=>e.seq===t)??null,dX=e=>e===null?null:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e),fX=e=>{if(e==null||e===``)return{kind:`absent`};let t;try{t=JSON.parse(e)}catch{return{kind:`raw`,raw:e}}return t===null?{kind:`fields`,fields:[{field:`value`,value:null}]}:typeof t==`object`&&!Array.isArray(t)?{kind:`fields`,fields:Object.entries(t).map(([e,t])=>({field:e,value:dX(t)}))}:{kind:`fields`,fields:[{field:Array.isArray(t)?`values`:`value`,value:dX(t)}]}},pX=e=>e===`not-enabled`?`The graph engine is switched off for this page, so there is nothing to read. Reloading with ?graph=1 turns it on, and this page then asks the sources about the uri itself. The only way a page gets here now is ?store=legacy, which pins it to the old store; dropping that flag puts the whole app back on the graph, which is the default.`:e===`graph-empty`?`The engine is on and the graph is empty. A graph is built inside one tab and never outlives it, so a link opened cold always starts here: what fills it is a page asking the sources, which is what this page does with the uri it was given.`:e===`no-row`?`No media row exists for that uri, so there is nothing to cluster. Either no source has answered for it in this tab yet, or the uri is not one any source recognises.`:e===`no-cluster`?`A media row exists for that uri, but no cluster holds it yet: either a pass has not run since it arrived, or it is a placeholder no pass will ever cluster on its own.`:`That uri reached no cluster, and the bundle carries no reason for it.`,mX=e=>e===`active`,hX=async(e,t,n={},r={})=>{let i=r.settleMs??2e4,a=await e(`http://d/graphql`,{method:`POST`,headers:{"content-type":`application/json`,accept:`application/json, text/event-stream`},body:JSON.stringify({query:t,variables:n})});if(!(a.headers.get(`content-type`)??``).includes(`event-stream`)){let e=await a.json();return r.onPayload?.(e,1),{payloads:1,last:e}}let o=a.body.getReader(),s=new TextDecoder,c=Date.now()+i,l=``,u=0,d,f=!1;for(;!f&&Date.now()<c;){let e=await Promise.race([o.read(),new Promise(e=>setTimeout(()=>e({done:!0,value:void 0}),Math.max(0,c-Date.now())))]);if(e.done)break;l+=s.decode(e.value,{stream:!0});let t=l.split(`
7803
+ `,nX=Ne({"not-found":{id:`That party has ended.`,defaultMessage:`That party has ended.`},"bad-key":{id:`The invite link is not valid.`,defaultMessage:`The invite link is not valid.`},invalid:{id:`The invite link is broken.`,defaultMessage:`The invite link is broken.`},full:{id:`The party is full.`,defaultMessage:`The party is full.`},blocked:{id:`You cannot join this party.`,defaultMessage:`You cannot join this party.`},unavailable:{id:`Parties are not available right now. Is FKN connected?`,defaultMessage:`Parties are not available right now. Is FKN connected?`}}),rX=()=>{let e=L(),t=LS(),[n]=K(()=>ua(location.hash,location.origin)),[r]=K(()=>location.hash.length>1&&!ua(location.hash,location.origin)),[i,a]=K([]),[o,s]=K(()=>Y.name()??``),[c,l]=K(!1),u=t.status===`active`;H(()=>{if(!n)return;let e=Y.getState();(e.status!==`joining`&&e.status!==`active`||e.invite!==n)&&Y.join(n)},[n]);let d=u?t.members:0;H(()=>{if(!u){a([]);return}let e=!1;return Y.roster().then(t=>{e||a(t)}),()=>{e=!0}},[u,d]),RS(e=>{e.t===`name`&&Y.roster().then(a)}),H(()=>{if(!c)return;let e=setTimeout(()=>l(!1),1500);return()=>clearTimeout(e)},[c]);let f=u?t.role===`host`?gu(la(location.origin,t.invite),pu(location.href),location.href):la(location.origin,t.invite):void 0,p=async()=>{if(f)try{await navigator.clipboard.writeText(f),l(!0)}catch{}},m=e.formatMessage({id:`Your name`,defaultMessage:`Your name`}),h=e.formatMessage({id:`Invite link`,defaultMessage:`Invite link`}),g=e=>{e.preventDefault(),Y.setName(li(o))},_=e.formatMessage({id:`This invite link is broken. Ask the host for a new one.`,defaultMessage:`This invite link is broken. Ask the host for a new one.`}),v=e.formatMessage({id:`Joining the party…`,defaultMessage:`Joining the party…`}),y=e.formatMessage({id:`The party ended.`,defaultMessage:`The party ended.`}),b=t.status===`failed`?e.formatMessage({id:`Could not join. {reason}`,defaultMessage:`Could not join. {reason}`},{reason:nX[t.code]?e.formatMessage(nX[t.code]):e.formatMessage({id:`Something went wrong.`,defaultMessage:`Something went wrong.`})}):void 0;return/* @__PURE__ */ W(`div`,{css:tX,children:[/* @__PURE__ */ V(`h1`,{className:`heading`,children:e.formatMessage({id:`Watch party`,defaultMessage:`Watch party`})}),/* @__PURE__ */ W(`div`,{className:`status`,children:[r?_:!n&&!u&&t.status!==`joining`?t.status===`failed`?b:t.status===`ended`?y:e.formatMessage({id:`You are not in a party. Start one from the header.`,defaultMessage:`You are not in a party. Start one from the header.`}):!n&&t.status===`joining`?v:n&&!u?t.status===`joining`?v:t.status===`failed`?b:t.status===`ended`?y:_:u&&t.role===`guest`&&n?e.formatMessage({id:`You are in. Waiting for the host…`,defaultMessage:`You are in. Waiting for the host…`}):u&&t.role===`guest`?e.formatMessage({id:`You are following the host. <home>Go home</home>`,defaultMessage:`You are following the host. <home>Go home</home>`},{home:e=>/* @__PURE__ */ V(Uh,{to:ag(Q.HOME),children:e})}):e.formatMessage({id:`You are hosting.`,defaultMessage:`You are hosting.`}),!n&&!u&&t.status!==`joining`&&(t.status===`failed`||t.status===`ended`)?/* @__PURE__ */ W(q,{children:[` `,/* @__PURE__ */ V(`button`,{type:`button`,className:`action`,onClick:()=>Y.dismiss(),children:e.formatMessage({id:`OK`,defaultMessage:`OK`})})]}):null]}),u&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`div`,{className:`section`,children:[/* @__PURE__ */ V(`div`,{className:`label`,children:m}),/* @__PURE__ */ W(`form`,{className:`field`,onSubmit:g,children:[/* @__PURE__ */ V(`input`,{value:o,maxLength:32,placeholder:e.formatMessage({id:`What the party should call you`,defaultMessage:`What the party should call you`}),"aria-label":m,onInput:e=>s(e.currentTarget.value)}),/* @__PURE__ */ W(`button`,{type:`submit`,className:`action`,children:[/* @__PURE__ */ V(Nt,{size:14}),` `,e.formatMessage({id:`Save`,defaultMessage:`Save`})]})]})]}),/* @__PURE__ */ W(`div`,{className:`section`,children:[/* @__PURE__ */ V(`div`,{className:`label`,children:h}),/* @__PURE__ */ W(`div`,{className:`field`,children:[/* @__PURE__ */ V(`input`,{readOnly:!0,value:f,"aria-label":h,onFocus:e=>e.currentTarget.select()}),/* @__PURE__ */ W(`button`,{type:`button`,className:`action`,onClick:()=>{p()},children:[V(c?Nt:jt,{size:14}),` `,e.formatMessage({id:`Copy`,defaultMessage:`Copy`})]})]})]}),/* @__PURE__ */ W(`div`,{className:`section`,children:[/* @__PURE__ */ V(`div`,{className:`label`,children:e.formatMessage({id:`In the party ({count})`,defaultMessage:`In the party ({count})`},{count:i.length})}),i.map(n=>/* @__PURE__ */ W(`div`,{className:`row`,"data-member":n.id,children:[n.name?/* @__PURE__ */ V(`span`,{className:`name`,children:n.name}):null,/* @__PURE__ */ V(`span`,{className:`id`,title:n.id,children:n.id}),n.host&&/* @__PURE__ */ V(`span`,{className:`badge`,children:e.formatMessage({id:`host#the party's host`,defaultMessage:`host`,description:`the party's host`})}),n.self&&/* @__PURE__ */ V(`span`,{className:`badge you`,children:e.formatMessage({id:`you#the viewer, among the party`,defaultMessage:`you`,description:`the viewer, among the party`})}),t.role===`host`&&!n.self&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`button`,{type:`button`,className:`action danger`,onClick:()=>{Y.kick(n.id)},children:[/* @__PURE__ */ V(bx,{size:14}),` `,e.formatMessage({id:`Kick`,defaultMessage:`Kick`})]}),/* @__PURE__ */ W(`button`,{type:`button`,className:`action danger`,onClick:()=>{Y.ban(n.id)},children:[/* @__PURE__ */ V(Ub,{size:14}),` `,e.formatMessage({id:`Ban`,defaultMessage:`Ban`})]})]})]},n.id))]}),/* @__PURE__ */ V(`div`,{className:`section`,children:/* @__PURE__ */ W(`button`,{type:`button`,className:`action`,onClick:()=>{Y.leave()},children:[/* @__PURE__ */ V(sx,{size:14}),` `,t.role===`host`?e.formatMessage({id:`End party`,defaultMessage:`End party`}):e.formatMessage({id:`Leave party`,defaultMessage:`Leave party`})]})})]})]})},iX=e=>e.owned?`owned`:`placeholder`,aX=e=>{let t=[],n=/* @__PURE__ */ new Set;for(let r of e.members??[])r.uri&&!n.has(r.uri)&&(n.add(r.uri),t.push({uri:r.uri,kind:iX(r),origin:r.origin,scope:r.scope,title:r.title,episodeCount:r.episodeCount,startDate:r.startDate,member:r}));let r=[...(e.links??[]).flatMap(e=>[e.fromUri,e.toUri]),...(e.claims??[]).flatMap(e=>[e.fromUri,e.toUri])];for(let e of r)e&&!n.has(e)&&(n.add(e),t.push({uri:e,kind:`named`,origin:null,scope:null,title:null,episodeCount:null,startDate:null,member:null}));return t},oX=e=>{let t=aX(e),n=TO({nodes:t.map(e=>({uri:e.uri,titles:[{title:e.title??e.uri}],startDate:e.startDate})),edges:(e.links??[]).map(e=>({from:e.fromUri,to:e.toUri,relation:e.kind}))},`graph`),r=new Map(n.nodes.map(e=>[e.uri,e]));return{nodes:t.map(e=>({...e,column:r.get(e.uri)?.column??0,row:r.get(e.uri)?.row??0})),columns:n.columns,rows:n.rows}},sX=(e,t)=>[e,t].sort().join(` `),cX=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){let e=sX(n.fromUri,n.toUri),r=t.get(e)??[];r.push(n.key),t.set(e,r)}let n=/* @__PURE__ */ new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,{lane:r,lanes:e.length}));return n},lX=e=>{let t=/* @__PURE__ */ new Map;for(let n of e.links??[])t.set(n.key,{kind:`link`,row:n});for(let n of e.claims??[])t.set(n.key,{kind:`claim`,row:n});for(let n of e.episodeLinks??[])t.set(n.key,{kind:`episode-link`,row:n});for(let n of e.episodeClaims??[])t.set(n.key,{kind:`episode-claim`,row:n});for(let n of e.episodeSources??[])t.set(n.key,{kind:`episode-source`,row:n});return t},uX=/^[0-9a-f]{64}$/,dX=(e,t)=>(t??[]).map(t=>{let n=e.get(t)??null;return{key:t,ref:n,gap:n?null:uX.test(t)?`missing`:`not-an-edge-key`}}),fX=(e,t)=>(e.answers??[]).find(e=>e.seq===t)??null,pX=e=>e===null?null:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e),mX=e=>{if(e==null||e===``)return{kind:`absent`};let t;try{t=JSON.parse(e)}catch{return{kind:`raw`,raw:e}}return t===null?{kind:`fields`,fields:[{field:`value`,value:null}]}:typeof t==`object`&&!Array.isArray(t)?{kind:`fields`,fields:Object.entries(t).map(([e,t])=>({field:e,value:pX(t)}))}:{kind:`fields`,fields:[{field:Array.isArray(t)?`values`:`value`,value:pX(t)}]}},hX=e=>e===`not-enabled`?`The graph engine is switched off for this page, so there is nothing to read. Reloading with ?graph=1 turns it on, and this page then asks the sources about the uri itself. The only way a page gets here now is ?store=legacy, which pins it to the old store; dropping that flag puts the whole app back on the graph, which is the default.`:e===`graph-empty`?`The engine is on and the graph is empty. A graph is built inside one tab and never outlives it, so a link opened cold always starts here: what fills it is a page asking the sources, which is what this page does with the uri it was given.`:e===`no-row`?`No media row exists for that uri, so there is nothing to cluster. Either no source has answered for it in this tab yet, or the uri is not one any source recognises.`:e===`no-cluster`?`A media row exists for that uri, but no cluster holds it yet: either a pass has not run since it arrived, or it is a placeholder no pass will ever cluster on its own.`:`That uri reached no cluster, and the bundle carries no reason for it.`,gX=e=>e===`active`,_X=async(e,t,n={},r={})=>{let i=r.settleMs??2e4,a=await e(`http://d/graphql`,{method:`POST`,headers:{"content-type":`application/json`,accept:`application/json, text/event-stream`},body:JSON.stringify({query:t,variables:n})});if(!(a.headers.get(`content-type`)??``).includes(`event-stream`)){let e=await a.json();return r.onPayload?.(e,1),{payloads:1,last:e}}let o=a.body.getReader(),s=new TextDecoder,c=Date.now()+i,l=``,u=0,d,f=!1;for(;!f&&Date.now()<c;){let e=await Promise.race([o.read(),new Promise(e=>setTimeout(()=>e({done:!0,value:void 0}),Math.max(0,c-Date.now())))]);if(e.done)break;l+=s.decode(e.value,{stream:!0});let t=l.split(`
7800
7804
 
7801
7805
  `);l=t.pop()??``;for(let e of t){let t=e.split(`
7802
- `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trim()).join(``);if(t){try{d=JSON.parse(t),u+=1}catch{continue}if(r.onPayload?.(d,u),r.done?.(d,u)){f=!0;break}}}}return o.cancel().catch(()=>{}),{payloads:u,last:d}},gX=`
7806
+ `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trim()).join(``);if(t){try{d=JSON.parse(t),u+=1}catch{continue}if(r.onPayload?.(d,u),r.done?.(d,u)){f=!0;break}}}}return o.cancel().catch(()=>{}),{payloads:u,last:d}},vX=`
7803
7807
  subscription TraceWarm($input: MediaInput!) {
7804
7808
  media(input: $input) {
7805
7809
  _id
@@ -7833,12 +7837,12 @@ scrollbar-gutter: stable;
7833
7837
  }
7834
7838
  }
7835
7839
  }
7836
- `,_X=(e,t)=>{let n=e?.data?.media;return{payloads:t,uri:typeof n?.uri==`string`?n.uri:null,handles:Array.isArray(n?.handles)?n.handles.length:0,episodes:Array.isArray(n?.episodes)?n.episodes.length:0}},vX=async(e,{onProgress:t,settleMs:n=25e3}={})=>{let r={payloads:0,uri:null,handles:0,episodes:0};if(!e)return r;try{let i=await import(`./assets/lib-worker-BwYVdaU4.js`);if(typeof i.handleRequest!=`function`)return r;await hX(i.handleRequest,gX,{input:{uri:e}},{settleMs:n,onPayload:(e,n)=>{r=_X(e,n),t?.(r)}})}catch(e){console.error(Error(`graph trace: the warm could not ask the sources`,{cause:e}))}return r},yX=R`
7840
+ `,yX=(e,t)=>{let n=e?.data?.media;return{payloads:t,uri:typeof n?.uri==`string`?n.uri:null,handles:Array.isArray(n?.handles)?n.handles.length:0,episodes:Array.isArray(n?.episodes)?n.episodes.length:0}},bX=async(e,{onProgress:t,settleMs:n=25e3}={})=>{let r={payloads:0,uri:null,handles:0,episodes:0};if(!e)return r;try{let i=await import(`./assets/lib-worker-CEeb8mNR.js`);if(typeof i.handleRequest!=`function`)return r;await _X(i.handleRequest,vX,{input:{uri:e}},{settleMs:n,onPayload:(e,n)=>{r=yX(e,n),t?.(r)}})}catch(e){console.error(Error(`graph trace: the warm could not ask the sources`,{cause:e}))}return r},xX=R`
7837
7841
  &.nothing {
7838
7842
  color: rgb(250, 204, 21);
7839
7843
  font-style: italic;
7840
7844
  }
7841
- `,bX=({value:e})=>e===null?/* @__PURE__ */ V(`span`,{css:yX,className:`nothing`,children:`null`}):e===void 0?/* @__PURE__ */ V(`span`,{css:yX,className:`nothing`,children:`absent`}):e===``?/* @__PURE__ */ V(`span`,{css:yX,className:`nothing`,children:`empty`}):/* @__PURE__ */ V(`span`,{css:yX,children:String(e)}),xX=R`
7845
+ `,SX=({value:e})=>e===null?/* @__PURE__ */ V(`span`,{css:xX,className:`nothing`,children:`null`}):e===void 0?/* @__PURE__ */ V(`span`,{css:xX,className:`nothing`,children:`absent`}):e===``?/* @__PURE__ */ V(`span`,{css:xX,className:`nothing`,children:`empty`}):/* @__PURE__ */ V(`span`,{css:xX,children:String(e)}),CX=R`
7842
7846
  .fields {
7843
7847
  width: 100%;
7844
7848
  border-collapse: collapse;
@@ -7871,7 +7875,7 @@ scrollbar-gutter: stable;
7871
7875
  white-space: pre-wrap;
7872
7876
  overflow-wrap: anywhere;
7873
7877
  }
7874
- `,SX=({blob:e,label:t})=>/* @__PURE__ */ W(`div`,{css:xX,className:`blob`,"data-blob":t,children:[e.kind===`absent`&&/* @__PURE__ */ V(`div`,{className:`absent`,children:/* @__PURE__ */ V(bX,{value:null})}),e.kind===`raw`&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`div`,{className:`note`,children:`not JSON, shown as it is stored`}),/* @__PURE__ */ V(`pre`,{className:`raw`,children:e.raw})]}),e.kind===`fields`&&/* @__PURE__ */ V(`table`,{className:`fields`,children:/* @__PURE__ */ V(`tbody`,{children:e.fields.map(e=>/* @__PURE__ */ W(`tr`,{"data-field":e.field,children:[/* @__PURE__ */ V(`th`,{scope:`row`,children:e.field}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(bX,{value:e.value})})]},e.field))})})]}),CX=88,wX=20,TX=36,EX=266,DX=76,OX=e=>[e.member?`${e.kind} ${e.member.via===`member`?`member`:`claimed`}`:`named by an edge`,e.origin??`no origin`,e.scope??`no scope`].join(` · `),kX=(e,t)=>{let n=e.find(e=>e.key===t);return new Set(n?[n.fromUri,n.toUri]:[])},AX=(e,t)=>{let n=iX(e),r=e.links??[],i=oX(r),a=kX(r,t),o=new Set(n.nodes.map(e=>e.uri));return{nodes:n.nodes.map(e=>({id:e.uri,type:`trace`,position:{x:TX+e.column*EX,y:TX+e.row*DX},width:178,height:56,draggable:!1,selectable:!1,data:{uri:e.uri,kind:e.kind,title:e.title,meta:OX(e),lit:a.has(e.uri)}})),edges:r.filter(e=>o.has(e.fromUri)&&o.has(e.toUri)).map(e=>{let n=i.get(e.key)??{lane:0,lanes:1};return{id:e.key,type:`trace`,source:e.fromUri,target:e.toUri,selected:e.key===t,data:{spread:(n.lane-(n.lanes-1)/2)*26,active:mX(e.status),status:e.status,label:e.kind,tooltip:`${e.kind} ${e.status} by ${e.by}: ${e.reason}`}}}),width:Math.max(1,n.columns)*EX-CX+72,height:Math.max(1,n.rows)*DX-wX+72}};U();var jX=R`
7878
+ `,wX=({blob:e,label:t})=>/* @__PURE__ */ W(`div`,{css:CX,className:`blob`,"data-blob":t,children:[e.kind===`absent`&&/* @__PURE__ */ V(`div`,{className:`absent`,children:/* @__PURE__ */ V(SX,{value:null})}),e.kind===`raw`&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`div`,{className:`note`,children:`not JSON, shown as it is stored`}),/* @__PURE__ */ V(`pre`,{className:`raw`,children:e.raw})]}),e.kind===`fields`&&/* @__PURE__ */ V(`table`,{className:`fields`,children:/* @__PURE__ */ V(`tbody`,{children:e.fields.map(e=>/* @__PURE__ */ W(`tr`,{"data-field":e.field,children:[/* @__PURE__ */ V(`th`,{scope:`row`,children:e.field}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(SX,{value:e.value})})]},e.field))})})]}),TX=88,EX=20,DX=36,OX=266,kX=76,AX=e=>[e.member?`${e.kind} ${e.member.via===`member`?`member`:`claimed`}`:`named by an edge`,e.origin??`no origin`,e.scope??`no scope`].join(` · `),jX=(e,t)=>{let n=e.find(e=>e.key===t);return new Set(n?[n.fromUri,n.toUri]:[])},MX=(e,t)=>{let n=oX(e),r=e.links??[],i=cX(r),a=jX(r,t),o=new Set(n.nodes.map(e=>e.uri));return{nodes:n.nodes.map(e=>({id:e.uri,type:`trace`,position:{x:DX+e.column*OX,y:DX+e.row*kX},width:178,height:56,draggable:!1,selectable:!1,data:{uri:e.uri,kind:e.kind,title:e.title,meta:AX(e),lit:a.has(e.uri)}})),edges:r.filter(e=>o.has(e.fromUri)&&o.has(e.toUri)).map(e=>{let n=i.get(e.key)??{lane:0,lanes:1};return{id:e.key,type:`trace`,source:e.fromUri,target:e.toUri,selected:e.key===t,data:{spread:(n.lane-(n.lanes-1)/2)*26,active:gX(e.status),status:e.status,label:e.kind,tooltip:`${e.kind} ${e.status} by ${e.by}: ${e.reason}`}}}),width:Math.max(1,n.columns)*OX-TX+72,height:Math.max(1,n.rows)*kX-EX+72}};U();var NX=R`
7875
7879
  position: relative;
7876
7880
  height: 46rem;
7877
7881
  border: 1px solid rgba(255, 255, 255, 0.12);
@@ -7943,7 +7947,7 @@ scrollbar-gutter: stable;
7943
7947
  .edge-label.active { fill: rgb(134, 239, 172); }
7944
7948
  .edge-label.refused { fill: rgb(252, 165, 165); }
7945
7949
  .cross { stroke: rgb(248, 113, 113); stroke-width: 1.5; }
7946
- `,MX=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,NX=({data:e})=>/* @__PURE__ */ W(`div`,{className:`trace-node ${e.kind}${e.lit?` lit`:``}`,"data-node":e.uri,"data-kind":e.kind,title:`${e.uri} (${e.kind})`,children:[/* @__PURE__ */ V(Tz,{type:`target`,position:$.Left}),/* @__PURE__ */ V(`div`,{className:`uri`,children:MX(e.uri,26)}),/* @__PURE__ */ V(`div`,{children:e.title===null?`no title`:MX(e.title,28)}),/* @__PURE__ */ V(`div`,{className:`meta`,children:MX(e.meta,34)}),/* @__PURE__ */ V(Tz,{type:`source`,position:$.Right})]}),PX=({data:e,selected:t,sourceX:n,sourceY:r,targetX:i,targetY:a})=>{let o=e?.spread??0,s=e?.active?`active`:`refused`,c=i>=n,l=Math.max(20,Math.abs(i-n)/2)*(c?1:-1),u=`M ${n} ${r} C ${n+l} ${r+o}, ${i-l} ${a+o}, ${i} ${a}`,d=(n+i)/2,f=(r+a)/2+o*.75;return/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`path`,{className:`edge ${s}${t?` selected`:``}`,d:u}),/* @__PURE__ */ V(`path`,{className:`edge-hit`,d:u,children:/* @__PURE__ */ V(`title`,{children:e?.tooltip})}),s===`refused`?/* @__PURE__ */ W(`g`,{className:`cross-mark`,children:[/* @__PURE__ */ V(`path`,{className:`cross`,d:`M ${d-5} ${f-5} L ${d+5} ${f+5}`}),/* @__PURE__ */ V(`path`,{className:`cross`,d:`M ${d+5} ${f-5} L ${d-5} ${f+5}`})]}):null,/* @__PURE__ */ V(`text`,{className:`edge-label ${s}`,x:d,y:f-9,textAnchor:`middle`,children:MX(e?.label??``,22)})]})},FX={trace:NX},IX={trace:PX},LX=({bundle:e,selected:t,onSelect:n})=>{let{nodes:r,edges:i}=B(()=>AX(e,t),[e,t]),a=wt((e,t)=>n(t.id),[n]);return/* @__PURE__ */ W(`div`,{css:jX,"data-trace-graph":!0,children:[/* @__PURE__ */ W(`div`,{className:`legend`,children:[/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`b`,{children:`solid`}),` owned: its origin described it`]}),/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`b`,{children:`dashed yellow`}),` placeholder: no origin has`]}),/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`b`,{children:`dotted`}),` named by an edge only`]}),/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`b`,{children:`green line`}),` active link`]}),/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`b`,{children:`red dashed, crossed`}),` refused link`]})]}),/* @__PURE__ */ V(iV,{nodes:r,edges:i,nodeTypes:FX,edgeTypes:IX,onEdgeClick:a,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,fitView:!0,minZoom:.05,maxZoom:20,"aria-label":`Every uri this cluster names, and every link between them`,children:/* @__PURE__ */ V(hV,{variant:dV.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.12)`})})]})};U();var RX=R`
7950
+ `,PX=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,FX=({data:e})=>/* @__PURE__ */ W(`div`,{className:`trace-node ${e.kind}${e.lit?` lit`:``}`,"data-node":e.uri,"data-kind":e.kind,title:`${e.uri} (${e.kind})`,children:[/* @__PURE__ */ V(Tz,{type:`target`,position:$.Left}),/* @__PURE__ */ V(`div`,{className:`uri`,children:PX(e.uri,26)}),/* @__PURE__ */ V(`div`,{children:e.title===null?`no title`:PX(e.title,28)}),/* @__PURE__ */ V(`div`,{className:`meta`,children:PX(e.meta,34)}),/* @__PURE__ */ V(Tz,{type:`source`,position:$.Right})]}),IX=({data:e,selected:t,sourceX:n,sourceY:r,targetX:i,targetY:a})=>{let o=e?.spread??0,s=e?.active?`active`:`refused`,c=i>=n,l=Math.max(20,Math.abs(i-n)/2)*(c?1:-1),u=`M ${n} ${r} C ${n+l} ${r+o}, ${i-l} ${a+o}, ${i} ${a}`,d=(n+i)/2,f=(r+a)/2+o*.75;return/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`path`,{className:`edge ${s}${t?` selected`:``}`,d:u}),/* @__PURE__ */ V(`path`,{className:`edge-hit`,d:u,children:/* @__PURE__ */ V(`title`,{children:e?.tooltip})}),s===`refused`?/* @__PURE__ */ W(`g`,{className:`cross-mark`,children:[/* @__PURE__ */ V(`path`,{className:`cross`,d:`M ${d-5} ${f-5} L ${d+5} ${f+5}`}),/* @__PURE__ */ V(`path`,{className:`cross`,d:`M ${d+5} ${f-5} L ${d-5} ${f+5}`})]}):null,/* @__PURE__ */ V(`text`,{className:`edge-label ${s}`,x:d,y:f-9,textAnchor:`middle`,children:PX(e?.label??``,22)})]})},LX={trace:FX},RX={trace:IX},zX=({bundle:e,selected:t,onSelect:n})=>{let{nodes:r,edges:i}=B(()=>MX(e,t),[e,t]),a=wt((e,t)=>n(t.id),[n]);return/* @__PURE__ */ W(`div`,{css:NX,"data-trace-graph":!0,children:[/* @__PURE__ */ W(`div`,{className:`legend`,children:[/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`b`,{children:`solid`}),` owned: its origin described it`]}),/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`b`,{children:`dashed yellow`}),` placeholder: no origin has`]}),/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`b`,{children:`dotted`}),` named by an edge only`]}),/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`b`,{children:`green line`}),` active link`]}),/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`b`,{children:`red dashed, crossed`}),` refused link`]})]}),/* @__PURE__ */ V(iV,{nodes:r,edges:i,nodeTypes:LX,edgeTypes:RX,onEdgeClick:a,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,fitView:!0,minZoom:.05,maxZoom:20,"aria-label":`Every uri this cluster names, and every link between them`,children:/* @__PURE__ */ V(hV,{variant:dV.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.12)`})})]})};U();var BX=R`
7947
7951
  border: 1px solid rgba(255, 255, 255, 0.12);
7948
7952
  border-radius: 0.5rem;
7949
7953
  padding: 1rem 1.2rem;
@@ -8043,7 +8047,7 @@ scrollbar-gutter: stable;
8043
8047
  }
8044
8048
 
8045
8049
  .empty { color: rgba(255, 255, 255, 0.5); }
8046
- `,zX=e=>e.kind===`link`?`link ${e.row.kind} ${e.row.status} by ${e.row.by}`:e.kind===`episode-link`?`episode link ${e.row.kind} ${e.row.status} by ${e.row.by}`:e.kind===`claim`?`claim ${e.row.kind} from ${e.row.claimer}`:e.kind===`episode-source`?`episode list from ${e.row.claimer}`:`episode claim ${e.row.kind} from ${e.row.claimer}`,BX=e=>e===`not-an-edge-key`?`not an edge key`:`not in this bundle`,VX=e=>{if(e==null)return``;if(typeof e==`string`)return e;if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(e instanceof ArrayBuffer)return new TextDecoder().decode(new Uint8Array(e));if(typeof e==`object`&&typeof e.raw==`string`)return e.raw;try{return JSON.stringify(e,null,2)}catch{return String(e)}},HX=({rows:e})=>/* @__PURE__ */ V(`table`,{className:`facts`,children:/* @__PURE__ */ V(`tbody`,{children:e.map(([e,t])=>/* @__PURE__ */ W(`tr`,{"data-fact":e,children:[/* @__PURE__ */ V(`th`,{scope:`row`,children:e}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(bX,{value:t})})]},e))})}),UX=({bundle:e,seq:t,answer:n,onLoad:r})=>{let i=uX(e,t);return/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`h4`,{children:[`answer `,t]}),i?/* @__PURE__ */ V(HX,{rows:[[`uri`,i.uri],[`origin`,i.origin],[`operation`,i.operation],[`bytes`,i.bytes]]}):/* @__PURE__ */ V(`p`,{className:`empty`,"data-no-answer-row":!0,children:`The bundle lists no answer with that sequence.`}),/* @__PURE__ */ V(`button`,{type:`button`,className:`load`,onClick:()=>r(t),children:`Load answer bytes`}),n?.seq===t&&/* @__PURE__ */ W(`div`,{className:`answer`,"data-answer":!0,children:[n.state===`loading`&&/* @__PURE__ */ V(`p`,{className:`empty`,children:`loading…`}),n.state===`failed`&&/* @__PURE__ */ V(`p`,{className:`failed`,children:n.text}),n.state===`done`&&(n.text===``?/* @__PURE__ */ V(`p`,{className:`empty`,children:`nothing came back for that sequence.`}):/* @__PURE__ */ V(`pre`,{children:n.text}))]})]})},WX=({bundle:e,index:t,trail:n,onFollow:r,onTrailTo:i,loadAnswerBytes:a})=>{let[o,s]=K(void 0),c=n[n.length-1],l=c===void 0?void 0:t.get(c),u=lX(t,l&&(l.kind===`link`||l.kind===`episode-link`)?l.row.supports:[]),d=e=>{s({seq:e,state:`loading`,text:``}),a(e).then(t=>s({seq:e,state:`done`,text:VX(t)})).catch(t=>s({seq:e,state:`failed`,text:t instanceof Error?t.message:String(t)}))};return/* @__PURE__ */ W(`div`,{css:RX,"data-inspector":!0,children:[/* @__PURE__ */ V(`h3`,{children:`Edge inspector`}),c===void 0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`Select a link in the graph, or any row in the tables below.`}):/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`div`,{className:`trail`,children:[n.slice(0,-1).map((e,n)=>/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>i(n),children:t.get(e)?zX(t.get(e)):e},e)),/* @__PURE__ */ V(`span`,{className:`here`,children:l?zX(l):c})]}),l===void 0?/* @__PURE__ */ W(`p`,{className:`empty`,"data-unknown-row":!0,children:[`The bundle carries no row with the key `,/* @__PURE__ */ V(`code`,{children:c}),`.`]}):/* @__PURE__ */ W(q,{children:[(l.kind===`link`||l.kind===`episode-link`)&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(HX,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`written by`,l.row.by],[`rule`,l.row.reason]]}),/* @__PURE__ */ W(`p`,{children:[`status`,` `,/* @__PURE__ */ V(`span`,{className:`status ${mX(l.row.status)?`active`:`refused`}`,children:l.row.status})]}),/* @__PURE__ */ V(HX,{rows:l.kind===`link`?[[`confidence`,l.row.confidence],[`version`,l.row.version]]:[[`from number`,l.row.fromNumber],[`to number`,l.row.toNumber]]}),/* @__PURE__ */ V(`h4`,{children:`evidence`}),/* @__PURE__ */ V(SX,{blob:fX(l.row.evidence),label:`evidence`}),l.kind===`link`&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`h4`,{children:`gates`}),/* @__PURE__ */ V(SX,{blob:fX(l.row.gates),label:`gates`})]})]}),(l.kind===`claim`||l.kind===`episode-claim`)&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(HX,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`claimed by`,l.row.claimer],[`provenance`,l.row.provenance],[`answer seq`,l.row.answerSeq],...l.kind===`claim`?[[`target scope`,l.row.targetScope]]:[]]}),/* @__PURE__ */ V(UX,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),l.kind===`episode-source`&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(HX,{rows:[[`media`,l.row.fromUri],[`episode`,l.row.toUri],[`listed by`,l.row.claimer],[`answer seq`,l.row.answerSeq]]}),/* @__PURE__ */ V(UX,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),/* @__PURE__ */ V(`h4`,{children:`supports`}),l.kind===`claim`||l.kind===`episode-claim`||l.kind===`episode-source`?/* @__PURE__ */ V(`p`,{className:`empty`,children:`This row is source truth: it is derived from nothing.`}):u.length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`This row names no supports.`}):/* @__PURE__ */ V(`div`,{className:`supports`,children:u.map(e=>/* @__PURE__ */ W(`div`,{className:`support`,"data-gap":e.gap??void 0,children:[e.ref?/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>r(e.key),children:`Follow`}):/* @__PURE__ */ V(`span`,{className:`unresolved`,children:BX(e.gap)}),/* @__PURE__ */ V(`span`,{className:`what`,children:e.ref?zX(e.ref):`unresolved`}),/* @__PURE__ */ V(`span`,{className:`key`,children:e.key})]},e.key))})]})]})]})},GX=R`
8050
+ `,VX=e=>e.kind===`link`?`link ${e.row.kind} ${e.row.status} by ${e.row.by}`:e.kind===`episode-link`?`episode link ${e.row.kind} ${e.row.status} by ${e.row.by}`:e.kind===`claim`?`claim ${e.row.kind} from ${e.row.claimer}`:e.kind===`episode-source`?`episode list from ${e.row.claimer}`:`episode claim ${e.row.kind} from ${e.row.claimer}`,HX=e=>e===`not-an-edge-key`?`not an edge key`:`not in this bundle`,UX=e=>{if(e==null)return``;if(typeof e==`string`)return e;if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(e instanceof ArrayBuffer)return new TextDecoder().decode(new Uint8Array(e));if(typeof e==`object`&&typeof e.raw==`string`)return e.raw;try{return JSON.stringify(e,null,2)}catch{return String(e)}},WX=({rows:e})=>/* @__PURE__ */ V(`table`,{className:`facts`,children:/* @__PURE__ */ V(`tbody`,{children:e.map(([e,t])=>/* @__PURE__ */ W(`tr`,{"data-fact":e,children:[/* @__PURE__ */ V(`th`,{scope:`row`,children:e}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(SX,{value:t})})]},e))})}),GX=({bundle:e,seq:t,answer:n,onLoad:r})=>{let i=fX(e,t);return/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`h4`,{children:[`answer `,t]}),i?/* @__PURE__ */ V(WX,{rows:[[`uri`,i.uri],[`origin`,i.origin],[`operation`,i.operation],[`bytes`,i.bytes]]}):/* @__PURE__ */ V(`p`,{className:`empty`,"data-no-answer-row":!0,children:`The bundle lists no answer with that sequence.`}),/* @__PURE__ */ V(`button`,{type:`button`,className:`load`,onClick:()=>r(t),children:`Load answer bytes`}),n?.seq===t&&/* @__PURE__ */ W(`div`,{className:`answer`,"data-answer":!0,children:[n.state===`loading`&&/* @__PURE__ */ V(`p`,{className:`empty`,children:`loading…`}),n.state===`failed`&&/* @__PURE__ */ V(`p`,{className:`failed`,children:n.text}),n.state===`done`&&(n.text===``?/* @__PURE__ */ V(`p`,{className:`empty`,children:`nothing came back for that sequence.`}):/* @__PURE__ */ V(`pre`,{children:n.text}))]})]})},KX=({bundle:e,index:t,trail:n,onFollow:r,onTrailTo:i,loadAnswerBytes:a})=>{let[o,s]=K(void 0),c=n[n.length-1],l=c===void 0?void 0:t.get(c),u=dX(t,l&&(l.kind===`link`||l.kind===`episode-link`)?l.row.supports:[]),d=e=>{s({seq:e,state:`loading`,text:``}),a(e).then(t=>s({seq:e,state:`done`,text:UX(t)})).catch(t=>s({seq:e,state:`failed`,text:t instanceof Error?t.message:String(t)}))};return/* @__PURE__ */ W(`div`,{css:BX,"data-inspector":!0,children:[/* @__PURE__ */ V(`h3`,{children:`Edge inspector`}),c===void 0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`Select a link in the graph, or any row in the tables below.`}):/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ W(`div`,{className:`trail`,children:[n.slice(0,-1).map((e,n)=>/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>i(n),children:t.get(e)?VX(t.get(e)):e},e)),/* @__PURE__ */ V(`span`,{className:`here`,children:l?VX(l):c})]}),l===void 0?/* @__PURE__ */ W(`p`,{className:`empty`,"data-unknown-row":!0,children:[`The bundle carries no row with the key `,/* @__PURE__ */ V(`code`,{children:c}),`.`]}):/* @__PURE__ */ W(q,{children:[(l.kind===`link`||l.kind===`episode-link`)&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(WX,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`written by`,l.row.by],[`rule`,l.row.reason]]}),/* @__PURE__ */ W(`p`,{children:[`status`,` `,/* @__PURE__ */ V(`span`,{className:`status ${gX(l.row.status)?`active`:`refused`}`,children:l.row.status})]}),/* @__PURE__ */ V(WX,{rows:l.kind===`link`?[[`confidence`,l.row.confidence],[`version`,l.row.version]]:[[`from number`,l.row.fromNumber],[`to number`,l.row.toNumber]]}),/* @__PURE__ */ V(`h4`,{children:`evidence`}),/* @__PURE__ */ V(wX,{blob:mX(l.row.evidence),label:`evidence`}),l.kind===`link`&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(`h4`,{children:`gates`}),/* @__PURE__ */ V(wX,{blob:mX(l.row.gates),label:`gates`})]})]}),(l.kind===`claim`||l.kind===`episode-claim`)&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(WX,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`claimed by`,l.row.claimer],[`provenance`,l.row.provenance],[`answer seq`,l.row.answerSeq],...l.kind===`claim`?[[`target scope`,l.row.targetScope]]:[]]}),/* @__PURE__ */ V(GX,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),l.kind===`episode-source`&&/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(WX,{rows:[[`media`,l.row.fromUri],[`episode`,l.row.toUri],[`listed by`,l.row.claimer],[`answer seq`,l.row.answerSeq]]}),/* @__PURE__ */ V(GX,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),/* @__PURE__ */ V(`h4`,{children:`supports`}),l.kind===`claim`||l.kind===`episode-claim`||l.kind===`episode-source`?/* @__PURE__ */ V(`p`,{className:`empty`,children:`This row is source truth: it is derived from nothing.`}):u.length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`This row names no supports.`}):/* @__PURE__ */ V(`div`,{className:`supports`,children:u.map(e=>/* @__PURE__ */ W(`div`,{className:`support`,"data-gap":e.gap??void 0,children:[e.ref?/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>r(e.key),children:`Follow`}):/* @__PURE__ */ V(`span`,{className:`unresolved`,children:HX(e.gap)}),/* @__PURE__ */ V(`span`,{className:`what`,children:e.ref?VX(e.ref):`unresolved`}),/* @__PURE__ */ V(`span`,{className:`key`,children:e.key})]},e.key))})]})]})]})},qX=R`
8047
8051
  table {
8048
8052
  width: 100%;
8049
8053
  border-collapse: collapse;
@@ -8096,7 +8100,7 @@ scrollbar-gutter: stable;
8096
8100
  .status.active { color: rgb(74, 222, 128); }
8097
8101
  .status.refused { color: rgb(248, 113, 113); }
8098
8102
  .empty { color: rgba(255, 255, 255, 0.5); font-size: 1.2rem; }
8099
- `,KX=({fill:e,index:t,onSelect:n})=>{let r=lX(t,e.supports);return r.length===0?/* @__PURE__ */ V(`div`,{className:`proof`,children:/* @__PURE__ */ V(`span`,{className:`missing`,"data-no-proof":!0,children:`${e.via} names no proving pair`})}):/* @__PURE__ */ V(q,{children:r.map(e=>{let t=e.ref?.kind===`episode-link`?e.ref.row:void 0;return/* @__PURE__ */ W(`div`,{className:`proof`,children:[/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>n(e.key),children:`Inspect`}),t?/* @__PURE__ */ V(`span`,{className:`pair`,children:`${t.fromUri} #${t.fromNumber??`null`} to ${t.toUri} #${t.toNumber??`null`}`}):/* @__PURE__ */ V(`span`,{className:`pair`,children:e.ref?`${zX(e.ref)} ${e.key}`:/* @__PURE__ */ V(`span`,{className:`missing`,children:`${e.key}: ${BX(e.gap)}`})}),t&&/* @__PURE__ */ V(`span`,{className:`status ${mX(t.status)?`active`:`refused`}`,children:t.status})]},e.key)})})},qX=({bundle:e,index:t,selected:n,onSelect:r})=>/* @__PURE__ */ W(`div`,{css:GX,"data-episodes":!0,children:[(e.episodes??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`This cluster holds no slots.`}):/* @__PURE__ */ W(`table`,{"data-slots":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`slot`}),/* @__PURE__ */ V(`th`,{children:`number`}),/* @__PURE__ */ V(`th`,{children:`title`}),/* @__PURE__ */ V(`th`,{children:`fills`})]})}),/* @__PURE__ */ V(`tbody`,{children:e.episodes.map(e=>/* @__PURE__ */ W(`tr`,{"data-slot":e.slotId,children:[/* @__PURE__ */ V(`td`,{className:`slot`,children:e.slotId}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(bX,{value:e.number})}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(bX,{value:e.title})}),/* @__PURE__ */ V(`td`,{children:e.fills.length===0?/* @__PURE__ */ V(`span`,{className:`empty`,children:`nothing fills this slot`}):e.fills.map(e=>/* @__PURE__ */ W(`div`,{"data-fill":e.episodeUri,children:[/* @__PURE__ */ W(`div`,{className:`fill`,children:[/* @__PURE__ */ V(`span`,{className:`uri`,children:e.episodeUri}),/* @__PURE__ */ W(`span`,{children:[`#`,/* @__PURE__ */ V(bX,{value:e.number})]}),/* @__PURE__ */ V(`span`,{children:e.origin}),/* @__PURE__ */ V(`span`,{className:`via`,children:e.via}),/* @__PURE__ */ V(`span`,{className:`by`,children:e.by})]}),/* @__PURE__ */ V(KX,{fill:e,index:t,onSelect:r})]},`${e.episodeUri}\u0000${e.via}`))})]},e.slotId))})]}),/* @__PURE__ */ V(`h3`,{children:`Episode edges`}),(e.episodeLinks??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`No episode links, refused or otherwise.`}):/* @__PURE__ */ W(`table`,{"data-episode-links":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`from`}),/* @__PURE__ */ V(`th`,{children:`to`}),/* @__PURE__ */ V(`th`,{children:`kind`}),/* @__PURE__ */ V(`th`,{children:`status`}),/* @__PURE__ */ V(`th`,{children:`by`}),/* @__PURE__ */ V(`th`,{children:`rule`}),/* @__PURE__ */ V(`th`,{})]})}),/* @__PURE__ */ V(`tbody`,{children:e.episodeLinks.map(e=>/* @__PURE__ */ W(`tr`,{"data-episode-link":e.key,"data-status":e.status,className:n===e.key?`selected`:void 0,children:[/* @__PURE__ */ V(`td`,{className:`uri`,children:`${e.fromUri} #${e.fromNumber??`null`}`}),/* @__PURE__ */ V(`td`,{className:`uri`,children:`${e.toUri} #${e.toNumber??`null`}`}),/* @__PURE__ */ V(`td`,{children:e.kind}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`span`,{className:`status ${mX(e.status)?`active`:`refused`}`,children:e.status})}),/* @__PURE__ */ V(`td`,{children:e.by}),/* @__PURE__ */ V(`td`,{children:e.reason}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ V(`h3`,{children:`Episode claims`}),(e.episodeClaims??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`no episode level claims`}):/* @__PURE__ */ W(`table`,{"data-episode-claims":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`from`}),/* @__PURE__ */ V(`th`,{children:`to`}),/* @__PURE__ */ V(`th`,{children:`kind`}),/* @__PURE__ */ V(`th`,{children:`claimer`}),/* @__PURE__ */ V(`th`,{children:`provenance`}),/* @__PURE__ */ V(`th`,{children:`answer`}),/* @__PURE__ */ V(`th`,{})]})}),/* @__PURE__ */ V(`tbody`,{children:e.episodeClaims.map(e=>/* @__PURE__ */ W(`tr`,{"data-episode-claim":e.key,className:n===e.key?`selected`:void 0,children:[/* @__PURE__ */ V(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ V(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ V(`td`,{children:e.kind}),/* @__PURE__ */ V(`td`,{children:e.claimer}),/* @__PURE__ */ V(`td`,{children:e.provenance}),/* @__PURE__ */ V(`td`,{children:e.answerSeq}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]})]});U();var JX=R`
8103
+ `,JX=({fill:e,index:t,onSelect:n})=>{let r=dX(t,e.supports);return r.length===0?/* @__PURE__ */ V(`div`,{className:`proof`,children:/* @__PURE__ */ V(`span`,{className:`missing`,"data-no-proof":!0,children:`${e.via} names no proving pair`})}):/* @__PURE__ */ V(q,{children:r.map(e=>{let t=e.ref?.kind===`episode-link`?e.ref.row:void 0;return/* @__PURE__ */ W(`div`,{className:`proof`,children:[/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>n(e.key),children:`Inspect`}),t?/* @__PURE__ */ V(`span`,{className:`pair`,children:`${t.fromUri} #${t.fromNumber??`null`} to ${t.toUri} #${t.toNumber??`null`}`}):/* @__PURE__ */ V(`span`,{className:`pair`,children:e.ref?`${VX(e.ref)} ${e.key}`:/* @__PURE__ */ V(`span`,{className:`missing`,children:`${e.key}: ${HX(e.gap)}`})}),t&&/* @__PURE__ */ V(`span`,{className:`status ${gX(t.status)?`active`:`refused`}`,children:t.status})]},e.key)})})},YX=({bundle:e,index:t,selected:n,onSelect:r})=>/* @__PURE__ */ W(`div`,{css:qX,"data-episodes":!0,children:[(e.episodes??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`This cluster holds no slots.`}):/* @__PURE__ */ W(`table`,{"data-slots":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`slot`}),/* @__PURE__ */ V(`th`,{children:`number`}),/* @__PURE__ */ V(`th`,{children:`title`}),/* @__PURE__ */ V(`th`,{children:`fills`})]})}),/* @__PURE__ */ V(`tbody`,{children:e.episodes.map(e=>/* @__PURE__ */ W(`tr`,{"data-slot":e.slotId,children:[/* @__PURE__ */ V(`td`,{className:`slot`,children:e.slotId}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(SX,{value:e.number})}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(SX,{value:e.title})}),/* @__PURE__ */ V(`td`,{children:e.fills.length===0?/* @__PURE__ */ V(`span`,{className:`empty`,children:`nothing fills this slot`}):e.fills.map(e=>/* @__PURE__ */ W(`div`,{"data-fill":e.episodeUri,children:[/* @__PURE__ */ W(`div`,{className:`fill`,children:[/* @__PURE__ */ V(`span`,{className:`uri`,children:e.episodeUri}),/* @__PURE__ */ W(`span`,{children:[`#`,/* @__PURE__ */ V(SX,{value:e.number})]}),/* @__PURE__ */ V(`span`,{children:e.origin}),/* @__PURE__ */ V(`span`,{className:`via`,children:e.via}),/* @__PURE__ */ V(`span`,{className:`by`,children:e.by})]}),/* @__PURE__ */ V(JX,{fill:e,index:t,onSelect:r})]},`${e.episodeUri}\u0000${e.via}`))})]},e.slotId))})]}),/* @__PURE__ */ V(`h3`,{children:`Episode edges`}),(e.episodeLinks??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`No episode links, refused or otherwise.`}):/* @__PURE__ */ W(`table`,{"data-episode-links":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`from`}),/* @__PURE__ */ V(`th`,{children:`to`}),/* @__PURE__ */ V(`th`,{children:`kind`}),/* @__PURE__ */ V(`th`,{children:`status`}),/* @__PURE__ */ V(`th`,{children:`by`}),/* @__PURE__ */ V(`th`,{children:`rule`}),/* @__PURE__ */ V(`th`,{})]})}),/* @__PURE__ */ V(`tbody`,{children:e.episodeLinks.map(e=>/* @__PURE__ */ W(`tr`,{"data-episode-link":e.key,"data-status":e.status,className:n===e.key?`selected`:void 0,children:[/* @__PURE__ */ V(`td`,{className:`uri`,children:`${e.fromUri} #${e.fromNumber??`null`}`}),/* @__PURE__ */ V(`td`,{className:`uri`,children:`${e.toUri} #${e.toNumber??`null`}`}),/* @__PURE__ */ V(`td`,{children:e.kind}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`span`,{className:`status ${gX(e.status)?`active`:`refused`}`,children:e.status})}),/* @__PURE__ */ V(`td`,{children:e.by}),/* @__PURE__ */ V(`td`,{children:e.reason}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ V(`h3`,{children:`Episode claims`}),(e.episodeClaims??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`no episode level claims`}):/* @__PURE__ */ W(`table`,{"data-episode-claims":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`from`}),/* @__PURE__ */ V(`th`,{children:`to`}),/* @__PURE__ */ V(`th`,{children:`kind`}),/* @__PURE__ */ V(`th`,{children:`claimer`}),/* @__PURE__ */ V(`th`,{children:`provenance`}),/* @__PURE__ */ V(`th`,{children:`answer`}),/* @__PURE__ */ V(`th`,{})]})}),/* @__PURE__ */ V(`tbody`,{children:e.episodeClaims.map(e=>/* @__PURE__ */ W(`tr`,{"data-episode-claim":e.key,className:n===e.key?`selected`:void 0,children:[/* @__PURE__ */ V(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ V(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ V(`td`,{children:e.kind}),/* @__PURE__ */ V(`td`,{children:e.claimer}),/* @__PURE__ */ V(`td`,{children:e.provenance}),/* @__PURE__ */ V(`td`,{children:e.answerSeq}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]})]});U();var XX=R`
8100
8104
  max-width: 150rem;
8101
8105
  margin: calc(var(--stub-header-height) + 2rem) auto 6rem;
8102
8106
  padding: 0 1.5rem;
@@ -8206,7 +8210,7 @@ scrollbar-gutter: stable;
8206
8210
 
8207
8211
  .columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
8208
8212
  @media (max-width: 900px) { .columns { grid-template-columns: 1fr; } }
8209
- `,YX=1500,XX=({label:e,value:t})=>/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`span`,{className:`label`,children:e}),/* @__PURE__ */ V(`code`,{children:/* @__PURE__ */ V(bX,{value:t})})]}),ZX=({reason:e})=>e===`null`?/* @__PURE__ */ V(`code`,{className:`token`,"data-token-reason":!0,children:`"null"`}):/* @__PURE__ */ V(bX,{value:e}),QX=({load:e=rO,loadAnswerBytes:t=iO,warm:n=vX})=>{let r=Ih(),[,i]=Fh(),a=pO(r),[o,s]=K(a),[c,l]=K({kind:`idle`}),[u,d]=K(0),[f,p]=K({kind:`off`}),[m,h]=K([]),g=G(``),_=G(void 0);H(()=>{s(a),h([]),p({kind:`off`}),g.current=``,_.current!==void 0&&clearTimeout(_.current),_.current=void 0},[a]),H(()=>{if(!a){l({kind:`idle`});return}let t=!0;return l(e=>e.kind===`done`?e:{kind:`loading`}),e(a).then(e=>{t&&l({kind:`done`,bundle:e})}).catch(e=>{t&&l({kind:`failed`,error:e instanceof Error?e.message:String(e)})}),()=>{t=!1}},[a,u]);let v=c.kind===`done`?c.bundle:void 0,y=B(()=>v?sX(v):/* @__PURE__ */ new Map,[v]),b=m[m.length-1],x=!(!v||v.resolved||v.reason===`not-enabled`);return H(()=>{if(!a||!x||g.current===a)return;g.current=a;let e=a,t=()=>g.current===e,r=()=>{_.current===void 0&&(_.current=setTimeout(()=>{_.current=void 0,t()&&d(e=>e+1)},YX))};p({kind:`asking`,progress:{payloads:0,uri:null,handles:0,episodes:0}}),n(a,{onProgress:e=>{t()&&(p({kind:`asking`,progress:e}),r())}}).then(e=>{t()&&(p({kind:`done`,progress:e}),d(e=>e+1))}).catch(()=>{t()&&p({kind:`off`})})},[a,x]),H(()=>()=>{g.current=``,_.current!==void 0&&clearTimeout(_.current)},[]),/* @__PURE__ */ W(`div`,{css:JX,dir:`ltr`,"data-debug-trace":!0,children:[/* @__PURE__ */ V(`h1`,{children:`Graph trace`}),/* @__PURE__ */ V(`p`,{className:`intro`,children:`Everything the graph holds for one cluster: its members, every link between them including the refused ones, the episodes it resolved to, and the answer each edge came from. Nothing here is derived, and a value the graph does not carry shows as null. The graph is built inside this tab, so a uri nothing has asked about yet is asked about here first, which is what makes this url worth pasting into a bug report.`}),/* @__PURE__ */ W(`form`,{className:`ask`,onSubmit:e=>{e.preventDefault();let t=o.trim();t&&(d(e=>e+1),i(oO({uri:t})))},children:[/* @__PURE__ */ V(`input`,{type:`text`,autoComplete:`off`,spellcheck:!1,placeholder:`ag:(mal:39535,anilist:101280), or a member uri like mal:39535, or a cluster id like cl:...`,value:o,onInput:e=>s(e.target.value)}),/* @__PURE__ */ V(`button`,{type:`submit`,children:`Trace`})]}),c.kind===`idle`&&/* @__PURE__ */ V(`p`,{className:`empty`,children:`Give it a uri. It rides in the url, so this page can be linked into a bug report.`}),f.kind!==`off`&&/* @__PURE__ */ V(`p`,{className:f.kind===`asking`?`warming`:`warming done`,"data-warming":f.kind,"data-answered":f.progress.payloads,children:f.kind===`asking`?`asking the sources about ${a}: ${f.progress.payloads} answer(s) so far, ${f.progress.handles} handle(s), ${f.progress.episodes} episode(s). Every source is asked, so a cold graph takes tens of seconds. The panel fills as they answer and stops waiting on its own.`:f.progress.payloads===0?`nothing answered about ${a}. Every source was asked and none returned a row, so the graph stayed empty: either no source recognises that uri, or every one of them refused it. Nothing is still loading.`:`the sources have stopped answering about ${a}: ${f.progress.payloads} answer(s), ${f.progress.handles} handle(s), ${f.progress.episodes} episode(s). What is below is what that produced.`}),c.kind===`loading`&&/* @__PURE__ */ W(`p`,{className:`empty`,"data-loading":!0,children:[`tracing `,a,`…`]}),c.kind===`failed`&&/* @__PURE__ */ V(`p`,{className:`failed`,"data-failed":!0,children:c.error}),v&&/* @__PURE__ */ W(q,{children:[v.resolved?/* @__PURE__ */ W(`div`,{className:`resolved`,"data-resolved":!0,children:[/* @__PURE__ */ W(`div`,{className:`pairs`,children:[/* @__PURE__ */ V(XX,{label:`asked`,value:v.asked}),/* @__PURE__ */ V(XX,{label:`cluster`,value:v.resolved.clusterId}),/* @__PURE__ */ V(XX,{label:`aggregate`,value:v.resolved.aggUri}),/* @__PURE__ */ V(XX,{label:`scope`,value:v.resolved.scope}),/* @__PURE__ */ V(XX,{label:`kind`,value:v.resolved.kind})]}),(v.resolved.otherClusters??[]).length>0&&/* @__PURE__ */ W(`div`,{className:`split`,"data-other-clusters":!0,children:[`This address also reaches`,` `,v.resolved.otherClusters.length,` other cluster(s), whose members are not below:`,` `,v.resolved.otherClusters.map(e=>/* @__PURE__ */ V(`a`,{href:oO({uri:e,search:r}),children:/* @__PURE__ */ V(`code`,{children:e})},e))]})]}):/* @__PURE__ */ W(`div`,{className:`unresolved`,"data-unresolved":!0,"data-reason":v.reason??`none`,children:[/* @__PURE__ */ V(`div`,{className:`why`,children:pX(v.reason)}),v.reason===`not-enabled`&&/* @__PURE__ */ W(`div`,{className:`advice`,children:[/* @__PURE__ */ V(`a`,{"data-reload-graph":!0,href:cO(r),children:`Reload with ?graph=1`}),` or `,/* @__PURE__ */ V(`a`,{"data-reload-store":!0,href:lO(r),children:`drop ?store=legacy`}),`, keeping this uri.`]}),/* @__PURE__ */ W(`div`,{className:`pairs`,children:[/* @__PURE__ */ V(XX,{label:`asked`,value:v.asked}),/* @__PURE__ */ V(XX,{label:`reason`,value:v.reason??null})]})]}),/* @__PURE__ */ W(`div`,{className:`pairs`,"data-run-length":!0,children:[/* @__PURE__ */ V(XX,{label:`run length`,value:v.runLength?.value??null}),/* @__PURE__ */ V(XX,{label:`from`,value:v.runLength?.from??null}),/* @__PURE__ */ V(XX,{label:`tier`,value:v.runLength?.tier??null}),/* @__PURE__ */ V(XX,{label:`witnesses`,value:v.runLength?.witnesses??null})]}),/* @__PURE__ */ W(`div`,{className:`pairs`,"data-cost":!0,children:[/* @__PURE__ */ V(XX,{label:`statements`,value:v.cost?.statements??null}),/* @__PURE__ */ V(XX,{label:`ms to build`,value:v.cost?.ms??null})]}),/* @__PURE__ */ V(`h3`,{children:`Graph counts`}),/* @__PURE__ */ V(`div`,{className:`chips`,"data-counts":!0,children:Object.entries(v.counts??{}).length===0?/* @__PURE__ */ V(`span`,{className:`empty`,children:`the bundle carries no counts`}):Object.entries(v.counts).map(([e,t])=>/* @__PURE__ */ V(`span`,{className:`chip`,children:`${e} ${t}`},e))}),/* @__PURE__ */ W(`div`,{className:`columns`,children:[/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`h3`,{children:`Anomalies`}),(v.anomalies??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`no rule complained`}):/* @__PURE__ */ V(`table`,{"data-anomalies":!0,children:/* @__PURE__ */ V(`tbody`,{children:v.anomalies.map((e,t)=>/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`td`,{children:e.rule}),/* @__PURE__ */ V(`td`,{children:e.detail})]},`${e.rule} ${e.detail} ${t}`))})})]}),/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`h3`,{children:`Asks`}),(v.asks??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`nothing was asked of any origin`}):/* @__PURE__ */ W(`table`,{"data-asks":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`seq`}),/* @__PURE__ */ V(`th`,{children:`origin`}),/* @__PURE__ */ V(`th`,{children:`outcome`}),/* @__PURE__ */ V(`th`,{children:`reason`})]})}),/* @__PURE__ */ V(`tbody`,{children:v.asks.map((e,t)=>/* @__PURE__ */ W(`tr`,{"data-ask":e.origin,children:[/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(bX,{value:e.seq??null})}),/* @__PURE__ */ V(`td`,{children:e.origin}),/* @__PURE__ */ V(`td`,{children:e.outcome}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(ZX,{reason:e.reason})})]},`${e.origin} ${e.seq??t}`))})]})]})]}),/* @__PURE__ */ V(`h2`,{children:`Media graph`}),/* @__PURE__ */ V(LX,{bundle:v,selected:b,onSelect:e=>h([e])}),/* @__PURE__ */ V(`h3`,{children:`Links`}),(v.links??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`no links, refused or otherwise`}):/* @__PURE__ */ W(`table`,{"data-links":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`from`}),/* @__PURE__ */ V(`th`,{children:`to`}),/* @__PURE__ */ V(`th`,{children:`kind`}),/* @__PURE__ */ V(`th`,{children:`status`}),/* @__PURE__ */ V(`th`,{children:`by`}),/* @__PURE__ */ V(`th`,{children:`rule`}),/* @__PURE__ */ V(`th`,{children:`confidence`}),/* @__PURE__ */ V(`th`,{})]})}),/* @__PURE__ */ V(`tbody`,{children:v.links.map(e=>/* @__PURE__ */ W(`tr`,{"data-link":e.key,"data-status":e.status,className:b===e.key?`selected`:void 0,children:[/* @__PURE__ */ V(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ V(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ V(`td`,{children:e.kind}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`span`,{className:`status ${mX(e.status)?`active`:`refused`}`,children:e.status})}),/* @__PURE__ */ V(`td`,{children:e.by}),/* @__PURE__ */ V(`td`,{children:e.reason}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(bX,{value:e.confidence})}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ V(`h3`,{children:`Claims`}),(v.claims??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`no claims between the uris this bundle names`}):/* @__PURE__ */ W(`table`,{"data-claims":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`from`}),/* @__PURE__ */ V(`th`,{children:`to`}),/* @__PURE__ */ V(`th`,{children:`kind`}),/* @__PURE__ */ V(`th`,{children:`claimer`}),/* @__PURE__ */ V(`th`,{children:`provenance`}),/* @__PURE__ */ V(`th`,{children:`answer`}),/* @__PURE__ */ V(`th`,{children:`target scope`}),/* @__PURE__ */ V(`th`,{})]})}),/* @__PURE__ */ V(`tbody`,{children:v.claims.map(e=>/* @__PURE__ */ W(`tr`,{"data-claim":e.key,className:b===e.key?`selected`:void 0,children:[/* @__PURE__ */ V(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ V(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ V(`td`,{children:e.kind}),/* @__PURE__ */ V(`td`,{children:e.claimer}),/* @__PURE__ */ V(`td`,{children:e.provenance}),/* @__PURE__ */ V(`td`,{children:e.answerSeq}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(bX,{value:e.targetScope})}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ V(`h3`,{children:`Attachments`}),(v.attachments??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`no run is attached to a container here`}):/* @__PURE__ */ W(`table`,{"data-attachments":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`run`}),/* @__PURE__ */ V(`th`,{children:`container`}),/* @__PURE__ */ V(`th`,{children:`via`}),/* @__PURE__ */ V(`th`,{children:`by`}),/* @__PURE__ */ V(`th`,{children:`evidence`}),/* @__PURE__ */ V(`th`,{children:`supports`})]})}),/* @__PURE__ */ V(`tbody`,{children:v.attachments.map(e=>/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`td`,{className:`uri`,children:e.runUri}),/* @__PURE__ */ V(`td`,{className:`uri`,children:e.containerUri}),/* @__PURE__ */ V(`td`,{children:e.via}),/* @__PURE__ */ V(`td`,{children:e.by}),/* @__PURE__ */ V(`td`,{className:`uri`,children:/* @__PURE__ */ V(bX,{value:e.evidence})}),/* @__PURE__ */ V(`td`,{children:(e.supports??[]).length===0?/* @__PURE__ */ V(bX,{value:null}):e.supports.map(e=>/* @__PURE__ */ V(`button`,{type:`button`,className:`inspect`,"data-attachment-support":e,onClick:()=>h([e]),children:e},e))})]},`${e.runUri} ${e.containerUri} ${e.via} ${e.by}`))})]}),/* @__PURE__ */ V(`h2`,{children:`Episodes`}),/* @__PURE__ */ V(qX,{bundle:v,index:y,selected:b,onSelect:e=>h([e])}),/* @__PURE__ */ V(`h2`,{children:`Inspector`}),/* @__PURE__ */ V(WX,{bundle:v,index:y,trail:m,onFollow:e=>h(t=>[...t,e]),onTrailTo:e=>h(t=>t.slice(0,e+1)),loadAnswerBytes:t})]})]})},$X=`[data-party-scroll]`,eZ=()=>{let e=document.querySelectorAll($X);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.scrollHeight-n.clientHeight>0)return n}},tZ=(e,t)=>t>0?Math.min(1,Math.max(0,e/t)):0,nZ=()=>{let e=eZ();return e?Math.max(0,e.scrollHeight-e.clientHeight):Math.max(0,document.documentElement.scrollHeight-window.innerHeight)},rZ=()=>{let e=eZ();return e?tZ(e.scrollTop,e.scrollHeight-e.clientHeight):tZ(window.scrollY,document.documentElement.scrollHeight-window.innerHeight)},iZ=()=>{try{return window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0}catch{return!1}},aZ=(e,t,n)=>!e||iZ()?`instant`:t<=n*2?`smooth`:`instant`,oZ=(e,{smooth:t}={})=>{let n=eZ();if(n){let r=n.scrollHeight-n.clientHeight,i=r>0?e*r:0;n.scrollTo({top:i,behavior:aZ(t,Math.abs(i-n.scrollTop),n.clientHeight)});return}let r=document.documentElement.scrollHeight-window.innerHeight,i=r>0?e*r:0;window.scrollTo({top:i,behavior:aZ(t,Math.abs(i-window.scrollY),window.innerHeight)})};U();var sZ=2,cZ=8e3,lZ=[`wheel`,`touchstart`,`keydown`,`pointerdown`],uZ=60,dZ=()=>{let e=LS(),[t,n]=Fh(),r=Ih(),i=mu(r?`${t}?${r}`:t),a=e.status===`active`?e.role:void 0,o=t===ca,s=t===ag(Q.SEARCH),c=yi(t);H(()=>{if(a!==`host`||o)return;let e=()=>{Y.setLocation(i,c?0:rZ()),Y.send({t:`nav`,path:i})};if(!s)return e();let t=setTimeout(e,350);return()=>clearTimeout(t)},[a,i,o]),H(()=>{if(a!==`host`||o||c)return;let e=0,t,n=()=>{t=void 0,e=Date.now();let n=rZ();Y.setLocation(i,n),Y.send({t:`scroll`,y:n})},r=()=>{if(t)return;let r=Math.max(0,1e3/sZ-(Date.now()-e));t=setTimeout(n,r)};return document.addEventListener(`scroll`,r,{passive:!0,capture:!0}),()=>{document.removeEventListener(`scroll`,r,{capture:!0}),t&&clearTimeout(t)}},[a,i]);let l=G(void 0),u=G(0);H(()=>{if(l.current===void 0)return;let e=l.current;l.current=void 0;let t=0,n=-1,r=0,i=!1,a=u.current,o=Date.now()+cZ,s=()=>{i=!0};for(let e of lZ)document.addEventListener(e,s,{passive:!0});let c=()=>{cancelAnimationFrame(t);for(let e of lZ)document.removeEventListener(e,s)};if(SS(),e===0)return oZ(0),c;let d=()=>{let s=nZ();s===n?r+=1:(r=0,n=s);let l=s>0&&r>=uZ;if(i||u.current!==a||l||Date.now()>o)return c();oZ(e),t=requestAnimationFrame(d)};return t=requestAnimationFrame(d),c},[i]);let d=G(!1),f=e.status===`active`?e.invite:void 0;H(()=>{d.current=!1},[f]);let p=(e,t)=>{d.current=!0,e===i?(SS(),u.current+=1,oZ(t,{smooth:!0})):(l.current=t,n(e))};return RS((e,{replayed:t})=>{if(a===`host`)e.t===`ask`&&e.c===`go`&&e.path!==i&&n(e.path);else if(a===`guest`)switch(e.t){case`nav`:d.current=!0,e.path!==i&&n(e.path);return;case`scroll`:Y.hostPath()===i&&(SS(),u.current+=1,oZ(e.y,{smooth:!0}));return;case`state`:(!d.current||t)&&p(e.path,e.y);return}}),null};U();var fZ=4,pZ=2500,mZ=R`
8213
+ `,ZX=1500,QX=({label:e,value:t})=>/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`span`,{className:`label`,children:e}),/* @__PURE__ */ V(`code`,{children:/* @__PURE__ */ V(SX,{value:t})})]}),$X=({reason:e})=>e===`null`?/* @__PURE__ */ V(`code`,{className:`token`,"data-token-reason":!0,children:`"null"`}):/* @__PURE__ */ V(SX,{value:e}),eZ=({load:e=rO,loadAnswerBytes:t=iO,warm:n=bX})=>{let r=Ih(),[,i]=Fh(),a=pO(r),[o,s]=K(a),[c,l]=K({kind:`idle`}),[u,d]=K(0),[f,p]=K({kind:`off`}),[m,h]=K([]),g=G(``),_=G(void 0);H(()=>{s(a),h([]),p({kind:`off`}),g.current=``,_.current!==void 0&&clearTimeout(_.current),_.current=void 0},[a]),H(()=>{if(!a){l({kind:`idle`});return}let t=!0;return l(e=>e.kind===`done`?e:{kind:`loading`}),e(a).then(e=>{t&&l({kind:`done`,bundle:e})}).catch(e=>{t&&l({kind:`failed`,error:e instanceof Error?e.message:String(e)})}),()=>{t=!1}},[a,u]);let v=c.kind===`done`?c.bundle:void 0,y=B(()=>v?lX(v):/* @__PURE__ */ new Map,[v]),b=m[m.length-1],x=!(!v||v.resolved||v.reason===`not-enabled`);return H(()=>{if(!a||!x||g.current===a)return;g.current=a;let e=a,t=()=>g.current===e,r=()=>{_.current===void 0&&(_.current=setTimeout(()=>{_.current=void 0,t()&&d(e=>e+1)},ZX))};p({kind:`asking`,progress:{payloads:0,uri:null,handles:0,episodes:0}}),n(a,{onProgress:e=>{t()&&(p({kind:`asking`,progress:e}),r())}}).then(e=>{t()&&(p({kind:`done`,progress:e}),d(e=>e+1))}).catch(()=>{t()&&p({kind:`off`})})},[a,x]),H(()=>()=>{g.current=``,_.current!==void 0&&clearTimeout(_.current)},[]),/* @__PURE__ */ W(`div`,{css:XX,dir:`ltr`,"data-debug-trace":!0,children:[/* @__PURE__ */ V(`h1`,{children:`Graph trace`}),/* @__PURE__ */ V(`p`,{className:`intro`,children:`Everything the graph holds for one cluster: its members, every link between them including the refused ones, the episodes it resolved to, and the answer each edge came from. Nothing here is derived, and a value the graph does not carry shows as null. The graph is built inside this tab, so a uri nothing has asked about yet is asked about here first, which is what makes this url worth pasting into a bug report.`}),/* @__PURE__ */ W(`form`,{className:`ask`,onSubmit:e=>{e.preventDefault();let t=o.trim();t&&(d(e=>e+1),i(oO({uri:t})))},children:[/* @__PURE__ */ V(`input`,{type:`text`,autoComplete:`off`,spellcheck:!1,placeholder:`ag:(mal:39535,anilist:101280), or a member uri like mal:39535, or a cluster id like cl:...`,value:o,onInput:e=>s(e.target.value)}),/* @__PURE__ */ V(`button`,{type:`submit`,children:`Trace`})]}),c.kind===`idle`&&/* @__PURE__ */ V(`p`,{className:`empty`,children:`Give it a uri. It rides in the url, so this page can be linked into a bug report.`}),f.kind!==`off`&&/* @__PURE__ */ V(`p`,{className:f.kind===`asking`?`warming`:`warming done`,"data-warming":f.kind,"data-answered":f.progress.payloads,children:f.kind===`asking`?`asking the sources about ${a}: ${f.progress.payloads} answer(s) so far, ${f.progress.handles} handle(s), ${f.progress.episodes} episode(s). Every source is asked, so a cold graph takes tens of seconds. The panel fills as they answer and stops waiting on its own.`:f.progress.payloads===0?`nothing answered about ${a}. Every source was asked and none returned a row, so the graph stayed empty: either no source recognises that uri, or every one of them refused it. Nothing is still loading.`:`the sources have stopped answering about ${a}: ${f.progress.payloads} answer(s), ${f.progress.handles} handle(s), ${f.progress.episodes} episode(s). What is below is what that produced.`}),c.kind===`loading`&&/* @__PURE__ */ W(`p`,{className:`empty`,"data-loading":!0,children:[`tracing `,a,`…`]}),c.kind===`failed`&&/* @__PURE__ */ V(`p`,{className:`failed`,"data-failed":!0,children:c.error}),v&&/* @__PURE__ */ W(q,{children:[v.resolved?/* @__PURE__ */ W(`div`,{className:`resolved`,"data-resolved":!0,children:[/* @__PURE__ */ W(`div`,{className:`pairs`,children:[/* @__PURE__ */ V(QX,{label:`asked`,value:v.asked}),/* @__PURE__ */ V(QX,{label:`cluster`,value:v.resolved.clusterId}),/* @__PURE__ */ V(QX,{label:`aggregate`,value:v.resolved.aggUri}),/* @__PURE__ */ V(QX,{label:`scope`,value:v.resolved.scope}),/* @__PURE__ */ V(QX,{label:`kind`,value:v.resolved.kind})]}),(v.resolved.otherClusters??[]).length>0&&/* @__PURE__ */ W(`div`,{className:`split`,"data-other-clusters":!0,children:[`This address also reaches`,` `,v.resolved.otherClusters.length,` other cluster(s), whose members are not below:`,` `,v.resolved.otherClusters.map(e=>/* @__PURE__ */ V(`a`,{href:oO({uri:e,search:r}),children:/* @__PURE__ */ V(`code`,{children:e})},e))]})]}):/* @__PURE__ */ W(`div`,{className:`unresolved`,"data-unresolved":!0,"data-reason":v.reason??`none`,children:[/* @__PURE__ */ V(`div`,{className:`why`,children:hX(v.reason)}),v.reason===`not-enabled`&&/* @__PURE__ */ W(`div`,{className:`advice`,children:[/* @__PURE__ */ V(`a`,{"data-reload-graph":!0,href:cO(r),children:`Reload with ?graph=1`}),` or `,/* @__PURE__ */ V(`a`,{"data-reload-store":!0,href:lO(r),children:`drop ?store=legacy`}),`, keeping this uri.`]}),/* @__PURE__ */ W(`div`,{className:`pairs`,children:[/* @__PURE__ */ V(QX,{label:`asked`,value:v.asked}),/* @__PURE__ */ V(QX,{label:`reason`,value:v.reason??null})]})]}),/* @__PURE__ */ W(`div`,{className:`pairs`,"data-run-length":!0,children:[/* @__PURE__ */ V(QX,{label:`run length`,value:v.runLength?.value??null}),/* @__PURE__ */ V(QX,{label:`from`,value:v.runLength?.from??null}),/* @__PURE__ */ V(QX,{label:`tier`,value:v.runLength?.tier??null}),/* @__PURE__ */ V(QX,{label:`witnesses`,value:v.runLength?.witnesses??null})]}),/* @__PURE__ */ W(`div`,{className:`pairs`,"data-cost":!0,children:[/* @__PURE__ */ V(QX,{label:`statements`,value:v.cost?.statements??null}),/* @__PURE__ */ V(QX,{label:`ms to build`,value:v.cost?.ms??null})]}),/* @__PURE__ */ V(`h3`,{children:`Graph counts`}),/* @__PURE__ */ V(`div`,{className:`chips`,"data-counts":!0,children:Object.entries(v.counts??{}).length===0?/* @__PURE__ */ V(`span`,{className:`empty`,children:`the bundle carries no counts`}):Object.entries(v.counts).map(([e,t])=>/* @__PURE__ */ V(`span`,{className:`chip`,children:`${e} ${t}`},e))}),/* @__PURE__ */ W(`div`,{className:`columns`,children:[/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`h3`,{children:`Anomalies`}),(v.anomalies??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`no rule complained`}):/* @__PURE__ */ V(`table`,{"data-anomalies":!0,children:/* @__PURE__ */ V(`tbody`,{children:v.anomalies.map((e,t)=>/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`td`,{children:e.rule}),/* @__PURE__ */ V(`td`,{children:e.detail})]},`${e.rule} ${e.detail} ${t}`))})})]}),/* @__PURE__ */ W(`div`,{children:[/* @__PURE__ */ V(`h3`,{children:`Asks`}),(v.asks??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`nothing was asked of any origin`}):/* @__PURE__ */ W(`table`,{"data-asks":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`seq`}),/* @__PURE__ */ V(`th`,{children:`origin`}),/* @__PURE__ */ V(`th`,{children:`outcome`}),/* @__PURE__ */ V(`th`,{children:`reason`})]})}),/* @__PURE__ */ V(`tbody`,{children:v.asks.map((e,t)=>/* @__PURE__ */ W(`tr`,{"data-ask":e.origin,children:[/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(SX,{value:e.seq??null})}),/* @__PURE__ */ V(`td`,{children:e.origin}),/* @__PURE__ */ V(`td`,{children:e.outcome}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V($X,{reason:e.reason})})]},`${e.origin} ${e.seq??t}`))})]})]})]}),/* @__PURE__ */ V(`h2`,{children:`Media graph`}),/* @__PURE__ */ V(zX,{bundle:v,selected:b,onSelect:e=>h([e])}),/* @__PURE__ */ V(`h3`,{children:`Links`}),(v.links??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`no links, refused or otherwise`}):/* @__PURE__ */ W(`table`,{"data-links":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`from`}),/* @__PURE__ */ V(`th`,{children:`to`}),/* @__PURE__ */ V(`th`,{children:`kind`}),/* @__PURE__ */ V(`th`,{children:`status`}),/* @__PURE__ */ V(`th`,{children:`by`}),/* @__PURE__ */ V(`th`,{children:`rule`}),/* @__PURE__ */ V(`th`,{children:`confidence`}),/* @__PURE__ */ V(`th`,{})]})}),/* @__PURE__ */ V(`tbody`,{children:v.links.map(e=>/* @__PURE__ */ W(`tr`,{"data-link":e.key,"data-status":e.status,className:b===e.key?`selected`:void 0,children:[/* @__PURE__ */ V(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ V(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ V(`td`,{children:e.kind}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`span`,{className:`status ${gX(e.status)?`active`:`refused`}`,children:e.status})}),/* @__PURE__ */ V(`td`,{children:e.by}),/* @__PURE__ */ V(`td`,{children:e.reason}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(SX,{value:e.confidence})}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ V(`h3`,{children:`Claims`}),(v.claims??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`no claims between the uris this bundle names`}):/* @__PURE__ */ W(`table`,{"data-claims":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`from`}),/* @__PURE__ */ V(`th`,{children:`to`}),/* @__PURE__ */ V(`th`,{children:`kind`}),/* @__PURE__ */ V(`th`,{children:`claimer`}),/* @__PURE__ */ V(`th`,{children:`provenance`}),/* @__PURE__ */ V(`th`,{children:`answer`}),/* @__PURE__ */ V(`th`,{children:`target scope`}),/* @__PURE__ */ V(`th`,{})]})}),/* @__PURE__ */ V(`tbody`,{children:v.claims.map(e=>/* @__PURE__ */ W(`tr`,{"data-claim":e.key,className:b===e.key?`selected`:void 0,children:[/* @__PURE__ */ V(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ V(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ V(`td`,{children:e.kind}),/* @__PURE__ */ V(`td`,{children:e.claimer}),/* @__PURE__ */ V(`td`,{children:e.provenance}),/* @__PURE__ */ V(`td`,{children:e.answerSeq}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(SX,{value:e.targetScope})}),/* @__PURE__ */ V(`td`,{children:/* @__PURE__ */ V(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ V(`h3`,{children:`Attachments`}),(v.attachments??[]).length===0?/* @__PURE__ */ V(`p`,{className:`empty`,children:`no run is attached to a container here`}):/* @__PURE__ */ W(`table`,{"data-attachments":!0,children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`th`,{children:`run`}),/* @__PURE__ */ V(`th`,{children:`container`}),/* @__PURE__ */ V(`th`,{children:`via`}),/* @__PURE__ */ V(`th`,{children:`by`}),/* @__PURE__ */ V(`th`,{children:`evidence`}),/* @__PURE__ */ V(`th`,{children:`supports`})]})}),/* @__PURE__ */ V(`tbody`,{children:v.attachments.map(e=>/* @__PURE__ */ W(`tr`,{children:[/* @__PURE__ */ V(`td`,{className:`uri`,children:e.runUri}),/* @__PURE__ */ V(`td`,{className:`uri`,children:e.containerUri}),/* @__PURE__ */ V(`td`,{children:e.via}),/* @__PURE__ */ V(`td`,{children:e.by}),/* @__PURE__ */ V(`td`,{className:`uri`,children:/* @__PURE__ */ V(SX,{value:e.evidence})}),/* @__PURE__ */ V(`td`,{children:(e.supports??[]).length===0?/* @__PURE__ */ V(SX,{value:null}):e.supports.map(e=>/* @__PURE__ */ V(`button`,{type:`button`,className:`inspect`,"data-attachment-support":e,onClick:()=>h([e]),children:e},e))})]},`${e.runUri} ${e.containerUri} ${e.via} ${e.by}`))})]}),/* @__PURE__ */ V(`h2`,{children:`Episodes`}),/* @__PURE__ */ V(YX,{bundle:v,index:y,selected:b,onSelect:e=>h([e])}),/* @__PURE__ */ V(`h2`,{children:`Inspector`}),/* @__PURE__ */ V(KX,{bundle:v,index:y,trail:m,onFollow:e=>h(t=>[...t,e]),onTrailTo:e=>h(t=>t.slice(0,e+1)),loadAnswerBytes:t})]})]})},tZ=`[data-party-scroll]`,nZ=()=>{let e=document.querySelectorAll(tZ);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.scrollHeight-n.clientHeight>0)return n}},rZ=(e,t)=>t>0?Math.min(1,Math.max(0,e/t)):0,iZ=()=>{let e=nZ();return e?Math.max(0,e.scrollHeight-e.clientHeight):Math.max(0,document.documentElement.scrollHeight-window.innerHeight)},aZ=()=>{let e=nZ();return e?rZ(e.scrollTop,e.scrollHeight-e.clientHeight):rZ(window.scrollY,document.documentElement.scrollHeight-window.innerHeight)},oZ=()=>{try{return window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0}catch{return!1}},sZ=(e,t,n)=>!e||oZ()?`instant`:t<=n*2?`smooth`:`instant`,cZ=(e,{smooth:t}={})=>{let n=nZ();if(n){let r=n.scrollHeight-n.clientHeight,i=r>0?e*r:0;n.scrollTo({top:i,behavior:sZ(t,Math.abs(i-n.scrollTop),n.clientHeight)});return}let r=document.documentElement.scrollHeight-window.innerHeight,i=r>0?e*r:0;window.scrollTo({top:i,behavior:sZ(t,Math.abs(i-window.scrollY),window.innerHeight)})};U();var lZ=2,uZ=8e3,dZ=[`wheel`,`touchstart`,`keydown`,`pointerdown`],fZ=60,pZ=()=>{let e=LS(),[t,n]=Fh(),r=Ih(),i=mu(r?`${t}?${r}`:t),a=e.status===`active`?e.role:void 0,o=t===ca,s=t===ag(Q.SEARCH),c=yi(t);H(()=>{if(a!==`host`||o)return;let e=()=>{Y.setLocation(i,c?0:aZ()),Y.send({t:`nav`,path:i})};if(!s)return e();let t=setTimeout(e,350);return()=>clearTimeout(t)},[a,i,o]),H(()=>{if(a!==`host`||o||c)return;let e=0,t,n=()=>{t=void 0,e=Date.now();let n=aZ();Y.setLocation(i,n),Y.send({t:`scroll`,y:n})},r=()=>{if(t)return;let r=Math.max(0,1e3/lZ-(Date.now()-e));t=setTimeout(n,r)};return document.addEventListener(`scroll`,r,{passive:!0,capture:!0}),()=>{document.removeEventListener(`scroll`,r,{capture:!0}),t&&clearTimeout(t)}},[a,i]);let l=G(void 0),u=G(0);H(()=>{if(l.current===void 0)return;let e=l.current;l.current=void 0;let t=0,n=-1,r=0,i=!1,a=u.current,o=Date.now()+uZ,s=()=>{i=!0};for(let e of dZ)document.addEventListener(e,s,{passive:!0});let c=()=>{cancelAnimationFrame(t);for(let e of dZ)document.removeEventListener(e,s)};if(SS(),e===0)return cZ(0),c;let d=()=>{let s=iZ();s===n?r+=1:(r=0,n=s);let l=s>0&&r>=fZ;if(i||u.current!==a||l||Date.now()>o)return c();cZ(e),t=requestAnimationFrame(d)};return t=requestAnimationFrame(d),c},[i]);let d=G(!1),f=e.status===`active`?e.invite:void 0;H(()=>{d.current=!1},[f]);let p=(e,t)=>{d.current=!0,e===i?(SS(),u.current+=1,cZ(t,{smooth:!0})):(l.current=t,n(e))};return RS((e,{replayed:t})=>{if(a===`host`)e.t===`ask`&&e.c===`go`&&e.path!==i&&n(e.path);else if(a===`guest`)switch(e.t){case`nav`:d.current=!0,e.path!==i&&n(e.path);return;case`scroll`:Y.hostPath()===i&&(SS(),u.current+=1,cZ(e.y,{smooth:!0}));return;case`state`:(!d.current||t)&&p(e.path,e.y);return}}),null};U();var mZ=4,hZ=2500,gZ=R`
8210
8214
  position: fixed;
8211
8215
  left: 0;
8212
8216
  top: 0;
@@ -8233,7 +8237,7 @@ scrollbar-gutter: stable;
8233
8237
  font-weight: 600;
8234
8238
  white-space: nowrap;
8235
8239
  }
8236
- `,hZ=(e,t)=>document.documentElement.dir===`rtl`&&document.elementFromPoint(e*window.innerWidth,t*window.innerHeight)?.matches(`:dir(rtl)`)?1-e:e,gZ=()=>{let e=L(),t=LS(),n=t.status===`active`?t.role:void 0,[r]=Fh(),i=Ih(),a=mu(i?`${r}?${i}`:r);H(()=>{if(n!==`host`)return;let e=0,t,r,i=()=>{t=void 0,r&&!Y.playing()&&(e=Date.now(),Y.send({t:`cursor`,x:r.x,y:r.y}))},a=n=>{let a=Math.min(1,Math.max(0,n.clientY/window.innerHeight));r={x:hZ(Math.min(1,Math.max(0,n.clientX/window.innerWidth)),a),y:a},!t&&(t=setTimeout(i,Math.max(0,1e3/fZ-(Date.now()-e))))};return window.addEventListener(`pointermove`,a,{passive:!0}),()=>{window.removeEventListener(`pointermove`,a),t&&clearTimeout(t)}},[n]);let[o,s]=K(void 0),[c,l]=K(()=>Date.now()),u=G(!1);if(RS(e=>{if(n===`guest`){if(e.t===`playback`||e.t===`state`&&e.s){let t=(e.t,e.s);u.current=!t.paused,u.current&&s(void 0)}else e.t!==`cursor`||u.current||Y.hostPath()===a&&s({x:e.x,y:e.y,at:Date.now()})}}),H(()=>{if(!o)return;let e=setInterval(()=>l(Date.now()),500);return()=>clearInterval(e)},[o]),n!==`guest`||!o||c-o.at>pZ)return null;let d=t.status===`active`?Y.nameOf(t.owner):void 0;return/* @__PURE__ */ W(`div`,{css:mZ,style:{"--x":`${hZ(o.x,o.y)*100}vw`,"--y":`${o.y*100}vh`},"aria-hidden":`true`,children:[/* @__PURE__ */ V(`svg`,{width:`18`,height:`22`,viewBox:`0 0 18 22`,fill:`none`,children:/* @__PURE__ */ V(`path`,{d:`M2 2 L2 17 L6.5 13 L9.5 20 L12 19 L9 12.5 L15 12 Z`,fill:`#4ade80`,stroke:`#06120a`,strokeWidth:`1.2`,strokeLinejoin:`round`})}),/* @__PURE__ */ V(`span`,{className:`tag`,children:d??e.formatMessage({id:`host#the party's host`,defaultMessage:`host`,description:`the party's host`})})]})};U();var _Z=()=>({pathname:location.pathname,search:location.search,over:cg(location.pathname,history.state)}),vZ=[[`pushState`,`push`],[`replaceState`,`replace`],[`popstate`,`pop`]],yZ=()=>{let e=G(_Z());return H(()=>{let t=vZ.map(([t,n])=>{let r=()=>{let t={from:e.current,to:_Z(),kind:n,asked:TS()};e.current=t.to;let r=uS(t)?0:_S(t);r!==void 0&&xS(r)};return addEventListener(t,r),()=>removeEventListener(t,r)});return globalThis.navigation?.addEventListener(`navigate`,hS),globalThis.navigation?.addEventListener(`currententrychange`,gS),()=>{SS();for(let e of t)e();globalThis.navigation?.removeEventListener(`navigate`,hS),globalThis.navigation?.removeEventListener(`currententrychange`,gS)}},[]),null};U();var bZ=()=>{let{query:e}=Nh();return/* @__PURE__ */ V(Kh,{to:Jg({query:qg(e)}),replace:!0})},xZ=()=>{let e=L();return H(()=>{globalThis.close()},[]),/* @__PURE__ */ V(`div`,{children:e.formatMessage({id:`Logging in...`,defaultMessage:`Logging in...`})})},SZ=()=>{let e=dg();return/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(zh,{hook:pg,searchHook:mg,hrefs:x_,children:/* @__PURE__ */ W(Gh,{children:[/* @__PURE__ */ V(Hh,{path:ig(Q.HOME),component:mW}),/* @__PURE__ */ V(Hh,{path:ig(Q.MEDIA),component:mW}),/* @__PURE__ */ V(Hh,{path:ig(Q.TITLE),component:jW}),/* @__PURE__ */ V(Hh,{path:ig(Q.SEARCH),children:/* @__PURE__ */ V(DG,{covered:e!==void 0})}),/* @__PURE__ */ V(Hh,{path:ig(Q.SEARCH_LEGACY),component:bZ}),/* @__PURE__ */ V(Hh,{path:ig(Q.LEGAL),component:AG}),/* @__PURE__ */ V(Hh,{path:ig(Q.PRIVACY),component:RG}),/* @__PURE__ */ V(Hh,{path:ig(Q.SETTINGS),component:$K}),/* @__PURE__ */ V(Hh,{path:ig(Q.LIST),component:gq}),/* @__PURE__ */ V(Hh,{path:ig(Q.CONTINUE),component:vq}),/* @__PURE__ */ V(Hh,{path:ig(Q.WATCH),component:QY}),/* @__PURE__ */ V(Hh,{path:ig(Q.PARTY),component:tX}),/* @__PURE__ */ V(Hh,{path:ig(Q.DEBUG_TRACE),children:/* @__PURE__ */ V(QX,{})}),/* @__PURE__ */ V(Hh,{path:ig(Q.LOGIN_CALLBACK),component:xZ}),/* @__PURE__ */ V(Hh,{component:WU})]})}),e?/* @__PURE__ */ V(Hh,{path:ig(Q.MEDIA),children:/* @__PURE__ */ V(ZU,{mediaNodes:[],closeTo:e})}):null]})},CZ=R`
8240
+ `,_Z=(e,t)=>document.documentElement.dir===`rtl`&&document.elementFromPoint(e*window.innerWidth,t*window.innerHeight)?.matches(`:dir(rtl)`)?1-e:e,vZ=()=>{let e=L(),t=LS(),n=t.status===`active`?t.role:void 0,[r]=Fh(),i=Ih(),a=mu(i?`${r}?${i}`:r);H(()=>{if(n!==`host`)return;let e=0,t,r,i=()=>{t=void 0,r&&!Y.playing()&&(e=Date.now(),Y.send({t:`cursor`,x:r.x,y:r.y}))},a=n=>{let a=Math.min(1,Math.max(0,n.clientY/window.innerHeight));r={x:_Z(Math.min(1,Math.max(0,n.clientX/window.innerWidth)),a),y:a},!t&&(t=setTimeout(i,Math.max(0,1e3/mZ-(Date.now()-e))))};return window.addEventListener(`pointermove`,a,{passive:!0}),()=>{window.removeEventListener(`pointermove`,a),t&&clearTimeout(t)}},[n]);let[o,s]=K(void 0),[c,l]=K(()=>Date.now()),u=G(!1);if(RS(e=>{if(n===`guest`){if(e.t===`playback`||e.t===`state`&&e.s){let t=(e.t,e.s);u.current=!t.paused,u.current&&s(void 0)}else e.t!==`cursor`||u.current||Y.hostPath()===a&&s({x:e.x,y:e.y,at:Date.now()})}}),H(()=>{if(!o)return;let e=setInterval(()=>l(Date.now()),500);return()=>clearInterval(e)},[o]),n!==`guest`||!o||c-o.at>hZ)return null;let d=t.status===`active`?Y.nameOf(t.owner):void 0;return/* @__PURE__ */ W(`div`,{css:gZ,style:{"--x":`${_Z(o.x,o.y)*100}vw`,"--y":`${o.y*100}vh`},"aria-hidden":`true`,children:[/* @__PURE__ */ V(`svg`,{width:`18`,height:`22`,viewBox:`0 0 18 22`,fill:`none`,children:/* @__PURE__ */ V(`path`,{d:`M2 2 L2 17 L6.5 13 L9.5 20 L12 19 L9 12.5 L15 12 Z`,fill:`#4ade80`,stroke:`#06120a`,strokeWidth:`1.2`,strokeLinejoin:`round`})}),/* @__PURE__ */ V(`span`,{className:`tag`,children:d??e.formatMessage({id:`host#the party's host`,defaultMessage:`host`,description:`the party's host`})})]})};U();var yZ=()=>({pathname:location.pathname,search:location.search,over:cg(location.pathname,history.state)}),bZ=[[`pushState`,`push`],[`replaceState`,`replace`],[`popstate`,`pop`]],xZ=()=>{let e=G(yZ());return H(()=>{let t=bZ.map(([t,n])=>{let r=()=>{let t={from:e.current,to:yZ(),kind:n,asked:TS()};e.current=t.to;let r=uS(t)?0:_S(t);r!==void 0&&xS(r)};return addEventListener(t,r),()=>removeEventListener(t,r)});return globalThis.navigation?.addEventListener(`navigate`,hS),globalThis.navigation?.addEventListener(`currententrychange`,gS),()=>{SS();for(let e of t)e();globalThis.navigation?.removeEventListener(`navigate`,hS),globalThis.navigation?.removeEventListener(`currententrychange`,gS)}},[]),null};U();var SZ=()=>{let{query:e}=Nh();return/* @__PURE__ */ V(Kh,{to:Jg({query:qg(e)}),replace:!0})},CZ=()=>{let e=L();return H(()=>{globalThis.close()},[]),/* @__PURE__ */ V(`div`,{children:e.formatMessage({id:`Logging in...`,defaultMessage:`Logging in...`})})},wZ=()=>{let e=dg();return/* @__PURE__ */ W(q,{children:[/* @__PURE__ */ V(zh,{hook:pg,searchHook:mg,hrefs:x_,children:/* @__PURE__ */ W(Gh,{children:[/* @__PURE__ */ V(Hh,{path:ig(Q.HOME),component:gW}),/* @__PURE__ */ V(Hh,{path:ig(Q.MEDIA),component:gW}),/* @__PURE__ */ V(Hh,{path:ig(Q.TITLE),component:NW}),/* @__PURE__ */ V(Hh,{path:ig(Q.SEARCH),children:/* @__PURE__ */ V(kG,{covered:e!==void 0})}),/* @__PURE__ */ V(Hh,{path:ig(Q.SEARCH_LEGACY),component:SZ}),/* @__PURE__ */ V(Hh,{path:ig(Q.LEGAL),component:MG}),/* @__PURE__ */ V(Hh,{path:ig(Q.PRIVACY),component:BG}),/* @__PURE__ */ V(Hh,{path:ig(Q.SETTINGS),component:tq}),/* @__PURE__ */ V(Hh,{path:ig(Q.LIST),component:vq}),/* @__PURE__ */ V(Hh,{path:ig(Q.CONTINUE),component:bq}),/* @__PURE__ */ V(Hh,{path:ig(Q.WATCH),component:eX}),/* @__PURE__ */ V(Hh,{path:ig(Q.PARTY),component:rX}),/* @__PURE__ */ V(Hh,{path:ig(Q.DEBUG_TRACE),children:/* @__PURE__ */ V(eZ,{})}),/* @__PURE__ */ V(Hh,{path:ig(Q.LOGIN_CALLBACK),component:CZ}),/* @__PURE__ */ V(Hh,{component:KU})]})}),e?/* @__PURE__ */ V(Hh,{path:ig(Q.MEDIA),children:/* @__PURE__ */ V($U,{mediaNodes:[],closeTo:e})}):null]})},TZ=R`
8237
8241
  display: flex;
8238
8242
  flex-direction: column;
8239
8243
  min-height: 100vh;
@@ -8241,7 +8245,7 @@ scrollbar-gutter: stable;
8241
8245
  & > .content {
8242
8246
  flex: 1;
8243
8247
  }
8244
- `,wZ=()=>/* @__PURE__ */ V(zh,{hook:fg,hrefs:x_,children:/* @__PURE__ */ W(`div`,{css:CZ,children:[/* @__PURE__ */ V(IC,{}),/* @__PURE__ */ V(kC,{}),/* @__PURE__ */ V(`main`,{className:`content`,children:/* @__PURE__ */ V(SZ,{})}),/* @__PURE__ */ V(MC,{}),/* @__PURE__ */ V(dZ,{}),/* @__PURE__ */ V(gZ,{}),/* @__PURE__ */ V(YS,{}),/* @__PURE__ */ V(yZ,{})]})});Qe(),U();var TZ=R`
8248
+ `,EZ=()=>/* @__PURE__ */ V(zh,{hook:fg,hrefs:x_,children:/* @__PURE__ */ W(`div`,{css:TZ,children:[/* @__PURE__ */ V(IC,{}),/* @__PURE__ */ V(kC,{}),/* @__PURE__ */ V(`main`,{className:`content`,children:/* @__PURE__ */ V(wZ,{})}),/* @__PURE__ */ V(MC,{}),/* @__PURE__ */ V(pZ,{}),/* @__PURE__ */ V(vZ,{}),/* @__PURE__ */ V(YS,{}),/* @__PURE__ */ V(xZ,{})]})});Qe(),U();var DZ=R`
8245
8249
  display: flex;
8246
8250
  align-items: center;
8247
8251
  justify-content: center;
@@ -8290,7 +8294,7 @@ scrollbar-gutter: stable;
8290
8294
  background: rgba(255, 255, 255, 0.08);
8291
8295
  }
8292
8296
  }
8293
- `,EZ=(e,t)=>`route: ${t}\nmessage: ${e.message}\nstack: ${e.stack??`(no stack)`}`,DZ=({error:e,route:t})=>{let n=L(),[r,i]=K(!1);return/* @__PURE__ */ V(`div`,{css:TZ,children:/* @__PURE__ */ W(`div`,{className:`panel`,children:[/* @__PURE__ */ V(`h2`,{children:n.formatMessage({id:`This page failed to render`,defaultMessage:`This page failed to render`})}),/* @__PURE__ */ V(`p`,{className:`message`,children:e.message||n.formatMessage({id:`No message was given.`,defaultMessage:`No message was given.`})}),/* @__PURE__ */ W(`div`,{className:`actions`,children:[/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>globalThis.location?.reload(),children:n.formatMessage({id:`Reload`,defaultMessage:`Reload`})}),/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>{let n=navigator.clipboard?.writeText(EZ(e,t));n&&n.then(()=>i(!0)).catch(e=>console.error(Error(`the failure details could not be copied`,{cause:e})))},children:r?n.formatMessage({id:`Copied`,defaultMessage:`Copied`}):n.formatMessage({id:`Copy details`,defaultMessage:`Copy details`})})]})]})})},OZ=class extends Mt{state={error:null,route:this.props.route};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}static getDerivedStateFromProps(e,t){return e.route===t.route?null:{error:null,route:e.route}}componentDidCatch(e){console.error(Error(`the ${this.props.route} route failed to render`,{cause:e}))}render(){return this.state.error?/* @__PURE__ */ V(DZ,{error:this.state.error,route:this.props.route}):this.props.children}},kZ=({children:e})=>{let[t]=Fh();return/* @__PURE__ */ V(OZ,{route:t,children:e})};_r(location.href)&&(window.__stubExportStore=e=>lr(e??{excludeOrigins:[]}));var AZ=async(e,t={},n={})=>hX(yr,e,t,{settleMs:n.settleMs});Hn(location.href)&&(window.__stubExportAnswers=()=>mr(),window.__stubExportAsks=()=>vr(),window.__stubGraphCounts=()=>hr()),Vn(location.href)&&(window.__stubGraphQL=(e,t,n)=>AZ(e,t,n));var jZ=`stub.apikeys`;Qe(),((e=()=>localStorage)=>{try{e().removeItem(jZ)}catch{}})(),jf({check:rr,focused:Cr}),Lf(Ju);var MZ=R`
8297
+ `,OZ=(e,t)=>`route: ${t}\nmessage: ${e.message}\nstack: ${e.stack??`(no stack)`}`,kZ=({error:e,route:t})=>{let n=L(),[r,i]=K(!1);return/* @__PURE__ */ V(`div`,{css:DZ,children:/* @__PURE__ */ W(`div`,{className:`panel`,children:[/* @__PURE__ */ V(`h2`,{children:n.formatMessage({id:`This page failed to render`,defaultMessage:`This page failed to render`})}),/* @__PURE__ */ V(`p`,{className:`message`,children:e.message||n.formatMessage({id:`No message was given.`,defaultMessage:`No message was given.`})}),/* @__PURE__ */ W(`div`,{className:`actions`,children:[/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>globalThis.location?.reload(),children:n.formatMessage({id:`Reload`,defaultMessage:`Reload`})}),/* @__PURE__ */ V(`button`,{type:`button`,onClick:()=>{let n=navigator.clipboard?.writeText(OZ(e,t));n&&n.then(()=>i(!0)).catch(e=>console.error(Error(`the failure details could not be copied`,{cause:e})))},children:r?n.formatMessage({id:`Copied`,defaultMessage:`Copied`}):n.formatMessage({id:`Copy details`,defaultMessage:`Copy details`})})]})]})})},AZ=class extends Mt{state={error:null,route:this.props.route};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}static getDerivedStateFromProps(e,t){return e.route===t.route?null:{error:null,route:e.route}}componentDidCatch(e){console.error(Error(`the ${this.props.route} route failed to render`,{cause:e}))}render(){return this.state.error?/* @__PURE__ */ V(kZ,{error:this.state.error,route:this.props.route}):this.props.children}},jZ=({children:e})=>{let[t]=Fh();return/* @__PURE__ */ V(AZ,{route:t,children:e})};_r(location.href)&&(window.__stubExportStore=e=>lr(e??{excludeOrigins:[]}));var MZ=async(e,t={},n={})=>_X(yr,e,t,{settleMs:n.settleMs});Hn(location.href)&&(window.__stubExportAnswers=()=>mr(),window.__stubExportAsks=()=>vr(),window.__stubGraphCounts=()=>hr()),Vn(location.href)&&(window.__stubGraphQL=(e,t,n)=>MZ(e,t,n));var NZ=`stub.apikeys`;Qe(),((e=()=>localStorage)=>{try{e().removeItem(NZ)}catch{}})(),jf({check:rr,focused:Cr}),Lf(Ju);var PZ=R`
8294
8298
  :root {
8295
8299
  color-scheme: dark;
8296
8300
  /* the fixed header's own height. Every page that has to start below the bar reads this instead of
@@ -8373,4 +8377,4 @@ scrollbar-gutter: stable;
8373
8377
  .hidden {
8374
8378
  display: none !important;
8375
8379
  }
8376
- `;Y.resume();var NZ=document.createElement(`div`);NZ.id=`stub-root`;var PZ=await yn();It(/* @__PURE__ */ V(Ve,{value:PZ,children:/* @__PURE__ */ W(Hs,{value:$m,children:[/* @__PURE__ */ V(He,{styles:[En,MZ]}),/* @__PURE__ */ V(kZ,{children:/* @__PURE__ */ V(wZ,{})})]})}),document.body.appendChild(NZ));
8380
+ `;Y.resume();var FZ=document.createElement(`div`);FZ.id=`stub-root`;var IZ=await yn();It(/* @__PURE__ */ V(Ve,{value:IZ,children:/* @__PURE__ */ W(Hs,{value:$m,children:[/* @__PURE__ */ V(He,{styles:[En,PZ]}),/* @__PURE__ */ V(jZ,{children:/* @__PURE__ */ V(EZ,{})})]})}),document.body.appendChild(FZ));