@banou/stub 0.0.72 → 0.0.73

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,G as c,H as l,J as u,L as d,M as f,N as p,P as m,Q as h,R as g,U as _,V as v,W as y,X as b,Y as x,_ as S,_t as C,a as w,at as T,b as E,ct as D,d as O,dt as k,et as A,f as j,g as ee,gt as M,h as te,ht as ne,i as re,k as ie,l as N,lt as P,m as ae,mt as oe,n as se,nt as ce,o as le,ot as ue,p as de,pt as fe,r as pe,rt as me,s as he,st as ge,t as _e,tt as ve,u as ye,ut as be,v as xe,vt as Se,x as Ce,xt as we,y as Te}from"./assets/lib-track-languages-ByAqcXWu.js";import{m as Ee}from"./assets/lib-intl-_4f6zNc2.js";import{$ as De,A as Oe,B as ke,C as Ae,D as je,E as Me,F as Ne,G as Pe,H as Fe,I as Ie,J as Le,K as F,L as Re,M as ze,N as Be,O as Ve,P as He,Q as Ue,R as We,St as Ge,T as Ke,U as qe,V as I,X as Je,Y as Ye,_ as Xe,_t as Ze,at as Qe,b as $e,bt as et,c as L,ct as tt,d as nt,dt as R,et as rt,f as it,ft as z,g as at,h as ot,ht as B,i as st,it as ct,j as lt,k as ut,l as V,lt as dt,m as ft,mt as pt,nt as mt,ot as ht,p as gt,pt as H,q as U,rt as _t,s as W,st as G,tt as vt,u as yt,ut as K,v as bt,vt as xt,w as St,x as Ct,xt as wt,y as Tt,yt as Et,z as Dt}from"./assets/lib-chapters-EBYXcEml-0fd33E6j.js";import{$ as Ot,A as kt,B as At,C as jt,D as Mt,E as Nt,F as Pt,G as Ft,H as It,I as Lt,J as Rt,K as zt,L as Bt,M as Vt,O as Ht,P as Ut,Q as Wt,R as Gt,S as Kt,V as qt,W as Jt,X as Yt,Y as Xt,Z as Zt,_ as Qt,a as $t,at as en,c as tn,ct as nn,d as rn,dt as an,et as on,f as sn,ft as cn,it as ln,j as un,k as dn,lt as q,n as fn,nt as pn,o as mn,ot as hn,q as gn,rt as _n,st as vn,t as yn,tt as bn,ut as xn,v as Sn,w as Cn,y as wn,z as Tn}from"./assets/lib-base-text-DdQ1GglO.js";import{A as En,B as Dn,C as On,D as kn,E as An,F as jn,H as Mn,I as Nn,L as Pn,M as Fn,N as In,O as Ln,P as Rn,R as zn,S as Bn,T as Vn,V as Hn,_ as Un,a as Wn,b as Gn,c as Kn,d as qn,f as Jn,i as Yn,j as Xn,k as Zn,l as Qn,m as $n,n as er,o as tr,p as nr,r as rr,s as ir,t as ar,u as or,v as sr,w as cr,x as lr,y as ur,z as dr}from"./assets/lib-worker-DrfdMXAL.js";import{i as fr}from"./assets/lib-remote-0E9Lyyzl.js";var pr=[`title`,`media`,`watch`],mr=/* @__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(`.`),hr=[``,`https:stub.plugins.banou.dev`],gr=[``,`amzn1.dv.gti.`],_r=[[1,1],[1,2],[2,3]],vr=8192,yr=16384,br=/^(\/(?:title|media)\/[^/?]+)\/([^/?:]+)(\?.*)?$/,xr=/^(?:[\w.~-]|%[\dA-F]{2})+$/i,Sr=/^ag:\((.*)\)$/,Cr=/^(?:0|[1-9]\d{0,14})$/,wr=/^(.*?)([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/,Tr=/^[0-9a-f]{24}$/,Er=/(\d{4,15})/,Dr=new TextEncoder,Or=/* @__PURE__ */ Error(`not a share code`),kr=(e,t)=>{do{let n=t%128;t=Math.floor(t/128),e.push(t?n+128:n)}while(t)},Ar=(e,t)=>{let n=Dr.encode(t);kr(e,n.length),e.push(...n)},jr=(e,t)=>{let n=t.split(Er).filter(Boolean);kr(e,n.length);for(let t of n)if(/^\d+$/.test(t)&&t.length>=4)kr(e,t.length*2+1),kr(e,Number(t));else{let n=Dr.encode(t);kr(e,n.length*2),e.push(...n)}},Mr=e=>e.match(/../g).map(e=>parseInt(e,16)),Nr=(e,t,n)=>{if(Cr.test(t))return kr(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 kr(e,r*4+1),jr(e,t.slice(n[r].length));let i=wr.exec(t),a=i?gr.indexOf(i[1]):-1;if(i&&a>=0)return kr(e,a*2*4+2),e.push(...Mr(i.slice(2).join(``)));if(Tr.test(t))return kr(e,6),e.push(...Mr(t));kr(e,3),jr(e,t)},Pr=(e,t,n)=>{let r=Sr.exec(t)?.[1],i=[];for(let e of r===void 0?[t]:r.split(`,`)){let t=e.indexOf(`:`);if(t<0)throw Or;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]})}kr(e,i.length*2+(r===void 0?0:1));for(let{origin:t,ids:r}of i){let i=mr.indexOf(t),a=i>0&&i<64?i:0,o=r.length>1&&r.every((e,t)=>Cr.test(e)&&(t===0||Number(e)>Number(r[t-1])));e.push(a+(r.length>1?64:0)+(o?128:0)),a||Ar(e,t),r.length>1&&kr(e,r.length-2);let s=0;for(let i of r)o?(kr(e,Number(i)-s),s=Number(i)):Nr(e,i,n),n.push(i,`${t}-${i}`)}},Fr=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=pr.indexOf(a);if(i!==``||s<0||o.length<_r[s][0]||o.length>_r[s][1]||o.includes(``))throw Or;let c=[s*4+o.length],l=[];for(let e of o)Pr(c,e,l);for(let e of r===void 0?[]:r.split(`&`)){if(!e.startsWith(`plugins=`))throw Or;let t=e.slice(8),n=Math.max(0,hr.indexOf(t));kr(c,n),n||Ar(c,t)}return Uint8Array.from(c)},Ir=e=>{let t=0,n=0,r=new TextDecoder(`utf-8`,{fatal:!0}),i=()=>e.length-t,a=()=>{if(t>=e.length)throw Or;return e[t++]},o=e=>{if(e>i())throw Or;return e},s=()=>{let e=0;for(let t=1,n=0;;t*=128,n++){if(n===8)throw Or;let r=a();if(e+=r%128*t,r<128)break}if(e>2**53-1)throw Or;return e},c=n=>e.subarray(t,t+=o(n)),l=()=>r.decode(c(s())),u=e=>{if(n+=e.length+1,n>vr)throw Or;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 Or;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 Or;return e[r]+d()}if(n===3)return d();if(r===1)return f(12);let i=gr[r/2];if(i===void 0)throw Or;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,_=_r[h];if(!_||g<_[0]||g>_[1])throw Or;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 Or;let r=[];for(let e=0;e<n;e++){let e=a(),n=e%64,i=n?mr[n]:l();if(i===void 0)throw Or;let c=!!(e&64),d=!!(e&128),f=c?o(s()+2):1;if(d&&!c||!t&&c)throw Or;let m=0;for(let e=0;e<f;e++){let e=d?String(m+=s()):p(y);if(m>2**53-1)throw Or;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?hr[e]:l();if(t===void 0)throw Or;b.push(u(`plugins=${t}`))}return`/${[pr[h],...v].join(`/`)}${b.length?`?${b.join(`&`)}`:``}`},Lr=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)},Rr=e=>{if(e.length>yr||!/^[\w-]+$/.test(e))throw Or;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`)),e=>e.charCodeAt(0))},zr=e=>{if(e.length>vr||e.includes(`#`))return;let t=br.exec(e);try{let n=t?`${Lr(Fr(`${t[1]}${t[3]??``}`))}/${t[2]}`:Lr(Fr(e));return Br(n)===e?n:void 0}catch{return}},Br=e=>{let t=e.indexOf(`/`),n=t<0?``:e.slice(t+1);try{let r=Ir(Rr(t<0?e:e.slice(0,t))),i=r.indexOf(`?`),a=i<0?r:r.slice(0,i);return xr.test(n)&&n.length<=vr&&/^\/(?:title|media)\/[^/]+$/.test(a)?`${a}/${n}${r.slice(a.length)}`:r}catch{return}};if(location.pathname.startsWith(`/s/`)){let e=Br(location.pathname.slice(3));e&&history.replaceState(history.state,``,e)}var Vr=()=>`https://fkn.app/connect-button`,Hr=[`ready`,`loading`,`away`],Ur=[`play`,`seek`,`go`,`rate`,`subs`,`audio`],Wr={subtitles:`subs`,audio:`audio`},Gr={all:[],by:{}},Kr=(e,t,n)=>e.by[t]?.[n]??e.all.includes(n),qr=/* @__PURE__ */ new Set([`nav`,`scroll`,`cursor`,`playback`,`state`,`pong`]),Jr=e=>qr.has(e.t),Yr=e=>e.trim().slice(0,500)||void 0,Xr=e=>e.trim().replace(/\s+/g,` `).slice(0,32)||void 0,Zr=e=>JSON.stringify({v:1,...e}),Qr=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 ai(n.path)?{t:`nav`,path:n.path}:void 0;case`scroll`:return li(n.y)?{t:`scroll`,y:n.y}:void 0;case`cursor`:return li(n.x)&&li(n.y)?{t:`cursor`,x:n.x,y:n.y}:void 0;case`chat`:{let e=typeof n.text==`string`?Yr(n.text):void 0;return e?{t:`chat`,text:e}:void 0}case`name`:{let e=typeof n.name==`string`?Xr(n.name):void 0;return e?{t:`name`,name:e}:void 0}case`ping`:return si(n.n)&&si(n.at)?{t:`ping`,n:n.n,at:n.at}:void 0;case`pong`:return si(n.n)&&si(n.at)&&si(n.host)?{t:`pong`,n:n.n,at:n.at,host:n.host}:void 0;case`playback`:return ui(n.s)?{t:`playback`,s:n.s}:void 0;case`state`:{if(!ai(n.path)||!li(n.y)||n.s!==void 0&&!ui(n.s))return;let e=ei(n.grants),t=ni(n.sub),r=ni(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(!Hr.includes(n.s)||n.path!==void 0&&!oi(n.path))return;let e=ci(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 oi(n.path)?{t:`ask`,c:`go`,path:n.path}:void 0;if(n.c===`subs`){let e=ni(n.sub);return e===void 0?void 0:{t:`ask`,c:`subs`,sub:e}}if(n.c===`audio`){let e=ni(n.audio);return e===void 0?void 0:{t:`ask`,c:`audio`,audio:e}}return $r(n.c)&&ai(n.path)&&ui(n.s)?{t:`ask`,c:n.c,path:n.path,s:n.s}:void 0;default:return}},$r=e=>Ur.includes(e),ei=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>ti)return;let i={all:t.filter($r),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])=>$r(e)&&typeof t==`boolean`))}return i},ti=100,ni=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},ri=/* @__PURE__ */ new Map,ii=(e,t)=>{ri.has(t)||ri.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]=ri.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})},ai=e=>typeof e==`string`&&e.length>0&&e.length<=2048&&e.startsWith(`/`)&&!e.startsWith(`//`)&&!e.startsWith(`/\\`)&&!/[\r\n\t]/.test(e),oi=e=>ai(e)&&new URL(e,`https://stub.invalid`).pathname.startsWith(`/watch/`),si=e=>typeof e==`number`&&Number.isFinite(e),ci=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0,li=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1,ui=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.paused==`boolean`&&ci(t.time)&&typeof t.rate==`number`&&Number.isFinite(t.rate)&&t.rate>0&&t.rate<=16&&typeof t.at==`number`&&Number.isFinite(t.at)},di=.5,fi=5e3,pi=(e,t,n=!1)=>{if(e.paused)return e.time;let r=Math.max(t-e.at,0),i=(n?r:Math.min(r,mi))/1e3;return e.time+i*e.rate},mi=2e3,hi=(e,t,n,r=!1)=>{let i={},a=pi(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),yi(e.rate,t.rate)||(i.rate=t.rate),i},gi=.05,_i=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},vi=(e,t,n,r,i=!1)=>{let a=pi(n,r,!0),o=(a-t.time)/n.rate,s=di*n.rate,c={...n,time:a,at:r},l=i||!e||e.heard.paused!==n.paused||Math.abs(pi(e.heard,r,!0)-a)>s||t.time<e.played.time-gi||t.time>pi(e.played,r,!0)+s,u=hi(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||!yi(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?_i(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;yi(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}}},yi=(e,t)=>Math.abs(e-t)<=.001,bi=(e,t)=>e<=t*1.05+.001&&e>=t/1.05-.001,xi=(e,t,n)=>({...e,time:e.paused?e.time:e.time+Math.max(0,n-t)/1e3*e.rate,at:n}),Si=2e3,Ci=3e3,wi=(e,t,n)=>{let r=[];return t.paused!==e.paused&&t.paused!==n.paused&&r.push(`play`),(t.time<e.time-gi||t.time>pi(e,t.at,!0)+.5)&&Math.abs(t.time-n.time)>.5&&r.push(`seek`),!bi(t.rate,e.rate)&&!bi(t.rate,n.rate)&&r.push(`rate`),r},Ti=(e,t,n)=>{let r=xi(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 yi(e.rate,t.s.rate)?void 0:{...r,rate:t.s.rate};let i=pi(t.s,n);return Math.abs(i-r.time)<=.5?void 0:{...r,time:i}},Ei=1e3,Di=1,Oi=(e,t)=>{let n=e.find(([e,n])=>e-.5<=t&&t<n);return n?n[1]-t:0},ki=(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 Oi(t.ranges,n)>=Math.min(i,a)?`ready`:`loading`},Ai=(e,t)=>e.time===void 0?void 0:e.time+Math.max(0,t)/1e3*(e.rate??0),ji=(e,t,n)=>{if(e.s!==t.s||e.path!==t.path||!e.rate!=!t.rate)return!0;let r=Ai(e,n);return r===void 0||t.time===void 0?r!==t.time:Math.abs(r-t.time)>Di},Mi=(e,t,n)=>{if(e.path!==n)return{s:e.s===`away`?`away`:`loading`};let r=Ai(e,t);return r===void 0?{s:e.s}:{s:e.s,time:r}},Ni=(e,t,n)=>({rtt:n-e,offset:t-(e+n)/2}),Pi=e=>e.length?e.reduce((e,t)=>t.rtt<e.rtt?t:e):void 0,Fi=(e,t)=>e-t,Ii=(e,t)=>e+t,Li=4e3,Ri=`stub-party-invite`,zi=`stub-party-name`,Bi=1e4,Vi=3e4,Hi=2e3,Ui=1e4,Wi=6e4,Gi={subtitles:`party`,audio:`party`},Ki=()=>{try{return globalThis.sessionStorage}catch{return}},qi=e=>e instanceof Error&&typeof e.code==`string`,Ji=(e,t=Ki())=>{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=Gr,h=!0,g={},_={},v=Gi,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)},ee=e=>{try{t?.setItem(Ri,e)}catch{}},M=()=>{try{t?.removeItem(Ri)}catch{}},te=()=>{try{return t?.getItem(`stub-party-invite`)??void 0}catch{return}},ne=e=>e.owner===e.self.id?`host`:`guest`,re=(e,t)=>{for(let n of s)n(e,t)},ie=async e=>{let t=await e.members().catch(()=>void 0);r===e&&n.status===`active`&&t&&j({...n,members:t.length})},N=e=>{r&&n.status===`active`&&(Jr(e)&&n.role!==`host`||r.send(Zr(e)).catch(()=>{}))},P=()=>{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),Li),N({t:`ping`,n:i,at:n})},n*400);setTimeout(()=>{if(x!==t||r!==e)return;x=void 0;let n=Pi(t);n&&(b=n)},2e3+Li)},ae=()=>({t:`state`,path:a.path,y:a.y,...a.playback?{s:xi(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}}),oe=({grants:e=Gr,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}))},se=(e,t)=>{g={...g,[e]:t},N(ae())},ce=()=>{if(D=void 0,!T)return;let e=Date.now(),t=Ai(T.status,e-T.at);E={status:t===void 0?T.status:{...T.status,time:t},at:e},N({t:`status`,...E.status})},le=e=>{if(!T||D||!e&&E&&!ji(E.status,T.status,T.at-E.at))return;let t=(E?.at??-1/0)+Hi-Date.now();t<=0?ce():D=setTimeout(ce,t)},ue=()=>[...u.values()].filter(e=>`path`in e).at(-1)?.path,de=()=>{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},fe=()=>{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=Gi},pe=async e=>{r=e;let t=ne(e);d.clear(),f.length=0,p=void 0,m=Gr,h=!0,g={},_={},j({status:`active`,role:t,invite:e.invite,members:1,self:e.self.id,owner:e.owner}),ee(e.invite),i=await e.on(i=>{if(r===e)switch(i.type){case`message`:{let n=Qr(i.message.text);if(!n)return;let r=i.message.from,a=r===e.self.id;if(n.t===`ping`){t===`host`&&!a&&N({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=Ni(i,n.host,Date.now());if(a.rtt>4e3)return;x?.push(a),b||=a;return}if(Jr(n)){if(r!==e.owner||(n.t===`state`&&oe(n),t===`host`))return;u.delete(n.t),u.set(n.t,n),re(n,{replayed:!1,from:r,self:a});return}if(n.t===`ask`){if(!Kr(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`&&se(`subtitles`,n.sub),t===`host`&&n.c===`audio`&&se(`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)}re(n,{replayed:!1,from:r,self:a});return}case`joined`:t===`host`&&N(ae()),A&&N({t:`name`,name:A}),ie(e);return;case`left`:{if(t===`guest`&&i.id===e.owner){he(`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))},N(ae()),j({...n})),ie(e);return}}}),r===e?(t===`host`&&(c=setInterval(()=>N(ae()),Bi)),t===`guest`&&(P(),S=setInterval(P,Wi),T={status:{s:`away`},at:Date.now()},O=setInterval(()=>{oi(ue())&&le(!0)},Ui)),l=setInterval(()=>{A&&N({t:`name`,name:A})},Vi),A&&N({t:`name`,name:A}),ie(e),e.closed.then(({reason:t})=>{r===e&&(fe(),M(),j({status:`ended`,reason:t}))})):(i(),i=void 0)},me=e=>n.status===`active`&&(n.role===`host`||Kr(m,n.self,e)),he=async e=>{let t=r;fe(),M(),j({status:`ended`,reason:e}),await t?.leave().catch(()=>{})},ge=(e,t)=>{M(),j(t?{status:`idle`}:{status:`failed`,code:qi(e)?e.code:`unknown`})},_e=async(e,t,n=!1)=>{r&&await he(`left`),u.clear(),j({status:`joining`,invite:e??``});try{let e=await t();await pe(e)}catch(e){ge(e,n)}};return{getState:()=>n,subscribe:e=>(o.add(e),()=>{o.delete(e)}),onMessage:e=>(s.add(e),()=>{s.delete(e)}),create:()=>_e(void 0,()=>e.create()),join:t=>_e(t,()=>e.join(t)),resume:async()=>{let t=te();t&&!r&&await _e(t,()=>e.join(t),!0)},leave:async()=>{r&&await he(`left`)},send:N,setLocation:(e,t)=>{a.path=e,a.y=t},setPlayback:e=>{a.playback=e,a.playbackAt=Date.now()},issued:()=>p??Gr,setGrants:e=>{n.status===`active`&&n.role===`host`&&(p=e,N(ae()),j({...n}))},may:me,partyTrack:e=>_[e],setPartyTrack:(e,t)=>{n.status===`active`&&(n.role===`host`?se(e,t):me(Wr[e])&&N(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:ue,following:()=>h,setFollowing:e=>{h=e,j({...n})},replay:()=>{for(let e of[`state`,`nav`,`scroll`,`playback`]){let t=e===`state`?de():u.get(e);t&&r&&re(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(zi,e):t?.removeItem(zi)}catch{}e&&N({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()},le(!1))},statuses:()=>k,dismiss:()=>{(n.status===`ended`||n.status===`failed`)&&j({status:`idle`})}}},Yi=`/party`,Xi=(e,t)=>`${e}${Yi}#${Qi(e,t)}`,Zi=(e,t)=>{let n=e.startsWith(`#`)?e.slice(1):e,r;try{r=decodeURIComponent(n).trim()}catch{return}if(ta.test(r))return r;if(!na.test(r))return;let i=r.indexOf(`.`),a=`${r.slice(0,i)}.${t}/${r.slice(i+1)}`;return ta.test(a)?a:void 0},Qi=(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},$i=`[A-Za-z0-9_-]{43}`,ea=`[a-z0-9][a-z0-9._-]{0,63}`,ta=RegExp(`^${$i}\\.[\\x21-\\x7e]{1,256}\\/${ea}$`),na=RegExp(`^${$i}\\.${ea}$`),J=Ji(ue),ra=/^(anime|movies|series|stub)\.(fkn\.app|localhost)$/,ia=e=>{let t=e.match(ra)?.[1];return t===`movies`?`movie`:t??`stub`},aa=e=>ra.test(e),oa=ia(globalThis.location?.hostname??``),sa=[{site:`movie`,host:`movies`},{site:`series`,host:`series`},{site:`anime`,host:`anime`},{site:`stub`,host:`stub`}],ca=globalThis.location?(({protocol:e,hostname:t,port:n})=>{let r=t.match(ra)?.[2];return r?sa.map(({site:t,host:i})=>({site:t,href:`${e}//${i}.${r}${n?`:${n}`:``}/`})):[]})(globalThis.location):[],la=[`anilist`,`mal`,`kitsu`,`livechart`,`anizip`,`offline`,`cr`],ua=(e,t=oa)=>t!==`movie`&&t!==`series`||!la.includes(e),da=/^\/assets\//,fa=e=>[...new Set([...e.querySelectorAll(`script[src], link[href]`)].map(e=>e.getAttribute(`src`)??e.getAttribute(`href`)??``).filter(e=>da.test(e)))].sort(),pa=e=>e.ok&&/javascript|css/.test(e.headers.get(`content-type`)??``),ma=async e=>{let t=await fetch(`/`,{cache:`no-store`}),n=fa(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(),pa(t)}))).every(Boolean)},ha=9e5,ga=e=>{let t=!1,n=!1,r=async()=>{if(!(t||n)){t=!0;try{n=await ma(fa(document))}catch{}t=!1,n&&(clearInterval(i),e())}},i=setInterval(r,ha);document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&r()}),window.addEventListener(`vite:preloadError`,()=>{r()})},_a={categoryBar:1,hoverCard:150,filterMenu:500,mediaModal:1e3,header:1100,headerPopup:1150,franchiseDialog:1200,pluginNotice:2e3,sourcePopup:2200,updating:2500,partyCursor:3e3},va=`stub-update-reloads`,ya=2,ba=3e5,xa=1e3,Sa=`textarea:not([readonly]), input:not([type=checkbox]):not([type=radio]):not([readonly]), [contenteditable]:not([contenteditable=false])`,Ca=()=>{try{let e=Date.now(),t=JSON.parse(sessionStorage.getItem(`stub-update-reloads`)??`[]`).filter(t=>e-t<ba);return t.length>=ya?!1:(sessionStorage.setItem(va,JSON.stringify([...t,e])),!0)}catch{return!1}},wa=/* @__PURE__ */ new Set,Ta=e=>{wa.add(e)},Ea=e=>{let{status:t}=e.getState();return![...wa].some(e=>e())&&navigator.onLine&&!location.pathname.startsWith(`/watch/`)&&t!==`joining`&&t!==`active`&&!document.activeElement?.matches(Sa)&&![...document.querySelectorAll(`video`)].some(e=>!e.paused&&!e.ended)},Da=()=>{let e=document.createElement(`div`);e.textContent=q.formatMessage({id:`Updating Stub`,defaultMessage:`Updating Stub`}),e.style.cssText=`position: fixed; inset: 0; z-index: ${_a.updating}; display: flex; align-items: center; justify-content: center; background: #0f0f0f; color: #fff; font-size: 2rem`,document.body.append(e)},Oa=(({party:e})=>{let t,n=!1,r=()=>{!n&&Ea(e)&&Ca()&&(n=!0,Da(),location.reload())};return{due:()=>{t??=setInterval(r,xa),r()}}})({party:J});me.onUpdateTaken(Oa.due),aa(location.hostname)&&ga(Oa.due),et();var ka={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`},Aa=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`}},Y,X;function ja(e){return new Aa(`Syntax Error: Unexpected token at ${X} in ${e}`)}function Ma(e){if(e.lastIndex=X,e.test(Y))return Y.slice(X,X=e.lastIndex)}var Na=/ +(?=[^\s])/y;function Pa(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,G as c,H as l,J as u,L as d,M as f,N as p,P as m,Q as h,R as g,U as _,V as v,W as y,X as b,Y as x,_ as S,_t as C,a as w,at as T,b as E,ct as D,d as O,dt as k,et as A,f as j,g as ee,gt as M,h as te,ht as ne,i as re,k as ie,l as N,lt as P,m as ae,mt as oe,n as se,nt as ce,o as le,ot as ue,p as de,pt as fe,r as pe,rt as me,s as he,st as ge,t as _e,tt as ve,u as ye,ut as be,v as xe,vt as Se,x as Ce,xt as we,y as Te}from"./assets/lib-track-languages-ByAqcXWu.js";import{m as Ee}from"./assets/lib-intl-_4f6zNc2.js";import{$ as De,A as Oe,B as ke,C as Ae,D as je,E as Me,F as Ne,G as Pe,H as Fe,I as Ie,J as Le,K as F,L as Re,M as ze,N as Be,O as Ve,P as He,Q as Ue,R as We,St as Ge,T as Ke,U as qe,V as I,X as Je,Y as Ye,_ as Xe,_t as Ze,at as Qe,b as $e,bt as et,c as L,ct as tt,d as nt,dt as R,et as rt,f as it,ft as z,g as at,h as ot,ht as B,i as st,it as ct,j as lt,k as ut,l as V,lt as dt,m as ft,mt as pt,nt as mt,ot as ht,p as gt,pt as H,q as U,rt as _t,s as W,st as G,tt as vt,u as yt,ut as K,v as bt,vt as xt,w as St,x as Ct,xt as wt,y as Tt,yt as Et,z as Dt}from"./assets/lib-chapters-EBYXcEml-0fd33E6j.js";import{$ as Ot,A as kt,B as At,C as jt,D as Mt,E as Nt,F as Pt,G as Ft,H as It,I as Lt,J as Rt,K as zt,L as Bt,M as Vt,O as Ht,P as Ut,Q as Wt,R as Gt,S as Kt,V as qt,W as Jt,X as Yt,Y as Xt,Z as Zt,_ as Qt,a as $t,at as en,c as tn,ct as nn,d as rn,dt as an,et as on,f as sn,ft as cn,it as ln,j as un,k as dn,lt as q,n as fn,nt as pn,o as mn,ot as hn,q as gn,rt as _n,st as vn,t as yn,tt as bn,ut as xn,v as Sn,w as Cn,y as wn,z as Tn}from"./assets/lib-base-text-DdQ1GglO.js";import{A as En,B as Dn,C as On,D as kn,E as An,F as jn,H as Mn,I as Nn,L as Pn,M as Fn,N as In,O as Ln,P as Rn,R as zn,S as Bn,T as Vn,V as Hn,_ as Un,a as Wn,b as Gn,c as Kn,d as qn,f as Jn,i as Yn,j as Xn,k as Zn,l as Qn,m as $n,n as er,o as tr,p as nr,r as rr,s as ir,t as ar,u as or,v as sr,w as cr,x as lr,y as ur,z as dr}from"./assets/lib-worker-CyXic1pj.js";import{i as fr}from"./assets/lib-remote-0E9Lyyzl.js";var pr=[`title`,`media`,`watch`],mr=/* @__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(`.`),hr=[``,`https:stub.plugins.banou.dev`],gr=[``,`amzn1.dv.gti.`],_r=[[1,1],[1,2],[2,3]],vr=8192,yr=16384,br=/^(\/(?:title|media)\/[^/?]+)\/([^/?:]+)(\?.*)?$/,xr=/^(?:[\w.~-]|%[\dA-F]{2})+$/i,Sr=/^ag:\((.*)\)$/,Cr=/^(?:0|[1-9]\d{0,14})$/,wr=/^(.*?)([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/,Tr=/^[0-9a-f]{24}$/,Er=/(\d{4,15})/,Dr=new TextEncoder,Or=/* @__PURE__ */ Error(`not a share code`),kr=(e,t)=>{do{let n=t%128;t=Math.floor(t/128),e.push(t?n+128:n)}while(t)},Ar=(e,t)=>{let n=Dr.encode(t);kr(e,n.length),e.push(...n)},jr=(e,t)=>{let n=t.split(Er).filter(Boolean);kr(e,n.length);for(let t of n)if(/^\d+$/.test(t)&&t.length>=4)kr(e,t.length*2+1),kr(e,Number(t));else{let n=Dr.encode(t);kr(e,n.length*2),e.push(...n)}},Mr=e=>e.match(/../g).map(e=>parseInt(e,16)),Nr=(e,t,n)=>{if(Cr.test(t))return kr(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 kr(e,r*4+1),jr(e,t.slice(n[r].length));let i=wr.exec(t),a=i?gr.indexOf(i[1]):-1;if(i&&a>=0)return kr(e,a*2*4+2),e.push(...Mr(i.slice(2).join(``)));if(Tr.test(t))return kr(e,6),e.push(...Mr(t));kr(e,3),jr(e,t)},Pr=(e,t,n)=>{let r=Sr.exec(t)?.[1],i=[];for(let e of r===void 0?[t]:r.split(`,`)){let t=e.indexOf(`:`);if(t<0)throw Or;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]})}kr(e,i.length*2+(r===void 0?0:1));for(let{origin:t,ids:r}of i){let i=mr.indexOf(t),a=i>0&&i<64?i:0,o=r.length>1&&r.every((e,t)=>Cr.test(e)&&(t===0||Number(e)>Number(r[t-1])));e.push(a+(r.length>1?64:0)+(o?128:0)),a||Ar(e,t),r.length>1&&kr(e,r.length-2);let s=0;for(let i of r)o?(kr(e,Number(i)-s),s=Number(i)):Nr(e,i,n),n.push(i,`${t}-${i}`)}},Fr=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=pr.indexOf(a);if(i!==``||s<0||o.length<_r[s][0]||o.length>_r[s][1]||o.includes(``))throw Or;let c=[s*4+o.length],l=[];for(let e of o)Pr(c,e,l);for(let e of r===void 0?[]:r.split(`&`)){if(!e.startsWith(`plugins=`))throw Or;let t=e.slice(8),n=Math.max(0,hr.indexOf(t));kr(c,n),n||Ar(c,t)}return Uint8Array.from(c)},Ir=e=>{let t=0,n=0,r=new TextDecoder(`utf-8`,{fatal:!0}),i=()=>e.length-t,a=()=>{if(t>=e.length)throw Or;return e[t++]},o=e=>{if(e>i())throw Or;return e},s=()=>{let e=0;for(let t=1,n=0;;t*=128,n++){if(n===8)throw Or;let r=a();if(e+=r%128*t,r<128)break}if(e>2**53-1)throw Or;return e},c=n=>e.subarray(t,t+=o(n)),l=()=>r.decode(c(s())),u=e=>{if(n+=e.length+1,n>vr)throw Or;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 Or;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 Or;return e[r]+d()}if(n===3)return d();if(r===1)return f(12);let i=gr[r/2];if(i===void 0)throw Or;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,_=_r[h];if(!_||g<_[0]||g>_[1])throw Or;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 Or;let r=[];for(let e=0;e<n;e++){let e=a(),n=e%64,i=n?mr[n]:l();if(i===void 0)throw Or;let c=!!(e&64),d=!!(e&128),f=c?o(s()+2):1;if(d&&!c||!t&&c)throw Or;let m=0;for(let e=0;e<f;e++){let e=d?String(m+=s()):p(y);if(m>2**53-1)throw Or;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?hr[e]:l();if(t===void 0)throw Or;b.push(u(`plugins=${t}`))}return`/${[pr[h],...v].join(`/`)}${b.length?`?${b.join(`&`)}`:``}`},Lr=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)},Rr=e=>{if(e.length>yr||!/^[\w-]+$/.test(e))throw Or;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`)),e=>e.charCodeAt(0))},zr=e=>{if(e.length>vr||e.includes(`#`))return;let t=br.exec(e);try{let n=t?`${Lr(Fr(`${t[1]}${t[3]??``}`))}/${t[2]}`:Lr(Fr(e));return Br(n)===e?n:void 0}catch{return}},Br=e=>{let t=e.indexOf(`/`),n=t<0?``:e.slice(t+1);try{let r=Ir(Rr(t<0?e:e.slice(0,t))),i=r.indexOf(`?`),a=i<0?r:r.slice(0,i);return xr.test(n)&&n.length<=vr&&/^\/(?:title|media)\/[^/]+$/.test(a)?`${a}/${n}${r.slice(a.length)}`:r}catch{return}};if(location.pathname.startsWith(`/s/`)){let e=Br(location.pathname.slice(3));e&&history.replaceState(history.state,``,e)}var Vr=()=>`https://fkn.app/connect-button`,Hr=[`ready`,`loading`,`away`],Ur=[`play`,`seek`,`go`,`rate`,`subs`,`audio`],Wr={subtitles:`subs`,audio:`audio`},Gr={all:[],by:{}},Kr=(e,t,n)=>e.by[t]?.[n]??e.all.includes(n),qr=/* @__PURE__ */ new Set([`nav`,`scroll`,`cursor`,`playback`,`state`,`pong`]),Jr=e=>qr.has(e.t),Yr=e=>e.trim().slice(0,500)||void 0,Xr=e=>e.trim().replace(/\s+/g,` `).slice(0,32)||void 0,Zr=e=>JSON.stringify({v:1,...e}),Qr=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 ai(n.path)?{t:`nav`,path:n.path}:void 0;case`scroll`:return li(n.y)?{t:`scroll`,y:n.y}:void 0;case`cursor`:return li(n.x)&&li(n.y)?{t:`cursor`,x:n.x,y:n.y}:void 0;case`chat`:{let e=typeof n.text==`string`?Yr(n.text):void 0;return e?{t:`chat`,text:e}:void 0}case`name`:{let e=typeof n.name==`string`?Xr(n.name):void 0;return e?{t:`name`,name:e}:void 0}case`ping`:return si(n.n)&&si(n.at)?{t:`ping`,n:n.n,at:n.at}:void 0;case`pong`:return si(n.n)&&si(n.at)&&si(n.host)?{t:`pong`,n:n.n,at:n.at,host:n.host}:void 0;case`playback`:return ui(n.s)?{t:`playback`,s:n.s}:void 0;case`state`:{if(!ai(n.path)||!li(n.y)||n.s!==void 0&&!ui(n.s))return;let e=ei(n.grants),t=ni(n.sub),r=ni(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(!Hr.includes(n.s)||n.path!==void 0&&!oi(n.path))return;let e=ci(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 oi(n.path)?{t:`ask`,c:`go`,path:n.path}:void 0;if(n.c===`subs`){let e=ni(n.sub);return e===void 0?void 0:{t:`ask`,c:`subs`,sub:e}}if(n.c===`audio`){let e=ni(n.audio);return e===void 0?void 0:{t:`ask`,c:`audio`,audio:e}}return $r(n.c)&&ai(n.path)&&ui(n.s)?{t:`ask`,c:n.c,path:n.path,s:n.s}:void 0;default:return}},$r=e=>Ur.includes(e),ei=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>ti)return;let i={all:t.filter($r),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])=>$r(e)&&typeof t==`boolean`))}return i},ti=100,ni=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},ri=/* @__PURE__ */ new Map,ii=(e,t)=>{ri.has(t)||ri.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]=ri.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})},ai=e=>typeof e==`string`&&e.length>0&&e.length<=2048&&e.startsWith(`/`)&&!e.startsWith(`//`)&&!e.startsWith(`/\\`)&&!/[\r\n\t]/.test(e),oi=e=>ai(e)&&new URL(e,`https://stub.invalid`).pathname.startsWith(`/watch/`),si=e=>typeof e==`number`&&Number.isFinite(e),ci=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0,li=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=1,ui=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.paused==`boolean`&&ci(t.time)&&typeof t.rate==`number`&&Number.isFinite(t.rate)&&t.rate>0&&t.rate<=16&&typeof t.at==`number`&&Number.isFinite(t.at)},di=.5,fi=5e3,pi=(e,t,n=!1)=>{if(e.paused)return e.time;let r=Math.max(t-e.at,0),i=(n?r:Math.min(r,mi))/1e3;return e.time+i*e.rate},mi=2e3,hi=(e,t,n,r=!1)=>{let i={},a=pi(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),yi(e.rate,t.rate)||(i.rate=t.rate),i},gi=.05,_i=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},vi=(e,t,n,r,i=!1)=>{let a=pi(n,r,!0),o=(a-t.time)/n.rate,s=di*n.rate,c={...n,time:a,at:r},l=i||!e||e.heard.paused!==n.paused||Math.abs(pi(e.heard,r,!0)-a)>s||t.time<e.played.time-gi||t.time>pi(e.played,r,!0)+s,u=hi(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||!yi(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?_i(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;yi(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}}},yi=(e,t)=>Math.abs(e-t)<=.001,bi=(e,t)=>e<=t*1.05+.001&&e>=t/1.05-.001,xi=(e,t,n)=>({...e,time:e.paused?e.time:e.time+Math.max(0,n-t)/1e3*e.rate,at:n}),Si=2e3,Ci=3e3,wi=(e,t,n)=>{let r=[];return t.paused!==e.paused&&t.paused!==n.paused&&r.push(`play`),(t.time<e.time-gi||t.time>pi(e,t.at,!0)+.5)&&Math.abs(t.time-n.time)>.5&&r.push(`seek`),!bi(t.rate,e.rate)&&!bi(t.rate,n.rate)&&r.push(`rate`),r},Ti=(e,t,n)=>{let r=xi(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 yi(e.rate,t.s.rate)?void 0:{...r,rate:t.s.rate};let i=pi(t.s,n);return Math.abs(i-r.time)<=.5?void 0:{...r,time:i}},Ei=1e3,Di=1,Oi=(e,t)=>{let n=e.find(([e,n])=>e-.5<=t&&t<n);return n?n[1]-t:0},ki=(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 Oi(t.ranges,n)>=Math.min(i,a)?`ready`:`loading`},Ai=(e,t)=>e.time===void 0?void 0:e.time+Math.max(0,t)/1e3*(e.rate??0),ji=(e,t,n)=>{if(e.s!==t.s||e.path!==t.path||!e.rate!=!t.rate)return!0;let r=Ai(e,n);return r===void 0||t.time===void 0?r!==t.time:Math.abs(r-t.time)>Di},Mi=(e,t,n)=>{if(e.path!==n)return{s:e.s===`away`?`away`:`loading`};let r=Ai(e,t);return r===void 0?{s:e.s}:{s:e.s,time:r}},Ni=(e,t,n)=>({rtt:n-e,offset:t-(e+n)/2}),Pi=e=>e.length?e.reduce((e,t)=>t.rtt<e.rtt?t:e):void 0,Fi=(e,t)=>e-t,Ii=(e,t)=>e+t,Li=4e3,Ri=`stub-party-invite`,zi=`stub-party-name`,Bi=1e4,Vi=3e4,Hi=2e3,Ui=1e4,Wi=6e4,Gi={subtitles:`party`,audio:`party`},Ki=()=>{try{return globalThis.sessionStorage}catch{return}},qi=e=>e instanceof Error&&typeof e.code==`string`,Ji=(e,t=Ki())=>{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=Gr,h=!0,g={},_={},v=Gi,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)},ee=e=>{try{t?.setItem(Ri,e)}catch{}},M=()=>{try{t?.removeItem(Ri)}catch{}},te=()=>{try{return t?.getItem(`stub-party-invite`)??void 0}catch{return}},ne=e=>e.owner===e.self.id?`host`:`guest`,re=(e,t)=>{for(let n of s)n(e,t)},ie=async e=>{let t=await e.members().catch(()=>void 0);r===e&&n.status===`active`&&t&&j({...n,members:t.length})},N=e=>{r&&n.status===`active`&&(Jr(e)&&n.role!==`host`||r.send(Zr(e)).catch(()=>{}))},P=()=>{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),Li),N({t:`ping`,n:i,at:n})},n*400);setTimeout(()=>{if(x!==t||r!==e)return;x=void 0;let n=Pi(t);n&&(b=n)},2e3+Li)},ae=()=>({t:`state`,path:a.path,y:a.y,...a.playback?{s:xi(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}}),oe=({grants:e=Gr,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}))},se=(e,t)=>{g={...g,[e]:t},N(ae())},ce=()=>{if(D=void 0,!T)return;let e=Date.now(),t=Ai(T.status,e-T.at);E={status:t===void 0?T.status:{...T.status,time:t},at:e},N({t:`status`,...E.status})},le=e=>{if(!T||D||!e&&E&&!ji(E.status,T.status,T.at-E.at))return;let t=(E?.at??-1/0)+Hi-Date.now();t<=0?ce():D=setTimeout(ce,t)},ue=()=>[...u.values()].filter(e=>`path`in e).at(-1)?.path,de=()=>{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},fe=()=>{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=Gi},pe=async e=>{r=e;let t=ne(e);d.clear(),f.length=0,p=void 0,m=Gr,h=!0,g={},_={},j({status:`active`,role:t,invite:e.invite,members:1,self:e.self.id,owner:e.owner}),ee(e.invite),i=await e.on(i=>{if(r===e)switch(i.type){case`message`:{let n=Qr(i.message.text);if(!n)return;let r=i.message.from,a=r===e.self.id;if(n.t===`ping`){t===`host`&&!a&&N({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=Ni(i,n.host,Date.now());if(a.rtt>4e3)return;x?.push(a),b||=a;return}if(Jr(n)){if(r!==e.owner||(n.t===`state`&&oe(n),t===`host`))return;u.delete(n.t),u.set(n.t,n),re(n,{replayed:!1,from:r,self:a});return}if(n.t===`ask`){if(!Kr(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`&&se(`subtitles`,n.sub),t===`host`&&n.c===`audio`&&se(`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)}re(n,{replayed:!1,from:r,self:a});return}case`joined`:t===`host`&&N(ae()),A&&N({t:`name`,name:A}),ie(e);return;case`left`:{if(t===`guest`&&i.id===e.owner){he(`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))},N(ae()),j({...n})),ie(e);return}}}),r===e?(t===`host`&&(c=setInterval(()=>N(ae()),Bi)),t===`guest`&&(P(),S=setInterval(P,Wi),T={status:{s:`away`},at:Date.now()},O=setInterval(()=>{oi(ue())&&le(!0)},Ui)),l=setInterval(()=>{A&&N({t:`name`,name:A})},Vi),A&&N({t:`name`,name:A}),ie(e),e.closed.then(({reason:t})=>{r===e&&(fe(),M(),j({status:`ended`,reason:t}))})):(i(),i=void 0)},me=e=>n.status===`active`&&(n.role===`host`||Kr(m,n.self,e)),he=async e=>{let t=r;fe(),M(),j({status:`ended`,reason:e}),await t?.leave().catch(()=>{})},ge=(e,t)=>{M(),j(t?{status:`idle`}:{status:`failed`,code:qi(e)?e.code:`unknown`})},_e=async(e,t,n=!1)=>{r&&await he(`left`),u.clear(),j({status:`joining`,invite:e??``});try{let e=await t();await pe(e)}catch(e){ge(e,n)}};return{getState:()=>n,subscribe:e=>(o.add(e),()=>{o.delete(e)}),onMessage:e=>(s.add(e),()=>{s.delete(e)}),create:()=>_e(void 0,()=>e.create()),join:t=>_e(t,()=>e.join(t)),resume:async()=>{let t=te();t&&!r&&await _e(t,()=>e.join(t),!0)},leave:async()=>{r&&await he(`left`)},send:N,setLocation:(e,t)=>{a.path=e,a.y=t},setPlayback:e=>{a.playback=e,a.playbackAt=Date.now()},issued:()=>p??Gr,setGrants:e=>{n.status===`active`&&n.role===`host`&&(p=e,N(ae()),j({...n}))},may:me,partyTrack:e=>_[e],setPartyTrack:(e,t)=>{n.status===`active`&&(n.role===`host`?se(e,t):me(Wr[e])&&N(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:ue,following:()=>h,setFollowing:e=>{h=e,j({...n})},replay:()=>{for(let e of[`state`,`nav`,`scroll`,`playback`]){let t=e===`state`?de():u.get(e);t&&r&&re(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(zi,e):t?.removeItem(zi)}catch{}e&&N({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()},le(!1))},statuses:()=>k,dismiss:()=>{(n.status===`ended`||n.status===`failed`)&&j({status:`idle`})}}},Yi=`/party`,Xi=(e,t)=>`${e}${Yi}#${Qi(e,t)}`,Zi=(e,t)=>{let n=e.startsWith(`#`)?e.slice(1):e,r;try{r=decodeURIComponent(n).trim()}catch{return}if(ta.test(r))return r;if(!na.test(r))return;let i=r.indexOf(`.`),a=`${r.slice(0,i)}.${t}/${r.slice(i+1)}`;return ta.test(a)?a:void 0},Qi=(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},$i=`[A-Za-z0-9_-]{43}`,ea=`[a-z0-9][a-z0-9._-]{0,63}`,ta=RegExp(`^${$i}\\.[\\x21-\\x7e]{1,256}\\/${ea}$`),na=RegExp(`^${$i}\\.${ea}$`),J=Ji(ue),ra=/^(anime|movies|series|stub)\.(fkn\.app|localhost)$/,ia=e=>{let t=e.match(ra)?.[1];return t===`movies`?`movie`:t??`stub`},aa=e=>ra.test(e),oa=ia(globalThis.location?.hostname??``),sa=[{site:`movie`,host:`movies`},{site:`series`,host:`series`},{site:`anime`,host:`anime`},{site:`stub`,host:`stub`}],ca=globalThis.location?(({protocol:e,hostname:t,port:n})=>{let r=t.match(ra)?.[2];return r?sa.map(({site:t,host:i})=>({site:t,href:`${e}//${i}.${r}${n?`:${n}`:``}/`})):[]})(globalThis.location):[],la=[`anilist`,`mal`,`kitsu`,`livechart`,`anizip`,`offline`,`cr`],ua=(e,t=oa)=>t!==`movie`&&t!==`series`||!la.includes(e),da=/^\/assets\//,fa=e=>[...new Set([...e.querySelectorAll(`script[src], link[href]`)].map(e=>e.getAttribute(`src`)??e.getAttribute(`href`)??``).filter(e=>da.test(e)))].sort(),pa=e=>e.ok&&/javascript|css/.test(e.headers.get(`content-type`)??``),ma=async e=>{let t=await fetch(`/`,{cache:`no-store`}),n=fa(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(),pa(t)}))).every(Boolean)},ha=9e5,ga=e=>{let t=!1,n=!1,r=async()=>{if(!(t||n)){t=!0;try{n=await ma(fa(document))}catch{}t=!1,n&&(clearInterval(i),e())}},i=setInterval(r,ha);document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&r()}),window.addEventListener(`vite:preloadError`,()=>{r()})},_a={categoryBar:1,hoverCard:150,filterMenu:500,mediaModal:1e3,header:1100,headerPopup:1150,franchiseDialog:1200,pluginNotice:2e3,sourcePopup:2200,updating:2500,partyCursor:3e3},va=`stub-update-reloads`,ya=2,ba=3e5,xa=1e3,Sa=`textarea:not([readonly]), input:not([type=checkbox]):not([type=radio]):not([readonly]), [contenteditable]:not([contenteditable=false])`,Ca=()=>{try{let e=Date.now(),t=JSON.parse(sessionStorage.getItem(`stub-update-reloads`)??`[]`).filter(t=>e-t<ba);return t.length>=ya?!1:(sessionStorage.setItem(va,JSON.stringify([...t,e])),!0)}catch{return!1}},wa=/* @__PURE__ */ new Set,Ta=e=>{wa.add(e)},Ea=e=>{let{status:t}=e.getState();return![...wa].some(e=>e())&&navigator.onLine&&!location.pathname.startsWith(`/watch/`)&&t!==`joining`&&t!==`active`&&!document.activeElement?.matches(Sa)&&![...document.querySelectorAll(`video`)].some(e=>!e.paused&&!e.ended)},Da=()=>{let e=document.createElement(`div`);e.textContent=q.formatMessage({id:`Updating Stub`,defaultMessage:`Updating Stub`}),e.style.cssText=`position: fixed; inset: 0; z-index: ${_a.updating}; display: flex; align-items: center; justify-content: center; background: #0f0f0f; color: #fff; font-size: 2rem`,document.body.append(e)},Oa=(({party:e})=>{let t,n=!1,r=()=>{!n&&Ea(e)&&Ca()&&(n=!0,Da(),location.reload())};return{due:()=>{t??=setInterval(r,xa),r()}}})({party:J});me.onUpdateTaken(Oa.due),aa(location.hostname)&&ga(Oa.due),et();var ka={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`},Aa=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`}},Y,X;function ja(e){return new Aa(`Syntax Error: Unexpected token at ${X} in ${e}`)}function Ma(e){if(e.lastIndex=X,e.test(Y))return Y.slice(X,X=e.lastIndex)}var Na=/ +(?=[^\s])/y;function Pa(e){for(var t=e.split(`
3
3
  `),n=``,r=0,i=0,a=t.length-1,o=0;o<t.length;o++)Na.lastIndex=0,Na.test(t[o])&&(o&&(!r||Na.lastIndex<r)&&(r=Na.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 Fa(){for(var e=0|Y.charCodeAt(X++);e===9||e===10||e===13||e===32||e===35||e===44||e===65279;e=0|Y.charCodeAt(X++))if(e===35)for(;(e=0|Y.charCodeAt(X++))&&e!==10&&e!==13;);X--}function Ia(){for(var e=X,t=0|Y.charCodeAt(X++);t>=48&&t<=57||t>=65&&t<=90||t===95||t>=97&&t<=122;t=0|Y.charCodeAt(X++));if(e===X-1)throw ja(`Name`);var n=Y.slice(e,--X);return Fa(),n}function La(){return{kind:`Name`,value:Ia()}}var Ra=/(?:"""|(?:[\s\S]*?[^\\])""")/y,za=/(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;function Ba(e){var t;switch(Y.charCodeAt(X)){case 91:X++,Fa();for(var n=[];Y.charCodeAt(X)!==93;)n.push(Ba(e));return X++,Fa(),{kind:`ListValue`,values:n};case 123:X++,Fa();for(var r=[];Y.charCodeAt(X)!==125;){var i=La();if(Y.charCodeAt(X++)!==58)throw ja(`ObjectField`);Fa(),r.push({kind:`ObjectField`,name:i,value:Ba(e)})}return X++,Fa(),{kind:`ObjectValue`,fields:r};case 36:if(e)throw ja(`Variable`);return X++,{kind:`Variable`,name:La()};case 34:if(Y.charCodeAt(X+1)===34&&Y.charCodeAt(X+2)===34){if(X+=3,(t=Ma(Ra))==null)throw ja(`StringValue`);return Fa(),{kind:`StringValue`,value:Pa(t.slice(0,-3)),block:!0}}var a=X,o;X++;var s=!1;for(o=0|Y.charCodeAt(X++);o===92&&(X++,s=!0)||o!==10&&o!==13&&o!==34&&o;o=0|Y.charCodeAt(X++));if(o!==34)throw ja(`StringValue`);return t=Y.slice(a,X),Fa(),{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=X++,l;(l=0|Y.charCodeAt(X++))>=48&&l<=57;);var u=Y.slice(c,--X);if((l=Y.charCodeAt(X))===46||l===69||l===101){if((t=Ma(za))==null)throw ja(`FloatValue`);return Fa(),{kind:`FloatValue`,value:u+t}}return Fa(),{kind:`IntValue`,value:u};case 110:if(Y.charCodeAt(X+1)===117&&Y.charCodeAt(X+2)===108&&Y.charCodeAt(X+3)===108)return X+=4,Fa(),{kind:`NullValue`};break;case 116:if(Y.charCodeAt(X+1)===114&&Y.charCodeAt(X+2)===117&&Y.charCodeAt(X+3)===101)return X+=4,Fa(),{kind:`BooleanValue`,value:!0};break;case 102:if(Y.charCodeAt(X+1)===97&&Y.charCodeAt(X+2)===108&&Y.charCodeAt(X+3)===115&&Y.charCodeAt(X+4)===101)return X+=5,Fa(),{kind:`BooleanValue`,value:!1}}return{kind:`EnumValue`,value:Ia()}}function Va(e){if(Y.charCodeAt(X)===40){var t=[];X++,Fa();do{var n=La();if(Y.charCodeAt(X++)!==58)throw ja(`Argument`);Fa(),t.push({kind:`Argument`,name:n,value:Ba(e)})}while(Y.charCodeAt(X)!==41);return X++,Fa(),t}}function Ha(e){if(Y.charCodeAt(X)===64){var t=[];do X++,t.push({kind:`Directive`,name:La(),arguments:Va(e)});while(Y.charCodeAt(X)===64);return t}}function Ua(){for(var e=0;Y.charCodeAt(X)===91;)e++,X++,Fa();var t={kind:`NamedType`,name:La()};do if(Y.charCodeAt(X)===33&&(X++,Fa(),t={kind:`NonNullType`,type:t}),e){if(Y.charCodeAt(X++)!==93)throw ja(`NamedType`);Fa(),t={kind:`ListType`,type:t}}while(e--);return t}function Wa(){if(Y.charCodeAt(X++)!==123)throw ja(`SelectionSet`);return Fa(),Ga()}function Ga(){var e=[];do if(Y.charCodeAt(X)===46){if(Y.charCodeAt(++X)!==46||Y.charCodeAt(++X)!==46)throw ja(`SelectionSet`);switch(X++,Fa(),Y.charCodeAt(X)){case 64:e.push({kind:`InlineFragment`,typeCondition:void 0,directives:Ha(!1),selectionSet:Wa()});break;case 111:Y.charCodeAt(X+1)===110?(X+=2,Fa(),e.push({kind:`InlineFragment`,typeCondition:{kind:`NamedType`,name:La()},directives:Ha(!1),selectionSet:Wa()})):e.push({kind:`FragmentSpread`,name:La(),directives:Ha(!1)});break;case 123:X++,Fa(),e.push({kind:`InlineFragment`,typeCondition:void 0,directives:void 0,selectionSet:Ga()});break;default:e.push({kind:`FragmentSpread`,name:La(),directives:Ha(!1)})}}else{var t=La(),n=void 0;Y.charCodeAt(X)===58&&(X++,Fa(),n=t,t=La());var r=Va(!1),i=Ha(!1),a=void 0;Y.charCodeAt(X)===123&&(X++,Fa(),a=Ga()),e.push({kind:`Field`,alias:n,name:t,arguments:r,directives:i,selectionSet:a})}while(Y.charCodeAt(X)!==125);return X++,Fa(),{kind:`SelectionSet`,selections:e}}function Ka(){if(Fa(),Y.charCodeAt(X)===40){var e=[];X++,Fa();do{var t=void 0;if(Y.charCodeAt(X)===34&&(t=Ba(!0)),Y.charCodeAt(X++)!==36)throw ja(`Variable`);var n=La();if(Y.charCodeAt(X++)!==58)throw ja(`VariableDefinition`);Fa();var r=Ua(),i=void 0;Y.charCodeAt(X)===61&&(X++,Fa(),i=Ba(!0)),Fa();var a={kind:`VariableDefinition`,variable:{kind:`Variable`,name:n},type:r,defaultValue:i,directives:Ha(!0)};t&&(a.description=t),e.push(a)}while(Y.charCodeAt(X)!==41);return X++,Fa(),e}}function qa(e){var t=La();if(Y.charCodeAt(X++)!==111||Y.charCodeAt(X++)!==110)throw ja(`FragmentDefinition`);Fa();var n={kind:`FragmentDefinition`,name:t,typeCondition:{kind:`NamedType`,name:La()},directives:Ha(!1),selectionSet:Wa()};return e&&(n.description=e),n}function Ja(){var e=[];do{var t=void 0;if(Y.charCodeAt(X)===34&&(t=Ba(!0)),Y.charCodeAt(X)===123){if(t)throw ja(`Document`);X++,Fa(),e.push({kind:`OperationDefinition`,operation:`query`,name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:Ga()})}else{var n=Ia();switch(n){case`fragment`:e.push(qa(t));break;case`query`:case`mutation`:case`subscription`:var r,i=void 0;(r=Y.charCodeAt(X))!==40&&r!==64&&r!==123&&(i=La());var a={kind:`OperationDefinition`,operation:n,name:i,variableDefinitions:Ka(),directives:Ha(!1),selectionSet:Wa()};t&&(a.description=t),e.push(a);break;default:throw ja(`Document`)}}}while(X<Y.length);return e}function Ya(e,t){return Y=e.body?e.body:e,X=0,Fa(),t&&t.noLocation?{kind:`Document`,definitions:Ja()}:{kind:`Document`,definitions:Ja(),loc:{start:0,end:Y.length,startToken:void 0,endToken:void 0,source:{body:Y,name:`graphql.web`,locationOffset:{line:1,column:1}}}}}function Xa(e,t,n){for(var r=``,i=0;i<e.length;i++)i&&(r+=t),r+=n(e[i]);return r}function Za(e){return JSON.stringify(e)}function Qa(e){return`"""
5
5
  `+e.replace(/"""/g,`\\"""`)+`
@@ -967,7 +967,7 @@ https://bit.ly/2XbVrpR#`;function Zf(e,t,n){if(!e){var r=t||`Minfied Error #`+n+
967
967
  gap: 1.2rem;
968
968
  padding: 2rem 1.5rem;
969
969
  }
970
- `,dC=`stub`,fC=()=>{let e=F(),[t]=wh(Wh(Q.WATCH)),[n]=wh(Wh(Q.LOGIN_CALLBACK));return t||n?null:/* @__PURE__ */ V(`footer`,{css:uC,children:[/* @__PURE__ */ L(kh,{to:Gh(Q.HOME),className:`wordmark`,onClick:iS,children:dC}),/* @__PURE__ */ L(kh,{to:Gh(Q.LEGAL),className:`nav-link`,children:e.formatMessage({id:`Legal`,defaultMessage:`Legal`})}),/* @__PURE__ */ L(kh,{to:Gh(Q.PRIVACY),className:`nav-link`,children:e.formatMessage({id:`Privacy`,defaultMessage:`Privacy`})}),/* @__PURE__ */ V(`span`,{className:`version`,title:e.formatMessage({id:`stub v{version}, commit {commit}`,defaultMessage:`stub v{version}, commit {commit}`},{version:`0.0.72`,commit:`8a8a0ab`}),children:[`v0.0.72`,` `,/* @__PURE__ */ L(`span`,{className:`commit`,children:`8a8a0ab`})]})]})};H();var pC=(e,{uri:t,sources:n=[]})=>n.length?e.formatList(n.map(e=>e.name),nn):t.replace(/^npm:/,``),mC=()=>{let[e,t]=z(du);return K(()=>{let e=()=>t(du());return e(),cu(e)},[]),e};H();var hC=I`
970
+ `,dC=`stub`,fC=()=>{let e=F(),[t]=wh(Wh(Q.WATCH)),[n]=wh(Wh(Q.LOGIN_CALLBACK));return t||n?null:/* @__PURE__ */ V(`footer`,{css:uC,children:[/* @__PURE__ */ L(kh,{to:Gh(Q.HOME),className:`wordmark`,onClick:iS,children:dC}),/* @__PURE__ */ L(kh,{to:Gh(Q.LEGAL),className:`nav-link`,children:e.formatMessage({id:`Legal`,defaultMessage:`Legal`})}),/* @__PURE__ */ L(kh,{to:Gh(Q.PRIVACY),className:`nav-link`,children:e.formatMessage({id:`Privacy`,defaultMessage:`Privacy`})}),/* @__PURE__ */ V(`span`,{className:`version`,title:e.formatMessage({id:`stub v{version}, commit {commit}`,defaultMessage:`stub v{version}, commit {commit}`},{version:`0.0.73`,commit:`0d30b87`}),children:[`v0.0.73`,` `,/* @__PURE__ */ L(`span`,{className:`commit`,children:`0d30b87`})]})]})};H();var pC=(e,{uri:t,sources:n=[]})=>n.length?e.formatList(n.map(e=>e.name),nn):t.replace(/^npm:/,``),mC=()=>{let[e,t]=z(du);return K(()=>{let e=()=>t(du());return e(),cu(e)},[]),e};H();var hC=I`
971
971
  --notice-top: calc(var(--fkn-inset-top, 0px) + var(--stub-header-height) + 1.6rem);
972
972
  position: fixed;
973
973
  top: var(--notice-top);
@@ -2883,7 +2883,7 @@ position: relative;
2883
2883
  @media (max-width: 768px) {
2884
2884
  --card-gutter: 1.5rem;
2885
2885
  }
2886
- `,AD=({uri:e,onAnswer:t})=>{let[{data:n}]=Rs({query:DD,variables:{input:{uri:e}}}),r=n?.media;return K(()=>{r&&t(e,r)},[r]),null},jD=()=>{let e=new Date(wT()),[{data:t}]=Rs({query:hD}),[n,r]=z({}),i=t?.viewerLists?.rows??[],a=B(()=>CD(i,e),[i]),o=(e,t)=>r(n=>({...n,[e]:{...t,settled:t.settled||n[e]?.settled}}));return{episodes:ED(i,t=>TD(t,n[t.uri],e),e).map(e=>({...e,stored:n[e.work.uri]})),asks:a.map(e=>/* @__PURE__ */ L(AD,{uri:e.uri,onAnswer:o},e.uri)),reading:!t||!!t.viewerLists?.lists.some(e=>e.state===`LOADING`)||a.some(e=>!n[e.uri]?.settled)}},MD=({episode:{work:e,next:t,count:n,stored:r},style:i})=>{let a=F();return/* @__PURE__ */ V(kh,{to:Gh(Q.MEDIA,{uri:e.uri,name:e.summary.title}),css:OD,className:`card`,style:i,children:[e.summary.cover?/* @__PURE__ */ L(`img`,{src:e.summary.cover,alt:``,loading:`lazy`}):void 0,/* @__PURE__ */ V(`div`,{className:`about`,children:[/* @__PURE__ */ L(`span`,{className:`title`,children:e.summary.title??e.uri}),/* @__PURE__ */ V(`span`,{className:`facts`,children:[/* @__PURE__ */ L(`span`,{children:a.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:t})}),/* @__PURE__ */ L(`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__ */ L(AE,{media:e.type?e:r??e})]})},ND=({style:e,columnIndex:t,card:n,episodes:r})=>{let i=r[t];return i?/* @__PURE__ */ L(MD,{episode:i,style:{...e,width:n.width,height:n.height,marginInlineStart:`var(--card-gutter, 100px)`}}):null},PD=()=>{let e=F(),{episodes:t,asks:n}=jD();return/* @__PURE__ */ V(W,{children:[n,t.length?/* @__PURE__ */ V(`section`,{css:kD,className:`home-row`,children:[/* @__PURE__ */ L(PE,{title:e.formatMessage({id:`Continue watching`,defaultMessage:`Continue watching`}),to:Gh(Q.CONTINUE)}),/* @__PURE__ */ L(dD,{name:`new-episodes`,count:Math.min(t.length,20),cell:ND,cellProps:{episodes:t}})]}):void 0]})},FD=`this build of the worker exposes no traceGraph, so there is nothing to read a trace from`,ID=async()=>await import(`./assets/lib-worker-Dkvb6OJM.js`),LD=async e=>{let t=await ID();if(typeof t.traceGraph!=`function`)throw Error(FD);return t.traceGraph(e)},RD=async e=>{let t=await ID();if(typeof t.traceAnswer!=`function`)throw Error(FD);return t.traceAnswer(e)},zD=[`graph`,`store`],BD=({uri:e,search:t}={})=>{let n=Gh(Q.DEBUG_TRACE),r=new URLSearchParams;e&&r.set(`uri`,e);let i=WD(t??``);for(let e of zD)for(let t of i.getAll(e))r.append(e,t);let a=r.toString();return a?`${n}?${a}`:n},VD=e=>{let t=WD(KD(e)),n=new URLSearchParams;for(let e of zD)for(let r of t.getAll(e))n.append(e,r);let r=n.toString();return r?`?${r}`:``},HD=(e,t=`graph`)=>{let n=WD(e);return n.set(t,`1`),`${Gh(Q.DEBUG_TRACE)}?${n.toString()}`},UD=e=>{let t=WD(e);t.delete(`store`);let n=t.toString();return`${Gh(Q.DEBUG_TRACE)}${n?`?${n}`:``}`},WD=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),GD=typeof location>`u`?``:location.search,KD=(e=``)=>{let t=WD(GD);for(let[n,r]of WD(e))t.set(n,r);return t.toString()},qD=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e).get(`uri`)??``,JD={PREQUEL:`SEQUEL`,ADAPTATION:`SOURCE`,COMPILATION:`CONTAINS`,SIDE_STORY:`PARENT`},YD=e=>{let t=/* @__PURE__ */ new Set,n=[];for(let r of e){if(!r?.from||!r?.to||r.from===r.to)continue;let e=JD[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},XD=/* @__PURE__ */ new Set([`TV`,`TV_SHORT`,`MOVIE`,`SPECIAL`,`OVA`,`ONA`,`MUSIC`]),ZD=e=>!e||XD.has(e),QD=e=>[...new Set((e.nodes??[]).map(e=>e.format??``).filter(Boolean))].sort(),$D=(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))}},eO=e=>`${e.from}\u0000${e.to}\u0000${e.relation}`,tO=(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(eO))}}let n=t.find(t=>eO(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}},nO=e=>e.titles?.[0]?.title||e.uri,rO=e=>[...e].sort((e,t)=>(e.startDate??`9999`).localeCompare(t.startDate??`9999`)||nO(e).localeCompare(nO(t))),iO=(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},aO=(e,t=`story`)=>{let n=YD(e.edges??[]),r=new Set((e.nodes??[]).map(e=>e.uri)),i=n.filter(e=>r.has(e.from)&&r.has(e.to)),a=rO(e.nodes??[]),o=t===`graph`?iO(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())}},oO=Ee({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`}}),sO=[`SOURCE`,`PREQUEL`,`SEQUEL`,`PARENT`,`SIDE_STORY`,`SPIN_OFF`,`ALTERNATIVE`,`ADAPTATION`,`SUMMARY`,`COMPILATION`,`CONTAINS`,`CHARACTER`,`OTHER`],cO=e=>{let t=sO.indexOf(e);return t===-1?sO.length:t},lO=e=>q.formatMessage(e&&oO[e]||oO.OTHER),uO=Ee({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`}}),dO=e=>{if(!e)return;let t=uO[e];return t?q.formatMessage(t):e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)},fO=e=>[...e].sort((e,t)=>cO(e.relation)-cO(t.relation)),pO=e=>e.filter(e=>ZD(e.format)),mO=3,hO=I`
2886
+ `,AD=({uri:e,onAnswer:t})=>{let[{data:n}]=Rs({query:DD,variables:{input:{uri:e}}}),r=n?.media;return K(()=>{r&&t(e,r)},[r]),null},jD=()=>{let e=new Date(wT()),[{data:t}]=Rs({query:hD}),[n,r]=z({}),i=t?.viewerLists?.rows??[],a=B(()=>CD(i,e),[i]),o=(e,t)=>r(n=>({...n,[e]:{...t,settled:t.settled||n[e]?.settled}}));return{episodes:ED(i,t=>TD(t,n[t.uri],e),e).map(e=>({...e,stored:n[e.work.uri]})),asks:a.map(e=>/* @__PURE__ */ L(AD,{uri:e.uri,onAnswer:o},e.uri)),reading:!t||!!t.viewerLists?.lists.some(e=>e.state===`LOADING`)||a.some(e=>!n[e.uri]?.settled)}},MD=({episode:{work:e,next:t,count:n,stored:r},style:i})=>{let a=F();return/* @__PURE__ */ V(kh,{to:Gh(Q.MEDIA,{uri:e.uri,name:e.summary.title}),css:OD,className:`card`,style:i,children:[e.summary.cover?/* @__PURE__ */ L(`img`,{src:e.summary.cover,alt:``,loading:`lazy`}):void 0,/* @__PURE__ */ V(`div`,{className:`about`,children:[/* @__PURE__ */ L(`span`,{className:`title`,children:e.summary.title??e.uri}),/* @__PURE__ */ V(`span`,{className:`facts`,children:[/* @__PURE__ */ L(`span`,{children:a.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:t})}),/* @__PURE__ */ L(`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__ */ L(AE,{media:e.type?e:r??e})]})},ND=({style:e,columnIndex:t,card:n,episodes:r})=>{let i=r[t];return i?/* @__PURE__ */ L(MD,{episode:i,style:{...e,width:n.width,height:n.height,marginInlineStart:`var(--card-gutter, 100px)`}}):null},PD=()=>{let e=F(),{episodes:t,asks:n}=jD();return/* @__PURE__ */ V(W,{children:[n,t.length?/* @__PURE__ */ V(`section`,{css:kD,className:`home-row`,children:[/* @__PURE__ */ L(PE,{title:e.formatMessage({id:`Continue watching`,defaultMessage:`Continue watching`}),to:Gh(Q.CONTINUE)}),/* @__PURE__ */ L(dD,{name:`new-episodes`,count:Math.min(t.length,20),cell:ND,cellProps:{episodes:t}})]}):void 0]})},FD=`this build of the worker exposes no traceGraph, so there is nothing to read a trace from`,ID=async()=>await import(`./assets/lib-worker-BPZX4rEX.js`),LD=async e=>{let t=await ID();if(typeof t.traceGraph!=`function`)throw Error(FD);return t.traceGraph(e)},RD=async e=>{let t=await ID();if(typeof t.traceAnswer!=`function`)throw Error(FD);return t.traceAnswer(e)},zD=[`graph`,`store`],BD=({uri:e,search:t}={})=>{let n=Gh(Q.DEBUG_TRACE),r=new URLSearchParams;e&&r.set(`uri`,e);let i=WD(t??``);for(let e of zD)for(let t of i.getAll(e))r.append(e,t);let a=r.toString();return a?`${n}?${a}`:n},VD=e=>{let t=WD(KD(e)),n=new URLSearchParams;for(let e of zD)for(let r of t.getAll(e))n.append(e,r);let r=n.toString();return r?`?${r}`:``},HD=(e,t=`graph`)=>{let n=WD(e);return n.set(t,`1`),`${Gh(Q.DEBUG_TRACE)}?${n.toString()}`},UD=e=>{let t=WD(e);t.delete(`store`);let n=t.toString();return`${Gh(Q.DEBUG_TRACE)}${n?`?${n}`:``}`},WD=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),GD=typeof location>`u`?``:location.search,KD=(e=``)=>{let t=WD(GD);for(let[n,r]of WD(e))t.set(n,r);return t.toString()},qD=e=>new URLSearchParams(e.startsWith(`?`)?e.slice(1):e).get(`uri`)??``,JD={PREQUEL:`SEQUEL`,ADAPTATION:`SOURCE`,COMPILATION:`CONTAINS`,SIDE_STORY:`PARENT`},YD=e=>{let t=/* @__PURE__ */ new Set,n=[];for(let r of e){if(!r?.from||!r?.to||r.from===r.to)continue;let e=JD[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},XD=/* @__PURE__ */ new Set([`TV`,`TV_SHORT`,`MOVIE`,`SPECIAL`,`OVA`,`ONA`,`MUSIC`]),ZD=e=>!e||XD.has(e),QD=e=>[...new Set((e.nodes??[]).map(e=>e.format??``).filter(Boolean))].sort(),$D=(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))}},eO=e=>`${e.from}\u0000${e.to}\u0000${e.relation}`,tO=(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(eO))}}let n=t.find(t=>eO(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}},nO=e=>e.titles?.[0]?.title||e.uri,rO=e=>[...e].sort((e,t)=>(e.startDate??`9999`).localeCompare(t.startDate??`9999`)||nO(e).localeCompare(nO(t))),iO=(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},aO=(e,t=`story`)=>{let n=YD(e.edges??[]),r=new Set((e.nodes??[]).map(e=>e.uri)),i=n.filter(e=>r.has(e.from)&&r.has(e.to)),a=rO(e.nodes??[]),o=t===`graph`?iO(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())}},oO=Ee({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`}}),sO=[`SOURCE`,`PREQUEL`,`SEQUEL`,`PARENT`,`SIDE_STORY`,`SPIN_OFF`,`ALTERNATIVE`,`ADAPTATION`,`SUMMARY`,`COMPILATION`,`CONTAINS`,`CHARACTER`,`OTHER`],cO=e=>{let t=sO.indexOf(e);return t===-1?sO.length:t},lO=e=>q.formatMessage(e&&oO[e]||oO.OTHER),uO=Ee({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`}}),dO=e=>{if(!e)return;let t=uO[e];return t?q.formatMessage(t):e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)},fO=e=>[...e].sort((e,t)=>cO(e.relation)-cO(t.relation)),pO=e=>e.filter(e=>ZD(e.format)),mO=3,hO=I`
2887
2887
  & > h2 {
2888
2888
  display: flex;
2889
2889
  align-items: center;
@@ -3095,8 +3095,8 @@ overflow-wrap: anywhere;
3095
3095
 
3096
3096
  `,`
3097
3097
  +`).split(`
3098
- `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return K(()=>{let n=t?.target??sR,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&RF(e))return!1;let n=uR(e.code,s);if(a.current.add(e[n]),lR(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=uR(e.code,s);lR(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function lR(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function uR(e,t){return t.includes(e)?`code`:`key`}var dR=()=>{let e=PL();return B(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=wF(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return yF(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=bF(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function fR(e,t){let n=[],r=/* @__PURE__ */ new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)pR(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function pR(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing)}}function mR(e,t){return fR(e,t)}function hR(e,t){return fR(e,t)}function gR(e,t){return{id:e,type:`select`,selected:t}}function _R(e,t=/* @__PURE__ */ new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);(a.selected!==void 0||e)&&a.selected!==e&&(n&&(a.selected=e),r.push(gR(a.id,e)))}return r}function vR({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function yR(e){return{id:e.id,type:`remove`}}var bR=_F(`React Flow`,`https://reactflow.dev/`);function xR(e,t,n={}){return ZF(e,t,{...n,onError:n.onError??bR})}var SR=e=>GP(e),CR=e=>WP(e);function wR(e){return De(e)}var TR=typeof window<`u`?ht:K;function ER(e){let[t,n]=z(BigInt(0)),[r]=z(()=>DR(()=>n(e=>e+BigInt(1))));return TR(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function DR(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var OR=xt(null);function kR({children:e}){let t=PL(),n=ER(R(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=vR({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=ER(R(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(vR({items:s,lookup:o}))},[])),i=B(()=>({nodeQueue:n,edgeQueue:r}),[]);return U(OR.Provider,{value:i,children:e})}function AR(){let e=pt(OR);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var jR=e=>!!e.panZoom;function MR(){let e=dR(),t=PL(),n=AR(),r=NL(jR),i=B(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=SR(e)?e:n.get(e.id),a=i.parentId?kF(i.position,i.measured,i.parentId,n,r):i.position;return uF({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&SR(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&CR(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await tF({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(yR);o?.(f),c(e)}if(m){let e=d.map(yR);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=hF(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=uF(s?r:a),l=mF(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=hF(e)?e:a(e);if(!r)return!1;let i=mF(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return JP(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??jF();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return B(()=>({...i,...e,viewportInitialized:r}),[r])}var NR=e=>e.selected,PR=typeof window<`u`?window:void 0;function FR({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=PL(),{deleteElements:r}=MR(),i=cR(e,{actInsideInputWithModifier:!1}),a=cR(t,{target:PR});K(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(NR),edges:e.filter(NR)}),n.setState({nodesSelectionActive:!1})}},[i]),K(()=>{n.setState({multiSelectionActive:a})},[a])}function IR(e){let t=PL();K(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=FF(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,NP.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var LR={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},RR=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function zR({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=RP.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:g,noPanClassName:_,onViewportChange:v,isControlledViewport:y,paneClickDistance:b,selectionOnDrag:x}){let S=PL(),C=G(null),{userSelectionActive:w,lib:T,connectionInProgress:E}=NL(RR,kL),D=cR(p),O=G();IR(C);let k=R(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||S.setState({transform:e})},[v,y]);return K(()=>{if(C.current){O.current=oL({domNode:C.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return S.setState({panZoom:O.current,transform:[e,t,n],domNode:C.current.closest(`.react-flow`)}),()=>{O.current?.destroy()}}},[]),K(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:D,preventScrolling:m,noPanClassName:_,userSelectionActive:w,noWheelClassName:g,lib:T,onTransformChange:k,connectionInProgress:E,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,c,D,m,_,w,g,T,k,E,x,b]),U(`div`,{className:`react-flow__renderer`,ref:C,style:LR,children:h})}var BR=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function VR(){let{userSelectionActive:e,userSelectionRect:t}=NL(BR,kL);return e&&t?U(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var HR=(e,t)=>n=>{n.target===t.current&&e?.(n)},UR=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function WR({isSelecting:e,selectionKeyPressed:t,selectionMode:n=zP.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=G(0),_=PL(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=NL(UR,kL),C=y&&(e||v),w=G(null),T=G(),E=G(/* @__PURE__ */ new Set),D=G(/* @__PURE__ */ new Set),O=G(!1),k=G(!1),A=G({x:0,y:0}),j=G(!1),ee=e=>{k.current||O.current||_.getState().connection.inProgress?(k.current=!1,O.current=!1):(l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1}))},M=e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():u?.(e)},te=d?e=>d(e):void 0,ne=e=>{k.current&&=(e.stopPropagation(),!1)},re=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(T.current=i?.getBoundingClientRect(),!T.current)return;let s=n.target===w.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:c,y:l}=BF(n.nativeEvent,T.current),u=yF({x:c,y:l},a);_.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(n.stopPropagation(),n.preventDefault())};function ie(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=bF(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(XP(a,m,i,n===zP.Partial,!0).map(e=>e.id)),D.current=/* @__PURE__ */ new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}AF(h,E.current)||c(_R(a,E.current,!0)),AF(g,D.current)||l(_R(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function N(){if(!i||!T.current)return;let[e,t]=oF(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(N);return}let{x:t,y:n}=A.current;ie(t,n),g.current=requestAnimationFrame(N)})}let P=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};K(()=>()=>P(),[]);let ae=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=BF(e.nativeEvent,T.current);A.current={x:o,y:c};let l=bF({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(N(),!0),ie(o,c)},oe=e=>{C?e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&ee?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),P()):e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0)},se=e=>{e.target?.releasePointerCapture?.(e.pointerId),P()},ce=r===!0||Array.isArray(r)&&r.includes(0);return U(`div`,{className:XO([`react-flow__pane`,{draggable:ce,dragging:b,selection:e}]),onClick:C?void 0:HR(ee,w),onContextMenu:HR(M,w),onWheel:HR(te,w),onPointerEnter:C?void 0:f,onPointerMove:C?ae:p,onPointerUp:oe,onPointerCancel:C?se:void 0,onPointerDownCapture:C?re:void 0,onClickCapture:C?ne:void 0,onPointerLeave:m,ref:w,style:LR,children:[h,U(VR,{})]})}function GR({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);l?(t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):c?.(`012`,NP.error012(e))}function KR({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=PL(),[c,l]=z(!1),u=G();return K(()=>{if(!t)return u.current=FI({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{GR({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),K(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var qR=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function JR(){let e=PL();return R(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=/* @__PURE__ */ new Map,d=qR(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=vF(t,i));let{position:a,positionAbsolute:s}=eF({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var YR=xt(null),XR=YR.Provider;YR.Consumer;var ZR=()=>pt(YR),QR=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),$R=xt(null);function ez({children:e}){let t=NL(QR,kL);return U($R.Provider,{value:t,children:e})}function tz(){let e=pt($R);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var nz={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},rz=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return nz;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===LP.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function iz({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=PL(),_=ZR(),{connectOnClick:v,noPanClassName:y,rfId:b}=tz(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=NL(rz(_,m,e),kL);_||g.getState().onError?.(`010`,NP.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(xR(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=zF(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();GI.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return U(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:XO([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=IF(t.target),h=n||c,{connection:v,isValid:y}=GI.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var az=Le(wR(iz));function oz({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return U(wt,{children:[e?.label,U(az,{type:`source`,position:n,isConnectable:t})]})}function sz({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return U(wt,{children:[U(az,{type:`target`,position:n,isConnectable:t}),e?.label,U(az,{type:`source`,position:r,isConnectable:t})]})}function cz(){return null}function lz({data:e,isConnectable:t,targetPosition:n=$.Top}){return U(wt,{children:[U(az,{type:`target`,position:n,isConnectable:t}),e?.label]})}var uz={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},dz={input:oz,default:sz,output:lz,group:cz};function fz(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var pz=e=>{let{width:t,height:n,x:r,y:i}=YP(e.nodeLookup,{filter:e=>!!e.selected});return{width:gF(t)?t:null,height:gF(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function mz({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=PL(),{width:i,height:a,transformString:o,userSelectionActive:s}=NL(pz,kL),c=JR(),l=G(null);K(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(KR({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return U(`div`,{className:XO([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:U(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(uz,e.key)&&(e.preventDefault(),c({direction:uz[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var hz=typeof window<`u`?window:void 0,gz=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function _z({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:ee,noPanClassName:M,disableKeyboardA11y:te,onViewportChange:ne,isControlledViewport:re}){let{nodesSelectionActive:ie,userSelectionActive:N}=NL(gz,kL),P=cR(l,{target:hz}),ae=cR(h,{target:hz}),oe=ae||w,se=ae||b,ce=u&&oe!==!0,le=P||N||ce;return FR({deleteKeyCode:c,multiSelectionKeyCode:m}),U(zR,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:se,panActivationKeyPressed:ae,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!P&&oe,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:ee,noPanClassName:M,onViewportChange:ne,isControlledViewport:re,paneClickDistance:s,selectionOnDrag:ce,children:U(WR,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:oe,autoPanOnSelection:T,isSelecting:!!le,selectionMode:d,selectionKeyPressed:P,paneClickDistance:s,selectionOnDrag:ce,children:[e,ie&&U(mz,{onSelectionContextMenu:j,noPanClassName:M,disableKeyboardA11y:te})]})})}_z.displayName=`FlowRenderer`;var vz=Le(_z),yz=e=>t=>e?XP(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function bz(e){return NL(R(yz(e),[e]),kL)}var xz=e=>e.updateNodeInternals;function Sz(){let e=NL(xz),[t]=z(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=/* @__PURE__ */ new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return K(()=>()=>{t?.disconnect()},[t]),t}function Cz({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=PL(),a=G(null),o=G(null),s=G(e.sourcePosition),c=G(e.targetPosition),l=G(t),u=n&&!!e.internals.handleBounds;return K(()=>{!a.current||e.hidden||u&&o.current===a.current||(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),K(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),K(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(/* @__PURE__ */ new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function wz({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=NL(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},kL),S=y.type||`default`,C=g?.[S]||dz[S];C===void 0&&(v?.(`003`,NP.error003(S)),S=`default`,C=g?.default||dz.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=PL(),k=OF(y),A=Cz({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=KR({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),ee=JR();if(y.hidden)return null;let M=DF(y),te=fz(y),ne=T||w||t||n||r||i,re=n?e=>n(e,{...b.userNode}):void 0,ie=r?e=>r(e,{...b.userNode}):void 0,N=i?e=>i(e,{...b.userNode}):void 0,P=a?e=>a(e,{...b.userNode}):void 0,ae=o?e=>o(e,{...b.userNode}):void 0,oe=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&GR({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},se=t=>{if(!(RF(t.nativeEvent)||m)){if(FP.includes(t.key)&&T){let n=t.key===`Escape`;GR({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(uz,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),ee({direction:uz[t.key],factor:t.shiftKey?4:1})}}},ce=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(XP(/* @__PURE__ */ new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+M.width/2,y.position.y+M.height/2,{zoom:t[2]}))};return U(`div`,{className:XO([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ne?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...te},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:re,onMouseMove:ie,onMouseLeave:N,onContextMenu:P,onClick:oe,onDoubleClick:ae,onKeyDown:D?se:void 0,tabIndex:D?0:void 0,onFocus:D?ce:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${LL}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:U(XR,{value:e,children:U(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...M})})})}var Tz=Le(wz),Ez=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Dz(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=NL(Ez,kL),a=bz(e.onlyRenderVisibleElements),o=Sz();return U(`div`,{className:`react-flow__nodes`,style:LR,children:a.map(a=>U(Tz,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}Dz.displayName=`NodeRenderer`;var Oz=Le(Dz);function kz(e){return NL(R(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&JF({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),kL)}var Az=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return U(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},jz=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return U(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},Mz={[HP.Arrow]:Az,[HP.ArrowClosed]:jz};function Nz(e){let t=PL();return B(()=>Object.prototype.hasOwnProperty.call(Mz,e)?Mz[e]:(t.getState().onError?.(`009`,NP.error009(e)),null),[e])}var Pz=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Nz(t);return c?U(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:U(c,{color:n,strokeWidth:o})}):null},Fz=({defaultColor:e,rfId:t})=>{let n=NL(e=>e.edges),r=NL(e=>e.defaultEdgeOptions),i=B(()=>dI(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?U(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:U(`defs`,{children:i.map(e=>U(Pz,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Fz.displayName=`MarkerDefinitions`;var Iz=Le(Fz);function Lz({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=z({x:1,y:0,width:0,height:0}),p=XO([`react-flow__edge-textwrapper`,l]),m=G(null);return K(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?U(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&U(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),U(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}Lz.displayName=`EdgeText`;var Rz=Le(Lz);function zz({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return U(wt,{children:[U(`path`,{...u,d:e,fill:`none`,className:XO([`react-flow__edge-path`,u.className])}),l?U(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&gF(t)&&gF(n)?U(Rz,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Bz({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Vz({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=Bz({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Bz({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=HF({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Hz(e){return Le(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Vz({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return U(zz,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Uz=Hz({isInternal:!1}),Wz=Hz({isInternal:!0});Uz.displayName=`SimpleBezierEdge`,Wz.displayName=`SimpleBezierEdgeInternal`;function Gz(e){return Le(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=iI({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return U(zz,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var Kz=Gz({isInternal:!1}),qz=Gz({isInternal:!0});Kz.displayName=`SmoothStepEdge`,qz.displayName=`SmoothStepEdgeInternal`;function Jz(e){return Le(({id:t,...n})=>{let r=e.isInternal?void 0:t;return U(Kz,{...n,id:r,pathOptions:B(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Yz=Jz({isInternal:!1}),Xz=Jz({isInternal:!0});Yz.displayName=`StepEdge`,Xz.displayName=`StepEdgeInternal`;function Zz(e){return Le(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=QF({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return U(zz,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var Qz=Zz({isInternal:!1}),$z=Zz({isInternal:!0});Qz.displayName=`StraightEdge`,$z.displayName=`StraightEdgeInternal`;function eB(e){return Le(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=GF({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return U(zz,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var tB=eB({isInternal:!1}),nB=eB({isInternal:!0});tB.displayName=`BezierEdge`,nB.displayName=`BezierEdgeInternal`;var rB={default:nB,straight:$z,step:Xz,smoothstep:qz,simplebezier:Wz},iB={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},aB=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,oB=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,sB=`react-flow__edgeupdater`;function cB({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return U(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:XO([sB,`${sB}-${s}`]),cx:aB(t,r,e),cy:oB(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function lB({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=PL(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;GI.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return U(wt,{children:[(e===!0||e===`source`)&&U(cB,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&U(cB,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function uB({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=NL(t=>t.edgeLookup.get(e)),b=NL(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||rB[x];S===void 0&&(_?.(`011`,NP.error011(x)),x=`default`,S=h?.default||rB.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=G(null),[D,O]=z(!1),[k,A]=z(!1),j=PL(),{zIndex:ee=y.zIndex,sourceX:M,sourceY:te,targetX:ne,targetY:re,sourcePosition:ie,targetPosition:N}=NL(R(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return iB;let i=oI({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=qF({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||iB,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex,_]),kL),P=B(()=>y.markerStart?`url('#${uI(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ae=B(()=>y.markerEnd?`url('#${uI(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||M===null||te===null||ne===null||re===null)return null;let oe=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},se=a?e=>{a(e,{...y})}:void 0,ce=o?e=>{o(e,{...y})}:void 0,le=s?e=>{s(e,{...y})}:void 0,ue=c?e=>{c(e,{...y})}:void 0,de=l?e=>{l(e,{...y})}:void 0;return U(`svg`,{style:{zIndex:ee},children:U(`g`,{className:XO([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:oe,onDoubleClick:se,onContextMenu:ce,onMouseEnter:le,onMouseMove:ue,onMouseLeave:de,onKeyDown:C?t=>{if(!v&&FP.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${RL}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&U(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:M,sourceY:te,targetX:ne,targetY:re,sourcePosition:ie,targetPosition:N,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:P,markerEnd:ae,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&U(lB,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:M,sourceY:te,targetX:ne,targetY:re,sourcePosition:ie,targetPosition:N,setUpdateHover:O,setReconnecting:A})]})})}var dB=Le(uB),fB=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function pB({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=NL(fB,kL),b=kz(t);return U(`div`,{className:`react-flow__edges`,children:[U(Iz,{defaultColor:e,rfId:n}),b.map(e=>U(dB,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}pB.displayName=`EdgeRenderer`;var mB=Le(pB),hB=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function gB({children:e}){let t=PL(),n=G(null),[r]=z(()=>t.getState().transform);return TR(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=hB(r)))};return r(),t.subscribe(r)},[t]),U(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:hB(r)},children:e})}function _B(e){let t=MR(),n=G(!1);K(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var vB=e=>e.panZoom?.syncViewport;function yB(e){let t=NL(vB),n=PL();return K(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function bB(e){return e.connection.inProgress?{...e.connection,to:yF(e.connection.to,e.transform)}:{...e.connection}}function xB(e){return e?t=>e(bB(t)):bB}function SB(e){return NL(xB(e),kL)}var CB=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function wB({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=NL(CB,kL);return a&&i&&c?U(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:U(`g`,{className:XO([`react-flow__connection`,NF(s)]),children:U(TB,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var TB=({style:e,type:t=VP.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=SB();if(!i)return;if(n)return U(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:NF(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case VP.Bezier:[m]=GF(h);break;case VP.SimpleBezier:[m]=Vz(h);break;case VP.Step:[m]=iI({...h,borderRadius:0});break;case VP.SmoothStep:[m]=iI(h);break;default:[m]=QF(h)}return U(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};TB.displayName=`ConnectionLine`;var EB={};function DB(e=EB){G(e),PL(),K(()=>{},[e])}function OB(){PL(),G(!1),K(()=>{},[])}function kB({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:ee,zoomOnScroll:M,zoomOnPinch:te,panOnScroll:ne,panOnScrollSpeed:re,panOnScrollMode:ie,zoomOnDoubleClick:N,panOnDrag:P,autoPanOnSelection:ae,onPaneClick:oe,onPaneMouseEnter:se,onPaneMouseMove:ce,onPaneMouseLeave:le,onPaneScroll:ue,onPaneContextMenu:de,paneClickDistance:fe,nodeClickDistance:pe,onEdgeContextMenu:me,onEdgeMouseEnter:he,onEdgeMouseMove:ge,onEdgeMouseLeave:_e,reconnectRadius:ve,onReconnect:ye,onReconnectStart:be,onReconnectEnd:xe,noDragClassName:Se,noWheelClassName:Ce,noPanClassName:we,disableKeyboardA11y:Te,nodeExtent:Ee,rfId:De,viewport:Oe,onViewportChange:ke,nodesDraggable:Ae}){return DB(e),DB(t),OB(),_B(n),yB(Oe),U(vz,{onPaneClick:oe,onPaneMouseEnter:se,onPaneMouseMove:ce,onPaneMouseLeave:le,onPaneContextMenu:de,onPaneScroll:ue,paneClickDistance:fe,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:M,zoomOnPinch:te,zoomOnDoubleClick:N,panOnScroll:ne,panOnScrollSpeed:re,panOnScrollMode:ie,panOnDrag:P,autoPanOnSelection:ae,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:Se,noWheelClassName:Ce,noPanClassName:we,disableKeyboardA11y:Te,onViewportChange:ke,isControlledViewport:!!Oe,children:U(gB,{children:[U(mB,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:ye,onReconnectStart:be,onReconnectEnd:xe,onlyRenderVisibleElements:T,onEdgeContextMenu:me,onEdgeMouseEnter:he,onEdgeMouseMove:ge,onEdgeMouseLeave:_e,reconnectRadius:ve,defaultMarkerColor:ee,noPanClassName:we,disableKeyboardA11y:Te,rfId:De}),U(wB,{style:h,type:m,component:g,containerStyle:_}),U(`div`,{className:`react-flow__edgelabel-renderer`}),U(Oz,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:pe,onlyRenderVisibleElements:T,noPanClassName:we,noDragClassName:Se,disableKeyboardA11y:Te,nodeExtent:Ee,rfId:De,nodesDraggable:Ae}),U(`div`,{className:`react-flow__viewport-portal`})]})})}kB.displayName=`GraphView`;var AB=Le(kB),jB=_F(`React Flow`,`https://reactflow.dev/`),MB=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=/* @__PURE__ */ new Map,m=/* @__PURE__ */ new Map,h=/* @__PURE__ */ new Map,g=/* @__PURE__ */ new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??PP;kI(h,g,_);let{nodesInitialized:x}=bI(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=wF(YP(p,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:PP,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:LP.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...BP},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:jB,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:IP,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:/* @__PURE__ */ new Map,onEdgesChangeMiddlewareMap:/* @__PURE__ */ new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},NB=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>OL((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await $P({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...MB({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=bI(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();kI(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=EI(e,n,r,i,a,o,l);d&&(_I(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=cI(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=TI(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(mR(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(hR(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?i(e.map(e=>gR(e,!0))):(i(_R(r,/* @__PURE__ */ new Set([...e]),!0)),a(_R(n)))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?a(e.map(e=>gR(e,!0))):(a(_R(n,/* @__PURE__ */ new Set([...e]))),i(_R(r,/* @__PURE__ */ new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(gR(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(gR(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,gR(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,gR(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(bI(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return DI({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...BP}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...MB()})}},Object.is);function PB({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=z(()=>NB({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return U(jL,{value:m,children:U(kR,{children:U(ez,{children:p})})})}function FB({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return pt(AL)?U(wt,{children:e}):U(PB,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var IB={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function LB({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:ee,onSelectionContextMenu:M,onSelectionStart:te,onSelectionEnd:ne,onBeforeDelete:re,connectionMode:ie,connectionLineType:N=VP.Bezier,connectionLineStyle:P,connectionLineComponent:ae,connectionLineContainerStyle:oe,deleteKeyCode:se=`Backspace`,selectionKeyCode:ce=`Shift`,selectionOnDrag:le=!1,selectionMode:ue=zP.Full,panActivationKeyCode:de=`Space`,multiSelectionKeyCode:fe=TF()?`Meta`:`Control`,zoomActivationKeyCode:pe=TF()?`Meta`:`Control`,snapToGrid:me,snapGrid:he,onlyRenderVisibleElements:ge=!1,selectNodesOnDrag:_e,nodesDraggable:ve,autoPanOnNodeFocus:ye,nodesConnectable:be,nodesFocusable:xe,nodeOrigin:Se=$L,edgesFocusable:Ce,edgesReconnectable:we,elementsSelectable:Te=!0,defaultViewport:Ee=eR,minZoom:De=.5,maxZoom:Oe=2,translateExtent:ke=PP,preventScrolling:Ae=!0,nodeExtent:je,defaultMarkerColor:Me=`#b1b1b7`,zoomOnScroll:Ne=!0,zoomOnPinch:Pe=!0,panOnScroll:Fe=!1,panOnScrollSpeed:Ie=.5,panOnScrollMode:Le=RP.Free,zoomOnDoubleClick:F=!0,panOnDrag:Re=!0,onPaneClick:ze,onPaneMouseEnter:Be,onPaneMouseMove:Ve,onPaneMouseLeave:He,onPaneScroll:Ue,onPaneContextMenu:We,paneClickDistance:Ge=1,nodeClickDistance:Ke=0,children:qe,onReconnect:I,onReconnectStart:Je,onReconnectEnd:Ye,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,reconnectRadius:L=10,onNodesChange:tt,onEdgesChange:nt,noDragClassName:rt=`nodrag`,noWheelClassName:it=`nowheel`,noPanClassName:z=`nopan`,fitView:at,fitViewOptions:ot,connectOnClick:B,attributionPosition:st,proOptions:ct,defaultEdgeOptions:lt,elevateNodesOnSelect:ut=!0,elevateEdgesOnSelect:V=!1,disableKeyboardA11y:dt=!1,autoPanOnConnect:ft,autoPanOnNodeDrag:pt,autoPanOnSelection:mt=!0,autoPanSpeed:ht,connectionRadius:gt,isValidConnection:H,onError:_t,style:W,id:G,nodeDragThreshold:vt,connectionDragThreshold:yt,viewport:K,onViewportChange:bt,width:xt,height:St,colorMode:Ct=`light`,debug:wt,onScroll:Tt,ariaLabelConfig:Et,zIndexMode:Dt=`basic`,...Ot},kt){let At=G||`1`,jt=oR(Ct),Mt=R(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Tt?.(e)},[Tt]);return U(`div`,{"data-testid":`rf__wrapper`,...Ot,onScroll:Mt,style:{...W,...IB},ref:kt,className:XO([`react-flow`,i,jt]),id:G,role:`application`,children:U(FB,{nodes:e,edges:t,width:xt,height:St,fitView:at,fitViewOptions:ot,minZoom:De,maxZoom:Oe,nodeOrigin:Se,nodeExtent:je,zIndexMode:Dt,children:[U(iR,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:ve,autoPanOnNodeFocus:ye,nodesConnectable:be,nodesFocusable:xe,edgesFocusable:Ce,edgesReconnectable:we,elementsSelectable:Te,elevateNodesOnSelect:ut,elevateEdgesOnSelect:V,minZoom:De,maxZoom:Oe,nodeExtent:je,onNodesChange:tt,onEdgesChange:nt,snapToGrid:me,snapGrid:he,connectionMode:ie,translateExtent:ke,connectOnClick:B,defaultEdgeOptions:lt,fitView:at,fitViewOptions:ot,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:ee,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:z,nodeOrigin:Se,rfId:At,autoPanOnConnect:ft,autoPanOnNodeDrag:pt,autoPanSpeed:ht,onError:_t,connectionRadius:gt,isValidConnection:H,selectNodesOnDrag:_e,nodeDragThreshold:vt,connectionDragThreshold:yt,onBeforeDelete:re,debug:wt,ariaLabelConfig:Et,zIndexMode:Dt}),U(AB,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:N,connectionLineStyle:P,connectionLineComponent:ae,connectionLineContainerStyle:oe,selectionKeyCode:ce,selectionOnDrag:le,selectionMode:ue,deleteKeyCode:se,multiSelectionKeyCode:fe,panActivationKeyCode:de,zoomActivationKeyCode:pe,onlyRenderVisibleElements:ge,defaultViewport:Ee,translateExtent:ke,minZoom:De,maxZoom:Oe,preventScrolling:Ae,zoomOnScroll:Ne,zoomOnPinch:Pe,zoomOnDoubleClick:F,panOnScroll:Fe,panOnScrollSpeed:Ie,panOnScrollMode:Le,panOnDrag:Re,autoPanOnSelection:mt,onPaneClick:ze,onPaneMouseEnter:Be,onPaneMouseMove:Ve,onPaneMouseLeave:He,onPaneScroll:Ue,onPaneContextMenu:We,paneClickDistance:Ge,nodeClickDistance:Ke,onSelectionContextMenu:M,onSelectionStart:te,onSelectionEnd:ne,onReconnect:I,onReconnectStart:Je,onReconnectEnd:Ye,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,reconnectRadius:L,defaultMarkerColor:Me,noDragClassName:rt,noWheelClassName:it,noPanClassName:z,rfId:At,disableKeyboardA11y:dt,nodeExtent:je,viewport:K,onViewportChange:bt,nodesDraggable:ve}),U(QL,{onSelectionChange:k}),qe,U(KL,{proOptions:ct,position:st}),U(UL,{rfId:At,disableKeyboardA11y:dt})]})})}var RB=wR(LB);NP.error014();function zB({dimensions:e,lineWidth:t,variant:n,className:r}){return U(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:XO([`react-flow__background-pattern`,n,r])})}function BB({radius:e,className:t}){return U(`circle`,{cx:e,cy:e,r:e,className:XO([`react-flow__background-pattern`,`dots`,t])})}var VB;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(VB||={});var HB={[VB.Dots]:1,[VB.Lines]:1,[VB.Cross]:6},UB=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function WB({id:e,variant:t=VB.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=G(null),{transform:f,patternId:p}=NL(UB,kL),m=r||HB[t],h=t===VB.Dots,g=t===VB.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]+x[0]/2,b[1]*f[2]+x[1]/2],C=`${p}${e||``}`;return U(`svg`,{className:XO([`react-flow__background`,l]),style:{...c,...LR,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[U(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?U(BB,{radius:y/2,className:u}):U(zB,{dimensions:x,lineWidth:i,variant:t,className:u})}),U(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}WB.displayName=`Background`;var GB=Le(WB);function KB(){return U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:U(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function qB(){return U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:U(`path`,{d:`M0 0h32v4.2H0z`})})}function JB(){return U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:U(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function YB(){return U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:U(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function XB(){return U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:U(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function ZB({children:e,className:t,...n}){return U(`button`,{type:`button`,className:XO([`react-flow__controls-button`,t]),...n,children:e})}var QB=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function $B({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=PL(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=NL(QB,kL),{zoomIn:y,zoomOut:b,fitView:x}=MR();return U(WL,{className:XO([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&U(wt,{children:[U(ZB,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:U(KB,{})}),U(ZB,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:U(qB,{})})]}),n&&U(ZB,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:U(JB,{})}),r&&U(ZB,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:U(h?XB:YB,{})}),u]})}$B.displayName=`Controls`,Le($B);function eV({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return U(`rect`,{className:XO([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var tV=Le(eV),nV=e=>e.nodes.map(e=>e.id),rV=e=>e instanceof Function?e:()=>e;function iV({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=tV,onClick:o}){let s=NL(nV,kL),c=rV(t),l=rV(e),u=rV(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return U(wt,{children:s.map(e=>U(oV,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function aV({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=NL(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=DF(r);return{node:r,x:i,y:a,width:o,height:s}},kL);return!l||l.hidden||!OF(l)?null:U(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var oV=Le(aV),sV=Le(iV),cV=200,lV=150,uV=e=>!e.hidden,dV=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?fF(YP(e.nodeLookup,{filter:uV}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},fV=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,pV=(e,t)=>fV(e.viewBB,t.viewBB)&&fV(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,mV=`react-flow__minimap-desc`;function hV({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=PL(),S=G(null),{boundingRect:C,panZoom:w,viewBB:T,rfId:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=NL(dV,pV),j=e?.width??cV,ee=e?.height??lV,M=C.width/j,te=C.height/ee,ne=Math.max(M,te),re=ne*j,ie=ne*ee,N=b*ne,P=C.x-(re-C.width)/2-N,ae=C.y-(ie-C.height)/2-N,oe=re+N*2,se=ie+N*2,ce=`${mV}-${E}`,le=G(0),ue=G();le.current=ne,K(()=>{let e=x.getState().panZoom;if(S.current&&e)return ue.current=KI({domNode:S.current,panZoom:e,getTransform:()=>x.getState().transform,getViewScale:()=>le.current}),()=>{ue.current?.destroy()}},[w]),K(()=>{ue.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let de=p?e=>{let[t,n]=ue.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,fe=R((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),pe=m?fe:void 0,me=_??A[`minimap.ariaLabel`];return U(WL,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*ne:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:XO([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:U(`svg`,{width:j,height:ee,viewBox:`${P} ${ae} ${oe} ${se}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":ce,ref:S,onClick:de,children:[me&&U(`title`,{id:ce,children:me}),U(sV,{onClick:pe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),U(`path`,{className:`react-flow__minimap-mask`,d:`M${P-N},${ae-N}h${oe+N*2}v${se+N*2}h${-oe-N*2}z
3099
- M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}hV.displayName=`MiniMap`,Le(hV);var gV=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,_V={[sL.Line]:`right`,[sL.Handle]:`bottom-right`};function vV({nodeId:e,position:t,variant:n=sL.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=ZR(),y=typeof e==`string`?e:v,b=PL(),x=G(null),S=n===sL.Handle,C=NL(R(gV(S&&p),[S,p]),kL),w=G(null),T=t??_V[n];K(()=>{if(x.current&&y)return w.current||=vL({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=TI([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...kF({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return U(`div`,{className:XO([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}Le(vV);var yV=40,bV=280,xV=98,SV=24,CV=e=>{let t=e.split(/\s+/).filter(Boolean),n=[],r=``;for(let e of t){let t=r?`${r} ${e}`:e;if(t.length<=SV)r=t;else{if(n.length===1)break;r&&n.push(r),r=e}}r&&n.length<2&&n.push(r);let i=n.slice(0,2);return i.join(` `).length<e.length&&i.length&&(i[i.length-1]=`${i[i.length-1].slice(0,23)}…`),i.length?i:[e.slice(0,SV)]},wV=(e,t)=>{let n=tO(t.hover,e.edges),r=new Set(e.nodes.map(e=>e.uri)),i=e.nodes.map(e=>{let r=nO(e);return{id:e.uri,type:`work`,position:{x:yV+e.column*bV,y:yV+e.row*xV},width:190,height:74,draggable:!1,selectable:!1,data:{uri:e.uri,title:r,lines:CV(r),meta:xn([dO(e.format),e.episodeCount?q.formatMessage({id:`{count} ep`,defaultMessage:`{count} ep`},{count:e.episodeCount}):void 0]),current:t.current.has(e.uri),lit:n.nodes.has(e.uri)}}}),a=e=>t.hover?.kind===`node`&&(e.from===t.hover.uri||e.to===t.hover.uri),o=e.chain.filter(e=>r.has(e.from)&&r.has(e.to)).map(e=>({id:`chain\u0000${e.from}\u0000${e.to}`,type:`chain`,source:e.from,target:e.to,data:{kind:`chain`,label:``,lit:a(e)}})),s=e.edges.filter(e=>r.has(e.from)&&r.has(e.to)).map(e=>{let t=eO(e);return{id:t,type:`relation`,source:e.from,target:e.to,data:{kind:`relation`,label:lO(e.relation).toLocaleUpperCase(q.locale),lit:n.edges.has(t)}}});return{nodes:i,edges:[...o,...s]}};H();var TV=I`
3098
+ `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return K(()=>{let n=t?.target??sR,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&RF(e))return!1;let n=uR(e.code,s);if(a.current.add(e[n]),lR(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=uR(e.code,s);lR(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function lR(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function uR(e,t){return t.includes(e)?`code`:`key`}var dR=()=>{let e=PL();return B(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=wF(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return yF(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=bF(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function fR(e,t){let n=[],r=/* @__PURE__ */ new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)pR(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function pR(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing)}}function mR(e,t){return fR(e,t)}function hR(e,t){return fR(e,t)}function gR(e,t){return{id:e,type:`select`,selected:t}}function _R(e,t=/* @__PURE__ */ new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);(a.selected!==void 0||e)&&a.selected!==e&&(n&&(a.selected=e),r.push(gR(a.id,e)))}return r}function vR({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function yR(e){return{id:e.id,type:`remove`}}var bR=_F(`React Flow`,`https://reactflow.dev/`);function xR(e,t,n={}){return ZF(e,t,{...n,onError:n.onError??bR})}var SR=e=>GP(e),CR=e=>WP(e);function wR(e){return De(e)}var TR=typeof window<`u`?ht:K;function ER(e){let[t,n]=z(BigInt(0)),[r]=z(()=>DR(()=>n(e=>e+BigInt(1))));return TR(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function DR(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var OR=xt(null);function kR({children:e}){let t=PL(),n=ER(R(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=vR({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=ER(R(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(vR({items:s,lookup:o}))},[])),i=B(()=>({nodeQueue:n,edgeQueue:r}),[]);return U(OR.Provider,{value:i,children:e})}function AR(){let e=pt(OR);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var jR=e=>!!e.panZoom;function MR(){let e=dR(),t=PL(),n=AR(),r=NL(jR),i=B(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=SR(e)?e:n.get(e.id),a=i.parentId?kF(i.position,i.measured,i.parentId,n,r):i.position;return uF({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&SR(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&CR(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await tF({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(yR);o?.(f),c(e)}if(m){let e=d.map(yR);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=hF(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=uF(s?r:a),l=mF(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=hF(e)?e:a(e);if(!r)return!1;let i=mF(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return JP(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??jF();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return B(()=>({...i,...e,viewportInitialized:r}),[r])}var NR=e=>e.selected,PR=typeof window<`u`?window:void 0;function FR({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=PL(),{deleteElements:r}=MR(),i=cR(e,{actInsideInputWithModifier:!1}),a=cR(t,{target:PR});K(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(NR),edges:e.filter(NR)}),n.setState({nodesSelectionActive:!1})}},[i]),K(()=>{n.setState({multiSelectionActive:a})},[a])}function IR(e){let t=PL();K(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=FF(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,NP.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var LR={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},RR=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function zR({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=RP.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:g,noPanClassName:_,onViewportChange:v,isControlledViewport:y,paneClickDistance:b,selectionOnDrag:x}){let S=PL(),C=G(null),{userSelectionActive:w,lib:T,connectionInProgress:E}=NL(RR,kL),D=cR(p),O=G();IR(C);let k=R(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||S.setState({transform:e})},[v,y]);return K(()=>{if(C.current){O.current=oL({domNode:C.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return S.setState({panZoom:O.current,transform:[e,t,n],domNode:C.current.closest(`.react-flow`)}),()=>{O.current?.destroy()}}},[]),K(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:D,preventScrolling:m,noPanClassName:_,userSelectionActive:w,noWheelClassName:g,lib:T,onTransformChange:k,connectionInProgress:E,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,c,D,m,_,w,g,T,k,E,x,b]),U(`div`,{className:`react-flow__renderer`,ref:C,style:LR,children:h})}var BR=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function VR(){let{userSelectionActive:e,userSelectionRect:t}=NL(BR,kL);return e&&t?U(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var HR=(e,t)=>n=>{n.target===t.current&&e?.(n)},UR=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function WR({isSelecting:e,selectionKeyPressed:t,selectionMode:n=zP.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=G(0),_=PL(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=NL(UR,kL),C=y&&(e||v),w=G(null),T=G(),E=G(/* @__PURE__ */ new Set),D=G(/* @__PURE__ */ new Set),O=G(!1),k=G(!1),A=G({x:0,y:0}),j=G(!1),ee=e=>{k.current||O.current||_.getState().connection.inProgress?(k.current=!1,O.current=!1):(l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1}))},M=e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():u?.(e)},te=d?e=>d(e):void 0,ne=e=>{k.current&&=(e.stopPropagation(),!1)},re=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(T.current=i?.getBoundingClientRect(),!T.current)return;let s=n.target===w.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:c,y:l}=BF(n.nativeEvent,T.current),u=yF({x:c,y:l},a);_.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(n.stopPropagation(),n.preventDefault())};function ie(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=bF(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(XP(a,m,i,n===zP.Partial,!0).map(e=>e.id)),D.current=/* @__PURE__ */ new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}AF(h,E.current)||c(_R(a,E.current,!0)),AF(g,D.current)||l(_R(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function N(){if(!i||!T.current)return;let[e,t]=oF(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(N);return}let{x:t,y:n}=A.current;ie(t,n),g.current=requestAnimationFrame(N)})}let P=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};K(()=>()=>P(),[]);let ae=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=BF(e.nativeEvent,T.current);A.current={x:o,y:c};let l=bF({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(N(),!0),ie(o,c)},oe=e=>{C?e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&ee?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),P()):e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0)},se=e=>{e.target?.releasePointerCapture?.(e.pointerId),P()},ce=r===!0||Array.isArray(r)&&r.includes(0);return U(`div`,{className:XO([`react-flow__pane`,{draggable:ce,dragging:b,selection:e}]),onClick:C?void 0:HR(ee,w),onContextMenu:HR(M,w),onWheel:HR(te,w),onPointerEnter:C?void 0:f,onPointerMove:C?ae:p,onPointerUp:oe,onPointerCancel:C?se:void 0,onPointerDownCapture:C?re:void 0,onClickCapture:C?ne:void 0,onPointerLeave:m,ref:w,style:LR,children:[h,U(VR,{})]})}function GR({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);l?(t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):c?.(`012`,NP.error012(e))}function KR({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=PL(),[c,l]=z(!1),u=G();return K(()=>{if(!t)return u.current=FI({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{GR({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),K(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var qR=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function JR(){let e=PL();return R(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=/* @__PURE__ */ new Map,d=qR(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=vF(t,i));let{position:a,positionAbsolute:s}=eF({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var YR=xt(null),XR=YR.Provider;YR.Consumer;var ZR=()=>pt(YR),QR=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),$R=xt(null);function ez({children:e}){let t=NL(QR,kL);return U($R.Provider,{value:t,children:e})}function tz(){let e=pt($R);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var nz={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},rz=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return nz;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===LP.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function iz({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=PL(),_=ZR(),{connectOnClick:v,noPanClassName:y,rfId:b}=tz(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=NL(rz(_,m,e),kL);_||g.getState().onError?.(`010`,NP.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(xR(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=zF(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();GI.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return U(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:XO([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=IF(t.target),h=n||c,{connection:v,isValid:y}=GI.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var az=Le(wR(iz));function oz({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return U(wt,{children:[e?.label,U(az,{type:`source`,position:n,isConnectable:t})]})}function sz({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return U(wt,{children:[U(az,{type:`target`,position:n,isConnectable:t}),e?.label,U(az,{type:`source`,position:r,isConnectable:t})]})}function cz(){return null}function lz({data:e,isConnectable:t,targetPosition:n=$.Top}){return U(wt,{children:[U(az,{type:`target`,position:n,isConnectable:t}),e?.label]})}var uz={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},dz={input:oz,default:sz,output:lz,group:cz};function fz(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var pz=e=>{let{width:t,height:n,x:r,y:i}=YP(e.nodeLookup,{filter:e=>!!e.selected});return{width:gF(t)?t:null,height:gF(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function mz({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=PL(),{width:i,height:a,transformString:o,userSelectionActive:s}=NL(pz,kL),c=JR(),l=G(null);K(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(KR({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return U(`div`,{className:XO([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:U(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(uz,e.key)&&(e.preventDefault(),c({direction:uz[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var hz=typeof window<`u`?window:void 0,gz=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function _z({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:ee,noPanClassName:M,disableKeyboardA11y:te,onViewportChange:ne,isControlledViewport:re}){let{nodesSelectionActive:ie,userSelectionActive:N}=NL(gz,kL),P=cR(l,{target:hz}),ae=cR(h,{target:hz}),oe=ae||w,se=ae||b,ce=u&&oe!==!0,le=P||N||ce;return FR({deleteKeyCode:c,multiSelectionKeyCode:m}),U(zR,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:se,panActivationKeyPressed:ae,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!P&&oe,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:ee,noPanClassName:M,onViewportChange:ne,isControlledViewport:re,paneClickDistance:s,selectionOnDrag:ce,children:U(WR,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:oe,autoPanOnSelection:T,isSelecting:!!le,selectionMode:d,selectionKeyPressed:P,paneClickDistance:s,selectionOnDrag:ce,children:[e,ie&&U(mz,{onSelectionContextMenu:j,noPanClassName:M,disableKeyboardA11y:te})]})})}_z.displayName=`FlowRenderer`;var vz=Le(_z),yz=e=>t=>e?XP(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function bz(e){return NL(R(yz(e),[e]),kL)}var xz=e=>e.updateNodeInternals;function Sz(){let e=NL(xz),[t]=z(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=/* @__PURE__ */ new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return K(()=>()=>{t?.disconnect()},[t]),t}function Cz({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=PL(),a=G(null),o=G(null),s=G(e.sourcePosition),c=G(e.targetPosition),l=G(t),u=n&&!!e.internals.handleBounds;return K(()=>{!a.current||e.hidden||u&&o.current===a.current||(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),K(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),K(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(/* @__PURE__ */ new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function wz({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=NL(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},kL),S=y.type||`default`,C=g?.[S]||dz[S];C===void 0&&(v?.(`003`,NP.error003(S)),S=`default`,C=g?.default||dz.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=PL(),k=OF(y),A=Cz({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=KR({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),ee=JR();if(y.hidden)return null;let M=DF(y),te=fz(y),ne=T||w||t||n||r||i,re=n?e=>n(e,{...b.userNode}):void 0,ie=r?e=>r(e,{...b.userNode}):void 0,N=i?e=>i(e,{...b.userNode}):void 0,P=a?e=>a(e,{...b.userNode}):void 0,ae=o?e=>o(e,{...b.userNode}):void 0,oe=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&GR({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},se=t=>{if(!(RF(t.nativeEvent)||m)){if(FP.includes(t.key)&&T){let n=t.key===`Escape`;GR({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(uz,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),ee({direction:uz[t.key],factor:t.shiftKey?4:1})}}},ce=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(XP(/* @__PURE__ */ new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+M.width/2,y.position.y+M.height/2,{zoom:t[2]}))};return U(`div`,{className:XO([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ne?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...te},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:re,onMouseMove:ie,onMouseLeave:N,onContextMenu:P,onClick:oe,onDoubleClick:ae,onKeyDown:D?se:void 0,tabIndex:D?0:void 0,onFocus:D?ce:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${LL}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:U(XR,{value:e,children:U(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...M})})})}var Tz=Le(wz),Ez=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Dz(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=NL(Ez,kL),a=bz(e.onlyRenderVisibleElements),o=Sz();return U(`div`,{className:`react-flow__nodes`,style:LR,children:a.map(a=>U(Tz,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}Dz.displayName=`NodeRenderer`;var Oz=Le(Dz);function kz(e){return NL(R(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&JF({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),kL)}var Az=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return U(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},jz=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return U(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},Mz={[HP.Arrow]:Az,[HP.ArrowClosed]:jz};function Nz(e){let t=PL();return B(()=>Object.prototype.hasOwnProperty.call(Mz,e)?Mz[e]:(t.getState().onError?.(`009`,NP.error009(e)),null),[e])}var Pz=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Nz(t);return c?U(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:U(c,{color:n,strokeWidth:o})}):null},Fz=({defaultColor:e,rfId:t})=>{let n=NL(e=>e.edges),r=NL(e=>e.defaultEdgeOptions),i=B(()=>dI(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?U(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:U(`defs`,{children:i.map(e=>U(Pz,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Fz.displayName=`MarkerDefinitions`;var Iz=Le(Fz);function Lz({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=z({x:1,y:0,width:0,height:0}),p=XO([`react-flow__edge-textwrapper`,l]),m=G(null);return K(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?U(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&U(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),U(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}Lz.displayName=`EdgeText`;var Rz=Le(Lz);function zz({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return U(wt,{children:[U(`path`,{...u,d:e,fill:`none`,className:XO([`react-flow__edge-path`,u.className])}),l?U(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&gF(t)&&gF(n)?U(Rz,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Bz({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Vz({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=Bz({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Bz({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=HF({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Hz(e){return Le(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Vz({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return U(zz,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Uz=Hz({isInternal:!1}),Wz=Hz({isInternal:!0});Uz.displayName=`SimpleBezierEdge`,Wz.displayName=`SimpleBezierEdgeInternal`;function Gz(e){return Le(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=iI({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return U(zz,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var Kz=Gz({isInternal:!1}),qz=Gz({isInternal:!0});Kz.displayName=`SmoothStepEdge`,qz.displayName=`SmoothStepEdgeInternal`;function Jz(e){return Le(({id:t,...n})=>{let r=e.isInternal?void 0:t;return U(Kz,{...n,id:r,pathOptions:B(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Yz=Jz({isInternal:!1}),Xz=Jz({isInternal:!0});Yz.displayName=`StepEdge`,Xz.displayName=`StepEdgeInternal`;function Zz(e){return Le(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=QF({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return U(zz,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var Qz=Zz({isInternal:!1}),$z=Zz({isInternal:!0});Qz.displayName=`StraightEdge`,$z.displayName=`StraightEdgeInternal`;function eB(e){return Le(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=GF({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return U(zz,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var tB=eB({isInternal:!1}),nB=eB({isInternal:!0});tB.displayName=`BezierEdge`,nB.displayName=`BezierEdgeInternal`;var rB={default:nB,straight:$z,step:Xz,smoothstep:qz,simplebezier:Wz},iB={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},aB=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,oB=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,sB=`react-flow__edgeupdater`;function cB({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return U(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:XO([sB,`${sB}-${s}`]),cx:aB(t,r,e),cy:oB(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function lB({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=PL(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;GI.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return U(wt,{children:[(e===!0||e===`source`)&&U(cB,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&U(cB,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function uB({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=NL(t=>t.edgeLookup.get(e)),b=NL(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||rB[x];S===void 0&&(_?.(`011`,NP.error011(x)),x=`default`,S=h?.default||rB.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=G(null),[D,O]=z(!1),[k,A]=z(!1),j=PL(),{zIndex:ee=y.zIndex,sourceX:M,sourceY:te,targetX:ne,targetY:re,sourcePosition:ie,targetPosition:N}=NL(R(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return iB;let i=oI({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=qF({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||iB,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex,_]),kL),P=B(()=>y.markerStart?`url('#${uI(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ae=B(()=>y.markerEnd?`url('#${uI(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||M===null||te===null||ne===null||re===null)return null;let oe=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},se=a?e=>{a(e,{...y})}:void 0,ce=o?e=>{o(e,{...y})}:void 0,le=s?e=>{s(e,{...y})}:void 0,ue=c?e=>{c(e,{...y})}:void 0,de=l?e=>{l(e,{...y})}:void 0;return U(`svg`,{style:{zIndex:ee},children:U(`g`,{className:XO([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:oe,onDoubleClick:se,onContextMenu:ce,onMouseEnter:le,onMouseMove:ue,onMouseLeave:de,onKeyDown:C?t=>{if(!v&&FP.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${RL}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&U(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:M,sourceY:te,targetX:ne,targetY:re,sourcePosition:ie,targetPosition:N,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:P,markerEnd:ae,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&U(lB,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:M,sourceY:te,targetX:ne,targetY:re,sourcePosition:ie,targetPosition:N,setUpdateHover:O,setReconnecting:A})]})})}var dB=Le(uB),fB=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function pB({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=NL(fB,kL),b=kz(t);return U(`div`,{className:`react-flow__edges`,children:[U(Iz,{defaultColor:e,rfId:n}),b.map(e=>U(dB,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}pB.displayName=`EdgeRenderer`;var mB=Le(pB),hB=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function gB({children:e}){let t=PL(),n=G(null),[r]=z(()=>t.getState().transform);return TR(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=hB(r)))};return r(),t.subscribe(r)},[t]),U(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:hB(r)},children:e})}function _B(e){let t=MR(),n=G(!1);K(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var vB=e=>e.panZoom?.syncViewport;function yB(e){let t=NL(vB),n=PL();return K(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function bB(e){return e.connection.inProgress?{...e.connection,to:yF(e.connection.to,e.transform)}:{...e.connection}}function xB(e){return e?t=>e(bB(t)):bB}function SB(e){return NL(xB(e),kL)}var CB=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function wB({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=NL(CB,kL);return a&&i&&c?U(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:U(`g`,{className:XO([`react-flow__connection`,NF(s)]),children:U(TB,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var TB=({style:e,type:t=VP.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=SB();if(!i)return;if(n)return U(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:NF(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case VP.Bezier:[m]=GF(h);break;case VP.SimpleBezier:[m]=Vz(h);break;case VP.Step:[m]=iI({...h,borderRadius:0});break;case VP.SmoothStep:[m]=iI(h);break;default:[m]=QF(h)}return U(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};TB.displayName=`ConnectionLine`;var EB={};function DB(e=EB){G(e),PL(),K(()=>{},[e])}function OB(){PL(),G(!1),K(()=>{},[])}function kB({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:ee,zoomOnScroll:M,zoomOnPinch:te,panOnScroll:ne,panOnScrollSpeed:re,panOnScrollMode:ie,zoomOnDoubleClick:N,panOnDrag:P,autoPanOnSelection:ae,onPaneClick:oe,onPaneMouseEnter:se,onPaneMouseMove:ce,onPaneMouseLeave:le,onPaneScroll:ue,onPaneContextMenu:de,paneClickDistance:fe,nodeClickDistance:pe,onEdgeContextMenu:me,onEdgeMouseEnter:he,onEdgeMouseMove:ge,onEdgeMouseLeave:_e,reconnectRadius:ve,onReconnect:ye,onReconnectStart:be,onReconnectEnd:xe,noDragClassName:Se,noWheelClassName:Ce,noPanClassName:we,disableKeyboardA11y:Te,nodeExtent:Ee,rfId:De,viewport:Oe,onViewportChange:ke,nodesDraggable:Ae}){return DB(e),DB(t),OB(),_B(n),yB(Oe),U(vz,{onPaneClick:oe,onPaneMouseEnter:se,onPaneMouseMove:ce,onPaneMouseLeave:le,onPaneContextMenu:de,onPaneScroll:ue,paneClickDistance:fe,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:M,zoomOnPinch:te,zoomOnDoubleClick:N,panOnScroll:ne,panOnScrollSpeed:re,panOnScrollMode:ie,panOnDrag:P,autoPanOnSelection:ae,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:Se,noWheelClassName:Ce,noPanClassName:we,disableKeyboardA11y:Te,onViewportChange:ke,isControlledViewport:!!Oe,children:U(gB,{children:[U(mB,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:ye,onReconnectStart:be,onReconnectEnd:xe,onlyRenderVisibleElements:T,onEdgeContextMenu:me,onEdgeMouseEnter:he,onEdgeMouseMove:ge,onEdgeMouseLeave:_e,reconnectRadius:ve,defaultMarkerColor:ee,noPanClassName:we,disableKeyboardA11y:Te,rfId:De}),U(wB,{style:h,type:m,component:g,containerStyle:_}),U(`div`,{className:`react-flow__edgelabel-renderer`}),U(Oz,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:pe,onlyRenderVisibleElements:T,noPanClassName:we,noDragClassName:Se,disableKeyboardA11y:Te,nodeExtent:Ee,rfId:De,nodesDraggable:Ae}),U(`div`,{className:`react-flow__viewport-portal`})]})})}kB.displayName=`GraphView`;var AB=Le(kB),jB=_F(`React Flow`,`https://reactflow.dev/`),MB=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=/* @__PURE__ */ new Map,m=/* @__PURE__ */ new Map,h=/* @__PURE__ */ new Map,g=/* @__PURE__ */ new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??PP;kI(h,g,_);let{nodesInitialized:x}=bI(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=wF(YP(p,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:PP,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:LP.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...BP},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:jB,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:IP,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:/* @__PURE__ */ new Map,onEdgesChangeMiddlewareMap:/* @__PURE__ */ new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},NB=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>OL((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await $P({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...MB({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=bI(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();kI(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=EI(e,n,r,i,a,o,l);d&&(_I(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=cI(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=TI(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(mR(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(hR(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?i(e.map(e=>gR(e,!0))):(i(_R(r,/* @__PURE__ */ new Set([...e]),!0)),a(_R(n)))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?a(e.map(e=>gR(e,!0))):(a(_R(n,/* @__PURE__ */ new Set([...e]))),i(_R(r,/* @__PURE__ */ new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(gR(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(gR(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,gR(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,gR(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(bI(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return DI({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...BP}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...MB()})}},Object.is);function PB({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=z(()=>NB({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return U(jL,{value:m,children:U(kR,{children:U(ez,{children:p})})})}function FB({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return pt(AL)?U(wt,{children:e}):U(PB,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var IB={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function LB({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:ee,onSelectionContextMenu:M,onSelectionStart:te,onSelectionEnd:ne,onBeforeDelete:re,connectionMode:ie,connectionLineType:N=VP.Bezier,connectionLineStyle:P,connectionLineComponent:ae,connectionLineContainerStyle:oe,deleteKeyCode:se=`Backspace`,selectionKeyCode:ce=`Shift`,selectionOnDrag:le=!1,selectionMode:ue=zP.Full,panActivationKeyCode:de=`Space`,multiSelectionKeyCode:fe=TF()?`Meta`:`Control`,zoomActivationKeyCode:pe=TF()?`Meta`:`Control`,snapToGrid:me,snapGrid:he,onlyRenderVisibleElements:ge=!1,selectNodesOnDrag:_e,nodesDraggable:ve,autoPanOnNodeFocus:ye,nodesConnectable:be,nodesFocusable:xe,nodeOrigin:Se=$L,edgesFocusable:Ce,edgesReconnectable:we,elementsSelectable:Te=!0,defaultViewport:Ee=eR,minZoom:De=.5,maxZoom:Oe=2,translateExtent:ke=PP,preventScrolling:Ae=!0,nodeExtent:je,defaultMarkerColor:Me=`#b1b1b7`,zoomOnScroll:Ne=!0,zoomOnPinch:Pe=!0,panOnScroll:Fe=!1,panOnScrollSpeed:Ie=.5,panOnScrollMode:Le=RP.Free,zoomOnDoubleClick:F=!0,panOnDrag:Re=!0,onPaneClick:ze,onPaneMouseEnter:Be,onPaneMouseMove:Ve,onPaneMouseLeave:He,onPaneScroll:Ue,onPaneContextMenu:We,paneClickDistance:Ge=1,nodeClickDistance:Ke=0,children:qe,onReconnect:I,onReconnectStart:Je,onReconnectEnd:Ye,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,reconnectRadius:L=10,onNodesChange:tt,onEdgesChange:nt,noDragClassName:rt=`nodrag`,noWheelClassName:it=`nowheel`,noPanClassName:z=`nopan`,fitView:at,fitViewOptions:ot,connectOnClick:B,attributionPosition:st,proOptions:ct,defaultEdgeOptions:lt,elevateNodesOnSelect:ut=!0,elevateEdgesOnSelect:V=!1,disableKeyboardA11y:dt=!1,autoPanOnConnect:ft,autoPanOnNodeDrag:pt,autoPanOnSelection:mt=!0,autoPanSpeed:ht,connectionRadius:gt,isValidConnection:H,onError:_t,style:W,id:G,nodeDragThreshold:vt,connectionDragThreshold:yt,viewport:K,onViewportChange:bt,width:xt,height:St,colorMode:Ct=`light`,debug:wt,onScroll:Tt,ariaLabelConfig:Et,zIndexMode:Dt=`basic`,...Ot},kt){let At=G||`1`,jt=oR(Ct),Mt=R(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Tt?.(e)},[Tt]);return U(`div`,{"data-testid":`rf__wrapper`,...Ot,onScroll:Mt,style:{...W,...IB},ref:kt,className:XO([`react-flow`,i,jt]),id:G,role:`application`,children:U(FB,{nodes:e,edges:t,width:xt,height:St,fitView:at,fitViewOptions:ot,minZoom:De,maxZoom:Oe,nodeOrigin:Se,nodeExtent:je,zIndexMode:Dt,children:[U(iR,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:ve,autoPanOnNodeFocus:ye,nodesConnectable:be,nodesFocusable:xe,edgesFocusable:Ce,edgesReconnectable:we,elementsSelectable:Te,elevateNodesOnSelect:ut,elevateEdgesOnSelect:V,minZoom:De,maxZoom:Oe,nodeExtent:je,onNodesChange:tt,onEdgesChange:nt,snapToGrid:me,snapGrid:he,connectionMode:ie,translateExtent:ke,connectOnClick:B,defaultEdgeOptions:lt,fitView:at,fitViewOptions:ot,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:ee,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:z,nodeOrigin:Se,rfId:At,autoPanOnConnect:ft,autoPanOnNodeDrag:pt,autoPanSpeed:ht,onError:_t,connectionRadius:gt,isValidConnection:H,selectNodesOnDrag:_e,nodeDragThreshold:vt,connectionDragThreshold:yt,onBeforeDelete:re,debug:wt,ariaLabelConfig:Et,zIndexMode:Dt}),U(AB,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:N,connectionLineStyle:P,connectionLineComponent:ae,connectionLineContainerStyle:oe,selectionKeyCode:ce,selectionOnDrag:le,selectionMode:ue,deleteKeyCode:se,multiSelectionKeyCode:fe,panActivationKeyCode:de,zoomActivationKeyCode:pe,onlyRenderVisibleElements:ge,defaultViewport:Ee,translateExtent:ke,minZoom:De,maxZoom:Oe,preventScrolling:Ae,zoomOnScroll:Ne,zoomOnPinch:Pe,zoomOnDoubleClick:F,panOnScroll:Fe,panOnScrollSpeed:Ie,panOnScrollMode:Le,panOnDrag:Re,autoPanOnSelection:mt,onPaneClick:ze,onPaneMouseEnter:Be,onPaneMouseMove:Ve,onPaneMouseLeave:He,onPaneScroll:Ue,onPaneContextMenu:We,paneClickDistance:Ge,nodeClickDistance:Ke,onSelectionContextMenu:M,onSelectionStart:te,onSelectionEnd:ne,onReconnect:I,onReconnectStart:Je,onReconnectEnd:Ye,onEdgeContextMenu:Xe,onEdgeDoubleClick:Ze,onEdgeMouseEnter:Qe,onEdgeMouseMove:$e,onEdgeMouseLeave:et,reconnectRadius:L,defaultMarkerColor:Me,noDragClassName:rt,noWheelClassName:it,noPanClassName:z,rfId:At,disableKeyboardA11y:dt,nodeExtent:je,viewport:K,onViewportChange:bt,nodesDraggable:ve}),U(QL,{onSelectionChange:k}),qe,U(KL,{proOptions:ct,position:st}),U(UL,{rfId:At,disableKeyboardA11y:dt})]})})}var RB=wR(LB),zB=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function BB({children:e}){let t=NL(zB);return t?Ue(e,t):null}var VB=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(let[,{internals:e}]of t.nodeLookup)if(e.handleBounds===void 0||!OF(e.userNode))return!1;return!0};function HB(e={includeHiddenNodes:!1}){return NL(VB(e))}NP.error014();function UB({dimensions:e,lineWidth:t,variant:n,className:r}){return U(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:XO([`react-flow__background-pattern`,n,r])})}function WB({radius:e,className:t}){return U(`circle`,{cx:e,cy:e,r:e,className:XO([`react-flow__background-pattern`,`dots`,t])})}var GB;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(GB||={});var KB={[GB.Dots]:1,[GB.Lines]:1,[GB.Cross]:6},qB=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function JB({id:e,variant:t=GB.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=G(null),{transform:f,patternId:p}=NL(qB,kL),m=r||KB[t],h=t===GB.Dots,g=t===GB.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]+x[0]/2,b[1]*f[2]+x[1]/2],C=`${p}${e||``}`;return U(`svg`,{className:XO([`react-flow__background`,l]),style:{...c,...LR,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[U(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?U(WB,{radius:y/2,className:u}):U(UB,{dimensions:x,lineWidth:i,variant:t,className:u})}),U(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}JB.displayName=`Background`;var YB=Le(JB);function XB(){return U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:U(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function ZB(){return U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:U(`path`,{d:`M0 0h32v4.2H0z`})})}function QB(){return U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:U(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function $B(){return U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:U(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function eV(){return U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:U(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function tV({children:e,className:t,...n}){return U(`button`,{type:`button`,className:XO([`react-flow__controls-button`,t]),...n,children:e})}var nV=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function rV({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=PL(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=NL(nV,kL),{zoomIn:y,zoomOut:b,fitView:x}=MR();return U(WL,{className:XO([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&U(wt,{children:[U(tV,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:U(XB,{})}),U(tV,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:U(ZB,{})})]}),n&&U(tV,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:U(QB,{})}),r&&U(tV,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:U(h?eV:$B,{})}),u]})}rV.displayName=`Controls`,Le(rV);function iV({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return U(`rect`,{className:XO([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var aV=Le(iV),oV=e=>e.nodes.map(e=>e.id),sV=e=>e instanceof Function?e:()=>e;function cV({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=aV,onClick:o}){let s=NL(oV,kL),c=sV(t),l=sV(e),u=sV(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return U(wt,{children:s.map(e=>U(uV,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function lV({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=NL(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=DF(r);return{node:r,x:i,y:a,width:o,height:s}},kL);return!l||l.hidden||!OF(l)?null:U(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var uV=Le(lV),dV=Le(cV),fV=200,pV=150,mV=e=>!e.hidden,hV=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?fF(YP(e.nodeLookup,{filter:mV}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},gV=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,_V=(e,t)=>gV(e.viewBB,t.viewBB)&&gV(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,vV=`react-flow__minimap-desc`;function yV({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=PL(),S=G(null),{boundingRect:C,panZoom:w,viewBB:T,rfId:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=NL(hV,_V),j=e?.width??fV,ee=e?.height??pV,M=C.width/j,te=C.height/ee,ne=Math.max(M,te),re=ne*j,ie=ne*ee,N=b*ne,P=C.x-(re-C.width)/2-N,ae=C.y-(ie-C.height)/2-N,oe=re+N*2,se=ie+N*2,ce=`${vV}-${E}`,le=G(0),ue=G();le.current=ne,K(()=>{let e=x.getState().panZoom;if(S.current&&e)return ue.current=KI({domNode:S.current,panZoom:e,getTransform:()=>x.getState().transform,getViewScale:()=>le.current}),()=>{ue.current?.destroy()}},[w]),K(()=>{ue.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let de=p?e=>{let[t,n]=ue.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,fe=R((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),pe=m?fe:void 0,me=_??A[`minimap.ariaLabel`];return U(WL,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*ne:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:XO([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:U(`svg`,{width:j,height:ee,viewBox:`${P} ${ae} ${oe} ${se}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":ce,ref:S,onClick:de,children:[me&&U(`title`,{id:ce,children:me}),U(dV,{onClick:pe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),U(`path`,{className:`react-flow__minimap-mask`,d:`M${P-N},${ae-N}h${oe+N*2}v${se+N*2}h${-oe-N*2}z
3099
+ M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}yV.displayName=`MiniMap`,Le(yV);var bV=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,xV={[sL.Line]:`right`,[sL.Handle]:`bottom-right`};function SV({nodeId:e,position:t,variant:n=sL.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=ZR(),y=typeof e==`string`?e:v,b=PL(),x=G(null),S=n===sL.Handle,C=NL(R(bV(S&&p),[S,p]),kL),w=G(null),T=t??xV[n];K(()=>{if(x.current&&y)return w.current||=vL({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=TI([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...kF({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return U(`div`,{className:XO([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}Le(SV);var CV=330,wV=130,TV=(e,t,n)=>{let r=Math.ceil(e.length*7.2)+20;return{left:t-r/2,right:t+r/2,top:n-11,bottom:n+11}},EV=(e,t,n=4)=>e.left<t.right+n&&e.right+n>t.left&&e.top<t.bottom+n&&e.bottom+n>t.top,DV=24,OV=e=>{let t=e.split(/\s+/).filter(Boolean),n=[],r=``;for(let e of t){let t=r?`${r} ${e}`:e;if(t.length<=DV)r=t;else{if(n.length===1)break;r&&n.push(r),r=e}}r&&n.length<2&&n.push(r);let i=n.slice(0,2);return i.join(` `).length<e.length&&i.length&&(i[i.length-1]=`${i[i.length-1].slice(0,23)}…`),i.length?i:[e.slice(0,DV)]},kV=(e,t)=>e[0]<=t[1]&&t[0]<=e[1],AV=(e,t)=>{for(let n=0;n<e.length;n++)if(!e[n].some(e=>kV(e,t)))return e[n].push(t),n;return e.push([t]),e.length-1},jV=(()=>{let e=[0];for(let t=1;t<=16;t++)e.push(-t*26,t*26);return e})(),MV=[0,-40,40,-80,80],NV=(e,t)=>{let n=tO(t.hover,e.edges),r=new Set(e.nodes.map(e=>e.uri)),i=/* @__PURE__ */ new Map,a=e.nodes.map(e=>{let r=nO(e),a=40+e.column*CV,o=40+e.row*wV;return i.set(e.uri,{column:e.column,row:e.row,x:a,y:o,sx:a+190,sy:o+37,tx:a,ty:o+37,box:{left:a,right:a+190,top:o,bottom:o+74}}),{id:e.uri,type:`work`,position:{x:a,y:o},width:190,height:74,draggable:!1,selectable:!1,data:{uri:e.uri,title:r,lines:OV(r),meta:xn([dO(e.format),e.episodeCount?q.formatMessage({id:`{count} ep`,defaultMessage:`{count} ep`},{count:e.episodeCount}):void 0]),current:t.current.has(e.uri),lit:n.nodes.has(e.uri)}}}),o=e=>t.hover?.kind===`node`&&(e.from===t.hover.uri||e.to===t.hover.uri),s=e.chain.filter(e=>r.has(e.from)&&r.has(e.to)).map(e=>({id:`chain\u0000${e.from}\u0000${e.to}`,type:`chain`,source:e.from,target:e.to,data:{kind:`chain`,label:``,lit:o(e)}})),c=e.edges.filter(e=>r.has(e.from)&&r.has(e.to)),l=/* @__PURE__ */ new Map;for(let e of c){let t=i.get(e.from);if(i.get(e.to).column===t.column+1){let t=`${e.from}\u0000${e.to}`;l.set(t,(l.get(t)??0)+1)}}let u=/* @__PURE__ */ new Map,d=[],f=[],p=[...i.values()].map(e=>e.box),m=(e,t)=>{let n=1/0,r=-1/0;for(let a of i.values())a.column>=e&&a.column<=t&&(a.y<n&&(n=a.y),a.box.bottom>r&&(r=a.box.bottom));return{minY:n,maxBottom:r}},h=(e,t,n)=>{for(let r of MV)for(let i of jV){let a=t+r,o=n+i,s=TV(e,a,o);if(!p.some(e=>EV(s,e)))return p.push(s),{x:a,y:o}}return p.push(TV(e,t,n)),{x:t,y:n}},g=c.map(e=>{let t=eO(e),r=lO(e.relation).toLocaleUpperCase(q.locale),a=i.get(e.from),o=i.get(e.to),s,c,p;if(o.column===a.column+1){let t=`${e.from}\u0000${e.to}`,n=l.get(t)??1,r=u.get(t)??0;u.set(t,r+1);let i=(r-(n-1)/2)*38,d=Math.max(24,Math.abs(o.tx-a.sx)/2);s=`M ${a.sx} ${a.sy} C ${a.sx+d} ${a.sy+i}, ${o.tx-d} ${o.ty+i}, ${o.tx} ${o.ty}`,c=(a.sx+o.tx)/2,p=(a.sy+o.ty)/2+.75*i}else{let e=Math.min(a.column,o.column),t=Math.max(a.column,o.column),n=[e,t],{minY:r,maxBottom:i}=m(e,t),l=o.column<=a.column?r-36-AV(d,n)*28:i+36+AV(f,n)*28,u=(l-.125*(a.sy+o.ty))/.75;s=`M ${a.sx} ${a.sy} C ${a.sx+48} ${u}, ${o.tx-48} ${u}, ${o.tx} ${o.ty}`,c=(a.sx+o.tx)/2,p=l}let{x:g,y:_}=h(r,c,p);return{id:t,type:`relation`,source:e.from,target:e.to,data:{kind:`relation`,label:r,lit:n.edges.has(t),path:s,labelX:g,labelY:_}}});return{nodes:a,edges:[...s,...g]}};H();var PV=I`
3100
3100
  display: inline-flex;
3101
3101
  align-items: center;
3102
3102
  gap: 0.6rem;
@@ -3125,7 +3125,7 @@ overflow-wrap: anywhere;
3125
3125
  svg { flex-shrink: 0; width: 1.5rem; height: 1.5rem; }
3126
3126
 
3127
3127
  span { overflow: hidden; text-overflow: ellipsis; }
3128
- `,EV=I`
3128
+ `,FV=I`
3129
3129
  display: flex;
3130
3130
  align-items: center;
3131
3131
  justify-content: center;
@@ -3233,6 +3233,8 @@ overflow-wrap: anywhere;
3233
3233
 
3234
3234
  .canvas {
3235
3235
  flex: 1;
3236
+ display: flex;
3237
+ flex-direction: column;
3236
3238
  /* HIDDEN, not auto. The drawing is moved by a transform rather than by a scroll offset, so there
3237
3239
  is nothing here to scroll and no content bounds to be stopped by: the surface is unbounded in
3238
3240
  every direction and at every zoom. */
@@ -3243,9 +3245,10 @@ overflow-wrap: anywhere;
3243
3245
  /* the library paints its own surface, so the app's dark ground is stated rather than inherited:
3244
3246
  its default is a light one and the modal around this box is not. The dot grid is the library's
3245
3247
  own Background component now, registered with the transform by it rather than by hand. */
3246
- .react-flow { background-color: rgb(9, 9, 10); }
3248
+ .react-flow { flex: 1; min-height: 0; background-color: rgb(9, 9, 10); }
3247
3249
  .react-flow__pane { cursor: grab; }
3248
3250
  .react-flow__pane.dragging { cursor: grabbing; }
3251
+ .react-flow__edgelabel-renderer { z-index: 1; }
3249
3252
  .react-flow__attribution { background: rgba(0, 0, 0, 0.4); a { color: rgba(255, 255, 255, 0.4); } }
3250
3253
  /* the handles carry the geometry and nothing else: nobody connects this graph by hand */
3251
3254
  .react-flow__handle { opacity: 0; pointer-events: none; }
@@ -3266,11 +3269,21 @@ overflow-wrap: anywhere;
3266
3269
  }
3267
3270
 
3268
3271
  .edge-label {
3269
- fill: rgba(255, 255, 255, 0.5);
3272
+ position: absolute;
3273
+ top: 0;
3274
+ inset-inline-start: 0;
3275
+ pointer-events: all;
3276
+ cursor: pointer;
3277
+ padding: 2px 7px;
3278
+ border-radius: 999px;
3279
+ background: rgba(9, 9, 10, 0.92);
3280
+ border: 1px solid rgba(255, 255, 255, 0.16);
3281
+ color: rgba(255, 255, 255, 0.78);
3270
3282
  font-size: 10px;
3271
3283
  font-weight: 700;
3272
3284
  letter-spacing: 0.04em;
3273
- text-anchor: middle;
3285
+ line-height: 1.3;
3286
+ white-space: nowrap;
3274
3287
  }
3275
3288
 
3276
3289
  /* An HTML box rather than an SVG one, which is what the move to xyflow bought here. The old
@@ -3314,11 +3327,35 @@ overflow-wrap: anywhere;
3314
3327
  }
3315
3328
  .edge.lit { stroke: rgb(255, 176, 62); stroke-width: 2.5; stroke-dasharray: none; }
3316
3329
  .chain.lit { stroke: rgb(255, 176, 62); stroke-width: 3; }
3317
- .edge-label.lit { fill: rgb(255, 176, 62); }
3330
+ .edge-label.lit {
3331
+ color: rgb(255, 176, 62);
3332
+ border-color: rgb(255, 176, 62);
3333
+ background: rgba(52, 42, 26, 0.96);
3334
+ }
3335
+
3336
+ @media (max-width: 720px) {
3337
+ padding: 0;
3338
+
3339
+ .sheet { border-radius: 0; border: 0; }
3340
+ .bar { padding-block: 1.2rem; padding-inline: 1.4rem 6rem; }
3341
+ .close { top: 1rem; inset-inline-end: 1.2rem; }
3342
+ .kinds {
3343
+ position: static;
3344
+ flex-direction: row;
3345
+ flex-wrap: wrap;
3346
+ align-items: center;
3347
+ gap: 0.5rem 1.2rem;
3348
+ padding: 0.8rem 1.4rem;
3349
+ border: 0;
3350
+ border-bottom: 1px solid rgba(255, 255, 255, 0.08);
3351
+ border-radius: 0;
3352
+ background: rgb(18, 18, 20);
3353
+ backdrop-filter: none;
3318
3354
 
3319
- /* the text alone is a thin target, so each label carries an invisible pad it can be caught by */
3320
- .label-hit { fill: transparent; cursor: pointer; }
3321
- `,DV=xt(()=>{}),OV=({data:e})=>{let t=pt(kV);return/* @__PURE__ */ V(kh,{className:`work-node${e.current?` current`:``}${e.lit?` lit`:``}`,to:t(e.uri,e.title===e.uri?void 0:e.title),title:e.title,children:[/* @__PURE__ */ L(az,{type:`target`,position:$.Left}),/* @__PURE__ */ L(`div`,{className:`title`,children:e.lines.map(e=>/* @__PURE__ */ L(`div`,{children:e},e))}),e.meta?/* @__PURE__ */ L(`div`,{className:`meta`,children:e.meta}):void 0,/* @__PURE__ */ L(az,{type:`source`,position:$.Right})]})},kV=xt((e,t)=>e),AV=(e,t,n,r)=>{let i=n>=e,a=Math.max(20,Math.abs(n-e)/2)*(i?1:-1);return`M ${e} ${t} C ${e+a} ${t}, ${n-a} ${r}, ${n} ${r}`},jV=({data:e,sourceX:t,sourceY:n,targetX:r,targetY:i})=>/* @__PURE__ */ L(`path`,{className:`chain${e?.lit?` lit`:``}`,d:AV(t,n,r,i)}),MV=({id:e,data:t,sourceX:n,sourceY:r,targetX:i,targetY:a})=>{let o=pt(DV),s=t?.label??``,c=t?.lit?` lit`:``,l=(e,t)=>e+(t-e)*.34,u=l(n,i),d=l(r,a)-6,f=s.length*6.4+12;return/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`path`,{className:`edge${c}`,d:AV(n,r,i,a)}),/* @__PURE__ */ V(`g`,{className:`label`,onPointerEnter:()=>o({kind:`edge`,key:e}),onPointerLeave:()=>o(void 0),children:[/* @__PURE__ */ L(`rect`,{className:`label-hit`,x:u-f/2,y:d-11,width:f,height:15}),/* @__PURE__ */ L(`text`,{className:`edge-label${c}`,x:u,y:d,children:s})]})]})},NV={work:OV},PV={chain:jV,relation:MV},FV=({franchise:e,currentUris:t,route:n})=>{let r=F(),i=VD(Sh()),a=R((e,t)=>`${Gh(n,{uri:Rt(e),name:t})}${i}`,[n,i]),o=B(()=>QD(e),[e]),[s,c]=z(()=>new Set(o.filter(ZD))),l=[...s].every(ZD)?`story`:`graph`,u=B(()=>aO($D(e,e=>!e.format||s.has(e.format)),l),[e,s,l]),[d,f]=z(void 0),p=B(()=>new Set(t),[t]),{nodes:m,edges:h}=B(()=>wV(u,{current:p,hover:d}),[u,p,d]),g=R((e,t)=>f({kind:`node`,uri:t.id}),[]),_=R(()=>f(void 0),[]),v=e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`div`,{className:`bar`,children:/* @__PURE__ */ L(`div`,{className:`title`,children:r.formatMessage({id:`Series#every work of a franchise`,defaultMessage:`Series`,description:`every work of a franchise`})})}),/* @__PURE__ */ V(`div`,{className:`canvas`,"data-canvas":!0,children:[o.length?/* @__PURE__ */ V(`div`,{className:`kinds`,onPointerDown:e=>e.stopPropagation(),children:[/* @__PURE__ */ L(`div`,{className:`legend`,children:r.formatMessage({id:`Show#verb`,defaultMessage:`Show`,description:`verb`})}),o.map(e=>/* @__PURE__ */ V(`label`,{className:s.has(e)?`on`:void 0,children:[/* @__PURE__ */ L(`input`,{type:`checkbox`,checked:s.has(e),onChange:()=>v(e)}),/* @__PURE__ */ L(`span`,{children:dO(e)})]},e))]}):void 0,/* @__PURE__ */ L(kV.Provider,{value:a,children:/* @__PURE__ */ L(DV.Provider,{value:f,children:/* @__PURE__ */ L(RB,{nodes:m,edges:h,nodeTypes:NV,edgeTypes:PV,onNodeMouseEnter:g,onNodeMouseLeave:_,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,fitView:!0,minZoom:.05,maxZoom:20,"aria-label":r.formatMessage({id:`Every work in this series, in order`,defaultMessage:`Every work in this series, in order`}),children:/* @__PURE__ */ L(GB,{variant:VB.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.14)`})})})})]})]})},IV=({franchise:e,currentUris:t,route:n=Q.MEDIA})=>{let r=F(),[i,a]=z(!1),{refs:o,context:s}=Yy({open:i,onOpenChange:a}),{getReferenceProps:c,getFloatingProps:l}=$y([Uy(s),qy(s,{outsidePress:!0}),tb(s,{role:`dialog`})]);return!e||(e.nodes?.length??0)<2?null:/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`button`,{type:`button`,css:TV,ref:o.setReference,...c(),"data-franchise-open":!0,children:[/* @__PURE__ */ L(Jb,{}),/* @__PURE__ */ L(`span`,{children:r.formatMessage({id:`Relation graph`,defaultMessage:`Relation graph`})})]}),i?/* @__PURE__ */ L(Cy,{children:/* @__PURE__ */ L(zy,{lockScroll:!0,css:EV,"data-franchise":!0,children:/* @__PURE__ */ L(Py,{context:s,children:/* @__PURE__ */ V(`div`,{className:`sheet`,ref:o.setFloating,...l(),children:[/* @__PURE__ */ L(FV,{franchise:e,currentUris:t,route:n}),/* @__PURE__ */ L(`button`,{type:`button`,className:`close`,"aria-label":r.formatMessage({id:`Close`,defaultMessage:`Close`}),onClick:()=>a(!1),children:/* @__PURE__ */ L(sx,{})})]})})})}):void 0]})},LV=[`started`,`watched`,`completed`],RV=150,zV=40,BV=300,VV=/^[\x20-\x7e]{1,64}$/,HV=10,UV=36e5,WV=e=>{let t=Tl(e),n=t.kind===`catalogue`||t.kind===`keys`?Ol(El(t)):null;return n&&VV.test(n)?n:void 0},GV=(e,t)=>[...e.normalize(`NFC`).trim()].slice(0,t).join(``),KV=e=>{try{let{href:t,protocol:n}=new URL(e);return n===`https:`&&t.length<=BV?t:void 0}catch{return}},qV=({kind:e,detail:t,title:n,uri:r,cover:i},a)=>{let o=WV(r),s=o&&Rt(o),c=s&&Ot(s)?KV(`${a}${Gh(Q.TITLE,{uri:s})}`):void 0,l=n?GV(n,RV):``;if(!c||!l)return;let u=i?KV(i):void 0,d=t?GV(t,zV):``;return{kind:e,title:l,link:c,...d?{detail:d}:{},...u?{image:u}:{},subject:o}},JV=(e,t,n=Date.now)=>{let r=[];return async i=>{try{let a=qV(i,t());if(!a)return;let o=await e.publishing();if(o.state!==`allowed`||!o.kinds.includes(a.kind))return;let s=n();for(;r.length&&r[0]<=s-UV;)r.shift();if(r.length>=HV)return;r.push(s),await e.publish(a)}catch{}}},YV=e=>2<e.min?{usable:!1,reason:`outdated`}:{usable:!0,level:Math.min(2,e.protocol)},XV=(e,t)=>e.usable&&e.level>=t,ZV={publishing:2,allowPublishing:2,publish:2,stopPublishing:2},QV=({connect:e,install:t})=>{let n=null,r=()=>{let t=n??=(async()=>{let t=await e();if(t===null)return`none`;let n=YV(await t.hello());return n.usable?XV(n,ZV.publish)?{hub:t}:{refused:`unsupported`}:{refused:`outdated`}})();return t.then(e=>{e===`none`&&n===t&&(n=null)},()=>{n===t&&(n=null)}),t},i=async(e,i,a,o=!1)=>{try{let n=await r();if(n===`none`&&o){if(!await t())return i(`unavailable`);n=await r()}return n===`none`?o?i(`unavailable`):e:`refused`in n?i(n.refused):await a(n.hub)}catch{return n=null,i(`unavailable`)}},a={state:`off`},o=e=>({state:e});return{publishing:()=>i(a,o,e=>e.publishing()),allowPublishing:e=>i(a,o,t=>t.allowPublishing(e),!0),publish:e=>i({ok:!1,reason:`not-allowed`},e=>({ok:!1,reason:e}),t=>t.publish(e)),stopPublishing:()=>i(a,o,e=>e.stopPublishing())}},$V=`https://social.fkn.app/`,eH=`https:social.fkn.app`,tH=`social@1`,nH=QV({connect:async()=>{try{let{remote:e}=await ge(eH,{protocol:tH});return e}catch(e){if(e?.code===`not-installed`)return null;throw e}},install:async()=>await P(eH,{noConfirm:!0})!==null}),rH=JV(nH,()=>location.origin),iH=e=>`tracking:${e}`;H();var aH=I`
3355
+ & > .legend { margin-bottom: 0; }
3356
+ }
3357
+ }
3358
+ `,IV=xt(()=>{}),LV=({data:e})=>{let t=pt(RV);return/* @__PURE__ */ V(kh,{className:`work-node${e.current?` current`:``}${e.lit?` lit`:``}`,to:t(e.uri,e.title===e.uri?void 0:e.title),title:e.title,children:[/* @__PURE__ */ L(az,{type:`target`,position:$.Left}),/* @__PURE__ */ L(`div`,{className:`title`,children:e.lines.map(e=>/* @__PURE__ */ L(`div`,{children:e},e))}),e.meta?/* @__PURE__ */ L(`div`,{className:`meta`,children:e.meta}):void 0,/* @__PURE__ */ L(az,{type:`source`,position:$.Right})]})},RV=xt((e,t)=>e),zV=(e,t,n,r)=>{let i=n>=e,a=Math.max(20,Math.abs(n-e)/2)*(i?1:-1);return`M ${e} ${t} C ${e+a} ${t}, ${n-a} ${r}, ${n} ${r}`},BV=({data:e,sourceX:t,sourceY:n,targetX:r,targetY:i})=>/* @__PURE__ */ L(`path`,{className:`chain${e?.lit?` lit`:``}`,d:zV(t,n,r,i)}),VV=({id:e,data:t,sourceX:n,sourceY:r,targetX:i,targetY:a})=>{let o=pt(IV),s=t?.label??``,c=t?.lit?` lit`:``,l=t?.labelX??(n+i)/2,u=t?.labelY??(r+a)/2;return/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`path`,{className:`edge${c}`,d:t?.path??zV(n,r,i,a)}),/* @__PURE__ */ L(BB,{children:/* @__PURE__ */ L(`div`,{className:`edge-label${c} nodrag nopan`,style:{transform:`translate(-50%, -50%) translate(${l}px, ${u}px)`},onPointerEnter:()=>o({kind:`edge`,key:e}),onPointerLeave:()=>o(void 0),children:s})})]})},HV=({nodes:e,currentKey:t,layoutKey:n})=>{let{setCenter:r}=MR(),i=HB();return K(()=>{if(!i||window.innerWidth>720||!e.length)return;let t=Math.min(...e.map(e=>e.position.x)),n=Math.max(...e.map(e=>e.position.x+190)),a=document.querySelector(`[data-franchise] .react-flow`)?.clientWidth??window.innerWidth;if((n-t)*.65<=a)return;let o=e.find(e=>e.data.current)??e[0];if(!o)return;let s=requestAnimationFrame(()=>{r(o.position.x+95,o.position.y+37,{zoom:.75})});return()=>cancelAnimationFrame(s)},[i,n,t,r]),null},UV={work:LV},WV={chain:BV,relation:VV},GV=({franchise:e,currentUris:t,route:n})=>{let r=F(),i=VD(Sh()),a=R((e,t)=>`${Gh(n,{uri:Rt(e),name:t})}${i}`,[n,i]),o=B(()=>QD(e),[e]),[s,c]=z(()=>new Set(o.filter(ZD))),l=[...s].every(ZD)?`story`:`graph`,u=B(()=>aO($D(e,e=>!e.format||s.has(e.format)),l),[e,s,l]),[d,f]=z(void 0),p=B(()=>new Set(t),[t]),{nodes:m,edges:h}=B(()=>NV(u,{current:p,hover:d}),[u,p,d]),g=R((e,t)=>f({kind:`node`,uri:t.id}),[]),_=R(()=>f(void 0),[]),v=e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`div`,{className:`bar`,children:/* @__PURE__ */ L(`div`,{className:`title`,children:r.formatMessage({id:`Series#every work of a franchise`,defaultMessage:`Series`,description:`every work of a franchise`})})}),/* @__PURE__ */ V(`div`,{className:`canvas`,"data-canvas":!0,children:[o.length?/* @__PURE__ */ V(`div`,{className:`kinds`,onPointerDown:e=>e.stopPropagation(),children:[/* @__PURE__ */ L(`div`,{className:`legend`,children:r.formatMessage({id:`Show#verb`,defaultMessage:`Show`,description:`verb`})}),o.map(e=>/* @__PURE__ */ V(`label`,{className:s.has(e)?`on`:void 0,children:[/* @__PURE__ */ L(`input`,{type:`checkbox`,checked:s.has(e),onChange:()=>v(e)}),/* @__PURE__ */ L(`span`,{children:dO(e)})]},e))]}):void 0,/* @__PURE__ */ L(RV.Provider,{value:a,children:/* @__PURE__ */ L(IV.Provider,{value:f,children:/* @__PURE__ */ V(RB,{nodes:m,edges:h,nodeTypes:UV,edgeTypes:WV,onNodeMouseEnter:g,onNodeMouseLeave:_,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,fitView:!0,fitViewOptions:{padding:.16,minZoom:.65,maxZoom:1},minZoom:.05,maxZoom:20,"aria-label":r.formatMessage({id:`Every work in this series, in order`,defaultMessage:`Every work in this series, in order`}),children:[/* @__PURE__ */ L(HV,{nodes:m,layoutKey:u.nodes.map(e=>e.uri).join(`\0`),currentKey:t.join(`\0`)}),/* @__PURE__ */ L(YB,{variant:GB.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.14)`})]})})})]})]})},KV=({franchise:e,currentUris:t,route:n=Q.MEDIA})=>{let r=F(),[i,a]=z(!1),{refs:o,context:s}=Yy({open:i,onOpenChange:a}),{getReferenceProps:c,getFloatingProps:l}=$y([Uy(s),qy(s,{outsidePress:!0}),tb(s,{role:`dialog`})]);return!e||(e.nodes?.length??0)<2?null:/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`button`,{type:`button`,css:PV,ref:o.setReference,...c(),"data-franchise-open":!0,children:[/* @__PURE__ */ L(Jb,{}),/* @__PURE__ */ L(`span`,{children:r.formatMessage({id:`Relation graph`,defaultMessage:`Relation graph`})})]}),i?/* @__PURE__ */ L(Cy,{children:/* @__PURE__ */ L(zy,{lockScroll:!0,css:FV,"data-franchise":!0,children:/* @__PURE__ */ L(Py,{context:s,children:/* @__PURE__ */ V(`div`,{className:`sheet`,ref:o.setFloating,...l(),children:[/* @__PURE__ */ L(GV,{franchise:e,currentUris:t,route:n}),/* @__PURE__ */ L(`button`,{type:`button`,className:`close`,"aria-label":r.formatMessage({id:`Close`,defaultMessage:`Close`}),onClick:()=>a(!1),children:/* @__PURE__ */ L(sx,{})})]})})})}):void 0]})},qV=[`started`,`watched`,`completed`],JV=150,YV=40,XV=300,ZV=/^[\x20-\x7e]{1,64}$/,QV=10,$V=36e5,eH=e=>{let t=Tl(e),n=t.kind===`catalogue`||t.kind===`keys`?Ol(El(t)):null;return n&&ZV.test(n)?n:void 0},tH=(e,t)=>[...e.normalize(`NFC`).trim()].slice(0,t).join(``),nH=e=>{try{let{href:t,protocol:n}=new URL(e);return n===`https:`&&t.length<=XV?t:void 0}catch{return}},rH=({kind:e,detail:t,title:n,uri:r,cover:i},a)=>{let o=eH(r),s=o&&Rt(o),c=s&&Ot(s)?nH(`${a}${Gh(Q.TITLE,{uri:s})}`):void 0,l=n?tH(n,JV):``;if(!c||!l)return;let u=i?nH(i):void 0,d=t?tH(t,YV):``;return{kind:e,title:l,link:c,...d?{detail:d}:{},...u?{image:u}:{},subject:o}},iH=(e,t,n=Date.now)=>{let r=[];return async i=>{try{let a=rH(i,t());if(!a)return;let o=await e.publishing();if(o.state!==`allowed`||!o.kinds.includes(a.kind))return;let s=n();for(;r.length&&r[0]<=s-$V;)r.shift();if(r.length>=QV)return;r.push(s),await e.publish(a)}catch{}}},aH=e=>2<e.min?{usable:!1,reason:`outdated`}:{usable:!0,level:Math.min(2,e.protocol)},oH=(e,t)=>e.usable&&e.level>=t,sH={publishing:2,allowPublishing:2,publish:2,stopPublishing:2},cH=({connect:e,install:t})=>{let n=null,r=()=>{let t=n??=(async()=>{let t=await e();if(t===null)return`none`;let n=aH(await t.hello());return n.usable?oH(n,sH.publish)?{hub:t}:{refused:`unsupported`}:{refused:`outdated`}})();return t.then(e=>{e===`none`&&n===t&&(n=null)},()=>{n===t&&(n=null)}),t},i=async(e,i,a,o=!1)=>{try{let n=await r();if(n===`none`&&o){if(!await t())return i(`unavailable`);n=await r()}return n===`none`?o?i(`unavailable`):e:`refused`in n?i(n.refused):await a(n.hub)}catch{return n=null,i(`unavailable`)}},a={state:`off`},o=e=>({state:e});return{publishing:()=>i(a,o,e=>e.publishing()),allowPublishing:e=>i(a,o,t=>t.allowPublishing(e),!0),publish:e=>i({ok:!1,reason:`not-allowed`},e=>({ok:!1,reason:e}),t=>t.publish(e)),stopPublishing:()=>i(a,o,e=>e.stopPublishing())}},lH=`https://social.fkn.app/`,uH=`https:social.fkn.app`,dH=`social@1`,fH=cH({connect:async()=>{try{let{remote:e}=await ge(uH,{protocol:dH});return e}catch(e){if(e?.code===`not-installed`)return null;throw e}},install:async()=>await P(uH,{noConfirm:!0})!==null}),pH=iH(fH,()=>location.origin),mH=e=>`tracking:${e}`;H();var hH=I`
3322
3359
  display: flex;
3323
3360
  flex-direction: column;
3324
3361
  gap: 0.8rem;
@@ -3345,7 +3382,7 @@ overflow-wrap: anywhere;
3345
3382
  &:hover { background: rgba(255, 255, 255, 0.08); }
3346
3383
  &:disabled { opacity: 0.5; cursor: default; }
3347
3384
  }
3348
- `,oH=({storage:e,onUnlock:t,onAdd:n})=>{let r=F(),[i,a]=z(!1);if(!e)return null;let o=e=>async()=>{a(!0);try{await e()}finally{a(!1)}},s=e.location===`ACCOUNT`,c=e.signedIn===!0&&e.locked,l=[c?/* @__PURE__ */ V(`div`,{className:`line`,children:[/* @__PURE__ */ L(`span`,{children:r.formatMessage({id:`Stub: your FKN account's list is locked on this device`,defaultMessage:`Stub: your FKN account's list is locked on this device`})}),/* @__PURE__ */ L(`button`,{type:`button`,disabled:i,onClick:o(t),children:r.formatMessage({id:`Unlock`,defaultMessage:`Unlock`})})]},`locked`):void 0,s&&!c&&e.held>0?/* @__PURE__ */ V(`div`,{className:`line`,children:[/* @__PURE__ */ L(`span`,{children:r.formatMessage({id:`Stub: {count, plural, one {{count} entry} other {{count} entries}} saved on this device before you signed in`,defaultMessage:`Stub: {count, plural, one {{count} entry} other {{count} entries}} saved on this device before you signed in`},{count:e.held})}),/* @__PURE__ */ L(`button`,{type:`button`,disabled:i,onClick:o(n),children:r.formatMessage({id:`Add to my FKN account`,defaultMessage:`Add to my FKN account`})})]},`held`):void 0,s&&!c&&e.waiting?/* @__PURE__ */ L(`div`,{className:`line`,children:r.formatMessage({id:`Stub: some changes have not reached your FKN account yet.`,defaultMessage:`Stub: some changes have not reached your FKN account yet.`})},`waiting`):void 0,e.error?/* @__PURE__ */ L(`div`,{className:`line problem`,children:r.formatMessage({id:`Stub: {error}`,defaultMessage:`Stub: {error}`},{error:cn(e.error)})},`error`):void 0].filter(Boolean);return l.length?/* @__PURE__ */ L(`div`,{css:aH,className:`stub-list-notice`,role:`status`,children:l}):null},sH=I`
3385
+ `,gH=({storage:e,onUnlock:t,onAdd:n})=>{let r=F(),[i,a]=z(!1);if(!e)return null;let o=e=>async()=>{a(!0);try{await e()}finally{a(!1)}},s=e.location===`ACCOUNT`,c=e.signedIn===!0&&e.locked,l=[c?/* @__PURE__ */ V(`div`,{className:`line`,children:[/* @__PURE__ */ L(`span`,{children:r.formatMessage({id:`Stub: your FKN account's list is locked on this device`,defaultMessage:`Stub: your FKN account's list is locked on this device`})}),/* @__PURE__ */ L(`button`,{type:`button`,disabled:i,onClick:o(t),children:r.formatMessage({id:`Unlock`,defaultMessage:`Unlock`})})]},`locked`):void 0,s&&!c&&e.held>0?/* @__PURE__ */ V(`div`,{className:`line`,children:[/* @__PURE__ */ L(`span`,{children:r.formatMessage({id:`Stub: {count, plural, one {{count} entry} other {{count} entries}} saved on this device before you signed in`,defaultMessage:`Stub: {count, plural, one {{count} entry} other {{count} entries}} saved on this device before you signed in`},{count:e.held})}),/* @__PURE__ */ L(`button`,{type:`button`,disabled:i,onClick:o(n),children:r.formatMessage({id:`Add to my FKN account`,defaultMessage:`Add to my FKN account`})})]},`held`):void 0,s&&!c&&e.waiting?/* @__PURE__ */ L(`div`,{className:`line`,children:r.formatMessage({id:`Stub: some changes have not reached your FKN account yet.`,defaultMessage:`Stub: some changes have not reached your FKN account yet.`})},`waiting`):void 0,e.error?/* @__PURE__ */ L(`div`,{className:`line problem`,children:r.formatMessage({id:`Stub: {error}`,defaultMessage:`Stub: {error}`},{error:cn(e.error)})},`error`):void 0].filter(Boolean);return l.length?/* @__PURE__ */ L(`div`,{css:hH,className:`stub-list-notice`,role:`status`,children:l}):null},_H=I`
3349
3386
  display: flex;
3350
3387
  align-items: center;
3351
3388
  flex-wrap: wrap;
@@ -3364,7 +3401,7 @@ overflow-wrap: anywhere;
3364
3401
  cursor: pointer;
3365
3402
  &:disabled { opacity: 0.5; cursor: default; }
3366
3403
  }
3367
- `,cH=({remove:e,status:t,progress:n,score:r})=>e?`removal`:[t!==void 0&&`status`,n!==void 0&&`episode`,r!==void 0&&`score`].filter(Boolean).join(`_`),lH=({answer:e,state:{failed:t,refused:n},queue:r})=>{let i=F(),{id:a,name:o}=e.tracker;return/* @__PURE__ */ V(W,{children:[t?/* @__PURE__ */ V(`div`,{css:sH,className:`note`,"data-note":a,children:[i.formatMessage({id:`{what, select, removal {{name} did not save the removal: {error}} status {{name} did not save the status: {error}} episode {{name} did not save episode {episode}: {error}} score {{name} did not save the score: {error}} status_episode {{name} did not save the status and episode {episode}: {error}} status_score {{name} did not save the status and the score: {error}} episode_score {{name} did not save episode {episode} and the score: {error}} status_episode_score {{name} did not save the status and episode {episode} and the score: {error}} other {{name} did not save: {error}}}`,defaultMessage:`{what, select, removal {{name} did not save the removal: {error}} status {{name} did not save the status: {error}} episode {{name} did not save episode {episode}: {error}} score {{name} did not save the score: {error}} status_episode {{name} did not save the status and episode {episode}: {error}} status_score {{name} did not save the status and the score: {error}} episode_score {{name} did not save episode {episode} and the score: {error}} status_episode_score {{name} did not save the status and episode {episode} and the score: {error}} other {{name} did not save: {error}}}`},{what:cH(t.fields),name:o,episode:t.fields.progress??``,error:cn(t.error)}),/* @__PURE__ */ L(`button`,{type:`button`,disabled:!Cd(e),onClick:()=>r.retry(a),children:i.formatMessage({id:`Retry`,defaultMessage:`Retry`})})]}):void 0,n?/* @__PURE__ */ V(`div`,{css:sH,className:`note`,"data-note":a,children:[i.formatMessage({id:`{name} did not save: {error}`,defaultMessage:`{name} did not save: {error}`},{name:o,error:cn(n)}),/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>r.dismiss(a),children:i.formatMessage({id:`Dismiss`,defaultMessage:`Dismiss`})})]}):void 0]})};H();var uH=[Ib,Gb,tx],dH={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10,POINT_100:100},fH=I`
3404
+ `,vH=({remove:e,status:t,progress:n,score:r})=>e?`removal`:[t!==void 0&&`status`,n!==void 0&&`episode`,r!==void 0&&`score`].filter(Boolean).join(`_`),yH=({answer:e,state:{failed:t,refused:n},queue:r})=>{let i=F(),{id:a,name:o}=e.tracker;return/* @__PURE__ */ V(W,{children:[t?/* @__PURE__ */ V(`div`,{css:_H,className:`note`,"data-note":a,children:[i.formatMessage({id:`{what, select, removal {{name} did not save the removal: {error}} status {{name} did not save the status: {error}} episode {{name} did not save episode {episode}: {error}} score {{name} did not save the score: {error}} status_episode {{name} did not save the status and episode {episode}: {error}} status_score {{name} did not save the status and the score: {error}} episode_score {{name} did not save episode {episode} and the score: {error}} status_episode_score {{name} did not save the status and episode {episode} and the score: {error}} other {{name} did not save: {error}}}`,defaultMessage:`{what, select, removal {{name} did not save the removal: {error}} status {{name} did not save the status: {error}} episode {{name} did not save episode {episode}: {error}} score {{name} did not save the score: {error}} status_episode {{name} did not save the status and episode {episode}: {error}} status_score {{name} did not save the status and the score: {error}} episode_score {{name} did not save episode {episode} and the score: {error}} status_episode_score {{name} did not save the status and episode {episode} and the score: {error}} other {{name} did not save: {error}}}`},{what:vH(t.fields),name:o,episode:t.fields.progress??``,error:cn(t.error)}),/* @__PURE__ */ L(`button`,{type:`button`,disabled:!Cd(e),onClick:()=>r.retry(a),children:i.formatMessage({id:`Retry`,defaultMessage:`Retry`})})]}):void 0,n?/* @__PURE__ */ V(`div`,{css:_H,className:`note`,"data-note":a,children:[i.formatMessage({id:`{name} did not save: {error}`,defaultMessage:`{name} did not save: {error}`},{name:o,error:cn(n)}),/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>r.dismiss(a),children:i.formatMessage({id:`Dismiss`,defaultMessage:`Dismiss`})})]}):void 0]})};H();var bH=[Ib,Gb,tx],xH={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10,POINT_100:100},SH=I`
3368
3405
  position: relative;
3369
3406
  display: flex;
3370
3407
 
@@ -3389,7 +3426,7 @@ overflow-wrap: anywhere;
3389
3426
  .caption { font-size: 1.2rem; color: rgba(255, 255, 255, 0.6); }
3390
3427
  .exact { display: flex; align-items: center; gap: 0.6rem; font-size: 1.2rem; color: rgba(255, 255, 255, 0.6); }
3391
3428
  .exact input { width: 7rem; }
3392
- `,pH=({score:e,scale:t,size:n=16})=>{let r=F(),i=gd(e,t);if(t===`POINT_3`){let e=uH[i-1]??Gb;return/* @__PURE__ */ L(e,{size:n,"aria-hidden":`true`})}return/* @__PURE__ */ L(`span`,{className:`value`,children:r.formatNumber(i)})},mH=(e,t,n)=>{let r=gd(t,n);return n===`POINT_3`?e.formatMessage({id:`{face, select, 1 {{value, number} out of 3 (bad)} 2 {{value, number} out of 3 (neutral)} other {{value, number} out of 3 (good)}}`,defaultMessage:`{face, select, 1 {{value, number} out of 3 (bad)} 2 {{value, number} out of 3 (neutral)} other {{value, number} out of 3 (good)}}`},{face:String(r),value:r}):e.formatMessage({id:`{value, number} out of {max, number}`,defaultMessage:`{value, number} out of {max, number}`},{value:r,max:dH[n]??100})},hH=({score:e,scale:t,mixed:n,disabled:r,clearable:i=!0,onPick:a})=>{let o=F(),[s,c]=z(!1),[l,u]=z(``),d=G(null),f=G(null),{refs:p,floatingStyles:m}=Yy({open:s,placement:`bottom-start`,whileElementsMounted:Ae,middleware:[Ev(6),Ov({padding:8})]}),h=Av([f,p.setReference]),g=hd(e),_=g?gd(e,t):void 0,v=()=>{c(!1),f.current?.focus()},y=e=>{a(e),v()};K(()=>{if(!s)return;d.current?.querySelector(`.menu button[aria-pressed="true"], .menu button`)?.focus();let e=e=>{d.current?.contains(e.target)||c(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[s]);let b=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),v();return}let t=getComputedStyle(d.current).direction===`rtl`?-1:1,n={ArrowRight:t,ArrowDown:1,ArrowLeft:-t,ArrowUp:-1}[e.key];if(!n||e.target.tagName===`INPUT`)return;let r=[...d.current.querySelectorAll(`.menu button, .menu input`)];r[(r.indexOf(document.activeElement)+n+r.length)%r.length]?.focus(),e.preventDefault()},x=t===`POINT_10_DECIMAL`,S=()=>{let e=Number(l);l!==``&&Number.isFinite(e)&&y(zd(Math.min(100,Math.max(1,Math.round(x?e*10:e))),t))};return/* @__PURE__ */ V(`span`,{css:fH,ref:d,children:[/* @__PURE__ */ V(`button`,{ref:h,type:`button`,className:`star`,"aria-label":g?o.formatMessage({id:`Score, {score}`,defaultMessage:`Score, {score}`},{score:mH(o,e,t)}):o.formatMessage({id:`Score, none`,defaultMessage:`Score, none`}),"aria-haspopup":`dialog`,"aria-expanded":s,disabled:r,onClick:()=>c(e=>!e),children:[/* @__PURE__ */ L(rx,{size:18,"aria-hidden":`true`,fill:g?`#facc15`:`none`,stroke:g?`#facc15`:`rgba(255, 255, 255, 0.45)`}),g?/* @__PURE__ */ L(pH,{score:e,scale:t}):void 0]}),s?/* @__PURE__ */ V(`div`,{ref:p.setFloating,style:m,className:`menu`,role:`dialog`,"aria-label":o.formatMessage({id:`Score`,defaultMessage:`Score`}),onKeyDown:b,children:[/* @__PURE__ */ L(`div`,{className:`grid${t===`POINT_3`?` faces`:``}`,children:Ld[t].map((e,n)=>{let r=gd(e,t),i=uH[n];return/* @__PURE__ */ L(`button`,{type:`button`,"aria-label":mH(o,e,t),"aria-pressed":_===r,onClick:()=>y(zd(e,t)),children:t===`POINT_3`&&i?/* @__PURE__ */ L(i,{size:16,"aria-hidden":`true`}):o.formatNumber(t===`POINT_100`?e/10:r)},e)})}),t===`POINT_100`||x?/* @__PURE__ */ V(`label`,{className:`exact`,children:[o.formatMessage({id:`Exact#score`,defaultMessage:`Exact`,description:`score`}),/* @__PURE__ */ L(`input`,{type:`number`,name:`score-exact`,min:x?.1:1,max:x?10:100,step:x?.1:1,value:l,onInput:e=>u(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&S()}})]}):void 0,n?/* @__PURE__ */ L(`span`,{className:`caption`,children:o.formatMessage({id:`Out of {max, number}`,defaultMessage:`Out of {max, number}`},{max:dH[t]})}):void 0,g&&i?/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>y(null),children:o.formatMessage({id:`No score`,defaultMessage:`No score`})}):void 0]}):void 0]})};H();var gH={blocked:()=>mc.formatMessage({id:`The browser blocked the sign-in window: allow pop-ups, then press Log in again.`,defaultMessage:`The browser blocked the sign-in window: allow pop-ups, then press Log in again.`}),unsupported:e=>mc.formatMessage({id:`Sign in to {name} in this browser, then press Log in again.`,defaultMessage:`Sign in to {name} in this browser, then press Log in again.`},{name:e})},_H=Ee({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`}}),vH=(e,t)=>{let n=_H[t];return n?e.formatMessage(n):t},yH=I`
3429
+ `,CH=({score:e,scale:t,size:n=16})=>{let r=F(),i=gd(e,t);if(t===`POINT_3`){let e=bH[i-1]??Gb;return/* @__PURE__ */ L(e,{size:n,"aria-hidden":`true`})}return/* @__PURE__ */ L(`span`,{className:`value`,children:r.formatNumber(i)})},wH=(e,t,n)=>{let r=gd(t,n);return n===`POINT_3`?e.formatMessage({id:`{face, select, 1 {{value, number} out of 3 (bad)} 2 {{value, number} out of 3 (neutral)} other {{value, number} out of 3 (good)}}`,defaultMessage:`{face, select, 1 {{value, number} out of 3 (bad)} 2 {{value, number} out of 3 (neutral)} other {{value, number} out of 3 (good)}}`},{face:String(r),value:r}):e.formatMessage({id:`{value, number} out of {max, number}`,defaultMessage:`{value, number} out of {max, number}`},{value:r,max:xH[n]??100})},TH=({score:e,scale:t,mixed:n,disabled:r,clearable:i=!0,onPick:a})=>{let o=F(),[s,c]=z(!1),[l,u]=z(``),d=G(null),f=G(null),{refs:p,floatingStyles:m}=Yy({open:s,placement:`bottom-start`,whileElementsMounted:Ae,middleware:[Ev(6),Ov({padding:8})]}),h=Av([f,p.setReference]),g=hd(e),_=g?gd(e,t):void 0,v=()=>{c(!1),f.current?.focus()},y=e=>{a(e),v()};K(()=>{if(!s)return;d.current?.querySelector(`.menu button[aria-pressed="true"], .menu button`)?.focus();let e=e=>{d.current?.contains(e.target)||c(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[s]);let b=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),v();return}let t=getComputedStyle(d.current).direction===`rtl`?-1:1,n={ArrowRight:t,ArrowDown:1,ArrowLeft:-t,ArrowUp:-1}[e.key];if(!n||e.target.tagName===`INPUT`)return;let r=[...d.current.querySelectorAll(`.menu button, .menu input`)];r[(r.indexOf(document.activeElement)+n+r.length)%r.length]?.focus(),e.preventDefault()},x=t===`POINT_10_DECIMAL`,S=()=>{let e=Number(l);l!==``&&Number.isFinite(e)&&y(zd(Math.min(100,Math.max(1,Math.round(x?e*10:e))),t))};return/* @__PURE__ */ V(`span`,{css:SH,ref:d,children:[/* @__PURE__ */ V(`button`,{ref:h,type:`button`,className:`star`,"aria-label":g?o.formatMessage({id:`Score, {score}`,defaultMessage:`Score, {score}`},{score:wH(o,e,t)}):o.formatMessage({id:`Score, none`,defaultMessage:`Score, none`}),"aria-haspopup":`dialog`,"aria-expanded":s,disabled:r,onClick:()=>c(e=>!e),children:[/* @__PURE__ */ L(rx,{size:18,"aria-hidden":`true`,fill:g?`#facc15`:`none`,stroke:g?`#facc15`:`rgba(255, 255, 255, 0.45)`}),g?/* @__PURE__ */ L(CH,{score:e,scale:t}):void 0]}),s?/* @__PURE__ */ V(`div`,{ref:p.setFloating,style:m,className:`menu`,role:`dialog`,"aria-label":o.formatMessage({id:`Score`,defaultMessage:`Score`}),onKeyDown:b,children:[/* @__PURE__ */ L(`div`,{className:`grid${t===`POINT_3`?` faces`:``}`,children:Ld[t].map((e,n)=>{let r=gd(e,t),i=bH[n];return/* @__PURE__ */ L(`button`,{type:`button`,"aria-label":wH(o,e,t),"aria-pressed":_===r,onClick:()=>y(zd(e,t)),children:t===`POINT_3`&&i?/* @__PURE__ */ L(i,{size:16,"aria-hidden":`true`}):o.formatNumber(t===`POINT_100`?e/10:r)},e)})}),t===`POINT_100`||x?/* @__PURE__ */ V(`label`,{className:`exact`,children:[o.formatMessage({id:`Exact#score`,defaultMessage:`Exact`,description:`score`}),/* @__PURE__ */ L(`input`,{type:`number`,name:`score-exact`,min:x?.1:1,max:x?10:100,step:x?.1:1,value:l,onInput:e=>u(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&S()}})]}):void 0,n?/* @__PURE__ */ L(`span`,{className:`caption`,children:o.formatMessage({id:`Out of {max, number}`,defaultMessage:`Out of {max, number}`},{max:xH[t]})}):void 0,g&&i?/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>y(null),children:o.formatMessage({id:`No score`,defaultMessage:`No score`})}):void 0]}):void 0]})};H();var EH={blocked:()=>mc.formatMessage({id:`The browser blocked the sign-in window: allow pop-ups, then press Log in again.`,defaultMessage:`The browser blocked the sign-in window: allow pop-ups, then press Log in again.`}),unsupported:e=>mc.formatMessage({id:`Sign in to {name} in this browser, then press Log in again.`,defaultMessage:`Sign in to {name} in this browser, then press Log in again.`},{name:e})},DH=Ee({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`}}),OH=(e,t)=>{let n=DH[t];return n?e.formatMessage(n):t},kH=I`
3393
3430
  margin-top: 2rem;
3394
3431
  display: flex;
3395
3432
  flex-direction: column;
@@ -3574,7 +3611,7 @@ overflow-wrap: anywhere;
3574
3611
  .chip > label { margin: 0 -0.4rem; padding: 0 0.4rem; }
3575
3612
  .chip .login-button { padding: 0 0.6rem; }
3576
3613
  }
3577
- `,bH={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10},xH=(e,t,n)=>{let r=n??`POINT_100`;return e.formatMessage({id:`{score, number} / {max, number}`,defaultMessage:`{score, number} / {max, number}`},{score:gd(t,r),max:bH[r]??100})},SH=`REMOVE`,CH=``,wH=({answer:e})=>/* @__PURE__ */ L(`span`,{className:`logo`,style:e.tracker.color?{color:e.tracker.color}:void 0,children:e.tracker.icon?/* @__PURE__ */ L(`img`,{src:e.tracker.icon,alt:``}):e.tracker.name.slice(0,1)}),TH=e=>e.state===`PAUSED`||e.state===`ERROR`?cn(wd(e)):void 0,EH=(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,DH=({answer:e,state:t})=>{let n=F().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__ */ V(`span`,{className:`tile ${t}`,"data-tile":e.tracker.id,role:`img`,"aria-label":n,title:n,children:[/* @__PURE__ */ L(wH,{answer:e}),/* @__PURE__ */ L(`span`,{className:`mark`,children:t===`loading`||t===`busy`?/* @__PURE__ */ L(Ub,{size:10,className:`spin`,"aria-hidden":`true`}):void 0})]})},OH=({outcome:e})=>e===`SAVED`||e===`QUEUED`,kH=({answer:e,failed:t})=>t||e.state===`ERROR`?/* @__PURE__ */ L(`span`,{className:`badge red`,"data-badge":`red`}):e.state===`PAUSED`?/* @__PURE__ */ L(`span`,{className:`badge amber`,"data-badge":`amber`}):null,AH=({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=F(),[p,m]=z(),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__ */ V(`div`,{className:`group edit`,children:[/* @__PURE__ */ L(hH,{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__ */ V(`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===SH?{remove:!0}:{status:t},!0)},children:[t.status?void 0:/* @__PURE__ */ L(`option`,{value:``,disabled:!0,children:f.formatMessage({id:`Add to list`,defaultMessage:`Add to list`})}),yd.filter(e=>!u||u.includes(e)).map(e=>/* @__PURE__ */ L(`option`,{value:e,children:vH(f,e)},e)),o?/* @__PURE__ */ L(`option`,{value:SH,children:f.formatMessage({id:`Remove from list`,defaultMessage:`Remove from list`})}):void 0]}),c.STATUS,l?/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`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__ */ L(Tt,{size:14,"aria-hidden":`true`}),f.formatMessage({id:`Watched#marked as seen`,defaultMessage:`Watched`,description:`marked as seen`})]}),c.PROGRESS]}):/* @__PURE__ */ V(`span`,{className:`progress-field`,children:[/* @__PURE__ */ L(`label`,{for:`${e}-progress`,className:`word`,children:f.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),/* @__PURE__ */ L(`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__ */ L(`span`,{className:`of`,children:f.formatMessage({id:`/ {total}`,defaultMessage:`/ {total}`},{total:_})}):void 0,c.PROGRESS,/* @__PURE__ */ L(`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__ */ L(Yb,{size:14,"aria-hidden":`true`})})]}),!l&&!i&&_&&t.progress===_&&t.status!==`COMPLETED`&&(!u||u.includes(`COMPLETED`))?/* @__PURE__ */ L(`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__ */ L(`button`,{type:`button`,onClick:()=>s({progress:_},!0),children:f.formatMessage({id:`Set {total} / {total}`,defaultMessage:`Set {total} / {total}`},{total:_})}):void 0]})},jH=({answer:e,className:t,busy:n,open:r,onOpen:i,card:a,children:o})=>{let s=G(null);K(()=>{r&&s.current?.focus()},[]);let{refs:c,floatingStyles:l,context:u}=Yy({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:Ae,middleware:[Ev(8),Ov({padding:8}),Dv({padding:8})]}),{getReferenceProps:d}=$y([Uy(u)]),{getReferenceProps:f,getFloatingProps:p}=$y([ny(u,{mouseOnly:!0,delay:{open:100},handleClose:ub()}),Zy(u),qy(u)]),m=F().formatMessage({id:`{name} entry`,defaultMessage:`{name} entry`},{name:e.tracker.name});return/* @__PURE__ */ V(`span`,{ref:c.setReference,className:t,"data-chip":e.tracker.id,"aria-busy":n?`true`:void 0,...f(),children:[/* @__PURE__ */ L(`button`,{ref:s,type:`button`,className:`logo-button`,"aria-label":m,"aria-haspopup":`dialog`,"aria-expanded":r,...d(),children:/* @__PURE__ */ L(wH,{answer:e})}),o,r?/* @__PURE__ */ L(`div`,{ref:c.setFloating,style:l,className:`card`,role:`dialog`,"aria-label":m,"data-card":e.tracker.id,...p(),children:a()}):void 0]})},MH=({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=F(),[,f]=z(0),[p,m]=z({}),[h,g]=z(),[_,v]=z(/* @__PURE__ */ new Set),[y,b]=z({}),[x,S]=z(),C=G({onSaveFields:a,onRemove:o,onActivity:s,tracking:e,episodeCount:t});C.current={onSaveFields:a,onRemove:o,onActivity:s,tracking:e,episodeCount:t};let w=G(void 0),T=B(()=>Vd({send:async(e,t)=>{let n=await(t.remove?C.current.onRemove([e]):C.current.onSaveFields([e],t));return n.find(t=>t.tracker===e)??n[0]??{outcome:`FAILED`,error:mc.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}=C.current,i=n?.answers.find(t=>t.tracker.id===e);return i&&Nd(i,t,{...Td(n,r),...t})},steps:e=>Id(C.current.tracking,e),onChange:e=>{if(f(e=>e+1),!e)return;let t=C.current.tracking?.answers.find(t=>t.tracker.id===e.tracker)?.tracker.name??e.tracker;if(g({...e,name:t}),OH(e)&&w.current){let t=bd(w.current.from,w.current.to);(!t||xd(e.fields,t))&&(w.current=void 0,t&&C.current.onActivity?.(t))}!OH(e)&&T.idle()&&m({})}}),[]),E=G(/* @__PURE__ */ new Map),D=G(/* @__PURE__ */ new Map),O=i??D.current,k=(e,t,n)=>{for(let[t,{progress:n}]of Object.entries(e))n!==void 0&&E.current.set(t,n);T.stage(e,t,n)};K(()=>{let e=()=>{document.visibilityState===`hidden`&&T.flush()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),T.flush()}},[]);let A=Td(e,t),j=t=>{let n=e?.answers.find(e=>e.tracker.id===t);return n&&Dd(n,A.total)};K(()=>{m(e=>T.idle()?{}:Object.fromEntries(Object.entries(e).flatMap(([e,t])=>{let n=e===CH?A:j(e);return n?[[e,kd(t,n)]]:[]})))},[e]);let ee=Od(A,p[CH]),M=e=>{w.current={from:w.current?.from??ee,to:e}},te=r&&e&&ee.status!==`COMPLETED`?Ud({...r,movie:n},e,l.targets,t):{},ne=e=>O.has(e)&&O.get(e)===r?.episode,re=e?.answers.filter(({tracker:{id:e}})=>te[e]&&!ne(e)&&te[e].progress>(E.current.get(e)??0))??[];K(()=>{let t=re.filter(Cd);if(r&&e&&r.played>=.85)for(let t of e.answers){let e=Ad(t,l.targets[t.tracker.id]);e.kind===`check`&&e.sendable&&O.set(t.tracker.id,r.episode)}t.length&&(M({...ee,...te[t[0].tracker.id]}),k(Object.fromEntries(t.map(({tracker:{id:e}})=>[e,te[e]])),!0))},[r,e,l]);let ie=e?.answers.filter(e=>e.state!==`NO_ID`)??[];if(e!==void 0&&!ie.length)return null;let N=ie.map(e=>({answer:e,target:Ad(e,l.targets[e.tracker.id])})),P=l.expanded===!0,ae=N.filter(({target:e})=>e.kind===`check`&&e.sendable).map(({answer:e})=>e),oe=!ae.length,se=Rd(ae.map(e=>e.tracker.scoreScale)),ce=ie.length>1&&T.idle()?Fd(N,A,se?.scale):{},le=Object.keys(ce).length>0,ue=()=>{le&&(M(A),k(ce,!0))},de=(e,t)=>{t.remove||m(n=>({...n,[e]:{...n[e],...t}}))},fe=(e,t)=>{de(CH,e);let n={...ee,...e};M(n);let r={};for(let{answer:t,target:i}of N){if(i.kind!==`check`||!i.checked)continue;let a=t.tracker.id;if(!Cd(t)){T.fail(a,e,wd(t));continue}let o=Nd(t,e,n);o&&(r[a]=o)}k(r,t)},pe=(e,t,n)=>{let r=e.tracker.id,i=Od(Dd(e,A.total),p[r]);de(r,t);let a=Nd(e,t,{...i,...t});a&&k({[r]:a},n,!0)},me=e=>{let t=T.state(e.tracker.id);return t.failed?.fields.remove&&e.state===`NOT_LISTED`?{...t,failed:void 0}:!t.failed&&re.includes(e)&&!Cd(e)?{...t,failed:{fields:te[e.tracker.id],error:wd(e)}}:t},he=e=>{u({...l,expanded:!0}),S(e)},ge=(e,t)=>{t||T.drop(e),!t&&!T.state(e).busy&&E.current.delete(e),u({...l,targets:{...l.targets,[e]:t}})},_e=e=>{let t=c[e.tracker.id],n=e.tracker.id;if(!t||_.has(n))return;let r=t();v(e=>new Set(e).add(n)),b(({[n]:e,...t})=>t),r.then(t=>gH[t]?.(e.tracker.name),e=>e instanceof Error?e.message:String(e)).then(e=>{e&&b(t=>({...t,[n]:e})),v(e=>{let t=new Set(e);return t.delete(n),t})})},ve=(e,t)=>d.formatMessage({id:`{name} cannot track this media: {reason}`,defaultMessage:`{name} cannot track this media: {reason}`},{name:e,reason:cn(t)}),ye=d.formatMessage({id:`Trackers loading`,defaultMessage:`Trackers loading`}),be=({name:e,outcome:t,fields:n,error:r})=>OH({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:cn(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}),xe=(e,t)=>/* @__PURE__ */ L(`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]||_.has(e.tracker.id),onClick:()=>_e(e),children:_.has(e.tracker.id)?d.formatMessage({id:`Logging in`,defaultMessage:`Logging in`}):d.formatMessage({id:`Log in`,defaultMessage:`Log in`})}),Se=(e,t)=>{let r=e.tracker.id,i=e.tracker.name,a=/* @__PURE__ */ V(`div`,{className:`head`,children:[/* @__PURE__ */ L(wH,{answer:e}),i,e.tracker.account?/* @__PURE__ */ L(`span`,{className:`account`,children:cn(e.tracker.account)}):void 0]});if(t.kind===`loading`)return a;if(t.kind===`login`)return/* @__PURE__ */ V(W,{children:[a,/* @__PURE__ */ L(`span`,{className:`why`,children:d.formatMessage({id:`Signed out`,defaultMessage:`Signed out`})}),xe(e)]});if(t.kind===`cannot`)return/* @__PURE__ */ V(W,{children:[a,/* @__PURE__ */ L(`span`,{className:`why`,children:ve(i,t.reason)})]});let o=Cd(e),s=Dd(e,A.total),c=Rd([e.tracker.scoreScale]);return/* @__PURE__ */ V(W,{children:[a,/* @__PURE__ */ L(AH,{name:`card-${r}`,movie:n,statuses:e.tracker.statuses,clearable:e.tracker.canClearScore!==!1,shown:Od(s,p[r]),scale:c.scale,mixed:!1,disabled:!o,listed:e.state===`LISTED`,removable:o&&Md(e),onChange:(t,n)=>pe(e,t,n)}),o?void 0:/* @__PURE__ */ L(`span`,{className:`why`,children:cn(wd(e))})]})},Ce=e=>d.formatList(ie.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})}),nn),we=(e,t)=>A.differs.includes(e)?/* @__PURE__ */ L(`span`,{className:`differs`,"data-differs":e,title:Ce(t)}):void 0;return/* @__PURE__ */ V(`section`,{css:yH,className:`tracking-compact`,"aria-label":d.formatMessage({id:`Quick tracking`,defaultMessage:`Quick tracking`}),children:[/* @__PURE__ */ V(`div`,{className:`row`,children:[/* @__PURE__ */ V(`div`,{className:`group platforms${P?` expanded`:``}`,children:[/* @__PURE__ */ L(`button`,{type:`button`,className:`expand`,"aria-expanded":P,"aria-label":P?d.formatMessage({id:`Trackers`,defaultMessage:`Trackers`}):void 0,title:P?d.formatMessage({id:`Collapse trackers`,defaultMessage:`Collapse trackers`}):void 0,onClick:()=>u({...l,expanded:!P}),children:P?/* @__PURE__ */ L(Ab,{size:14,"aria-hidden":`true`}):/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`span`,{className:`tiles`,children:e===void 0?/* @__PURE__ */ L(`span`,{className:`tile loading`,role:`img`,"aria-label":ye,title:ye,children:/* @__PURE__ */ L(Ub,{size:12,className:`spin`,"aria-hidden":`true`})}):N.map(({answer:e,target:t})=>/* @__PURE__ */ L(DH,{answer:e,state:EH(e,t,me(e))},e.tracker.id))}),/* @__PURE__ */ L(kb,{size:12,"aria-hidden":`true`})]})}),P&&e===void 0?/* @__PURE__ */ L(`span`,{className:`chip loading`,children:/* @__PURE__ */ L(`span`,{className:`slot`,role:`img`,"aria-label":ye,children:/* @__PURE__ */ L(Ub,{size:14,className:`spin`,"aria-hidden":`true`})})}):void 0,P&&N.map(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name,i={answer:e,open:x===n,onOpen:e=>S(t=>e?n:t===n?void 0:t),card:()=>Se(e,t)};if(t.kind===`loading`)return/* @__PURE__ */ L(jH,{...i,className:`chip loading`,busy:!0,children:/* @__PURE__ */ L(`span`,{className:`slot`,role:`img`,"aria-label":d.formatMessage({id:`{name} loading`,defaultMessage:`{name} loading`},{name:r}),children:/* @__PURE__ */ L(Ub,{size:14,className:`spin`,"aria-hidden":`true`})})},n);if(t.kind===`login`)return/* @__PURE__ */ L(jH,{...i,className:`chip login`,children:xe(e,`login-button`)},n);if(t.kind===`cannot`)return/* @__PURE__ */ L(jH,{...i,className:`chip cannot`,children:/* @__PURE__ */ L(`span`,{className:`slot`,role:`img`,"aria-label":ve(r,t.reason),children:/* @__PURE__ */ L(qb,{size:14,"aria-hidden":`true`})})},n);let{busy:a,failed:o}=me(e),s=TH(e);return/* @__PURE__ */ V(jH,{...i,className:`chip${t.checked?``:` off`}`,busy:a,children:[/* @__PURE__ */ V(`label`,{children:[/* @__PURE__ */ L(`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=>ge(n,e.currentTarget.checked)}),/* @__PURE__ */ L(`span`,{className:`slot`,children:a?/* @__PURE__ */ L(Ub,{size:14,className:`spin`,"aria-hidden":`true`}):t.checked?/* @__PURE__ */ L(`span`,{className:`check`,children:/* @__PURE__ */ L(Tt,{size:11,"aria-hidden":`true`})}):/* @__PURE__ */ L(`span`,{className:`ring`})})]}),/* @__PURE__ */ L(kH,{answer:e,failed:o}),s?/* @__PURE__ */ L(`span`,{id:`compact-hint-${n}`,className:`sr-only`,children:s}):void 0]},n)}),!oe&&le?/* @__PURE__ */ L(`button`,{type:`button`,className:`sync-all`,onClick:ue,children:d.formatMessage({id:`Sync all`,defaultMessage:`Sync all`})}):void 0]}),/* @__PURE__ */ L(AH,{name:`compact`,movie:n,shown:ee,scale:se?.scale??`POINT_100`,mixed:se?.mixed??!1,disabled:oe,listed:ie.some(e=>e.state===`LISTED`),removable:ae.some(Md),onChange:fe,dots:{SCORE:we(`SCORE`,e=>hd(e.entry?.score)?xH(d,e.entry.score,e.tracker.scoreScale):void 0),STATUS:we(`STATUS`,e=>e.entry?.status?vH(d,e.entry.status):void 0),PROGRESS:we(`PROGRESS`,e=>e.entry?.progress==null?void 0:String(e.entry.progress))}})]}),/* @__PURE__ */ L(`div`,{className:`notes`,children:N.flatMap(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name;return[y[n]&&e.state===`SIGNED_OUT`?/* @__PURE__ */ V(`div`,{className:`note`,"data-note":n,children:[cn(y[n]),P?void 0:xe(e)]},`${n}-sign-in`):void 0,/* @__PURE__ */ L(lH,{answer:e,state:me(e),queue:T},`${n}-problems`),t.kind===`check`&&t.sendable&&jd(e,A.total)?/* @__PURE__ */ V(`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}),P?void 0:/* @__PURE__ */ L(`button`,{type:`button`,"aria-haspopup":`dialog`,onClick:()=>he(n),children:d.formatMessage({id:`Open`,defaultMessage:`Open`})})]},`${n}-count`):void 0].filter(Boolean)})}),/* @__PURE__ */ L(`div`,{className:`sr-only`,role:`status`,children:h?be(h):``})]})};H();var NH=vC(`
3614
+ `,AH={POINT_3:3,POINT_5:5,POINT_10:10,POINT_10_DECIMAL:10},jH=(e,t,n)=>{let r=n??`POINT_100`;return e.formatMessage({id:`{score, number} / {max, number}`,defaultMessage:`{score, number} / {max, number}`},{score:gd(t,r),max:AH[r]??100})},MH=`REMOVE`,NH=``,PH=({answer:e})=>/* @__PURE__ */ L(`span`,{className:`logo`,style:e.tracker.color?{color:e.tracker.color}:void 0,children:e.tracker.icon?/* @__PURE__ */ L(`img`,{src:e.tracker.icon,alt:``}):e.tracker.name.slice(0,1)}),FH=e=>e.state===`PAUSED`||e.state===`ERROR`?cn(wd(e)):void 0,IH=(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,LH=({answer:e,state:t})=>{let n=F().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__ */ V(`span`,{className:`tile ${t}`,"data-tile":e.tracker.id,role:`img`,"aria-label":n,title:n,children:[/* @__PURE__ */ L(PH,{answer:e}),/* @__PURE__ */ L(`span`,{className:`mark`,children:t===`loading`||t===`busy`?/* @__PURE__ */ L(Ub,{size:10,className:`spin`,"aria-hidden":`true`}):void 0})]})},RH=({outcome:e})=>e===`SAVED`||e===`QUEUED`,zH=({answer:e,failed:t})=>t||e.state===`ERROR`?/* @__PURE__ */ L(`span`,{className:`badge red`,"data-badge":`red`}):e.state===`PAUSED`?/* @__PURE__ */ L(`span`,{className:`badge amber`,"data-badge":`amber`}):null,BH=({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=F(),[p,m]=z(),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__ */ V(`div`,{className:`group edit`,children:[/* @__PURE__ */ L(TH,{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__ */ V(`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===MH?{remove:!0}:{status:t},!0)},children:[t.status?void 0:/* @__PURE__ */ L(`option`,{value:``,disabled:!0,children:f.formatMessage({id:`Add to list`,defaultMessage:`Add to list`})}),yd.filter(e=>!u||u.includes(e)).map(e=>/* @__PURE__ */ L(`option`,{value:e,children:OH(f,e)},e)),o?/* @__PURE__ */ L(`option`,{value:MH,children:f.formatMessage({id:`Remove from list`,defaultMessage:`Remove from list`})}):void 0]}),c.STATUS,l?/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`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__ */ L(Tt,{size:14,"aria-hidden":`true`}),f.formatMessage({id:`Watched#marked as seen`,defaultMessage:`Watched`,description:`marked as seen`})]}),c.PROGRESS]}):/* @__PURE__ */ V(`span`,{className:`progress-field`,children:[/* @__PURE__ */ L(`label`,{for:`${e}-progress`,className:`word`,children:f.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),/* @__PURE__ */ L(`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__ */ L(`span`,{className:`of`,children:f.formatMessage({id:`/ {total}`,defaultMessage:`/ {total}`},{total:_})}):void 0,c.PROGRESS,/* @__PURE__ */ L(`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__ */ L(Yb,{size:14,"aria-hidden":`true`})})]}),!l&&!i&&_&&t.progress===_&&t.status!==`COMPLETED`&&(!u||u.includes(`COMPLETED`))?/* @__PURE__ */ L(`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__ */ L(`button`,{type:`button`,onClick:()=>s({progress:_},!0),children:f.formatMessage({id:`Set {total} / {total}`,defaultMessage:`Set {total} / {total}`},{total:_})}):void 0]})},VH=({answer:e,className:t,busy:n,open:r,onOpen:i,card:a,children:o})=>{let s=G(null);K(()=>{r&&s.current?.focus()},[]);let{refs:c,floatingStyles:l,context:u}=Yy({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:Ae,middleware:[Ev(8),Ov({padding:8}),Dv({padding:8})]}),{getReferenceProps:d}=$y([Uy(u)]),{getReferenceProps:f,getFloatingProps:p}=$y([ny(u,{mouseOnly:!0,delay:{open:100},handleClose:ub()}),Zy(u),qy(u)]),m=F().formatMessage({id:`{name} entry`,defaultMessage:`{name} entry`},{name:e.tracker.name});return/* @__PURE__ */ V(`span`,{ref:c.setReference,className:t,"data-chip":e.tracker.id,"aria-busy":n?`true`:void 0,...f(),children:[/* @__PURE__ */ L(`button`,{ref:s,type:`button`,className:`logo-button`,"aria-label":m,"aria-haspopup":`dialog`,"aria-expanded":r,...d(),children:/* @__PURE__ */ L(PH,{answer:e})}),o,r?/* @__PURE__ */ L(`div`,{ref:c.setFloating,style:l,className:`card`,role:`dialog`,"aria-label":m,"data-card":e.tracker.id,...p(),children:a()}):void 0]})},HH=({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=F(),[,f]=z(0),[p,m]=z({}),[h,g]=z(),[_,v]=z(/* @__PURE__ */ new Set),[y,b]=z({}),[x,S]=z(),C=G({onSaveFields:a,onRemove:o,onActivity:s,tracking:e,episodeCount:t});C.current={onSaveFields:a,onRemove:o,onActivity:s,tracking:e,episodeCount:t};let w=G(void 0),T=B(()=>Vd({send:async(e,t)=>{let n=await(t.remove?C.current.onRemove([e]):C.current.onSaveFields([e],t));return n.find(t=>t.tracker===e)??n[0]??{outcome:`FAILED`,error:mc.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}=C.current,i=n?.answers.find(t=>t.tracker.id===e);return i&&Nd(i,t,{...Td(n,r),...t})},steps:e=>Id(C.current.tracking,e),onChange:e=>{if(f(e=>e+1),!e)return;let t=C.current.tracking?.answers.find(t=>t.tracker.id===e.tracker)?.tracker.name??e.tracker;if(g({...e,name:t}),RH(e)&&w.current){let t=bd(w.current.from,w.current.to);(!t||xd(e.fields,t))&&(w.current=void 0,t&&C.current.onActivity?.(t))}!RH(e)&&T.idle()&&m({})}}),[]),E=G(/* @__PURE__ */ new Map),D=G(/* @__PURE__ */ new Map),O=i??D.current,k=(e,t,n)=>{for(let[t,{progress:n}]of Object.entries(e))n!==void 0&&E.current.set(t,n);T.stage(e,t,n)};K(()=>{let e=()=>{document.visibilityState===`hidden`&&T.flush()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),T.flush()}},[]);let A=Td(e,t),j=t=>{let n=e?.answers.find(e=>e.tracker.id===t);return n&&Dd(n,A.total)};K(()=>{m(e=>T.idle()?{}:Object.fromEntries(Object.entries(e).flatMap(([e,t])=>{let n=e===NH?A:j(e);return n?[[e,kd(t,n)]]:[]})))},[e]);let ee=Od(A,p[NH]),M=e=>{w.current={from:w.current?.from??ee,to:e}},te=r&&e&&ee.status!==`COMPLETED`?Ud({...r,movie:n},e,l.targets,t):{},ne=e=>O.has(e)&&O.get(e)===r?.episode,re=e?.answers.filter(({tracker:{id:e}})=>te[e]&&!ne(e)&&te[e].progress>(E.current.get(e)??0))??[];K(()=>{let t=re.filter(Cd);if(r&&e&&r.played>=.85)for(let t of e.answers){let e=Ad(t,l.targets[t.tracker.id]);e.kind===`check`&&e.sendable&&O.set(t.tracker.id,r.episode)}t.length&&(M({...ee,...te[t[0].tracker.id]}),k(Object.fromEntries(t.map(({tracker:{id:e}})=>[e,te[e]])),!0))},[r,e,l]);let ie=e?.answers.filter(e=>e.state!==`NO_ID`)??[];if(e!==void 0&&!ie.length)return null;let N=ie.map(e=>({answer:e,target:Ad(e,l.targets[e.tracker.id])})),P=l.expanded===!0,ae=N.filter(({target:e})=>e.kind===`check`&&e.sendable).map(({answer:e})=>e),oe=!ae.length,se=Rd(ae.map(e=>e.tracker.scoreScale)),ce=ie.length>1&&T.idle()?Fd(N,A,se?.scale):{},le=Object.keys(ce).length>0,ue=()=>{le&&(M(A),k(ce,!0))},de=(e,t)=>{t.remove||m(n=>({...n,[e]:{...n[e],...t}}))},fe=(e,t)=>{de(NH,e);let n={...ee,...e};M(n);let r={};for(let{answer:t,target:i}of N){if(i.kind!==`check`||!i.checked)continue;let a=t.tracker.id;if(!Cd(t)){T.fail(a,e,wd(t));continue}let o=Nd(t,e,n);o&&(r[a]=o)}k(r,t)},pe=(e,t,n)=>{let r=e.tracker.id,i=Od(Dd(e,A.total),p[r]);de(r,t);let a=Nd(e,t,{...i,...t});a&&k({[r]:a},n,!0)},me=e=>{let t=T.state(e.tracker.id);return t.failed?.fields.remove&&e.state===`NOT_LISTED`?{...t,failed:void 0}:!t.failed&&re.includes(e)&&!Cd(e)?{...t,failed:{fields:te[e.tracker.id],error:wd(e)}}:t},he=e=>{u({...l,expanded:!0}),S(e)},ge=(e,t)=>{t||T.drop(e),!t&&!T.state(e).busy&&E.current.delete(e),u({...l,targets:{...l.targets,[e]:t}})},_e=e=>{let t=c[e.tracker.id],n=e.tracker.id;if(!t||_.has(n))return;let r=t();v(e=>new Set(e).add(n)),b(({[n]:e,...t})=>t),r.then(t=>EH[t]?.(e.tracker.name),e=>e instanceof Error?e.message:String(e)).then(e=>{e&&b(t=>({...t,[n]:e})),v(e=>{let t=new Set(e);return t.delete(n),t})})},ve=(e,t)=>d.formatMessage({id:`{name} cannot track this media: {reason}`,defaultMessage:`{name} cannot track this media: {reason}`},{name:e,reason:cn(t)}),ye=d.formatMessage({id:`Trackers loading`,defaultMessage:`Trackers loading`}),be=({name:e,outcome:t,fields:n,error:r})=>RH({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:cn(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}),xe=(e,t)=>/* @__PURE__ */ L(`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]||_.has(e.tracker.id),onClick:()=>_e(e),children:_.has(e.tracker.id)?d.formatMessage({id:`Logging in`,defaultMessage:`Logging in`}):d.formatMessage({id:`Log in`,defaultMessage:`Log in`})}),Se=(e,t)=>{let r=e.tracker.id,i=e.tracker.name,a=/* @__PURE__ */ V(`div`,{className:`head`,children:[/* @__PURE__ */ L(PH,{answer:e}),i,e.tracker.account?/* @__PURE__ */ L(`span`,{className:`account`,children:cn(e.tracker.account)}):void 0]});if(t.kind===`loading`)return a;if(t.kind===`login`)return/* @__PURE__ */ V(W,{children:[a,/* @__PURE__ */ L(`span`,{className:`why`,children:d.formatMessage({id:`Signed out`,defaultMessage:`Signed out`})}),xe(e)]});if(t.kind===`cannot`)return/* @__PURE__ */ V(W,{children:[a,/* @__PURE__ */ L(`span`,{className:`why`,children:ve(i,t.reason)})]});let o=Cd(e),s=Dd(e,A.total),c=Rd([e.tracker.scoreScale]);return/* @__PURE__ */ V(W,{children:[a,/* @__PURE__ */ L(BH,{name:`card-${r}`,movie:n,statuses:e.tracker.statuses,clearable:e.tracker.canClearScore!==!1,shown:Od(s,p[r]),scale:c.scale,mixed:!1,disabled:!o,listed:e.state===`LISTED`,removable:o&&Md(e),onChange:(t,n)=>pe(e,t,n)}),o?void 0:/* @__PURE__ */ L(`span`,{className:`why`,children:cn(wd(e))})]})},Ce=e=>d.formatList(ie.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})}),nn),we=(e,t)=>A.differs.includes(e)?/* @__PURE__ */ L(`span`,{className:`differs`,"data-differs":e,title:Ce(t)}):void 0;return/* @__PURE__ */ V(`section`,{css:kH,className:`tracking-compact`,"aria-label":d.formatMessage({id:`Quick tracking`,defaultMessage:`Quick tracking`}),children:[/* @__PURE__ */ V(`div`,{className:`row`,children:[/* @__PURE__ */ V(`div`,{className:`group platforms${P?` expanded`:``}`,children:[/* @__PURE__ */ L(`button`,{type:`button`,className:`expand`,"aria-expanded":P,"aria-label":P?d.formatMessage({id:`Trackers`,defaultMessage:`Trackers`}):void 0,title:P?d.formatMessage({id:`Collapse trackers`,defaultMessage:`Collapse trackers`}):void 0,onClick:()=>u({...l,expanded:!P}),children:P?/* @__PURE__ */ L(Ab,{size:14,"aria-hidden":`true`}):/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`span`,{className:`tiles`,children:e===void 0?/* @__PURE__ */ L(`span`,{className:`tile loading`,role:`img`,"aria-label":ye,title:ye,children:/* @__PURE__ */ L(Ub,{size:12,className:`spin`,"aria-hidden":`true`})}):N.map(({answer:e,target:t})=>/* @__PURE__ */ L(LH,{answer:e,state:IH(e,t,me(e))},e.tracker.id))}),/* @__PURE__ */ L(kb,{size:12,"aria-hidden":`true`})]})}),P&&e===void 0?/* @__PURE__ */ L(`span`,{className:`chip loading`,children:/* @__PURE__ */ L(`span`,{className:`slot`,role:`img`,"aria-label":ye,children:/* @__PURE__ */ L(Ub,{size:14,className:`spin`,"aria-hidden":`true`})})}):void 0,P&&N.map(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name,i={answer:e,open:x===n,onOpen:e=>S(t=>e?n:t===n?void 0:t),card:()=>Se(e,t)};if(t.kind===`loading`)return/* @__PURE__ */ L(VH,{...i,className:`chip loading`,busy:!0,children:/* @__PURE__ */ L(`span`,{className:`slot`,role:`img`,"aria-label":d.formatMessage({id:`{name} loading`,defaultMessage:`{name} loading`},{name:r}),children:/* @__PURE__ */ L(Ub,{size:14,className:`spin`,"aria-hidden":`true`})})},n);if(t.kind===`login`)return/* @__PURE__ */ L(VH,{...i,className:`chip login`,children:xe(e,`login-button`)},n);if(t.kind===`cannot`)return/* @__PURE__ */ L(VH,{...i,className:`chip cannot`,children:/* @__PURE__ */ L(`span`,{className:`slot`,role:`img`,"aria-label":ve(r,t.reason),children:/* @__PURE__ */ L(qb,{size:14,"aria-hidden":`true`})})},n);let{busy:a,failed:o}=me(e),s=FH(e);return/* @__PURE__ */ V(VH,{...i,className:`chip${t.checked?``:` off`}`,busy:a,children:[/* @__PURE__ */ V(`label`,{children:[/* @__PURE__ */ L(`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=>ge(n,e.currentTarget.checked)}),/* @__PURE__ */ L(`span`,{className:`slot`,children:a?/* @__PURE__ */ L(Ub,{size:14,className:`spin`,"aria-hidden":`true`}):t.checked?/* @__PURE__ */ L(`span`,{className:`check`,children:/* @__PURE__ */ L(Tt,{size:11,"aria-hidden":`true`})}):/* @__PURE__ */ L(`span`,{className:`ring`})})]}),/* @__PURE__ */ L(zH,{answer:e,failed:o}),s?/* @__PURE__ */ L(`span`,{id:`compact-hint-${n}`,className:`sr-only`,children:s}):void 0]},n)}),!oe&&le?/* @__PURE__ */ L(`button`,{type:`button`,className:`sync-all`,onClick:ue,children:d.formatMessage({id:`Sync all`,defaultMessage:`Sync all`})}):void 0]}),/* @__PURE__ */ L(BH,{name:`compact`,movie:n,shown:ee,scale:se?.scale??`POINT_100`,mixed:se?.mixed??!1,disabled:oe,listed:ie.some(e=>e.state===`LISTED`),removable:ae.some(Md),onChange:fe,dots:{SCORE:we(`SCORE`,e=>hd(e.entry?.score)?jH(d,e.entry.score,e.tracker.scoreScale):void 0),STATUS:we(`STATUS`,e=>e.entry?.status?OH(d,e.entry.status):void 0),PROGRESS:we(`PROGRESS`,e=>e.entry?.progress==null?void 0:String(e.entry.progress))}})]}),/* @__PURE__ */ L(`div`,{className:`notes`,children:N.flatMap(({answer:e,target:t})=>{let n=e.tracker.id,r=e.tracker.name;return[y[n]&&e.state===`SIGNED_OUT`?/* @__PURE__ */ V(`div`,{className:`note`,"data-note":n,children:[cn(y[n]),P?void 0:xe(e)]},`${n}-sign-in`):void 0,/* @__PURE__ */ L(yH,{answer:e,state:me(e),queue:T},`${n}-problems`),t.kind===`check`&&t.sendable&&jd(e,A.total)?/* @__PURE__ */ V(`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}),P?void 0:/* @__PURE__ */ L(`button`,{type:`button`,"aria-haspopup":`dialog`,onClick:()=>he(n),children:d.formatMessage({id:`Open`,defaultMessage:`Open`})})]},`${n}-count`):void 0].filter(Boolean)})}),/* @__PURE__ */ L(`div`,{className:`sr-only`,role:`status`,children:h?be(h):``})]})};H();var UH=vC(`
3578
3615
  mutation DeleteListEntry($input: DeleteListEntryInput!) {
3579
3616
  deleteListEntry(input: $input) {
3580
3617
  tracker
@@ -3582,7 +3619,7 @@ overflow-wrap: anywhere;
3582
3619
  error
3583
3620
  }
3584
3621
  }
3585
- `),PH=vC(`
3622
+ `),WH=vC(`
3586
3623
  subscription StubTrackerStorage {
3587
3624
  stubTrackerStorage {
3588
3625
  location
@@ -3593,7 +3630,7 @@ overflow-wrap: anywhere;
3593
3630
  error
3594
3631
  }
3595
3632
  }
3596
- `),FH=vC(`
3633
+ `),GH=vC(`
3597
3634
  mutation AddHeldStubEntries {
3598
3635
  addHeldStubEntries {
3599
3636
  location
@@ -3604,7 +3641,7 @@ overflow-wrap: anywhere;
3604
3641
  error
3605
3642
  }
3606
3643
  }
3607
- `),IH=e=>[{tracker:``,outcome:`FAILED`,error:e??mc.formatMessage({id:`The write did not reach the trackers`,defaultMessage:`The write did not reach the trackers`})}],LH=e=>e.state===`LOADING`,RH=e=>!LH(e)&&e.state!==`NO_ID`,zH=(e,t)=>e&&t?.answers.some(t=>LH(t)&&e.answers.some(e=>e.tracker.id===t.tracker.id&&RH(e)))?e:t??void 0,BH=e=>e.state===Ec.Ambiguous,VH=(e,t)=>e&&e._id!==iH(t)&&e.answers.some(BH)?{...e,answers:e.answers.map(e=>BH(e)?{...e,state:Ec.Loading}:e)}:e,HH=e=>e&&{...e,summary:null,disagreements:[],answers:e.answers.map(e=>e.state===Ec.NoId?e:{...e,state:Ec.Loading,entry:null})},UH=(e,t)=>{let[n,r]=z({episode:t,played:0});return K(()=>{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},WH=({work:e,address:t,uri:n,title:r,cover:i,episodeCount:a,movie:o,prefsStore:s=od,notice:c=!0,link:l,episode:u,sameWork:d,counted:f})=>{let p=F(),m=n??e,[{data:h}]=Rs({query:Bw,variables:{input:{uri:m}},pause:!m}),g=B(()=>VH(h?.tracking,m),[h?.tracking,m]),_=G(void 0);_.current=zH(VH(_.current,m),g);let v=!!(n&&Iw(e,t)),y=Hw({uri:n,title:r,cover:i,episodeCount:a,type:o?wc.Movie:void 0}),[,b]=Is(NH),[{data:x}]=Rs({query:PH,pause:!c}),[,S]=Is(FH),[C,w]=z(s.read),[T]=z(d?void 0:l),E=UH(l===T?void 0:l,u),D=h?.tracking?.answers;return K(()=>{D&&Te(D,Ce,Xn)},[D]),K(()=>sd(()=>w(s.read())),[s]),/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(MH,{tracking:v?_.current:HH(_.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??IH(t.error?.message)},onActivity:({kind:e,episode:t})=>{n&&rH({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__ */ L(oH,{storage:x?.stubTrackerStorage,onUnlock:async()=>{await Jl()&&await Un()},onAdd:()=>S({})})]})},GH=e=>{let t=Uw(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||Iw(r,e.work)||Iw(i,e.work);return n.current={work:e.work,uri:e.uri,counted:o?a:/* @__PURE__ */ new Map},/* @__PURE__ */ L(WH,{...e,sameWork:o,counted:n.current.counted},`${e.work} ${t}`)};H();var KH=({label:e,labelledBy:t,onClose:n,children:r,...i})=>{let{refs:a,context:o,elements:s}=Yy({open:!0,onOpenChange:(e,t)=>{t?.target===a.reference.current&&n()}}),c=G(n);c.current=n,K(()=>{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}=$y([Uy(o,{keyboardHandlers:!1})]),{onKeyDown:d,onKeyUp:f,...p}=l();return/* @__PURE__ */ L(Cy,{children:/* @__PURE__ */ L(zy,{lockScroll:!0,...i,ref:a.setReference,...p,children:/* @__PURE__ */ L(Py,{context:o,initialFocus:a.floating,children:/* @__PURE__ */ L(`div`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-label":e,"aria-labelledby":t,tabIndex:-1,ref:a.setFloating,...u(),children:r})})})})},qH=I`
3644
+ `),KH=e=>[{tracker:``,outcome:`FAILED`,error:e??mc.formatMessage({id:`The write did not reach the trackers`,defaultMessage:`The write did not reach the trackers`})}],qH=e=>e.state===`LOADING`,JH=e=>!qH(e)&&e.state!==`NO_ID`,YH=(e,t)=>e&&t?.answers.some(t=>qH(t)&&e.answers.some(e=>e.tracker.id===t.tracker.id&&JH(e)))?e:t??void 0,XH=e=>e.state===Ec.Ambiguous,ZH=(e,t)=>e&&e._id!==mH(t)&&e.answers.some(XH)?{...e,answers:e.answers.map(e=>XH(e)?{...e,state:Ec.Loading}:e)}:e,QH=e=>e&&{...e,summary:null,disagreements:[],answers:e.answers.map(e=>e.state===Ec.NoId?e:{...e,state:Ec.Loading,entry:null})},$H=(e,t)=>{let[n,r]=z({episode:t,played:0});return K(()=>{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},eU=({work:e,address:t,uri:n,title:r,cover:i,episodeCount:a,movie:o,prefsStore:s=od,notice:c=!0,link:l,episode:u,sameWork:d,counted:f})=>{let p=F(),m=n??e,[{data:h}]=Rs({query:Bw,variables:{input:{uri:m}},pause:!m}),g=B(()=>ZH(h?.tracking,m),[h?.tracking,m]),_=G(void 0);_.current=YH(ZH(_.current,m),g);let v=!!(n&&Iw(e,t)),y=Hw({uri:n,title:r,cover:i,episodeCount:a,type:o?wc.Movie:void 0}),[,b]=Is(UH),[{data:x}]=Rs({query:WH,pause:!c}),[,S]=Is(GH),[C,w]=z(s.read),[T]=z(d?void 0:l),E=$H(l===T?void 0:l,u),D=h?.tracking?.answers;return K(()=>{D&&Te(D,Ce,Xn)},[D]),K(()=>sd(()=>w(s.read())),[s]),/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(HH,{tracking:v?_.current:QH(_.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??KH(t.error?.message)},onActivity:({kind:e,episode:t})=>{n&&pH({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__ */ L(gH,{storage:x?.stubTrackerStorage,onUnlock:async()=>{await Jl()&&await Un()},onAdd:()=>S({})})]})},tU=e=>{let t=Uw(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||Iw(r,e.work)||Iw(i,e.work);return n.current={work:e.work,uri:e.uri,counted:o?a:/* @__PURE__ */ new Map},/* @__PURE__ */ L(eU,{...e,sameWork:o,counted:n.current.counted},`${e.work} ${t}`)};H();var nU=({label:e,labelledBy:t,onClose:n,children:r,...i})=>{let{refs:a,context:o,elements:s}=Yy({open:!0,onOpenChange:(e,t)=>{t?.target===a.reference.current&&n()}}),c=G(n);c.current=n,K(()=>{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}=$y([Uy(o,{keyboardHandlers:!1})]),{onKeyDown:d,onKeyUp:f,...p}=l();return/* @__PURE__ */ L(Cy,{children:/* @__PURE__ */ L(zy,{lockScroll:!0,...i,ref:a.setReference,...p,children:/* @__PURE__ */ L(Py,{context:o,initialFocus:a.floating,children:/* @__PURE__ */ L(`div`,{className:`modal`,role:`dialog`,"aria-modal":`true`,"aria-label":e,"aria-labelledby":t,tabIndex:-1,ref:a.setFloating,...u(),children:r})})})})},rU=I`
3608
3645
  font-size: 1.2rem;
3609
3646
  padding: 0.15rem 0.6rem;
3610
3647
  border: 1px solid rgba(255, 255, 255, 0.25);
@@ -3612,9 +3649,9 @@ overflow-wrap: anywhere;
3612
3649
  white-space: nowrap;
3613
3650
 
3614
3651
  &:hover { border-color: rgba(255, 255, 255, 0.5); }
3615
- `,JH=({uri:e})=>{let t=KD(Sh());return!e||!Mn(`?${t}`,`http://d/`)?null:/* @__PURE__ */ L(kh,{css:qH,"data-trace-link":e,href:BD({uri:e,search:t}),title:`what the graph holds for this uri`,children:`graph trace`})},YH={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`},XH=e=>YH[e]?`https://images.justwatch.com/icon/${YH[e]}.webp`:void 0;H();var ZH=3,QH=({episode:e,mediaUri:t,sources:n,settled:r,startDate:i,status:a},o)=>{let{released:s,upcoming:c}=yT({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&&OT(n.origin,n.url,`extension`)))?Gh(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}},$H=e=>{try{return new URL(e??``).hostname.replace(/^www\./,``)}catch{return}},eU=({source:e})=>{let t=XH(e.id),n=[t,e.icon].filter(e=>!!e),[r,i]=z(0),a=n[r];return/* @__PURE__ */ L(`span`,{className:t&&a===t?`logo sharp`:`logo`,children:a?/* @__PURE__ */ L(`img`,{src:a,alt:``,onError:()=>i(r+1)}):e.name.charAt(0)})},tU=(e,t)=>e?.handles?.flatMap(({relation:e,node:n})=>e===`SAME_AS`&&n.origin===t?n.thumbnails??[]:[]),nU=({source:e,pictures:t})=>{let n=F(),[r,i]=z(/* @__PURE__ */ new Set),a=_w(t,r),o=/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`span`,{className:a?`picture`:`picture logo-led`,children:[a?/* @__PURE__ */ L(`img`,{className:`still`,src:a,alt:``,loading:`lazy`,onError:()=>i(e=>new Set(e).add(a))}):void 0,/* @__PURE__ */ L(eU,{source:e}),/* @__PURE__ */ L(`span`,{className:`mark`,"aria-hidden":`true`,children:e.external?Dw.external:Dw.play})]}),/* @__PURE__ */ V(`span`,{className:`body`,children:[/* @__PURE__ */ V(`span`,{className:`head`,children:[/* @__PURE__ */ L(`span`,{className:`name`,children:e.name}),e.releases&&e.releases.length>1?/* @__PURE__ */ L(`span`,{className:`count`,children:e.releases.length}):void 0]}),/* @__PURE__ */ L(`span`,{className:`how`,children:e.external?$H(e.href):n.formatMessage({id:`Plays here`,defaultMessage:`Plays here`})})]})]}),s={title:e.name,style:{"--brand":Sw(e)}};return e.external||!e.href?/* @__PURE__ */ L(`a`,{className:`source`,href:e.href,target:`_blank`,rel:`noreferrer`,...s,children:o}):/* @__PURE__ */ L(kh,{className:`source plays`,href:e.href,...s,children:o})},rU=({children:e,...t})=>{let n=F(),r=wT(),{released:i,upcoming:a,play:o,none:s,announced:c,holding:l}=QH(t,r),u=!o&&l&&(s||t.sources.some(e=>e.external&&OT(e.id,e.href,`extension`))),d=a?nT(i,new Date(r)):void 0;return/* @__PURE__ */ V(`div`,{className:`movie`,children:[d?/* @__PURE__ */ V(`div`,{className:`release`,children:[/* @__PURE__ */ L(`span`,{className:d.partial?`day partial`:`day`,children:d.day}),/* @__PURE__ */ L(`span`,{className:`date`,children:d.date}),d.count?/* @__PURE__ */ L(`span`,{className:`count`,children:d.count}):void 0]}):c?/* @__PURE__ */ V(`div`,{className:`release`,children:[/* @__PURE__ */ L(`span`,{className:`day partial`,children:n.formatMessage({id:`Coming soon`,defaultMessage:`Coming soon`})}),/* @__PURE__ */ L(`span`,{className:`date`,children:n.formatMessage({id:`No release date yet`,defaultMessage:`No release date yet`})})]}):void 0,/* @__PURE__ */ V(`div`,{className:`actions`,children:[o?/* @__PURE__ */ V(kh,{className:`play`,href:o,children:[/* @__PURE__ */ L(ft,{size:20,fill:`currentColor`,"aria-hidden":`true`}),n.formatMessage({id:`Play`,defaultMessage:`Play`})]}):u?/* @__PURE__ */ L(LC,{className:`play-pending`}):void 0,e]})]})},iU=e=>{let t=F(),n=Yu(),{none:r,announced:i,holding:a}=QH(e,wT()),o=e.sources.filter(e=>!n.has(e.id)),s=a?Math.max(0,ZH-o.length):0;return o.length||s?/* @__PURE__ */ V(`ul`,{className:`sources`,children:[o.map(t=>/* @__PURE__ */ L(`li`,{children:/* @__PURE__ */ L(nU,{source:t,pictures:tU(e.episode,t.id)})},t.id)),Array.from({length:s},(e,t)=>/* @__PURE__ */ L(`li`,{children:/* @__PURE__ */ L(LC,{className:`source-pending`})},t))]}):r&&e.settled&&!i?/* @__PURE__ */ L(`p`,{className:`none`,children:t.formatMessage({id:`No sources yet`,defaultMessage:`No sources yet`})}):null},aU={sciencefiction:`scifi`},oU=e=>{let t=e.toLowerCase().replace(/[^\p{L}\p{N}]/gu,``);return(aU[t]??t).replace(/(ine|al|s)$/,``)},sU=()=>new Set(oa===`anime`?[`Animation`,`Anime`].map(oU):[]),cU=e=>e.split(/\s*(?:&|\/|\band\b)\s*/i).filter(Boolean).map(oU),lU=(e=[],t=[])=>{let n=sU(),r=new Set(e.map(cU).flatMap(e=>e.length===1?e:[])),i=/* @__PURE__ */ new Set,a=e.filter(e=>{let t=cU(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(cU)]);return{genres:a,tags:t.filter(e=>{let t=!o.has(oU(e));return o.add(oU(e)),t}).slice(0,5)}},uU=e=>xn([Lg(e.type),LT(e,{locale:q.locale}),MT(e)]),dU=(e,t=/* @__PURE__ */ new Date)=>{let n=e.episodes?.at(0),{released:r,upcoming:i}=yT({startDate:e.startDate,status:e.status,episode:n},t);return xn([q.formatMessage({id:`Movie`,defaultMessage:`Movie`}),i?void 0:Zw(r,{locale:q.locale}),tT(n?.runtime??e.duration)])},fU=(e,t,n=/* @__PURE__ */ new Date)=>{let{genres:r,tags:i}=lU(e.genres??[],e.tags??[]);return{genres:r,tags:i,aired:t?void 0:LT(e,{locale:q.locale}),upcoming:!t&&yT({startDate:e.startDate,status:e.status},n).upcoming}},pU=I`
3652
+ `,iU=({uri:e})=>{let t=KD(Sh());return!e||!Mn(`?${t}`,`http://d/`)?null:/* @__PURE__ */ L(kh,{css:rU,"data-trace-link":e,href:BD({uri:e,search:t}),title:`what the graph holds for this uri`,children:`graph trace`})},aU={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=>aU[e]?`https://images.justwatch.com/icon/${aU[e]}.webp`:void 0;H();var sU=3,cU=({episode:e,mediaUri:t,sources:n,settled:r,startDate:i,status:a},o)=>{let{released:s,upcoming:c}=yT({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&&OT(n.origin,n.url,`extension`)))?Gh(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}},lU=e=>{try{return new URL(e??``).hostname.replace(/^www\./,``)}catch{return}},uU=({source:e})=>{let t=oU(e.id),n=[t,e.icon].filter(e=>!!e),[r,i]=z(0),a=n[r];return/* @__PURE__ */ L(`span`,{className:t&&a===t?`logo sharp`:`logo`,children:a?/* @__PURE__ */ L(`img`,{src:a,alt:``,onError:()=>i(r+1)}):e.name.charAt(0)})},dU=(e,t)=>e?.handles?.flatMap(({relation:e,node:n})=>e===`SAME_AS`&&n.origin===t?n.thumbnails??[]:[]),fU=({source:e,pictures:t})=>{let n=F(),[r,i]=z(/* @__PURE__ */ new Set),a=_w(t,r),o=/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`span`,{className:a?`picture`:`picture logo-led`,children:[a?/* @__PURE__ */ L(`img`,{className:`still`,src:a,alt:``,loading:`lazy`,onError:()=>i(e=>new Set(e).add(a))}):void 0,/* @__PURE__ */ L(uU,{source:e}),/* @__PURE__ */ L(`span`,{className:`mark`,"aria-hidden":`true`,children:e.external?Dw.external:Dw.play})]}),/* @__PURE__ */ V(`span`,{className:`body`,children:[/* @__PURE__ */ V(`span`,{className:`head`,children:[/* @__PURE__ */ L(`span`,{className:`name`,children:e.name}),e.releases&&e.releases.length>1?/* @__PURE__ */ L(`span`,{className:`count`,children:e.releases.length}):void 0]}),/* @__PURE__ */ L(`span`,{className:`how`,children:e.external?lU(e.href):n.formatMessage({id:`Plays here`,defaultMessage:`Plays here`})})]})]}),s={title:e.name,style:{"--brand":Sw(e)}};return e.external||!e.href?/* @__PURE__ */ L(`a`,{className:`source`,href:e.href,target:`_blank`,rel:`noreferrer`,...s,children:o}):/* @__PURE__ */ L(kh,{className:`source plays`,href:e.href,...s,children:o})},pU=({children:e,...t})=>{let n=F(),r=wT(),{released:i,upcoming:a,play:o,none:s,announced:c,holding:l}=cU(t,r),u=!o&&l&&(s||t.sources.some(e=>e.external&&OT(e.id,e.href,`extension`))),d=a?nT(i,new Date(r)):void 0;return/* @__PURE__ */ V(`div`,{className:`movie`,children:[d?/* @__PURE__ */ V(`div`,{className:`release`,children:[/* @__PURE__ */ L(`span`,{className:d.partial?`day partial`:`day`,children:d.day}),/* @__PURE__ */ L(`span`,{className:`date`,children:d.date}),d.count?/* @__PURE__ */ L(`span`,{className:`count`,children:d.count}):void 0]}):c?/* @__PURE__ */ V(`div`,{className:`release`,children:[/* @__PURE__ */ L(`span`,{className:`day partial`,children:n.formatMessage({id:`Coming soon`,defaultMessage:`Coming soon`})}),/* @__PURE__ */ L(`span`,{className:`date`,children:n.formatMessage({id:`No release date yet`,defaultMessage:`No release date yet`})})]}):void 0,/* @__PURE__ */ V(`div`,{className:`actions`,children:[o?/* @__PURE__ */ V(kh,{className:`play`,href:o,children:[/* @__PURE__ */ L(ft,{size:20,fill:`currentColor`,"aria-hidden":`true`}),n.formatMessage({id:`Play`,defaultMessage:`Play`})]}):u?/* @__PURE__ */ L(LC,{className:`play-pending`}):void 0,e]})]})},mU=e=>{let t=F(),n=Yu(),{none:r,announced:i,holding:a}=cU(e,wT()),o=e.sources.filter(e=>!n.has(e.id)),s=a?Math.max(0,sU-o.length):0;return o.length||s?/* @__PURE__ */ V(`ul`,{className:`sources`,children:[o.map(t=>/* @__PURE__ */ L(`li`,{children:/* @__PURE__ */ L(fU,{source:t,pictures:dU(e.episode,t.id)})},t.id)),Array.from({length:s},(e,t)=>/* @__PURE__ */ L(`li`,{children:/* @__PURE__ */ L(LC,{className:`source-pending`})},t))]}):r&&e.settled&&!i?/* @__PURE__ */ L(`p`,{className:`none`,children:t.formatMessage({id:`No sources yet`,defaultMessage:`No sources yet`})}):null},hU={sciencefiction:`scifi`},gU=e=>{let t=e.toLowerCase().replace(/[^\p{L}\p{N}]/gu,``);return(hU[t]??t).replace(/(ine|al|s)$/,``)},_U=()=>new Set(oa===`anime`?[`Animation`,`Anime`].map(gU):[]),vU=e=>e.split(/\s*(?:&|\/|\band\b)\s*/i).filter(Boolean).map(gU),yU=(e=[],t=[])=>{let n=_U(),r=new Set(e.map(vU).flatMap(e=>e.length===1?e:[])),i=/* @__PURE__ */ new Set,a=e.filter(e=>{let t=vU(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(vU)]);return{genres:a,tags:t.filter(e=>{let t=!o.has(gU(e));return o.add(gU(e)),t}).slice(0,5)}},bU=e=>xn([Lg(e.type),LT(e,{locale:q.locale}),MT(e)]),xU=(e,t=/* @__PURE__ */ new Date)=>{let n=e.episodes?.at(0),{released:r,upcoming:i}=yT({startDate:e.startDate,status:e.status,episode:n},t);return xn([q.formatMessage({id:`Movie`,defaultMessage:`Movie`}),i?void 0:Zw(r,{locale:q.locale}),tT(n?.runtime??e.duration)])},SU=(e,t,n=/* @__PURE__ */ new Date)=>{let{genres:r,tags:i}=yU(e.genres??[],e.tags??[]);return{genres:r,tags:i,aired:t?void 0:LT(e,{locale:q.locale}),upcoming:!t&&yT({startDate:e.startDate,status:e.status},n).upcoming}},CU=I`
3616
3653
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
3617
- `,mU=()=>/* @__PURE__ */ L(`div`,{css:pU,children:F().formatMessage({id:`404 No page found`,defaultMessage:`404 No page found`})});H();var hU=(e,t)=>{K(()=>{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(Gh(Q.TITLE,{uri:e,name:t}),location.origin).href),document.head.append(n),()=>n.remove()},[e,t])};H();var gU=document.title,_U=e=>{K(()=>(document.title=e?`${e} - ${gU}`:gU,()=>{document.title=gU}),[e])};H();var vU=I`
3654
+ `,wU=()=>/* @__PURE__ */ L(`div`,{css:CU,children:F().formatMessage({id:`404 No page found`,defaultMessage:`404 No page found`})});H();var TU=(e,t)=>{K(()=>{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(Gh(Q.TITLE,{uri:e,name:t}),location.origin).href),document.head.append(n),()=>n.remove()},[e,t])};H();var EU=document.title,DU=e=>{K(()=>(document.title=e?`${e} - ${EU}`:EU,()=>{document.title=EU}),[e])};H();var OU=I`
3618
3655
  z-index: ${_a.mediaModal};
3619
3656
  padding: 5rem 1rem;
3620
3657
  background-color: hsla(0, 0%, 0%, 0.439);
@@ -4337,7 +4374,7 @@ scrollbar-gutter: stable;
4337
4374
  }
4338
4375
  }
4339
4376
  }
4340
- `,yU=({media:e,movie:t,loading:n})=>{let r=wT();return/* @__PURE__ */ V(`span`,{className:`line`,children:[t?dU(e,new Date(r)):uU(e),n?/* @__PURE__ */ L(hw,{}):void 0]})},bU=({media:e,movie:t})=>{let n=F(),{genres:r,tags:i,aired:a,upcoming:o}=fU(e,t);return/* @__PURE__ */ V(W,{children:[e.averageScore?/* @__PURE__ */ L(YO,{percent:e.averageScore}):void 0,/* @__PURE__ */ L(qO,{genres:r,tags:i,linked:!0}),a?/* @__PURE__ */ L(`dl`,{className:`facts`,children:/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`dt`,{children:o?n.formatMessage({id:`Releases#verb`,defaultMessage:`Releases`,description:`verb`}):n.formatMessage({id:`Aired`,defaultMessage:`Aired`})}),/* @__PURE__ */ L(`dd`,{children:a})]})}):void 0]})},xU=({mediaNodes:e,closeTo:t=`/`})=>{let n=F(),r=tt(),i=yh(),a={...i,uri:en(i.uri)},[,o]=xh(),s=Lw(a.uri,e),[c,l]=z(a.uri);K(()=>{l(e=>e&&_n(e,a.uri??``)?e:a.uri)},[a.uri]);let[{data:u,operation:d}]=Rs({query:KT,variables:{input:{uri:c},descriptionInput:{type:bc.Html}},pause:!c}),f=u?.media??s,p=Rw({data:u,operation:d},c),m=B(()=>f?.titles?.at(0)?.title,[f]);_U(m),hU(f?.uri??a.uri,m);let h=!!(u?.media&&rT(u.media)),g=h?u?.media?.episodes.at(0):void 0,{sources:_,answered:v}=tE(g,f?.uri??``,f?.handles),y=nE(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=JT(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=iw(f?.covers,f),w=G(null),[T,E]=z([]),[D,O]=z(),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=iw(k?.url?void 0:rw(f),f);K(()=>{k?.uri&&k.uri!==D&&O(k.uri)},[k?.uri,D]);let j=R(()=>{k&&E([...T,k.uri])},[k,T]),[ee,M]=z(!0),te=VD(Sh()),[ne,re]=z(!1),[ie,N]=z(!0),[P,ae]=z(.25),oe=G(void 0),se=u?.media?.handles.map(e=>e.node.uri)??[];K(()=>{let e=Kh(Q.MEDIA,i,f&&{uri:f.uri,name:m},oe.current);e&&!ow(u?.media?.seasons,se)&&(e.grown&&(oe.current=f.uri),o(`${e.path}${location.search}`,{replace:!0}))},[f?.uri,a.uri,m,i.slug]);let ce=/* @__PURE__ */ L(GH,{work:c,address:a.uri,uri:p?.uri,title:m,cover:C,episodeCount:p?.episodeCount,movie:h}),le=/* @__PURE__ */ V(`div`,{className:`links`,children:[/* @__PURE__ */ L(JH,{uri:f?.uri}),/* @__PURE__ */ L(sE,{uri:u?.media?.uri,handles:f?.handles,links:u?.media?.streamingLinks,except:eE(g,f?.handles)}),/* @__PURE__ */ L(EE,{path:Gh(Q.TITLE,{uri:f?.uri??a.uri,name:m}),title:m}),/* @__PURE__ */ L(kh,{className:`more`,href:`${Gh(Q.TITLE,{uri:f?.uri??a.uri,name:m})}${te}`,children:n.formatMessage({id:`More details`,defaultMessage:`More details`})})]}),ue=m||y?/* @__PURE__ */ L(`h2`,{id:m?r:void 0,className:`title`,children:m}):/* @__PURE__ */ L(LC,{className:`title-pending`}),de=/* @__PURE__ */ L(`button`,{type:`button`,className:`close`,"aria-label":n.formatMessage({id:`Close`,defaultMessage:`Close`}),onClick:()=>M(!1),children:/* @__PURE__ */ L(sx,{size:20,"aria-hidden":`true`})});if(!ee)return/* @__PURE__ */ L(Mh,{to:t});if(zw({data:u,operation:d},c))return/* @__PURE__ */ V(KH,{css:vU,label:n.formatMessage({id:`404 No page found`,defaultMessage:`404 No page found`}),onClose:()=>M(!1),children:[de,/* @__PURE__ */ L(mU,{})]});let fe=m?void 0:f?.titles?.at(0)?.title||`Stub`;return/* @__PURE__ */ V(KH,{"data-party-scroll":!0,css:vU,labelledBy:m?r:void 0,label:fe,onClose:()=>M(!1),children:[de,/* @__PURE__ */ V(`div`,{className:b?`hero film`:`hero`,children:[/* @__PURE__ */ V(`div`,{className:`trailer`,style:!k?.url&&A?{backgroundImage:`url(${A})`}:{},children:[k?.url?/* @__PURE__ */ L(OC,{url:k.url,className:`player`,onError:j,paused:ne,volume:ie?0:P},k.url):void 0,/* @__PURE__ */ V(`div`,{className:`player-controls ${k?.url?``:`hidden`}`,children:[/* @__PURE__ */ V(`button`,{type:`button`,className:`playback`,"aria-label":ne?n.formatMessage({id:`Play trailer`,defaultMessage:`Play trailer`}):n.formatMessage({id:`Pause trailer`,defaultMessage:`Pause trailer`}),onClick:()=>re(e=>!e),children:[L(ne?ft:ot,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,"aria-hidden":`true`}),L(ne?ft:ot,{className:`icon-body`,size:30,"aria-hidden":`true`})]}),/* @__PURE__ */ L(jC,{defaultMuted:ie,onMutedUpdate:N,defaultVolume:P,onVolumeUpdate:e=>ae(e)})]})]}),/* @__PURE__ */ V(`div`,{className:`over`,children:[C?/* @__PURE__ */ L(`img`,{className:`poster`,src:C,alt:``}):void 0,/* @__PURE__ */ V(`div`,{className:`stack`,children:[u?.media?/* @__PURE__ */ L(yU,{media:u.media,movie:h,loading:!y}):void 0,ue]}),b?/* @__PURE__ */ L(rU,{...b,children:ce}):void 0]})]}),/* @__PURE__ */ V(`div`,{className:`content`,children:[/* @__PURE__ */ V(`div`,{className:`columns`,children:[/* @__PURE__ */ V(`div`,{className:`main`,children:[b?/* @__PURE__ */ L(iU,{...b}):ce,S?/* @__PURE__ */ L(GO,{collapsedHeight:200,beside:w,className:`description`,children:/* @__PURE__ */ L(`div`,{dangerouslySetInnerHTML:{__html:S}})}):y?void 0:/* @__PURE__ */ L(RC,{count:5,className:`description pending`})]}),/* @__PURE__ */ V(`aside`,{ref:w,className:`side`,children:[u?.media?/* @__PURE__ */ L(bU,{media:u.media,movie:h}):void 0,le]})]}),/* @__PURE__ */ L(yO,{relations:f&&`relations`in f?f.relations??[]:[],action:/* @__PURE__ */ L(IV,{franchise:f&&`franchise`in f?f.franchise:void 0,currentUris:f?.handles?.map(e=>e.node.uri)??[]})},c),/* @__PURE__ */ L(sw,{seasons:u?.media?.seasons,currentUris:se,href:e=>`${Gh(Q.MEDIA,{uri:e,name:m})}${te}`}),h||!u?.media?void 0:/* @__PURE__ */ L(`div`,{className:`episode-list`,children:p?/* @__PURE__ */ L(mE,{media:p,tracked:x,settled:y},c):/* @__PURE__ */ L(fE,{})})]})]})},SU=Ee({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`}}),CU=[{label:SU.all,value:null},{label:SU.anime,value:yc.Anime},{label:SU.series,value:yc.Series},{label:SU.movies,value:yc.Movie}],wU=I`
4377
+ `,kU=({media:e,movie:t,loading:n})=>{let r=wT();return/* @__PURE__ */ V(`span`,{className:`line`,children:[t?xU(e,new Date(r)):bU(e),n?/* @__PURE__ */ L(hw,{}):void 0]})},AU=({media:e,movie:t})=>{let n=F(),{genres:r,tags:i,aired:a,upcoming:o}=SU(e,t);return/* @__PURE__ */ V(W,{children:[e.averageScore?/* @__PURE__ */ L(YO,{percent:e.averageScore}):void 0,/* @__PURE__ */ L(qO,{genres:r,tags:i,linked:!0}),a?/* @__PURE__ */ L(`dl`,{className:`facts`,children:/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`dt`,{children:o?n.formatMessage({id:`Releases#verb`,defaultMessage:`Releases`,description:`verb`}):n.formatMessage({id:`Aired`,defaultMessage:`Aired`})}),/* @__PURE__ */ L(`dd`,{children:a})]})}):void 0]})},jU=({mediaNodes:e,closeTo:t=`/`})=>{let n=F(),r=tt(),i=yh(),a={...i,uri:en(i.uri)},[,o]=xh(),s=Lw(a.uri,e),[c,l]=z(a.uri);K(()=>{l(e=>e&&_n(e,a.uri??``)?e:a.uri)},[a.uri]);let[{data:u,operation:d}]=Rs({query:KT,variables:{input:{uri:c},descriptionInput:{type:bc.Html}},pause:!c}),f=u?.media??s,p=Rw({data:u,operation:d},c),m=B(()=>f?.titles?.at(0)?.title,[f]);DU(m),TU(f?.uri??a.uri,m);let h=!!(u?.media&&rT(u.media)),g=h?u?.media?.episodes.at(0):void 0,{sources:_,answered:v}=tE(g,f?.uri??``,f?.handles),y=nE(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=JT(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=iw(f?.covers,f),w=G(null),[T,E]=z([]),[D,O]=z(),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=iw(k?.url?void 0:rw(f),f);K(()=>{k?.uri&&k.uri!==D&&O(k.uri)},[k?.uri,D]);let j=R(()=>{k&&E([...T,k.uri])},[k,T]),[ee,M]=z(!0),te=VD(Sh()),[ne,re]=z(!1),[ie,N]=z(!0),[P,ae]=z(.25),oe=G(void 0),se=u?.media?.handles.map(e=>e.node.uri)??[];K(()=>{let e=Kh(Q.MEDIA,i,f&&{uri:f.uri,name:m},oe.current);e&&!ow(u?.media?.seasons,se)&&(e.grown&&(oe.current=f.uri),o(`${e.path}${location.search}`,{replace:!0}))},[f?.uri,a.uri,m,i.slug]);let ce=/* @__PURE__ */ L(tU,{work:c,address:a.uri,uri:p?.uri,title:m,cover:C,episodeCount:p?.episodeCount,movie:h}),le=/* @__PURE__ */ V(`div`,{className:`links`,children:[/* @__PURE__ */ L(iU,{uri:f?.uri}),/* @__PURE__ */ L(sE,{uri:u?.media?.uri,handles:f?.handles,links:u?.media?.streamingLinks,except:eE(g,f?.handles)}),/* @__PURE__ */ L(EE,{path:Gh(Q.TITLE,{uri:f?.uri??a.uri,name:m}),title:m}),/* @__PURE__ */ L(kh,{className:`more`,href:`${Gh(Q.TITLE,{uri:f?.uri??a.uri,name:m})}${te}`,children:n.formatMessage({id:`More details`,defaultMessage:`More details`})})]}),ue=m||y?/* @__PURE__ */ L(`h2`,{id:m?r:void 0,className:`title`,children:m}):/* @__PURE__ */ L(LC,{className:`title-pending`}),de=/* @__PURE__ */ L(`button`,{type:`button`,className:`close`,"aria-label":n.formatMessage({id:`Close`,defaultMessage:`Close`}),onClick:()=>M(!1),children:/* @__PURE__ */ L(sx,{size:20,"aria-hidden":`true`})});if(!ee)return/* @__PURE__ */ L(Mh,{to:t});if(zw({data:u,operation:d},c))return/* @__PURE__ */ V(nU,{css:OU,label:n.formatMessage({id:`404 No page found`,defaultMessage:`404 No page found`}),onClose:()=>M(!1),children:[de,/* @__PURE__ */ L(wU,{})]});let fe=m?void 0:f?.titles?.at(0)?.title||`Stub`;return/* @__PURE__ */ V(nU,{"data-party-scroll":!0,css:OU,labelledBy:m?r:void 0,label:fe,onClose:()=>M(!1),children:[de,/* @__PURE__ */ V(`div`,{className:b?`hero film`:`hero`,children:[/* @__PURE__ */ V(`div`,{className:`trailer`,style:!k?.url&&A?{backgroundImage:`url(${A})`}:{},children:[k?.url?/* @__PURE__ */ L(OC,{url:k.url,className:`player`,onError:j,paused:ne,volume:ie?0:P},k.url):void 0,/* @__PURE__ */ V(`div`,{className:`player-controls ${k?.url?``:`hidden`}`,children:[/* @__PURE__ */ V(`button`,{type:`button`,className:`playback`,"aria-label":ne?n.formatMessage({id:`Play trailer`,defaultMessage:`Play trailer`}):n.formatMessage({id:`Pause trailer`,defaultMessage:`Pause trailer`}),onClick:()=>re(e=>!e),children:[L(ne?ft:ot,{className:`icon-outline`,size:30,strokeWidth:3,stroke:`black`,"aria-hidden":`true`}),L(ne?ft:ot,{className:`icon-body`,size:30,"aria-hidden":`true`})]}),/* @__PURE__ */ L(jC,{defaultMuted:ie,onMutedUpdate:N,defaultVolume:P,onVolumeUpdate:e=>ae(e)})]})]}),/* @__PURE__ */ V(`div`,{className:`over`,children:[C?/* @__PURE__ */ L(`img`,{className:`poster`,src:C,alt:``}):void 0,/* @__PURE__ */ V(`div`,{className:`stack`,children:[u?.media?/* @__PURE__ */ L(kU,{media:u.media,movie:h,loading:!y}):void 0,ue]}),b?/* @__PURE__ */ L(pU,{...b,children:ce}):void 0]})]}),/* @__PURE__ */ V(`div`,{className:`content`,children:[/* @__PURE__ */ V(`div`,{className:`columns`,children:[/* @__PURE__ */ V(`div`,{className:`main`,children:[b?/* @__PURE__ */ L(mU,{...b}):ce,S?/* @__PURE__ */ L(GO,{collapsedHeight:200,beside:w,className:`description`,children:/* @__PURE__ */ L(`div`,{dangerouslySetInnerHTML:{__html:S}})}):y?void 0:/* @__PURE__ */ L(RC,{count:5,className:`description pending`})]}),/* @__PURE__ */ V(`aside`,{ref:w,className:`side`,children:[u?.media?/* @__PURE__ */ L(AU,{media:u.media,movie:h}):void 0,le]})]}),/* @__PURE__ */ L(yO,{relations:f&&`relations`in f?f.relations??[]:[],action:/* @__PURE__ */ L(KV,{franchise:f&&`franchise`in f?f.franchise:void 0,currentUris:f?.handles?.map(e=>e.node.uri)??[]})},c),/* @__PURE__ */ L(sw,{seasons:u?.media?.seasons,currentUris:se,href:e=>`${Gh(Q.MEDIA,{uri:e,name:m})}${te}`}),h||!u?.media?void 0:/* @__PURE__ */ L(`div`,{className:`episode-list`,children:p?/* @__PURE__ */ L(mE,{media:p,tracked:x,settled:y},c):/* @__PURE__ */ L(fE,{})})]})]})},MU=Ee({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`}}),NU=[{label:MU.all,value:null},{label:MU.anime,value:yc.Anime},{label:MU.series,value:yc.Series},{label:MU.movies,value:yc.Movie}],PU=I`
4341
4378
  display: flex;
4342
4379
  flex-wrap: wrap;
4343
4380
  gap: 0.6rem;
@@ -4360,7 +4397,7 @@ scrollbar-gutter: stable;
4360
4397
  color: #000;
4361
4398
  border-color: #fff;
4362
4399
  }
4363
- `,TU=({value:e,onChange:t})=>{let n=F();return/* @__PURE__ */ L(`div`,{css:wU,children:CU.map(r=>/* @__PURE__ */ L(`button`,{className:e===r.value?`tab active`:`tab`,onClick:()=>t(r.value),children:n.formatMessage(r.label)},r.label.id))})},EU=e=>{let t=e.uri??``;return[e._id??``,...t.match(/^ag:\((.*)\)$/)?.[1]?.split(`,`)??[t]].filter(Boolean)},DU=(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(...EU(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]},OU=e=>e.filter(e=>e.popularity!=null).map(EU).filter(e=>e.length);H();var kU=vC(`
4400
+ `,FU=({value:e,onChange:t})=>{let n=F();return/* @__PURE__ */ L(`div`,{css:PU,children:NU.map(r=>/* @__PURE__ */ L(`button`,{className:e===r.value?`tab active`:`tab`,onClick:()=>t(r.value),children:n.formatMessage(r.label)},r.label.id))})},IU=e=>{let t=e.uri??``;return[e._id??``,...t.match(/^ag:\((.*)\)$/)?.[1]?.split(`,`)??[t]].filter(Boolean)},LU=(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(...IU(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]},RU=e=>e.filter(e=>e.popularity!=null).map(IU).filter(e=>e.length);H();var zU=vC(`
4364
4401
  subscription GetReleasingMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
4365
4402
  mediaPage(input: $input) {
4366
4403
  nodes {
@@ -4399,7 +4436,7 @@ scrollbar-gutter: stable;
4399
4436
  }
4400
4437
  }
4401
4438
  }
4402
- `),AU=I`
4439
+ `),BU=I`
4403
4440
  & > .home-row + .home-row {
4404
4441
  margin-top: 4rem;
4405
4442
  }
@@ -4415,7 +4452,7 @@ scrollbar-gutter: stable;
4415
4452
  z-index: ${_a.categoryBar};
4416
4453
  padding: 1.5rem 3rem 0.5rem;
4417
4454
  }
4418
- `,jU=gl(),MU={season:yg(jU.season),year:jU.year},NU=jg(MU),PU={categories:[yc.Movie]},FU={categories:[yc.Series]},IU={anime:[`season`],movie:[`movies`],series:[`shows`],stub:[`season`,`movies`,`shows`]}[oa],LU=(e,t)=>{let[{data:n}]=Rs({query:kU,variables:{input:e,shortDescriptionInput:{count:1}},pause:!IU.includes(t)}),r=n?.mediaPage?.nodes,i=G([]);return B(()=>{if(!r?.length||t!==`season`)return r||[];let e=DU(r,i.current);return i.current=OU(e),e},[r])},RU=()=>{let e=F(),[t]=wh(Wh(Q.MEDIA)),[n,r]=z(null),i={season:LU({season:MU.season,seasonYear:MU.year,sorts:[Sc.PopularityDesc],...n?{categories:[n]}:{}},`season`),movies:LU(PU,`movies`),shows:LU(FU,`shows`)};return/* @__PURE__ */ V(`div`,{css:AU,children:[/* @__PURE__ */ L(bE,{mediaNodes:i[IU[0]]}),oa===`stub`?/* @__PURE__ */ L(`div`,{className:`category-bar`,children:/* @__PURE__ */ L(TU,{value:n,onChange:r})}):void 0,IU.includes(`season`)&&/* @__PURE__ */ L(mD,{name:`season`,title:e.formatMessage({id:`Current season`,defaultMessage:`Current season`}),titleTo:NU,mediaNodes:i.season}),oa===`anime`||oa===`stub`?/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(PD,{}),(!n||n===yc.Anime)&&/* @__PURE__ */ L(HO,{})]}):void 0,IU.includes(`movies`)&&(!n||n===yc.Movie)&&/* @__PURE__ */ L(mD,{name:`movies`,title:e.formatMessage({id:`Popular movies`,defaultMessage:`Popular movies`}),mediaNodes:i.movies}),IU.includes(`shows`)&&(!n||n===yc.Series)&&/* @__PURE__ */ L(mD,{name:`shows`,title:e.formatMessage({id:`Popular shows`,defaultMessage:`Popular shows`}),mediaNodes:i.shows}),t&&/* @__PURE__ */ L(xU,{mediaNodes:[...i.season,...i.movies,...i.shows]})]})},zU=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,BU=/\p{Script=Hangul}/u,VU=({language:e,title:t})=>{if(e){if(e===`jp`)return zU.test(t)?`ja`:BU.test(t)?`ko`:void 0;try{return new Intl.Locale(e===`jp-en`?`ja-Latn`:e).baseName}catch{return}}},HU=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]}},UU=(e,t)=>e.map(e=>({...e,actors:e.voiceActors.filter(e=>(e.language??void 0)===t)})),WU=Ee({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`}}),GU=e=>e?WU[e]?q.formatMessage(WU[e]):e:void 0,KU=e=>{let t=/^[a-z]{2,3}$/.test(e)?q.formatDisplayName(e,{type:`language`})??e:e;return t===e?t:t.charAt(0).toLocaleUpperCase(q.locale)+t.slice(1)};H();var qU=12,JU=I`
4455
+ `,VU=gl(),HU={season:yg(VU.season),year:VU.year},UU=jg(HU),WU={categories:[yc.Movie]},GU={categories:[yc.Series]},KU={anime:[`season`],movie:[`movies`],series:[`shows`],stub:[`season`,`movies`,`shows`]}[oa],qU=(e,t)=>{let[{data:n}]=Rs({query:zU,variables:{input:e,shortDescriptionInput:{count:1}},pause:!KU.includes(t)}),r=n?.mediaPage?.nodes,i=G([]);return B(()=>{if(!r?.length||t!==`season`)return r||[];let e=LU(r,i.current);return i.current=RU(e),e},[r])},JU=()=>{let e=F(),[t]=wh(Wh(Q.MEDIA)),[n,r]=z(null),i={season:qU({season:HU.season,seasonYear:HU.year,sorts:[Sc.PopularityDesc],...n?{categories:[n]}:{}},`season`),movies:qU(WU,`movies`),shows:qU(GU,`shows`)};return/* @__PURE__ */ V(`div`,{css:BU,children:[/* @__PURE__ */ L(bE,{mediaNodes:i[KU[0]]}),oa===`stub`?/* @__PURE__ */ L(`div`,{className:`category-bar`,children:/* @__PURE__ */ L(FU,{value:n,onChange:r})}):void 0,KU.includes(`season`)&&/* @__PURE__ */ L(mD,{name:`season`,title:e.formatMessage({id:`Current season`,defaultMessage:`Current season`}),titleTo:UU,mediaNodes:i.season}),oa===`anime`||oa===`stub`?/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(PD,{}),(!n||n===yc.Anime)&&/* @__PURE__ */ L(HO,{})]}):void 0,KU.includes(`movies`)&&(!n||n===yc.Movie)&&/* @__PURE__ */ L(mD,{name:`movies`,title:e.formatMessage({id:`Popular movies`,defaultMessage:`Popular movies`}),mediaNodes:i.movies}),KU.includes(`shows`)&&(!n||n===yc.Series)&&/* @__PURE__ */ L(mD,{name:`shows`,title:e.formatMessage({id:`Popular shows`,defaultMessage:`Popular shows`}),mediaNodes:i.shows}),t&&/* @__PURE__ */ L(jU,{mediaNodes:[...i.season,...i.movies,...i.shows]})]})},YU=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,XU=/\p{Script=Hangul}/u,ZU=({language:e,title:t})=>{if(e){if(e===`jp`)return YU.test(t)?`ja`:XU.test(t)?`ko`:void 0;try{return new Intl.Locale(e===`jp-en`?`ja-Latn`:e).baseName}catch{return}}},QU=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]}},$U=(e,t)=>e.map(e=>({...e,actors:e.voiceActors.filter(e=>(e.language??void 0)===t)})),eW=Ee({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`}}),tW=e=>e?eW[e]?q.formatMessage(eW[e]):e:void 0,nW=e=>{let t=/^[a-z]{2,3}$/.test(e)?q.formatDisplayName(e,{type:`language`})??e:e;return t===e?t:t.charAt(0).toLocaleUpperCase(q.locale)+t.slice(1)};H();var rW=12,iW=I`
4419
4456
  /* the footer under it stays below the fold while the page fills, rather than being pushed off it */
4420
4457
  min-height: 100vh;
4421
4458
  padding-bottom: 6rem;
@@ -4935,7 +4972,7 @@ scrollbar-gutter: stable;
4935
4972
  }
4936
4973
  }
4937
4974
  }
4938
- `,YU=({person:e,detail:t,actor:n})=>/* @__PURE__ */ V(`div`,{className:n?`person actor`:`person`,children:[e.image?/* @__PURE__ */ L(`img`,{className:`face`,src:e.image,alt:``,loading:`lazy`}):void 0,/* @__PURE__ */ V(`div`,{children:[e.url?/* @__PURE__ */ L(`a`,{className:`name`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.name}):/* @__PURE__ */ L(`div`,{className:`name`,children:e.name}),t?/* @__PURE__ */ L(`div`,{className:`detail`,children:t}):void 0]})]}),XU=({characters:e})=>{let t=F(),n=t.formatMessage({id:`Characters`,defaultMessage:`Characters`}),r=HU(e),[i,a]=z(),o=UU(e,i??r.selected);return/* @__PURE__ */ V(`section`,{"data-characters":!0,children:[/* @__PURE__ */ V(`h2`,{children:[/* @__PURE__ */ L(`span`,{children:n}),r.options.length?/* @__PURE__ */ L(`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__ */ L(`option`,{value:e,children:KU(e)},e))}):void 0]}),/* @__PURE__ */ L(dw,{items:o,size:qU,label:n,children:(e,t)=>/* @__PURE__ */ L(`ul`,{className:`credits`,children:e.map((e,n)=>/* @__PURE__ */ V(`li`,{children:[/* @__PURE__ */ L(YU,{person:e,detail:GU(e.role)}),e.actors.length?/* @__PURE__ */ L(`div`,{className:`actors`,children:e.actors.map(e=>/* @__PURE__ */ L(YU,{person:e,actor:!0},e.name))}):void 0]},`${e.name}:${t+n}`))})})]})},ZU=({staff:e})=>{let t=F(),n=t.formatMessage({id:`Staff`,defaultMessage:`Staff`});return/* @__PURE__ */ V(`section`,{"data-staff":!0,children:[/* @__PURE__ */ L(`h2`,{children:n}),/* @__PURE__ */ L(dw,{items:e,size:qU,label:n,children:(e,n)=>/* @__PURE__ */ L(`ul`,{className:`credits`,children:e.map((e,r)=>/* @__PURE__ */ L(`li`,{children:/* @__PURE__ */ L(YU,{person:e,detail:e.roles?t.formatList(e.roles,nn):void 0})},`${e.name}:${n+r}`))})})]})},QU=({url:e})=>{let[t,n]=z();return K(()=>{import(`./assets/lib-theme-player-BrNO5--o.js`).then(e=>n(()=>e.default)).catch(()=>n(()=>({url:e})=>/* @__PURE__ */ L(`video`,{src:e,controls:!0,autoPlay:!0,playsInline:!0})))},[]),/* @__PURE__ */ L(`div`,{className:`player`,children:t?/* @__PURE__ */ L(t,{url:e}):void 0})},$U=({themes:e})=>{let t=F(),[n,r]=z();return/* @__PURE__ */ L(`ul`,{className:`themes`,children:e.map((e,i)=>{let a=e.video;return/* @__PURE__ */ V(`li`,{children:[/* @__PURE__ */ V(`div`,{className:`theme`,children:[a?/* @__PURE__ */ L(`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:L(n===i?nx:ft,{size:14,fill:`currentColor`})}):/* @__PURE__ */ L(`span`,{className:`toggle`}),/* @__PURE__ */ V(`span`,{className:`kind`,children:[e.kind,e.sequence??``]}),e.group?/* @__PURE__ */ L(`span`,{className:`group`,dir:`auto`,children:e.group}):void 0,/* @__PURE__ */ L(`span`,{className:`song`,children:e.title}),/* @__PURE__ */ L(`span`,{className:`artists`,children:/* @__PURE__ */ L(`bdi`,{children:t.formatList(e.artists,nn)})})]}),n===i&&a?/* @__PURE__ */ L(QU,{url:a}):void 0]},i)})})},eW=({themes:e})=>{let t=F().formatMessage({id:`Themes`,defaultMessage:`Themes`});return/* @__PURE__ */ V(`section`,{"data-themes":!0,children:[/* @__PURE__ */ L(`h2`,{children:t}),/* @__PURE__ */ L(dw,{items:e,size:qU,label:t,children:(e,t)=>/* @__PURE__ */ L($U,{themes:e},t)})]})},tW=()=>{let e=F(),t=yh(),n=en(t.uri),[,r]=xh(),i=VD(Sh()),[a,o]=z(n);K(()=>{o(e=>e&&_n(e,n??``)?e:n)},[n]);let[{data:s,operation:c}]=Rs({query:KT,variables:{input:{uri:a,details:!0},descriptionInput:{type:bc.Html},details:!0},pause:!a}),l=s?.media,u=l?.handles.map(e=>e.node.uri)??[],d=Rw({data:s,operation:c},a),f=JT(l?.uri),p=G(void 0),m=l?.titles.at(0);ht(()=>{let e=Kh(Q.TITLE,t,l&&{uri:l.uri,name:m?.title},p.current);e&&!ow(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=iw(l?.banners,l),g=iw(l?.covers,l);_U(m?.title),hU(l?.uri,m?.title);let _=IT(l?.titles),v=l?.descriptions.map(({description:e})=>e).sort((e,t)=>t.length-e.length).at(0),y=!!(l&&rT(l)),b=y?l.episodes.at(0):void 0,{sources:x,answered:S}=tE(b,l?.uri??``,l?.handles),C=nE(a,d?.settled&&S),w=ln(a??``).some(e=>la.includes(e)),T=y&&yT({startDate:l.startDate,status:l.status,episode:l.episodes.at(0)}).upcoming,E=VT(l??{},{locale:e.locale},w&&!C,T),D=l?RT(l):[],O=zT(l??{}),k=l?zg(l.season,l.seasonYear):void 0,[A,j]=z(!1),[ee,M]=z(!1),te=G(null);ht(()=>{let e=te.current;e&&!A&&M(e.scrollHeight>e.clientHeight+1)},[v,A]),K(()=>{j(!1)},[a]);let ne=l?.trailers.at(0)?.url,re=e.formatMessage({id:`Trailer`,defaultMessage:`Trailer`});return zw({data:s,operation:c},a)?/* @__PURE__ */ L(mU,{}):/* @__PURE__ */ V(`div`,{css:JU,children:[/* @__PURE__ */ L(`div`,{className:`banner`,children:h??g?/* @__PURE__ */ L(`div`,{className:h?`image`:`image blurred`,style:{backgroundImage:`url(${h??g})`}}):void 0}),/* @__PURE__ */ V(`div`,{className:`body`,children:[g?/* @__PURE__ */ L(`img`,{className:`cover`,src:g,alt:``}):/* @__PURE__ */ L(`div`,{className:`cover`}),/* @__PURE__ */ V(`div`,{className:`heading`,children:[k?/* @__PURE__ */ L(`div`,{className:`season`,children:k}):C?void 0:/* @__PURE__ */ L(`div`,{className:`season`,children:/* @__PURE__ */ L(LC,{className:`pending`})}),/* @__PURE__ */ L(`h1`,{lang:m&&VU(m),children:m?.title??(C?void 0:/* @__PURE__ */ L(RC,{count:2,className:`pending`}))}),_?/* @__PURE__ */ L(`div`,{className:`second`,lang:VU(_),children:_.title}):w&&!C?/* @__PURE__ */ L(`div`,{className:`second`,children:/* @__PURE__ */ L(LC,{className:`pending`})}):void 0,D.length||l?.averageScore!=null||O.length?/* @__PURE__ */ V(`div`,{className:`chips`,children:[D.map(e=>/* @__PURE__ */ L(`span`,{className:`chip`,children:e},e)),l?.averageScore==null?void 0:/* @__PURE__ */ L(`span`,{className:`chip`,children:/* @__PURE__ */ L(YO,{percent:l.averageScore})}),O.map(e=>/* @__PURE__ */ L(`span`,{className:`chip`,children:e},e))]}):C?void 0:/* @__PURE__ */ L(`div`,{className:`chips`,children:/* @__PURE__ */ L(LC,{className:`pending`})}),v?/* @__PURE__ */ L(`div`,{ref:te,className:A?`description`:`description clamped`,dir:`auto`,dangerouslySetInnerHTML:{__html:v}}):C?void 0:/* @__PURE__ */ L(RC,{count:5,className:`description`}),v&&(ee||A)?/* @__PURE__ */ L(`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__ */ L(Nw,{film:!0,sources:x,pending:!C}):void 0]}),/* @__PURE__ */ V(`div`,{className:`actions`,children:[l?/* @__PURE__ */ V(`div`,{className:`buttons`,children:[/* @__PURE__ */ L(XT,{media:l}),/* @__PURE__ */ L(EE,{className:`icon`,path:Gh(Q.TITLE,{uri:l.uri,name:m?.title}),title:m?.title}),ne?/* @__PURE__ */ L(`a`,{className:`icon`,href:ne,target:`_blank`,rel:`noreferrer`,"aria-label":re,title:re,children:/* @__PURE__ */ L(Nb,{size:20})}):void 0,/* @__PURE__ */ L(sE,{uri:l.uri,handles:l.handles,links:l.streamingLinks,except:eE(b,l.handles)})]}):/* @__PURE__ */ L(`div`,{className:`buttons`,children:/* @__PURE__ */ L(LC,{className:`play-pending`})}),/* @__PURE__ */ L(`div`,{className:`tracking`,children:/* @__PURE__ */ L(GH,{work:a,address:n,uri:d?.uri,title:m?.title,cover:g,episodeCount:d?.episodeCount,movie:y})})]}),E.length?/* @__PURE__ */ L(`dl`,{className:`facts`,children:E.map(({label:e,value:t,pills:n})=>t?/* @__PURE__ */ V(`div`,{className:n&&`pills`,children:[/* @__PURE__ */ L(`dt`,{children:e}),/* @__PURE__ */ L(`dd`,{children:typeof t==`string`?t:/* @__PURE__ */ L(qO,{...n===`genre`?{genres:t,linked:!0}:{tags:t}})})]},e):/* @__PURE__ */ V(`div`,{className:n?`fact placeholder pills`:`fact placeholder`,"aria-hidden":`true`,children:[/* @__PURE__ */ L(`dt`,{children:e}),/* @__PURE__ */ L(`dd`,{children:/* @__PURE__ */ L(LC,{className:`pending`})})]},e))}):void 0,/* @__PURE__ */ V(`div`,{className:`main`,children:[/* @__PURE__ */ L(yO,{relations:l?.relations??[],action:/* @__PURE__ */ L(IV,{franchise:l?.franchise,currentUris:u,route:Q.TITLE}),route:Q.TITLE,pending:w&&!C}),/* @__PURE__ */ L(sw,{seasons:l?.seasons,currentUris:u,href:e=>`${Gh(Q.TITLE,{uri:e,name:m?.title})}${i}`}),l&&!y?/* @__PURE__ */ V(`section`,{"data-episodes":!0,children:[/* @__PURE__ */ L(`h2`,{children:e.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),d?/* @__PURE__ */ L(mE,{media:d,tracked:f}):/* @__PURE__ */ L(fE,{})]}):void 0,/* @__PURE__ */ L(bO,{recommendations:l?.recommendations??[],route:Q.TITLE}),l?.characters?.length?/* @__PURE__ */ L(XU,{characters:l.characters}):void 0,l?.staff?.length?/* @__PURE__ */ L(ZU,{staff:l.staff}):void 0,l?.themes?.length?/* @__PURE__ */ L(eW,{themes:l.themes}):void 0]},a)]})]})};H();var nW=`t`,rW=(e,t)=>`${e}?${nW}=${Math.max(0,Math.floor(t))}`,iW=e=>{let t=new URLSearchParams(e).get(nW);return t&&/^\d+$/.test(t)?Number(t):void 0},aW=(e,t,n,r,i)=>{let a=G({uris:n,guest:r,start:i});a.current={uris:n,guest:r,start:i},K(()=>{if(!e||!t)return;let n=!1,r,i=!1,o=()=>{document.visibilityState===`hidden`&&Xd.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??Qd(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)&&ef(t,{time:o.time,duration:s,ended:c}),o.paused&&!i&&Xd.flush(),r=o.time,i=o.paused});return()=>{s(),document.removeEventListener(`visibilitychange`,o),Xd.flush()}},[e,t])};H();var oW=vC(`
4975
+ `,aW=({person:e,detail:t,actor:n})=>/* @__PURE__ */ V(`div`,{className:n?`person actor`:`person`,children:[e.image?/* @__PURE__ */ L(`img`,{className:`face`,src:e.image,alt:``,loading:`lazy`}):void 0,/* @__PURE__ */ V(`div`,{children:[e.url?/* @__PURE__ */ L(`a`,{className:`name`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.name}):/* @__PURE__ */ L(`div`,{className:`name`,children:e.name}),t?/* @__PURE__ */ L(`div`,{className:`detail`,children:t}):void 0]})]}),oW=({characters:e})=>{let t=F(),n=t.formatMessage({id:`Characters`,defaultMessage:`Characters`}),r=QU(e),[i,a]=z(),o=$U(e,i??r.selected);return/* @__PURE__ */ V(`section`,{"data-characters":!0,children:[/* @__PURE__ */ V(`h2`,{children:[/* @__PURE__ */ L(`span`,{children:n}),r.options.length?/* @__PURE__ */ L(`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__ */ L(`option`,{value:e,children:nW(e)},e))}):void 0]}),/* @__PURE__ */ L(dw,{items:o,size:rW,label:n,children:(e,t)=>/* @__PURE__ */ L(`ul`,{className:`credits`,children:e.map((e,n)=>/* @__PURE__ */ V(`li`,{children:[/* @__PURE__ */ L(aW,{person:e,detail:tW(e.role)}),e.actors.length?/* @__PURE__ */ L(`div`,{className:`actors`,children:e.actors.map(e=>/* @__PURE__ */ L(aW,{person:e,actor:!0},e.name))}):void 0]},`${e.name}:${t+n}`))})})]})},sW=({staff:e})=>{let t=F(),n=t.formatMessage({id:`Staff`,defaultMessage:`Staff`});return/* @__PURE__ */ V(`section`,{"data-staff":!0,children:[/* @__PURE__ */ L(`h2`,{children:n}),/* @__PURE__ */ L(dw,{items:e,size:rW,label:n,children:(e,n)=>/* @__PURE__ */ L(`ul`,{className:`credits`,children:e.map((e,r)=>/* @__PURE__ */ L(`li`,{children:/* @__PURE__ */ L(aW,{person:e,detail:e.roles?t.formatList(e.roles,nn):void 0})},`${e.name}:${n+r}`))})})]})},cW=({url:e})=>{let[t,n]=z();return K(()=>{import(`./assets/lib-theme-player-BrNO5--o.js`).then(e=>n(()=>e.default)).catch(()=>n(()=>({url:e})=>/* @__PURE__ */ L(`video`,{src:e,controls:!0,autoPlay:!0,playsInline:!0})))},[]),/* @__PURE__ */ L(`div`,{className:`player`,children:t?/* @__PURE__ */ L(t,{url:e}):void 0})},lW=({themes:e})=>{let t=F(),[n,r]=z();return/* @__PURE__ */ L(`ul`,{className:`themes`,children:e.map((e,i)=>{let a=e.video;return/* @__PURE__ */ V(`li`,{children:[/* @__PURE__ */ V(`div`,{className:`theme`,children:[a?/* @__PURE__ */ L(`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:L(n===i?nx:ft,{size:14,fill:`currentColor`})}):/* @__PURE__ */ L(`span`,{className:`toggle`}),/* @__PURE__ */ V(`span`,{className:`kind`,children:[e.kind,e.sequence??``]}),e.group?/* @__PURE__ */ L(`span`,{className:`group`,dir:`auto`,children:e.group}):void 0,/* @__PURE__ */ L(`span`,{className:`song`,children:e.title}),/* @__PURE__ */ L(`span`,{className:`artists`,children:/* @__PURE__ */ L(`bdi`,{children:t.formatList(e.artists,nn)})})]}),n===i&&a?/* @__PURE__ */ L(cW,{url:a}):void 0]},i)})})},uW=({themes:e})=>{let t=F().formatMessage({id:`Themes`,defaultMessage:`Themes`});return/* @__PURE__ */ V(`section`,{"data-themes":!0,children:[/* @__PURE__ */ L(`h2`,{children:t}),/* @__PURE__ */ L(dw,{items:e,size:rW,label:t,children:(e,t)=>/* @__PURE__ */ L(lW,{themes:e},t)})]})},dW=()=>{let e=F(),t=yh(),n=en(t.uri),[,r]=xh(),i=VD(Sh()),[a,o]=z(n);K(()=>{o(e=>e&&_n(e,n??``)?e:n)},[n]);let[{data:s,operation:c}]=Rs({query:KT,variables:{input:{uri:a,details:!0},descriptionInput:{type:bc.Html},details:!0},pause:!a}),l=s?.media,u=l?.handles.map(e=>e.node.uri)??[],d=Rw({data:s,operation:c},a),f=JT(l?.uri),p=G(void 0),m=l?.titles.at(0);ht(()=>{let e=Kh(Q.TITLE,t,l&&{uri:l.uri,name:m?.title},p.current);e&&!ow(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=iw(l?.banners,l),g=iw(l?.covers,l);DU(m?.title),TU(l?.uri,m?.title);let _=IT(l?.titles),v=l?.descriptions.map(({description:e})=>e).sort((e,t)=>t.length-e.length).at(0),y=!!(l&&rT(l)),b=y?l.episodes.at(0):void 0,{sources:x,answered:S}=tE(b,l?.uri??``,l?.handles),C=nE(a,d?.settled&&S),w=ln(a??``).some(e=>la.includes(e)),T=y&&yT({startDate:l.startDate,status:l.status,episode:l.episodes.at(0)}).upcoming,E=VT(l??{},{locale:e.locale},w&&!C,T),D=l?RT(l):[],O=zT(l??{}),k=l?zg(l.season,l.seasonYear):void 0,[A,j]=z(!1),[ee,M]=z(!1),te=G(null);ht(()=>{let e=te.current;e&&!A&&M(e.scrollHeight>e.clientHeight+1)},[v,A]),K(()=>{j(!1)},[a]);let ne=l?.trailers.at(0)?.url,re=e.formatMessage({id:`Trailer`,defaultMessage:`Trailer`});return zw({data:s,operation:c},a)?/* @__PURE__ */ L(wU,{}):/* @__PURE__ */ V(`div`,{css:iW,children:[/* @__PURE__ */ L(`div`,{className:`banner`,children:h??g?/* @__PURE__ */ L(`div`,{className:h?`image`:`image blurred`,style:{backgroundImage:`url(${h??g})`}}):void 0}),/* @__PURE__ */ V(`div`,{className:`body`,children:[g?/* @__PURE__ */ L(`img`,{className:`cover`,src:g,alt:``}):/* @__PURE__ */ L(`div`,{className:`cover`}),/* @__PURE__ */ V(`div`,{className:`heading`,children:[k?/* @__PURE__ */ L(`div`,{className:`season`,children:k}):C?void 0:/* @__PURE__ */ L(`div`,{className:`season`,children:/* @__PURE__ */ L(LC,{className:`pending`})}),/* @__PURE__ */ L(`h1`,{lang:m&&ZU(m),children:m?.title??(C?void 0:/* @__PURE__ */ L(RC,{count:2,className:`pending`}))}),_?/* @__PURE__ */ L(`div`,{className:`second`,lang:ZU(_),children:_.title}):w&&!C?/* @__PURE__ */ L(`div`,{className:`second`,children:/* @__PURE__ */ L(LC,{className:`pending`})}):void 0,D.length||l?.averageScore!=null||O.length?/* @__PURE__ */ V(`div`,{className:`chips`,children:[D.map(e=>/* @__PURE__ */ L(`span`,{className:`chip`,children:e},e)),l?.averageScore==null?void 0:/* @__PURE__ */ L(`span`,{className:`chip`,children:/* @__PURE__ */ L(YO,{percent:l.averageScore})}),O.map(e=>/* @__PURE__ */ L(`span`,{className:`chip`,children:e},e))]}):C?void 0:/* @__PURE__ */ L(`div`,{className:`chips`,children:/* @__PURE__ */ L(LC,{className:`pending`})}),v?/* @__PURE__ */ L(`div`,{ref:te,className:A?`description`:`description clamped`,dir:`auto`,dangerouslySetInnerHTML:{__html:v}}):C?void 0:/* @__PURE__ */ L(RC,{count:5,className:`description`}),v&&(ee||A)?/* @__PURE__ */ L(`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__ */ L(Nw,{film:!0,sources:x,pending:!C}):void 0]}),/* @__PURE__ */ V(`div`,{className:`actions`,children:[l?/* @__PURE__ */ V(`div`,{className:`buttons`,children:[/* @__PURE__ */ L(XT,{media:l}),/* @__PURE__ */ L(EE,{className:`icon`,path:Gh(Q.TITLE,{uri:l.uri,name:m?.title}),title:m?.title}),ne?/* @__PURE__ */ L(`a`,{className:`icon`,href:ne,target:`_blank`,rel:`noreferrer`,"aria-label":re,title:re,children:/* @__PURE__ */ L(Nb,{size:20})}):void 0,/* @__PURE__ */ L(sE,{uri:l.uri,handles:l.handles,links:l.streamingLinks,except:eE(b,l.handles)})]}):/* @__PURE__ */ L(`div`,{className:`buttons`,children:/* @__PURE__ */ L(LC,{className:`play-pending`})}),/* @__PURE__ */ L(`div`,{className:`tracking`,children:/* @__PURE__ */ L(tU,{work:a,address:n,uri:d?.uri,title:m?.title,cover:g,episodeCount:d?.episodeCount,movie:y})})]}),E.length?/* @__PURE__ */ L(`dl`,{className:`facts`,children:E.map(({label:e,value:t,pills:n})=>t?/* @__PURE__ */ V(`div`,{className:n&&`pills`,children:[/* @__PURE__ */ L(`dt`,{children:e}),/* @__PURE__ */ L(`dd`,{children:typeof t==`string`?t:/* @__PURE__ */ L(qO,{...n===`genre`?{genres:t,linked:!0}:{tags:t}})})]},e):/* @__PURE__ */ V(`div`,{className:n?`fact placeholder pills`:`fact placeholder`,"aria-hidden":`true`,children:[/* @__PURE__ */ L(`dt`,{children:e}),/* @__PURE__ */ L(`dd`,{children:/* @__PURE__ */ L(LC,{className:`pending`})})]},e))}):void 0,/* @__PURE__ */ V(`div`,{className:`main`,children:[/* @__PURE__ */ L(yO,{relations:l?.relations??[],action:/* @__PURE__ */ L(KV,{franchise:l?.franchise,currentUris:u,route:Q.TITLE}),route:Q.TITLE,pending:w&&!C}),/* @__PURE__ */ L(sw,{seasons:l?.seasons,currentUris:u,href:e=>`${Gh(Q.TITLE,{uri:e,name:m?.title})}${i}`}),l&&!y?/* @__PURE__ */ V(`section`,{"data-episodes":!0,children:[/* @__PURE__ */ L(`h2`,{children:e.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),d?/* @__PURE__ */ L(mE,{media:d,tracked:f}):/* @__PURE__ */ L(fE,{})]}):void 0,/* @__PURE__ */ L(bO,{recommendations:l?.recommendations??[],route:Q.TITLE}),l?.characters?.length?/* @__PURE__ */ L(oW,{characters:l.characters}):void 0,l?.staff?.length?/* @__PURE__ */ L(sW,{staff:l.staff}):void 0,l?.themes?.length?/* @__PURE__ */ L(uW,{themes:l.themes}):void 0]},a)]})]})};H();var fW=`t`,pW=(e,t)=>`${e}?${fW}=${Math.max(0,Math.floor(t))}`,mW=e=>{let t=new URLSearchParams(e).get(fW);return t&&/^\d+$/.test(t)?Number(t):void 0},hW=(e,t,n,r,i)=>{let a=G({uris:n,guest:r,start:i});a.current={uris:n,guest:r,start:i},K(()=>{if(!e||!t)return;let n=!1,r,i=!1,o=()=>{document.visibilityState===`hidden`&&Xd.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??Qd(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)&&ef(t,{time:o.time,duration:s,ended:c}),o.paused&&!i&&Xd.flush(),r=o.time,i=o.paused});return()=>{s(),document.removeEventListener(`visibilitychange`,o),Xd.flush()}},[e,t])};H();var gW=vC(`
4939
4976
  subscription SceneMedia($input: MediaInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
4940
4977
  media(input: $input) {
4941
4978
  ...SearchCard
@@ -4946,7 +4983,7 @@ scrollbar-gutter: stable;
4946
4983
  }
4947
4984
  }
4948
4985
  }
4949
- `),sW=Ee({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.`}}),cW=e=>{let[t,n]=z();return K(()=>{if(!e)return;let t=!0;return nr(e).catch(()=>({error:`busy`})).then(r=>{t&&n({code:e,answer:r})}),()=>{t=!1}},[e]),t&&t.code===e?t.answer:void 0},lW=({match:e,item:t})=>{let n=F(),[{data:r}]=Rs({query:oW,variables:{input:{uri:`anilist:${e.anilist}`},shortDescriptionInput:{count:1}}}),i=r?.media;if(!i)return/* @__PURE__ */ L(LC,{className:`pending`});let a=i.type===wc.Movie;return/* @__PURE__ */ V(`div`,{className:`scene`,children:[t(i),/* @__PURE__ */ L(`div`,{className:`moments`,children:e.moments.map(e=>{if(e.episode==null&&!a)return;let t=ag(e.from),r=a||e.episode==null?t:n.formatMessage({id:`Episode {number}, {time}`,defaultMessage:`Episode {number}, {time}`},{number:e.episode,time:t}),o=i.episodes.find(t=>t.episodeNumber===e.episode)??(a?i.episodes[0]:void 0);return o?/* @__PURE__ */ V(kh,{className:`moment`,href:rW(Gh(Q.WATCH,{mediaUri:i.uri,episodeUri:o.uri}),e.from),children:[/* @__PURE__ */ L(ft,{size:14,fill:`currentColor`,"aria-hidden":`true`}),r]},r):/* @__PURE__ */ L(`span`,{className:`moment`,children:r},r)})})]})},uW=(e,t)=>{let n=e.nextAiringEpisode?.airingAt;if(!n)return;let r=new Date(n).getTime();return Number.isFinite(r)?r-t:void 0},dW=e=>e.episodeCount==null||rT(e)?void 0:q.formatMessage({id:`{count, plural, one {{count} episode} other {{count} episodes}}`,defaultMessage:`{count, plural, one {{count} episode} other {{count} episodes}}`},{count:e.episodeCount}),fW=(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})`},pW=e=>({"--accent":fW(e,1)??`rgba(255, 255, 255, 0.75)`,"--accent-soft":fW(e,.18)??`rgba(255, 255, 255, 0.08)`,"--accent-wash":fW(e,.07)??`rgba(255, 255, 255, 0.03)`}),mW=I`
4986
+ `),_W=Ee({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.`}}),vW=e=>{let[t,n]=z();return K(()=>{if(!e)return;let t=!0;return nr(e).catch(()=>({error:`busy`})).then(r=>{t&&n({code:e,answer:r})}),()=>{t=!1}},[e]),t&&t.code===e?t.answer:void 0},yW=({match:e,item:t})=>{let n=F(),[{data:r}]=Rs({query:gW,variables:{input:{uri:`anilist:${e.anilist}`},shortDescriptionInput:{count:1}}}),i=r?.media;if(!i)return/* @__PURE__ */ L(LC,{className:`pending`});let a=i.type===wc.Movie;return/* @__PURE__ */ V(`div`,{className:`scene`,children:[t(i),/* @__PURE__ */ L(`div`,{className:`moments`,children:e.moments.map(e=>{if(e.episode==null&&!a)return;let t=ag(e.from),r=a||e.episode==null?t:n.formatMessage({id:`Episode {number}, {time}`,defaultMessage:`Episode {number}, {time}`},{number:e.episode,time:t}),o=i.episodes.find(t=>t.episodeNumber===e.episode)??(a?i.episodes[0]:void 0);return o?/* @__PURE__ */ V(kh,{className:`moment`,href:pW(Gh(Q.WATCH,{mediaUri:i.uri,episodeUri:o.uri}),e.from),children:[/* @__PURE__ */ L(ft,{size:14,fill:`currentColor`,"aria-hidden":`true`}),r]},r):/* @__PURE__ */ L(`span`,{className:`moment`,children:r},r)})})]})},bW=(e,t)=>{let n=e.nextAiringEpisode?.airingAt;if(!n)return;let r=new Date(n).getTime();return Number.isFinite(r)?r-t:void 0},xW=e=>e.episodeCount==null||rT(e)?void 0:q.formatMessage({id:`{count, plural, one {{count} episode} other {{count} episodes}}`,defaultMessage:`{count, plural, one {{count} episode} other {{count} episodes}}`},{count:e.episodeCount}),SW=(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})`},CW=e=>({"--accent":SW(e,1)??`rgba(255, 255, 255, 0.75)`,"--accent-soft":SW(e,.18)??`rgba(255, 255, 255, 0.08)`,"--accent-wash":SW(e,.07)??`rgba(255, 255, 255, 0.03)`}),wW=I`
4950
4987
  display: grid;
4951
4988
  grid-template-columns: 15rem minmax(0, 1fr);
4952
4989
  height: 23rem;
@@ -5060,7 +5097,7 @@ scrollbar-gutter: stable;
5060
5097
  .description { -webkit-line-clamp: 3; }
5061
5098
  .chips { display: none; }
5062
5099
  }
5063
- `,hW=({media:e,to:t})=>{let n=F(),r=wT(),i=iw(e.covers,e,{box:xE}),a=e.covers?.find(e=>e.color)?.color,o=CS(uW(e,r)??0),s=e.nextAiringEpisode?.episodeNumber,c=Lg(e.type),l=zg(e.season,e.seasonYear),u=xn([c,dW(e)],` • `),d=Rg(e.status)??(l?void 0:Zw(e.startDate?.slice(0,4),{locale:n.locale}));return/* @__PURE__ */ V(kh,{to:t,css:mW,style:pW(a),children:[/* @__PURE__ */ L(`div`,{className:`cover`,style:i?{backgroundImage:`url(${i})`}:void 0,children:/* @__PURE__ */ V(`div`,{className:`cover-text`,children:[/* @__PURE__ */ L(`div`,{className:`title`,dir:`auto`,children:e.titles?.at(0)?.title}),l&&/* @__PURE__ */ L(`div`,{className:`season`,children:l})]})}),/* @__PURE__ */ V(`div`,{className:`detail`,children:[/* @__PURE__ */ V(`div`,{className:`detail-top`,children:[/* @__PURE__ */ L(`div`,{children:o&&s!=null?/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`div`,{className:`airing-label`,children:n.formatMessage({id:`Ep {episode} airing in`,defaultMessage:`Ep {episode} airing in`},{episode:s})}),/* @__PURE__ */ L(`div`,{className:`airing-value airing`,children:o})]}):d&&/* @__PURE__ */ L(`div`,{className:`airing-value`,children:d})}),e.averageScore!=null&&/* @__PURE__ */ L(YO,{percent:e.averageScore})]}),u&&/* @__PURE__ */ L(`div`,{className:`meta`,children:u}),/* @__PURE__ */ L(`div`,{className:`description`,dir:`auto`,children:e.shortDescriptions?.at(0)?.shortDescription}),/* @__PURE__ */ L(qO,{genres:e.genres?.slice(0,2)})]})]})},gW=I`
5100
+ `,TW=({media:e,to:t})=>{let n=F(),r=wT(),i=iw(e.covers,e,{box:xE}),a=e.covers?.find(e=>e.color)?.color,o=CS(bW(e,r)??0),s=e.nextAiringEpisode?.episodeNumber,c=Lg(e.type),l=zg(e.season,e.seasonYear),u=xn([c,xW(e)],` • `),d=Rg(e.status)??(l?void 0:Zw(e.startDate?.slice(0,4),{locale:n.locale}));return/* @__PURE__ */ V(kh,{to:t,css:wW,style:CW(a),children:[/* @__PURE__ */ L(`div`,{className:`cover`,style:i?{backgroundImage:`url(${i})`}:void 0,children:/* @__PURE__ */ V(`div`,{className:`cover-text`,children:[/* @__PURE__ */ L(`div`,{className:`title`,dir:`auto`,children:e.titles?.at(0)?.title}),l&&/* @__PURE__ */ L(`div`,{className:`season`,children:l})]})}),/* @__PURE__ */ V(`div`,{className:`detail`,children:[/* @__PURE__ */ V(`div`,{className:`detail-top`,children:[/* @__PURE__ */ L(`div`,{children:o&&s!=null?/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`div`,{className:`airing-label`,children:n.formatMessage({id:`Ep {episode} airing in`,defaultMessage:`Ep {episode} airing in`},{episode:s})}),/* @__PURE__ */ L(`div`,{className:`airing-value airing`,children:o})]}):d&&/* @__PURE__ */ L(`div`,{className:`airing-value`,children:d})}),e.averageScore!=null&&/* @__PURE__ */ L(YO,{percent:e.averageScore})]}),u&&/* @__PURE__ */ L(`div`,{className:`meta`,children:u}),/* @__PURE__ */ L(`div`,{className:`description`,dir:`auto`,children:e.shortDescriptions?.at(0)?.shortDescription}),/* @__PURE__ */ L(qO,{genres:e.genres?.slice(0,2)})]})]})},EW=I`
5064
5101
  display: grid;
5065
5102
  grid-template-columns: 5rem minmax(0, 1fr) 11rem 11rem 17rem;
5066
5103
  align-items: center;
@@ -5131,7 +5168,7 @@ scrollbar-gutter: stable;
5131
5168
  .score { display: none; }
5132
5169
  .chips { display: none; }
5133
5170
  }
5134
- `,_W=({media:e,to:t})=>{let n=F(),r=wT(),i=iw(e.covers,e,{box:xE}),a=e.covers?.find(e=>e.color)?.color,o=CS(uW(e,r)??0,1),s=e.nextAiringEpisode?.episodeNumber,c=dW(e);return/* @__PURE__ */ V(kh,{to:t,css:gW,style:pW(a),children:[/* @__PURE__ */ L(`div`,{className:`cover`,style:i?{backgroundImage:`url(${i})`}:void 0}),/* @__PURE__ */ V(`div`,{className:`heading`,children:[/* @__PURE__ */ L(`div`,{className:`title`,children:e.titles?.at(0)?.title}),/* @__PURE__ */ L(qO,{genres:e.genres?.slice(0,5)})]}),/* @__PURE__ */ V(`div`,{className:`column score`,children:[e.averageScore!=null&&/* @__PURE__ */ L(YO,{percent:e.averageScore}),e.followers!=null&&/* @__PURE__ */ L(`span`,{className:`secondary`,children:n.formatMessage({id:`{count, plural, one {# user} other {# users}}`,defaultMessage:`{count, plural, one {# user} other {# users}}`},{count:e.followers})})]}),/* @__PURE__ */ V(`div`,{className:`column format`,children:[/* @__PURE__ */ L(`span`,{children:Lg(e.type)}),c&&/* @__PURE__ */ L(`span`,{className:`secondary`,children:c})]}),/* @__PURE__ */ V(`div`,{className:`column`,children:[/* @__PURE__ */ L(`span`,{children:Rg(e.status)}),o&&s!=null&&/* @__PURE__ */ L(`span`,{className:`secondary airing`,children:n.formatMessage({id:`Ep {episode} airing in {countdown}`,defaultMessage:`Ep {episode} airing in {countdown}`},{episode:s,countdown:o})})]})]})},vW={grid:zb,card:Rb,list:Vb},yW=Ee({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`}}),bW=I`
5171
+ `,DW=({media:e,to:t})=>{let n=F(),r=wT(),i=iw(e.covers,e,{box:xE}),a=e.covers?.find(e=>e.color)?.color,o=CS(bW(e,r)??0,1),s=e.nextAiringEpisode?.episodeNumber,c=xW(e);return/* @__PURE__ */ V(kh,{to:t,css:EW,style:CW(a),children:[/* @__PURE__ */ L(`div`,{className:`cover`,style:i?{backgroundImage:`url(${i})`}:void 0}),/* @__PURE__ */ V(`div`,{className:`heading`,children:[/* @__PURE__ */ L(`div`,{className:`title`,children:e.titles?.at(0)?.title}),/* @__PURE__ */ L(qO,{genres:e.genres?.slice(0,5)})]}),/* @__PURE__ */ V(`div`,{className:`column score`,children:[e.averageScore!=null&&/* @__PURE__ */ L(YO,{percent:e.averageScore}),e.followers!=null&&/* @__PURE__ */ L(`span`,{className:`secondary`,children:n.formatMessage({id:`{count, plural, one {# user} other {# users}}`,defaultMessage:`{count, plural, one {# user} other {# users}}`},{count:e.followers})})]}),/* @__PURE__ */ V(`div`,{className:`column format`,children:[/* @__PURE__ */ L(`span`,{children:Lg(e.type)}),c&&/* @__PURE__ */ L(`span`,{className:`secondary`,children:c})]}),/* @__PURE__ */ V(`div`,{className:`column`,children:[/* @__PURE__ */ L(`span`,{children:Rg(e.status)}),o&&s!=null&&/* @__PURE__ */ L(`span`,{className:`secondary airing`,children:n.formatMessage({id:`Ep {episode} airing in {countdown}`,defaultMessage:`Ep {episode} airing in {countdown}`},{episode:s,countdown:o})})]})]})},OW={grid:zb,card:Rb,list:Vb},kW=Ee({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`}}),AW=I`
5135
5172
  display: inline-flex;
5136
5173
  gap: 0.4rem;
5137
5174
  padding: 0.4rem;
@@ -5158,7 +5195,7 @@ scrollbar-gutter: stable;
5158
5195
  background: rgba(255, 255, 255, 0.12);
5159
5196
  color: #fff;
5160
5197
  }
5161
- `,xW=({mode:e,modes:t=tf,onChange:n})=>{let r=F();return/* @__PURE__ */ L(`div`,{css:bW,role:`group`,"aria-label":r.formatMessage({id:`Result layout`,defaultMessage:`Result layout`}),children:t.map(t=>{let i=vW[t],a=r.formatMessage(yW[t]);return/* @__PURE__ */ L(`button`,{type:`button`,title:a,"aria-label":a,"aria-pressed":e===t,onClick:()=>n(t),children:/* @__PURE__ */ L(i,{size:18})},t)})})};H();var SW=I`
5198
+ `,jW=({mode:e,modes:t=tf,onChange:n})=>{let r=F();return/* @__PURE__ */ L(`div`,{css:AW,role:`group`,"aria-label":r.formatMessage({id:`Result layout`,defaultMessage:`Result layout`}),children:t.map(t=>{let i=OW[t],a=r.formatMessage(kW[t]);return/* @__PURE__ */ L(`button`,{type:`button`,title:a,"aria-label":a,"aria-pressed":e===t,onClick:()=>n(t),children:/* @__PURE__ */ L(i,{size:18})},t)})})};H();var MW=I`
5162
5199
  display: flex;
5163
5200
  flex-direction: column;
5164
5201
  gap: 0.7rem;
@@ -5208,7 +5245,7 @@ scrollbar-gutter: stable;
5208
5245
  }
5209
5246
 
5210
5247
  .control.open .chevron { transform: rotate(180deg); }
5211
- `,CW=I`
5248
+ `,NW=I`
5212
5249
  z-index: ${_a.filterMenu};
5213
5250
  width: max-content;
5214
5251
  min-width: 22rem;
@@ -5283,7 +5320,7 @@ scrollbar-gutter: stable;
5283
5320
  font-size: 1.4rem;
5284
5321
  color: rgba(255, 255, 255, 0.4);
5285
5322
  }
5286
- `,wW=({label:e,options:t,selected:n,onChange:r,multiple:i=!1,searchable:a,allowCustom:o=!1})=>{let s=F(),[c,l]=z(!1),[u,d]=z(``),[f,p]=z(-1),m=G([]),h=tt(),g=e=>`${h}-option-${e}`;K(()=>{c||p(-1)},[c]),K(()=>{p(-1)},[u]),K(()=>{c&&f>=0&&m.current[f]?.scrollIntoView?.({block:`nearest`})},[c,f]);let{refs:_,floatingStyles:v,context:y}=Yy({open:c,onOpenChange:e=>{l(e),e||d(``)},placement:`bottom-start`,whileElementsMounted:Ae,middleware:[Ev(6),Ov({padding:8}),Dv({padding:8}),kv({padding:8,apply:({availableHeight:e,elements:t})=>{t.floating.style.maxHeight=`${Math.max(160,e)}px`}})]}),{getReferenceProps:b,getFloatingProps:x}=$y([Uy(y),qy(y),tb(y,{role:`listbox`})]),S=s.formatList(n.map(e=>t.find(t=>t.value===e)?.label??e),nn),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__ */ V(`div`,{css:SW,children:[/* @__PURE__ */ L(`span`,{className:`label`,id:h,children:e}),/* @__PURE__ */ V(`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__ */ L(`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__ */ L(Db,{size:16,className:`chevron`})]}),c&&/* @__PURE__ */ L(Cy,{children:/* @__PURE__ */ L(Py,{context:y,modal:!1,initialFocus:a===void 0?-1:0,children:/* @__PURE__ */ V(`div`,{ref:_.setFloating,css:CW,style:v,...x(),children:[a!==void 0&&/* @__PURE__ */ V(`div`,{className:`filter`,children:[/* @__PURE__ */ L(Qb,{size:15}),/* @__PURE__ */ L(`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__ */ L(`div`,{className:`options`,children:C.length?C.map((e,t)=>/* @__PURE__ */ V(`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__ */ L(Tt,{size:16,className:n.includes(e.value)?`tick`:`tick hidden`}),/* @__PURE__ */ L(`span`,{children:e.label})]},e.value)):/* @__PURE__ */ L(`div`,{className:`empty`,children:s.formatMessage({id:`Nothing matches “{term}”.`,defaultMessage:`Nothing matches “{term}”.`},{term:u})})})]})})})]})},TW=({label:e,children:t})=>/* @__PURE__ */ V(`div`,{css:SW,children:[/* @__PURE__ */ L(`span`,{className:`label`,children:e}),t]});H();var EW=oa===`movie`||oa===`series`;vC(`
5323
+ `,PW=({label:e,options:t,selected:n,onChange:r,multiple:i=!1,searchable:a,allowCustom:o=!1})=>{let s=F(),[c,l]=z(!1),[u,d]=z(``),[f,p]=z(-1),m=G([]),h=tt(),g=e=>`${h}-option-${e}`;K(()=>{c||p(-1)},[c]),K(()=>{p(-1)},[u]),K(()=>{c&&f>=0&&m.current[f]?.scrollIntoView?.({block:`nearest`})},[c,f]);let{refs:_,floatingStyles:v,context:y}=Yy({open:c,onOpenChange:e=>{l(e),e||d(``)},placement:`bottom-start`,whileElementsMounted:Ae,middleware:[Ev(6),Ov({padding:8}),Dv({padding:8}),kv({padding:8,apply:({availableHeight:e,elements:t})=>{t.floating.style.maxHeight=`${Math.max(160,e)}px`}})]}),{getReferenceProps:b,getFloatingProps:x}=$y([Uy(y),qy(y),tb(y,{role:`listbox`})]),S=s.formatList(n.map(e=>t.find(t=>t.value===e)?.label??e),nn),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__ */ V(`div`,{css:MW,children:[/* @__PURE__ */ L(`span`,{className:`label`,id:h,children:e}),/* @__PURE__ */ V(`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__ */ L(`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__ */ L(Db,{size:16,className:`chevron`})]}),c&&/* @__PURE__ */ L(Cy,{children:/* @__PURE__ */ L(Py,{context:y,modal:!1,initialFocus:a===void 0?-1:0,children:/* @__PURE__ */ V(`div`,{ref:_.setFloating,css:NW,style:v,...x(),children:[a!==void 0&&/* @__PURE__ */ V(`div`,{className:`filter`,children:[/* @__PURE__ */ L(Qb,{size:15}),/* @__PURE__ */ L(`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__ */ L(`div`,{className:`options`,children:C.length?C.map((e,t)=>/* @__PURE__ */ V(`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__ */ L(Tt,{size:16,className:n.includes(e.value)?`tick`:`tick hidden`}),/* @__PURE__ */ L(`span`,{children:e.label})]},e.value)):/* @__PURE__ */ L(`div`,{className:`empty`,children:s.formatMessage({id:`Nothing matches “{term}”.`,defaultMessage:`Nothing matches “{term}”.`},{term:u})})})]})})})]})},FW=({label:e,children:t})=>/* @__PURE__ */ V(`div`,{css:MW,children:[/* @__PURE__ */ L(`span`,{className:`label`,children:e}),t]});H();var IW=oa===`movie`||oa===`series`;vC(`
5287
5324
  fragment SearchCard on Media {
5288
5325
  ...MediaFragment
5289
5326
  score
@@ -5329,7 +5366,7 @@ scrollbar-gutter: stable;
5329
5366
  airingAt
5330
5367
  }
5331
5368
  }
5332
- `);var DW=vC(`
5369
+ `);var LW=vC(`
5333
5370
  subscription SearchMediaPage($input: MediaPageInput!, $shortDescriptionInput: MediaShortDescriptionInput!) {
5334
5371
  mediaPage(input: $input) {
5335
5372
  nodes {
@@ -5337,7 +5374,7 @@ scrollbar-gutter: stable;
5337
5374
  }
5338
5375
  }
5339
5376
  }
5340
- `),OW=I`
5377
+ `),RW=I`
5341
5378
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
5342
5379
  min-height: 100vh;
5343
5380
 
@@ -5531,7 +5568,7 @@ scrollbar-gutter: stable;
5531
5568
  .grid > .pending { width: 100%; height: auto; aspect-ratio: 5 / 7; }
5532
5569
  .cards > .pending { height: 17rem; }
5533
5570
  }
5534
- `,kW=(()=>{let e=[];for(let t=Tg();t>=wg;t--)e.push({value:String(t),label:String(t)});return e})(),AW=e=>({...e.query?{search:e.query}:{sorts:[Sc.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}:{}}),jW=({covered:e=!1})=>{let t=F(),n=Sh(),[,r]=xh(),i=B(()=>Dg(n),[n]),a=EW?void 0:Pg(n),o=cW(a),s=!a&&Vg(i),{searchPicture:c,unreadable:l}=Lx();zx(c,!EW&&!e);let u=e=>r(jg({...i,...e}),{replace:!0}),[d,f]=z(i.query),p=G(null);K(()=>{document.activeElement!==p.current&&f(e=>e.trim()===i.query?e:i.query)},[i.query]);let[m,h]=z(()=>document.activeElement?.matches(`header input`)?``:i.query);K(()=>{let e=setTimeout(()=>h(i.query),350);return()=>clearTimeout(e)},[i.query]);let g=m!==i.query,_={...i,query:m},v=B(()=>AW(_),[kg(_)]),[{data:y}]=Rs({query:DW,variables:{input:v,shortDescriptionInput:{count:1}},pause:!!a||!Vg(_)}),[b,x]=z(of),S=e=>{x(e),sf(e)},[C,w]=z(!1);K(()=>{w(!1);let e=setTimeout(()=>w(!0),5e3);return()=>clearTimeout(e)},[n,v]);let T=G(y),E=G(v);y!==T.current&&(T.current=y,E.current=v);let D=s&&!g&&E.current===v?y?.mediaPage?.nodes??[]:[],O=!!(i.season&&i.year),{genreOptions:k,tagOptions:A,genreKeys:j}=B(()=>{let e=new Map(pg[oa].map(e=>[rg(e),e])),n=/* @__PURE__ */ new Map;for(let t of i.genres)e.set(rg(t),t);for(let e of i.tags)n.set(rg(e),e);let r=(t,r)=>{let i=rg(r);!e.has(i)&&!n.has(i)&&t.set(i,r)};if(O)for(let t of D)for(let n of t.genres??[])r(e,n);for(let e of D)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:gg(e)})).sort(a),tagOptions:[...n.values()].map(e=>({value:e,label:e})).sort(a)}},[D,i.genres,i.tags,O]),ee=[...i.genres,...i.tags],M=e=>j.has(rg(e)),te=e=>u({genres:e.filter(M),tags:e.filter(e=>!M(e))}),ne={grid:{className:`grid`,item:e=>/* @__PURE__ */ L(CE,{media:e,to:Gh(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title}),ellipsis:!1})},card:{className:`cards`,item:e=>/* @__PURE__ */ L(hW,{media:e,to:Gh(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title})})},list:{className:`rows`,item:e=>/* @__PURE__ */ L(_W,{media:e,to:Gh(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title})})}}[b],re=/* @__PURE__ */ L(`div`,{className:ne.className,children:Array.from({length:12},(e,t)=>/* @__PURE__ */ L(LC,{className:`pending`},t))}),ie=[...i.year?[{key:`year`,label:String(i.year),clear:{year:null}}]:[],...i.season?[{key:`season`,label:Ig(lg,i.season),clear:{season:null}}]:[],...i.status?[{key:`status`,label:Ig(cg,i.status),clear:{status:null}}]:[],...i.category?[{key:`category`,label:Ig(ug,i.category),clear:{category:null}}]:[],...i.formats.map(e=>({key:`format:${e}`,label:Ig(sg,e),clear:{formats:i.formats.filter(t=>t!==e)}})),...i.genres.map(e=>({key:`genre:${e}`,label:gg(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)}}))],N=e=>e.map(({value:e,label:n})=>({value:e,label:t.formatMessage(n)})),P=/* @__PURE__ */ L(`div`,{className:`status`,children:t.formatMessage({id:`No results found.`,defaultMessage:`No results found.`})});return/* @__PURE__ */ V(`div`,{css:OW,children:[/* @__PURE__ */ V(`div`,{className:`heading-row`,children:[/* @__PURE__ */ L(`h1`,{className:`heading`,children:a?t.formatMessage({id:`Scene search`,defaultMessage:`Scene search`}):Fg(i)}),/* @__PURE__ */ L(xW,{mode:b,onChange:S})]}),a?/* @__PURE__ */ L(`div`,{className:`credit`,children:t.formatMessage({id:`Scenes found by <link>trace.moe</link>`,defaultMessage:`Scenes found by <link>trace.moe</link>`},{link:e=>/* @__PURE__ */ L(`a`,{href:`https://trace.moe`,target:`_blank`,rel:`noreferrer noopener`,children:e})})}):void 0,/* @__PURE__ */ V(`div`,{className:`filters`,children:[/* @__PURE__ */ L(TW,{label:t.formatMessage({id:`Search`,defaultMessage:`Search`}),children:/* @__PURE__ */ V(`div`,{className:`text-field`,children:[/* @__PURE__ */ L(Qb,{size:17}),/* @__PURE__ */ L(`input`,{ref:p,type:`text`,value:d,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;f(t),u({query:t})}}),EW?void 0:/* @__PURE__ */ L(Bx,{onPicture:c,size:17})]})}),/* @__PURE__ */ L(wW,{label:EW?t.formatMessage({id:`Genres`,defaultMessage:`Genres`}):t.formatMessage({id:`Genres & Tags`,defaultMessage:`Genres & Tags`}),options:[...k,...A],selected:ee,onChange:te,multiple:!0,searchable:EW?t.formatMessage({id:`Filter genres`,defaultMessage:`Filter genres`}):t.formatMessage({id:`Filter genres & tags`,defaultMessage:`Filter genres & tags`}),allowCustom:!EW}),/* @__PURE__ */ L(wW,{label:t.formatMessage({id:`Year`,defaultMessage:`Year`}),options:kW,selected:i.year?[String(i.year)]:[],onChange:e=>u({year:e.length?Number(e[0]):null}),searchable:t.formatMessage({id:`Filter year`,defaultMessage:`Filter year`})}),EW?void 0:/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(wW,{label:t.formatMessage({id:`Season#broadcast season`,defaultMessage:`Season`,description:`broadcast season`}),options:N(lg),selected:i.season?[i.season]:[],onChange:e=>u({season:e[0]??null})}),/* @__PURE__ */ L(wW,{label:t.formatMessage({id:`Format`,defaultMessage:`Format`}),options:N(sg),selected:i.formats,onChange:e=>u({formats:e}),multiple:!0}),/* @__PURE__ */ L(wW,{label:t.formatMessage({id:`Airing Status`,defaultMessage:`Airing Status`}),options:N(cg),selected:i.status?[i.status]:[],onChange:e=>u({status:e[0]??null})})]}),oa===`stub`?/* @__PURE__ */ L(wW,{label:t.formatMessage({id:`Category`,defaultMessage:`Category`}),options:N(ug),selected:i.category?[i.category]:[],onChange:e=>u({category:e[0]??null})}):void 0]}),/* @__PURE__ */ V(`div`,{className:`chips`,children:[ie.map(e=>/* @__PURE__ */ V(`button`,{type:`button`,className:`chip`,"aria-label":t.formatMessage({id:`Remove {filter}`,defaultMessage:`Remove {filter}`},{filter:e.label}),onClick:()=>u(e.clear),children:[e.label,/* @__PURE__ */ L(sx,{size:14})]},e.key)),ie.length>1&&/* @__PURE__ */ L(`button`,{type:`button`,className:`chip-clear`,onClick:()=>u({category:null,status:null,season:null,year:null,formats:[],genres:[],tags:[]}),children:t.formatMessage({id:`Clear filters`,defaultMessage:`Clear filters`})})]}),l?/* @__PURE__ */ L(`div`,{className:`status`,children:t.formatMessage({id:`This picture could not be read.`,defaultMessage:`This picture could not be read.`})}):a?o?`error`in o?/* @__PURE__ */ L(`div`,{className:`status`,children:t.formatMessage(sW[o.error])}):o.matches.length?/* @__PURE__ */ L(`div`,{className:ne.className,children:o.matches.map(e=>/* @__PURE__ */ L(lW,{match:e,item:ne.item},e.anilist))}):P:re:D.length?/* @__PURE__ */ L(`div`,{className:ne.className,children:D.map(ne.item)}):s?C?P:re:/* @__PURE__ */ L(`div`,{className:`status`,children:Bg(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.`})})]})},MW=I`
5571
+ `,zW=(()=>{let e=[];for(let t=Tg();t>=wg;t--)e.push({value:String(t),label:String(t)});return e})(),BW=e=>({...e.query?{search:e.query}:{sorts:[Sc.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}:{}}),VW=({covered:e=!1})=>{let t=F(),n=Sh(),[,r]=xh(),i=B(()=>Dg(n),[n]),a=IW?void 0:Pg(n),o=vW(a),s=!a&&Vg(i),{searchPicture:c,unreadable:l}=Lx();zx(c,!IW&&!e);let u=e=>r(jg({...i,...e}),{replace:!0}),[d,f]=z(i.query),p=G(null);K(()=>{document.activeElement!==p.current&&f(e=>e.trim()===i.query?e:i.query)},[i.query]);let[m,h]=z(()=>document.activeElement?.matches(`header input`)?``:i.query);K(()=>{let e=setTimeout(()=>h(i.query),350);return()=>clearTimeout(e)},[i.query]);let g=m!==i.query,_={...i,query:m},v=B(()=>BW(_),[kg(_)]),[{data:y}]=Rs({query:LW,variables:{input:v,shortDescriptionInput:{count:1}},pause:!!a||!Vg(_)}),[b,x]=z(of),S=e=>{x(e),sf(e)},[C,w]=z(!1);K(()=>{w(!1);let e=setTimeout(()=>w(!0),5e3);return()=>clearTimeout(e)},[n,v]);let T=G(y),E=G(v);y!==T.current&&(T.current=y,E.current=v);let D=s&&!g&&E.current===v?y?.mediaPage?.nodes??[]:[],O=!!(i.season&&i.year),{genreOptions:k,tagOptions:A,genreKeys:j}=B(()=>{let e=new Map(pg[oa].map(e=>[rg(e),e])),n=/* @__PURE__ */ new Map;for(let t of i.genres)e.set(rg(t),t);for(let e of i.tags)n.set(rg(e),e);let r=(t,r)=>{let i=rg(r);!e.has(i)&&!n.has(i)&&t.set(i,r)};if(O)for(let t of D)for(let n of t.genres??[])r(e,n);for(let e of D)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:gg(e)})).sort(a),tagOptions:[...n.values()].map(e=>({value:e,label:e})).sort(a)}},[D,i.genres,i.tags,O]),ee=[...i.genres,...i.tags],M=e=>j.has(rg(e)),te=e=>u({genres:e.filter(M),tags:e.filter(e=>!M(e))}),ne={grid:{className:`grid`,item:e=>/* @__PURE__ */ L(CE,{media:e,to:Gh(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title}),ellipsis:!1})},card:{className:`cards`,item:e=>/* @__PURE__ */ L(TW,{media:e,to:Gh(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title})})},list:{className:`rows`,item:e=>/* @__PURE__ */ L(DW,{media:e,to:Gh(Q.MEDIA,{uri:e.uri,name:e.titles?.at(0)?.title})})}}[b],re=/* @__PURE__ */ L(`div`,{className:ne.className,children:Array.from({length:12},(e,t)=>/* @__PURE__ */ L(LC,{className:`pending`},t))}),ie=[...i.year?[{key:`year`,label:String(i.year),clear:{year:null}}]:[],...i.season?[{key:`season`,label:Ig(lg,i.season),clear:{season:null}}]:[],...i.status?[{key:`status`,label:Ig(cg,i.status),clear:{status:null}}]:[],...i.category?[{key:`category`,label:Ig(ug,i.category),clear:{category:null}}]:[],...i.formats.map(e=>({key:`format:${e}`,label:Ig(sg,e),clear:{formats:i.formats.filter(t=>t!==e)}})),...i.genres.map(e=>({key:`genre:${e}`,label:gg(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)}}))],N=e=>e.map(({value:e,label:n})=>({value:e,label:t.formatMessage(n)})),P=/* @__PURE__ */ L(`div`,{className:`status`,children:t.formatMessage({id:`No results found.`,defaultMessage:`No results found.`})});return/* @__PURE__ */ V(`div`,{css:RW,children:[/* @__PURE__ */ V(`div`,{className:`heading-row`,children:[/* @__PURE__ */ L(`h1`,{className:`heading`,children:a?t.formatMessage({id:`Scene search`,defaultMessage:`Scene search`}):Fg(i)}),/* @__PURE__ */ L(jW,{mode:b,onChange:S})]}),a?/* @__PURE__ */ L(`div`,{className:`credit`,children:t.formatMessage({id:`Scenes found by <link>trace.moe</link>`,defaultMessage:`Scenes found by <link>trace.moe</link>`},{link:e=>/* @__PURE__ */ L(`a`,{href:`https://trace.moe`,target:`_blank`,rel:`noreferrer noopener`,children:e})})}):void 0,/* @__PURE__ */ V(`div`,{className:`filters`,children:[/* @__PURE__ */ L(FW,{label:t.formatMessage({id:`Search`,defaultMessage:`Search`}),children:/* @__PURE__ */ V(`div`,{className:`text-field`,children:[/* @__PURE__ */ L(Qb,{size:17}),/* @__PURE__ */ L(`input`,{ref:p,type:`text`,value:d,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;f(t),u({query:t})}}),IW?void 0:/* @__PURE__ */ L(Bx,{onPicture:c,size:17})]})}),/* @__PURE__ */ L(PW,{label:IW?t.formatMessage({id:`Genres`,defaultMessage:`Genres`}):t.formatMessage({id:`Genres & Tags`,defaultMessage:`Genres & Tags`}),options:[...k,...A],selected:ee,onChange:te,multiple:!0,searchable:IW?t.formatMessage({id:`Filter genres`,defaultMessage:`Filter genres`}):t.formatMessage({id:`Filter genres & tags`,defaultMessage:`Filter genres & tags`}),allowCustom:!IW}),/* @__PURE__ */ L(PW,{label:t.formatMessage({id:`Year`,defaultMessage:`Year`}),options:zW,selected:i.year?[String(i.year)]:[],onChange:e=>u({year:e.length?Number(e[0]):null}),searchable:t.formatMessage({id:`Filter year`,defaultMessage:`Filter year`})}),IW?void 0:/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(PW,{label:t.formatMessage({id:`Season#broadcast season`,defaultMessage:`Season`,description:`broadcast season`}),options:N(lg),selected:i.season?[i.season]:[],onChange:e=>u({season:e[0]??null})}),/* @__PURE__ */ L(PW,{label:t.formatMessage({id:`Format`,defaultMessage:`Format`}),options:N(sg),selected:i.formats,onChange:e=>u({formats:e}),multiple:!0}),/* @__PURE__ */ L(PW,{label:t.formatMessage({id:`Airing Status`,defaultMessage:`Airing Status`}),options:N(cg),selected:i.status?[i.status]:[],onChange:e=>u({status:e[0]??null})})]}),oa===`stub`?/* @__PURE__ */ L(PW,{label:t.formatMessage({id:`Category`,defaultMessage:`Category`}),options:N(ug),selected:i.category?[i.category]:[],onChange:e=>u({category:e[0]??null})}):void 0]}),/* @__PURE__ */ V(`div`,{className:`chips`,children:[ie.map(e=>/* @__PURE__ */ V(`button`,{type:`button`,className:`chip`,"aria-label":t.formatMessage({id:`Remove {filter}`,defaultMessage:`Remove {filter}`},{filter:e.label}),onClick:()=>u(e.clear),children:[e.label,/* @__PURE__ */ L(sx,{size:14})]},e.key)),ie.length>1&&/* @__PURE__ */ L(`button`,{type:`button`,className:`chip-clear`,onClick:()=>u({category:null,status:null,season:null,year:null,formats:[],genres:[],tags:[]}),children:t.formatMessage({id:`Clear filters`,defaultMessage:`Clear filters`})})]}),l?/* @__PURE__ */ L(`div`,{className:`status`,children:t.formatMessage({id:`This picture could not be read.`,defaultMessage:`This picture could not be read.`})}):a?o?`error`in o?/* @__PURE__ */ L(`div`,{className:`status`,children:t.formatMessage(_W[o.error])}):o.matches.length?/* @__PURE__ */ L(`div`,{className:ne.className,children:o.matches.map(e=>/* @__PURE__ */ L(yW,{match:e,item:ne.item},e.anilist))}):P:re:D.length?/* @__PURE__ */ L(`div`,{className:ne.className,children:D.map(ne.item)}):s?C?P:re:/* @__PURE__ */ L(`div`,{className:`status`,children:Bg(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.`})})]})},HW=I`
5535
5572
  max-width: 72rem;
5536
5573
  margin: 0 auto;
5537
5574
  padding: calc(var(--stub-header-height) + 3rem) 3rem 6rem;
@@ -5570,7 +5607,7 @@ scrollbar-gutter: stable;
5570
5607
  color: #ff8a3d;
5571
5608
  }
5572
5609
  }
5573
- `,NW=({children:e})=>/* @__PURE__ */ L(`div`,{css:MW,lang:`en`,dir:`ltr`,children:e}),PW=()=>/* @__PURE__ */ V(NW,{children:[/* @__PURE__ */ L(`h1`,{children:`Legal & Terms`}),/* @__PURE__ */ L(`div`,{className:`updated`,children:`Last updated 31 October 2026`}),/* @__PURE__ */ L(`p`,{children:`stub is an independent, non-commercial personal project, provided “as is” without warranties of any kind.`}),/* @__PURE__ */ L(`h2`,{children:`No hosted content`}),/* @__PURE__ */ L(`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__ */ V(`p`,{children:[`Contains information from`,` `,/* @__PURE__ */ L(`a`,{href:`https://github.com/cedya77/anime-offline-database`,target:`_blank`,rel:`noreferrer noopener`,children:`cedya77/anime-offline-database`}),`, continuing`,` `,/* @__PURE__ */ L(`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__ */ L(`a`,{href:`https://opendatacommons.org/licenses/odbl/1-0/`,target:`_blank`,rel:`noreferrer noopener`,children:`ODbL`}),`.`]}),/* @__PURE__ */ V(`p`,{children:[`Contains information from`,` `,/* @__PURE__ */ L(`a`,{href:`https://www.tvmaze.com/`,target:`_blank`,rel:`noreferrer noopener`,children:`TVmaze`}),`, made available under`,` `,/* @__PURE__ */ L(`a`,{href:`https://creativecommons.org/licenses/by-sa/4.0/`,target:`_blank`,rel:`noreferrer noopener`,children:`CC BY-SA`}),`.`]}),/* @__PURE__ */ L(`h2`,{children:`Personal use`}),/* @__PURE__ */ L(`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__ */ L(`h2`,{children:`Privacy`}),/* @__PURE__ */ V(`p`,{children:[`stub keeps no accounts and stores no personal data. See the`,` `,/* @__PURE__ */ L(kh,{href:Gh(Q.PRIVACY),children:`Privacy page`}),` for what is and isn’t handled when you use it.`]}),/* @__PURE__ */ L(`h2`,{children:`Rights holders`}),/* @__PURE__ */ V(`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__ */ L(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]}),/* @__PURE__ */ L(`h2`,{children:`Liability`}),/* @__PURE__ */ L(`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.`})]}),FW=`This browser, in its storage for stub at this address`,IW=`This tab, in its storage for stub`,LW=`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`,RW=[{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:`${FW}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you remove them. ${LW}. 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:[Bs,Vs]}},{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:`${FW}, 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. ${LW}`,keys:{store:`local`,names:[Hs,Us]}},{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:IW,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:[Ws]}},{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:`${FW}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you change them. ${LW}`,keys:{store:`local`,names:[...ff,h]}},{id:`connected-sites`,title:`Connected tracking sites`,what:`Which of AniList, MyAnimeList and Crunchyroll you signed in to through stub on this device, so stub reaches only those.`,where:FW,lasts:`Until you sign out of them, or clear this site's data in your browser`,keys:{store:`local`,names:[s]}},{id:`site-status`,title:`Site sign-in states`,what:`Whether you were signed in to Crunchyroll, Prime Video, AniList and MyAnimeList when stub last learned it, when, and whether you were signed in to it on this browser before. Never your name there.`,where:FW,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:[S]}},{id:`party-name`,title:`Party name`,what:`The name you gave yourself in a watch party.`,where:IW,lasts:`Until you close the tab`,keys:{store:`session`,names:[zi]}},{id:`party-invite`,title:`Party you are in`,what:`The watch party this tab is in, so a reload rejoins it.`,where:IW,lasts:`Until you leave the party or close the tab`,keys:{store:`session`,names:[Ri]}},{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:IW,lasts:`Until you close the tab`,keys:{store:`session`,names:[va]}},{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:IW,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 and MyAnimeList sessions, which stub plays and tracks with.`,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:FW,lasts:`Until you clear this site's data in your browser`,keys:{store:`local`,names:[st]}},{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:`${FW}, 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. ${LW}`,keys:{store:`local`,names:[Wd,Gd]}},{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:FW,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:[DO]}},{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`}],zW=I`
5610
+ `,UW=({children:e})=>/* @__PURE__ */ L(`div`,{css:HW,lang:`en`,dir:`ltr`,children:e}),WW=()=>/* @__PURE__ */ V(UW,{children:[/* @__PURE__ */ L(`h1`,{children:`Legal & Terms`}),/* @__PURE__ */ L(`div`,{className:`updated`,children:`Last updated 31 October 2026`}),/* @__PURE__ */ L(`p`,{children:`stub is an independent, non-commercial personal project, provided “as is” without warranties of any kind.`}),/* @__PURE__ */ L(`h2`,{children:`No hosted content`}),/* @__PURE__ */ L(`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__ */ V(`p`,{children:[`Contains information from`,` `,/* @__PURE__ */ L(`a`,{href:`https://github.com/cedya77/anime-offline-database`,target:`_blank`,rel:`noreferrer noopener`,children:`cedya77/anime-offline-database`}),`, continuing`,` `,/* @__PURE__ */ L(`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__ */ L(`a`,{href:`https://opendatacommons.org/licenses/odbl/1-0/`,target:`_blank`,rel:`noreferrer noopener`,children:`ODbL`}),`.`]}),/* @__PURE__ */ V(`p`,{children:[`Contains information from`,` `,/* @__PURE__ */ L(`a`,{href:`https://www.tvmaze.com/`,target:`_blank`,rel:`noreferrer noopener`,children:`TVmaze`}),`, made available under`,` `,/* @__PURE__ */ L(`a`,{href:`https://creativecommons.org/licenses/by-sa/4.0/`,target:`_blank`,rel:`noreferrer noopener`,children:`CC BY-SA`}),`.`]}),/* @__PURE__ */ L(`h2`,{children:`Personal use`}),/* @__PURE__ */ L(`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__ */ L(`h2`,{children:`Privacy`}),/* @__PURE__ */ V(`p`,{children:[`stub keeps no accounts and stores no personal data. See the`,` `,/* @__PURE__ */ L(kh,{href:Gh(Q.PRIVACY),children:`Privacy page`}),` for what is and isn’t handled when you use it.`]}),/* @__PURE__ */ L(`h2`,{children:`Rights holders`}),/* @__PURE__ */ V(`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__ */ L(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]}),/* @__PURE__ */ L(`h2`,{children:`Liability`}),/* @__PURE__ */ L(`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.`})]}),GW=`This browser, in its storage for stub at this address`,KW=`This tab, in its storage for stub`,qW=`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`,JW=[{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:`${GW}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you remove them. ${qW}. 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:[Bs,Vs]}},{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:`${GW}, 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. ${qW}`,keys:{store:`local`,names:[Hs,Us]}},{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:KW,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:[Ws]}},{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:`${GW}, and your FKN account's storage while you are signed in, encrypted in this browser before it is stored`,lasts:`Until you change them. ${qW}`,keys:{store:`local`,names:[...ff,h]}},{id:`connected-sites`,title:`Connected tracking sites`,what:`Which of AniList, MyAnimeList and Crunchyroll you signed in to through stub on this device, so stub reaches only those.`,where:GW,lasts:`Until you sign out of them, or clear this site's data in your browser`,keys:{store:`local`,names:[s]}},{id:`site-status`,title:`Site sign-in states`,what:`Whether you were signed in to Crunchyroll, Prime Video, AniList and MyAnimeList when stub last learned it, when, and whether you were signed in to it on this browser before. Never your name there.`,where:GW,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:[S]}},{id:`party-name`,title:`Party name`,what:`The name you gave yourself in a watch party.`,where:KW,lasts:`Until you close the tab`,keys:{store:`session`,names:[zi]}},{id:`party-invite`,title:`Party you are in`,what:`The watch party this tab is in, so a reload rejoins it.`,where:KW,lasts:`Until you leave the party or close the tab`,keys:{store:`session`,names:[Ri]}},{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:KW,lasts:`Until you close the tab`,keys:{store:`session`,names:[va]}},{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:KW,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 and MyAnimeList sessions, which stub plays and tracks with.`,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:GW,lasts:`Until you clear this site's data in your browser`,keys:{store:`local`,names:[st]}},{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:`${GW}, 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. ${qW}`,keys:{store:`local`,names:[Wd,Gd]}},{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:GW,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:[DO]}},{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`}],YW=I`
5574
5611
  display: flex;
5575
5612
  flex-direction: column;
5576
5613
  gap: 1rem;
@@ -5585,7 +5622,7 @@ scrollbar-gutter: stable;
5585
5622
 
5586
5623
  strong { color: #fff; }
5587
5624
  .facts { color: rgba(255, 255, 255, 0.55); }
5588
- `,BW=I`
5625
+ `,XW=I`
5589
5626
  margin: 0 0 1.6rem;
5590
5627
  padding-left: 2rem;
5591
5628
 
@@ -5595,7 +5632,7 @@ scrollbar-gutter: stable;
5595
5632
  }
5596
5633
 
5597
5634
  .host { color: rgba(255, 255, 255, 0.55); }
5598
- `,VW=e=>e.endsWith(`.`)?e:`${e}.`,HW=()=>/* @__PURE__ */ V(NW,{children:[/* @__PURE__ */ L(`h1`,{children:`Privacy`}),/* @__PURE__ */ L(`div`,{className:`updated`,children:`Last updated 23 November 2026`}),/* @__PURE__ */ L(`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__ */ L(`h2`,{children:`What stub keeps`}),/* @__PURE__ */ V(`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__ */ L(kh,{to:`/settings#sources`,children:`Settings, under Sources`}),`. Clearing this site's data in your browser removes everything stub keeps in this browser.`]}),/* @__PURE__ */ L(`ul`,{css:zW,children:RW.map(e=>/* @__PURE__ */ V(`li`,{children:[/* @__PURE__ */ V(`strong`,{children:[e.title,`.`]}),` `,e.what,` `,/* @__PURE__ */ V(`span`,{className:`facts`,children:[`Where: `,VW(e.where),` How long: `,VW(e.lasts)]})]},e.id))}),/* @__PURE__ */ L(`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__ */ L(`h2`,{children:`Sign-ins to other sites`}),/* @__PURE__ */ V(`p`,{children:[`stub plays Crunchyroll and Prime Video and tracks your AniList and MyAnimeList 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__ */ L(kh,{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__ */ L(`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__ */ L(`h2`,{children:`FKN Social`}),/* @__PURE__ */ V(`p`,{children:[`If you turn on Post to FKN Social in `,/* @__PURE__ */ L(kh,{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__ */ L(`h2`,{children:`Network requests & third parties`}),/* @__PURE__ */ V(`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 and JustWatch. 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__ */ L(`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__ */ L(`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__ */ V(`ul`,{css:BW,children:[/* @__PURE__ */ V(`li`,{children:[`AniList `,/* @__PURE__ */ L(`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__ */ V(`li`,{children:[`Anime News Network `,/* @__PURE__ */ L(`span`,{className:`host`,children:`cdn.animenewsnetwork.com`})]}),/* @__PURE__ */ V(`li`,{children:[`AnimeThemes `,/* @__PURE__ */ L(`span`,{className:`host`,children:`graphql.animethemes.moe`})]}),/* @__PURE__ */ V(`li`,{children:[`AniSkip `,/* @__PURE__ */ L(`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__ */ V(`li`,{children:[`AniZip `,/* @__PURE__ */ L(`span`,{className:`host`,children:`api.ani.zip`})]}),/* @__PURE__ */ V(`li`,{children:[`Apple TV `,/* @__PURE__ */ L(`span`,{className:`host`,children:`uts-api.itunes.apple.com`})]}),/* @__PURE__ */ V(`li`,{children:[`Kitsu `,/* @__PURE__ */ L(`span`,{className:`host`,children:`kitsu.io`})]}),/* @__PURE__ */ V(`li`,{children:[`Netflix `,/* @__PURE__ */ L(`span`,{className:`host`,children:`www.netflix.com`}),`, whose catalogue depends on your country`]}),/* @__PURE__ */ V(`li`,{children:[`TheTVDB `,/* @__PURE__ */ L(`span`,{className:`host`,children:`api4.thetvdb.com`})]}),/* @__PURE__ */ V(`li`,{children:[`trace.moe `,/* @__PURE__ */ L(`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__ */ V(`li`,{children:[`Trakt `,/* @__PURE__ */ L(`span`,{className:`host`,children:`apiz.trakt.tv`})]}),/* @__PURE__ */ V(`li`,{children:[`TVmaze `,/* @__PURE__ */ L(`span`,{className:`host`,children:`api.tvmaze.com`})]})]}),/* @__PURE__ */ L(`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.`}),/* @__PURE__ */ V(`p`,{children:[`JustWatch is asked for the streaming links of your country: the one you picked in`,` `,/* @__PURE__ */ L(kh,{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__ */ V(`p`,{children:[`Sources you add in `,/* @__PURE__ */ L(kh,{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__ */ L(`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__ */ L(`h2`,{children:`The optional browser extension`}),/* @__PURE__ */ L(`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__ */ L(`h2`,{children:`Your control`}),/* @__PURE__ */ L(`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__ */ L(`h2`,{children:`Contact`}),/* @__PURE__ */ V(`p`,{children:[`Questions about privacy can be raised through the project repository at`,` `,/* @__PURE__ */ L(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]})]});H();var UW=(e,t=e)=>{let n=new Intl.DisplayNames([t],{type:`language`}).of(e)??e;return n.charAt(0).toLocaleUpperCase(t)+n.slice(1)},WW=({saved:e,reload:t=()=>location.reload()})=>{let n=F(),[r,i]=z(!1),a=B(()=>{let{compare:e}=new Intl.Collator(n.locale);return _.map(e=>({tag:e,name:UW(e)})).sort((t,n)=>e(t.name,n.name))},[n]),o=y();return/* @__PURE__ */ L(`div`,{className:`row`,"data-setting":`language`,children:/* @__PURE__ */ V(`select`,{"aria-labelledby":`settings-section-title`,value:x()??``,disabled:r,onChange:n=>{i(!0),u(n.currentTarget.value||void 0,{saved:e,reload:t})},children:[/* @__PURE__ */ L(`option`,{value:``,children:n.formatMessage({id:`Automatic ({language})`,defaultMessage:`Automatic ({language})`},{language:UW(o)})}),a.map(({tag:e,name:t})=>/* @__PURE__ */ L(`option`,{value:e,lang:e,children:t},e))]})})};H();var GW=I`
5635
+ `,ZW=e=>e.endsWith(`.`)?e:`${e}.`,QW=()=>/* @__PURE__ */ V(UW,{children:[/* @__PURE__ */ L(`h1`,{children:`Privacy`}),/* @__PURE__ */ L(`div`,{className:`updated`,children:`Last updated 23 November 2026`}),/* @__PURE__ */ L(`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__ */ L(`h2`,{children:`What stub keeps`}),/* @__PURE__ */ V(`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__ */ L(kh,{to:`/settings#sources`,children:`Settings, under Sources`}),`. Clearing this site's data in your browser removes everything stub keeps in this browser.`]}),/* @__PURE__ */ L(`ul`,{css:YW,children:JW.map(e=>/* @__PURE__ */ V(`li`,{children:[/* @__PURE__ */ V(`strong`,{children:[e.title,`.`]}),` `,e.what,` `,/* @__PURE__ */ V(`span`,{className:`facts`,children:[`Where: `,ZW(e.where),` How long: `,ZW(e.lasts)]})]},e.id))}),/* @__PURE__ */ L(`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__ */ L(`h2`,{children:`Sign-ins to other sites`}),/* @__PURE__ */ V(`p`,{children:[`stub plays Crunchyroll and Prime Video and tracks your AniList and MyAnimeList 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__ */ L(kh,{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__ */ L(`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__ */ L(`h2`,{children:`FKN Social`}),/* @__PURE__ */ V(`p`,{children:[`If you turn on Post to FKN Social in `,/* @__PURE__ */ L(kh,{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__ */ L(`h2`,{children:`Network requests & third parties`}),/* @__PURE__ */ V(`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 and JustWatch. 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__ */ L(`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__ */ L(`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__ */ V(`ul`,{css:XW,children:[/* @__PURE__ */ V(`li`,{children:[`AniList `,/* @__PURE__ */ L(`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__ */ V(`li`,{children:[`Anime News Network `,/* @__PURE__ */ L(`span`,{className:`host`,children:`cdn.animenewsnetwork.com`})]}),/* @__PURE__ */ V(`li`,{children:[`AnimeThemes `,/* @__PURE__ */ L(`span`,{className:`host`,children:`graphql.animethemes.moe`})]}),/* @__PURE__ */ V(`li`,{children:[`AniSkip `,/* @__PURE__ */ L(`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__ */ V(`li`,{children:[`AniZip `,/* @__PURE__ */ L(`span`,{className:`host`,children:`api.ani.zip`})]}),/* @__PURE__ */ V(`li`,{children:[`Apple TV `,/* @__PURE__ */ L(`span`,{className:`host`,children:`uts-api.itunes.apple.com`})]}),/* @__PURE__ */ V(`li`,{children:[`Kitsu `,/* @__PURE__ */ L(`span`,{className:`host`,children:`kitsu.io`})]}),/* @__PURE__ */ V(`li`,{children:[`Netflix `,/* @__PURE__ */ L(`span`,{className:`host`,children:`www.netflix.com`}),`, whose catalogue depends on your country`]}),/* @__PURE__ */ V(`li`,{children:[`TheTVDB `,/* @__PURE__ */ L(`span`,{className:`host`,children:`api4.thetvdb.com`})]}),/* @__PURE__ */ V(`li`,{children:[`trace.moe `,/* @__PURE__ */ L(`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__ */ V(`li`,{children:[`Trakt `,/* @__PURE__ */ L(`span`,{className:`host`,children:`apiz.trakt.tv`})]}),/* @__PURE__ */ V(`li`,{children:[`TVmaze `,/* @__PURE__ */ L(`span`,{className:`host`,children:`api.tvmaze.com`})]})]}),/* @__PURE__ */ L(`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.`}),/* @__PURE__ */ V(`p`,{children:[`JustWatch is asked for the streaming links of your country: the one you picked in`,` `,/* @__PURE__ */ L(kh,{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__ */ V(`p`,{children:[`Sources you add in `,/* @__PURE__ */ L(kh,{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__ */ L(`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__ */ L(`h2`,{children:`The optional browser extension`}),/* @__PURE__ */ L(`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__ */ L(`h2`,{children:`Your control`}),/* @__PURE__ */ L(`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__ */ L(`h2`,{children:`Contact`}),/* @__PURE__ */ V(`p`,{children:[`Questions about privacy can be raised through the project repository at`,` `,/* @__PURE__ */ L(`a`,{href:`https://github.com/banou26/stub`,target:`_blank`,rel:`noreferrer noopener`,children:`github.com/banou26/stub`}),`.`]})]});H();var $W=(e,t=e)=>{let n=new Intl.DisplayNames([t],{type:`language`}).of(e)??e;return n.charAt(0).toLocaleUpperCase(t)+n.slice(1)},eG=({saved:e,reload:t=()=>location.reload()})=>{let n=F(),[r,i]=z(!1),a=B(()=>{let{compare:e}=new Intl.Collator(n.locale);return _.map(e=>({tag:e,name:$W(e)})).sort((t,n)=>e(t.name,n.name))},[n]),o=y();return/* @__PURE__ */ L(`div`,{className:`row`,"data-setting":`language`,children:/* @__PURE__ */ V(`select`,{"aria-labelledby":`settings-section-title`,value:x()??``,disabled:r,onChange:n=>{i(!0),u(n.currentTarget.value||void 0,{saved:e,reload:t})},children:[/* @__PURE__ */ L(`option`,{value:``,children:n.formatMessage({id:`Automatic ({language})`,defaultMessage:`Automatic ({language})`},{language:$W(o)})}),a.map(({tag:e,name:t})=>/* @__PURE__ */ L(`option`,{value:e,lang:e,children:t},e))]})})};H();var tG=I`
5599
5636
  display: flex;
5600
5637
  flex-direction: column;
5601
5638
  gap: 1rem;
@@ -5618,7 +5655,7 @@ scrollbar-gutter: stable;
5618
5655
 
5619
5656
  &:hover { border-color: rgba(255, 255, 255, 0.25); }
5620
5657
  }
5621
- `,KW=({children:e,on:t,set:n,disabled:r})=>/* @__PURE__ */ V(`label`,{className:`switch`,children:[e,/* @__PURE__ */ L(`input`,{type:`checkbox`,role:`switch`,css:qS,checked:t,disabled:r,onChange:e=>n(e.target.checked)})]}),qW=({title:e,setting:t,value:n,first:i,pick:a})=>{let o=F(),s=tt(),l=e=>UW(e,o.locale),u=B(()=>{let{compare:e}=new Intl.Collator(o.locale);return _.map(e=>({value:e,label:l(e)})).sort((t,n)=>e(t.label,n.label))},[o]),d=e=>e===i.value||_.includes(e),f=r(n??void 0),p=n===null?``:d(n)?n:f&&_.includes(f)?f:n,m=p===``||d(p)?[]:[{value:p,label:f?l(f):p}],h=c();return/* @__PURE__ */ V(`div`,{className:`row`,"data-setting":t,children:[/* @__PURE__ */ L(`div`,{className:`head`,children:/* @__PURE__ */ L(`h3`,{id:s,children:e})}),/* @__PURE__ */ V(`select`,{"aria-labelledby":s,value:p,onChange:e=>a(e.currentTarget.value||void 0),children:[/* @__PURE__ */ L(`option`,{value:``,children:o.formatMessage({id:`Automatic ({language})`,defaultMessage:`Automatic ({language})`},{language:l(ce([h],_)??h)})}),[i,...m,...u].map(e=>/* @__PURE__ */ L(`option`,{value:e.value,children:e.label},e.value))]})]})},JW=()=>{let e=F(),t=At(Ft,gn),n=At(ld,dd),r=At(()=>ve.getItem(se),N),i=At(()=>ve.getItem(re),N),a=At(()=>ve.getItem(_e)===`on`,N);return/* @__PURE__ */ V(`div`,{css:GW,children:[/* @__PURE__ */ L(KW,{on:t,set:zt,children:e.formatMessage({id:`Autoplay next episode`,defaultMessage:`Autoplay next episode`})}),/* @__PURE__ */ L(KW,{on:n,set:ud,children:e.formatMessage({id:`Open episodes in a new tab`,defaultMessage:`Open episodes in a new tab`})}),/* @__PURE__ */ L(qW,{title:e.formatMessage({id:`Audio language`,defaultMessage:`Audio language`}),setting:`audio-language`,value:r,first:{value:pe,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:le}),/* @__PURE__ */ L(qW,{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:he}),/* @__PURE__ */ L(KW,{on:a,set:w,children:e.formatMessage({id:`Always show subtitles`,defaultMessage:`Always show subtitles`})})]})},YW=Ee({sources:{id:`Sources`,defaultMessage:`Sources`},tracking:{id:`Tracking`,defaultMessage:`Tracking`},playback:{id:`Playback`,defaultMessage:`Playback`},language:{id:`Language`,defaultMessage:`Language`}}),XW=[{id:`sources`,title:YW.sources},{id:`tracking`,title:YW.tracking},{id:`playback`,title:YW.playback},{id:`language`,title:YW.language}],ZW=e=>XW.find(t=>`#${t.id}`===e)?.id??`sources`;H();var QW=({label:e,name:t=e,confirmLabel:n,busyLabel:r,question:i,onConfirm:a,home:o})=>{let s=F(),[c,l]=z(!1),[u,d]=z(!1),f=G(null),p=G(null),m=G(null),h=G(!1),g=G(!0),_=tt(),v=()=>{let e=document.activeElement;return!e||e===document.body||!!m.current?.contains(e)};return K(()=>()=>{g.current=!1,m.current&&v()&&o?.current?.focus()},[]),ht(()=>{c?p.current?.focus():h.current&&f.current?.focus(),h.current=!1},[c]),c?/* @__PURE__ */ V(`div`,{ref:m,className:`confirm`,role:`group`,"aria-label":t,children:[/* @__PURE__ */ L(`p`,{id:_,children:i}),/* @__PURE__ */ V(`div`,{className:`actions`,children:[/* @__PURE__ */ L(`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__ */ L(`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__ */ L(`button`,{ref:f,type:`button`,className:`secondary`,"aria-label":t===e?void 0:t,onClick:()=>l(!0),children:e})};H();var $W=()=>{let[e,t]=z(de);return K(()=>(t(de()),te(()=>t(de()))),[]),e},eG=()=>($W(),ae()),tG=()=>{let e=F(),t=$W(),n=tt(),r=t=>e.formatDisplayName(t,{type:`region`})??t,i=B(()=>{let{compare:t}=new Intl.Collator(e.locale);return ye.map(e=>({country:e,name:r(e)})).sort((e,n)=>t(e.name,n.name))},[e]);return/* @__PURE__ */ V(`div`,{className:`row`,"data-setting":`country`,children:[/* @__PURE__ */ L(`div`,{className:`head`,children:/* @__PURE__ */ L(`h3`,{id:n,children:e.formatMessage({id:`Country`,defaultMessage:`Country`})})}),/* @__PURE__ */ V(`select`,{"aria-labelledby":n,value:t??``,onChange:e=>j(e.currentTarget.value||void 0),children:[/* @__PURE__ */ L(`option`,{value:``,children:e.formatMessage({id:`Automatic ({country})`,defaultMessage:`Automatic ({country})`},{country:r(ee())})}),i.map(({country:e,name:t})=>/* @__PURE__ */ L(`option`,{value:e,children:t},e))]})]})};H();var nG=e=>e instanceof Error?e.message:String(e),rG=(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})}}},iG=Ee({"signed-in":{id:`Signed in`,defaultMessage:`Signed in`},"signed-out":{id:`Signed out`,defaultMessage:`Signed out`}}),aG=(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})}),oG=(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})}),sG=(e,t)=>e.formatMessage({id:`Open {host}`,defaultMessage:`Open {host}`},{host:t}),cG=(e,t)=>t?e.formatMessage({id:`Signing in...`,defaultMessage:`Signing in...`}):e.formatMessage({id:`Sign in`,defaultMessage:`Sign in`}),lG=e=>e.formatMessage({id:`Signed out.`,defaultMessage:`Signed out.`}),uG=(e,t)=>{let[,n]=z(0);return K(()=>e.watch(t,()=>n(e=>e+1)),[e,t]),e.read(t)},dG=(e,t,n)=>{K(()=>{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])},fG=({id:e,state:t,on:n,children:r})=>/* @__PURE__ */ V(`div`,{className:`account`,"data-account":e,children:[t?/* @__PURE__ */ L(`span`,{className:`state${n?` on`:``}`,children:t}):void 0,r]}),pG=({note:e})=>/* @__PURE__ */ L(`p`,{className:`note${e?.error?` error`:``}`,role:`status`,children:e?.text}),mG=()=>{let e=G(!0);return K(()=>()=>{e.current=!1},[]),e},hG=[{site:`crunchyroll`,origin:`cr`,name:`Crunchyroll`,hostFor:()=>`crunchyroll.com`,signsInOnCloud:()=>!0,checked:!0},{site:`prime`,origin:`amazon`,name:`Prime Video`,hostFor:Gt,signsInOnCloud:Pt,checked:!1}].filter(e=>ua(e.origin)),gG=(e,t,n)=>{let r=hG.find(t=>t.origin===e);return!!(r&&t===`cloud`&&r.signsInOnCloud(r.hostFor(ae()))&&n.read(r.site)?.state!==`signed-in`)},_G=(e,t)=>{let n=hG.find(t=>t.origin===e);return!!(n&&t.read(n.site)?.state===`signed-in`)},vG=(e,t)=>{let n=hG.find(t=>t.origin===e),r=n&&t.read(n.site);return!!n&&r?.state!==`signed-in`&&!r?.signedInBefore},yG=({site:e,name:t,hostFor:n,signsInOnCloud:r,checked:i,account:a,heading:o,backend:s,status:c})=>{let l=F(),u=n(eG()),[d,f]=z(!1),[p,m]=z(),h=mG(),g=uG(c,e);dG(c,s,i&&s===`cloud`&&g!==void 0);let _=()=>{let e=a.signIn();f(!0),m(void 0),e.then(e=>{h.current&&m(rG(l,t,e))}).catch(e=>{h.current&&m({text:nG(e),error:!0})}).finally(()=>{h.current&&f(!1)})},v=()=>a.signOut().then(()=>{h.current&&m({text:lG(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:nG(e)});h.current&&m({text:n,error:!0})}),y=s===`cloud`&&r(u),b=g?.state??(y?`signed-out`:void 0);return/* @__PURE__ */ V(fG,{id:e,state:b&&l.formatMessage(iG[b]),on:b===`signed-in`,children:[y?/* @__PURE__ */ L(`div`,{className:`actions`,children:b===`signed-in`?/* @__PURE__ */ L(QW,{...aG(l,t),home:o,onConfirm:v}):/* @__PURE__ */ L(`button`,{type:`button`,disabled:d,onClick:_,children:cG(l,d)})}):s?/* @__PURE__ */ L(`div`,{className:`actions`,children:/* @__PURE__ */ L(`a`,{className:`link`,href:`https://www.${u}`,target:`_blank`,rel:`noreferrer`,children:sG(l,u)})}):/* @__PURE__ */ L(`p`,{children:l.formatMessage({id:`Loading...`,defaultMessage:`Loading...`})}),/* @__PURE__ */ L(pG,{note:p})]})},bG=[{site:`anilist`,name:`AniList`,host:`anilist.co`},{site:`mal`,name:`MyAnimeList`,host:`myanimelist.net`}].filter(e=>ua(e.site)),xG=({site:e,name:t,host:n,heading:r,backend:i,sites:a,status:o})=>{let s=F(),[c,l]=z(()=>a.isConnected(e)),[u,d]=z(!1),[f,p]=z(),m=mG(),h=uG(o,e),g=c&&h?.state!==`signed-out`;K(()=>(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(rG(s,t,e))}).catch(e=>{m.current&&p({text:nG(e),error:!0})}).finally(()=>{m.current&&d(!1),_()})},y=n=>a.signOut(e,n).then(()=>{m.current&&p({text:n===`cloud`?lG(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:nG(e)});m.current&&p({text:n,error:!0}),_()});return/* @__PURE__ */ V(fG,{id:e,state:c?h&&s.formatMessage(iG[h.state]):s.formatMessage({id:`Not connected`,defaultMessage:`Not connected`}),on:g,children:[i?/* @__PURE__ */ L(`div`,{className:`actions`,children:g?/* @__PURE__ */ L(QW,{...i===`cloud`?aG(s,t):oG(s,t),home:r,onConfirm:()=>y(i)}):i===`extension`&&c?/* @__PURE__ */ L(`a`,{className:`link`,href:`https://${n}`,target:`_blank`,rel:`noreferrer`,children:sG(s,n)}):/* @__PURE__ */ L(`button`,{type:`button`,disabled:u,onClick:v,children:u||i===`cloud`?cG(s,u):s.formatMessage({id:`Connect`,defaultMessage:`Connect`})})}):void 0,/* @__PURE__ */ L(pG,{note:f})]})},SG=({backend:e})=>{let t=F();return/* @__PURE__ */ L(fG,{id:`netflix`,children:e===`extension`?/* @__PURE__ */ L(`div`,{className:`actions`,children:/* @__PURE__ */ L(`a`,{className:`link`,href:`https://www.netflix.com`,target:`_blank`,rel:`noreferrer`,children:sG(t,`netflix.com`)})}):/* @__PURE__ */ L(`p`,{children:t.formatMessage({id:`Needs the FKN browser extension.`,defaultMessage:`Needs the FKN browser extension.`})})})},CG=({origin:e,heading:t,backend:n,sites:r,status:i,...a})=>{let o=hG.find(t=>t.origin===e);if(o)return/* @__PURE__ */ L(yG,{...o,account:a[o.site],heading:t,backend:n,status:i});let s=bG.find(t=>t.site===e);return s?/* @__PURE__ */ L(xG,{...s,heading:t,backend:n,sites:r,status:i}):e===`nf`?/* @__PURE__ */ L(SG,{backend:n}):null},wG=4,TG=48,EG=8,DG=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<TG?-8:o.clientY>innerHeight-TG?EG: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)>wG)&&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})};H();var OG=I`
5658
+ `,nG=({children:e,on:t,set:n,disabled:r})=>/* @__PURE__ */ V(`label`,{className:`switch`,children:[e,/* @__PURE__ */ L(`input`,{type:`checkbox`,role:`switch`,css:qS,checked:t,disabled:r,onChange:e=>n(e.target.checked)})]}),rG=({title:e,setting:t,value:n,first:i,pick:a})=>{let o=F(),s=tt(),l=e=>$W(e,o.locale),u=B(()=>{let{compare:e}=new Intl.Collator(o.locale);return _.map(e=>({value:e,label:l(e)})).sort((t,n)=>e(t.label,n.label))},[o]),d=e=>e===i.value||_.includes(e),f=r(n??void 0),p=n===null?``:d(n)?n:f&&_.includes(f)?f:n,m=p===``||d(p)?[]:[{value:p,label:f?l(f):p}],h=c();return/* @__PURE__ */ V(`div`,{className:`row`,"data-setting":t,children:[/* @__PURE__ */ L(`div`,{className:`head`,children:/* @__PURE__ */ L(`h3`,{id:s,children:e})}),/* @__PURE__ */ V(`select`,{"aria-labelledby":s,value:p,onChange:e=>a(e.currentTarget.value||void 0),children:[/* @__PURE__ */ L(`option`,{value:``,children:o.formatMessage({id:`Automatic ({language})`,defaultMessage:`Automatic ({language})`},{language:l(ce([h],_)??h)})}),[i,...m,...u].map(e=>/* @__PURE__ */ L(`option`,{value:e.value,children:e.label},e.value))]})]})},iG=()=>{let e=F(),t=At(Ft,gn),n=At(ld,dd),r=At(()=>ve.getItem(se),N),i=At(()=>ve.getItem(re),N),a=At(()=>ve.getItem(_e)===`on`,N);return/* @__PURE__ */ V(`div`,{css:tG,children:[/* @__PURE__ */ L(nG,{on:t,set:zt,children:e.formatMessage({id:`Autoplay next episode`,defaultMessage:`Autoplay next episode`})}),/* @__PURE__ */ L(nG,{on:n,set:ud,children:e.formatMessage({id:`Open episodes in a new tab`,defaultMessage:`Open episodes in a new tab`})}),/* @__PURE__ */ L(rG,{title:e.formatMessage({id:`Audio language`,defaultMessage:`Audio language`}),setting:`audio-language`,value:r,first:{value:pe,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:le}),/* @__PURE__ */ L(rG,{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:he}),/* @__PURE__ */ L(nG,{on:a,set:w,children:e.formatMessage({id:`Always show subtitles`,defaultMessage:`Always show subtitles`})})]})},aG=Ee({sources:{id:`Sources`,defaultMessage:`Sources`},tracking:{id:`Tracking`,defaultMessage:`Tracking`},playback:{id:`Playback`,defaultMessage:`Playback`},language:{id:`Language`,defaultMessage:`Language`}}),oG=[{id:`sources`,title:aG.sources},{id:`tracking`,title:aG.tracking},{id:`playback`,title:aG.playback},{id:`language`,title:aG.language}],sG=e=>oG.find(t=>`#${t.id}`===e)?.id??`sources`;H();var cG=({label:e,name:t=e,confirmLabel:n,busyLabel:r,question:i,onConfirm:a,home:o})=>{let s=F(),[c,l]=z(!1),[u,d]=z(!1),f=G(null),p=G(null),m=G(null),h=G(!1),g=G(!0),_=tt(),v=()=>{let e=document.activeElement;return!e||e===document.body||!!m.current?.contains(e)};return K(()=>()=>{g.current=!1,m.current&&v()&&o?.current?.focus()},[]),ht(()=>{c?p.current?.focus():h.current&&f.current?.focus(),h.current=!1},[c]),c?/* @__PURE__ */ V(`div`,{ref:m,className:`confirm`,role:`group`,"aria-label":t,children:[/* @__PURE__ */ L(`p`,{id:_,children:i}),/* @__PURE__ */ V(`div`,{className:`actions`,children:[/* @__PURE__ */ L(`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__ */ L(`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__ */ L(`button`,{ref:f,type:`button`,className:`secondary`,"aria-label":t===e?void 0:t,onClick:()=>l(!0),children:e})};H();var lG=()=>{let[e,t]=z(de);return K(()=>(t(de()),te(()=>t(de()))),[]),e},uG=()=>(lG(),ae()),dG=()=>{let e=F(),t=lG(),n=tt(),r=t=>e.formatDisplayName(t,{type:`region`})??t,i=B(()=>{let{compare:t}=new Intl.Collator(e.locale);return ye.map(e=>({country:e,name:r(e)})).sort((e,n)=>t(e.name,n.name))},[e]);return/* @__PURE__ */ V(`div`,{className:`row`,"data-setting":`country`,children:[/* @__PURE__ */ L(`div`,{className:`head`,children:/* @__PURE__ */ L(`h3`,{id:n,children:e.formatMessage({id:`Country`,defaultMessage:`Country`})})}),/* @__PURE__ */ V(`select`,{"aria-labelledby":n,value:t??``,onChange:e=>j(e.currentTarget.value||void 0),children:[/* @__PURE__ */ L(`option`,{value:``,children:e.formatMessage({id:`Automatic ({country})`,defaultMessage:`Automatic ({country})`},{country:r(ee())})}),i.map(({country:e,name:t})=>/* @__PURE__ */ L(`option`,{value:e,children:t},e))]})]})};H();var fG=e=>e instanceof Error?e.message:String(e),pG=(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})}}},mG=Ee({"signed-in":{id:`Signed in`,defaultMessage:`Signed in`},"signed-out":{id:`Signed out`,defaultMessage:`Signed out`}}),hG=(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})}),gG=(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})}),_G=(e,t)=>e.formatMessage({id:`Open {host}`,defaultMessage:`Open {host}`},{host:t}),vG=(e,t)=>t?e.formatMessage({id:`Signing in...`,defaultMessage:`Signing in...`}):e.formatMessage({id:`Sign in`,defaultMessage:`Sign in`}),yG=e=>e.formatMessage({id:`Signed out.`,defaultMessage:`Signed out.`}),bG=(e,t)=>{let[,n]=z(0);return K(()=>e.watch(t,()=>n(e=>e+1)),[e,t]),e.read(t)},xG=(e,t,n)=>{K(()=>{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])},SG=({id:e,state:t,on:n,children:r})=>/* @__PURE__ */ V(`div`,{className:`account`,"data-account":e,children:[t?/* @__PURE__ */ L(`span`,{className:`state${n?` on`:``}`,children:t}):void 0,r]}),CG=({note:e})=>/* @__PURE__ */ L(`p`,{className:`note${e?.error?` error`:``}`,role:`status`,children:e?.text}),wG=()=>{let e=G(!0);return K(()=>()=>{e.current=!1},[]),e},TG=[{site:`crunchyroll`,origin:`cr`,name:`Crunchyroll`,hostFor:()=>`crunchyroll.com`,signsInOnCloud:()=>!0,checked:!0},{site:`prime`,origin:`amazon`,name:`Prime Video`,hostFor:Gt,signsInOnCloud:Pt,checked:!1}].filter(e=>ua(e.origin)),EG=(e,t,n)=>{let r=TG.find(t=>t.origin===e);return!!(r&&t===`cloud`&&r.signsInOnCloud(r.hostFor(ae()))&&n.read(r.site)?.state!==`signed-in`)},DG=(e,t)=>{let n=TG.find(t=>t.origin===e);return!!(n&&t.read(n.site)?.state===`signed-in`)},OG=(e,t)=>{let n=TG.find(t=>t.origin===e),r=n&&t.read(n.site);return!!n&&r?.state!==`signed-in`&&!r?.signedInBefore},kG=({site:e,name:t,hostFor:n,signsInOnCloud:r,checked:i,account:a,heading:o,backend:s,status:c})=>{let l=F(),u=n(uG()),[d,f]=z(!1),[p,m]=z(),h=wG(),g=bG(c,e);xG(c,s,i&&s===`cloud`&&g!==void 0);let _=()=>{let e=a.signIn();f(!0),m(void 0),e.then(e=>{h.current&&m(pG(l,t,e))}).catch(e=>{h.current&&m({text:fG(e),error:!0})}).finally(()=>{h.current&&f(!1)})},v=()=>a.signOut().then(()=>{h.current&&m({text:yG(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:fG(e)});h.current&&m({text:n,error:!0})}),y=s===`cloud`&&r(u),b=g?.state??(y?`signed-out`:void 0);return/* @__PURE__ */ V(SG,{id:e,state:b&&l.formatMessage(mG[b]),on:b===`signed-in`,children:[y?/* @__PURE__ */ L(`div`,{className:`actions`,children:b===`signed-in`?/* @__PURE__ */ L(cG,{...hG(l,t),home:o,onConfirm:v}):/* @__PURE__ */ L(`button`,{type:`button`,disabled:d,onClick:_,children:vG(l,d)})}):s?/* @__PURE__ */ L(`div`,{className:`actions`,children:/* @__PURE__ */ L(`a`,{className:`link`,href:`https://www.${u}`,target:`_blank`,rel:`noreferrer`,children:_G(l,u)})}):/* @__PURE__ */ L(`p`,{children:l.formatMessage({id:`Loading...`,defaultMessage:`Loading...`})}),/* @__PURE__ */ L(CG,{note:p})]})},AG=[{site:`anilist`,name:`AniList`,host:`anilist.co`},{site:`mal`,name:`MyAnimeList`,host:`myanimelist.net`}].filter(e=>ua(e.site)),jG=({site:e,name:t,host:n,heading:r,backend:i,sites:a,status:o})=>{let s=F(),[c,l]=z(()=>a.isConnected(e)),[u,d]=z(!1),[f,p]=z(),m=wG(),h=bG(o,e),g=c&&h?.state!==`signed-out`;K(()=>(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(pG(s,t,e))}).catch(e=>{m.current&&p({text:fG(e),error:!0})}).finally(()=>{m.current&&d(!1),_()})},y=n=>a.signOut(e,n).then(()=>{m.current&&p({text:n===`cloud`?yG(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:fG(e)});m.current&&p({text:n,error:!0}),_()});return/* @__PURE__ */ V(SG,{id:e,state:c?h&&s.formatMessage(mG[h.state]):s.formatMessage({id:`Not connected`,defaultMessage:`Not connected`}),on:g,children:[i?/* @__PURE__ */ L(`div`,{className:`actions`,children:g?/* @__PURE__ */ L(cG,{...i===`cloud`?hG(s,t):gG(s,t),home:r,onConfirm:()=>y(i)}):i===`extension`&&c?/* @__PURE__ */ L(`a`,{className:`link`,href:`https://${n}`,target:`_blank`,rel:`noreferrer`,children:_G(s,n)}):/* @__PURE__ */ L(`button`,{type:`button`,disabled:u,onClick:v,children:u||i===`cloud`?vG(s,u):s.formatMessage({id:`Connect`,defaultMessage:`Connect`})})}):void 0,/* @__PURE__ */ L(CG,{note:f})]})},MG=({backend:e})=>{let t=F();return/* @__PURE__ */ L(SG,{id:`netflix`,children:e===`extension`?/* @__PURE__ */ L(`div`,{className:`actions`,children:/* @__PURE__ */ L(`a`,{className:`link`,href:`https://www.netflix.com`,target:`_blank`,rel:`noreferrer`,children:_G(t,`netflix.com`)})}):/* @__PURE__ */ L(`p`,{children:t.formatMessage({id:`Needs the FKN browser extension.`,defaultMessage:`Needs the FKN browser extension.`})})})},NG=({origin:e,heading:t,backend:n,sites:r,status:i,...a})=>{let o=TG.find(t=>t.origin===e);if(o)return/* @__PURE__ */ L(kG,{...o,account:a[o.site],heading:t,backend:n,status:i});let s=AG.find(t=>t.site===e);return s?/* @__PURE__ */ L(jG,{...s,heading:t,backend:n,sites:r,status:i}):e===`nf`?/* @__PURE__ */ L(MG,{backend:n}):null},PG=4,FG=48,IG=8,LG=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<FG?-8:o.clientY>innerHeight-FG?IG: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)>PG)&&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})};H();var RG=I`
5622
5659
  h3.part {
5623
5660
  font-size: 1.3rem;
5624
5661
  font-weight: 700;
@@ -5944,9 +5981,9 @@ scrollbar-gutter: stable;
5944
5981
  .group button:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.8); outline-offset: 0; }
5945
5982
 
5946
5983
  .by-address .note { font-size: 1.35rem; overflow-wrap: anywhere; }
5947
- `,kG=Ee({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`}}),AG=Ee({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`}}),jG=`npm:@scope/package`,MG={text:`text`,url:`url`,secret:`password`},NG=({uri:e,name:t,fields:n})=>{let r=F(),[i,a]=z(()=>fc(e)),[o,s]=z({}),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 K(()=>{let t=()=>a(fc(e));return t(),cu(t)},[e]),/* @__PURE__ */ V(`form`,{onSubmit:t=>{t.preventDefault(),u&&(a(l),s({}),Uu(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__ */ V(`label`,{children:[t,/* @__PURE__ */ L(`input`,{type:MG[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__ */ L(`p`,{className:`failure`,children:r.formatMessage({id:`Required: {fields}`,defaultMessage:`Required: {fields}`},{fields:r.formatList(d,nn)})}):void 0,/* @__PURE__ */ L(`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`})})]})},PG=({plugin:e,onRemove:t})=>{let n=F(),r=e.sources??[],i=pC(n,e),a=e.temporary?n.formatMessage({id:`Temporary`,defaultMessage:`Temporary`}):void 0,o=xn([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__ */ V(`li`,{className:`row plugin`,"data-plugin":e.uri,children:[/* @__PURE__ */ V(`div`,{className:`info`,children:[/* @__PURE__ */ L(`span`,{className:`name`,children:i}),r.length?/* @__PURE__ */ V(`span`,{className:`meta`,children:[/* @__PURE__ */ L(`span`,{className:`uri`,children:e.uri}),s]}):a&&/* @__PURE__ */ L(`span`,{className:`meta`,children:a})]}),/* @__PURE__ */ V(`span`,{className:`pill`,"data-state":e.state,children:[/* @__PURE__ */ L(`span`,{className:`dot`,"aria-hidden":`true`}),n.formatMessage(kG[e.state])]}),/* @__PURE__ */ L(`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__ */ L(`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__ */ L(NG,{uri:e.uri,name:i,fields:e.settings}):void 0]})},FG=e=>{let{host:t,pathname:n}=new URL(e);return t.replace(/^www\./,``)+n.replace(/\/$/,``)},IG=Nh.map(e=>({origin:e.origin,name:e.name,from:FG(e.url),icon:e.icon,drawn:Fh(e.origin),asked:ua(e.origin)})).filter(e=>e.asked||e.drawn),LG=e=>e.flatMap(e=>e.state===`connected`?(e.sources??[]).map(t=>({origin:t.origin,name:t.name,from:e.uri,icon:t.icon,drawn:t.isApiOnly?void 0:t.origin,asked:!0})):[]),RG=({card:e,on:t,shown:n,accounts:r,place:i,grab:a,brief:o,children:s})=>{let c=F(),l=G(null);return/* @__PURE__ */ V(`li`,{className:`card${o?` brief`:``}${t?``:` off`}`,"data-source":e.origin,children:[/* @__PURE__ */ V(`div`,{className:`top`,children:[a?/* @__PURE__ */ L(`span`,{className:`grip`,"aria-hidden":`true`,onPointerDown:a,children:/* @__PURE__ */ L(Bb,{})}):void 0,i?/* @__PURE__ */ L(`span`,{className:`place`,"aria-hidden":`true`,children:i}):void 0,/* @__PURE__ */ L(`span`,{className:`icon`,children:e.icon?/* @__PURE__ */ L(gw,{icon:e.icon,name:e.name}):/* @__PURE__ */ L(`span`,{className:`letter`,"aria-hidden":`true`,children:e.name.charAt(0)})}),/* @__PURE__ */ V(`div`,{className:`title`,children:[/* @__PURE__ */ L(`h4`,{ref:l,tabIndex:-1,children:e.name}),/* @__PURE__ */ L(`span`,{className:`from`,children:e.from})]}),s?/* @__PURE__ */ L(`div`,{className:`order`,children:s}):void 0]}),o?void 0:/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`div`,{className:`switches`,children:[e.asked?/* @__PURE__ */ V(`label`,{children:[c.formatMessage({id:`Source#switch using a source`,defaultMessage:`Source`,description:`switch using a source`}),/* @__PURE__ */ L(`input`,{type:`checkbox`,role:`switch`,css:qS,"aria-label":c.formatMessage({id:`{name} source`,defaultMessage:`{name} source`},{name:e.name}),checked:t,onChange:t=>Ln(e.origin,t.target.checked)})]}):void 0,e.drawn?/* @__PURE__ */ V(`label`,{children:[c.formatMessage({id:`Icon#switch showing a source icon`,defaultMessage:`Icon`,description:`switch showing a source icon`}),/* @__PURE__ */ L(`input`,{type:`checkbox`,role:`switch`,css:qS,"aria-label":c.formatMessage({id:`{name} icon`,defaultMessage:`{name} icon`},{name:e.name}),checked:n,onChange:t=>qu(e.drawn,t.target.checked)})]}):void 0]}),/* @__PURE__ */ L(CG,{origin:e.origin,heading:l,...r})]})]})},zG=e=>{let t=F(),[n,r]=z(du),[i,a]=z(()=>new Set(kn())),[o,s]=z(Qu),[c,l]=z(On),u=Yu(),[d,f]=z(``),[p,m]=z(!1),[h,g]=z(``),_=tt(),v=()=>r(du());K(()=>(v(),cu(v)),[]),K(()=>En(()=>a(new Set(kn()))),[]),K(()=>ed(()=>s(Qu())),[]),K(()=>cr(()=>l(On())),[]);let y=LG(n),b=[...IG.filter(e=>e.asked&&Zu.includes(e.origin)),...y],x=td(o,y.map(e=>e.origin)),S=x.flatMap(e=>b.filter(t=>t.origin===e)),C=Bn(c),w=C.flatMap(e=>IG.filter(t=>t.origin===e&&t.asked)),T=IG.filter(e=>!b.includes(e)&&!w.includes(e)),E=[...S,...w.filter(e=>!b.includes(e)),...T].filter(e=>e.asked),D=E.filter(e=>i.has(e.origin)).length,O=G(void 0);ht(()=>{O.current?.focus(),O.current=void 0});let k={cards:S,order:x,write:$u,up:AG.up,down:AG.down},A={cards:w,order:C,write:Vn,up:AG.mergeUp,down:AG.mergeDown},j=(e,n,r,i)=>{let a=n<0?r===0:r===i.cards.length-1;return/* @__PURE__ */ L(`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||(O.current=t.currentTarget,i.write(nd(i.order,e.origin,n,i.cards.map(e=>e.origin))))},children:L(n<0?Ob:Db,{})})},ee=(e,t,n)=>DG(r=>n.write(nd(n.order,e.origin,r-t,n.cards.map(e=>e.origin)))),M=(t,n,r=0)=>/* @__PURE__ */ L(RG,{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?ee(t,r,n):void 0,brief:n===A&&b.includes(t),children:n?/* @__PURE__ */ V(W,{children:[j(t,-1,r,n),j(t,1,r,n)]}):void 0},t.origin);return/* @__PURE__ */ V(`div`,{css:OG,children:[/* @__PURE__ */ L(`div`,{className:`rows`,children:/* @__PURE__ */ L(tG,{})}),/* @__PURE__ */ V(`div`,{className:`part-head`,children:[/* @__PURE__ */ L(`span`,{className:`count`,children:D?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:E.length-D,count:E.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:E.length})}),/* @__PURE__ */ L(`button`,{type:`button`,className:`link-button`,"aria-disabled":!D||void 0,onClick:()=>{D&&Zn(E.map(e=>e.origin))},children:t.formatMessage({id:`Turn all on`,defaultMessage:`Turn all on`})})]}),/* @__PURE__ */ L(`h3`,{className:`part`,children:t.formatMessage({id:`Play order`,defaultMessage:`Play order`})}),/* @__PURE__ */ L(`ol`,{className:`cards play-order`,children:S.map((e,t)=>M(e,k,t))}),/* @__PURE__ */ L(`h3`,{className:`part`,children:t.formatMessage({id:`Merge order`,defaultMessage:`Merge order`})}),/* @__PURE__ */ L(`ol`,{className:`cards merge-order`,children:w.map((e,t)=>M(e,A,t))}),/* @__PURE__ */ L(`h3`,{className:`part`,children:t.formatMessage({id:`Other sources`,defaultMessage:`Other sources`})}),/* @__PURE__ */ L(`ul`,{className:`cards`,children:T.map(e=>M(e))}),/* @__PURE__ */ L(`h3`,{className:`part`,children:t.formatMessage({id:`Added#sources the viewer added`,defaultMessage:`Added`,description:`sources the viewer added`})}),n.length?/* @__PURE__ */ L(`ul`,{className:`rows`,children:n.map(e=>/* @__PURE__ */ L(PG,{plugin:e,onRemove:()=>{Hu(e.uri).then(v)}},e.uri))}):/* @__PURE__ */ L(`p`,{className:`row empty`,children:t.formatMessage({id:`No sources added yet.`,defaultMessage:`No sources added yet.`})}),/* @__PURE__ */ V(`div`,{className:`add`,children:[/* @__PURE__ */ L(`div`,{className:`browse`,children:/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>{Wu().finally(v)},children:t.formatMessage({id:`Browse sources`,defaultMessage:`Browse sources`})})}),/* @__PURE__ */ V(`form`,{className:`by-address`,onSubmit:e=>{e.preventDefault();let n=d.trim();n&&!p&&(m(!0),g(``),Ru(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__ */ L(`label`,{for:`${_}-address`,children:t.formatMessage({id:`Or add one by its address`,defaultMessage:`Or add one by its address`})}),/* @__PURE__ */ V(`div`,{className:`group${h?` invalid`:``}`,children:[/* @__PURE__ */ L(`input`,{id:`${_}-address`,type:`text`,autoComplete:`off`,spellcheck:!1,placeholder:jG,"aria-invalid":h?!0:void 0,"aria-describedby":`${_}-error`,value:d,onInput:e=>f(e.target.value)}),/* @__PURE__ */ L(`button`,{type:`submit`,disabled:p,children:p?t.formatMessage({id:`Adding...`,defaultMessage:`Adding...`}):t.formatMessage({id:`Add`,defaultMessage:`Add`})})]}),/* @__PURE__ */ L(`p`,{className:`note error`,id:`${_}-error`,role:`alert`,children:h})]})]})]})};H();var BG=I`
5984
+ `,zG=Ee({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`}}),BG=Ee({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`}}),VG=`npm:@scope/package`,HG={text:`text`,url:`url`,secret:`password`},UG=({uri:e,name:t,fields:n})=>{let r=F(),[i,a]=z(()=>fc(e)),[o,s]=z({}),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 K(()=>{let t=()=>a(fc(e));return t(),cu(t)},[e]),/* @__PURE__ */ V(`form`,{onSubmit:t=>{t.preventDefault(),u&&(a(l),s({}),Uu(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__ */ V(`label`,{children:[t,/* @__PURE__ */ L(`input`,{type:HG[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__ */ L(`p`,{className:`failure`,children:r.formatMessage({id:`Required: {fields}`,defaultMessage:`Required: {fields}`},{fields:r.formatList(d,nn)})}):void 0,/* @__PURE__ */ L(`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`})})]})},WG=({plugin:e,onRemove:t})=>{let n=F(),r=e.sources??[],i=pC(n,e),a=e.temporary?n.formatMessage({id:`Temporary`,defaultMessage:`Temporary`}):void 0,o=xn([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__ */ V(`li`,{className:`row plugin`,"data-plugin":e.uri,children:[/* @__PURE__ */ V(`div`,{className:`info`,children:[/* @__PURE__ */ L(`span`,{className:`name`,children:i}),r.length?/* @__PURE__ */ V(`span`,{className:`meta`,children:[/* @__PURE__ */ L(`span`,{className:`uri`,children:e.uri}),s]}):a&&/* @__PURE__ */ L(`span`,{className:`meta`,children:a})]}),/* @__PURE__ */ V(`span`,{className:`pill`,"data-state":e.state,children:[/* @__PURE__ */ L(`span`,{className:`dot`,"aria-hidden":`true`}),n.formatMessage(zG[e.state])]}),/* @__PURE__ */ L(`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__ */ L(`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__ */ L(UG,{uri:e.uri,name:i,fields:e.settings}):void 0]})},GG=e=>{let{host:t,pathname:n}=new URL(e);return t.replace(/^www\./,``)+n.replace(/\/$/,``)},KG=Nh.map(e=>({origin:e.origin,name:e.name,from:GG(e.url),icon:e.icon,drawn:Fh(e.origin),asked:ua(e.origin)})).filter(e=>e.asked||e.drawn),qG=e=>e.flatMap(e=>e.state===`connected`?(e.sources??[]).map(t=>({origin:t.origin,name:t.name,from:e.uri,icon:t.icon,drawn:t.isApiOnly?void 0:t.origin,asked:!0})):[]),JG=({card:e,on:t,shown:n,accounts:r,place:i,grab:a,brief:o,children:s})=>{let c=F(),l=G(null);return/* @__PURE__ */ V(`li`,{className:`card${o?` brief`:``}${t?``:` off`}`,"data-source":e.origin,children:[/* @__PURE__ */ V(`div`,{className:`top`,children:[a?/* @__PURE__ */ L(`span`,{className:`grip`,"aria-hidden":`true`,onPointerDown:a,children:/* @__PURE__ */ L(Bb,{})}):void 0,i?/* @__PURE__ */ L(`span`,{className:`place`,"aria-hidden":`true`,children:i}):void 0,/* @__PURE__ */ L(`span`,{className:`icon`,children:e.icon?/* @__PURE__ */ L(gw,{icon:e.icon,name:e.name}):/* @__PURE__ */ L(`span`,{className:`letter`,"aria-hidden":`true`,children:e.name.charAt(0)})}),/* @__PURE__ */ V(`div`,{className:`title`,children:[/* @__PURE__ */ L(`h4`,{ref:l,tabIndex:-1,children:e.name}),/* @__PURE__ */ L(`span`,{className:`from`,children:e.from})]}),s?/* @__PURE__ */ L(`div`,{className:`order`,children:s}):void 0]}),o?void 0:/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`div`,{className:`switches`,children:[e.asked?/* @__PURE__ */ V(`label`,{children:[c.formatMessage({id:`Source#switch using a source`,defaultMessage:`Source`,description:`switch using a source`}),/* @__PURE__ */ L(`input`,{type:`checkbox`,role:`switch`,css:qS,"aria-label":c.formatMessage({id:`{name} source`,defaultMessage:`{name} source`},{name:e.name}),checked:t,onChange:t=>Ln(e.origin,t.target.checked)})]}):void 0,e.drawn?/* @__PURE__ */ V(`label`,{children:[c.formatMessage({id:`Icon#switch showing a source icon`,defaultMessage:`Icon`,description:`switch showing a source icon`}),/* @__PURE__ */ L(`input`,{type:`checkbox`,role:`switch`,css:qS,"aria-label":c.formatMessage({id:`{name} icon`,defaultMessage:`{name} icon`},{name:e.name}),checked:n,onChange:t=>qu(e.drawn,t.target.checked)})]}):void 0]}),/* @__PURE__ */ L(NG,{origin:e.origin,heading:l,...r})]})]})},YG=e=>{let t=F(),[n,r]=z(du),[i,a]=z(()=>new Set(kn())),[o,s]=z(Qu),[c,l]=z(On),u=Yu(),[d,f]=z(``),[p,m]=z(!1),[h,g]=z(``),_=tt(),v=()=>r(du());K(()=>(v(),cu(v)),[]),K(()=>En(()=>a(new Set(kn()))),[]),K(()=>ed(()=>s(Qu())),[]),K(()=>cr(()=>l(On())),[]);let y=qG(n),b=[...KG.filter(e=>e.asked&&Zu.includes(e.origin)),...y],x=td(o,y.map(e=>e.origin)),S=x.flatMap(e=>b.filter(t=>t.origin===e)),C=Bn(c),w=C.flatMap(e=>KG.filter(t=>t.origin===e&&t.asked)),T=KG.filter(e=>!b.includes(e)&&!w.includes(e)),E=[...S,...w.filter(e=>!b.includes(e)),...T].filter(e=>e.asked),D=E.filter(e=>i.has(e.origin)).length,O=G(void 0);ht(()=>{O.current?.focus(),O.current=void 0});let k={cards:S,order:x,write:$u,up:BG.up,down:BG.down},A={cards:w,order:C,write:Vn,up:BG.mergeUp,down:BG.mergeDown},j=(e,n,r,i)=>{let a=n<0?r===0:r===i.cards.length-1;return/* @__PURE__ */ L(`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||(O.current=t.currentTarget,i.write(nd(i.order,e.origin,n,i.cards.map(e=>e.origin))))},children:L(n<0?Ob:Db,{})})},ee=(e,t,n)=>LG(r=>n.write(nd(n.order,e.origin,r-t,n.cards.map(e=>e.origin)))),M=(t,n,r=0)=>/* @__PURE__ */ L(JG,{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?ee(t,r,n):void 0,brief:n===A&&b.includes(t),children:n?/* @__PURE__ */ V(W,{children:[j(t,-1,r,n),j(t,1,r,n)]}):void 0},t.origin);return/* @__PURE__ */ V(`div`,{css:RG,children:[/* @__PURE__ */ L(`div`,{className:`rows`,children:/* @__PURE__ */ L(dG,{})}),/* @__PURE__ */ V(`div`,{className:`part-head`,children:[/* @__PURE__ */ L(`span`,{className:`count`,children:D?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:E.length-D,count:E.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:E.length})}),/* @__PURE__ */ L(`button`,{type:`button`,className:`link-button`,"aria-disabled":!D||void 0,onClick:()=>{D&&Zn(E.map(e=>e.origin))},children:t.formatMessage({id:`Turn all on`,defaultMessage:`Turn all on`})})]}),/* @__PURE__ */ L(`h3`,{className:`part`,children:t.formatMessage({id:`Play order`,defaultMessage:`Play order`})}),/* @__PURE__ */ L(`ol`,{className:`cards play-order`,children:S.map((e,t)=>M(e,k,t))}),/* @__PURE__ */ L(`h3`,{className:`part`,children:t.formatMessage({id:`Merge order`,defaultMessage:`Merge order`})}),/* @__PURE__ */ L(`ol`,{className:`cards merge-order`,children:w.map((e,t)=>M(e,A,t))}),/* @__PURE__ */ L(`h3`,{className:`part`,children:t.formatMessage({id:`Other sources`,defaultMessage:`Other sources`})}),/* @__PURE__ */ L(`ul`,{className:`cards`,children:T.map(e=>M(e))}),/* @__PURE__ */ L(`h3`,{className:`part`,children:t.formatMessage({id:`Added#sources the viewer added`,defaultMessage:`Added`,description:`sources the viewer added`})}),n.length?/* @__PURE__ */ L(`ul`,{className:`rows`,children:n.map(e=>/* @__PURE__ */ L(WG,{plugin:e,onRemove:()=>{Hu(e.uri).then(v)}},e.uri))}):/* @__PURE__ */ L(`p`,{className:`row empty`,children:t.formatMessage({id:`No sources added yet.`,defaultMessage:`No sources added yet.`})}),/* @__PURE__ */ V(`div`,{className:`add`,children:[/* @__PURE__ */ L(`div`,{className:`browse`,children:/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>{Wu().finally(v)},children:t.formatMessage({id:`Browse sources`,defaultMessage:`Browse sources`})})}),/* @__PURE__ */ V(`form`,{className:`by-address`,onSubmit:e=>{e.preventDefault();let n=d.trim();n&&!p&&(m(!0),g(``),Ru(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__ */ L(`label`,{for:`${_}-address`,children:t.formatMessage({id:`Or add one by its address`,defaultMessage:`Or add one by its address`})}),/* @__PURE__ */ V(`div`,{className:`group${h?` invalid`:``}`,children:[/* @__PURE__ */ L(`input`,{id:`${_}-address`,type:`text`,autoComplete:`off`,spellcheck:!1,placeholder:VG,"aria-invalid":h?!0:void 0,"aria-describedby":`${_}-error`,value:d,onInput:e=>f(e.target.value)}),/* @__PURE__ */ L(`button`,{type:`submit`,disabled:p,children:p?t.formatMessage({id:`Adding...`,defaultMessage:`Adding...`}):t.formatMessage({id:`Add`,defaultMessage:`Add`})})]}),/* @__PURE__ */ L(`p`,{className:`note error`,id:`${_}-error`,role:`alert`,children:h})]})]})]})};H();var XG=I`
5948
5985
  .line { align-self: flex-start; padding: 0 1.6rem; font-size: 1.4rem; }
5949
- `,VG=()=>{let e=F(),[t,n]=z(),[r,i]=z();K(()=>{let e=!0,t=()=>{document.visibilityState!==`hidden`&&nH.publishing().then(t=>{e&&n(t)})};return t(),document.addEventListener(`visibilitychange`,t),()=>{e=!1,document.removeEventListener(`visibilitychange`,t)}},[]);let a=e=>{i(e),(e?nH.allowPublishing({kinds:LV}):nH.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__ */ V(`div`,{css:[GW,BG],"data-setting":`social`,children:[/* @__PURE__ */ L(KW,{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__ */ L(`a`,{className:`line link`,href:$V,target:`_blank`,rel:`noreferrer`,children:s}):void 0,c?/* @__PURE__ */ L(`p`,{className:`line note error`,children:c}):void 0]})},HG=I`
5986
+ `,ZG=()=>{let e=F(),[t,n]=z(),[r,i]=z();K(()=>{let e=!0,t=()=>{document.visibilityState!==`hidden`&&fH.publishing().then(t=>{e&&n(t)})};return t(),document.addEventListener(`visibilitychange`,t),()=>{e=!1,document.removeEventListener(`visibilitychange`,t)}},[]);let a=e=>{i(e),(e?fH.allowPublishing({kinds:qV}):fH.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__ */ V(`div`,{css:[tG,XG],"data-setting":`social`,children:[/* @__PURE__ */ L(nG,{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__ */ L(`a`,{className:`line link`,href:lH,target:`_blank`,rel:`noreferrer`,children:s}):void 0,c?/* @__PURE__ */ L(`p`,{className:`line note error`,children:c}):void 0]})},QG=I`
5950
5987
  min-width: 0;
5951
5988
 
5952
5989
  & > h2 {
@@ -6083,7 +6120,7 @@ scrollbar-gutter: stable;
6083
6120
  }
6084
6121
 
6085
6122
  .confirm p { color: rgba(255, 255, 255, 0.9); }
6086
- `,UG={url:`${m}/auth/v1/token`,authorization:`Basic ${btoa(`${g}:`)}`,deviceType:`stub on FKN`},WG=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)}},GG=e=>hc(mc.formatMessage({id:`Crunchyroll answered {status}`,defaultMessage:`Crunchyroll answered {status}`},{status:e}),`Crunchyroll answered ${e}`),KG=e=>(e?.context??[]).some(e=>e.field===`etp_rt`&&e.code===`auth.obtain_access_token.missing_required_field`),qG=({status:e,body:t})=>{if(e===200)return`signed-in`;if(e===400&&KG(t))return`signed-out`;throw GG(e)},JG=`Check whether you are signed in to crunchyroll.com`,YG=async(e,{attach:t,mount:n,fetch:r,settle:i=()=>new Promise(e=>setTimeout(e,2e3))})=>{if(e===`extension`)return qG(await WG(UG,r));let{iframe:a,remove:o}=n();try{let e=await(await t({iframe:a,blank:{url:d},cookies:`persistent`,permissions:[{category:`evaluation`,reason:JG}]})).evaluate(WG,UG);return e.status===200&&await i(),qG(e)}finally{o()}},XG={signIn:Fn,signOut:In},ZG={signIn:()=>ie({url:Lt(Gt(ae())),domains:Vt,isSignedIn:Bt}).then(E(Ce,`prime`)),signOut:()=>Pn(Vt).then(()=>Ce.recordSignOut(`prime`))},QG={isConnected:Xn,watch:Nn,signIn:e=>jn[e](),signOut:Rn},$G={read:Ce.read,watch:Ce.watch,refresh:xe(Ce,(e,t)=>YG(t,{attach:T,mount:()=>zn(`Sign-in check`),fetch:Se}))},eK=Sf;H();var tK=I`
6123
+ `,$G={url:`${m}/auth/v1/token`,authorization:`Basic ${btoa(`${g}:`)}`,deviceType:`stub on FKN`},eK=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)}},tK=e=>hc(mc.formatMessage({id:`Crunchyroll answered {status}`,defaultMessage:`Crunchyroll answered {status}`},{status:e}),`Crunchyroll answered ${e}`),nK=e=>(e?.context??[]).some(e=>e.field===`etp_rt`&&e.code===`auth.obtain_access_token.missing_required_field`),rK=({status:e,body:t})=>{if(e===200)return`signed-in`;if(e===400&&nK(t))return`signed-out`;throw tK(e)},iK=`Check whether you are signed in to crunchyroll.com`,aK=async(e,{attach:t,mount:n,fetch:r,settle:i=()=>new Promise(e=>setTimeout(e,2e3))})=>{if(e===`extension`)return rK(await eK($G,r));let{iframe:a,remove:o}=n();try{let e=await(await t({iframe:a,blank:{url:d},cookies:`persistent`,permissions:[{category:`evaluation`,reason:iK}]})).evaluate(eK,$G);return e.status===200&&await i(),rK(e)}finally{o()}},oK={signIn:Fn,signOut:In},sK={signIn:()=>ie({url:Lt(Gt(ae())),domains:Vt,isSignedIn:Bt}).then(E(Ce,`prime`)),signOut:()=>Pn(Vt).then(()=>Ce.recordSignOut(`prime`))},cK={isConnected:Xn,watch:Nn,signIn:e=>jn[e](),signOut:Rn},lK={read:Ce.read,watch:Ce.watch,refresh:xe(Ce,(e,t)=>aK(t,{attach:T,mount:()=>zn(`Sign-in check`),fetch:Se}))},uK=Sf;H();var dK=I`
6087
6124
  display: grid;
6088
6125
  grid-template-columns: 17rem minmax(0, 1fr);
6089
6126
  column-gap: 4rem;
@@ -6144,7 +6181,7 @@ scrollbar-gutter: stable;
6144
6181
 
6145
6182
  .index a[aria-current='true'] { background: #fff; color: #000; border-color: #fff; }
6146
6183
  }
6147
- `,nK=()=>location.hash,rK=()=>{let e=F(),[t,n]=z(),r=ZW($m(nK)),i=XW.find(e=>e.id===r);return K(()=>{let e=!1;return p().then(t=>{e||n(t)}),()=>{e=!0}},[]),/* @__PURE__ */ V(`div`,{css:tK,children:[/* @__PURE__ */ L(`h1`,{children:e.formatMessage({id:`Settings`,defaultMessage:`Settings`})}),/* @__PURE__ */ L(`nav`,{className:`index`,"aria-label":e.formatMessage({id:`Settings categories`,defaultMessage:`Settings categories`}),children:XW.map(t=>/* @__PURE__ */ L(`a`,{href:`#${t.id}`,"aria-current":i===t?`true`:void 0,onClick:$x,children:e.formatMessage(t.title)},t.id))}),/* @__PURE__ */ V(`section`,{css:HG,"data-section":i.id,"aria-labelledby":`settings-section-title`,children:[/* @__PURE__ */ L(`h2`,{id:`settings-section-title`,children:e.formatMessage(i.title)}),i.id===`sources`?/* @__PURE__ */ L(zG,{backend:t,crunchyroll:XG,prime:ZG,sites:QG,status:$G}):i.id===`tracking`?/* @__PURE__ */ L(VG,{}):i.id===`playback`?/* @__PURE__ */ L(JW,{}):/* @__PURE__ */ L(WW,{saved:eK})]})]})},iK=[`WATCHING`,`PLANNING`,`COMPLETED`,`PAUSED`,`DROPPED`,`ALL`],aK=e=>e===`REWATCHING`?`WATCHING`:e&&e!==`ALL`&&iK.includes(e)?e:void 0,oK=e=>{let t=Object.fromEntries(iK.map(e=>[e,0]));for(let n of e){t.ALL++;let e=aK(n.summary.status);e&&t[e]++}return t},sK=[`updated`,`title`,`score`,`progress`],cK=(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},lK=(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`||aK(e.summary.status)===t)&&(e.summary.title??``).toLocaleLowerCase(i).includes(a)).sort((e,t)=>{if(r===`title`)return s(e,t);let[n,i]=[cK(e,r),cK(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)})},uK=(e,t)=>{let n=Td(e,e.episodeCount);return aK(e.summary.status)===`WATCHING`&&(n.total==null||(t??n.progress)<n.total)},dK=(e,t,n)=>{let r=Td(e,e.episodeCount),i={progress:(n??r.progress)+1},a={};for(let n of e.answers){let e=Ad(n,t[n.tracker.id]);if(e.kind!==`check`||!e.sendable)continue;let o=Nd(n,i,{...r,...i});o&&(a[n.tracker.id]=o)}return a};H();var fK=Ee({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`}}),pK=Ee({updated:{id:`Last updated`,defaultMessage:`Last updated`},title:{id:`Title`,defaultMessage:`Title`},score:{id:`Score`,defaultMessage:`Score`},progress:{id:`Progress`,defaultMessage:`Progress`}}),mK=[`grid`,`list`],hK=48,gK=I`
6184
+ `,fK=()=>location.hash,pK=()=>{let e=F(),[t,n]=z(),r=sG($m(fK)),i=oG.find(e=>e.id===r);return K(()=>{let e=!1;return p().then(t=>{e||n(t)}),()=>{e=!0}},[]),/* @__PURE__ */ V(`div`,{css:dK,children:[/* @__PURE__ */ L(`h1`,{children:e.formatMessage({id:`Settings`,defaultMessage:`Settings`})}),/* @__PURE__ */ L(`nav`,{className:`index`,"aria-label":e.formatMessage({id:`Settings categories`,defaultMessage:`Settings categories`}),children:oG.map(t=>/* @__PURE__ */ L(`a`,{href:`#${t.id}`,"aria-current":i===t?`true`:void 0,onClick:$x,children:e.formatMessage(t.title)},t.id))}),/* @__PURE__ */ V(`section`,{css:QG,"data-section":i.id,"aria-labelledby":`settings-section-title`,children:[/* @__PURE__ */ L(`h2`,{id:`settings-section-title`,children:e.formatMessage(i.title)}),i.id===`sources`?/* @__PURE__ */ L(YG,{backend:t,crunchyroll:oK,prime:sK,sites:cK,status:lK}):i.id===`tracking`?/* @__PURE__ */ L(ZG,{}):i.id===`playback`?/* @__PURE__ */ L(iG,{}):/* @__PURE__ */ L(eG,{saved:uK})]})]})},mK=[`WATCHING`,`PLANNING`,`COMPLETED`,`PAUSED`,`DROPPED`,`ALL`],hK=e=>e===`REWATCHING`?`WATCHING`:e&&e!==`ALL`&&mK.includes(e)?e:void 0,gK=e=>{let t=Object.fromEntries(mK.map(e=>[e,0]));for(let n of e){t.ALL++;let e=hK(n.summary.status);e&&t[e]++}return t},_K=[`updated`,`title`,`score`,`progress`],vK=(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},yK=(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`||hK(e.summary.status)===t)&&(e.summary.title??``).toLocaleLowerCase(i).includes(a)).sort((e,t)=>{if(r===`title`)return s(e,t);let[n,i]=[vK(e,r),vK(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)})},bK=(e,t)=>{let n=Td(e,e.episodeCount);return hK(e.summary.status)===`WATCHING`&&(n.total==null||(t??n.progress)<n.total)},xK=(e,t,n)=>{let r=Td(e,e.episodeCount),i={progress:(n??r.progress)+1},a={};for(let n of e.answers){let e=Ad(n,t[n.tracker.id]);if(e.kind!==`check`||!e.sendable)continue;let o=Nd(n,i,{...r,...i});o&&(a[n.tracker.id]=o)}return a};H();var SK=Ee({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`}}),CK=Ee({updated:{id:`Last updated`,defaultMessage:`Last updated`},title:{id:`Title`,defaultMessage:`Title`},score:{id:`Score`,defaultMessage:`Score`},progress:{id:`Progress`,defaultMessage:`Progress`}}),wK=[`grid`,`list`],TK=48,EK=I`
6148
6185
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
6149
6186
  min-height: 100vh;
6150
6187
 
@@ -6361,8 +6398,8 @@ scrollbar-gutter: stable;
6361
6398
  .rows > .item { grid-template-columns: 4.5rem minmax(0, 1fr); }
6362
6399
  .rows > .item > .title, .rows > .item > .facts, .rows > .item > .bar { grid-column: 2; grid-row: auto; }
6363
6400
  }
6364
- `,_K=(e,t)=>{let n=(t,n)=>t===`STATUS`?n?.status?e.formatMessage(fK[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})}),nn)).join(`
6365
- `)},vK=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()]},yK=({row:e})=>{let t=F(),n=Hw({uri:e.uri,title:e.summary.title,cover:e.summary.cover,episodeCount:e.episodeCount}),r=e.summary.progress??0,[i,a]=z(),[o,s]=z([]);K(()=>{i!==void 0&&r>=i&&a(void 0)},[r,i]);let c=i??r,l=e.episodeCount,u=rT(e),d=Gh(Q.MEDIA,{uri:e.uri,name:e.summary.title}),f=e.summary.title??e.uri,p=e.summary.score,m=dK(e,od.read().targets,c);return/* @__PURE__ */ V(`div`,{className:`item`,children:[/* @__PURE__ */ L(kh,{to:d,className:`cover`,tabIndex:-1,children:e.summary.cover?/* @__PURE__ */ L(`img`,{src:e.summary.cover,alt:``,loading:`lazy`}):void 0}),/* @__PURE__ */ L(kh,{to:d,className:`title`,children:f}),/* @__PURE__ */ V(`div`,{className:`facts`,children:[u?void 0:/* @__PURE__ */ V(`span`,{className:`progress`,children:[/* @__PURE__ */ L(`span`,{children:c}),l==null?void 0:/* @__PURE__ */ L(`span`,{children:t.formatMessage({id:`/ {total}`,defaultMessage:`/ {total}`},{total:l})})]}),p==null?void 0:/* @__PURE__ */ V(`span`,{className:`score`,children:[/* @__PURE__ */ L(rx,{size:12,"aria-hidden":`true`}),t.formatNumber(p/10,{maximumFractionDigits:1})]}),e.type?/* @__PURE__ */ L(`span`,{children:Lg(e.type)}):void 0,e.disagreements.length?/* @__PURE__ */ L(`span`,{className:`differs`,role:`img`,title:_K(t,e),"aria-label":_K(t,e)}):void 0,!u&&uK(e,c)?/* @__PURE__ */ L(`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(vK(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__ */ L(Yb,{size:14,"aria-hidden":`true`})}):void 0]}),l&&!u?/* @__PURE__ */ L(`div`,{className:`bar`,children:/* @__PURE__ */ L(`span`,{style:{width:`${Math.min(100,c/l*100)}%`}})}):void 0,o.map(({name:e,outcome:n,error:r})=>/* @__PURE__ */ L(`div`,{className:`missed`,children:r?t.formatMessage({id:`{name} did not save: {error}`,defaultMessage:`{name} did not save: {error}`},{name:e,error:cn(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))]})},bK=()=>{let e=F(),[{data:t}]=Rs({query:hD}),[n,r]=z(`WATCHING`),[i,a]=z(``),[o,s]=z(`updated`),[c,l]=z(`grid`),u=t?.viewerLists?.rows??[],d=t?.viewerLists?.lists??[],f=B(()=>oK(u),[u]),p=B(()=>lK(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__ */ V(`div`,{css:gK,children:[/* @__PURE__ */ V(`div`,{className:`heading-row`,children:[/* @__PURE__ */ L(`h1`,{className:`heading`,children:g}),/* @__PURE__ */ L(xW,{mode:c,modes:mK,onChange:l})]}),/* @__PURE__ */ L(`div`,{className:`tabs`,children:iK.map(t=>/* @__PURE__ */ V(`button`,{type:`button`,className:`tab`,"aria-pressed":n===t,onClick:()=>r(t),children:[/* @__PURE__ */ L(`span`,{children:e.formatMessage(fK[t])}),/* @__PURE__ */ L(`span`,{className:`count`,children:f[t]})]},t))}),/* @__PURE__ */ V(`div`,{className:`filters`,children:[/* @__PURE__ */ L(TW,{label:e.formatMessage({id:`Search`,defaultMessage:`Search`}),children:/* @__PURE__ */ V(`div`,{className:`text-field`,children:[/* @__PURE__ */ L(Qb,{size:17}),/* @__PURE__ */ L(`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__ */ L(wW,{label:e.formatMessage({id:`Sort by`,defaultMessage:`Sort by`}),options:sK.map(t=>({value:t,label:e.formatMessage(pK[t])})),selected:[o],onChange:([e])=>s(e??`updated`)})]}),d.filter(e=>e.state===`ERROR`||e.state===`PAUSED`).map(t=>/* @__PURE__ */ L(`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__ */ L(dw,{items:p,size:hK,label:g,children:e=>/* @__PURE__ */ L(`div`,{className:h,children:e.map(e=>/* @__PURE__ */ L(yK,{row:e},e._id))})},`${n} ${o} ${i}`):m?/* @__PURE__ */ L(`div`,{className:h,children:Array.from({length:12},(e,t)=>/* @__PURE__ */ L(LC,{className:`pending`},t))}):/* @__PURE__ */ L(`div`,{className:`status`,children:e.formatMessage({id:`No results found.`,defaultMessage:`No results found.`})})]})},xK=I`
6401
+ `,DK=(e,t)=>{let n=(t,n)=>t===`STATUS`?n?.status?e.formatMessage(SK[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})}),nn)).join(`
6402
+ `)},OK=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()]},kK=({row:e})=>{let t=F(),n=Hw({uri:e.uri,title:e.summary.title,cover:e.summary.cover,episodeCount:e.episodeCount}),r=e.summary.progress??0,[i,a]=z(),[o,s]=z([]);K(()=>{i!==void 0&&r>=i&&a(void 0)},[r,i]);let c=i??r,l=e.episodeCount,u=rT(e),d=Gh(Q.MEDIA,{uri:e.uri,name:e.summary.title}),f=e.summary.title??e.uri,p=e.summary.score,m=xK(e,od.read().targets,c);return/* @__PURE__ */ V(`div`,{className:`item`,children:[/* @__PURE__ */ L(kh,{to:d,className:`cover`,tabIndex:-1,children:e.summary.cover?/* @__PURE__ */ L(`img`,{src:e.summary.cover,alt:``,loading:`lazy`}):void 0}),/* @__PURE__ */ L(kh,{to:d,className:`title`,children:f}),/* @__PURE__ */ V(`div`,{className:`facts`,children:[u?void 0:/* @__PURE__ */ V(`span`,{className:`progress`,children:[/* @__PURE__ */ L(`span`,{children:c}),l==null?void 0:/* @__PURE__ */ L(`span`,{children:t.formatMessage({id:`/ {total}`,defaultMessage:`/ {total}`},{total:l})})]}),p==null?void 0:/* @__PURE__ */ V(`span`,{className:`score`,children:[/* @__PURE__ */ L(rx,{size:12,"aria-hidden":`true`}),t.formatNumber(p/10,{maximumFractionDigits:1})]}),e.type?/* @__PURE__ */ L(`span`,{children:Lg(e.type)}):void 0,e.disagreements.length?/* @__PURE__ */ L(`span`,{className:`differs`,role:`img`,title:DK(t,e),"aria-label":DK(t,e)}):void 0,!u&&bK(e,c)?/* @__PURE__ */ L(`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(OK(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__ */ L(Yb,{size:14,"aria-hidden":`true`})}):void 0]}),l&&!u?/* @__PURE__ */ L(`div`,{className:`bar`,children:/* @__PURE__ */ L(`span`,{style:{width:`${Math.min(100,c/l*100)}%`}})}):void 0,o.map(({name:e,outcome:n,error:r})=>/* @__PURE__ */ L(`div`,{className:`missed`,children:r?t.formatMessage({id:`{name} did not save: {error}`,defaultMessage:`{name} did not save: {error}`},{name:e,error:cn(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))]})},AK=()=>{let e=F(),[{data:t}]=Rs({query:hD}),[n,r]=z(`WATCHING`),[i,a]=z(``),[o,s]=z(`updated`),[c,l]=z(`grid`),u=t?.viewerLists?.rows??[],d=t?.viewerLists?.lists??[],f=B(()=>gK(u),[u]),p=B(()=>yK(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__ */ V(`div`,{css:EK,children:[/* @__PURE__ */ V(`div`,{className:`heading-row`,children:[/* @__PURE__ */ L(`h1`,{className:`heading`,children:g}),/* @__PURE__ */ L(jW,{mode:c,modes:wK,onChange:l})]}),/* @__PURE__ */ L(`div`,{className:`tabs`,children:mK.map(t=>/* @__PURE__ */ V(`button`,{type:`button`,className:`tab`,"aria-pressed":n===t,onClick:()=>r(t),children:[/* @__PURE__ */ L(`span`,{children:e.formatMessage(SK[t])}),/* @__PURE__ */ L(`span`,{className:`count`,children:f[t]})]},t))}),/* @__PURE__ */ V(`div`,{className:`filters`,children:[/* @__PURE__ */ L(FW,{label:e.formatMessage({id:`Search`,defaultMessage:`Search`}),children:/* @__PURE__ */ V(`div`,{className:`text-field`,children:[/* @__PURE__ */ L(Qb,{size:17}),/* @__PURE__ */ L(`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__ */ L(PW,{label:e.formatMessage({id:`Sort by`,defaultMessage:`Sort by`}),options:_K.map(t=>({value:t,label:e.formatMessage(CK[t])})),selected:[o],onChange:([e])=>s(e??`updated`)})]}),d.filter(e=>e.state===`ERROR`||e.state===`PAUSED`).map(t=>/* @__PURE__ */ L(`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__ */ L(dw,{items:p,size:TK,label:g,children:e=>/* @__PURE__ */ L(`div`,{className:h,children:e.map(e=>/* @__PURE__ */ L(kK,{row:e},e._id))})},`${n} ${o} ${i}`):m?/* @__PURE__ */ L(`div`,{className:h,children:Array.from({length:12},(e,t)=>/* @__PURE__ */ L(LC,{className:`pending`},t))}):/* @__PURE__ */ L(`div`,{className:`status`,children:e.formatMessage({id:`No results found.`,defaultMessage:`No results found.`})})]})},jK=I`
6366
6403
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
6367
6404
  min-height: 100vh;
6368
6405
 
@@ -6400,7 +6437,7 @@ scrollbar-gutter: stable;
6400
6437
 
6401
6438
  .grid > * { width: 100%; }
6402
6439
  }
6403
- `,SK=()=>{let e=F(),{episodes:t,asks:n,reading:r}=jD();return/* @__PURE__ */ V(`div`,{css:xK,children:[n,/* @__PURE__ */ L(`h1`,{className:`heading`,children:e.formatMessage({id:`Continue watching`,defaultMessage:`Continue watching`})}),t.length?/* @__PURE__ */ L(`div`,{className:`grid`,children:t.map(e=>/* @__PURE__ */ L(MD,{episode:e},e.work._id))}):r?void 0:/* @__PURE__ */ L(`div`,{className:`status`,children:e.formatMessage({id:`No new episodes`,defaultMessage:`No new episodes`})})]})},CK=(()=>{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))}})(),wK=e=>typeof e!=`number`||e===1/0?void 0:e>0?e:0,TK=e=>typeof e==`number`&&Number.isFinite(e),EK=e=>{if(!e||typeof e!=`object`)return;let{time:t,readyState:n,ranges:r}=e;if(!(!TK(t)||t<0||!TK(n)||!Number.isInteger(n)||n<0||n>4))return Array.isArray(r)&&r.every(e=>Array.isArray(e)&&e.length===2&&TK(e[0])&&TK(e[1])&&e[0]<=e[1])?{time:t,readyState:n,ranges:r}:void 0},DK=e=>{if(!Array.isArray(e))return;let t=e.map(e=>{let{start:t,end:n,title:r}=e??{};return TK(t)&&TK(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},OK=e=>{if(!e||typeof e!=`object`)return;let{audio:t,subtitles:n,alwaysSubtitles:r}=e;typeof t==`string`&&le(t),(typeof n==`string`||n===null)&&he(n),typeof r==`boolean`&&w(r)},kK=1e3,AK=(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||!ui(e))return;OK(e.picked),typeof e.autoplayNext==`boolean`&&zt(e.autoplayNext),u=e.ended===!0,d=wK(e.duration),f=DK(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||TK(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:xi(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}=vi(_,r,e,n,t);_=a,clearTimeout(v);let{catchUp:o}=a;return o&&(v=setTimeout(()=>{h&&yi(h.rate,o.rate)&&S(xi(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||s(e).catch(()=>{})}}:{},...i?{buffer:()=>Promise.race([i().then(EK,()=>void 0),new Promise(e=>setTimeout(e,kK))])}:{},dispose:()=>{l=!0,clearTimeout(v),c.clear()}}},jK=(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=Sn(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)}},MK=e=>{let{applyAutoplay:t}=e;if(!t)return()=>{};let n=()=>{t(Ft()).catch(()=>{})};return n(),gn(n)},NK=3e3,PK=(e,t)=>Promise.race([Promise.resolve().then(()=>e(t)).catch(()=>{}),new Promise(e=>setTimeout(e,NK))]);H();var FK=I`
6440
+ `,MK=()=>{let e=F(),{episodes:t,asks:n,reading:r}=jD();return/* @__PURE__ */ V(`div`,{css:jK,children:[n,/* @__PURE__ */ L(`h1`,{className:`heading`,children:e.formatMessage({id:`Continue watching`,defaultMessage:`Continue watching`})}),t.length?/* @__PURE__ */ L(`div`,{className:`grid`,children:t.map(e=>/* @__PURE__ */ L(MD,{episode:e},e.work._id))}):r?void 0:/* @__PURE__ */ L(`div`,{className:`status`,children:e.formatMessage({id:`No new episodes`,defaultMessage:`No new episodes`})})]})},NK=(()=>{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))}})(),PK=e=>typeof e!=`number`||e===1/0?void 0:e>0?e:0,FK=e=>typeof e==`number`&&Number.isFinite(e),IK=e=>{if(!e||typeof e!=`object`)return;let{time:t,readyState:n,ranges:r}=e;if(!(!FK(t)||t<0||!FK(n)||!Number.isInteger(n)||n<0||n>4))return Array.isArray(r)&&r.every(e=>Array.isArray(e)&&e.length===2&&FK(e[0])&&FK(e[1])&&e[0]<=e[1])?{time:t,readyState:n,ranges:r}:void 0},LK=e=>{if(!Array.isArray(e))return;let t=e.map(e=>{let{start:t,end:n,title:r}=e??{};return FK(t)&&FK(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},RK=e=>{if(!e||typeof e!=`object`)return;let{audio:t,subtitles:n,alwaysSubtitles:r}=e;typeof t==`string`&&le(t),(typeof n==`string`||n===null)&&he(n),typeof r==`boolean`&&w(r)},zK=1e3,BK=(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||!ui(e))return;RK(e.picked),typeof e.autoplayNext==`boolean`&&zt(e.autoplayNext),u=e.ended===!0,d=PK(e.duration),f=LK(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||FK(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:xi(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}=vi(_,r,e,n,t);_=a,clearTimeout(v);let{catchUp:o}=a;return o&&(v=setTimeout(()=>{h&&yi(h.rate,o.rate)&&S(xi(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||s(e).catch(()=>{})}}:{},...i?{buffer:()=>Promise.race([i().then(IK,()=>void 0),new Promise(e=>setTimeout(e,zK))])}:{},dispose:()=>{l=!0,clearTimeout(v),c.clear()}}},VK=(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=Sn(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)}},HK=e=>{let{applyAutoplay:t}=e;if(!t)return()=>{};let n=()=>{t(Ft()).catch(()=>{})};return n(),gn(n)},UK=3e3,WK=(e,t)=>Promise.race([Promise.resolve().then(()=>e(t)).catch(()=>{}),new Promise(e=>setTimeout(e,UK))]);H();var GK=I`
6404
6441
  position: relative;
6405
6442
  width: 100%;
6406
6443
  flex: 1;
@@ -6426,7 +6463,7 @@ scrollbar-gutter: stable;
6426
6463
  color: rgba(255, 255, 255, 0.55);
6427
6464
  font-size: 1.4rem;
6428
6465
  }
6429
- `,IK=({pluginUri:e,release:t,onUnplayable:n,onPlayback:r,stage:i})=>{let a=F(),o=G(null),[s,c]=z(!1),l=G({onUnplayable:n,onPlayback:r});l.current={onUnplayable:n,onPlayback:r};let u=G(void 0);return K(()=>{let n=o.current;if(!n)return;let r=!1,a,s,d;return c(!1),(async()=>{try{u.current??=D.mount(e,{iframe:n,protocol:zs}).catch(e=>{throw u.current=void 0,e});let o=await u.current;if(r)return;let{origin:c}=Wt(t.uri),f=o.remote;if(f.configure&&await PK(f.configure,fc(e)),r)return;let p=f.sources?.find(e=>e.origin===c)??f,m=await p.play?.({uri:t.uri,url:t.url,languages:Gn()});if(r)return;if(!m){l.current.onUnplayable();return}a=AK(p,n),a&&l.current.onPlayback?.(a),i?.current&&(s=jK(p,i.current,window,n)),d=MK(p)}catch(t){if(r)return;console.warn(`Source '${e}' could not start playback:`,t),c(!0)}})(),()=>{r=!0,s?.(),d?.(),a&&(a.dispose(),l.current.onPlayback?.(void 0))}},[e,t.uri,t.url]),K(()=>()=>{u.current?.then(e=>e.unmount(),()=>{})},[]),/* @__PURE__ */ V(`div`,{css:FK,children:[/* @__PURE__ */ L(`iframe`,{ref:o,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`,allow:`fullscreen; autoplay; encrypted-media; cross-origin-isolated`}),s?/* @__PURE__ */ L(`div`,{className:`failed`,children:a.formatMessage({id:`This source could not start playback.`,defaultMessage:`This source could not start playback.`})}):null]})},LK=(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},RK=(e,t,n,r,i)=>!n||r.selected===n.selected||r.selected===i?e:r.selected===t?`party`:r.selected;H();var zK=()=>tu(location.pathname+location.search),BK=()=>navigator.userActivation?.isActive??!0,VK=({link:e,tracks:t})=>{let n=_S(),r=n.status===`active`?n.role:void 0,i=J.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||!J.following()||h())return;let r=Date.now(),i=o.current&&xi(o.current,o.current.at,r),a=i&&hi(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+Si),s?.seek!==void 0&&(u.current=s.seek)},_=(e=!1)=>{let t=a.current;t&&g(xi(t,t.at,Date.now()),e)},v=(e,t)=>{let n=J.hostClock(),r=n?{...t,at:Ii(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:zK(),s:r},e.timer)continue;let n=()=>{e.timer=void 0,e.sentAt=Date.now(),J.send(e.next)},i=e.sentAt+250-Date.now();i<=0?n():e.timer=setTimeout(n,i)}s.current=Date.now()+Ci,clearTimeout(c.current),c.current=setTimeout(()=>_(),Ci)};K(()=>{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,J.setPlayback(t),J.send({t:`playback`,s:t});return}let i=a.current;if(!i||e.ended?.()||!J.following()||h())return;let c=Date.now(),d=c<s.current,p=xi(i,i.at,c),m=u.current!==void 0&&Math.abs(t.time-u.current)<=.5;m&&(u.current=void 0);let _=n&&BK()&&(d||c>=l.current)?wi(n,t,d?n:p).filter(e=>J.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`&&J.setPlayback(void 0)}},[r,e]),K(()=>{i&&_(!0)},[i]),K(()=>{if(r!==`guest`)return;let t,n=!0,i=async()=>{let r=zK(),i=J.hostPath();if(i===void 0)return;if(i!==r){J.setStatus({s:`away`});return}let s=await e?.buffer?.();if(!n)return;let c=Date.now(),l=o.current&&xi(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(!J.following()){J.setStatus({s:`away`,path:r,...f});return}let p=a.current;t=p?ki(t,s,xi(p,p.at,c).time,e?.duration?.()):`loading`,J.setStatus({s:t,path:r,...f})};i();let s=setInterval(()=>{i()},Ei);return()=>{n=!1,clearInterval(s)}},[r,e]),K(()=>()=>{r===`guest`&&J.setStatus({s:`away`})},[r]);let y=()=>{let e=p.current;if(t&&e&&r)for(let n of qt){let r=e[n],i=r&&LK(J.partyTrack(n),J.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=xi(t,t.at,i),s=xi(n,n.at,i);Math.abs(a.time-s.time)>.5?e.apply({...s,time:a.time},!0):(f.current=n,J.setPlayback(n),J.send({t:`playback`,s:n}))};return K(()=>{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 qt){let r=e[n];if(!r)continue;let i=RK(J.mine(n),J.partyTrack(n),t?.[n],r,m.current.get(n));i!==J.mine(n)&&J.setMine(n,i)}J.setPlayerTracks(e),t?.busy&&!e.busy&&b(),y()});return()=>{e(),p.current=void 0,J.setPlayerTracks(void 0)}},[r,t,e]),K(y),vS((t,{replayed:n})=>{if(r===`host`){if(t.t!==`ask`||!(`s`in t)||t.path!==zK()||!e||!o.current)return;let n=Ti(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||J.hostPath()!==zK())return;let c=J.hostClock(),l=c?{...i,at:Fi(i.at,c.offset)}:i,u=Date.now(),d={...l,time:pi(l,u,!!c),at:u};a.current=d,u>=s.current&&g(d,n)}),null},HK=[`play`,`pause`,`seeked`,`ratechange`,`ended`],UK=e=>({paused:e.paused,time:e.currentTime,rate:e.playbackRate??1,at:Date.now()}),WK=(e,t=()=>{})=>{let n=/* @__PURE__ */ new Set,r=()=>{let t=UK(e);for(let e of n)e(t)};for(let t of HK)e.addEventListener(t,r);let i=setInterval(()=>{e.paused||r()},fi),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(hi(UK(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}=vi(o,{...UK(e),seeking:e.seeking},t,r,n);o=c,clearTimeout(s);let{catchUp:l}=c;return l&&(s=setTimeout(()=>{yi(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 HK)e.removeEventListener(t,r);clearInterval(i),clearTimeout(s),n.clear(),t()}}},GK=e=>{let t=fr(e,{origin:location.origin});return WK(t,()=>t.destroy())},KK=(e,t)=>t?e==null?t:q.formatMessage({id:`E{number} - {title}`,defaultMessage:`E{number} - {title}`},{number:e,title:t}):e==null?void 0:q.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:e}),qK=e=>!!(e&&rT(e)&&(e.episodes?.length??0)<=1),JK=(e,t)=>{let n=t?.titles?.at(0)?.title;return qK(e)?e?.titles?.at(0)?.title??n:KK(t?.episodeNumber,n)},YK=``,XK=(e,t)=>{let n=t?.titles?.at(0)?.title;if(qK(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=q.formatMessage({id:`E{number} - {title}`,defaultMessage:`E{number} - {title}`},{number:t.episodeNumber,title:YK}),i=r.indexOf(YK);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}};H();var ZK=(e,t)=>!t.off(e.origin)&&(!!(e.url&&t.builtIn(e.origin,e.url))||!!(t.selfPlaying&&(e.embedUrl||t.selfPlaying(e.origin)))),QK=(e,t)=>{let n=e=>{let n=t.order.indexOf(e);return n<0?t.order.length:n},r;for(let i of e)ZK(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}},$K=(e,t,{plays:n,free:r,neverSignedIn:i},{answered:a,asked:o,moving:s,pending:c})=>{let l=QK(e.filter(n),t),u=QK(e,t),d=e.find(e=>e.uri===u?.uri),f=!!(d&&i(d));return{pick:(f?QK(e.filter(r),t):void 0)??(f&&c?void 0:o?l:l||s?u:void 0),stuck:!l&&(a||o)}},eq=(e,{mediaUri:t,episodeUri:n,sourceUri:r,guest:i,cannotPlay:a,search:o},s)=>{let c=G(void 0);K(()=>{r&&r!==c.current&&(c.current=void 0)},[r]);let l=(!r||a&&r===c.current)&&!i&&e?.now?e.uri:void 0;K(()=>{if(!l)return;c.current=l;let e=Gh(Q.WATCH,{mediaUri:t,episodeUri:n,sourceUri:l});s(o?`${e}?${o}`:e,{replace:!0})},[l,t,n])},tq=(e,t,n)=>`https://api.aniskip.com/v2/skip-times/${encodeURIComponent(e)}/${t}?types=ed&episodeLength=${n}`,nq=e=>typeof e==`number`&&Number.isFinite(e),rq=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 nq(r)&&nq(i)&&nq(a)&&i>r?{start:r,end:i,length:a}:void 0},iq=async(e,t,n,r)=>{let i=await r(tq(e,t,n),{credentials:`omit`});if(i.status!==404){if(!i.ok)throw Error(`aniskip answered ${i.status}`);return rq(await i.json())}},aq=/* @__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://uts-api.itunes.apple.com`,`https://www.netflix.com`]),oq=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 aq.has(new URL(t).origin)}catch{return!1}},sq=(e,t)=>(n,r)=>oq(n)?t(n,{...r,credentials:`omit`}):e(n,r);H();var cq=2,lq=.6,uq=(e,t)=>Math.abs(e-t)<cq,dq=async(e,t)=>{let n=await fn(e);return n===void 0||!uq(n,t)?[]:Cn(await jt(Kt(e)),t)},fq=sq(o,EO),pq=async({id:e,episode:t},n)=>{let r=await iq(e,t,n,fq);return r&&uq(r.length,n)&&r.start>=n*lq?Cn({credits:{start:r.start,end:r.end}},n):[]},mq=async(e,{crunchyroll:t,mal:n})=>{let r=t?await dq(t,e).catch(()=>[]):[];return dn(r)?r:n?pq(n,e).catch(()=>[]):[]},hq=[],gq=(e,{crunchyroll:t,mal:n})=>{let[r,i]=z(hq);return K(()=>{if(i(hq),!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&&dn(c)||(r=!0,mq(s,{crunchyroll:t,mal:n}).then(e=>{a||i(e)}))});return()=>{a=!0,o()}},[e,t,n?.id,n?.episode]),r},_q=(e,t)=>{if(rT(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&&Rt(e.uri)}let s=t>0?`SEQUEL`:`PREQUEL`,c=i?.filter(e=>e.relation===s&&ZD(e.format))??[],l=c.find(e=>e.format===a)??c[0];return l&&Rt(l.node.uri)},vq=([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=>vT(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}},yq=(e,t,n,r)=>{if(!t)return;let i=e.filter(e=>e.origin===t);return(r?QK(i.filter(e=>e.url===r),n):void 0)?.uri??QK(i,n)?.uri};H();var bq=I`
6466
+ `,KK=({pluginUri:e,release:t,onUnplayable:n,onPlayback:r,stage:i})=>{let a=F(),o=G(null),[s,c]=z(!1),l=G({onUnplayable:n,onPlayback:r});l.current={onUnplayable:n,onPlayback:r};let u=G(void 0);return K(()=>{let n=o.current;if(!n)return;let r=!1,a,s,d;return c(!1),(async()=>{try{u.current??=D.mount(e,{iframe:n,protocol:zs}).catch(e=>{throw u.current=void 0,e});let o=await u.current;if(r)return;let{origin:c}=Wt(t.uri),f=o.remote;if(f.configure&&await WK(f.configure,fc(e)),r)return;let p=f.sources?.find(e=>e.origin===c)??f,m=await p.play?.({uri:t.uri,url:t.url,languages:Gn()});if(r)return;if(!m){l.current.onUnplayable();return}a=BK(p,n),a&&l.current.onPlayback?.(a),i?.current&&(s=VK(p,i.current,window,n)),d=HK(p)}catch(t){if(r)return;console.warn(`Source '${e}' could not start playback:`,t),c(!0)}})(),()=>{r=!0,s?.(),d?.(),a&&(a.dispose(),l.current.onPlayback?.(void 0))}},[e,t.uri,t.url]),K(()=>()=>{u.current?.then(e=>e.unmount(),()=>{})},[]),/* @__PURE__ */ V(`div`,{css:GK,children:[/* @__PURE__ */ L(`iframe`,{ref:o,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`,allow:`fullscreen; autoplay; encrypted-media; cross-origin-isolated`}),s?/* @__PURE__ */ L(`div`,{className:`failed`,children:a.formatMessage({id:`This source could not start playback.`,defaultMessage:`This source could not start playback.`})}):null]})},qK=(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},JK=(e,t,n,r,i)=>!n||r.selected===n.selected||r.selected===i?e:r.selected===t?`party`:r.selected;H();var YK=()=>tu(location.pathname+location.search),XK=()=>navigator.userActivation?.isActive??!0,ZK=({link:e,tracks:t})=>{let n=_S(),r=n.status===`active`?n.role:void 0,i=J.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||!J.following()||h())return;let r=Date.now(),i=o.current&&xi(o.current,o.current.at,r),a=i&&hi(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+Si),s?.seek!==void 0&&(u.current=s.seek)},_=(e=!1)=>{let t=a.current;t&&g(xi(t,t.at,Date.now()),e)},v=(e,t)=>{let n=J.hostClock(),r=n?{...t,at:Ii(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:YK(),s:r},e.timer)continue;let n=()=>{e.timer=void 0,e.sentAt=Date.now(),J.send(e.next)},i=e.sentAt+250-Date.now();i<=0?n():e.timer=setTimeout(n,i)}s.current=Date.now()+Ci,clearTimeout(c.current),c.current=setTimeout(()=>_(),Ci)};K(()=>{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,J.setPlayback(t),J.send({t:`playback`,s:t});return}let i=a.current;if(!i||e.ended?.()||!J.following()||h())return;let c=Date.now(),d=c<s.current,p=xi(i,i.at,c),m=u.current!==void 0&&Math.abs(t.time-u.current)<=.5;m&&(u.current=void 0);let _=n&&XK()&&(d||c>=l.current)?wi(n,t,d?n:p).filter(e=>J.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`&&J.setPlayback(void 0)}},[r,e]),K(()=>{i&&_(!0)},[i]),K(()=>{if(r!==`guest`)return;let t,n=!0,i=async()=>{let r=YK(),i=J.hostPath();if(i===void 0)return;if(i!==r){J.setStatus({s:`away`});return}let s=await e?.buffer?.();if(!n)return;let c=Date.now(),l=o.current&&xi(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(!J.following()){J.setStatus({s:`away`,path:r,...f});return}let p=a.current;t=p?ki(t,s,xi(p,p.at,c).time,e?.duration?.()):`loading`,J.setStatus({s:t,path:r,...f})};i();let s=setInterval(()=>{i()},Ei);return()=>{n=!1,clearInterval(s)}},[r,e]),K(()=>()=>{r===`guest`&&J.setStatus({s:`away`})},[r]);let y=()=>{let e=p.current;if(t&&e&&r)for(let n of qt){let r=e[n],i=r&&qK(J.partyTrack(n),J.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=xi(t,t.at,i),s=xi(n,n.at,i);Math.abs(a.time-s.time)>.5?e.apply({...s,time:a.time},!0):(f.current=n,J.setPlayback(n),J.send({t:`playback`,s:n}))};return K(()=>{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 qt){let r=e[n];if(!r)continue;let i=JK(J.mine(n),J.partyTrack(n),t?.[n],r,m.current.get(n));i!==J.mine(n)&&J.setMine(n,i)}J.setPlayerTracks(e),t?.busy&&!e.busy&&b(),y()});return()=>{e(),p.current=void 0,J.setPlayerTracks(void 0)}},[r,t,e]),K(y),vS((t,{replayed:n})=>{if(r===`host`){if(t.t!==`ask`||!(`s`in t)||t.path!==YK()||!e||!o.current)return;let n=Ti(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||J.hostPath()!==YK())return;let c=J.hostClock(),l=c?{...i,at:Fi(i.at,c.offset)}:i,u=Date.now(),d={...l,time:pi(l,u,!!c),at:u};a.current=d,u>=s.current&&g(d,n)}),null},QK=[`play`,`pause`,`seeked`,`ratechange`,`ended`],$K=e=>({paused:e.paused,time:e.currentTime,rate:e.playbackRate??1,at:Date.now()}),eq=(e,t=()=>{})=>{let n=/* @__PURE__ */ new Set,r=()=>{let t=$K(e);for(let e of n)e(t)};for(let t of QK)e.addEventListener(t,r);let i=setInterval(()=>{e.paused||r()},fi),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(hi($K(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}=vi(o,{...$K(e),seeking:e.seeking},t,r,n);o=c,clearTimeout(s);let{catchUp:l}=c;return l&&(s=setTimeout(()=>{yi(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 QK)e.removeEventListener(t,r);clearInterval(i),clearTimeout(s),n.clear(),t()}}},tq=e=>{let t=fr(e,{origin:location.origin});return eq(t,()=>t.destroy())},nq=(e,t)=>t?e==null?t:q.formatMessage({id:`E{number} - {title}`,defaultMessage:`E{number} - {title}`},{number:e,title:t}):e==null?void 0:q.formatMessage({id:`Episode {number}`,defaultMessage:`Episode {number}`},{number:e}),rq=e=>!!(e&&rT(e)&&(e.episodes?.length??0)<=1),iq=(e,t)=>{let n=t?.titles?.at(0)?.title;return rq(e)?e?.titles?.at(0)?.title??n:nq(t?.episodeNumber,n)},aq=``,oq=(e,t)=>{let n=t?.titles?.at(0)?.title;if(rq(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=q.formatMessage({id:`E{number} - {title}`,defaultMessage:`E{number} - {title}`},{number:t.episodeNumber,title:aq}),i=r.indexOf(aq);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}};H();var sq=(e,t)=>!t.off(e.origin)&&(!!(e.url&&t.builtIn(e.origin,e.url))||!!(t.selfPlaying&&(e.embedUrl||t.selfPlaying(e.origin)))),cq=(e,t)=>{let n=e=>{let n=t.order.indexOf(e);return n<0?t.order.length:n},r;for(let i of e)sq(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}},lq=(e,t,{plays:n,free:r,neverSignedIn:i},{answered:a,asked:o,moving:s,pending:c})=>{let l=cq(e.filter(n),t),u=cq(e,t),d=e.find(e=>e.uri===u?.uri),f=!!(d&&i(d));return{pick:(f?cq(e.filter(r),t):void 0)??(f&&c?void 0:o?l:l||s?u:void 0),stuck:!l&&(a||o)}},uq=(e,{mediaUri:t,episodeUri:n,sourceUri:r,guest:i,cannotPlay:a,search:o},s)=>{let c=G(void 0);K(()=>{r&&r!==c.current&&(c.current=void 0)},[r]);let l=(!r||a&&r===c.current)&&!i&&e?.now?e.uri:void 0;K(()=>{if(!l)return;c.current=l;let e=Gh(Q.WATCH,{mediaUri:t,episodeUri:n,sourceUri:l});s(o?`${e}?${o}`:e,{replace:!0})},[l,t,n])},dq=(e,t,n)=>`https://api.aniskip.com/v2/skip-times/${encodeURIComponent(e)}/${t}?types=ed&episodeLength=${n}`,fq=e=>typeof e==`number`&&Number.isFinite(e),pq=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 fq(r)&&fq(i)&&fq(a)&&i>r?{start:r,end:i,length:a}:void 0},mq=async(e,t,n,r)=>{let i=await r(dq(e,t,n),{credentials:`omit`});if(i.status!==404){if(!i.ok)throw Error(`aniskip answered ${i.status}`);return pq(await i.json())}},hq=/* @__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://uts-api.itunes.apple.com`,`https://www.netflix.com`]),gq=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 hq.has(new URL(t).origin)}catch{return!1}},_q=(e,t)=>(n,r)=>gq(n)?t(n,{...r,credentials:`omit`}):e(n,r);H();var vq=2,yq=.6,bq=(e,t)=>Math.abs(e-t)<vq,xq=async(e,t)=>{let n=await fn(e);return n===void 0||!bq(n,t)?[]:Cn(await jt(Kt(e)),t)},Sq=_q(o,EO),Cq=async({id:e,episode:t},n)=>{let r=await mq(e,t,n,Sq);return r&&bq(r.length,n)&&r.start>=n*yq?Cn({credits:{start:r.start,end:r.end}},n):[]},wq=async(e,{crunchyroll:t,mal:n})=>{let r=t?await xq(t,e).catch(()=>[]):[];return dn(r)?r:n?Cq(n,e).catch(()=>[]):[]},Tq=[],Eq=(e,{crunchyroll:t,mal:n})=>{let[r,i]=z(Tq);return K(()=>{if(i(Tq),!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&&dn(c)||(r=!0,wq(s,{crunchyroll:t,mal:n}).then(e=>{a||i(e)}))});return()=>{a=!0,o()}},[e,t,n?.id,n?.episode]),r},Dq=(e,t)=>{if(rT(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&&Rt(e.uri)}let s=t>0?`SEQUEL`:`PREQUEL`,c=i?.filter(e=>e.relation===s&&ZD(e.format))??[],l=c.find(e=>e.format===a)??c[0];return l&&Rt(l.node.uri)},Oq=([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=>vT(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}},kq=(e,t,n,r)=>{if(!t)return;let i=e.filter(e=>e.origin===t);return(r?cq(i.filter(e=>e.url===r),n):void 0)?.uri??cq(i,n)?.uri};H();var Aq=I`
6430
6467
  align-items: center;
6431
6468
  justify-content: center;
6432
6469
  gap: 1.6rem;
@@ -6512,7 +6549,7 @@ scrollbar-gutter: stable;
6512
6549
  }
6513
6550
 
6514
6551
  .account button { padding: 0.5rem 1.2rem; font-size: 1.3rem; }
6515
- `,xq=({signIns:e,accounts:t})=>{let n=F(),r=G(null);return/* @__PURE__ */ V(`div`,{className:`player-container no-source`,css:bq,children:[/* @__PURE__ */ L(`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__ */ L(`ul`,{children:e.map(e=>{let n=Nh.find(t=>t.origin===e),i=n?.name??e;return/* @__PURE__ */ V(`li`,{"data-source":e,children:[/* @__PURE__ */ L(`span`,{className:`icon`,children:n?.icon?/* @__PURE__ */ L(gw,{icon:n.icon,name:i}):/* @__PURE__ */ L(`span`,{className:`letter`,"aria-hidden":`true`,children:i.charAt(0)})}),/* @__PURE__ */ L(`span`,{className:`name`,children:i}),/* @__PURE__ */ L(CG,{origin:e,heading:r,...t})]},e)})}):void 0,/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>{Wu()},children:n.formatMessage({id:`Browse sources`,defaultMessage:`Browse sources`})})]})},Sq=({url:e,passed:t})=>ie({url:e,domains:[new URL(e).hostname],cookies:`persistent`,isSignedIn:e=>e.locator(t).exists()});H();var Cq=I`
6552
+ `,jq=({signIns:e,accounts:t})=>{let n=F(),r=G(null);return/* @__PURE__ */ V(`div`,{className:`player-container no-source`,css:Aq,children:[/* @__PURE__ */ L(`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__ */ L(`ul`,{children:e.map(e=>{let n=Nh.find(t=>t.origin===e),i=n?.name??e;return/* @__PURE__ */ V(`li`,{"data-source":e,children:[/* @__PURE__ */ L(`span`,{className:`icon`,children:n?.icon?/* @__PURE__ */ L(gw,{icon:n.icon,name:i}):/* @__PURE__ */ L(`span`,{className:`letter`,"aria-hidden":`true`,children:i.charAt(0)})}),/* @__PURE__ */ L(`span`,{className:`name`,children:i}),/* @__PURE__ */ L(NG,{origin:e,heading:r,...t})]},e)})}):void 0,/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>{Wu()},children:n.formatMessage({id:`Browse sources`,defaultMessage:`Browse sources`})})]})},Mq=({url:e,passed:t})=>ie({url:e,domains:[new URL(e).hostname],cookies:`persistent`,isSignedIn:e=>e.locator(t).exists()});H();var Nq=I`
6516
6553
  display: flex;
6517
6554
  flex-wrap: wrap;
6518
6555
  gap: 1rem;
@@ -6565,9 +6602,9 @@ scrollbar-gutter: stable;
6565
6602
 
6566
6603
  &:disabled { opacity: 0.6; cursor: default; }
6567
6604
  }
6568
- `,wq=({sources:e})=>{let t=F(),[n,r]=z({}),[i,a]=z(),o=e=>Qn(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(`,`);K(()=>{if(s)for(let e of s.split(`,`))o(e)},[s]);let c=(e,t)=>{let n=Sq(t);a(e),n.catch(()=>void 0).then(async t=>{(t===`authed`||t===`closed`)&&(await Jn(e).catch(()=>{}),await o(e)),a(void 0)})},l=e.filter(({origin:e})=>n[e]);return l.length?/* @__PURE__ */ L(`ul`,{css:Cq,children:l.map(({origin:e,name:r,icon:a})=>/* @__PURE__ */ V(`li`,{"data-check":e,children:[/* @__PURE__ */ L(`span`,{className:`icon`,children:/* @__PURE__ */ L(gw,{icon:a,name:r})}),/* @__PURE__ */ L(`span`,{className:`name`,id:`check-${e}`,children:r}),/* @__PURE__ */ L(`button`,{type:`button`,"aria-describedby":`check-${e}`,disabled:i===e,onClick:()=>c(e,n[e]),children:t.formatMessage({id:`Verify`,defaultMessage:`Verify`})})]},e))}):null};H();var Tq=5e3,Eq=Fe`
6605
+ `,Pq=({sources:e})=>{let t=F(),[n,r]=z({}),[i,a]=z(),o=e=>Qn(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(`,`);K(()=>{if(s)for(let e of s.split(`,`))o(e)},[s]);let c=(e,t)=>{let n=Mq(t);a(e),n.catch(()=>void 0).then(async t=>{(t===`authed`||t===`closed`)&&(await Jn(e).catch(()=>{}),await o(e)),a(void 0)})},l=e.filter(({origin:e})=>n[e]);return l.length?/* @__PURE__ */ L(`ul`,{css:Nq,children:l.map(({origin:e,name:r,icon:a})=>/* @__PURE__ */ V(`li`,{"data-check":e,children:[/* @__PURE__ */ L(`span`,{className:`icon`,children:/* @__PURE__ */ L(gw,{icon:a,name:r})}),/* @__PURE__ */ L(`span`,{className:`name`,id:`check-${e}`,children:r}),/* @__PURE__ */ L(`button`,{type:`button`,"aria-describedby":`check-${e}`,disabled:i===e,onClick:()=>c(e,n[e]),children:t.formatMessage({id:`Verify`,defaultMessage:`Verify`})})]},e))}):null};H();var Fq=5e3,Iq=Fe`
6569
6606
  to { background-size: 100% 100%; }
6570
- `,Dq=I`
6607
+ `,Lq=I`
6571
6608
  position: absolute;
6572
6609
  inset-inline-end: 2.4rem;
6573
6610
  bottom: 8rem;
@@ -6617,9 +6654,9 @@ scrollbar-gutter: stable;
6617
6654
  }
6618
6655
 
6619
6656
  .up-next.counting {
6620
- animation: ${Eq} ${Tq}ms linear forwards;
6657
+ animation: ${Iq} ${Fq}ms linear forwards;
6621
6658
  }
6622
- `,Oq=(e,t,n)=>{let r=Mt(t,n).length<t.length;return e.offerEnding?.(!r),r&&e.endingOffered?.()!==!1?void 0:kt(t,n)??un(n)},kq=(e,t,n)=>{let r=e.chapters?e.chapters()??[]:t;return e.chapters&&e.endingOffered?.()!==!1?r:Mt(r,n)},Aq=({link:e,next:t,chapters:n,stage:r,episode:i,release:a,onAdvance:o})=>{let s=F(),[,c]=xh(),[l,u]=z(),[d,f]=z(!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(()=>{});return K(()=>{if(u(void 0),p||e?.offerEnding?.(!0),!e||!p)return;let t=!1,n=!1,r,i,a,o=()=>u(`offered`),s=Ht(f),c=(c,l)=>{let{paused:d,time:f,rate:p,at:h}=c;clearTimeout(a);let g=l&&!d&&p>0?f+Math.max(0,(Date.now()-h)/1e3)*p:f;l||(i=c);let y=r;if(l||(r=f),s.hear(kq(e,_.current,e.duration?.()),l?{...c,time:g,at:Date.now()}:c),e.ended?.()){if(!t)return;t=!1,m(),u(Ft()?`counting`:`offered`);return}t||=!d;let b=e.chapters?.(),x=e.duration?.();!n&&v.current&&e.prepare&&x&&g>=x*.8&&(n=!0,e.prepare(v.current));let S=b&&dn(b)?Oq(e,b,x):kt(_.current,x)??un(x);S!==void 0&&g>=S?o():(S===void 0||y===void 0||d||l||f<y)&&u(void 0),S!==void 0&&g<S&&!d&&p>0&&(a=setTimeout(o,(S-g)/p*1e3))};y.current=()=>{i&&!e.ended?.()&&c(i,!0)};let l=e.onReport(e=>c(e,!1));return()=>{y.current=()=>{},l(),clearTimeout(a),s.stop()}},[e,!!p,i]),K(()=>{y.current()},[n]),K(()=>{if(l!==`counting`||!p)return;let e=setTimeout(()=>h(p),Tq),t=gn(()=>{Ft()||u(`offered`)});return()=>{clearTimeout(e),t()}},[l,p]),!l||!p?null:/* @__PURE__ */ V(`div`,{css:Dq,className:d?`above-skip`:void 0,children:[/* @__PURE__ */ L(`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__ */ L(`button`,{type:`button`,className:`up-next-cancel`,onClick:g,children:s.formatMessage({id:`Cancel`,defaultMessage:`Cancel`})}):void 0]})};H();var jq=e=>(e??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node),Mq={nf:e=>`https://www.netflix.com/watch/${e}`},Nq=vC(`
6659
+ `,Rq=(e,t,n)=>{let r=Mt(t,n).length<t.length;return e.offerEnding?.(!r),r&&e.endingOffered?.()!==!1?void 0:kt(t,n)??un(n)},zq=(e,t,n)=>{let r=e.chapters?e.chapters()??[]:t;return e.chapters&&e.endingOffered?.()!==!1?r:Mt(r,n)},Bq=({link:e,next:t,chapters:n,stage:r,episode:i,release:a,onAdvance:o})=>{let s=F(),[,c]=xh(),[l,u]=z(),[d,f]=z(!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(()=>{});return K(()=>{if(u(void 0),p||e?.offerEnding?.(!0),!e||!p)return;let t=!1,n=!1,r,i,a,o=()=>u(`offered`),s=Ht(f),c=(c,l)=>{let{paused:d,time:f,rate:p,at:h}=c;clearTimeout(a);let g=l&&!d&&p>0?f+Math.max(0,(Date.now()-h)/1e3)*p:f;l||(i=c);let y=r;if(l||(r=f),s.hear(zq(e,_.current,e.duration?.()),l?{...c,time:g,at:Date.now()}:c),e.ended?.()){if(!t)return;t=!1,m(),u(Ft()?`counting`:`offered`);return}t||=!d;let b=e.chapters?.(),x=e.duration?.();!n&&v.current&&e.prepare&&x&&g>=x*.8&&(n=!0,e.prepare(v.current));let S=b&&dn(b)?Rq(e,b,x):kt(_.current,x)??un(x);S!==void 0&&g>=S?o():(S===void 0||y===void 0||d||l||f<y)&&u(void 0),S!==void 0&&g<S&&!d&&p>0&&(a=setTimeout(o,(S-g)/p*1e3))};y.current=()=>{i&&!e.ended?.()&&c(i,!0)};let l=e.onReport(e=>c(e,!1));return()=>{y.current=()=>{},l(),clearTimeout(a),s.stop()}},[e,!!p,i]),K(()=>{y.current()},[n]),K(()=>{if(l!==`counting`||!p)return;let e=setTimeout(()=>h(p),Fq),t=gn(()=>{Ft()||u(`offered`)});return()=>{clearTimeout(e),t()}},[l,p]),!l||!p?null:/* @__PURE__ */ V(`div`,{css:Lq,className:d?`above-skip`:void 0,children:[/* @__PURE__ */ L(`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__ */ L(`button`,{type:`button`,className:`up-next-cancel`,onClick:g,children:s.formatMessage({id:`Cancel`,defaultMessage:`Cancel`})}):void 0]})};H();var Vq=e=>(e??[]).filter(e=>e.relation===`SAME_AS`).map(e=>e.node),Hq={nf:e=>`https://www.netflix.com/watch/${e}`},Uq=vC(`
6623
6660
  subscription GetWatchMedia($input: MediaInput!) {
6624
6661
  media(input: $input) {
6625
6662
  _id
@@ -6722,7 +6759,7 @@ scrollbar-gutter: stable;
6722
6759
  }
6723
6760
  }
6724
6761
  }
6725
- `),Pq=vC(`
6762
+ `),Wq=vC(`
6726
6763
  subscription GetWatchOrigins($input: OriginPageInput!) {
6727
6764
  originPage(input: $input) {
6728
6765
  nodes {
@@ -6735,7 +6772,7 @@ scrollbar-gutter: stable;
6735
6772
  }
6736
6773
  }
6737
6774
  }
6738
- `),Fq=e=>{let[t]=Rs({query:Nq,variables:{input:{uri:e??``}},pause:!e});return Rw(t,e)},Iq=I`
6775
+ `),Gq=e=>{let[t]=Rs({query:Uq,variables:{input:{uri:e??``}},pause:!e});return Rw(t,e)},Kq=I`
6739
6776
  display: flex;
6740
6777
  flex-direction: column;
6741
6778
  /* The bar is fixed, so it takes no room in the flow and every other route pads itself out from
@@ -7049,13 +7086,13 @@ scrollbar-gutter: stable;
7049
7086
  }
7050
7087
  }
7051
7088
  }
7052
- `,Lq=({link:e,previous:t=!1})=>{let n=F();return/* @__PURE__ */ V(kh,{className:`episode-step ${t?`previous`:`next`}`,href:e.href,title:e.title,children:[t?/* @__PURE__ */ L(bt,{}):void 0,/* @__PURE__ */ V(`span`,{className:`step`,children:[/* @__PURE__ */ L(`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__ */ L(`span`,{className:`step-target`,children:e.parts?/* @__PURE__ */ V(W,{children:[e.parts.prefix?/* @__PURE__ */ L(`span`,{className:`step-prefix`,children:e.parts.prefix}):void 0,/* @__PURE__ */ L(`span`,{className:`step-title`,dir:`auto`,children:e.parts.title}),e.parts.suffix?/* @__PURE__ */ L(`span`,{className:`step-prefix`,children:e.parts.suffix}):void 0]}):e.title}):void 0]}),t?void 0:/* @__PURE__ */ L(Xe,{})]})},Rq=()=>{let e=F(),t=yh(),n={...t,mediaUri:en(t.mediaUri),episodeUri:Xt(t.episodeUri),sourceUri:Xt(t.sourceUri)},[,r]=xh(),i=G(null),o=G(null),[s,c]=z(),[l,u]=z(void 0),[d]=Rs({query:Nq,variables:{input:{uri:n.mediaUri}},pause:!n.mediaUri}),m=d.data?.media,h=B(()=>m?.episodes?.find(e=>e.uri&&n.episodeUri?_n(Rt(e.uri),Rt(n.episodeUri)):!1)??m?.episodes?.find(e=>jq(e.handles).some(e=>e.uri===n.sourceUri)),[m?.episodes,n.episodeUri,n.sourceUri]),g=n.sourceUri,_=s?.sourceUri===g?s?.link:void 0,v=B(()=>{let e=jq(h?.handles);if(!g||h?.handles?.some(e=>e.node.uri===g))return e;let{origin:t,id:n}=Wt(g),r=Mq[t]?.(n);return r?[...e,{uri:g,origin:t,url:r}]:e},[h?.handles,g]),y=B(()=>h?.uri?Zt(h.uri)?.handleUrisValues:void 0,[h?.uri]),b=B(()=>y&&[...new Set([...y,...v].map(e=>e.origin))],[y,v]),[{data:x}]=Rs({query:Pq,variables:{input:{ids:b,filters:[Tc.IsNotApiOnly]}},pause:!b}),S=m?.titles?.at(0)?.title;_U(S);let C=!!(m&&rT(m)),w=qK(m),T=S&&Gh(Q.TITLE,{uri:n.mediaUri,name:S}),E=h?.episodeNumber,D=JK(m,h),O=h?.thumbnails?.at(0)?.url,[k,A]=z();K(()=>{let e=!1;return p().then(t=>{e||A(t)}),()=>{e=!0}},[]);let j=B(()=>g?rn(g):{},[g]),ee=B(()=>g?Qt():{},[g]),M=B(()=>{if(!g)return;let e=v.find(e=>e.uri===g);if(!e)return;if(e.embedUrl)return e.embedUrl;let{origin:t}=Wt(g);if(!e.url||!OT(t,e.url,k)||k!==`extension`&&ET.has(t))return;let r=new URLSearchParams({mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:g,url:e.url,...j,...ee});return`${new URL(`embed.html`,import.meta.url).href}?${r}`},[g,v,n.mediaUri,n.episodeUri,j,ee,k]),te=mC(),ne=te.flatMap(e=>e.state===`connected`?e.sources??[]:[]),re=ne.map(e=>e.origin),ie=e=>ne.find(t=>t.origin===e)?.access??`none`,N=re.join(`,`),P=At(Qu,ed),ae=B(()=>td(P,re),[P,N]),[oe,se]=z({}),[ce,le]=z(),[ue,de]=z();K(()=>{let e=!1,t=N?N.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(qn)]).then(([t,n])=>{e||(se(t),le(n),de(N))}).catch(()=>{e||de(N)}),()=>{e=!0}},[N]);let fe=re.filter(e=>ie(e)!==`none`).join(`,`),pe=`${n.episodeUri} ${fe}`,[me,he]=z(),ge=e=>ie(e)===`none`||me===pe;K(()=>{if(!fe)return;let e=!1;return Promise.all(fe.split(`,`).map(e=>Kn(e).catch(()=>void 0).then(t=>{CK.record(e,t)}))).then(()=>{e||he(pe)}),()=>{e=!0}},[pe]);let _e=G(void 0),ve=B(()=>{if(!g){_e.current=void 0;return}let{origin:e}=Wt(g),t=ce?.[e],n=v.find(e=>e.uri===g);if(t&&n){let e={pluginUri:t,release:{uri:g,url:n.url??void 0}};return _e.current=e,e}let r=_e.current;if(r&&r.release.uri===g&&te.some(e=>e.uri===r.pluginUri))return r;_e.current=void 0},[g,ce,v,te]),[ye,be]=z();K(()=>{be(void 0)},[g]);let xe=!!(ve&&ye!==g);K(()=>{let e=i.current;if(xe||!M||!e)return;let t=GK(e),n=It(e);return c({link:t,sourceUri:g}),u(n),()=>{t.dispose(),n.dispose(),c(void 0),u(void 0)}},[xe,M]),K(()=>{let e=i.current;if(!xe&&M&&e&&D)return $t(e,D)},[xe,M,D]),K(()=>{let e=i.current;if(!xe&&M&&e&&g)return tn(e,g)},[xe,M,g]),K(()=>{let e=i.current;if(!xe&&M&&e)return sn(e)},[xe,M]),K(()=>{let e=i.current;if(!xe&&M&&e&&o.current)return wn(e,o.current)},[xe,M]);let Se=G(!1),Ce=G(!1),we=G(void 0),Te=G(n.episodeUri),Ee=e=>!!(e&&(e.isContentEditable||/^(input|textarea|select)$/i.test(e.tagName)));K(()=>{let e=i.current;if(xe||!M||!e)return;if(!Se.current){Se.current=!0;return}let t=()=>{let t=Ce.current;Ce.current=!1;let n=document.activeElement;(t?!Ee(n):!n||n===document.body)&&e.focus()};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[xe,M]);let De=xe?_:void 0;K(()=>{if(!De)return;let e=Se.current;if(Se.current=!0,!e)return;let t=De.onReport(()=>{t();let e=Ce.current;Ce.current=!1;let n=document.activeElement;(e?!Ee(n):!n||n===document.body||o.current?.contains(n))&&(De.focus?De.focus():o.current?.querySelector(`iframe`)?.focus())});return t},[De,n.episodeUri,g]);let[Oe,ke]=z([]);K(()=>{let e=i.current;if(!xe&&M&&e&&g)return mn(e,()=>ke(e=>[...e,g]))},[xe,M,g]);let Ae=B(()=>{let e=e=>{let t=ae.indexOf(e);return t===-1?ae.length:t};return(x?.originPage?.nodes??[]).map(e=>{let t=v.filter(t=>t.origin===e.id),r=!!ce?.[e.id],i=t=>!!(t?.embedUrl||r||OT(e.id,t?.url,k)),a=e=>Gh(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??Wt(e.uri).id,href:i(e)?a(e.uri):e.url??void 0,external:!i(e),active:g===e.uri})),s=t.at(0),c=t.find(e=>e.uri===g)??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??[],...h?.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))},[x,v,h?.thumbnails,n.mediaUri,n.episodeUri,g,oe,ce,k,ae]),je=e=>k!==`extension`&&!e.embedUrl&&OT(e.origin,e.url,`extension`)&&(ET.has(e.origin)||!OT(e.origin,e.url,k)),Me=v.find(e=>e.uri===g),Ne=Nt(M&&Me?.origin===`cr`&&Me.url?Kt(Me.url):void 0),Pe=B(()=>Cn(Ne),[Ne]),Fe=k===`cloud`&&Me&&je(Me)?Nh.find(e=>e.origin===Me.origin)?.name:void 0;K(()=>{Fe&&g&&!f()&&ke(e=>[...e,g])},[Fe,g]);let Ie=G(/* @__PURE__ */ new Map);for(let e of Ie.current.keys())re.includes(e)||Ie.current.delete(e);for(let e of re)Ie.current.has(e)||Ie.current.set(e,m);let Le=!!m?.settled&&ue===N,Re=te.some(e=>e.state===`connecting`),ze=_S(),Be=k===`extension`||f(),Ve=e=>kn().includes(e),He={builtIn:(e,t)=>OT(e,t,`extension`),selfPlaying:ce&&(e=>!!ce[e]),off:Ve,order:ae,possible:e=>!Ve(e)&&(TT.has(e)?Be||!ET.has(e):Re||re.includes(e)),settled:e=>Le&&(TT.has(e)||Ie.current.has(e)&&Ie.current.get(e)!==m)&&ge(e)},Ue=ze.status===`joining`||ze.status===`active`&&ze.role===`guest`,We=Sh(),[,Ge]=z(0);K(()=>{let e=()=>Ge(e=>e+1),t=[`crunchyroll`,`prime`].map(t=>$G.watch(t,e));return()=>{for(let e of t)e()}},[]);let Ke=e=>!!(e.url&&OT(e.origin,e.url,k)&&gG(e.origin,k??`cloud`,$G)),qe=e=>!Ke(e)&&(Be||!je(e)),Je=e=>vG(e.origin,$G)&&!je(e)||CK.neverSignedIn(e.origin,ie(e.origin)),Ye=e=>TT.has(e.origin)?_G(e.origin,$G)&&!je(e):ge(e.origin)&&CK.free(e.origin,ie(e.origin)),Xe=v.filter(e=>!Oe.includes(e.uri)),Ze=!!(g&&(Oe.includes(g)||Me&&Je(Me)&&QK(Xe.filter(Ye),He))),Qe=!!(h&&k)&&Le&&!Re&&He.order.every(e=>!He.possible(e)||He.settled(e)),$e=Re||re.some(e=>He.possible(e)&&!He.settled(e)),et=G(void 0),{pick:tt,stuck:nt}=$K(Xe,He,{plays:qe,free:Ye,neverSignedIn:Je},{answered:Qe,asked:et.current===n.episodeUri,moving:Ze,pending:$e});nt&&(et.current=n.episodeUri);let R=m?.episodes??[],rt=h?R.indexOf(h):-1,it=wT(),at=!!(m&&rt>=0&&!bT(m,new Date(it))[rt]),ot=nt&&!Ue&&!Me&&(Ae.length?!g:at),st=!ot&&!xe&&!M&&!Fe,ct=st&&!(m?.settled&&!h)&&(Ue||!(g?Qe:nt)),lt=Rw(d,n.mediaUri),ut=(lt?.handles??[]).map(e=>e.node.uri),dt=!Ue&&lt?ow(lt.seasons,[lt.uri,...ut]):void 0;K(()=>{if(!dt)return;let e=Gh(Q.WATCH,{mediaUri:Rt(dt),episodeUri:n.episodeUri,sourceUri:n.sourceUri});r(We?`${e}?${We}`:e,{replace:!0})},[dt,n.episodeUri,n.sourceUri,We,r]),eq(dt?void 0:tt,{...n,guest:Ue,cannotPlay:Ze,search:We},r),aW(_,g,v.map(e=>e.uri),Ue,iW(We)),K(()=>{let e=we.current,t=Te.current;if(Te.current=n.episodeUri,!e)return;if(n.episodeUri!==e){t!==n.episodeUri&&(we.current=void 0);return}if(Ue||!_)return;let r=!1,i;return i=_.onReport(t=>{r||_.ended?.()||(r=!0,i?.(),we.current===e&&(we.current=void 0,t.paused&&_.play?.()))}),()=>{r=!0,i?.()}},[_,n.episodeUri,g,Ue]);let ft=Fq(m&&rt===0?_q(m,-1):void 0),pt=Fq(m&&rt>=0&&rt===R.length-1?_q(m,1):void 0),{previous:mt,next:ht}=vq([ft,m?{...m,uri:n.mediaUri}:void 0,pt],rt,new Date(it)),gt=g?Wt(g).origin:void 0,H=v.find(e=>e.uri===g)?.url??void 0,U=e=>yq(e,gt,He,H),_t=e=>{if(!e?.episode.uri)return;let t=[ft,m,pt].find(t=>t?.episodes.includes(e.episode));return{href:Gh(Q.WATCH,{mediaUri:e.mediaUri,episodeUri:e.episode.uri,sourceUri:U(jq(e.episode.handles))}),title:JK(t,e.episode),parts:XK(t,e.episode)}},W=_t(mt),vt=_t(ht),yt=!Ue&&jq(ht?.episode.handles).length?vt:void 0,bt=yt&&xe?U(jq(ht?.episode.handles)):void 0,xt=bt?jq(ht?.episode.handles).find(e=>e.uri===bt):void 0,St=xt?{uri:xt.uri,url:xt.url??void 0}:void 0,Ct=m?.uri?Yt(m.uri,`mal`)?.id:void 0,wt=gq(yt&&(xe||Me?.origin!==`cr`&&!dn(Pe))?_:void 0,{crunchyroll:v.find(e=>e.origin===`cr`&&e.url)?.url??void 0,mal:Ct&&Number.isInteger(E)?{id:Ct,episode:E}:void 0}),[Tt,Et]=z(),Dt=Tt?.on===n.episodeUri?lt?.seasons?.find(e=>e.uri===Tt.uri&&!ut.includes(e.uri)):void 0,Ot=Dt&&Rt(Dt.uri),kt=Fq(Ot),jt=Dt?kt:lt,Mt=JT(jt?.uri);return!dt&&(zw(d,n.mediaUri)||lt?.settled&&!$e&&!h&&!Me)?/* @__PURE__ */ L(mU,{}):/* @__PURE__ */ V(`div`,{css:Iq,children:[/* @__PURE__ */ V(`div`,{className:`watch-container`,children:[/* @__PURE__ */ V(`div`,{className:`stage`,ref:o,children:[/* @__PURE__ */ V(`div`,{className:`episode-card`,children:[O?/* @__PURE__ */ L(`img`,{src:O,alt:``}):void 0,D]}),ot?/* @__PURE__ */ L(xq,{signIns:He.order.filter(e=>Xe.some(t=>t.origin===e&&Ke(t))),accounts:{backend:k,crunchyroll:XG,prime:ZG,sites:QG,status:$G}}):xe&&ve||M?/* @__PURE__ */ V(`div`,{className:`player-container`,children:[xe&&ve?/* @__PURE__ */ L(IK,{pluginUri:ve.pluginUri,release:ve.release,onUnplayable:()=>be(g),onPlayback:e=>c(e&&{link:e,sourceUri:ve.release.uri}),stage:o},ve.pluginUri):/* @__PURE__ */ L(`iframe`,{ref:i,src:M,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`,css:I`
7089
+ `,qq=({link:e,previous:t=!1})=>{let n=F();return/* @__PURE__ */ V(kh,{className:`episode-step ${t?`previous`:`next`}`,href:e.href,title:e.title,children:[t?/* @__PURE__ */ L(bt,{}):void 0,/* @__PURE__ */ V(`span`,{className:`step`,children:[/* @__PURE__ */ L(`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__ */ L(`span`,{className:`step-target`,children:e.parts?/* @__PURE__ */ V(W,{children:[e.parts.prefix?/* @__PURE__ */ L(`span`,{className:`step-prefix`,children:e.parts.prefix}):void 0,/* @__PURE__ */ L(`span`,{className:`step-title`,dir:`auto`,children:e.parts.title}),e.parts.suffix?/* @__PURE__ */ L(`span`,{className:`step-prefix`,children:e.parts.suffix}):void 0]}):e.title}):void 0]}),t?void 0:/* @__PURE__ */ L(Xe,{})]})},Jq=()=>{let e=F(),t=yh(),n={...t,mediaUri:en(t.mediaUri),episodeUri:Xt(t.episodeUri),sourceUri:Xt(t.sourceUri)},[,r]=xh(),i=G(null),o=G(null),[s,c]=z(),[l,u]=z(void 0),[d]=Rs({query:Uq,variables:{input:{uri:n.mediaUri}},pause:!n.mediaUri}),m=d.data?.media,h=B(()=>m?.episodes?.find(e=>e.uri&&n.episodeUri?_n(Rt(e.uri),Rt(n.episodeUri)):!1)??m?.episodes?.find(e=>Vq(e.handles).some(e=>e.uri===n.sourceUri)),[m?.episodes,n.episodeUri,n.sourceUri]),g=n.sourceUri,_=s?.sourceUri===g?s?.link:void 0,v=B(()=>{let e=Vq(h?.handles);if(!g||h?.handles?.some(e=>e.node.uri===g))return e;let{origin:t,id:n}=Wt(g),r=Hq[t]?.(n);return r?[...e,{uri:g,origin:t,url:r}]:e},[h?.handles,g]),y=B(()=>h?.uri?Zt(h.uri)?.handleUrisValues:void 0,[h?.uri]),b=B(()=>y&&[...new Set([...y,...v].map(e=>e.origin))],[y,v]),[{data:x}]=Rs({query:Wq,variables:{input:{ids:b,filters:[Tc.IsNotApiOnly]}},pause:!b}),S=m?.titles?.at(0)?.title;DU(S);let C=!!(m&&rT(m)),w=rq(m),T=S&&Gh(Q.TITLE,{uri:n.mediaUri,name:S}),E=h?.episodeNumber,D=iq(m,h),O=h?.thumbnails?.at(0)?.url,[k,A]=z();K(()=>{let e=!1;return p().then(t=>{e||A(t)}),()=>{e=!0}},[]);let j=B(()=>g?rn(g):{},[g]),ee=B(()=>g?Qt():{},[g]),M=B(()=>{if(!g)return;let e=v.find(e=>e.uri===g);if(!e)return;if(e.embedUrl)return e.embedUrl;let{origin:t}=Wt(g);if(!e.url||!OT(t,e.url,k)||k!==`extension`&&ET.has(t))return;let r=new URLSearchParams({mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:g,url:e.url,...j,...ee});return`${new URL(`embed.html`,import.meta.url).href}?${r}`},[g,v,n.mediaUri,n.episodeUri,j,ee,k]),te=mC(),ne=te.flatMap(e=>e.state===`connected`?e.sources??[]:[]),re=ne.map(e=>e.origin),ie=e=>ne.find(t=>t.origin===e)?.access??`none`,N=re.join(`,`),P=At(Qu,ed),ae=B(()=>td(P,re),[P,N]),[oe,se]=z({}),[ce,le]=z(),[ue,de]=z();K(()=>{let e=!1,t=N?N.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(qn)]).then(([t,n])=>{e||(se(t),le(n),de(N))}).catch(()=>{e||de(N)}),()=>{e=!0}},[N]);let fe=re.filter(e=>ie(e)!==`none`).join(`,`),pe=`${n.episodeUri} ${fe}`,[me,he]=z(),ge=e=>ie(e)===`none`||me===pe;K(()=>{if(!fe)return;let e=!1;return Promise.all(fe.split(`,`).map(e=>Kn(e).catch(()=>void 0).then(t=>{NK.record(e,t)}))).then(()=>{e||he(pe)}),()=>{e=!0}},[pe]);let _e=G(void 0),ve=B(()=>{if(!g){_e.current=void 0;return}let{origin:e}=Wt(g),t=ce?.[e],n=v.find(e=>e.uri===g);if(t&&n){let e={pluginUri:t,release:{uri:g,url:n.url??void 0}};return _e.current=e,e}let r=_e.current;if(r&&r.release.uri===g&&te.some(e=>e.uri===r.pluginUri))return r;_e.current=void 0},[g,ce,v,te]),[ye,be]=z();K(()=>{be(void 0)},[g]);let xe=!!(ve&&ye!==g);K(()=>{let e=i.current;if(xe||!M||!e)return;let t=tq(e),n=It(e);return c({link:t,sourceUri:g}),u(n),()=>{t.dispose(),n.dispose(),c(void 0),u(void 0)}},[xe,M]),K(()=>{let e=i.current;if(!xe&&M&&e&&D)return $t(e,D)},[xe,M,D]),K(()=>{let e=i.current;if(!xe&&M&&e&&g)return tn(e,g)},[xe,M,g]),K(()=>{let e=i.current;if(!xe&&M&&e)return sn(e)},[xe,M]),K(()=>{let e=i.current;if(!xe&&M&&e&&o.current)return wn(e,o.current)},[xe,M]);let Se=G(!1),Ce=G(!1),we=G(void 0),Te=G(n.episodeUri),Ee=e=>!!(e&&(e.isContentEditable||/^(input|textarea|select)$/i.test(e.tagName)));K(()=>{let e=i.current;if(xe||!M||!e)return;if(!Se.current){Se.current=!0;return}let t=()=>{let t=Ce.current;Ce.current=!1;let n=document.activeElement;(t?!Ee(n):!n||n===document.body)&&e.focus()};return e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t)},[xe,M]);let De=xe?_:void 0;K(()=>{if(!De)return;let e=Se.current;if(Se.current=!0,!e)return;let t=De.onReport(()=>{t();let e=Ce.current;Ce.current=!1;let n=document.activeElement;(e?!Ee(n):!n||n===document.body||o.current?.contains(n))&&(De.focus?De.focus():o.current?.querySelector(`iframe`)?.focus())});return t},[De,n.episodeUri,g]);let[Oe,ke]=z([]);K(()=>{let e=i.current;if(!xe&&M&&e&&g)return mn(e,()=>ke(e=>[...e,g]))},[xe,M,g]);let Ae=B(()=>{let e=e=>{let t=ae.indexOf(e);return t===-1?ae.length:t};return(x?.originPage?.nodes??[]).map(e=>{let t=v.filter(t=>t.origin===e.id),r=!!ce?.[e.id],i=t=>!!(t?.embedUrl||r||OT(e.id,t?.url,k)),a=e=>Gh(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??Wt(e.uri).id,href:i(e)?a(e.uri):e.url??void 0,external:!i(e),active:g===e.uri})),s=t.at(0),c=t.find(e=>e.uri===g)??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??[],...h?.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))},[x,v,h?.thumbnails,n.mediaUri,n.episodeUri,g,oe,ce,k,ae]),je=e=>k!==`extension`&&!e.embedUrl&&OT(e.origin,e.url,`extension`)&&(ET.has(e.origin)||!OT(e.origin,e.url,k)),Me=v.find(e=>e.uri===g),Ne=Nt(M&&Me?.origin===`cr`&&Me.url?Kt(Me.url):void 0),Pe=B(()=>Cn(Ne),[Ne]),Fe=k===`cloud`&&Me&&je(Me)?Nh.find(e=>e.origin===Me.origin)?.name:void 0;K(()=>{Fe&&g&&!f()&&ke(e=>[...e,g])},[Fe,g]);let Ie=G(/* @__PURE__ */ new Map);for(let e of Ie.current.keys())re.includes(e)||Ie.current.delete(e);for(let e of re)Ie.current.has(e)||Ie.current.set(e,m);let Le=!!m?.settled&&ue===N,Re=te.some(e=>e.state===`connecting`),ze=_S(),Be=k===`extension`||f(),Ve=e=>kn().includes(e),He={builtIn:(e,t)=>OT(e,t,`extension`),selfPlaying:ce&&(e=>!!ce[e]),off:Ve,order:ae,possible:e=>!Ve(e)&&(TT.has(e)?Be||!ET.has(e):Re||re.includes(e)),settled:e=>Le&&(TT.has(e)||Ie.current.has(e)&&Ie.current.get(e)!==m)&&ge(e)},Ue=ze.status===`joining`||ze.status===`active`&&ze.role===`guest`,We=Sh(),[,Ge]=z(0);K(()=>{let e=()=>Ge(e=>e+1),t=[`crunchyroll`,`prime`].map(t=>lK.watch(t,e));return()=>{for(let e of t)e()}},[]);let Ke=e=>!!(e.url&&OT(e.origin,e.url,k)&&EG(e.origin,k??`cloud`,lK)),qe=e=>!Ke(e)&&(Be||!je(e)),Je=e=>OG(e.origin,lK)&&!je(e)||NK.neverSignedIn(e.origin,ie(e.origin)),Ye=e=>TT.has(e.origin)?DG(e.origin,lK)&&!je(e):ge(e.origin)&&NK.free(e.origin,ie(e.origin)),Xe=v.filter(e=>!Oe.includes(e.uri)),Ze=!!(g&&(Oe.includes(g)||Me&&Je(Me)&&cq(Xe.filter(Ye),He))),Qe=!!(h&&k)&&Le&&!Re&&He.order.every(e=>!He.possible(e)||He.settled(e)),$e=Re||re.some(e=>He.possible(e)&&!He.settled(e)),et=G(void 0),{pick:tt,stuck:nt}=lq(Xe,He,{plays:qe,free:Ye,neverSignedIn:Je},{answered:Qe,asked:et.current===n.episodeUri,moving:Ze,pending:$e});nt&&(et.current=n.episodeUri);let R=m?.episodes??[],rt=h?R.indexOf(h):-1,it=wT(),at=!!(m&&rt>=0&&!bT(m,new Date(it))[rt]),ot=nt&&!Ue&&!Me&&(Ae.length?!g:at),st=!ot&&!xe&&!M&&!Fe,ct=st&&!(m?.settled&&!h)&&(Ue||!(g?Qe:nt)),lt=Rw(d,n.mediaUri),ut=(lt?.handles??[]).map(e=>e.node.uri),dt=!Ue&&lt?ow(lt.seasons,[lt.uri,...ut]):void 0;K(()=>{if(!dt)return;let e=Gh(Q.WATCH,{mediaUri:Rt(dt),episodeUri:n.episodeUri,sourceUri:n.sourceUri});r(We?`${e}?${We}`:e,{replace:!0})},[dt,n.episodeUri,n.sourceUri,We,r]),uq(dt?void 0:tt,{...n,guest:Ue,cannotPlay:Ze,search:We},r),hW(_,g,v.map(e=>e.uri),Ue,mW(We)),K(()=>{let e=we.current,t=Te.current;if(Te.current=n.episodeUri,!e)return;if(n.episodeUri!==e){t!==n.episodeUri&&(we.current=void 0);return}if(Ue||!_)return;let r=!1,i;return i=_.onReport(t=>{r||_.ended?.()||(r=!0,i?.(),we.current===e&&(we.current=void 0,t.paused&&_.play?.()))}),()=>{r=!0,i?.()}},[_,n.episodeUri,g,Ue]);let ft=Gq(m&&rt===0?Dq(m,-1):void 0),pt=Gq(m&&rt>=0&&rt===R.length-1?Dq(m,1):void 0),{previous:mt,next:ht}=Oq([ft,m?{...m,uri:n.mediaUri}:void 0,pt],rt,new Date(it)),gt=g?Wt(g).origin:void 0,H=v.find(e=>e.uri===g)?.url??void 0,U=e=>kq(e,gt,He,H),_t=e=>{if(!e?.episode.uri)return;let t=[ft,m,pt].find(t=>t?.episodes.includes(e.episode));return{href:Gh(Q.WATCH,{mediaUri:e.mediaUri,episodeUri:e.episode.uri,sourceUri:U(Vq(e.episode.handles))}),title:iq(t,e.episode),parts:oq(t,e.episode)}},W=_t(mt),vt=_t(ht),yt=!Ue&&Vq(ht?.episode.handles).length?vt:void 0,bt=yt&&xe?U(Vq(ht?.episode.handles)):void 0,xt=bt?Vq(ht?.episode.handles).find(e=>e.uri===bt):void 0,St=xt?{uri:xt.uri,url:xt.url??void 0}:void 0,Ct=m?.uri?Yt(m.uri,`mal`)?.id:void 0,wt=Eq(yt&&(xe||Me?.origin!==`cr`&&!dn(Pe))?_:void 0,{crunchyroll:v.find(e=>e.origin===`cr`&&e.url)?.url??void 0,mal:Ct&&Number.isInteger(E)?{id:Ct,episode:E}:void 0}),[Tt,Et]=z(),Dt=Tt?.on===n.episodeUri?lt?.seasons?.find(e=>e.uri===Tt.uri&&!ut.includes(e.uri)):void 0,Ot=Dt&&Rt(Dt.uri),kt=Gq(Ot),jt=Dt?kt:lt,Mt=JT(jt?.uri);return!dt&&(zw(d,n.mediaUri)||lt?.settled&&!$e&&!h&&!Me)?/* @__PURE__ */ L(wU,{}):/* @__PURE__ */ V(`div`,{css:Kq,children:[/* @__PURE__ */ V(`div`,{className:`watch-container`,children:[/* @__PURE__ */ V(`div`,{className:`stage`,ref:o,children:[/* @__PURE__ */ V(`div`,{className:`episode-card`,children:[O?/* @__PURE__ */ L(`img`,{src:O,alt:``}):void 0,D]}),ot?/* @__PURE__ */ L(jq,{signIns:He.order.filter(e=>Xe.some(t=>t.origin===e&&Ke(t))),accounts:{backend:k,crunchyroll:oK,prime:sK,sites:cK,status:lK}}):xe&&ve||M?/* @__PURE__ */ V(`div`,{className:`player-container`,children:[xe&&ve?/* @__PURE__ */ L(KK,{pluginUri:ve.pluginUri,release:ve.release,onUnplayable:()=>be(g),onPlayback:e=>c(e&&{link:e,sourceUri:ve.release.uri}),stage:o},ve.pluginUri):/* @__PURE__ */ L(`iframe`,{ref:i,src:M,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`,css:I`
7053
7090
  width: 100%;
7054
7091
  border: none;
7055
7092
  background: #000;
7056
7093
  flex: 1;
7057
7094
  min-height: 0;
7058
- `},M),/* @__PURE__ */ L(Aq,{link:_,next:yt,chapters:xe?wt:dn(Pe)||!wt.length?Pe:wt,stage:o,episode:n.episodeUri,release:St,onAdvance:()=>{Ce.current=!0,we.current=ht?.episode.uri}})]}):Fe?/* @__PURE__ */ L(`div`,{className:`player-container fix`,children:/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>{a().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:Fe})})}):void 0]}),ct?/* @__PURE__ */ L(LC,{className:`player-container holding`}):st?/* @__PURE__ */ L(`div`,{className:`player-container still`,children:O?/* @__PURE__ */ L(`img`,{src:O,alt:``}):void 0},`still`):void 0,/* @__PURE__ */ L(VK,{link:_,tracks:l}),/* @__PURE__ */ L(`div`,{className:`watch-info`,children:/* @__PURE__ */ V(`div`,{className:`episode-row`,children:[W?/* @__PURE__ */ L(Lq,{link:W,previous:!0}):void 0,/* @__PURE__ */ V(`div`,{className:`episode-main`,children:[/* @__PURE__ */ V(`div`,{className:`episode-info`,children:[/* @__PURE__ */ L(`div`,{className:`episode-title`,children:w&&T?/* @__PURE__ */ L(kh,{href:T,children:D}):D??(h||m?.settled?n.episodeUri:/* @__PURE__ */ L(LC,{className:`pending`}))}),w?void 0:T?/* @__PURE__ */ L(kh,{className:`media-title`,href:T,children:S}):m?.settled?void 0:/* @__PURE__ */ L(LC,{className:`media-title pending`}),/* @__PURE__ */ L(EE,{className:`share`,path:Gh(Q.WATCH,n),title:S})]}),/* @__PURE__ */ L(`div`,{className:`tracking`,children:/* @__PURE__ */ L(GH,{work:n.mediaUri,address:n.mediaUri,uri:Rw(d,n.mediaUri)?.uri,title:S,cover:m?.covers?.at(0)?.url,episodeCount:m?.episodeCount,movie:C,notice:!1,link:_,episode:E})})]}),vt?/* @__PURE__ */ L(Lq,{link:vt}):void 0]})})]}),/* @__PURE__ */ V(`div`,{className:`watch-info sources`,children:[/* @__PURE__ */ L(wq,{sources:ne.filter(({origin:e})=>He.settled(e))}),/* @__PURE__ */ L(Nw,{sources:Ae,onPickRelease:e=>r(Gh(Q.WATCH,{mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:e}))})]}),m&&!C?/* @__PURE__ */ V(`div`,{className:`watch-info episodes`,children:[/* @__PURE__ */ L(sw,{seasons:lt?.seasons,currentUris:Dt?[Dt.uri]:ut,onPick:e=>Et({uri:e,on:n.episodeUri})}),/* @__PURE__ */ V(`section`,{"data-episodes":!0,children:[/* @__PURE__ */ L(`h2`,{children:e.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),jt?/* @__PURE__ */ L(mE,{media:jt,tracked:Mt,current:Dt||rt<0?void 0:rt,mediaUri:Ot??n.mediaUri,sourceOf:e=>e===h?g:U(jq(e.handles))},Ot??n.mediaUri):/* @__PURE__ */ L(fE,{})]})]}):void 0]})};H();var zq=I`
7095
+ `},M),/* @__PURE__ */ L(Bq,{link:_,next:yt,chapters:xe?wt:dn(Pe)||!wt.length?Pe:wt,stage:o,episode:n.episodeUri,release:St,onAdvance:()=>{Ce.current=!0,we.current=ht?.episode.uri}})]}):Fe?/* @__PURE__ */ L(`div`,{className:`player-container fix`,children:/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>{a().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:Fe})})}):void 0]}),ct?/* @__PURE__ */ L(LC,{className:`player-container holding`}):st?/* @__PURE__ */ L(`div`,{className:`player-container still`,children:O?/* @__PURE__ */ L(`img`,{src:O,alt:``}):void 0},`still`):void 0,/* @__PURE__ */ L(ZK,{link:_,tracks:l}),/* @__PURE__ */ L(`div`,{className:`watch-info`,children:/* @__PURE__ */ V(`div`,{className:`episode-row`,children:[W?/* @__PURE__ */ L(qq,{link:W,previous:!0}):void 0,/* @__PURE__ */ V(`div`,{className:`episode-main`,children:[/* @__PURE__ */ V(`div`,{className:`episode-info`,children:[/* @__PURE__ */ L(`div`,{className:`episode-title`,children:w&&T?/* @__PURE__ */ L(kh,{href:T,children:D}):D??(h||m?.settled?n.episodeUri:/* @__PURE__ */ L(LC,{className:`pending`}))}),w?void 0:T?/* @__PURE__ */ L(kh,{className:`media-title`,href:T,children:S}):m?.settled?void 0:/* @__PURE__ */ L(LC,{className:`media-title pending`}),/* @__PURE__ */ L(EE,{className:`share`,path:Gh(Q.WATCH,n),title:S})]}),/* @__PURE__ */ L(`div`,{className:`tracking`,children:/* @__PURE__ */ L(tU,{work:n.mediaUri,address:n.mediaUri,uri:Rw(d,n.mediaUri)?.uri,title:S,cover:m?.covers?.at(0)?.url,episodeCount:m?.episodeCount,movie:C,notice:!1,link:_,episode:E})})]}),vt?/* @__PURE__ */ L(qq,{link:vt}):void 0]})})]}),/* @__PURE__ */ V(`div`,{className:`watch-info sources`,children:[/* @__PURE__ */ L(Pq,{sources:ne.filter(({origin:e})=>He.settled(e))}),/* @__PURE__ */ L(Nw,{sources:Ae,onPickRelease:e=>r(Gh(Q.WATCH,{mediaUri:n.mediaUri,episodeUri:n.episodeUri,sourceUri:e}))})]}),m&&!C?/* @__PURE__ */ V(`div`,{className:`watch-info episodes`,children:[/* @__PURE__ */ L(sw,{seasons:lt?.seasons,currentUris:Dt?[Dt.uri]:ut,onPick:e=>Et({uri:e,on:n.episodeUri})}),/* @__PURE__ */ V(`section`,{"data-episodes":!0,children:[/* @__PURE__ */ L(`h2`,{children:e.formatMessage({id:`Episodes`,defaultMessage:`Episodes`})}),jt?/* @__PURE__ */ L(mE,{media:jt,tracked:Mt,current:Dt||rt<0?void 0:rt,mediaUri:Ot??n.mediaUri,sourceOf:e=>e===h?g:U(Vq(e.handles))},Ot??n.mediaUri):/* @__PURE__ */ L(fE,{})]})]}):void 0]})};H();var Yq=I`
7059
7096
  padding: calc(var(--stub-header-height) + 3rem) 3rem 4rem;
7060
7097
  min-height: 100vh;
7061
7098
  max-width: 72rem;
@@ -7173,10 +7210,10 @@ scrollbar-gutter: stable;
7173
7210
  }
7174
7211
 
7175
7212
  .field input:focus { border-color: rgba(255, 255, 255, 0.4); }
7176
- `,Bq=Ee({"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?`}}),Vq=()=>{let e=F(),t=_S(),[n]=z(()=>Zi(location.hash,location.origin)),[r]=z(()=>location.hash.length>1&&!Zi(location.hash,location.origin)),[i,a]=z([]),[o,s]=z(()=>J.name()??``),[c,l]=z(!1),u=t.status===`active`;K(()=>{if(!n)return;let e=J.getState();(e.status!==`joining`&&e.status!==`active`||e.invite!==n)&&J.join(n)},[n]);let d=u?t.members:0;K(()=>{if(!u){a([]);return}let e=!1;return J.roster().then(t=>{e||a(t)}),()=>{e=!0}},[u,d]),vS(e=>{e.t===`name`&&J.roster().then(a)}),K(()=>{if(!c)return;let e=setTimeout(()=>l(!1),1500);return()=>clearTimeout(e)},[c]);let f=u?t.role===`host`?ru(Xi(location.origin,t.invite),eu(location.href),location.href):Xi(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(),J.setName(Xr(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:Bq[t.code]?e.formatMessage(Bq[t.code]):e.formatMessage({id:`Something went wrong.`,defaultMessage:`Something went wrong.`})}):void 0;return/* @__PURE__ */ V(`div`,{css:zq,children:[/* @__PURE__ */ L(`h1`,{className:`heading`,children:e.formatMessage({id:`Watch party`,defaultMessage:`Watch party`})}),/* @__PURE__ */ V(`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__ */ L(kh,{to:Gh(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__ */ V(W,{children:[` `,/* @__PURE__ */ L(`button`,{type:`button`,className:`action`,onClick:()=>J.dismiss(),children:e.formatMessage({id:`OK`,defaultMessage:`OK`})})]}):null]}),u&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`div`,{className:`section`,children:[/* @__PURE__ */ L(`div`,{className:`label`,children:m}),/* @__PURE__ */ V(`form`,{className:`field`,onSubmit:g,children:[/* @__PURE__ */ L(`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__ */ V(`button`,{type:`submit`,className:`action`,children:[/* @__PURE__ */ L(Tt,{size:14}),` `,e.formatMessage({id:`Save`,defaultMessage:`Save`})]})]})]}),/* @__PURE__ */ V(`div`,{className:`section`,children:[/* @__PURE__ */ L(`div`,{className:`label`,children:h}),/* @__PURE__ */ V(`div`,{className:`field`,children:[/* @__PURE__ */ L(`input`,{readOnly:!0,value:f,"aria-label":h,onFocus:e=>e.currentTarget.select()}),/* @__PURE__ */ V(`button`,{type:`button`,className:`action`,onClick:()=>{p()},children:[L(c?Tt:at,{size:14}),` `,e.formatMessage({id:`Copy`,defaultMessage:`Copy`})]})]})]}),/* @__PURE__ */ V(`div`,{className:`section`,children:[/* @__PURE__ */ L(`div`,{className:`label`,children:e.formatMessage({id:`In the party ({count})`,defaultMessage:`In the party ({count})`},{count:i.length})}),i.map(n=>/* @__PURE__ */ V(`div`,{className:`row`,"data-member":n.id,children:[n.name?/* @__PURE__ */ L(`span`,{className:`name`,children:n.name}):null,/* @__PURE__ */ L(`span`,{className:`id`,title:n.id,children:n.id}),n.host&&/* @__PURE__ */ L(`span`,{className:`badge`,children:e.formatMessage({id:`host#the party's host`,defaultMessage:`host`,description:`the party's host`})}),n.self&&/* @__PURE__ */ L(`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__ */ V(W,{children:[/* @__PURE__ */ V(`button`,{type:`button`,className:`action danger`,onClick:()=>{J.kick(n.id)},children:[/* @__PURE__ */ L(ix,{size:14}),` `,e.formatMessage({id:`Kick`,defaultMessage:`Kick`})]}),/* @__PURE__ */ V(`button`,{type:`button`,className:`action danger`,onClick:()=>{J.ban(n.id)},children:[/* @__PURE__ */ L(Eb,{size:14}),` `,e.formatMessage({id:`Ban`,defaultMessage:`Ban`})]})]})]},n.id))]}),/* @__PURE__ */ L(`div`,{className:`section`,children:/* @__PURE__ */ V(`button`,{type:`button`,className:`action`,onClick:()=>{J.leave()},children:[/* @__PURE__ */ L(Wb,{size:14}),` `,t.role===`host`?e.formatMessage({id:`End party`,defaultMessage:`End party`}):e.formatMessage({id:`Leave party`,defaultMessage:`Leave party`})]})})]})]})},Hq=e=>e.owned?`owned`:`placeholder`,Uq=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:Hq(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},Wq=e=>{let t=Uq(e),n=aO({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}},Gq=(e,t)=>[e,t].sort().join(` `),Kq=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){let e=Gq(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},qq=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},Jq=/^[0-9a-f]{64}$/,Yq=(e,t)=>(t??[]).map(t=>{let n=e.get(t)??null;return{key:t,ref:n,gap:n?null:Jq.test(t)?`missing`:`not-an-edge-key`}}),Xq=(e,t)=>(e.answers??[]).find(e=>e.seq===t)??null,Zq=e=>e===null?null:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e),Qq=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:Zq(t)}))}:{kind:`fields`,fields:[{field:Array.isArray(t)?`values`:`value`,value:Zq(t)}]}},$q=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.`,eJ=e=>e===`active`,tJ=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(`
7213
+ `,Xq=Ee({"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?`}}),Zq=()=>{let e=F(),t=_S(),[n]=z(()=>Zi(location.hash,location.origin)),[r]=z(()=>location.hash.length>1&&!Zi(location.hash,location.origin)),[i,a]=z([]),[o,s]=z(()=>J.name()??``),[c,l]=z(!1),u=t.status===`active`;K(()=>{if(!n)return;let e=J.getState();(e.status!==`joining`&&e.status!==`active`||e.invite!==n)&&J.join(n)},[n]);let d=u?t.members:0;K(()=>{if(!u){a([]);return}let e=!1;return J.roster().then(t=>{e||a(t)}),()=>{e=!0}},[u,d]),vS(e=>{e.t===`name`&&J.roster().then(a)}),K(()=>{if(!c)return;let e=setTimeout(()=>l(!1),1500);return()=>clearTimeout(e)},[c]);let f=u?t.role===`host`?ru(Xi(location.origin,t.invite),eu(location.href),location.href):Xi(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(),J.setName(Xr(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:Xq[t.code]?e.formatMessage(Xq[t.code]):e.formatMessage({id:`Something went wrong.`,defaultMessage:`Something went wrong.`})}):void 0;return/* @__PURE__ */ V(`div`,{css:Yq,children:[/* @__PURE__ */ L(`h1`,{className:`heading`,children:e.formatMessage({id:`Watch party`,defaultMessage:`Watch party`})}),/* @__PURE__ */ V(`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__ */ L(kh,{to:Gh(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__ */ V(W,{children:[` `,/* @__PURE__ */ L(`button`,{type:`button`,className:`action`,onClick:()=>J.dismiss(),children:e.formatMessage({id:`OK`,defaultMessage:`OK`})})]}):null]}),u&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`div`,{className:`section`,children:[/* @__PURE__ */ L(`div`,{className:`label`,children:m}),/* @__PURE__ */ V(`form`,{className:`field`,onSubmit:g,children:[/* @__PURE__ */ L(`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__ */ V(`button`,{type:`submit`,className:`action`,children:[/* @__PURE__ */ L(Tt,{size:14}),` `,e.formatMessage({id:`Save`,defaultMessage:`Save`})]})]})]}),/* @__PURE__ */ V(`div`,{className:`section`,children:[/* @__PURE__ */ L(`div`,{className:`label`,children:h}),/* @__PURE__ */ V(`div`,{className:`field`,children:[/* @__PURE__ */ L(`input`,{readOnly:!0,value:f,"aria-label":h,onFocus:e=>e.currentTarget.select()}),/* @__PURE__ */ V(`button`,{type:`button`,className:`action`,onClick:()=>{p()},children:[L(c?Tt:at,{size:14}),` `,e.formatMessage({id:`Copy`,defaultMessage:`Copy`})]})]})]}),/* @__PURE__ */ V(`div`,{className:`section`,children:[/* @__PURE__ */ L(`div`,{className:`label`,children:e.formatMessage({id:`In the party ({count})`,defaultMessage:`In the party ({count})`},{count:i.length})}),i.map(n=>/* @__PURE__ */ V(`div`,{className:`row`,"data-member":n.id,children:[n.name?/* @__PURE__ */ L(`span`,{className:`name`,children:n.name}):null,/* @__PURE__ */ L(`span`,{className:`id`,title:n.id,children:n.id}),n.host&&/* @__PURE__ */ L(`span`,{className:`badge`,children:e.formatMessage({id:`host#the party's host`,defaultMessage:`host`,description:`the party's host`})}),n.self&&/* @__PURE__ */ L(`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__ */ V(W,{children:[/* @__PURE__ */ V(`button`,{type:`button`,className:`action danger`,onClick:()=>{J.kick(n.id)},children:[/* @__PURE__ */ L(ix,{size:14}),` `,e.formatMessage({id:`Kick`,defaultMessage:`Kick`})]}),/* @__PURE__ */ V(`button`,{type:`button`,className:`action danger`,onClick:()=>{J.ban(n.id)},children:[/* @__PURE__ */ L(Eb,{size:14}),` `,e.formatMessage({id:`Ban`,defaultMessage:`Ban`})]})]})]},n.id))]}),/* @__PURE__ */ L(`div`,{className:`section`,children:/* @__PURE__ */ V(`button`,{type:`button`,className:`action`,onClick:()=>{J.leave()},children:[/* @__PURE__ */ L(Wb,{size:14}),` `,t.role===`host`?e.formatMessage({id:`End party`,defaultMessage:`End party`}):e.formatMessage({id:`Leave party`,defaultMessage:`Leave party`})]})})]})]})},Qq=e=>e.owned?`owned`:`placeholder`,$q=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:Qq(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},eJ=e=>{let t=$q(e),n=aO({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}},tJ=(e,t)=>[e,t].sort().join(` `),nJ=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){let e=tJ(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},rJ=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},iJ=/^[0-9a-f]{64}$/,aJ=(e,t)=>(t??[]).map(t=>{let n=e.get(t)??null;return{key:t,ref:n,gap:n?null:iJ.test(t)?`missing`:`not-an-edge-key`}}),oJ=(e,t)=>(e.answers??[]).find(e=>e.seq===t)??null,sJ=e=>e===null?null:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e),cJ=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:sJ(t)}))}:{kind:`fields`,fields:[{field:Array.isArray(t)?`values`:`value`,value:sJ(t)}]}},lJ=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.`,uJ=e=>e===`active`,dJ=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(`
7177
7214
 
7178
7215
  `);l=t.pop()??``;for(let e of t){let t=e.split(`
7179
- `).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}},nJ=`
7216
+ `).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}},fJ=`
7180
7217
  subscription TraceWarm($input: MediaInput!) {
7181
7218
  media(input: $input) {
7182
7219
  _id
@@ -7210,12 +7247,12 @@ scrollbar-gutter: stable;
7210
7247
  }
7211
7248
  }
7212
7249
  }
7213
- `,rJ=(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}},iJ=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-Dkvb6OJM.js`);if(typeof i.handleRequest!=`function`)return r;await tJ(i.handleRequest,nJ,{input:{uri:e}},{settleMs:n,onPayload:(e,n)=>{r=rJ(e,n),t?.(r)}})}catch(e){console.error(Error(`graph trace: the warm could not ask the sources`,{cause:e}))}return r},aJ=I`
7250
+ `,pJ=(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}},mJ=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-BPZX4rEX.js`);if(typeof i.handleRequest!=`function`)return r;await dJ(i.handleRequest,fJ,{input:{uri:e}},{settleMs:n,onPayload:(e,n)=>{r=pJ(e,n),t?.(r)}})}catch(e){console.error(Error(`graph trace: the warm could not ask the sources`,{cause:e}))}return r},hJ=I`
7214
7251
  &.nothing {
7215
7252
  color: rgb(250, 204, 21);
7216
7253
  font-style: italic;
7217
7254
  }
7218
- `,oJ=({value:e})=>e===null?/* @__PURE__ */ L(`span`,{css:aJ,className:`nothing`,children:`null`}):e===void 0?/* @__PURE__ */ L(`span`,{css:aJ,className:`nothing`,children:`absent`}):e===``?/* @__PURE__ */ L(`span`,{css:aJ,className:`nothing`,children:`empty`}):/* @__PURE__ */ L(`span`,{css:aJ,children:String(e)}),sJ=I`
7255
+ `,gJ=({value:e})=>e===null?/* @__PURE__ */ L(`span`,{css:hJ,className:`nothing`,children:`null`}):e===void 0?/* @__PURE__ */ L(`span`,{css:hJ,className:`nothing`,children:`absent`}):e===``?/* @__PURE__ */ L(`span`,{css:hJ,className:`nothing`,children:`empty`}):/* @__PURE__ */ L(`span`,{css:hJ,children:String(e)}),_J=I`
7219
7256
  .fields {
7220
7257
  width: 100%;
7221
7258
  border-collapse: collapse;
@@ -7248,7 +7285,7 @@ scrollbar-gutter: stable;
7248
7285
  white-space: pre-wrap;
7249
7286
  overflow-wrap: anywhere;
7250
7287
  }
7251
- `,cJ=({blob:e,label:t})=>/* @__PURE__ */ V(`div`,{css:sJ,className:`blob`,"data-blob":t,children:[e.kind===`absent`&&/* @__PURE__ */ L(`div`,{className:`absent`,children:/* @__PURE__ */ L(oJ,{value:null})}),e.kind===`raw`&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`div`,{className:`note`,children:`not JSON, shown as it is stored`}),/* @__PURE__ */ L(`pre`,{className:`raw`,children:e.raw})]}),e.kind===`fields`&&/* @__PURE__ */ L(`table`,{className:`fields`,children:/* @__PURE__ */ L(`tbody`,{children:e.fields.map(e=>/* @__PURE__ */ V(`tr`,{"data-field":e.field,children:[/* @__PURE__ */ L(`th`,{scope:`row`,children:e.field}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(oJ,{value:e.value})})]},e.field))})})]}),lJ=88,uJ=20,dJ=36,fJ=266,pJ=76,mJ=e=>[e.member?`${e.kind} ${e.member.via===`member`?`member`:`claimed`}`:`named by an edge`,e.origin??`no origin`,e.scope??`no scope`].join(` · `),hJ=(e,t)=>{let n=e.find(e=>e.key===t);return new Set(n?[n.fromUri,n.toUri]:[])},gJ=(e,t)=>{let n=Wq(e),r=e.links??[],i=Kq(r),a=hJ(r,t),o=new Set(n.nodes.map(e=>e.uri));return{nodes:n.nodes.map(e=>({id:e.uri,type:`trace`,position:{x:dJ+e.column*fJ,y:dJ+e.row*pJ},width:178,height:56,draggable:!1,selectable:!1,data:{uri:e.uri,kind:e.kind,title:e.title,meta:mJ(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:eJ(e.status),status:e.status,label:e.kind,tooltip:`${e.kind} ${e.status} by ${e.by}: ${e.reason}`}}}),width:Math.max(1,n.columns)*fJ-lJ+72,height:Math.max(1,n.rows)*pJ-uJ+72}};H();var _J=I`
7288
+ `,vJ=({blob:e,label:t})=>/* @__PURE__ */ V(`div`,{css:_J,className:`blob`,"data-blob":t,children:[e.kind===`absent`&&/* @__PURE__ */ L(`div`,{className:`absent`,children:/* @__PURE__ */ L(gJ,{value:null})}),e.kind===`raw`&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`div`,{className:`note`,children:`not JSON, shown as it is stored`}),/* @__PURE__ */ L(`pre`,{className:`raw`,children:e.raw})]}),e.kind===`fields`&&/* @__PURE__ */ L(`table`,{className:`fields`,children:/* @__PURE__ */ L(`tbody`,{children:e.fields.map(e=>/* @__PURE__ */ V(`tr`,{"data-field":e.field,children:[/* @__PURE__ */ L(`th`,{scope:`row`,children:e.field}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(gJ,{value:e.value})})]},e.field))})})]}),yJ=88,bJ=20,xJ=36,SJ=266,CJ=76,wJ=e=>[e.member?`${e.kind} ${e.member.via===`member`?`member`:`claimed`}`:`named by an edge`,e.origin??`no origin`,e.scope??`no scope`].join(` · `),TJ=(e,t)=>{let n=e.find(e=>e.key===t);return new Set(n?[n.fromUri,n.toUri]:[])},EJ=(e,t)=>{let n=eJ(e),r=e.links??[],i=nJ(r),a=TJ(r,t),o=new Set(n.nodes.map(e=>e.uri));return{nodes:n.nodes.map(e=>({id:e.uri,type:`trace`,position:{x:xJ+e.column*SJ,y:xJ+e.row*CJ},width:178,height:56,draggable:!1,selectable:!1,data:{uri:e.uri,kind:e.kind,title:e.title,meta:wJ(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:uJ(e.status),status:e.status,label:e.kind,tooltip:`${e.kind} ${e.status} by ${e.by}: ${e.reason}`}}}),width:Math.max(1,n.columns)*SJ-yJ+72,height:Math.max(1,n.rows)*CJ-bJ+72}};H();var DJ=I`
7252
7289
  position: relative;
7253
7290
  height: 46rem;
7254
7291
  border: 1px solid rgba(255, 255, 255, 0.12);
@@ -7320,7 +7357,7 @@ scrollbar-gutter: stable;
7320
7357
  .edge-label.active { fill: rgb(134, 239, 172); }
7321
7358
  .edge-label.refused { fill: rgb(252, 165, 165); }
7322
7359
  .cross { stroke: rgb(248, 113, 113); stroke-width: 1.5; }
7323
- `,vJ=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,yJ=({data:e})=>/* @__PURE__ */ V(`div`,{className:`trace-node ${e.kind}${e.lit?` lit`:``}`,"data-node":e.uri,"data-kind":e.kind,title:`${e.uri} (${e.kind})`,children:[/* @__PURE__ */ L(az,{type:`target`,position:$.Left}),/* @__PURE__ */ L(`div`,{className:`uri`,children:vJ(e.uri,26)}),/* @__PURE__ */ L(`div`,{children:e.title===null?`no title`:vJ(e.title,28)}),/* @__PURE__ */ L(`div`,{className:`meta`,children:vJ(e.meta,34)}),/* @__PURE__ */ L(az,{type:`source`,position:$.Right})]}),bJ=({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__ */ V(W,{children:[/* @__PURE__ */ L(`path`,{className:`edge ${s}${t?` selected`:``}`,d:u}),/* @__PURE__ */ L(`path`,{className:`edge-hit`,d:u,children:/* @__PURE__ */ L(`title`,{children:e?.tooltip})}),s===`refused`?/* @__PURE__ */ V(`g`,{className:`cross-mark`,children:[/* @__PURE__ */ L(`path`,{className:`cross`,d:`M ${d-5} ${f-5} L ${d+5} ${f+5}`}),/* @__PURE__ */ L(`path`,{className:`cross`,d:`M ${d+5} ${f-5} L ${d-5} ${f+5}`})]}):null,/* @__PURE__ */ L(`text`,{className:`edge-label ${s}`,x:d,y:f-9,textAnchor:`middle`,children:vJ(e?.label??``,22)})]})},xJ={trace:yJ},SJ={trace:bJ},CJ=({bundle:e,selected:t,onSelect:n})=>{let{nodes:r,edges:i}=B(()=>gJ(e,t),[e,t]),a=R((e,t)=>n(t.id),[n]);return/* @__PURE__ */ V(`div`,{css:_J,"data-trace-graph":!0,children:[/* @__PURE__ */ V(`div`,{className:`legend`,children:[/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`b`,{children:`solid`}),` owned: its origin described it`]}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`b`,{children:`dashed yellow`}),` placeholder: no origin has`]}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`b`,{children:`dotted`}),` named by an edge only`]}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`b`,{children:`green line`}),` active link`]}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`b`,{children:`red dashed, crossed`}),` refused link`]})]}),/* @__PURE__ */ L(RB,{nodes:r,edges:i,nodeTypes:xJ,edgeTypes:SJ,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__ */ L(GB,{variant:VB.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.12)`})})]})};H();var wJ=I`
7360
+ `,OJ=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,kJ=({data:e})=>/* @__PURE__ */ V(`div`,{className:`trace-node ${e.kind}${e.lit?` lit`:``}`,"data-node":e.uri,"data-kind":e.kind,title:`${e.uri} (${e.kind})`,children:[/* @__PURE__ */ L(az,{type:`target`,position:$.Left}),/* @__PURE__ */ L(`div`,{className:`uri`,children:OJ(e.uri,26)}),/* @__PURE__ */ L(`div`,{children:e.title===null?`no title`:OJ(e.title,28)}),/* @__PURE__ */ L(`div`,{className:`meta`,children:OJ(e.meta,34)}),/* @__PURE__ */ L(az,{type:`source`,position:$.Right})]}),AJ=({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__ */ V(W,{children:[/* @__PURE__ */ L(`path`,{className:`edge ${s}${t?` selected`:``}`,d:u}),/* @__PURE__ */ L(`path`,{className:`edge-hit`,d:u,children:/* @__PURE__ */ L(`title`,{children:e?.tooltip})}),s===`refused`?/* @__PURE__ */ V(`g`,{className:`cross-mark`,children:[/* @__PURE__ */ L(`path`,{className:`cross`,d:`M ${d-5} ${f-5} L ${d+5} ${f+5}`}),/* @__PURE__ */ L(`path`,{className:`cross`,d:`M ${d+5} ${f-5} L ${d-5} ${f+5}`})]}):null,/* @__PURE__ */ L(`text`,{className:`edge-label ${s}`,x:d,y:f-9,textAnchor:`middle`,children:OJ(e?.label??``,22)})]})},jJ={trace:kJ},MJ={trace:AJ},NJ=({bundle:e,selected:t,onSelect:n})=>{let{nodes:r,edges:i}=B(()=>EJ(e,t),[e,t]),a=R((e,t)=>n(t.id),[n]);return/* @__PURE__ */ V(`div`,{css:DJ,"data-trace-graph":!0,children:[/* @__PURE__ */ V(`div`,{className:`legend`,children:[/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`b`,{children:`solid`}),` owned: its origin described it`]}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`b`,{children:`dashed yellow`}),` placeholder: no origin has`]}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`b`,{children:`dotted`}),` named by an edge only`]}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`b`,{children:`green line`}),` active link`]}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`b`,{children:`red dashed, crossed`}),` refused link`]})]}),/* @__PURE__ */ L(RB,{nodes:r,edges:i,nodeTypes:jJ,edgeTypes:MJ,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__ */ L(YB,{variant:GB.Dots,gap:24,size:1,color:`rgba(255, 255, 255, 0.12)`})})]})};H();var PJ=I`
7324
7361
  border: 1px solid rgba(255, 255, 255, 0.12);
7325
7362
  border-radius: 0.5rem;
7326
7363
  padding: 1rem 1.2rem;
@@ -7420,7 +7457,7 @@ scrollbar-gutter: stable;
7420
7457
  }
7421
7458
 
7422
7459
  .empty { color: rgba(255, 255, 255, 0.5); }
7423
- `,TJ=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}`,EJ=e=>e===`not-an-edge-key`?`not an edge key`:`not in this bundle`,DJ=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)}},OJ=({rows:e})=>/* @__PURE__ */ L(`table`,{className:`facts`,children:/* @__PURE__ */ L(`tbody`,{children:e.map(([e,t])=>/* @__PURE__ */ V(`tr`,{"data-fact":e,children:[/* @__PURE__ */ L(`th`,{scope:`row`,children:e}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(oJ,{value:t})})]},e))})}),kJ=({bundle:e,seq:t,answer:n,onLoad:r})=>{let i=Xq(e,t);return/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`h4`,{children:[`answer `,t]}),i?/* @__PURE__ */ L(OJ,{rows:[[`uri`,i.uri],[`origin`,i.origin],[`operation`,i.operation],[`bytes`,i.bytes]]}):/* @__PURE__ */ L(`p`,{className:`empty`,"data-no-answer-row":!0,children:`The bundle lists no answer with that sequence.`}),/* @__PURE__ */ L(`button`,{type:`button`,className:`load`,onClick:()=>r(t),children:`Load answer bytes`}),n?.seq===t&&/* @__PURE__ */ V(`div`,{className:`answer`,"data-answer":!0,children:[n.state===`loading`&&/* @__PURE__ */ L(`p`,{className:`empty`,children:`loading…`}),n.state===`failed`&&/* @__PURE__ */ L(`p`,{className:`failed`,children:n.text}),n.state===`done`&&(n.text===``?/* @__PURE__ */ L(`p`,{className:`empty`,children:`nothing came back for that sequence.`}):/* @__PURE__ */ L(`pre`,{children:n.text}))]})]})},AJ=({bundle:e,index:t,trail:n,onFollow:r,onTrailTo:i,loadAnswerBytes:a})=>{let[o,s]=z(void 0),c=n[n.length-1],l=c===void 0?void 0:t.get(c),u=Yq(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:DJ(t)})).catch(t=>s({seq:e,state:`failed`,text:t instanceof Error?t.message:String(t)}))};return/* @__PURE__ */ V(`div`,{css:wJ,"data-inspector":!0,children:[/* @__PURE__ */ L(`h3`,{children:`Edge inspector`}),c===void 0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`Select a link in the graph, or any row in the tables below.`}):/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`div`,{className:`trail`,children:[n.slice(0,-1).map((e,n)=>/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>i(n),children:t.get(e)?TJ(t.get(e)):e},e)),/* @__PURE__ */ L(`span`,{className:`here`,children:l?TJ(l):c})]}),l===void 0?/* @__PURE__ */ V(`p`,{className:`empty`,"data-unknown-row":!0,children:[`The bundle carries no row with the key `,/* @__PURE__ */ L(`code`,{children:c}),`.`]}):/* @__PURE__ */ V(W,{children:[(l.kind===`link`||l.kind===`episode-link`)&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(OJ,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`written by`,l.row.by],[`rule`,l.row.reason]]}),/* @__PURE__ */ V(`p`,{children:[`status`,` `,/* @__PURE__ */ L(`span`,{className:`status ${eJ(l.row.status)?`active`:`refused`}`,children:l.row.status})]}),/* @__PURE__ */ L(OJ,{rows:l.kind===`link`?[[`confidence`,l.row.confidence],[`version`,l.row.version]]:[[`from number`,l.row.fromNumber],[`to number`,l.row.toNumber]]}),/* @__PURE__ */ L(`h4`,{children:`evidence`}),/* @__PURE__ */ L(cJ,{blob:Qq(l.row.evidence),label:`evidence`}),l.kind===`link`&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`h4`,{children:`gates`}),/* @__PURE__ */ L(cJ,{blob:Qq(l.row.gates),label:`gates`})]})]}),(l.kind===`claim`||l.kind===`episode-claim`)&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(OJ,{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__ */ L(kJ,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),l.kind===`episode-source`&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(OJ,{rows:[[`media`,l.row.fromUri],[`episode`,l.row.toUri],[`listed by`,l.row.claimer],[`answer seq`,l.row.answerSeq]]}),/* @__PURE__ */ L(kJ,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),/* @__PURE__ */ L(`h4`,{children:`supports`}),l.kind===`claim`||l.kind===`episode-claim`||l.kind===`episode-source`?/* @__PURE__ */ L(`p`,{className:`empty`,children:`This row is source truth: it is derived from nothing.`}):u.length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`This row names no supports.`}):/* @__PURE__ */ L(`div`,{className:`supports`,children:u.map(e=>/* @__PURE__ */ V(`div`,{className:`support`,"data-gap":e.gap??void 0,children:[e.ref?/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Follow`}):/* @__PURE__ */ L(`span`,{className:`unresolved`,children:EJ(e.gap)}),/* @__PURE__ */ L(`span`,{className:`what`,children:e.ref?TJ(e.ref):`unresolved`}),/* @__PURE__ */ L(`span`,{className:`key`,children:e.key})]},e.key))})]})]})]})},jJ=I`
7460
+ `,FJ=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}`,IJ=e=>e===`not-an-edge-key`?`not an edge key`:`not in this bundle`,LJ=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)}},RJ=({rows:e})=>/* @__PURE__ */ L(`table`,{className:`facts`,children:/* @__PURE__ */ L(`tbody`,{children:e.map(([e,t])=>/* @__PURE__ */ V(`tr`,{"data-fact":e,children:[/* @__PURE__ */ L(`th`,{scope:`row`,children:e}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(gJ,{value:t})})]},e))})}),zJ=({bundle:e,seq:t,answer:n,onLoad:r})=>{let i=oJ(e,t);return/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`h4`,{children:[`answer `,t]}),i?/* @__PURE__ */ L(RJ,{rows:[[`uri`,i.uri],[`origin`,i.origin],[`operation`,i.operation],[`bytes`,i.bytes]]}):/* @__PURE__ */ L(`p`,{className:`empty`,"data-no-answer-row":!0,children:`The bundle lists no answer with that sequence.`}),/* @__PURE__ */ L(`button`,{type:`button`,className:`load`,onClick:()=>r(t),children:`Load answer bytes`}),n?.seq===t&&/* @__PURE__ */ V(`div`,{className:`answer`,"data-answer":!0,children:[n.state===`loading`&&/* @__PURE__ */ L(`p`,{className:`empty`,children:`loading…`}),n.state===`failed`&&/* @__PURE__ */ L(`p`,{className:`failed`,children:n.text}),n.state===`done`&&(n.text===``?/* @__PURE__ */ L(`p`,{className:`empty`,children:`nothing came back for that sequence.`}):/* @__PURE__ */ L(`pre`,{children:n.text}))]})]})},BJ=({bundle:e,index:t,trail:n,onFollow:r,onTrailTo:i,loadAnswerBytes:a})=>{let[o,s]=z(void 0),c=n[n.length-1],l=c===void 0?void 0:t.get(c),u=aJ(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:LJ(t)})).catch(t=>s({seq:e,state:`failed`,text:t instanceof Error?t.message:String(t)}))};return/* @__PURE__ */ V(`div`,{css:PJ,"data-inspector":!0,children:[/* @__PURE__ */ L(`h3`,{children:`Edge inspector`}),c===void 0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`Select a link in the graph, or any row in the tables below.`}):/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ V(`div`,{className:`trail`,children:[n.slice(0,-1).map((e,n)=>/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>i(n),children:t.get(e)?FJ(t.get(e)):e},e)),/* @__PURE__ */ L(`span`,{className:`here`,children:l?FJ(l):c})]}),l===void 0?/* @__PURE__ */ V(`p`,{className:`empty`,"data-unknown-row":!0,children:[`The bundle carries no row with the key `,/* @__PURE__ */ L(`code`,{children:c}),`.`]}):/* @__PURE__ */ V(W,{children:[(l.kind===`link`||l.kind===`episode-link`)&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(RJ,{rows:[[`from`,l.row.fromUri],[`to`,l.row.toUri],[`kind`,l.row.kind],[`written by`,l.row.by],[`rule`,l.row.reason]]}),/* @__PURE__ */ V(`p`,{children:[`status`,` `,/* @__PURE__ */ L(`span`,{className:`status ${uJ(l.row.status)?`active`:`refused`}`,children:l.row.status})]}),/* @__PURE__ */ L(RJ,{rows:l.kind===`link`?[[`confidence`,l.row.confidence],[`version`,l.row.version]]:[[`from number`,l.row.fromNumber],[`to number`,l.row.toNumber]]}),/* @__PURE__ */ L(`h4`,{children:`evidence`}),/* @__PURE__ */ L(vJ,{blob:cJ(l.row.evidence),label:`evidence`}),l.kind===`link`&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(`h4`,{children:`gates`}),/* @__PURE__ */ L(vJ,{blob:cJ(l.row.gates),label:`gates`})]})]}),(l.kind===`claim`||l.kind===`episode-claim`)&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(RJ,{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__ */ L(zJ,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),l.kind===`episode-source`&&/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(RJ,{rows:[[`media`,l.row.fromUri],[`episode`,l.row.toUri],[`listed by`,l.row.claimer],[`answer seq`,l.row.answerSeq]]}),/* @__PURE__ */ L(zJ,{bundle:e,seq:l.row.answerSeq,answer:o,onLoad:d})]}),/* @__PURE__ */ L(`h4`,{children:`supports`}),l.kind===`claim`||l.kind===`episode-claim`||l.kind===`episode-source`?/* @__PURE__ */ L(`p`,{className:`empty`,children:`This row is source truth: it is derived from nothing.`}):u.length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`This row names no supports.`}):/* @__PURE__ */ L(`div`,{className:`supports`,children:u.map(e=>/* @__PURE__ */ V(`div`,{className:`support`,"data-gap":e.gap??void 0,children:[e.ref?/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Follow`}):/* @__PURE__ */ L(`span`,{className:`unresolved`,children:IJ(e.gap)}),/* @__PURE__ */ L(`span`,{className:`what`,children:e.ref?FJ(e.ref):`unresolved`}),/* @__PURE__ */ L(`span`,{className:`key`,children:e.key})]},e.key))})]})]})]})},VJ=I`
7424
7461
  table {
7425
7462
  width: 100%;
7426
7463
  border-collapse: collapse;
@@ -7473,7 +7510,7 @@ scrollbar-gutter: stable;
7473
7510
  .status.active { color: rgb(74, 222, 128); }
7474
7511
  .status.refused { color: rgb(248, 113, 113); }
7475
7512
  .empty { color: rgba(255, 255, 255, 0.5); font-size: 1.2rem; }
7476
- `,MJ=({fill:e,index:t,onSelect:n})=>{let r=Yq(t,e.supports);return r.length===0?/* @__PURE__ */ L(`div`,{className:`proof`,children:/* @__PURE__ */ L(`span`,{className:`missing`,"data-no-proof":!0,children:`${e.via} names no proving pair`})}):/* @__PURE__ */ L(W,{children:r.map(e=>{let t=e.ref?.kind===`episode-link`?e.ref.row:void 0;return/* @__PURE__ */ V(`div`,{className:`proof`,children:[/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>n(e.key),children:`Inspect`}),t?/* @__PURE__ */ L(`span`,{className:`pair`,children:`${t.fromUri} #${t.fromNumber??`null`} to ${t.toUri} #${t.toNumber??`null`}`}):/* @__PURE__ */ L(`span`,{className:`pair`,children:e.ref?`${TJ(e.ref)} ${e.key}`:/* @__PURE__ */ L(`span`,{className:`missing`,children:`${e.key}: ${EJ(e.gap)}`})}),t&&/* @__PURE__ */ L(`span`,{className:`status ${eJ(t.status)?`active`:`refused`}`,children:t.status})]},e.key)})})},NJ=({bundle:e,index:t,selected:n,onSelect:r})=>/* @__PURE__ */ V(`div`,{css:jJ,"data-episodes":!0,children:[(e.episodes??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`This cluster holds no slots.`}):/* @__PURE__ */ V(`table`,{"data-slots":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`slot`}),/* @__PURE__ */ L(`th`,{children:`number`}),/* @__PURE__ */ L(`th`,{children:`title`}),/* @__PURE__ */ L(`th`,{children:`fills`})]})}),/* @__PURE__ */ L(`tbody`,{children:e.episodes.map(e=>/* @__PURE__ */ V(`tr`,{"data-slot":e.slotId,children:[/* @__PURE__ */ L(`td`,{className:`slot`,children:e.slotId}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(oJ,{value:e.number})}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(oJ,{value:e.title})}),/* @__PURE__ */ L(`td`,{children:e.fills.length===0?/* @__PURE__ */ L(`span`,{className:`empty`,children:`nothing fills this slot`}):e.fills.map(e=>/* @__PURE__ */ V(`div`,{"data-fill":e.episodeUri,children:[/* @__PURE__ */ V(`div`,{className:`fill`,children:[/* @__PURE__ */ L(`span`,{className:`uri`,children:e.episodeUri}),/* @__PURE__ */ V(`span`,{children:[`#`,/* @__PURE__ */ L(oJ,{value:e.number})]}),/* @__PURE__ */ L(`span`,{children:e.origin}),/* @__PURE__ */ L(`span`,{className:`via`,children:e.via}),/* @__PURE__ */ L(`span`,{className:`by`,children:e.by})]}),/* @__PURE__ */ L(MJ,{fill:e,index:t,onSelect:r})]},`${e.episodeUri}\u0000${e.via}`))})]},e.slotId))})]}),/* @__PURE__ */ L(`h3`,{children:`Episode edges`}),(e.episodeLinks??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`No episode links, refused or otherwise.`}):/* @__PURE__ */ V(`table`,{"data-episode-links":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`from`}),/* @__PURE__ */ L(`th`,{children:`to`}),/* @__PURE__ */ L(`th`,{children:`kind`}),/* @__PURE__ */ L(`th`,{children:`status`}),/* @__PURE__ */ L(`th`,{children:`by`}),/* @__PURE__ */ L(`th`,{children:`rule`}),/* @__PURE__ */ L(`th`,{})]})}),/* @__PURE__ */ L(`tbody`,{children:e.episodeLinks.map(e=>/* @__PURE__ */ V(`tr`,{"data-episode-link":e.key,"data-status":e.status,className:n===e.key?`selected`:void 0,children:[/* @__PURE__ */ L(`td`,{className:`uri`,children:`${e.fromUri} #${e.fromNumber??`null`}`}),/* @__PURE__ */ L(`td`,{className:`uri`,children:`${e.toUri} #${e.toNumber??`null`}`}),/* @__PURE__ */ L(`td`,{children:e.kind}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`span`,{className:`status ${eJ(e.status)?`active`:`refused`}`,children:e.status})}),/* @__PURE__ */ L(`td`,{children:e.by}),/* @__PURE__ */ L(`td`,{children:e.reason}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ L(`h3`,{children:`Episode claims`}),(e.episodeClaims??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`no episode level claims`}):/* @__PURE__ */ V(`table`,{"data-episode-claims":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`from`}),/* @__PURE__ */ L(`th`,{children:`to`}),/* @__PURE__ */ L(`th`,{children:`kind`}),/* @__PURE__ */ L(`th`,{children:`claimer`}),/* @__PURE__ */ L(`th`,{children:`provenance`}),/* @__PURE__ */ L(`th`,{children:`answer`}),/* @__PURE__ */ L(`th`,{})]})}),/* @__PURE__ */ L(`tbody`,{children:e.episodeClaims.map(e=>/* @__PURE__ */ V(`tr`,{"data-episode-claim":e.key,className:n===e.key?`selected`:void 0,children:[/* @__PURE__ */ L(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ L(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ L(`td`,{children:e.kind}),/* @__PURE__ */ L(`td`,{children:e.claimer}),/* @__PURE__ */ L(`td`,{children:e.provenance}),/* @__PURE__ */ L(`td`,{children:e.answerSeq}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]})]});H();var PJ=I`
7513
+ `,HJ=({fill:e,index:t,onSelect:n})=>{let r=aJ(t,e.supports);return r.length===0?/* @__PURE__ */ L(`div`,{className:`proof`,children:/* @__PURE__ */ L(`span`,{className:`missing`,"data-no-proof":!0,children:`${e.via} names no proving pair`})}):/* @__PURE__ */ L(W,{children:r.map(e=>{let t=e.ref?.kind===`episode-link`?e.ref.row:void 0;return/* @__PURE__ */ V(`div`,{className:`proof`,children:[/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>n(e.key),children:`Inspect`}),t?/* @__PURE__ */ L(`span`,{className:`pair`,children:`${t.fromUri} #${t.fromNumber??`null`} to ${t.toUri} #${t.toNumber??`null`}`}):/* @__PURE__ */ L(`span`,{className:`pair`,children:e.ref?`${FJ(e.ref)} ${e.key}`:/* @__PURE__ */ L(`span`,{className:`missing`,children:`${e.key}: ${IJ(e.gap)}`})}),t&&/* @__PURE__ */ L(`span`,{className:`status ${uJ(t.status)?`active`:`refused`}`,children:t.status})]},e.key)})})},UJ=({bundle:e,index:t,selected:n,onSelect:r})=>/* @__PURE__ */ V(`div`,{css:VJ,"data-episodes":!0,children:[(e.episodes??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`This cluster holds no slots.`}):/* @__PURE__ */ V(`table`,{"data-slots":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`slot`}),/* @__PURE__ */ L(`th`,{children:`number`}),/* @__PURE__ */ L(`th`,{children:`title`}),/* @__PURE__ */ L(`th`,{children:`fills`})]})}),/* @__PURE__ */ L(`tbody`,{children:e.episodes.map(e=>/* @__PURE__ */ V(`tr`,{"data-slot":e.slotId,children:[/* @__PURE__ */ L(`td`,{className:`slot`,children:e.slotId}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(gJ,{value:e.number})}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(gJ,{value:e.title})}),/* @__PURE__ */ L(`td`,{children:e.fills.length===0?/* @__PURE__ */ L(`span`,{className:`empty`,children:`nothing fills this slot`}):e.fills.map(e=>/* @__PURE__ */ V(`div`,{"data-fill":e.episodeUri,children:[/* @__PURE__ */ V(`div`,{className:`fill`,children:[/* @__PURE__ */ L(`span`,{className:`uri`,children:e.episodeUri}),/* @__PURE__ */ V(`span`,{children:[`#`,/* @__PURE__ */ L(gJ,{value:e.number})]}),/* @__PURE__ */ L(`span`,{children:e.origin}),/* @__PURE__ */ L(`span`,{className:`via`,children:e.via}),/* @__PURE__ */ L(`span`,{className:`by`,children:e.by})]}),/* @__PURE__ */ L(HJ,{fill:e,index:t,onSelect:r})]},`${e.episodeUri}\u0000${e.via}`))})]},e.slotId))})]}),/* @__PURE__ */ L(`h3`,{children:`Episode edges`}),(e.episodeLinks??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`No episode links, refused or otherwise.`}):/* @__PURE__ */ V(`table`,{"data-episode-links":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`from`}),/* @__PURE__ */ L(`th`,{children:`to`}),/* @__PURE__ */ L(`th`,{children:`kind`}),/* @__PURE__ */ L(`th`,{children:`status`}),/* @__PURE__ */ L(`th`,{children:`by`}),/* @__PURE__ */ L(`th`,{children:`rule`}),/* @__PURE__ */ L(`th`,{})]})}),/* @__PURE__ */ L(`tbody`,{children:e.episodeLinks.map(e=>/* @__PURE__ */ V(`tr`,{"data-episode-link":e.key,"data-status":e.status,className:n===e.key?`selected`:void 0,children:[/* @__PURE__ */ L(`td`,{className:`uri`,children:`${e.fromUri} #${e.fromNumber??`null`}`}),/* @__PURE__ */ L(`td`,{className:`uri`,children:`${e.toUri} #${e.toNumber??`null`}`}),/* @__PURE__ */ L(`td`,{children:e.kind}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`span`,{className:`status ${uJ(e.status)?`active`:`refused`}`,children:e.status})}),/* @__PURE__ */ L(`td`,{children:e.by}),/* @__PURE__ */ L(`td`,{children:e.reason}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ L(`h3`,{children:`Episode claims`}),(e.episodeClaims??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`no episode level claims`}):/* @__PURE__ */ V(`table`,{"data-episode-claims":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`from`}),/* @__PURE__ */ L(`th`,{children:`to`}),/* @__PURE__ */ L(`th`,{children:`kind`}),/* @__PURE__ */ L(`th`,{children:`claimer`}),/* @__PURE__ */ L(`th`,{children:`provenance`}),/* @__PURE__ */ L(`th`,{children:`answer`}),/* @__PURE__ */ L(`th`,{})]})}),/* @__PURE__ */ L(`tbody`,{children:e.episodeClaims.map(e=>/* @__PURE__ */ V(`tr`,{"data-episode-claim":e.key,className:n===e.key?`selected`:void 0,children:[/* @__PURE__ */ L(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ L(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ L(`td`,{children:e.kind}),/* @__PURE__ */ L(`td`,{children:e.claimer}),/* @__PURE__ */ L(`td`,{children:e.provenance}),/* @__PURE__ */ L(`td`,{children:e.answerSeq}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>r(e.key),children:`Inspect`})})]},e.key))})]})]});H();var WJ=I`
7477
7514
  max-width: 150rem;
7478
7515
  margin: calc(var(--stub-header-height) + 2rem) auto 6rem;
7479
7516
  padding: 0 1.5rem;
@@ -7583,7 +7620,7 @@ scrollbar-gutter: stable;
7583
7620
 
7584
7621
  .columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
7585
7622
  @media (max-width: 900px) { .columns { grid-template-columns: 1fr; } }
7586
- `,FJ=1500,IJ=({label:e,value:t})=>/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`span`,{className:`label`,children:e}),/* @__PURE__ */ L(`code`,{children:/* @__PURE__ */ L(oJ,{value:t})})]}),LJ=({reason:e})=>e===`null`?/* @__PURE__ */ L(`code`,{className:`token`,"data-token-reason":!0,children:`"null"`}):/* @__PURE__ */ L(oJ,{value:e}),RJ=({load:e=LD,loadAnswerBytes:t=RD,warm:n=iJ})=>{let r=Sh(),[,i]=xh(),a=qD(r),[o,s]=z(a),[c,l]=z({kind:`idle`}),[u,d]=z(0),[f,p]=z({kind:`off`}),[m,h]=z([]),g=G(``),_=G(void 0);K(()=>{s(a),h([]),p({kind:`off`}),g.current=``,_.current!==void 0&&clearTimeout(_.current),_.current=void 0},[a]),K(()=>{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?qq(v):/* @__PURE__ */ new Map,[v]),b=m[m.length-1],x=!(!v||v.resolved||v.reason===`not-enabled`);return K(()=>{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)},FJ))};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]),K(()=>()=>{g.current=``,_.current!==void 0&&clearTimeout(_.current)},[]),/* @__PURE__ */ V(`div`,{css:PJ,dir:`ltr`,"data-debug-trace":!0,children:[/* @__PURE__ */ L(`h1`,{children:`Graph trace`}),/* @__PURE__ */ L(`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__ */ V(`form`,{className:`ask`,onSubmit:e=>{e.preventDefault();let t=o.trim();t&&(d(e=>e+1),i(BD({uri:t})))},children:[/* @__PURE__ */ L(`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__ */ L(`button`,{type:`submit`,children:`Trace`})]}),c.kind===`idle`&&/* @__PURE__ */ L(`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__ */ L(`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__ */ V(`p`,{className:`empty`,"data-loading":!0,children:[`tracing `,a,`…`]}),c.kind===`failed`&&/* @__PURE__ */ L(`p`,{className:`failed`,"data-failed":!0,children:c.error}),v&&/* @__PURE__ */ V(W,{children:[v.resolved?/* @__PURE__ */ V(`div`,{className:`resolved`,"data-resolved":!0,children:[/* @__PURE__ */ V(`div`,{className:`pairs`,children:[/* @__PURE__ */ L(IJ,{label:`asked`,value:v.asked}),/* @__PURE__ */ L(IJ,{label:`cluster`,value:v.resolved.clusterId}),/* @__PURE__ */ L(IJ,{label:`aggregate`,value:v.resolved.aggUri}),/* @__PURE__ */ L(IJ,{label:`scope`,value:v.resolved.scope}),/* @__PURE__ */ L(IJ,{label:`kind`,value:v.resolved.kind})]}),(v.resolved.otherClusters??[]).length>0&&/* @__PURE__ */ V(`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__ */ L(`a`,{href:BD({uri:e,search:r}),children:/* @__PURE__ */ L(`code`,{children:e})},e))]})]}):/* @__PURE__ */ V(`div`,{className:`unresolved`,"data-unresolved":!0,"data-reason":v.reason??`none`,children:[/* @__PURE__ */ L(`div`,{className:`why`,children:$q(v.reason)}),v.reason===`not-enabled`&&/* @__PURE__ */ V(`div`,{className:`advice`,children:[/* @__PURE__ */ L(`a`,{"data-reload-graph":!0,href:HD(r),children:`Reload with ?graph=1`}),` or `,/* @__PURE__ */ L(`a`,{"data-reload-store":!0,href:UD(r),children:`drop ?store=legacy`}),`, keeping this uri.`]}),/* @__PURE__ */ V(`div`,{className:`pairs`,children:[/* @__PURE__ */ L(IJ,{label:`asked`,value:v.asked}),/* @__PURE__ */ L(IJ,{label:`reason`,value:v.reason??null})]})]}),/* @__PURE__ */ V(`div`,{className:`pairs`,"data-run-length":!0,children:[/* @__PURE__ */ L(IJ,{label:`run length`,value:v.runLength?.value??null}),/* @__PURE__ */ L(IJ,{label:`from`,value:v.runLength?.from??null}),/* @__PURE__ */ L(IJ,{label:`tier`,value:v.runLength?.tier??null}),/* @__PURE__ */ L(IJ,{label:`witnesses`,value:v.runLength?.witnesses??null})]}),/* @__PURE__ */ V(`div`,{className:`pairs`,"data-cost":!0,children:[/* @__PURE__ */ L(IJ,{label:`statements`,value:v.cost?.statements??null}),/* @__PURE__ */ L(IJ,{label:`ms to build`,value:v.cost?.ms??null})]}),/* @__PURE__ */ L(`h3`,{children:`Graph counts`}),/* @__PURE__ */ L(`div`,{className:`chips`,"data-counts":!0,children:Object.entries(v.counts??{}).length===0?/* @__PURE__ */ L(`span`,{className:`empty`,children:`the bundle carries no counts`}):Object.entries(v.counts).map(([e,t])=>/* @__PURE__ */ L(`span`,{className:`chip`,children:`${e} ${t}`},e))}),/* @__PURE__ */ V(`div`,{className:`columns`,children:[/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`h3`,{children:`Anomalies`}),(v.anomalies??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`no rule complained`}):/* @__PURE__ */ L(`table`,{"data-anomalies":!0,children:/* @__PURE__ */ L(`tbody`,{children:v.anomalies.map((e,t)=>/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`td`,{children:e.rule}),/* @__PURE__ */ L(`td`,{children:e.detail})]},`${e.rule} ${e.detail} ${t}`))})})]}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`h3`,{children:`Asks`}),(v.asks??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`nothing was asked of any origin`}):/* @__PURE__ */ V(`table`,{"data-asks":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`seq`}),/* @__PURE__ */ L(`th`,{children:`origin`}),/* @__PURE__ */ L(`th`,{children:`outcome`}),/* @__PURE__ */ L(`th`,{children:`reason`})]})}),/* @__PURE__ */ L(`tbody`,{children:v.asks.map((e,t)=>/* @__PURE__ */ V(`tr`,{"data-ask":e.origin,children:[/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(oJ,{value:e.seq??null})}),/* @__PURE__ */ L(`td`,{children:e.origin}),/* @__PURE__ */ L(`td`,{children:e.outcome}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(LJ,{reason:e.reason})})]},`${e.origin} ${e.seq??t}`))})]})]})]}),/* @__PURE__ */ L(`h2`,{children:`Media graph`}),/* @__PURE__ */ L(CJ,{bundle:v,selected:b,onSelect:e=>h([e])}),/* @__PURE__ */ L(`h3`,{children:`Links`}),(v.links??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`no links, refused or otherwise`}):/* @__PURE__ */ V(`table`,{"data-links":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`from`}),/* @__PURE__ */ L(`th`,{children:`to`}),/* @__PURE__ */ L(`th`,{children:`kind`}),/* @__PURE__ */ L(`th`,{children:`status`}),/* @__PURE__ */ L(`th`,{children:`by`}),/* @__PURE__ */ L(`th`,{children:`rule`}),/* @__PURE__ */ L(`th`,{children:`confidence`}),/* @__PURE__ */ L(`th`,{})]})}),/* @__PURE__ */ L(`tbody`,{children:v.links.map(e=>/* @__PURE__ */ V(`tr`,{"data-link":e.key,"data-status":e.status,className:b===e.key?`selected`:void 0,children:[/* @__PURE__ */ L(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ L(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ L(`td`,{children:e.kind}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`span`,{className:`status ${eJ(e.status)?`active`:`refused`}`,children:e.status})}),/* @__PURE__ */ L(`td`,{children:e.by}),/* @__PURE__ */ L(`td`,{children:e.reason}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(oJ,{value:e.confidence})}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ L(`h3`,{children:`Claims`}),(v.claims??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`no claims between the uris this bundle names`}):/* @__PURE__ */ V(`table`,{"data-claims":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`from`}),/* @__PURE__ */ L(`th`,{children:`to`}),/* @__PURE__ */ L(`th`,{children:`kind`}),/* @__PURE__ */ L(`th`,{children:`claimer`}),/* @__PURE__ */ L(`th`,{children:`provenance`}),/* @__PURE__ */ L(`th`,{children:`answer`}),/* @__PURE__ */ L(`th`,{children:`target scope`}),/* @__PURE__ */ L(`th`,{})]})}),/* @__PURE__ */ L(`tbody`,{children:v.claims.map(e=>/* @__PURE__ */ V(`tr`,{"data-claim":e.key,className:b===e.key?`selected`:void 0,children:[/* @__PURE__ */ L(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ L(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ L(`td`,{children:e.kind}),/* @__PURE__ */ L(`td`,{children:e.claimer}),/* @__PURE__ */ L(`td`,{children:e.provenance}),/* @__PURE__ */ L(`td`,{children:e.answerSeq}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(oJ,{value:e.targetScope})}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ L(`h3`,{children:`Attachments`}),(v.attachments??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`no run is attached to a container here`}):/* @__PURE__ */ V(`table`,{"data-attachments":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`run`}),/* @__PURE__ */ L(`th`,{children:`container`}),/* @__PURE__ */ L(`th`,{children:`via`}),/* @__PURE__ */ L(`th`,{children:`by`}),/* @__PURE__ */ L(`th`,{children:`evidence`}),/* @__PURE__ */ L(`th`,{children:`supports`})]})}),/* @__PURE__ */ L(`tbody`,{children:v.attachments.map(e=>/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`td`,{className:`uri`,children:e.runUri}),/* @__PURE__ */ L(`td`,{className:`uri`,children:e.containerUri}),/* @__PURE__ */ L(`td`,{children:e.via}),/* @__PURE__ */ L(`td`,{children:e.by}),/* @__PURE__ */ L(`td`,{className:`uri`,children:/* @__PURE__ */ L(oJ,{value:e.evidence})}),/* @__PURE__ */ L(`td`,{children:(e.supports??[]).length===0?/* @__PURE__ */ L(oJ,{value:null}):e.supports.map(e=>/* @__PURE__ */ L(`button`,{type:`button`,className:`inspect`,"data-attachment-support":e,onClick:()=>h([e]),children:e},e))})]},`${e.runUri} ${e.containerUri} ${e.via} ${e.by}`))})]}),/* @__PURE__ */ L(`h2`,{children:`Episodes`}),/* @__PURE__ */ L(NJ,{bundle:v,index:y,selected:b,onSelect:e=>h([e])}),/* @__PURE__ */ L(`h2`,{children:`Inspector`}),/* @__PURE__ */ L(AJ,{bundle:v,index:y,trail:m,onFollow:e=>h(t=>[...t,e]),onTrailTo:e=>h(t=>t.slice(0,e+1)),loadAnswerBytes:t})]})]})},zJ=`[data-party-scroll]`,BJ=()=>{let e=document.querySelectorAll(zJ);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.scrollHeight-n.clientHeight>0)return n}},VJ=(e,t)=>t>0?Math.min(1,Math.max(0,e/t)):0,HJ=()=>{let e=BJ();return e?Math.max(0,e.scrollHeight-e.clientHeight):Math.max(0,document.documentElement.scrollHeight-window.innerHeight)},UJ=()=>{let e=BJ();return e?VJ(e.scrollTop,e.scrollHeight-e.clientHeight):VJ(window.scrollY,document.documentElement.scrollHeight-window.innerHeight)},WJ=()=>{try{return window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0}catch{return!1}},GJ=(e,t,n)=>!e||WJ()?`instant`:t<=n*2?`smooth`:`instant`,KJ=(e,{smooth:t}={})=>{let n=BJ();if(n){let r=n.scrollHeight-n.clientHeight,i=r>0?e*r:0;n.scrollTo({top:i,behavior:GJ(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:GJ(t,Math.abs(i-window.scrollY),window.innerHeight)})};H();var qJ=2,JJ=8e3,YJ=[`wheel`,`touchstart`,`keydown`,`pointerdown`],XJ=60,ZJ=()=>{let e=_S(),[t,n]=xh(),r=Sh(),i=tu(r?`${t}?${r}`:t),a=e.status===`active`?e.role:void 0,o=t===Yi,s=t===Gh(Q.SEARCH),c=oi(t);K(()=>{if(a!==`host`||o)return;let e=()=>{J.setLocation(i,c?0:UJ()),J.send({t:`nav`,path:i})};if(!s)return e();let t=setTimeout(e,350);return()=>clearTimeout(t)},[a,i,o]),K(()=>{if(a!==`host`||o||c)return;let e=0,t,n=()=>{t=void 0,e=Date.now();let n=UJ();J.setLocation(i,n),J.send({t:`scroll`,y:n})},r=()=>{if(t)return;let r=Math.max(0,1e3/qJ-(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);K(()=>{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()+JJ,s=()=>{i=!0};for(let e of YJ)document.addEventListener(e,s,{passive:!0});let c=()=>{cancelAnimationFrame(t);for(let e of YJ)document.removeEventListener(e,s)};if(nS(),e===0)return KJ(0),c;let d=()=>{let s=HJ();s===n?r+=1:(r=0,n=s);let l=s>0&&r>=XJ;if(i||u.current!==a||l||Date.now()>o)return c();KJ(e),t=requestAnimationFrame(d)};return t=requestAnimationFrame(d),c},[i]);let d=G(!1),f=e.status===`active`?e.invite:void 0;K(()=>{d.current=!1},[f]);let p=(e,t)=>{d.current=!0,e===i?(nS(),u.current+=1,KJ(t,{smooth:!0})):(l.current=t,n(e))};return vS((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`:J.hostPath()===i&&(nS(),u.current+=1,KJ(e.y,{smooth:!0}));return;case`state`:(!d.current||t)&&p(e.path,e.y);return}}),null};H();var QJ=4,$J=2500,eY=I`
7623
+ `,GJ=1500,KJ=({label:e,value:t})=>/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`span`,{className:`label`,children:e}),/* @__PURE__ */ L(`code`,{children:/* @__PURE__ */ L(gJ,{value:t})})]}),qJ=({reason:e})=>e===`null`?/* @__PURE__ */ L(`code`,{className:`token`,"data-token-reason":!0,children:`"null"`}):/* @__PURE__ */ L(gJ,{value:e}),JJ=({load:e=LD,loadAnswerBytes:t=RD,warm:n=mJ})=>{let r=Sh(),[,i]=xh(),a=qD(r),[o,s]=z(a),[c,l]=z({kind:`idle`}),[u,d]=z(0),[f,p]=z({kind:`off`}),[m,h]=z([]),g=G(``),_=G(void 0);K(()=>{s(a),h([]),p({kind:`off`}),g.current=``,_.current!==void 0&&clearTimeout(_.current),_.current=void 0},[a]),K(()=>{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?rJ(v):/* @__PURE__ */ new Map,[v]),b=m[m.length-1],x=!(!v||v.resolved||v.reason===`not-enabled`);return K(()=>{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)},GJ))};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]),K(()=>()=>{g.current=``,_.current!==void 0&&clearTimeout(_.current)},[]),/* @__PURE__ */ V(`div`,{css:WJ,dir:`ltr`,"data-debug-trace":!0,children:[/* @__PURE__ */ L(`h1`,{children:`Graph trace`}),/* @__PURE__ */ L(`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__ */ V(`form`,{className:`ask`,onSubmit:e=>{e.preventDefault();let t=o.trim();t&&(d(e=>e+1),i(BD({uri:t})))},children:[/* @__PURE__ */ L(`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__ */ L(`button`,{type:`submit`,children:`Trace`})]}),c.kind===`idle`&&/* @__PURE__ */ L(`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__ */ L(`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__ */ V(`p`,{className:`empty`,"data-loading":!0,children:[`tracing `,a,`…`]}),c.kind===`failed`&&/* @__PURE__ */ L(`p`,{className:`failed`,"data-failed":!0,children:c.error}),v&&/* @__PURE__ */ V(W,{children:[v.resolved?/* @__PURE__ */ V(`div`,{className:`resolved`,"data-resolved":!0,children:[/* @__PURE__ */ V(`div`,{className:`pairs`,children:[/* @__PURE__ */ L(KJ,{label:`asked`,value:v.asked}),/* @__PURE__ */ L(KJ,{label:`cluster`,value:v.resolved.clusterId}),/* @__PURE__ */ L(KJ,{label:`aggregate`,value:v.resolved.aggUri}),/* @__PURE__ */ L(KJ,{label:`scope`,value:v.resolved.scope}),/* @__PURE__ */ L(KJ,{label:`kind`,value:v.resolved.kind})]}),(v.resolved.otherClusters??[]).length>0&&/* @__PURE__ */ V(`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__ */ L(`a`,{href:BD({uri:e,search:r}),children:/* @__PURE__ */ L(`code`,{children:e})},e))]})]}):/* @__PURE__ */ V(`div`,{className:`unresolved`,"data-unresolved":!0,"data-reason":v.reason??`none`,children:[/* @__PURE__ */ L(`div`,{className:`why`,children:lJ(v.reason)}),v.reason===`not-enabled`&&/* @__PURE__ */ V(`div`,{className:`advice`,children:[/* @__PURE__ */ L(`a`,{"data-reload-graph":!0,href:HD(r),children:`Reload with ?graph=1`}),` or `,/* @__PURE__ */ L(`a`,{"data-reload-store":!0,href:UD(r),children:`drop ?store=legacy`}),`, keeping this uri.`]}),/* @__PURE__ */ V(`div`,{className:`pairs`,children:[/* @__PURE__ */ L(KJ,{label:`asked`,value:v.asked}),/* @__PURE__ */ L(KJ,{label:`reason`,value:v.reason??null})]})]}),/* @__PURE__ */ V(`div`,{className:`pairs`,"data-run-length":!0,children:[/* @__PURE__ */ L(KJ,{label:`run length`,value:v.runLength?.value??null}),/* @__PURE__ */ L(KJ,{label:`from`,value:v.runLength?.from??null}),/* @__PURE__ */ L(KJ,{label:`tier`,value:v.runLength?.tier??null}),/* @__PURE__ */ L(KJ,{label:`witnesses`,value:v.runLength?.witnesses??null})]}),/* @__PURE__ */ V(`div`,{className:`pairs`,"data-cost":!0,children:[/* @__PURE__ */ L(KJ,{label:`statements`,value:v.cost?.statements??null}),/* @__PURE__ */ L(KJ,{label:`ms to build`,value:v.cost?.ms??null})]}),/* @__PURE__ */ L(`h3`,{children:`Graph counts`}),/* @__PURE__ */ L(`div`,{className:`chips`,"data-counts":!0,children:Object.entries(v.counts??{}).length===0?/* @__PURE__ */ L(`span`,{className:`empty`,children:`the bundle carries no counts`}):Object.entries(v.counts).map(([e,t])=>/* @__PURE__ */ L(`span`,{className:`chip`,children:`${e} ${t}`},e))}),/* @__PURE__ */ V(`div`,{className:`columns`,children:[/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`h3`,{children:`Anomalies`}),(v.anomalies??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`no rule complained`}):/* @__PURE__ */ L(`table`,{"data-anomalies":!0,children:/* @__PURE__ */ L(`tbody`,{children:v.anomalies.map((e,t)=>/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`td`,{children:e.rule}),/* @__PURE__ */ L(`td`,{children:e.detail})]},`${e.rule} ${e.detail} ${t}`))})})]}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ L(`h3`,{children:`Asks`}),(v.asks??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`nothing was asked of any origin`}):/* @__PURE__ */ V(`table`,{"data-asks":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`seq`}),/* @__PURE__ */ L(`th`,{children:`origin`}),/* @__PURE__ */ L(`th`,{children:`outcome`}),/* @__PURE__ */ L(`th`,{children:`reason`})]})}),/* @__PURE__ */ L(`tbody`,{children:v.asks.map((e,t)=>/* @__PURE__ */ V(`tr`,{"data-ask":e.origin,children:[/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(gJ,{value:e.seq??null})}),/* @__PURE__ */ L(`td`,{children:e.origin}),/* @__PURE__ */ L(`td`,{children:e.outcome}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(qJ,{reason:e.reason})})]},`${e.origin} ${e.seq??t}`))})]})]})]}),/* @__PURE__ */ L(`h2`,{children:`Media graph`}),/* @__PURE__ */ L(NJ,{bundle:v,selected:b,onSelect:e=>h([e])}),/* @__PURE__ */ L(`h3`,{children:`Links`}),(v.links??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`no links, refused or otherwise`}):/* @__PURE__ */ V(`table`,{"data-links":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`from`}),/* @__PURE__ */ L(`th`,{children:`to`}),/* @__PURE__ */ L(`th`,{children:`kind`}),/* @__PURE__ */ L(`th`,{children:`status`}),/* @__PURE__ */ L(`th`,{children:`by`}),/* @__PURE__ */ L(`th`,{children:`rule`}),/* @__PURE__ */ L(`th`,{children:`confidence`}),/* @__PURE__ */ L(`th`,{})]})}),/* @__PURE__ */ L(`tbody`,{children:v.links.map(e=>/* @__PURE__ */ V(`tr`,{"data-link":e.key,"data-status":e.status,className:b===e.key?`selected`:void 0,children:[/* @__PURE__ */ L(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ L(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ L(`td`,{children:e.kind}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`span`,{className:`status ${uJ(e.status)?`active`:`refused`}`,children:e.status})}),/* @__PURE__ */ L(`td`,{children:e.by}),/* @__PURE__ */ L(`td`,{children:e.reason}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(gJ,{value:e.confidence})}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ L(`h3`,{children:`Claims`}),(v.claims??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`no claims between the uris this bundle names`}):/* @__PURE__ */ V(`table`,{"data-claims":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`from`}),/* @__PURE__ */ L(`th`,{children:`to`}),/* @__PURE__ */ L(`th`,{children:`kind`}),/* @__PURE__ */ L(`th`,{children:`claimer`}),/* @__PURE__ */ L(`th`,{children:`provenance`}),/* @__PURE__ */ L(`th`,{children:`answer`}),/* @__PURE__ */ L(`th`,{children:`target scope`}),/* @__PURE__ */ L(`th`,{})]})}),/* @__PURE__ */ L(`tbody`,{children:v.claims.map(e=>/* @__PURE__ */ V(`tr`,{"data-claim":e.key,className:b===e.key?`selected`:void 0,children:[/* @__PURE__ */ L(`td`,{className:`uri`,children:e.fromUri}),/* @__PURE__ */ L(`td`,{className:`uri`,children:e.toUri}),/* @__PURE__ */ L(`td`,{children:e.kind}),/* @__PURE__ */ L(`td`,{children:e.claimer}),/* @__PURE__ */ L(`td`,{children:e.provenance}),/* @__PURE__ */ L(`td`,{children:e.answerSeq}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(gJ,{value:e.targetScope})}),/* @__PURE__ */ L(`td`,{children:/* @__PURE__ */ L(`button`,{type:`button`,className:`inspect`,onClick:()=>h([e.key]),children:`Inspect`})})]},e.key))})]}),/* @__PURE__ */ L(`h3`,{children:`Attachments`}),(v.attachments??[]).length===0?/* @__PURE__ */ L(`p`,{className:`empty`,children:`no run is attached to a container here`}):/* @__PURE__ */ V(`table`,{"data-attachments":!0,children:[/* @__PURE__ */ L(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`th`,{children:`run`}),/* @__PURE__ */ L(`th`,{children:`container`}),/* @__PURE__ */ L(`th`,{children:`via`}),/* @__PURE__ */ L(`th`,{children:`by`}),/* @__PURE__ */ L(`th`,{children:`evidence`}),/* @__PURE__ */ L(`th`,{children:`supports`})]})}),/* @__PURE__ */ L(`tbody`,{children:v.attachments.map(e=>/* @__PURE__ */ V(`tr`,{children:[/* @__PURE__ */ L(`td`,{className:`uri`,children:e.runUri}),/* @__PURE__ */ L(`td`,{className:`uri`,children:e.containerUri}),/* @__PURE__ */ L(`td`,{children:e.via}),/* @__PURE__ */ L(`td`,{children:e.by}),/* @__PURE__ */ L(`td`,{className:`uri`,children:/* @__PURE__ */ L(gJ,{value:e.evidence})}),/* @__PURE__ */ L(`td`,{children:(e.supports??[]).length===0?/* @__PURE__ */ L(gJ,{value:null}):e.supports.map(e=>/* @__PURE__ */ L(`button`,{type:`button`,className:`inspect`,"data-attachment-support":e,onClick:()=>h([e]),children:e},e))})]},`${e.runUri} ${e.containerUri} ${e.via} ${e.by}`))})]}),/* @__PURE__ */ L(`h2`,{children:`Episodes`}),/* @__PURE__ */ L(UJ,{bundle:v,index:y,selected:b,onSelect:e=>h([e])}),/* @__PURE__ */ L(`h2`,{children:`Inspector`}),/* @__PURE__ */ L(BJ,{bundle:v,index:y,trail:m,onFollow:e=>h(t=>[...t,e]),onTrailTo:e=>h(t=>t.slice(0,e+1)),loadAnswerBytes:t})]})]})},YJ=`[data-party-scroll]`,XJ=()=>{let e=document.querySelectorAll(YJ);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.scrollHeight-n.clientHeight>0)return n}},ZJ=(e,t)=>t>0?Math.min(1,Math.max(0,e/t)):0,QJ=()=>{let e=XJ();return e?Math.max(0,e.scrollHeight-e.clientHeight):Math.max(0,document.documentElement.scrollHeight-window.innerHeight)},$J=()=>{let e=XJ();return e?ZJ(e.scrollTop,e.scrollHeight-e.clientHeight):ZJ(window.scrollY,document.documentElement.scrollHeight-window.innerHeight)},eY=()=>{try{return window.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0}catch{return!1}},tY=(e,t,n)=>!e||eY()?`instant`:t<=n*2?`smooth`:`instant`,nY=(e,{smooth:t}={})=>{let n=XJ();if(n){let r=n.scrollHeight-n.clientHeight,i=r>0?e*r:0;n.scrollTo({top:i,behavior:tY(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:tY(t,Math.abs(i-window.scrollY),window.innerHeight)})};H();var rY=2,iY=8e3,aY=[`wheel`,`touchstart`,`keydown`,`pointerdown`],oY=60,sY=()=>{let e=_S(),[t,n]=xh(),r=Sh(),i=tu(r?`${t}?${r}`:t),a=e.status===`active`?e.role:void 0,o=t===Yi,s=t===Gh(Q.SEARCH),c=oi(t);K(()=>{if(a!==`host`||o)return;let e=()=>{J.setLocation(i,c?0:$J()),J.send({t:`nav`,path:i})};if(!s)return e();let t=setTimeout(e,350);return()=>clearTimeout(t)},[a,i,o]),K(()=>{if(a!==`host`||o||c)return;let e=0,t,n=()=>{t=void 0,e=Date.now();let n=$J();J.setLocation(i,n),J.send({t:`scroll`,y:n})},r=()=>{if(t)return;let r=Math.max(0,1e3/rY-(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);K(()=>{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()+iY,s=()=>{i=!0};for(let e of aY)document.addEventListener(e,s,{passive:!0});let c=()=>{cancelAnimationFrame(t);for(let e of aY)document.removeEventListener(e,s)};if(nS(),e===0)return nY(0),c;let d=()=>{let s=QJ();s===n?r+=1:(r=0,n=s);let l=s>0&&r>=oY;if(i||u.current!==a||l||Date.now()>o)return c();nY(e),t=requestAnimationFrame(d)};return t=requestAnimationFrame(d),c},[i]);let d=G(!1),f=e.status===`active`?e.invite:void 0;K(()=>{d.current=!1},[f]);let p=(e,t)=>{d.current=!0,e===i?(nS(),u.current+=1,nY(t,{smooth:!0})):(l.current=t,n(e))};return vS((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`:J.hostPath()===i&&(nS(),u.current+=1,nY(e.y,{smooth:!0}));return;case`state`:(!d.current||t)&&p(e.path,e.y);return}}),null};H();var cY=4,lY=2500,uY=I`
7587
7624
  position: fixed;
7588
7625
  left: 0;
7589
7626
  top: 0;
@@ -7610,7 +7647,7 @@ scrollbar-gutter: stable;
7610
7647
  font-weight: 600;
7611
7648
  white-space: nowrap;
7612
7649
  }
7613
- `,tY=(e,t)=>document.documentElement.dir===`rtl`&&document.elementFromPoint(e*window.innerWidth,t*window.innerHeight)?.matches(`:dir(rtl)`)?1-e:e,nY=()=>{let e=F(),t=_S(),n=t.status===`active`?t.role:void 0,[r]=xh(),i=Sh(),a=tu(i?`${r}?${i}`:r);K(()=>{if(n!==`host`)return;let e=0,t,r,i=()=>{t=void 0,r&&!J.playing()&&(e=Date.now(),J.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:tY(Math.min(1,Math.max(0,n.clientX/window.innerWidth)),a),y:a},!t&&(t=setTimeout(i,Math.max(0,1e3/QJ-(Date.now()-e))))};return window.addEventListener(`pointermove`,a,{passive:!0}),()=>{window.removeEventListener(`pointermove`,a),t&&clearTimeout(t)}},[n]);let[o,s]=z(void 0),[c,l]=z(()=>Date.now()),u=G(!1);if(vS(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||J.hostPath()===a&&s({x:e.x,y:e.y,at:Date.now()})}}),K(()=>{if(!o)return;let e=setInterval(()=>l(Date.now()),500);return()=>clearInterval(e)},[o]),n!==`guest`||!o||c-o.at>$J)return null;let d=t.status===`active`?J.nameOf(t.owner):void 0;return/* @__PURE__ */ V(`div`,{css:eY,style:{"--x":`${tY(o.x,o.y)*100}vw`,"--y":`${o.y*100}vh`},"aria-hidden":`true`,children:[/* @__PURE__ */ L(`svg`,{width:`18`,height:`22`,viewBox:`0 0 18 22`,fill:`none`,children:/* @__PURE__ */ L(`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__ */ L(`span`,{className:`tag`,children:d??e.formatMessage({id:`host#the party's host`,defaultMessage:`host`,description:`the party's host`})})]})};H();var rY=()=>({pathname:location.pathname,search:location.search,over:Jh(location.pathname,history.state)}),iY=[[`pushState`,`push`],[`replaceState`,`replace`],[`popstate`,`pop`]],aY=()=>{let e=G(rY());return K(()=>{let t=iY.map(([t,n])=>{let r=()=>{let t={from:e.current,to:rY(),kind:n,asked:aS()};e.current=t.to;let r=Wx(t)?0:Zx(t);r!==void 0&&tS(r)};return addEventListener(t,r),()=>removeEventListener(t,r)});return globalThis.navigation?.addEventListener(`navigate`,Yx),globalThis.navigation?.addEventListener(`currententrychange`,Xx),()=>{nS();for(let e of t)e();globalThis.navigation?.removeEventListener(`navigate`,Yx),globalThis.navigation?.removeEventListener(`currententrychange`,Xx)}},[]),null};H();var oY=()=>{let{query:e}=yh();return/* @__PURE__ */ L(Mh,{to:jg({query:Ag(e)}),replace:!0})},sY=()=>{let e=F();return K(()=>{globalThis.close()},[]),/* @__PURE__ */ L(`div`,{children:e.formatMessage({id:`Logging in...`,defaultMessage:`Logging in...`})})},cY=()=>{let e=Zh();return/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(Th,{hook:$h,searchHook:eg,hrefs:i_,children:/* @__PURE__ */ V(jh,{children:[/* @__PURE__ */ L(Oh,{path:Wh(Q.HOME),component:RU}),/* @__PURE__ */ L(Oh,{path:Wh(Q.MEDIA),component:RU}),/* @__PURE__ */ L(Oh,{path:Wh(Q.TITLE),component:tW}),/* @__PURE__ */ L(Oh,{path:Wh(Q.SEARCH),children:/* @__PURE__ */ L(jW,{covered:e!==void 0})}),/* @__PURE__ */ L(Oh,{path:Wh(Q.SEARCH_LEGACY),component:oY}),/* @__PURE__ */ L(Oh,{path:Wh(Q.LEGAL),component:PW}),/* @__PURE__ */ L(Oh,{path:Wh(Q.PRIVACY),component:HW}),/* @__PURE__ */ L(Oh,{path:Wh(Q.SETTINGS),component:rK}),/* @__PURE__ */ L(Oh,{path:Wh(Q.LIST),component:bK}),/* @__PURE__ */ L(Oh,{path:Wh(Q.CONTINUE),component:SK}),/* @__PURE__ */ L(Oh,{path:Wh(Q.WATCH),component:Rq}),/* @__PURE__ */ L(Oh,{path:Wh(Q.PARTY),component:Vq}),/* @__PURE__ */ L(Oh,{path:Wh(Q.DEBUG_TRACE),children:/* @__PURE__ */ L(RJ,{})}),/* @__PURE__ */ L(Oh,{path:Wh(Q.LOGIN_CALLBACK),component:sY}),/* @__PURE__ */ L(Oh,{component:mU})]})}),e?/* @__PURE__ */ L(Oh,{path:Wh(Q.MEDIA),children:/* @__PURE__ */ L(xU,{mediaNodes:[],closeTo:e})}):null]})},lY=I`
7650
+ `,dY=(e,t)=>document.documentElement.dir===`rtl`&&document.elementFromPoint(e*window.innerWidth,t*window.innerHeight)?.matches(`:dir(rtl)`)?1-e:e,fY=()=>{let e=F(),t=_S(),n=t.status===`active`?t.role:void 0,[r]=xh(),i=Sh(),a=tu(i?`${r}?${i}`:r);K(()=>{if(n!==`host`)return;let e=0,t,r,i=()=>{t=void 0,r&&!J.playing()&&(e=Date.now(),J.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:dY(Math.min(1,Math.max(0,n.clientX/window.innerWidth)),a),y:a},!t&&(t=setTimeout(i,Math.max(0,1e3/cY-(Date.now()-e))))};return window.addEventListener(`pointermove`,a,{passive:!0}),()=>{window.removeEventListener(`pointermove`,a),t&&clearTimeout(t)}},[n]);let[o,s]=z(void 0),[c,l]=z(()=>Date.now()),u=G(!1);if(vS(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||J.hostPath()===a&&s({x:e.x,y:e.y,at:Date.now()})}}),K(()=>{if(!o)return;let e=setInterval(()=>l(Date.now()),500);return()=>clearInterval(e)},[o]),n!==`guest`||!o||c-o.at>lY)return null;let d=t.status===`active`?J.nameOf(t.owner):void 0;return/* @__PURE__ */ V(`div`,{css:uY,style:{"--x":`${dY(o.x,o.y)*100}vw`,"--y":`${o.y*100}vh`},"aria-hidden":`true`,children:[/* @__PURE__ */ L(`svg`,{width:`18`,height:`22`,viewBox:`0 0 18 22`,fill:`none`,children:/* @__PURE__ */ L(`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__ */ L(`span`,{className:`tag`,children:d??e.formatMessage({id:`host#the party's host`,defaultMessage:`host`,description:`the party's host`})})]})};H();var pY=()=>({pathname:location.pathname,search:location.search,over:Jh(location.pathname,history.state)}),mY=[[`pushState`,`push`],[`replaceState`,`replace`],[`popstate`,`pop`]],hY=()=>{let e=G(pY());return K(()=>{let t=mY.map(([t,n])=>{let r=()=>{let t={from:e.current,to:pY(),kind:n,asked:aS()};e.current=t.to;let r=Wx(t)?0:Zx(t);r!==void 0&&tS(r)};return addEventListener(t,r),()=>removeEventListener(t,r)});return globalThis.navigation?.addEventListener(`navigate`,Yx),globalThis.navigation?.addEventListener(`currententrychange`,Xx),()=>{nS();for(let e of t)e();globalThis.navigation?.removeEventListener(`navigate`,Yx),globalThis.navigation?.removeEventListener(`currententrychange`,Xx)}},[]),null};H();var gY=()=>{let{query:e}=yh();return/* @__PURE__ */ L(Mh,{to:jg({query:Ag(e)}),replace:!0})},_Y=()=>{let e=F();return K(()=>{globalThis.close()},[]),/* @__PURE__ */ L(`div`,{children:e.formatMessage({id:`Logging in...`,defaultMessage:`Logging in...`})})},vY=()=>{let e=Zh();return/* @__PURE__ */ V(W,{children:[/* @__PURE__ */ L(Th,{hook:$h,searchHook:eg,hrefs:i_,children:/* @__PURE__ */ V(jh,{children:[/* @__PURE__ */ L(Oh,{path:Wh(Q.HOME),component:JU}),/* @__PURE__ */ L(Oh,{path:Wh(Q.MEDIA),component:JU}),/* @__PURE__ */ L(Oh,{path:Wh(Q.TITLE),component:dW}),/* @__PURE__ */ L(Oh,{path:Wh(Q.SEARCH),children:/* @__PURE__ */ L(VW,{covered:e!==void 0})}),/* @__PURE__ */ L(Oh,{path:Wh(Q.SEARCH_LEGACY),component:gY}),/* @__PURE__ */ L(Oh,{path:Wh(Q.LEGAL),component:WW}),/* @__PURE__ */ L(Oh,{path:Wh(Q.PRIVACY),component:QW}),/* @__PURE__ */ L(Oh,{path:Wh(Q.SETTINGS),component:pK}),/* @__PURE__ */ L(Oh,{path:Wh(Q.LIST),component:AK}),/* @__PURE__ */ L(Oh,{path:Wh(Q.CONTINUE),component:MK}),/* @__PURE__ */ L(Oh,{path:Wh(Q.WATCH),component:Jq}),/* @__PURE__ */ L(Oh,{path:Wh(Q.PARTY),component:Zq}),/* @__PURE__ */ L(Oh,{path:Wh(Q.DEBUG_TRACE),children:/* @__PURE__ */ L(JJ,{})}),/* @__PURE__ */ L(Oh,{path:Wh(Q.LOGIN_CALLBACK),component:_Y}),/* @__PURE__ */ L(Oh,{component:wU})]})}),e?/* @__PURE__ */ L(Oh,{path:Wh(Q.MEDIA),children:/* @__PURE__ */ L(jU,{mediaNodes:[],closeTo:e})}):null]})},yY=I`
7614
7651
  display: flex;
7615
7652
  flex-direction: column;
7616
7653
  min-height: 100vh;
@@ -7618,7 +7655,7 @@ scrollbar-gutter: stable;
7618
7655
  & > .content {
7619
7656
  flex: 1;
7620
7657
  }
7621
- `,uY=()=>/* @__PURE__ */ L(Th,{hook:Qh,hrefs:i_,children:/* @__PURE__ */ V(`div`,{css:lY,children:[/* @__PURE__ */ L(gC,{}),/* @__PURE__ */ L(lC,{}),/* @__PURE__ */ L(`main`,{className:`content`,children:/* @__PURE__ */ L(cY,{})}),/* @__PURE__ */ L(fC,{}),/* @__PURE__ */ L(ZJ,{}),/* @__PURE__ */ L(nY,{}),/* @__PURE__ */ L(kS,{}),/* @__PURE__ */ L(aY,{})]})});et(),H();var dY=I`
7658
+ `,bY=()=>/* @__PURE__ */ L(Th,{hook:Qh,hrefs:i_,children:/* @__PURE__ */ V(`div`,{css:yY,children:[/* @__PURE__ */ L(gC,{}),/* @__PURE__ */ L(lC,{}),/* @__PURE__ */ L(`main`,{className:`content`,children:/* @__PURE__ */ L(vY,{})}),/* @__PURE__ */ L(fC,{}),/* @__PURE__ */ L(sY,{}),/* @__PURE__ */ L(fY,{}),/* @__PURE__ */ L(kS,{}),/* @__PURE__ */ L(hY,{})]})});et(),H();var xY=I`
7622
7659
  display: flex;
7623
7660
  align-items: center;
7624
7661
  justify-content: center;
@@ -7667,7 +7704,7 @@ scrollbar-gutter: stable;
7667
7704
  background: rgba(255, 255, 255, 0.08);
7668
7705
  }
7669
7706
  }
7670
- `,fY=(e,t)=>`route: ${t}\nmessage: ${e.message}\nstack: ${e.stack??`(no stack)`}`,pY=({error:e,route:t})=>{let n=F(),[r,i]=z(!1);return/* @__PURE__ */ L(`div`,{css:dY,children:/* @__PURE__ */ V(`div`,{className:`panel`,children:[/* @__PURE__ */ L(`h2`,{children:n.formatMessage({id:`This page failed to render`,defaultMessage:`This page failed to render`})}),/* @__PURE__ */ L(`p`,{className:`message`,children:e.message||n.formatMessage({id:`No message was given.`,defaultMessage:`No message was given.`})}),/* @__PURE__ */ V(`div`,{className:`actions`,children:[/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>globalThis.location?.reload(),children:n.formatMessage({id:`Reload`,defaultMessage:`Reload`})}),/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>{let n=navigator.clipboard?.writeText(fY(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`})})]})]})})},mY=class extends Ge{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__ */ L(pY,{error:this.state.error,route:this.props.route}):this.props.children}},hY=({children:e})=>{let[t]=xh();return/* @__PURE__ */ L(mY,{route:t,children:e})};Dn(location.href)&&(window.__stubExportStore=e=>Yn(e??{excludeOrigins:[]}));var gY=async(e,t={},n={})=>tJ(tr,e,t,{settleMs:n.settleMs});dr(location.href)&&(window.__stubExportAnswers=()=>er(),window.__stubExportAsks=()=>rr(),window.__stubGraphCounts=()=>Wn()),Hn(location.href)&&(window.__stubGraphQL=(e,t,n)=>gY(e,t,n));var _Y=`stub.apikeys`;et(),((e=()=>localStorage)=>{try{e().removeItem(_Y)}catch{}})(),vf({check:Un,focused:sr}),wf(Fu);var vY=I`
7707
+ `,SY=(e,t)=>`route: ${t}\nmessage: ${e.message}\nstack: ${e.stack??`(no stack)`}`,CY=({error:e,route:t})=>{let n=F(),[r,i]=z(!1);return/* @__PURE__ */ L(`div`,{css:xY,children:/* @__PURE__ */ V(`div`,{className:`panel`,children:[/* @__PURE__ */ L(`h2`,{children:n.formatMessage({id:`This page failed to render`,defaultMessage:`This page failed to render`})}),/* @__PURE__ */ L(`p`,{className:`message`,children:e.message||n.formatMessage({id:`No message was given.`,defaultMessage:`No message was given.`})}),/* @__PURE__ */ V(`div`,{className:`actions`,children:[/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>globalThis.location?.reload(),children:n.formatMessage({id:`Reload`,defaultMessage:`Reload`})}),/* @__PURE__ */ L(`button`,{type:`button`,onClick:()=>{let n=navigator.clipboard?.writeText(SY(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`})})]})]})})},wY=class extends Ge{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__ */ L(CY,{error:this.state.error,route:this.props.route}):this.props.children}},TY=({children:e})=>{let[t]=xh();return/* @__PURE__ */ L(wY,{route:t,children:e})};Dn(location.href)&&(window.__stubExportStore=e=>Yn(e??{excludeOrigins:[]}));var EY=async(e,t={},n={})=>dJ(tr,e,t,{settleMs:n.settleMs});dr(location.href)&&(window.__stubExportAnswers=()=>er(),window.__stubExportAsks=()=>rr(),window.__stubGraphCounts=()=>Wn()),Hn(location.href)&&(window.__stubGraphQL=(e,t,n)=>EY(e,t,n));var DY=`stub.apikeys`;et(),((e=()=>localStorage)=>{try{e().removeItem(DY)}catch{}})(),vf({check:Un,focused:sr}),wf(Fu);var OY=I`
7671
7708
  :root {
7672
7709
  color-scheme: dark;
7673
7710
  /* the fixed header's own height. Every page that has to start below the bar reads this instead of
@@ -7750,4 +7787,4 @@ scrollbar-gutter: stable;
7750
7787
  .hidden {
7751
7788
  display: none !important;
7752
7789
  }
7753
- `;J.resume();var yY=document.createElement(`div`);yY.id=`stub-root`;var bY=await an();Ze(/* @__PURE__ */ L(qe,{value:bY,children:/* @__PURE__ */ V(ks,{value:zm,children:[/* @__PURE__ */ L(ke,{styles:[yn,vY]}),/* @__PURE__ */ L(hY,{children:/* @__PURE__ */ L(uY,{})})]})}),document.body.appendChild(yY));
7790
+ `;J.resume();var kY=document.createElement(`div`);kY.id=`stub-root`;var AY=await an();Ze(/* @__PURE__ */ L(qe,{value:AY,children:/* @__PURE__ */ V(ks,{value:zm,children:[/* @__PURE__ */ L(ke,{styles:[yn,OY]}),/* @__PURE__ */ L(TY,{children:/* @__PURE__ */ L(bY,{})})]})}),document.body.appendChild(kY));