UNPKG

@duell10111/youtubei.js

Version:

A JavaScript client for YouTube's private API, known as InnerTube.

6 lines 681 kB
/* eslint-disable */ var Hk=Object.defineProperty;var r=(t,e)=>Hk(t,"name",{value:e,configurable:!0});var Ie=(t,e)=>{for(var i in e)Hk(t,i,{get:e[i],enumerable:!0})};function qk(t,e,i){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:i?"".concat(i," ",e):e})}r(qk,"__setFunctionName");function c(t,e,i,n){if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}r(c,"__classPrivateFieldGet");function w(t,e,i,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,i):o?o.value=i:e.set(t,i),i}r(w,"__classPrivateFieldSet");var xI={};Ie(xI,{ChannelError:()=>fr,InnertubeError:()=>_,MissingParamError:()=>Gx,OAuth2Error:()=>Se,ParsingError:()=>gt,Platform:()=>B,PlayerError:()=>si,SessionError:()=>as,base64ToU8:()=>bI,concatMemos:()=>BI,debugFetch:()=>qM,deepCompare:()=>Qx,escapeStringRegexp:()=>fk,findFunction:()=>jx,generateRandomString:()=>ut,generateSidAuth:()=>aI,getCookie:()=>cI,getRandomUserAgent:()=>uo,getStringBetweenStrings:()=>lt,hasKeys:()=>HM,isTextRun:()=>at,streamToIterable:()=>oI,throwIfMissing:()=>J,timeToSeconds:()=>Be,u8ToBase64:()=>Ee});var nI={};Ie(nI,{Maybe:()=>so,Memo:()=>sn,SuperParsedResult:()=>ai,YTNode:()=>a,observe:()=>O});var V={};Ie(V,{Level:()=>Vt,debug:()=>QR,error:()=>JR,info:()=>XR,setLevel:()=>ZR,warn:()=>Oi,warnOnce:()=>zR});var $R="YOUTUBEJS",Vt={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},Kk={[Vt.ERROR]:(...t)=>console.error(...t),[Vt.WARNING]:(...t)=>console.warn(...t),[Vt.INFO]:(...t)=>console.info(...t),[Vt.DEBUG]:(...t)=>console.debug(...t)},zk=[Vt.WARNING],$k=new Set;function Sa(t,e,i){if(!Kk[t]||!zk.includes(t))return;let n=[`[${$R}]`];e&&n.push(`[${e}]`),Kk[t](`${n.join("")}:`,...i||[])}r(Sa,"doLog");var zR=r((t,...e)=>{$k.has(t)||(Sa(Vt.WARNING,t,e),$k.add(t))},"warnOnce"),Oi=r((t,...e)=>Sa(Vt.WARNING,t,e),"warn"),JR=r((t,...e)=>Sa(Vt.ERROR,t,e),"error"),XR=r((t,...e)=>Sa(Vt.INFO,t,e),"info"),QR=r((t,...e)=>Sa(Vt.DEBUG,t,e),"debug");function ZR(...t){zk=t}r(ZR,"setLevel");var iI,Jk,Re,ce,ri,Li,oo,Xk=Symbol("ObservedArray.isObserved"),a=class{constructor(){iI.add(this),this.type=this.constructor.type}is(...e){return e.some(i=>c(this,iI,"m",Jk).call(this,i))}as(...e){if(!this.is(...e))throw new gt(`Cannot cast ${this.type} to one of ${e.map(i=>i.type).join(", ")}`);return this}hasKey(e){return Reflect.has(this,e)}key(e){if(!this.hasKey(e))throw new gt(`Missing key ${e}`);return new so(this[e])}};r(a,"YTNode");iI=new WeakSet,Jk=r(function(e){return this.type===e.type},"_YTNode_is");a.type="YTNode";var e3="Maybe",so=class{constructor(e){Re.add(this),ce.set(this,void 0),w(this,ce,e,"f")}get typeof(){return typeof c(this,ce,"f")}string(){return c(this,Re,"m",Li).call(this,"string")}isString(){return c(this,Re,"m",ri).call(this,"string")}number(){return c(this,Re,"m",Li).call(this,"number")}isNumber(){return c(this,Re,"m",ri).call(this,"number")}bigint(){return c(this,Re,"m",Li).call(this,"bigint")}isBigint(){return c(this,Re,"m",ri).call(this,"bigint")}boolean(){return c(this,Re,"m",Li).call(this,"boolean")}isBoolean(){return c(this,Re,"m",ri).call(this,"boolean")}symbol(){return c(this,Re,"m",Li).call(this,"symbol")}isSymbol(){return c(this,Re,"m",ri).call(this,"symbol")}undefined(){return c(this,Re,"m",Li).call(this,"undefined")}isUndefined(){return c(this,Re,"m",ri).call(this,"undefined")}null(){if(c(this,ce,"f")!==null)throw new TypeError(`Expected null, got ${typeof c(this,ce,"f")}`);return c(this,ce,"f")}isNull(){return c(this,ce,"f")===null}object(){return c(this,Re,"m",Li).call(this,"object")}isObject(){return c(this,Re,"m",ri).call(this,"object")}function(){return c(this,Re,"m",Li).call(this,"function")}isFunction(){return c(this,Re,"m",ri).call(this,"function")}array(){if(!Array.isArray(c(this,ce,"f")))throw new TypeError(`Expected array, got ${typeof c(this,ce,"f")}`);return c(this,ce,"f")}arrayOfMaybe(){let e=[];return new Proxy(this.array(),{get(i,n){return Reflect.has(e,n)?Reflect.get(i,n):new so(Reflect.get(i,n))}})}isArray(){return Array.isArray(c(this,ce,"f"))}node(){if(!(c(this,ce,"f")instanceof a))throw new TypeError(`Expected YTNode, got ${c(this,ce,"f").constructor.name}`);return c(this,ce,"f")}isNode(){return c(this,ce,"f")instanceof a}nodeOfType(...e){return this.node().as(...e)}isNodeOfType(...e){return this.isNode()&&this.node().is(...e)}observed(){if(!this.isObserved())throw new TypeError(`Expected ObservedArray, got ${typeof c(this,ce,"f")}`);return c(this,ce,"f")}isObserved(){var e;return(e=c(this,ce,"f"))==null?void 0:e[Xk]}parsed(){if(!(c(this,ce,"f")instanceof ai))throw new TypeError(`Expected SuperParsedResult, got ${typeof c(this,ce,"f")}`);return c(this,ce,"f")}isParsed(){return c(this,ce,"f")instanceof ai}any(){return Oi(e3,"This call is not meant to be used outside of debugging. Please use the specific type getter instead."),c(this,ce,"f")}instanceof(e){if(!this.isInstanceof(e))throw new TypeError(`Expected instance of ${e.name}, got ${c(this,ce,"f").constructor.name}`);return c(this,ce,"f")}isInstanceof(e){return c(this,ce,"f")instanceof e}};r(so,"Maybe");ce=new WeakMap,Re=new WeakSet,ri=r(function(e){return typeof c(this,ce,"f")===e},"_Maybe_checkPrimitive"),Li=r(function(e){if(!c(this,Re,"m",ri).call(this,e))throw new TypeError(`Expected ${e}, got ${this.typeof}`);return c(this,ce,"f")},"_Maybe_assertPrimitive");var ai=class{constructor(e){oo.set(this,void 0),w(this,oo,e,"f")}get is_null(){return c(this,oo,"f")===null}get is_array(){return!this.is_null&&Array.isArray(c(this,oo,"f"))}get is_node(){return!this.is_array}array(){if(!this.is_array)throw new TypeError("Expected an array, got a node");return c(this,oo,"f")}item(){if(!this.is_node)throw new TypeError("Expected a node, got an array");return c(this,oo,"f")}};r(ai,"SuperParsedResult");oo=new WeakMap;function O(t){return new Proxy(t,{get(e,i){return i=="get"?(n,o)=>e.find((s,l)=>{let f=Qx(n,s);return f&&o&&e.splice(l,1),f}):i==Xk?!0:i=="getAll"?(n,o)=>e.filter((s,l)=>{let f=Qx(n,s);return f&&o&&e.splice(l,1),f}):i=="matchCondition"?n=>e.find(o=>n(o)):i=="filterType"?(...n)=>O(e.filter(o=>!!o.is(...n))):i=="firstOfType"?(...n)=>e.find(o=>!!o.is(...n)):i=="first"?()=>e[0]:i=="as"?(...n)=>O(e.map(o=>{if(o.is(...n))return o;throw new gt(`Expected node of any type ${n.map(s=>s.type).join(", ")}, got ${o.type}`)})):i=="remove"?n=>e.splice(n,1):Reflect.get(e,i)}})}r(O,"observe");var sn=class extends Map{getType(...e){return e=e.flat(),O(e.flatMap(i=>this.get(i.type)||[]))}};r(sn,"Memo");var KI={};Ie(KI,{Author:()=>A,ChildElement:()=>pw,EmojiRun:()=>pn,Format:()=>Ev,RendererContext:()=>Le,Text:()=>p,TextRun:()=>ln,Thumbnail:()=>y,VideoDetails:()=>Ln});var z={};Ie(z,{CLIENTS:()=>K,INNERTUBE_HEADERS_BASE:()=>i3,OAUTH:()=>t3,STREAM_HEADERS:()=>Bi,SUPPORTED_CLIENTS:()=>Zx,URLS:()=>Xe});var Xe=Object.freeze({YT_BASE:"https://www.youtube.com",YT_MUSIC_BASE:"https://music.youtube.com",YT_SUGGESTIONS:"https://suggestqueries-clients6.youtube.com",YT_UPLOAD:"https://upload.youtube.com/",API:Object.freeze({BASE:"https://youtubei.googleapis.com",PRODUCTION_1:"https://www.youtube.com/youtubei/",PRODUCTION_2:"https://youtubei.googleapis.com/youtubei/",STAGING:"https://green-youtubei.sandbox.googleapis.com/youtubei/",RELEASE:"https://release-youtubei.sandbox.googleapis.com/youtubei/",TEST:"https://test-youtubei.sandbox.googleapis.com/youtubei/",CAMI:"http://cami-youtubei.sandbox.googleapis.com/youtubei/",UYTFE:"https://uytfe.sandbox.google.com/youtubei/"}),GOOGLE_SEARCH_BASE:"https://www.google.com/"}),t3=Object.freeze({REGEX:Object.freeze({TV_SCRIPT:new RegExp('<script\\s+id="base-js"\\s+src="([^"]+)"[^>]*><\\/script>'),CLIENT_IDENTITY:new RegExp('clientId:"(?<client_id>[^"]+)",[^"]*?:"(?<client_secret>[^"]+)"')})}),K=Object.freeze({IOS:{NAME_ID:"5",NAME:"iOS",VERSION:"18.06.35",USER_AGENT:"com.google.ios.youtube/18.06.35 (iPhone; CPU iPhone OS 14_4 like Mac OS X; en_US)",DEVICE_MODEL:"iPhone10,6"},WEB:{NAME_ID:"1",NAME:"WEB",VERSION:"2.20241121.01.00",API_KEY:"AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",API_VERSION:"v1",STATIC_VISITOR_ID:"6zpwvWUNAco",SUGG_EXP_ID:"ytzpb5_e2,ytpo.bo.lqp.elu=1,ytpo.bo.lqp.ecsc=1,ytpo.bo.lqp.mcsc=3,ytpo.bo.lqp.mec=1,ytpo.bo.lqp.rw=0.8,ytpo.bo.lqp.fw=0.2,ytpo.bo.lqp.szp=1,ytpo.bo.lqp.mz=3,ytpo.bo.lqp.al=en_us,ytpo.bo.lqp.zrm=1,ytpo.bo.lqp.er=1,ytpo.bo.ro.erl=1,ytpo.bo.ro.mlus=3,ytpo.bo.ro.erls=3,ytpo.bo.qfo.mlus=3,ytzprp.ppp.e=1,ytzprp.ppp.st=772,ytzprp.ppp.p=5"},MWEB:{NAME_ID:"2",NAME:"MWEB",VERSION:"2.20241205.01.00",API_VERSION:"v1"},WEB_KIDS:{NAME_ID:"76",NAME:"WEB_KIDS",VERSION:"2.20230111.00.00"},YTMUSIC:{NAME_ID:"67",NAME:"WEB_REMIX",VERSION:"1.20211213.00.00"},ANDROID:{NAME_ID:"3",NAME:"ANDROID",VERSION:"19.35.36",SDK_VERSION:33,USER_AGENT:"com.google.android.youtube/19.35.36(Linux; U; Android 13; en_US; SM-S908E Build/TP1A.220624.014) gzip"},YTSTUDIO_ANDROID:{NAME_ID:"14",NAME:"ANDROID_CREATOR",VERSION:"22.43.101"},YTMUSIC_ANDROID:{NAME_ID:"21",NAME:"ANDROID_MUSIC",VERSION:"5.34.51"},TV:{NAME_ID:"7",NAME:"TVHTML5",VERSION:"7.20240424.00.00",USER_AGENT:"Mozilla/5.0 (Linux armeabi-v7a; Android 7.1.2; Fire OS 6.0) Cobalt/22.lts.3.306369-gold (unlike Gecko) v8/8.8.278.8-jit gles Starboard/13, Amazon_ATV_mediatek8695_2019/NS6294 (Amazon, AFTMM, Wireless) com.amazon.firetv.youtube/22.3.r2.v66.0"},TV_EMBEDDED:{NAME_ID:"85",NAME:"TVHTML5_SIMPLY_EMBEDDED_PLAYER",VERSION:"2.0"},WEB_EMBEDDED:{NAME_ID:"56",NAME:"WEB_EMBEDDED_PLAYER",VERSION:"2.20240111.09.00",API_KEY:"AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",API_VERSION:"v1",STATIC_VISITOR_ID:"6zpwvWUNAco"},WEB_CREATOR:{NAME_ID:"62",NAME:"WEB_CREATOR",VERSION:"1.20240918.03.00",API_KEY:"AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",API_VERSION:"v1",STATIC_VISITOR_ID:"6zpwvWUNAco"}}),Bi=Object.freeze({accept:"*/*",origin:"https://www.youtube.com",referer:"https://www.youtube.com",DNT:"?1"}),i3=Object.freeze({accept:"*/*","accept-encoding":"gzip, deflate","content-type":"application/json"}),Zx=["IOS","WEB","MWEB","YTKIDS","YTMUSIC","ANDROID","YTSTUDIO_ANDROID","YTMUSIC_ANDROID","TV","TV_EMBEDDED","WEB_EMBEDDED","WEB_CREATOR"];var u={};Ie(u,{addRuntimeParser:()=>PI,applyCommentsMutations:()=>gP,applyMutations:()=>yP,getDynamicParsers:()=>ZA,getParserByName:()=>rr,hasParser:()=>px,parse:()=>Ze,parseActions:()=>xP,parseArray:()=>$e,parseC:()=>bP,parseCommand:()=>_P,parseCommands:()=>nM,parseFormats:()=>MI,parseItem:()=>te,parseLC:()=>AI,parseRR:()=>Cv,parseResponse:()=>RI,sanitizeClassName:()=>ar,setParserErrorHandler:()=>XA,shouldIgnore:()=>OI});var wo={};Ie(wo,{AboutChannel:()=>by,AboutChannelView:()=>_y,AccountChannel:()=>xy,AccountItem:()=>ds,AccountItemSection:()=>gy,AccountItemSectionHeader:()=>yy,AccountSectionList:()=>wy,ActiveAccountHeader:()=>aE,AddBannerToLiveChatCommand:()=>UC,AddChatItemAction:()=>Yw,AddLiveChatTickerItemAction:()=>VC,AddToPlaylist:()=>cE,AddToPlaylistCommand:()=>CE,AddToPlaylistEndpoint:()=>JE,AddToPlaylistServiceEndpoint:()=>fw,Alert:()=>ms,AlertWithButton:()=>Ay,AnchoredSection:()=>gv,AppendContinuationItemsAction:()=>ot,AttributionView:()=>My,AudioOnlyPlayability:()=>Dy,AuthorCommentBadge:()=>ME,AutomixPreviewVideo:()=>dn,AutonavEndpoint:()=>dw,AutoplayEndpoint:()=>hw,AvatarLockup:()=>Oy,AvatarStackView:()=>Ly,AvatarView:()=>_s,BackgroundPromo:()=>uE,BackstageImage:()=>By,BackstagePost:()=>mn,BackstagePostThread:()=>pE,BadgeView:()=>_n,BrowseEndpoint:()=>XE,BrowseFeedActions:()=>jy,BrowserMediaSession:()=>lE,BumperUserEduContentView:()=>Fw,Button:()=>k,ButtonCardView:()=>fE,ButtonView:()=>pe,C4TabbedHeader:()=>Tn,CallToActionButton:()=>dE,Card:()=>hE,CardCollection:()=>kg,CarouselHeader:()=>Sg,CarouselItem:()=>mE,CarouselItemView:()=>Cg,CarouselLockup:()=>dg,CarouselTitleView:()=>Ng,ChangeEngagementPanelVisibilityAction:()=>eE,Channel:()=>Pg,ChannelAboutFullMetadata:()=>ip,ChannelAgeGate:()=>_E,ChannelExternalLinkView:()=>my,ChannelFeaturedContent:()=>bE,ChannelHeaderLinks:()=>Hy,ChannelHeaderLinksView:()=>qy,ChannelMetadata:()=>Rg,ChannelMobileHeader:()=>xE,ChannelOptions:()=>Ag,ChannelOwnerEmptyState:()=>yE,ChannelSubMenu:()=>pp,ChannelSwitcherHeader:()=>gE,ChannelSwitcherPage:()=>vy,ChannelTagline:()=>vg,ChannelThumbnailWithLink:()=>wE,ChannelVideoPlayer:()=>TE,Chapter:()=>Mg,ChildVideo:()=>vE,ChipBarView:()=>IE,ChipCloud:()=>Tt,ChipCloudChip:()=>be,ChipView:()=>Dg,ClientSideToggleMenuItem:()=>kE,ClipAdState:()=>zy,ClipCreation:()=>Jy,ClipCreationScrubber:()=>$y,ClipCreationTextInput:()=>Ky,ClipSection:()=>Xy,CollaboratorInfoCardContent:()=>SE,CollageHeroImage:()=>EE,CollectionThumbnailView:()=>Vg,CommandExecutorCommand:()=>NE,CommentActionButtons:()=>Vy,CommentDialog:()=>DE,CommentReplies:()=>Gg,CommentReplyDialog:()=>jg,CommentSimplebox:()=>$g,CommentThread:()=>Jg,CommentView:()=>fo,CommentsEntryPoint:()=>yg,CommentsEntryPointHeader:()=>Kg,CommentsEntryPointTeaser:()=>qg,CommentsHeader:()=>vn,CommentsSimplebox:()=>Hg,CompactChannel:()=>BE,CompactLink:()=>fn,CompactMix:()=>UE,CompactMovie:()=>VE,CompactPlaylist:()=>YE,CompactStation:()=>FE,CompactVideo:()=>vs,ConfirmDialog:()=>WE,ContentMetadataView:()=>Cs,ContentPreviewImageView:()=>xn,ContinuationCommand:()=>PE,ContinuationItem:()=>le,ConversationBar:()=>GE,CopyLink:()=>Ns,CreateCommentEndpoint:()=>QE,CreatePlaylistDialog:()=>fy,CreatePlaylistDialogFormView:()=>Zg,CreatePlaylistServiceEndpoint:()=>ZE,CreatorHeart:()=>Uy,CreatorHeartView:()=>Ww,DecoratedAvatarView:()=>Ps,DecoratedPlayerBar:()=>nw,DefaultPromoPanel:()=>jE,DeletePlaylistEndpoint:()=>eC,DescriptionPreviewView:()=>ow,DialogHeaderView:()=>sw,DialogView:()=>HE,DidYouMean:()=>cw,DimChatItemAction:()=>YC,DislikeButtonView:()=>Fy,DownloadButton:()=>bs,Dropdown:()=>cn,DropdownItem:()=>ly,DropdownView:()=>Xg,DynamicTextView:()=>uw,Element:()=>lw,EmergencyOnebox:()=>qE,EmojiPicker:()=>Wg,EmojiPickerCategory:()=>KE,EmojiPickerCategoryButton:()=>$E,EmojiPickerUpsellCategory:()=>zE,EndScreenPlaylist:()=>bw,EndScreenVideo:()=>xw,Endscreen:()=>_w,EndscreenElement:()=>yC,EngagementPanelSectionList:()=>wn,EngagementPanelTitleHeader:()=>Qy,EntityMetadata:()=>gw,EomSettingsDisclaimer:()=>gC,ExpandableMetadata:()=>rg,ExpandableTab:()=>Ms,ExpandableVideoDescriptionBody:()=>ig,ExpandedShelfContents:()=>wC,Factoid:()=>gn,FancyDismissibleDialog:()=>TC,FeedFilterChipBar:()=>zt,FeedNudge:()=>vC,FeedTabbedHeader:()=>ww,FeedbackEndpoint:()=>tC,FlexibleActionsView:()=>xs,FormFooterView:()=>aw,GameCard:()=>ng,GameDetails:()=>IC,GetAccountsListInnertubeEndpoint:()=>iC,GetKidsBlocklistPickerCommand:()=>RE,GetMultiPageMenuAction:()=>tE,Grid:()=>Ae,GridChannel:()=>Tw,GridHeader:()=>kC,GridMix:()=>SC,GridMovie:()=>EC,GridPlaylist:()=>vw,GridShow:()=>CC,GridVideo:()=>Sw,GuideCollapsibleEntry:()=>NC,GuideCollapsibleSectionEntry:()=>PC,GuideDownloadsEntry:()=>RC,GuideEntry:()=>go,GuideSection:()=>Ds,GuideSubscriptionsSection:()=>Ew,HashtagHeader:()=>Cw,HashtagTile:()=>AC,HeatMarker:()=>ew,Heatmap:()=>tw,HeroPlaylistThumbnail:()=>MC,HideEngagementPanelEndpoint:()=>nC,HighlightsCarousel:()=>Wf,HistorySuggestion:()=>DC,HorizontalButtonList:()=>OC,HorizontalCardList:()=>bn,HorizontalList:()=>ws,HorizontalMovieList:()=>LC,HowThisWasMadeSectionView:()=>bg,IconLink:()=>Pw,ImageBannerView:()=>Rw,IncludingResultsFor:()=>BC,InfoPanelContainer:()=>Mw,InfoPanelContent:()=>Aw,InfoRow:()=>fg,InteractiveTabbedHeader:()=>Dw,ItemSection:()=>fe,ItemSectionHeader:()=>Os,ItemSectionTab:()=>Ow,ItemSectionTabbedHeader:()=>Ls,KidsBlocklistPicker:()=>oP,KidsBlocklistPickerItem:()=>or,KidsCategoriesHeader:()=>wv,KidsCategoryTab:()=>sr,KidsHomeScreen:()=>Tv,LikeButton:()=>hn,LikeButtonView:()=>Yy,LikeEndpoint:()=>oC,Line:()=>As,LineItem:()=>yw,LiveChat:()=>Bw,LiveChatActionPanel:()=>Kw,LiveChatAuthorBadge:()=>Hw,LiveChatAutoModMessage:()=>FC,LiveChatBanner:()=>Vw,LiveChatBannerChatSummary:()=>WC,LiveChatBannerHeader:()=>Uw,LiveChatBannerPoll:()=>GC,LiveChatBannerRedirect:()=>jC,LiveChatDialog:()=>x1,LiveChatHeader:()=>Zw,LiveChatItemBumperView:()=>Gw,LiveChatItemContextMenuEndpoint:()=>sC,LiveChatItemList:()=>eT,LiveChatMembershipItem:()=>HC,LiveChatMessageInput:()=>y1,LiveChatModeChangeMessage:()=>qC,LiveChatPaidMessage:()=>KC,LiveChatPaidSticker:()=>$C,LiveChatParticipant:()=>tT,LiveChatParticipantsList:()=>iT,LiveChatPlaceholderItem:()=>zC,LiveChatProductItem:()=>JC,LiveChatRestrictedParticipation:()=>XC,LiveChatSponsorshipsGiftPurchaseAnnouncement:()=>QC,LiveChatSponsorshipsGiftRedemptionAnnouncement:()=>ZC,LiveChatSponsorshipsHeader:()=>qw,LiveChatTextMessage:()=>e1,LiveChatTickerPaidMessageItem:()=>t1,LiveChatTickerPaidStickerItem:()=>i1,LiveChatTickerSponsorItem:()=>n1,LiveChatViewerEngagementMessage:()=>o1,LockupMetadataView:()=>nT,LockupView:()=>oT,MacroMarkersInfoItem:()=>Zy,MacroMarkersList:()=>eg,MacroMarkersListItem:()=>gs,MacroMarkersListView:()=>wg,MarkChatItemAsDeletedAction:()=>r1,MarkChatItemsByAuthorAsDeletedAction:()=>a1,MaybeHistoryEndpoint:()=>ph,Menu:()=>L,MenuFlexibleItem:()=>Gy,MenuNavigationItem:()=>rT,MenuPopup:()=>g1,MenuServiceItem:()=>ci,MenuServiceItemDownload:()=>Wy,MenuTitle:()=>Py,MerchandiseItem:()=>T1,MerchandiseShelf:()=>pT,Message:()=>qe,MetadataBadge:()=>ft,MetadataRow:()=>v1,MetadataRowContainer:()=>lT,MetadataRowHeader:()=>I1,MetadataScreen:()=>k1,MicroformatData:()=>fi,Mix:()=>S1,MobileTopbar:()=>W1,ModalWithTitleAndButton:()=>E1,ModifyChannelNotificationPreferenceEndpoint:()=>rC,Movie:()=>C1,MovingThumbnail:()=>N1,MultiMarkersPlayerBar:()=>iw,MultiPageMenu:()=>Ty,MultiPageMenuNotificationSection:()=>w1,MultiPageMenuSection:()=>G1,MusicCardShelf:()=>dT,MusicCardShelfHeaderBasic:()=>fT,MusicCarouselShelf:()=>Ye,MusicCarouselShelfBasicHeader:()=>hT,MusicDescriptionShelf:()=>kn,MusicDetailHeader:()=>Ws,MusicDownloadStateBadge:()=>V1,MusicEditablePlaylistDetailHeader:()=>xT,MusicElementHeader:()=>$h,MusicHeader:()=>Sn,MusicImmersiveHeader:()=>yT,MusicInlineBadge:()=>Bs,MusicItemThumbnailOverlay:()=>di,MusicLargeCardItemCarousel:()=>Y1,MusicMenuItemDivider:()=>aT,MusicMultiRowListItem:()=>mT,MusicMultiSelectMenu:()=>cT,MusicMultiSelectMenuItem:()=>li,MusicNavigationButton:()=>Vs,MusicPlayButton:()=>Us,MusicPlaylistEditHeader:()=>F1,MusicPlaylistShelf:()=>To,MusicQueue:()=>Gs,MusicResponsiveHeader:()=>js,MusicResponsiveListItem:()=>Ct,MusicResponsiveListItemFixedColumn:()=>_T,MusicResponsiveListItemFlexColumn:()=>bT,MusicShelf:()=>ye,MusicSideAlignedItem:()=>wT,MusicSortFilterButton:()=>pm,MusicTastebuilderShelf:()=>vT,MusicTastebuilderShelfThumbnail:()=>TT,MusicThumbnail:()=>ze,MusicTwoRowItem:()=>Fs,MusicVisualHeader:()=>IT,NavigationEndpoint:()=>h,NextContinuationData:()=>og,Notification:()=>kT,NotificationAction:()=>K1,OpenPopupAction:()=>fs,OverlayPanelHeader:()=>Tg,PageHeader:()=>hi,PageHeaderView:()=>ST,PageIntroduction:()=>ET,PanelFooterView:()=>rw,PdgCommentChip:()=>OE,PdgReplyButtonView:()=>jw,PerformCommentActionEndpoint:()=>aC,PivotBar:()=>j1,PivotBarItem:()=>H1,PivotButton:()=>CT,PivotVideo:()=>$1,PlayerAnnotationsExpanded:()=>NT,PlayerCaptionsTracklist:()=>PT,PlayerControlsOverlay:()=>z1,PlayerErrorMessage:()=>J1,PlayerLegacyDesktopYpcOffer:()=>X1,PlayerLegacyDesktopYpcTrailer:()=>Dm,PlayerLiveStoryboardSpec:()=>AT,PlayerMicroformat:()=>kt,PlayerOverflow:()=>RT,PlayerOverlay:()=>mi,PlayerOverlayAutoplay:()=>MT,PlayerOverlayVideoDetails:()=>DT,PlayerStoryboardSpec:()=>ao,Playlist:()=>pi,PlaylistAddToOption:()=>Ry,PlaylistCustomThumbnail:()=>Ss,PlaylistEditEndpoint:()=>cC,PlaylistHeader:()=>LT,PlaylistInfoCardContent:()=>Q1,PlaylistMetadata:()=>BT,PlaylistPanel:()=>Jt,PlaylistPanelVideo:()=>Wi,PlaylistPanelVideoWrapper:()=>gT,PlaylistSidebar:()=>Z1,PlaylistSidebarPrimaryInfo:()=>UT,PlaylistSidebarSecondaryInfo:()=>VT,PlaylistThumbnailOverlay:()=>eN,PlaylistVideo:()=>Hs,PlaylistVideoList:()=>YT,PlaylistVideoThumbnail:()=>Es,Poll:()=>tN,PollHeader:()=>s1,Post:()=>qs,PostMultiImage:()=>iN,PrefetchWatchCommand:()=>uC,PremiereTrailerBadge:()=>nN,PreviewButton:()=>sT,ProductList:()=>tg,ProductListHeader:()=>oN,ProductListItem:()=>sN,ProfileColumn:()=>rN,ProfileColumnStats:()=>aN,ProfileColumnStatsEntry:()=>cN,ProfileColumnUserInfo:()=>uN,QrCode:()=>pN,Quiz:()=>lN,RecognitionShelf:()=>fN,ReelItem:()=>Ks,ReelPlayerHeader:()=>FT,ReelPlayerOverlay:()=>dN,ReelShelf:()=>ks,ReelWatchEndpoint:()=>pC,RelatedChipCloud:()=>WT,ReloadContinuationData:()=>sg,RemoveBannerForLiveChatCommand:()=>c1,RemoveChatItemAction:()=>u1,RemoveChatItemByAuthorAction:()=>p1,ReplaceChatItemAction:()=>l1,ReplaceLiveChatAction:()=>f1,ReplayChatItemAction:()=>d1,RichGrid:()=>En,RichItem:()=>hN,RichListHeader:()=>mN,RichMetadata:()=>b_,RichMetadataRow:()=>y_,RichSection:()=>_N,RichShelf:()=>GT,RunAttestationCommand:()=>Yg,SearchBox:()=>bN,SearchEndpoint:()=>lC,SearchFilter:()=>jT,SearchFilterGroup:()=>$s,SearchFilterOptionsDialog:()=>xN,SearchHeader:()=>HT,SearchRefinementCard:()=>po,SearchSubMenu:()=>qT,SearchSuggestion:()=>Nw,SearchSuggestionsSection:()=>KT,SecondarySearchContainer:()=>yN,SectionList:()=>Y,SegmentedLikeDislikeButton:()=>Io,SegmentedLikeDislikeButtonView:()=>Ui,SendFeedbackAction:()=>iE,SettingBoolean:()=>gN,SettingsCheckbox:()=>$T,SettingsOptions:()=>Js,SettingsSidebar:()=>zT,SettingsSwitch:()=>zs,ShareEndpoint:()=>fC,ShareEntityEndpoint:()=>dC,ShareEntityServiceEndpoint:()=>Rs,SharePanelHeader:()=>XT,SharePanelTitleV15:()=>wN,ShareTarget:()=>QT,SharedPost:()=>JT,Shelf:()=>Xs,ShelfHeader:()=>ZT,ShortsLockupView:()=>Qs,ShowCustomThumbnail:()=>Iw,ShowDialogCommand:()=>AE,ShowEngagementPanelEndpoint:()=>hC,ShowLiveChatActionPanelAction:()=>h1,ShowLiveChatDialogAction:()=>m1,ShowLiveChatTooltipCommand:()=>_1,ShowingResultsFor:()=>ev,SignalAction:()=>nE,SignalServiceEndpoint:()=>mC,SimpleCardContent:()=>TN,SimpleCardTeaser:()=>vN,SimpleMenuHeader:()=>uT,SimpleTextSection:()=>IN,SingleActionEmergencySupport:()=>kN,SingleColumnBrowseResults:()=>Cn,SingleColumnMusicWatchNextResults:()=>SN,SingleColumnWatchNextResults:()=>tv,SingleHeroImage:()=>EN,SlimOwner:()=>CN,SlimVideoMetadata:()=>iv,SortFilterHeader:()=>Lw,SortFilterSubMenu:()=>Wt,SponsorCommentBadge:()=>LE,StartAt:()=>nv,StructuredDescriptionContent:()=>lo,StructuredDescriptionPlaylistLockup:()=>hg,SubFeedOption:()=>ov,SubFeedSelector:()=>NN,SubscribeButton:()=>Ue,SubscribeEndpoint:()=>_C,SubscriptionNotificationToggleButton:()=>Ig,Tab:()=>oe,Tabbed:()=>PN,TabbedSearchResults:()=>sv,TextCarouselItemView:()=>Eg,TextFieldView:()=>Qg,TextHeader:()=>RN,ThirdPartyShareTargetSection:()=>rv,ThumbnailBadgeView:()=>Lg,ThumbnailHoverOverlayView:()=>Og,ThumbnailLandscapePortrait:()=>AN,ThumbnailOverlayBadgeView:()=>Bg,ThumbnailOverlayBottomPanel:()=>kw,ThumbnailOverlayEndorsement:()=>MN,ThumbnailOverlayHoverText:()=>DN,ThumbnailOverlayIcon:()=>av,ThumbnailOverlayInlineUnplayable:()=>ON,ThumbnailOverlayLoadingPreview:()=>LN,ThumbnailOverlayNowPlaying:()=>BN,ThumbnailOverlayPinking:()=>UN,ThumbnailOverlayPlaybackStatus:()=>VN,ThumbnailOverlayResumePlayback:()=>cv,ThumbnailOverlaySidePanel:()=>YN,ThumbnailOverlayStackingEffect:()=>uv,ThumbnailOverlayTimeStatus:()=>jt,ThumbnailOverlayToggleButton:()=>FN,ThumbnailView:()=>Ug,Tile:()=>WN,TileHeader:()=>pv,TileMetadata:()=>er,TimedMarkerDecoration:()=>GN,TitleAndButtonListHeader:()=>jN,ToggleButton:()=>de,ToggleButtonView:()=>Gt,ToggleMenuServiceItem:()=>HN,Tooltip:()=>qN,TopbarMenuButton:()=>q1,TopicChannelDetails:()=>KN,Transcript:()=>hs,TranscriptFooter:()=>Iy,TranscriptSearchBox:()=>ky,TranscriptSearchPanel:()=>Ny,TranscriptSectionHeader:()=>Sy,TranscriptSegment:()=>Ey,TranscriptSegmentList:()=>Cy,TvBrowse:()=>$N,TvSecondaryNav:()=>lv,TvSecondaryNavSection:()=>tr,TvSurfaceContent:()=>dt,TwoColumn:()=>Zs,TwoColumnBrowseResults:()=>_i,TwoColumnSearchResults:()=>fv,TwoColumnWatchNextResults:()=>ir,UnifiedSharePanel:()=>zN,UniversalWatchCard:()=>hv,UnsubscribeEndpoint:()=>bC,UpdateChannelSwitcherPageAction:()=>oE,UpdateDateTextAction:()=>$w,UpdateDescriptionAction:()=>zw,UpdateEngagementPanelAction:()=>sE,UpdateLiveChatPollAction:()=>b1,UpdateSubscribeButtonAction:()=>rE,UpdateTitleAction:()=>Jw,UpdateToggleButtonTextAction:()=>Xw,UpdateViewershipAction:()=>Qw,UploadTimeFactoid:()=>cg,UpsellDialog:()=>JN,VerticalList:()=>XN,VerticalWatchCardList:()=>QN,Video:()=>Ts,VideoAttributeView:()=>yn,VideoAttributesSectionView:()=>_g,VideoBadgeView:()=>mv,VideoCard:()=>ag,VideoDescriptionChannelSection:()=>xg,VideoDescriptionCommentsSection:()=>gg,VideoDescriptionCourseSection:()=>mg,VideoDescriptionHeader:()=>pg,VideoDescriptionInfocardsSection:()=>lg,VideoDescriptionMusicSection:()=>Is,VideoDescriptionTranscriptSection:()=>Cu,VideoInfoCardContent:()=>ZN,VideoMetadata:()=>_v,VideoMetadataCarouselView:()=>eP,VideoOwner:()=>ui,VideoPrimaryInfo:()=>bv,VideoSecondaryInfo:()=>zb,VideoViewCount:()=>nr,ViewCountFactoid:()=>ug,WatchCardCompactVideo:()=>xv,WatchCardHeroVideo:()=>tP,WatchCardRichHeader:()=>iP,WatchCardSectionSequence:()=>nP,WatchEndpoint:()=>mw,WatchNextEndScreen:()=>OT,WatchNextEndpoint:()=>xC,WatchNextTabbedResults:()=>yv,YpcTrailer:()=>vo});var ro,ey=class{constructor(e,i){ro.set(this,void 0),w(this,ro,new B.shim.Cache(e,i),"f")}get cache_dir(){return c(this,ro,"f").cache_dir}get(e){return c(this,ro,"f").get(e)}set(e,i){return c(this,ro,"f").set(e,i)}remove(e){return c(this,ro,"f").remove(e)}};r(ey,"UniversalCache");ro=new WeakMap;var n3=ey;var ps,ty=class extends EventTarget{constructor(){super(),ps.set(this,new Map)}emit(e,...i){let n=new B.shim.CustomEvent(e,{detail:i});this.dispatchEvent(n)}on(e,i){let n=r(o=>{o instanceof B.shim.CustomEvent?i(...o.detail):i(o)},"wrapper");c(this,ps,"f").set(i,n),this.addEventListener(e,n)}once(e,i){let n=r(o=>{o instanceof B.shim.CustomEvent?i(...o.detail):i(o),this.off(e,i)},"wrapper");c(this,ps,"f").set(i,n),this.addEventListener(e,n)}off(e,i){let n=c(this,ps,"f").get(i);n&&(this.removeEventListener(e,n),c(this,ps,"f").delete(i))}};r(ty,"EventEmitterLike");ps=new WeakMap;var Ea=ty;var co={};Ie(co,{chooseFormat:()=>uS,download:()=>C3,toDash:()=>cS});var o3={"&":"&amp;",'"':"&quot;","'":"&apos;","<":"&lt;",">":"&gt;"};function Qk(t){return t.replace(/([&"<>'])/g,(e,i)=>o3[i])}r(Qk,"escapeXMLString");function s3(t){return t.charAt(0).toUpperCase()+t.slice(1)}r(s3,"normalizeTag");function ee(t,e,...i){let n=i.flat();return typeof t=="function"?t({...e,children:n}):{type:s3(t),props:{...e,children:n}}}r(ee,"createElement");async function Zk(t){if(typeof t=="string")return Qk(t);let e=`<${t.type}`;if(t.props)for(let i of Object.keys(t.props))i!=="children"&&t.props[i]!==void 0&&(e+=` ${i}="${Qk(`${t.props[i]}`)}"`);if(t.props.children){let i=await Promise.all((await Promise.all(t.props.children.flat())).flat().filter(n=>!!n).map(n=>Zk(n)));if(i.length>0)return e+=`>${i.join("")}</${t.type}>`,e}return`${e}/>`}r(Zk,"renderElementToString");async function eS(t){return`<?xml version="1.0" encoding="utf-8"?>${await Zk(await t)}`}r(eS,"renderToString");function tS(t){return t.children}r(tS,"Fragment");var Ca=class extends a{constructor(e){super();let i=e.spec.split("|"),n=new URL(i.shift());this.boards=i.map((o,s)=>{let[l,f,d,b,x,g,T,I]=o.split("#");n.searchParams.set("sigh",I);let S=Math.ceil(parseInt(d,10)/(parseInt(b,10)*parseInt(x,10)));return{type:"vod",template_url:n.toString().replace("$L",s).replace("$N",T),thumbnail_width:parseInt(l,10),thumbnail_height:parseInt(f,10),thumbnail_count:parseInt(d,10),interval:parseInt(g,10),columns:parseInt(b,10),rows:parseInt(x,10),storyboard_count:S}})}};r(Ca,"PlayerStoryboardSpec");Ca.type="PlayerStoryboardSpec";var ao=Ca;var a3="StreamingInfo";function c3(t,e){var o,s,l;let i=new Map,n=t.some(f=>!!f.audio_track);for(let f of t){if((!f.index_range||!f.init_range)&&!f.is_type_otf&&!e)continue;let d=f.mime_type.split(";")[0],b=(o=lt(f.mime_type,'codecs="','"'))==null?void 0:o.split(".")[0],x=f.color_info?Object.values(f.color_info).join("-"):"",g=((s=f.audio_track)==null?void 0:s.id)||"",T=f.is_drc?"drc":"",I=`${d}-${b}-${x}-${g}-${T}`;i.has(I)||i.set(I,[]),(l=i.get(I))==null||l.push(f)}return{groups:Array.from(i.values()),has_multiple_audio_tracks:n}}r(c3,"getFormatGroupings");function nS(t,e){if(t.length>1&&new Set(t.map(i=>lt(i.mime_type,'codecs="','"'))).size===1)return e.push("codecs"),lt(t[0].mime_type,'codecs="','"')}r(nS,"hoistCodecsIfPossible");function oS(t,e,i){if(t.length>1&&new Set(t.map(n=>n.fps)).size===1)return i.push(e),Number(t[0][e])}r(oS,"hoistNumberAttributeIfPossible");function u3(t,e){if(t.length>1&&new Set(t.map(i=>i.audio_channels||2)).size===1)return e.push("AudioChannelConfiguration"),t[0].audio_channels}r(u3,"hoistAudioChannelsIfPossible");async function p3(t,e){var f;let i=await e.session.http.fetch_function(`${t}&rn=0&sq=0`,{method:"GET",headers:Bi,redirect:"follow"}),n=i.url.replace("&rn=0","").replace("&sq=0",""),o=await i.text(),s=(f=lt(o,"Segment-Durations-Ms:",`\r `))==null?void 0:f.split(",");if(!s)throw new _("Failed to extract the segment durations from this OTF stream",{url:t});let l=[];for(let d of s){let b=d.trim();if(b.length===0)continue;let x,g=lt(b,"(r=",")");g&&(x=parseInt(g)),l.push({duration:parseInt(b),repeat_count:x})}return{init_url:`${n}&sq=0`,media_url:`${n}&sq=$Number$`,timeline:l}}r(p3,"getOTFSegmentTemplate");async function sS(t,e){let i=await e.session.http.fetch_function(`${t}&rn=0&sq=0`,{method:"HEAD",headers:Bi,redirect:"follow"}),n=parseInt(i.headers.get("X-Head-Time-Millis")||""),o=parseInt(i.headers.get("X-Head-Seqnum")||"");if(isNaN(n)||isNaN(o))throw new _("Failed to extract the duration or segment count for this Post Live DVR video");return{duration:n/1e3,segment_count:o}}r(sS,"getPostLiveDvrInfo");async function l3(t,e,i,n,o,s){if(!t.item){let l=new URL(e.decipher(o));l.searchParams.set("cpn",s||"");let f=i(l).toString();t.item=await sS(f,n)}return t.item.duration}r(l3,"getPostLiveDvrDuration");function rS(t,e,i,n,o,s){let l=new URL(t.decipher(n));l.searchParams.set("cpn",o||"");let f=e(l).toString();if(t.is_type_otf){if(!i)throw new _("Unable to get segment durations for this OTF stream without an Actions instance",{format:t});return{is_oft:!0,is_post_live_dvr:!1,getSegmentTemplate(){return p3(f,i)}}}if(s){if(!i)throw new _("Unable to get segment count for this Post Live DVR video without an Actions instance",{format:t});let b=t.target_duration_dec;if(typeof b!="number")throw new _("Format is missing target_duration_dec",{format:t});return{is_oft:!1,is_post_live_dvr:!0,async getSegmentTemplate(){return s.item||(s.item=await sS(f,i)),{media_url:`${f}&sq=$Number$`,timeline:[{duration:b*1e3,repeat_count:s.item.segment_count}]}}}}if(!t.index_range||!t.init_range)throw new _("Index and init ranges not available",{format:t});return{is_oft:!1,is_post_live_dvr:!1,base_url:f,index_range:t.index_range,init_range:t.init_range}}r(rS,"getSegmentInfo");function f3(t,e,i,n,o,s,l){new URL(t.decipher(o)).searchParams.set("cpn",s||"");let d=[t.itag.toString()];return t.audio_track&&d.push(t.audio_track.id),t.is_drc&&d.push("drc"),{uid:d.join("-"),bitrate:t.bitrate,codecs:e.includes("codecs")?void 0:lt(t.mime_type,'codecs="','"'),audio_sample_rate:e.includes("audio_sample_rate")?void 0:t.audio_sample_rate,channels:e.includes("AudioChannelConfiguration")?void 0:t.audio_channels||2,segment_info:rS(t,i,n,o,s,l)}}r(f3,"getAudioRepresentation");function d3(t,e){var n;if(!t.audio_track&&!e)return;let i=[t.is_original||((n=t.audio_track)==null?void 0:n.audio_is_default)?"main":"alternate"];return(t.is_dubbed||t.is_auto_dubbed)&&i.push("dub"),t.is_descriptive&&i.push("description"),t.is_drc&&i.push("enhanced-audio-intelligibility"),i}r(d3,"getTrackRoles");function h3(t,e,i,n,o,s,l){var I;let f=t[0],{audio_track:d}=f,b=[],x=!!l,g;return d?x&&f.is_drc?g=l.label_drc_multiple(d.display_name):g=d.display_name:x&&(g=f.is_drc?l.label_drc:l.label_original),{mime_type:f.mime_type.split(";")[0],language:(I=f.language)!=null?I:void 0,codecs:nS(t,b),audio_sample_rate:oS(t,"audio_sample_rate",b),track_name:g,track_roles:d3(f,x),channels:u3(t,b),representations:t.map(S=>f3(S,b,e,i,n,o,s))}}r(h3,"getAudioSet");var m3={BT709:"1",BT2020:"9"},iS={BT709:"1",BT2020_10:"14",SMPTEST2084:"16",ARIB_STD_B67:"18"},_3={BT709:"1",BT2020_NCL:"14"};function b3(t){var l;let e=t.color_info,i,n,o;if(e){if(e.primaries&&(i=m3[e.primaries]),e.transfer_characteristics&&(n=iS[e.transfer_characteristics]),e.matrix_coefficients&&(o=_3[e.matrix_coefficients],!o)){let f=new URL(t.url),d=JSON.parse(JSON.stringify(t));d.url="REDACTED",d.signature_cipher="REDACTED",d.cipher="REDACTED",Oi(a3,`Unknown matrix coefficients "${e.matrix_coefficients}". The DASH manifest is still usable without this. Please report it at ${B.shim.info.bugs_url} so we can add support for it. InnerTube client: ${f.searchParams.get("c")} format:`,d)}}else(l=lt(t.mime_type,'codecs="','"'))!=null&&l.startsWith("avc1")&&(n=iS.BT709);return{primaries:i,transfer_characteristics:n,matrix_coefficients:o}}r(b3,"getColorInfo");function x3(t,e,i,n,o,s,l){return{uid:t.itag.toString(),bitrate:t.bitrate,width:t.width,height:t.height,codecs:i.includes("codecs")?void 0:lt(t.mime_type,'codecs="','"'),fps:i.includes("fps")?void 0:t.fps,segment_info:rS(t,e,o,n,s,l)}}r(x3,"getVideoRepresentation");function y3(t,e,i,n,o,s){let l=t[0],f=b3(l),d=[];return{mime_type:l.mime_type.split(";")[0],color_info:f,codecs:nS(t,d),fps:oS(t,"fps",d),representations:t.map(x=>x3(x,e,d,i,n,o,s))}}r(y3,"getVideoSet");function g3(t){var n;let e=new Map,i=t.is(ao)?t.boards:[t.board];for(let o of i){let s=new URL(o.template_url).pathname.split(".").pop(),l=`image/${s==="jpg"?"jpeg":s}`;e.has(l)||e.set(l,[]),(n=e.get(l))==null||n.push(o)}return e}r(g3,"getStoryboardInfo");async function w3(t,e,i,n,o){let s=e.template_url,l=i(new URL(s.replace("$M","0"))),f=o.response?o.response:t.session.http.fetch_function(l,{method:"HEAD",headers:Bi});return o.response=f,(await f).headers.get("Content-Type")||n}r(w3,"getStoryboardMimeType");async function T3(t,e,i){let n=e.template_url,o=[],s=Math.min(e.type==="vod"?e.storyboard_count:5,10);for(let d=0;d<s;d++){let b=new URL(n.replace("$M",d.toString())),x=d===0&&i.response?i.response:t.session.http.fetch_function(b,{method:"HEAD",headers:Bi});d===0&&(i.response=x),o.push(x)}let l=await Promise.all(o),f=[];for(let d of l)f.push(parseInt(d.headers.get("Content-Length")||"0"));return Math.ceil(Math.max(...f)/(e.rows*e.columns)*8)}r(T3,"getStoryboardBitrate");function v3(t,e,i,n,o){let s=i.template_url,l=new URL(s.replace("$M","$Number$")),f;return i.type==="vod"?f=t/i.storyboard_count:f=t*i.columns*i.rows,{uid:`thumbnails_${i.thumbnail_width}x${i.thumbnail_height}`,getBitrate(){return T3(e,i,o)},sheet_width:i.thumbnail_width*i.columns,sheet_height:i.thumbnail_height*i.rows,thumbnail_height:i.thumbnail_height,thumbnail_width:i.thumbnail_width,rows:i.rows,columns:i.columns,template_duration:Math.round(f),template_url:n(l).toString(),getURL(b){return l.toString().replace("$Number$",b.toString())}}}r(v3,"getImageRepresentation");function I3(t,e,i,n){let o=g3(i),s={};return Array.from(o.entries()).map(([l,f])=>({probable_mime_type:l,getMimeType(){return w3(e,f[0],n,l,s)},representations:f.map(d=>v3(t,e,d,n,s))}))}r(I3,"getImageSets");function k3(t,e,i){let n=e==="vtt"?"text/vtt":"application/ttml+xml";return t.map(o=>{let s=new URL(o.base_url);s.searchParams.set("fmt",e);let l=["caption"];return s.searchParams.has("tlang")&&l.push("dub"),{mime_type:n,language:o.language_code,track_name:o.name.toString(),track_roles:l,representation:{uid:`text-${o.vss_id}`,base_url:i(s).toString()}}})}r(k3,"getTextSets");function iy(t,e=!1,i=x=>x,n,o,s,l,f,d,b){if(!t)throw new _("Streaming data not available");let x=n?t.adaptive_formats.filter(j=>!n(j)):t.adaptive_formats,g,T;if(e){if(T={},!l)throw new _("Unable to get duration or segment count for this Post Live DVR video without an Actions instance");g=r(()=>T?l3(T,x[0],i,l,s,o):Promise.resolve(0),"getDuration")}else{let j=x[0].approx_duration_ms/1e3;g=r(()=>Promise.resolve(j),"getDuration")}let{groups:I,has_multiple_audio_tracks:S}=c3(x,e),{video_groups:E,audio_groups:N}=I.reduce((j,ue)=>ue[0].has_audio?(S&&!ue[0].audio_track||j.audio_groups.push(ue),j):(j.video_groups.push(ue),j),{video_groups:[],audio_groups:[]}),C;N.flat().some(j=>j.is_drc)&&(C={label_original:(b==null?void 0:b.label_original)||"Original",label_drc:(b==null?void 0:b.label_drc)||"Stable Volume",label_drc_multiple:(b==null?void 0:b.label_drc_multiple)||(j=>`${j} (Stable Volume)`)});let q=N.map(j=>h3(j,i,l,s,o,T,C)),U=E.map(j=>y3(j,i,s,l,o,T)),Q=[];if(f&&l){let j;if(f.is(ao))j=x[0].approx_duration_ms/1e3;else{let ue=x[0].target_duration_dec;if(ue===void 0)throw new _("Format is missing target_duration_dec",{format:x[0]});j=ue}Q=I3(j,l,f,i)}let W=[];if(d&&(b==null?void 0:b.captions_format)){if(b.captions_format!=="vtt"&&b.captions_format!=="ttml")throw new _("Invalid captions format",b.captions_format);W=k3(d,b.captions_format,i)}return{getDuration:g,audio_sets:q,video_sets:U,image_sets:Q,text_sets:W}}r(iy,"getStreamingInfo");async function S3({info:t}){if(!t.is_oft&&!t.is_post_live_dvr)return null;let e=await t.getSegmentTemplate();return ee("segmentTemplate",{startNumber:e.init_url?"1":"0",timescale:"1000",initialization:e.init_url,media:e.media_url},ee("segmentTimeline",null,e.timeline.map(i=>ee("s",{d:i.duration,r:i.repeat_count}))))}r(S3,"OTFPostLiveDvrSegmentInfo");function aS({info:t}){return t.is_oft||t.is_post_live_dvr?ee(S3,{info:t}):ee(tS,null,ee("baseURL",null,t.base_url),ee("segmentBase",{indexRange:`${t.index_range.start}-${t.index_range.end}`},ee("initialization",{range:`${t.init_range.start}-${t.init_range.end}`})))}r(aS,"SegmentInfo");async function E3({streamingData:t,isPostLiveDvr:e,transformURL:i,rejectFormat:n,cpn:o,player:s,actions:l,storyboards:f,captionTracks:d,options:b}){let{getDuration:x,audio_sets:g,video_sets:T,image_sets:I,text_sets:S}=iy(t,e,i,n,o,s,l,f,d,b);return ee("mPD",{xmlns:"urn:mpeg:dash:schema:mpd:2011",minBufferTime:"PT1.500S",profiles:"urn:mpeg:dash:profile:isoff-main:2011",type:"static",mediaPresentationDuration:`PT${await x()}S`,"xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xsi:schemaLocation":"urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"},ee("period",null,g.map((E,N)=>ee("adaptationSet",{id:N,mimeType:E.mime_type,startWithSAP:"1",subsegmentAlignment:"true",lang:E.language,codecs:E.codecs,audioSamplingRate:E.audio_sample_rate,contentType:"audio"},E.track_roles&&E.track_roles.map(C=>ee("role",{schemeIdUri:"urn:mpeg:dash:role:2011",value:C})),E.track_name&&ee("label",{id:N},E.track_name),E.channels&&ee("audioChannelConfiguration",{schemeIdUri:"urn:mpeg:dash:23003:3:audio_channel_configuration:2011",value:E.channels}),E.representations.map(C=>ee("representation",{id:C.uid,bandwidth:C.bitrate,codecs:C.codecs,audioSamplingRate:C.audio_sample_rate},C.channels&&ee("audioChannelConfiguration",{schemeIdUri:"urn:mpeg:dash:23003:3:audio_channel_configuration:2011",value:C.channels}),ee(aS,{info:C.segment_info}))))),T.map((E,N)=>ee("adaptationSet",{id:N+g.length,mimeType:E.mime_type,startWithSAP:"1",subsegmentAlignment:"true",codecs:E.codecs,maxPlayoutRate:"1",frameRate:E.fps,contentType:"video"},E.color_info.primaries&&ee("supplementalProperty",{schemeIdUri:"urn:mpeg:mpegB:cicp:ColourPrimaries",value:E.color_info.primaries}),E.color_info.transfer_characteristics&&ee("supplementalProperty",{schemeIdUri:"urn:mpeg:mpegB:cicp:TransferCharacteristics",value:E.color_info.transfer_characteristics}),E.color_info.matrix_coefficients&&ee("supplementalProperty",{schemeIdUri:"urn:mpeg:mpegB:cicp:MatrixCoefficients",value:E.color_info.matrix_coefficients}),E.representations.map(C=>ee("representation",{id:C.uid,bandwidth:C.bitrate,width:C.width,height:C.height,codecs:C.codecs,frameRate:C.fps},ee(aS,{info:C.segment_info}))))),I.map(async(E,N)=>ee("adaptationSet",{id:N+g.length+T.length,mimeType:await E.getMimeType(),contentType:"image"},E.representations.map(async C=>ee("representation",{id:`thumbnails_${C.thumbnail_width}x${C.thumbnail_height}`,bandwidth:await C.getBitrate(),width:C.sheet_width,height:C.sheet_height},ee("essentialProperty",{schemeIdUri:"http://dashif.org/thumbnail_tile",value:`${C.columns}x${C.rows}`}),ee("segmentTemplate",{media:C.template_url,duration:C.template_duration,startNumber:"0"}))))),S.map((E,N)=>ee("adaptationSet",{id:N+g.length+T.length+I.length,mimeType:E.mime_type,lang:E.language,contentType:"text"},E.track_roles.map(C=>ee("role",{schemeIdUri:"urn:mpeg:dash:role:2011",value:C})),ee("label",{id:N+g.length},E.track_name),ee("representation",{id:E.representation.uid,bandwidth:"0"},ee("baseURL",null,E.representation.base_url))))))}r(E3,"DashManifest");function cS(t,e=!1,i=x=>x,n,o,s,l,f,d,b){if(!t)throw new _("Streaming data not available");return eS(ee(E3,{streamingData:t,isPostLiveDvr:e,transformURL:i,options:b,rejectFormat:n,cpn:o,player:s,actions:l,storyboards:f,captionTracks:d}))}r(cS,"toDash");async function C3(t,e,i,n,o,s){if((i==null?void 0:i.status)==="UNPLAYABLE")throw new _("Video is unplayable",{error_type:"UNPLAYABLE"});if((i==null?void 0:i.status)==="LOGIN_REQUIRED")throw new _("Video is login required",{error_type:"LOGIN_REQUIRED"});if(!n)throw new _("Streaming data not available.",{error_type:"NO_STREAMING_DATA"});let l={quality:"360p",type:"video+audio",format:"mp4",range:void 0,...t},f=uS(l,n),d=f.decipher(o);if(l.type==="video+audio"&&!t.range){let S=await e.session.http.fetch_function(`${d}&cpn=${s}`,{method:"GET",headers:Bi,redirect:"follow"});if(!S.ok)throw new _("The server responded with a non 2xx status code",{error_type:"FETCH_FAILED",response:S});let E=S.body;if(!E)throw new _("Could not get ReadableStream from fetch Response.",{error_type:"FETCH_FAILED",response:S});return E}let b=1048576*10,x=t.range?t.range.start:0,g=t.range?t.range.end:b,T=!1,I;return new B.shim.ReadableStream({start(){},pull:async S=>{if(T){S.close();return}return(g>=(f.content_length?f.content_length:0)||t.range)&&(T=!0),new Promise(async(E,N)=>{try{I=new AbortController;let C=await e.session.http.fetch_function(`${d}&cpn=${s}&range=${x}-${g||""}`,{method:"GET",headers:{...Bi},signal:I.signal});if(!C.ok)throw new _("The server responded with a non 2xx status code",{error_type:"FETCH_FAILED",response:C});let q=C.body;if(!q)throw new _("Could not get ReadableStream from fetch Response.",{error_type:"FETCH_FAILED",response:C});for await(let U of oI(q))S.enqueue(U);x=g+1,g+=b,E()}catch(C){N(C)}})},async cancel(S){I.abort(S)}},{highWaterMark:1,size(S){return S.byteLength}})}r(C3,"download");function uS(t,e){if(!e)throw new _("Streaming data not available");let i=[...e.formats||[],...e.adaptive_formats||[]],n=t.type?t.type.includes("audio"):!0,o=t.type?t.type.includes("video"):!0,s=t.language||"original",l=t.quality||"best",f=-1,d=["best","bestefficiency"].includes(l),b=l!=="best",x=i.filter(g=>n&&!g.has_audio||o&&!g.has_video||t.format!=="any"&&!g.mime_type.includes(t.format||"mp4")||!d&&g.quality_label!==l?!1:(g.width&&f<g.width&&(f=g.width),!0));if(!x.length)throw new _("No matching formats found",{options:t});if(d&&o&&(x=x.filter(g=>g.width===f)),n&&!o){let g=x.filter(T=>s!=="original"?!T.has_video&&!T.has_text&&T.language===s:!T.has_video&&!T.has_text&&T.is_original);g.length>0&&(x=g)}return b?x.sort((g,T)=>g.bitrate-T.bitrate):x.sort((g,T)=>T.bitrate-g.bitrate),x[0]}r(uS,"chooseFormat");var sI,wt,ls,Na,pS,ny=class{constructor(e,i,n){sI.add(this),wt.set(this,void 0),ls.set(this,void 0),Na.set(this,void 0),w(this,wt,e,"f"),w(this,ls,i,"f"),w(this,Na,n||B.shim.fetch,"f")}get fetch_function(){return c(this,Na,"f")}async fetch(e,i){let n=Xe.API.PRODUCTION_1+c(this,wt,"f").api_version,o=(i==null?void 0:i.baseURL)||n,s=typeof e=="string"?!o.endsWith("/")&&!e.startsWith("/")?new URL(`${o}/${e}`):new URL(o+e):e instanceof URL?e:new URL(e.url,o),l=(i==null?void 0:i.headers)||(e instanceof B.shim.Request?e.headers:new B.shim.Headers)||new B.shim.Headers,f=(i==null?void 0:i.body)||(e instanceof B.shim.Request?e.body:void 0),d=new B.shim.Headers(l);d.set("Accept","*/*"),d.set("Accept-Language","*"),d.set("X-Goog-Visitor-Id",c(this,wt,"f").context.client.visitorData||""),d.set("X-Youtube-Client-Version",c(this,wt,"f").context.client.clientVersion||"");let b=Object.values(K).find(N=>N.NAME===c(this,wt,"f").context.client.clientName);b&&d.set("X-Youtube-Client-Name",b.NAME_ID),B.shim.server&&(d.set("User-Agent",uo("desktop")),d.set("Origin",s.origin)),s.searchParams.set("prettyPrint","false"),s.searchParams.set("alt","json");let x=d.get("Content-Type"),g=f,T=!1,I=o===n||o===Xe.YT_UPLOAD;if(x==="application/json"&&I&&typeof f=="string"){let C={...JSON.parse(f),context:JSON.parse(JSON.stringify(c(this,wt,"f").context))};c(this,sI,"m",pS).call(this,C.context,C.client),d.set("X-Youtube-Client-Version",C.context.client.clientVersion);let q=Object.values(K).find(U=>U.NAME===C.context.client.clientName);q&&d.set("X-Youtube-Client-Name",q.NAME_ID),delete C.client,C.context.client.clientName==="ANDROID"||C.context.client.clientName==="ANDROID_MUSIC"?(d.set("User-Agent",K.ANDROID.USER_AGENT),d.set("X-GOOG-API-FORMAT-VERSION","2")):C.context.client.clientName==="iOS"&&d.set("User-Agent",K.IOS.USER_AGENT),T=C.context.client.clientName==="WEB_KIDS",g=JSON.stringify(C)}else x==="application/x-protobuf"&&B.shim.server&&(d.set("User-Agent",K.ANDROID.USER_AGENT),d.set("X-GOOG-API-FORMAT-VERSION","2"),d.delete("X-Youtube-Client-Version"));if(c(this,wt,"f").logged_in&&I&&!T){let N=c(this,wt,"f").oauth;if(N.oauth2_tokens&&(N.shouldRefreshToken()&&await N.refreshAccessToken(),d.set("Authorization",`Bearer ${N.oauth2_tokens.access_token}`)),c(this,ls,"f")){let C=cI(c(this,ls,"f"),"SAPISID");C&&(d.set("Authorization",await aI(C)),d.set("X-Goog-Authuser",c(this,wt,"f").account_index.toString()),c(this,wt,"f").context.user.onBehalfOfUser&&d.set("X-Goog-PageId",c(this,wt,"f").context.user.onBehalfOfUser)),d.set("Cookie",c(this,ls,"f"))}}let S=new B.shim.Request(s,e instanceof B.shim.Request?e:i),E=await c(this,Na,"f").call(this,S,{body:g,headers:d,redirect:e instanceof B.shim.Request?e.redirect:(i==null?void 0:i.redirect)||"follow",...B.shim.runtime!=="cf-worker"?{credentials:"include"}:{}});if(E.ok)return E;throw new _(`Request to ${E.url} failed with status ${E.status}`,await E.text())}};r(ny,"HTTPClient");wt=new WeakMap,ls=new WeakMap,Na=new WeakMap,sI=new WeakSet,pS=r(function(e,i){if(!!i){if(!Zx.includes(i.toUpperCase()))throw new _(`Invalid client: ${i}`,{available_innertube_clients:Zx});switch((i==="ANDROID"||i==="YTMUSIC_ANDROID"||i==="YTMUSIC_ANDROID"||i==="YTSTUDIO_ANDROID")&&(e.client.androidSdkVersion=K.ANDROID.SDK_VERSION,e.client.userAgent=K.ANDROID.USER_AGENT,e.client.osName="Android",e.client.osVersion="13",e.client.platform="MOBILE"),i.toUpperCase()){case"MWEB":e.client.clientVersion=K.MWEB.VERSION,e.client.clientName=K.MWEB.NAME,e.client.clientFormFactor="SMALL_FORM_FACTOR",e.client.platform="MOBILE";break;case"IOS":e.client.deviceMake="Apple",e.client.deviceModel=K.IOS.DEVICE_MODEL,e.client.clientVersion=K.IOS.VERSION,e.client.clientName=K.IOS.NAME,e.client.platform="MOBILE",e.client.osName="iOS",delete e.client.browserName,delete e.client.browserVersion;break;case"YTMUSIC":e.client.clientVersion=K.YTMUSIC.VERSION,e.client.clientName=K.YTMUSIC.NAME;break;case"ANDROID":e.client.clientVersion=K.ANDROID.VERSION,e.client.clientFormFactor="SMALL_FORM_FACTOR",e.client.clientName=K.ANDROID.NAME;break;case"YTMUSIC_ANDROID":e.client.clientVersion=K.YTMUSIC_ANDROID.VERSION,e.client.clientFormFactor="SMALL_FORM_FACTOR",e.client.clientName=K.YTMUSIC_ANDROID.NAME;break;case"YTSTUDIO_ANDROID":e.client.clientVersion=K.YTSTUDIO_ANDROID.VERSION,e.client.clientFormFactor="SMALL_FORM_FACTOR",e.client.clientName=K.YTSTUDIO_ANDROID.NAME;break;case"TV":{e.client.clientVersion=K.TV.VERSION,e.client.clientName=K.TV.NAME,e.client.userAgent=K.TV.USER_AGENT,e.client.browserName="Cobalt",e.client.tvAppInfo={appQuality:"TV_APP_QUALITY_FULL_ANIMATION",zylonLeftNav:!0},delete e.client.browserVersion;break}case"TV_EMBEDDED":e.client.clientName=K.TV_EMBEDDED.NAME,e.client.clientVersion=K.TV_EMBEDDED.VERSION,e.client.clientScreen="EMBED",e.thirdParty={embedUrl:Xe.YT_BASE};break;case"YTKIDS":e.client.clientVersion=K.WEB_KIDS.VERSION,e.client.clientName=K.WEB_KIDS.NAME,e.client.kidsAppInfo={categorySettings:{enabledCategories:["approved_for_you","black_joy","camp","collections","earth","explore","favorites","gaming","halloween","hero","learning","move","music","reading","shared_by_parents","shows","soccer","sports","spotlight","winter"]},contentSettings:{corpusPreference:"KIDS_CORPUS_PREFERENCE_YOUNGER",kidsNoSearchMode:"YT_KIDS_NO_SEARCH_MODE_OFF"}};break;case"WEB_EMBEDDED":e.client.clientName=K.WEB_EMBEDDED.NAME,e.client.clientVersion=K.WEB_EMBEDDED.VERSION,e.client.clientScreen="EMBED",e.thirdParty={embedUrl:Xe.GOOGLE_SEARCH_BASE};break;case"WEB_CREATOR":e.client.clientName=K.WEB_CREATOR.NAME,e.client.clientVersion=K.WEB_CREATOR.VERSION;break;default:break}}},"_HTTPClient_adjustContext");var rI=ny;var Yt={};Ie(Yt,{compress:()=>N3,decompress:()=>P3});function N3(t){let e=[],i={};for(let s=0;s<256;s++)i[String.fromCharCode(s)]=s;let n="",o=256;for(let s=0;s<t.length;s++){let l=t[s],f=n+l;i.hasOwnProperty(f)?n=f:(e.push(i[n]),i[f]=o++,n=l)}return n!==""&&e.push(i[n]),e.map(s=>String.fromCharCode(s)).join("")}r(N3,"compress");function P3(t){let e={},i=t.split(""),n=[i.shift()],o=i.length>>>0,s=256,l=n[0],f=l;for(let d=0;d<o;++d){let b=i[d].charCodeAt(0),x=b<256?i[d]:e[b]?e[b]:f+l;n.push(x),l=x.charAt(0),e[s++]=f+l,f=x}return n.join("")}r(P3,"decompress");var an={};Ie(an,{decodeVisitorData:()=>TA,encodeCommentActi