@swipefindercom/finder-sdk 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(){if(typeof document!=="undefined"){var s=document.createElement("style");s.textContent="._card_doqsx_2{position:absolute;width:100%;height:100%;left:0;top:0;background-color:#fff;box-shadow:0 2px 8px #0003;overflow:hidden;transition:transform .3s ease;cursor:default;transform-origin:50% 100%;will-change:transform;z-index:1}._cardContent_doqsx_18{position:absolute;z-index:2;bottom:0;left:0;width:100%;height:100%;color:#fff}._gradientBottom_doqsx_29{position:absolute;z-index:1;bottom:0;left:0;width:100%;height:120px;background:linear-gradient(transparent,#000);pointer-events:none}._gradientTop_doqsx_41{position:absolute;z-index:1;top:0;left:0;width:100%;height:120px;background:linear-gradient(rgba(0,0,0,1),transparent);pointer-events:none}._cardName_doqsx_52{position:absolute;left:0;bottom:10%;font-weight:700;font-size:22px;padding:0 20px;text-shadow:1px 1px 2px rgba(0,0,0,.8);width:100%;text-align:left;white-space:pre-wrap}._image_trs4h_2{width:100%;height:100%;object-fit:cover}._videoContainer_119iz_3{width:100%;height:100%;position:relative;overflow:hidden}._cardVideo_119iz_10{width:100%;height:100%;object-fit:cover;position:absolute;top:0;left:0;z-index:1}._swipeableCard_14c6z_1{position:relative;width:100%;height:100%;will-change:transform,opacity;backface-visibility:hidden;-webkit-backface-visibility:hidden;touch-action:none;user-select:none;-webkit-user-select:none;pointer-events:auto}._swipeableCard_14c6z_1>*{pointer-events:none}._swipeableCard_14c6z_1 video,._swipeableCard_14c6z_1 img{pointer-events:none}._swipeHeadline_14c6z_25{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:24px;font-weight:700;color:#fff;z-index:200000}._ctaTooltip_1mai4_2{position:absolute;z-index:110;font-size:12px;top:0;right:-2px;background-color:#fff;color:#333;padding:10px 14px;border-radius:8px;font-weight:800;text-align:center;width:max-content;transition:opacity .3s ease;pointer-events:none;animation:_ctaTooltipBounce_1mai4_1 2s infinite;box-shadow:0 0 16px 1px #000;white-space:pre-line}._ctaTooltipArrow_1mai4_22{position:absolute;bottom:-8px;width:16px;height:16px;transform:translate(50%) rotate(45deg);z-index:0}@keyframes _ctaTooltipBounce_1mai4_1{0%,20%,50%,80%,to{transform:translateY(calc(-100% - 16px))}40%{transform:translateY(calc(-100% - 24px))}60%{transform:translateY(calc(-100% - 20px))}}._verticalEmojisButtons_14t5d_2{position:absolute;display:flex;flex-direction:column;align-items:center;z-index:100}._buttonContainer_14t5d_11{display:flex;flex-direction:column;align-items:center;justify-content:center;margin:8px 0}._button_14t5d_11{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 2px 5px #0003;background-color:#fff;position:relative;-webkit-user-select:none;user-select:none;transition:transform .2s ease,background-color .2s ease;outline:none;border:none;-webkit-tap-highlight-color:transparent}._button_14t5d_11:focus,._button_14t5d_11:active{outline:none;border:none}._emojiIcon_14t5d_45{width:35px;height:35px;display:block;outline:none;pointer-events:none;position:relative;z-index:2}._buttonLabel_14t5d_56{white-space:pre-wrap;margin-top:5px}._buttonAnimation_14t5d_62{transform:scale(1.3);z-index:101;position:relative}._buttonAnimation_14t5d_62:before{content:\"\";position:absolute;top:-5px;left:-5px;right:-5px;bottom:-5px;border-radius:50%;border:5px solid rgba(255,255,255,.5);z-index:1}._buttonLikeAnimation_14t5d_80{background-color:#4cd964!important;transform:scale(1.3)!important}._buttonDislikeAnimation_14t5d_85{background-color:#ff3b30!important;transform:scale(1.3)!important}._buttonMaybeAnimation_14t5d_90{background-color:#fc0!important;transform:scale(1.3)!important}._buttonSeenAnimation_14t5d_95{background-color:#007aff!important;transform:scale(1.3)!important}._contrastMode_14t5d_101 ._buttonContainer_14t5d_11{display:flex;flex-direction:column;align-items:center;justify-content:center;margin:8px 0}._contrastModeButton_14t5d_109{background-color:#fffc!important;border:2px solid black!important;box-shadow:0 0 8px #00000080!important}._contrastModeButton_14t5d_109:hover{background-color:#fff!important}._contrastModeLabel_14t5d_119{color:#fff!important;text-shadow:1px 1px 3px black,-1px -1px 3px black,1px -1px 3px black,-1px 1px 3px black!important;font-weight:700!important;font-size:12px!important;text-align:center!important;display:block!important;margin-top:5px!important;text-transform:uppercase}._contrastModeLike_14t5d_130,._contrastModeDislike_14t5d_135,._contrastModeMaybe_14t5d_140,._contrastModeSeen_14t5d_145{color:#fff!important;filter:brightness(1.5)!important}._sideButtonsContainer_jjr9u_2{position:absolute;width:100%;height:100%;left:0;top:0;display:flex;justify-content:center;align-items:center;z-index:100;pointer-events:none}._sideButtonsWrapper_jjr9u_16{position:relative;width:100%;height:100%;display:grid;grid-template-columns:1fr auto 1fr;grid-template-rows:auto 1fr auto;padding:15px;box-sizing:border-box}._sideButtonContainer_jjr9u_28{display:flex;align-items:center;flex-direction:column;gap:4px}._sideButtonLeft_jjr9u_36{grid-column:1;grid-row:2;margin-right:auto;justify-self:start;align-self:center}._sideButtonRight_jjr9u_45{grid-column:3;grid-row:2;margin-left:auto;justify-self:end;align-self:center}._sideButtonTop_jjr9u_54{grid-column:2;grid-row:1;justify-self:center;align-self:start}._sideButtonBottom_jjr9u_62{grid-column:2;grid-row:3;justify-self:center;align-self:end}._sideButton_jjr9u_2{border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px solid rgba(255,255,255,.4);background-color:#ffffffb3;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);box-shadow:0 4px 12px #0000004d;transition:all .3s ease;-webkit-tap-highlight-color:transparent;pointer-events:auto;padding:0;margin:0;gap:4px}._sideButton_jjr9u_2:hover{border-color:#fff;background-color:#ffffffe6}._buttonContent_jjr9u_95{position:relative;display:flex;align-items:center;justify-content:center}._arrowWrapper_jjr9u_103,._emojiWrapper_jjr9u_104{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center}._arrowWrapper_jjr9u_103 svg{color:#000}._arrowRight_jjr9u_120{transform:rotate(0)}._arrowLeft_jjr9u_124{transform:rotate(180deg)}._arrowUp_jjr9u_128{transform:rotate(-90deg)}._arrowDown_jjr9u_132{transform:rotate(90deg)}._emojiIcon_jjr9u_137{pointer-events:none;user-select:none;-webkit-user-select:none}._buttonLabel_jjr9u_144{white-space:pre-wrap;text-align:center;color:#000;font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.1em;line-height:1.2;user-select:none;-webkit-user-select:none;margin-top:0}@keyframes _moveRight_jjr9u_1{0%{transform:rotate(0) translate(0);opacity:.7}10%{transform:rotate(0) translate(6px);opacity:1}15%{transform:rotate(0) translate(12px);opacity:1}20%{transform:rotate(0) translate(12px);opacity:1}25%{transform:rotate(0) translate(0);opacity:.7}25.01%,to{transform:rotate(0) translate(0);opacity:.7}}@keyframes _moveLeft_jjr9u_1{0%,24.99%{transform:rotate(180deg) translate(0);opacity:.7}25%{transform:rotate(180deg) translate(0);opacity:.7}35%{transform:rotate(180deg) translate(6px);opacity:1}40%{transform:rotate(180deg) translate(12px);opacity:1}45%{transform:rotate(180deg) translate(12px);opacity:1}50%{transform:rotate(180deg) translate(0);opacity:.7}50.01%,to{transform:rotate(180deg) translate(0);opacity:.7}}@keyframes _moveUp_jjr9u_1{0%,49.99%{transform:rotate(-90deg) translate(0);opacity:.7}50%{transform:rotate(-90deg) translate(0);opacity:.7}60%{transform:rotate(-90deg) translate(6px);opacity:1}65%{transform:rotate(-90deg) translate(12px);opacity:1}70%{transform:rotate(-90deg) translate(12px);opacity:1}75%{transform:rotate(-90deg) translate(0);opacity:.7}75.01%,to{transform:rotate(-90deg) translate(0);opacity:.7}}@keyframes _moveDown_jjr9u_1{0%,74.99%{transform:rotate(90deg) translate(0);opacity:.7}75%{transform:rotate(90deg) translate(0);opacity:.7}85%{transform:rotate(90deg) translate(6px);opacity:1}90%{transform:rotate(90deg) translate(12px);opacity:1}95%{transform:rotate(90deg) translate(12px);opacity:1}to{transform:rotate(90deg) translate(0);opacity:.7}}._sideButton_jjr9u_2.like-btn ._arrowWrapper_jjr9u_103 svg._arrowRight_jjr9u_120{animation:_moveRight_jjr9u_1 8s infinite}._sideButton_jjr9u_2.dislike-btn ._arrowWrapper_jjr9u_103 svg._arrowLeft_jjr9u_124{animation:_moveLeft_jjr9u_1 8s infinite}._sideButton_jjr9u_2.maybe-btn ._arrowWrapper_jjr9u_103 svg._arrowUp_jjr9u_128{animation:_moveUp_jjr9u_1 8s infinite}._sideButton_jjr9u_2.seen-btn ._arrowWrapper_jjr9u_103 svg._arrowDown_jjr9u_132{animation:_moveDown_jjr9u_1 8s infinite}._horizontalCtaTooltip_1slua_1{position:absolute;transform:translate(-50%) translateY(-25%);left:50%;padding:10px 15px;border-radius:6px;font-weight:500;text-align:center;z-index:100;transition:opacity .3s ease;box-shadow:0 2px 8px #0003;animation:_horizontalCtaTooltipPulse_1slua_1 2s infinite ease-in-out;white-space:pre-line;background-color:#fff;color:#333;font-size:12px}._contrastMode_1slua_19 ._horizontalCtaTooltip_1slua_1{background-color:#00000080;color:#fff;border:1px solid white;font-weight:600}@keyframes _horizontalCtaTooltipPulse_1slua_1{0%{transform:translate(-50%) translateY(-25%) scale(1)}50%{transform:translate(-50%) translateY(-25%) scale(1.1)}to{transform:translate(-50%) translateY(-25%) scale(1)}}._sideButtonsContainer_1kkly_2{position:absolute;width:100%;height:100%;left:0;top:0;display:flex;justify-content:center;align-items:center;z-index:100;pointer-events:none}._sideButtonsWrapper_1kkly_16{position:relative;width:100%;height:100%;display:grid;grid-template-columns:1fr auto 1fr;grid-template-rows:auto 1fr auto;padding:15px;box-sizing:border-box}._sideButtonContainer_1kkly_28{display:flex;align-items:center;flex-direction:column;gap:4px}._sideButtonLeft_1kkly_36{grid-column:1;grid-row:2;margin-right:auto;justify-self:start;align-self:center}._sideButtonRight_1kkly_45{grid-column:3;grid-row:2;margin-left:auto;justify-self:end;align-self:center}._sideButtonTop_1kkly_54{grid-column:2;grid-row:1;justify-self:center;align-self:start}._sideButtonBottom_1kkly_62{grid-column:2;grid-row:3;justify-self:center;align-self:end}._sideButton_1kkly_2{border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px solid rgba(255,255,255,.4);background-color:#ffffffb3;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);box-shadow:0 4px 12px #0000004d;transition:all .3s ease;-webkit-tap-highlight-color:transparent;pointer-events:auto;padding:0;margin:0;gap:4px;-webkit-touch-callout:none;-webkit-user-select:none;touch-action:manipulation;cursor:pointer}._sideButton_1kkly_2:hover{border-color:#fff;background-color:#ffffffe6}._buttonContent_1kkly_99{position:relative;display:flex;align-items:center;justify-content:center}._buttonContent_1kkly_99 svg{color:#000}._buttonLabel_1kkly_111{white-space:pre-wrap;text-align:center;color:#000;font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.1em;line-height:1.2;user-select:none;-webkit-user-select:none;margin-top:0}._arrowRight_1kkly_126{transform:rotate(0)}._arrowLeft_1kkly_130{transform:rotate(180deg)}._arrowUp_1kkly_134{transform:rotate(-90deg)}._arrowDown_1kkly_138{transform:rotate(90deg)}@keyframes _moveRight_1kkly_1{0%{transform:rotate(0) translate(0);opacity:.7}10%{transform:rotate(0) translate(6px);opacity:1}15%{transform:rotate(0) translate(12px);opacity:1}20%{transform:rotate(0) translate(12px);opacity:1}25%{transform:rotate(0) translate(0);opacity:.7}25.01%,to{transform:rotate(0) translate(0);opacity:.7}}@keyframes _moveLeft_1kkly_1{0%,24.99%{transform:rotate(180deg) translate(0);opacity:.7}25%{transform:rotate(180deg) translate(0);opacity:.7}35%{transform:rotate(180deg) translate(6px);opacity:1}40%{transform:rotate(180deg) translate(12px);opacity:1}45%{transform:rotate(180deg) translate(12px);opacity:1}50%{transform:rotate(180deg) translate(0);opacity:.7}50.01%,to{transform:rotate(180deg) translate(0);opacity:.7}}@keyframes _moveUp_1kkly_1{0%,49.99%{transform:rotate(-90deg) translate(0);opacity:.7}50%{transform:rotate(-90deg) translate(0);opacity:.7}60%{transform:rotate(-90deg) translate(6px);opacity:1}65%{transform:rotate(-90deg) translate(12px);opacity:1}70%{transform:rotate(-90deg) translate(12px);opacity:1}75%{transform:rotate(-90deg) translate(0);opacity:.7}75.01%,to{transform:rotate(-90deg) translate(0);opacity:.7}}@keyframes _moveDown_1kkly_1{0%,74.99%{transform:rotate(90deg) translate(0);opacity:.7}75%{transform:rotate(90deg) translate(0);opacity:.7}85%{transform:rotate(90deg) translate(6px);opacity:1}90%{transform:rotate(90deg) translate(12px);opacity:1}95%{transform:rotate(90deg) translate(12px);opacity:1}to{transform:rotate(90deg) translate(0);opacity:.7}}._sideButton_1kkly_2.like-btn ._buttonContent_1kkly_99 svg._arrowRight_1kkly_126{animation:_moveRight_1kkly_1 8s infinite}._sideButton_1kkly_2.dislike-btn ._buttonContent_1kkly_99 svg._arrowLeft_1kkly_130{animation:_moveLeft_1kkly_1 8s infinite}._sideButton_1kkly_2.maybe-btn ._buttonContent_1kkly_99 svg._arrowUp_1kkly_134{animation:_moveUp_1kkly_1 8s infinite}._sideButton_1kkly_2.seen-btn ._buttonContent_1kkly_99 svg._arrowDown_1kkly_138{animation:_moveDown_1kkly_1 8s infinite}._tooltipWrapper_1kkly_277{grid-column:2;grid-row:2;display:flex;align-items:center;justify-content:center}._swipeTutorialOverlay_jbb64_2{position:absolute;width:100%;height:100%;left:0;top:0;display:flex;justify-content:center;align-items:center;z-index:100;pointer-events:none}._handContainer_jbb64_16{display:flex;align-items:center;justify-content:center;pointer-events:none}._handIcon_jbb64_24{filter:drop-shadow(0 4px 8px rgba(0,0,0,.3));opacity:.9}._swipeableFeed_jamse_1{position:relative;width:100%;height:100%;overflow:hidden}._swipeableFeedCards_jamse_8{position:relative;width:100%;height:100%}._swipeableFeedCards_jamse_8>*{position:absolute;top:0;left:0;width:100%;height:100%}._swipeableFeedEmpty_jamse_22{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:#666;font-size:16px;text-align:center}._swipeTutorialContainer_jamse_33{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:150}._volumeControl_r52gg_2{position:absolute;z-index:1100;display:flex;align-items:center;gap:8px;margin:0}._volumeControlTopLeft_r52gg_12{top:10px;left:10px}._volumeControlTopRight_r52gg_17{top:10px;right:10px;flex-direction:row-reverse}._volumeControlBottomLeft_r52gg_23{bottom:80px;left:15px}._volumeControlBottomRight_r52gg_28{bottom:80px;right:15px;flex-direction:row-reverse}._volumeControlButton_r52gg_34{width:auto;height:30px;cursor:pointer;background-color:#0006;border-radius:50%;transition:background-color .2s ease;display:flex;align-items:center;justify-content:center;padding:4px;box-sizing:border-box;flex-shrink:0}._volumeControlButton_r52gg_34:hover{background-color:#000000b3}._volumeControlButton_r52gg_34 img{width:100%;height:100%;object-fit:contain}._volumeSlider_r52gg_60{background-color:#0006;border-radius:20px;padding:8px 12px;display:flex;align-items:center;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);opacity:0;pointer-events:none;transition:opacity .2s ease}._volumeSlider_r52gg_60:hover{background-color:#000000b3}._volumeControl_r52gg_2:hover ._volumeSlider_r52gg_60{opacity:1;pointer-events:auto}._volumeSliderInput_r52gg_81{width:100px;height:4px;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#ffffff4d;border-radius:2px;outline:none;cursor:pointer}._volumeSliderInput_r52gg_81::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:12px;height:12px;border-radius:50%;background:#fff;cursor:pointer;transition:transform .1s ease}._volumeSliderInput_r52gg_81::-webkit-slider-thumb:hover{transform:scale(1.2)}._volumeSliderInput_r52gg_81::-moz-range-thumb{width:12px;height:12px;border-radius:50%;background:#fff;cursor:pointer;border:none;transition:transform .1s ease}._volumeSliderInput_r52gg_81::-moz-range-thumb:hover{transform:scale(1.2)}._historyButton_1xf6c_1{border-radius:50%;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:1000;box-shadow:16px 20px 8px #00000026,inset -4px -4px 10px #0003;background-image:linear-gradient(135deg,#fff3,#0003);outline:none;-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none}._historyCardsContent_1xf6c_17{margin:12px 0}._historyButton_1xf6c_1:focus{outline:none}._historyButton_1xf6c_1:active{outline:none;-webkit-tap-highlight-color:transparent}._historyButton_1xf6c_1:focus-visible{outline:none}._historyButton_1xf6c_1 img{pointer-events:none}._tooltip_1xf6c_39{display:flex;z-index:110;line-height:1.2;padding:10px 14px;position:absolute;top:0;border-radius:8px;font-weight:800;text-align:center;width:max-content;transition:opacity .3s ease;box-shadow:0 0 16px 1px #000;left:50%;white-space:pre-line;transform:translate(-50%) translateY(calc(-100% - 16px));animation:_historyButtonTooltipBounce_1xf6c_1 2s infinite}._tooltipArrow_1xf6c_59{position:absolute;bottom:-8px;left:50%;width:16px;height:16px;transform:translate(-50%) rotate(45deg);z-index:0}@keyframes _historyButtonTooltipBounce_1xf6c_1{0%,20%,50%,80%,to{transform:translate(-50%) translateY(calc(-100% - 16px))}40%{transform:translate(-50%) translateY(calc(-100% - 24px))}60%{transform:translate(-50%) translateY(calc(-100% - 20px))}}._drawerOverlay_1eftt_2{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#00000080;z-index:999;opacity:0;visibility:hidden;transition:opacity .5s ease,visibility .5s ease}._drawerOverlayScoped_1eftt_16{position:absolute;top:0;left:0;right:0;bottom:0}._drawerOverlayVisible_1eftt_24{opacity:1;visibility:visible}._drawer_1eftt_2{position:fixed;bottom:0;left:0;right:0;height:80%;background:#fff;border-radius:20px 20px 0 0;z-index:1000;transform:translateY(100%);transition:transform .6s cubic-bezier(.25,.46,.45,.94);box-shadow:0 -8px 32px #0003;display:flex;flex-direction:column;overflow:hidden}._drawerScoped_1eftt_48{position:absolute;bottom:0;left:0;right:0}._drawerOpen_1eftt_55{transform:translateY(0)}._drawerHandle_1eftt_60{width:40px;height:4px;background-color:#0003;border-radius:2px;margin:12px auto 8px;flex-shrink:0;transition:background-color .2s ease}._drawerHandle_1eftt_60:hover{background-color:#0000004d}._drawerEmojisContainer_1eftt_75{display:flex;justify-content:space-between;padding:16px 20px;border-bottom:1px solid rgba(0,0,0,.1);flex-shrink:0}._drawerEmojiItem_1eftt_84{display:flex;flex-direction:column;align-items:center;gap:8px}._drawerEmojiItemActive_1eftt_91 ._drawerEmojiLabel_1eftt_91{color:#000;font-weight:700}._drawerEmojiButton_1eftt_97{display:flex;align-items:center;justify-content:center;padding:0;border-radius:50%;background:#fffc;border:2px solid rgba(0,0,0,.2);cursor:pointer;transition:all .3s ease;width:50px;height:50px;box-shadow:0 2px 8px #00000026;-webkit-tap-highlight-color:transparent}._drawerEmojiButtonActive_1eftt_113{background:#fff;border:3px solid rgba(0,0,0,.6);box-shadow:0 4px 12px #00000040;transform:scale(1.1)}._drawerEmojiLikeActive_1eftt_125{border-color:#4caf50;background:#4caf5026;box-shadow:0 4px 12px #4caf504d}._drawerEmojiDislikeActive_1eftt_135{border-color:#f44336;background:#f4433626;box-shadow:0 4px 12px #f443364d}._drawerEmojiMaybeActive_1eftt_145{border-color:#ff9800;background:#ff980026;box-shadow:0 4px 12px #ff98004d}._drawerEmojiSeenActive_1eftt_155{border-color:#2196f3;background:#2196f326;box-shadow:0 4px 12px #2196f34d}._drawerEmojiIcon_1eftt_162{width:32px;height:32px;object-fit:contain}._drawerEmojiLabel_1eftt_91{font-size:11px;font-weight:600;color:#000c;text-align:center;line-height:1.2;text-transform:uppercase;letter-spacing:.5px;white-space:pre-wrap}._drawerEmojiLike_1eftt_121:hover{border-color:#4caf50;background:#4caf501a}._drawerEmojiDislike_1eftt_131:hover{border-color:#f44336;background:#f443361a}._drawerEmojiMaybe_1eftt_141:hover{border-color:#ff9800;background:#ff98001a}._drawerEmojiSeen_1eftt_151:hover{border-color:#2196f3;background:#2196f31a}._drawerContent_1eftt_202{flex:1;padding:20px;-webkit-overflow-scrolling:touch;overflow-y:auto}._drawerCloseButton_1eftt_210{background:linear-gradient(135deg,#ff6b6b,#ee5a52);color:#fff;border:none;padding:12px 24px;margin:20px;border-radius:25px;font-size:16px;font-weight:600;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;transition:all .3s ease;box-shadow:0 4px 16px #ff6b6b4d;outline:none;-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;align-self:center;min-height:48px;white-space:pre-wrap}._drawerCloseButton_1eftt_210:hover{transform:translateY(-2px);box-shadow:0 6px 20px #ff6b6b66}._drawerCloseButton_1eftt_210:active{transform:translateY(0);box-shadow:0 2px 8px #ff6b6b4d}._drawerCloseButton_1eftt_210:focus{outline:none}._drawerCloseButton_1eftt_210:focus-visible{outline:2px solid rgba(255,107,107,.5);outline-offset:2px}._drawerCloseIcon_1eftt_255{width:16px;height:16px;filter:brightness(0) invert(1)}@media (max-width: 768px){._drawer_1eftt_2{height:80%;border-radius:30px 30px 0 0}._drawerContent_1eftt_202{padding:16px}._drawerCloseButton_1eftt_210{margin:16px;padding:10px 20px;font-size:14px}}@media (max-width: 480px){._drawer_1eftt_2{height:80%;border-radius:30px 30px 0 0}._drawerContent_1eftt_202{padding:12px}._drawerCloseButton_1eftt_210{margin:12px;font-size:14px}}._cardListContainer_zrmnf_2{padding:20px;overscroll-behavior-y:contain;touch-action:pan-y;overflow-y:auto;height:100%;box-sizing:border-box}._cardListContainerNoPadding_zrmnf_11{padding:0;box-sizing:border-box}._summaryGridContainer_zrmnf_17{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:20px;box-sizing:border-box}._summaryGridItem_zrmnf_26{aspect-ratio:1;border-radius:8px;overflow:hidden;background:#0000000d;cursor:default}._summaryGridItemClickable_zrmnf_34{cursor:pointer}._gridPlaceholder_zrmnf_39{width:100%;height:100%;background:#f2f2f2;display:flex;align-items:center;justify-content:center;font-size:12px;color:#181818}._gridItemImage_zrmnf_51{width:100%;height:100%;object-fit:cover}._summaryCardItem_zrmnf_58{display:flex;gap:8px;padding:12px;border-radius:8px;background:#f2f2f2;color:#181818;margin-bottom:8px;align-items:center;cursor:default}._summaryCardItemClickable_zrmnf_70{cursor:pointer}._cardItemImage_zrmnf_75{width:60px;height:60px;border-radius:6px;object-fit:cover;flex-shrink:0}._cardItemPlaceholder_zrmnf_84{width:60px;height:60px;border-radius:6px;background:#d9d9d9;display:flex;align-items:center;justify-content:center;font-size:12px;color:#00000080;flex-shrink:0}._cardItemContent_zrmnf_98{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center}._cardItemTitle_zrmnf_107{margin:0 0 2px;font-size:14px;font-weight:600;line-height:1.2;text-align:left}._cardItemPrice_zrmnf_116{margin:0;font-size:12px;color:#000000b3;line-height:1.2}._summaryContainer_1gtok_3{display:flex;flex-direction:column;height:100%;width:100%;background-color:#fff;overflow:hidden;position:relative}._summaryShareButtonFixed_1gtok_14{position:absolute;bottom:10px;right:10px;width:45px;height:45px;font-size:12px;text-transform:uppercase;border-radius:50%;background-color:#2196f3;color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000026;transition:all .3s ease;z-index:1000;-webkit-tap-highlight-color:transparent}._summaryShareButtonFixed_1gtok_14:hover{background-color:#1976d2;box-shadow:0 6px 16px #0003;transform:scale(1.05)}._summaryShareButtonFixed_1gtok_14:active{transform:scale(.95);box-shadow:0 2px 8px #00000026}._summaryShareButtonFixed_1gtok_14 ._shareIcon_1gtok_47{width:24px;height:24px;filter:brightness(0) invert(1)}._summaryExplaination_1gtok_54{gap:8px;padding:12px;border-radius:8px;align-items:center;margin:12px 20px 0;font-size:14px;font-weight:600;line-height:1.2;text-align:center;justify-content:center;white-space:pre-wrap;background:#f2f2f2;color:#181818}._summaryTabs_1gtok_71{display:flex;justify-content:center;padding:16px 20px;background-color:#f5f5f5;border-bottom:1px solid #e0e0e0}._summaryTab_1gtok_71{display:flex;flex-direction:column;align-items:center;cursor:pointer;transition:all .3s ease;text-align:center;padding:0 5px;-webkit-tap-highlight-color:transparent}._summaryEmojiItem_1gtok_96{display:flex;flex-direction:column;align-items:center;gap:8px}._summaryEmojiButton_1gtok_108{display:flex;align-items:center;justify-content:center;padding:0;border-radius:50%;background:#fffc;border:2px solid rgba(0,0,0,.2);cursor:pointer;transition:all .3s ease;width:40px;height:40px;box-shadow:0 2px 8px #00000026;-webkit-tap-highlight-color:transparent}._summaryEmojiButtonActive_1gtok_124{background:#fff;border:3px solid rgba(0,0,0,.6);box-shadow:0 4px 12px #00000040;transform:scale(1.1)}._summaryEmojiLikeActive_1gtok_136{border-color:#4caf50;background:#4caf5026;box-shadow:0 4px 12px #4caf504d}._summaryEmojiDislikeActive_1gtok_146{border-color:#f44336;background:#f4433626;box-shadow:0 4px 12px #f443364d}._summaryEmojiMaybeActive_1gtok_156{border-color:#ff9800;background:#ff980026;box-shadow:0 4px 12px #ff98004d}._summaryEmojiSeenActive_1gtok_166{border-color:#2196f3;background:#2196f326;box-shadow:0 4px 12px #2196f34d}._summaryEmojiLike_1gtok_132:hover{border-color:#4caf50;background:#4caf501a}._summaryEmojiDislike_1gtok_142:hover{border-color:#f44336;background:#f443361a}._summaryEmojiMaybe_1gtok_152:hover{border-color:#ff9800;background:#ff98001a}._summaryEmojiSeen_1gtok_162:hover{border-color:#2196f3;background:#2196f31a}._summaryEmojiIcon_1gtok_194{width:28px;height:28px;object-fit:contain}._summaryEmojiLabel_1gtok_201{font-size:11px;font-weight:600;color:#000c;text-align:center;line-height:1.2;text-transform:uppercase;letter-spacing:.5px}._summaryEmojiItemActive_1gtok_103 ._summaryEmojiLabel_1gtok_201{color:#000;font-weight:700}._summaryContent_1gtok_217{flex:1;overflow:hidden;position:relative;background-color:#fff;min-height:0}._summaryPanel_1gtok_226{display:none;position:absolute;top:0;left:0;right:0;bottom:0;height:100%;width:100%;overflow-y:auto;min-height:0;box-sizing:border-box;overscroll-behavior:contain}._summaryPanelActive_1gtok_241{display:block}._summaryEmptyState_1gtok_246{text-align:center;padding:40px 20px;color:#181818}._summaryEmptyStateText_1gtok_252{margin:0 0 16px;font-size:18px;font-weight:600}._historyDrawerContent_x0jj6_1,._historyDrawerContent_x0jj6_1 .summary-container{height:100%;display:flex;flex-direction:column;overflow:hidden}._historyDrawerEmpty_x0jj6_15{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;padding:40px 20px;text-align:center;color:#666}._historyDrawerEmpty_x0jj6_15 p{margin:8px 0;font-size:16px}._historyDrawerEmptyHint_x0jj6_31{font-size:14px;color:#999}._historyDrawerTitle_x0jj6_36{margin:0 0 16px;padding:20px 20px 0;font-size:20px;font-weight:700;color:#333}._historyDrawerList_x0jj6_44{height:100%;display:flex;flex-direction:column;overflow:hidden}._historyDrawerList_x0jj6_44 .card-list-container{flex:1;overflow-y:auto}._historyDrawerGrouped_x0jj6_56{height:100%;display:flex;flex-direction:column;overflow-y:auto}._historyDrawerGroup_x0jj6_56{margin-bottom:24px}._historyDrawerGroup_x0jj6_56:last-child{margin-bottom:0}._historyDrawerGroupTitle_x0jj6_71{margin:0 0 12px;padding:20px 20px 0;font-size:18px;font-weight:700;color:#333}._historyDrawerGroup_x0jj6_56:first-child ._historyDrawerGroupTitle_x0jj6_71{padding-top:20px}._historyDrawerGroup_x0jj6_56 .card-list-container{padding-top:0}._historyDrawer_x0jj6_1 .drawer-content{padding:20px 0}._historyDrawer_x0jj6_1 .drawer-content .summary-tabs,._historyDrawer_x0jj6_1 .drawer-content .summary-content{background-color:transparent!important}._filtersButton_qio2f_1{position:absolute;z-index:1000;min-width:80px;height:40px;padding:8px 16px;border:none;border-radius:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;outline:none;-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-size:14px;font-weight:500;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;text-align:center;white-space:pre-wrap;background-image:linear-gradient(135deg,#ffffff1a,#0000001a);transition:all .3s ease;box-shadow:0 4px 8px #00000026}._filtersButton_qio2f_1:hover{box-shadow:0 6px 12px #0003;transform:translateY(-1px)}._filtersButton_qio2f_1:active{transform:translateY(1px);box-shadow:0 2px 4px #00000026}._filtersButton_qio2f_1:focus{outline:none}._filtersButton_qio2f_1:focus-visible{outline:none}._filtersLeft_qio2f_46{left:20px;right:auto}._filtersMiddle_qio2f_51{left:50%;right:auto;transform:translate(-50%)}._filtersRight_qio2f_57{left:auto;right:20px}._filtersIcon_qio2f_63{pointer-events:none;flex-shrink:0}._content_hci8k_2{padding:12px 20px}._title_hci8k_7{margin:0 0 12px;font-size:16px;font-weight:600;color:#333;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;white-space:pre-wrap}._categories_hci8k_17{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:0}._pill_hci8k_25{display:inline-flex;align-items:center;padding:6px 12px;border-radius:20px;cursor:pointer;font-size:13px;font-weight:500;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;transition:all .2s ease;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}._noCategories_hci8k_40{width:100%;color:#999;font-style:italic;text-align:center;padding:20px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}._cardsCounter_1h26d_1{width:100%;text-align:left;font-size:14px;font-weight:700;color:#fff;text-shadow:1px 1px 2px rgba(0,0,0,.8);padding:5px 5px 5px 21px;pointer-events:none;white-space:pre-wrap}._logo_1rzq2_1{display:block;height:auto;max-width:100%;-webkit-user-select:none;user-select:none;pointer-events:none}._container_18bki_1{position:absolute}._interactiveFeed_1wsuw_1,._swippingJourney_15509_1{position:relative;width:100%;height:100%;overflow:hidden}._mainBootstrap_1rzog_1{width:100%;height:100%;position:relative}:root{--media-object-fit: cover}*{margin:0;padding:0;box-sizing:border-box;font-family:Arial,sans-serif}body{touch-action:pan-y;-webkit-user-select:none;user-select:none}";document.head.appendChild(s);}})();!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SwipeFinderSDK={})}(this,function(e){"use strict";var t,i,n,s,r,a,o,l,u,c,d,h,f,g,m,p,v,y,A,E,b=Object.defineProperty,S=e=>{throw TypeError(e)},T=(e,t,i)=>((e,t,i)=>t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),k=(e,t,i)=>t.has(e)||S("Cannot "+i),w=(e,t,i)=>(k(e,t,"read from private field"),i?i.call(e):t.get(e)),I=(e,t,i)=>t.has(e)?S("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),L=(e,t,i,n)=>(k(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),C=(e,t,i)=>(k(e,t,"access private method"),i);function R(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var x={exports:{}},D={},P=Symbol.for("react.element"),M=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),N=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),H=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),G=Symbol.iterator;var Q={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},K=Object.assign,z={};function W(e,t,i){this.props=e,this.context=t,this.refs=z,this.updater=i||Q}function q(){}function Y(e,t,i){this.props=e,this.context=t,this.refs=z,this.updater=i||Q}W.prototype.isReactComponent={},W.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},W.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},q.prototype=W.prototype;var $=Y.prototype=new q;$.constructor=Y,K($,W.prototype),$.isPureReactComponent=!0;var X=Array.isArray,Z=Object.prototype.hasOwnProperty,J={current:null},ee={key:!0,ref:!0,__self:!0,__source:!0};function te(e,t,i){var n,s={},r=null,a=null;if(null!=t)for(n in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(r=""+t.key),t)Z.call(t,n)&&!ee.hasOwnProperty(n)&&(s[n]=t[n]);var o=arguments.length-2;if(1===o)s.children=i;else if(1<o){for(var l=Array(o),u=0;u<o;u++)l[u]=arguments[u+2];s.children=l}if(e&&e.defaultProps)for(n in o=e.defaultProps)void 0===s[n]&&(s[n]=o[n]);return{$$typeof:P,type:e,key:r,ref:a,props:s,_owner:J.current}}function ie(e){return"object"==typeof e&&null!==e&&e.$$typeof===P}var ne=/\/+/g;function se(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function re(e,t,i,n,s){var r=typeof e;"undefined"!==r&&"boolean"!==r||(e=null);var a=!1;if(null===e)a=!0;else switch(r){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case P:case M:a=!0}}if(a)return s=s(a=e),e=""===n?"."+se(a,0):n,X(s)?(i="",null!=e&&(i=e.replace(ne,"$&/")+"/"),re(s,t,i,"",function(e){return e})):null!=s&&(ie(s)&&(s=function(e,t){return{$$typeof:P,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,i+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(ne,"$&/")+"/")+e)),t.push(s)),1;if(a=0,n=""===n?".":n+":",X(e))for(var o=0;o<e.length;o++){var l=n+se(r=e[o],o);a+=re(r,t,i,l,s)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=G&&e[G]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),o=0;!(r=e.next()).done;)a+=re(r=r.value,t,i,l=n+se(r,o++),s);else if("object"===r)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function ae(e,t,i){if(null==e)return e;var n=[],s=0;return re(e,n,"","",function(e){return t.call(i,e,s++)}),n}function oe(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var le={current:null},ue={transition:null},ce={ReactCurrentDispatcher:le,ReactCurrentBatchConfig:ue,ReactCurrentOwner:J};function de(){throw Error("act(...) is not supported in production builds of React.")}D.Children={map:ae,forEach:function(e,t,i){ae(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return ae(e,function(){t++}),t},toArray:function(e){return ae(e,function(e){return e})||[]},only:function(e){if(!ie(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},D.Component=W,D.Fragment=O,D.Profiler=F,D.PureComponent=Y,D.StrictMode=B,D.Suspense=j,D.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ce,D.act=de,D.cloneElement=function(e,t,i){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=K({},e.props),s=e.key,r=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(r=t.ref,a=J.current),void 0!==t.key&&(s=""+t.key),e.type&&e.type.defaultProps)var o=e.type.defaultProps;for(l in t)Z.call(t,l)&&!ee.hasOwnProperty(l)&&(n[l]=void 0===t[l]&&void 0!==o?o[l]:t[l])}var l=arguments.length-2;if(1===l)n.children=i;else if(1<l){o=Array(l);for(var u=0;u<l;u++)o[u]=arguments[u+2];n.children=o}return{$$typeof:P,type:e.type,key:s,ref:r,props:n,_owner:a}},D.createContext=function(e){return(e={$$typeof:N,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:_,_context:e},e.Consumer=e},D.createElement=te,D.createFactory=function(e){var t=te.bind(null,e);return t.type=e,t},D.createRef=function(){return{current:null}},D.forwardRef=function(e){return{$$typeof:U,render:e}},D.isValidElement=ie,D.lazy=function(e){return{$$typeof:V,_payload:{_status:-1,_result:e},_init:oe}},D.memo=function(e,t){return{$$typeof:H,type:e,compare:void 0===t?null:t}},D.startTransition=function(e){var t=ue.transition;ue.transition={};try{e()}finally{ue.transition=t}},D.unstable_act=de,D.useCallback=function(e,t){return le.current.useCallback(e,t)},D.useContext=function(e){return le.current.useContext(e)},D.useDebugValue=function(){},D.useDeferredValue=function(e){return le.current.useDeferredValue(e)},D.useEffect=function(e,t){return le.current.useEffect(e,t)},D.useId=function(){return le.current.useId()},D.useImperativeHandle=function(e,t,i){return le.current.useImperativeHandle(e,t,i)},D.useInsertionEffect=function(e,t){return le.current.useInsertionEffect(e,t)},D.useLayoutEffect=function(e,t){return le.current.useLayoutEffect(e,t)},D.useMemo=function(e,t){return le.current.useMemo(e,t)},D.useReducer=function(e,t,i){return le.current.useReducer(e,t,i)},D.useRef=function(e){return le.current.useRef(e)},D.useState=function(e){return le.current.useState(e)},D.useSyncExternalStore=function(e,t,i){return le.current.useSyncExternalStore(e,t,i)},D.useTransition=function(){return le.current.useTransition()},D.version="18.3.1",x.exports=D;var he=x.exports;const fe=R(he);var ge={exports:{}},me={},pe={exports:{}},ve={};!function(e){function t(e,t){var i=e.length;e.push(t);e:for(;0<i;){var n=i-1>>>1,r=e[n];if(!(0<s(r,t)))break e;e[n]=t,e[i]=r,i=n}}function i(e){return 0===e.length?null:e[0]}function n(e){if(0===e.length)return null;var t=e[0],i=e.pop();if(i!==t){e[0]=i;e:for(var n=0,r=e.length,a=r>>>1;n<a;){var o=2*(n+1)-1,l=e[o],u=o+1,c=e[u];if(0>s(l,i))u<r&&0>s(c,l)?(e[n]=c,e[u]=i,n=u):(e[n]=l,e[o]=i,n=o);else{if(!(u<r&&0>s(c,i)))break e;e[n]=c,e[u]=i,n=u}}}return t}function s(e,t){var i=e.sortIndex-t.sortIndex;return 0!==i?i:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var r=performance;e.unstable_now=function(){return r.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var l=[],u=[],c=1,d=null,h=3,f=!1,g=!1,m=!1,p="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function A(e){for(var s=i(u);null!==s;){if(null===s.callback)n(u);else{if(!(s.startTime<=e))break;n(u),s.sortIndex=s.expirationTime,t(l,s)}s=i(u)}}function E(e){if(m=!1,A(e),!g)if(null!==i(l))g=!0,P(b);else{var t=i(u);null!==t&&M(E,t.startTime-e)}}function b(t,s){g=!1,m&&(m=!1,v(w),w=-1),f=!0;var r=h;try{for(A(s),d=i(l);null!==d&&(!(d.expirationTime>s)||t&&!C());){var a=d.callback;if("function"==typeof a){d.callback=null,h=d.priorityLevel;var o=a(d.expirationTime<=s);s=e.unstable_now(),"function"==typeof o?d.callback=o:d===i(l)&&n(l),A(s)}else n(l);d=i(l)}if(null!==d)var c=!0;else{var p=i(u);null!==p&&M(E,p.startTime-s),c=!1}return c}finally{d=null,h=r,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,T=!1,k=null,w=-1,I=5,L=-1;function C(){return!(e.unstable_now()-L<I)}function R(){if(null!==k){var t=e.unstable_now();L=t;var i=!0;try{i=k(!0,t)}finally{i?S():(T=!1,k=null)}}else T=!1}if("function"==typeof y)S=function(){y(R)};else if("undefined"!=typeof MessageChannel){var x=new MessageChannel,D=x.port2;x.port1.onmessage=R,S=function(){D.postMessage(null)}}else S=function(){p(R,0)};function P(e){k=e,T||(T=!0,S())}function M(t,i){w=p(function(){t(e.unstable_now())},i)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){g||f||(g=!0,P(b))},e.unstable_forceFrameRate=function(e){0>e||125<e||(I=0<e?Math.floor(1e3/e):5)},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return i(l)},e.unstable_next=function(e){switch(h){case 1:case 2:case 3:var t=3;break;default:t=h}var i=h;h=t;try{return e()}finally{h=i}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var i=h;h=e;try{return t()}finally{h=i}},e.unstable_scheduleCallback=function(n,s,r){var a=e.unstable_now();switch("object"==typeof r&&null!==r?r="number"==typeof(r=r.delay)&&0<r?a+r:a:r=a,n){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return n={id:c++,callback:s,priorityLevel:n,startTime:r,expirationTime:o=r+o,sortIndex:-1},r>a?(n.sortIndex=r,t(u,n),null===i(l)&&n===i(u)&&(m?(v(w),w=-1):m=!0,M(E,r-a))):(n.sortIndex=o,t(l,n),g||f||(g=!0,P(b))),n},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(e){var t=h;return function(){var i=h;h=t;try{return e.apply(this,arguments)}finally{h=i}}}}(ve),pe.exports=ve;var ye=pe.exports,Ae=he,Ee=ye;function be(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Se=new Set,Te={};function ke(e,t){we(e,t),we(e+"Capture",t)}function we(e,t){for(Te[e]=t,e=0;e<t.length;e++)Se.add(t[e])}var Ie=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Le=Object.prototype.hasOwnProperty,Ce=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Re={},xe={};function De(e,t,i,n,s,r,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=i,this.propertyName=e,this.type=t,this.sanitizeURL=r,this.removeEmptyString=a}var Pe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Pe[e]=new De(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Pe[t]=new De(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){Pe[e]=new De(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Pe[e]=new De(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Pe[e]=new De(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){Pe[e]=new De(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){Pe[e]=new De(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){Pe[e]=new De(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){Pe[e]=new De(e,5,!1,e.toLowerCase(),null,!1,!1)});var Me=/[\-:]([a-z])/g;function Oe(e){return e[1].toUpperCase()}function Be(e,t,i,n){var s=Pe.hasOwnProperty(t)?Pe[t]:null;(null!==s?0!==s.type:n||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,i,n){if(null==t||function(e,t,i,n){if(null!==i&&0===i.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!n&&(null!==i?!i.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,i,n))return!0;if(n)return!1;if(null!==i)switch(i.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,i,s,n)&&(i=null),n||null===s?function(e){return!!Le.call(xe,e)||!Le.call(Re,e)&&(Ce.test(e)?xe[e]=!0:(Re[e]=!0,!1))}(t)&&(null===i?e.removeAttribute(t):e.setAttribute(t,""+i)):s.mustUseProperty?e[s.propertyName]=null===i?3!==s.type&&"":i:(t=s.attributeName,n=s.attributeNamespace,null===i?e.removeAttribute(t):(i=3===(s=s.type)||4===s&&!0===i?"":""+i,n?e.setAttributeNS(n,t,i):e.setAttribute(t,i))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Me,Oe);Pe[t]=new De(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Me,Oe);Pe[t]=new De(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Me,Oe);Pe[t]=new De(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){Pe[e]=new De(e,1,!1,e.toLowerCase(),null,!1,!1)}),Pe.xlinkHref=new De("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){Pe[e]=new De(e,1,!1,e.toLowerCase(),null,!0,!0)});var Fe=Ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,_e=Symbol.for("react.element"),Ne=Symbol.for("react.portal"),Ue=Symbol.for("react.fragment"),je=Symbol.for("react.strict_mode"),He=Symbol.for("react.profiler"),Ve=Symbol.for("react.provider"),Ge=Symbol.for("react.context"),Qe=Symbol.for("react.forward_ref"),Ke=Symbol.for("react.suspense"),ze=Symbol.for("react.suspense_list"),We=Symbol.for("react.memo"),qe=Symbol.for("react.lazy"),Ye=Symbol.for("react.offscreen"),$e=Symbol.iterator;function Xe(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=$e&&e[$e]||e["@@iterator"])?e:null}var Ze,Je=Object.assign;function et(e){if(void 0===Ze)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ze=t&&t[1]||""}return"\n"+Ze+e}var tt=!1;function it(e,t){if(!e||tt)return"";tt=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var n=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){n=u}e.call(t.prototype)}else{try{throw Error()}catch(u){n=u}e()}}catch(u){if(u&&n&&"string"==typeof u.stack){for(var s=u.stack.split("\n"),r=n.stack.split("\n"),a=s.length-1,o=r.length-1;1<=a&&0<=o&&s[a]!==r[o];)o--;for(;1<=a&&0<=o;a--,o--)if(s[a]!==r[o]){if(1!==a||1!==o)do{if(a--,0>--o||s[a]!==r[o]){var l="\n"+s[a].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=a&&0<=o);break}}}finally{tt=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?et(e):""}function nt(e){switch(e.tag){case 5:return et(e.type);case 16:return et("Lazy");case 13:return et("Suspense");case 19:return et("SuspenseList");case 0:case 2:case 15:return e=it(e.type,!1);case 11:return e=it(e.type.render,!1);case 1:return e=it(e.type,!0);default:return""}}function st(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case Ue:return"Fragment";case Ne:return"Portal";case He:return"Profiler";case je:return"StrictMode";case Ke:return"Suspense";case ze:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case Ge:return(e.displayName||"Context")+".Consumer";case Ve:return(e._context.displayName||"Context")+".Provider";case Qe:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case We:return null!==(t=e.displayName||null)?t:st(e.type)||"Memo";case qe:t=e._payload,e=e._init;try{return st(e(t))}catch(i){}}return null}function rt(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return st(t);case 8:return t===je?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function at(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function ot(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function lt(e){e._valueTracker||(e._valueTracker=function(e){var t=ot(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==i&&"function"==typeof i.get&&"function"==typeof i.set){var s=i.get,r=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(e){n=""+e,r.call(this,e)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function ut(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),n="";return e&&(n=ot(e)?e.checked?"true":"false":e.value),(e=n)!==i&&(t.setValue(e),!0)}function ct(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function dt(e,t){var i=t.checked;return Je({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=i?i:e._wrapperState.initialChecked})}function ht(e,t){var i=null==t.defaultValue?"":t.defaultValue,n=null!=t.checked?t.checked:t.defaultChecked;i=at(null!=t.value?t.value:i),e._wrapperState={initialChecked:n,initialValue:i,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function ft(e,t){null!=(t=t.checked)&&Be(e,"checked",t,!1)}function gt(e,t){ft(e,t);var i=at(t.value),n=t.type;if(null!=i)"number"===n?(0===i&&""===e.value||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if("submit"===n||"reset"===n)return void e.removeAttribute("value");t.hasOwnProperty("value")?pt(e,t.type,i):t.hasOwnProperty("defaultValue")&&pt(e,t.type,at(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function mt(e,t,i){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!("submit"!==n&&"reset"!==n||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,i||t===e.value||(e.value=t),e.defaultValue=t}""!==(i=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==i&&(e.name=i)}function pt(e,t,i){"number"===t&&ct(e.ownerDocument)===e||(null==i?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var vt=Array.isArray;function yt(e,t,i,n){if(e=e.options,t){t={};for(var s=0;s<i.length;s++)t["$"+i[s]]=!0;for(i=0;i<e.length;i++)s=t.hasOwnProperty("$"+e[i].value),e[i].selected!==s&&(e[i].selected=s),s&&n&&(e[i].defaultSelected=!0)}else{for(i=""+at(i),t=null,s=0;s<e.length;s++){if(e[s].value===i)return e[s].selected=!0,void(n&&(e[s].defaultSelected=!0));null!==t||e[s].disabled||(t=e[s])}null!==t&&(t.selected=!0)}}function At(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(be(91));return Je({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Et(e,t){var i=t.value;if(null==i){if(i=t.children,t=t.defaultValue,null!=i){if(null!=t)throw Error(be(92));if(vt(i)){if(1<i.length)throw Error(be(93));i=i[0]}t=i}null==t&&(t=""),i=t}e._wrapperState={initialValue:at(i)}}function bt(e,t){var i=at(t.value),n=at(t.defaultValue);null!=i&&((i=""+i)!==e.value&&(e.value=i),null==t.defaultValue&&e.defaultValue!==i&&(e.defaultValue=i)),null!=n&&(e.defaultValue=""+n)}function St(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function Tt(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function kt(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Tt(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var wt,It,Lt=(It=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((wt=wt||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=wt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,i,n){MSApp.execUnsafeLocalFunction(function(){return It(e,t)})}:It);function Ct(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&3===i.nodeType)return void(i.nodeValue=t)}e.textContent=t}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xt=["Webkit","ms","Moz","O"];function Dt(e,t,i){return null==t||"boolean"==typeof t||""===t?"":i||"number"!=typeof t||0===t||Rt.hasOwnProperty(e)&&Rt[e]?(""+t).trim():t+"px"}function Pt(e,t){for(var i in e=e.style,t)if(t.hasOwnProperty(i)){var n=0===i.indexOf("--"),s=Dt(i,t[i],n);"float"===i&&(i="cssFloat"),n?e.setProperty(i,s):e[i]=s}}Object.keys(Rt).forEach(function(e){xt.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Rt[t]=Rt[e]})});var Mt=Je({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ot(e,t){if(t){if(Mt[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(be(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(be(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(be(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(be(62))}}function Bt(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ft=null;function _t(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Nt=null,Ut=null,jt=null;function Ht(e){if(e=Br(e)){if("function"!=typeof Nt)throw Error(be(280));var t=e.stateNode;t&&(t=_r(t),Nt(e.stateNode,e.type,t))}}function Vt(e){Ut?jt?jt.push(e):jt=[e]:Ut=e}function Gt(){if(Ut){var e=Ut,t=jt;if(jt=Ut=null,Ht(e),t)for(e=0;e<t.length;e++)Ht(t[e])}}function Qt(e,t){return e(t)}function Kt(){}var zt=!1;function Wt(e,t,i){if(zt)return e(t,i);zt=!0;try{return Qt(e,t,i)}finally{zt=!1,(null!==Ut||null!==jt)&&(Kt(),Gt())}}function qt(e,t){var i=e.stateNode;if(null===i)return null;var n=_r(i);if(null===n)return null;i=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(n=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!n;break e;default:e=!1}if(e)return null;if(i&&"function"!=typeof i)throw Error(be(231,t,typeof i));return i}var Yt=!1;if(Ie)try{var $t={};Object.defineProperty($t,"passive",{get:function(){Yt=!0}}),window.addEventListener("test",$t,$t),window.removeEventListener("test",$t,$t)}catch(It){Yt=!1}function Xt(e,t,i,n,s,r,a,o,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(i,u)}catch(c){this.onError(c)}}var Zt=!1,Jt=null,ei=!1,ti=null,ii={onError:function(e){Zt=!0,Jt=e}};function ni(e,t,i,n,s,r,a,o,l){Zt=!1,Jt=null,Xt.apply(ii,arguments)}function si(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(i=t.return),e=t.return}while(e)}return 3===t.tag?i:null}function ri(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function ai(e){if(si(e)!==e)throw Error(be(188))}function oi(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=si(e)))throw Error(be(188));return t!==e?null:e}for(var i=e,n=t;;){var s=i.return;if(null===s)break;var r=s.alternate;if(null===r){if(null!==(n=s.return)){i=n;continue}break}if(s.child===r.child){for(r=s.child;r;){if(r===i)return ai(s),e;if(r===n)return ai(s),t;r=r.sibling}throw Error(be(188))}if(i.return!==n.return)i=s,n=r;else{for(var a=!1,o=s.child;o;){if(o===i){a=!0,i=s,n=r;break}if(o===n){a=!0,n=s,i=r;break}o=o.sibling}if(!a){for(o=r.child;o;){if(o===i){a=!0,i=r,n=s;break}if(o===n){a=!0,n=r,i=s;break}o=o.sibling}if(!a)throw Error(be(189))}}if(i.alternate!==n)throw Error(be(190))}if(3!==i.tag)throw Error(be(188));return i.stateNode.current===i?e:t}(e))?li(e):null}function li(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=li(e);if(null!==t)return t;e=e.sibling}return null}var ui=Ee.unstable_scheduleCallback,ci=Ee.unstable_cancelCallback,di=Ee.unstable_shouldYield,hi=Ee.unstable_requestPaint,fi=Ee.unstable_now,gi=Ee.unstable_getCurrentPriorityLevel,mi=Ee.unstable_ImmediatePriority,pi=Ee.unstable_UserBlockingPriority,vi=Ee.unstable_NormalPriority,yi=Ee.unstable_LowPriority,Ai=Ee.unstable_IdlePriority,Ei=null,bi=null;var Si=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(Ti(e)/ki|0)|0},Ti=Math.log,ki=Math.LN2;var wi=64,Ii=4194304;function Li(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ci(e,t){var i=e.pendingLanes;if(0===i)return 0;var n=0,s=e.suspendedLanes,r=e.pingedLanes,a=268435455&i;if(0!==a){var o=a&~s;0!==o?n=Li(o):0!==(r&=a)&&(n=Li(r))}else 0!==(a=i&~s)?n=Li(a):0!==r&&(n=Li(r));if(0===n)return 0;if(0!==t&&t!==n&&0===(t&s)&&((s=n&-n)>=(r=t&-t)||16===s&&4194240&r))return t;if(4&n&&(n|=16&i),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=n;0<t;)s=1<<(i=31-Si(t)),n|=e[i],t&=~s;return n}function Ri(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function xi(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function Di(){var e=wi;return!(4194240&(wi<<=1))&&(wi=64),e}function Pi(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function Mi(e,t,i){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-Si(t)]=i}function Oi(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var n=31-Si(i),s=1<<n;s&t|e[n]&t&&(e[n]|=t),i&=~s}}var Bi=0;function Fi(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var _i,Ni,Ui,ji,Hi,Vi=!1,Gi=[],Qi=null,Ki=null,zi=null,Wi=new Map,qi=new Map,Yi=[],$i="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Xi(e,t){switch(e){case"focusin":case"focusout":Qi=null;break;case"dragenter":case"dragleave":Ki=null;break;case"mouseover":case"mouseout":zi=null;break;case"pointerover":case"pointerout":Wi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":qi.delete(t.pointerId)}}function Zi(e,t,i,n,s,r){return null===e||e.nativeEvent!==r?(e={blockedOn:t,domEventName:i,eventSystemFlags:n,nativeEvent:r,targetContainers:[s]},null!==t&&(null!==(t=Br(t))&&Ni(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,null!==s&&-1===t.indexOf(s)&&t.push(s),e)}function Ji(e){var t=Or(e.target);if(null!==t){var i=si(t);if(null!==i)if(13===(t=i.tag)){if(null!==(t=ri(i)))return e.blockedOn=t,void Hi(e.priority,function(){Ui(i)})}else if(3===t&&i.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===i.tag?i.stateNode.containerInfo:null)}e.blockedOn=null}function en(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var i=hn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==i)return null!==(t=Br(i))&&Ni(t),e.blockedOn=i,!1;var n=new(i=e.nativeEvent).constructor(i.type,i);Ft=n,i.target.dispatchEvent(n),Ft=null,t.shift()}return!0}function tn(e,t,i){en(e)&&i.delete(t)}function nn(){Vi=!1,null!==Qi&&en(Qi)&&(Qi=null),null!==Ki&&en(Ki)&&(Ki=null),null!==zi&&en(zi)&&(zi=null),Wi.forEach(tn),qi.forEach(tn)}function sn(e,t){e.blockedOn===t&&(e.blockedOn=null,Vi||(Vi=!0,Ee.unstable_scheduleCallback(Ee.unstable_NormalPriority,nn)))}function rn(e){function t(t){return sn(t,e)}if(0<Gi.length){sn(Gi[0],e);for(var i=1;i<Gi.length;i++){var n=Gi[i];n.blockedOn===e&&(n.blockedOn=null)}}for(null!==Qi&&sn(Qi,e),null!==Ki&&sn(Ki,e),null!==zi&&sn(zi,e),Wi.forEach(t),qi.forEach(t),i=0;i<Yi.length;i++)(n=Yi[i]).blockedOn===e&&(n.blockedOn=null);for(;0<Yi.length&&null===(i=Yi[0]).blockedOn;)Ji(i),null===i.blockedOn&&Yi.shift()}var an=Fe.ReactCurrentBatchConfig,on=!0;function ln(e,t,i,n){var s=Bi,r=an.transition;an.transition=null;try{Bi=1,cn(e,t,i,n)}finally{Bi=s,an.transition=r}}function un(e,t,i,n){var s=Bi,r=an.transition;an.transition=null;try{Bi=4,cn(e,t,i,n)}finally{Bi=s,an.transition=r}}function cn(e,t,i,n){if(on){var s=hn(e,t,i,n);if(null===s)ar(e,t,n,dn,i),Xi(e,n);else if(function(e,t,i,n,s){switch(t){case"focusin":return Qi=Zi(Qi,e,t,i,n,s),!0;case"dragenter":return Ki=Zi(Ki,e,t,i,n,s),!0;case"mouseover":return zi=Zi(zi,e,t,i,n,s),!0;case"pointerover":var r=s.pointerId;return Wi.set(r,Zi(Wi.get(r)||null,e,t,i,n,s)),!0;case"gotpointercapture":return r=s.pointerId,qi.set(r,Zi(qi.get(r)||null,e,t,i,n,s)),!0}return!1}(s,e,t,i,n))n.stopPropagation();else if(Xi(e,n),4&t&&-1<$i.indexOf(e)){for(;null!==s;){var r=Br(s);if(null!==r&&_i(r),null===(r=hn(e,t,i,n))&&ar(e,t,n,dn,i),r===s)break;s=r}null!==s&&n.stopPropagation()}else ar(e,t,n,null,i)}}var dn=null;function hn(e,t,i,n){if(dn=null,null!==(e=Or(e=_t(n))))if(null===(t=si(e)))e=null;else if(13===(i=t.tag)){if(null!==(e=ri(t)))return e;e=null}else if(3===i){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return dn=e,null}function fn(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(gi()){case mi:return 1;case pi:return 4;case vi:case yi:return 16;case Ai:return 536870912;default:return 16}default:return 16}}var gn=null,mn=null,pn=null;function vn(){if(pn)return pn;var e,t,i=mn,n=i.length,s="value"in gn?gn.value:gn.textContent,r=s.length;for(e=0;e<n&&i[e]===s[e];e++);var a=n-e;for(t=1;t<=a&&i[n-t]===s[r-t];t++);return pn=s.slice(e,1<t?1-t:void 0)}function yn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function An(){return!0}function En(){return!1}function bn(e){function t(t,i,n,s,r){for(var a in this._reactName=t,this._targetInst=n,this.type=i,this.nativeEvent=s,this.target=r,this.currentTarget=null,e)e.hasOwnProperty(a)&&(t=e[a],this[a]=t?t(s):s[a]);return this.isDefaultPrevented=(null!=s.defaultPrevented?s.defaultPrevented:!1===s.returnValue)?An:En,this.isPropagationStopped=En,this}return Je(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=An)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=An)},persist:function(){},isPersistent:An}),t}var Sn,Tn,kn,wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},In=bn(wn),Ln=Je({},wn,{view:0,detail:0}),Cn=bn(Ln),Rn=Je({},Ln,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==kn&&(kn&&"mousemove"===e.type?(Sn=e.screenX-kn.screenX,Tn=e.screenY-kn.screenY):Tn=Sn=0,kn=e),Sn)},movementY:function(e){return"movementY"in e?e.movementY:Tn}}),xn=bn(Rn),Dn=bn(Je({},Rn,{dataTransfer:0})),Pn=bn(Je({},Ln,{relatedTarget:0})),Mn=bn(Je({},wn,{animationName:0,elapsedTime:0,pseudoElement:0})),On=Je({},wn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Bn=bn(On),Fn=bn(Je({},wn,{data:0})),_n={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Un={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Un[e])&&!!t[e]}function Hn(){return jn}var Vn=Je({},Ln,{key:function(e){if(e.key){var t=_n[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=yn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Nn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hn,charCode:function(e){return"keypress"===e.type?yn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?yn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Gn=bn(Vn),Qn=bn(Je({},Rn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Kn=bn(Je({},Ln,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hn})),zn=bn(Je({},wn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Wn=Je({},Rn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),qn=bn(Wn),Yn=[9,13,27,32],$n=Ie&&"CompositionEvent"in window,Xn=null;Ie&&"documentMode"in document&&(Xn=document.documentMode);var Zn=Ie&&"TextEvent"in window&&!Xn,Jn=Ie&&(!$n||Xn&&8<Xn&&11>=Xn),es=String.fromCharCode(32),ts=!1;function is(e,t){switch(e){case"keyup":return-1!==Yn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ns(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var ss=!1;var rs={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function as(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!rs[e.type]:"textarea"===t}function os(e,t,i,n){Vt(n),0<(t=lr(t,"onChange")).length&&(i=new In("onChange","change",null,i,n),e.push({event:i,listeners:t}))}var ls=null,us=null;function cs(e){er(e,0)}function ds(e){if(ut(Fr(e)))return e}function hs(e,t){if("change"===e)return t}var fs=!1;if(Ie){var gs;if(Ie){var ms="oninput"in document;if(!ms){var ps=document.createElement("div");ps.setAttribute("oninput","return;"),ms="function"==typeof ps.oninput}gs=ms}else gs=!1;fs=gs&&(!document.documentMode||9<document.documentMode)}function vs(){ls&&(ls.detachEvent("onpropertychange",ys),us=ls=null)}function ys(e){if("value"===e.propertyName&&ds(us)){var t=[];os(t,us,e,_t(e)),Wt(cs,t)}}function As(e,t,i){"focusin"===e?(vs(),us=i,(ls=t).attachEvent("onpropertychange",ys)):"focusout"===e&&vs()}function Es(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return ds(us)}function bs(e,t){if("click"===e)return ds(t)}function Ss(e,t){if("input"===e||"change"===e)return ds(t)}var Ts="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function ks(e,t){if(Ts(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(n=0;n<i.length;n++){var s=i[n];if(!Le.call(t,s)||!Ts(e[s],t[s]))return!1}return!0}function ws(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Is(e,t){var i,n=ws(e);for(e=0;n;){if(3===n.nodeType){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ws(n)}}function Ls(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?Ls(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function Cs(){for(var e=window,t=ct();t instanceof e.HTMLIFrameElement;){try{var i="string"==typeof t.contentWindow.location.href}catch(n){i=!1}if(!i)break;t=ct((e=t.contentWindow).document)}return t}function Rs(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function xs(e){var t=Cs(),i=e.focusedElem,n=e.selectionRange;if(t!==i&&i&&i.ownerDocument&&Ls(i.ownerDocument.documentElement,i)){if(null!==n&&Rs(i))if(t=n.start,void 0===(e=n.end)&&(e=t),"selectionStart"in i)i.selectionStart=t,i.selectionEnd=Math.min(e,i.value.length);else if((e=(t=i.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var s=i.textContent.length,r=Math.min(n.start,s);n=void 0===n.end?r:Math.min(n.end,s),!e.extend&&r>n&&(s=n,n=r,r=s),s=Is(i,r);var a=Is(i,n);s&&a&&(1!==e.rangeCount||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&((t=t.createRange()).setStart(s.node,s.offset),e.removeAllRanges(),r>n?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}for(t=[],e=i;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof i.focus&&i.focus(),i=0;i<t.length;i++)(e=t[i]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Ds=Ie&&"documentMode"in document&&11>=document.documentMode,Ps=null,Ms=null,Os=null,Bs=!1;function Fs(e,t,i){var n=i.window===i?i.document:9===i.nodeType?i:i.ownerDocument;Bs||null==Ps||Ps!==ct(n)||("selectionStart"in(n=Ps)&&Rs(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},Os&&ks(Os,n)||(Os=n,0<(n=lr(Ms,"onSelect")).length&&(t=new In("onSelect","select",null,t,i),e.push({event:t,listeners:n}),t.target=Ps)))}function _s(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Ns={animationend:_s("Animation","AnimationEnd"),animationiteration:_s("Animation","AnimationIteration"),animationstart:_s("Animation","AnimationStart"),transitionend:_s("Transition","TransitionEnd")},Us={},js={};function Hs(e){if(Us[e])return Us[e];if(!Ns[e])return e;var t,i=Ns[e];for(t in i)if(i.hasOwnProperty(t)&&t in js)return Us[e]=i[t];return e}Ie&&(js=document.createElement("div").style,"AnimationEvent"in window||(delete Ns.animationend.animation,delete Ns.animationiteration.animation,delete Ns.animationstart.animation),"TransitionEvent"in window||delete Ns.transitionend.transition);var Vs=Hs("animationend"),Gs=Hs("animationiteration"),Qs=Hs("animationstart"),Ks=Hs("transitionend"),zs=new Map,Ws="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function qs(e,t){zs.set(e,t),ke(t,[e])}for(var Ys=0;Ys<Ws.length;Ys++){var $s=Ws[Ys];qs($s.toLowerCase(),"on"+($s[0].toUpperCase()+$s.slice(1)))}qs(Vs,"onAnimationEnd"),qs(Gs,"onAnimationIteration"),qs(Qs,"onAnimationStart"),qs("dblclick","onDoubleClick"),qs("focusin","onFocus"),qs("focusout","onBlur"),qs(Ks,"onTransitionEnd"),we("onMouseEnter",["mouseout","mouseover"]),we("onMouseLeave",["mouseout","mouseover"]),we("onPointerEnter",["pointerout","pointerover"]),we("onPointerLeave",["pointerout","pointerover"]),ke("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ke("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ke("onBeforeInput",["compositionend","keypress","textInput","paste"]),ke("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ke("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ke("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Zs=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xs));function Js(e,t,i){var n=e.type||"unknown-event";e.currentTarget=i,function(e,t,i,n,s,r,a,o,l){if(ni.apply(this,arguments),Zt){if(!Zt)throw Error(be(198));var u=Jt;Zt=!1,Jt=null,ei||(ei=!0,ti=u)}}(n,t,void 0,e),e.currentTarget=null}function er(e,t){t=!!(4&t);for(var i=0;i<e.length;i++){var n=e[i],s=n.event;n=n.listeners;e:{var r=void 0;if(t)for(var a=n.length-1;0<=a;a--){var o=n[a],l=o.instance,u=o.currentTarget;if(o=o.listener,l!==r&&s.isPropagationStopped())break e;Js(s,o,u),r=l}else for(a=0;a<n.length;a++){if(l=(o=n[a]).instance,u=o.currentTarget,o=o.listener,l!==r&&s.isPropagationStopped())break e;Js(s,o,u),r=l}}}if(ei)throw e=ti,ei=!1,ti=null,e}function tr(e,t){var i=t[Dr];void 0===i&&(i=t[Dr]=new Set);var n=e+"__bubble";i.has(n)||(rr(t,e,2,!1),i.add(n))}function ir(e,t,i){var n=0;t&&(n|=4),rr(i,e,n,t)}var nr="_reactListening"+Math.random().toString(36).slice(2);function sr(e){if(!e[nr]){e[nr]=!0,Se.forEach(function(t){"selectionchange"!==t&&(Zs.has(t)||ir(t,!1,e),ir(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[nr]||(t[nr]=!0,ir("selectionchange",!1,t))}}function rr(e,t,i,n){switch(fn(t)){case 1:var s=ln;break;case 4:s=un;break;default:s=cn}i=s.bind(null,t,i,e),s=void 0,!Yt||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(s=!0),n?void 0!==s?e.addEventListener(t,i,{capture:!0,passive:s}):e.addEventListener(t,i,!0):void 0!==s?e.addEventListener(t,i,{passive:s}):e.addEventListener(t,i,!1)}function ar(e,t,i,n,s){var r=n;if(!(1&t||2&t||null===n))e:for(;;){if(null===n)return;var a=n.tag;if(3===a||4===a){var o=n.stateNode.containerInfo;if(o===s||8===o.nodeType&&o.parentNode===s)break;if(4===a)for(a=n.return;null!==a;){var l=a.tag;if((3===l||4===l)&&((l=a.stateNode.containerInfo)===s||8===l.nodeType&&l.parentNode===s))return;a=a.return}for(;null!==o;){if(null===(a=Or(o)))return;if(5===(l=a.tag)||6===l){n=r=a;continue e}o=o.parentNode}}n=n.return}Wt(function(){var n=r,s=_t(i),a=[];e:{var o=zs.get(e);if(void 0!==o){var l=In,u=e;switch(e){case"keypress":if(0===yn(i))break e;case"keydown":case"keyup":l=Gn;break;case"focusin":u="focus",l=Pn;break;case"focusout":u="blur",l=Pn;break;case"beforeblur":case"afterblur":l=Pn;break;case"click":if(2===i.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=xn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=Dn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=Kn;break;case Vs:case Gs:case Qs:l=Mn;break;case Ks:l=zn;break;case"scroll":l=Cn;break;case"wheel":l=qn;break;case"copy":case"cut":case"paste":l=Bn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=Qn}var c=!!(4&t),d=!c&&"scroll"===e,h=c?null!==o?o+"Capture":null:o;c=[];for(var f,g=n;null!==g;){var m=(f=g).stateNode;if(5===f.tag&&null!==m&&(f=m,null!==h&&(null!=(m=qt(g,h))&&c.push(or(g,m,f)))),d)break;g=g.return}0<c.length&&(o=new l(o,u,null,i,s),a.push({event:o,listeners:c}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(o="mouseover"===e||"pointerover"===e)||i===Ft||!(u=i.relatedTarget||i.fromElement)||!Or(u)&&!u[xr])&&(l||o)&&(o=s.window===s?s:(o=s.ownerDocument)?o.defaultView||o.parentWindow:window,l?(l=n,null!==(u=(u=i.relatedTarget||i.toElement)?Or(u):null)&&(u!==(d=si(u))||5!==u.tag&&6!==u.tag)&&(u=null)):(l=null,u=n),l!==u)){if(c=xn,m="onMouseLeave",h="onMouseEnter",g="mouse","pointerout"!==e&&"pointerover"!==e||(c=Qn,m="onPointerLeave",h="onPointerEnter",g="pointer"),d=null==l?o:Fr(l),f=null==u?o:Fr(u),(o=new c(m,g+"leave",l,i,s)).target=d,o.relatedTarget=f,m=null,Or(s)===n&&((c=new c(h,g+"enter",u,i,s)).target=f,c.relatedTarget=d,m=c),d=m,l&&u)e:{for(h=u,g=0,f=c=l;f;f=ur(f))g++;for(f=0,m=h;m;m=ur(m))f++;for(;0<g-f;)c=ur(c),g--;for(;0<f-g;)h=ur(h),f--;for(;g--;){if(c===h||null!==h&&c===h.alternate)break e;c=ur(c),h=ur(h)}c=null}else c=null;null!==l&&cr(a,o,l,c,!1),null!==u&&null!==d&&cr(a,d,u,c,!0)}if("select"===(l=(o=n?Fr(n):window).nodeName&&o.nodeName.toLowerCase())||"input"===l&&"file"===o.type)var p=hs;else if(as(o))if(fs)p=Ss;else{p=Es;var v=As}else(l=o.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===o.type||"radio"===o.type)&&(p=bs);switch(p&&(p=p(e,n))?os(a,p,i,s):(v&&v(e,o,n),"focusout"===e&&(v=o._wrapperState)&&v.controlled&&"number"===o.type&&pt(o,"number",o.value)),v=n?Fr(n):window,e){case"focusin":(as(v)||"true"===v.contentEditable)&&(Ps=v,Ms=n,Os=null);break;case"focusout":Os=Ms=Ps=null;break;case"mousedown":Bs=!0;break;case"contextmenu":case"mouseup":case"dragend":Bs=!1,Fs(a,i,s);break;case"selectionchange":if(Ds)break;case"keydown":case"keyup":Fs(a,i,s)}var y;if($n)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else ss?is(e,i)&&(A="onCompositionEnd"):"keydown"===e&&229===i.keyCode&&(A="onCompositionStart");A&&(Jn&&"ko"!==i.locale&&(ss||"onCompositionStart"!==A?"onCompositionEnd"===A&&ss&&(y=vn()):(mn="value"in(gn=s)?gn.value:gn.textContent,ss=!0)),0<(v=lr(n,A)).length&&(A=new Fn(A,e,null,i,s),a.push({event:A,listeners:v}),y?A.data=y:null!==(y=ns(i))&&(A.data=y))),(y=Zn?function(e,t){switch(e){case"compositionend":return ns(t);case"keypress":return 32!==t.which?null:(ts=!0,es);case"textInput":return(e=t.data)===es&&ts?null:e;default:return null}}(e,i):function(e,t){if(ss)return"compositionend"===e||!$n&&is(e,t)?(e=vn(),pn=mn=gn=null,ss=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Jn&&"ko"!==t.locale?null:t.data}}(e,i))&&(0<(n=lr(n,"onBeforeInput")).length&&(s=new Fn("onBeforeInput","beforeinput",null,i,s),a.push({event:s,listeners:n}),s.data=y))}er(a,t)})}function or(e,t,i){return{instance:e,listener:t,currentTarget:i}}function lr(e,t){for(var i=t+"Capture",n=[];null!==e;){var s=e,r=s.stateNode;5===s.tag&&null!==r&&(s=r,null!=(r=qt(e,i))&&n.unshift(or(e,r,s)),null!=(r=qt(e,t))&&n.push(or(e,r,s))),e=e.return}return n}function ur(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function cr(e,t,i,n,s){for(var r=t._reactName,a=[];null!==i&&i!==n;){var o=i,l=o.alternate,u=o.stateNode;if(null!==l&&l===n)break;5===o.tag&&null!==u&&(o=u,s?null!=(l=qt(i,r))&&a.unshift(or(i,l,o)):s||null!=(l=qt(i,r))&&a.push(or(i,l,o))),i=i.return}0!==a.length&&e.push({event:t,listeners:a})}var dr=/\r\n?/g,hr=/\u0000|\uFFFD/g;function fr(e){return("string"==typeof e?e:""+e).replace(dr,"\n").replace(hr,"")}function gr(e,t,i){if(t=fr(t),fr(e)!==t&&i)throw Error(be(425))}function mr(){}var pr=null,vr=null;function yr(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Ar="function"==typeof setTimeout?setTimeout:void 0,Er="function"==typeof clearTimeout?clearTimeout:void 0,br="function"==typeof Promise?Promise:void 0,Sr="function"==typeof queueMicrotask?queueMicrotask:void 0!==br?function(e){return br.resolve(null).then(e).catch(Tr)}:Ar;function Tr(e){setTimeout(function(){throw e})}function kr(e,t){var i=t,n=0;do{var s=i.nextSibling;if(e.removeChild(i),s&&8===s.nodeType)if("/$"===(i=s.data)){if(0===n)return e.removeChild(s),void rn(t);n--}else"$"!==i&&"$?"!==i&&"$!"!==i||n++;i=s}while(i);rn(t)}function wr(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function Ir(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var i=e.data;if("$"===i||"$!"===i||"$?"===i){if(0===t)return e;t--}else"/$"===i&&t++}e=e.previousSibling}return null}var Lr=Math.random().toString(36).slice(2),Cr="__reactFiber$"+Lr,Rr="__reactProps$"+Lr,xr="__reactContainer$"+Lr,Dr="__reactEvents$"+Lr,Pr="__reactListeners$"+Lr,Mr="__reactHandles$"+Lr;function Or(e){var t=e[Cr];if(t)return t;for(var i=e.parentNode;i;){if(t=i[xr]||i[Cr]){if(i=t.alternate,null!==t.child||null!==i&&null!==i.child)for(e=Ir(e);null!==e;){if(i=e[Cr])return i;e=Ir(e)}return t}i=(e=i).parentNode}return null}function Br(e){return!(e=e[Cr]||e[xr])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function Fr(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(be(33))}function _r(e){return e[Rr]||null}var Nr=[],Ur=-1;function jr(e){return{current:e}}function Hr(e){0>Ur||(e.current=Nr[Ur],Nr[Ur]=null,Ur--)}function Vr(e,t){Ur++,Nr[Ur]=e.current,e.current=t}var Gr={},Qr=jr(Gr),Kr=jr(!1),zr=Gr;function Wr(e,t){var i=e.type.contextTypes;if(!i)return Gr;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s,r={};for(s in i)r[s]=t[s];return n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=r),r}function qr(e){return null!=(e=e.childContextTypes)}function Yr(){Hr(Kr),Hr(Qr)}function $r(e,t,i){if(Qr.current!==Gr)throw Error(be(168));Vr(Qr,t),Vr(Kr,i)}function Xr(e,t,i){var n=e.stateNode;if(t=t.childContextTypes,"function"!=typeof n.getChildContext)return i;for(var s in n=n.getChildContext())if(!(s in t))throw Error(be(108,rt(e)||"Unknown",s));return Je({},i,n)}function Zr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gr,zr=Qr.current,Vr(Qr,e),Vr(Kr,Kr.current),!0}function Jr(e,t,i){var n=e.stateNode;if(!n)throw Error(be(169));i?(e=Xr(e,t,zr),n.__reactInternalMemoizedMergedChildContext=e,Hr(Kr),Hr(Qr),Vr(Qr,e)):Hr(Kr),Vr(Kr,i)}var ea=null,ta=!1,ia=!1;function na(e){null===ea?ea=[e]:ea.push(e)}function sa(){if(!ia&&null!==ea){ia=!0;var e=0,t=Bi;try{var i=ea;for(Bi=1;e<i.length;e++){var n=i[e];do{n=n(!0)}while(null!==n)}ea=null,ta=!1}catch(s){throw null!==ea&&(ea=ea.slice(e+1)),ui(mi,sa),s}finally{Bi=t,ia=!1}}return null}var ra=[],aa=0,oa=null,la=0,ua=[],ca=0,da=null,ha=1,fa="";function ga(e,t){ra[aa++]=la,ra[aa++]=oa,oa=e,la=t}function ma(e,t,i){ua[ca++]=ha,ua[ca++]=fa,ua[ca++]=da,da=e;var n=ha;e=fa;var s=32-Si(n)-1;n&=~(1<<s),i+=1;var r=32-Si(t)+s;if(30<r){var a=s-s%5;r=(n&(1<<a)-1).toString(32),n>>=a,s-=a,ha=1<<32-Si(t)+s|i<<s|n,fa=r+e}else ha=1<<r|i<<s|n,fa=e}function pa(e){null!==e.return&&(ga(e,1),ma(e,1,0))}function va(e){for(;e===oa;)oa=ra[--aa],ra[aa]=null,la=ra[--aa],ra[aa]=null;for(;e===da;)da=ua[--ca],ua[ca]=null,fa=ua[--ca],ua[ca]=null,ha=ua[--ca],ua[ca]=null}var ya=null,Aa=null,Ea=!1,ba=null;function Sa(e,t){var i=zc(5,null,null,0);i.elementType="DELETED",i.stateNode=t,i.return=e,null===(t=e.deletions)?(e.deletions=[i],e.flags|=16):t.push(i)}function Ta(e,t){switch(e.tag){case 5:var i=e.type;return null!==(t=1!==t.nodeType||i.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,ya=e,Aa=wr(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,ya=e,Aa=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(i=null!==da?{id:ha,overflow:fa}:null,e.memoizedState={dehydrated:t,treeContext:i,retryLane:1073741824},(i=zc(18,null,null,0)).stateNode=t,i.return=e,e.child=i,ya=e,Aa=null,!0);default:return!1}}function ka(e){return!(!(1&e.mode)||128&e.flags)}function wa(e){if(Ea){var t=Aa;if(t){var i=t;if(!Ta(e,t)){if(ka(e))throw Error(be(418));t=wr(i.nextSibling);var n=ya;t&&Ta(e,t)?Sa(n,i):(e.flags=-4097&e.flags|2,Ea=!1,ya=e)}}else{if(ka(e))throw Error(be(418));e.flags=-4097&e.flags|2,Ea=!1,ya=e}}}function Ia(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ya=e}function La(e){if(e!==ya)return!1;if(!Ea)return Ia(e),Ea=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!yr(e.type,e.memoizedProps)),t&&(t=Aa)){if(ka(e))throw Ca(),Error(be(418));for(;t;)Sa(e,t),t=wr(t.nextSibling)}if(Ia(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(be(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var i=e.data;if("/$"===i){if(0===t){Aa=wr(e.nextSibling);break e}t--}else"$"!==i&&"$!"!==i&&"$?"!==i||t++}e=e.nextSibling}Aa=null}}else Aa=ya?wr(e.stateNode.nextSibling):null;return!0}function Ca(){for(var e=Aa;e;)e=wr(e.nextSibling)}function Ra(){Aa=ya=null,Ea=!1}function xa(e){null===ba?ba=[e]:ba.push(e)}var Da=Fe.ReactCurrentBatchConfig;function Pa(e,t,i){if(null!==(e=i.ref)&&"function"!=typeof e&&"object"!=typeof e){if(i._owner){if(i=i._owner){if(1!==i.tag)throw Error(be(309));var n=i.stateNode}if(!n)throw Error(be(147,e));var s=n,r=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===r?t.ref:((t=function(e){var t=s.refs;null===e?delete t[r]:t[r]=e})._stringRef=r,t)}if("string"!=typeof e)throw Error(be(284));if(!i._owner)throw Error(be(290,e))}return e}function Ma(e,t){throw e=Object.prototype.toString.call(t),Error(be(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Oa(e){return(0,e._init)(e._payload)}function Ba(e){function t(t,i){if(e){var n=t.deletions;null===n?(t.deletions=[i],t.flags|=16):n.push(i)}}function i(i,n){if(!e)return null;for(;null!==n;)t(i,n),n=n.sibling;return null}function n(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function s(e,t){return(e=qc(e,t)).index=0,e.sibling=null,e}function r(t,i,n){return t.index=n,e?null!==(n=t.alternate)?(n=n.index)<i?(t.flags|=2,i):n:(t.flags|=2,i):(t.flags|=1048576,i)}function a(t){return e&&null===t.alternate&&(t.flags|=2),t}function o(e,t,i,n){return null===t||6!==t.tag?((t=Zc(i,e.mode,n)).return=e,t):((t=s(t,i)).return=e,t)}function l(e,t,i,n){var r=i.type;return r===Ue?c(e,t,i.props.children,n,i.key):null!==t&&(t.elementType===r||"object"==typeof r&&null!==r&&r.$$typeof===qe&&Oa(r)===t.type)?((n=s(t,i.props)).ref=Pa(e,t,i),n.return=e,n):((n=Yc(i.type,i.key,i.props,null,e.mode,n)).ref=Pa(e,t,i),n.return=e,n)}function u(e,t,i,n){return null===t||4!==t.tag||t.stateNode.containerInfo!==i.containerInfo||t.stateNode.implementation!==i.implementation?((t=Jc(i,e.mode,n)).return=e,t):((t=s(t,i.children||[])).return=e,t)}function c(e,t,i,n,r){return null===t||7!==t.tag?((t=$c(i,e.mode,n,r)).return=e,t):((t=s(t,i)).return=e,t)}function d(e,t,i){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Zc(""+t,e.mode,i)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case _e:return(i=Yc(t.type,t.key,t.props,null,e.mode,i)).ref=Pa(e,null,t),i.return=e,i;case Ne:return(t=Jc(t,e.mode,i)).return=e,t;case qe:return d(e,(0,t._init)(t._payload),i)}if(vt(t)||Xe(t))return(t=$c(t,e.mode,i,null)).return=e,t;Ma(e,t)}return null}function h(e,t,i,n){var s=null!==t?t.key:null;if("string"==typeof i&&""!==i||"number"==typeof i)return null!==s?null:o(e,t,""+i,n);if("object"==typeof i&&null!==i){switch(i.$$typeof){case _e:return i.key===s?l(e,t,i,n):null;case Ne:return i.key===s?u(e,t,i,n):null;case qe:return h(e,t,(s=i._init)(i._payload),n)}if(vt(i)||Xe(i))return null!==s?null:c(e,t,i,n,null);Ma(e,i)}return null}function f(e,t,i,n,s){if("string"==typeof n&&""!==n||"number"==typeof n)return o(t,e=e.get(i)||null,""+n,s);if("object"==typeof n&&null!==n){switch(n.$$typeof){case _e:return l(t,e=e.get(null===n.key?i:n.key)||null,n,s);case Ne:return u(t,e=e.get(null===n.key?i:n.key)||null,n,s);case qe:return f(e,t,i,(0,n._init)(n._payload),s)}if(vt(n)||Xe(n))return c(t,e=e.get(i)||null,n,s,null);Ma(t,n)}return null}return function o(l,u,c,g){if("object"==typeof c&&null!==c&&c.type===Ue&&null===c.key&&(c=c.props.children),"object"==typeof c&&null!==c){switch(c.$$typeof){case _e:e:{for(var m=c.key,p=u;null!==p;){if(p.key===m){if((m=c.type)===Ue){if(7===p.tag){i(l,p.sibling),(u=s(p,c.props.children)).return=l,l=u;break e}}else if(p.elementType===m||"object"==typeof m&&null!==m&&m.$$typeof===qe&&Oa(m)===p.type){i(l,p.sibling),(u=s(p,c.props)).ref=Pa(l,p,c),u.return=l,l=u;break e}i(l,p);break}t(l,p),p=p.sibling}c.type===Ue?((u=$c(c.props.children,l.mode,g,c.key)).return=l,l=u):((g=Yc(c.type,c.key,c.props,null,l.mode,g)).ref=Pa(l,u,c),g.return=l,l=g)}return a(l);case Ne:e:{for(p=c.key;null!==u;){if(u.key===p){if(4===u.tag&&u.stateNode.containerInfo===c.containerInfo&&u.stateNode.implementation===c.implementation){i(l,u.sibling),(u=s(u,c.children||[])).return=l,l=u;break e}i(l,u);break}t(l,u),u=u.sibling}(u=Jc(c,l.mode,g)).return=l,l=u}return a(l);case qe:return o(l,u,(p=c._init)(c._payload),g)}if(vt(c))return function(s,a,o,l){for(var u=null,c=null,g=a,m=a=0,p=null;null!==g&&m<o.length;m++){g.index>m?(p=g,g=null):p=g.sibling;var v=h(s,g,o[m],l);if(null===v){null===g&&(g=p);break}e&&g&&null===v.alternate&&t(s,g),a=r(v,a,m),null===c?u=v:c.sibling=v,c=v,g=p}if(m===o.length)return i(s,g),Ea&&ga(s,m),u;if(null===g){for(;m<o.length;m++)null!==(g=d(s,o[m],l))&&(a=r(g,a,m),null===c?u=g:c.sibling=g,c=g);return Ea&&ga(s,m),u}for(g=n(s,g);m<o.length;m++)null!==(p=f(g,s,m,o[m],l))&&(e&&null!==p.alternate&&g.delete(null===p.key?m:p.key),a=r(p,a,m),null===c?u=p:c.sibling=p,c=p);return e&&g.forEach(function(e){return t(s,e)}),Ea&&ga(s,m),u}(l,u,c,g);if(Xe(c))return function(s,a,o,l){var u=Xe(o);if("function"!=typeof u)throw Error(be(150));if(null==(o=u.call(o)))throw Error(be(151));for(var c=u=null,g=a,m=a=0,p=null,v=o.next();null!==g&&!v.done;m++,v=o.next()){g.index>m?(p=g,g=null):p=g.sibling;var y=h(s,g,v.value,l);if(null===y){null===g&&(g=p);break}e&&g&&null===y.alternate&&t(s,g),a=r(y,a,m),null===c?u=y:c.sibling=y,c=y,g=p}if(v.done)return i(s,g),Ea&&ga(s,m),u;if(null===g){for(;!v.done;m++,v=o.next())null!==(v=d(s,v.value,l))&&(a=r(v,a,m),null===c?u=v:c.sibling=v,c=v);return Ea&&ga(s,m),u}for(g=n(s,g);!v.done;m++,v=o.next())null!==(v=f(g,s,m,v.value,l))&&(e&&null!==v.alternate&&g.delete(null===v.key?m:v.key),a=r(v,a,m),null===c?u=v:c.sibling=v,c=v);return e&&g.forEach(function(e){return t(s,e)}),Ea&&ga(s,m),u}(l,u,c,g);Ma(l,c)}return"string"==typeof c&&""!==c||"number"==typeof c?(c=""+c,null!==u&&6===u.tag?(i(l,u.sibling),(u=s(u,c)).return=l,l=u):(i(l,u),(u=Zc(c,l.mode,g)).return=l,l=u),a(l)):i(l,u)}}var Fa=Ba(!0),_a=Ba(!1),Na=jr(null),Ua=null,ja=null,Ha=null;function Va(){Ha=ja=Ua=null}function Ga(e){var t=Na.current;Hr(Na),e._currentValue=t}function Qa(e,t,i){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==n&&(n.childLanes|=t)):null!==n&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===i)break;e=e.return}}function Ka(e,t){Ua=e,Ha=ja=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(Ol=!0),e.firstContext=null)}function za(e){var t=e._currentValue;if(Ha!==e)if(e={context:e,memoizedValue:t,next:null},null===ja){if(null===Ua)throw Error(be(308));ja=e,Ua.dependencies={lanes:0,firstContext:e}}else ja=ja.next=e;return t}var Wa=null;function qa(e){null===Wa?Wa=[e]:Wa.push(e)}function Ya(e,t,i,n){var s=t.interleaved;return null===s?(i.next=i,qa(t)):(i.next=s.next,s.next=i),t.interleaved=i,$a(e,n)}function $a(e,t){e.lanes|=t;var i=e.alternate;for(null!==i&&(i.lanes|=t),i=e,e=e.return;null!==e;)e.childLanes|=t,null!==(i=e.alternate)&&(i.childLanes|=t),i=e,e=e.return;return 3===i.tag?i.stateNode:null}var Xa=!1;function Za(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ja(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function eo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function to(e,t,i){var n=e.updateQueue;if(null===n)return null;if(n=n.shared,2&Gu){var s=n.pending;return null===s?t.next=t:(t.next=s.next,s.next=t),n.pending=t,$a(e,i)}return null===(s=n.interleaved)?(t.next=t,qa(n)):(t.next=s.next,s.next=t),n.interleaved=t,$a(e,i)}function io(e,t,i){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&i)){var n=t.lanes;i|=n&=e.pendingLanes,t.lanes=i,Oi(e,i)}}function no(e,t){var i=e.updateQueue,n=e.alternate;if(null!==n&&i===(n=n.updateQueue)){var s=null,r=null;if(null!==(i=i.firstBaseUpdate)){do{var a={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};null===r?s=r=a:r=r.next=a,i=i.next}while(null!==i);null===r?s=r=t:r=r.next=t}else s=r=t;return i={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:r,shared:n.shared,effects:n.effects},void(e.updateQueue=i)}null===(e=i.lastBaseUpdate)?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function so(e,t,i,n){var s=e.updateQueue;Xa=!1;var r=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(null!==o){s.shared.pending=null;var l=o,u=l.next;l.next=null,null===a?r=u:a.next=u,a=l;var c=e.alternate;null!==c&&((o=(c=c.updateQueue).lastBaseUpdate)!==a&&(null===o?c.firstBaseUpdate=u:o.next=u,c.lastBaseUpdate=l))}if(null!==r){var d=s.baseState;for(a=0,c=u=l=null,o=r;;){var h=o.lane,f=o.eventTime;if((n&h)===h){null!==c&&(c=c.next={eventTime:f,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var g=e,m=o;switch(h=t,f=i,m.tag){case 1:if("function"==typeof(g=m.payload)){d=g.call(f,d,h);break e}d=g;break e;case 3:g.flags=-65537&g.flags|128;case 0:if(null==(h="function"==typeof(g=m.payload)?g.call(f,d,h):g))break e;d=Je({},d,h);break e;case 2:Xa=!0}}null!==o.callback&&0!==o.lane&&(e.flags|=64,null===(h=s.effects)?s.effects=[o]:h.push(o))}else f={eventTime:f,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},null===c?(u=c=f,l=d):c=c.next=f,a|=h;if(null===(o=o.next)){if(null===(o=s.shared.pending))break;o=(h=o).next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}if(null===c&&(l=d),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=c,null!==(t=s.shared.interleaved)){s=t;do{a|=s.lane,s=s.next}while(s!==t)}else null===r&&(s.shared.lanes=0);Xu|=a,e.lanes=a,e.memoizedState=d}}function ro(e,t,i){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var n=e[t],s=n.callback;if(null!==s){if(n.callback=null,n=i,"function"!=typeof s)throw Error(be(191,s));s.call(n)}}}var ao={},oo=jr(ao),lo=jr(ao),uo=jr(ao);function co(e){if(e===ao)throw Error(be(174));return e}function ho(e,t){switch(Vr(uo,t),Vr(lo,e),Vr(oo,ao),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:kt(null,"");break;default:t=kt(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Hr(oo),Vr(oo,t)}function fo(){Hr(oo),Hr(lo),Hr(uo)}function go(e){co(uo.current);var t=co(oo.current),i=kt(t,e.type);t!==i&&(Vr(lo,e),Vr(oo,i))}function mo(e){lo.current===e&&(Hr(oo),Hr(lo))}var po=jr(0);function vo(e){for(var t=e;null!==t;){if(13===t.tag){var i=t.memoizedState;if(null!==i&&(null===(i=i.dehydrated)||"$?"===i.data||"$!"===i.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var yo=[];function Ao(){for(var e=0;e<yo.length;e++)yo[e]._workInProgressVersionPrimary=null;yo.length=0}var Eo=Fe.ReactCurrentDispatcher,bo=Fe.ReactCurrentBatchConfig,So=0,To=null,ko=null,wo=null,Io=!1,Lo=!1,Co=0,Ro=0;function xo(){throw Error(be(321))}function Do(e,t){if(null===t)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Ts(e[i],t[i]))return!1;return!0}function Po(e,t,i,n,s,r){if(So=r,To=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Eo.current=null===e||null===e.memoizedState?ml:pl,e=i(n,s),Lo){r=0;do{if(Lo=!1,Co=0,25<=r)throw Error(be(301));r+=1,wo=ko=null,t.updateQueue=null,Eo.current=vl,e=i(n,s)}while(Lo)}if(Eo.current=gl,t=null!==ko&&null!==ko.next,So=0,wo=ko=To=null,Io=!1,t)throw Error(be(300));return e}function Mo(){var e=0!==Co;return Co=0,e}function Oo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===wo?To.memoizedState=wo=e:wo=wo.next=e,wo}function Bo(){if(null===ko){var e=To.alternate;e=null!==e?e.memoizedState:null}else e=ko.next;var t=null===wo?To.memoizedState:wo.next;if(null!==t)wo=t,ko=e;else{if(null===e)throw Error(be(310));e={memoizedState:(ko=e).memoizedState,baseState:ko.baseState,baseQueue:ko.baseQueue,queue:ko.queue,next:null},null===wo?To.memoizedState=wo=e:wo=wo.next=e}return wo}function Fo(e,t){return"function"==typeof t?t(e):t}function _o(e){var t=Bo(),i=t.queue;if(null===i)throw Error(be(311));i.lastRenderedReducer=e;var n=ko,s=n.baseQueue,r=i.pending;if(null!==r){if(null!==s){var a=s.next;s.next=r.next,r.next=a}n.baseQueue=s=r,i.pending=null}if(null!==s){r=s.next,n=n.baseState;var o=a=null,l=null,u=r;do{var c=u.lane;if((So&c)===c)null!==l&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:e(n,u.action);else{var d={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===l?(o=l=d,a=n):l=l.next=d,To.lanes|=c,Xu|=c}u=u.next}while(null!==u&&u!==r);null===l?a=n:l.next=o,Ts(n,t.memoizedState)||(Ol=!0),t.memoizedState=n,t.baseState=a,t.baseQueue=l,i.lastRenderedState=n}if(null!==(e=i.interleaved)){s=e;do{r=s.lane,To.lanes|=r,Xu|=r,s=s.next}while(s!==e)}else null===s&&(i.lanes=0);return[t.memoizedState,i.dispatch]}function No(e){var t=Bo(),i=t.queue;if(null===i)throw Error(be(311));i.lastRenderedReducer=e;var n=i.dispatch,s=i.pending,r=t.memoizedState;if(null!==s){i.pending=null;var a=s=s.next;do{r=e(r,a.action),a=a.next}while(a!==s);Ts(r,t.memoizedState)||(Ol=!0),t.memoizedState=r,null===t.baseQueue&&(t.baseState=r),i.lastRenderedState=r}return[r,n]}function Uo(){}function jo(e,t){var i=To,n=Bo(),s=t(),r=!Ts(n.memoizedState,s);if(r&&(n.memoizedState=s,Ol=!0),n=n.queue,Zo(Go.bind(null,i,n,e),[e]),n.getSnapshot!==t||r||null!==wo&&1&wo.memoizedState.tag){if(i.flags|=2048,Wo(9,Vo.bind(null,i,n,s,t),void 0,null),null===Qu)throw Error(be(349));30&So||Ho(i,t,s)}return s}function Ho(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},null===(t=To.updateQueue)?(t={lastEffect:null,stores:null},To.updateQueue=t,t.stores=[e]):null===(i=t.stores)?t.stores=[e]:i.push(e)}function Vo(e,t,i,n){t.value=i,t.getSnapshot=n,Qo(t)&&Ko(e)}function Go(e,t,i){return i(function(){Qo(t)&&Ko(e)})}function Qo(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Ts(e,i)}catch(n){return!0}}function Ko(e){var t=$a(e,1);null!==t&&vc(t,e,1,-1)}function zo(e){var t=Oo();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:e},t.queue=e,e=e.dispatch=cl.bind(null,To,e),[t.memoizedState,e]}function Wo(e,t,i,n){return e={tag:e,create:t,destroy:i,deps:n,next:null},null===(t=To.updateQueue)?(t={lastEffect:null,stores:null},To.updateQueue=t,t.lastEffect=e.next=e):null===(i=t.lastEffect)?t.lastEffect=e.next=e:(n=i.next,i.next=e,e.next=n,t.lastEffect=e),e}function qo(){return Bo().memoizedState}function Yo(e,t,i,n){var s=Oo();To.flags|=e,s.memoizedState=Wo(1|t,i,void 0,void 0===n?null:n)}function $o(e,t,i,n){var s=Bo();n=void 0===n?null:n;var r=void 0;if(null!==ko){var a=ko.memoizedState;if(r=a.destroy,null!==n&&Do(n,a.deps))return void(s.memoizedState=Wo(t,i,r,n))}To.flags|=e,s.memoizedState=Wo(1|t,i,r,n)}function Xo(e,t){return Yo(8390656,8,e,t)}function Zo(e,t){return $o(2048,8,e,t)}function Jo(e,t){return $o(4,2,e,t)}function el(e,t){return $o(4,4,e,t)}function tl(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function il(e,t,i){return i=null!=i?i.concat([e]):null,$o(4,4,tl.bind(null,t,e),i)}function nl(){}function sl(e,t){var i=Bo();t=void 0===t?null:t;var n=i.memoizedState;return null!==n&&null!==t&&Do(t,n[1])?n[0]:(i.memoizedState=[e,t],e)}function rl(e,t){var i=Bo();t=void 0===t?null:t;var n=i.memoizedState;return null!==n&&null!==t&&Do(t,n[1])?n[0]:(e=e(),i.memoizedState=[e,t],e)}function al(e,t,i){return 21&So?(Ts(i,t)||(i=Di(),To.lanes|=i,Xu|=i,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ol=!0),e.memoizedState=i)}function ol(e,t){var i=Bi;Bi=0!==i&&4>i?i:4,e(!0);var n=bo.transition;bo.transition={};try{e(!1),t()}finally{Bi=i,bo.transition=n}}function ll(){return Bo().memoizedState}function ul(e,t,i){var n=pc(e);if(i={lane:n,action:i,hasEagerState:!1,eagerState:null,next:null},dl(e))hl(t,i);else if(null!==(i=Ya(e,t,i,n))){vc(i,e,n,mc()),fl(i,t,n)}}function cl(e,t,i){var n=pc(e),s={lane:n,action:i,hasEagerState:!1,eagerState:null,next:null};if(dl(e))hl(t,s);else{var r=e.alternate;if(0===e.lanes&&(null===r||0===r.lanes)&&null!==(r=t.lastRenderedReducer))try{var a=t.lastRenderedState,o=r(a,i);if(s.hasEagerState=!0,s.eagerState=o,Ts(o,a)){var l=t.interleaved;return null===l?(s.next=s,qa(t)):(s.next=l.next,l.next=s),void(t.interleaved=s)}}catch(u){}null!==(i=Ya(e,t,s,n))&&(vc(i,e,n,s=mc()),fl(i,t,n))}}function dl(e){var t=e.alternate;return e===To||null!==t&&t===To}function hl(e,t){Lo=Io=!0;var i=e.pending;null===i?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function fl(e,t,i){if(4194240&i){var n=t.lanes;i|=n&=e.pendingLanes,t.lanes=i,Oi(e,i)}}var gl={readContext:za,useCallback:xo,useContext:xo,useEffect:xo,useImperativeHandle:xo,useInsertionEffect:xo,useLayoutEffect:xo,useMemo:xo,useReducer:xo,useRef:xo,useState:xo,useDebugValue:xo,useDeferredValue:xo,useTransition:xo,useMutableSource:xo,useSyncExternalStore:xo,useId:xo,unstable_isNewReconciler:!1},ml={readContext:za,useCallback:function(e,t){return Oo().memoizedState=[e,void 0===t?null:t],e},useContext:za,useEffect:Xo,useImperativeHandle:function(e,t,i){return i=null!=i?i.concat([e]):null,Yo(4194308,4,tl.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Yo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Yo(4,2,e,t)},useMemo:function(e,t){var i=Oo();return t=void 0===t?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var n=Oo();return t=void 0!==i?i(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=ul.bind(null,To,e),[n.memoizedState,e]},useRef:function(e){return e={current:e},Oo().memoizedState=e},useState:zo,useDebugValue:nl,useDeferredValue:function(e){return Oo().memoizedState=e},useTransition:function(){var e=zo(!1),t=e[0];return e=ol.bind(null,e[1]),Oo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var n=To,s=Oo();if(Ea){if(void 0===i)throw Error(be(407));i=i()}else{if(i=t(),null===Qu)throw Error(be(349));30&So||Ho(n,t,i)}s.memoizedState=i;var r={value:i,getSnapshot:t};return s.queue=r,Xo(Go.bind(null,n,r,e),[e]),n.flags|=2048,Wo(9,Vo.bind(null,n,r,i,t),void 0,null),i},useId:function(){var e=Oo(),t=Qu.identifierPrefix;if(Ea){var i=fa;t=":"+t+"R"+(i=(ha&~(1<<32-Si(ha)-1)).toString(32)+i),0<(i=Co++)&&(t+="H"+i.toString(32)),t+=":"}else t=":"+t+"r"+(i=Ro++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},pl={readContext:za,useCallback:sl,useContext:za,useEffect:Zo,useImperativeHandle:il,useInsertionEffect:Jo,useLayoutEffect:el,useMemo:rl,useReducer:_o,useRef:qo,useState:function(){return _o(Fo)},useDebugValue:nl,useDeferredValue:function(e){return al(Bo(),ko.memoizedState,e)},useTransition:function(){return[_o(Fo)[0],Bo().memoizedState]},useMutableSource:Uo,useSyncExternalStore:jo,useId:ll,unstable_isNewReconciler:!1},vl={readContext:za,useCallback:sl,useContext:za,useEffect:Zo,useImperativeHandle:il,useInsertionEffect:Jo,useLayoutEffect:el,useMemo:rl,useReducer:No,useRef:qo,useState:function(){return No(Fo)},useDebugValue:nl,useDeferredValue:function(e){var t=Bo();return null===ko?t.memoizedState=e:al(t,ko.memoizedState,e)},useTransition:function(){return[No(Fo)[0],Bo().memoizedState]},useMutableSource:Uo,useSyncExternalStore:jo,useId:ll,unstable_isNewReconciler:!1};function yl(e,t){if(e&&e.defaultProps){for(var i in t=Je({},t),e=e.defaultProps)void 0===t[i]&&(t[i]=e[i]);return t}return t}function Al(e,t,i,n){i=null==(i=i(n,t=e.memoizedState))?t:Je({},t,i),e.memoizedState=i,0===e.lanes&&(e.updateQueue.baseState=i)}var El={isMounted:function(e){return!!(e=e._reactInternals)&&si(e)===e},enqueueSetState:function(e,t,i){e=e._reactInternals;var n=mc(),s=pc(e),r=eo(n,s);r.payload=t,null!=i&&(r.callback=i),null!==(t=to(e,r,s))&&(vc(t,e,s,n),io(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var n=mc(),s=pc(e),r=eo(n,s);r.tag=1,r.payload=t,null!=i&&(r.callback=i),null!==(t=to(e,r,s))&&(vc(t,e,s,n),io(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=mc(),n=pc(e),s=eo(i,n);s.tag=2,null!=t&&(s.callback=t),null!==(t=to(e,s,n))&&(vc(t,e,n,i),io(t,e,n))}};function bl(e,t,i,n,s,r,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(n,r,a):!t.prototype||!t.prototype.isPureReactComponent||(!ks(i,n)||!ks(s,r))}function Sl(e,t,i){var n=!1,s=Gr,r=t.contextType;return"object"==typeof r&&null!==r?r=za(r):(s=qr(t)?zr:Qr.current,r=(n=null!=(n=t.contextTypes))?Wr(e,s):Gr),t=new t(i,r),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=El,e.stateNode=t,t._reactInternals=e,n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=r),t}function Tl(e,t,i,n){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(i,n),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(i,n),t.state!==e&&El.enqueueReplaceState(t,t.state,null)}function kl(e,t,i,n){var s=e.stateNode;s.props=i,s.state=e.memoizedState,s.refs={},Za(e);var r=t.contextType;"object"==typeof r&&null!==r?s.context=za(r):(r=qr(t)?zr:Qr.current,s.context=Wr(e,r)),s.state=e.memoizedState,"function"==typeof(r=t.getDerivedStateFromProps)&&(Al(e,t,r,i),s.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof s.getSnapshotBeforeUpdate||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||(t=s.state,"function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount(),t!==s.state&&El.enqueueReplaceState(s,s.state,null),so(e,i,s,n),s.state=e.memoizedState),"function"==typeof s.componentDidMount&&(e.flags|=4194308)}function wl(e,t){try{var i="",n=t;do{i+=nt(n),n=n.return}while(n);var s=i}catch(r){s="\nError generating stack: "+r.message+"\n"+r.stack}return{value:e,source:t,stack:s,digest:null}}function Il(e,t,i){return{value:e,source:null,stack:null!=i?i:null,digest:null!=t?t:null}}var Ll="function"==typeof WeakMap?WeakMap:Map;function Cl(e,t,i){(i=eo(-1,i)).tag=3,i.payload={element:null};var n=t.value;return i.callback=function(){rc||(rc=!0,ac=n)},i}function Rl(e,t,i){(i=eo(-1,i)).tag=3;var n=e.type.getDerivedStateFromError;if("function"==typeof n){var s=t.value;i.payload=function(){return n(s)},i.callback=function(){}}var r=e.stateNode;return null!==r&&"function"==typeof r.componentDidCatch&&(i.callback=function(){"function"!=typeof n&&(null===oc?oc=new Set([this]):oc.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),i}function xl(e,t,i){var n=e.pingCache;if(null===n){n=e.pingCache=new Ll;var s=new Set;n.set(t,s)}else void 0===(s=n.get(t))&&(s=new Set,n.set(t,s));s.has(i)||(s.add(i),e=jc.bind(null,e,t,i),t.then(e,e))}function Dl(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function Pl(e,t,i,n,s){return 1&e.mode?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,1===i.tag&&(null===i.alternate?i.tag=17:((t=eo(-1,1)).tag=2,to(i,t,1))),i.lanes|=1),e)}var Ml=Fe.ReactCurrentOwner,Ol=!1;function Bl(e,t,i,n){t.child=null===e?_a(t,null,i,n):Fa(t,e.child,i,n)}function Fl(e,t,i,n,s){i=i.render;var r=t.ref;return Ka(t,s),n=Po(e,t,i,n,r,s),i=Mo(),null===e||Ol?(Ea&&i&&pa(t),t.flags|=1,Bl(e,t,n,s),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ru(e,t,s))}function _l(e,t,i,n,s){if(null===e){var r=i.type;return"function"!=typeof r||Wc(r)||void 0!==r.defaultProps||null!==i.compare||void 0!==i.defaultProps?((e=Yc(i.type,null,n,t,t.mode,s)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=r,Nl(e,t,r,n,s))}if(r=e.child,0===(e.lanes&s)){var a=r.memoizedProps;if((i=null!==(i=i.compare)?i:ks)(a,n)&&e.ref===t.ref)return ru(e,t,s)}return t.flags|=1,(e=qc(r,n)).ref=t.ref,e.return=t,t.child=e}function Nl(e,t,i,n,s){if(null!==e){var r=e.memoizedProps;if(ks(r,n)&&e.ref===t.ref){if(Ol=!1,t.pendingProps=n=r,0===(e.lanes&s))return t.lanes=e.lanes,ru(e,t,s);131072&e.flags&&(Ol=!0)}}return Hl(e,t,i,n,s)}function Ul(e,t,i){var n=t.pendingProps,s=n.children,r=null!==e?e.memoizedState:null;if("hidden"===n.mode)if(1&t.mode){if(!(1073741824&i))return e=null!==r?r.baseLanes|i:i,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Vr(qu,Wu),Wu|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=null!==r?r.baseLanes:i,Vr(qu,Wu),Wu|=n}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Vr(qu,Wu),Wu|=i;else null!==r?(n=r.baseLanes|i,t.memoizedState=null):n=i,Vr(qu,Wu),Wu|=n;return Bl(e,t,s,i),t.child}function jl(e,t){var i=t.ref;(null===e&&null!==i||null!==e&&e.ref!==i)&&(t.flags|=512,t.flags|=2097152)}function Hl(e,t,i,n,s){var r=qr(i)?zr:Qr.current;return r=Wr(t,r),Ka(t,s),i=Po(e,t,i,n,r,s),n=Mo(),null===e||Ol?(Ea&&n&&pa(t),t.flags|=1,Bl(e,t,i,s),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ru(e,t,s))}function Vl(e,t,i,n,s){if(qr(i)){var r=!0;Zr(t)}else r=!1;if(Ka(t,s),null===t.stateNode)su(e,t),Sl(t,i,n),kl(t,i,n,s),n=!0;else if(null===e){var a=t.stateNode,o=t.memoizedProps;a.props=o;var l=a.context,u=i.contextType;"object"==typeof u&&null!==u?u=za(u):u=Wr(t,u=qr(i)?zr:Qr.current);var c=i.getDerivedStateFromProps,d="function"==typeof c||"function"==typeof a.getSnapshotBeforeUpdate;d||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(o!==n||l!==u)&&Tl(t,a,n,u),Xa=!1;var h=t.memoizedState;a.state=h,so(t,n,a,s),l=t.memoizedState,o!==n||h!==l||Kr.current||Xa?("function"==typeof c&&(Al(t,i,c,n),l=t.memoizedState),(o=Xa||bl(t,i,o,n,h,l,u))?(d||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=l),a.props=n,a.state=l,a.context=u,n=o):("function"==typeof a.componentDidMount&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,Ja(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:yl(t.type,o),a.props=u,d=t.pendingProps,h=a.context,"object"==typeof(l=i.contextType)&&null!==l?l=za(l):l=Wr(t,l=qr(i)?zr:Qr.current);var f=i.getDerivedStateFromProps;(c="function"==typeof f||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(o!==d||h!==l)&&Tl(t,a,n,l),Xa=!1,h=t.memoizedState,a.state=h,so(t,n,a,s);var g=t.memoizedState;o!==d||h!==g||Kr.current||Xa?("function"==typeof f&&(Al(t,i,f,n),g=t.memoizedState),(u=Xa||bl(t,i,u,n,h,g,l)||!1)?(c||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(n,g,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(n,g,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=g),a.props=n,a.state=g,a.context=l,n=u):("function"!=typeof a.componentDidUpdate||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),n=!1)}return Gl(e,t,i,n,r,s)}function Gl(e,t,i,n,s,r){jl(e,t);var a=!!(128&t.flags);if(!n&&!a)return s&&Jr(t,i,!1),ru(e,t,r);n=t.stateNode,Ml.current=t;var o=a&&"function"!=typeof i.getDerivedStateFromError?null:n.render();return t.flags|=1,null!==e&&a?(t.child=Fa(t,e.child,null,r),t.child=Fa(t,null,o,r)):Bl(e,t,o,r),t.memoizedState=n.state,s&&Jr(t,i,!0),t.child}function Ql(e){var t=e.stateNode;t.pendingContext?$r(0,t.pendingContext,t.pendingContext!==t.context):t.context&&$r(0,t.context,!1),ho(e,t.containerInfo)}function Kl(e,t,i,n,s){return Ra(),xa(s),t.flags|=256,Bl(e,t,i,n),t.child}var zl,Wl,ql,Yl,$l={dehydrated:null,treeContext:null,retryLane:0};function Xl(e){return{baseLanes:e,cachePool:null,transitions:null}}function Zl(e,t,i){var n,s=t.pendingProps,r=po.current,a=!1,o=!!(128&t.flags);if((n=o)||(n=(null===e||null!==e.memoizedState)&&!!(2&r)),n?(a=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(r|=1),Vr(po,1&r),null===e)return wa(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=s.children,e=s.fallback,a?(s=t.mode,a=t.child,o={mode:"hidden",children:o},1&s||null===a?a=Xc(o,s,0,null):(a.childLanes=0,a.pendingProps=o),e=$c(e,s,i,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Xl(i),t.memoizedState=$l,e):Jl(t,o));if(null!==(r=e.memoizedState)&&null!==(n=r.dehydrated))return function(e,t,i,n,s,r,a){if(i)return 256&t.flags?(t.flags&=-257,eu(e,t,a,n=Il(Error(be(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(r=n.fallback,s=t.mode,n=Xc({mode:"visible",children:n.children},s,0,null),(r=$c(r,s,a,null)).flags|=2,n.return=t,r.return=t,n.sibling=r,t.child=n,1&t.mode&&Fa(t,e.child,null,a),t.child.memoizedState=Xl(a),t.memoizedState=$l,r);if(!(1&t.mode))return eu(e,t,a,null);if("$!"===s.data){if(n=s.nextSibling&&s.nextSibling.dataset)var o=n.dgst;return n=o,eu(e,t,a,n=Il(r=Error(be(419)),n,void 0))}if(o=0!==(a&e.childLanes),Ol||o){if(null!==(n=Qu)){switch(a&-a){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}0!==(s=0!==(s&(n.suspendedLanes|a))?0:s)&&s!==r.retryLane&&(r.retryLane=s,$a(e,s),vc(n,e,s,-1))}return xc(),eu(e,t,a,n=Il(Error(be(421))))}return"$?"===s.data?(t.flags|=128,t.child=e.child,t=Vc.bind(null,e),s._reactRetry=t,null):(e=r.treeContext,Aa=wr(s.nextSibling),ya=t,Ea=!0,ba=null,null!==e&&(ua[ca++]=ha,ua[ca++]=fa,ua[ca++]=da,ha=e.id,fa=e.overflow,da=t),t=Jl(t,n.children),t.flags|=4096,t)}(e,t,o,s,n,r,i);if(a){a=s.fallback,o=t.mode,n=(r=e.child).sibling;var l={mode:"hidden",children:s.children};return 1&o||t.child===r?(s=qc(r,l)).subtreeFlags=14680064&r.subtreeFlags:((s=t.child).childLanes=0,s.pendingProps=l,t.deletions=null),null!==n?a=qc(n,a):(a=$c(a,o,i,null)).flags|=2,a.return=t,s.return=t,s.sibling=a,t.child=s,s=a,a=t.child,o=null===(o=e.child.memoizedState)?Xl(i):{baseLanes:o.baseLanes|i,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~i,t.memoizedState=$l,s}return e=(a=e.child).sibling,s=qc(a,{mode:"visible",children:s.children}),!(1&t.mode)&&(s.lanes=i),s.return=t,s.sibling=null,null!==e&&(null===(i=t.deletions)?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=s,t.memoizedState=null,s}function Jl(e,t){return(t=Xc({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function eu(e,t,i,n){return null!==n&&xa(n),Fa(t,e.child,null,i),(e=Jl(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function tu(e,t,i){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),Qa(e.return,t,i)}function iu(e,t,i,n,s){var r=e.memoizedState;null===r?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:i,tailMode:s}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=n,r.tail=i,r.tailMode=s)}function nu(e,t,i){var n=t.pendingProps,s=n.revealOrder,r=n.tail;if(Bl(e,t,n.children,i),2&(n=po.current))n=1&n|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&tu(e,i,t);else if(19===e.tag)tu(e,i,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(Vr(po,n),1&t.mode)switch(s){case"forwards":for(i=t.child,s=null;null!==i;)null!==(e=i.alternate)&&null===vo(e)&&(s=i),i=i.sibling;null===(i=s)?(s=t.child,t.child=null):(s=i.sibling,i.sibling=null),iu(t,!1,s,i,r);break;case"backwards":for(i=null,s=t.child,t.child=null;null!==s;){if(null!==(e=s.alternate)&&null===vo(e)){t.child=s;break}e=s.sibling,s.sibling=i,i=s,s=e}iu(t,!0,i,null,r);break;case"together":iu(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function su(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ru(e,t,i){if(null!==e&&(t.dependencies=e.dependencies),Xu|=t.lanes,0===(i&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(be(153));if(null!==t.child){for(i=qc(e=t.child,e.pendingProps),t.child=i,i.return=t;null!==e.sibling;)e=e.sibling,(i=i.sibling=qc(e,e.pendingProps)).return=t;i.sibling=null}return t.child}function au(e,t){if(!Ea)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;null!==t;)null!==t.alternate&&(i=t),t=t.sibling;null===i?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var n=null;null!==i;)null!==i.alternate&&(n=i),i=i.sibling;null===n?t||null===e.tail?e.tail=null:e.tail.sibling=null:n.sibling=null}}function ou(e){var t=null!==e.alternate&&e.alternate.child===e.child,i=0,n=0;if(t)for(var s=e.child;null!==s;)i|=s.lanes|s.childLanes,n|=14680064&s.subtreeFlags,n|=14680064&s.flags,s.return=e,s=s.sibling;else for(s=e.child;null!==s;)i|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=i,t}function lu(e,t,i){var n=t.pendingProps;switch(va(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ou(t),null;case 1:case 17:return qr(t.type)&&Yr(),ou(t),null;case 3:return n=t.stateNode,fo(),Hr(Kr),Hr(Qr),Ao(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(La(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==ba&&(bc(ba),ba=null))),Wl(e,t),ou(t),null;case 5:mo(t);var s=co(uo.current);if(i=t.type,null!==e&&null!=t.stateNode)ql(e,t,i,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(null===t.stateNode)throw Error(be(166));return ou(t),null}if(e=co(oo.current),La(t)){n=t.stateNode,i=t.type;var r=t.memoizedProps;switch(n[Cr]=t,n[Rr]=r,e=!!(1&t.mode),i){case"dialog":tr("cancel",n),tr("close",n);break;case"iframe":case"object":case"embed":tr("load",n);break;case"video":case"audio":for(s=0;s<Xs.length;s++)tr(Xs[s],n);break;case"source":tr("error",n);break;case"img":case"image":case"link":tr("error",n),tr("load",n);break;case"details":tr("toggle",n);break;case"input":ht(n,r),tr("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!r.multiple},tr("invalid",n);break;case"textarea":Et(n,r),tr("invalid",n)}for(var a in Ot(i,r),s=null,r)if(r.hasOwnProperty(a)){var o=r[a];"children"===a?"string"==typeof o?n.textContent!==o&&(!0!==r.suppressHydrationWarning&&gr(n.textContent,o,e),s=["children",o]):"number"==typeof o&&n.textContent!==""+o&&(!0!==r.suppressHydrationWarning&&gr(n.textContent,o,e),s=["children",""+o]):Te.hasOwnProperty(a)&&null!=o&&"onScroll"===a&&tr("scroll",n)}switch(i){case"input":lt(n),mt(n,r,!0);break;case"textarea":lt(n),St(n);break;case"select":case"option":break;default:"function"==typeof r.onClick&&(n.onclick=mr)}n=s,t.updateQueue=n,null!==n&&(t.flags|=4)}else{a=9===s.nodeType?s:s.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=Tt(i)),"http://www.w3.org/1999/xhtml"===e?"script"===i?((e=a.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof n.is?e=a.createElement(i,{is:n.is}):(e=a.createElement(i),"select"===i&&(a=e,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):e=a.createElementNS(e,i),e[Cr]=t,e[Rr]=n,zl(e,t,!1,!1),t.stateNode=e;e:{switch(a=Bt(i,n),i){case"dialog":tr("cancel",e),tr("close",e),s=n;break;case"iframe":case"object":case"embed":tr("load",e),s=n;break;case"video":case"audio":for(s=0;s<Xs.length;s++)tr(Xs[s],e);s=n;break;case"source":tr("error",e),s=n;break;case"img":case"image":case"link":tr("error",e),tr("load",e),s=n;break;case"details":tr("toggle",e),s=n;break;case"input":ht(e,n),s=dt(e,n),tr("invalid",e);break;case"option":default:s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=Je({},n,{value:void 0}),tr("invalid",e);break;case"textarea":Et(e,n),s=At(e,n),tr("invalid",e)}for(r in Ot(i,s),o=s)if(o.hasOwnProperty(r)){var l=o[r];"style"===r?Pt(e,l):"dangerouslySetInnerHTML"===r?null!=(l=l?l.__html:void 0)&&Lt(e,l):"children"===r?"string"==typeof l?("textarea"!==i||""!==l)&&Ct(e,l):"number"==typeof l&&Ct(e,""+l):"suppressContentEditableWarning"!==r&&"suppressHydrationWarning"!==r&&"autoFocus"!==r&&(Te.hasOwnProperty(r)?null!=l&&"onScroll"===r&&tr("scroll",e):null!=l&&Be(e,r,l,a))}switch(i){case"input":lt(e),mt(e,n,!1);break;case"textarea":lt(e),St(e);break;case"option":null!=n.value&&e.setAttribute("value",""+at(n.value));break;case"select":e.multiple=!!n.multiple,null!=(r=n.value)?yt(e,!!n.multiple,r,!1):null!=n.defaultValue&&yt(e,!!n.multiple,n.defaultValue,!0);break;default:"function"==typeof s.onClick&&(e.onclick=mr)}switch(i){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return ou(t),null;case 6:if(e&&null!=t.stateNode)Yl(e,t,e.memoizedProps,n);else{if("string"!=typeof n&&null===t.stateNode)throw Error(be(166));if(i=co(uo.current),co(oo.current),La(t)){if(n=t.stateNode,i=t.memoizedProps,n[Cr]=t,(r=n.nodeValue!==i)&&null!==(e=ya))switch(e.tag){case 3:gr(n.nodeValue,i,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&gr(n.nodeValue,i,!!(1&e.mode))}r&&(t.flags|=4)}else(n=(9===i.nodeType?i:i.ownerDocument).createTextNode(n))[Cr]=t,t.stateNode=n}return ou(t),null;case 13:if(Hr(po),n=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(Ea&&null!==Aa&&1&t.mode&&!(128&t.flags))Ca(),Ra(),t.flags|=98560,r=!1;else if(r=La(t),null!==n&&null!==n.dehydrated){if(null===e){if(!r)throw Error(be(318));if(!(r=null!==(r=t.memoizedState)?r.dehydrated:null))throw Error(be(317));r[Cr]=t}else Ra(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;ou(t),r=!1}else null!==ba&&(bc(ba),ba=null),r=!0;if(!r)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=i,t):((n=null!==n)!==(null!==e&&null!==e.memoizedState)&&n&&(t.child.flags|=8192,1&t.mode&&(null===e||1&po.current?0===Yu&&(Yu=3):xc())),null!==t.updateQueue&&(t.flags|=4),ou(t),null);case 4:return fo(),Wl(e,t),null===e&&sr(t.stateNode.containerInfo),ou(t),null;case 10:return Ga(t.type._context),ou(t),null;case 19:if(Hr(po),null===(r=t.memoizedState))return ou(t),null;if(n=!!(128&t.flags),null===(a=r.rendering))if(n)au(r,!1);else{if(0!==Yu||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(a=vo(e))){for(t.flags|=128,au(r,!1),null!==(n=a.updateQueue)&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=i,i=t.child;null!==i;)e=n,(r=i).flags&=14680066,null===(a=r.alternate)?(r.childLanes=0,r.lanes=e,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=a.childLanes,r.lanes=a.lanes,r.child=a.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=a.memoizedProps,r.memoizedState=a.memoizedState,r.updateQueue=a.updateQueue,r.type=a.type,e=a.dependencies,r.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return Vr(po,1&po.current|2),t.child}e=e.sibling}null!==r.tail&&fi()>nc&&(t.flags|=128,n=!0,au(r,!1),t.lanes=4194304)}else{if(!n)if(null!==(e=vo(a))){if(t.flags|=128,n=!0,null!==(i=e.updateQueue)&&(t.updateQueue=i,t.flags|=4),au(r,!0),null===r.tail&&"hidden"===r.tailMode&&!a.alternate&&!Ea)return ou(t),null}else 2*fi()-r.renderingStartTime>nc&&1073741824!==i&&(t.flags|=128,n=!0,au(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(null!==(i=r.last)?i.sibling=a:t.child=a,r.last=a)}return null!==r.tail?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=fi(),t.sibling=null,i=po.current,Vr(po,n?1&i|2:1&i),t):(ou(t),null);case 22:case 23:return Ic(),n=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==n&&(t.flags|=8192),n&&1&t.mode?!!(1073741824&Wu)&&(ou(t),6&t.subtreeFlags&&(t.flags|=8192)):ou(t),null;case 24:case 25:return null}throw Error(be(156,t.tag))}function uu(e,t){switch(va(t),t.tag){case 1:return qr(t.type)&&Yr(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return fo(),Hr(Kr),Hr(Qr),Ao(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return mo(t),null;case 13:if(Hr(po),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(be(340));Ra()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Hr(po),null;case 4:return fo(),null;case 10:return Ga(t.type._context),null;case 22:case 23:return Ic(),null;default:return null}}zl=function(e,t){for(var i=t.child;null!==i;){if(5===i.tag||6===i.tag)e.appendChild(i.stateNode);else if(4!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},Wl=function(){},ql=function(e,t,i,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,co(oo.current);var r,a=null;switch(i){case"input":s=dt(e,s),n=dt(e,n),a=[];break;case"select":s=Je({},s,{value:void 0}),n=Je({},n,{value:void 0}),a=[];break;case"textarea":s=At(e,s),n=At(e,n),a=[];break;default:"function"!=typeof s.onClick&&"function"==typeof n.onClick&&(e.onclick=mr)}for(u in Ot(i,n),i=null,s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&null!=s[u])if("style"===u){var o=s[u];for(r in o)o.hasOwnProperty(r)&&(i||(i={}),i[r]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(Te.hasOwnProperty(u)?a||(a=[]):(a=a||[]).push(u,null));for(u in n){var l=n[u];if(o=null!=s?s[u]:void 0,n.hasOwnProperty(u)&&l!==o&&(null!=l||null!=o))if("style"===u)if(o){for(r in o)!o.hasOwnProperty(r)||l&&l.hasOwnProperty(r)||(i||(i={}),i[r]="");for(r in l)l.hasOwnProperty(r)&&o[r]!==l[r]&&(i||(i={}),i[r]=l[r])}else i||(a||(a=[]),a.push(u,i)),i=l;else"dangerouslySetInnerHTML"===u?(l=l?l.__html:void 0,o=o?o.__html:void 0,null!=l&&o!==l&&(a=a||[]).push(u,l)):"children"===u?"string"!=typeof l&&"number"!=typeof l||(a=a||[]).push(u,""+l):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(Te.hasOwnProperty(u)?(null!=l&&"onScroll"===u&&tr("scroll",e),a||o===l||(a=[])):(a=a||[]).push(u,l))}i&&(a=a||[]).push("style",i);var u=a;(t.updateQueue=u)&&(t.flags|=4)}},Yl=function(e,t,i,n){i!==n&&(t.flags|=4)};var cu=!1,du=!1,hu="function"==typeof WeakSet?WeakSet:Set,fu=null;function gu(e,t){var i=e.ref;if(null!==i)if("function"==typeof i)try{i(null)}catch(n){Uc(e,t,n)}else i.current=null}function mu(e,t,i){try{i()}catch(n){Uc(e,t,n)}}var pu=!1;function vu(e,t,i){var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var s=n=n.next;do{if((s.tag&e)===e){var r=s.destroy;s.destroy=void 0,void 0!==r&&mu(t,i,r)}s=s.next}while(s!==n)}}function yu(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var i=t=t.next;do{if((i.tag&e)===e){var n=i.create;i.destroy=n()}i=i.next}while(i!==t)}}function Au(e){var t=e.ref;if(null!==t){var i=e.stateNode;e.tag,e=i,"function"==typeof t?t(e):t.current=e}}function Eu(e){var t=e.alternate;null!==t&&(e.alternate=null,Eu(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[Cr],delete t[Rr],delete t[Dr],delete t[Pr],delete t[Mr])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function bu(e){return 5===e.tag||3===e.tag||4===e.tag}function Su(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||bu(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Tu(e,t,i){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?8===i.nodeType?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(8===i.nodeType?(t=i.parentNode).insertBefore(e,i):(t=i).appendChild(e),null!=(i=i._reactRootContainer)||null!==t.onclick||(t.onclick=mr));else if(4!==n&&null!==(e=e.child))for(Tu(e,t,i),e=e.sibling;null!==e;)Tu(e,t,i),e=e.sibling}function ku(e,t,i){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(4!==n&&null!==(e=e.child))for(ku(e,t,i),e=e.sibling;null!==e;)ku(e,t,i),e=e.sibling}var wu=null,Iu=!1;function Lu(e,t,i){for(i=i.child;null!==i;)Cu(e,t,i),i=i.sibling}function Cu(e,t,i){if(bi&&"function"==typeof bi.onCommitFiberUnmount)try{bi.onCommitFiberUnmount(Ei,i)}catch(o){}switch(i.tag){case 5:du||gu(i,t);case 6:var n=wu,s=Iu;wu=null,Lu(e,t,i),Iu=s,null!==(wu=n)&&(Iu?(e=wu,i=i.stateNode,8===e.nodeType?e.parentNode.removeChild(i):e.removeChild(i)):wu.removeChild(i.stateNode));break;case 18:null!==wu&&(Iu?(e=wu,i=i.stateNode,8===e.nodeType?kr(e.parentNode,i):1===e.nodeType&&kr(e,i),rn(e)):kr(wu,i.stateNode));break;case 4:n=wu,s=Iu,wu=i.stateNode.containerInfo,Iu=!0,Lu(e,t,i),wu=n,Iu=s;break;case 0:case 11:case 14:case 15:if(!du&&(null!==(n=i.updateQueue)&&null!==(n=n.lastEffect))){s=n=n.next;do{var r=s,a=r.destroy;r=r.tag,void 0!==a&&(2&r||4&r)&&mu(i,t,a),s=s.next}while(s!==n)}Lu(e,t,i);break;case 1:if(!du&&(gu(i,t),"function"==typeof(n=i.stateNode).componentWillUnmount))try{n.props=i.memoizedProps,n.state=i.memoizedState,n.componentWillUnmount()}catch(o){Uc(i,t,o)}Lu(e,t,i);break;case 21:Lu(e,t,i);break;case 22:1&i.mode?(du=(n=du)||null!==i.memoizedState,Lu(e,t,i),du=n):Lu(e,t,i);break;default:Lu(e,t,i)}}function Ru(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var i=e.stateNode;null===i&&(i=e.stateNode=new hu),t.forEach(function(t){var n=Gc.bind(null,e,t);i.has(t)||(i.add(t),t.then(n,n))})}}function xu(e,t){var i=t.deletions;if(null!==i)for(var n=0;n<i.length;n++){var s=i[n];try{var r=e,a=t,o=a;e:for(;null!==o;){switch(o.tag){case 5:wu=o.stateNode,Iu=!1;break e;case 3:case 4:wu=o.stateNode.containerInfo,Iu=!0;break e}o=o.return}if(null===wu)throw Error(be(160));Cu(r,a,s),wu=null,Iu=!1;var l=s.alternate;null!==l&&(l.return=null),s.return=null}catch(u){Uc(s,t,u)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)Du(t,e),t=t.sibling}function Du(e,t){var i=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(xu(t,e),Pu(e),4&n){try{vu(3,e,e.return),yu(3,e)}catch(m){Uc(e,e.return,m)}try{vu(5,e,e.return)}catch(m){Uc(e,e.return,m)}}break;case 1:xu(t,e),Pu(e),512&n&&null!==i&&gu(i,i.return);break;case 5:if(xu(t,e),Pu(e),512&n&&null!==i&&gu(i,i.return),32&e.flags){var s=e.stateNode;try{Ct(s,"")}catch(m){Uc(e,e.return,m)}}if(4&n&&null!=(s=e.stateNode)){var r=e.memoizedProps,a=null!==i?i.memoizedProps:r,o=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===o&&"radio"===r.type&&null!=r.name&&ft(s,r),Bt(o,a);var u=Bt(o,r);for(a=0;a<l.length;a+=2){var c=l[a],d=l[a+1];"style"===c?Pt(s,d):"dangerouslySetInnerHTML"===c?Lt(s,d):"children"===c?Ct(s,d):Be(s,c,d,u)}switch(o){case"input":gt(s,r);break;case"textarea":bt(s,r);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!r.multiple;var f=r.value;null!=f?yt(s,!!r.multiple,f,!1):h!==!!r.multiple&&(null!=r.defaultValue?yt(s,!!r.multiple,r.defaultValue,!0):yt(s,!!r.multiple,r.multiple?[]:"",!1))}s[Rr]=r}catch(m){Uc(e,e.return,m)}}break;case 6:if(xu(t,e),Pu(e),4&n){if(null===e.stateNode)throw Error(be(162));s=e.stateNode,r=e.memoizedProps;try{s.nodeValue=r}catch(m){Uc(e,e.return,m)}}break;case 3:if(xu(t,e),Pu(e),4&n&&null!==i&&i.memoizedState.isDehydrated)try{rn(t.containerInfo)}catch(m){Uc(e,e.return,m)}break;case 4:default:xu(t,e),Pu(e);break;case 13:xu(t,e),Pu(e),8192&(s=e.child).flags&&(r=null!==s.memoizedState,s.stateNode.isHidden=r,!r||null!==s.alternate&&null!==s.alternate.memoizedState||(ic=fi())),4&n&&Ru(e);break;case 22:if(c=null!==i&&null!==i.memoizedState,1&e.mode?(du=(u=du)||c,xu(t,e),du=u):xu(t,e),Pu(e),8192&n){if(u=null!==e.memoizedState,(e.stateNode.isHidden=u)&&!c&&1&e.mode)for(fu=e,c=e.child;null!==c;){for(d=fu=c;null!==fu;){switch(f=(h=fu).child,h.tag){case 0:case 11:case 14:case 15:vu(4,h,h.return);break;case 1:gu(h,h.return);var g=h.stateNode;if("function"==typeof g.componentWillUnmount){n=h,i=h.return;try{t=n,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(m){Uc(n,i,m)}}break;case 5:gu(h,h.return);break;case 22:if(null!==h.memoizedState){Fu(d);continue}}null!==f?(f.return=h,fu=f):Fu(d)}c=c.sibling}e:for(c=null,d=e;;){if(5===d.tag){if(null===c){c=d;try{s=d.stateNode,u?"function"==typeof(r=s.style).setProperty?r.setProperty("display","none","important"):r.display="none":(o=d.stateNode,a=null!=(l=d.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,o.style.display=Dt("display",a))}catch(m){Uc(e,e.return,m)}}}else if(6===d.tag){if(null===c)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(m){Uc(e,e.return,m)}}else if((22!==d.tag&&23!==d.tag||null===d.memoizedState||d===e)&&null!==d.child){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;null===d.sibling;){if(null===d.return||d.return===e)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:xu(t,e),Pu(e),4&n&&Ru(e);case 21:}}function Pu(e){var t=e.flags;if(2&t){try{e:{for(var i=e.return;null!==i;){if(bu(i)){var n=i;break e}i=i.return}throw Error(be(160))}switch(n.tag){case 5:var s=n.stateNode;32&n.flags&&(Ct(s,""),n.flags&=-33),ku(e,Su(e),s);break;case 3:case 4:var r=n.stateNode.containerInfo;Tu(e,Su(e),r);break;default:throw Error(be(161))}}catch(a){Uc(e,e.return,a)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function Mu(e,t,i){fu=e,Ou(e)}function Ou(e,t,i){for(var n=!!(1&e.mode);null!==fu;){var s=fu,r=s.child;if(22===s.tag&&n){var a=null!==s.memoizedState||cu;if(!a){var o=s.alternate,l=null!==o&&null!==o.memoizedState||du;o=cu;var u=du;if(cu=a,(du=l)&&!u)for(fu=s;null!==fu;)l=(a=fu).child,22===a.tag&&null!==a.memoizedState?_u(s):null!==l?(l.return=a,fu=l):_u(s);for(;null!==r;)fu=r,Ou(r),r=r.sibling;fu=s,cu=o,du=u}Bu(e)}else 8772&s.subtreeFlags&&null!==r?(r.return=s,fu=r):Bu(e)}}function Bu(e){for(;null!==fu;){var t=fu;if(8772&t.flags){var i=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:du||yu(5,t);break;case 1:var n=t.stateNode;if(4&t.flags&&!du)if(null===i)n.componentDidMount();else{var s=t.elementType===t.type?i.memoizedProps:yl(t.type,i.memoizedProps);n.componentDidUpdate(s,i.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var r=t.updateQueue;null!==r&&ro(t,r,n);break;case 3:var a=t.updateQueue;if(null!==a){if(i=null,null!==t.child)switch(t.child.tag){case 5:case 1:i=t.child.stateNode}ro(t,a,i)}break;case 5:var o=t.stateNode;if(null===i&&4&t.flags){i=o;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break;case"img":l.src&&(i.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var u=t.alternate;if(null!==u){var c=u.memoizedState;if(null!==c){var d=c.dehydrated;null!==d&&rn(d)}}}break;default:throw Error(be(163))}du||512&t.flags&&Au(t)}catch(h){Uc(t,t.return,h)}}if(t===e){fu=null;break}if(null!==(i=t.sibling)){i.return=t.return,fu=i;break}fu=t.return}}function Fu(e){for(;null!==fu;){var t=fu;if(t===e){fu=null;break}var i=t.sibling;if(null!==i){i.return=t.return,fu=i;break}fu=t.return}}function _u(e){for(;null!==fu;){var t=fu;try{switch(t.tag){case 0:case 11:case 15:var i=t.return;try{yu(4,t)}catch(l){Uc(t,i,l)}break;case 1:var n=t.stateNode;if("function"==typeof n.componentDidMount){var s=t.return;try{n.componentDidMount()}catch(l){Uc(t,s,l)}}var r=t.return;try{Au(t)}catch(l){Uc(t,r,l)}break;case 5:var a=t.return;try{Au(t)}catch(l){Uc(t,a,l)}}}catch(l){Uc(t,t.return,l)}if(t===e){fu=null;break}var o=t.sibling;if(null!==o){o.return=t.return,fu=o;break}fu=t.return}}var Nu,Uu=Math.ceil,ju=Fe.ReactCurrentDispatcher,Hu=Fe.ReactCurrentOwner,Vu=Fe.ReactCurrentBatchConfig,Gu=0,Qu=null,Ku=null,zu=0,Wu=0,qu=jr(0),Yu=0,$u=null,Xu=0,Zu=0,Ju=0,ec=null,tc=null,ic=0,nc=1/0,sc=null,rc=!1,ac=null,oc=null,lc=!1,uc=null,cc=0,dc=0,hc=null,fc=-1,gc=0;function mc(){return 6&Gu?fi():-1!==fc?fc:fc=fi()}function pc(e){return 1&e.mode?2&Gu&&0!==zu?zu&-zu:null!==Da.transition?(0===gc&&(gc=Di()),gc):0!==(e=Bi)?e:e=void 0===(e=window.event)?16:fn(e.type):1}function vc(e,t,i,n){if(50<dc)throw dc=0,hc=null,Error(be(185));Mi(e,i,n),2&Gu&&e===Qu||(e===Qu&&(!(2&Gu)&&(Zu|=i),4===Yu&&Sc(e,zu)),yc(e,n),1===i&&0===Gu&&!(1&t.mode)&&(nc=fi()+500,ta&&sa()))}function yc(e,t){var i=e.callbackNode;!function(e,t){for(var i=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,r=e.pendingLanes;0<r;){var a=31-Si(r),o=1<<a,l=s[a];-1===l?0!==(o&i)&&0===(o&n)||(s[a]=Ri(o,t)):l<=t&&(e.expiredLanes|=o),r&=~o}}(e,t);var n=Ci(e,e===Qu?zu:0);if(0===n)null!==i&&ci(i),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(null!=i&&ci(i),1===t)0===e.tag?function(e){ta=!0,na(e)}(Tc.bind(null,e)):na(Tc.bind(null,e)),Sr(function(){!(6&Gu)&&sa()}),i=null;else{switch(Fi(n)){case 1:i=mi;break;case 4:i=pi;break;case 16:default:i=vi;break;case 536870912:i=Ai}i=Qc(i,Ac.bind(null,e))}e.callbackPriority=t,e.callbackNode=i}}function Ac(e,t){if(fc=-1,gc=0,6&Gu)throw Error(be(327));var i=e.callbackNode;if(_c()&&e.callbackNode!==i)return null;var n=Ci(e,e===Qu?zu:0);if(0===n)return null;if(30&n||0!==(n&e.expiredLanes)||t)t=Dc(e,n);else{t=n;var s=Gu;Gu|=2;var r=Rc();for(Qu===e&&zu===t||(sc=null,nc=fi()+500,Lc(e,t));;)try{Mc();break}catch(o){Cc(e,o)}Va(),ju.current=r,Gu=s,null!==Ku?t=0:(Qu=null,zu=0,t=Yu)}if(0!==t){if(2===t&&(0!==(s=xi(e))&&(n=s,t=Ec(e,s))),1===t)throw i=$u,Lc(e,0),Sc(e,n),yc(e,fi()),i;if(6===t)Sc(e,n);else{if(s=e.current.alternate,!(30&n||function(e){for(var t=e;;){if(16384&t.flags){var i=t.updateQueue;if(null!==i&&null!==(i=i.stores))for(var n=0;n<i.length;n++){var s=i[n],r=s.getSnapshot;s=s.value;try{if(!Ts(r(),s))return!1}catch(a){return!1}}}if(i=t.child,16384&t.subtreeFlags&&null!==i)i.return=t,t=i;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(s)||(t=Dc(e,n),2===t&&(r=xi(e),0!==r&&(n=r,t=Ec(e,r))),1!==t)))throw i=$u,Lc(e,0),Sc(e,n),yc(e,fi()),i;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(be(345));case 2:case 5:Fc(e,tc,sc);break;case 3:if(Sc(e,n),(130023424&n)===n&&10<(t=ic+500-fi())){if(0!==Ci(e,0))break;if(((s=e.suspendedLanes)&n)!==n){mc(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Ar(Fc.bind(null,e,tc,sc),t);break}Fc(e,tc,sc);break;case 4:if(Sc(e,n),(4194240&n)===n)break;for(t=e.eventTimes,s=-1;0<n;){var a=31-Si(n);r=1<<a,(a=t[a])>s&&(s=a),n&=~r}if(n=s,10<(n=(120>(n=fi()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Uu(n/1960))-n)){e.timeoutHandle=Ar(Fc.bind(null,e,tc,sc),n);break}Fc(e,tc,sc);break;default:throw Error(be(329))}}}return yc(e,fi()),e.callbackNode===i?Ac.bind(null,e):null}function Ec(e,t){var i=ec;return e.current.memoizedState.isDehydrated&&(Lc(e,t).flags|=256),2!==(e=Dc(e,t))&&(t=tc,tc=i,null!==t&&bc(t)),e}function bc(e){null===tc?tc=e:tc.push.apply(tc,e)}function Sc(e,t){for(t&=~Ju,t&=~Zu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var i=31-Si(t),n=1<<i;e[i]=-1,t&=~n}}function Tc(e){if(6&Gu)throw Error(be(327));_c();var t=Ci(e,0);if(!(1&t))return yc(e,fi()),null;var i=Dc(e,t);if(0!==e.tag&&2===i){var n=xi(e);0!==n&&(t=n,i=Ec(e,n))}if(1===i)throw i=$u,Lc(e,0),Sc(e,t),yc(e,fi()),i;if(6===i)throw Error(be(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fc(e,tc,sc),yc(e,fi()),null}function kc(e,t){var i=Gu;Gu|=1;try{return e(t)}finally{0===(Gu=i)&&(nc=fi()+500,ta&&sa())}}function wc(e){null!==uc&&0===uc.tag&&!(6&Gu)&&_c();var t=Gu;Gu|=1;var i=Vu.transition,n=Bi;try{if(Vu.transition=null,Bi=1,e)return e()}finally{Bi=n,Vu.transition=i,!(6&(Gu=t))&&sa()}}function Ic(){Wu=qu.current,Hr(qu)}function Lc(e,t){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(-1!==i&&(e.timeoutHandle=-1,Er(i)),null!==Ku)for(i=Ku.return;null!==i;){var n=i;switch(va(n),n.tag){case 1:null!=(n=n.type.childContextTypes)&&Yr();break;case 3:fo(),Hr(Kr),Hr(Qr),Ao();break;case 5:mo(n);break;case 4:fo();break;case 13:case 19:Hr(po);break;case 10:Ga(n.type._context);break;case 22:case 23:Ic()}i=i.return}if(Qu=e,Ku=e=qc(e.current,null),zu=Wu=t,Yu=0,$u=null,Ju=Zu=Xu=0,tc=ec=null,null!==Wa){for(t=0;t<Wa.length;t++)if(null!==(n=(i=Wa[t]).interleaved)){i.interleaved=null;var s=n.next,r=i.pending;if(null!==r){var a=r.next;r.next=s,n.next=a}i.pending=n}Wa=null}return e}function Cc(e,t){for(;;){var i=Ku;try{if(Va(),Eo.current=gl,Io){for(var n=To.memoizedState;null!==n;){var s=n.queue;null!==s&&(s.pending=null),n=n.next}Io=!1}if(So=0,wo=ko=To=null,Lo=!1,Co=0,Hu.current=null,null===i||null===i.return){Yu=1,$u=t,Ku=null;break}e:{var r=e,a=i.return,o=i,l=t;if(t=zu,o.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){var u=l,c=o,d=c.tag;if(!(1&c.mode||0!==d&&11!==d&&15!==d)){var h=c.alternate;h?(c.updateQueue=h.updateQueue,c.memoizedState=h.memoizedState,c.lanes=h.lanes):(c.updateQueue=null,c.memoizedState=null)}var f=Dl(a);if(null!==f){f.flags&=-257,Pl(f,a,o,0,t),1&f.mode&&xl(r,u,t),l=u;var g=(t=f).updateQueue;if(null===g){var m=new Set;m.add(l),t.updateQueue=m}else g.add(l);break e}if(!(1&t)){xl(r,u,t),xc();break e}l=Error(be(426))}else if(Ea&&1&o.mode){var p=Dl(a);if(null!==p){!(65536&p.flags)&&(p.flags|=256),Pl(p,a,o,0,t),xa(wl(l,o));break e}}r=l=wl(l,o),4!==Yu&&(Yu=2),null===ec?ec=[r]:ec.push(r),r=a;do{switch(r.tag){case 3:r.flags|=65536,t&=-t,r.lanes|=t,no(r,Cl(0,l,t));break e;case 1:o=l;var v=r.type,y=r.stateNode;if(!(128&r.flags||"function"!=typeof v.getDerivedStateFromError&&(null===y||"function"!=typeof y.componentDidCatch||null!==oc&&oc.has(y)))){r.flags|=65536,t&=-t,r.lanes|=t,no(r,Rl(r,o,t));break e}}r=r.return}while(null!==r)}Bc(i)}catch(A){t=A,Ku===i&&null!==i&&(Ku=i=i.return);continue}break}}function Rc(){var e=ju.current;return ju.current=gl,null===e?gl:e}function xc(){0!==Yu&&3!==Yu&&2!==Yu||(Yu=4),null===Qu||!(268435455&Xu)&&!(268435455&Zu)||Sc(Qu,zu)}function Dc(e,t){var i=Gu;Gu|=2;var n=Rc();for(Qu===e&&zu===t||(sc=null,Lc(e,t));;)try{Pc();break}catch(s){Cc(e,s)}if(Va(),Gu=i,ju.current=n,null!==Ku)throw Error(be(261));return Qu=null,zu=0,Yu}function Pc(){for(;null!==Ku;)Oc(Ku)}function Mc(){for(;null!==Ku&&!di();)Oc(Ku)}function Oc(e){var t=Nu(e.alternate,e,Wu);e.memoizedProps=e.pendingProps,null===t?Bc(e):Ku=t,Hu.current=null}function Bc(e){var t=e;do{var i=t.alternate;if(e=t.return,32768&t.flags){if(null!==(i=uu(i,t)))return i.flags&=32767,void(Ku=i);if(null===e)return Yu=6,void(Ku=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(i=lu(i,t,Wu)))return void(Ku=i);if(null!==(t=t.sibling))return void(Ku=t);Ku=t=e}while(null!==t);0===Yu&&(Yu=5)}function Fc(e,t,i){var n=Bi,s=Vu.transition;try{Vu.transition=null,Bi=1,function(e,t,i,n){do{_c()}while(null!==uc);if(6&Gu)throw Error(be(327));i=e.finishedWork;var s=e.finishedLanes;if(null===i)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(be(177));e.callbackNode=null,e.callbackPriority=0;var r=i.lanes|i.childLanes;if(function(e,t){var i=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<i;){var s=31-Si(i),r=1<<s;t[s]=0,n[s]=-1,e[s]=-1,i&=~r}}(e,r),e===Qu&&(Ku=Qu=null,zu=0),!(2064&i.subtreeFlags)&&!(2064&i.flags)||lc||(lc=!0,Qc(vi,function(){return _c(),null})),r=!!(15990&i.flags),!!(15990&i.subtreeFlags)||r){r=Vu.transition,Vu.transition=null;var a=Bi;Bi=1;var o=Gu;Gu|=4,Hu.current=null,function(e,t){if(pr=on,Rs(e=Cs())){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{var n=(i=(i=e.ownerDocument)&&i.defaultView||window).getSelection&&i.getSelection();if(n&&0!==n.rangeCount){i=n.anchorNode;var s=n.anchorOffset,r=n.focusNode;n=n.focusOffset;try{i.nodeType,r.nodeType}catch(E){i=null;break e}var a=0,o=-1,l=-1,u=0,c=0,d=e,h=null;t:for(;;){for(var f;d!==i||0!==s&&3!==d.nodeType||(o=a+s),d!==r||0!==n&&3!==d.nodeType||(l=a+n),3===d.nodeType&&(a+=d.nodeValue.length),null!==(f=d.firstChild);)h=d,d=f;for(;;){if(d===e)break t;if(h===i&&++u===s&&(o=a),h===r&&++c===n&&(l=a),null!==(f=d.nextSibling))break;h=(d=h).parentNode}d=f}i=-1===o||-1===l?null:{start:o,end:l}}else i=null}i=i||{start:0,end:0}}else i=null;for(vr={focusedElem:e,selectionRange:i},on=!1,fu=t;null!==fu;)if(e=(t=fu).child,1028&t.subtreeFlags&&null!==e)e.return=t,fu=e;else for(;null!==fu;){t=fu;try{var g=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==g){var m=g.memoizedProps,p=g.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?m:yl(t.type,m),p);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var A=t.stateNode.containerInfo;1===A.nodeType?A.textContent="":9===A.nodeType&&A.documentElement&&A.removeChild(A.documentElement);break;default:throw Error(be(163))}}catch(E){Uc(t,t.return,E)}if(null!==(e=t.sibling)){e.return=t.return,fu=e;break}fu=t.return}g=pu,pu=!1}(e,i),Du(i,e),xs(vr),on=!!pr,vr=pr=null,e.current=i,Mu(i),hi(),Gu=o,Bi=a,Vu.transition=r}else e.current=i;if(lc&&(lc=!1,uc=e,cc=s),r=e.pendingLanes,0===r&&(oc=null),function(e){if(bi&&"function"==typeof bi.onCommitFiberRoot)try{bi.onCommitFiberRoot(Ei,e,void 0,!(128&~e.current.flags))}catch(t){}}(i.stateNode),yc(e,fi()),null!==t)for(n=e.onRecoverableError,i=0;i<t.length;i++)s=t[i],n(s.value,{componentStack:s.stack,digest:s.digest});if(rc)throw rc=!1,e=ac,ac=null,e;!!(1&cc)&&0!==e.tag&&_c(),r=e.pendingLanes,1&r?e===hc?dc++:(dc=0,hc=e):dc=0,sa()}(e,t,i,n)}finally{Vu.transition=s,Bi=n}return null}function _c(){if(null!==uc){var e=Fi(cc),t=Vu.transition,i=Bi;try{if(Vu.transition=null,Bi=16>e?16:e,null===uc)var n=!1;else{if(e=uc,uc=null,cc=0,6&Gu)throw Error(be(331));var s=Gu;for(Gu|=4,fu=e.current;null!==fu;){var r=fu,a=r.child;if(16&fu.flags){var o=r.deletions;if(null!==o){for(var l=0;l<o.length;l++){var u=o[l];for(fu=u;null!==fu;){var c=fu;switch(c.tag){case 0:case 11:case 15:vu(8,c,r)}var d=c.child;if(null!==d)d.return=c,fu=d;else for(;null!==fu;){var h=(c=fu).sibling,f=c.return;if(Eu(c),c===u){fu=null;break}if(null!==h){h.return=f,fu=h;break}fu=f}}}var g=r.alternate;if(null!==g){var m=g.child;if(null!==m){g.child=null;do{var p=m.sibling;m.sibling=null,m=p}while(null!==m)}}fu=r}}if(2064&r.subtreeFlags&&null!==a)a.return=r,fu=a;else e:for(;null!==fu;){if(2048&(r=fu).flags)switch(r.tag){case 0:case 11:case 15:vu(9,r,r.return)}var v=r.sibling;if(null!==v){v.return=r.return,fu=v;break e}fu=r.return}}var y=e.current;for(fu=y;null!==fu;){var A=(a=fu).child;if(2064&a.subtreeFlags&&null!==A)A.return=a,fu=A;else e:for(a=y;null!==fu;){if(2048&(o=fu).flags)try{switch(o.tag){case 0:case 11:case 15:yu(9,o)}}catch(b){Uc(o,o.return,b)}if(o===a){fu=null;break e}var E=o.sibling;if(null!==E){E.return=o.return,fu=E;break e}fu=o.return}}if(Gu=s,sa(),bi&&"function"==typeof bi.onPostCommitFiberRoot)try{bi.onPostCommitFiberRoot(Ei,e)}catch(b){}n=!0}return n}finally{Bi=i,Vu.transition=t}}return!1}function Nc(e,t,i){e=to(e,t=Cl(0,t=wl(i,t),1),1),t=mc(),null!==e&&(Mi(e,1,t),yc(e,t))}function Uc(e,t,i){if(3===e.tag)Nc(e,e,i);else for(;null!==t;){if(3===t.tag){Nc(t,e,i);break}if(1===t.tag){var n=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof n.componentDidCatch&&(null===oc||!oc.has(n))){t=to(t,e=Rl(t,e=wl(i,e),1),1),e=mc(),null!==t&&(Mi(t,1,e),yc(t,e));break}}t=t.return}}function jc(e,t,i){var n=e.pingCache;null!==n&&n.delete(t),t=mc(),e.pingedLanes|=e.suspendedLanes&i,Qu===e&&(zu&i)===i&&(4===Yu||3===Yu&&(130023424&zu)===zu&&500>fi()-ic?Lc(e,0):Ju|=i),yc(e,t)}function Hc(e,t){0===t&&(1&e.mode?(t=Ii,!(130023424&(Ii<<=1))&&(Ii=4194304)):t=1);var i=mc();null!==(e=$a(e,t))&&(Mi(e,t,i),yc(e,i))}function Vc(e){var t=e.memoizedState,i=0;null!==t&&(i=t.retryLane),Hc(e,i)}function Gc(e,t){var i=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;null!==s&&(i=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(be(314))}null!==n&&n.delete(t),Hc(e,i)}function Qc(e,t){return ui(e,t)}function Kc(e,t,i,n){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zc(e,t,i,n){return new Kc(e,t,i,n)}function Wc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function qc(e,t){var i=e.alternate;return null===i?((i=zc(e.tag,t,e.key,e.mode)).elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=14680064&e.flags,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Yc(e,t,i,n,s,r){var a=2;if(n=e,"function"==typeof e)Wc(e)&&(a=1);else if("string"==typeof e)a=5;else e:switch(e){case Ue:return $c(i.children,s,r,t);case je:a=8,s|=8;break;case He:return(e=zc(12,i,t,2|s)).elementType=He,e.lanes=r,e;case Ke:return(e=zc(13,i,t,s)).elementType=Ke,e.lanes=r,e;case ze:return(e=zc(19,i,t,s)).elementType=ze,e.lanes=r,e;case Ye:return Xc(i,s,r,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case Ve:a=10;break e;case Ge:a=9;break e;case Qe:a=11;break e;case We:a=14;break e;case qe:a=16,n=null;break e}throw Error(be(130,null==e?e:typeof e,""))}return(t=zc(a,i,t,s)).elementType=e,t.type=n,t.lanes=r,t}function $c(e,t,i,n){return(e=zc(7,e,n,t)).lanes=i,e}function Xc(e,t,i,n){return(e=zc(22,e,n,t)).elementType=Ye,e.lanes=i,e.stateNode={isHidden:!1},e}function Zc(e,t,i){return(e=zc(6,e,null,t)).lanes=i,e}function Jc(e,t,i){return(t=zc(4,null!==e.children?e.children:[],e.key,t)).lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ed(e,t,i,n,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pi(0),this.expirationTimes=Pi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pi(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function td(e,t,i,n,s,r,a,o,l){return e=new ed(e,t,i,o,l),1===t?(t=1,!0===r&&(t|=8)):t=0,r=zc(3,null,null,t),e.current=r,r.stateNode=e,r.memoizedState={element:n,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Za(r),e}function id(e){if(!e)return Gr;e:{if(si(e=e._reactInternals)!==e||1!==e.tag)throw Error(be(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(qr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(be(171))}if(1===e.tag){var i=e.type;if(qr(i))return Xr(e,i,t)}return t}function nd(e,t,i,n,s,r,a,o,l){return(e=td(i,n,!0,e,0,r,0,o,l)).context=id(null),i=e.current,(r=eo(n=mc(),s=pc(i))).callback=null!=t?t:null,to(i,r,s),e.current.lanes=s,Mi(e,s,n),yc(e,n),e}function sd(e,t,i,n){var s=t.current,r=mc(),a=pc(s);return i=id(i),null===t.context?t.context=i:t.pendingContext=i,(t=eo(r,a)).payload={element:e},null!==(n=void 0===n?null:n)&&(t.callback=n),null!==(e=to(s,t,a))&&(vc(e,s,a,r),io(e,s,a)),a}function rd(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function ad(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var i=e.retryLane;e.retryLane=0!==i&&i<t?i:t}}function od(e,t){ad(e,t),(e=e.alternate)&&ad(e,t)}Nu=function(e,t,i){if(null!==e)if(e.memoizedProps!==t.pendingProps||Kr.current)Ol=!0;else{if(0===(e.lanes&i)&&!(128&t.flags))return Ol=!1,function(e,t,i){switch(t.tag){case 3:Ql(t),Ra();break;case 5:go(t);break;case 1:qr(t.type)&&Zr(t);break;case 4:ho(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;Vr(Na,n._currentValue),n._currentValue=s;break;case 13:if(null!==(n=t.memoizedState))return null!==n.dehydrated?(Vr(po,1&po.current),t.flags|=128,null):0!==(i&t.child.childLanes)?Zl(e,t,i):(Vr(po,1&po.current),null!==(e=ru(e,t,i))?e.sibling:null);Vr(po,1&po.current);break;case 19:if(n=0!==(i&t.childLanes),128&e.flags){if(n)return nu(e,t,i);t.flags|=128}if(null!==(s=t.memoizedState)&&(s.rendering=null,s.tail=null,s.lastEffect=null),Vr(po,po.current),n)break;return null;case 22:case 23:return t.lanes=0,Ul(e,t,i)}return ru(e,t,i)}(e,t,i);Ol=!!(131072&e.flags)}else Ol=!1,Ea&&1048576&t.flags&&ma(t,la,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;su(e,t),e=t.pendingProps;var s=Wr(t,Qr.current);Ka(t,i),s=Po(null,t,n,e,s,i);var r=Mo();return t.flags|=1,"object"==typeof s&&null!==s&&"function"==typeof s.render&&void 0===s.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,qr(n)?(r=!0,Zr(t)):r=!1,t.memoizedState=null!==s.state&&void 0!==s.state?s.state:null,Za(t),s.updater=El,t.stateNode=s,s._reactInternals=t,kl(t,n,e,i),t=Gl(null,t,n,!0,r,i)):(t.tag=0,Ea&&r&&pa(t),Bl(null,t,s,i),t=t.child),t;case 16:n=t.elementType;e:{switch(su(e,t),e=t.pendingProps,n=(s=n._init)(n._payload),t.type=n,s=t.tag=function(e){if("function"==typeof e)return Wc(e)?1:0;if(null!=e){if((e=e.$$typeof)===Qe)return 11;if(e===We)return 14}return 2}(n),e=yl(n,e),s){case 0:t=Hl(null,t,n,e,i);break e;case 1:t=Vl(null,t,n,e,i);break e;case 11:t=Fl(null,t,n,e,i);break e;case 14:t=_l(null,t,n,yl(n.type,e),i);break e}throw Error(be(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,Hl(e,t,n,s=t.elementType===n?s:yl(n,s),i);case 1:return n=t.type,s=t.pendingProps,Vl(e,t,n,s=t.elementType===n?s:yl(n,s),i);case 3:e:{if(Ql(t),null===e)throw Error(be(387));n=t.pendingProps,s=(r=t.memoizedState).element,Ja(e,t),so(t,n,null,i);var a=t.memoizedState;if(n=a.element,r.isDehydrated){if(r={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=r,t.memoizedState=r,256&t.flags){t=Kl(e,t,n,i,s=wl(Error(be(423)),t));break e}if(n!==s){t=Kl(e,t,n,i,s=wl(Error(be(424)),t));break e}for(Aa=wr(t.stateNode.containerInfo.firstChild),ya=t,Ea=!0,ba=null,i=_a(t,null,n,i),t.child=i;i;)i.flags=-3&i.flags|4096,i=i.sibling}else{if(Ra(),n===s){t=ru(e,t,i);break e}Bl(e,t,n,i)}t=t.child}return t;case 5:return go(t),null===e&&wa(t),n=t.type,s=t.pendingProps,r=null!==e?e.memoizedProps:null,a=s.children,yr(n,s)?a=null:null!==r&&yr(n,r)&&(t.flags|=32),jl(e,t),Bl(e,t,a,i),t.child;case 6:return null===e&&wa(t),null;case 13:return Zl(e,t,i);case 4:return ho(t,t.stateNode.containerInfo),n=t.pendingProps,null===e?t.child=Fa(t,null,n,i):Bl(e,t,n,i),t.child;case 11:return n=t.type,s=t.pendingProps,Fl(e,t,n,s=t.elementType===n?s:yl(n,s),i);case 7:return Bl(e,t,t.pendingProps,i),t.child;case 8:case 12:return Bl(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,r=t.memoizedProps,a=s.value,Vr(Na,n._currentValue),n._currentValue=a,null!==r)if(Ts(r.value,a)){if(r.children===s.children&&!Kr.current){t=ru(e,t,i);break e}}else for(null!==(r=t.child)&&(r.return=t);null!==r;){var o=r.dependencies;if(null!==o){a=r.child;for(var l=o.firstContext;null!==l;){if(l.context===n){if(1===r.tag){(l=eo(-1,i&-i)).tag=2;var u=r.updateQueue;if(null!==u){var c=(u=u.shared).pending;null===c?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}r.lanes|=i,null!==(l=r.alternate)&&(l.lanes|=i),Qa(r.return,i,t),o.lanes|=i;break}l=l.next}}else if(10===r.tag)a=r.type===t.type?null:r.child;else if(18===r.tag){if(null===(a=r.return))throw Error(be(341));a.lanes|=i,null!==(o=a.alternate)&&(o.lanes|=i),Qa(a,i,t),a=r.sibling}else a=r.child;if(null!==a)a.return=r;else for(a=r;null!==a;){if(a===t){a=null;break}if(null!==(r=a.sibling)){r.return=a.return,a=r;break}a=a.return}r=a}Bl(e,t,s.children,i),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Ka(t,i),n=n(s=za(s)),t.flags|=1,Bl(e,t,n,i),t.child;case 14:return s=yl(n=t.type,t.pendingProps),_l(e,t,n,s=yl(n.type,s),i);case 15:return Nl(e,t,t.type,t.pendingProps,i);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:yl(n,s),su(e,t),t.tag=1,qr(n)?(e=!0,Zr(t)):e=!1,Ka(t,i),Sl(t,n,s),kl(t,n,s,i),Gl(null,t,n,!0,e,i);case 19:return nu(e,t,i);case 22:return Ul(e,t,i)}throw Error(be(156,t.tag))};var ld="function"==typeof reportError?reportError:function(e){};function ud(e){this._internalRoot=e}function cd(e){this._internalRoot=e}function dd(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function hd(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function fd(){}function gd(e,t,i,n,s){var r=i._reactRootContainer;if(r){var a=r;if("function"==typeof s){var o=s;s=function(){var e=rd(a);o.call(e)}}sd(t,a,e,s)}else a=function(e,t,i,n,s){if(s){if("function"==typeof n){var r=n;n=function(){var e=rd(a);r.call(e)}}var a=nd(t,n,e,0,null,!1,0,"",fd);return e._reactRootContainer=a,e[xr]=a.current,sr(8===e.nodeType?e.parentNode:e),wc(),a}for(;s=e.lastChild;)e.removeChild(s);if("function"==typeof n){var o=n;n=function(){var e=rd(l);o.call(e)}}var l=td(e,0,!1,null,0,!1,0,"",fd);return e._reactRootContainer=l,e[xr]=l.current,sr(8===e.nodeType?e.parentNode:e),wc(function(){sd(t,l,i,n)}),l}(i,t,e,s,n);return rd(a)}cd.prototype.render=ud.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(be(409));sd(e,t,null,null)},cd.prototype.unmount=ud.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;wc(function(){sd(null,e,null,null)}),t[xr]=null}},cd.prototype.unstable_scheduleHydration=function(e){if(e){var t=ji();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Yi.length&&0!==t&&t<Yi[i].priority;i++);Yi.splice(i,0,e),0===i&&Ji(e)}},_i=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var i=Li(t.pendingLanes);0!==i&&(Oi(t,1|i),yc(t,fi()),!(6&Gu)&&(nc=fi()+500,sa()))}break;case 13:wc(function(){var t=$a(e,1);if(null!==t){var i=mc();vc(t,e,1,i)}}),od(e,1)}},Ni=function(e){if(13===e.tag){var t=$a(e,134217728);if(null!==t)vc(t,e,134217728,mc());od(e,134217728)}},Ui=function(e){if(13===e.tag){var t=pc(e),i=$a(e,t);if(null!==i)vc(i,e,t,mc());od(e,t)}},ji=function(){return Bi},Hi=function(e,t){var i=Bi;try{return Bi=e,t()}finally{Bi=i}},Nt=function(e,t,i){switch(t){case"input":if(gt(e,i),t=i.name,"radio"===i.type&&null!=t){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<i.length;t++){var n=i[t];if(n!==e&&n.form===e.form){var s=_r(n);if(!s)throw Error(be(90));ut(n),gt(n,s)}}}break;case"textarea":bt(e,i);break;case"select":null!=(t=i.value)&&yt(e,!!i.multiple,t,!1)}},Qt=kc,Kt=wc;var md={usingClientEntryPoint:!1,Events:[Br,Fr,_r,Vt,Gt,kc]},pd={findFiberByHostInstance:Or,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},vd={bundleType:pd.bundleType,version:pd.version,rendererPackageName:pd.rendererPackageName,rendererConfig:pd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Fe.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=oi(e))?null:e.stateNode},findFiberByHostInstance:pd.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var yd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yd.isDisabled&&yd.supportsFiber)try{Ei=yd.inject(vd),bi=yd}catch(It){}}me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=md,me.createPortal=function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!dd(t))throw Error(be(200));return function(e,t,i){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:Ne,key:null==n?null:""+n,children:e,containerInfo:t,implementation:i}}(e,t,null,i)},me.createRoot=function(e,t){if(!dd(e))throw Error(be(299));var i=!1,n="",s=ld;return null!=t&&(!0===t.unstable_strictMode&&(i=!0),void 0!==t.identifierPrefix&&(n=t.identifierPrefix),void 0!==t.onRecoverableError&&(s=t.onRecoverableError)),t=td(e,1,!1,null,0,i,0,n,s),e[xr]=t.current,sr(8===e.nodeType?e.parentNode:e),new ud(t)},me.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(be(188));throw e=Object.keys(e).join(","),Error(be(268,e))}return e=null===(e=oi(t))?null:e.stateNode},me.flushSync=function(e){return wc(e)},me.hydrate=function(e,t,i){if(!hd(t))throw Error(be(200));return gd(null,e,t,!0,i)},me.hydrateRoot=function(e,t,i){if(!dd(e))throw Error(be(405));var n=null!=i&&i.hydratedSources||null,s=!1,r="",a=ld;if(null!=i&&(!0===i.unstable_strictMode&&(s=!0),void 0!==i.identifierPrefix&&(r=i.identifierPrefix),void 0!==i.onRecoverableError&&(a=i.onRecoverableError)),t=nd(t,null,e,1,null!=i?i:null,s,0,r,a),e[xr]=t.current,sr(e),n)for(e=0;e<n.length;e++)s=(s=(i=n[e])._getVersion)(i._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[i,s]:t.mutableSourceEagerHydrationData.push(i,s);return new cd(t)},me.render=function(e,t,i){if(!hd(t))throw Error(be(200));return gd(null,e,t,!1,i)},me.unmountComponentAtNode=function(e){if(!hd(e))throw Error(be(40));return!!e._reactRootContainer&&(wc(function(){gd(null,null,e,!1,function(){e._reactRootContainer=null,e[xr]=null})}),!0)},me.unstable_batchedUpdates=kc,me.unstable_renderSubtreeIntoContainer=function(e,t,i,n){if(!hd(i))throw Error(be(200));if(null==e||void 0===e._reactInternals)throw Error(be(38));return gd(e,t,i,!1,n)},me.version="18.3.1-next-f1338f8080-20240426",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){}}(),ge.exports=me;var Ad,Ed=ge.exports;Ad=Ed.createRoot,Ed.hydrateRoot;var bd={exports:{}},Sd={},Td=he,kd=Symbol.for("react.element"),wd=Symbol.for("react.fragment"),Id=Object.prototype.hasOwnProperty,Ld=Td.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Cd={key:!0,ref:!0,__self:!0,__source:!0};function Rd(e,t,i){var n,s={},r=null,a=null;for(n in void 0!==i&&(r=""+i),void 0!==t.key&&(r=""+t.key),void 0!==t.ref&&(a=t.ref),t)Id.call(t,n)&&!Cd.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:kd,type:e,key:r,ref:a,props:s,_owner:Ld.current}}Sd.Fragment=wd,Sd.jsx=Rd,Sd.jsxs=Rd,bd.exports=Sd;var xd=bd.exports;const Dd=he.createContext({});function Pd(e){const t=he.useRef(null);return null===t.current&&(t.current=e()),t.current}const Md=he.createContext(null),Od=he.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});const Bd="undefined"!=typeof window,Fd=Bd?he.useLayoutEffect:he.useEffect,_d=e=>e;let Nd=_d;const Ud=!1;const jd=["read","resolveKeyframes","update","preRender","render","postRender"];function Hd(e,t){let i=!1,n=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>i=!0,a=jd.reduce((e,t)=>(e[t]=function(e){let t=new Set,i=new Set,n=!1,s=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(t){r.has(t)&&(l.schedule(t),e()),t(a)}const l={schedule:(e,s=!1,a=!1)=>{const o=a&&n?t:i;return s&&r.add(e),o.has(e)||o.add(e),e},cancel:e=>{i.delete(e),r.delete(e)},process:e=>{a=e,n?s=!0:(n=!0,[t,i]=[i,t],t.forEach(o),t.clear(),n=!1,s&&(s=!1,l.process(e)))}};return l}(r),e),{}),{read:o,resolveKeyframes:l,update:u,preRender:c,render:d,postRender:h}=a,f=()=>{const r=performance.now();i=!1,s.delta=n?1e3/60:Math.max(Math.min(r-s.timestamp,40),1),s.timestamp=r,s.isProcessing=!0,o.process(s),l.process(s),u.process(s),c.process(s),d.process(s),h.process(s),s.isProcessing=!1,i&&t&&(n=!1,e(f))};return{schedule:jd.reduce((t,r)=>{const o=a[r];return t[r]=(t,r=!1,a=!1)=>(i||(i=!0,n=!0,s.isProcessing||e(f)),o.schedule(t,r,a)),t},{}),cancel:e=>{for(let t=0;t<jd.length;t++)a[jd[t]].cancel(e)},state:s,steps:a}}const{schedule:Vd,cancel:Gd,state:Qd,steps:Kd}=Hd("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:_d,!0),zd=he.createContext({strict:!1}),Wd={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},qd={};for(const LP in Wd)qd[LP]={isEnabled:e=>Wd[LP].some(t=>!!e[t])};const Yd=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function $d(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Yd.has(e)}let Xd=e=>!$d(e);try{(Zd=require("@emotion/is-prop-valid").default)&&(Xd=e=>e.startsWith("on")?!$d(e):Zd(e))}catch(JR){}var Zd;function Jd(e){if("undefined"==typeof Proxy)return e;const t=new Map;return new Proxy((...t)=>e(...t),{get:(i,n)=>"create"===n?e:(t.has(n)||t.set(n,e(n)),t.get(n))})}const eh=he.createContext({});function th(e){return"string"==typeof e||Array.isArray(e)}function ih(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}const nh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],sh=["initial",...nh];function rh(e){return ih(e.animate)||sh.some(t=>th(e[t]))}function ah(e){return Boolean(rh(e)||e.variants)}function oh(e){const{initial:t,animate:i}=function(e,t){if(rh(e)){const{initial:t,animate:i}=e;return{initial:!1===t||th(t)?t:void 0,animate:th(i)?i:void 0}}return!1!==e.inherit?t:{}}(e,he.useContext(eh));return he.useMemo(()=>({initial:t,animate:i}),[lh(t),lh(i)])}function lh(e){return Array.isArray(e)?e.join(" "):e}const uh=Symbol.for("motionComponentSymbol");function ch(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function dh(e,t,i){return he.useCallback(n=>{n&&e.onMount&&e.onMount(n),t&&(n?t.mount(n):t.unmount()),i&&("function"==typeof i?i(n):ch(i)&&(i.current=n))},[t])}const hh=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),fh="data-"+hh("framerAppearId"),{schedule:gh}=Hd(queueMicrotask,!1),mh=he.createContext({});function ph(e,t,i,n,s){var r,a;const{visualElement:o}=he.useContext(eh),l=he.useContext(zd),u=he.useContext(Md),c=he.useContext(Od).reducedMotion,d=he.useRef(null);n=n||l.renderer,!d.current&&n&&(d.current=n(e,{visualState:t,parent:o,props:i,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:c}));const h=d.current,f=he.useContext(mh);!h||h.projection||!s||"html"!==h.type&&"svg"!==h.type||function(e,t,i,n){const{layoutId:s,layout:r,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:u}=t;e.projection=new i(e.latestValues,t["data-framer-portal-id"]?void 0:vh(e.parent)),e.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:Boolean(a)||o&&ch(o),visualElement:e,animationType:"string"==typeof r?r:"both",initialPromotionConfig:n,layoutScroll:l,layoutRoot:u})}(d.current,i,s,f);const g=he.useRef(!1);he.useInsertionEffect(()=>{h&&g.current&&h.update(i,u)});const m=i[fh],p=he.useRef(Boolean(m)&&!(null===(r=window.MotionHandoffIsComplete)||void 0===r?void 0:r.call(window,m))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,m)));return Fd(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),gh.render(h.render),p.current&&h.animationState&&h.animationState.animateChanges())}),he.useEffect(()=>{h&&(!p.current&&h.animationState&&h.animationState.animateChanges(),p.current&&(queueMicrotask(()=>{var e;null===(e=window.MotionHandoffMarkAsComplete)||void 0===e||e.call(window,m)}),p.current=!1))}),h}function vh(e){if(e)return!1!==e.options.allowProjection?e.projection:vh(e.parent)}function yh({preloadedFeatures:e,createVisualElement:t,useRender:i,useVisualState:n,Component:s}){var r,a;function o(e,r){let a;const o={...he.useContext(Od),...e,layoutId:Ah(e)},{isStatic:l}=o,u=oh(e),c=n(e,l);if(!l&&Bd){he.useContext(zd).strict;const e=function(e){const{drag:t,layout:i}=qd;if(!t&&!i)return{};const n={...t,...i};return{MeasureLayout:(null==t?void 0:t.isEnabled(e))||(null==i?void 0:i.isEnabled(e))?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}(o);a=e.MeasureLayout,u.visualElement=ph(s,c,o,t,e.ProjectionNode)}return xd.jsxs(eh.Provider,{value:u,children:[a&&u.visualElement?xd.jsx(a,{visualElement:u.visualElement,...o}):null,i(s,e,dh(c,u.visualElement,r),c,l,u.visualElement)]})}e&&function(e){for(const t in e)qd[t]={...qd[t],...e[t]}}(e),o.displayName=`motion.${"string"==typeof s?s:`create(${null!==(a=null!==(r=s.displayName)&&void 0!==r?r:s.name)&&void 0!==a?a:""})`}`;const l=he.forwardRef(o);return l[uh]=s,l}function Ah({layoutId:e}){const t=he.useContext(Dd).id;return t&&void 0!==e?t+"-"+e:e}const Eh=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function bh(e){return"string"==typeof e&&!e.includes("-")&&!!(Eh.indexOf(e)>-1||/[A-Z]/u.test(e))}function Sh(e){const t=[{},{}];return null==e||e.values.forEach((e,i)=>{t[0][i]=e.get(),t[1][i]=e.getVelocity()}),t}function Th(e,t,i,n){if("function"==typeof t){const[s,r]=Sh(n);t=t(void 0!==i?i:e.custom,s,r)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[s,r]=Sh(n);t=t(void 0!==i?i:e.custom,s,r)}return t}const kh=e=>Array.isArray(e),wh=e=>kh(e)?e[e.length-1]||0:e,Ih=e=>Boolean(e&&e.getVelocity);function Lh(e){const t=Ih(e)?e.get():e;return i=t,Boolean(i&&"object"==typeof i&&i.mix&&i.toValue)?t.toValue():t;var i}const Ch=e=>(t,i)=>{const n=he.useContext(eh),s=he.useContext(Md),r=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:i},n,s,r){const a={latestValues:Rh(n,s,r,e),renderState:t()};return i&&(a.onMount=e=>i({props:n,current:e,...a}),a.onUpdate=e=>i(e)),a}(e,t,n,s);return i?r():Pd(r)};function Rh(e,t,i,n){const s={},r=n(e,{});for(const h in r)s[h]=Lh(r[h]);let{initial:a,animate:o}=e;const l=rh(e),u=ah(e);t&&u&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===o&&(o=t.animate));let c=!!i&&!1===i.initial;c=c||!1===a;const d=c?o:a;if(d&&"boolean"!=typeof d&&!ih(d)){const t=Array.isArray(d)?d:[d];for(let i=0;i<t.length;i++){const n=Th(e,t[i]);if(n){const{transitionEnd:e,transition:t,...i}=n;for(const n in i){let e=i[n];if(Array.isArray(e)){e=e[c?e.length-1:0]}null!==e&&(s[n]=e)}for(const n in e)s[n]=e[n]}}}return s}const xh=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Dh=new Set(xh),Ph=e=>t=>"string"==typeof t&&t.startsWith(e),Mh=Ph("--"),Oh=Ph("var(--"),Bh=e=>!!Oh(e)&&Fh.test(e.split("/*")[0].trim()),Fh=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,_h=(e,t)=>t&&"number"==typeof e?t.transform(e):e,Nh=(e,t,i)=>i>t?t:i<e?e:i,Uh={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},jh={...Uh,transform:e=>Nh(0,1,e)},Hh={...Uh,default:1},Vh=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),Gh=Vh("deg"),Qh=Vh("%"),Kh=Vh("px"),zh=Vh("vh"),Wh=Vh("vw"),qh={...Qh,parse:e=>Qh.parse(e)/100,transform:e=>Qh.transform(100*e)},Yh={borderWidth:Kh,borderTopWidth:Kh,borderRightWidth:Kh,borderBottomWidth:Kh,borderLeftWidth:Kh,borderRadius:Kh,radius:Kh,borderTopLeftRadius:Kh,borderTopRightRadius:Kh,borderBottomRightRadius:Kh,borderBottomLeftRadius:Kh,width:Kh,maxWidth:Kh,height:Kh,maxHeight:Kh,top:Kh,right:Kh,bottom:Kh,left:Kh,padding:Kh,paddingTop:Kh,paddingRight:Kh,paddingBottom:Kh,paddingLeft:Kh,margin:Kh,marginTop:Kh,marginRight:Kh,marginBottom:Kh,marginLeft:Kh,backgroundPositionX:Kh,backgroundPositionY:Kh},$h={rotate:Gh,rotateX:Gh,rotateY:Gh,rotateZ:Gh,scale:Hh,scaleX:Hh,scaleY:Hh,scaleZ:Hh,skew:Gh,skewX:Gh,skewY:Gh,distance:Kh,translateX:Kh,translateY:Kh,translateZ:Kh,x:Kh,y:Kh,z:Kh,perspective:Kh,transformPerspective:Kh,opacity:jh,originX:qh,originY:qh,originZ:Kh},Xh={...Uh,transform:Math.round},Zh={...Yh,...$h,zIndex:Xh,size:Kh,fillOpacity:jh,strokeOpacity:jh,numOctaves:Xh},Jh={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ef=xh.length;function tf(e,t,i){const{style:n,vars:s,transformOrigin:r}=e;let a=!1,o=!1;for(const l in t){const e=t[l];if(Dh.has(l))a=!0;else if(Mh(l))s[l]=e;else{const t=_h(e,Zh[l]);l.startsWith("origin")?(o=!0,r[l]=t):n[l]=t}}if(t.transform||(a||i?n.transform=function(e,t,i){let n="",s=!0;for(let r=0;r<ef;r++){const a=xh[r],o=e[a];if(void 0===o)continue;let l=!0;if(l="number"==typeof o?o===(a.startsWith("scale")?1:0):0===parseFloat(o),!l||i){const e=_h(o,Zh[a]);l||(s=!1,n+=`${Jh[a]||a}(${e}) `),i&&(t[a]=e)}}return n=n.trim(),i?n=i(t,s?"":n):s&&(n="none"),n}(t,e.transform,i):n.transform&&(n.transform="none")),o){const{originX:e="50%",originY:t="50%",originZ:i=0}=r;n.transformOrigin=`${e} ${t} ${i}`}}const nf={offset:"stroke-dashoffset",array:"stroke-dasharray"},sf={offset:"strokeDashoffset",array:"strokeDasharray"};function rf(e,t,i){return"string"==typeof e?e:Kh.transform(t+i*e)}function af(e,{attrX:t,attrY:i,attrScale:n,originX:s,originY:r,pathLength:a,pathSpacing:o=1,pathOffset:l=0,...u},c,d){if(tf(e,u,d),c)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:h,style:f,dimensions:g}=e;h.transform&&(g&&(f.transform=h.transform),delete h.transform),g&&(void 0!==s||void 0!==r||f.transform)&&(f.transformOrigin=function(e,t,i){return`${rf(t,e.x,e.width)} ${rf(i,e.y,e.height)}`}(g,void 0!==s?s:.5,void 0!==r?r:.5)),void 0!==t&&(h.x=t),void 0!==i&&(h.y=i),void 0!==n&&(h.scale=n),void 0!==a&&function(e,t,i=1,n=0,s=!0){e.pathLength=1;const r=s?nf:sf;e[r.offset]=Kh.transform(-n);const a=Kh.transform(t),o=Kh.transform(i);e[r.array]=`${a} ${o}`}(h,a,o,l,!1)}const of=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),lf=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}}),uf=e=>"string"==typeof e&&"svg"===e.toLowerCase();function cf(e,{style:t,vars:i},n,s){Object.assign(e.style,t,s&&s.getProjectionStyles(n));for(const r in i)e.style.setProperty(r,i[r])}const df=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function hf(e,t,i,n){cf(e,t,void 0,n);for(const s in t.attrs)e.setAttribute(df.has(s)?s:hh(s),t.attrs[s])}const ff={};function gf(e,{layout:t,layoutId:i}){return Dh.has(e)||e.startsWith("origin")||(t||void 0!==i)&&(!!ff[e]||"opacity"===e)}function mf(e,t,i){var n;const{style:s}=e,r={};for(const a in s)(Ih(s[a])||t.style&&Ih(t.style[a])||gf(a,e)||void 0!==(null===(n=null==i?void 0:i.getValue(a))||void 0===n?void 0:n.liveStyle))&&(r[a]=s[a]);return r}function pf(e,t,i){const n=mf(e,t,i);for(const s in e)if(Ih(e[s])||Ih(t[s])){n[-1!==xh.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=e[s]}return n}const vf=["x","y","width","height","cx","cy","r"],yf={useVisualState:Ch({scrapeMotionValuesFromProps:pf,createRenderState:lf,onUpdate:({props:e,prevProps:t,current:i,renderState:n,latestValues:s})=>{if(!i)return;let r=!!e.drag;if(!r)for(const o in s)if(Dh.has(o)){r=!0;break}if(!r)return;let a=!t;if(t)for(let o=0;o<vf.length;o++){const i=vf[o];e[i]!==t[i]&&(a=!0)}a&&Vd.read(()=>{!function(e,t){try{t.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(i){t.dimensions={x:0,y:0,width:0,height:0}}}(i,n),Vd.render(()=>{af(n,s,uf(i.tagName),e.transformTemplate),hf(i,n)})})}})},Af={useVisualState:Ch({scrapeMotionValuesFromProps:mf,createRenderState:of})};function Ef(e,t,i){for(const n in t)Ih(t[n])||gf(n,i)||(e[n]=t[n])}function bf(e,t){const i={};return Ef(i,e.style||{},e),Object.assign(i,function({transformTemplate:e},t){return he.useMemo(()=>{const i={style:{},transform:{},transformOrigin:{},vars:{}};return tf(i,t,e),Object.assign({},i.vars,i.style)},[t])}(e,t)),i}function Sf(e,t){const i={},n=bf(e,t);return e.drag&&!1!==e.dragListener&&(i.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=n,i}function Tf(e,t,i,n){const s=he.useMemo(()=>{const i={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return af(i,t,uf(n),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const t={};Ef(t,e.style,e),s.style={...t,...s.style}}return s}function kf(e=!1){return(t,i,n,{latestValues:s},r)=>{const a=(bh(t)?Tf:Sf)(i,s,r,t),o=function(e,t,i){const n={};for(const s in e)"values"===s&&"object"==typeof e.values||(Xd(s)||!0===i&&$d(s)||!t&&!$d(s)||e.draggable&&s.startsWith("onDrag"))&&(n[s]=e[s]);return n}(i,"string"==typeof t,e),l=t!==he.Fragment?{...o,...a,ref:n}:{},{children:u}=i,c=he.useMemo(()=>Ih(u)?u.get():u,[u]);return he.createElement(t,{...l,children:c})}}function wf(e,t){return function(i,{forwardMotionProps:n}={forwardMotionProps:!1}){return yh({...bh(i)?yf:Af,preloadedFeatures:e,useRender:kf(n),createVisualElement:t,Component:i})}}function If(e,t){if(!Array.isArray(t))return!1;const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Lf(e,t,i){const n=e.getProps();return Th(n,t,void 0!==i?i:n.custom,e)}function Cf(e,t){return e?e[t]||e.default||e:void 0}const Rf=new Set(["width","height","top","left","right","bottom",...xh]);let xf;function Df(){xf=void 0}const Pf={now:()=>(void 0===xf&&Pf.set(Qd.isProcessing||Ud?Qd.timestamp:performance.now()),xf),set:e=>{xf=e,queueMicrotask(Df)}};function Mf(e,t){-1===e.indexOf(t)&&e.push(t)}function Of(e,t){const i=e.indexOf(t);i>-1&&e.splice(i,1)}class Bf{constructor(){this.subscriptions=[]}add(e){return Mf(this.subscriptions,e),()=>Of(this.subscriptions,e)}notify(e,t,i){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,i);else for(let s=0;s<n;s++){const n=this.subscriptions[s];n&&n(e,t,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Ff(e,t){return t?e*(1e3/t):0}const _f={current:void 0};class Nf{constructor(e,t={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(e,t=!0)=>{const i=Pf.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){var t;this.current=e,this.updatedAt=Pf.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(t=this.current,!isNaN(parseFloat(t))))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Bf);const i=this.events[e].add(t);return"change"===e?()=>{i(),Vd.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){t&&this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e,t)}setWithVelocity(e,t,i){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return _f.current&&_f.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=Pf.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Ff(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Uf(e,t){return new Nf(e,t)}function jf(e,t,i){e.hasValue(t)?e.getValue(t).set(i):e.addValue(t,Uf(i))}function Hf(e,t){const i=Lf(e,t);let{transitionEnd:n={},transition:s={},...r}=i||{};r={...r,...n};for(const a in r){jf(e,a,wh(r[a]))}}function Vf(e,t){const i=e.getValue("willChange");if(n=i,Boolean(Ih(n)&&n.add))return i.add(t);var n}function Gf(e){return e.props[fh]}function Qf(e){let t;return()=>(void 0===t&&(t=e()),t)}const Kf=Qf(()=>void 0!==window.ScrollTimeline);class zf{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let i=0;i<this.animations.length;i++)this.animations[i][e]=t}attachTimeline(e,t){const i=this.animations.map(i=>Kf()&&i.attachTimeline?i.attachTimeline(e):"function"==typeof t?t(i):void 0);return()=>{i.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Wf extends zf{then(e,t){return Promise.all(this.animations).then(e).catch(t)}}const qf=e=>1e3*e,Yf=e=>e/1e3;function $f(e){return"function"==typeof e}function Xf(e,t){e.timeline=t,e.onfinish=null}const Zf=e=>Array.isArray(e)&&"number"==typeof e[0],Jf={linearEasing:void 0};function eg(e,t){const i=Qf(e);return()=>{var e;return null!==(e=Jf[t])&&void 0!==e?e:i()}}const tg=eg(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),ig=(e,t,i)=>{const n=t-e;return 0===n?1:(i-e)/n},ng=(e,t,i=10)=>{let n="";const s=Math.max(Math.round(t/i),2);for(let r=0;r<s;r++)n+=e(ig(0,s-1,r))+", ";return`linear(${n.substring(0,n.length-2)})`};function sg(e){return Boolean("function"==typeof e&&tg()||!e||"string"==typeof e&&(e in ag||tg())||Zf(e)||Array.isArray(e)&&e.every(sg))}const rg=([e,t,i,n])=>`cubic-bezier(${e}, ${t}, ${i}, ${n})`,ag={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:rg([0,.65,.55,1]),circOut:rg([.55,0,1,.45]),backIn:rg([.31,.01,.66,-.59]),backOut:rg([.33,1.53,.69,.99])};function og(e,t){return e?"function"==typeof e&&tg()?ng(e,t):Zf(e)?rg(e):Array.isArray(e)?e.map(e=>og(e,t)||ag.easeOut):ag[e]:void 0}const lg=(e,t,i)=>(((1-3*i+3*t)*e+(3*i-6*t))*e+3*t)*e;function ug(e,t,i,n){if(e===t&&i===n)return _d;const s=t=>function(e,t,i,n,s){let r,a,o=0;do{a=t+(i-t)/2,r=lg(a,n,s)-e,r>0?i=a:t=a}while(Math.abs(r)>1e-7&&++o<12);return a}(t,0,1,e,i);return e=>0===e||1===e?e:lg(s(e),t,n)}const cg=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,dg=e=>t=>1-e(1-t),hg=ug(.33,1.53,.69,.99),fg=dg(hg),gg=cg(fg),mg=e=>(e*=2)<1?.5*fg(e):.5*(2-Math.pow(2,-10*(e-1))),pg=e=>1-Math.sin(Math.acos(e)),vg=dg(pg),yg=cg(pg),Ag=e=>/^0[^.\s]+$/u.test(e);function Eg(e){return"number"==typeof e?0===e:null===e||("none"===e||"0"===e||Ag(e))}const bg=e=>Math.round(1e5*e)/1e5,Sg=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Tg=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,kg=(e,t)=>i=>Boolean("string"==typeof i&&Tg.test(i)&&i.startsWith(e)||t&&!function(e){return null==e}(i)&&Object.prototype.hasOwnProperty.call(i,t)),wg=(e,t,i)=>n=>{if("string"!=typeof n)return n;const[s,r,a,o]=n.match(Sg);return{[e]:parseFloat(s),[t]:parseFloat(r),[i]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},Ig={...Uh,transform:e=>Math.round((e=>Nh(0,255,e))(e))},Lg={test:kg("rgb","red"),parse:wg("red","green","blue"),transform:({red:e,green:t,blue:i,alpha:n=1})=>"rgba("+Ig.transform(e)+", "+Ig.transform(t)+", "+Ig.transform(i)+", "+bg(jh.transform(n))+")"};const Cg={test:kg("#"),parse:function(e){let t="",i="",n="",s="";return e.length>5?(t=e.substring(1,3),i=e.substring(3,5),n=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),i=e.substring(2,3),n=e.substring(3,4),s=e.substring(4,5),t+=t,i+=i,n+=n,s+=s),{red:parseInt(t,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:s?parseInt(s,16)/255:1}},transform:Lg.transform},Rg={test:kg("hsl","hue"),parse:wg("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:i,alpha:n=1})=>"hsla("+Math.round(e)+", "+Qh.transform(bg(t))+", "+Qh.transform(bg(i))+", "+bg(jh.transform(n))+")"},xg={test:e=>Lg.test(e)||Cg.test(e)||Rg.test(e),parse:e=>Lg.test(e)?Lg.parse(e):Rg.test(e)?Rg.parse(e):Cg.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?Lg.transform(e):Rg.transform(e)},Dg=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Pg="number",Mg="color",Og=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Bg(e){const t=e.toString(),i=[],n={color:[],number:[],var:[]},s=[];let r=0;const a=t.replace(Og,e=>(xg.test(e)?(n.color.push(r),s.push(Mg),i.push(xg.parse(e))):e.startsWith("var(")?(n.var.push(r),s.push("var"),i.push(e)):(n.number.push(r),s.push(Pg),i.push(parseFloat(e))),++r,"${}")).split("${}");return{values:i,split:a,indexes:n,types:s}}function Fg(e){return Bg(e).values}function _g(e){const{split:t,types:i}=Bg(e),n=t.length;return e=>{let s="";for(let r=0;r<n;r++)if(s+=t[r],void 0!==e[r]){const t=i[r];s+=t===Pg?bg(e[r]):t===Mg?xg.transform(e[r]):e[r]}return s}}const Ng=e=>"number"==typeof e?0:e;const Ug={test:function(e){var t,i;return isNaN(e)&&"string"==typeof e&&((null===(t=e.match(Sg))||void 0===t?void 0:t.length)||0)+((null===(i=e.match(Dg))||void 0===i?void 0:i.length)||0)>0},parse:Fg,createTransformer:_g,getAnimatableNone:function(e){const t=Fg(e);return _g(e)(t.map(Ng))}},jg=new Set(["brightness","contrast","saturate","opacity"]);function Hg(e){const[t,i]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[n]=i.match(Sg)||[];if(!n)return e;const s=i.replace(n,"");let r=jg.has(t)?1:0;return n!==i&&(r*=100),t+"("+r+s+")"}const Vg=/\b([a-z-]*)\(.*?\)/gu,Gg={...Ug,getAnimatableNone:e=>{const t=e.match(Vg);return t?t.map(Hg).join(" "):e}},Qg={...Zh,color:xg,backgroundColor:xg,outlineColor:xg,fill:xg,stroke:xg,borderColor:xg,borderTopColor:xg,borderRightColor:xg,borderBottomColor:xg,borderLeftColor:xg,filter:Gg,WebkitFilter:Gg},Kg=e=>Qg[e];function zg(e,t){let i=Kg(e);return i!==Gg&&(i=Ug),i.getAnimatableNone?i.getAnimatableNone(t):void 0}const Wg=new Set(["auto","none","0"]);const qg=e=>e===Uh||e===Kh,Yg=(e,t)=>parseFloat(e.split(", ")[t]),$g=(e,t)=>(i,{transform:n})=>{if("none"===n||!n)return 0;const s=n.match(/^matrix3d\((.+)\)$/u);if(s)return Yg(s[1],t);{const t=n.match(/^matrix\((.+)\)$/u);return t?Yg(t[1],e):0}},Xg=new Set(["x","y","z"]),Zg=xh.filter(e=>!Xg.has(e));const Jg={width:({x:e},{paddingLeft:t="0",paddingRight:i="0"})=>e.max-e.min-parseFloat(t)-parseFloat(i),height:({y:e},{paddingTop:t="0",paddingBottom:i="0"})=>e.max-e.min-parseFloat(t)-parseFloat(i),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:$g(4,13),y:$g(5,14)};Jg.translateX=Jg.x,Jg.translateY=Jg.y;const em=new Set;let tm=!1,im=!1;function nm(){if(im){const e=Array.from(em).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),i=new Map;t.forEach(e=>{const t=function(e){const t=[];return Zg.forEach(i=>{const n=e.getValue(i);void 0!==n&&(t.push([i,n.get()]),n.set(i.startsWith("scale")?1:0))}),t}(e);t.length&&(i.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=i.get(e);t&&t.forEach(([t,i])=>{var n;null===(n=e.getValue(t))||void 0===n||n.set(i)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}im=!1,tm=!1,em.forEach(e=>e.complete()),em.clear()}function sm(){em.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(im=!0)})}class rm{constructor(e,t,i,n,s,r=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=i,this.motionValue=n,this.element=s,this.isAsync=r}scheduleResolve(){this.isScheduled=!0,this.isAsync?(em.add(this),tm||(tm=!0,Vd.read(sm),Vd.resolveKeyframes(nm))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:i,motionValue:n}=this;for(let s=0;s<e.length;s++)if(null===e[s])if(0===s){const s=null==n?void 0:n.get(),r=e[e.length-1];if(void 0!==s)e[0]=s;else if(i&&t){const n=i.readValue(t,r);null!=n&&(e[0]=n)}void 0===e[0]&&(e[0]=r),n&&void 0===s&&n.set(e[0])}else e[s]=e[s-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),em.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,em.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const am=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),om=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function lm(e,t,i=1){const[n,s]=function(e){const t=om.exec(e);if(!t)return[,];const[,i,n,s]=t;return[`--${null!=i?i:n}`,s]}(e);if(!n)return;const r=window.getComputedStyle(t).getPropertyValue(n);if(r){const e=r.trim();return am(e)?parseFloat(e):e}return Bh(s)?lm(s,t,i+1):s}const um=e=>t=>t.test(e),cm=[Uh,Kh,Qh,Gh,Wh,zh,{test:e=>"auto"===e,parse:e=>e}],dm=e=>cm.find(um(e));class hm extends rm{constructor(e,t,i,n,s){super(e,t,i,n,s,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:i}=this;if(!t||!t.current)return;super.readKeyframes();for(let o=0;o<e.length;o++){let i=e[o];if("string"==typeof i&&(i=i.trim(),Bh(i))){const n=lm(i,t.current);void 0!==n&&(e[o]=n),o===e.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!Rf.has(i)||2!==e.length)return;const[n,s]=e,r=dm(n),a=dm(s);if(r!==a)if(qg(r)&&qg(a))for(let o=0;o<e.length;o++){const t=e[o];"string"==typeof t&&(e[o]=parseFloat(t))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,i=[];for(let n=0;n<e.length;n++)Eg(e[n])&&i.push(n);i.length&&function(e,t,i){let n,s=0;for(;s<e.length&&!n;){const t=e[s];"string"==typeof t&&!Wg.has(t)&&Bg(t).values.length&&(n=e[s]),s++}if(n&&i)for(const r of t)e[r]=zg(i,n)}(e,i,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:i}=this;if(!e||!e.current)return;"height"===i&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Jg[i](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const n=t[t.length-1];void 0!==n&&e.getValue(i,n).jump(n,!1)}measureEndState(){var e;const{element:t,name:i,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const s=t.getValue(i);s&&s.jump(this.measuredOrigin,!1);const r=n.length-1,a=n[r];n[r]=Jg[i](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==a&&void 0===this.finalKeyframe&&(this.finalKeyframe=a),(null===(e=this.removedTransforms)||void 0===e?void 0:e.length)&&this.removedTransforms.forEach(([e,i])=>{t.getValue(e).set(i)}),this.resolveNoneKeyframes()}}const fm=(e,t)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!Ug.test(e)&&"0"!==e||e.startsWith("url(")));const gm=e=>null!==e;function mm(e,{repeat:t,repeatType:i="loop"},n){const s=e.filter(gm),r=t&&"loop"!==i&&t%2==1?0:s.length-1;return r&&void 0!==n?n:s[r]}class pm{constructor({autoplay:e=!0,delay:t=0,type:i="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:r="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Pf.now(),this.options={autoplay:e,delay:t,type:i,repeat:n,repeatDelay:s,repeatType:r,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(sm(),nm()),this._resolved}onKeyframesResolved(e,t){this.resolvedAt=Pf.now(),this.hasAttemptedResolve=!0;const{name:i,type:n,velocity:s,delay:r,onComplete:a,onUpdate:o,isGenerator:l}=this.options;if(!l&&!function(e,t,i,n){const s=e[0];if(null===s)return!1;if("display"===t||"visibility"===t)return!0;const r=e[e.length-1],a=fm(s,t),o=fm(r,t);return!(!a||!o)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let i=0;i<e.length;i++)if(e[i]!==t)return!0}(e)||("spring"===i||$f(i))&&n)}(e,i,n,s)){if(!r)return o&&o(mm(e,this.options,t)),a&&a(),void this.resolveFinishedPromise();this.options.duration=0}const u=this.initPlayback(e,t);!1!==u&&(this._resolved={keyframes:e,finalKeyframe:t,...u},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const vm=2e4;function ym(e){let t=0;let i=e.next(t);for(;!i.done&&t<vm;)t+=50,i=e.next(t);return t>=vm?1/0:t}const Am=(e,t,i)=>e+(t-e)*i;function Em(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}function bm(e,t){return i=>i>0?t:e}const Sm=(e,t,i)=>{const n=e*e,s=i*(t*t-n)+n;return s<0?0:Math.sqrt(s)},Tm=[Cg,Lg,Rg];function km(e){const t=(i=e,Tm.find(e=>e.test(i)));var i;if(!Boolean(t))return!1;let n=t.parse(e);return t===Rg&&(n=function({hue:e,saturation:t,lightness:i,alpha:n}){e/=360,i/=100;let s=0,r=0,a=0;if(t/=100){const n=i<.5?i*(1+t):i+t-i*t,o=2*i-n;s=Em(o,n,e+1/3),r=Em(o,n,e),a=Em(o,n,e-1/3)}else s=r=a=i;return{red:Math.round(255*s),green:Math.round(255*r),blue:Math.round(255*a),alpha:n}}(n)),n}const wm=(e,t)=>{const i=km(e),n=km(t);if(!i||!n)return bm(e,t);const s={...i};return e=>(s.red=Sm(i.red,n.red,e),s.green=Sm(i.green,n.green,e),s.blue=Sm(i.blue,n.blue,e),s.alpha=Am(i.alpha,n.alpha,e),Lg.transform(s))},Im=(e,t)=>i=>t(e(i)),Lm=(...e)=>e.reduce(Im),Cm=new Set(["none","hidden"]);function Rm(e,t){return i=>Am(e,t,i)}function xm(e){return"number"==typeof e?Rm:"string"==typeof e?Bh(e)?bm:xg.test(e)?wm:Mm:Array.isArray(e)?Dm:"object"==typeof e?xg.test(e)?wm:Pm:bm}function Dm(e,t){const i=[...e],n=i.length,s=e.map((e,i)=>xm(e)(e,t[i]));return e=>{for(let t=0;t<n;t++)i[t]=s[t](e);return i}}function Pm(e,t){const i={...e,...t},n={};for(const s in i)void 0!==e[s]&&void 0!==t[s]&&(n[s]=xm(e[s])(e[s],t[s]));return e=>{for(const t in n)i[t]=n[t](e);return i}}const Mm=(e,t)=>{const i=Ug.createTransformer(t),n=Bg(e),s=Bg(t);return n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length?Cm.has(e)&&!s.values.length||Cm.has(t)&&!n.values.length?function(e,t){return Cm.has(e)?i=>i<=0?e:t:i=>i>=1?t:e}(e,t):Lm(Dm(function(e,t){var i;const n=[],s={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){const a=t.types[r],o=e.indexes[a][s[a]],l=null!==(i=e.values[o])&&void 0!==i?i:0;n[r]=l,s[a]++}return n}(n,s),s.values),i):bm(e,t)};function Om(e,t,i){if("number"==typeof e&&"number"==typeof t&&"number"==typeof i)return Am(e,t,i);return xm(e)(e,t)}function Bm(e,t,i){const n=Math.max(t-5,0);return Ff(i-e(n),t-n)}const Fm=100,_m=10,Nm=1,Um=0,jm=800,Hm=.3,Vm=.3,Gm={granular:.01,default:2},Qm={granular:.005,default:.5},Km=.01,zm=10,Wm=.05,qm=1,Ym=.001;function $m({duration:e=jm,bounce:t=Hm,velocity:i=Um,mass:n=Nm}){let s,r,a=1-t;a=Nh(Wm,qm,a),e=Nh(Km,zm,Yf(e)),a<1?(s=t=>{const n=t*a,s=n*e,r=n-i,o=Zm(t,a),l=Math.exp(-s);return Ym-r/o*l},r=t=>{const n=t*a*e,r=n*i+i,o=Math.pow(a,2)*Math.pow(t,2)*e,l=Math.exp(-n),u=Zm(Math.pow(t,2),a);return(-s(t)+Ym>0?-1:1)*((r-o)*l)/u}):(s=t=>Math.exp(-t*e)*((t-i)*e+1)-.001,r=t=>Math.exp(-t*e)*(e*e*(i-t)));const o=function(e,t,i){let n=i;for(let s=1;s<Xm;s++)n-=e(n)/t(n);return n}(s,r,5/e);if(e=qf(e),isNaN(o))return{stiffness:Fm,damping:_m,duration:e};{const t=Math.pow(o,2)*n;return{stiffness:t,damping:2*a*Math.sqrt(n*t),duration:e}}}const Xm=12;function Zm(e,t){return e*Math.sqrt(1-t*t)}const Jm=["duration","bounce"],ep=["stiffness","damping","mass"];function tp(e,t){return t.some(t=>void 0!==e[t])}function ip(e=Vm,t=Hm){const i="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:s}=i;const r=i.keyframes[0],a=i.keyframes[i.keyframes.length-1],o={done:!1,value:r},{stiffness:l,damping:u,mass:c,duration:d,velocity:h,isResolvedFromDuration:f}=function(e){let t={velocity:Um,stiffness:Fm,damping:_m,mass:Nm,isResolvedFromDuration:!1,...e};if(!tp(e,ep)&&tp(e,Jm))if(e.visualDuration){const i=e.visualDuration,n=2*Math.PI/(1.2*i),s=n*n,r=2*Nh(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:Nm,stiffness:s,damping:r}}else{const i=$m(e);t={...t,...i,mass:Nm},t.isResolvedFromDuration=!0}return t}({...i,velocity:-Yf(i.velocity||0)}),g=h||0,m=u/(2*Math.sqrt(l*c)),p=a-r,v=Yf(Math.sqrt(l/c)),y=Math.abs(p)<5;let A;if(n||(n=y?Gm.granular:Gm.default),s||(s=y?Qm.granular:Qm.default),m<1){const e=Zm(v,m);A=t=>{const i=Math.exp(-m*v*t);return a-i*((g+m*v*p)/e*Math.sin(e*t)+p*Math.cos(e*t))}}else if(1===m)A=e=>a-Math.exp(-v*e)*(p+(g+v*p)*e);else{const e=v*Math.sqrt(m*m-1);A=t=>{const i=Math.exp(-m*v*t),n=Math.min(e*t,300);return a-i*((g+m*v*p)*Math.sinh(n)+e*p*Math.cosh(n))/e}}const E={calculatedDuration:f&&d||null,next:e=>{const t=A(e);if(f)o.done=e>=d;else{let i=0;m<1&&(i=0===e?qf(g):Bm(A,e,t));const r=Math.abs(i)<=n,l=Math.abs(a-t)<=s;o.done=r&&l}return o.value=o.done?a:t,o},toString:()=>{const e=Math.min(ym(E),vm),t=ng(t=>E.next(e*t).value,e,30);return e+"ms "+t}};return E}function np({keyframes:e,velocity:t=0,power:i=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],h={done:!1,value:d},f=e=>void 0===o?l:void 0===l||Math.abs(o-e)<Math.abs(l-e)?o:l;let g=i*t;const m=d+g,p=void 0===a?m:a(m);p!==m&&(g=p-d);const v=e=>-g*Math.exp(-e/n),y=e=>p+v(e),A=e=>{const t=v(e),i=y(e);h.done=Math.abs(t)<=u,h.value=h.done?p:i};let E,b;const S=e=>{var t;(t=h.value,void 0!==o&&t<o||void 0!==l&&t>l)&&(E=e,b=ip({keyframes:[h.value,f(h.value)],velocity:Bm(y,e,h.value),damping:s,stiffness:r,restDelta:u,restSpeed:c}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return b||void 0!==E||(t=!0,A(e),S(e)),void 0!==E&&e>=E?b.next(e-E):(!t&&A(e),h)}}}const sp=ug(.42,0,1,1),rp=ug(0,0,.58,1),ap=ug(.42,0,.58,1),op=e=>Array.isArray(e)&&"number"!=typeof e[0],lp={linear:_d,easeIn:sp,easeInOut:ap,easeOut:rp,circIn:pg,circInOut:yg,circOut:vg,backIn:fg,backInOut:gg,backOut:hg,anticipate:mg},up=e=>{if(Zf(e)){Nd(4===e.length);const[t,i,n,s]=e;return ug(t,i,n,s)}return"string"==typeof e?lp[e]:e};function cp(e,t,{clamp:i=!0,ease:n,mixer:s}={}){const r=e.length;if(Nd(r===t.length),1===r)return()=>t[0];if(2===r&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=function(e,t,i){const n=[],s=i||Om,r=e.length-1;for(let a=0;a<r;a++){let i=s(e[a],e[a+1]);if(t){const e=Array.isArray(t)?t[a]||_d:t;i=Lm(e,i)}n.push(i)}return n}(t,n,s),l=o.length,u=i=>{if(a&&i<e[0])return t[0];let n=0;if(l>1)for(;n<e.length-2&&!(i<e[n+1]);n++);const s=ig(e[n],e[n+1],i);return o[n](s)};return i?t=>u(Nh(e[0],e[r-1],t)):u}function dp(e,t){const i=e[e.length-1];for(let n=1;n<=t;n++){const s=ig(0,t,n);e.push(Am(i,1,s))}}function hp(e){const t=[0];return dp(t,e.length-1),t}function fp({duration:e=300,keyframes:t,times:i,ease:n="easeInOut"}){const s=op(n)?n.map(up):up(n),r={done:!1,value:t[0]},a=function(e,t){return e.map(e=>e*t)}(i&&i.length===t.length?i:hp(t),e),o=cp(a,t,{ease:Array.isArray(s)?s:(l=t,u=s,l.map(()=>u||ap).splice(0,l.length-1))});var l,u;return{calculatedDuration:e,next:t=>(r.value=o(t),r.done=t>=e,r)}}const gp=e=>{const t=({timestamp:t})=>e(t);return{start:()=>Vd.update(t,!0),stop:()=>Gd(t),now:()=>Qd.isProcessing?Qd.timestamp:Pf.now()}},mp={decay:np,inertia:np,tween:fp,keyframes:fp,spring:ip},pp=e=>e/100;class vp extends pm{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:e}=this.options;e&&e()};const{name:t,motionValue:i,element:n,keyframes:s}=this.options,r=(null==n?void 0:n.KeyframeResolver)||rm;this.resolver=new r(s,(e,t)=>this.onKeyframesResolved(e,t),t,i,n),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:t="keyframes",repeat:i=0,repeatDelay:n=0,repeatType:s,velocity:r=0}=this.options,a=$f(t)?t:mp[t]||fp;let o,l;a!==fp&&"number"!=typeof e[0]&&(o=Lm(pp,Om(e[0],e[1])),e=[0,100]);const u=a({...this.options,keyframes:e});"mirror"===s&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-r})),null===u.calculatedDuration&&(u.calculatedDuration=ym(u));const{calculatedDuration:c}=u,d=c+n;return{generator:u,mirroredGenerator:l,mapPercentToKeyframes:o,calculatedDuration:c,resolvedDuration:d,totalDuration:d*(i+1)-n}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&e?this.state=this.pendingPlayState:this.pause()}tick(e,t=!1){const{resolved:i}=this;if(!i){const{keyframes:e}=this.options;return{done:!0,value:e[e.length-1]}}const{finalKeyframe:n,generator:s,mirroredGenerator:r,mapPercentToKeyframes:a,keyframes:o,calculatedDuration:l,totalDuration:u,resolvedDuration:c}=i;if(null===this.startTime)return s.next(0);const{delay:d,repeat:h,repeatType:f,repeatDelay:g,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-u/this.speed,this.startTime)),t?this.currentTime=e:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const p=this.currentTime-d*(this.speed>=0?1:-1),v=this.speed>=0?p<0:p>u;this.currentTime=Math.max(p,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let y=this.currentTime,A=s;if(h){const e=Math.min(this.currentTime,u)/c;let t=Math.floor(e),i=e%1;!i&&e>=1&&(i=1),1===i&&t--,t=Math.min(t,h+1);Boolean(t%2)&&("reverse"===f?(i=1-i,g&&(i-=g/c)):"mirror"===f&&(A=r)),y=Nh(0,1,i)*c}const E=v?{done:!1,value:o[0]}:A.next(y);a&&(E.value=a(E.value));let{done:b}=E;v||null===l||(b=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&b);return S&&void 0!==n&&(E.value=mm(o,this.options,n)),m&&m(E.value),S&&this.finish(),E}get duration(){const{resolved:e}=this;return e?Yf(e.calculatedDuration):0}get time(){return Yf(this.currentTime)}set time(e){e=qf(e),this.currentTime=e,null!==this.holdTime||0===this.speed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Yf(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:e=gp,onPlay:t,startTime:i}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),t&&t();const n=this.driver.now();null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=n):this.startTime=null!=i?i:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;this._resolved?(this.state="paused",this.holdTime=null!==(e=this.currentTime)&&void 0!==e?e:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const yp=new Set(["opacity","clipPath","filter","transform"]);function Ap(e,t,i,{delay:n=0,duration:s=300,repeat:r=0,repeatType:a="loop",ease:o="easeInOut",times:l}={}){const u={[t]:i};l&&(u.offset=l);const c=og(o,s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:n,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===a?"alternate":"normal"})}const Ep=Qf(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));const bp={anticipate:mg,backInOut:gg,circInOut:yg};class Sp extends pm{constructor(e){super(e);const{name:t,motionValue:i,element:n,keyframes:s}=this.options;this.resolver=new hm(s,(e,t)=>this.onKeyframesResolved(e,t),t,i,n),this.resolver.scheduleResolve()}initPlayback(e,t){let{duration:i=300,times:n,ease:s,type:r,motionValue:a,name:o,startTime:l}=this.options;if(!a.owner||!a.owner.current)return!1;var u;if("string"==typeof s&&tg()&&s in bp&&(s=bp[s]),$f((u=this.options).type)||"spring"===u.type||!sg(u.ease)){const{onComplete:t,onUpdate:a,motionValue:o,element:l,...u}=this.options,c=function(e,t){const i=new vp({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:e[0]};const s=[];let r=0;for(;!n.done&&r<2e4;)n=i.sample(r),s.push(n.value),r+=10;return{times:void 0,keyframes:s,duration:r-10,ease:"linear"}}(e,u);1===(e=c.keyframes).length&&(e[1]=e[0]),i=c.duration,n=c.times,s=c.ease,r="keyframes"}const c=Ap(a.owner.current,o,e,{...this.options,duration:i,times:n,ease:s});return c.startTime=null!=l?l:this.calcStartTime(),this.pendingTimeline?(Xf(c,this.pendingTimeline),this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:i}=this.options;a.set(mm(e,this.options,t)),i&&i(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:i,times:n,type:r,ease:s,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:t}=e;return Yf(t)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:t}=e;return Yf(t.currentTime||0)}set time(e){const{resolved:t}=this;if(!t)return;const{animation:i}=t;i.currentTime=qf(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:t}=e;return t.playbackRate}set speed(e){const{resolved:t}=this;if(!t)return;const{animation:i}=t;i.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:t}=e;return t.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:t}=e;return t.startTime}attachTimeline(e){if(this._resolved){const{resolved:t}=this;if(!t)return _d;const{animation:i}=t;Xf(i,e)}else this.pendingTimeline=e;return _d}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:t}=e;"finished"===t.playState&&this.updateFinishedPromise(),t.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:t,keyframes:i,duration:n,type:s,ease:r,times:a}=e;if("idle"===t.playState||"finished"===t.playState)return;if(this.time){const{motionValue:e,onUpdate:t,onComplete:o,element:l,...u}=this.options,c=new vp({...u,keyframes:i,duration:n,type:s,ease:r,times:a,isGenerator:!0}),d=qf(this.time);e.setWithVelocity(c.sample(d-10).value,c.sample(d).value,10)}const{onStop:o}=this.options;o&&o(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:t,name:i,repeatDelay:n,repeatType:s,damping:r,type:a}=e;if(!(t&&t.owner&&t.owner.current instanceof HTMLElement))return!1;const{onUpdate:o,transformTemplate:l}=t.owner.getProps();return Ep()&&i&&yp.has(i)&&!o&&!l&&!n&&"mirror"!==s&&0!==r&&"inertia"!==a}}const Tp={type:"spring",stiffness:500,damping:25,restSpeed:10},kp={type:"keyframes",duration:.8},wp={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ip=(e,{keyframes:t})=>t.length>2?kp:Dh.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:Tp:wp;const Lp=(e,t,i,n={},s,r)=>a=>{const o=Cf(n,e)||{},l=o.delay||n.delay||0;let{elapsed:u=0}=n;u-=qf(l);let c={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:r?void 0:s};(function({when:e,delay:t,delayChildren:i,staggerChildren:n,staggerDirection:s,repeat:r,repeatType:a,repeatDelay:o,from:l,elapsed:u,...c}){return!!Object.keys(c).length})(o)||(c={...c,...Ip(e,c)}),c.duration&&(c.duration=qf(c.duration)),c.repeatDelay&&(c.repeatDelay=qf(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(c.duration=0,0===c.delay&&(d=!0)),d&&!r&&void 0!==t.get()){const e=mm(c.keyframes,o);if(void 0!==e)return Vd.update(()=>{c.onUpdate(e),c.onComplete()}),new Wf([])}return!r&&Sp.supports(c)?new Sp(c):new vp(c)};function Cp({protectedKeys:e,needsAnimating:t},i){const n=e.hasOwnProperty(i)&&!0!==t[i];return t[i]=!1,n}function Rp(e,t,{delay:i=0,transitionOverride:n,type:s}={}){var r;let{transition:a=e.getDefaultTransition(),transitionEnd:o,...l}=t;n&&(a=n);const u=[],c=s&&e.animationState&&e.animationState.getState()[s];for(const d in l){const t=e.getValue(d,null!==(r=e.latestValues[d])&&void 0!==r?r:null),n=l[d];if(void 0===n||c&&Cp(c,d))continue;const s={delay:i,...Cf(a||{},d)};let o=!1;if(window.MotionHandoffAnimation){const t=Gf(e);if(t){const e=window.MotionHandoffAnimation(t,d,Vd);null!==e&&(s.startTime=e,o=!0)}}Vf(e,d),t.start(Lp(d,t,n,e.shouldReduceMotion&&Rf.has(d)?{type:!1}:s,e,o));const h=t.animation;h&&u.push(h)}return o&&Promise.all(u).then(()=>{Vd.update(()=>{o&&Hf(e,o)})}),u}function xp(e,t,i={}){var n;const s=Lf(e,t,"exit"===i.type?null===(n=e.presenceContext)||void 0===n?void 0:n.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};i.transitionOverride&&(r=i.transitionOverride);const a=s?()=>Promise.all(Rp(e,s,i)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(n=0)=>{const{delayChildren:s=0,staggerChildren:a,staggerDirection:o}=r;return function(e,t,i=0,n=0,s=1,r){const a=[],o=(e.variantChildren.size-1)*n,l=1===s?(e=0)=>e*n:(e=0)=>o-e*n;return Array.from(e.variantChildren).sort(Dp).forEach((e,n)=>{e.notify("AnimationStart",t),a.push(xp(e,t,{...r,delay:i+l(n)}).then(()=>e.notify("AnimationComplete",t)))}),Promise.all(a)}(e,t,s+n,a,o,i)}:()=>Promise.resolve(),{when:l}=r;if(l){const[e,t]="beforeChildren"===l?[a,o]:[o,a];return e().then(()=>t())}return Promise.all([a(),o(i.delay)])}function Dp(e,t){return e.sortNodePosition(t)}function Pp(e,t,i={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t)){const s=t.map(t=>xp(e,t,i));n=Promise.all(s)}else if("string"==typeof t)n=xp(e,t,i);else{const s="function"==typeof t?Lf(e,t,i.custom):t;n=Promise.all(Rp(e,s,i))}return n.then(()=>{e.notify("AnimationComplete",t)})}const Mp=sh.length;function Op(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&Op(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let i=0;i<Mp;i++){const n=sh[i],s=e.props[n];(th(s)||!1===s)&&(t[n]=s)}return t}const Bp=[...nh].reverse(),Fp=nh.length;function _p(e){let t=function(e){return t=>Promise.all(t.map(({animation:t,options:i})=>Pp(e,t,i)))}(e),i=jp(),n=!0;const s=t=>(i,n)=>{var s;const r=Lf(e,n,"exit"===t?null===(s=e.presenceContext)||void 0===s?void 0:s.custom:void 0);if(r){const{transition:e,transitionEnd:t,...n}=r;i={...i,...n,...t}}return i};function r(r){const{props:a}=e,o=Op(e.parent)||{},l=[],u=new Set;let c={},d=1/0;for(let t=0;t<Fp;t++){const h=Bp[t],f=i[h],g=void 0!==a[h]?a[h]:o[h],m=th(g),p=h===r?f.isActive:null;!1===p&&(d=t);let v=g===o[h]&&g!==a[h]&&m;if(v&&n&&e.manuallyAnimateOnMount&&(v=!1),f.protectedKeys={...c},!f.isActive&&null===p||!g&&!f.prevProp||ih(g)||"boolean"==typeof g)continue;const y=Np(f.prevProp,g);let A=y||h===r&&f.isActive&&!v&&m||t>d&&m,E=!1;const b=Array.isArray(g)?g:[g];let S=b.reduce(s(h),{});!1===p&&(S={});const{prevResolvedValues:T={}}=f,k={...T,...S},w=t=>{A=!0,u.has(t)&&(E=!0,u.delete(t)),f.needsAnimating[t]=!0;const i=e.getValue(t);i&&(i.liveStyle=!1)};for(const e in k){const t=S[e],i=T[e];if(c.hasOwnProperty(e))continue;let n=!1;n=kh(t)&&kh(i)?!If(t,i):t!==i,n?null!=t?w(e):u.add(e):void 0!==t&&u.has(e)?w(e):f.protectedKeys[e]=!0}f.prevProp=g,f.prevResolvedValues=S,f.isActive&&(c={...c,...S}),n&&e.blockInitialAnimation&&(A=!1);A&&(!(v&&y)||E)&&l.push(...b.map(e=>({animation:e,options:{type:h}})))}if(u.size){const t={};u.forEach(i=>{const n=e.getBaseTarget(i),s=e.getValue(i);s&&(s.liveStyle=!0),t[i]=null!=n?n:null}),l.push({animation:t})}let h=Boolean(l.length);return!n||!1!==a.initial&&a.initial!==a.animate||e.manuallyAnimateOnMount||(h=!1),n=!1,h?t(l):Promise.resolve()}return{animateChanges:r,setActive:function(t,n){var s;if(i[t].isActive===n)return Promise.resolve();null===(s=e.variantChildren)||void 0===s||s.forEach(e=>{var i;return null===(i=e.animationState)||void 0===i?void 0:i.setActive(t,n)}),i[t].isActive=n;const a=r(t);for(const e in i)i[e].protectedKeys={};return a},setAnimateFunction:function(i){t=i(e)},getState:()=>i,reset:()=>{i=jp(),n=!0}}}function Np(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!If(t,e)}function Up(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function jp(){return{animate:Up(!0),whileInView:Up(),whileHover:Up(),whileTap:Up(),whileDrag:Up(),whileFocus:Up(),exit:Up()}}class Hp{constructor(e){this.isMounted=!1,this.node=e}update(){}}let Vp=0;const Gp={animation:{Feature:class extends Hp{constructor(e){super(e),e.animationState||(e.animationState=_p(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ih(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),null===(e=this.unmountControls)||void 0===e||e.call(this)}}},exit:{Feature:class extends Hp{constructor(){super(...arguments),this.id=Vp++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const n=this.node.animationState.setActive("exit",!e);t&&!e&&n.then(()=>t(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}}},Qp={x:!1,y:!1};function Kp(){return Qp.x||Qp.y}const zp=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function Wp(e,t,i,n={passive:!0}){return e.addEventListener(t,i,n),()=>e.removeEventListener(t,i)}function qp(e){return{point:{x:e.pageX,y:e.pageY}}}function Yp(e,t,i,n){return Wp(e,t,(e=>t=>zp(t)&&e(t,qp(t)))(i),n)}const $p=(e,t)=>Math.abs(e-t);class Xp{constructor(e,t,{transformPagePoint:i,contextWindow:n,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const e=ev(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,i=function(e,t){const i=$p(e.x,t.x),n=$p(e.y,t.y);return Math.sqrt(i**2+n**2)}(e.offset,{x:0,y:0})>=3;if(!t&&!i)return;const{point:n}=e,{timestamp:s}=Qd;this.history.push({...n,timestamp:s});const{onStart:r,onMove:a}=this.handlers;t||(r&&r(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a&&a(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=Zp(t,this.transformPagePoint),Vd.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:i,onSessionEnd:n,resumeAnimation:s}=this.handlers;if(this.dragSnapToOrigin&&s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const r=ev("pointercancel"===e.type?this.lastMoveEventInfo:Zp(t,this.transformPagePoint),this.history);this.startEvent&&i&&i(e,r),n&&n(e,r)},!zp(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=i,this.contextWindow=n||window;const r=Zp(qp(e),this.transformPagePoint),{point:a}=r,{timestamp:o}=Qd;this.history=[{...a,timestamp:o}];const{onSessionStart:l}=t;l&&l(e,ev(r,this.history)),this.removeListeners=Lm(Yp(this.contextWindow,"pointermove",this.handlePointerMove),Yp(this.contextWindow,"pointerup",this.handlePointerUp),Yp(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Gd(this.updatePoint)}}function Zp(e,t){return t?{point:t(e.point)}:e}function Jp(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ev({point:e},t){return{point:e,delta:Jp(e,iv(t)),offset:Jp(e,tv(t)),velocity:nv(t,.1)}}function tv(e){return e[0]}function iv(e){return e[e.length-1]}function nv(e,t){if(e.length<2)return{x:0,y:0};let i=e.length-1,n=null;const s=iv(e);for(;i>=0&&(n=e[i],!(s.timestamp-n.timestamp>qf(t)));)i--;if(!n)return{x:0,y:0};const r=Yf(s.timestamp-n.timestamp);if(0===r)return{x:0,y:0};const a={x:(s.x-n.x)/r,y:(s.y-n.y)/r};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function sv(e){return e.max-e.min}function rv(e,t,i,n=.5){e.origin=n,e.originPoint=Am(t.min,t.max,e.origin),e.scale=sv(i)/sv(t),e.translate=Am(i.min,i.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function av(e,t,i,n){rv(e.x,t.x,i.x,n?n.originX:void 0),rv(e.y,t.y,i.y,n?n.originY:void 0)}function ov(e,t,i){e.min=i.min+t.min,e.max=e.min+sv(t)}function lv(e,t,i){e.min=t.min-i.min,e.max=e.min+sv(t)}function uv(e,t,i){lv(e.x,t.x,i.x),lv(e.y,t.y,i.y)}function cv(e,t,i){return{min:void 0!==t?e.min+t:void 0,max:void 0!==i?e.max+i-(e.max-e.min):void 0}}function dv(e,t){let i=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([i,n]=[n,i]),{min:i,max:n}}const hv=.35;function fv(e,t,i){return{min:gv(e,t),max:gv(e,i)}}function gv(e,t){return"number"==typeof e?e:e[t]||0}const mv=()=>({x:{min:0,max:0},y:{min:0,max:0}});function pv(e){return[e("x"),e("y")]}function vv({top:e,left:t,right:i,bottom:n}){return{x:{min:t,max:i},y:{min:e,max:n}}}function yv(e){return void 0===e||1===e}function Av({scale:e,scaleX:t,scaleY:i}){return!yv(e)||!yv(t)||!yv(i)}function Ev(e){return Av(e)||bv(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function bv(e){return Sv(e.x)||Sv(e.y)}function Sv(e){return e&&"0%"!==e}function Tv(e,t,i){return i+t*(e-i)}function kv(e,t,i,n,s){return void 0!==s&&(e=Tv(e,s,n)),Tv(e,i,n)+t}function wv(e,t=0,i=1,n,s){e.min=kv(e.min,t,i,n,s),e.max=kv(e.max,t,i,n,s)}function Iv(e,{x:t,y:i}){wv(e.x,t.translate,t.scale,t.originPoint),wv(e.y,i.translate,i.scale,i.originPoint)}const Lv=.999999999999,Cv=1.0000000000001;function Rv(e,t){e.min=e.min+t,e.max=e.max+t}function xv(e,t,i,n,s=.5){wv(e,t,i,Am(e.min,e.max,s),n)}function Dv(e,t){xv(e.x,t.x,t.scaleX,t.scale,t.originX),xv(e.y,t.y,t.scaleY,t.scale,t.originY)}function Pv(e,t){return vv(function(e,t){if(!t)return e;const i=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:i.y,left:i.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}const Mv=({current:e})=>e?e.ownerDocument.defaultView:null,Ov=new WeakMap;class Bv{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=e}start(e,{snapToCursor:t=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&!1===i.isPresent)return;const{dragSnapToOrigin:n}=this.getProps();this.panSession=new Xp(e,{onSessionStart:e=>{const{dragSnapToOrigin:i}=this.getProps();i?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(qp(e).point)},onStart:(e,t)=>{const{drag:i,dragPropagation:n,onDragStart:s}=this.getProps();if(i&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(r=i)||"y"===r?Qp[r]?null:(Qp[r]=!0,()=>{Qp[r]=!1}):Qp.x||Qp.y?null:(Qp.x=Qp.y=!0,()=>{Qp.x=Qp.y=!1}),!this.openDragLock))return;var r;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),pv(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Qh.test(t)){const{projection:i}=this.visualElement;if(i&&i.layout){const n=i.layout.layoutBox[e];if(n){t=sv(n)*(parseFloat(t)/100)}}}this.originPoint[e]=t}),s&&Vd.postRender(()=>s(e,t)),Vf(this.visualElement,"transform");const{animationState:a}=this.visualElement;a&&a.setActive("whileDrag",!0)},onMove:(e,t)=>{const{dragPropagation:i,dragDirectionLock:n,onDirectionLock:s,onDrag:r}=this.getProps();if(!i&&!this.openDragLock)return;const{offset:a}=t;if(n&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let i=null;Math.abs(e.y)>t?i="y":Math.abs(e.x)>t&&(i="x");return i}(a),void(null!==this.currentDirection&&s&&s(this.currentDirection));this.updateAxis("x",t.point,a),this.updateAxis("y",t.point,a),this.visualElement.render(),r&&r(e,t)},onSessionEnd:(e,t)=>this.stop(e,t),resumeAnimation:()=>pv(e=>{var t;return"paused"===this.getAnimationState(e)&&(null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.play())})},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:n,contextWindow:Mv(this.visualElement)})}stop(e,t){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:n}=t;this.startAnimation(n);const{onDragEnd:s}=this.getProps();s&&Vd.postRender(()=>s(e,t))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,i){const{drag:n}=this.getProps();if(!i||!Fv(e,n,this.currentDirection))return;const s=this.getAxisMotionValue(e);let r=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(r=function(e,{min:t,max:i},n){return void 0!==t&&e<t?e=n?Am(t,e,n.min):Math.max(e,t):void 0!==i&&e>i&&(e=n?Am(i,e,n.max):Math.min(e,i)),e}(r,this.constraints[e],this.elastic[e])),s.set(r)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:i}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(e=this.visualElement.projection)||void 0===e?void 0:e.layout,s=this.constraints;t&&ch(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!n)&&function(e,{top:t,left:i,bottom:n,right:s}){return{x:cv(e.x,i,s),y:cv(e.y,t,n)}}(n.layoutBox,t),this.elastic=function(e=hv){return!1===e?e=0:!0===e&&(e=hv),{x:fv(e,"left","right"),y:fv(e,"top","bottom")}}(i),s!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&pv(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const i={};return void 0!==t.min&&(i.min=t.min-e.min),void 0!==t.max&&(i.max=t.max-e.min),i}(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!ch(e))return!1;const i=e.current,{projection:n}=this.visualElement;if(!n||!n.layout)return!1;const s=function(e,t,i){const n=Pv(e,i),{scroll:s}=t;return s&&(Rv(n.x,s.offset.x),Rv(n.y,s.offset.y)),n}(i,n.root,this.visualElement.getTransformPagePoint());let r=function(e,t){return{x:dv(e.x,t.x),y:dv(e.y,t.y)}}(n.layout.layoutBox,s);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(r));this.hasMutatedConstraints=!!e,e&&(r=vv(e))}return r}startAnimation(e){const{drag:t,dragMomentum:i,dragElastic:n,dragTransition:s,dragSnapToOrigin:r,onDragTransitionEnd:a}=this.getProps(),o=this.constraints||{},l=pv(a=>{if(!Fv(a,t,this.currentDirection))return;let l=o&&o[a]||{};r&&(l={min:0,max:0});const u=n?200:1e6,c=n?40:1e7,d={type:"inertia",velocity:i?e[a]:0,bounceStiffness:u,bounceDamping:c,timeConstant:750,restDelta:1,restSpeed:10,...s,...l};return this.startAxisValueAnimation(a,d)});return Promise.all(l).then(a)}startAxisValueAnimation(e,t){const i=this.getAxisMotionValue(e);return Vf(this.visualElement,e),i.start(Lp(e,i,0,t,this.visualElement,!1))}stopAnimation(){pv(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){pv(e=>{var t;return null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.pause()})}getAnimationState(e){var t;return null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),n=i[t];return n||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){pv(t=>{const{drag:i}=this.getProps();if(!Fv(t,i,this.currentDirection))return;const{projection:n}=this.visualElement,s=this.getAxisMotionValue(t);if(n&&n.layout){const{min:i,max:r}=n.layout.layoutBox[t];s.set(e[t]-Am(i,r,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:i}=this.visualElement;if(!ch(t)||!i||!this.constraints)return;this.stopAnimation();const n={x:0,y:0};pv(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const i=t.get();n[e]=function(e,t){let i=.5;const n=sv(e),s=sv(t);return s>n?i=ig(t.min,t.max-n,e.min):n>s&&(i=ig(e.min,e.max-s,t.min)),Nh(0,1,i)}({min:i,max:i},this.constraints[e])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),pv(t=>{if(!Fv(t,e,null))return;const i=this.getAxisMotionValue(t),{min:s,max:r}=this.constraints[t];i.set(Am(s,r,n[t]))})}addListeners(){if(!this.visualElement.current)return;Ov.set(this.visualElement,this);const e=Yp(this.visualElement.current,"pointerdown",e=>{const{drag:t,dragListener:i=!0}=this.getProps();t&&i&&this.start(e)}),t=()=>{const{dragConstraints:e}=this.getProps();ch(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,n=i.addEventListener("measure",t);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Vd.read(t);const s=Wp(window,"resize",()=>this.scalePositionWithinConstraints()),r=i.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(pv(t=>{const i=this.getAxisMotionValue(t);i&&(this.originPoint[t]+=e[t].translate,i.set(i.get()+e[t].translate))}),this.visualElement.render())});return()=>{s(),e(),n(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:i=!1,dragPropagation:n=!1,dragConstraints:s=!1,dragElastic:r=hv,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:i,dragPropagation:n,dragConstraints:s,dragElastic:r,dragMomentum:a}}}function Fv(e,t,i){return!(!0!==t&&t!==e||null!==i&&i!==e)}const _v=e=>(t,i)=>{e&&Vd.postRender(()=>e(t,i))};const Nv={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Uv(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const jv={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!Kh.test(e))return e;e=parseFloat(e)}return`${Uv(e,t.target.x)}% ${Uv(e,t.target.y)}%`}},Hv={correct:(e,{treeScale:t,projectionDelta:i})=>{const n=e,s=Ug.parse(e);if(s.length>5)return n;const r=Ug.createTransformer(e),a="number"!=typeof s[0]?1:0,o=i.x.scale*t.x,l=i.y.scale*t.y;s[0+a]/=o,s[1+a]/=l;const u=Am(o,l,.5);return"number"==typeof s[2+a]&&(s[2+a]/=u),"number"==typeof s[3+a]&&(s[3+a]/=u),r(s)}};class Vv extends he.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:i,layoutId:n}=this.props,{projection:s}=e;var r;r=Qv,Object.assign(ff,r),s&&(t.group&&t.group.add(s),i&&i.register&&n&&i.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Nv.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:i,drag:n,isPresent:s}=this.props,r=i.projection;return r?(r.isPresent=s,n||e.layoutDependency!==t||void 0===t?r.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?r.promote():r.relegate()||Vd.postRender(()=>{const e=r.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),gh.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:i}=this.props,{projection:n}=e;n&&(n.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(n),i&&i.deregister&&i.deregister(n))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Gv(e){const[t,i]=function(e=!0){const t=he.useContext(Md);if(null===t)return[!0,null];const{isPresent:i,onExitComplete:n,register:s}=t,r=he.useId();he.useEffect(()=>{e&&s(r)},[e]);const a=he.useCallback(()=>e&&n&&n(r),[r,n,e]);return!i&&n?[!1,a]:[!0]}(),n=he.useContext(Dd);return xd.jsx(Vv,{...e,layoutGroup:n,switchLayoutGroup:he.useContext(mh),isPresent:t,safeToRemove:i})}const Qv={borderRadius:{...jv,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:jv,borderTopRightRadius:jv,borderBottomLeftRadius:jv,borderBottomRightRadius:jv,boxShadow:Hv};function Kv(e,t,i){const n=Ih(e)?e:Uf(e);return n.start(Lp("",n,t,i)),n.animation}function zv(e){return e instanceof SVGElement&&"svg"!==e.tagName}const Wv=(e,t)=>e.depth-t.depth;class qv{constructor(){this.children=[],this.isDirty=!1}add(e){Mf(this.children,e),this.isDirty=!0}remove(e){Of(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Wv),this.isDirty=!1,this.children.forEach(e)}}const Yv=["TopLeft","TopRight","BottomLeft","BottomRight"],$v=Yv.length,Xv=e=>"string"==typeof e?parseFloat(e):e,Zv=e=>"number"==typeof e||Kh.test(e);function Jv(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const ey=iy(0,.5,vg),ty=iy(.5,.95,_d);function iy(e,t,i){return n=>n<e?0:n>t?1:i(ig(e,t,n))}function ny(e,t){e.min=t.min,e.max=t.max}function sy(e,t){ny(e.x,t.x),ny(e.y,t.y)}function ry(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function ay(e,t,i,n,s){return e=Tv(e-=t,1/i,n),void 0!==s&&(e=Tv(e,1/s,n)),e}function oy(e,t,[i,n,s],r,a){!function(e,t=0,i=1,n=.5,s,r=e,a=e){Qh.test(t)&&(t=parseFloat(t),t=Am(a.min,a.max,t/100)-a.min);if("number"!=typeof t)return;let o=Am(r.min,r.max,n);e===r&&(o-=t),e.min=ay(e.min,t,i,o,s),e.max=ay(e.max,t,i,o,s)}(e,t[i],t[n],t[s],t.scale,r,a)}const ly=["x","scaleX","originX"],uy=["y","scaleY","originY"];function cy(e,t,i,n){oy(e.x,t,ly,i?i.x:void 0,n?n.x:void 0),oy(e.y,t,uy,i?i.y:void 0,n?n.y:void 0)}function dy(e){return 0===e.translate&&1===e.scale}function hy(e){return dy(e.x)&&dy(e.y)}function fy(e,t){return e.min===t.min&&e.max===t.max}function gy(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function my(e,t){return gy(e.x,t.x)&&gy(e.y,t.y)}function py(e){return sv(e.x)/sv(e.y)}function vy(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class yy{constructor(){this.members=[]}add(e){Mf(this.members,e),e.scheduleRender()}remove(e){if(Of(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){const t=this.members.findIndex(t=>e===t);if(0===t)return!1;let i;for(let n=t;n>=0;n--){const e=this.members[n];if(!1!==e.isPresent){i=e;break}}return!!i&&(this.promote(i),!0)}promote(e,t){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,t&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:n}=e.options;!1===n&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:i}=e;t.onExitComplete&&t.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Ay={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Ey="undefined"!=typeof window&&void 0!==window.MotionDebug,by=["","X","Y","Z"],Sy={visibility:"hidden"};let Ty=0;function ky(e,t,i,n){const{latestValues:s}=t;s[e]&&(i[e]=s[e],t.setStaticValue(e,0),n&&(n[e]=0))}function wy(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const i=Gf(t);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:t,layoutId:n}=e.options;window.MotionCancelOptimisedAnimation(i,"transform",Vd,!(t||n))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&wy(n)}function Iy({attachResizeListener:e,defaultParent:t,measureScroll:i,checkIsScrollRoot:n,resetTransform:s}){return class{constructor(e={},i=(null==t?void 0:t())){this.id=Ty++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Ey&&(Ay.totalNodes=Ay.resolvedTargetDeltas=Ay.recalculatedProjection=0),this.nodes.forEach(Ry),this.nodes.forEach(Fy),this.nodes.forEach(_y),this.nodes.forEach(xy),Ey&&window.MotionDebug.record(Ay)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=i?i.root||i:this,this.path=i?[...i.path,i]:[],this.parent=i,this.depth=i?i.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new qv)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Bf),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){const i=this.eventHandlers.get(e);i&&i.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t,i=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=zv(t),this.instance=t;const{layoutId:n,layout:s,visualElement:r}=this.options;if(r&&!r.current&&r.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),i&&(s||n)&&(this.isLayoutDirty=!0),e){let i;const n=()=>this.root.updateBlockedByResize=!1;e(t,()=>{this.root.updateBlockedByResize=!0,i&&i(),i=function(e,t){const i=Pf.now(),n=({timestamp:s})=>{const r=s-i;r>=t&&(Gd(n),e(r-t))};return Vd.read(n,!0),()=>Gd(n)}(n,250),Nv.hasAnimatedSinceResize&&(Nv.hasAnimatedSinceResize=!1,this.nodes.forEach(By))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&r&&(n||s)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeTargetChanged:i,layout:n})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const s=this.options.transition||r.getDefaultTransition()||Gy,{onLayoutAnimationStart:a,onLayoutAnimationComplete:o}=r.getProps(),l=!this.targetLayout||!my(this.targetLayout,n)||i,u=!t&&i;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||u||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,u);const t={...Cf(s,"layout"),onPlay:a,onComplete:o};(r.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t)}else t||By(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Gd(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Ny),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&wy(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let s=0;s<this.path.length;s++){const e=this.path[s];e.shouldResetTransform=!0,e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:t,layout:i}=this.options;if(void 0===t&&!i)return;const n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(Py);this.isUpdating||this.nodes.forEach(My),this.isUpdating=!1,this.nodes.forEach(Oy),this.nodes.forEach(Ly),this.nodes.forEach(Cy),this.clearAllSnapshots();const e=Pf.now();Qd.delta=Nh(0,1e3/60,e-Qd.timestamp),Qd.timestamp=e,Qd.isProcessing=!0,Kd.update.process(Qd),Kd.preRender.process(Qd),Kd.render.process(Qd),Qd.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,gh.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Dy),this.sharedNodes.forEach(Uy)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Vd.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Vd.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let i=0;i<this.path.length;i++){this.path[i].updateScroll()}const e=this.layout;this.layout=this.measure(!1),this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}},this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t){const t=n(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!s)return;const e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!hy(this.projectionDelta),i=this.getTransformTemplate(),n=i?i(this.latestValues,""):void 0,r=n!==this.prevTransformTemplateValue;e&&(t||Ev(this.latestValues)||r)&&(s(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){const t=this.measurePageBox();let i=this.removeElementScroll(t);var n;return e&&(i=this.removeTransform(i)),zy((n=i).x),zy(n.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){var e;const{visualElement:t}=this.options;if(!t)return{x:{min:0,max:0},y:{min:0,max:0}};const i=t.measureViewportBox();if(!((null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)||this.path.some(qy))){const{scroll:e}=this.root;e&&(Rv(i.x,e.offset.x),Rv(i.y,e.offset.y))}return i}removeElementScroll(e){var t;const i={x:{min:0,max:0},y:{min:0,max:0}};if(sy(i,e),null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)return i;for(let n=0;n<this.path.length;n++){const t=this.path[n],{scroll:s,options:r}=t;t!==this.root&&s&&r.layoutScroll&&(s.wasRoot&&sy(i,e),Rv(i.x,s.offset.x),Rv(i.y,s.offset.y))}return i}applyTransform(e,t=!1){const i={x:{min:0,max:0},y:{min:0,max:0}};sy(i,e);for(let n=0;n<this.path.length;n++){const e=this.path[n];!t&&e.options.layoutScroll&&e.scroll&&e!==e.root&&Dv(i,{x:-e.scroll.offset.x,y:-e.scroll.offset.y}),Ev(e.latestValues)&&Dv(i,e.latestValues)}return Ev(this.latestValues)&&Dv(i,this.latestValues),i}removeTransform(e){const t={x:{min:0,max:0},y:{min:0,max:0}};sy(t,e);for(let i=0;i<this.path.length;i++){const e=this.path[i];if(!e.instance)continue;if(!Ev(e.latestValues))continue;Av(e.latestValues)&&e.updateSnapshot();const n=mv();sy(n,e.measurePageBox()),cy(t,e.latestValues,e.snapshot?e.snapshot.layoutBox:void 0,n)}return Ev(this.latestValues)&&cy(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Qd.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){var t;const i=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=i.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=i.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=i.isSharedProjectionDirty);const n=Boolean(this.resumingFrom)||this!==i;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:s,layoutId:r}=this.options;if(this.layout&&(s||r)){if(this.resolvedRelativeTargetAt=Qd.timestamp,!this.targetDelta&&!this.relativeTarget){const e=this.getClosestProjectingParent();e&&e.layout&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},uv(this.relativeTargetOrigin,this.layout.layoutBox,e.layout.layoutBox),sy(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var a,o,l;if(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),a=this.target,o=this.relativeTarget,l=this.relativeParent.target,ov(a.x,o.x,l.x),ov(a.y,o.y,l.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):sy(this.target,this.layout.layoutBox),Iv(this.target,this.targetDelta)):sy(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const e=this.getClosestProjectingParent();e&&Boolean(e.resumingFrom)===Boolean(this.resumingFrom)&&!e.options.layoutScroll&&e.target&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},uv(this.relativeTargetOrigin,this.target,e.target),sy(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Ey&&Ay.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!Av(this.parent.latestValues)&&!bv(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var e;const t=this.getLead(),i=Boolean(this.resumingFrom)||this!==t;let n=!0;if((this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty))&&(n=!1),i&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===Qd.timestamp&&(n=!1),n)return;const{layout:s,layoutId:r}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!s&&!r)return;sy(this.layoutCorrected,this.layout.layoutBox);const a=this.treeScale.x,o=this.treeScale.y;!function(e,t,i,n=!1){const s=i.length;if(!s)return;let r,a;t.x=t.y=1;for(let o=0;o<s;o++){r=i[o],a=r.projectionDelta;const{visualElement:s}=r.options;s&&s.props.style&&"contents"===s.props.style.display||(n&&r.options.layoutScroll&&r.scroll&&r!==r.root&&Dv(e,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,Iv(e,a)),n&&Ev(r.latestValues)&&Dv(e,r.latestValues))}t.x<Cv&&t.x>Lv&&(t.x=1),t.y<Cv&&t.y>Lv&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,i),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:l}=t;l?(this.projectionDelta&&this.prevProjectionDelta?(ry(this.prevProjectionDelta.x,this.projectionDelta.x),ry(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),av(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===a&&this.treeScale.y===o&&vy(this.projectionDelta.x,this.prevProjectionDelta.x)&&vy(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l)),Ey&&Ay.recalculatedProjection++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if(null===(t=this.options.visualElement)||void 0===t||t.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,t=!1){const i=this.snapshot,n=i?i.latestValues:{},s={...this.latestValues},r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const a={x:{min:0,max:0},y:{min:0,max:0}},o=(i?i.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,c=Boolean(o&&!u&&!0===this.options.crossfade&&!this.path.some(Vy));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const i=t/1e3;var l,h,f,g;jy(r.x,e.x,i),jy(r.y,e.y,i),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(uv(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),l=this.relativeTarget,h=this.relativeTargetOrigin,f=a,g=i,Hy(l.x,h.x,f.x,g),Hy(l.y,h.y,f.y,g),d&&function(e,t){return fy(e.x,t.x)&&fy(e.y,t.y)}(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),sy(d,this.relativeTarget)),o&&(this.animationValues=s,function(e,t,i,n,s,r){s?(e.opacity=Am(0,void 0!==i.opacity?i.opacity:1,ey(n)),e.opacityExit=Am(void 0!==t.opacity?t.opacity:1,0,ty(n))):r&&(e.opacity=Am(void 0!==t.opacity?t.opacity:1,void 0!==i.opacity?i.opacity:1,n));for(let a=0;a<$v;a++){const s=`border${Yv[a]}Radius`;let r=Jv(t,s),o=Jv(i,s);void 0===r&&void 0===o||(r||(r=0),o||(o=0),0===r||0===o||Zv(r)===Zv(o)?(e[s]=Math.max(Am(Xv(r),Xv(o),n),0),(Qh.test(o)||Qh.test(r))&&(e[s]+="%")):e[s]=o)}(t.rotate||i.rotate)&&(e.rotate=Am(t.rotate||0,i.rotate||0,n))}(s,n,this.latestValues,i,c,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Gd(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Vd.update(()=>{Nv.hasAnimatedSinceResize=!0,this.currentAnimation=Kv(0,1e3,{...e,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:i,layout:n,latestValues:s}=e;if(t&&i&&n){if(this!==e&&this.layout&&n&&Wy(this.options.animationType,this.layout.layoutBox,n.layoutBox)){i=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=sv(this.layout.layoutBox.x);i.x.min=e.target.x.min,i.x.max=i.x.min+t;const n=sv(this.layout.layoutBox.y);i.y.min=e.target.y.min,i.y.max=i.y.min+n}sy(t,i),Dv(t,s),av(this.projectionDeltaWithTransform,this.layoutCorrected,t,s)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new yy);this.sharedNodes.get(e).add(t);const i=t.options.initialPromotionConfig;t.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){var e;const{layoutId:t}=this.options;return t&&(null===(e=this.getStack())||void 0===e?void 0:e.lead)||this}getPrevLead(){var e;const{layoutId:t}=this.options;return t?null===(e=this.getStack())||void 0===e?void 0:e.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:i}={}){const n=this.getStack();n&&n.promote(this,i),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:i}=e;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(t=!0),!t)return;const n={};i.z&&ky("z",e,n,this.animationValues);for(let s=0;s<by.length;s++)ky(`rotate${by[s]}`,e,n,this.animationValues),ky(`skew${by[s]}`,e,n,this.animationValues);e.render();for(const s in n)e.setStaticValue(s,n[s]),this.animationValues&&(this.animationValues[s]=n[s]);e.scheduleRender()}getProjectionStyles(e){var t,i;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Sy;const n={visibility:""},s=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,n.opacity="",n.pointerEvents=Lh(null==e?void 0:e.pointerEvents)||"",n.transform=s?s(this.latestValues,""):"none",n;const r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){const t={};return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=Lh(null==e?void 0:e.pointerEvents)||""),this.hasProjected&&!Ev(this.latestValues)&&(t.transform=s?s({},""):"none",this.hasProjected=!1),t}const a=r.animationValues||r.latestValues;this.applyTransformsToTarget(),n.transform=function(e,t,i){let n="";const s=e.x.translate/t.x,r=e.y.translate/t.y,a=(null==i?void 0:i.z)||0;if((s||r||a)&&(n=`translate3d(${s}px, ${r}px, ${a}px) `),1===t.x&&1===t.y||(n+=`scale(${1/t.x}, ${1/t.y}) `),i){const{transformPerspective:e,rotate:t,rotateX:s,rotateY:r,skewX:a,skewY:o}=i;e&&(n=`perspective(${e}px) ${n}`),t&&(n+=`rotate(${t}deg) `),s&&(n+=`rotateX(${s}deg) `),r&&(n+=`rotateY(${r}deg) `),a&&(n+=`skewX(${a}deg) `),o&&(n+=`skewY(${o}deg) `)}const o=e.x.scale*t.x,l=e.y.scale*t.y;return 1===o&&1===l||(n+=`scale(${o}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,a),s&&(n.transform=s(a,n.transform));const{x:o,y:l}=this.projectionDelta;n.transformOrigin=`${100*o.origin}% ${100*l.origin}% 0`,r.animationValues?n.opacity=r===this?null!==(i=null!==(t=a.opacity)&&void 0!==t?t:this.latestValues.opacity)&&void 0!==i?i:1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:n.opacity=r===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0;for(const u in ff){if(void 0===a[u])continue;const{correct:e,applyTo:t}=ff[u],i="none"===n.transform?a[u]:e(a[u],r);if(t){const e=t.length;for(let s=0;s<e;s++)n[t[s]]=i}else n[u]=i}return this.options.layoutId&&(n.pointerEvents=r===this?Lh(null==e?void 0:e.pointerEvents)||"":"none"),n}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>{var t;return null===(t=e.currentAnimation)||void 0===t?void 0:t.stop()}),this.root.nodes.forEach(Py),this.root.sharedNodes.clear()}}}function Ly(e){e.updateLayout()}function Cy(e){var t;const i=(null===(t=e.resumeFrom)||void 0===t?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&i&&e.hasListeners("didUpdate")){const{layoutBox:t,measuredBox:n}=e.layout,{animationType:s}=e.options,r=i.source!==e.layout.source;"size"===s?pv(e=>{const n=r?i.measuredBox[e]:i.layoutBox[e],s=sv(n);n.min=t[e].min,n.max=n.min+s}):Wy(s,i.layoutBox,t)&&pv(n=>{const s=r?i.measuredBox[n]:i.layoutBox[n],a=sv(t[n]);s.max=s.min+a,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[n].max=e.relativeTarget[n].min+a)});const a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};av(a,t,i.layoutBox);const o={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};r?av(o,e.applyTransform(n,!0),i.measuredBox):av(o,t,i.layoutBox);const l=!hy(a);let u=!1;if(!e.resumeFrom){const n=e.getClosestProjectingParent();if(n&&!n.resumeFrom){const{snapshot:s,layout:r}=n;if(s&&r){const a={x:{min:0,max:0},y:{min:0,max:0}};uv(a,i.layoutBox,s.layoutBox);const o={x:{min:0,max:0},y:{min:0,max:0}};uv(o,t,r.layoutBox),my(a,o)||(u=!0),n.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=a,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:t,snapshot:i,delta:o,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:u})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Ry(e){Ey&&Ay.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function xy(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Dy(e){e.clearSnapshot()}function Py(e){e.clearMeasurements()}function My(e){e.isLayoutDirty=!1}function Oy(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function By(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Fy(e){e.resolveTargetDelta()}function _y(e){e.calcProjection()}function Ny(e){e.resetSkewAndRotation()}function Uy(e){e.removeLeadSnapshot()}function jy(e,t,i){e.translate=Am(t.translate,0,i),e.scale=Am(t.scale,1,i),e.origin=t.origin,e.originPoint=t.originPoint}function Hy(e,t,i,n){e.min=Am(t.min,i.min,n),e.max=Am(t.max,i.max,n)}function Vy(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const Gy={duration:.45,ease:[.4,0,.1,1]},Qy=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ky=Qy("applewebkit/")&&!Qy("chrome/")?Math.round:_d;function zy(e){e.min=Ky(e.min),e.max=Ky(e.max)}function Wy(e,t,i){return"position"===e||"preserve-aspect"===e&&(n=py(t),s=py(i),r=.2,!(Math.abs(n-s)<=r));var n,s,r}function qy(e){var t;return e!==e.root&&(null===(t=e.scroll)||void 0===t?void 0:t.wasRoot)}const Yy=Iy({attachResizeListener:(e,t)=>Wp(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),$y={current:void 0},Xy=Iy({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!$y.current){const e=new Yy({});e.mount(window),e.setOptions({layoutScroll:!0}),$y.current=e}return $y.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),Zy={pan:{Feature:class extends Hp{constructor(){super(...arguments),this.removePointerDownListener=_d}onPointerDown(e){this.session=new Xp(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Mv(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:i,onPanEnd:n}=this.node.getProps();return{onSessionStart:_v(e),onStart:_v(t),onMove:i,onEnd:(e,t)=>{delete this.session,n&&Vd.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=Yp(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends Hp{constructor(e){super(e),this.removeGroupControls=_d,this.removeListeners=_d,this.controls=new Bv(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||_d}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:Xy,MeasureLayout:Gv}};function Jy(e,t,i){var n;if(e instanceof Element)return[e];if("string"==typeof e){let t=document;const s=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:t.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}function eA(e,t){const i=Jy(e),n=new AbortController;return[i,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function tA(e){return t=>{"touch"===t.pointerType||Kp()||e(t)}}function iA(e,t,i){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===i);const s=n["onHover"+i];s&&Vd.postRender(()=>s(t,qp(t)))}const nA=(e,t)=>!!t&&(e===t||nA(e,t.parentElement)),sA=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const rA=new WeakSet;function aA(e){return t=>{"Enter"===t.key&&e(t)}}function oA(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function lA(e){return zp(e)&&!Kp()}function uA(e,t,i={}){const[n,s,r]=eA(e,i),a=e=>{const n=e.currentTarget;if(!lA(e)||rA.has(n))return;rA.add(n);const r=t(e),a=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),lA(e)&&rA.has(n)&&(rA.delete(n),"function"==typeof r&&r(e,{success:t}))},o=e=>{a(e,i.useGlobalTarget||nA(n,e.target))},l=e=>{a(e,!1)};window.addEventListener("pointerup",o,s),window.addEventListener("pointercancel",l,s)};return n.forEach(e=>{(function(e){return sA.has(e.tagName)||-1!==e.tabIndex})(e)||null!==e.getAttribute("tabindex")||(e.tabIndex=0);(i.useGlobalTarget?window:e).addEventListener("pointerdown",a,s),e.addEventListener("focus",e=>((e,t)=>{const i=e.currentTarget;if(!i)return;const n=aA(()=>{if(rA.has(i))return;oA(i,"down");const e=aA(()=>{oA(i,"up")});i.addEventListener("keyup",e,t),i.addEventListener("blur",()=>oA(i,"cancel"),t)});i.addEventListener("keydown",n,t),i.addEventListener("blur",()=>i.removeEventListener("keydown",n),t)})(e,s),s)}),r}function cA(e,t,i){const{props:n}=e;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap","Start"===i);const s=n["onTap"+("End"===i?"":i)];s&&Vd.postRender(()=>s(t,qp(t)))}const dA=new WeakMap,hA=new WeakMap,fA=e=>{const t=dA.get(e.target);t&&t(e)},gA=e=>{e.forEach(fA)};function mA(e,t,i){const n=function({root:e,...t}){const i=e||document;hA.has(i)||hA.set(i,{});const n=hA.get(i),s=JSON.stringify(t);return n[s]||(n[s]=new IntersectionObserver(gA,{root:e,...t})),n[s]}(t);return dA.set(e,i),n.observe(e),()=>{dA.delete(e),n.unobserve(e)}}const pA={some:0,all:1};const vA={inView:{Feature:class extends Hp{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:i,amount:n="some",once:s}=e,r={root:t?t.current:void 0,rootMargin:i,threshold:"number"==typeof n?n:pA[n]};return mA(this.node.current,r,e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,s&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:i,onViewportLeave:n}=this.node.getProps(),r=t?i:n;r&&r(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return i=>e[i]!==t[i]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Hp{mount(){const{current:e}=this.node;e&&(this.unmount=uA(e,e=>(cA(this.node,e,"Start"),(e,{success:t})=>cA(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends Hp{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Lm(Wp(this.node.current,"focus",()=>this.onFocus()),Wp(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends Hp{mount(){const{current:e}=this.node;e&&(this.unmount=function(e,t,i={}){const[n,s,r]=eA(e,i),a=tA(e=>{const{target:i}=e,n=t(e);if("function"!=typeof n||!i)return;const r=tA(e=>{n(e),i.removeEventListener("pointerleave",r)});i.addEventListener("pointerleave",r,s)});return n.forEach(e=>{e.addEventListener("pointerenter",a,s)}),r}(e,e=>(iA(this.node,e,"Start"),e=>iA(this.node,e,"End"))))}unmount(){}}}},yA={layout:{ProjectionNode:Xy,MeasureLayout:Gv}},AA={current:null},EA={current:!1};const bA=[...cm,xg,Ug],SA=new WeakMap;const TA=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class kA{scrapeMotionValuesFromProps(e,t,i){return{}}constructor({parent:e,props:t,presenceContext:i,reducedMotionConfig:n,blockInitialAnimation:s,visualState:r},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=rm,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=Pf.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Vd.render(this.render,!1,!0))};const{latestValues:o,renderState:l,onUpdate:u}=r;this.onUpdate=u,this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.options=a,this.blockInitialAnimation=Boolean(s),this.isControllingVariants=rh(t),this.isVariantNode=ah(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:c,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(const h in d){const e=d[h];void 0!==o[h]&&Ih(e)&&e.set(o[h],!1)}}mount(e){this.current=e,SA.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),EA.current||function(){if(EA.current=!0,Bd)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>AA.current=e.matches;e.addListener(t),t()}else AA.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||AA.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){SA.delete(this.current),this.projection&&this.projection.unmount(),Gd(this.notifyUpdate),Gd(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=Dh.has(e),n=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&Vd.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),s=t.on("renderRequest",this.scheduleRender);let r;window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{n(),s(),r&&r(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in qd){const t=qd[e];if(!t)continue;const{isEnabled:i,Feature:n}=t;if(!this.features[e]&&n&&i(this.props)&&(this.features[e]=new n(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let i=0;i<TA.length;i++){const t=TA[i];this.propEventSubscriptions[t]&&(this.propEventSubscriptions[t](),delete this.propEventSubscriptions[t]);const n=e["on"+t];n&&(this.propEventSubscriptions[t]=this.on(t,n))}this.prevMotionValues=function(e,t,i){for(const n in t){const s=t[n],r=i[n];if(Ih(s))e.addValue(n,s);else if(Ih(r))e.addValue(n,Uf(s,{owner:e}));else if(r!==s)if(e.hasValue(n)){const t=e.getValue(n);!0===t.liveStyle?t.jump(s):t.hasAnimated||t.set(s)}else{const t=e.getStaticValue(n);e.addValue(n,Uf(void 0!==t?t:s,{owner:e}))}}for(const n in i)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const i=this.values.get(e);t!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return void 0===i&&void 0!==t&&(i=Uf(null===t?void 0:t,{owner:this}),this.addValue(e,i)),i}readValue(e,t){var i;let n=void 0===this.latestValues[e]&&this.current?null!==(i=this.getBaseTargetFromProps(this.props,e))&&void 0!==i?i:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];var s;return null!=n&&("string"==typeof n&&(am(n)||Ag(n))?n=parseFloat(n):(s=n,!bA.find(um(s))&&Ug.test(t)&&(n=zg(e,t))),this.setBaseTarget(e,Ih(n)?n.get():n)),Ih(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:i}=this.props;let n;if("string"==typeof i||"object"==typeof i){const s=Th(this.props,i,null===(t=this.presenceContext)||void 0===t?void 0:t.custom);s&&(n=s[e])}if(i&&void 0!==n)return n;const s=this.getBaseTargetFromProps(this.props,e);return void 0===s||Ih(s)?void 0!==this.initialValues[e]&&void 0===n?void 0:this.baseTarget[e]:s}on(e,t){return this.events[e]||(this.events[e]=new Bf),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class wA extends kA{constructor(){super(...arguments),this.KeyframeResolver=hm}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:i}){delete t[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ih(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}class IA extends wA{constructor(){super(...arguments),this.type="html",this.renderInstance=cf}readValueFromInstance(e,t){if(Dh.has(t)){const e=Kg(t);return e&&e.default||0}{const n=(i=e,window.getComputedStyle(i)),s=(Mh(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof s?s.trim():s}var i}measureInstanceViewportBox(e,{transformPagePoint:t}){return Pv(e,t)}build(e,t,i){tf(e,t,i.transformTemplate)}scrapeMotionValuesFromProps(e,t,i){return mf(e,t,i)}}class LA extends wA{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=mv}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Dh.has(t)){const e=Kg(t);return e&&e.default||0}return t=df.has(t)?t:hh(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,i){return pf(e,t,i)}build(e,t,i){af(e,t,this.isSVGTag,i.transformTemplate)}renderInstance(e,t,i,n){hf(e,t,0,n)}mount(e){this.isSVGTag=uf(e.tagName),super.mount(e)}}const CA=Jd(wf({...Gp,...vA,...Zy,...yA},(e,t)=>bh(e)?new LA(t):new IA(t,{allowProjection:e!==he.Fragment})));function RA(e){const t=Pd(()=>Uf(e)),{isStatic:i}=he.useContext(Od);if(i){const[,i]=he.useState(e);he.useEffect(()=>t.on("change",i),[])}return t}function xA(e,t){const i=RA(t()),n=()=>i.set(t());return n(),Fd(()=>{const t=()=>Vd.preRender(n,!1,!0),i=e.map(e=>e.on("change",t));return()=>{i.forEach(e=>e()),Gd(n)}}),i}function DA(e,t,i,n){if("function"==typeof e)return function(e){_f.current=[],e();const t=xA(_f.current,e);return _f.current=void 0,t}(e);const s="function"==typeof t?t:function(...e){const t=!Array.isArray(e[0]),i=t?0:-1,n=e[0+i],s=e[1+i],r=e[2+i],a=e[3+i],o=cp(s,r,{mixer:(l=r[0],(e=>e&&"object"==typeof e&&e.mix)(l)?l.mix:void 0),...a});var l;return t?o(n):o}(t,i,n);return Array.isArray(e)?PA(e,s):PA([e],([e])=>s(e))}function PA(e,t){const i=Pd(()=>[]);return xA(e,()=>{i.length=0;const n=e.length;for(let t=0;t<n;t++)i[t]=e[t].get();return t(i)})}function MA(e,t){[...t].reverse().forEach(i=>{const n=e.getVariant(i);n&&Hf(e,n),e.variantChildren&&e.variantChildren.forEach(e=>{MA(e,t)})})}function OA(){const e=new Set,t={subscribe:t=>(e.add(t),()=>{e.delete(t)}),start(t,i){const n=[];return e.forEach(e=>{n.push(Pp(e,t,{transitionOverride:i}))}),Promise.all(n)},set:t=>e.forEach(e=>{!function(e,t){Array.isArray(t)?MA(e,t):"string"==typeof t?MA(e,[t]):Hf(e,t)}(e,t)}),stop(){e.forEach(e=>{!function(e){e.values.forEach(e=>e.stop())}(e)})},mount:()=>()=>{t.stop()}};return t}function BA(e,t=100,i){const n=i({...e,keyframes:[0,t]}),s=Math.min(ym(n),vm);return{type:"keyframes",ease:e=>n.next(s*e).value/t,duration:Yf(s)}}function FA(e,t){return op(e)?e[((e,t,i)=>{const n=t-e;return((i-e)%n+n)%n+e})(0,e.length,t)]:e}function _A(e){return"object"==typeof e&&!Array.isArray(e)}function NA(e,t,i,n){return"string"==typeof e&&_A(t)?Jy(e,0,n):e instanceof NodeList?Array.from(e):Array.isArray(e)?e:[e]}function UA(e,t,i){return e*(t+1)}function jA(e,t,i,n){var s;return"number"==typeof t?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):"<"===t?i:null!==(s=n.get(t))&&void 0!==s?s:e}function HA(e,t,i,n,s,r){!function(e,t,i){for(let n=0;n<e.length;n++){const s=e[n];s.at>t&&s.at<i&&(Of(e,s),n--)}}(e,s,r);for(let a=0;a<t.length;a++)e.push({value:t[a],at:Am(s,r,n[a]),easing:FA(i,a)})}function VA(e,t){for(let i=0;i<e.length;i++)e[i]=e[i]/(t+1)}function GA(e,t){return e.at===t.at?null===e.value?1:null===t.value?-1:0:e.at-t.at}function QA(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function KA(e,t){return t[e]||(t[e]=[]),t[e]}function zA(e){return Array.isArray(e)?e:[e]}function WA(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}const qA=e=>"number"==typeof e,YA=e=>e.every(qA);class $A extends kA{constructor(){super(...arguments),this.type="object"}readValueFromInstance(e,t){if(function(e,t){return e in t}(t,e)){const i=e[t];if("string"==typeof i||"number"==typeof i)return i}}getBaseTargetFromProps(){}removeValueFromRenderState(e,t){delete t.output[e]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(e,t){Object.assign(e.output,t)}renderInstance(e,{output:t}){Object.assign(e,t)}sortInstanceNodePosition(){return 0}}function XA(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},i=zv(e)?new LA(t):new IA(t);i.mount(e),SA.set(e,i)}function ZA(e){const t=new $A({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});t.mount(e),SA.set(e,t)}function JA(e,t,i,n){const s=[];if(function(e,t){return Ih(e)||"number"==typeof e||"string"==typeof e&&!_A(t)}(e,t))s.push(Kv(e,_A(t)&&t.default||t,i&&i.default||i));else{const n=NA(e,t),r=n.length;for(let e=0;e<r;e++){const a=n[e],o=a instanceof Element?XA:ZA;SA.has(a)||o(a);const l=SA.get(a),u={...i};"delay"in u&&"function"==typeof u.delay&&(u.delay=u.delay(e,r)),s.push(...Rp(l,{...t,transition:u},{}))}}return s}function eE(e,t,i){const n=[],s=function(e,{defaultTransition:t={},...i}={},n,s){const r=t.duration||.3,a=new Map,o=new Map,l={},u=new Map;let c=0,d=0,h=0;for(let f=0;f<e.length;f++){const i=e[f];if("string"==typeof i){u.set(i,d);continue}if(!Array.isArray(i)){u.set(i.name,jA(d,i.at,c,u));continue}let[n,a,g={}]=i;void 0!==g.at&&(d=jA(d,g.at,c,u));let m=0;const p=(e,i,n,a=0,o=0)=>{const l=zA(e),{delay:u=0,times:c=hp(l),type:f="keyframes",repeat:g,repeatType:p,repeatDelay:v=0,...y}=i;let{ease:A=t.ease||"easeOut",duration:E}=i;const b="function"==typeof u?u(a,o):u,S=l.length,T=$f(f)?f:null==s?void 0:s[f];if(S<=2&&T){let e=100;if(2===S&&YA(l)){const t=l[1]-l[0];e=Math.abs(t)}const t={...y};void 0!==E&&(t.duration=qf(E));const i=BA(t,e,T);A=i.ease,E=i.duration}null!=E||(E=r);const k=d+b;1===c.length&&0===c[0]&&(c[1]=1);const w=c.length-l.length;if(w>0&&dp(c,w),1===l.length&&l.unshift(null),g){E=UA(E,g);const e=[...l],t=[...c];A=Array.isArray(A)?[...A]:[A];const i=[...A];for(let n=0;n<g;n++){l.push(...e);for(let s=0;s<e.length;s++)c.push(t[s]+(n+1)),A.push(0===s?"linear":FA(i,s-1))}VA(c,g)}const I=k+E;HA(n,l,A,c,k,I),m=Math.max(b+E,m),h=Math.max(I,h)};if(Ih(n))p(a,g,KA("default",QA(n,o)));else{const e=NA(n,a,0,l),t=e.length;for(let i=0;i<t;i++){const n=QA(e[i],o);for(const e in a)p(a[e],WA(g,e),KA(e,n),i,t)}}c=d,d+=m}return o.forEach((e,n)=>{for(const s in e){const r=e[s];r.sort(GA);const o=[],l=[],u=[];for(let e=0;e<r.length;e++){const{at:t,value:i,easing:n}=r[e];o.push(i),l.push(ig(0,h,t)),u.push(n||"easeOut")}0!==l[0]&&(l.unshift(0),o.unshift(o[0]),u.unshift("easeInOut")),1!==l[l.length-1]&&(l.push(1),o.push(null)),a.has(n)||a.set(n,{keyframes:{},transition:{}});const c=a.get(n);c.keyframes[s]=o,c.transition[s]={...t,duration:h,ease:u,times:l,...i}}}),a}(e,t,0,{spring:ip});return s.forEach(({keyframes:e,transition:t},i)=>{n.push(...JA(i,e,t))}),n}const tE=function(e,t,i){let n=[];var s;return s=e,n=Array.isArray(s)&&s.some(Array.isArray)?eE(e,t):JA(e,t,i),new Wf(n)};function iE(){const e=Pd(OA);return Fd(e.mount,[]),e}const nE="_card_doqsx_2",sE="_cardContent_doqsx_18",rE="_gradientBottom_doqsx_29",aE="_gradientTop_doqsx_41",oE="_cardName_doqsx_52",lE=({card:e,cardUIConfig:t,className:i="",children:n})=>{const{gradient:s,title:r}=t,a=s.color||"rgba(0, 0, 0, 1)",o=(()=>{if(!s.type)return{showTop:!1,showBottom:!1};const e=s.type.toLowerCase();return{showTop:"top"===e||"top-and-bottom"===e,showBottom:"bottom"===e||"top-and-bottom"===e}})();return xd.jsxs("div",{id:e.id||void 0,className:`${nE} ${i}`.trim(),children:[n,o.showBottom&&xd.jsx("div",{className:rE,style:{background:`linear-gradient(transparent, ${a})`}}),o.showTop&&xd.jsx("div",{className:aE,style:{background:`linear-gradient(${a}, transparent)`}}),r.enabled&&xd.jsx("div",{className:sE,children:xd.jsx("div",{className:oE,style:{fontSize:`${r.textSize}px`,bottom:`${r.positionBottom}%`},children:e.title||""})})]})},uE="_image_trs4h_2",cE=({card:e,onImageReady:t,ready:i=!0,lazyLoad:n=!1,className:s=""})=>{const r=he.useRef(null);return he.useEffect(()=>{if(r.current&&t&&i){const e=()=>{t(r.current)};if(!r.current.complete)return r.current.addEventListener("load",e),()=>{var t;null==(t=r.current)||t.removeEventListener("load",e)};t(r.current)}},[i]),xd.jsx(xd.Fragment,{children:e.imageUrl&&i&&xd.jsx("img",{ref:r,src:e.imageUrl,alt:e.title||"",loading:n?"lazy":"eager",className:`${uE} ${s}`.trim()})})},dE=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],hE=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function fE(e){return`\n <style>\n :host {\n display: inline-flex;\n line-height: 0;\n flex-direction: column;\n justify-content: end;\n }\n\n audio {\n width: 100%;\n }\n </style>\n <slot name="media">\n <audio${pE(e)}></audio>\n </slot>\n <slot></slot>\n `}function gE(e){return`\n <style>\n :host {\n display: inline-block;\n line-height: 0;\n }\n\n video {\n max-width: 100%;\n max-height: 100%;\n min-width: 100%;\n min-height: 100%;\n object-fit: var(--media-object-fit, contain);\n object-position: var(--media-object-position, 50% 50%);\n }\n\n video::-webkit-media-text-track-container {\n transform: var(--media-webkit-text-track-transform);\n transition: var(--media-webkit-text-track-transition);\n }\n </style>\n <slot name="media">\n <video${pE(e)}></video>\n </slot>\n <slot></slot>\n `}function mE(e,{tag:t,is:i}){var n,s,r,a,o,l,u,c,d,h,f,g,m,p,v,y,A,E,b;const S=null==(s=null==(n=globalThis.document)?void 0:n.createElement)?void 0:s.call(n,t,{is:i}),k=S?function(e){const t=[];for(let i=Object.getPrototypeOf(e);i&&i!==HTMLElement.prototype;i=Object.getPrototypeOf(i)){const e=Object.getOwnPropertyNames(i);t.push(...e)}return t}(S):[];return r=class extends e{constructor(){super(...arguments),I(this,g),I(this,u,!1),I(this,c,null),I(this,d,new Map),I(this,h),I(this,f),T(this,"get"),T(this,"set"),T(this,"call")}static get observedAttributes(){var e,t;C(e=r,o,l).call(e);return[...(null==(t=null==S?void 0:S.constructor)?void 0:t.observedAttributes)??[],...hE]}get nativeEl(){var e;return C(this,g,m).call(this),w(this,c)??this.querySelector(":scope > [slot=media]")??this.querySelector(t)??(null==(e=this.shadowRoot)?void 0:e.querySelector(t))??null}set nativeEl(e){L(this,c,e)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(e){this.toggleAttribute("muted",e)}get src(){return this.getAttribute("src")}set src(e){this.setAttribute("src",`${e}`)}get preload(){var e;return this.getAttribute("preload")??(null==(e=this.nativeEl)?void 0:e.preload)}set preload(e){this.setAttribute("preload",`${e}`)}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const e=function(e){const t={};for(const i of e)t[i.name]=i.value;return t}(this.attributes);i&&(e.is=i),t&&(e.part=t),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.nativeEl.muted=this.hasAttribute("muted");for(const e of k)C(this,g,E).call(this,e);C(this,g,p).call(this)}handleEvent(e){e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))}attributeChangedCallback(e,t,i){C(this,g,m).call(this),C(this,g,b).call(this,e,t,i)}connectedCallback(){C(this,g,m).call(this),w(this,f)||C(this,g,p).call(this)}disconnectedCallback(){var e,t,i;null==(e=w(this,h))||e.disconnect(),L(this,h,void 0),w(this,f)&&(null==(t=this.shadowRoot)||t.removeEventListener("slotchange",w(this,f)),L(this,f,void 0));for(const n of this.constructor.Events)null==(i=this.shadowRoot)||i.removeEventListener(n,this,!0);w(this,d).forEach(e=>e.remove()),w(this,d).clear(),L(this,c,null)}},a=new WeakMap,o=new WeakSet,l=function(){if(w(this,a))return;L(this,a,!0);const e=new Set(this.observedAttributes);e.delete("muted");for(const t of k)if(!(t in this.prototype))if("function"==typeof S[t])this.prototype[t]=function(...e){C(this,g,m).call(this);return(()=>{var i;if(this.call)return this.call(t,...e);const n=null==(i=this.nativeEl)?void 0:i[t];return null==n?void 0:n.apply(this.nativeEl,e)})()};else{const i={get(){var i,n;C(this,g,m).call(this);const s=t.toLowerCase();if(e.has(s)){const e=this.getAttribute(s);return null!==e&&(""===e||e)}return(null==(i=this.get)?void 0:i.call(this,t))??(null==(n=this.nativeEl)?void 0:n[t])}};t!==t.toUpperCase()&&(i.set=function(i){C(this,g,m).call(this);const n=t.toLowerCase();e.has(n)?!0===i||!1===i||null==i?this.toggleAttribute(n,Boolean(i)):this.setAttribute(n,i):this.set?this.set(t,i):this.nativeEl&&(this.nativeEl[t]=i)}),Object.defineProperty(this.prototype,t,i)}},u=new WeakMap,c=new WeakMap,d=new WeakMap,h=new WeakMap,f=new WeakMap,g=new WeakSet,m=function(){w(this,u)||(L(this,u,!0),this.init())},p=function(){var e,t;L(this,h,new MutationObserver(C(this,g,y).bind(this))),L(this,f,()=>C(this,g,v).call(this)),null==(e=this.shadowRoot)||e.addEventListener("slotchange",w(this,f)),C(this,g,v).call(this);for(const i of this.constructor.Events)null==(t=this.shadowRoot)||t.addEventListener(i,this,!0)},v=function(){var e;const t=new Map(w(this,d)),i=null==(e=this.shadowRoot)?void 0:e.querySelector("slot:not([name])");(null==i?void 0:i.assignedElements({flatten:!0}).filter(e=>["track","source"].includes(e.localName))).forEach(e=>{var i,n;t.delete(e);let s=w(this,d).get(e);s||(s=e.cloneNode(),w(this,d).set(e,s),null==(i=w(this,h))||i.observe(e,{attributes:!0})),null==(n=this.nativeEl)||n.append(s),C(this,g,A).call(this,s)}),t.forEach((e,t)=>{e.remove(),w(this,d).delete(t)})},y=function(e){for(const t of e)if("attributes"===t.type){const{target:e,attributeName:i}=t,n=w(this,d).get(e);n&&i&&(n.setAttribute(i,e.getAttribute(i)??""),C(this,g,A).call(this,n))}},A=function(e){e&&"track"===e.localName&&e.default&&("chapters"===e.kind||"metadata"===e.kind)&&"disabled"===e.track.mode&&(e.track.mode="hidden")},E=function(e){if(Object.prototype.hasOwnProperty.call(this,e)){const t=this[e];delete this[e],this[e]=t}},b=function(e,t,i){var n,s,a;["id","class"].includes(e)||!r.observedAttributes.includes(e)&&this.constructor.observedAttributes.includes(e)||(null===i?null==(n=this.nativeEl)||n.removeAttribute(e):(null==(s=this.nativeEl)?void 0:s.getAttribute(e))!==i&&(null==(a=this.nativeEl)||a.setAttribute(e,i)))},I(r,o),T(r,"getTemplateHTML",t.endsWith("audio")?fE:gE),T(r,"shadowRootOptions",{mode:"open"}),T(r,"Events",dE),I(r,a,!1),r}function pE(e){let t="";for(const i in e){if(!hE.includes(i))continue;const n=e[i];t+=""===n?` ${i}`:` ${i}="${n}"`}return t}const vE=mE(globalThis.HTMLElement??class{},{tag:"video"});mE(globalThis.HTMLElement??class{},{tag:"audio"});class yE extends Event{constructor(e,t){super(e),T(this,"track"),this.track=t.track}}const AE=new WeakMap;function EE(e){return AE.get(e)??function(e,t){let i=AE.get(e);i||AE.set(e,i={});return Object.assign(i,t)}(e,{})}function bE(e,t){const i=e.videoTracks;EE(t).media=new WeakRef(e),EE(t).renditionSet||(EE(t).renditionSet=new Set);const n=EE(i).trackSet;n.add(t);const s=n.size-1;s in TE.prototype||Object.defineProperty(TE.prototype,s,{get(){return[...EE(this).trackSet][s]}}),queueMicrotask(()=>{i.dispatchEvent(new yE("addtrack",{track:t}))})}function SE(e){var t,i;const n=null==(i=null==(t=EE(e).media)?void 0:t.deref())?void 0:i.videoTracks;if(!n)return;EE(n).trackSet.delete(e),queueMicrotask(()=>{n.dispatchEvent(new yE("removetrack",{track:e}))})}class TE extends EventTarget{constructor(){super(),I(this,s),I(this,t),I(this,i),I(this,n),EE(this).trackSet=new Set}[Symbol.iterator](){return w(this,s,r).values()}get length(){return w(this,s,r).size}getTrackById(e){return[...w(this,s,r)].find(t=>t.id===e)??null}get selectedIndex(){return[...w(this,s,r)].findIndex(e=>e.selected)}get onaddtrack(){return w(this,t)}set onaddtrack(e){w(this,t)&&(this.removeEventListener("addtrack",w(this,t)),L(this,t,void 0)),"function"==typeof e&&(L(this,t,e),this.addEventListener("addtrack",e))}get onremovetrack(){return w(this,i)}set onremovetrack(e){w(this,i)&&(this.removeEventListener("removetrack",w(this,i)),L(this,i,void 0)),"function"==typeof e&&(L(this,i,e),this.addEventListener("removetrack",e))}get onchange(){return w(this,n)}set onchange(e){w(this,n)&&(this.removeEventListener("change",w(this,n)),L(this,n,void 0)),"function"==typeof e&&(L(this,n,e),this.addEventListener("change",e))}}t=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakSet,r=function(){return EE(this).trackSet};class kE extends Event{constructor(e,t){super(e),T(this,"rendition"),this.rendition=t.rendition}}function wE(e){var t;const i=null==(t=EE(e).media)?void 0:t.deref();return i?[...i.videoTracks].filter(e=>e.selected).flatMap(e=>[...EE(e).renditionSet]):[]}class IE extends EventTarget{constructor(){super(...arguments),I(this,a),I(this,o),I(this,l)}[Symbol.iterator](){return wE(this).values()}get length(){return wE(this).length}getRenditionById(e){return wE(this).find(t=>`${t.id}`==`${e}`)??null}get selectedIndex(){return wE(this).findIndex(e=>e.selected)}set selectedIndex(e){for(const[t,i]of wE(this).entries())i.selected=t===e}get onaddrendition(){return w(this,a)}set onaddrendition(e){w(this,a)&&(this.removeEventListener("addrendition",w(this,a)),L(this,a,void 0)),"function"==typeof e&&(L(this,a,e),this.addEventListener("addrendition",e))}get onremoverendition(){return w(this,o)}set onremoverendition(e){w(this,o)&&(this.removeEventListener("removerendition",w(this,o)),L(this,o,void 0)),"function"==typeof e&&(L(this,o,e),this.addEventListener("removerendition",e))}get onchange(){return w(this,l)}set onchange(e){w(this,l)&&(this.removeEventListener("change",w(this,l)),L(this,l,void 0)),"function"==typeof e&&(L(this,l,e),this.addEventListener("change",e))}}a=new WeakMap,o=new WeakMap,l=new WeakMap;class LE{constructor(){T(this,"src"),T(this,"id"),T(this,"width"),T(this,"height"),T(this,"bitrate"),T(this,"frameRate"),T(this,"codec"),I(this,u,!1)}get selected(){return w(this,u)}set selected(e){w(this,u)!==e&&(L(this,u,e),function(e){var t,i;const n=null==(i=null==(t=EE(e).media)?void 0:t.deref())?void 0:i.videoRenditions;n&&!EE(n).changeRequested&&(EE(n).changeRequested=!0,queueMicrotask(()=>{delete EE(n).changeRequested,EE(e).track.selected&&n.dispatchEvent(new Event("change"))}))}(this))}}u=new WeakMap;class CE{constructor(){T(this,"id"),T(this,"kind"),T(this,"label",""),T(this,"language",""),T(this,"sourceBuffer"),I(this,c,!1)}addRendition(e,t,i,n,s,r){const a=new LE;return a.src=e,a.width=t,a.height=i,a.frameRate=r,a.bitrate=s,a.codec=n,function(e,t){var i,n;const s=null==(n=null==(i=EE(e).media)?void 0:i.deref())?void 0:n.videoRenditions;EE(t).media=EE(e).media,EE(t).track=e;const r=EE(e).renditionSet;r.add(t);const a=r.size-1;a in IE.prototype||Object.defineProperty(IE.prototype,a,{get(){return wE(this)[a]}}),queueMicrotask(()=>{s&&e.selected&&s.dispatchEvent(new kE("addrendition",{rendition:t}))})}(this,a),a}removeRendition(e){!function(e){var t,i;const n=null==(i=null==(t=EE(e).media)?void 0:t.deref())?void 0:i.videoRenditions,s=EE(e).track;EE(s).renditionSet.delete(e),queueMicrotask(()=>{const t=EE(e).track;n&&t.selected&&n.dispatchEvent(new kE("removerendition",{rendition:e}))})}(e)}get selected(){return w(this,c)}set selected(e){w(this,c)!==e&&(L(this,c,e),!0===e&&function(e){var t,i;const n=(null==(i=null==(t=EE(e).media)?void 0:t.deref())?void 0:i.videoTracks)??[];let s=!1;for(const r of n)r!==e&&(r.selected=!1,s=!0);if(s){if(EE(n).changeRequested)return;EE(n).changeRequested=!0,queueMicrotask(()=>{delete EE(n).changeRequested,n.dispatchEvent(new Event("change"))})}}(this))}}function RE(e){var t;const i=null==(t=EE(e).media)?void 0:t.deref();return i?[...i.audioTracks].filter(e=>e.enabled).flatMap(e=>[...EE(e).renditionSet]):[]}c=new WeakMap;class xE extends EventTarget{constructor(){super(...arguments),I(this,d),I(this,h),I(this,f)}[Symbol.iterator](){return RE(this).values()}get length(){return RE(this).length}getRenditionById(e){return RE(this).find(t=>`${t.id}`==`${e}`)??null}get selectedIndex(){return RE(this).findIndex(e=>e.selected)}set selectedIndex(e){for(const[t,i]of RE(this).entries())i.selected=t===e}get onaddrendition(){return w(this,d)}set onaddrendition(e){w(this,d)&&(this.removeEventListener("addrendition",w(this,d)),L(this,d,void 0)),"function"==typeof e&&(L(this,d,e),this.addEventListener("addrendition",e))}get onremoverendition(){return w(this,h)}set onremoverendition(e){w(this,h)&&(this.removeEventListener("removerendition",w(this,h)),L(this,h,void 0)),"function"==typeof e&&(L(this,h,e),this.addEventListener("removerendition",e))}get onchange(){return w(this,f)}set onchange(e){w(this,f)&&(this.removeEventListener("change",w(this,f)),L(this,f,void 0)),"function"==typeof e&&(L(this,f,e),this.addEventListener("change",e))}}d=new WeakMap,h=new WeakMap,f=new WeakMap;class DE{constructor(){T(this,"src"),T(this,"id"),T(this,"bitrate"),T(this,"codec"),I(this,g,!1)}get selected(){return w(this,g)}set selected(e){w(this,g)!==e&&(L(this,g,e),function(e){var t,i;const n=null==(i=null==(t=EE(e).media)?void 0:t.deref())?void 0:i.audioRenditions;n&&!EE(n).changeRequested&&(EE(n).changeRequested=!0,queueMicrotask(()=>{delete EE(n).changeRequested,EE(e).track.enabled&&n.dispatchEvent(new Event("change"))}))}(this))}}function PE(e,t){const i=e.audioTracks;EE(t).media=new WeakRef(e),EE(t).renditionSet||(EE(t).renditionSet=new Set);const n=EE(i).trackSet;n.add(t);const s=n.size-1;s in OE.prototype||Object.defineProperty(OE.prototype,s,{get(){return[...EE(this).trackSet][s]}}),queueMicrotask(()=>{i.dispatchEvent(new yE("addtrack",{track:t}))})}function ME(e){var t,i;const n=null==(i=null==(t=EE(e).media)?void 0:t.deref())?void 0:i.audioTracks;if(!n)return;EE(n).trackSet.delete(e),queueMicrotask(()=>{n.dispatchEvent(new yE("removetrack",{track:e}))})}g=new WeakMap;class OE extends EventTarget{constructor(){super(),I(this,y),I(this,m),I(this,p),I(this,v),EE(this).trackSet=new Set}[Symbol.iterator](){return w(this,y,A).values()}get length(){return w(this,y,A).size}getTrackById(e){return[...w(this,y,A)].find(t=>t.id===e)??null}get onaddtrack(){return w(this,m)}set onaddtrack(e){w(this,m)&&(this.removeEventListener("addtrack",w(this,m)),L(this,m,void 0)),"function"==typeof e&&(L(this,m,e),this.addEventListener("addtrack",e))}get onremovetrack(){return w(this,p)}set onremovetrack(e){w(this,p)&&(this.removeEventListener("removetrack",w(this,p)),L(this,p,void 0)),"function"==typeof e&&(L(this,p,e),this.addEventListener("removetrack",e))}get onchange(){return w(this,v)}set onchange(e){w(this,v)&&(this.removeEventListener("change",w(this,v)),L(this,v,void 0)),"function"==typeof e&&(L(this,v,e),this.addEventListener("change",e))}}m=new WeakMap,p=new WeakMap,v=new WeakMap,y=new WeakSet,A=function(){return EE(this).trackSet};class BE{constructor(){T(this,"id"),T(this,"kind"),T(this,"label",""),T(this,"language",""),T(this,"sourceBuffer"),I(this,E,!1)}addRendition(e,t,i){const n=new DE;return n.src=e,n.codec=t,n.bitrate=i,function(e,t){var i,n;const s=null==(n=null==(i=EE(e).media)?void 0:i.deref())?void 0:n.audioRenditions;EE(t).media=EE(e).media,EE(t).track=e;const r=EE(e).renditionSet;r.add(t);const a=r.size-1;a in xE.prototype||Object.defineProperty(xE.prototype,a,{get(){return RE(this)[a]}}),queueMicrotask(()=>{s&&e.enabled&&s.dispatchEvent(new kE("addrendition",{rendition:t}))})}(this,n),n}removeRendition(e){!function(e){var t,i;const n=null==(i=null==(t=EE(e).media)?void 0:t.deref())?void 0:i.audioRenditions,s=EE(e).track;EE(s).renditionSet.delete(e),queueMicrotask(()=>{const t=EE(e).track;n&&t.enabled&&n.dispatchEvent(new kE("removerendition",{rendition:e}))})}(e)}get enabled(){return w(this,E)}set enabled(e){w(this,E)!==e&&(L(this,E,e),function(e){var t,i;const n=null==(i=null==(t=EE(e).media)?void 0:t.deref())?void 0:i.audioTracks;n&&!EE(n).changeRequested&&(EE(n).changeRequested=!0,queueMicrotask(()=>{delete EE(n).changeRequested,n.dispatchEvent(new Event("change"))}))}(this))}}E=new WeakMap;const FE=NE(globalThis.HTMLMediaElement,"video"),_E=NE(globalThis.HTMLMediaElement,"audio");function NE(e,t){var i;if(null==e?void 0:e.prototype)return null==(i=Object.getOwnPropertyDescriptor(e.prototype,`${t}Tracks`))?void 0:i.get}const UE=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},jE=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=HE},HE=Number.MAX_SAFE_INTEGER||9007199254740991;let VE=function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),GE=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.ASSET_LIST_LOAD_ERROR="assetListLoadError",e.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",e.ASSET_LIST_PARSING_ERROR="assetListParsingError",e.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.ATTACH_MEDIA_ERROR="attachMediaError",e.UNKNOWN="unknown",e}({}),QE=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.MEDIA_ENDED="hlsMediaEnded",e.STALL_RESOLVED="hlsStallResolved",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFERED_TO_END="hlsBufferedToEnd",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e.ASSET_LIST_LOADING="hlsAssetListLoading",e.ASSET_LIST_LOADED="hlsAssetListLoaded",e.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",e.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",e.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",e.INTERSTITIAL_STARTED="hlsInterstitialStarted",e.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",e.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",e.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",e.INTERSTITIAL_ENDED="hlsInterstitialEnded",e.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",e.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",e.EVENT_CUE_ENTER="hlsEventCueEnter",e}({});var KE="manifest",zE="level",WE="audioTrack",qE="subtitleTrack",YE="main",$E="audio",XE="subtitle";class ZE{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class JE{constructor(e,t,i,n=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ZE(e),this.fast_=new ZE(t),this.defaultTTFB_=n,this.ttfb_=new ZE(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:s}=this;i.halfLife!==e&&(this.slow_=new ZE(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new ZE(t,n.getEstimate(),n.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new ZE(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){const i=(e=Math.max(e,this.minDelayMs_))/1e3,n=8*t/i;this.fast_.sample(i,n),this.slow_.sample(i,n)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function eb(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function tb(){return tb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},tb.apply(null,arguments)}function ib(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function nb(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ib(Object(i),!0).forEach(function(t){eb(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ib(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}class sb{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${e}]:`;this.trace=rb,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}const rb=function(){},ab={trace:rb,debug:rb,log:rb,warn:rb,info:rb,error:rb};function ob(){return tb({},ab)}function lb(e,t,i){return t[e]?t[e].bind(t):function(e,t){const i=self.console[e];return i?i.bind(self.console,`${t?"["+t+"] ":""}[${e}] >`):rb}(e,i)}const ub=ob();const cb=ub;function db(e=!0){if("undefined"==typeof self)return;return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function hb(e,t){const i=Object.keys(e),n=Object.keys(t),s=i.length,r=n.length;return!s||!r||s===r&&!i.some(e=>-1===n.indexOf(e))}function fb(e,t=!1){if("undefined"!=typeof TextDecoder){const i=new TextDecoder("utf-8").decode(e);if(t){const e=i.indexOf("\0");return-1!==e?i.substring(0,e):i}return i.replace(/\0/g,"")}const i=e.length;let n,s,r,a="",o=0;for(;o<i;){if(n=e[o++],0===n&&t)return a;if(0!==n&&3!==n)switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(n);break;case 12:case 13:s=e[o++],a+=String.fromCharCode((31&n)<<6|63&s);break;case 14:s=e[o++],r=e[o++],a+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&r)}}return a}function gb(e){let t="";for(let i=0;i<e.length;i++){let n=e[i].toString(16);n.length<2&&(n="0"+n),t+=n}return t}function mb(e){return Uint8Array.from(e.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function pb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vb,yb={exports:{}};var Ab,Eb,bb,Sb,Tb,kb=(vb||(vb=1,Ab=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,Eb=/^(?=([^\/?#]*))\1([^]*)$/,bb=/(?:\/|^)\.(?=\/)/g,Sb=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,yb.exports=Tb={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var n=Tb.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=Tb.normalizePath(n.path),Tb.buildURLFromParts(n)}var s=Tb.parseURL(t);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return i.alwaysNormalize?(s.path=Tb.normalizePath(s.path),Tb.buildURLFromParts(s)):t;var r=Tb.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");if(!r.netLoc&&r.path&&"/"!==r.path[0]){var a=Eb.exec(r.path);r.netLoc=a[1],r.path=a[2]}r.netLoc&&!r.path&&(r.path="/");var o={scheme:r.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(o.netLoc=r.netLoc,"/"!==s.path[0]))if(s.path){var l=r.path,u=l.substring(0,l.lastIndexOf("/")+1)+s.path;o.path=Tb.normalizePath(u)}else o.path=r.path,s.params||(o.params=r.params,s.query||(o.query=r.query));return null===o.path&&(o.path=i.alwaysNormalize?Tb.normalizePath(s.path):s.path),Tb.buildURLFromParts(o)},parseURL:function(e){var t=Ab.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(bb,"");e.length!==(e=e.replace(Sb,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}}),yb.exports);class wb{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Ib="audio",Lb="video",Cb="audiovideo";class Rb{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof e&&(e={url:e}),this.base=e,function(e,t){const i=Mb(e,t);i&&(i.enumerable=!0,Object.defineProperty(e,t,i))}(this,"stats")}setByteRange(e,t){const i=e.split("@",2);let n;n=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[n,parseInt(i[0])+n]}get baseurl(){return this.base.url}get byteRange(){return null===this._byteRange?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return null===this._streams&&(this._streams={[Ib]:null,[Lb]:null,[Cb]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return null!==this._stats}get hasStreams(){return null!==this._streams}get stats(){return null===this._stats&&(this._stats=new wb),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=kb.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Ib]=null,e[Lb]=null,e[Cb]=null}}function xb(e){return"initSegment"!==e.sn}class Db extends Rb{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(UE(e)&&UE(t))return t-e}return null}get bitrate(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(null==(e=this._decryptdata)||!e.keyId){const e=Object.keys(t);if(1===e.length){const i=this._decryptdata=t[e[0]]||null;i&&(this._decryptdata=i.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;const e=UE(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var t;const e=Object.keys(this.levelkeys),i=e.length;if(i>1||1===i&&null!=(t=this.levelkeys[e[0]])&&t.encrypted)return!0}return!1}get programDateTime(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){UE(e)?this._programDateTime=e:this._programDateTime=this.rawProgramDateTime=null}get ref(){return xb(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var i;const n=t[e];!n||null!=(i=this._decryptdata)&&i.keyId||(this._decryptdata=n.getDecryptData(this.sn,t))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,n,s,r=!1){const{elementaryStreams:a}=this,o=a[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,n),o.endDTS=Math.max(o.endDTS,s)):a[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:s,partial:r}}}class Pb extends Rb{constructor(e,t,i,n,s){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=n;const r=e.enumeratedString("BYTERANGE");r&&this.setByteRange(r,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function Mb(e,t){const i=Object.getPrototypeOf(e);if(i){const e=Object.getOwnPropertyDescriptor(i,t);return e||Mb(i,t)}}const Ob=Math.pow(2,32)-1,Bb=[].push,Fb={video:1,audio:2,id3:3,text:4};function _b(e){return String.fromCharCode.apply(null,e)}function Nb(e,t){const i=e[t]<<8|e[t+1];return i<0?65536+i:i}function Ub(e,t){const i=Hb(e,t);return i<0?4294967296+i:i}function jb(e,t){let i=Ub(e,t);return i*=Math.pow(2,32),i+=Ub(e,t+4),i}function Hb(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Vb(e,t){const i=[];if(!t.length)return i;const n=e.byteLength;for(let s=0;s<n;){const r=Ub(e,s),a=r>1?s+r:n;if(_b(e.subarray(s+4,s+8))===t[0])if(1===t.length)i.push(e.subarray(s+8,a));else{const n=Vb(e.subarray(s+8,a),t.slice(1));n.length&&Bb.apply(i,n)}s=a}return i}function Gb(e){const t=[],i=e[0];let n=8;const s=Ub(e,n);n+=4;let r=0,a=0;0===i?(r=Ub(e,n),a=Ub(e,n+4),n+=8):(r=jb(e,n),a=jb(e,n+8),n+=16),n+=2;let o=e.length+a;const l=Nb(e,n);n+=2;for(let u=0;u<l;u++){let i=n;const r=Ub(e,i);i+=4;const a=2147483647&r;if(1===(2147483648&r)>>>31)return cb.warn("SIDX has hierarchical references (not supported)"),null;const l=Ub(e,i);i+=4,t.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/s,start:o,end:o+a-1}}),o+=a,i+=4,n=i}return{earliestPresentationTime:r,timescale:s,version:i,referencesCount:l,references:t}}function Qb(e){const t=[],i=Vb(e,["moov","trak"]);for(let n=0;n<i.length;n++){const e=i[n],s=Vb(e,["tkhd"])[0];if(s){let i=s[0];const n=Ub(s,0===i?12:20),r=Vb(e,["mdia","mdhd"])[0];if(r){i=r[0];const s=Ub(r,0===i?12:20),a=Vb(e,["mdia","hdlr"])[0];if(a){const i=_b(a.subarray(8,12)),r={soun:Ib,vide:Lb}[i],o=Kb(Vb(e,["mdia","minf","stbl","stsd"])[0]);r?(t[n]={timescale:s,type:r,stsd:o},t[r]=nb({timescale:s,id:n},o)):t[n]={timescale:s,type:i,stsd:o}}}}}return Vb(e,["moov","mvex","trex"]).forEach(e=>{const i=Ub(e,4),n=t[i];n&&(n.default={duration:Ub(e,12),flags:Ub(e,20)})}),t}function Kb(e){const t=e.subarray(8),i=t.subarray(86),n=_b(t.subarray(4,8));let s,r=n;const a="enca"===n||"encv"===n;if(a){const e=Vb(t,[n])[0];Vb(e.subarray("enca"===n?28:78),["sinf"]).forEach(e=>{const t=Vb(e,["schm"])[0];if(t){const i=_b(t.subarray(4,8));if("cbcs"===i||"cenc"===i){const t=Vb(e,["frma"])[0];t&&(r=_b(t))}}})}const o=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const e=Vb(i,["avcC"])[0];e&&e.length>3&&(r+="."+qb(e[1])+qb(e[2])+qb(e[3]),s=zb("avc1"===o?"dva1":"dvav",i));break}case"mp4a":{const e=Vb(t,[n])[0],i=Vb(e.subarray(28),["esds"])[0];if(i&&i.length>7){let e=4;if(3!==i[e++])break;e=Wb(i,e),e+=2;const t=i[e++];if(128&t&&(e+=2),64&t&&(e+=i[e++]),4!==i[e++])break;e=Wb(i,e);const n=i[e++];if(64!==n)break;if(r+="."+qb(n),e+=12,5!==i[e++])break;e=Wb(i,e);const s=i[e++];let a=(248&s)>>3;31===a&&(a+=1+((7&s)<<3)+((224&i[e])>>5)),r+="."+a}break}case"hvc1":case"hev1":{const e=Vb(i,["hvcC"])[0];if(e&&e.length>12){const t=e[1],i=["","A","B","C"][t>>6],n=31&t,s=Ub(e,2),a=(32&t)>>5?"H":"L",o=e[12],l=e.subarray(6,12);r+="."+i+n,r+="."+function(e){let t=0;for(let i=0;i<32;i++)t|=(e>>i&1)<<31-i;return t>>>0}(s).toString(16).toUpperCase(),r+="."+a+o;let u="";for(let e=l.length;e--;){const t=l[e];if(t||u){u="."+t.toString(16).toUpperCase()+u}}r+=u}s=zb("hev1"==o?"dvhe":"dvh1",i);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":r=zb(r,i)||r;break;case"vp09":{const e=Vb(i,["vpcC"])[0];if(e&&e.length>6){const t=e[4],i=e[5],n=e[6]>>4&15;r+="."+Yb(t)+"."+Yb(i)+"."+Yb(n)}break}case"av01":{const e=Vb(i,["av1C"])[0];if(e&&e.length>2){const t=e[1]>>>5,n=31&e[1],a=e[2]>>>7?"H":"M",o=(64&e[2])>>6,l=(32&e[2])>>5,u=2===t&&o?l?12:10:o?10:8,c=(16&e[2])>>4,d=(8&e[2])>>3,h=(4&e[2])>>2,f=3&e[2],g=1,m=1,p=1,v=0;r+="."+t+"."+Yb(n)+a+"."+Yb(u)+"."+c+"."+d+h+f+"."+Yb(g)+"."+Yb(m)+"."+Yb(p)+"."+v,s=zb("dav1",i)}break}}return{codec:r,encrypted:a,supplemental:s}}function zb(e,t){const i=Vb(t,["dvvC"]),n=i.length?i[0]:Vb(t,["dvcC"])[0];if(n){const t=n[2]>>1&127,i=n[2]<<5&32|n[3]>>3&31;return e+"."+Yb(t)+"."+Yb(i)}}function Wb(e,t){const i=t+5;for(;128&e[t++]&&t<i;);return t}function qb(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function Yb(e){return(e<10?"0":"")+e}function $b(e,t){Vb(e,["moov","trak"]).forEach(e=>{const i=Vb(e,["mdia","minf","stbl","stsd"])[0];if(!i)return;const n=i.subarray(8);let s=Vb(n,["enca"]);const r=s.length>0;r||(s=Vb(n,["encv"])),s.forEach(e=>{Vb(r?e.subarray(28):e.subarray(78),["sinf"]).forEach(e=>{const i=Xb(e);i&&t(i,r)})})})}function Xb(e){const t=Vb(e,["schm"])[0];if(t){const i=_b(t.subarray(4,8));if("cbcs"===i||"cenc"===i){const t=Vb(e,["schi","tenc"])[0];if(t)return t}}}function Zb(e,t){const i=new Uint8Array(e.length+t.length);return i.set(e),i.set(t,e.length),i}function Jb(e,t){const i=[],n=t.samples,s=t.timescale,r=t.id;let a=!1;return Vb(n,["moof"]).map(o=>{const l=o.byteOffset-8;Vb(o,["traf"]).map(o=>{const u=Vb(o,["tfdt"]).map(e=>{const t=e[0];let i=Ub(e,4);return 1===t&&(i*=Math.pow(2,32),i+=Ub(e,8)),i/s})[0];return void 0!==u&&(e=u),Vb(o,["tfhd"]).map(u=>{const c=Ub(u,4),d=16777215&Ub(u,0);let h=0;const f=!!(16&d);let g=0;const m=!!(32&d);let p=8;c===r&&(!!(1&d)&&(p+=8),!!(2&d)&&(p+=4),!!(8&d)&&(h=Ub(u,p),p+=4),f&&(g=Ub(u,p),p+=4),m&&(p+=4),"video"===t.type&&(a=eS(t.codec)),Vb(o,["trun"]).map(r=>{const o=r[0],u=16777215&Ub(r,0),c=!!(1&u);let d=0;const f=!!(4&u),m=!!(256&u);let p=0;const v=!!(512&u);let y=0;const A=!!(1024&u),E=!!(2048&u);let b=0;const S=Ub(r,4);let T=8;c&&(d=Ub(r,T),T+=4),f&&(T+=4);let k=d+l;for(let l=0;l<S;l++){if(m?(p=Ub(r,T),T+=4):p=h,v?(y=Ub(r,T),T+=4):y=g,A&&(T+=4),E&&(b=0===o?Ub(r,T):Hb(r,T),T+=4),t.type===Lb){let t=0;for(;t<y;){const r=Ub(n,k);if(k+=4,tS(a,n[k])){iS(n.subarray(k,k+r),a?2:1,e+b/s,i)}k+=r,t+=r+4}}e+=p/s}}))})})}),i}function eS(e){if(!e)return!1;const t=e.substring(0,4);return"hvc1"===t||"hev1"===t||"dvh1"===t||"dvhe"===t}function tS(e,t){if(e){const e=t>>1&63;return 39===e||40===e}return 6===(31&t)}function iS(e,t,i,n){const s=nS(e);let r=0;r+=t;let a=0,o=0,l=0;for(;r<s.length;){a=0;do{if(r>=s.length)break;l=s[r++],a+=l}while(255===l);o=0;do{if(r>=s.length)break;l=s[r++],o+=l}while(255===l);const e=s.length-r;let t=r;if(o<e)r+=o;else if(o>e){cb.error(`Malformed SEI payload. ${o} is too small, only ${e} bytes left to parse.`);break}if(4===a){if(181===s[t++]){const e=Nb(s,t);if(t+=2,49===e){const e=Ub(s,t);if(t+=4,1195456820===e){const e=s[t++];if(3===e){const r=s[t++],o=64&r,l=o?2+3*(31&r):0,u=new Uint8Array(l);if(o){u[0]=r;for(let e=1;e<l;e++)u[e]=s[t++]}n.push({type:e,payloadType:a,pts:i,bytes:u})}}}}}else if(5===a&&o>16){const e=[];for(let i=0;i<16;i++){const n=s[t++].toString(16);e.push(1==n.length?"0"+n:n),3!==i&&5!==i&&7!==i&&9!==i||e.push("-")}const r=o-16,l=new Uint8Array(r);for(let i=0;i<r;i++)l[i]=s[t++];n.push({payloadType:a,pts:i,uuid:e.join(""),userData:fb(l),userDataBytes:l})}}}function nS(e){const t=e.byteLength,i=[];let n=1;for(;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return e;const s=t-i.length,r=new Uint8Array(s);let a=0;for(n=0;n<s;a++,n++)a===i[0]&&(a++,i.shift()),r[n]=e[a];return r}function sS(e,t,i){if(16!==e.byteLength)throw new RangeError("Invalid system id");let n,s,r;n=0,s=new Uint8Array,r=new Uint8Array;const a=new Uint8Array(4);return i.byteLength>0&&new DataView(a.buffer).setUint32(0,i.byteLength,!1),function(e,...t){const i=t.length;let n=8,s=i;for(;s--;)n+=t[s].byteLength;const r=new Uint8Array(n);for(r[0]=n>>24&255,r[1]=n>>16&255,r[2]=n>>8&255,r[3]=255&n,r.set(e,4),s=0,n=8;s<i;s++)r.set(t[s],n),n+=t[s].byteLength;return r}([112,115,115,104],new Uint8Array([0,0,0,0]),e,r,s,a,i)}function rS(e){const t=e.getUint32(0),i=e.byteOffset,n=e.byteLength;if(n<t)return{offset:i,size:n};if(1886614376!==e.getUint32(4))return{offset:i,size:t};const s=e.getUint32(8)>>>24;if(0!==s&&1!==s)return{offset:i,size:t};const r=e.buffer,a=gb(new Uint8Array(r,i+12,16));let o=null,l=null,u=0;if(0===s)u=28;else{const s=e.getUint32(28);if(!s||n<32+16*s)return{offset:i,size:t};o=[];for(let e=0;e<s;e++)o.push(new Uint8Array(r,i+32+16*e,16));u=32+16*s}if(!u)return{offset:i,size:t};const c=e.getUint32(u);return t-32<c?{offset:i,size:t}:(l=new Uint8Array(r,i+u+4,c),{version:s,systemId:a,kids:o,data:l,offset:i,size:t})}const aS=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),oS={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function lS(e,t){const i=oS[t];return!!i&&!!i[e.slice(0,4)]}function uS(e,t,i=!0){return!e.split(",").some(e=>!cS(e,t,i))}function cS(e,t,i=!0){var n;const s=db(i);return null!=(n=null==s?void 0:s.isTypeSupported(dS(e,t)))&&n}function dS(e,t){return`${t}/mp4;codecs=${e}`}function hS(e){if(e){const t=e.substring(0,4);return oS.video[t]}return 2}function fS(e){const t=aS();return e.split(",").reduce((e,i)=>{const n=t&&eS(i)?9:oS.video[i];return n?(2*n+e)/(e?3:2):(oS.audio[i]+e)/(e?2:1)},0)}const gS={};const mS=/flac|opus|mp4a\.40\.34/i;function pS(e,t=!0){return e.replace(mS,e=>function(e,t=!0){if(gS[e])return gS[e];const i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e];for(let s=0;s<i.length;s++){var n;if(cS(i[s],"audio",t))return gS[e]=i[s],i[s];if("mp3"===i[s]&&null!=(n=db(t))&&n.isTypeSupported("audio/mpeg"))return""}return e}(e.toLowerCase(),t))}function vS(e,t){if(e&&(e.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(e))&&(yS(e,"audio")||yS(e,"video")))return e;if(t){const i=t.split(",");if(i.length>1){if(e)for(let t=i.length;t--;)if(i[t].substring(0,4)===e.substring(0,4))return i[t];return i[0]}}return t||e}function yS(e,t){return lS(e,t)&&cS(e,t)}function AS(e){if(e.startsWith("av01.")){const t=e.split("."),i=["0","111","01","01","01","0"];for(let e=t.length;e>4&&e<10;e++)t[e]=i[e-4];return t.join(".")}return e}function ES(e){const t=db(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function bS(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const SS={supported:!1,smooth:!1,powerEfficient:!1},TS={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function kS(e,t){return{supported:!1,configurations:t,decodingInfoResults:[SS],error:e}}function wS(e,t,i,n,s,r){const a=e.videoCodec,o=e.audioCodec?e.audioGroups:null,l=null==r?void 0:r.audioCodec,u=null==r?void 0:r.channels,c=u?parseInt(u):l?1/0:2;let d=null;if(null!=o&&o.length)try{d=1===o.length&&o[0]?t.groups[o[0]].channels:o.reduce((e,i)=>{if(i){const n=t.groups[i];if(!n)throw new Error(`Audio track group ${i} not found`);Object.keys(n.channels).forEach(t=>{e[t]=(e[t]||0)+n.channels[t]})}return e},{2:0})}catch(h){return!0}return void 0!==a&&(a.split(",").some(e=>eS(e))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(n,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(s,8e6))||!!d&&UE(c)&&Object.keys(d).some(e=>parseInt(e)>c)}function IS(e,t,i,n={}){const s=e.videoCodec;if(!s&&!e.audioCodec||!i)return Promise.resolve(TS);const r=[],a=function(e){var t;const i=null==(t=e.videoCodec)?void 0:t.split(","),n=CS(e),s=e.width||640,r=e.height||480,a=e.frameRate||30,o=e.videoRange.toLowerCase();return i?i.map(e=>{const t={contentType:dS(AS(e),"video"),width:s,height:r,bitrate:n,framerate:a};return"sdr"!==o&&(t.transferFunction=o),t}):[]}(e),o=a.length,l=function(e,t,i){var n;const s=null==(n=e.audioCodec)?void 0:n.split(","),r=CS(e);if(s&&e.audioGroups)return e.audioGroups.reduce((e,n)=>{var a;const o=n?null==(a=t.groups[n])?void 0:a.tracks:null;return o?o.reduce((e,t)=>{if(t.groupId===n){const n=parseFloat(t.channels||"");s.forEach(t=>{const s={contentType:dS(t,"audio"),bitrate:i?LS(t,r):r};n&&(s.channels=""+n),e.push(s)})}return e},e):e},[]);return[]}(e,t,o>0),u=l.length;for(let c=o||1*u||1;c--;){const e={type:"media-source"};if(o&&(e.video=a[c%o]),u){e.audio=l[c%u];const t=e.audio.bitrate;e.video&&t&&(e.video.bitrate-=t)}r.push(e)}if(s){const e=navigator.userAgent;if(s.split(",").some(e=>eS(e))&&aS())return Promise.resolve(kS(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),r))}return Promise.all(r.map(e=>{const t=function(e){let t="";const{audio:i,video:n}=e;if(n){t+=`${bS(n.contentType)}_r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction||"sd"}_${Math.ceil(n.bitrate/1e5)}`}if(i){t+=`${n?"_":""}${bS(i.contentType)}_c${i.channels}`}return t}(e);return n[t]||(n[t]=i.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:r,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:r,decodingInfoResults:[],error:e}))}function LS(e,t){if(t<=1)return 1;let i=128e3;return"ec-3"===e?i=768e3:"ac-3"===e&&(i=64e4),Math.min(t/2,i)}function CS(e){return 1e3*Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)/1e3)||1}const RS=["NONE","TYPE-0","TYPE-1",null];const xS=["SDR","PQ","HLG"];var DS="",PS="YES",MS="v2";function OS(e){const{canSkipUntil:t,canSkipDateRanges:i,age:n}=e;return t&&n<t/2?i?MS:PS:DS}class BS{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class FS{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(e=>!!e).map(e=>e.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=null==(t=e.supplemental)?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return _S(this._audioGroups,e)}hasSubtitleGroup(e){return _S(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function _S(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function NS(e,t){let i=!1,n=[];if(e&&(i="SDR"!==e,n=[e]),t){n=t.allowedVideoRanges||xS.slice(0);const e="SDR"!==n.join("")&&!t.videoCodec;i=void 0!==t.preferHDR?t.preferHDR:e&&function(){if("function"==typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),i||(n=["SDR"])}return{preferHDR:i,allowedVideoRanges:n}}const US=(e,t)=>JSON.stringify(e,(e=>{const t=new WeakSet;return(i,n)=>{if(e&&(n=e(i,n)),"object"==typeof n&&null!==n){if(t.has(n))return;t.add(n)}return n}})(t));function jS(e,t){cb.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function HS(e){return e.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const n=t.channels||"2";return i.channels[n]=(i.channels[n]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function VS(e){if(!e)return e;const{lang:t,assocLang:i,characteristics:n,channels:s,audioCodec:r}=e;return{lang:t,assocLang:i,characteristics:n,channels:s,audioCodec:r}}function GS(e,t,i){if("attrs"in e){const i=t.indexOf(e);if(-1!==i)return i}for(let n=0;n<t.length;n++){if(QS(e,t[n],i))return n}return-1}function QS(e,t,i){const{groupId:n,name:s,lang:r,assocLang:a,default:o}=e,l=e.forced;return(void 0===n||t.groupId===n)&&(void 0===s||t.name===s)&&(void 0===r||function(e,t="--"){if(e.length===t.length)return e===t;return e.startsWith(t)||t.startsWith(e)}(r,t.lang))&&(void 0===r||t.assocLang===a)&&(void 0===o||t.default===o)&&(void 0===l||t.forced===l)&&(!("characteristics"in e)||function(e,t=""){const i=e.split(","),n=t.split(",");return i.length===n.length&&!i.some(e=>-1===n.indexOf(e))}(e.characteristics||"",t.characteristics))&&(void 0===i||i(e,t))}function KS(e,t){const{audioCodec:i,channels:n}=e;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==n&&n!==(t.channels||"2"))}function zS(e,t,i){for(let n=t;n>-1;n--)if(i(e[n]))return n;for(let n=t+1;n<e.length;n++)if(i(e[n]))return n;return-1}function WS(e,t){var i;return!!e&&e!==(null==(i=t.loadLevelObj)?void 0:i.uri)}const qS=function(e,t){let i=0,n=e.length-1,s=null,r=null;for(;i<=n;){s=(i+n)/2|0,r=e[s];const a=t(r);if(a>0)i=s+1;else{if(!(a<0))return r;n=s-1}}return null};function YS(e,t,i=0,n=0,s=.005){let r=null;if(e){r=t[1+e.sn-t[0].sn]||null;const n=e.endDTS-i;n>0&&n<15e-7&&(i+=15e-7),r&&e.level!==r.level&&r.end<=e.end&&(r=t[2+e.sn-t[0].sn]||null)}else 0===i&&0===t[0].start&&(r=t[0]);if(r&&((!e||e.level===r.level)&&0===$S(i,n,r)||function(e,t,i){if(t&&0===t.start&&t.level<e.level&&(t.endPTS||0)>0){const n=t.tagList.reduce((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e),i);return e.start<=n}return!1}(r,e,Math.min(s,n))))return r;const a=qS(t,$S.bind(null,i,n));return!a||a===e&&r?r:a}function $S(e=0,t=0,i){if(i.start<=e&&i.start+i.duration>e)return 0;const n=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-n<=e?1:i.start-n>e&&i.start?-1:0}function XS(e,t,i){const n=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-n>e}function ZS(e,t,i){if(e&&e.startCC<=t&&e.endCC>=t){let n=e.fragments;const{fragmentHint:s}=e;let r;return s&&(n=n.concat(s)),qS(n,e=>e.cc<t?1:e.cc>t?-1:(r=e,e.end<=i?1:e.start>i?-1:0)),r||null}return null}function JS(e){switch(e.details){case GE.FRAG_LOAD_TIMEOUT:case GE.KEY_LOAD_TIMEOUT:case GE.LEVEL_LOAD_TIMEOUT:case GE.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function eT(e){return e.details.startsWith("key")}function tT(e){return eT(e)&&!!e.frag&&!e.frag.decryptdata}function iT(e,t){const i=JS(t);return e.default[(i?"timeout":"error")+"Retry"]}function nT(e,t){const i="linear"===e.backoff?1:Math.pow(2,t);return Math.min(i*e.retryDelayMs,e.maxRetryDelayMs)}function sT(e){return nb(nb({},e),{errorRetry:null,timeoutRetry:null})}function rT(e,t,i,n){if(!e)return!1;const s=null==n?void 0:n.code,r=t<e.maxNumRetry&&(function(e){return aT(e)||!!e&&(e<400||e>499)}(s)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,n,r):r}function aT(e){return 0===e&&!1===navigator.onLine}var oT=0,lT=2,uT=3,cT=5,dT=0,hT=1,fT=2,gT=4;function mT(e){const t={action:oT,flags:dT};return e&&(t.resolved=!0),t}var pT="NOT_LOADED",vT="APPENDING",yT="PARTIAL",AT="OK";class ET{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.BUFFER_APPENDED,this.onBufferAppended,this),e.on(QE.FRAG_BUFFERED,this.onFragBuffered,this),e.on(QE.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.BUFFER_APPENDED,this.onBufferAppended,this),e.off(QE.FRAG_BUFFERED,this.onFragBuffered,this),e.off(QE.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let n=i.length;n--;){const t=i[n];if(!t)break;if(t.start<=e&&e<=t.end&&t.loaded)return t}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:n}=this,s=Object.keys(n);for(let r=s.length;r--;){const a=n[s[r]];if((null==a?void 0:a.body.type)===t&&(!i||a.buffered)){const t=a.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,i,n,s){this.timeRanges&&(this.timeRanges[e]=t);const r=(null==n?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach(n=>{const a=this.fragments[n];if(!a)return;if(r>=a.body.sn)return;if(!a.buffered&&(!a.loaded||s))return void(a.body.type===i&&this.removeFragment(a.body));const o=a.range[e];o&&(0!==o.time.length?o.time.some(e=>{const i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(a.body),i}):this.removeFragment(a.body))})}detectPartialFragments(e){const t=this.timeRanges;if(!t||"initSegment"===e.frag.sn)return;const i=e.frag,n=ST(i),s=this.fragments[n];if(!s||s.buffered&&i.gap)return;const r=!i.relurl;Object.keys(t).forEach(n=>{const a=i.elementaryStreams[n];if(!a)return;const o=t[n],l=r||!0===a.partial;s.range[n]=this.getBufferedTimes(i,e.part,l,o)}),s.loaded=null,Object.keys(s.range).length?(this.bufferedEnd(s,i),bT(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}bufferedEnd(e,t){e.buffered=!0;(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=TT(i,t=>t.fragment.sn>=e))}fragBuffered(e,t){const i=ST(e);let n=this.fragments[i];!n&&t&&(n=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,this.bufferedEnd(n,e))}getBufferedTimes(e,t,i,n){const s={time:[],partial:i},r=e.start,a=e.end,o=e.minEndPTS||a,l=e.maxStartPTS||r;for(let u=0;u<n.length;u++){const e=n.start(u)-this.bufferPadding,t=n.end(u)+this.bufferPadding;if(l>=e&&o<=t){s.time.push({startPTS:Math.max(r,n.start(u)),endPTS:Math.min(a,n.end(u))});break}if(r<t&&a>e){const e=Math.max(r,n.start(u)),t=Math.min(a,n.end(u));t>e&&(s.partial=!0,s.time.push({startPTS:e,endPTS:t}))}else if(a<=e)break}return s}getPartialFragment(e){let t,i,n,s=null,r=0;const{bufferPadding:a,fragments:o}=this;return Object.keys(o).forEach(l=>{const u=o[l];u&&bT(u)&&(i=u.body.start-a,n=u.body.end+a,e>=i&&e<=n&&(t=Math.min(e-i,n-e),r<=t&&(s=u.body,r=t)))}),s}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||bT(t))}getState(e){const t=ST(e),i=this.fragments[t];return i?i.buffered?bT(i)?yT:AT:vT:pT}isTimeBuffered(e,t,i){let n,s;for(let r=0;r<i.length;r++){if(n=i.start(r)-this.bufferPadding,s=i.end(r)+this.bufferPadding,e>=n&&t<=s)return!0;if(t<=n)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if("initSegment"===t.frag.sn||t.frag.bitrateTest)return;const i=t.frag,n=t.part?null:t,s=ST(i);this.fragments[s]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:n,timeRanges:s,type:r}=t;if("initSegment"===i.sn)return;const a=i.type;if(n){let e=this.activePartLists[a];e||(this.activePartLists[a]=e=[]),e.push(n)}this.timeRanges=s;const o=s[r];this.detectEvictedFragments(r,o,a,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=ST(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let n=i.length;n--;){const s=t[i[n]];if((null==s?void 0:s.body.type)===e)return!0}return!1}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,i,n,s){n&&!this.hasGaps||Object.keys(this.fragments).forEach(r=>{const a=this.fragments[r];if(!a)return;const o=a.body;o.type!==i||n&&!o.gap||o.start<t&&o.end>e&&(a.buffered||s)&&this.removeFragment(o)})}removeFragment(e){const t=ST(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const t=e.sn;this.activePartLists[e.type]=TT(i,e=>e.fragment.sn!==t)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=null==(e=this.hls)||null==(e=e.latestLevelDetails)?void 0:e.partList;t&&t.forEach(e=>e.clearElementaryStreamInfo())}}function bT(e){var t,i,n;return e.buffered&&!!(e.body.gap||null!=(t=e.range.video)&&t.partial||null!=(i=e.range.audio)&&i.partial||null!=(n=e.range.audiovideo)&&n.partial)}function ST(e){return`${e.type}_${e.level}_${e.sn}`}function TT(e,t){return e.filter(e=>{const i=t(e);return i||e.clearElementaryStreamInfo(),i})}var kT=0,wT=1;class IT{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case kT:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case wT:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}class LT{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let n=0;n<4;n++)i[n]=t.getUint32(4*n);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,n=i[0],s=i[1],r=i[2],a=i[3],o=this.invSubMix,l=o[0],u=o[1],c=o[2],d=o[3],h=new Uint32Array(256);let f=0,g=0,m=0;for(m=0;m<256;m++)h[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){let i=g^g<<1^g<<2^g<<3^g<<4;i=i>>>8^255&i^99,e[f]=i,t[i]=f;const o=h[f],m=h[o],p=h[m];let v=257*h[i]^16843008*i;n[f]=v<<24|v>>>8,s[f]=v<<16|v>>>16,r[f]=v<<8|v>>>24,a[f]=v,v=16843009*p^65537*m^257*o^16843008*f,l[i]=v<<24|v>>>8,u[i]=v<<16|v>>>16,c[i]=v<<8|v>>>24,d[i]=v,f?(f=o^h[h[h[p^o]]],g^=h[h[g]]):f=g=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,n=0;for(;n<t.length&&i;)i=t[n]===this.key[n],n++;if(i)return;this.key=t;const s=this.keySize=t.length;if(4!==s&&6!==s&&8!==s)throw new Error("Invalid aes key size="+s);const r=this.ksRows=4*(s+6+1);let a,o;const l=this.keySchedule=new Uint32Array(r),u=this.invKeySchedule=new Uint32Array(r),c=this.sBox,d=this.rcon,h=this.invSubMix,f=h[0],g=h[1],m=h[2],p=h[3];let v,y;for(a=0;a<r;a++)a<s?v=l[a]=t[a]:(y=v,a%s===0?(y=y<<8|y>>>24,y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[255&y],y^=d[a/s|0]<<24):s>6&&a%s===4&&(y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[255&y]),l[a]=v=(l[a-s]^y)>>>0);for(o=0;o<r;o++)a=r-o,y=3&o?l[a]:l[a-4],u[o]=o<4||a<=4?y:f[c[y>>>24]]^g[c[y>>>16&255]]^m[c[y>>>8&255]]^p[c[255&y]],u[o]=u[o]>>>0}networkToHostOrderSwap(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}decrypt(e,t,i){const n=this.keySize+6,s=this.invKeySchedule,r=this.invSBox,a=this.invSubMix,o=a[0],l=a[1],u=a[2],c=a[3],d=this.uint8ArrayToUint32Array_(i);let h=d[0],f=d[1],g=d[2],m=d[3];const p=new Int32Array(e),v=new Int32Array(p.length);let y,A,E,b,S,T,k,w,I,L,C,R,x,D;const P=this.networkToHostOrderSwap;for(;t<p.length;){for(I=P(p[t]),L=P(p[t+1]),C=P(p[t+2]),R=P(p[t+3]),S=I^s[0],T=R^s[1],k=C^s[2],w=L^s[3],x=4,D=1;D<n;D++)y=o[S>>>24]^l[T>>16&255]^u[k>>8&255]^c[255&w]^s[x],A=o[T>>>24]^l[k>>16&255]^u[w>>8&255]^c[255&S]^s[x+1],E=o[k>>>24]^l[w>>16&255]^u[S>>8&255]^c[255&T]^s[x+2],b=o[w>>>24]^l[S>>16&255]^u[T>>8&255]^c[255&k]^s[x+3],S=y,T=A,k=E,w=b,x+=4;y=r[S>>>24]<<24^r[T>>16&255]<<16^r[k>>8&255]<<8^r[255&w]^s[x],A=r[T>>>24]<<24^r[k>>16&255]<<16^r[w>>8&255]<<8^r[255&S]^s[x+1],E=r[k>>>24]<<24^r[w>>16&255]<<16^r[S>>8&255]<<8^r[255&T]^s[x+2],b=r[w>>>24]<<24^r[S>>16&255]<<16^r[T>>8&255]<<8^r[255&k]^s[x+3],v[t]=P(y^h),v[t+1]=P(b^f),v[t+2]=P(E^g),v[t+3]=P(A^m),h=I,f=L,g=C,m=R,t+=4}return v.buffer}}class CT{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){const e=function(e){switch(e){case kT:return"AES-CBC";case wT:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${e}`)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}class RT{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch(i){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?function(e){const t=e.byteLength,i=t&&new DataView(e.buffer).getUint8(t-1);return i?e.slice(0,t-i):e}(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,n){return this.useSoftware?new Promise((s,r)=>{const a=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(a,t,i,n);const o=this.flush();o?s(o.buffer):r(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,n)}softwareDecrypt(e,t,i,n){const{currentIV:s,currentResult:r,remainderData:a}=this;if(n!==kT||16!==t.byteLength)return cb.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),a&&(e=Zb(a,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;s&&(i=s);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new LT),l.expandKey(t);const u=r;return this.currentResult=l.decrypt(o.buffer,0,i),this.currentIV=o.slice(-16).buffer,u||null}webCryptoDecrypt(e,t,i,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new CT(this.subtle,t,n)}return this.fastAesKey.expandKey().then(t=>{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new IT(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,t)}).catch(s=>(cb.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i,n)))}onWebCryptoError(e,t,i,n){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,n);const s=this.flush();if(s)return s.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%16;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(cb.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const xT=Math.pow(2,17);class DT{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new OT({type:VE.NETWORK_ERROR,details:GE.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(i?"part list":"url")),networkDetails:null}));this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((a,o)=>{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some(e=>"GAP"===e[0]))return void o(MT(e));e.gap=!1}const l=this.loader=s?new s(n):new r(n),u=PT(e);e.loader=l;const c=sT(n.fragLoadPolicy.default),d={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:xT};e.stats=l.stats;const h={onSuccess:(t,i,n,s)=>{this.resetLoader(e,l);let r=t.data;n.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(r.slice(0,16)),r=r.slice(16)),a({frag:e,part:null,payload:r,networkDetails:s})},onError:(t,n,s,r)=>{this.resetLoader(e,l),o(new OT({type:VE.NETWORK_ERROR,details:GE.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:nb({url:i,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:s,stats:r}))},onAbort:(t,i,n)=>{this.resetLoader(e,l),o(new OT({type:VE.NETWORK_ERROR,details:GE.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:n,stats:t}))},onTimeout:(t,i,n)=>{this.resetLoader(e,l),o(new OT({type:VE.NETWORK_ERROR,details:GE.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:n,stats:t}))}};t&&(h.onProgress=(i,n,s,r)=>t({frag:e,part:null,payload:s,networkDetails:r})),l.load(u,d,h)})}loadPart(e,t,i){this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((a,o)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void o(MT(e,t));const l=this.loader=s?new s(n):new r(n),u=PT(e,t);e.loader=l;const c=sT(n.fragLoadPolicy.default),d={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:xT};t.stats=l.stats,l.load(u,d,{onSuccess:(n,s,r,o)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const u={frag:e,part:t,payload:n.data,networkDetails:o};i(u),a(u)},onError:(i,n,s,r)=>{this.resetLoader(e,l),o(new OT({type:VE.NETWORK_ERROR,details:GE.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:nb({url:u.url,data:void 0},i),error:new Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:s,stats:r}))},onAbort:(i,n,s)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),o(new OT({type:VE.NETWORK_ERROR,details:GE.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:s,stats:i}))},onTimeout:(i,n,s)=>{this.resetLoader(e,l),o(new OT({type:VE.NETWORK_ERROR,details:GE.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:s,stats:i}))}})})}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,s=n.total;if(i.loaded+=n.loaded,s){const n=Math.round(e.duration/t.duration),r=Math.min(Math.round(i.loaded/s),n),a=(n-r)*Math.round(i.loaded/r);i.total=i.loaded+a}else i.total=Math.max(i.loaded,i.total);const r=i.loading,a=n.loading;r.start?r.first+=a.first-a.start:(r.start=a.start,r.first=a.first),r.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function PT(e,t=null){const i=t||e,n={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},s=i.byteRangeStartOffset,r=i.byteRangeEndOffset;if(UE(s)&&UE(r)){var a;let t=s,i=r;if("initSegment"===e.sn&&("AES-128"===(o=null==(a=e.decryptdata)?void 0:a.method)||"AES-256"===o)){const e=r-s;e%16&&(i=r+(16-e%16)),0!==s&&(n.resetIV=!0,t=s-16)}n.rangeStart=t,n.rangeEnd=i}var o;return n}function MT(e,t){const i=new Error(`GAP ${e.gap?"tag":"attribute"} found`),n={type:VE.MEDIA_ERROR,details:GE.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(n.part=t),(t||e).stats.aborted=!0,new OT(n)}class OT extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class BT extends sb{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class FT{constructor(e,t,i,n=0,s=-1,r=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=s,this.partial=r}}const _T={length:0,start:()=>0,end:()=>0};class NT{static isBuffered(e,t){if(e){const i=NT.getBuffered(e);for(let e=i.length;e--;)if(t>=i.start(e)&&t<=i.end(e))return!0}return!1}static bufferedRanges(e){if(e){const t=NT.getBuffered(e);return NT.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){const n=NT.bufferedRanges(e);if(n.length)return NT.bufferedInfo(n,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.length>1&&e.sort((e,t)=>e.start-t.start||t.end-e.end);let n=-1,s=[];if(i)for(let u=0;u<e.length;u++){t>=e[u].start&&t<=e[u].end&&(n=u);const r=s.length;if(r){const t=s[r-1].end;e[u].start-t<i?e[u].end>t&&(s[r-1].end=e[u].end):s.push(e[u])}else s.push(e[u])}else s=e;let r,a=0,o=t,l=t;for(let u=0;u<s.length;u++){const e=s[u].start,c=s[u].end;if(-1===n&&t>=e&&t<=c&&(n=u),t+i>=e&&t<c)o=e,l=c,a=l-t;else if(t+i<e){r=e;break}}return{len:a,start:o||0,end:l||0,nextStart:r,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||_T}catch(t){return cb.log("failed to get media.buffered",t),_T}}}const UT=/\{\$([a-zA-Z0-9-_]+)\}/g;function jT(e){return UT.test(e)}function HT(e,t){if(null!==e.variableList||e.hasVariableRefs){const i=e.variableList;return t.replace(UT,t=>{const n=t.substring(2,t.length-1),s=null==i?void 0:i[n];return void 0===s?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),t):s})}return t}function VT(e,t,i){let n,s,r=e.variableList;if(r||(e.variableList=r={}),"QUERYPARAM"in t){n=t.QUERYPARAM;try{const e=new self.URL(i).searchParams;if(!e.has(n))throw new Error(`"${n}" does not match any query parameter in URI: "${i}"`);s=e.get(n)}catch(a){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else n=t.NAME,s=t.VALUE;n in r?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):r[n]=s||""}function GT(e,t,i){const n=t.IMPORT;if(i&&n in i){let t=e.variableList;t||(e.variableList=t={}),t[n]=i[n]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}const QT=/^(\d+)x(\d+)$/,KT=/(.+?)=(".*?"|.*?)(?:,|$)/g;class zT{constructor(e,t){"string"==typeof e&&(e=zT.parseAttrList(e,t)),tb(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>"X-"===e.substring(0,2))}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const i=new Uint8Array(t.length/2);for(let e=0;e<t.length/2;e++)i[e]=parseInt(t.slice(2*e,2*e+2),16);return i}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((e,t)=>(e[t.toLowerCase()]=!0,e),t)}bool(e){return"YES"===this[e]}decimalResolution(e){const t=QT.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const n={};for(KT.lastIndex=0;null!==(i=KT.exec(e));){const s=i[1].trim();let r=i[2];const a=0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1;let o=!1;if(a)r=r.slice(1,-1);else switch(s){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":o=!0}if(t&&(a||o))r=HT(t,r);else if(!o&&!a)switch(s){case"CLOSED-CAPTIONS":if("NONE"===r)break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":cb.warn(`${e}: attribute ${s} is missing quotes`)}n[s]=r}return n}}function WT(e){return"ID"!==e&&"CLASS"!==e&&"CUE"!==e&&"START-DATE"!==e&&"DURATION"!==e&&"END-DATE"!==e&&"END-ON-NEXT"!==e}function qT(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e||"SCTE35-CMD"===e}class YT{constructor(e,t,i=0){var n;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(null==t?void 0:t.tagAnchor)||null,this.tagOrder=null!=(n=null==t?void 0:t.tagOrder)?n:i,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){cb.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=tb(new zT({}),i,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=(null==t?void 0:t.endDate)||new Date(this.attr["END-DATE"]);UE(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return void 0===e?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return null===e||null===e.programDateTime?(cb.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return null!==t?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*t):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(UE(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return"com.apple.hls.interstitial"===this.class}get isValid(){return!!this.id&&!this._badValueForSameId&&UE(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}class $T{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return!!this.fragments.length&&UE(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(-1!==t){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function XT(e,t){return e.length===t.length&&!e.some((e,i)=>e!==t[i])}function ZT(e,t){return!e&&!t||!(!e||!t)&&XT(e,t)}function JT(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function ek(e){switch(e){case"AES-128":case"AES-256":return kT;case"AES-256-CTR":return wT;default:throw new Error(`invalid full segment method ${e}`)}}function tk(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function ik(e){return Uint8Array.from(unescape(encodeURIComponent(e)),e=>e.charCodeAt(0))}function nk(e){const t=function(e,t,i){const n=e[t];e[t]=e[i],e[i]=n};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function sk(e){const t=e.split(":");let i=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),n=e[e.length-1].split(",");if(2===n.length){const t="base64"===n[0],s=n[1];t?(e.splice(-1,1),i=tk(s)):i=function(e){const t=ik(e).subarray(0,16),i=new Uint8Array(16);return i.set(t,16-t.length),i}(s)}}return i}const rk="undefined"!=typeof self?self:void 0;var ak={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},ok="org.w3.clearkey",lk="com.apple.streamingkeydelivery",uk="com.microsoft.playready",ck="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function dk(e){switch(e){case lk:return ak.FAIRPLAY;case uk:return ak.PLAYREADY;case ck:return ak.WIDEVINE;case ok:return ak.CLEARKEY}}function hk(e){switch(e){case ak.FAIRPLAY:return lk;case ak.PLAYREADY:return uk;case ak.WIDEVINE:return ck;case ak.CLEARKEY:return ok}}function fk(e){const{drmSystems:t,widevineLicenseUrl:i}=e,n=t?[ak.FAIRPLAY,ak.WIDEVINE,ak.PLAYREADY,ak.CLEARKEY].filter(e=>!!t[e]):[];return!n[ak.WIDEVINE]&&i&&n.push(ak.WIDEVINE),n}const gk=null!=rk&&null!=(mk=rk.navigator)&&mk.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var mk;function pk(e){const t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=String.fromCharCode.apply(null,Array.from(t)),n=i.substring(i.indexOf("<"),i.length),s=(new DOMParser).parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(s){const e=s.childNodes[0]?s.childNodes[0].nodeValue:s.getAttribute("VALUE");if(e){const t=tk(e).subarray(0,16);return nk(t),t}}return null}let vk={};class yk{static clearKeyUriToKeyIdMap(){vk={}}static setKeyIdForUri(e,t){vk[e]=t}static addKeyIdForUri(e){const t=Object.keys(vk).length%Number.MAX_SAFE_INTEGER,i=new Uint8Array(16);return new DataView(i.buffer,12,4).setUint32(0,t),vk[e]=i,i}constructor(e,t,i,n=[1],s=null,r){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=n,this.iv=s,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&!JT(e),null!=r&&r.startsWith("0x")&&(this.keyId=new Uint8Array(mb(r)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&XT(e.keyFormatVersions,this.keyFormatVersions)&&ZT(e.iv,this.iv)&&ZT(e.keyId,this.keyId)}isSupported(){if(this.method){if(JT(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case lk:case ck:case uk:case ok:return-1!==["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(JT(this.method)){let t=this.iv;t||("number"!=typeof e&&(cb.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),t=function(e){const t=new Uint8Array(16);for(let i=12;i<16;i++)t[i]=e>>8*(15-i)&255;return t}(e));return new yk(this.method,this.uri,"identity",this.keyFormatVersions,t)}if(this.keyId){const e=vk[this.uri];if(e&&!XT(this.keyId,e)&&yk.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const i=sk(this.uri);if(i)switch(this.keyFormat){case ck:if(this.pssh=i,!this.keyId){const e=function(e){const t=[];if(e instanceof ArrayBuffer){const i=e.byteLength;let n=0;for(;n+32<i;){const i=rS(new DataView(e,n));t.push(i),n+=i.size}}return t}(i.buffer);if(e.length){var n;const t=e[0];this.keyId=null!=(n=t.kids)&&n.length?t.kids[0]:null}}this.keyId||(this.keyId=Ak(t));break;case uk:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=sS(e,0,i),this.keyId=pk(i);break}default:{let e=i.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e;e=function(e){const t=null==e?void 0:e[ck];if(t)return t.keyId;return null}(t),e||(e=Ak(t),e||(e=vk[this.uri])),e&&(this.keyId=e,yk.setKeyIdForUri(this.uri,e))}return this}}function Ak(e){const t=null==e?void 0:e[uk];if(t){const e=sk(t.uri);if(e)return pk(e)}return null}const Ek=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,bk=/#EXT-X-MEDIA:(.*)/g,Sk=/^#EXT(?:INF|-X-TARGETDURATION):/m,Tk=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),kk=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class wk{static findGroup(e,t){for(let i=0;i<e.length;i++){const n=e[i];if(n.id===t)return n}}static resolve(e,t){return kb.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Sk.test(e)}static parseMasterPlaylist(e,t){const i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:jT(e)},n=[];if(Ek.lastIndex=0,!e.startsWith("#EXTM3U"))return i.playlistParsingError=new Error("no EXTM3U delimiter"),i;let s;for(;null!=(s=Ek.exec(e));)if(s[1]){var r;const e=new zT(s[1],i),a=HT(i,s[2]),o={attrs:e,bitrate:e.decimalInteger("BANDWIDTH")||e.decimalInteger("AVERAGE-BANDWIDTH"),name:e.NAME,url:wk.resolve(a,t)},l=e.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),xk(e.CODECS,o);const u=e["SUPPLEMENTAL-CODECS"];u&&(o.supplemental={},xk(u,o.supplemental)),null!=(r=o.unknownCodecs)&&r.length||n.push(o),i.levels.push(o)}else if(s[3]){const e=s[3],n=s[4];switch(e){case"SESSION-DATA":{const e=new zT(n,i),t=e["DATA-ID"];t&&(null===i.sessionData&&(i.sessionData={}),i.sessionData[t]=e);break}case"SESSION-KEY":{const e=Ck(n,t,i);e.encrypted&&e.isSupported()?(null===i.sessionKeys&&(i.sessionKeys=[]),i.sessionKeys.push(e)):cb.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${n}"`);break}case"DEFINE":VT(i,new zT(n,i),t);break;case"CONTENT-STEERING":{const e=new zT(n,i);i.contentSteering={uri:wk.resolve(e["SERVER-URI"],t),pathwayId:e["PATHWAY-ID"]||"."};break}case"START":i.startTimeOffset=Rk(n)}}const a=n.length>0&&n.length<i.levels.length;return i.levels=a?n:i.levels,0===i.levels.length&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,i){let n;const s={},r=i.levels,a={AUDIO:r.map(e=>({id:e.attrs.AUDIO,audioCodec:e.audioCodec})),SUBTITLES:r.map(e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec})),"CLOSED-CAPTIONS":[]};let o=0;for(bk.lastIndex=0;null!==(n=bk.exec(e));){const e=new zT(n[1],i),r=e.TYPE;if(r){const i=a[r],n=s[r]||[];s[r]=n;const l=e.LANGUAGE,u=e["ASSOC-LANGUAGE"],c=e.CHANNELS,d=e.CHARACTERISTICS,h=e["INSTREAM-ID"],f={attrs:e,bitrate:0,id:o++,groupId:e["GROUP-ID"]||"",name:e.NAME||l||"",type:r,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:l,url:e.URI?wk.resolve(e.URI,t):""};if(u&&(f.assocLang=u),c&&(f.channels=c),d&&(f.characteristics=d),h&&(f.instreamId=h),null!=i&&i.length){const e=wk.findGroup(i,f.groupId)||i[0];Dk(f,e,"audioCodec"),Dk(f,e,"textCodec")}n.push(f)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var a;const o={url:t},l=new $T(t),u=l.fragments,c=[];let d,h,f,g,m=null,p=0,v=0,y=0,A=0,E=0,b=null,S=new Db(n,o),T=-1,k=!1,w=null;if(Tk.lastIndex=0,l.m3u8=e,l.hasVariableRefs=jT(e),"#EXTM3U"!==(null==(a=Tk.exec(e))?void 0:a[0]))return l.playlistParsingError=new Error("Missing format identifier #EXTM3U"),l;for(;null!==(d=Tk.exec(e));){k&&(k=!1,S=new Db(n,o),S.playlistOffset=y,S.setStart(y),S.sn=p,S.cc=A,E&&(S.bitrate=E),S.level=i,m&&(S.initSegment=m,m.rawProgramDateTime&&(S.rawProgramDateTime=m.rawProgramDateTime,m.rawProgramDateTime=null),w&&(S.setByteRange(w),w=null)));const e=d[1];if(e){S.duration=parseFloat(e);const t=(" "+d[2]).slice(1);S.title=t||null,S.tagList.push(t?["INF",e,t]:["INF",e])}else if(d[3]){if(UE(S.duration)){S.playlistOffset=y,S.setStart(y),f&&Ok(S,f,l),S.sn=p,S.level=i,S.cc=A,u.push(S);const e=(" "+d[3]).slice(1);S.relurl=HT(l,e),Pk(S,b,c),b=S,y+=S.duration,p++,v=0,k=!0}}else{if(d=d[0].match(kk),!d){cb.warn("No matches on slow regex match for level playlist!");continue}for(h=1;h<d.length&&void 0===d[h];h++);const e=(" "+d[h]).slice(1),s=(" "+d[h+1]).slice(1),a=d[h+2]?(" "+d[h+2]).slice(1):null;switch(e){case"BYTERANGE":b?S.setByteRange(s,b):S.setByteRange(s);break;case"PROGRAM-DATE-TIME":S.rawProgramDateTime=s,S.tagList.push(["PROGRAM-DATE-TIME",s]),-1===T&&(T=u.length);break;case"PLAYLIST-TYPE":l.type&&Bk(l,e,d),l.type=s.toUpperCase();break;case"MEDIA-SEQUENCE":0!==l.startSN?Bk(l,e,d):u.length>0&&Fk(l,e,d),p=l.startSN=parseInt(s);break;case"SKIP":{l.skippedSegments&&Bk(l,e,d);const t=new zT(s,l),i=t.decimalInteger("SKIPPED-SEGMENTS");if(UE(i)){l.skippedSegments+=i;for(let e=i;e--;)u.push(null);p+=i}const n=t.enumeratedString("RECENTLY-REMOVED-DATERANGES");n&&(l.recentlyRemovedDateranges=(l.recentlyRemovedDateranges||[]).concat(n.split("\t")));break}case"TARGETDURATION":0!==l.targetduration&&Bk(l,e,d),l.targetduration=Math.max(parseInt(s),1);break;case"VERSION":null!==l.version&&Bk(l,e,d),l.version=parseInt(s);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":l.live||Bk(l,e,d),l.live=!1;break;case"#":(s||a)&&S.tagList.push(a?[s,a]:[s]);break;case"DISCONTINUITY":A++,S.tagList.push(["DIS"]);break;case"GAP":S.gap=!0,S.tagList.push([e]);break;case"BITRATE":S.tagList.push([e,s]),E=1e3*parseInt(s),UE(E)?S.bitrate=E:E=0;break;case"DATERANGE":{const e=new zT(s,l),t=new YT(e,l.dateRanges[e.ID],l.dateRangeTagCount);l.dateRangeTagCount++,t.isValid||l.skippedSegments?l.dateRanges[t.id]=t:cb.warn(`Ignoring invalid DATERANGE tag: "${s}"`),S.tagList.push(["EXT-X-DATERANGE",s]);break}case"DEFINE":{const e=new zT(s,l);"IMPORT"in e?GT(l,e,r):VT(l,e,t)}break;case"DISCONTINUITY-SEQUENCE":0!==l.startCC?Bk(l,e,d):u.length>0&&Fk(l,e,d),l.startCC=A=parseInt(s);break;case"KEY":{const e=Ck(s,t,l);if(e.isSupported()){if("NONE"===e.method){f=void 0;break}f||(f={});const t=f[e.keyFormat];null!=t&&t.matches(e)||(t&&(f=tb({},f)),f[e.keyFormat]=e)}else cb.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${s}"`);break}case"START":l.startTimeOffset=Rk(s);break;case"MAP":{const e=new zT(s,l);if(S.duration){const t=new Db(n,o);Mk(t,e,i,f),m=t,S.initSegment=m,m.rawProgramDateTime&&!S.rawProgramDateTime&&(S.rawProgramDateTime=m.rawProgramDateTime)}else{const t=S.byteRangeEndOffset;if(t){const e=S.byteRangeStartOffset;w=`${t-e}@${e}`}else w=null;Mk(S,e,i,f),m=S,k=!0}m.cc=A;break}case"SERVER-CONTROL":g&&Bk(l,e,d),g=new zT(s),l.canBlockReload=g.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=g.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&g.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=g.optionalFloat("PART-HOLD-BACK",0),l.holdBack=g.optionalFloat("HOLD-BACK",0);break;case"PART-INF":{l.partTarget&&Bk(l,e,d);const t=new zT(s);l.partTarget=t.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=l.partList;e||(e=l.partList=[]);const t=v>0?e[e.length-1]:void 0,i=v++,n=new zT(s,l),r=new Pb(n,S,o,i,t);e.push(r),S.duration+=r.duration;break}case"PRELOAD-HINT":{const e=new zT(s,l);l.preloadHint=e;break}case"RENDITION-REPORT":{const e=new zT(s,l);l.renditionReports=l.renditionReports||[],l.renditionReports.push(e);break}default:cb.warn(`line parsed but not handled: ${d}`)}}}b&&!b.relurl?(u.pop(),y-=b.duration,l.partList&&(l.fragmentHint=b)):l.partList&&(Pk(S,b,c),S.cc=A,l.fragmentHint=S,f&&Ok(S,f,l)),l.targetduration||(l.playlistParsingError=new Error("Missing Target Duration"));const I=u.length,L=u[0],C=u[I-1];if(y+=l.skippedSegments*l.targetduration,y>0&&I&&C){l.averagetargetduration=y/I;const e=C.sn;l.endSN="initSegment"!==e?e:0,l.live||(C.endList=!0),T>0&&(!function(e,t){let i=e[t];for(let n=t;n--;){const t=e[n];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(u,T),L&&c.unshift(L))}return l.fragmentHint&&(y+=l.fragmentHint.duration),l.totalduration=y,c.length&&l.dateRangeTagCount&&L&&Ik(c,l),l.endCC=A,l}}function Ik(e,t){let i=e.length;if(!i){if(!t.hasProgramDateTime)return;{const n=t.fragments[t.fragments.length-1];e.push(n),i++}}const n=e[i-1],s=t.live?1/0:t.totalduration,r=Object.keys(t.dateRanges);for(let o=r.length;o--;){const l=t.dateRanges[r[o]],u=l.startDate.getTime();l.tagAnchor=n.ref;for(let n=i;n--;){var a;if((null==(a=e[n])?void 0:a.sn)<t.startSN)break;const i=Lk(t,u,e,n,s);if(-1!==i){l.tagAnchor=t.fragments[i].ref;break}}}}function Lk(e,t,i,n,s){const r=i[n];if(r){const o=r.programDateTime;if(t>=o||0===n){var a;if(t<=o+1e3*(((null==(a=i[n+1])?void 0:a.start)||s)-r.start)){const s=i[n].sn-e.startSN;if(s<0)return-1;const r=e.fragments;if(r.length>i.length){for(let a=(i[n+1]||r[r.length-1]).sn-e.startSN;a>s;a--){const e=r[a].programDateTime;if(t>=e&&t<e+1e3*r[a].duration)return a}}return s}}}return-1}function Ck(e,t,i){var n,s;const r=new zT(e,i),a=null!=(n=r.METHOD)?n:"",o=r.URI,l=r.hexadecimalInteger("IV"),u=r.KEYFORMATVERSIONS,c=null!=(s=r.KEYFORMAT)?s:"identity";o&&r.IV&&!l&&cb.error(`Invalid IV: ${r.IV}`);const d=o?wk.resolve(o,t):"",h=(u||"1").split("/").map(Number).filter(Number.isFinite);return new yk(a,d,c,h,l,r.KEYID)}function Rk(e){const t=new zT(e).decimalFloatingPoint("TIME-OFFSET");return UE(t)?t:null}function xk(e,t){let i=(e||"").split(/[ ,]+/).filter(e=>e);["video","audio","text"].forEach(e=>{const n=i.filter(t=>lS(t,e));n.length&&(t[`${e}Codec`]=n.map(e=>e.split("/")[0]).join(","),i=i.filter(e=>-1===n.indexOf(e)))}),t.unknownCodecs=i}function Dk(e,t,i){const n=t[i];n&&(e[i]=n)}function Pk(e,t,i){e.rawProgramDateTime?i.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function Mk(e,t,i,n){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",n&&(e.levelkeys=n),e.initSegment=null}function Ok(e,t,i){e.levelkeys=t;const{encryptedFragments:n}=i;n.length&&n[n.length-1].levelkeys===t||!Object.keys(t).some(e=>t[e].isCommonEncryption)||n.push(e)}function Bk(e,t,i){e.playlistParsingError=new Error(`#EXT-X-${t} must not appear more than once (${i[0]})`)}function Fk(e,t,i){e.playlistParsingError=new Error(`#EXT-X-${t} must appear before the first Media Segment (${i[0]})`)}function _k(e,t){const i=t.startPTS;if(UE(i)){let n,s=0;t.sn>e.sn?(s=i-e.start,n=e):(s=e.start-i,n=t),n.duration!==s&&n.setDuration(s)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration)}else t.setStart(Math.max(e.start-t.duration,0))}function Nk(e,t,i,n,s,r,a){n-i<=0&&(a.warn("Fragment should have a positive duration",t),n=i+t.duration,r=s+t.duration);let o=i,l=n;const u=t.startPTS,c=t.endPTS;if(UE(u)){const d=Math.abs(u-i);e&&d>e.totalduration?a.warn(`media timestamps and playlist times differ by ${d}s for level ${t.level} ${e.url}`):UE(t.deltaPTS)?t.deltaPTS=Math.max(d,t.deltaPTS):t.deltaPTS=d,o=Math.max(i,u),i=Math.min(i,u),s=void 0!==t.startDTS?Math.min(s,t.startDTS):s,l=Math.min(n,c),n=Math.max(n,c),r=void 0!==t.endDTS?Math.max(r,t.endDTS):r}const d=i-t.start;0!==t.start&&t.setStart(i),t.setDuration(n-t.start),t.startPTS=i,t.maxStartPTS=o,t.startDTS=s,t.endPTS=n,t.minEndPTS=l,t.endDTS=r;const h=t.sn;if(!e||h<e.startSN||h>e.endSN)return 0;let f;const g=h-e.startSN,m=e.fragments;for(m[g]=t,f=g;f>0;f--)_k(m[f],m[f-1]);for(f=g;f<m.length-1;f++)_k(m[f],m[f+1]);return e.fragmentHint&&_k(m[m.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,d}function Uk(e,t,i){if(e===t)return;let n=null;const s=e.fragments;for(let c=s.length-1;c>=0;c--){const e=s[c].initSegment;if(e){n=e;break}}let r;e.fragmentHint&&delete e.fragmentHint.endPTS,function(e,t,i){const n=t.skippedSegments,s=Math.max(e.startSN,t.startSN)-t.startSN,r=(e.fragmentHint?1:0)+(n?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,a=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let u=s;u<=r;u++){const s=l[a+u];let r=o[u];if(n&&!r&&s&&(r=t.fragments[u]=s),s&&r){i(s,r,u,o);const n=s.relurl,a=r.relurl;if(n&&qk(n,a))return void(t.playlistParsingError=jk(`media sequence mismatch ${r.sn}:`,e,t,s,r));if(s.cc!==r.cc)return void(t.playlistParsingError=jk(`discontinuity sequence mismatch (${s.cc}!=${r.cc})`,e,t,s,r))}}}(e,t,(e,i,s,a)=>{if((!t.startCC||t.skippedSegments)&&i.cc!==e.cc){const n=e.cc-i.cc;for(let e=s;e<a.length;e++)a[e].cc+=n;t.endCC=a[a.length-1].cc}UE(e.startPTS)&&UE(e.endPTS)&&(i.setStart(i.startPTS=e.startPTS),i.startDTS=e.startDTS,i.maxStartPTS=e.maxStartPTS,i.endPTS=e.endPTS,i.endDTS=e.endDTS,i.minEndPTS=e.minEndPTS,i.setDuration(e.endPTS-e.startPTS),i.duration&&(r=i),t.PTSKnown=t.alignedSliding=!0),e.hasStreams&&(i.elementaryStreams=e.elementaryStreams),i.loader=e.loader,e.hasStats&&(i.stats=e.stats),e.initSegment&&(i.initSegment=e.initSegment,n=e.initSegment)});const a=t.fragments,o=t.fragmentHint?a.concat(t.fragmentHint):a;if(n&&o.forEach(e=>{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=n)?void 0:t.relurl)||(e.initSegment=n)}),t.skippedSegments){if(t.deltaUpdateFailed=a.some(e=>!e),t.deltaUpdateFailed){i.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)a.shift();t.startSN=a[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){const{dateRanges:n,recentlyRemovedDateranges:s}=t,r=tb({},e);s&&s.forEach(e=>{delete r[e]});const a=Object.keys(r).length;if(!a)return n;return Object.keys(n).forEach(e=>{const t=r[e],s=new YT(n[e].attr,t);s.isValid?(r[e]=s,t||(s.tagOrder+=a)):i.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${US(n[e].attr)}"`)}),r}(e.dateRanges,t,i));const n=e.fragments.filter(e=>e.rawProgramDateTime);if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(let e=1;e<o.length;e++)null===o[e].programDateTime&&Pk(o[e],o[e-1],n);Ik(n,t)}t.endCC=a[a.length-1].cc}if(!t.startCC){var l;const i=Qk(e,t.startSN-1);t.startCC=null!=(l=null==i?void 0:i.cc)?l:a[0].cc}!function(e,t,i){if(e&&t){let n=0;for(let s=0,r=e.length;s<=r;s++){const r=e[s],a=t[s+n];r&&a&&r.index===a.index&&r.fragment.sn===a.fragment.sn?i(r,a):n--}}}(e.partList,t.partList,(e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),r?Nk(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS,i):Hk(e,t),a.length&&(t.totalduration=t.edge-a[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const u=t.advancedDateTime;if(t.advanced&&u){const e=t.edge;t.driftStart||(t.driftStartTime=u,t.driftStart=e),t.driftEndTime=u,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}function jk(e,t,i,n,s){return new Error(`${e} ${s.url}\nPlaylist starting @${t.startSN}\n${t.m3u8}\n\nPlaylist starting @${i.startSN}\n${i.m3u8}`)}function Hk(e,t,i=!0){const n=t.startSN+t.skippedSegments-e.startSN,s=e.fragments,r=n>=0;let a=0;if(r&&n<s.length)a=s[n].start;else if(r&&t.startSN===e.endSN+1)a=e.fragmentEnd;else if(r&&i)a=e.fragmentStart+n*t.levelTargetDuration;else{if(t.skippedSegments||0!==t.fragmentStart)return;a=e.fragmentStart}Vk(t,a)}function Vk(e,t){if(t){const i=e.fragments;for(let n=e.skippedSegments;n<i.length;n++)i[n].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}function Gk(e,t=1/0){let i=1e3*e.targetduration;if(e.updated){const n=e.fragments,s=4;if(n.length&&i*s>t){const e=1e3*n[n.length-1].duration;e<i&&(i=e)}}else i/=2;return Math.round(i)}function Qk(e,t,i){if(!e)return null;let n=e.fragments[t-e.startSN];return n||(n=e.fragmentHint,n&&n.sn===t?n:t<e.startSN&&i&&i.sn===t?i:null)}function Kk(e,t,i){return e?zk(e.partList,t,i):null}function zk(e,t,i){if(e)for(let n=e.length;n--;){const s=e[n];if(s.index===i&&s.fragment.sn===t)return s}return null}function Wk(e){e.forEach((e,t)=>{var i;null==(i=e.details)||i.fragments.forEach(e=>{e.level=t,e.initSegment&&(e.initSegment.level=t)})})}function qk(e,t){return!(e===t||!t)&&Yk(e)!==Yk(t)}function Yk(e){return e.replace(/\?[^?]*$/,"")}function $k(e,t){for(let n=0,s=e.length;n<s;n++){var i;if((null==(i=e[n])?void 0:i.cc)===t)return e[n]}return null}function Xk(e,t){const i=e.start+t;e.startPTS=i,e.setStart(i),e.endPTS=i+e.duration}function Zk(e,t){const i=t.fragments;for(let n=0,s=i.length;n<s;n++)Xk(i[n],e);t.fragmentHint&&Xk(t.fragmentHint,e),t.alignedSliding=!0}function Jk(e,t){if(!function(e,t){return!!(e&&t.startCC<e.endCC&&t.endCC>e.startCC)}(t,e))return;const i=Math.min(t.endCC,e.endCC),n=$k(t.fragments,i),s=$k(e.fragments,i);if(!n||!s)return;cb.log(`Aligning playlist at start of dicontinuity sequence ${i}`);Zk(n.start-s.start,e)}function ew(e,t){if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;const i=e.fragments,n=t.fragments;if(!i.length||!n.length)return;let s,r;const a=Math.min(t.endCC,e.endCC);t.startCC<a&&e.startCC<a&&(s=$k(n,a),r=$k(i,a)),s&&r||(s=n[Math.floor(n.length/2)],r=$k(i,s.cc)||i[Math.floor(i.length/2)]);const o=s.programDateTime,l=r.programDateTime;if(!o||!l)return;Zk((l-o)/1e3-(r.start-s.start),e)}function tw(e,t,i){iw(e,t,i),e.addEventListener(t,i)}function iw(e,t,i){e.removeEventListener(t,i)}const nw=function(e){let t="";const i=e.length;for(let n=0;n<i;n++)t+=`[${e.start(n).toFixed(3)}-${e.end(n).toFixed(3)}]`;return t},sw="STOPPED",rw="IDLE",aw="KEY_LOADING",ow="FRAG_LOADING",lw="FRAG_LOADING_WAITING_RETRY",uw="WAITING_TRACK",cw="PARSING",dw="PARSED",hw="ENDED",fw="ERROR",gw="WAITING_INIT_PTS",mw="WAITING_LEVEL";class pw extends BT{constructor(e,t,i,n,s){super(n,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=sw,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:e,fragCurrent:t,media:i,mediaBuffer:n,state:s}=this,r=i?i.currentTime:0,a=NT.bufferInfo(n||i,r,e.maxBufferHole),o=!a.len;if(this.log(`Media seeking to ${UE(r)?r.toFixed(3):r}, state: ${s}, ${o?"out of":"in"} buffer`),this.state===hw)this.resetLoadingState();else if(t){const i=e.maxFragLookUpTolerance,n=t.start-i,s=t.start+t.duration+i;if(o||s<a.start||n>a.end){const e=r>s;(r<n||e)&&(e&&t.loader&&(this.log(`Cancelling fragment load for seek (sn: ${t.sn})`),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(i){this.fragmentTracker.removeFragmentsInRange(r,1/0,this.playlistType,!0);if(r>this.lastCurrentTime&&(this.lastCurrentTime=r),!this.loadingParts){const e=Math.max(a.end,r),t=this.shouldLoadParts(this.getLevelDetails(),e);t&&(this.log(`LL-Part loading ON after seeking to ${r.toFixed(2)} with buffer @${e.toFixed(2)}`),this.loadingParts=t)}}this.hls.hasEnoughToStart||(this.log(`Setting ${o?"startPosition":"nextLoadPosition"} to ${r} for seek without enough to start`),this.nextLoadPosition=r,o&&(this.startPosition=r)),o&&this.state===rw&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=e,this.fragmentLoader=new DT(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new RT(e.config)}registerListeners(){const{hls:e}=this;e.on(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(QE.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(QE.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===sw)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=sw}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return-1===t&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,n=this.config.timelineOffset||0;if(i<=n)return!1;const s=e.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=NT.bufferedInfo(s,e.start,0));const r=e.nextStart;if(r&&r>n&&r<t.edge)return!1;if(this.media.currentTime<e.start)return!1;const a=t.partList;if(null!=a&&a.length){const e=a[a.length-1];return NT.isBuffered(this.media,e.start+e.duration/2)}const o=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(o)}getLevelDetails(){if(this.levels&&null!==this.levelLastLoaded)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;var t;return e?(null==(t=this.getLevelDetails())?void 0:t.appliedTimelineOffset)||e:0}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;tw(i,"seeking",this.onMediaSeeking),tw(i,"ended",this.onMediaEnded);const n=this.config;this.levels&&n.autoStartLoad&&this.state===sw&&this.startLoad(n.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(null!==n){if(n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),iw(n,"seeking",this.onMediaSeeking),iw(n,"ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i)return this.resetLoadingState(),void this.resetTransmuxer();this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=sw,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){this._doFragLoad(e,t,i,e=>{const t=e.frag;if(this.fragContextChanged(t))return this.warn(`${t.type} sn: ${t.sn}${e.part?" part: "+e.part.index:""} of ${this.fragInfo(t,!1,e.part)}) was dropped during download.`),void this.fragmentTracker.removeFragment(t);t.stats.chunkCount++,this._handleFragmentLoadProgress(e)}).then(e=>{if(!e)return;const t=this.state,i=e.frag;this.fragContextChanged(i)?(t===ow||!this.fragCurrent&&t===cw)&&(this.fragmentTracker.removeFragment(i),this.state=rw):("payload"in e&&(this.log(`Loaded ${i.type} sn: ${i.sn} of ${this.playlistLabel()} ${i.level}`),this.hls.trigger(QE.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e))}).catch(t=>{this.state!==sw&&this.state!==fw&&(this.warn(`Frag error: ${(null==t?void 0:t.message)||t}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===vT){const t=e.type,n=this.getFwdBufferInfo(this.mediaBuffer,t),s=Math.max(e.duration,n?n.len:this.config.maxBufferLength),r=this.backtrackFragment;(1===(r?e.sn-r.sn:0)||this.reduceMaxBufferLength(s,e.duration))&&i.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===yT&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(null==t?void 0:t.live)&&"EVENT"!==t.type&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:i};this.hls.trigger(QE.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(e=>{const t=null==e?void 0:e.frag;if(!t||this.fragContextChanged(t)||!this.levels)throw new Error("init load aborted");return e}).then(e=>{const{hls:t}=this,{frag:i,payload:n}=e,s=i.decryptdata;if(n&&n.byteLength>0&&null!=s&&s.key&&s.iv&&JT(s.method)){const r=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),s.key.buffer,s.iv.buffer,ek(s.method)).catch(e=>{throw t.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:i}),e}).then(n=>{const s=self.performance.now();return t.trigger(QE.FRAG_DECRYPTED,{frag:i,payload:n,stats:{tstart:r,tdecrypt:s}}),e.payload=n,this.completeInitSegmentLoad(e)})}return this.completeInitSegmentLoad(e)}).catch(t=>{this.state!==sw&&this.state!==fw&&(this.warn(t),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==sw&&(this.state=rw),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var i,n;const s=e.tracks;if(s&&!t.encrypted&&(null!=(i=s.audio)&&i.encrypted||null!=(n=s.video)&&n.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const e=this.media,i=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${e?"attached mediaKeys: "+e.mediaKeys:"detached"})`);return this.warn(i.message),!e||e.mediaKeys?!1:(this.hls.trigger(QE.ERROR,{type:VE.KEY_SYSTEM_ERROR,details:GE.KEY_SYSTEM_NO_KEYS,fatal:!1,error:i,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?nw(NT.getBuffered(i)):"(detached)"})`),xb(e)){var n;if(e.type!==XE){const t=e.elementaryStreams;if(!Object.keys(t).some(e=>!!t[e]))return void(this.state=rw)}const t=null==(n=this.levels)?void 0:n[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=rw}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:n,partsLoaded:s}=e,r=!s||0===s.length||s.some(e=>!e),a=new FT(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!r);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,n){var s;this.fragCurrent=e;const r=t.details;if(!this.levels||!r)throw new Error(`frag load aborted, missing level${r?"":" detail"}s`);let a=null;if(!e.encrypted||null!=(s=e.decryptdata)&&s.key)e.encrypted||(a=this.keyLoader.loadClear(e,r.encryptedFragments,this.startFragRequested),a&&this.log("[eme] blocking frag load until media-keys acquired"));else if(this.log(`Loading key for ${e.sn} of [${r.startSN}-${r.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=aw,this.fragCurrent=e,a=this.keyLoader.load(e).then(e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(QE.KEY_LOADED,e),this.state===aw&&(this.state=rw),e}),this.hls.trigger(QE.KEY_LOADING,{frag:e}),null===this.fragCurrent)return this.log("context changed in KEY_LOADING"),Promise.resolve(null);const o=this.fragPrevious;if(xb(e)&&(!o||e.sn!==o.sn)){const i=this.shouldLoadParts(t.details,e.end);i!==this.loadingParts&&(this.log(`LL-Part loading ${i?"ON":"OFF"} loading sn ${null==o?void 0:o.sn}->${e.sn}`),this.loadingParts=i)}if(i=Math.max(e.start,i||0),this.loadingParts&&xb(e)){const s=r.partList;if(s&&n){i>r.fragmentEnd&&r.fragmentHint&&(e=r.fragmentHint);const o=this.getNextPart(s,e,i);if(o>-1){const l=s[o];let u;return e=this.fragCurrent=l.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${l.index} (${o}/${s.length-1}) of ${this.fragInfo(e,!1,l)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=ow,u=a?a.then(i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,l,t,n)).catch(e=>this.handleFragLoadError(e)):this.doFragPartsLoad(e,l,t,n).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(QE.FRAG_LOADING,{frag:e,part:l,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):u}if(!e.url||this.loadedEndOfParts(s,i))return Promise.resolve(null)}}var l;if(xb(e)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${null==(l=r.partList)?void 0:l.filter(e=>e.loaded).map(e=>`[${e.start}-${e.end}]`)}`),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+r.startSN+"-"+r.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),UE(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=ow;const u=this.config.progressive&&e.type!==XE;let c;return c=u&&a?a.then(t=>!t||this.fragContextChanged(t.frag)?null:this.fragmentLoader.load(e,n)).catch(e=>this.handleFragLoadError(e)):Promise.all([this.fragmentLoader.load(e,u?n:void 0),a]).then(([e])=>(!u&&n&&n(e),e)).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(QE.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,i,n){return new Promise((s,r)=>{var a;const o=[],l=null==(a=i.details)?void 0:a.partList,u=t=>{this.fragmentLoader.loadPart(e,t,n).then(n=>{o[t.index]=n;const r=n.part;this.hls.trigger(QE.FRAG_LOADED,n);const a=Kk(i.details,e.sn,t.index+1)||zk(l,e.sn,t.index+1);if(!a)return s({frag:e,part:r,partsLoaded:o});u(a)}).catch(r)};u(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===GE.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===VE.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(QE.ERROR,t)}else this.hls.trigger(QE.ERROR,{type:VE.OTHER_ERROR,details:GE.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==cw)return void(this.fragCurrent||this.state===sw||this.state===fw||(this.state=rw));const{frag:i,part:n,level:s}=t,r=self.performance.now();i.stats.parsing.end=r,n&&(n.stats.parsing.end=r);const a=this.getLevelDetails(),o=a&&i.sn>a.endSN||this.shouldLoadParts(a,i.end);o!==this.loadingParts&&(this.log(`LL-Part loading ${o?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=o),this.updateLevelTiming(i,n,s,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i;const s=e.partList[0];if(s.fragment.type===XE)return!1;if(t>=s.end+((null==(i=e.fragmentHint)?void 0:i.duration)||0)){var n;if((this.hls.hasEnoughToStart?(null==(n=this.media)?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:n,sn:s,part:r}=e;if(null==t||!t[n])return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${n}. The current chunk will not be buffered.`),null;const a=t[n],o=a.details,l=r>-1?Kk(o,s,r):null,u=l?l.fragment:Qk(o,s,i);return u?(i&&i!==u&&(u.stats=i.stats),{frag:u,part:l,level:a}):null}bufferFragmentData(e,t,i,n,s){if(this.state!==cw)return;const{data1:r,data2:a}=e;let o=r;if(a&&(o=Zb(r,a)),!o.length)return;const l=this.initPTS[t.cc],u=l?-l.baseTime/l.timescale:void 0,c={type:e.type,frag:t,part:i,chunkMeta:n,offset:u,parent:t.type,data:o};if(this.hls.trigger(QE.BUFFER_APPENDING,c),e.dropped&&e.independent&&!i){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!NT.isBuffered(t,t.currentTime))return void this.flushMainBuffer(0,e.start);const i=t.currentTime,n=NT.bufferInfo(t,i,0),s=e.duration,r=Math.min(2*this.config.maxFragLookUpTolerance,.25*s),a=Math.max(Math.min(e.start-r,n.end-r),i+r);e.start-a>r&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){var i;const n=this.getLoadPosition();if(!UE(n))return null;const s=this.lastCurrentTime>n||null!=(i=this.media)&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,n,t,s)}getFwdBufferInfoAtPos(e,t,i,n){const s=NT.bufferInfo(e,t,n);if(0===s.len&&void 0!==s.nextStart){const r=this.fragmentTracker.getBufferedFrag(t,i);if(r&&(s.nextStart<=r.end||r.gap)){const i=Math.max(Math.min(s.nextStart,r.end)-t,n);return NT.bufferInfo(e,t,i)}}return s}getMaxBufferLength(e){const{config:t}=this;let i;return i=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,n=Math.max(Math.min(e-t,i.maxBufferLength),t),s=Math.max(e-3*t,i.maxMaxBufferLength/2,n);return s>=n&&(i.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0)}getAppendedFrag(e,t=YE){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,n=i.length;if(!n)return null;const{config:s}=this,r=i[0].start,a=s.lowLatencyMode&&!!t.partList;let o=null;if(t.live){const i=s.initialLiveManifestSize;if(n<i)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${i})`),null;if(!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<r){var l;a&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),o=this.getInitialLiveFragment(t);const i=this.hls.startPosition,n=this.hls.liveSyncPosition,s=o?(-1!==i&&i>=r?i:n)||o.start:e;this.log(`Setting startPosition to ${s} to match start frag at live edge. mainStart: ${i} liveSyncPosition: ${n} frag.start: ${null==(l=o)?void 0:l.start}`),this.startPosition=this.nextLoadPosition=s}}else e<=r&&(o=i[0]);if(!o){const i=this.loadingParts?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,i,t)}let u=this.filterReplacedPrimary(o,t);if(!u&&o){const e=o.sn-t.startSN;u=this.filterReplacedPrimary(i[e+1]||null,t)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===AT||i===yT&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,n,s){let r=null;if(e.gap&&(r=this.getNextFragment(this.nextLoadPosition,t),r&&!r.gap&&i.nextStart)){const e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n,0);if(null!==e&&i.len+e.len>=s){const e=r.sn;return this.loopSn!==e&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${e}`),this.loopSn=e),null}}return this.loopSn=void 0,r}get primaryPrefetch(){if(vw(this.config)){var e;if(null==(e=this.hls.interstitialsManager)||null==(e=e.playingItem)?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(vw(this.config)&&e.type!==XE){const i=this.hls.interstitialsManager,n=null==i?void 0:i.bufferingItem;if(n){const i=n.event;if(i){if(i.appendInPlace||Math.abs(e.start-n.start)>1||0===n.start)return null}else{if(e.end<=n.start&&!1===(null==t?void 0:t.live))return null;if(e.start>n.end&&n.nextEvent&&(n.nextEvent.appendInPlace||e.start-n.end>1))return null}}const s=null==i?void 0:i.playerQueue;if(s)for(let t=s.length;t--;){const i=s[t].interstitial;if(i.appendInPlace&&e.start>=i.startTime&&e.end<=i.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let n=-1,s=!1,r=!0;for(let a=0,o=e.length;a<o;a++){const o=e[a];if(r=r&&!o.independent,n>-1&&i<o.start)break;const l=o.loaded;l?n=-1:(s||(o.independent||r)&&o.fragment===t)&&(o.fragment!==t&&this.warn(`Need buffer at ${i} but next unloaded part starts at ${o.start}`),n=a),s=l}return n}loadedEndOfParts(e,t){let i;for(let n=e.length;n--;){if(i=e[n],!i.loaded)return!1;if(t>i.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let n=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),n=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!UE(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;for(let n=0;n<e.length;++n){const s=e[n];if(XS(t,i,s))return s}return null}(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const s=i.sn+1;if(s>=e.startSN&&s<=e.endSN){const r=t[s-e.startSN];i.cc===r.cc&&(n=r,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=ZS(e,i.cc,i.end),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const t=this.hls.liveSyncPosition;null!==t&&(n=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:s}=this,{fragments:r,endSN:a}=i;const{fragmentHint:o}=i,{maxFragLookUpTolerance:l}=n,u=i.partList,c=!!(this.loadingParts&&null!=u&&u.length&&o);let d;if(c&&!this.bitrateTest&&u[u.length-1].fragment.sn===o.sn&&(r=r.concat(o),a=o.sn),e<t){var h;d=YS(s,r,e,e<this.lastCurrentTime||e>t-l||null!=(h=this.media)&&h.paused||!this.startFragRequested?0:l)}else d=r[r.length-1];if(d){const e=d.sn-i.startSN,t=this.fragmentTracker.getState(d);if((t===AT||t===yT&&d.gap)&&(s=d),s&&d.sn===s.sn&&(!c||u[0].fragment.sn>d.sn||!i.live)){if(d.level===s.level){const t=r[e+1];d=d.sn<a&&this.fragmentTracker.getState(t)!==AT?t:null}}}return d}alignPlaylists(e,t,i){const n=e.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,r=!t,a=e.alignedSliding&&UE(s);if(r||!a&&!s){!function(e,t){e&&(Jk(t,e),t.alignedSliding||ew(t,e),t.alignedSliding||t.skippedSegments||Hk(e,t,!1))}(i,e);const s=e.fragmentStart;return this.log(`Live playlist sliding: ${s.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${n}`),s}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);const n=this.timelineOffset;if(-1===i){const s=null!==this.startTimeOffset,r=s?this.startTimeOffset:e.startTimeOffset;null!==r&&UE(r)?(i=t+r,r<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${r} found in ${s?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+n}this.nextLoadPosition=i+n}getLoadPosition(){var e;const{media:t}=this;let i=0;return null!=(e=this.hls)&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&xb(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===lw)||(this.state=rw)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;var s;if(this.fragContextChanged(n))return void this.warn(`Frag load error must match current frag to retry ${n.url} > ${null==(s=this.fragCurrent)?void 0:s.url}`);const r=t.details===GE.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(n,!0);const a=t.errorAction;if(!a)return void(this.state=fw);const{action:o,flags:l,retryCount:u=0,retryConfig:c}=a,d=!!c,h=d&&o===cT,f=d&&!a.resolved&&l===hT,g=null==(i=this.hls.latestLevelDetails)?void 0:i.live;if(!h&&f&&xb(n)&&!n.endList&&g&&!tT(t))this.resetFragmentErrors(e),this.treatAsGap(n),a.resolved=!0;else if((h||f)&&u<c.maxNumRetry){var m;const i=aT(null==(m=t.response)?void 0:m.code),s=nT(c,u);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+s,this.state=lw,a.resolved=!0,i)return this.log("Waiting for connection (offline)"),this.retryDate=1/0,void(t.reason="offline");this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${u+1}/${c.maxNumRetry} in ${s}ms`)}else if(c){if(this.resetFragmentErrors(e),!(u<c.maxNumRetry))return void this.warn(`${t.details} reached or exceeded max retry (${u})`);r||o===uT||(a.resolved=!0)}else this.state=o===lT?mw:fw;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!aT(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=rw)}reduceLengthAndFlushBuffer(e){if(this.state===cw||this.state===dw){const t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),s=n&&n.len>.5;s&&this.reduceMaxBufferLength(n.len,(null==t?void 0:t.duration)||10);const r=!s;return r&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===$E&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==sw&&(this.state=rw)}afterBufferFlushed(e,t,i){if(!e)return;const n=NT.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===hw&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==sw&&(this.state=rw)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;null!=t&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${-1===e.level?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,n){const s=i.details;if(!s)return void this.warn("level.details undefined");if(!Object.keys(e.elementaryStreams).reduce((t,r)=>{const a=e.elementaryStreams[r];if(a){const o=a.endPTS-a.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${e.sn} ${r} duration reliably (${o})`),t||!1;const l=n?0:Nk(s,e,a.startPTS,a.endPTS,a.startDTS,a.endDTS,this);return this.hls.trigger(QE.LEVEL_PTS_UPDATED,{details:s,level:i,drift:l,type:r,frag:e,start:a.startPTS,end:a.endPTS}),!0}return t},!1)){var r;const t=null===(null==(r=this.transmuxer)?void 0:r.error);if((0===i.fragmentError||t&&(i.fragmentError<2||e.endList))&&this.treatAsGap(e,i),t){const t=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(t.message),this.hls.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=dw,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(QE.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===YE?"level":"track"}fragInfo(e,t=!0,i){var n,s;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${(null!=(n=t&&!i?e.startPTS:(i||e).start)?n:NaN).toFixed(3)}-${(null!=(s=t&&!i?e.endPTS:(i||e).end)?s:NaN).toFixed(3)}]${i&&"main"===e.type?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;null==(e=this.transmuxer)||e.reset()}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function vw(e){return!!e.interstitialsController&&!1!==e.enableInterstitialPlayback}class yw{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;return e.length?(i=1===e.length?e[0]:function(e,t){const i=new Uint8Array(t);let n=0;for(let s=0;s<e.length;s++){const t=e[s];i.set(t,n),n+=t.length}return i}(e,t),this.reset(),i):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}var Aw,Ew={exports:{}};var bw=(Aw||(Aw=1,function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function s(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function r(e,t,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function a(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var e,n,s=[];if(0===this._eventsCount)return s;for(n in e=this._events)t.call(e,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},o.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);s<r;s++)a[s]=n[s].fn;return a},o.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},o.prototype.emit=function(e,t,n,s,r,a){var o=i?i+e:e;if(!this._events[o])return!1;var l,u,c=this._events[o],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,s),!0;case 5:return c.fn.call(c.context,t,n,s,r),!0;case 6:return c.fn.call(c.context,t,n,s,r,a),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var h,f=c.length;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,n);break;case 4:c[u].fn.call(c[u].context,t,n,s);break;default:if(!l)for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c[u].fn.apply(c[u].context,l)}}return!0},o.prototype.on=function(e,t,i){return r(this,e,t,i,!1)},o.prototype.once=function(e,t,i){return r(this,e,t,i,!0)},o.prototype.removeListener=function(e,t,n,s){var r=i?i+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var o=this._events[r];if(o.fn)o.fn!==t||s&&!o.once||n&&o.context!==n||a(this,r);else{for(var l=0,u=[],c=o.length;l<c;l++)(o[l].fn!==t||s&&!o[l].once||n&&o[l].context!==n)&&u.push(o[l]);u.length?this._events[r]=1===u.length?u[0]:u:a(this,r)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,e.exports=o}(Ew)),Ew.exports),Sw=pb(bw);const Tw="1.6.15",kw={};function ww(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Iw(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Lw(e,t){let i=0;return i=(127&e[t])<<21,i|=(127&e[t+1])<<14,i|=(127&e[t+2])<<7,i|=127&e[t+3],i}function Cw(e,t){const i=t;let n=0;for(;Iw(e,t);){n+=10;n+=Lw(e,t+6),ww(e,t+10)&&(n+=10),t+=n}if(n>0)return e.subarray(i,i+n)}function Rw(e,t){return 255===e[t]&&240==(246&e[t+1])}function xw(e,t){return 1&e[t+1]?7:9}function Dw(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Pw(e,t){return t+1<e.length&&Rw(e,t)}function Mw(e,t){if(Pw(e,t)){const i=xw(e,t);if(t+i>=e.length)return!1;const n=Dw(e,t);if(n<=i)return!1;const s=t+n;return s===e.length||Pw(e,s)}return!1}function Ow(e,t,i,n,s){if(!e.samplerate){const r=function(e,t,i,n){const s=t[i+2],r=s>>2&15;if(r>12){const t=new Error(`invalid ADTS sampling index:${r}`);return void e.emit(QE.ERROR,QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}const a=1+(s>>6&3),o=t[i+3]>>6&3|(1&s)<<2,l="mp4a.40."+a,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][r];let c=r;5!==a&&29!==a||(c-=3);const d=[a<<3|(14&c)>>1,(1&c)<<7|o<<3];return cb.log(`manifest codec:${n}, parsed codec:${l}, channels:${o}, rate:${u} (ADTS object type:${a} sampling index:${r})`),{config:d,samplerate:u,channelCount:o,codec:l,parsedCodec:l,manifestCodec:n}}(t,i,n,s);if(!r)return;tb(e,r)}}function Bw(e){return 9216e4/e}function Fw(e,t,i,n,s){const r=n+s*Bw(e.samplerate),a=function(e,t){const i=xw(e,t);if(t+i<=e.length){const n=Dw(e,t)-i;if(n>0)return{headerLength:i,frameLength:n}}}(t,i);let o;if(a){const{frameLength:n,headerLength:s}=a,l=s+n,u=Math.max(0,i+l-t.length);u?(o=new Uint8Array(l-s),o.set(t.subarray(i+s,t.length),0)):o=t.subarray(i+s,i+l);const c={unit:o,pts:r};return u||e.samples.push(c),{sample:c,length:l,missing:u}}const l=t.length-i;o=new Uint8Array(l),o.set(t.subarray(i,t.length),0);return{sample:{unit:o,pts:r},length:l,missing:-1}}function _w(e,t){return Iw(e,t)&&Lw(e,t+6)+10<=e.length-t}function Nw(e,t=0,i=1/0){return function(e,t,i,n){const s=(r=e,r instanceof ArrayBuffer?r:r.buffer);var r;let a=1;"BYTES_PER_ELEMENT"in n&&(a=n.BYTES_PER_ELEMENT);const o=(h=e,h&&h.buffer instanceof ArrayBuffer&&void 0!==h.byteLength&&void 0!==h.byteOffset?e.byteOffset:0),l=(o+e.byteLength)/a,u=(o+t)/a,c=Math.floor(Math.max(0,Math.min(u,l))),d=Math.floor(Math.min(c+Math.max(i,0),l));var h;return new n(s,c,d-c)}(e,t,i,Uint8Array)}function Uw(e){const t={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(e.size<2)return;if(3!==e.data[0])return;const i=e.data.subarray(1).indexOf(0);if(-1===i)return;const n=fb(Nw(e.data,1,i)),s=e.data[2+i],r=e.data.subarray(3+i).indexOf(0);if(-1===r)return;const a=fb(Nw(e.data,3+i,r));let o;var l;return o="--\x3e"===n?fb(Nw(e.data,4+i+r)):(l=e.data.subarray(4+i+r))instanceof ArrayBuffer?l:0==l.byteOffset&&l.byteLength==l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer,t.mimeType=n,t.pictureType=s,t.description=a,t.data=o,t}function jw(e){return"PRIV"===e.type?function(e){if(e.size<2)return;const t=fb(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}}(e):"W"===e.type[0]?function(e){if("WXXX"===e.type){if(e.size<2)return;let t=1;const i=fb(e.data.subarray(t),!0);t+=i.length+1;const n=fb(e.data.subarray(t));return{key:e.type,info:i,data:n}}const t=fb(e.data);return{key:e.type,info:"",data:t}}(e):"APIC"===e.type?Uw(e):function(e){if(e.size<2)return;if("TXXX"===e.type){let t=1;const i=fb(e.data.subarray(t),!0);t+=i.length+1;const n=fb(e.data.subarray(t));return{key:e.type,info:i,data:n}}const t=fb(e.data.subarray(1));return{key:e.type,info:"",data:t}}(e)}function Hw(e){const t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=Lw(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}}function Vw(e){let t=0;const i=[];for(;Iw(e,t);){const n=Lw(e,t+6);e[t+5]>>6&1&&(t+=10),t+=10;const s=t+n;for(;t+10<s;){const n=Hw(e.subarray(t)),s=jw(n);s&&i.push(s),t+=n.size+10}ww(e,t)&&(t+=10)}return i}function Gw(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function Qw(e){if(8===e.data.byteLength){const t=new Uint8Array(e.data),i=1&t[3];let n=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return n/=45,i&&(n+=47721858.84),Math.round(n)}}function Kw(e){const t=Vw(e);for(let i=0;i<t.length;i++){const e=t[i];if(Gw(e))return Qw(e)}}let zw=function(e){return e.audioId3="org.id3",e.dateRange="com.apple.quicktime.HLS",e.emsg="https://aomedia.org/emsg/ID3",e.misbklv="urn:misb:KLV:bin:1910.1",e}({});function Ww(e="",t=9e4){return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class qw{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=Zb(this.cachedData,e),this.cachedData=null);let i,n=Cw(e,0),s=n?n.length:0;const r=this._audioTrack,a=this._id3Track,o=n?Kw(n):void 0,l=e.length;for((null===this.basePTS||0===this.frameIndex&&UE(o))&&(this.basePTS=Yw(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),n&&n.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:zw.audioId3,duration:Number.POSITIVE_INFINITY});s<l;){if(this.canParse(e,s)){const t=this.appendFrame(r,e,s);t?(this.frameIndex++,this.lastPTS=t.sample.pts,s+=t.length,i=s):s=l}else _w(e,s)?(n=Cw(e,s),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:zw.audioId3,duration:Number.POSITIVE_INFINITY}),s+=n.length,i=s):s++;if(s===l&&i!==l){const t=e.slice(i);this.cachedData?this.cachedData=Zb(this.cachedData,t):this.cachedData=t}}return{audioTrack:r,videoTrack:Ww(),id3Track:a,textTrack:Ww()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Ww(),id3Track:this._id3Track,textTrack:Ww()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Yw=(e,t,i)=>{if(UE(e))return 90*e;return 9e4*t+(i?9e4*i.baseTime/i.timescale:0)};let $w=null;const Xw=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Zw=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Jw=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],eI=[0,1,1,4];function tI(e,t,i,n,s){if(i+24>t.length)return;const r=iI(t,i);if(r&&i+r.frameLength<=t.length){const a=n+s*(9e4*r.samplesPerFrame/r.sampleRate),o={unit:t.subarray(i,i+r.frameLength),pts:a,dts:a};return e.config=[],e.channelCount=r.channelCount,e.samplerate=r.sampleRate,e.samples.push(o),{sample:o,length:r.frameLength,missing:0}}}function iI(e,t){const i=e[t+1]>>3&3,n=e[t+1]>>1&3,s=e[t+2]>>4&15,r=e[t+2]>>2&3;if(1!==i&&0!==s&&15!==s&&3!==r){const a=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*Xw[14*(3===i?3-n:3===n?3:4)+s-1],u=Zw[3*(3===i?0:2===i?1:2)+r],c=3===o?1:2,d=Jw[i][n],h=eI[n],f=8*d*h,g=Math.floor(d*l/u+a)*h;if(null===$w){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);$w=e?parseInt(e[1]):0}return!!$w&&$w<=87&&2===n&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:u,channelCount:c,frameLength:g,samplesPerFrame:f}}}function nI(e,t){return!(255!==e[t]||224&~e[t+1]||!(6&e[t+1]))}function sI(e,t){return t+1<e.length&&nI(e,t)}function rI(e,t){if(t+1<e.length&&nI(e,t)){const i=4,n=iI(e,t);let s=i;null!=n&&n.frameLength&&(s=n.frameLength);const r=t+s;return r===e.length||sI(e,r)}return!1}const aI=(e,t)=>{let i=0,n=5;t+=n;const s=new Uint32Array(1),r=new Uint32Array(1),a=new Uint8Array(1);for(;n>0;){a[0]=e[t];const o=Math.min(n,8),l=8-o;r[0]=4278190080>>>24+l<<l,s[0]=(a[0]&r[0])>>l,i=i?i<<o|s[0]:s[0],t+=1,n-=o}return i};class oI extends qw{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const n=lI(e,t,i,this.basePTS,this.frameIndex);if(-1!==n){return{sample:e.samples[e.samples.length-1],length:n,missing:0}}}static probe(e){if(!e)return!1;const t=Cw(e,0);if(!t)return!1;const i=t.length;return 11===e[i]&&119===e[i+1]&&void 0!==Kw(t)&&aI(e,i)<16}}function lI(e,t,i,n,s){if(i+8>t.length)return-1;if(11!==t[i]||119!==t[i+1])return-1;const r=t[i+4]>>6;if(r>=3)return-1;const a=[48e3,44100,32e3][r],o=63&t[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+r];if(i+l>t.length)return-1;const u=t[i+6]>>5;let c=0;2===u?c+=2:(1&u&&1!==u&&(c+=2),4&u&&(c+=2));const d=(t[i+6]<<8|t[i+7])>>12-c&1,h=[2,1,2,3,3,4,4,5][u]+d,f=t[i+5]>>3,g=7&t[i+5],m=new Uint8Array([r<<6|f<<1|g>>2,(3&g)<<6|u<<3|d<<2|o>>4,o<<4&224]),p=n+s*(1536/a*9e4),v=t.subarray(i,i+l);return e.config=m,e.channelCount=h,e.samplerate=a,e.samples.push({unit:v,pts:p}),l}const uI=/\/emsg[-/]ID3/i;function cI(e,t){return UE(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}class dI{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new RT(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,kT)}decryptAacSample(e,t,i){const n=e[t].unit;if(n.length<=16)return;const s=n.subarray(16,n.length-n.length%16),r=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(r).then(s=>{const r=new Uint8Array(s);n.set(r,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(i)}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)i.set(e.subarray(s,s+16),n);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)e.set(i.subarray(n,n+16),s);return e}decryptAvcSample(e,t,i,n,s){const r=nS(s.data),a=this.getAvcEncryptedData(r);this.decryptBuffer(a.buffer).then(a=>{s.data=this.getAvcDecryptedUnit(r,a),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,n)}).catch(n)}decryptAvcSamples(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void n();const s=e[t].units;for(;!(i>=s.length);i++){const r=s[i];if(!(r.data.length<=48||1!==r.type&&5!==r.type||(this.decryptAvcSample(e,t,i,n,r),this.decrypter.isSync())))return}}}}class hI{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i,n=this.VideoSample;if(n&&0!==n.units.length||(n=e[e.length-1]),null!=(t=n)&&t.units){const e=n.units;i=e[e.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){const i=t.samples,n=i.length;if(!n)return void t.dropped++;{const t=i[n-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}}parseNALu(e,t,i){const n=t.byteLength;let s=e.naluState||0;const r=s,a=[];let o,l,u,c=0,d=-1,h=0;for(-1===s&&(d=0,h=this.getNALuType(t,0),s=0,c=1);c<n;)if(o=t[c++],s)if(1!==s)if(o)if(1===o){if(l=c-s-1,d>=0){const e={data:t.subarray(d,l),type:h};a.push(e)}else{const i=this.getLastNalUnit(e.samples);i&&(r&&c<=4-r&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-r)),l>0&&(i.data=Zb(i.data,t.subarray(0,l)),i.state=0))}c<n?(u=this.getNALuType(t,c),d=c,h=u,s=0):s=-1}else s=0;else s=3;else s=o?0:2;else s=o?0:1;if(d>=0&&s>=0){const e={data:t.subarray(d,n),type:h,state:s};a.push(e)}if(0===a.length){const i=this.getLastNalUnit(e.samples);i&&(i.data=Zb(i.data,t))}return e.naluState=s,a}}class fI{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,n=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");n.set(e.subarray(i,i+s)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*s,this.bytesAvailable-=s}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&cb.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class gI extends hI{parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r,a=this.VideoSample,o=!1;i.data=null,a&&s.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(n=>{var s,l;switch(n.type){case 1:{let t=!1;r=!0;const s=n.data;if(o&&s.length>4){const e=this.readSliceType(s);2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var u;if(t)null!=(u=a)&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.frame=!0,a.key=t;break}case 5:r=!0,null!=(s=a)&&s.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 6:r=!0,iS(n.data,1,i.pts,t.samples);break;case 7:{var c,d;r=!0,o=!0;const t=n.data,i=this.readSPS(t);if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(c=e.pixelRatio)?void 0:c[0])!==i.pixelRatio[0]||(null==(d=e.pixelRatio)?void 0:d[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t];const n=t.subarray(1,4);let s="avc1.";for(let e=0;e<3;e++){let t=n[e].toString(16);t.length<2&&(t="0"+t),s+=t}e.codec=s}break}case 8:r=!0,e.pps=[n.data];break;case 9:r=!0,e.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:r=!0;break;default:r=!1}if(a&&r){a.units.push(n)}}),n&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return 31&e[t]}readSliceType(e){const t=new fI(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i,n=8,s=8;for(let r=0;r<e;r++)0!==s&&(i=t.readEG(),s=(n+i+256)%256),n=0===s?n:s}readSPS(e){const t=new fI(e);let i,n,s,r=0,a=0,o=0,l=0;const u=t.readUByte.bind(t),c=t.readBits.bind(t),d=t.readUEG.bind(t),h=t.readBoolean.bind(t),f=t.skipBits.bind(t),g=t.skipEG.bind(t),m=t.skipUEG.bind(t),p=this.skipScalingList.bind(this);u();const v=u();if(c(5),f(3),u(),m(),100===v||110===v||122===v||244===v||44===v||83===v||86===v||118===v||128===v){const e=d();if(3===e&&f(1),m(),m(),f(1),h())for(n=3!==e?8:12,s=0;s<n;s++)h()&&p(s<6?16:64,t)}m();const y=d();if(0===y)d();else if(1===y)for(f(1),g(),g(),i=d(),s=0;s<i;s++)g();m(),f(1);const A=d(),E=d(),b=c(1);0===b&&f(1),f(1),h()&&(r=d(),a=d(),o=d(),l=d());let S=[1,1];if(h()&&h()){switch(u()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:S=[u()<<8|u(),u()<<8|u()]}}return{width:Math.ceil(16*(A+1)-2*r-2*a),height:(2-b)*(E+1)*16-(b?2:4)*(o+l),pixelRatio:S}}}class mI extends hI{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r,a=this.VideoSample,o=!1;i.data=null,a&&s.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(n=>{var s,l;switch(n.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),a.frame=!0,r=!0;break;case 16:case 17:case 18:case 21:var u;if(r=!0,o)null!=(u=a)&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:r=!0,null!=(s=a)&&s.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 39:r=!0,iS(n.data,2,i.pts,t.samples);break;case 32:r=!0,e.vps||("object"!=typeof e.params&&(e.params={}),e.params=tb(e.params,this.readVPS(n.data)),this.initVPS=n.data),e.vps=[n.data];break;case 33:if(r=!0,o=!0,void 0===e.vps||e.vps[0]===this.initVPS||void 0===e.sps||this.matchSPS(e.sps[0],n.data)||(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const t=this.readSPS(n.data);e.width=t.width,e.height=t.height,e.pixelRatio=t.pixelRatio,e.codec=t.codecString,e.sps=[],"object"!=typeof e.params&&(e.params={});for(const i in t.params)e.params[i]=t.params[i]}this.pushParameterSet(e.sps,n.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0;break;case 34:if(r=!0,"object"==typeof e.params){if(!e.pps){e.pps=[];const t=this.readPPS(n.data);for(const i in t)e.params[i]=t[i]}this.pushParameterSet(e.pps,n.data,e.vps)}break;case 35:r=!0,e.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:r=!1}if(a&&r){a.units.push(n)}}),n&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(126&e[t])>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let n=0;n<e.byteLength;n++)n>=2&&3===e[n]&&0===e[n-1]&&0===e[n-2]||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new fI(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);return{numTemporalLayers:t.readBits(3)+1,temporalIdNested:t.readBoolean()}}readSPS(e){const t=new fI(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const n=t.readBits(2),s=t.readBoolean(),r=t.readBits(5),a=t.readUByte(),o=t.readUByte(),l=t.readUByte(),u=t.readUByte(),c=t.readUByte(),d=t.readUByte(),h=t.readUByte(),f=t.readUByte(),g=t.readUByte(),m=t.readUByte(),p=t.readUByte(),v=[],y=[];for(let K=0;K<i;K++)v.push(t.readBoolean()),y.push(t.readBoolean());if(i>0)for(let K=i;K<8;K++)t.readBits(2);for(let K=0;K<i;K++)v[K]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),y[K]&&t.readUByte();t.readUEG();const A=t.readUEG();3==A&&t.skipBits(1);const E=t.readUEG(),b=t.readUEG(),S=t.readBoolean();let T=0,k=0,w=0,I=0;S&&(T+=t.readUEG(),k+=t.readUEG(),w+=t.readUEG(),I+=t.readUEG());const L=t.readUEG(),C=t.readUEG(),R=t.readUEG();for(let K=t.readBoolean()?0:i;K<=i;K++)t.skipUEG(),t.skipUEG(),t.skipUEG();t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.readBoolean()){if(t.readBoolean())for(let e=0;e<4;e++)for(let i=0;i<(3===e?2:6);i++){if(t.readBoolean()){const i=Math.min(64,1<<4+(e<<1));e>1&&t.readEG();for(let e=0;e<i;e++)t.readEG()}else t.readUEG()}}t.readBoolean(),t.readBoolean();t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const x=t.readUEG();let D=0;for(let K=0;K<x;K++){let e=!1;if(0!==K&&(e=t.readBoolean()),e){K===x&&t.readUEG(),t.readBoolean(),t.readUEG();let e=0;for(let i=0;i<=D;i++){const i=t.readBoolean();let n=!1;i||(n=t.readBoolean()),(i||n)&&e++}D=e}else{const e=t.readUEG(),i=t.readUEG();D=e+i;for(let n=0;n<e;n++)t.readUEG(),t.readBoolean();for(let n=0;n<i;n++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const e=t.readUEG();for(let i=0;i<e;i++){for(let e=0;e<R+4;e++)t.readBits(1);t.readBits(1)}}let P=0,M=1,O=1,B=!0,F=1,_=0;t.readBoolean(),t.readBoolean();let N=!1;if(t.readBoolean()){if(t.readBoolean()){const e=t.readUByte();e>0&&e<16?(M=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],O=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):255===e&&(M=t.readBits(16),O=t.readBits(16))}t.readBoolean()&&t.readBoolean();if(t.readBoolean()){t.readBits(3),t.readBoolean();t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())}t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),N=t.readBoolean(),N&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG());if(t.readBoolean()){F=t.readBits(32),_=t.readBits(32);t.readBoolean()&&t.readUEG();if(t.readBoolean()){const e=t.readBoolean(),n=t.readBoolean();let s=!1;(e||n)&&(s=t.readBoolean(),s&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),s&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let r=0;r<=i;r++){B=t.readBoolean();let i=!1;B||t.readBoolean()?t.readEG():i=t.readBoolean();const r=i?1:t.readUEG()+1;if(e)for(let e=0;e<r;e++)t.readUEG(),t.readUEG(),s&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(n)for(let e=0;e<r;e++)t.readUEG(),t.readUEG(),s&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),P=t.readUEG())}let U=E,j=b;if(S){let e=1,t=1;1===A?e=t=2:2==A&&(e=2),U=E-e*k-e*T,j=b-t*I-t*w}const H=n?["A","B","C"][n]:"",V=a<<24|o<<16|l<<8|u;let G=0;for(let K=0;K<32;K++)G=(G|(V>>K&1)<<31-K)>>>0;let Q=G.toString(16);1===r&&"2"===Q&&(Q="6");return{codecString:`hvc1.${H}${r}.${Q}.${s?"H":"L"}${p}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:n,general_profile_compatibility_flags:[a,o,l,u],general_constraint_indicator_flags:[c,d,h,f,g,m],general_level_idc:p,bit_depth:L+8,bit_depth_luma_minus8:L,bit_depth_chroma_minus8:C,min_spatial_segmentation_idc:P,chroma_format_idc:A,frame_rate:{fixed:B,fps:_/F}},width:U,height:j,pixelRatio:[M,O]}}readPPS(e){const t=new fI(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2);t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const i=t.readBoolean(),n=t.readBoolean();let s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const pI=188;class vI{constructor(e,t,i,n){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.videoParser=null}static probe(e,t){const i=vI.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),-1!==i}static syncOffset(e){const t=e.length;let i=Math.min(940,t-pI)+1,n=0;for(;n<i;){let s=!1,r=-1,a=0;for(let o=n;o<t;o+=pI){if(71!==e[o]||t-o!==pI&&71!==e[o+pI]){if(a)return-1;break}if(a++,-1===r&&(r=o,0!==r&&(i=Math.min(r+18612,e.length-pI)+1)),s||(s=0===yI(e,o)),s&&a>1&&(0===r&&a>2||o+pI>i))return r}n++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Fb[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=vI.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=vI.createTrack("audio",n),this._id3Track=vI.createTrack("id3"),this._txtTrack=vI.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,n=!1){let s;i||(this.sampleAes=null);const r=this._videoTrack,a=this._audioTrack,o=this._id3Track,l=this._txtTrack;let u=r.pid,c=r.pesData,d=a.pid,h=o.pid,f=a.pesData,g=o.pesData,m=null,p=this.pmtParsed,v=this._pmtId,y=e.length;if(this.remainderData&&(y=(e=Zb(this.remainderData,e)).length,this.remainderData=null),y<pI&&!n)return this.remainderData=e,{audioTrack:a,videoTrack:r,id3Track:o,textTrack:l};const A=Math.max(0,vI.syncOffset(e));y-=(y-A)%pI,y<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,y,e.buffer.byteLength-y));let E=0;for(let S=A;S<y;S+=pI)if(71===e[S]){const t=!!(64&e[S+1]),n=yI(e,S);let y;if((48&e[S+3])>>4>1){if(y=S+5+e[S+4],y===S+pI)continue}else y=S+4;switch(n){case u:t&&(c&&(s=TI(c,this.logger))&&(this.readyVideoParser(r.segmentCodec),null!==this.videoParser&&this.videoParser.parsePES(r,l,s,!1)),c={data:[],size:0}),c&&(c.data.push(e.subarray(y,S+pI)),c.size+=S+pI-y);break;case d:if(t){if(f&&(s=TI(f,this.logger)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,s);break;case"mp3":this.parseMPEGPES(a,s);break;case"ac3":this.parseAC3PES(a,s)}f={data:[],size:0}}f&&(f.data.push(e.subarray(y,S+pI)),f.size+=S+pI-y);break;case h:t&&(g&&(s=TI(g,this.logger))&&this.parseID3PES(o,s),g={data:[],size:0}),g&&(g.data.push(e.subarray(y,S+pI)),g.size+=S+pI-y);break;case 0:t&&(y+=e[y]+1),v=this._pmtId=AI(e,y);break;case v:{t&&(y+=e[y]+1);const n=EI(e,y,this.typeSupported,i,this.observer,this.logger);u=n.videoPid,u>0&&(r.pid=u,r.segmentCodec=n.segmentVideoCodec),d=n.audioPid,d>0&&(a.pid=d,a.segmentCodec=n.segmentAudioCodec),h=n.id3Pid,h>0&&(o.pid=h),null===m||p||(this.logger.warn(`MPEG-TS PMT found at ${S} after unknown PID '${m}'. Backtracking to sync byte @${A} to parse all TS packets.`),m=null,S=A-188),p=this.pmtParsed=!0;break}case 17:case 8191:break;default:m=n}}else E++;E>0&&bI(this.observer,new Error(`Found ${E} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=c,a.pesData=f,o.pesData=g;const b={audioTrack:a,videoTrack:r,id3Track:o,textTrack:l};return n&&this.extractRemainingSamples(b),b}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:n,textTrack:s}=e,r=i.pesData,a=t.pesData,o=n.pesData;let l;if(r&&(l=TI(r,this.logger))?(this.readyVideoParser(i.segmentCodec),null!==this.videoParser&&(this.videoParser.parsePES(i,s,l,!0),i.pesData=null)):i.pesData=r,a&&(l=TI(a,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l)}t.pesData=null}else null!=a&&a.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;o&&(l=TI(o,this.logger))?(this.parseID3PES(n,l),n.pesData=null):n.pesData=o}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),s=this.sampleAes=new dI(this.observer,this.config,t);return this.decrypt(n,s)}readyVideoParser(e){null===this.videoParser&&("avc"===e?this.videoParser=new gI:"hevc"===e&&(this.videoParser=new mI))}decrypt(e,t){return new Promise(i=>{const{audioTrack:n,videoTrack:s}=e;n.samples&&"aac"===n.segmentCodec?t.decryptAacSamples(n.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{i(e)}):i(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const n=this.aacOverFlow;let s,r,a,o=t.data;if(n){this.aacOverFlow=null;const t=n.missing,s=n.sample.unit.byteLength;if(-1===t)o=Zb(n.sample.unit,o);else{const r=s-t;n.sample.unit.set(o.subarray(0,t),r),e.samples.push(n.sample),i=n.missing}}for(s=i,r=o.length;s<r-1&&!Pw(o,s);s++);if(s!==i){let e;const t=s<r-1;if(e=t?`AAC PES did not start with ADTS header,offset:${s}`:"No ADTS header found in AAC PES",bI(this.observer,new Error(e),t,this.logger),!t)return}if(Ow(e,this.observer,o,s,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!n)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");{const t=Bw(e.samplerate);a=n.sample.pts+t}}let l,u=0;for(;s<r;){if(l=Fw(e,o,s,a,u),s+=l.length,l.missing){this.aacOverFlow=l;break}for(u++;s<r-1&&!Pw(o,s);s++);}}parseMPEGPES(e,t){const i=t.data,n=i.length;let s=0,r=0;const a=t.pts;if(void 0!==a)for(;r<n;)if(sI(i,r)){const t=tI(e,i,r,a,s);if(!t)break;r+=t.length,s++}else r++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")}parseAC3PES(e,t){{const i=t.data,n=t.pts;if(void 0===n)return void this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");const s=i.length;let r,a=0,o=0;for(;o<s&&(r=lI(e,i,o,n,a++))>0;)o+=r}}parseID3PES(e,t){if(void 0===t.pts)return void this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");const i=tb({},t,{type:this._videoTrack?zw.emsg:zw.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function yI(e,t){return((31&e[t+1])<<8)+e[t+2]}function AI(e,t){return(31&e[t+10])<<8|e[t+11]}function EI(e,t,i,n,s,r){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<o;){const o=yI(e,t),l=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!n){SI("ADTS AAC",r);break}case 15:-1===a.audioPid&&(a.audioPid=o);break;case 21:-1===a.id3Pid&&(a.id3Pid=o);break;case 219:if(!n){SI("H.264",r);break}case 27:-1===a.videoPid&&(a.videoPid=o);break;case 3:case 4:i.mpeg||i.mp3?-1===a.audioPid&&(a.audioPid=o,a.segmentAudioCodec="mp3"):r.log("MPEG audio found, not supported in this browser");break;case 193:if(!n){SI("AC-3",r);break}case 129:i.ac3?-1===a.audioPid&&(a.audioPid=o,a.segmentAudioCodec="ac3"):r.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===a.audioPid&&l>0){let n=t+5,s=l;for(;s>2;){if(106===e[n])!0!==i.ac3?r.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=o,a.segmentAudioCodec="ac3");const t=e[n+1]+2;n+=t,s-=t}}break;case 194:case 135:return bI(s,new Error("Unsupported EC-3 in M2TS found"),void 0,r),a;case 36:-1===a.videoPid&&(a.videoPid=o,a.segmentVideoCodec="hevc",r.log("HEVC in M2TS found"))}t+=l+5}return a}function bI(e,t,i,n){n.warn(`parsing error: ${t.message}`),e.emit(QE.ERROR,QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:t,reason:t.message})}function SI(e,t){t.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function TI(e,t){let i,n,s,r,a,o=0;const l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=Zb(l[0],l[1]),l.splice(1,1);i=l[0];if(1===(i[0]<<16)+(i[1]<<8)+i[2]){if(n=(i[4]<<8)+i[5],n&&n>e.size-6)return null;const u=i[7];192&u&&(r=536870912*(14&i[9])+4194304*(255&i[10])+16384*(254&i[11])+128*(255&i[12])+(254&i[13])/2,64&u?(a=536870912*(14&i[14])+4194304*(255&i[15])+16384*(254&i[16])+128*(255&i[17])+(254&i[18])/2,r-a>54e5&&(t.warn(`${Math.round((r-a)/9e4)}s delta between PTS and DTS, align them`),r=a)):a=r),s=i[8];let c=s+9;if(e.size<=c)return null;e.size-=c;const d=new Uint8Array(e.size);for(let e=0,t=l.length;e<t;e++){i=l[e];let t=i.byteLength;if(c){if(c>t){c-=t;continue}i=i.subarray(c),t-=c,c=0}d.set(i,o),o+=t}return n&&(n-=s+3),{data:d,pts:r,dts:a,len:n}}return null}class kI{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const wI=Math.pow(2,32)-1;class II{static init(){let e;for(e in II.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},II.types)II.types.hasOwnProperty(e)&&(II.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);II.HDLR_TYPES={video:t,audio:i};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);II.STTS=II.STSC=II.STCO=s,II.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),II.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),II.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),II.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const r=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);II.FTYP=II.box(II.types.ftyp,r,o,r,a),II.DINF=II.box(II.types.dinf,II.box(II.types.dref,n))}static box(e,...t){let i=8,n=t.length;const s=n;for(;n--;)i+=t[n].byteLength;const r=new Uint8Array(i);for(r[0]=i>>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=255&i,r.set(e,4),n=0,i=8;n<s;n++)r.set(t[n],i),i+=t[n].byteLength;return r}static hdlr(e){return II.box(II.types.hdlr,II.HDLR_TYPES[e])}static mdat(e){return II.box(II.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(wI+1)),n=Math.floor(t%(wI+1));return II.box(II.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))}static mdia(e){return II.box(II.types.mdia,II.mdhd(e.timescale||0,e.duration||0),II.hdlr(e.type),II.minf(e))}static mfhd(e){return II.box(II.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?II.box(II.types.minf,II.box(II.types.smhd,II.SMHD),II.DINF,II.stbl(e)):II.box(II.types.minf,II.box(II.types.vmhd,II.VMHD),II.DINF,II.stbl(e))}static moof(e,t,i){return II.box(II.types.moof,II.mfhd(e),II.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=II.trak(e[t]);return II.box.apply(null,[II.types.moov,II.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(II.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=II.trex(e[t]);return II.box.apply(null,[II.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(wI+1)),n=Math.floor(t%(wI+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return II.box(II.types.mvhd,s)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let n,s;for(n=0;n<t.length;n++)s=t[n].flags,i[n+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return II.box(II.types.sdtp,i)}static stbl(e){return II.box(II.types.stbl,II.stsd(e),II.box(II.types.stts,II.STTS),II.box(II.types.stsc,II.STSC),II.box(II.types.stsz,II.STSZ),II.box(II.types.stco,II.STCO))}static avc1(e){let t,i,n,s=[],r=[];for(t=0;t<e.sps.length;t++)i=e.sps[t],n=i.byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(i));for(t=0;t<e.pps.length;t++)i=e.pps[t],n=i.byteLength,r.push(n>>>8&255),r.push(255&n),r=r.concat(Array.prototype.slice.call(i));const a=II.box(II.types.avcC,new Uint8Array([1,s[3],s[4],s[5],255,224|e.sps.length].concat(s).concat([e.pps.length]).concat(r))),o=e.width,l=e.height,u=e.pixelRatio[0],c=e.pixelRatio[1];return II.box(II.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,II.box(II.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),II.box(II.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return II.box(II.types.mp4a,II.audioStsd(e),II.box(II.types.esds,II.esds(e)))}static mp3(e){return II.box(II.types[".mp3"],II.audioStsd(e))}static ac3(e){return II.box(II.types["ac-3"],II.audioStsd(e),II.box(II.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if("audio"===e.type){if("aac"===t)return II.box(II.types.stsd,II.STSD,II.mp4a(e));if("ac3"===t&&e.config)return II.box(II.types.stsd,II.STSD,II.ac3(e));if("mp3"===t&&"mp3"===e.codec)return II.box(II.types.stsd,II.STSD,II.mp3(e))}else{if(!e.pps||!e.sps)throw new Error("video track missing pps or sps");if("avc"===t)return II.box(II.types.stsd,II.STSD,II.avc1(e));if("hevc"===t&&e.vps)return II.box(II.types.stsd,II.STSD,II.hvc1(e))}throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),n=e.width||0,s=e.height||0,r=Math.floor(i/(wI+1)),a=Math.floor(i%(wI+1));return II.box(II.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,s>>8&255,255&s,0,0]))}static traf(e,t){const i=II.sdtp(e),n=e.id,s=Math.floor(t/(wI+1)),r=Math.floor(t%(wI+1));return II.box(II.types.traf,II.box(II.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),II.box(II.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,r>>24,r>>16&255,r>>8&255,255&r])),II.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,II.box(II.types.trak,II.tkhd(e),II.mdia(e))}static trex(e){const t=e.id;return II.box(II.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],n=i.length,s=12+16*n,r=new Uint8Array(s);let a,o,l,u,c,d;for(t+=8+s,r.set(["video"===e.type?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),a=0;a<n;a++)o=i[a],l=o.duration,u=o.size,c=o.flags,d=o.cts,r.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,u>>>24&255,u>>>16&255,u>>>8&255,255&u,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,61440&c.degradPrio,15&c.degradPrio,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*a);return II.box(II.types.trun,r)}static initSegment(e){II.types||II.init();const t=II.moov(e);return Zb(II.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],n=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),3|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let s=n.length;for(let h=0;h<i.length;h+=1){s+=3;for(let e=0;e<i[h].length;e+=1)s+=2+i[h][e].length}const r=new Uint8Array(s);r.set(n,0),s=n.length;const a=i.length-1;for(let h=0;h<i.length;h+=1){r.set(new Uint8Array([32+h|(h===a?128:0),0,i[h].length]),s),s+=3;for(let e=0;e<i[h].length;e+=1)r.set(new Uint8Array([i[h][e].length>>8,255&i[h][e].length]),s),s+=2,r.set(i[h][e],s),s+=i[h][e].length}const o=II.box(II.types.hvcC,r),l=e.width,u=e.height,c=e.pixelRatio[0],d=e.pixelRatio[1];return II.box(II.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,II.box(II.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),II.box(II.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,d>>24,d>>16&255,d>>8&255,255&d])))}}II.types=void 0,II.HDLR_TYPES=void 0,II.STTS=void 0,II.STSC=void 0,II.STCO=void 0,II.STSZ=void 0,II.VMHD=void 0,II.SMHD=void 0,II.STSD=void 0,II.FTYP=void 0,II.DINF=void 0;function LI(e,t,i=1,n=!1){const s=e*t*i;return n?Math.round(s):s}function CI(e,t=!1){return LI(e,1e3,1/9e4,t)}function RI(e){const{baseTime:t,timescale:i,trackId:n}=e;return`${t/i} (${t}/${i}) trackId: ${n}`}let xI,DI=null,PI=null;function MI(e,t,i,n){return{duration:t,size:i,cts:n,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class OI extends sb{constructor(e,t,i,n){if(super("mp4-remuxer",n),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===DI){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);DI=e?parseInt(e[1]):0}if(null===PI){const e=navigator.userAgent.match(/Safari\/(\d+)/i);PI=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;t&&e&&e.trackId===t.trackId&&e.baseTime===t.baseTime&&e.timescale===t.timescale||this.log(`Reset initPTS: ${t?RI(t):t} > ${e?RI(e):e}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((e,n)=>{let s=n.pts,r=s-e;return r<-4294967296&&(t=!0,s=BI(s,i),r=s-e),r>0?e:s},i);return t&&this.debug("PTS rollover detected"),n}remux(e,t,i,n,s,r,a,o){let l,u,c,d,h,f,g=s,m=s;const p=e.pid>-1,v=t.pid>-1,y=t.samples.length,A=e.samples.length>0,E=a&&y>0||y>1;if((!p||A)&&(!v||E)||this.ISGenerated||a){if(this.ISGenerated){var b,S,T,k;const e=this.videoTrackConfig;(e&&(t.width!==e.width||t.height!==e.height||(null==(b=t.pixelRatio)?void 0:b[0])!==(null==(S=e.pixelRatio)?void 0:S[0])||(null==(T=t.pixelRatio)?void 0:T[1])!==(null==(k=e.pixelRatio)?void 0:k[1]))||!e&&E||null===this.nextAudioTs&&A)&&this.resetInitSegment()}this.ISGenerated||(c=this.generateIS(e,t,s,r));const i=this.isVideoContiguous;let n,a=-1;if(E&&(a=function(e){for(let t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!i&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,a>0){this.warn(`Dropped ${a} out of ${y} video samples due to a missing keyframe`);const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(a),t.dropped+=a,m+=(t.samples[0].pts-e)/t.inputTimeScale,n=m}else-1===a&&(this.warn(`No keyframe found out of ${y} video samples`),f=!1);if(this.ISGenerated){if(A&&E){const i=this.getVideoStartPts(t.samples),n=(BI(e.samples[0].pts,i)-i)/t.inputTimeScale;g+=Math.max(0,n),m+=Math.max(0,-n)}if(A){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),c=this.generateIS(e,t,s,r)),u=this.remuxAudio(e,g,this.isAudioContiguous,r,v||E||o===$E?m:void 0),E){const n=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),c=this.generateIS(e,t,s,r)),l=this.remuxVideo(t,m,i,n)}}else E&&(l=this.remuxVideo(t,m,i,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=n)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(h=FI(i,s,this._initPTS,this._initDTS)),n.samples.length&&(d=_I(n,s,this._initPTS))),{audio:u,video:l,initSegment:c,independent:f,text:d,id3:h}}computeInitPts(e,t,i,n){const s=Math.round(i*t);let r=BI(e,s);if(r<s+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(s-r)/t} ${n}`);r<s+t;)r+=8589934592;return r-s}generateIS(e,t,i,n){const s=e.samples,r=t.samples,a=this.typeSupported,o={},l=this._initPTS;let u,c,d,h=!l||n,f="audio/mp4",g=-1;if(h&&(u=c=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(f="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}o.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&a.mpeg?new Uint8Array(0):II.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(g=e.id,d=e.inputTimeScale,l&&d===l.timescale?h=!1:u=c=this.computeInitPts(s[0].pts,d,i,"audio"))}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,o.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:II.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(g=t.id,d=t.inputTimeScale,l&&d===l.timescale)h=!1;else{const e=this.getVideoStartPts(r),t=BI(r[0].dts,e),n=this.computeInitPts(t,d,i,"video"),s=this.computeInitPts(e,d,i,"video");c=Math.min(c,n),u=Math.min(u,s)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(o).length)return this.ISGenerated=!0,h?(l&&this.warn(`Timestamps at playlist time: ${n?"":"~"}${i} ${u/d} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${u/d} (${u}/${d}) trackId: ${g}`),this._initPTS={baseTime:u,timescale:d,trackId:g},this._initDTS={baseTime:c,timescale:d,trackId:g}):u=d=void 0,{tracks:o,initPTS:u,timescale:d,trackId:g}}remuxVideo(e,t,i,n){const s=e.inputTimeScale,r=e.samples,a=[],o=r.length,l=this._initPTS,u=l.baseTime*s/l.timescale;let c,d,h=this.nextVideoTs,f=8,g=this.videoSampleDuration,m=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,v=!1;if(!i||null===h){const e=u+t*s,n=r[0].pts-BI(r[0].dts,r[0].pts);DI&&null!==h&&Math.abs(e-n-(h+u))<15e3?i=!0:h=e-n-u}const y=h+u;for(let B=0;B<o;B++){const e=r[B];e.pts=BI(e.pts,y),e.dts=BI(e.dts,y),e.dts<r[B>0?B-1:B].dts&&(v=!0)}v&&r.sort(function(e,t){const i=e.dts-t.dts,n=e.pts-t.pts;return i||n}),c=r[0].dts,d=r[r.length-1].dts;const A=d-c,E=A?Math.round(A/(o-1)):g||e.inputTimeScale/30;if(i){const i=c-y,n=i>E,s=i<-1;if((n||s)&&(n?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${CI(i,!0)} ms (${i}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${CI(-i,!0)} ms (${i}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!s||y>=r[0].pts||DI)){c=y;const e=r[0].pts-i;if(n)r[0].dts=c,r[0].pts=e;else{let t=!0;for(let n=0;n<r.length&&!(r[n].dts>e&&t);n++){const e=r[n].pts;if(r[n].dts-=i,r[n].pts-=i,n<r.length-1){const i=r[n+1].pts;t=i<=r[n].pts==i<=e}}}this.log(`Video: Initial PTS/DTS adjusted: ${CI(e,!0)}/${CI(c,!0)}, delta: ${CI(i,!0)} ms`)}}c=Math.max(0,c);let b=0,S=0,T=c;for(let B=0;B<o;B++){const e=r[B],t=e.units,i=t.length;let n=0;for(let s=0;s<i;s++)n+=t[s].data.length;S+=n,b+=i,e.length=n,e.dts<T?(e.dts=T,T+=E/4|0||1):T=e.dts,m=Math.min(e.pts,m),p=Math.max(e.pts,p)}d=r[o-1].dts;const k=S+4*b+8;let w;try{w=new Uint8Array(k)}catch(O){return void this.observer.emit(QE.ERROR,QE.ERROR,{type:VE.MUX_ERROR,details:GE.REMUX_ALLOC_ERROR,fatal:!1,error:O,bytes:k,reason:`fail allocating video mdat ${k}`})}const I=new DataView(w.buffer);I.setUint32(0,k),w.set(II.types.mdat,4);let L=!1,C=Number.POSITIVE_INFINITY,R=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,D=Number.NEGATIVE_INFINITY;for(let B=0;B<o;B++){const e=r[B],t=e.units;let i,l=0;for(let n=0,s=t.length;n<s;n++){const e=t[n],i=e.data,s=e.data.byteLength;I.setUint32(f,s),f+=4,w.set(i,f),f+=s,l+=4+s}if(B<o-1)g=r[B+1].dts-e.dts,i=r[B+1].pts-e.pts;else{const t=this.config,a=B>0?e.dts-r[B-1].dts:E;if(i=B>0?e.pts-r[B-1].pts:E,t.stretchShortVideoTrack&&null!==this.nextAudioTs){const i=Math.floor(t.maxBufferHole*s),r=(n?m+n*s:this.nextAudioTs+u)-e.pts;r>i?(g=r-a,g<0?g=a:L=!0,this.log(`It is approximately ${r/90} ms to the next segment; using duration ${g/90} ms for the last video frame.`)):g=a}else g=a}const c=Math.round(e.pts-e.dts);C=Math.min(C,g),x=Math.max(x,g),R=Math.min(R,i),D=Math.max(D,i),a.push(MI(e.key,g,l,c))}if(a.length)if(DI){if(DI<70){const e=a[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(PI&&D-R<x-C&&E/x<.025&&0===a[0].cts){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let e=c;for(let t=0,i=a.length;t<i;t++){const n=e+a[t].duration,s=e+a[t].cts;if(t<i-1){const e=n+a[t+1].cts;a[t].duration=e-s}else a[t].duration=t?a[t-1].duration:E;a[t].cts=0,e=n}}g=L||!g?E:g;const P=d+g;this.nextVideoTs=h=P-u,this.videoSampleDuration=g,this.isVideoContiguous=!0;const M={data1:II.moof(e.sequenceNumber++,c,tb(e,{samples:a})),data2:w,startPTS:(m-u)/s,endPTS:(p+g-u)/s,startDTS:(c-u)/s,endDTS:h/s,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,M}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(e,t,i,n,s){const r=e.inputTimeScale,a=r/(e.samplerate?e.samplerate:r),o=this.getSamplesPerFrame(e),l=o*a,u=this._initPTS,c="mp3"===e.segmentCodec&&this.typeSupported.mpeg,d=[],h=void 0!==s;let f=e.samples,g=c?0:8,m=this.nextAudioTs||-1;const p=u.baseTime*r/u.timescale,v=p+t*r;if(this.isAudioContiguous=i=i||f.length&&m>0&&(n&&Math.abs(v-(m+p))<9e3||Math.abs(BI(f[0].pts,v)-(m+p))<20*l),f.forEach(function(e){e.pts=BI(e.pts,v)}),!i||m<0){const e=f.length;if(f=f.filter(e=>e.pts>=0),e!==f.length&&this.warn(`Removed ${f.length-e} of ${e} samples (initPTS ${p} / ${r})`),!f.length)return;m=0===s?0:n&&!h?Math.max(0,v-p):f[0].pts-p}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let i=0,n=m+p;i<f.length;i++){const s=f[i],a=s.pts,o=a-n,u=Math.abs(1e3*o/r);if(o<=-t*l&&h)0===i&&(this.warn(`Audio frame @ ${(a/r).toFixed(3)}s overlaps marker by ${Math.round(1e3*o/r)} ms.`),this.nextAudioTs=m=a-p,n=a);else if(o>=t*l&&u<1e4&&h){let t=Math.round(o/l);for(n=a-t*l;n<0&&t&&l;)t--,n+=l;0===i&&(this.nextAudioTs=m=n-p),this.warn(`Injecting ${t} audio frames @ ${((n-p)/r).toFixed(3)}s due to ${Math.round(1e3*o/r)} ms gap.`);for(let r=0;r<t;r++){let t=kI.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);t||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),t=s.unit.subarray()),f.splice(i,0,{unit:t,pts:n}),n+=l,i++}}s.pts=n,n+=l}}let y,A=null,E=null,b=0,S=f.length;for(;S--;)b+=f[S].unit.byteLength;for(let x=0,D=f.length;x<D;x++){const t=f[x],n=t.unit;let s=t.pts;if(null!==E){d[x-1].duration=Math.round((s-E)/a)}else{if(i&&"aac"===e.segmentCodec&&(s=m+p),A=s,!(b>0))return;b+=g;try{y=new Uint8Array(b)}catch(R){return void this.observer.emit(QE.ERROR,QE.ERROR,{type:VE.MUX_ERROR,details:GE.REMUX_ALLOC_ERROR,fatal:!1,error:R,bytes:b,reason:`fail allocating audio mdat ${b}`})}if(!c){new DataView(y.buffer).setUint32(0,b),y.set(II.types.mdat,4)}}y.set(n,g);const r=n.byteLength;g+=r,d.push(MI(!0,o,r,0)),E=s}const T=d.length;if(!T)return;const k=d[d.length-1];m=E-p,this.nextAudioTs=m+a*k.duration;const w=c?new Uint8Array(0):II.moof(e.sequenceNumber++,A/a,tb({},e,{samples:d}));e.samples=[];const I=(A-p)/r,L=this.nextAudioTs/r,C={data1:w,data2:y,startPTS:I,endPTS:L,startDTS:I,endDTS:L,type:"audio",hasAudio:!0,hasVideo:!1,nb:T};return this.isAudioContiguous=!0,C}}function BI(e,t){let i;if(null===t)return e;for(i=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=i;return e}function FI(e,t,i,n){const s=e.samples.length;if(!s)return;const r=e.inputTimeScale;for(let o=0;o<s;o++){const s=e.samples[o];s.pts=BI(s.pts-i.baseTime*r/i.timescale,t*r)/r,s.dts=BI(s.dts-n.baseTime*r/n.timescale,t*r)/r}const a=e.samples;return e.samples=[],{samples:a}}function _I(e,t,i){const n=e.samples.length;if(!n)return;const s=e.inputTimeScale;for(let a=0;a<n;a++){const n=e.samples[a];n.pts=BI(n.pts-i.baseTime*s/i.timescale,t*s)/s}e.samples.sort((e,t)=>e.pts-t.pts);const r=e.samples;return e.samples=[],{samples:r}}function NI(e,t,i=!1){return void 0!==(null==e?void 0:e.start)?(e.start+(i?e.duration:0))/e.timescale:t}function UI(e,t,i){const n=e.codec;if(n&&n.length>4)return n;if(t===Ib){if("ec-3"===n||"ac-3"===n||"alac"===n)return n;if("fLaC"===n||"Opus"===n){return pS(n,!1)}return i.warn(`Unhandled audio codec "${n}" in mp4 MAP`),n||"mp4a"}return i.warn(`Unhandled video codec "${n}" in mp4 MAP`),n||"avc1"}try{xI=self.performance.now.bind(self.performance)}catch(IP){xI=Date.now}const jI=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,n){const s=this.videoTrack=Ww("video",1),r=this.audioTrack=Ww("audio",1),a=this.txtTrack=Ww("text",1);if(this.id3Track=Ww("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const o=Qb(e);if(o.video){const{id:e,timescale:t,codec:i,supplemental:n}=o.video;s.id=e,s.timescale=a.timescale=t,s.codec=i,s.supplemental=n}if(o.audio){const{id:e,timescale:t,codec:i}=o.audio;r.id=e,r.timescale=t,r.codec=i}a.id=Fb.text,s.sampleDuration=0,s.duration=r.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let i=0;i<t;){const n=Ub(e,i);if(n>8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=n>1?i+n:t}return!1}(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Zb(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},i=Vb(e,["moof"]);if(i.length<2)return t.remainder=e,t;const n=i[i.length-1];return t.valid=e.slice(0,n.byteOffset-8),t.remainder=e.slice(n.byteOffset-8),t}(i);this.remainderData=t.remainder,n.samples=t.valid||new Uint8Array}else n.samples=i;const r=this.extractID3Track(n,t);return s.samples=Jb(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:r,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const n=this.extractID3Track(t,this.timeOffset);return i.samples=Jb(e,t),{videoTrack:t,audioTrack:Ww(),id3Track:n,textTrack:Ww()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=Vb(e.samples,["emsg"]);n&&n.forEach(e=>{const n=function(e){const t=e[0];let i="",n="",s=0,r=0,a=0,o=0,l=0,u=0;if(0===t){for(;"\0"!==_b(e.subarray(u,u+1));)i+=_b(e.subarray(u,u+1)),u+=1;for(i+=_b(e.subarray(u,u+1)),u+=1;"\0"!==_b(e.subarray(u,u+1));)n+=_b(e.subarray(u,u+1)),u+=1;n+=_b(e.subarray(u,u+1)),u+=1,s=Ub(e,12),r=Ub(e,16),o=Ub(e,20),l=Ub(e,24),u=28}else if(1===t){u+=4,s=Ub(e,u),u+=4;const t=Ub(e,u);u+=4;const r=Ub(e,u);for(u+=4,a=2**32*t+r,jE(a)||(a=Number.MAX_SAFE_INTEGER,cb.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Ub(e,u),u+=4,l=Ub(e,u),u+=4;"\0"!==_b(e.subarray(u,u+1));)i+=_b(e.subarray(u,u+1)),u+=1;for(i+=_b(e.subarray(u,u+1)),u+=1;"\0"!==_b(e.subarray(u,u+1));)n+=_b(e.subarray(u,u+1)),u+=1;n+=_b(e.subarray(u,u+1)),u+=1}return{schemeIdUri:i,value:n,timeScale:s,presentationTime:a,presentationTimeDelta:r,eventDuration:o,id:l,payload:e.subarray(u,e.byteLength)}}(e);if(uI.test(n.schemeIdUri)){const e=cI(n,t);let s=4294967295===n.eventDuration?Number.POSITIVE_INFINITY:n.eventDuration/n.timeScale;s<=.001&&(s=Number.POSITIVE_INFINITY);const r=n.payload;i.samples.push({data:r,len:r.byteLength,dts:e,pts:e,type:zw.emsg,duration:s})}else if(this.config.enableEmsgKLVMetadata&&n.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const e=cI(n,t);i.samples.push({data:n.payload,len:n.payload.byteLength,dts:e,pts:e,type:zw.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}},remux:class extends sb{constructor(e,t,i,n){super("passthrough-remuxer",n),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,n),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:n}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const{audio:s,video:r}=this.initData=Qb(e);if(t)!function(e,t){if(!e||!t)return;const i=t.keyId;i&&t.isCommonEncryption&&$b(e,(e,t)=>{const n=e.subarray(8,24);n.some(e=>0!==e)||(cb.log(`[eme] Patching keyId in 'enc${t?"a":"v"}>sinf>>tenc' box: ${gb(n)} -> ${gb(i)}`),e.set(i,8))})}(e,t);else{const e=s||r;null!=e&&e.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${e.codec}")!`)}s&&(i=UI(s,Ib,this)),r&&(n=UI(r,Lb,this));const a={};s&&r?a.audiovideo={container:"video/mp4",codec:i+","+n,supplemental:r.supplemental,encrypted:r.encrypted,initSegment:e,id:"main"}:s?a.audio={container:"audio/mp4",codec:i,encrypted:s.encrypted,initSegment:e,id:"audio"}:r?a.video={container:"video/mp4",codec:n,supplemental:r.supplemental,encrypted:r.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=a}remux(e,t,i,n,s,r){var a,o;let{initPTS:l,lastEndTime:u}=this;const c={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};UE(u)||(u=this.lastEndTime=s||0);const d=t.samples;if(!d.length)return c;const h={initPTS:void 0,timescale:void 0,trackId:void 0};let f=this.initData;if(null!=(a=f)&&a.length||(this.generateInitSegment(d),f=this.initData),null==(o=f)||!o.length)return this.warn("Failed to generate initSegment."),c;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1);const g=function(e,t,i){const n={},s=Vb(e,["moof","traf"]);for(let r=0;r<s.length;r++){const e=s[r],a=Vb(e,["tfhd"])[0],o=Ub(a,4),l=t[o];if(!l)continue;n[o]||(n[o]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type});const u=n[o],c=Vb(e,["tfdt"])[0];if(c){const e=c[0];let t=Ub(c,4);1===e&&(t===Ob?i.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(t*=Ob+1,t+=Ub(c,8))),UE(t)&&(!UE(u.start)||t<u.start)&&(u.start=t)}const d=l.default,h=Ub(a,0)|(null==d?void 0:d.flags);let f=(null==d?void 0:d.duration)||0;8&h&&(f=Ub(a,2&h?12:8));const g=Vb(e,["trun"]);let m=u.start||0,p=0,v=f;for(let t=0;t<g.length;t++){const e=g[t],i=Ub(e,4),n=u.sampleCount;u.sampleCount+=i;const s=1&e[3],r=4&e[3],a=1&e[2],o=2&e[2],l=4&e[2],c=8&e[2];let d=8,h=i;for(s&&(d+=4),r&&i&&(1&e[d+1]||void 0!==u.keyFrameIndex||(u.keyFrameIndex=n),d+=4,a?(v=Ub(e,d),d+=4):v=f,o&&(d+=4),c&&(d+=4),m+=v,p+=v,h--);h--;)a?(v=Ub(e,d),d+=4):v=f,o&&(d+=4),l&&(1&e[d+1]||void 0===u.keyFrameIndex&&(u.keyFrameIndex=u.sampleCount-(h+1),u.keyFrameStart=m),d+=4),c&&(d+=4),m+=v,p+=v;!p&&f&&(p+=f*i)}u.duration+=p}if(!Object.keys(n).some(e=>n[e].duration)){let t=1/0,i=0;const s=Vb(e,["sidx"]);for(let e=0;e<s.length;e++){const n=Gb(s[e]);if(null!=n&&n.references){t=Math.min(t,n.earliestPresentationTime/n.timescale);const e=n.references.reduce((e,t)=>e+t.info.duration||0,0);i=Math.max(i,e+n.earliestPresentationTime/n.timescale)}}i&&UE(i)&&Object.keys(n).forEach(e=>{n[e].duration||(n[e].duration=i*n[e].timescale-n[e].start)})}return n}(d,f,this),m=f.audio?g[f.audio.id]:null,p=f.video?g[f.video.id]:null,v=NI(p,1/0),y=NI(m,1/0),A=NI(p,0,!0),E=NI(m,0,!0);let b=s,S=0;const T=m&&(!p||!l&&y<v||l&&l.trackId===f.audio.id),k=T?m:p;if(k){const e=k.timescale,t=k.start-s*e,i=T?f.audio.id:f.video.id;b=k.start/e,S=T?E-y:A-v,!r&&l||!function(e,t,i,n){if(null===e)return!0;const s=Math.max(n,1),r=t-e.baseTime/e.timescale;return Math.abs(r-i)>s}(l,b,s,S)&&e===l.timescale||(l&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${s} ${t/e} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${b-s} (${t}/${e}) trackId: ${i}`),l=null,h.initPTS=t,h.timescale=e,h.trackId=i)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${s}`);l?(h.initPTS=l.baseTime,h.timescale=l.timescale,h.trackId=l.trackId):(h.timescale&&void 0!==h.trackId&&void 0!==h.initPTS||(this.warn("Could not set initPTS"),h.initPTS=b,h.timescale=1,h.trackId=-1),this.initPTS=l={baseTime:h.initPTS,timescale:h.timescale,trackId:h.trackId});const w=b-l.baseTime/l.timescale,I=w+S;S>0?this.lastEndTime=I:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const L=!!f.audio,C=!!f.video;let R="";L&&(R+="audio"),C&&(R+="video");const x={data1:d,startPTS:w,startDTS:w,endPTS:I,endDTS:I,type:R,hasAudio:L,hasVideo:C,nb:1,dropped:0,encrypted:!!f.audio&&f.audio.encrypted||!!f.video&&f.video.encrypted};c.audio=L&&!C?x:void 0,c.video=C?x:void 0;const D=null==p?void 0:p.sampleCount;if(D){const e=p.keyFrameIndex,t=-1!==e;x.nb=D,x.dropped=0===e||this.isVideoContiguous?0:t?e:D,x.independent=t,x.firstKeyFrame=e,t&&p.keyFrameStart&&(x.firstKeyFramePTS=(p.keyFrameStart-l.baseTime)/l.timescale),this.isVideoContiguous||(c.independent=t),this.isVideoContiguous||(this.isVideoContiguous=t),x.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${e}/${D} dropped: ${x.dropped} start: ${x.firstKeyFramePTS||"NA"}`)}return c.initSegment=h,c.id3=FI(i,s,l,l),n.samples.length&&(c.text=_I(n,s,l)),c}}},{demux:vI,remux:OI},{demux:class extends qw{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=Cw(e,0);let n=(null==i?void 0:i.length)||0;if(rI(e,n))return!1;for(let s=e.length;n<s;n++)if(Mw(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return function(e,t){return function(e,t){return t+5<e.length}(e,t)&&Rw(e,t)&&Dw(e,t)<=e.length-t}(e,t)}appendFrame(e,t,i){Ow(e,this.observer,t,i,e.manifestCodec);const n=Fw(e,t,i,this.basePTS,this.frameIndex);if(n&&0===n.missing)return n}},remux:OI},{demux:class extends qw{resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Cw(e,0);let i=(null==t?void 0:t.length)||0;if(t&&11===e[i]&&119===e[i+1]&&void 0!==Kw(t)&&aI(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(rI(e,i))return cb.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return function(e,t){return nI(e,t)&&4<=e.length-t}(e,t)}appendFrame(e,t,i){if(null!==this.basePTS)return tI(e,t,i,this.basePTS,this.frameIndex)}},remux:OI}];jI.splice(2,0,{demux:oI,remux:OI});class HI{constructor(e,t,i,n,s,r){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.id=s,this.logger=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const s=i.transmuxing;s.executeStart=xI();let r=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:o}=this;n&&(this.currentTransmuxState=n);const{contiguous:l,discontinuity:u,trackSwitch:c,accurateTimeOffset:d,timeOffset:h,initSegmentChange:f}=n||a,{audioCodec:g,videoCodec:m,defaultInitPts:p,duration:v,initSegmentData:y}=o,A=function(e,t){let i=null;e.byteLength>0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(i=t);return i}(r,t);if(A&&JT(A.method)){const e=this.getDecrypter(),t=ek(A.method);if(!e.isSync())return this.asyncResult=!0,this.decryptionPromise=e.webCryptoDecrypt(r,A.key.buffer,A.iv.buffer,t).then(e=>{const t=this.push(e,null,i);return this.decryptionPromise=null,t}),this.decryptionPromise;{let n=e.softwareDecrypt(r,A.key.buffer,A.iv.buffer,t);if(i.part>-1){const t=e.flush();n=t?t.buffer:t}if(!n)return s.executeEnd=xI(),VI(i);r=new Uint8Array(n)}}const E=this.needsProbing(u,c);if(E){const e=this.configureTransmuxer(r);if(e)return this.logger.warn(`[transmuxer] ${e.message}`),this.observer.emit(QE.ERROR,QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),s.executeEnd=xI(),VI(i)}(u||c||f||E)&&this.resetInitSegment(y,g,m,v,t),(u||f||E)&&this.resetInitialTimestamp(p),l||this.resetContiguity();const b=this.transmux(r,A,h,d,i);this.asyncResult=GI(b);const S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,s.executeEnd=xI(),b}flush(e){const t=e.transmuxing;t.executeStart=xI();const{decrypter:i,currentTransmuxState:n,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const r=[],{timeOffset:a}=n;if(i){const t=i.flush();t&&r.push(this.push(t.buffer,null,e))}const{demuxer:o,remuxer:l}=this;if(!o||!l){t.executeEnd=xI();const i=[VI(e)];return this.asyncResult?Promise.resolve(i):i}const u=o.flush(a);return GI(u)?(this.asyncResult=!0,u.then(t=>(this.flushRemux(r,t,e),r))):(this.flushRemux(r,u,e),this.asyncResult?Promise.resolve(r):r)}flushRemux(e,t,i){const{audioTrack:n,videoTrack:s,id3Track:r,textTrack:a}=t,{accurateTimeOffset:o,timeOffset:l}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===YE?"level":"track"} ${i.level}`);const u=this.remuxer.remux(n,s,r,a,l,o,!0,this.id);e.push({remuxResult:u,chunkMeta:i}),i.transmuxing.executeEnd=xI()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,n,s){const{demuxer:r,remuxer:a}=this;r&&a&&(r.resetInitSegment(e,t,i,n),a.resetInitSegment(e,t,i,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,n,s){let r;return r=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,n,s):this.transmuxUnencrypted(e,i,n,s),r}transmuxUnencrypted(e,t,i,n){const{audioTrack:s,videoTrack:r,id3Track:a,textTrack:o}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,r,a,o,t,i,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,i,n,s){return this.demuxer.demuxSampleAes(e,t,i).then(e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,n,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:n}=this;let s;for(let c=0,d=jI.length;c<d;c++){var r;if(null!=(r=jI[c].demux)&&r.probe(e,this.logger)){s=jI[c];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const a=this.demuxer,o=this.remuxer,l=s.remux,u=s.demux;o&&o instanceof l||(this.remuxer=new l(i,t,n,this.logger)),a&&a instanceof u||(this.demuxer=new u(i,t,n,this.logger),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new RT(this.config)),e}}const VI=e=>({remuxResult:{},chunkMeta:e});function GI(e){return"then"in e&&e.then instanceof Function}class QI{constructor(e,t,i,n,s){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=n,this.defaultInitPts=s||null}}class KI{constructor(e,t,i,n,s,r){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=n,this.timeOffset=s,this.initSegmentChange=r}}let zI=0;class WI{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=zI++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=e=>{const t=e.data,i=this.hls;if(i&&null!=t&&t.event&&t.instanceNo===this.instanceNo)switch(t.event){case"init":{var n;const e=null==(n=this.workerContext)?void 0:n.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":i.logger[t.data.logType]&&i.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.part=this.part,t.data.id=this.id,i.trigger(t.event,t.data)}},this.onWorkerError=e=>{if(!this.hls)return;const t=new Error(`${e.message} (${e.filename}:${e.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(QE.ERROR,{type:VE.OTHER_ERROR,details:GE.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:t})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const r=(e,t)=>{(t=t||{}).frag=this.frag||void 0,e===QE.ERROR&&(t.parent=this.id,t.part=this.part,this.error=t.error),this.hls.trigger(e,t)};this.observer=new Sw,this.observer.on(QE.FRAG_DECRYPTED,r),this.observer.on(QE.ERROR,r);const a=ES(s.preferManagedMediaSource);if(this.useWorker&&"undefined"!=typeof Worker){const i=this.hls.logger;if(s.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{s.workerPath?(i.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=function(e){const t=kw[e];if(t)return t.clientCount++,t;const i=new self.URL(e,self.location.href).href,n={worker:new self.Worker(i),scriptURL:i,clientCount:1};return kw[e]=n,n}(s.workerPath)):(i.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=kw[Tw];if(e)return e.clientCount++,e;const t=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),i=self.URL.createObjectURL(t),n={worker:new self.Worker(i),objectURL:i,clientCount:1};return kw[Tw]=n,n}());const{worker:e}=this.workerContext;e.addEventListener("message",this.onWorkerMessage),e.addEventListener("error",this.onWorkerError),e.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:a,id:t,config:US(s)})}catch(IP){i.warn(`Error setting up "${t}" Web Worker, fallback to inline`,IP),this.terminateWorker(),this.error=null,this.transmuxer=new HI(this.observer,a,s,"",t,e.logger)}return}}this.transmuxer=new HI(this.observer,a,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=zI++;const t=this.hls.config,i=ES(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:US(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),function(e){const t=kw[e||Tw];if(t&&1===t.clientCount--){const{worker:i,objectURL:n}=t;delete kw[e||Tw],n&&self.URL.revokeObjectURL(n),i.terminate()}}(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,n,s,r,a,o,l,u){var c,d;l.transmuxing.start=self.performance.now();const{instanceNo:h,transmuxer:f}=this,g=r?r.start:s.start,m=s.decryptdata,p=this.frag,v=!(p&&s.cc===p.cc),y=!(p&&l.level===p.level),A=p?l.sn-p.sn:-1,E=this.part?l.part-this.part.index:-1,b=0===A&&l.id>1&&l.id===(null==p?void 0:p.stats.chunkCount),S=!y&&(1===A||0===A&&(1===E||b&&E<=0)),T=self.performance.now();(y||A||0===s.stats.parsing.start)&&(s.stats.parsing.start=T),!r||!E&&S||(r.stats.parsing.start=T);const k=!(p&&(null==(c=s.initSegment)?void 0:c.url)===(null==(d=p.initSegment)?void 0:d.url)),w=new KI(v,S,o,y,g,k);if(!S||v||k){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${l.sn}${l.part>-1?" part: "+l.part:""} ${this.id===YE?"level":"track"}: ${l.level} id: ${l.id}\n discontinuity: ${v}\n trackSwitch: ${y}\n contiguous: ${S}\n accurateTimeOffset: ${o}\n timeOffset: ${g}\n initSegmentChange: ${k}`);const e=new QI(i,n,t,a,u);this.configureTransmuxer(e)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:h,cmd:"demux",data:e,decryptdata:m,chunkMeta:l,state:w},e instanceof ArrayBuffer?[e]:[]);else if(f){const t=f.push(e,m,l,w);GI(t)?t.then(e=>{this.handleTransmuxComplete(e)}).catch(e=>{this.transmuxerError(e,l,"transmuxer-interface push error")}):this.handleTransmuxComplete(t)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const t=i.flush(e);GI(t)?t.then(t=>{this.handleFlushResult(t,e)}).catch(t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}):this.handleFlushResult(t,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(e=>{this.handleTransmuxComplete(e)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}class qI extends sb{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const n=null==t?void 0:t.renditionReports;if(n){let r=-1;for(let i=0;i<n.length;i++){const a=n[i];let o;try{o=new self.URL(a.URI,t.url).href}catch(s){this.warn(`Could not construct new URL for Rendition Report: ${s}`),o=a.URI||""}if(o===e){r=i;break}o===e.substring(0,o.length)&&(r=i)}if(-1!==r){const e=n[r],s=parseInt(e["LAST-MSN"])||t.lastPartSn;let a=parseInt(e["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const e=Math.min(t.age-t.partTarget,t.targetduration);a>=0&&e>t.partTarget&&(a+=1)}const o=i&&OS(i);return new BS(s,a>=0?a:void 0,o)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:n,stats:s}=t,r=self.performance.now(),a=s.loading.first?Math.max(0,r-s.loading.first):0;n.advancedDateTime=Date.now()-a;const o=this.hls.config.timelineOffset;if(o!==n.appliedTimelineOffset){const e=Math.max(o||0,0);n.appliedTimelineOffset=e,n.fragments.forEach(t=>{t.setStart(t.playlistOffset+e)})}if(n.live||null!=i&&i.live){const o="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){Uk(i,n,this);const e=n.playlistParsingError;if(e){this.warn(e);const i=this.hls;if(!i.config.ignorePlaylistParsingErrors){var l;const{networkDetails:r}=t;return void i.trigger(QE.ERROR,{type:VE.NETWORK_ERROR,details:GE.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:e,reason:e.message,level:t.level||void 0,parent:null==(l=n.fragments[0])?void 0:l.type,networkDetails:r,stats:s})}n.playlistParsingError=null}}-1===n.requestScheduled&&(n.requestScheduled=s.loading.start);const u=this.hls.mainForwardBufferInfo,c=u?u.end-u.len:0,d=Gk(n,1e3*(n.edge-c));if(n.requestScheduled+d<r?n.requestScheduled=r:n.requestScheduled+=d,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let h,f,g;if(n.canBlockReload&&n.endSN&&n.advanced){const e=this.hls.config.lowLatencyMode,s=n.lastPartSn,a=n.endSN,l=n.lastPartIndex,u=s===a;-1!==l?u?(f=a+1,g=e?0:l):(f=s,g=e?l+1:n.maxPartIndex):f=a+1;const c=n.age,d=c+n.ageHeader;let m=Math.min(d-n.partTarget,1.5*n.targetduration);if(m>0){if(d>3*n.targetduration)this.log(`Playlist last advanced ${c.toFixed(2)}s ago. Omitting segment and part directives.`),f=void 0,g=void 0;else if(null!=i&&i.tuneInGoal&&d-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${m} with playlist age: ${n.age}`),m=0;else{const e=Math.floor(m/n.targetduration);if(f+=e,void 0!==g){g+=Math.round(m%n.targetduration/n.partTarget)}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${c.toFixed(2)}s goal: ${m} skip sn ${e} to part ${g}`)}n.tuneInGoal=m}if(h=this.getDeliveryDirectives(n,t.deliveryDirectives,f,g),e||!u)return n.requestScheduled=r,void this.loadingPlaylist(o,h)}else(n.canBlockReload||n.canSkipUntil)&&(h=this.getDeliveryDirectives(n,t.deliveryDirectives,f,g));h&&void 0!==f&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(d-2*a,d/2)),this.scheduleLoading(o,h,n)}else this.clearTimer()}scheduleLoading(e,t,i){const n=i||e.details;if(!n)return void this.loadingPlaylist(e,t);const s=self.performance.now(),r=n.requestScheduled;if(s>=r)return void this.loadingPlaylist(e,t);const a=r-s;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(a)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),a)}getDeliveryDirectives(e,t,i,n){let s=OS(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=DS),new BS(i,n,s)}checkRetry(e){const t=e.details,i=JS(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:a}=n||{},o=!!n&&!!a&&(s===cT||!n.resolved&&s===lT);if(o){var l;if(r>=a.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${r+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=nT(a,r);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),e),this.warn(`Retrying playlist loading ${r+1}/${a.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,n.resolved=!0}return o}}function YI(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!$I(e[i].attrs,t[i].attrs))return!1;return!0}function $I(e,t,i){const n=e["STABLE-RENDITION-ID"];return n&&!i?n===t["STABLE-RENDITION-ID"]:!(i||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>e[i]!==t[i])}function XI(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class ZI{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(null===this.queues||null===this.tracks)return;const n=this.queues[t];n.push(e),1!==n.length||i||this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){null!==this.queues&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=null==(t=e[0])?void 0:t.label;"async-blocker"!==i&&"async-blocker-prepend"!==i||(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(null===this.queues)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(null===this.queues||null===this.tracks)return;const t=this.queues[e];if(t.length){const s=t[0];try{s.execute()}catch(n){var i;if(s.onError(n),null===this.queues||null===this.tracks)return;const t=null==(i=this.tracks[e])?void 0:i.buffer;null!=t&&t.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){null!==this.queues&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return(null==(t=this.queues)?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return null===e||null===t?"<destroyed>":`\n${this.list("video")}\n${this.list("audio")}\n${this.list("audiovideo")}}`}list(e){var t,i;return null!=(t=this.queues)&&t[e]||null!=(i=this.tracks)&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=null==(t=this.tracks)?void 0:t[e],n=null==i?void 0:i.buffer;return n?`SourceBuffer${n.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return(null==(t=this.queues)?void 0:t[e].map(e=>e.label).join(", "))||""}}const JI=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,eL="HlsJsTrackRemovedError";class tL extends Error{constructor(e){super(e),this.name=eL}}function iL(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach(t=>{e.removeChild(t)})}function nL(e){return"audio"===e?1:0}class sL{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(QE.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.on(QE.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(QE.BUFFER_CODECS,this.onBufferCodecs,this),e.on(QE.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(QE.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.off(QE.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(QE.BUFFER_CODECS,this.onBufferCodecs,this),e.off(QE.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&UE(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((t,i)=>this.isLevelAllowed(t)&&i<=e);return this.clientRect=null,sL.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height)}static getMaxLevelByMediaSize(e,t,i){if(null==e||!e.length)return-1;const n=(e,t)=>!t||(e.width!==t.width||e.height!==t.height);let s=e.length-1;const r=Math.max(t,i);for(let a=0;a<e.length;a+=1){const t=e[a];if((t.width>=r||t.height>=r)&&n(t,e[a+1])){s=a;break}}return s}}const rL={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},aL={HLS:"h"};class oL{constructor(e,t){Array.isArray(e)&&(e=e.map(e=>e instanceof oL?e:new oL(e))),this.value=e,this.params=t}}function lL(e,t,i,n){return new Error(`failed to ${e} "${s=t,Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":"object"==typeof s?JSON.stringify(s):String(s)}" as ${i}`,{cause:n});var s}function uL(e,t,i){return lL("serialize",e,t,i)}class cL{constructor(e){this.description=e}}const dL="Bare Item";function hL(e){if(!1===ArrayBuffer.isView(e))throw uL(e,"Byte Sequence");return`:${t=e,btoa(String.fromCharCode(...t))}:`;var t}function fL(e){if(function(e){return e<-999999999999999||999999999999999<e}(e))throw uL(e,"Integer");return e.toString()}function gL(e,t){if(e<0)return-gL(-e,t);const i=Math.pow(10,t);if(Math.abs(e*i%1-.5)<Number.EPSILON){const t=Math.floor(e*i);return(t%2==0?t:t+1)/i}return Math.round(e*i)/i}function mL(e){const t=gL(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw uL(e,"Decimal");const i=t.toString();return i.includes(".")?i:`${i}.0`}const pL=/[\x00-\x1f\x7f]+/;function vL(e){const t=(i=e).description||i.toString().slice(7,-1);var i;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw uL(t,"Token");return t}function yL(e){switch(typeof e){case"number":if(!UE(e))throw uL(e,dL);return Number.isInteger(e)?fL(e):mL(e);case"string":return function(e){if(pL.test(e))throw uL(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(e);case"symbol":return vL(e);case"boolean":return function(e){if("boolean"!=typeof e)throw uL(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return`@${fL(e.getTime()/1e3)}`}(e);if(e instanceof Uint8Array)return hL(e);if(e instanceof cL)return vL(e);default:throw uL(e,dL)}}function AL(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw uL(e,"Key");return e}function EL(e){return null==e?"":Object.entries(e).map(([e,t])=>!0===t?`;${AL(e)}`:`;${AL(e)}=${yL(t)}`).join("")}function bL(e){return e instanceof oL?`${yL(e.value)}${EL(e.params)}`:yL(e)}function SL(e,t={whitespace:!0}){if("object"!=typeof e||null==e)throw uL(e,"Dict");const i=e instanceof Map?e.entries():Object.entries(e),n=(null==t?void 0:t.whitespace)?" ":"";return Array.from(i).map(([e,t])=>{t instanceof oL==!1&&(t=new oL(t));let i=AL(e);var n;return!0===t.value?i+=EL(t.params):(i+="=",Array.isArray(t.value)?i+=`(${(n=t).value.map(bL).join(" ")})${EL(n.params)}`:i+=bL(t)),i}).join(`,${n}`)}function TL(e,t){return SL(e,t)}const kL="CMCD-Object",wL="CMCD-Request",IL="CMCD-Session",LL="CMCD-Status",CL={br:kL,ab:kL,d:kL,ot:kL,tb:kL,tpb:kL,lb:kL,tab:kL,lab:kL,url:kL,pb:wL,bl:wL,tbl:wL,dl:wL,ltc:wL,mtp:wL,nor:wL,nrr:wL,rc:wL,sn:wL,sta:wL,su:wL,ttfb:wL,ttfbb:wL,ttlb:wL,cmsdd:wL,cmsds:wL,smrt:wL,df:wL,cs:wL,ts:wL,cid:IL,pr:IL,sf:IL,sid:IL,st:IL,v:IL,msd:IL,bs:LL,bsd:LL,cdn:LL,rtp:LL,bg:LL,pt:LL,ec:LL,e:LL},RL=wL;function xL(e,t){const i={};if(!e)return i;const n=Object.keys(e),s=t?(r=t,Object.keys(r).reduce((e,t)=>{var i;return null===(i=r[t])||void 0===i||i.forEach(i=>e[i]=t),e},{})):{};var r;return n.reduce((t,i)=>{var n;const r=CL[i]||s[i]||RL;return(null!==(n=t[r])&&void 0!==n?n:t[r]={})[i]=e[i],t},i)}const DL="event";const PL=e=>Math.round(e),ML=(e,t)=>Array.isArray(e)?e.map(e=>ML(e,t)):e instanceof oL&&"string"==typeof e.value?new oL(ML(e.value,t),e.params):(t.baseUrl&&(e=function(e,t){const i=new URL(e),n=new URL(t);if(i.origin!==n.origin)return e;const s=i.pathname.split("/").slice(1),r=n.pathname.split("/").slice(1,-1);for(;s[0]===r[0];)s.shift(),r.shift();for(;r.length;)r.shift(),s.unshift("..");return s.join("/")+i.search+i.hash}(e,t.baseUrl)),1===t.version?encodeURIComponent(e):e),OL=e=>100*PL(e/100),BL={br:PL,d:PL,bl:OL,dl:OL,mtp:OL,nor:(e,t)=>{let i=e;return t.version>=2&&(e instanceof oL&&"string"==typeof e.value?i=new oL([e]):"string"==typeof e&&(i=[e])),ML(i,t)},rtp:OL,tb:PL},FL="request",_L="response",NL=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],UL=["e"],jL=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function HL(e){return jL.test(e)}const VL=["d","dl","nor","ot","rtp","su"];const GL=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];const QL=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function KL(e){return QL.includes(e)||HL(e)}const zL={[_L]:function(e){return NL.includes(e)||VL.includes(e)||GL.includes(e)||HL(e)},[DL]:function(e){return NL.includes(e)||UL.includes(e)||HL(e)},[FL]:function(e){return NL.includes(e)||VL.includes(e)||HL(e)}};function WL(e,t={}){const i={};if(null==e||"object"!=typeof e)return i;const n=t.version||e.v||1,s=t.reportingMode||FL,r=1===n?KL:zL[s];let a=Object.keys(e).filter(r);const o=t.filter;"function"==typeof o&&(a=a.filter(o));const l=s===_L||s===DL;l&&!a.includes("ts")&&a.push("ts"),n>1&&!a.includes("v")&&a.push("v");const u=tb({},BL,t.formatters),c={version:n,reportingMode:s,baseUrl:t.baseUrl};return a.sort().forEach(t=>{let s=e[t];const r=u[t];if("function"==typeof r&&(s=r(s,c)),"v"===t){if(1===n)return;s=n}"pr"==t&&1===s||(l&&"ts"===t&&!UE(s)&&(s=Date.now()),function(e){return"number"==typeof e?UE(e):null!=e&&""!==e&&!1!==e}(s)&&(function(e){return["ot","sf","st","e","sta"].includes(e)}(t)&&"string"==typeof s&&(s=new cL(s)),i[t]=s))}),i}function qL(e,t,i){return tb(e,function(e,t={}){const i={};if(!e)return i;const n=xL(WL(e,t),null==t?void 0:t.customHeaderMap);return Object.entries(n).reduce((e,[t,i])=>{const n=TL(i,{whitespace:!1});return n&&(e[t]=n),e},i)}(t,i))}function YL(e,t={}){if(!e)return"";const i=function(e,t={}){return e?TL(WL(e,t),{whitespace:!1}):""}(e,t);return encodeURIComponent(i)}const $L=/CMCD=[^&#]+/;function XL(e,t,i){const n=function(e,t={}){return e?`CMCD=${YL(e,t)}`:""}(t,i);if(!n)return e;if($L.test(e))return e.replace($L,n);const s=e.includes("?")?"&":"?";return`${e}${s}${n}`}function ZL(e,t,i,n){e&&Object.keys(t).forEach(s=>{const r=e.filter(e=>e.groupId===s).map(e=>{const r=tb({},e);return r.details=void 0,r.attrs=new zT(r.attrs),r.url=r.attrs.URI=JL(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),r.groupId=r.attrs["GROUP-ID"]=t[s],r.attrs["PATHWAY-ID"]=n,r});e.push(...r)})}function JL(e,t,i,n){const{HOST:s,PARAMS:r,[i]:a}=n;let o;t&&(o=null==a?void 0:a[t],o&&(e=o));const l=new self.URL(e);return s&&!o&&(l.host=s),r&&Object.keys(r).sort().forEach(e=>{e&&l.searchParams.set(e,r[e])}),l.href}class eC extends sb{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=eC.CDMCleanupPromise?[eC.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=e=>{const{initDataType:t,initData:i}=e,n=`"${e.type}" event: init data type: "${t}"`;if(this.debug(n),null!==i){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=fk(this.config));const t=e.map(hk).filter(e=>!!e);this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then(s=>{const r=dk(s);if("sinf"!==t||r!==ak.FAIRPLAY)return void this.log(`Ignoring "${e.type}" event with init data type: "${t}" for selected key-system ${r}`);let a;try{const e=_b(new Uint8Array(i)),t=Xb(tk(JSON.parse(e).sinf));if(!t)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");a=new Uint8Array(t.subarray(8,24))}catch(d){return void this.warn(`${n} Failed to parse sinf: ${d}`)}const o=gb(a),{keyIdToKeySessionPromise:l,mediaKeySessions:u}=this;let c=l[o];for(let e=0;e<u.length;e++){const n=u[e],s=n.decryptdata;if(!s.keyId)continue;const r=gb(s.keyId);if(XT(a,s.keyId)||-1!==s.uri.replace(/-/g,"").indexOf(o)){if(c=l[r],!c)continue;if(s.pssh)break;delete l[r],s.pssh=new Uint8Array(i),s.keyId=a,c=l[o]=c.then(()=>this.generateRequestWithPreferredKeySession(n,t,i,"encrypted-event-key-match")),c.catch(e=>this.handleError(e));break}}c||this.handleError(new Error(`Key ID ${o} not encountered in playlist. Key-system sessions ${u.length}.`))}).catch(e=>this.handleError(e))}},this.onWaitingForKey=e=>{this.log(`"${e.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(QE.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(QE.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(QE.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(QE.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(QE.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(QE.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(QE.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(QE.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=null==t?void 0:t[e];return n?n.licenseUrl:e===ak.WIDEVINE&&i?i:void 0}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(void 0===t)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=null==t?void 0:t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,n=t.map(e=>e.audioCodec).filter(i),s=t.map(e=>e.videoCodec).filter(i);return n.length+s.length===0&&s.push("avc1.42e01e"),new Promise((t,i)=>{const r=e=>{const a=e.shift();this.getMediaKeysPromise(a,n,s).then(e=>t({keySystem:a,mediaKeys:e})).catch(t=>{e.length?r(e):i(t instanceof nC?t:new nC({type:VE.KEY_SYSTEM_ERROR,details:GE.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})};r(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===gk&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){var n;const s=function(e,t,i,n){let s;switch(e){case ak.FAIRPLAY:s=["cenc","sinf"];break;case ak.WIDEVINE:case ak.PLAYREADY:s=["cenc"];break;case ak.CLEARKEY:s=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,i,n){return[{initDataTypes:e,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:t.map(e=>({contentType:`audio/mp4; codecs=${e}`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:i.map(e=>({contentType:`video/mp4; codecs=${e}`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}(s,t,i,n)}(e,t,i,this.config.drmSystemOptions||{});let r=this.keySystemAccessPromises[e],a=null==(n=r)?void 0:n.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${US(s)}`),a=this.requestMediaKeySystemAccess(e,s);const t=r=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)}),a.then(i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);const n=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const s=t.mediaKeys=i.createMediaKeys().then(i=>(this.log(`Media-keys created for "${e}"`),t.hasMediaKeys=!0,n.then(t=>t?this.setMediaKeysServerCertificate(i,e,t):i)));return s.catch(t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)}),s})}return a.then(()=>r.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${gb(e.keyId||[])} keyUri: ${e.uri}`);const n=i.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),n=tC(t),s="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,s,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${gb(e.decryptdata.keyId||[])}\n } (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>hk(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:e,mediaKeys:t})=>this.attemptSetMediaKeys(e,t))}selectKeySystem(e){return new Promise((t,i)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:e})=>{const n=hk(e);n?t(n):i(new Error(`Unable to find format for key-system "${e}"`))}).catch(i)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=fk(this.config),i=e.map(dk).filter(e=>!!e&&-1!==t.indexOf(e));return this.selectKeySystem(i)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let i=0;i<t.length;i++){const n=iC(e,t[i]);if(n)return n}}loadKey(e){const t=e.keyInfo.decryptdata,i=tC(t),n=this.bannedKeyIds[i];if(n||"internal-error"===this.getKeyStatus(t)){const i=sC(n||"internal-error",t);return this.handleError(i,e.frag),Promise.reject(i)}const s=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);const r=this.keyIdToKeySessionPromise[i];if(!r){const n=this.getKeySystemForKeyPromise(t).then(({keySystem:i,mediaKeys:n})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(i,n).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:i,mediaKeys:n,decryptdata:t}))))).then(e=>{const i=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(e,"cenc",i,"playlist-key")});return n.catch(t=>this.handleError(t,e.frag)),this.keyIdToKeySessionPromise[i]=n,n}return r.catch(i=>{if(i instanceof nC){const n=nb({},i.data);"internal-error"===this.getKeyStatus(t)&&(n.decryptdata=t);const s=new nC(n,i.message);this.handleError(s,e.frag)}}),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof nC){t&&(e.data.frag=t);const i=e.data.decryptdata;this.error(`${e.message}${i?` (${gb(i.keyId||[])})`:""}`),this.hls.trigger(QE.ERROR,e.data)}else this.error(e.message),this.hls.trigger(QE.ERROR,{type:VE.KEY_SYSTEM_ERROR,details:GE.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=tC(e),i=this.keyIdToKeySessionPromise[t];if(!i){const t=dk(e.keyFormat),i=t?[t]:fk(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=fk(this.config)),0===e.length)throw new nC({type:VE.KEY_SYSTEM_ERROR,details:GE.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${US({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>this.media?this.media.setMediaKeys(t):new Promise((e,i)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return i(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(e).catch(i)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>-1===i.indexOf(e))})}generateRequestWithPreferredKeySession(e,t,i,n){var s;const r=null==(s=this.config.drmSystems)||null==(s=s[e.keySystem])?void 0:s.generateRequest;if(r)try{const n=r.call(this.hls,t,i,e);if(!n)throw new Error("Invalid response from configured generateRequest filter");t=n.initDataType,i=n.initData?n.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(f){if(this.warn(f.message),this.hls&&this.hls.config.debug)throw f}if(null===i)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const a=tC(e.decryptdata),o=e.decryptdata.uri;this.log(`Generating key-session request for "${n}" keyId: ${a} URI: ${o} (init data type: ${t} length: ${i.byteLength})`);const l=new Sw,u=e._onmessage=t=>{const i=e.mediaKeysSession;if(!i)return void l.emit("error",new Error("invalid state"));const{messageType:n,message:s}=t;this.log(`"${n}" message event for session "${i.sessionId}" message size: ${s.byteLength}`),"license-request"===n||"license-renewal"===n?this.renewLicense(e,s).catch(e=>{l.eventNames().length?l.emit("error",e):this.handleError(e)}):"license-release"===n?e.keySystem===ak.FAIRPLAY&&this.updateKeySession(e,ik("acknowledged")).then(()=>this.removeSession(e)).catch(e=>this.handleError(e)):this.warn(`unhandled media key message type "${n}"`)},c=(e,t)=>{let i;t.keyStatus=e,e.startsWith("usable")?l.emit("resolved"):"internal-error"===e||"output-restricted"===e||"output-downscaled"===e?i=sC(e,t.decryptdata):"expired"===e?i=new Error(`key expired (keyId: ${a})`):"released"===e?i=new Error("key released"):"status-pending"===e||this.warn(`unhandled key status change "${e}" (keyId: ${a})`),i&&(l.eventNames().length?l.emit("error",i):this.handleError(i))},d=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void l.emit("error",new Error("invalid state"));const i=this.getKeyStatuses(e);if(!Object.keys(i).some(e=>"status-pending"!==i[e]))return;if("expired"===i[a])return this.log(`Expired key ${US(i)} in key-session "${e.mediaKeysSession.sessionId}"`),void this.renewKeySession(e);let n=i[a];if(n)c(n,e);else{var s;const t=1e3;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(s=e.keyStatusTimeouts)[a]||(s[a]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const i=this.getKeyStatus(e.decryptdata);if(i&&"status-pending"!==i)return this.log(`No status for keyId ${a} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${i} from other session.`),c(i,e);this.log(`key status for ${a} in key-session "${e.mediaKeysSession.sessionId}" timed out after ${t}ms`),n="internal-error",c(n,e)},t)),this.log(`No status for keyId ${a} (${US(i)}).`)}};tw(e.mediaKeysSession,"message",u),tw(e.mediaKeysSession,"keystatuseschange",d);const h=new Promise((e,t)=>{l.on("error",t),l.on("resolved",e)});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${a} URI: ${o}`)}).catch(t=>{throw new nC({type:VE.KEY_SYSTEM_ERROR,details:GE.KEY_SYSTEM_NO_SESSION,error:t,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${t}`)}).then(()=>h).catch(t=>(l.removeAllListeners(),this.removeSession(e).then(()=>{throw t}))).then(()=>(l.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((i,n)=>{if("string"==typeof n&&"object"==typeof i){const e=n;n=i,i=e}const s="buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n);if(e.keySystem===ak.PLAYREADY&&16===s.length){const e=gb(s);t[e]=i,nk(s)}const r=gb(s);"internal-error"===i&&(this.bannedKeyIds[r]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${r} key-session "${e.mediaKeysSession.sessionId}"`),t[r]=i}),t}fetchServerCertificate(e){const t=this.config,i=new(0,t.loader)(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((s,r)=>{const a={responseType:"arraybuffer",url:n},o=t.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(e,t,i,n)=>{s(e.data)},onError:(t,i,s,o)=>{r(new nC({type:VE.KEY_SYSTEM_ERROR,details:GE.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:s,response:nb({url:a.url,data:void 0},t)},`"${e}" certificate request failed (${n}). Status: ${t.code} (${t.text})`))},onTimeout:(t,i,s)=>{r(new nC({type:VE.KEY_SYSTEM_ERROR,details:GE.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:s,response:{url:a.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(e,t,i)=>{r(new Error("aborted"))}};i.load(a,l,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((n,s)=>{e.setServerCertificate(i).then(s=>{this.log(`setServerCertificate ${s?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),n(e)}).catch(e=>{s(new nC({type:VE.KEY_SYSTEM_ERROR,details:GE.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(t=>this.updateKeySession(e,new Uint8Array(t)).catch(t=>{throw new nC({type:VE.KEY_SYSTEM_ERROR,details:GE.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:t,fatal:!1},t.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const n=(new DOMParser).parseFromString(i,"application/xml"),s=n.querySelectorAll("HttpHeader");if(s.length>0){let t;for(let i=0,n=s.length;i<n;i++){var r,a;t=s[i];const n=null==(r=t.querySelector("name"))?void 0:r.textContent,o=null==(a=t.querySelector("value"))?void 0:a.textContent;n&&o&&e.setRequestHeader(n,o)}}const o=n.querySelector("Challenge"),l=null==o?void 0:o.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return ik(atob(l))}setupLicenseXHR(e,t,i,n){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,i,n)}).catch(r=>{if(!i.decryptdata)throw r;return e.open("POST",t,!0),s.call(this.hls,e,t,i,n)}).then(i=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:i||n}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((n,s)=>{const r=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${r}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return s(new Error("invalid state"));if(4===a.readyState)if(200===a.status){this._requestLicenseFailureCount=0;let t=a.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,a,r,e)}catch(o){this.error(o)}n(t)}else{const o=i.errorRetry,l=o?o.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)s(new nC({type:VE.KEY_SYSTEM_ERROR,details:GE.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:a,response:{url:r,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${r}). Status: ${a.status} (${a.statusText})`));else{const i=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(e,t).then(n,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,r,e,t).then(({xhr:t,licenseChallenge:i})=>{e.keySystem==ak.PLAYREADY&&(i=this.unpackPlayReadyKeyMessage(t,i)),t.send(i)}).catch(s)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,tw(i,"encrypted",this.onMediaEncrypted),tw(i,"waitingforkey",this.onWaitingForKey);const n=this.mediaResolved;n?n():this.mediaKeys=i.mediaKeys}onMediaDetached(){const e=this.media;e&&(iw(e,"encrypted",this.onMediaEncrypted),iw(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const i=this.media,n=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,yk.clearKeyUriToKeyIdMap();const s=n.length;eC.CDMCleanupPromise=Promise.all(n.map(e=>this.removeSession(e)).concat((null==i||null==(e=i.setMediaKeys(null))?void 0:e.catch(e=>{this.log(`Could not clear media keys: ${e}`),this.hls&&this.hls.trigger(QE.ERROR,{type:VE.OTHER_ERROR,details:GE.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${e}`)})}))||Promise.resolve())).catch(e=>{this.log(`Could not close sessions and clear media keys: ${e}`),this.hls&&this.hls.trigger(QE.ERROR,{type:VE.OTHER_ERROR,details:GE.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${e}`)})}).then(()=>{s&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i,decryptdata:n}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${gb((null==n?void 0:n.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);s>-1&&this.mediaKeySessions.splice(s,1);const{keyStatusTimeouts:r}=e;r&&Object.keys(r).forEach(e=>self.clearTimeout(r[e]));const{drmSystemOptions:a}=this.config,o=function(e){var t;return!(!e||"persistent-license"!==e.sessionType&&(null==(t=e.sessionTypes)||!t.some(e=>"persistent-license"===e)))}(a)?new Promise((e,i)=>{self.setTimeout(()=>i(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(e).catch(i)}):Promise.resolve();return o.catch(e=>{this.log(`Could not remove session: ${e}`),this.hls&&this.hls.trigger(QE.ERROR,{type:VE.OTHER_ERROR,details:GE.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${e}`)})}).then(()=>t.close()).catch(e=>{this.log(`Could not close session: ${e}`),this.hls&&this.hls.trigger(QE.ERROR,{type:VE.OTHER_ERROR,details:GE.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${e}`)})})}return Promise.resolve()}}function tC(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return gb(e.keyId)}function iC(e,t){return e.keyId&&t.mediaKeysSession.keyStatuses.has(e.keyId)?t.mediaKeysSession.keyStatuses.get(e.keyId):e.matches(t.decryptdata)?t.keyStatus:void 0}eC.CDMCleanupPromise=void 0;class nC extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function sC(e,t){const i="output-restricted"===e,n=i?GE.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:GE.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new nC({type:VE.KEY_SYSTEM_ERROR,details:n,fatal:!1,decryptdata:t},i?"HDCP level output restricted":`key status changed to "${e}"`)}function rC(e,t){let i;try{i=new Event("addtrack")}catch(IP){i=document.createEvent("Event"),i.initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function aC(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(IP){cb.debug(`[texttrack-utils]: ${IP}`);try{const i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(n){cb.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}"disabled"===i&&(e.mode=i)}function oC(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues)for(let n=e.cues.length;n--;)t&&e.cues[n].removeEventListener("enter",t),e.removeCue(e.cues[n]);"disabled"===i&&(e.mode=i)}function lC(e,t,i,n){const s=e.mode;if("disabled"===s&&(e.mode="hidden"),e.cues&&e.cues.length>0){const s=function(e,t,i){const n=[],s=function(e,t){if(t<=e[0].startTime)return 0;const i=e.length-1;if(t>e[i].endTime)return-1;let n,s=0,r=i;for(;s<=r;)if(n=Math.floor((r+s)/2),t<e[n].startTime)r=n-1;else{if(!(t>e[n].startTime&&s<i))return n;s=n+1}return e[s].startTime-t<t-e[r].startTime?s:r}(e,t);if(s>-1)for(let r=s,a=e.length;r<a;r++){const s=e[r];if(s.startTime>=t&&s.endTime<=i)n.push(s);else if(s.startTime>i)return n}return n}(e.cues,t,i);for(let t=0;t<s.length;t++)n&&!n(s[t])||e.removeCue(s[t])}"disabled"===s&&(e.mode=s)}function uC(e){const t=[];for(let i=0;i<e.length;i++){const n=e[i];"subtitles"!==n.kind&&"captions"!==n.kind||!n.label||t.push(e[i])}return t}function cC(e){let t=5381,i=e.length;for(;i;)t=33*t^e.charCodeAt(--i);return(t>>>0).toString()}const dC=.025;let hC=function(e){return e[e.Point=0]="Point",e[e.Range=1]="Range",e}({});function fC(e,t,i){return`${e.identifier}-${i+1}-${cC(t)}`}class gC{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,null==(e=this.assetListLoader)||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;if(e<=0||isNaN(i))return!1;if(0===i)return!0;return((null==(t=this.assetList[e])?void 0:t.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return mC(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(0===this.startTime||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime;return t-mC(t,e)<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=UE(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return mC(e,t)}return e}get appendInPlace(){return!!this.appendInPlaceStarted||!this.appendInPlaceDisabled&&!(this.cue.once||this.cue.pre||!this.startIsAligned||!(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<dC))}set appendInPlace(e){this.appendInPlaceStarted?this.resetOnResume=!e:this.appendInPlaceDisabled=!e}get timelineStart(){return null!==this._timelineStart?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return t=null!==this._duration?this._duration:this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return"RANGE"===this.dateRange.attr["X-TIMELINE-OCCUPIES"]?hC.Range:hC.Point}get supplementsPrimary(){return"PRIMARY"===this.dateRange.attr["X-TIMELINE-STYLE"]}get contentMayVary(){return"NO"!==this.dateRange.attr["X-CONTENT-MAY-VARY"]}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||null!==this.assetListResponse}toString(){return`["${(e=this).identifier}" ${e.cue.pre?"<pre>":e.cue.post?"<post>":""}${e.timelineStart.toFixed(2)}-${e.resumeTime.toFixed(2)}]`;var e}}function mC(e,t){return e-t.start<t.duration/2&&!(Math.abs(e-(t.start+t.duration))<dC)?t.start:t.start+t.duration}function pC(e,t,i){const n=new self.URL(e,i);return"data:"!==n.protocol&&n.searchParams.set("_HLS_primary_id",t),n}function vC(e,t){for(;null!=(i=e.assetList[++t])&&i.error;)var i;return t}function yC(e){const t=e.timelineStart,i=e.duration||0;return`["${e.identifier}" ${t.toFixed(2)}-${(t+i).toFixed(2)}]`}class AC{constructor(e,t,i,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(QE.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=i,this.assetItem=n;const r=()=>{this.hasDetails=!0};s.once(QE.LEVEL_LOADED,r),s.once(QE.AUDIO_TRACK_LOADED,r),s.once(QE.SUBTITLE_TRACK_LOADED,r),s.on(QE.MEDIA_ATTACHING,(e,{media:t})=>{this.removeMediaListeners(),this.mediaAttached=t;this.interstitial.playoutLimit&&(t.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(QE.BUFFER_APPENDED,()=>{const e=this.bufferedEnd;this.reachedPlayout(e)&&(this._bufferedEosTime=e,s.trigger(QE.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let i=this.assetItem.uri;try{i=pC(i,e.config.primarySessionId||"").href}catch(t){}e.loadSource(i)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if(null!=(t=this.hls)&&t.bufferedToEnd)return!0;if(!e)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),n=this.timelineOffset,s=NT.bufferInfo(e,n,0);return this.getAssetTime(s.end)>=i-.02}reachedPlayout(e){const t=this.interstitial.playoutLimit;return this.startOffset+e>=t}get destroyed(){var e;return!(null!=(e=this.hls)&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return(null==(e=this.hls)?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=NT.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const i=t-this.startOffset;if(i>0&&i<e)return i}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return(null==(e=this.hls)?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){var e;this.mediaAttached&&(null!=(e=this.hls)&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd))}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),null==(t=this.hls)||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,null==(e=this.hls)||e.detachMedia()}resumeBuffering(){var e;null==(e=this.hls)||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.hls)||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),(null==(e=this.hls)?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=e=>delete e.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var n;null==(n=this.hls)||n.on(e,t)}once(e,t,i){var n;null==(n=this.hls)||n.once(e,t)}off(e,t,i){var n;null==(n=this.hls)||n.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${yC(this.assetItem)} ${null==(e=this.hls)?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}class EC extends sb{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,n)=>e<=n.startOffset&&t>n.startOffset?(delete n.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const n=this.items;if(n)for(n[i]||(void 0===t&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&null!=(s=n[i])&&s.event;){var s;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let n=0;n<i.length;n++){let s=i[n];if(t&&"primary"!==t&&(s=s[t]),e===s.start||e>s.start&&e<s.end)return n}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let n=e;n<=t&&i[n];n++){const e=i[n].event;if(null!=e&&e.restrictions.jump&&!e.appendInPlace)return n}return-1}findEventIndex(e){const t=this.items;if(t)for(let n=t.length;n--;){var i;if((null==(i=t[n].event)?void 0:i.identifier)===e)return n}return-1}findAssetIndex(e,t){const i=e.assetList,n=i.length;if(n>1)for(let s=0;s<n;s++){const e=i[s];if(!e.error){const i=e.timelineStart;if(t===i||t>i&&(t<i+(e.duration||0)||s===n-1))return s}}return 0}get assetIdAtEnd(){var e;const t=null==(e=this.items)||null==(e=e[this.length-1])?void 0:e.event;if(t){const e=t.assetList,i=e[e.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:n}=i,s=this.events,r=this.parseDateRanges(n,{url:i.url},t),a=Object.keys(n),o=s?s.filter(e=>!a.includes(e.identifier)):[];r.length&&r.sort((e,t)=>{const i=e.cue.pre,n=e.cue.post,s=t.cue.pre,r=t.cue.post;if(i&&!s)return-1;if(s&&!i)return 1;if(n&&!r)return 1;if(r&&!n)return-1;if(!(i||s||n||r)){const i=e.startTime,n=t.startTime;if(i!==n)return i-n}return e.dateRange.tagOrder-t.dateRange.tagOrder}),this.events=r,o.forEach(e=>{this.removeEvent(e)}),this.updateSchedule(e,o)}updateSchedule(e,t=[],i=!1){const n=this.events||[];if(n.length||t.length||this.length<2){const s=this.items,r=this.parseSchedule(n,e);(i||t.length||(null==s?void 0:s.length)!==r.length||r.some((e,t)=>Math.abs(e.playout.start-s[t].playout.start)>.005||Math.abs(e.playout.end-s[t].playout.end)>.005))&&(this.items=r,this.onScheduleUpdate(t,s))}}parseDateRanges(e,t,i){const n=[],s=Object.keys(e);for(let r=0;r<s.length;r++){const a=s[r],o=e[a];if(o.isInterstitial){let e=this.eventMap[a];e?e.setDateRange(o):(e=new gC(o,t),this.eventMap[a]=e,!1===i&&(e.appendInPlace=i)),n.push(e)}}return n}parseSchedule(e,t){const i=[],n=t.main.details,s=n.live?1/0:n.edge;let r=0;if((e=e.filter(e=>!(e.error||e.cue.once&&e.hasPlayed))).length){this.resolveOffsets(e,t);let n=0,o=0;if(e.forEach((t,a)=>{const l=t.cue.pre,u=t.cue.post,c=e[a-1]||null,d=t.appendInPlace,h=u?s:t.startOffset,f=t.duration,g=t.timelineOccupancy===hC.Range?f:0,m=t.resumptionOffset,p=(null==c?void 0:c.startTime)===h,v=h+t.cumulativeDuration;let y=d?v+f:h+m;if(l||!u&&h<=0){const e=o;o+=g,t.timelineStart=v;const n=r;r+=f,i.push({event:t,start:v,end:y,playout:{start:n,end:r},integrated:{start:e,end:o}})}else{if(!(h<=s))return;{if(!p){const s=h-n;if(s>.033){const l=n,u=o;o+=s;const c=r;r+=s;const d={previousEvent:e[a-1]||null,nextEvent:t,start:l,end:l+s,playout:{start:c,end:r},integrated:{start:u,end:o}};i.push(d)}else s>0&&c&&(c.cumulativeDuration+=s,i[i.length-1].end=h)}u&&(y=v),t.timelineStart=v;const s=o;o+=g;const l=r;r+=f,i.push({event:t,start:v,end:y,playout:{start:l,end:r},integrated:{start:s,end:o}})}}const A=t.resumeTime;n=u||A>s?s:A}),n<s){var a;const e=n,t=o,l=s-n;o+=l;const u=r;r+=l,i.push({previousEvent:(null==(a=i[i.length-1])?void 0:a.event)||null,nextEvent:null,start:n,end:e+l,playout:{start:u,end:r},integrated:{start:t,end:o}})}this.setDurations(s,r,o)}else{const e=0;i.push({previousEvent:null,nextEvent:null,start:e,end:s,playout:{start:e,end:s},integrated:{start:e,end:s}}),this.setDurations(s,s,s)}return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,n=i.live?1/0:i.edge;let s=0,r=-1;e.forEach((a,o)=>{const l=a.cue.pre,u=a.cue.post,c=l?0:u?n:a.startTime;this.updateAssetDurations(a);if(r===c?a.cumulativeDuration=s:(s=0,r=c),!u&&a.snapOptions.in&&(a.resumeAnchor=YS(null,i.fragments,a.startOffset+a.resumptionOffset,0,0)||void 0),a.appendInPlace&&!a.appendInPlaceStarted){this.primaryCanResumeInPlaceAt(a,t)||(a.appendInPlace=!1)}if(!a.appendInPlace&&o+1<e.length){e[o+1].startTime-e[o].resumeTime<.033&&(e[o+1].appendInPlace=!1,e[o+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${a}`))}const d=UE(a.resumeOffset)?a.resumeOffset:a.duration;s+=d})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;if(Math.abs(i-n)>dC)return this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${n}`),!1;return!Object.keys(t).some(n=>{const s=t[n].details,r=s.edge;if(i>=r)return this.log(`"${e.identifier}" resumption ${i} past ${n} playlist end ${r}`),!1;const a=YS(null,s.fragments,i);if(!a)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${n} playlist (${s.fragStart}-${s.fragmentEnd})`),!0;const o="audio"===n?.175:0;return!(Math.abs(a.start-i)<dC+o||Math.abs(a.end-i)<dC+o)&&(this.log(`"${e.identifier}" resumption ${i} not aligned with ${n} fragment bounds (${a.start}-${a.end} sn: ${a.sn} cc: ${a.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,n=!1,s=!1;for(let r=0;r<e.assetList.length;r++){const a=e.assetList[r],o=t+i;a.startOffset=i,a.timelineStart=o,n||(n=null===a.duration),s||(s=!!a.error);i+=a.error?0:a.duration||0}e.duration=n&&!s?Math.max(i,e.duration):i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function bC(e){return`[${e.event?'"'+e.event.identifier+'"':"primary"}: ${e.start.toFixed(2)}-${e.end.toFixed(2)}]`}class SC{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let n;try{n=pC(i,this.hls.sessionId,e.baseUrl)}catch(c){const t=this.assignAssetListError(e,GE.ASSET_LIST_LOAD_ERROR,c,i);return void this.hls.trigger(QE.ERROR,t)}t&&"data:"!==n.protocol&&n.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,r=new(0,s.loader)(s),a={responseType:"json",url:n.href},o=s.interstitialAssetListLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(t,i,n,s)=>{const r=t.data,a=null==r?void 0:r.ASSETS;if(!Array.isArray(a)){const t=this.assignAssetListError(e,GE.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),n.url,i,s);return void this.hls.trigger(QE.ERROR,t)}e.assetListResponse=r,this.hls.trigger(QE.ASSET_LIST_LOADED,{event:e,assetListResponse:r,networkDetails:s})},onError:(t,i,n,s)=>{const r=this.assignAssetListError(e,GE.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${t.code} ${t.text} (${i.url})`),i.url,s,n);this.hls.trigger(QE.ERROR,r)},onTimeout:(t,i,n)=>{const s=this.assignAssetListError(e,GE.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${i.url})`),i.url,t,n);this.hls.trigger(QE.ERROR,s)}};return r.load(a,l,u),this.hls.trigger(QE.ASSET_LIST_LOADING,{event:e}),r}assignAssetListError(e,t,i,n,s,r){return e.error=i,{type:VE.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:r,stats:s}}}function TC(e){var t;null==e||null==(t=e.play())||t.catch(()=>{})}function kC(e,t){return`[${e}] Advancing timeline position to ${t}`}class wC{constructor(e){this.buffered=void 0;const t=(t,i,n)=>{if((i>>>=0)>n-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${n})`);return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}const IC={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},LC=e=>String.fromCharCode(IC[e]||e),CC=15,RC=100,xC={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},DC={17:2,18:4,21:6,22:8,23:10,19:13,20:15},PC={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},MC={25:2,26:4,29:6,30:8,31:10,27:13,28:15},OC=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class BC{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i="function"==typeof t?t():t;cb.log(`${this.time} [${e}] ${i}`)}}}const FC=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class _C{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const n=t[i];e.hasOwnProperty(n)&&(this[n]=e[n])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class NC{constructor(){this.uchar=" ",this.penState=new _C}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return" "===this.uchar&&this.penState.isDefault()}}class UC{constructor(e){this.chars=[],this.pos=0,this.currPenState=new _C,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<RC;t++)this.chars.push(new NC);this.logger=e}equals(e){for(let t=0;t<RC;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<RC;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<RC;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>RC&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=RC)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=LC(e);this.pos>=RC?this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t<RC;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<RC;i++){const n=this.chars[i].uchar;" "!==n&&(t=!1),e.push(n)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e);this.chars[this.pos].setPenState(this.currPenState)}}class jC{constructor(e){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<CC;t++)this.rows.push(new UC(e));this.logger=e}reset(){for(let e=0;e<CC;e++)this.rows[e].clear();this.currRow=14}equals(e){let t=!0;for(let i=0;i<CC;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<CC;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<CC;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e);this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+US(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let t=0;t<CC;t++)this.rows[t].clear();const e=this.currRow+1-this.nrRollUpRows,i=this.lastOutputScreen;if(i){const n=i.rows[e].cueStartTime,s=this.logger.time;if(null!==n&&null!==s&&n<s)for(let r=0;r<this.nrRollUpRows;r++)this.rows[t-this.nrRollUpRows+r+1].copy(i.rows[e+r])}}this.currRow=t;const i=this.rows[this.currRow];if(null!==e.indent){const t=e.indent,n=Math.max(t-1,0);i.setCursor(e.indent),e.color=i.chars[n].penState.foreground}const n={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(n)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+US(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",n=-1;for(let s=0;s<CC;s++){const i=this.rows[s].getTextString();i&&(n=s+1,e?t.push("Row "+n+": '"+i+"'"):t.push(i.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class HC{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new jC(i),this.nonDisplayedMemory=new jC(i),this.lastOutputScreen=new jC(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+US(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class VC{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const n=this.logger=new BC;this.channels=[null,new HC(e,t,n),new HC(e+1,i,n)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i<t.length;i+=2){const e=127&t[i],n=127&t[i+1];let s=!1,r=null;if(0===e&&0===n)continue;this.logger.log(3,()=>"["+FC([t[i],t[i+1]])+"] -> ("+FC([e,n])+")");const a=this.cmdHistory;if(e>=16&&e<=31){if(QC(e,n,a)){GC(null,null,a),this.logger.log(3,()=>"Repeated command ("+FC([e,n])+") is dropped");continue}GC(e,n,this.cmdHistory),s=this.parseCmd(e,n),s||(s=this.parseMidrow(e,n)),s||(s=this.parsePAC(e,n)),s||(s=this.parseBackgroundAttributes(e,n))}else GC(null,null,a);if(!s&&(r=this.parseChars(e,n),r)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(r)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}s||r||this.logger.log(2,()=>"Couldn't parse cleaned data "+FC([e,n])+" orig: "+FC([t[i],t[i+1]]))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;const i=20===e||21===e||23===e?1:2,n=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?n.ccRCL():33===t?n.ccBS():34===t?n.ccAOF():35===t?n.ccAON():36===t?n.ccDER():37===t?n.ccRU(2):38===t?n.ccRU(3):39===t?n.ccRU(4):40===t?n.ccFON():41===t?n.ccRDC():42===t?n.ccTR():43===t?n.ccRTD():44===t?n.ccEDM():45===t?n.ccCR():46===t?n.ccENM():47===t&&n.ccEOC():n.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if(i=17===e?1:2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[i];return!!n&&(n.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+FC([e,t])+")"),!0)}return!1}parsePAC(e,t){let i;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;const n=e<=23?1:2;i=t>=64&&t<=95?1===n?xC[e]:PC[e]:1===n?DC[e]:MC[e];const s=this.channels[n];return!!s&&(s.setPAC(this.interpretPAC(i,t)),this.currentChannel=n,!0)}interpretPAC(e,t){let i;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,n.underline=!(1&~i),i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((i-16)/2),n}parseChars(e,t){let i,n=null,s=null;if(e>=25?(i=2,s=e-8):(i=1,s=e),s>=17&&s<=19){let e;e=17===s?t+80:18===s?t+112:t+144,this.logger.log(2,()=>"Special char '"+LC(e)+"' in channel "+i),n=[e]}else e>=32&&e<=127&&(n=0===t?[e]:[e,t]);return n&&this.logger.log(3,()=>"Char codes = "+FC(n).join(",")),n}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let i;const n={};16===e||24===e?(i=Math.floor((t-32)/2),n.background=OC[i],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0));const s=e<=23?1:2;return this.channels[s].setBkgData(n),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}GC(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function GC(e,t,i){i.a=e,i.b=t}function QC(e,t,i){return i.a===e&&i.b===t}var KC=function(){if(null!=rk&&rk.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const i=t.toLowerCase();return!!~e.indexOf(i)&&i}function n(e){return i(t,e)}function s(e,...t){let i=1;for(;i<arguments.length;i++){const t=arguments[i];for(const i in t)e[i]=t[i]}return e}function r(t,r,a){const o=this,l={enumerable:!0};o.hasBeenReset=!1;let u="",c=!1,d=t,h=r,f=a,g=null,m="",p=!0,v="auto",y="start",A=50,E="middle",b=50,S="middle";Object.defineProperty(o,"id",s({},l,{get:function(){return u},set:function(e){u=""+e}})),Object.defineProperty(o,"pauseOnExit",s({},l,{get:function(){return c},set:function(e){c=!!e}})),Object.defineProperty(o,"startTime",s({},l,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",s({},l,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",s({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",s({},l,{get:function(){return g},set:function(e){g=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",s({},l,{get:function(){return m},set:function(t){const n=function(t){return i(e,t)}(t);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");m=n,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",s({},l,{get:function(){return p},set:function(e){p=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",s({},l,{get:function(){return v},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",s({},l,{get:function(){return y},set:function(e){const t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",s({},l,{get:function(){return A},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");A=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",s({},l,{get:function(){return E},set:function(e){const t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",s({},l,{get:function(){return b},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",s({},l,{get:function(){return S},set:function(e){const t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),o.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class zC{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function WC(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(n||0)}const i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class qC{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function YC(e,t,i,n){const s=n?e.split(n):[e];for(const r in s){if("string"!=typeof s[r])continue;const e=s[r].split(i);if(2!==e.length)continue;t(e[0],e[1])}}const $C=new KC(0,0,""),XC="middle"===$C.align?"middle":"center";function ZC(e,t,i){const n=e;function s(){const t=WC(e);if(null===t)throw new Error("Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function r(){e=e.replace(/^\s+/,"")}if(r(),t.startTime=s(),r(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.slice(3),r(),t.endTime=s(),r(),function(e,t){const n=new qC;YC(e,function(e,t){let s;switch(e){case"region":for(let s=i.length-1;s>=0;s--)if(i[s].id===t){n.set(e,i[s].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":s=t.split(","),n.integer(e,s[0]),n.percent(e,s[0])&&n.set("snapToLines",!1),n.alt(e,s[0],["auto"]),2===s.length&&n.alt("lineAlign",s[1],["start",XC,"end"]);break;case"position":s=t.split(","),n.percent(e,s[0]),2===s.length&&n.alt("positionAlign",s[1],["start",XC,"end","line-left","line-right","auto"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start",XC,"end","left","right"])}},/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");let s=n.get("line","auto");"auto"===s&&-1===$C.line&&(s=-1),t.line=s,t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100),t.align=n.get("align",XC);let r=n.get("position","auto");"auto"===r&&50===$C.position&&(r="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=r}(e,t)}function JC(e){return e.replace(/<br(?: \/)?>/gi,"\n")}class eR{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new zC,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function i(){let e=t.buffer,i=0;for(e=JC(e);i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;const n=e.slice(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.slice(i),n}function n(e){YC(e,function(e,t){},/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{let e="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;e=i();const n=e.match(/^()?WEBVTT([ \t].*)?$/);if(null==n||!n[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let r=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(r?r=!1:e=i(),t.state){case"HEADER":/:/.test(e)?n(e):e||(t.state="ID");continue;case"NOTE":e||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(e)){t.state="NOTE";break}if(!e)continue;if(t.cue=new KC(0,0,""),t.state="CUE",-1===e.indexOf("--\x3e")){t.cue.id=e;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{ZC(e,t.cue,t.regionList)}catch(s){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const i=-1!==e.indexOf("--\x3e");if(!e||i&&(r=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=e}continue;case"BADCUE":e||(t.state="ID")}}}catch(s){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state||"BADWEBVTT"===e.state)throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const tR=/\r\n|\n\r|\n|\r/g,iR=function(e,t,i=0){return e.slice(i,i+t.length)===t};function nR(e,t,i){return cC(e.toString())+cC(t.toString())+cC(i)}function sR(e,t,i,n,s,r,a){const o=new eR,l=fb(new Uint8Array(e)).trim().replace(tR,"\n").split("\n"),u=[],c=t?function(e,t=1){return LI(e,9e4,1/t)}(t.baseTime,t.timescale):0;let d,h="00:00.000",f=0,g=0,m=!0;o.oncue=function(e){const r=i[n];let a=i.ccOffset;const o=(f-c)/9e4;if(null!=r&&r.new&&(void 0!==g?a=i.ccOffset=r.start:function(e,t,i){let n=e[t],s=e[n.prevCC];if(!s||!s.new&&n.new)return e.ccOffset=e.presentationOffset=n.start,void(n.new=!1);for(;null!=(r=s)&&r.new;){var r;e.ccOffset+=n.start-s.start,n.new=!1,n=s,s=e[n.prevCC]}e.presentationOffset=i}(i,n,o)),o){if(!t)return void(d=new Error("Missing initPTS for VTT MPEGTS"));a=o-i.presentationOffset}const l=e.endTime-e.startTime,h=BI(9e4*(e.startTime+a-g),9e4*s)/9e4;e.startTime=Math.max(h,0),e.endTime=Math.max(h+l,0);const m=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(m)),e.id||(e.id=nR(e.startTime,e.endTime,m)),e.endTime>0&&u.push(e)},o.onparsingerror=function(e){d=e},o.onflush=function(){d?a(d):r(u)},l.forEach(e=>{if(m){if(iR(e,"X-TIMESTAMP-MAP=")){m=!1,e.slice(16).split(",").forEach(e=>{iR(e,"LOCAL:")?h=e.slice(6):iR(e,"MPEGTS:")&&(f=parseInt(e.slice(7)))});try{g=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(UE(t)&&UE(i)&&UE(n)&&UE(s)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=6e4*n,t+=36e5*s,t}(h)/1e3}catch(t){d=t}return}""===e&&(m=!1)}o.parse(e+"\n")}),o.flush()}const rR="stpp.ttml.im1t",aR=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,oR=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,lR={left:"start",center:"center",right:"end",start:"start",end:"end"};function uR(e,t,i,n){const s=Vb(new Uint8Array(e),["mdat"]);if(0===s.length)return void n(new Error("Could not parse IMSC1 mdat"));const r=s.map(e=>fb(e)),a=function(e,t,i=1,n=!1){return LI(e,t,1/i,n)}(t.baseTime,1,t.timescale);try{r.forEach(e=>i(function(e,t){const i=(new DOMParser).parseFromString(e,"text/xml"),n=i.getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(s).reduce((e,t)=>(e[t]=n.getAttribute(`ttp:${t}`)||s[t],e),{}),a="preserve"!==n.getAttribute("xml:space"),o=dR(cR(n,"styling","style")),l=dR(cR(n,"layout","region")),u=cR(n,"body","[begin]");return[].map.call(u,e=>{const i=hR(e,a);if(!i||!e.hasAttribute("begin"))return null;const n=mR(e.getAttribute("begin"),r),s=mR(e.getAttribute("dur"),r);let u=mR(e.getAttribute("end"),r);if(null===n)throw gR(e);if(null===u){if(null===s)throw gR(e);u=n+s}const c=new KC(n-t,u-t,i);c.id=nR(c.startTime,c.endTime,c.text);const d=function(e,t,i){const n="http://www.w3.org/ns/ttml#styling";let s=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;a&&i.hasOwnProperty(a)&&(s=i[a]);return r.reduce((i,r)=>{const a=fR(t,n,r)||fR(e,n,r)||fR(s,n,r);return a&&(i[r]=a),i},{})}(l[e.getAttribute("region")],o[e.getAttribute("style")],o),{textAlign:h}=d;if(h){const e=lR[h];e&&(c.lineAlign=e),c.align=h}return tb(c,d),c}).filter(e=>null!==e)}(e,a)))}catch(o){n(o)}}function cR(e,t,i){const n=e.getElementsByTagName(t)[0];return n?[].slice.call(n.querySelectorAll(i)):[]}function dR(e){return e.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function hR(e,t){return[].slice.call(e.childNodes).reduce((e,i,n)=>{var s;return"br"===i.nodeName&&n?e+"\n":null!=(s=i.childNodes)&&s.length?hR(i,t):t?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent},"")}function fR(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function gR(e){return new Error(`Could not parse ttml timestamp ${e}`)}function mR(e,t){if(!e)return null;let i=WC(e);return null===i&&(aR.test(e)?i=function(e,t){const i=aR.exec(e),n=(0|i[4])+(0|i[5])/t.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+n/t.frameRate}(e,t):oR.test(e)&&(i=function(e,t){const i=oR.exec(e),n=Number(i[1]);switch(i[2]){case"h":return 3600*n;case"m":return 60*n;case"ms":return 1e3*n;case"f":return n/t.frameRate;case"t":return n/t.tickRate}return n}(e,t))),i}class pR{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}function vR(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function yR(e,t){return!!e&&e.kind===vR(t)&&XI(t,e)}function AR(e,t,i,n){return Math.min(t,n)-Math.max(e,i)}const ER=/\s/,bR={newCue(e,t,i,n){const s=[];let r,a,o,l,u;const c=self.VTTCue||self.TextTrackCue;for(let h=0;h<n.rows.length;h++)if(r=n.rows[h],o=!0,l=0,u="",!r.isEmpty()){var d;for(let e=0;e<r.chars.length;e++)ER.test(r.chars[e].uchar)&&o?l++:(u+=r.chars[e].uchar,o=!1);r.cueStartTime=t,t===i&&(i+=1e-4),l>=16?l--:l++;const n=JC(u.trim()),f=nR(t,i,n);null!=e&&null!=(d=e.cues)&&d.getCueById(f)||(a=new c(t,i,n),a.id=f,a.line=h+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*l/32)),s.push(a))}return e&&s.length&&(s.sort((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),s.forEach(t=>aC(e,t))),s}};const SR=/(\d+)-(\d+)\/(\d+)/;class TR{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||kR,this.controller=new self.AbortController,this.stats=new wb}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const s=function(e,t){const i={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(tb({},e.headers))};e.rangeEnd&&i.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return i}(e,this.controller.signal),r="arraybuffer"===e.responseType,a=r?"byteLength":"length",{maxTimeToFirstByteMs:o,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=o&&UE(o)?o:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout);(GI(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(i=>{var s;this.response=this.loader=i;const a=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},l-(a-n.loading.start)),!i.ok){const{status:e,statusText:t}=i;throw new wR(t||"fetch, bad network response",e,i)}n.loading.first=a,n.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=SR.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(UE(e))return e}const i=e.get("Content-Length");if(i)return parseInt(i)}(i.headers)||n.total;const o=null==(s=this.callbacks)?void 0:s.onProgress;return o&&UE(t.highWaterMark)?this.loadProgressively(i,n,e,t.highWaterMark,o):r?i.arrayBuffer():"json"===e.responseType?i.json():i.text()}).then(i=>{var s,r;const o=this.response;if(!o)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const l=i[a];l&&(n.loaded=n.total=l);const u={url:o.url,data:i,code:o.status},c=null==(s=this.callbacks)?void 0:s.onProgress;c&&!UE(t.highWaterMark)&&c(n,e,i,o),null==(r=this.callbacks)||r.onSuccess(u,n,e,o)}).catch(t=>{var i;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const s=t&&t.code||0,r=t?t.message:null;null==(i=this.callbacks)||i.onError({code:s,text:r},e,t?t.details:null,n)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,n=0,s){const r=new yw,a=e.body.getReader(),o=()=>a.read().then(a=>{if(a.done)return r.dataLength&&s(t,i,r.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const l=a.value,u=l.length;return t.loaded+=u,u<n||r.dataLength?(r.push(l),r.dataLength>=n&&s(t,i,r.flush().buffer,e)):s(t,i,l.buffer,e),o()}).catch(()=>Promise.reject());return o()}}function kR(e,t){return new self.Request(e.url,t)}class wR extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const IR=/^age:\s*[\d.]+\s*$/im;class LR{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new wb,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(this.loader===i&&!this.stats.aborted)return s(i,t.url)}).catch(e=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",t.url,!0),s(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(e=>{var s;null==(s=this.callbacks)||s.onError({code:i.status,text:e.message},t,i,n)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const n=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:r}=i.loadPolicy;if(n)for(const a in n)e.setRequestHeader(a,n[a]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=s&&UE(s)?s:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const n=t.readyState,s=this.config;if(!i.aborted&&n>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===n)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const n=t.status,l="text"===t.responseType?t.responseText:null;if(n>=200&&n<300){const s=null!=l?l:t.response;if(null!=s){var r,a;i.loading.end=Math.max(self.performance.now(),i.loading.first);const o="arraybuffer"===t.responseType?s.byteLength:s.length;i.loaded=i.total=o,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first);const l=null==(r=this.callbacks)?void 0:r.onProgress;l&&l(i,e,s,t);const u={url:t.responseURL,data:s,code:n};return void(null==(a=this.callbacks)||a.onSuccess(u,i,e,t))}}const u=s.loadPolicy.errorRetry;var o;if(rT(u,i.retry,!1,{url:e.url,data:void 0,code:n}))this.retry(u);else cb.error(`${n} while loading ${e.url}`),null==(o=this.callbacks)||o.onError({code:n,text:t.statusText},e,t,i)}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry;if(rT(e,this.stats.retry,!0))this.retry(e);else{var t;cb.warn(`timeout while loading ${null==(t=this.context)?void 0:t.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=nT(e,i.retry),i.retry++,cb.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&IR.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const CR=nb(nb({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:6e7,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:LR,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class extends sb{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{var t;const{fragCurrent:i,partCurrent:n,hls:s}=this,{autoLevelEnabled:r,media:a}=s;if(!i||!a)return;const o=performance.now(),l=n?n.stats:i.stats,u=n?n.duration:i.duration,c=o-l.loading.start,d=s.minAutoLevel,h=i.level,f=this._nextAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||h<=d)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!r)return;const g=f>-1&&f!==h,m=!!e||g;if(!m&&(a.paused||!a.playbackRate||!a.readyState))return;const p=s.mainForwardBufferInfo;if(!m&&null===p)return;const v=this.bwEstimator.getEstimateTTFB(),y=Math.abs(a.playbackRate);if(c<=Math.max(v,u/(2*y)*1e3))return;const A=p?p.len/y:0,E=l.loading.first?l.loading.first-l.loading.start:-1,b=l.loaded&&E>-1,S=this.getBwEstimate(),T=s.levels,k=T[h],w=Math.max(l.loaded,Math.round(u*(i.bitrate||k.averageBitrate)/8));let I=b?c-E:c;I<1&&b&&(I=Math.min(c,8*l.loaded/S));const L=b?1e3*l.loaded/I:0,C=v/1e3,R=L?(w-l.loaded)/L:8*w/S+C;if(R<=A)return;const x=L?8*L:S,D=!0===(null==(t=(null==e?void 0:e.details)||this.hls.latestLevelDetails)?void 0:t.live),P=this.hls.config.abrBandWidthUpFactor;let M,O=Number.POSITIVE_INFINITY;for(M=h-1;M>d;M--){const e=T[M].maxBitrate,t=!T[M].details||D;if(O=this.getTimeToLoadFrag(C,x,u*e,t),O<Math.min(A,u+C))break}if(O>=R)return;if(O>10*u)return;b?this.bwEstimator.sample(c-Math.min(v,E),l.loaded):this.bwEstimator.sampleTTFB(c);const B=T[M].maxBitrate;this.getBwEstimate()*P>B&&this.resetEstimator(B);const F=this.findBestLevel(B,d,M,0,A,1,1);F>-1&&(M=F),this.warn(`Fragment ${i.sn}${n?" part "+n.index:""} of level ${h} is loading too slowly;\n Fragment duration: ${i.duration.toFixed(3)}\n Time to underbuffer: ${A.toFixed(3)} s\n Estimated load time for current fragment: ${R.toFixed(3)} s\n Estimated load time for down switch fragment: ${O.toFixed(3)} s\n TTFB estimate: ${0|E} ms\n Current BW estimate: ${UE(S)?0|S:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${M} @ ${0|B} bps`),s.nextLoadLevel=s.nextAutoLevel=M,this.clearTimer();const _=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===M&&M>0){const e=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${M>0?"and switching down":""}\n Fragment duration: ${i.duration.toFixed(3)} s\n Time to underbuffer: ${e.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,M>d){let t=this.findBestLevel(this.hls.levels[d].bitrate,d,M,0,e,1,1);-1===t&&(t=d),this.hls.nextLoadLevel=this.hls.nextAutoLevel=t,this.resetEstimator(this.hls.levels[t].bitrate)}}};g||R>2*O?_():this.timer=self.setInterval(_,1e3*O),s.trigger(QE.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:n,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new JE(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.FRAG_LOADING,this.onFragLoading,this),e.on(QE.FRAG_LOADED,this.onFragLoaded,this),e.on(QE.FRAG_BUFFERED,this.onFragBuffered,this),e.on(QE.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(QE.LEVEL_LOADED,this.onLevelLoaded,this),e.on(QE.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(QE.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(QE.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.FRAG_LOADING,this.onFragLoading,this),e.off(QE.FRAG_LOADED,this.onFragLoaded,this),e.off(QE.FRAG_BUFFERED,this.onFragBuffered,this),e.off(QE.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(QE.LEVEL_LOADED,this.onLevelLoaded,this),e.off(QE.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(QE.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(QE.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){var n;if(!i.bitrateTest)this.fragCurrent=i,this.partCurrent=null!=(n=t.part)?n:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case GE.BUFFER_ADD_CODEC_ERROR:case GE.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case GE.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:i,partCurrent:n}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){const t=performance.now(),i=n?n.stats:e.stats,s=t-i.loading.start,r=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&r>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(s-Math.min(e,r),i.loaded)}else this.bwEstimator.sampleTTFB(s)}break}}}getTimeToLoadFrag(e,t,i,n){return e+i/t+(n?e+this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const i=this.hls.config,{loading:n}=t.stats,s=n.end-n.first;UE(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===YE&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=i?i.duration:t.duration,s=this.hls.levels[t.level],r=(s.loaded?s.loaded.bytes:0)+n.loaded,a=(s.loaded?s.loaded.duration:0)+e;s.loaded={bytes:r,duration:a},s.realBitrate=Math.round(8*r/a)}if(t.bitrateTest){const e={stats:n,frag:t,part:i,id:t.type};this.onFragBuffered(QE.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:n}=t,s=null!=n&&n.stats.loaded?n.stats:i.stats;if(s.aborted)return;if(this.ignoreFragment(i))return;const r=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(r,s.loaded),s.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==YE||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,s=this.findBestLevel(i,t,e,0,n,1,1);if(s>-1)return s;const r=this.hls.firstLevel,a=Math.min(Math.max(r,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${r} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;const n=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,n)&&t[e].loadError<=t[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:n,config:s,minAutoLevel:r}=i,a=t?t.duration:e?e.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay();let u=s.abrBandWidthFactor,c=s.abrBandWidthUpFactor;if(l){const e=this.findBestLevel(o,r,n,l,0,u,c);if(e>=0)return this.rebufferNotice=-1,e}let d=a?Math.min(a,s.maxStarvationDelay):s.maxStarvationDelay;if(!l){const e=this.bitrateTestDelay;if(e){d=(a?Math.min(a,s.maxLoadingDelay):s.maxLoadingDelay)-e,this.info(`bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),u=c=1}}const h=this.findBestLevel(o,r,n,l,d,u,c);if(this.rebufferNotice!==h&&(this.rebufferNotice=h,this.info(`${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${h}`)),h>-1)return h;const f=i.levels[r],g=i.loadLevelObj;return g&&(null==f?void 0:f.bitrate)<g.bitrate?r:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,n=e.mainForwardBufferInfo;return(n?n.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,n,s,r,a){var o;const l=n+s,u=this.lastLoadedFragLevel,c=-1===u?this.hls.firstLevel:u,{fragCurrent:d,partCurrent:h}=this,{levels:f,allAudioTracks:g,loadLevel:m,config:p}=this.hls;if(1===f.length)return 0;const v=f[c],y=!(null==(o=this.hls.latestLevelDetails)||!o.live),A=-1===m||-1===u;let E,b="SDR",S=(null==v?void 0:v.frameRate)||0;const{audioPreference:T,videoPreference:k}=p,w=this.audioTracksByGroup||(this.audioTracksByGroup=HS(g));let I=-1;if(A){if(-1!==this.firstSelection)return this.firstSelection;const n=this.codecTiers||(this.codecTiers=function(e,t,i,n){return e.slice(i,n+1).reduce((e,i,n)=>{if(!i.codecSet)return e;const s=i.audioGroups;let r=e[i.codecSet];r||(e[i.codecSet]=r={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:n,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!s,fragmentError:0}),r.minBitrate=Math.min(r.minBitrate,i.bitrate);const a=Math.min(i.height,i.width);return r.minHeight=Math.min(r.minHeight,a),r.minFramerate=Math.min(r.minFramerate,i.frameRate),r.minIndex=Math.min(r.minIndex,n),r.maxScore=Math.max(r.maxScore,i.score),r.fragmentError+=i.fragmentError,r.videoRanges[i.videoRange]=(r.videoRanges[i.videoRange]||0)+1,s&&s.forEach(e=>{if(!e)return;const i=t.groups[e];i&&(r.hasDefaultAudio=r.hasDefaultAudio||t.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(i.channels).forEach(e=>{r.channels[e]=(r.channels[e]||0)+i.channels[e]}))}),e},{})}(f,w,t,i)),s=function(e,t,i,n,s){const r=Object.keys(e),a=null==n?void 0:n.channels,o=null==n?void 0:n.audioCodec,l=null==s?void 0:s.videoCodec,u=a&&2===parseInt(a);let c=!1,d=!1,h=1/0,f=1/0,g=1/0,m=1/0,p=0,v=[];const{preferHDR:y,allowedVideoRanges:A}=NS(t,s);for(let T=r.length;T--;){const t=e[r[T]];c||(c=t.channels[2]>0),h=Math.min(h,t.minHeight),f=Math.min(f,t.minFramerate),g=Math.min(g,t.minBitrate),A.filter(e=>t.videoRanges[e]>0).length>0&&(d=!0)}h=UE(h)?h:0,f=UE(f)?f:0;const E=Math.max(1080,h),b=Math.max(30,f);g=UE(g)?g:i,i=Math.max(g,i),d||(t=void 0);const S=r.length>1;return{codecSet:r.reduce((t,n)=>{const s=e[n];if(n===t)return t;if(v=d?A.filter(e=>s.videoRanges[e]>0):[],S){if(s.minBitrate>i)return jS(n,`min bitrate of ${s.minBitrate} > current estimate of ${i}`),t;if(!s.hasDefaultAudio)return jS(n,"no renditions with default or auto-select sound found"),t;if(o&&n.indexOf(o.substring(0,4))%5!=0)return jS(n,`audio codec preference "${o}" not found`),t;if(a&&!u){if(!s.channels[a])return jS(n,`no renditions with ${a} channel sound found (channels options: ${Object.keys(s.channels)})`),t}else if((!o||u)&&c&&0===s.channels[2])return jS(n,"no renditions with stereo sound found"),t;if(s.minHeight>E)return jS(n,`min resolution of ${s.minHeight} > maximum of ${E}`),t;if(s.minFramerate>b)return jS(n,`min framerate of ${s.minFramerate} > maximum of ${b}`),t;if(!v.some(e=>s.videoRanges[e]>0))return jS(n,`no variants with VIDEO-RANGE of ${US(v)} found`),t;if(l&&n.indexOf(l.substring(0,4))%5!=0)return jS(n,`video codec preference "${l}" not found`),t;if(s.maxScore<p)return jS(n,`max score of ${s.maxScore} < selected max of ${p}`),t}return t&&(fS(n)>=fS(t)||s.fragmentError>e[t].fragmentError)?t:(m=s.minIndex,p=s.maxScore,n)},void 0),videoRanges:v,preferHDR:y,minFramerate:f,minBitrate:g,minIndex:m}}(n,b,e,T,k),{codecSet:r,videoRanges:a,minFramerate:o,minBitrate:l,minIndex:u,preferHDR:c}=s;I=u,E=r,b=c?a[a.length-1]:a[0],S=o,e=Math.max(e,l),this.log(`picked start tier ${US(s)}`)}else E=null==v?void 0:v.codecSet,b=null==v?void 0:v.videoRange;const L=h?h.duration:d?d.duration:0,C=this.bwEstimator.getEstimateTTFB()/1e3,R=[];for(let D=i;D>=t;D--){var x;const t=f[D],o=D>c;if(!t)continue;if(p.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const i=navigator.mediaCapabilities;"function"==typeof(null==i?void 0:i.decodingInfo)&&wS(t,w,b,S,e,T)?(t.supportedPromise=IS(t,w,i,this.supportedCache),t.supportedPromise.then(e=>{if(!this.hls)return;t.supportedResult=e;const i=this.hls.levels,n=i.indexOf(t);e.error?this.warn(`MediaCapabilities decodingInfo error: "${e.error}" for level ${n} ${US(e)}`):e.supported?e.decodingInfoResults.some(e=>!1===e.smooth||!1===e.powerEfficient)&&this.log(`MediaCapabilities decodingInfo for level ${n} not smooth or powerEfficient: ${US(e)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${n} ${US(e)}`),n>-1&&i.length>1&&(this.log(`Removing unsupported level ${n}`),this.hls.removeLevel(n),-1===this.hls.loadLevel&&(this.hls.nextLoadLevel=0)))}).catch(e=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${e}`)})):t.supportedResult=TS}if((E&&t.codecSet!==E||b&&t.videoRange!==b||o&&S>t.frameRate||!o&&S>0&&S<t.frameRate||null!=(x=t.supportedResult)&&null!=(x=x.decodingInfoResults)&&x.some(e=>!1===e.smooth))&&(!A||D!==I)){R.push(D);continue}const d=t.details,g=(h?null==d?void 0:d.partTarget:null==d?void 0:d.averagetargetduration)||L;let v;v=o?a*e:r*e;const k=L&&n>=2*L&&0===s?t.averageBitrate:t.maxBitrate,P=this.getTimeToLoadFrag(C,v,k*g,void 0===d);if(v>=k&&(D===u||0===t.loadError&&0===t.fragmentError)&&(P<=C||!UE(P)||y&&!this.bitrateTestDelay||P<l)){const e=this.forcedAutoLevel;return D===m||-1!==e&&e===m||(R.length&&this.trace(`Skipped level(s) ${R.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${f[R[0]].codecs}" ${f[R[0]].videoRange}; not compatible with "${E}" ${b}`),this.info(`switch candidate:${c}->${D} adjustedbw(${Math.round(v)})-bitrate=${Math.round(v-k)} ttfb:${C.toFixed(1)} avgDuration:${g.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${A} codecSet:${t.codecSet} videoRange:${t.videoRange} hls.loadLevel:${m}`)),A&&(this.firstSelection=D),D}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}},bufferController:class extends sb{constructor(e,t){var i;super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=e=>{var t;this.hls&&"open"===(null==(t=this.mediaSource)?void 0:t.readyState)&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=e=>{const{media:t,mediaSource:i}=this;e&&this.log("Media source opened"),t&&i&&(i.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(QE.MEDIA_ATTACHED,{media:t,mediaSource:i}),null!==this.mediaSource&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:e,_objectUrl:t}=this;e!==t&&this.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=(i=db(e.config.preferManagedMediaSource),"undefined"!=typeof self&&i===self.ManagedMediaSource),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.on(QE.BUFFER_RESET,this.onBufferReset,this),e.on(QE.BUFFER_APPENDING,this.onBufferAppending,this),e.on(QE.BUFFER_CODECS,this.onBufferCodecs,this),e.on(QE.BUFFER_EOS,this.onBufferEos,this),e.on(QE.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(QE.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(QE.FRAG_PARSED,this.onFragParsed,this),e.on(QE.FRAG_CHANGED,this.onFragChanged,this),e.on(QE.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.off(QE.BUFFER_RESET,this.onBufferReset,this),e.off(QE.BUFFER_APPENDING,this.onBufferAppending,this),e.off(QE.BUFFER_CODECS,this.onBufferCodecs,this),e.off(QE.BUFFER_EOS,this.onBufferEos,this),e.off(QE.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(QE.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(QE.FRAG_PARSED,this.onFragParsed,this),e.off(QE.FRAG_CHANGED,this.onFragChanged,this),e.off(QE.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const e=this.isUpdating();e||this.operationQueue.removeBlockers();const t=this.isQueued();(e||t)&&this.warn(`Transfering MediaSource with${t?" operations in queue":""}${e?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const n=this.transferData;return!this.sourceBufferCount&&n&&n.mediaSource===t?tb(i,n.tracks):this.sourceBuffers.forEach(e=>{const[t]=e;t&&(i[t]=tb({},this.tracks[t]),this.removeBuffer(t)),e[0]=e[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log(`${n} bufferCodec event(s) expected.`),null!=(i=this.transferData)&&i.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media;this.transferData=this.overrides=void 0;const n=db(this.appendSource);if(n){const e=!!t.mediaSource;(e||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(r),e)this._objectUrl=i.src,this.attachTransferred();else{const e=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{i.removeAttribute("src");const t=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||t&&r instanceof t,iL(i),function(e,t){const i=self.document.createElement("source");i.type="video/mp4",i.src=t,e.appendChild(i)}(i,e),i.load()}catch(s){i.src=e}else i.src=e}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${(null==(t=this.transferData)?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${null==(i=e.constructor)?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,n=t.tracks,s=n?Object.keys(n):null,r=s?s.length:0,a=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(n&&s&&r){if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})\nrequired tracks: ${US(i,(e,t)=>"initSegment"===e?void 0:t)};\ntransfer tracks: ${US(n,(e,t)=>"initSegment"===e?void 0:t)}}`),!hb(n,i)){t.mediaSource=null,t.tracks=void 0;const s=e.currentTime,r=this.details,a=Math.max(s,(null==r?void 0:r.fragments[0].start)||0);return a-s>1?void this.log(`attachTransferred: waiting for playback to reach new tracks start time ${s} -> ${a}`):(this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(n)}"->"${Object.keys(i)}") start time: ${a} currentTime: ${s}`),this.onMediaDetaching(QE.MEDIA_DETACHING,{}),this.onMediaAttaching(QE.MEDIA_ATTACHING,t),void(e.currentTime=a))}this.transferData=void 0,s.forEach(e=>{const t=e,i=n[t];if(i){const e=i.buffer;if(e){const n=this.fragmentTracker,s=i.id;if(n.hasFragments(s)||n.hasParts(s)){const i=NT.getBuffered(e);n.detectEvictedFragments(t,i,s,null,!0)}const r=nL(t),a=[t,e];this.sourceBuffers[r]=a,e.updating&&this.operationQueue&&this.operationQueue.prependBlocker(t),this.trackSourceBuffer(t,i)}}}),a(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),a()}get mediaSourceOpenOrEnded(){var e;const t=null==(e=this.mediaSource)?void 0:e.readyState;return"open"===t||"ended"===t}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:n,mediaSource:s,_objectUrl:r}=this;if(s){if(this.log("media source "+(i?"transferring":"detaching")),i)this.sourceBuffers.forEach(([e])=>{e&&this.removeBuffer(e)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const e="open"===s.readyState;try{const t=s.sourceBuffers;for(let i=t.length;i--;)e&&t[i].abort(),s.removeSourceBuffer(t[i]);e&&s.endOfStream()}catch(IP){this.warn(`onMediaDetaching: ${IP.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.removeEventListener("startstreaming",this._onStartStreaming),s.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(n.removeAttribute("src"),this.appendSource&&iL(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(QE.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=null==(t=this.tracks[e])?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;null!=(n=this.mediaSource)&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(IP){this.warn(`onBufferReset ${e}`,IP)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[nL(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new ZI(this.tracks)}onBufferCodecs(e,t){var i;const n=this.tracks,s=Object.keys(t);this.log(`BUFFER_CODECS: "${s}" (current SB count ${this.sourceBufferCount})`);const r="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),a=!r&&this.sourceBufferCount&&this.media&&s.some(e=>!n[e]);r||a?this.warn(`Unsupported transition between "${Object.keys(n)}" and "${s}" SourceBuffers`):(s.forEach(e=>{var i,s;const r=t[e],{id:a,codec:o,levelCodec:l,container:u,metadata:c,supplemental:d}=r;let h=n[e];const f=null==(i=this.transferData)||null==(i=i.tracks)?void 0:i[e],g=null!=f&&f.buffer?f:h,m=(null==g?void 0:g.pendingCodec)||(null==g?void 0:g.codec),p=null==g?void 0:g.levelCodec;h||(h=n[e]={buffer:void 0,listeners:[],codec:o,supplemental:d,container:u,levelCodec:l,metadata:c,id:a});const v=vS(m,p),y=null==v?void 0:v.replace(JI,"$1");let A=vS(o,l);const E=null==(s=A)?void 0:s.replace(JI,"$1");A&&v&&y!==E&&("audio"===e.slice(0,5)&&(A=pS(A,this.appendSource)),this.log(`switching codec ${m} to ${A}`),A!==(h.pendingCodec||h.codec)&&(h.pendingCodec=A),h.container=u,this.appendChangeType(e,u,A))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),this.sourceBufferCount||(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&"main"===(null==(i=t.audio)?void 0:i.id)&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks()))}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const n=`${t};codecs=${i}`,s={label:`change-type=${n}`,execute:()=>{const s=this.tracks[e];if(s){const r=s.buffer;null!=r&&r.changeType&&(this.log(`changing ${e} sourceBuffer type to ${n}`),r.changeType(n),s.codec=i,s.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};this.append(s,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,n=i+.05*e.duration;if(!0===(null==(t=this.fragmentTracker.getAppendedFrag(i,YE))?void 0:t.gap))return;const s={label:"block-audio",execute:()=>{var e;const t=this.tracks.video;(this.lastVideoAppendEnd>n||null!=t&&t.buffer&&NT.isBuffered(t.buffer,n)||!0===(null==(e=this.fragmentTracker.getAppendedFrag(n,YE))?void 0:e.gap))&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn("Error executing block-audio operation",e)}};this.blockedAudioAppend={op:s,frag:e},this.append(s,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:n,type:s,parent:r,frag:a,part:o,chunkMeta:l,offset:u}=t,c=l.buffering[s],{sn:d,cc:h}=a,f=self.performance.now();c.start=f;const g=a.stats.buffering,m=o?o.stats.buffering:null;0===g.start&&(g.start=f),m&&0===m.start&&(m.start=f);const p=i.audio;let v=!1;"audio"===s&&"audio/mpeg"===(null==p?void 0:p.container)&&(v=!this.lastMpegAudioChunk||1===l.id||this.lastMpegAudioChunk.sn!==l.sn,this.lastMpegAudioChunk=l);const y=i.video,A=null==y?void 0:y.buffer;if(A&&"initSegment"!==d){const e=o||a,t=this.blockedAudioAppend;if("audio"!==s||"main"===r||this.blockedAudioAppend||y.ending||y.ended){if("video"===s){const i=e.end;if(t){const e=t.frag.start;(i>e||i<this.lastVideoAppendEnd||NT.isBuffered(A,e))&&this.unblockAudio()}this.lastVideoAppendEnd=i}}else{const t=e.start+.05*e.duration,i=A.buffered,n=this.currentOp("video");i.length||n?!n&&!NT.isBuffered(A,t)&&this.lastVideoAppendEnd<t&&this.blockAudio(e):this.blockAudio(e)}}const E=(o||a).start,b={label:`append-${s}`,execute:()=>{var e;c.executeStart=self.performance.now();const t=null==(e=this.tracks[s])?void 0:e.buffer;t&&(v?this.updateTimestampOffset(t,E,.1,s,d,h):void 0!==u&&UE(u)&&this.updateTimestampOffset(t,u,1e-6,s,d,h)),this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();c.executeEnd=c.end=e,0===g.first&&(g.first=e),m&&0===m.first&&(m.first=e);const t={};this.sourceBuffers.forEach(([e,i])=>{e&&(t[e]=NT.getBuffered(i))}),this.appendErrors[s]=0,"audio"===s||"video"===s?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(QE.BUFFER_APPENDED,{type:s,frag:a,part:o,chunkMeta:l,parent:a.type,timeRanges:t})},onError:e=>{var t;const i={type:VE.MEDIA_ERROR,parent:a.type,details:GE.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:a,part:o,chunkMeta:l,error:e,err:e,fatal:!1},n=null==(t=this.media)?void 0:t.error;if(e.code===DOMException.QUOTA_EXCEEDED_ERR||"QuotaExceededError"==e.name||"quota"in e)i.details=GE.BUFFER_FULL_ERROR;else if(e.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!n)i.errorAction=mT(!0);else if(e.name===eL&&0===this.sourceBufferCount)i.errorAction=mT(!0);else{const e=++this.appendErrors[s];this.warn(`Failed ${e}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${n||"no media error"})`),(e>=this.hls.config.appendErrorMaxRetry||n)&&(i.fatal=!0)}this.hls.trigger(QE.ERROR,i)}};this.log(`queuing "${s}" append sn: ${d}${o?" p: "+o.index:""} of ${a.type===YE?"level":"track"} ${a.level} cc: ${h}`),this.append(b,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(QE.BUFFER_FLUSHED,{type:e})},onError:n=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,n)}}}onBufferFlushing(e,t){const{type:i,startOffset:n,endOffset:s}=t;i?this.append(this.getFlushOp(i,n,s),i):this.sourceBuffers.forEach(([e])=>{e&&this.append(this.getFlushOp(e,n,s),e)})}onFragParsed(e,t){const{frag:i,part:n}=t,s=[],r=n?n.elementaryStreams:i.elementaryStreams;r[Cb]?s.push("audiovideo"):(r[Ib]&&s.push("audio"),r[Lb]&&s.push("video"));0===s.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(()=>{const e=self.performance.now();i.stats.buffering.end=e,n&&(n.stats.buffering.end=e);const t=n?n.stats:i.stats;this.hls.trigger(QE.FRAG_BUFFERED,{frag:i,part:n,stats:t,id:i.type})},s).catch(e=>{this.warn(`Fragment buffered callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([e])=>{if(e){const i=this.tracks[e];t.type&&t.type!==e||(i.ending=!0,i.ended||(i.ended=!0,this.log(`${e} buffer reached EOS`)))}});const n=!1!==(null==(i=this.overrides)?void 0:i.endOfStream);this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{var t;return e&&!(null!=(t=this.tracks[e])&&t.ended)})?n?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream(),this.hls.trigger(QE.BUFFERED_TO_END,void 0)):e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)})):(this.tracksEnded(),this.hls.trigger(QE.BUFFERED_TO_END,void 0)):"video"===t.type&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(null!==e){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===GE.BUFFER_APPEND_ERROR&&t.frag){var i;const e=null==(i=t.errorAction)?void 0:i.nextAutoLevel;UE(e)&&e!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||null===t)return;if(!this.sourceBufferCount)return;const n=e.config,s=i.currentTime,r=t.levelTargetDuration,a=t.live&&null!==n.liveBackBufferLength?n.liveBackBufferLength:n.backBufferLength;if(UE(a)&&a>=0){const e=Math.max(a,r),t=Math.floor(s/r)*r-e;this.flushBackBuffer(s,r,t)}const o=n.frontBufferFlushThreshold;if(UE(o)&&o>0){const e=Math.max(n.maxBufferLength,o),t=Math.max(e,r),i=Math.floor(s/r)*r+t;this.flushFrontBuffer(s,r,i)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([e,t])=>{if(t){const s=NT.getBuffered(t);if(s.length>0&&i>s.start(0)){var n;this.hls.trigger(QE.BACK_BUFFER_REACHED,{bufferEnd:i});const t=this.tracks[e];if(null!=(n=this.details)&&n.live)this.hls.trigger(QE.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(null!=t&&t.ended)return void this.log(`Cannot flush ${e} back buffer while SourceBuffer is in ended state`);this.hls.trigger(QE.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:e})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([t,n])=>{if(n){const s=NT.getBuffered(n),r=s.length;if(r<2)return;const a=s.start(r-1),o=s.end(r-1);if(i>a||e>=a&&e<=o)return;this.hls.trigger(QE.BUFFER_FLUSHING,{startOffset:a,endOffset:1/0,type:t})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||"open"!==(null==i?void 0:i.readyState))return null;const n=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){const e=Math.max(0,t.fragmentStart);return{duration:1/0,start:e,end:Math.max(e,n)}}return{duration:1/0}}const s=null==(e=this.overrides)?void 0:e.duration;if(s)return UE(s)?{duration:s}:null;const r=this.media.duration;return n>(UE(i.duration)?i.duration:0)&&n>r||!UE(r)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;this.media&&n&&"open"===n.readyState&&(n.duration!==e&&(UE(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),n.duration=e),void 0!==t&&void 0!==i&&(this.log(`MediaSource duration is set to ${n.duration}. Setting seekable range to ${t}-${i}.`),n.setLiveSeekableRange(t,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${US(i)}`),this.tracksReady){var n;const e=null==(n=this.transferData)?void 0:n.tracks;e&&Object.keys(e).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const n=this.tracks[t];e[t]={buffer:i,container:n.container,codec:n.codec,supplemental:n.supplemental,levelCodec:n.levelCodec,id:n.id,metadata:n.metadata}}}),this.hls.trigger(QE.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([e])=>{this.executeNext(e)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const r in e){const a=r,o=e[a];if(this.isPending(o)){const e=this.getTrackCodec(o,a),r=`${o.container};codecs=${e}`;o.codec=e,this.log(`creating sourceBuffer(${r})${this.currentOp(a)?" Queued":""} ${US(o)}`);try{const e=i.addSourceBuffer(r),n=nL(a),s=[a,e];t[n]=s,o.buffer=e}catch(s){var n;return this.error(`error while trying to add sourceBuffer: ${s.message}`),this.shiftAndExecuteNext(a),null==(n=this.operationQueue)||n.removeBlockers(),delete this.tracks[a],void this.hls.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,sourceBufferName:a,mimeType:r,parent:o.id})}this.trackSourceBuffer(a,o)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let n=e.codec;i&&("video"===t||"audiovideo"===t)&&uS(i,"video")&&(n=function(e,t){const i=[];if(e){const t=e.split(",");for(let e=0;e<t.length;e++)lS(t[e],"video")||i.push(t[e])}return t&&i.push(t),i.join(",")}(n,i));const s=vS(n,e.levelCodec);return s?"audio"===t.slice(0,5)?pS(s,this.appendSource):s:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(e,t)=>{const i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(QE.BUFFER_FLUSHED,{type:e})})}get mediaSrc(){var e,t;const i=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==i?void 0:i.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const n=new Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${n}`,t),this.hls.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const s=this.currentOp(e);s&&s.onError(n)}updateTimestampOffset(e,t,i,n,s,r){const a=t-e.timestampOffset;Math.abs(a)>=i&&(this.log(`Updating ${n} SourceBuffer timestampOffset to ${t} (sn: ${s} cc: ${r})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:n,mediaSource:s}=this,r=this.tracks[e],a=null==r?void 0:r.buffer;if(!n||!s||!a)return this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void this.shiftAndExecuteNext(e);const o=UE(n.duration)?n.duration:1/0,l=UE(s.duration)?s.duration:1/0,u=Math.max(0,t),c=Math.min(i,o,l);c>u&&(!r.ending||r.ended)?(r.ended=!1,this.log(`Removing [${u},${c}] from the ${e} SourceBuffer`),a.remove(u,c)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],n=null==i?void 0:i.buffer;if(!n)throw new tL(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(e=>{this.warn(`SourceBuffer blocked callback ${e}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,n=t.map(e=>this.appendBlocker(e));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(t=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(e=>{var t;const i=null==(t=this.tracks[e])?void 0:t.buffer;i&&!i.updating&&this.shiftAndExecuteNext(e)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const n=this.tracks[e];if(!n)return;const s=n.buffer;if(!s)return;const r=i.bind(this,e);n.listeners.push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(e=>{i.removeEventListener(e.event,e.listener)}),t.listeners.length=0)}},capLevelController:sL,errorController:class extends sb{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(QE.ERROR,this.onError,this),e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(QE.ERROR,this.onError,this),e.off(QE.ERROR,this.onErrorOut,this),e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===YE?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,i=t.currentLevel;return null!=(e=t.loadLevelObj)&&e.details||-1===i?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if(null!=(i=e.details)&&i.hasKey(t))return!0;const n=e.audioGroups;if(n){return this.hls.allAudioTracks.filter(e=>n.indexOf(e.groupId)>=0).some(e=>{var i;return null==(i=e.details)?void 0:i.hasKey(t)})}}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const n=this.hls,s=t.context;switch(t.details){case GE.FRAG_LOAD_ERROR:case GE.FRAG_LOAD_TIMEOUT:case GE.KEY_LOAD_ERROR:case GE.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case GE.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap)return void(t.errorAction=mT());case GE.FRAG_GAP:case GE.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=lT);case GE.LEVEL_EMPTY_ERROR:case GE.LEVEL_PARSING_ERROR:{var r;const e=t.parent===YE?t.level:n.loadLevel;t.details===GE.LEVEL_EMPTY_ERROR&&null!=(r=t.context)&&null!=(r=r.levelDetails)&&r.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case GE.LEVEL_LOAD_ERROR:case GE.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==s?void 0:s.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level)));case GE.AUDIO_TRACK_LOAD_ERROR:case GE.AUDIO_TRACK_LOAD_TIMEOUT:case GE.SUBTITLE_LOAD_ERROR:case GE.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const e=n.loadLevelObj;if(e&&(s.type===WE&&e.hasAudioGroup(s.groupId)||s.type===qE&&e.hasSubtitleGroup(s.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=lT,void(t.errorAction.flags=hT)}return;case GE.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:return void(t.errorAction={action:lT,flags:fT});case GE.KEY_SYSTEM_SESSION_UPDATE_FAILED:case GE.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case GE.KEY_SYSTEM_NO_SESSION:return void(t.errorAction={action:lT,flags:gT});case GE.BUFFER_ADD_CODEC_ERROR:case GE.REMUX_ALLOC_ERROR:case GE.BUFFER_APPEND_ERROR:var a;if(!t.errorAction)t.errorAction=this.getLevelSwitchAction(t,null!=(a=t.level)?a:n.loadLevel);return;case GE.INTERNAL_EXCEPTION:case GE.BUFFER_APPENDING_ERROR:case GE.BUFFER_FULL_ERROR:case GE.LEVEL_SWITCH_ERROR:case GE.BUFFER_STALLED_ERROR:case GE.BUFFER_SEEK_OVER_HOLE:case GE.BUFFER_NUDGE_ON_STALL:return void(t.errorAction=mT())}t.type===VE.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=mT())}getPlaylistRetryOrSwitchAction(e,t){const i=iT(this.hls.config.playlistLoadPolicy,e),n=this.playlistError++;if(rT(i,n,JS(e),e.response))return{action:cT,flags:dT,retryConfig:i,retryCount:n};const s=this.getLevelSwitchAction(e,t);return i&&(s.retryConfig=i,s.retryCount=n),s}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],{fragLoadPolicy:s,keyLoadPolicy:r}=t.config,a=iT(eT(e)?r:s,e),o=t.levels.reduce((e,t)=>e+t.fragmentError,0);if(n&&(e.details!==GE.FRAG_GAP&&n.fragmentError++,!tT(e))){if(rT(a,o,JS(e),e.response))return{action:cT,flags:dT,retryConfig:a,retryCount:o}}const l=this.getLevelSwitchAction(e,i);return a&&(l.retryConfig=a,l.retryCount=o),l}getLevelSwitchAction(e,t){const i=this.hls;null==t&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var s,r;const t=e.details;n.loadError++,t===GE.BUFFER_APPEND_ERROR&&n.fragmentError++;let l=-1;const{levels:u,loadLevel:c,minAutoLevel:d,maxAutoLevel:h}=i;i.autoLevelEnabled||i.config.preserveManualLevelOnError||(i.loadLevel=-1);const f=null==(s=e.frag)?void 0:s.type,g=(f===$E&&t===GE.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===GE.BUFFER_ADD_CODEC_ERROR||t===GE.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:e})=>n.audioCodec!==e),m="video"===e.sourceBufferName&&(t===GE.BUFFER_ADD_CODEC_ERROR||t===GE.BUFFER_APPEND_ERROR)&&u.some(({codecSet:e,audioCodec:t})=>n.codecSet!==e&&n.audioCodec===t),{type:p,groupId:v}=null!=(r=e.context)?r:{};for(let i=u.length;i--;){const s=(i+c)%u.length;if(s!==c&&s>=d&&s<=h&&0===u[s].loadError){var a,o;const i=u[s];if(t===GE.FRAG_GAP&&f===YE&&e.frag){const t=u[s].details;if(t){const i=YS(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else{if(p===WE&&i.hasAudioGroup(v)||p===qE&&i.hasSubtitleGroup(v))continue;if(f===$E&&null!=(a=n.audioGroups)&&a.some(e=>i.hasAudioGroup(e))||f===XE&&null!=(o=n.subtitleGroups)&&o.some(e=>i.hasSubtitleGroup(e))||g&&n.audioCodec===i.audioCodec||m&&n.codecSet===i.codecSet||!g&&n.codecSet!==i.codecSet)continue}l=s;break}}if(l>-1&&i.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:lT,flags:dT,nextAutoLevel:l}}return{action:lT,flags:hT}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case oT:break;case lT:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===GE.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n}=i,s=i.nextAutoLevel;switch(n){case dT:this.switchLevel(e,s);break;case fT:{const n=this.getVariantLevelIndex(e.frag),s=t.levels[n],r=null==s?void 0:s.attrs["HDCP-LEVEL"];if(i.hdcpLevel=r,"NONE"===r)this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(r){t.maxHdcpLevel=RS[RS.indexOf(r)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case gT:{const t=e.decryptdata;if(t){const n=this.hls.levels,s=n.length;for(let i=s;i--;){var r,a;if(this.variantHasKey(n[i],t))this.log(`Banned key found in level ${i} (${n[i].bitrate}bps) or audio group "${null==(r=n[i].audioGroups)?void 0:r.join(",")}" (${null==(a=e.frag)?void 0:a.type} fragment) ${gb(t.keyId||[])}`),n[i].fragmentError++,n[i].loadError++,this.log(`Removing level ${i} with key error (${e.error})`),this.hls.removeLevel(i)}const o=e.frag;if(this.hls.levels.length<s)i.resolved=!0;else if(o&&o.type!==YE){const e=o.decryptdata;e&&!t.matches(e)&&(i.resolved=!0)}}break}}i.resolved||this.switchLevel(e,s)}switchLevel(e,t){if(void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===GE.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&"audiovideo"!==e.sourceBufferName)){const t=bS(e.mimeType),i=this.hls.levels;for(let n=i.length;n--;)i[n][`${e.sourceBufferName}Codec`]===t&&(this.log(`Removing level ${n} for ${e.details} ("${t}" not supported)`),this.hls.removeLevel(n))}}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(QE.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(QE.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const e=n-this.lastTime,s=i-this.lastDroppedFrames,r=t-this.lastDecodedFrames,a=1e3*s/e,o=this.hls;if(o.trigger(QE.FPS_DROP,{currentDropped:s,currentDecoded:r,totalDroppedFrames:i}),a>0&&s>o.config.fpsDroppedMonitoringThreshold*r){let e=o.currentLevel;o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=e)&&(e-=1,o.trigger(QE.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:o.currentLevel}),o.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:gk,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:bR,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends pw{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",XE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(QE.LEVEL_LOADED,this.onLevelLoaded,this),e.on(QE.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(QE.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(QE.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(QE.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(QE.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(QE.LEVEL_LOADED,this.onLevelLoaded,this),e.off(QE.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(QE.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(QE.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(QE.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(QE.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=rw,this.setInterval(500),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:n}=t;if(this.fragContextChanged(i)||(xb(i)&&(this.fragPrevious=i),this.state=rw),!n)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let r;const a=i.start;for(let l=0;l<s.length;l++)if(a>=s[l].start&&a<=s[l].end){r=s[l];break}const o=i.start+i.duration;r?r.end=o:(r={start:a,end:o},s.push(r)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:n}=t;if(0===i&&n!==Number.POSITIVE_INFINITY){const e=n-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach(t=>{for(let i=0;i<t.length;)if(t[i].end<=e)t.shift();else{if(!(t[i].start<e))break;t[i].start=e,i++}}),this.fragmentTracker.removeFragmentsInRange(i,e,XE)}}onError(e,t){const i=t.frag;(null==i?void 0:i.type)===XE&&(t.details===GE.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==sw&&(this.state=rw))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){this.levels&&YI(this.levels,t)?this.levels=t.map(e=>new FS(e)):(this.tracksBuffered=[],this.levels=t.map(e=>{const t=new FS(e);return this.tracksBuffered[t.id]=[],t}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,XE),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,null==(i=this.levels)||!i.length||-1===this.currentTrackId)return void this.clearInterval();const n=this.levels[this.currentTrackId];null!=n&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==sw&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:n,levels:s}=this,{details:r,id:a}=t;if(!s)return void this.warn(`Subtitle tracks were reset while loading level ${a}`);const o=s[a];if(a>=s.length||!o)return;this.log(`Subtitle track ${a} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(r.live||null!=(i=o.details)&&i.live){if(r.deltaUpdateFailed)return;const e=this.mainDetails;if(!e)return void(this.startFragRequested=!1);const t=e.fragments[0];var u;if(o.details)l=this.alignPlaylists(r,o.details,null==(u=this.levelLastLoaded)?void 0:u.details),0===l&&t&&(l=t.start,Vk(r,l));else r.hasProgramDateTime&&e.hasProgramDateTime?(ew(r,e),l=r.fragmentStart):t&&(l=t.start,Vk(r,l));e&&!this.startFragRequested&&this.setStartPosition(e,l)}if(o.details=r,this.levelLastLoaded=o,a===n&&(this.hls.trigger(QE.SUBTITLE_TRACK_UPDATED,{details:r,id:a,groupId:t.groupId}),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===rw)){YS(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,n=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&null!=n&&n.key&&n.iv&&JT(n.method)){const e=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,ek(n.method)).catch(e=>{throw s.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e}).then(i=>{const n=performance.now();s.trigger(QE.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:n}})}).catch(e=>{this.warn(`${e.name}: ${e.message}`),this.state=rw})}}doTick(){if(this.media){if(this.state===rw){const{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;if(this.waitForLive(i))return;const{config:n}=this,s=this.getLoadPosition(),r=NT.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,n.maxBufferHole),{end:a,len:o}=r,l=i.details;if(o>this.hls.maxBufferLength+l.levelTargetDuration)return;const u=l.fragments,c=u.length,d=l.edge;let h=null;const f=this.fragPrevious;if(a<d){const e=n.maxFragLookUpTolerance,t=a>d-e?0:e;h=YS(f,u,Math.max(u[0].start,a),t),!h&&f&&f.start<u[0].start&&(h=u[0])}else h=u[c-1];if(h=this.filterReplacedPrimary(h,i.details),!h)return;const g=u[h.sn-l.startSN-1];if(g&&g.cc===h.cc&&this.fragmentTracker.getState(g)===pT&&(h=g),this.fragmentTracker.getState(h)===pT){const e=this.mapToInitFragWhenRequired(h);e&&this.loadFragment(e,i,a)}}}else this.state=rw}loadFragment(e,t,i){xb(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new wC(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends qI{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null;const t=uC(this.media.textTracks);for(let n=0;n<t.length;n++)if("hidden"===t[n].mode)e=t[n];else if("showing"===t[n].mode){e=t[n];break}const i=this.findTrackForTextTrack(e);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.on(QE.LEVEL_LOADING,this.onLevelLoading,this),e.on(QE.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(QE.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(QE.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.off(QE.LEVEL_LOADING,this.onLevelLoading,this),e.off(QE.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(QE.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(QE.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;uC(i.textTracks).forEach(e=>{oC(e)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n)return void this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${null==r?void 0:r.groupId}`);const a=r.details;r.details=t.details,this.log(`Subtitle track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(null==n?void 0:n.length)!==(null==i?void 0:i.length)||null!=i&&i.some(e=>-1===(null==n?void 0:n.indexOf(e)))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter(e=>!i||-1!==i.indexOf(e.groupId));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!s&&t){this.selectDefaultTrack=!1;const i=GS(t,e);if(i>-1)s=e[i];else{const e=GS(t,this.tracks);s=this.tracks[e]}}let n=this.findTrackId(s);-1===n&&s&&(n=this.findTrackId(null));const r={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger(QE.SUBTITLE_TRACKS_UPDATED,r),-1!==n&&-1===this.trackId&&this.setSubtitleTrack(n)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let n=0;n<t.length;n++){const s=t[n];if((!i||s.default)&&(i||e)&&(!e||QS(s,e)))return n}if(e){for(let i=0;i<t.length;i++){const n=t[i];if($I(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const n=t[i];if($I(e.attrs,n.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){if(XI(t[i],e))return i}}return-1}onError(e,t){!t.fatal&&t.context&&(t.context.type!==qE||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(-1===e.id)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&QS(e,i))return i;const n=GS(e,this.tracksInGroup);if(n>-1){const e=this.tracksInGroup[n];return this.setSubtitleTrack(n),e}if(i)return null;{const i=GS(e,t);if(i>-1)return t[i]}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,a=null==r?void 0:r.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${n}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""}${a&&r.live?" age "+a.toFixed(1)+(r.type&&" "+r.type||""):""} ${s}`),this.hls.trigger(QE.SUBTITLE_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=uC(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(e=>XI(i,e))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(e=>{"disabled"!==e.mode&&e!==n&&(e.mode="disabled")}),n){const e=this.subtitleDisplay?"showing":"hidden";n.mode!==e&&(n.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!UE(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e]||null;if(this.trackId=e,this.currentTrack=n,this.toggleTrackModes(),!n)return void this.hls.trigger(QE.SUBTITLE_TRACK_SWITCH,{id:e});const s=!!n.details&&!n.details.live;if(e===this.trackId&&n===i&&s)return;this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:r,groupId:a="",name:o,type:l,url:u}=n;this.hls.trigger(QE.SUBTITLE_TRACK_SWITCH,{id:r,groupId:a,name:o,type:l,url:u});const c=this.switchParams(n.url,null==i?void 0:i.details,n.details);this.loadPlaylist(c)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(QE.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(QE.FRAG_LOADING,this.onFragLoading,this),e.on(QE.FRAG_LOADED,this.onFragLoaded,this),e.on(QE.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(QE.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(QE.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(QE.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(QE.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(QE.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(QE.FRAG_LOADING,this.onFragLoading,this),e.off(QE.FRAG_LOADED,this.onFragLoaded,this),e.off(QE.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(QE.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(QE.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(QE.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(QE.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new pR(this,"textTrack1"),t=new pR(this,"textTrack2"),i=new pR(this,"textTrack3"),n=new pR(this,"textTrack4");this.cea608Parser1=new VC(1,e,t),this.cea608Parser2=new VC(3,i,n)}addCues(e,t,i,n,s){let r=!1;for(let a=s.length;a--;){const e=s[a],n=AR(e[0],e[1],t,i);if(n>=0&&(e[0]=Math.min(e[0],t),e[1]=Math.max(e[1],i),r=!0,n/(i-t)>.5))return}if(r||s.push([t,i]),this.config.renderTextTracksNatively){const s=this.captionsTracks[e];this.Cues.newCue(s,t,i,n)}else{const s=this.Cues.newCue(null,t,i,n);this.hls.trigger(QE.CUES_PARSED,{type:"captions",cues:s,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s,trackId:r}){const{unparsedVttFrags:a}=this;i===YE&&(this.initPTS[t.cc]={baseTime:n,timescale:s,trackId:r}),a.length&&(this.unparsedVttFrags=[],a.forEach(e=>{this.initPTS[e.frag.cc]?this.onFragLoaded(QE.FRAG_LOADED,e):this.hls.trigger(QE.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n<i.textTracks.length;n++){const s=i.textTracks[n];if(yR(s,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:n}=this,{label:s,languageCode:r}=t[e],a=this.getExistingTrack(s,r);if(a)i[e]=a,oC(i[e]),rC(i[e],n);else{const t=this.createTextTrack("captions",s,r);t&&(t[e]=!0,i[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(QE.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,i){const n=this.media;if(n)return n.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:n}=this;Object.keys(n).forEach(e=>{oC(n[e]),delete n[e]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)oC(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some(e=>e.textCodec===rR);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(YI(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const e=this.media,t=e?uC(e.textTracks):null;if(this.tracks.forEach((e,i)=>{let n;if(t){let i=null;for(let n=0;n<t.length;n++)if(t[n]&&yR(t[n],e)){i=t[n],t[n]=null;break}i&&(n=i)}if(n)oC(n);else{const t=vR(e);n=this.createTextTrack(t,e.name,e.lang),n&&(n.mode="disabled")}n&&this.textTracks.push(n)}),null!=t&&t.length){const e=t.filter(e=>null!==e).map(e=>e.label);e.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const e=this.tracks.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(QE.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const i=`textTrack${t[1]}`,n=this.captionsProperties[i];n&&(n.label=e.name,e.lang&&(n.languageCode=e.lang),n.media=e)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===YE){var i,n;const{cea608Parser1:e,cea608Parser2:s,lastSn:r}=this,{cc:a,sn:o}=t.frag,l=null!=(i=null==(n=t.part)?void 0:n.index)?i:-1;e&&s&&(o!==r+1||o===r&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(e.reset(),s.reset()),this.lastCc=a,this.lastSn=o,this.lastPartIndex=l}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===XE)if(n.byteLength){const e=i.decryptdata,s="stats"in t;if(null==e||!e.encrypted||s){const e=this.tracks[i.level],s=this.vttCCs;s[i.cc]||(s[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===rR?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger(QE.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;uR(t,this.initPTS[e.cc],t=>{this._appendCues(t,e.level),i.trigger(QE.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},t=>{i.logger.log(`Failed to parse IMSC1: ${t}`),i.trigger(QE.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})}_parseVTTs(e){var t;const{frag:i,payload:n}=e,{initPTS:s,unparsedVttFrags:r}=this,a=s.length-1;if(!s[i.cc]&&-1===a)return void r.push(e);const o=this.hls;sR(null!=(t=i.initSegment)&&t.data?Zb(i.initSegment.data,new Uint8Array(n)).buffer:n,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,e=>{this._appendCues(e,i.level),o.trigger(QE.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},t=>{const s="Missing initPTS for VTT MPEGTS"===t.message;s?r.push(e):this._fallbackToIMSC1(i,n),o.logger.log(`Failed to parse VTT cue: ${t}`),s&&a>i.cc||o.trigger(QE.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||uR(t,this.initPTS[e.cc],()=>{i.textCodec=rR,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach(e=>aC(i,e))}else{const n=this.tracks[t];if(!n)return;const s=n.default?"default":"subtitles"+t;i.trigger(QE.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===XE&&this.onFragLoaded(QE.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:n}=t;if(i.type!==YE||"NONE"!==this.closedCaptionsForLevel(i))for(let s=0;s<n.length;s++){const e=n[s].bytes;if(e){this.cea608Parser1||this.initCea608Parsers();const t=this.extractCea608Data(e);this.cea608Parser1.addData(n[s].pts,t[0]),this.cea608Parser2.addData(n[s].pts,t[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:n,type:s}){const{media:r}=this;if(r&&!(r.currentTime<i)){if(!s||"video"===s){const{captionsTracks:e}=this;Object.keys(e).forEach(n=>lC(e[n],t,i))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==n){const{textTracks:e}=this;Object.keys(e).forEach(i=>lC(e[i],t,n))}}}extractCea608Data(e){const t=[[],[]],i=31&e[0];let n=2;for(let s=0;s<i;s++){const i=e[n++],s=127&e[n++],r=127&e[n++];if(0===s&&0===r)continue;if(!!(4&i)){const e=3&i;0!==e&&1!==e||(t[e].push(s),t[e].push(r))}}return t}},audioStreamController:class extends pw{constructor(e,t,i){super(e,t,i,"audio-stream-controller",$E),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(QE.LEVEL_LOADED,this.onLevelLoaded,this),e.on(QE.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(QE.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(QE.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(QE.BUFFER_RESET,this.onBufferReset,this),e.on(QE.BUFFER_CREATED,this.onBufferCreated,this),e.on(QE.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(QE.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(QE.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(QE.FRAG_LOADING,this.onFragLoading,this),e.on(QE.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(QE.LEVEL_LOADED,this.onLevelLoaded,this),e.off(QE.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(QE.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(QE.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(QE.BUFFER_RESET,this.onBufferReset,this),e.off(QE.BUFFER_CREATED,this.onBufferCreated,this),e.off(QE.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(QE.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(QE.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(QE.FRAG_LOADING,this.onFragLoading,this),e.off(QE.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s,trackId:r}){if(i===YE){const e=t.cc,i=this.fragCurrent;if(this.initPTS[e]={baseTime:n,timescale:s,trackId:r},this.log(`InitPTS for cc: ${e} found from main: ${n/s} (${n}/${s}) trackId: ${r}`),this.mainAnchor=t,this.state===gw){const i=this.waitingData;(!i&&!this.loadingParts||i&&i.frag.cc!==e)&&this.syncWithAnchor(t,null==i?void 0:i.frag)}else!this.hls.hasEnoughToStart&&i&&i.cc!==e?(i.abortRequests(),this.syncWithAnchor(t,i)):this.state===rw&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const n=(null==(i=this.mainFragLoading)?void 0:i.frag)||null;if(t&&(null==n?void 0:n.cc)===t.cc)return;const s=(n||e).cc,r=ZS(this.getLevelDetails(),s,this.getLoadPosition());r&&(this.log(`Syncing with main frag at ${r.start} cc ${r.cc}`),this.startFragRequested=!1,this.nextLoadPosition=r.start,this.resetLoadingState(),this.state===rw&&this.doTickIdle())}startLoad(e,t){if(!this.levels)return this.startPosition=e,void(this.state=sw);const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),i>0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=rw):this.state=uw,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case rw:this.doTickIdle();break;case uw:{const{levels:e,trackId:t}=this,i=null==e?void 0:e[t],n=null==i?void 0:i.details;if(n&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(n))break;this.state=gw}break}case lw:this.checkRetryDate();break;case gw:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:n,complete:s}=e,r=this.mainAnchor;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.state=ow;const e={frag:t,part:i,payload:n.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(e),s&&super._handleFragmentLoadComplete(e)}else r&&r.cc!==e.frag.cc&&this.syncWithAnchor(r,e.frag)}else this.state=rw}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:n,trackId:s}=this,r=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!r.startFragPrefetch)||null==i||!i[s])return;const a=i[s],o=a.details;if(!o||this.waitForLive(a)||this.waitForCdnTuneIn(o))return this.state=uw,void(this.startFragRequested=!1);const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,Ib,$E));const u=this.getFwdBufferInfo(l,$E);if(null===u)return;if(!this.switchingTrack&&this._streamEnded(u,o))return t.trigger(QE.BUFFER_EOS,{type:"audio"}),void(this.state=hw);const c=u.len,d=t.maxBufferLength,h=o.fragments,f=h[0].start,g=this.getLoadPosition(),m=this.flushing?g:u.end;if(this.switchingTrack&&n){const e=g;o.PTSKnown&&e<f&&(u.end>f||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=f+.05)}if(c>=d&&!this.switchingTrack&&m<h[h.length-1].start)return;let p=this.getNextFragment(m,o);if(p&&this.isLoopLoading(p,m)&&(p=this.getNextFragmentLoopLoading(p,o,u,YE,d)),!p)return void(this.bufferFlushed=!0);let v=(null==(e=this.mainFragLoading)?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&v&&xb(p)&&!p.endList&&(!o.live||!this.loadingParts&&m<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(v)===AT&&(this.mainFragLoading=v=null),v&&xb(v))){if(p.start>v.end){const e=this.fragmentTracker.getFragAtPos(m,YE);e&&e.end>v.end&&(v=e,this.mainFragLoading={frag:e,targetBufferTime:null})}if(p.start>v.end)return}this.loadFragment(p,a,m)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(e=>new FS(e))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==sw&&(this.setInterval(100),this.state=rw,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(QE.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:n}=this,{details:s,id:r,groupId:a,track:o}=t;if(!n)return void this.warn(`Audio tracks reset while loading track ${r} "${o.name}" of "${a}"`);const l=this.mainDetails;if(!l||s.endCC>l.endCC||l.expired)return this.cachedTrackLoadedData=t,void(this.state!==sw&&(this.state=uw));this.cachedTrackLoadedData=null,this.log(`Audio track ${r} "${o.name}" of "${a}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const u=n[r];let c=0;if(s.live||null!=(i=u.details)&&i.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;var d;if(u.details)c=this.alignPlaylists(s,u.details,null==(d=this.levelLastLoaded)?void 0:d.details);s.alignedSliding||(Jk(s,l),s.alignedSliding||ew(s,l),c=s.fragmentStart)}u.details=s,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(l,c),this.hls.trigger(QE.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state!==uw||this.waitForCdnTuneIn(s)||(this.state=rw),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{config:r,trackId:a,levels:o}=this;if(!o)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const l=o[a];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const u=l.details;if(!u)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);const c=r.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let d=this.transmuxer;d||(d=this.transmuxer=new WI(this.hls,$E,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const h=this.initPTS[i.cc],f=null==(t=i.initSegment)?void 0:t.data;if(void 0!==h){const e=!1,t=n?n.index:-1,r=-1!==t,a=new FT(i.level,i.sn,i.stats.chunkCount,s.byteLength,t,r);d.push(s,f,c,"",i,n,u.totalduration,e,a,h)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${u.startSN} ,${u.endSN}],track ${a}`);const{cache:e}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new yw,complete:!1};e.push(new Uint8Array(s)),this.state!==sw&&(this.state=gw)}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===YE&&xb(t.frag)&&(this.mainFragLoading=t,this.state===rw&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type===$E)if(this.fragContextChanged(i))this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if(xb(i)){this.fragPrevious=i;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(QE.AUDIO_TRACK_SWITCHED,nb({},e)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}else this.audioOnly||i.type!==YE||i.elementaryStreams.video||i.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null)}onError(e,t){var i;if(t.fatal)this.state=fw;else switch(t.details){case GE.FRAG_GAP:case GE.FRAG_PARSING_ERROR:case GE.FRAG_DECRYPT_ERROR:case GE.FRAG_LOAD_ERROR:case GE.FRAG_LOAD_TIMEOUT:case GE.KEY_LOAD_ERROR:case GE.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError($E,t);break;case GE.AUDIO_TRACK_LOAD_ERROR:case GE.AUDIO_TRACK_LOAD_TIMEOUT:case GE.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==uw||(null==(i=t.context)?void 0:i.type)!==WE||(this.state=rw);break;case GE.BUFFER_ADD_CODEC_ERROR:case GE.BUFFER_APPEND_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case GE.BUFFER_FULL_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case GE.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==Lb&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Lb){this.flushing=!1,this.bufferFlushed=!0,this.state===hw&&(this.state=rw);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,$E),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:n}=this,{remuxResult:s,chunkMeta:r}=e,a=this.getCurrentContext(r);if(!a)return void this.resetWhenMissingContext(r);const{frag:o,part:l,level:u}=a,{details:c}=u,{audio:d,text:h,id3:f,initSegment:g}=s;if(!this.fragContextChanged(o)&&c){if(this.state=cw,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),null!=g&&g.tracks){const e=o.initSegment||o;if(this.unhandledEncryptionError(g,o))return;this._bufferInitSegment(u,g.tracks,e,r),n.trigger(QE.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:g.tracks})}if(d){const{startPTS:e,endPTS:t,startDTS:i,endDTS:n}=d;l&&(l.elementaryStreams[Ib]={startPTS:e,endPTS:t,startDTS:i,endDTS:n}),o.setElementaryStreamInfo(Ib,e,t,i,n),this.bufferFragmentData(d,o,l,r)}if(null!=f&&null!=(t=f.samples)&&t.length){const e=tb({id:i,frag:o,details:c},f);n.trigger(QE.FRAG_PARSING_METADATA,e)}if(h){const e=tb({id:i,frag:o,details:c},h);n.trigger(QE.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(o)}_bufferInitSegment(e,t,i,n){if(this.state!==cw)return;if(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio)return;const s=t.audio;s.id=$E;const r=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${r}/${s.codec}]`),r&&1===r.split(",").length&&(s.levelCodec=r),this.hls.trigger(QE.BUFFER_CODECS,t);const a=s.initSegment;if(null!=a&&a.byteLength){const e={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:a};this.hls.trigger(QE.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);var s;if(this.switchingTrack||n===pT||n===yT)if(xb(e))if(null!=(s=t.details)&&s.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=gw;const i=this.mainDetails;i&&i.fragmentStart!==t.details.fragmentStart&&ew(t.details,i)}else super.loadFragment(e,t,i);else this._loadInitSegment(e,t);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:a}=this.bufferedTrack;QS({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:a},e,KS)||(WS(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(QE.AUDIO_TRACK_SWITCHED,nb({},e))}},audioTrackController:class extends qI{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.on(QE.LEVEL_LOADING,this.onLevelLoading,this),e.on(QE.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(QE.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(QE.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.off(QE.LEVEL_LOADING,this.onLevelLoading,this),e.off(QE.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(QE.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(QE.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:n,details:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n)return void this.warn(`Audio track with id:${i} and group:${n} not found in active group ${null==r?void 0:r.groupId}`);const a=r.details;r.details=t.details,this.log(`Audio track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,n=this.groupIds;let s=this.currentTrack;if(!i||(null==n?void 0:n.length)!==(null==i?void 0:i.length)||null!=i&&i.some(e=>-1===(null==n?void 0:n.indexOf(e)))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter(e=>!i||-1!==i.indexOf(e.groupId));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!s&&t){const i=GS(t,e,KS);if(i>-1)s=e[i];else{const e=GS(t,this.tracks);s=this.tracks[e]}}let n=this.findTrackId(s);-1===n&&s&&(n=this.findTrackId(null));const a={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger(QE.AUDIO_TRACKS_UPDATED,a);const o=this.trackId;if(-1!==n&&-1===o)this.setAudioTrack(n);else if(e.length&&-1===o){var r;const t=new Error(`No audio track selected for current audio group-ID(s): ${null==(r=this.groupIds)?void 0:r.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}}onError(e,t){!t.fatal&&t.context&&(t.context.type!==WE||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const n=this.currentTrack;if(n&&QS(e,n,KS))return n;const s=GS(e,this.tracksInGroup,KS);if(s>-1){const e=this.tracksInGroup[s];return this.setAudioTrack(s),e}if(n){let n=t.loadLevel;-1===n&&(n=t.firstAutoLevel);const s=function(e,t,i,n,s){const r=t[n],a=t.reduce((e,t,i)=>{const n=t.uri;return(e[n]||(e[n]=[])).push(i),e},{})[r.uri];a.length>1&&(n=Math.max.apply(Math,a));const o=r.videoRange,l=r.frameRate,u=r.codecSet.substring(0,4),c=zS(t,n,t=>{if(t.videoRange!==o||t.frameRate!==l||t.codecSet.substring(0,4)!==u)return!1;const n=t.audioGroups,r=i.filter(e=>!n||-1!==n.indexOf(e.groupId));return GS(e,r,s)>-1});return c>-1?c:zS(t,n,t=>{const n=t.audioGroups,r=i.filter(e=>!n||-1!==n.indexOf(e.groupId));return GS(e,r,s)>-1})}(e,t.levels,i,n,KS);if(-1===s)return null;t.nextLoadLevel=s}if(e.channels||e.audioCodec){const t=GS(e,i);if(t>-1)return i[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e],s=n.details&&!n.details.live;if(e===this.trackId&&n===i&&s)return;if(this.log(`Switching to audio-track ${e} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=e,this.currentTrack=n,this.hls.trigger(QE.AUDIO_TRACK_SWITCHING,nb({},n)),s)return;const r=this.switchParams(n.url,null==i?void 0:i.details,n.details);this.loadPlaylist(r)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if((!this.selectDefaultTrack||n.default)&&(!e||QS(e,n,KS)))return i}if(e){const{name:i,lang:n,assocLang:s,characteristics:r,audioCodec:a,channels:o}=e;for(let e=0;e<t.length;e++){if(QS({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:a,channels:o},t[e],KS))return e}for(let l=0;l<t.length;l++){const i=t[l];if($I(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<t.length;l++){const i=t[l];if($I(e.attrs,i.attrs,["LANGUAGE"]))return l}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&WS(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,a=null==r?void 0:r.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${n}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""}${a&&r.live?" age "+a.toFixed(1)+(r.type&&" "+r.type||""):""} ${s}`),this.hls.trigger(QE.AUDIO_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}},emeController:eC,cmcdController:class{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:rL.MANIFEST,su:!this.initialized})}catch(t){this.hls.logger.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=e=>{try{const{frag:t,part:i}=e,n=this.hls.levels[t.level],s=this.getObjectType(t),r={d:1e3*(i||t).duration,ot:s};s!==rL.VIDEO&&s!==rL.AUDIO&&s!=rL.MUXED||(r.br=n.bitrate/1e3,r.tb=this.getTopBandwidth(s)/1e3,r.bl=this.getBufferLength(s));const a=i?this.getNextPart(i):this.getNextFrag(t);null!=a&&a.url&&a.url!==t.url&&(r.nor=a.url),this.apply(e,r)}catch(t){this.hls.logger.warn("Could not generate segment CMCD data.",t)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(QE.MEDIA_DETACHED,this.onMediaDetached,this),e.on(QE.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(QE.MEDIA_DETACHED,this.onMediaDetached,this),e.off(QE.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,n;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(n=t.tracks.video)?void 0:n.buffer}createData(){var e;return{v:1,sf:aL.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){tb(t,this.createData());const i=t.ot===rL.INIT||t.ot===rL.VIDEO||t.ot===rL.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((e,i)=>(n.includes(i)&&(e[i]=t[i]),e),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),qL(e.headers,t,s)):e.url=XL(e.url,t,s)}getNextFrag(e){var t;const i=null==(t=this.hls.levels[e.level])?void 0:t.details;if(i){const t=e.sn-i.startSN;return i.fragments[t+1]}}getNextPart(e){var t;const{index:i,fragment:n}=e,s=null==(t=this.hls.levels[n.level])||null==(t=t.details)?void 0:t.partList;if(s){const{sn:e}=n;for(let t=s.length-1;t>=0;t--){const n=s[t];if(n.index===i&&n.fragment.sn===e)return s[t+1]}}}getObjectType(e){const{type:t}=e;return"subtitle"===t?rL.TIMED_TEXT:"initSegment"===e.sn?rL.INIT:"audio"===t?rL.AUDIO:"main"===t?this.hls.audioTracks.length?rL.VIDEO:rL.MUXED:void 0}getTopBandwidth(e){let t,i=0;const n=this.hls;if(e===rL.AUDIO)t=n.audioTracks;else{const e=n.maxAutoLevel,i=e>-1?e+1:n.levels.length;t=n.levels.slice(0,i)}return t.forEach(e=>{e.bitrate>i&&(i=e.bitrate)}),i>0?i:NaN}getBufferLength(e){const t=this.media,i=e===rL.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!t)return NaN;return 1e3*NT.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,n){t(e),this.loader.load(e,i,n)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,n){t(e),this.loader.load(e,i,n)}}}},contentSteeringController:class extends sb{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.on(QE.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.off(QE.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(t=>t!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((null==i?void 0:i.action)===lT&&i.flags===hT){const e=this.levels;let n=this._pathwayPriority,s=this.pathwayId;if(t.context){const{groupId:i,pathwayId:n,type:r}=t.context;i&&e?s=this.getPathwayForGroupId(i,r,s):n&&(s=n)}s in this.penalizedPathways||(this.penalizedPathways[s]=performance.now()),!n&&e&&(n=this.pathways()),n&&n.length>1&&(this.updatePathwayPriority(n),i.resolved=this.pathwayId!==s),t.details!==GE.BUFFER_APPEND_ERROR||t.fatal?i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${s} levels: ${e?e.length:e} priorities: ${US(n)} penalized: ${US(this.penalizedPathways)}`):i.resolved=!0}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){let t;this._pathwayPriority=e;const i=this.penalizedPathways,n=performance.now();Object.keys(i).forEach(e=>{n-i[e]>3e5&&delete i[e]});for(let s=0;s<e.length;s++){const n=e[s];if(n in i)continue;if(n===this.pathwayId)return;const r=this.hls.nextLoadLevel,a=this.hls.levels[r];if(t=this.getLevelsForPathway(n),t.length>0){this.log(`Setting Pathway to "${n}"`),this.pathwayId=n,Wk(t),this.hls.trigger(QE.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[r];a&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=r);break}}}getPathwayForGroupId(e,t,i){const n=this.getLevelsForPathway(i).concat(this.levels||[]);for(let s=0;s<n.length;s++)if(t===WE&&n[s].hasAudioGroup(e)||t===qE&&n[s].hasSubtitleGroup(e))return n[s].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},n={};e.forEach(e=>{const{ID:s,"BASE-ID":r,"URI-REPLACEMENT":a}=e;if(t.some(e=>e.pathwayId===s))return;const o=this.getLevelsForPathway(r).map(e=>{const t=new zT(e.attrs);t["PATHWAY-ID"]=s;const r=t.AUDIO&&`${t.AUDIO}_clone_${s}`,o=t.SUBTITLES&&`${t.SUBTITLES}_clone_${s}`;r&&(i[t.AUDIO]=r,t.AUDIO=r),o&&(n[t.SUBTITLES]=o,t.SUBTITLES=o);const l=JL(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),u=new FS({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let i=1;i<e.audioGroups.length;i++)u.addGroupId("audio",`${e.audioGroups[i]}_clone_${s}`);if(e.subtitleGroups)for(let i=1;i<e.subtitleGroups.length;i++)u.addGroupId("text",`${e.subtitleGroups[i]}_clone_${s}`);return u});t.push(...o),ZL(this.audioTracks,i,a,s),ZL(this.subtitleTracks,n,a,s)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;let n;this.loader&&this.loader.destroy(),this.loader=new i(t);try{n=new self.URL(e)}catch(u){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest URI: ${e}`)}if("data:"!==n.protocol){const e=0|(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate);n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+e)}const s={responseType:"json",url:n.href},r=t.steeringManifestLoadPolicy.default,a=r.errorRetry||r.timeoutRetry||{},o={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(e,t,i,s)=>{this.log(`Loaded steering manifest: "${n}"`);const r=e.data;if(1!==(null==r?void 0:r.VERSION))return void this.log(`Steering VERSION ${r.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=r.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":l}=r;if(a)try{this.uri=new self.URL(a,n).href}catch(u){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${a}`)}this.scheduleRefresh(this.uri||i.url),o&&this.clonePathways(o);const c={steeringManifest:r,url:n.toString()};this.hls.trigger(QE.STEERING_MANIFEST_LOADED,c),l&&this.updatePathwayPriority(l)},onError:(e,t,i,n)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let s=1e3*this.timeToLoad;if(429===e.code){const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(s=1e3*parseFloat(t))}return void this.log(`Steering manifest ${t.url} rate limited`)}this.scheduleRefresh(this.uri||t.url,s)},onTimeout:(e,t,i)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(s,o,l)}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var t;const i=null==(t=this.hls)?void 0:t.media;!i||i.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)},t)}},interstitialsController:class extends sb{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const e=this.currentTime;if(void 0===e||this.playbackDisabled||!this.schedule)return;const t=e-this.timelinePos;if(Math.abs(t)<1/7056e5)return;const i=t<=-.01;this.timelinePos=e,this.bufferedPos=e;const n=this.playingItem;if(!n)return void this.checkBuffer();if(i){this.schedule.resetErrorsInRange(e,e-t)&&this.updateSchedule(!0)}if(this.checkBuffer(),i&&e<n.start||e>=n.end){var s;const t=this.findItemIndex(n);let r=this.schedule.findItemIndexAtTime(e);if(-1===r&&(r=t+(i?-1:1),this.log(`seeked ${i?"back ":""}to position not covered by schedule ${e} (resolving from ${t} to ${r})`)),!this.isInterstitial(n)&&null!=(s=this.media)&&s.paused&&(this.shouldPlay=!1),!i&&r>t){const e=this.schedule.findJumpRestrictedIndex(t+1,r);if(e>t)return void this.setSchedulePosition(e)}return void this.setSchedulePosition(r)}const r=this.playingAsset;if(!r){if(this.playingLastItem&&this.isInterstitial(n)){const t=n.event.assetList[0];t&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(e,t))}return}const a=r.timelineStart,o=r.duration||0;var l;(i&&e<a||e>=a+o)&&(null!=(l=n.event)&&l.appendInPlace&&(this.clearAssetPlayers(n.event,n),this.flushFrontBuffer(e)),this.setScheduleToAssetAtTime(e,r))},this.onTimeupdate=()=>{const e=this.currentTime;if(void 0===e||this.playbackDisabled)return;if(!(e>this.timelinePos))return;this.timelinePos=e,e>this.bufferedPos&&this.checkBuffer();const t=this.playingItem;if(!t||this.playingLastItem)return;if(e>=t.end){this.timelinePos=t.end;const e=this.findItemIndex(t);this.setSchedulePosition(e+1)}const i=this.playingAsset;if(!i)return;e>=i.timelineStart+(i.duration||0)&&this.setScheduleToAssetAtTime(e,i)},this.onScheduleUpdate=(e,t)=>{const i=this.schedule;if(!i)return;const n=this.playingItem,s=i.events||[],r=i.items||[],a=i.durations,o=e.map(e=>e.identifier),l=!(!s.length&&!o.length);(l||t)&&this.log(`INTERSTITIALS_UPDATED (${s.length}): ${s}\nSchedule: ${r.map(e=>bC(e))} pos: ${this.timelinePos}`),o.length&&this.log(`Removed events ${o}`);let u=null,c=null;n&&(u=this.updateItem(n,this.timelinePos),this.itemsMatch(n,u)?this.playingItem=u:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const d=this.bufferingItem;if(d&&(c=this.updateItem(d,this.bufferedPos),this.itemsMatch(d,c)?this.bufferingItem=c:d.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(d.event,null))),e.forEach(e=>{e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,null)})}),this.playerQueue.forEach(e=>{if(e.interstitial.appendInPlace){const i=e.assetItem.timelineStart,n=e.timelineOffset-i;if(n)try{e.timelineOffset=i}catch(t){Math.abs(n)>dC&&this.warn(`${t} ("${e.assetId}" ${e.timelineOffset}->${i})`)}}}),l||t){if(this.hls.trigger(QE.INTERSTITIALS_UPDATED,{events:s.slice(0),schedule:r.slice(0),durations:a,removedIds:o}),this.isInterstitial(n)&&o.includes(n.event.identifier))return this.warn(`Interstitial "${n.event.identifier}" removed while playing`),void this.primaryFallback(n.event);n&&this.trimInPlace(u,n),d&&c!==u&&this.trimInPlace(c,d),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new SC(e),this.schedule=new EC(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(QE.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(QE.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(QE.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(QE.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(QE.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(QE.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(QE.BUFFER_APPENDED,this.onBufferAppended,this),e.on(QE.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(QE.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(QE.MEDIA_ENDED,this.onMediaEnded,this),e.on(QE.ERROR,this.onError,this),e.on(QE.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(QE.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(QE.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(QE.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(QE.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(QE.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(QE.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(QE.BUFFER_CODECS,this.onBufferCodecs,this),e.off(QE.BUFFER_APPENDED,this.onBufferAppended,this),e.off(QE.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(QE.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(QE.MEDIA_ENDED,this.onMediaEnded,this),e.off(QE.ERROR,this.onError,this),e.off(QE.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;null==(e=this.getBufferingPlayer())||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.getBufferingPlayer())||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){iw(e,"play",this.onPlay),iw(e,"pause",this.onPause),iw(e,"seeking",this.onSeeking),iw(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;tw(i,"seeking",this.onSeeking),tw(i,"timeupdate",this.onTimeupdate),tw(i,"play",this.onPlay),tw(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,null===i)this.checkStart();else if(!n){this.clearScheduleState();const e=this.findItemIndex(i);this.setSchedulePosition(e)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),this.detachedData)){const e=this.getBufferingPlayer();e&&(this.log(`Removing schedule state for detachedData and ${e}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,e.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=t=>t?e.getAssetPlayer(t.identifier):t,n=(t,n,r,a,o)=>{if(t){let l=t[n].start;const u=t.event;if(u){if("playout"===n||u.timelineOccupancy!==hC.Point){const e=i(r);(null==e?void 0:e.interstitial)===u&&(l+=e.assetItem.startOffset+e[o])}}else{l+=("bufferedPos"===a?s():e[a])-t.start}return l}return 0},s=()=>{const t=e.bufferedPos;return t===Number.MAX_VALUE?r("primary"):Math.max(t,0)},r=t=>{var i,n;return null!=(i=e.primaryDetails)&&i.live?e.primaryDetails.edge:(null==(n=e.schedule)?void 0:n.durations[t])||0},a=(t,s)=>{var r,a;const o=e.effectivePlayingItem;if(null!=o&&null!=(r=o.event)&&r.restrictions.skip||!e.schedule)return;e.log(`seek to ${t} "${s}"`);const l=e.effectivePlayingItem,u=e.schedule.findItemIndexAtTime(t,s),c=null==(a=e.schedule.items)?void 0:a[u],d=e.getBufferingPlayer(),h=null==d?void 0:d.interstitial,f=null==h?void 0:h.appendInPlace,g=l&&e.itemsMatch(l,c);if(l&&(f||g)){const r=i(e.playingAsset),a=(null==r?void 0:r.media)||e.primaryMedia;if(a){const i="primary"===s?a.currentTime:n(l,s,e.playingAsset,"timelinePos","currentTime"),o=t-i,u=(f?i:a.currentTime)+o;if(u>=0&&(!r||f||u<=r.duration))return void(a.currentTime=u)}}if(c){let i=t;if("primary"!==s){const e=t-c[s].start;i=c.start+e}const n=!e.isInterstitial(c);if(e.isInterstitial(l)&&!l.event.appendInPlace||!n&&!c.event.appendInPlace){if(l){const r=e.findItemIndex(l);if(u>r){const t=e.schedule.findJumpRestrictedIndex(r+1,u);if(t>r)return void e.setSchedulePosition(t)}let a=0;if(n)e.timelinePos=i,e.checkBuffer();else{const e=c.event.assetList,i=t-(c[s]||c).start;for(let t=e.length;t--;){const n=e[t];if(n.duration&&i>=n.startOffset&&i<n.startOffset+n.duration){a=t;break}}}e.setSchedulePosition(u,a)}}else{const t=e.media||(f?null==d?void 0:d.media:null);t&&(t.currentTime=i)}}},o=()=>{const i=e.effectivePlayingItem;if(e.isInterstitial(i))return i;const n=t();return e.isInterstitial(n)?n:null},l={get bufferedEnd(){const i=t(),s=e.bufferingItem;var r;return s&&s===i&&(n(s,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-s.playout.start||(null==(r=e.bufferingAsset)?void 0:r.startOffset))||0},get currentTime(){const t=o(),i=e.effectivePlayingItem;return i&&i===t?n(i,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-i.playout.start:0},set currentTime(t){const i=o(),n=e.effectivePlayingItem;n&&n===i&&a(t+n.playout.start,"playout")},get duration(){const e=o();return e?e.playout.end-e.playout.start:0},get assetPlayers(){var t;const i=null==(t=o())?void 0:t.event.assetList;return i?i.map(t=>e.getAssetPlayer(t.identifier)):[]},get playingIndex(){var t;const i=null==(t=o())?void 0:t.event;return i&&e.effectivePlayingAsset?i.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return o()}};return this.manager={get events(){var t;return(null==(t=e.schedule)||null==(t=t.events)?void 0:t.slice(0))||[]},get schedule(){var t;return(null==(t=e.schedule)||null==(t=t.items)?void 0:t.slice(0))||[]},get interstitialPlayer(){return o()?l:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const i=t();return e.findItemIndex(i)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const t=e.effectivePlayingItem;return e.findItemIndex(t)},primary:{get bufferedEnd(){return s()},get currentTime(){const t=e.timelinePos;return t>0?t:0},set currentTime(e){a(e,"primary")},get duration(){return r("primary")},get seekableStart(){var t;return(null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0}},integrated:{get bufferedEnd(){return n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(e){a(e,"integrated")},get duration(){return r("integrated")},get seekableStart(){var t;return((t,i)=>{var n;if(0!==t&&"primary"!==i&&null!=(n=e.schedule)&&n.length){var s;const n=e.schedule.findItemIndexAtTime(t),r=null==(s=e.schedule.items)?void 0:s[n];if(r)return t+(r[i].start-r.start)}return t})((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"integrated")}},skip:()=>{const t=e.effectivePlayingItem,i=null==t?void 0:t.event;if(i&&!i.restrictions.skip){const n=e.findItemIndex(t);if(i.appendInPlace){const e=t.playout.start+t.event.duration;a(e+.001,"playout")}else e.advanceAfterAssetEnded(i,n,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=null==(e=this.schedule)?void 0:e.items;return!!(this.playbackStarted&&t&&i)&&this.findItemIndex(t)===i.length-1}get playbackStarted(){return null!==this.effectivePlayingItem}get currentTime(){var e,t;if(null===this.mediaSelection)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let n=this.media;!n&&null!=(e=this.bufferingItem)&&null!=(e=e.event)&&e.appendInPlace&&(n=this.primaryMedia);const s=null==(t=n)?void 0:t.currentTime;return void 0!==s&&UE(s)?s:void 0}get primaryMedia(){var e;return this.media||(null==(e=this.detachedData)?void 0:e.media)||null}isInterstitial(e){return!(null==e||!e.event)}retreiveMediaSource(e,t){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,n=e.media;if(i&&n===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&n)return void(this.detachedData={media:n});const i=e.transferMedia();this.log(`transfer MediaSource from ${e} ${US(i)}`),this.detachedData=i}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}transferMediaTo(e,t){var i,n;if(e.media===t)return;let s=null;const r=this.hls,a=e!==r,o=a&&e.interstitial.appendInPlace,l=null==(i=this.detachedData)?void 0:i.mediaSource;let u;if(r.media)o&&(s=r.transferMedia(),this.detachedData=s),u="Primary";else if(l){const e=this.getBufferingPlayer();e?(s=e.transferMedia(),u=`${e}`):u="detached MediaSource"}else u="detached media";if(!s)if(l)s=this.detachedData,this.log(`using detachedData: MediaSource ${US(s)}`);else if(!this.detachedData||r.media===t){const e=this.playerQueue;e.length>1&&e.forEach(e=>{if(a&&e.interstitial.appendInPlace!==o){const t=e.interstitial;this.clearInterstitial(e.interstitial,null),t.appendInPlace=!1,t.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${t}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}const c=s&&"mediaSource"in s&&"closed"!==(null==(n=s.mediaSource)?void 0:n.readyState),d=c&&s?s:t;this.log(`${c?"transfering MediaSource":"attaching media"} to ${a?e:"Primary"} from ${u} (media.currentTime: ${t.currentTime})`);const h=this.schedule;if(d===s&&h){const t=a&&e.assetId===h.assetIdAtEnd;d.overrides={duration:h.duration,endOfStream:!a||t,cueRemoval:!a}}e.attachMedia(d)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=null==e?void 0:e.events;if(!t||this.playbackDisabled||!this.media)return;-1===this.bufferedPos&&(this.bufferedPos=0);const i=this.timelinePos,n=this.effectivePlayingItem;if(-1===i){const i=this.hls.startPosition;if(this.log(kC("checkStart",i)),this.timelinePos=i,t.length&&t[0].cue.pre){const i=e.findEventIndex(t[0].identifier);this.setSchedulePosition(i)}else if(i>=0||!this.primaryLive){const t=this.timelinePos=i>0?i:0,n=e.findItemIndexAtTime(t);this.setSchedulePosition(n)}}else if(n&&!this.playingItem){const t=e.findItemIndex(n);this.setSchedulePosition(t)}}advanceAssetBuffering(e,t){const i=e.event,n=i.findAssetIndex(t),s=vC(i,n);if(i.isAssetPastPlayoutLimit(s)){if(this.schedule){var r;const t=null==(r=this.schedule.items)?void 0:r[this.findItemIndex(e)+1];t&&this.bufferedToItem(t)}}else this.bufferedToEvent(e,s)}advanceAfterAssetEnded(e,t,i){const n=vC(e,i);if(e.isAssetPastPlayoutLimit(n)){if(this.schedule){const i=this.schedule.items;if(i){const n=t+1;if(n>=i.length)return void this.setSchedulePosition(-1);const s=e.resumeTime;this.timelinePos<s&&(this.log(kC("advanceAfterAssetEnded",s)),this.timelinePos=s,e.appendInPlace&&this.advanceInPlace(s),this.checkBuffer(this.bufferedPos<s)),this.setSchedulePosition(n)}}}else{if(e.appendInPlace){const t=e.assetList[n];t&&this.advanceInPlace(t.timelineStart)}this.setSchedulePosition(t,n)}}setScheduleToAssetAtTime(e,t){const i=this.schedule;if(!i)return;const n=t.parentIdentifier,s=i.getEvent(n);if(s){const t=i.findEventIndex(n),r=i.findAssetIndex(s,e);this.advanceAfterAssetEnded(s,t,r-1)}}setSchedulePosition(e,t){var i;const n=null==(i=this.schedule)?void 0:i.items;if(!n||this.playbackDisabled)return;const s=e>=0?n[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${s?bC(s):s}) pos: ${this.timelinePos}`);const r=this.waitingItem||this.playingItem,a=this.playingLastItem;if(this.isInterstitial(r)){const i=r.event,u=this.playingAsset,c=null==u?void 0:u.identifier,d=c?this.getAssetPlayer(c):null;if(d&&c&&(!this.eventItemsMatch(r,s)||void 0!==t&&c!==i.assetList[t].identifier)){var o;const t=i.findAssetIndex(u);if(this.log(`INTERSTITIAL_ASSET_ENDED ${t+1}/${i.assetList.length} ${yC(u)}`),this.endedAsset=u,this.playingAsset=null,this.hls.trigger(QE.INTERSTITIAL_ASSET_ENDED,{asset:u,assetListIndex:t,event:i,schedule:n.slice(0),scheduleIndex:e,player:d}),r!==this.playingItem)return void(this.itemsMatch(r,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(i,this.findItemIndex(this.playingItem),t));this.retreiveMediaSource(c,s),!d.media||null!=(o=this.detachedData)&&o.mediaSource||d.detachMedia()}if(!this.eventItemsMatch(r,s)&&(this.endedItem=r,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${i} ${bC(r)}`),i.hasPlayed=!0,this.hls.trigger(QE.INTERSTITIAL_ENDED,{event:i,schedule:n.slice(0),scheduleIndex:e}),i.cue.once)){var l;this.updateSchedule();const e=null==(l=this.schedule)?void 0:l.items;if(s&&e){const i=this.findItemIndex(s);this.advanceSchedule(i,e,t,r,a)}return}}this.advanceSchedule(e,n,t,r,a)}advanceSchedule(e,t,i,n,s){const r=this.schedule;if(!r)return;const a=t[e]||null,o=this.primaryMedia,l=this.playerQueue;if(l.length&&l.forEach(t=>{const i=t.interstitial,n=r.findEventIndex(i.identifier);(n<e||n>e+1)&&this.clearInterstitial(i,a)}),this.isInterstitial(a)){this.timelinePos=Math.min(Math.max(this.timelinePos,a.start),a.end);const s=a.event;if(void 0===i){const t=vC(s,(i=r.findAssetIndex(s,this.timelinePos))-1);if(s.isAssetPastPlayoutLimit(t)||s.appendInPlace&&this.timelinePos===a.end)return void this.advanceAfterAssetEnded(s,e,i);i=t}const l=this.waitingItem;this.assetsBuffered(a,o)||this.setBufferingItem(a);let u=this.preloadAssets(s,i);if(this.eventItemsMatch(a,l||n)||(this.waitingItem=a,this.log(`INTERSTITIAL_STARTED ${bC(a)} ${s.appendInPlace?"append in place":""}`),this.hls.trigger(QE.INTERSTITIAL_STARTED,{event:s,schedule:t.slice(0),scheduleIndex:e})),!s.assetListLoaded)return void this.log(`Waiting for ASSET-LIST to complete loading ${s}`);if(s.assetListLoader&&(s.assetListLoader.destroy(),s.assetListLoader=void 0),!o)return void this.log(`Waiting for attachMedia to start Interstitial ${s}`);this.waitingItem=this.endedItem=null,this.playingItem=a;const c=s.assetList[i];if(!c)return void this.advanceAfterAssetEnded(s,e,i||0);if(u||(u=this.getAssetPlayer(c.identifier)),null===u||u.destroyed){const e=s.assetList.length;this.warn(`asset ${i+1}/${e} player destroyed ${s}`),u=this.createAssetPlayer(s,c,i),u.loadSource()}if(!this.eventItemsMatch(a,this.bufferingItem)&&s.appendInPlace&&this.isAssetBuffered(c))return;this.startAssetPlayer(u,i,t,e,o),this.shouldPlay&&TC(u.media)}else a?(this.resumePrimary(a,e,n),this.shouldPlay&&TC(this.hls.media)):s&&this.isInterstitial(n)&&(this.endedItem=null,this.playingItem=n,n.event.appendInPlace||this.attachPrimary(r.durations.primary,null))}get playbackDisabled(){return!1===this.hls.config.enableInterstitialPlayback}get primaryDetails(){var e;return null==(e=this.mediaSelection)?void 0:e.main.details}get primaryLive(){var e;return!(null==(e=this.primaryDetails)||!e.live)}resumePrimary(e,t,i){var n,s;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${bC(e)}`),null==(n=this.detachedData)||!n.mediaSource){let i=this.timelinePos;(i<e.start||i>=e.end)&&(i=this.getPrimaryResumption(e,t),this.log(kC("resumePrimary",i)),this.timelinePos=i),this.attachPrimary(i,e)}if(!i)return;const r=null==(s=this.schedule)?void 0:s.items;r&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${bC(e)}`),this.hls.trigger(QE.INTERSTITIALS_PRIMARY_RESUMED,{schedule:r.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const e=this.primaryDetails;if(0===t)return this.hls.startPosition;if(e&&(i<e.fragmentStart||i>e.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);if(null!=t&&t.hls)return t.hls.bufferedToEnd;return NT.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const n=this.primaryMedia;if(!n)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,n),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(kC("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const n=this.hls;!n.loadingEnabled||!n.media||Math.abs(((null==(i=n.mainForwardBufferInfo)?void 0:i.start)||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),null==(e=this.schedule)||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(QE.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(QE.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(-1===t.level||!this.schedule)return;const i=this.hls.levels[t.level];if(!i.details)return;const n=nb(nb({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],n=this.mediaSelection;if(!n)return void(this.altSelection=nb(nb({},this.altSelection),{},{audio:i}));const s=nb(nb({},n),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n)return void(this.altSelection=nb(nb({},this.altSelection),{},{subtitles:i}));const s=nb(nb({},n),{},{subtitles:i});this.mediaSelection=s}onAudioTrackSwitching(e,t){const i=VS(t);this.playerQueue.forEach(({hls:e})=>e&&(e.setAudioOption(t)||e.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=VS(t);this.playerQueue.forEach(({hls:e})=>e&&(e.setSubtitleOption(t)||-1!==t.id&&e.setSubtitleOption(i)))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const e=this.timelinePos;this.bufferedPos=e,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let e=0;e<t.length;e++){const n=t[e];if(n.cue.post){var i;const e=this.schedule.findEventIndex(n.identifier),t=null==(i=this.schedule.items)?void 0:i[e];this.isInterstitial(t)&&this.eventItemsMatch(t,this.bufferingItem)&&this.bufferedToItem(t,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const e=this.findItemIndex(t);this.setSchedulePosition(e+1)}else this.shouldPlay=!1}updateItem(e,t){var i;const n=null==(i=this.schedule)?void 0:i.items;if(e&&n){return n[this.findItemIndex(e,t)]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((t,i)=>{e.event.isAssetPastPlayoutLimit(i)&&this.clearAssetPlayer(t.identifier,null)});const i=e.end+.25,n=NT.bufferInfo(this.primaryMedia,i,0);if(n.end>i||(n.nextStart||0)>i){this.log(`trim buffered interstitial ${bC(e)} (was ${bC(t)})`);const n=!0;this.attachPrimary(i,null,n),this.flushFrontBuffer(i)}}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===(null==(i=t.event)?void 0:i.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const i=this.mediaSelection;i&&(null==(t=this.schedule)||t.updateSchedule(i,[],e))}checkBuffer(e){var t;const i=null==(t=this.schedule)?void 0:t.items;if(!i)return;const n=NT.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=n.len<1),this.updateBufferedPos(n.end,i,e)}updateBufferedPos(e,t,i){const n=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e||!n)return;if(1===t.length&&this.itemsMatch(t[0],s))return void(this.bufferedPos=e);const r=this.playingItem,a=this.findItemIndex(r);let o=n.findItemIndexAtTime(e);if(this.bufferedPos<e){var l;const i=this.findItemIndex(s),n=Math.min(i+1,t.length-1),r=t[n];if((-1===o&&s&&e>=s.end||null!=(l=r.event)&&l.appendInPlace&&e+.01>=r.start)&&(o=n),this.isInterstitial(s)){const e=s.event;if(n-a>1&&!1===e.appendInPlace)return;if(0===e.assetList.length&&e.assetListLoader)return}if(this.bufferedPos=e,o>i&&o>a)this.bufferedToItem(r);else{const t=this.primaryDetails;this.primaryLive&&t&&e>t.edge-t.targetduration&&r.start<t.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(r)&&this.preloadAssets(r.event,0)}}else i&&r&&!this.itemsMatch(r,s)&&(o===a?this.bufferedToItem(r):o===a+1&&this.bufferedToItem(t[o]))}assetsBuffered(e,t){return 0!==e.event.assetList.length&&!e.event.assetList.some(e=>{const i=this.getAssetPlayer(e.identifier);return!(null!=i&&i.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){const{items:n,events:s}=i;if(!n||!s)return t;const r=this.isInterstitial(e),a=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const o=a?a.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${bC(e)}`+(t?` (${o.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(r){const t=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((e,i)=>{const n=this.getAssetPlayer(e.identifier);n&&(i===t&&n.loadSource(),n.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(e=>e.pauseBuffering());this.hls.trigger(QE.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled)if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(null!==i){this.bufferingAsset=null;const t=this.detachedData;if(t)if(t.mediaSource){const t=!0;this.attachPrimary(e.start,e,t)}else this.preloadPrimary(e);else this.preloadPrimary(e)}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,n=0===i.assetList.length&&!i.assetListLoader,s=i.cue.once;if(n||!s){const e=this.preloadAssets(i,t);if(null!=e&&e.interstitial.appendInPlace){const t=this.primaryMedia;t&&this.bufferAssetPlayer(e,t)}}}preloadAssets(e,t){const i=e.assetUrl,n=e.assetList.length,s=0===n&&!e.assetListLoader,r=e.cue.once;if(s){const s=e.timelineStart;if(e.appendInPlace){var a;const t=this.playingItem;this.isInterstitial(t)||(null==t||null==(a=t.nextEvent)?void 0:a.identifier)!==e.identifier||this.flushFrontBuffer(s+.25)}let r,o=0;if(!this.playingItem&&this.primaryLive&&(o=this.hls.startPosition,-1===o&&(o=this.hls.liveSyncPosition||0)),o&&!e.cue.pre&&!e.cue.post){const e=o-s;e>0&&(r=Math.round(1e3*e)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${r?` live-start: ${o} start-offset: ${r}`:""}`),i)return this.createAsset(e,0,0,s,e.duration,i);const l=this.assetListLoader.loadAssetList(e,r);l&&(e.assetListLoader=l)}else if(!r&&n){for(let s=t;s<n;s++){const t=e.assetList[s],i=this.getAssetPlayerQueueIndex(t.identifier);-1!==i&&!this.playerQueue[i].destroyed||t.error||this.createAssetPlayer(e,t,s)}const i=e.assetList[t];if(i){const e=this.getAssetPlayer(i.identifier);return e&&e.loadSource(),e}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`);Object.keys(t).forEach(t=>{this.hls.trigger(QE.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t)for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i];return null}createAsset(e,t,i,n,s,r){const a={parentIdentifier:e.identifier,identifier:fC(e,r,t),duration:s,startOffset:i,timelineStart:n,uri:r};return this.createAssetPlayer(e,a,t)}createAssetPlayer(e,t,i){const n=this.hls,s=n.userConfig;let r=s.videoPreference;const a=n.loadLevelObj||n.levels[n.currentLevel];(r||a)&&(r=tb({},r),a.videoCodec&&(r.videoCodec=a.videoCodec),a.videoRange&&(r.allowedVideoRanges=[a.videoRange]));const o=n.audioTracks[n.audioTrack],l=n.subtitleTracks[n.subtitleTrack];let u=0;if(this.primaryLive||e.appendInPlace){const e=this.timelinePos-t.timelineStart;if(e>1){const i=t.duration;i&&e<i&&(u=e)}}const c=t.identifier,d=nb(nb({},s),{},{maxMaxBufferLength:Math.min(180,n.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:c,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:r,audioPreference:o||s.audioPreference,subtitlePreference:l||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(d.timelineOffset=t.timelineStart));const h=d.cmcd;null!=h&&h.sessionId&&h.contentId&&(d.cmcd=tb({},h,{contentId:cC(t.uri)})),this.getAssetPlayer(c)&&this.warn(`Duplicate date range identifier ${e} and asset ${c}`);const f=new AC(this.HlsPlayerClass,d,e,t);this.playerQueue.push(f),e.assetList[i]=t;let g=!0;const m=n=>{if(n.live){var s;const t=new Error(`Interstitials MUST be VOD assets ${e}`),n={fatal:!0,type:VE.OTHER_ERROR,details:GE.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},r=(null==(s=this.schedule)?void 0:s.findEventIndex(e.identifier))||-1;return void this.handleAssetItemError(n,e,r,i,t.message)}const r=n.edge-n.fragmentStart,a=t.duration;(g||null===a||r>a)&&(g=!1,this.log(`Interstitial asset "${c}" duration change ${a} > ${r}`),t.duration=r,this.updateSchedule())};f.on(QE.LEVEL_UPDATED,(e,{details:t})=>m(t)),f.on(QE.LEVEL_PTS_UPDATED,(e,{details:t})=>m(t)),f.on(QE.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const p=(e,t)=>{const i=this.getAssetPlayer(c);if(i&&t.tracks){i.off(QE.BUFFER_CODECS,p),i.tracks=t.tracks;const e=this.primaryMedia;this.bufferingAsset===i.assetItem&&e&&!i.media&&this.bufferAssetPlayer(i,e)}};f.on(QE.BUFFER_CODECS,p);f.on(QE.BUFFERED_TO_END,()=>{var i;const n=this.getAssetPlayer(c);if(this.log(`buffered to end of asset ${n}`),!n||!this.schedule)return;const s=this.schedule.findEventIndex(e.identifier),r=null==(i=this.schedule.items)?void 0:i[s];this.isInterstitial(r)&&this.advanceAssetBuffering(r,t)});const v=t=>()=>{if(!this.getAssetPlayer(c)||!this.schedule)return;this.shouldPlay=!0;const i=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,i,t)};return f.once(QE.MEDIA_ENDED,v(i)),f.once(QE.PLAYOUT_LIMIT_REACHED,v(1/0)),f.on(QE.ERROR,(t,n)=>{if(!this.schedule)return;const s=this.getAssetPlayer(c);if(n.details===GE.BUFFER_STALLED_ERROR)return null!=s&&s.appendInPlace?void this.handleInPlaceStall(e):(this.onTimeupdate(),void this.checkBuffer(!0));this.handleAssetItemError(n,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${n.error} ${e}`)}),f.on(QE.DESTROYING,()=>{if(!this.getAssetPlayer(c)||!this.schedule)return;const t=new Error(`Asset player destroyed unexpectedly ${c}`),n={fatal:!0,type:VE.OTHER_ERROR,details:GE.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};this.handleAssetItemError(n,e,this.schedule.findEventIndex(e.identifier),i,t.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${yC(t)}`),this.hls.trigger(QE.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:f}),f}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(-1!==t){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(-1!==i){const e=this.playerQueue[i];this.log(`clear ${e} toSegment: ${t?bC(t):t}`),this.transferMediaFromPlayer(e,t),this.playerQueue.splice(i,1),e.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,n,s){const{interstitial:r,assetItem:a,assetId:o}=e,l=r.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=a,u&&u.identifier===o||(u&&(this.clearAssetPlayer(u.identifier,i[n]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${l} ${yC(a)}`),this.hls.trigger(QE.INTERSTITIAL_ASSET_STARTED,{asset:a,assetListIndex:t,event:r,schedule:i.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var i,n;if(!this.schedule)return;const{interstitial:s,assetItem:r}=e,a=this.schedule.findEventIndex(s.identifier),o=null==(i=this.schedule.items)?void 0:i[a];if(!o)return;e.loadSource(),this.setBufferingItem(o),this.bufferingAsset=r;const l=this.getBufferingPlayer();if(l===e)return;const u=s.appendInPlace;if(u&&!1===(null==l?void 0:l.interstitial.appendInPlace))return;const c=(null==l?void 0:l.tracks)||(null==(n=this.detachedData)?void 0:n.tracks)||this.requiredTracks;if(u&&r!==this.playingAsset){if(!e.tracks)return void this.log(`Waiting for track info before buffering ${e}`);if(c&&!hb(c,e.tracks)){const t=new Error(`Asset ${yC(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(c)}')`),i={fatal:!0,type:VE.OTHER_ERROR,details:GE.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},n=s.findAssetIndex(r);return void this.handleAssetItemError(i,s,a,n,t.message)}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,i=this.primaryMedia;if(!t||!i)return;const n=i.currentTime,s=t.findAssetIndex(e,n),r=e.assetList[s];if(r){const a=this.getAssetPlayer(r.identifier);if(a){const o=a.currentTime||n-r.timelineStart,l=a.duration-o;if(this.warn(`Stalled at ${o} of ${o+l} in ${a} ${e} (media.currentTime: ${n})`),o&&(l/i.playbackRate<.5||a.bufferedInPlaceToEnd(i))&&a.hls){const i=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,i,s)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,i,n,s){if(e.details===GE.BUFFER_STALLED_ERROR)return;const r=t.assetList[n]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${r?yC(r):r} ${e.error}`),!this.schedule)return;const a=(null==r?void 0:r.identifier)||"",o=this.getAssetPlayerQueueIndex(a),l=this.playerQueue[o]||null,u=this.schedule.items,c=tb({},e,{fatal:!1,errorAction:mT(!0),asset:r,assetListIndex:n,event:t,schedule:u,scheduleIndex:i,player:l});if(this.hls.trigger(QE.INTERSTITIAL_ASSET_ERROR,c),!e.fatal)return;const d=this.playingAsset,h=this.bufferingAsset,f=new Error(s);if(r&&(this.clearAssetPlayer(a,null),r.error=f),t.assetList.some(e=>!e.error))for(let g=n;g<t.assetList.length;g++)this.resetAssetPlayer(t.assetList[g].identifier);else t.error=f;this.updateSchedule(!0),t.error?this.primaryFallback(t):d&&d.identifier===a?this.advanceAfterAssetEnded(t,i,n):h&&h.identifier===a&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,h)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;let n=this.timelinePos;if(i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${n} playing: ${bC(i)} error: ${e.error}`),-1===n&&(n=this.hls.startPosition);const s=this.updateItem(i,n);this.itemsMatch(i,s)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(-1===n)return void this.checkStart();if(!this.schedule)return;const s=this.schedule.findItemIndexAtTime(n);this.setSchedulePosition(s)}onAssetListLoaded(e,t){var i,n;const s=t.event,r=s.identifier,a=t.assetListResponse.ASSETS;if(null==(i=this.schedule)||!i.hasEvent(r))return;const o=s.timelineStart,l=s.duration;let u=0;a.forEach((e,t)=>{const i=parseFloat(e.DURATION);this.createAsset(s,t,u,o+u,i,e.URI),u+=i}),s.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${l}) ${s}`);const c=this.waitingItem,d=(null==c?void 0:c.event.identifier)===r;this.updateSchedule();const h=null==(n=this.bufferingItem)?void 0:n.event;if(d){var f;const e=this.schedule.findEventIndex(r),t=null==(f=this.schedule.items)?void 0:f[e];if(t){if(!this.playingItem&&this.timelinePos>t.end){if(this.schedule.findItemIndexAtTime(this.timelinePos)!==e)return s.error=new Error(`Interstitial ${a.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${s}`),this.log(s.error.message),this.updateSchedule(!0),void this.primaryFallback(s)}this.setBufferingItem(t)}this.setSchedulePosition(e)}else if((null==h?void 0:h.identifier)===r){const e=s.assetList[0];if(e){const t=this.getAssetPlayer(e.identifier);if(h.appendInPlace){const e=this.primaryMedia;t&&e&&this.bufferAssetPlayer(t,e)}else t&&t.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case GE.ASSET_LIST_PARSING_ERROR:case GE.ASSET_LIST_LOAD_ERROR:case GE.ASSET_LIST_LOAD_TIMEOUT:{const e=t.interstitial;e&&(this.updateSchedule(!0),this.primaryFallback(e));break}case GE.BUFFER_STALLED_ERROR:{const e=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(e)&&e.event.appendInPlace)return void this.handleInPlaceStall(e.event);this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}});function RR(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(RR):Object.keys(e).reduce((t,i)=>(t[i]=RR(e[i]),t),{}):e}function xR(e,t){const i=e.loader;if(i!==TR&&i!==LR)t.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=TR,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}}class DR extends BT{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var e;null!=(e=this.media)&&e.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{var e;this.hls&&(this.ended=(null==(e=this.media)?void 0:e.currentTime)||1,this.hls.trigger(QE.MEDIA_ENDED,{stalled:!1}))},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(QE.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(QE.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(100),this.mediaSource=t.mediaSource;const i=this.media=t.media;tw(i,"playing",this.onMediaPlaying),tw(i,"waiting",this.onMediaWaiting),tw(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(iw(i,"playing",this.onMediaPlaying),iw(i,"waiting",this.onMediaWaiting),iw(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(null==(e=this.media)||!e.readyState||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,n;const s=null==(i=this.hls)?void 0:i.config;if(!s)return;const r=this.media;if(!r)return;const{seeking:a}=r,o=this.seeking&&!a,l=!this.seeking&&a,u=r.paused&&!a||r.ended||0===r.playbackRate;if(this.seeking=a,e!==t)return t&&(this.ended=0),this.moved=!0,a||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!u&&e>t&&this.nudgeOnVideoHole(e,t)),void(0===this.waiting&&this.stallResolved(e));if(l||o)return void(o&&this.stallResolved(e));if(u)return this.nudgeRetry=0,this.stallResolved(e),void(!this.ended&&r.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(QE.MEDIA_ENDED,{stalled:!1})));if(!NT.getBuffered(r).length)return void(this.nudgeRetry=0);const c=NT.bufferInfo(r,e,0),d=c.nextStart||0,h=this.fragmentTracker;if(a&&h&&this.hls){const t=PR(this.hls.inFlightFragments,e),i=c.len>2,n=!d||t||d-e>2&&!h.getPartialFragment(e);if(i||n)return;this.moved=!1}const f=null==(n=this.hls)?void 0:n.latestLevelDetails;if(!this.moved&&null!==this.stalled&&h){if(!(c.len>0)&&!d)return;const t=Math.max(d,c.start||0)-e,i=!(null==f||!f.live)?2*f.targetduration:2,n=OR(e,h);if(t>0&&(t<=i||n))return void(r.paused||this._trySkipBufferHole(n))}const g=s.detectStallWithCurrentTimeMs,m=self.performance.now(),p=this.waiting;let v=this.stalled;if(null===v){if(!(p>0&&m-p<g))return void(this.stalled=m);v=this.stalled=p}const y=m-v;if(!a&&(y>=g||p)&&this.hls){var A;if("ended"===(null==(A=this.mediaSource)?void 0:A.readyState)&&(null==f||!f.live)&&Math.abs(e-((null==f?void 0:f.edge)||0))<1){if(this.ended)return;return this.ended=e||1,void this.hls.trigger(QE.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(c),!this.media||!this.hls)return}const E=NT.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(E,y,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(QE.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&null!=(i=this.buffered.audio)&&i.length&&n&&n.length>1&&e>n.end(0)){const i=NT.bufferedInfo(NT.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&t>=i.start){const i=NT.timeRangesToArray(n),s=NT.bufferedInfo(i,t,0).bufferedIndex;if(s>-1&&s<i.length-1){const t=NT.bufferedInfo(i,e,0).bufferedIndex,n=i[s].end,r=i[s+1].start;if((-1===t||t>s)&&r-n<1&&e-n<2){const i=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${n} -> ${r} buffered index: ${t}`);this.warn(i.message),this.media.currentTime+=1e-6;let s=OR(e,this.fragmentTracker);s&&"fragment"in s?s=s.fragment:s||(s=void 0);const a=NT.bufferInfo(this.media,e,0);this.hls.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:i,reason:i.message,frag:s,buffer:a.len,bufferInfo:a})}}}}}_tryFixBufferStall(e,t,i){var n,s;const{fragmentTracker:r,media:a}=this,o=null==(n=this.hls)?void 0:n.config;if(!a||!r||!o)return;const l=null==(s=this.hls)?void 0:s.latestLevelDetails,u=OR(i,r);if(u||null!=l&&l.live&&i<l.fragmentStart){if(this._trySkipBufferHole(u)||!this.media)return}const c=e.buffered,d=this.adjacentTraversal(e,i);(c&&c.length>1&&e.len>o.maxBufferHole||e.nextStart&&(e.nextStart-i<o.maxBufferHole||d))&&(t>1e3*o.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,n=e.nextStart;if(i&&n){const e=i.getFragAtPos(t,YE),s=i.getFragAtPos(n,YE);if(e&&s)return s.sn-e.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:n,stalled:s}=this;if(!n&&null!==s&&i&&t){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${US(e)})`);this.warn(n.message),t.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:n}=this,s=null==(t=this.hls)?void 0:t.config;if(!n||!i||!s)return 0;const r=n.currentTime,a=NT.bufferInfo(n,r,0),o=r<a.start?a.start:a.nextStart;if(o&&this.hls){const t=a.len<=s.maxBufferHole,u=a.len>0&&a.len<1&&n.readyState<3,c=o-r;if(c>0&&(t||u)){if(c>s.maxBufferHole){let t=!1;if(0===r){const e=i.getAppendedFrag(0,YE);e&&o<e.end&&(t=!0)}if(!t&&e){var l;if(null==(l=this.hls.loadLevelObj)||!l.details)return 0;if(PR(this.hls.inFlightFragments,o))return 0;let t=!1,n=e.end;for(;n<o;){const e=OR(n,i);if(!e){t=!0;break}n+=e.duration}if(t)return 0}}const t=Math.max(o+.05,r+.1);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${t}`),this.moved=!0,n.currentTime=t,null==e||!e.gap){const i=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${t}`),n={type:VE.MEDIA_ERROR,details:GE.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:i,reason:i.message,buffer:a.len,bufferInfo:a};e&&("fragment"in e?n.part=e:n.frag=e),this.hls.trigger(QE.ERROR,n)}return t}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:n}=this,s=null==t?void 0:t.config;if(!i||!s)return 0;const r=i.currentTime;if(this.nudgeRetry++,n<s.nudgeMaxRetry){const a=r+(n+1)*s.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${r} to ${a}`);this.warn(o.message),i.currentTime=a,t.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1,buffer:e.len,bufferInfo:e})}else{const i=new Error(`Playhead still not moving while enough data buffered @${r} after ${s.nudgeMaxRetry} nudges`);this.error(i.message),t.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.BUFFER_STALLED_ERROR,error:i,fatal:!0,buffer:e.len,bufferInfo:e})}}}function PR(e,t){const i=MR(e.main);if(i&&i.start<=t)return i;const n=MR(e.audio);return n&&n.start<=t?n:null}function MR(e){if(!e)return null;switch(e.state){case rw:case sw:case hw:case fw:return null}return e.frag}function OR(e,t){return t.getAppendedFrag(e,YE)||t.getPartialFragment(e)}function BR(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function FR(e,t,i,n,s){let r=new e(t,i,"");try{r.value=n,s&&(r.type=s)}catch(a){r=new e(t,i,US(s?nb({type:s},n):n))}return r}const _R=(()=>{const e=BR();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class NR{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(QE.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(QE.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(QE.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(QE.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(QE.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(QE.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(QE.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(QE.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,!1===(null==(i=t.overrides)?void 0:i.cueRemoval)&&(this.removeCues=!1)}onMediaAttached(){var e;const t=null==(e=this.hls)?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null;!!t.transferMedia||(this.id3Track&&(this.removeCues&&oC(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if("metadata"===i.kind&&"id3"===i.label)return rC(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:n}=this.hls.config;if(!i&&!n)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=BR();if(r)for(let a=0;a<s.length;a++){const e=s[a].type;if(e===zw.emsg&&!i||!n)continue;const t=Vw(s[a].data),o=s[a].pts;let l=o+s[a].duration;l>_R&&(l=_R);l-o<=0&&(l=o+.25);for(let i=0;i<t.length;i++){const n=t[i];if(!Gw(n)){this.updateId3CueEnds(o,e);const t=FR(r,o,l,n,e);t&&this.id3Track.addCue(t)}}}}updateId3CueEnds(e,t){var i;const n=null==(i=this.id3Track)?void 0:i.cues;if(n)for(let s=n.length;s--;){const i=n[s];i.type===t&&i.startTime<e&&i.endTime===_R&&(i.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:n}){const{id3Track:s,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:o}}=r;if(s&&(a||o)){let e;e="audio"===n?e=>e.type===zw.audioId3&&o:"video"===n?e=>e.type===zw.emsg&&a:e=>e.type===zw.audioId3&&o||e.type===zw.emsg&&a,lC(s,t,i,e)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:n,enableDateRangeMetadataCues:s,interstitialsController:r}=this.hls.config;if(!s)return;const a=BR();if(i&&n&&!r){const{fragmentStart:t,fragmentEnd:n}=e;let s=this.assetCue;s?(s.startTime=t,s.endTime=n):a&&(s=this.assetCue=FR(a,t,n,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),s&&(s.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(s),s.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:o}=this,{dateRanges:l}=e,u=Object.keys(l);let c=this.dateRangeCuesAppended;var d;if(o&&t)if(null!=(d=o.cues)&&d.length){const e=Object.keys(c).filter(e=>!u.includes(e));for(let t=e.length;t--;){var h;const i=e[t],n=null==(h=c[i])?void 0:h.cues;delete c[i],n&&Object.keys(n).forEach(e=>{const t=n[e];if(t){t.removeEventListener("enter",this.onEventCueEnter);try{o.removeCue(t)}catch(i){}}})}}else c=this.dateRangeCuesAppended={};const f=e.fragments[e.fragments.length-1];if(0!==u.length&&UE(null==f?void 0:f.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let e=0;e<u.length;e++){const t=u[e],i=l[t],n=i.startTime,s=c[t],o=(null==s?void 0:s.cues)||{};let d=(null==s?void 0:s.durationKnown)||!1,h=_R;const{duration:f,endDate:g}=i;if(g&&null!==f)h=n+f,d=!0;else if(i.endOnNext&&!d){const e=u.reduce((e,t)=>{if(t!==i.id){const n=l[t];if(n.class===i.class&&n.startDate>i.startDate&&(!e||i.startDate<e.startDate))return n}return e},null);e&&(h=e.startTime,d=!0)}const m=Object.keys(i.attr);for(let e=0;e<m.length;e++){const l=m[e];if(!WT(l))continue;const u=o[l];if(u)!d||null!=s&&s.durationKnown?Math.abs(u.startTime-n)>.01&&(u.startTime=n,u.endTime=h):u.endTime=h;else if(a){let e=i.attr[l];qT(l)&&(e=mb(e));const s=FR(a,n,h,{key:l,data:e},zw.dateRange);s&&(s.id=t,this.id3Track.addCue(s),o[l]=s,r&&("X-ASSET-LIST"!==l&&"X-ASSET-URL"!==l||s.addEventListener("enter",this.onEventCueEnter)))}}c[t]={cues:o,dateRange:i,durationKnown:d}}}}}class UR{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:e}=this,t=this.levelDetails;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(null===i)return;this._latency=i;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:s}=this.config;if(!n||1===s||!t.live)return;const r=this.targetLatency;if(null===r)return;const a=i-r;if(a<Math.min(this.maxLatency,r+t.targetduration)&&a>.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,s)),i=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20,n=Math.min(t,Math.max(1,i));this.changeMediaPlaybackRate(e,n)}else 1!==e.playbackRate&&0!==e.playbackRate&&this.changeMediaPlaybackRate(e,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return(null==(e=this.hls)?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(void 0!==e.liveMaxLatencyDuration)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(null===e||null===this.hls)return null;const{holdBack:t,partHoldBack:i,targetduration:n}=e,{liveSyncDuration:s,liveSyncDurationCount:r,lowLatencyMode:a}=this.config,o=this.hls.userConfig;let l=a&&i||t;(this._targetLatencyUpdated||o.liveSyncDuration||o.liveSyncDurationCount||0===l)&&(l=void 0!==s?s:r*n);const u=n;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(null===e||null===t)return null;const i=this.levelDetails;if(null===i)return null;const n=i.edge,s=e-t-this.edgeStalled,r=n-i.totalduration,a=n-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(r,s),a)}get drift(){const e=this.levelDetails;return null===e?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(QE.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(QE.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(QE.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(QE.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===GE.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&null!=(i=this.levelDetails)&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,n;e.playbackRate!==t&&(null==(i=this.hls)||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${null==(n=this.targetLatency)?void 0:n.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}class jR extends qI{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(QE.LEVEL_LOADED,this.onLevelLoaded,this),e.on(QE.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(QE.FRAG_BUFFERED,this.onFragBuffered,this),e.on(QE.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(QE.LEVEL_LOADED,this.onLevelLoaded,this),e.off(QE.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(QE.FRAG_BUFFERED,this.onFragBuffered,this),e.off(QE.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,n=[],s={},r={};let a=!1,o=!1,l=!1;t.levels.forEach(e=>{const t=e.attrs;let{audioCodec:u,videoCodec:c}=e;u&&(e.audioCodec=u=pS(u,i)||void 0),c&&(c=e.videoCodec=function(e){const t=e.split(",");for(let i=0;i<t.length;i++){const e=t[i].split(".");e.length>2&&"avc1"===e[0]&&(t[i]=`avc1.${parseInt(e[1]).toString(16)}${("000"+parseInt(e[2]).toString(16)).slice(-4)}`)}return t.join(",")}(c));const{width:d,height:h,unknownCodecs:f}=e,g=(null==f?void 0:f.length)||0;if(a||(a=!(!d||!h)),o||(o=!!c),l||(l=!!u),g||u&&!this.isAudioSupported(u)||c&&!this.isVideoSupported(c))return void this.log(`Some or all CODECS not supported "${t.CODECS}"`);const{CODECS:m,"FRAME-RATE":p,"HDCP-LEVEL":v,"PATHWAY-ID":y,RESOLUTION:A,"VIDEO-RANGE":E}=t,b=`${`${y||"."}-`}${e.bitrate}-${A}-${p}-${m}-${E}-${v}`;if(s[b])if(s[b].uri===e.url||e.attrs["PATHWAY-ID"])s[b].addGroupId("audio",t.AUDIO),s[b].addGroupId("text",t.SUBTITLES);else{const t=r[b]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const i=this.createLevel(e);s[b]=i,n.push(i)}else{const t=this.createLevel(e);s[b]=t,r[b]=1,n.push(t)}}),this.filterAndSortMediaOptions(n,t,a,o,l)}createLevel(e){const t=new FS(e),i=e.supplemental;if(null!=i&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const e=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(e.message),t.supportedResult=kS(e,[])}return t}isAudioSupported(e){return uS(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return uS(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,s){var r;let a=[],o=[],l=e;const u=(null==(r=t.stats)?void 0:r.parsing)||{};if((i||n)&&s&&(l=l.filter(({videoCodec:e,videoRange:t,width:i,height:n})=>{return(!!e||!(!i||!n))&&(!!(s=t)&&xS.indexOf(s)>-1);var s})),0===l.length)return Promise.resolve().then(()=>{if(this.hls){let e="no level with compatible codecs found in manifest",i=e;t.levels.length&&(i=`one or more CODECS in variant not supported: ${US(t.levels.map(e=>e.attrs.CODECS).filter((e,t,i)=>i.indexOf(e)===t))}`,this.warn(i),e+=` (${i})`);const n=new Error(e);this.hls.trigger(QE.ERROR,{type:VE.MEDIA_ERROR,details:GE.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:n,reason:i})}}),void(u.end=performance.now());t.audioTracks&&(a=t.audioTracks.filter(e=>!e.audioCodec||this.isAudioSupported(e.audioCodec)),HR(a)),t.subtitles&&(o=t.subtitles,HR(o));const c=l.slice(0);l.sort((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return xS.indexOf(e.videoRange)-xS.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const i=hS(e.videoCodec),n=hS(t.videoCodec);if(i!==n)return n-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const i=fS(e.codecSet),n=fS(t.codecSet);if(i!==n)return n-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0});let d=c[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==c.length))for(let v=0;v<c.length;v++)if(c[v].pathwayId===l[0].pathwayId){d=c[v];break}this._levels=l;for(let v=0;v<l.length;v++)if(l[v]===d){var h;this._firstLevel=v;const e=d.bitrate,t=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${e}`),void 0===(null==(h=this.hls.userConfig)?void 0:h.abrEwmaDefaultEstimate)){const i=Math.min(e,this.hls.config.abrEwmaDefaultEstimateMax);i>t&&t===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=i)}break}const f=s&&!n,g=this.hls.config,m=!(!g.audioStreamController||!g.audioTrackController),p={levels:l,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:m&&!f&&a.some(e=>!!e.url)};u.end=performance.now(),this.hls.trigger(QE.MANIFEST_PARSED,p)}get levels(){return 0===this._levels.length?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const i=new Error("invalid level idx"),n=e<0;if(this.hls.trigger(QE.ERROR,{type:VE.OTHER_ERROR,details:GE.LEVEL_SWITCH_ERROR,level:e,fatal:n,error:i,reason:i.message}),n)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,n=this.currentLevel,s=n?n.attrs["PATHWAY-ID"]:void 0,r=t[e],a=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,i===e&&n&&s===a)return;this.log(`Switching to level ${e} (${r.height?r.height+"p ":""}${r.videoRange?r.videoRange+" ":""}${r.codecSet?r.codecSet+" ":""}@${r.bitrate})${a?" with Pathway "+a:""} from level ${i}${s?" with Pathway "+s:""}`);const o={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds};this.hls.trigger(QE.LEVEL_SWITCHING,o);const l=r.details;if(!l||l.live){const e=this.switchParams(r.uri,null==n?void 0:n.details,l);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(e=>-1!==t.indexOf(e));if(e.length<1)return void this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);this.steering.pathwayPriority=i}}onError(e,t){!t.fatal&&t.context&&t.context.type===zE&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===YE){const e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;const i=this._levels[t.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:n,details:s}=t,r=t.levelInfo;var a;if(!r)return this.warn(`Invalid level index ${n}`),void(null!=(a=t.deliveryDirectives)&&a.skip&&(s.deltaUpdateFailed=!0));if(r===this.currentLevel||t.withoutMultiVariant){0===r.fragmentError&&(r.loadError=0);let e=r.details;e===t.details&&e.advanced&&(e=void 0),this.playlistLoaded(n,t,e)}else null!=(i=t.deliveryDirectives)&&i.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),n=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],r=e.details,a=null==r?void 0:r.age;this.log(`Loading level index ${n}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""}${s?" Pathway "+s:""}${a&&r.live?" age "+a.toFixed(1)+(r.type&&" "+r.type||""):""} ${i}`),this.hls.trigger(QE.LEVEL_LOADING,{url:i,level:n,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(1===this._levels.length)return;const i=this._levels.filter((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1));Wk(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const n=i.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger(QE.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(QE.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function HR(e){const t={};e.forEach(e=>{const i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++})}function VR(){return self.SourceBuffer||self.WebKitSourceBuffer}function GR(){if(!db())return!1;const e=VR();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class QR extends pw{constructor(e,t,i){super(e,t,i,"stream-controller",YE),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const e=this.media,t=e?e.currentTime:null;if(null===t||!UE(t))return;if(this.log(`Media seeked to ${t.toFixed(3)}`),!this.getBufferedFrag(t))return;const i=this.getFwdBufferInfoAtPos(e,t,YE,0);null!==i&&0!==i.len?this.tick():this.warn(`Main forward buffer length at ${t} on "seeked" event ${i?i.len:"empty"})`)},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.on(QE.LEVEL_LOADING,this.onLevelLoading,this),e.on(QE.LEVEL_LOADED,this.onLevelLoaded,this),e.on(QE.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(QE.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(QE.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(QE.BUFFER_CREATED,this.onBufferCreated,this),e.on(QE.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(QE.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(QE.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(QE.MANIFEST_PARSED,this.onManifestParsed,this),e.off(QE.LEVEL_LOADED,this.onLevelLoaded,this),e.off(QE.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(QE.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(QE.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(QE.BUFFER_CREATED,this.onBufferCreated,this),e.off(QE.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(QE.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(QE.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:n}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let e=n.startLevel;-1===e&&(n.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=n.firstAutoLevel),n.nextLoadLevel=e,this.level=n.loadLevel,this._hasEnoughToStart=!!t}i>0&&-1===e&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=rw,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=sw}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case mw:{const{levels:e,level:t}=this,i=null==e?void 0:e[t],n=null==i?void 0:i.details;if(n&&(!n.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(n))break;this.state=rw;break}if(this.hls.nextLoadLevel!==this.level){this.state=rw;break}break}case lw:this.checkRetryDate()}this.state===rw&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),null!=(e=this.media)&&e.readyState&&!1===this.media.seeking&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:n}=this;if(null===t||!n&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(null==i||!i[s])return;const r=i[s],a=this.getMainFwdBufferInfo();if(null===a)return;const o=this.getLevelDetails();if(o&&this._streamEnded(a,o)){const e={};return 2===this.altAudio&&(e.type="video"),this.hls.trigger(QE.BUFFER_EOS,e),void(this.state=hw)}if(!this.buffering)return;e.loadLevel!==s&&-1===e.manualLevel&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const l=r.details;if(!l||this.state===mw||this.waitForLive(r))return this.level=s,this.state=mw,void(this.startFragRequested=!1);const u=a.len,c=this.getMaxBufferLength(r.maxBitrate);if(u>=c)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:a.end;let h=this.getNextFragment(d,l);if(this.couldBacktrack&&!this.fragPrevious&&h&&xb(h)&&this.fragmentTracker.getState(h)!==AT){var f;const e=(null!=(f=this.backtrackFragment)?f:h).sn-l.startSN,t=l.fragments[e-1];t&&h.cc===t.cc&&(h=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(h&&this.isLoopLoading(h,d)){if(!h.gap){const e=this.audioOnly&&!this.altAudio?Ib:Lb,t=(e===Lb?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,YE)}h=this.getNextFragmentLoopLoading(h,l,a,YE,c)}h&&(!h.initSegment||h.initSegment.data||this.bitrateTest||(h=h.initSegment),this.loadFragment(h,r,d))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===pT||n===yT?xb(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,YE)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let i;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const s=this.getLevelDetails();if(null!=s&&s.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*s.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],n=this.fragLastKbps;i=n&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*n)+1:0}else i=0;const r=this.getBufferedFrag(t.currentTime+i);if(r){const e=this.followingBufferedFrag(r);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,n=Math.max(r.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(n,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case aw:case ow:case lw:case cw:case dw:this.state=rw}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,2===this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;tw(i,"playing",this.onMediaPlaying),tw(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(iw(i,"playing",this.onMediaPlaying),iw(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t);!!t.transferMedia||(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(QE.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,n=!1;for(let s=0;s<t.levels.length;s++){const e=t.levels[s].audioCodec;e&&(i=i||-1!==e.indexOf("mp4a.40.2"),n=n||-1!==e.indexOf("mp4a.40.5"))}this.audioCodecSwitch=i&&n&&!function(){var e;const t=VR();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==rw)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=mw)}onLevelLoaded(e,t){var i;const{levels:n,startFragRequested:s}=this,r=t.level,a=t.details,o=a.totalduration;if(!n)return void this.warn(`Levels were reset while loading level ${r}`);this.log(`Level ${r} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);const l=t.levelInfo,u=this.fragCurrent;!u||this.state!==ow&&this.state!==lw||u.level!==t.level&&u.loader&&this.abortCurrentFrag();let c=0;if(a.live||null!=(i=l.details)&&i.live){var d;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;c=this.alignPlaylists(a,l.details,null==(d=this.levelLastLoaded)?void 0:d.details)}if(l.details=a,this.levelLastLoaded=l,s||this.setStartPosition(a,c),this.hls.trigger(QE.LEVEL_UPDATED,{details:a,level:r}),this.state===mw){if(this.waitForCdnTuneIn(a))return;this.state=rw}s&&a.live&&this.synchronizeToLiveEdge(a),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const n=this.hls.liveSyncPosition,s=this.getLoadPosition(),r=e.fragmentStart,a=e.edge,o=s>=r-t.maxFragLookUpTolerance&&s<=a;if(null!==n&&i.duration>n&&(s<n||!o)){const r=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!o&&i.readyState<4||s<a-r)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),i.readyState))if(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${n.toFixed(3)}`),"buffered"===this.config.liveSyncMode){var l;const e=NT.bufferInfo(i,n,0);if(null==(l=e.buffered)||!l.length)return void(i.currentTime=n);if(e.start<=s)return void(i.currentTime=n);const{nextStart:t}=NT.bufferedInfo(e.buffered,s,0);t&&(i.currentTime=t)}else i.currentTime=n}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{levels:r}=this;if(!r)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const a=r[i.level];if(!a)return void this.warn(`Level ${i.level} not found on progress`);const o=a.details;if(!o)return this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),void this.fragmentTracker.removeFragment(i);const l=a.videoCodec,u=o.PTSKnown||!o.live,c=null==(t=i.initSegment)?void 0:t.data,d=this._getAudioCodec(a),h=this.transmuxer=this.transmuxer||new WI(this.hls,YE,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=n?n.index:-1,g=-1!==f,m=new FT(i.level,i.sn,i.stats.chunkCount,s.byteLength,f,g),p=this.initPTS[i.cc];h.push(s,c,d,l,i,n,o.totalduration,u,m,p)}onAudioTrackSwitching(e,t){const i=this.hls,n=0!==this.altAudio;if(WS(t.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(n)return this.altAudio=0,this.fragmentTracker.removeAllFragments(),i.once(QE.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(QE.AUDIO_TRACK_SWITCHED,t)}),void i.trigger(QE.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});i.trigger(QE.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=WS(t.url,this.hls);if(i){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let n,s,r=!1;for(const a in i){const e=i[a];if("main"===e.id){if(s=a,n=e,"video"===a){const e=i[a];e&&(this.videoBuffer=e.buffer)}}else r=!0}r&&n?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:n}=t,s=i.type===YE;if(s){if(this.fragContextChanged(i))return this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===dw&&(this.state=rw));const e=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*e.total/(e.buffering.end-e.loading.first)),xb(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const r=this.media;r&&(!this._hasEnoughToStart&&NT.getBuffered(r).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal)this.state=fw;else switch(t.details){case GE.FRAG_GAP:case GE.FRAG_PARSING_ERROR:case GE.FRAG_DECRYPT_ERROR:case GE.FRAG_LOAD_ERROR:case GE.FRAG_LOAD_TIMEOUT:case GE.KEY_LOAD_ERROR:case GE.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(YE,t);break;case GE.LEVEL_LOAD_ERROR:case GE.LEVEL_LOAD_TIMEOUT:case GE.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==mw||(null==(i=t.context)?void 0:i.type)!==zE||(this.state=rw);break;case GE.BUFFER_ADD_CODEC_ERROR:case GE.BUFFER_APPEND_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case GE.BUFFER_FULL_ERROR:if("main"!==t.parent)return;if(this.reduceLengthAndFlushBuffer(t)){!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}break;case GE.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onFragLoadEmergencyAborted(){this.state=rw,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Ib||!this.altAudio){const e=(t===Lb?this.videoBuffer:this.mediaBuffer)||this.media;e&&(this.afterBufferFlushed(e,t,YE),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking)return void this.log(`could not seek to ${i}, already seeking at ${t}`);const n=this.timelineOffset;n&&i&&(i+=n);const s=this.getLevelDetails(),r=NT.getBuffered(e),a=r.length?r.start(0):0,o=a-i,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||o>0&&(o<l||this.loadingParts&&o<2*((null==s?void 0:s.partTarget)||0)))&&(this.log(`adjusting start position by ${o} to match buffer start`),i+=o,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${a}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(e=>{const{hls:i}=this,n=null==e?void 0:e.frag;if(!n||this.fragContextChanged(n))return;t.fragmentError=0,this.state=rw,this.startFragRequested=!1,this.bitrateTest=!1;const s=n.stats;s.parsing.start=s.parsing.end=s.buffering.start=s.buffering.end=self.performance.now(),i.trigger(QE.FRAG_LOADED,e),n.bitrateTest=!1}).catch(t=>{this.state!==sw&&this.state!==fw&&(this.warn(t),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:n,chunkMeta:s}=e,r=this.getCurrentContext(s);if(!r)return void this.resetWhenMissingContext(s);const{frag:a,part:o,level:l}=r,{video:u,text:c,id3:d,initSegment:h}=n,{details:f}=l,g=this.altAudio?void 0:n.audio;if(this.fragContextChanged(a))this.fragmentTracker.removeFragment(a);else{if(this.state=cw,h){const e=h.tracks;if(e){const n=a.initSegment||a;if(this.unhandledEncryptionError(h,a))return;this._bufferInitSegment(l,e,n,s),i.trigger(QE.FRAG_PARSING_INIT_SEGMENT,{frag:n,id:t,tracks:e})}const n=h.initPTS,r=h.timescale,o=this.initPTS[a.cc];if(UE(n)&&(!o||o.baseTime!==n||o.timescale!==r)){const e=h.trackId;this.initPTS[a.cc]={baseTime:n,timescale:r,trackId:e},i.trigger(QE.INIT_PTS_FOUND,{frag:a,id:t,initPTS:n,timescale:r,trackId:e})}}if(u&&f){g&&"audiovideo"===u.type&&this.logMuxedErr(a);const e=f.fragments[a.sn-1-f.startSN],t=a.sn===f.startSN,i=!e||a.cc>e.cc;if(!1!==n.independent){const{startPTS:e,endPTS:n,startDTS:r,endDTS:l}=u;if(o)o.elementaryStreams[u.type]={startPTS:e,endPTS:n,startDTS:r,endDTS:l};else if(u.firstKeyFrame&&u.independent&&1===s.id&&!i&&(this.couldBacktrack=!0),u.dropped&&u.independent){const s=this.getMainFwdBufferInfo(),r=(s?s.end:this.getLoadPosition())+this.config.maxBufferHole,o=u.firstKeyFramePTS?u.firstKeyFramePTS:e;if(!t&&r<o-this.config.maxBufferHole&&!i)return void this.backtrack(a);i&&(a.gap=!0),a.setElementaryStreamInfo(u.type,a.start,n,a.start,l,!0)}else t&&e-(f.appliedTimelineOffset||0)>2&&(a.gap=!0);a.setElementaryStreamInfo(u.type,e,n,r,l),this.backtrackFragment&&(this.backtrackFragment=a),this.bufferFragmentData(u,a,o,s,t||i)}else{if(!t&&!i)return void this.backtrack(a);a.gap=!0}}if(g){const{startPTS:e,endPTS:t,startDTS:i,endDTS:n}=g;o&&(o.elementaryStreams[Ib]={startPTS:e,endPTS:t,startDTS:i,endDTS:n}),a.setElementaryStreamInfo(Ib,e,t,i,n),this.bufferFragmentData(g,a,o,s)}if(f&&null!=d&&d.samples.length){const e={id:t,frag:a,details:f,samples:d.samples};i.trigger(QE.FRAG_PARSING_METADATA,e)}if(f&&c){const e={id:t,frag:a,details:f,samples:c.samples};i.trigger(QE.FRAG_PARSING_USERDATA,e)}}}logMuxedErr(e){this.warn(`${xb(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==cw)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:s,video:r,audiovideo:a}=t;if(s){const i=e.audioCodec;let n=vS(s.codec,i);"mp4a"===n&&(n="mp4a.40.5");const r=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){n&&(n=-1!==n.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const e=s.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&-1===r.indexOf("firefox")&&(n="mp4a.40.5")}n&&-1!==n.indexOf("mp4a.40.5")&&-1!==r.indexOf("android")&&"audio/mpeg"!==s.container&&(n="mp4a.40.2",this.log(`Android: force audio codec to ${n}`)),i&&i!==n&&this.log(`Swapping manifest audio codec "${i}" for "${n}"`),s.levelCodec=n,s.id=YE,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${n||""}/${i||""}/${s.codec}]`),delete t.audiovideo}if(r){r.levelCodec=e.videoCodec,r.id=YE;const i=r.codec;if(4===(null==i?void 0:i.length))switch(i){case"hvc1":case"hev1":r.codec="hvc1.1.6.L120.90";break;case"av01":r.codec="av01.0.04M.08";break;case"avc1":r.codec="avc1.42e01e"}this.log(`Init video buffer, container:${r.container}, codecs[level/parsed]=[${e.videoCodec||""}/${i}]${r.codec!==i?" parsed-corrected="+r.codec:""}${r.supplemental?" supplemental="+r.supplemental:""}`),delete t.audiovideo}a&&(this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),delete t.video,delete t.audio);const o=Object.keys(t);if(o.length){if(this.hls.trigger(QE.BUFFER_CODECS,t),!this.hls)return;o.forEach(e=>{const s=t[e].initSegment;null!=s&&s.byteLength&&this.hls.trigger(QE.BUFFER_APPENDING,{type:e,data:s,frag:i,part:null,chunkMeta:n,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&2===this.altAudio?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,YE)}get maxBufferLength(){const{levels:e,level:t}=this,i=null==e?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=rw}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const i=e.currentTime;if(NT.isBuffered(e,i)?t=this.getAppendedFrag(i):NT.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,i=t.level;e&&t.sn===e.sn&&e.level===i||(this.fragPlaying=t,this.hls.trigger(QE.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(QE.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;return UE(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(UE(t)){const e=this.getLevelDetails(),i=this.currentFrag||(e?YS(null,e.fragments,t):null);if(i){const e=i.programDateTime;if(null!==e){const n=e+1e3*(t-i.start);return new Date(n)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class KR extends sb{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[i].loader;if(n){var t;if(e&&e!==(null==(t=n.context)?void 0:t.frag.type))return;n.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=GE.KEY_LOAD_ERROR,i,n,s){return new OT({type:VE.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:i,networkDetails:n})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let n=0,s=t.length;n<s;n++){const r=t[n];if(e.cc<=r.cc&&(!xb(e)||!xb(r)||e.sn<r.sn)||!i&&n==s-1)return this.emeController.selectKeySystemFormat(r).then(e=>{if(!this.emeController)return;r.setKeyFormat(e);const t=dk(e);return t?this.emeController.getKeySystemAccess([t]):void 0})}if(this.config.requireKeySystemAccessOnStart){const e=fk(this.config);if(e.length)return this.emeController.getKeySystemAccess(e)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const i=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,GE.KEY_LOAD_ERROR,i))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,GE.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));const a=zR(s);let o=this.keyIdToKeyInfo[a];if(null!=(i=o)&&i.decryptdata.key)return s.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if(this.emeController&&null!=(n=o)&&n.keyLoadPromise){switch(this.emeController.getKeyStatus(o.decryptdata)){case"usable":case"usable-in-future":return o.keyLoadPromise.then(t=>{const{keyInfo:i}=t;return s.key=i.decryptdata.key,{frag:e,keyInfo:i}})}}switch(this.log(`${this.keyIdToKeyInfo[a]?"Rel":"L"}oading${s.keyId?" keyId: "+gb(s.keyId):""} URI: ${s.uri} from ${e.type} ${e.level}`),o=this.keyIdToKeyInfo[a]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===s.keyFormat?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,GE.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var n;if(!e.decryptdata.keyId&&null!=(n=t.initSegment)&&n.data){const i=function(e){const t=[];return $b(e,e=>t.push(e.subarray(8,24))),t}(t.initSegment.data);if(i.length){let t=i[0];t.some(e=>0!==e)?(this.log(`Using keyId found in init segment ${gb(t)}`),yk.setKeyIdForUri(e.decryptdata.uri,t)):(t=yk.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${gb(t)}`)),e.decryptdata.keyId=t}}if(!e.decryptdata.keyId&&!xb(t))return Promise.resolve(i);const s=this.emeController.loadKey(i);return(e.keyLoadPromise=s.then(t=>(e.mediaKeySessionContext=t,i))).catch(i=>{throw e.keyLoadPromise=null,"data"in i&&(i.data.frag=t),i})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,n=new(0,i.loader)(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((s,r)=>{const a={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},o=i.keyLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(e,t,i,n)=>{const{frag:a,keyInfo:o}=i,l=zR(o.decryptdata);if(!a.decryptdata||o!==this.keyIdToKeyInfo[l])return r(this.createKeyLoadError(a,GE.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),n));o.decryptdata.key=a.decryptdata.key=new Uint8Array(e.data),a.keyLoader=null,o.loader=null,s({frag:a,keyInfo:o})},onError:(e,i,n,s)=>{this.resetLoader(i),r(this.createKeyLoadError(t,GE.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),n,nb({url:a.url,data:void 0},e)))},onTimeout:(e,i,n)=>{this.resetLoader(i),r(this.createKeyLoadError(t,GE.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),n))},onAbort:(e,i,n)=>{this.resetLoader(i),r(this.createKeyLoadError(t,GE.INTERNAL_ABORTED,new Error("key loading aborted"),n))}};n.load(a,l,u)})}resetLoader(e){const{frag:t,keyInfo:i,url:n}=e,s=i.loader;t.keyLoader===s&&(t.keyLoader=null,i.loader=null);const r=zR(i.decryptdata)||n;delete this.keyIdToKeyInfo[r],s&&s.destroy()}}function zR(e){if(e.keyFormat!==lk){const t=e.keyId;if(t)return gb(t)}return e.uri}function WR(e){const{type:t}=e;switch(t){case WE:return $E;case qE:return XE;default:return YE}}function qR(e,t){let i=e.url;return void 0!==i&&0!==i.indexOf("data:")||(i=t.url),i}class YR{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.on(QE.LEVEL_LOADING,this.onLevelLoading,this),e.on(QE.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(QE.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(QE.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(QE.MANIFEST_LOADING,this.onManifestLoading,this),e.off(QE.LEVEL_LOADING,this.onLevelLoading,this),e.off(QE.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(QE.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(QE.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,n=t.loader,s=new(i||n)(t);return this.loaders[e.type]=s,s}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:KE,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:s,url:r,deliveryDirectives:a,levelInfo:o}=t;this.load({id:i,level:n,pathwayId:s,responseType:"text",type:zE,url:r,deliveryDirectives:a,levelOrTrack:o})}onAudioTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:a}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:WE,url:s,deliveryDirectives:r,levelOrTrack:a})}onSubtitleTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:a}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:qE,url:s,deliveryDirectives:r,levelOrTrack:a})}onLevelsUpdated(e,t){const i=this.loaders[zE];if(i){const e=i.context;e&&!t.levels.some(t=>t===e.levelOrTrack)&&(i.abort(),delete this.loaders[zE])}}load(e){var t;const i=this.hls.config;let n,s=this.getInternalLoader(e);if(s){const t=this.hls.logger,i=s.context;if(i&&i.levelOrTrack===e.levelOrTrack&&(i.url===e.url||i.deliveryDirectives&&!e.deliveryDirectives))return void(i.url===e.url?t.log(`[playlist-loader]: ignore ${e.url} ongoing request`):t.log(`[playlist-loader]: ignore ${e.url} in favor of ${i.url}`));t.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}if(n=e.type===KE?i.manifestLoadPolicy.default:tb({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),UE(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===zE&&null!==e.level?t=this.hls.levels[e.level].details:e.type===WE&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===qE&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,i=t.targetduration;if(e&&i){const t=1e3*Math.max(3*e,.8*i);n=tb({},n,{maxTimeToFirstByteMs:Math.min(t,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,n.maxTimeToFirstByteMs)})}}}const r=n.errorRetry||n.timeoutRetry||{},a={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:r.maxNumRetry||0,retryDelay:r.retryDelayMs||0,maxRetryDelay:r.maxRetryDelayMs||0},o={onSuccess:(e,t,i,n)=>{const s=this.getInternalLoader(i);this.resetInternalLoader(i.type);const r=e.data;t.parsing.start=performance.now(),wk.isMediaPlaylist(r)||i.type!==KE?this.handleTrackOrLevelPlaylist(e,t,i,n||null,s):this.handleMasterPlaylist(e,t,i,n)},onError:(e,t,i,n)=>{this.handleNetworkError(t,i,!1,e,n)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}};s.load(e,a,o)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,n){const s=this.hls,r=e.data,a=qR(e,i),o=wk.parseMasterPlaylist(r,a);if(o.playlistParsingError)return t.parsing.end=performance.now(),void this.handleManifestParsingError(e,i,o.playlistParsingError,n,t);const{contentSteering:l,levels:u,sessionData:c,sessionKeys:d,startTimeOffset:h,variableList:f}=o;this.variableList=f,u.forEach(e=>{const{unknownCodecs:t}=e;if(t){const{preferManagedMediaSource:i}=this.hls.config;let{audioCodec:n,videoCodec:s}=e;for(let r=t.length;r--;){const a=t[r];uS(a,"audio",i)?(e.audioCodec=n=n?`${n},${a}`:a,oS.audio[n.substring(0,4)]=2,t.splice(r,1)):uS(a,"video",i)&&(e.videoCodec=s=s?`${s},${a}`:a,oS.video[s.substring(0,4)]=2,t.splice(r,1))}}});const{AUDIO:g=[],SUBTITLES:m,"CLOSED-CAPTIONS":p}=wk.parseMasterPlaylistMedia(r,a,o);if(g.length){g.some(e=>!e.url)||!u[0].audioCodec||u[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new zT({}),bitrate:0,url:""}))}s.trigger(QE.MANIFEST_LOADED,{levels:u,audioTracks:g,subtitles:m,captions:p,contentSteering:l,url:a,stats:t,networkDetails:n,sessionData:c,sessionKeys:d,startTimeOffset:h,variableList:f})}handleTrackOrLevelPlaylist(e,t,i,n,s){const r=this.hls,{id:a,level:o,type:l}=i,u=qR(e,i),c=UE(o)?o:UE(a)?a:0,d=WR(i),h=wk.parseLevelPlaylist(e.data,u,c,d,0,this.variableList);if(l===KE){const e={attrs:new zT({}),bitrate:0,details:h,name:"",url:u};h.requestScheduled=t.loading.start+Gk(h,0),r.trigger(QE.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:u,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=h,this.handlePlaylistLoaded(h,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(QE.ERROR,{type:VE.NETWORK_ERROR,details:GE.MANIFEST_PARSING_ERROR,fatal:t.type===KE,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:s})}handleNetworkError(e,t,i=!1,n,s){let r=`A network ${i?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===zE?r+=`: ${e.level} id: ${e.id}`:e.type!==WE&&e.type!==qE||(r+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(r);this.hls.logger.warn(`[playlist-loader]: ${r}`);let o=GE.UNKNOWN,l=!1;const u=this.getInternalLoader(e);switch(e.type){case KE:o=i?GE.MANIFEST_LOAD_TIMEOUT:GE.MANIFEST_LOAD_ERROR,l=!0;break;case zE:o=i?GE.LEVEL_LOAD_TIMEOUT:GE.LEVEL_LOAD_ERROR,l=!1;break;case WE:o=i?GE.AUDIO_TRACK_LOAD_TIMEOUT:GE.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case qE:o=i?GE.SUBTITLE_TRACK_LOAD_TIMEOUT:GE.SUBTITLE_LOAD_ERROR,l=!1}u&&this.resetInternalLoader(e.type);const c={type:VE.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:u,context:e,error:a,networkDetails:t,stats:s};if(n){const i=(null==t?void 0:t.url)||e.url;c.response=nb({url:i,data:void 0},n)}this.hls.trigger(QE.ERROR,c)}handlePlaylistLoaded(e,t,i,n,s,r){const a=this.hls,{type:o,level:l,levelOrTrack:u,id:c,groupId:d,deliveryDirectives:h}=n,f=qR(t,n),g=WR(n);let m="number"==typeof n.level&&g===YE?l:void 0;const p=e.playlistParsingError;if(p){if(this.hls.logger.warn(`${p} ${e.url}`),!a.config.ignorePlaylistParsingErrors)return void a.trigger(QE.ERROR,{type:VE.NETWORK_ERROR,details:GE.LEVEL_PARSING_ERROR,fatal:!1,url:f,error:p,reason:p.message,response:t,context:n,level:m,parent:g,networkDetails:s,stats:i});e.playlistParsingError=null}if(!e.fragments.length){const r=e.playlistParsingError=new Error("No Segments found in Playlist");return void a.trigger(QE.ERROR,{type:VE.NETWORK_ERROR,details:GE.LEVEL_EMPTY_ERROR,fatal:!1,url:f,error:r,reason:r.message,response:t,context:n,level:m,parent:g,networkDetails:s,stats:i})}switch(e.live&&r&&(r.getCacheAge&&(e.ageHeader=r.getCacheAge()||0),r.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),o){case KE:case zE:if(m)if(u){if(u!==a.levels[m]){const e=a.levels.indexOf(u);e>-1&&(m=e)}}else m=0;a.trigger(QE.LEVEL_LOADED,{details:e,levelInfo:u||a.levels[0],level:m||0,id:c||0,stats:i,networkDetails:s,deliveryDirectives:h,withoutMultiVariant:o===KE});break;case WE:a.trigger(QE.AUDIO_TRACK_LOADED,{details:e,track:u,id:c||0,groupId:d||"",stats:i,networkDetails:s,deliveryDirectives:h});break;case qE:a.trigger(QE.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:c||0,groupId:d||"",stats:i,networkDetails:s,deliveryDirectives:h})}}}class $R{static get version(){return Tw}static isMSESupported(){return GR()}static isSupported(){return function(){if(!GR())return!1;const e=db();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(t=>e.isTypeSupported(dS(t,"video")))||["mp4a.40.2","fLaC"].some(t=>e.isTypeSupported(dS(t,"audio"))))}()}static getMediaSource(){return db()}static get Events(){return QE}static get MetadataSchema(){return zw}static get ErrorTypes(){return VE}static get ErrorDetails(){return GE}static get DefaultConfig(){return $R.defaultConfig?$R.defaultConfig:CR}static set DefaultConfig(e){$R.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Sw,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=function(e,t,i){const n=ob();if("object"==typeof console&&!0===e||"object"==typeof e){const r=["debug","log","info","warn","error"];r.forEach(t=>{n[t]=lb(t,e,i)});try{n.log(`Debug logs enabled for "${t}" in hls.js version 1.6.15`)}catch(s){return ob()}r.forEach(t=>{ub[t]=lb(t,e)})}else tb(ub,n);return n}(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=function(e,t,i){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const n=RR(e),s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(e=>{const r=`${"level"===e?"playlist":e}LoadPolicy`,a=void 0===t[r],o=[];s.forEach(i=>{const s=`${e}Loading${i}`,l=t[s];if(void 0!==l&&a){o.push(s);const e=n[r].default;switch(t[r]={default:e},i){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}}),o.length&&i.warn(`hls.js config: "${o.join('", "')}" setting(s) are deprecated, use "${r}": ${US(t[r])}`)}),nb(nb({},n),t)}($R.DefaultConfig,e,t);this.userConfig=e,i.progressive&&xR(i,t);const{abrController:n,bufferController:s,capLevelController:r,errorController:a,fpsController:o}=i,l=new a(this),u=this.abrController=new n(this),c=new ET(this),d=i.interstitialsController,h=d?this.interstitialsController=new d(this,$R):null,f=this.bufferController=new s(this,c),g=this.capLevelController=new r(this),m=new o(this),p=new YR(this),v=i.contentSteeringController,y=v?new v(this):null,A=this.levelController=new jR(this,y),E=new NR(this),b=new KR(this.config,this.logger),S=this.streamController=new QR(this,c,b),T=this.gapController=new DR(this,c);g.setStreamController(S),m.setStreamController(S);const k=[p,A,S];h&&k.splice(1,0,h),y&&k.splice(1,0,y),this.networkControllers=k;const w=[u,f,T,g,m,E,c];this.audioTrackController=this.createController(i.audioTrackController,k);const I=i.audioStreamController;I&&k.push(this.audioStreamController=new I(this,c,b)),this.subtitleTrackController=this.createController(i.subtitleTrackController,k);const L=i.subtitleStreamController;L&&k.push(this.subtititleStreamController=new L(this,c,b)),this.createController(i.timelineController,w),b.emeController=this.emeController=this.createController(i.emeController,w),this.cmcdController=this.createController(i.cmcdController,w),this.latencyController=this.createController(UR,w),this.coreComponents=w,k.push(l);const C=l.onErrorOut;"function"==typeof C&&this.on(QE.ERROR,C,l),this.on(QE.MANIFEST_LOADED,p.onManifestLoaded,p)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,n){this._emitter.off(e,t,i,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const t=e===QE.ERROR;this.trigger(QE.ERROR,{type:VE.OTHER_ERROR,details:GE.INTERNAL_EXCEPTION,fatal:t,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(QE.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const t=new Error(`attachMedia failed: invalid argument (${e})`);return void this.trigger(QE.ERROR,{type:VE.OTHER_ERROR,details:GE.ATTACH_MEDIA_ERROR,fatal:!0,error:t})}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,n=t?e:{media:i};this._media=i,this.trigger(QE.MEDIA_ATTACHING,n)}detachMedia(){this.logger.log("detachMedia"),this.trigger(QE.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(QE.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,n=this._url=kb.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${n}`),t&&i&&(i!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(QE.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),this.started&&this.networkControllers);i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!this.started&&this.networkControllers);e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[YE]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[$E]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[XE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=null==e?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=function(){try{return crypto.randomUUID()}catch(e){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(t){let e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?i:3&i|8).toString(16)})}}}()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){(function(e){return RS.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let n=0;n<i;n++)if(e[n].maxBitrate>=t)return n;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let n;if(n=-1===t&&null!=e&&e.length?e.length-1:t,i)for(let s=n;s--;){const t=e[s].attrs["HDCP-LEVEL"];if(t&&t<=i)return s}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return(null==(t=this.audioTrackController)?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return(null==(t=this.subtitleTrackController)?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!(null==(e=this.bufferController)||!e.bufferedToEnd)}get interstitialsManager(){var e;return(null==(e=this.interstitialsController)?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){return IS(e,HS(t),navigator.mediaCapabilities)}}$R.defaultConfig=void 0;const XR=(ZR=function(e){if(!(null==e?void 0:e.prototype))return e;const t=NE(e,"video");t&&!`${t}`.includes("[native code]")||Object.defineProperty(e.prototype,"videoTracks",{get(){return function(e){let t=EE(e).videoTracks;if(!t&&(t=new TE,EE(e).videoTracks=t,FE)){const i=FE.call(e.nativeEl??e);for(const t of i)bE(e,t);const n=()=>{t.dispatchEvent(new Event("change"))},s=n=>{if([...t].some(e=>e instanceof CE))for(const e of i)SE(e);else bE(e,n.track)},r=e=>{SE(e.track)};i.addEventListener("change",n),i.addEventListener("addtrack",s),i.addEventListener("removetrack",r)}return t}(this)}});const i=NE(e,"audio");i&&!`${i}`.includes("[native code]")||Object.defineProperty(e.prototype,"audioTracks",{get(){return function(e){let t=EE(e).audioTracks;if(!t&&(t=new OE,EE(e).audioTracks=t,_E)){const i=_E.call(e.nativeEl??e);for(const t of i)PE(e,t);const n=()=>{t.dispatchEvent(new Event("change"))},s=n=>{if([...t].some(e=>e instanceof BE))for(const e of i)ME(e);else PE(e,n.track)},r=e=>{ME(e.track)};i.addEventListener("change",n),i.addEventListener("addtrack",s),i.addEventListener("removetrack",r)}return t}(this)}}),"addVideoTrack"in e.prototype||(e.prototype.addVideoTrack=function(e,t="",i=""){const n=new CE;return n.kind=e,n.label=t,n.language=i,bE(this,n),n}),"removeVideoTrack"in e.prototype||(e.prototype.removeVideoTrack=SE),"addAudioTrack"in e.prototype||(e.prototype.addAudioTrack=function(e,t="",i=""){const n=new BE;return n.kind=e,n.label=t,n.language=i,PE(this,n),n}),"removeAudioTrack"in e.prototype||(e.prototype.removeAudioTrack=ME),"videoRenditions"in e.prototype||Object.defineProperty(e.prototype,"videoRenditions",{get(){return n(this)}});const n=e=>{let t=EE(e).videoRenditions;return t||(t=new IE,EE(t).media=new WeakRef(e),EE(e).videoRenditions=t),t};"audioRenditions"in e.prototype||Object.defineProperty(e.prototype,"audioRenditions",{get(){return s(this)}});const s=e=>{let t=EE(e).audioRenditions;return t||(t=new xE,EE(t).media=new WeakRef(e),EE(e).audioRenditions=t),t};return e}(vE),JR=class extends ZR{constructor(){super(),I(this,ix),I(this,ex,null),I(this,tx,null),I(this,sx,()=>{var e,t,i;(null==(e=this.nativeEl)?void 0:e.webkitCurrentPlaybackTargetIsWireless)?null==(t=this.api)||t.stopLoad():null==(i=this.api)||i.startLoad()}),C(this,ix,rx).call(this,"config")}get config(){return w(this,tx)}set config(e){L(this,tx,e)}attributeChangedCallback(e,t,i){"src"!==e&&super.attributeChangedCallback(e,t,i),"src"===e&&t!=i&&this.load()}async load(){var e,t;const i=!this.api;if(C(this,ix,nx).call(this),this.src){if(i&&!w(this,tx)&&L(this,tx,JSON.parse((null==(e=this.shadowRoot.getElementById("config"))?void 0:e.textContent)||"{}")),$R.isSupported()){switch(await Promise.resolve(),this.api=new $R({liveDurationInfinity:!0,autoStartLoad:!1,...this.config}),this.api.loadSource(this.src),this.api.attachMedia(this.nativeEl),this.nativeEl.preload){case"none":{const e=()=>this.api.startLoad();this.nativeEl.addEventListener("play",e,{once:!0}),this.api.on($R.Events.DESTROYING,()=>{this.nativeEl.removeEventListener("play",e)});break}case"metadata":{const e=this.api.config.maxBufferLength,t=this.api.config.maxBufferSize;this.api.config.maxBufferLength=1,this.api.config.maxBufferSize=1;const i=()=>{this.api.config.maxBufferLength=e,this.api.config.maxBufferSize=t};this.nativeEl.addEventListener("play",i,{once:!0}),this.api.on($R.Events.DESTROYING,()=>{this.nativeEl.removeEventListener("play",i)}),this.api.startLoad();break}default:this.api.startLoad()}this.nativeEl.webkitCurrentPlaybackTargetIsWireless&&this.api.stopLoad(),this.nativeEl.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",w(this,sx)),L(this,ex,document.createElement("source")),w(this,ex).setAttribute("type","application/x-mpegURL"),w(this,ex).setAttribute("src",this.src),this.nativeEl.disableRemotePlayback=!1,this.nativeEl.append(w(this,ex));const e=new WeakMap;this.api.on($R.Events.MANIFEST_PARSED,(t,i)=>{this.nativeEl.autoplay&&this.nativeEl.paused&&this.nativeEl.play().catch(e=>{}),s();let n=this.videoTracks.getTrackById("main");n||(n=this.addVideoTrack("main"),n.id="main",n.selected=!0);for(const[s,r]of i.levels.entries()){const t=n.addRendition(r.url[0],r.width,r.height,r.videoCodec,r.bitrate);e.set(r,`${s}`),t.id=`${s}`}for(let[e,s]of i.audioTracks.entries()){const t=s.default?"main":"alternative",i=this.addAudioTrack(t,s.name,s.lang);i.id=`${e}`,s.default&&(i.enabled=!0)}}),this.audioTracks.addEventListener("change",()=>{var e;const t=+(null==(e=[...this.audioTracks].find(e=>e.enabled))?void 0:e.id),i=this.api.audioTracks.map(e=>e.id);t!=this.api.audioTrack&&i.includes(t)&&(this.api.audioTrack=t)}),this.api.on($R.Events.LEVELS_UPDATED,(t,i)=>{const n=this.videoTracks[this.videoTracks.selectedIndex??0];if(!n)return;const s=i.levels.map(t=>e.get(t));for(const e of this.videoRenditions)e.id&&!s.includes(e.id)&&n.removeRendition(e)});let i=null;this.api.on($R.Events.ERROR,(e,t)=>{t.type===$R.ErrorTypes.NETWORK_ERROR&&t.details===$R.ErrorDetails.FRAG_LOAD_ERROR&&(i=t.frag.level)}),this.api.on($R.Events.LEVEL_SWITCHED,(e,t)=>{const n=t.level;null!==i&&n<i&&(this.videoRenditions.selectedIndex=n,i=null)});const n=e=>{const t=e.target.selectedIndex;t!=this.api.nextLevel&&(this.api.nextLevel=t)};null==(t=this.videoRenditions)||t.addEventListener("change",n);const s=()=>{for(const e of this.videoTracks)this.removeVideoTrack(e);for(const e of this.audioTracks)this.removeAudioTrack(e)};return void this.api.once($R.Events.DESTROYING,s)}await Promise.resolve(),this.nativeEl.canPlayType("application/vnd.apple.mpegurl")&&(this.nativeEl.src=this.src)}}},ex=new WeakMap,tx=new WeakMap,ix=new WeakSet,nx=function(){var e,t;null==(e=w(this,ex))||e.remove(),null==(t=this.nativeEl)||t.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",w(this,sx)),this.api&&(this.api.detachMedia(),this.api.destroy(),this.api=null)},sx=new WeakMap,rx=function(e){if(Object.prototype.hasOwnProperty.call(this,e)){const t=this[e];delete this[e],this[e]=t}},T(JR,"shadowRootOptions",{...ZR.shadowRootOptions}),T(JR,"getTemplateHTML",(e,t={})=>{const{src:i,...n}=e;return`\n <script type="application/json" id="config">\n ${JSON.stringify(t.config||{})}\n <\/script>\n ${ZR.getTemplateHTML(n)}\n `}),JR);var ZR,JR,ex,tx,ix,nx,sx,rx;globalThis.customElements&&!globalThis.customElements.get("hls-video")&&globalThis.customElements.define("hls-video",XR);const ax="_videoContainer_119iz_3",ox="_cardVideo_119iz_10",lx=({card:e,cardIndex:t=0,isActive:i=!1,isMuted:n,volume:s=.5,onVideoReady:r,onPlayRequested:a,ready:o=!0,className:l=""})=>{const u=he.useRef(null);he.useEffect(()=>{u.current&&r&&o&&r(u.current)},[o]),he.useEffect(()=>{i&&u.current&&a&&o&&a(u.current)},[i,o]),he.useEffect(()=>{u.current&&o&&(n?u.current.muted=!0:u.current.paused||(u.current.muted=!1),void 0!==u.current.volume&&(u.current.volume=s))},[n,s,o]),he.useEffect(()=>{if(!u.current||!e.videoUrl)return;const t=u.current;t.setAttribute("src",e.videoUrl),e.videoThumbnail&&(t.poster=e.videoThumbnail,t.setAttribute("poster",e.videoThumbnail))},[e.videoUrl,e.videoThumbnail]);const c=0===t?"auto":"none";return xd.jsx(xd.Fragment,{children:e.videoUrl&&o&&xd.jsx("div",{className:ax,children:xd.jsx("hls-video",{ref:u,id:`video-card-${e.id}`,class:ox,src:e.videoUrl,muted:!0,loop:!0,playsInline:!0,preload:c,...e.videoThumbnail?{poster:e.videoThumbnail}:{}})})})},ux="_swipeableCard_14c6z_1",cx="_swipeHeadline_14c6z_25",dx=e=>"video"===e.type,hx=100,fx=1,gx=.35,mx=.25,px=.35,vx=600,yx=(e,t,i=!1)=>{const n=Math.abs(e)>Math.abs(t)?e>0?"right":"left":t>0?"down":"up";return i?n.charAt(0).toUpperCase()+n.slice(1):n},Ax=he.forwardRef(({card:e,cardIndex:t=0,cardUIConfig:i,isActive:n=!1,swipeOptions:s,creation:r,isAnimating:a=!1,animateDirection:o,onSwipeLeft:l,onSwipeRight:u,onSwipeUp:c,onSwipeDown:d,isMuted:h=!0,volume:f=.5,onVideoReady:g,onPlayRequested:m,onImageReady:p,ready:v=!0,className:y="",zIndex:A,tutorialXOffset:E=0},b)=>{const S=he.useRef(null),T=RA(0),k=RA(0),w=RA(1),[I,L]=he.useState({text:"",opacity:0}),C=he.useRef(null),R=he.useRef(0),x=he.useRef(null),D=DA(T,e=>e+E),P=he.useCallback(()=>s||((null==r?void 0:r.swipeOptions)?r.swipeOptions:{right:{enabled:!0,gesture:!0,label:"RIGHT"},left:{enabled:!0,gesture:!0,label:"LEFT"},up:{enabled:!0,gesture:!0,label:"UP"},down:{enabled:!0,gesture:!0,label:"DOWN"}}),[s,r]),M=he.useCallback(()=>{const e=P();return{right:e.right.label,left:e.left.label,up:e.up.label,down:e.down.label}},[P]),O=he.useCallback((e,t)=>{if(!n||a)return;const{offset:i}=t;x.current||(Math.abs(i.x)>5||Math.abs(i.y)>5)&&(x.current=Math.abs(i.x)>Math.abs(i.y)?"x":"y");const s=P(),r="x"===x.current?i.x:0,o="y"===x.current?i.y:0,l=r>0&&s.right.enabled&&s.right.gesture||r<0&&s.left.enabled&&s.left.gesture,u=o<0&&s.up.enabled&&s.up.gesture||o>0&&s.down.enabled&&s.down.gesture;if("x"===x.current&&!l)return;if("y"===x.current&&!u)return;T.set(r),k.set(o);const c=Math.sqrt(r**2+o**2);w.set((e=>1-Math.min(e/(4*hx),1)*(1-gx))(c));const d=yx(r,o,!0),h=Math.min(c/hx*3,fx);if(d!==C.current||Math.abs(h-R.current)>.05){C.current=d,R.current=h;const e=M(),t="Left"===d?e.left:"Right"===d?e.right:"Up"===d?e.up:"Down"===d?e.down:"";L({text:t,opacity:h})}},[n,a,P,M,T,k,w]),B=he.useCallback((e,t)=>{if(!n||a)return;const{offset:i}=t,s="x"===x.current?i.x:0,r="y"===x.current?i.y:0;x.current=null;const o=P(),h=s>0&&o.right.enabled&&o.right.gesture||s<0&&o.left.enabled&&o.left.gesture,f=r<0&&o.up.enabled&&o.up.gesture||r>0&&o.down.enabled&&o.down.gesture;if(Math.abs(s)>hx&&h||Math.abs(r)>hx&&f){const e=yx(s,r);tE(w,mx,{duration:px,ease:"easeOut"}),requestAnimationFrame(()=>{"right"===e&&u?(u(),L({text:"",opacity:0})):"left"===e&&l?(l(),L({text:"",opacity:0})):"up"===e&&c?(c(),L({text:"",opacity:0})):"down"===e&&d&&(d(),L({text:"",opacity:0}))})}else tE(T,0,{type:"spring",stiffness:400,damping:30,duration:.15}),tE(k,0,{type:"spring",stiffness:400,damping:30,duration:.15}),tE(w,1,{type:"spring",stiffness:400,damping:30,duration:.15});C.current=null,R.current=0},[n,a,P,l,u,c,d,T,k,w]),F=he.useRef(null);he.useEffect(()=>{if(o&&o!==F.current&&n&&S.current){F.current=o;const e=S.current.getBoundingClientRect(),t=e.width,i=e.height,n="up"===o?1.25*-i:"down"===o?1.25*i:0;tE(T,"left"===o?1.25*-t:"right"===o?1.25*t:0,{duration:vx/1e3,ease:"easeOut"}),tE(k,n,{duration:vx/1e3,ease:"easeOut"}),tE(w,mx,{duration:px,ease:"easeOut"})}else!o&&F.current&&(F.current=null,T.set(0),k.set(0),w.set(1))},[o,n,w,T,k]),he.useEffect(()=>{n||(T.set(0),k.set(0),w.set(1),L({text:"",opacity:0}),x.current=null)},[n,T,k,w]),he.useImperativeHandle(b,()=>({fadeOut:()=>{tE(w,mx,{duration:px,ease:"easeOut"})}}),[w]);const _=P(),N=_.left.enabled&&_.left.gesture||_.right.enabled&&_.right.gesture,U=_.up.enabled&&_.up.gesture||_.down.enabled&&_.down.gesture;return xd.jsxs(CA.div,{ref:S,drag:n&&!a&&(N||U),dragConstraints:{left:0,right:0,top:0,bottom:0},dragElastic:1,dragPropagation:!1,onDrag:O,onDragEnd:B,className:`${ux} ${y}`.trim(),style:{x:D,y:k,opacity:w,zIndex:A,cursor:n&&!a&&(N||U)?"grab":"default"},whileDrag:{cursor:"grabbing"},children:[xd.jsx(lE,{card:e,cardUIConfig:i,children:dx(e)?xd.jsx(lx,{card:e,cardIndex:t,isActive:n,isMuted:h,volume:f,onVideoReady:t=>{g&&g(t,e.id)},onPlayRequested:t=>{m&&m(t,e.id)},ready:v}):xd.jsx(cE,{card:e,onImageReady:t=>{p&&p(t,e.id)},ready:v})}),xd.jsx("div",{className:cx,style:{opacity:I.opacity},children:I.text})]})}),Ex="_ctaTooltip_1mai4_2",bx="_ctaTooltipArrow_1mai4_22",Sx=({currentCardId:e,currentCardIndex:t=0,totalCards:i=10,tooltipText:n,tooltipTextColor:s,tooltipTextSize:r,tooltipBackgroundColor:a,tooltipKeep:o=!1,assetTooltips:l={},buttonContainerId:u="buttonsContainer",onFirstSwipe:c,className:d=""})=>{var h;const[f,g]=he.useState(e??null),[m,p]=he.useState(t),[v,y]=he.useState(i),[A,E]=he.useState(t>0),b=he.useRef(null),S=he.useRef(t),T=f&&(null==(h=l[f])?void 0:h.enabled)?l[f]:null,k=(null==T?void 0:T.text)??n??null,w=!(m>=v)&&""!==(k??"")&&(!A||o);he.useEffect(()=>{void 0!==e&&g(e)},[e]),he.useEffect(()=>{const e=S.current;S.current=t,p(t),t>0&&0===e&&!A?(E(!0),c&&c()):t>0&&!A&&E(!0)},[t,A,c]),he.useEffect(()=>{y(i)},[i]);const[I,L]=he.useState(100);he.useEffect(()=>{const e=document.getElementById(u);if(!e)return;const t=new ResizeObserver(e=>{for(const t of e)L(t.contentRect.width)});return t.observe(e),b.current=t,()=>{b.current&&(b.current.disconnect(),b.current=null)}},[u]);const C=(null==T?void 0:T.textColor)??s,R=(null==T?void 0:T.textSize)??r,x=(null==T?void 0:T.backgroundColor)??a;if(!k)return null;const D=k.replace(/<br>/g,"\n"),P=x??"#FFFFFF",M=`calc((${I}px / 2) + 2px)`;return xd.jsxs("div",{className:`${Ex} ${d}`.trim(),style:{fontSize:R?`${R}px`:"12px",backgroundColor:P,color:C??"#333333",opacity:w?1:0},children:[D,xd.jsx("div",{className:bx,style:{right:M,backgroundColor:P}})]})},Tx={verticalEmojisButtons:"_verticalEmojisButtons_14t5d_2",buttonContainer:"_buttonContainer_14t5d_11",button:"_button_14t5d_11",emojiIcon:"_emojiIcon_14t5d_45",buttonLabel:"_buttonLabel_14t5d_56",buttonAnimation:"_buttonAnimation_14t5d_62",buttonLikeAnimation:"_buttonLikeAnimation_14t5d_80",buttonDislikeAnimation:"_buttonDislikeAnimation_14t5d_85",buttonMaybeAnimation:"_buttonMaybeAnimation_14t5d_90",buttonSeenAnimation:"_buttonSeenAnimation_14t5d_95",contrastMode:"_contrastMode_14t5d_101",contrastModeButton:"_contrastModeButton_14t5d_109",contrastModeLabel:"_contrastModeLabel_14t5d_119",contrastModeLike:"_contrastModeLike_14t5d_130",contrastModeDislike:"_contrastModeDislike_14t5d_135",contrastModeMaybe:"_contrastModeMaybe_14t5d_140",contrastModeSeen:"_contrastModeSeen_14t5d_145"},kx=({buttons:e,tooltipText:t,tooltipTextColor:i,tooltipTextSize:n,tooltipBackgroundColor:s,tooltipKeep:r,verticalPosition:a,horizontalPosition:o,buttonClass:l,containerClass:u,labelClass:c,onButtonClick:d,isAnimating:h=!1,visible:f=!0,className:g="",id:m="buttonsContainer",currentCardIndex:p,totalCards:v,onFirstSwipe:y})=>{const[A,E]=he.useState(null),b=he.useRef(null),S=he.useRef(null);he.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]);const T=t&&t.trim().length>0;return f?xd.jsxs("div",{ref:b,id:m,className:`${Tx.verticalEmojisButtons} contrast-mode ${u||""} ${g}`.trim(),style:{...void 0!==a&&{top:`${a}px`},...void 0!==o&&{right:`${o}px`}},children:[T&&xd.jsx(Sx,{tooltipText:t,tooltipTextColor:i,tooltipTextSize:n,tooltipBackgroundColor:s,tooltipKeep:r,buttonContainerId:m,currentCardIndex:p,totalCards:v,onFirstSwipe:y}),e.map(e=>{const t=A===e.id;return xd.jsxs("div",{className:Tx.buttonContainer,children:[xd.jsx("div",{className:`${Tx.button} ${e.action}-btn ${l||""} ${Tx.contrastModeButton} ${Tx[`contrastMode${e.action.charAt(0).toUpperCase()+e.action.slice(1)}`]||""} ${t&&Tx[`button${e.action.charAt(0).toUpperCase()+e.action.slice(1)}Animation`]||""}`.trim(),onClick:()=>(e=>{h||(E(e.id),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{E(null)},300),d&&d(e.action,e.id))})(e),children:xd.jsx("img",{src:e.icon,alt:e.altText,className:Tx.emojiIcon})}),xd.jsx("span",{className:`${Tx.buttonLabel} ${Tx.contrastModeLabel} ${c||""}`.trim(),children:e.label})]},e.id)})]}):null},wx={sideButtonsContainer:"_sideButtonsContainer_jjr9u_2",sideButtonsWrapper:"_sideButtonsWrapper_jjr9u_16",sideButtonContainer:"_sideButtonContainer_jjr9u_28",sideButtonLeft:"_sideButtonLeft_jjr9u_36",sideButtonRight:"_sideButtonRight_jjr9u_45",sideButtonTop:"_sideButtonTop_jjr9u_54",sideButtonBottom:"_sideButtonBottom_jjr9u_62",sideButton:"_sideButton_jjr9u_2",buttonContent:"_buttonContent_jjr9u_95",arrowWrapper:"_arrowWrapper_jjr9u_103",emojiWrapper:"_emojiWrapper_jjr9u_104",arrowRight:"_arrowRight_jjr9u_120",arrowLeft:"_arrowLeft_jjr9u_124",arrowUp:"_arrowUp_jjr9u_128",arrowDown:"_arrowDown_jjr9u_132",emojiIcon:"_emojiIcon_jjr9u_137",buttonLabel:"_buttonLabel_jjr9u_144",moveRight:"_moveRight_jjr9u_1",moveLeft:"_moveLeft_jjr9u_1",moveUp:"_moveUp_jjr9u_1",moveDown:"_moveDown_jjr9u_1"},Ix=({direction:e,size:t=32})=>xd.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:(()=>{switch(e){case"right":default:return wx.arrowRight;case"left":return wx.arrowLeft;case"up":return wx.arrowUp;case"down":return wx.arrowDown}})(),children:xd.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})}),Lx=({button:e,position:t,onButtonClick:i,isAnimating:n,buttonClass:s,labelClass:r,currentAnimation:a=0,showEmoji:o=!1,buttonSize:l=80})=>{const u=iE(),c=(()=>{switch(e.action){case"like":default:return"right";case"dislike":return"left";case"maybe":return"up";case"seen":return"down"}})(),d=["right","left","up","down"][a]===c,h=.4*l,f=wx[`sideButton${t.charAt(0).toUpperCase()+t.slice(1)}`]||"";return xd.jsx("div",{className:`${wx.sideButtonContainer} ${f}`,children:xd.jsxs(CA.button,{onClick:async()=>{n||(await u.start({scale:1.2,transition:{type:"spring",stiffness:400,damping:17,duration:.15}}),await u.start({scale:1,transition:{type:"spring",stiffness:400,damping:17,duration:.15}}),i&&i(e.action,e.id))},onContextMenu:e=>e.preventDefault(),className:`${wx.sideButton} ${e.action}-btn ${s||""}`.trim(),animate:u,whileHover:{scale:1.1,transition:{duration:.2}},style:{WebkitTouchCallout:"none",WebkitUserSelect:"none",touchAction:"manipulation",cursor:"pointer",pointerEvents:"auto",width:`${l}px`,height:`${l}px`},"aria-label":e.altText,children:[xd.jsxs("div",{className:wx.buttonContent,style:{width:`${h}px`,height:`${h}px`},children:[xd.jsx("div",{className:wx.arrowWrapper,style:{opacity:d&&o?0:1,transition:"opacity 0.15s ease"},children:xd.jsx(Ix,{direction:c,size:h})}),xd.jsx("div",{className:wx.emojiWrapper,style:{opacity:d&&o?1:0,transition:"opacity 0.15s ease"},children:xd.jsx("img",{src:e.icon,alt:e.altText,className:wx.emojiIcon,style:{width:`${h}px`,height:`${h}px`}})})]}),xd.jsx("span",{className:`${wx.buttonLabel} ${r||""}`.trim(),children:e.label})]})})},Cx=({buttons:e,buttonClass:t,containerClass:i,labelClass:n,buttonSize:s=80,onButtonClick:r,isAnimating:a=!1,visible:o=!0,className:l="",id:u="buttonsContainer"})=>{const[c,d]=he.useState(0),[h,f]=he.useState(!1),g=e.find(e=>"like"===e.action&&!1!==e.enabled),m=e.find(e=>"dislike"===e.action&&!1!==e.enabled),p=e.find(e=>"maybe"===e.action&&!1!==e.enabled),v=e.find(e=>"seen"===e.action&&!1!==e.enabled);return he.useEffect(()=>{f(!1);const e=setTimeout(()=>{f(!0)},300),t=setTimeout(()=>{f(!1)},1500);return()=>{clearTimeout(e),clearTimeout(t)}},[c]),he.useEffect(()=>{const e=setInterval(()=>{d(e=>(e+1)%4)},2e3);return()=>clearInterval(e)},[]),o?xd.jsx("div",{id:u,className:`${wx.sideButtonsContainer} ${i||""} ${l}`.trim(),children:xd.jsxs("div",{className:wx.sideButtonsWrapper,children:[p&&xd.jsx(Lx,{button:p,position:"top",onButtonClick:r,isAnimating:a,buttonClass:t,labelClass:n,currentAnimation:c,showEmoji:h,buttonSize:s}),m&&xd.jsx(Lx,{button:m,position:"left",onButtonClick:r,isAnimating:a,buttonClass:t,labelClass:n,currentAnimation:c,showEmoji:h,buttonSize:s}),g&&xd.jsx(Lx,{button:g,position:"right",onButtonClick:r,isAnimating:a,buttonClass:t,labelClass:n,currentAnimation:c,showEmoji:h,buttonSize:s}),v&&xd.jsx(Lx,{button:v,position:"bottom",onButtonClick:r,isAnimating:a,buttonClass:t,labelClass:n,currentAnimation:c,showEmoji:h,buttonSize:s})]})}):null},Rx="_horizontalCtaTooltip_1slua_1",xx=({currentCardId:e,currentCardIndex:t=0,tooltipText:i,tooltipTextColor:n,tooltipTextSize:s,tooltipBackgroundColor:r,tooltipKeep:a=!1,tooltipBottomOffset:o,assetTooltips:l={},onFirstSwipe:u,className:c=""})=>{var d;const[h,f]=he.useState(e??null),[g,m]=he.useState(t),[p,v]=he.useState(t>0),y=he.useRef(t),A=h&&(null==(d=l[h])?void 0:d.enabled)?l[h]:null,E=(null==A?void 0:A.text)??i??null,b=(0===g||a||((null==A?void 0:A.enabled)??!1))&&""!==(E??"")&&(!p||a);he.useEffect(()=>{void 0!==e&&f(e)},[e]),he.useEffect(()=>{const e=y.current;y.current=t,m(t),t>0&&0===e&&!p?(v(!0),u&&u()):t>0&&!p&&v(!0)},[t,p,u]);const S=(null==A?void 0:A.textColor)??n,T=(null==A?void 0:A.textSize)??s,k=(null==A?void 0:A.backgroundColor)??r,w=(null==A?void 0:A.bottomOffset)??o;if(!E)return null;const I=E.replace(/<br>/g,"\n");return xd.jsx("div",{className:`${Rx} ${c}`.trim(),style:{bottom:void 0!==w?`calc(${w}px + 50%)`:"50%",backgroundColor:k??"#FFFFFF",color:S??"#333333",fontSize:T?`${T}px`:"12px",opacity:b?1:0,pointerEvents:b?"auto":"none"},children:I})},Dx={sideButtonsContainer:"_sideButtonsContainer_1kkly_2",sideButtonsWrapper:"_sideButtonsWrapper_1kkly_16",sideButtonContainer:"_sideButtonContainer_1kkly_28",sideButtonLeft:"_sideButtonLeft_1kkly_36",sideButtonRight:"_sideButtonRight_1kkly_45",sideButtonTop:"_sideButtonTop_1kkly_54",sideButtonBottom:"_sideButtonBottom_1kkly_62",sideButton:"_sideButton_1kkly_2",buttonContent:"_buttonContent_1kkly_99",buttonLabel:"_buttonLabel_1kkly_111",arrowRight:"_arrowRight_1kkly_126",arrowLeft:"_arrowLeft_1kkly_130",arrowUp:"_arrowUp_1kkly_134",arrowDown:"_arrowDown_1kkly_138",moveRight:"_moveRight_1kkly_1",moveLeft:"_moveLeft_1kkly_1",moveUp:"_moveUp_1kkly_1",moveDown:"_moveDown_1kkly_1",tooltipWrapper:"_tooltipWrapper_1kkly_277"},Px=({direction:e,size:t=32})=>xd.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:(()=>{switch(e){case"right":default:return Dx.arrowRight;case"left":return Dx.arrowLeft;case"up":return Dx.arrowUp;case"down":return Dx.arrowDown}})(),children:xd.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})}),Mx=({button:e,position:t,onButtonClick:i,isAnimating:n,buttonClass:s,labelClass:r,currentAnimation:a=0,buttonSize:o=80})=>{const l=iE(),u=(()=>{switch(e.action){case"like":default:return"right";case"dislike":return"left";case"maybe":return"up";case"seen":return"down"}})(),c=.4*o,d=Dx[`sideButton${t.charAt(0).toUpperCase()+t.slice(1)}`]||"";return xd.jsx("div",{className:`${Dx.sideButtonContainer} ${d}`,children:xd.jsxs(CA.button,{onClick:async()=>{n||(await l.start({scale:1.2,transition:{type:"spring",stiffness:400,damping:17,duration:.15}}),await l.start({scale:1,transition:{type:"spring",stiffness:400,damping:17,duration:.15}}),i&&i(e.action,e.id))},onContextMenu:e=>e.preventDefault(),className:`${Dx.sideButton} ${e.action}-btn ${s||""}`.trim(),animate:l,whileHover:{scale:1.1,transition:{duration:.2}},style:{width:`${o}px`,height:`${o}px`},"aria-label":e.altText,children:[xd.jsx("div",{className:Dx.buttonContent,style:{width:`${c}px`,height:`${c}px`},children:xd.jsx(Px,{direction:u,size:c})}),xd.jsx("span",{className:`${Dx.buttonLabel} ${r||""}`.trim(),children:e.label})]})})},Ox=({buttons:e,ctaText:t,isDemoMode:i=!1,tooltipTextColor:n,tooltipTextSize:s,tooltipBackgroundColor:r,tooltipKeep:a,tooltipBottomOffset:o,currentCardIndex:l,onFirstSwipe:u,buttonClass:c,containerClass:d,labelClass:h,buttonSize:f=80,onButtonClick:g,isAnimating:m=!1,visible:p=!0,className:v="",id:y="buttonsContainer"})=>{const[A,E]=he.useState(0),b=e.find(e=>"like"===e.action&&e.enabled),S=e.find(e=>"dislike"===e.action&&e.enabled),T=e.find(e=>"maybe"===e.action&&e.enabled),k=e.find(e=>"seen"===e.action&&e.enabled);if(he.useEffect(()=>{const e=setInterval(()=>{E(e=>(e+1)%4)},2e3);return()=>clearInterval(e)},[]),!p)return null;const w=i&&t&&t.trim().length>0;return xd.jsx("div",{id:y,className:`${Dx.sideButtonsContainer} ${d||""} ${v}`.trim(),children:xd.jsxs("div",{className:Dx.sideButtonsWrapper,children:[T&&xd.jsx(Mx,{button:T,position:"top",onButtonClick:g,isAnimating:m,buttonClass:c,labelClass:h,currentAnimation:A,buttonSize:f}),S&&xd.jsx(Mx,{button:S,position:"left",onButtonClick:g,isAnimating:m,buttonClass:c,labelClass:h,currentAnimation:A,buttonSize:f}),w&&xd.jsx("div",{className:Dx.tooltipWrapper,children:xd.jsx(xx,{tooltipText:t,tooltipTextColor:n,tooltipTextSize:s,tooltipBackgroundColor:r,tooltipKeep:a,tooltipBottomOffset:o,currentCardIndex:l??0,onFirstSwipe:u})}),b&&xd.jsx(Mx,{button:b,position:"right",onButtonClick:g,isAnimating:m,buttonClass:c,labelClass:h,currentAnimation:A,buttonSize:f}),k&&xd.jsx(Mx,{button:k,position:"bottom",onButtonClick:g,isAnimating:m,buttonClass:c,labelClass:h,currentAnimation:A,buttonSize:f})]})})},Bx="_swipeTutorialOverlay_jbb64_2",Fx="_handContainer_jbb64_16",_x="_handIcon_jbb64_24",Nx="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABBwAAAQ4AQAAAACC3fKIAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAnRSTlMAAHaTzTgAAAACYktHRAAB3YoTpAAAAAd0SU1FB+oCCwgOA99Ta6kAABV7SURBVHja7Z1PsqwqEsY1HDBk2jOWwtK0ozfmDnoLLsGhEW1o3z/nVKklmh9kJt53YfTOfVXUTyA/kgSTqiqllFJKKaWUUkoppZRSSinl7y71OrDX6RbwC806sUO0a4d9wa8rN0Ozoq3brij2bbEr2Lr1uq4995BY1xltOvaR+aOHsS4268o+Mn/0MNbFP/oPbLv7sqJd7Pghfg4zrIt/9t8iADGi/beyywQ4zn5+gVkofo51qItrKYgFbTpmCLuCXfyLmlkyLfpgVgDCoXX+/sIgADFgMiEDMYIyIQIxgTIhAjGDMiECsYAyIQKxgjIhA9FhMiED0YOfF4EYMAuVgRgxC5WBmDALlYGYMQsVmcDIQmEkIVYQohOB6CCZEPGsyO3rRCAMNtz9uq78Lv83xAhpFfPi59vmJkirJFZgZKHAPg1DLBLtBrprxKEGjiDQcSUanRWZOt5G1yMy0TNDOOThvBCERbq5FdGq91ib8snE2+pmdnsWEgopmYCEQkomIKGwYhCA2UnJBCQUXsSlAdtYSiYgoZCyUEQohLwJTCgaOQi6UMhZKCAUTsibgITCi8kE8ICtmEwAXb2KyQRdKGo5maBbnigEtXI5bwLoayMoE+RRbwVlgmz/TlAmyELhBWWCLBStoEyQhULSQqlCIehN0IVCViaIQiErE0ShkJUJolDIygRRKGRlgigUsjJBFApZmaAJhbBM0I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UhquwGShwUsziEeUBvUAZFJw5xrxSTPMP99DEoQNSZ5ZLUH5MKhM3fG7f20VX5+0OnIW76Q6khLpti1GK4kgq1hrhoil6PIdwUig0RbIpKtZiMYnndFr02w0lbLFUppZRSSimllFJKKaWUUkoppZQSKP8HUbkEDAG+x4EAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjYtMDItMTFUMDg6MTQ6MDMrMDA6MDCAmdYbAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDI2LTAyLTExVDA4OjE0OjAzKzAwOjAw8cRupwAAAABJRU5ErkJggg==",Ux=({size:e=80,src:t,alt:i})=>xd.jsx("img",{src:t,alt:i,className:_x,style:{width:`${e}px`,height:`${e}px`}}),jx=({visible:e=!0,onCardMove:t,animationDuration:i=3e3,startDelay:n=500,className:s="",id:r="swipeTutorialOverlay"})=>{const a=iE(),o=he.useRef(null),l=he.useRef(!1),[u,c]=he.useState(Nx);return he.useEffect(()=>{if(!e)return a.set({x:0}),c(Nx),t&&t(0),o.current&&(cancelAnimationFrame(o.current),o.current=null),void(l.current=!1);if(l.current)return;l.current=!0;return(async()=>{for(await new Promise(e=>setTimeout(e,n));e&&l.current;)c(Nx),await a.start({x:0,transition:{duration:.4,ease:"easeOut"}}),await new Promise(e=>setTimeout(e,1e3)),c("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABBwAAAQ4CAQAAAAArweuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAHHkSURBVHja7d13nBbHYf/x79Db0etxvd/RqwoSSKh32XJRYjtuiR07sZPYaU7imuIk/sWOe48tN9mW1ZAEiCaJItGr6Bxw9C7g6OXm9wdIQqI9zz27O7O7n3deSWwJdnZntnyf2dkZCQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AJBcs22hiqgGBBIa1uuo7uVZRHAAkHSzbLn6UQ3IKTTU6zCzNBAcAKTHAtuPCaLQLDu0SyN4AhEcAKTNBNtBpSqjIpCFDdqum3j6EBwApNkaW00l4Kq267DqeO4QHABAmmy7ayS3FFzGca3WQd3CCUJwAIALrbBF6kw14AKntEOlPGsIDgBwadNsS/VXJRUBSeu1VaKfgeAAAFe33Pbkc83UOq0tOsRXEwQHAMjOLNtedWpPRaTKRm3RCd3F04XgAADNs8x2Vr7aUBGJt0cbdUCWeSAJDgCQqxdtG/VVKRWRULvVoD06qod5phAcACA4c2wbdVORWlMVCXFU+9SoQTxJCA4AEJ7JtoPyVU5FxNpO1Wuf3sEzhOAAANFZb1uppzpREbFxXHt1XDU8OQgOAODKU7a9Oqmb+qkrleGx3dqugzqjO3hqEByoAgC+WGjbqLMK1YKq8MQxNapRxzWYZwUIDgB8NcHmqUAVVIRDr2mrduiUHuAZAYIDgDhZZVuog3qoA1URohPaoxOSWqiSZwIIDgDib7JtqQ7qpr7qRmUEao92aJ+O0bMAggOANKi3x3RKTbKS2qiz+jK99ds0arcO65Sa1FIt1Vqt1EqtVc6dHwQHAOn1a3tCx3RMVp3UU4UqTfniWo3arYNq1GEd1Gtq1Bm1UXt1VJ7exx0fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJB0/x/Bt3TKC4gr+QAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyNi0wMi0xMVQwODoxMzo0NyswMDowMBJA54sAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjYtMDItMTFUMDg6MTM6NDcrMDA6MDBjHV83AAAAAElFTkSuQmCC"),await Promise.all([a.start({x:90,transition:{duration:i/1e3,ease:"easeOut"}}),t?new Promise(e=>{const n=Date.now(),s=()=>{const r=Date.now()-n,a=Math.min(r/i,1),l=1-Math.pow(1-a,3);t(150*l),a<1?o.current=requestAnimationFrame(s):e()};s()}):Promise.resolve()]),c(Nx),await Promise.all([a.start({x:0,transition:{duration:.5,ease:"easeInOut"}}),t?new Promise(e=>{const i=Date.now(),n=()=>{const s=Date.now()-i,r=Math.min(s/500,1),a=1-Math.pow(1-r,3);t(150*(1-a)),r<1?o.current=requestAnimationFrame(n):(t(0),e())};n()}):Promise.resolve()]),await new Promise(e=>setTimeout(e,500)),c("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABBwAAAQ4CAQAAAAArweuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAE5dSURBVHja7d13vG5VfSf+777tnMu9F5AL3AKCYAHEQhDUYDdxYhJ1HAvjaOxiTXOS0ZlkJslk0pNfzGSMLcWGGks0oCLWSEws9KaJqKBSbu/tnFvO+v3BBUFuec45+3n2Wmu/33m9fBnkPHvv7157rc9eu0UAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtKZRgul4V1oQ949HxLEREbEhro3vxvYYi+PiBSoJgODAj3wyjceKOPM+//y2WB2bYyKeqZYACA5E/Hm6X5wUZ8SKQ/w7U3F1/Ftsj9erKACCQ399OG2IB8cTY8FA//YX4pZ4tZoCIDj007vSMfGTsXIaf3FD3BgvVFUABIf+eW96QDxx2n+1Kf41NseLVRYAwaE/PpQm4px42Az/+pL49/g1tQVAcOiH96XF8YT9D13OzCfjO6IDAIJDH3wwHRk/P+tf+XDsiFeqLwBVmaME9xnw0/IWYkPEz8SYYgIgONQeG46Pp7TyS0fHo+PDSUUBEBwqjg0nxpNb+7UHx6nxd6IDAIJDnS5Mx8d5rf7iOXG0sgIgONTo/emYFmcb7nJeXGrOAYBqzFOCO300zYunD+F3l8USxQVAcKjLx9KR8bQh/fbRygtANVyqiIiI44cWGyKW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AcgB6cIad5ijBtu2NMz88seKoCKNb8pmmaZqtCDGRnNE3TNI3YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAxf5/YGXrivgArHYAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjYtMDItMTFUMDg6MTM6MjArMDA6MDARiNCCAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDI2LTAyLTExVDA4OjEzOjIwKzAwOjAwYNVoPgAAAABJRU5ErkJggg=="),await Promise.all([a.start({x:-90,transition:{duration:i/1e3,ease:"easeOut"}}),t?new Promise(e=>{const n=Date.now(),s=()=>{const r=Date.now()-n,a=Math.min(r/i,1),l=1-Math.pow(1-a,3);t(-150*l),a<1?o.current=requestAnimationFrame(s):e()};s()}):Promise.resolve()]),c(Nx),await Promise.all([a.start({x:0,transition:{duration:.5,ease:"easeInOut"}}),t?new Promise(e=>{const i=Date.now(),n=()=>{const s=Date.now()-i,r=Math.min(s/500,1),a=1-Math.pow(1-r,3);t(-150*(1-a)),r<1?o.current=requestAnimationFrame(n):(t(0),e())};n()}):Promise.resolve()]),await new Promise(e=>setTimeout(e,1e3))})(),()=>{l.current=!1,o.current&&(cancelAnimationFrame(o.current),o.current=null)}},[e,a,t,i,n]),e?xd.jsx("div",{id:r,className:`${Bx} ${s}`.trim(),children:xd.jsx(CA.div,{className:Fx,animate:a,initial:{x:0},children:xd.jsx(Ux,{size:80,src:u,alt:"Swipe tutorial hand"})})}):null},Hx="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='144'%20height='144'%20fill='%23000'%20xmlns:v='https://vecta.io/nano'%3e%3cpath%20d='M71.998%20105c6.8%200%2012.975-1.925%2018.525-5.775S100.098%2090.3%20102.598%2084h-9.9c-2.2%203.7-5.125%206.625-8.775%208.775S76.298%2096%2071.998%2096s-8.275-1.075-11.925-3.225S53.498%2087.7%2051.298%2084h-9.9c2.5%206.3%206.525%2011.375%2012.075%2015.225S65.198%20105%2071.998%20105zM52.395%2051.002c-3.2%200-6.175.9-8.925%202.7a23.03%2023.03%200%200%200-6.825%206.9l7.5%204.95c1-1.5%202.2-2.775%203.6-3.825s2.95-1.575%204.65-1.575%203.25.525%204.65%201.575%202.6%202.275%203.6%203.675l7.5-4.95c-1.8-2.7-4.075-4.95-6.825-6.75s-5.725-2.7-8.925-2.7zm42%200c-3.2%200-6.175.9-8.925%202.7a23.03%2023.03%200%200%200-6.825%206.9l7.5%204.95c1-1.4%202.2-2.625%203.6-3.675s2.95-1.575%204.65-1.575%203.275.5%204.725%201.5%202.626%202.25%203.525%203.75l7.5-4.95a23.03%2023.03%200%200%200-6.825-6.9c-2.75-1.8-5.725-2.7-8.925-2.7z'/%3e%3c/svg%3e",Vx="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='144'%20height='144'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cpath%20d='M37.498%2095.998h9v-1.5c0-7.1%202.475-13.125%207.425-18.075s10.975-7.425%2018.075-7.425%2013.125%202.475%2018.075%207.425%207.425%2010.975%207.425%2018.075v1.5h9v-1.5c0-9.6-3.35-17.75-10.05-24.45s-14.85-10.05-24.45-10.05-17.75%203.35-24.45%2010.05-10.05%2014.85-10.05%2024.45v1.5zm5.1-40.5c4.1-.6%208.425-2.2%2012.975-4.8s8.175-5.55%2010.875-8.85l-6.9-5.7c-2%202.4-4.775%204.6-8.325%206.6s-6.825%203.25-9.825%203.75l1.2%209zm58.8%200l1.2-9c-3-.5-6.275-1.75-9.825-3.75s-6.325-4.2-8.325-6.6l-6.9%205.7c2.7%203.3%206.325%206.25%2010.875%208.85s8.875%204.2%2012.975%204.8z'%20fill='%23000'/%3e%3c/svg%3e",Gx="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='145'%20height='144'%20fill='%23000'%20xmlns:v='https://vecta.io/nano'%3e%3cdefs%3e%3cclipPath%20id='iconClip'%3e%3ccircle%20cx='50%25'%20cy='50%25'%20r='50%25'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23iconClip)'%3e%3cpath%20d='M49.734%2084.513a2%202%200%200%200%201.284%202.52l30.434%209.889a2%202%200%200%200%202.52-1.284l1.545-4.755a2%202%200%200%200-1.284-2.52L53.8%2078.474a2%202%200%200%200-2.52%201.284l-1.545%204.755zm44.815-11.736c2.378.773%204.669.597%206.874-.526s3.694-2.874%204.467-5.252.597-4.669-.527-6.874-2.874-3.694-5.252-4.467-4.669-.597-6.874.527-3.694%202.874-4.466%205.252-.597%204.669.527%206.874%202.874%203.694%205.252%204.466zM54.605%2059.799c2.378.773%204.669.597%206.874-.526s3.694-2.874%204.467-5.252.597-4.669-.527-6.874-2.874-3.694-5.252-4.466-4.669-.597-6.874.526-3.694%202.874-4.466%205.252-.597%204.669.526%206.874%202.874%203.694%205.252%204.467z'/%3e%3c/g%3e%3c/svg%3e",Qx="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='144'%20height='144'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cpath%20d='M63.601%2099.602l42.3-42.3-8.4-8.4-33.9%2033.9-17.1-17.1-8.4%208.4%2025.5%2025.5z'%20fill='%23000'/%3e%3c/svg%3e",Kx="_swipeableFeed_jamse_1",zx="_swipeableFeedCards_jamse_8",Wx="_swipeableFeedEmpty_jamse_22",qx="_swipeTutorialContainer_jamse_33",Yx=({cards:e,finderUiConfig:t,buttonStyle:i="vertical-emojis",maxVisibleCards:n=2,isMuted:s=!0,volume:r=.5,currentCardIndex:a,setCurrentCardIndex:o,addSwipeToHistory:l,setIsAnimating:u,isAnimating:c,setNoMoreCards:d,sendSwipeEvent:h,sendImpressionEvent:f,startCardImpression:g,onAllCardsSwiped:m,onCardSwiped:p,swipeTutorialEnabled:v=!1,swipeTutorialDuration:y=3e3,swipeTutorialStartDelay:A=500,id:E="swipeableFeed"})=>{const[b,S]=he.useState(!1),[T,k]=he.useState(null),[w,I]=he.useState({}),[L,C]=he.useState(0),R=he.useRef(null),x=he.useCallback(async e=>{if(!e)return;if(!("HLS-VIDEO"===e.tagName||"VIDEO"===e.tagName||"play"in e))return;const t=e;try{t.muted=!0,t.setAttribute&&t.setAttribute("muted",""),(void 0===t.readyState||t.readyState<2)&&await new Promise(e=>{const i=()=>{t.removeEventListener("loadeddata",i),e()};t.addEventListener("loadeddata",i),setTimeout(()=>{t.removeEventListener("loadeddata",i),e()},3e3)}),void 0!==t.currentTime&&(t.currentTime=0);let e=0;const i=5,n=async()=>{try{t.muted=!0,t.play&&await t.play()}catch(s){e<i&&(e++,t.load&&t.load(),setTimeout(n,500*e))}};setTimeout(()=>{n()},200)}catch(i){}},[]),D=he.useMemo(()=>e.slice(a,a+n),[e,a,n]),P=a<e.length,M=he.useCallback(t=>{if(c||!P)return;const i=e[a];i&&(u(!0),S(!0),C(0),i.id&&h(i.id,t),l(t,i),null==p||p(i,t),k(t),setTimeout(()=>{const t=a+1;if(k(null),t>=e.length)return u(!1),d(!0),void(null==m||m());const i=e[t];if(!(!i||(w[t]??!1))&&i){const e=(i=0)=>{if(i>20)return u(!1),void o(t);w[t]??!1?(u(!1),o(t)):setTimeout(()=>e(i+1),100)};e()}else u(!1),o(t);if(t<e.length){const i=e[t];(null==i?void 0:i.id)&&(g(i.id),f(i.id),"video"===i.type&&i.videoUrl&&setTimeout(()=>{var e;const t=null==(e=R.current)?void 0:e.querySelector(`[id="${i.id}"]`);if(t){const e=t.querySelector("hls-video, video");e&&x(e)}},100))}},600))},[c,P,e,a,u,o,d,h,f,g,l,p,m,x,w,d]),O=he.useCallback((e,t)=>{if(c||!P)return;const i={like:"right",dislike:"left",maybe:"up",seen:"down"}[e];i&&M(i)},[c,P,M]),B=he.useCallback(e=>{C(e)},[]),F=he.useCallback(t=>{const i=e.findIndex(e=>e.id===t);i>=0&&I(e=>({...e,[i]:!0}))},[e]),_=he.useCallback((e,t)=>{t&&F(t)},[F]),N=he.useCallback((t,i)=>{if(!t)return;const n=e[a];n&&i===n.id&&x(t)},[x,e,a]),U=he.useCallback((e,t)=>{t&&F(t)},[F]),j=he.useRef(new Set);he.useEffect(()=>{D.forEach((e,t)=>{const i=a+t;"image"===e.type&&e.id&&!j.current.has(i)&&(j.current.add(i),I(e=>({...e,[i]:!0})))});const e=new Set(D.map((e,t)=>a+t));j.current.forEach(t=>{e.has(t)||j.current.delete(t)})},[D,a]),he.useEffect(()=>{if(e.length>0&&0===a){const t=e[0];(null==t?void 0:t.id)&&(g(t.id),f(t.id),"video"===t.type&&t.videoUrl&&setTimeout(()=>{var e;const i=null==(e=R.current)?void 0:e.querySelector(`[id="${t.id}"]`);if(i){const e=i.querySelector("hls-video, video");e&&x(e)}},500))}},[e,a,g,f,x]),he.useEffect(()=>{C(0)},[a]);const H=he.useMemo(()=>t.navigation.options||{right:{enabled:!0,gesture:!0,label:"RIGHT"},left:{enabled:!0,gesture:!0,label:"LEFT"},up:{enabled:!0,gesture:!1,label:"UP"},down:{enabled:!0,gesture:!1,label:"DOWN"}},[t.navigation.options]),V=he.useMemo(()=>{const n={tooltipText:t.navigationDemoTooltip.text,tooltipTextColor:t.navigationDemoTooltip.textColor,tooltipTextSize:t.navigationDemoTooltip.textSize,tooltipBackgroundColor:t.navigationDemoTooltip.backgroundColor,tooltipKeep:t.navigationDemoTooltip.keep,onButtonClick:O,isAnimating:c,visible:P,currentCardIndex:a,totalCards:e.length,onFirstSwipe:()=>S(!0)};switch(i){case"vertical-emojis":{const e=[{id:"likeBtn",action:"like",label:H.right.label,icon:Hx,altText:"Yes"},{id:"dislikeBtn",action:"dislike",label:H.left.label,icon:Vx,altText:"No"},{id:"maybeBtn",action:"maybe",label:H.up.label,icon:Gx,altText:"Maybe"},{id:"seenBtn",action:"seen",label:H.down.label,icon:Qx,altText:"Seen"}].filter(e=>{var t;const i={like:"right",dislike:"left",maybe:"up",seen:"down"}[e.action];return(null==(t=H[i])?void 0:t.enabled)??!0});return{component:kx,props:{...n,buttons:e,verticalPosition:t.navigation.positionTop,horizontalPosition:t.navigation.positionRight}}}case"side-emojis":{const e=[{id:"likeBtn",action:"like",label:H.right.label,icon:Hx,altText:"Yes"},{id:"dislikeBtn",action:"dislike",label:H.left.label,icon:Vx,altText:"No"}].filter(e=>{var t;const i={like:"right",dislike:"left"}[e.action];return(null==(t=H[i])?void 0:t.enabled)??!0});return{component:Cx,props:{...n,buttons:e}}}case"side-arrows":{const e=[{id:"likeBtn",action:"like",label:H.right.label,icon:Hx,altText:"Yes",enabled:H.right.enabled},{id:"dislikeBtn",action:"dislike",label:H.left.label,icon:Vx,altText:"No",enabled:H.left.enabled},{id:"maybeBtn",action:"maybe",label:H.up.label,icon:Gx,altText:"Maybe",enabled:H.up.enabled},{id:"seenBtn",action:"seen",label:H.down.label,icon:Qx,altText:"Seen",enabled:H.down.enabled}];return{component:Ox,props:{...n,buttons:e,ctaText:t.navigationDemoTooltip.text,isDemoMode:Boolean(t.navigationDemoTooltip.text&&!b),tooltipBottomOffset:t.navigationDemoTooltip.bottomOffset}}}default:return null}},[i,t.navigation.options,H,O,c,P,a,e.length,b]),G=he.useCallback(()=>{H.left.enabled&&H.left.gesture&&M("left")},[H.left,M]),Q=he.useCallback(()=>{H.right.enabled&&H.right.gesture&&M("right")},[H.right,M]),K=he.useCallback(()=>{H.up.enabled&&H.up.gesture&&M("up")},[H.up,M]),z=he.useCallback(()=>{H.down.enabled&&H.down.gesture&&M("down")},[H.down,M]);return 0===e.length?xd.jsx("div",{className:Kx,id:E,children:xd.jsx("div",{className:Wx,children:"No cards available"})}):xd.jsxs("div",{ref:R,className:Kx,id:E,children:[xd.jsx("div",{className:zx,children:D.map((e,i)=>{const o=a+i,l=0===i,u=l&&(w[o]??!0)&&!c,d=n-i;return xd.jsx(Ax,{card:e,cardUIConfig:t.card,cardIndex:o,isActive:l,swipeOptions:H,isAnimating:c&&l,animateDirection:l?T:null,onSwipeLeft:u?G:void 0,onSwipeRight:u?Q:void 0,onSwipeUp:u?K:void 0,onSwipeDown:u?z:void 0,onVideoReady:_,onPlayRequested:N,onImageReady:U,isMuted:s,volume:r,ready:!0,zIndex:d,tutorialXOffset:l?L:0},e.id)})}),(()=>{if(!V||!P)return null;const{component:e,props:t}=V;return xd.jsx(e,{...t})})(),v&&P&&!b&&D.length>0&&xd.jsx("div",{className:qx,children:xd.jsx(jx,{visible:!0,onCardMove:B,animationDuration:y,startDelay:A})})]})},$x="_volumeControl_r52gg_2",Xx="_volumeControlTopLeft_r52gg_12",Zx="_volumeControlTopRight_r52gg_17",Jx="_volumeControlBottomLeft_r52gg_23",eD="_volumeControlBottomRight_r52gg_28",tD="_volumeControlButton_r52gg_34",iD="_volumeSlider_r52gg_60",nD="_volumeSliderInput_r52gg_81",sD="_volumeSliderLeft_r52gg_122",rD="_volumeSliderRight_r52gg_126",aD=({volumeControlUIConfig:e,isMuted:t,volume:i,visible:n=!0,className:s="",onToggleMute:r,onVolumeChange:a})=>{const{position:o,size:l,volumeControl:u}=e,c="top-left"===o||"bottom-left"===o?"right":"left";if(!n)return null;const d=he.useMemo(()=>{switch(o){case"top-left":return Xx;case"top-right":default:return Zx;case"bottom-left":return Jx;case"bottom-right":return eD}},[o]);return xd.jsxs("div",{className:`${$x} ${d} ${s}`.trim(),style:{height:`${l}px`},children:[xd.jsx("div",{className:tD,onClick:e=>{e.stopPropagation(),r()},style:{height:`${l}px`},children:xd.jsx("img",{src:t?"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cmask%20id='A'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%20mask-type='alpha'%3e%3cpath%20fill='%23d9d9d9'%20d='M0%200h24v24H0z'/%3e%3c/mask%3e%3cg%20mask='url(%23A)'%3e%3cpath%20d='M19.801%2022.601l-3.025-3.025a8.31%208.31%200%200%201-1.325.688%209.48%209.48%200%200%201-1.45.462v-2.05l.688-.25c.225-.083.438-.183.637-.3l-3.325-3.325v5.2l-5-5h-4v-6h3.2l-4.8-4.8%201.4-1.4%2018.4%2018.4-1.4%201.4zm-.2-5.8l-1.45-1.45c.283-.517.496-1.058.638-1.625a7.19%207.19%200%200%200%20.212-1.75%206.86%206.86%200%200%200-1.375-4.2c-.917-1.233-2.125-2.067-3.625-2.5v-2.05c2.067.467%203.75%201.512%205.05%203.137s1.95%203.496%201.95%205.613c0%20.883-.121%201.733-.363%202.55s-.587%201.575-1.037%202.275zm-3.35-3.35l-2.25-2.25v-3.25a4.15%204.15%200%200%201%201.838%201.65c.442.733.662%201.533.662%202.4a4.34%204.34%200%200%201-.062.738%204.28%204.28%200%200%201-.187.712zm-4.25-4.25l-2.6-2.6%202.6-2.6v5.2zm-2%205.95v-2.35l-1.8-1.8h-3.2v2h2.85l2.15%202.15z'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cmask%20id='A'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%20mask-type='alpha'%3e%3cpath%20fill='%23d9d9d9'%20d='M0%200h24v24H0z'/%3e%3c/mask%3e%3cg%20mask='url(%23A)'%3e%3cpath%20d='M14%2020.727v-2.05c1.5-.433%202.708-1.267%203.625-2.5S19%2013.543%2019%2011.977s-.458-2.967-1.375-4.2S15.5%205.71%2014%205.277v-2.05c2.067.467%203.75%201.513%205.05%203.138S21%209.86%2021%2011.977s-.65%203.988-1.95%205.612-2.983%202.671-5.05%203.138zM3%2015.002v-6h4l5-5v16l-5-5H3zm11%201v-8.05a4.15%204.15%200%200%201%201.838%201.65c.442.733.662%201.533.662%202.4%200%20.85-.221%201.637-.662%202.363S14.783%2015.635%2014%2016.002zm-4-7.15l-2.15%202.15H5v2h2.85l2.15%202.15v-6.3z'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e",alt:"Volume control"})}),u&&xd.jsx("div",{className:`${iD} ${"left"===c?sD:rD}`,onClick:e=>e.stopPropagation(),style:{height:`${l}px`,borderRadius:`${l}px`},children:xd.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:i,onChange:e=>{const i=parseFloat(e.target.value)||1;t&&r(),a(i)},className:nD,onClick:e=>e.stopPropagation()})})]})},oD="_historyButton_1xf6c_1",lD="_tooltip_1xf6c_39",uD="_tooltipArrow_1xf6c_59",cD=({historyUIConfig:e,show:t=!1,onOpenHistory:i,className:n=""})=>{const{enabled:s,buttonSize:r,buttonColor:a,tooltipText:o,tooltipTextSize:l,tooltipTextColor:u,tooltipBackgroundColor:c,tooltipTimeout:d}=e,[h,f]=he.useState(!1),g=he.useRef(null);he.useEffect(()=>{t&&s?(f(!0),g.current&&clearTimeout(g.current),g.current=window.setTimeout(()=>{f(!1),g.current=null},d)):(f(!1),g.current&&(clearTimeout(g.current),g.current=null))},[t,s,d]),he.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);if(!s||!t)return null;const m=.6*r;return xd.jsxs("button",{className:`${oD} ${n}`.trim(),onClick:()=>{i&&i()},"aria-label":"Open history",style:{width:`${r}px`,height:`${r}px`,backgroundColor:a},children:[xd.jsx("img",{src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='33'%20height='32'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cmask%20id='A'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='33'%20height='32'%20mask-type='alpha'%3e%3cpath%20fill='%23d9d9d9'%20d='M.5%200h32v32H.5z'/%3e%3c/mask%3e%3cg%20mask='url(%23A)'%3e%3cpath%20d='M16.5%2018.001l8-5.333-8-5.333v10.667zM8.1%2029.168a2.5%202.5%200%200%201-1.983-.517A2.56%202.56%200%200%201%205.1%2026.868L3.334%2012.301c-.089-.733.089-1.389.533-1.967s1.033-.911%201.767-1l1.533-.2v10.867c0%201.467.522%202.722%201.567%203.767s2.3%201.567%203.767%201.567h12.4c-.133.533-.4.995-.8%201.383s-.889.617-1.467.683L8.1%2029.168zm4.4-6.5c-.733%200-1.361-.261-1.883-.783s-.783-1.15-.783-1.883V5.335c0-.733.261-1.361.783-1.883s1.15-.783%201.883-.783h14.667c.733%200%201.361.261%201.883.783s.783%201.15.783%201.883v14.667c0%20.733-.261%201.361-.783%201.883s-1.15.783-1.883.783H12.5z'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e",alt:"History",style:{width:`${m}px`,height:`${m}px`}}),h&&o&&xd.jsxs("span",{className:lD,style:{fontSize:`${l}px`,backgroundColor:c,color:u},children:[(o??"").replace(/<br>/g,"\n"),xd.jsx("span",{className:uD,style:{backgroundColor:c}})]})]})},dD="_drawerOverlay_1eftt_2",hD="_drawerOverlayScoped_1eftt_16",fD="_drawerOverlayVisible_1eftt_24",gD="_drawer_1eftt_2",mD="_drawerScoped_1eftt_48",pD="_drawerOpen_1eftt_55",vD="_drawerHandle_1eftt_60",yD="_drawerContent_1eftt_202",AD="_drawerCloseButton_1eftt_210",ED="_drawerCloseIcon_1eftt_255",bD=({isOpen:e,onClose:t,height:i="50%",maxHeight:n,showHandle:s=!0,showCloseButton:r=!0,className:a="",closeButtonText:o="Close",handleEscKey:l=!0,lockBodyScroll:u=!0,scoped:c=!1,children:d})=>{const h=he.useRef(null),f=he.useRef(null),[g,m]=he.useState(!1);he.useEffect(()=>{e?requestAnimationFrame(()=>{m(!0)}):m(!1)},[e]);const p=e=>{if(!e||e===document.body)return null;const t=e.parentElement;if(!t)return null;const i=window.getComputedStyle(t);return"auto"===i.overflow||"scroll"===i.overflow||"auto"===i.overflowY||"scroll"===i.overflowY||t.scrollHeight>t.clientHeight?t:p(t)};he.useEffect(()=>{if(!u||c)return;const i=i=>{"Escape"===i.key&&e&&t()};if(e){document.addEventListener("keydown",i);const e=(h.current?p(h.current):null)||document.body,t=(()=>{var e;const t=document.createElement("div");t.style.visibility="hidden",t.style.overflow="scroll",t.style.msOverflowStyle="scrollbar",document.body.appendChild(t);const i=document.createElement("div");t.appendChild(i);const n=t.offsetWidth-i.offsetWidth;return null==(e=t.parentNode)||e.removeChild(t),n})(),n=window.getComputedStyle(e).paddingRight,s=parseInt(n,10)||0,r=e.style.overflow,a=e.style.paddingRight;return e.style.overflow="hidden",e===document.body&&(e.style.paddingRight=`${s+t}px`),()=>{document.removeEventListener("keydown",i),e.style.overflow=r,e.style.paddingRight=a}}return()=>{document.removeEventListener("keydown",i)}},[e,t,u]);const v={height:i,...n&&{maxHeight:n}},y=`${gD} ${c?mD:""} ${a} ${g?pD:""}`.trim(),A=`${dD} ${c?hD:""} ${g?fD:""}`.trim();return e?xd.jsxs(xd.Fragment,{children:[xd.jsx("div",{ref:f,className:A,onClick:e=>{e.target===f.current&&t()},"aria-hidden":!1}),xd.jsxs("div",{ref:h,className:y,style:v,"aria-hidden":!1,role:"dialog","aria-modal":"true",onKeyDown:e=>{l&&"Escape"===e.key&&t()},tabIndex:-1,children:[s&&xd.jsx("div",{className:vD}),xd.jsx("div",{className:yD,children:d}),r&&xd.jsxs("button",{className:AD,onClick:t,"aria-label":"Close drawer",children:[xd.jsx("img",{src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cmask%20id='A'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%20mask-type='alpha'%3e%3cpath%20fill='%23d9d9d9'%20d='M0%200h24v24H0z'/%3e%3c/mask%3e%3cg%20mask='url(%23A)'%3e%3cpath%20d='M6.4%2019L5%2017.6L10.6%2012L5%206.4L6.4%205L12%2010.6L17.6%205L19%206.4L13.4%2012L19%2017.6L17.6%2019L12%2013.4L6.4%2019Z'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e",alt:"Close",className:ED}),o]})]})]}):null},SD="_cardListContainer_zrmnf_2",TD="_summaryGridContainer_zrmnf_17",kD="_summaryGridItem_zrmnf_26",wD="_summaryGridItemClickable_zrmnf_34",ID="_gridPlaceholder_zrmnf_39",LD="_gridItemImage_zrmnf_51",CD="_summaryCardItem_zrmnf_58",RD="_summaryCardItemClickable_zrmnf_70",xD="_cardItemImage_zrmnf_75",DD="_cardItemPlaceholder_zrmnf_84",PD="_cardItemContent_zrmnf_98",MD="_cardItemTitle_zrmnf_107",OD="_cardItemPrice_zrmnf_116",BD=({cards:e,clickable:t=!1,padding:i="20px",layout:n="list",onCardClick:s,cardItemBackgroundColor:r,cardItemTextColor:a})=>{const o=(e,t,i)=>{s&&s(e,t,i)},l=r||"#F2F2F2",u=a||"#181818";return"grid"===n?xd.jsx("div",{className:TD,children:e.map((e,i)=>{const n="card"in e?e.card:e;if(!n)return null;const s="image"===n.type?n.imageUrl:n.summaryImage??n.videoThumbnail;return xd.jsx("div",{className:`${kD} ${t?wD:""}`,"data-card-id":n.id||"","data-card-url":n.url||"","data-card-position":n.position||"",onClick:t?()=>o(n.id,n.url,n.position):void 0,children:s?xd.jsx("img",{src:s,className:LD,alt:"Card image"}):xd.jsx("div",{className:ID,style:{background:l,color:u},children:"No image"})},n.id||i)})}):xd.jsx("div",{className:SD,style:{padding:"0"===i?"0":i},children:e.map((e,i)=>{const n="card"in e?e.card:e;if(!n)return null;const s="image"===n.type?n.imageUrl:n.summaryImage??n.videoThumbnail;return xd.jsxs("div",{className:`${CD} ${t?RD:""}`,style:{background:l,color:u},"data-card-id":n.id||"","data-card-url":n.url||"","data-card-position":n.position||"",onClick:t?()=>o(n.id,n.url,n.position):void 0,children:[s?xd.jsx("img",{src:s,className:xD,alt:"Card image"}):xd.jsx("div",{className:DD,children:"No image"}),xd.jsxs("div",{className:PD,children:[xd.jsx("h4",{className:MD,children:n.title||"Untitled"}),n.price&&xd.jsxs("p",{className:OD,children:[n.price," ",n.currency||""]})]})]},n.id||i)})})},FD={summaryContainer:"_summaryContainer_1gtok_3",summaryShareButtonFixed:"_summaryShareButtonFixed_1gtok_14",shareIcon:"_shareIcon_1gtok_47",summaryExplaination:"_summaryExplaination_1gtok_54",summaryTabs:"_summaryTabs_1gtok_71",summaryTab:"_summaryTab_1gtok_71",summaryTabActive:"_summaryTabActive_1gtok_91",summaryEmojiItem:"_summaryEmojiItem_1gtok_96",summaryEmojiItemActive:"_summaryEmojiItemActive_1gtok_103",summaryEmojiButton:"_summaryEmojiButton_1gtok_108",summaryEmojiButtonActive:"_summaryEmojiButtonActive_1gtok_124",summaryEmojiLike:"_summaryEmojiLike_1gtok_132",summaryEmojiLikeActive:"_summaryEmojiLikeActive_1gtok_136",summaryEmojiDislike:"_summaryEmojiDislike_1gtok_142",summaryEmojiDislikeActive:"_summaryEmojiDislikeActive_1gtok_146",summaryEmojiMaybe:"_summaryEmojiMaybe_1gtok_152",summaryEmojiMaybeActive:"_summaryEmojiMaybeActive_1gtok_156",summaryEmojiSeen:"_summaryEmojiSeen_1gtok_162",summaryEmojiSeenActive:"_summaryEmojiSeenActive_1gtok_166",summaryEmojiIcon:"_summaryEmojiIcon_1gtok_194",summaryEmojiLabel:"_summaryEmojiLabel_1gtok_201",summaryContent:"_summaryContent_1gtok_217",summaryPanel:"_summaryPanel_1gtok_226",summaryPanelActive:"_summaryPanelActive_1gtok_241",summaryEmptyState:"_summaryEmptyState_1gtok_246",summaryEmptyStateText:"_summaryEmptyStateText_1gtok_252",summaryExplainationRight:"_summaryExplainationRight_1gtok_259",summaryExplainationLeft:"_summaryExplainationLeft_1gtok_263",summaryExplainationUp:"_summaryExplainationUp_1gtok_267",summaryExplainationDown:"_summaryExplainationDown_1gtok_271"},_D=({cardsByDirection:e,navigationUIConfig:t,summaryUIConfig:i,onCardClick:n,onShareClick:s,visible:r=!0,className:a=""})=>{const o=t.options,{endCardType:l="list",explanationTexts:u={},tabsBackgroundColor:c="#f5f5f5",tabsBorderColor:d="#e0e0e0",cardItemBackgroundColor:h="#F2F2F2",cardItemTextColor:f="#181818",contentBackgroundColor:g="#ffffff",explanationVisible:m=!1}=i,[p,v]=he.useState(null),y={right:Hx,left:Vx,up:Gx,down:Qx},A=(e,t)=>`${FD.summaryEmojiButton} ${FD[`summaryEmoji${e.charAt(0).toUpperCase()+e.slice(1)}`]||""} ${t?FD.summaryEmojiButtonActive:""} ${t&&FD[`summaryEmoji${e.charAt(0).toUpperCase()+e.slice(1)}Active`]||""}`.trim(),E=he.useMemo(()=>[{key:"right",config:o.right},{key:"up",config:o.up},{key:"down",config:o.down},{key:"left",config:o.left}].filter(e=>e.config.enabled),[o]);he.useEffect(()=>{E.length>0&&null===p&&v(E[0].key)},[E]);const b=(e,t,i)=>{n&&n(e,t,i)};if(!r||0===E.length)return null;const S=100/E.length;return xd.jsxs("div",{className:`${FD.summaryContainer} ${a}`.trim(),children:[xd.jsx("div",{className:FD.summaryTabs,style:{backgroundColor:c,borderBottom:`1px solid ${d}`},children:E.map(e=>{const t=p===e.key,i={right:"like",left:"dislike",up:"maybe",down:"seen"}[e.key];return xd.jsx("div",{className:`${FD.summaryTab} ${t?FD.summaryTabActive:""}`,style:{width:`${S}%`,boxSizing:"border-box"},onClick:()=>v(e.key),children:xd.jsxs("div",{className:`${FD.summaryEmojiItem} ${t?FD.summaryEmojiItemActive:""}`,children:[xd.jsx("div",{className:A(i,t),children:xd.jsx("img",{src:y[e.key],alt:e.config.label,className:FD.summaryEmojiIcon})}),xd.jsx("span",{className:FD.summaryEmojiLabel,children:e.config.label})]})},e.key)})}),xd.jsx("div",{className:FD.summaryContent,style:{backgroundColor:g},children:E.map(t=>{const i=p===t.key,n=(s=t.key,e[s]||[]);var s;const r=(e=>{var t;return(null==(t=u[e])?void 0:t.replace(/\\A/g,"\n"))||""})(t.key);return xd.jsx("div",{className:`${FD.summaryPanel} ${i?FD.summaryPanelActive:""}`,"data-panel":t.key,children:0===n.length?xd.jsx("div",{className:FD.summaryEmptyState,style:{color:f},children:xd.jsx("h3",{className:FD.summaryEmptyStateText,children:"No cards"})}):xd.jsxs(xd.Fragment,{children:[r&&xd.jsx("div",{className:`${FD.summaryExplaination} ${FD[`summaryExplaination${t.key.charAt(0).toUpperCase()+t.key.slice(1)}`]||""}`,style:{display:m?"flex":"none",background:h,color:f},children:r}),xd.jsx(BD,{cards:n,clickable:!0,padding:"20px",layout:l,onCardClick:b,cardItemBackgroundColor:h,cardItemTextColor:f})]})},t.key)})}),s&&xd.jsx("button",{className:FD.summaryShareButtonFixed,onClick:()=>{if(!s)return;const t=e.right.map(e=>e.id).filter(e=>null!=e&&""!==e),i=e.up.map(e=>e.id).filter(e=>null!=e&&""!==e);s(t,i)},"aria-label":"Share",children:"share"})]})},ND="_historyDrawerContent_x0jj6_1",UD="_historyDrawerEmpty_x0jj6_15",jD="_historyDrawerEmptyHint_x0jj6_31",HD="_historyDrawer_x0jj6_1",VD=({isOpen:e,onClose:t,swipeHistory:i,getCardsByDirection:n,historyUIConfig:s,navigationUIConfig:r,summaryUIConfig:a,onCardClick:o,className:l="",scoped:u=!1})=>{const{drawerHeight:c,drawerMaxHeight:d,drawerCloseButtonText:h}=s,f=he.useMemo(()=>({right:n("right"),left:n("left"),up:n("up"),down:n("down")}),[n,i]),g=i.length>0;return xd.jsx(bD,{isOpen:e,onClose:t,height:`${c}%`,maxHeight:`${d}%`,showHandle:!0,showCloseButton:!0,closeButtonText:h,scoped:u,className:`${HD} ${l}`.trim(),children:xd.jsx("div",{className:ND,children:g?xd.jsx(_D,{cardsByDirection:f,navigationUIConfig:r,summaryUIConfig:a,onCardClick:o,visible:!0}):xd.jsxs("div",{className:UD,children:[xd.jsx("p",{children:"No swipe history yet"}),xd.jsx("p",{className:jD,children:"Swipe some cards to see them here"})]})})})},GD="_filtersButton_qio2f_1",QD="_filtersIcon_qio2f_63",KD=({filtersUIConfig:e,onClick:t,className:i=""})=>{const{enabled:n,buttonText:s,buttonColor:r,iconSize:a,textColor:o,showIcon:l}=e;if(!n)return null;const u={gap:l&&s?"8px":"0",background:r,color:o},c={width:`${a}px`,height:`${a}px`,color:o};return xd.jsxs("button",{className:`${GD} ${i}`.trim(),style:u,onClick:()=>{t&&t()},onFocus:e=>e.currentTarget.blur(),"aria-label":"Open filters",children:[l&&xd.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:QD,style:c,"aria-hidden":"true",children:xd.jsx("polygon",{points:"22,3 2,3 10,12.46 10,19 14,21 14,12.46"})}),s&&xd.jsx("span",{children:s})]})},zD="_content_hci8k_2",WD="_title_hci8k_7",qD="_categories_hci8k_17",YD="_pill_hci8k_25",$D="_noCategories_hci8k_40",XD=({isOpen:e,onClose:t,filtersUIConfig:i,categories:n=[],selectedCategories:s=[],onFilterChange:r,scoped:a=!1,className:o=""})=>{const{drawerCategoriesTitle:l,drawerCloseButtonText:u}=i,c=new Set(s),[d,h]=he.useState(null),f=e=>{const t=new Set(s);"all"===e?t.clear():t.has(e)?t.delete(e):t.add(e),r&&r(Array.from(t))},g=(e,t)=>{const i=d===e,n="all"===e&&0===c.size;return{background:t||n?"#007bff":i?"#e9ecef":"#f5f5f5",color:t||n?"white":"#666",border:"2px solid "+(t||n?"#0056b3":"transparent"),transform:i?"translateY(-1px)":"none"}};return xd.jsx(bD,{isOpen:e,onClose:t,height:"auto",maxHeight:"70%",className:o,showHandle:!0,showCloseButton:!0,closeButtonText:u,scoped:a,children:xd.jsxs("div",{className:zD,children:[xd.jsx("h3",{className:WD,children:l}),xd.jsx("div",{className:qD,children:0===n.length?xd.jsx("div",{className:$D,children:"No categories available"}):xd.jsxs(xd.Fragment,{children:[xd.jsx("div",{className:YD,style:g("all",0===c.size),onMouseEnter:()=>h("all"),onMouseLeave:()=>h(null),onClick:()=>f("all"),children:"All"}),n.map(e=>xd.jsx("div",{className:YD,style:g(e.id,c.has(e.id)),onMouseEnter:()=>h(e.id),onMouseLeave:()=>h(null),onClick:()=>f(e.id),children:e.name},e.id))]})})]})})},ZD="_cardsCounter_1h26d_1",JD=({cardsCounterUIConfig:e,currentCardIndex:t,totalCards:i,className:n=""})=>{const{enabled:s,text:r,textSize:a}=e;if(!s)return null;const o=Math.min(t+1,i);let l;return l=e.text.includes("{current}")||e.text.includes("{total}")?r.replace(/{current}/g,o.toString()).replace(/{total}/g,i.toString()):`${r} ${o} / ${i}`,xd.jsx("div",{className:`${ZD} ${n}`.trim(),style:{fontSize:a},children:l})},eP="_logo_1rzq2_1",tP=({logoUIConfig:e,visible:t,className:i=""})=>{const{enabled:n,url:s,size:r}=e;if(!n||!s||!t)return null;const a={...void 0!==r&&{width:`${r}px`}};return xd.jsx("img",{src:s,alt:"Logo",className:`${eP} ${i}`.trim(),style:a})},iP="_container_18bki_1",nP=({children:e,x:t,y:i,centered:n=!1,zIndex:s,className:r=""})=>{const a={...void 0!==t&&{left:"number"==typeof t?`${t}px`:t},...void 0!==i&&{top:"number"==typeof i?`${i}px`:i},...n&&{transform:"translate(-50%, -50%)"},...void 0!==s&&{zIndex:s}};return xd.jsx("div",{className:`${iP} ${r}`.trim(),style:a,children:e})},sP=he.createContext(void 0),rP=({children:e,dataService:t,finderId:i,backendUrl:n,data:s,initialCards:r=[],initialFinder:a=null,initialCategories:o=[]})=>{const l=he.useRef(!1),[u,c]=he.useState(()=>s?t.processApiResponse(s).cards:r),[d,h]=he.useState(()=>s?t.processApiResponse(s).finder:a),[f,g]=he.useState(()=>s?t.processApiResponse(s).categories:o),[m,p]=he.useState(!1),[v,y]=he.useState(null);he.useEffect(()=>{if(s){const e=t.processApiResponse(s);h(e.finder),c(e.cards),g(e.categories),p(!1),y(null),l.current=!0}},[s,t]);const A=he.useCallback(async()=>{if(i&&n){p(!0),y(null);try{const e=await t.loadFinderFromApi(i,n);h(e.finder),c(e.cards),g(e.categories)}catch(IP){const t=IP instanceof Error?IP.message:"Failed to load finder";y(t)}finally{p(!1),l.current=!0}}else y("finderId and backendUrl are required to load finder")},[t,i,n]);he.useEffect(()=>{s||A()},[A,s]);const E={cards:u,finder:d,categories:f,loading:m,error:v,isInitiallyLoaded:l.current,setCards:c,setFinder:h,setCategories:g,loadFinder:A};return xd.jsx(sP.Provider,{value:E,children:e})},aP=()=>{const e=he.useContext(sP);if(void 0===e)throw new Error("useData must be used within a DataProvider");return e},oP=he.createContext(void 0),lP=({children:e})=>{const{finder:t,isInitiallyLoaded:i}=aP(),[n,s]=he.useState(0),[r,a]=he.useState([]),[o,l]=he.useState(!1),[u,c]=he.useState(!0),[d,h]=he.useState(!1),[f,g]=he.useState(!1),[m,p]=he.useState(!0),[v,y]=he.useState(.5),[A,E]=he.useState(!0),[b,S]=he.useState([]),[T,k]=he.useState([]),[w,I]=he.useState([]);he.useEffect(()=>{i&&t&&y(t.initialVolume)},[i,t]);const L=he.useCallback((e,t)=>{a(i=>{const n=i.findIndex(e=>e.card.id&&t.id&&e.card.id===t.id);return[...-1!==n?i.filter((e,t)=>t!==n):i,{direction:e,card:t,timestamp:Date.now()}]})},[]),C=he.useCallback(()=>{a([])},[]),R=he.useCallback(e=>r.filter(t=>t.direction===e).map(e=>e.card),[r]),x=he.useCallback(()=>{p(e=>!e)},[]),D=he.useCallback(e=>{y(e)},[]),P=he.useCallback(e=>{setTimeout(()=>{E(!0)},e)},[]),M=he.useCallback(e=>{S(e),k(e),I([])},[]);he.useEffect(()=>{let e;e=0===w.length?[...b]:b.filter(e=>e.categoryIds&&e.categoryIds.some(e=>w.includes(e))),k(e),b.length>0&&s(0)},[w,b]);const O={currentCardIndex:n,swipeHistory:r,isAnimating:o,demoActive:u,noMoreCards:d,userHasInteracted:f,isMuted:m,volume:v,logoVisible:A,allCards:b,filteredCards:T,selectedCategories:w,setCurrentCardIndex:s,addSwipeToHistory:L,clearSwipeHistory:C,setIsAnimating:l,setDemoActive:c,setNoMoreCards:h,setUserHasInteracted:g,getCardsByDirection:R,setIsMuted:p,setVolume:D,toggleMute:x,showLogo:P,setCards:M,setSelectedCategories:I};return xd.jsx(oP.Provider,{value:O,children:e})},uP=()=>{const e=he.useContext(oP);if(void 0===e)throw new Error("useAppState must be used within an AppStateProvider");return e},cP=he.createContext(void 0),dP=({children:e,monitorService:t,finderId:i})=>{const[n]=he.useState(()=>crypto.randomUUID()),s=he.useRef({}),[r,a]=he.useState(!1),o=he.useRef([]),l=he.useCallback(()=>{const e=[...o.current];o.current=[],e.forEach(e=>{t.sendEvent({sessionId:n,finderId:i,event:e.event,cardId:e.cardId,cardViewDuration:e.cardViewDuration,direction:e.direction})})},[t,n,i]),u=he.useCallback(()=>{!r&&o.current.length>0&&l(),a(!0)},[r,l]),c=he.useCallback(e=>{r?t.sendEvent({sessionId:n,finderId:i,event:e.event,cardId:e.cardId,cardViewDuration:e.cardViewDuration,direction:e.direction}):o.current.push({...e,finderId:i,timestamp:Date.now()})},[t,n,r]),d=he.useCallback(()=>{i&&c({event:"impression"})},[i,c]),h=he.useCallback(e=>{i&&(s.current[e]=Date.now(),c({event:"impression",cardId:e}))},[i,c]),f=he.useCallback(e=>{s.current[e]=Date.now()},[]),g=he.useCallback((e,t)=>{if(i){let i=0;s.current[e]&&(i=(Date.now()-s.current[e])/1e3,delete s.current[e]),c({event:"swipe",cardId:e,direction:t,cardViewDuration:Math.round(i)})}},[i,c]),m=he.useCallback(e=>{i&&c({event:"click",cardId:e})},[i,c]),p=he.useCallback(()=>{i&&c({event:"click"})},[i,c]),v=he.useMemo(()=>({sessionId:n,sendImpressionEvent:h,sendSwipeEvent:g,sendClickEvent:m,sendButtonClickEvent:p,sendCreativeImpressionEvent:d,startCardImpression:f,setConsentGranted:u}),[n,h,g,m,p,d,f,u]);return xd.jsx(cP.Provider,{value:v,children:e})},hP="_interactiveFeed_1wsuw_1",fP=({cards:e,categories:t=[],finderUiConfig:i,buttonStyle:n="vertical-emojis",maxVisibleCards:s=2,volumeControlUIConfig:r,historyUIConfig:a,onOpenHistory:o,onHistoryCardClick:l,filtersUIConfig:u,onFilterChange:c,onAllCardsSwiped:d,onCardSwiped:h,initialMuted:f=!0,cardsCounterUIConfig:g,navigationUIConfig:m,summaryUIConfig:p,logoUIConfig:v,className:y="",id:A})=>{const{currentCardIndex:E,setCurrentCardIndex:b,swipeHistory:S,getCardsByDirection:T,isMuted:k,volume:w,toggleMute:I,setVolume:L,showLogo:C,logoVisible:R,filteredCards:x,selectedCategories:D,setCards:P,setSelectedCategories:M,addSwipeToHistory:O,setIsAnimating:B,isAnimating:F,setNoMoreCards:_}=uP(),{sendSwipeEvent:N,sendImpressionEvent:U,startCardImpression:j}=(()=>{const e=he.useContext(cP);if(void 0===e)throw new Error("useMonitoring must be used within a MonitoringProvider");return e})();he.useEffect(()=>{(null==v?void 0:v.url)&&v.autoHideTimeout>0&&C(v.autoHideTimeout)},[v,C]),he.useEffect(()=>{P(e)},[e,P]);const[H,V]=he.useState(!1),[G,Q]=he.useState(!1),K=he.useCallback(e=>{M(e),c&&c(e)},[M,c]),z=he.useMemo(()=>E>0,[E]),W=he.useMemo(()=>t,[t]),q=he.useCallback(()=>{V(!0),o&&o()},[o]),Y=he.useCallback(()=>{V(!1)},[]),$=he.useCallback(()=>{Q(!0)},[]),X=he.useCallback(()=>{Q(!1)},[]);return xd.jsxs("div",{className:hP,children:[xd.jsx(Yx,{cards:x,finderUiConfig:i,buttonStyle:n,maxVisibleCards:s,isMuted:k,volume:w,currentCardIndex:E,setCurrentCardIndex:b,addSwipeToHistory:O,setIsAnimating:B,isAnimating:F,setNoMoreCards:_,sendSwipeEvent:N,sendImpressionEvent:U,startCardImpression:j,onAllCardsSwiped:d,onCardSwiped:h,id:A}),r.enabled&&xd.jsx(aD,{volumeControlUIConfig:r,isMuted:k,volume:w,onToggleMute:I,onVolumeChange:L}),a.enabled&&xd.jsx(nP,{x:`${a.buttonLeftPosition}%`,y:100-a.buttonBottomPosition+"%",centered:!0,zIndex:1e3,children:xd.jsx(cD,{historyUIConfig:a,show:z,onOpenHistory:q})}),u.enabled&&xd.jsx(nP,{x:`${u.buttonLeftPosition}%`,y:100-u.buttonBottomPosition+"%",centered:50===u.buttonLeftPosition,zIndex:1e3,children:xd.jsx(KD,{filtersUIConfig:u,onClick:$})}),u.enabled&&xd.jsx(XD,{isOpen:G,onClose:X,filtersUIConfig:u,categories:W,selectedCategories:D,onFilterChange:K,scoped:!0}),a.enabled&&xd.jsx(VD,{isOpen:H,onClose:Y,swipeHistory:S,getCardsByDirection:T,historyUIConfig:a,navigationUIConfig:m,summaryUIConfig:p,onCardClick:l,scoped:!0}),g.enabled&&xd.jsx(nP,{x:`${g.positionLeft}%`,y:100-g.positionBottom+"%",zIndex:100,children:xd.jsx(JD,{cardsCounterUIConfig:g,currentCardIndex:E,totalCards:x.length})}),v.enabled&&xd.jsx(nP,{x:`${v.positionX}%`,y:`${v.positionY}%`,centered:!0,zIndex:100,children:xd.jsx(tP,{logoUIConfig:v,visible:R})})]})},gP="_swippingJourney_15509_1",mP=({summaryEnabled:e=!0,finderUiConfig:t,onSummaryCardClick:i,onSummaryShareClick:n,onAllCardsSwiped:s})=>{const{cards:r,finder:a,categories:o}=aP(),{noMoreCards:l,getCardsByDirection:u,swipeHistory:c}=uP(),[d,h]=he.useState(!1),f=t??a,g=he.useCallback(()=>{s&&s(),e&&h(!0)},[s,e]);he.useEffect(()=>{h(!(!l||!e))},[l,e]);const m=he.useMemo(()=>({right:u("right"),left:u("left"),up:u("up"),down:u("down")}),[u,c]);return f?d&&e?xd.jsx("div",{className:gP,children:xd.jsx(_D,{cardsByDirection:m,navigationUIConfig:f.navigation,summaryUIConfig:f.summary,onCardClick:i,onShareClick:n,visible:!0})}):xd.jsx("div",{className:gP,children:xd.jsx(fP,{cards:r,finderUiConfig:f,categories:o,historyUIConfig:f.history,filtersUIConfig:f.filters,volumeControlUIConfig:f.volumeControl,cardsCounterUIConfig:f.cardsCounter,navigationUIConfig:f.navigation,summaryUIConfig:f.summary,logoUIConfig:f.logo,onAllCardsSwiped:g})}):null},pP="_mainBootstrap_1rzog_1";var vP,yP={exports:{}};vP=yP,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var s=arguments[t];s&&(e=n(e,i(s)))}return e}function i(i){if("string"==typeof i||"number"==typeof i)return i;if("object"!=typeof i)return"";if(Array.isArray(i))return t.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var r in i)e.call(i,r)&&i[r]&&(s=n(s,r));return s}function n(e,t){return t?e?e+" "+t:e+t:e}vP.exports?(t.default=t,vP.exports=t):window.classNames=t}();const AP=R(yP.exports),EP=he.createContext(void 0),bP=({children:e})=>{const[t,i]=he.useState(!1),[n,s]=he.useState(!1),[r,a]=he.useState(!1),[o,l]=he.useState([]),[u,c]=he.useState(!0),d={buttonsVisible:t,summaryVisible:n,ctaTooltipVisible:r,selectedCategories:o,logoVisible:u,showButtons:he.useCallback(()=>{i(!0)},[]),hideButtons:he.useCallback(()=>{i(!1)},[]),showSummary:he.useCallback(()=>{s(!0)},[]),hideSummary:he.useCallback(()=>{s(!1)},[]),showCtaTooltip:he.useCallback(()=>{a(!0)},[]),hideCtaTooltip:he.useCallback(()=>{a(!1)},[]),setSelectedCategories:l,toggleLogo:he.useCallback(e=>{c(e)},[])};return xd.jsx(EP.Provider,{value:d,children:e})},SP=({children:e,monitorService:t,dataService:i,backendUrl:n,finderId:s,data:r})=>xd.jsx(rP,{dataService:i,finderId:s,backendUrl:n,data:r,children:xd.jsx(lP,{children:xd.jsx(bP,{children:xd.jsx(dP,{monitorService:t,finderId:s,children:e})})})}),TP=({monitorService:e,dataService:t,backendUrl:i,finderId:n,className:s="",data:r})=>xd.jsx("div",{className:AP(pP,s),children:xd.jsx(SP,{monitorService:e,dataService:t,backendUrl:i,finderId:n,data:r,children:xd.jsx(mP,{})})});class kP{getMonitorUrl(){if("undefined"==typeof window)throw new Error("window is not available");if(!window.SWIPEFINDER_CAMPAIGN_MONITOR_URL)throw new Error("SWIPEFINDER_CAMPAIGN_MONITOR_URL is not set");return window.SWIPEFINDER_CAMPAIGN_MONITOR_URL}sendEvent(e){try{const t=this.getMonitorUrl();fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({finder_id:e.finderId,event_type:e.event,session_id:e.sessionId,card_id:e.cardId,card_view_duration:e.cardViewDuration,swipe_direction:e.direction})}).catch(e=>{})}catch(t){}}}class wP{processApiResponse(e){return{finder:e.finder,cards:(t=e.cards.items,t.map(e=>{if("image"===e.type){const{image:t,...i}=e;return{...i,imageUrl:t||e.imageUrl||""}}if("video"===e.type){const{video:t,...i}=e;return{...i,videoUrl:t||e.videoUrl||""}}return e})),categories:e.categories};var t}async loadFinderFromApi(e,t){try{const i=`${t}/api/finders/${e}/queue`,n=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({categories:[],exclude:[]})});if(!n.ok)throw new Error(`API returned status: ${n.status}`);const s=await n.json();return this.processApiResponse(s)}catch(i){return{finder:null,cards:[],categories:[]}}}}e.initSwipeFinder=function(e){const{backendUrl:t,finderId:i,element:n,data:s,...r}=e;if(!(n&&n instanceof HTMLElement))throw new Error("Invalid element provided. Must be an HTMLElement.");const a=new kP,o=new wP,l=Ad(n);return l.render(fe.createElement(TP,{monitorService:a,dataService:o,backendUrl:t,finderId:i,data:s,...r})),()=>{l.unmount()}},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ (function(){if(typeof document!=="undefined"){var s=document.createElement("style");s.textContent="._card_doqsx_2{position:absolute;width:100%;height:100%;left:0;top:0;background-color:#fff;box-shadow:0 2px 8px #0003;overflow:hidden;transition:transform .3s ease;cursor:default;transform-origin:50% 100%;will-change:transform;z-index:1}._cardContent_doqsx_18{position:absolute;z-index:2;bottom:0;left:0;width:100%;height:100%;color:#fff}._gradientBottom_doqsx_29{position:absolute;z-index:1;bottom:0;left:0;width:100%;height:120px;background:linear-gradient(transparent,#000);pointer-events:none}._gradientTop_doqsx_41{position:absolute;z-index:1;top:0;left:0;width:100%;height:120px;background:linear-gradient(rgba(0,0,0,1),transparent);pointer-events:none}._cardName_doqsx_52{position:absolute;left:0;bottom:10%;font-weight:700;font-size:22px;padding:0 20px;text-shadow:1px 1px 2px rgba(0,0,0,.8);width:100%;text-align:left;white-space:pre-wrap}._image_trs4h_2{width:100%;height:100%;object-fit:cover}._videoContainer_119iz_3{width:100%;height:100%;position:relative;overflow:hidden}._cardVideo_119iz_10{width:100%;height:100%;object-fit:cover;position:absolute;top:0;left:0;z-index:1}._swipeableCard_14c6z_1{position:relative;width:100%;height:100%;will-change:transform,opacity;backface-visibility:hidden;-webkit-backface-visibility:hidden;touch-action:none;user-select:none;-webkit-user-select:none;pointer-events:auto}._swipeableCard_14c6z_1>*{pointer-events:none}._swipeableCard_14c6z_1 video,._swipeableCard_14c6z_1 img{pointer-events:none}._swipeHeadline_14c6z_25{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:24px;font-weight:700;color:#fff;z-index:200000}._ctaTooltip_1mai4_2{position:absolute;z-index:110;font-size:12px;top:0;right:-2px;background-color:#fff;color:#333;padding:10px 14px;border-radius:8px;font-weight:800;text-align:center;width:max-content;transition:opacity .3s ease;pointer-events:none;animation:_ctaTooltipBounce_1mai4_1 2s infinite;box-shadow:0 0 16px 1px #000;white-space:pre-line}._ctaTooltipArrow_1mai4_22{position:absolute;bottom:-8px;width:16px;height:16px;transform:translate(50%) rotate(45deg);z-index:0}@keyframes _ctaTooltipBounce_1mai4_1{0%,20%,50%,80%,to{transform:translateY(calc(-100% - 16px))}40%{transform:translateY(calc(-100% - 24px))}60%{transform:translateY(calc(-100% - 20px))}}._verticalEmojisButtons_14t5d_2{position:absolute;display:flex;flex-direction:column;align-items:center;z-index:100}._buttonContainer_14t5d_11{display:flex;flex-direction:column;align-items:center;justify-content:center;margin:8px 0}._button_14t5d_11{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 2px 5px #0003;background-color:#fff;position:relative;-webkit-user-select:none;user-select:none;transition:transform .2s ease,background-color .2s ease;outline:none;border:none;-webkit-tap-highlight-color:transparent}._button_14t5d_11:focus,._button_14t5d_11:active{outline:none;border:none}._emojiIcon_14t5d_45{width:35px;height:35px;display:block;outline:none;pointer-events:none;position:relative;z-index:2}._buttonLabel_14t5d_56{white-space:pre-wrap;margin-top:5px}._buttonAnimation_14t5d_62{transform:scale(1.3);z-index:101;position:relative}._buttonAnimation_14t5d_62:before{content:\"\";position:absolute;top:-5px;left:-5px;right:-5px;bottom:-5px;border-radius:50%;border:5px solid rgba(255,255,255,.5);z-index:1}._buttonLikeAnimation_14t5d_80{background-color:#4cd964!important;transform:scale(1.3)!important}._buttonDislikeAnimation_14t5d_85{background-color:#ff3b30!important;transform:scale(1.3)!important}._buttonMaybeAnimation_14t5d_90{background-color:#fc0!important;transform:scale(1.3)!important}._buttonSeenAnimation_14t5d_95{background-color:#007aff!important;transform:scale(1.3)!important}._contrastMode_14t5d_101 ._buttonContainer_14t5d_11{display:flex;flex-direction:column;align-items:center;justify-content:center;margin:8px 0}._contrastModeButton_14t5d_109{background-color:#fffc!important;border:2px solid black!important;box-shadow:0 0 8px #00000080!important}._contrastModeButton_14t5d_109:hover{background-color:#fff!important}._contrastModeLabel_14t5d_119{color:#fff!important;text-shadow:1px 1px 3px black,-1px -1px 3px black,1px -1px 3px black,-1px 1px 3px black!important;font-weight:700!important;font-size:12px!important;text-align:center!important;display:block!important;margin-top:5px!important;text-transform:uppercase}._contrastModeLike_14t5d_130,._contrastModeDislike_14t5d_135,._contrastModeMaybe_14t5d_140,._contrastModeSeen_14t5d_145{color:#fff!important;filter:brightness(1.5)!important}._sideButtonsContainer_jjr9u_2{position:absolute;width:100%;height:100%;left:0;top:0;display:flex;justify-content:center;align-items:center;z-index:100;pointer-events:none}._sideButtonsWrapper_jjr9u_16{position:relative;width:100%;height:100%;display:grid;grid-template-columns:1fr auto 1fr;grid-template-rows:auto 1fr auto;padding:15px;box-sizing:border-box}._sideButtonContainer_jjr9u_28{display:flex;align-items:center;flex-direction:column;gap:4px}._sideButtonLeft_jjr9u_36{grid-column:1;grid-row:2;margin-right:auto;justify-self:start;align-self:center}._sideButtonRight_jjr9u_45{grid-column:3;grid-row:2;margin-left:auto;justify-self:end;align-self:center}._sideButtonTop_jjr9u_54{grid-column:2;grid-row:1;justify-self:center;align-self:start}._sideButtonBottom_jjr9u_62{grid-column:2;grid-row:3;justify-self:center;align-self:end}._sideButton_jjr9u_2{border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px solid rgba(255,255,255,.4);background-color:#ffffffb3;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);box-shadow:0 4px 12px #0000004d;transition:all .3s ease;-webkit-tap-highlight-color:transparent;pointer-events:auto;padding:0;margin:0;gap:4px}._sideButton_jjr9u_2:hover{border-color:#fff;background-color:#ffffffe6}._buttonContent_jjr9u_95{position:relative;display:flex;align-items:center;justify-content:center}._arrowWrapper_jjr9u_103,._emojiWrapper_jjr9u_104{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center}._arrowWrapper_jjr9u_103 svg{color:#000}._arrowRight_jjr9u_120{transform:rotate(0)}._arrowLeft_jjr9u_124{transform:rotate(180deg)}._arrowUp_jjr9u_128{transform:rotate(-90deg)}._arrowDown_jjr9u_132{transform:rotate(90deg)}._emojiIcon_jjr9u_137{pointer-events:none;user-select:none;-webkit-user-select:none}._buttonLabel_jjr9u_144{white-space:pre-wrap;text-align:center;color:#000;font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.1em;line-height:1.2;user-select:none;-webkit-user-select:none;margin-top:0}@keyframes _moveRight_jjr9u_1{0%{transform:rotate(0) translate(0);opacity:.7}10%{transform:rotate(0) translate(6px);opacity:1}15%{transform:rotate(0) translate(12px);opacity:1}20%{transform:rotate(0) translate(12px);opacity:1}25%{transform:rotate(0) translate(0);opacity:.7}25.01%,to{transform:rotate(0) translate(0);opacity:.7}}@keyframes _moveLeft_jjr9u_1{0%,24.99%{transform:rotate(180deg) translate(0);opacity:.7}25%{transform:rotate(180deg) translate(0);opacity:.7}35%{transform:rotate(180deg) translate(6px);opacity:1}40%{transform:rotate(180deg) translate(12px);opacity:1}45%{transform:rotate(180deg) translate(12px);opacity:1}50%{transform:rotate(180deg) translate(0);opacity:.7}50.01%,to{transform:rotate(180deg) translate(0);opacity:.7}}@keyframes _moveUp_jjr9u_1{0%,49.99%{transform:rotate(-90deg) translate(0);opacity:.7}50%{transform:rotate(-90deg) translate(0);opacity:.7}60%{transform:rotate(-90deg) translate(6px);opacity:1}65%{transform:rotate(-90deg) translate(12px);opacity:1}70%{transform:rotate(-90deg) translate(12px);opacity:1}75%{transform:rotate(-90deg) translate(0);opacity:.7}75.01%,to{transform:rotate(-90deg) translate(0);opacity:.7}}@keyframes _moveDown_jjr9u_1{0%,74.99%{transform:rotate(90deg) translate(0);opacity:.7}75%{transform:rotate(90deg) translate(0);opacity:.7}85%{transform:rotate(90deg) translate(6px);opacity:1}90%{transform:rotate(90deg) translate(12px);opacity:1}95%{transform:rotate(90deg) translate(12px);opacity:1}to{transform:rotate(90deg) translate(0);opacity:.7}}._sideButton_jjr9u_2.like-btn ._arrowWrapper_jjr9u_103 svg._arrowRight_jjr9u_120{animation:_moveRight_jjr9u_1 8s infinite}._sideButton_jjr9u_2.dislike-btn ._arrowWrapper_jjr9u_103 svg._arrowLeft_jjr9u_124{animation:_moveLeft_jjr9u_1 8s infinite}._sideButton_jjr9u_2.maybe-btn ._arrowWrapper_jjr9u_103 svg._arrowUp_jjr9u_128{animation:_moveUp_jjr9u_1 8s infinite}._sideButton_jjr9u_2.seen-btn ._arrowWrapper_jjr9u_103 svg._arrowDown_jjr9u_132{animation:_moveDown_jjr9u_1 8s infinite}._horizontalCtaTooltip_1slua_1{position:absolute;transform:translate(-50%) translateY(-25%);left:50%;padding:10px 15px;border-radius:6px;font-weight:500;text-align:center;z-index:100;transition:opacity .3s ease;box-shadow:0 2px 8px #0003;animation:_horizontalCtaTooltipPulse_1slua_1 2s infinite ease-in-out;white-space:pre-line;background-color:#fff;color:#333;font-size:12px}._contrastMode_1slua_19 ._horizontalCtaTooltip_1slua_1{background-color:#00000080;color:#fff;border:1px solid white;font-weight:600}@keyframes _horizontalCtaTooltipPulse_1slua_1{0%{transform:translate(-50%) translateY(-25%) scale(1)}50%{transform:translate(-50%) translateY(-25%) scale(1.1)}to{transform:translate(-50%) translateY(-25%) scale(1)}}._sideButtonsContainer_1kkly_2{position:absolute;width:100%;height:100%;left:0;top:0;display:flex;justify-content:center;align-items:center;z-index:100;pointer-events:none}._sideButtonsWrapper_1kkly_16{position:relative;width:100%;height:100%;display:grid;grid-template-columns:1fr auto 1fr;grid-template-rows:auto 1fr auto;padding:15px;box-sizing:border-box}._sideButtonContainer_1kkly_28{display:flex;align-items:center;flex-direction:column;gap:4px}._sideButtonLeft_1kkly_36{grid-column:1;grid-row:2;margin-right:auto;justify-self:start;align-self:center}._sideButtonRight_1kkly_45{grid-column:3;grid-row:2;margin-left:auto;justify-self:end;align-self:center}._sideButtonTop_1kkly_54{grid-column:2;grid-row:1;justify-self:center;align-self:start}._sideButtonBottom_1kkly_62{grid-column:2;grid-row:3;justify-self:center;align-self:end}._sideButton_1kkly_2{border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px solid rgba(255,255,255,.4);background-color:#ffffffb3;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);box-shadow:0 4px 12px #0000004d;transition:all .3s ease;-webkit-tap-highlight-color:transparent;pointer-events:auto;padding:0;margin:0;gap:4px;-webkit-touch-callout:none;-webkit-user-select:none;touch-action:manipulation;cursor:pointer}._sideButton_1kkly_2:hover{border-color:#fff;background-color:#ffffffe6}._buttonContent_1kkly_99{position:relative;display:flex;align-items:center;justify-content:center}._buttonContent_1kkly_99 svg{color:#000}._buttonLabel_1kkly_111{white-space:pre-wrap;text-align:center;color:#000;font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.1em;line-height:1.2;user-select:none;-webkit-user-select:none;margin-top:0}._arrowRight_1kkly_126{transform:rotate(0)}._arrowLeft_1kkly_130{transform:rotate(180deg)}._arrowUp_1kkly_134{transform:rotate(-90deg)}._arrowDown_1kkly_138{transform:rotate(90deg)}@keyframes _moveRight_1kkly_1{0%{transform:rotate(0) translate(0);opacity:.7}10%{transform:rotate(0) translate(6px);opacity:1}15%{transform:rotate(0) translate(12px);opacity:1}20%{transform:rotate(0) translate(12px);opacity:1}25%{transform:rotate(0) translate(0);opacity:.7}25.01%,to{transform:rotate(0) translate(0);opacity:.7}}@keyframes _moveLeft_1kkly_1{0%,24.99%{transform:rotate(180deg) translate(0);opacity:.7}25%{transform:rotate(180deg) translate(0);opacity:.7}35%{transform:rotate(180deg) translate(6px);opacity:1}40%{transform:rotate(180deg) translate(12px);opacity:1}45%{transform:rotate(180deg) translate(12px);opacity:1}50%{transform:rotate(180deg) translate(0);opacity:.7}50.01%,to{transform:rotate(180deg) translate(0);opacity:.7}}@keyframes _moveUp_1kkly_1{0%,49.99%{transform:rotate(-90deg) translate(0);opacity:.7}50%{transform:rotate(-90deg) translate(0);opacity:.7}60%{transform:rotate(-90deg) translate(6px);opacity:1}65%{transform:rotate(-90deg) translate(12px);opacity:1}70%{transform:rotate(-90deg) translate(12px);opacity:1}75%{transform:rotate(-90deg) translate(0);opacity:.7}75.01%,to{transform:rotate(-90deg) translate(0);opacity:.7}}@keyframes _moveDown_1kkly_1{0%,74.99%{transform:rotate(90deg) translate(0);opacity:.7}75%{transform:rotate(90deg) translate(0);opacity:.7}85%{transform:rotate(90deg) translate(6px);opacity:1}90%{transform:rotate(90deg) translate(12px);opacity:1}95%{transform:rotate(90deg) translate(12px);opacity:1}to{transform:rotate(90deg) translate(0);opacity:.7}}._sideButton_1kkly_2.like-btn ._buttonContent_1kkly_99 svg._arrowRight_1kkly_126{animation:_moveRight_1kkly_1 8s infinite}._sideButton_1kkly_2.dislike-btn ._buttonContent_1kkly_99 svg._arrowLeft_1kkly_130{animation:_moveLeft_1kkly_1 8s infinite}._sideButton_1kkly_2.maybe-btn ._buttonContent_1kkly_99 svg._arrowUp_1kkly_134{animation:_moveUp_1kkly_1 8s infinite}._sideButton_1kkly_2.seen-btn ._buttonContent_1kkly_99 svg._arrowDown_1kkly_138{animation:_moveDown_1kkly_1 8s infinite}._tooltipWrapper_1kkly_277{grid-column:2;grid-row:2;display:flex;align-items:center;justify-content:center}._swipeTutorialOverlay_jbb64_2{position:absolute;width:100%;height:100%;left:0;top:0;display:flex;justify-content:center;align-items:center;z-index:100;pointer-events:none}._handContainer_jbb64_16{display:flex;align-items:center;justify-content:center;pointer-events:none}._handIcon_jbb64_24{filter:drop-shadow(0 4px 8px rgba(0,0,0,.3));opacity:.9}._swipeableFeed_jamse_1{position:relative;width:100%;height:100%;overflow:hidden}._swipeableFeedCards_jamse_8{position:relative;width:100%;height:100%}._swipeableFeedCards_jamse_8>*{position:absolute;top:0;left:0;width:100%;height:100%}._swipeableFeedEmpty_jamse_22{display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:#666;font-size:16px;text-align:center}._swipeTutorialContainer_jamse_33{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:150}._volumeControl_r52gg_2{position:absolute;z-index:1100;display:flex;align-items:center;gap:8px;margin:0}._volumeControlTopLeft_r52gg_12{top:10px;left:10px}._volumeControlTopRight_r52gg_17{top:10px;right:10px;flex-direction:row-reverse}._volumeControlBottomLeft_r52gg_23{bottom:80px;left:15px}._volumeControlBottomRight_r52gg_28{bottom:80px;right:15px;flex-direction:row-reverse}._volumeControlButton_r52gg_34{width:auto;height:30px;cursor:pointer;background-color:#0006;border-radius:50%;transition:background-color .2s ease;display:flex;align-items:center;justify-content:center;padding:4px;box-sizing:border-box;flex-shrink:0}._volumeControlButton_r52gg_34:hover{background-color:#000000b3}._volumeControlButton_r52gg_34 img{width:100%;height:100%;object-fit:contain}._volumeSlider_r52gg_60{background-color:#0006;border-radius:20px;padding:8px 12px;display:flex;align-items:center;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);opacity:0;pointer-events:none;transition:opacity .2s ease}._volumeSlider_r52gg_60:hover{background-color:#000000b3}._volumeControl_r52gg_2:hover ._volumeSlider_r52gg_60{opacity:1;pointer-events:auto}._volumeSliderInput_r52gg_81{width:100px;height:4px;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#ffffff4d;border-radius:2px;outline:none;cursor:pointer}._volumeSliderInput_r52gg_81::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:12px;height:12px;border-radius:50%;background:#fff;cursor:pointer;transition:transform .1s ease}._volumeSliderInput_r52gg_81::-webkit-slider-thumb:hover{transform:scale(1.2)}._volumeSliderInput_r52gg_81::-moz-range-thumb{width:12px;height:12px;border-radius:50%;background:#fff;cursor:pointer;border:none;transition:transform .1s ease}._volumeSliderInput_r52gg_81::-moz-range-thumb:hover{transform:scale(1.2)}._historyButton_1xf6c_1{border-radius:50%;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:1000;box-shadow:16px 20px 8px #00000026,inset -4px -4px 10px #0003;background-image:linear-gradient(135deg,#fff3,#0003);outline:none;-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none}._historyCardsContent_1xf6c_17{margin:12px 0}._historyButton_1xf6c_1:focus{outline:none}._historyButton_1xf6c_1:active{outline:none;-webkit-tap-highlight-color:transparent}._historyButton_1xf6c_1:focus-visible{outline:none}._historyButton_1xf6c_1 img{pointer-events:none}._tooltip_1xf6c_39{display:flex;z-index:110;line-height:1.2;padding:10px 14px;position:absolute;top:0;border-radius:8px;font-weight:800;text-align:center;width:max-content;transition:opacity .3s ease;box-shadow:0 0 16px 1px #000;left:50%;white-space:pre-line;transform:translate(-50%) translateY(calc(-100% - 16px));animation:_historyButtonTooltipBounce_1xf6c_1 2s infinite}._tooltipArrow_1xf6c_59{position:absolute;bottom:-8px;left:50%;width:16px;height:16px;transform:translate(-50%) rotate(45deg);z-index:0}@keyframes _historyButtonTooltipBounce_1xf6c_1{0%,20%,50%,80%,to{transform:translate(-50%) translateY(calc(-100% - 16px))}40%{transform:translate(-50%) translateY(calc(-100% - 24px))}60%{transform:translate(-50%) translateY(calc(-100% - 20px))}}._drawerOverlay_1eftt_2{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#00000080;z-index:999;opacity:0;visibility:hidden;transition:opacity .5s ease,visibility .5s ease}._drawerOverlayScoped_1eftt_16{position:absolute;top:0;left:0;right:0;bottom:0}._drawerOverlayVisible_1eftt_24{opacity:1;visibility:visible}._drawer_1eftt_2{position:fixed;bottom:0;left:0;right:0;height:80%;background:#fff;border-radius:20px 20px 0 0;z-index:1000;transform:translateY(100%);transition:transform .6s cubic-bezier(.25,.46,.45,.94);box-shadow:0 -8px 32px #0003;display:flex;flex-direction:column;overflow:hidden}._drawerScoped_1eftt_48{position:absolute;bottom:0;left:0;right:0}._drawerOpen_1eftt_55{transform:translateY(0)}._drawerHandle_1eftt_60{width:40px;height:4px;background-color:#0003;border-radius:2px;margin:12px auto 8px;flex-shrink:0;transition:background-color .2s ease}._drawerHandle_1eftt_60:hover{background-color:#0000004d}._drawerEmojisContainer_1eftt_75{display:flex;justify-content:space-between;padding:16px 20px;border-bottom:1px solid rgba(0,0,0,.1);flex-shrink:0}._drawerEmojiItem_1eftt_84{display:flex;flex-direction:column;align-items:center;gap:8px}._drawerEmojiItemActive_1eftt_91 ._drawerEmojiLabel_1eftt_91{color:#000;font-weight:700}._drawerEmojiButton_1eftt_97{display:flex;align-items:center;justify-content:center;padding:0;border-radius:50%;background:#fffc;border:2px solid rgba(0,0,0,.2);cursor:pointer;transition:all .3s ease;width:50px;height:50px;box-shadow:0 2px 8px #00000026;-webkit-tap-highlight-color:transparent}._drawerEmojiButtonActive_1eftt_113{background:#fff;border:3px solid rgba(0,0,0,.6);box-shadow:0 4px 12px #00000040;transform:scale(1.1)}._drawerEmojiLikeActive_1eftt_125{border-color:#4caf50;background:#4caf5026;box-shadow:0 4px 12px #4caf504d}._drawerEmojiDislikeActive_1eftt_135{border-color:#f44336;background:#f4433626;box-shadow:0 4px 12px #f443364d}._drawerEmojiMaybeActive_1eftt_145{border-color:#ff9800;background:#ff980026;box-shadow:0 4px 12px #ff98004d}._drawerEmojiSeenActive_1eftt_155{border-color:#2196f3;background:#2196f326;box-shadow:0 4px 12px #2196f34d}._drawerEmojiIcon_1eftt_162{width:32px;height:32px;object-fit:contain}._drawerEmojiLabel_1eftt_91{font-size:11px;font-weight:600;color:#000c;text-align:center;line-height:1.2;text-transform:uppercase;letter-spacing:.5px;white-space:pre-wrap}._drawerEmojiLike_1eftt_121:hover{border-color:#4caf50;background:#4caf501a}._drawerEmojiDislike_1eftt_131:hover{border-color:#f44336;background:#f443361a}._drawerEmojiMaybe_1eftt_141:hover{border-color:#ff9800;background:#ff98001a}._drawerEmojiSeen_1eftt_151:hover{border-color:#2196f3;background:#2196f31a}._drawerContent_1eftt_202{flex:1;padding:20px;-webkit-overflow-scrolling:touch;overflow-y:auto}._drawerCloseButton_1eftt_210{background:linear-gradient(135deg,#ff6b6b,#ee5a52);color:#fff;border:none;padding:12px 24px;margin:20px;border-radius:25px;font-size:16px;font-weight:600;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;transition:all .3s ease;box-shadow:0 4px 16px #ff6b6b4d;outline:none;-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;align-self:center;min-height:48px;white-space:pre-wrap}._drawerCloseButton_1eftt_210:hover{transform:translateY(-2px);box-shadow:0 6px 20px #ff6b6b66}._drawerCloseButton_1eftt_210:active{transform:translateY(0);box-shadow:0 2px 8px #ff6b6b4d}._drawerCloseButton_1eftt_210:focus{outline:none}._drawerCloseButton_1eftt_210:focus-visible{outline:2px solid rgba(255,107,107,.5);outline-offset:2px}._drawerCloseIcon_1eftt_255{width:16px;height:16px;filter:brightness(0) invert(1)}@media (max-width: 768px){._drawer_1eftt_2{height:80%;border-radius:30px 30px 0 0}._drawerContent_1eftt_202{padding:16px}._drawerCloseButton_1eftt_210{margin:16px;padding:10px 20px;font-size:14px}}@media (max-width: 480px){._drawer_1eftt_2{height:80%;border-radius:30px 30px 0 0}._drawerContent_1eftt_202{padding:12px}._drawerCloseButton_1eftt_210{margin:12px;font-size:14px}}._cardListContainer_zrmnf_2{padding:20px;overscroll-behavior-y:contain;touch-action:pan-y;overflow-y:auto;height:100%;box-sizing:border-box}._cardListContainerNoPadding_zrmnf_11{padding:0;box-sizing:border-box}._summaryGridContainer_zrmnf_17{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:20px;box-sizing:border-box}._summaryGridItem_zrmnf_26{aspect-ratio:1;border-radius:8px;overflow:hidden;background:#0000000d;cursor:default}._summaryGridItemClickable_zrmnf_34{cursor:pointer}._gridPlaceholder_zrmnf_39{width:100%;height:100%;background:#f2f2f2;display:flex;align-items:center;justify-content:center;font-size:12px;color:#181818}._gridItemImage_zrmnf_51{width:100%;height:100%;object-fit:cover}._summaryCardItem_zrmnf_58{display:flex;gap:8px;padding:12px;border-radius:8px;background:#f2f2f2;color:#181818;margin-bottom:8px;align-items:center;cursor:default}._summaryCardItemClickable_zrmnf_70{cursor:pointer}._cardItemImage_zrmnf_75{width:60px;height:60px;border-radius:6px;object-fit:cover;flex-shrink:0}._cardItemPlaceholder_zrmnf_84{width:60px;height:60px;border-radius:6px;background:#d9d9d9;display:flex;align-items:center;justify-content:center;font-size:12px;color:#00000080;flex-shrink:0}._cardItemContent_zrmnf_98{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center}._cardItemTitle_zrmnf_107{margin:0 0 2px;font-size:14px;font-weight:600;line-height:1.2;text-align:left}._cardItemPrice_zrmnf_116{margin:0;font-size:12px;color:#000000b3;line-height:1.2}._summaryContainer_1gtok_3{display:flex;flex-direction:column;height:100%;width:100%;background-color:#fff;overflow:hidden;position:relative}._summaryShareButtonFixed_1gtok_14{position:absolute;bottom:10px;right:10px;width:45px;height:45px;font-size:12px;text-transform:uppercase;border-radius:50%;background-color:#2196f3;color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000026;transition:all .3s ease;z-index:1000;-webkit-tap-highlight-color:transparent}._summaryShareButtonFixed_1gtok_14:hover{background-color:#1976d2;box-shadow:0 6px 16px #0003;transform:scale(1.05)}._summaryShareButtonFixed_1gtok_14:active{transform:scale(.95);box-shadow:0 2px 8px #00000026}._summaryShareButtonFixed_1gtok_14 ._shareIcon_1gtok_47{width:24px;height:24px;filter:brightness(0) invert(1)}._summaryExplaination_1gtok_54{gap:8px;padding:12px;border-radius:8px;align-items:center;margin:12px 20px 0;font-size:14px;font-weight:600;line-height:1.2;text-align:center;justify-content:center;white-space:pre-wrap;background:#f2f2f2;color:#181818}._summaryTabs_1gtok_71{display:flex;justify-content:center;padding:16px 20px;background-color:#f5f5f5;border-bottom:1px solid #e0e0e0}._summaryTab_1gtok_71{display:flex;flex-direction:column;align-items:center;cursor:pointer;transition:all .3s ease;text-align:center;padding:0 5px;-webkit-tap-highlight-color:transparent}._summaryEmojiItem_1gtok_96{display:flex;flex-direction:column;align-items:center;gap:8px}._summaryEmojiButton_1gtok_108{display:flex;align-items:center;justify-content:center;padding:0;border-radius:50%;background:#fffc;border:2px solid rgba(0,0,0,.2);cursor:pointer;transition:all .3s ease;width:40px;height:40px;box-shadow:0 2px 8px #00000026;-webkit-tap-highlight-color:transparent}._summaryEmojiButtonActive_1gtok_124{background:#fff;border:3px solid rgba(0,0,0,.6);box-shadow:0 4px 12px #00000040;transform:scale(1.1)}._summaryEmojiLikeActive_1gtok_136{border-color:#4caf50;background:#4caf5026;box-shadow:0 4px 12px #4caf504d}._summaryEmojiDislikeActive_1gtok_146{border-color:#f44336;background:#f4433626;box-shadow:0 4px 12px #f443364d}._summaryEmojiMaybeActive_1gtok_156{border-color:#ff9800;background:#ff980026;box-shadow:0 4px 12px #ff98004d}._summaryEmojiSeenActive_1gtok_166{border-color:#2196f3;background:#2196f326;box-shadow:0 4px 12px #2196f34d}._summaryEmojiLike_1gtok_132:hover{border-color:#4caf50;background:#4caf501a}._summaryEmojiDislike_1gtok_142:hover{border-color:#f44336;background:#f443361a}._summaryEmojiMaybe_1gtok_152:hover{border-color:#ff9800;background:#ff98001a}._summaryEmojiSeen_1gtok_162:hover{border-color:#2196f3;background:#2196f31a}._summaryEmojiIcon_1gtok_194{width:28px;height:28px;object-fit:contain}._summaryEmojiLabel_1gtok_201{font-size:11px;font-weight:600;color:#000c;text-align:center;line-height:1.2;text-transform:uppercase;letter-spacing:.5px}._summaryEmojiItemActive_1gtok_103 ._summaryEmojiLabel_1gtok_201{color:#000;font-weight:700}._summaryContent_1gtok_217{flex:1;overflow:hidden;position:relative;background-color:#fff;min-height:0}._summaryPanel_1gtok_226{display:none;position:absolute;top:0;left:0;right:0;bottom:0;height:100%;width:100%;overflow-y:auto;min-height:0;box-sizing:border-box;overscroll-behavior:contain}._summaryPanelActive_1gtok_241{display:block}._summaryEmptyState_1gtok_246{text-align:center;padding:40px 20px;color:#181818}._summaryEmptyStateText_1gtok_252{margin:0 0 16px;font-size:18px;font-weight:600}._historyDrawerContent_x0jj6_1,._historyDrawerContent_x0jj6_1 .summary-container{height:100%;display:flex;flex-direction:column;overflow:hidden}._historyDrawerEmpty_x0jj6_15{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;padding:40px 20px;text-align:center;color:#666}._historyDrawerEmpty_x0jj6_15 p{margin:8px 0;font-size:16px}._historyDrawerEmptyHint_x0jj6_31{font-size:14px;color:#999}._historyDrawerTitle_x0jj6_36{margin:0 0 16px;padding:20px 20px 0;font-size:20px;font-weight:700;color:#333}._historyDrawerList_x0jj6_44{height:100%;display:flex;flex-direction:column;overflow:hidden}._historyDrawerList_x0jj6_44 .card-list-container{flex:1;overflow-y:auto}._historyDrawerGrouped_x0jj6_56{height:100%;display:flex;flex-direction:column;overflow-y:auto}._historyDrawerGroup_x0jj6_56{margin-bottom:24px}._historyDrawerGroup_x0jj6_56:last-child{margin-bottom:0}._historyDrawerGroupTitle_x0jj6_71{margin:0 0 12px;padding:20px 20px 0;font-size:18px;font-weight:700;color:#333}._historyDrawerGroup_x0jj6_56:first-child ._historyDrawerGroupTitle_x0jj6_71{padding-top:20px}._historyDrawerGroup_x0jj6_56 .card-list-container{padding-top:0}._historyDrawer_x0jj6_1 .drawer-content{padding:20px 0}._historyDrawer_x0jj6_1 .drawer-content .summary-tabs,._historyDrawer_x0jj6_1 .drawer-content .summary-content{background-color:transparent!important}._filtersButton_qio2f_1{position:absolute;z-index:1000;min-width:80px;height:40px;padding:8px 16px;border:none;border-radius:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;outline:none;-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-size:14px;font-weight:500;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;text-align:center;white-space:pre-wrap;background-image:linear-gradient(135deg,#ffffff1a,#0000001a);transition:all .3s ease;box-shadow:0 4px 8px #00000026}._filtersButton_qio2f_1:hover{box-shadow:0 6px 12px #0003;transform:translateY(-1px)}._filtersButton_qio2f_1:active{transform:translateY(1px);box-shadow:0 2px 4px #00000026}._filtersButton_qio2f_1:focus{outline:none}._filtersButton_qio2f_1:focus-visible{outline:none}._filtersLeft_qio2f_46{left:20px;right:auto}._filtersMiddle_qio2f_51{left:50%;right:auto;transform:translate(-50%)}._filtersRight_qio2f_57{left:auto;right:20px}._filtersIcon_qio2f_63{pointer-events:none;flex-shrink:0}._content_hci8k_2{padding:12px 20px}._title_hci8k_7{margin:0 0 12px;font-size:16px;font-weight:600;color:#333;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;white-space:pre-wrap}._categories_hci8k_17{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:0}._pill_hci8k_25{display:inline-flex;align-items:center;padding:6px 12px;border-radius:20px;cursor:pointer;font-size:13px;font-weight:500;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;transition:all .2s ease;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}._noCategories_hci8k_40{width:100%;color:#999;font-style:italic;text-align:center;padding:20px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}._cardsCounter_1h26d_1{width:100%;text-align:left;font-size:14px;font-weight:700;color:#fff;text-shadow:1px 1px 2px rgba(0,0,0,.8);padding:5px 5px 5px 21px;pointer-events:none;white-space:pre-wrap}._logo_1rzq2_1{display:block;height:auto;max-width:100%;-webkit-user-select:none;user-select:none;pointer-events:none}._container_18bki_1{position:absolute}._interactiveFeed_1wsuw_1,._swippingJourney_15509_1{position:relative;width:100%;height:100%;overflow:hidden}._mainBootstrap_1rzog_1{width:100%;height:100%;position:relative}:root{--media-object-fit: cover}*{margin:0;padding:0;box-sizing:border-box;font-family:Arial,sans-serif}body{touch-action:pan-y;-webkit-user-select:none;user-select:none}";document.head.appendChild(s);}})();!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","react/jsx-runtime"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).SwipeFinderSDK={},t.React,t.ReactDOM,t.ReactJSXRuntime)}(this,function(t,e,i,s){"use strict";var r,n,a,o,l,d,h,c,u,f,g,m,p,A,v,y,E,T,S,b,I,L=Object.defineProperty,R=t=>{throw TypeError(t)},k=(t,e,i)=>((t,e,i)=>e in t?L(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i),w=(t,e,i)=>e.has(t)||R("Cannot "+i),D=(t,e,i)=>(w(t,e,"read from private field"),i?i.call(t):e.get(t)),C=(t,e,i)=>e.has(t)?R("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),x=(t,e,i,s)=>(w(t,e,"write to private field"),s?s.call(t,i):e.set(t,i),i),P=(t,e,i)=>(w(t,e,"access private method"),i);function M(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var O=i;I=O.createRoot,O.hydrateRoot;const B=e.createContext({});function F(t){const i=e.useRef(null);return null===i.current&&(i.current=t()),i.current}const N=e.createContext(null),_=e.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});const U="undefined"!=typeof window,H=U?e.useLayoutEffect:e.useEffect,j=t=>t;let V=j;const G=!1;const Q=["read","resolveKeyframes","update","preRender","render","postRender"];function K(t,e){let i=!1,s=!0;const r={delta:0,timestamp:0,isProcessing:!1},n=()=>i=!0,a=Q.reduce((t,e)=>(t[e]=function(t){let e=new Set,i=new Set,s=!1,r=!1;const n=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(e){n.has(e)&&(l.schedule(e),t()),e(a)}const l={schedule:(t,r=!1,a=!1)=>{const o=a&&s?e:i;return r&&n.add(t),o.has(t)||o.add(t),t},cancel:t=>{i.delete(t),n.delete(t)},process:t=>{a=t,s?r=!0:(s=!0,[e,i]=[i,e],e.forEach(o),e.clear(),s=!1,r&&(r=!1,l.process(t)))}};return l}(n),t),{}),{read:o,resolveKeyframes:l,update:d,preRender:h,render:c,postRender:u}=a,f=()=>{const n=performance.now();i=!1,r.delta=s?1e3/60:Math.max(Math.min(n-r.timestamp,40),1),r.timestamp=n,r.isProcessing=!0,o.process(r),l.process(r),d.process(r),h.process(r),c.process(r),u.process(r),r.isProcessing=!1,i&&e&&(s=!1,t(f))};return{schedule:Q.reduce((e,n)=>{const o=a[n];return e[n]=(e,n=!1,a=!1)=>(i||(i=!0,s=!0,r.isProcessing||t(f)),o.schedule(e,n,a)),e},{}),cancel:t=>{for(let e=0;e<Q.length;e++)a[Q[e]].cancel(t)},state:r,steps:a}}const{schedule:q,cancel:W,state:Y,steps:$}=K("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:j,!0),z=e.createContext({strict:!1}),X={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Z={};for(const ME in X)Z[ME]={isEnabled:t=>X[ME].some(e=>!!t[e])};const J=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function tt(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||J.has(t)}let et=t=>!tt(t);try{(it=require("@emotion/is-prop-valid").default)&&(et=t=>t.startsWith("on")?!tt(t):it(t))}catch(nv){}var it;function st(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy((...e)=>t(...e),{get:(i,s)=>"create"===s?t:(e.has(s)||e.set(s,t(s)),e.get(s))})}const rt=e.createContext({});function nt(t){return"string"==typeof t||Array.isArray(t)}function at(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}const ot=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lt=["initial",...ot];function dt(t){return at(t.animate)||lt.some(e=>nt(t[e]))}function ht(t){return Boolean(dt(t)||t.variants)}function ct(t){const{initial:i,animate:s}=function(t,e){if(dt(t)){const{initial:e,animate:i}=t;return{initial:!1===e||nt(e)?e:void 0,animate:nt(i)?i:void 0}}return!1!==t.inherit?e:{}}(t,e.useContext(rt));return e.useMemo(()=>({initial:i,animate:s}),[ut(i),ut(s)])}function ut(t){return Array.isArray(t)?t.join(" "):t}const ft=Symbol.for("motionComponentSymbol");function gt(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function mt(t,i,s){return e.useCallback(e=>{e&&t.onMount&&t.onMount(e),i&&(e?i.mount(e):i.unmount()),s&&("function"==typeof s?s(e):gt(s)&&(s.current=e))},[i])}const pt=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),At="data-"+pt("framerAppearId"),{schedule:vt}=K(queueMicrotask,!1),yt=e.createContext({});function Et(t,i,s,r,n){var a,o;const{visualElement:l}=e.useContext(rt),d=e.useContext(z),h=e.useContext(N),c=e.useContext(_).reducedMotion,u=e.useRef(null);r=r||d.renderer,!u.current&&r&&(u.current=r(t,{visualState:i,parent:l,props:s,presenceContext:h,blockInitialAnimation:!!h&&!1===h.initial,reducedMotionConfig:c}));const f=u.current,g=e.useContext(yt);!f||f.projection||!n||"html"!==f.type&&"svg"!==f.type||function(t,e,i,s){const{layoutId:r,layout:n,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:d}=e;t.projection=new i(t.latestValues,e["data-framer-portal-id"]?void 0:Tt(t.parent)),t.projection.setOptions({layoutId:r,layout:n,alwaysMeasureLayout:Boolean(a)||o&&gt(o),visualElement:t,animationType:"string"==typeof n?n:"both",initialPromotionConfig:s,layoutScroll:l,layoutRoot:d})}(u.current,s,n,g);const m=e.useRef(!1);e.useInsertionEffect(()=>{f&&m.current&&f.update(s,h)});const p=s[At],A=e.useRef(Boolean(p)&&!(null===(a=window.MotionHandoffIsComplete)||void 0===a?void 0:a.call(window,p))&&(null===(o=window.MotionHasOptimisedAnimation)||void 0===o?void 0:o.call(window,p)));return H(()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),vt.render(f.render),A.current&&f.animationState&&f.animationState.animateChanges())}),e.useEffect(()=>{f&&(!A.current&&f.animationState&&f.animationState.animateChanges(),A.current&&(queueMicrotask(()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,p)}),A.current=!1))}),f}function Tt(t){if(t)return!1!==t.options.allowProjection?t.projection:Tt(t.parent)}function St({preloadedFeatures:t,createVisualElement:i,useRender:r,useVisualState:n,Component:a}){var o,l;function d(t,o){let l;const d={...e.useContext(_),...t,layoutId:bt(t)},{isStatic:h}=d,c=ct(t),u=n(t,h);if(!h&&U){e.useContext(z).strict;const t=function(t){const{drag:e,layout:i}=Z;if(!e&&!i)return{};const s={...e,...i};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==i?void 0:i.isEnabled(t))?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}(d);l=t.MeasureLayout,c.visualElement=Et(a,u,d,i,t.ProjectionNode)}return s.jsxs(rt.Provider,{value:c,children:[l&&c.visualElement?s.jsx(l,{visualElement:c.visualElement,...d}):null,r(a,t,mt(u,c.visualElement,o),u,h,c.visualElement)]})}t&&function(t){for(const e in t)Z[e]={...Z[e],...t[e]}}(t),d.displayName=`motion.${"string"==typeof a?a:`create(${null!==(l=null!==(o=a.displayName)&&void 0!==o?o:a.name)&&void 0!==l?l:""})`}`;const h=e.forwardRef(d);return h[ft]=a,h}function bt({layoutId:t}){const i=e.useContext(B).id;return i&&void 0!==t?i+"-"+t:t}const It=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Lt(t){return"string"==typeof t&&!t.includes("-")&&!!(It.indexOf(t)>-1||/[A-Z]/u.test(t))}function Rt(t){const e=[{},{}];return null==t||t.values.forEach((t,i)=>{e[0][i]=t.get(),e[1][i]=t.getVelocity()}),e}function kt(t,e,i,s){if("function"==typeof e){const[r,n]=Rt(s);e=e(void 0!==i?i:t.custom,r,n)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[r,n]=Rt(s);e=e(void 0!==i?i:t.custom,r,n)}return e}const wt=t=>Array.isArray(t),Dt=t=>wt(t)?t[t.length-1]||0:t,Ct=t=>Boolean(t&&t.getVelocity);function xt(t){const e=Ct(t)?t.get():t;return i=e,Boolean(i&&"object"==typeof i&&i.mix&&i.toValue)?e.toValue():e;var i}const Pt=t=>(i,s)=>{const r=e.useContext(rt),n=e.useContext(N),a=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:i},s,r,n){const a={latestValues:Mt(s,r,n,t),renderState:e()};return i&&(a.onMount=t=>i({props:s,current:t,...a}),a.onUpdate=t=>i(t)),a}(t,i,r,n);return s?a():F(a)};function Mt(t,e,i,s){const r={},n=s(t,{});for(const u in n)r[u]=xt(n[u]);let{initial:a,animate:o}=t;const l=dt(t),d=ht(t);e&&d&&!l&&!1!==t.inherit&&(void 0===a&&(a=e.initial),void 0===o&&(o=e.animate));let h=!!i&&!1===i.initial;h=h||!1===a;const c=h?o:a;if(c&&"boolean"!=typeof c&&!at(c)){const e=Array.isArray(c)?c:[c];for(let i=0;i<e.length;i++){const s=kt(t,e[i]);if(s){const{transitionEnd:t,transition:e,...i}=s;for(const s in i){let t=i[s];if(Array.isArray(t)){t=t[h?t.length-1:0]}null!==t&&(r[s]=t)}for(const s in t)r[s]=t[s]}}}return r}const Ot=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Bt=new Set(Ot),Ft=t=>e=>"string"==typeof e&&e.startsWith(t),Nt=Ft("--"),_t=Ft("var(--"),Ut=t=>!!_t(t)&&Ht.test(t.split("/*")[0].trim()),Ht=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,jt=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Vt=(t,e,i)=>i>e?e:i<t?t:i,Gt={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Qt={...Gt,transform:t=>Vt(0,1,t)},Kt={...Gt,default:1},qt=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Wt=qt("deg"),Yt=qt("%"),$t=qt("px"),zt=qt("vh"),Xt=qt("vw"),Zt={...Yt,parse:t=>Yt.parse(t)/100,transform:t=>Yt.transform(100*t)},Jt={borderWidth:$t,borderTopWidth:$t,borderRightWidth:$t,borderBottomWidth:$t,borderLeftWidth:$t,borderRadius:$t,radius:$t,borderTopLeftRadius:$t,borderTopRightRadius:$t,borderBottomRightRadius:$t,borderBottomLeftRadius:$t,width:$t,maxWidth:$t,height:$t,maxHeight:$t,top:$t,right:$t,bottom:$t,left:$t,padding:$t,paddingTop:$t,paddingRight:$t,paddingBottom:$t,paddingLeft:$t,margin:$t,marginTop:$t,marginRight:$t,marginBottom:$t,marginLeft:$t,backgroundPositionX:$t,backgroundPositionY:$t},te={rotate:Wt,rotateX:Wt,rotateY:Wt,rotateZ:Wt,scale:Kt,scaleX:Kt,scaleY:Kt,scaleZ:Kt,skew:Wt,skewX:Wt,skewY:Wt,distance:$t,translateX:$t,translateY:$t,translateZ:$t,x:$t,y:$t,z:$t,perspective:$t,transformPerspective:$t,opacity:Qt,originX:Zt,originY:Zt,originZ:$t},ee={...Gt,transform:Math.round},ie={...Jt,...te,zIndex:ee,size:$t,fillOpacity:Qt,strokeOpacity:Qt,numOctaves:ee},se={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},re=Ot.length;function ne(t,e,i){const{style:s,vars:r,transformOrigin:n}=t;let a=!1,o=!1;for(const l in e){const t=e[l];if(Bt.has(l))a=!0;else if(Nt(l))r[l]=t;else{const e=jt(t,ie[l]);l.startsWith("origin")?(o=!0,n[l]=e):s[l]=e}}if(e.transform||(a||i?s.transform=function(t,e,i){let s="",r=!0;for(let n=0;n<re;n++){const a=Ot[n],o=t[a];if(void 0===o)continue;let l=!0;if(l="number"==typeof o?o===(a.startsWith("scale")?1:0):0===parseFloat(o),!l||i){const t=jt(o,ie[a]);l||(r=!1,s+=`${se[a]||a}(${t}) `),i&&(e[a]=t)}}return s=s.trim(),i?s=i(e,r?"":s):r&&(s="none"),s}(e,t.transform,i):s.transform&&(s.transform="none")),o){const{originX:t="50%",originY:e="50%",originZ:i=0}=n;s.transformOrigin=`${t} ${e} ${i}`}}const ae={offset:"stroke-dashoffset",array:"stroke-dasharray"},oe={offset:"strokeDashoffset",array:"strokeDasharray"};function le(t,e,i){return"string"==typeof t?t:$t.transform(e+i*t)}function de(t,{attrX:e,attrY:i,attrScale:s,originX:r,originY:n,pathLength:a,pathSpacing:o=1,pathOffset:l=0,...d},h,c){if(ne(t,d,c),h)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:u,style:f,dimensions:g}=t;u.transform&&(g&&(f.transform=u.transform),delete u.transform),g&&(void 0!==r||void 0!==n||f.transform)&&(f.transformOrigin=function(t,e,i){return`${le(e,t.x,t.width)} ${le(i,t.y,t.height)}`}(g,void 0!==r?r:.5,void 0!==n?n:.5)),void 0!==e&&(u.x=e),void 0!==i&&(u.y=i),void 0!==s&&(u.scale=s),void 0!==a&&function(t,e,i=1,s=0,r=!0){t.pathLength=1;const n=r?ae:oe;t[n.offset]=$t.transform(-s);const a=$t.transform(e),o=$t.transform(i);t[n.array]=`${a} ${o}`}(u,a,o,l,!1)}const he=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),ce=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}}),ue=t=>"string"==typeof t&&"svg"===t.toLowerCase();function fe(t,{style:e,vars:i},s,r){Object.assign(t.style,e,r&&r.getProjectionStyles(s));for(const n in i)t.style.setProperty(n,i[n])}const ge=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function me(t,e,i,s){fe(t,e,void 0,s);for(const r in e.attrs)t.setAttribute(ge.has(r)?r:pt(r),e.attrs[r])}const pe={};function Ae(t,{layout:e,layoutId:i}){return Bt.has(t)||t.startsWith("origin")||(e||void 0!==i)&&(!!pe[t]||"opacity"===t)}function ve(t,e,i){var s;const{style:r}=t,n={};for(const a in r)(Ct(r[a])||e.style&&Ct(e.style[a])||Ae(a,t)||void 0!==(null===(s=null==i?void 0:i.getValue(a))||void 0===s?void 0:s.liveStyle))&&(n[a]=r[a]);return n}function ye(t,e,i){const s=ve(t,e,i);for(const r in t)if(Ct(t[r])||Ct(e[r])){s[-1!==Ot.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=t[r]}return s}const Ee=["x","y","width","height","cx","cy","r"],Te={useVisualState:Pt({scrapeMotionValuesFromProps:ye,createRenderState:ce,onUpdate:({props:t,prevProps:e,current:i,renderState:s,latestValues:r})=>{if(!i)return;let n=!!t.drag;if(!n)for(const o in r)if(Bt.has(o)){n=!0;break}if(!n)return;let a=!e;if(e)for(let o=0;o<Ee.length;o++){const i=Ee[o];t[i]!==e[i]&&(a=!0)}a&&q.read(()=>{!function(t,e){try{e.dimensions="function"==typeof t.getBBox?t.getBBox():t.getBoundingClientRect()}catch(i){e.dimensions={x:0,y:0,width:0,height:0}}}(i,s),q.render(()=>{de(s,r,ue(i.tagName),t.transformTemplate),me(i,s)})})}})},Se={useVisualState:Pt({scrapeMotionValuesFromProps:ve,createRenderState:he})};function be(t,e,i){for(const s in e)Ct(e[s])||Ae(s,i)||(t[s]=e[s])}function Ie(t,i){const s={};return be(s,t.style||{},t),Object.assign(s,function({transformTemplate:t},i){return e.useMemo(()=>{const e={style:{},transform:{},transformOrigin:{},vars:{}};return ne(e,i,t),Object.assign({},e.vars,e.style)},[i])}(t,i)),s}function Le(t,e){const i={},s=Ie(t,e);return t.drag&&!1!==t.dragListener&&(i.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(i.tabIndex=0),i.style=s,i}function Re(t,i,s,r){const n=e.useMemo(()=>{const e={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return de(e,i,ue(r),t.transformTemplate),{...e.attrs,style:{...e.style}}},[i]);if(t.style){const e={};be(e,t.style,t),n.style={...e,...n.style}}return n}function ke(t=!1){return(i,s,r,{latestValues:n},a)=>{const o=(Lt(i)?Re:Le)(s,n,a,i),l=function(t,e,i){const s={};for(const r in t)"values"===r&&"object"==typeof t.values||(et(r)||!0===i&&tt(r)||!e&&!tt(r)||t.draggable&&r.startsWith("onDrag"))&&(s[r]=t[r]);return s}(s,"string"==typeof i,t),d=i!==e.Fragment?{...l,...o,ref:r}:{},{children:h}=s,c=e.useMemo(()=>Ct(h)?h.get():h,[h]);return e.createElement(i,{...d,children:c})}}function we(t,e){return function(i,{forwardMotionProps:s}={forwardMotionProps:!1}){return St({...Lt(i)?Te:Se,preloadedFeatures:t,useRender:ke(s),createVisualElement:e,Component:i})}}function De(t,e){if(!Array.isArray(e))return!1;const i=e.length;if(i!==t.length)return!1;for(let s=0;s<i;s++)if(e[s]!==t[s])return!1;return!0}function Ce(t,e,i){const s=t.getProps();return kt(s,e,void 0!==i?i:s.custom,t)}function xe(t,e){return t?t[e]||t.default||t:void 0}const Pe=new Set(["width","height","top","left","right","bottom",...Ot]);let Me;function Oe(){Me=void 0}const Be={now:()=>(void 0===Me&&Be.set(Y.isProcessing||G?Y.timestamp:performance.now()),Me),set:t=>{Me=t,queueMicrotask(Oe)}};function Fe(t,e){-1===t.indexOf(e)&&t.push(e)}function Ne(t,e){const i=t.indexOf(e);i>-1&&t.splice(i,1)}class _e{constructor(){this.subscriptions=[]}add(t){return Fe(this.subscriptions,t),()=>Ne(this.subscriptions,t)}notify(t,e,i){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,i);else for(let r=0;r<s;r++){const s=this.subscriptions[r];s&&s(t,e,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Ue(t,e){return e?t*(1e3/e):0}const He={current:void 0};class je{constructor(t,e={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const i=Be.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=Be.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new _e);const i=this.events[t].add(e);return"change"===t?()=>{i(),q.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,i){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return He.current&&He.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Be.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Ue(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ve(t,e){return new je(t,e)}function Ge(t,e,i){t.hasValue(e)?t.getValue(e).set(i):t.addValue(e,Ve(i))}function Qe(t,e){const i=Ce(t,e);let{transitionEnd:s={},transition:r={},...n}=i||{};n={...n,...s};for(const a in n){Ge(t,a,Dt(n[a]))}}function Ke(t,e){const i=t.getValue("willChange");if(s=i,Boolean(Ct(s)&&s.add))return i.add(e);var s}function qe(t){return t.props[At]}function We(t){let e;return()=>(void 0===e&&(e=t()),e)}const Ye=We(()=>void 0!==window.ScrollTimeline);class $e{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let i=0;i<this.animations.length;i++)this.animations[i][t]=e}attachTimeline(t,e){const i=this.animations.map(i=>Ye()&&i.attachTimeline?i.attachTimeline(t):"function"==typeof e?e(i):void 0);return()=>{i.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach(e=>e[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class ze extends $e{then(t,e){return Promise.all(this.animations).then(t).catch(e)}}const Xe=t=>1e3*t,Ze=t=>t/1e3;function Je(t){return"function"==typeof t}function ti(t,e){t.timeline=e,t.onfinish=null}const ei=t=>Array.isArray(t)&&"number"==typeof t[0],ii={linearEasing:void 0};function si(t,e){const i=We(t);return()=>{var t;return null!==(t=ii[e])&&void 0!==t?t:i()}}const ri=si(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),ni=(t,e,i)=>{const s=e-t;return 0===s?1:(i-t)/s},ai=(t,e,i=10)=>{let s="";const r=Math.max(Math.round(e/i),2);for(let n=0;n<r;n++)s+=t(ni(0,r-1,n))+", ";return`linear(${s.substring(0,s.length-2)})`};function oi(t){return Boolean("function"==typeof t&&ri()||!t||"string"==typeof t&&(t in di||ri())||ei(t)||Array.isArray(t)&&t.every(oi))}const li=([t,e,i,s])=>`cubic-bezier(${t}, ${e}, ${i}, ${s})`,di={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:li([0,.65,.55,1]),circOut:li([.55,0,1,.45]),backIn:li([.31,.01,.66,-.59]),backOut:li([.33,1.53,.69,.99])};function hi(t,e){return t?"function"==typeof t&&ri()?ai(t,e):ei(t)?li(t):Array.isArray(t)?t.map(t=>hi(t,e)||di.easeOut):di[t]:void 0}const ci=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function ui(t,e,i,s){if(t===e&&i===s)return j;const r=e=>function(t,e,i,s,r){let n,a,o=0;do{a=e+(i-e)/2,n=ci(a,s,r)-t,n>0?i=a:e=a}while(Math.abs(n)>1e-7&&++o<12);return a}(e,0,1,t,i);return t=>0===t||1===t?t:ci(r(t),e,s)}const fi=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,gi=t=>e=>1-t(1-e),mi=ui(.33,1.53,.69,.99),pi=gi(mi),Ai=fi(pi),vi=t=>(t*=2)<1?.5*pi(t):.5*(2-Math.pow(2,-10*(t-1))),yi=t=>1-Math.sin(Math.acos(t)),Ei=gi(yi),Ti=fi(yi),Si=t=>/^0[^.\s]+$/u.test(t);function bi(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||Si(t))}const Ii=t=>Math.round(1e5*t)/1e5,Li=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Ri=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ki=(t,e)=>i=>Boolean("string"==typeof i&&Ri.test(i)&&i.startsWith(t)||e&&!function(t){return null==t}(i)&&Object.prototype.hasOwnProperty.call(i,e)),wi=(t,e,i)=>s=>{if("string"!=typeof s)return s;const[r,n,a,o]=s.match(Li);return{[t]:parseFloat(r),[e]:parseFloat(n),[i]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},Di={...Gt,transform:t=>Math.round((t=>Vt(0,255,t))(t))},Ci={test:ki("rgb","red"),parse:wi("red","green","blue"),transform:({red:t,green:e,blue:i,alpha:s=1})=>"rgba("+Di.transform(t)+", "+Di.transform(e)+", "+Di.transform(i)+", "+Ii(Qt.transform(s))+")"};const xi={test:ki("#"),parse:function(t){let e="",i="",s="",r="";return t.length>5?(e=t.substring(1,3),i=t.substring(3,5),s=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),i=t.substring(2,3),s=t.substring(3,4),r=t.substring(4,5),e+=e,i+=i,s+=s,r+=r),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}},transform:Ci.transform},Pi={test:ki("hsl","hue"),parse:wi("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:i,alpha:s=1})=>"hsla("+Math.round(t)+", "+Yt.transform(Ii(e))+", "+Yt.transform(Ii(i))+", "+Ii(Qt.transform(s))+")"},Mi={test:t=>Ci.test(t)||xi.test(t)||Pi.test(t),parse:t=>Ci.test(t)?Ci.parse(t):Pi.test(t)?Pi.parse(t):xi.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Ci.transform(t):Pi.transform(t)},Oi=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Bi="number",Fi="color",Ni=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function _i(t){const e=t.toString(),i=[],s={color:[],number:[],var:[]},r=[];let n=0;const a=e.replace(Ni,t=>(Mi.test(t)?(s.color.push(n),r.push(Fi),i.push(Mi.parse(t))):t.startsWith("var(")?(s.var.push(n),r.push("var"),i.push(t)):(s.number.push(n),r.push(Bi),i.push(parseFloat(t))),++n,"${}")).split("${}");return{values:i,split:a,indexes:s,types:r}}function Ui(t){return _i(t).values}function Hi(t){const{split:e,types:i}=_i(t),s=e.length;return t=>{let r="";for(let n=0;n<s;n++)if(r+=e[n],void 0!==t[n]){const e=i[n];r+=e===Bi?Ii(t[n]):e===Fi?Mi.transform(t[n]):t[n]}return r}}const ji=t=>"number"==typeof t?0:t;const Vi={test:function(t){var e,i;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(Li))||void 0===e?void 0:e.length)||0)+((null===(i=t.match(Oi))||void 0===i?void 0:i.length)||0)>0},parse:Ui,createTransformer:Hi,getAnimatableNone:function(t){const e=Ui(t);return Hi(t)(e.map(ji))}},Gi=new Set(["brightness","contrast","saturate","opacity"]);function Qi(t){const[e,i]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=i.match(Li)||[];if(!s)return t;const r=i.replace(s,"");let n=Gi.has(e)?1:0;return s!==i&&(n*=100),e+"("+n+r+")"}const Ki=/\b([a-z-]*)\(.*?\)/gu,qi={...Vi,getAnimatableNone:t=>{const e=t.match(Ki);return e?e.map(Qi).join(" "):t}},Wi={...ie,color:Mi,backgroundColor:Mi,outlineColor:Mi,fill:Mi,stroke:Mi,borderColor:Mi,borderTopColor:Mi,borderRightColor:Mi,borderBottomColor:Mi,borderLeftColor:Mi,filter:qi,WebkitFilter:qi},Yi=t=>Wi[t];function $i(t,e){let i=Yi(t);return i!==qi&&(i=Vi),i.getAnimatableNone?i.getAnimatableNone(e):void 0}const zi=new Set(["auto","none","0"]);const Xi=t=>t===Gt||t===$t,Zi=(t,e)=>parseFloat(t.split(", ")[e]),Ji=(t,e)=>(i,{transform:s})=>{if("none"===s||!s)return 0;const r=s.match(/^matrix3d\((.+)\)$/u);if(r)return Zi(r[1],e);{const e=s.match(/^matrix\((.+)\)$/u);return e?Zi(e[1],t):0}},ts=new Set(["x","y","z"]),es=Ot.filter(t=>!ts.has(t));const is={width:({x:t},{paddingLeft:e="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),height:({y:t},{paddingTop:e="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:Ji(4,13),y:Ji(5,14)};is.translateX=is.x,is.translateY=is.y;const ss=new Set;let rs=!1,ns=!1;function as(){if(ns){const t=Array.from(ss).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),i=new Map;e.forEach(t=>{const e=function(t){const e=[];return es.forEach(i=>{const s=t.getValue(i);void 0!==s&&(e.push([i,s.get()]),s.set(i.startsWith("scale")?1:0))}),e}(t);e.length&&(i.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=i.get(t);e&&e.forEach(([e,i])=>{var s;null===(s=t.getValue(e))||void 0===s||s.set(i)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}ns=!1,rs=!1,ss.forEach(t=>t.complete()),ss.clear()}function os(){ss.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(ns=!0)})}class ls{constructor(t,e,i,s,r,n=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=i,this.motionValue=s,this.element=r,this.isAsync=n}scheduleResolve(){this.isScheduled=!0,this.isAsync?(ss.add(this),rs||(rs=!0,q.read(os),q.resolveKeyframes(as))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:i,motionValue:s}=this;for(let r=0;r<t.length;r++)if(null===t[r])if(0===r){const r=null==s?void 0:s.get(),n=t[t.length-1];if(void 0!==r)t[0]=r;else if(i&&e){const s=i.readValue(e,n);null!=s&&(t[0]=s)}void 0===t[0]&&(t[0]=n),s&&void 0===r&&s.set(t[0])}else t[r]=t[r-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),ss.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,ss.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const ds=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),hs=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function cs(t,e,i=1){const[s,r]=function(t){const e=hs.exec(t);if(!e)return[,];const[,i,s,r]=e;return[`--${null!=i?i:s}`,r]}(t);if(!s)return;const n=window.getComputedStyle(e).getPropertyValue(s);if(n){const t=n.trim();return ds(t)?parseFloat(t):t}return Ut(r)?cs(r,e,i+1):r}const us=t=>e=>e.test(t),fs=[Gt,$t,Yt,Wt,Xt,zt,{test:t=>"auto"===t,parse:t=>t}],gs=t=>fs.find(us(t));class ms extends ls{constructor(t,e,i,s,r){super(t,e,i,s,r,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:i}=this;if(!e||!e.current)return;super.readKeyframes();for(let o=0;o<t.length;o++){let i=t[o];if("string"==typeof i&&(i=i.trim(),Ut(i))){const s=cs(i,e.current);void 0!==s&&(t[o]=s),o===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!Pe.has(i)||2!==t.length)return;const[s,r]=t,n=gs(s),a=gs(r);if(n!==a)if(Xi(n)&&Xi(a))for(let o=0;o<t.length;o++){const e=t[o];"string"==typeof e&&(t[o]=parseFloat(e))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,i=[];for(let s=0;s<t.length;s++)bi(t[s])&&i.push(s);i.length&&function(t,e,i){let s,r=0;for(;r<t.length&&!s;){const e=t[r];"string"==typeof e&&!zi.has(e)&&_i(e).values.length&&(s=t[r]),r++}if(s&&i)for(const n of e)t[n]=$i(i,s)}(t,i,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:i}=this;if(!t||!t.current)return;"height"===i&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=is[i](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const s=e[e.length-1];void 0!==s&&t.getValue(i,s).jump(s,!1)}measureEndState(){var t;const{element:e,name:i,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const r=e.getValue(i);r&&r.jump(this.measuredOrigin,!1);const n=s.length-1,a=s[n];s[n]=is[i](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==a&&void 0===this.finalKeyframe&&(this.finalKeyframe=a),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach(([t,i])=>{e.getValue(t).set(i)}),this.resolveNoneKeyframes()}}const ps=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Vi.test(t)&&"0"!==t||t.startsWith("url(")));const As=t=>null!==t;function vs(t,{repeat:e,repeatType:i="loop"},s){const r=t.filter(As),n=e&&"loop"!==i&&e%2==1?0:r.length-1;return n&&void 0!==s?s:r[n]}class ys{constructor({autoplay:t=!0,delay:e=0,type:i="keyframes",repeat:s=0,repeatDelay:r=0,repeatType:n="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Be.now(),this.options={autoplay:t,delay:e,type:i,repeat:s,repeatDelay:r,repeatType:n,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(os(),as()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Be.now(),this.hasAttemptedResolve=!0;const{name:i,type:s,velocity:r,delay:n,onComplete:a,onUpdate:o,isGenerator:l}=this.options;if(!l&&!function(t,e,i,s){const r=t[0];if(null===r)return!1;if("display"===e||"visibility"===e)return!0;const n=t[t.length-1],a=ps(r,e),o=ps(n,e);return!(!a||!o)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let i=0;i<t.length;i++)if(t[i]!==e)return!0}(t)||("spring"===i||Je(i))&&s)}(t,i,s,r)){if(!n)return o&&o(vs(t,this.options,e)),a&&a(),void this.resolveFinishedPromise();this.options.duration=0}const d=this.initPlayback(t,e);!1!==d&&(this._resolved={keyframes:t,finalKeyframe:e,...d},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Es=2e4;function Ts(t){let e=0;let i=t.next(e);for(;!i.done&&e<Es;)e+=50,i=t.next(e);return e>=Es?1/0:e}const Ss=(t,e,i)=>t+(e-t)*i;function bs(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function Is(t,e){return i=>i>0?e:t}const Ls=(t,e,i)=>{const s=t*t,r=i*(e*e-s)+s;return r<0?0:Math.sqrt(r)},Rs=[xi,Ci,Pi];function ks(t){const e=(i=t,Rs.find(t=>t.test(i)));var i;if(!Boolean(e))return!1;let s=e.parse(t);return e===Pi&&(s=function({hue:t,saturation:e,lightness:i,alpha:s}){t/=360,i/=100;let r=0,n=0,a=0;if(e/=100){const s=i<.5?i*(1+e):i+e-i*e,o=2*i-s;r=bs(o,s,t+1/3),n=bs(o,s,t),a=bs(o,s,t-1/3)}else r=n=a=i;return{red:Math.round(255*r),green:Math.round(255*n),blue:Math.round(255*a),alpha:s}}(s)),s}const ws=(t,e)=>{const i=ks(t),s=ks(e);if(!i||!s)return Is(t,e);const r={...i};return t=>(r.red=Ls(i.red,s.red,t),r.green=Ls(i.green,s.green,t),r.blue=Ls(i.blue,s.blue,t),r.alpha=Ss(i.alpha,s.alpha,t),Ci.transform(r))},Ds=(t,e)=>i=>e(t(i)),Cs=(...t)=>t.reduce(Ds),xs=new Set(["none","hidden"]);function Ps(t,e){return i=>Ss(t,e,i)}function Ms(t){return"number"==typeof t?Ps:"string"==typeof t?Ut(t)?Is:Mi.test(t)?ws:Fs:Array.isArray(t)?Os:"object"==typeof t?Mi.test(t)?ws:Bs:Is}function Os(t,e){const i=[...t],s=i.length,r=t.map((t,i)=>Ms(t)(t,e[i]));return t=>{for(let e=0;e<s;e++)i[e]=r[e](t);return i}}function Bs(t,e){const i={...t,...e},s={};for(const r in i)void 0!==t[r]&&void 0!==e[r]&&(s[r]=Ms(t[r])(t[r],e[r]));return t=>{for(const e in s)i[e]=s[e](t);return i}}const Fs=(t,e)=>{const i=Vi.createTransformer(e),s=_i(t),r=_i(e);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?xs.has(t)&&!r.values.length||xs.has(e)&&!s.values.length?function(t,e){return xs.has(t)?i=>i<=0?t:e:i=>i>=1?e:t}(t,e):Cs(Os(function(t,e){var i;const s=[],r={color:0,var:0,number:0};for(let n=0;n<e.values.length;n++){const a=e.types[n],o=t.indexes[a][r[a]],l=null!==(i=t.values[o])&&void 0!==i?i:0;s[n]=l,r[a]++}return s}(s,r),r.values),i):Is(t,e)};function Ns(t,e,i){if("number"==typeof t&&"number"==typeof e&&"number"==typeof i)return Ss(t,e,i);return Ms(t)(t,e)}function _s(t,e,i){const s=Math.max(e-5,0);return Ue(i-t(s),e-s)}const Us=100,Hs=10,js=1,Vs=0,Gs=800,Qs=.3,Ks=.3,qs={granular:.01,default:2},Ws={granular:.005,default:.5},Ys=.01,$s=10,zs=.05,Xs=1,Zs=.001;function Js({duration:t=Gs,bounce:e=Qs,velocity:i=Vs,mass:s=js}){let r,n,a=1-e;a=Vt(zs,Xs,a),t=Vt(Ys,$s,Ze(t)),a<1?(r=e=>{const s=e*a,r=s*t,n=s-i,o=er(e,a),l=Math.exp(-r);return Zs-n/o*l},n=e=>{const s=e*a*t,n=s*i+i,o=Math.pow(a,2)*Math.pow(e,2)*t,l=Math.exp(-s),d=er(Math.pow(e,2),a);return(-r(e)+Zs>0?-1:1)*((n-o)*l)/d}):(r=e=>Math.exp(-e*t)*((e-i)*t+1)-.001,n=e=>Math.exp(-e*t)*(t*t*(i-e)));const o=function(t,e,i){let s=i;for(let r=1;r<tr;r++)s-=t(s)/e(s);return s}(r,n,5/t);if(t=Xe(t),isNaN(o))return{stiffness:Us,damping:Hs,duration:t};{const e=Math.pow(o,2)*s;return{stiffness:e,damping:2*a*Math.sqrt(s*e),duration:t}}}const tr=12;function er(t,e){return t*Math.sqrt(1-e*e)}const ir=["duration","bounce"],sr=["stiffness","damping","mass"];function rr(t,e){return e.some(e=>void 0!==t[e])}function nr(t=Ks,e=Qs){const i="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:r}=i;const n=i.keyframes[0],a=i.keyframes[i.keyframes.length-1],o={done:!1,value:n},{stiffness:l,damping:d,mass:h,duration:c,velocity:u,isResolvedFromDuration:f}=function(t){let e={velocity:Vs,stiffness:Us,damping:Hs,mass:js,isResolvedFromDuration:!1,...t};if(!rr(t,sr)&&rr(t,ir))if(t.visualDuration){const i=t.visualDuration,s=2*Math.PI/(1.2*i),r=s*s,n=2*Vt(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:js,stiffness:r,damping:n}}else{const i=Js(t);e={...e,...i,mass:js},e.isResolvedFromDuration=!0}return e}({...i,velocity:-Ze(i.velocity||0)}),g=u||0,m=d/(2*Math.sqrt(l*h)),p=a-n,A=Ze(Math.sqrt(l/h)),v=Math.abs(p)<5;let y;if(s||(s=v?qs.granular:qs.default),r||(r=v?Ws.granular:Ws.default),m<1){const t=er(A,m);y=e=>{const i=Math.exp(-m*A*e);return a-i*((g+m*A*p)/t*Math.sin(t*e)+p*Math.cos(t*e))}}else if(1===m)y=t=>a-Math.exp(-A*t)*(p+(g+A*p)*t);else{const t=A*Math.sqrt(m*m-1);y=e=>{const i=Math.exp(-m*A*e),s=Math.min(t*e,300);return a-i*((g+m*A*p)*Math.sinh(s)+t*p*Math.cosh(s))/t}}const E={calculatedDuration:f&&c||null,next:t=>{const e=y(t);if(f)o.done=t>=c;else{let i=0;m<1&&(i=0===t?Xe(g):_s(y,t,e));const n=Math.abs(i)<=s,l=Math.abs(a-e)<=r;o.done=n&&l}return o.value=o.done?a:e,o},toString:()=>{const t=Math.min(Ts(E),Es),e=ai(e=>E.next(t*e).value,t,30);return t+"ms "+e}};return E}function ar({keyframes:t,velocity:e=0,power:i=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:n=500,modifyTarget:a,min:o,max:l,restDelta:d=.5,restSpeed:h}){const c=t[0],u={done:!1,value:c},f=t=>void 0===o?l:void 0===l||Math.abs(o-t)<Math.abs(l-t)?o:l;let g=i*e;const m=c+g,p=void 0===a?m:a(m);p!==m&&(g=p-c);const A=t=>-g*Math.exp(-t/s),v=t=>p+A(t),y=t=>{const e=A(t),i=v(t);u.done=Math.abs(e)<=d,u.value=u.done?p:i};let E,T;const S=t=>{var e;(e=u.value,void 0!==o&&e<o||void 0!==l&&e>l)&&(E=t,T=nr({keyframes:[u.value,f(u.value)],velocity:_s(v,t,u.value),damping:r,stiffness:n,restDelta:d,restSpeed:h}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==E||(e=!0,y(t),S(t)),void 0!==E&&t>=E?T.next(t-E):(!e&&y(t),u)}}}const or=ui(.42,0,1,1),lr=ui(0,0,.58,1),dr=ui(.42,0,.58,1),hr=t=>Array.isArray(t)&&"number"!=typeof t[0],cr={linear:j,easeIn:or,easeInOut:dr,easeOut:lr,circIn:yi,circInOut:Ti,circOut:Ei,backIn:pi,backInOut:Ai,backOut:mi,anticipate:vi},ur=t=>{if(ei(t)){V(4===t.length);const[e,i,s,r]=t;return ui(e,i,s,r)}return"string"==typeof t?cr[t]:t};function fr(t,e,{clamp:i=!0,ease:s,mixer:r}={}){const n=t.length;if(V(n===e.length),1===n)return()=>e[0];if(2===n&&e[0]===e[1])return()=>e[1];const a=t[0]===t[1];t[0]>t[n-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=function(t,e,i){const s=[],r=i||Ns,n=t.length-1;for(let a=0;a<n;a++){let i=r(t[a],t[a+1]);if(e){const t=Array.isArray(e)?e[a]||j:e;i=Cs(t,i)}s.push(i)}return s}(e,s,r),l=o.length,d=i=>{if(a&&i<t[0])return e[0];let s=0;if(l>1)for(;s<t.length-2&&!(i<t[s+1]);s++);const r=ni(t[s],t[s+1],i);return o[s](r)};return i?e=>d(Vt(t[0],t[n-1],e)):d}function gr(t,e){const i=t[t.length-1];for(let s=1;s<=e;s++){const r=ni(0,e,s);t.push(Ss(i,1,r))}}function mr(t){const e=[0];return gr(e,t.length-1),e}function pr({duration:t=300,keyframes:e,times:i,ease:s="easeInOut"}){const r=hr(s)?s.map(ur):ur(s),n={done:!1,value:e[0]},a=function(t,e){return t.map(t=>t*e)}(i&&i.length===e.length?i:mr(e),t),o=fr(a,e,{ease:Array.isArray(r)?r:(l=e,d=r,l.map(()=>d||dr).splice(0,l.length-1))});var l,d;return{calculatedDuration:t,next:e=>(n.value=o(e),n.done=e>=t,n)}}const Ar=t=>{const e=({timestamp:e})=>t(e);return{start:()=>q.update(e,!0),stop:()=>W(e),now:()=>Y.isProcessing?Y.timestamp:Be.now()}},vr={decay:ar,inertia:ar,tween:pr,keyframes:pr,spring:nr},yr=t=>t/100;class Er extends ys{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:i,element:s,keyframes:r}=this.options,n=(null==s?void 0:s.KeyframeResolver)||ls;this.resolver=new n(r,(t,e)=>this.onKeyframesResolved(t,e),e,i,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:r,velocity:n=0}=this.options,a=Je(e)?e:vr[e]||pr;let o,l;a!==pr&&"number"!=typeof t[0]&&(o=Cs(yr,Ns(t[0],t[1])),t=[0,100]);const d=a({...this.options,keyframes:t});"mirror"===r&&(l=a({...this.options,keyframes:[...t].reverse(),velocity:-n})),null===d.calculatedDuration&&(d.calculatedDuration=Ts(d));const{calculatedDuration:h}=d,c=h+s;return{generator:d,mirroredGenerator:l,mapPercentToKeyframes:o,calculatedDuration:h,resolvedDuration:c,totalDuration:c*(i+1)-s}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:i}=this;if(!i){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:s,generator:r,mirroredGenerator:n,mapPercentToKeyframes:a,keyframes:o,calculatedDuration:l,totalDuration:d,resolvedDuration:h}=i;if(null===this.startTime)return r.next(0);const{delay:c,repeat:u,repeatType:f,repeatDelay:g,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const p=this.currentTime-c*(this.speed>=0?1:-1),A=this.speed>=0?p<0:p>d;this.currentTime=Math.max(p,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=d);let v=this.currentTime,y=r;if(u){const t=Math.min(this.currentTime,d)/h;let e=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),1===i&&e--,e=Math.min(e,u+1);Boolean(e%2)&&("reverse"===f?(i=1-i,g&&(i-=g/h)):"mirror"===f&&(y=n)),v=Vt(0,1,i)*h}const E=A?{done:!1,value:o[0]}:y.next(v);a&&(E.value=a(E.value));let{done:T}=E;A||null===l||(T=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&T);return S&&void 0!==s&&(E.value=vs(o,this.options,s)),m&&m(E.value),S&&this.finish(),E}get duration(){const{resolved:t}=this;return t?Ze(t.calculatedDuration):0}get time(){return Ze(this.currentTime)}set time(t){t=Xe(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=Ze(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Ar,onPlay:e,startTime:i}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),e&&e();const s=this.driver.now();null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=s):this.startTime=null!=i?i:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const Tr=new Set(["opacity","clipPath","filter","transform"]);function Sr(t,e,i,{delay:s=0,duration:r=300,repeat:n=0,repeatType:a="loop",ease:o="easeInOut",times:l}={}){const d={[e]:i};l&&(d.offset=l);const h=hi(o,r);return Array.isArray(h)&&(d.easing=h),t.animate(d,{delay:s,duration:r,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:n+1,direction:"reverse"===a?"alternate":"normal"})}const br=We(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));const Ir={anticipate:vi,backInOut:Ai,circInOut:Ti};class Lr extends ys{constructor(t){super(t);const{name:e,motionValue:i,element:s,keyframes:r}=this.options;this.resolver=new ms(r,(t,e)=>this.onKeyframesResolved(t,e),e,i,s),this.resolver.scheduleResolve()}initPlayback(t,e){let{duration:i=300,times:s,ease:r,type:n,motionValue:a,name:o,startTime:l}=this.options;if(!a.owner||!a.owner.current)return!1;var d;if("string"==typeof r&&ri()&&r in Ir&&(r=Ir[r]),Je((d=this.options).type)||"spring"===d.type||!oi(d.ease)){const{onComplete:e,onUpdate:a,motionValue:o,element:l,...d}=this.options,h=function(t,e){const i=new Er({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const r=[];let n=0;for(;!s.done&&n<2e4;)s=i.sample(n),r.push(s.value),n+=10;return{times:void 0,keyframes:r,duration:n-10,ease:"linear"}}(t,d);1===(t=h.keyframes).length&&(t[1]=t[0]),i=h.duration,s=h.times,r=h.ease,n="keyframes"}const h=Sr(a.owner.current,o,t,{...this.options,duration:i,times:s,ease:r});return h.startTime=null!=l?l:this.calcStartTime(),this.pendingTimeline?(ti(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:i}=this.options;a.set(vs(t,this.options,e)),i&&i(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:i,times:s,type:n,ease:r,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return Ze(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return Ze(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:i}=e;i.currentTime=Xe(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:i}=e;i.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return j;const{animation:i}=e;ti(i,t)}else this.pendingTimeline=t;return j}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:i,duration:s,type:r,ease:n,times:a}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:o,element:l,...d}=this.options,h=new Er({...d,keyframes:i,duration:s,type:r,ease:n,times:a,isGenerator:!0}),c=Xe(this.time);t.setWithVelocity(h.sample(c-10).value,h.sample(c).value,10)}const{onStop:o}=this.options;o&&o(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:i,repeatDelay:s,repeatType:r,damping:n,type:a}=t;if(!(e&&e.owner&&e.owner.current instanceof HTMLElement))return!1;const{onUpdate:o,transformTemplate:l}=e.owner.getProps();return br()&&i&&Tr.has(i)&&!o&&!l&&!s&&"mirror"!==r&&0!==n&&"inertia"!==a}}const Rr={type:"spring",stiffness:500,damping:25,restSpeed:10},kr={type:"keyframes",duration:.8},wr={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Dr=(t,{keyframes:e})=>e.length>2?kr:Bt.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Rr:wr;const Cr=(t,e,i,s={},r,n)=>a=>{const o=xe(s,t)||{},l=o.delay||s.delay||0;let{elapsed:d=0}=s;d-=Xe(l);let h={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...o,delay:-d,onUpdate:t=>{e.set(t),o.onUpdate&&o.onUpdate(t)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:t,motionValue:e,element:n?void 0:r};(function({when:t,delay:e,delayChildren:i,staggerChildren:s,staggerDirection:r,repeat:n,repeatType:a,repeatDelay:o,from:l,elapsed:d,...h}){return!!Object.keys(h).length})(o)||(h={...h,...Dr(t,h)}),h.duration&&(h.duration=Xe(h.duration)),h.repeatDelay&&(h.repeatDelay=Xe(h.repeatDelay)),void 0!==h.from&&(h.keyframes[0]=h.from);let c=!1;if((!1===h.type||0===h.duration&&!h.repeatDelay)&&(h.duration=0,0===h.delay&&(c=!0)),c&&!n&&void 0!==e.get()){const t=vs(h.keyframes,o);if(void 0!==t)return q.update(()=>{h.onUpdate(t),h.onComplete()}),new ze([])}return!n&&Lr.supports(h)?new Lr(h):new Er(h)};function xr({protectedKeys:t,needsAnimating:e},i){const s=t.hasOwnProperty(i)&&!0!==e[i];return e[i]=!1,s}function Pr(t,e,{delay:i=0,transitionOverride:s,type:r}={}){var n;let{transition:a=t.getDefaultTransition(),transitionEnd:o,...l}=e;s&&(a=s);const d=[],h=r&&t.animationState&&t.animationState.getState()[r];for(const c in l){const e=t.getValue(c,null!==(n=t.latestValues[c])&&void 0!==n?n:null),s=l[c];if(void 0===s||h&&xr(h,c))continue;const r={delay:i,...xe(a||{},c)};let o=!1;if(window.MotionHandoffAnimation){const e=qe(t);if(e){const t=window.MotionHandoffAnimation(e,c,q);null!==t&&(r.startTime=t,o=!0)}}Ke(t,c),e.start(Cr(c,e,s,t.shouldReduceMotion&&Pe.has(c)?{type:!1}:r,t,o));const u=e.animation;u&&d.push(u)}return o&&Promise.all(d).then(()=>{q.update(()=>{o&&Qe(t,o)})}),d}function Mr(t,e,i={}){var s;const r=Ce(t,e,"exit"===i.type?null===(s=t.presenceContext)||void 0===s?void 0:s.custom:void 0);let{transition:n=t.getDefaultTransition()||{}}=r||{};i.transitionOverride&&(n=i.transitionOverride);const a=r?()=>Promise.all(Pr(t,r,i)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(s=0)=>{const{delayChildren:r=0,staggerChildren:a,staggerDirection:o}=n;return function(t,e,i=0,s=0,r=1,n){const a=[],o=(t.variantChildren.size-1)*s,l=1===r?(t=0)=>t*s:(t=0)=>o-t*s;return Array.from(t.variantChildren).sort(Or).forEach((t,s)=>{t.notify("AnimationStart",e),a.push(Mr(t,e,{...n,delay:i+l(s)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(a)}(t,e,r+s,a,o,i)}:()=>Promise.resolve(),{when:l}=n;if(l){const[t,e]="beforeChildren"===l?[a,o]:[o,a];return t().then(()=>e())}return Promise.all([a(),o(i.delay)])}function Or(t,e){return t.sortNodePosition(e)}function Br(t,e,i={}){let s;if(t.notify("AnimationStart",e),Array.isArray(e)){const r=e.map(e=>Mr(t,e,i));s=Promise.all(r)}else if("string"==typeof e)s=Mr(t,e,i);else{const r="function"==typeof e?Ce(t,e,i.custom):e;s=Promise.all(Pr(t,r,i))}return s.then(()=>{t.notify("AnimationComplete",e)})}const Fr=lt.length;function Nr(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Nr(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let i=0;i<Fr;i++){const s=lt[i],r=t.props[s];(nt(r)||!1===r)&&(e[s]=r)}return e}const _r=[...ot].reverse(),Ur=ot.length;function Hr(t){let e=function(t){return e=>Promise.all(e.map(({animation:e,options:i})=>Br(t,e,i)))}(t),i=Gr(),s=!0;const r=e=>(i,s)=>{var r;const n=Ce(t,s,"exit"===e?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);if(n){const{transition:t,transitionEnd:e,...s}=n;i={...i,...s,...e}}return i};function n(n){const{props:a}=t,o=Nr(t.parent)||{},l=[],d=new Set;let h={},c=1/0;for(let e=0;e<Ur;e++){const u=_r[e],f=i[u],g=void 0!==a[u]?a[u]:o[u],m=nt(g),p=u===n?f.isActive:null;!1===p&&(c=e);let A=g===o[u]&&g!==a[u]&&m;if(A&&s&&t.manuallyAnimateOnMount&&(A=!1),f.protectedKeys={...h},!f.isActive&&null===p||!g&&!f.prevProp||at(g)||"boolean"==typeof g)continue;const v=jr(f.prevProp,g);let y=v||u===n&&f.isActive&&!A&&m||e>c&&m,E=!1;const T=Array.isArray(g)?g:[g];let S=T.reduce(r(u),{});!1===p&&(S={});const{prevResolvedValues:b={}}=f,I={...b,...S},L=e=>{y=!0,d.has(e)&&(E=!0,d.delete(e)),f.needsAnimating[e]=!0;const i=t.getValue(e);i&&(i.liveStyle=!1)};for(const t in I){const e=S[t],i=b[t];if(h.hasOwnProperty(t))continue;let s=!1;s=wt(e)&&wt(i)?!De(e,i):e!==i,s?null!=e?L(t):d.add(t):void 0!==e&&d.has(t)?L(t):f.protectedKeys[t]=!0}f.prevProp=g,f.prevResolvedValues=S,f.isActive&&(h={...h,...S}),s&&t.blockInitialAnimation&&(y=!1);y&&(!(A&&v)||E)&&l.push(...T.map(t=>({animation:t,options:{type:u}})))}if(d.size){const e={};d.forEach(i=>{const s=t.getBaseTarget(i),r=t.getValue(i);r&&(r.liveStyle=!0),e[i]=null!=s?s:null}),l.push({animation:e})}let u=Boolean(l.length);return!s||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(u=!1),s=!1,u?e(l):Promise.resolve()}return{animateChanges:n,setActive:function(e,s){var r;if(i[e].isActive===s)return Promise.resolve();null===(r=t.variantChildren)||void 0===r||r.forEach(t=>{var i;return null===(i=t.animationState)||void 0===i?void 0:i.setActive(e,s)}),i[e].isActive=s;const a=n(e);for(const t in i)i[t].protectedKeys={};return a},setAnimateFunction:function(i){e=i(t)},getState:()=>i,reset:()=>{i=Gr(),s=!0}}}function jr(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!De(e,t)}function Vr(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Gr(){return{animate:Vr(!0),whileInView:Vr(),whileHover:Vr(),whileTap:Vr(),whileDrag:Vr(),whileFocus:Vr(),exit:Vr()}}class Qr{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Kr=0;const qr={animation:{Feature:class extends Qr{constructor(t){super(t),t.animationState||(t.animationState=Hr(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();at(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends Qr{constructor(){super(...arguments),this.id=Kr++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const s=this.node.animationState.setActive("exit",!t);e&&!t&&s.then(()=>e(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}},Wr={x:!1,y:!1};function Yr(){return Wr.x||Wr.y}const $r=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary;function zr(t,e,i,s={passive:!0}){return t.addEventListener(e,i,s),()=>t.removeEventListener(e,i)}function Xr(t){return{point:{x:t.pageX,y:t.pageY}}}function Zr(t,e,i,s){return zr(t,e,(t=>e=>$r(e)&&t(e,Xr(e)))(i),s)}const Jr=(t,e)=>Math.abs(t-e);class tn{constructor(t,e,{transformPagePoint:i,contextWindow:s,dragSnapToOrigin:r=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=rn(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,i=function(t,e){const i=Jr(t.x,e.x),s=Jr(t.y,e.y);return Math.sqrt(i**2+s**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!i)return;const{point:s}=t,{timestamp:r}=Y;this.history.push({...s,timestamp:r});const{onStart:n,onMove:a}=this.handlers;e||(n&&n(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),a&&a(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=en(e,this.transformPagePoint),q.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:i,onSessionEnd:s,resumeAnimation:r}=this.handlers;if(this.dragSnapToOrigin&&r&&r(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const n=rn("pointercancel"===t.type?this.lastMoveEventInfo:en(e,this.transformPagePoint),this.history);this.startEvent&&i&&i(t,n),s&&s(t,n)},!$r(t))return;this.dragSnapToOrigin=r,this.handlers=e,this.transformPagePoint=i,this.contextWindow=s||window;const n=en(Xr(t),this.transformPagePoint),{point:a}=n,{timestamp:o}=Y;this.history=[{...a,timestamp:o}];const{onSessionStart:l}=e;l&&l(t,rn(n,this.history)),this.removeListeners=Cs(Zr(this.contextWindow,"pointermove",this.handlePointerMove),Zr(this.contextWindow,"pointerup",this.handlePointerUp),Zr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),W(this.updatePoint)}}function en(t,e){return e?{point:e(t.point)}:t}function sn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function rn({point:t},e){return{point:t,delta:sn(t,an(e)),offset:sn(t,nn(e)),velocity:on(e,.1)}}function nn(t){return t[0]}function an(t){return t[t.length-1]}function on(t,e){if(t.length<2)return{x:0,y:0};let i=t.length-1,s=null;const r=an(t);for(;i>=0&&(s=t[i],!(r.timestamp-s.timestamp>Xe(e)));)i--;if(!s)return{x:0,y:0};const n=Ze(r.timestamp-s.timestamp);if(0===n)return{x:0,y:0};const a={x:(r.x-s.x)/n,y:(r.y-s.y)/n};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function ln(t){return t.max-t.min}function dn(t,e,i,s=.5){t.origin=s,t.originPoint=Ss(e.min,e.max,t.origin),t.scale=ln(i)/ln(e),t.translate=Ss(i.min,i.max,t.origin)-t.originPoint,(t.scale>=.9999&&t.scale<=1.0001||isNaN(t.scale))&&(t.scale=1),(t.translate>=-.01&&t.translate<=.01||isNaN(t.translate))&&(t.translate=0)}function hn(t,e,i,s){dn(t.x,e.x,i.x,s?s.originX:void 0),dn(t.y,e.y,i.y,s?s.originY:void 0)}function cn(t,e,i){t.min=i.min+e.min,t.max=t.min+ln(e)}function un(t,e,i){t.min=e.min-i.min,t.max=t.min+ln(e)}function fn(t,e,i){un(t.x,e.x,i.x),un(t.y,e.y,i.y)}function gn(t,e,i){return{min:void 0!==e?t.min+e:void 0,max:void 0!==i?t.max+i-(t.max-t.min):void 0}}function mn(t,e){let i=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([i,s]=[s,i]),{min:i,max:s}}const pn=.35;function An(t,e,i){return{min:vn(t,e),max:vn(t,i)}}function vn(t,e){return"number"==typeof t?t:t[e]||0}const yn=()=>({x:{min:0,max:0},y:{min:0,max:0}});function En(t){return[t("x"),t("y")]}function Tn({top:t,left:e,right:i,bottom:s}){return{x:{min:e,max:i},y:{min:t,max:s}}}function Sn(t){return void 0===t||1===t}function bn({scale:t,scaleX:e,scaleY:i}){return!Sn(t)||!Sn(e)||!Sn(i)}function In(t){return bn(t)||Ln(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Ln(t){return Rn(t.x)||Rn(t.y)}function Rn(t){return t&&"0%"!==t}function kn(t,e,i){return i+e*(t-i)}function wn(t,e,i,s,r){return void 0!==r&&(t=kn(t,r,s)),kn(t,i,s)+e}function Dn(t,e=0,i=1,s,r){t.min=wn(t.min,e,i,s,r),t.max=wn(t.max,e,i,s,r)}function Cn(t,{x:e,y:i}){Dn(t.x,e.translate,e.scale,e.originPoint),Dn(t.y,i.translate,i.scale,i.originPoint)}const xn=.999999999999,Pn=1.0000000000001;function Mn(t,e){t.min=t.min+e,t.max=t.max+e}function On(t,e,i,s,r=.5){Dn(t,e,i,Ss(t.min,t.max,r),s)}function Bn(t,e){On(t.x,e.x,e.scaleX,e.scale,e.originX),On(t.y,e.y,e.scaleY,e.scale,e.originY)}function Fn(t,e){return Tn(function(t,e){if(!e)return t;const i=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:s.y,right:s.x}}(t.getBoundingClientRect(),e))}const Nn=({current:t})=>t?t.ownerDocument.defaultView:null,_n=new WeakMap;class Un{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=t}start(t,{snapToCursor:e=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&!1===i.isPresent)return;const{dragSnapToOrigin:s}=this.getProps();this.panSession=new tn(t,{onSessionStart:t=>{const{dragSnapToOrigin:i}=this.getProps();i?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(Xr(t).point)},onStart:(t,e)=>{const{drag:i,dragPropagation:s,onDragStart:r}=this.getProps();if(i&&!s&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(n=i)||"y"===n?Wr[n]?null:(Wr[n]=!0,()=>{Wr[n]=!1}):Wr.x||Wr.y?null:(Wr.x=Wr.y=!0,()=>{Wr.x=Wr.y=!1}),!this.openDragLock))return;var n;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),En(t=>{let e=this.getAxisMotionValue(t).get()||0;if(Yt.test(e)){const{projection:i}=this.visualElement;if(i&&i.layout){const s=i.layout.layoutBox[t];if(s){e=ln(s)*(parseFloat(e)/100)}}}this.originPoint[t]=e}),r&&q.postRender(()=>r(t,e)),Ke(this.visualElement,"transform");const{animationState:a}=this.visualElement;a&&a.setActive("whileDrag",!0)},onMove:(t,e)=>{const{dragPropagation:i,dragDirectionLock:s,onDirectionLock:r,onDrag:n}=this.getProps();if(!i&&!this.openDragLock)return;const{offset:a}=e;if(s&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let i=null;Math.abs(t.y)>e?i="y":Math.abs(t.x)>e&&(i="x");return i}(a),void(null!==this.currentDirection&&r&&r(this.currentDirection));this.updateAxis("x",e.point,a),this.updateAxis("y",e.point,a),this.visualElement.render(),n&&n(t,e)},onSessionEnd:(t,e)=>this.stop(t,e),resumeAnimation:()=>En(t=>{var e;return"paused"===this.getAnimationState(t)&&(null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.play())})},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,contextWindow:Nn(this.visualElement)})}stop(t,e){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:s}=e;this.startAnimation(s);const{onDragEnd:r}=this.getProps();r&&q.postRender(()=>r(t,e))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(t,e,i){const{drag:s}=this.getProps();if(!i||!Hn(t,s,this.currentDirection))return;const r=this.getAxisMotionValue(t);let n=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(n=function(t,{min:e,max:i},s){return void 0!==e&&t<e?t=s?Ss(e,t,s.min):Math.max(t,e):void 0!==i&&t>i&&(t=s?Ss(i,t,s.max):Math.min(t,i)),t}(n,this.constraints[t],this.elastic[t])),r.set(n)}resolveConstraints(){var t;const{dragConstraints:e,dragElastic:i}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(t=this.visualElement.projection)||void 0===t?void 0:t.layout,r=this.constraints;e&&gt(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!s)&&function(t,{top:e,left:i,bottom:s,right:r}){return{x:gn(t.x,i,r),y:gn(t.y,e,s)}}(s.layoutBox,e),this.elastic=function(t=pn){return!1===t?t=0:!0===t&&(t=pn),{x:An(t,"left","right"),y:An(t,"top","bottom")}}(i),r!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&En(t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const i={};return void 0!==e.min&&(i.min=e.min-t.min),void 0!==e.max&&(i.max=e.max-t.min),i}(s.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!gt(t))return!1;const i=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const r=function(t,e,i){const s=Fn(t,i),{scroll:r}=e;return r&&(Mn(s.x,r.offset.x),Mn(s.y,r.offset.y)),s}(i,s.root,this.visualElement.getTransformPagePoint());let n=function(t,e){return{x:mn(t.x,e.x),y:mn(t.y,e.y)}}(s.layout.layoutBox,r);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(n));this.hasMutatedConstraints=!!t,t&&(n=Tn(t))}return n}startAnimation(t){const{drag:e,dragMomentum:i,dragElastic:s,dragTransition:r,dragSnapToOrigin:n,onDragTransitionEnd:a}=this.getProps(),o=this.constraints||{},l=En(a=>{if(!Hn(a,e,this.currentDirection))return;let l=o&&o[a]||{};n&&(l={min:0,max:0});const d=s?200:1e6,h=s?40:1e7,c={type:"inertia",velocity:i?t[a]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...r,...l};return this.startAxisValueAnimation(a,c)});return Promise.all(l).then(a)}startAxisValueAnimation(t,e){const i=this.getAxisMotionValue(t);return Ke(this.visualElement,t),i.start(Cr(t,i,0,e,this.visualElement,!1))}stopAnimation(){En(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){En(t=>{var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.pause()})}getAnimationState(t){var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.state}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),s=i[e];return s||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){En(e=>{const{drag:i}=this.getProps();if(!Hn(e,i,this.currentDirection))return;const{projection:s}=this.visualElement,r=this.getAxisMotionValue(e);if(s&&s.layout){const{min:i,max:n}=s.layout.layoutBox[e];r.set(t[e]-Ss(i,n,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:i}=this.visualElement;if(!gt(e)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};En(t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const i=e.get();s[t]=function(t,e){let i=.5;const s=ln(t),r=ln(e);return r>s?i=ni(e.min,e.max-s,t.min):s>r&&(i=ni(t.min,t.max-r,e.min)),Vt(0,1,i)}({min:i,max:i},this.constraints[t])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),En(e=>{if(!Hn(e,t,null))return;const i=this.getAxisMotionValue(e),{min:r,max:n}=this.constraints[e];i.set(Ss(r,n,s[e]))})}addListeners(){if(!this.visualElement.current)return;_n.set(this.visualElement,this);const t=Zr(this.visualElement.current,"pointerdown",t=>{const{drag:e,dragListener:i=!0}=this.getProps();e&&i&&this.start(t)}),e=()=>{const{dragConstraints:t}=this.getProps();gt(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",e);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),q.read(e);const r=zr(window,"resize",()=>this.scalePositionWithinConstraints()),n=i.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(En(e=>{const i=this.getAxisMotionValue(e);i&&(this.originPoint[e]+=t[e].translate,i.set(i.get()+t[e].translate))}),this.visualElement.render())});return()=>{r(),t(),s(),n&&n()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:i=!1,dragPropagation:s=!1,dragConstraints:r=!1,dragElastic:n=pn,dragMomentum:a=!0}=t;return{...t,drag:e,dragDirectionLock:i,dragPropagation:s,dragConstraints:r,dragElastic:n,dragMomentum:a}}}function Hn(t,e,i){return!(!0!==e&&e!==t||null!==i&&i!==t)}const jn=t=>(e,i)=>{t&&q.postRender(()=>t(e,i))};const Vn={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Gn(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Qn={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!$t.test(t))return t;t=parseFloat(t)}return`${Gn(t,e.target.x)}% ${Gn(t,e.target.y)}%`}},Kn={correct:(t,{treeScale:e,projectionDelta:i})=>{const s=t,r=Vi.parse(t);if(r.length>5)return s;const n=Vi.createTransformer(t),a="number"!=typeof r[0]?1:0,o=i.x.scale*e.x,l=i.y.scale*e.y;r[0+a]/=o,r[1+a]/=l;const d=Ss(o,l,.5);return"number"==typeof r[2+a]&&(r[2+a]/=d),"number"==typeof r[3+a]&&(r[3+a]/=d),n(r)}};class qn extends e.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i,layoutId:s}=this.props,{projection:r}=t;var n;n=Yn,Object.assign(pe,n),r&&(e.group&&e.group.add(r),i&&i.register&&s&&i.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),Vn.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:i,drag:s,isPresent:r}=this.props,n=i.projection;return n?(n.isPresent=r,s||t.layoutDependency!==e||void 0===e?n.willUpdate():this.safeToRemove(),t.isPresent!==r&&(r?n.promote():n.relegate()||q.postRender(()=>{const t=n.getStack();t&&t.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),vt.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(s),i&&i.deregister&&i.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Wn(t){const[i,r]=function(t=!0){const i=e.useContext(N);if(null===i)return[!0,null];const{isPresent:s,onExitComplete:r,register:n}=i,a=e.useId();e.useEffect(()=>{t&&n(a)},[t]);const o=e.useCallback(()=>t&&r&&r(a),[a,r,t]);return!s&&r?[!1,o]:[!0]}(),n=e.useContext(B);return s.jsx(qn,{...t,layoutGroup:n,switchLayoutGroup:e.useContext(yt),isPresent:i,safeToRemove:r})}const Yn={borderRadius:{...Qn,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Qn,borderTopRightRadius:Qn,borderBottomLeftRadius:Qn,borderBottomRightRadius:Qn,boxShadow:Kn};function $n(t,e,i){const s=Ct(t)?t:Ve(t);return s.start(Cr("",s,e,i)),s.animation}function zn(t){return t instanceof SVGElement&&"svg"!==t.tagName}const Xn=(t,e)=>t.depth-e.depth;class Zn{constructor(){this.children=[],this.isDirty=!1}add(t){Fe(this.children,t),this.isDirty=!0}remove(t){Ne(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Xn),this.isDirty=!1,this.children.forEach(t)}}const Jn=["TopLeft","TopRight","BottomLeft","BottomRight"],ta=Jn.length,ea=t=>"string"==typeof t?parseFloat(t):t,ia=t=>"number"==typeof t||$t.test(t);function sa(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const ra=aa(0,.5,Ei),na=aa(.5,.95,j);function aa(t,e,i){return s=>s<t?0:s>e?1:i(ni(t,e,s))}function oa(t,e){t.min=e.min,t.max=e.max}function la(t,e){oa(t.x,e.x),oa(t.y,e.y)}function da(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function ha(t,e,i,s,r){return t=kn(t-=e,1/i,s),void 0!==r&&(t=kn(t,1/r,s)),t}function ca(t,e,[i,s,r],n,a){!function(t,e=0,i=1,s=.5,r,n=t,a=t){Yt.test(e)&&(e=parseFloat(e),e=Ss(a.min,a.max,e/100)-a.min);if("number"!=typeof e)return;let o=Ss(n.min,n.max,s);t===n&&(o-=e),t.min=ha(t.min,e,i,o,r),t.max=ha(t.max,e,i,o,r)}(t,e[i],e[s],e[r],e.scale,n,a)}const ua=["x","scaleX","originX"],fa=["y","scaleY","originY"];function ga(t,e,i,s){ca(t.x,e,ua,i?i.x:void 0,s?s.x:void 0),ca(t.y,e,fa,i?i.y:void 0,s?s.y:void 0)}function ma(t){return 0===t.translate&&1===t.scale}function pa(t){return ma(t.x)&&ma(t.y)}function Aa(t,e){return t.min===e.min&&t.max===e.max}function va(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function ya(t,e){return va(t.x,e.x)&&va(t.y,e.y)}function Ea(t){return ln(t.x)/ln(t.y)}function Ta(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Sa{constructor(){this.members=[]}add(t){Fe(this.members,t),t.scheduleRender()}remove(t){if(Ne(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex(e=>t===e);if(0===e)return!1;let i;for(let s=e;s>=0;s--){const t=this.members[s];if(!1!==t.isPresent){i=t;break}}return!!i&&(this.promote(i),!0)}promote(t,e){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,e&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;!1===s&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:e,resumingFrom:i}=t;e.onExitComplete&&e.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const ba={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Ia="undefined"!=typeof window&&void 0!==window.MotionDebug,La=["","X","Y","Z"],Ra={visibility:"hidden"};let ka=0;function wa(t,e,i,s){const{latestValues:r}=e;r[t]&&(i[t]=r[t],e.setStaticValue(t,0),s&&(s[t]=0))}function Da(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const i=qe(e);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:e,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",q,!(e||s))}const{parent:s}=t;s&&!s.hasCheckedOptimisedAppear&&Da(s)}function Ca({attachResizeListener:t,defaultParent:e,measureScroll:i,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(t={},i=(null==e?void 0:e())){this.id=ka++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Ia&&(ba.totalNodes=ba.resolvedTargetDeltas=ba.recalculatedProjection=0),this.nodes.forEach(Ma),this.nodes.forEach(Ha),this.nodes.forEach(ja),this.nodes.forEach(Oa),Ia&&window.MotionDebug.record(ba)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=i?i.root||i:this,this.path=i?[...i.path,i]:[],this.parent=i,this.depth=i?i.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new Zn)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new _e),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const i=this.eventHandlers.get(t);i&&i.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e,i=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=zn(e),this.instance=e;const{layoutId:s,layout:r,visualElement:n}=this.options;if(n&&!n.current&&n.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),i&&(r||s)&&(this.isLayoutDirty=!0),t){let i;const s=()=>this.root.updateBlockedByResize=!1;t(e,()=>{this.root.updateBlockedByResize=!0,i&&i(),i=function(t,e){const i=Be.now(),s=({timestamp:r})=>{const n=r-i;n>=e&&(W(s),t(n-e))};return q.read(s,!0),()=>W(s)}(s,250),Vn.hasAnimatedSinceResize&&(Vn.hasAnimatedSinceResize=!1,this.nodes.forEach(Ua))})}s&&this.root.registerSharedNode(s,this),!1!==this.options.animate&&n&&(s||r)&&this.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e,hasRelativeTargetChanged:i,layout:s})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const r=this.options.transition||n.getDefaultTransition()||Wa,{onLayoutAnimationStart:a,onLayoutAnimationComplete:o}=n.getProps(),l=!this.targetLayout||!ya(this.targetLayout,s)||i,d=!e&&i;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||d||e&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,d);const e={...xe(r,"layout"),onPlay:a,onComplete:o};(n.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||Ua(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=s})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,W(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Va),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Da(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let r=0;r<this.path.length;r++){const t=this.path[r];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(Fa);this.isUpdating||this.nodes.forEach(Na),this.isUpdating=!1,this.nodes.forEach(_a),this.nodes.forEach(xa),this.nodes.forEach(Pa),this.clearAllSnapshots();const t=Be.now();Y.delta=Vt(0,1e3/60,t-Y.timestamp),Y.timestamp=t,Y.isProcessing=!0,$.update.process(Y),$.preRender.process(Y),$.render.process(Y),Y.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,vt.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ba),this.sharedNodes.forEach(Ga)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,q.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){q.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let i=0;i<this.path.length;i++){this.path[i].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}},this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(t="measure"){let e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e){const e=s(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!r)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!pa(this.projectionDelta),i=this.getTransformTemplate(),s=i?i(this.latestValues,""):void 0,n=s!==this.prevTransformTemplateValue;t&&(e||In(this.latestValues)||n)&&(r(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let i=this.removeElementScroll(e);var s;return t&&(i=this.removeTransform(i)),za((s=i).x),za(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){var t;const{visualElement:e}=this.options;if(!e)return{x:{min:0,max:0},y:{min:0,max:0}};const i=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(Za))){const{scroll:t}=this.root;t&&(Mn(i.x,t.offset.x),Mn(i.y,t.offset.y))}return i}removeElementScroll(t){var e;const i={x:{min:0,max:0},y:{min:0,max:0}};if(la(i,t),null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)return i;for(let s=0;s<this.path.length;s++){const e=this.path[s],{scroll:r,options:n}=e;e!==this.root&&r&&n.layoutScroll&&(r.wasRoot&&la(i,t),Mn(i.x,r.offset.x),Mn(i.y,r.offset.y))}return i}applyTransform(t,e=!1){const i={x:{min:0,max:0},y:{min:0,max:0}};la(i,t);for(let s=0;s<this.path.length;s++){const t=this.path[s];!e&&t.options.layoutScroll&&t.scroll&&t!==t.root&&Bn(i,{x:-t.scroll.offset.x,y:-t.scroll.offset.y}),In(t.latestValues)&&Bn(i,t.latestValues)}return In(this.latestValues)&&Bn(i,this.latestValues),i}removeTransform(t){const e={x:{min:0,max:0},y:{min:0,max:0}};la(e,t);for(let i=0;i<this.path.length;i++){const t=this.path[i];if(!t.instance)continue;if(!In(t.latestValues))continue;bn(t.latestValues)&&t.updateSnapshot();const s=yn();la(s,t.measurePageBox()),ga(e,t.latestValues,t.snapshot?t.snapshot.layoutBox:void 0,s)}return In(this.latestValues)&&ga(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Y.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){var e;const i=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=i.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=i.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=i.isSharedProjectionDirty);const s=Boolean(this.resumingFrom)||this!==i;if(!(t||s&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:r,layoutId:n}=this.options;if(this.layout&&(r||n)){if(this.resolvedRelativeTargetAt=Y.timestamp,!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},fn(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),la(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var a,o,l;if(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),a=this.target,o=this.relativeTarget,l=this.relativeParent.target,cn(a.x,o.x,l.x),cn(a.y,o.y,l.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):la(this.target,this.layout.layoutBox),Cn(this.target,this.targetDelta)):la(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const t=this.getClosestProjectingParent();t&&Boolean(t.resumingFrom)===Boolean(this.resumingFrom)&&!t.options.layoutScroll&&t.target&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},fn(this.relativeTargetOrigin,this.target,t.target),la(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Ia&&ba.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!bn(this.parent.latestValues)&&!Ln(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var t;const e=this.getLead(),i=Boolean(this.resumingFrom)||this!==e;let s=!0;if((this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty))&&(s=!1),i&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(s=!1),this.resolvedRelativeTargetAt===Y.timestamp&&(s=!1),s)return;const{layout:r,layoutId:n}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!r&&!n)return;la(this.layoutCorrected,this.layout.layoutBox);const a=this.treeScale.x,o=this.treeScale.y;!function(t,e,i,s=!1){const r=i.length;if(!r)return;let n,a;e.x=e.y=1;for(let o=0;o<r;o++){n=i[o],a=n.projectionDelta;const{visualElement:r}=n.options;r&&r.props.style&&"contents"===r.props.style.display||(s&&n.options.layoutScroll&&n.scroll&&n!==n.root&&Bn(t,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),a&&(e.x*=a.x.scale,e.y*=a.y.scale,Cn(t,a)),s&&In(n.latestValues)&&Bn(t,n.latestValues))}e.x<Pn&&e.x>xn&&(e.x=1),e.y<Pn&&e.y>xn&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,i),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:l}=e;l?(this.projectionDelta&&this.prevProjectionDelta?(da(this.prevProjectionDelta.x,this.projectionDelta.x),da(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),hn(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===a&&this.treeScale.y===o&&Ta(this.projectionDelta.x,this.prevProjectionDelta.x)&&Ta(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l)),Ia&&ba.recalculatedProjection++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){var e;if(null===(e=this.options.visualElement)||void 0===e||e.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(t,e=!1){const i=this.snapshot,s=i?i.latestValues:{},r={...this.latestValues},n={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const a={x:{min:0,max:0},y:{min:0,max:0}},o=(i?i.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),d=!l||l.members.length<=1,h=Boolean(o&&!d&&!0===this.options.crossfade&&!this.path.some(qa));let c;this.animationProgress=0,this.mixTargetDelta=e=>{const i=e/1e3;var l,u,f,g,m,p;Qa(n.x,t.x,i),Qa(n.y,t.y,i),this.setTargetDelta(n),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(fn(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),f=this.relativeTarget,g=this.relativeTargetOrigin,m=a,p=i,Ka(f.x,g.x,m.x,p),Ka(f.y,g.y,m.y,p),c&&(l=this.relativeTarget,u=c,Aa(l.x,u.x)&&Aa(l.y,u.y))&&(this.isProjectionDirty=!1),c||(c={x:{min:0,max:0},y:{min:0,max:0}}),la(c,this.relativeTarget)),o&&(this.animationValues=r,function(t,e,i,s,r,n){r?(t.opacity=Ss(0,void 0!==i.opacity?i.opacity:1,ra(s)),t.opacityExit=Ss(void 0!==e.opacity?e.opacity:1,0,na(s))):n&&(t.opacity=Ss(void 0!==e.opacity?e.opacity:1,void 0!==i.opacity?i.opacity:1,s));for(let a=0;a<ta;a++){const r=`border${Jn[a]}Radius`;let n=sa(e,r),o=sa(i,r);void 0===n&&void 0===o||(n||(n=0),o||(o=0),0===n||0===o||ia(n)===ia(o)?(t[r]=Math.max(Ss(ea(n),ea(o),s),0),(Yt.test(o)||Yt.test(n))&&(t[r]+="%")):t[r]=o)}(e.rotate||i.rotate)&&(t.rotate=Ss(e.rotate||0,i.rotate||0,s))}(r,s,this.latestValues,i,h,d)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(W(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=q.update(()=>{Vn.hasAnimatedSinceResize=!0,this.currentAnimation=$n(0,1e3,{...t,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:s,latestValues:r}=t;if(e&&i&&s){if(this!==t&&this.layout&&s&&Xa(this.options.animationType,this.layout.layoutBox,s.layoutBox)){i=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const e=ln(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const s=ln(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+s}la(e,i),Bn(e,r),hn(this.projectionDeltaWithTransform,this.layoutCorrected,e,r)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new Sa);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){var t;const{layoutId:e}=this.options;return e&&(null===(t=this.getStack())||void 0===t?void 0:t.lead)||this}getPrevLead(){var t;const{layoutId:e}=this.options;return e?null===(t=this.getStack())||void 0===t?void 0:t.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:i}={}){const s=this.getStack();s&&s.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const s={};i.z&&wa("z",t,s,this.animationValues);for(let r=0;r<La.length;r++)wa(`rotate${La[r]}`,t,s,this.animationValues),wa(`skew${La[r]}`,t,s,this.animationValues);t.render();for(const r in s)t.setStaticValue(r,s[r]),this.animationValues&&(this.animationValues[r]=s[r]);t.scheduleRender()}getProjectionStyles(t){var e,i;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Ra;const s={visibility:""},r=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,s.opacity="",s.pointerEvents=xt(null==t?void 0:t.pointerEvents)||"",s.transform=r?r(this.latestValues,""):"none",s;const n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target){const e={};return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=xt(null==t?void 0:t.pointerEvents)||""),this.hasProjected&&!In(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1),e}const a=n.animationValues||n.latestValues;this.applyTransformsToTarget(),s.transform=function(t,e,i){let s="";const r=t.x.translate/e.x,n=t.y.translate/e.y,a=(null==i?void 0:i.z)||0;if((r||n||a)&&(s=`translate3d(${r}px, ${n}px, ${a}px) `),1===e.x&&1===e.y||(s+=`scale(${1/e.x}, ${1/e.y}) `),i){const{transformPerspective:t,rotate:e,rotateX:r,rotateY:n,skewX:a,skewY:o}=i;t&&(s=`perspective(${t}px) ${s}`),e&&(s+=`rotate(${e}deg) `),r&&(s+=`rotateX(${r}deg) `),n&&(s+=`rotateY(${n}deg) `),a&&(s+=`skewX(${a}deg) `),o&&(s+=`skewY(${o}deg) `)}const o=t.x.scale*e.x,l=t.y.scale*e.y;return 1===o&&1===l||(s+=`scale(${o}, ${l})`),s||"none"}(this.projectionDeltaWithTransform,this.treeScale,a),r&&(s.transform=r(a,s.transform));const{x:o,y:l}=this.projectionDelta;s.transformOrigin=`${100*o.origin}% ${100*l.origin}% 0`,n.animationValues?s.opacity=n===this?null!==(i=null!==(e=a.opacity)&&void 0!==e?e:this.latestValues.opacity)&&void 0!==i?i:1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:s.opacity=n===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0;for(const d in pe){if(void 0===a[d])continue;const{correct:t,applyTo:e}=pe[d],i="none"===s.transform?a[d]:t(a[d],n);if(e){const t=e.length;for(let r=0;r<t;r++)s[e[r]]=i}else s[d]=i}return this.options.layoutId&&(s.pointerEvents=n===this?xt(null==t?void 0:t.pointerEvents)||"":"none"),s}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(t=>{var e;return null===(e=t.currentAnimation)||void 0===e?void 0:e.stop()}),this.root.nodes.forEach(Fa),this.root.sharedNodes.clear()}}}function xa(t){t.updateLayout()}function Pa(t){var e;const i=(null===(e=t.resumeFrom)||void 0===e?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&i&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:s}=t.layout,{animationType:r}=t.options,n=i.source!==t.layout.source;"size"===r?En(t=>{const s=n?i.measuredBox[t]:i.layoutBox[t],r=ln(s);s.min=e[t].min,s.max=s.min+r}):Xa(r,i.layoutBox,e)&&En(s=>{const r=n?i.measuredBox[s]:i.layoutBox[s],a=ln(e[s]);r.max=r.min+a,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+a)});const a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};hn(a,e,i.layoutBox);const o={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};n?hn(o,t.applyTransform(s,!0),i.measuredBox):hn(o,e,i.layoutBox);const l=!pa(a);let d=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:r,layout:n}=s;if(r&&n){const a={x:{min:0,max:0},y:{min:0,max:0}};fn(a,i.layoutBox,r.layoutBox);const o={x:{min:0,max:0},y:{min:0,max:0}};fn(o,e,n.layoutBox),ya(a,o)||(d=!0),s.options.layoutRoot&&(t.relativeTarget=o,t.relativeTargetOrigin=a,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:i,delta:o,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function Ma(t){Ia&&ba.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Oa(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Ba(t){t.clearSnapshot()}function Fa(t){t.clearMeasurements()}function Na(t){t.isLayoutDirty=!1}function _a(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Ua(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Ha(t){t.resolveTargetDelta()}function ja(t){t.calcProjection()}function Va(t){t.resetSkewAndRotation()}function Ga(t){t.removeLeadSnapshot()}function Qa(t,e,i){t.translate=Ss(e.translate,0,i),t.scale=Ss(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function Ka(t,e,i,s){t.min=Ss(e.min,i.min,s),t.max=Ss(e.max,i.max,s)}function qa(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const Wa={duration:.45,ease:[.4,0,.1,1]},Ya=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),$a=Ya("applewebkit/")&&!Ya("chrome/")?Math.round:j;function za(t){t.min=$a(t.min),t.max=$a(t.max)}function Xa(t,e,i){return"position"===t||"preserve-aspect"===t&&(s=Ea(e),r=Ea(i),n=.2,!(Math.abs(s-r)<=n));var s,r,n}function Za(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const Ja=Ca({attachResizeListener:(t,e)=>zr(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),to={current:void 0},eo=Ca({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!to.current){const t=new Ja({});t.mount(window),t.setOptions({layoutScroll:!0}),to.current=t}return to.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),io={pan:{Feature:class extends Qr{constructor(){super(...arguments),this.removePointerDownListener=j}onPointerDown(t){this.session=new tn(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Nn(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:i,onPanEnd:s}=this.node.getProps();return{onSessionStart:jn(t),onStart:jn(e),onMove:i,onEnd:(t,e)=>{delete this.session,s&&q.postRender(()=>s(t,e))}}}mount(){this.removePointerDownListener=Zr(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends Qr{constructor(t){super(t),this.removeGroupControls=j,this.removeListeners=j,this.controls=new Un(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||j}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:eo,MeasureLayout:Wn}};function so(t,e,i){var s;if(t instanceof Element)return[t];if("string"==typeof t){let e=document;const r=null!==(s=null==i?void 0:i[t])&&void 0!==s?s:e.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t)}function ro(t,e){const i=so(t),s=new AbortController;return[i,{passive:!0,...e,signal:s.signal},()=>s.abort()]}function no(t){return e=>{"touch"===e.pointerType||Yr()||t(e)}}function ao(t,e,i){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover","Start"===i);const r=s["onHover"+i];r&&q.postRender(()=>r(e,Xr(e)))}const oo=(t,e)=>!!e&&(t===e||oo(t,e.parentElement)),lo=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const ho=new WeakSet;function co(t){return e=>{"Enter"===e.key&&t(e)}}function uo(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function fo(t){return $r(t)&&!Yr()}function go(t,e,i={}){const[s,r,n]=ro(t,i),a=t=>{const s=t.currentTarget;if(!fo(t)||ho.has(s))return;ho.add(s);const n=e(t),a=(t,e)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),fo(t)&&ho.has(s)&&(ho.delete(s),"function"==typeof n&&n(t,{success:e}))},o=t=>{a(t,i.useGlobalTarget||oo(s,t.target))},l=t=>{a(t,!1)};window.addEventListener("pointerup",o,r),window.addEventListener("pointercancel",l,r)};return s.forEach(t=>{(function(t){return lo.has(t.tagName)||-1!==t.tabIndex})(t)||null!==t.getAttribute("tabindex")||(t.tabIndex=0);(i.useGlobalTarget?window:t).addEventListener("pointerdown",a,r),t.addEventListener("focus",t=>((t,e)=>{const i=t.currentTarget;if(!i)return;const s=co(()=>{if(ho.has(i))return;uo(i,"down");const t=co(()=>{uo(i,"up")});i.addEventListener("keyup",t,e),i.addEventListener("blur",()=>uo(i,"cancel"),e)});i.addEventListener("keydown",s,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",s),e)})(t,r),r)}),n}function mo(t,e,i){const{props:s}=t;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap","Start"===i);const r=s["onTap"+("End"===i?"":i)];r&&q.postRender(()=>r(e,Xr(e)))}const po=new WeakMap,Ao=new WeakMap,vo=t=>{const e=po.get(t.target);e&&e(t)},yo=t=>{t.forEach(vo)};function Eo(t,e,i){const s=function({root:t,...e}){const i=t||document;Ao.has(i)||Ao.set(i,{});const s=Ao.get(i),r=JSON.stringify(e);return s[r]||(s[r]=new IntersectionObserver(yo,{root:t,...e})),s[r]}(e);return po.set(t,i),s.observe(t),()=>{po.delete(t),s.unobserve(t)}}const To={some:0,all:1};const So={inView:{Feature:class extends Qr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:i,amount:s="some",once:r}=t,n={root:e?e.current:void 0,rootMargin:i,threshold:"number"==typeof s?s:To[s]};return Eo(this.node.current,n,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,r&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:i,onViewportLeave:s}=this.node.getProps(),n=e?i:s;n&&n(t)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return i=>t[i]!==e[i]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Qr{mount(){const{current:t}=this.node;t&&(this.unmount=go(t,t=>(mo(this.node,t,"Start"),(t,{success:e})=>mo(this.node,t,e?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends Qr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Cs(zr(this.node.current,"focus",()=>this.onFocus()),zr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends Qr{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,i={}){const[s,r,n]=ro(t,i),a=no(t=>{const{target:i}=t,s=e(t);if("function"!=typeof s||!i)return;const n=no(t=>{s(t),i.removeEventListener("pointerleave",n)});i.addEventListener("pointerleave",n,r)});return s.forEach(t=>{t.addEventListener("pointerenter",a,r)}),n}(t,t=>(ao(this.node,t,"Start"),t=>ao(this.node,t,"End"))))}unmount(){}}}},bo={layout:{ProjectionNode:eo,MeasureLayout:Wn}},Io={current:null},Lo={current:!1};const Ro=[...fs,Mi,Vi],ko=new WeakMap;const wo=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Do{scrapeMotionValuesFromProps(t,e,i){return{}}constructor({parent:t,props:e,presenceContext:i,reducedMotionConfig:s,blockInitialAnimation:r,visualState:n},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ls,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Be.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,q.render(this.render,!1,!0))};const{latestValues:o,renderState:l,onUpdate:d}=n;this.onUpdate=d,this.latestValues=o,this.baseTarget={...o},this.initialValues=e.initial?{...o}:{},this.renderState=l,this.parent=t,this.props=e,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=Boolean(r),this.isControllingVariants=dt(e),this.isVariantNode=ht(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:h,...c}=this.scrapeMotionValuesFromProps(e,{},this);for(const u in c){const t=c[u];void 0!==o[u]&&Ct(t)&&t.set(o[u],!1)}}mount(t){this.current=t,ko.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),Lo.current||function(){if(Lo.current=!0,U)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Io.current=t.matches;t.addListener(e),e()}else Io.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Io.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){ko.delete(this.current),this.projection&&this.projection.unmount(),W(this.notifyUpdate),W(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const i=Bt.has(t),s=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&q.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),r=e.on("renderRequest",this.scheduleRender);let n;window.MotionCheckAppearSync&&(n=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{s(),r(),n&&n(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in Z){const e=Z[t];if(!e)continue;const{isEnabled:i,Feature:s}=e;if(!this.features[t]&&s&&i(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let i=0;i<wo.length;i++){const e=wo[i];this.propEventSubscriptions[e]&&(this.propEventSubscriptions[e](),delete this.propEventSubscriptions[e]);const s=t["on"+e];s&&(this.propEventSubscriptions[e]=this.on(e,s))}this.prevMotionValues=function(t,e,i){for(const s in e){const r=e[s],n=i[s];if(Ct(r))t.addValue(s,r);else if(Ct(n))t.addValue(s,Ve(r,{owner:t}));else if(n!==r)if(t.hasValue(s)){const e=t.getValue(s);!0===e.liveStyle?e.jump(r):e.hasAnimated||e.set(r)}else{const e=t.getStaticValue(s);t.addValue(s,Ve(void 0!==e?e:r,{owner:t}))}}for(const s in i)void 0===e[s]&&t.removeValue(s);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const i=this.values.get(t);e!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return void 0===i&&void 0!==e&&(i=Ve(null===e?void 0:e,{owner:this}),this.addValue(t,i)),i}readValue(t,e){var i;let s=void 0===this.latestValues[t]&&this.current?null!==(i=this.getBaseTargetFromProps(this.props,t))&&void 0!==i?i:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var r;return null!=s&&("string"==typeof s&&(ds(s)||Si(s))?s=parseFloat(s):(r=s,!Ro.find(us(r))&&Vi.test(e)&&(s=$i(t,e))),this.setBaseTarget(t,Ct(s)?s.get():s)),Ct(s)?s.get():s}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:i}=this.props;let s;if("string"==typeof i||"object"==typeof i){const r=kt(this.props,i,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);r&&(s=r[t])}if(i&&void 0!==s)return s;const r=this.getBaseTargetFromProps(this.props,t);return void 0===r||Ct(r)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:r}on(t,e){return this.events[t]||(this.events[t]=new _e),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Co extends Do{constructor(){super(...arguments),this.KeyframeResolver=ms}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:i}){delete e[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ct(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class xo extends Co{constructor(){super(...arguments),this.type="html",this.renderInstance=fe}readValueFromInstance(t,e){if(Bt.has(e)){const t=Yi(e);return t&&t.default||0}{const s=(i=t,window.getComputedStyle(i)),r=(Nt(e)?s.getPropertyValue(e):s[e])||0;return"string"==typeof r?r.trim():r}var i}measureInstanceViewportBox(t,{transformPagePoint:e}){return Fn(t,e)}build(t,e,i){ne(t,e,i.transformTemplate)}scrapeMotionValuesFromProps(t,e,i){return ve(t,e,i)}}class Po extends Co{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=yn}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Bt.has(e)){const t=Yi(e);return t&&t.default||0}return e=ge.has(e)?e:pt(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,i){return ye(t,e,i)}build(t,e,i){de(t,e,this.isSVGTag,i.transformTemplate)}renderInstance(t,e,i,s){me(t,e,0,s)}mount(t){this.isSVGTag=ue(t.tagName),super.mount(t)}}const Mo=st(we({...qr,...So,...io,...bo},(t,i)=>Lt(t)?new Po(i):new xo(i,{allowProjection:t!==e.Fragment})));function Oo(t){const i=F(()=>Ve(t)),{isStatic:s}=e.useContext(_);if(s){const[,s]=e.useState(t);e.useEffect(()=>i.on("change",s),[])}return i}function Bo(t,e){const i=Oo(e()),s=()=>i.set(e());return s(),H(()=>{const e=()=>q.preRender(s,!1,!0),i=t.map(t=>t.on("change",e));return()=>{i.forEach(t=>t()),W(s)}}),i}function Fo(t,e,i,s){if("function"==typeof t)return function(t){He.current=[],t();const e=Bo(He.current,t);return He.current=void 0,e}(t);const r="function"==typeof e?e:function(...t){const e=!Array.isArray(t[0]),i=e?0:-1,s=t[0+i],r=t[1+i],n=t[2+i],a=t[3+i],o=fr(r,n,{mixer:(l=n[0],(t=>t&&"object"==typeof t&&t.mix)(l)?l.mix:void 0),...a});var l;return e?o(s):o}(e,i,s);return Array.isArray(t)?No(t,r):No([t],([t])=>r(t))}function No(t,e){const i=F(()=>[]);return Bo(t,()=>{i.length=0;const s=t.length;for(let e=0;e<s;e++)i[e]=t[e].get();return e(i)})}function _o(t,e){[...e].reverse().forEach(i=>{const s=t.getVariant(i);s&&Qe(t,s),t.variantChildren&&t.variantChildren.forEach(t=>{_o(t,e)})})}function Uo(){const t=new Set,e={subscribe:e=>(t.add(e),()=>{t.delete(e)}),start(e,i){const s=[];return t.forEach(t=>{s.push(Br(t,e,{transitionOverride:i}))}),Promise.all(s)},set:e=>t.forEach(t=>{!function(t,e){Array.isArray(e)?_o(t,e):"string"==typeof e?_o(t,[e]):Qe(t,e)}(t,e)}),stop(){t.forEach(t=>{!function(t){t.values.forEach(t=>t.stop())}(t)})},mount:()=>()=>{e.stop()}};return e}function Ho(t,e=100,i){const s=i({...t,keyframes:[0,e]}),r=Math.min(Ts(s),Es);return{type:"keyframes",ease:t=>s.next(r*t).value/e,duration:Ze(r)}}function jo(t,e){return hr(t)?t[((t,e,i)=>{const s=e-t;return((i-t)%s+s)%s+t})(0,t.length,e)]:t}function Vo(t){return"object"==typeof t&&!Array.isArray(t)}function Go(t,e,i,s){return"string"==typeof t&&Vo(e)?so(t,0,s):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function Qo(t,e,i){return t*(e+1)}function Ko(t,e,i,s){var r;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?i:null!==(r=s.get(e))&&void 0!==r?r:t}function qo(t,e,i,s,r,n){!function(t,e,i){for(let s=0;s<t.length;s++){const r=t[s];r.at>e&&r.at<i&&(Ne(t,r),s--)}}(t,r,n);for(let a=0;a<e.length;a++)t.push({value:e[a],at:Ss(r,n,s[a]),easing:jo(i,a)})}function Wo(t,e){for(let i=0;i<t.length;i++)t[i]=t[i]/(e+1)}function Yo(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}function $o(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function zo(t,e){return e[t]||(e[t]=[]),e[t]}function Xo(t){return Array.isArray(t)?t:[t]}function Zo(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const Jo=t=>"number"==typeof t,tl=t=>t.every(Jo);class el extends Do{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const i=t[e];if("string"==typeof i||"number"==typeof i)return i}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function il(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},i=zn(t)?new Po(e):new xo(e);i.mount(t),ko.set(t,i)}function sl(t){const e=new el({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),ko.set(t,e)}function rl(t,e,i,s){const r=[];if(function(t,e){return Ct(t)||"number"==typeof t||"string"==typeof t&&!Vo(e)}(t,e))r.push($n(t,Vo(e)&&e.default||e,i&&i.default||i));else{const s=Go(t,e),n=s.length;for(let t=0;t<n;t++){const a=s[t],o=a instanceof Element?il:sl;ko.has(a)||o(a);const l=ko.get(a),d={...i};"delay"in d&&"function"==typeof d.delay&&(d.delay=d.delay(t,n)),r.push(...Pr(l,{...e,transition:d},{}))}}return r}function nl(t,e,i){const s=[],r=function(t,{defaultTransition:e={},...i}={},s,r){const n=e.duration||.3,a=new Map,o=new Map,l={},d=new Map;let h=0,c=0,u=0;for(let f=0;f<t.length;f++){const i=t[f];if("string"==typeof i){d.set(i,c);continue}if(!Array.isArray(i)){d.set(i.name,Ko(c,i.at,h,d));continue}let[s,a,g={}]=i;void 0!==g.at&&(c=Ko(c,g.at,h,d));let m=0;const p=(t,i,s,a=0,o=0)=>{const l=Xo(t),{delay:d=0,times:h=mr(l),type:f="keyframes",repeat:g,repeatType:p,repeatDelay:A=0,...v}=i;let{ease:y=e.ease||"easeOut",duration:E}=i;const T="function"==typeof d?d(a,o):d,S=l.length,b=Je(f)?f:null==r?void 0:r[f];if(S<=2&&b){let t=100;if(2===S&&tl(l)){const e=l[1]-l[0];t=Math.abs(e)}const e={...v};void 0!==E&&(e.duration=Xe(E));const i=Ho(e,t,b);y=i.ease,E=i.duration}null!=E||(E=n);const I=c+T;1===h.length&&0===h[0]&&(h[1]=1);const L=h.length-l.length;if(L>0&&gr(h,L),1===l.length&&l.unshift(null),g){E=Qo(E,g);const t=[...l],e=[...h];y=Array.isArray(y)?[...y]:[y];const i=[...y];for(let s=0;s<g;s++){l.push(...t);for(let r=0;r<t.length;r++)h.push(e[r]+(s+1)),y.push(0===r?"linear":jo(i,r-1))}Wo(h,g)}const R=I+E;qo(s,l,y,h,I,R),m=Math.max(T+E,m),u=Math.max(R,u)};if(Ct(s))p(a,g,zo("default",$o(s,o)));else{const t=Go(s,a,0,l),e=t.length;for(let i=0;i<e;i++){const s=$o(t[i],o);for(const t in a)p(a[t],Zo(g,t),zo(t,s),i,e)}}h=c,c+=m}return o.forEach((t,s)=>{for(const r in t){const n=t[r];n.sort(Yo);const o=[],l=[],d=[];for(let t=0;t<n.length;t++){const{at:e,value:i,easing:s}=n[t];o.push(i),l.push(ni(0,u,e)),d.push(s||"easeOut")}0!==l[0]&&(l.unshift(0),o.unshift(o[0]),d.unshift("easeInOut")),1!==l[l.length-1]&&(l.push(1),o.push(null)),a.has(s)||a.set(s,{keyframes:{},transition:{}});const h=a.get(s);h.keyframes[r]=o,h.transition[r]={...e,duration:u,ease:d,times:l,...i}}}),a}(t,e,0,{spring:nr});return r.forEach(({keyframes:t,transition:e},i)=>{s.push(...rl(i,t,e))}),s}const al=function(t,e,i){let s=[];var r;return r=t,s=Array.isArray(r)&&r.some(Array.isArray)?nl(t,e):rl(t,e,i),new ze(s)};function ol(){const t=F(Uo);return H(t.mount,[]),t}const ll="_card_doqsx_2",dl="_cardContent_doqsx_18",hl="_gradientBottom_doqsx_29",cl="_gradientTop_doqsx_41",ul="_cardName_doqsx_52",fl=({card:t,cardUIConfig:e,className:i="",children:r})=>{const{gradient:n,title:a}=e,o=n.color||"rgba(0, 0, 0, 1)",l=(()=>{if(!n.type)return{showTop:!1,showBottom:!1};const t=n.type.toLowerCase();return{showTop:"top"===t||"top-and-bottom"===t,showBottom:"bottom"===t||"top-and-bottom"===t}})();return s.jsxs("div",{id:t.id||void 0,className:`${ll} ${i}`.trim(),children:[r,l.showBottom&&s.jsx("div",{className:hl,style:{background:`linear-gradient(transparent, ${o})`}}),l.showTop&&s.jsx("div",{className:cl,style:{background:`linear-gradient(${o}, transparent)`}}),a.enabled&&s.jsx("div",{className:dl,children:s.jsx("div",{className:ul,style:{fontSize:`${a.textSize}px`,bottom:`${a.positionBottom}%`},children:t.title||""})})]})},gl="_image_trs4h_2",ml=({card:t,onImageReady:i,ready:r=!0,lazyLoad:n=!1,className:a=""})=>{const o=e.useRef(null);return e.useEffect(()=>{if(o.current&&i&&r){const t=()=>{i(o.current)};if(!o.current.complete)return o.current.addEventListener("load",t),()=>{var e;null==(e=o.current)||e.removeEventListener("load",t)};i(o.current)}},[r]),s.jsx(s.Fragment,{children:t.imageUrl&&r&&s.jsx("img",{ref:o,src:t.imageUrl,alt:t.title||"",loading:n?"lazy":"eager",className:`${gl} ${a}`.trim()})})},pl=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],Al=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function vl(t){return`\n <style>\n :host {\n display: inline-flex;\n line-height: 0;\n flex-direction: column;\n justify-content: end;\n }\n\n audio {\n width: 100%;\n }\n </style>\n <slot name="media">\n <audio${Tl(t)}></audio>\n </slot>\n <slot></slot>\n `}function yl(t){return`\n <style>\n :host {\n display: inline-block;\n line-height: 0;\n }\n\n video {\n max-width: 100%;\n max-height: 100%;\n min-width: 100%;\n min-height: 100%;\n object-fit: var(--media-object-fit, contain);\n object-position: var(--media-object-position, 50% 50%);\n }\n\n video::-webkit-media-text-track-container {\n transform: var(--media-webkit-text-track-transform);\n transition: var(--media-webkit-text-track-transition);\n }\n </style>\n <slot name="media">\n <video${Tl(t)}></video>\n </slot>\n <slot></slot>\n `}function El(t,{tag:e,is:i}){var s,r,n,a,o,l,d,h,c,u,f,g,m,p,A,v,y,E,T;const S=null==(r=null==(s=globalThis.document)?void 0:s.createElement)?void 0:r.call(s,e,{is:i}),b=S?function(t){const e=[];for(let i=Object.getPrototypeOf(t);i&&i!==HTMLElement.prototype;i=Object.getPrototypeOf(i)){const t=Object.getOwnPropertyNames(i);e.push(...t)}return e}(S):[];return n=class extends t{constructor(){super(...arguments),C(this,g),C(this,d,!1),C(this,h,null),C(this,c,new Map),C(this,u),C(this,f),k(this,"get"),k(this,"set"),k(this,"call")}static get observedAttributes(){var t,e;P(t=n,o,l).call(t);return[...(null==(e=null==S?void 0:S.constructor)?void 0:e.observedAttributes)??[],...Al]}get nativeEl(){var t;return P(this,g,m).call(this),D(this,h)??this.querySelector(":scope > [slot=media]")??this.querySelector(e)??(null==(t=this.shadowRoot)?void 0:t.querySelector(e))??null}set nativeEl(t){x(this,h,t)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(t){this.toggleAttribute("muted",t)}get src(){return this.getAttribute("src")}set src(t){this.setAttribute("src",`${t}`)}get preload(){var t;return this.getAttribute("preload")??(null==(t=this.nativeEl)?void 0:t.preload)}set preload(t){this.setAttribute("preload",`${t}`)}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const t=function(t){const e={};for(const i of t)e[i.name]=i.value;return e}(this.attributes);i&&(t.is=i),e&&(t.part=e),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(t)}this.nativeEl.muted=this.hasAttribute("muted");for(const t of b)P(this,g,E).call(this,t);P(this,g,p).call(this)}handleEvent(t){t.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(t.type,{detail:t.detail}))}attributeChangedCallback(t,e,i){P(this,g,m).call(this),P(this,g,T).call(this,t,e,i)}connectedCallback(){P(this,g,m).call(this),D(this,f)||P(this,g,p).call(this)}disconnectedCallback(){var t,e,i;null==(t=D(this,u))||t.disconnect(),x(this,u,void 0),D(this,f)&&(null==(e=this.shadowRoot)||e.removeEventListener("slotchange",D(this,f)),x(this,f,void 0));for(const s of this.constructor.Events)null==(i=this.shadowRoot)||i.removeEventListener(s,this,!0);D(this,c).forEach(t=>t.remove()),D(this,c).clear(),x(this,h,null)}},a=new WeakMap,o=new WeakSet,l=function(){if(D(this,a))return;x(this,a,!0);const t=new Set(this.observedAttributes);t.delete("muted");for(const e of b)if(!(e in this.prototype))if("function"==typeof S[e])this.prototype[e]=function(...t){P(this,g,m).call(this);return(()=>{var i;if(this.call)return this.call(e,...t);const s=null==(i=this.nativeEl)?void 0:i[e];return null==s?void 0:s.apply(this.nativeEl,t)})()};else{const i={get(){var i,s;P(this,g,m).call(this);const r=e.toLowerCase();if(t.has(r)){const t=this.getAttribute(r);return null!==t&&(""===t||t)}return(null==(i=this.get)?void 0:i.call(this,e))??(null==(s=this.nativeEl)?void 0:s[e])}};e!==e.toUpperCase()&&(i.set=function(i){P(this,g,m).call(this);const s=e.toLowerCase();t.has(s)?!0===i||!1===i||null==i?this.toggleAttribute(s,Boolean(i)):this.setAttribute(s,i):this.set?this.set(e,i):this.nativeEl&&(this.nativeEl[e]=i)}),Object.defineProperty(this.prototype,e,i)}},d=new WeakMap,h=new WeakMap,c=new WeakMap,u=new WeakMap,f=new WeakMap,g=new WeakSet,m=function(){D(this,d)||(x(this,d,!0),this.init())},p=function(){var t,e;x(this,u,new MutationObserver(P(this,g,v).bind(this))),x(this,f,()=>P(this,g,A).call(this)),null==(t=this.shadowRoot)||t.addEventListener("slotchange",D(this,f)),P(this,g,A).call(this);for(const i of this.constructor.Events)null==(e=this.shadowRoot)||e.addEventListener(i,this,!0)},A=function(){var t;const e=new Map(D(this,c)),i=null==(t=this.shadowRoot)?void 0:t.querySelector("slot:not([name])");(null==i?void 0:i.assignedElements({flatten:!0}).filter(t=>["track","source"].includes(t.localName))).forEach(t=>{var i,s;e.delete(t);let r=D(this,c).get(t);r||(r=t.cloneNode(),D(this,c).set(t,r),null==(i=D(this,u))||i.observe(t,{attributes:!0})),null==(s=this.nativeEl)||s.append(r),P(this,g,y).call(this,r)}),e.forEach((t,e)=>{t.remove(),D(this,c).delete(e)})},v=function(t){for(const e of t)if("attributes"===e.type){const{target:t,attributeName:i}=e,s=D(this,c).get(t);s&&i&&(s.setAttribute(i,t.getAttribute(i)??""),P(this,g,y).call(this,s))}},y=function(t){t&&"track"===t.localName&&t.default&&("chapters"===t.kind||"metadata"===t.kind)&&"disabled"===t.track.mode&&(t.track.mode="hidden")},E=function(t){if(Object.prototype.hasOwnProperty.call(this,t)){const e=this[t];delete this[t],this[t]=e}},T=function(t,e,i){var s,r,a;["id","class"].includes(t)||!n.observedAttributes.includes(t)&&this.constructor.observedAttributes.includes(t)||(null===i?null==(s=this.nativeEl)||s.removeAttribute(t):(null==(r=this.nativeEl)?void 0:r.getAttribute(t))!==i&&(null==(a=this.nativeEl)||a.setAttribute(t,i)))},C(n,o),k(n,"getTemplateHTML",e.endsWith("audio")?vl:yl),k(n,"shadowRootOptions",{mode:"open"}),k(n,"Events",pl),C(n,a,!1),n}function Tl(t){let e="";for(const i in t){if(!Al.includes(i))continue;const s=t[i];e+=""===s?` ${i}`:` ${i}="${s}"`}return e}const Sl=El(globalThis.HTMLElement??class{},{tag:"video"});El(globalThis.HTMLElement??class{},{tag:"audio"});class bl extends Event{constructor(t,e){super(t),k(this,"track"),this.track=e.track}}const Il=new WeakMap;function Ll(t){return Il.get(t)??function(t,e){let i=Il.get(t);i||Il.set(t,i={});return Object.assign(i,e)}(t,{})}function Rl(t,e){const i=t.videoTracks;Ll(e).media=new WeakRef(t),Ll(e).renditionSet||(Ll(e).renditionSet=new Set);const s=Ll(i).trackSet;s.add(e);const r=s.size-1;r in wl.prototype||Object.defineProperty(wl.prototype,r,{get(){return[...Ll(this).trackSet][r]}}),queueMicrotask(()=>{i.dispatchEvent(new bl("addtrack",{track:e}))})}function kl(t){var e,i;const s=null==(i=null==(e=Ll(t).media)?void 0:e.deref())?void 0:i.videoTracks;if(!s)return;Ll(s).trackSet.delete(t),queueMicrotask(()=>{s.dispatchEvent(new bl("removetrack",{track:t}))})}class wl extends EventTarget{constructor(){super(),C(this,o),C(this,r),C(this,n),C(this,a),Ll(this).trackSet=new Set}[Symbol.iterator](){return D(this,o,l).values()}get length(){return D(this,o,l).size}getTrackById(t){return[...D(this,o,l)].find(e=>e.id===t)??null}get selectedIndex(){return[...D(this,o,l)].findIndex(t=>t.selected)}get onaddtrack(){return D(this,r)}set onaddtrack(t){D(this,r)&&(this.removeEventListener("addtrack",D(this,r)),x(this,r,void 0)),"function"==typeof t&&(x(this,r,t),this.addEventListener("addtrack",t))}get onremovetrack(){return D(this,n)}set onremovetrack(t){D(this,n)&&(this.removeEventListener("removetrack",D(this,n)),x(this,n,void 0)),"function"==typeof t&&(x(this,n,t),this.addEventListener("removetrack",t))}get onchange(){return D(this,a)}set onchange(t){D(this,a)&&(this.removeEventListener("change",D(this,a)),x(this,a,void 0)),"function"==typeof t&&(x(this,a,t),this.addEventListener("change",t))}}r=new WeakMap,n=new WeakMap,a=new WeakMap,o=new WeakSet,l=function(){return Ll(this).trackSet};class Dl extends Event{constructor(t,e){super(t),k(this,"rendition"),this.rendition=e.rendition}}function Cl(t){var e;const i=null==(e=Ll(t).media)?void 0:e.deref();return i?[...i.videoTracks].filter(t=>t.selected).flatMap(t=>[...Ll(t).renditionSet]):[]}class xl extends EventTarget{constructor(){super(...arguments),C(this,d),C(this,h),C(this,c)}[Symbol.iterator](){return Cl(this).values()}get length(){return Cl(this).length}getRenditionById(t){return Cl(this).find(e=>`${e.id}`==`${t}`)??null}get selectedIndex(){return Cl(this).findIndex(t=>t.selected)}set selectedIndex(t){for(const[e,i]of Cl(this).entries())i.selected=e===t}get onaddrendition(){return D(this,d)}set onaddrendition(t){D(this,d)&&(this.removeEventListener("addrendition",D(this,d)),x(this,d,void 0)),"function"==typeof t&&(x(this,d,t),this.addEventListener("addrendition",t))}get onremoverendition(){return D(this,h)}set onremoverendition(t){D(this,h)&&(this.removeEventListener("removerendition",D(this,h)),x(this,h,void 0)),"function"==typeof t&&(x(this,h,t),this.addEventListener("removerendition",t))}get onchange(){return D(this,c)}set onchange(t){D(this,c)&&(this.removeEventListener("change",D(this,c)),x(this,c,void 0)),"function"==typeof t&&(x(this,c,t),this.addEventListener("change",t))}}d=new WeakMap,h=new WeakMap,c=new WeakMap;class Pl{constructor(){k(this,"src"),k(this,"id"),k(this,"width"),k(this,"height"),k(this,"bitrate"),k(this,"frameRate"),k(this,"codec"),C(this,u,!1)}get selected(){return D(this,u)}set selected(t){D(this,u)!==t&&(x(this,u,t),function(t){var e,i;const s=null==(i=null==(e=Ll(t).media)?void 0:e.deref())?void 0:i.videoRenditions;s&&!Ll(s).changeRequested&&(Ll(s).changeRequested=!0,queueMicrotask(()=>{delete Ll(s).changeRequested,Ll(t).track.selected&&s.dispatchEvent(new Event("change"))}))}(this))}}u=new WeakMap;class Ml{constructor(){k(this,"id"),k(this,"kind"),k(this,"label",""),k(this,"language",""),k(this,"sourceBuffer"),C(this,f,!1)}addRendition(t,e,i,s,r,n){const a=new Pl;return a.src=t,a.width=e,a.height=i,a.frameRate=n,a.bitrate=r,a.codec=s,function(t,e){var i,s;const r=null==(s=null==(i=Ll(t).media)?void 0:i.deref())?void 0:s.videoRenditions;Ll(e).media=Ll(t).media,Ll(e).track=t;const n=Ll(t).renditionSet;n.add(e);const a=n.size-1;a in xl.prototype||Object.defineProperty(xl.prototype,a,{get(){return Cl(this)[a]}}),queueMicrotask(()=>{r&&t.selected&&r.dispatchEvent(new Dl("addrendition",{rendition:e}))})}(this,a),a}removeRendition(t){!function(t){var e,i;const s=null==(i=null==(e=Ll(t).media)?void 0:e.deref())?void 0:i.videoRenditions,r=Ll(t).track;Ll(r).renditionSet.delete(t),queueMicrotask(()=>{const e=Ll(t).track;s&&e.selected&&s.dispatchEvent(new Dl("removerendition",{rendition:t}))})}(t)}get selected(){return D(this,f)}set selected(t){D(this,f)!==t&&(x(this,f,t),!0===t&&function(t){var e,i;const s=(null==(i=null==(e=Ll(t).media)?void 0:e.deref())?void 0:i.videoTracks)??[];let r=!1;for(const n of s)n!==t&&(n.selected=!1,r=!0);if(r){if(Ll(s).changeRequested)return;Ll(s).changeRequested=!0,queueMicrotask(()=>{delete Ll(s).changeRequested,s.dispatchEvent(new Event("change"))})}}(this))}}function Ol(t){var e;const i=null==(e=Ll(t).media)?void 0:e.deref();return i?[...i.audioTracks].filter(t=>t.enabled).flatMap(t=>[...Ll(t).renditionSet]):[]}f=new WeakMap;class Bl extends EventTarget{constructor(){super(...arguments),C(this,g),C(this,m),C(this,p)}[Symbol.iterator](){return Ol(this).values()}get length(){return Ol(this).length}getRenditionById(t){return Ol(this).find(e=>`${e.id}`==`${t}`)??null}get selectedIndex(){return Ol(this).findIndex(t=>t.selected)}set selectedIndex(t){for(const[e,i]of Ol(this).entries())i.selected=e===t}get onaddrendition(){return D(this,g)}set onaddrendition(t){D(this,g)&&(this.removeEventListener("addrendition",D(this,g)),x(this,g,void 0)),"function"==typeof t&&(x(this,g,t),this.addEventListener("addrendition",t))}get onremoverendition(){return D(this,m)}set onremoverendition(t){D(this,m)&&(this.removeEventListener("removerendition",D(this,m)),x(this,m,void 0)),"function"==typeof t&&(x(this,m,t),this.addEventListener("removerendition",t))}get onchange(){return D(this,p)}set onchange(t){D(this,p)&&(this.removeEventListener("change",D(this,p)),x(this,p,void 0)),"function"==typeof t&&(x(this,p,t),this.addEventListener("change",t))}}g=new WeakMap,m=new WeakMap,p=new WeakMap;class Fl{constructor(){k(this,"src"),k(this,"id"),k(this,"bitrate"),k(this,"codec"),C(this,A,!1)}get selected(){return D(this,A)}set selected(t){D(this,A)!==t&&(x(this,A,t),function(t){var e,i;const s=null==(i=null==(e=Ll(t).media)?void 0:e.deref())?void 0:i.audioRenditions;s&&!Ll(s).changeRequested&&(Ll(s).changeRequested=!0,queueMicrotask(()=>{delete Ll(s).changeRequested,Ll(t).track.enabled&&s.dispatchEvent(new Event("change"))}))}(this))}}function Nl(t,e){const i=t.audioTracks;Ll(e).media=new WeakRef(t),Ll(e).renditionSet||(Ll(e).renditionSet=new Set);const s=Ll(i).trackSet;s.add(e);const r=s.size-1;r in Ul.prototype||Object.defineProperty(Ul.prototype,r,{get(){return[...Ll(this).trackSet][r]}}),queueMicrotask(()=>{i.dispatchEvent(new bl("addtrack",{track:e}))})}function _l(t){var e,i;const s=null==(i=null==(e=Ll(t).media)?void 0:e.deref())?void 0:i.audioTracks;if(!s)return;Ll(s).trackSet.delete(t),queueMicrotask(()=>{s.dispatchEvent(new bl("removetrack",{track:t}))})}A=new WeakMap;class Ul extends EventTarget{constructor(){super(),C(this,T),C(this,v),C(this,y),C(this,E),Ll(this).trackSet=new Set}[Symbol.iterator](){return D(this,T,S).values()}get length(){return D(this,T,S).size}getTrackById(t){return[...D(this,T,S)].find(e=>e.id===t)??null}get onaddtrack(){return D(this,v)}set onaddtrack(t){D(this,v)&&(this.removeEventListener("addtrack",D(this,v)),x(this,v,void 0)),"function"==typeof t&&(x(this,v,t),this.addEventListener("addtrack",t))}get onremovetrack(){return D(this,y)}set onremovetrack(t){D(this,y)&&(this.removeEventListener("removetrack",D(this,y)),x(this,y,void 0)),"function"==typeof t&&(x(this,y,t),this.addEventListener("removetrack",t))}get onchange(){return D(this,E)}set onchange(t){D(this,E)&&(this.removeEventListener("change",D(this,E)),x(this,E,void 0)),"function"==typeof t&&(x(this,E,t),this.addEventListener("change",t))}}v=new WeakMap,y=new WeakMap,E=new WeakMap,T=new WeakSet,S=function(){return Ll(this).trackSet};class Hl{constructor(){k(this,"id"),k(this,"kind"),k(this,"label",""),k(this,"language",""),k(this,"sourceBuffer"),C(this,b,!1)}addRendition(t,e,i){const s=new Fl;return s.src=t,s.codec=e,s.bitrate=i,function(t,e){var i,s;const r=null==(s=null==(i=Ll(t).media)?void 0:i.deref())?void 0:s.audioRenditions;Ll(e).media=Ll(t).media,Ll(e).track=t;const n=Ll(t).renditionSet;n.add(e);const a=n.size-1;a in Bl.prototype||Object.defineProperty(Bl.prototype,a,{get(){return Ol(this)[a]}}),queueMicrotask(()=>{r&&t.enabled&&r.dispatchEvent(new Dl("addrendition",{rendition:e}))})}(this,s),s}removeRendition(t){!function(t){var e,i;const s=null==(i=null==(e=Ll(t).media)?void 0:e.deref())?void 0:i.audioRenditions,r=Ll(t).track;Ll(r).renditionSet.delete(t),queueMicrotask(()=>{const e=Ll(t).track;s&&e.enabled&&s.dispatchEvent(new Dl("removerendition",{rendition:t}))})}(t)}get enabled(){return D(this,b)}set enabled(t){D(this,b)!==t&&(x(this,b,t),function(t){var e,i;const s=null==(i=null==(e=Ll(t).media)?void 0:e.deref())?void 0:i.audioTracks;s&&!Ll(s).changeRequested&&(Ll(s).changeRequested=!0,queueMicrotask(()=>{delete Ll(s).changeRequested,s.dispatchEvent(new Event("change"))}))}(this))}}b=new WeakMap;const jl=Gl(globalThis.HTMLMediaElement,"video"),Vl=Gl(globalThis.HTMLMediaElement,"audio");function Gl(t,e){var i;if(null==t?void 0:t.prototype)return null==(i=Object.getOwnPropertyDescriptor(t.prototype,`${e}Tracks`))?void 0:i.get}const Ql=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Kl=Number.isSafeInteger||function(t){return"number"==typeof t&&Math.abs(t)<=ql},ql=Number.MAX_SAFE_INTEGER||9007199254740991;let Wl=function(t){return t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t}({}),Yl=function(t){return t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",t.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",t.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.ASSET_LIST_LOAD_ERROR="assetListLoadError",t.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",t.ASSET_LIST_PARSING_ERROR="assetListParsingError",t.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.ATTACH_MEDIA_ERROR="attachMediaError",t.UNKNOWN="unknown",t}({}),$l=function(t){return t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.MEDIA_ENDED="hlsMediaEnded",t.STALL_RESOLVED="hlsStallResolved",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFERED_TO_END="hlsBufferedToEnd",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t.ASSET_LIST_LOADING="hlsAssetListLoading",t.ASSET_LIST_LOADED="hlsAssetListLoaded",t.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",t.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",t.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",t.INTERSTITIAL_STARTED="hlsInterstitialStarted",t.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",t.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",t.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",t.INTERSTITIAL_ENDED="hlsInterstitialEnded",t.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",t.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",t.EVENT_CUE_ENTER="hlsEventCueEnter",t}({});var zl="manifest",Xl="level",Zl="audioTrack",Jl="subtitleTrack",td="main",ed="audio",id="subtitle";class sd{constructor(t,e=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=i}sample(t,e){const i=Math.pow(this.alpha_,t);this.estimate_=e*(1-i)+i*this.estimate_,this.totalWeight_+=t}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}class rd{constructor(t,e,i,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new sd(t),this.fast_=new sd(e),this.defaultTTFB_=s,this.ttfb_=new sd(t)}update(t,e){const{slow_:i,fast_:s,ttfb_:r}=this;i.halfLife!==t&&(this.slow_=new sd(t,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.fast_=new sd(e,s.getEstimate(),s.getTotalWeight())),r.halfLife!==t&&(this.ttfb_=new sd(t,r.getEstimate(),r.getTotalWeight()))}sample(t,e){const i=(t=Math.max(t,this.minDelayMs_))/1e3,s=8*e/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(t){const e=t/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(e,2)/2);this.ttfb_.sample(i,Math.max(t,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function nd(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e);if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ad(){return ad=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)({}).hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},ad.apply(null,arguments)}function od(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function ld(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?od(Object(i),!0).forEach(function(e){nd(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):od(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}class dd{constructor(t,e){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${t}]:`;this.trace=hd,this.debug=e.debug.bind(null,i),this.log=e.log.bind(null,i),this.warn=e.warn.bind(null,i),this.info=e.info.bind(null,i),this.error=e.error.bind(null,i)}}const hd=function(){},cd={trace:hd,debug:hd,log:hd,warn:hd,info:hd,error:hd};function ud(){return ad({},cd)}function fd(t,e,i){return e[t]?e[t].bind(e):function(t,e){const i=self.console[t];return i?i.bind(self.console,`${e?"["+e+"] ":""}[${t}] >`):hd}(t,i)}const gd=ud();const md=gd;function pd(t=!0){if("undefined"==typeof self)return;return(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Ad(t,e){const i=Object.keys(t),s=Object.keys(e),r=i.length,n=s.length;return!r||!n||r===n&&!i.some(t=>-1===s.indexOf(t))}function vd(t,e=!1){if("undefined"!=typeof TextDecoder){const i=new TextDecoder("utf-8").decode(t);if(e){const t=i.indexOf("\0");return-1!==t?i.substring(0,t):i}return i.replace(/\0/g,"")}const i=t.length;let s,r,n,a="",o=0;for(;o<i;){if(s=t[o++],0===s&&e)return a;if(0!==s&&3!==s)switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(s);break;case 12:case 13:r=t[o++],a+=String.fromCharCode((31&s)<<6|63&r);break;case 14:r=t[o++],n=t[o++],a+=String.fromCharCode((15&s)<<12|(63&r)<<6|63&n)}}return a}function yd(t){let e="";for(let i=0;i<t.length;i++){let s=t[i].toString(16);s.length<2&&(s="0"+s),e+=s}return e}function Ed(t){return Uint8Array.from(t.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function Td(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Sd,bd={exports:{}};var Id,Ld,Rd,kd,wd,Dd=(Sd||(Sd=1,Id=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,Ld=/^(?=([^\/?#]*))\1([^]*)$/,Rd=/(?:\/|^)\.(?=\/)/g,kd=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,bd.exports=wd={buildAbsoluteURL:function(t,e,i){if(i=i||{},t=t.trim(),!(e=e.trim())){if(!i.alwaysNormalize)return t;var s=wd.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");return s.path=wd.normalizePath(s.path),wd.buildURLFromParts(s)}var r=wd.parseURL(e);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=wd.normalizePath(r.path),wd.buildURLFromParts(r)):e;var n=wd.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var a=Ld.exec(n.path);n.netLoc=a[1],n.path=a[2]}n.netLoc&&!n.path&&(n.path="/");var o={scheme:n.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(o.netLoc=n.netLoc,"/"!==r.path[0]))if(r.path){var l=n.path,d=l.substring(0,l.lastIndexOf("/")+1)+r.path;o.path=wd.normalizePath(d)}else o.path=n.path,r.params||(o.params=n.params,r.query||(o.query=n.query));return null===o.path&&(o.path=i.alwaysNormalize?wd.normalizePath(r.path):r.path),wd.buildURLFromParts(o)},parseURL:function(t){var e=Id.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(Rd,"");t.length!==(t=t.replace(kd,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}}),bd.exports);class Cd{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var xd="audio",Pd="video",Md="audiovideo";class Od{constructor(t){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof t&&(t={url:t}),this.base=t,function(t,e){const i=_d(t,e);i&&(i.enumerable=!0,Object.defineProperty(t,e,i))}(this,"stats")}setByteRange(t,e){const i=t.split("@",2);let s;s=1===i.length?(null==e?void 0:e.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get baseurl(){return this.base.url}get byteRange(){return null===this._byteRange?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return null===this._streams&&(this._streams={[xd]:null,[Pd]:null,[Md]:null}),this._streams}set elementaryStreams(t){this._streams=t}get hasStats(){return null!==this._stats}get hasStreams(){return null!==this._streams}get stats(){return null===this._stats&&(this._stats=new Cd),this._stats}set stats(t){this._stats=t}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Dd.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(t){this._url=t}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[xd]=null,t[Pd]=null,t[Md]=null}}function Bd(t){return"initSegment"!==t.sn}class Fd extends Od{constructor(t,e){super(e),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=t}get byteLength(){if(this.hasStats){const t=this.stats.total;if(t)return t}if(this.byteRange.length){const t=this.byteRange[0],e=this.byteRange[1];if(Ql(t)&&Ql(e))return e-t}return null}get bitrate(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null}set bitrate(t){this._bitrate=t}get decryptdata(){var t;const{levelkeys:e}=this;if(!e||e.NONE)return null;if(e.identity)this._decryptdata||(this._decryptdata=e.identity.getDecryptData(this.sn));else if(null==(t=this._decryptdata)||!t.keyId){const t=Object.keys(e);if(1===t.length){const i=this._decryptdata=e[t[0]]||null;i&&(this._decryptdata=i.getDecryptData(this.sn,e))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;const t=Ql(this.duration)?this.duration:0;return this.programDateTime+1e3*t}get encrypted(){var t;if(null!=(t=this._decryptdata)&&t.encrypted)return!0;if(this.levelkeys){var e;const t=Object.keys(this.levelkeys),i=t.length;if(i>1||1===i&&null!=(e=this.levelkeys[t[0]])&&e.encrypted)return!0}return!1}get programDateTime(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(t){Ql(t)?this._programDateTime=t:this._programDateTime=this.rawProgramDateTime=null}get ref(){return Bd(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(t){this.setStart(this.start+t)}setStart(t){this.start=t,this._ref&&(this._ref.start=t)}setDuration(t){this.duration=t,this._ref&&(this._ref.duration=t)}setKeyFormat(t){const e=this.levelkeys;if(e){var i;const s=e[t];!s||null!=(i=this._decryptdata)&&i.keyId||(this._decryptdata=s.getDecryptData(this.sn,e))}}abortRequests(){var t,e;null==(t=this.loader)||t.abort(),null==(e=this.keyLoader)||e.abort()}setElementaryStreamInfo(t,e,i,s,r,n=!1){const{elementaryStreams:a}=this,o=a[t];o?(o.startPTS=Math.min(o.startPTS,e),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,s),o.endDTS=Math.max(o.endDTS,r)):a[t]={startPTS:e,endPTS:i,startDTS:s,endDTS:r,partial:n}}}class Nd extends Od{constructor(t,e,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=t.decimalFloatingPoint("DURATION"),this.gap=t.bool("GAP"),this.independent=t.bool("INDEPENDENT"),this.relurl=t.enumeratedString("URI"),this.fragment=e,this.index=s;const n=t.enumeratedString("BYTERANGE");n&&this.setByteRange(n,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:t}=this;return!!(t.audio||t.video||t.audiovideo)}}function _d(t,e){const i=Object.getPrototypeOf(t);if(i){const t=Object.getOwnPropertyDescriptor(i,e);return t||_d(i,e)}}const Ud=Math.pow(2,32)-1,Hd=[].push,jd={video:1,audio:2,id3:3,text:4};function Vd(t){return String.fromCharCode.apply(null,t)}function Gd(t,e){const i=t[e]<<8|t[e+1];return i<0?65536+i:i}function Qd(t,e){const i=qd(t,e);return i<0?4294967296+i:i}function Kd(t,e){let i=Qd(t,e);return i*=Math.pow(2,32),i+=Qd(t,e+4),i}function qd(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function Wd(t,e){const i=[];if(!e.length)return i;const s=t.byteLength;for(let r=0;r<s;){const n=Qd(t,r),a=n>1?r+n:s;if(Vd(t.subarray(r+4,r+8))===e[0])if(1===e.length)i.push(t.subarray(r+8,a));else{const s=Wd(t.subarray(r+8,a),e.slice(1));s.length&&Hd.apply(i,s)}r=a}return i}function Yd(t){const e=[],i=t[0];let s=8;const r=Qd(t,s);s+=4;let n=0,a=0;0===i?(n=Qd(t,s),a=Qd(t,s+4),s+=8):(n=Kd(t,s),a=Kd(t,s+8),s+=16),s+=2;let o=t.length+a;const l=Gd(t,s);s+=2;for(let d=0;d<l;d++){let i=s;const n=Qd(t,i);i+=4;const a=2147483647&n;if(1===(2147483648&n)>>>31)return md.warn("SIDX has hierarchical references (not supported)"),null;const l=Qd(t,i);i+=4,e.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/r,start:o,end:o+a-1}}),o+=a,i+=4,s=i}return{earliestPresentationTime:n,timescale:r,version:i,referencesCount:l,references:e}}function $d(t){const e=[],i=Wd(t,["moov","trak"]);for(let s=0;s<i.length;s++){const t=i[s],r=Wd(t,["tkhd"])[0];if(r){let i=r[0];const s=Qd(r,0===i?12:20),n=Wd(t,["mdia","mdhd"])[0];if(n){i=n[0];const r=Qd(n,0===i?12:20),a=Wd(t,["mdia","hdlr"])[0];if(a){const i=Vd(a.subarray(8,12)),n={soun:xd,vide:Pd}[i],o=zd(Wd(t,["mdia","minf","stbl","stsd"])[0]);n?(e[s]={timescale:r,type:n,stsd:o},e[n]=ld({timescale:r,id:s},o)):e[s]={timescale:r,type:i,stsd:o}}}}}return Wd(t,["moov","mvex","trex"]).forEach(t=>{const i=Qd(t,4),s=e[i];s&&(s.default={duration:Qd(t,12),flags:Qd(t,20)})}),e}function zd(t){const e=t.subarray(8),i=e.subarray(86),s=Vd(e.subarray(4,8));let r,n=s;const a="enca"===s||"encv"===s;if(a){const t=Wd(e,[s])[0];Wd(t.subarray("enca"===s?28:78),["sinf"]).forEach(t=>{const e=Wd(t,["schm"])[0];if(e){const i=Vd(e.subarray(4,8));if("cbcs"===i||"cenc"===i){const e=Wd(t,["frma"])[0];e&&(n=Vd(e))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const t=Wd(i,["avcC"])[0];t&&t.length>3&&(n+="."+Jd(t[1])+Jd(t[2])+Jd(t[3]),r=Xd("avc1"===o?"dva1":"dvav",i));break}case"mp4a":{const t=Wd(e,[s])[0],i=Wd(t.subarray(28),["esds"])[0];if(i&&i.length>7){let t=4;if(3!==i[t++])break;t=Zd(i,t),t+=2;const e=i[t++];if(128&e&&(t+=2),64&e&&(t+=i[t++]),4!==i[t++])break;t=Zd(i,t);const s=i[t++];if(64!==s)break;if(n+="."+Jd(s),t+=12,5!==i[t++])break;t=Zd(i,t);const r=i[t++];let a=(248&r)>>3;31===a&&(a+=1+((7&r)<<3)+((224&i[t])>>5)),n+="."+a}break}case"hvc1":case"hev1":{const t=Wd(i,["hvcC"])[0];if(t&&t.length>12){const e=t[1],i=["","A","B","C"][e>>6],s=31&e,r=Qd(t,2),a=(32&e)>>5?"H":"L",o=t[12],l=t.subarray(6,12);n+="."+i+s,n+="."+function(t){let e=0;for(let i=0;i<32;i++)e|=(t>>i&1)<<31-i;return e>>>0}(r).toString(16).toUpperCase(),n+="."+a+o;let d="";for(let t=l.length;t--;){const e=l[t];if(e||d){d="."+e.toString(16).toUpperCase()+d}}n+=d}r=Xd("hev1"==o?"dvhe":"dvh1",i);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":n=Xd(n,i)||n;break;case"vp09":{const t=Wd(i,["vpcC"])[0];if(t&&t.length>6){const e=t[4],i=t[5],s=t[6]>>4&15;n+="."+th(e)+"."+th(i)+"."+th(s)}break}case"av01":{const t=Wd(i,["av1C"])[0];if(t&&t.length>2){const e=t[1]>>>5,s=31&t[1],a=t[2]>>>7?"H":"M",o=(64&t[2])>>6,l=(32&t[2])>>5,d=2===e&&o?l?12:10:o?10:8,h=(16&t[2])>>4,c=(8&t[2])>>3,u=(4&t[2])>>2,f=3&t[2],g=1,m=1,p=1,A=0;n+="."+e+"."+th(s)+a+"."+th(d)+"."+h+"."+c+u+f+"."+th(g)+"."+th(m)+"."+th(p)+"."+A,r=Xd("dav1",i)}break}}return{codec:n,encrypted:a,supplemental:r}}function Xd(t,e){const i=Wd(e,["dvvC"]),s=i.length?i[0]:Wd(e,["dvcC"])[0];if(s){const e=s[2]>>1&127,i=s[2]<<5&32|s[3]>>3&31;return t+"."+th(e)+"."+th(i)}}function Zd(t,e){const i=e+5;for(;128&t[e++]&&e<i;);return e}function Jd(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}function th(t){return(t<10?"0":"")+t}function eh(t,e){Wd(t,["moov","trak"]).forEach(t=>{const i=Wd(t,["mdia","minf","stbl","stsd"])[0];if(!i)return;const s=i.subarray(8);let r=Wd(s,["enca"]);const n=r.length>0;n||(r=Wd(s,["encv"])),r.forEach(t=>{Wd(n?t.subarray(28):t.subarray(78),["sinf"]).forEach(t=>{const i=ih(t);i&&e(i,n)})})})}function ih(t){const e=Wd(t,["schm"])[0];if(e){const i=Vd(e.subarray(4,8));if("cbcs"===i||"cenc"===i){const e=Wd(t,["schi","tenc"])[0];if(e)return e}}}function sh(t,e){const i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i}function rh(t,e){const i=[],s=e.samples,r=e.timescale,n=e.id;let a=!1;return Wd(s,["moof"]).map(o=>{const l=o.byteOffset-8;Wd(o,["traf"]).map(o=>{const d=Wd(o,["tfdt"]).map(t=>{const e=t[0];let i=Qd(t,4);return 1===e&&(i*=Math.pow(2,32),i+=Qd(t,8)),i/r})[0];return void 0!==d&&(t=d),Wd(o,["tfhd"]).map(d=>{const h=Qd(d,4),c=16777215&Qd(d,0);let u=0;const f=!!(16&c);let g=0;const m=!!(32&c);let p=8;h===n&&(!!(1&c)&&(p+=8),!!(2&c)&&(p+=4),!!(8&c)&&(u=Qd(d,p),p+=4),f&&(g=Qd(d,p),p+=4),m&&(p+=4),"video"===e.type&&(a=nh(e.codec)),Wd(o,["trun"]).map(n=>{const o=n[0],d=16777215&Qd(n,0),h=!!(1&d);let c=0;const f=!!(4&d),m=!!(256&d);let p=0;const A=!!(512&d);let v=0;const y=!!(1024&d),E=!!(2048&d);let T=0;const S=Qd(n,4);let b=8;h&&(c=Qd(n,b),b+=4),f&&(b+=4);let I=c+l;for(let l=0;l<S;l++){if(m?(p=Qd(n,b),b+=4):p=u,A?(v=Qd(n,b),b+=4):v=g,y&&(b+=4),E&&(T=0===o?Qd(n,b):qd(n,b),b+=4),e.type===Pd){let e=0;for(;e<v;){const n=Qd(s,I);if(I+=4,ah(a,s[I])){oh(s.subarray(I,I+n),a?2:1,t+T/r,i)}I+=n,e+=n+4}}t+=p/r}}))})})}),i}function nh(t){if(!t)return!1;const e=t.substring(0,4);return"hvc1"===e||"hev1"===e||"dvh1"===e||"dvhe"===e}function ah(t,e){if(t){const t=e>>1&63;return 39===t||40===t}return 6===(31&e)}function oh(t,e,i,s){const r=lh(t);let n=0;n+=e;let a=0,o=0,l=0;for(;n<r.length;){a=0;do{if(n>=r.length)break;l=r[n++],a+=l}while(255===l);o=0;do{if(n>=r.length)break;l=r[n++],o+=l}while(255===l);const t=r.length-n;let e=n;if(o<t)n+=o;else if(o>t){md.error(`Malformed SEI payload. ${o} is too small, only ${t} bytes left to parse.`);break}if(4===a){if(181===r[e++]){const t=Gd(r,e);if(e+=2,49===t){const t=Qd(r,e);if(e+=4,1195456820===t){const t=r[e++];if(3===t){const n=r[e++],o=64&n,l=o?2+3*(31&n):0,d=new Uint8Array(l);if(o){d[0]=n;for(let t=1;t<l;t++)d[t]=r[e++]}s.push({type:t,payloadType:a,pts:i,bytes:d})}}}}}else if(5===a&&o>16){const t=[];for(let i=0;i<16;i++){const s=r[e++].toString(16);t.push(1==s.length?"0"+s:s),3!==i&&5!==i&&7!==i&&9!==i||t.push("-")}const n=o-16,l=new Uint8Array(n);for(let i=0;i<n;i++)l[i]=r[e++];s.push({payloadType:a,pts:i,uuid:t.join(""),userData:vd(l),userDataBytes:l})}}}function lh(t){const e=t.byteLength,i=[];let s=1;for(;s<e-2;)0===t[s]&&0===t[s+1]&&3===t[s+2]?(i.push(s+2),s+=2):s++;if(0===i.length)return t;const r=e-i.length,n=new Uint8Array(r);let a=0;for(s=0;s<r;a++,s++)a===i[0]&&(a++,i.shift()),n[s]=t[a];return n}function dh(t,e,i){if(16!==t.byteLength)throw new RangeError("Invalid system id");let s,r,n;s=0,r=new Uint8Array,n=new Uint8Array;const a=new Uint8Array(4);return i.byteLength>0&&new DataView(a.buffer).setUint32(0,i.byteLength,!1),function(t,...e){const i=e.length;let s=8,r=i;for(;r--;)s+=e[r].byteLength;const n=new Uint8Array(s);for(n[0]=s>>24&255,n[1]=s>>16&255,n[2]=s>>8&255,n[3]=255&s,n.set(t,4),r=0,s=8;r<i;r++)n.set(e[r],s),s+=e[r].byteLength;return n}([112,115,115,104],new Uint8Array([0,0,0,0]),t,n,r,a,i)}function hh(t){const e=t.getUint32(0),i=t.byteOffset,s=t.byteLength;if(s<e)return{offset:i,size:s};if(1886614376!==t.getUint32(4))return{offset:i,size:e};const r=t.getUint32(8)>>>24;if(0!==r&&1!==r)return{offset:i,size:e};const n=t.buffer,a=yd(new Uint8Array(n,i+12,16));let o=null,l=null,d=0;if(0===r)d=28;else{const r=t.getUint32(28);if(!r||s<32+16*r)return{offset:i,size:e};o=[];for(let t=0;t<r;t++)o.push(new Uint8Array(n,i+32+16*t,16));d=32+16*r}if(!d)return{offset:i,size:e};const h=t.getUint32(d);return e-32<h?{offset:i,size:e}:(l=new Uint8Array(n,i+d+4,h),{version:r,systemId:a,kids:o,data:l,offset:i,size:e})}const ch=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),uh={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function fh(t,e){const i=uh[e];return!!i&&!!i[t.slice(0,4)]}function gh(t,e,i=!0){return!t.split(",").some(t=>!mh(t,e,i))}function mh(t,e,i=!0){var s;const r=pd(i);return null!=(s=null==r?void 0:r.isTypeSupported(ph(t,e)))&&s}function ph(t,e){return`${e}/mp4;codecs=${t}`}function Ah(t){if(t){const e=t.substring(0,4);return uh.video[e]}return 2}function vh(t){const e=ch();return t.split(",").reduce((t,i)=>{const s=e&&nh(i)?9:uh.video[i];return s?(2*s+t)/(t?3:2):(uh.audio[i]+t)/(t?2:1)},0)}const yh={};const Eh=/flac|opus|mp4a\.40\.34/i;function Th(t,e=!0){return t.replace(Eh,t=>function(t,e=!0){if(yh[t])return yh[t];const i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[t];for(let r=0;r<i.length;r++){var s;if(mh(i[r],"audio",e))return yh[t]=i[r],i[r];if("mp3"===i[r]&&null!=(s=pd(e))&&s.isTypeSupported("audio/mpeg"))return""}return t}(t.toLowerCase(),e))}function Sh(t,e){if(t&&(t.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(t))&&(bh(t,"audio")||bh(t,"video")))return t;if(e){const i=e.split(",");if(i.length>1){if(t)for(let e=i.length;e--;)if(i[e].substring(0,4)===t.substring(0,4))return i[e];return i[0]}}return e||t}function bh(t,e){return fh(t,e)&&mh(t,e)}function Ih(t){if(t.startsWith("av01.")){const e=t.split("."),i=["0","111","01","01","01","0"];for(let t=e.length;t>4&&t<10;t++)e[t]=i[t-4];return e.join(".")}return t}function Lh(t){const e=pd(t)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Rh(t){return t.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const kh={supported:!1,smooth:!1,powerEfficient:!1},wh={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function Dh(t,e){return{supported:!1,configurations:e,decodingInfoResults:[kh],error:t}}function Ch(t,e,i,s,r,n){const a=t.videoCodec,o=t.audioCodec?t.audioGroups:null,l=null==n?void 0:n.audioCodec,d=null==n?void 0:n.channels,h=d?parseInt(d):l?1/0:2;let c=null;if(null!=o&&o.length)try{c=1===o.length&&o[0]?e.groups[o[0]].channels:o.reduce((t,i)=>{if(i){const s=e.groups[i];if(!s)throw new Error(`Audio track group ${i} not found`);Object.keys(s.channels).forEach(e=>{t[e]=(t[e]||0)+s.channels[e]})}return t},{2:0})}catch(u){return!0}return void 0!==a&&(a.split(",").some(t=>nh(t))||t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(s,30)||"SDR"!==t.videoRange&&t.videoRange!==i||t.bitrate>Math.max(r,8e6))||!!c&&Ql(h)&&Object.keys(c).some(t=>parseInt(t)>h)}function xh(t,e,i,s={}){const r=t.videoCodec;if(!r&&!t.audioCodec||!i)return Promise.resolve(wh);const n=[],a=function(t){var e;const i=null==(e=t.videoCodec)?void 0:e.split(","),s=Mh(t),r=t.width||640,n=t.height||480,a=t.frameRate||30,o=t.videoRange.toLowerCase();return i?i.map(t=>{const e={contentType:ph(Ih(t),"video"),width:r,height:n,bitrate:s,framerate:a};return"sdr"!==o&&(e.transferFunction=o),e}):[]}(t),o=a.length,l=function(t,e,i){var s;const r=null==(s=t.audioCodec)?void 0:s.split(","),n=Mh(t);if(r&&t.audioGroups)return t.audioGroups.reduce((t,s)=>{var a;const o=s?null==(a=e.groups[s])?void 0:a.tracks:null;return o?o.reduce((t,e)=>{if(e.groupId===s){const s=parseFloat(e.channels||"");r.forEach(e=>{const r={contentType:ph(e,"audio"),bitrate:i?Ph(e,n):n};s&&(r.channels=""+s),t.push(r)})}return t},t):t},[]);return[]}(t,e,o>0),d=l.length;for(let h=o||1*d||1;h--;){const t={type:"media-source"};if(o&&(t.video=a[h%o]),d){t.audio=l[h%d];const e=t.audio.bitrate;t.video&&e&&(t.video.bitrate-=e)}n.push(t)}if(r){const t=navigator.userAgent;if(r.split(",").some(t=>nh(t))&&ch())return Promise.resolve(Dh(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${t})`),n))}return Promise.all(n.map(t=>{const e=function(t){let e="";const{audio:i,video:s}=t;if(s){e+=`${Rh(s.contentType)}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(i){e+=`${s?"_":""}${Rh(i.contentType)}_c${i.channels}`}return e}(t);return s[e]||(s[e]=i.decodingInfo(t))})).then(t=>({supported:!t.some(t=>!t.supported),configurations:n,decodingInfoResults:t})).catch(t=>({supported:!1,configurations:n,decodingInfoResults:[],error:t}))}function Ph(t,e){if(e<=1)return 1;let i=128e3;return"ec-3"===t?i=768e3:"ac-3"===t&&(i=64e4),Math.min(e/2,i)}function Mh(t){return 1e3*Math.ceil(Math.max(.9*t.bitrate,t.averageBitrate)/1e3)||1}const Oh=["NONE","TYPE-0","TYPE-1",null];const Bh=["SDR","PQ","HLG"];var Fh="",Nh="YES",_h="v2";function Uh(t){const{canSkipUntil:e,canSkipDateRanges:i,age:s}=t;return e&&s<e/2?i?_h:Nh:Fh}class Hh{constructor(t,e,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=e,this.skip=i}addDirectives(t){const e=new self.URL(t);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href}}class jh{constructor(t){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=[t.videoCodec,t.audioCodec].filter(t=>!!t).map(t=>t.substring(0,4)).join(","),"supplemental"in t){var e;this.supplemental=t.supplemental;const i=null==(e=t.supplemental)?void 0:e.videoCodec;i&&i!==t.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(t){return Vh(this._audioGroups,t)}hasSubtitleGroup(t){return Vh(this._subtitleGroups,t)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(t,e){if(e)if("audio"===t){let t=this._audioGroups;t||(t=this._audioGroups=[]),-1===t.indexOf(e)&&t.push(e)}else if("text"===t){let t=this._subtitleGroups;t||(t=this._subtitleGroups=[]),-1===t.indexOf(e)&&t.push(e)}}get urlId(){return 0}set urlId(t){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var t;return null==(t=this.audioGroups)?void 0:t[0]}get textGroupId(){var t;return null==(t=this.subtitleGroups)?void 0:t[0]}addFallback(){}}function Vh(t,e){return!(!e||!t)&&-1!==t.indexOf(e)}function Gh(t,e){let i=!1,s=[];if(t&&(i="SDR"!==t,s=[t]),e){s=e.allowedVideoRanges||Bh.slice(0);const t="SDR"!==s.join("")&&!e.videoCodec;i=void 0!==e.preferHDR?e.preferHDR:t&&function(){if("function"==typeof matchMedia){const t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return!0===t.matches}return!1}(),i||(s=["SDR"])}return{preferHDR:i,allowedVideoRanges:s}}const Qh=(t,e)=>JSON.stringify(t,(t=>{const e=new WeakSet;return(i,s)=>{if(t&&(s=t(i,s)),"object"==typeof s&&null!==s){if(e.has(s))return;e.add(s)}return s}})(e));function Kh(t,e){md.log(`[abr] start candidates with "${t}" ignored because ${e}`)}function qh(t){return t.reduce((t,e)=>{let i=t.groups[e.groupId];i||(i=t.groups[e.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(e);const s=e.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||e.default,i.hasAutoSelect=i.hasAutoSelect||e.autoselect,i.hasDefault&&(t.hasDefaultAudio=!0),i.hasAutoSelect&&(t.hasAutoSelectAudio=!0),t},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Wh(t){if(!t)return t;const{lang:e,assocLang:i,characteristics:s,channels:r,audioCodec:n}=t;return{lang:e,assocLang:i,characteristics:s,channels:r,audioCodec:n}}function Yh(t,e,i){if("attrs"in t){const i=e.indexOf(t);if(-1!==i)return i}for(let s=0;s<e.length;s++){if($h(t,e[s],i))return s}return-1}function $h(t,e,i){const{groupId:s,name:r,lang:n,assocLang:a,default:o}=t,l=t.forced;return(void 0===s||e.groupId===s)&&(void 0===r||e.name===r)&&(void 0===n||function(t,e="--"){if(t.length===e.length)return t===e;return t.startsWith(e)||e.startsWith(t)}(n,e.lang))&&(void 0===n||e.assocLang===a)&&(void 0===o||e.default===o)&&(void 0===l||e.forced===l)&&(!("characteristics"in t)||function(t,e=""){const i=t.split(","),s=e.split(",");return i.length===s.length&&!i.some(t=>-1===s.indexOf(t))}(t.characteristics||"",e.characteristics))&&(void 0===i||i(t,e))}function zh(t,e){const{audioCodec:i,channels:s}=t;return!(void 0!==i&&(e.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==s&&s!==(e.channels||"2"))}function Xh(t,e,i){for(let s=e;s>-1;s--)if(i(t[s]))return s;for(let s=e+1;s<t.length;s++)if(i(t[s]))return s;return-1}function Zh(t,e){var i;return!!t&&t!==(null==(i=e.loadLevelObj)?void 0:i.uri)}const Jh=function(t,e){let i=0,s=t.length-1,r=null,n=null;for(;i<=s;){r=(i+s)/2|0,n=t[r];const a=e(n);if(a>0)i=r+1;else{if(!(a<0))return n;s=r-1}}return null};function tc(t,e,i=0,s=0,r=.005){let n=null;if(t){n=e[1+t.sn-e[0].sn]||null;const s=t.endDTS-i;s>0&&s<15e-7&&(i+=15e-7),n&&t.level!==n.level&&n.end<=t.end&&(n=e[2+t.sn-e[0].sn]||null)}else 0===i&&0===e[0].start&&(n=e[0]);if(n&&((!t||t.level===n.level)&&0===ec(i,s,n)||function(t,e,i){if(e&&0===e.start&&e.level<t.level&&(e.endPTS||0)>0){const s=e.tagList.reduce((t,e)=>("INF"===e[0]&&(t+=parseFloat(e[1])),t),i);return t.start<=s}return!1}(n,t,Math.min(r,s))))return n;const a=Jh(e,ec.bind(null,i,s));return!a||a===t&&n?n:a}function ec(t=0,e=0,i){if(i.start<=t&&i.start+i.duration>t)return 0;const s=Math.min(e,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-s<=t?1:i.start-s>t&&i.start?-1:0}function ic(t,e,i){const s=1e3*Math.min(e,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-s>t}function sc(t,e,i){if(t&&t.startCC<=e&&t.endCC>=e){let s=t.fragments;const{fragmentHint:r}=t;let n;return r&&(s=s.concat(r)),Jh(s,t=>t.cc<e?1:t.cc>e?-1:(n=t,t.end<=i?1:t.start>i?-1:0)),n||null}return null}function rc(t){switch(t.details){case Yl.FRAG_LOAD_TIMEOUT:case Yl.KEY_LOAD_TIMEOUT:case Yl.LEVEL_LOAD_TIMEOUT:case Yl.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function nc(t){return t.details.startsWith("key")}function ac(t){return nc(t)&&!!t.frag&&!t.frag.decryptdata}function oc(t,e){const i=rc(e);return t.default[(i?"timeout":"error")+"Retry"]}function lc(t,e){const i="linear"===t.backoff?1:Math.pow(2,e);return Math.min(i*t.retryDelayMs,t.maxRetryDelayMs)}function dc(t){return ld(ld({},t),{errorRetry:null,timeoutRetry:null})}function hc(t,e,i,s){if(!t)return!1;const r=null==s?void 0:s.code,n=e<t.maxNumRetry&&(function(t){return cc(t)||!!t&&(t<400||t>499)}(r)||!!i);return t.shouldRetry?t.shouldRetry(t,e,i,s,n):n}function cc(t){return 0===t&&!1===navigator.onLine}var uc=0,fc=2,gc=3,mc=5,pc=0,Ac=1,vc=2,yc=4;function Ec(t){const e={action:uc,flags:pc};return t&&(e.resolved=!0),e}var Tc="NOT_LOADED",Sc="APPENDING",bc="PARTIAL",Ic="OK";class Lc{constructor(t){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=t,this._registerListeners()}_registerListeners(){const{hls:t}=this;t&&(t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.BUFFER_APPENDED,this.onBufferAppended,this),t.on($l.FRAG_BUFFERED,this.onFragBuffered,this),t.on($l.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:t}=this;t&&(t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.BUFFER_APPENDED,this.onBufferAppended,this),t.off($l.FRAG_BUFFERED,this.onFragBuffered,this),t.off($l.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(t,e){const i=this.activePartLists[e];if(i)for(let s=i.length;s--;){const e=i[s];if(!e)break;if(e.start<=t&&t<=e.end&&e.loaded)return e}return this.getBufferedFrag(t,e)}getBufferedFrag(t,e){return this.getFragAtPos(t,e,!0)}getFragAtPos(t,e,i){const{fragments:s}=this,r=Object.keys(s);for(let n=r.length;n--;){const a=s[r[n]];if((null==a?void 0:a.body.type)===e&&(!i||a.buffered)){const e=a.body;if(e.start<=t&&t<=e.end)return e}}return null}detectEvictedFragments(t,e,i,s,r){this.timeRanges&&(this.timeRanges[t]=e);const n=(null==s?void 0:s.fragment.sn)||-1;Object.keys(this.fragments).forEach(s=>{const a=this.fragments[s];if(!a)return;if(n>=a.body.sn)return;if(!a.buffered&&(!a.loaded||r))return void(a.body.type===i&&this.removeFragment(a.body));const o=a.range[t];o&&(0!==o.time.length?o.time.some(t=>{const i=!this.isTimeBuffered(t.startPTS,t.endPTS,e);return i&&this.removeFragment(a.body),i}):this.removeFragment(a.body))})}detectPartialFragments(t){const e=this.timeRanges;if(!e||"initSegment"===t.frag.sn)return;const i=t.frag,s=kc(i),r=this.fragments[s];if(!r||r.buffered&&i.gap)return;const n=!i.relurl;Object.keys(e).forEach(s=>{const a=i.elementaryStreams[s];if(!a)return;const o=e[s],l=n||!0===a.partial;r.range[s]=this.getBufferedTimes(i,t.part,l,o)}),r.loaded=null,Object.keys(r.range).length?(this.bufferedEnd(r,i),Rc(r)||this.removeParts(i.sn-1,i.type)):this.removeFragment(r.body)}bufferedEnd(t,e){t.buffered=!0;(t.body.endList=e.endList||t.body.endList)&&(this.endListFragments[t.body.type]=t)}removeParts(t,e){const i=this.activePartLists[e];i&&(this.activePartLists[e]=wc(i,e=>e.fragment.sn>=t))}fragBuffered(t,e){const i=kc(t);let s=this.fragments[i];!s&&e&&(s=this.fragments[i]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,this.bufferedEnd(s,t))}getBufferedTimes(t,e,i,s){const r={time:[],partial:i},n=t.start,a=t.end,o=t.minEndPTS||a,l=t.maxStartPTS||n;for(let d=0;d<s.length;d++){const t=s.start(d)-this.bufferPadding,e=s.end(d)+this.bufferPadding;if(l>=t&&o<=e){r.time.push({startPTS:Math.max(n,s.start(d)),endPTS:Math.min(a,s.end(d))});break}if(n<e&&a>t){const t=Math.max(n,s.start(d)),e=Math.min(a,s.end(d));e>t&&(r.partial=!0,r.time.push({startPTS:t,endPTS:e}))}else if(a<=t)break}return r}getPartialFragment(t){let e,i,s,r=null,n=0;const{bufferPadding:a,fragments:o}=this;return Object.keys(o).forEach(l=>{const d=o[l];d&&Rc(d)&&(i=d.body.start-a,s=d.body.end+a,t>=i&&t<=s&&(e=Math.min(t-i,s-t),n<=e&&(r=d.body,n=e)))}),r}isEndListAppended(t){const e=this.endListFragments[t];return void 0!==e&&(e.buffered||Rc(e))}getState(t){const e=kc(t),i=this.fragments[e];return i?i.buffered?Rc(i)?bc:Ic:Sc:Tc}isTimeBuffered(t,e,i){let s,r;for(let n=0;n<i.length;n++){if(s=i.start(n)-this.bufferPadding,r=i.end(n)+this.bufferPadding,t>=s&&e<=r)return!0;if(e<=s)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(t,e){if("initSegment"===e.frag.sn||e.frag.bitrateTest)return;const i=e.frag,s=e.part?null:e,r=kc(i);this.fragments[r]={body:i,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(t,e){const{frag:i,part:s,timeRanges:r,type:n}=e;if("initSegment"===i.sn)return;const a=i.type;if(s){let t=this.activePartLists[a];t||(this.activePartLists[a]=t=[]),t.push(s)}this.timeRanges=r;const o=r[n];this.detectEvictedFragments(n,o,a,s)}onFragBuffered(t,e){this.detectPartialFragments(e)}hasFragment(t){const e=kc(t);return!!this.fragments[e]}hasFragments(t){const{fragments:e}=this,i=Object.keys(e);if(!t)return i.length>0;for(let s=i.length;s--;){const r=e[i[s]];if((null==r?void 0:r.body.type)===t)return!0}return!1}hasParts(t){var e;return!(null==(e=this.activePartLists[t])||!e.length)}removeFragmentsInRange(t,e,i,s,r){s&&!this.hasGaps||Object.keys(this.fragments).forEach(n=>{const a=this.fragments[n];if(!a)return;const o=a.body;o.type!==i||s&&!o.gap||o.start<e&&o.end>t&&(a.buffered||r)&&this.removeFragment(o)})}removeFragment(t){const e=kc(t);t.clearElementaryStreamInfo();const i=this.activePartLists[t.type];if(i){const e=t.sn;this.activePartLists[t.type]=wc(i,t=>t.fragment.sn!==e)}delete this.fragments[e],t.endList&&delete this.endListFragments[t.type]}removeAllFragments(){var t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const e=null==(t=this.hls)||null==(t=t.latestLevelDetails)?void 0:t.partList;e&&e.forEach(t=>t.clearElementaryStreamInfo())}}function Rc(t){var e,i,s;return t.buffered&&!!(t.body.gap||null!=(e=t.range.video)&&e.partial||null!=(i=t.range.audio)&&i.partial||null!=(s=t.range.audiovideo)&&s.partial)}function kc(t){return`${t.type}_${t.level}_${t.sn}`}function wc(t,e){return t.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Dc=0,Cc=1;class xc{constructor(t,e,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=t,this.aesIV=e,this.aesMode=i}decrypt(t,e){switch(this.aesMode){case Dc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t);case Cc:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},e,t);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}class Pc{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(t){const e=new DataView(t),i=new Uint32Array(4);for(let s=0;s<4;s++)i[s]=e.getUint32(4*s);return i}initTable(){const t=this.sBox,e=this.invSBox,i=this.subMix,s=i[0],r=i[1],n=i[2],a=i[3],o=this.invSubMix,l=o[0],d=o[1],h=o[2],c=o[3],u=new Uint32Array(256);let f=0,g=0,m=0;for(m=0;m<256;m++)u[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){let i=g^g<<1^g<<2^g<<3^g<<4;i=i>>>8^255&i^99,t[f]=i,e[i]=f;const o=u[f],m=u[o],p=u[m];let A=257*u[i]^16843008*i;s[f]=A<<24|A>>>8,r[f]=A<<16|A>>>16,n[f]=A<<8|A>>>24,a[f]=A,A=16843009*p^65537*m^257*o^16843008*f,l[i]=A<<24|A>>>8,d[i]=A<<16|A>>>16,h[i]=A<<8|A>>>24,c[i]=A,f?(f=o^u[u[u[p^o]]],g^=u[u[g]]):f=g=1}}expandKey(t){const e=this.uint8ArrayToUint32Array_(t);let i=!0,s=0;for(;s<e.length&&i;)i=e[s]===this.key[s],s++;if(i)return;this.key=e;const r=this.keySize=e.length;if(4!==r&&6!==r&&8!==r)throw new Error("Invalid aes key size="+r);const n=this.ksRows=4*(r+6+1);let a,o;const l=this.keySchedule=new Uint32Array(n),d=this.invKeySchedule=new Uint32Array(n),h=this.sBox,c=this.rcon,u=this.invSubMix,f=u[0],g=u[1],m=u[2],p=u[3];let A,v;for(a=0;a<n;a++)a<r?A=l[a]=e[a]:(v=A,a%r===0?(v=v<<8|v>>>24,v=h[v>>>24]<<24|h[v>>>16&255]<<16|h[v>>>8&255]<<8|h[255&v],v^=c[a/r|0]<<24):r>6&&a%r===4&&(v=h[v>>>24]<<24|h[v>>>16&255]<<16|h[v>>>8&255]<<8|h[255&v]),l[a]=A=(l[a-r]^v)>>>0);for(o=0;o<n;o++)a=n-o,v=3&o?l[a]:l[a-4],d[o]=o<4||a<=4?v:f[h[v>>>24]]^g[h[v>>>16&255]]^m[h[v>>>8&255]]^p[h[255&v]],d[o]=d[o]>>>0}networkToHostOrderSwap(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24}decrypt(t,e,i){const s=this.keySize+6,r=this.invKeySchedule,n=this.invSBox,a=this.invSubMix,o=a[0],l=a[1],d=a[2],h=a[3],c=this.uint8ArrayToUint32Array_(i);let u=c[0],f=c[1],g=c[2],m=c[3];const p=new Int32Array(t),A=new Int32Array(p.length);let v,y,E,T,S,b,I,L,R,k,w,D,C,x;const P=this.networkToHostOrderSwap;for(;e<p.length;){for(R=P(p[e]),k=P(p[e+1]),w=P(p[e+2]),D=P(p[e+3]),S=R^r[0],b=D^r[1],I=w^r[2],L=k^r[3],C=4,x=1;x<s;x++)v=o[S>>>24]^l[b>>16&255]^d[I>>8&255]^h[255&L]^r[C],y=o[b>>>24]^l[I>>16&255]^d[L>>8&255]^h[255&S]^r[C+1],E=o[I>>>24]^l[L>>16&255]^d[S>>8&255]^h[255&b]^r[C+2],T=o[L>>>24]^l[S>>16&255]^d[b>>8&255]^h[255&I]^r[C+3],S=v,b=y,I=E,L=T,C+=4;v=n[S>>>24]<<24^n[b>>16&255]<<16^n[I>>8&255]<<8^n[255&L]^r[C],y=n[b>>>24]<<24^n[I>>16&255]<<16^n[L>>8&255]<<8^n[255&S]^r[C+1],E=n[I>>>24]<<24^n[L>>16&255]<<16^n[S>>8&255]<<8^n[255&b]^r[C+2],T=n[L>>>24]<<24^n[S>>16&255]<<16^n[b>>8&255]<<8^n[255&I]^r[C+3],A[e]=P(v^u),A[e+1]=P(T^f),A[e+2]=P(E^g),A[e+3]=P(y^m),u=R,f=k,g=w,m=D,e+=4}return A.buffer}}class Mc{constructor(t,e,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=t,this.key=e,this.aesMode=i}expandKey(){const t=function(t){switch(t){case Dc:return"AES-CBC";case Cc:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${t}`)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:t},!1,["encrypt","decrypt"])}}class Oc{constructor(t,{removePKCS7Padding:e=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=t.enableSoftwareAES,this.removePKCS7Padding=e,e)try{const t=self.crypto;t&&(this.subtle=t.subtle||t.webkitSubtle)}catch(i){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:t,remainderData:e}=this;if(!t||e)return this.reset(),null;const i=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?function(t){const e=t.byteLength,i=e&&new DataView(t.buffer).getUint8(e-1);return i?t.slice(0,e-i):t}(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(t,e,i,s){return this.useSoftware?new Promise((r,n)=>{const a=ArrayBuffer.isView(t)?t:new Uint8Array(t);this.softwareDecrypt(a,e,i,s);const o=this.flush();o?r(o.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(t),e,i,s)}softwareDecrypt(t,e,i,s){const{currentIV:r,currentResult:n,remainderData:a}=this;if(s!==Dc||16!==e.byteLength)return md.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),a&&(t=sh(a,t),this.remainderData=null);const o=this.getValidChunk(t);if(!o.length)return null;r&&(i=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Pc),l.expandKey(e);const d=n;return this.currentResult=l.decrypt(o.buffer,0,i),this.currentIV=o.slice(-16).buffer,d||null}webCryptoDecrypt(t,e,i,s){if(this.key!==e||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(t,e,i,s));this.key=e,this.fastAesKey=new Mc(this.subtle,e,s)}return this.fastAesKey.expandKey().then(e=>{if(!this.subtle)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new xc(this.subtle,new Uint8Array(i),s).decrypt(t.buffer,e)}).catch(r=>(md.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(t,e,i,s)))}onWebCryptoError(t,e,i,s){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,e,i,s);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(t){let e=t;const i=t.length-t.length%16;return i!==t.length&&(e=t.slice(0,i),this.remainderData=t.slice(i)),e}logOnce(t){this.logEnabled&&(md.log(`[decrypter]: ${t}`),this.logEnabled=!1)}}const Bc=Math.pow(2,17);class Fc{constructor(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(t,e){const i=t.url;if(!i)return Promise.reject(new Uc({type:Wl.NETWORK_ERROR,details:Yl.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error("Fragment does not have a "+(i?"part list":"url")),networkDetails:null}));this.abort();const s=this.config,r=s.fLoader,n=s.loader;return new Promise((a,o)=>{if(this.loader&&this.loader.destroy(),t.gap){if(t.tagList.some(t=>"GAP"===t[0]))return void o(_c(t));t.gap=!1}const l=this.loader=r?new r(s):new n(s),d=Nc(t);t.loader=l;const h=dc(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===t.sn?1/0:Bc};t.stats=l.stats;const u={onSuccess:(e,i,s,r)=>{this.resetLoader(t,l);let n=e.data;s.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(n.slice(0,16)),n=n.slice(16)),a({frag:t,part:null,payload:n,networkDetails:r})},onError:(e,s,r,n)=>{this.resetLoader(t,l),o(new Uc({type:Wl.NETWORK_ERROR,details:Yl.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:ld({url:i,data:void 0},e),error:new Error(`HTTP Error ${e.code} ${e.text}`),networkDetails:r,stats:n}))},onAbort:(e,i,s)=>{this.resetLoader(t,l),o(new Uc({type:Wl.NETWORK_ERROR,details:Yl.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:s,stats:e}))},onTimeout:(e,i,s)=>{this.resetLoader(t,l),o(new Uc({type:Wl.NETWORK_ERROR,details:Yl.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:s,stats:e}))}};e&&(u.onProgress=(i,s,r,n)=>e({frag:t,part:null,payload:r,networkDetails:n})),l.load(d,c,u)})}loadPart(t,e,i){this.abort();const s=this.config,r=s.fLoader,n=s.loader;return new Promise((a,o)=>{if(this.loader&&this.loader.destroy(),t.gap||e.gap)return void o(_c(t,e));const l=this.loader=r?new r(s):new n(s),d=Nc(t,e);t.loader=l;const h=dc(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Bc};e.stats=l.stats,l.load(d,c,{onSuccess:(s,r,n,o)=>{this.resetLoader(t,l),this.updateStatsFromPart(t,e);const d={frag:t,part:e,payload:s.data,networkDetails:o};i(d),a(d)},onError:(i,s,r,n)=>{this.resetLoader(t,l),o(new Uc({type:Wl.NETWORK_ERROR,details:Yl.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:ld({url:d.url,data:void 0},i),error:new Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:r,stats:n}))},onAbort:(i,s,r)=>{t.stats.aborted=e.stats.aborted,this.resetLoader(t,l),o(new Uc({type:Wl.NETWORK_ERROR,details:Yl.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,error:new Error("Aborted"),networkDetails:r,stats:i}))},onTimeout:(i,s,r)=>{this.resetLoader(t,l),o(new Uc({type:Wl.NETWORK_ERROR,details:Yl.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:r,stats:i}))}})})}updateStatsFromPart(t,e){const i=t.stats,s=e.stats,r=s.total;if(i.loaded+=s.loaded,r){const s=Math.round(t.duration/e.duration),n=Math.min(Math.round(i.loaded/r),s),a=(s-n)*Math.round(i.loaded/n);i.total=i.loaded+a}else i.total=Math.max(i.loaded,i.total);const n=i.loading,a=s.loading;n.start?n.first+=a.first-a.start:(n.start=a.start,n.first=a.first),n.end=a.end}resetLoader(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()}}function Nc(t,e=null){const i=e||t,s={frag:t,part:e,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},r=i.byteRangeStartOffset,n=i.byteRangeEndOffset;if(Ql(r)&&Ql(n)){var a;let e=r,i=n;if("initSegment"===t.sn&&("AES-128"===(o=null==(a=t.decryptdata)?void 0:a.method)||"AES-256"===o)){const t=n-r;t%16&&(i=n+(16-t%16)),0!==r&&(s.resetIV=!0,e=r-16)}s.rangeStart=e,s.rangeEnd=i}var o;return s}function _c(t,e){const i=new Error(`GAP ${t.gap?"tag":"attribute"} found`),s={type:Wl.MEDIA_ERROR,details:Yl.FRAG_GAP,fatal:!1,frag:t,error:i,networkDetails:null};return e&&(s.part=e),(e||t).stats.aborted=!0,new Uc(s)}class Uc extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class Hc extends dd{constructor(t,e){super(t,e),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(t){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,t),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class jc{constructor(t,e,i,s=0,r=-1,n=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=e,this.id=i,this.size=s,this.part=r,this.partial=n}}const Vc={length:0,start:()=>0,end:()=>0};class Gc{static isBuffered(t,e){if(t){const i=Gc.getBuffered(t);for(let t=i.length;t--;)if(e>=i.start(t)&&e<=i.end(t))return!0}return!1}static bufferedRanges(t){if(t){const e=Gc.getBuffered(t);return Gc.timeRangesToArray(e)}return[]}static timeRangesToArray(t){const e=[];for(let i=0;i<t.length;i++)e.push({start:t.start(i),end:t.end(i)});return e}static bufferInfo(t,e,i){if(t){const s=Gc.bufferedRanges(t);if(s.length)return Gc.bufferedInfo(s,e,i)}return{len:0,start:e,end:e,bufferedIndex:-1}}static bufferedInfo(t,e,i){e=Math.max(0,e),t.length>1&&t.sort((t,e)=>t.start-e.start||e.end-t.end);let s=-1,r=[];if(i)for(let d=0;d<t.length;d++){e>=t[d].start&&e<=t[d].end&&(s=d);const n=r.length;if(n){const e=r[n-1].end;t[d].start-e<i?t[d].end>e&&(r[n-1].end=t[d].end):r.push(t[d])}else r.push(t[d])}else r=t;let n,a=0,o=e,l=e;for(let d=0;d<r.length;d++){const t=r[d].start,h=r[d].end;if(-1===s&&e>=t&&e<=h&&(s=d),e+i>=t&&e<h)o=t,l=h,a=l-e;else if(e+i<t){n=t;break}}return{len:a,start:o||0,end:l||0,nextStart:n,buffered:t,bufferedIndex:s}}static getBuffered(t){try{return t.buffered||Vc}catch(e){return md.log("failed to get media.buffered",e),Vc}}}const Qc=/\{\$([a-zA-Z0-9-_]+)\}/g;function Kc(t){return Qc.test(t)}function qc(t,e){if(null!==t.variableList||t.hasVariableRefs){const i=t.variableList;return e.replace(Qc,e=>{const s=e.substring(2,e.length-1),r=null==i?void 0:i[s];return void 0===r?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),e):r})}return e}function Wc(t,e,i){let s,r,n=t.variableList;if(n||(t.variableList=n={}),"QUERYPARAM"in e){s=e.QUERYPARAM;try{const t=new self.URL(i).searchParams;if(!t.has(s))throw new Error(`"${s}" does not match any query parameter in URI: "${i}"`);r=t.get(s)}catch(a){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else s=e.NAME,r=e.VALUE;s in n?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):n[s]=r||""}function Yc(t,e,i){const s=e.IMPORT;if(i&&s in i){let e=t.variableList;e||(t.variableList=e={}),e[s]=i[s]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}const $c=/^(\d+)x(\d+)$/,zc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Xc{constructor(t,e){"string"==typeof t&&(t=Xc.parseAttrList(t,e)),ad(this,t)}get clientAttrs(){return Object.keys(this).filter(t=>"X-"===t.substring(0,2))}decimalInteger(t){const e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e}hexadecimalInteger(t){if(this[t]){let e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;const i=new Uint8Array(e.length/2);for(let t=0;t<e.length/2;t++)i[t]=parseInt(e.slice(2*t,2*t+2),16);return i}return null}hexadecimalIntegerAsNumber(t){const e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e}decimalFloatingPoint(t){return parseFloat(this[t])}optionalFloat(t,e){const i=this[t];return i?parseFloat(i):e}enumeratedString(t){return this[t]}enumeratedStringList(t,e){const i=this[t];return(i?i.split(/[ ,]+/):[]).reduce((t,e)=>(t[e.toLowerCase()]=!0,t),e)}bool(t){return"YES"===this[t]}decimalResolution(t){const e=$c.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}static parseAttrList(t,e){let i;const s={};for(zc.lastIndex=0;null!==(i=zc.exec(t));){const r=i[1].trim();let n=i[2];const a=0===n.indexOf('"')&&n.lastIndexOf('"')===n.length-1;let o=!1;if(a)n=n.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":o=!0}if(e&&(a||o))n=qc(e,n);else if(!o&&!a)switch(r){case"CLOSED-CAPTIONS":if("NONE"===n)break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":md.warn(`${t}: attribute ${r} is missing quotes`)}s[r]=n}return s}}function Zc(t){return"ID"!==t&&"CLASS"!==t&&"CUE"!==t&&"START-DATE"!==t&&"DURATION"!==t&&"END-DATE"!==t&&"END-ON-NEXT"!==t}function Jc(t){return"SCTE35-OUT"===t||"SCTE35-IN"===t||"SCTE35-CMD"===t}class tu{constructor(t,e,i=0){var s;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(null==e?void 0:e.tagAnchor)||null,this.tagOrder=null!=(s=null==e?void 0:e.tagOrder)?s:i,e){const i=e.attr;for(const e in i)if(Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==i[e]){md.warn(`DATERANGE tag attribute: "${e}" does not match for tags with ID: "${t.ID}"`),this._badValueForSameId=e;break}t=ad(new Xc({}),i,t)}if(this.attr=t,e?(this._startDate=e._startDate,this._cue=e._cue,this._endDate=e._endDate,this._dateAtEnd=e._dateAtEnd):this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){const t=(null==e?void 0:e.endDate)||new Date(this.attr["END-DATE"]);Ql(t.getTime())&&(this._endDate=t)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const t=this._cue;return void 0===t?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):t}get startTime(){const{tagAnchor:t}=this;return null===t||null===t.programDateTime?(md.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${t}`),NaN):t.start+(this.startDate.getTime()-t.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const t=this._endDate||this._dateAtEnd;if(t)return t;const e=this.duration;return null!==e?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){const t=this.attr.decimalFloatingPoint("DURATION");if(Ql(t))return t}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return"com.apple.hls.interstitial"===this.class}get isValid(){return!!this.id&&!this._badValueForSameId&&Ql(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}class eu{constructor(t){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}reloaded(t){if(!t)return this.advanced=!0,void(this.updated=!0);const e=this.lastPartSn-t.lastPartSn,i=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!i||!!e||!this.live,this.advanced=this.endSN>t.endSN||e>0||0===e&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1}hasKey(t){return this.encryptedFragments.some(e=>{let i=e.decryptdata;return i||(e.setKeyFormat(t.keyFormat),i=e.decryptdata),!!i&&t.matches(i)})}get hasProgramDateTime(){return!!this.fragments.length&&Ql(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const t=this.driftEndTime-this.driftStartTime;if(t>0){return 1e3*(this.driftEnd-this.driftStart)/t}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const t=this.partList;if(t){const e=this.lastPartIndex;if(-1!==e){for(let i=t.length;i--;)if(t[i].index>e)return t[i].index;return e}}return 0}get lastPartSn(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const t=this.partEnd-this.fragmentStart;return this.age>Math.max(t,this.totalduration)+this.levelTargetDuration}return!1}}function iu(t,e){return t.length===e.length&&!t.some((t,i)=>t!==e[i])}function su(t,e){return!t&&!e||!(!t||!e)&&iu(t,e)}function ru(t){return"AES-128"===t||"AES-256"===t||"AES-256-CTR"===t}function nu(t){switch(t){case"AES-128":case"AES-256":return Dc;case"AES-256-CTR":return Cc;default:throw new Error(`invalid full segment method ${t}`)}}function au(t){return Uint8Array.from(atob(t),t=>t.charCodeAt(0))}function ou(t){return Uint8Array.from(unescape(encodeURIComponent(t)),t=>t.charCodeAt(0))}function lu(t){const e=function(t,e,i){const s=t[e];t[e]=t[i],t[i]=s};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}function du(t){const e=t.split(":");let i=null;if("data"===e[0]&&2===e.length){const t=e[1].split(";"),s=t[t.length-1].split(",");if(2===s.length){const e="base64"===s[0],r=s[1];e?(t.splice(-1,1),i=au(r)):i=function(t){const e=ou(t).subarray(0,16),i=new Uint8Array(16);return i.set(e,16-e.length),i}(r)}}return i}const hu="undefined"!=typeof self?self:void 0;var cu={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},uu="org.w3.clearkey",fu="com.apple.streamingkeydelivery",gu="com.microsoft.playready",mu="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function pu(t){switch(t){case fu:return cu.FAIRPLAY;case gu:return cu.PLAYREADY;case mu:return cu.WIDEVINE;case uu:return cu.CLEARKEY}}function Au(t){switch(t){case cu.FAIRPLAY:return fu;case cu.PLAYREADY:return gu;case cu.WIDEVINE:return mu;case cu.CLEARKEY:return uu}}function vu(t){const{drmSystems:e,widevineLicenseUrl:i}=t,s=e?[cu.FAIRPLAY,cu.WIDEVINE,cu.PLAYREADY,cu.CLEARKEY].filter(t=>!!e[t]):[];return!s[cu.WIDEVINE]&&i&&s.push(cu.WIDEVINE),s}const yu=null!=hu&&null!=(Eu=hu.navigator)&&Eu.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var Eu;function Tu(t){const e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),i=String.fromCharCode.apply(null,Array.from(e)),s=i.substring(i.indexOf("<"),i.length),r=(new DOMParser).parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(r){const t=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(t){const e=au(t).subarray(0,16);return lu(e),e}}return null}let Su={};class bu{static clearKeyUriToKeyIdMap(){Su={}}static setKeyIdForUri(t,e){Su[t]=e}static addKeyIdForUri(t){const e=Object.keys(Su).length%Number.MAX_SAFE_INTEGER,i=new Uint8Array(16);return new DataView(i.buffer,12,4).setUint32(0,e),Su[t]=i,i}constructor(t,e,i,s=[1],r=null,n){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=t,this.uri=e,this.keyFormat=i,this.keyFormatVersions=s,this.iv=r,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&!ru(t),null!=n&&n.startsWith("0x")&&(this.keyId=new Uint8Array(Ed(n)))}matches(t){return t.uri===this.uri&&t.method===this.method&&t.encrypted===this.encrypted&&t.keyFormat===this.keyFormat&&iu(t.keyFormatVersions,this.keyFormatVersions)&&su(t.iv,this.iv)&&su(t.keyId,this.keyId)}isSupported(){if(this.method){if(ru(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case fu:case mu:case gu:case uu:return-1!==["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(t,e){if(!this.encrypted||!this.uri)return null;if(ru(this.method)){let e=this.iv;e||("number"!=typeof t&&(md.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),t=0),e=function(t){const e=new Uint8Array(16);for(let i=12;i<16;i++)e[i]=t>>8*(15-i)&255;return e}(t));return new bu(this.method,this.uri,"identity",this.keyFormatVersions,e)}if(this.keyId){const t=Su[this.uri];if(t&&!iu(this.keyId,t)&&bu.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const i=du(this.uri);if(i)switch(this.keyFormat){case mu:if(this.pssh=i,!this.keyId){const t=function(t){const e=[];if(t instanceof ArrayBuffer){const i=t.byteLength;let s=0;for(;s+32<i;){const i=hh(new DataView(t,s));e.push(i),s+=i.size}}return e}(i.buffer);if(t.length){var s;const e=t[0];this.keyId=null!=(s=e.kids)&&s.length?e.kids[0]:null}}this.keyId||(this.keyId=Iu(e));break;case gu:{const t=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=dh(t,0,i),this.keyId=Tu(i);break}default:{let t=i.subarray(0,16);if(16!==t.length){const e=new Uint8Array(16);e.set(t,16-t.length),t=e}this.keyId=t;break}}if(!this.keyId||16!==this.keyId.byteLength){let t;t=function(t){const e=null==t?void 0:t[mu];if(e)return e.keyId;return null}(e),t||(t=Iu(e),t||(t=Su[this.uri])),t&&(this.keyId=t,bu.setKeyIdForUri(this.uri,t))}return this}}function Iu(t){const e=null==t?void 0:t[gu];if(e){const t=du(e.uri);if(t)return Tu(t)}return null}const Lu=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Ru=/#EXT-X-MEDIA:(.*)/g,ku=/^#EXT(?:INF|-X-TARGETDURATION):/m,wu=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Du=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Cu{static findGroup(t,e){for(let i=0;i<t.length;i++){const s=t[i];if(s.id===e)return s}}static resolve(t,e){return Dd.buildAbsoluteURL(e,t,{alwaysNormalize:!0})}static isMediaPlaylist(t){return ku.test(t)}static parseMasterPlaylist(t,e){const i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Kc(t)},s=[];if(Lu.lastIndex=0,!t.startsWith("#EXTM3U"))return i.playlistParsingError=new Error("no EXTM3U delimiter"),i;let r;for(;null!=(r=Lu.exec(t));)if(r[1]){var n;const t=new Xc(r[1],i),a=qc(i,r[2]),o={attrs:t,bitrate:t.decimalInteger("BANDWIDTH")||t.decimalInteger("AVERAGE-BANDWIDTH"),name:t.NAME,url:Cu.resolve(a,e)},l=t.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),Bu(t.CODECS,o);const d=t["SUPPLEMENTAL-CODECS"];d&&(o.supplemental={},Bu(d,o.supplemental)),null!=(n=o.unknownCodecs)&&n.length||s.push(o),i.levels.push(o)}else if(r[3]){const t=r[3],s=r[4];switch(t){case"SESSION-DATA":{const t=new Xc(s,i),e=t["DATA-ID"];e&&(null===i.sessionData&&(i.sessionData={}),i.sessionData[e]=t);break}case"SESSION-KEY":{const t=Mu(s,e,i);t.encrypted&&t.isSupported()?(null===i.sessionKeys&&(i.sessionKeys=[]),i.sessionKeys.push(t)):md.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${s}"`);break}case"DEFINE":Wc(i,new Xc(s,i),e);break;case"CONTENT-STEERING":{const t=new Xc(s,i);i.contentSteering={uri:Cu.resolve(t["SERVER-URI"],e),pathwayId:t["PATHWAY-ID"]||"."};break}case"START":i.startTimeOffset=Ou(s)}}const a=s.length>0&&s.length<i.levels.length;return i.levels=a?s:i.levels,0===i.levels.length&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(t,e,i){let s;const r={},n=i.levels,a={AUDIO:n.map(t=>({id:t.attrs.AUDIO,audioCodec:t.audioCodec})),SUBTITLES:n.map(t=>({id:t.attrs.SUBTITLES,textCodec:t.textCodec})),"CLOSED-CAPTIONS":[]};let o=0;for(Ru.lastIndex=0;null!==(s=Ru.exec(t));){const t=new Xc(s[1],i),n=t.TYPE;if(n){const i=a[n],s=r[n]||[];r[n]=s;const l=t.LANGUAGE,d=t["ASSOC-LANGUAGE"],h=t.CHANNELS,c=t.CHARACTERISTICS,u=t["INSTREAM-ID"],f={attrs:t,bitrate:0,id:o++,groupId:t["GROUP-ID"]||"",name:t.NAME||l||"",type:n,default:t.bool("DEFAULT"),autoselect:t.bool("AUTOSELECT"),forced:t.bool("FORCED"),lang:l,url:t.URI?Cu.resolve(t.URI,e):""};if(d&&(f.assocLang=d),h&&(f.channels=h),c&&(f.characteristics=c),u&&(f.instreamId=u),null!=i&&i.length){const t=Cu.findGroup(i,f.groupId)||i[0];Fu(f,t,"audioCodec"),Fu(f,t,"textCodec")}s.push(f)}}return r}static parseLevelPlaylist(t,e,i,s,r,n){var a;const o={url:e},l=new eu(e),d=l.fragments,h=[];let c,u,f,g,m=null,p=0,A=0,v=0,y=0,E=0,T=null,S=new Fd(s,o),b=-1,I=!1,L=null;if(wu.lastIndex=0,l.m3u8=t,l.hasVariableRefs=Kc(t),"#EXTM3U"!==(null==(a=wu.exec(t))?void 0:a[0]))return l.playlistParsingError=new Error("Missing format identifier #EXTM3U"),l;for(;null!==(c=wu.exec(t));){I&&(I=!1,S=new Fd(s,o),S.playlistOffset=v,S.setStart(v),S.sn=p,S.cc=y,E&&(S.bitrate=E),S.level=i,m&&(S.initSegment=m,m.rawProgramDateTime&&(S.rawProgramDateTime=m.rawProgramDateTime,m.rawProgramDateTime=null),L&&(S.setByteRange(L),L=null)));const t=c[1];if(t){S.duration=parseFloat(t);const e=(" "+c[2]).slice(1);S.title=e||null,S.tagList.push(e?["INF",t,e]:["INF",t])}else if(c[3]){if(Ql(S.duration)){S.playlistOffset=v,S.setStart(v),f&&Uu(S,f,l),S.sn=p,S.level=i,S.cc=y,d.push(S);const t=(" "+c[3]).slice(1);S.relurl=qc(l,t),Nu(S,T,h),T=S,v+=S.duration,p++,A=0,I=!0}}else{if(c=c[0].match(Du),!c){md.warn("No matches on slow regex match for level playlist!");continue}for(u=1;u<c.length&&void 0===c[u];u++);const t=(" "+c[u]).slice(1),r=(" "+c[u+1]).slice(1),a=c[u+2]?(" "+c[u+2]).slice(1):null;switch(t){case"BYTERANGE":T?S.setByteRange(r,T):S.setByteRange(r);break;case"PROGRAM-DATE-TIME":S.rawProgramDateTime=r,S.tagList.push(["PROGRAM-DATE-TIME",r]),-1===b&&(b=d.length);break;case"PLAYLIST-TYPE":l.type&&Hu(l,t,c),l.type=r.toUpperCase();break;case"MEDIA-SEQUENCE":0!==l.startSN?Hu(l,t,c):d.length>0&&ju(l,t,c),p=l.startSN=parseInt(r);break;case"SKIP":{l.skippedSegments&&Hu(l,t,c);const e=new Xc(r,l),i=e.decimalInteger("SKIPPED-SEGMENTS");if(Ql(i)){l.skippedSegments+=i;for(let t=i;t--;)d.push(null);p+=i}const s=e.enumeratedString("RECENTLY-REMOVED-DATERANGES");s&&(l.recentlyRemovedDateranges=(l.recentlyRemovedDateranges||[]).concat(s.split("\t")));break}case"TARGETDURATION":0!==l.targetduration&&Hu(l,t,c),l.targetduration=Math.max(parseInt(r),1);break;case"VERSION":null!==l.version&&Hu(l,t,c),l.version=parseInt(r);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":l.live||Hu(l,t,c),l.live=!1;break;case"#":(r||a)&&S.tagList.push(a?[r,a]:[r]);break;case"DISCONTINUITY":y++,S.tagList.push(["DIS"]);break;case"GAP":S.gap=!0,S.tagList.push([t]);break;case"BITRATE":S.tagList.push([t,r]),E=1e3*parseInt(r),Ql(E)?S.bitrate=E:E=0;break;case"DATERANGE":{const t=new Xc(r,l),e=new tu(t,l.dateRanges[t.ID],l.dateRangeTagCount);l.dateRangeTagCount++,e.isValid||l.skippedSegments?l.dateRanges[e.id]=e:md.warn(`Ignoring invalid DATERANGE tag: "${r}"`),S.tagList.push(["EXT-X-DATERANGE",r]);break}case"DEFINE":{const t=new Xc(r,l);"IMPORT"in t?Yc(l,t,n):Wc(l,t,e)}break;case"DISCONTINUITY-SEQUENCE":0!==l.startCC?Hu(l,t,c):d.length>0&&ju(l,t,c),l.startCC=y=parseInt(r);break;case"KEY":{const t=Mu(r,e,l);if(t.isSupported()){if("NONE"===t.method){f=void 0;break}f||(f={});const e=f[t.keyFormat];null!=e&&e.matches(t)||(e&&(f=ad({},f)),f[t.keyFormat]=t)}else md.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${r}"`);break}case"START":l.startTimeOffset=Ou(r);break;case"MAP":{const t=new Xc(r,l);if(S.duration){const e=new Fd(s,o);_u(e,t,i,f),m=e,S.initSegment=m,m.rawProgramDateTime&&!S.rawProgramDateTime&&(S.rawProgramDateTime=m.rawProgramDateTime)}else{const e=S.byteRangeEndOffset;if(e){const t=S.byteRangeStartOffset;L=`${e-t}@${t}`}else L=null;_u(S,t,i,f),m=S,I=!0}m.cc=y;break}case"SERVER-CONTROL":g&&Hu(l,t,c),g=new Xc(r),l.canBlockReload=g.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=g.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&g.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=g.optionalFloat("PART-HOLD-BACK",0),l.holdBack=g.optionalFloat("HOLD-BACK",0);break;case"PART-INF":{l.partTarget&&Hu(l,t,c);const e=new Xc(r);l.partTarget=e.decimalFloatingPoint("PART-TARGET");break}case"PART":{let t=l.partList;t||(t=l.partList=[]);const e=A>0?t[t.length-1]:void 0,i=A++,s=new Xc(r,l),n=new Nd(s,S,o,i,e);t.push(n),S.duration+=n.duration;break}case"PRELOAD-HINT":{const t=new Xc(r,l);l.preloadHint=t;break}case"RENDITION-REPORT":{const t=new Xc(r,l);l.renditionReports=l.renditionReports||[],l.renditionReports.push(t);break}default:md.warn(`line parsed but not handled: ${c}`)}}}T&&!T.relurl?(d.pop(),v-=T.duration,l.partList&&(l.fragmentHint=T)):l.partList&&(Nu(S,T,h),S.cc=y,l.fragmentHint=S,f&&Uu(S,f,l)),l.targetduration||(l.playlistParsingError=new Error("Missing Target Duration"));const R=d.length,k=d[0],w=d[R-1];if(v+=l.skippedSegments*l.targetduration,v>0&&R&&w){l.averagetargetduration=v/R;const t=w.sn;l.endSN="initSegment"!==t?t:0,l.live||(w.endList=!0),b>0&&(!function(t,e){let i=t[e];for(let s=e;s--;){const e=t[s];if(!e)return;e.programDateTime=i.programDateTime-1e3*e.duration,i=e}}(d,b),k&&h.unshift(k))}return l.fragmentHint&&(v+=l.fragmentHint.duration),l.totalduration=v,h.length&&l.dateRangeTagCount&&k&&xu(h,l),l.endCC=y,l}}function xu(t,e){let i=t.length;if(!i){if(!e.hasProgramDateTime)return;{const s=e.fragments[e.fragments.length-1];t.push(s),i++}}const s=t[i-1],r=e.live?1/0:e.totalduration,n=Object.keys(e.dateRanges);for(let o=n.length;o--;){const l=e.dateRanges[n[o]],d=l.startDate.getTime();l.tagAnchor=s.ref;for(let s=i;s--;){var a;if((null==(a=t[s])?void 0:a.sn)<e.startSN)break;const i=Pu(e,d,t,s,r);if(-1!==i){l.tagAnchor=e.fragments[i].ref;break}}}}function Pu(t,e,i,s,r){const n=i[s];if(n){const o=n.programDateTime;if(e>=o||0===s){var a;if(e<=o+1e3*(((null==(a=i[s+1])?void 0:a.start)||r)-n.start)){const r=i[s].sn-t.startSN;if(r<0)return-1;const n=t.fragments;if(n.length>i.length){for(let a=(i[s+1]||n[n.length-1]).sn-t.startSN;a>r;a--){const t=n[a].programDateTime;if(e>=t&&e<t+1e3*n[a].duration)return a}}return r}}}return-1}function Mu(t,e,i){var s,r;const n=new Xc(t,i),a=null!=(s=n.METHOD)?s:"",o=n.URI,l=n.hexadecimalInteger("IV"),d=n.KEYFORMATVERSIONS,h=null!=(r=n.KEYFORMAT)?r:"identity";o&&n.IV&&!l&&md.error(`Invalid IV: ${n.IV}`);const c=o?Cu.resolve(o,e):"",u=(d||"1").split("/").map(Number).filter(Number.isFinite);return new bu(a,c,h,u,l,n.KEYID)}function Ou(t){const e=new Xc(t).decimalFloatingPoint("TIME-OFFSET");return Ql(e)?e:null}function Bu(t,e){let i=(t||"").split(/[ ,]+/).filter(t=>t);["video","audio","text"].forEach(t=>{const s=i.filter(e=>fh(e,t));s.length&&(e[`${t}Codec`]=s.map(t=>t.split("/")[0]).join(","),i=i.filter(t=>-1===s.indexOf(t)))}),e.unknownCodecs=i}function Fu(t,e,i){const s=e[i];s&&(t[i]=s)}function Nu(t,e,i){t.rawProgramDateTime?i.push(t):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime)}function _u(t,e,i,s){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=i,t.sn="initSegment",s&&(t.levelkeys=s),t.initSegment=null}function Uu(t,e,i){t.levelkeys=e;const{encryptedFragments:s}=i;s.length&&s[s.length-1].levelkeys===e||!Object.keys(e).some(t=>e[t].isCommonEncryption)||s.push(t)}function Hu(t,e,i){t.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${i[0]})`)}function ju(t,e,i){t.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${i[0]})`)}function Vu(t,e){const i=e.startPTS;if(Ql(i)){let s,r=0;e.sn>t.sn?(r=i-t.start,s=t):(r=t.start-i,s=e),s.duration!==r&&s.setDuration(r)}else if(e.sn>t.sn){t.cc===e.cc&&t.minEndPTS?e.setStart(t.start+(t.minEndPTS-t.start)):e.setStart(t.start+t.duration)}else e.setStart(Math.max(t.start-e.duration,0))}function Gu(t,e,i,s,r,n,a){s-i<=0&&(a.warn("Fragment should have a positive duration",e),s=i+e.duration,n=r+e.duration);let o=i,l=s;const d=e.startPTS,h=e.endPTS;if(Ql(d)){const c=Math.abs(d-i);t&&c>t.totalduration?a.warn(`media timestamps and playlist times differ by ${c}s for level ${e.level} ${t.url}`):Ql(e.deltaPTS)?e.deltaPTS=Math.max(c,e.deltaPTS):e.deltaPTS=c,o=Math.max(i,d),i=Math.min(i,d),r=void 0!==e.startDTS?Math.min(r,e.startDTS):r,l=Math.min(s,h),s=Math.max(s,h),n=void 0!==e.endDTS?Math.max(n,e.endDTS):n}const c=i-e.start;0!==e.start&&e.setStart(i),e.setDuration(s-e.start),e.startPTS=i,e.maxStartPTS=o,e.startDTS=r,e.endPTS=s,e.minEndPTS=l,e.endDTS=n;const u=e.sn;if(!t||u<t.startSN||u>t.endSN)return 0;let f;const g=u-t.startSN,m=t.fragments;for(m[g]=e,f=g;f>0;f--)Vu(m[f],m[f-1]);for(f=g;f<m.length-1;f++)Vu(m[f],m[f+1]);return t.fragmentHint&&Vu(m[m.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,c}function Qu(t,e,i){if(t===e)return;let s=null;const r=t.fragments;for(let h=r.length-1;h>=0;h--){const t=r[h].initSegment;if(t){s=t;break}}let n;t.fragmentHint&&delete t.fragmentHint.endPTS,function(t,e,i){const s=e.skippedSegments,r=Math.max(t.startSN,e.startSN)-e.startSN,n=(t.fragmentHint?1:0)+(s?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,a=e.startSN-t.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments;for(let d=r;d<=n;d++){const r=l[a+d];let n=o[d];if(s&&!n&&r&&(n=e.fragments[d]=r),r&&n){i(r,n,d,o);const s=r.relurl,a=n.relurl;if(s&&Ju(s,a))return void(e.playlistParsingError=Ku(`media sequence mismatch ${n.sn}:`,t,e,r,n));if(r.cc!==n.cc)return void(e.playlistParsingError=Ku(`discontinuity sequence mismatch (${r.cc}!=${n.cc})`,t,e,r,n))}}}(t,e,(t,i,r,a)=>{if((!e.startCC||e.skippedSegments)&&i.cc!==t.cc){const s=t.cc-i.cc;for(let t=r;t<a.length;t++)a[t].cc+=s;e.endCC=a[a.length-1].cc}Ql(t.startPTS)&&Ql(t.endPTS)&&(i.setStart(i.startPTS=t.startPTS),i.startDTS=t.startDTS,i.maxStartPTS=t.maxStartPTS,i.endPTS=t.endPTS,i.endDTS=t.endDTS,i.minEndPTS=t.minEndPTS,i.setDuration(t.endPTS-t.startPTS),i.duration&&(n=i),e.PTSKnown=e.alignedSliding=!0),t.hasStreams&&(i.elementaryStreams=t.elementaryStreams),i.loader=t.loader,t.hasStats&&(i.stats=t.stats),t.initSegment&&(i.initSegment=t.initSegment,s=t.initSegment)});const a=e.fragments,o=e.fragmentHint?a.concat(e.fragmentHint):a;if(s&&o.forEach(t=>{var e;!t||t.initSegment&&t.initSegment.relurl!==(null==(e=s)?void 0:e.relurl)||(t.initSegment=s)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(t=>!t),e.deltaUpdateFailed){i.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let t=e.skippedSegments;t--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=function(t,e,i){const{dateRanges:s,recentlyRemovedDateranges:r}=e,n=ad({},t);r&&r.forEach(t=>{delete n[t]});const a=Object.keys(n).length;if(!a)return s;return Object.keys(s).forEach(t=>{const e=n[t],r=new tu(s[t].attr,e);r.isValid?(n[t]=r,e||(r.tagOrder+=a)):i.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Qh(s[t].attr)}"`)}),n}(t.dateRanges,e,i));const s=t.fragments.filter(t=>t.rawProgramDateTime);if(t.hasProgramDateTime&&!e.hasProgramDateTime)for(let t=1;t<o.length;t++)null===o[t].programDateTime&&Nu(o[t],o[t-1],s);xu(s,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var l;const i=$u(t,e.startSN-1);e.startCC=null!=(l=null==i?void 0:i.cc)?l:a[0].cc}!function(t,e,i){if(t&&e){let s=0;for(let r=0,n=t.length;r<=n;r++){const n=t[r],a=e[r+s];n&&a&&n.index===a.index&&n.fragment.sn===a.fragment.sn?i(n,a):s--}}}(t.partList,e.partList,(t,e)=>{e.elementaryStreams=t.elementaryStreams,e.stats=t.stats}),n?Gu(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS,i):qu(t,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;const d=e.advancedDateTime;if(e.advanced&&d){const t=e.edge;e.driftStart||(e.driftStartTime=d,e.driftStart=t),e.driftEndTime=d,e.driftEnd=t}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime;-1===e.requestScheduled&&(e.requestScheduled=t.requestScheduled)}function Ku(t,e,i,s,r){return new Error(`${t} ${r.url}\nPlaylist starting @${e.startSN}\n${e.m3u8}\n\nPlaylist starting @${i.startSN}\n${i.m3u8}`)}function qu(t,e,i=!0){const s=e.startSN+e.skippedSegments-t.startSN,r=t.fragments,n=s>=0;let a=0;if(n&&s<r.length)a=r[s].start;else if(n&&e.startSN===t.endSN+1)a=t.fragmentEnd;else if(n&&i)a=t.fragmentStart+s*e.levelTargetDuration;else{if(e.skippedSegments||0!==e.fragmentStart)return;a=t.fragmentStart}Wu(e,a)}function Wu(t,e){if(e){const i=t.fragments;for(let s=t.skippedSegments;s<i.length;s++)i[s].addStart(e);t.fragmentHint&&t.fragmentHint.addStart(e)}}function Yu(t,e=1/0){let i=1e3*t.targetduration;if(t.updated){const s=t.fragments,r=4;if(s.length&&i*r>e){const t=1e3*s[s.length-1].duration;t<i&&(i=t)}}else i/=2;return Math.round(i)}function $u(t,e,i){if(!t)return null;let s=t.fragments[e-t.startSN];return s||(s=t.fragmentHint,s&&s.sn===e?s:e<t.startSN&&i&&i.sn===e?i:null)}function zu(t,e,i){return t?Xu(t.partList,e,i):null}function Xu(t,e,i){if(t)for(let s=t.length;s--;){const r=t[s];if(r.index===i&&r.fragment.sn===e)return r}return null}function Zu(t){t.forEach((t,e)=>{var i;null==(i=t.details)||i.fragments.forEach(t=>{t.level=e,t.initSegment&&(t.initSegment.level=e)})})}function Ju(t,e){return!(t===e||!e)&&tf(t)!==tf(e)}function tf(t){return t.replace(/\?[^?]*$/,"")}function ef(t,e){for(let s=0,r=t.length;s<r;s++){var i;if((null==(i=t[s])?void 0:i.cc)===e)return t[s]}return null}function sf(t,e){const i=t.start+e;t.startPTS=i,t.setStart(i),t.endPTS=i+t.duration}function rf(t,e){const i=e.fragments;for(let s=0,r=i.length;s<r;s++)sf(i[s],t);e.fragmentHint&&sf(e.fragmentHint,t),e.alignedSliding=!0}function nf(t,e){if(!function(t,e){return!!(t&&e.startCC<t.endCC&&e.endCC>t.startCC)}(e,t))return;const i=Math.min(e.endCC,t.endCC),s=ef(e.fragments,i),r=ef(t.fragments,i);if(!s||!r)return;md.log(`Aligning playlist at start of dicontinuity sequence ${i}`);rf(s.start-r.start,t)}function af(t,e){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;const i=t.fragments,s=e.fragments;if(!i.length||!s.length)return;let r,n;const a=Math.min(e.endCC,t.endCC);e.startCC<a&&t.startCC<a&&(r=ef(s,a),n=ef(i,a)),r&&n||(r=s[Math.floor(s.length/2)],n=ef(i,r.cc)||i[Math.floor(i.length/2)]);const o=r.programDateTime,l=n.programDateTime;if(!o||!l)return;rf((l-o)/1e3-(n.start-r.start),t)}function of(t,e,i){lf(t,e,i),t.addEventListener(e,i)}function lf(t,e,i){t.removeEventListener(e,i)}const df=function(t){let e="";const i=t.length;for(let s=0;s<i;s++)e+=`[${t.start(s).toFixed(3)}-${t.end(s).toFixed(3)}]`;return e},hf="STOPPED",cf="IDLE",uf="KEY_LOADING",ff="FRAG_LOADING",gf="FRAG_LOADING_WAITING_RETRY",mf="WAITING_TRACK",pf="PARSING",Af="PARSED",vf="ENDED",yf="ERROR",Ef="WAITING_INIT_PTS",Tf="WAITING_LEVEL";class Sf extends Hc{constructor(t,e,i,s,r){super(s,t.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=hf,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:t,fragCurrent:e,media:i,mediaBuffer:s,state:r}=this,n=i?i.currentTime:0,a=Gc.bufferInfo(s||i,n,t.maxBufferHole),o=!a.len;if(this.log(`Media seeking to ${Ql(n)?n.toFixed(3):n}, state: ${r}, ${o?"out of":"in"} buffer`),this.state===vf)this.resetLoadingState();else if(e){const i=t.maxFragLookUpTolerance,s=e.start-i,r=e.start+e.duration+i;if(o||r<a.start||s>a.end){const t=n>r;(n<s||t)&&(t&&e.loader&&(this.log(`Cancelling fragment load for seek (sn: ${e.sn})`),e.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(i){this.fragmentTracker.removeFragmentsInRange(n,1/0,this.playlistType,!0);if(n>this.lastCurrentTime&&(this.lastCurrentTime=n),!this.loadingParts){const t=Math.max(a.end,n),e=this.shouldLoadParts(this.getLevelDetails(),t);e&&(this.log(`LL-Part loading ON after seeking to ${n.toFixed(2)} with buffer @${t.toFixed(2)}`),this.loadingParts=e)}}this.hls.hasEnoughToStart||(this.log(`Setting ${o?"startPosition":"nextLoadPosition"} to ${n} for seek without enough to start`),this.nextLoadPosition=n,o&&(this.startPosition=n)),o&&this.state===cf&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=r,this.hls=t,this.fragmentLoader=new Fc(t.config),this.keyLoader=i,this.fragmentTracker=e,this.config=t.config,this.decrypter=new Oc(t.config)}registerListeners(){const{hls:t}=this;t.on($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.MANIFEST_LOADED,this.onManifestLoaded,this),t.on($l.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.MANIFEST_LOADED,this.onManifestLoaded,this),t.off($l.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(t){}stopLoad(){if(this.state===hf)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const t=this.fragCurrent;null!=t&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=hf}get startPositionValue(){const{nextLoadPosition:t,startPosition:e}=this;return-1===e&&t?t:e}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(t,e){if(e.live||!this.media)return!1;const i=t.end||0,s=this.config.timelineOffset||0;if(i<=s)return!1;const r=t.buffered;this.config.maxBufferHole&&r&&r.length>1&&(t=Gc.bufferedInfo(r,t.start,0));const n=t.nextStart;if(n&&n>s&&n<e.edge)return!1;if(this.media.currentTime<t.start)return!1;const a=e.partList;if(null!=a&&a.length){const t=a[a.length-1];return Gc.isBuffered(this.media,t.start+t.duration/2)}const o=e.fragments[e.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(o)}getLevelDetails(){if(this.levels&&null!==this.levelLastLoaded)return this.levelLastLoaded.details}get timelineOffset(){const t=this.config.timelineOffset;var e;return t?(null==(e=this.getLevelDetails())?void 0:e.appliedTimelineOffset)||t:0}onMediaAttached(t,e){const i=this.media=this.mediaBuffer=e.media;of(i,"seeking",this.onMediaSeeking),of(i,"ended",this.onMediaEnded);const s=this.config;this.levels&&s.autoStartLoad&&this.state===hf&&this.startLoad(s.startPosition)}onMediaDetaching(t,e){const i=!!e.transferMedia,s=this.media;if(null!==s){if(s.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),lf(s,"seeking",this.onMediaSeeking),lf(s,"ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i)return this.resetLoadingState(),void this.resetTransmuxer();this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(t,e){}onManifestLoaded(t,e){this.startTimeOffset=e.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=hf,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(t,e,i){this.startFragRequested=!0,this._loadFragForPlayback(t,e,i)}_loadFragForPlayback(t,e,i){this._doFragLoad(t,e,i,t=>{const e=t.frag;if(this.fragContextChanged(e))return this.warn(`${e.type} sn: ${e.sn}${t.part?" part: "+t.part.index:""} of ${this.fragInfo(e,!1,t.part)}) was dropped during download.`),void this.fragmentTracker.removeFragment(e);e.stats.chunkCount++,this._handleFragmentLoadProgress(t)}).then(t=>{if(!t)return;const e=this.state,i=t.frag;this.fragContextChanged(i)?(e===ff||!this.fragCurrent&&e===pf)&&(this.fragmentTracker.removeFragment(i),this.state=cf):("payload"in t&&(this.log(`Loaded ${i.type} sn: ${i.sn} of ${this.playlistLabel()} ${i.level}`),this.hls.trigger($l.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t))}).catch(e=>{this.state!==hf&&this.state!==yf&&(this.warn(`Frag error: ${(null==e?void 0:e.message)||e}`),this.resetFragmentLoading(t))})}clearTrackerIfNeeded(t){var e;const{fragmentTracker:i}=this;if(i.getState(t)===Sc){const e=t.type,s=this.getFwdBufferInfo(this.mediaBuffer,e),r=Math.max(t.duration,s?s.len:this.config.maxBufferLength),n=this.backtrackFragment;(1===(n?t.sn-n.sn:0)||this.reduceMaxBufferLength(r,t.duration))&&i.removeFragment(t)}else 0===(null==(e=this.mediaBuffer)?void 0:e.buffered.length)?i.removeAllFragments():i.hasParts(t.type)&&(i.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),i.getState(t)===bc&&i.removeFragment(t))}checkLiveUpdate(t){if(t.updated&&!t.live){const e=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type})}t.fragments[0]||(t.deltaUpdateFailed=!0)}waitForLive(t){const e=t.details;return(null==e?void 0:e.live)&&"EVENT"!==e.type&&(this.levelLastLoaded!==t||e.expired)}flushMainBuffer(t,e,i=null){if(!(t-e))return;const s={startOffset:t,endOffset:e,type:i};this.hls.trigger($l.BUFFER_FLUSHING,s)}_loadInitSegment(t,e){this._doFragLoad(t,e).then(t=>{const e=null==t?void 0:t.frag;if(!e||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return t}).then(t=>{const{hls:e}=this,{frag:i,payload:s}=t,r=i.decryptdata;if(s&&s.byteLength>0&&null!=r&&r.key&&r.iv&&ru(r.method)){const n=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer,nu(r.method)).catch(t=>{throw e.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:i}),t}).then(s=>{const r=self.performance.now();return e.trigger($l.FRAG_DECRYPTED,{frag:i,payload:s,stats:{tstart:n,tdecrypt:r}}),t.payload=s,this.completeInitSegmentLoad(t)})}return this.completeInitSegmentLoad(t)}).catch(e=>{this.state!==hf&&this.state!==yf&&(this.warn(e),this.resetFragmentLoading(t))})}completeInitSegmentLoad(t){const{levels:e}=this;if(!e)throw new Error("init load aborted, missing levels");const i=t.frag.stats;this.state!==hf&&(this.state=cf),t.frag.data=new Uint8Array(t.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(t,e){var i,s;const r=t.tracks;if(r&&!e.encrypted&&(null!=(i=r.audio)&&i.encrypted||null!=(s=r.video)&&s.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const t=this.media,i=new Error(`Encrypted track with no key in ${this.fragInfo(e)} (media ${t?"attached mediaKeys: "+t.mediaKeys:"detached"})`);return this.warn(i.message),!t||t.mediaKeys?!1:(this.hls.trigger($l.ERROR,{type:Wl.KEY_SYSTEM_ERROR,details:Yl.KEY_SYSTEM_NO_KEYS,fatal:!1,error:i,frag:e}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(t){const{fragCurrent:e}=this;return!t||!e||t.sn!==e.sn||t.level!==e.level}fragBufferedComplete(t,e){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${t.type} sn: ${t.sn}${e?" part: "+e.index:""} of ${this.fragInfo(t,!1,e)} > buffer:${i?df(Gc.getBuffered(i)):"(detached)"})`),Bd(t)){var s;if(t.type!==id){const e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return void(this.state=cf)}const e=null==(s=this.levels)?void 0:s[t.level];null!=e&&e.fragmentError&&(this.log(`Resetting level fragment error count of ${e.fragmentError} on frag buffered`),e.fragmentError=0)}this.state=cf}_handleFragmentLoadComplete(t){const{transmuxer:e}=this;if(!e)return;const{frag:i,part:s,partsLoaded:r}=t,n=!r||0===r.length||r.some(t=>!t),a=new jc(i.level,i.sn,i.stats.chunkCount+1,0,s?s.index:-1,!n);e.flush(a)}_handleFragmentLoadProgress(t){}_doFragLoad(t,e,i=null,s){var r;this.fragCurrent=t;const n=e.details;if(!this.levels||!n)throw new Error(`frag load aborted, missing level${n?"":" detail"}s`);let a=null;if(!t.encrypted||null!=(r=t.decryptdata)&&r.key)t.encrypted||(a=this.keyLoader.loadClear(t,n.encryptedFragments,this.startFragRequested),a&&this.log("[eme] blocking frag load until media-keys acquired"));else if(this.log(`Loading key for ${t.sn} of [${n.startSN}-${n.endSN}], ${this.playlistLabel()} ${t.level}`),this.state=uf,this.fragCurrent=t,a=this.keyLoader.load(t).then(t=>{if(!this.fragContextChanged(t.frag))return this.hls.trigger($l.KEY_LOADED,t),this.state===uf&&(this.state=cf),t}),this.hls.trigger($l.KEY_LOADING,{frag:t}),null===this.fragCurrent)return this.log("context changed in KEY_LOADING"),Promise.resolve(null);const o=this.fragPrevious;if(Bd(t)&&(!o||t.sn!==o.sn)){const i=this.shouldLoadParts(e.details,t.end);i!==this.loadingParts&&(this.log(`LL-Part loading ${i?"ON":"OFF"} loading sn ${null==o?void 0:o.sn}->${t.sn}`),this.loadingParts=i)}if(i=Math.max(t.start,i||0),this.loadingParts&&Bd(t)){const r=n.partList;if(r&&s){i>n.fragmentEnd&&n.fragmentHint&&(t=n.fragmentHint);const o=this.getNextPart(r,t,i);if(o>-1){const l=r[o];let d;return t=this.fragCurrent=l.fragment,this.log(`Loading ${t.type} sn: ${t.sn} part: ${l.index} (${o}/${r.length-1}) of ${this.fragInfo(t,!1,l)}) cc: ${t.cc} [${n.startSN}-${n.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=ff,d=a?a.then(i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(t,l,e,s)).catch(t=>this.handleFragLoadError(t)):this.doFragPartsLoad(t,l,e,s).catch(t=>this.handleFragLoadError(t)),this.hls.trigger($l.FRAG_LOADING,{frag:t,part:l,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}if(!t.url||this.loadedEndOfParts(r,i))return Promise.resolve(null)}}var l;if(Bd(t)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${t.sn} loaded parts: ${null==(l=n.partList)?void 0:l.filter(t=>t.loaded).map(t=>`[${t.start}-${t.end}]`)}`),this.loadingParts=!1;else if(!t.url)return Promise.resolve(null);this.log(`Loading ${t.type} sn: ${t.sn} of ${this.fragInfo(t,!1)}) cc: ${t.cc} ${"["+n.startSN+"-"+n.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),Ql(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=ff;const d=this.config.progressive&&t.type!==id;let h;return h=d&&a?a.then(e=>!e||this.fragContextChanged(e.frag)?null:this.fragmentLoader.load(t,s)).catch(t=>this.handleFragLoadError(t)):Promise.all([this.fragmentLoader.load(t,d?s:void 0),a]).then(([t])=>(!d&&s&&s(t),t)).catch(t=>this.handleFragLoadError(t)),this.hls.trigger($l.FRAG_LOADING,{frag:t,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):h}doFragPartsLoad(t,e,i,s){return new Promise((r,n)=>{var a;const o=[],l=null==(a=i.details)?void 0:a.partList,d=e=>{this.fragmentLoader.loadPart(t,e,s).then(s=>{o[e.index]=s;const n=s.part;this.hls.trigger($l.FRAG_LOADED,s);const a=zu(i.details,t.sn,e.index+1)||Xu(l,t.sn,e.index+1);if(!a)return r({frag:t,part:n,partsLoaded:o});d(a)}).catch(n)};d(e)})}handleFragLoadError(t){if("data"in t){const e=t.data;e.frag&&e.details===Yl.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):e.frag&&e.type===Wl.KEY_SYSTEM_ERROR?(e.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(e.frag)):this.hls.trigger($l.ERROR,e)}else this.hls.trigger($l.ERROR,{type:Wl.OTHER_ERROR,details:Yl.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}_handleTransmuxerFlush(t){const e=this.getCurrentContext(t);if(!e||this.state!==pf)return void(this.fragCurrent||this.state===hf||this.state===yf||(this.state=cf));const{frag:i,part:s,level:r}=e,n=self.performance.now();i.stats.parsing.end=n,s&&(s.stats.parsing.end=n);const a=this.getLevelDetails(),o=a&&i.sn>a.endSN||this.shouldLoadParts(a,i.end);o!==this.loadingParts&&(this.log(`LL-Part loading ${o?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=o),this.updateLevelTiming(i,s,r,t.partial)}shouldLoadParts(t,e){if(this.config.lowLatencyMode){if(!t)return this.loadingParts;if(t.partList){var i;const r=t.partList[0];if(r.fragment.type===id)return!1;if(e>=r.end+((null==(i=t.fragmentHint)?void 0:i.duration)||0)){var s;if((this.hls.hasEnoughToStart?(null==(s=this.media)?void 0:s.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(t){const{levels:e,fragCurrent:i}=this,{level:s,sn:r,part:n}=t;if(null==e||!e[s])return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${s}. The current chunk will not be buffered.`),null;const a=e[s],o=a.details,l=n>-1?zu(o,r,n):null,d=l?l.fragment:$u(o,r,i);return d?(i&&i!==d&&(d.stats=i.stats),{frag:d,part:l,level:a}):null}bufferFragmentData(t,e,i,s,r){if(this.state!==pf)return;const{data1:n,data2:a}=t;let o=n;if(a&&(o=sh(n,a)),!o.length)return;const l=this.initPTS[e.cc],d=l?-l.baseTime/l.timescale:void 0,h={type:t.type,frag:e,part:i,chunkMeta:s,offset:d,parent:e.type,data:o};if(this.hls.trigger($l.BUFFER_APPENDING,h),t.dropped&&t.independent&&!i){if(r)return;this.flushBufferGap(e)}}flushBufferGap(t){const e=this.media;if(!e)return;if(!Gc.isBuffered(e,e.currentTime))return void this.flushMainBuffer(0,t.start);const i=e.currentTime,s=Gc.bufferInfo(e,i,0),r=t.duration,n=Math.min(2*this.config.maxFragLookUpTolerance,.25*r),a=Math.max(Math.min(t.start-n,s.end-n),i+n);t.start-a>n&&this.flushMainBuffer(a,t.start)}getFwdBufferInfo(t,e){var i;const s=this.getLoadPosition();if(!Ql(s))return null;const r=this.lastCurrentTime>s||null!=(i=this.media)&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(t,s,e,r)}getFwdBufferInfoAtPos(t,e,i,s){const r=Gc.bufferInfo(t,e,s);if(0===r.len&&void 0!==r.nextStart){const n=this.fragmentTracker.getBufferedFrag(e,i);if(n&&(r.nextStart<=n.end||n.gap)){const i=Math.max(Math.min(r.nextStart,n.end)-e,s);return Gc.bufferInfo(t,e,i)}}return r}getMaxBufferLength(t){const{config:e}=this;let i;return i=t?Math.max(8*e.maxBufferSize/t,e.maxBufferLength):e.maxBufferLength,Math.min(i,e.maxMaxBufferLength)}reduceMaxBufferLength(t,e){const i=this.config,s=Math.max(Math.min(t-e,i.maxBufferLength),e),r=Math.max(t-3*e,i.maxMaxBufferLength/2,s);return r>=s&&(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0)}getAppendedFrag(t,e=td){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(t,e):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(t,e){const i=e.fragments,s=i.length;if(!s)return null;const{config:r}=this,n=i[0].start,a=r.lowLatencyMode&&!!e.partList;let o=null;if(e.live){const i=r.initialLiveManifestSize;if(s<i)return this.warn(`Not enough fragments to start playback (have: ${s}, need: ${i})`),null;if(!e.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||t<n){var l;a&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),o=this.getInitialLiveFragment(e);const i=this.hls.startPosition,s=this.hls.liveSyncPosition,r=o?(-1!==i&&i>=n?i:s)||o.start:t;this.log(`Setting startPosition to ${r} to match start frag at live edge. mainStart: ${i} liveSyncPosition: ${s} frag.start: ${null==(l=o)?void 0:l.start}`),this.startPosition=this.nextLoadPosition=r}}else t<=n&&(o=i[0]);if(!o){const i=this.loadingParts?e.partEnd:e.fragmentEnd;o=this.getFragmentAtPosition(t,i,e)}let d=this.filterReplacedPrimary(o,e);if(!d&&o){const t=o.sn-e.startSN;d=this.filterReplacedPrimary(i[t+1]||null,e)}return this.mapToInitFragWhenRequired(d)}isLoopLoading(t,e){const i=this.fragmentTracker.getState(t);return(i===Ic||i===bc&&!!t.gap)&&this.nextLoadPosition>e}getNextFragmentLoopLoading(t,e,i,s,r){let n=null;if(t.gap&&(n=this.getNextFragment(this.nextLoadPosition,e),n&&!n.gap&&i.nextStart)){const t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,s,0);if(null!==t&&i.len+t.len>=r){const t=n.sn;return this.loopSn!==t&&(this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${t}`),this.loopSn=t),null}}return this.loopSn=void 0,n}get primaryPrefetch(){if(bf(this.config)){var t;if(null==(t=this.hls.interstitialsManager)||null==(t=t.playingItem)?void 0:t.event)return!0}return!1}filterReplacedPrimary(t,e){if(!t)return t;if(bf(this.config)&&t.type!==id){const i=this.hls.interstitialsManager,s=null==i?void 0:i.bufferingItem;if(s){const i=s.event;if(i){if(i.appendInPlace||Math.abs(t.start-s.start)>1||0===s.start)return null}else{if(t.end<=s.start&&!1===(null==e?void 0:e.live))return null;if(t.start>s.end&&s.nextEvent&&(s.nextEvent.appendInPlace||t.start-s.end>1))return null}}const r=null==i?void 0:i.playerQueue;if(r)for(let e=r.length;e--;){const i=r[e].interstitial;if(i.appendInPlace&&t.start>=i.startTime&&t.end<=i.resumeTime)return null}}return t}mapToInitFragWhenRequired(t){return null==t||!t.initSegment||t.initSegment.data||this.bitrateTest?t:t.initSegment}getNextPart(t,e,i){let s=-1,r=!1,n=!0;for(let a=0,o=t.length;a<o;a++){const o=t[a];if(n=n&&!o.independent,s>-1&&i<o.start)break;const l=o.loaded;l?s=-1:(r||(o.independent||n)&&o.fragment===e)&&(o.fragment!==e&&this.warn(`Need buffer at ${i} but next unloaded part starts at ${o.start}`),s=a),r=l}return s}loadedEndOfParts(t,e){let i;for(let s=t.length;s--;){if(i=t[s],!i.loaded)return!1;if(e>i.start)return!0}return!1}getInitialLiveFragment(t){const e=t.fragments,i=this.fragPrevious;let s=null;if(i){if(t.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),s=function(t,e,i){if(null===e||!Array.isArray(t)||!t.length||!Ql(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;for(let s=0;s<t.length;++s){const r=t[s];if(ic(e,i,r))return r}return null}(e,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!s){const r=i.sn+1;if(r>=t.startSN&&r<=t.endSN){const n=e[r-t.startSN];i.cc===n.cc&&(s=n,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=sc(t,i.cc,i.end),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const e=this.hls.liveSyncPosition;null!==e&&(s=this.getFragmentAtPosition(e,this.bitrateTest?t.fragmentEnd:t.edge,t))}return s}getFragmentAtPosition(t,e,i){const{config:s}=this;let{fragPrevious:r}=this,{fragments:n,endSN:a}=i;const{fragmentHint:o}=i,{maxFragLookUpTolerance:l}=s,d=i.partList,h=!!(this.loadingParts&&null!=d&&d.length&&o);let c;if(h&&!this.bitrateTest&&d[d.length-1].fragment.sn===o.sn&&(n=n.concat(o),a=o.sn),t<e){var u;c=tc(r,n,t,t<this.lastCurrentTime||t>e-l||null!=(u=this.media)&&u.paused||!this.startFragRequested?0:l)}else c=n[n.length-1];if(c){const t=c.sn-i.startSN,e=this.fragmentTracker.getState(c);if((e===Ic||e===bc&&c.gap)&&(r=c),r&&c.sn===r.sn&&(!h||d[0].fragment.sn>c.sn||!i.live)){if(c.level===r.level){const e=n[t+1];c=c.sn<a&&this.fragmentTracker.getState(e)!==Ic?e:null}}}return c}alignPlaylists(t,e,i){const s=t.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;const r=t.fragmentStart,n=!e,a=t.alignedSliding&&Ql(r);if(n||!a&&!r){!function(t,e){t&&(nf(e,t),e.alignedSliding||af(e,t),e.alignedSliding||e.skippedSegments||qu(t,e,!1))}(i,t);const r=t.fragmentStart;return this.log(`Live playlist sliding: ${r.toFixed(2)} start-sn: ${e?e.startSN:"na"}->${t.startSN} fragments: ${s}`),r}return r}waitForCdnTuneIn(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)}setStartPosition(t,e){let i=this.startPosition;i<e&&(i=-1);const s=this.timelineOffset;if(-1===i){const r=null!==this.startTimeOffset,n=r?this.startTimeOffset:t.startTimeOffset;null!==n&&Ql(n)?(i=e+n,n<0&&(i+=t.edge),i=Math.min(Math.max(e,i),e+t.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${n} found in ${r?"multivariant":"media"} playlist`),this.startPosition=i):t.live?(i=this.hls.liveSyncPosition||e,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+s}this.nextLoadPosition=i+s}getLoadPosition(){var t;const{media:e}=this;let i=0;return null!=(t=this.hls)&&t.hasEnoughToStart&&e?i=e.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(t,e){this.transmuxer&&t.type===this.playlistType&&Bd(t)&&t.stats.aborted&&(this.log(`Fragment ${t.sn}${e?" part "+e.index:""} of ${this.playlistLabel()} ${t.level} was aborted`),this.resetFragmentLoading(t))}resetFragmentLoading(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===gf)||(this.state=cf)}onFragmentOrKeyLoadError(t,e){var i;if(e.chunkMeta&&!e.frag){const t=this.getCurrentContext(e.chunkMeta);t&&(e.frag=t.frag)}const s=e.frag;if(!s||s.type!==t||!this.levels)return;var r;if(this.fragContextChanged(s))return void this.warn(`Frag load error must match current frag to retry ${s.url} > ${null==(r=this.fragCurrent)?void 0:r.url}`);const n=e.details===Yl.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(s,!0);const a=e.errorAction;if(!a)return void(this.state=yf);const{action:o,flags:l,retryCount:d=0,retryConfig:h}=a,c=!!h,u=c&&o===mc,f=c&&!a.resolved&&l===Ac,g=null==(i=this.hls.latestLevelDetails)?void 0:i.live;if(!u&&f&&Bd(s)&&!s.endList&&g&&!ac(e))this.resetFragmentErrors(t),this.treatAsGap(s),a.resolved=!0;else if((u||f)&&d<h.maxNumRetry){var m;const i=cc(null==(m=e.response)?void 0:m.code),r=lc(h,d);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+r,this.state=gf,a.resolved=!0,i)return this.log("Waiting for connection (offline)"),this.retryDate=1/0,void(e.reason="offline");this.warn(`Fragment ${s.sn} of ${t} ${s.level} errored with ${e.details}, retrying loading ${d+1}/${h.maxNumRetry} in ${r}ms`)}else if(h){if(this.resetFragmentErrors(t),!(d<h.maxNumRetry))return void this.warn(`${e.details} reached or exceeded max retry (${d})`);n||o===gc||(a.resolved=!0)}else this.state=o===fc?Tf:yf;this.tickImmediate()}checkRetryDate(){const t=self.performance.now(),e=this.retryDate,i=e===1/0;(!e||t>=e||i&&!cc(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=cf)}reduceLengthAndFlushBuffer(t){if(this.state===pf||this.state===Af){const e=t.frag,i=t.parent,s=this.getFwdBufferInfo(this.mediaBuffer,i),r=s&&s.len>.5;r&&this.reduceMaxBufferLength(s.len,(null==e?void 0:e.duration)||10);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),e&&(this.fragmentTracker.removeFragment(e),this.nextLoadPosition=e.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(t){t===ed&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==hf&&(this.state=cf)}afterBufferFlushed(t,e,i){if(!t)return;const s=Gc.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,s,i),this.state===vf&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==hf&&(this.state=cf)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=this.levelLastLoaded,e=t?t.details:null;null!=e&&e.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(e,e.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(t){this.log(`Loading context changed while buffering sn ${t.sn} of ${this.playlistLabel()} ${-1===t.level?"<removed>":t.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(t=0){this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)}updateLevelTiming(t,e,i,s){const r=i.details;if(!r)return void this.warn("level.details undefined");if(!Object.keys(t.elementaryStreams).reduce((e,n)=>{const a=t.elementaryStreams[n];if(a){const o=a.endPTS-a.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${t.sn} ${n} duration reliably (${o})`),e||!1;const l=s?0:Gu(r,t,a.startPTS,a.endPTS,a.startDTS,a.endDTS,this);return this.hls.trigger($l.LEVEL_PTS_UPDATED,{details:r,level:i,drift:l,type:n,frag:t,start:a.startPTS,end:a.endPTS}),!0}return e},!1)){var n;const e=null===(null==(n=this.transmuxer)?void 0:n.error);if((0===i.fragmentError||e&&(i.fragmentError<2||t.endList))&&this.treatAsGap(t,i),e){const e=new Error(`Found no media in fragment ${t.sn} of ${this.playlistLabel()} ${t.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(e.message),this.hls.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.FRAG_PARSING_ERROR,fatal:!1,error:e,frag:t,reason:`Found no media in msn ${t.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Af,this.log(`Parsed ${t.type} sn: ${t.sn}${e?" part: "+e.index:""} of ${this.fragInfo(t,!1,e)})`),this.hls.trigger($l.FRAG_PARSED,{frag:t,part:e})}playlistLabel(){return this.playlistType===td?"level":"track"}fragInfo(t,e=!0,i){var s,r;return`${this.playlistLabel()} ${t.level} (${i?"part":"frag"}:[${(null!=(s=e&&!i?t.startPTS:(i||t).start)?s:NaN).toFixed(3)}-${(null!=(r=e&&!i?t.endPTS:(i||t).end)?r:NaN).toFixed(3)}]${i&&"main"===t.type?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(t,e){e&&e.fragmentError++,t.gap=!0,this.fragmentTracker.removeFragment(t),this.fragmentTracker.fragBuffered(t,!0)}resetTransmuxer(){var t;null==(t=this.transmuxer)||t.reset()}recoverWorkerError(t){"demuxerWorker"===t.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(t){const e=this._state;e!==t&&(this._state=t,this.log(`${e}->${t}`))}get state(){return this._state}}function bf(t){return!!t.interstitialsController&&!1!==t.enableInterstitialPlayback}class If{constructor(){this.chunks=[],this.dataLength=0}push(t){this.chunks.push(t),this.dataLength+=t.length}flush(){const{chunks:t,dataLength:e}=this;let i;return t.length?(i=1===t.length?t[0]:function(t,e){const i=new Uint8Array(e);let s=0;for(let r=0;r<t.length;r++){const e=t[r];i.set(e,s),s+=e.length}return i}(t,e),this.reset(),i):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}var Lf,Rf={exports:{}};var kf=(Lf||(Lf=1,function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,s,n,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new r(s,n||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0===--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,r=[];if(0===this._eventsCount)return r;for(s in t=this._events)e.call(t,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,n=s.length,a=new Array(n);r<n;r++)a[r]=s[r].fn;return a},o.prototype.listenerCount=function(t){var e=i?i+t:t,s=this._events[e];return s?s.fn?1:s.length:0},o.prototype.emit=function(t,e,s,r,n,a){var o=i?i+t:t;if(!this._events[o])return!1;var l,d,h=this._events[o],c=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),c){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,s),!0;case 4:return h.fn.call(h.context,e,s,r),!0;case 5:return h.fn.call(h.context,e,s,r,n),!0;case 6:return h.fn.call(h.context,e,s,r,n,a),!0}for(d=1,l=new Array(c-1);d<c;d++)l[d-1]=arguments[d];h.fn.apply(h.context,l)}else{var u,f=h.length;for(d=0;d<f;d++)switch(h[d].once&&this.removeListener(t,h[d].fn,void 0,!0),c){case 1:h[d].fn.call(h[d].context);break;case 2:h[d].fn.call(h[d].context,e);break;case 3:h[d].fn.call(h[d].context,e,s);break;case 4:h[d].fn.call(h[d].context,e,s,r);break;default:if(!l)for(u=1,l=new Array(c-1);u<c;u++)l[u-1]=arguments[u];h[d].fn.apply(h[d].context,l)}}return!0},o.prototype.on=function(t,e,i){return n(this,t,e,i,!1)},o.prototype.once=function(t,e,i){return n(this,t,e,i,!0)},o.prototype.removeListener=function(t,e,s,r){var n=i?i+t:t;if(!this._events[n])return this;if(!e)return a(this,n),this;var o=this._events[n];if(o.fn)o.fn!==e||r&&!o.once||s&&o.context!==s||a(this,n);else{for(var l=0,d=[],h=o.length;l<h;l++)(o[l].fn!==e||r&&!o[l].once||s&&o[l].context!==s)&&d.push(o[l]);d.length?this._events[n]=1===d.length?d[0]:d:a(this,n)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&a(this,e)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,t.exports=o}(Rf)),Rf.exports),wf=Td(kf);const Df="1.6.15",Cf={};function xf(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function Pf(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function Mf(t,e){let i=0;return i=(127&t[e])<<21,i|=(127&t[e+1])<<14,i|=(127&t[e+2])<<7,i|=127&t[e+3],i}function Of(t,e){const i=e;let s=0;for(;Pf(t,e);){s+=10;s+=Mf(t,e+6),xf(t,e+10)&&(s+=10),e+=s}if(s>0)return t.subarray(i,i+s)}function Bf(t,e){return 255===t[e]&&240==(246&t[e+1])}function Ff(t,e){return 1&t[e+1]?7:9}function Nf(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function _f(t,e){return e+1<t.length&&Bf(t,e)}function Uf(t,e){if(_f(t,e)){const i=Ff(t,e);if(e+i>=t.length)return!1;const s=Nf(t,e);if(s<=i)return!1;const r=e+s;return r===t.length||_f(t,r)}return!1}function Hf(t,e,i,s,r){if(!t.samplerate){const n=function(t,e,i,s){const r=e[i+2],n=r>>2&15;if(n>12){const e=new Error(`invalid ADTS sampling index:${n}`);return void t.emit($l.ERROR,$l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.FRAG_PARSING_ERROR,fatal:!0,error:e,reason:e.message})}const a=1+(r>>6&3),o=e[i+3]>>6&3|(1&r)<<2,l="mp4a.40."+a,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][n];let h=n;5!==a&&29!==a||(h-=3);const c=[a<<3|(14&h)>>1,(1&h)<<7|o<<3];return md.log(`manifest codec:${s}, parsed codec:${l}, channels:${o}, rate:${d} (ADTS object type:${a} sampling index:${n})`),{config:c,samplerate:d,channelCount:o,codec:l,parsedCodec:l,manifestCodec:s}}(e,i,s,r);if(!n)return;ad(t,n)}}function jf(t){return 9216e4/t}function Vf(t,e,i,s,r){const n=s+r*jf(t.samplerate),a=function(t,e){const i=Ff(t,e);if(e+i<=t.length){const s=Nf(t,e)-i;if(s>0)return{headerLength:i,frameLength:s}}}(e,i);let o;if(a){const{frameLength:s,headerLength:r}=a,l=r+s,d=Math.max(0,i+l-e.length);d?(o=new Uint8Array(l-r),o.set(e.subarray(i+r,e.length),0)):o=e.subarray(i+r,i+l);const h={unit:o,pts:n};return d||t.samples.push(h),{sample:h,length:l,missing:d}}const l=e.length-i;o=new Uint8Array(l),o.set(e.subarray(i,e.length),0);return{sample:{unit:o,pts:n},length:l,missing:-1}}function Gf(t,e){return Pf(t,e)&&Mf(t,e+6)+10<=t.length-e}function Qf(t,e=0,i=1/0){return function(t,e,i,s){const r=(n=t,n instanceof ArrayBuffer?n:n.buffer);var n;let a=1;"BYTES_PER_ELEMENT"in s&&(a=s.BYTES_PER_ELEMENT);const o=(u=t,u&&u.buffer instanceof ArrayBuffer&&void 0!==u.byteLength&&void 0!==u.byteOffset?t.byteOffset:0),l=(o+t.byteLength)/a,d=(o+e)/a,h=Math.floor(Math.max(0,Math.min(d,l))),c=Math.floor(Math.min(h+Math.max(i,0),l));var u;return new s(r,h,c-h)}(t,e,i,Uint8Array)}function Kf(t){const e={key:t.type,description:"",data:"",mimeType:null,pictureType:null};if(t.size<2)return;if(3!==t.data[0])return;const i=t.data.subarray(1).indexOf(0);if(-1===i)return;const s=vd(Qf(t.data,1,i)),r=t.data[2+i],n=t.data.subarray(3+i).indexOf(0);if(-1===n)return;const a=vd(Qf(t.data,3+i,n));let o;var l;return o="--\x3e"===s?vd(Qf(t.data,4+i+n)):(l=t.data.subarray(4+i+n))instanceof ArrayBuffer?l:0==l.byteOffset&&l.byteLength==l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer,e.mimeType=s,e.pictureType=r,e.description=a,e.data=o,e}function qf(t){return"PRIV"===t.type?function(t){if(t.size<2)return;const e=vd(t.data,!0),i=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:i.buffer}}(t):"W"===t.type[0]?function(t){if("WXXX"===t.type){if(t.size<2)return;let e=1;const i=vd(t.data.subarray(e),!0);e+=i.length+1;const s=vd(t.data.subarray(e));return{key:t.type,info:i,data:s}}const e=vd(t.data);return{key:t.type,info:"",data:e}}(t):"APIC"===t.type?Kf(t):function(t){if(t.size<2)return;if("TXXX"===t.type){let e=1;const i=vd(t.data.subarray(e),!0);e+=i.length+1;const s=vd(t.data.subarray(e));return{key:t.type,info:i,data:s}}const e=vd(t.data.subarray(1));return{key:t.type,info:"",data:e}}(t)}function Wf(t){const e=String.fromCharCode(t[0],t[1],t[2],t[3]),i=Mf(t,4);return{type:e,size:i,data:t.subarray(10,10+i)}}function Yf(t){let e=0;const i=[];for(;Pf(t,e);){const s=Mf(t,e+6);t[e+5]>>6&1&&(e+=10),e+=10;const r=e+s;for(;e+10<r;){const s=Wf(t.subarray(e)),r=qf(s);r&&i.push(r),e+=s.size+10}xf(t,e)&&(e+=10)}return i}function $f(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info}function zf(t){if(8===t.data.byteLength){const e=new Uint8Array(t.data),i=1&e[3];let s=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return s/=45,i&&(s+=47721858.84),Math.round(s)}}function Xf(t){const e=Yf(t);for(let i=0;i<e.length;i++){const t=e[i];if($f(t))return zf(t)}}let Zf=function(t){return t.audioId3="org.id3",t.dateRange="com.apple.quicktime.HLS",t.emsg="https://aomedia.org/emsg/ID3",t.misbklv="urn:misb:KLV:bin:1910.1",t}({});function Jf(t="",e=9e4){return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class tg{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(t,e,i,s){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(t){this.initPTS=t,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(t,e){return!1}appendFrame(t,e,i){}demux(t,e){this.cachedData&&(t=sh(this.cachedData,t),this.cachedData=null);let i,s=Of(t,0),r=s?s.length:0;const n=this._audioTrack,a=this._id3Track,o=s?Xf(s):void 0,l=t.length;for((null===this.basePTS||0===this.frameIndex&&Ql(o))&&(this.basePTS=eg(o,e,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),s&&s.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Zf.audioId3,duration:Number.POSITIVE_INFINITY});r<l;){if(this.canParse(t,r)){const e=this.appendFrame(n,t,r);e?(this.frameIndex++,this.lastPTS=e.sample.pts,r+=e.length,i=r):r=l}else Gf(t,r)?(s=Of(t,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Zf.audioId3,duration:Number.POSITIVE_INFINITY}),r+=s.length,i=r):r++;if(r===l&&i!==l){const e=t.slice(i);this.cachedData?this.cachedData=sh(this.cachedData,e):this.cachedData=e}}return{audioTrack:n,videoTrack:Jf(),id3Track:a,textTrack:Jf()}}demuxSampleAes(t,e,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(t){const e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),{audioTrack:this._audioTrack,videoTrack:Jf(),id3Track:this._id3Track,textTrack:Jf()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const eg=(t,e,i)=>{if(Ql(t))return 90*t;return 9e4*e+(i?9e4*i.baseTime/i.timescale:0)};let ig=null;const sg=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],rg=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],ng=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],ag=[0,1,1,4];function og(t,e,i,s,r){if(i+24>e.length)return;const n=lg(e,i);if(n&&i+n.frameLength<=e.length){const a=s+r*(9e4*n.samplesPerFrame/n.sampleRate),o={unit:e.subarray(i,i+n.frameLength),pts:a,dts:a};return t.config=[],t.channelCount=n.channelCount,t.samplerate=n.sampleRate,t.samples.push(o),{sample:o,length:n.frameLength,missing:0}}}function lg(t,e){const i=t[e+1]>>3&3,s=t[e+1]>>1&3,r=t[e+2]>>4&15,n=t[e+2]>>2&3;if(1!==i&&0!==r&&15!==r&&3!==n){const a=t[e+2]>>1&1,o=t[e+3]>>6,l=1e3*sg[14*(3===i?3-s:3===s?3:4)+r-1],d=rg[3*(3===i?0:2===i?1:2)+n],h=3===o?1:2,c=ng[i][s],u=ag[s],f=8*c*u,g=Math.floor(c*l/d+a)*u;if(null===ig){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ig=t?parseInt(t[1]):0}return!!ig&&ig<=87&&2===s&&l>=224e3&&0===o&&(t[e+3]=128|t[e+3]),{sampleRate:d,channelCount:h,frameLength:g,samplesPerFrame:f}}}function dg(t,e){return!(255!==t[e]||224&~t[e+1]||!(6&t[e+1]))}function hg(t,e){return e+1<t.length&&dg(t,e)}function cg(t,e){if(e+1<t.length&&dg(t,e)){const i=4,s=lg(t,e);let r=i;null!=s&&s.frameLength&&(r=s.frameLength);const n=e+r;return n===t.length||hg(t,n)}return!1}const ug=(t,e)=>{let i=0,s=5;e+=s;const r=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=t[e];const o=Math.min(s,8),l=8-o;n[0]=4278190080>>>24+l<<l,r[0]=(a[0]&n[0])>>l,i=i?i<<o|r[0]:r[0],e+=1,s-=o}return i};class fg extends tg{constructor(t){super(),this.observer=void 0,this.observer=t}resetInitSegment(t,e,i,s){super.resetInitSegment(t,e,i,s),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:e,duration:s,inputTimeScale:9e4,dropped:0}}canParse(t,e){return e+64<t.length}appendFrame(t,e,i){const s=gg(t,e,i,this.basePTS,this.frameIndex);if(-1!==s){return{sample:t.samples[t.samples.length-1],length:s,missing:0}}}static probe(t){if(!t)return!1;const e=Of(t,0);if(!e)return!1;const i=e.length;return 11===t[i]&&119===t[i+1]&&void 0!==Xf(e)&&ug(t,i)<16}}function gg(t,e,i,s,r){if(i+8>e.length)return-1;if(11!==e[i]||119!==e[i+1])return-1;const n=e[i+4]>>6;if(n>=3)return-1;const a=[48e3,44100,32e3][n],o=63&e[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+n];if(i+l>e.length)return-1;const d=e[i+6]>>5;let h=0;2===d?h+=2:(1&d&&1!==d&&(h+=2),4&d&&(h+=2));const c=(e[i+6]<<8|e[i+7])>>12-h&1,u=[2,1,2,3,3,4,4,5][d]+c,f=e[i+5]>>3,g=7&e[i+5],m=new Uint8Array([n<<6|f<<1|g>>2,(3&g)<<6|d<<3|c<<2|o>>4,o<<4&224]),p=s+r*(1536/a*9e4),A=e.subarray(i,i+l);return t.config=m,t.channelCount=u,t.samplerate=a,t.samples.push({unit:A,pts:p}),l}const mg=/\/emsg[-/]ID3/i;function pg(t,e){return Ql(t.presentationTime)?t.presentationTime/t.timeScale:e+t.presentationTimeDelta/t.timeScale}class Ag{constructor(t,e,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Oc(e,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,Dc)}decryptAacSample(t,e,i){const s=t[e].unit;if(s.length<=16)return;const r=s.subarray(16,s.length-s.length%16),n=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(n).then(r=>{const n=new Uint8Array(r);s.set(n,16),this.decrypter.isSync()||this.decryptAacSamples(t,e+1,i)}).catch(i)}decryptAacSamples(t,e,i){for(;;e++){if(e>=t.length)return void i();if(!(t[e].unit.length<32)&&(this.decryptAacSample(t,e,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(t){const e=16*Math.floor((t.length-48)/160)+16,i=new Int8Array(e);let s=0;for(let r=32;r<t.length-16;r+=160,s+=16)i.set(t.subarray(r,r+16),s);return i}getAvcDecryptedUnit(t,e){const i=new Uint8Array(e);let s=0;for(let r=32;r<t.length-16;r+=160,s+=16)t.set(i.subarray(s,s+16),r);return t}decryptAvcSample(t,e,i,s,r){const n=lh(r.data),a=this.getAvcEncryptedData(n);this.decryptBuffer(a.buffer).then(a=>{r.data=this.getAvcDecryptedUnit(n,a),this.decrypter.isSync()||this.decryptAvcSamples(t,e,i+1,s)}).catch(s)}decryptAvcSamples(t,e,i,s){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,i=0){if(e>=t.length)return void s();const r=t[e].units;for(;!(i>=r.length);i++){const n=r[i];if(!(n.data.length<=48||1!==n.type&&5!==n.type||(this.decryptAvcSample(t,e,i,s,n),this.decrypter.isSync())))return}}}}class vg{constructor(){this.VideoSample=null}createVideoSample(t,e,i){return{key:t,frame:!1,pts:e,dts:i,units:[],length:0}}getLastNalUnit(t){var e;let i,s=this.VideoSample;if(s&&0!==s.units.length||(s=t[t.length-1]),null!=(e=s)&&e.units){const t=s.units;i=t[t.length-1]}return i}pushAccessUnit(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){const i=e.samples,s=i.length;if(!s)return void e.dropped++;{const e=i[s-1];t.pts=e.pts,t.dts=e.dts}}e.samples.push(t)}}parseNALu(t,e,i){const s=e.byteLength;let r=t.naluState||0;const n=r,a=[];let o,l,d,h=0,c=-1,u=0;for(-1===r&&(c=0,u=this.getNALuType(e,0),r=0,h=1);h<s;)if(o=e[h++],r)if(1!==r)if(o)if(1===o){if(l=h-r-1,c>=0){const t={data:e.subarray(c,l),type:u};a.push(t)}else{const i=this.getLastNalUnit(t.samples);i&&(n&&h<=4-n&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-n)),l>0&&(i.data=sh(i.data,e.subarray(0,l)),i.state=0))}h<s?(d=this.getNALuType(e,h),c=h,u=d,r=0):r=-1}else r=0;else r=3;else r=o?0:2;else r=o?0:1;if(c>=0&&r>=0){const t={data:e.subarray(c,s),type:u,state:r};a.push(t)}if(0===a.length){const i=this.getLastNalUnit(t.samples);i&&(i.data=sh(i.data,e))}return t.naluState=r,a}}class yg{constructor(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const t=this.data,e=this.bytesAvailable,i=t.byteLength-e,s=new Uint8Array(4),r=Math.min(4,e);if(0===r)throw new Error("no bytes available");s.set(t.subarray(i,i+r)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(t){let e;t=Math.min(t,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(e=(t-=this.bitsAvailable)>>3,t-=e<<3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}readBits(t){let e=Math.min(this.bitsAvailable,t);const i=this.word>>>32-e;if(t>32&&md.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0)this.word<<=e;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return e=t-e,e>0&&this.bitsAvailable?i<<e|this.readBits(e):i}skipLZ(){let t;for(t=0;t<this.bitsAvailable;++t)if(this.word&2147483648>>>t)return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const t=this.skipLZ();return this.readBits(t+1)-1}readEG(){const t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Eg extends vg{parsePES(t,e,i,s){const r=this.parseNALu(t,i.data,s);let n,a=this.VideoSample,o=!1;i.data=null,a&&r.length&&!t.audFound&&(this.pushAccessUnit(a,t),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.forEach(s=>{var r,l;switch(s.type){case 1:{let e=!1;n=!0;const r=s.data;if(o&&r.length>4){const t=this.readSliceType(r);2!==t&&4!==t&&7!==t&&9!==t||(e=!0)}var d;if(e)null!=(d=a)&&d.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.frame=!0,a.key=e;break}case 5:n=!0,null!=(r=a)&&r.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 6:n=!0,oh(s.data,1,i.pts,e.samples);break;case 7:{var h,c;n=!0,o=!0;const e=s.data,i=this.readSPS(e);if(!t.sps||t.width!==i.width||t.height!==i.height||(null==(h=t.pixelRatio)?void 0:h[0])!==i.pixelRatio[0]||(null==(c=t.pixelRatio)?void 0:c[1])!==i.pixelRatio[1]){t.width=i.width,t.height=i.height,t.pixelRatio=i.pixelRatio,t.sps=[e];const s=e.subarray(1,4);let r="avc1.";for(let t=0;t<3;t++){let e=s[t].toString(16);e.length<2&&(e="0"+e),r+=e}t.codec=r}break}case 8:n=!0,t.pps=[s.data];break;case 9:n=!0,t.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,t),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:n=!0;break;default:n=!1}if(a&&n){a.units.push(s)}}),s&&a&&(this.pushAccessUnit(a,t),this.VideoSample=null)}getNALuType(t,e){return 31&t[e]}readSliceType(t){const e=new yg(t);return e.readUByte(),e.readUEG(),e.readUEG()}skipScalingList(t,e){let i,s=8,r=8;for(let n=0;n<t;n++)0!==r&&(i=e.readEG(),r=(s+i+256)%256),s=0===r?s:r}readSPS(t){const e=new yg(t);let i,s,r,n=0,a=0,o=0,l=0;const d=e.readUByte.bind(e),h=e.readBits.bind(e),c=e.readUEG.bind(e),u=e.readBoolean.bind(e),f=e.skipBits.bind(e),g=e.skipEG.bind(e),m=e.skipUEG.bind(e),p=this.skipScalingList.bind(this);d();const A=d();if(h(5),f(3),d(),m(),100===A||110===A||122===A||244===A||44===A||83===A||86===A||118===A||128===A){const t=c();if(3===t&&f(1),m(),m(),f(1),u())for(s=3!==t?8:12,r=0;r<s;r++)u()&&p(r<6?16:64,e)}m();const v=c();if(0===v)c();else if(1===v)for(f(1),g(),g(),i=c(),r=0;r<i;r++)g();m(),f(1);const y=c(),E=c(),T=h(1);0===T&&f(1),f(1),u()&&(n=c(),a=c(),o=c(),l=c());let S=[1,1];if(u()&&u()){switch(d()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:S=[d()<<8|d(),d()<<8|d()]}}return{width:Math.ceil(16*(y+1)-2*n-2*a),height:(2-T)*(E+1)*16-(T?2:4)*(o+l),pixelRatio:S}}}class Tg extends vg{constructor(...t){super(...t),this.initVPS=null}parsePES(t,e,i,s){const r=this.parseNALu(t,i.data,s);let n,a=this.VideoSample,o=!1;i.data=null,a&&r.length&&!t.audFound&&(this.pushAccessUnit(a,t),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.forEach(s=>{var r,l;switch(s.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),a.frame=!0,n=!0;break;case 16:case 17:case 18:case 21:var d;if(n=!0,o)null!=(d=a)&&d.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null);a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:n=!0,null!=(r=a)&&r.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 39:n=!0,oh(s.data,2,i.pts,e.samples);break;case 32:n=!0,t.vps||("object"!=typeof t.params&&(t.params={}),t.params=ad(t.params,this.readVPS(s.data)),this.initVPS=s.data),t.vps=[s.data];break;case 33:if(n=!0,o=!0,void 0===t.vps||t.vps[0]===this.initVPS||void 0===t.sps||this.matchSPS(t.sps[0],s.data)||(this.initVPS=t.vps[0],t.sps=t.pps=void 0),!t.sps){const e=this.readSPS(s.data);t.width=e.width,t.height=e.height,t.pixelRatio=e.pixelRatio,t.codec=e.codecString,t.sps=[],"object"!=typeof t.params&&(t.params={});for(const i in e.params)t.params[i]=e.params[i]}this.pushParameterSet(t.sps,s.data,t.vps),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0;break;case 34:if(n=!0,"object"==typeof t.params){if(!t.pps){t.pps=[];const e=this.readPPS(s.data);for(const i in e)t.params[i]=e[i]}this.pushParameterSet(t.pps,s.data,t.vps)}break;case 35:n=!0,t.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,t),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:n=!1}if(a&&n){a.units.push(s)}}),s&&a&&(this.pushAccessUnit(a,t),this.VideoSample=null)}pushParameterSet(t,e,i){(i&&i[0]===this.initVPS||!i&&!t.length)&&t.push(e)}getNALuType(t,e){return(126&t[e])>>>1}ebsp2rbsp(t){const e=new Uint8Array(t.byteLength);let i=0;for(let s=0;s<t.byteLength;s++)s>=2&&3===t[s]&&0===t[s-1]&&0===t[s-2]||(e[i]=t[s],i++);return new Uint8Array(e.buffer,0,i)}pushAccessUnit(t,e){super.pushAccessUnit(t,e),this.initVPS&&(this.initVPS=null)}readVPS(t){const e=new yg(t);e.readUByte(),e.readUByte(),e.readBits(4),e.skipBits(2),e.readBits(6);return{numTemporalLayers:e.readBits(3)+1,temporalIdNested:e.readBoolean()}}readSPS(t){const e=new yg(this.ebsp2rbsp(t));e.readUByte(),e.readUByte(),e.readBits(4);const i=e.readBits(3);e.readBoolean();const s=e.readBits(2),r=e.readBoolean(),n=e.readBits(5),a=e.readUByte(),o=e.readUByte(),l=e.readUByte(),d=e.readUByte(),h=e.readUByte(),c=e.readUByte(),u=e.readUByte(),f=e.readUByte(),g=e.readUByte(),m=e.readUByte(),p=e.readUByte(),A=[],v=[];for(let K=0;K<i;K++)A.push(e.readBoolean()),v.push(e.readBoolean());if(i>0)for(let K=i;K<8;K++)e.readBits(2);for(let K=0;K<i;K++)A[K]&&(e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte()),v[K]&&e.readUByte();e.readUEG();const y=e.readUEG();3==y&&e.skipBits(1);const E=e.readUEG(),T=e.readUEG(),S=e.readBoolean();let b=0,I=0,L=0,R=0;S&&(b+=e.readUEG(),I+=e.readUEG(),L+=e.readUEG(),R+=e.readUEG());const k=e.readUEG(),w=e.readUEG(),D=e.readUEG();for(let K=e.readBoolean()?0:i;K<=i;K++)e.skipUEG(),e.skipUEG(),e.skipUEG();e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG();if(e.readBoolean()){if(e.readBoolean())for(let t=0;t<4;t++)for(let i=0;i<(3===t?2:6);i++){if(e.readBoolean()){const i=Math.min(64,1<<4+(t<<1));t>1&&e.readEG();for(let t=0;t<i;t++)e.readEG()}else e.readUEG()}}e.readBoolean(),e.readBoolean();e.readBoolean()&&(e.readUByte(),e.skipUEG(),e.skipUEG(),e.readBoolean());const C=e.readUEG();let x=0;for(let K=0;K<C;K++){let t=!1;if(0!==K&&(t=e.readBoolean()),t){K===C&&e.readUEG(),e.readBoolean(),e.readUEG();let t=0;for(let i=0;i<=x;i++){const i=e.readBoolean();let s=!1;i||(s=e.readBoolean()),(i||s)&&t++}x=t}else{const t=e.readUEG(),i=e.readUEG();x=t+i;for(let s=0;s<t;s++)e.readUEG(),e.readBoolean();for(let s=0;s<i;s++)e.readUEG(),e.readBoolean()}}if(e.readBoolean()){const t=e.readUEG();for(let i=0;i<t;i++){for(let t=0;t<D+4;t++)e.readBits(1);e.readBits(1)}}let P=0,M=1,O=1,B=!0,F=1,N=0;e.readBoolean(),e.readBoolean();let _=!1;if(e.readBoolean()){if(e.readBoolean()){const t=e.readUByte();t>0&&t<16?(M=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][t-1],O=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][t-1]):255===t&&(M=e.readBits(16),O=e.readBits(16))}e.readBoolean()&&e.readBoolean();if(e.readBoolean()){e.readBits(3),e.readBoolean();e.readBoolean()&&(e.readUByte(),e.readUByte(),e.readUByte())}e.readBoolean()&&(e.readUEG(),e.readUEG()),e.readBoolean(),e.readBoolean(),e.readBoolean(),_=e.readBoolean(),_&&(e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG());if(e.readBoolean()){F=e.readBits(32),N=e.readBits(32);e.readBoolean()&&e.readUEG();if(e.readBoolean()){const t=e.readBoolean(),s=e.readBoolean();let r=!1;(t||s)&&(r=e.readBoolean(),r&&(e.readUByte(),e.readBits(5),e.readBoolean(),e.readBits(5)),e.readBits(4),e.readBits(4),r&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5));for(let n=0;n<=i;n++){B=e.readBoolean();let i=!1;B||e.readBoolean()?e.readEG():i=e.readBoolean();const n=i?1:e.readUEG()+1;if(t)for(let t=0;t<n;t++)e.readUEG(),e.readUEG(),r&&(e.readUEG(),e.readUEG()),e.skipBits(1);if(s)for(let t=0;t<n;t++)e.readUEG(),e.readUEG(),r&&(e.readUEG(),e.readUEG()),e.skipBits(1)}}}e.readBoolean()&&(e.readBoolean(),e.readBoolean(),e.readBoolean(),P=e.readUEG())}let U=E,H=T;if(S){let t=1,e=1;1===y?t=e=2:2==y&&(t=2),U=E-t*I-t*b,H=T-e*R-e*L}const j=s?["A","B","C"][s]:"",V=a<<24|o<<16|l<<8|d;let G=0;for(let K=0;K<32;K++)G=(G|(V>>K&1)<<31-K)>>>0;let Q=G.toString(16);1===n&&"2"===Q&&(Q="6");return{codecString:`hvc1.${j}${n}.${Q}.${r?"H":"L"}${p}.B0`,params:{general_tier_flag:r,general_profile_idc:n,general_profile_space:s,general_profile_compatibility_flags:[a,o,l,d],general_constraint_indicator_flags:[h,c,u,f,g,m],general_level_idc:p,bit_depth:k+8,bit_depth_luma_minus8:k,bit_depth_chroma_minus8:w,min_spatial_segmentation_idc:P,chroma_format_idc:y,frame_rate:{fixed:B,fps:N/F}},width:U,height:H,pixelRatio:[M,O]}}readPPS(t){const e=new yg(this.ebsp2rbsp(t));e.readUByte(),e.readUByte(),e.skipUEG(),e.skipUEG(),e.skipBits(2),e.skipBits(3),e.skipBits(2),e.skipUEG(),e.skipUEG(),e.skipEG(),e.skipBits(2);e.readBoolean()&&e.skipUEG(),e.skipEG(),e.skipEG(),e.skipBits(4);const i=e.readBoolean(),s=e.readBoolean();let r=1;return s&&i?r=0:s?r=3:i&&(r=2),{parallelismType:r}}matchSPS(t,e){return String.fromCharCode.apply(null,t).substr(3)===String.fromCharCode.apply(null,e).substr(3)}}const Sg=188;class bg{constructor(t,e,i,s){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=e,this.typeSupported=i,this.logger=s,this.videoParser=null}static probe(t,e){const i=bg.syncOffset(t);return i>0&&e.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),-1!==i}static syncOffset(t){const e=t.length;let i=Math.min(940,e-Sg)+1,s=0;for(;s<i;){let r=!1,n=-1,a=0;for(let o=s;o<e;o+=Sg){if(71!==t[o]||e-o!==Sg&&71!==t[o+Sg]){if(a)return-1;break}if(a++,-1===n&&(n=o,0!==n&&(i=Math.min(n+18612,t.length-Sg)+1)),r||(r=0===Ig(t,o)),r&&a>1&&(0===n&&a>2||o+Sg>i))return n}s++}return-1}static createTrack(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:jd[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===t?e:void 0}}resetInitSegment(t,e,i,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=bg.createTrack("video"),this._videoTrack.duration=s,this._audioTrack=bg.createTrack("audio",s),this._id3Track=bg.createTrack("id3"),this._txtTrack=bg.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=e,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:t,_videoTrack:e,_id3Track:i}=this;t&&(t.pesData=null),e&&(e.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,e,i=!1,s=!1){let r;i||(this.sampleAes=null);const n=this._videoTrack,a=this._audioTrack,o=this._id3Track,l=this._txtTrack;let d=n.pid,h=n.pesData,c=a.pid,u=o.pid,f=a.pesData,g=o.pesData,m=null,p=this.pmtParsed,A=this._pmtId,v=t.length;if(this.remainderData&&(v=(t=sh(this.remainderData,t)).length,this.remainderData=null),v<Sg&&!s)return this.remainderData=t,{audioTrack:a,videoTrack:n,id3Track:o,textTrack:l};const y=Math.max(0,bg.syncOffset(t));v-=(v-y)%Sg,v<t.byteLength&&!s&&(this.remainderData=new Uint8Array(t.buffer,v,t.buffer.byteLength-v));let E=0;for(let S=y;S<v;S+=Sg)if(71===t[S]){const e=!!(64&t[S+1]),s=Ig(t,S);let v;if((48&t[S+3])>>4>1){if(v=S+5+t[S+4],v===S+Sg)continue}else v=S+4;switch(s){case d:e&&(h&&(r=Dg(h,this.logger))&&(this.readyVideoParser(n.segmentCodec),null!==this.videoParser&&this.videoParser.parsePES(n,l,r,!1)),h={data:[],size:0}),h&&(h.data.push(t.subarray(v,S+Sg)),h.size+=S+Sg-v);break;case c:if(e){if(f&&(r=Dg(f,this.logger)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,r);break;case"mp3":this.parseMPEGPES(a,r);break;case"ac3":this.parseAC3PES(a,r)}f={data:[],size:0}}f&&(f.data.push(t.subarray(v,S+Sg)),f.size+=S+Sg-v);break;case u:e&&(g&&(r=Dg(g,this.logger))&&this.parseID3PES(o,r),g={data:[],size:0}),g&&(g.data.push(t.subarray(v,S+Sg)),g.size+=S+Sg-v);break;case 0:e&&(v+=t[v]+1),A=this._pmtId=Lg(t,v);break;case A:{e&&(v+=t[v]+1);const s=Rg(t,v,this.typeSupported,i,this.observer,this.logger);d=s.videoPid,d>0&&(n.pid=d,n.segmentCodec=s.segmentVideoCodec),c=s.audioPid,c>0&&(a.pid=c,a.segmentCodec=s.segmentAudioCodec),u=s.id3Pid,u>0&&(o.pid=u),null===m||p||(this.logger.warn(`MPEG-TS PMT found at ${S} after unknown PID '${m}'. Backtracking to sync byte @${y} to parse all TS packets.`),m=null,S=y-188),p=this.pmtParsed=!0;break}case 17:case 8191:break;default:m=s}}else E++;E>0&&kg(this.observer,new Error(`Found ${E} TS packet/s that do not start with 0x47`),void 0,this.logger),n.pesData=h,a.pesData=f,o.pesData=g;const T={audioTrack:a,videoTrack:n,id3Track:o,textTrack:l};return s&&this.extractRemainingSamples(T),T}flush(){const{remainderData:t}=this;let e;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e}extractRemainingSamples(t){const{audioTrack:e,videoTrack:i,id3Track:s,textTrack:r}=t,n=i.pesData,a=e.pesData,o=s.pesData;let l;if(n&&(l=Dg(n,this.logger))?(this.readyVideoParser(i.segmentCodec),null!==this.videoParser&&(this.videoParser.parsePES(i,r,l,!0),i.pesData=null)):i.pesData=n,a&&(l=Dg(a,this.logger))){switch(e.segmentCodec){case"aac":this.parseAACPES(e,l);break;case"mp3":this.parseMPEGPES(e,l);break;case"ac3":this.parseAC3PES(e,l)}e.pesData=null}else null!=a&&a.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),e.pesData=a;o&&(l=Dg(o,this.logger))?(this.parseID3PES(s,l),s.pesData=null):s.pesData=o}demuxSampleAes(t,e,i){const s=this.demux(t,i,!0,!this.config.progressive),r=this.sampleAes=new Ag(this.observer,this.config,e);return this.decrypt(s,r)}readyVideoParser(t){null===this.videoParser&&("avc"===t?this.videoParser=new Eg:"hevc"===t&&(this.videoParser=new Tg))}decrypt(t,e){return new Promise(i=>{const{audioTrack:s,videoTrack:r}=t;s.samples&&"aac"===s.segmentCodec?e.decryptAacSamples(s.samples,0,()=>{r.samples?e.decryptAvcSamples(r.samples,0,0,()=>{i(t)}):i(t)}):r.samples&&e.decryptAvcSamples(r.samples,0,0,()=>{i(t)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(t,e){let i=0;const s=this.aacOverFlow;let r,n,a,o=e.data;if(s){this.aacOverFlow=null;const e=s.missing,r=s.sample.unit.byteLength;if(-1===e)o=sh(s.sample.unit,o);else{const n=r-e;s.sample.unit.set(o.subarray(0,e),n),t.samples.push(s.sample),i=s.missing}}for(r=i,n=o.length;r<n-1&&!_f(o,r);r++);if(r!==i){let t;const e=r<n-1;if(t=e?`AAC PES did not start with ADTS header,offset:${r}`:"No ADTS header found in AAC PES",kg(this.observer,new Error(t),e,this.logger),!e)return}if(Hf(t,this.observer,o,r,this.audioCodec),void 0!==e.pts)a=e.pts;else{if(!s)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");{const e=jf(t.samplerate);a=s.sample.pts+e}}let l,d=0;for(;r<n;){if(l=Vf(t,o,r,a,d),r+=l.length,l.missing){this.aacOverFlow=l;break}for(d++;r<n-1&&!_f(o,r);r++);}}parseMPEGPES(t,e){const i=e.data,s=i.length;let r=0,n=0;const a=e.pts;if(void 0!==a)for(;n<s;)if(hg(i,n)){const e=og(t,i,n,a,r);if(!e)break;n+=e.length,r++}else n++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")}parseAC3PES(t,e){{const i=e.data,s=e.pts;if(void 0===s)return void this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");const r=i.length;let n,a=0,o=0;for(;o<r&&(n=gg(t,i,o,s,a++))>0;)o+=n}}parseID3PES(t,e){if(void 0===e.pts)return void this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");const i=ad({},e,{type:this._videoTrack?Zf.emsg:Zf.audioId3,duration:Number.POSITIVE_INFINITY});t.samples.push(i)}}function Ig(t,e){return((31&t[e+1])<<8)+t[e+2]}function Lg(t,e){return(31&t[e+10])<<8|t[e+11]}function Rg(t,e,i,s,r,n){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<o;){const o=Ig(t,e),l=(15&t[e+3])<<8|t[e+4];switch(t[e]){case 207:if(!s){wg("ADTS AAC",n);break}case 15:-1===a.audioPid&&(a.audioPid=o);break;case 21:-1===a.id3Pid&&(a.id3Pid=o);break;case 219:if(!s){wg("H.264",n);break}case 27:-1===a.videoPid&&(a.videoPid=o);break;case 3:case 4:i.mpeg||i.mp3?-1===a.audioPid&&(a.audioPid=o,a.segmentAudioCodec="mp3"):n.log("MPEG audio found, not supported in this browser");break;case 193:if(!s){wg("AC-3",n);break}case 129:i.ac3?-1===a.audioPid&&(a.audioPid=o,a.segmentAudioCodec="ac3"):n.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===a.audioPid&&l>0){let s=e+5,r=l;for(;r>2;){if(106===t[s])!0!==i.ac3?n.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=o,a.segmentAudioCodec="ac3");const e=t[s+1]+2;s+=e,r-=e}}break;case 194:case 135:return kg(r,new Error("Unsupported EC-3 in M2TS found"),void 0,n),a;case 36:-1===a.videoPid&&(a.videoPid=o,a.segmentVideoCodec="hevc",n.log("HEVC in M2TS found"))}e+=l+5}return a}function kg(t,e,i,s){s.warn(`parsing error: ${e.message}`),t.emit($l.ERROR,$l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:e,reason:e.message})}function wg(t,e){e.log(`${t} with AES-128-CBC encryption found in unencrypted stream`)}function Dg(t,e){let i,s,r,n,a,o=0;const l=t.data;if(!t||0===t.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=sh(l[0],l[1]),l.splice(1,1);i=l[0];if(1===(i[0]<<16)+(i[1]<<8)+i[2]){if(s=(i[4]<<8)+i[5],s&&s>t.size-6)return null;const d=i[7];192&d&&(n=536870912*(14&i[9])+4194304*(255&i[10])+16384*(254&i[11])+128*(255&i[12])+(254&i[13])/2,64&d?(a=536870912*(14&i[14])+4194304*(255&i[15])+16384*(254&i[16])+128*(255&i[17])+(254&i[18])/2,n-a>54e5&&(e.warn(`${Math.round((n-a)/9e4)}s delta between PTS and DTS, align them`),n=a)):a=n),r=i[8];let h=r+9;if(t.size<=h)return null;t.size-=h;const c=new Uint8Array(t.size);for(let t=0,e=l.length;t<e;t++){i=l[t];let e=i.byteLength;if(h){if(h>e){h-=e;continue}i=i.subarray(h),e-=h,h=0}c.set(i,o),o+=e}return s&&(s-=r+3),{data:c,pts:n,dts:a,len:s}}return null}class Cg{static getSilentFrame(t,e){if("mp4a.40.2"===t){if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===e)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const xg=Math.pow(2,32)-1;class Pg{static init(){let t;for(t in Pg.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},Pg.types)Pg.types.hasOwnProperty(t)&&(Pg.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);const e=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Pg.HDLR_TYPES={video:e,audio:i};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);Pg.STTS=Pg.STSC=Pg.STCO=r,Pg.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Pg.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Pg.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Pg.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const n=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);Pg.FTYP=Pg.box(Pg.types.ftyp,n,o,n,a),Pg.DINF=Pg.box(Pg.types.dinf,Pg.box(Pg.types.dref,s))}static box(t,...e){let i=8,s=e.length;const r=s;for(;s--;)i+=e[s].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=255&i,n.set(t,4),s=0,i=8;s<r;s++)n.set(e[s],i),i+=e[s].byteLength;return n}static hdlr(t){return Pg.box(Pg.types.hdlr,Pg.HDLR_TYPES[t])}static mdat(t){return Pg.box(Pg.types.mdat,t)}static mdhd(t,e){e*=t;const i=Math.floor(e/(xg+1)),s=Math.floor(e%(xg+1));return Pg.box(Pg.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,85,196,0,0]))}static mdia(t){return Pg.box(Pg.types.mdia,Pg.mdhd(t.timescale||0,t.duration||0),Pg.hdlr(t.type),Pg.minf(t))}static mfhd(t){return Pg.box(Pg.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}static minf(t){return"audio"===t.type?Pg.box(Pg.types.minf,Pg.box(Pg.types.smhd,Pg.SMHD),Pg.DINF,Pg.stbl(t)):Pg.box(Pg.types.minf,Pg.box(Pg.types.vmhd,Pg.VMHD),Pg.DINF,Pg.stbl(t))}static moof(t,e,i){return Pg.box(Pg.types.moof,Pg.mfhd(t),Pg.traf(i,e))}static moov(t){let e=t.length;const i=[];for(;e--;)i[e]=Pg.trak(t[e]);return Pg.box.apply(null,[Pg.types.moov,Pg.mvhd(t[0].timescale||0,t[0].duration||0)].concat(i).concat(Pg.mvex(t)))}static mvex(t){let e=t.length;const i=[];for(;e--;)i[e]=Pg.trex(t[e]);return Pg.box.apply(null,[Pg.types.mvex,...i])}static mvhd(t,e){e*=t;const i=Math.floor(e/(xg+1)),s=Math.floor(e%(xg+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return Pg.box(Pg.types.mvhd,r)}static sdtp(t){const e=t.samples||[],i=new Uint8Array(4+e.length);let s,r;for(s=0;s<e.length;s++)r=e[s].flags,i[s+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return Pg.box(Pg.types.sdtp,i)}static stbl(t){return Pg.box(Pg.types.stbl,Pg.stsd(t),Pg.box(Pg.types.stts,Pg.STTS),Pg.box(Pg.types.stsc,Pg.STSC),Pg.box(Pg.types.stsz,Pg.STSZ),Pg.box(Pg.types.stco,Pg.STCO))}static avc1(t){let e,i,s,r=[],n=[];for(e=0;e<t.sps.length;e++)i=t.sps[e],s=i.byteLength,r.push(s>>>8&255),r.push(255&s),r=r.concat(Array.prototype.slice.call(i));for(e=0;e<t.pps.length;e++)i=t.pps[e],s=i.byteLength,n.push(s>>>8&255),n.push(255&s),n=n.concat(Array.prototype.slice.call(i));const a=Pg.box(Pg.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|t.sps.length].concat(r).concat([t.pps.length]).concat(n))),o=t.width,l=t.height,d=t.pixelRatio[0],h=t.pixelRatio[1];return Pg.box(Pg.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,Pg.box(Pg.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Pg.box(Pg.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,h>>24,h>>16&255,h>>8&255,255&h])))}static esds(t){const e=t.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...e,6,1,2])}static audioStsd(t){const e=t.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount||0,0,16,0,0,0,0,e>>8&255,255&e,0,0])}static mp4a(t){return Pg.box(Pg.types.mp4a,Pg.audioStsd(t),Pg.box(Pg.types.esds,Pg.esds(t)))}static mp3(t){return Pg.box(Pg.types[".mp3"],Pg.audioStsd(t))}static ac3(t){return Pg.box(Pg.types["ac-3"],Pg.audioStsd(t),Pg.box(Pg.types.dac3,t.config))}static stsd(t){const{segmentCodec:e}=t;if("audio"===t.type){if("aac"===e)return Pg.box(Pg.types.stsd,Pg.STSD,Pg.mp4a(t));if("ac3"===e&&t.config)return Pg.box(Pg.types.stsd,Pg.STSD,Pg.ac3(t));if("mp3"===e&&"mp3"===t.codec)return Pg.box(Pg.types.stsd,Pg.STSD,Pg.mp3(t))}else{if(!t.pps||!t.sps)throw new Error("video track missing pps or sps");if("avc"===e)return Pg.box(Pg.types.stsd,Pg.STSD,Pg.avc1(t));if("hevc"===e&&t.vps)return Pg.box(Pg.types.stsd,Pg.STSD,Pg.hvc1(t))}throw new Error(`unsupported ${t.type} segment codec (${e}/${t.codec})`)}static tkhd(t){const e=t.id,i=(t.duration||0)*(t.timescale||0),s=t.width||0,r=t.height||0,n=Math.floor(i/(xg+1)),a=Math.floor(i%(xg+1));return Pg.box(Pg.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,255&s,0,0,r>>8&255,255&r,0,0]))}static traf(t,e){const i=Pg.sdtp(t),s=t.id,r=Math.floor(e/(xg+1)),n=Math.floor(e%(xg+1));return Pg.box(Pg.types.traf,Pg.box(Pg.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s])),Pg.box(Pg.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,n>>24,n>>16&255,n>>8&255,255&n])),Pg.trun(t,i.length+16+20+8+16+8+8),i)}static trak(t){return t.duration=t.duration||4294967295,Pg.box(Pg.types.trak,Pg.tkhd(t),Pg.mdia(t))}static trex(t){const e=t.id;return Pg.box(Pg.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,e){const i=t.samples||[],s=i.length,r=12+16*s,n=new Uint8Array(r);let a,o,l,d,h,c;for(e+=8+r,n.set(["video"===t.type?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,255&s,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),a=0;a<s;a++)o=i[a],l=o.duration,d=o.size,h=o.flags,c=o.cts,n.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,d>>>24&255,d>>>16&255,d>>>8&255,255&d,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,61440&h.degradPrio,15&h.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*a);return Pg.box(Pg.types.trun,n)}static initSegment(t){Pg.types||Pg.init();const e=Pg.moov(t);return sh(Pg.FTYP,e)}static hvc1(t){const e=t.params,i=[t.vps,t.sps,t.pps],s=new Uint8Array([1,e.general_profile_space<<6|(e.general_tier_flag?32:0)|e.general_profile_idc,e.general_profile_compatibility_flags[0],e.general_profile_compatibility_flags[1],e.general_profile_compatibility_flags[2],e.general_profile_compatibility_flags[3],e.general_constraint_indicator_flags[0],e.general_constraint_indicator_flags[1],e.general_constraint_indicator_flags[2],e.general_constraint_indicator_flags[3],e.general_constraint_indicator_flags[4],e.general_constraint_indicator_flags[5],e.general_level_idc,240|e.min_spatial_segmentation_idc>>8,255&e.min_spatial_segmentation_idc,252|e.parallelismType,252|e.chroma_format_idc,248|e.bit_depth_luma_minus8,248|e.bit_depth_chroma_minus8,0,parseInt(e.frame_rate.fps),3|e.temporal_id_nested<<2|e.num_temporal_layers<<3|(e.frame_rate.fixed?64:0),i.length]);let r=s.length;for(let u=0;u<i.length;u+=1){r+=3;for(let t=0;t<i[u].length;t+=1)r+=2+i[u][t].length}const n=new Uint8Array(r);n.set(s,0),r=s.length;const a=i.length-1;for(let u=0;u<i.length;u+=1){n.set(new Uint8Array([32+u|(u===a?128:0),0,i[u].length]),r),r+=3;for(let t=0;t<i[u].length;t+=1)n.set(new Uint8Array([i[u][t].length>>8,255&i[u][t].length]),r),r+=2,n.set(i[u][t],r),r+=i[u][t].length}const o=Pg.box(Pg.types.hvcC,n),l=t.width,d=t.height,h=t.pixelRatio[0],c=t.pixelRatio[1];return Pg.box(Pg.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,d>>8&255,255&d,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,Pg.box(Pg.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Pg.box(Pg.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,255&h,c>>24,c>>16&255,c>>8&255,255&c])))}}Pg.types=void 0,Pg.HDLR_TYPES=void 0,Pg.STTS=void 0,Pg.STSC=void 0,Pg.STCO=void 0,Pg.STSZ=void 0,Pg.VMHD=void 0,Pg.SMHD=void 0,Pg.STSD=void 0,Pg.FTYP=void 0,Pg.DINF=void 0;function Mg(t,e,i=1,s=!1){const r=t*e*i;return s?Math.round(r):r}function Og(t,e=!1){return Mg(t,1e3,1/9e4,e)}function Bg(t){const{baseTime:e,timescale:i,trackId:s}=t;return`${e/i} (${e}/${i}) trackId: ${s}`}let Fg,Ng=null,_g=null;function Ug(t,e,i,s){return{duration:e,size:i,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}}class Hg extends dd{constructor(t,e,i,s){if(super("mp4-remuxer",s),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=t,this.config=e,this.typeSupported=i,this.ISGenerated=!1,null===Ng){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ng=t?parseInt(t[1]):0}if(null===_g){const t=navigator.userAgent.match(/Safari\/(\d+)/i);_g=t?parseInt(t[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(t){const e=this._initPTS;e&&t&&t.trackId===e.trackId&&t.baseTime===e.baseTime&&t.timescale===e.timescale||this.log(`Reset initPTS: ${e?Bg(e):e} > ${t?Bg(t):t}`),this._initPTS=this._initDTS=t}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(t){let e=!1;const i=t[0].pts,s=t.reduce((t,s)=>{let r=s.pts,n=r-t;return n<-4294967296&&(e=!0,r=jg(r,i),n=r-t),n>0?t:r},i);return e&&this.debug("PTS rollover detected"),s}remux(t,e,i,s,r,n,a,o){let l,d,h,c,u,f,g=r,m=r;const p=t.pid>-1,A=e.pid>-1,v=e.samples.length,y=t.samples.length>0,E=a&&v>0||v>1;if((!p||y)&&(!A||E)||this.ISGenerated||a){if(this.ISGenerated){var T,S,b,I;const t=this.videoTrackConfig;(t&&(e.width!==t.width||e.height!==t.height||(null==(T=e.pixelRatio)?void 0:T[0])!==(null==(S=t.pixelRatio)?void 0:S[0])||(null==(b=e.pixelRatio)?void 0:b[1])!==(null==(I=t.pixelRatio)?void 0:I[1]))||!t&&E||null===this.nextAudioTs&&y)&&this.resetInitSegment()}this.ISGenerated||(h=this.generateIS(t,e,r,n));const i=this.isVideoContiguous;let s,a=-1;if(E&&(a=function(t){for(let e=0;e<t.length;e++)if(t[e].key)return e;return-1}(e.samples),!i&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,a>0){this.warn(`Dropped ${a} out of ${v} video samples due to a missing keyframe`);const t=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(a),e.dropped+=a,m+=(e.samples[0].pts-t)/e.inputTimeScale,s=m}else-1===a&&(this.warn(`No keyframe found out of ${v} video samples`),f=!1);if(this.ISGenerated){if(y&&E){const i=this.getVideoStartPts(e.samples),s=(jg(t.samples[0].pts,i)-i)/e.inputTimeScale;g+=Math.max(0,s),m+=Math.max(0,-s)}if(y){if(t.samplerate||(this.warn("regenerate InitSegment as audio detected"),h=this.generateIS(t,e,r,n)),d=this.remuxAudio(t,g,this.isAudioContiguous,n,A||E||o===ed?m:void 0),E){const s=d?d.endPTS-d.startPTS:0;e.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),h=this.generateIS(t,e,r,n)),l=this.remuxVideo(e,m,i,s)}}else E&&(l=this.remuxVideo(e,m,i,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=s)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(u=Vg(i,r,this._initPTS,this._initDTS)),s.samples.length&&(c=Gg(s,r,this._initPTS))),{audio:d,video:l,initSegment:h,independent:f,text:c,id3:u}}computeInitPts(t,e,i,s){const r=Math.round(i*e);let n=jg(t,r);if(n<r+e)for(this.log(`Adjusting PTS for rollover in timeline near ${(r-n)/e} ${s}`);n<r+e;)n+=8589934592;return n-r}generateIS(t,e,i,s){const r=t.samples,n=e.samples,a=this.typeSupported,o={},l=this._initPTS;let d,h,c,u=!l||s,f="audio/mp4",g=-1;if(u&&(d=h=1/0),t.config&&r.length){switch(t.timescale=t.samplerate,t.segmentCodec){case"mp3":a.mpeg?(f="audio/mpeg",t.codec=""):a.mp3&&(t.codec="mp3");break;case"ac3":t.codec="ac-3"}o.audio={id:"audio",container:f,codec:t.codec,initSegment:"mp3"===t.segmentCodec&&a.mpeg?new Uint8Array(0):Pg.initSegment([t]),metadata:{channelCount:t.channelCount}},u&&(g=t.id,c=t.inputTimeScale,l&&c===l.timescale?u=!1:d=h=this.computeInitPts(r[0].pts,c,i,"audio"))}if(e.sps&&e.pps&&n.length){if(e.timescale=e.inputTimeScale,o.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:Pg.initSegment([e]),metadata:{width:e.width,height:e.height}},u)if(g=e.id,c=e.inputTimeScale,l&&c===l.timescale)u=!1;else{const t=this.getVideoStartPts(n),e=jg(n[0].dts,t),s=this.computeInitPts(e,c,i,"video"),r=this.computeInitPts(t,c,i,"video");h=Math.min(h,s),d=Math.min(d,r)}this.videoTrackConfig={width:e.width,height:e.height,pixelRatio:e.pixelRatio}}if(Object.keys(o).length)return this.ISGenerated=!0,u?(l&&this.warn(`Timestamps at playlist time: ${s?"":"~"}${i} ${d/c} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${d/c} (${d}/${c}) trackId: ${g}`),this._initPTS={baseTime:d,timescale:c,trackId:g},this._initDTS={baseTime:h,timescale:c,trackId:g}):d=c=void 0,{tracks:o,initPTS:d,timescale:c,trackId:g}}remuxVideo(t,e,i,s){const r=t.inputTimeScale,n=t.samples,a=[],o=n.length,l=this._initPTS,d=l.baseTime*r/l.timescale;let h,c,u=this.nextVideoTs,f=8,g=this.videoSampleDuration,m=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,A=!1;if(!i||null===u){const t=d+e*r,s=n[0].pts-jg(n[0].dts,n[0].pts);Ng&&null!==u&&Math.abs(t-s-(u+d))<15e3?i=!0:u=t-s-d}const v=u+d;for(let B=0;B<o;B++){const t=n[B];t.pts=jg(t.pts,v),t.dts=jg(t.dts,v),t.dts<n[B>0?B-1:B].dts&&(A=!0)}A&&n.sort(function(t,e){const i=t.dts-e.dts,s=t.pts-e.pts;return i||s}),h=n[0].dts,c=n[n.length-1].dts;const y=c-h,E=y?Math.round(y/(o-1)):g||t.inputTimeScale/30;if(i){const i=h-v,s=i>E,r=i<-1;if((s||r)&&(s?this.warn(`${(t.segmentCodec||"").toUpperCase()}: ${Og(i,!0)} ms (${i}dts) hole between fragments detected at ${e.toFixed(3)}`):this.warn(`${(t.segmentCodec||"").toUpperCase()}: ${Og(-i,!0)} ms (${i}dts) overlapping between fragments detected at ${e.toFixed(3)}`),!r||v>=n[0].pts||Ng)){h=v;const t=n[0].pts-i;if(s)n[0].dts=h,n[0].pts=t;else{let e=!0;for(let s=0;s<n.length&&!(n[s].dts>t&&e);s++){const t=n[s].pts;if(n[s].dts-=i,n[s].pts-=i,s<n.length-1){const i=n[s+1].pts;e=i<=n[s].pts==i<=t}}}this.log(`Video: Initial PTS/DTS adjusted: ${Og(t,!0)}/${Og(h,!0)}, delta: ${Og(i,!0)} ms`)}}h=Math.max(0,h);let T=0,S=0,b=h;for(let B=0;B<o;B++){const t=n[B],e=t.units,i=e.length;let s=0;for(let r=0;r<i;r++)s+=e[r].data.length;S+=s,T+=i,t.length=s,t.dts<b?(t.dts=b,b+=E/4|0||1):b=t.dts,m=Math.min(t.pts,m),p=Math.max(t.pts,p)}c=n[o-1].dts;const I=S+4*T+8;let L;try{L=new Uint8Array(I)}catch(O){return void this.observer.emit($l.ERROR,$l.ERROR,{type:Wl.MUX_ERROR,details:Yl.REMUX_ALLOC_ERROR,fatal:!1,error:O,bytes:I,reason:`fail allocating video mdat ${I}`})}const R=new DataView(L.buffer);R.setUint32(0,I),L.set(Pg.types.mdat,4);let k=!1,w=Number.POSITIVE_INFINITY,D=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,x=Number.NEGATIVE_INFINITY;for(let B=0;B<o;B++){const t=n[B],e=t.units;let i,l=0;for(let s=0,r=e.length;s<r;s++){const t=e[s],i=t.data,r=t.data.byteLength;R.setUint32(f,r),f+=4,L.set(i,f),f+=r,l+=4+r}if(B<o-1)g=n[B+1].dts-t.dts,i=n[B+1].pts-t.pts;else{const e=this.config,a=B>0?t.dts-n[B-1].dts:E;if(i=B>0?t.pts-n[B-1].pts:E,e.stretchShortVideoTrack&&null!==this.nextAudioTs){const i=Math.floor(e.maxBufferHole*r),n=(s?m+s*r:this.nextAudioTs+d)-t.pts;n>i?(g=n-a,g<0?g=a:k=!0,this.log(`It is approximately ${n/90} ms to the next segment; using duration ${g/90} ms for the last video frame.`)):g=a}else g=a}const h=Math.round(t.pts-t.dts);w=Math.min(w,g),C=Math.max(C,g),D=Math.min(D,i),x=Math.max(x,i),a.push(Ug(t.key,g,l,h))}if(a.length)if(Ng){if(Ng<70){const t=a[0].flags;t.dependsOn=2,t.isNonSync=0}}else if(_g&&x-D<C-w&&E/C<.025&&0===a[0].cts){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let t=h;for(let e=0,i=a.length;e<i;e++){const s=t+a[e].duration,r=t+a[e].cts;if(e<i-1){const t=s+a[e+1].cts;a[e].duration=t-r}else a[e].duration=e?a[e-1].duration:E;a[e].cts=0,t=s}}g=k||!g?E:g;const P=c+g;this.nextVideoTs=u=P-d,this.videoSampleDuration=g,this.isVideoContiguous=!0;const M={data1:Pg.moof(t.sequenceNumber++,h,ad(t,{samples:a})),data2:L,startPTS:(m-d)/r,endPTS:(p+g-d)/r,startDTS:(h-d)/r,endDTS:u/r,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:t.dropped};return t.samples=[],t.dropped=0,M}getSamplesPerFrame(t){switch(t.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(t,e,i,s,r){const n=t.inputTimeScale,a=n/(t.samplerate?t.samplerate:n),o=this.getSamplesPerFrame(t),l=o*a,d=this._initPTS,h="mp3"===t.segmentCodec&&this.typeSupported.mpeg,c=[],u=void 0!==r;let f=t.samples,g=h?0:8,m=this.nextAudioTs||-1;const p=d.baseTime*n/d.timescale,A=p+e*n;if(this.isAudioContiguous=i=i||f.length&&m>0&&(s&&Math.abs(A-(m+p))<9e3||Math.abs(jg(f[0].pts,A)-(m+p))<20*l),f.forEach(function(t){t.pts=jg(t.pts,A)}),!i||m<0){const t=f.length;if(f=f.filter(t=>t.pts>=0),t!==f.length&&this.warn(`Removed ${f.length-t} of ${t} samples (initPTS ${p} / ${n})`),!f.length)return;m=0===r?0:s&&!u?Math.max(0,A-p):f[0].pts-p}if("aac"===t.segmentCodec){const e=this.config.maxAudioFramesDrift;for(let i=0,s=m+p;i<f.length;i++){const r=f[i],a=r.pts,o=a-s,d=Math.abs(1e3*o/n);if(o<=-e*l&&u)0===i&&(this.warn(`Audio frame @ ${(a/n).toFixed(3)}s overlaps marker by ${Math.round(1e3*o/n)} ms.`),this.nextAudioTs=m=a-p,s=a);else if(o>=e*l&&d<1e4&&u){let e=Math.round(o/l);for(s=a-e*l;s<0&&e&&l;)e--,s+=l;0===i&&(this.nextAudioTs=m=s-p),this.warn(`Injecting ${e} audio frames @ ${((s-p)/n).toFixed(3)}s due to ${Math.round(1e3*o/n)} ms gap.`);for(let n=0;n<e;n++){let e=Cg.getSilentFrame(t.parsedCodec||t.manifestCodec||t.codec,t.channelCount);e||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),e=r.unit.subarray()),f.splice(i,0,{unit:e,pts:s}),s+=l,i++}}r.pts=s,s+=l}}let v,y=null,E=null,T=0,S=f.length;for(;S--;)T+=f[S].unit.byteLength;for(let C=0,x=f.length;C<x;C++){const e=f[C],s=e.unit;let r=e.pts;if(null!==E){c[C-1].duration=Math.round((r-E)/a)}else{if(i&&"aac"===t.segmentCodec&&(r=m+p),y=r,!(T>0))return;T+=g;try{v=new Uint8Array(T)}catch(D){return void this.observer.emit($l.ERROR,$l.ERROR,{type:Wl.MUX_ERROR,details:Yl.REMUX_ALLOC_ERROR,fatal:!1,error:D,bytes:T,reason:`fail allocating audio mdat ${T}`})}if(!h){new DataView(v.buffer).setUint32(0,T),v.set(Pg.types.mdat,4)}}v.set(s,g);const n=s.byteLength;g+=n,c.push(Ug(!0,o,n,0)),E=r}const b=c.length;if(!b)return;const I=c[c.length-1];m=E-p,this.nextAudioTs=m+a*I.duration;const L=h?new Uint8Array(0):Pg.moof(t.sequenceNumber++,y/a,ad({},t,{samples:c}));t.samples=[];const R=(y-p)/n,k=this.nextAudioTs/n,w={data1:L,data2:v,startPTS:R,endPTS:k,startDTS:R,endDTS:k,type:"audio",hasAudio:!0,hasVideo:!1,nb:b};return this.isAudioContiguous=!0,w}}function jg(t,e){let i;if(null===e)return t;for(i=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=i;return t}function Vg(t,e,i,s){const r=t.samples.length;if(!r)return;const n=t.inputTimeScale;for(let o=0;o<r;o++){const r=t.samples[o];r.pts=jg(r.pts-i.baseTime*n/i.timescale,e*n)/n,r.dts=jg(r.dts-s.baseTime*n/s.timescale,e*n)/n}const a=t.samples;return t.samples=[],{samples:a}}function Gg(t,e,i){const s=t.samples.length;if(!s)return;const r=t.inputTimeScale;for(let a=0;a<s;a++){const s=t.samples[a];s.pts=jg(s.pts-i.baseTime*r/i.timescale,e*r)/r}t.samples.sort((t,e)=>t.pts-e.pts);const n=t.samples;return t.samples=[],{samples:n}}function Qg(t,e,i=!1){return void 0!==(null==t?void 0:t.start)?(t.start+(i?t.duration:0))/t.timescale:e}function Kg(t,e,i){const s=t.codec;if(s&&s.length>4)return s;if(e===xd){if("ec-3"===s||"ac-3"===s||"alac"===s)return s;if("fLaC"===s||"Opus"===s){return Th(s,!1)}return i.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||"mp4a"}return i.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||"avc1"}try{Fg=self.performance.now.bind(self.performance)}catch(PE){Fg=Date.now}const qg=[{demux:class{constructor(t,e){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=e}resetTimeStamp(){}resetInitSegment(t,e,i,s){const r=this.videoTrack=Jf("video",1),n=this.audioTrack=Jf("audio",1),a=this.txtTrack=Jf("text",1);if(this.id3Track=Jf("id3",1),this.timeOffset=0,null==t||!t.byteLength)return;const o=$d(t);if(o.video){const{id:t,timescale:e,codec:i,supplemental:s}=o.video;r.id=t,r.timescale=a.timescale=e,r.codec=i,r.supplemental=s}if(o.audio){const{id:t,timescale:e,codec:i}=o.audio;n.id=t,n.timescale=e,n.codec=i}a.id=jd.text,r.sampleDuration=0,r.duration=n.duration=s}resetContiguity(){this.remainderData=null}static probe(t){return function(t){const e=t.byteLength;for(let i=0;i<e;){const s=Qd(t,i);if(s>8&&109===t[i+4]&&111===t[i+5]&&111===t[i+6]&&102===t[i+7])return!0;i=s>1?i+s:e}return!1}(t)}demux(t,e){this.timeOffset=e;let i=t;const s=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=sh(this.remainderData,t));const e=function(t){const e={valid:null,remainder:null},i=Wd(t,["moof"]);if(i.length<2)return e.remainder=t,e;const s=i[i.length-1];return e.valid=t.slice(0,s.byteOffset-8),e.remainder=t.slice(s.byteOffset-8),e}(i);this.remainderData=e.remainder,s.samples=e.valid||new Uint8Array}else s.samples=i;const n=this.extractID3Track(s,e);return r.samples=rh(e,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:n,textTrack:this.txtTrack}}flush(){const t=this.timeOffset,e=this.videoTrack,i=this.txtTrack;e.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(e,this.timeOffset);return i.samples=rh(t,e),{videoTrack:e,audioTrack:Jf(),id3Track:s,textTrack:Jf()}}extractID3Track(t,e){const i=this.id3Track;if(t.samples.length){const s=Wd(t.samples,["emsg"]);s&&s.forEach(t=>{const s=function(t){const e=t[0];let i="",s="",r=0,n=0,a=0,o=0,l=0,d=0;if(0===e){for(;"\0"!==Vd(t.subarray(d,d+1));)i+=Vd(t.subarray(d,d+1)),d+=1;for(i+=Vd(t.subarray(d,d+1)),d+=1;"\0"!==Vd(t.subarray(d,d+1));)s+=Vd(t.subarray(d,d+1)),d+=1;s+=Vd(t.subarray(d,d+1)),d+=1,r=Qd(t,12),n=Qd(t,16),o=Qd(t,20),l=Qd(t,24),d=28}else if(1===e){d+=4,r=Qd(t,d),d+=4;const e=Qd(t,d);d+=4;const n=Qd(t,d);for(d+=4,a=2**32*e+n,Kl(a)||(a=Number.MAX_SAFE_INTEGER,md.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Qd(t,d),d+=4,l=Qd(t,d),d+=4;"\0"!==Vd(t.subarray(d,d+1));)i+=Vd(t.subarray(d,d+1)),d+=1;for(i+=Vd(t.subarray(d,d+1)),d+=1;"\0"!==Vd(t.subarray(d,d+1));)s+=Vd(t.subarray(d,d+1)),d+=1;s+=Vd(t.subarray(d,d+1)),d+=1}return{schemeIdUri:i,value:s,timeScale:r,presentationTime:a,presentationTimeDelta:n,eventDuration:o,id:l,payload:t.subarray(d,t.byteLength)}}(t);if(mg.test(s.schemeIdUri)){const t=pg(s,e);let r=4294967295===s.eventDuration?Number.POSITIVE_INFINITY:s.eventDuration/s.timeScale;r<=.001&&(r=Number.POSITIVE_INFINITY);const n=s.payload;i.samples.push({data:n,len:n.byteLength,dts:t,pts:t,type:Zf.emsg,duration:r})}else if(this.config.enableEmsgKLVMetadata&&s.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const t=pg(s,e);i.samples.push({data:s.payload,len:s.payload.byteLength,dts:t,pts:t,type:Zf.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(t,e,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}},remux:class extends dd{constructor(t,e,i,s){super("passthrough-remuxer",s),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(t){this.lastEndTime=null;const e=this.initPTS;e&&t&&e.baseTime===t.baseTime&&e.timescale===t.timescale||(this.initPTS=t)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(t,e,i,s){this.audioCodec=e,this.videoCodec=i,this.generateInitSegment(t,s),this.emitInitSegment=!0}generateInitSegment(t,e){let{audioCodec:i,videoCodec:s}=this;if(null==t||!t.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const{audio:r,video:n}=this.initData=$d(t);if(e)!function(t,e){if(!t||!e)return;const i=e.keyId;i&&e.isCommonEncryption&&eh(t,(t,e)=>{const s=t.subarray(8,24);s.some(t=>0!==t)||(md.log(`[eme] Patching keyId in 'enc${e?"a":"v"}>sinf>>tenc' box: ${yd(s)} -> ${yd(i)}`),t.set(i,8))})}(t,e);else{const t=r||n;null!=t&&t.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${t.codec}")!`)}r&&(i=Kg(r,xd,this)),n&&(s=Kg(n,Pd,this));const a={};r&&n?a.audiovideo={container:"video/mp4",codec:i+","+s,supplemental:n.supplemental,encrypted:n.encrypted,initSegment:t,id:"main"}:r?a.audio={container:"audio/mp4",codec:i,encrypted:r.encrypted,initSegment:t,id:"audio"}:n?a.video={container:"video/mp4",codec:s,supplemental:n.supplemental,encrypted:n.encrypted,initSegment:t,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=a}remux(t,e,i,s,r,n){var a,o;let{initPTS:l,lastEndTime:d}=this;const h={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};Ql(d)||(d=this.lastEndTime=r||0);const c=e.samples;if(!c.length)return h;const u={initPTS:void 0,timescale:void 0,trackId:void 0};let f=this.initData;if(null!=(a=f)&&a.length||(this.generateInitSegment(c),f=this.initData),null==(o=f)||!o.length)return this.warn("Failed to generate initSegment."),h;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1);const g=function(t,e,i){const s={},r=Wd(t,["moof","traf"]);for(let n=0;n<r.length;n++){const t=r[n],a=Wd(t,["tfhd"])[0],o=Qd(a,4),l=e[o];if(!l)continue;s[o]||(s[o]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type});const d=s[o],h=Wd(t,["tfdt"])[0];if(h){const t=h[0];let e=Qd(h,4);1===t&&(e===Ud?i.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(e*=Ud+1,e+=Qd(h,8))),Ql(e)&&(!Ql(d.start)||e<d.start)&&(d.start=e)}const c=l.default,u=Qd(a,0)|(null==c?void 0:c.flags);let f=(null==c?void 0:c.duration)||0;8&u&&(f=Qd(a,2&u?12:8));const g=Wd(t,["trun"]);let m=d.start||0,p=0,A=f;for(let e=0;e<g.length;e++){const t=g[e],i=Qd(t,4),s=d.sampleCount;d.sampleCount+=i;const r=1&t[3],n=4&t[3],a=1&t[2],o=2&t[2],l=4&t[2],h=8&t[2];let c=8,u=i;for(r&&(c+=4),n&&i&&(1&t[c+1]||void 0!==d.keyFrameIndex||(d.keyFrameIndex=s),c+=4,a?(A=Qd(t,c),c+=4):A=f,o&&(c+=4),h&&(c+=4),m+=A,p+=A,u--);u--;)a?(A=Qd(t,c),c+=4):A=f,o&&(c+=4),l&&(1&t[c+1]||void 0===d.keyFrameIndex&&(d.keyFrameIndex=d.sampleCount-(u+1),d.keyFrameStart=m),c+=4),h&&(c+=4),m+=A,p+=A;!p&&f&&(p+=f*i)}d.duration+=p}if(!Object.keys(s).some(t=>s[t].duration)){let e=1/0,i=0;const r=Wd(t,["sidx"]);for(let t=0;t<r.length;t++){const s=Yd(r[t]);if(null!=s&&s.references){e=Math.min(e,s.earliestPresentationTime/s.timescale);const t=s.references.reduce((t,e)=>t+e.info.duration||0,0);i=Math.max(i,t+s.earliestPresentationTime/s.timescale)}}i&&Ql(i)&&Object.keys(s).forEach(t=>{s[t].duration||(s[t].duration=i*s[t].timescale-s[t].start)})}return s}(c,f,this),m=f.audio?g[f.audio.id]:null,p=f.video?g[f.video.id]:null,A=Qg(p,1/0),v=Qg(m,1/0),y=Qg(p,0,!0),E=Qg(m,0,!0);let T=r,S=0;const b=m&&(!p||!l&&v<A||l&&l.trackId===f.audio.id),I=b?m:p;if(I){const t=I.timescale,e=I.start-r*t,i=b?f.audio.id:f.video.id;T=I.start/t,S=b?E-v:y-A,!n&&l||!function(t,e,i,s){if(null===t)return!0;const r=Math.max(s,1),n=e-t.baseTime/t.timescale;return Math.abs(n-i)>r}(l,T,r,S)&&t===l.timescale||(l&&this.warn(`Timestamps at playlist time: ${n?"":"~"}${r} ${e/t} != initPTS: ${l.baseTime/l.timescale} (${l.baseTime}/${l.timescale}) trackId: ${l.trackId}`),this.log(`Found initPTS at playlist time: ${r} offset: ${T-r} (${e}/${t}) trackId: ${i}`),l=null,u.initPTS=e,u.timescale=t,u.trackId=i)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${r}`);l?(u.initPTS=l.baseTime,u.timescale=l.timescale,u.trackId=l.trackId):(u.timescale&&void 0!==u.trackId&&void 0!==u.initPTS||(this.warn("Could not set initPTS"),u.initPTS=T,u.timescale=1,u.trackId=-1),this.initPTS=l={baseTime:u.initPTS,timescale:u.timescale,trackId:u.trackId});const L=T-l.baseTime/l.timescale,R=L+S;S>0?this.lastEndTime=R:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const k=!!f.audio,w=!!f.video;let D="";k&&(D+="audio"),w&&(D+="video");const C={data1:c,startPTS:L,startDTS:L,endPTS:R,endDTS:R,type:D,hasAudio:k,hasVideo:w,nb:1,dropped:0,encrypted:!!f.audio&&f.audio.encrypted||!!f.video&&f.video.encrypted};h.audio=k&&!w?C:void 0,h.video=w?C:void 0;const x=null==p?void 0:p.sampleCount;if(x){const t=p.keyFrameIndex,e=-1!==t;C.nb=x,C.dropped=0===t||this.isVideoContiguous?0:e?t:x,C.independent=e,C.firstKeyFrame=t,e&&p.keyFrameStart&&(C.firstKeyFramePTS=(p.keyFrameStart-l.baseTime)/l.timescale),this.isVideoContiguous||(h.independent=e),this.isVideoContiguous||(this.isVideoContiguous=e),C.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${t}/${x} dropped: ${C.dropped} start: ${C.firstKeyFramePTS||"NA"}`)}return h.initSegment=u,h.id3=Vg(i,r,l,l),s.samples.length&&(h.text=Gg(s,r,l)),h}}},{demux:bg,remux:Hg},{demux:class extends tg{constructor(t,e){super(),this.observer=void 0,this.config=void 0,this.observer=t,this.config=e}resetInitSegment(t,e,i,s){super.resetInitSegment(t,e,i,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:e,duration:s,inputTimeScale:9e4,dropped:0}}static probe(t,e){if(!t)return!1;const i=Of(t,0);let s=(null==i?void 0:i.length)||0;if(cg(t,s))return!1;for(let r=t.length;s<r;s++)if(Uf(t,s))return e.log("ADTS sync word found !"),!0;return!1}canParse(t,e){return function(t,e){return function(t,e){return e+5<t.length}(t,e)&&Bf(t,e)&&Nf(t,e)<=t.length-e}(t,e)}appendFrame(t,e,i){Hf(t,this.observer,e,i,t.manifestCodec);const s=Vf(t,e,i,this.basePTS,this.frameIndex);if(s&&0===s.missing)return s}},remux:Hg},{demux:class extends tg{resetInitSegment(t,e,i,s){super.resetInitSegment(t,e,i,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:e,duration:s,inputTimeScale:9e4,dropped:0}}static probe(t){if(!t)return!1;const e=Of(t,0);let i=(null==e?void 0:e.length)||0;if(e&&11===t[i]&&119===t[i+1]&&void 0!==Xf(e)&&ug(t,i)<=16)return!1;for(let s=t.length;i<s;i++)if(cg(t,i))return md.log("MPEG Audio sync word found !"),!0;return!1}canParse(t,e){return function(t,e){return dg(t,e)&&4<=t.length-e}(t,e)}appendFrame(t,e,i){if(null!==this.basePTS)return og(t,e,i,this.basePTS,this.frameIndex)}},remux:Hg}];qg.splice(2,0,{demux:fg,remux:Hg});class Wg{constructor(t,e,i,s,r,n){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=t,this.typeSupported=e,this.config=i,this.id=r,this.logger=n}configure(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()}push(t,e,i,s){const r=i.transmuxing;r.executeStart=Fg();let n=new Uint8Array(t);const{currentTransmuxState:a,transmuxConfig:o}=this;s&&(this.currentTransmuxState=s);const{contiguous:l,discontinuity:d,trackSwitch:h,accurateTimeOffset:c,timeOffset:u,initSegmentChange:f}=s||a,{audioCodec:g,videoCodec:m,defaultInitPts:p,duration:A,initSegmentData:v}=o,y=function(t,e){let i=null;t.byteLength>0&&null!=(null==e?void 0:e.key)&&null!==e.iv&&null!=e.method&&(i=e);return i}(n,e);if(y&&ru(y.method)){const t=this.getDecrypter(),e=nu(y.method);if(!t.isSync())return this.asyncResult=!0,this.decryptionPromise=t.webCryptoDecrypt(n,y.key.buffer,y.iv.buffer,e).then(t=>{const e=this.push(t,null,i);return this.decryptionPromise=null,e}),this.decryptionPromise;{let s=t.softwareDecrypt(n,y.key.buffer,y.iv.buffer,e);if(i.part>-1){const e=t.flush();s=e?e.buffer:e}if(!s)return r.executeEnd=Fg(),Yg(i);n=new Uint8Array(s)}}const E=this.needsProbing(d,h);if(E){const t=this.configureTransmuxer(n);if(t)return this.logger.warn(`[transmuxer] ${t.message}`),this.observer.emit($l.ERROR,$l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.FRAG_PARSING_ERROR,fatal:!1,error:t,reason:t.message}),r.executeEnd=Fg(),Yg(i)}(d||h||f||E)&&this.resetInitSegment(v,g,m,A,e),(d||f||E)&&this.resetInitialTimestamp(p),l||this.resetContiguity();const T=this.transmux(n,y,u,c,i);this.asyncResult=$g(T);const S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,r.executeEnd=Fg(),T}flush(t){const e=t.transmuxing;e.executeStart=Fg();const{decrypter:i,currentTransmuxState:s,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then(()=>this.flush(t));const n=[],{timeOffset:a}=s;if(i){const e=i.flush();e&&n.push(this.push(e.buffer,null,t))}const{demuxer:o,remuxer:l}=this;if(!o||!l){e.executeEnd=Fg();const i=[Yg(t)];return this.asyncResult?Promise.resolve(i):i}const d=o.flush(a);return $g(d)?(this.asyncResult=!0,d.then(e=>(this.flushRemux(n,e,t),n))):(this.flushRemux(n,d,t),this.asyncResult?Promise.resolve(n):n)}flushRemux(t,e,i){const{audioTrack:s,videoTrack:r,id3Track:n,textTrack:a}=e,{accurateTimeOffset:o,timeOffset:l}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===td?"level":"track"} ${i.level}`);const d=this.remuxer.remux(s,r,n,a,l,o,!0,this.id);t.push({remuxResult:d,chunkMeta:i}),i.transmuxing.executeEnd=Fg()}resetInitialTimestamp(t){const{demuxer:e,remuxer:i}=this;e&&i&&(e.resetTimeStamp(t),i.resetTimeStamp(t))}resetContiguity(){const{demuxer:t,remuxer:e}=this;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())}resetInitSegment(t,e,i,s,r){const{demuxer:n,remuxer:a}=this;n&&a&&(n.resetInitSegment(t,e,i,s),a.resetInitSegment(t,e,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(t,e,i,s,r){let n;return n=e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,i,s,r):this.transmuxUnencrypted(t,i,s,r),n}transmuxUnencrypted(t,e,i,s){const{audioTrack:r,videoTrack:n,id3Track:a,textTrack:o}=this.demuxer.demux(t,e,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,n,a,o,e,i,!1,this.id),chunkMeta:s}}transmuxSampleAes(t,e,i,s,r){return this.demuxer.demuxSampleAes(t,e,i).then(t=>({remuxResult:this.remuxer.remux(t.audioTrack,t.videoTrack,t.id3Track,t.textTrack,i,s,!1,this.id),chunkMeta:r}))}configureTransmuxer(t){const{config:e,observer:i,typeSupported:s}=this;let r;for(let h=0,c=qg.length;h<c;h++){var n;if(null!=(n=qg[h].demux)&&n.probe(t,this.logger)){r=qg[h];break}}if(!r)return new Error("Failed to find demuxer by probing fragment data");const a=this.demuxer,o=this.remuxer,l=r.remux,d=r.demux;o&&o instanceof l||(this.remuxer=new l(i,e,s,this.logger)),a&&a instanceof d||(this.demuxer=new d(i,e,s,this.logger),this.probe=d.probe)}needsProbing(t,e){return!this.demuxer||!this.remuxer||t||e}getDecrypter(){let t=this.decrypter;return t||(t=this.decrypter=new Oc(this.config)),t}}const Yg=t=>({remuxResult:{},chunkMeta:t});function $g(t){return"then"in t&&t.then instanceof Function}class zg{constructor(t,e,i,s,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=e,this.initSegmentData=i,this.duration=s,this.defaultInitPts=r||null}}class Xg{constructor(t,e,i,s,r,n){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=t,this.contiguous=e,this.accurateTimeOffset=i,this.trackSwitch=s,this.timeOffset=r,this.initSegmentChange=n}}let Zg=0;class Jg{constructor(t,e,i,s){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Zg++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=t=>{const e=t.data,i=this.hls;if(i&&null!=e&&e.event&&e.instanceNo===this.instanceNo)switch(e.event){case"init":{var s;const t=null==(s=this.workerContext)?void 0:s.objectURL;t&&self.URL.revokeObjectURL(t);break}case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;case"workerLog":i.logger[e.data.logType]&&i.logger[e.data.logType](e.data.message);break;default:e.data=e.data||{},e.data.frag=this.frag,e.data.part=this.part,e.data.id=this.id,i.trigger(e.event,e.data)}},this.onWorkerError=t=>{if(!this.hls)return;const e=new Error(`${t.message} (${t.filename}:${t.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger($l.ERROR,{type:Wl.OTHER_ERROR,details:Yl.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:e})};const r=t.config;this.hls=t,this.id=e,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=i,this.onFlush=s;const n=(t,e)=>{(e=e||{}).frag=this.frag||void 0,t===$l.ERROR&&(e.parent=this.id,e.part=this.part,this.error=e.error),this.hls.trigger(t,e)};this.observer=new wf,this.observer.on($l.FRAG_DECRYPTED,n),this.observer.on($l.ERROR,n);const a=Lh(r.preferManagedMediaSource);if(this.useWorker&&"undefined"!=typeof Worker){const i=this.hls.logger;if(r.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{r.workerPath?(i.log(`loading Web Worker ${r.workerPath} for "${e}"`),this.workerContext=function(t){const e=Cf[t];if(e)return e.clientCount++,e;const i=new self.URL(t,self.location.href).href,s={worker:new self.Worker(i),scriptURL:i,clientCount:1};return Cf[t]=s,s}(r.workerPath)):(i.log(`injecting Web Worker for "${e}"`),this.workerContext=function(){const t=Cf[Df];if(t)return t.clientCount++,t;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),i=self.URL.createObjectURL(e),s={worker:new self.Worker(i),objectURL:i,clientCount:1};return Cf[Df]=s,s}());const{worker:t}=this.workerContext;t.addEventListener("message",this.onWorkerMessage),t.addEventListener("error",this.onWorkerError),t.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:a,id:e,config:Qh(r)})}catch(PE){i.warn(`Error setting up "${e}" Web Worker, fallback to inline`,PE),this.terminateWorker(),this.error=null,this.transmuxer=new Wg(this.observer,a,r,"",e,t.logger)}return}}this.transmuxer=new Wg(this.observer,a,r,"",e,t.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const t=this.instanceNo;this.instanceNo=Zg++;const e=this.hls.config,i=Lh(e.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:t,typeSupported:i,id:this.id,config:Qh(e)})}}terminateWorker(){if(this.workerContext){const{worker:t}=this.workerContext;this.workerContext=null,t.removeEventListener("message",this.onWorkerMessage),t.removeEventListener("error",this.onWorkerError),function(t){const e=Cf[t||Df];if(e&&1===e.clientCount--){const{worker:i,objectURL:s}=e;delete Cf[t||Df],s&&self.URL.revokeObjectURL(s),i.terminate()}}(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(t,e,i,s,r,n,a,o,l,d){var h,c;l.transmuxing.start=self.performance.now();const{instanceNo:u,transmuxer:f}=this,g=n?n.start:r.start,m=r.decryptdata,p=this.frag,A=!(p&&r.cc===p.cc),v=!(p&&l.level===p.level),y=p?l.sn-p.sn:-1,E=this.part?l.part-this.part.index:-1,T=0===y&&l.id>1&&l.id===(null==p?void 0:p.stats.chunkCount),S=!v&&(1===y||0===y&&(1===E||T&&E<=0)),b=self.performance.now();(v||y||0===r.stats.parsing.start)&&(r.stats.parsing.start=b),!n||!E&&S||(n.stats.parsing.start=b);const I=!(p&&(null==(h=r.initSegment)?void 0:h.url)===(null==(c=p.initSegment)?void 0:c.url)),L=new Xg(A,S,o,v,g,I);if(!S||A||I){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${l.sn}${l.part>-1?" part: "+l.part:""} ${this.id===td?"level":"track"}: ${l.level} id: ${l.id}\n discontinuity: ${A}\n trackSwitch: ${v}\n contiguous: ${S}\n accurateTimeOffset: ${o}\n timeOffset: ${g}\n initSegmentChange: ${I}`);const t=new zg(i,s,e,a,d);this.configureTransmuxer(t)}if(this.frag=r,this.part=n,this.workerContext)this.workerContext.worker.postMessage({instanceNo:u,cmd:"demux",data:t,decryptdata:m,chunkMeta:l,state:L},t instanceof ArrayBuffer?[t]:[]);else if(f){const e=f.push(t,m,l,L);$g(e)?e.then(t=>{this.handleTransmuxComplete(t)}).catch(t=>{this.transmuxerError(t,l,"transmuxer-interface push error")}):this.handleTransmuxComplete(e)}}flush(t){t.transmuxing.start=self.performance.now();const{instanceNo:e,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:e,cmd:"flush",chunkMeta:t});else if(i){const e=i.flush(t);$g(e)?e.then(e=>{this.handleFlushResult(e,t)}).catch(e=>{this.transmuxerError(e,t,"transmuxer-interface flush error")}):this.handleFlushResult(e,t)}}transmuxerError(t,e,i){this.hls&&(this.error=t,this.hls.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.FRAG_PARSING_ERROR,chunkMeta:e,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:t,err:t,reason:i}))}handleFlushResult(t,e){t.forEach(t=>{this.handleTransmuxComplete(t)}),this.onFlush(e)}configureTransmuxer(t){const{instanceNo:e,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:e,cmd:"configure",config:t}):i&&i.configure(t)}handleTransmuxComplete(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)}}class tm extends dd{constructor(t,e){super(e,t.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=t}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(t,e,i){const s=null==e?void 0:e.renditionReports;if(s){let n=-1;for(let i=0;i<s.length;i++){const a=s[i];let o;try{o=new self.URL(a.URI,e.url).href}catch(r){this.warn(`Could not construct new URL for Rendition Report: ${r}`),o=a.URI||""}if(o===t){n=i;break}o===t.substring(0,o.length)&&(n=i)}if(-1!==n){const t=s[n],r=parseInt(t["LAST-MSN"])||e.lastPartSn;let a=parseInt(t["LAST-PART"])||e.lastPartIndex;if(this.hls.config.lowLatencyMode){const t=Math.min(e.age-e.partTarget,e.targetduration);a>=0&&t>e.partTarget&&(a+=1)}const o=i&&Uh(i);return new Hh(r,a>=0?a:void 0,o)}}}loadPlaylist(t){this.clearTimer()}loadingPlaylist(t,e){this.clearTimer()}shouldLoadPlaylist(t){return this.canLoad&&!!t&&!!t.url&&(!t.details||t.details.live)}getUrlWithDirectives(t,e){if(e)try{return e.addDirectives(t)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return t}playlistLoaded(t,e,i){const{details:s,stats:r}=e,n=self.performance.now(),a=r.loading.first?Math.max(0,n-r.loading.first):0;s.advancedDateTime=Date.now()-a;const o=this.hls.config.timelineOffset;if(o!==s.appliedTimelineOffset){const t=Math.max(o||0,0);s.appliedTimelineOffset=t,s.fragments.forEach(e=>{e.setStart(e.playlistOffset+t)})}if(s.live||null!=i&&i.live){const o="levelInfo"in e?e.levelInfo:e.track;if(s.reloaded(i),i&&s.fragments.length>0){Qu(i,s,this);const t=s.playlistParsingError;if(t){this.warn(t);const i=this.hls;if(!i.config.ignorePlaylistParsingErrors){var l;const{networkDetails:n}=e;return void i.trigger($l.ERROR,{type:Wl.NETWORK_ERROR,details:Yl.LEVEL_PARSING_ERROR,fatal:!1,url:s.url,error:t,reason:t.message,level:e.level||void 0,parent:null==(l=s.fragments[0])?void 0:l.type,networkDetails:n,stats:r})}s.playlistParsingError=null}}-1===s.requestScheduled&&(s.requestScheduled=r.loading.start);const d=this.hls.mainForwardBufferInfo,h=d?d.end-d.len:0,c=Yu(s,1e3*(s.edge-h));if(s.requestScheduled+c<n?s.requestScheduled=n:s.requestScheduled+=c,this.log(`live playlist ${t} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),!this.canLoad||!s.live)return;let u,f,g;if(s.canBlockReload&&s.endSN&&s.advanced){const t=this.hls.config.lowLatencyMode,r=s.lastPartSn,a=s.endSN,l=s.lastPartIndex,d=r===a;-1!==l?d?(f=a+1,g=t?0:l):(f=r,g=t?l+1:s.maxPartIndex):f=a+1;const h=s.age,c=h+s.ageHeader;let m=Math.min(c-s.partTarget,1.5*s.targetduration);if(m>0){if(c>3*s.targetduration)this.log(`Playlist last advanced ${h.toFixed(2)}s ago. Omitting segment and part directives.`),f=void 0,g=void 0;else if(null!=i&&i.tuneInGoal&&c-s.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${m} with playlist age: ${s.age}`),m=0;else{const t=Math.floor(m/s.targetduration);if(f+=t,void 0!==g){g+=Math.round(m%s.targetduration/s.partTarget)}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${h.toFixed(2)}s goal: ${m} skip sn ${t} to part ${g}`)}s.tuneInGoal=m}if(u=this.getDeliveryDirectives(s,e.deliveryDirectives,f,g),t||!d)return s.requestScheduled=n,void this.loadingPlaylist(o,u)}else(s.canBlockReload||s.canSkipUntil)&&(u=this.getDeliveryDirectives(s,e.deliveryDirectives,f,g));u&&void 0!==f&&s.canBlockReload&&(s.requestScheduled=r.loading.first+Math.max(c-2*a,c/2)),this.scheduleLoading(o,u,s)}else this.clearTimer()}scheduleLoading(t,e,i){const s=i||t.details;if(!s)return void this.loadingPlaylist(t,e);const r=self.performance.now(),n=s.requestScheduled;if(r>=n)return void this.loadingPlaylist(t,e);const a=n-r;this.log(`reload live playlist ${t.name||t.bitrate+"bps"} in ${Math.round(a)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(t,e),a)}getDeliveryDirectives(t,e,i,s){let r=Uh(t);return null!=e&&e.skip&&t.deltaUpdateFailed&&(i=e.msn,s=e.part,r=Fh),new Hh(i,s,r)}checkRetry(t){const e=t.details,i=rc(t),s=t.errorAction,{action:r,retryCount:n=0,retryConfig:a}=s||{},o=!!s&&!!a&&(r===mc||!s.resolved&&r===fc);if(o){var l;if(n>=a.maxNumRetry)return!1;if(i&&null!=(l=t.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${n+1}/${a.maxNumRetry} after "${e}" without delivery-directives`),this.loadPlaylist();else{const t=lc(a,n);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),t),this.warn(`Retrying playlist loading ${n+1}/${a.maxNumRetry} after "${e}" in ${t}ms`)}t.levelRetry=!0,s.resolved=!0}return o}}function em(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!im(t[i].attrs,e[i].attrs))return!1;return!0}function im(t,e,i){const s=t["STABLE-RENDITION-ID"];return s&&!i?s===e["STABLE-RENDITION-ID"]:!(i||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>t[i]!==e[i])}function sm(t,e){return e.label.toLowerCase()===t.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(t.lang||"").toLowerCase())}class rm{constructor(t){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=t}destroy(){this.tracks=this.queues=null}append(t,e,i){if(null===this.queues||null===this.tracks)return;const s=this.queues[e];s.push(t),1!==s.length||i||this.executeNext(e)}appendBlocker(t){return new Promise(e=>{const i={label:"async-blocker",execute:e,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,t)})}prependBlocker(t){return new Promise(e=>{if(this.queues){const i={label:"async-blocker-prepend",execute:e,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[t].unshift(i)}})}removeBlockers(){null!==this.queues&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(t=>{var e;const i=null==(e=t[0])?void 0:e.label;"async-blocker"!==i&&"async-blocker-prepend"!==i||(t[0].execute(),t.splice(0,1))})}unblockAudio(t){if(null===this.queues)return;this.queues.audio[0]===t&&this.shiftAndExecuteNext("audio")}executeNext(t){if(null===this.queues||null===this.tracks)return;const e=this.queues[t];if(e.length){const r=e[0];try{r.execute()}catch(s){var i;if(r.onError(s),null===this.queues||null===this.tracks)return;const e=null==(i=this.tracks[t])?void 0:i.buffer;null!=e&&e.updating||this.shiftAndExecuteNext(t)}}}shiftAndExecuteNext(t){null!==this.queues&&(this.queues[t].shift(),this.executeNext(t))}current(t){var e;return(null==(e=this.queues)?void 0:e[t][0])||null}toString(){const{queues:t,tracks:e}=this;return null===t||null===e?"<destroyed>":`\n${this.list("video")}\n${this.list("audio")}\n${this.list("audiovideo")}}`}list(t){var e,i;return null!=(e=this.queues)&&e[t]||null!=(i=this.tracks)&&i[t]?`${t}: (${this.listSbInfo(t)}) ${this.listOps(t)}`:""}listSbInfo(t){var e;const i=null==(e=this.tracks)?void 0:e[t],s=null==i?void 0:i.buffer;return s?`SourceBuffer${s.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(t){var e;return(null==(e=this.queues)?void 0:e[t].map(t=>t.label).join(", "))||""}}const nm=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,am="HlsJsTrackRemovedError";class om extends Error{constructor(t){super(t),this.name=am}}function lm(t){const e=t.querySelectorAll("source");[].slice.call(e).forEach(e=>{t.removeChild(e)})}function dm(t){return"audio"===t?1:0}class hm{constructor(t){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(t){this.streamController=t}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:t}=this;t.on($l.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on($l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on($l.MANIFEST_PARSED,this.onManifestParsed,this),t.on($l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on($l.BUFFER_CODECS,this.onBufferCodecs,this),t.on($l.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:t}=this;t.off($l.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off($l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off($l.MANIFEST_PARSED,this.onManifestParsed,this),t.off($l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off($l.BUFFER_CODECS,this.onBufferCodecs,this),t.off($l.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(t,e){const i=this.hls.levels[e.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(t,e){const i=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,i.config.capLevelToPlayerSize&&e.video&&this.startCapping()}onLevelsUpdated(t,e){this.timer&&Ql(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const t=this.hls.levels;if(t.length){const e=this.hls,i=this.getMaxLevel(t.length-1);i!==this.autoLevelCapping&&e.logger.log(`Setting autoLevelCapping to ${i}: ${t[i].height}p@${t[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),e.autoLevelCapping=i,e.autoLevelEnabled&&e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}}getMaxLevel(t){const e=this.hls.levels;if(!e.length)return-1;const i=e.filter((e,i)=>this.isLevelAllowed(e)&&i<=t);return this.clientRect=null,hm.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const t=this.media,e={width:0,height:0};if(t){const i=t.getBoundingClientRect();e.width=i.width,e.height=i.height,e.width||e.height||(e.width=i.right-i.left||t.width||0,e.height=i.bottom-i.top||t.height||0)}return this.clientRect=e,e}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch(e){}return Math.min(t,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(t){return!this.restrictedLevels.some(e=>t.bitrate===e.bitrate&&t.width===e.width&&t.height===e.height)}static getMaxLevelByMediaSize(t,e,i){if(null==t||!t.length)return-1;const s=(t,e)=>!e||(t.width!==e.width||t.height!==e.height);let r=t.length-1;const n=Math.max(e,i);for(let a=0;a<t.length;a+=1){const e=t[a];if((e.width>=n||e.height>=n)&&s(e,t[a+1])){r=a;break}}return r}}const cm={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},um={HLS:"h"};class fm{constructor(t,e){Array.isArray(t)&&(t=t.map(t=>t instanceof fm?t:new fm(t))),this.value=t,this.params=e}}function gm(t,e,i,s){return new Error(`failed to ${t} "${r=e,Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":"object"==typeof r?JSON.stringify(r):String(r)}" as ${i}`,{cause:s});var r}function mm(t,e,i){return gm("serialize",t,e,i)}class pm{constructor(t){this.description=t}}const Am="Bare Item";function vm(t){if(!1===ArrayBuffer.isView(t))throw mm(t,"Byte Sequence");return`:${e=t,btoa(String.fromCharCode(...e))}:`;var e}function ym(t){if(function(t){return t<-999999999999999||999999999999999<t}(t))throw mm(t,"Integer");return t.toString()}function Em(t,e){if(t<0)return-Em(-t,e);const i=Math.pow(10,e);if(Math.abs(t*i%1-.5)<Number.EPSILON){const e=Math.floor(t*i);return(e%2==0?e:e+1)/i}return Math.round(t*i)/i}function Tm(t){const e=Em(t,3);if(Math.floor(Math.abs(e)).toString().length>12)throw mm(t,"Decimal");const i=e.toString();return i.includes(".")?i:`${i}.0`}const Sm=/[\x00-\x1f\x7f]+/;function bm(t){const e=(i=t).description||i.toString().slice(7,-1);var i;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e))throw mm(e,"Token");return e}function Im(t){switch(typeof t){case"number":if(!Ql(t))throw mm(t,Am);return Number.isInteger(t)?ym(t):Tm(t);case"string":return function(t){if(Sm.test(t))throw mm(t,"String");return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(t);case"symbol":return bm(t);case"boolean":return function(t){if("boolean"!=typeof t)throw mm(t,"Boolean");return t?"?1":"?0"}(t);case"object":if(t instanceof Date)return function(t){return`@${ym(t.getTime()/1e3)}`}(t);if(t instanceof Uint8Array)return vm(t);if(t instanceof pm)return bm(t);default:throw mm(t,Am)}}function Lm(t){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(t))throw mm(t,"Key");return t}function Rm(t){return null==t?"":Object.entries(t).map(([t,e])=>!0===e?`;${Lm(t)}`:`;${Lm(t)}=${Im(e)}`).join("")}function km(t){return t instanceof fm?`${Im(t.value)}${Rm(t.params)}`:Im(t)}function wm(t,e={whitespace:!0}){if("object"!=typeof t||null==t)throw mm(t,"Dict");const i=t instanceof Map?t.entries():Object.entries(t),s=(null==e?void 0:e.whitespace)?" ":"";return Array.from(i).map(([t,e])=>{e instanceof fm==!1&&(e=new fm(e));let i=Lm(t);var s;return!0===e.value?i+=Rm(e.params):(i+="=",Array.isArray(e.value)?i+=`(${(s=e).value.map(km).join(" ")})${Rm(s.params)}`:i+=km(e)),i}).join(`,${s}`)}function Dm(t,e){return wm(t,e)}const Cm="CMCD-Object",xm="CMCD-Request",Pm="CMCD-Session",Mm="CMCD-Status",Om={br:Cm,ab:Cm,d:Cm,ot:Cm,tb:Cm,tpb:Cm,lb:Cm,tab:Cm,lab:Cm,url:Cm,pb:xm,bl:xm,tbl:xm,dl:xm,ltc:xm,mtp:xm,nor:xm,nrr:xm,rc:xm,sn:xm,sta:xm,su:xm,ttfb:xm,ttfbb:xm,ttlb:xm,cmsdd:xm,cmsds:xm,smrt:xm,df:xm,cs:xm,ts:xm,cid:Pm,pr:Pm,sf:Pm,sid:Pm,st:Pm,v:Pm,msd:Pm,bs:Mm,bsd:Mm,cdn:Mm,rtp:Mm,bg:Mm,pt:Mm,ec:Mm,e:Mm},Bm=xm;function Fm(t,e){const i={};if(!t)return i;const s=Object.keys(t),r=e?(n=e,Object.keys(n).reduce((t,e)=>{var i;return null===(i=n[e])||void 0===i||i.forEach(i=>t[i]=e),t},{})):{};var n;return s.reduce((e,i)=>{var s;const n=Om[i]||r[i]||Bm;return(null!==(s=e[n])&&void 0!==s?s:e[n]={})[i]=t[i],e},i)}const Nm="event";const _m=t=>Math.round(t),Um=(t,e)=>Array.isArray(t)?t.map(t=>Um(t,e)):t instanceof fm&&"string"==typeof t.value?new fm(Um(t.value,e),t.params):(e.baseUrl&&(t=function(t,e){const i=new URL(t),s=new URL(e);if(i.origin!==s.origin)return t;const r=i.pathname.split("/").slice(1),n=s.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")+i.search+i.hash}(t,e.baseUrl)),1===e.version?encodeURIComponent(t):t),Hm=t=>100*_m(t/100),jm={br:_m,d:_m,bl:Hm,dl:Hm,mtp:Hm,nor:(t,e)=>{let i=t;return e.version>=2&&(t instanceof fm&&"string"==typeof t.value?i=new fm([t]):"string"==typeof t&&(i=[t])),Um(i,e)},rtp:Hm,tb:_m},Vm="request",Gm="response",Qm=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Km=["e"],qm=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Wm(t){return qm.test(t)}const Ym=["d","dl","nor","ot","rtp","su"];const $m=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];const zm=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function Xm(t){return zm.includes(t)||Wm(t)}const Zm={[Gm]:function(t){return Qm.includes(t)||Ym.includes(t)||$m.includes(t)||Wm(t)},[Nm]:function(t){return Qm.includes(t)||Km.includes(t)||Wm(t)},[Vm]:function(t){return Qm.includes(t)||Ym.includes(t)||Wm(t)}};function Jm(t,e={}){const i={};if(null==t||"object"!=typeof t)return i;const s=e.version||t.v||1,r=e.reportingMode||Vm,n=1===s?Xm:Zm[r];let a=Object.keys(t).filter(n);const o=e.filter;"function"==typeof o&&(a=a.filter(o));const l=r===Gm||r===Nm;l&&!a.includes("ts")&&a.push("ts"),s>1&&!a.includes("v")&&a.push("v");const d=ad({},jm,e.formatters),h={version:s,reportingMode:r,baseUrl:e.baseUrl};return a.sort().forEach(e=>{let r=t[e];const n=d[e];if("function"==typeof n&&(r=n(r,h)),"v"===e){if(1===s)return;r=s}"pr"==e&&1===r||(l&&"ts"===e&&!Ql(r)&&(r=Date.now()),function(t){return"number"==typeof t?Ql(t):null!=t&&""!==t&&!1!==t}(r)&&(function(t){return["ot","sf","st","e","sta"].includes(t)}(e)&&"string"==typeof r&&(r=new pm(r)),i[e]=r))}),i}function tp(t,e,i){return ad(t,function(t,e={}){const i={};if(!t)return i;const s=Fm(Jm(t,e),null==e?void 0:e.customHeaderMap);return Object.entries(s).reduce((t,[e,i])=>{const s=Dm(i,{whitespace:!1});return s&&(t[e]=s),t},i)}(e,i))}function ep(t,e={}){if(!t)return"";const i=function(t,e={}){return t?Dm(Jm(t,e),{whitespace:!1}):""}(t,e);return encodeURIComponent(i)}const ip=/CMCD=[^&#]+/;function sp(t,e,i){const s=function(t,e={}){return t?`CMCD=${ep(t,e)}`:""}(e,i);if(!s)return t;if(ip.test(t))return t.replace(ip,s);const r=t.includes("?")?"&":"?";return`${t}${r}${s}`}function rp(t,e,i,s){t&&Object.keys(e).forEach(r=>{const n=t.filter(t=>t.groupId===r).map(t=>{const n=ad({},t);return n.details=void 0,n.attrs=new Xc(n.attrs),n.url=n.attrs.URI=np(t.url,t.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),n.groupId=n.attrs["GROUP-ID"]=e[r],n.attrs["PATHWAY-ID"]=s,n});t.push(...n)})}function np(t,e,i,s){const{HOST:r,PARAMS:n,[i]:a}=s;let o;e&&(o=null==a?void 0:a[e],o&&(t=o));const l=new self.URL(t);return r&&!o&&(l.host=r),n&&Object.keys(n).sort().forEach(t=>{t&&l.searchParams.set(t,n[t])}),l.href}class ap extends dd{constructor(t){super("eme",t.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=ap.CDMCleanupPromise?[ap.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:e,initData:i}=t,s=`"${t.type}" event: init data type: "${e}"`;if(this.debug(s),null!==i){if(!this.keyFormatPromise){let t=Object.keys(this.keySystemAccessPromises);t.length||(t=vu(this.config));const e=t.map(Au).filter(t=>!!t);this.keyFormatPromise=this.getKeyFormatPromise(e)}this.keyFormatPromise.then(r=>{const n=pu(r);if("sinf"!==e||n!==cu.FAIRPLAY)return void this.log(`Ignoring "${t.type}" event with init data type: "${e}" for selected key-system ${n}`);let a;try{const t=Vd(new Uint8Array(i)),e=ih(au(JSON.parse(t).sinf));if(!e)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");a=new Uint8Array(e.subarray(8,24))}catch(c){return void this.warn(`${s} Failed to parse sinf: ${c}`)}const o=yd(a),{keyIdToKeySessionPromise:l,mediaKeySessions:d}=this;let h=l[o];for(let t=0;t<d.length;t++){const s=d[t],r=s.decryptdata;if(!r.keyId)continue;const n=yd(r.keyId);if(iu(a,r.keyId)||-1!==r.uri.replace(/-/g,"").indexOf(o)){if(h=l[n],!h)continue;if(r.pssh)break;delete l[n],r.pssh=new Uint8Array(i),r.keyId=a,h=l[o]=h.then(()=>this.generateRequestWithPreferredKeySession(s,e,i,"encrypted-event-key-match")),h.catch(t=>this.handleError(t));break}}h||this.handleError(new Error(`Key ID ${o} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(t=>this.handleError(t))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on($l.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on($l.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on($l.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on($l.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on($l.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off($l.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off($l.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off($l.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off($l.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off($l.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(t){const{drmSystems:e,widevineLicenseUrl:i}=this.config,s=null==e?void 0:e[t];return s?s.licenseUrl:t===cu.WIDEVINE&&i?i:void 0}getLicenseServerUrlOrThrow(t){const e=this.getLicenseServerUrl(t);if(void 0===e)throw new Error(`no license server URL configured for key-system "${t}"`);return e}getServerCertificateUrl(t){const{drmSystems:e}=this.config,i=null==e?void 0:e[t];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${t}"]`)}attemptKeySystemAccess(t){const e=this.hls.levels,i=(t,e,i)=>!!t&&i.indexOf(t)===e,s=e.map(t=>t.audioCodec).filter(i),r=e.map(t=>t.videoCodec).filter(i);return s.length+r.length===0&&r.push("avc1.42e01e"),new Promise((e,i)=>{const n=t=>{const a=t.shift();this.getMediaKeysPromise(a,s,r).then(t=>e({keySystem:a,mediaKeys:t})).catch(e=>{t.length?n(t):i(e instanceof dp?e:new dp({type:Wl.KEY_SYSTEM_ERROR,details:Yl.KEY_SYSTEM_NO_ACCESS,error:e,fatal:!0},e.message))})};n(t)})}requestMediaKeySystemAccess(t,e){const{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let t=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===yu&&"http:"===self.location.protocol&&(t=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(t))}return i(t,e)}getMediaKeysPromise(t,e,i){var s;const r=function(t,e,i,s){let r;switch(t){case cu.FAIRPLAY:r=["cenc","sinf"];break;case cu.WIDEVINE:case cu.PLAYREADY:r=["cenc"];break;case cu.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${t}`)}return function(t,e,i,s){return[{initDataTypes:t,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(t=>({contentType:`audio/mp4; codecs=${t}`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:i.map(t=>({contentType:`video/mp4; codecs=${t}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}(r,e,i,s)}(t,e,i,this.config.drmSystemOptions||{});let n=this.keySystemAccessPromises[t],a=null==(s=n)?void 0:s.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${t}" key-system access with config: ${Qh(r)}`),a=this.requestMediaKeySystemAccess(t,r);const e=n=this.keySystemAccessPromises[t]={keySystemAccess:a};return a.catch(e=>{this.log(`Failed to obtain access to key-system "${t}": ${e}`)}),a.then(i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);const s=this.fetchServerCertificate(t);this.log(`Create media-keys for "${t}"`);const r=e.mediaKeys=i.createMediaKeys().then(i=>(this.log(`Media-keys created for "${t}"`),e.hasMediaKeys=!0,s.then(e=>e?this.setMediaKeysServerCertificate(i,t,e):i)));return r.catch(e=>{this.error(`Failed to create media-keys for "${t}"}: ${e}`)}),r})}return a.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:t,keySystem:e,mediaKeys:i}){this.log(`Creating key-system session "${e}" keyId: ${yd(t.keyId||[])} keyUri: ${t.uri}`);const s=i.createSession(),r={decryptdata:t,keySystem:e,mediaKeys:i,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(t){const e=t.decryptdata;if(e.pssh){const i=this.createMediaKeySessionContext(t),s=op(e),r="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(i,r,e.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(t)}updateKeySession(t,e){const i=t.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${yd(t.decryptdata.keyId||[])}\n } (data length: ${e.byteLength})`),i.update(e)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(t=>({keySystem:t,hasMediaKeys:this.keySystemAccessPromises[t].hasMediaKeys})).filter(({hasMediaKeys:t})=>!!t).map(({keySystem:t})=>Au(t)).filter(t=>!!t)}getKeySystemAccess(t){return this.getKeySystemSelectionPromise(t).then(({keySystem:t,mediaKeys:e})=>this.attemptSetMediaKeys(t,e))}selectKeySystem(t){return new Promise((e,i)=>{this.getKeySystemSelectionPromise(t).then(({keySystem:t})=>{const s=Au(t);s?e(s):i(new Error(`Unable to find format for key-system "${t}"`))}).catch(i)})}selectKeySystemFormat(t){const e=Object.keys(t.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${t.sn} ${t.type}: ${t.level}) key formats ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)),this.keyFormatPromise}getKeyFormatPromise(t){const e=vu(this.config),i=t.map(pu).filter(t=>!!t&&-1!==e.indexOf(t));return this.selectKeySystem(i)}getKeyStatus(t){const{mediaKeySessions:e}=this;for(let i=0;i<e.length;i++){const s=lp(t,e[i]);if(s)return s}}loadKey(t){const e=t.keyInfo.decryptdata,i=op(e),s=this.bannedKeyIds[i];if(s||"internal-error"===this.getKeyStatus(e)){const i=hp(s||"internal-error",e);return this.handleError(i,t.frag),Promise.reject(i)}const r=`(keyId: ${i} format: "${e.keyFormat}" method: ${e.method} uri: ${e.uri})`;this.log(`Starting session for key ${r}`);const n=this.keyIdToKeySessionPromise[i];if(!n){const s=this.getKeySystemForKeyPromise(e).then(({keySystem:i,mediaKeys:s})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${r}`),this.attemptSetMediaKeys(i,s).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:i,mediaKeys:s,decryptdata:e}))))).then(t=>{const i=e.pssh?e.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(t,"cenc",i,"playlist-key")});return s.catch(e=>this.handleError(e,t.frag)),this.keyIdToKeySessionPromise[i]=s,s}return n.catch(i=>{if(i instanceof dp){const s=ld({},i.data);"internal-error"===this.getKeyStatus(e)&&(s.decryptdata=e);const r=new dp(s,i.message);this.handleError(r,t.frag)}}),n}throwIfDestroyed(t="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(t,e){if(this.hls)if(t instanceof dp){e&&(t.data.frag=e);const i=t.data.decryptdata;this.error(`${t.message}${i?` (${yd(i.keyId||[])})`:""}`),this.hls.trigger($l.ERROR,t.data)}else this.error(t.message),this.hls.trigger($l.ERROR,{type:Wl.KEY_SYSTEM_ERROR,details:Yl.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0})}getKeySystemForKeyPromise(t){const e=op(t),i=this.keyIdToKeySessionPromise[e];if(!i){const e=pu(t.keyFormat),i=e?[e]:vu(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(t){if(t.length||(t=vu(this.config)),0===t.length)throw new dp({type:Wl.KEY_SYSTEM_ERROR,details:Yl.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Qh({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(t)}attemptSetMediaKeys(t,e){if(this.mediaResolved=void 0,this.mediaKeys===e)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${t}"`);const s=Promise.all(i).then(()=>this.media?this.media.setMediaKeys(e):new Promise((t,i)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return i(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=e,this.media.setMediaKeys(e).then(t).catch(i)}}));return this.mediaKeys=e,this.setMediaKeysQueue.push(s),s.then(()=>{this.log(`Media-keys set for "${t}"`),i.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(t=>-1===i.indexOf(t))})}generateRequestWithPreferredKeySession(t,e,i,s){var r;const n=null==(r=this.config.drmSystems)||null==(r=r[t.keySystem])?void 0:r.generateRequest;if(n)try{const s=n.call(this.hls,e,i,t);if(!s)throw new Error("Invalid response from configured generateRequest filter");e=s.initDataType,i=s.initData?s.initData:null,t.decryptdata.pssh=i?new Uint8Array(i):null}catch(f){if(this.warn(f.message),this.hls&&this.hls.config.debug)throw f}if(null===i)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(t);const a=op(t.decryptdata),o=t.decryptdata.uri;this.log(`Generating key-session request for "${s}" keyId: ${a} URI: ${o} (init data type: ${e} length: ${i.byteLength})`);const l=new wf,d=t._onmessage=e=>{const i=t.mediaKeysSession;if(!i)return void l.emit("error",new Error("invalid state"));const{messageType:s,message:r}=e;this.log(`"${s}" message event for session "${i.sessionId}" message size: ${r.byteLength}`),"license-request"===s||"license-renewal"===s?this.renewLicense(t,r).catch(t=>{l.eventNames().length?l.emit("error",t):this.handleError(t)}):"license-release"===s?t.keySystem===cu.FAIRPLAY&&this.updateKeySession(t,ou("acknowledged")).then(()=>this.removeSession(t)).catch(t=>this.handleError(t)):this.warn(`unhandled media key message type "${s}"`)},h=(t,e)=>{let i;e.keyStatus=t,t.startsWith("usable")?l.emit("resolved"):"internal-error"===t||"output-restricted"===t||"output-downscaled"===t?i=hp(t,e.decryptdata):"expired"===t?i=new Error(`key expired (keyId: ${a})`):"released"===t?i=new Error("key released"):"status-pending"===t||this.warn(`unhandled key status change "${t}" (keyId: ${a})`),i&&(l.eventNames().length?l.emit("error",i):this.handleError(i))},c=t._onkeystatuseschange=e=>{if(!t.mediaKeysSession)return void l.emit("error",new Error("invalid state"));const i=this.getKeyStatuses(t);if(!Object.keys(i).some(t=>"status-pending"!==i[t]))return;if("expired"===i[a])return this.log(`Expired key ${Qh(i)} in key-session "${t.mediaKeysSession.sessionId}"`),void this.renewKeySession(t);let s=i[a];if(s)h(s,t);else{var r;const e=1e3;t.keyStatusTimeouts||(t.keyStatusTimeouts={}),(r=t.keyStatusTimeouts)[a]||(r[a]=self.setTimeout(()=>{if(!t.mediaKeysSession||!this.mediaKeys)return;const i=this.getKeyStatus(t.decryptdata);if(i&&"status-pending"!==i)return this.log(`No status for keyId ${a} in key-session "${t.mediaKeysSession.sessionId}". Using session key-status ${i} from other session.`),h(i,t);this.log(`key status for ${a} in key-session "${t.mediaKeysSession.sessionId}" timed out after ${e}ms`),s="internal-error",h(s,t)},e)),this.log(`No status for keyId ${a} (${Qh(i)}).`)}};of(t.mediaKeysSession,"message",d),of(t.mediaKeysSession,"keystatuseschange",c);const u=new Promise((t,e)=>{l.on("error",e),l.on("resolved",t)});return t.mediaKeysSession.generateRequest(e,i).then(()=>{this.log(`Request generated for key-session "${t.mediaKeysSession.sessionId}" keyId: ${a} URI: ${o}`)}).catch(e=>{throw new dp({type:Wl.KEY_SYSTEM_ERROR,details:Yl.KEY_SYSTEM_NO_SESSION,error:e,decryptdata:t.decryptdata,fatal:!1},`Error generating key-session request: ${e}`)}).then(()=>u).catch(e=>(l.removeAllListeners(),this.removeSession(t).then(()=>{throw e}))).then(()=>(l.removeAllListeners(),t))}getKeyStatuses(t){const e={};return t.mediaKeysSession.keyStatuses.forEach((i,s)=>{if("string"==typeof s&&"object"==typeof i){const t=s;s=i,i=t}const r="buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s);if(t.keySystem===cu.PLAYREADY&&16===r.length){const t=yd(r);e[t]=i,lu(r)}const n=yd(r);"internal-error"===i&&(this.bannedKeyIds[n]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${n} key-session "${t.mediaKeysSession.sessionId}"`),e[n]=i}),e}fetchServerCertificate(t){const e=this.config,i=new(0,e.loader)(e),s=this.getServerCertificateUrl(t);return s?(this.log(`Fetching server certificate for "${t}"`),new Promise((r,n)=>{const a={responseType:"arraybuffer",url:s},o=e.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(t,e,i,s)=>{r(t.data)},onError:(e,i,r,o)=>{n(new dp({type:Wl.KEY_SYSTEM_ERROR,details:Yl.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:ld({url:a.url,data:void 0},e)},`"${t}" certificate request failed (${s}). Status: ${e.code} (${e.text})`))},onTimeout:(e,i,r)=>{n(new dp({type:Wl.KEY_SYSTEM_ERROR,details:Yl.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:a.url,data:void 0}},`"${t}" certificate request timed out (${s})`))},onAbort:(t,e,i)=>{n(new Error("aborted"))}};i.load(a,l,d)})):Promise.resolve()}setMediaKeysServerCertificate(t,e,i){return new Promise((s,r)=>{t.setServerCertificate(i).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${i.byteLength}) on "${e}"`),s(t)}).catch(t=>{r(new dp({type:Wl.KEY_SYSTEM_ERROR,details:Yl.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:t,fatal:!0},t.message))})})}renewLicense(t,e){return this.requestLicense(t,new Uint8Array(e)).then(e=>this.updateKeySession(t,new Uint8Array(e)).catch(e=>{throw new dp({type:Wl.KEY_SYSTEM_ERROR,details:Yl.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:t.decryptdata,error:e,fatal:!1},e.message)}))}unpackPlayReadyKeyMessage(t,e){const i=String.fromCharCode.apply(null,new Uint16Array(e.buffer));if(!i.includes("PlayReadyKeyMessage"))return t.setRequestHeader("Content-Type","text/xml; charset=utf-8"),e;const s=(new DOMParser).parseFromString(i,"application/xml"),r=s.querySelectorAll("HttpHeader");if(r.length>0){let e;for(let i=0,s=r.length;i<s;i++){var n,a;e=r[i];const s=null==(n=e.querySelector("name"))?void 0:n.textContent,o=null==(a=e.querySelector("value"))?void 0:a.textContent;s&&o&&t.setRequestHeader(s,o)}}const o=s.querySelector("Challenge"),l=null==o?void 0:o.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return ou(atob(l))}setupLicenseXHR(t,e,i,s){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,t,e,i,s)}).catch(n=>{if(!i.decryptdata)throw n;return t.open("POST",e,!0),r.call(this.hls,t,e,i,s)}).then(i=>{t.readyState||t.open("POST",e,!0);return{xhr:t,licenseChallenge:i||s}}):(t.open("POST",e,!0),Promise.resolve({xhr:t,licenseChallenge:s}))}requestLicense(t,e){const i=this.config.keyLoadPolicy.default;return new Promise((s,r)=>{const n=this.getLicenseServerUrlOrThrow(t.keySystem);this.log(`Sending license request to URL: ${n}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!t.mediaKeysSession)return r(new Error("invalid state"));if(4===a.readyState)if(200===a.status){this._requestLicenseFailureCount=0;let e=a.response;this.log(`License received ${e instanceof ArrayBuffer?e.byteLength:e}`);const i=this.config.licenseResponseCallback;if(i)try{e=i.call(this.hls,a,n,t)}catch(o){this.error(o)}s(e)}else{const o=i.errorRetry,l=o?o.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)r(new dp({type:Wl.KEY_SYSTEM_ERROR,details:Yl.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:t.decryptdata,fatal:!0,networkDetails:a,response:{url:n,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${n}). Status: ${a.status} (${a.statusText})`));else{const i=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(t,e).then(s,r)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=a,this.setupLicenseXHR(a,n,t,e).then(({xhr:e,licenseChallenge:i})=>{t.keySystem==cu.PLAYREADY&&(i=this.unpackPlayReadyKeyMessage(e,i)),e.send(i)}).catch(r)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(t,e){if(!this.config.emeEnabled)return;const i=e.media;this.media=i,of(i,"encrypted",this.onMediaEncrypted),of(i,"waitingforkey",this.onWaitingForKey);const s=this.mediaResolved;s?s():this.mediaKeys=i.mediaKeys}onMediaDetached(){const t=this.media;t&&(lf(t,"encrypted",this.onMediaEncrypted),lf(t,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var t;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const e=this.mediaResolved;if(e&&e(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const i=this.media,s=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,bu.clearKeyUriToKeyIdMap();const r=s.length;ap.CDMCleanupPromise=Promise.all(s.map(t=>this.removeSession(t)).concat((null==i||null==(t=i.setMediaKeys(null))?void 0:t.catch(t=>{this.log(`Could not clear media keys: ${t}`),this.hls&&this.hls.trigger($l.ERROR,{type:Wl.OTHER_ERROR,details:Yl.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${t}`)})}))||Promise.resolve())).catch(t=>{this.log(`Could not close sessions and clear media keys: ${t}`),this.hls&&this.hls.trigger($l.ERROR,{type:Wl.OTHER_ERROR,details:Yl.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${t}`)})}).then(()=>{r&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(t,{sessionKeys:e}){if(e&&this.config.emeEnabled&&!this.keyFormatPromise){const t=e.reduce((t,e)=>(-1===t.indexOf(e.keyFormat)&&t.push(e.keyFormat),t),[]);this.log(`Selecting key-system from session-keys ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)}}removeSession(t){const{mediaKeysSession:e,licenseXhr:i,decryptdata:s}=t;if(e){this.log(`Remove licenses and keys and close session "${e.sessionId}" keyId: ${yd((null==s?void 0:s.keyId)||[])}`),t._onmessage&&(e.removeEventListener("message",t._onmessage),t._onmessage=void 0),t._onkeystatuseschange&&(e.removeEventListener("keystatuseschange",t._onkeystatuseschange),t._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(t);r>-1&&this.mediaKeySessions.splice(r,1);const{keyStatusTimeouts:n}=t;n&&Object.keys(n).forEach(t=>self.clearTimeout(n[t]));const{drmSystemOptions:a}=this.config,o=function(t){var e;return!(!t||"persistent-license"!==t.sessionType&&(null==(e=t.sessionTypes)||!e.some(t=>"persistent-license"===t)))}(a)?new Promise((t,i)=>{self.setTimeout(()=>i(new Error("MediaKeySession.remove() timeout")),8e3),e.remove().then(t).catch(i)}):Promise.resolve();return o.catch(t=>{this.log(`Could not remove session: ${t}`),this.hls&&this.hls.trigger($l.ERROR,{type:Wl.OTHER_ERROR,details:Yl.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${t}`)})}).then(()=>e.close()).catch(t=>{this.log(`Could not close session: ${t}`),this.hls&&this.hls.trigger($l.ERROR,{type:Wl.OTHER_ERROR,details:Yl.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${t}`)})})}return Promise.resolve()}}function op(t){if(!t)throw new Error("Could not read keyId of undefined decryptdata");if(null===t.keyId)throw new Error("keyId is null");return yd(t.keyId)}function lp(t,e){return t.keyId&&e.mediaKeysSession.keyStatuses.has(t.keyId)?e.mediaKeysSession.keyStatuses.get(t.keyId):t.matches(e.decryptdata)?e.keyStatus:void 0}ap.CDMCleanupPromise=void 0;class dp extends Error{constructor(t,e){super(e),this.data=void 0,t.error||(t.error=new Error(e)),this.data=t,t.err=t.error}}function hp(t,e){const i="output-restricted"===t,s=i?Yl.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:Yl.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new dp({type:Wl.KEY_SYSTEM_ERROR,details:s,fatal:!1,decryptdata:e},i?"HDCP level output restricted":`key status changed to "${t}"`)}function cp(t,e){let i;try{i=new Event("addtrack")}catch(PE){i=document.createEvent("Event"),i.initEvent("addtrack",!1,!1)}i.track=t,e.dispatchEvent(i)}function up(t,e){const i=t.mode;if("disabled"===i&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(PE){md.debug(`[texttrack-utils]: ${PE}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,t.addCue(i)}catch(s){md.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${s}`)}}"disabled"===i&&(t.mode=i)}function fp(t,e){const i=t.mode;if("disabled"===i&&(t.mode="hidden"),t.cues)for(let s=t.cues.length;s--;)e&&t.cues[s].removeEventListener("enter",e),t.removeCue(t.cues[s]);"disabled"===i&&(t.mode=i)}function gp(t,e,i,s){const r=t.mode;if("disabled"===r&&(t.mode="hidden"),t.cues&&t.cues.length>0){const r=function(t,e,i){const s=[],r=function(t,e){if(e<=t[0].startTime)return 0;const i=t.length-1;if(e>t[i].endTime)return-1;let s,r=0,n=i;for(;r<=n;)if(s=Math.floor((n+r)/2),e<t[s].startTime)n=s-1;else{if(!(e>t[s].startTime&&r<i))return s;r=s+1}return t[r].startTime-e<e-t[n].startTime?r:n}(t,e);if(r>-1)for(let n=r,a=t.length;n<a;n++){const r=t[n];if(r.startTime>=e&&r.endTime<=i)s.push(r);else if(r.startTime>i)return s}return s}(t.cues,e,i);for(let e=0;e<r.length;e++)s&&!s(r[e])||t.removeCue(r[e])}"disabled"===r&&(t.mode=r)}function mp(t){const e=[];for(let i=0;i<t.length;i++){const s=t[i];"subtitles"!==s.kind&&"captions"!==s.kind||!s.label||e.push(t[i])}return e}function pp(t){let e=5381,i=t.length;for(;i;)e=33*e^t.charCodeAt(--i);return(e>>>0).toString()}const Ap=.025;let vp=function(t){return t[t.Point=0]="Point",t[t.Range=1]="Range",t}({});function yp(t,e,i){return`${t.identifier}-${i+1}-${pp(e)}`}class Ep{constructor(t,e){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=e,this.dateRange=t,this.setDateRange(t)}setDateRange(t){this.dateRange=t,this.resumeOffset=t.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=t.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=t.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=t.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var t;this.appendInPlaceStarted=!1,null==(t=this.assetListLoader)||t.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(t){var e;if(t>0&&t>=this.assetList.length)return!0;const i=this.playoutLimit;if(t<=0||isNaN(i))return!1;if(0===i)return!0;return((null==(e=this.assetList[t])?void 0:e.startOffset)||0)>i}findAssetIndex(t){return this.assetList.indexOf(t)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const t=this.dateRange.startTime;if(this.snapOptions.out){const e=this.dateRange.tagAnchor;if(e)return Tp(t,e)}return t}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(0===this.startTime||this.snapOptions.out)return!0;const t=this.dateRange.tagAnchor;if(t){const e=this.dateRange.startTime;return e-Tp(e,t)<.1}return!1}get resumptionOffset(){const t=this.resumeOffset,e=Ql(t)?t:this.duration;return this.cumulativeDuration+e}get resumeTime(){const t=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const e=this.resumeAnchor;if(e)return Tp(t,e)}return t}get appendInPlace(){return!!this.appendInPlaceStarted||!this.appendInPlaceDisabled&&!(this.cue.once||this.cue.pre||!this.startIsAligned||!(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Ap))}set appendInPlace(t){this.appendInPlaceStarted?this.resetOnResume=!t:this.appendInPlaceDisabled=!t}get timelineStart(){return null!==this._timelineStart?this._timelineStart:this.startTime}set timelineStart(t){this._timelineStart=t}get duration(){const t=this.playoutLimit;let e;return e=null!==this._duration?this._duration:this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0,!isNaN(t)&&t<e&&(e=t),e}set duration(t){this._duration=t}get cue(){return this.dateRange.cue}get timelineOccupancy(){return"RANGE"===this.dateRange.attr["X-TIMELINE-OCCUPIES"]?vp.Range:vp.Point}get supplementsPrimary(){return"PRIMARY"===this.dateRange.attr["X-TIMELINE-STYLE"]}get contentMayVary(){return"NO"!==this.dateRange.attr["X-CONTENT-MAY-VARY"]}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||null!==this.assetListResponse}toString(){return`["${(t=this).identifier}" ${t.cue.pre?"<pre>":t.cue.post?"<post>":""}${t.timelineStart.toFixed(2)}-${t.resumeTime.toFixed(2)}]`;var t}}function Tp(t,e){return t-e.start<e.duration/2&&!(Math.abs(t-(e.start+e.duration))<Ap)?e.start:e.start+e.duration}function Sp(t,e,i){const s=new self.URL(t,i);return"data:"!==s.protocol&&s.searchParams.set("_HLS_primary_id",e),s}function bp(t,e){for(;null!=(i=t.assetList[++e])&&i.error;)var i;return e}function Ip(t){const e=t.timelineStart,i=t.duration||0;return`["${t.identifier}" ${e.toFixed(2)}-${(e+i).toFixed(2)}]`}class Lp{constructor(t,e,i,s){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger($l.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new t(e);this.interstitial=i,this.assetItem=s;const n=()=>{this.hasDetails=!0};r.once($l.LEVEL_LOADED,n),r.once($l.AUDIO_TRACK_LOADED,n),r.once($l.SUBTITLE_TRACK_LOADED,n),r.on($l.MEDIA_ATTACHING,(t,{media:e})=>{this.removeMediaListeners(),this.mediaAttached=e;this.interstitial.playoutLimit&&(e.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on($l.BUFFER_APPENDED,()=>{const t=this.bufferedEnd;this.reachedPlayout(t)&&(this._bufferedEosTime=t,r.trigger($l.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const t=this.hls;if(t)if(t.url)t.levels.length&&!t.started&&t.startLoad(-1,!0);else{let i=this.assetItem.uri;try{i=Sp(i,t.config.primarySessionId||"").href}catch(e){}t.loadSource(i)}}bufferedInPlaceToEnd(t){var e;if(!this.appendInPlace)return!1;if(null!=(e=this.hls)&&e.bufferedToEnd)return!0;if(!t)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),s=this.timelineOffset,r=Gc.bufferInfo(t,s,0);return this.getAssetTime(r.end)>=i-.02}reachedPlayout(t){const e=this.interstitial.playoutLimit;return this.startOffset+t>=e}get destroyed(){var t;return!(null!=(t=this.hls)&&t.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var t;return(null==(t=this.hls)?void 0:t.media)||null}get bufferedEnd(){const t=this.media||this.mediaAttached;if(!t)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const e=Gc.bufferInfo(t,t.currentTime,.001);return this.getAssetTime(e.end)}get currentTime(){const t=this.media||this.mediaAttached;return t?this.getAssetTime(t.currentTime):this._currentTime||0}get duration(){const t=this.assetItem.duration;if(!t)return 0;const e=this.interstitial.playoutLimit;if(e){const i=e-this.startOffset;if(i>0&&i<t)return i}return t}get remaining(){const t=this.duration;return t?Math.max(0,t-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var t;return(null==(t=this.hls)?void 0:t.config.timelineOffset)||0}set timelineOffset(t){const e=this.timelineOffset;if(t!==e){const i=t-e;if(Math.abs(i)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=t}}}getAssetTime(t){const e=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,t-e),i)}removeMediaListeners(){const t=this.mediaAttached;t&&(this._currentTime=t.currentTime,this.bufferSnapShot(),t.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){var t;this.mediaAttached&&(null!=(t=this.hls)&&t.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd))}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(t){var e;this.loadSource(),null==(e=this.hls)||e.attachMedia(t)}detachMedia(){var t;this.removeMediaListeners(),this.mediaAttached=null,null==(t=this.hls)||t.detachMedia()}resumeBuffering(){var t;null==(t=this.hls)||t.resumeBuffering()}pauseBuffering(){var t;null==(t=this.hls)||t.pauseBuffering()}transferMedia(){var t;return this.bufferSnapShot(),(null==(t=this.hls)?void 0:t.transferMedia())||null}resetDetails(){const t=this.hls;if(t&&this.hasDetails){t.stopLoad();const e=t=>delete t.details;t.levels.forEach(e),t.allAudioTracks.forEach(e),t.allSubtitleTracks.forEach(e),this.hasDetails=!1}}on(t,e,i){var s;null==(s=this.hls)||s.on(t,e)}once(t,e,i){var s;null==(s=this.hls)||s.once(t,e)}off(t,e,i){var s;null==(s=this.hls)||s.off(t,e)}toString(){var t;return`HlsAssetPlayer: ${Ip(this.assetItem)} ${null==(t=this.hls)?void 0:t.sessionId} ${this.appendInPlace?"append-in-place":""}`}}class Rp extends dd{constructor(t,e){super("interstitials-sched",e),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=t}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(t=>t.reset()),this.events=this.items=null}resetErrorsInRange(t,e){return this.events?this.events.reduce((i,s)=>t<=s.startOffset&&e>s.startOffset?(delete s.error,i+1):i,0):0}get duration(){const t=this.items;return t?t[t.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(t){return t&&this.eventMap[t]||null}hasEvent(t){return t in this.eventMap}findItemIndex(t,e){if(t.event)return this.findEventIndex(t.event.identifier);let i=-1;t.nextEvent?i=this.findEventIndex(t.nextEvent.identifier)-1:t.previousEvent&&(i=this.findEventIndex(t.previousEvent.identifier)+1);const s=this.items;if(s)for(s[i]||(void 0===e&&(e=t.start),i=this.findItemIndexAtTime(e));i>=0&&null!=(r=s[i])&&r.event;){var r;i--}return i}findItemIndexAtTime(t,e){const i=this.items;if(i)for(let s=0;s<i.length;s++){let r=i[s];if(e&&"primary"!==e&&(r=r[e]),t===r.start||t>r.start&&t<r.end)return s}return-1}findJumpRestrictedIndex(t,e){const i=this.items;if(i)for(let s=t;s<=e&&i[s];s++){const t=i[s].event;if(null!=t&&t.restrictions.jump&&!t.appendInPlace)return s}return-1}findEventIndex(t){const e=this.items;if(e)for(let s=e.length;s--;){var i;if((null==(i=e[s].event)?void 0:i.identifier)===t)return s}return-1}findAssetIndex(t,e){const i=t.assetList,s=i.length;if(s>1)for(let r=0;r<s;r++){const t=i[r];if(!t.error){const i=t.timelineStart;if(e===i||e>i&&(e<i+(t.duration||0)||r===s-1))return r}}return 0}get assetIdAtEnd(){var t;const e=null==(t=this.items)||null==(t=t[this.length-1])?void 0:t.event;if(e){const t=e.assetList,i=t[t.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(t,e){const i=t.main.details,{dateRanges:s}=i,r=this.events,n=this.parseDateRanges(s,{url:i.url},e),a=Object.keys(s),o=r?r.filter(t=>!a.includes(t.identifier)):[];n.length&&n.sort((t,e)=>{const i=t.cue.pre,s=t.cue.post,r=e.cue.pre,n=e.cue.post;if(i&&!r)return-1;if(r&&!i)return 1;if(s&&!n)return 1;if(n&&!s)return-1;if(!(i||r||s||n)){const i=t.startTime,s=e.startTime;if(i!==s)return i-s}return t.dateRange.tagOrder-e.dateRange.tagOrder}),this.events=n,o.forEach(t=>{this.removeEvent(t)}),this.updateSchedule(t,o)}updateSchedule(t,e=[],i=!1){const s=this.events||[];if(s.length||e.length||this.length<2){const r=this.items,n=this.parseSchedule(s,t);(i||e.length||(null==r?void 0:r.length)!==n.length||n.some((t,e)=>Math.abs(t.playout.start-r[e].playout.start)>.005||Math.abs(t.playout.end-r[e].playout.end)>.005))&&(this.items=n,this.onScheduleUpdate(e,r))}}parseDateRanges(t,e,i){const s=[],r=Object.keys(t);for(let n=0;n<r.length;n++){const a=r[n],o=t[a];if(o.isInterstitial){let t=this.eventMap[a];t?t.setDateRange(o):(t=new Ep(o,e),this.eventMap[a]=t,!1===i&&(t.appendInPlace=i)),s.push(t)}}return s}parseSchedule(t,e){const i=[],s=e.main.details,r=s.live?1/0:s.edge;let n=0;if((t=t.filter(t=>!(t.error||t.cue.once&&t.hasPlayed))).length){this.resolveOffsets(t,e);let s=0,o=0;if(t.forEach((e,a)=>{const l=e.cue.pre,d=e.cue.post,h=t[a-1]||null,c=e.appendInPlace,u=d?r:e.startOffset,f=e.duration,g=e.timelineOccupancy===vp.Range?f:0,m=e.resumptionOffset,p=(null==h?void 0:h.startTime)===u,A=u+e.cumulativeDuration;let v=c?A+f:u+m;if(l||!d&&u<=0){const t=o;o+=g,e.timelineStart=A;const s=n;n+=f,i.push({event:e,start:A,end:v,playout:{start:s,end:n},integrated:{start:t,end:o}})}else{if(!(u<=r))return;{if(!p){const r=u-s;if(r>.033){const l=s,d=o;o+=r;const h=n;n+=r;const c={previousEvent:t[a-1]||null,nextEvent:e,start:l,end:l+r,playout:{start:h,end:n},integrated:{start:d,end:o}};i.push(c)}else r>0&&h&&(h.cumulativeDuration+=r,i[i.length-1].end=u)}d&&(v=A),e.timelineStart=A;const r=o;o+=g;const l=n;n+=f,i.push({event:e,start:A,end:v,playout:{start:l,end:n},integrated:{start:r,end:o}})}}const y=e.resumeTime;s=d||y>r?r:y}),s<r){var a;const t=s,e=o,l=r-s;o+=l;const d=n;n+=l,i.push({previousEvent:(null==(a=i[i.length-1])?void 0:a.event)||null,nextEvent:null,start:s,end:t+l,playout:{start:d,end:n},integrated:{start:e,end:o}})}this.setDurations(r,n,o)}else{const t=0;i.push({previousEvent:null,nextEvent:null,start:t,end:r,playout:{start:t,end:r},integrated:{start:t,end:r}}),this.setDurations(r,r,r)}return i}setDurations(t,e,i){this.durations={primary:t,playout:e,integrated:i}}resolveOffsets(t,e){const i=e.main.details,s=i.live?1/0:i.edge;let r=0,n=-1;t.forEach((a,o)=>{const l=a.cue.pre,d=a.cue.post,h=l?0:d?s:a.startTime;this.updateAssetDurations(a);if(n===h?a.cumulativeDuration=r:(r=0,n=h),!d&&a.snapOptions.in&&(a.resumeAnchor=tc(null,i.fragments,a.startOffset+a.resumptionOffset,0,0)||void 0),a.appendInPlace&&!a.appendInPlaceStarted){this.primaryCanResumeInPlaceAt(a,e)||(a.appendInPlace=!1)}if(!a.appendInPlace&&o+1<t.length){t[o+1].startTime-t[o].resumeTime<.033&&(t[o+1].appendInPlace=!1,t[o+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${a}`))}const c=Ql(a.resumeOffset)?a.resumeOffset:a.duration;r+=c})}primaryCanResumeInPlaceAt(t,e){const i=t.resumeTime,s=t.startTime+t.resumptionOffset;if(Math.abs(i-s)>Ap)return this.log(`"${t.identifier}" resumption ${i} not aligned with estimated timeline end ${s}`),!1;return!Object.keys(e).some(s=>{const r=e[s].details,n=r.edge;if(i>=n)return this.log(`"${t.identifier}" resumption ${i} past ${s} playlist end ${n}`),!1;const a=tc(null,r.fragments,i);if(!a)return this.log(`"${t.identifier}" resumption ${i} does not align with any fragments in ${s} playlist (${r.fragStart}-${r.fragmentEnd})`),!0;const o="audio"===s?.175:0;return!(Math.abs(a.start-i)<Ap+o||Math.abs(a.end-i)<Ap+o)&&(this.log(`"${t.identifier}" resumption ${i} not aligned with ${s} fragment bounds (${a.start}-${a.end} sn: ${a.sn} cc: ${a.cc})`),!0)})}updateAssetDurations(t){if(!t.assetListLoaded)return;const e=t.timelineStart;let i=0,s=!1,r=!1;for(let n=0;n<t.assetList.length;n++){const a=t.assetList[n],o=e+i;a.startOffset=i,a.timelineStart=o,s||(s=null===a.duration),r||(r=!!a.error);i+=a.error?0:a.duration||0}t.duration=s&&!r?Math.max(i,t.duration):i}removeEvent(t){t.reset(),delete this.eventMap[t.identifier]}}function kp(t){return`[${t.event?'"'+t.event.identifier+'"':"primary"}: ${t.start.toFixed(2)}-${t.end.toFixed(2)}]`}class wp{constructor(t){this.hls=void 0,this.hls=t}destroy(){this.hls=null}loadAssetList(t,e){const i=t.assetListUrl;let s;try{s=Sp(i,this.hls.sessionId,t.baseUrl)}catch(h){const e=this.assignAssetListError(t,Yl.ASSET_LIST_LOAD_ERROR,h,i);return void this.hls.trigger($l.ERROR,e)}e&&"data:"!==s.protocol&&s.searchParams.set("_HLS_start_offset",""+e);const r=this.hls.config,n=new(0,r.loader)(r),a={responseType:"json",url:s.href},o=r.interstitialAssetListLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,i,s,r)=>{const n=e.data,a=null==n?void 0:n.ASSETS;if(!Array.isArray(a)){const e=this.assignAssetListError(t,Yl.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),s.url,i,r);return void this.hls.trigger($l.ERROR,e)}t.assetListResponse=n,this.hls.trigger($l.ASSET_LIST_LOADED,{event:t,assetListResponse:n,networkDetails:r})},onError:(e,i,s,r)=>{const n=this.assignAssetListError(t,Yl.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${e.code} ${e.text} (${i.url})`),i.url,r,s);this.hls.trigger($l.ERROR,n)},onTimeout:(e,i,s)=>{const r=this.assignAssetListError(t,Yl.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${i.url})`),i.url,e,s);this.hls.trigger($l.ERROR,r)}};return n.load(a,l,d),this.hls.trigger($l.ASSET_LIST_LOADING,{event:t}),n}assignAssetListError(t,e,i,s,r,n){return t.error=i,{type:Wl.NETWORK_ERROR,details:e,fatal:!1,interstitial:t,url:s,error:i,networkDetails:n,stats:r}}}function Dp(t){var e;null==t||null==(e=t.play())||e.catch(()=>{})}function Cp(t,e){return`[${t}] Advancing timeline position to ${e}`}class xp{constructor(t){this.buffered=void 0;const e=(e,i,s)=>{if((i>>>=0)>s-1)throw new DOMException(`Failed to execute '${e}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return t[i][e]};this.buffered={get length(){return t.length},end:i=>e("end",i,t.length),start:i=>e("start",i,t.length)}}}const Pp={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Mp=t=>String.fromCharCode(Pp[t]||t),Op=15,Bp=100,Fp={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Np={17:2,18:4,21:6,22:8,23:10,19:13,20:15},_p={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Up={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Hp=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class jp{constructor(){this.time=null,this.verboseLevel=0}log(t,e){if(this.verboseLevel>=t){const i="function"==typeof e?e():e;md.log(`${this.time} [${t}] ${i}`)}}}const Vp=function(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].toString(16));return e};class Gp{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(t){const e=["foreground","underline","italics","background","flash"];for(let i=0;i<e.length;i++){const s=e[i];t.hasOwnProperty(s)&&(this[s]=t[s])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}equals(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash}copy(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class Qp{constructor(){this.uchar=" ",this.penState=new Gp}reset(){this.uchar=" ",this.penState.reset()}setChar(t,e){this.uchar=t,this.penState.copy(e)}setPenState(t){this.penState.copy(t)}equals(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)}copy(t){this.uchar=t.uchar,this.penState.copy(t.penState)}isEmpty(){return" "===this.uchar&&this.penState.isDefault()}}class Kp{constructor(t){this.chars=[],this.pos=0,this.currPenState=new Gp,this.cueStartTime=null,this.logger=void 0;for(let e=0;e<Bp;e++)this.chars.push(new Qp);this.logger=t}equals(t){for(let e=0;e<Bp;e++)if(!this.chars[e].equals(t.chars[e]))return!1;return!0}copy(t){for(let e=0;e<Bp;e++)this.chars[e].copy(t.chars[e])}isEmpty(){let t=!0;for(let e=0;e<Bp;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t}setCursor(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Bp&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Bp)}moveCursor(t){const e=this.pos+t;if(t>1)for(let i=this.pos+1;i<e+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(e)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(t){t>=144&&this.backSpace();const e=Mp(t);this.pos>=Bp?this.logger.log(0,()=>"Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))}clearFromPos(t){let e;for(e=t;e<Bp;e++)this.chars[e].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const t=[];let e=!0;for(let i=0;i<Bp;i++){const s=this.chars[i].uchar;" "!==s&&(e=!1),t.push(s)}return e?"":t.join("")}setPenStyles(t){this.currPenState.setStyles(t);this.chars[this.pos].setPenState(this.currPenState)}}class qp{constructor(t){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let e=0;e<Op;e++)this.rows.push(new Kp(t));this.logger=t}reset(){for(let t=0;t<Op;t++)this.rows[t].clear();this.currRow=14}equals(t){let e=!0;for(let i=0;i<Op;i++)if(!this.rows[i].equals(t.rows[i])){e=!1;break}return e}copy(t){for(let e=0;e<Op;e++)this.rows[e].copy(t.rows[e])}isEmpty(){let t=!0;for(let e=0;e<Op;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(t){this.rows[this.currRow].insertChar(t)}setPen(t){this.rows[this.currRow].setPenStyles(t)}moveCursor(t){this.rows[this.currRow].moveCursor(t)}setCursor(t){this.logger.log(2,"setCursor: "+t);this.rows[this.currRow].setCursor(t)}setPAC(t){this.logger.log(2,()=>"pacData = "+Qh(t));let e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(let e=0;e<Op;e++)this.rows[e].clear();const t=this.currRow+1-this.nrRollUpRows,i=this.lastOutputScreen;if(i){const s=i.rows[t].cueStartTime,r=this.logger.time;if(null!==s&&null!==r&&s<r)for(let n=0;n<this.nrRollUpRows;n++)this.rows[e-this.nrRollUpRows+n+1].copy(i.rows[t+n])}}this.currRow=e;const i=this.rows[this.currRow];if(null!==t.indent){const e=t.indent,s=Math.max(e-1,0);i.setCursor(t.indent),t.color=i.chars[s].penState.foreground}const s={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(s)}setBkgData(t){this.logger.log(2,()=>"bkgData = "+Qh(t)),this.backSpace(),this.setPen(t),this.insertChar(32)}setRollUpRows(t){this.nrRollUpRows=t}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,()=>this.getDisplayText());const t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),this.logger.log(2,"Rolling up")}getDisplayText(t){t=t||!1;const e=[];let i="",s=-1;for(let r=0;r<Op;r++){const i=this.rows[r].getTextString();i&&(s=r+1,t?e.push("Row "+s+": '"+i+"'"):e.push(i.trim()))}return e.length>0&&(i=t?"["+e.join(" | ")+"]":e.join("\n")),i}getTextAndFormat(){return this.rows}}class Wp{constructor(t,e,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new qp(i),this.nonDisplayedMemory=new qp(i),this.lastOutputScreen=new qp(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(t){this.outputFilter=t}setPAC(t){this.writeScreen.setPAC(t)}setBkgData(t){this.writeScreen.setBkgData(t)}setMode(t){t!==this.mode&&(this.mode=t,this.logger.log(2,()=>"MODE="+t),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)}insertChars(t){for(let i=0;i<t.length;i++)this.writeScreen.insertChar(t[i]);const e=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>e+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(t){this.logger.log(2,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(t){this.logger.log(2,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)}ccMIDROW(t){const e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{const i=Math.floor(t/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=s[i]}this.logger.log(2,"MIDROW: "+Qh(e)),this.writeScreen.setPen(e)}outputDataUpdate(t=!1){const e=this.logger.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))}}class Yp{constructor(t,e,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const s=this.logger=new jp;this.channels=[null,new Wp(t,e,s),new Wp(t+1,i,s)]}getHandler(t){return this.channels[t].getHandler()}setHandler(t,e){this.channels[t].setHandler(e)}addData(t,e){this.logger.time=t;for(let i=0;i<e.length;i+=2){const t=127&e[i],s=127&e[i+1];let r=!1,n=null;if(0===t&&0===s)continue;this.logger.log(3,()=>"["+Vp([e[i],e[i+1]])+"] -> ("+Vp([t,s])+")");const a=this.cmdHistory;if(t>=16&&t<=31){if(zp(t,s,a)){$p(null,null,a),this.logger.log(3,()=>"Repeated command ("+Vp([t,s])+") is dropped");continue}$p(t,s,this.cmdHistory),r=this.parseCmd(t,s),r||(r=this.parseMidrow(t,s)),r||(r=this.parsePAC(t,s)),r||(r=this.parseBackgroundAttributes(t,s))}else $p(null,null,a);if(!r&&(n=this.parseChars(t,s),n)){const t=this.currentChannel;if(t&&t>0){this.channels[t].insertChars(n)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}r||n||this.logger.log(2,()=>"Couldn't parse cleaned data "+Vp([t,s])+" orig: "+Vp([e[i],e[i+1]]))}}parseCmd(t,e){if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47)&&!((23===t||31===t)&&e>=33&&e<=35))return!1;const i=20===t||21===t||23===t?1:2,s=this.channels[i];return 20===t||21===t||28===t||29===t?32===e?s.ccRCL():33===e?s.ccBS():34===e?s.ccAOF():35===e?s.ccAON():36===e?s.ccDER():37===e?s.ccRU(2):38===e?s.ccRU(3):39===e?s.ccRU(4):40===e?s.ccFON():41===e?s.ccRDC():42===e?s.ccTR():43===e?s.ccRTD():44===e?s.ccEDM():45===e?s.ccCR():46===e?s.ccENM():47===e&&s.ccEOC():s.ccTO(e-32),this.currentChannel=i,!0}parseMidrow(t,e){let i=0;if((17===t||25===t)&&e>=32&&e<=47){if(i=17===t?1:2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[i];return!!s&&(s.ccMIDROW(e),this.logger.log(3,()=>"MIDROW ("+Vp([t,e])+")"),!0)}return!1}parsePAC(t,e){let i;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127)&&!((16===t||24===t)&&e>=64&&e<=95))return!1;const s=t<=23?1:2;i=e>=64&&e<=95?1===s?Fp[t]:_p[t]:1===s?Np[t]:Up[t];const r=this.channels[s];return!!r&&(r.setPAC(this.interpretPAC(i,e)),this.currentChannel=s,!0)}interpretPAC(t,e){let i;const s={color:null,italics:!1,indent:null,underline:!1,row:t};return i=e>95?e-96:e-64,s.underline=!(1&~i),i<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(s.italics=!0,s.color="white"):s.indent=4*Math.floor((i-16)/2),s}parseChars(t,e){let i,s=null,r=null;if(t>=25?(i=2,r=t-8):(i=1,r=t),r>=17&&r<=19){let t;t=17===r?e+80:18===r?e+112:e+144,this.logger.log(2,()=>"Special char '"+Mp(t)+"' in channel "+i),s=[t]}else t>=32&&t<=127&&(s=0===e?[t]:[t,e]);return s&&this.logger.log(3,()=>"Char codes = "+Vp(s).join(",")),s}parseBackgroundAttributes(t,e){if(!((16===t||24===t)&&e>=32&&e<=47)&&!((23===t||31===t)&&e>=45&&e<=47))return!1;let i;const s={};16===t||24===t?(i=Math.floor((e-32)/2),s.background=Hp[i],e%2==1&&(s.background=s.background+"_semi")):45===e?s.background="transparent":(s.foreground="black",47===e&&(s.underline=!0));const r=t<=23?1:2;return this.channels[r].setBkgData(s),!0}reset(){for(let t=0;t<Object.keys(this.channels).length;t++){const e=this.channels[t];e&&e.reset()}$p(null,null,this.cmdHistory)}cueSplitAtTime(t){for(let e=0;e<this.channels.length;e++){const i=this.channels[e];i&&i.cueSplitAtTime(t)}}}function $p(t,e,i){i.a=t,i.b=e}function zp(t,e,i){return i.a===t&&i.b===e}var Xp=function(){if(null!=hu&&hu.VTTCue)return self.VTTCue;const t=["","lr","rl"],e=["start","middle","end","left","right"];function i(t,e){if("string"!=typeof e)return!1;if(!Array.isArray(t))return!1;const i=e.toLowerCase();return!!~t.indexOf(i)&&i}function s(t){return i(e,t)}function r(t,...e){let i=1;for(;i<arguments.length;i++){const e=arguments[i];for(const i in e)t[i]=e[i]}return t}function n(e,n,a){const o=this,l={enumerable:!0};o.hasBeenReset=!1;let d="",h=!1,c=e,u=n,f=a,g=null,m="",p=!0,A="auto",v="start",y=50,E="middle",T=50,S="middle";Object.defineProperty(o,"id",r({},l,{get:function(){return d},set:function(t){d=""+t}})),Object.defineProperty(o,"pauseOnExit",r({},l,{get:function(){return h},set:function(t){h=!!t}})),Object.defineProperty(o,"startTime",r({},l,{get:function(){return c},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");c=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",r({},l,{get:function(){return u},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");u=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",r({},l,{get:function(){return f},set:function(t){f=""+t,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",r({},l,{get:function(){return g},set:function(t){g=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",r({},l,{get:function(){return m},set:function(e){const s=function(e){return i(t,e)}(e);if(!1===s)throw new SyntaxError("An invalid or illegal string was specified.");m=s,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",r({},l,{get:function(){return p},set:function(t){p=!!t,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",r({},l,{get:function(){return A},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");A=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",r({},l,{get:function(){return v},set:function(t){const e=s(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",r({},l,{get:function(){return y},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",r({},l,{get:function(){return E},set:function(t){const e=s(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",r({},l,{get:function(){return T},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");T=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",r({},l,{get:function(){return S},set:function(t){const e=s(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");S=e,this.hasBeenReset=!0}})),o.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n}();class Zp{decode(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}function Jp(t){function e(t,e,i,s){return 3600*(0|t)+60*(0|e)+(0|i)+parseFloat(s||0)}const i=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?e(i[2],i[3],0,i[4]):e(i[1],i[2],i[3],i[4]):null}class tA{constructor(){this.values=Object.create(null)}set(t,e){this.get(t)||""===e||(this.values[t]=e)}get(t,e,i){return i?this.has(t)?this.values[t]:e[i]:this.has(t)?this.values[t]:e}has(t){return t in this.values}alt(t,e,i){for(let s=0;s<i.length;++s)if(e===i[s]){this.set(t,e);break}}integer(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))}percent(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){const i=parseFloat(e);if(i>=0&&i<=100)return this.set(t,i),!0}return!1}}function eA(t,e,i,s){const r=s?t.split(s):[t];for(const n in r){if("string"!=typeof r[n])continue;const t=r[n].split(i);if(2!==t.length)continue;e(t[0],t[1])}}const iA=new Xp(0,0,""),sA="middle"===iA.align?"middle":"center";function rA(t,e,i){const s=t;function r(){const e=Jp(t);if(null===e)throw new Error("Malformed timestamp: "+s);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function n(){t=t.replace(/^\s+/,"")}if(n(),e.startTime=r(),n(),"--\x3e"!==t.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);t=t.slice(3),n(),e.endTime=r(),n(),function(t,e){const s=new tA;eA(t,function(t,e){let r;switch(t){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===e){s.set(t,i[r].region);break}break;case"vertical":s.alt(t,e,["rl","lr"]);break;case"line":r=e.split(","),s.integer(t,r[0]),s.percent(t,r[0])&&s.set("snapToLines",!1),s.alt(t,r[0],["auto"]),2===r.length&&s.alt("lineAlign",r[1],["start",sA,"end"]);break;case"position":r=e.split(","),s.percent(t,r[0]),2===r.length&&s.alt("positionAlign",r[1],["start",sA,"end","line-left","line-right","auto"]);break;case"size":s.percent(t,e);break;case"align":s.alt(t,e,["start",sA,"end","left","right"])}},/:/,/\s/),e.region=s.get("region",null),e.vertical=s.get("vertical","");let r=s.get("line","auto");"auto"===r&&-1===iA.line&&(r=-1),e.line=r,e.lineAlign=s.get("lineAlign","start"),e.snapToLines=s.get("snapToLines",!0),e.size=s.get("size",100),e.align=s.get("align",sA);let n=s.get("position","auto");"auto"===n&&50===iA.position&&(n="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=n}(t,e)}function nA(t){return t.replace(/<br(?: \/)?>/gi,"\n")}class aA{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Zp,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(t){const e=this;function i(){let t=e.buffer,i=0;for(t=nA(t);i<t.length&&"\r"!==t[i]&&"\n"!==t[i];)++i;const s=t.slice(0,i);return"\r"===t[i]&&++i,"\n"===t[i]&&++i,e.buffer=t.slice(i),s}function s(t){eA(t,function(t,e){},/:/)}t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));try{let t="";if("INITIAL"===e.state){if(!/\r\n|\n/.test(e.buffer))return this;t=i();const s=t.match(/^()?WEBVTT([ \t].*)?$/);if(null==s||!s[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}let n=!1;for(;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(n?n=!1:t=i(),e.state){case"HEADER":/:/.test(t)?s(t):t||(e.state="ID");continue;case"NOTE":t||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(t)){e.state="NOTE";break}if(!t)continue;if(e.cue=new Xp(0,0,""),e.state="CUE",-1===t.indexOf("--\x3e")){e.cue.id=t;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{rA(t,e.cue,e.regionList)}catch(r){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{const i=-1!==t.indexOf("--\x3e");if(!t||i&&(n=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(null===e.cue)continue;e.cue.text&&(e.cue.text+="\n"),e.cue.text+=t}continue;case"BADCUE":t||(e.state="ID")}}}catch(r){"CUETEXT"===e.state&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state="INITIAL"===e.state?"BADWEBVTT":"BADCUE"}return this}flush(){const t=this;try{if((t.cue||"HEADER"===t.state)&&(t.buffer+="\n\n",t.parse()),"INITIAL"===t.state||"BADWEBVTT"===t.state)throw new Error("Malformed WebVTT signature.")}catch(e){t.onparsingerror&&t.onparsingerror(e)}return t.onflush&&t.onflush(),this}}const oA=/\r\n|\n\r|\n|\r/g,lA=function(t,e,i=0){return t.slice(i,i+e.length)===e};function dA(t,e,i){return pp(t.toString())+pp(e.toString())+pp(i)}function hA(t,e,i,s,r,n,a){const o=new aA,l=vd(new Uint8Array(t)).trim().replace(oA,"\n").split("\n"),d=[],h=e?function(t,e=1){return Mg(t,9e4,1/e)}(e.baseTime,e.timescale):0;let c,u="00:00.000",f=0,g=0,m=!0;o.oncue=function(t){const n=i[s];let a=i.ccOffset;const o=(f-h)/9e4;if(null!=n&&n.new&&(void 0!==g?a=i.ccOffset=n.start:function(t,e,i){let s=t[e],r=t[s.prevCC];if(!r||!r.new&&s.new)return t.ccOffset=t.presentationOffset=s.start,void(s.new=!1);for(;null!=(n=r)&&n.new;){var n;t.ccOffset+=s.start-r.start,s.new=!1,s=r,r=t[s.prevCC]}t.presentationOffset=i}(i,s,o)),o){if(!e)return void(c=new Error("Missing initPTS for VTT MPEGTS"));a=o-i.presentationOffset}const l=t.endTime-t.startTime,u=jg(9e4*(t.startTime+a-g),9e4*r)/9e4;t.startTime=Math.max(u,0),t.endTime=Math.max(u+l,0);const m=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(m)),t.id||(t.id=dA(t.startTime,t.endTime,m)),t.endTime>0&&d.push(t)},o.onparsingerror=function(t){c=t},o.onflush=function(){c?a(c):n(d)},l.forEach(t=>{if(m){if(lA(t,"X-TIMESTAMP-MAP=")){m=!1,t.slice(16).split(",").forEach(t=>{lA(t,"LOCAL:")?u=t.slice(6):lA(t,"MPEGTS:")&&(f=parseInt(t.slice(7)))});try{g=function(t){let e=parseInt(t.slice(-3));const i=parseInt(t.slice(-6,-4)),s=parseInt(t.slice(-9,-7)),r=t.length>9?parseInt(t.substring(0,t.indexOf(":"))):0;if(!(Ql(e)&&Ql(i)&&Ql(s)&&Ql(r)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${t}`);return e+=1e3*i,e+=6e4*s,e+=36e5*r,e}(u)/1e3}catch(e){c=e}return}""===t&&(m=!1)}o.parse(t+"\n")}),o.flush()}const cA="stpp.ttml.im1t",uA=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,fA=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,gA={left:"start",center:"center",right:"end",start:"start",end:"end"};function mA(t,e,i,s){const r=Wd(new Uint8Array(t),["mdat"]);if(0===r.length)return void s(new Error("Could not parse IMSC1 mdat"));const n=r.map(t=>vd(t)),a=function(t,e,i=1,s=!1){return Mg(t,e,1/i,s)}(e.baseTime,1,e.timescale);try{n.forEach(t=>i(function(t,e){const i=(new DOMParser).parseFromString(t,"text/xml"),s=i.getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},n=Object.keys(r).reduce((t,e)=>(t[e]=s.getAttribute(`ttp:${e}`)||r[e],t),{}),a="preserve"!==s.getAttribute("xml:space"),o=AA(pA(s,"styling","style")),l=AA(pA(s,"layout","region")),d=pA(s,"body","[begin]");return[].map.call(d,t=>{const i=vA(t,a);if(!i||!t.hasAttribute("begin"))return null;const s=TA(t.getAttribute("begin"),n),r=TA(t.getAttribute("dur"),n);let d=TA(t.getAttribute("end"),n);if(null===s)throw EA(t);if(null===d){if(null===r)throw EA(t);d=s+r}const h=new Xp(s-e,d-e,i);h.id=dA(h.startTime,h.endTime,h.text);const c=function(t,e,i){const s="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=t&&t.hasAttribute("style")?t.getAttribute("style"):null;a&&i.hasOwnProperty(a)&&(r=i[a]);return n.reduce((i,n)=>{const a=yA(e,s,n)||yA(t,s,n)||yA(r,s,n);return a&&(i[n]=a),i},{})}(l[t.getAttribute("region")],o[t.getAttribute("style")],o),{textAlign:u}=c;if(u){const t=gA[u];t&&(h.lineAlign=t),h.align=u}return ad(h,c),h}).filter(t=>null!==t)}(t,a)))}catch(o){s(o)}}function pA(t,e,i){const s=t.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(i)):[]}function AA(t){return t.reduce((t,e)=>{const i=e.getAttribute("xml:id");return i&&(t[i]=e),t},{})}function vA(t,e){return[].slice.call(t.childNodes).reduce((t,i,s)=>{var r;return"br"===i.nodeName&&s?t+"\n":null!=(r=i.childNodes)&&r.length?vA(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function yA(t,e,i){return t&&t.hasAttributeNS(e,i)?t.getAttributeNS(e,i):null}function EA(t){return new Error(`Could not parse ttml timestamp ${t}`)}function TA(t,e){if(!t)return null;let i=Jp(t);return null===i&&(uA.test(t)?i=function(t,e){const i=uA.exec(t),s=(0|i[4])+(0|i[5])/e.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+s/e.frameRate}(t,e):fA.test(t)&&(i=function(t,e){const i=fA.exec(t),s=Number(i[1]);switch(i[2]){case"h":return 3600*s;case"m":return 60*s;case"ms":return 1e3*s;case"f":return s/e.frameRate;case"t":return s/e.tickRate}return s}(t,e))),i}class SA{constructor(t,e){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=e}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(t,e,i){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}function bA(t){return t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}function IA(t,e){return!!t&&t.kind===bA(e)&&sm(e,t)}function LA(t,e,i,s){return Math.min(e,s)-Math.max(t,i)}const RA=/\s/,kA={newCue(t,e,i,s){const r=[];let n,a,o,l,d;const h=self.VTTCue||self.TextTrackCue;for(let u=0;u<s.rows.length;u++)if(n=s.rows[u],o=!0,l=0,d="",!n.isEmpty()){var c;for(let t=0;t<n.chars.length;t++)RA.test(n.chars[t].uchar)&&o?l++:(d+=n.chars[t].uchar,o=!1);n.cueStartTime=e,e===i&&(i+=1e-4),l>=16?l--:l++;const s=nA(d.trim()),f=dA(e,i,s);null!=t&&null!=(c=t.cues)&&c.getCueById(f)||(a=new h(e,i,s),a.id=f,a.line=u+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*l/32)),r.push(a))}return t&&r.length&&(r.sort((t,e)=>"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line),r.forEach(e=>up(t,e))),r}};const wA=/(\d+)-(\d+)\/(\d+)/;class DA{constructor(t){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=t.fetchSetup||CA,this.controller=new self.AbortController,this.stats=new Cd}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(t,e,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=function(t,e){const i={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(ad({},t.headers))};t.rangeEnd&&i.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1));return i}(t,this.controller.signal),n="arraybuffer"===t.responseType,a=n?"byteLength":"length",{maxTimeToFirstByteMs:o,maxLoadTimeMs:l}=e.loadPolicy;this.context=t,this.config=e,this.callbacks=i,this.request=this.fetchSetup(t,r),self.clearTimeout(this.requestTimeout),e.timeout=o&&Ql(o)?o:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,t,this.response))},e.timeout);($g(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(i=>{var r;this.response=this.loader=i;const a=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),e.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,t,this.response))},l-(a-s.loading.start)),!i.ok){const{status:t,statusText:e}=i;throw new xA(e||"fetch, bad network response",t,i)}s.loading.first=a,s.total=function(t){const e=t.get("Content-Range");if(e){const t=function(t){const e=wA.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}(e);if(Ql(t))return t}const i=t.get("Content-Length");if(i)return parseInt(i)}(i.headers)||s.total;const o=null==(r=this.callbacks)?void 0:r.onProgress;return o&&Ql(e.highWaterMark)?this.loadProgressively(i,s,t,e.highWaterMark,o):n?i.arrayBuffer():"json"===t.responseType?i.json():i.text()}).then(i=>{var r,n;const o=this.response;if(!o)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=i[a];l&&(s.loaded=s.total=l);const d={url:o.url,data:i,code:o.status},h=null==(r=this.callbacks)?void 0:r.onProgress;h&&!Ql(e.highWaterMark)&&h(s,t,i,o),null==(n=this.callbacks)||n.onSuccess(d,s,t,o)}).catch(e=>{var i;if(self.clearTimeout(this.requestTimeout),s.aborted)return;const r=e&&e.code||0,n=e?e.message:null;null==(i=this.callbacks)||i.onError({code:r,text:n},t,e?e.details:null,s)})}getCacheAge(){let t=null;if(this.response){const e=this.response.headers.get("age");t=e?parseFloat(e):null}return t}getResponseHeader(t){return this.response?this.response.headers.get(t):null}loadProgressively(t,e,i,s=0,r){const n=new If,a=t.body.getReader(),o=()=>a.read().then(a=>{if(a.done)return n.dataLength&&r(e,i,n.flush().buffer,t),Promise.resolve(new ArrayBuffer(0));const l=a.value,d=l.length;return e.loaded+=d,d<s||n.dataLength?(n.push(l),n.dataLength>=s&&r(e,i,n.flush().buffer,t)):r(e,i,l.buffer,t),o()}).catch(()=>Promise.reject());return o()}}function CA(t,e){return new self.Request(t.url,e)}class xA extends Error{constructor(t,e,i){super(t),this.code=void 0,this.details=void 0,this.code=e,this.details=i}}const PA=/^age:\s*[\d.]+\s*$/im;class MA{constructor(t){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=t&&t.xhrSetup||null,this.stats=new Cd,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))}abort(){var t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(t,e,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:t,context:e}=this;if(!t||!e)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(this.loader===i&&!this.stats.aborted)return r(i,e.url)}).catch(t=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",e.url,!0),r(i,e.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,e,t)}).catch(t=>{var r;null==(r=this.callbacks)||r.onError({code:i.status,text:t.message},e,i,s)}):this.openAndSendXhr(i,e,t)}openAndSendXhr(t,e,i){t.readyState||t.open("GET",e.url,!0);const s=e.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:n}=i.loadPolicy;if(s)for(const a in s)t.setRequestHeader(a,s[a]);e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=e.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&Ql(r)?r:n,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),t.send()}readystatechange(){const{context:t,loader:e,stats:i}=this;if(!t||!e)return;const s=e.readyState,r=this.config;if(!i.aborted&&s>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===s)){self.clearTimeout(this.requestTimeout),e.onreadystatechange=null,e.onprogress=null;const s=e.status,l="text"===e.responseType?e.responseText:null;if(s>=200&&s<300){const r=null!=l?l:e.response;if(null!=r){var n,a;i.loading.end=Math.max(self.performance.now(),i.loading.first);const o="arraybuffer"===e.responseType?r.byteLength:r.length;i.loaded=i.total=o,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first);const l=null==(n=this.callbacks)?void 0:n.onProgress;l&&l(i,t,r,e);const d={url:e.responseURL,data:r,code:s};return void(null==(a=this.callbacks)||a.onSuccess(d,i,t,e))}}const d=r.loadPolicy.errorRetry;var o;if(hc(d,i.retry,!1,{url:t.url,data:void 0,code:s}))this.retry(d);else md.error(`${s} while loading ${t.url}`),null==(o=this.callbacks)||o.onError({code:s,text:e.statusText},t,e,i)}}loadtimeout(){if(!this.config)return;const t=this.config.loadPolicy.timeoutRetry;if(hc(t,this.stats.retry,!0))this.retry(t);else{var e;md.warn(`timeout while loading ${null==(e=this.context)?void 0:e.url}`);const t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))}}retry(t){const{context:e,stats:i}=this;this.retryDelay=lc(t,i.retry),i.retry++,md.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==e?void 0:e.url}, retrying ${i.retry}/${t.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(t){const e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)}getCacheAge(){let t=null;if(this.loader&&PA.test(this.loader.getAllResponseHeaders())){const e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t}getResponseHeader(t){return this.loader&&new RegExp(`^${t}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(t):null}}const OA=ld(ld({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:6e7,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:MA,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class extends dd{constructor(t){super("abr",t.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var e;const{fragCurrent:i,partCurrent:s,hls:r}=this,{autoLevelEnabled:n,media:a}=r;if(!i||!a)return;const o=performance.now(),l=s?s.stats:i.stats,d=s?s.duration:i.duration,h=o-l.loading.start,c=r.minAutoLevel,u=i.level,f=this._nextAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||u<=c)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!n)return;const g=f>-1&&f!==u,m=!!t||g;if(!m&&(a.paused||!a.playbackRate||!a.readyState))return;const p=r.mainForwardBufferInfo;if(!m&&null===p)return;const A=this.bwEstimator.getEstimateTTFB(),v=Math.abs(a.playbackRate);if(h<=Math.max(A,d/(2*v)*1e3))return;const y=p?p.len/v:0,E=l.loading.first?l.loading.first-l.loading.start:-1,T=l.loaded&&E>-1,S=this.getBwEstimate(),b=r.levels,I=b[u],L=Math.max(l.loaded,Math.round(d*(i.bitrate||I.averageBitrate)/8));let R=T?h-E:h;R<1&&T&&(R=Math.min(h,8*l.loaded/S));const k=T?1e3*l.loaded/R:0,w=A/1e3,D=k?(L-l.loaded)/k:8*L/S+w;if(D<=y)return;const C=k?8*k:S,x=!0===(null==(e=(null==t?void 0:t.details)||this.hls.latestLevelDetails)?void 0:e.live),P=this.hls.config.abrBandWidthUpFactor;let M,O=Number.POSITIVE_INFINITY;for(M=u-1;M>c;M--){const t=b[M].maxBitrate,e=!b[M].details||x;if(O=this.getTimeToLoadFrag(w,C,d*t,e),O<Math.min(y,d+w))break}if(O>=D)return;if(O>10*d)return;T?this.bwEstimator.sample(h-Math.min(A,E),l.loaded):this.bwEstimator.sampleTTFB(h);const B=b[M].maxBitrate;this.getBwEstimate()*P>B&&this.resetEstimator(B);const F=this.findBestLevel(B,c,M,0,y,1,1);F>-1&&(M=F),this.warn(`Fragment ${i.sn}${s?" part "+s.index:""} of level ${u} is loading too slowly;\n Fragment duration: ${i.duration.toFixed(3)}\n Time to underbuffer: ${y.toFixed(3)} s\n Estimated load time for current fragment: ${D.toFixed(3)} s\n Estimated load time for down switch fragment: ${O.toFixed(3)} s\n TTFB estimate: ${0|E} ms\n Current BW estimate: ${Ql(S)?0|S:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${M} @ ${0|B} bps`),r.nextLoadLevel=r.nextAutoLevel=M,this.clearTimer();const N=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===M&&M>0){const t=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${M>0?"and switching down":""}\n Fragment duration: ${i.duration.toFixed(3)} s\n Time to underbuffer: ${t.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,M>c){let e=this.findBestLevel(this.hls.levels[c].bitrate,c,M,0,t,1,1);-1===e&&(e=c),this.hls.nextLoadLevel=this.hls.nextAutoLevel=e,this.resetEstimator(this.hls.levels[e].bitrate)}}};g||D>2*O?N():this.timer=self.setInterval(N,1e3*O),r.trigger($l.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:s,stats:l})},this.hls=t,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(t){t&&(this.log(`setting initial bwe to ${t}`),this.hls.config.abrEwmaDefaultEstimate=t),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const t=this.hls.config;return new rd(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate)}registerListeners(){const{hls:t}=this;t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.FRAG_LOADING,this.onFragLoading,this),t.on($l.FRAG_LOADED,this.onFragLoaded,this),t.on($l.FRAG_BUFFERED,this.onFragBuffered,this),t.on($l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on($l.LEVEL_LOADED,this.onLevelLoaded,this),t.on($l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on($l.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.on($l.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t&&(t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.FRAG_LOADING,this.onFragLoading,this),t.off($l.FRAG_LOADED,this.onFragLoaded,this),t.off($l.FRAG_BUFFERED,this.onFragBuffered,this),t.off($l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off($l.LEVEL_LOADED,this.onLevelLoaded,this),t.off($l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off($l.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.off($l.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(t,e){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(t,e){const i=e.frag;if(!this.ignoreFragment(i)){var s;if(!i.bitrateTest)this.fragCurrent=i,this.partCurrent=null!=(s=e.part)?s:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(t,e){this.clearTimer()}onError(t,e){if(!e.fatal)switch(e.details){case Yl.BUFFER_ADD_CODEC_ERROR:case Yl.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Yl.FRAG_LOAD_TIMEOUT:{const t=e.frag,{fragCurrent:i,partCurrent:s}=this;if(t&&i&&t.sn===i.sn&&t.level===i.level){const e=performance.now(),i=s?s.stats:t.stats,r=e-i.loading.start,n=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&n>-1){const t=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(r-Math.min(t,n),i.loaded)}else this.bwEstimator.sampleTTFB(r)}break}}}getTimeToLoadFrag(t,e,i,s){return t+i/e+(s?t+this.lastLevelLoadSec:0)}onLevelLoaded(t,e){const i=this.hls.config,{loading:s}=e.stats,r=s.end-s.first;Ql(r)&&(this.lastLevelLoadSec=r/1e3),e.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(e.levelInfo)}onFragLoaded(t,{frag:e,part:i}){const s=i?i.stats:e.stats;if(e.type===td&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(e)){if(this.clearTimer(),e.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const t=i?i.duration:e.duration,r=this.hls.levels[e.level],n=(r.loaded?r.loaded.bytes:0)+s.loaded,a=(r.loaded?r.loaded.duration:0)+t;r.loaded={bytes:n,duration:a},r.realBitrate=Math.round(8*n/a)}if(e.bitrateTest){const t={stats:s,frag:e,part:i,id:e.type};this.onFragBuffered($l.FRAG_BUFFERED,t),e.bitrateTest=!1}else this.lastLoadedFragLevel=e.level}}onFragBuffered(t,e){const{frag:i,part:s}=e,r=null!=s&&s.stats.loaded?s.stats:i.stats;if(r.aborted)return;if(this.ignoreFragment(i))return;const n=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=n/1e3:this.bitrateTestDelay=0}ignoreFragment(t){return t.type!==td||"initSegment"===t.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:t,minAutoLevel:e}=this.hls,i=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,e,t,0,s,1,1);if(r>-1)return r;const n=this.hls.firstLevel,a=Math.min(Math.max(n,e),t);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${n} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const t=this.forcedAutoLevel,e=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(!(-1===t||e&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return t;const s=e&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==t){const e=this.hls.levels;if(e.length>Math.max(t,s)&&e[t].loadError<=e[s].loadError)return t}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:t,partCurrent:e,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:s,config:r,minAutoLevel:n}=i,a=e?e.duration:t?t.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay();let d=r.abrBandWidthFactor,h=r.abrBandWidthUpFactor;if(l){const t=this.findBestLevel(o,n,s,l,0,d,h);if(t>=0)return this.rebufferNotice=-1,t}let c=a?Math.min(a,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const t=this.bitrateTestDelay;if(t){c=(a?Math.min(a,r.maxLoadingDelay):r.maxLoadingDelay)-t,this.info(`bitrate test took ${Math.round(1e3*t)}ms, set first fragment max fetchDuration to ${Math.round(1e3*c)} ms`),d=h=1}}const u=this.findBestLevel(o,n,s,l,c,d,h);if(this.rebufferNotice!==u&&(this.rebufferNotice=u,this.info(`${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${u}`)),u>-1)return u;const f=i.levels[n],g=i.loadLevelObj;return g&&(null==f?void 0:f.bitrate)<g.bitrate?n:i.loadLevel}getStarvationDelay(){const t=this.hls,e=t.media;if(!e)return 1/0;const i=e&&0!==e.playbackRate?Math.abs(e.playbackRate):1,s=t.mainForwardBufferInfo;return(s?s.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(t,e,i,s,r,n,a){var o;const l=s+r,d=this.lastLoadedFragLevel,h=-1===d?this.hls.firstLevel:d,{fragCurrent:c,partCurrent:u}=this,{levels:f,allAudioTracks:g,loadLevel:m,config:p}=this.hls;if(1===f.length)return 0;const A=f[h],v=!(null==(o=this.hls.latestLevelDetails)||!o.live),y=-1===m||-1===d;let E,T="SDR",S=(null==A?void 0:A.frameRate)||0;const{audioPreference:b,videoPreference:I}=p,L=this.audioTracksByGroup||(this.audioTracksByGroup=qh(g));let R=-1;if(y){if(-1!==this.firstSelection)return this.firstSelection;const s=this.codecTiers||(this.codecTiers=function(t,e,i,s){return t.slice(i,s+1).reduce((t,i,s)=>{if(!i.codecSet)return t;const r=i.audioGroups;let n=t[i.codecSet];n||(t[i.codecSet]=n={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:s,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!r,fragmentError:0}),n.minBitrate=Math.min(n.minBitrate,i.bitrate);const a=Math.min(i.height,i.width);return n.minHeight=Math.min(n.minHeight,a),n.minFramerate=Math.min(n.minFramerate,i.frameRate),n.minIndex=Math.min(n.minIndex,s),n.maxScore=Math.max(n.maxScore,i.score),n.fragmentError+=i.fragmentError,n.videoRanges[i.videoRange]=(n.videoRanges[i.videoRange]||0)+1,r&&r.forEach(t=>{if(!t)return;const i=e.groups[t];i&&(n.hasDefaultAudio=n.hasDefaultAudio||e.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(i.channels).forEach(t=>{n.channels[t]=(n.channels[t]||0)+i.channels[t]}))}),t},{})}(f,L,e,i)),r=function(t,e,i,s,r){const n=Object.keys(t),a=null==s?void 0:s.channels,o=null==s?void 0:s.audioCodec,l=null==r?void 0:r.videoCodec,d=a&&2===parseInt(a);let h=!1,c=!1,u=1/0,f=1/0,g=1/0,m=1/0,p=0,A=[];const{preferHDR:v,allowedVideoRanges:y}=Gh(e,r);for(let b=n.length;b--;){const e=t[n[b]];h||(h=e.channels[2]>0),u=Math.min(u,e.minHeight),f=Math.min(f,e.minFramerate),g=Math.min(g,e.minBitrate),y.filter(t=>e.videoRanges[t]>0).length>0&&(c=!0)}u=Ql(u)?u:0,f=Ql(f)?f:0;const E=Math.max(1080,u),T=Math.max(30,f);g=Ql(g)?g:i,i=Math.max(g,i),c||(e=void 0);const S=n.length>1;return{codecSet:n.reduce((e,s)=>{const r=t[s];if(s===e)return e;if(A=c?y.filter(t=>r.videoRanges[t]>0):[],S){if(r.minBitrate>i)return Kh(s,`min bitrate of ${r.minBitrate} > current estimate of ${i}`),e;if(!r.hasDefaultAudio)return Kh(s,"no renditions with default or auto-select sound found"),e;if(o&&s.indexOf(o.substring(0,4))%5!=0)return Kh(s,`audio codec preference "${o}" not found`),e;if(a&&!d){if(!r.channels[a])return Kh(s,`no renditions with ${a} channel sound found (channels options: ${Object.keys(r.channels)})`),e}else if((!o||d)&&h&&0===r.channels[2])return Kh(s,"no renditions with stereo sound found"),e;if(r.minHeight>E)return Kh(s,`min resolution of ${r.minHeight} > maximum of ${E}`),e;if(r.minFramerate>T)return Kh(s,`min framerate of ${r.minFramerate} > maximum of ${T}`),e;if(!A.some(t=>r.videoRanges[t]>0))return Kh(s,`no variants with VIDEO-RANGE of ${Qh(A)} found`),e;if(l&&s.indexOf(l.substring(0,4))%5!=0)return Kh(s,`video codec preference "${l}" not found`),e;if(r.maxScore<p)return Kh(s,`max score of ${r.maxScore} < selected max of ${p}`),e}return e&&(vh(s)>=vh(e)||r.fragmentError>t[e].fragmentError)?e:(m=r.minIndex,p=r.maxScore,s)},void 0),videoRanges:A,preferHDR:v,minFramerate:f,minBitrate:g,minIndex:m}}(s,T,t,b,I),{codecSet:n,videoRanges:a,minFramerate:o,minBitrate:l,minIndex:d,preferHDR:h}=r;R=d,E=n,T=h?a[a.length-1]:a[0],S=o,t=Math.max(t,l),this.log(`picked start tier ${Qh(r)}`)}else E=null==A?void 0:A.codecSet,T=null==A?void 0:A.videoRange;const k=u?u.duration:c?c.duration:0,w=this.bwEstimator.getEstimateTTFB()/1e3,D=[];for(let x=i;x>=e;x--){var C;const e=f[x],o=x>h;if(!e)continue;if(p.useMediaCapabilities&&!e.supportedResult&&!e.supportedPromise){const i=navigator.mediaCapabilities;"function"==typeof(null==i?void 0:i.decodingInfo)&&Ch(e,L,T,S,t,b)?(e.supportedPromise=xh(e,L,i,this.supportedCache),e.supportedPromise.then(t=>{if(!this.hls)return;e.supportedResult=t;const i=this.hls.levels,s=i.indexOf(e);t.error?this.warn(`MediaCapabilities decodingInfo error: "${t.error}" for level ${s} ${Qh(t)}`):t.supported?t.decodingInfoResults.some(t=>!1===t.smooth||!1===t.powerEfficient)&&this.log(`MediaCapabilities decodingInfo for level ${s} not smooth or powerEfficient: ${Qh(t)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${s} ${Qh(t)}`),s>-1&&i.length>1&&(this.log(`Removing unsupported level ${s}`),this.hls.removeLevel(s),-1===this.hls.loadLevel&&(this.hls.nextLoadLevel=0)))}).catch(t=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${t}`)})):e.supportedResult=wh}if((E&&e.codecSet!==E||T&&e.videoRange!==T||o&&S>e.frameRate||!o&&S>0&&S<e.frameRate||null!=(C=e.supportedResult)&&null!=(C=C.decodingInfoResults)&&C.some(t=>!1===t.smooth))&&(!y||x!==R)){D.push(x);continue}const c=e.details,g=(u?null==c?void 0:c.partTarget:null==c?void 0:c.averagetargetduration)||k;let A;A=o?a*t:n*t;const I=k&&s>=2*k&&0===r?e.averageBitrate:e.maxBitrate,P=this.getTimeToLoadFrag(w,A,I*g,void 0===c);if(A>=I&&(x===d||0===e.loadError&&0===e.fragmentError)&&(P<=w||!Ql(P)||v&&!this.bitrateTestDelay||P<l)){const t=this.forcedAutoLevel;return x===m||-1!==t&&t===m||(D.length&&this.trace(`Skipped level(s) ${D.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${f[D[0]].codecs}" ${f[D[0]].videoRange}; not compatible with "${E}" ${T}`),this.info(`switch candidate:${h}->${x} adjustedbw(${Math.round(A)})-bitrate=${Math.round(A-I)} ttfb:${w.toFixed(1)} avgDuration:${g.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${y} codecSet:${e.codecSet} videoRange:${e.videoRange} hls.loadLevel:${m}`)),y&&(this.firstSelection=x),x}}return-1}set nextAutoLevel(t){const e=this.deriveNextAutoLevel(t);this._nextAutoLevel!==e&&(this.nextAutoLevelKey="",this._nextAutoLevel=e)}deriveNextAutoLevel(t){const{maxAutoLevel:e,minAutoLevel:i}=this.hls;return Math.min(Math.max(t,i),e)}},bufferController:class extends dd{constructor(t,e){var i;super("buffer-controller",t.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=t=>{var e;this.hls&&"open"===(null==(e=this.mediaSource)?void 0:e.readyState)&&this.hls.pauseBuffering()},this._onStartStreaming=t=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=t=>{const{media:e,mediaSource:i}=this;t&&this.log("Media source opened"),e&&i&&(i.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger($l.MEDIA_ATTACHED,{media:e,mediaSource:i}),null!==this.mediaSource&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:t,_objectUrl:e}=this;t!==e&&this.error(`Media element src was set while attaching MediaSource (${e} > ${t})`)},this.hls=t,this.fragmentTracker=e,this.appendSource=(i=pd(t.config.preferManagedMediaSource),"undefined"!=typeof self&&i===self.ManagedMediaSource),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:t}=this;t.on($l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.MANIFEST_PARSED,this.onManifestParsed,this),t.on($l.BUFFER_RESET,this.onBufferReset,this),t.on($l.BUFFER_APPENDING,this.onBufferAppending,this),t.on($l.BUFFER_CODECS,this.onBufferCodecs,this),t.on($l.BUFFER_EOS,this.onBufferEos,this),t.on($l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on($l.LEVEL_UPDATED,this.onLevelUpdated,this),t.on($l.FRAG_PARSED,this.onFragParsed,this),t.on($l.FRAG_CHANGED,this.onFragChanged,this),t.on($l.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off($l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.MANIFEST_PARSED,this.onManifestParsed,this),t.off($l.BUFFER_RESET,this.onBufferReset,this),t.off($l.BUFFER_APPENDING,this.onBufferAppending,this),t.off($l.BUFFER_CODECS,this.onBufferCodecs,this),t.off($l.BUFFER_EOS,this.onBufferEos,this),t.off($l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off($l.LEVEL_UPDATED,this.onLevelUpdated,this),t.off($l.FRAG_PARSED,this.onFragParsed,this),t.off($l.FRAG_CHANGED,this.onFragChanged,this),t.off($l.ERROR,this.onError,this)}transferMedia(){const{media:t,mediaSource:e}=this;if(!t)return null;const i={};if(this.operationQueue){const t=this.isUpdating();t||this.operationQueue.removeBlockers();const e=this.isQueued();(t||e)&&this.warn(`Transfering MediaSource with${e?" operations in queue":""}${t?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const s=this.transferData;return!this.sourceBufferCount&&s&&s.mediaSource===e?ad(i,s.tracks):this.sourceBuffers.forEach(t=>{const[e]=t;e&&(i[e]=ad({},this.tracks[e]),this.removeBuffer(e)),t[0]=t[1]=null}),{media:t,mediaSource:e,tracks:i}}initTracks(){this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(t,e){var i;let s=2;(e.audio&&!e.video||!e.altAudio)&&(s=1),this.bufferCodecEventsTotal=s,this.log(`${s} bufferCodec event(s) expected.`),null!=(i=this.transferData)&&i.mediaSource&&this.sourceBufferCount&&s&&this.bufferCreated()}onMediaAttaching(t,e){const i=this.media=e.media;this.transferData=this.overrides=void 0;const s=pd(this.appendSource);if(s){const t=!!e.mediaSource;(t||e.overrides)&&(this.transferData=e,this.overrides=e.overrides);const n=this.mediaSource=e.mediaSource||new s;if(this.assignMediaSource(n),t)this._objectUrl=i.src,this.attachTransferred();else{const t=this._objectUrl=self.URL.createObjectURL(n);if(this.appendSource)try{i.removeAttribute("src");const e=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||e&&n instanceof e,lm(i),function(t,e){const i=self.document.createElement("source");i.type="video/mp4",i.src=e,t.appendChild(i)}(i,t),i.load()}catch(r){i.src=t}else i.src=t}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(t){var e,i;this.log(`${(null==(e=this.transferData)?void 0:e.mediaSource)===t?"transferred":"created"} media source: ${null==(i=t.constructor)?void 0:i.name}`),t.addEventListener("sourceopen",this._onMediaSourceOpen),t.addEventListener("sourceended",this._onMediaSourceEnded),t.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.addEventListener("startstreaming",this._onStartStreaming),t.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const t=this.media,e=this.transferData;if(!e||!t)return;const i=this.tracks,s=e.tracks,r=s?Object.keys(s):null,n=r?r.length:0,a=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(s&&r&&n){if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})\nrequired tracks: ${Qh(i,(t,e)=>"initSegment"===t?void 0:e)};\ntransfer tracks: ${Qh(s,(t,e)=>"initSegment"===t?void 0:e)}}`),!Ad(s,i)){e.mediaSource=null,e.tracks=void 0;const r=t.currentTime,n=this.details,a=Math.max(r,(null==n?void 0:n.fragments[0].start)||0);return a-r>1?void this.log(`attachTransferred: waiting for playback to reach new tracks start time ${r} -> ${a}`):(this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(s)}"->"${Object.keys(i)}") start time: ${a} currentTime: ${r}`),this.onMediaDetaching($l.MEDIA_DETACHING,{}),this.onMediaAttaching($l.MEDIA_ATTACHING,e),void(t.currentTime=a))}this.transferData=void 0,r.forEach(t=>{const e=t,i=s[e];if(i){const t=i.buffer;if(t){const s=this.fragmentTracker,r=i.id;if(s.hasFragments(r)||s.hasParts(r)){const i=Gc.getBuffered(t);s.detectEvictedFragments(e,i,r,null,!0)}const n=dm(e),a=[e,t];this.sourceBuffers[n]=a,t.updating&&this.operationQueue&&this.operationQueue.prependBlocker(e),this.trackSourceBuffer(e,i)}}}),a(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),a()}get mediaSourceOpenOrEnded(){var t;const e=null==(t=this.mediaSource)?void 0:t.readyState;return"open"===e||"ended"===e}onMediaDetaching(t,e){const i=!!e.transferMedia;this.transferData=this.overrides=void 0;const{media:s,mediaSource:r,_objectUrl:n}=this;if(r){if(this.log("media source "+(i?"transferring":"detaching")),i)this.sourceBuffers.forEach(([t])=>{t&&this.removeBuffer(t)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const t="open"===r.readyState;try{const e=r.sourceBuffers;for(let i=e.length;i--;)t&&e[i].abort(),r.removeSourceBuffer(e[i]);t&&r.endOfStream()}catch(PE){this.warn(`onMediaDetaching: ${PE.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}r.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("sourceended",this._onMediaSourceEnded),r.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.removeEventListener("startstreaming",this._onStartStreaming),r.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}s&&(s.removeEventListener("emptied",this._onMediaEmptied),i||(n&&self.URL.revokeObjectURL(n),this.mediaSrc===n?(s.removeAttribute("src"),this.appendSource&&lm(s),s.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger($l.MEDIA_DETACHED,e)}onBufferReset(){this.sourceBuffers.forEach(([t])=>{t&&this.resetBuffer(t)}),this.initTracks()}resetBuffer(t){var e;const i=null==(e=this.tracks[t])?void 0:e.buffer;if(this.removeBuffer(t),i)try{var s;null!=(s=this.mediaSource)&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(PE){this.warn(`onBufferReset ${t}`,PE)}delete this.tracks[t]}removeBuffer(t){this.removeBufferListeners(t),this.sourceBuffers[dm(t)]=[null,null];const e=this.tracks[t];e&&(e.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new rm(this.tracks)}onBufferCodecs(t,e){var i;const s=this.tracks,r=Object.keys(e);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const n="audiovideo"in e&&(s.audio||s.video)||s.audiovideo&&("audio"in e||"video"in e),a=!n&&this.sourceBufferCount&&this.media&&r.some(t=>!s[t]);n||a?this.warn(`Unsupported transition between "${Object.keys(s)}" and "${r}" SourceBuffers`):(r.forEach(t=>{var i,r;const n=e[t],{id:a,codec:o,levelCodec:l,container:d,metadata:h,supplemental:c}=n;let u=s[t];const f=null==(i=this.transferData)||null==(i=i.tracks)?void 0:i[t],g=null!=f&&f.buffer?f:u,m=(null==g?void 0:g.pendingCodec)||(null==g?void 0:g.codec),p=null==g?void 0:g.levelCodec;u||(u=s[t]={buffer:void 0,listeners:[],codec:o,supplemental:c,container:d,levelCodec:l,metadata:h,id:a});const A=Sh(m,p),v=null==A?void 0:A.replace(nm,"$1");let y=Sh(o,l);const E=null==(r=y)?void 0:r.replace(nm,"$1");y&&A&&v!==E&&("audio"===t.slice(0,5)&&(y=Th(y,this.appendSource)),this.log(`switching codec ${m} to ${y}`),y!==(u.pendingCodec||u.codec)&&(u.pendingCodec=y),u.container=d,this.appendChangeType(t,d,y))}),(this.tracksReady||this.sourceBufferCount)&&(e.tracks=this.sourceBufferTracks),this.sourceBufferCount||(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!e.video&&"main"===(null==(i=e.audio)?void 0:i.id)&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks()))}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((t,e)=>{const i=this.tracks[e];return t[e]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},t},{})}appendChangeType(t,e,i){const s=`${e};codecs=${i}`,r={label:`change-type=${s}`,execute:()=>{const r=this.tracks[t];if(r){const n=r.buffer;null!=n&&n.changeType&&(this.log(`changing ${t} sourceBuffer type to ${s}`),n.changeType(s),r.codec=i,r.container=e)}this.shiftAndExecuteNext(t)},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn(`Failed to change ${t} SourceBuffer type`,e)}};this.append(r,t,this.isPending(this.tracks[t]))}blockAudio(t){var e;const i=t.start,s=i+.05*t.duration;if(!0===(null==(e=this.fragmentTracker.getAppendedFrag(i,td))?void 0:e.gap))return;const r={label:"block-audio",execute:()=>{var t;const e=this.tracks.video;(this.lastVideoAppendEnd>s||null!=e&&e.buffer&&Gc.isBuffered(e.buffer,s)||!0===(null==(t=this.fragmentTracker.getAppendedFrag(s,td))?void 0:t.gap))&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn("Error executing block-audio operation",t)}};this.blockedAudioAppend={op:r,frag:t},this.append(r,"audio",!0)}unblockAudio(){const{blockedAudioAppend:t,operationQueue:e}=this;t&&e&&(this.blockedAudioAppend=null,e.unblockAudio(t.op))}onBufferAppending(t,e){const{tracks:i}=this,{data:s,type:r,parent:n,frag:a,part:o,chunkMeta:l,offset:d}=e,h=l.buffering[r],{sn:c,cc:u}=a,f=self.performance.now();h.start=f;const g=a.stats.buffering,m=o?o.stats.buffering:null;0===g.start&&(g.start=f),m&&0===m.start&&(m.start=f);const p=i.audio;let A=!1;"audio"===r&&"audio/mpeg"===(null==p?void 0:p.container)&&(A=!this.lastMpegAudioChunk||1===l.id||this.lastMpegAudioChunk.sn!==l.sn,this.lastMpegAudioChunk=l);const v=i.video,y=null==v?void 0:v.buffer;if(y&&"initSegment"!==c){const t=o||a,e=this.blockedAudioAppend;if("audio"!==r||"main"===n||this.blockedAudioAppend||v.ending||v.ended){if("video"===r){const i=t.end;if(e){const t=e.frag.start;(i>t||i<this.lastVideoAppendEnd||Gc.isBuffered(y,t))&&this.unblockAudio()}this.lastVideoAppendEnd=i}}else{const e=t.start+.05*t.duration,i=y.buffered,s=this.currentOp("video");i.length||s?!s&&!Gc.isBuffered(y,e)&&this.lastVideoAppendEnd<e&&this.blockAudio(t):this.blockAudio(t)}}const E=(o||a).start,T={label:`append-${r}`,execute:()=>{var t;h.executeStart=self.performance.now();const e=null==(t=this.tracks[r])?void 0:t.buffer;e&&(A?this.updateTimestampOffset(e,E,.1,r,c,u):void 0!==d&&Ql(d)&&this.updateTimestampOffset(e,d,1e-6,r,c,u)),this.appendExecutor(s,r)},onStart:()=>{},onComplete:()=>{const t=self.performance.now();h.executeEnd=h.end=t,0===g.first&&(g.first=t),m&&0===m.first&&(m.first=t);const e={};this.sourceBuffers.forEach(([t,i])=>{t&&(e[t]=Gc.getBuffered(i))}),this.appendErrors[r]=0,"audio"===r||"video"===r?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger($l.BUFFER_APPENDED,{type:r,frag:a,part:o,chunkMeta:l,parent:a.type,timeRanges:e})},onError:t=>{var e;const i={type:Wl.MEDIA_ERROR,parent:a.type,details:Yl.BUFFER_APPEND_ERROR,sourceBufferName:r,frag:a,part:o,chunkMeta:l,error:t,err:t,fatal:!1},s=null==(e=this.media)?void 0:e.error;if(t.code===DOMException.QUOTA_EXCEEDED_ERR||"QuotaExceededError"==t.name||"quota"in t)i.details=Yl.BUFFER_FULL_ERROR;else if(t.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!s)i.errorAction=Ec(!0);else if(t.name===am&&0===this.sourceBufferCount)i.errorAction=Ec(!0);else{const t=++this.appendErrors[r];this.warn(`Failed ${t}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${r}" sourceBuffer (${s||"no media error"})`),(t>=this.hls.config.appendErrorMaxRetry||s)&&(i.fatal=!0)}this.hls.trigger($l.ERROR,i)}};this.log(`queuing "${r}" append sn: ${c}${o?" p: "+o.index:""} of ${a.type===td?"level":"track"} ${a.level} cc: ${u}`),this.append(T,r,this.isPending(this.tracks[r]))}getFlushOp(t,e,i){return this.log(`queuing "${t}" remove ${e}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(t,e,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger($l.BUFFER_FLUSHED,{type:t})},onError:s=>{this.warn(`Failed to remove ${e}-${i} from "${t}" SourceBuffer`,s)}}}onBufferFlushing(t,e){const{type:i,startOffset:s,endOffset:r}=e;i?this.append(this.getFlushOp(i,s,r),i):this.sourceBuffers.forEach(([t])=>{t&&this.append(this.getFlushOp(t,s,r),t)})}onFragParsed(t,e){const{frag:i,part:s}=e,r=[],n=s?s.elementaryStreams:i.elementaryStreams;n[Md]?r.push("audiovideo"):(n[xd]&&r.push("audio"),n[Pd]&&r.push("video"));0===r.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(()=>{const t=self.performance.now();i.stats.buffering.end=t,s&&(s.stats.buffering.end=t);const e=s?s.stats:i.stats;this.hls.trigger($l.FRAG_BUFFERED,{frag:i,part:s,stats:e,id:i.type})},r).catch(t=>{this.warn(`Fragment buffered callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(t,e){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([t])=>{if(t){const e=this.tracks[t];if(e)return!e.ended||e.ending}return!1})}onBufferEos(t,e){var i;this.sourceBuffers.forEach(([t])=>{if(t){const i=this.tracks[t];e.type&&e.type!==t||(i.ending=!0,i.ended||(i.ended=!0,this.log(`${t} buffer reached EOS`)))}});const s=!1!==(null==(i=this.overrides)?void 0:i.endOfStream);this.sourceBufferCount>0&&!this.sourceBuffers.some(([t])=>{var e;return t&&!(null!=(e=this.tracks[t])&&e.ended)})?s?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:t}=this;t&&"open"===t.readyState?(this.log("Calling mediaSource.endOfStream()"),t.endOfStream(),this.hls.trigger($l.BUFFERED_TO_END,void 0)):t&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${t.readyState}`)})):(this.tracksEnded(),this.hls.trigger($l.BUFFERED_TO_END,void 0)):"video"===e.type&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([t])=>{if(null!==t){const e=this.tracks[t];e&&(e.ending=!1)}})}onLevelUpdated(t,{details:e}){e.fragments.length&&(this.details=e,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const t=this.getDurationAndRange();t&&this.updateMediaSource(t)})}onError(t,e){if(e.details===Yl.BUFFER_APPEND_ERROR&&e.frag){var i;const t=null==(i=e.errorAction)?void 0:i.nextAutoLevel;Ql(t)&&t!==e.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:t,details:e,media:i}=this;if(!i||null===e)return;if(!this.sourceBufferCount)return;const s=t.config,r=i.currentTime,n=e.levelTargetDuration,a=e.live&&null!==s.liveBackBufferLength?s.liveBackBufferLength:s.backBufferLength;if(Ql(a)&&a>=0){const t=Math.max(a,n),e=Math.floor(r/n)*n-t;this.flushBackBuffer(r,n,e)}const o=s.frontBufferFlushThreshold;if(Ql(o)&&o>0){const t=Math.max(s.maxBufferLength,o),e=Math.max(t,n),i=Math.floor(r/n)*n+e;this.flushFrontBuffer(r,n,i)}}flushBackBuffer(t,e,i){this.sourceBuffers.forEach(([t,e])=>{if(e){const r=Gc.getBuffered(e);if(r.length>0&&i>r.start(0)){var s;this.hls.trigger($l.BACK_BUFFER_REACHED,{bufferEnd:i});const e=this.tracks[t];if(null!=(s=this.details)&&s.live)this.hls.trigger($l.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(null!=e&&e.ended)return void this.log(`Cannot flush ${t} back buffer while SourceBuffer is in ended state`);this.hls.trigger($l.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:t})}}})}flushFrontBuffer(t,e,i){this.sourceBuffers.forEach(([e,s])=>{if(s){const r=Gc.getBuffered(s),n=r.length;if(n<2)return;const a=r.start(n-1),o=r.end(n-1);if(i>a||t>=a&&t<=o)return;this.hls.trigger($l.BUFFER_FLUSHING,{startOffset:a,endOffset:1/0,type:e})}})}getDurationAndRange(){var t;const{details:e,mediaSource:i}=this;if(!e||!this.media||"open"!==(null==i?void 0:i.readyState))return null;const s=e.edge;if(e.live&&this.hls.config.liveDurationInfinity){if(e.fragments.length&&i.setLiveSeekableRange){const t=Math.max(0,e.fragmentStart);return{duration:1/0,start:t,end:Math.max(t,s)}}return{duration:1/0}}const r=null==(t=this.overrides)?void 0:t.duration;if(r)return Ql(r)?{duration:r}:null;const n=this.media.duration;return s>(Ql(i.duration)?i.duration:0)&&s>n||!Ql(n)?{duration:s}:null}updateMediaSource({duration:t,start:e,end:i}){const s=this.mediaSource;this.media&&s&&"open"===s.readyState&&(s.duration!==t&&(Ql(t)&&this.log(`Updating MediaSource duration to ${t.toFixed(3)}`),s.duration=t),void 0!==e&&void 0!==i&&(this.log(`MediaSource duration is set to ${s.duration}. Setting seekable range to ${e}-${i}.`),s.setLiveSeekableRange(e,i)))}get tracksReady(){const t=this.pendingTrackCount;return t>0&&(t>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:t,pendingTrackCount:e,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${e} codec events expected: ${t}) ${Qh(i)}`),this.tracksReady){var s;const t=null==(s=this.transferData)?void 0:s.tracks;t&&Object.keys(t).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const t={};this.sourceBuffers.forEach(([e,i])=>{if(e){const s=this.tracks[e];t[e]={buffer:i,container:s.container,codec:s.codec,supplemental:s.supplemental,levelCodec:s.levelCodec,id:s.id,metadata:s.metadata}}}),this.hls.trigger($l.BUFFER_CREATED,{tracks:t}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const t=new Error("could not create source buffer for media codec(s)");this.hls.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:t,reason:t.message})}}createSourceBuffers(){const{tracks:t,sourceBuffers:e,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const n in t){const a=n,o=t[a];if(this.isPending(o)){const t=this.getTrackCodec(o,a),n=`${o.container};codecs=${t}`;o.codec=t,this.log(`creating sourceBuffer(${n})${this.currentOp(a)?" Queued":""} ${Qh(o)}`);try{const t=i.addSourceBuffer(n),s=dm(a),r=[a,t];e[s]=r,o.buffer=t}catch(r){var s;return this.error(`error while trying to add sourceBuffer: ${r.message}`),this.shiftAndExecuteNext(a),null==(s=this.operationQueue)||s.removeBlockers(),delete this.tracks[a],void this.hls.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:r,sourceBufferName:a,mimeType:n,parent:o.id})}this.trackSourceBuffer(a,o)}}this.bufferCreated()}getTrackCodec(t,e){const i=t.supplemental;let s=t.codec;i&&("video"===e||"audiovideo"===e)&&gh(i,"video")&&(s=function(t,e){const i=[];if(t){const e=t.split(",");for(let t=0;t<e.length;t++)fh(e[t],"video")||i.push(e[t])}return e&&i.push(e),i.join(",")}(s,i));const r=Sh(s,t.levelCodec);return r?"audio"===e.slice(0,5)?Th(r,this.appendSource):r:""}trackSourceBuffer(t,e){const i=e.buffer;if(!i)return;const s=this.getTrackCodec(e,t);this.tracks[t]={buffer:i,codec:s,container:e.container,levelCodec:e.levelCodec,supplemental:e.supplemental,metadata:e.metadata,id:e.id,listeners:[]},this.removeBufferListeners(t),this.addBufferListener(t,"updatestart",this.onSBUpdateStart),this.addBufferListener(t,"updateend",this.onSBUpdateEnd),this.addBufferListener(t,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(t,"bufferedchange",(t,e)=>{const i=e.removedRanges;null!=i&&i.length&&this.hls.trigger($l.BUFFER_FLUSHED,{type:t})})}get mediaSrc(){var t,e;const i=(null==(t=this.media)||null==(e=t.querySelector)?void 0:e.call(t,"source"))||this.media;return null==i?void 0:i.src}onSBUpdateStart(t){const e=this.currentOp(t);e&&e.onStart()}onSBUpdateEnd(t){var e;if("closed"===(null==(e=this.mediaSource)?void 0:e.readyState))return void this.resetBuffer(t);const i=this.currentOp(t);i&&(i.onComplete(),this.shiftAndExecuteNext(t))}onSBUpdateError(t,e){var i;const s=new Error(`${t} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${s}`,e),this.hls.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.BUFFER_APPENDING_ERROR,sourceBufferName:t,error:s,fatal:!1});const r=this.currentOp(t);r&&r.onError(s)}updateTimestampOffset(t,e,i,s,r,n){const a=e-t.timestampOffset;Math.abs(a)>=i&&(this.log(`Updating ${s} SourceBuffer timestampOffset to ${e} (sn: ${r} cc: ${n})`),t.timestampOffset=e)}removeExecutor(t,e,i){const{media:s,mediaSource:r}=this,n=this.tracks[t],a=null==n?void 0:n.buffer;if(!s||!r||!a)return this.warn(`Attempting to remove from the ${t} SourceBuffer, but it does not exist`),void this.shiftAndExecuteNext(t);const o=Ql(s.duration)?s.duration:1/0,l=Ql(r.duration)?r.duration:1/0,d=Math.max(0,e),h=Math.min(i,o,l);h>d&&(!n.ending||n.ended)?(n.ended=!1,this.log(`Removing [${d},${h}] from the ${t} SourceBuffer`),a.remove(d,h)):this.shiftAndExecuteNext(t)}appendExecutor(t,e){const i=this.tracks[e],s=null==i?void 0:i.buffer;if(!s)throw new om(`Attempting to append to the ${e} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,s.appendBuffer(t)}blockUntilOpen(t){if(this.isUpdating()||this.isQueued())this.blockBuffers(t).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{t()}catch(e){this.warn(`Callback run without blocking ${this.operationQueue} ${e}`)}}isUpdating(){return this.sourceBuffers.some(([t,e])=>t&&e.updating)}isQueued(){return this.sourceBuffers.some(([t])=>t&&!!this.currentOp(t))}isPending(t){return!!t&&!t.buffer}blockBuffers(t,e=this.sourceBufferTypes){if(!e.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(t);const{operationQueue:i}=this,s=e.map(t=>this.appendBlocker(t));return e.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(s).then(e=>{i===this.operationQueue&&(t(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(t){t.forEach(t=>{var e;const i=null==(e=this.tracks[t])?void 0:e.buffer;i&&!i.updating&&this.shiftAndExecuteNext(t)})}append(t,e,i){this.operationQueue&&this.operationQueue.append(t,e,i)}appendBlocker(t){if(this.operationQueue)return this.operationQueue.appendBlocker(t)}currentOp(t){return this.operationQueue?this.operationQueue.current(t):null}executeNext(t){t&&this.operationQueue&&this.operationQueue.executeNext(t)}shiftAndExecuteNext(t){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(t)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((t,e)=>t+(this.isPending(this.tracks[e])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((t,[e])=>t+(e?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([t])=>t).filter(t=>!!t)}addBufferListener(t,e,i){const s=this.tracks[t];if(!s)return;const r=s.buffer;if(!r)return;const n=i.bind(this,t);s.listeners.push({event:e,listener:n}),r.addEventListener(e,n)}removeBufferListeners(t){const e=this.tracks[t];if(!e)return;const i=e.buffer;i&&(e.listeners.forEach(t=>{i.removeEventListener(t.event,t.listener)}),e.listeners.length=0)}},capLevelController:hm,errorController:class extends dd{constructor(t){super("error-controller",t.logger),this.hls=void 0,this.playlistError=0,this.hls=t,this.registerListeners()}registerListeners(){const t=this.hls;t.on($l.ERROR,this.onError,this),t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const t=this.hls;t&&(t.off($l.ERROR,this.onError,this),t.off($l.ERROR,this.onErrorOut,this),t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(t){}stopLoad(){this.playlistError=0}getVariantLevelIndex(t){return(null==t?void 0:t.type)===td?t.level:this.getVariantIndex()}getVariantIndex(){var t;const e=this.hls,i=e.currentLevel;return null!=(t=e.loadLevelObj)&&t.details||-1===i?e.loadLevel:i}variantHasKey(t,e){if(t){var i;if(null!=(i=t.details)&&i.hasKey(e))return!0;const s=t.audioGroups;if(s){return this.hls.allAudioTracks.filter(t=>s.indexOf(t.groupId)>=0).some(t=>{var i;return null==(i=t.details)?void 0:i.hasKey(e)})}}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(t,e){var i;if(e.fatal)return;const s=this.hls,r=e.context;switch(e.details){case Yl.FRAG_LOAD_ERROR:case Yl.FRAG_LOAD_TIMEOUT:case Yl.KEY_LOAD_ERROR:case Yl.KEY_LOAD_TIMEOUT:return void(e.errorAction=this.getFragRetryOrSwitchAction(e));case Yl.FRAG_PARSING_ERROR:if(null!=(i=e.frag)&&i.gap)return void(e.errorAction=Ec());case Yl.FRAG_GAP:case Yl.FRAG_DECRYPT_ERROR:return e.errorAction=this.getFragRetryOrSwitchAction(e),void(e.errorAction.action=fc);case Yl.LEVEL_EMPTY_ERROR:case Yl.LEVEL_PARSING_ERROR:{var n;const t=e.parent===td?e.level:s.loadLevel;e.details===Yl.LEVEL_EMPTY_ERROR&&null!=(n=e.context)&&null!=(n=n.levelDetails)&&n.live?e.errorAction=this.getPlaylistRetryOrSwitchAction(e,t):(e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t))}return;case Yl.LEVEL_LOAD_ERROR:case Yl.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==r?void 0:r.level)&&(e.errorAction=this.getPlaylistRetryOrSwitchAction(e,r.level)));case Yl.AUDIO_TRACK_LOAD_ERROR:case Yl.AUDIO_TRACK_LOAD_TIMEOUT:case Yl.SUBTITLE_LOAD_ERROR:case Yl.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const t=s.loadLevelObj;if(t&&(r.type===Zl&&t.hasAudioGroup(r.groupId)||r.type===Jl&&t.hasSubtitleGroup(r.groupId)))return e.errorAction=this.getPlaylistRetryOrSwitchAction(e,s.loadLevel),e.errorAction.action=fc,void(e.errorAction.flags=Ac)}return;case Yl.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:return void(e.errorAction={action:fc,flags:vc});case Yl.KEY_SYSTEM_SESSION_UPDATE_FAILED:case Yl.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case Yl.KEY_SYSTEM_NO_SESSION:return void(e.errorAction={action:fc,flags:yc});case Yl.BUFFER_ADD_CODEC_ERROR:case Yl.REMUX_ALLOC_ERROR:case Yl.BUFFER_APPEND_ERROR:var a;if(!e.errorAction)e.errorAction=this.getLevelSwitchAction(e,null!=(a=e.level)?a:s.loadLevel);return;case Yl.INTERNAL_EXCEPTION:case Yl.BUFFER_APPENDING_ERROR:case Yl.BUFFER_FULL_ERROR:case Yl.LEVEL_SWITCH_ERROR:case Yl.BUFFER_STALLED_ERROR:case Yl.BUFFER_SEEK_OVER_HOLE:case Yl.BUFFER_NUDGE_ON_STALL:return void(e.errorAction=Ec())}e.type===Wl.KEY_SYSTEM_ERROR&&(e.levelRetry=!1,e.errorAction=Ec())}getPlaylistRetryOrSwitchAction(t,e){const i=oc(this.hls.config.playlistLoadPolicy,t),s=this.playlistError++;if(hc(i,s,rc(t),t.response))return{action:mc,flags:pc,retryConfig:i,retryCount:s};const r=this.getLevelSwitchAction(t,e);return i&&(r.retryConfig=i,r.retryCount=s),r}getFragRetryOrSwitchAction(t){const e=this.hls,i=this.getVariantLevelIndex(t.frag),s=e.levels[i],{fragLoadPolicy:r,keyLoadPolicy:n}=e.config,a=oc(nc(t)?n:r,t),o=e.levels.reduce((t,e)=>t+e.fragmentError,0);if(s&&(t.details!==Yl.FRAG_GAP&&s.fragmentError++,!ac(t))){if(hc(a,o,rc(t),t.response))return{action:mc,flags:pc,retryConfig:a,retryCount:o}}const l=this.getLevelSwitchAction(t,i);return a&&(l.retryConfig=a,l.retryCount=o),l}getLevelSwitchAction(t,e){const i=this.hls;null==e&&(e=i.loadLevel);const s=this.hls.levels[e];if(s){var r,n;const e=t.details;s.loadError++,e===Yl.BUFFER_APPEND_ERROR&&s.fragmentError++;let l=-1;const{levels:d,loadLevel:h,minAutoLevel:c,maxAutoLevel:u}=i;i.autoLevelEnabled||i.config.preserveManualLevelOnError||(i.loadLevel=-1);const f=null==(r=t.frag)?void 0:r.type,g=(f===ed&&e===Yl.FRAG_PARSING_ERROR||"audio"===t.sourceBufferName&&(e===Yl.BUFFER_ADD_CODEC_ERROR||e===Yl.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:t})=>s.audioCodec!==t),m="video"===t.sourceBufferName&&(e===Yl.BUFFER_ADD_CODEC_ERROR||e===Yl.BUFFER_APPEND_ERROR)&&d.some(({codecSet:t,audioCodec:e})=>s.codecSet!==t&&s.audioCodec===e),{type:p,groupId:A}=null!=(n=t.context)?n:{};for(let i=d.length;i--;){const r=(i+h)%d.length;if(r!==h&&r>=c&&r<=u&&0===d[r].loadError){var a,o;const i=d[r];if(e===Yl.FRAG_GAP&&f===td&&t.frag){const e=d[r].details;if(e){const i=tc(t.frag,e.fragments,t.frag.start);if(null!=i&&i.gap)continue}}else{if(p===Zl&&i.hasAudioGroup(A)||p===Jl&&i.hasSubtitleGroup(A))continue;if(f===ed&&null!=(a=s.audioGroups)&&a.some(t=>i.hasAudioGroup(t))||f===id&&null!=(o=s.subtitleGroups)&&o.some(t=>i.hasSubtitleGroup(t))||g&&s.audioCodec===i.audioCodec||m&&s.codecSet===i.codecSet||!g&&s.codecSet!==i.codecSet)continue}l=r;break}}if(l>-1&&i.loadLevel!==l)return t.levelRetry=!0,this.playlistError=0,{action:fc,flags:pc,nextAutoLevel:l}}return{action:fc,flags:Ac}}onErrorOut(t,e){var i;switch(null==(i=e.errorAction)?void 0:i.action){case uc:break;case fc:this.sendAlternateToPenaltyBox(e),e.errorAction.resolved||e.details===Yl.FRAG_GAP?/MediaSource readyState: ended/.test(e.error.message)&&(this.warn(`MediaSource ended after "${e.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):e.fatal=!0}e.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(t){const e=this.hls,i=t.errorAction;if(!i)return;const{flags:s}=i,r=i.nextAutoLevel;switch(s){case pc:this.switchLevel(t,r);break;case vc:{const s=this.getVariantLevelIndex(t.frag),r=e.levels[s],n=null==r?void 0:r.attrs["HDCP-LEVEL"];if(i.hdcpLevel=n,"NONE"===n)this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(n){e.maxHdcpLevel=Oh[Oh.indexOf(n)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${e.maxHdcpLevel}" or lower`);break}}case yc:{const e=t.decryptdata;if(e){const s=this.hls.levels,r=s.length;for(let i=r;i--;){var n,a;if(this.variantHasKey(s[i],e))this.log(`Banned key found in level ${i} (${s[i].bitrate}bps) or audio group "${null==(n=s[i].audioGroups)?void 0:n.join(",")}" (${null==(a=t.frag)?void 0:a.type} fragment) ${yd(e.keyId||[])}`),s[i].fragmentError++,s[i].loadError++,this.log(`Removing level ${i} with key error (${t.error})`),this.hls.removeLevel(i)}const o=t.frag;if(this.hls.levels.length<r)i.resolved=!0;else if(o&&o.type!==td){const t=o.decryptdata;t&&!e.matches(t)&&(i.resolved=!0)}}break}}i.resolved||this.switchLevel(t,r)}switchLevel(t,e){if(void 0!==e&&t.errorAction&&(this.warn(`switching to level ${e} after ${t.details}`),this.hls.nextAutoLevel=e,t.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,t.details===Yl.BUFFER_ADD_CODEC_ERROR&&t.mimeType&&"audiovideo"!==t.sourceBufferName)){const e=Rh(t.mimeType),i=this.hls.levels;for(let s=i.length;s--;)i[s][`${t.sourceBufferName}Codec`]===e&&(this.log(`Removing level ${s} for ${t.details} ("${e}" not supported)`),this.hls.removeLevel(s))}}},fpsController:class{constructor(t){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=t,this.registerListeners()}setStreamController(t){this.streamController=t}registerListeners(){this.hls.on($l.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on($l.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off($l.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off($l.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(t,e){const i=this.hls.config;if(i.capLevelOnFPSDrop){const t=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=t,t&&"function"==typeof t.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(t,e,i){const s=performance.now();if(e){if(this.lastTime){const t=s-this.lastTime,r=i-this.lastDroppedFrames,n=e-this.lastDecodedFrames,a=1e3*r/t,o=this.hls;if(o.trigger($l.FPS_DROP,{currentDropped:r,currentDecoded:n,totalDroppedFrames:i}),a>0&&r>o.config.fpsDroppedMonitoringThreshold*n){let t=o.currentLevel;o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+t),t>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=t)&&(t-=1,o.trigger($l.FPS_DROP_LEVEL_CAPPING,{level:t,droppedLevel:o.currentLevel}),o.autoLevelCapping=t,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=e}}checkFPSInterval(){const t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){const e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:yu,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:kA,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends Sf{constructor(t,e,i){super(t,e,i,"subtitle-stream-controller",id),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:t}=this;t.on($l.LEVEL_LOADED,this.onLevelLoaded,this),t.on($l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on($l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on($l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on($l.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on($l.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off($l.LEVEL_LOADED,this.onLevelLoaded,this),t.off($l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off($l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off($l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off($l.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off($l.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(t,e){this.stopLoad(),this.state=cf,this.setInterval(500),this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=e?-1:t,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(t,e){this.tracksBuffered=[],super.onMediaDetaching(t,e)}onLevelLoaded(t,e){this.mainDetails=e.details}onSubtitleFragProcessed(t,e){const{frag:i,success:s}=e;if(this.fragContextChanged(i)||(Bd(i)&&(this.fragPrevious=i),this.state=cf),!s)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let n;const a=i.start;for(let l=0;l<r.length;l++)if(a>=r[l].start&&a<=r[l].end){n=r[l];break}const o=i.start+i.duration;n?n.end=o:(n={start:a,end:o},r.push(n)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(t,e){const{startOffset:i,endOffset:s}=e;if(0===i&&s!==Number.POSITIVE_INFINITY){const t=s-1;if(t<=0)return;e.endOffsetSubtitles=Math.max(0,t),this.tracksBuffered.forEach(e=>{for(let i=0;i<e.length;)if(e[i].end<=t)e.shift();else{if(!(e[i].start<t))break;e[i].start=t,i++}}),this.fragmentTracker.removeFragmentsInRange(i,t,id)}}onError(t,e){const i=e.frag;(null==i?void 0:i.type)===id&&(e.details===Yl.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==hf&&(this.state=cf))}onSubtitleTracksUpdated(t,{subtitleTracks:e}){this.levels&&em(this.levels,e)?this.levels=e.map(t=>new jh(t)):(this.tracksBuffered=[],this.levels=e.map(t=>{const e=new jh(t);return this.tracksBuffered[e.id]=[],e}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,id),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(t,e){var i;if(this.currentTrackId=e.id,null==(i=this.levels)||!i.length||-1===this.currentTrackId)return void this.clearInterval();const s=this.levels[this.currentTrackId];null!=s&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.state!==hf&&this.setInterval(500)}onSubtitleTrackLoaded(t,e){var i;const{currentTrackId:s,levels:r}=this,{details:n,id:a}=e;if(!r)return void this.warn(`Subtitle tracks were reset while loading level ${a}`);const o=r[a];if(a>=r.length||!o)return;this.log(`Subtitle track ${a} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(n.live||null!=(i=o.details)&&i.live){if(n.deltaUpdateFailed)return;const t=this.mainDetails;if(!t)return void(this.startFragRequested=!1);const e=t.fragments[0];var d;if(o.details)l=this.alignPlaylists(n,o.details,null==(d=this.levelLastLoaded)?void 0:d.details),0===l&&e&&(l=e.start,Wu(n,l));else n.hasProgramDateTime&&t.hasProgramDateTime?(af(n,t),l=n.fragmentStart):e&&(l=e.start,Wu(n,l));t&&!this.startFragRequested&&this.setStartPosition(t,l)}if(o.details=n,this.levelLastLoaded=o,a===s&&(this.hls.trigger($l.SUBTITLE_TRACK_UPDATED,{details:n,id:a,groupId:e.groupId}),this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===cf)){tc(null,n.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0)}}_handleFragmentLoadComplete(t){const{frag:e,payload:i}=t,s=e.decryptdata,r=this.hls;if(!this.fragContextChanged(e)&&i&&i.byteLength>0&&null!=s&&s.key&&s.iv&&ru(s.method)){const t=performance.now();this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer,nu(s.method)).catch(t=>{throw r.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t}).then(i=>{const s=performance.now();r.trigger($l.FRAG_DECRYPTED,{frag:e,payload:i,stats:{tstart:t,tdecrypt:s}})}).catch(t=>{this.warn(`${t.name}: ${t.message}`),this.state=cf})}}doTick(){if(this.media){if(this.state===cf){const{currentTrackId:t,levels:e}=this,i=null==e?void 0:e[t];if(!i||!e.length||!i.details)return;if(this.waitForLive(i))return;const{config:s}=this,r=this.getLoadPosition(),n=Gc.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,s.maxBufferHole),{end:a,len:o}=n,l=i.details;if(o>this.hls.maxBufferLength+l.levelTargetDuration)return;const d=l.fragments,h=d.length,c=l.edge;let u=null;const f=this.fragPrevious;if(a<c){const t=s.maxFragLookUpTolerance,e=a>c-t?0:t;u=tc(f,d,Math.max(d[0].start,a),e),!u&&f&&f.start<d[0].start&&(u=d[0])}else u=d[h-1];if(u=this.filterReplacedPrimary(u,i.details),!u)return;const g=d[u.sn-l.startSN-1];if(g&&g.cc===u.cc&&this.fragmentTracker.getState(g)===Tc&&(u=g),this.fragmentTracker.getState(u)===Tc){const t=this.mapToInitFragWhenRequired(u);t&&this.loadFragment(t,i,a)}}}else this.state=cf}loadFragment(t,e,i){Bd(t)?super.loadFragment(t,e,i):this._loadInitSegment(t,e)}get mediaBufferTimeRanges(){return new xp(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends tm{constructor(t){super(t,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const e=mp(this.media.textTracks);for(let s=0;s<e.length;s++)if("hidden"===e[s].mode)t=e[s];else if("showing"===e[s].mode){t=e[s];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:t}=this;t.on($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.MANIFEST_PARSED,this.onManifestParsed,this),t.on($l.LEVEL_LOADING,this.onLevelLoading,this),t.on($l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on($l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on($l.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.MANIFEST_PARSED,this.onManifestParsed,this),t.off($l.LEVEL_LOADING,this.onLevelLoading,this),t.off($l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off($l.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off($l.ERROR,this.onError,this)}onMediaAttached(t,e){this.media=e.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,t)}onMediaDetaching(t,e){const i=this.media;if(!i)return;const s=!!e.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,s)return;mp(i.textTracks).forEach(t=>{fp(t)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(t,e){this.tracks=e.subtitleTracks}onSubtitleTrackLoaded(t,e){const{id:i,groupId:s,details:r}=e,n=this.tracksInGroup[i];if(!n||n.groupId!==s)return void this.warn(`Subtitle track with id:${i} and group:${s} not found in active group ${null==n?void 0:n.groupId}`);const a=n.details;n.details=e.details,this.log(`Subtitle track ${i} "${n.name}" lang:${n.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,e,a)}onLevelLoading(t,e){this.switchLevel(e.level)}onLevelSwitching(t,e){this.switchLevel(e.level)}switchLevel(t){const e=this.hls.levels[t];if(!e)return;const i=e.subtitleGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some(t=>-1===(null==s?void 0:s.indexOf(t)))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const t=this.tracks.filter(t=>!i||-1!==i.indexOf(t.groupId));if(t.length)this.selectDefaultTrack&&!t.some(t=>t.default)&&(this.selectDefaultTrack=!1),t.forEach((t,e)=>{t.id=e});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=t;const e=this.hls.config.subtitlePreference;if(!r&&e){this.selectDefaultTrack=!1;const i=Yh(e,t);if(i>-1)r=t[i];else{const t=Yh(e,this.tracks);r=this.tracks[t]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const n={subtitleTracks:t};this.log(`Updating subtitle tracks, ${t.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger($l.SUBTITLE_TRACKS_UPDATED,n),-1!==s&&-1===this.trackId&&this.setSubtitleTrack(s)}}findTrackId(t){const e=this.tracksInGroup,i=this.selectDefaultTrack;for(let s=0;s<e.length;s++){const r=e[s];if((!i||r.default)&&(i||t)&&(!t||$h(r,t)))return s}if(t){for(let i=0;i<e.length;i++){const s=e[i];if(im(t.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<e.length;i++){const s=e[i];if(im(t.attrs,s.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(t){if(t){const e=this.tracksInGroup;for(let i=0;i<e.length;i++){if(sm(e[i],t))return i}}return-1}onError(t,e){!e.fatal&&e.context&&(e.context.type!==Jl||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||this.checkRetry(e))}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(t){this.selectDefaultTrack=!1,this.setSubtitleTrack(t)}setSubtitleOption(t){if(this.hls.config.subtitlePreference=t,t){if(-1===t.id)return this.setSubtitleTrack(-1),null;const e=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,e.length){const i=this.currentTrack;if(i&&$h(t,i))return i;const s=Yh(t,this.tracksInGroup);if(s>-1){const t=this.tracksInGroup[s];return this.setSubtitleTrack(s),t}if(i)return null;{const i=Yh(t,e);if(i>-1)return e[i]}}}return null}loadPlaylist(t){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,t)}loadingPlaylist(t,e){super.loadingPlaylist(t,e);const i=t.id,s=t.groupId,r=this.getUrlWithDirectives(t.url,e),n=t.details,a=null==n?void 0:n.age;this.log(`Loading subtitle ${i} "${t.name}" lang:${t.lang} group:${s}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""}${a&&n.live?" age "+a.toFixed(1)+(n.type&&" "+n.type||""):""} ${r}`),this.hls.trigger($l.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:e||null,track:t})}toggleTrackModes(){const{media:t}=this;if(!t)return;const e=mp(t.textTracks),i=this.currentTrack;let s;if(i&&(s=e.filter(t=>sm(i,t))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(e).forEach(t=>{"disabled"!==t.mode&&t!==s&&(t.mode="disabled")}),s){const t=this.subtitleDisplay?"showing":"hidden";s.mode!==t&&(s.mode=t)}}setSubtitleTrack(t){const e=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=t);if(t<-1||t>=e.length||!Ql(t))return void this.warn(`Invalid subtitle track id: ${t}`);this.selectDefaultTrack=!1;const i=this.currentTrack,s=e[t]||null;if(this.trackId=t,this.currentTrack=s,this.toggleTrackModes(),!s)return void this.hls.trigger($l.SUBTITLE_TRACK_SWITCH,{id:t});const r=!!s.details&&!s.details.live;if(t===this.trackId&&s===i&&r)return;this.log(`Switching to subtitle-track ${t}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:n,groupId:a="",name:o,type:l,url:d}=s;this.hls.trigger($l.SUBTITLE_TRACK_SWITCH,{id:n,groupId:a,name:o,type:l,url:d});const h=this.switchParams(s.url,null==i?void 0:i.details,s.details);this.loadPlaylist(h)}},timelineController:class{constructor(t){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},t.on($l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.MANIFEST_LOADED,this.onManifestLoaded,this),t.on($l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on($l.FRAG_LOADING,this.onFragLoading,this),t.on($l.FRAG_LOADED,this.onFragLoaded,this),t.on($l.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on($l.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on($l.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on($l.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on($l.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:t}=this;t.off($l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.MANIFEST_LOADED,this.onManifestLoaded,this),t.off($l.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off($l.FRAG_LOADING,this.onFragLoading,this),t.off($l.FRAG_LOADED,this.onFragLoaded,this),t.off($l.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off($l.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off($l.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off($l.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off($l.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const t=new SA(this,"textTrack1"),e=new SA(this,"textTrack2"),i=new SA(this,"textTrack3"),s=new SA(this,"textTrack4");this.cea608Parser1=new Yp(1,t,e),this.cea608Parser2=new Yp(3,i,s)}addCues(t,e,i,s,r){let n=!1;for(let a=r.length;a--;){const t=r[a],s=LA(t[0],t[1],e,i);if(s>=0&&(t[0]=Math.min(t[0],e),t[1]=Math.max(t[1],i),n=!0,s/(i-e)>.5))return}if(n||r.push([e,i]),this.config.renderTextTracksNatively){const r=this.captionsTracks[t];this.Cues.newCue(r,e,i,s)}else{const r=this.Cues.newCue(null,e,i,s);this.hls.trigger($l.CUES_PARSED,{type:"captions",cues:r,track:t})}}onInitPtsFound(t,{frag:e,id:i,initPTS:s,timescale:r,trackId:n}){const{unparsedVttFrags:a}=this;i===td&&(this.initPTS[e.cc]={baseTime:s,timescale:r,trackId:n}),a.length&&(this.unparsedVttFrags=[],a.forEach(t=>{this.initPTS[t.frag.cc]?this.onFragLoaded($l.FRAG_LOADED,t):this.hls.trigger($l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(t,e){const{media:i}=this;if(i)for(let s=0;s<i.textTracks.length;s++){const r=i.textTracks[s];if(IA(r,{name:t,lang:e,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return r}return null}createCaptionsTrack(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)}createNativeTrack(t){if(this.captionsTracks[t])return;const{captionsProperties:e,captionsTracks:i,media:s}=this,{label:r,languageCode:n}=e[t],a=this.getExistingTrack(r,n);if(a)i[t]=a,fp(i[t]),cp(i[t],s);else{const e=this.createTextTrack("captions",r,n);e&&(e[t]=!0,i[t]=e)}}createNonNativeTrack(t){if(this.nonNativeCaptionsTracks[t])return;const e=this.captionsProperties[t];if(!e)return;const i={_id:t,label:e.label,kind:"captions",default:!!e.media&&!!e.media.default,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=i,this.hls.trigger($l.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(t,e,i){const s=this.media;if(s)return s.addTextTrack(t,e,i)}onMediaAttaching(t,e){this.media=e.media,e.mediaSource||this._cleanTracks()}onMediaDetaching(t,e){const i=!!e.transferMedia;if(this.media=null,i)return;const{captionsTracks:s}=this;Object.keys(s).forEach(t=>{fp(s[t]),delete s[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:t}=this;if(!t)return;const e=t.textTracks;if(e)for(let i=0;i<e.length;i++)fp(e[i])}onSubtitleTracksUpdated(t,e){const i=e.subtitleTracks||[],s=i.some(t=>t.textCodec===cA);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(em(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const t=this.media,e=t?mp(t.textTracks):null;if(this.tracks.forEach((t,i)=>{let s;if(e){let i=null;for(let s=0;s<e.length;s++)if(e[s]&&IA(e[s],t)){i=e[s],e[s]=null;break}i&&(s=i)}if(s)fp(s);else{const e=bA(t);s=this.createTextTrack(e,t.name,t.lang),s&&(s.mode="disabled")}s&&this.textTracks.push(s)}),null!=e&&e.length){const t=e.filter(t=>null!==t).map(t=>t.label);t.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${t.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const t=this.tracks.map(t=>({label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}));this.hls.trigger($l.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:t})}}}onManifestLoaded(t,e){this.config.enableCEA708Captions&&e.captions&&e.captions.forEach(t=>{const e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(!e)return;const i=`textTrack${e[1]}`,s=this.captionsProperties[i];s&&(s.label=t.name,t.lang&&(s.languageCode=t.lang),s.media=t)})}closedCaptionsForLevel(t){const e=this.hls.levels[t.level];return null==e?void 0:e.attrs["CLOSED-CAPTIONS"]}onFragLoading(t,e){if(this.enabled&&e.frag.type===td){var i,s;const{cea608Parser1:t,cea608Parser2:r,lastSn:n}=this,{cc:a,sn:o}=e.frag,l=null!=(i=null==(s=e.part)?void 0:s.index)?i:-1;t&&r&&(o!==n+1||o===n&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(t.reset(),r.reset()),this.lastCc=a,this.lastSn=o,this.lastPartIndex=l}}onFragLoaded(t,e){const{frag:i,payload:s}=e;if(i.type===id)if(s.byteLength){const t=i.decryptdata,r="stats"in e;if(null==t||!t.encrypted||r){const t=this.tracks[i.level],r=this.vttCCs;r[i.cc]||(r[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),t&&t.textCodec===cA?this._parseIMSC1(i,s):this._parseVTTs(e)}}else this.hls.trigger($l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(t,e){const i=this.hls;mA(e,this.initPTS[t.cc],e=>{this._appendCues(e,t.level),i.trigger($l.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},e=>{i.logger.log(`Failed to parse IMSC1: ${e}`),i.trigger($l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})})}_parseVTTs(t){var e;const{frag:i,payload:s}=t,{initPTS:r,unparsedVttFrags:n}=this,a=r.length-1;if(!r[i.cc]&&-1===a)return void n.push(t);const o=this.hls;hA(null!=(e=i.initSegment)&&e.data?sh(i.initSegment.data,new Uint8Array(s)).buffer:s,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,t=>{this._appendCues(t,i.level),o.trigger($l.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},e=>{const r="Missing initPTS for VTT MPEGTS"===e.message;r?n.push(t):this._fallbackToIMSC1(i,s),o.logger.log(`Failed to parse VTT cue: ${e}`),r&&a>i.cc||o.trigger($l.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:e})})}_fallbackToIMSC1(t,e){const i=this.tracks[t.level];i.textCodec||mA(e,this.initPTS[t.cc],()=>{i.textCodec=cA,this._parseIMSC1(t,e)},()=>{i.textCodec="wvtt"})}_appendCues(t,e){const i=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[e];if(!i||"disabled"===i.mode)return;t.forEach(t=>up(i,t))}else{const s=this.tracks[e];if(!s)return;const r=s.default?"default":"subtitles"+e;i.trigger($l.CUES_PARSED,{type:"subtitles",cues:t,track:r})}}onFragDecrypted(t,e){const{frag:i}=e;i.type===id&&this.onFragLoaded($l.FRAG_LOADED,e)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(t,e){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:s}=e;if(i.type!==td||"NONE"!==this.closedCaptionsForLevel(i))for(let r=0;r<s.length;r++){const t=s[r].bytes;if(t){this.cea608Parser1||this.initCea608Parsers();const e=this.extractCea608Data(t);this.cea608Parser1.addData(s[r].pts,e[0]),this.cea608Parser2.addData(s[r].pts,e[1])}}}onBufferFlushing(t,{startOffset:e,endOffset:i,endOffsetSubtitles:s,type:r}){const{media:n}=this;if(n&&!(n.currentTime<i)){if(!r||"video"===r){const{captionsTracks:t}=this;Object.keys(t).forEach(s=>gp(t[s],e,i))}if(this.config.renderTextTracksNatively&&0===e&&void 0!==s){const{textTracks:t}=this;Object.keys(t).forEach(i=>gp(t[i],e,s))}}}extractCea608Data(t){const e=[[],[]],i=31&t[0];let s=2;for(let r=0;r<i;r++){const i=t[s++],r=127&t[s++],n=127&t[s++];if(0===r&&0===n)continue;if(!!(4&i)){const t=3&i;0!==t&&1!==t||(e[t].push(r),e[t].push(n))}}return e}},audioStreamController:class extends Sf{constructor(t,e,i){super(t,e,i,"audio-stream-controller",ed),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:t}=this;t.on($l.LEVEL_LOADED,this.onLevelLoaded,this),t.on($l.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on($l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on($l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on($l.BUFFER_RESET,this.onBufferReset,this),t.on($l.BUFFER_CREATED,this.onBufferCreated,this),t.on($l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on($l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on($l.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on($l.FRAG_LOADING,this.onFragLoading,this),t.on($l.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:t}=this;t&&(super.unregisterListeners(),t.off($l.LEVEL_LOADED,this.onLevelLoaded,this),t.off($l.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off($l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off($l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off($l.BUFFER_RESET,this.onBufferReset,this),t.off($l.BUFFER_CREATED,this.onBufferCreated,this),t.off($l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off($l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off($l.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off($l.FRAG_LOADING,this.onFragLoading,this),t.off($l.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(t,{frag:e,id:i,initPTS:s,timescale:r,trackId:n}){if(i===td){const t=e.cc,i=this.fragCurrent;if(this.initPTS[t]={baseTime:s,timescale:r,trackId:n},this.log(`InitPTS for cc: ${t} found from main: ${s/r} (${s}/${r}) trackId: ${n}`),this.mainAnchor=e,this.state===Ef){const i=this.waitingData;(!i&&!this.loadingParts||i&&i.frag.cc!==t)&&this.syncWithAnchor(e,null==i?void 0:i.frag)}else!this.hls.hasEnoughToStart&&i&&i.cc!==t?(i.abortRequests(),this.syncWithAnchor(e,i)):this.state===cf&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(t,e){var i;const s=(null==(i=this.mainFragLoading)?void 0:i.frag)||null;if(e&&(null==s?void 0:s.cc)===e.cc)return;const r=(s||t).cc,n=sc(this.getLevelDetails(),r,this.getLoadPosition());n&&(this.log(`Syncing with main frag at ${n.start} cc ${n.cc}`),this.startFragRequested=!1,this.nextLoadPosition=n.start,this.resetLoadingState(),this.state===cf&&this.doTickIdle())}startLoad(t,e){if(!this.levels)return this.startPosition=t,void(this.state=hf);const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),i>0&&-1===t?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),t=i,this.state=cf):this.state=mf,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=e?-1:t,this.tick()}doTick(){switch(this.state){case cf:this.doTickIdle();break;case mf:{const{levels:t,trackId:e}=this,i=null==t?void 0:t[e],s=null==i?void 0:i.details;if(s&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(s))break;this.state=Ef}break}case gf:this.checkRetryDate();break;case Ef:{const t=this.waitingData;if(t){const{frag:e,part:i,cache:s,complete:r}=t,n=this.mainAnchor;if(void 0!==this.initPTS[e.cc]){this.waitingData=null,this.state=ff;const t={frag:e,part:i,payload:s.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(t),r&&super._handleFragmentLoadComplete(t)}else n&&n.cc!==t.frag.cc&&this.syncWithAnchor(n,t.frag)}else this.state=cf}}this.onTickEnd()}resetLoadingState(){const t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:t}=this;null!=t&&t.readyState&&(this.lastCurrentTime=t.currentTime)}doTickIdle(){var t;const{hls:e,levels:i,media:s,trackId:r}=this,n=e.config;if(!this.buffering||!s&&!this.primaryPrefetch&&(this.startFragRequested||!n.startFragPrefetch)||null==i||!i[r])return;const a=i[r],o=a.details;if(!o||this.waitForLive(a)||this.waitForCdnTuneIn(o))return this.state=mf,void(this.startFragRequested=!1);const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,xd,ed));const d=this.getFwdBufferInfo(l,ed);if(null===d)return;if(!this.switchingTrack&&this._streamEnded(d,o))return e.trigger($l.BUFFER_EOS,{type:"audio"}),void(this.state=vf);const h=d.len,c=e.maxBufferLength,u=o.fragments,f=u[0].start,g=this.getLoadPosition(),m=this.flushing?g:d.end;if(this.switchingTrack&&s){const t=g;o.PTSKnown&&t<f&&(d.end>f||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=f+.05)}if(h>=c&&!this.switchingTrack&&m<u[u.length-1].start)return;let p=this.getNextFragment(m,o);if(p&&this.isLoopLoading(p,m)&&(p=this.getNextFragmentLoopLoading(p,o,d,td,c)),!p)return void(this.bufferFlushed=!0);let A=(null==(t=this.mainFragLoading)?void 0:t.frag)||null;if(!this.audioOnly&&this.startFragRequested&&A&&Bd(p)&&!p.endList&&(!o.live||!this.loadingParts&&m<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(A)===Ic&&(this.mainFragLoading=A=null),A&&Bd(A))){if(p.start>A.end){const t=this.fragmentTracker.getFragAtPos(m,td);t&&t.end>A.end&&(A=t,this.mainFragLoading={frag:t,targetBufferTime:null})}if(p.start>A.end)return}this.loadFragment(p,a,m)}onMediaDetaching(t,e){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(t,e)}onAudioTracksUpdated(t,{audioTracks:e}){this.resetTransmuxer(),this.levels=e.map(t=>new jh(t))}onAudioTrackSwitching(t,e){const i=!!e.url;this.trackId=e.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),i?(this.switchingTrack=e,this.flushAudioIfNeeded(e),this.state!==hf&&(this.setInterval(100),this.state=cf,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=e,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(t,e){this.mainDetails=e.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded($l.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(t,e){var i;const{levels:s}=this,{details:r,id:n,groupId:a,track:o}=e;if(!s)return void this.warn(`Audio tracks reset while loading track ${n} "${o.name}" of "${a}"`);const l=this.mainDetails;if(!l||r.endCC>l.endCC||l.expired)return this.cachedTrackLoadedData=e,void(this.state!==hf&&(this.state=mf));this.cachedTrackLoadedData=null,this.log(`Audio track ${n} "${o.name}" of "${a}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const d=s[n];let h=0;if(r.live||null!=(i=d.details)&&i.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;var c;if(d.details)h=this.alignPlaylists(r,d.details,null==(c=this.levelLastLoaded)?void 0:c.details);r.alignedSliding||(nf(r,l),r.alignedSliding||af(r,l),h=r.fragmentStart)}d.details=r,this.levelLastLoaded=d,this.startFragRequested||this.setStartPosition(l,h),this.hls.trigger($l.AUDIO_TRACK_UPDATED,{details:r,id:n,groupId:e.groupId}),this.state!==mf||this.waitForCdnTuneIn(r)||(this.state=cf),this.tick()}_handleFragmentLoadProgress(t){var e;const i=t.frag,{part:s,payload:r}=t,{config:n,trackId:a,levels:o}=this;if(!o)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const l=o[a];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const d=l.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);const h=n.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let c=this.transmuxer;c||(c=this.transmuxer=new Jg(this.hls,ed,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const u=this.initPTS[i.cc],f=null==(e=i.initSegment)?void 0:e.data;if(void 0!==u){const t=!1,e=s?s.index:-1,n=-1!==e,a=new jc(i.level,i.sn,i.stats.chunkCount,r.byteLength,e,n);c.push(r,f,h,"",i,s,d.totalduration,t,a,u)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${a}`);const{cache:t}=this.waitingData=this.waitingData||{frag:i,part:s,cache:new If,complete:!1};t.push(new Uint8Array(r)),this.state!==hf&&(this.state=Ef)}}_handleFragmentLoadComplete(t){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(t)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(t,e){this.bufferFlushed=this.flushing=!1;const i=e.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(t,e){!this.audioOnly&&e.frag.type===td&&Bd(e.frag)&&(this.mainFragLoading=e,this.state===cf&&this.tick())}onFragBuffered(t,e){const{frag:i,part:s}=e;if(i.type===ed)if(this.fragContextChanged(i))this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if(Bd(i)){this.fragPrevious=i;const t=this.switchingTrack;t&&(this.bufferedTrack=t,this.switchingTrack=null,this.hls.trigger($l.AUDIO_TRACK_SWITCHED,ld({},t)))}this.fragBufferedComplete(i,s),this.media&&this.tick()}else this.audioOnly||i.type!==td||i.elementaryStreams.video||i.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null)}onError(t,e){var i;if(e.fatal)this.state=yf;else switch(e.details){case Yl.FRAG_GAP:case Yl.FRAG_PARSING_ERROR:case Yl.FRAG_DECRYPT_ERROR:case Yl.FRAG_LOAD_ERROR:case Yl.FRAG_LOAD_TIMEOUT:case Yl.KEY_LOAD_ERROR:case Yl.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ed,e);break;case Yl.AUDIO_TRACK_LOAD_ERROR:case Yl.AUDIO_TRACK_LOAD_TIMEOUT:case Yl.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==mf||(null==(i=e.context)?void 0:i.type)!==Zl||(this.state=cf);break;case Yl.BUFFER_ADD_CODEC_ERROR:case Yl.BUFFER_APPEND_ERROR:if("audio"!==e.parent)return;this.reduceLengthAndFlushBuffer(e)||this.resetLoadingState();break;case Yl.BUFFER_FULL_ERROR:if("audio"!==e.parent)return;this.reduceLengthAndFlushBuffer(e)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Yl.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}}onBufferFlushing(t,{type:e}){e!==Pd&&(this.flushing=!0)}onBufferFlushed(t,{type:e}){if(e!==Pd){this.flushing=!1,this.bufferFlushed=!0,this.state===vf&&(this.state=cf);const t=this.mediaBuffer||this.media;t&&(this.afterBufferFlushed(t,e,ed),this.tick())}}_handleTransmuxComplete(t){var e;const i="audio",{hls:s}=this,{remuxResult:r,chunkMeta:n}=t,a=this.getCurrentContext(n);if(!a)return void this.resetWhenMissingContext(n);const{frag:o,part:l,level:d}=a,{details:h}=d,{audio:c,text:u,id3:f,initSegment:g}=r;if(!this.fragContextChanged(o)&&h){if(this.state=pf,this.switchingTrack&&c&&this.completeAudioSwitch(this.switchingTrack),null!=g&&g.tracks){const t=o.initSegment||o;if(this.unhandledEncryptionError(g,o))return;this._bufferInitSegment(d,g.tracks,t,n),s.trigger($l.FRAG_PARSING_INIT_SEGMENT,{frag:t,id:i,tracks:g.tracks})}if(c){const{startPTS:t,endPTS:e,startDTS:i,endDTS:s}=c;l&&(l.elementaryStreams[xd]={startPTS:t,endPTS:e,startDTS:i,endDTS:s}),o.setElementaryStreamInfo(xd,t,e,i,s),this.bufferFragmentData(c,o,l,n)}if(null!=f&&null!=(e=f.samples)&&e.length){const t=ad({id:i,frag:o,details:h},f);s.trigger($l.FRAG_PARSING_METADATA,t)}if(u){const t=ad({id:i,frag:o,details:h},u);s.trigger($l.FRAG_PARSING_USERDATA,t)}}else this.fragmentTracker.removeFragment(o)}_bufferInitSegment(t,e,i,s){if(this.state!==pf)return;if(e.video&&delete e.video,e.audiovideo&&delete e.audiovideo,!e.audio)return;const r=e.audio;r.id=ed;const n=t.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${n}/${r.codec}]`),n&&1===n.split(",").length&&(r.levelCodec=n),this.hls.trigger($l.BUFFER_CODECS,e);const a=r.initSegment;if(null!=a&&a.byteLength){const t={type:"audio",frag:i,part:null,chunkMeta:s,parent:i.type,data:a};this.hls.trigger($l.BUFFER_APPENDING,t)}this.tickImmediate()}loadFragment(t,e,i){const s=this.fragmentTracker.getState(t);var r;if(this.switchingTrack||s===Tc||s===bc)if(Bd(t))if(null!=(r=e.details)&&r.live&&!this.initPTS[t.cc]){this.log(`Waiting for video PTS in continuity counter ${t.cc} of live stream before loading audio fragment ${t.sn} of level ${this.trackId}`),this.state=Ef;const i=this.mainDetails;i&&i.fragmentStart!==e.details.fragmentStart&&af(e.details,i)}else super.loadFragment(t,e,i);else this._loadInitSegment(t,e);else this.clearTrackerIfNeeded(t)}flushAudioIfNeeded(t){if(this.media&&this.bufferedTrack){const{name:e,lang:i,assocLang:s,characteristics:r,audioCodec:n,channels:a}=this.bufferedTrack;$h({name:e,lang:i,assocLang:s,characteristics:r,audioCodec:n,channels:a},t,zh)||(Zh(t.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=t)}}completeAudioSwitch(t){const{hls:e}=this;this.flushAudioIfNeeded(t),this.bufferedTrack=t,this.switchingTrack=null,e.trigger($l.AUDIO_TRACK_SWITCHED,ld({},t))}},audioTrackController:class extends tm{constructor(t){super(t,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:t}=this;t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.MANIFEST_PARSED,this.onManifestParsed,this),t.on($l.LEVEL_LOADING,this.onLevelLoading,this),t.on($l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on($l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on($l.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.MANIFEST_PARSED,this.onManifestParsed,this),t.off($l.LEVEL_LOADING,this.onLevelLoading,this),t.off($l.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off($l.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off($l.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(t,e){this.tracks=e.audioTracks||[]}onAudioTrackLoaded(t,e){const{id:i,groupId:s,details:r}=e,n=this.tracksInGroup[i];if(!n||n.groupId!==s)return void this.warn(`Audio track with id:${i} and group:${s} not found in active group ${null==n?void 0:n.groupId}`);const a=n.details;n.details=e.details,this.log(`Audio track ${i} "${n.name}" lang:${n.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,e,a)}onLevelLoading(t,e){this.switchLevel(e.level)}onLevelSwitching(t,e){this.switchLevel(e.level)}switchLevel(t){const e=this.hls.levels[t];if(!e)return;const i=e.audioGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some(t=>-1===(null==s?void 0:s.indexOf(t)))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const t=this.tracks.filter(t=>!i||-1!==i.indexOf(t.groupId));if(t.length)this.selectDefaultTrack&&!t.some(t=>t.default)&&(this.selectDefaultTrack=!1),t.forEach((t,e)=>{t.id=e});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=t;const e=this.hls.config.audioPreference;if(!r&&e){const i=Yh(e,t,zh);if(i>-1)r=t[i];else{const t=Yh(e,this.tracks);r=this.tracks[t]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const a={audioTracks:t};this.log(`Updating audio tracks, ${t.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger($l.AUDIO_TRACKS_UPDATED,a);const o=this.trackId;if(-1!==s&&-1===o)this.setAudioTrack(s);else if(t.length&&-1===o){var n;const e=new Error(`No audio track selected for current audio group-ID(s): ${null==(n=this.groupIds)?void 0:n.join(",")} track count: ${t.length}`);this.warn(e.message),this.hls.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:e})}}}onError(t,e){!e.fatal&&e.context&&(e.context.type!==Zl||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||this.checkRetry(e))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}setAudioOption(t){const e=this.hls;if(e.config.audioPreference=t,t){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const s=this.currentTrack;if(s&&$h(t,s,zh))return s;const r=Yh(t,this.tracksInGroup,zh);if(r>-1){const t=this.tracksInGroup[r];return this.setAudioTrack(r),t}if(s){let s=e.loadLevel;-1===s&&(s=e.firstAutoLevel);const r=function(t,e,i,s,r){const n=e[s],a=e.reduce((t,e,i)=>{const s=e.uri;return(t[s]||(t[s]=[])).push(i),t},{})[n.uri];a.length>1&&(s=Math.max.apply(Math,a));const o=n.videoRange,l=n.frameRate,d=n.codecSet.substring(0,4),h=Xh(e,s,e=>{if(e.videoRange!==o||e.frameRate!==l||e.codecSet.substring(0,4)!==d)return!1;const s=e.audioGroups,n=i.filter(t=>!s||-1!==s.indexOf(t.groupId));return Yh(t,n,r)>-1});return h>-1?h:Xh(e,s,e=>{const s=e.audioGroups,n=i.filter(t=>!s||-1!==s.indexOf(t.groupId));return Yh(t,n,r)>-1})}(t,e.levels,i,s,zh);if(-1===r)return null;e.nextLoadLevel=r}if(t.channels||t.audioCodec){const e=Yh(t,i);if(e>-1)return i[e]}}}return null}setAudioTrack(t){const e=this.tracksInGroup;if(t<0||t>=e.length)return void this.warn(`Invalid audio track id: ${t}`);this.selectDefaultTrack=!1;const i=this.currentTrack,s=e[t],r=s.details&&!s.details.live;if(t===this.trackId&&s===i&&r)return;if(this.log(`Switching to audio-track ${t} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=t,this.currentTrack=s,this.hls.trigger($l.AUDIO_TRACK_SWITCHING,ld({},s)),r)return;const n=this.switchParams(s.url,null==i?void 0:i.details,s.details);this.loadPlaylist(n)}findTrackId(t){const e=this.tracksInGroup;for(let i=0;i<e.length;i++){const s=e[i];if((!this.selectDefaultTrack||s.default)&&(!t||$h(t,s,zh)))return i}if(t){const{name:i,lang:s,assocLang:r,characteristics:n,audioCodec:a,channels:o}=t;for(let t=0;t<e.length;t++){if($h({name:i,lang:s,assocLang:r,characteristics:n,audioCodec:a,channels:o},e[t],zh))return t}for(let l=0;l<e.length;l++){const i=e[l];if(im(t.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<e.length;l++){const i=e[l];if(im(t.attrs,i.attrs,["LANGUAGE"]))return l}}return-1}loadPlaylist(t){super.loadPlaylist();const e=this.currentTrack;this.shouldLoadPlaylist(e)&&Zh(e.url,this.hls)&&this.scheduleLoading(e,t)}loadingPlaylist(t,e){super.loadingPlaylist(t,e);const i=t.id,s=t.groupId,r=this.getUrlWithDirectives(t.url,e),n=t.details,a=null==n?void 0:n.age;this.log(`Loading audio-track ${i} "${t.name}" lang:${t.lang} group:${s}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""}${a&&n.live?" age "+a.toFixed(1)+(n.type&&" "+n.type||""):""} ${r}`),this.hls.trigger($l.AUDIO_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:e||null,track:t})}},emeController:ap,cmcdController:class{constructor(t){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=t=>{try{this.apply(t,{ot:cm.MANIFEST,su:!this.initialized})}catch(e){this.hls.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=t=>{try{const{frag:e,part:i}=t,s=this.hls.levels[e.level],r=this.getObjectType(e),n={d:1e3*(i||e).duration,ot:r};r!==cm.VIDEO&&r!==cm.AUDIO&&r!=cm.MUXED||(n.br=s.bitrate/1e3,n.tb=this.getTopBandwidth(r)/1e3,n.bl=this.getBufferLength(r));const a=i?this.getNextPart(i):this.getNextFrag(e);null!=a&&a.url&&a.url!==e.url&&(n.nor=a.url),this.apply(t,n)}catch(e){this.hls.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=t;const e=this.config=t.config,{cmcd:i}=e;null!=i&&(e.pLoader=this.createPlaylistLoader(),e.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||t.sessionId,this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const t=this.hls;t.on($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on($l.MEDIA_DETACHED,this.onMediaDetached,this),t.on($l.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const t=this.hls;t.off($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off($l.MEDIA_DETACHED,this.onMediaDetached,this),t.off($l.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(t,e){this.media=e.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(t,e){var i,s;this.audioBuffer=null==(i=e.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(s=e.tracks.video)?void 0:s.buffer}createData(){var t;return{v:1,sf:um.HLS,sid:this.sid,cid:this.cid,pr:null==(t=this.media)?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(t,e={}){ad(e,this.createData());const i=e.ot===cm.INIT||e.ot===cm.VIDEO||e.ot===cm.MUXED;this.starved&&i&&(e.bs=!0,e.su=!0,this.starved=!1),null==e.su&&(e.su=this.buffering);const{includeKeys:s}=this;s&&(e=Object.keys(e).reduce((t,i)=>(s.includes(i)&&(t[i]=e[i]),t),{}));const r={baseUrl:t.url};this.useHeaders?(t.headers||(t.headers={}),tp(t.headers,e,r)):t.url=sp(t.url,e,r)}getNextFrag(t){var e;const i=null==(e=this.hls.levels[t.level])?void 0:e.details;if(i){const e=t.sn-i.startSN;return i.fragments[e+1]}}getNextPart(t){var e;const{index:i,fragment:s}=t,r=null==(e=this.hls.levels[s.level])||null==(e=e.details)?void 0:e.partList;if(r){const{sn:t}=s;for(let e=r.length-1;e>=0;e--){const s=r[e];if(s.index===i&&s.fragment.sn===t)return r[e+1]}}}getObjectType(t){const{type:e}=t;return"subtitle"===e?cm.TIMED_TEXT:"initSegment"===t.sn?cm.INIT:"audio"===e?cm.AUDIO:"main"===e?this.hls.audioTracks.length?cm.VIDEO:cm.MUXED:void 0}getTopBandwidth(t){let e,i=0;const s=this.hls;if(t===cm.AUDIO)e=s.audioTracks;else{const t=s.maxAutoLevel,i=t>-1?t+1:s.levels.length;e=s.levels.slice(0,i)}return e.forEach(t=>{t.bitrate>i&&(i=t.bitrate)}),i>0?i:NaN}getBufferLength(t){const e=this.media,i=t===cm.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!e)return NaN;return 1e3*Gc.bufferInfo(i,e.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:t}=this.config,e=this.applyPlaylistData,i=t||this.config.loader;return class{constructor(t){this.loader=void 0,this.loader=new i(t)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(t,i,s){e(t),this.loader.load(t,i,s)}}}createFragmentLoader(){const{fLoader:t}=this.config,e=this.applyFragmentData,i=t||this.config.loader;return class{constructor(t){this.loader=void 0,this.loader=new i(t)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(t,i,s){e(t),this.loader.load(t,i,s)}}}},contentSteeringController:class extends dd{constructor(t){super("content-steering",t.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=t,this.registerListeners()}registerListeners(){const t=this.hls;t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.MANIFEST_LOADED,this.onManifestLoaded,this),t.on($l.MANIFEST_PARSED,this.onManifestParsed,this),t.on($l.ERROR,this.onError,this)}unregisterListeners(){const t=this.hls;t&&(t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.MANIFEST_LOADED,this.onManifestLoaded,this),t.off($l.MANIFEST_PARSED,this.onManifestParsed,this),t.off($l.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((t,e)=>(-1===t.indexOf(e.pathwayId)&&t.push(e.pathwayId),t),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(t){this.updatePathwayPriority(t)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const t=1e3*this.timeToLoad-(performance.now()-this.updated);if(t>0)return void this.scheduleRefresh(this.uri,t)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(t){const e=this.levels;e&&(this.levels=e.filter(e=>e!==t))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(t,e){const{contentSteering:i}=e;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(t,e){this.audioTracks=e.audioTracks,this.subtitleTracks=e.subtitleTracks}onError(t,e){const{errorAction:i}=e;if((null==i?void 0:i.action)===fc&&i.flags===Ac){const t=this.levels;let s=this._pathwayPriority,r=this.pathwayId;if(e.context){const{groupId:i,pathwayId:s,type:n}=e.context;i&&t?r=this.getPathwayForGroupId(i,n,r):s&&(r=s)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&t&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),e.details!==Yl.BUFFER_APPEND_ERROR||e.fatal?i.resolved||this.warn(`Could not resolve ${e.details} ("${e.error.message}") with content-steering for Pathway: ${r} levels: ${t?t.length:t} priorities: ${Qh(s)} penalized: ${Qh(this.penalizedPathways)}`):i.resolved=!0}}filterParsedLevels(t){this.levels=t;let e=this.getLevelsForPathway(this.pathwayId);if(0===e.length){const i=t[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),e=this.getLevelsForPathway(i),this.pathwayId=i}return e.length!==t.length&&this.log(`Found ${e.length}/${t.length} levels in Pathway "${this.pathwayId}"`),e}getLevelsForPathway(t){return null===this.levels?[]:this.levels.filter(e=>t===e.pathwayId)}updatePathwayPriority(t){let e;this._pathwayPriority=t;const i=this.penalizedPathways,s=performance.now();Object.keys(i).forEach(t=>{s-i[t]>3e5&&delete i[t]});for(let r=0;r<t.length;r++){const s=t[r];if(s in i)continue;if(s===this.pathwayId)return;const n=this.hls.nextLoadLevel,a=this.hls.levels[n];if(e=this.getLevelsForPathway(s),e.length>0){this.log(`Setting Pathway to "${s}"`),this.pathwayId=s,Zu(e),this.hls.trigger($l.LEVELS_UPDATED,{levels:e});const t=this.hls.levels[n];a&&t&&this.levels&&(t.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&t.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${t.bitrate}`),this.hls.nextLoadLevel=n);break}}}getPathwayForGroupId(t,e,i){const s=this.getLevelsForPathway(i).concat(this.levels||[]);for(let r=0;r<s.length;r++)if(e===Zl&&s[r].hasAudioGroup(t)||e===Jl&&s[r].hasSubtitleGroup(t))return s[r].pathwayId;return i}clonePathways(t){const e=this.levels;if(!e)return;const i={},s={};t.forEach(t=>{const{ID:r,"BASE-ID":n,"URI-REPLACEMENT":a}=t;if(e.some(t=>t.pathwayId===r))return;const o=this.getLevelsForPathway(n).map(t=>{const e=new Xc(t.attrs);e["PATHWAY-ID"]=r;const n=e.AUDIO&&`${e.AUDIO}_clone_${r}`,o=e.SUBTITLES&&`${e.SUBTITLES}_clone_${r}`;n&&(i[e.AUDIO]=n,e.AUDIO=n),o&&(s[e.SUBTITLES]=o,e.SUBTITLES=o);const l=np(t.uri,e["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),d=new jh({attrs:e,audioCodec:t.audioCodec,bitrate:t.bitrate,height:t.height,name:t.name,url:l,videoCodec:t.videoCodec,width:t.width});if(t.audioGroups)for(let i=1;i<t.audioGroups.length;i++)d.addGroupId("audio",`${t.audioGroups[i]}_clone_${r}`);if(t.subtitleGroups)for(let i=1;i<t.subtitleGroups.length;i++)d.addGroupId("text",`${t.subtitleGroups[i]}_clone_${r}`);return d});e.push(...o),rp(this.audioTracks,i,a,r),rp(this.subtitleTracks,s,a,r)})}loadSteeringManifest(t){const e=this.hls.config,i=e.loader;let s;this.loader&&this.loader.destroy(),this.loader=new i(e);try{s=new self.URL(t)}catch(d){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest URI: ${t}`)}if("data:"!==s.protocol){const t=0|(this.hls.bandwidthEstimate||e.abrEwmaDefaultEstimate);s.searchParams.set("_HLS_pathway",this.pathwayId),s.searchParams.set("_HLS_throughput",""+t)}const r={responseType:"json",url:s.href},n=e.steeringManifestLoadPolicy.default,a=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(t,e,i,r)=>{this.log(`Loaded steering manifest: "${s}"`);const n=t.data;if(1!==(null==n?void 0:n.VERSION))return void this.log(`Steering VERSION ${n.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=n.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":l}=n;if(a)try{this.uri=new self.URL(a,s).href}catch(d){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${a}`)}this.scheduleRefresh(this.uri||i.url),o&&this.clonePathways(o);const h={steeringManifest:n,url:s.toString()};this.hls.trigger($l.STEERING_MANIFEST_LOADED,h),l&&this.updatePathwayPriority(l)},onError:(t,e,i,s)=>{if(this.log(`Error loading steering manifest: ${t.code} ${t.text} (${e.url})`),this.stopLoad(),410===t.code)return this.enabled=!1,void this.log(`Steering manifest ${e.url} no longer available`);let r=1e3*this.timeToLoad;if(429===t.code){const t=this.loader;if("function"==typeof(null==t?void 0:t.getResponseHeader)){const e=t.getResponseHeader("Retry-After");e&&(r=1e3*parseFloat(e))}return void this.log(`Steering manifest ${e.url} rate limited`)}this.scheduleRefresh(this.uri||e.url,r)},onTimeout:(t,e,i)=>{this.log(`Timeout loading steering manifest (${e.url})`),this.scheduleRefresh(this.uri||e.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(r,o,l)}scheduleRefresh(t,e=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var e;const i=null==(e=this.hls)?void 0:e.media;!i||i.ended?this.scheduleRefresh(t,1e3*this.timeToLoad):this.loadSteeringManifest(t)},e)}},interstitialsController:class extends dd{constructor(t,e){super("interstitials",t.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const t=this.currentTime;if(void 0===t||this.playbackDisabled||!this.schedule)return;const e=t-this.timelinePos;if(Math.abs(e)<1/7056e5)return;const i=e<=-.01;this.timelinePos=t,this.bufferedPos=t;const s=this.playingItem;if(!s)return void this.checkBuffer();if(i){this.schedule.resetErrorsInRange(t,t-e)&&this.updateSchedule(!0)}if(this.checkBuffer(),i&&t<s.start||t>=s.end){var r;const e=this.findItemIndex(s);let n=this.schedule.findItemIndexAtTime(t);if(-1===n&&(n=e+(i?-1:1),this.log(`seeked ${i?"back ":""}to position not covered by schedule ${t} (resolving from ${e} to ${n})`)),!this.isInterstitial(s)&&null!=(r=this.media)&&r.paused&&(this.shouldPlay=!1),!i&&n>e){const t=this.schedule.findJumpRestrictedIndex(e+1,n);if(t>e)return void this.setSchedulePosition(t)}return void this.setSchedulePosition(n)}const n=this.playingAsset;if(!n){if(this.playingLastItem&&this.isInterstitial(s)){const e=s.event.assetList[0];e&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(t,e))}return}const a=n.timelineStart,o=n.duration||0;var l;(i&&t<a||t>=a+o)&&(null!=(l=s.event)&&l.appendInPlace&&(this.clearAssetPlayers(s.event,s),this.flushFrontBuffer(t)),this.setScheduleToAssetAtTime(t,n))},this.onTimeupdate=()=>{const t=this.currentTime;if(void 0===t||this.playbackDisabled)return;if(!(t>this.timelinePos))return;this.timelinePos=t,t>this.bufferedPos&&this.checkBuffer();const e=this.playingItem;if(!e||this.playingLastItem)return;if(t>=e.end){this.timelinePos=e.end;const t=this.findItemIndex(e);this.setSchedulePosition(t+1)}const i=this.playingAsset;if(!i)return;t>=i.timelineStart+(i.duration||0)&&this.setScheduleToAssetAtTime(t,i)},this.onScheduleUpdate=(t,e)=>{const i=this.schedule;if(!i)return;const s=this.playingItem,r=i.events||[],n=i.items||[],a=i.durations,o=t.map(t=>t.identifier),l=!(!r.length&&!o.length);(l||e)&&this.log(`INTERSTITIALS_UPDATED (${r.length}): ${r}\nSchedule: ${n.map(t=>kp(t))} pos: ${this.timelinePos}`),o.length&&this.log(`Removed events ${o}`);let d=null,h=null;s&&(d=this.updateItem(s,this.timelinePos),this.itemsMatch(s,d)?this.playingItem=d:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const c=this.bufferingItem;if(c&&(h=this.updateItem(c,this.bufferedPos),this.itemsMatch(c,h)?this.bufferingItem=h:c.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(c.event,null))),t.forEach(t=>{t.assetList.forEach(t=>{this.clearAssetPlayer(t.identifier,null)})}),this.playerQueue.forEach(t=>{if(t.interstitial.appendInPlace){const i=t.assetItem.timelineStart,s=t.timelineOffset-i;if(s)try{t.timelineOffset=i}catch(e){Math.abs(s)>Ap&&this.warn(`${e} ("${t.assetId}" ${t.timelineOffset}->${i})`)}}}),l||e){if(this.hls.trigger($l.INTERSTITIALS_UPDATED,{events:r.slice(0),schedule:n.slice(0),durations:a,removedIds:o}),this.isInterstitial(s)&&o.includes(s.event.identifier))return this.warn(`Interstitial "${s.event.identifier}" removed while playing`),void this.primaryFallback(s.event);s&&this.trimInPlace(d,s),c&&h!==d&&this.trimInPlace(h,c),this.checkBuffer()}},this.hls=t,this.HlsPlayerClass=e,this.assetListLoader=new wp(t),this.schedule=new Rp(this.onScheduleUpdate,t.logger),this.registerListeners()}registerListeners(){const t=this.hls;t&&(t.on($l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.LEVEL_UPDATED,this.onLevelUpdated,this),t.on($l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on($l.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),t.on($l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on($l.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),t.on($l.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),t.on($l.ASSET_LIST_LOADED,this.onAssetListLoaded,this),t.on($l.BUFFER_APPENDED,this.onBufferAppended,this),t.on($l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on($l.BUFFERED_TO_END,this.onBufferedToEnd,this),t.on($l.MEDIA_ENDED,this.onMediaEnded,this),t.on($l.ERROR,this.onError,this),t.on($l.DESTROYING,this.onDestroying,this))}unregisterListeners(){const t=this.hls;t&&(t.off($l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.LEVEL_UPDATED,this.onLevelUpdated,this),t.off($l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off($l.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),t.off($l.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off($l.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),t.off($l.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),t.off($l.ASSET_LIST_LOADED,this.onAssetListLoaded,this),t.off($l.BUFFER_CODECS,this.onBufferCodecs,this),t.off($l.BUFFER_APPENDED,this.onBufferAppended,this),t.off($l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off($l.BUFFERED_TO_END,this.onBufferedToEnd,this),t.off($l.MEDIA_ENDED,this.onMediaEnded,this),t.off($l.ERROR,this.onError,this),t.off($l.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var t;null==(t=this.getBufferingPlayer())||t.resumeBuffering()}pauseBuffering(){var t;null==(t=this.getBufferingPlayer())||t.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const t=this.primaryMedia||this.media;t&&this.removeMediaListeners(t)}removeMediaListeners(t){lf(t,"play",this.onPlay),lf(t,"pause",this.onPause),lf(t,"seeking",this.onSeeking),lf(t,"timeupdate",this.onTimeupdate)}onMediaAttaching(t,e){const i=this.media=e.media;of(i,"seeking",this.onSeeking),of(i,"timeupdate",this.onTimeupdate),of(i,"play",this.onPlay),of(i,"pause",this.onPause)}onMediaAttached(t,e){const i=this.effectivePlayingItem,s=this.detachedData;if(this.detachedData=null,null===i)this.checkStart();else if(!s){this.clearScheduleState();const t=this.findItemIndex(i);this.setSchedulePosition(t)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(t,e){const i=!!e.transferMedia,s=this.media;if(this.media=null,!i&&(s&&this.removeMediaListeners(s),this.detachedData)){const t=this.getBufferingPlayer();t&&(this.log(`Removing schedule state for detachedData and ${t}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,t.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const t=this,e=()=>t.bufferingItem||t.waitingItem,i=e=>e?t.getAssetPlayer(e.identifier):e,s=(e,s,n,a,o)=>{if(e){let l=e[s].start;const d=e.event;if(d){if("playout"===s||d.timelineOccupancy!==vp.Point){const t=i(n);(null==t?void 0:t.interstitial)===d&&(l+=t.assetItem.startOffset+t[o])}}else{l+=("bufferedPos"===a?r():t[a])-e.start}return l}return 0},r=()=>{const e=t.bufferedPos;return e===Number.MAX_VALUE?n("primary"):Math.max(e,0)},n=e=>{var i,s;return null!=(i=t.primaryDetails)&&i.live?t.primaryDetails.edge:(null==(s=t.schedule)?void 0:s.durations[e])||0},a=(e,r)=>{var n,a;const o=t.effectivePlayingItem;if(null!=o&&null!=(n=o.event)&&n.restrictions.skip||!t.schedule)return;t.log(`seek to ${e} "${r}"`);const l=t.effectivePlayingItem,d=t.schedule.findItemIndexAtTime(e,r),h=null==(a=t.schedule.items)?void 0:a[d],c=t.getBufferingPlayer(),u=null==c?void 0:c.interstitial,f=null==u?void 0:u.appendInPlace,g=l&&t.itemsMatch(l,h);if(l&&(f||g)){const n=i(t.playingAsset),a=(null==n?void 0:n.media)||t.primaryMedia;if(a){const i="primary"===r?a.currentTime:s(l,r,t.playingAsset,"timelinePos","currentTime"),o=e-i,d=(f?i:a.currentTime)+o;if(d>=0&&(!n||f||d<=n.duration))return void(a.currentTime=d)}}if(h){let i=e;if("primary"!==r){const t=e-h[r].start;i=h.start+t}const s=!t.isInterstitial(h);if(t.isInterstitial(l)&&!l.event.appendInPlace||!s&&!h.event.appendInPlace){if(l){const n=t.findItemIndex(l);if(d>n){const e=t.schedule.findJumpRestrictedIndex(n+1,d);if(e>n)return void t.setSchedulePosition(e)}let a=0;if(s)t.timelinePos=i,t.checkBuffer();else{const t=h.event.assetList,i=e-(h[r]||h).start;for(let e=t.length;e--;){const s=t[e];if(s.duration&&i>=s.startOffset&&i<s.startOffset+s.duration){a=e;break}}}t.setSchedulePosition(d,a)}}else{const e=t.media||(f?null==c?void 0:c.media:null);e&&(e.currentTime=i)}}},o=()=>{const i=t.effectivePlayingItem;if(t.isInterstitial(i))return i;const s=e();return t.isInterstitial(s)?s:null},l={get bufferedEnd(){const i=e(),r=t.bufferingItem;var n;return r&&r===i&&(s(r,"playout",t.bufferingAsset,"bufferedPos","bufferedEnd")-r.playout.start||(null==(n=t.bufferingAsset)?void 0:n.startOffset))||0},get currentTime(){const e=o(),i=t.effectivePlayingItem;return i&&i===e?s(i,"playout",t.effectivePlayingAsset,"timelinePos","currentTime")-i.playout.start:0},set currentTime(e){const i=o(),s=t.effectivePlayingItem;s&&s===i&&a(e+s.playout.start,"playout")},get duration(){const t=o();return t?t.playout.end-t.playout.start:0},get assetPlayers(){var e;const i=null==(e=o())?void 0:e.event.assetList;return i?i.map(e=>t.getAssetPlayer(e.identifier)):[]},get playingIndex(){var e;const i=null==(e=o())?void 0:e.event;return i&&t.effectivePlayingAsset?i.findAssetIndex(t.effectivePlayingAsset):-1},get scheduleItem(){return o()}};return this.manager={get events(){var e;return(null==(e=t.schedule)||null==(e=e.events)?void 0:e.slice(0))||[]},get schedule(){var e;return(null==(e=t.schedule)||null==(e=e.items)?void 0:e.slice(0))||[]},get interstitialPlayer(){return o()?l:null},get playerQueue(){return t.playerQueue.slice(0)},get bufferingAsset(){return t.bufferingAsset},get bufferingItem(){return e()},get bufferingIndex(){const i=e();return t.findItemIndex(i)},get playingAsset(){return t.effectivePlayingAsset},get playingItem(){return t.effectivePlayingItem},get playingIndex(){const e=t.effectivePlayingItem;return t.findItemIndex(e)},primary:{get bufferedEnd(){return r()},get currentTime(){const e=t.timelinePos;return e>0?e:0},set currentTime(t){a(t,"primary")},get duration(){return n("primary")},get seekableStart(){var e;return(null==(e=t.primaryDetails)?void 0:e.fragmentStart)||0}},integrated:{get bufferedEnd(){return s(e(),"integrated",t.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return s(t.effectivePlayingItem,"integrated",t.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(t){a(t,"integrated")},get duration(){return n("integrated")},get seekableStart(){var e;return((e,i)=>{var s;if(0!==e&&"primary"!==i&&null!=(s=t.schedule)&&s.length){var r;const s=t.schedule.findItemIndexAtTime(e),n=null==(r=t.schedule.items)?void 0:r[s];if(n)return e+(n[i].start-n.start)}return e})((null==(e=t.primaryDetails)?void 0:e.fragmentStart)||0,"integrated")}},skip:()=>{const e=t.effectivePlayingItem,i=null==e?void 0:e.event;if(i&&!i.restrictions.skip){const s=t.findItemIndex(e);if(i.appendInPlace){const t=e.playout.start+e.event.duration;a(t+.001,"playout")}else t.advanceAfterAssetEnded(i,s,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var t;const e=this.playingItem,i=null==(t=this.schedule)?void 0:t.items;return!!(this.playbackStarted&&e&&i)&&this.findItemIndex(e)===i.length-1}get playbackStarted(){return null!==this.effectivePlayingItem}get currentTime(){var t,e;if(null===this.mediaSelection)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let s=this.media;!s&&null!=(t=this.bufferingItem)&&null!=(t=t.event)&&t.appendInPlace&&(s=this.primaryMedia);const r=null==(e=s)?void 0:e.currentTime;return void 0!==r&&Ql(r)?r:void 0}get primaryMedia(){var t;return this.media||(null==(t=this.detachedData)?void 0:t.media)||null}isInterstitial(t){return!(null==t||!t.event)}retreiveMediaSource(t,e){const i=this.getAssetPlayer(t);i&&this.transferMediaFromPlayer(i,e)}transferMediaFromPlayer(t,e){const i=t.interstitial.appendInPlace,s=t.media;if(i&&s===this.primaryMedia){if(this.bufferingAsset=null,(!e||this.isInterstitial(e)&&!e.event.appendInPlace)&&e&&s)return void(this.detachedData={media:s});const i=t.transferMedia();this.log(`transfer MediaSource from ${t} ${Qh(i)}`),this.detachedData=i}else e&&s&&(this.shouldPlay||(this.shouldPlay=!s.paused))}transferMediaTo(t,e){var i,s;if(t.media===e)return;let r=null;const n=this.hls,a=t!==n,o=a&&t.interstitial.appendInPlace,l=null==(i=this.detachedData)?void 0:i.mediaSource;let d;if(n.media)o&&(r=n.transferMedia(),this.detachedData=r),d="Primary";else if(l){const t=this.getBufferingPlayer();t?(r=t.transferMedia(),d=`${t}`):d="detached MediaSource"}else d="detached media";if(!r)if(l)r=this.detachedData,this.log(`using detachedData: MediaSource ${Qh(r)}`);else if(!this.detachedData||n.media===e){const t=this.playerQueue;t.length>1&&t.forEach(t=>{if(a&&t.interstitial.appendInPlace!==o){const e=t.interstitial;this.clearInterstitial(t.interstitial,null),e.appendInPlace=!1,e.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${e}`)}}),this.hls.detachMedia(),this.detachedData={media:e}}const h=r&&"mediaSource"in r&&"closed"!==(null==(s=r.mediaSource)?void 0:s.readyState),c=h&&r?r:e;this.log(`${h?"transfering MediaSource":"attaching media"} to ${a?t:"Primary"} from ${d} (media.currentTime: ${e.currentTime})`);const u=this.schedule;if(c===r&&u){const e=a&&t.assetId===u.assetIdAtEnd;c.overrides={duration:u.duration,endOfStream:!a||e,cueRemoval:!a}}t.attachMedia(c)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const t=this.schedule,e=null==t?void 0:t.events;if(!e||this.playbackDisabled||!this.media)return;-1===this.bufferedPos&&(this.bufferedPos=0);const i=this.timelinePos,s=this.effectivePlayingItem;if(-1===i){const i=this.hls.startPosition;if(this.log(Cp("checkStart",i)),this.timelinePos=i,e.length&&e[0].cue.pre){const i=t.findEventIndex(e[0].identifier);this.setSchedulePosition(i)}else if(i>=0||!this.primaryLive){const e=this.timelinePos=i>0?i:0,s=t.findItemIndexAtTime(e);this.setSchedulePosition(s)}}else if(s&&!this.playingItem){const e=t.findItemIndex(s);this.setSchedulePosition(e)}}advanceAssetBuffering(t,e){const i=t.event,s=i.findAssetIndex(e),r=bp(i,s);if(i.isAssetPastPlayoutLimit(r)){if(this.schedule){var n;const e=null==(n=this.schedule.items)?void 0:n[this.findItemIndex(t)+1];e&&this.bufferedToItem(e)}}else this.bufferedToEvent(t,r)}advanceAfterAssetEnded(t,e,i){const s=bp(t,i);if(t.isAssetPastPlayoutLimit(s)){if(this.schedule){const i=this.schedule.items;if(i){const s=e+1;if(s>=i.length)return void this.setSchedulePosition(-1);const r=t.resumeTime;this.timelinePos<r&&(this.log(Cp("advanceAfterAssetEnded",r)),this.timelinePos=r,t.appendInPlace&&this.advanceInPlace(r),this.checkBuffer(this.bufferedPos<r)),this.setSchedulePosition(s)}}}else{if(t.appendInPlace){const e=t.assetList[s];e&&this.advanceInPlace(e.timelineStart)}this.setSchedulePosition(e,s)}}setScheduleToAssetAtTime(t,e){const i=this.schedule;if(!i)return;const s=e.parentIdentifier,r=i.getEvent(s);if(r){const e=i.findEventIndex(s),n=i.findAssetIndex(r,t);this.advanceAfterAssetEnded(r,e,n-1)}}setSchedulePosition(t,e){var i;const s=null==(i=this.schedule)?void 0:i.items;if(!s||this.playbackDisabled)return;const r=t>=0?s[t]:null;this.log(`setSchedulePosition ${t}, ${e} (${r?kp(r):r}) pos: ${this.timelinePos}`);const n=this.waitingItem||this.playingItem,a=this.playingLastItem;if(this.isInterstitial(n)){const i=n.event,d=this.playingAsset,h=null==d?void 0:d.identifier,c=h?this.getAssetPlayer(h):null;if(c&&h&&(!this.eventItemsMatch(n,r)||void 0!==e&&h!==i.assetList[e].identifier)){var o;const e=i.findAssetIndex(d);if(this.log(`INTERSTITIAL_ASSET_ENDED ${e+1}/${i.assetList.length} ${Ip(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger($l.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:e,event:i,schedule:s.slice(0),scheduleIndex:t,player:c}),n!==this.playingItem)return void(this.itemsMatch(n,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(i,this.findItemIndex(this.playingItem),e));this.retreiveMediaSource(h,r),!c.media||null!=(o=this.detachedData)&&o.mediaSource||c.detachMedia()}if(!this.eventItemsMatch(n,r)&&(this.endedItem=n,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${i} ${kp(n)}`),i.hasPlayed=!0,this.hls.trigger($l.INTERSTITIAL_ENDED,{event:i,schedule:s.slice(0),scheduleIndex:t}),i.cue.once)){var l;this.updateSchedule();const t=null==(l=this.schedule)?void 0:l.items;if(r&&t){const i=this.findItemIndex(r);this.advanceSchedule(i,t,e,n,a)}return}}this.advanceSchedule(t,s,e,n,a)}advanceSchedule(t,e,i,s,r){const n=this.schedule;if(!n)return;const a=e[t]||null,o=this.primaryMedia,l=this.playerQueue;if(l.length&&l.forEach(e=>{const i=e.interstitial,s=n.findEventIndex(i.identifier);(s<t||s>t+1)&&this.clearInterstitial(i,a)}),this.isInterstitial(a)){this.timelinePos=Math.min(Math.max(this.timelinePos,a.start),a.end);const r=a.event;if(void 0===i){const e=bp(r,(i=n.findAssetIndex(r,this.timelinePos))-1);if(r.isAssetPastPlayoutLimit(e)||r.appendInPlace&&this.timelinePos===a.end)return void this.advanceAfterAssetEnded(r,t,i);i=e}const l=this.waitingItem;this.assetsBuffered(a,o)||this.setBufferingItem(a);let d=this.preloadAssets(r,i);if(this.eventItemsMatch(a,l||s)||(this.waitingItem=a,this.log(`INTERSTITIAL_STARTED ${kp(a)} ${r.appendInPlace?"append in place":""}`),this.hls.trigger($l.INTERSTITIAL_STARTED,{event:r,schedule:e.slice(0),scheduleIndex:t})),!r.assetListLoaded)return void this.log(`Waiting for ASSET-LIST to complete loading ${r}`);if(r.assetListLoader&&(r.assetListLoader.destroy(),r.assetListLoader=void 0),!o)return void this.log(`Waiting for attachMedia to start Interstitial ${r}`);this.waitingItem=this.endedItem=null,this.playingItem=a;const h=r.assetList[i];if(!h)return void this.advanceAfterAssetEnded(r,t,i||0);if(d||(d=this.getAssetPlayer(h.identifier)),null===d||d.destroyed){const t=r.assetList.length;this.warn(`asset ${i+1}/${t} player destroyed ${r}`),d=this.createAssetPlayer(r,h,i),d.loadSource()}if(!this.eventItemsMatch(a,this.bufferingItem)&&r.appendInPlace&&this.isAssetBuffered(h))return;this.startAssetPlayer(d,i,e,t,o),this.shouldPlay&&Dp(d.media)}else a?(this.resumePrimary(a,t,s),this.shouldPlay&&Dp(this.hls.media)):r&&this.isInterstitial(s)&&(this.endedItem=null,this.playingItem=s,s.event.appendInPlace||this.attachPrimary(n.durations.primary,null))}get playbackDisabled(){return!1===this.hls.config.enableInterstitialPlayback}get primaryDetails(){var t;return null==(t=this.mediaSelection)?void 0:t.main.details}get primaryLive(){var t;return!(null==(t=this.primaryDetails)||!t.live)}resumePrimary(t,e,i){var s,r;if(this.playingItem=t,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(t),this.log(`resuming ${kp(t)}`),null==(s=this.detachedData)||!s.mediaSource){let i=this.timelinePos;(i<t.start||i>=t.end)&&(i=this.getPrimaryResumption(t,e),this.log(Cp("resumePrimary",i)),this.timelinePos=i),this.attachPrimary(i,t)}if(!i)return;const n=null==(r=this.schedule)?void 0:r.items;n&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${kp(t)}`),this.hls.trigger($l.INTERSTITIALS_PRIMARY_RESUMED,{schedule:n.slice(0),scheduleIndex:e}),this.checkBuffer())}getPrimaryResumption(t,e){const i=t.start;if(this.primaryLive){const t=this.primaryDetails;if(0===e)return this.hls.startPosition;if(t&&(i<t.fragmentStart||i>t.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(t){const e=this.getAssetPlayer(t.identifier);if(null!=e&&e.hls)return e.hls.bufferedToEnd;return Gc.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=t.timelineStart+(t.duration||0)}attachPrimary(t,e,i){e?this.setBufferingItem(e):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const s=this.primaryMedia;if(!s)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,s),i&&this.startLoadingPrimaryAt(t,i)),i||(this.log(Cp("attachPrimary",t)),this.timelinePos=t,this.startLoadingPrimaryAt(t,i))}startLoadingPrimaryAt(t,e){var i;const s=this.hls;!s.loadingEnabled||!s.media||Math.abs(((null==(i=s.mainForwardBufferInfo)?void 0:i.start)||s.media.currentTime)-t)>.5?s.startLoad(t,e):s.bufferingEnabled||s.resumeBuffering()}onManifestLoading(){var t;this.stopLoad(),null==(t=this.schedule)||t.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off($l.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on($l.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(t,e){if(-1===e.level||!this.schedule)return;const i=this.hls.levels[e.level];if(!i.details)return;const s=ld(ld({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=s,this.schedule.parseInterstitialDateRanges(s,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(t,e){const i=this.hls.audioTracks[e.id],s=this.mediaSelection;if(!s)return void(this.altSelection=ld(ld({},this.altSelection),{},{audio:i}));const r=ld(ld({},s),{},{audio:i});this.mediaSelection=r}onSubtitleTrackUpdated(t,e){const i=this.hls.subtitleTracks[e.id],s=this.mediaSelection;if(!s)return void(this.altSelection=ld(ld({},this.altSelection),{},{subtitles:i}));const r=ld(ld({},s),{},{subtitles:i});this.mediaSelection=r}onAudioTrackSwitching(t,e){const i=Wh(e);this.playerQueue.forEach(({hls:t})=>t&&(t.setAudioOption(e)||t.setAudioOption(i)))}onSubtitleTrackSwitch(t,e){const i=Wh(e);this.playerQueue.forEach(({hls:t})=>t&&(t.setSubtitleOption(e)||-1!==e.id&&t.setSubtitleOption(i)))}onBufferCodecs(t,e){const i=e.tracks;i&&(this.requiredTracks=i)}onBufferAppended(t,e){this.checkBuffer()}onBufferFlushed(t,e){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const t=this.timelinePos;this.bufferedPos=t,this.checkBuffer()}}onBufferedToEnd(t){if(!this.schedule)return;const e=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&e){for(let t=0;t<e.length;t++){const s=e[t];if(s.cue.post){var i;const t=this.schedule.findEventIndex(s.identifier),e=null==(i=this.schedule.items)?void 0:i[t];this.isInterstitial(e)&&this.eventItemsMatch(e,this.bufferingItem)&&this.bufferedToItem(e,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(t){const e=this.playingItem;if(!this.playingLastItem&&e){const t=this.findItemIndex(e);this.setSchedulePosition(t+1)}else this.shouldPlay=!1}updateItem(t,e){var i;const s=null==(i=this.schedule)?void 0:i.items;if(t&&s){return s[this.findItemIndex(t,e)]||null}return null}trimInPlace(t,e){if(this.isInterstitial(t)&&t.event.appendInPlace&&e.end-t.end>.25){t.event.assetList.forEach((e,i)=>{t.event.isAssetPastPlayoutLimit(i)&&this.clearAssetPlayer(e.identifier,null)});const i=t.end+.25,s=Gc.bufferInfo(this.primaryMedia,i,0);if(s.end>i||(s.nextStart||0)>i){this.log(`trim buffered interstitial ${kp(t)} (was ${kp(e)})`);const s=!0;this.attachPrimary(i,null,s),this.flushFrontBuffer(i)}}}itemsMatch(t,e){return!!e&&(t===e||t.event&&e.event&&this.eventItemsMatch(t,e)||!t.event&&!e.event&&this.findItemIndex(t)===this.findItemIndex(e))}eventItemsMatch(t,e){var i;return!!e&&(t===e||t.event.identifier===(null==(i=e.event)?void 0:i.identifier))}findItemIndex(t,e){return t&&this.schedule?this.schedule.findItemIndex(t,e):-1}updateSchedule(t=!1){var e;const i=this.mediaSelection;i&&(null==(e=this.schedule)||e.updateSchedule(i,[],t))}checkBuffer(t){var e;const i=null==(e=this.schedule)?void 0:e.items;if(!i)return;const s=Gc.bufferInfo(this.primaryMedia,this.timelinePos,0);t&&(this.bufferedPos=this.timelinePos),t||(t=s.len<1),this.updateBufferedPos(s.end,i,t)}updateBufferedPos(t,e,i){const s=this.schedule,r=this.bufferingItem;if(this.bufferedPos>t||!s)return;if(1===e.length&&this.itemsMatch(e[0],r))return void(this.bufferedPos=t);const n=this.playingItem,a=this.findItemIndex(n);let o=s.findItemIndexAtTime(t);if(this.bufferedPos<t){var l;const i=this.findItemIndex(r),s=Math.min(i+1,e.length-1),n=e[s];if((-1===o&&r&&t>=r.end||null!=(l=n.event)&&l.appendInPlace&&t+.01>=n.start)&&(o=s),this.isInterstitial(r)){const t=r.event;if(s-a>1&&!1===t.appendInPlace)return;if(0===t.assetList.length&&t.assetListLoader)return}if(this.bufferedPos=t,o>i&&o>a)this.bufferedToItem(n);else{const e=this.primaryDetails;this.primaryLive&&e&&t>e.edge-e.targetduration&&n.start<e.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(n)&&this.preloadAssets(n.event,0)}}else i&&n&&!this.itemsMatch(n,r)&&(o===a?this.bufferedToItem(n):o===a+1&&this.bufferedToItem(e[o]))}assetsBuffered(t,e){return 0!==t.event.assetList.length&&!t.event.assetList.some(t=>{const i=this.getAssetPlayer(t.identifier);return!(null!=i&&i.bufferedInPlaceToEnd(e))})}setBufferingItem(t){const e=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(t,e)&&i){const{items:s,events:r}=i;if(!s||!r)return e;const n=this.isInterstitial(t),a=this.getBufferingPlayer();this.bufferingItem=t,this.bufferedPos=Math.max(t.start,Math.min(t.end,this.timelinePos));const o=a?a.remaining:e?e.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${kp(t)}`+(e?` (${o.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(n){const e=i.findAssetIndex(t.event,this.bufferedPos);t.event.assetList.forEach((t,i)=>{const s=this.getAssetPlayer(t.identifier);s&&(i===e&&s.loadSource(),s.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(t=>t.pauseBuffering());this.hls.trigger($l.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:s.slice(0),bufferingIndex:this.findItemIndex(t),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==t&&(this.bufferingItem=t);return e}bufferedToItem(t,e=0){const i=this.setBufferingItem(t);if(!this.playbackDisabled)if(this.isInterstitial(t))this.bufferedToEvent(t,e);else if(null!==i){this.bufferingAsset=null;const e=this.detachedData;if(e)if(e.mediaSource){const e=!0;this.attachPrimary(t.start,t,e)}else this.preloadPrimary(t);else this.preloadPrimary(t)}}preloadPrimary(t){const e=this.findItemIndex(t),i=this.getPrimaryResumption(t,e);this.startLoadingPrimaryAt(i)}bufferedToEvent(t,e){const i=t.event,s=0===i.assetList.length&&!i.assetListLoader,r=i.cue.once;if(s||!r){const t=this.preloadAssets(i,e);if(null!=t&&t.interstitial.appendInPlace){const e=this.primaryMedia;e&&this.bufferAssetPlayer(t,e)}}}preloadAssets(t,e){const i=t.assetUrl,s=t.assetList.length,r=0===s&&!t.assetListLoader,n=t.cue.once;if(r){const r=t.timelineStart;if(t.appendInPlace){var a;const e=this.playingItem;this.isInterstitial(e)||(null==e||null==(a=e.nextEvent)?void 0:a.identifier)!==t.identifier||this.flushFrontBuffer(r+.25)}let n,o=0;if(!this.playingItem&&this.primaryLive&&(o=this.hls.startPosition,-1===o&&(o=this.hls.liveSyncPosition||0)),o&&!t.cue.pre&&!t.cue.post){const t=o-r;t>0&&(n=Math.round(1e3*t)/1e3)}if(this.log(`Load interstitial asset ${e+1}/${i?1:s} ${t}${n?` live-start: ${o} start-offset: ${n}`:""}`),i)return this.createAsset(t,0,0,r,t.duration,i);const l=this.assetListLoader.loadAssetList(t,n);l&&(t.assetListLoader=l)}else if(!n&&s){for(let r=e;r<s;r++){const e=t.assetList[r],i=this.getAssetPlayerQueueIndex(e.identifier);-1!==i&&!this.playerQueue[i].destroyed||e.error||this.createAssetPlayer(t,e,r)}const i=t.assetList[e];if(i){const t=this.getAssetPlayer(i.identifier);return t&&t.loadSource(),t}}return null}flushFrontBuffer(t){const e=this.requiredTracks;if(!e)return;this.log(`Removing front buffer starting at ${t}`);Object.keys(e).forEach(e=>{this.hls.trigger($l.BUFFER_FLUSHING,{startOffset:t,endOffset:1/0,type:e})})}getAssetPlayerQueueIndex(t){const e=this.playerQueue;for(let i=0;i<e.length;i++)if(t===e[i].assetId)return i;return-1}getAssetPlayer(t){const e=this.getAssetPlayerQueueIndex(t);return this.playerQueue[e]||null}getBufferingPlayer(){const{playerQueue:t,primaryMedia:e}=this;if(e)for(let i=0;i<t.length;i++)if(t[i].media===e)return t[i];return null}createAsset(t,e,i,s,r,n){const a={parentIdentifier:t.identifier,identifier:yp(t,n,e),duration:r,startOffset:i,timelineStart:s,uri:n};return this.createAssetPlayer(t,a,e)}createAssetPlayer(t,e,i){const s=this.hls,r=s.userConfig;let n=r.videoPreference;const a=s.loadLevelObj||s.levels[s.currentLevel];(n||a)&&(n=ad({},n),a.videoCodec&&(n.videoCodec=a.videoCodec),a.videoRange&&(n.allowedVideoRanges=[a.videoRange]));const o=s.audioTracks[s.audioTrack],l=s.subtitleTracks[s.subtitleTrack];let d=0;if(this.primaryLive||t.appendInPlace){const t=this.timelinePos-e.timelineStart;if(t>1){const i=e.duration;i&&t<i&&(d=t)}}const h=e.identifier,c=ld(ld({},r),{},{maxMaxBufferLength:Math.min(180,s.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:s.sessionId,assetPlayerId:h,abrEwmaDefaultEstimate:s.bandwidthEstimate,interstitialsController:void 0,startPosition:d,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:n,audioPreference:o||r.audioPreference,subtitlePreference:l||r.subtitlePreference});t.appendInPlace&&(t.appendInPlaceStarted=!0,e.timelineStart&&(c.timelineOffset=e.timelineStart));const u=c.cmcd;null!=u&&u.sessionId&&u.contentId&&(c.cmcd=ad({},u,{contentId:pp(e.uri)})),this.getAssetPlayer(h)&&this.warn(`Duplicate date range identifier ${t} and asset ${h}`);const f=new Lp(this.HlsPlayerClass,c,t,e);this.playerQueue.push(f),t.assetList[i]=e;let g=!0;const m=s=>{if(s.live){var r;const e=new Error(`Interstitials MUST be VOD assets ${t}`),s={fatal:!0,type:Wl.OTHER_ERROR,details:Yl.INTERSTITIAL_ASSET_ITEM_ERROR,error:e},n=(null==(r=this.schedule)?void 0:r.findEventIndex(t.identifier))||-1;return void this.handleAssetItemError(s,t,n,i,e.message)}const n=s.edge-s.fragmentStart,a=e.duration;(g||null===a||n>a)&&(g=!1,this.log(`Interstitial asset "${h}" duration change ${a} > ${n}`),e.duration=n,this.updateSchedule())};f.on($l.LEVEL_UPDATED,(t,{details:e})=>m(e)),f.on($l.LEVEL_PTS_UPDATED,(t,{details:e})=>m(e)),f.on($l.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const p=(t,e)=>{const i=this.getAssetPlayer(h);if(i&&e.tracks){i.off($l.BUFFER_CODECS,p),i.tracks=e.tracks;const t=this.primaryMedia;this.bufferingAsset===i.assetItem&&t&&!i.media&&this.bufferAssetPlayer(i,t)}};f.on($l.BUFFER_CODECS,p);f.on($l.BUFFERED_TO_END,()=>{var i;const s=this.getAssetPlayer(h);if(this.log(`buffered to end of asset ${s}`),!s||!this.schedule)return;const r=this.schedule.findEventIndex(t.identifier),n=null==(i=this.schedule.items)?void 0:i[r];this.isInterstitial(n)&&this.advanceAssetBuffering(n,e)});const A=e=>()=>{if(!this.getAssetPlayer(h)||!this.schedule)return;this.shouldPlay=!0;const i=this.schedule.findEventIndex(t.identifier);this.advanceAfterAssetEnded(t,i,e)};return f.once($l.MEDIA_ENDED,A(i)),f.once($l.PLAYOUT_LIMIT_REACHED,A(1/0)),f.on($l.ERROR,(e,s)=>{if(!this.schedule)return;const r=this.getAssetPlayer(h);if(s.details===Yl.BUFFER_STALLED_ERROR)return null!=r&&r.appendInPlace?void this.handleInPlaceStall(t):(this.onTimeupdate(),void this.checkBuffer(!0));this.handleAssetItemError(s,t,this.schedule.findEventIndex(t.identifier),i,`Asset player error ${s.error} ${t}`)}),f.on($l.DESTROYING,()=>{if(!this.getAssetPlayer(h)||!this.schedule)return;const e=new Error(`Asset player destroyed unexpectedly ${h}`),s={fatal:!0,type:Wl.OTHER_ERROR,details:Yl.INTERSTITIAL_ASSET_ITEM_ERROR,error:e};this.handleAssetItemError(s,t,this.schedule.findEventIndex(t.identifier),i,e.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Ip(e)}`),this.hls.trigger($l.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:e,assetListIndex:i,event:t,player:f}),f}clearInterstitial(t,e){this.clearAssetPlayers(t,e),t.reset()}clearAssetPlayers(t,e){t.assetList.forEach(t=>{this.clearAssetPlayer(t.identifier,e)})}resetAssetPlayer(t){const e=this.getAssetPlayerQueueIndex(t);if(-1!==e){this.log(`reset asset player "${t}" after error`);const i=this.playerQueue[e];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(t,e){const i=this.getAssetPlayerQueueIndex(t);if(-1!==i){const t=this.playerQueue[i];this.log(`clear ${t} toSegment: ${e?kp(e):e}`),this.transferMediaFromPlayer(t,e),this.playerQueue.splice(i,1),t.destroy()}}emptyPlayerQueue(){let t;for(;t=this.playerQueue.pop();)t.destroy();this.playerQueue=[]}startAssetPlayer(t,e,i,s,r){const{interstitial:n,assetItem:a,assetId:o}=t,l=n.assetList.length,d=this.playingAsset;this.endedAsset=null,this.playingAsset=a,d&&d.identifier===o||(d&&(this.clearAssetPlayer(d.identifier,i[s]),delete d.error),this.log(`INTERSTITIAL_ASSET_STARTED ${e+1}/${l} ${Ip(a)}`),this.hls.trigger($l.INTERSTITIAL_ASSET_STARTED,{asset:a,assetListIndex:e,event:n,schedule:i.slice(0),scheduleIndex:s,player:t})),this.bufferAssetPlayer(t,r)}bufferAssetPlayer(t,e){var i,s;if(!this.schedule)return;const{interstitial:r,assetItem:n}=t,a=this.schedule.findEventIndex(r.identifier),o=null==(i=this.schedule.items)?void 0:i[a];if(!o)return;t.loadSource(),this.setBufferingItem(o),this.bufferingAsset=n;const l=this.getBufferingPlayer();if(l===t)return;const d=r.appendInPlace;if(d&&!1===(null==l?void 0:l.interstitial.appendInPlace))return;const h=(null==l?void 0:l.tracks)||(null==(s=this.detachedData)?void 0:s.tracks)||this.requiredTracks;if(d&&n!==this.playingAsset){if(!t.tracks)return void this.log(`Waiting for track info before buffering ${t}`);if(h&&!Ad(h,t.tracks)){const e=new Error(`Asset ${Ip(n)} SourceBuffer tracks ('${Object.keys(t.tracks)}') are not compatible with primary content tracks ('${Object.keys(h)}')`),i={fatal:!0,type:Wl.OTHER_ERROR,details:Yl.INTERSTITIAL_ASSET_ITEM_ERROR,error:e},s=r.findAssetIndex(n);return void this.handleAssetItemError(i,r,a,s,e.message)}}this.transferMediaTo(t,e)}handleInPlaceStall(t){const e=this.schedule,i=this.primaryMedia;if(!e||!i)return;const s=i.currentTime,r=e.findAssetIndex(t,s),n=t.assetList[r];if(n){const a=this.getAssetPlayer(n.identifier);if(a){const o=a.currentTime||s-n.timelineStart,l=a.duration-o;if(this.warn(`Stalled at ${o} of ${o+l} in ${a} ${t} (media.currentTime: ${s})`),o&&(l/i.playbackRate<.5||a.bufferedInPlaceToEnd(i))&&a.hls){const i=e.findEventIndex(t.identifier);this.advanceAfterAssetEnded(t,i,r)}}}}advanceInPlace(t){const e=this.primaryMedia;e&&e.currentTime<t&&(e.currentTime=t)}handleAssetItemError(t,e,i,s,r){if(t.details===Yl.BUFFER_STALLED_ERROR)return;const n=e.assetList[s]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${n?Ip(n):n} ${t.error}`),!this.schedule)return;const a=(null==n?void 0:n.identifier)||"",o=this.getAssetPlayerQueueIndex(a),l=this.playerQueue[o]||null,d=this.schedule.items,h=ad({},t,{fatal:!1,errorAction:Ec(!0),asset:n,assetListIndex:s,event:e,schedule:d,scheduleIndex:i,player:l});if(this.hls.trigger($l.INTERSTITIAL_ASSET_ERROR,h),!t.fatal)return;const c=this.playingAsset,u=this.bufferingAsset,f=new Error(r);if(n&&(this.clearAssetPlayer(a,null),n.error=f),e.assetList.some(t=>!t.error))for(let g=s;g<e.assetList.length;g++)this.resetAssetPlayer(e.assetList[g].identifier);else e.error=f;this.updateSchedule(!0),e.error?this.primaryFallback(e):c&&c.identifier===a?this.advanceAfterAssetEnded(e,i,s):u&&u.identifier===a&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,u)}primaryFallback(t){const e=t.timelineStart,i=this.effectivePlayingItem;let s=this.timelinePos;if(i){this.log(`Fallback to primary from event "${t.identifier}" start: ${e} pos: ${s} playing: ${kp(i)} error: ${t.error}`),-1===s&&(s=this.hls.startPosition);const r=this.updateItem(i,s);this.itemsMatch(i,r)&&this.clearInterstitial(t,null),t.appendInPlace&&(this.attachPrimary(e,null),this.flushFrontBuffer(e))}else if(-1===s)return void this.checkStart();if(!this.schedule)return;const r=this.schedule.findItemIndexAtTime(s);this.setSchedulePosition(r)}onAssetListLoaded(t,e){var i,s;const r=e.event,n=r.identifier,a=e.assetListResponse.ASSETS;if(null==(i=this.schedule)||!i.hasEvent(n))return;const o=r.timelineStart,l=r.duration;let d=0;a.forEach((t,e)=>{const i=parseFloat(t.DURATION);this.createAsset(r,e,d,o+d,i,t.URI),d+=i}),r.duration=d,this.log(`Loaded asset-list with duration: ${d} (was: ${l}) ${r}`);const h=this.waitingItem,c=(null==h?void 0:h.event.identifier)===n;this.updateSchedule();const u=null==(s=this.bufferingItem)?void 0:s.event;if(c){var f;const t=this.schedule.findEventIndex(n),e=null==(f=this.schedule.items)?void 0:f[t];if(e){if(!this.playingItem&&this.timelinePos>e.end){if(this.schedule.findItemIndexAtTime(this.timelinePos)!==t)return r.error=new Error(`Interstitial ${a.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${r}`),this.log(r.error.message),this.updateSchedule(!0),void this.primaryFallback(r)}this.setBufferingItem(e)}this.setSchedulePosition(t)}else if((null==u?void 0:u.identifier)===n){const t=r.assetList[0];if(t){const e=this.getAssetPlayer(t.identifier);if(u.appendInPlace){const t=this.primaryMedia;e&&t&&this.bufferAssetPlayer(e,t)}else e&&e.loadSource()}}}onError(t,e){if(this.schedule)switch(e.details){case Yl.ASSET_LIST_PARSING_ERROR:case Yl.ASSET_LIST_LOAD_ERROR:case Yl.ASSET_LIST_LOAD_TIMEOUT:{const t=e.interstitial;t&&(this.updateSchedule(!0),this.primaryFallback(t));break}case Yl.BUFFER_STALLED_ERROR:{const t=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(t)&&t.event.appendInPlace)return void this.handleInPlaceStall(t.event);this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}});function BA(t){return t&&"object"==typeof t?Array.isArray(t)?t.map(BA):Object.keys(t).reduce((e,i)=>(e[i]=BA(t[i]),e),{}):t}function FA(t,e){const i=t.loader;if(i!==DA&&i!==MA)e.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(t){}return!1})()&&(t.loader=DA,t.progressive=!0,t.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}}class NA extends Hc{constructor(t,e){super("gap-controller",t.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var t;null!=(t=this.media)&&t.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{var t;this.hls&&(this.ended=(null==(t=this.media)?void 0:t.currentTime)||1,this.hls.trigger($l.MEDIA_ENDED,{stalled:!1}))},this.hls=t,this.fragmentTracker=e,this.registerListeners()}registerListeners(){const{hls:t}=this;t&&(t.on($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on($l.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off($l.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(t,e){this.setInterval(100),this.mediaSource=e.mediaSource;const i=this.media=e.media;of(i,"playing",this.onMediaPlaying),of(i,"waiting",this.onMediaWaiting),of(i,"ended",this.onMediaEnded)}onMediaDetaching(t,e){this.clearInterval();const{media:i}=this;i&&(lf(i,"playing",this.onMediaPlaying),lf(i,"waiting",this.onMediaWaiting),lf(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(t,e){this.buffered=e.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var t;if(null==(t=this.media)||!t.readyState||!this.hasBuffered)return;const e=this.media.currentTime;this.poll(e,this.lastCurrentTime),this.lastCurrentTime=e}poll(t,e){var i,s;const r=null==(i=this.hls)?void 0:i.config;if(!r)return;const n=this.media;if(!n)return;const{seeking:a}=n,o=this.seeking&&!a,l=!this.seeking&&a,d=n.paused&&!a||n.ended||0===n.playbackRate;if(this.seeking=a,t!==e)return e&&(this.ended=0),this.moved=!0,a||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!d&&t>e&&this.nudgeOnVideoHole(t,e)),void(0===this.waiting&&this.stallResolved(t));if(l||o)return void(o&&this.stallResolved(t));if(d)return this.nudgeRetry=0,this.stallResolved(t),void(!this.ended&&n.ended&&this.hls&&(this.ended=t||1,this.hls.trigger($l.MEDIA_ENDED,{stalled:!1})));if(!Gc.getBuffered(n).length)return void(this.nudgeRetry=0);const h=Gc.bufferInfo(n,t,0),c=h.nextStart||0,u=this.fragmentTracker;if(a&&u&&this.hls){const e=_A(this.hls.inFlightFragments,t),i=h.len>2,s=!c||e||c-t>2&&!u.getPartialFragment(t);if(i||s)return;this.moved=!1}const f=null==(s=this.hls)?void 0:s.latestLevelDetails;if(!this.moved&&null!==this.stalled&&u){if(!(h.len>0)&&!c)return;const e=Math.max(c,h.start||0)-t,i=!(null==f||!f.live)?2*f.targetduration:2,s=HA(t,u);if(e>0&&(e<=i||s))return void(n.paused||this._trySkipBufferHole(s))}const g=r.detectStallWithCurrentTimeMs,m=self.performance.now(),p=this.waiting;let A=this.stalled;if(null===A){if(!(p>0&&m-p<g))return void(this.stalled=m);A=this.stalled=p}const v=m-A;if(!a&&(v>=g||p)&&this.hls){var y;if("ended"===(null==(y=this.mediaSource)?void 0:y.readyState)&&(null==f||!f.live)&&Math.abs(t-((null==f?void 0:f.edge)||0))<1){if(this.ended)return;return this.ended=t||1,void this.hls.trigger($l.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(h),!this.media||!this.hls)return}const E=Gc.bufferInfo(n,t,r.maxBufferHole);this._tryFixBufferStall(E,v,t)}stallResolved(t){const e=this.stalled;if(e&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-e;this.log(`playback not stuck anymore @${t}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger($l.STALL_RESOLVED,{})}}nudgeOnVideoHole(t,e){var i;const s=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&null!=(i=this.buffered.audio)&&i.length&&s&&s.length>1&&t>s.end(0)){const i=Gc.bufferedInfo(Gc.timeRangesToArray(this.buffered.audio),t,0);if(i.len>1&&e>=i.start){const i=Gc.timeRangesToArray(s),r=Gc.bufferedInfo(i,e,0).bufferedIndex;if(r>-1&&r<i.length-1){const e=Gc.bufferedInfo(i,t,0).bufferedIndex,s=i[r].end,n=i[r+1].start;if((-1===e||e>r)&&n-s<1&&t-s<2){const i=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${t} hole: ${s} -> ${n} buffered index: ${e}`);this.warn(i.message),this.media.currentTime+=1e-6;let r=HA(t,this.fragmentTracker);r&&"fragment"in r?r=r.fragment:r||(r=void 0);const a=Gc.bufferInfo(this.media,t,0);this.hls.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:i,reason:i.message,frag:r,buffer:a.len,bufferInfo:a})}}}}}_tryFixBufferStall(t,e,i){var s,r;const{fragmentTracker:n,media:a}=this,o=null==(s=this.hls)?void 0:s.config;if(!a||!n||!o)return;const l=null==(r=this.hls)?void 0:r.latestLevelDetails,d=HA(i,n);if(d||null!=l&&l.live&&i<l.fragmentStart){if(this._trySkipBufferHole(d)||!this.media)return}const h=t.buffered,c=this.adjacentTraversal(t,i);(h&&h.length>1&&t.len>o.maxBufferHole||t.nextStart&&(t.nextStart-i<o.maxBufferHole||c))&&(e>1e3*o.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(t))}adjacentTraversal(t,e){const i=this.fragmentTracker,s=t.nextStart;if(i&&s){const t=i.getFragAtPos(e,td),r=i.getFragAtPos(s,td);if(t&&r)return r.sn-t.sn<2}return!1}_reportStall(t){const{hls:e,media:i,stallReported:s,stalled:r}=this;if(!s&&null!==r&&i&&e){this.stallReported=!0;const s=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${Qh(t)})`);this.warn(s.message),e.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:t.len,bufferInfo:t,stalled:{start:r}})}}_trySkipBufferHole(t){var e;const{fragmentTracker:i,media:s}=this,r=null==(e=this.hls)?void 0:e.config;if(!s||!i||!r)return 0;const n=s.currentTime,a=Gc.bufferInfo(s,n,0),o=n<a.start?a.start:a.nextStart;if(o&&this.hls){const e=a.len<=r.maxBufferHole,d=a.len>0&&a.len<1&&s.readyState<3,h=o-n;if(h>0&&(e||d)){if(h>r.maxBufferHole){let e=!1;if(0===n){const t=i.getAppendedFrag(0,td);t&&o<t.end&&(e=!0)}if(!e&&t){var l;if(null==(l=this.hls.loadLevelObj)||!l.details)return 0;if(_A(this.hls.inFlightFragments,o))return 0;let e=!1,s=t.end;for(;s<o;){const t=HA(s,i);if(!t){e=!0;break}s+=t.duration}if(e)return 0}}const e=Math.max(o+.05,n+.1);if(this.warn(`skipping hole, adjusting currentTime from ${n} to ${e}`),this.moved=!0,s.currentTime=e,null==t||!t.gap){const i=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${e}`),s={type:Wl.MEDIA_ERROR,details:Yl.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:i,reason:i.message,buffer:a.len,bufferInfo:a};t&&("fragment"in t?s.part=t:s.frag=t),this.hls.trigger($l.ERROR,s)}return e}}return 0}_tryNudgeBuffer(t){const{hls:e,media:i,nudgeRetry:s}=this,r=null==e?void 0:e.config;if(!i||!r)return 0;const n=i.currentTime;if(this.nudgeRetry++,s<r.nudgeMaxRetry){const a=n+(s+1)*r.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${n} to ${a}`);this.warn(o.message),i.currentTime=a,e.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1,buffer:t.len,bufferInfo:t})}else{const i=new Error(`Playhead still not moving while enough data buffered @${n} after ${r.nudgeMaxRetry} nudges`);this.error(i.message),e.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.BUFFER_STALLED_ERROR,error:i,fatal:!0,buffer:t.len,bufferInfo:t})}}}function _A(t,e){const i=UA(t.main);if(i&&i.start<=e)return i;const s=UA(t.audio);return s&&s.start<=e?s:null}function UA(t){if(!t)return null;switch(t.state){case cf:case hf:case vf:case yf:return null}return t.frag}function HA(t,e){return e.getAppendedFrag(t,td)||e.getPartialFragment(t)}function jA(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function VA(t,e,i,s,r){let n=new t(e,i,"");try{n.value=s,r&&(n.type=r)}catch(a){n=new t(e,i,Qh(r?ld({type:r},s):s))}return n}const GA=(()=>{const t=jA();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class QA{constructor(t){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger($l.EVENT_CUE_ENTER,{})},this.hls=t,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:t}=this;t&&(t.on($l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on($l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on($l.LEVEL_UPDATED,this.onLevelUpdated,this),t.on($l.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:t}=this;t&&(t.off($l.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off($l.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off($l.LEVEL_UPDATED,this.onLevelUpdated,this),t.off($l.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(t,e){var i;this.media=e.media,!1===(null==(i=e.overrides)?void 0:i.cueRemoval)&&(this.removeCues=!1)}onMediaAttached(){var t;const e=null==(t=this.hls)?void 0:t.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(t,e){this.media=null;!!e.transferMedia||(this.id3Track&&(this.removeCues&&fp(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(t){const e=this.getID3Track(t.textTracks);return e.mode="hidden",e}getID3Track(t){if(this.media){for(let e=0;e<t.length;e++){const i=t[e];if("metadata"===i.kind&&"id3"===i.label)return cp(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(t,e){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:s}=this.hls.config;if(!i&&!s)return;const{samples:r}=e;this.id3Track||(this.id3Track=this.createTrack(this.media));const n=jA();if(n)for(let a=0;a<r.length;a++){const t=r[a].type;if(t===Zf.emsg&&!i||!s)continue;const e=Yf(r[a].data),o=r[a].pts;let l=o+r[a].duration;l>GA&&(l=GA);l-o<=0&&(l=o+.25);for(let i=0;i<e.length;i++){const s=e[i];if(!$f(s)){this.updateId3CueEnds(o,t);const e=VA(n,o,l,s,t);e&&this.id3Track.addCue(e)}}}}updateId3CueEnds(t,e){var i;const s=null==(i=this.id3Track)?void 0:i.cues;if(s)for(let r=s.length;r--;){const i=s[r];i.type===e&&i.startTime<t&&i.endTime===GA&&(i.endTime=t)}}onBufferFlushing(t,{startOffset:e,endOffset:i,type:s}){const{id3Track:r,hls:n}=this;if(!n)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:o}}=n;if(r&&(a||o)){let t;t="audio"===s?t=>t.type===Zf.audioId3&&o:"video"===s?t=>t.type===Zf.emsg&&a:t=>t.type===Zf.audioId3&&o||t.type===Zf.emsg&&a,gp(r,e,i,t)}}onLevelUpdated(t,{details:e}){this.updateDateRangeCues(e,!0)}onLevelPtsUpdated(t,e){Math.abs(e.drift)>.01&&this.updateDateRangeCues(e.details)}updateDateRangeCues(t,e){if(!this.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:s,enableDateRangeMetadataCues:r,interstitialsController:n}=this.hls.config;if(!r)return;const a=jA();if(i&&s&&!n){const{fragmentStart:e,fragmentEnd:s}=t;let r=this.assetCue;r?(r.startTime=e,r.endTime=s):a&&(r=this.assetCue=VA(a,e,s,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),r&&(r.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(r),r.addEventListener("enter",this.onEventCueEnter)))}if(!t.hasProgramDateTime)return;const{id3Track:o}=this,{dateRanges:l}=t,d=Object.keys(l);let h=this.dateRangeCuesAppended;var c;if(o&&e)if(null!=(c=o.cues)&&c.length){const t=Object.keys(h).filter(t=>!d.includes(t));for(let e=t.length;e--;){var u;const i=t[e],s=null==(u=h[i])?void 0:u.cues;delete h[i],s&&Object.keys(s).forEach(t=>{const e=s[t];if(e){e.removeEventListener("enter",this.onEventCueEnter);try{o.removeCue(e)}catch(i){}}})}}else h=this.dateRangeCuesAppended={};const f=t.fragments[t.fragments.length-1];if(0!==d.length&&Ql(null==f?void 0:f.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let t=0;t<d.length;t++){const e=d[t],i=l[e],s=i.startTime,r=h[e],o=(null==r?void 0:r.cues)||{};let c=(null==r?void 0:r.durationKnown)||!1,u=GA;const{duration:f,endDate:g}=i;if(g&&null!==f)u=s+f,c=!0;else if(i.endOnNext&&!c){const t=d.reduce((t,e)=>{if(e!==i.id){const s=l[e];if(s.class===i.class&&s.startDate>i.startDate&&(!t||i.startDate<t.startDate))return s}return t},null);t&&(u=t.startTime,c=!0)}const m=Object.keys(i.attr);for(let t=0;t<m.length;t++){const l=m[t];if(!Zc(l))continue;const d=o[l];if(d)!c||null!=r&&r.durationKnown?Math.abs(d.startTime-s)>.01&&(d.startTime=s,d.endTime=u):d.endTime=u;else if(a){let t=i.attr[l];Jc(l)&&(t=Ed(t));const r=VA(a,s,u,{key:l,data:t},Zf.dateRange);r&&(r.id=e,this.id3Track.addCue(r),o[l]=r,n&&("X-ASSET-LIST"!==l&&"X-ASSET-URL"!==l||r.addEventListener("enter",this.onEventCueEnter)))}}h[e]={cues:o,dateRange:i,durationKnown:c}}}}}class KA{constructor(t){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,e=this.levelDetails;if(!t||!e)return;this.currentTime=t.currentTime;const i=this.computeLatency();if(null===i)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||1===r||!e.live)return;const n=this.targetLatency;if(null===n)return;const a=i-n;if(a<Math.min(this.maxLatency,n+e.targetduration)&&a>.05&&this.forwardBufferLength>1){const e=Math.min(2,Math.max(1,r)),i=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20,s=Math.min(e,Math.max(1,i));this.changeMediaPlaybackRate(t,s)}else 1!==t.playbackRate&&0!==t.playbackRate&&this.changeMediaPlaybackRate(t,1)},this.hls=t,this.config=t.config,this.registerListeners()}get levelDetails(){var t;return(null==(t=this.hls)?void 0:t.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:t}=this;if(void 0!==t.liveMaxLatencyDuration)return t.liveMaxLatencyDuration;const e=this.levelDetails;return e?t.liveMaxLatencyDurationCount*e.targetduration:0}get targetLatency(){const t=this.levelDetails;if(null===t||null===this.hls)return null;const{holdBack:e,partHoldBack:i,targetduration:s}=t,{liveSyncDuration:r,liveSyncDurationCount:n,lowLatencyMode:a}=this.config,o=this.hls.userConfig;let l=a&&i||e;(this._targetLatencyUpdated||o.liveSyncDuration||o.liveSyncDurationCount||0===l)&&(l=void 0!==r?r:n*s);const d=s;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,d)}set targetLatency(t){this.stallCount=0,this.config.liveSyncDuration=t,this._targetLatencyUpdated=!0}get liveSyncPosition(){const t=this.estimateLiveEdge(),e=this.targetLatency;if(null===t||null===e)return null;const i=this.levelDetails;if(null===i)return null;const s=i.edge,r=t-e-this.edgeStalled,n=s-i.totalduration,a=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(n,r),a)}get drift(){const t=this.levelDetails;return null===t?1:t.drift}get edgeStalled(){const t=this.levelDetails;if(null===t)return 0;const e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}get forwardBufferLength(){const{media:t}=this,e=this.levelDetails;if(!t||!e)return 0;const i=t.buffered.length;return(i?t.buffered.end(i-1):e.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:t}=this;t&&(t.on($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.on($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.LEVEL_UPDATED,this.onLevelUpdated,this),t.on($l.ERROR,this.onError,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off($l.MEDIA_ATTACHED,this.onMediaAttached,this),t.off($l.MEDIA_DETACHING,this.onMediaDetaching,this),t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.LEVEL_UPDATED,this.onLevelUpdated,this),t.off($l.ERROR,this.onError,this))}onMediaAttached(t,e){this.media=e.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(t,{details:e}){e.advanced&&this.onTimeupdate(),!e.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(t,e){var i;e.details===Yl.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&null!=(i=this.levelDetails)&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(t,e){var i,s;t.playbackRate!==e&&(null==(i=this.hls)||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${null==(s=this.targetLatency)?void 0:s.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${t.playbackRate} to ${e}`),t.playbackRate=e)}estimateLiveEdge(){const t=this.levelDetails;return null===t?null:t.edge+t.age}computeLatency(){const t=this.estimateLiveEdge();return null===t?null:t-this.currentTime}}class qA extends tm{constructor(t,e){super(t,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=e,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.MANIFEST_LOADED,this.onManifestLoaded,this),t.on($l.LEVEL_LOADED,this.onLevelLoaded,this),t.on($l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on($l.FRAG_BUFFERED,this.onFragBuffered,this),t.on($l.ERROR,this.onError,this)}_unregisterListeners(){const{hls:t}=this;t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.MANIFEST_LOADED,this.onManifestLoaded,this),t.off($l.LEVEL_LOADED,this.onLevelLoaded,this),t.off($l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off($l.FRAG_BUFFERED,this.onFragBuffered,this),t.off($l.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(t,e){this.resetLevels()}onManifestLoaded(t,e){const i=this.hls.config.preferManagedMediaSource,s=[],r={},n={};let a=!1,o=!1,l=!1;e.levels.forEach(t=>{const e=t.attrs;let{audioCodec:d,videoCodec:h}=t;d&&(t.audioCodec=d=Th(d,i)||void 0),h&&(h=t.videoCodec=function(t){const e=t.split(",");for(let i=0;i<e.length;i++){const t=e[i].split(".");t.length>2&&"avc1"===t[0]&&(e[i]=`avc1.${parseInt(t[1]).toString(16)}${("000"+parseInt(t[2]).toString(16)).slice(-4)}`)}return e.join(",")}(h));const{width:c,height:u,unknownCodecs:f}=t,g=(null==f?void 0:f.length)||0;if(a||(a=!(!c||!u)),o||(o=!!h),l||(l=!!d),g||d&&!this.isAudioSupported(d)||h&&!this.isVideoSupported(h))return void this.log(`Some or all CODECS not supported "${e.CODECS}"`);const{CODECS:m,"FRAME-RATE":p,"HDCP-LEVEL":A,"PATHWAY-ID":v,RESOLUTION:y,"VIDEO-RANGE":E}=e,T=`${`${v||"."}-`}${t.bitrate}-${y}-${p}-${m}-${E}-${A}`;if(r[T])if(r[T].uri===t.url||t.attrs["PATHWAY-ID"])r[T].addGroupId("audio",e.AUDIO),r[T].addGroupId("text",e.SUBTITLES);else{const e=n[T]+=1;t.attrs["PATHWAY-ID"]=new Array(e+1).join(".");const i=this.createLevel(t);r[T]=i,s.push(i)}else{const e=this.createLevel(t);r[T]=e,n[T]=1,s.push(e)}}),this.filterAndSortMediaOptions(s,e,a,o,l)}createLevel(t){const e=new jh(t),i=t.supplemental;if(null!=i&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const t=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(t.message),e.supportedResult=Dh(t,[])}return e}isAudioSupported(t){return gh(t,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(t){return gh(t,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(t,e,i,s,r){var n;let a=[],o=[],l=t;const d=(null==(n=e.stats)?void 0:n.parsing)||{};if((i||s)&&r&&(l=l.filter(({videoCodec:t,videoRange:e,width:i,height:s})=>{return(!!t||!(!i||!s))&&(!!(r=e)&&Bh.indexOf(r)>-1);var r})),0===l.length)return Promise.resolve().then(()=>{if(this.hls){let t="no level with compatible codecs found in manifest",i=t;e.levels.length&&(i=`one or more CODECS in variant not supported: ${Qh(e.levels.map(t=>t.attrs.CODECS).filter((t,e,i)=>i.indexOf(t)===e))}`,this.warn(i),t+=` (${i})`);const s=new Error(t);this.hls.trigger($l.ERROR,{type:Wl.MEDIA_ERROR,details:Yl.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:e.url,error:s,reason:i})}}),void(d.end=performance.now());e.audioTracks&&(a=e.audioTracks.filter(t=>!t.audioCodec||this.isAudioSupported(t.audioCodec)),WA(a)),e.subtitles&&(o=e.subtitles,WA(o));const h=l.slice(0);l.sort((t,e)=>{if(t.attrs["HDCP-LEVEL"]!==e.attrs["HDCP-LEVEL"])return(t.attrs["HDCP-LEVEL"]||"")>(e.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&t.height!==e.height)return t.height-e.height;if(t.frameRate!==e.frameRate)return t.frameRate-e.frameRate;if(t.videoRange!==e.videoRange)return Bh.indexOf(t.videoRange)-Bh.indexOf(e.videoRange);if(t.videoCodec!==e.videoCodec){const i=Ah(t.videoCodec),s=Ah(e.videoCodec);if(i!==s)return s-i}if(t.uri===e.uri&&t.codecSet!==e.codecSet){const i=vh(t.codecSet),s=vh(e.codecSet);if(i!==s)return s-i}return t.averageBitrate!==e.averageBitrate?t.averageBitrate-e.averageBitrate:0});let c=h[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==h.length))for(let A=0;A<h.length;A++)if(h[A].pathwayId===l[0].pathwayId){c=h[A];break}this._levels=l;for(let A=0;A<l.length;A++)if(l[A]===c){var u;this._firstLevel=A;const t=c.bitrate,e=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${t}`),void 0===(null==(u=this.hls.userConfig)?void 0:u.abrEwmaDefaultEstimate)){const i=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);i>e&&e===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=i)}break}const f=r&&!s,g=this.hls.config,m=!(!g.audioStreamController||!g.audioTrackController),p={levels:l,audioTracks:a,subtitleTracks:o,sessionData:e.sessionData,sessionKeys:e.sessionKeys,firstLevel:this._firstLevel,stats:e.stats,audio:r,video:s,altAudio:m&&!f&&a.some(t=>!!t.url)};d.end=performance.now(),this.hls.trigger($l.MANIFEST_PARSED,p)}get levels(){return 0===this._levels.length?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(t){const e=this._levels;if(0===e.length)return;if(t<0||t>=e.length){const i=new Error("invalid level idx"),s=t<0;if(this.hls.trigger($l.ERROR,{type:Wl.OTHER_ERROR,details:Yl.LEVEL_SWITCH_ERROR,level:t,fatal:s,error:i,reason:i.message}),s)return;t=Math.min(t,e.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,n=e[t],a=n.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=n,i===t&&s&&r===a)return;this.log(`Switching to level ${t} (${n.height?n.height+"p ":""}${n.videoRange?n.videoRange+" ":""}${n.codecSet?n.codecSet+" ":""}@${n.bitrate})${a?" with Pathway "+a:""} from level ${i}${r?" with Pathway "+r:""}`);const o={level:t,attrs:n.attrs,details:n.details,bitrate:n.bitrate,averageBitrate:n.averageBitrate,maxBitrate:n.maxBitrate,realBitrate:n.realBitrate,width:n.width,height:n.height,codecSet:n.codecSet,audioCodec:n.audioCodec,videoCodec:n.videoCodec,audioGroups:n.audioGroups,subtitleGroups:n.subtitleGroups,loaded:n.loaded,loadError:n.loadError,fragmentError:n.fragmentError,name:n.name,id:n.id,uri:n.uri,url:n.url,urlId:0,audioGroupIds:n.audioGroupIds,textGroupIds:n.textGroupIds};this.hls.trigger($l.LEVEL_SWITCHING,o);const l=n.details;if(!l||l.live){const t=this.switchParams(n.uri,null==s?void 0:s.details,l);this.loadPlaylist(t)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}get firstLevel(){return this._firstLevel}set firstLevel(t){this._firstLevel=t}get startLevel(){if(void 0===this._startLevel){const t=this.hls.config.startLevel;return void 0!==t?t:this.hls.firstAutoLevel}return this._startLevel}set startLevel(t){this._startLevel=t}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(t){if(this.steering){const e=this.steering.pathways(),i=t.filter(t=>-1!==e.indexOf(t));if(t.length<1)return void this.warn(`pathwayPriority ${t} should contain at least one pathway from list: ${e}`);this.steering.pathwayPriority=i}}onError(t,e){!e.fatal&&e.context&&e.context.type===Xl&&e.context.level===this.level&&this.checkRetry(e)}onFragBuffered(t,{frag:e}){if(void 0!==e&&e.type===td){const t=e.elementaryStreams;if(!Object.keys(t).some(e=>!!t[e]))return;const i=this._levels[e.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(t,e){var i;const{level:s,details:r}=e,n=e.levelInfo;var a;if(!n)return this.warn(`Invalid level index ${s}`),void(null!=(a=e.deliveryDirectives)&&a.skip&&(r.deltaUpdateFailed=!0));if(n===this.currentLevel||e.withoutMultiVariant){0===n.fragmentError&&(n.loadError=0);let t=n.details;t===e.details&&t.advanced&&(t=void 0),this.playlistLoaded(s,e,t)}else null!=(i=e.deliveryDirectives)&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(t){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,t)}loadingPlaylist(t,e){super.loadingPlaylist(t,e);const i=this.getUrlWithDirectives(t.uri,e),s=this.currentLevelIndex,r=t.attrs["PATHWAY-ID"],n=t.details,a=null==n?void 0:n.age;this.log(`Loading level index ${s}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""}${r?" Pathway "+r:""}${a&&n.live?" age "+a.toFixed(1)+(n.type&&" "+n.type||""):""} ${i}`),this.hls.trigger($l.LEVEL_LOADING,{url:i,level:s,levelInfo:t,pathwayId:t.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}removeLevel(t){var e;if(1===this._levels.length)return;const i=this._levels.filter((e,i)=>i!==t||(this.steering&&this.steering.removeLevel(e),e===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,e.details&&e.details.fragments.forEach(t=>t.level=-1)),!1));Zu(i),this._levels=i,this.currentLevelIndex>-1&&null!=(e=this.currentLevel)&&e.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const s=i.length-1;this._firstLevel=Math.min(this._firstLevel,s),this._startLevel&&(this._startLevel=Math.min(this._startLevel,s)),this.hls.trigger($l.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(t,{levels:e}){this._levels=e}checkMaxAutoUpdated(){const{autoLevelCapping:t,maxAutoLevel:e,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==e&&(this._maxAutoLevel=e,this.hls.trigger($l.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:e,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function WA(t){const e={};t.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function YA(){return self.SourceBuffer||self.WebKitSourceBuffer}function $A(){if(!pd())return!1;const t=YA();return!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove}class zA extends Sf{constructor(t,e,i){super(t,e,i,"stream-controller",td),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const t=this.media,e=t?t.currentTime:null;if(null===e||!Ql(e))return;if(this.log(`Media seeked to ${e.toFixed(3)}`),!this.getBufferedFrag(e))return;const i=this.getFwdBufferInfoAtPos(t,e,td,0);null!==i&&0!==i.len?this.tick():this.warn(`Main forward buffer length at ${e} on "seeked" event ${i?i.len:"empty"})`)},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:t}=this;t.on($l.MANIFEST_PARSED,this.onManifestParsed,this),t.on($l.LEVEL_LOADING,this.onLevelLoading,this),t.on($l.LEVEL_LOADED,this.onLevelLoaded,this),t.on($l.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on($l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on($l.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on($l.BUFFER_CREATED,this.onBufferCreated,this),t.on($l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on($l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on($l.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off($l.MANIFEST_PARSED,this.onManifestParsed,this),t.off($l.LEVEL_LOADED,this.onLevelLoaded,this),t.off($l.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off($l.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off($l.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off($l.BUFFER_CREATED,this.onBufferCreated,this),t.off($l.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off($l.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off($l.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(t,e){if(this.levels){const{lastCurrentTime:i,hls:s}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let t=s.startLevel;-1===t&&(s.config.testBandwidth&&this.levels.length>1?(t=0,this.bitrateTest=!0):t=s.firstAutoLevel),s.nextLoadLevel=t,this.level=s.loadLevel,this._hasEnoughToStart=!!e}i>0&&-1===t&&!e&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),t=i),this.state=cf,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=e?-1:t,this.tick()}else this._forceStartLoad=!0,this.state=hf}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Tf:{const{levels:t,level:e}=this,i=null==t?void 0:t[e],s=null==i?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(s))break;this.state=cf;break}if(this.hls.nextLoadLevel!==this.level){this.state=cf;break}break}case gf:this.checkRetryDate()}this.state===cf&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var t;super.onTickEnd(),null!=(t=this.media)&&t.readyState&&!1===this.media.seeking&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:t,levelLastLoaded:e,levels:i,media:s}=this;if(null===e||!s&&!this.primaryPrefetch&&(this.startFragRequested||!t.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const r=this.buffering?t.nextLoadLevel:t.loadLevel;if(null==i||!i[r])return;const n=i[r],a=this.getMainFwdBufferInfo();if(null===a)return;const o=this.getLevelDetails();if(o&&this._streamEnded(a,o)){const t={};return 2===this.altAudio&&(t.type="video"),this.hls.trigger($l.BUFFER_EOS,t),void(this.state=vf)}if(!this.buffering)return;t.loadLevel!==r&&-1===t.manualLevel&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=t.nextLoadLevel=r;const l=n.details;if(!l||this.state===Tf||this.waitForLive(n))return this.level=r,this.state=Tf,void(this.startFragRequested=!1);const d=a.len,h=this.getMaxBufferLength(n.maxBitrate);if(d>=h)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const c=this.backtrackFragment?this.backtrackFragment.start:a.end;let u=this.getNextFragment(c,l);if(this.couldBacktrack&&!this.fragPrevious&&u&&Bd(u)&&this.fragmentTracker.getState(u)!==Ic){var f;const t=(null!=(f=this.backtrackFragment)?f:u).sn-l.startSN,e=l.fragments[t-1];e&&u.cc===e.cc&&(u=e,this.fragmentTracker.removeFragment(e))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(u&&this.isLoopLoading(u,c)){if(!u.gap){const t=this.audioOnly&&!this.altAudio?xd:Pd,e=(t===Pd?this.videoBuffer:this.mediaBuffer)||this.media;e&&this.afterBufferFlushed(e,t,td)}u=this.getNextFragmentLoopLoading(u,l,a,td,h)}u&&(!u.initSegment||u.initSegment.data||this.bitrateTest||(u=u.initSegment),this.loadFragment(u,n,c))}loadFragment(t,e,i){const s=this.fragmentTracker.getState(t);s===Tc||s===bc?Bd(t)?this.bitrateTest?(this.log(`Fragment ${t.sn} of level ${t.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(t,e)):super.loadFragment(t,e,i):this._loadInitSegment(t,e):this.clearTrackerIfNeeded(t)}getBufferedFrag(t){return this.fragmentTracker.getBufferedFrag(t,td)}followingBufferedFrag(t){return t?this.getBufferedFrag(t.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:t,media:e}=this;if(null!=e&&e.readyState){let i;const s=this.getAppendedFrag(e.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(null!=r&&r.live){const t=this.getMainFwdBufferInfo();if(!t||t.len<2*r.targetduration)return}if(!e.paused&&t){const e=t[this.hls.nextLoadLevel],s=this.fragLastKbps;i=s&&this.fragCurrent?this.fragCurrent.duration*e.maxBitrate/(1e3*s)+1:0}else i=0;const n=this.getBufferedFrag(e.currentTime+i);if(n){const t=this.followingBufferedFrag(n);if(t){this.abortCurrentFrag();const e=t.maxStartPTS?t.maxStartPTS:t.start,i=t.duration,s=Math.max(n.end,e+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(s,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case uf:case ff:case gf:case pf:case Af:this.state=cf}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(t,e){super.flushMainBuffer(t,e,2===this.altAudio?"video":null)}onMediaAttached(t,e){super.onMediaAttached(t,e);const i=e.media;of(i,"playing",this.onMediaPlaying),of(i,"seeked",this.onMediaSeeked)}onMediaDetaching(t,e){const{media:i}=this;i&&(lf(i,"playing",this.onMediaPlaying),lf(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(t,e);!!e.transferMedia||(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger($l.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(t,e){let i=!1,s=!1;for(let r=0;r<e.levels.length;r++){const t=e.levels[r].audioCodec;t&&(i=i||-1!==t.indexOf("mp4a.40.2"),s=s||-1!==t.indexOf("mp4a.40.5"))}this.audioCodecSwitch=i&&s&&!function(){var t;const e=YA();return"function"==typeof(null==e||null==(t=e.prototype)?void 0:t.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1}onLevelLoading(t,e){const{levels:i}=this;if(!i||this.state!==cf)return;const s=e.levelInfo;(!s.details||s.details.live&&(this.levelLastLoaded!==s||s.details.expired)||this.waitForCdnTuneIn(s.details))&&(this.state=Tf)}onLevelLoaded(t,e){var i;const{levels:s,startFragRequested:r}=this,n=e.level,a=e.details,o=a.totalduration;if(!s)return void this.warn(`Levels were reset while loading level ${n}`);this.log(`Level ${n} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);const l=e.levelInfo,d=this.fragCurrent;!d||this.state!==ff&&this.state!==gf||d.level!==e.level&&d.loader&&this.abortCurrentFrag();let h=0;if(a.live||null!=(i=l.details)&&i.live){var c;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;h=this.alignPlaylists(a,l.details,null==(c=this.levelLastLoaded)?void 0:c.details)}if(l.details=a,this.levelLastLoaded=l,r||this.setStartPosition(a,h),this.hls.trigger($l.LEVEL_UPDATED,{details:a,level:n}),this.state===Tf){if(this.waitForCdnTuneIn(a))return;this.state=cf}r&&a.live&&this.synchronizeToLiveEdge(a),this.tick()}synchronizeToLiveEdge(t){const{config:e,media:i}=this;if(!i)return;const s=this.hls.liveSyncPosition,r=this.getLoadPosition(),n=t.fragmentStart,a=t.edge,o=r>=n-e.maxFragLookUpTolerance&&r<=a;if(null!==s&&i.duration>s&&(r<s||!o)){const n=void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:e.liveMaxLatencyDurationCount*t.targetduration;if((!o&&i.readyState<4||r<a-n)&&(this._hasEnoughToStart||(this.nextLoadPosition=s),i.readyState))if(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${s.toFixed(3)}`),"buffered"===this.config.liveSyncMode){var l;const t=Gc.bufferInfo(i,s,0);if(null==(l=t.buffered)||!l.length)return void(i.currentTime=s);if(t.start<=r)return void(i.currentTime=s);const{nextStart:e}=Gc.bufferedInfo(t.buffered,r,0);e&&(i.currentTime=e)}else i.currentTime=s}}_handleFragmentLoadProgress(t){var e;const i=t.frag,{part:s,payload:r}=t,{levels:n}=this;if(!n)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const a=n[i.level];if(!a)return void this.warn(`Level ${i.level} not found on progress`);const o=a.details;if(!o)return this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),void this.fragmentTracker.removeFragment(i);const l=a.videoCodec,d=o.PTSKnown||!o.live,h=null==(e=i.initSegment)?void 0:e.data,c=this._getAudioCodec(a),u=this.transmuxer=this.transmuxer||new Jg(this.hls,td,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=s?s.index:-1,g=-1!==f,m=new jc(i.level,i.sn,i.stats.chunkCount,r.byteLength,f,g),p=this.initPTS[i.cc];u.push(r,h,c,l,i,s,o.totalduration,d,m,p)}onAudioTrackSwitching(t,e){const i=this.hls,s=0!==this.altAudio;if(Zh(e.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const t=this.fragCurrent;t&&(this.log("Switching to main audio track, cancel main fragment load"),t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(s)return this.altAudio=0,this.fragmentTracker.removeAllFragments(),i.once($l.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger($l.AUDIO_TRACK_SWITCHED,e)}),void i.trigger($l.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});i.trigger($l.AUDIO_TRACK_SWITCHED,e)}}onAudioTrackSwitched(t,e){const i=Zh(e.url,this.hls);if(i){const t=this.videoBuffer;t&&this.mediaBuffer!==t&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=t)}this.altAudio=i?2:0,this.tick()}onBufferCreated(t,e){const i=e.tracks;let s,r,n=!1;for(const a in i){const t=i[a];if("main"===t.id){if(r=a,s=t,"video"===a){const t=i[a];t&&(this.videoBuffer=t.buffer)}}else n=!0}n&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(t,e){const{frag:i,part:s}=e,r=i.type===td;if(r){if(this.fragContextChanged(i))return this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===Af&&(this.state=cf));const t=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*t.total/(t.buffering.end-t.loading.first)),Bd(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}const n=this.media;n&&(!this._hasEnoughToStart&&Gc.getBuffered(n).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(t,e){var i;if(e.fatal)this.state=yf;else switch(e.details){case Yl.FRAG_GAP:case Yl.FRAG_PARSING_ERROR:case Yl.FRAG_DECRYPT_ERROR:case Yl.FRAG_LOAD_ERROR:case Yl.FRAG_LOAD_TIMEOUT:case Yl.KEY_LOAD_ERROR:case Yl.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(td,e);break;case Yl.LEVEL_LOAD_ERROR:case Yl.LEVEL_LOAD_TIMEOUT:case Yl.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==Tf||(null==(i=e.context)?void 0:i.type)!==Xl||(this.state=cf);break;case Yl.BUFFER_ADD_CODEC_ERROR:case Yl.BUFFER_APPEND_ERROR:if("main"!==e.parent)return;this.reduceLengthAndFlushBuffer(e)&&this.resetLoadingState();break;case Yl.BUFFER_FULL_ERROR:if("main"!==e.parent)return;if(this.reduceLengthAndFlushBuffer(e)){!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}break;case Yl.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}}onFragLoadEmergencyAborted(){this.state=cf,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(t,{type:e}){if(e!==xd||!this.altAudio){const t=(e===Pd?this.videoBuffer:this.mediaBuffer)||this.media;t&&(this.afterBufferFlushed(t,e,td),this.tick())}}onLevelsUpdated(t,e){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=e.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:t}=this;if(!t)return;const e=t.currentTime;let i=this.startPosition;if(i>=0&&e<i){if(t.seeking)return void this.log(`could not seek to ${i}, already seeking at ${e}`);const s=this.timelineOffset;s&&i&&(i+=s);const r=this.getLevelDetails(),n=Gc.getBuffered(t),a=n.length?n.start(0):0,o=a-i,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||o>0&&(o<l||this.loadingParts&&o<2*((null==r?void 0:r.partTarget)||0)))&&(this.log(`adjusting start position by ${o} to match buffer start`),i+=o,this.startPosition=i),e<i&&(this.log(`seek to target start position ${i} from current time ${e} buffer start ${a}`),t.currentTime=i)}}_getAudioCodec(t){let e=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e}_loadBitrateTestFrag(t,e){t.bitrateTest=!0,this._doFragLoad(t,e).then(t=>{const{hls:i}=this,s=null==t?void 0:t.frag;if(!s||this.fragContextChanged(s))return;e.fragmentError=0,this.state=cf,this.startFragRequested=!1,this.bitrateTest=!1;const r=s.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),i.trigger($l.FRAG_LOADED,t),s.bitrateTest=!1}).catch(e=>{this.state!==hf&&this.state!==yf&&(this.warn(e),this.resetFragmentLoading(t))})}_handleTransmuxComplete(t){const e=this.playlistType,{hls:i}=this,{remuxResult:s,chunkMeta:r}=t,n=this.getCurrentContext(r);if(!n)return void this.resetWhenMissingContext(r);const{frag:a,part:o,level:l}=n,{video:d,text:h,id3:c,initSegment:u}=s,{details:f}=l,g=this.altAudio?void 0:s.audio;if(this.fragContextChanged(a))this.fragmentTracker.removeFragment(a);else{if(this.state=pf,u){const t=u.tracks;if(t){const s=a.initSegment||a;if(this.unhandledEncryptionError(u,a))return;this._bufferInitSegment(l,t,s,r),i.trigger($l.FRAG_PARSING_INIT_SEGMENT,{frag:s,id:e,tracks:t})}const s=u.initPTS,n=u.timescale,o=this.initPTS[a.cc];if(Ql(s)&&(!o||o.baseTime!==s||o.timescale!==n)){const t=u.trackId;this.initPTS[a.cc]={baseTime:s,timescale:n,trackId:t},i.trigger($l.INIT_PTS_FOUND,{frag:a,id:e,initPTS:s,timescale:n,trackId:t})}}if(d&&f){g&&"audiovideo"===d.type&&this.logMuxedErr(a);const t=f.fragments[a.sn-1-f.startSN],e=a.sn===f.startSN,i=!t||a.cc>t.cc;if(!1!==s.independent){const{startPTS:t,endPTS:s,startDTS:n,endDTS:l}=d;if(o)o.elementaryStreams[d.type]={startPTS:t,endPTS:s,startDTS:n,endDTS:l};else if(d.firstKeyFrame&&d.independent&&1===r.id&&!i&&(this.couldBacktrack=!0),d.dropped&&d.independent){const r=this.getMainFwdBufferInfo(),n=(r?r.end:this.getLoadPosition())+this.config.maxBufferHole,o=d.firstKeyFramePTS?d.firstKeyFramePTS:t;if(!e&&n<o-this.config.maxBufferHole&&!i)return void this.backtrack(a);i&&(a.gap=!0),a.setElementaryStreamInfo(d.type,a.start,s,a.start,l,!0)}else e&&t-(f.appliedTimelineOffset||0)>2&&(a.gap=!0);a.setElementaryStreamInfo(d.type,t,s,n,l),this.backtrackFragment&&(this.backtrackFragment=a),this.bufferFragmentData(d,a,o,r,e||i)}else{if(!e&&!i)return void this.backtrack(a);a.gap=!0}}if(g){const{startPTS:t,endPTS:e,startDTS:i,endDTS:s}=g;o&&(o.elementaryStreams[xd]={startPTS:t,endPTS:e,startDTS:i,endDTS:s}),a.setElementaryStreamInfo(xd,t,e,i,s),this.bufferFragmentData(g,a,o,r)}if(f&&null!=c&&c.samples.length){const t={id:e,frag:a,details:f,samples:c.samples};i.trigger($l.FRAG_PARSING_METADATA,t)}if(f&&h){const t={id:e,frag:a,details:f,samples:h.samples};i.trigger($l.FRAG_PARSING_USERDATA,t)}}}logMuxedErr(t){this.warn(`${Bd(t)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${t.url}`)}_bufferInitSegment(t,e,i,s){if(this.state!==pf)return;this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&(delete e.audio,e.audiovideo&&this.logMuxedErr(i));const{audio:r,video:n,audiovideo:a}=e;if(r){const i=t.audioCodec;let s=Sh(r.codec,i);"mp4a"===s&&(s="mp4a.40.5");const n=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){s&&(s=-1!==s.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const t=r.metadata;t&&"channelCount"in t&&1!==(t.channelCount||1)&&-1===n.indexOf("firefox")&&(s="mp4a.40.5")}s&&-1!==s.indexOf("mp4a.40.5")&&-1!==n.indexOf("android")&&"audio/mpeg"!==r.container&&(s="mp4a.40.2",this.log(`Android: force audio codec to ${s}`)),i&&i!==s&&this.log(`Swapping manifest audio codec "${i}" for "${s}"`),r.levelCodec=s,r.id=td,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${s||""}/${i||""}/${r.codec}]`),delete e.audiovideo}if(n){n.levelCodec=t.videoCodec,n.id=td;const i=n.codec;if(4===(null==i?void 0:i.length))switch(i){case"hvc1":case"hev1":n.codec="hvc1.1.6.L120.90";break;case"av01":n.codec="av01.0.04M.08";break;case"avc1":n.codec="avc1.42e01e"}this.log(`Init video buffer, container:${n.container}, codecs[level/parsed]=[${t.videoCodec||""}/${i}]${n.codec!==i?" parsed-corrected="+n.codec:""}${n.supplemental?" supplemental="+n.supplemental:""}`),delete e.audiovideo}a&&(this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${t.codecs}/${a.codec}]`),delete e.video,delete e.audio);const o=Object.keys(e);if(o.length){if(this.hls.trigger($l.BUFFER_CODECS,e),!this.hls)return;o.forEach(t=>{const r=e[t].initSegment;null!=r&&r.byteLength&&this.hls.trigger($l.BUFFER_APPENDING,{type:t,data:r,frag:i,part:null,chunkMeta:s,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const t=this.mediaBuffer&&2===this.altAudio?this.mediaBuffer:this.media;return this.getFwdBufferInfo(t,td)}get maxBufferLength(){const{levels:t,level:e}=this,i=null==t?void 0:t[e];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=cf}checkFragmentChanged(){const t=this.media;let e=null;if(t&&t.readyState>1&&!1===t.seeking){const i=t.currentTime;if(Gc.isBuffered(t,i)?e=this.getAppendedFrag(i):Gc.isBuffered(t,i+.1)&&(e=this.getAppendedFrag(i+.1)),e){this.backtrackFragment=null;const t=this.fragPlaying,i=e.level;t&&e.sn===t.sn&&t.level===i||(this.fragPlaying=e,this.hls.trigger($l.FRAG_CHANGED,{frag:e}),t&&t.level===i||this.hls.trigger($l.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const t=this.nextBufferedFrag;return t?t.level:-1}get currentFrag(){var t;if(this.fragPlaying)return this.fragPlaying;const e=(null==(t=this.media)?void 0:t.currentTime)||this.lastCurrentTime;return Ql(e)?this.getAppendedFrag(e):null}get currentProgramDateTime(){var t;const e=(null==(t=this.media)?void 0:t.currentTime)||this.lastCurrentTime;if(Ql(e)){const t=this.getLevelDetails(),i=this.currentFrag||(t?tc(null,t.fragments,e):null);if(i){const t=i.programDateTime;if(null!==t){const s=t+1e3*(e-i.start);return new Date(s)}}}return null}get currentLevel(){const t=this.currentFrag;return t?t.level:-1}get nextBufferedFrag(){const t=this.currentFrag;return t?this.followingBufferedFrag(t):null}get forceStartLoad(){return this._forceStartLoad}}class XA extends dd{constructor(t,e){super("key-loader",e),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=t}abort(t){for(const i in this.keyIdToKeyInfo){const s=this.keyIdToKeyInfo[i].loader;if(s){var e;if(t&&t!==(null==(e=s.context)?void 0:e.frag.type))return;s.abort()}}}detach(){for(const t in this.keyIdToKeyInfo){const e=this.keyIdToKeyInfo[t];(e.mediaKeySessionContext||e.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[t]}}destroy(){this.detach();for(const t in this.keyIdToKeyInfo){const e=this.keyIdToKeyInfo[t].loader;e&&e.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(t,e=Yl.KEY_LOAD_ERROR,i,s,r){return new Uc({type:Wl.NETWORK_ERROR,details:e,fatal:!1,frag:t,response:r,error:i,networkDetails:s})}loadClear(t,e,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(e.length)for(let s=0,r=e.length;s<r;s++){const n=e[s];if(t.cc<=n.cc&&(!Bd(t)||!Bd(n)||t.sn<n.sn)||!i&&s==r-1)return this.emeController.selectKeySystemFormat(n).then(t=>{if(!this.emeController)return;n.setKeyFormat(t);const e=pu(t);return e?this.emeController.getKeySystemAccess([e]):void 0})}if(this.config.requireKeySystemAccessOnStart){const t=vu(this.config);if(t.length)return this.emeController.getKeySystemAccess(t)}}return null}load(t){return!t.decryptdata&&t.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(t).then(e=>this.loadInternal(t,e)):this.loadInternal(t)}loadInternal(t,e){var i,s;e&&t.setKeyFormat(e);const r=t.decryptdata;if(!r){const i=new Error(e?`Expected frag.decryptdata to be defined after setting format ${e}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(t,Yl.KEY_LOAD_ERROR,i))}const n=r.uri;if(!n)return Promise.reject(this.createKeyLoadError(t,Yl.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${n}"`)));const a=ZA(r);let o=this.keyIdToKeyInfo[a];if(null!=(i=o)&&i.decryptdata.key)return r.key=o.decryptdata.key,Promise.resolve({frag:t,keyInfo:o});if(this.emeController&&null!=(s=o)&&s.keyLoadPromise){switch(this.emeController.getKeyStatus(o.decryptdata)){case"usable":case"usable-in-future":return o.keyLoadPromise.then(e=>{const{keyInfo:i}=e;return r.key=i.decryptdata.key,{frag:t,keyInfo:i}})}}switch(this.log(`${this.keyIdToKeyInfo[a]?"Rel":"L"}oading${r.keyId?" keyId: "+yd(r.keyId):""} URI: ${r.uri} from ${t.type} ${t.level}`),o=this.keyIdToKeyInfo[a]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===r.keyFormat?this.loadKeyHTTP(o,t):this.loadKeyEME(o,t);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(o,t);default:return Promise.reject(this.createKeyLoadError(t,Yl.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(t,e){const i={frag:e,keyInfo:t};if(this.emeController&&this.config.emeEnabled){var s;if(!t.decryptdata.keyId&&null!=(s=e.initSegment)&&s.data){const i=function(t){const e=[];return eh(t,t=>e.push(t.subarray(8,24))),e}(e.initSegment.data);if(i.length){let e=i[0];e.some(t=>0!==t)?(this.log(`Using keyId found in init segment ${yd(e)}`),bu.setKeyIdForUri(t.decryptdata.uri,e)):(e=bu.addKeyIdForUri(t.decryptdata.uri),this.log(`Generating keyId to patch media ${yd(e)}`)),t.decryptdata.keyId=e}}if(!t.decryptdata.keyId&&!Bd(e))return Promise.resolve(i);const r=this.emeController.loadKey(i);return(t.keyLoadPromise=r.then(e=>(t.mediaKeySessionContext=e,i))).catch(i=>{throw t.keyLoadPromise=null,"data"in i&&(i.data.frag=e),i})}return Promise.resolve(i)}loadKeyHTTP(t,e){const i=this.config,s=new(0,i.loader)(i);return e.keyLoader=t.loader=s,t.keyLoadPromise=new Promise((r,n)=>{const a={keyInfo:t,frag:e,responseType:"arraybuffer",url:t.decryptdata.uri},o=i.keyLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(t,e,i,s)=>{const{frag:a,keyInfo:o}=i,l=ZA(o.decryptdata);if(!a.decryptdata||o!==this.keyIdToKeyInfo[l])return n(this.createKeyLoadError(a,Yl.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),s));o.decryptdata.key=a.decryptdata.key=new Uint8Array(t.data),a.keyLoader=null,o.loader=null,r({frag:a,keyInfo:o})},onError:(t,i,s,r)=>{this.resetLoader(i),n(this.createKeyLoadError(e,Yl.KEY_LOAD_ERROR,new Error(`HTTP Error ${t.code} loading key ${t.text}`),s,ld({url:a.url,data:void 0},t)))},onTimeout:(t,i,s)=>{this.resetLoader(i),n(this.createKeyLoadError(e,Yl.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),s))},onAbort:(t,i,s)=>{this.resetLoader(i),n(this.createKeyLoadError(e,Yl.INTERNAL_ABORTED,new Error("key loading aborted"),s))}};s.load(a,l,d)})}resetLoader(t){const{frag:e,keyInfo:i,url:s}=t,r=i.loader;e.keyLoader===r&&(e.keyLoader=null,i.loader=null);const n=ZA(i.decryptdata)||s;delete this.keyIdToKeyInfo[n],r&&r.destroy()}}function ZA(t){if(t.keyFormat!==fu){const e=t.keyId;if(e)return yd(e)}return t.uri}function JA(t){const{type:e}=t;switch(e){case Zl:return ed;case Jl:return id;default:return td}}function tv(t,e){let i=t.url;return void 0!==i&&0!==i.indexOf("data:")||(i=e.url),i}class ev{constructor(t){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=t,this.registerListeners()}startLoad(t){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:t}=this;t.on($l.MANIFEST_LOADING,this.onManifestLoading,this),t.on($l.LEVEL_LOADING,this.onLevelLoading,this),t.on($l.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on($l.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.on($l.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:t}=this;t.off($l.MANIFEST_LOADING,this.onManifestLoading,this),t.off($l.LEVEL_LOADING,this.onLevelLoading,this),t.off($l.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off($l.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.off($l.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(t){const e=this.hls.config,i=e.pLoader,s=e.loader,r=new(i||s)(e);return this.loaders[t.type]=r,r}getInternalLoader(t){return this.loaders[t.type]}resetInternalLoader(t){this.loaders[t]&&delete this.loaders[t]}destroyInternalLoaders(){for(const t in this.loaders){const e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(t,e){const{url:i}=e;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:zl,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(t,e){const{id:i,level:s,pathwayId:r,url:n,deliveryDirectives:a,levelInfo:o}=e;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:Xl,url:n,deliveryDirectives:a,levelOrTrack:o})}onAudioTrackLoading(t,e){const{id:i,groupId:s,url:r,deliveryDirectives:n,track:a}=e;this.load({id:i,groupId:s,level:null,responseType:"text",type:Zl,url:r,deliveryDirectives:n,levelOrTrack:a})}onSubtitleTrackLoading(t,e){const{id:i,groupId:s,url:r,deliveryDirectives:n,track:a}=e;this.load({id:i,groupId:s,level:null,responseType:"text",type:Jl,url:r,deliveryDirectives:n,levelOrTrack:a})}onLevelsUpdated(t,e){const i=this.loaders[Xl];if(i){const t=i.context;t&&!e.levels.some(e=>e===t.levelOrTrack)&&(i.abort(),delete this.loaders[Xl])}}load(t){var e;const i=this.hls.config;let s,r=this.getInternalLoader(t);if(r){const e=this.hls.logger,i=r.context;if(i&&i.levelOrTrack===t.levelOrTrack&&(i.url===t.url||i.deliveryDirectives&&!t.deliveryDirectives))return void(i.url===t.url?e.log(`[playlist-loader]: ignore ${t.url} ongoing request`):e.log(`[playlist-loader]: ignore ${t.url} in favor of ${i.url}`));e.log(`[playlist-loader]: aborting previous loader for type: ${t.type}`),r.abort()}if(s=t.type===zl?i.manifestLoadPolicy.default:ad({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(t),Ql(null==(e=t.deliveryDirectives)?void 0:e.part)){let e;if(t.type===Xl&&null!==t.level?e=this.hls.levels[t.level].details:t.type===Zl&&null!==t.id?e=this.hls.audioTracks[t.id].details:t.type===Jl&&null!==t.id&&(e=this.hls.subtitleTracks[t.id].details),e){const t=e.partTarget,i=e.targetduration;if(t&&i){const e=1e3*Math.max(3*t,.8*i);s=ad({},s,{maxTimeToFirstByteMs:Math.min(e,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(e,s.maxTimeToFirstByteMs)})}}}const n=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:n.maxNumRetry||0,retryDelay:n.retryDelayMs||0,maxRetryDelay:n.maxRetryDelayMs||0},o={onSuccess:(t,e,i,s)=>{const r=this.getInternalLoader(i);this.resetInternalLoader(i.type);const n=t.data;e.parsing.start=performance.now(),Cu.isMediaPlaylist(n)||i.type!==zl?this.handleTrackOrLevelPlaylist(t,e,i,s||null,r):this.handleMasterPlaylist(t,e,i,s)},onError:(t,e,i,s)=>{this.handleNetworkError(e,i,!1,t,s)},onTimeout:(t,e,i)=>{this.handleNetworkError(e,i,!0,void 0,t)}};r.load(t,a,o)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:t,startPosition:e},forceStartLoad:i}=this.hls;(t||i)&&(this.hls.logger.log(`${t?"auto":"force"} startLoad with configured startPosition ${e}`),this.hls.startLoad(e))}handleMasterPlaylist(t,e,i,s){const r=this.hls,n=t.data,a=tv(t,i),o=Cu.parseMasterPlaylist(n,a);if(o.playlistParsingError)return e.parsing.end=performance.now(),void this.handleManifestParsingError(t,i,o.playlistParsingError,s,e);const{contentSteering:l,levels:d,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:f}=o;this.variableList=f,d.forEach(t=>{const{unknownCodecs:e}=t;if(e){const{preferManagedMediaSource:i}=this.hls.config;let{audioCodec:s,videoCodec:r}=t;for(let n=e.length;n--;){const a=e[n];gh(a,"audio",i)?(t.audioCodec=s=s?`${s},${a}`:a,uh.audio[s.substring(0,4)]=2,e.splice(n,1)):gh(a,"video",i)&&(t.videoCodec=r=r?`${r},${a}`:a,uh.video[r.substring(0,4)]=2,e.splice(n,1))}}});const{AUDIO:g=[],SUBTITLES:m,"CLOSED-CAPTIONS":p}=Cu.parseMasterPlaylistMedia(n,a,o);if(g.length){g.some(t=>!t.url)||!d[0].audioCodec||d[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Xc({}),bitrate:0,url:""}))}r.trigger($l.MANIFEST_LOADED,{levels:d,audioTracks:g,subtitles:m,captions:p,contentSteering:l,url:a,stats:e,networkDetails:s,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:f})}handleTrackOrLevelPlaylist(t,e,i,s,r){const n=this.hls,{id:a,level:o,type:l}=i,d=tv(t,i),h=Ql(o)?o:Ql(a)?a:0,c=JA(i),u=Cu.parseLevelPlaylist(t.data,d,h,c,0,this.variableList);if(l===zl){const t={attrs:new Xc({}),bitrate:0,details:u,name:"",url:d};u.requestScheduled=e.loading.start+Yu(u,0),n.trigger($l.MANIFEST_LOADED,{levels:[t],audioTracks:[],url:d,stats:e,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}e.parsing.end=performance.now(),i.levelDetails=u,this.handlePlaylistLoaded(u,t,e,i,s,r)}handleManifestParsingError(t,e,i,s,r){this.hls.trigger($l.ERROR,{type:Wl.NETWORK_ERROR,details:Yl.MANIFEST_PARSING_ERROR,fatal:e.type===zl,url:t.url,err:i,error:i,reason:i.message,response:t,context:e,networkDetails:s,stats:r})}handleNetworkError(t,e,i=!1,s,r){let n=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${t.type}`;t.type===Xl?n+=`: ${t.level} id: ${t.id}`:t.type!==Zl&&t.type!==Jl||(n+=` id: ${t.id} group-id: "${t.groupId}"`);const a=new Error(n);this.hls.logger.warn(`[playlist-loader]: ${n}`);let o=Yl.UNKNOWN,l=!1;const d=this.getInternalLoader(t);switch(t.type){case zl:o=i?Yl.MANIFEST_LOAD_TIMEOUT:Yl.MANIFEST_LOAD_ERROR,l=!0;break;case Xl:o=i?Yl.LEVEL_LOAD_TIMEOUT:Yl.LEVEL_LOAD_ERROR,l=!1;break;case Zl:o=i?Yl.AUDIO_TRACK_LOAD_TIMEOUT:Yl.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Jl:o=i?Yl.SUBTITLE_TRACK_LOAD_TIMEOUT:Yl.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(t.type);const h={type:Wl.NETWORK_ERROR,details:o,fatal:l,url:t.url,loader:d,context:t,error:a,networkDetails:e,stats:r};if(s){const i=(null==e?void 0:e.url)||t.url;h.response=ld({url:i,data:void 0},s)}this.hls.trigger($l.ERROR,h)}handlePlaylistLoaded(t,e,i,s,r,n){const a=this.hls,{type:o,level:l,levelOrTrack:d,id:h,groupId:c,deliveryDirectives:u}=s,f=tv(e,s),g=JA(s);let m="number"==typeof s.level&&g===td?l:void 0;const p=t.playlistParsingError;if(p){if(this.hls.logger.warn(`${p} ${t.url}`),!a.config.ignorePlaylistParsingErrors)return void a.trigger($l.ERROR,{type:Wl.NETWORK_ERROR,details:Yl.LEVEL_PARSING_ERROR,fatal:!1,url:f,error:p,reason:p.message,response:e,context:s,level:m,parent:g,networkDetails:r,stats:i});t.playlistParsingError=null}if(!t.fragments.length){const n=t.playlistParsingError=new Error("No Segments found in Playlist");return void a.trigger($l.ERROR,{type:Wl.NETWORK_ERROR,details:Yl.LEVEL_EMPTY_ERROR,fatal:!1,url:f,error:n,reason:n.message,response:e,context:s,level:m,parent:g,networkDetails:r,stats:i})}switch(t.live&&n&&(n.getCacheAge&&(t.ageHeader=n.getCacheAge()||0),n.getCacheAge&&!isNaN(t.ageHeader)||(t.ageHeader=0)),o){case zl:case Xl:if(m)if(d){if(d!==a.levels[m]){const t=a.levels.indexOf(d);t>-1&&(m=t)}}else m=0;a.trigger($l.LEVEL_LOADED,{details:t,levelInfo:d||a.levels[0],level:m||0,id:h||0,stats:i,networkDetails:r,deliveryDirectives:u,withoutMultiVariant:o===zl});break;case Zl:a.trigger($l.AUDIO_TRACK_LOADED,{details:t,track:d,id:h||0,groupId:c||"",stats:i,networkDetails:r,deliveryDirectives:u});break;case Jl:a.trigger($l.SUBTITLE_TRACK_LOADED,{details:t,track:d,id:h||0,groupId:c||"",stats:i,networkDetails:r,deliveryDirectives:u})}}}class iv{static get version(){return Df}static isMSESupported(){return $A()}static isSupported(){return function(){if(!$A())return!1;const t=pd();return"function"==typeof(null==t?void 0:t.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>t.isTypeSupported(ph(e,"video")))||["mp4a.40.2","fLaC"].some(e=>t.isTypeSupported(ph(e,"audio"))))}()}static getMediaSource(){return pd()}static get Events(){return $l}static get MetadataSchema(){return Zf}static get ErrorTypes(){return Wl}static get ErrorDetails(){return Yl}static get DefaultConfig(){return iv.defaultConfig?iv.defaultConfig:OA}static set DefaultConfig(t){iv.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new wf,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const e=this.logger=function(t,e,i){const s=ud();if("object"==typeof console&&!0===t||"object"==typeof t){const n=["debug","log","info","warn","error"];n.forEach(e=>{s[e]=fd(e,t,i)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch(r){return ud()}n.forEach(e=>{gd[e]=fd(e,t)})}else ad(gd,s);return s}(t.debug||!1,"Hls instance",t.assetPlayerId),i=this.config=function(t,e,i){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==e.liveMaxLatencyDurationCount&&(void 0===e.liveSyncDurationCount||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(void 0===e.liveSyncDuration||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const s=BA(t),r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(t=>{const n=`${"level"===t?"playlist":t}LoadPolicy`,a=void 0===e[n],o=[];r.forEach(i=>{const r=`${t}Loading${i}`,l=e[r];if(void 0!==l&&a){o.push(r);const t=s[n].default;switch(e[n]={default:t},i){case"TimeOut":t.maxLoadTimeMs=l,t.maxTimeToFirstByteMs=l;break;case"MaxRetry":t.errorRetry.maxNumRetry=l,t.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":t.errorRetry.retryDelayMs=l,t.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":t.errorRetry.maxRetryDelayMs=l,t.timeoutRetry.maxRetryDelayMs=l}}}),o.length&&i.warn(`hls.js config: "${o.join('", "')}" setting(s) are deprecated, use "${n}": ${Qh(e[n])}`)}),ld(ld({},s),e)}(iv.DefaultConfig,t,e);this.userConfig=t,i.progressive&&FA(i,e);const{abrController:s,bufferController:r,capLevelController:n,errorController:a,fpsController:o}=i,l=new a(this),d=this.abrController=new s(this),h=new Lc(this),c=i.interstitialsController,u=c?this.interstitialsController=new c(this,iv):null,f=this.bufferController=new r(this,h),g=this.capLevelController=new n(this),m=new o(this),p=new ev(this),A=i.contentSteeringController,v=A?new A(this):null,y=this.levelController=new qA(this,v),E=new QA(this),T=new XA(this.config,this.logger),S=this.streamController=new zA(this,h,T),b=this.gapController=new NA(this,h);g.setStreamController(S),m.setStreamController(S);const I=[p,y,S];u&&I.splice(1,0,u),v&&I.splice(1,0,v),this.networkControllers=I;const L=[d,f,b,g,m,E,h];this.audioTrackController=this.createController(i.audioTrackController,I);const R=i.audioStreamController;R&&I.push(this.audioStreamController=new R(this,h,T)),this.subtitleTrackController=this.createController(i.subtitleTrackController,I);const k=i.subtitleStreamController;k&&I.push(this.subtititleStreamController=new k(this,h,T)),this.createController(i.timelineController,L),T.emeController=this.emeController=this.createController(i.emeController,L),this.cmcdController=this.createController(i.cmcdController,L),this.latencyController=this.createController(KA,L),this.coreComponents=L,I.push(l);const w=l.onErrorOut;"function"==typeof w&&this.on($l.ERROR,w,l),this.on($l.MANIFEST_LOADED,p.onManifestLoaded,p)}createController(t,e){if(t){const i=new t(this);return e&&e.push(i),i}return null}on(t,e,i=this){this._emitter.on(t,e,i)}once(t,e,i=this){this._emitter.once(t,e,i)}removeAllListeners(t){this._emitter.removeAllListeners(t)}off(t,e,i=this,s){this._emitter.off(t,e,i,s)}listeners(t){return this._emitter.listeners(t)}emit(t,e,i){return this._emitter.emit(t,e,i)}trigger(t,e){if(this.config.debug)return this.emit(t,t,e);try{return this.emit(t,t,e)}catch(i){if(this.logger.error("An internal error happened while handling event "+t+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const e=t===$l.ERROR;this.trigger($l.ERROR,{type:Wl.OTHER_ERROR,details:Yl.INTERNAL_EXCEPTION,fatal:e,event:t,error:i}),this.triggeringException=!1}}return!1}listenerCount(t){return this._emitter.listenerCount(t)}destroy(){this.logger.log("destroy"),this.trigger($l.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null}attachMedia(t){if(!t||"media"in t&&!t.media){const e=new Error(`attachMedia failed: invalid argument (${t})`);return void this.trigger($l.ERROR,{type:Wl.OTHER_ERROR,details:Yl.ATTACH_MEDIA_ERROR,fatal:!0,error:e})}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const e="media"in t,i=e?t.media:t,s=e?t:{media:i};this._media=i,this.trigger($l.MEDIA_ATTACHING,s)}detachMedia(){this.logger.log("detachMedia"),this.trigger($l.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const t=this.bufferController.transferMedia();return this.trigger($l.MEDIA_DETACHING,{transferMedia:t}),t}loadSource(t){this.stopLoad();const e=this.media,i=this._url,s=this._url=Dd.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${s}`),e&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(e)),this.trigger($l.MANIFEST_LOADING,{url:t})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(t=-1,e){this.logger.log(`startLoad(${t+(e?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(t,e),this.started&&this.networkControllers);i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].stopLoad(),!this.started&&this.networkControllers);t++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(t=>{t.resumeBuffering&&t.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(t=>{t.pauseBuffering&&t.pauseBuffering()}))}get inFlightFragments(){const t={[td]:this.streamController.inFlightFrag};return this.audioStreamController&&(t[ed]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(t[id]=this.subtititleStreamController.inFlightFrag),t}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const t=this._media,e=null==t?void 0:t.currentTime;this.detachMedia(),t&&(this.attachMedia(t),e&&this.startLoad(e))}removeLevel(t){this.levelController.removeLevel(t)}get sessionId(){let t=this._sessionId;return t||(t=this._sessionId=function(){try{return crypto.randomUUID()}catch(t){try{const t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.slice(e.lastIndexOf("/")+1)}catch(e){let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)})}}}()),t}get levels(){const t=this.levelController.levels;return t||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(t){this.logger.log(`set currentLevel:${t}`),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(t){this.logger.log(`set nextLevel:${t}`),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(t){this.logger.log(`set loadLevel:${t}`),this.levelController.manualLevel=t}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(t){this.levelController.nextLoadLevel=t}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(t){this.logger.log(`set firstLevel:${t}`),this.levelController.firstLevel=t}get startLevel(){const t=this.levelController.startLevel;return-1===t&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t}set startLevel(t){this.logger.log(`set startLevel:${t}`),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(t){const e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimate():NaN}set bandwidthEstimate(t){this.abrController.resetEstimator(t)}get abrEwmaDefaultEstimate(){const{bwEstimator:t}=this.abrController;return t?t.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimateTTFB():NaN}set autoLevelCapping(t){this._autoLevelCapping!==t&&(this.logger.log(`set autoLevelCapping:${t}`),this._autoLevelCapping=t,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(t){(function(t){return Oh.indexOf(t)>-1})(t)&&this._maxHdcpLevel!==t&&(this._maxHdcpLevel=t,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:t,config:{minAutoBitrate:e}}=this;if(!t)return 0;const i=t.length;for(let s=0;s<i;s++)if(t[s].maxBitrate>=e)return s;return 0}get maxAutoLevel(){const{levels:t,autoLevelCapping:e,maxHdcpLevel:i}=this;let s;if(s=-1===e&&null!=t&&t.length?t.length-1:e,i)for(let r=s;r--;){const e=t[r].attrs["HDCP-LEVEL"];if(e&&e<=i)return r}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(t){this.abrController.nextAutoLevel=t}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(t){var e;return(null==(e=this.audioTrackController)?void 0:e.setAudioOption(t))||null}setSubtitleOption(t){var e;return(null==(e=this.subtitleTrackController)?void 0:e.setSubtitleOption(t))||null}get allAudioTracks(){const t=this.audioTrackController;return t?t.allAudioTracks:[]}get audioTracks(){const t=this.audioTrackController;return t?t.audioTracks:[]}get audioTrack(){const t=this.audioTrackController;return t?t.audioTrack:-1}set audioTrack(t){const e=this.audioTrackController;e&&(e.audioTrack=t)}get allSubtitleTracks(){const t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}get subtitleTracks(){const t=this.subtitleTrackController;return t?t.subtitleTracks:[]}get subtitleTrack(){const t=this.subtitleTrackController;return t?t.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(t){const e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}get subtitleDisplay(){const t=this.subtitleTrackController;return!!t&&t.subtitleDisplay}set subtitleDisplay(t){const e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(t){this.config.lowLatencyMode=t}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(t){this.latencyController.targetLatency=t}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(t){this.levelController.pathwayPriority=t}get bufferedToEnd(){var t;return!(null==(t=this.bufferController)||!t.bufferedToEnd)}get interstitialsManager(){var t;return(null==(t=this.interstitialsController)?void 0:t.interstitialsManager)||null}getMediaDecodingInfo(t,e=this.allAudioTracks){return xh(t,qh(e),navigator.mediaCapabilities)}}iv.defaultConfig=void 0;const sv=(rv=function(t){if(!(null==t?void 0:t.prototype))return t;const e=Gl(t,"video");e&&!`${e}`.includes("[native code]")||Object.defineProperty(t.prototype,"videoTracks",{get(){return function(t){let e=Ll(t).videoTracks;if(!e&&(e=new wl,Ll(t).videoTracks=e,jl)){const i=jl.call(t.nativeEl??t);for(const e of i)Rl(t,e);const s=()=>{e.dispatchEvent(new Event("change"))},r=s=>{if([...e].some(t=>t instanceof Ml))for(const t of i)kl(t);else Rl(t,s.track)},n=t=>{kl(t.track)};i.addEventListener("change",s),i.addEventListener("addtrack",r),i.addEventListener("removetrack",n)}return e}(this)}});const i=Gl(t,"audio");i&&!`${i}`.includes("[native code]")||Object.defineProperty(t.prototype,"audioTracks",{get(){return function(t){let e=Ll(t).audioTracks;if(!e&&(e=new Ul,Ll(t).audioTracks=e,Vl)){const i=Vl.call(t.nativeEl??t);for(const e of i)Nl(t,e);const s=()=>{e.dispatchEvent(new Event("change"))},r=s=>{if([...e].some(t=>t instanceof Hl))for(const t of i)_l(t);else Nl(t,s.track)},n=t=>{_l(t.track)};i.addEventListener("change",s),i.addEventListener("addtrack",r),i.addEventListener("removetrack",n)}return e}(this)}}),"addVideoTrack"in t.prototype||(t.prototype.addVideoTrack=function(t,e="",i=""){const s=new Ml;return s.kind=t,s.label=e,s.language=i,Rl(this,s),s}),"removeVideoTrack"in t.prototype||(t.prototype.removeVideoTrack=kl),"addAudioTrack"in t.prototype||(t.prototype.addAudioTrack=function(t,e="",i=""){const s=new Hl;return s.kind=t,s.label=e,s.language=i,Nl(this,s),s}),"removeAudioTrack"in t.prototype||(t.prototype.removeAudioTrack=_l),"videoRenditions"in t.prototype||Object.defineProperty(t.prototype,"videoRenditions",{get(){return s(this)}});const s=t=>{let e=Ll(t).videoRenditions;return e||(e=new xl,Ll(e).media=new WeakRef(t),Ll(t).videoRenditions=e),e};"audioRenditions"in t.prototype||Object.defineProperty(t.prototype,"audioRenditions",{get(){return r(this)}});const r=t=>{let e=Ll(t).audioRenditions;return e||(e=new Bl,Ll(e).media=new WeakRef(t),Ll(t).audioRenditions=e),e};return t}(Sl),nv=class extends rv{constructor(){super(),C(this,lv),C(this,av,null),C(this,ov,null),C(this,hv,()=>{var t,e,i;(null==(t=this.nativeEl)?void 0:t.webkitCurrentPlaybackTargetIsWireless)?null==(e=this.api)||e.stopLoad():null==(i=this.api)||i.startLoad()}),P(this,lv,cv).call(this,"config")}get config(){return D(this,ov)}set config(t){x(this,ov,t)}attributeChangedCallback(t,e,i){"src"!==t&&super.attributeChangedCallback(t,e,i),"src"===t&&e!=i&&this.load()}async load(){var t,e;const i=!this.api;if(P(this,lv,dv).call(this),this.src){if(i&&!D(this,ov)&&x(this,ov,JSON.parse((null==(t=this.shadowRoot.getElementById("config"))?void 0:t.textContent)||"{}")),iv.isSupported()){switch(await Promise.resolve(),this.api=new iv({liveDurationInfinity:!0,autoStartLoad:!1,...this.config}),this.api.loadSource(this.src),this.api.attachMedia(this.nativeEl),this.nativeEl.preload){case"none":{const t=()=>this.api.startLoad();this.nativeEl.addEventListener("play",t,{once:!0}),this.api.on(iv.Events.DESTROYING,()=>{this.nativeEl.removeEventListener("play",t)});break}case"metadata":{const t=this.api.config.maxBufferLength,e=this.api.config.maxBufferSize;this.api.config.maxBufferLength=1,this.api.config.maxBufferSize=1;const i=()=>{this.api.config.maxBufferLength=t,this.api.config.maxBufferSize=e};this.nativeEl.addEventListener("play",i,{once:!0}),this.api.on(iv.Events.DESTROYING,()=>{this.nativeEl.removeEventListener("play",i)}),this.api.startLoad();break}default:this.api.startLoad()}this.nativeEl.webkitCurrentPlaybackTargetIsWireless&&this.api.stopLoad(),this.nativeEl.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",D(this,hv)),x(this,av,document.createElement("source")),D(this,av).setAttribute("type","application/x-mpegURL"),D(this,av).setAttribute("src",this.src),this.nativeEl.disableRemotePlayback=!1,this.nativeEl.append(D(this,av));const t=new WeakMap;this.api.on(iv.Events.MANIFEST_PARSED,(e,i)=>{this.nativeEl.autoplay&&this.nativeEl.paused&&this.nativeEl.play().catch(t=>{}),r();let s=this.videoTracks.getTrackById("main");s||(s=this.addVideoTrack("main"),s.id="main",s.selected=!0);for(const[r,n]of i.levels.entries()){const e=s.addRendition(n.url[0],n.width,n.height,n.videoCodec,n.bitrate);t.set(n,`${r}`),e.id=`${r}`}for(let[t,r]of i.audioTracks.entries()){const e=r.default?"main":"alternative",i=this.addAudioTrack(e,r.name,r.lang);i.id=`${t}`,r.default&&(i.enabled=!0)}}),this.audioTracks.addEventListener("change",()=>{var t;const e=+(null==(t=[...this.audioTracks].find(t=>t.enabled))?void 0:t.id),i=this.api.audioTracks.map(t=>t.id);e!=this.api.audioTrack&&i.includes(e)&&(this.api.audioTrack=e)}),this.api.on(iv.Events.LEVELS_UPDATED,(e,i)=>{const s=this.videoTracks[this.videoTracks.selectedIndex??0];if(!s)return;const r=i.levels.map(e=>t.get(e));for(const t of this.videoRenditions)t.id&&!r.includes(t.id)&&s.removeRendition(t)});let i=null;this.api.on(iv.Events.ERROR,(t,e)=>{e.type===iv.ErrorTypes.NETWORK_ERROR&&e.details===iv.ErrorDetails.FRAG_LOAD_ERROR&&(i=e.frag.level)}),this.api.on(iv.Events.LEVEL_SWITCHED,(t,e)=>{const s=e.level;null!==i&&s<i&&(this.videoRenditions.selectedIndex=s,i=null)});const s=t=>{const e=t.target.selectedIndex;e!=this.api.nextLevel&&(this.api.nextLevel=e)};null==(e=this.videoRenditions)||e.addEventListener("change",s);const r=()=>{for(const t of this.videoTracks)this.removeVideoTrack(t);for(const t of this.audioTracks)this.removeAudioTrack(t)};return void this.api.once(iv.Events.DESTROYING,r)}await Promise.resolve(),this.nativeEl.canPlayType("application/vnd.apple.mpegurl")&&(this.nativeEl.src=this.src)}}},av=new WeakMap,ov=new WeakMap,lv=new WeakSet,dv=function(){var t,e;null==(t=D(this,av))||t.remove(),null==(e=this.nativeEl)||e.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",D(this,hv)),this.api&&(this.api.detachMedia(),this.api.destroy(),this.api=null)},hv=new WeakMap,cv=function(t){if(Object.prototype.hasOwnProperty.call(this,t)){const e=this[t];delete this[t],this[t]=e}},k(nv,"shadowRootOptions",{...rv.shadowRootOptions}),k(nv,"getTemplateHTML",(t,e={})=>{const{src:i,...s}=t;return`\n <script type="application/json" id="config">\n ${JSON.stringify(e.config||{})}\n <\/script>\n ${rv.getTemplateHTML(s)}\n `}),nv);var rv,nv,av,ov,lv,dv,hv,cv;globalThis.customElements&&!globalThis.customElements.get("hls-video")&&globalThis.customElements.define("hls-video",sv);const uv="_videoContainer_119iz_3",fv="_cardVideo_119iz_10",gv=({card:t,cardIndex:i=0,isActive:r=!1,isMuted:n,volume:a=.5,onVideoReady:o,onPlayRequested:l,ready:d=!0,className:h=""})=>{const c=e.useRef(null);e.useEffect(()=>{c.current&&o&&d&&o(c.current)},[d]),e.useEffect(()=>{r&&c.current&&l&&d&&l(c.current)},[r,d]),e.useEffect(()=>{c.current&&d&&(n?c.current.muted=!0:c.current.paused||(c.current.muted=!1),void 0!==c.current.volume&&(c.current.volume=a))},[n,a,d]),e.useEffect(()=>{if(!c.current||!t.videoUrl)return;const e=c.current;e.setAttribute("src",t.videoUrl),t.videoThumbnail&&(e.poster=t.videoThumbnail,e.setAttribute("poster",t.videoThumbnail))},[t.videoUrl,t.videoThumbnail]);const u=0===i?"auto":"none";return s.jsx(s.Fragment,{children:t.videoUrl&&d&&s.jsx("div",{className:uv,children:s.jsx("hls-video",{ref:c,id:`video-card-${t.id}`,class:fv,src:t.videoUrl,muted:!0,loop:!0,playsInline:!0,preload:u,...t.videoThumbnail?{poster:t.videoThumbnail}:{}})})})},mv="_swipeableCard_14c6z_1",pv="_swipeHeadline_14c6z_25",Av=t=>"video"===t.type,vv=100,yv=1,Ev=.35,Tv=.25,Sv=.35,bv=600,Iv=(t,e,i=!1)=>{const s=Math.abs(t)>Math.abs(e)?t>0?"right":"left":e>0?"down":"up";return i?s.charAt(0).toUpperCase()+s.slice(1):s},Lv=e.forwardRef(({card:t,cardIndex:i=0,cardUIConfig:r,isActive:n=!1,swipeOptions:a,creation:o,isAnimating:l=!1,animateDirection:d,onSwipeLeft:h,onSwipeRight:c,onSwipeUp:u,onSwipeDown:f,isMuted:g=!0,volume:m=.5,onVideoReady:p,onPlayRequested:A,onImageReady:v,ready:y=!0,className:E="",zIndex:T,tutorialXOffset:S=0},b)=>{const I=e.useRef(null),L=Oo(0),R=Oo(0),k=Oo(1),[w,D]=e.useState({text:"",opacity:0}),C=e.useRef(null),x=e.useRef(0),P=e.useRef(null),M=Fo(L,t=>t+S),O=e.useCallback(()=>a||((null==o?void 0:o.swipeOptions)?o.swipeOptions:{right:{enabled:!0,gesture:!0,label:"RIGHT"},left:{enabled:!0,gesture:!0,label:"LEFT"},up:{enabled:!0,gesture:!0,label:"UP"},down:{enabled:!0,gesture:!0,label:"DOWN"}}),[a,o]),B=e.useCallback(()=>{const t=O();return{right:t.right.label,left:t.left.label,up:t.up.label,down:t.down.label}},[O]),F=e.useCallback((t,e)=>{if(!n||l)return;const{offset:i}=e;P.current||(Math.abs(i.x)>5||Math.abs(i.y)>5)&&(P.current=Math.abs(i.x)>Math.abs(i.y)?"x":"y");const s=O(),r="x"===P.current?i.x:0,a="y"===P.current?i.y:0,o=r>0&&s.right.enabled&&s.right.gesture||r<0&&s.left.enabled&&s.left.gesture,d=a<0&&s.up.enabled&&s.up.gesture||a>0&&s.down.enabled&&s.down.gesture;if("x"===P.current&&!o)return;if("y"===P.current&&!d)return;L.set(r),R.set(a);const h=Math.sqrt(r**2+a**2);k.set((t=>1-Math.min(t/(4*vv),1)*(1-Ev))(h));const c=Iv(r,a,!0),u=Math.min(h/vv*3,yv);if(c!==C.current||Math.abs(u-x.current)>.05){C.current=c,x.current=u;const t=B(),e="Left"===c?t.left:"Right"===c?t.right:"Up"===c?t.up:"Down"===c?t.down:"";D({text:e,opacity:u})}},[n,l,O,B,L,R,k]),N=e.useCallback((t,e)=>{if(!n||l)return;const{offset:i}=e,s="x"===P.current?i.x:0,r="y"===P.current?i.y:0;P.current=null;const a=O(),o=s>0&&a.right.enabled&&a.right.gesture||s<0&&a.left.enabled&&a.left.gesture,d=r<0&&a.up.enabled&&a.up.gesture||r>0&&a.down.enabled&&a.down.gesture;if(Math.abs(s)>vv&&o||Math.abs(r)>vv&&d){const t=Iv(s,r);al(k,Tv,{duration:Sv,ease:"easeOut"}),requestAnimationFrame(()=>{"right"===t&&c?(c(),D({text:"",opacity:0})):"left"===t&&h?(h(),D({text:"",opacity:0})):"up"===t&&u?(u(),D({text:"",opacity:0})):"down"===t&&f&&(f(),D({text:"",opacity:0}))})}else al(L,0,{type:"spring",stiffness:400,damping:30,duration:.15}),al(R,0,{type:"spring",stiffness:400,damping:30,duration:.15}),al(k,1,{type:"spring",stiffness:400,damping:30,duration:.15});C.current=null,x.current=0},[n,l,O,h,c,u,f,L,R,k]),_=e.useRef(null);e.useEffect(()=>{if(d&&d!==_.current&&n&&I.current){_.current=d;const t=I.current.getBoundingClientRect(),e=t.width,i=t.height,s="up"===d?1.25*-i:"down"===d?1.25*i:0;al(L,"left"===d?1.25*-e:"right"===d?1.25*e:0,{duration:bv/1e3,ease:"easeOut"}),al(R,s,{duration:bv/1e3,ease:"easeOut"}),al(k,Tv,{duration:Sv,ease:"easeOut"})}else!d&&_.current&&(_.current=null,L.set(0),R.set(0),k.set(1))},[d,n,k,L,R]),e.useEffect(()=>{n||(L.set(0),R.set(0),k.set(1),D({text:"",opacity:0}),P.current=null)},[n,L,R,k]),e.useImperativeHandle(b,()=>({fadeOut:()=>{al(k,Tv,{duration:Sv,ease:"easeOut"})}}),[k]);const U=O(),H=U.left.enabled&&U.left.gesture||U.right.enabled&&U.right.gesture,j=U.up.enabled&&U.up.gesture||U.down.enabled&&U.down.gesture;return s.jsxs(Mo.div,{ref:I,drag:n&&!l&&(H||j),dragConstraints:{left:0,right:0,top:0,bottom:0},dragElastic:1,dragPropagation:!1,onDrag:F,onDragEnd:N,className:`${mv} ${E}`.trim(),style:{x:M,y:R,opacity:k,zIndex:T,cursor:n&&!l&&(H||j)?"grab":"default"},whileDrag:{cursor:"grabbing"},children:[s.jsx(fl,{card:t,cardUIConfig:r,children:Av(t)?s.jsx(gv,{card:t,cardIndex:i,isActive:n,isMuted:g,volume:m,onVideoReady:e=>{p&&p(e,t.id)},onPlayRequested:e=>{A&&A(e,t.id)},ready:y}):s.jsx(ml,{card:t,onImageReady:e=>{v&&v(e,t.id)},ready:y})}),s.jsx("div",{className:pv,style:{opacity:w.opacity},children:w.text})]})}),Rv="_ctaTooltip_1mai4_2",kv="_ctaTooltipArrow_1mai4_22",wv=({currentCardId:t,currentCardIndex:i=0,totalCards:r=10,tooltipText:n,tooltipTextColor:a,tooltipTextSize:o,tooltipBackgroundColor:l,tooltipKeep:d=!1,assetTooltips:h={},buttonContainerId:c="buttonsContainer",onFirstSwipe:u,className:f=""})=>{var g;const[m,p]=e.useState(t??null),[A,v]=e.useState(i),[y,E]=e.useState(r),[T,S]=e.useState(i>0),b=e.useRef(null),I=e.useRef(i),L=m&&(null==(g=h[m])?void 0:g.enabled)?h[m]:null,R=(null==L?void 0:L.text)??n??null,k=!(A>=y)&&""!==(R??"")&&(!T||d);e.useEffect(()=>{void 0!==t&&p(t)},[t]),e.useEffect(()=>{const t=I.current;I.current=i,v(i),i>0&&0===t&&!T?(S(!0),u&&u()):i>0&&!T&&S(!0)},[i,T,u]),e.useEffect(()=>{E(r)},[r]);const[w,D]=e.useState(100);e.useEffect(()=>{const t=document.getElementById(c);if(!t)return;const e=new ResizeObserver(t=>{for(const e of t)D(e.contentRect.width)});return e.observe(t),b.current=e,()=>{b.current&&(b.current.disconnect(),b.current=null)}},[c]);const C=(null==L?void 0:L.textColor)??a,x=(null==L?void 0:L.textSize)??o,P=(null==L?void 0:L.backgroundColor)??l;if(!R)return null;const M=R.replace(/<br>/g,"\n"),O=P??"#FFFFFF",B=`calc((${w}px / 2) + 2px)`;return s.jsxs("div",{className:`${Rv} ${f}`.trim(),style:{fontSize:x?`${x}px`:"12px",backgroundColor:O,color:C??"#333333",opacity:k?1:0},children:[M,s.jsx("div",{className:kv,style:{right:B,backgroundColor:O}})]})},Dv={verticalEmojisButtons:"_verticalEmojisButtons_14t5d_2",buttonContainer:"_buttonContainer_14t5d_11",button:"_button_14t5d_11",emojiIcon:"_emojiIcon_14t5d_45",buttonLabel:"_buttonLabel_14t5d_56",buttonAnimation:"_buttonAnimation_14t5d_62",buttonLikeAnimation:"_buttonLikeAnimation_14t5d_80",buttonDislikeAnimation:"_buttonDislikeAnimation_14t5d_85",buttonMaybeAnimation:"_buttonMaybeAnimation_14t5d_90",buttonSeenAnimation:"_buttonSeenAnimation_14t5d_95",contrastMode:"_contrastMode_14t5d_101",contrastModeButton:"_contrastModeButton_14t5d_109",contrastModeLabel:"_contrastModeLabel_14t5d_119",contrastModeLike:"_contrastModeLike_14t5d_130",contrastModeDislike:"_contrastModeDislike_14t5d_135",contrastModeMaybe:"_contrastModeMaybe_14t5d_140",contrastModeSeen:"_contrastModeSeen_14t5d_145"},Cv=({buttons:t,tooltipText:i,tooltipTextColor:r,tooltipTextSize:n,tooltipBackgroundColor:a,tooltipKeep:o,verticalPosition:l,horizontalPosition:d,buttonClass:h,containerClass:c,labelClass:u,onButtonClick:f,isAnimating:g=!1,visible:m=!0,className:p="",id:A="buttonsContainer",currentCardIndex:v,totalCards:y,onFirstSwipe:E})=>{const[T,S]=e.useState(null),b=e.useRef(null),I=e.useRef(null);e.useEffect(()=>()=>{I.current&&clearTimeout(I.current)},[]);const L=i&&i.trim().length>0;return m?s.jsxs("div",{ref:b,id:A,className:`${Dv.verticalEmojisButtons} contrast-mode ${c||""} ${p}`.trim(),style:{...void 0!==l&&{top:`${l}px`},...void 0!==d&&{right:`${d}px`}},children:[L&&s.jsx(wv,{tooltipText:i,tooltipTextColor:r,tooltipTextSize:n,tooltipBackgroundColor:a,tooltipKeep:o,buttonContainerId:A,currentCardIndex:v,totalCards:y,onFirstSwipe:E}),t.map(t=>{const e=T===t.id;return s.jsxs("div",{className:Dv.buttonContainer,children:[s.jsx("div",{className:`${Dv.button} ${t.action}-btn ${h||""} ${Dv.contrastModeButton} ${Dv[`contrastMode${t.action.charAt(0).toUpperCase()+t.action.slice(1)}`]||""} ${e&&Dv[`button${t.action.charAt(0).toUpperCase()+t.action.slice(1)}Animation`]||""}`.trim(),onClick:()=>(t=>{g||(S(t.id),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{S(null)},300),f&&f(t.action,t.id))})(t),children:s.jsx("img",{src:t.icon,alt:t.altText,className:Dv.emojiIcon})}),s.jsx("span",{className:`${Dv.buttonLabel} ${Dv.contrastModeLabel} ${u||""}`.trim(),children:t.label})]},t.id)})]}):null},xv={sideButtonsContainer:"_sideButtonsContainer_jjr9u_2",sideButtonsWrapper:"_sideButtonsWrapper_jjr9u_16",sideButtonContainer:"_sideButtonContainer_jjr9u_28",sideButtonLeft:"_sideButtonLeft_jjr9u_36",sideButtonRight:"_sideButtonRight_jjr9u_45",sideButtonTop:"_sideButtonTop_jjr9u_54",sideButtonBottom:"_sideButtonBottom_jjr9u_62",sideButton:"_sideButton_jjr9u_2",buttonContent:"_buttonContent_jjr9u_95",arrowWrapper:"_arrowWrapper_jjr9u_103",emojiWrapper:"_emojiWrapper_jjr9u_104",arrowRight:"_arrowRight_jjr9u_120",arrowLeft:"_arrowLeft_jjr9u_124",arrowUp:"_arrowUp_jjr9u_128",arrowDown:"_arrowDown_jjr9u_132",emojiIcon:"_emojiIcon_jjr9u_137",buttonLabel:"_buttonLabel_jjr9u_144",moveRight:"_moveRight_jjr9u_1",moveLeft:"_moveLeft_jjr9u_1",moveUp:"_moveUp_jjr9u_1",moveDown:"_moveDown_jjr9u_1"},Pv=({direction:t,size:e=32})=>s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:(()=>{switch(t){case"right":default:return xv.arrowRight;case"left":return xv.arrowLeft;case"up":return xv.arrowUp;case"down":return xv.arrowDown}})(),children:s.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})}),Mv=({button:t,position:e,onButtonClick:i,isAnimating:r,buttonClass:n,labelClass:a,currentAnimation:o=0,showEmoji:l=!1,buttonSize:d=80})=>{const h=ol(),c=(()=>{switch(t.action){case"like":default:return"right";case"dislike":return"left";case"maybe":return"up";case"seen":return"down"}})(),u=["right","left","up","down"][o]===c,f=.4*d,g=xv[`sideButton${e.charAt(0).toUpperCase()+e.slice(1)}`]||"";return s.jsx("div",{className:`${xv.sideButtonContainer} ${g}`,children:s.jsxs(Mo.button,{onClick:async()=>{r||(await h.start({scale:1.2,transition:{type:"spring",stiffness:400,damping:17,duration:.15}}),await h.start({scale:1,transition:{type:"spring",stiffness:400,damping:17,duration:.15}}),i&&i(t.action,t.id))},onContextMenu:t=>t.preventDefault(),className:`${xv.sideButton} ${t.action}-btn ${n||""}`.trim(),animate:h,whileHover:{scale:1.1,transition:{duration:.2}},style:{WebkitTouchCallout:"none",WebkitUserSelect:"none",touchAction:"manipulation",cursor:"pointer",pointerEvents:"auto",width:`${d}px`,height:`${d}px`},"aria-label":t.altText,children:[s.jsxs("div",{className:xv.buttonContent,style:{width:`${f}px`,height:`${f}px`},children:[s.jsx("div",{className:xv.arrowWrapper,style:{opacity:u&&l?0:1,transition:"opacity 0.15s ease"},children:s.jsx(Pv,{direction:c,size:f})}),s.jsx("div",{className:xv.emojiWrapper,style:{opacity:u&&l?1:0,transition:"opacity 0.15s ease"},children:s.jsx("img",{src:t.icon,alt:t.altText,className:xv.emojiIcon,style:{width:`${f}px`,height:`${f}px`}})})]}),s.jsx("span",{className:`${xv.buttonLabel} ${a||""}`.trim(),children:t.label})]})})},Ov=({buttons:t,buttonClass:i,containerClass:r,labelClass:n,buttonSize:a=80,onButtonClick:o,isAnimating:l=!1,visible:d=!0,className:h="",id:c="buttonsContainer"})=>{const[u,f]=e.useState(0),[g,m]=e.useState(!1),p=t.find(t=>"like"===t.action&&!1!==t.enabled),A=t.find(t=>"dislike"===t.action&&!1!==t.enabled),v=t.find(t=>"maybe"===t.action&&!1!==t.enabled),y=t.find(t=>"seen"===t.action&&!1!==t.enabled);return e.useEffect(()=>{m(!1);const t=setTimeout(()=>{m(!0)},300),e=setTimeout(()=>{m(!1)},1500);return()=>{clearTimeout(t),clearTimeout(e)}},[u]),e.useEffect(()=>{const t=setInterval(()=>{f(t=>(t+1)%4)},2e3);return()=>clearInterval(t)},[]),d?s.jsx("div",{id:c,className:`${xv.sideButtonsContainer} ${r||""} ${h}`.trim(),children:s.jsxs("div",{className:xv.sideButtonsWrapper,children:[v&&s.jsx(Mv,{button:v,position:"top",onButtonClick:o,isAnimating:l,buttonClass:i,labelClass:n,currentAnimation:u,showEmoji:g,buttonSize:a}),A&&s.jsx(Mv,{button:A,position:"left",onButtonClick:o,isAnimating:l,buttonClass:i,labelClass:n,currentAnimation:u,showEmoji:g,buttonSize:a}),p&&s.jsx(Mv,{button:p,position:"right",onButtonClick:o,isAnimating:l,buttonClass:i,labelClass:n,currentAnimation:u,showEmoji:g,buttonSize:a}),y&&s.jsx(Mv,{button:y,position:"bottom",onButtonClick:o,isAnimating:l,buttonClass:i,labelClass:n,currentAnimation:u,showEmoji:g,buttonSize:a})]})}):null},Bv="_horizontalCtaTooltip_1slua_1",Fv=({currentCardId:t,currentCardIndex:i=0,tooltipText:r,tooltipTextColor:n,tooltipTextSize:a,tooltipBackgroundColor:o,tooltipKeep:l=!1,tooltipBottomOffset:d,assetTooltips:h={},onFirstSwipe:c,className:u=""})=>{var f;const[g,m]=e.useState(t??null),[p,A]=e.useState(i),[v,y]=e.useState(i>0),E=e.useRef(i),T=g&&(null==(f=h[g])?void 0:f.enabled)?h[g]:null,S=(null==T?void 0:T.text)??r??null,b=(0===p||l||((null==T?void 0:T.enabled)??!1))&&""!==(S??"")&&(!v||l);e.useEffect(()=>{void 0!==t&&m(t)},[t]),e.useEffect(()=>{const t=E.current;E.current=i,A(i),i>0&&0===t&&!v?(y(!0),c&&c()):i>0&&!v&&y(!0)},[i,v,c]);const I=(null==T?void 0:T.textColor)??n,L=(null==T?void 0:T.textSize)??a,R=(null==T?void 0:T.backgroundColor)??o,k=(null==T?void 0:T.bottomOffset)??d;if(!S)return null;const w=S.replace(/<br>/g,"\n");return s.jsx("div",{className:`${Bv} ${u}`.trim(),style:{bottom:void 0!==k?`calc(${k}px + 50%)`:"50%",backgroundColor:R??"#FFFFFF",color:I??"#333333",fontSize:L?`${L}px`:"12px",opacity:b?1:0,pointerEvents:b?"auto":"none"},children:w})},Nv={sideButtonsContainer:"_sideButtonsContainer_1kkly_2",sideButtonsWrapper:"_sideButtonsWrapper_1kkly_16",sideButtonContainer:"_sideButtonContainer_1kkly_28",sideButtonLeft:"_sideButtonLeft_1kkly_36",sideButtonRight:"_sideButtonRight_1kkly_45",sideButtonTop:"_sideButtonTop_1kkly_54",sideButtonBottom:"_sideButtonBottom_1kkly_62",sideButton:"_sideButton_1kkly_2",buttonContent:"_buttonContent_1kkly_99",buttonLabel:"_buttonLabel_1kkly_111",arrowRight:"_arrowRight_1kkly_126",arrowLeft:"_arrowLeft_1kkly_130",arrowUp:"_arrowUp_1kkly_134",arrowDown:"_arrowDown_1kkly_138",moveRight:"_moveRight_1kkly_1",moveLeft:"_moveLeft_1kkly_1",moveUp:"_moveUp_1kkly_1",moveDown:"_moveDown_1kkly_1",tooltipWrapper:"_tooltipWrapper_1kkly_277"},_v=({direction:t,size:e=32})=>s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:(()=>{switch(t){case"right":default:return Nv.arrowRight;case"left":return Nv.arrowLeft;case"up":return Nv.arrowUp;case"down":return Nv.arrowDown}})(),children:s.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})}),Uv=({button:t,position:e,onButtonClick:i,isAnimating:r,buttonClass:n,labelClass:a,currentAnimation:o=0,buttonSize:l=80})=>{const d=ol(),h=(()=>{switch(t.action){case"like":default:return"right";case"dislike":return"left";case"maybe":return"up";case"seen":return"down"}})(),c=.4*l,u=Nv[`sideButton${e.charAt(0).toUpperCase()+e.slice(1)}`]||"";return s.jsx("div",{className:`${Nv.sideButtonContainer} ${u}`,children:s.jsxs(Mo.button,{onClick:async()=>{r||(await d.start({scale:1.2,transition:{type:"spring",stiffness:400,damping:17,duration:.15}}),await d.start({scale:1,transition:{type:"spring",stiffness:400,damping:17,duration:.15}}),i&&i(t.action,t.id))},onContextMenu:t=>t.preventDefault(),className:`${Nv.sideButton} ${t.action}-btn ${n||""}`.trim(),animate:d,whileHover:{scale:1.1,transition:{duration:.2}},style:{width:`${l}px`,height:`${l}px`},"aria-label":t.altText,children:[s.jsx("div",{className:Nv.buttonContent,style:{width:`${c}px`,height:`${c}px`},children:s.jsx(_v,{direction:h,size:c})}),s.jsx("span",{className:`${Nv.buttonLabel} ${a||""}`.trim(),children:t.label})]})})},Hv=({buttons:t,ctaText:i,isDemoMode:r=!1,tooltipTextColor:n,tooltipTextSize:a,tooltipBackgroundColor:o,tooltipKeep:l,tooltipBottomOffset:d,currentCardIndex:h,onFirstSwipe:c,buttonClass:u,containerClass:f,labelClass:g,buttonSize:m=80,onButtonClick:p,isAnimating:A=!1,visible:v=!0,className:y="",id:E="buttonsContainer"})=>{const[T,S]=e.useState(0),b=t.find(t=>"like"===t.action&&t.enabled),I=t.find(t=>"dislike"===t.action&&t.enabled),L=t.find(t=>"maybe"===t.action&&t.enabled),R=t.find(t=>"seen"===t.action&&t.enabled);if(e.useEffect(()=>{const t=setInterval(()=>{S(t=>(t+1)%4)},2e3);return()=>clearInterval(t)},[]),!v)return null;const k=r&&i&&i.trim().length>0;return s.jsx("div",{id:E,className:`${Nv.sideButtonsContainer} ${f||""} ${y}`.trim(),children:s.jsxs("div",{className:Nv.sideButtonsWrapper,children:[L&&s.jsx(Uv,{button:L,position:"top",onButtonClick:p,isAnimating:A,buttonClass:u,labelClass:g,currentAnimation:T,buttonSize:m}),I&&s.jsx(Uv,{button:I,position:"left",onButtonClick:p,isAnimating:A,buttonClass:u,labelClass:g,currentAnimation:T,buttonSize:m}),k&&s.jsx("div",{className:Nv.tooltipWrapper,children:s.jsx(Fv,{tooltipText:i,tooltipTextColor:n,tooltipTextSize:a,tooltipBackgroundColor:o,tooltipKeep:l,tooltipBottomOffset:d,currentCardIndex:h??0,onFirstSwipe:c})}),b&&s.jsx(Uv,{button:b,position:"right",onButtonClick:p,isAnimating:A,buttonClass:u,labelClass:g,currentAnimation:T,buttonSize:m}),R&&s.jsx(Uv,{button:R,position:"bottom",onButtonClick:p,isAnimating:A,buttonClass:u,labelClass:g,currentAnimation:T,buttonSize:m})]})})},jv="_swipeTutorialOverlay_jbb64_2",Vv="_handContainer_jbb64_16",Gv="_handIcon_jbb64_24",Qv="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABBwAAAQ4AQAAAACC3fKIAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAnRSTlMAAHaTzTgAAAACYktHRAAB3YoTpAAAAAd0SU1FB+oCCwgOA99Ta6kAABV7SURBVHja7Z1PsqwqEsY1HDBk2jOWwtK0ozfmDnoLLsGhEW1o3z/nVKklmh9kJt53YfTOfVXUTyA/kgSTqiqllFJKKaWUUkoppZRSSinl7y71OrDX6RbwC806sUO0a4d9wa8rN0Ozoq3brij2bbEr2Lr1uq4995BY1xltOvaR+aOHsS4268o+Mn/0MNbFP/oPbLv7sqJd7Pghfg4zrIt/9t8iADGi/beyywQ4zn5+gVkofo51qItrKYgFbTpmCLuCXfyLmlkyLfpgVgDCoXX+/sIgADFgMiEDMYIyIQIxgTIhAjGDMiECsYAyIQKxgjIhA9FhMiED0YOfF4EYMAuVgRgxC5WBmDALlYGYMQsVmcDIQmEkIVYQohOB6CCZEPGsyO3rRCAMNtz9uq78Lv83xAhpFfPi59vmJkirJFZgZKHAPg1DLBLtBrprxKEGjiDQcSUanRWZOt5G1yMy0TNDOOThvBCERbq5FdGq91ib8snE2+pmdnsWEgopmYCEQkomIKGwYhCA2UnJBCQUXsSlAdtYSiYgoZCyUEQohLwJTCgaOQi6UMhZKCAUTsibgITCi8kE8ICtmEwAXb2KyQRdKGo5maBbnigEtXI5bwLoayMoE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jFIJoHjEvEPAY5iDb/uERGphwDfWQughDNA8YlfWQOkhA+7xQKjUzJIUEemaJDYu9xZxoSVLmSZaCNzFkYwmZ1aBC56oUhquwGShwUsziEeUBvUAZFJw5xrxSTPMP99DEoQNSZ5ZLUH5MKhM3fG7f20VX5+0OnIW76Q6khLpti1GK4kgq1hrhoil6PIdwUig0RbIpKtZiMYnndFr02w0lbLFUppZRSSimllFJKKaWUUkoppZQSKP8HUbkEDAG+x4EAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjYtMDItMTFUMDg6MTQ6MDMrMDA6MDCAmdYbAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDI2LTAyLTExVDA4OjE0OjAzKzAwOjAw8cRupwAAAABJRU5ErkJggg==",Kv=({size:t=80,src:e,alt:i})=>s.jsx("img",{src:e,alt:i,className:Gv,style:{width:`${t}px`,height:`${t}px`}}),qv=({visible:t=!0,onCardMove:i,animationDuration:r=3e3,startDelay:n=500,className:a="",id:o="swipeTutorialOverlay"})=>{const l=ol(),d=e.useRef(null),h=e.useRef(!1),[c,u]=e.useState(Qv);return e.useEffect(()=>{if(!t)return l.set({x:0}),u(Qv),i&&i(0),d.current&&(cancelAnimationFrame(d.current),d.current=null),void(h.current=!1);if(h.current)return;h.current=!0;return(async()=>{for(await new Promise(t=>setTimeout(t,n));t&&h.current;)u(Qv),await l.start({x:0,transition:{duration:.4,ease:"easeOut"}}),await new Promise(t=>setTimeout(t,1e3)),u("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABBwAAAQ4CAQAAAAArweuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAHHkSURBVHja7d13nBbHYf/x79Db0etxvd/RqwoSSKh32XJRYjtuiR07sZPYaU7imuIk/sWOe48tN9mW1ZAEiCaJItGr6Bxw9C7g6OXm9wdIQqI9zz27O7O7n3deSWwJdnZntnyf2dkZCQA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:90,transition:{duration:r/1e3,ease:"easeOut"}}),i?new Promise(t=>{const e=Date.now(),s=()=>{const n=Date.now()-e,a=Math.min(n/r,1),o=1-Math.pow(1-a,3);i(150*o),a<1?d.current=requestAnimationFrame(s):t()};s()}):Promise.resolve()]),u(Qv),await Promise.all([l.start({x:0,transition:{duration:.5,ease:"easeInOut"}}),i?new Promise(t=>{const e=Date.now(),s=()=>{const r=Date.now()-e,n=Math.min(r/500,1),a=1-Math.pow(1-n,3);i(150*(1-a)),n<1?d.current=requestAnimationFrame(s):(i(0),t())};s()}):Promise.resolve()]),await new Promise(t=>setTimeout(t,500)),u("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABBwAAAQ4CAQAAAAArweuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAE5dSURBVHja7d13vG5VfSf+777tnMu9F5AL3AKCYAHEQhDUYDdxYhJ1HAvjaOxiTXOS0ZlkJslk0pNfzGSMLcWGGks0oCLWSEws9KaJqKBSbu/tnFvO+v3BBUFuec45+3n2Wmu/33m9fBnkPHvv7157rc9eu0UAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtKZRgul4V1oQ949HxLEREbEhro3vxvYYi+PiBSoJgODAj3wyjceKOPM+//y2WB2bYyKeqZYACA5E/Hm6X5wUZ8SKQ/w7U3F1/Ftsj9erKACCQ399OG2IB8cTY8FA//YX4pZ4tZoCIDj007vSMfGTsXIaf3FD3BgvVFUABIf+eW96QDxx2n+1Kf41NseLVRYAwaE/PpQm4px42Az/+pL49/g1tQVAcOiH96XF8YT9D13OzCfjO6IDAIJDH3wwHRk/P+tf+XDsiFeqLwBVmaME9xnw0/IWYkPEz8SYYgIgONQeG46Pp7TyS0fHo+PDSUUBEBwqjg0nxpNb+7UHx6nxd6IDAIJDnS5Mx8d5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ieqgA6HICaZkIZCrLV0xKYcQDyYQYiz7CwI1YaKxAcAPGBQ9sZi4wRCA6AEMGB7YkFxgQEB6CCM9+0UBGGOxQYCxAcgB6cIad5ijBtu2NMz88seKoCKNb8pmmaZqtCDGRnNE3TNI3YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAxf5/YGXrivgArHYAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjYtMDItMTFUMDg6MTM6MjArMDA6MDARiNCCAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDI2LTAyLTExVDA4OjEzOjIwKzAwOjAwYNVoPgAAAABJRU5ErkJggg=="),await Promise.all([l.start({x:-90,transition:{duration:r/1e3,ease:"easeOut"}}),i?new Promise(t=>{const e=Date.now(),s=()=>{const n=Date.now()-e,a=Math.min(n/r,1),o=1-Math.pow(1-a,3);i(-150*o),a<1?d.current=requestAnimationFrame(s):t()};s()}):Promise.resolve()]),u(Qv),await Promise.all([l.start({x:0,transition:{duration:.5,ease:"easeInOut"}}),i?new Promise(t=>{const e=Date.now(),s=()=>{const r=Date.now()-e,n=Math.min(r/500,1),a=1-Math.pow(1-n,3);i(-150*(1-a)),n<1?d.current=requestAnimationFrame(s):(i(0),t())};s()}):Promise.resolve()]),await new Promise(t=>setTimeout(t,1e3))})(),()=>{h.current=!1,d.current&&(cancelAnimationFrame(d.current),d.current=null)}},[t,l,i,r,n]),t?s.jsx("div",{id:o,className:`${jv} ${a}`.trim(),children:s.jsx(Mo.div,{className:Vv,animate:l,initial:{x:0},children:s.jsx(Kv,{size:80,src:c,alt:"Swipe tutorial hand"})})}):null},Wv="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='144'%20height='144'%20fill='%23000'%20xmlns:v='https://vecta.io/nano'%3e%3cpath%20d='M71.998%20105c6.8%200%2012.975-1.925%2018.525-5.775S100.098%2090.3%20102.598%2084h-9.9c-2.2%203.7-5.125%206.625-8.775%208.775S76.298%2096%2071.998%2096s-8.275-1.075-11.925-3.225S53.498%2087.7%2051.298%2084h-9.9c2.5%206.3%206.525%2011.375%2012.075%2015.225S65.198%20105%2071.998%20105zM52.395%2051.002c-3.2%200-6.175.9-8.925%202.7a23.03%2023.03%200%200%200-6.825%206.9l7.5%204.95c1-1.5%202.2-2.775%203.6-3.825s2.95-1.575%204.65-1.575%203.25.525%204.65%201.575%202.6%202.275%203.6%203.675l7.5-4.95c-1.8-2.7-4.075-4.95-6.825-6.75s-5.725-2.7-8.925-2.7zm42%200c-3.2%200-6.175.9-8.925%202.7a23.03%2023.03%200%200%200-6.825%206.9l7.5%204.95c1-1.4%202.2-2.625%203.6-3.675s2.95-1.575%204.65-1.575%203.275.5%204.725%201.5%202.626%202.25%203.525%203.75l7.5-4.95a23.03%2023.03%200%200%200-6.825-6.9c-2.75-1.8-5.725-2.7-8.925-2.7z'/%3e%3c/svg%3e",Yv="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='144'%20height='144'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cpath%20d='M37.498%2095.998h9v-1.5c0-7.1%202.475-13.125%207.425-18.075s10.975-7.425%2018.075-7.425%2013.125%202.475%2018.075%207.425%207.425%2010.975%207.425%2018.075v1.5h9v-1.5c0-9.6-3.35-17.75-10.05-24.45s-14.85-10.05-24.45-10.05-17.75%203.35-24.45%2010.05-10.05%2014.85-10.05%2024.45v1.5zm5.1-40.5c4.1-.6%208.425-2.2%2012.975-4.8s8.175-5.55%2010.875-8.85l-6.9-5.7c-2%202.4-4.775%204.6-8.325%206.6s-6.825%203.25-9.825%203.75l1.2%209zm58.8%200l1.2-9c-3-.5-6.275-1.75-9.825-3.75s-6.325-4.2-8.325-6.6l-6.9%205.7c2.7%203.3%206.325%206.25%2010.875%208.85s8.875%204.2%2012.975%204.8z'%20fill='%23000'/%3e%3c/svg%3e",$v="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='145'%20height='144'%20fill='%23000'%20xmlns:v='https://vecta.io/nano'%3e%3cdefs%3e%3cclipPath%20id='iconClip'%3e%3ccircle%20cx='50%25'%20cy='50%25'%20r='50%25'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23iconClip)'%3e%3cpath%20d='M49.734%2084.513a2%202%200%200%200%201.284%202.52l30.434%209.889a2%202%200%200%200%202.52-1.284l1.545-4.755a2%202%200%200%200-1.284-2.52L53.8%2078.474a2%202%200%200%200-2.52%201.284l-1.545%204.755zm44.815-11.736c2.378.773%204.669.597%206.874-.526s3.694-2.874%204.467-5.252.597-4.669-.527-6.874-2.874-3.694-5.252-4.467-4.669-.597-6.874.527-3.694%202.874-4.466%205.252-.597%204.669.527%206.874%202.874%203.694%205.252%204.466zM54.605%2059.799c2.378.773%204.669.597%206.874-.526s3.694-2.874%204.467-5.252.597-4.669-.527-6.874-2.874-3.694-5.252-4.466-4.669-.597-6.874.526-3.694%202.874-4.466%205.252-.597%204.669.526%206.874%202.874%203.694%205.252%204.467z'/%3e%3c/g%3e%3c/svg%3e",zv="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='144'%20height='144'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cpath%20d='M63.601%2099.602l42.3-42.3-8.4-8.4-33.9%2033.9-17.1-17.1-8.4%208.4%2025.5%2025.5z'%20fill='%23000'/%3e%3c/svg%3e",Xv="_swipeableFeed_jamse_1",Zv="_swipeableFeedCards_jamse_8",Jv="_swipeableFeedEmpty_jamse_22",ty="_swipeTutorialContainer_jamse_33",ey=({cards:t,finderUiConfig:i,buttonStyle:r="vertical-emojis",maxVisibleCards:n=2,isMuted:a=!0,volume:o=.5,currentCardIndex:l,setCurrentCardIndex:d,addSwipeToHistory:h,setIsAnimating:c,isAnimating:u,setNoMoreCards:f,sendSwipeEvent:g,sendImpressionEvent:m,startCardImpression:p,onAllCardsSwiped:A,onCardSwiped:v,swipeTutorialEnabled:y=!1,swipeTutorialDuration:E=3e3,swipeTutorialStartDelay:T=500,id:S="swipeableFeed"})=>{const[b,I]=e.useState(!1),[L,R]=e.useState(null),[k,w]=e.useState({}),[D,C]=e.useState(0),x=e.useRef(null),P=e.useCallback(async t=>{if(!t)return;if(!("HLS-VIDEO"===t.tagName||"VIDEO"===t.tagName||"play"in t))return;const e=t;try{e.muted=!0,e.setAttribute&&e.setAttribute("muted",""),(void 0===e.readyState||e.readyState<2)&&await new Promise(t=>{const i=()=>{e.removeEventListener("loadeddata",i),t()};e.addEventListener("loadeddata",i),setTimeout(()=>{e.removeEventListener("loadeddata",i),t()},3e3)}),void 0!==e.currentTime&&(e.currentTime=0);let t=0;const i=5,s=async()=>{try{e.muted=!0,e.play&&await e.play()}catch(r){t<i&&(t++,e.load&&e.load(),setTimeout(s,500*t))}};setTimeout(()=>{s()},200)}catch(i){}},[]),M=e.useMemo(()=>t.slice(l,l+n),[t,l,n]),O=l<t.length,B=e.useCallback(e=>{if(u||!O)return;const i=t[l];i&&(c(!0),I(!0),C(0),i.id&&g(i.id,e),h(e,i),null==v||v(i,e),R(e),setTimeout(()=>{const e=l+1;if(R(null),e>=t.length)return c(!1),f(!0),void(null==A||A());const i=t[e];if(!(!i||(k[e]??!1))&&i){const t=(i=0)=>{if(i>20)return c(!1),void d(e);k[e]??!1?(c(!1),d(e)):setTimeout(()=>t(i+1),100)};t()}else c(!1),d(e);if(e<t.length){const i=t[e];(null==i?void 0:i.id)&&(p(i.id),m(i.id),"video"===i.type&&i.videoUrl&&setTimeout(()=>{var t;const e=null==(t=x.current)?void 0:t.querySelector(`[id="${i.id}"]`);if(e){const t=e.querySelector("hls-video, video");t&&P(t)}},100))}},600))},[u,O,t,l,c,d,f,g,m,p,h,v,A,P,k,f]),F=e.useCallback((t,e)=>{if(u||!O)return;const i={like:"right",dislike:"left",maybe:"up",seen:"down"}[t];i&&B(i)},[u,O,B]),N=e.useCallback(t=>{C(t)},[]),_=e.useCallback(e=>{const i=t.findIndex(t=>t.id===e);i>=0&&w(t=>({...t,[i]:!0}))},[t]),U=e.useCallback((t,e)=>{e&&_(e)},[_]),H=e.useCallback((e,i)=>{if(!e)return;const s=t[l];s&&i===s.id&&P(e)},[P,t,l]),j=e.useCallback((t,e)=>{e&&_(e)},[_]),V=e.useRef(new Set);e.useEffect(()=>{M.forEach((t,e)=>{const i=l+e;"image"===t.type&&t.id&&!V.current.has(i)&&(V.current.add(i),w(t=>({...t,[i]:!0})))});const t=new Set(M.map((t,e)=>l+e));V.current.forEach(e=>{t.has(e)||V.current.delete(e)})},[M,l]),e.useEffect(()=>{if(t.length>0&&0===l){const e=t[0];(null==e?void 0:e.id)&&(p(e.id),m(e.id),"video"===e.type&&e.videoUrl&&setTimeout(()=>{var t;const i=null==(t=x.current)?void 0:t.querySelector(`[id="${e.id}"]`);if(i){const t=i.querySelector("hls-video, video");t&&P(t)}},500))}},[t,l,p,m,P]),e.useEffect(()=>{C(0)},[l]);const G=e.useMemo(()=>i.navigation.options||{right:{enabled:!0,gesture:!0,label:"RIGHT"},left:{enabled:!0,gesture:!0,label:"LEFT"},up:{enabled:!0,gesture:!1,label:"UP"},down:{enabled:!0,gesture:!1,label:"DOWN"}},[i.navigation.options]),Q=e.useMemo(()=>{const e={tooltipText:i.navigationDemoTooltip.text,tooltipTextColor:i.navigationDemoTooltip.textColor,tooltipTextSize:i.navigationDemoTooltip.textSize,tooltipBackgroundColor:i.navigationDemoTooltip.backgroundColor,tooltipKeep:i.navigationDemoTooltip.keep,onButtonClick:F,isAnimating:u,visible:O,currentCardIndex:l,totalCards:t.length,onFirstSwipe:()=>I(!0)};switch(r){case"vertical-emojis":{const t=[{id:"likeBtn",action:"like",label:G.right.label,icon:Wv,altText:"Yes"},{id:"dislikeBtn",action:"dislike",label:G.left.label,icon:Yv,altText:"No"},{id:"maybeBtn",action:"maybe",label:G.up.label,icon:$v,altText:"Maybe"},{id:"seenBtn",action:"seen",label:G.down.label,icon:zv,altText:"Seen"}].filter(t=>{var e;const i={like:"right",dislike:"left",maybe:"up",seen:"down"}[t.action];return(null==(e=G[i])?void 0:e.enabled)??!0});return{component:Cv,props:{...e,buttons:t,verticalPosition:i.navigation.positionTop,horizontalPosition:i.navigation.positionRight}}}case"side-emojis":{const t=[{id:"likeBtn",action:"like",label:G.right.label,icon:Wv,altText:"Yes"},{id:"dislikeBtn",action:"dislike",label:G.left.label,icon:Yv,altText:"No"}].filter(t=>{var e;const i={like:"right",dislike:"left"}[t.action];return(null==(e=G[i])?void 0:e.enabled)??!0});return{component:Ov,props:{...e,buttons:t}}}case"side-arrows":{const t=[{id:"likeBtn",action:"like",label:G.right.label,icon:Wv,altText:"Yes",enabled:G.right.enabled},{id:"dislikeBtn",action:"dislike",label:G.left.label,icon:Yv,altText:"No",enabled:G.left.enabled},{id:"maybeBtn",action:"maybe",label:G.up.label,icon:$v,altText:"Maybe",enabled:G.up.enabled},{id:"seenBtn",action:"seen",label:G.down.label,icon:zv,altText:"Seen",enabled:G.down.enabled}];return{component:Hv,props:{...e,buttons:t,ctaText:i.navigationDemoTooltip.text,isDemoMode:Boolean(i.navigationDemoTooltip.text&&!b),tooltipBottomOffset:i.navigationDemoTooltip.bottomOffset}}}default:return null}},[r,i.navigation.options,G,F,u,O,l,t.length,b]),K=e.useCallback(()=>{G.left.enabled&&G.left.gesture&&B("left")},[G.left,B]),q=e.useCallback(()=>{G.right.enabled&&G.right.gesture&&B("right")},[G.right,B]),W=e.useCallback(()=>{G.up.enabled&&G.up.gesture&&B("up")},[G.up,B]),Y=e.useCallback(()=>{G.down.enabled&&G.down.gesture&&B("down")},[G.down,B]);return 0===t.length?s.jsx("div",{className:Xv,id:S,children:s.jsx("div",{className:Jv,children:"No cards available"})}):s.jsxs("div",{ref:x,className:Xv,id:S,children:[s.jsx("div",{className:Zv,children:M.map((t,e)=>{const r=l+e,d=0===e,h=d&&(k[r]??!0)&&!u,c=n-e;return s.jsx(Lv,{card:t,cardUIConfig:i.card,cardIndex:r,isActive:d,swipeOptions:G,isAnimating:u&&d,animateDirection:d?L:null,onSwipeLeft:h?K:void 0,onSwipeRight:h?q:void 0,onSwipeUp:h?W:void 0,onSwipeDown:h?Y:void 0,onVideoReady:U,onPlayRequested:H,onImageReady:j,isMuted:a,volume:o,ready:!0,zIndex:c,tutorialXOffset:d?D:0},t.id)})}),(()=>{if(!Q||!O)return null;const{component:t,props:e}=Q;return s.jsx(t,{...e})})(),y&&O&&!b&&M.length>0&&s.jsx("div",{className:ty,children:s.jsx(qv,{visible:!0,onCardMove:N,animationDuration:E,startDelay:T})})]})},iy="_volumeControl_r52gg_2",sy="_volumeControlTopLeft_r52gg_12",ry="_volumeControlTopRight_r52gg_17",ny="_volumeControlBottomLeft_r52gg_23",ay="_volumeControlBottomRight_r52gg_28",oy="_volumeControlButton_r52gg_34",ly="_volumeSlider_r52gg_60",dy="_volumeSliderInput_r52gg_81",hy="_volumeSliderLeft_r52gg_122",cy="_volumeSliderRight_r52gg_126",uy=({volumeControlUIConfig:t,isMuted:i,volume:r,visible:n=!0,className:a="",onToggleMute:o,onVolumeChange:l})=>{const{position:d,size:h,volumeControl:c}=t,u="top-left"===d||"bottom-left"===d?"right":"left";if(!n)return null;const f=e.useMemo(()=>{switch(d){case"top-left":return sy;case"top-right":default:return ry;case"bottom-left":return ny;case"bottom-right":return ay}},[d]);return s.jsxs("div",{className:`${iy} ${f} ${a}`.trim(),style:{height:`${h}px`},children:[s.jsx("div",{className:oy,onClick:t=>{t.stopPropagation(),o()},style:{height:`${h}px`},children:s.jsx("img",{src:i?"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cmask%20id='A'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%20mask-type='alpha'%3e%3cpath%20fill='%23d9d9d9'%20d='M0%200h24v24H0z'/%3e%3c/mask%3e%3cg%20mask='url(%23A)'%3e%3cpath%20d='M19.801%2022.601l-3.025-3.025a8.31%208.31%200%200%201-1.325.688%209.48%209.48%200%200%201-1.45.462v-2.05l.688-.25c.225-.083.438-.183.637-.3l-3.325-3.325v5.2l-5-5h-4v-6h3.2l-4.8-4.8%201.4-1.4%2018.4%2018.4-1.4%201.4zm-.2-5.8l-1.45-1.45c.283-.517.496-1.058.638-1.625a7.19%207.19%200%200%200%20.212-1.75%206.86%206.86%200%200%200-1.375-4.2c-.917-1.233-2.125-2.067-3.625-2.5v-2.05c2.067.467%203.75%201.512%205.05%203.137s1.95%203.496%201.95%205.613c0%20.883-.121%201.733-.363%202.55s-.587%201.575-1.037%202.275zm-3.35-3.35l-2.25-2.25v-3.25a4.15%204.15%200%200%201%201.838%201.65c.442.733.662%201.533.662%202.4a4.34%204.34%200%200%201-.062.738%204.28%204.28%200%200%201-.187.712zm-4.25-4.25l-2.6-2.6%202.6-2.6v5.2zm-2%205.95v-2.35l-1.8-1.8h-3.2v2h2.85l2.15%202.15z'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cmask%20id='A'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%20mask-type='alpha'%3e%3cpath%20fill='%23d9d9d9'%20d='M0%200h24v24H0z'/%3e%3c/mask%3e%3cg%20mask='url(%23A)'%3e%3cpath%20d='M14%2020.727v-2.05c1.5-.433%202.708-1.267%203.625-2.5S19%2013.543%2019%2011.977s-.458-2.967-1.375-4.2S15.5%205.71%2014%205.277v-2.05c2.067.467%203.75%201.513%205.05%203.138S21%209.86%2021%2011.977s-.65%203.988-1.95%205.612-2.983%202.671-5.05%203.138zM3%2015.002v-6h4l5-5v16l-5-5H3zm11%201v-8.05a4.15%204.15%200%200%201%201.838%201.65c.442.733.662%201.533.662%202.4%200%20.85-.221%201.637-.662%202.363S14.783%2015.635%2014%2016.002zm-4-7.15l-2.15%202.15H5v2h2.85l2.15%202.15v-6.3z'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e",alt:"Volume control"})}),c&&s.jsx("div",{className:`${ly} ${"left"===u?hy:cy}`,onClick:t=>t.stopPropagation(),style:{height:`${h}px`,borderRadius:`${h}px`},children:s.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:r,onChange:t=>{const e=parseFloat(t.target.value)||1;i&&o(),l(e)},className:dy,onClick:t=>t.stopPropagation()})})]})},fy="_historyButton_1xf6c_1",gy="_tooltip_1xf6c_39",my="_tooltipArrow_1xf6c_59",py=({historyUIConfig:t,show:i=!1,onOpenHistory:r,className:n=""})=>{const{enabled:a,buttonSize:o,buttonColor:l,tooltipText:d,tooltipTextSize:h,tooltipTextColor:c,tooltipBackgroundColor:u,tooltipTimeout:f}=t,[g,m]=e.useState(!1),p=e.useRef(null);e.useEffect(()=>{i&&a?(m(!0),p.current&&clearTimeout(p.current),p.current=window.setTimeout(()=>{m(!1),p.current=null},f)):(m(!1),p.current&&(clearTimeout(p.current),p.current=null))},[i,a,f]),e.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);if(!a||!i)return null;const A=.6*o;return s.jsxs("button",{className:`${fy} ${n}`.trim(),onClick:()=>{r&&r()},"aria-label":"Open history",style:{width:`${o}px`,height:`${o}px`,backgroundColor:l},children:[s.jsx("img",{src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='33'%20height='32'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cmask%20id='A'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='33'%20height='32'%20mask-type='alpha'%3e%3cpath%20fill='%23d9d9d9'%20d='M.5%200h32v32H.5z'/%3e%3c/mask%3e%3cg%20mask='url(%23A)'%3e%3cpath%20d='M16.5%2018.001l8-5.333-8-5.333v10.667zM8.1%2029.168a2.5%202.5%200%200%201-1.983-.517A2.56%202.56%200%200%201%205.1%2026.868L3.334%2012.301c-.089-.733.089-1.389.533-1.967s1.033-.911%201.767-1l1.533-.2v10.867c0%201.467.522%202.722%201.567%203.767s2.3%201.567%203.767%201.567h12.4c-.133.533-.4.995-.8%201.383s-.889.617-1.467.683L8.1%2029.168zm4.4-6.5c-.733%200-1.361-.261-1.883-.783s-.783-1.15-.783-1.883V5.335c0-.733.261-1.361.783-1.883s1.15-.783%201.883-.783h14.667c.733%200%201.361.261%201.883.783s.783%201.15.783%201.883v14.667c0%20.733-.261%201.361-.783%201.883s-1.15.783-1.883.783H12.5z'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e",alt:"History",style:{width:`${A}px`,height:`${A}px`}}),g&&d&&s.jsxs("span",{className:gy,style:{fontSize:`${h}px`,backgroundColor:u,color:c},children:[(d??"").replace(/<br>/g,"\n"),s.jsx("span",{className:my,style:{backgroundColor:u}})]})]})},Ay="_drawerOverlay_1eftt_2",vy="_drawerOverlayScoped_1eftt_16",yy="_drawerOverlayVisible_1eftt_24",Ey="_drawer_1eftt_2",Ty="_drawerScoped_1eftt_48",Sy="_drawerOpen_1eftt_55",by="_drawerHandle_1eftt_60",Iy="_drawerContent_1eftt_202",Ly="_drawerCloseButton_1eftt_210",Ry="_drawerCloseIcon_1eftt_255",ky=({isOpen:t,onClose:i,height:r="50%",maxHeight:n,showHandle:a=!0,showCloseButton:o=!0,className:l="",closeButtonText:d="Close",handleEscKey:h=!0,lockBodyScroll:c=!0,scoped:u=!1,children:f})=>{const g=e.useRef(null),m=e.useRef(null),[p,A]=e.useState(!1);e.useEffect(()=>{t?requestAnimationFrame(()=>{A(!0)}):A(!1)},[t]);const v=t=>{if(!t||t===document.body)return null;const e=t.parentElement;if(!e)return null;const i=window.getComputedStyle(e);return"auto"===i.overflow||"scroll"===i.overflow||"auto"===i.overflowY||"scroll"===i.overflowY||e.scrollHeight>e.clientHeight?e:v(e)};e.useEffect(()=>{if(!c||u)return;const e=e=>{"Escape"===e.key&&t&&i()};if(t){document.addEventListener("keydown",e);const t=(g.current?v(g.current):null)||document.body,i=(()=>{var t;const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",e.style.msOverflowStyle="scrollbar",document.body.appendChild(e);const i=document.createElement("div");e.appendChild(i);const s=e.offsetWidth-i.offsetWidth;return null==(t=e.parentNode)||t.removeChild(e),s})(),s=window.getComputedStyle(t).paddingRight,r=parseInt(s,10)||0,n=t.style.overflow,a=t.style.paddingRight;return t.style.overflow="hidden",t===document.body&&(t.style.paddingRight=`${r+i}px`),()=>{document.removeEventListener("keydown",e),t.style.overflow=n,t.style.paddingRight=a}}return()=>{document.removeEventListener("keydown",e)}},[t,i,c]);const y={height:r,...n&&{maxHeight:n}},E=`${Ey} ${u?Ty:""} ${l} ${p?Sy:""}`.trim(),T=`${Ay} ${u?vy:""} ${p?yy:""}`.trim();return t?s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:m,className:T,onClick:t=>{t.target===m.current&&i()},"aria-hidden":!1}),s.jsxs("div",{ref:g,className:E,style:y,"aria-hidden":!1,role:"dialog","aria-modal":"true",onKeyDown:t=>{h&&"Escape"===t.key&&i()},tabIndex:-1,children:[a&&s.jsx("div",{className:by}),s.jsx("div",{className:Iy,children:f}),o&&s.jsxs("button",{className:Ly,onClick:i,"aria-label":"Close drawer",children:[s.jsx("img",{src:"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20xmlns:v='https://vecta.io/nano'%3e%3cmask%20id='A'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='24'%20height='24'%20mask-type='alpha'%3e%3cpath%20fill='%23d9d9d9'%20d='M0%200h24v24H0z'/%3e%3c/mask%3e%3cg%20mask='url(%23A)'%3e%3cpath%20d='M6.4%2019L5%2017.6L10.6%2012L5%206.4L6.4%205L12%2010.6L17.6%205L19%206.4L13.4%2012L19%2017.6L17.6%2019L12%2013.4L6.4%2019Z'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e",alt:"Close",className:Ry}),d]})]})]}):null},wy="_cardListContainer_zrmnf_2",Dy="_summaryGridContainer_zrmnf_17",Cy="_summaryGridItem_zrmnf_26",xy="_summaryGridItemClickable_zrmnf_34",Py="_gridPlaceholder_zrmnf_39",My="_gridItemImage_zrmnf_51",Oy="_summaryCardItem_zrmnf_58",By="_summaryCardItemClickable_zrmnf_70",Fy="_cardItemImage_zrmnf_75",Ny="_cardItemPlaceholder_zrmnf_84",_y="_cardItemContent_zrmnf_98",Uy="_cardItemTitle_zrmnf_107",Hy="_cardItemPrice_zrmnf_116",jy=({cards:t,clickable:e=!1,padding:i="20px",layout:r="list",onCardClick:n,cardItemBackgroundColor:a,cardItemTextColor:o})=>{const l=(t,e,i)=>{n&&n(t,e,i)},d=a||"#F2F2F2",h=o||"#181818";return"grid"===r?s.jsx("div",{className:Dy,children:t.map((t,i)=>{const r="card"in t?t.card:t;if(!r)return null;const n="image"===r.type?r.imageUrl:r.summaryImage??r.videoThumbnail;return s.jsx("div",{className:`${Cy} ${e?xy:""}`,"data-card-id":r.id||"","data-card-url":r.url||"","data-card-position":r.position||"",onClick:e?()=>l(r.id,r.url,r.position):void 0,children:n?s.jsx("img",{src:n,className:My,alt:"Card image"}):s.jsx("div",{className:Py,style:{background:d,color:h},children:"No image"})},r.id||i)})}):s.jsx("div",{className:wy,style:{padding:"0"===i?"0":i},children:t.map((t,i)=>{const r="card"in t?t.card:t;if(!r)return null;const n="image"===r.type?r.imageUrl:r.summaryImage??r.videoThumbnail;return s.jsxs("div",{className:`${Oy} ${e?By:""}`,style:{background:d,color:h},"data-card-id":r.id||"","data-card-url":r.url||"","data-card-position":r.position||"",onClick:e?()=>l(r.id,r.url,r.position):void 0,children:[n?s.jsx("img",{src:n,className:Fy,alt:"Card image"}):s.jsx("div",{className:Ny,children:"No image"}),s.jsxs("div",{className:_y,children:[s.jsx("h4",{className:Uy,children:r.title||"Untitled"}),r.price&&s.jsxs("p",{className:Hy,children:[r.price," ",r.currency||""]})]})]},r.id||i)})})},Vy={summaryContainer:"_summaryContainer_1gtok_3",summaryShareButtonFixed:"_summaryShareButtonFixed_1gtok_14",shareIcon:"_shareIcon_1gtok_47",summaryExplaination:"_summaryExplaination_1gtok_54",summaryTabs:"_summaryTabs_1gtok_71",summaryTab:"_summaryTab_1gtok_71",summaryTabActive:"_summaryTabActive_1gtok_91",summaryEmojiItem:"_summaryEmojiItem_1gtok_96",summaryEmojiItemActive:"_summaryEmojiItemActive_1gtok_103",summaryEmojiButton:"_summaryEmojiButton_1gtok_108",summaryEmojiButtonActive:"_summaryEmojiButtonActive_1gtok_124",summaryEmojiLike:"_summaryEmojiLike_1gtok_132",summaryEmojiLikeActive:"_summaryEmojiLikeActive_1gtok_136",summaryEmojiDislike:"_summaryEmojiDislike_1gtok_142",summaryEmojiDislikeActive:"_summaryEmojiDislikeActive_1gtok_146",summaryEmojiMaybe:"_summaryEmojiMaybe_1gtok_152",summaryEmojiMaybeActive:"_summaryEmojiMaybeActive_1gtok_156",summaryEmojiSeen:"_summaryEmojiSeen_1gtok_162",summaryEmojiSeenActive:"_summaryEmojiSeenActive_1gtok_166",summaryEmojiIcon:"_summaryEmojiIcon_1gtok_194",summaryEmojiLabel:"_summaryEmojiLabel_1gtok_201",summaryContent:"_summaryContent_1gtok_217",summaryPanel:"_summaryPanel_1gtok_226",summaryPanelActive:"_summaryPanelActive_1gtok_241",summaryEmptyState:"_summaryEmptyState_1gtok_246",summaryEmptyStateText:"_summaryEmptyStateText_1gtok_252",summaryExplainationRight:"_summaryExplainationRight_1gtok_259",summaryExplainationLeft:"_summaryExplainationLeft_1gtok_263",summaryExplainationUp:"_summaryExplainationUp_1gtok_267",summaryExplainationDown:"_summaryExplainationDown_1gtok_271"},Gy=({cardsByDirection:t,navigationUIConfig:i,summaryUIConfig:r,onCardClick:n,onShareClick:a,visible:o=!0,className:l=""})=>{const d=i.options,{endCardType:h="list",explanationTexts:c={},tabsBackgroundColor:u="#f5f5f5",tabsBorderColor:f="#e0e0e0",cardItemBackgroundColor:g="#F2F2F2",cardItemTextColor:m="#181818",contentBackgroundColor:p="#ffffff",explanationVisible:A=!1}=r,[v,y]=e.useState(null),E={right:Wv,left:Yv,up:$v,down:zv},T=(t,e)=>`${Vy.summaryEmojiButton} ${Vy[`summaryEmoji${t.charAt(0).toUpperCase()+t.slice(1)}`]||""} ${e?Vy.summaryEmojiButtonActive:""} ${e&&Vy[`summaryEmoji${t.charAt(0).toUpperCase()+t.slice(1)}Active`]||""}`.trim(),S=e.useMemo(()=>[{key:"right",config:d.right},{key:"up",config:d.up},{key:"down",config:d.down},{key:"left",config:d.left}].filter(t=>t.config.enabled),[d]);e.useEffect(()=>{S.length>0&&null===v&&y(S[0].key)},[S]);const b=(t,e,i)=>{n&&n(t,e,i)};if(!o||0===S.length)return null;const I=100/S.length;return s.jsxs("div",{className:`${Vy.summaryContainer} ${l}`.trim(),children:[s.jsx("div",{className:Vy.summaryTabs,style:{backgroundColor:u,borderBottom:`1px solid ${f}`},children:S.map(t=>{const e=v===t.key,i={right:"like",left:"dislike",up:"maybe",down:"seen"}[t.key];return s.jsx("div",{className:`${Vy.summaryTab} ${e?Vy.summaryTabActive:""}`,style:{width:`${I}%`,boxSizing:"border-box"},onClick:()=>y(t.key),children:s.jsxs("div",{className:`${Vy.summaryEmojiItem} ${e?Vy.summaryEmojiItemActive:""}`,children:[s.jsx("div",{className:T(i,e),children:s.jsx("img",{src:E[t.key],alt:t.config.label,className:Vy.summaryEmojiIcon})}),s.jsx("span",{className:Vy.summaryEmojiLabel,children:t.config.label})]})},t.key)})}),s.jsx("div",{className:Vy.summaryContent,style:{backgroundColor:p},children:S.map(e=>{const i=v===e.key,r=(n=e.key,t[n]||[]);var n;const a=(t=>{var e;return(null==(e=c[t])?void 0:e.replace(/\\A/g,"\n"))||""})(e.key);return s.jsx("div",{className:`${Vy.summaryPanel} ${i?Vy.summaryPanelActive:""}`,"data-panel":e.key,children:0===r.length?s.jsx("div",{className:Vy.summaryEmptyState,style:{color:m},children:s.jsx("h3",{className:Vy.summaryEmptyStateText,children:"No cards"})}):s.jsxs(s.Fragment,{children:[a&&s.jsx("div",{className:`${Vy.summaryExplaination} ${Vy[`summaryExplaination${e.key.charAt(0).toUpperCase()+e.key.slice(1)}`]||""}`,style:{display:A?"flex":"none",background:g,color:m},children:a}),s.jsx(jy,{cards:r,clickable:!0,padding:"20px",layout:h,onCardClick:b,cardItemBackgroundColor:g,cardItemTextColor:m})]})},e.key)})}),a&&s.jsx("button",{className:Vy.summaryShareButtonFixed,onClick:()=>{if(!a)return;const e=t.right.map(t=>t.id).filter(t=>null!=t&&""!==t),i=t.up.map(t=>t.id).filter(t=>null!=t&&""!==t);a(e,i)},"aria-label":"Share",children:"share"})]})},Qy="_historyDrawerContent_x0jj6_1",Ky="_historyDrawerEmpty_x0jj6_15",qy="_historyDrawerEmptyHint_x0jj6_31",Wy="_historyDrawer_x0jj6_1",Yy=({isOpen:t,onClose:i,swipeHistory:r,getCardsByDirection:n,historyUIConfig:a,navigationUIConfig:o,summaryUIConfig:l,onCardClick:d,className:h="",scoped:c=!1})=>{const{drawerHeight:u,drawerMaxHeight:f,drawerCloseButtonText:g}=a,m=e.useMemo(()=>({right:n("right"),left:n("left"),up:n("up"),down:n("down")}),[n,r]),p=r.length>0;return s.jsx(ky,{isOpen:t,onClose:i,height:`${u}%`,maxHeight:`${f}%`,showHandle:!0,showCloseButton:!0,closeButtonText:g,scoped:c,className:`${Wy} ${h}`.trim(),children:s.jsx("div",{className:Qy,children:p?s.jsx(Gy,{cardsByDirection:m,navigationUIConfig:o,summaryUIConfig:l,onCardClick:d,visible:!0}):s.jsxs("div",{className:Ky,children:[s.jsx("p",{children:"No swipe history yet"}),s.jsx("p",{className:qy,children:"Swipe some cards to see them here"})]})})})},$y="_filtersButton_qio2f_1",zy="_filtersIcon_qio2f_63",Xy=({filtersUIConfig:t,onClick:e,className:i=""})=>{const{enabled:r,buttonText:n,buttonColor:a,iconSize:o,textColor:l,showIcon:d}=t;if(!r)return null;const h={gap:d&&n?"8px":"0",background:a,color:l},c={width:`${o}px`,height:`${o}px`,color:l};return s.jsxs("button",{className:`${$y} ${i}`.trim(),style:h,onClick:()=>{e&&e()},onFocus:t=>t.currentTarget.blur(),"aria-label":"Open filters",children:[d&&s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:l,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:zy,style:c,"aria-hidden":"true",children:s.jsx("polygon",{points:"22,3 2,3 10,12.46 10,19 14,21 14,12.46"})}),n&&s.jsx("span",{children:n})]})},Zy="_content_hci8k_2",Jy="_title_hci8k_7",tE="_categories_hci8k_17",eE="_pill_hci8k_25",iE="_noCategories_hci8k_40",sE=({isOpen:t,onClose:i,filtersUIConfig:r,categories:n=[],selectedCategories:a=[],onFilterChange:o,scoped:l=!1,className:d=""})=>{const{drawerCategoriesTitle:h,drawerCloseButtonText:c}=r,u=new Set(a),[f,g]=e.useState(null),m=t=>{const e=new Set(a);"all"===t?e.clear():e.has(t)?e.delete(t):e.add(t),o&&o(Array.from(e))},p=(t,e)=>{const i=f===t,s="all"===t&&0===u.size;return{background:e||s?"#007bff":i?"#e9ecef":"#f5f5f5",color:e||s?"white":"#666",border:"2px solid "+(e||s?"#0056b3":"transparent"),transform:i?"translateY(-1px)":"none"}};return s.jsx(ky,{isOpen:t,onClose:i,height:"auto",maxHeight:"70%",className:d,showHandle:!0,showCloseButton:!0,closeButtonText:c,scoped:l,children:s.jsxs("div",{className:Zy,children:[s.jsx("h3",{className:Jy,children:h}),s.jsx("div",{className:tE,children:0===n.length?s.jsx("div",{className:iE,children:"No categories available"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:eE,style:p("all",0===u.size),onMouseEnter:()=>g("all"),onMouseLeave:()=>g(null),onClick:()=>m("all"),children:"All"}),n.map(t=>s.jsx("div",{className:eE,style:p(t.id,u.has(t.id)),onMouseEnter:()=>g(t.id),onMouseLeave:()=>g(null),onClick:()=>m(t.id),children:t.name},t.id))]})})]})})},rE="_cardsCounter_1h26d_1",nE=({cardsCounterUIConfig:t,currentCardIndex:e,totalCards:i,className:r=""})=>{const{enabled:n,text:a,textSize:o}=t;if(!n)return null;const l=Math.min(e+1,i);let d;return d=t.text.includes("{current}")||t.text.includes("{total}")?a.replace(/{current}/g,l.toString()).replace(/{total}/g,i.toString()):`${a} ${l} / ${i}`,s.jsx("div",{className:`${rE} ${r}`.trim(),style:{fontSize:o},children:d})},aE="_logo_1rzq2_1",oE=({logoUIConfig:t,visible:e,className:i=""})=>{const{enabled:r,url:n,size:a}=t;if(!r||!n||!e)return null;const o={...void 0!==a&&{width:`${a}px`}};return s.jsx("img",{src:n,alt:"Logo",className:`${aE} ${i}`.trim(),style:o})},lE="_container_18bki_1",dE=({children:t,x:e,y:i,centered:r=!1,zIndex:n,className:a=""})=>{const o={...void 0!==e&&{left:"number"==typeof e?`${e}px`:e},...void 0!==i&&{top:"number"==typeof i?`${i}px`:i},...r&&{transform:"translate(-50%, -50%)"},...void 0!==n&&{zIndex:n}};return s.jsx("div",{className:`${lE} ${a}`.trim(),style:o,children:t})},hE=e.createContext(void 0),cE=({children:t,dataService:i,finderId:r,backendUrl:n,data:a,initialCards:o=[],initialFinder:l=null,initialCategories:d=[]})=>{const h=e.useRef(!1),[c,u]=e.useState(()=>a?i.processApiResponse(a).cards:o),[f,g]=e.useState(()=>a?i.processApiResponse(a).finder:l),[m,p]=e.useState(()=>a?i.processApiResponse(a).categories:d),[A,v]=e.useState(!1),[y,E]=e.useState(null);e.useEffect(()=>{if(a){const t=i.processApiResponse(a);g(t.finder),u(t.cards),p(t.categories),v(!1),E(null),h.current=!0}},[a,i]);const T=e.useCallback(async()=>{if(r&&n){v(!0),E(null);try{const t=await i.loadFinderFromApi(r,n);g(t.finder),u(t.cards),p(t.categories)}catch(PE){const e=PE instanceof Error?PE.message:"Failed to load finder";E(e)}finally{v(!1),h.current=!0}}else E("finderId and backendUrl are required to load finder")},[i,r,n]);e.useEffect(()=>{a||T()},[T,a]);const S={cards:c,finder:f,categories:m,loading:A,error:y,isInitiallyLoaded:h.current,setCards:u,setFinder:g,setCategories:p,loadFinder:T};return s.jsx(hE.Provider,{value:S,children:t})},uE=()=>{const t=e.useContext(hE);if(void 0===t)throw new Error("useData must be used within a DataProvider");return t},fE=e.createContext(void 0),gE=({children:t})=>{const{finder:i,isInitiallyLoaded:r}=uE(),[n,a]=e.useState(0),[o,l]=e.useState([]),[d,h]=e.useState(!1),[c,u]=e.useState(!0),[f,g]=e.useState(!1),[m,p]=e.useState(!1),[A,v]=e.useState(!0),[y,E]=e.useState(.5),[T,S]=e.useState(!0),[b,I]=e.useState([]),[L,R]=e.useState([]),[k,w]=e.useState([]);e.useEffect(()=>{r&&i&&E(i.initialVolume)},[r,i]);const D=e.useCallback((t,e)=>{l(i=>{const s=i.findIndex(t=>t.card.id&&e.id&&t.card.id===e.id);return[...-1!==s?i.filter((t,e)=>e!==s):i,{direction:t,card:e,timestamp:Date.now()}]})},[]),C=e.useCallback(()=>{l([])},[]),x=e.useCallback(t=>o.filter(e=>e.direction===t).map(t=>t.card),[o]),P=e.useCallback(()=>{v(t=>!t)},[]),M=e.useCallback(t=>{E(t)},[]),O=e.useCallback(t=>{setTimeout(()=>{S(!0)},t)},[]),B=e.useCallback(t=>{I(t),R(t),w([])},[]);e.useEffect(()=>{let t;t=0===k.length?[...b]:b.filter(t=>t.categoryIds&&t.categoryIds.some(t=>k.includes(t))),R(t),b.length>0&&a(0)},[k,b]);const F={currentCardIndex:n,swipeHistory:o,isAnimating:d,demoActive:c,noMoreCards:f,userHasInteracted:m,isMuted:A,volume:y,logoVisible:T,allCards:b,filteredCards:L,selectedCategories:k,setCurrentCardIndex:a,addSwipeToHistory:D,clearSwipeHistory:C,setIsAnimating:h,setDemoActive:u,setNoMoreCards:g,setUserHasInteracted:p,getCardsByDirection:x,setIsMuted:v,setVolume:M,toggleMute:P,showLogo:O,setCards:B,setSelectedCategories:w};return s.jsx(fE.Provider,{value:F,children:t})},mE=()=>{const t=e.useContext(fE);if(void 0===t)throw new Error("useAppState must be used within an AppStateProvider");return t},pE=e.createContext(void 0),AE=({children:t,monitorService:i,finderId:r})=>{const[n]=e.useState(()=>crypto.randomUUID()),a=e.useRef({}),[o,l]=e.useState(!1),d=e.useRef([]),h=e.useCallback(()=>{const t=[...d.current];d.current=[],t.forEach(t=>{i.sendEvent({sessionId:n,finderId:r,event:t.event,cardId:t.cardId,cardViewDuration:t.cardViewDuration,direction:t.direction})})},[i,n,r]),c=e.useCallback(()=>{!o&&d.current.length>0&&h(),l(!0)},[o,h]),u=e.useCallback(t=>{o?i.sendEvent({sessionId:n,finderId:r,event:t.event,cardId:t.cardId,cardViewDuration:t.cardViewDuration,direction:t.direction}):d.current.push({...t,finderId:r,timestamp:Date.now()})},[i,n,o]),f=e.useCallback(()=>{r&&u({event:"impression"})},[r,u]),g=e.useCallback(t=>{r&&(a.current[t]=Date.now(),u({event:"impression",cardId:t}))},[r,u]),m=e.useCallback(t=>{a.current[t]=Date.now()},[]),p=e.useCallback((t,e)=>{if(r){let i=0;a.current[t]&&(i=(Date.now()-a.current[t])/1e3,delete a.current[t]),u({event:"swipe",cardId:t,direction:e,cardViewDuration:Math.round(i)})}},[r,u]),A=e.useCallback(t=>{r&&u({event:"click",cardId:t})},[r,u]),v=e.useCallback(()=>{r&&u({event:"click"})},[r,u]),y=e.useMemo(()=>({sessionId:n,sendImpressionEvent:g,sendSwipeEvent:p,sendClickEvent:A,sendButtonClickEvent:v,sendCreativeImpressionEvent:f,startCardImpression:m,setConsentGranted:c}),[n,g,p,A,v,f,m,c]);return s.jsx(pE.Provider,{value:y,children:t})},vE="_interactiveFeed_1wsuw_1",yE=({cards:t,categories:i=[],finderUiConfig:r,buttonStyle:n="vertical-emojis",maxVisibleCards:a=2,volumeControlUIConfig:o,historyUIConfig:l,onOpenHistory:d,onHistoryCardClick:h,filtersUIConfig:c,onFilterChange:u,onAllCardsSwiped:f,onCardSwiped:g,initialMuted:m=!0,cardsCounterUIConfig:p,navigationUIConfig:A,summaryUIConfig:v,logoUIConfig:y,className:E="",id:T})=>{const{currentCardIndex:S,setCurrentCardIndex:b,swipeHistory:I,getCardsByDirection:L,isMuted:R,volume:k,toggleMute:w,setVolume:D,showLogo:C,logoVisible:x,filteredCards:P,selectedCategories:M,setCards:O,setSelectedCategories:B,addSwipeToHistory:F,setIsAnimating:N,isAnimating:_,setNoMoreCards:U}=mE(),{sendSwipeEvent:H,sendImpressionEvent:j,startCardImpression:V}=(()=>{const t=e.useContext(pE);if(void 0===t)throw new Error("useMonitoring must be used within a MonitoringProvider");return t})();e.useEffect(()=>{(null==y?void 0:y.url)&&y.autoHideTimeout>0&&C(y.autoHideTimeout)},[y,C]),e.useEffect(()=>{O(t)},[t,O]);const[G,Q]=e.useState(!1),[K,q]=e.useState(!1),W=e.useCallback(t=>{B(t),u&&u(t)},[B,u]),Y=e.useMemo(()=>S>0,[S]),$=e.useMemo(()=>i,[i]),z=e.useCallback(()=>{Q(!0),d&&d()},[d]),X=e.useCallback(()=>{Q(!1)},[]),Z=e.useCallback(()=>{q(!0)},[]),J=e.useCallback(()=>{q(!1)},[]);return s.jsxs("div",{className:vE,children:[s.jsx(ey,{cards:P,finderUiConfig:r,buttonStyle:n,maxVisibleCards:a,isMuted:R,volume:k,currentCardIndex:S,setCurrentCardIndex:b,addSwipeToHistory:F,setIsAnimating:N,isAnimating:_,setNoMoreCards:U,sendSwipeEvent:H,sendImpressionEvent:j,startCardImpression:V,onAllCardsSwiped:f,onCardSwiped:g,id:T}),o.enabled&&s.jsx(uy,{volumeControlUIConfig:o,isMuted:R,volume:k,onToggleMute:w,onVolumeChange:D}),l.enabled&&s.jsx(dE,{x:`${l.buttonLeftPosition}%`,y:100-l.buttonBottomPosition+"%",centered:!0,zIndex:1e3,children:s.jsx(py,{historyUIConfig:l,show:Y,onOpenHistory:z})}),c.enabled&&s.jsx(dE,{x:`${c.buttonLeftPosition}%`,y:100-c.buttonBottomPosition+"%",centered:50===c.buttonLeftPosition,zIndex:1e3,children:s.jsx(Xy,{filtersUIConfig:c,onClick:Z})}),c.enabled&&s.jsx(sE,{isOpen:K,onClose:J,filtersUIConfig:c,categories:$,selectedCategories:M,onFilterChange:W,scoped:!0}),l.enabled&&s.jsx(Yy,{isOpen:G,onClose:X,swipeHistory:I,getCardsByDirection:L,historyUIConfig:l,navigationUIConfig:A,summaryUIConfig:v,onCardClick:h,scoped:!0}),p.enabled&&s.jsx(dE,{x:`${p.positionLeft}%`,y:100-p.positionBottom+"%",zIndex:100,children:s.jsx(nE,{cardsCounterUIConfig:p,currentCardIndex:S,totalCards:P.length})}),y.enabled&&s.jsx(dE,{x:`${y.positionX}%`,y:`${y.positionY}%`,centered:!0,zIndex:100,children:s.jsx(oE,{logoUIConfig:y,visible:x})})]})},EE="_swippingJourney_15509_1",TE=({summaryEnabled:t=!0,finderUiConfig:i,onSummaryCardClick:r,onSummaryShareClick:n,onAllCardsSwiped:a})=>{const{cards:o,finder:l,categories:d}=uE(),{noMoreCards:h,getCardsByDirection:c,swipeHistory:u}=mE(),[f,g]=e.useState(!1),m=i??l,p=e.useCallback(()=>{a&&a(),t&&g(!0)},[a,t]);e.useEffect(()=>{g(!(!h||!t))},[h,t]);const A=e.useMemo(()=>({right:c("right"),left:c("left"),up:c("up"),down:c("down")}),[c,u]);return m?f&&t?s.jsx("div",{className:EE,children:s.jsx(Gy,{cardsByDirection:A,navigationUIConfig:m.navigation,summaryUIConfig:m.summary,onCardClick:r,onShareClick:n,visible:!0})}):s.jsx("div",{className:EE,children:s.jsx(yE,{cards:o,finderUiConfig:m,categories:d,historyUIConfig:m.history,filtersUIConfig:m.filters,volumeControlUIConfig:m.volumeControl,cardsCounterUIConfig:m.cardsCounter,navigationUIConfig:m.navigation,summaryUIConfig:m.summary,logoUIConfig:m.logo,onAllCardsSwiped:p})}):null},SE="_mainBootstrap_1rzog_1";var bE,IE={exports:{}};bE=IE,function(){var t={}.hasOwnProperty;function e(){for(var t="",e=0;e<arguments.length;e++){var r=arguments[e];r&&(t=s(t,i(r)))}return t}function i(i){if("string"==typeof i||"number"==typeof i)return i;if("object"!=typeof i)return"";if(Array.isArray(i))return e.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var r="";for(var n in i)t.call(i,n)&&i[n]&&(r=s(r,n));return r}function s(t,e){return e?t?t+" "+e:t+e:t}bE.exports?(e.default=e,bE.exports=e):window.classNames=e}();const LE=M(IE.exports),RE=e.createContext(void 0),kE=({children:t})=>{const[i,r]=e.useState(!1),[n,a]=e.useState(!1),[o,l]=e.useState(!1),[d,h]=e.useState([]),[c,u]=e.useState(!0),f={buttonsVisible:i,summaryVisible:n,ctaTooltipVisible:o,selectedCategories:d,logoVisible:c,showButtons:e.useCallback(()=>{r(!0)},[]),hideButtons:e.useCallback(()=>{r(!1)},[]),showSummary:e.useCallback(()=>{a(!0)},[]),hideSummary:e.useCallback(()=>{a(!1)},[]),showCtaTooltip:e.useCallback(()=>{l(!0)},[]),hideCtaTooltip:e.useCallback(()=>{l(!1)},[]),setSelectedCategories:h,toggleLogo:e.useCallback(t=>{u(t)},[])};return s.jsx(RE.Provider,{value:f,children:t})},wE=({children:t,monitorService:e,dataService:i,backendUrl:r,finderId:n,data:a})=>s.jsx(cE,{dataService:i,finderId:n,backendUrl:r,data:a,children:s.jsx(gE,{children:s.jsx(kE,{children:s.jsx(AE,{monitorService:e,finderId:n,children:t})})})}),DE=({monitorService:t,dataService:e,backendUrl:i,finderId:r,className:n="",data:a})=>s.jsx("div",{className:LE(SE,n),children:s.jsx(wE,{monitorService:t,dataService:e,backendUrl:i,finderId:r,data:a,children:s.jsx(TE,{})})});class CE{getMonitorUrl(){if("undefined"==typeof window)throw new Error("window is not available");if(!window.SWIPEFINDER_CAMPAIGN_MONITOR_URL)throw new Error("SWIPEFINDER_CAMPAIGN_MONITOR_URL is not set");return window.SWIPEFINDER_CAMPAIGN_MONITOR_URL}sendEvent(t){try{const e=this.getMonitorUrl();fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({finder_id:t.finderId,event_type:t.event,session_id:t.sessionId,card_id:t.cardId,card_view_duration:t.cardViewDuration,swipe_direction:t.direction})}).catch(t=>{})}catch(e){}}}class xE{processApiResponse(t){return{finder:t.finder,cards:(e=t.cards.items,e.map(t=>{if("image"===t.type){const{image:e,...i}=t;return{...i,imageUrl:e||t.imageUrl||""}}if("video"===t.type){const{video:e,...i}=t;return{...i,videoUrl:e||t.videoUrl||""}}return t})),categories:t.categories};var e}async loadFinderFromApi(t,e){try{const i=`${e}/api/finders/${t}/queue`,s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({categories:[],exclude:[]})});if(!s.ok)throw new Error(`API returned status: ${s.status}`);const r=await s.json();return this.processApiResponse(r)}catch(i){return{finder:null,cards:[],categories:[]}}}}t.initSwipeFinder=function(t){const{backendUrl:i,finderId:s,element:r,data:n,...a}=t;if(!(r&&r instanceof HTMLElement))throw new Error("Invalid element provided. Must be an HTMLElement.");const o=new CE,l=new xE,d=I(r);return d.render(e.createElement(DE,{monitorService:o,dataService:l,backendUrl:i,finderId:s,data:n,...a})),()=>{d.unmount()}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});