notes/.config/chromium/Default/Extensions/mnjggcdmjocbbbhaepdhchncahnbgone/4.1.6_0/js/content.js

1 line
No EOL
106 KiB
JavaScript

(()=>{"use strict";var e,t={240:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,s){function r(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=n(294),s=n(913),r=n(94),a=n(215),c=n(523),l=n(854),d=n(829),u=n(709);class p extends i.Component{constructor(e){super(e),this.state={segment:null,show:!1,open:!1}}render(){var e;const t={backgroundColor:this.getColor(),display:this.state.show?"flex":"none",color:this.getTextColor()};return i.createElement("span",{style:t,className:"sponsorBlockCategoryPill","aria-label":this.getTitleText(),onClick:e=>this.toggleOpen(e),onMouseEnter:()=>this.openTooltip(),onMouseLeave:()=>this.closeTooltip()},i.createElement("span",{className:"sponsorBlockCategoryPillTitleSection"},i.createElement("img",{className:"sponsorSkipLogo sponsorSkipObject",src:chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}),i.createElement("span",{className:"sponsorBlockCategoryPillTitle"},chrome.i18n.getMessage("category_"+(null===(e=this.state.segment)||void 0===e?void 0:e.category)))),this.state.open&&i.createElement(i.Fragment,null,i.createElement("div",{id:"sponsorTimesDownvoteButtonsContainerUpvoteCategoryPill",className:"voteButton",style:{marginLeft:"5px"},title:chrome.i18n.getMessage("upvoteButtonInfo"),onClick:e=>this.vote(e,1)},i.createElement(r.default,{fill:s.default.config.colorPalette.white})),i.createElement("div",{id:"sponsorTimesDownvoteButtonsContainerDownvoteCategoryPill",className:"voteButton",title:chrome.i18n.getMessage("reportButtonInfo"),onClick:e=>this.vote(e,0)},i.createElement(a.default,{fill:(0,c.downvoteButtonColor)(null,null,c.SkipNoticeAction.Downvote)}))),i.createElement("img",{src:chrome.extension.getURL("icons/close.png"),className:"categoryPillClose",onClick:()=>this.setState({show:!1})}))}toggleOpen(e){e.stopPropagation(),this.state.show&&this.setState({open:!this.state.open})}vote(e,t){return o(this,void 0,void 0,(function*(){if(e.stopPropagation(),this.state.segment){const n=l.AnimationUtils.applyLoadingAnimation(e.currentTarget,.3),o=yield this.props.vote(t,this.state.segment.UUID);yield n(),1==o.successType||-1==o.successType&&429==o.statusCode?this.setState({open:!1,show:1===t}):403!==o.statusCode&&alert(d.GenericUtils.getErrorMessage(o.statusCode,o.responseText))}}))}getColor(){var e,t;const n=s.default.config.barTypes["preview-"+(null===(e=this.state.segment)||void 0===e?void 0:e.category)]||s.default.config.barTypes[null===(t=this.state.segment)||void 0===t?void 0:t.category];return null==n?void 0:n.color}getTextColor(){var e,t;const n=this.getColor();if(!n)return null;const o=s.default.config.categoryPillColors[null===(e=this.state.segment)||void 0===e?void 0:e.category];if(o&&o.lastColor===n)return o.textColor;{const e=d.GenericUtils.getLuminance(n)>128?"black":"white";return s.default.config.categoryPillColors[null===(t=this.state.segment)||void 0===t?void 0:t.category]={lastColor:n,textColor:e},e}}openTooltip(){const e=document.querySelector("ytd-video-primary-info-renderer > #container");e&&(this.tooltip=new u.Tooltip({text:this.getTitleText(),referenceNode:e,bottomOffset:"70px",opacity:.95,displayTriangle:!1,showLogo:!1,showGotIt:!1}))}closeTooltip(){var e;null===(e=this.tooltip)||void 0===e||e.close(),this.tooltip=null}getTitleText(){var e;const t=chrome.i18n.getMessage(`category_${null===(e=this.state.segment)||void 0===e?void 0:e.category}_pill`);return(t?t+". ":"")+chrome.i18n.getMessage("categoryPillTitleText")}}t.default=p},541:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(294),i=n(913);var s;!function(e){e[e.Timer=0]="Timer",e[e.Paused=1]="Paused",e[e.Stopped=2]="Stopped"}(s||(s={}));class r extends o.Component{constructor(e){var t;super(e);const n=()=>this.props.maxCountdownTime?this.props.maxCountdownTime():i.default.config.skipNoticeDuration;this.countdownInterval=null,this.amountOfPreviousNotices=e.amountOfPreviousNotices||0,this.idSuffix=e.idSuffix||"",this.state={noticeTitle:e.noticeTitle,maxCountdownTime:n,countdownTime:n(),countdownMode:s.Timer,mouseHovering:!1,startFaded:null!==(t=this.props.startFaded)&&void 0!==t&&t}}componentDidMount(){this.startCountdown()}render(){var e;const t=Object.assign({zIndex:this.props.zIndex||1e3+this.amountOfPreviousNotices},null!==(e=this.props.style)&&void 0!==e?e:{});return o.createElement("div",{id:"sponsorSkipNotice"+this.idSuffix,className:"sponsorSkipObject sponsorSkipNoticeParent"+(this.props.showInSecondSlot?" secondSkipNotice":""),onMouseEnter:e=>this.onMouseEnter(e),onMouseLeave:()=>this.timerMouseLeave(),style:t},o.createElement("div",{className:"sponsorSkipNoticeTableContainer"+(this.props.fadeIn?" sponsorSkipNoticeFadeIn":"")+(this.state.startFaded?" sponsorSkipNoticeFaded":"")},o.createElement("table",{className:"sponsorSkipObject sponsorSkipNotice"+(this.props.limitWidth?" sponsorSkipNoticeLimitWidth":"")},o.createElement("tbody",null,o.createElement("tr",{id:"sponsorSkipNoticeFirstRow"+this.idSuffix,className:"sponsorSkipNoticeFirstRow"},o.createElement("td",{className:"noticeLeftIcon"},o.createElement("img",{id:"sponsorSkipLogo"+this.idSuffix,className:"sponsorSkipLogo sponsorSkipObject",src:chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}),o.createElement("span",{id:"sponsorSkipMessage"+this.idSuffix,style:{float:"left"},className:"sponsorSkipMessage sponsorSkipObject"},this.state.noticeTitle),this.props.firstColumn),this.props.firstRow,o.createElement("td",{className:"sponsorSkipNoticeRightSection",style:{top:"9.32px"}},this.props.timed?o.createElement("span",{id:"sponsorSkipNoticeTimeLeft"+this.idSuffix,onClick:()=>this.toggleManualPause(),className:"sponsorSkipObject sponsorSkipNoticeTimeLeft"},this.getCountdownElements()):"",o.createElement("img",{src:chrome.extension.getURL("icons/close.png"),className:"sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeCloseButton sponsorSkipNoticeRightButton"+(this.props.biggerCloseButton?" biggerCloseButton":""),onClick:()=>this.close()}))),this.props.children,!this.props.smaller&&this.props.bottomRow?this.props.bottomRow:null))),this.props.smaller&&this.props.bottomRow?o.createElement("table",{style:{visibility:"hidden",paddingTop:"14px"}},o.createElement("tbody",null,this.props.bottomRow)):null)}getCountdownElements(){return[o.createElement("span",{id:"skipNoticeTimerText"+this.idSuffix,key:"skipNoticeTimerText",className:this.state.countdownMode!==s.Timer?"hidden":""},this.state.countdownTime+"s"),o.createElement("img",{id:"skipNoticeTimerPaused"+this.idSuffix,key:"skipNoticeTimerPaused",className:this.state.countdownMode!==s.Paused?"hidden":"",src:chrome.runtime.getURL("icons/pause.svg"),alt:chrome.i18n.getMessage("paused")}),o.createElement("img",{id:"skipNoticeTimerStopped"+this.idSuffix,key:"skipNoticeTimerStopped",className:this.state.countdownMode!==s.Stopped?"hidden":"",src:chrome.runtime.getURL("icons/stop.svg"),alt:chrome.i18n.getMessage("manualPaused")})]}onMouseEnter(e){this.props.onMouseEnter&&this.props.onMouseEnter(e),this.fadedMouseEnter(),this.timerMouseEnter()}fadedMouseEnter(){this.state.startFaded&&this.setState({startFaded:!1})}timerMouseEnter(){this.state.countdownMode!==s.Stopped&&(this.pauseCountdown(),this.setState({mouseHovering:!0}))}timerMouseLeave(){this.state.countdownMode!==s.Stopped&&(this.startCountdown(),this.setState({mouseHovering:!1}))}toggleManualPause(){this.setState({countdownMode:this.state.countdownMode===s.Stopped?s.Timer:s.Stopped},(()=>{this.state.countdownMode===s.Stopped||this.state.mouseHovering?this.pauseCountdown():this.startCountdown()}))}countdown(){if(!this.props.timed)return;const e=Math.min(this.state.countdownTime-1,this.state.maxCountdownTime());if(e<=0)return clearInterval(this.countdownInterval),void this.close();if(3==e){const e=document.getElementById("sponsorSkipNotice"+this.idSuffix);null==e||e.style.removeProperty("animation"),null==e||e.classList.add("sponsorSkipNoticeFadeOut")}this.setState({countdownTime:e})}removeFadeAnimation(){const e=document.getElementById("sponsorSkipNotice"+this.idSuffix);e.classList.remove("sponsorSkipNoticeFadeOut"),e.style.animation="none"}pauseCountdown(){this.props.timed&&(this.countdownInterval&&clearInterval(this.countdownInterval),this.countdownInterval=null,this.setState({countdownTime:this.state.maxCountdownTime(),countdownMode:this.state.countdownMode===s.Timer?s.Paused:this.state.countdownMode}),this.removeFadeAnimation())}startCountdown(){this.props.timed&&null===this.countdownInterval&&(this.setState({countdownTime:this.state.maxCountdownTime(),countdownMode:s.Timer}),this.setupInterval())}setupInterval(){this.countdownInterval&&clearInterval(this.countdownInterval),this.countdownInterval=setInterval(this.countdown.bind(this),1e3)}resetCountdown(){this.props.timed&&(this.setupInterval(),this.setState({countdownTime:this.state.maxCountdownTime(),countdownMode:s.Timer}),this.removeFadeAnimation())}close(e){null!==this.countdownInterval&&clearInterval(this.countdownInterval),e||this.props.closeListener()}changeNoticeTitle(e){this.setState({noticeTitle:e})}addNoticeInfoMessage(e,t=""){const n=document.getElementById("sponsorTimesInfoMessage"+this.idSuffix);null!=n&&document.getElementById("sponsorSkipNotice"+this.idSuffix).removeChild(n);const o=document.getElementById("sponsorTimesInfoMessage"+this.idSuffix+"2");null!=o&&document.getElementById("sponsorSkipNotice"+this.idSuffix).removeChild(o);const i=document.createElement("p");if(i.id="sponsorTimesInfoMessage"+this.idSuffix,i.className="sponsorTimesInfoMessage",i.innerText=e,document.querySelector("#sponsorSkipNotice"+this.idSuffix+" > tbody").insertBefore(i,document.getElementById("sponsorSkipNoticeSpacer"+this.idSuffix)),void 0!==t){const e=document.createElement("p");e.id="sponsorTimesInfoMessage"+this.idSuffix+"2",e.className="sponsorTimesInfoMessage",e.innerText=t,document.querySelector("#sponsorSkipNotice"+this.idSuffix+" > tbody").insertBefore(e,document.getElementById("sponsorSkipNoticeSpacer"+this.idSuffix))}}}t.default=r},751:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(294);class i extends o.Component{constructor(e){super(e)}render(){const e={};return this.props.onClick&&(e.cursor="pointer",e.textDecoration="underline"),o.createElement("p",{id:"sponsorTimesInfoMessage"+this.props.idSuffix,onClick:this.props.onClick,style:e,className:"sponsorTimesInfoMessage"},this.props.text)}}t.default=i},710:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(294),i=n(181),s=n(913),r=n(699),a=n(541),c=n(751),l=new(n(593).default),d=n(974),u=n(386),p=n(94),m=n(215),h=n(984),g=n(523);class f extends o.Component{constructor(e){var t,n;super(e),this.noticeRef=o.createRef(),this.categoryOptionRef=o.createRef(),this.segments=e.segments,this.autoSkip=e.autoSkip,this.contentContainer=e.contentContainer;const i=(0,d.getSkippingText)(this.segments,this.props.autoSkip),r=document.getElementsByClassName("sponsorSkipNoticeParent");this.amountOfPreviousNotices=r.length,this.showInSecondSlot=r.length>0&&[...r].some((e=>!e.classList.contains("secondSkipNotice"))),this.segments.length>1&&this.segments.sort(((e,t)=>e.segment[0]-t.segment[0]));for(const e of this.segments)this.idSuffix+=e.UUID;this.idSuffix+=this.amountOfPreviousNotices,this.selectedColor=s.default.config.colorPalette.red,this.unselectedColor=s.default.config.colorPalette.white,this.lockedColor=s.default.config.colorPalette.locked,this.state={noticeTitle:i,messages:[],messageOnClick:null,maxCountdownTime:()=>s.default.config.skipNoticeDuration,countdownTime:s.default.config.skipNoticeDuration,countdownText:null,skipButtonText:this.getUnskipText(),skipButtonCallback:e=>this.unskip(e),showSkipButton:!0,editing:!1,choosingCategory:!1,thanksForVotingText:null,actionState:g.SkipNoticeAction.None,showKeybindHint:null===(t=this.props.showKeybindHint)||void 0===t||t,smaller:null!==(n=this.props.smaller)&&void 0!==n&&n,voted:new Array(this.props.segments.length).fill(g.SkipNoticeAction.None),copied:new Array(this.props.segments.length).fill(g.SkipNoticeAction.None)},this.autoSkip||Object.assign(this.state,this.getUnskippedModeInfo(0,this.getSkipText()))}render(){const e={};this.contentContainer().onMobileYouTube&&(e.bottom="4em",e.transform="scale(0.8) translate(10%, 10%)");const t=this.props.smaller?this.getSkipButton():null;return o.createElement(a.default,{noticeTitle:this.state.noticeTitle,amountOfPreviousNotices:this.amountOfPreviousNotices,showInSecondSlot:this.showInSecondSlot,idSuffix:this.idSuffix,fadeIn:!0,startFaded:s.default.config.noticeVisibilityMode>=r.NoticeVisbilityMode.FadedForAll||s.default.config.noticeVisibilityMode>=r.NoticeVisbilityMode.FadedForAutoSkip&&this.autoSkip,timed:!0,maxCountdownTime:this.state.maxCountdownTime,style:e,biggerCloseButton:this.contentContainer().onMobileYouTube,ref:this.noticeRef,closeListener:()=>this.closeListener(),smaller:this.state.smaller,limitWidth:!0,firstColumn:t,bottomRow:[...this.getMessageBoxes(),...this.getBottomRow()],onMouseEnter:()=>this.onMouseEnter()})}getBottomRow(){return[o.createElement("tr",{id:"sponsorSkipNoticeSecondRow"+this.idSuffix,key:0},this.state.thanksForVotingText?o.createElement("td",{id:"sponsorTimesVoteButtonInfoMessage"+this.idSuffix,className:"sponsorTimesInfoMessage sponsorTimesVoteButtonMessage",style:{marginRight:"10px"}},o.createElement("span",{style:{marginRight:"10px"}},this.state.thanksForVotingText),o.createElement("button",{id:"sponsorTimesContinueVotingContainer"+this.idSuffix,className:"sponsorSkipObject sponsorSkipNoticeButton",title:"Continue Voting",onClick:()=>this.setState({thanksForVotingText:null,messages:[]})},chrome.i18n.getMessage("ContinueVoting"))):o.createElement("td",{id:"sponsorTimesVoteButtonsContainer"+this.idSuffix,className:"sponsorTimesVoteButtonsContainer"},o.createElement("div",{id:"sponsorTimesDownvoteButtonsContainerUpvote"+this.idSuffix,className:"voteButton",style:{marginRight:"5px"},title:chrome.i18n.getMessage("upvoteButtonInfo"),onClick:()=>this.prepAction(g.SkipNoticeAction.Upvote)},o.createElement(p.default,{fill:this.state.actionState===g.SkipNoticeAction.Upvote?this.selectedColor:this.unselectedColor})),o.createElement("div",{id:"sponsorTimesDownvoteButtonsContainerDownvote"+this.idSuffix,className:"voteButton",style:{marginRight:"5px",marginLeft:"5px"},title:chrome.i18n.getMessage("reportButtonInfo"),onClick:()=>this.prepAction(g.SkipNoticeAction.Downvote)},o.createElement(m.default,{fill:(0,g.downvoteButtonColor)(this.segments,this.state.actionState,g.SkipNoticeAction.Downvote)})),o.createElement("div",{id:"sponsorTimesDownvoteButtonsContainerCopyDownvote"+this.idSuffix,className:"voteButton",style:{marginLeft:"5px"},onClick:()=>this.openEditingOptions()},o.createElement(h.default,{fill:!0===this.state.editing||this.state.actionState===g.SkipNoticeAction.CopyDownvote||!0===this.state.choosingCategory?this.selectedColor:this.unselectedColor}))),this.props.smaller?null:this.getSkipButton(),this.autoSkip?o.createElement("td",{className:"sponsorSkipNoticeRightSection",key:1},o.createElement("button",{className:"sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeRightButton",onClick:this.contentContainer().dontShowNoticeAgain},chrome.i18n.getMessage("Hide"))):""),this.state.editing&&!this.state.thanksForVotingText&&!(this.state.choosingCategory||this.state.actionState===g.SkipNoticeAction.CopyDownvote)&&o.createElement("tr",{id:"sponsorSkipNoticeEditSegmentsRow"+this.idSuffix,key:2},o.createElement("td",{id:"sponsorTimesEditSegmentsContainer"+this.idSuffix},o.createElement("button",{className:"sponsorSkipObject sponsorSkipNoticeButton",title:chrome.i18n.getMessage("CopyDownvoteButtonInfo"),style:{color:(0,g.downvoteButtonColor)(this.segments,this.state.actionState,g.SkipNoticeAction.Downvote)},onClick:()=>this.prepAction(g.SkipNoticeAction.CopyDownvote)},chrome.i18n.getMessage("CopyAndDownvote")),o.createElement("button",{className:"sponsorSkipObject sponsorSkipNoticeButton",title:chrome.i18n.getMessage("ChangeCategoryTooltip"),style:{color:this.state.actionState===g.SkipNoticeAction.CategoryVote&&1==this.state.editing?this.selectedColor:this.unselectedColor},onClick:()=>this.resetStateToStart(g.SkipNoticeAction.CategoryVote,!0,!0)},chrome.i18n.getMessage("incorrectCategory")))),this.state.choosingCategory&&!this.state.thanksForVotingText&&o.createElement("tr",{id:"sponsorSkipNoticeCategoryChooserRow"+this.idSuffix,key:3},o.createElement("td",null,o.createElement("select",{id:"sponsorTimeCategories"+this.idSuffix,className:"sponsorTimeCategories sponsorTimeEditSelector",defaultValue:this.segments[0].category,ref:this.categoryOptionRef},this.getCategoryOptions()),1===this.segments.length&&o.createElement("button",{className:"sponsorSkipObject sponsorSkipNoticeButton",onClick:()=>this.prepAction(g.SkipNoticeAction.CategoryVote)},chrome.i18n.getMessage("submit")))),this.state.actionState!==g.SkipNoticeAction.None&&this.segments.length>1&&!this.state.thanksForVotingText&&o.createElement("tr",{id:"sponsorSkipNoticeSubmissionOptionsRow"+this.idSuffix,key:4},o.createElement("td",{id:"sponsorTimesSubmissionOptionsContainer"+this.idSuffix},this.getSubmissionChooser()))]}getSkipButton(){if(this.state.showSkipButton&&(this.segments.length>1||this.segments[0].actionType!==r.ActionType.Poi||this.props.unskipTime)){const e={marginLeft:"4px",color:this.state.actionState===g.SkipNoticeAction.Unskip?this.selectedColor:this.unselectedColor};return this.contentContainer().onMobileYouTube&&(e.padding="20px",e.minWidth="100px"),o.createElement("span",{className:"sponsorSkipNoticeUnskipSection"},o.createElement("button",{id:"sponsorSkipUnskipButton"+this.idSuffix,className:"sponsorSkipObject sponsorSkipNoticeButton",style:e,onClick:()=>this.prepAction(g.SkipNoticeAction.Unskip)},this.state.skipButtonText+(this.state.showKeybindHint?" ("+(0,u.keybindToString)(s.default.config.skipKeybind)+")":"")))}}getSubmissionChooser(){const e=[];for(let t=0;t<this.segments.length;t++)e.push(o.createElement("button",{className:"sponsorSkipObject sponsorSkipNoticeButton",style:{opacity:this.getSubmissionChooserOpacity(t),color:this.getSubmissionChooserColor(t)},onClick:()=>this.performAction(t),key:"submission"+t+this.segments[t].category+this.idSuffix},t+1+". "+chrome.i18n.getMessage("category_"+this.segments[t].category)));return e}getSubmissionChooserOpacity(e){const t=this.state.actionState===g.SkipNoticeAction.Upvote,n=this.state.actionState==g.SkipNoticeAction.Downvote,o=this.state.actionState==g.SkipNoticeAction.CopyDownvote;return t&&this.state.voted[e]==g.SkipNoticeAction.Upvote||n&&this.state.voted[e]==g.SkipNoticeAction.Downvote||o&&this.state.copied[e]==g.SkipNoticeAction.CopyDownvote?.35:1}getSubmissionChooserColor(e){const t=this.state.actionState==g.SkipNoticeAction.Downvote,n=this.state.actionState==g.SkipNoticeAction.CopyDownvote;return s.default.config.isVip&&(t||n)&&1===this.segments[e].locked?this.lockedColor:this.unselectedColor}onMouseEnter(){this.state.smaller&&this.setState({smaller:!1})}getMessageBoxes(){if(0===this.state.messages.length)return[o.createElement("tr",{id:"sponsorSkipNoticeSpacer"+this.idSuffix,className:"sponsorBlockSpacer",key:"messageBoxSpacer"})];const e=[];for(let t=0;t<this.state.messages.length;t++)e.push(o.createElement("tr",{key:t+"_messageBox"},o.createElement("td",{key:t+"_messageBox"},o.createElement(c.default,{idSuffix:this.idSuffix,text:this.state.messages[t],onClick:this.state.messageOnClick,key:t+"_messageBox"}))));return e}prepAction(e){if(1===this.segments.length)this.performAction(0,e);else switch(null!=e?e:this.state.actionState){case g.SkipNoticeAction.None:this.resetStateToStart();break;case g.SkipNoticeAction.Upvote:this.resetStateToStart(g.SkipNoticeAction.Upvote);break;case g.SkipNoticeAction.Downvote:this.resetStateToStart(g.SkipNoticeAction.Downvote);break;case g.SkipNoticeAction.CategoryVote:this.resetStateToStart(g.SkipNoticeAction.CategoryVote,!0,!0);break;case g.SkipNoticeAction.CopyDownvote:this.resetStateToStart(g.SkipNoticeAction.CopyDownvote,!0);break;case g.SkipNoticeAction.Unskip:this.resetStateToStart(g.SkipNoticeAction.Unskip)}}performAction(e,t){switch(null!=t?t:this.state.actionState){case g.SkipNoticeAction.None:this.noAction(e);break;case g.SkipNoticeAction.Upvote:this.upvote(e);break;case g.SkipNoticeAction.Downvote:this.downvote(e);break;case g.SkipNoticeAction.CategoryVote:this.categoryVote(e);break;case g.SkipNoticeAction.CopyDownvote:this.copyDownvote(e);break;case g.SkipNoticeAction.Unskip:this.unskipAction(e);break;default:this.resetStateToStart()}}noAction(e){const t=this.state.voted;t[e]=g.SkipNoticeAction.None,this.setState({voted:t})}upvote(e){1===this.segments.length&&this.resetStateToStart(),this.contentContainer().vote(1,this.segments[e].UUID,void 0,this)}downvote(e){1===this.segments.length&&this.resetStateToStart(),this.contentContainer().vote(0,this.segments[e].UUID,void 0,this)}categoryVote(e){this.contentContainer().vote(void 0,this.segments[e].UUID,this.categoryOptionRef.current.value,this)}copyDownvote(e){const t=this.props.contentContainer().sponsorVideoID,n={segment:this.segments[e].segment,UUID:l.generateUserID(),category:this.segments[e].category,actionType:this.segments[e].actionType,source:r.SponsorSourceType.Local},o=s.default.config.unsubmittedSegments[t]||[];o.push(n),s.default.config.unsubmittedSegments[t]=o,s.default.forceSyncUpdate("unsubmittedSegments"),this.props.contentContainer().sponsorTimesSubmitting.push(n),this.props.contentContainer().updatePreviewBar(),this.props.contentContainer().resetSponsorSubmissionNotice(),this.props.contentContainer().updateEditButtonsOnPlayer(),this.contentContainer().vote(0,this.segments[e].UUID,void 0,this);const i=this.state.copied;i[e]=g.SkipNoticeAction.CopyDownvote,this.setState({copied:i})}unskipAction(e){this.state.skipButtonCallback(e)}openEditingOptions(){this.resetStateToStart(void 0,!0)}getCategoryOptions(){const e=[],t=i.categoryList.filter((e=>i.categorySupport[e].includes(r.ActionType.Skip)));for(const n of t)e.push(o.createElement("option",{value:n,key:n,className:this.getCategoryNameClass(n)},chrome.i18n.getMessage("category_"+n)));return e}getCategoryNameClass(e){return this.props.contentContainer().lockedCategories.includes(e)?"sponsorBlockLockedColor":""}unskip(e){this.contentContainer().unskipSponsorTime(this.segments[e],this.props.unskipTime),this.unskippedMode(e,this.getReskipText())}reskip(e){this.contentContainer().reskipSponsorTime(this.segments[e]);const t={skipButtonText:this.getUnskipText(),skipButtonCallback:this.unskip.bind(this),maxCountdownTime:()=>s.default.config.skipNoticeDuration,countdownTime:s.default.config.skipNoticeDuration};this.autoSkip||(t.noticeTitle=chrome.i18n.getMessage("noticeTitle")),this.setState(t,(()=>{this.noticeRef.current.resetCountdown()}))}unskippedMode(e,t){this.setState(this.getUnskippedModeInfo(e,t),(()=>{this.noticeRef.current.resetCountdown()}))}getUnskippedModeInfo(e,t){const n=this.segments[e].actionType!==r.ActionType.Poi?()=>{const t=this.segments[e],n=Math.round((t.segment[1]-this.contentContainer().v.currentTime)*(1/this.contentContainer().v.playbackRate));return Math.max(n,s.default.config.skipNoticeDuration)}:this.state.maxCountdownTime;return{skipButtonText:t,skipButtonCallback:e=>this.reskip(e),maxCountdownTime:n,countdownTime:n()}}afterVote(e,t,n){const o=l.getSponsorIndexFromUUID(this.segments,e.UUID),s=i.wikiLinks[e.category],r=this.state.voted;switch(t){case 0:this.clearConfigListener(),this.setNoticeInfoMessageWithOnClick((()=>window.open(s)),chrome.i18n.getMessage("OpenCategoryWikiPage")),r[o]=g.SkipNoticeAction.Downvote;break;case 1:r[o]=g.SkipNoticeAction.Upvote;break;case 20:r[o]=g.SkipNoticeAction.None}this.setState({voted:r}),this.addVoteButtonInfo(chrome.i18n.getMessage("voted")),e&&n&&(this.segments[o].category=n)}setNoticeInfoMessageWithOnClick(e,...t){this.setState({messages:t,messageOnClick:t=>e(t)})}setNoticeInfoMessage(...e){this.setState({messages:e})}addVoteButtonInfo(e){this.setState({thanksForVotingText:e})}resetVoteButtonInfo(){this.setState({thanksForVotingText:null})}closeListener(){this.clearConfigListener(),this.props.closeListener()}clearConfigListener(){this.configListener&&(s.default.configSyncListeners.splice(s.default.configSyncListeners.indexOf(this.configListener),1),this.configListener=null)}unmutedListener(){1===this.props.segments.length&&this.props.segments[0].actionType===r.ActionType.Mute&&this.contentContainer().v.currentTime>=this.props.segments[0].segment[1]&&this.setState({showSkipButton:!1})}resetStateToStart(e=g.SkipNoticeAction.None,t=!1,n=!1){this.setState({actionState:e,editing:t,choosingCategory:n,thanksForVotingText:null,messages:[]})}getUnskipText(){switch(this.props.segments[0].actionType){case r.ActionType.Mute:return chrome.i18n.getMessage("unmute");case r.ActionType.Skip:default:return chrome.i18n.getMessage("unskip")}}getReskipText(){switch(this.props.segments[0].actionType){case r.ActionType.Mute:return chrome.i18n.getMessage("mute");case r.ActionType.Skip:default:return chrome.i18n.getMessage("reskip")}}getSkipText(){switch(this.props.segments[0].actionType){case r.ActionType.Mute:return chrome.i18n.getMessage("mute");case r.ActionType.Skip:default:return chrome.i18n.getMessage("skip")}}}t.default=f},919:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(294),i=n(181),s=n(913),r=n(699),a=n(593),c=n(307),l=new a.default,d="chooseACategory";class u extends o.Component{constructor(e){super(e),this.timesBeforeChanging=[],this.fullVideoWarningShown=!1,this.categoryOptionRef=o.createRef(),this.actionTypeOptionRef=o.createRef(),this.idSuffix=this.props.idSuffix,this.previousSkipType=r.ActionType.Skip,this.state={editing:!1,sponsorTimeEdits:[null,null],selectedCategory:d}}componentDidMount(){document.getElementById("sponsorTimesContainer"+this.idSuffix).addEventListener("keydown",(function(e){e.stopPropagation()})),document.getElementById("sponsorTimesContainer"+this.idSuffix).addEventListener("wheel",(function(e){e.preventDefault()}),{passive:!1}),this.configUpdateListener||(this.configUpdateListener=()=>this.configUpdate(),s.default.configSyncListeners.push(this.configUpdate.bind(this))),this.checkToShowFullVideoWarning()}componentWillUnmount(){this.configUpdateListener&&s.default.configSyncListeners.splice(s.default.configSyncListeners.indexOf(this.configUpdate.bind(this)),1)}render(){var e,t;this.checkToShowFullVideoWarning();const n={textAlign:"center"};0!=this.props.index&&(n.marginTop="15px");const s=e=>{e&&(e.style.setProperty("color","black","important"),e.style.setProperty("text-shadow","none","important"))};let a;const c={},d=this.props.contentContainer().sponsorTimesSubmitting[this.props.index],u=d.segment;return(null==d?void 0:d.actionType)===r.ActionType.Full&&(c.display="none"),a=this.state.editing?o.createElement("div",{id:"sponsorTimesContainer"+this.idSuffix,style:c,className:"sponsorTimeDisplay"},o.createElement("span",{id:"nowButton0"+this.idSuffix,className:"sponsorNowButton",onClick:()=>this.setTimeToNow(0)},chrome.i18n.getMessage("bracketNow")),o.createElement("input",{id:"submittingTime0"+this.idSuffix,className:"sponsorTimeEdit sponsorTimeEditInput",ref:s,type:"text",value:this.state.sponsorTimeEdits[0],onChange:e=>{this.handleOnChange(0,e,d,e.target.value)},onWheel:e=>{this.changeTimesWhenScrolling(0,e,d)}}),d.actionType!==r.ActionType.Poi?o.createElement("span",null,o.createElement("span",null," "+chrome.i18n.getMessage("to")+" "),o.createElement("input",{id:"submittingTime1"+this.idSuffix,className:"sponsorTimeEdit sponsorTimeEditInput",ref:s,type:"text",value:this.state.sponsorTimeEdits[1],onChange:e=>{this.handleOnChange(1,e,d,e.target.value)},onWheel:e=>{this.changeTimesWhenScrolling(1,e,d)}}),o.createElement("span",{id:"nowButton1"+this.idSuffix,className:"sponsorNowButton",onClick:()=>this.setTimeToNow(1)},chrome.i18n.getMessage("bracketNow")),o.createElement("span",{id:"endButton"+this.idSuffix,className:"sponsorNowButton",onClick:()=>this.setTimeToEnd()},chrome.i18n.getMessage("bracketEnd"))):""):o.createElement("div",{id:"sponsorTimesContainer"+this.idSuffix,style:c,className:"sponsorTimeDisplay",onClick:this.toggleEditTime.bind(this)},l.getFormattedTime(u[0],!0)+(isNaN(u[1])||d.actionType===r.ActionType.Poi?"":" "+chrome.i18n.getMessage("to")+" "+l.getFormattedTime(u[1],!0))),o.createElement("div",{style:n},a,o.createElement("div",{style:{position:"relative"}},o.createElement("select",{id:"sponsorTimeCategories"+this.idSuffix,className:"sponsorTimeEditSelector sponsorTimeCategories",defaultValue:d.category,ref:this.categoryOptionRef,onChange:this.categorySelectionChange.bind(this)},this.getCategoryOptions()),o.createElement("a",{href:i.wikiLinks[d.category]||"https://wiki.sponsor.ajay.app/index.php/Segment_Categories",target:"_blank",rel:"noreferrer"},o.createElement("img",{id:"sponsorTimeCategoriesHelpButton"+this.idSuffix,className:"helpButton",src:chrome.extension.getURL("icons/help.svg"),title:chrome.i18n.getMessage("categoryGuidelines")}))),i.categorySupport[d.category]&&((null===(e=i.categorySupport[d.category])||void 0===e?void 0:e.length)>1||(null===(t=i.categorySupport[d.category])||void 0===t?void 0:t[0])===r.ActionType.Full)?o.createElement("div",{style:{position:"relative"}},o.createElement("select",{id:"sponsorTimeActionTypes"+this.idSuffix,className:"sponsorTimeEditSelector sponsorTimeActionTypes",defaultValue:d.actionType,ref:this.actionTypeOptionRef,onChange:e=>this.actionTypeSelectionChange(e)},this.getActionTypeOptions(d))):"",o.createElement("br",null),o.createElement("span",{id:"sponsorTimeDeleteButton"+this.idSuffix,className:"sponsorTimeEditButton",onClick:this.deleteTime.bind(this)},chrome.i18n.getMessage("delete")),isNaN(u[1])||[r.ActionType.Poi,r.ActionType.Full].includes(d.actionType)?"":o.createElement("span",{id:"sponsorTimePreviewButton"+this.idSuffix,className:"sponsorTimeEditButton",onClick:e=>this.previewTime(e.ctrlKey,e.shiftKey)},chrome.i18n.getMessage("preview")),isNaN(u[1])||d.actionType==r.ActionType.Full?"":o.createElement("span",{id:"sponsorTimeInspectButton"+this.idSuffix,className:"sponsorTimeEditButton",onClick:this.inspectTime.bind(this)},chrome.i18n.getMessage("inspect")),isNaN(u[1])||d.actionType==r.ActionType.Full?"":o.createElement("span",{id:"sponsorTimeEditButton"+this.idSuffix,className:"sponsorTimeEditButton",onClick:this.toggleEditTime.bind(this)},this.state.editing?chrome.i18n.getMessage("save"):chrome.i18n.getMessage("edit")))}handleOnChange(e,t,n,o){const i=this.state.sponsorTimeEdits,s=l.getFormattedTimeToSeconds(i[e]),a=l.getFormattedTimeToSeconds(o),c=Math.abs(s-a);0<c&&c<.5&&this.showScrollToEditToolTip(),i[e]=o,0===e&&n.actionType===r.ActionType.Poi&&(i[1]=o),this.setState({sponsorTimeEdits:i}),this.saveEditTimes()}changeTimesWhenScrolling(e,t,n){let o=0;o=t.shiftKey?t.ctrlKey?1:.001:t.ctrlKey?.1:.01;const i=this.state.sponsorTimeEdits;let s=l.getFormattedTimeToSeconds(this.state.sponsorTimeEdits[e]);null!==s&&0!=t.deltaY&&(t.deltaY<0?s+=o:s>=o?s-=o:s=0,i[e]=l.getFormattedTime(s,!0),n.actionType===r.ActionType.Poi&&(i[1]=i[0]),this.setState({sponsorTimeEdits:i}),this.saveEditTimes())}showScrollToEditToolTip(){s.default.config.scrollToEditTimeUpdate||null!==document.getElementById("sponsorRectangleTooltipsponsorTimesContainer"+this.idSuffix)||this.showToolTip(chrome.i18n.getMessage("SponsorTimeEditScrollNewFeature"),(()=>{s.default.config.scrollToEditTimeUpdate=!0}))}showToolTip(e,t){const n=document.getElementById("sponsorTimesContainer"+this.idSuffix);return!!n&&(new c.RectangleTooltip({text:e,referenceNode:n.parentElement,prependElement:n,timeout:15,bottomOffset:"0px",leftOffset:"-318px",backgroundColor:"rgba(28, 28, 28, 1.0)",htmlId:"sponsorTimesContainer"+this.idSuffix,buttonFunction:t,fontSize:"14px",maxHeight:"200px"}),!0)}checkToShowFullVideoWarning(){const e=this.props.contentContainer().sponsorTimesSubmitting[this.props.index];(e.segment[1]-e.segment[0])/this.props.contentContainer().v.duration>.6&&!this.fullVideoWarningShown&&("sponsor"===e.category||"selfpromo"===e.category||"chooseACategory"===e.category)&&this.showToolTip(chrome.i18n.getMessage("fullVideoTooltipWarning"))&&(this.fullVideoWarningShown=!0)}getCategoryOptions(){var e;const t=[o.createElement("option",{value:d,key:d},chrome.i18n.getMessage(d))];for(const n of null!==(e=this.props.categoryList)&&void 0!==e?e:i.categoryList)t.push(o.createElement("option",{value:n,key:n,className:this.getCategoryLockedClass(n)},chrome.i18n.getMessage("category_"+n)));return t}getCategoryLockedClass(e){return this.props.contentContainer().lockedCategories.includes(e)?"sponsorBlockLockedColor":""}categorySelectionChange(e){if(e.target.value!==d&&!s.default.config.categorySelections.some((t=>t.name===e.target.value))){const t=e.target.value;return e.target.value=d,void(confirm(chrome.i18n.getMessage("enableThisCategoryFirst").replace("{0}",chrome.i18n.getMessage("category_"+t)))&&chrome.runtime.sendMessage({message:"openConfig",hash:"behavior"}))}const t=this.props.contentContainer().sponsorTimesSubmitting[this.props.index];this.handleReplacingLostTimes(e.target.value,t.actionType,t),this.saveEditTimes()}actionTypeSelectionChange(e){const t=this.props.contentContainer().sponsorTimesSubmitting[this.props.index];this.handleReplacingLostTimes(t.category,e.target.value,t),this.saveEditTimes()}handleReplacingLostTimes(e,t,n){var o,s,a,c;(null===(o=i.categorySupport[e])||void 0===o?void 0:o.includes(r.ActionType.Poi))?(this.previousSkipType!==r.ActionType.Poi&&(this.timesBeforeChanging=[null,n.segment[1]]),this.setTimeTo(1,null),this.props.contentContainer().updateEditButtonsOnPlayer(),this.props.contentContainer().sponsorTimesSubmitting.some(((t,n)=>t.category===e&&n!==this.props.index))&&alert(chrome.i18n.getMessage("poiOnlyOneSegment")),this.previousSkipType=r.ActionType.Poi):1===(null===(s=i.categorySupport[e])||void 0===s?void 0:s.length)&&(null===(a=i.categorySupport[e])||void 0===a?void 0:a[0])===r.ActionType.Full?(this.previousSkipType!==r.ActionType.Full&&(this.timesBeforeChanging=[...n.segment]),this.previousSkipType=r.ActionType.Full):("chooseACategory"===e||(null===(c=i.categorySupport[e])||void 0===c?void 0:c.includes(r.ActionType.Skip))&&![r.ActionType.Poi,r.ActionType.Full].includes(this.getNextActionType(e,t)))&&this.previousSkipType!==r.ActionType.Skip&&(this.timesBeforeChanging[0]&&this.setTimeTo(0,this.timesBeforeChanging[0]),this.timesBeforeChanging[1]&&this.setTimeTo(1,this.timesBeforeChanging[1]),this.previousSkipType=r.ActionType.Skip)}getActionTypeOptions(e){const t=[];for(const n of i.categorySupport[e.category])t.push(o.createElement("option",{value:n,key:n},chrome.i18n.getMessage(n)));return t}setTimeToNow(e){this.setTimeTo(e,this.props.contentContainer().getRealCurrentTime())}setTimeToEnd(){this.setTimeTo(1,this.props.contentContainer().v.duration)}setTimeTo(e,t){const n=this.props.contentContainer().sponsorTimesSubmitting[this.props.index];null===t&&(t=n.segment[0]),n.segment[e]=t,n.actionType===r.ActionType.Poi&&(n.segment[1]=t),this.setState({sponsorTimeEdits:this.getFormattedSponsorTimesEdits(n)},this.saveEditTimes)}toggleEditTime(){if(this.state.editing)this.setState({editing:!1}),this.saveEditTimes();else{const e=this.props.contentContainer().sponsorTimesSubmitting[this.props.index];this.setState({editing:!0,sponsorTimeEdits:this.getFormattedSponsorTimesEdits(e)})}}getFormattedSponsorTimesEdits(e){return[l.getFormattedTime(e.segment[0],!0),l.getFormattedTime(e.segment[1],!0)]}saveEditTimes(){var e,t;const n=this.props.contentContainer().sponsorTimesSubmitting;if(this.state.editing){const e=l.getFormattedTimeToSeconds(this.state.sponsorTimeEdits[0]),t=l.getFormattedTimeToSeconds(this.state.sponsorTimeEdits[1]);null!==e&&null!==t&&(n[this.props.index].segment=[e,t])}const o=this.categoryOptionRef.current.value;n[this.props.index].category=o;const i=null===(t=null===(e=this.actionTypeOptionRef)||void 0===e?void 0:e.current)||void 0===t?void 0:t.value;n[this.props.index].actionType=this.getNextActionType(o,i),s.default.config.unsubmittedSegments[this.props.contentContainer().sponsorVideoID]=n,s.default.forceSyncUpdate("unsubmittedSegments"),this.props.contentContainer().updatePreviewBar(),n[this.props.index].actionType!==r.ActionType.Full||0===n[this.props.index].segment[0]&&0===n[this.props.index].segment[1]||(this.setTimeTo(0,0),this.setTimeTo(1,0))}getNextActionType(e,t){var n,o,s;return t&&(null===(n=i.categorySupport[e])||void 0===n?void 0:n.includes(t))?t:null!==(s=null===(o=i.categorySupport[e])||void 0===o?void 0:o[0])&&void 0!==s?s:r.ActionType.Skip}previewTime(e=!1,t=!1){const n=this.props.contentContainer().sponsorTimesSubmitting[this.props.index].segment[0];let o=2;e&&(o=.5),t&&(o=.25),this.props.contentContainer().previewTime(n-o*this.props.contentContainer().v.playbackRate)}inspectTime(){const e=this.props.contentContainer().sponsorTimesSubmitting[this.props.index].segment[0];this.props.contentContainer().previewTime(e+1e-4,!1)}deleteTime(){const e=this.props.contentContainer().sponsorTimesSubmitting,t=this.props.index,n=e[t].segment.length<2;e.splice(t,1),e.length>0?s.default.config.unsubmittedSegments[this.props.contentContainer().sponsorVideoID]=e:delete s.default.config.unsubmittedSegments[this.props.contentContainer().sponsorVideoID],s.default.forceSyncUpdate("unsubmittedSegments"),this.props.contentContainer().updatePreviewBar(),0==e.length?this.props.submissionNotice.cancel():this.props.submissionNotice.forceUpdate(),(0===e.length||n)&&this.props.contentContainer().updateEditButtonsOnPlayer()}configUpdate(){this.forceUpdate()}}t.default=u},875:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(294),i=n(913),s=n(541),r=n(751),a=n(919);class c extends o.Component{constructor(e){super(e),this.noticeRef=o.createRef(),this.contentContainer=e.contentContainer,this.callback=e.callback;const t=chrome.i18n.getMessage("confirmNoticeTitle");this.state={noticeTitle:t,messages:[],idSuffix:"SubmissionNotice"}}componentDidMount(){this.videoObserver=new MutationObserver((()=>{this.forceUpdate()})),this.videoObserver.observe(this.contentContainer().v,{attributes:!0})}componentWillUnmount(){this.videoObserver&&this.videoObserver.disconnect()}render(){return o.createElement(s.default,{noticeTitle:this.state.noticeTitle,idSuffix:this.state.idSuffix,ref:this.noticeRef,closeListener:this.cancel.bind(this),zIndex:5e3},this.getMessageBoxes(),o.createElement("tr",{id:"sponsorSkipNoticeMiddleRow"+this.state.idSuffix,className:"sponsorTimeMessagesRow",style:{maxHeight:this.contentContainer().v.offsetHeight-200+"px"}},o.createElement("td",{style:{width:"100%"}},this.getSponsorTimeMessages())),o.createElement("tr",{id:"sponsorSkipNoticeSecondRow"+this.state.idSuffix},o.createElement("td",{className:"sponsorSkipNoticeRightSection",style:{position:"relative"}},o.createElement("button",{className:"sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeRightButton",onClick:()=>window.open("https://wiki.sponsor.ajay.app/index.php/Guidelines")},chrome.i18n.getMessage(i.default.config.submissionCountSinceCategories>3?"guidelines":"readTheGuidelines")),o.createElement("button",{className:"sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeRightButton",onClick:this.submit.bind(this)},chrome.i18n.getMessage("submit")))))}getSponsorTimeMessages(){const e=[];this.timeEditRefs=[];const t=this.props.contentContainer().sponsorTimesSubmitting;for(let n=0;n<t.length;n++){const i=o.createRef();e.push(o.createElement(a.default,{key:t[n].UUID,idSuffix:this.state.idSuffix+n,index:n,contentContainer:this.props.contentContainer,submissionNotice:this,ref:i})),this.timeEditRefs.push(i)}return e}getMessageBoxes(){const e=[];for(let t=0;t<this.state.messages.length;t++)e.push(o.createElement(r.default,{idSuffix:this.state.idSuffix+t,text:this.state.messages[t],key:t}));return e}cancel(){this.noticeRef.current.close(!0),this.contentContainer().resetSponsorSubmissionNotice(),this.props.closeListener()}submit(){var e,t,n;for(const e of this.timeEditRefs)e.current.saveEditTimes();const o=this.props.contentContainer().sponsorTimesSubmitting;for(const e of o)if("chooseACategory"===e.category)return void alert(chrome.i18n.getMessage("youMustSelectACategory"));if("Music"===(null===(n=null===(t=null===(e=this.contentContainer().videoInfo)||void 0===e?void 0:e.microformat)||void 0===t?void 0:t.playerMicroformatRenderer)||void 0===n?void 0:n.category))for(const e of o)if("sponsor"===e.category){if(!confirm(chrome.i18n.getMessage("nonMusicCategoryOnMusic")))return;break}this.props.callback(),this.cancel()}}t.default=c},144:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,s){function r(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=n(913),s=n(699),r=new(n(593).default),a=n(975),c=n(779),l=n(766),d=n(557),u=n(979),p=n(847),m=n(315),h=n(39),g=n(386),f=n(360),y=n(854),v=n(829);r.wait((()=>null!==i.default.config),5e3,10).then((function(){!r.isFirefox()&&i.default.config.invidiousInstances.includes(new URL(document.URL).host)&&window.addEventListener("DOMContentLoaded",(()=>{const e=document.getElementsByTagName("head")[0];for(const t of r.css){const n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=chrome.extension.getURL(t),e.appendChild(n)}}))}));let S=!1,T=null,k=null;const b=[];let C,w,x=null,E=null,N=[],M=null,I=null,L=[],B=!1,U=null;const A=[],D=[];let P,O,R,V=null,F=!1,H=0,_=-1,W=!1,q=null,j=null,K=null,G=null;const Y={};r.wait((()=>null!==i.default.config),1e3,1).then((()=>ne(ge(document)))),window.addEventListener("DOMContentLoaded",(()=>r.waitForElement(".ytp-inline-preview-ui").then((()=>de())))),document.addEventListener("yt-navigate-finish",(()=>{(0,h.isVisible)(w)||de()})),document.addEventListener("keydown",(function(e){var t,n,o,s,r;if(["textarea","input"].includes(null===(n=null===(t=document.activeElement)||void 0===t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase())||(null===(r=null===(s=null===(o=document.activeElement)||void 0===o?void 0:o.id)||void 0===s?void 0:s.toLowerCase())||void 0===r?void 0:r.includes("editable")))return;const a={key:e.key,code:e.code,alt:e.altKey,ctrl:e.ctrlKey,shift:e.shiftKey},c=i.default.config.skipKeybind,l=i.default.config.startSponsorKeybind,d=i.default.config.submitKeybind;(0,g.keybindEquals)(a,c)?x&&x.toggleSkip.call(x):(0,g.keybindEquals)(a,l)?Ae():(0,g.keybindEquals)(a,d)?je():a.key!=(null==c?void 0:c.key)||null!=c.code||(0,g.keybindEquals)(i.default.syncDefaults.skipKeybind,c)?a.key!=(null==l?void 0:l.key)||null!=l.code||(0,g.keybindEquals)(i.default.syncDefaults.startSponsorKeybind,l)?a.key!=(null==d?void 0:d.key)||null!=d.code||(0,g.keybindEquals)(i.default.syncDefaults.submitKeybind,d)||je():Ae():x&&x.toggleSkip.call(x)}));let z=[],$=!1,J=!1,X=null,Q=!1;const Z=()=>({vote:He,dontShowNoticeAgain:We,unskipSponsorTime:we,sponsorTimes:T,sponsorTimesSubmitting:z,skipNotices:b,v:w,sponsorVideoID:k,reskipSponsorTime:xe,updatePreviewBar:ve,onMobileYouTube:O,sponsorSubmissionNotice:X,resetSponsorSubmissionNotice:qe,updateEditButtonsOnPlayer:Be,previewTime:ke,videoInfo:E,getRealCurrentTime:Ue,lockedCategories:N});function ee(e,t,n){switch(e.message){case"update":ne(ge(document));break;case"sponsorStart":Ae(),n({creatingSegment:Pe()});break;case"isInfoFound":n({found:S,sponsorTimes:T,onMobileYouTube:O}),!e.updating&&J&&null!=document.getElementById("sponsorBlockPopupContainer")&&Ve(),J=!0;break;case"getVideoID":n({videoID:k,creatingSegment:Pe()});break;case"getChannelID":n({channelID:C.id});break;case"isChannelWhitelisted":n({value:W});break;case"whitelistChange":W=e.value,ue(k);break;case"submitTimes":je();break;case"refreshSegments":return ue(k,!1).then((()=>n({found:S,sponsorTimes:T,onMobileYouTube:O}))),!0;case"submitVote":return He(e.type,e.UUID).then((e=>n(e))),!0;case"hideSegment":r.getSponsorTimeFromUUID(T,e.UUID).hidden=e.type,r.addHiddenSegment(k,e.UUID,e.type),ve()}}function te(e){for(const t in e)switch(t){case"hideVideoPlayerControls":case"hideInfoButtonPlayerControls":case"hideDeleteButtonPlayerControls":Le()}}function ne(e){return o(this,void 0,void 0,(function*(){if((k!==e||!(0,h.isVisible)(w))&&(k=e,function(){var e;H=0,_=-1,T=null,L=[],E=null,W=!1,C={status:s.ChannelIDStatus.Fetching,id:null},N=[],null!==q&&q.clear(),S=!1,V=null!==V,F=!0,Q=!1;for(let t=0;t<b.length;t++)null===(e=b.pop())||void 0===e||e.close();null==j||j.disable(),null==K||K.setVisibility(!1)}(),e)){if(yield r.wait((()=>null!==i.default.config),5e3,1),i.default.config.checkForUnlistedVideos){if(!confirm("SponsorBlock: You have the setting 'Ignore Unlisted/Private Videos' enabled. Due to a change in how segment fetching works, this setting is not needed anymore as it cannot leak your video ID to the server. It instead sends just the first 4 characters of a longer hash of the videoID to the server, and filters through a subset of the database. More info about this implementation can be found here: https://github.com/ajayyy/SponsorBlockServer/issues/25\n\nPlease click okay to confirm that you acknowledge this and continue using SponsorBlock."))return;i.default.config.checkForUnlistedVideos=!1}if(function(){o(this,void 0,void 0,(function*(){const e=i.default.config.whitelistedChannels,t=()=>{var e,t,n,o,i,s,r,a,c,l,d,u,p,m;return null!==(u=null!==(a=null!==(i=null!==(t=null===(e=null==E?void 0:E.videoDetails)||void 0===e?void 0:e.channelId)&&void 0!==t?t:null===(o=null===(n=document.querySelector(".ytd-channel-name a"))||void 0===n?void 0:n.getAttribute("href"))||void 0===o?void 0:o.replace(/\/.+\//,""))&&void 0!==i?i:null===(r=null===(s=document.querySelector(".ytp-title-channel-logo"))||void 0===s?void 0:s.getAttribute("href"))||void 0===r?void 0:r.replace(/https:\/.+\//,""))&&void 0!==a?a:null===(d=null===(l=null===(c=document.querySelector("a > .channel-profile"))||void 0===c?void 0:c.parentElement)||void 0===l?void 0:l.getAttribute("href"))||void 0===d?void 0:d.replace(/\/.+\//,""))&&void 0!==u?u:null===(m=null===(p=document.querySelector("a.slim-owner-icon-and-title"))||void 0===p?void 0:p.getAttribute("href"))||void 0===m?void 0:m.replace(/\/.+\//,"")};try{yield r.wait((()=>!!t()),6e3,20),C={status:s.ChannelIDStatus.Found,id:t().match(/^\/?([^\s/]+)/)[0]}}catch(e){return void(C={status:s.ChannelIDStatus.Failed,id:null})}null!=e&&C.status===s.ChannelIDStatus.Found&&e.includes(C.id)&&(W=!0),i.default.config.forceChannelCheck&&(null==T?void 0:T.length)>0&&he()}))}(),null===q)if(O){const e=new MutationObserver(oe);let t=null;r.wait((()=>(t=document.getElementById("player-control-container"),null!==t))).then((()=>{e.observe(document.getElementById("player-control-container"),{attributes:!0,childList:!0,subtree:!0})})).catch()}else r.wait(h.getControls).then(ie);Ve(),ue(e),Le(),z=[],Oe()}}))}function oe(){if(Le(),null==j||j.updateMobileControls(),null!==q){if(document.body.contains(q.container)){const t=document.querySelector(".progress-bar-background");return void(null!==t&&(e=t,null===document.getElementById("previewbar")&&q.createElement(e)))}q.remove(),q=null}var e;ie()}function ie(){if(null!==q)return;const e=[".progress-bar-background",".ytp-progress-bar-container",".no-model.cue-range-markers",".vjs-progress-holder"];for(const t of e){const e=(0,h.findValidElement)(document.querySelectorAll(t));if(e){q=new c.default(e,O,P),ve();break}}}function se(){Ye(),ve()}function re(){ie(),ve(),Ie()}function ae(){null!==M&&(clearTimeout(M),M=null),null!==I&&(clearInterval(I),I=null)}function ce(e=!1,t,n=!0){if(ae(),Q)return _=-1,void(H=0);if(!w||w.paused)return;if(null==t&&(t=w.currentTime),B&&!function(e){const t=t=>t.actionType===s.ActionType.Mute&&t.segment[0]<=e&&t.segment[1]>e;return(null==T?void 0:T.some(t))||z.some(t)}(t)){w.muted=!1,B=!1;for(const e of b)e.unmutedListener()}if(i.default.config.disableSkipping||W||C.status===s.ChannelIDStatus.Fetching&&i.default.config.forceChannelCheck)return;if(le())return;const o=function(e,t,n){const{includedTimes:o,scheduledTimes:i}=Te(T,t,n),{scheduledTimes:s}=Te(T,t,n,e,!0,!0),r=i.indexOf(Math.min(...s)),a=Se(o,r),{includedTimes:c,scheduledTimes:l}=Te(z,t,n),{scheduledTimes:d}=Te(z,t,n,e,!1,!1),u=l.indexOf(Math.min(...d)),p=Se(c,u);return-1===u&&-1!==r||i[r]<l[u]?{array:o,index:r,endIndex:a,openNotice:!0}:{array:c,index:u,endIndex:p,openNotice:!1}}(t,e,n);if(-1===o.index)return;const a=o.array[o.index],c=[a.scheduledTime,o.array[o.endIndex].segment[1]],l=c[0]-t,d=k;let u=[o.array[o.index]];if(o.index!==o.endIndex){u=[];for(const e of o.array)Ne(e)&&e.segment[0]>=c[0]&&e.segment[1]<=c[1]&&u.push(e)}if(!Me(a)&&!(null==z?void 0:z.some((e=>e.segment===a.segment))))return;const p=e=>{var t;let n=null,i=!1,l=!0;le(d,a)||(e||(e=w.currentTime),e>=c[0]&&e<c[1]&&(Ce({v:w,skipTime:c,skippingSegments:u,openNotice:o.openNotice}),(null===(t=r.getCategorySelection(a.category))||void 0===t?void 0:t.option)===s.CategorySkipOption.ManualSkip||a.actionType===s.ActionType.Mute?n=c[0]+.001:(n=c[1],i=!0,l=!1)),ce(i,n,l))};if(l<=0)p();else{const e=1e3*l*(1/w.playbackRate);if(e<300&&r.isFirefox()&&!(0,g.isSafari)()){const t=performance.now(),n=w.currentTime;I=setInterval((()=>{const o=performance.now()-t;(o>=e||w.currentTime>=c[0])&&(clearInterval(I),p(Math.max(w.currentTime,n+o/1e3)))}),5)}else M=setTimeout(p,Math.max(0,e-30))}}function le(e,t){const n=ge(document);return!(n===(e||k)&&(!t||T&&(null==T?void 0:T.some((e=>e.segment===t.segment)))||z.some((e=>e.segment===t.segment)))||(console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be."),console.error("[SponsorBlock] VideoID recorded: "+k+". Actual VideoID: "+n),ne(n),0))}function de(){var e;const t=(0,h.findValidElement)(document.querySelectorAll("video"));t&&t!==w&&(w=t,A.includes(w)||(A.push(w),w.addEventListener("loadstart",re),w.addEventListener("durationchange",se),i.default.config.disableSkipping||(V=!1,w.addEventListener("play",(()=>{(F||0!==w.currentTime)&&(F=!1,V&&(V=!1,T&&he()),Ye(),(Math.abs(_-w.currentTime)>.3||_!==w.currentTime&&Date.now()-H>2e3)&&(H=Date.now(),_=w.currentTime,ce()))})),w.addEventListener("playing",(()=>{(Math.abs(_-w.currentTime)>.3||_!==w.currentTime&&Date.now()-H>2e3)&&(H=Date.now(),_=w.currentTime,ce())})),w.addEventListener("seeking",(()=>{w.paused||(H=Date.now(),_=w.currentTime,ce())})),w.addEventListener("ratechange",(()=>ce())),w.addEventListener("videoSpeed_ratechange",(()=>ce())),w.addEventListener("pause",(()=>{_=-1,H=0,ae()})),ce()),j||(j=new p.SkipButtonControlBar({skip:e=>Ce({v:w,skipTime:e.segment,skippingSegments:[e],openNotice:!0,forceAutoSkip:!0}),onMobileYouTube:O})),j.attachToPage(),K||(K=new f.CategoryPill),K.attachToPage(O,P,_e)),q&&!(null===(e=r.findReferenceNode())||void 0===e?void 0:e.contains(q.container))&&(q.remove(),q=null,ie()))}function ue(e,t=!0){var n,a;return o(this,void 0,void 0,(function*(){if(w&&(0,h.isVisible)(w)||de(),!w)return void setTimeout((()=>ue(e)),100);!function(){const e=document.querySelector(".html5-video-container");e&&null===U&&!P&&(U=new MutationObserver(de),U.observe(e,{attributes:!0,childList:!0,subtree:!0}))}();const c=i.default.config.categorySelections.map((e=>e.name)),l={},d=(0,h.getHashParams)();d.requiredSegment&&(l.requiredSegment=d.requiredSegment);const u=(yield r.getHash(e,1)).slice(0,4),p=yield r.asyncRequestToServer("GET","/api/skipSegments/"+u,Object.assign({categories:c,actionTypes:pe(),userAgent:`${chrome.runtime.id}`},l));if(null==p?void 0:p.ok){const o=null===(a=null===(n=JSON.parse(p.responseText))||void 0===n?void 0:n.filter((t=>t.videoID===e)))||void 0===a?void 0:a.map((e=>e.segments))[0];if(!o||!o.length)return void me();if(S=!0,null!==T&&t)for(let e=0;e<T.length;e++)T[e].source===s.SponsorSourceType.Local&&o.push(T[e]);const c=T||[];if(T=o,0!==i.default.config.minDuration)for(const e of T){const t=e.segment[1]-e.segment[0];t>0&&t<i.default.config.minDuration&&(e.hidden=s.SponsorHideType.MinimumDuration)}if(t)for(const e of c){const t=T.find((t=>e.UUID===t.UUID));t&&(t.hidden=e.hidden,t.category=e.category)}const l=i.default.local.downvotedSegments[u];if(l)for(const e of T){const t=yield r.getHash(e.UUID,1),n=l.segments.find((e=>e.uuid===t));n&&(e.hidden=n.hidden)}he(),(R==e||null==R&&!isNaN(w.duration))&&ve()}else 404===(null==p?void 0:p.status)&&me();!function(e){(function(){var e;return o(this,void 0,void 0,(function*(){const t=Date.now();if(t-i.default.config.lastIsVipUpdate>2592e5){i.default.config.lastIsVipUpdate=t;const n=yield r.asyncRequestToServer("GET","/api/isUserVIP",{userID:i.default.config.userID});if(n.ok){let t=!1;try{const o=null===(e=JSON.parse(n.responseText))||void 0===e?void 0:e.vip;"boolean"==typeof o&&(t=o)}catch(e){}return i.default.config.isVip=t,t}}return i.default.config.isVip}))})().then((t=>{t&&function(e){var t;o(this,void 0,void 0,(function*(){const n=(yield r.getHash(e,1)).slice(0,4),o=yield r.asyncRequestToServer("GET","/api/lockCategories/"+n);if(o.ok)try{const n=null===(t=JSON.parse(o.responseText).filter((t=>t.videoID===e))[0])||void 0===t?void 0:t.categories;Array.isArray(n)&&(N=n)}catch(e){}}))}(e)}))}(e)}))}function pe(){const e=[s.ActionType.Skip,s.ActionType.Poi];return i.default.config.muteSegments&&e.push(s.ActionType.Mute),i.default.config.fullVideoSegments&&e.push(s.ActionType.Full),e}function me(){i.default.config.refetchWhenNotFound&&(S=!1,setTimeout((()=>{k&&0===(null==T?void 0:T.length)&&ue(k)}),1e4+3e4*Math.random()))}function he(){var e;if((!V||g.isSafari)&&T){let t=(0,m.getStartTimeFromUrl)(document.URL)||-1,n=!1,o=null;for(const e of T)if(e.segment[0]<=w.currentTime&&e.segment[0]>t&&e.segment[1]>w.currentTime&&e.actionType!==s.ActionType.Poi){t=e.segment[0],o=e,n=!0;break}if(!n)for(const e of z)if(e.segment[0]<=w.currentTime&&e.segment[0]>t&&e.segment[1]>w.currentTime&&e.actionType!==s.ActionType.Poi){t=e.segment[0],o=e,n=!0;break}const i=T.filter((e=>e.segment[1]>w.currentTime&&e.actionType===s.ActionType.Poi)).sort(((e,t)=>t.segment[0]-e.segment[0]));for(const t of i){const n=null===(e=r.getCategorySelection(t.category))||void 0===e?void 0:e.option;if(n!==s.CategorySkipOption.ShowOverlay&&(Ce({v:w,skipTime:t.segment,skippingSegments:[t],openNotice:!0,unskipTime:w.currentTime}),n===s.CategorySkipOption.AutoSkip))break}const a=T.filter((e=>e.actionType===s.ActionType.Full))[0];a&&(null==K||K.setSegment(a)),-1!==t?ce(void 0,t):ce()}}function ge(e){const t=e.URL;return!t.includes("youtube.com/clip/")&&(!t.includes("youtube.com")||t.includes("/watch")||t.includes("/shorts/")||t.includes("playlist")?ye(t):t.includes("/embed/")?fe(e,!1):t.includes("/channel/")||t.includes("/user/")||t.includes("/c/")?fe(e):ye(t)||fe(e,!1))}function fe(e,t=!0){var n;const o=null===(n=e.querySelector("[data-sessionlink='feature=player-title']"))||void 0===n?void 0:n.getAttribute("href");return!!o&&(P=t,ye(o))}function ye(e){e.startsWith("https://www.youtube.com/tv#/")&&(e=e.replace("#",""));let t=null;try{t=new URL(e)}catch(t){return console.error("[SB] Unable to parse URL: "+e),!1}if(i.default.config&&i.default.config.invidiousInstances.includes(t.host))P=!0;else if("m.youtube.com"===t.host)O=!0;else if(!["m.youtube.com","www.youtube.com","www.youtube-nocookie.com","music.youtube.com"].includes(t.host))return i.default.config||r.wait((()=>null!==i.default.config)).then((()=>ne(ye(e)))),!1;if(t.searchParams.has("v")&&["/watch","/watch/"].includes(t.pathname)||t.pathname.startsWith("/tv/watch")){const e=t.searchParams.get("v");return 11==e.length&&e}if(t.pathname.startsWith("/embed/")||t.pathname.startsWith("/shorts/"))try{const e=t.pathname.split("/")[2];if((null==e?void 0:e.length)>=11)return e.slice(0,11)}catch(t){return console.error("[SB] Video ID not valid for "+e),!1}return!1}function ve(){if(null===q)return;if(Q)return void q.clear();if(null===w)return;const e=[];T&&T.forEach((t=>{t.hidden===s.SponsorHideType.Visible&&e.push({segment:t.segment,category:t.category,unsubmitted:!1,actionType:t.actionType,showLarger:t.actionType===s.ActionType.Poi})})),z.forEach((t=>{e.push({segment:t.segment,category:t.category,unsubmitted:!0,actionType:t.actionType,showLarger:t.actionType===s.ActionType.Poi})})),q.set(e.filter((e=>e.actionType!==s.ActionType.Full)),null==w?void 0:w.duration),i.default.config.showTimeWithSkips&&function(e){if(O||P)return;(isNaN(e)||e<0)&&(e=0);const t=document.querySelector(".ytp-time-display.notranslate");if(!t)return;const n="sponsorBlockDurationAfterSkips";let o=document.getElementById(n);null===o&&(o=document.createElement("span"),o.id=n,o.classList.add("ytp-time-duration"),t.appendChild(o));const i=r.getFormattedTime((null==w?void 0:w.duration)-e);o.innerText=null==i||e<=0?"":" ("+i+")"}(r.getTimestampsDuration(e.map((({segment:e})=>e)))),R=k}function Se(e,t,n=!0){if(-1==t||!Ne(e[t])||e[t].actionType!==s.ActionType.Skip)return t;let o=t;for(let t=0;t<(null==e?void 0:e.length);t++){const i=e[t].segment,r=e[o].segment[1];i[0]<=r&&i[1]>r&&(!n||e[t].hidden===s.SponsorHideType.Visible)&&Ne(e[t])&&e[t].actionType===s.ActionType.Skip&&(o=t)}return o!==t&&(o=Se(e,o,n)),o}function Te(e,t,n,o,i=!1,r=!1){if(!e)return{includedTimes:[],scheduledTimes:[]};const a=[],c=[],l=e.map((e=>Object.assign(Object.assign({},e),{scheduledTime:e.segment[0]})));e.filter((e=>e.actionType===s.ActionType.Mute)).forEach((e=>{l.some((t=>e.segment[1]===t.scheduledTime))||l.push(Object.assign(Object.assign({},e),{scheduledTime:e.segment[1]}))}));for(let e=0;e<l.length;e++)!(void 0===o||n&&l[e].scheduledTime>=o||t&&l[e].scheduledTime<o&&l[e].segment[1]>o)||i&&!Me(l[e])||r&&l[e].hidden!==s.SponsorHideType.Visible||l[e].actionType===s.ActionType.Poi||(c.push(l[e].scheduledTime),a.push(l[e]));return{includedTimes:a,scheduledTimes:c}}function ke(e,t=!0){w.currentTime=e,t&&w.paused&&w.play()}function be(e,t,n){if(!i.default.config.trackViewCount||!i.default.config.trackViewCountInPrivate&&chrome.extension.inIncognitoContext)return;let o=!1;for(const s of e){const e=null==T?void 0:T.findIndex((e=>e.segment===s.segment));-1===e||L[e]||(L[e]=!0,o||(i.default.config.minutesSaved=i.default.config.minutesSaved+t/60,i.default.config.skipCount=i.default.config.skipCount+1,o=!0),n&&r.asyncRequestToServer("POST","/api/viewedVideoSponsorTime?UUID="+s.UUID))}}function Ce({v:e,skipTime:t,skippingSegments:n,openNotice:o,forceAutoSkip:r,unskipTime:a}){if(i.default.config.disableSkipping)return;const c=r||Ne(n[0]);if((c||z.some((e=>e.segment===n[0].segment)))&&e.currentTime!==t[1])switch(n[0].actionType){case s.ActionType.Poi:case s.ActionType.Skip:e.loop&&e.duration>1&&t[1]>=e.duration-1?e.currentTime=0:"Apple Computer, Inc."===navigator.vendor&&e.duration>1&&t[1]>=e.duration?e.currentTime=e.duration-.001:e.currentTime=t[1];break;case s.ActionType.Mute:e.muted||(e.muted=!0,B=!0)}if(c&&i.default.config.audioNotificationOnSkip){const e=new Audio(chrome.runtime.getURL("icons/beep.ogg"));e.volume=.1*w.volume;const t=navigator.mediaSession.metadata;e.play(),e.addEventListener("ended",(()=>{navigator.mediaSession.metadata=null,setTimeout((()=>navigator.mediaSession.metadata=t))}))}if(c||1!==n.length||n[0].actionType!==s.ActionType.Poi){if(o&&(!i.default.config.dontShowNotice||!c)){const e=new l.default(n,c,Z,a);(O||null==i.default.config.skipKeybind)&&e.setShowKeybindHint(!1),b.push(e),null==x||x.setShowKeybindHint(!1),x=e}}else j.enable(n[0]),(O||null==i.default.config.skipKeybind)&&j.setShowKeybindHint(!1),null==x||x.setShowKeybindHint(!1),x=j;c&&be(n,t[1]-t[0],!0)}function we(e,t=null){e.actionType===s.ActionType.Mute?(w.muted=!1,B=!1):w.currentTime=null!=t?t:e.segment[0]+.001}function xe(e){if(e.actionType===s.ActionType.Mute)w.muted=!0,B=!0;else{const t=Math.max(e.segment[1]-w.currentTime,0),n=t/(e.segment[1]-e.segment[0])>.5;w.currentTime=e.segment[1],be([e],t,n),ce(!0,e.segment[1],!1)}}function Ee(e,t,n,o,i=!1){const s=document.getElementById(e+"Button");if(null!==s)return s;const r=document.createElement("button");r.draggable=i,r.id=e+"Button",r.classList.add("playerButton"),r.classList.add("ytp-button"),r.setAttribute("title",chrome.i18n.getMessage(t)),r.addEventListener("click",(()=>{n()}));const a=document.createElement("img");return r.draggable=i,a.id=e+"Image",a.className="playerButtonImage",a.src=chrome.extension.getURL("icons/"+o),r.appendChild(a),G&&G.prepend(r),Y[e]={button:r,image:a,setupListener:!1},r}function Ne(e){var t;return(null===(t=r.getCategorySelection(e.category))||void 0===t?void 0:t.option)===s.CategorySkipOption.AutoSkip||i.default.config.autoSkipOnMusicVideos&&(null==T?void 0:T.some((e=>"music_offtopic"===e.category)))&&e.actionType!==s.ActionType.Poi}function Me(e){var t;return e.actionType!==s.ActionType.Full&&(null===(t=r.getCategorySelection(e.category))||void 0===t?void 0:t.option)!==s.CategorySkipOption.ShowOverlay||i.default.config.autoSkipOnMusicVideos&&(null==T?void 0:T.some((e=>"music_offtopic"===e.category)))}function Ie(){var e;return o(this,void 0,void 0,(function*(){if(O)return;G=yield r.wait(h.getControls).catch(),Ee("startSegment","sponsorStart",(()=>Fe((()=>Ae()))),"PlayerStartIconSponsorBlocker.svg"),Ee("cancelSegment","sponsorCancel",(()=>Fe((()=>(Pe()&&(z.splice(z.length-1,1),i.default.config.unsubmittedSegments[k]=z,i.default.forceSyncUpdate("unsubmittedSegments"),z.length<=0&&qe()),Be(),void Oe(!1))))),"PlayerCancelSegmentIconSponsorBlocker.svg"),Ee("delete","clearTimes",(()=>Fe((()=>function(){const e=k,t=i.default.config.unsubmittedSegments[e];if(null!=t&&t.length>0){const n=chrome.i18n.getMessage("clearThis")+Ge(t)+"\n"+chrome.i18n.getMessage("confirmMSG");if(!confirm(n))return;qe(),delete i.default.config.unsubmittedSegments[e],i.default.forceSyncUpdate("unsubmittedSegments"),z=[],ve(),Be()}}()))),"PlayerDeleteIconSponsorBlocker.svg"),Ee("submit","SubmitTimes",je,"PlayerUploadIconSponsorBlocker.svg"),Ee("info","openPopup",Re,"PlayerInfoIconSponsorBlocker.svg");const t=(0,h.getControls)();i.default.config.autoHideInfoButton&&!P&&t&&(null===(e=Y.info)||void 0===e?void 0:e.button)&&!D.includes(t)&&(D.push(t),y.AnimationUtils.setupAutoHideAnimation(Y.info.button,t))}))}function Le(){return o(this,void 0,void 0,(function*(){k&&!O&&(yield Ie(),Be(),i.default.config.hideInfoButtonPlayerControls||document.URL.includes("/embed/")||P?Y.info.button.style.display="none":Y.info.button.style.removeProperty("display"))}))}function Be(){if(!k||O)return;const e=!i.default.config.hideVideoPlayerControls&&!P;let t=!1,n=!1,o=!1;e&&(t=Pe(),n=z.length>0,o=z.length>1||z.length>0&&!t),Y.startSegment.button.style.display=e?"unset":"none",Y.cancelSegment.button.style.display=e&&t?"unset":"none",e&&(t?(Y.startSegment.image.src=chrome.extension.getURL("icons/PlayerStopIconSponsorBlocker.svg"),Y.startSegment.button.setAttribute("title",chrome.i18n.getMessage("sponsorEnd"))):(Y.startSegment.image.src=chrome.extension.getURL("icons/PlayerStartIconSponsorBlocker.svg"),Y.startSegment.button.setAttribute("title",chrome.i18n.getMessage("sponsorStart")))),Y.submit.button.style.display=n&&!i.default.config.hideUploadButtonPlayerControls?"unset":"none",Y.delete.button.style.display=o&&!i.default.config.hideDeleteButtonPlayerControls?"unset":"none"}function Ue(){var e,t;return"M 18,11 V 7 l -5,5 5,5 v -4 c 3.3,0 6,2.7 6,6 0,3.3 -2.7,6 -6,6 -3.3,0 -6,-2.7 -6,-6 h -2 c 0,4.4 3.6,8 8,8 4.4,0 8,-3.6 8,-8 0,-4.4 -3.6,-8 -8,-8 z"===(null===(t=null===(e=document.querySelector(".ytp-play-button"))||void 0===e?void 0:e.querySelector(".ytp-svg-fill"))||void 0===t?void 0:t.getAttribute("d"))?null==w?void 0:w.duration:w.currentTime}function Ae(){const e=Math.round(1e3*(Ue()+Number.EPSILON))/1e3;if(Pe()){const t=De(),n=t.segment[0],o=e;t.segment=[Math.min(n,o),Math.max(n,o)]}else z.push({segment:[e],UUID:r.generateUserID(),category:i.default.config.defaultCategory,actionType:s.ActionType.Skip,source:s.SponsorSourceType.Local});i.default.config.unsubmittedSegments[k]=z,i.default.forceSyncUpdate("unsubmittedSegments"),ue(k),Be(),Oe(!1)}function De(){return z[z.length-1]}function Pe(){var e;const t=De();return t&&2!==(null===(e=null==t?void 0:t.segment)||void 0===e?void 0:e.length)}function Oe(e=!0){const t=i.default.config.unsubmittedSegments[k];if(e&&null!=t){z=[];for(const e of t)z.push({segment:e.segment,UUID:e.UUID,category:e.category,actionType:e.actionType,source:e.source})}ve(),null!==w&&ce(),null!==X&&X.update(),function(){if($)return;$=!0;let e=!1;const t=(0,h.getHashParams)().segments;if(Array.isArray(t))for(const n of t)Array.isArray(n.segment)&&(z.some((e=>e.segment[0]===n.segment[0]&&e.segment[1]==e.segment[1]))||(z.push({segment:n.segment,UUID:r.generateUserID(),category:n.category?n.category:i.default.config.defaultCategory,actionType:n.actionType?n.actionType:s.ActionType.Skip,source:s.SponsorSourceType.Local}),e=!0));e&&(i.default.config.unsubmittedSegments[k]=z,i.default.forceSyncUpdate("unsubmittedSegments"))}()}function Re(){null==document.getElementById("sponsorBlockPopupContainer")&&(J=!1,Y.info&&(Y.info.button.style.display="none"),function(e,t,n){const o=new XMLHttpRequest;o.open("GET",t,!0),null!=n&&(o.onreadystatechange=function(){n(o)},o.onerror=function(){n(o)}),o.send()}(0,chrome.extension.getURL("popup.html"),(function(e){if(4==e.readyState&&200==e.status){const t=document.createElement("div");t.id="sponsorBlockPopupContainer";let n=e.responseText;n=n.replace(/<head>[\S\s]*<\/head>/gi,""),n=n.replace(/<body/gi,"<div"),n=n.replace(/<\/body/gi,"</div"),n=n.replace(/<html/gi,"<div"),n=n.replace(/<\/html/gi,"</div"),t.innerHTML=n;const o=document.createElement("div");o.innerText=chrome.i18n.getMessage("closePopup"),o.classList.add("smallLink"),o.setAttribute("align","center"),o.addEventListener("click",Ve),o.style.color="var(--yt-spec-text-primary)",t.prepend(o);const i=document.querySelectorAll("#secondary");let s=null;for(let e=0;e<i.length;e++)null!==i[e].firstElementChild&&(s=i[e]);null==s&&(s=document.getElementById("watch7-sidebar-contents"));const r=t.querySelector("#sponsorBlockPopupLogo"),c=t.querySelector("#sbPopupIconSettings"),l=t.querySelector("#sbPopupIconEdit"),d=t.querySelector("#sbPopupIconCopyUserID"),u=t.querySelector("#sbPopupIconCheck"),p=t.querySelector("#refreshSegments"),m=t.querySelector(".sbHeart"),h=t.querySelector("#sbCloseDonate");r.src=chrome.extension.getURL("icons/IconSponsorBlocker256px.png"),c.src=chrome.extension.getURL("icons/settings.svg"),l.src=chrome.extension.getURL("icons/pencil.svg"),d.src=chrome.extension.getURL("icons/clipboard.svg"),u.src=chrome.extension.getURL("icons/check.svg"),m.src=chrome.extension.getURL("icons/heart.svg"),h.src=chrome.extension.getURL("icons/close.png"),p.src=chrome.extension.getURL("icons/refresh.svg"),s.insertBefore(t,s.firstChild),(0,a.default)(ee)}})))}function Ve(){const e=document.getElementById("sponsorBlockPopupContainer");null!==e&&(e.remove(),!document.URL.includes("/embed/")&&Y.info&&(Y.info.button.style.display="unset"))}function Fe(e){return Ve(),e()}function He(e,t,n,i){return o(this,void 0,void 0,(function*(){null!=i&&(i.addVoteButtonInfo.bind(i)(chrome.i18n.getMessage("Loading")),i.setNoticeInfoMessage.bind(i)());const o=yield _e(e,t,n);return null!=o&&null!=i&&(1==o.successType||-1==o.successType&&429==o.statusCode?i.afterVote.bind(i)(r.getSponsorTimeFromUUID(T,t),e,n):-1==o.successType&&(403===o.statusCode&&o.responseText.startsWith("Vote rejected due to a warning from a moderator.")?i.setNoticeInfoMessageWithOnClick.bind(i)((()=>{u.openWarningChat(o.responseText),i.closeListener.call(i)}),chrome.i18n.getMessage("voteRejectedWarning")):i.setNoticeInfoMessage.bind(i)(v.GenericUtils.getErrorMessage(o.statusCode,o.responseText)),i.resetVoteButtonInfo.bind(i)())),o}))}function _e(e,t,n){return o(this,void 0,void 0,(function*(){const o=r.getSponsorIndexFromUUID(T,t);if(-1!=o&&T[o].source!==s.SponsorSourceType.Local){if(0===e&&L[o]||1===e&&!L[o]){let t=1;0==e&&(t=-1,L[o]=!1),i.default.config.minutesSaved=i.default.config.minutesSaved+t*(T[o].segment[1]-T[o].segment[0])/60,i.default.config.skipCount=i.default.config.skipCount+t}return new Promise((o=>{chrome.runtime.sendMessage({message:"submitVote",type:e,UUID:t,category:n},(a=>{if(1===a.successType){const o=r.getSponsorTimeFromUUID(T,t);o&&(0===e?o.hidden=s.SponsorHideType.Downvoted:n?o.category=n:1===e&&(o.hidden=s.SponsorHideType.Visible),n||i.default.config.isVip||r.addHiddenSegment(k,o.UUID,o.hidden),ve())}o(a)}))}))}}))}function We(){i.default.config.dontShowNotice=!0,function(){const e=document.getElementsByClassName("sponsorSkipNotice");for(let t=0;t<e.length;t++)e[t].remove()}()}function qe(){null==X||X.close(),X=null}function je(){if(null!==X)return X.close(),void(X=null);void 0!==z&&z.length>0&&(X=new d.default(Z,Ke))}function Ke(){return o(this,void 0,void 0,(function*(){if((0,h.isVisible)(document.querySelector(".ytp-live-badge")))return void alert(chrome.i18n.getMessage("liveOrPremiere"));Y.submit.image.src=chrome.extension.getURL("icons/PlayerUploadIconSponsorBlocker.svg");const e=y.AnimationUtils.applyLoadingAnimation(Y.submit.button,1,(()=>Be()));for(let e=0;e<z.length;e++)z[e].segment[1]>w.duration&&(z[e].segment[1]=w.duration);if(i.default.config.unsubmittedSegments[k]=z,i.default.forceSyncUpdate("unsubmittedSegments"),i.default.config.minDuration>0)for(let e=0;e<z.length;e++){const t=z[e].segment[1]-z[e].segment[0];if(t>0&&t<i.default.config.minDuration){const e=chrome.i18n.getMessage("shortCheck")+"\n\n"+Ge(z);if(!confirm(e))return}}const t=yield r.asyncRequestToServer("POST","/api/skipSegments",{videoID:k,userID:i.default.config.userID,segments:z,videoDuration:null==w?void 0:w.duration,userAgent:`${chrome.runtime.id}/v${chrome.runtime.getManifest().version}`});if(200===t.status){e(),delete i.default.config.unsubmittedSegments[k],i.default.forceSyncUpdate("unsubmittedSegments");const n=z;try{const e=JSON.parse(t.responseText);if((null==e?void 0:e.length)===n.length)for(let t=0;t<e.length;t++)n[t].UUID=e[t].UUID,n[t].source=s.SponsorSourceType.Server}catch(e){}T=(T||[]).concat(n),i.default.config.sponsorTimesContributed=i.default.config.sponsorTimesContributed+z.length,i.default.config.submissionCountSinceCategories=i.default.config.submissionCountSinceCategories+1,z=[],ve();const o=T.filter((e=>e.actionType===s.ActionType.Full))[0];o&&(null==K||K.setSegment(o))}else Y.submit.button.style.animation="unset",Y.submit.image.src=chrome.extension.getURL("icons/PlayerUploadFailedIconSponsorBlocker.svg"),403===t.status&&t.responseText.startsWith("Submission rejected due to a warning from a moderator.")?u.openWarningChat(t.responseText):alert(v.GenericUtils.getErrorMessage(t.status,t.responseText))}))}function Ge(e){let t="";for(let n=0;n<e.length;n++)for(let o=0;o<e[n].segment.length;o++){let i=r.getFormattedTime(e[n].segment[o]);1==o?i=" "+chrome.i18n.getMessage("to")+" "+i:n>0&&(i=", "+i),t+=i}return t}function Ye(){const e=Q;Q=document.getElementsByClassName("ad-showing").length>0,e!=Q&&(ve(),Le())}chrome.runtime.onMessage.addListener(ee),i.default.configSyncListeners.includes(te)||i.default.configSyncListeners.push(te)},979:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,s){function r(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.openWarningChat=t.openChat=void 0;const i=n(913),s=new(n(593).default);function r(e){const t=document.createElement("div");t.classList.add("sbChatNotice"),t.style.zIndex="2000";const n=document.createElement("iframe");n.src="https://chat.sponsor.ajay.app/#"+s.objectToURI("",e,!1),t.appendChild(n);const o=document.createElement("img");o.classList.add("sbChatClose"),o.src=chrome.extension.getURL("icons/close.png"),o.addEventListener("click",(()=>{t.remove(),o.remove()})),t.appendChild(o),s.findReferenceNode().prepend(t)}t.openChat=r,t.openWarningChat=function(e){return o(this,void 0,void 0,(function*(){const t=e.match(/Warning reason: '(.+)'/);alert(chrome.i18n.getMessage("warningChatInfo")+"\n\n"+(t?` Warning reason: ${t[1]}`:""));const n=yield s.asyncRequestToServer("GET","/api/getUsername?userID="+i.default.config.userID),o=n.ok?JSON.parse(n.responseText).userName:"",a=yield s.getHash(i.default.config.userID);r({displayName:`${o||""}${o!==a?` | ${a}`:""}`,composerInitialValue:` Warning reason: ${t[1]}`,customDescription:chrome.i18n.getMessage("warningChatInfo")})}))}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(913),i=new(n(593).default),s="sponsorCategoryTooltipVisible";t.default=class{constructor(e,t,n){this.segments=[],this.videoDuration=0,this.container=document.createElement("ul"),this.container.id="previewbar",this.parent=e,this.onMobileYouTube=t,this.onInvidious=n,this.createElement(e),this.setupHoverText()}setupHoverText(){if(this.onMobileYouTube||this.onInvidious)return;this.categoryTooltip=document.createElement("div"),this.categoryTooltip.className="ytp-tooltip-title sponsorCategoryTooltip";const e=document.querySelector(".ytp-tooltip-text-wrapper");if(!e||!e.parentElement)return;this.tooltipContainer=e.parentElement;const t=e.querySelector(".ytp-tooltip-title");if(!this.tooltipContainer||!t)return;e.insertBefore(this.categoryTooltip,t.nextSibling);const n=document.querySelector(".ytp-progress-bar-container");if(!n)return;let o=!1;n.addEventListener("mouseenter",(()=>{o=!0})),n.addEventListener("mouseleave",(()=>{o=!1})),new MutationObserver((t=>{if(!o||!this.categoryTooltip||!this.tooltipContainer)return;if(1===t.length&&t[0].target.classList.contains("sponsorCategoryTooltip"))return;const n=e.querySelectorAll(".ytp-tooltip-text");let r=null,a=!1;for(const e of n){e.classList.contains("ytp-tooltip-text-no-title")&&(a=!0);const t=e.textContent;if(null!==t&&0!==t.length&&(r=i.getFormattedTimeToSeconds(t),null!==r))break}if(null===r)return;let c=null,l=1/0;for(const e of this.segments){const t=e.segment[1]-e.segment[0],n=this.getMinimumSize(e.showLarger),o=0!==t?e.segment[0]:Math.floor(e.segment[0]),i=t>n?e.segment[1]:Math.ceil(e.segment[0]+n);o<=r&&i>=r&&t<l&&(l=t,c=e)}null===c&&this.tooltipContainer.classList.contains(s)?this.tooltipContainer.classList.remove(s):null!==c&&(this.tooltipContainer.classList.add(s),c.unsubmitted?this.categoryTooltip.textContent=chrome.i18n.getMessage("unsubmitted")+" "+i.shortCategoryName(c.category):this.categoryTooltip.textContent=i.shortCategoryName(c.category),this.categoryTooltip.classList.toggle("ytp-tooltip-text-no-title",a))})).observe(e,{childList:!0,subtree:!0})}createElement(e){this.parent=e,this.onMobileYouTube?(e.style.backgroundColor="rgba(255, 255, 255, 0.3)",e.style.opacity="1",this.container.style.transform="none"):this.onInvidious||(this.parent.addEventListener("mouseenter",(()=>this.container.classList.add("hovered"))),this.parent.addEventListener("mouseleave",(()=>this.container.classList.remove("hovered")))),this.parent.prepend(this.container)}clear(){for(this.videoDuration=0,this.segments=[];this.container.firstChild;)this.container.removeChild(this.container.firstChild)}set(e,t){this.clear(),e&&(this.segments=e,this.videoDuration=t,this.segments.sort((({segment:e},{segment:t})=>t[1]-t[0]-(e[1]-e[0]))).forEach((e=>{const t=this.createBar(e);this.container.appendChild(t)})))}createBar({category:e,unsubmitted:t,segment:n,showLarger:i}){var s,r;const a=document.createElement("li");a.classList.add("previewbar"),a.innerHTML=i?"&nbsp;&nbsp;":"&nbsp;";const c=(t?"preview-":"")+e;a.setAttribute("sponsorblock-category",c),a.style.backgroundColor=null===(s=o.default.config.barTypes[c])||void 0===s?void 0:s.color,this.onMobileYouTube||(a.style.opacity=null===(r=o.default.config.barTypes[c])||void 0===r?void 0:r.opacity),a.style.position="absolute";const l=Math.min(n[1],this.videoDuration)-n[0];l>0&&(a.style.width=this.timeToPercentage(l));const d=n[1]?Math.min(this.videoDuration,n[0]):n[0];return a.style.left=this.timeToPercentage(d),a}remove(){this.container.remove(),this.categoryTooltip&&(this.categoryTooltip.remove(),this.categoryTooltip=void 0),this.tooltipContainer&&(this.tooltipContainer.classList.remove(s),this.tooltipContainer=void 0)}timeToPercentage(e){return Math.min(100,e/this.videoDuration*100)+"%"}getMinimumSize(e=!1){return this.videoDuration*(e?.006:.003)}}},847:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SkipButtonControlBar=void 0;const o=n(913),i=n(974),s=n(386),r=n(593),a=n(854);new r.default,t.SkipButtonControlBar=class{constructor(e){this.showKeybindHint=!0,this.enabled=!1,this.duration=0,this.left=0,this.swipeStart=0,this.skip=e.skip,this.onMobileYouTube=e.onMobileYouTube,this.container=document.createElement("div"),this.container.classList.add("skipButtonControlBarContainer"),this.container.classList.add("hidden"),this.onMobileYouTube&&this.container.classList.add("mobile"),this.skipIcon=document.createElement("img"),this.skipIcon.src=chrome.runtime.getURL("icons/skipIcon.svg"),this.skipIcon.classList.add("ytp-button"),this.skipIcon.id="sbSkipIconControlBarImage",this.textContainer=document.createElement("div"),this.container.appendChild(this.skipIcon),this.container.appendChild(this.textContainer),this.container.addEventListener("click",(()=>this.toggleSkip())),this.container.addEventListener("mouseenter",(()=>this.stopTimer())),this.container.addEventListener("mouseleave",(()=>this.startTimer())),this.onMobileYouTube&&(this.container.addEventListener("touchstart",(e=>this.handleTouchStart(e))),this.container.addEventListener("touchmove",(e=>this.handleTouchMove(e))),this.container.addEventListener("touchend",(()=>this.handleTouchEnd())))}getElement(){return this.container}attachToPage(){const e=this.getMountingContainer();if(this.chapterText=document.querySelector(".ytp-chapter-container"),e&&!e.contains(this.container))if(this.onMobileYouTube?e.appendChild(this.container):e.insertBefore(this.container,this.chapterText),this.onMobileYouTube){const{hide:t,show:n}=a.AnimationUtils.setupCustomHideAnimation(this.skipIcon,e,!1,!1);this.hideButton=t,this.showButton=n}else a.AnimationUtils.setupAutoHideAnimation(this.skipIcon,e,!1,!1)}getMountingContainer(){return this.onMobileYouTube?document.getElementById("player-container-id"):document.querySelector(".ytp-left-controls")}enable(e,t){var n,o;t&&(this.duration=t),this.segment=e,this.enabled=!0,this.refreshText(),null===(o=null===(n=this.textContainer)||void 0===n?void 0:n.classList)||void 0===o||o.remove("hidden"),a.AnimationUtils.disableAutoHideAnimation(this.skipIcon),this.startTimer()}refreshText(){var e,t;this.segment&&(null===(t=null===(e=this.chapterText)||void 0===e?void 0:e.classList)||void 0===t||t.add("hidden"),this.container.classList.remove("hidden"),this.textContainer.innerText=this.getTitle(),this.skipIcon.setAttribute("title",this.getTitle()))}setShowKeybindHint(e){this.showKeybindHint=e,this.refreshText()}stopTimer(){this.timeout&&clearTimeout(this.timeout)}startTimer(){this.stopTimer(),this.timeout=setTimeout((()=>this.disableText()),1e3*Math.max(o.default.config.skipNoticeDuration,this.duration))}disable(){var e,t,n,o,i,s;this.container.classList.add("hidden"),null===(t=null===(e=this.textContainer)||void 0===e?void 0:e.classList)||void 0===t||t.remove("hidden"),null===(o=null===(n=this.chapterText)||void 0===n?void 0:n.classList)||void 0===o||o.remove("hidden"),null===(s=null===(i=this.getChapterPrefix())||void 0===i?void 0:i.classList)||void 0===s||s.remove("hidden"),this.enabled=!1}toggleSkip(){this.skip(this.segment),this.disableText()}disableText(){var e,t,n,i,s,r;o.default.config.hideVideoPlayerControls||o.default.config.hideSkipButtonPlayerControls?this.disable():(this.container.classList.add("textDisabled"),null===(t=null===(e=this.textContainer)||void 0===e?void 0:e.classList)||void 0===t||t.add("hidden"),null===(i=null===(n=this.chapterText)||void 0===n?void 0:n.classList)||void 0===i||i.remove("hidden"),null===(r=null===(s=this.getChapterPrefix())||void 0===s?void 0:s.classList)||void 0===r||r.add("hidden"),a.AnimationUtils.enableAutoHideAnimation(this.skipIcon),this.onMobileYouTube&&this.hideButton())}updateMobileControls(){var e;const t=document.getElementById("player-control-overlay");t&&this.enabled&&((null===(e=null==t?void 0:t.classList)||void 0===e?void 0:e.contains("pointer-events-off"))?this.hideButton():this.showButton())}getTitle(){return(0,i.getSkippingText)([this.segment],!1)+(this.showKeybindHint?" ("+(0,s.keybindToString)(o.default.config.skipKeybind)+")":"")}getChapterPrefix(){return document.querySelector(".ytp-chapter-title-prefix")}handleTouchStart(e){this.swipeStart=e.touches[0].clientX}handleTouchMove(e){const t=this.swipeStart-e.touches[0].clientX;this.left=Math.min(-t,0),this.updateLeftStyle()}handleTouchEnd(){this.left<-this.container.offsetWidth/2&&(this.disableText(),this.skipIcon.style.display="none",setTimeout((()=>this.skipIcon.style.removeProperty("display")),200)),this.left=0,this.updateLeftStyle()}updateLeftStyle(){this.container.style.left=this.left+"px"}}},975:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,s){function r(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=n(913),s=n(593),r=n(699),a=n(386),c=n(854),l=n(829),d=new s.default;class u{constructor(e){this.messageListener=e}sendMessage(e,t,n){this.messageListener?this.messageListener(t,null,n):chrome.tabs.sendMessage(e,t,n)}query(e,t){this.messageListener?t([{url:document.URL,id:-1}]):chrome.tabs.query(e,t)}}function p(e){return o(this,void 0,void 0,(function*(){const t=new u(e);d.localizeHtmlPage(),yield d.wait((()=>null!==i.default.config));const n={};["sponsorblockPopup","sponsorStart","whitelistChannel","unwhitelistChannel","whitelistToggle","whitelistForceCheck","disableSkipping","enableSkipping","toggleSwitch","showNoticeAgain","optionsButton","helpButton","submitTimes","sponsorTimesContributionsContainer","sponsorTimesContributionsDisplay","sponsorTimesViewsContainer","sponsorTimesViewsDisplay","sponsorTimesViewsDisplayEndWord","sponsorTimesOthersTimeSavedDisplay","sponsorTimesOthersTimeSavedEndWord","sponsorTimesSkipsDoneContainer","sponsorTimesSkipsDoneDisplay","sponsorTimesSkipsDoneEndWord","sponsorTimeSavedDisplay","sponsorTimeSavedEndWord","setUsernameContainer","setUsernameButton","setUsernameStatusContainer","setUsernameStatus","setUsername","usernameInput","usernameValue","submitUsername","sbPopupIconCopyUserID","submissionSection","mainControls","loadingIndicator","videoFound","sponsorMessageTimes","refreshSegmentsButton","whitelistButton","sbDonate","sponsorTimesDonateContainer","sbConsiderDonateLink","sbCloseDonate"].forEach((e=>n[e]=document.getElementById(e))),(0,a.showDonationLink)()||(n.sbDonate.style.display="none"),n.sbDonate.addEventListener("click",(()=>i.default.config.donateClicked=i.default.config.donateClicked+1)),n.sponsorStart.addEventListener("click",(function(){t.query({active:!0,currentWindow:!0},(e=>{t.sendMessage(e[0].id,{from:"popup",message:"sponsorStart"},(e=>o(this,void 0,void 0,(function*(){y(e);const t=e=>{const t=i.default.configSyncListeners.indexOf(e);-1!==t&&i.default.configSyncListeners.splice(t,1)},n=()=>{y(e),t(n)};i.default.configSyncListeners.push(n),setTimeout((()=>t(n)),200)}))))}))})),n.whitelistToggle.addEventListener("change",(function(){this.checked?t.query({active:!0,currentWindow:!0},(e=>{t.sendMessage(e[0].id,{message:"getChannelID"},(function(e){if(!e.channelID)return void alert(chrome.i18n.getMessage("channelDataNotFound")+" https://github.com/ajayyy/SponsorBlock/issues/753");let o=i.default.config.whitelistedChannels;null==o&&(o=[]),o.push(e.channelID),n.whitelistChannel.style.display="none",n.unwhitelistChannel.style.display="unset",document.querySelectorAll(".SBWhitelistIcon")[0].classList.add("rotated"),i.default.config.forceChannelCheck||n.whitelistForceCheck.classList.remove("hidden"),i.default.config.whitelistedChannels=o,t.query({active:!0,currentWindow:!0},(e=>{t.sendMessage(e[0].id,{message:"whitelistChange",value:!0})}))}))})):t.query({active:!0,currentWindow:!0},(e=>{t.sendMessage(e[0].id,{message:"getChannelID"},(function(e){let o=i.default.config.whitelistedChannels;null==o&&(o=[]);const s=o.indexOf(e.channelID);o.splice(s,1),n.whitelistChannel.style.display="unset",n.unwhitelistChannel.style.display="none",document.querySelectorAll(".SBWhitelistIcon")[0].classList.remove("rotated"),i.default.config.whitelistedChannels=o,t.query({active:!0,currentWindow:!0},(e=>{t.sendMessage(e[0].id,{message:"whitelistChange",value:!1})}))}))}))})),n.whitelistForceCheck.addEventListener("click",(()=>{chrome.runtime.sendMessage({message:"openConfig",hash:"behavior"})})),n.toggleSwitch.addEventListener("change",(function(){!function(e){i.default.config.disableSkipping=e;let t=n.disableSkipping,o=n.enableSkipping;e||(t=n.enableSkipping,o=n.disableSkipping),o.style.display="unset",t.style.display="none"}(!this.checked)})),n.submitTimes.addEventListener("click",(function(){p.length>0&&t.query({active:!0,currentWindow:!0},(e=>{t.sendMessage(e[0].id,{message:"submitTimes"})}))})),n.showNoticeAgain.addEventListener("click",(function(){i.default.config.dontShowNotice=!1,n.showNoticeAgain.style.display="none"})),n.setUsernameButton.addEventListener("click",S),n.usernameValue.addEventListener("click",S),n.submitUsername.addEventListener("click",(function(){n.setUsernameStatusContainer.style.display="unset",n.setUsernameStatus.innerText=chrome.i18n.getMessage("Loading"),d.sendRequestToServer("POST","/api/setUsername?userID="+i.default.config.userID+"&username="+n.usernameInput.value,(function(e){200==e.status?(n.submitUsername.style.display="none",n.usernameInput.style.display="none",n.setUsernameContainer.style.removeProperty("display"),n.setUsername.classList.remove("SBExpanded"),n.usernameValue.innerText=n.usernameInput.value,n.setUsernameStatusContainer.style.display="none",n.sponsorTimesContributionsContainer.classList.remove("hidden")):n.setUsernameStatus.innerText=l.GenericUtils.getErrorMessage(e.status,e.responseText)})),n.setUsernameContainer.style.display="none",n.setUsername.style.display="unset"})),n.optionsButton.addEventListener("click",(function(){chrome.runtime.sendMessage({message:"openConfig"})})),n.helpButton.addEventListener("click",(function(){chrome.runtime.sendMessage({message:"openHelp"})})),n.refreshSegmentsButton.addEventListener("click",(function(){const e=c.AnimationUtils.applyLoadingAnimation(n.refreshSegmentsButton,.3);t.query({active:!0,currentWindow:!0},(n=>{t.sendMessage(n[0].id,{message:"refreshSegments"},(t=>{f(t),e()}))}))})),n.sbPopupIconCopyUserID.addEventListener("click",(()=>o(this,void 0,void 0,(function*(){return navigator.clipboard.writeText(yield d.getHash(i.default.config.userID))}))));let s=!1,p=[],m=null;const h=i.default.config.disableSkipping;null!=h&&h&&(n.disableSkipping.style.display="none",n.enableSkipping.style.display="unset",n.toggleSwitch.checked=!1);const g=i.default.config.dontShowNotice;function f(e){chrome.runtime.lastError?T():(null!=e&&(n.mainControls.style.display="flex",e.onMobileYouTube&&n.mainControls.classList.add("hidden"),n.whitelistButton.classList.remove("hidden"),n.loadingIndicator.style.display="none",e.found?(n.videoFound.innerHTML=chrome.i18n.getMessage("sponsorFound"),function(e){var n;if(null!=e.sponsorTimes){const o=e.sponsorTimes.sort(((e,t)=>e.segment[1]-t.segment[1])).sort(((e,t)=>e.segment[0]-t.segment[0])),s=document.getElementById("issueReporterTimeButtons");for(;s.firstChild;)s.removeChild(s.firstChild);const a=i.default.config.isVip;for(let e=0;e<o.length;e++){const l=o[e].UUID,u=o[e].locked,p=document.createElement("button");p.className="segmentTimeButton popupElement";const m=document.createElement("span");m.id="sponsorTimesCategoryColorCircle"+l,m.style.backgroundColor=null===(n=i.default.config.barTypes[o[e].category])||void 0===n?void 0:n.color,m.classList.add("dot"),m.classList.add("sponsorTimesCategoryColorCircle");let h="";o[e].hidden===r.SponsorHideType.Downvoted?h=" ("+chrome.i18n.getMessage("hiddenDueToDownvote")+")":o[e].hidden===r.SponsorHideType.MinimumDuration?h=" ("+chrome.i18n.getMessage("hiddenDueToDuration")+")":o[e].hidden===r.SponsorHideType.Hidden&&(h=" ("+chrome.i18n.getMessage("manuallyHidden")+")");const g=document.createTextNode(d.shortCategoryName(o[e].category)+h),f=document.createElement("div");o[e].actionType===r.ActionType.Full?f.innerText=chrome.i18n.getMessage("full"):f.innerText=d.getFormattedTime(o[e].segment[0],!0)+(o[e].actionType!==r.ActionType.Poi?" "+chrome.i18n.getMessage("to")+" "+d.getFormattedTime(o[e].segment[1],!0):""),f.style.margin="5px",p.appendChild(m),p.appendChild(g),p.appendChild(f);const y=document.createElement("div");y.classList.add("votingButtons");const v=document.createElement("div");v.id="sponsorTimesVoteButtonsContainer"+l,v.setAttribute("align","center"),v.classList.add("voteButtonsContainer--hide");const S=document.createElement("img");S.id="sponsorTimesUpvoteButtonsContainer"+l,S.className="voteButton",S.src=chrome.runtime.getURL("icons/thumbs_up.svg"),S.addEventListener("click",(()=>b(1,l)));const T=document.createElement("img");T.id="sponsorTimesDownvoteButtonsContainer"+l,T.className="voteButton",T.src=u&&a?chrome.runtime.getURL("icons/thumbs_down_locked.svg"):chrome.runtime.getURL("icons/thumbs_down.svg"),T.addEventListener("click",(()=>b(0,l)));const k=document.createElement("img");k.id="sponsorTimesCopyUUIDButtonContainer"+l,k.className="voteButton",k.src=chrome.runtime.getURL("icons/clipboard.svg"),k.addEventListener("click",(()=>{navigator.clipboard.writeText(l),c.AnimationUtils.applyLoadingAnimation(k,.3)()}));const C=document.createElement("img");C.id="sponsorTimesCopyUUIDButtonContainer"+l,C.className="voteButton",o[e].hidden===r.SponsorHideType.Hidden?C.src=chrome.runtime.getURL("icons/not_visible.svg"):C.src=chrome.runtime.getURL("icons/visible.svg"),C.addEventListener("click",(()=>{c.AnimationUtils.applyLoadingAnimation(C,.4)(),o[e].hidden===r.SponsorHideType.Hidden?(C.src=chrome.runtime.getURL("icons/visible.svg"),o[e].hidden=r.SponsorHideType.Visible):(C.src=chrome.runtime.getURL("icons/not_visible.svg"),o[e].hidden=r.SponsorHideType.Hidden),t.query({active:!0,currentWindow:!0},(n=>{t.sendMessage(n[0].id,{message:"hideSegment",type:o[e].hidden,UUID:l})}))})),v.appendChild(S),v.appendChild(T),v.appendChild(k),o[e].actionType===r.ActionType.Skip&&[r.SponsorHideType.Visible,r.SponsorHideType.Hidden].includes(o[e].hidden)&&v.appendChild(C),p.addEventListener("click",(function(){v.classList.toggle("voteButtonsContainer--hide")}));const w=document.createElement("div");w.id="sponsorTimesVoteStatusContainer"+l,w.classList.add("sponsorTimesVoteStatusContainer"),w.style.display="none";const x=document.createElement("div");x.id="sponsorTimesThanksForVotingText"+l,x.classList.add("sponsorTimesThanksForVotingText"),w.appendChild(x),y.append(p),y.append(v),y.append(w),s.appendChild(y)}}}(e)):n.videoFound.innerHTML=chrome.i18n.getMessage("sponsor404")),t.query({active:!0,currentWindow:!0},(e=>{t.sendMessage(e[0].id,{message:"isChannelWhitelisted"},(function(e){e.value&&(n.whitelistChannel.style.display="none",n.unwhitelistChannel.style.display="unset",n.whitelistToggle.checked=!0,document.querySelectorAll(".SBWhitelistIcon")[0].classList.add("rotated"))}))})))}function y(e){s=e.creatingSegment,s||(p=i.default.config.unsubmittedSegments[m]||[]),v()}function v(){n.sponsorStart.innerText=chrome.i18n.getMessage(s?"sponsorEnd":"sponsorStart"),n.submissionSection.style.display=p&&p.length>0?"unset":"none"}function S(){n.usernameInput.value=n.usernameValue.innerText,n.submitUsername.style.display="unset",n.usernameInput.style.display="unset",n.setUsernameContainer.style.display="none",n.setUsername.style.display="flex",n.setUsername.classList.add("SBExpanded"),n.setUsernameStatusContainer.style.display="none",n.sponsorTimesContributionsContainer.classList.add("hidden")}function T(){document.getElementById("loadingIndicator").innerText=chrome.i18n.getMessage("noVideoID")}function k(e,t){document.getElementById("sponsorTimesVoteButtonsContainer"+t).style.display="none",document.getElementById("sponsorTimesVoteStatusContainer"+t).style.removeProperty("display"),document.getElementById("sponsorTimesThanksForVotingText"+t).innerText=e}function b(e,n){k(chrome.i18n.getMessage("Loading"),n),t.query({active:!0,currentWindow:!0},(o=>{t.sendMessage(o[0].id,{message:"submitVote",type:e,UUID:n},(function(e){null!=e&&(1==e.successType||-1==e.successType&&429==e.statusCode?k(chrome.i18n.getMessage("voted"),n):-1==e.successType&&k(l.GenericUtils.getErrorMessage(e.statusCode,e.responseText),n))}))}))}function C(e){e=Math.round(10*e)/10;const t=Math.floor(e/1440),n=Math.floor(e/60)%24;return(t>0?t+chrome.i18n.getMessage("dayAbbreviation")+" ":"")+(n>0?n+chrome.i18n.getMessage("hourAbbreviation")+" ":"")+(e%60).toFixed(1)}null!=g&&g&&(n.showNoticeAgain.style.display="unset"),d.sendRequestToServer("GET","/api/userInfo?value=userName&value=viewCount&value=minutesSaved&userID="+i.default.config.userID,(e=>{if(200===e.status){const t=JSON.parse(e.responseText);n.usernameValue.innerText=t.userName;const o=t.viewCount;0!=o&&(n.sponsorTimesViewsDisplayEndWord.innerText=o>1?chrome.i18n.getMessage("Segments"):chrome.i18n.getMessage("Segment"),n.sponsorTimesViewsDisplay.innerText=o.toLocaleString(),n.sponsorTimesViewsContainer.style.display="unset"),function(e){i.default.config.showDonationLink&&i.default.config.donateClicked<=0&&i.default.config.showPopupDonationCount<5&&e<5e4&&!i.default.config.isVip&&i.default.config.skipCount>10&&(n.sponsorTimesDonateContainer.style.display="flex",n.sbConsiderDonateLink.addEventListener("click",(()=>{i.default.config.donateClicked=i.default.config.donateClicked+1})),n.sbCloseDonate.addEventListener("click",(()=>{n.sponsorTimesDonateContainer.style.display="none",i.default.config.showPopupDonationCount=100})),i.default.config.showPopupDonationCount=i.default.config.showPopupDonationCount+1)}(o);const s=t.minutesSaved;0!=s&&(n.sponsorTimesOthersTimeSavedEndWord.innerText=1!=s?chrome.i18n.getMessage("minsLower"):chrome.i18n.getMessage("minLower"),n.sponsorTimesOthersTimeSavedDisplay.innerText=C(s))}})),null!=i.default.config.sponsorTimesContributed&&(n.sponsorTimesContributionsDisplay.innerText=i.default.config.sponsorTimesContributed.toLocaleString(),n.sponsorTimesContributionsContainer.classList.remove("hidden")),null!=i.default.config.skipCount&&(1!=i.default.config.skipCount?n.sponsorTimesSkipsDoneEndWord.innerText=chrome.i18n.getMessage("Segments"):n.sponsorTimesSkipsDoneEndWord.innerText=chrome.i18n.getMessage("Segment"),n.sponsorTimesSkipsDoneDisplay.innerText=i.default.config.skipCount.toLocaleString(),n.sponsorTimesSkipsDoneContainer.style.display="unset"),null!=i.default.config.minutesSaved&&(1!=i.default.config.minutesSaved?n.sponsorTimeSavedEndWord.innerText=chrome.i18n.getMessage("minsLower"):n.sponsorTimeSavedEndWord.innerText=chrome.i18n.getMessage("minLower"),n.sponsorTimeSavedDisplay.innerText=C(i.default.config.minutesSaved)),setTimeout((()=>n.sponsorblockPopup.classList.remove("preload")),250),t.query({active:!0,currentWindow:!0},(e=>function(e,n){t.sendMessage(e[0].id,{message:"getVideoID"},(function(n){void 0!==n&&n.videoID?(m=n.videoID,s=n.creatingSegment,function(e,n){var o;m?(p=null!==(o=i.default.config.unsubmittedSegments[m])&&void 0!==o?o:[],v(),t.sendMessage(e[0].id,{message:"isInfoFound",updating:false},f)):T()}(e)):void 0===n&&chrome.runtime.lastError&&T()}))}(e)))}))}null!=chrome.tabs&&p(),t.default=p},360:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,s){function r(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CategoryPill=void 0;const i=n(294),s=n(935),r=n(240),a=n(913),c=n(829),l=n(709);t.CategoryPill=class{constructor(){this.ref=i.createRef()}attachToPage(e,t,n){var a;return o(this,void 0,void 0,(function*(){const o=yield c.GenericUtils.wait((()=>document.querySelector("#title h1, .ytd-video-primary-info-renderer.title, .slim-video-information-title, #player-container + .h-box > h1")));o&&!o.contains(this.container)&&(this.container=document.createElement("span"),this.container.id="categoryPill",this.container.style.display="relative",o.prepend(this.container),o.style.display="flex",this.ref.current&&(this.unsavedState=this.ref.current.state),s.render(i.createElement(r.default,{ref:this.ref,vote:n}),this.container),this.unsavedState&&(null===(a=this.ref.current)||void 0===a||a.setState(this.unsavedState),this.unsavedState=null),e&&(this.mutationObserver&&this.mutationObserver.disconnect(),this.mutationObserver=new MutationObserver((()=>this.attachToPage(e,t,n))),this.mutationObserver.observe(o,{childList:!0,subtree:!0})))}))}close(){s.unmountComponentAtNode(this.container),this.container.remove()}setVisibility(e){var t,n;const o={show:e,open:!!e&&(null===(t=this.ref.current)||void 0===t?void 0:t.state.open)};this.ref.current?null===(n=this.ref.current)||void 0===n||n.setState(o):this.unsavedState=o}setSegment(e){var t,n,i;return o(this,void 0,void 0,(function*(){if((null===(n=null===(t=this.ref.current)||void 0===t?void 0:t.state)||void 0===n?void 0:n.segment)!==e){const t={segment:e,show:!0,open:!1};if(this.ref.current?null===(i=this.ref.current)||void 0===i||i.setState(t):this.unsavedState=t,!a.default.config.categoryPillUpdate){a.default.config.categoryPillUpdate=!0;const e=yield c.GenericUtils.wait((()=>document.querySelector("#info.ytd-watch-flexy")));e&&new l.Tooltip({text:chrome.i18n.getMessage("categoryPillNewFeature"),link:"https://blog.ajay.app/full-video-sponsorblock",referenceNode:e,prependElement:e.firstChild,bottomOffset:"-10px",opacity:.95,timeout:5e4})}}}))}}},307:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleTooltip=void 0;const o=n(294),i=n(935);t.RectangleTooltip=class{constructor(e){var t,n,s,r,a,c,l;null!==(t=e.bottomOffset)&&void 0!==t||(e.bottomOffset="0px"),null!==(n=e.leftOffset)&&void 0!==n||(e.leftOffset="0px"),null!==(s=e.maxHeight)&&void 0!==s||(e.maxHeight="100px"),null!==(r=e.maxWidth)&&void 0!==r||(e.maxWidth="300px"),null!==(a=e.backgroundColor)&&void 0!==a||(e.backgroundColor="rgba(28, 28, 28, 0.7)"),this.text=e.text,null!==(c=e.fontSize)&&void 0!==c||(e.fontSize="10px"),this.container=document.createElement("div"),null!==(l=e.htmlId)&&void 0!==l||(e.htmlId=e.text),this.container.id="sponsorRectangleTooltip"+e.htmlId,this.container.style.display="relative",e.prependElement?e.referenceNode.insertBefore(this.container,e.prependElement):e.referenceNode.appendChild(this.container),e.timeout&&(this.timer=setTimeout((()=>this.close()),1e3*e.timeout)),i.render(o.createElement("div",{style:{bottom:e.bottomOffset,left:e.leftOffset,maxHeight:e.maxHeight,maxWidth:e.maxWidth,backgroundColor:e.backgroundColor,fontSize:e.fontSize},className:"sponsorBlockRectangleTooltip"},o.createElement("div",null,o.createElement("img",{className:"sponsorSkipLogo sponsorSkipObject",src:chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}),o.createElement("span",{className:"sponsorSkipObject"},this.text+(e.link?". ":""),e.link?o.createElement("a",{style:{textDecoration:"underline"},target:"_blank",rel:"noopener noreferrer",href:e.link},chrome.i18n.getMessage("LearnMore")):null)),o.createElement("button",{className:"sponsorSkipObject sponsorSkipNoticeButton",style:{float:"right"},onClick:()=>{e.buttonFunction&&e.buttonFunction(),this.close()}},chrome.i18n.getMessage("GotIt"))),this.container)}close(){i.unmountComponentAtNode(this.container),this.container.remove(),this.timer&&clearTimeout(this.timer)}}},766:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(294),i=n(935),s=new(n(593).default),r=n(710),a=n(699),c=n(913),l=n(523);t.default=class{constructor(e,t=!1,n,l=null){this.skipNoticeRef=o.createRef(),this.segments=e,this.autoSkip=t,this.contentContainer=n;const d=s.findReferenceNode(),u=document.getElementsByClassName("sponsorSkipNotice").length;let p="";for(const e of this.segments)p+=e.UUID;p+=u,this.noticeElement=document.createElement("div"),this.noticeElement.id="sponsorSkipNoticeContainer"+p,d.prepend(this.noticeElement),i.render(o.createElement(r.default,{segments:e,autoSkip:t,contentContainer:n,ref:this.skipNoticeRef,closeListener:()=>this.close(),smaller:c.default.config.noticeVisibilityMode>=a.NoticeVisbilityMode.MiniForAll||c.default.config.noticeVisibilityMode>=a.NoticeVisbilityMode.MiniForAutoSkip&&t,unskipTime:l}),this.noticeElement)}setShowKeybindHint(e){var t,n;null===(n=null===(t=this.skipNoticeRef)||void 0===t?void 0:t.current)||void 0===n||n.setState({showKeybindHint:e})}close(){i.unmountComponentAtNode(this.noticeElement),this.noticeElement.remove();const e=this.contentContainer().skipNotices;e.splice(e.indexOf(this),1)}toggleSkip(){var e,t;null===(t=null===(e=this.skipNoticeRef)||void 0===e?void 0:e.current)||void 0===t||t.prepAction(l.SkipNoticeAction.Unskip)}unmutedListener(){var e,t;null===(t=null===(e=this.skipNoticeRef)||void 0===e?void 0:e.current)||void 0===t||t.unmutedListener()}}},557:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(294),i=n(935),s=new(n(593).default),r=n(875);t.default=class{constructor(e,t){this.noticeRef=o.createRef(),this.contentContainer=e,this.callback=t;const n=s.findReferenceNode();this.noticeElement=document.createElement("div"),this.noticeElement.id="submissionNoticeContainer",n.prepend(this.noticeElement),i.render(o.createElement(r.default,{contentContainer:e,callback:t,ref:this.noticeRef,closeListener:()=>this.close()}),this.noticeElement)}update(){this.noticeRef.current.forceUpdate()}close(){i.unmountComponentAtNode(this.noticeElement),this.noticeElement.remove()}}},709:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Tooltip=void 0;const o=n(294),i=n(935);t.Tooltip=class{constructor(e){var t,n,s,r,a;null!==(t=e.bottomOffset)&&void 0!==t||(e.bottomOffset="70px"),null!==(n=e.opacity)&&void 0!==n||(e.opacity=.7),null!==(s=e.displayTriangle)&&void 0!==s||(e.displayTriangle=!0),null!==(r=e.showLogo)&&void 0!==r||(e.showLogo=!0),null!==(a=e.showGotIt)&&void 0!==a||(e.showGotIt=!0),this.text=e.text,this.container=document.createElement("div"),this.container.id="sponsorTooltip"+e.text,this.container.style.position="relative",e.prependElement?e.referenceNode.insertBefore(this.container,e.prependElement):e.referenceNode.appendChild(this.container),e.timeout&&(this.timer=setTimeout((()=>this.close()),1e3*e.timeout));const c=`rgba(28, 28, 28, ${e.opacity})`;i.render(o.createElement("div",{style:{bottom:e.bottomOffset,backgroundColor:c},className:"sponsorBlockTooltip"+(e.displayTriangle?" sbTriangle":"")},o.createElement("div",null,e.showLogo?o.createElement("img",{className:"sponsorSkipLogo sponsorSkipObject",src:chrome.extension.getURL("icons/IconSponsorBlocker256px.png")}):null,o.createElement("span",{className:"sponsorSkipObject"},this.text+(e.link?". ":""),e.link?o.createElement("a",{style:{textDecoration:"underline"},target:"_blank",rel:"noopener noreferrer",href:e.link},chrome.i18n.getMessage("LearnMore")):null)),e.showGotIt?o.createElement("button",{className:"sponsorSkipObject sponsorSkipNoticeButton",style:{float:"right"},onClick:()=>this.close()},chrome.i18n.getMessage("GotIt")):null),this.container)}close(){i.unmountComponentAtNode(this.container),this.container.remove(),this.timer&&clearTimeout(this.timer)}}},984:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(294);t.default=({fill:e="#ffffff"})=>o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:e},o.createElement("path",{d:"M14.1 7.1l2.9 2.9L6.1 20.7l-3.6.7.7-3.6L14.1 7.1zm0-2.8L1.4 16.9 0 24l7.1-1.4L19.8 9.9l-5.7-5.7zm7.1 4.3L24 5.7 18.3 0l-2.8 2.8 5.7 5.7z"}))},215:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(294);t.default=({fill:e="#ffffff"})=>o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:e,viewBox:"0 0 24 24"},o.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),o.createElement("path",{d:"M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm4 0v12h4V3h-4z"}))},94:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(294);t.default=({fill:e="#ffffff"})=>o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:e,viewBox:"0 0 24 24"},o.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),o.createElement("path",{d:"M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2z"}))},523:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.downvoteButtonColor=t.SkipNoticeAction=void 0;const o=n(913);var i;(i=t.SkipNoticeAction||(t.SkipNoticeAction={}))[i.None=0]="None",i[i.Upvote=1]="Upvote",i[i.Downvote=2]="Downvote",i[i.CategoryVote=3]="CategoryVote",i[i.CopyDownvote=4]="CopyDownvote",i[i.Unskip=5]="Unskip",t.downvoteButtonColor=function(e,t,n){return(null==e?void 0:e.length)>1?t===n?o.default.config.colorPalette.red:o.default.config.colorPalette.white:o.default.config.isVip&&1===(null==e?void 0:e[0].locked)?o.default.config.colorPalette.locked:o.default.config.colorPalette.white}},315:(e,t)=>{function n(e){var t,n,o;if(!e)return 0;const i=/(?:(\d{1,3})h)?(?:(\d{1,2})m)?(\d+)s?/.exec(e);return i?3600*parseInt(null!==(t=i[1])&&void 0!==t?t:"0",10)+60*parseInt(null!==(n=i[2])&&void 0!==n?n:"0",10)+parseInt(null!==(o=i[3])&&void 0!==o?o:"0",10):/\d+/.test(e)?parseInt(e,10):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t.urlTimeToSeconds=t.getStartTimeFromUrl=void 0,t.getStartTimeFromUrl=function(e){const t=new URLSearchParams(e);return n((null==t?void 0:t.get("t"))||(null==t?void 0:t.get("time_continue")))},t.urlTimeToSeconds=n}},n={};function o(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}};return t[e].call(s.exports,s,s.exports,o),s.exports}o.m=t,e=[],o.O=(t,n,i,s)=>{if(!n){var r=1/0;for(d=0;d<e.length;d++){for(var[n,i,s]=e[d],a=!0,c=0;c<n.length;c++)(!1&s||r>=s)&&Object.keys(o.O).every((e=>o.O[e](n[c])))?n.splice(c--,1):(a=!1,s<r&&(r=s));if(a){e.splice(d--,1);var l=i();void 0!==l&&(t=l)}}return t}s=s||0;for(var d=e.length;d>0&&e[d-1][2]>s;d--)e[d]=e[d-1];e[d]=[n,i,s]},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={998:0,42:0};o.O.j=t=>0===e[t];var t=(t,n)=>{var i,s,[r,a,c]=n,l=0;if(r.some((t=>0!==e[t]))){for(i in a)o.o(a,i)&&(o.m[i]=a[i]);if(c)var d=c(o)}for(t&&t(n);l<r.length;l++)s=r[l],o.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return o.O(d)},n=self.webpackChunksponsorblock=self.webpackChunksponsorblock||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var i=o.O(void 0,[736],(()=>o(144)));i=o.O(i)})();