Skip to content

Instantly share code, notes, and snippets.

@MulverineX
Created March 9, 2025 23:20
Show Gist options
  • Save MulverineX/c3f49c7192f502f1715c332f72c01648 to your computer and use it in GitHub Desktop.
Save MulverineX/c3f49c7192f502f1715c332f72c01648 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
/* eslint-disable */
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
// node_modules/tslib/tslib.es6.mjs
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol")
name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
}
__name(__setFunctionName, "__setFunctionName");
function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
__name(__classPrivateFieldGet, "__classPrivateFieldGet");
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m")
throw new TypeError("Private method is not writable");
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot write private member to an object whose class did not declare it");
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
}
__name(__classPrivateFieldSet, "__classPrivateFieldSet");
// dist/src/utils/Utils.js
var Utils_exports = {};
__export(Utils_exports, {
ChannelError: () => ChannelError,
InnertubeError: () => InnertubeError,
MissingParamError: () => MissingParamError,
OAuth2Error: () => OAuth2Error,
ParsingError: () => ParsingError,
Platform: () => Platform,
PlayerError: () => PlayerError,
SessionError: () => SessionError,
base64ToU8: () => base64ToU8,
concatMemos: () => concatMemos,
debugFetch: () => debugFetch,
deepCompare: () => deepCompare,
escapeStringRegexp: () => escapeStringRegexp,
findFunction: () => findFunction,
generateRandomString: () => generateRandomString,
generateSidAuth: () => generateSidAuth,
getCookie: () => getCookie,
getRandomUserAgent: () => getRandomUserAgent,
getStringBetweenStrings: () => getStringBetweenStrings,
hasKeys: () => hasKeys,
isTextRun: () => isTextRun,
streamToIterable: () => streamToIterable,
throwIfMissing: () => throwIfMissing,
timeToSeconds: () => timeToSeconds,
u8ToBase64: () => u8ToBase64
});
// dist/src/parser/helpers.js
var helpers_exports = {};
__export(helpers_exports, {
Maybe: () => Maybe,
Memo: () => Memo,
SuperParsedResult: () => SuperParsedResult,
YTNode: () => YTNode,
observe: () => observe
});
// dist/src/utils/Log.js
var Log_exports = {};
__export(Log_exports, {
Level: () => Level,
debug: () => debug,
error: () => error,
info: () => info,
setLevel: () => setLevel,
warn: () => warn,
warnOnce: () => warnOnce
});
var YTJS_TAG = "YOUTUBEJS";
var Level = {
NONE: 0,
ERROR: 1,
WARNING: 2,
INFO: 3,
DEBUG: 4
};
var log_map = {
[Level.ERROR]: (...args) => console.error(...args),
[Level.WARNING]: (...args) => console.warn(...args),
[Level.INFO]: (...args) => console.info(...args),
[Level.DEBUG]: (...args) => console.debug(...args)
};
var log_level = [Level.WARNING];
var one_time_warnings_issued = /* @__PURE__ */ new Set();
function doLog(level, tag, args) {
if (!log_map[level] || !log_level.includes(level))
return;
const tags = [`[${YTJS_TAG}]`];
if (tag)
tags.push(`[${tag}]`);
log_map[level](`${tags.join("")}:`, ...args || []);
}
__name(doLog, "doLog");
var warnOnce = /* @__PURE__ */ __name((id, ...args) => {
if (one_time_warnings_issued.has(id))
return;
doLog(Level.WARNING, id, args);
one_time_warnings_issued.add(id);
}, "warnOnce");
var warn = /* @__PURE__ */ __name((tag, ...args) => doLog(Level.WARNING, tag, args), "warn");
var error = /* @__PURE__ */ __name((tag, ...args) => doLog(Level.ERROR, tag, args), "error");
var info = /* @__PURE__ */ __name((tag, ...args) => doLog(Level.INFO, tag, args), "info");
var debug = /* @__PURE__ */ __name((tag, ...args) => doLog(Level.DEBUG, tag, args), "debug");
function setLevel(...args) {
log_level = args;
}
__name(setLevel, "setLevel");
// dist/src/parser/helpers.js
var _YTNode_instances;
var _YTNode_is;
var _Maybe_instances;
var _Maybe_value;
var _Maybe_checkPrimitive;
var _Maybe_assertPrimitive;
var _SuperParsedResult_result;
var isObserved = Symbol("ObservedArray.isObserved");
var YTNode = class {
constructor() {
_YTNode_instances.add(this);
this.type = this.constructor.type;
}
is(...types2) {
return types2.some((type) => __classPrivateFieldGet(this, _YTNode_instances, "m", _YTNode_is).call(this, type));
}
as(...types2) {
if (!this.is(...types2)) {
throw new ParsingError(`Cannot cast ${this.type} to one of ${types2.map((t) => t.type).join(", ")}`);
}
return this;
}
hasKey(key) {
return Reflect.has(this, key);
}
key(key) {
if (!this.hasKey(key)) {
throw new ParsingError(`Missing key ${key}`);
}
return new Maybe(this[key]);
}
};
__name(YTNode, "YTNode");
_YTNode_instances = /* @__PURE__ */ new WeakSet(), _YTNode_is = /* @__PURE__ */ __name(function _YTNode_is2(type) {
return this.type === type.type;
}, "_YTNode_is");
YTNode.type = "YTNode";
var MAYBE_TAG = "Maybe";
var Maybe = class {
constructor(value) {
_Maybe_instances.add(this);
_Maybe_value.set(this, void 0);
__classPrivateFieldSet(this, _Maybe_value, value, "f");
}
get typeof() {
return typeof __classPrivateFieldGet(this, _Maybe_value, "f");
}
string() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimitive).call(this, "string");
}
isString() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimitive).call(this, "string");
}
number() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimitive).call(this, "number");
}
isNumber() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimitive).call(this, "number");
}
bigint() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimitive).call(this, "bigint");
}
isBigint() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimitive).call(this, "bigint");
}
boolean() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimitive).call(this, "boolean");
}
isBoolean() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimitive).call(this, "boolean");
}
symbol() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimitive).call(this, "symbol");
}
isSymbol() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimitive).call(this, "symbol");
}
undefined() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimitive).call(this, "undefined");
}
isUndefined() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimitive).call(this, "undefined");
}
null() {
if (__classPrivateFieldGet(this, _Maybe_value, "f") !== null)
throw new TypeError(`Expected null, got ${typeof __classPrivateFieldGet(this, _Maybe_value, "f")}`);
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
isNull() {
return __classPrivateFieldGet(this, _Maybe_value, "f") === null;
}
object() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimitive).call(this, "object");
}
isObject() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimitive).call(this, "object");
}
function() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_assertPrimitive).call(this, "function");
}
isFunction() {
return __classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimitive).call(this, "function");
}
array() {
if (!Array.isArray(__classPrivateFieldGet(this, _Maybe_value, "f"))) {
throw new TypeError(`Expected array, got ${typeof __classPrivateFieldGet(this, _Maybe_value, "f")}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
arrayOfMaybe() {
const arrayProps = [];
return new Proxy(this.array(), {
get(target, prop) {
if (Reflect.has(arrayProps, prop)) {
return Reflect.get(target, prop);
}
return new Maybe(Reflect.get(target, prop));
}
});
}
isArray() {
return Array.isArray(__classPrivateFieldGet(this, _Maybe_value, "f"));
}
node() {
if (!(__classPrivateFieldGet(this, _Maybe_value, "f") instanceof YTNode)) {
throw new TypeError(`Expected YTNode, got ${__classPrivateFieldGet(this, _Maybe_value, "f").constructor.name}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
isNode() {
return __classPrivateFieldGet(this, _Maybe_value, "f") instanceof YTNode;
}
nodeOfType(...types2) {
return this.node().as(...types2);
}
isNodeOfType(...types2) {
return this.isNode() && this.node().is(...types2);
}
observed() {
if (!this.isObserved()) {
throw new TypeError(`Expected ObservedArray, got ${typeof __classPrivateFieldGet(this, _Maybe_value, "f")}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
isObserved() {
return __classPrivateFieldGet(this, _Maybe_value, "f")?.[isObserved];
}
parsed() {
if (!(__classPrivateFieldGet(this, _Maybe_value, "f") instanceof SuperParsedResult)) {
throw new TypeError(`Expected SuperParsedResult, got ${typeof __classPrivateFieldGet(this, _Maybe_value, "f")}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
isParsed() {
return __classPrivateFieldGet(this, _Maybe_value, "f") instanceof SuperParsedResult;
}
any() {
warn(MAYBE_TAG, "This call is not meant to be used outside of debugging. Please use the specific type getter instead.");
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
instanceof(type) {
if (!this.isInstanceof(type)) {
throw new TypeError(`Expected instance of ${type.name}, got ${__classPrivateFieldGet(this, _Maybe_value, "f").constructor.name}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}
isInstanceof(type) {
return __classPrivateFieldGet(this, _Maybe_value, "f") instanceof type;
}
};
__name(Maybe, "Maybe");
_Maybe_value = /* @__PURE__ */ new WeakMap(), _Maybe_instances = /* @__PURE__ */ new WeakSet(), _Maybe_checkPrimitive = /* @__PURE__ */ __name(function _Maybe_checkPrimitive2(type) {
return typeof __classPrivateFieldGet(this, _Maybe_value, "f") === type;
}, "_Maybe_checkPrimitive"), _Maybe_assertPrimitive = /* @__PURE__ */ __name(function _Maybe_assertPrimitive2(type) {
if (!__classPrivateFieldGet(this, _Maybe_instances, "m", _Maybe_checkPrimitive).call(this, type)) {
throw new TypeError(`Expected ${type}, got ${this.typeof}`);
}
return __classPrivateFieldGet(this, _Maybe_value, "f");
}, "_Maybe_assertPrimitive");
var SuperParsedResult = class {
constructor(result) {
_SuperParsedResult_result.set(this, void 0);
__classPrivateFieldSet(this, _SuperParsedResult_result, result, "f");
}
get is_null() {
return __classPrivateFieldGet(this, _SuperParsedResult_result, "f") === null;
}
get is_array() {
return !this.is_null && Array.isArray(__classPrivateFieldGet(this, _SuperParsedResult_result, "f"));
}
get is_node() {
return !this.is_array;
}
array() {
if (!this.is_array) {
throw new TypeError("Expected an array, got a node");
}
return __classPrivateFieldGet(this, _SuperParsedResult_result, "f");
}
item() {
if (!this.is_node) {
throw new TypeError("Expected a node, got an array");
}
return __classPrivateFieldGet(this, _SuperParsedResult_result, "f");
}
};
__name(SuperParsedResult, "SuperParsedResult");
_SuperParsedResult_result = /* @__PURE__ */ new WeakMap();
function observe(obj) {
return new Proxy(obj, {
get(target, prop) {
if (prop == "get") {
return (rule, del_item) => target.find((obj2, index) => {
const match = deepCompare(rule, obj2);
if (match && del_item) {
target.splice(index, 1);
}
return match;
});
}
if (prop == isObserved) {
return true;
}
if (prop == "getAll") {
return (rule, del_items) => target.filter((obj2, index) => {
const match = deepCompare(rule, obj2);
if (match && del_items) {
target.splice(index, 1);
}
return match;
});
}
if (prop == "matchCondition") {
return (condition) => target.find((obj2) => {
return condition(obj2);
});
}
if (prop == "filterType") {
return (...types2) => {
return observe(target.filter((node) => {
return !!node.is(...types2);
}));
};
}
if (prop == "firstOfType") {
return (...types2) => {
return target.find((node) => {
return !!node.is(...types2);
});
};
}
if (prop == "first") {
return () => target[0];
}
if (prop == "as") {
return (...types2) => {
return observe(target.map((node) => {
if (node.is(...types2))
return node;
throw new ParsingError(`Expected node of any type ${types2.map((type) => type.type).join(", ")}, got ${node.type}`);
}));
};
}
if (prop == "remove") {
return (index) => target.splice(index, 1);
}
return Reflect.get(target, prop);
}
});
}
__name(observe, "observe");
var Memo = class extends Map {
getType(...types2) {
types2 = types2.flat();
return observe(types2.flatMap((type) => this.get(type.type) || []));
}
};
__name(Memo, "Memo");
// dist/src/parser/misc.js
var misc_exports = {};
__export(misc_exports, {
Author: () => Author,
ChildElement: () => ChildElement_default,
EmojiRun: () => EmojiRun,
Format: () => Format_default,
RendererContext: () => RendererContext,
Text: () => Text,
TextRun: () => TextRun,
Thumbnail: () => Thumbnail,
VideoDetails: () => VideoDetails
});
// dist/src/utils/Constants.js
var Constants_exports = {};
__export(Constants_exports, {
CLIENTS: () => CLIENTS,
CLIENT_NAME_IDS: () => CLIENT_NAME_IDS,
INNERTUBE_HEADERS_BASE: () => INNERTUBE_HEADERS_BASE,
OAUTH: () => OAUTH,
STREAM_HEADERS: () => STREAM_HEADERS,
SUPPORTED_CLIENTS: () => SUPPORTED_CLIENTS,
URLS: () => URLS
});
var URLS = {
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: {
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/"
};
var OAUTH = {
REGEX: {
TV_SCRIPT: new RegExp('<script\\s+id="base-js"\\s+src="([^"]+)"[^>]*><\\/script>'),
CLIENT_IDENTITY: new RegExp('clientId:"(?<client_id>[^"]+)",[^"]*?:"(?<client_secret>[^"]+)"')
}
};
var CLIENTS = {
IOS: {
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: "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: "MWEB",
VERSION: "2.20241205.01.00",
API_VERSION: "v1"
},
WEB_KIDS: {
NAME: "WEB_KIDS",
VERSION: "2.20230111.00.00"
},
YTMUSIC: {
NAME: "WEB_REMIX",
VERSION: "1.20250219.01.00"
},
ANDROID: {
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: "ANDROID_CREATOR",
VERSION: "22.43.101"
},
YTMUSIC_ANDROID: {
NAME: "ANDROID_MUSIC",
VERSION: "5.34.51"
},
TV: {
NAME: "TVHTML5",
VERSION: "7.20241016.15.00",
USER_AGENT: "Mozilla/5.0 (ChromiumStylePlatform) Cobalt/Version"
},
TV_EMBEDDED: {
NAME: "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
VERSION: "2.0"
},
WEB_EMBEDDED: {
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: "WEB_CREATOR",
VERSION: "1.20241203.01.00",
API_KEY: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
API_VERSION: "v1",
STATIC_VISITOR_ID: "6zpwvWUNAco"
}
};
var CLIENT_NAME_IDS = {
iOS: "5",
WEB: "1",
MWEB: "2",
WEB_KIDS: "76",
WEB_REMIX: "67",
ANDROID: "3",
ANDROID_CREATOR: "14",
ANDROID_MUSIC: "21",
TVHTML5: "7",
TVHTML5_SIMPLY_EMBEDDED_PLAYER: "85",
WEB_EMBEDDED_PLAYER: "56",
WEB_CREATOR: "62"
};
var STREAM_HEADERS = {
"accept": "*/*",
"origin": "https://www.youtube.com",
"referer": "https://www.youtube.com",
"DNT": "?1"
};
var INNERTUBE_HEADERS_BASE = {
"accept": "*/*",
"accept-encoding": "gzip, deflate",
"content-type": "application/json"
};
var SUPPORTED_CLIENTS = ["IOS", "WEB", "MWEB", "YTKIDS", "YTMUSIC", "ANDROID", "YTSTUDIO_ANDROID", "YTMUSIC_ANDROID", "TV", "TV_EMBEDDED", "WEB_EMBEDDED", "WEB_CREATOR"];
// dist/src/parser/parser.js
var parser_exports = {};
__export(parser_exports, {
addRuntimeParser: () => addRuntimeParser,
applyCommentsMutations: () => applyCommentsMutations,
applyMutations: () => applyMutations,
getDynamicParsers: () => getDynamicParsers,
getParserByName: () => getParserByName,
hasParser: () => hasParser,
parse: () => parse,
parseActions: () => parseActions,
parseArray: () => parseArray,
parseC: () => parseC,
parseCommand: () => parseCommand,
parseCommands: () => parseCommands,
parseFormats: () => parseFormats,
parseItem: () => parseItem,
parseLC: () => parseLC,
parseRR: () => parseRR,
parseResponse: () => parseResponse,
sanitizeClassName: () => sanitizeClassName,
setParserErrorHandler: () => setParserErrorHandler,
shouldIgnore: () => shouldIgnore
});
// dist/src/parser/nodes.js
var nodes_exports = {};
__export(nodes_exports, {
AboutChannel: () => AboutChannel_default,
AboutChannelView: () => AboutChannelView_default,
AccountChannel: () => AccountChannel_default,
AccountItem: () => AccountItem_default,
AccountItemSection: () => AccountItemSection_default,
AccountItemSectionHeader: () => AccountItemSectionHeader_default,
AccountSectionList: () => AccountSectionList_default,
ActiveAccountHeader: () => ActiveAccountHeader_default,
AddBannerToLiveChatCommand: () => AddBannerToLiveChatCommand_default,
AddChatItemAction: () => AddChatItemAction_default,
AddLiveChatTickerItemAction: () => AddLiveChatTickerItemAction_default,
AddToPlaylist: () => AddToPlaylist_default,
AddToPlaylistCommand: () => AddToPlaylistCommand_default,
AddToPlaylistEndpoint: () => AddToPlaylistEndpoint_default,
AddToPlaylistServiceEndpoint: () => AddToPlaylistServiceEndpoint_default,
Alert: () => Alert_default,
AlertWithButton: () => AlertWithButton_default,
AnchoredSection: () => AnchoredSection_default,
AnimatedThumbnailOverlayView: () => AnimatedThumbnailOverlayView_default,
AppendContinuationItemsAction: () => AppendContinuationItemsAction_default,
AttributionView: () => AttributionView_default,
AudioOnlyPlayability: () => AudioOnlyPlayability_default,
AuthorCommentBadge: () => AuthorCommentBadge_default,
AutomixPreviewVideo: () => AutomixPreviewVideo_default,
AvatarStackView: () => AvatarStackView_default,
AvatarView: () => AvatarView_default,
BackgroundPromo: () => BackgroundPromo_default,
BackstageImage: () => BackstageImage_default,
BackstagePost: () => BackstagePost_default,
BackstagePostThread: () => BackstagePostThread_default,
BadgeView: () => BadgeView,
BrowseEndpoint: () => BrowseEndpoint_default,
BrowseFeedActions: () => BrowseFeedActions_default,
BrowserMediaSession: () => BrowserMediaSession_default,
BumperUserEduContentView: () => BumperUserEduContentView_default,
Button: () => Button_default,
ButtonCardView: () => ButtonCardView_default,
ButtonView: () => ButtonView_default,
C4TabbedHeader: () => C4TabbedHeader_default,
CallToActionButton: () => CallToActionButton_default,
Card: () => Card_default,
CardCollection: () => CardCollection_default,
CarouselHeader: () => CarouselHeader_default,
CarouselItem: () => CarouselItem_default,
CarouselItemView: () => CarouselItemView_default,
CarouselLockup: () => CarouselLockup_default,
CarouselTitleView: () => CarouselTitleView_default,
ChangeEngagementPanelVisibilityAction: () => ChangeEngagementPanelVisibilityAction_default,
Channel: () => Channel_default,
ChannelAboutFullMetadata: () => ChannelAboutFullMetadata_default,
ChannelAgeGate: () => ChannelAgeGate_default,
ChannelExternalLinkView: () => ChannelExternalLinkView_default,
ChannelFeaturedContent: () => ChannelFeaturedContent_default,
ChannelHeaderLinks: () => ChannelHeaderLinks_default,
ChannelHeaderLinksView: () => ChannelHeaderLinksView_default,
ChannelMetadata: () => ChannelMetadata_default,
ChannelMobileHeader: () => ChannelMobileHeader_default,
ChannelOptions: () => ChannelOptions_default,
ChannelOwnerEmptyState: () => ChannelOwnerEmptyState_default,
ChannelSubMenu: () => ChannelSubMenu_default,
ChannelSwitcherHeader: () => ChannelSwitcherHeader_default,
ChannelSwitcherPage: () => ChannelSwitcherPage_default,
ChannelTagline: () => ChannelTagline_default,
ChannelThumbnailWithLink: () => ChannelThumbnailWithLink_default,
ChannelVideoPlayer: () => ChannelVideoPlayer_default,
Chapter: () => Chapter_default,
ChildVideo: () => ChildVideo_default,
ChipBarView: () => ChipBarView_default,
ChipCloud: () => ChipCloud_default,
ChipCloudChip: () => ChipCloudChip_default,
ChipView: () => ChipView_default,
ClientSideToggleMenuItem: () => ClientSideToggleMenuItem_default,
ClipAdState: () => ClipAdState_default,
ClipCreation: () => ClipCreation_default,
ClipCreationScrubber: () => ClipCreationScrubber_default,
ClipCreationTextInput: () => ClipCreationTextInput_default,
ClipSection: () => ClipSection_default,
CollaboratorInfoCardContent: () => CollaboratorInfoCardContent_default,
CollageHeroImage: () => CollageHeroImage_default,
CollectionThumbnailView: () => CollectionThumbnailView_default,
CommandExecutorCommand: () => CommandExecutorCommand_default,
CommentActionButtons: () => CommentActionButtons_default,
CommentDialog: () => CommentDialog_default,
CommentReplies: () => CommentReplies_default,
CommentReplyDialog: () => CommentReplyDialog_default,
CommentSimplebox: () => CommentSimplebox_default,
CommentThread: () => CommentThread_default,
CommentView: () => CommentView_default,
CommentsEntryPointHeader: () => CommentsEntryPointHeader_default,
CommentsEntryPointTeaser: () => CommentsEntryPointTeaser_default,
CommentsHeader: () => CommentsHeader_default,
CommentsSimplebox: () => CommentsSimplebox_default,
CompactChannel: () => CompactChannel_default,
CompactLink: () => CompactLink_default,
CompactMix: () => CompactMix_default,
CompactMovie: () => CompactMovie_default,
CompactPlaylist: () => CompactPlaylist_default,
CompactStation: () => CompactStation_default,
CompactVideo: () => CompactVideo_default,
ConfirmDialog: () => ConfirmDialog_default,
ContentMetadataView: () => ContentMetadataView_default,
ContentPreviewImageView: () => ContentPreviewImageView_default,
ContinuationCommand: () => ContinuationCommand_default,
ContinuationItem: () => ContinuationItem_default,
ConversationBar: () => ConversationBar_default,
CopyLink: () => CopyLink_default,
CreateCommentEndpoint: () => CreateCommentEndpoint_default,
CreatePlaylistDialog: () => CreatePlaylistDialog_default,
CreatePlaylistDialogFormView: () => CreatePlaylistDialogFormView_default,
CreatePlaylistServiceEndpoint: () => CreatePlaylistServiceEndpoint_default,
CreatorHeart: () => CreatorHeart_default,
CreatorHeartView: () => CreatorHeartView_default,
DecoratedAvatarView: () => DecoratedAvatarView_default,
DecoratedPlayerBar: () => DecoratedPlayerBar_default,
DefaultPromoPanel: () => DefaultPromoPanel_default,
DeletePlaylistEndpoint: () => DeletePlaylistEndpoint_default,
DescriptionPreviewView: () => DescriptionPreviewView_default,
DialogHeaderView: () => DialogHeaderView_default,
DialogView: () => DialogView_default,
DidYouMean: () => DidYouMean_default,
DimChatItemAction: () => DimChatItemAction_default,
DislikeButtonView: () => DislikeButtonView_default,
DownloadButton: () => DownloadButton_default,
Dropdown: () => Dropdown_default,
DropdownItem: () => DropdownItem_default,
DropdownView: () => DropdownView_default,
DynamicTextView: () => DynamicTextView_default,
Element: () => Element_default,
EmergencyOnebox: () => EmergencyOnebox_default,
EmojiPicker: () => EmojiPicker_default,
EmojiPickerCategory: () => EmojiPickerCategory_default,
EmojiPickerCategoryButton: () => EmojiPickerCategoryButton_default,
EmojiPickerUpsellCategory: () => EmojiPickerUpsellCategory_default,
EndScreenPlaylist: () => EndScreenPlaylist_default,
EndScreenVideo: () => EndScreenVideo_default,
Endscreen: () => Endscreen_default,
EndscreenElement: () => EndscreenElement_default,
EngagementPanelSectionList: () => EngagementPanelSectionList_default,
EngagementPanelTitleHeader: () => EngagementPanelTitleHeader_default,
EomSettingsDisclaimer: () => EomSettingsDisclaimer_default,
ExpandableMetadata: () => ExpandableMetadata_default,
ExpandableTab: () => ExpandableTab_default,
ExpandableVideoDescriptionBody: () => ExpandableVideoDescriptionBody_default,
ExpandedShelfContents: () => ExpandedShelfContents_default,
Factoid: () => Factoid_default,
FancyDismissibleDialog: () => FancyDismissibleDialog_default,
FeedFilterChipBar: () => FeedFilterChipBar_default,
FeedNudge: () => FeedNudge_default,
FeedTabbedHeader: () => FeedTabbedHeader_default,
FeedbackEndpoint: () => FeedbackEndpoint_default,
FlexibleActionsView: () => FlexibleActionsView_default,
FormFooterView: () => FormFooterView_default,
GameCard: () => GameCard_default,
GameDetails: () => GameDetails_default,
GetAccountsListInnertubeEndpoint: () => GetAccountsListInnertubeEndpoint_default,
GetKidsBlocklistPickerCommand: () => GetKidsBlocklistPickerCommand_default,
GetMultiPageMenuAction: () => GetMultiPageMenuAction_default,
Grid: () => Grid_default,
GridChannel: () => GridChannel_default,
GridHeader: () => GridHeader_default,
GridMix: () => GridMix_default,
GridMovie: () => GridMovie_default,
GridPlaylist: () => GridPlaylist_default,
GridShow: () => GridShow_default,
GridVideo: () => GridVideo_default,
GuideCollapsibleEntry: () => GuideCollapsibleEntry_default,
GuideCollapsibleSectionEntry: () => GuideCollapsibleSectionEntry_default,
GuideDownloadsEntry: () => GuideDownloadsEntry_default,
GuideEntry: () => GuideEntry_default,
GuideSection: () => GuideSection_default,
GuideSubscriptionsSection: () => GuideSubscriptionsSection_default,
HashtagHeader: () => HashtagHeader_default,
HashtagTile: () => HashtagTile_default,
HeatMarker: () => HeatMarker_default,
Heatmap: () => Heatmap_default,
HeroPlaylistThumbnail: () => HeroPlaylistThumbnail_default,
HideEngagementPanelEndpoint: () => HideEngagementPanelEndpoint_default,
HighlightsCarousel: () => HighlightsCarousel_default,
HistorySuggestion: () => HistorySuggestion_default,
HorizontalCardList: () => HorizontalCardList_default,
HorizontalList: () => HorizontalList_default,
HorizontalMovieList: () => HorizontalMovieList_default,
HowThisWasMadeSectionView: () => HowThisWasMadeSectionView_default,
IconLink: () => IconLink_default,
ImageBannerView: () => ImageBannerView_default,
IncludingResultsFor: () => IncludingResultsFor_default,
InfoPanelContainer: () => InfoPanelContainer_default,
InfoPanelContent: () => InfoPanelContent_default,
InfoRow: () => InfoRow_default,
InteractiveTabbedHeader: () => InteractiveTabbedHeader_default,
ItemSection: () => ItemSection_default,
ItemSectionHeader: () => ItemSectionHeader_default,
ItemSectionTab: () => ItemSectionTab_default,
ItemSectionTabbedHeader: () => ItemSectionTabbedHeader_default,
KidsBlocklistPicker: () => KidsBlocklistPicker_default,
KidsBlocklistPickerItem: () => KidsBlocklistPickerItem_default,
KidsCategoriesHeader: () => KidsCategoriesHeader_default,
KidsCategoryTab: () => KidsCategoryTab_default,
KidsHomeScreen: () => KidsHomeScreen_default,
LikeButton: () => LikeButton_default,
LikeButtonView: () => LikeButtonView_default,
LikeEndpoint: () => LikeEndpoint_default,
LiveChat: () => LiveChat_default,
LiveChatActionPanel: () => LiveChatActionPanel_default,
LiveChatAuthorBadge: () => LiveChatAuthorBadge_default,
LiveChatAutoModMessage: () => LiveChatAutoModMessage_default,
LiveChatBanner: () => LiveChatBanner_default,
LiveChatBannerChatSummary: () => LiveChatBannerChatSummary_default,
LiveChatBannerHeader: () => LiveChatBannerHeader_default,
LiveChatBannerPoll: () => LiveChatBannerPoll_default,
LiveChatBannerRedirect: () => LiveChatBannerRedirect_default,
LiveChatDialog: () => LiveChatDialog_default,
LiveChatHeader: () => LiveChatHeader_default,
LiveChatItemBumperView: () => LiveChatItemBumperView_default,
LiveChatItemContextMenuEndpoint: () => LiveChatItemContextMenuEndpoint_default,
LiveChatItemList: () => LiveChatItemList_default,
LiveChatMembershipItem: () => LiveChatMembershipItem_default,
LiveChatMessageInput: () => LiveChatMessageInput_default,
LiveChatModeChangeMessage: () => LiveChatModeChangeMessage_default,
LiveChatPaidMessage: () => LiveChatPaidMessage_default,
LiveChatPaidSticker: () => LiveChatPaidSticker_default,
LiveChatParticipant: () => LiveChatParticipant_default,
LiveChatParticipantsList: () => LiveChatParticipantsList_default,
LiveChatPlaceholderItem: () => LiveChatPlaceholderItem_default,
LiveChatProductItem: () => LiveChatProductItem_default,
LiveChatRestrictedParticipation: () => LiveChatRestrictedParticipation_default,
LiveChatSponsorshipsGiftPurchaseAnnouncement: () => LiveChatSponsorshipsGiftPurchaseAnnouncement_default,
LiveChatSponsorshipsGiftRedemptionAnnouncement: () => LiveChatSponsorshipsGiftRedemptionAnnouncement_default,
LiveChatSponsorshipsHeader: () => LiveChatSponsorshipsHeader_default,
LiveChatTextMessage: () => LiveChatTextMessage_default,
LiveChatTickerPaidMessageItem: () => LiveChatTickerPaidMessageItem_default,
LiveChatTickerPaidStickerItem: () => LiveChatTickerPaidStickerItem_default,
LiveChatTickerSponsorItem: () => LiveChatTickerSponsorItem_default,
LiveChatViewerEngagementMessage: () => LiveChatViewerEngagementMessage_default,
LockupMetadataView: () => LockupMetadataView_default,
LockupView: () => LockupView_default,
MacroMarkersInfoItem: () => MacroMarkersInfoItem_default,
MacroMarkersList: () => MacroMarkersList_default,
MacroMarkersListItem: () => MacroMarkersListItem_default,
MarkChatItemAsDeletedAction: () => MarkChatItemAsDeletedAction_default,
MarkChatItemsByAuthorAsDeletedAction: () => MarkChatItemsByAuthorAsDeletedAction_default,
Menu: () => Menu_default,
MenuFlexibleItem: () => MenuFlexibleItem_default,
MenuNavigationItem: () => MenuNavigationItem_default,
MenuPopup: () => MenuPopup_default,
MenuServiceItem: () => MenuServiceItem_default,
MenuServiceItemDownload: () => MenuServiceItemDownload_default,
MenuTitle: () => MenuTitle_default,
MerchandiseItem: () => MerchandiseItem_default,
MerchandiseShelf: () => MerchandiseShelf_default,
Message: () => Message_default,
MetadataBadge: () => MetadataBadge_default,
MetadataRow: () => MetadataRow_default,
MetadataRowContainer: () => MetadataRowContainer_default,
MetadataRowHeader: () => MetadataRowHeader_default,
MetadataScreen: () => MetadataScreen_default,
MicroformatData: () => MicroformatData_default,
Mix: () => Mix_default,
MobileTopbar: () => MobileTopbar_default,
ModalWithTitleAndButton: () => ModalWithTitleAndButton_default,
ModifyChannelNotificationPreferenceEndpoint: () => ModifyChannelNotificationPreferenceEndpoint_default,
Movie: () => Movie_default,
MovingThumbnail: () => MovingThumbnail_default,
MultiMarkersPlayerBar: () => MultiMarkersPlayerBar_default,
MultiPageMenu: () => MultiPageMenu_default,
MultiPageMenuNotificationSection: () => MultiPageMenuNotificationSection_default,
MultiPageMenuSection: () => MultiPageMenuSection_default,
MusicCardShelf: () => MusicCardShelf_default,
MusicCardShelfHeaderBasic: () => MusicCardShelfHeaderBasic_default,
MusicCarouselShelf: () => MusicCarouselShelf_default,
MusicCarouselShelfBasicHeader: () => MusicCarouselShelfBasicHeader_default,
MusicDescriptionShelf: () => MusicDescriptionShelf_default,
MusicDetailHeader: () => MusicDetailHeader_default,
MusicDownloadStateBadge: () => MusicDownloadStateBadge_default,
MusicEditablePlaylistDetailHeader: () => MusicEditablePlaylistDetailHeader_default,
MusicElementHeader: () => MusicElementHeader_default,
MusicHeader: () => MusicHeader_default,
MusicImmersiveHeader: () => MusicImmersiveHeader_default,
MusicInlineBadge: () => MusicInlineBadge_default,
MusicItemThumbnailOverlay: () => MusicItemThumbnailOverlay_default,
MusicLargeCardItemCarousel: () => MusicLargeCardItemCarousel_default,
MusicMenuItemDivider: () => MusicMenuItemDivider_default,
MusicMultiRowListItem: () => MusicMultiRowListItem_default,
MusicMultiSelectMenu: () => MusicMultiSelectMenu_default,
MusicMultiSelectMenuItem: () => MusicMultiSelectMenuItem_default,
MusicNavigationButton: () => MusicNavigationButton_default,
MusicPlayButton: () => MusicPlayButton_default,
MusicPlaylistEditHeader: () => MusicPlaylistEditHeader_default,
MusicPlaylistShelf: () => MusicPlaylistShelf_default,
MusicQueue: () => MusicQueue_default,
MusicResponsiveHeader: () => MusicResponsiveHeader_default,
MusicResponsiveListItem: () => MusicResponsiveListItem_default,
MusicResponsiveListItemFixedColumn: () => MusicResponsiveListItemFixedColumn_default,
MusicResponsiveListItemFlexColumn: () => MusicResponsiveListItemFlexColumn_default,
MusicShelf: () => MusicShelf_default,
MusicSideAlignedItem: () => MusicSideAlignedItem_default,
MusicSortFilterButton: () => MusicSortFilterButton_default,
MusicTastebuilderShelf: () => MusicTastebuilderShelf_default,
MusicTastebuilderShelfThumbnail: () => MusicTastebuilderShelfThumbnail_default,
MusicThumbnail: () => MusicThumbnail_default,
MusicTwoRowItem: () => MusicTwoRowItem_default,
MusicVisualHeader: () => MusicVisualHeader_default,
NavigationEndpoint: () => NavigationEndpoint_default,
Notification: () => Notification_default,
NotificationAction: () => NotificationAction_default,
OpenPopupAction: () => OpenPopupAction_default,
PageHeader: () => PageHeader_default,
PageHeaderView: () => PageHeaderView_default,
PageIntroduction: () => PageIntroduction_default,
PanelFooterView: () => PanelFooterView_default,
PdgCommentChip: () => PdgCommentChip_default,
PdgReplyButtonView: () => PdgReplyButtonView_default,
PerformCommentActionEndpoint: () => PerformCommentActionEndpoint_default,
PivotBar: () => PivotBar_default,
PivotBarItem: () => PivotBarItem_default,
PivotButton: () => PivotButton_default,
PlayerAnnotationsExpanded: () => PlayerAnnotationsExpanded_default,
PlayerCaptionsTracklist: () => PlayerCaptionsTracklist_default,
PlayerControlsOverlay: () => PlayerControlsOverlay_default,
PlayerErrorMessage: () => PlayerErrorMessage_default,
PlayerLegacyDesktopYpcOffer: () => PlayerLegacyDesktopYpcOffer_default,
PlayerLegacyDesktopYpcTrailer: () => PlayerLegacyDesktopYpcTrailer_default,
PlayerLiveStoryboardSpec: () => PlayerLiveStoryboardSpec_default,
PlayerMicroformat: () => PlayerMicroformat_default,
PlayerOverflow: () => PlayerOverflow_default,
PlayerOverlay: () => PlayerOverlay_default,
PlayerOverlayAutoplay: () => PlayerOverlayAutoplay_default,
PlayerOverlayVideoDetails: () => PlayerOverlayVideoDetails_default,
PlayerStoryboardSpec: () => PlayerStoryboardSpec_default,
Playlist: () => Playlist_default,
PlaylistAddToOption: () => PlaylistAddToOption_default,
PlaylistCustomThumbnail: () => PlaylistCustomThumbnail_default,
PlaylistEditEndpoint: () => PlaylistEditEndpoint_default,
PlaylistHeader: () => PlaylistHeader_default,
PlaylistInfoCardContent: () => PlaylistInfoCardContent_default,
PlaylistMetadata: () => PlaylistMetadata_default,
PlaylistPanel: () => PlaylistPanel_default,
PlaylistPanelVideo: () => PlaylistPanelVideo_default,
PlaylistPanelVideoWrapper: () => PlaylistPanelVideoWrapper_default,
PlaylistSidebar: () => PlaylistSidebar_default,
PlaylistSidebarPrimaryInfo: () => PlaylistSidebarPrimaryInfo_default,
PlaylistSidebarSecondaryInfo: () => PlaylistSidebarSecondaryInfo_default,
PlaylistThumbnailOverlay: () => PlaylistThumbnailOverlay_default,
PlaylistVideo: () => PlaylistVideo_default,
PlaylistVideoList: () => PlaylistVideoList_default,
PlaylistVideoThumbnail: () => PlaylistVideoThumbnail_default,
Poll: () => Poll_default,
PollHeader: () => PollHeader_default,
Post: () => Post_default,
PostMultiImage: () => PostMultiImage_default,
PrefetchWatchCommand: () => PrefetchWatchCommand_default,
PremiereTrailerBadge: () => PremiereTrailerBadge_default,
ProductList: () => ProductList_default,
ProductListHeader: () => ProductListHeader_default,
ProductListItem: () => ProductListItem_default,
ProfileColumn: () => ProfileColumn_default,
ProfileColumnStats: () => ProfileColumnStats_default,
ProfileColumnStatsEntry: () => ProfileColumnStatsEntry_default,
ProfileColumnUserInfo: () => ProfileColumnUserInfo_default,
Quiz: () => Quiz_default,
RecognitionShelf: () => RecognitionShelf_default,
ReelItem: () => ReelItem_default,
ReelPlayerHeader: () => ReelPlayerHeader_default,
ReelPlayerOverlay: () => ReelPlayerOverlay_default,
ReelShelf: () => ReelShelf_default,
ReelWatchEndpoint: () => ReelWatchEndpoint_default,
RelatedChipCloud: () => RelatedChipCloud_default,
RemoveBannerForLiveChatCommand: () => RemoveBannerForLiveChatCommand_default,
RemoveChatItemAction: () => RemoveChatItemAction_default,
RemoveChatItemByAuthorAction: () => RemoveChatItemByAuthorAction_default,
ReplaceChatItemAction: () => ReplaceChatItemAction_default,
ReplaceLiveChatAction: () => ReplaceLiveChatAction_default,
ReplayChatItemAction: () => ReplayChatItemAction_default,
RichGrid: () => RichGrid_default,
RichItem: () => RichItem_default,
RichListHeader: () => RichListHeader_default,
RichMetadata: () => RichMetadata_default,
RichMetadataRow: () => RichMetadataRow_default,
RichSection: () => RichSection_default,
RichShelf: () => RichShelf_default,
RunAttestationCommand: () => RunAttestationCommand_default,
SearchBox: () => SearchBox_default,
SearchEndpoint: () => SearchEndpoint_default,
SearchFilter: () => SearchFilter_default,
SearchFilterGroup: () => SearchFilterGroup_default,
SearchFilterOptionsDialog: () => SearchFilterOptionsDialog_default,
SearchHeader: () => SearchHeader_default,
SearchRefinementCard: () => SearchRefinementCard_default,
SearchSubMenu: () => SearchSubMenu_default,
SearchSuggestion: () => SearchSuggestion_default,
SearchSuggestionsSection: () => SearchSuggestionsSection_default,
SecondarySearchContainer: () => SecondarySearchContainer_default,
SectionList: () => SectionList_default,
SegmentedLikeDislikeButton: () => SegmentedLikeDislikeButton_default,
SegmentedLikeDislikeButtonView: () => SegmentedLikeDislikeButtonView_default,
SendFeedbackAction: () => SendFeedbackAction_default,
SettingBoolean: () => SettingBoolean_default,
SettingsCheckbox: () => SettingsCheckbox_default,
SettingsOptions: () => SettingsOptions_default,
SettingsSidebar: () => SettingsSidebar_default,
SettingsSwitch: () => SettingsSwitch_default,
ShareEndpoint: () => ShareEndpoint_default,
ShareEntityEndpoint: () => ShareEntityEndpoint_default,
ShareEntityServiceEndpoint: () => ShareEntityServiceEndpoint_default,
SharePanelHeader: () => SharePanelHeader_default,
SharePanelTitleV15: () => SharePanelTitleV15_default,
ShareTarget: () => ShareTarget_default,
SharedPost: () => SharedPost_default,
Shelf: () => Shelf_default,
ShortsLockupView: () => ShortsLockupView_default,
ShowCustomThumbnail: () => ShowCustomThumbnail_default,
ShowDialogCommand: () => ShowDialogCommand_default,
ShowEngagementPanelEndpoint: () => ShowEngagementPanelEndpoint_default,
ShowLiveChatActionPanelAction: () => ShowLiveChatActionPanelAction_default,
ShowLiveChatDialogAction: () => ShowLiveChatDialogAction_default,
ShowLiveChatTooltipCommand: () => ShowLiveChatTooltipCommand_default,
ShowingResultsFor: () => ShowingResultsFor_default,
SignalAction: () => SignalAction_default,
SignalServiceEndpoint: () => SignalServiceEndpoint_default,
SimpleCardContent: () => SimpleCardContent_default,
SimpleCardTeaser: () => SimpleCardTeaser_default,
SimpleMenuHeader: () => SimpleMenuHeader_default,
SimpleTextSection: () => SimpleTextSection_default,
SingleActionEmergencySupport: () => SingleActionEmergencySupport_default,
SingleColumnBrowseResults: () => SingleColumnBrowseResults_default,
SingleColumnMusicWatchNextResults: () => SingleColumnMusicWatchNextResults_default,
SingleHeroImage: () => SingleHeroImage_default,
SlimOwner: () => SlimOwner_default,
SlimVideoMetadata: () => SlimVideoMetadata_default,
SortFilterHeader: () => SortFilterHeader_default,
SortFilterSubMenu: () => SortFilterSubMenu_default,
SponsorCommentBadge: () => SponsorCommentBadge_default,
StartAt: () => StartAt_default,
StructuredDescriptionContent: () => StructuredDescriptionContent_default,
StructuredDescriptionPlaylistLockup: () => StructuredDescriptionPlaylistLockup_default,
SubFeedOption: () => SubFeedOption_default,
SubFeedSelector: () => SubFeedSelector_default,
SubscribeButton: () => SubscribeButton_default,
SubscribeEndpoint: () => SubscribeEndpoint_default,
SubscriptionNotificationToggleButton: () => SubscriptionNotificationToggleButton_default,
Tab: () => Tab_default,
Tabbed: () => Tabbed_default,
TabbedSearchResults: () => TabbedSearchResults_default,
TextCarouselItemView: () => TextCarouselItemView_default,
TextFieldView: () => TextFieldView_default,
TextHeader: () => TextHeader_default,
ThirdPartyShareTargetSection: () => ThirdPartyShareTargetSection_default,
ThumbnailBadgeView: () => ThumbnailBadgeView_default,
ThumbnailBottomOverlayView: () => ThumbnailBottomOverlayView_default,
ThumbnailHoverOverlayToggleActionsView: () => ThumbnailHoverOverlayToggleActionsView_default,
ThumbnailHoverOverlayView: () => ThumbnailHoverOverlayView_default,
ThumbnailLandscapePortrait: () => ThumbnailLandscapePortrait_default,
ThumbnailOverlayBadgeView: () => ThumbnailOverlayBadgeView_default,
ThumbnailOverlayBottomPanel: () => ThumbnailOverlayBottomPanel_default,
ThumbnailOverlayEndorsement: () => ThumbnailOverlayEndorsement_default,
ThumbnailOverlayHoverText: () => ThumbnailOverlayHoverText_default,
ThumbnailOverlayInlineUnplayable: () => ThumbnailOverlayInlineUnplayable_default,
ThumbnailOverlayLoadingPreview: () => ThumbnailOverlayLoadingPreview_default,
ThumbnailOverlayNowPlaying: () => ThumbnailOverlayNowPlaying_default,
ThumbnailOverlayPinking: () => ThumbnailOverlayPinking_default,
ThumbnailOverlayPlaybackStatus: () => ThumbnailOverlayPlaybackStatus_default,
ThumbnailOverlayProgressBarView: () => ThumbnailOverlayProgressBarView_default,
ThumbnailOverlayResumePlayback: () => ThumbnailOverlayResumePlayback_default,
ThumbnailOverlaySidePanel: () => ThumbnailOverlaySidePanel_default,
ThumbnailOverlayTimeStatus: () => ThumbnailOverlayTimeStatus_default,
ThumbnailOverlayToggleButton: () => ThumbnailOverlayToggleButton_default,
ThumbnailView: () => ThumbnailView_default,
TimedMarkerDecoration: () => TimedMarkerDecoration_default,
TitleAndButtonListHeader: () => TitleAndButtonListHeader_default,
ToggleButton: () => ToggleButton_default,
ToggleButtonView: () => ToggleButtonView_default,
ToggleMenuServiceItem: () => ToggleMenuServiceItem_default,
Tooltip: () => Tooltip_default,
TopbarMenuButton: () => TopbarMenuButton_default,
TopicChannelDetails: () => TopicChannelDetails_default,
Transcript: () => Transcript_default,
TranscriptFooter: () => TranscriptFooter_default,
TranscriptSearchBox: () => TranscriptSearchBox_default,
TranscriptSearchPanel: () => TranscriptSearchPanel_default,
TranscriptSectionHeader: () => TranscriptSectionHeader_default,
TranscriptSegment: () => TranscriptSegment_default,
TranscriptSegmentList: () => TranscriptSegmentList_default,
TwoColumnBrowseResults: () => TwoColumnBrowseResults_default,
TwoColumnSearchResults: () => TwoColumnSearchResults_default,
TwoColumnWatchNextResults: () => TwoColumnWatchNextResults_default,
UnifiedSharePanel: () => UnifiedSharePanel_default,
UniversalWatchCard: () => UniversalWatchCard_default,
UnsubscribeEndpoint: () => UnsubscribeEndpoint_default,
UpdateChannelSwitcherPageAction: () => UpdateChannelSwitcherPageAction_default,
UpdateDateTextAction: () => UpdateDateTextAction_default,
UpdateDescriptionAction: () => UpdateDescriptionAction_default,
UpdateEngagementPanelAction: () => UpdateEngagementPanelAction_default,
UpdateEngagementPanelContentCommand: () => UpdateEngagementPanelContentCommand_default,
UpdateLiveChatPollAction: () => UpdateLiveChatPollAction_default,
UpdateSubscribeButtonAction: () => UpdateSubscribeButtonAction_default,
UpdateTitleAction: () => UpdateTitleAction_default,
UpdateToggleButtonTextAction: () => UpdateToggleButtonTextAction_default,
UpdateViewershipAction: () => UpdateViewershipAction_default,
UploadTimeFactoid: () => UploadTimeFactoid_default,
UpsellDialog: () => UpsellDialog_default,
VerticalList: () => VerticalList_default,
VerticalWatchCardList: () => VerticalWatchCardList_default,
Video: () => Video_default,
VideoAttributeView: () => VideoAttributeView_default,
VideoAttributesSectionView: () => VideoAttributesSectionView_default,
VideoCard: () => VideoCard_default,
VideoDescriptionCourseSection: () => VideoDescriptionCourseSection_default,
VideoDescriptionHeader: () => VideoDescriptionHeader_default,
VideoDescriptionInfocardsSection: () => VideoDescriptionInfocardsSection_default,
VideoDescriptionMusicSection: () => VideoDescriptionMusicSection_default,
VideoDescriptionTranscriptSection: () => VideoDescriptionTranscriptSection_default,
VideoInfoCardContent: () => VideoInfoCardContent_default,
VideoMetadataCarouselView: () => VideoMetadataCarouselView_default,
VideoOwner: () => VideoOwner_default,
VideoPrimaryInfo: () => VideoPrimaryInfo_default,
VideoSecondaryInfo: () => VideoSecondaryInfo_default,
VideoViewCount: () => VideoViewCount_default,
ViewCountFactoid: () => ViewCountFactoid_default,
WatchCardCompactVideo: () => WatchCardCompactVideo_default,
WatchCardHeroVideo: () => WatchCardHeroVideo_default,
WatchCardRichHeader: () => WatchCardRichHeader_default,
WatchCardSectionSequence: () => WatchCardSectionSequence_default,
WatchEndpoint: () => WatchEndpoint_default,
WatchNextEndScreen: () => WatchNextEndScreen_default,
WatchNextEndpoint: () => WatchNextEndpoint_default,
WatchNextTabbedResults: () => WatchNextTabbedResults_default,
YpcTrailer: () => YpcTrailer_default
});
// dist/src/utils/Cache.js
var _UniversalCache_cache;
var UniversalCache = class {
constructor(persistent, persistent_directory) {
_UniversalCache_cache.set(this, void 0);
__classPrivateFieldSet(this, _UniversalCache_cache, new Platform.shim.Cache(persistent, persistent_directory), "f");
}
get cache_dir() {
return __classPrivateFieldGet(this, _UniversalCache_cache, "f").cache_dir;
}
get(key) {
return __classPrivateFieldGet(this, _UniversalCache_cache, "f").get(key);
}
set(key, value) {
return __classPrivateFieldGet(this, _UniversalCache_cache, "f").set(key, value);
}
remove(key) {
return __classPrivateFieldGet(this, _UniversalCache_cache, "f").remove(key);
}
};
__name(UniversalCache, "UniversalCache");
_UniversalCache_cache = /* @__PURE__ */ new WeakMap();
var Cache_default = UniversalCache;
// dist/src/utils/EventEmitterLike.js
var _EventEmitterLike_legacy_listeners;
var EventEmitterLike = class extends EventTarget {
constructor() {
super();
_EventEmitterLike_legacy_listeners.set(this, /* @__PURE__ */ new Map());
}
emit(type, ...args) {
const event = new Platform.shim.CustomEvent(type, { detail: args });
this.dispatchEvent(event);
}
on(type, listener) {
const wrapper = /* @__PURE__ */ __name((ev) => {
if (ev instanceof Platform.shim.CustomEvent) {
listener(...ev.detail);
} else {
listener(ev);
}
}, "wrapper");
__classPrivateFieldGet(this, _EventEmitterLike_legacy_listeners, "f").set(listener, wrapper);
this.addEventListener(type, wrapper);
}
once(type, listener) {
const wrapper = /* @__PURE__ */ __name((ev) => {
if (ev instanceof Platform.shim.CustomEvent) {
listener(...ev.detail);
} else {
listener(ev);
}
this.off(type, listener);
}, "wrapper");
__classPrivateFieldGet(this, _EventEmitterLike_legacy_listeners, "f").set(listener, wrapper);
this.addEventListener(type, wrapper);
}
off(type, listener) {
const wrapper = __classPrivateFieldGet(this, _EventEmitterLike_legacy_listeners, "f").get(listener);
if (wrapper) {
this.removeEventListener(type, wrapper);
__classPrivateFieldGet(this, _EventEmitterLike_legacy_listeners, "f").delete(listener);
}
}
};
__name(EventEmitterLike, "EventEmitterLike");
_EventEmitterLike_legacy_listeners = /* @__PURE__ */ new WeakMap();
var EventEmitterLike_default = EventEmitterLike;
// dist/src/utils/FormatUtils.js
var FormatUtils_exports = {};
__export(FormatUtils_exports, {
chooseFormat: () => chooseFormat,
download: () => download,
toDash: () => toDash
});
// dist/src/utils/DashUtils.js
var XML_CHARACTER_MAP = {
"&": "&amp;",
'"': "&quot;",
"'": "&apos;",
"<": "&lt;",
">": "&gt;"
};
function escapeXMLString(str) {
return str.replace(/([&"<>'])/g, (_, item) => {
return XML_CHARACTER_MAP[item];
});
}
__name(escapeXMLString, "escapeXMLString");
function normalizeTag(tag) {
return tag.charAt(0).toUpperCase() + tag.slice(1);
}
__name(normalizeTag, "normalizeTag");
function createElement(tagNameOrFunction, props, ...children) {
const normalizedChildren = children.flat();
if (typeof tagNameOrFunction === "function") {
return tagNameOrFunction({ ...props, children: normalizedChildren });
}
return {
type: normalizeTag(tagNameOrFunction),
props: {
...props,
children: normalizedChildren
}
};
}
__name(createElement, "createElement");
async function renderElementToString(element) {
if (typeof element === "string")
return escapeXMLString(element);
let dom = `<${element.type}`;
if (element.props) {
for (const key of Object.keys(element.props)) {
if (key !== "children" && element.props[key] !== void 0) {
dom += ` ${key}="${escapeXMLString(`${element.props[key]}`)}"`;
}
}
}
if (element.props.children) {
const children = await Promise.all((await Promise.all(element.props.children.flat())).flat().filter((child) => !!child).map((child) => renderElementToString(child)));
if (children.length > 0) {
dom += `>${children.join("")}</${element.type}>`;
return dom;
}
}
return `${dom}/>`;
}
__name(renderElementToString, "renderElementToString");
async function renderToString(root) {
const dom = await renderElementToString(await root);
return `<?xml version="1.0" encoding="utf-8"?>${dom}`;
}
__name(renderToString, "renderToString");
function Fragment(props) {
return props.children;
}
__name(Fragment, "Fragment");
// dist/src/parser/classes/PlayerStoryboardSpec.js
var PlayerStoryboardSpec = class extends YTNode {
constructor(data2) {
super();
const parts = data2.spec.split("|");
const url = new URL(parts.shift());
this.boards = parts.map((part, i) => {
const [thumbnail_width, thumbnail_height, thumbnail_count, columns, rows, interval, name, sigh] = part.split("#");
url.searchParams.set("sigh", sigh);
const storyboard_count = Math.ceil(parseInt(thumbnail_count, 10) / (parseInt(columns, 10) * parseInt(rows, 10)));
return {
type: "vod",
template_url: url.toString().replace("$L", i).replace("$N", name),
thumbnail_width: parseInt(thumbnail_width, 10),
thumbnail_height: parseInt(thumbnail_height, 10),
thumbnail_count: parseInt(thumbnail_count, 10),
interval: parseInt(interval, 10),
columns: parseInt(columns, 10),
rows: parseInt(rows, 10),
storyboard_count
};
});
}
};
__name(PlayerStoryboardSpec, "PlayerStoryboardSpec");
PlayerStoryboardSpec.type = "PlayerStoryboardSpec";
var PlayerStoryboardSpec_default = PlayerStoryboardSpec;
// dist/src/utils/StreamingInfo.js
var TAG_ = "StreamingInfo";
function getFormatGroupings(formats, is_post_live_dvr) {
const group_info = /* @__PURE__ */ new Map();
const has_multiple_audio_tracks = formats.some((fmt) => !!fmt.audio_track);
for (const format of formats) {
if ((!format.index_range || !format.init_range) && !format.is_type_otf && !is_post_live_dvr) {
continue;
}
const mime_type = format.mime_type.split(";")[0];
const just_codec = getStringBetweenStrings(format.mime_type, 'codecs="', '"')?.split(".")[0];
const color_info = format.color_info ? Object.values(format.color_info).join("-") : "";
const audio_track_id = format.audio_track?.id || "";
const drc = format.is_drc ? "drc" : "";
const group_id = `${mime_type}-${just_codec}-${color_info}-${audio_track_id}-${drc}`;
if (!group_info.has(group_id)) {
group_info.set(group_id, []);
}
group_info.get(group_id)?.push(format);
}
return {
groups: Array.from(group_info.values()),
has_multiple_audio_tracks
};
}
__name(getFormatGroupings, "getFormatGroupings");
function hoistCodecsIfPossible(formats, hoisted) {
if (formats.length > 1 && new Set(formats.map((format) => getStringBetweenStrings(format.mime_type, 'codecs="', '"'))).size === 1) {
hoisted.push("codecs");
return getStringBetweenStrings(formats[0].mime_type, 'codecs="', '"');
}
}
__name(hoistCodecsIfPossible, "hoistCodecsIfPossible");
function hoistNumberAttributeIfPossible(formats, property, hoisted) {
if (formats.length > 1 && new Set(formats.map((format) => format.fps)).size === 1) {
hoisted.push(property);
return Number(formats[0][property]);
}
}
__name(hoistNumberAttributeIfPossible, "hoistNumberAttributeIfPossible");
function hoistAudioChannelsIfPossible(formats, hoisted) {
if (formats.length > 1 && new Set(formats.map((format) => format.audio_channels || 2)).size === 1) {
hoisted.push("AudioChannelConfiguration");
return formats[0].audio_channels;
}
}
__name(hoistAudioChannelsIfPossible, "hoistAudioChannelsIfPossible");
async function getOTFSegmentTemplate(url, actions) {
const response = await actions.session.http.fetch_function(`${url}&rn=0&sq=0`, {
method: "GET",
headers: STREAM_HEADERS,
redirect: "follow"
});
const resolved_url = response.url.replace("&rn=0", "").replace("&sq=0", "");
const response_text = await response.text();
const segment_duration_strings = getStringBetweenStrings(response_text, "Segment-Durations-Ms:", "\r\n")?.split(",");
if (!segment_duration_strings) {
throw new InnertubeError("Failed to extract the segment durations from this OTF stream", { url });
}
const segment_durations = [];
for (const segment_duration_string of segment_duration_strings) {
const trimmed_segment_duration = segment_duration_string.trim();
if (trimmed_segment_duration.length === 0) {
continue;
}
let repeat_count;
const repeat_count_string = getStringBetweenStrings(trimmed_segment_duration, "(r=", ")");
if (repeat_count_string) {
repeat_count = parseInt(repeat_count_string);
}
segment_durations.push({
duration: parseInt(trimmed_segment_duration),
repeat_count
});
}
return {
init_url: `${resolved_url}&sq=0`,
media_url: `${resolved_url}&sq=$Number$`,
timeline: segment_durations
};
}
__name(getOTFSegmentTemplate, "getOTFSegmentTemplate");
async function getPostLiveDvrInfo(transformed_url, actions) {
const response = await actions.session.http.fetch_function(`${transformed_url}&rn=0&sq=0`, {
method: "HEAD",
headers: STREAM_HEADERS,
redirect: "follow"
});
const duration_ms = parseInt(response.headers.get("X-Head-Time-Millis") || "");
const segment_count = parseInt(response.headers.get("X-Head-Seqnum") || "");
if (isNaN(duration_ms) || isNaN(segment_count)) {
throw new InnertubeError("Failed to extract the duration or segment count for this Post Live DVR video");
}
return {
duration: duration_ms / 1e3,
segment_count
};
}
__name(getPostLiveDvrInfo, "getPostLiveDvrInfo");
async function getPostLiveDvrDuration(shared_post_live_dvr_info, format, url_transformer, actions, player, cpn) {
if (!shared_post_live_dvr_info.item) {
const url = new URL(format.decipher(player));
url.searchParams.set("cpn", cpn || "");
const transformed_url = url_transformer(url).toString();
shared_post_live_dvr_info.item = await getPostLiveDvrInfo(transformed_url, actions);
}
return shared_post_live_dvr_info.item.duration;
}
__name(getPostLiveDvrDuration, "getPostLiveDvrDuration");
function getSegmentInfo(format, url_transformer, actions, player, cpn, shared_post_live_dvr_info) {
const url = new URL(format.decipher(player));
url.searchParams.set("cpn", cpn || "");
const transformed_url = url_transformer(url).toString();
if (format.is_type_otf) {
if (!actions)
throw new InnertubeError("Unable to get segment durations for this OTF stream without an Actions instance", { format });
const info3 = {
is_oft: true,
is_post_live_dvr: false,
getSegmentTemplate() {
return getOTFSegmentTemplate(transformed_url, actions);
}
};
return info3;
}
if (shared_post_live_dvr_info) {
if (!actions) {
throw new InnertubeError("Unable to get segment count for this Post Live DVR video without an Actions instance", { format });
}
const target_duration_dec = format.target_duration_dec;
if (typeof target_duration_dec !== "number") {
throw new InnertubeError("Format is missing target_duration_dec", { format });
}
const info3 = {
is_oft: false,
is_post_live_dvr: true,
async getSegmentTemplate() {
if (!shared_post_live_dvr_info.item) {
shared_post_live_dvr_info.item = await getPostLiveDvrInfo(transformed_url, actions);
}
return {
media_url: `${transformed_url}&sq=$Number$`,
timeline: [
{
duration: target_duration_dec * 1e3,
repeat_count: shared_post_live_dvr_info.item.segment_count
}
]
};
}
};
return info3;
}
if (!format.index_range || !format.init_range)
throw new InnertubeError("Index and init ranges not available", { format });
const info2 = {
is_oft: false,
is_post_live_dvr: false,
base_url: transformed_url,
index_range: format.index_range,
init_range: format.init_range
};
return info2;
}
__name(getSegmentInfo, "getSegmentInfo");
function getAudioRepresentation(format, hoisted, url_transformer, actions, player, cpn, shared_post_live_dvr_info) {
const url = new URL(format.decipher(player));
url.searchParams.set("cpn", cpn || "");
const uid_parts = [format.itag.toString()];
if (format.audio_track) {
uid_parts.push(format.audio_track.id);
}
if (format.is_drc) {
uid_parts.push("drc");
}
const rep = {
uid: uid_parts.join("-"),
bitrate: format.bitrate,
codecs: !hoisted.includes("codecs") ? getStringBetweenStrings(format.mime_type, 'codecs="', '"') : void 0,
audio_sample_rate: !hoisted.includes("audio_sample_rate") ? format.audio_sample_rate : void 0,
channels: !hoisted.includes("AudioChannelConfiguration") ? format.audio_channels || 2 : void 0,
segment_info: getSegmentInfo(format, url_transformer, actions, player, cpn, shared_post_live_dvr_info)
};
return rep;
}
__name(getAudioRepresentation, "getAudioRepresentation");
function getTrackRoles(format, has_drc_streams) {
if (!format.audio_track && !has_drc_streams) {
return;
}
const roles = [
format.is_original ? "main" : "alternate"
];
if (format.is_dubbed || format.is_auto_dubbed)
roles.push("dub");
if (format.is_descriptive)
roles.push("description");
if (format.is_drc)
roles.push("enhanced-audio-intelligibility");
return roles;
}
__name(getTrackRoles, "getTrackRoles");
function getAudioSet(formats, url_transformer, actions, player, cpn, shared_post_live_dvr_info, drc_labels) {
const first_format = formats[0];
const { audio_track } = first_format;
const hoisted = [];
const has_drc_streams = !!drc_labels;
let track_name;
if (audio_track) {
if (has_drc_streams && first_format.is_drc) {
track_name = drc_labels.label_drc_multiple(audio_track.display_name);
} else {
track_name = audio_track.display_name;
}
} else if (has_drc_streams) {
track_name = first_format.is_drc ? drc_labels.label_drc : drc_labels.label_original;
}
const set = {
mime_type: first_format.mime_type.split(";")[0],
language: first_format.language ?? void 0,
codecs: hoistCodecsIfPossible(formats, hoisted),
audio_sample_rate: hoistNumberAttributeIfPossible(formats, "audio_sample_rate", hoisted),
track_name,
track_roles: getTrackRoles(first_format, has_drc_streams),
channels: hoistAudioChannelsIfPossible(formats, hoisted),
representations: formats.map((format) => getAudioRepresentation(format, hoisted, url_transformer, actions, player, cpn, shared_post_live_dvr_info))
};
return set;
}
__name(getAudioSet, "getAudioSet");
var COLOR_PRIMARIES = {
BT709: "1",
BT2020: "9"
};
var COLOR_TRANSFER_CHARACTERISTICS = {
BT709: "1",
BT2020_10: "14",
SMPTEST2084: "16",
ARIB_STD_B67: "18"
};
var COLOR_MATRIX_COEFFICIENTS = {
BT709: "1",
BT2020_NCL: "14"
};
function getColorInfo(format) {
const color_info = format.color_info;
let primaries;
let transfer_characteristics;
let matrix_coefficients;
if (color_info) {
if (color_info.primaries) {
primaries = COLOR_PRIMARIES[color_info.primaries];
}
if (color_info.transfer_characteristics) {
transfer_characteristics = COLOR_TRANSFER_CHARACTERISTICS[color_info.transfer_characteristics];
}
if (color_info.matrix_coefficients) {
matrix_coefficients = COLOR_MATRIX_COEFFICIENTS[color_info.matrix_coefficients];
if (!matrix_coefficients) {
const url = new URL(format.url);
const anonymisedFormat = JSON.parse(JSON.stringify(format));
anonymisedFormat.url = "REDACTED";
anonymisedFormat.signature_cipher = "REDACTED";
anonymisedFormat.cipher = "REDACTED";
warn(TAG_, `Unknown matrix coefficients "${color_info.matrix_coefficients}". The DASH manifest is still usable without this.
Please report it at ${Platform.shim.info.bugs_url} so we can add support for it.
InnerTube client: ${url.searchParams.get("c")}
format:`, anonymisedFormat);
}
}
} else if (getStringBetweenStrings(format.mime_type, 'codecs="', '"')?.startsWith("avc1")) {
transfer_characteristics = COLOR_TRANSFER_CHARACTERISTICS.BT709;
}
const info2 = {
primaries,
transfer_characteristics,
matrix_coefficients
};
return info2;
}
__name(getColorInfo, "getColorInfo");
function getVideoRepresentation(format, url_transformer, hoisted, player, actions, cpn, shared_post_live_dvr_info) {
const rep = {
uid: format.itag.toString(),
bitrate: format.bitrate,
width: format.width,
height: format.height,
codecs: !hoisted.includes("codecs") ? getStringBetweenStrings(format.mime_type, 'codecs="', '"') : void 0,
fps: !hoisted.includes("fps") ? format.fps : void 0,
segment_info: getSegmentInfo(format, url_transformer, actions, player, cpn, shared_post_live_dvr_info)
};
return rep;
}
__name(getVideoRepresentation, "getVideoRepresentation");
function getVideoSet(formats, url_transformer, player, actions, cpn, shared_post_live_dvr_info) {
const first_format = formats[0];
const color_info = getColorInfo(first_format);
const hoisted = [];
const set = {
mime_type: first_format.mime_type.split(";")[0],
color_info,
codecs: hoistCodecsIfPossible(formats, hoisted),
fps: hoistNumberAttributeIfPossible(formats, "fps", hoisted),
representations: formats.map((format) => getVideoRepresentation(format, url_transformer, hoisted, player, actions, cpn, shared_post_live_dvr_info))
};
return set;
}
__name(getVideoSet, "getVideoSet");
function getStoryboardInfo(storyboards) {
const mime_info = /* @__PURE__ */ new Map();
const boards = storyboards.is(PlayerStoryboardSpec_default) ? storyboards.boards : [storyboards.board];
for (const storyboard of boards) {
const extension = new URL(storyboard.template_url).pathname.split(".").pop();
const mime_type = `image/${extension === "jpg" ? "jpeg" : extension}`;
if (!mime_info.has(mime_type)) {
mime_info.set(mime_type, []);
}
mime_info.get(mime_type)?.push(storyboard);
}
return mime_info;
}
__name(getStoryboardInfo, "getStoryboardInfo");
async function getStoryboardMimeType(actions, board, transform_url, probable_mime_type, shared_response) {
const url = board.template_url;
const req_url = transform_url(new URL(url.replace("$M", "0")));
const res_promise = shared_response.response ? shared_response.response : actions.session.http.fetch_function(req_url, {
method: "HEAD",
headers: STREAM_HEADERS
});
shared_response.response = res_promise;
const res = await res_promise;
return res.headers.get("Content-Type") || probable_mime_type;
}
__name(getStoryboardMimeType, "getStoryboardMimeType");
async function getStoryboardBitrate(actions, board, shared_response) {
const url = board.template_url;
const response_promises = [];
const request_limit = Math.min(board.type === "vod" ? board.storyboard_count : 5, 10);
for (let i = 0; i < request_limit; i++) {
const req_url = new URL(url.replace("$M", i.toString()));
const response_promise = i === 0 && shared_response.response ? shared_response.response : actions.session.http.fetch_function(req_url, {
method: "HEAD",
headers: STREAM_HEADERS
});
if (i === 0)
shared_response.response = response_promise;
response_promises.push(response_promise);
}
const responses = await Promise.all(response_promises);
const content_lengths = [];
for (const response of responses) {
content_lengths.push(parseInt(response.headers.get("Content-Length") || "0"));
}
return Math.ceil(Math.max(...content_lengths) / (board.rows * board.columns) * 8);
}
__name(getStoryboardBitrate, "getStoryboardBitrate");
function getImageRepresentation(duration, actions, board, transform_url, shared_response) {
const url = board.template_url;
const template_url = new URL(url.replace("$M", "$Number$"));
let template_duration;
if (board.type === "vod") {
template_duration = duration / board.storyboard_count;
} else {
template_duration = duration * board.columns * board.rows;
}
const rep = {
uid: `thumbnails_${board.thumbnail_width}x${board.thumbnail_height}`,
getBitrate() {
return getStoryboardBitrate(actions, board, shared_response);
},
sheet_width: board.thumbnail_width * board.columns,
sheet_height: board.thumbnail_height * board.rows,
thumbnail_height: board.thumbnail_height,
thumbnail_width: board.thumbnail_width,
rows: board.rows,
columns: board.columns,
template_duration: Math.round(template_duration),
template_url: transform_url(template_url).toString(),
getURL(n) {
return template_url.toString().replace("$Number$", n.toString());
}
};
return rep;
}
__name(getImageRepresentation, "getImageRepresentation");
function getImageSets(duration, actions, storyboards, transform_url) {
const mime_info = getStoryboardInfo(storyboards);
const shared_response = {};
return Array.from(mime_info.entries()).map(([type, boards]) => ({
probable_mime_type: type,
getMimeType() {
return getStoryboardMimeType(actions, boards[0], transform_url, type, shared_response);
},
representations: boards.map((board) => getImageRepresentation(duration, actions, board, transform_url, shared_response))
}));
}
__name(getImageSets, "getImageSets");
function getTextSets(caption_tracks, format, transform_url) {
const mime_type = format === "vtt" ? "text/vtt" : "application/ttml+xml";
return caption_tracks.map((caption_track) => {
const url = new URL(caption_track.base_url);
url.searchParams.set("fmt", format);
const track_roles = ["caption"];
if (url.searchParams.has("tlang")) {
track_roles.push("dub");
}
return {
mime_type,
language: caption_track.language_code,
track_name: caption_track.name.toString(),
track_roles,
representation: {
uid: `text-${caption_track.vss_id}`,
base_url: transform_url(url).toString()
}
};
});
}
__name(getTextSets, "getTextSets");
function getStreamingInfo(streaming_data, is_post_live_dvr = false, url_transformer = (url) => url, format_filter, cpn, player, actions, storyboards, caption_tracks, options) {
if (!streaming_data)
throw new InnertubeError("Streaming data not available");
const formats = format_filter ? streaming_data.adaptive_formats.filter((fmt) => !format_filter(fmt)) : streaming_data.adaptive_formats;
let getDuration;
let shared_post_live_dvr_info;
if (is_post_live_dvr) {
shared_post_live_dvr_info = {};
if (!actions) {
throw new InnertubeError("Unable to get duration or segment count for this Post Live DVR video without an Actions instance");
}
getDuration = /* @__PURE__ */ __name(() => {
if (!shared_post_live_dvr_info) {
return Promise.resolve(0);
}
return getPostLiveDvrDuration(shared_post_live_dvr_info, formats[0], url_transformer, actions, player, cpn);
}, "getDuration");
} else {
const duration = formats[0].approx_duration_ms / 1e3;
getDuration = /* @__PURE__ */ __name(() => Promise.resolve(duration), "getDuration");
}
const { groups, has_multiple_audio_tracks } = getFormatGroupings(formats, is_post_live_dvr);
const { video_groups, audio_groups } = groups.reduce((acc, formats2) => {
if (formats2[0].has_audio) {
if (has_multiple_audio_tracks && !formats2[0].audio_track)
return acc;
acc.audio_groups.push(formats2);
return acc;
}
acc.video_groups.push(formats2);
return acc;
}, {
video_groups: [],
audio_groups: []
});
let drc_labels;
if (audio_groups.flat().some((format) => format.is_drc)) {
drc_labels = {
label_original: options?.label_original || "Original",
label_drc: options?.label_drc || "Stable Volume",
label_drc_multiple: options?.label_drc_multiple || ((display_name) => `${display_name} (Stable Volume)`)
};
}
const audio_sets = audio_groups.map((formats2) => getAudioSet(formats2, url_transformer, actions, player, cpn, shared_post_live_dvr_info, drc_labels));
const video_sets = video_groups.map((formats2) => getVideoSet(formats2, url_transformer, player, actions, cpn, shared_post_live_dvr_info));
let image_sets = [];
if (storyboards && actions) {
let duration;
if (storyboards.is(PlayerStoryboardSpec_default)) {
duration = formats[0].approx_duration_ms / 1e3;
} else {
const target_duration_dec = formats[0].target_duration_dec;
if (target_duration_dec === void 0)
throw new InnertubeError("Format is missing target_duration_dec", { format: formats[0] });
duration = target_duration_dec;
}
image_sets = getImageSets(duration, actions, storyboards, url_transformer);
}
let text_sets = [];
if (caption_tracks && options?.captions_format) {
if (options.captions_format !== "vtt" && options.captions_format !== "ttml") {
throw new InnertubeError("Invalid captions format", options.captions_format);
}
text_sets = getTextSets(caption_tracks, options.captions_format, url_transformer);
}
const info2 = {
getDuration,
audio_sets,
video_sets,
image_sets,
text_sets
};
return info2;
}
__name(getStreamingInfo, "getStreamingInfo");
// dist/src/utils/DashManifest.js
async function OTFPostLiveDvrSegmentInfo({ info: info2 }) {
if (!info2.is_oft && !info2.is_post_live_dvr)
return null;
const template = await info2.getSegmentTemplate();
return createElement(
"segmentTemplate",
{ startNumber: template.init_url ? "1" : "0", timescale: "1000", initialization: template.init_url, media: template.media_url },
createElement("segmentTimeline", null, template.timeline.map((segment_duration) => createElement("s", { d: segment_duration.duration, r: segment_duration.repeat_count })))
);
}
__name(OTFPostLiveDvrSegmentInfo, "OTFPostLiveDvrSegmentInfo");
function SegmentInfo({ info: info2 }) {
if (info2.is_oft || info2.is_post_live_dvr) {
return createElement(OTFPostLiveDvrSegmentInfo, { info: info2 });
}
return createElement(
Fragment,
null,
createElement("baseURL", null, info2.base_url),
createElement(
"segmentBase",
{ indexRange: `${info2.index_range.start}-${info2.index_range.end}` },
createElement("initialization", { range: `${info2.init_range.start}-${info2.init_range.end}` })
)
);
}
__name(SegmentInfo, "SegmentInfo");
async function DashManifest({ streamingData, isPostLiveDvr, transformURL, rejectFormat, cpn, player, actions, storyboards, captionTracks, options }) {
const { getDuration, audio_sets, video_sets, image_sets, text_sets } = getStreamingInfo(streamingData, isPostLiveDvr, transformURL, rejectFormat, cpn, player, actions, storyboards, captionTracks, options);
return createElement(
"mPD",
{ xmlns: "urn:mpeg:dash:schema:mpd:2011", minBufferTime: "PT1.500S", profiles: "urn:mpeg:dash:profile:isoff-main:2011", type: "static", mediaPresentationDuration: `PT${await getDuration()}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" },
createElement(
"period",
null,
audio_sets.map((set, index) => createElement(
"adaptationSet",
{ id: index, mimeType: set.mime_type, startWithSAP: "1", subsegmentAlignment: "true", lang: set.language, codecs: set.codecs, audioSamplingRate: set.audio_sample_rate, contentType: "audio" },
set.track_roles && set.track_roles.map((role) => createElement("role", { schemeIdUri: "urn:mpeg:dash:role:2011", value: role })),
set.track_name && createElement("label", { id: index }, set.track_name),
set.channels && createElement("audioChannelConfiguration", { schemeIdUri: "urn:mpeg:dash:23003:3:audio_channel_configuration:2011", value: set.channels }),
set.representations.map((rep) => createElement(
"representation",
{ id: rep.uid, bandwidth: rep.bitrate, codecs: rep.codecs, audioSamplingRate: rep.audio_sample_rate },
rep.channels && createElement("audioChannelConfiguration", { schemeIdUri: "urn:mpeg:dash:23003:3:audio_channel_configuration:2011", value: rep.channels }),
createElement(SegmentInfo, { info: rep.segment_info })
))
)),
video_sets.map((set, index) => createElement(
"adaptationSet",
{ id: index + audio_sets.length, mimeType: set.mime_type, startWithSAP: "1", subsegmentAlignment: "true", codecs: set.codecs, maxPlayoutRate: "1", frameRate: set.fps, contentType: "video" },
set.color_info.primaries && createElement("supplementalProperty", { schemeIdUri: "urn:mpeg:mpegB:cicp:ColourPrimaries", value: set.color_info.primaries }),
set.color_info.transfer_characteristics && createElement("supplementalProperty", { schemeIdUri: "urn:mpeg:mpegB:cicp:TransferCharacteristics", value: set.color_info.transfer_characteristics }),
set.color_info.matrix_coefficients && createElement("supplementalProperty", { schemeIdUri: "urn:mpeg:mpegB:cicp:MatrixCoefficients", value: set.color_info.matrix_coefficients }),
set.representations.map((rep) => createElement(
"representation",
{ id: rep.uid, bandwidth: rep.bitrate, width: rep.width, height: rep.height, codecs: rep.codecs, frameRate: rep.fps },
createElement(SegmentInfo, { info: rep.segment_info })
))
)),
image_sets.map(async (set, index) => {
return createElement("adaptationSet", { id: index + audio_sets.length + video_sets.length, mimeType: await set.getMimeType(), contentType: "image" }, set.representations.map(async (rep) => createElement(
"representation",
{ id: `thumbnails_${rep.thumbnail_width}x${rep.thumbnail_height}`, bandwidth: await rep.getBitrate(), width: rep.sheet_width, height: rep.sheet_height },
createElement("essentialProperty", { schemeIdUri: "http://dashif.org/thumbnail_tile", value: `${rep.columns}x${rep.rows}` }),
createElement("segmentTemplate", { media: rep.template_url, duration: rep.template_duration, startNumber: "0" })
)));
}),
text_sets.map((set, index) => {
return createElement(
"adaptationSet",
{ id: index + audio_sets.length + video_sets.length + image_sets.length, mimeType: set.mime_type, lang: set.language, contentType: "text" },
set.track_roles.map((role) => createElement("role", { schemeIdUri: "urn:mpeg:dash:role:2011", value: role })),
createElement("label", { id: index + audio_sets.length }, set.track_name),
createElement(
"representation",
{ id: set.representation.uid, bandwidth: "0" },
createElement("baseURL", null, set.representation.base_url)
)
);
})
)
);
}
__name(DashManifest, "DashManifest");
function toDash(streaming_data, is_post_live_dvr = false, url_transformer = (url) => url, format_filter, cpn, player, actions, storyboards, caption_tracks, options) {
if (!streaming_data)
throw new InnertubeError("Streaming data not available");
return renderToString(createElement(DashManifest, { streamingData: streaming_data, isPostLiveDvr: is_post_live_dvr, transformURL: url_transformer, options, rejectFormat: format_filter, cpn, player, actions, storyboards, captionTracks: caption_tracks }));
}
__name(toDash, "toDash");
// dist/src/utils/FormatUtils.js
async function download(options, actions, playability_status, streaming_data, player, cpn) {
if (playability_status?.status === "UNPLAYABLE")
throw new InnertubeError("Video is unplayable", { error_type: "UNPLAYABLE" });
if (playability_status?.status === "LOGIN_REQUIRED")
throw new InnertubeError("Video is login required", { error_type: "LOGIN_REQUIRED" });
if (!streaming_data)
throw new InnertubeError("Streaming data not available.", { error_type: "NO_STREAMING_DATA" });
const opts = {
quality: "360p",
type: "video+audio",
format: "mp4",
range: void 0,
...options
};
const format = chooseFormat(opts, streaming_data);
const format_url = format.decipher(player);
if (opts.type === "video+audio" && !options.range) {
const response = await actions.session.http.fetch_function(`${format_url}&cpn=${cpn}`, {
method: "GET",
headers: STREAM_HEADERS,
redirect: "follow"
});
if (!response.ok)
throw new InnertubeError("The server responded with a non 2xx status code", { error_type: "FETCH_FAILED", response });
const body = response.body;
if (!body)
throw new InnertubeError("Could not get ReadableStream from fetch Response.", { error_type: "FETCH_FAILED", response });
return body;
}
const chunk_size = 1048576 * 10;
let chunk_start = options.range ? options.range.start : 0;
let chunk_end = options.range ? options.range.end : chunk_size;
let must_end = false;
let cancel;
return new Platform.shim.ReadableStream({
start() {
},
pull: async (controller) => {
if (must_end) {
controller.close();
return;
}
if (chunk_end >= (format.content_length ? format.content_length : 0) || options.range) {
must_end = true;
}
return new Promise(async (resolve, reject) => {
try {
cancel = new AbortController();
const response = await actions.session.http.fetch_function(`${format_url}&cpn=${cpn}&range=${chunk_start}-${chunk_end || ""}`, {
method: "GET",
headers: {
...STREAM_HEADERS
},
signal: cancel.signal
});
if (!response.ok)
throw new InnertubeError("The server responded with a non 2xx status code", {
error_type: "FETCH_FAILED",
response
});
const body = response.body;
if (!body)
throw new InnertubeError("Could not get ReadableStream from fetch Response.", {
error_type: "FETCH_FAILED",
response
});
for await (const chunk of streamToIterable(body)) {
controller.enqueue(chunk);
}
chunk_start = chunk_end + 1;
chunk_end += chunk_size;
resolve();
} catch (e) {
reject(e);
}
});
},
async cancel(reason) {
cancel.abort(reason);
}
}, {
highWaterMark: 1,
size(chunk) {
return chunk.byteLength;
}
});
}
__name(download, "download");
function chooseFormat(options, streaming_data) {
if (!streaming_data)
throw new InnertubeError("Streaming data not available");
const formats = [
...streaming_data.formats || [],
...streaming_data.adaptive_formats || []
];
if (options.itag) {
const candidates2 = formats.filter((format) => format.itag === options.itag);
if (!candidates2.length)
throw new InnertubeError("No matching formats found", { options });
return candidates2[0];
}
const requires_audio = options.type ? options.type.includes("audio") : true;
const requires_video = options.type ? options.type.includes("video") : true;
const language = options.language || "original";
const quality = options.quality || "best";
let best_width = -1;
const is_best = ["best", "bestefficiency"].includes(quality);
const use_most_efficient = quality !== "best";
let candidates = formats.filter((format) => {
if (requires_audio && !format.has_audio)
return false;
if (requires_video && !format.has_video)
return false;
if (options.codec && !format.mime_type.includes(options.codec))
return false;
if (options.format !== "any" && !format.mime_type.includes(options.format || "mp4"))
return false;
if (!is_best && format.quality_label !== quality)
return false;
if (format.width && best_width < format.width)
best_width = format.width;
return true;
});
if (!candidates.length)
throw new InnertubeError("No matching formats found", { options });
if (is_best && requires_video)
candidates = candidates.filter((format) => format.width === best_width);
if (requires_audio && !requires_video) {
const audio_only = candidates.filter((format) => {
if (language !== "original") {
return !format.has_video && !format.has_text && format.language === language;
}
return !format.has_video && !format.has_text && format.is_original;
});
if (audio_only.length > 0) {
candidates = audio_only;
}
}
if (use_most_efficient) {
candidates.sort((a, b) => a.bitrate - b.bitrate);
} else {
candidates.sort((a, b) => b.bitrate - a.bitrate);
}
return candidates[0];
}
__name(chooseFormat, "chooseFormat");
// dist/src/utils/HTTPClient.js
var _HTTPClient_instances;
var _HTTPClient_session;
var _HTTPClient_cookie;
var _HTTPClient_fetch;
var _HTTPClient_adjustContext;
var HTTPClient = class {
constructor(session, cookie, fetch2) {
_HTTPClient_instances.add(this);
_HTTPClient_session.set(this, void 0);
_HTTPClient_cookie.set(this, void 0);
_HTTPClient_fetch.set(this, void 0);
__classPrivateFieldSet(this, _HTTPClient_session, session, "f");
__classPrivateFieldSet(this, _HTTPClient_cookie, cookie, "f");
__classPrivateFieldSet(this, _HTTPClient_fetch, fetch2 || Platform.shim.fetch, "f");
}
get fetch_function() {
return __classPrivateFieldGet(this, _HTTPClient_fetch, "f");
}
async fetch(input, init) {
const innertube_url = URLS.API.PRODUCTION_1 + __classPrivateFieldGet(this, _HTTPClient_session, "f").api_version;
const baseURL = init?.baseURL || innertube_url;
const request_url = typeof input === "string" ? !baseURL.endsWith("/") && !input.startsWith("/") ? new URL(`${baseURL}/${input}`) : new URL(baseURL + input) : input instanceof URL ? input : new URL(input.url, baseURL);
const headers = init?.headers || (input instanceof Platform.shim.Request ? input.headers : new Platform.shim.Headers()) || new Platform.shim.Headers();
const body = init?.body || (input instanceof Platform.shim.Request ? input.body : void 0);
const request_headers = new Platform.shim.Headers(headers);
request_headers.set("Accept", "*/*");
request_headers.set("Accept-Language", "*");
request_headers.set("X-Goog-Visitor-Id", __classPrivateFieldGet(this, _HTTPClient_session, "f").context.client.visitorData || "");
request_headers.set("X-Youtube-Client-Version", __classPrivateFieldGet(this, _HTTPClient_session, "f").context.client.clientVersion || "");
const client_name_id = CLIENT_NAME_IDS[__classPrivateFieldGet(this, _HTTPClient_session, "f").context.client.clientName];
if (client_name_id) {
request_headers.set("X-Youtube-Client-Name", client_name_id);
}
if (Platform.shim.server) {
request_headers.set("User-Agent", __classPrivateFieldGet(this, _HTTPClient_session, "f").user_agent || "");
request_headers.set("Origin", request_url.origin);
}
request_url.searchParams.set("prettyPrint", "false");
request_url.searchParams.set("alt", "json");
const content_type = request_headers.get("Content-Type");
let request_body = body;
let is_web_kids = false;
const is_innertube_req = baseURL === innertube_url || baseURL === URLS.YT_UPLOAD;
if (content_type === "application/json" && is_innertube_req && typeof body === "string") {
const json = JSON.parse(body);
const n_body = {
...json,
context: JSON.parse(JSON.stringify(__classPrivateFieldGet(this, _HTTPClient_session, "f").context))
};
__classPrivateFieldGet(this, _HTTPClient_instances, "m", _HTTPClient_adjustContext).call(this, n_body.context, n_body.client);
request_headers.set("X-Youtube-Client-Version", n_body.context.client.clientVersion);
const client_name_id2 = CLIENT_NAME_IDS[n_body.context.client.clientName];
if (client_name_id2) {
request_headers.set("X-Youtube-Client-Name", client_name_id2);
}
delete n_body.client;
if (n_body.context.client.clientName === "ANDROID" || n_body.context.client.clientName === "ANDROID_MUSIC") {
request_headers.set("User-Agent", CLIENTS.ANDROID.USER_AGENT);
request_headers.set("X-GOOG-API-FORMAT-VERSION", "2");
} else if (n_body.context.client.clientName === "iOS") {
request_headers.set("User-Agent", CLIENTS.IOS.USER_AGENT);
}
is_web_kids = n_body.context.client.clientName === "WEB_KIDS";
request_body = JSON.stringify(n_body);
} else if (content_type === "application/x-protobuf") {
if (Platform.shim.server) {
request_headers.set("User-Agent", CLIENTS.ANDROID.USER_AGENT);
request_headers.set("X-GOOG-API-FORMAT-VERSION", "2");
request_headers.delete("X-Youtube-Client-Version");
}
}
if (__classPrivateFieldGet(this, _HTTPClient_session, "f").logged_in && is_innertube_req && !is_web_kids) {
const oauth = __classPrivateFieldGet(this, _HTTPClient_session, "f").oauth;
if (oauth.oauth2_tokens) {
if (oauth.shouldRefreshToken()) {
await oauth.refreshAccessToken();
}
request_headers.set("Authorization", `Bearer ${oauth.oauth2_tokens.access_token}`);
}
if (__classPrivateFieldGet(this, _HTTPClient_cookie, "f")) {
const sapisid = getCookie(__classPrivateFieldGet(this, _HTTPClient_cookie, "f"), "SAPISID");
if (sapisid) {
request_headers.set("Authorization", await generateSidAuth(sapisid));
request_headers.set("X-Goog-Authuser", __classPrivateFieldGet(this, _HTTPClient_session, "f").account_index.toString());
if (__classPrivateFieldGet(this, _HTTPClient_session, "f").context.user.onBehalfOfUser)
request_headers.set("X-Goog-PageId", __classPrivateFieldGet(this, _HTTPClient_session, "f").context.user.onBehalfOfUser);
}
request_headers.set("Cookie", __classPrivateFieldGet(this, _HTTPClient_cookie, "f"));
}
}
const request = new Platform.shim.Request(request_url, input instanceof Platform.shim.Request ? input : init);
const response = await __classPrivateFieldGet(this, _HTTPClient_fetch, "f").call(this, request, {
body: request_body,
headers: request_headers,
redirect: input instanceof Platform.shim.Request ? input.redirect : init?.redirect || "follow",
...Platform.shim.runtime !== "cf-worker" ? { credentials: "include" } : {}
});
if (response.ok) {
return response;
}
throw new InnertubeError(`Request to ${response.url} failed with status ${response.status}`, await response.text());
}
};
__name(HTTPClient, "HTTPClient");
_HTTPClient_session = /* @__PURE__ */ new WeakMap(), _HTTPClient_cookie = /* @__PURE__ */ new WeakMap(), _HTTPClient_fetch = /* @__PURE__ */ new WeakMap(), _HTTPClient_instances = /* @__PURE__ */ new WeakSet(), _HTTPClient_adjustContext = /* @__PURE__ */ __name(function _HTTPClient_adjustContext2(ctx, client) {
if (!client)
return;
if (!SUPPORTED_CLIENTS.includes(client.toUpperCase()))
throw new InnertubeError(`Invalid client: ${client}`, {
available_innertube_clients: SUPPORTED_CLIENTS
});
if (client === "ANDROID" || client === "YTMUSIC_ANDROID" || client === "YTMUSIC_ANDROID" || client === "YTSTUDIO_ANDROID") {
ctx.client.androidSdkVersion = CLIENTS.ANDROID.SDK_VERSION;
ctx.client.userAgent = CLIENTS.ANDROID.USER_AGENT;
ctx.client.osName = "Android";
ctx.client.osVersion = "13";
ctx.client.platform = "MOBILE";
}
switch (client.toUpperCase()) {
case "MWEB":
ctx.client.clientVersion = CLIENTS.MWEB.VERSION;
ctx.client.clientName = CLIENTS.MWEB.NAME;
ctx.client.clientFormFactor = "SMALL_FORM_FACTOR";
ctx.client.platform = "MOBILE";
break;
case "IOS":
ctx.client.deviceMake = "Apple";
ctx.client.deviceModel = CLIENTS.IOS.DEVICE_MODEL;
ctx.client.clientVersion = CLIENTS.IOS.VERSION;
ctx.client.clientName = CLIENTS.IOS.NAME;
ctx.client.platform = "MOBILE";
ctx.client.osName = "iOS";
delete ctx.client.browserName;
delete ctx.client.browserVersion;
break;
case "YTMUSIC":
ctx.client.clientVersion = CLIENTS.YTMUSIC.VERSION;
ctx.client.clientName = CLIENTS.YTMUSIC.NAME;
break;
case "ANDROID":
ctx.client.clientVersion = CLIENTS.ANDROID.VERSION;
ctx.client.clientFormFactor = "SMALL_FORM_FACTOR";
ctx.client.clientName = CLIENTS.ANDROID.NAME;
break;
case "YTMUSIC_ANDROID":
ctx.client.clientVersion = CLIENTS.YTMUSIC_ANDROID.VERSION;
ctx.client.clientFormFactor = "SMALL_FORM_FACTOR";
ctx.client.clientName = CLIENTS.YTMUSIC_ANDROID.NAME;
break;
case "YTSTUDIO_ANDROID":
ctx.client.clientVersion = CLIENTS.YTSTUDIO_ANDROID.VERSION;
ctx.client.clientFormFactor = "SMALL_FORM_FACTOR";
ctx.client.clientName = CLIENTS.YTSTUDIO_ANDROID.NAME;
break;
case "TV": {
ctx.client.clientVersion = CLIENTS.TV.VERSION;
ctx.client.clientName = CLIENTS.TV.NAME;
ctx.client.userAgent = CLIENTS.TV.USER_AGENT;
break;
}
case "TV_EMBEDDED":
ctx.client.clientName = CLIENTS.TV_EMBEDDED.NAME;
ctx.client.clientVersion = CLIENTS.TV_EMBEDDED.VERSION;
ctx.client.clientScreen = "EMBED";
ctx.thirdParty = { embedUrl: URLS.YT_BASE };
break;
case "YTKIDS":
ctx.client.clientVersion = CLIENTS.WEB_KIDS.VERSION;
ctx.client.clientName = CLIENTS.WEB_KIDS.NAME;
ctx.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":
ctx.client.clientName = CLIENTS.WEB_EMBEDDED.NAME;
ctx.client.clientVersion = CLIENTS.WEB_EMBEDDED.VERSION;
ctx.client.clientScreen = "EMBED";
ctx.thirdParty = { embedUrl: URLS.GOOGLE_SEARCH_BASE };
break;
case "WEB_CREATOR":
ctx.client.clientName = CLIENTS.WEB_CREATOR.NAME;
ctx.client.clientVersion = CLIENTS.WEB_CREATOR.VERSION;
break;
default:
break;
}
}, "_HTTPClient_adjustContext");
var HTTPClient_default = HTTPClient;
// dist/src/utils/LZW.js
var LZW_exports = {};
__export(LZW_exports, {
compress: () => compress,
decompress: () => decompress
});
function compress(input) {
const output = [];
const dictionary = {};
for (let i = 0; i < 256; i++) {
dictionary[String.fromCharCode(i)] = i;
}
let current_string = "";
let dictionary_size = 256;
for (let i = 0; i < input.length; i++) {
const current_char = input[i];
const combined_string = current_string + current_char;
if (dictionary.hasOwnProperty(combined_string)) {
current_string = combined_string;
} else {
output.push(dictionary[current_string]);
dictionary[combined_string] = dictionary_size++;
current_string = current_char;
}
}
if (current_string !== "") {
output.push(dictionary[current_string]);
}
return output.map((code) => String.fromCharCode(code)).join("");
}
__name(compress, "compress");
function decompress(input) {
const dictionary = {};
const input_data = input.split("");
const output = [input_data.shift()];
const input_length = input_data.length >>> 0;
let dictionary_code = 256;
let current_char = output[0];
let current_string = current_char;
for (let i = 0; i < input_length; ++i) {
const current_code = input_data[i].charCodeAt(0);
const entry = current_code < 256 ? input_data[i] : dictionary[current_code] ? dictionary[current_code] : current_string + current_char;
output.push(entry);
current_char = entry.charAt(0);
dictionary[dictionary_code++] = current_string + current_char;
current_string = entry;
}
return output.join("");
}
__name(decompress, "decompress");
// dist/src/utils/ProtoUtils.js
var ProtoUtils_exports = {};
__export(ProtoUtils_exports, {
decodeVisitorData: () => decodeVisitorData,
encodeCommentActionParams: () => encodeCommentActionParams,
encodeNextParams: () => encodeNextParams,
encodeVisitorData: () => encodeVisitorData
});
// node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js
function varint64read() {
let lowBits = 0;
let highBits = 0;
for (let shift = 0; shift < 28; shift += 7) {
let b = this.buf[this.pos++];
lowBits |= (b & 127) << shift;
if ((b & 128) == 0) {
this.assertBounds();
return [lowBits, highBits];
}
}
let middleByte = this.buf[this.pos++];
lowBits |= (middleByte & 15) << 28;
highBits = (middleByte & 112) >> 4;
if ((middleByte & 128) == 0) {
this.assertBounds();
return [lowBits, highBits];
}
for (let shift = 3; shift <= 31; shift += 7) {
let b = this.buf[this.pos++];
highBits |= (b & 127) << shift;
if ((b & 128) == 0) {
this.assertBounds();
return [lowBits, highBits];
}
}
throw new Error("invalid varint");
}
__name(varint64read, "varint64read");
function varint64write(lo, hi, bytes) {
for (let i = 0; i < 28; i = i + 7) {
const shift = lo >>> i;
const hasNext = !(shift >>> 7 == 0 && hi == 0);
const byte = (hasNext ? shift | 128 : shift) & 255;
bytes.push(byte);
if (!hasNext) {
return;
}
}
const splitBits = lo >>> 28 & 15 | (hi & 7) << 4;
const hasMoreBits = !(hi >> 3 == 0);
bytes.push((hasMoreBits ? splitBits | 128 : splitBits) & 255);
if (!hasMoreBits) {
return;
}
for (let i = 3; i < 31; i = i + 7) {
const shift = hi >>> i;
const hasNext = !(shift >>> 7 == 0);
const byte = (hasNext ? shift | 128 : shift) & 255;
bytes.push(byte);
if (!hasNext) {
return;
}
}
bytes.push(hi >>> 31 & 1);
}
__name(varint64write, "varint64write");
var TWO_PWR_32_DBL = 4294967296;
function int64FromString(dec) {
const minus = dec[0] === "-";
if (minus) {
dec = dec.slice(1);
}
const base = 1e6;
let lowBits = 0;
let highBits = 0;
function add1e6digit(begin, end) {
const digit1e6 = Number(dec.slice(begin, end));
highBits *= base;
lowBits = lowBits * base + digit1e6;
if (lowBits >= TWO_PWR_32_DBL) {
highBits = highBits + (lowBits / TWO_PWR_32_DBL | 0);
lowBits = lowBits % TWO_PWR_32_DBL;
}
}
__name(add1e6digit, "add1e6digit");
add1e6digit(-24, -18);
add1e6digit(-18, -12);
add1e6digit(-12, -6);
add1e6digit(-6);
return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits);
}
__name(int64FromString, "int64FromString");
function int64ToString(lo, hi) {
let bits = newBits(lo, hi);
const negative = bits.hi & 2147483648;
if (negative) {
bits = negate(bits.lo, bits.hi);
}
const result = uInt64ToString(bits.lo, bits.hi);
return negative ? "-" + result : result;
}
__name(int64ToString, "int64ToString");
function uInt64ToString(lo, hi) {
({ lo, hi } = toUnsigned(lo, hi));
if (hi <= 2097151) {
return String(TWO_PWR_32_DBL * hi + lo);
}
const low = lo & 16777215;
const mid = (lo >>> 24 | hi << 8) & 16777215;
const high = hi >> 16 & 65535;
let digitA = low + mid * 6777216 + high * 6710656;
let digitB = mid + high * 8147497;
let digitC = high * 2;
const base = 1e7;
if (digitA >= base) {
digitB += Math.floor(digitA / base);
digitA %= base;
}
if (digitB >= base) {
digitC += Math.floor(digitB / base);
digitB %= base;
}
return digitC.toString() + decimalFrom1e7WithLeadingZeros(digitB) + decimalFrom1e7WithLeadingZeros(digitA);
}
__name(uInt64ToString, "uInt64ToString");
function toUnsigned(lo, hi) {
return { lo: lo >>> 0, hi: hi >>> 0 };
}
__name(toUnsigned, "toUnsigned");
function newBits(lo, hi) {
return { lo: lo | 0, hi: hi | 0 };
}
__name(newBits, "newBits");
function negate(lowBits, highBits) {
highBits = ~highBits;
if (lowBits) {
lowBits = ~lowBits + 1;
} else {
highBits += 1;
}
return newBits(lowBits, highBits);
}
__name(negate, "negate");
var decimalFrom1e7WithLeadingZeros = /* @__PURE__ */ __name((digit1e7) => {
const partial = String(digit1e7);
return "0000000".slice(partial.length) + partial;
}, "decimalFrom1e7WithLeadingZeros");
function varint32write(value, bytes) {
if (value >= 0) {
while (value > 127) {
bytes.push(value & 127 | 128);
value = value >>> 7;
}
bytes.push(value);
} else {
for (let i = 0; i < 9; i++) {
bytes.push(value & 127 | 128);
value = value >> 7;
}
bytes.push(1);
}
}
__name(varint32write, "varint32write");
function varint32read() {
let b = this.buf[this.pos++];
let result = b & 127;
if ((b & 128) == 0) {
this.assertBounds();
return result;
}
b = this.buf[this.pos++];
result |= (b & 127) << 7;
if ((b & 128) == 0) {
this.assertBounds();
return result;
}
b = this.buf[this.pos++];
result |= (b & 127) << 14;
if ((b & 128) == 0) {
this.assertBounds();
return result;
}
b = this.buf[this.pos++];
result |= (b & 127) << 21;
if ((b & 128) == 0) {
this.assertBounds();
return result;
}
b = this.buf[this.pos++];
result |= (b & 15) << 28;
for (let readBytes = 5; (b & 128) !== 0 && readBytes < 10; readBytes++)
b = this.buf[this.pos++];
if ((b & 128) != 0)
throw new Error("invalid varint");
this.assertBounds();
return result >>> 0;
}
__name(varint32read, "varint32read");
// node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js
var protoInt64 = /* @__PURE__ */ makeInt64Support();
function makeInt64Support() {
const dv = new DataView(new ArrayBuffer(8));
const ok = typeof BigInt === "function" && typeof dv.getBigInt64 === "function" && typeof dv.getBigUint64 === "function" && typeof dv.setBigInt64 === "function" && typeof dv.setBigUint64 === "function" && (typeof process != "object" || typeof process.env != "object" || process.env.BUF_BIGINT_DISABLE !== "1");
if (ok) {
const MIN = BigInt("-9223372036854775808"), MAX = BigInt("9223372036854775807"), UMIN = BigInt("0"), UMAX = BigInt("18446744073709551615");
return {
zero: BigInt(0),
supported: true,
parse(value) {
const bi = typeof value == "bigint" ? value : BigInt(value);
if (bi > MAX || bi < MIN) {
throw new Error(`invalid int64: ${value}`);
}
return bi;
},
uParse(value) {
const bi = typeof value == "bigint" ? value : BigInt(value);
if (bi > UMAX || bi < UMIN) {
throw new Error(`invalid uint64: ${value}`);
}
return bi;
},
enc(value) {
dv.setBigInt64(0, this.parse(value), true);
return {
lo: dv.getInt32(0, true),
hi: dv.getInt32(4, true)
};
},
uEnc(value) {
dv.setBigInt64(0, this.uParse(value), true);
return {
lo: dv.getInt32(0, true),
hi: dv.getInt32(4, true)
};
},
dec(lo, hi) {
dv.setInt32(0, lo, true);
dv.setInt32(4, hi, true);
return dv.getBigInt64(0, true);
},
uDec(lo, hi) {
dv.setInt32(0, lo, true);
dv.setInt32(4, hi, true);
return dv.getBigUint64(0, true);
}
};
}
return {
zero: "0",
supported: false,
parse(value) {
if (typeof value != "string") {
value = value.toString();
}
assertInt64String(value);
return value;
},
uParse(value) {
if (typeof value != "string") {
value = value.toString();
}
assertUInt64String(value);
return value;
},
enc(value) {
if (typeof value != "string") {
value = value.toString();
}
assertInt64String(value);
return int64FromString(value);
},
uEnc(value) {
if (typeof value != "string") {
value = value.toString();
}
assertUInt64String(value);
return int64FromString(value);
},
dec(lo, hi) {
return int64ToString(lo, hi);
},
uDec(lo, hi) {
return uInt64ToString(lo, hi);
}
};
}
__name(makeInt64Support, "makeInt64Support");
function assertInt64String(value) {
if (!/^-?[0-9]+$/.test(value)) {
throw new Error("invalid int64: " + value);
}
}
__name(assertInt64String, "assertInt64String");
function assertUInt64String(value) {
if (!/^[0-9]+$/.test(value)) {
throw new Error("invalid uint64: " + value);
}
}
__name(assertUInt64String, "assertUInt64String");
// node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js
var symbol = Symbol.for("@bufbuild/protobuf/text-encoding");
function getTextEncoding() {
if (globalThis[symbol] == void 0) {
const te = new globalThis.TextEncoder();
const td = new globalThis.TextDecoder();
globalThis[symbol] = {
encodeUtf8(text) {
return te.encode(text);
},
decodeUtf8(bytes) {
return td.decode(bytes);
},
checkUtf8(text) {
try {
encodeURIComponent(text);
return true;
} catch (e) {
return false;
}
}
};
}
return globalThis[symbol];
}
__name(getTextEncoding, "getTextEncoding");
// node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js
var WireType;
(function(WireType2) {
WireType2[WireType2["Varint"] = 0] = "Varint";
WireType2[WireType2["Bit64"] = 1] = "Bit64";
WireType2[WireType2["LengthDelimited"] = 2] = "LengthDelimited";
WireType2[WireType2["StartGroup"] = 3] = "StartGroup";
WireType2[WireType2["EndGroup"] = 4] = "EndGroup";
WireType2[WireType2["Bit32"] = 5] = "Bit32";
})(WireType || (WireType = {}));
var FLOAT32_MAX = 34028234663852886e22;
var FLOAT32_MIN = -34028234663852886e22;
var UINT32_MAX = 4294967295;
var INT32_MAX = 2147483647;
var INT32_MIN = -2147483648;
var BinaryWriter = class {
constructor(encodeUtf8 = getTextEncoding().encodeUtf8) {
this.encodeUtf8 = encodeUtf8;
this.stack = [];
this.chunks = [];
this.buf = [];
}
finish() {
this.chunks.push(new Uint8Array(this.buf));
let len = 0;
for (let i = 0; i < this.chunks.length; i++)
len += this.chunks[i].length;
let bytes = new Uint8Array(len);
let offset2 = 0;
for (let i = 0; i < this.chunks.length; i++) {
bytes.set(this.chunks[i], offset2);
offset2 += this.chunks[i].length;
}
this.chunks = [];
return bytes;
}
fork() {
this.stack.push({ chunks: this.chunks, buf: this.buf });
this.chunks = [];
this.buf = [];
return this;
}
join() {
let chunk = this.finish();
let prev = this.stack.pop();
if (!prev)
throw new Error("invalid state, fork stack empty");
this.chunks = prev.chunks;
this.buf = prev.buf;
this.uint32(chunk.byteLength);
return this.raw(chunk);
}
tag(fieldNo, type) {
return this.uint32((fieldNo << 3 | type) >>> 0);
}
raw(chunk) {
if (this.buf.length) {
this.chunks.push(new Uint8Array(this.buf));
this.buf = [];
}
this.chunks.push(chunk);
return this;
}
uint32(value) {
assertUInt32(value);
while (value > 127) {
this.buf.push(value & 127 | 128);
value = value >>> 7;
}
this.buf.push(value);
return this;
}
int32(value) {
assertInt32(value);
varint32write(value, this.buf);
return this;
}
bool(value) {
this.buf.push(value ? 1 : 0);
return this;
}
bytes(value) {
this.uint32(value.byteLength);
return this.raw(value);
}
string(value) {
let chunk = this.encodeUtf8(value);
this.uint32(chunk.byteLength);
return this.raw(chunk);
}
float(value) {
assertFloat32(value);
let chunk = new Uint8Array(4);
new DataView(chunk.buffer).setFloat32(0, value, true);
return this.raw(chunk);
}
double(value) {
let chunk = new Uint8Array(8);
new DataView(chunk.buffer).setFloat64(0, value, true);
return this.raw(chunk);
}
fixed32(value) {
assertUInt32(value);
let chunk = new Uint8Array(4);
new DataView(chunk.buffer).setUint32(0, value, true);
return this.raw(chunk);
}
sfixed32(value) {
assertInt32(value);
let chunk = new Uint8Array(4);
new DataView(chunk.buffer).setInt32(0, value, true);
return this.raw(chunk);
}
sint32(value) {
assertInt32(value);
value = (value << 1 ^ value >> 31) >>> 0;
varint32write(value, this.buf);
return this;
}
sfixed64(value) {
let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = protoInt64.enc(value);
view.setInt32(0, tc.lo, true);
view.setInt32(4, tc.hi, true);
return this.raw(chunk);
}
fixed64(value) {
let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = protoInt64.uEnc(value);
view.setInt32(0, tc.lo, true);
view.setInt32(4, tc.hi, true);
return this.raw(chunk);
}
int64(value) {
let tc = protoInt64.enc(value);
varint64write(tc.lo, tc.hi, this.buf);
return this;
}
sint64(value) {
let tc = protoInt64.enc(value), sign = tc.hi >> 31, lo = tc.lo << 1 ^ sign, hi = (tc.hi << 1 | tc.lo >>> 31) ^ sign;
varint64write(lo, hi, this.buf);
return this;
}
uint64(value) {
let tc = protoInt64.uEnc(value);
varint64write(tc.lo, tc.hi, this.buf);
return this;
}
};
__name(BinaryWriter, "BinaryWriter");
var BinaryReader = class {
constructor(buf, decodeUtf8 = getTextEncoding().decodeUtf8) {
this.decodeUtf8 = decodeUtf8;
this.varint64 = varint64read;
this.uint32 = varint32read;
this.buf = buf;
this.len = buf.length;
this.pos = 0;
this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
}
tag() {
let tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7;
if (fieldNo <= 0 || wireType < 0 || wireType > 5)
throw new Error("illegal tag: field no " + fieldNo + " wire type " + wireType);
return [fieldNo, wireType];
}
skip(wireType, fieldNo) {
let start = this.pos;
switch (wireType) {
case WireType.Varint:
while (this.buf[this.pos++] & 128) {
}
break;
case WireType.Bit64:
this.pos += 4;
case WireType.Bit32:
this.pos += 4;
break;
case WireType.LengthDelimited:
let len = this.uint32();
this.pos += len;
break;
case WireType.StartGroup:
for (; ; ) {
const [fn, wt] = this.tag();
if (wt === WireType.EndGroup) {
if (fieldNo !== void 0 && fn !== fieldNo) {
throw new Error("invalid end group tag");
}
break;
}
this.skip(wt, fn);
}
break;
default:
throw new Error("cant skip wire type " + wireType);
}
this.assertBounds();
return this.buf.subarray(start, this.pos);
}
assertBounds() {
if (this.pos > this.len)
throw new RangeError("premature EOF");
}
int32() {
return this.uint32() | 0;
}
sint32() {
let zze = this.uint32();
return zze >>> 1 ^ -(zze & 1);
}
int64() {
return protoInt64.dec(...this.varint64());
}
uint64() {
return protoInt64.uDec(...this.varint64());
}
sint64() {
let [lo, hi] = this.varint64();
let s = -(lo & 1);
lo = (lo >>> 1 | (hi & 1) << 31) ^ s;
hi = hi >>> 1 ^ s;
return protoInt64.dec(lo, hi);
}
bool() {
let [lo, hi] = this.varint64();
return lo !== 0 || hi !== 0;
}
fixed32() {
return this.view.getUint32((this.pos += 4) - 4, true);
}
sfixed32() {
return this.view.getInt32((this.pos += 4) - 4, true);
}
fixed64() {
return protoInt64.uDec(this.sfixed32(), this.sfixed32());
}
sfixed64() {
return protoInt64.dec(this.sfixed32(), this.sfixed32());
}
float() {
return this.view.getFloat32((this.pos += 4) - 4, true);
}
double() {
return this.view.getFloat64((this.pos += 8) - 8, true);
}
bytes() {
let len = this.uint32(), start = this.pos;
this.pos += len;
this.assertBounds();
return this.buf.subarray(start, start + len);
}
string() {
return this.decodeUtf8(this.bytes());
}
};
__name(BinaryReader, "BinaryReader");
function assertInt32(arg) {
if (typeof arg == "string") {
arg = Number(arg);
} else if (typeof arg != "number") {
throw new Error("invalid int32: " + typeof arg);
}
if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN)
throw new Error("invalid int32: " + arg);
}
__name(assertInt32, "assertInt32");
function assertUInt32(arg) {
if (typeof arg == "string") {
arg = Number(arg);
} else if (typeof arg != "number") {
throw new Error("invalid uint32: " + typeof arg);
}
if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0)
throw new Error("invalid uint32: " + arg);
}
__name(assertUInt32, "assertUInt32");
function assertFloat32(arg) {
if (typeof arg == "string") {
const o = arg;
arg = Number(arg);
if (isNaN(arg) && o !== "NaN") {
throw new Error("invalid float32: " + o);
}
} else if (typeof arg != "number") {
throw new Error("invalid float32: " + typeof arg);
}
if (Number.isFinite(arg) && (arg > FLOAT32_MAX || arg < FLOAT32_MIN))
throw new Error("invalid float32: " + arg);
}
__name(assertFloat32, "assertFloat32");
// dist/protos/generated/misc/params.js
var SearchFilter_SortBy;
(function(SearchFilter_SortBy2) {
SearchFilter_SortBy2[SearchFilter_SortBy2["RELEVANCE"] = 0] = "RELEVANCE";
SearchFilter_SortBy2[SearchFilter_SortBy2["RATING"] = 1] = "RATING";
SearchFilter_SortBy2[SearchFilter_SortBy2["UPLOAD_DATE"] = 2] = "UPLOAD_DATE";
SearchFilter_SortBy2[SearchFilter_SortBy2["VIEW_COUNT"] = 3] = "VIEW_COUNT";
SearchFilter_SortBy2[SearchFilter_SortBy2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(SearchFilter_SortBy || (SearchFilter_SortBy = {}));
var SearchFilter_Filters_UploadDate;
(function(SearchFilter_Filters_UploadDate2) {
SearchFilter_Filters_UploadDate2[SearchFilter_Filters_UploadDate2["ANY_DATE"] = 0] = "ANY_DATE";
SearchFilter_Filters_UploadDate2[SearchFilter_Filters_UploadDate2["HOUR"] = 1] = "HOUR";
SearchFilter_Filters_UploadDate2[SearchFilter_Filters_UploadDate2["TODAY"] = 2] = "TODAY";
SearchFilter_Filters_UploadDate2[SearchFilter_Filters_UploadDate2["WEEK"] = 3] = "WEEK";
SearchFilter_Filters_UploadDate2[SearchFilter_Filters_UploadDate2["MONTH"] = 4] = "MONTH";
SearchFilter_Filters_UploadDate2[SearchFilter_Filters_UploadDate2["YEAR"] = 5] = "YEAR";
SearchFilter_Filters_UploadDate2[SearchFilter_Filters_UploadDate2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(SearchFilter_Filters_UploadDate || (SearchFilter_Filters_UploadDate = {}));
var SearchFilter_Filters_SearchType;
(function(SearchFilter_Filters_SearchType2) {
SearchFilter_Filters_SearchType2[SearchFilter_Filters_SearchType2["ANY_TYPE"] = 0] = "ANY_TYPE";
SearchFilter_Filters_SearchType2[SearchFilter_Filters_SearchType2["VIDEO"] = 1] = "VIDEO";
SearchFilter_Filters_SearchType2[SearchFilter_Filters_SearchType2["CHANNEL"] = 2] = "CHANNEL";
SearchFilter_Filters_SearchType2[SearchFilter_Filters_SearchType2["PLAYLIST"] = 3] = "PLAYLIST";
SearchFilter_Filters_SearchType2[SearchFilter_Filters_SearchType2["MOVIE"] = 4] = "MOVIE";
SearchFilter_Filters_SearchType2[SearchFilter_Filters_SearchType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(SearchFilter_Filters_SearchType || (SearchFilter_Filters_SearchType = {}));
var SearchFilter_Filters_Duration;
(function(SearchFilter_Filters_Duration2) {
SearchFilter_Filters_Duration2[SearchFilter_Filters_Duration2["ANY_DURATION"] = 0] = "ANY_DURATION";
SearchFilter_Filters_Duration2[SearchFilter_Filters_Duration2["SHORT"] = 1] = "SHORT";
SearchFilter_Filters_Duration2[SearchFilter_Filters_Duration2["LONG"] = 2] = "LONG";
SearchFilter_Filters_Duration2[SearchFilter_Filters_Duration2["MEDIUM"] = 3] = "MEDIUM";
SearchFilter_Filters_Duration2[SearchFilter_Filters_Duration2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(SearchFilter_Filters_Duration || (SearchFilter_Filters_Duration = {}));
function createBaseVisitorData() {
return { id: "", timestamp: 0 };
}
__name(createBaseVisitorData, "createBaseVisitorData");
var VisitorData = {
encode(message, writer = new BinaryWriter()) {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.timestamp !== 0) {
writer.uint32(40).int32(message.timestamp);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseVisitorData();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
case 5:
if (tag !== 40) {
break;
}
message.timestamp = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseSearchFilter() {
return { sortBy: void 0, filters: void 0 };
}
__name(createBaseSearchFilter, "createBaseSearchFilter");
var SearchFilter = {
encode(message, writer = new BinaryWriter()) {
if (message.sortBy !== void 0) {
writer.uint32(8).int32(message.sortBy);
}
if (message.filters !== void 0) {
SearchFilter_Filters.encode(message.filters, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseSearchFilter();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.sortBy = reader.int32();
continue;
case 2:
if (tag !== 18) {
break;
}
message.filters = SearchFilter_Filters.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseSearchFilter_Filters() {
return {
uploadDate: void 0,
type: void 0,
duration: void 0,
musicSearchType: void 0,
featuresHd: void 0,
featuresSubtitles: void 0,
featuresCreativeCommons: void 0,
features3d: void 0,
featuresLive: void 0,
featuresPurchased: void 0,
features4k: void 0,
features360: void 0,
featuresLocation: void 0,
featuresHdr: void 0,
featuresVr180: void 0
};
}
__name(createBaseSearchFilter_Filters, "createBaseSearchFilter_Filters");
var SearchFilter_Filters = {
encode(message, writer = new BinaryWriter()) {
if (message.uploadDate !== void 0) {
writer.uint32(8).int32(message.uploadDate);
}
if (message.type !== void 0) {
writer.uint32(16).int32(message.type);
}
if (message.duration !== void 0) {
writer.uint32(24).int32(message.duration);
}
if (message.musicSearchType !== void 0) {
SearchFilter_Filters_MusicSearchType.encode(message.musicSearchType, writer.uint32(138).fork()).join();
}
if (message.featuresHd !== void 0) {
writer.uint32(32).bool(message.featuresHd);
}
if (message.featuresSubtitles !== void 0) {
writer.uint32(40).bool(message.featuresSubtitles);
}
if (message.featuresCreativeCommons !== void 0) {
writer.uint32(48).bool(message.featuresCreativeCommons);
}
if (message.features3d !== void 0) {
writer.uint32(56).bool(message.features3d);
}
if (message.featuresLive !== void 0) {
writer.uint32(64).bool(message.featuresLive);
}
if (message.featuresPurchased !== void 0) {
writer.uint32(72).bool(message.featuresPurchased);
}
if (message.features4k !== void 0) {
writer.uint32(112).bool(message.features4k);
}
if (message.features360 !== void 0) {
writer.uint32(120).bool(message.features360);
}
if (message.featuresLocation !== void 0) {
writer.uint32(184).bool(message.featuresLocation);
}
if (message.featuresHdr !== void 0) {
writer.uint32(200).bool(message.featuresHdr);
}
if (message.featuresVr180 !== void 0) {
writer.uint32(208).bool(message.featuresVr180);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseSearchFilter_Filters();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.uploadDate = reader.int32();
continue;
case 2:
if (tag !== 16) {
break;
}
message.type = reader.int32();
continue;
case 3:
if (tag !== 24) {
break;
}
message.duration = reader.int32();
continue;
case 17:
if (tag !== 138) {
break;
}
message.musicSearchType = SearchFilter_Filters_MusicSearchType.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 32) {
break;
}
message.featuresHd = reader.bool();
continue;
case 5:
if (tag !== 40) {
break;
}
message.featuresSubtitles = reader.bool();
continue;
case 6:
if (tag !== 48) {
break;
}
message.featuresCreativeCommons = reader.bool();
continue;
case 7:
if (tag !== 56) {
break;
}
message.features3d = reader.bool();
continue;
case 8:
if (tag !== 64) {
break;
}
message.featuresLive = reader.bool();
continue;
case 9:
if (tag !== 72) {
break;
}
message.featuresPurchased = reader.bool();
continue;
case 14:
if (tag !== 112) {
break;
}
message.features4k = reader.bool();
continue;
case 15:
if (tag !== 120) {
break;
}
message.features360 = reader.bool();
continue;
case 23:
if (tag !== 184) {
break;
}
message.featuresLocation = reader.bool();
continue;
case 25:
if (tag !== 200) {
break;
}
message.featuresHdr = reader.bool();
continue;
case 26:
if (tag !== 208) {
break;
}
message.featuresVr180 = reader.bool();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseSearchFilter_Filters_MusicSearchType() {
return { song: void 0, video: void 0, album: void 0, artist: void 0, playlist: void 0 };
}
__name(createBaseSearchFilter_Filters_MusicSearchType, "createBaseSearchFilter_Filters_MusicSearchType");
var SearchFilter_Filters_MusicSearchType = {
encode(message, writer = new BinaryWriter()) {
if (message.song !== void 0) {
writer.uint32(8).bool(message.song);
}
if (message.video !== void 0) {
writer.uint32(16).bool(message.video);
}
if (message.album !== void 0) {
writer.uint32(24).bool(message.album);
}
if (message.artist !== void 0) {
writer.uint32(32).bool(message.artist);
}
if (message.playlist !== void 0) {
writer.uint32(40).bool(message.playlist);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseSearchFilter_Filters_MusicSearchType();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.song = reader.bool();
continue;
case 2:
if (tag !== 16) {
break;
}
message.video = reader.bool();
continue;
case 3:
if (tag !== 24) {
break;
}
message.album = reader.bool();
continue;
case 4:
if (tag !== 32) {
break;
}
message.artist = reader.bool();
continue;
case 5:
if (tag !== 40) {
break;
}
message.playlist = reader.bool();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseNotificationPreferences() {
return { channelId: "", prefId: void 0, number0: void 0, number1: void 0 };
}
__name(createBaseNotificationPreferences, "createBaseNotificationPreferences");
var NotificationPreferences = {
encode(message, writer = new BinaryWriter()) {
if (message.channelId !== "") {
writer.uint32(10).string(message.channelId);
}
if (message.prefId !== void 0) {
NotificationPreferences_Preference.encode(message.prefId, writer.uint32(18).fork()).join();
}
if (message.number0 !== void 0) {
writer.uint32(24).int32(message.number0);
}
if (message.number1 !== void 0) {
writer.uint32(32).int32(message.number1);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseNotificationPreferences();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.channelId = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.prefId = NotificationPreferences_Preference.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 24) {
break;
}
message.number0 = reader.int32();
continue;
case 4:
if (tag !== 32) {
break;
}
message.number1 = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseNotificationPreferences_Preference() {
return { index: 0 };
}
__name(createBaseNotificationPreferences_Preference, "createBaseNotificationPreferences_Preference");
var NotificationPreferences_Preference = {
encode(message, writer = new BinaryWriter()) {
if (message.index !== 0) {
writer.uint32(8).int32(message.index);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseNotificationPreferences_Preference();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.index = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseLiveMessageParams() {
return { params: void 0, number0: void 0, number1: void 0 };
}
__name(createBaseLiveMessageParams, "createBaseLiveMessageParams");
var LiveMessageParams = {
encode(message, writer = new BinaryWriter()) {
if (message.params !== void 0) {
LiveMessageParams_Params.encode(message.params, writer.uint32(10).fork()).join();
}
if (message.number0 !== void 0) {
writer.uint32(16).int32(message.number0);
}
if (message.number1 !== void 0) {
writer.uint32(24).int32(message.number1);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseLiveMessageParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.params = LiveMessageParams_Params.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 16) {
break;
}
message.number0 = reader.int32();
continue;
case 3:
if (tag !== 24) {
break;
}
message.number1 = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseLiveMessageParams_Params() {
return { ids: void 0 };
}
__name(createBaseLiveMessageParams_Params, "createBaseLiveMessageParams_Params");
var LiveMessageParams_Params = {
encode(message, writer = new BinaryWriter()) {
if (message.ids !== void 0) {
LiveMessageParams_Params_Ids.encode(message.ids, writer.uint32(42).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseLiveMessageParams_Params();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 5:
if (tag !== 42) {
break;
}
message.ids = LiveMessageParams_Params_Ids.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseLiveMessageParams_Params_Ids() {
return { channelId: "", videoId: "" };
}
__name(createBaseLiveMessageParams_Params_Ids, "createBaseLiveMessageParams_Params_Ids");
var LiveMessageParams_Params_Ids = {
encode(message, writer = new BinaryWriter()) {
if (message.channelId !== "") {
writer.uint32(10).string(message.channelId);
}
if (message.videoId !== "") {
writer.uint32(18).string(message.videoId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseLiveMessageParams_Params_Ids();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.channelId = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.videoId = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseGetCommentsSectionParams() {
return { ctx: void 0, unkParam: 0, params: void 0 };
}
__name(createBaseGetCommentsSectionParams, "createBaseGetCommentsSectionParams");
var GetCommentsSectionParams = {
encode(message, writer = new BinaryWriter()) {
if (message.ctx !== void 0) {
GetCommentsSectionParams_Context.encode(message.ctx, writer.uint32(18).fork()).join();
}
if (message.unkParam !== 0) {
writer.uint32(24).int32(message.unkParam);
}
if (message.params !== void 0) {
GetCommentsSectionParams_Params.encode(message.params, writer.uint32(50).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseGetCommentsSectionParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.ctx = GetCommentsSectionParams_Context.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 24) {
break;
}
message.unkParam = reader.int32();
continue;
case 6:
if (tag !== 50) {
break;
}
message.params = GetCommentsSectionParams_Params.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseGetCommentsSectionParams_Context() {
return { videoId: "" };
}
__name(createBaseGetCommentsSectionParams_Context, "createBaseGetCommentsSectionParams_Context");
var GetCommentsSectionParams_Context = {
encode(message, writer = new BinaryWriter()) {
if (message.videoId !== "") {
writer.uint32(18).string(message.videoId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseGetCommentsSectionParams_Context();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.videoId = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseGetCommentsSectionParams_Params() {
return { unkToken: void 0, opts: void 0, repliesOpts: void 0, page: void 0, target: "" };
}
__name(createBaseGetCommentsSectionParams_Params, "createBaseGetCommentsSectionParams_Params");
var GetCommentsSectionParams_Params = {
encode(message, writer = new BinaryWriter()) {
if (message.unkToken !== void 0) {
writer.uint32(10).string(message.unkToken);
}
if (message.opts !== void 0) {
GetCommentsSectionParams_Params_Options.encode(message.opts, writer.uint32(34).fork()).join();
}
if (message.repliesOpts !== void 0) {
GetCommentsSectionParams_Params_RepliesOptions.encode(message.repliesOpts, writer.uint32(26).fork()).join();
}
if (message.page !== void 0) {
writer.uint32(40).int32(message.page);
}
if (message.target !== "") {
writer.uint32(66).string(message.target);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseGetCommentsSectionParams_Params();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.unkToken = reader.string();
continue;
case 4:
if (tag !== 34) {
break;
}
message.opts = GetCommentsSectionParams_Params_Options.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
message.repliesOpts = GetCommentsSectionParams_Params_RepliesOptions.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 40) {
break;
}
message.page = reader.int32();
continue;
case 8:
if (tag !== 66) {
break;
}
message.target = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseGetCommentsSectionParams_Params_Options() {
return { videoId: "", sortBy: 0, type: 0, commentId: void 0 };
}
__name(createBaseGetCommentsSectionParams_Params_Options, "createBaseGetCommentsSectionParams_Params_Options");
var GetCommentsSectionParams_Params_Options = {
encode(message, writer = new BinaryWriter()) {
if (message.videoId !== "") {
writer.uint32(34).string(message.videoId);
}
if (message.sortBy !== 0) {
writer.uint32(48).int32(message.sortBy);
}
if (message.type !== 0) {
writer.uint32(120).int32(message.type);
}
if (message.commentId !== void 0) {
writer.uint32(130).string(message.commentId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseGetCommentsSectionParams_Params_Options();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 4:
if (tag !== 34) {
break;
}
message.videoId = reader.string();
continue;
case 6:
if (tag !== 48) {
break;
}
message.sortBy = reader.int32();
continue;
case 15:
if (tag !== 120) {
break;
}
message.type = reader.int32();
continue;
case 16:
if (tag !== 130) {
break;
}
message.commentId = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseGetCommentsSectionParams_Params_RepliesOptions() {
return { commentId: "", unkopts: void 0, channelId: void 0, videoId: "", unkParam1: 0, unkParam2: 0 };
}
__name(createBaseGetCommentsSectionParams_Params_RepliesOptions, "createBaseGetCommentsSectionParams_Params_RepliesOptions");
var GetCommentsSectionParams_Params_RepliesOptions = {
encode(message, writer = new BinaryWriter()) {
if (message.commentId !== "") {
writer.uint32(18).string(message.commentId);
}
if (message.unkopts !== void 0) {
GetCommentsSectionParams_Params_RepliesOptions_UnkOpts.encode(message.unkopts, writer.uint32(34).fork()).join();
}
if (message.channelId !== void 0) {
writer.uint32(42).string(message.channelId);
}
if (message.videoId !== "") {
writer.uint32(50).string(message.videoId);
}
if (message.unkParam1 !== 0) {
writer.uint32(64).int32(message.unkParam1);
}
if (message.unkParam2 !== 0) {
writer.uint32(72).int32(message.unkParam2);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseGetCommentsSectionParams_Params_RepliesOptions();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.commentId = reader.string();
continue;
case 4:
if (tag !== 34) {
break;
}
message.unkopts = GetCommentsSectionParams_Params_RepliesOptions_UnkOpts.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
break;
}
message.channelId = reader.string();
continue;
case 6:
if (tag !== 50) {
break;
}
message.videoId = reader.string();
continue;
case 8:
if (tag !== 64) {
break;
}
message.unkParam1 = reader.int32();
continue;
case 9:
if (tag !== 72) {
break;
}
message.unkParam2 = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseGetCommentsSectionParams_Params_RepliesOptions_UnkOpts() {
return { unkParam: 0 };
}
__name(createBaseGetCommentsSectionParams_Params_RepliesOptions_UnkOpts, "createBaseGetCommentsSectionParams_Params_RepliesOptions_UnkOpts");
var GetCommentsSectionParams_Params_RepliesOptions_UnkOpts = {
encode(message, writer = new BinaryWriter()) {
if (message.unkParam !== 0) {
writer.uint32(8).int32(message.unkParam);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseGetCommentsSectionParams_Params_RepliesOptions_UnkOpts();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.unkParam = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCreateCommentParams() {
return { videoId: "", params: void 0, number: 0 };
}
__name(createBaseCreateCommentParams, "createBaseCreateCommentParams");
var CreateCommentParams = {
encode(message, writer = new BinaryWriter()) {
if (message.videoId !== "") {
writer.uint32(18).string(message.videoId);
}
if (message.params !== void 0) {
CreateCommentParams_Params.encode(message.params, writer.uint32(42).fork()).join();
}
if (message.number !== 0) {
writer.uint32(80).int32(message.number);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCreateCommentParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.videoId = reader.string();
continue;
case 5:
if (tag !== 42) {
break;
}
message.params = CreateCommentParams_Params.decode(reader, reader.uint32());
continue;
case 10:
if (tag !== 80) {
break;
}
message.number = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCreateCommentParams_Params() {
return { index: 0 };
}
__name(createBaseCreateCommentParams_Params, "createBaseCreateCommentParams_Params");
var CreateCommentParams_Params = {
encode(message, writer = new BinaryWriter()) {
if (message.index !== 0) {
writer.uint32(8).int32(message.index);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCreateCommentParams_Params();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.index = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBasePeformCommentActionParams() {
return {
type: 0,
commentId: "",
videoId: "",
unkNum: void 0,
channelId: void 0,
translateCommentParams: void 0
};
}
__name(createBasePeformCommentActionParams, "createBasePeformCommentActionParams");
var PeformCommentActionParams = {
encode(message, writer = new BinaryWriter()) {
if (message.type !== 0) {
writer.uint32(8).int32(message.type);
}
if (message.commentId !== "") {
writer.uint32(26).string(message.commentId);
}
if (message.videoId !== "") {
writer.uint32(42).string(message.videoId);
}
if (message.unkNum !== void 0) {
writer.uint32(16).int32(message.unkNum);
}
if (message.channelId !== void 0) {
writer.uint32(186).string(message.channelId);
}
if (message.translateCommentParams !== void 0) {
PeformCommentActionParams_TranslateCommentParams.encode(message.translateCommentParams, writer.uint32(250).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBasePeformCommentActionParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.type = reader.int32();
continue;
case 3:
if (tag !== 26) {
break;
}
message.commentId = reader.string();
continue;
case 5:
if (tag !== 42) {
break;
}
message.videoId = reader.string();
continue;
case 2:
if (tag !== 16) {
break;
}
message.unkNum = reader.int32();
continue;
case 23:
if (tag !== 186) {
break;
}
message.channelId = reader.string();
continue;
case 31:
if (tag !== 250) {
break;
}
message.translateCommentParams = PeformCommentActionParams_TranslateCommentParams.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBasePeformCommentActionParams_TranslateCommentParams() {
return { params: void 0, commentId: "", targetLanguage: "" };
}
__name(createBasePeformCommentActionParams_TranslateCommentParams, "createBasePeformCommentActionParams_TranslateCommentParams");
var PeformCommentActionParams_TranslateCommentParams = {
encode(message, writer = new BinaryWriter()) {
if (message.params !== void 0) {
PeformCommentActionParams_TranslateCommentParams_Params.encode(message.params, writer.uint32(26).fork()).join();
}
if (message.commentId !== "") {
writer.uint32(18).string(message.commentId);
}
if (message.targetLanguage !== "") {
writer.uint32(34).string(message.targetLanguage);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBasePeformCommentActionParams_TranslateCommentParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3:
if (tag !== 26) {
break;
}
message.params = PeformCommentActionParams_TranslateCommentParams_Params.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.commentId = reader.string();
continue;
case 4:
if (tag !== 34) {
break;
}
message.targetLanguage = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBasePeformCommentActionParams_TranslateCommentParams_Params() {
return { comment: void 0 };
}
__name(createBasePeformCommentActionParams_TranslateCommentParams_Params, "createBasePeformCommentActionParams_TranslateCommentParams_Params");
var PeformCommentActionParams_TranslateCommentParams_Params = {
encode(message, writer = new BinaryWriter()) {
if (message.comment !== void 0) {
PeformCommentActionParams_TranslateCommentParams_Params_Comment.encode(message.comment, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBasePeformCommentActionParams_TranslateCommentParams_Params();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.comment = PeformCommentActionParams_TranslateCommentParams_Params_Comment.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBasePeformCommentActionParams_TranslateCommentParams_Params_Comment() {
return { text: "" };
}
__name(createBasePeformCommentActionParams_TranslateCommentParams_Params_Comment, "createBasePeformCommentActionParams_TranslateCommentParams_Params_Comment");
var PeformCommentActionParams_TranslateCommentParams_Params_Comment = {
encode(message, writer = new BinaryWriter()) {
if (message.text !== "") {
writer.uint32(10).string(message.text);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBasePeformCommentActionParams_TranslateCommentParams_Params_Comment();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.text = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseHashtag() {
return { params: void 0 };
}
__name(createBaseHashtag, "createBaseHashtag");
var Hashtag = {
encode(message, writer = new BinaryWriter()) {
if (message.params !== void 0) {
Hashtag_Params.encode(message.params, writer.uint32(746).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseHashtag();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 93:
if (tag !== 746) {
break;
}
message.params = Hashtag_Params.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseHashtag_Params() {
return { hashtag: "", type: 0 };
}
__name(createBaseHashtag_Params, "createBaseHashtag_Params");
var Hashtag_Params = {
encode(message, writer = new BinaryWriter()) {
if (message.hashtag !== "") {
writer.uint32(10).string(message.hashtag);
}
if (message.type !== 0) {
writer.uint32(24).int32(message.type);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseHashtag_Params();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.hashtag = reader.string();
continue;
case 3:
if (tag !== 24) {
break;
}
message.type = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseReelSequence() {
return { shortId: "", params: void 0, feature2: 0, feature3: 0 };
}
__name(createBaseReelSequence, "createBaseReelSequence");
var ReelSequence = {
encode(message, writer = new BinaryWriter()) {
if (message.shortId !== "") {
writer.uint32(10).string(message.shortId);
}
if (message.params !== void 0) {
ReelSequence_Params.encode(message.params, writer.uint32(42).fork()).join();
}
if (message.feature2 !== 0) {
writer.uint32(80).int32(message.feature2);
}
if (message.feature3 !== 0) {
writer.uint32(104).int32(message.feature3);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseReelSequence();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.shortId = reader.string();
continue;
case 5:
if (tag !== 42) {
break;
}
message.params = ReelSequence_Params.decode(reader, reader.uint32());
continue;
case 10:
if (tag !== 80) {
break;
}
message.feature2 = reader.int32();
continue;
case 13:
if (tag !== 104) {
break;
}
message.feature3 = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseReelSequence_Params() {
return { number: 0 };
}
__name(createBaseReelSequence_Params, "createBaseReelSequence_Params");
var ReelSequence_Params = {
encode(message, writer = new BinaryWriter()) {
if (message.number !== 0) {
writer.uint32(24).int32(message.number);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseReelSequence_Params();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3:
if (tag !== 24) {
break;
}
message.number = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseNextParams() {
return { videoId: [] };
}
__name(createBaseNextParams, "createBaseNextParams");
var NextParams = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.videoId) {
writer.uint32(42).string(v);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseNextParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 5:
if (tag !== 42) {
break;
}
message.videoId.push(reader.string());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCommunityPostParams() {
return { f0: "", f1: void 0, f2: void 0 };
}
__name(createBaseCommunityPostParams, "createBaseCommunityPostParams");
var CommunityPostParams = {
encode(message, writer = new BinaryWriter()) {
if (message.f0 !== "") {
writer.uint32(18).string(message.f0);
}
if (message.f1 !== void 0) {
CommunityPostParams_Field1.encode(message.f1, writer.uint32(202).fork()).join();
}
if (message.f2 !== void 0) {
CommunityPostParams_Field2.encode(message.f2, writer.uint32(362).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCommunityPostParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.f0 = reader.string();
continue;
case 25:
if (tag !== 202) {
break;
}
message.f1 = CommunityPostParams_Field1.decode(reader, reader.uint32());
continue;
case 45:
if (tag !== 362) {
break;
}
message.f2 = CommunityPostParams_Field2.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCommunityPostParams_Field1() {
return { postId: "" };
}
__name(createBaseCommunityPostParams_Field1, "createBaseCommunityPostParams_Field1");
var CommunityPostParams_Field1 = {
encode(message, writer = new BinaryWriter()) {
if (message.postId !== "") {
writer.uint32(178).string(message.postId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCommunityPostParams_Field1();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 22:
if (tag !== 178) {
break;
}
message.postId = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCommunityPostParams_Field2() {
return { p1: 0, p2: 0 };
}
__name(createBaseCommunityPostParams_Field2, "createBaseCommunityPostParams_Field2");
var CommunityPostParams_Field2 = {
encode(message, writer = new BinaryWriter()) {
if (message.p1 !== 0) {
writer.uint32(16).uint32(message.p1);
}
if (message.p2 !== 0) {
writer.uint32(24).uint32(message.p2);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCommunityPostParams_Field2();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 16) {
break;
}
message.p1 = reader.uint32();
continue;
case 3:
if (tag !== 24) {
break;
}
message.p2 = reader.uint32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCommunityPostCommentsParamContainer() {
return { f0: void 0 };
}
__name(createBaseCommunityPostCommentsParamContainer, "createBaseCommunityPostCommentsParamContainer");
var CommunityPostCommentsParamContainer = {
encode(message, writer = new BinaryWriter()) {
if (message.f0 !== void 0) {
CommunityPostCommentsParamContainer_Container.encode(message.f0, writer.uint32(641815778).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCommunityPostCommentsParamContainer();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 80226972:
if (tag !== 641815778) {
break;
}
message.f0 = CommunityPostCommentsParamContainer_Container.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCommunityPostCommentsParamContainer_Container() {
return { location: "", protoData: "" };
}
__name(createBaseCommunityPostCommentsParamContainer_Container, "createBaseCommunityPostCommentsParamContainer_Container");
var CommunityPostCommentsParamContainer_Container = {
encode(message, writer = new BinaryWriter()) {
if (message.location !== "") {
writer.uint32(18).string(message.location);
}
if (message.protoData !== "") {
writer.uint32(26).string(message.protoData);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCommunityPostCommentsParamContainer_Container();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.location = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.protoData = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCommunityPostCommentsParam() {
return { title: "", postContainer: void 0, f0: void 0, commentDataContainer: void 0 };
}
__name(createBaseCommunityPostCommentsParam, "createBaseCommunityPostCommentsParam");
var CommunityPostCommentsParam = {
encode(message, writer = new BinaryWriter()) {
if (message.title !== "") {
writer.uint32(18).string(message.title);
}
if (message.postContainer !== void 0) {
CommunityPostCommentsParam_PostContainer.encode(message.postContainer, writer.uint32(202).fork()).join();
}
if (message.f0 !== void 0) {
CommunityPostCommentsParam_Field2.encode(message.f0, writer.uint32(362).fork()).join();
}
if (message.commentDataContainer !== void 0) {
CommunityPostCommentsParam_CommentDataContainer.encode(message.commentDataContainer, writer.uint32(426).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCommunityPostCommentsParam();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.title = reader.string();
continue;
case 25:
if (tag !== 202) {
break;
}
message.postContainer = CommunityPostCommentsParam_PostContainer.decode(reader, reader.uint32());
continue;
case 45:
if (tag !== 362) {
break;
}
message.f0 = CommunityPostCommentsParam_Field2.decode(reader, reader.uint32());
continue;
case 53:
if (tag !== 426) {
break;
}
message.commentDataContainer = CommunityPostCommentsParam_CommentDataContainer.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCommunityPostCommentsParam_PostContainer() {
return { postId: "" };
}
__name(createBaseCommunityPostCommentsParam_PostContainer, "createBaseCommunityPostCommentsParam_PostContainer");
var CommunityPostCommentsParam_PostContainer = {
encode(message, writer = new BinaryWriter()) {
if (message.postId !== "") {
writer.uint32(178).string(message.postId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCommunityPostCommentsParam_PostContainer();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 22:
if (tag !== 178) {
break;
}
message.postId = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCommunityPostCommentsParam_Field2() {
return { f0: 0, f1: 0 };
}
__name(createBaseCommunityPostCommentsParam_Field2, "createBaseCommunityPostCommentsParam_Field2");
var CommunityPostCommentsParam_Field2 = {
encode(message, writer = new BinaryWriter()) {
if (message.f0 !== 0) {
writer.uint32(16).int32(message.f0);
}
if (message.f1 !== 0) {
writer.uint32(24).int32(message.f1);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCommunityPostCommentsParam_Field2();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 16) {
break;
}
message.f0 = reader.int32();
continue;
case 3:
if (tag !== 24) {
break;
}
message.f1 = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCommunityPostCommentsParam_CommentDataContainer() {
return { commentData: void 0, title: "" };
}
__name(createBaseCommunityPostCommentsParam_CommentDataContainer, "createBaseCommunityPostCommentsParam_CommentDataContainer");
var CommunityPostCommentsParam_CommentDataContainer = {
encode(message, writer = new BinaryWriter()) {
if (message.commentData !== void 0) {
CommunityPostCommentsParam_CommentDataContainer_CommentData.encode(message.commentData, writer.uint32(34).fork()).join();
}
if (message.title !== "") {
writer.uint32(66).string(message.title);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCommunityPostCommentsParam_CommentDataContainer();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 4:
if (tag !== 34) {
break;
}
message.commentData = CommunityPostCommentsParam_CommentDataContainer_CommentData.decode(reader, reader.uint32());
continue;
case 8:
if (tag !== 66) {
break;
}
message.title = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
function createBaseCommunityPostCommentsParam_CommentDataContainer_CommentData() {
return { sortBy: 0, f0: 0, postId: "", channelId: "" };
}
__name(createBaseCommunityPostCommentsParam_CommentDataContainer_CommentData, "createBaseCommunityPostCommentsParam_CommentDataContainer_CommentData");
var CommunityPostCommentsParam_CommentDataContainer_CommentData = {
encode(message, writer = new BinaryWriter()) {
if (message.sortBy !== 0) {
writer.uint32(48).int32(message.sortBy);
}
if (message.f0 !== 0) {
writer.uint32(216).int32(message.f0);
}
if (message.postId !== "") {
writer.uint32(234).string(message.postId);
}
if (message.channelId !== "") {
writer.uint32(242).string(message.channelId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === void 0 ? reader.len : reader.pos + length;
const message = createBaseCommunityPostCommentsParam_CommentDataContainer_CommentData();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 6:
if (tag !== 48) {
break;
}
message.sortBy = reader.int32();
continue;
case 27:
if (tag !== 216) {
break;
}
message.f0 = reader.int32();
continue;
case 29:
if (tag !== 234) {
break;
}
message.postId = reader.string();
continue;
case 30:
if (tag !== 242) {
break;
}
message.channelId = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
}
};
// dist/src/utils/ProtoUtils.js
function encodeVisitorData(id, timestamp) {
const writer = VisitorData.encode({ id, timestamp });
return encodeURIComponent(u8ToBase64(writer.finish()).replace(/\+/g, "-").replace(/\//g, "_"));
}
__name(encodeVisitorData, "encodeVisitorData");
function decodeVisitorData(visitor_data) {
return VisitorData.decode(base64ToU8(decodeURIComponent(visitor_data).replace(/-/g, "+").replace(/_/g, "/")));
}
__name(decodeVisitorData, "decodeVisitorData");
function encodeCommentActionParams(type, args = {}) {
const data2 = {
type,
commentId: args.comment_id || " ",
videoId: args.video_id || " ",
channelId: " ",
unkNum: 2
};
if (args.hasOwnProperty("text")) {
if (typeof args.target_language !== "string")
throw new Error("target_language must be a string");
if (args.comment_id)
delete data2.unkNum;
data2.translateCommentParams = {
params: {
comment: {
text: args.text
}
},
commentId: args.comment_id || " ",
targetLanguage: args.target_language
};
}
const writer = PeformCommentActionParams.encode(data2);
return encodeURIComponent(u8ToBase64(writer.finish()));
}
__name(encodeCommentActionParams, "encodeCommentActionParams");
function encodeNextParams(video_ids) {
const writer = NextParams.encode({ videoId: video_ids });
return encodeURIComponent(u8ToBase64(writer.finish()).replace(/\+/g, "-").replace(/\//g, "_"));
}
__name(encodeNextParams, "encodeNextParams");
// dist/src/parser/classes/actions/OpenPopupAction.js
var OpenPopupAction = class extends YTNode {
constructor(data2) {
super();
this.popup = parser_exports.parseItem(data2.popup);
this.popup_type = data2.popupType;
}
};
__name(OpenPopupAction, "OpenPopupAction");
OpenPopupAction.type = "OpenPopupAction";
var OpenPopupAction_default = OpenPopupAction;
// dist/src/parser/classes/Button.js
var Button = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "text"))
this.text = new Text(data2.text).toString();
if (Reflect.has(data2, "accessibility") && Reflect.has(data2.accessibility, "label")) {
this.label = data2.accessibility.label;
} else if (Reflect.has(data2, "accessibilityData") && Reflect.has(data2.accessibilityData, "accessibilityData") && Reflect.has(data2.accessibilityData.accessibilityData, "label")) {
this.label = data2.accessibilityData.accessibilityData.label;
}
if (Reflect.has(data2, "tooltip"))
this.tooltip = data2.tooltip;
if (Reflect.has(data2, "style"))
this.style = data2.style;
if (Reflect.has(data2, "size"))
this.size = data2.size;
if (Reflect.has(data2, "icon") && Reflect.has(data2.icon, "iconType"))
this.icon_type = data2.icon.iconType;
if (Reflect.has(data2, "isDisabled"))
this.is_disabled = data2.isDisabled;
if (Reflect.has(data2, "targetId"))
this.target_id = data2.targetId;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint || data2.serviceEndpoint || data2.command);
}
};
__name(Button, "Button");
Button.type = "Button";
var Button_default = Button;
// dist/src/parser/classes/DropdownItem.js
var DropdownItem = class extends YTNode {
constructor(data2) {
super();
this.label = new Text(data2.label).toString();
this.selected = !!data2.isSelected;
if (Reflect.has(data2, "int32Value")) {
this.value = data2.int32Value;
} else if (data2.stringValue) {
this.value = data2.stringValue;
}
if (Reflect.has(data2, "onSelectCommand")) {
this.endpoint = new NavigationEndpoint_default(data2.onSelectCommand);
}
if (Reflect.has(data2, "icon")) {
this.icon_type = data2.icon?.iconType;
}
if (Reflect.has(data2, "descriptionText")) {
this.description = new Text(data2.descriptionText);
}
}
};
__name(DropdownItem, "DropdownItem");
DropdownItem.type = "DropdownItem";
var DropdownItem_default = DropdownItem;
// dist/src/parser/classes/Dropdown.js
var Dropdown = class extends YTNode {
constructor(data2) {
super();
this.label = data2.label || "";
this.entries = parser_exports.parseArray(data2.entries, DropdownItem_default);
}
};
__name(Dropdown, "Dropdown");
Dropdown.type = "Dropdown";
var Dropdown_default = Dropdown;
// dist/src/parser/classes/CreatePlaylistDialog.js
var CreatePlaylistDialog = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.dialogTitle).toString();
this.title_placeholder = data2.titlePlaceholder || "";
this.privacy_option = parser_exports.parseItem(data2.privacyOption, Dropdown_default);
this.create_button = parser_exports.parseItem(data2.cancelButton, Button_default);
this.cancel_button = parser_exports.parseItem(data2.cancelButton, Button_default);
}
};
__name(CreatePlaylistDialog, "CreatePlaylistDialog");
CreatePlaylistDialog.type = "CreatePlaylistDialog";
var CreatePlaylistDialog_default = CreatePlaylistDialog;
// dist/src/parser/classes/NavigationEndpoint.js
var NavigationEndpoint = class extends YTNode {
constructor(data2) {
super();
if (data2) {
if (data2.serialCommand || data2.parallelCommand) {
const raw_command = data2.serialCommand || data2.parallelCommand;
this.commands = raw_command.commands.map((command) => new NavigationEndpoint(command));
}
if (data2.innertubeCommand || data2.command || data2.performOnceCommand) {
data2 = data2.innertubeCommand || data2.command || data2.performOnceCommand;
}
}
this.command = parser_exports.parseCommand(data2);
if (Reflect.has(data2 || {}, "openPopupAction"))
this.open_popup = new OpenPopupAction_default(data2.openPopupAction);
this.name = Object.keys(data2 || {}).find((item) => item.endsWith("Endpoint") || item.endsWith("Command"));
this.payload = this.name ? Reflect.get(data2, this.name) : {};
if (Reflect.has(this.payload, "dialog") || Reflect.has(this.payload, "content")) {
this.dialog = parser_exports.parseItem(this.payload.dialog || this.payload.content);
}
if (Reflect.has(this.payload, "modal")) {
this.modal = parser_exports.parseItem(this.payload.modal);
}
if (Reflect.has(this.payload, "nextEndpoint")) {
this.next_endpoint = new NavigationEndpoint(this.payload.nextEndpoint);
}
if (data2?.serviceEndpoint) {
data2 = data2.serviceEndpoint;
}
this.metadata = {};
if (data2?.commandMetadata?.webCommandMetadata?.url) {
this.metadata.url = data2.commandMetadata.webCommandMetadata.url;
}
if (data2?.commandMetadata?.webCommandMetadata?.webPageType) {
this.metadata.page_type = data2.commandMetadata.webCommandMetadata.webPageType;
}
if (data2?.commandMetadata?.webCommandMetadata?.apiUrl) {
this.metadata.api_url = data2.commandMetadata.webCommandMetadata.apiUrl.replace("/youtubei/v1/", "");
} else if (this.name) {
this.metadata.api_url = this.getPath(this.name);
}
if (data2?.commandMetadata?.webCommandMetadata?.sendPost) {
this.metadata.send_post = data2.commandMetadata.webCommandMetadata.sendPost;
}
if (data2?.createPlaylistEndpoint) {
if (data2?.createPlaylistEndpoint.createPlaylistDialog) {
this.dialog = parser_exports.parseItem(data2?.createPlaylistEndpoint.createPlaylistDialog, CreatePlaylistDialog_default);
}
}
}
getPath(name) {
switch (name) {
case "browseEndpoint":
return "/browse";
case "watchEndpoint":
case "reelWatchEndpoint":
return "/player";
case "searchEndpoint":
return "/search";
case "watchPlaylistEndpoint":
return "/next";
case "liveChatItemContextMenuEndpoint":
return "/live_chat/get_item_context_menu";
}
}
call(actions, args) {
if (!actions)
throw new Error("An API caller must be provided");
if (this.command) {
const command = this.command;
return actions.execute(command.getApiPath(), { ...command.buildRequest(), ...args });
}
if (!this.metadata.api_url)
throw new Error("Expected an api_url, but none was found.");
return actions.execute(this.metadata.api_url, { ...this.payload, ...args });
}
toURL() {
if (!this.metadata.url)
return void 0;
if (!this.metadata.page_type)
return void 0;
return this.metadata.page_type === "WEB_PAGE_TYPE_UNKNOWN" ? this.metadata.url : `https://www.youtube.com${this.metadata.url}`;
}
};
__name(NavigationEndpoint, "NavigationEndpoint");
NavigationEndpoint.type = "NavigationEndpoint";
var NavigationEndpoint_default = NavigationEndpoint;
// dist/src/parser/classes/misc/Thumbnail.js
var Thumbnail = class {
constructor(data2) {
this.url = data2.url;
this.width = data2.width;
this.height = data2.height;
}
static fromResponse(data2) {
if (!data2)
return [];
let thumbnail_data;
if (data2.thumbnails) {
thumbnail_data = data2.thumbnails;
} else if (data2.sources) {
thumbnail_data = data2.sources;
}
if (thumbnail_data) {
return thumbnail_data.map((x) => new Thumbnail(x)).sort((a, b) => b.width - a.width);
}
return [];
}
};
__name(Thumbnail, "Thumbnail");
// dist/src/parser/classes/misc/EmojiRun.js
var EmojiRun = class {
constructor(data2) {
this.text = data2.emoji?.emojiId || data2.emoji?.shortcuts?.[0] || data2.text || "";
this.emoji = {
emoji_id: data2.emoji.emojiId,
shortcuts: data2.emoji?.shortcuts || [],
search_terms: data2.emoji?.searchTerms || [],
image: Thumbnail.fromResponse(data2.emoji.image),
is_custom: !!data2.emoji?.isCustomEmoji
};
}
toString() {
return this.text;
}
toHTML() {
const escaped_text = escape(this.text);
return `<img src="${this.emoji.image[0].url}" alt="${escaped_text}" title="${escaped_text}" style="display: inline-block; vertical-align: text-top; height: var(--yt-emoji-size, 1rem); width: var(--yt-emoji-size, 1rem);" loading="lazy" crossorigin="anonymous" />`;
}
};
__name(EmojiRun, "EmojiRun");
// dist/src/parser/classes/misc/TextRun.js
var TextRun = class {
constructor(data2) {
this.text = data2.text;
this.bold = Boolean(data2.bold);
this.italics = Boolean(data2.italics);
this.strikethrough = Boolean(data2.strikethrough);
this.deemphasize = Boolean(data2.deemphasize);
if (Reflect.has(data2, "navigationEndpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
this.attachment = data2.attachment;
}
toString() {
return this.text;
}
toHTML() {
const tags = [];
if (this.bold)
tags.push("b");
if (this.italics)
tags.push("i");
if (this.strikethrough)
tags.push("s");
if (this.deemphasize)
tags.push("small");
if (!this.text?.length)
return "";
const escaped_text = escape(this.text);
const styled_text = tags.map((tag) => `<${tag}>`).join("") + escaped_text + tags.map((tag) => `</${tag}>`).join("");
const wrapped_text = `<span style="white-space: pre-wrap;">${styled_text}</span>`;
if (this.attachment) {
if (this.attachment.element.type.imageType.image.sources.length) {
if (this.endpoint) {
const { url } = this.attachment.element.type.imageType.image.sources[0];
let image_el = "";
if (url) {
image_el = `<img src="${url}" style="vertical-align: middle; height: ${this.attachment.element.properties.layoutProperties.height.value}px; width: ${this.attachment.element.properties.layoutProperties.width.value}px;" alt="">`;
}
const nav_url = this.endpoint.toURL();
if (nav_url)
return `<a href="${nav_url}" class="yt-ch-link">${image_el}${wrapped_text}</a>`;
}
}
}
if (this.endpoint) {
const url = this.endpoint.toURL();
if (url)
return `<a href="${url}">${wrapped_text}</a>`;
}
return wrapped_text;
}
};
__name(TextRun, "TextRun");
// dist/src/parser/classes/misc/Text.js
function escape(text) {
return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
}
__name(escape, "escape");
var TAG = "Text";
var Text = class {
constructor(data2) {
if (typeof data2 === "object" && data2 !== null && Reflect.has(data2, "runs") && Array.isArray(data2.runs)) {
this.runs = data2.runs.map((run) => run.emoji ? new EmojiRun(run) : new TextRun(run));
this.text = this.runs.map((run) => run.text).join("");
} else {
this.text = data2?.simpleText;
}
if (typeof data2 === "object" && data2 !== null && Reflect.has(data2, "navigationEndpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
if (typeof data2 === "object" && data2 !== null && Reflect.has(data2, "titleNavigationEndpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.titleNavigationEndpoint);
}
if (!this.endpoint) {
if (this.runs?.[0]?.endpoint) {
this.endpoint = this.runs?.[0]?.endpoint;
}
}
}
static fromAttributed(data2) {
const { content, commandRuns: command_runs, attachmentRuns: attachment_runs } = data2;
const runs = [
{
text: content,
startIndex: 0
}
];
const style_runs = data2.styleRuns?.map((run) => ({
...run,
startIndex: run.startIndex ?? 0,
length: run.length ?? content.length
}));
if (style_runs || command_runs || attachment_runs) {
if (style_runs) {
for (const style_run of style_runs) {
if (style_run.italic || style_run.strikethrough === "LINE_STYLE_SINGLE" || style_run.weightLabel === "FONT_WEIGHT_MEDIUM" || style_run.weightLabel === "FONT_WEIGHT_BOLD") {
const matching_run = findMatchingRun(runs, style_run);
if (!matching_run) {
Log_exports.warn(TAG, "Unable to find matching run for style run. Skipping...", {
style_run,
input_data: data2,
parsed_runs: JSON.parse(JSON.stringify(runs))
});
continue;
}
insertSubRun(runs, matching_run, style_run, {
bold: style_run.weightLabel === "FONT_WEIGHT_MEDIUM" || style_run.weightLabel === "FONT_WEIGHT_BOLD",
italics: style_run.italic,
strikethrough: style_run.strikethrough === "LINE_STYLE_SINGLE"
});
} else {
Log_exports.debug(TAG, "Skipping style run as it is doesn't have any information that we parse.", {
style_run,
input_data: data2
});
}
}
}
if (command_runs) {
for (const command_run of command_runs) {
if (command_run.onTap) {
const matching_run = findMatchingRun(runs, command_run);
if (!matching_run) {
Log_exports.warn(TAG, "Unable to find matching run for command run. Skipping...", {
command_run,
input_data: data2,
parsed_runs: JSON.parse(JSON.stringify(runs))
});
continue;
}
insertSubRun(runs, matching_run, command_run, {
navigationEndpoint: command_run.onTap
});
} else {
Log_exports.debug(TAG, 'Skipping command run as it is missing the "doTap" property.', {
command_run,
input_data: data2
});
}
}
}
if (attachment_runs) {
for (const attachment_run of attachment_runs) {
const matching_run = findMatchingRun(runs, attachment_run);
if (!matching_run) {
Log_exports.warn(TAG, "Unable to find matching run for attachment run. Skipping...", {
attachment_run,
input_data: data2,
parsed_runs: JSON.parse(JSON.stringify(runs))
});
continue;
}
if (attachment_run.length === 0) {
matching_run.attachment = attachment_run;
} else {
const offset_start_index = attachment_run.startIndex - matching_run.startIndex;
const text = matching_run.text.substring(offset_start_index, offset_start_index + attachment_run.length);
const is_custom_emoji = /^:[^:]+:$/.test(text);
if (attachment_run.element?.type?.imageType?.image && (is_custom_emoji || /^(?:\p{Emoji}|\u200d)+$/u.test(text))) {
const emoji = {
image: attachment_run.element.type.imageType.image,
isCustomEmoji: is_custom_emoji,
shortcuts: is_custom_emoji ? [text] : void 0
};
insertSubRun(runs, matching_run, attachment_run, { emoji });
} else {
insertSubRun(runs, matching_run, attachment_run, {
attachment: attachment_run
});
}
}
}
}
}
return new Text({ runs });
}
toHTML() {
return this.runs ? this.runs.map((run) => run.toHTML()).join("") : this.text;
}
isEmpty() {
return this.text === void 0;
}
toString() {
return this.text || "N/A";
}
};
__name(Text, "Text");
function findMatchingRun(runs, response_run) {
return runs.find((run) => {
return run.startIndex <= response_run.startIndex && response_run.startIndex + response_run.length <= run.startIndex + run.text.length;
});
}
__name(findMatchingRun, "findMatchingRun");
function insertSubRun(runs, original_run, response_run, properties_to_add) {
const replace_index = runs.indexOf(original_run);
const replacement_runs = [];
const offset_start_index = response_run.startIndex - original_run.startIndex;
if (response_run.startIndex > original_run.startIndex) {
replacement_runs.push({
...original_run,
text: original_run.text.substring(0, offset_start_index)
});
}
replacement_runs.push({
...original_run,
text: original_run.text.substring(offset_start_index, offset_start_index + response_run.length),
startIndex: response_run.startIndex,
...properties_to_add
});
if (response_run.startIndex + response_run.length < original_run.startIndex + original_run.text.length) {
replacement_runs.push({
...original_run,
text: original_run.text.substring(offset_start_index + response_run.length),
startIndex: response_run.startIndex + response_run.length
});
}
runs.splice(replace_index, 1, ...replacement_runs);
}
__name(insertSubRun, "insertSubRun");
// dist/src/parser/classes/ChannelExternalLinkView.js
var ChannelExternalLinkView = class extends YTNode {
constructor(data2) {
super();
this.title = Text.fromAttributed(data2.title);
this.link = Text.fromAttributed(data2.link);
this.favicon = Thumbnail.fromResponse(data2.favicon);
}
};
__name(ChannelExternalLinkView, "ChannelExternalLinkView");
ChannelExternalLinkView.type = "ChannelExternalLinkView";
var ChannelExternalLinkView_default = ChannelExternalLinkView;
// dist/src/parser/classes/AboutChannelView.js
var AboutChannelView = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "description")) {
this.description = data2.description;
}
if (Reflect.has(data2, "descriptionLabel")) {
this.description_label = Text.fromAttributed(data2.descriptionLabel);
}
if (Reflect.has(data2, "country")) {
this.country = data2.country;
}
if (Reflect.has(data2, "customLinksLabel")) {
this.custom_links_label = Text.fromAttributed(data2.customLinksLabel);
}
if (Reflect.has(data2, "subscriberCountText")) {
this.subscriber_count = data2.subscriberCountText;
}
if (Reflect.has(data2, "viewCountText")) {
this.view_count = data2.viewCountText;
}
if (Reflect.has(data2, "joinedDateText")) {
this.joined_date = Text.fromAttributed(data2.joinedDateText);
}
if (Reflect.has(data2, "canonicalChannelUrl")) {
this.canonical_channel_url = data2.canonicalChannelUrl;
}
if (Reflect.has(data2, "channelId")) {
this.channel_id = data2.channelId;
}
if (Reflect.has(data2, "additionalInfoLabel")) {
this.additional_info_label = Text.fromAttributed(data2.additionalInfoLabel);
}
if (Reflect.has(data2, "customUrlOnTap")) {
this.custom_url_on_tap = new NavigationEndpoint_default(data2.customUrlOnTap);
}
if (Reflect.has(data2, "videoCountText")) {
this.video_count = data2.videoCountText;
}
if (Reflect.has(data2, "signInForBusinessEmail")) {
this.sign_in_for_business_email = Text.fromAttributed(data2.signInForBusinessEmail);
}
if (Reflect.has(data2, "links")) {
this.links = parser_exports.parseArray(data2.links, ChannelExternalLinkView_default);
} else {
this.links = [];
}
}
};
__name(AboutChannelView, "AboutChannelView");
AboutChannelView.type = "AboutChannelView";
var AboutChannelView_default = AboutChannelView;
// dist/src/parser/classes/AboutChannel.js
var AboutChannel = class extends YTNode {
constructor(data2) {
super();
this.metadata = parser_exports.parseItem(data2.metadata, AboutChannelView_default);
this.share_channel = parser_exports.parseItem(data2.shareChannel, Button_default);
}
};
__name(AboutChannel, "AboutChannel");
AboutChannel.type = "AboutChannel";
var AboutChannel_default = AboutChannel;
// dist/src/parser/classes/AccountChannel.js
var AccountChannel = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
};
__name(AccountChannel, "AccountChannel");
AccountChannel.type = "AccountChannel";
var AccountChannel_default = AccountChannel;
// dist/src/parser/classes/AccountItem.js
var AccountItem = class extends YTNode {
constructor(data2) {
super();
this.account_name = new Text(data2.accountName);
this.account_photo = Thumbnail.fromResponse(data2.accountPhoto);
this.is_selected = !!data2.isSelected;
this.is_disabled = !!data2.isDisabled;
this.has_channel = !!data2.hasChannel;
this.endpoint = new NavigationEndpoint_default(data2.serviceEndpoint);
this.account_byline = new Text(data2.accountByline);
this.channel_handle = new Text(data2.channelHandle);
}
};
__name(AccountItem, "AccountItem");
AccountItem.type = "AccountItem";
var AccountItem_default = AccountItem;
// dist/src/parser/classes/AccountItemSectionHeader.js
var AccountItemSectionHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
}
};
__name(AccountItemSectionHeader, "AccountItemSectionHeader");
AccountItemSectionHeader.type = "AccountItemSectionHeader";
var AccountItemSectionHeader_default = AccountItemSectionHeader;
// dist/src/parser/classes/CompactLink.js
var CompactLink = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title).toString();
if ("subtitle" in data2)
this.subtitle = new Text(data2.subtitle);
if ("icon" in data2 && "iconType" in data2.icon)
this.icon_type = data2.icon.iconType;
if ("secondaryIcon" in data2 && "iconType" in data2.secondaryIcon)
this.secondary_icon_type = data2.secondaryIcon.iconType;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint || data2.serviceEndpoint);
this.style = data2.style;
}
};
__name(CompactLink, "CompactLink");
CompactLink.type = "CompactLink";
var CompactLink_default = CompactLink;
// dist/src/parser/classes/AccountItemSection.js
var AccountItemSection = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents, [AccountItem_default, CompactLink_default]);
this.header = parser_exports.parseItem(data2.header, AccountItemSectionHeader_default);
}
};
__name(AccountItemSection, "AccountItemSection");
AccountItemSection.type = "AccountItemSection";
var AccountItemSection_default = AccountItemSection;
// dist/src/parser/classes/AccountSectionList.js
var AccountSectionList = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents, AccountItemSection_default);
this.footers = parser_exports.parseArray(data2.footers, AccountChannel_default);
}
};
__name(AccountSectionList, "AccountSectionList");
AccountSectionList.type = "AccountSectionList";
var AccountSectionList_default = AccountSectionList;
// dist/src/parser/classes/actions/AppendContinuationItemsAction.js
var AppendContinuationItemsAction = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.continuationItems);
this.target = data2.target;
}
};
__name(AppendContinuationItemsAction, "AppendContinuationItemsAction");
AppendContinuationItemsAction.type = "AppendContinuationItemsAction";
var AppendContinuationItemsAction_default = AppendContinuationItemsAction;
// dist/src/parser/classes/actions/ChangeEngagementPanelVisibilityAction.js
var ChangeEngagementPanelVisibilityAction = class extends YTNode {
constructor(data2) {
super();
this.target_id = data2.targetId;
this.visibility = data2.visibility;
}
};
__name(ChangeEngagementPanelVisibilityAction, "ChangeEngagementPanelVisibilityAction");
ChangeEngagementPanelVisibilityAction.type = "ChangeEngagementPanelVisibilityAction";
var ChangeEngagementPanelVisibilityAction_default = ChangeEngagementPanelVisibilityAction;
// dist/src/parser/classes/menus/MultiPageMenu.js
var MultiPageMenu = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header);
this.sections = parser_exports.parseArray(data2.sections);
this.style = data2.style;
}
};
__name(MultiPageMenu, "MultiPageMenu");
MultiPageMenu.type = "MultiPageMenu";
var MultiPageMenu_default = MultiPageMenu;
// dist/src/parser/classes/actions/GetMultiPageMenuAction.js
var GetMultiPageMenuAction = class extends YTNode {
constructor(data2) {
super();
this.menu = parser_exports.parseItem(data2.menu, MultiPageMenu_default);
}
};
__name(GetMultiPageMenuAction, "GetMultiPageMenuAction");
GetMultiPageMenuAction.type = "GetMultiPageMenuAction";
var GetMultiPageMenuAction_default = GetMultiPageMenuAction;
// dist/src/parser/classes/actions/SendFeedbackAction.js
var SendFeedbackAction = class extends YTNode {
constructor(data2) {
super();
this.bucket = data2.bucket;
}
};
__name(SendFeedbackAction, "SendFeedbackAction");
SendFeedbackAction.type = "SendFeedbackAction";
var SendFeedbackAction_default = SendFeedbackAction;
// dist/src/parser/classes/actions/SignalAction.js
var SignalAction = class extends YTNode {
constructor(data2) {
super();
this.signal = data2.signal;
}
};
__name(SignalAction, "SignalAction");
SignalAction.type = "SignalAction";
var SignalAction_default = SignalAction;
// dist/src/parser/classes/ChannelSwitcherPage.js
var ChannelSwitcherPage = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header);
this.contents = parser_exports.parse(data2.contents, true);
}
};
__name(ChannelSwitcherPage, "ChannelSwitcherPage");
ChannelSwitcherPage.type = "ChannelSwitcherPage";
var ChannelSwitcherPage_default = ChannelSwitcherPage;
// dist/src/parser/classes/actions/UpdateChannelSwitcherPageAction.js
var UpdateChannelSwitcherPageAction = class extends YTNode {
constructor(data2) {
super();
const page = parser_exports.parseItem(data2.page, ChannelSwitcherPage_default);
if (page) {
this.header = page.header;
this.contents = page.contents;
}
}
};
__name(UpdateChannelSwitcherPageAction, "UpdateChannelSwitcherPageAction");
UpdateChannelSwitcherPageAction.type = "UpdateChannelSwitcherPageAction";
var UpdateChannelSwitcherPageAction_default = UpdateChannelSwitcherPageAction;
// dist/src/parser/classes/SortFilterSubMenu.js
var SortFilterSubMenu = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "title")) {
this.title = data2.title;
}
if (Reflect.has(data2, "icon")) {
this.icon_type = data2.icon.iconType;
}
if (Reflect.has(data2, "accessibility")) {
this.label = data2.accessibility.accessibilityData.label;
}
if (Reflect.has(data2, "tooltip")) {
this.tooltip = data2.tooltip;
}
if (Reflect.has(data2, "subMenuItems")) {
this.sub_menu_items = data2.subMenuItems.map((item) => ({
title: item.title,
selected: item.selected,
continuation: item.continuation?.reloadContinuationData?.continuation,
endpoint: new NavigationEndpoint_default(item.serviceEndpoint || item.navigationEndpoint),
subtitle: item.subtitle || null
}));
}
}
};
__name(SortFilterSubMenu, "SortFilterSubMenu");
SortFilterSubMenu.type = "SortFilterSubMenu";
var SortFilterSubMenu_default = SortFilterSubMenu;
// dist/src/parser/classes/TranscriptFooter.js
var TranscriptFooter = class extends YTNode {
constructor(data2) {
super();
this.language_menu = parser_exports.parseItem(data2.languageMenu, SortFilterSubMenu_default);
}
};
__name(TranscriptFooter, "TranscriptFooter");
TranscriptFooter.type = "TranscriptFooter";
var TranscriptFooter_default = TranscriptFooter;
// dist/src/parser/classes/TranscriptSearchBox.js
var TranscriptSearchBox = class extends YTNode {
constructor(data2) {
super();
this.formatted_placeholder = new Text(data2.formattedPlaceholder);
this.clear_button = parser_exports.parseItem(data2.clearButton, Button_default);
this.endpoint = new NavigationEndpoint_default(data2.onTextChangeCommand);
this.search_button = parser_exports.parseItem(data2.searchButton, Button_default);
}
};
__name(TranscriptSearchBox, "TranscriptSearchBox");
TranscriptSearchBox.type = "TranscriptSearchBox";
var TranscriptSearchBox_default = TranscriptSearchBox;
// dist/src/parser/classes/TranscriptSectionHeader.js
var TranscriptSectionHeader = class extends YTNode {
constructor(data2) {
super();
this.start_ms = data2.startMs;
this.end_ms = data2.endMs;
this.snippet = new Text(data2.snippet);
}
};
__name(TranscriptSectionHeader, "TranscriptSectionHeader");
TranscriptSectionHeader.type = "TranscriptSectionHeader";
var TranscriptSectionHeader_default = TranscriptSectionHeader;
// dist/src/parser/classes/TranscriptSegment.js
var TranscriptSegment = class extends YTNode {
constructor(data2) {
super();
this.start_ms = data2.startMs;
this.end_ms = data2.endMs;
this.snippet = new Text(data2.snippet);
this.start_time_text = new Text(data2.startTimeText);
this.target_id = data2.targetId;
}
};
__name(TranscriptSegment, "TranscriptSegment");
TranscriptSegment.type = "TranscriptSegment";
var TranscriptSegment_default = TranscriptSegment;
// dist/src/parser/classes/TranscriptSegmentList.js
var TranscriptSegmentList = class extends YTNode {
constructor(data2) {
super();
this.initial_segments = parser_exports.parseArray(data2.initialSegments, [TranscriptSegment_default, TranscriptSectionHeader_default]);
this.no_result_label = new Text(data2.noResultLabel);
this.retry_label = new Text(data2.retryLabel);
this.touch_captions_enabled = data2.touchCaptionsEnabled;
}
};
__name(TranscriptSegmentList, "TranscriptSegmentList");
TranscriptSegmentList.type = "TranscriptSegmentList";
var TranscriptSegmentList_default = TranscriptSegmentList;
// dist/src/parser/classes/TranscriptSearchPanel.js
var TranscriptSearchPanel = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header, TranscriptSearchBox_default);
this.body = parser_exports.parseItem(data2.body, TranscriptSegmentList_default);
this.footer = parser_exports.parseItem(data2.footer, TranscriptFooter_default);
this.target_id = data2.targetId;
}
};
__name(TranscriptSearchPanel, "TranscriptSearchPanel");
TranscriptSearchPanel.type = "TranscriptSearchPanel";
var TranscriptSearchPanel_default = TranscriptSearchPanel;
// dist/src/parser/classes/Transcript.js
var Transcript = class extends YTNode {
constructor(data2) {
super();
this.content = parser_exports.parseItem(data2.content, TranscriptSearchPanel_default);
}
};
__name(Transcript, "Transcript");
Transcript.type = "Transcript";
var Transcript_default = Transcript;
// dist/src/parser/classes/actions/UpdateEngagementPanelAction.js
var UpdateEngagementPanelAction = class extends YTNode {
constructor(data2) {
super();
this.target_id = data2.targetId;
this.content = parser_exports.parseItem(data2.content, Transcript_default);
}
};
__name(UpdateEngagementPanelAction, "UpdateEngagementPanelAction");
UpdateEngagementPanelAction.type = "UpdateEngagementPanelAction";
var UpdateEngagementPanelAction_default = UpdateEngagementPanelAction;
// dist/src/parser/classes/actions/UpdateSubscribeButtonAction.js
var UpdateSubscribeButtonAction = class extends YTNode {
constructor(data2) {
super();
this.channel_id = data2.channelId;
this.subscribed = data2.subscribed;
}
};
__name(UpdateSubscribeButtonAction, "UpdateSubscribeButtonAction");
UpdateSubscribeButtonAction.type = "UpdateSubscribeButtonAction";
var UpdateSubscribeButtonAction_default = UpdateSubscribeButtonAction;
// dist/src/parser/classes/ActiveAccountHeader.js
var ActiveAccountHeader = class extends YTNode {
constructor(data2) {
super();
this.account_name = new Text(data2.accountName);
this.account_photo = Thumbnail.fromResponse(data2.accountPhoto);
this.endpoint = new NavigationEndpoint_default(data2.serviceEndpoint);
this.manage_account_title = new Text(data2.manageAccountTitle);
this.channel_handle = new Text(data2.channelHandle);
}
};
__name(ActiveAccountHeader, "ActiveAccountHeader");
ActiveAccountHeader.type = "ActiveAccountHeader";
var ActiveAccountHeader_default = ActiveAccountHeader;
// dist/src/parser/classes/MenuTitle.js
var MenuTitle = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
}
};
__name(MenuTitle, "MenuTitle");
MenuTitle.type = "MenuTitle";
var MenuTitle_default = MenuTitle;
// dist/src/parser/classes/PlaylistAddToOption.js
var PlaylistAddToOption = class extends YTNode {
constructor(data2) {
super();
this.add_to_playlist_service_endpoint = new NavigationEndpoint_default(data2.addToPlaylistServiceEndpoint);
this.contains_selected_videos = data2.containsSelectedVideos;
this.playlist_id = data2.playlistId;
this.privacy = data2.privacy;
this.privacy_icon = { icon_type: data2.privacyIcon?.iconType || null };
this.remove_from_playlist_service_endpoint = new NavigationEndpoint_default(data2.removeFromPlaylistServiceEndpoint);
this.title = new Text(data2.title);
}
};
__name(PlaylistAddToOption, "PlaylistAddToOption");
PlaylistAddToOption.type = "PlaylistAddToOption";
var PlaylistAddToOption_default = PlaylistAddToOption;
// dist/src/parser/classes/AddToPlaylist.js
var AddToPlaylist = class extends YTNode {
constructor(data2) {
super();
this.actions = parser_exports.parseArray(data2.actions, [MenuTitle_default, Button_default]);
this.playlists = parser_exports.parseArray(data2.playlists, PlaylistAddToOption_default);
}
};
__name(AddToPlaylist, "AddToPlaylist");
AddToPlaylist.type = "AddToPlaylist";
var AddToPlaylist_default = AddToPlaylist;
// dist/src/parser/classes/Alert.js
var Alert = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text);
this.alert_type = data2.type;
}
};
__name(Alert, "Alert");
Alert.type = "Alert";
var Alert_default = Alert;
// dist/src/parser/classes/AlertWithButton.js
var AlertWithButton = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text);
this.alert_type = data2.type;
this.dismiss_button = parser_exports.parseItem(data2.dismissButton, Button_default);
}
};
__name(AlertWithButton, "AlertWithButton");
AlertWithButton.type = "AlertWithButton";
var AlertWithButton_default = AlertWithButton;
// dist/src/parser/classes/AnimatedThumbnailOverlayView.js
var AnimatedThumbnailOverlayView = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
}
};
__name(AnimatedThumbnailOverlayView, "AnimatedThumbnailOverlayView");
AnimatedThumbnailOverlayView.type = "AnimatedThumbnailOverlayView";
var AnimatedThumbnailOverlayView_default = AnimatedThumbnailOverlayView;
// dist/src/parser/classes/AttributionView.js
var AttributionView = class extends YTNode {
constructor(data2) {
super();
this.text = Text.fromAttributed(data2.text);
this.suffix = Text.fromAttributed(data2.suffix);
}
};
__name(AttributionView, "AttributionView");
AttributionView.type = "AttributionView";
var AttributionView_default = AttributionView;
// dist/src/parser/classes/AudioOnlyPlayability.js
var AudioOnlyPlayability = class extends YTNode {
constructor(data2) {
super();
this.audio_only_availability = data2.audioOnlyAvailability;
}
};
__name(AudioOnlyPlayability, "AudioOnlyPlayability");
AudioOnlyPlayability.type = "AudioOnlyPlayability";
var AudioOnlyPlayability_default = AudioOnlyPlayability;
// dist/src/parser/classes/AutomixPreviewVideo.js
var AutomixPreviewVideo = class extends YTNode {
constructor(data2) {
super();
if (data2?.content?.automixPlaylistVideoRenderer?.navigationEndpoint) {
this.playlist_video = {
endpoint: new NavigationEndpoint_default(data2.content.automixPlaylistVideoRenderer.navigationEndpoint)
};
}
}
};
__name(AutomixPreviewVideo, "AutomixPreviewVideo");
AutomixPreviewVideo.type = "AutomixPreviewVideo";
var AutomixPreviewVideo_default = AutomixPreviewVideo;
// dist/src/parser/classes/AvatarView.js
var AvatarView = class extends YTNode {
constructor(data2) {
super();
this.image = Thumbnail.fromResponse(data2.image);
this.avatar_image_size = data2.avatarImageSize;
if (data2.image.processor) {
this.image_processor = {
border_image_processor: {
circular: data2.image.processor.borderImageProcessor.circular
}
};
}
}
};
__name(AvatarView, "AvatarView");
AvatarView.type = "AvatarView";
var AvatarView_default = AvatarView;
// dist/src/parser/classes/misc/RendererContext.js
var RendererContext = class {
constructor(data2) {
this.command_context = {};
this.accessibility_context = {};
if (!data2)
return;
if (Reflect.has(data2, "commandContext")) {
if (Reflect.has(data2.commandContext, "onTap")) {
this.command_context.on_tap = new NavigationEndpoint_default(data2.commandContext.onTap);
}
}
if (Reflect.has(data2, "accessibilityContext")) {
if (Reflect.has(data2.accessibilityContext, "label")) {
this.accessibility_context.label = data2.accessibilityContext.label;
}
}
}
};
__name(RendererContext, "RendererContext");
// dist/src/parser/classes/AvatarStackView.js
var AvatarStackView = class extends YTNode {
constructor(data2) {
super();
this.avatars = parser_exports.parseArray(data2.avatars, AvatarView_default);
if (Reflect.has(data2, "text"))
this.text = Text.fromAttributed(data2.text);
this.renderer_context = new RendererContext(data2.rendererContext);
}
};
__name(AvatarStackView, "AvatarStackView");
AvatarStackView.type = "AvatarStackView";
var AvatarStackView_default = AvatarStackView;
// dist/src/parser/classes/ButtonView.js
var ButtonView = class extends YTNode {
constructor(data2) {
super();
this.icon_name = data2.iconName;
this.title = data2.title;
this.accessibility_text = data2.accessibilityText;
this.style = data2.style;
this.is_full_width = data2.isFullWidth;
this.button_type = data2.type;
this.button_size = data2.buttonSize;
this.on_tap = new NavigationEndpoint_default(data2.onTap);
}
};
__name(ButtonView, "ButtonView");
ButtonView.type = "ButtonView";
var ButtonView_default = ButtonView;
// dist/src/parser/classes/BackgroundPromo.js
var BackgroundPromo = class extends YTNode {
constructor(data2) {
super();
this.body_text = new Text(data2.bodyText);
this.cta_button = parser_exports.parseItem(data2.ctaButton, [Button_default, ButtonView_default]);
if (Reflect.has(data2, "icon"))
this.icon_type = data2.icon.iconType;
this.title = new Text(data2.title);
}
};
__name(BackgroundPromo, "BackgroundPromo");
BackgroundPromo.type = "BackgroundPromo";
var BackgroundPromo_default = BackgroundPromo;
// dist/src/parser/classes/BackstageImage.js
var BackstageImage = class extends YTNode {
constructor(data2) {
super();
this.image = Thumbnail.fromResponse(data2.image);
this.endpoint = new NavigationEndpoint_default(data2.command);
}
};
__name(BackstageImage, "BackstageImage");
BackstageImage.type = "BackstageImage";
var BackstageImage_default = BackstageImage;
// dist/src/parser/classes/ToggleButton.js
var ToggleButton = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.defaultText);
this.toggled_text = new Text(data2.toggledText);
this.tooltip = data2.defaultTooltip;
this.toggled_tooltip = data2.toggledTooltip;
this.is_toggled = data2.isToggled;
this.is_disabled = data2.isDisabled;
this.icon_type = data2.defaultIcon?.iconType;
const acc_label = data2?.defaultText?.accessibility?.accessibilityData?.label || data2?.accessibilityData?.accessibilityData?.label || data2?.accessibility?.label;
if (this.icon_type == "LIKE") {
this.like_count = parseInt(acc_label.replace(/\D/g, ""));
this.short_like_count = new Text(data2.defaultText).toString();
}
this.endpoint = data2.defaultServiceEndpoint?.commandExecutorCommand?.commands ? new NavigationEndpoint_default(data2.defaultServiceEndpoint.commandExecutorCommand.commands.pop()) : new NavigationEndpoint_default(data2.defaultServiceEndpoint);
this.toggled_endpoint = new NavigationEndpoint_default(data2.toggledServiceEndpoint);
if (Reflect.has(data2, "toggleButtonSupportedData") && Reflect.has(data2.toggleButtonSupportedData, "toggleButtonIdData")) {
this.button_id = data2.toggleButtonSupportedData.toggleButtonIdData.id;
}
if (Reflect.has(data2, "targetId")) {
this.target_id = data2.targetId;
}
}
};
__name(ToggleButton, "ToggleButton");
ToggleButton.type = "ToggleButton";
var ToggleButton_default = ToggleButton;
// dist/src/parser/classes/comments/CreatorHeart.js
var CreatorHeart = class extends YTNode {
constructor(data2) {
super();
this.creator_thumbnail = Thumbnail.fromResponse(data2.creatorThumbnail);
if (Reflect.has(data2, "heartIcon") && Reflect.has(data2.heartIcon, "iconType")) {
this.heart_icon_type = data2.heartIcon.iconType;
}
this.heart_color = {
basic_color_palette_data: {
foreground_title_color: data2.heartColor?.basicColorPaletteData?.foregroundTitleColor
}
};
this.hearted_tooltip = data2.heartedTooltip;
this.is_hearted = data2.isHearted;
this.is_enabled = data2.isEnabled;
this.kennedy_heart_color_string = data2.kennedyHeartColorString;
}
};
__name(CreatorHeart, "CreatorHeart");
CreatorHeart.type = "CreatorHeart";
var CreatorHeart_default = CreatorHeart;
// dist/src/parser/classes/comments/CommentActionButtons.js
var CommentActionButtons = class extends YTNode {
constructor(data2) {
super();
this.like_button = parser_exports.parseItem(data2.likeButton, ToggleButton_default);
this.dislike_button = parser_exports.parseItem(data2.dislikeButton, ToggleButton_default);
this.reply_button = parser_exports.parseItem(data2.replyButton, Button_default);
this.creator_heart = parser_exports.parseItem(data2.creatorHeart, CreatorHeart_default);
}
};
__name(CommentActionButtons, "CommentActionButtons");
CommentActionButtons.type = "CommentActionButtons";
var CommentActionButtons_default = CommentActionButtons;
// dist/src/parser/classes/ToggleButtonView.js
var ToggleButtonView = class extends YTNode {
constructor(data2) {
super();
this.default_button = parser_exports.parseItem(data2.defaultButtonViewModel, ButtonView_default);
this.toggled_button = parser_exports.parseItem(data2.toggledButtonViewModel, ButtonView_default);
this.is_toggling_disabled = data2.isTogglingDisabled;
this.identifier = data2.identifier;
if (Reflect.has(data2, "isToggled")) {
this.is_toggled = data2.isToggled;
}
}
};
__name(ToggleButtonView, "ToggleButtonView");
ToggleButtonView.type = "ToggleButtonView";
var ToggleButtonView_default = ToggleButtonView;
// dist/src/parser/classes/LikeButtonView.js
var LikeButtonView = class extends YTNode {
constructor(data2) {
super();
this.toggle_button = parser_exports.parseItem(data2.toggleButtonViewModel, ToggleButtonView_default);
this.like_status_entity_key = data2.likeStatusEntityKey;
this.like_status_entity = {
key: data2.likeStatusEntity.key,
like_status: data2.likeStatusEntity.likeStatus
};
}
};
__name(LikeButtonView, "LikeButtonView");
LikeButtonView.type = "LikeButtonView";
var LikeButtonView_default = LikeButtonView;
// dist/src/parser/classes/DislikeButtonView.js
var DislikeButtonView = class extends YTNode {
constructor(data2) {
super();
this.toggle_button = parser_exports.parseItem(data2.toggleButtonViewModel, ToggleButtonView_default);
this.dislike_entity_key = data2.dislikeEntityKey;
}
};
__name(DislikeButtonView, "DislikeButtonView");
DislikeButtonView.type = "DislikeButtonView";
var DislikeButtonView_default = DislikeButtonView;
// dist/src/parser/classes/SegmentedLikeDislikeButtonView.js
var SegmentedLikeDislikeButtonView = class extends YTNode {
constructor(data2) {
super();
this.like_button = parser_exports.parseItem(data2.likeButtonViewModel, LikeButtonView_default);
this.dislike_button = parser_exports.parseItem(data2.dislikeButtonViewModel, DislikeButtonView_default);
this.icon_type = data2.iconType;
if (this.like_button && this.like_button.toggle_button) {
const toggle_button = this.like_button.toggle_button;
if (toggle_button.default_button) {
this.short_like_count = toggle_button.default_button.title;
this.like_count = parseInt(toggle_button.default_button.accessibility_text.replace(/\D/g, ""));
} else if (toggle_button.toggled_button) {
this.short_like_count = toggle_button.toggled_button.title;
this.like_count = parseInt(toggle_button.toggled_button.accessibility_text.replace(/\D/g, ""));
}
}
this.like_count_entity = {
key: data2.likeCountEntity.key
};
this.dynamic_like_count_update_data = {
update_status_key: data2.dynamicLikeCountUpdateData.updateStatusKey,
placeholder_like_count_values_key: data2.dynamicLikeCountUpdateData.placeholderLikeCountValuesKey,
update_delay_loop_id: data2.dynamicLikeCountUpdateData.updateDelayLoopId,
update_delay_sec: data2.dynamicLikeCountUpdateData.updateDelaySec
};
}
};
__name(SegmentedLikeDislikeButtonView, "SegmentedLikeDislikeButtonView");
SegmentedLikeDislikeButtonView.type = "SegmentedLikeDislikeButtonView";
var SegmentedLikeDislikeButtonView_default = SegmentedLikeDislikeButtonView;
// dist/src/parser/classes/menus/MenuServiceItem.js
var MenuServiceItem = class extends Button_default {
constructor(data2) {
super(data2);
}
};
__name(MenuServiceItem, "MenuServiceItem");
MenuServiceItem.type = "MenuServiceItem";
var MenuServiceItem_default = MenuServiceItem;
// dist/src/parser/classes/DownloadButton.js
var DownloadButton = class extends YTNode {
constructor(data2) {
super();
this.style = data2.style;
this.size = data2.size;
this.endpoint = new NavigationEndpoint_default(data2.command);
this.target_id = data2.targetId;
}
};
__name(DownloadButton, "DownloadButton");
DownloadButton.type = "DownloadButton";
var DownloadButton_default = DownloadButton;
// dist/src/parser/classes/menus/MenuServiceItemDownload.js
var MenuServiceItemDownload = class extends YTNode {
constructor(data2) {
super();
this.has_separator = !!data2.hasSeparator;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint || data2.serviceEndpoint);
}
};
__name(MenuServiceItemDownload, "MenuServiceItemDownload");
MenuServiceItemDownload.type = "MenuServiceItemDownload";
var MenuServiceItemDownload_default = MenuServiceItemDownload;
// dist/src/parser/classes/menus/MenuFlexibleItem.js
var MenuFlexibleItem = class extends YTNode {
constructor(data2) {
super();
this.menu_item = parser_exports.parseItem(data2.menuItem, [MenuServiceItem_default, MenuServiceItemDownload_default]);
this.top_level_button = parser_exports.parseItem(data2.topLevelButton, [DownloadButton_default, ButtonView_default, Button_default]);
}
};
__name(MenuFlexibleItem, "MenuFlexibleItem");
MenuFlexibleItem.type = "MenuFlexibleItem";
var MenuFlexibleItem_default = MenuFlexibleItem;
// dist/src/parser/classes/LikeButton.js
var LikeButton = class extends YTNode {
constructor(data2) {
super();
this.target = {
video_id: data2.target.videoId
};
this.like_status = data2.likeStatus;
this.likes_allowed = data2.likesAllowed;
if (Reflect.has(data2, "serviceEndpoints")) {
this.endpoints = data2.serviceEndpoints.map((endpoint) => new NavigationEndpoint_default(endpoint));
}
}
};
__name(LikeButton, "LikeButton");
LikeButton.type = "LikeButton";
var LikeButton_default = LikeButton;
// dist/src/parser/classes/FlexibleActionsView.js
var FlexibleActionsView = class extends YTNode {
constructor(data2) {
super();
this.actions_rows = data2.actionsRows.map((row) => ({
actions: parser_exports.parseArray(row.actions, [ButtonView_default, ToggleButtonView_default])
}));
this.style = data2.style;
}
};
__name(FlexibleActionsView, "FlexibleActionsView");
FlexibleActionsView.type = "FlexibleActionsView";
var FlexibleActionsView_default = FlexibleActionsView;
// dist/src/parser/classes/menus/Menu.js
var Menu = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
this.flexible_items = parser_exports.parseArray(data2.flexibleItems, MenuFlexibleItem_default);
this.top_level_buttons = parser_exports.parseArray(data2.topLevelButtons, [ToggleButton_default, LikeButton_default, Button_default, ButtonView_default, SegmentedLikeDislikeButtonView_default, FlexibleActionsView_default]);
if (Reflect.has(data2, "accessibility") && Reflect.has(data2.accessibility, "accessibilityData")) {
this.label = data2.accessibility.accessibilityData.label;
}
}
get contents() {
return this.items;
}
};
__name(Menu, "Menu");
Menu.type = "Menu";
var Menu_default = Menu;
// dist/src/parser/classes/BackstagePost.js
var BackstagePost = class extends YTNode {
constructor(data2) {
super();
this.id = data2.postId;
this.author = new Author({
...data2.authorText,
navigationEndpoint: data2.authorEndpoint
}, null, data2.authorThumbnail);
this.content = new Text(data2.contentText);
this.published = new Text(data2.publishedTimeText);
if (Reflect.has(data2, "pollStatus")) {
this.poll_status = data2.pollStatus;
}
if (Reflect.has(data2, "voteStatus")) {
this.vote_status = data2.voteStatus;
}
if (Reflect.has(data2, "voteCount")) {
this.vote_count = new Text(data2.voteCount);
}
if (Reflect.has(data2, "actionMenu")) {
this.menu = parser_exports.parseItem(data2.actionMenu, Menu_default);
}
if (Reflect.has(data2, "actionButtons")) {
this.action_buttons = parser_exports.parseItem(data2.actionButtons, CommentActionButtons_default);
}
if (Reflect.has(data2, "voteButton")) {
this.vote_button = parser_exports.parseItem(data2.voteButton, Button_default);
}
if (Reflect.has(data2, "navigationEndpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
if (Reflect.has(data2, "backstageAttachment")) {
this.attachment = parser_exports.parseItem(data2.backstageAttachment);
}
this.surface = data2.surface;
}
};
__name(BackstagePost, "BackstagePost");
BackstagePost.type = "BackstagePost";
var BackstagePost_default = BackstagePost;
// dist/src/parser/classes/BackstagePostThread.js
var BackstagePostThread = class extends YTNode {
constructor(data2) {
super();
this.post = parser_exports.parseItem(data2.post);
}
};
__name(BackstagePostThread, "BackstagePostThread");
BackstagePostThread.type = "BackstagePostThread";
var BackstagePostThread_default = BackstagePostThread;
// dist/src/parser/classes/BadgeView.js
var BadgeView = class extends YTNode {
constructor(data2) {
super();
this.text = data2.badgeText;
this.style = data2.badgeStyle;
this.accessibility_label = data2.accessibilityLabel;
}
};
__name(BadgeView, "BadgeView");
// dist/src/parser/classes/BrowseFeedActions.js
var BrowseFeedActions = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents);
}
};
__name(BrowseFeedActions, "BrowseFeedActions");
BrowseFeedActions.type = "BrowseFeedActions";
var BrowseFeedActions_default = BrowseFeedActions;
// dist/src/parser/classes/BrowserMediaSession.js
var BrowserMediaSession = class extends YTNode {
constructor(data2) {
super();
this.album = new Text(data2.album);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnailDetails);
}
};
__name(BrowserMediaSession, "BrowserMediaSession");
BrowserMediaSession.type = "BrowserMediaSession";
var BrowserMediaSession_default = BrowserMediaSession;
// dist/src/parser/classes/ButtonCardView.js
var ButtonCardView = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title;
this.icon_name = data2.image.sources[0].clientResource.imageName;
this.renderer_context = new RendererContext(data2.rendererContext);
}
};
__name(ButtonCardView, "ButtonCardView");
ButtonCardView.type = "ButtonCardView";
var ButtonCardView_default = ButtonCardView;
// dist/src/parser/classes/ChannelHeaderLinks.js
var HeaderLink = class extends YTNode {
constructor(data2) {
super();
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.icon = Thumbnail.fromResponse(data2.icon);
this.title = new Text(data2.title);
}
};
__name(HeaderLink, "HeaderLink");
HeaderLink.type = "HeaderLink";
var ChannelHeaderLinks = class extends YTNode {
constructor(data2) {
super();
this.primary = observe(data2.primaryLinks?.map((link) => new HeaderLink(link)) || []);
this.secondary = observe(data2.secondaryLinks?.map((link) => new HeaderLink(link)) || []);
}
};
__name(ChannelHeaderLinks, "ChannelHeaderLinks");
ChannelHeaderLinks.type = "ChannelHeaderLinks";
var ChannelHeaderLinks_default = ChannelHeaderLinks;
// dist/src/parser/classes/ChannelHeaderLinksView.js
var ChannelHeaderLinksView = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "firstLink")) {
this.first_link = Text.fromAttributed(data2.firstLink);
}
if (Reflect.has(data2, "more")) {
this.more = Text.fromAttributed(data2.more);
}
}
};
__name(ChannelHeaderLinksView, "ChannelHeaderLinksView");
ChannelHeaderLinksView.type = "ChannelHeaderLinksView";
var ChannelHeaderLinksView_default = ChannelHeaderLinksView;
// dist/src/parser/classes/ClipCreationTextInput.js
var ClipCreationTextInput = class extends YTNode {
constructor(data2) {
super();
this.placeholder_text = new Text(data2.placeholderText);
this.max_character_limit = data2.maxCharacterLimit;
}
};
__name(ClipCreationTextInput, "ClipCreationTextInput");
ClipCreationTextInput.type = "ClipCreationTextInput";
var ClipCreationTextInput_default = ClipCreationTextInput;
// dist/src/parser/classes/ClipCreationScrubber.js
var ClipCreationScrubber = class extends YTNode {
constructor(data2) {
super();
this.length_template = data2.lengthTemplate;
this.max_length_ms = data2.maxLengthMs;
this.min_length_ms = data2.minLengthMs;
this.default_length_ms = data2.defaultLengthMs;
this.window_size_ms = data2.windowSizeMs;
this.start_label = data2.startAccessibility?.accessibilityData?.label;
this.end_label = data2.endAccessibility?.accessibilityData?.label;
this.duration_label = data2.durationAccessibility?.accessibilityData?.label;
}
};
__name(ClipCreationScrubber, "ClipCreationScrubber");
ClipCreationScrubber.type = "ClipCreationScrubber";
var ClipCreationScrubber_default = ClipCreationScrubber;
// dist/src/parser/classes/ClipAdState.js
var ClipAdState = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.body = new Text(data2.body);
}
};
__name(ClipAdState, "ClipAdState");
ClipAdState.type = "ClipAdState";
var ClipAdState_default = ClipAdState;
// dist/src/parser/classes/ClipCreation.js
var ClipCreation = class extends YTNode {
constructor(data2) {
super();
this.user_avatar = Thumbnail.fromResponse(data2.userAvatar);
this.title_input = parser_exports.parseItem(data2.titleInput, [ClipCreationTextInput_default]);
this.scrubber = parser_exports.parseItem(data2.scrubber, [ClipCreationScrubber_default]);
this.save_button = parser_exports.parseItem(data2.saveButton, [Button_default]);
this.display_name = new Text(data2.displayName);
this.publicity_label = data2.publicityLabel;
this.cancel_button = parser_exports.parseItem(data2.cancelButton, [Button_default]);
this.ad_state_overlay = parser_exports.parseItem(data2.adStateOverlay, [ClipAdState_default]);
this.external_video_id = data2.externalVideoId;
this.publicity_label_icon = data2.publicityLabelIcon;
}
};
__name(ClipCreation, "ClipCreation");
ClipCreation.type = "ClipCreation";
var ClipCreation_default = ClipCreation;
// dist/src/parser/classes/ClipSection.js
var ClipSection = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parse(data2.contents, true, [ClipCreation_default]);
}
};
__name(ClipSection, "ClipSection");
ClipSection.type = "ClipSection";
var ClipSection_default = ClipSection;
// dist/src/parser/classes/ContinuationItem.js
var ContinuationItem = class extends YTNode {
constructor(data2) {
super();
this.trigger = data2.trigger;
if (Reflect.has(data2, "button")) {
this.button = parser_exports.parseItem(data2.button, Button_default);
}
this.endpoint = new NavigationEndpoint_default(data2.continuationEndpoint);
}
};
__name(ContinuationItem, "ContinuationItem");
ContinuationItem.type = "ContinuationItem";
var ContinuationItem_default = ContinuationItem;
// dist/src/parser/classes/EngagementPanelTitleHeader.js
var EngagementPanelTitleHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.contextual_info = data2.contextualInfo ? new Text(data2.contextualInfo) : void 0;
this.visibility_button = parser_exports.parseItem(data2.visibilityButton, Button_default);
this.menu = parser_exports.parseItem(data2.menu);
}
};
__name(EngagementPanelTitleHeader, "EngagementPanelTitleHeader");
EngagementPanelTitleHeader.type = "EngagementPanelTitleHeader";
var EngagementPanelTitleHeader_default = EngagementPanelTitleHeader;
// dist/src/parser/classes/MacroMarkersInfoItem.js
var MacroMarkersInfoItem = class extends YTNode {
constructor(data2) {
super();
this.info_text = new Text(data2.infoText);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
}
};
__name(MacroMarkersInfoItem, "MacroMarkersInfoItem");
MacroMarkersInfoItem.type = "MacroMarkersInfoItem";
var MacroMarkersInfoItem_default = MacroMarkersInfoItem;
// dist/src/parser/classes/MacroMarkersListItem.js
var MacroMarkersListItem = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.time_description = new Text(data2.timeDescription);
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.on_tap_endpoint = new NavigationEndpoint_default(data2.onTap);
this.layout = data2.layout;
this.is_highlighted = !!data2.isHighlighted;
}
};
__name(MacroMarkersListItem, "MacroMarkersListItem");
MacroMarkersListItem.type = "MacroMarkersListItem";
var MacroMarkersListItem_default = MacroMarkersListItem;
// dist/src/parser/classes/MacroMarkersList.js
var MacroMarkersList = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents, [MacroMarkersInfoItem_default, MacroMarkersListItem_default]);
this.sync_button_label = new Text(data2.syncButtonLabel);
}
};
__name(MacroMarkersList, "MacroMarkersList");
MacroMarkersList.type = "MacroMarkersList";
var MacroMarkersList_default = MacroMarkersList;
// dist/src/parser/classes/ProductList.js
var ProductList = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents);
}
};
__name(ProductList, "ProductList");
ProductList.type = "ProductList";
var ProductList_default = ProductList;
// dist/src/parser/classes/SectionList.js
var SectionList = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents);
if (Reflect.has(data2, "targetId")) {
this.target_id = data2.targetId;
}
if (Reflect.has(data2, "continuations")) {
if (Reflect.has(data2.continuations[0], "nextContinuationData")) {
this.continuation = data2.continuations[0].nextContinuationData.continuation;
} else if (Reflect.has(data2.continuations[0], "reloadContinuationData")) {
this.continuation = data2.continuations[0].reloadContinuationData.continuation;
}
}
if (Reflect.has(data2, "header")) {
this.header = parser_exports.parseItem(data2.header);
}
if (Reflect.has(data2, "subMenu")) {
this.sub_menu = parser_exports.parseItem(data2.subMenu);
}
}
};
__name(SectionList, "SectionList");
SectionList.type = "SectionList";
var SectionList_default = SectionList;
// dist/src/parser/classes/ExpandableVideoDescriptionBody.js
var ExpandableVideoDescriptionBody = class extends YTNode {
constructor(data2) {
super();
this.show_more_text = new Text(data2.showMoreText);
this.show_less_text = new Text(data2.showLessText);
if (Reflect.has(data2, "attributedDescriptionBodyText")) {
this.attributed_description_body_text = Text.fromAttributed(data2.attributedDescriptionBodyText);
}
}
};
__name(ExpandableVideoDescriptionBody, "ExpandableVideoDescriptionBody");
ExpandableVideoDescriptionBody.type = "ExpandableVideoDescriptionBody";
var ExpandableVideoDescriptionBody_default = ExpandableVideoDescriptionBody;
// dist/src/parser/classes/SearchRefinementCard.js
var SearchRefinementCard = class extends YTNode {
constructor(data2) {
super();
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.endpoint = new NavigationEndpoint_default(data2.searchEndpoint);
this.query = new Text(data2.query).toString();
}
};
__name(SearchRefinementCard, "SearchRefinementCard");
SearchRefinementCard.type = "SearchRefinementCard";
var SearchRefinementCard_default = SearchRefinementCard;
// dist/src/parser/classes/GameCard.js
var GameCard = class extends YTNode {
constructor(data2) {
super();
this.game = parser_exports.parseItem(data2.game);
}
};
__name(GameCard, "GameCard");
GameCard.type = "GameCard";
var GameCard_default = GameCard;
// dist/src/parser/classes/HorizontalList.js
var HorizontalList = class extends YTNode {
constructor(data2) {
super();
this.visible_item_count = data2.visibleItemCount;
this.items = parser_exports.parseArray(data2.items);
}
get contents() {
return this.items;
}
};
__name(HorizontalList, "HorizontalList");
HorizontalList.type = "HorizontalList";
var HorizontalList_default = HorizontalList;
// dist/src/parser/classes/ExpandableMetadata.js
var ExpandableMetadata = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "header")) {
this.header = {
collapsed_title: new Text(data2.header.collapsedTitle),
collapsed_thumbnail: Thumbnail.fromResponse(data2.header.collapsedThumbnail),
collapsed_label: new Text(data2.header.collapsedLabel),
expanded_title: new Text(data2.header.expandedTitle)
};
}
this.expanded_content = parser_exports.parseItem(data2.expandedContent, [HorizontalCardList_default, HorizontalList_default]);
this.expand_button = parser_exports.parseItem(data2.expandButton, Button_default);
this.collapse_button = parser_exports.parseItem(data2.collapseButton, Button_default);
}
};
__name(ExpandableMetadata, "ExpandableMetadata");
ExpandableMetadata.type = "ExpandableMetadata";
var ExpandableMetadata_default = ExpandableMetadata;
// dist/src/parser/classes/MetadataBadge.js
var MetadataBadge = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "icon")) {
this.icon_type = data2.icon.iconType;
}
if (Reflect.has(data2, "style")) {
this.style = data2.style;
}
if (Reflect.has(data2, "label")) {
this.label = data2.label;
}
if (Reflect.has(data2, "tooltip") || Reflect.has(data2, "iconTooltip")) {
this.tooltip = data2.tooltip || data2.iconTooltip;
}
}
};
__name(MetadataBadge, "MetadataBadge");
MetadataBadge.type = "MetadataBadge";
var MetadataBadge_default = MetadataBadge;
// dist/src/parser/classes/ThumbnailOverlayTimeStatus.js
var ThumbnailOverlayTimeStatus = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text).toString();
this.style = data2.style;
}
};
__name(ThumbnailOverlayTimeStatus, "ThumbnailOverlayTimeStatus");
ThumbnailOverlayTimeStatus.type = "ThumbnailOverlayTimeStatus";
var ThumbnailOverlayTimeStatus_default = ThumbnailOverlayTimeStatus;
// dist/src/parser/classes/Video.js
var Video = class extends YTNode {
constructor(data2) {
super();
const overlay_time_status = data2.thumbnailOverlays.find((overlay) => overlay.thumbnailOverlayTimeStatusRenderer)?.thumbnailOverlayTimeStatusRenderer.text || "N/A";
this.id = data2.videoId;
this.title = new Text(data2.title);
if (Reflect.has(data2, "descriptionSnippet")) {
this.description_snippet = new Text(data2.descriptionSnippet);
}
if (Reflect.has(data2, "detailedMetadataSnippets")) {
this.snippets = data2.detailedMetadataSnippets.map((snippet) => ({
text: new Text(snippet.snippetText),
hover_text: new Text(snippet.snippetHoverText)
}));
}
this.expandable_metadata = parser_exports.parseItem(data2.expandableMetadata, ExpandableMetadata_default);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
if (Reflect.has(data2, "richThumbnail")) {
this.rich_thumbnail = parser_exports.parseItem(data2.richThumbnail);
}
this.author = new Author(data2.ownerText, data2.ownerBadges, data2.channelThumbnailSupportedRenderers?.channelThumbnailWithLinkRenderer?.thumbnail);
this.badges = parser_exports.parseArray(data2.badges, MetadataBadge_default);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.published = new Text(data2.publishedTimeText);
this.view_count = new Text(data2.viewCountText);
this.short_view_count = new Text(data2.shortViewCountText);
if (Reflect.has(data2, "upcomingEventData")) {
this.upcoming = new Date(Number(`${data2.upcomingEventData.startTime}000`));
}
this.duration = {
text: data2.lengthText ? new Text(data2.lengthText).toString() : new Text(overlay_time_status).toString(),
seconds: timeToSeconds(data2.lengthText ? new Text(data2.lengthText).toString() : new Text(overlay_time_status).toString())
};
this.show_action_menu = !!data2.showActionMenu;
this.is_watched = !!data2.isWatched;
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
if (Reflect.has(data2, "searchVideoResultEntityKey")) {
this.search_video_result_entity_key = data2.searchVideoResultEntityKey;
}
if (Reflect.has(data2, "bylineText")) {
this.byline_text = new Text(data2.bylineText);
}
}
get description() {
if (this.snippets) {
return this.snippets.map((snip) => snip.text.toString()).join("");
}
return this.description_snippet?.toString() || "";
}
get is_live() {
return this.badges.some((badge) => {
if (badge.style === "BADGE_STYLE_TYPE_LIVE_NOW" || badge.label === "LIVE")
return true;
}) || this.thumbnail_overlays.firstOfType(ThumbnailOverlayTimeStatus_default)?.style === "LIVE";
}
get is_upcoming() {
return this.upcoming && this.upcoming > new Date();
}
get is_premiere() {
return this.badges.some((badge) => badge.label === "PREMIERE");
}
get is_4k() {
return this.badges.some((badge) => badge.label === "4K");
}
get has_captions() {
return this.badges.some((badge) => badge.label === "CC");
}
get best_thumbnail() {
return this.thumbnails[0];
}
};
__name(Video, "Video");
Video.type = "Video";
var Video_default = Video;
// dist/src/parser/classes/VideoCard.js
var VideoCard = class extends Video_default {
constructor(data2) {
super(data2);
if (Reflect.has(data2, "metadataText")) {
this.metadata_text = new Text(data2.metadataText);
if (this.metadata_text.text) {
this.short_view_count = new Text({ simpleText: this.metadata_text.text.split("\xB7")[0]?.trim() });
this.published = new Text({ simpleText: this.metadata_text.text.split("\xB7")[1]?.trim() });
}
}
if (Reflect.has(data2, "bylineText")) {
this.author = new Author(data2.bylineText, data2.ownerBadges, data2.channelThumbnailSupportedRenderers?.channelThumbnailWithLinkRenderer?.thumbnail);
}
}
};
__name(VideoCard, "VideoCard");
VideoCard.type = "VideoCard";
var VideoCard_default = VideoCard;
// dist/src/parser/classes/ContentPreviewImageView.js
var ContentPreviewImageView = class extends YTNode {
constructor(data2) {
super();
this.image = Thumbnail.fromResponse(data2.image);
this.style = data2.style;
}
};
__name(ContentPreviewImageView, "ContentPreviewImageView");
ContentPreviewImageView.type = "ContentPreviewImageView";
var ContentPreviewImageView_default = ContentPreviewImageView;
// dist/src/parser/classes/VideoAttributeView.js
var VideoAttributeView = class extends YTNode {
constructor(data2) {
super();
if (data2.image?.sources) {
this.image = Thumbnail.fromResponse(data2.image);
} else {
this.image = parser_exports.parseItem(data2.image, ContentPreviewImageView_default);
}
this.image_style = data2.imageStyle;
this.title = data2.title;
this.subtitle = data2.subtitle;
if (Reflect.has(data2, "secondarySubtitle")) {
this.secondary_subtitle = {
content: data2.secondarySubtitle.content
};
}
this.orientation = data2.orientation;
this.sizing_rule = data2.sizingRule;
this.overflow_menu_on_tap = new NavigationEndpoint_default(data2.overflowMenuOnTap);
this.overflow_menu_a11y_label = data2.overflowMenuA11yLabel;
}
};
__name(VideoAttributeView, "VideoAttributeView");
VideoAttributeView.type = "VideoAttributeView";
var VideoAttributeView_default = VideoAttributeView;
// dist/src/parser/classes/HorizontalCardList.js
var HorizontalCardList = class extends YTNode {
constructor(data2) {
super();
this.cards = parser_exports.parseArray(data2.cards, [VideoAttributeView_default, SearchRefinementCard_default, MacroMarkersListItem_default, GameCard_default, VideoCard_default]);
this.header = parser_exports.parseItem(data2.header);
this.previous_button = parser_exports.parseItem(data2.previousButton, Button_default);
this.next_button = parser_exports.parseItem(data2.nextButton, Button_default);
}
};
__name(HorizontalCardList, "HorizontalCardList");
HorizontalCardList.type = "HorizontalCardList";
var HorizontalCardList_default = HorizontalCardList;
// dist/src/parser/classes/Factoid.js
var Factoid = class extends YTNode {
constructor(data2) {
super();
this.label = new Text(data2.label);
this.value = new Text(data2.value);
this.accessibility_text = data2.accessibilityText;
}
};
__name(Factoid, "Factoid");
Factoid.type = "Factoid";
var Factoid_default = Factoid;
// dist/src/parser/classes/UploadTimeFactoid.js
var UploadTimeFactoid = class extends YTNode {
constructor(data2) {
super();
this.factoid = parser_exports.parseItem(data2.factoid, Factoid_default);
}
};
__name(UploadTimeFactoid, "UploadTimeFactoid");
UploadTimeFactoid.type = "UploadTimeFactoid";
var UploadTimeFactoid_default = UploadTimeFactoid;
// dist/src/parser/classes/ViewCountFactoid.js
var ViewCountFactoid = class extends YTNode {
constructor(data2) {
super();
this.view_count_entity_key = data2.viewCountEntityKey;
this.factoid = parser_exports.parseItem(data2.factoid, [Factoid_default]);
this.view_count_type = data2.viewCountType;
}
};
__name(ViewCountFactoid, "ViewCountFactoid");
ViewCountFactoid.type = "ViewCountFactoid";
var ViewCountFactoid_default = ViewCountFactoid;
// dist/src/parser/classes/VideoDescriptionHeader.js
var VideoDescriptionHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.channel = new Text(data2.channel);
this.channel_navigation_endpoint = new NavigationEndpoint_default(data2.channelNavigationEndpoint);
this.channel_thumbnail = Thumbnail.fromResponse(data2.channelThumbnail);
this.publish_date = new Text(data2.publishDate);
this.views = new Text(data2.views);
this.factoids = parser_exports.parseArray(data2.factoid, [Factoid_default, ViewCountFactoid_default, UploadTimeFactoid_default]);
}
};
__name(VideoDescriptionHeader, "VideoDescriptionHeader");
VideoDescriptionHeader.type = "VideoDescriptionHeader";
var VideoDescriptionHeader_default = VideoDescriptionHeader;
// dist/src/parser/classes/VideoDescriptionInfocardsSection.js
var VideoDescriptionInfocardsSection = class extends YTNode {
constructor(data2) {
super();
this.section_title = new Text(data2.sectionTitle);
this.creator_videos_button = parser_exports.parseItem(data2.creatorVideosButton, Button_default);
this.creator_about_button = parser_exports.parseItem(data2.creatorAboutButton, Button_default);
this.section_subtitle = new Text(data2.sectionSubtitle);
this.channel_avatar = Thumbnail.fromResponse(data2.channelAvatar);
this.channel_endpoint = new NavigationEndpoint_default(data2.channelEndpoint);
}
};
__name(VideoDescriptionInfocardsSection, "VideoDescriptionInfocardsSection");
VideoDescriptionInfocardsSection.type = "VideoDescriptionInfocardsSection";
var VideoDescriptionInfocardsSection_default = VideoDescriptionInfocardsSection;
// dist/src/parser/classes/InfoRow.js
var InfoRow = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
if (Reflect.has(data2, "defaultMetadata")) {
this.default_metadata = new Text(data2.defaultMetadata);
}
if (Reflect.has(data2, "expandedMetadata")) {
this.expanded_metadata = new Text(data2.expandedMetadata);
}
if (Reflect.has(data2, "infoRowExpandStatusKey")) {
this.info_row_expand_status_key = data2.infoRowExpandStatusKey;
}
}
};
__name(InfoRow, "InfoRow");
InfoRow.type = "InfoRow";
var InfoRow_default = InfoRow;
// dist/src/parser/classes/CompactVideo.js
var CompactVideo = class extends YTNode {
constructor(data2) {
super();
this.id = data2.videoId;
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail) || null;
if (Reflect.has(data2, "richThumbnail")) {
this.rich_thumbnail = parser_exports.parseItem(data2.richThumbnail);
}
this.title = new Text(data2.title);
this.author = new Author(data2.longBylineText, data2.ownerBadges, data2.channelThumbnail);
this.view_count = new Text(data2.viewCountText);
this.short_view_count = new Text(data2.shortViewCountText);
this.published = new Text(data2.publishedTimeText);
this.badges = parser_exports.parseArray(data2.badges, MetadataBadge_default);
this.duration = {
text: new Text(data2.lengthText).toString(),
seconds: timeToSeconds(new Text(data2.lengthText).toString())
};
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
}
get best_thumbnail() {
return this.thumbnails[0];
}
get is_fundraiser() {
return this.badges.some((badge) => badge.label === "Fundraiser");
}
get is_live() {
return this.badges.some((badge) => {
if (badge.style === "BADGE_STYLE_TYPE_LIVE_NOW" || badge.label === "LIVE")
return true;
});
}
get is_new() {
return this.badges.some((badge) => badge.label === "New");
}
get is_premiere() {
return this.badges.some((badge) => badge.style === "PREMIERE");
}
};
__name(CompactVideo, "CompactVideo");
CompactVideo.type = "CompactVideo";
var CompactVideo_default = CompactVideo;
// dist/src/parser/classes/CarouselLockup.js
var CarouselLockup = class extends YTNode {
constructor(data2) {
super();
this.info_rows = parser_exports.parseArray(data2.infoRows, InfoRow_default);
this.video_lockup = parser_exports.parseItem(data2.videoLockup, CompactVideo_default);
}
};
__name(CarouselLockup, "CarouselLockup");
CarouselLockup.type = "CarouselLockup";
var CarouselLockup_default = CarouselLockup;
// dist/src/parser/classes/VideoDescriptionMusicSection.js
var VideoDescriptionMusicSection = class extends YTNode {
constructor(data2) {
super();
this.carousel_lockups = parser_exports.parseArray(data2.carouselLockups, CarouselLockup_default);
this.section_title = new Text(data2.sectionTitle);
}
};
__name(VideoDescriptionMusicSection, "VideoDescriptionMusicSection");
VideoDescriptionMusicSection.type = "VideoDescriptionMusicSection";
var VideoDescriptionMusicSection_default = VideoDescriptionMusicSection;
// dist/src/parser/classes/VideoDescriptionTranscriptSection.js
var VideoDescriptionTranscriptSection = class extends YTNode {
constructor(data2) {
super();
this.section_title = new Text(data2.sectionTitle);
this.sub_header_text = new Text(data2.subHeaderText);
this.primary_button = parser_exports.parseItem(data2.primaryButton, Button_default);
}
};
__name(VideoDescriptionTranscriptSection, "VideoDescriptionTranscriptSection");
VideoDescriptionTranscriptSection.type = "VideoDescriptionTranscriptSection";
var VideoDescriptionTranscriptSection_default = VideoDescriptionTranscriptSection;
// dist/src/parser/classes/StructuredDescriptionPlaylistLockup.js
var StructuredDescriptionPlaylistLockup = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.title = new Text(data2.title);
this.short_byline_text = new Text(data2.shortBylineText);
this.video_count_short_text = new Text(data2.videoCountShortText);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.thumbnail_width = data2.thumbnailWidth;
this.aspect_ratio = data2.aspectRatio;
this.max_lines_title = data2.maxLinesTitle;
this.max_lines_short_byline_text = data2.maxLinesShortBylineText;
this.overlay_position = data2.overlayPosition;
}
};
__name(StructuredDescriptionPlaylistLockup, "StructuredDescriptionPlaylistLockup");
StructuredDescriptionPlaylistLockup.type = "StructuredDescriptionPlaylistLockup";
var StructuredDescriptionPlaylistLockup_default = StructuredDescriptionPlaylistLockup;
// dist/src/parser/classes/VideoDescriptionCourseSection.js
var VideoDescriptionCourseSection = class extends YTNode {
constructor(data2) {
super();
this.section_title = new Text(data2.sectionTitle);
this.media_lockups = parser_exports.parseArray(data2.mediaLockups, [StructuredDescriptionPlaylistLockup_default]);
}
};
__name(VideoDescriptionCourseSection, "VideoDescriptionCourseSection");
VideoDescriptionCourseSection.type = "VideoDescriptionCourseSection";
var VideoDescriptionCourseSection_default = VideoDescriptionCourseSection;
// dist/src/parser/classes/VideoAttributesSectionView.js
var VideoAttributesSectionView = class extends YTNode {
constructor(data2) {
super();
this.header_title = data2.headerTitle;
this.header_subtitle = data2.headerSubtitle;
this.video_attributes = parser_exports.parseArray(data2.videoAttributeViewModels, VideoAttributeView_default);
this.previous_button = parser_exports.parseItem(data2.previousButton, ButtonView_default);
this.next_button = parser_exports.parseItem(data2.nextButton, ButtonView_default);
}
};
__name(VideoAttributesSectionView, "VideoAttributesSectionView");
VideoAttributesSectionView.type = "VideoAttributesSectionView";
var VideoAttributesSectionView_default = VideoAttributesSectionView;
// dist/src/parser/classes/HowThisWasMadeSectionView.js
var HowThisWasMadeSectionView = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "sectionText"))
this.section_title = Text.fromAttributed(data2.sectionText);
if (Reflect.has(data2, "bodyText"))
this.body_text = Text.fromAttributed(data2.bodyText);
if (Reflect.has(data2, "bodyHeader"))
this.body_header = Text.fromAttributed(data2.bodyHeader);
}
};
__name(HowThisWasMadeSectionView, "HowThisWasMadeSectionView");
HowThisWasMadeSectionView.type = "HowThisWasMadeSectionView";
var HowThisWasMadeSectionView_default = HowThisWasMadeSectionView;
// dist/src/parser/classes/ReelShelf.js
var ReelShelf = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.items = parser_exports.parseArray(data2.items);
if (Reflect.has(data2, "endpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
}
}
get contents() {
return this.items;
}
};
__name(ReelShelf, "ReelShelf");
ReelShelf.type = "ReelShelf";
var ReelShelf_default = ReelShelf;
// dist/src/parser/classes/StructuredDescriptionContent.js
var StructuredDescriptionContent = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items, [
VideoDescriptionHeader_default,
ExpandableVideoDescriptionBody_default,
VideoDescriptionMusicSection_default,
VideoDescriptionInfocardsSection_default,
VideoDescriptionCourseSection_default,
VideoDescriptionTranscriptSection_default,
VideoDescriptionTranscriptSection_default,
HorizontalCardList_default,
ReelShelf_default,
VideoAttributesSectionView_default,
HowThisWasMadeSectionView_default
]);
}
};
__name(StructuredDescriptionContent, "StructuredDescriptionContent");
StructuredDescriptionContent.type = "StructuredDescriptionContent";
var StructuredDescriptionContent_default = StructuredDescriptionContent;
// dist/src/parser/classes/EngagementPanelSectionList.js
var EngagementPanelSectionList = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header, EngagementPanelTitleHeader_default);
this.content = parser_exports.parseItem(data2.content, [VideoAttributeView_default, SectionList_default, ContinuationItem_default, ClipSection_default, StructuredDescriptionContent_default, MacroMarkersList_default, ProductList_default]);
this.panel_identifier = data2.panelIdentifier;
this.identifier = data2.identifier ? {
surface: data2.identifier.surface,
tag: data2.identifier.tag
} : void 0;
this.target_id = data2.targetId;
this.visibility = data2.visibility;
}
};
__name(EngagementPanelSectionList, "EngagementPanelSectionList");
EngagementPanelSectionList.type = "EngagementPanelSectionList";
var EngagementPanelSectionList_default = EngagementPanelSectionList;
// dist/src/parser/classes/ChannelTagline.js
var ChannelTagline = class extends YTNode {
constructor(data2) {
super();
this.content = data2.content;
this.max_lines = data2.maxLines;
this.more_endpoint = data2.moreEndpoint.showEngagementPanelEndpoint ? {
show_engagement_panel_endpoint: {
engagement_panel: parser_exports.parseItem(data2.moreEndpoint.showEngagementPanelEndpoint.engagementPanel, EngagementPanelSectionList_default),
engagement_panel_popup_type: data2.moreEndpoint.showEngagementPanelEndpoint.engagementPanelPresentationConfigs.engagementPanelPopupPresentationConfig.popupType,
identifier: {
surface: data2.moreEndpoint.showEngagementPanelEndpoint.identifier.surface,
tag: data2.moreEndpoint.showEngagementPanelEndpoint.identifier.tag
}
}
} : new NavigationEndpoint_default(data2.moreEndpoint);
this.more_icon_type = data2.moreIcon.iconType;
this.more_label = data2.moreLabel;
this.target_id = data2.targetId;
}
};
__name(ChannelTagline, "ChannelTagline");
ChannelTagline.type = "ChannelTagline";
var ChannelTagline_default = ChannelTagline;
// dist/src/parser/classes/SubscriptionNotificationToggleButton.js
var SubscriptionNotificationToggleButton = class extends YTNode {
constructor(data2) {
super();
this.states = data2.states.map((data3) => ({
id: data3.stateId,
next_id: data3.nextStateId,
state: parser_exports.parse(data3.state)
}));
this.current_state_id = data2.currentStateId;
this.target_id = data2.targetId;
}
};
__name(SubscriptionNotificationToggleButton, "SubscriptionNotificationToggleButton");
SubscriptionNotificationToggleButton.type = "SubscriptionNotificationToggleButton";
var SubscriptionNotificationToggleButton_default = SubscriptionNotificationToggleButton;
// dist/src/parser/classes/SubscribeButton.js
var SubscribeButton = class extends YTNode {
constructor(data2) {
super();
this.button_text = new Text(data2.buttonText);
this.subscribed = data2.subscribed;
this.enabled = data2.enabled;
this.item_type = data2.type;
this.channel_id = data2.channelId;
this.show_preferences = data2.showPreferences;
if (Reflect.has(data2, "subscribedButtonText"))
this.subscribed_text = new Text(data2.subscribedButtonText);
if (Reflect.has(data2, "unsubscribedButtonText"))
this.unsubscribed_text = new Text(data2.unsubscribedButtonText);
if (Reflect.has(data2, "unsubscribeButtonText"))
this.unsubscribe_text = new Text(data2.unsubscribeButtonText);
this.notification_preference_button = parser_exports.parseItem(data2.notificationPreferenceButton, SubscriptionNotificationToggleButton_default);
if (Reflect.has(data2, "serviceEndpoints"))
this.service_endpoints = data2.serviceEndpoints.map((endpoint) => new NavigationEndpoint_default(endpoint));
if (Reflect.has(data2, "onSubscribeEndpoints"))
this.on_subscribe_endpoints = data2.onSubscribeEndpoints.map((endpoint) => new NavigationEndpoint_default(endpoint));
if (Reflect.has(data2, "onUnsubscribeEndpoints"))
this.on_unsubscribe_endpoints = data2.onUnsubscribeEndpoints.map((endpoint) => new NavigationEndpoint_default(endpoint));
if (Reflect.has(data2, "subscribedEntityKey"))
this.subscribed_entity_key = data2.subscribedEntityKey;
if (Reflect.has(data2, "targetId"))
this.target_id = data2.targetId;
if (Reflect.has(data2, "subscribeAccessibility"))
this.subscribe_accessibility_label = data2.subscribeAccessibility.accessibilityData?.label;
if (Reflect.has(data2, "unsubscribeAccessibility"))
this.unsubscribe_accessibility_label = data2.unsubscribeAccessibility.accessibilityData?.label;
}
};
__name(SubscribeButton, "SubscribeButton");
SubscribeButton.type = "SubscribeButton";
var SubscribeButton_default = SubscribeButton;
// dist/src/parser/classes/C4TabbedHeader.js
var C4TabbedHeader = class extends YTNode {
constructor(data2) {
super();
this.author = new Author({
simpleText: data2.title,
navigationEndpoint: data2.navigationEndpoint
}, data2.badges, data2.avatar);
if (Reflect.has(data2, "banner")) {
this.banner = Thumbnail.fromResponse(data2.banner);
}
if (Reflect.has(data2, "tv_banner")) {
this.tv_banner = Thumbnail.fromResponse(data2.tvBanner);
}
if (Reflect.has(data2, "mobile_banner")) {
this.mobile_banner = Thumbnail.fromResponse(data2.mobileBanner);
}
if (Reflect.has(data2, "subscriberCountText")) {
this.subscribers = new Text(data2.subscriberCountText);
}
if (Reflect.has(data2, "videosCountText")) {
this.videos_count = new Text(data2.videosCountText);
}
if (Reflect.has(data2, "sponsorButton")) {
this.sponsor_button = parser_exports.parseItem(data2.sponsorButton, Button_default);
}
if (Reflect.has(data2, "subscribeButton")) {
this.subscribe_button = parser_exports.parseItem(data2.subscribeButton, [SubscribeButton_default, Button_default]);
}
if (Reflect.has(data2, "headerLinks")) {
this.header_links = parser_exports.parseItem(data2.headerLinks, [ChannelHeaderLinks_default, ChannelHeaderLinksView_default]);
}
if (Reflect.has(data2, "channelHandleText")) {
this.channel_handle = new Text(data2.channelHandleText);
}
if (Reflect.has(data2, "channelId")) {
this.channel_id = data2.channelId;
}
if (Reflect.has(data2, "tagline")) {
this.tagline = parser_exports.parseItem(data2.tagline, ChannelTagline_default);
}
}
};
__name(C4TabbedHeader, "C4TabbedHeader");
C4TabbedHeader.type = "C4TabbedHeader";
var C4TabbedHeader_default = C4TabbedHeader;
// dist/src/parser/classes/CallToActionButton.js
var CallToActionButton = class extends YTNode {
constructor(data2) {
super();
this.label = new Text(data2.label);
this.icon_type = data2.icon.iconType;
this.style = data2.style;
}
};
__name(CallToActionButton, "CallToActionButton");
CallToActionButton.type = "CallToActionButton";
var CallToActionButton_default = CallToActionButton;
// dist/src/parser/classes/Card.js
var Card = class extends YTNode {
constructor(data2) {
super();
this.teaser = parser_exports.parseItem(data2.teaser);
this.content = parser_exports.parseItem(data2.content);
if (Reflect.has(data2, "cardId")) {
this.card_id = data2.cardId;
}
if (Reflect.has(data2, "feature")) {
this.feature = data2.feature;
}
this.cue_ranges = data2.cueRanges.map((cr) => ({
start_card_active_ms: cr.startCardActiveMs,
end_card_active_ms: cr.endCardActiveMs,
teaser_duration_ms: cr.teaserDurationMs,
icon_after_teaser_ms: cr.iconAfterTeaserMs
}));
}
};
__name(Card, "Card");
Card.type = "Card";
var Card_default = Card;
// dist/src/parser/classes/CardCollection.js
var CardCollection = class extends YTNode {
constructor(data2) {
super();
this.cards = parser_exports.parseArray(data2.cards);
this.header = new Text(data2.headerText);
this.allow_teaser_dismiss = data2.allowTeaserDismiss;
}
};
__name(CardCollection, "CardCollection");
CardCollection.type = "CardCollection";
var CardCollection_default = CardCollection;
// dist/src/parser/classes/CarouselHeader.js
var CarouselHeader = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents);
}
};
__name(CarouselHeader, "CarouselHeader");
CarouselHeader.type = "CarouselHeader";
var CarouselHeader_default = CarouselHeader;
// dist/src/parser/classes/CarouselItem.js
var CarouselItem = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.carouselItems);
this.background_color = data2.backgroundColor;
this.layout_style = data2.layoutStyle;
this.pagination_thumbnails = Thumbnail.fromResponse(data2.paginationThumbnails);
this.paginator_alignment = data2.paginatorAlignment;
}
get contents() {
return this.items;
}
};
__name(CarouselItem, "CarouselItem");
CarouselItem.type = "CarouselItem";
var CarouselItem_default = CarouselItem;
// dist/src/parser/classes/TextCarouselItemView.js
var TextCarouselItemView = class extends YTNode {
constructor(data2) {
super();
this.icon_name = data2.iconName;
this.text = Text.fromAttributed(data2.text);
this.on_tap_endpoint = new NavigationEndpoint_default(data2.onTap);
this.button = parser_exports.parseItem(data2.button, ButtonView_default);
}
};
__name(TextCarouselItemView, "TextCarouselItemView");
TextCarouselItemView.type = "TextCarouselItemView";
var TextCarouselItemView_default = TextCarouselItemView;
// dist/src/parser/classes/CarouselItemView.js
var CarouselItemView = class extends YTNode {
constructor(data2) {
super();
this.item_type = data2.itemType;
this.carousel_item = parser_exports.parseItem(data2.carouselItem, TextCarouselItemView_default);
}
};
__name(CarouselItemView, "CarouselItemView");
CarouselItemView.type = "CarouselItemView";
var CarouselItemView_default = CarouselItemView;
// dist/src/parser/classes/CarouselTitleView.js
var CarouselTitleView = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title;
this.previous_button = parser_exports.parseItem(data2.previousButton, ButtonView_default);
this.next_button = parser_exports.parseItem(data2.nextButton, ButtonView_default);
}
};
__name(CarouselTitleView, "CarouselTitleView");
CarouselTitleView.type = "CarouselTitleView";
var CarouselTitleView_default = CarouselTitleView;
// dist/src/parser/classes/Channel.js
var Channel = class extends YTNode {
constructor(data2) {
super();
this.id = data2.channelId;
this.author = new Author({
...data2.title,
navigationEndpoint: data2.navigationEndpoint
}, data2.ownerBadges, data2.thumbnail);
this.subscriber_count = new Text(data2.subscriberCountText);
this.video_count = new Text(data2.videoCountText);
this.long_byline = new Text(data2.longBylineText);
this.short_byline = new Text(data2.shortBylineText);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.subscribe_button = parser_exports.parseItem(data2.subscribeButton, [SubscribeButton_default, Button_default]);
this.description_snippet = new Text(data2.descriptionSnippet);
}
};
__name(Channel, "Channel");
Channel.type = "Channel";
var Channel_default = Channel;
// dist/src/parser/classes/ChannelAboutFullMetadata.js
var ChannelAboutFullMetadata = class extends YTNode {
constructor(data2) {
super();
this.id = data2.channelId;
this.name = new Text(data2.title);
this.avatar = Thumbnail.fromResponse(data2.avatar);
this.canonical_channel_url = data2.canonicalChannelUrl;
this.primary_links = data2.primaryLinks?.map((link) => ({
endpoint: new NavigationEndpoint_default(link.navigationEndpoint),
icon: Thumbnail.fromResponse(link.icon),
title: new Text(link.title)
})) ?? [];
this.view_count = new Text(data2.viewCountText);
this.joined_date = new Text(data2.joinedDateText);
this.description = new Text(data2.description);
this.email_reveal = new NavigationEndpoint_default(data2.onBusinessEmailRevealClickCommand);
this.can_reveal_email = !data2.signInForBusinessEmail;
this.country = new Text(data2.country);
this.buttons = parser_exports.parseArray(data2.actionButtons, Button_default);
}
};
__name(ChannelAboutFullMetadata, "ChannelAboutFullMetadata");
ChannelAboutFullMetadata.type = "ChannelAboutFullMetadata";
var ChannelAboutFullMetadata_default = ChannelAboutFullMetadata;
// dist/src/parser/classes/ChannelAgeGate.js
var ChannelAgeGate = class extends YTNode {
constructor(data2) {
super();
this.channel_title = data2.channelTitle;
this.avatar = Thumbnail.fromResponse(data2.avatar);
this.header = new Text(data2.header);
this.main_text = new Text(data2.mainText);
this.sign_in_button = parser_exports.parseItem(data2.signInButton, Button_default);
this.secondary_text = new Text(data2.secondaryText);
}
};
__name(ChannelAgeGate, "ChannelAgeGate");
ChannelAgeGate.type = "ChannelAgeGate";
var ChannelAgeGate_default = ChannelAgeGate;
// dist/src/parser/classes/ChannelFeaturedContent.js
var ChannelFeaturedContent = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.items = parser_exports.parseArray(data2.items);
}
};
__name(ChannelFeaturedContent, "ChannelFeaturedContent");
ChannelFeaturedContent.type = "ChannelFeaturedContent";
var ChannelFeaturedContent_default = ChannelFeaturedContent;
// dist/src/parser/classes/ChannelMetadata.js
var ChannelMetadata = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title;
this.description = data2.description;
this.url = data2.channelUrl;
this.rss_url = data2.rssUrl;
this.vanity_channel_url = data2.vanityChannelUrl;
this.external_id = data2.externalId;
this.is_family_safe = data2.isFamilySafe;
this.keywords = data2.keywords;
this.avatar = Thumbnail.fromResponse(data2.avatar);
this.music_artist_name = typeof data2.musicArtistName === "string" && data2.musicArtistName.length > 0 ? data2.musicArtistName : void 0;
this.available_countries = data2.availableCountryCodes;
this.android_deep_link = data2.androidDeepLink;
this.android_appindexing_link = data2.androidAppindexingLink;
this.ios_appindexing_link = data2.iosAppindexingLink;
}
};
__name(ChannelMetadata, "ChannelMetadata");
ChannelMetadata.type = "ChannelMetadata";
var ChannelMetadata_default = ChannelMetadata;
// dist/src/parser/classes/ChannelMobileHeader.js
var ChannelMobileHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
}
};
__name(ChannelMobileHeader, "ChannelMobileHeader");
ChannelMobileHeader.type = "ChannelMobileHeader";
var ChannelMobileHeader_default = ChannelMobileHeader;
// dist/src/parser/classes/ChannelOptions.js
var ChannelOptions = class extends YTNode {
constructor(data2) {
super();
this.avatar = Thumbnail.fromResponse(data2.avatar);
this.endpoint = new NavigationEndpoint_default(data2.avatarEndpoint);
this.name = data2.name;
this.links = data2.links.map((link) => new Text(link));
}
};
__name(ChannelOptions, "ChannelOptions");
ChannelOptions.type = "ChannelOptions";
var ChannelOptions_default = ChannelOptions;
// dist/src/parser/classes/ChannelOwnerEmptyState.js
var ChannelOwnerEmptyState = class extends YTNode {
constructor(data2) {
super();
this.illustration = Thumbnail.fromResponse(data2.illustration);
this.description = new Text(data2.description);
}
};
__name(ChannelOwnerEmptyState, "ChannelOwnerEmptyState");
ChannelOwnerEmptyState.type = "ChannelOwnerEmptyState";
var ChannelOwnerEmptyState_default = ChannelOwnerEmptyState;
// dist/src/parser/classes/ChannelSubMenu.js
var ChannelSubMenu = class extends YTNode {
constructor(data2) {
super();
this.content_type_sub_menu_items = data2.contentTypeSubMenuItems.map((item) => ({
endpoint: new NavigationEndpoint_default(item.navigationEndpoint || item.endpoint),
selected: item.selected,
title: item.title
}));
this.sort_setting = parser_exports.parseItem(data2.sortSetting);
}
};
__name(ChannelSubMenu, "ChannelSubMenu");
ChannelSubMenu.type = "ChannelSubMenu";
var ChannelSubMenu_default = ChannelSubMenu;
// dist/src/parser/classes/ChannelSwitcherHeader.js
var ChannelSwitcherHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title).toString();
if (Reflect.has(data2, "button")) {
this.button = parser_exports.parseItem(data2.button, Button_default);
}
}
};
__name(ChannelSwitcherHeader, "ChannelSwitcherHeader");
ChannelSwitcherHeader.type = "ChannelSwitcherHeader";
var ChannelSwitcherHeader_default = ChannelSwitcherHeader;
// dist/src/parser/classes/ChannelThumbnailWithLink.js
var ChannelThumbnailWithLink = class extends YTNode {
constructor(data2) {
super();
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.label = data2.accessibility?.accessibilityData?.label;
}
};
__name(ChannelThumbnailWithLink, "ChannelThumbnailWithLink");
ChannelThumbnailWithLink.type = "ChannelThumbnailWithLink";
var ChannelThumbnailWithLink_default = ChannelThumbnailWithLink;
// dist/src/parser/classes/ChannelVideoPlayer.js
var ChannelVideoPlayer = class extends YTNode {
constructor(data2) {
super();
this.id = data2.videoId;
this.title = new Text(data2.title);
this.description = new Text(data2.description);
this.view_count = new Text(data2.viewCountText);
this.published_time = new Text(data2.publishedTimeText);
}
};
__name(ChannelVideoPlayer, "ChannelVideoPlayer");
ChannelVideoPlayer.type = "ChannelVideoPlayer";
var ChannelVideoPlayer_default = ChannelVideoPlayer;
// dist/src/parser/classes/Chapter.js
var Chapter = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.time_range_start_millis = data2.timeRangeStartMillis;
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
}
};
__name(Chapter, "Chapter");
Chapter.type = "Chapter";
var Chapter_default = Chapter;
// dist/src/parser/classes/ChildVideo.js
var ChildVideo = class extends YTNode {
constructor(data2) {
super();
this.id = data2.videoId;
this.title = new Text(data2.title);
this.duration = {
text: data2.lengthText.simpleText,
seconds: timeToSeconds(data2.lengthText.simpleText)
};
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
};
__name(ChildVideo, "ChildVideo");
ChildVideo.type = "ChildVideo";
var ChildVideo_default = ChildVideo;
// dist/src/parser/classes/ChipView.js
var ChipView = class extends YTNode {
constructor(data2) {
super();
this.text = data2.text;
this.display_type = data2.displayType;
this.endpoint = new NavigationEndpoint_default(data2.tapCommand);
this.chip_entity_key = data2.chipEntityKey;
}
};
__name(ChipView, "ChipView");
ChipView.type = "ChipView";
var ChipView_default = ChipView;
// dist/src/parser/classes/ChipBarView.js
var ChipBarView = class extends YTNode {
constructor(data2) {
super();
this.chips = parser_exports.parseArray(data2.chips, ChipView_default);
}
};
__name(ChipBarView, "ChipBarView");
ChipBarView.type = "ChipBarView";
var ChipBarView_default = ChipBarView;
// dist/src/parser/classes/ChipCloudChip.js
var ChipCloudChip = class extends YTNode {
constructor(data2) {
super();
this.is_selected = data2.isSelected;
if (Reflect.has(data2, "navigationEndpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
this.text = new Text(data2.text).toString();
}
};
__name(ChipCloudChip, "ChipCloudChip");
ChipCloudChip.type = "ChipCloudChip";
var ChipCloudChip_default = ChipCloudChip;
// dist/src/parser/classes/ChipCloud.js
var ChipCloud = class extends YTNode {
constructor(data2) {
super();
this.chips = parser_exports.parseArray(data2.chips, ChipCloudChip_default);
this.next_button = parser_exports.parseItem(data2.nextButton, Button_default);
this.previous_button = parser_exports.parseItem(data2.previousButton, Button_default);
this.horizontal_scrollable = data2.horizontalScrollable;
}
};
__name(ChipCloud, "ChipCloud");
ChipCloud.type = "ChipCloud";
var ChipCloud_default = ChipCloud;
// dist/src/parser/classes/ClientSideToggleMenuItem.js
var ClientSideToggleMenuItem = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.defaultText);
this.icon_type = data2.defaultIcon.iconType;
this.toggled_text = new Text(data2.toggledText);
this.toggled_icon_type = data2.toggledIcon.iconType;
if (Reflect.has(data2, "isToggled")) {
this.is_toggled = data2.isToggled;
}
this.menu_item_identifier = data2.menuItemIdentifier;
this.endpoint = new NavigationEndpoint_default(data2.command);
if (Reflect.has(data2, "loggingDirectives")) {
this.logging_directives = {
visibility: {
types: data2.loggingDirectives.visibility.types
},
enable_displaylogger_experiment: data2.loggingDirectives.enableDisplayloggerExperiment
};
}
}
};
__name(ClientSideToggleMenuItem, "ClientSideToggleMenuItem");
ClientSideToggleMenuItem.type = "ClientSideToggleMenuItem";
var ClientSideToggleMenuItem_default = ClientSideToggleMenuItem;
// dist/src/parser/classes/CollaboratorInfoCardContent.js
var CollaboratorInfoCardContent = class extends YTNode {
constructor(data2) {
super();
this.channel_avatar = Thumbnail.fromResponse(data2.channelAvatar);
this.custom_text = new Text(data2.customText);
this.channel_name = new Text(data2.channelName);
this.subscriber_count = new Text(data2.subscriberCountText);
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
}
};
__name(CollaboratorInfoCardContent, "CollaboratorInfoCardContent");
CollaboratorInfoCardContent.type = "CollaboratorInfoCardContent";
var CollaboratorInfoCardContent_default = CollaboratorInfoCardContent;
// dist/src/parser/classes/CollageHeroImage.js
var CollageHeroImage = class extends YTNode {
constructor(data2) {
super();
this.left = Thumbnail.fromResponse(data2.leftThumbnail);
this.top_right = Thumbnail.fromResponse(data2.topRightThumbnail);
this.bottom_right = Thumbnail.fromResponse(data2.bottomRightThumbnail);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
};
__name(CollageHeroImage, "CollageHeroImage");
CollageHeroImage.type = "CollageHeroImage";
var CollageHeroImage_default = CollageHeroImage;
// dist/src/parser/classes/ThumbnailHoverOverlayView.js
var ThumbnailHoverOverlayView = class extends YTNode {
constructor(data2) {
super();
this.icon_name = data2.icon.sources[0].clientResource.imageName;
this.text = Text.fromAttributed(data2.text);
this.style = data2.style;
}
};
__name(ThumbnailHoverOverlayView, "ThumbnailHoverOverlayView");
ThumbnailHoverOverlayView.type = "ThumbnailHoverOverlayView";
var ThumbnailHoverOverlayView_default = ThumbnailHoverOverlayView;
// dist/src/parser/classes/ThumbnailBadgeView.js
var ThumbnailBadgeView = class extends YTNode {
constructor(data2) {
super();
this.text = data2.text;
this.badge_style = data2.badgeStyle;
if (data2.backgroundColor) {
this.background_color = {
light_theme: data2.backgroundColor.lightTheme,
dark_theme: data2.backgroundColor.darkTheme
};
}
if (data2.iconName) {
this.icon_name = data2.icon.sources[0].clientResource.imageName;
}
}
};
__name(ThumbnailBadgeView, "ThumbnailBadgeView");
ThumbnailBadgeView.type = "ThumbnailBadgeView";
var ThumbnailBadgeView_default = ThumbnailBadgeView;
// dist/src/parser/classes/ThumbnailOverlayBadgeView.js
var ThumbnailOverlayBadgeView = class extends YTNode {
constructor(data2) {
super();
this.badges = parser_exports.parseArray(data2.thumbnailBadges, ThumbnailBadgeView_default);
this.position = data2.position;
}
};
__name(ThumbnailOverlayBadgeView, "ThumbnailOverlayBadgeView");
ThumbnailOverlayBadgeView.type = "ThumbnailOverlayBadgeView";
var ThumbnailOverlayBadgeView_default = ThumbnailOverlayBadgeView;
// dist/src/parser/classes/ThumbnailHoverOverlayToggleActionsView.js
var ThumbnailHoverOverlayToggleActionsView = class extends YTNode {
constructor(data2) {
super();
this.buttons = parser_exports.parseArray(data2.buttons, ToggleButtonView_default);
}
};
__name(ThumbnailHoverOverlayToggleActionsView, "ThumbnailHoverOverlayToggleActionsView");
ThumbnailHoverOverlayToggleActionsView.type = "ThumbnailHoverOverlayToggleActionsView";
var ThumbnailHoverOverlayToggleActionsView_default = ThumbnailHoverOverlayToggleActionsView;
// dist/src/parser/classes/ThumbnailOverlayProgressBarView.js
var ThumbnailOverlayProgressBarView = class extends YTNode {
constructor(data2) {
super();
this.start_percent = data2.startPercent;
}
};
__name(ThumbnailOverlayProgressBarView, "ThumbnailOverlayProgressBarView");
ThumbnailOverlayProgressBarView.type = "ThumbnailOverlayProgressBarView";
var ThumbnailOverlayProgressBarView_default = ThumbnailOverlayProgressBarView;
// dist/src/parser/classes/ThumbnailBottomOverlayView.js
var ThumbnailBottomOverlayView = class extends YTNode {
constructor(data2) {
super();
this.progress_bar = parser_exports.parseItem(data2.progressBar, ThumbnailOverlayProgressBarView_default);
this.badges = parser_exports.parseArray(data2.badges, ThumbnailBadgeView_default);
}
};
__name(ThumbnailBottomOverlayView, "ThumbnailBottomOverlayView");
ThumbnailBottomOverlayView.type = "ThumbnailBottomOverlayView";
var ThumbnailBottomOverlayView_default = ThumbnailBottomOverlayView;
// dist/src/parser/classes/ThumbnailView.js
var ThumbnailView = class extends YTNode {
constructor(data2) {
super();
this.image = Thumbnail.fromResponse(data2.image);
this.overlays = parser_exports.parseArray(data2.overlays, [
ThumbnailHoverOverlayToggleActionsView_default,
ThumbnailBottomOverlayView_default,
ThumbnailOverlayBadgeView_default,
ThumbnailHoverOverlayView_default,
AnimatedThumbnailOverlayView_default
]);
if ("backgroundColor" in data2) {
this.background_color = {
light_theme: data2.backgroundColor.lightTheme,
dark_theme: data2.backgroundColor.darkTheme
};
}
}
};
__name(ThumbnailView, "ThumbnailView");
ThumbnailView.type = "ThumbnailView";
var ThumbnailView_default = ThumbnailView;
// dist/src/parser/classes/CollectionThumbnailView.js
var CollectionThumbnailView = class extends YTNode {
constructor(data2) {
super();
this.primary_thumbnail = parser_exports.parseItem(data2.primaryThumbnail, ThumbnailView_default);
if (data2.stackColor) {
this.stack_color = {
light_theme: data2.stackColor.lightTheme,
dark_theme: data2.stackColor.darkTheme
};
}
}
};
__name(CollectionThumbnailView, "CollectionThumbnailView");
CollectionThumbnailView.type = "CollectionThumbnailView";
var CollectionThumbnailView_default = CollectionThumbnailView;
// dist/src/parser/classes/commands/AddToPlaylistCommand.js
var AddToPlaylistCommand = class extends YTNode {
constructor(data2) {
super();
this.open_miniplayer = data2.openMiniplayer;
this.video_id = data2.videoId;
this.list_type = data2.listType;
this.endpoint = new NavigationEndpoint_default(data2.onCreateListCommand);
this.video_ids = data2.videoIds;
}
};
__name(AddToPlaylistCommand, "AddToPlaylistCommand");
AddToPlaylistCommand.type = "AddToPlaylistCommand";
var AddToPlaylistCommand_default = AddToPlaylistCommand;
// dist/src/parser/classes/commands/CommandExecutorCommand.js
var CommandExecutorCommand = class extends YTNode {
constructor(data2) {
super();
this.commands = parser_exports.parseCommands(data2.commands);
}
};
__name(CommandExecutorCommand, "CommandExecutorCommand");
CommandExecutorCommand.type = "CommandExecutorCommand";
var CommandExecutorCommand_default = CommandExecutorCommand;
// dist/src/parser/classes/commands/ContinuationCommand.js
var _ContinuationCommand_data;
var ContinuationCommand = class extends YTNode {
constructor(data2) {
super();
_ContinuationCommand_data.set(this, void 0);
__classPrivateFieldSet(this, _ContinuationCommand_data, data2, "f");
}
getApiPath() {
switch (__classPrivateFieldGet(this, _ContinuationCommand_data, "f").request) {
case "CONTINUATION_REQUEST_TYPE_WATCH_NEXT":
return "next";
case "CONTINUATION_REQUEST_TYPE_BROWSE":
return "browse";
case "CONTINUATION_REQUEST_TYPE_SEARCH":
return "search";
case "CONTINUATION_REQUEST_TYPE_ACCOUNTS_LIST":
return "account/accounts_list";
case "CONTINUATION_REQUEST_TYPE_COMMENTS_NOTIFICATION_MENU":
return "notification/get_notification_menu";
case "CONTINUATION_REQUEST_TYPE_COMMENT_REPLIES":
return "comment/get_comment_replies";
case "CONTINUATION_REQUEST_TYPE_REEL_WATCH_SEQUENCE":
return "reel/reel_watch_sequence";
case "CONTINUATION_REQUEST_TYPE_GET_PANEL":
return "get_panel";
default:
return "";
}
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _ContinuationCommand_data, "f").formData)
request.formData = __classPrivateFieldGet(this, _ContinuationCommand_data, "f").formData;
if (__classPrivateFieldGet(this, _ContinuationCommand_data, "f").token)
request.continuation = __classPrivateFieldGet(this, _ContinuationCommand_data, "f").token;
if (__classPrivateFieldGet(this, _ContinuationCommand_data, "f").request === "CONTINUATION_REQUEST_TYPE_COMMENTS_NOTIFICATION_MENU") {
request.notificationsMenuRequestType = "NOTIFICATIONS_MENU_REQUEST_TYPE_COMMENTS";
if (__classPrivateFieldGet(this, _ContinuationCommand_data, "f").token) {
request.fetchCommentsParams = {
continuation: __classPrivateFieldGet(this, _ContinuationCommand_data, "f").token
};
delete request.continuation;
}
}
return request;
}
};
__name(ContinuationCommand, "ContinuationCommand");
_ContinuationCommand_data = /* @__PURE__ */ new WeakMap();
ContinuationCommand.type = "ContinuationCommand";
var ContinuationCommand_default = ContinuationCommand;
// dist/src/parser/classes/commands/GetKidsBlocklistPickerCommand.js
var _GetKidsBlocklistPickerCommand_data;
var API_PATH = "kids/get_kids_blocklist_picker";
var GetKidsBlocklistPickerCommand = class extends YTNode {
constructor(data2) {
super();
_GetKidsBlocklistPickerCommand_data.set(this, void 0);
__classPrivateFieldSet(this, _GetKidsBlocklistPickerCommand_data, data2, "f");
}
getApiPath() {
return API_PATH;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _GetKidsBlocklistPickerCommand_data, "f").blockedForKidsContent)
request.blockedForKidsContent = __classPrivateFieldGet(this, _GetKidsBlocklistPickerCommand_data, "f").blockedForKidsContent;
return request;
}
};
__name(GetKidsBlocklistPickerCommand, "GetKidsBlocklistPickerCommand");
_GetKidsBlocklistPickerCommand_data = /* @__PURE__ */ new WeakMap();
GetKidsBlocklistPickerCommand.type = "GetKidsBlocklistPickerCommand";
var GetKidsBlocklistPickerCommand_default = GetKidsBlocklistPickerCommand;
// dist/src/parser/classes/commands/RunAttestationCommand.js
var RunAttestationCommand = class extends YTNode {
constructor(data2) {
super();
this.engagement_type = data2.engagementType;
if (Reflect.has(data2, "ids")) {
this.ids = data2.ids.map((id) => ({
encrypted_video_id: id.encryptedVideoId,
external_channel_id: id.externalChannelId,
comment_id: id.commentId,
external_owner_id: id.externalOwnerId,
artist_id: id.artistId,
playlist_id: id.playlistId,
external_post_id: id.externalPostId,
share_id: id.shareId
}));
}
}
};
__name(RunAttestationCommand, "RunAttestationCommand");
RunAttestationCommand.type = "RunAttestationCommand";
var RunAttestationCommand_default = RunAttestationCommand;
// dist/src/parser/classes/commands/ShowDialogCommand.js
var ShowDialogCommand = class extends YTNode {
constructor(data2) {
super();
this.inline_content = parser_exports.parseItem(data2.panelLoadingStrategy?.inlineContent);
this.remove_default_padding = !!data2.removeDefaultPadding;
}
};
__name(ShowDialogCommand, "ShowDialogCommand");
ShowDialogCommand.type = "ShowDialogCommand";
var ShowDialogCommand_default = ShowDialogCommand;
// dist/src/parser/classes/commands/UpdateEngagementPanelContentCommand.js
var UpdateEngagementPanelContentCommand = class extends YTNode {
constructor(data2) {
super();
this.content_source_panel_identifier = data2.contentSourcePanelIdentifier;
this.target_panel_identifier = data2.targetPanelIdentifier;
}
};
__name(UpdateEngagementPanelContentCommand, "UpdateEngagementPanelContentCommand");
UpdateEngagementPanelContentCommand.type = "UpdateEngagementPanelContentCommand";
var UpdateEngagementPanelContentCommand_default = UpdateEngagementPanelContentCommand;
// dist/src/parser/classes/comments/AuthorCommentBadge.js
var _AuthorCommentBadge_data;
var AuthorCommentBadge = class extends YTNode {
constructor(data2) {
super();
_AuthorCommentBadge_data.set(this, void 0);
if (Reflect.has(data2, "icon") && Reflect.has(data2.icon, "iconType")) {
this.icon_type = data2.icon.iconType;
}
this.tooltip = data2.iconTooltip;
if (this.tooltip === "Verified") {
this.style = "BADGE_STYLE_TYPE_VERIFIED";
data2.style = "BADGE_STYLE_TYPE_VERIFIED";
}
__classPrivateFieldSet(this, _AuthorCommentBadge_data, data2, "f");
}
get orig_badge() {
return __classPrivateFieldGet(this, _AuthorCommentBadge_data, "f");
}
};
__name(AuthorCommentBadge, "AuthorCommentBadge");
_AuthorCommentBadge_data = /* @__PURE__ */ new WeakMap();
AuthorCommentBadge.type = "AuthorCommentBadge";
var AuthorCommentBadge_default = AuthorCommentBadge;
// dist/src/parser/classes/comments/EmojiPicker.js
var EmojiPicker = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.categories = parser_exports.parseArray(data2.categories);
this.category_buttons = parser_exports.parseArray(data2.categoryButtons);
this.search_placeholder = new Text(data2.searchPlaceholderText);
this.search_no_results = new Text(data2.searchNoResultsText);
this.pick_skin_tone = new Text(data2.pickSkinToneText);
this.clear_search_label = data2.clearSearchLabel;
this.skin_tone_generic_label = data2.skinToneGenericLabel;
this.skin_tone_light_label = data2.skinToneLightLabel;
this.skin_tone_medium_light_label = data2.skinToneMediumLightLabel;
this.skin_tone_medium_label = data2.skinToneMediumLabel;
this.skin_tone_medium_dark_label = data2.skinToneMediumDarkLabel;
this.skin_tone_dark_label = data2.skinToneDarkLabel;
}
};
__name(EmojiPicker, "EmojiPicker");
EmojiPicker.type = "EmojiPicker";
var EmojiPicker_default = EmojiPicker;
// dist/src/parser/classes/comments/CommentDialog.js
var CommentDialog = class extends YTNode {
constructor(data2) {
super();
this.editable_text = new Text(data2.editableText);
this.author_thumbnail = Thumbnail.fromResponse(data2.authorThumbnail);
this.submit_button = parser_exports.parseItem(data2.submitButton, Button_default);
this.cancel_button = parser_exports.parseItem(data2.cancelButton, Button_default);
this.placeholder = new Text(data2.placeholderText);
this.emoji_button = parser_exports.parseItem(data2.emojiButton, Button_default);
this.emoji_picker = parser_exports.parseItem(data2.emojiPicker, EmojiPicker_default);
}
};
__name(CommentDialog, "CommentDialog");
CommentDialog.type = "CommentDialog";
var CommentDialog_default = CommentDialog;
// dist/src/parser/classes/comments/CommentReplies.js
var CommentReplies = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents);
this.view_replies = parser_exports.parseItem(data2.viewReplies, Button_default);
this.hide_replies = parser_exports.parseItem(data2.hideReplies, Button_default);
this.view_replies_creator_thumbnail = Thumbnail.fromResponse(data2.viewRepliesCreatorThumbnail);
this.has_channel_owner_replied = !!data2.viewRepliesCreatorThumbnail;
}
};
__name(CommentReplies, "CommentReplies");
CommentReplies.type = "CommentReplies";
var CommentReplies_default = CommentReplies;
// dist/src/parser/classes/comments/CommentReplyDialog.js
var CommentReplyDialog = class extends YTNode {
constructor(data2) {
super();
this.reply_button = parser_exports.parseItem(data2.replyButton, Button_default);
this.cancel_button = parser_exports.parseItem(data2.cancelButton, Button_default);
this.author_thumbnail = Thumbnail.fromResponse(data2.authorThumbnail);
this.placeholder = new Text(data2.placeholderText);
this.error_message = new Text(data2.errorMessage);
}
};
__name(CommentReplyDialog, "CommentReplyDialog");
CommentReplyDialog.type = "CommentReplyDialog";
var CommentReplyDialog_default = CommentReplyDialog;
// dist/src/parser/classes/comments/CommentsSimplebox.js
var CommentsSimplebox = class extends YTNode {
constructor(data2) {
super();
this.simplebox_avatar = Thumbnail.fromResponse(data2.simpleboxAvatar);
this.simplebox_placeholder = new Text(data2.simpleboxPlaceholder);
}
};
__name(CommentsSimplebox, "CommentsSimplebox");
CommentsSimplebox.type = "CommentsSimplebox";
var CommentsSimplebox_default = CommentsSimplebox;
// dist/src/parser/classes/comments/CommentsEntryPointTeaser.js
var CommentsEntryPointTeaser = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "teaserAvatar")) {
this.teaser_avatar = Thumbnail.fromResponse(data2.teaserAvatar);
}
if (Reflect.has(data2, "teaserContent")) {
this.teaser_content = new Text(data2.teaserContent);
}
}
};
__name(CommentsEntryPointTeaser, "CommentsEntryPointTeaser");
CommentsEntryPointTeaser.type = "CommentsEntryPointTeaser";
var CommentsEntryPointTeaser_default = CommentsEntryPointTeaser;
// dist/src/parser/classes/comments/CommentsEntryPointHeader.js
var CommentsEntryPointHeader = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "headerText")) {
this.header = new Text(data2.headerText);
}
if (Reflect.has(data2, "commentCount")) {
this.comment_count = new Text(data2.commentCount);
}
if (Reflect.has(data2, "teaserAvatar") || Reflect.has(data2, "simpleboxAvatar")) {
this.teaser_avatar = Thumbnail.fromResponse(data2.teaserAvatar || data2.simpleboxAvatar);
}
if (Reflect.has(data2, "teaserContent")) {
this.teaser_content = new Text(data2.teaserContent);
}
if (Reflect.has(data2, "contentRenderer")) {
this.content_renderer = parser_exports.parseItem(data2.contentRenderer, [CommentsEntryPointTeaser_default, CommentsSimplebox_default]);
}
if (Reflect.has(data2, "simpleboxPlaceholder")) {
this.simplebox_placeholder = new Text(data2.simpleboxPlaceholder);
}
}
};
__name(CommentsEntryPointHeader, "CommentsEntryPointHeader");
CommentsEntryPointHeader.type = "CommentsEntryPointHeader";
var CommentsEntryPointHeader_default = CommentsEntryPointHeader;
// dist/src/parser/classes/comments/CommentsHeader.js
var CommentsHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.titleText);
this.count = new Text(data2.countText);
this.comments_count = new Text(data2.commentsCount);
this.create_renderer = parser_exports.parseItem(data2.createRenderer);
this.sort_menu = parser_exports.parseItem(data2.sortMenu, SortFilterSubMenu_default);
if (Reflect.has(data2, "customEmojis")) {
this.custom_emojis = data2.customEmojis.map((emoji) => ({
emoji_id: emoji.emojiId,
shortcuts: emoji.shortcuts,
search_terms: emoji.searchTerms,
image: Thumbnail.fromResponse(emoji.image),
is_custom_emoji: emoji.isCustomEmoji
}));
}
}
};
__name(CommentsHeader, "CommentsHeader");
CommentsHeader.type = "CommentsHeader";
var CommentsHeader_default = CommentsHeader;
// dist/src/parser/classes/comments/CommentSimplebox.js
var CommentSimplebox = class extends YTNode {
constructor(data2) {
super();
this.submit_button = parser_exports.parseItem(data2.submitButton, Button_default);
this.cancel_button = parser_exports.parseItem(data2.cancelButton, Button_default);
this.author_thumbnail = Thumbnail.fromResponse(data2.authorThumbnail);
this.placeholder = new Text(data2.placeholderText);
this.avatar_size = data2.avatarSize;
}
};
__name(CommentSimplebox, "CommentSimplebox");
CommentSimplebox.type = "CommentSimplebox";
var CommentSimplebox_default = CommentSimplebox;
// dist/src/parser/classes/comments/CommentView.js
var _CommentView_actions;
var CommentView = class extends YTNode {
constructor(data2) {
super();
_CommentView_actions.set(this, void 0);
this.comment_id = data2.commentId;
this.is_pinned = !!data2.pinnedText;
this.keys = {
comment: data2.commentKey,
comment_surface: data2.commentSurfaceKey,
toolbar_state: data2.toolbarStateKey,
toolbar_surface: data2.toolbarSurfaceKey,
shared: data2.sharedKey
};
}
applyMutations(comment, toolbar_state, toolbar_surface) {
if (comment) {
this.content = Text.fromAttributed(comment.properties.content);
this.published_time = comment.properties.publishedTime;
this.author_is_channel_owner = !!comment.author.isCreator;
this.creator_thumbnail_url = comment.toolbar.creatorThumbnailUrl;
this.like_count = comment.toolbar.likeCountNotliked ? comment.toolbar.likeCountNotliked : "0";
this.like_count_liked = comment.toolbar.likeCountLiked ? comment.toolbar.likeCountLiked : "0";
this.like_count_a11y = comment.toolbar.likeCountA11y;
this.like_active_tooltip = comment.toolbar.likeActiveTooltip;
this.like_inactive_tooltip = comment.toolbar.likeInactiveTooltip;
this.dislike_active_tooltip = comment.toolbar.dislikeActiveTooltip;
this.dislike_inactive_tooltip = comment.toolbar.dislikeInactiveTooltip;
this.like_button_a11y = comment.toolbar.likeButtonA11y;
this.heart_active_tooltip = comment.toolbar.heartActiveTooltip;
this.reply_count_a11y = comment.toolbar.replyCountA11y;
this.reply_count = comment.toolbar.replyCount ? comment.toolbar.replyCount : "0";
this.is_member = !!comment.author.sponsorBadgeUrl;
if (Reflect.has(comment.author, "sponsorBadgeUrl")) {
this.member_badge = {
url: comment.author.sponsorBadgeUrl,
a11y: comment.author.A11y
};
}
this.author = new Author({
simpleText: comment.author.displayName,
navigationEndpoint: comment.avatar.endpoint
}, comment.author, comment.avatar.image, comment.author.channelId);
}
if (toolbar_state) {
this.is_hearted = toolbar_state.heartState === "TOOLBAR_HEART_STATE_HEARTED";
this.is_liked = toolbar_state.likeState === "TOOLBAR_LIKE_STATE_LIKED";
this.is_disliked = toolbar_state.likeState === "TOOLBAR_LIKE_STATE_DISLIKED";
}
if (toolbar_surface) {
if ("prepareAccountCommand" in toolbar_surface) {
this.prepare_account_command = new NavigationEndpoint_default(toolbar_surface.prepareAccountCommand);
} else {
this.like_command = new NavigationEndpoint_default(toolbar_surface.likeCommand);
this.dislike_command = new NavigationEndpoint_default(toolbar_surface.dislikeCommand);
this.unlike_command = new NavigationEndpoint_default(toolbar_surface.unlikeCommand);
this.undislike_command = new NavigationEndpoint_default(toolbar_surface.undislikeCommand);
this.reply_command = new NavigationEndpoint_default(toolbar_surface.replyCommand);
}
}
}
async like() {
if (!__classPrivateFieldGet(this, _CommentView_actions, "f"))
throw new InnertubeError("Actions instance not set for this comment.");
if (!this.like_command)
throw new InnertubeError("Like command not found.");
if (this.is_liked)
throw new InnertubeError("This comment is already liked.", { comment_id: this.comment_id });
return this.like_command.call(__classPrivateFieldGet(this, _CommentView_actions, "f"));
}
async dislike() {
if (!__classPrivateFieldGet(this, _CommentView_actions, "f"))
throw new InnertubeError("Actions instance not set for this comment.");
if (!this.dislike_command)
throw new InnertubeError("Dislike command not found.");
if (this.is_disliked)
throw new InnertubeError("This comment is already disliked.", { comment_id: this.comment_id });
return this.dislike_command.call(__classPrivateFieldGet(this, _CommentView_actions, "f"));
}
async unlike() {
if (!__classPrivateFieldGet(this, _CommentView_actions, "f"))
throw new InnertubeError("Actions instance not set for this comment.");
if (!this.unlike_command)
throw new InnertubeError("Unlike command not found.");
if (!this.is_liked)
throw new InnertubeError("This comment is not liked.", { comment_id: this.comment_id });
return this.unlike_command.call(__classPrivateFieldGet(this, _CommentView_actions, "f"));
}
async undislike() {
if (!__classPrivateFieldGet(this, _CommentView_actions, "f"))
throw new InnertubeError("Actions instance not set for this comment.");
if (!this.undislike_command)
throw new InnertubeError("Undislike command not found.");
if (!this.is_disliked)
throw new InnertubeError("This comment is not disliked.", { comment_id: this.comment_id });
return this.undislike_command.call(__classPrivateFieldGet(this, _CommentView_actions, "f"));
}
async reply(comment_text) {
if (!__classPrivateFieldGet(this, _CommentView_actions, "f"))
throw new InnertubeError("Actions instance not set for this comment.");
if (!this.reply_command)
throw new InnertubeError("Reply command not found.");
const dialog = this.reply_command.dialog?.as(CommentReplyDialog_default);
if (!dialog)
throw new InnertubeError("Reply dialog not found.");
const reply_button = dialog.reply_button;
if (!reply_button)
throw new InnertubeError("Reply button not found in the dialog.");
if (!reply_button.endpoint)
throw new InnertubeError("Reply button endpoint not found.");
return reply_button.endpoint.call(__classPrivateFieldGet(this, _CommentView_actions, "f"), { commentText: comment_text });
}
async translate(target_language) {
if (!__classPrivateFieldGet(this, _CommentView_actions, "f"))
throw new InnertubeError("Actions instance not set for this comment.");
if (!this.content)
throw new InnertubeError("Comment content not found.", { comment_id: this.comment_id });
const text = this.content.toString().replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu, "");
const payload = { text, target_language };
const action = encodeCommentActionParams(22, payload);
const response = await __classPrivateFieldGet(this, _CommentView_actions, "f").execute("comment/perform_comment_action", { action });
const mutations = response.data.frameworkUpdates?.entityBatchUpdate?.mutations;
const content = mutations?.[0]?.payload?.commentEntityPayload?.translatedContent?.content;
return { ...response, content };
}
setActions(actions) {
__classPrivateFieldSet(this, _CommentView_actions, actions, "f");
}
};
__name(CommentView, "CommentView");
_CommentView_actions = /* @__PURE__ */ new WeakMap();
CommentView.type = "CommentView";
var CommentView_default = CommentView;
// dist/src/parser/classes/comments/CommentThread.js
var _CommentThread_instances;
var _CommentThread_actions;
var _CommentThread_continuation;
var _CommentThread_getPatchedReplies;
var CommentThread = class extends YTNode {
constructor(data2) {
super();
_CommentThread_instances.add(this);
_CommentThread_actions.set(this, void 0);
_CommentThread_continuation.set(this, void 0);
this.comment = parser_exports.parseItem(data2.commentViewModel, CommentView_default);
this.comment_replies_data = parser_exports.parseItem(data2.replies, CommentReplies_default);
this.is_moderated_elq_comment = data2.isModeratedElqComment;
this.has_replies = !!this.comment_replies_data;
}
get has_continuation() {
if (!this.replies)
throw new InnertubeError("Cannot determine if there is a continuation because this thread's replies have not been loaded.");
return !!__classPrivateFieldGet(this, _CommentThread_continuation, "f");
}
async getReplies() {
if (!__classPrivateFieldGet(this, _CommentThread_actions, "f"))
throw new InnertubeError("Actions instance not set for this thread.");
if (!this.comment_replies_data)
throw new InnertubeError("This comment has no replies.", this);
const continuation = this.comment_replies_data.contents?.firstOfType(ContinuationItem_default);
if (!continuation)
throw new InnertubeError("Replies continuation not found.");
const response = await continuation.endpoint.call(__classPrivateFieldGet(this, _CommentThread_actions, "f"), { parse: true });
if (!response.on_response_received_endpoints_memo)
throw new InnertubeError("Unexpected response.", response);
this.replies = __classPrivateFieldGet(this, _CommentThread_instances, "m", _CommentThread_getPatchedReplies).call(this, response.on_response_received_endpoints_memo);
__classPrivateFieldSet(this, _CommentThread_continuation, response.on_response_received_endpoints_memo.getType(ContinuationItem_default)[0], "f");
return this;
}
async getContinuation() {
if (!this.replies)
throw new InnertubeError("Cannot retrieve continuation because this thread's replies have not been loaded.");
if (!__classPrivateFieldGet(this, _CommentThread_continuation, "f"))
throw new InnertubeError("Continuation not found.");
if (!__classPrivateFieldGet(this, _CommentThread_actions, "f"))
throw new InnertubeError("Actions instance not set for this thread.");
const load_more_button = __classPrivateFieldGet(this, _CommentThread_continuation, "f").button?.as(Button_default);
if (!load_more_button)
throw new InnertubeError('"Load more" button not found.');
const response = await load_more_button.endpoint.call(__classPrivateFieldGet(this, _CommentThread_actions, "f"), { parse: true });
if (!response.on_response_received_endpoints_memo)
throw new InnertubeError("Unexpected response.", response);
this.replies = __classPrivateFieldGet(this, _CommentThread_instances, "m", _CommentThread_getPatchedReplies).call(this, response.on_response_received_endpoints_memo);
__classPrivateFieldSet(this, _CommentThread_continuation, response.on_response_received_endpoints_memo.getType(ContinuationItem_default)[0], "f");
return this;
}
setActions(actions) {
__classPrivateFieldSet(this, _CommentThread_actions, actions, "f");
}
};
__name(CommentThread, "CommentThread");
_CommentThread_actions = /* @__PURE__ */ new WeakMap(), _CommentThread_continuation = /* @__PURE__ */ new WeakMap(), _CommentThread_instances = /* @__PURE__ */ new WeakSet(), _CommentThread_getPatchedReplies = /* @__PURE__ */ __name(function _CommentThread_getPatchedReplies2(data2) {
return observe(data2.getType(CommentView_default).map((comment) => {
comment.setActions(__classPrivateFieldGet(this, _CommentThread_actions, "f"));
return comment;
}));
}, "_CommentThread_getPatchedReplies");
CommentThread.type = "CommentThread";
var CommentThread_default = CommentThread;
// dist/src/parser/classes/comments/PdgCommentChip.js
var PdgCommentChip = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.chipText);
this.color_pallette = {
background_color: data2.chipColorPalette?.backgroundColor,
foreground_title_color: data2.chipColorPalette?.foregroundTitleColor
};
if (Reflect.has(data2, "chipIcon") && Reflect.has(data2.chipIcon, "iconType")) {
this.icon_type = data2.chipIcon.iconType;
}
}
};
__name(PdgCommentChip, "PdgCommentChip");
PdgCommentChip.type = "PdgCommentChip";
var PdgCommentChip_default = PdgCommentChip;
// dist/src/parser/classes/comments/SponsorCommentBadge.js
var SponsorCommentBadge = class extends YTNode {
constructor(data2) {
super();
this.custom_badge = Thumbnail.fromResponse(data2.customBadge);
this.tooltip = data2.tooltip;
}
};
__name(SponsorCommentBadge, "SponsorCommentBadge");
SponsorCommentBadge.type = "SponsorCommentBadge";
var SponsorCommentBadge_default = SponsorCommentBadge;
// dist/src/parser/classes/CompactChannel.js
var CompactChannel = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.channel_id = data2.channelId;
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.display_name = new Text(data2.displayName);
this.video_count = new Text(data2.videoCountText);
this.subscriber_count = new Text(data2.subscriberCountText);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.tv_banner = Thumbnail.fromResponse(data2.tvBanner);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
}
};
__name(CompactChannel, "CompactChannel");
CompactChannel.type = "CompactChannel";
var CompactChannel_default = CompactChannel;
// dist/src/parser/classes/PlaylistCustomThumbnail.js
var PlaylistCustomThumbnail = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
}
};
__name(PlaylistCustomThumbnail, "PlaylistCustomThumbnail");
PlaylistCustomThumbnail.type = "PlaylistCustomThumbnail";
var PlaylistCustomThumbnail_default = PlaylistCustomThumbnail;
// dist/src/parser/classes/PlaylistVideoThumbnail.js
var PlaylistVideoThumbnail = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
}
};
__name(PlaylistVideoThumbnail, "PlaylistVideoThumbnail");
PlaylistVideoThumbnail.type = "PlaylistVideoThumbnail";
var PlaylistVideoThumbnail_default = PlaylistVideoThumbnail;
// dist/src/parser/classes/Playlist.js
var Playlist = class extends YTNode {
constructor(data2) {
super();
this.id = data2.playlistId;
this.title = new Text(data2.title);
this.author = data2.shortBylineText?.simpleText ? new Text(data2.shortBylineText) : new Author(data2.longBylineText, data2.ownerBadges, null);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail || { thumbnails: data2.thumbnails.map((th) => th.thumbnails).flat(1) });
this.video_count = new Text(data2.thumbnailText);
this.video_count_short = new Text(data2.videoCountShortText);
this.first_videos = parser_exports.parseArray(data2.videos);
this.share_url = data2.shareUrl || null;
this.menu = parser_exports.parseItem(data2.menu);
this.badges = parser_exports.parseArray(data2.ownerBadges);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
if (Reflect.has(data2, "thumbnailRenderer")) {
this.thumbnail_renderer = parser_exports.parseItem(data2.thumbnailRenderer, [PlaylistVideoThumbnail_default, PlaylistCustomThumbnail_default]) || void 0;
}
if (Reflect.has(data2, "viewPlaylistText")) {
this.view_playlist = new Text(data2.viewPlaylistText);
}
}
};
__name(Playlist, "Playlist");
Playlist.type = "Playlist";
var Playlist_default = Playlist;
// dist/src/parser/classes/CompactMix.js
var CompactMix = class extends Playlist_default {
constructor(data2) {
super(data2);
}
};
__name(CompactMix, "CompactMix");
CompactMix.type = "CompactMix";
var CompactMix_default = CompactMix;
// dist/src/parser/classes/CompactMovie.js
var CompactMovie = class extends YTNode {
constructor(data2) {
super();
const overlay_time_status = data2.thumbnailOverlays.find((overlay) => overlay.thumbnailOverlayTimeStatusRenderer)?.thumbnailOverlayTimeStatusRenderer.text || "N/A";
this.id = data2.videoId;
this.title = new Text(data2.title);
this.top_metadata_items = new Text(data2.topMetadataItems);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
this.author = new Author(data2.shortBylineText);
const durationText = data2.lengthText ? new Text(data2.lengthText).toString() : new Text(overlay_time_status).toString();
this.duration = {
text: durationText,
seconds: timeToSeconds(durationText)
};
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.badges = parser_exports.parseArray(data2.badges);
this.use_vertical_poster = data2.useVerticalPoster;
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
}
};
__name(CompactMovie, "CompactMovie");
CompactMovie.type = "CompactMovie";
var CompactMovie_default = CompactMovie;
// dist/src/parser/classes/CompactPlaylist.js
var CompactPlaylist = class extends Playlist_default {
constructor(data2) {
super(data2);
}
};
__name(CompactPlaylist, "CompactPlaylist");
CompactPlaylist.type = "CompactPlaylist";
var CompactPlaylist_default = CompactPlaylist;
// dist/src/parser/classes/CompactStation.js
var CompactStation = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.description = new Text(data2.description);
this.video_count = new Text(data2.videoCountText);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
}
};
__name(CompactStation, "CompactStation");
CompactStation.type = "CompactStation";
var CompactStation_default = CompactStation;
// dist/src/parser/classes/ConfirmDialog.js
var ConfirmDialog = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.confirm_button = parser_exports.parseItem(data2.confirmButton, Button_default);
this.cancel_button = parser_exports.parseItem(data2.cancelButton, Button_default);
this.dialog_messages = data2.dialogMessages.map((txt) => new Text(txt));
}
};
__name(ConfirmDialog, "ConfirmDialog");
ConfirmDialog.type = "ConfirmDialog";
var ConfirmDialog_default = ConfirmDialog;
// dist/src/parser/classes/ContentMetadataView.js
var ContentMetadataView = class extends YTNode {
constructor(data2) {
super();
this.metadata_rows = data2.metadataRows.map((row) => ({
metadata_parts: row.metadataParts?.map((part) => ({
text: part.text ? Text.fromAttributed(part.text) : null,
avatar_stack: parser_exports.parseItem(part.avatarStack, AvatarStackView_default),
enable_truncation: data2.enableTruncation
}))
}));
this.delimiter = data2.delimiter;
}
};
__name(ContentMetadataView, "ContentMetadataView");
ContentMetadataView.type = "ContentMetadataView";
var ContentMetadataView_default = ContentMetadataView;
// dist/src/parser/classes/Message.js
var Message = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text);
}
};
__name(Message, "Message");
Message.type = "Message";
var Message_default = Message;
// dist/src/parser/classes/ConversationBar.js
var ConversationBar = class extends YTNode {
constructor(data2) {
super();
this.availability_message = parser_exports.parseItem(data2.availabilityMessage, Message_default);
}
};
__name(ConversationBar, "ConversationBar");
ConversationBar.type = "ConversationBar";
var ConversationBar_default = ConversationBar;
// dist/src/parser/classes/CopyLink.js
var CopyLink = class extends YTNode {
constructor(data2) {
super();
this.copy_button = parser_exports.parseItem(data2.copyButton, Button_default);
this.short_url = data2.shortUrl;
this.style = data2.style;
}
};
__name(CopyLink, "CopyLink");
CopyLink.type = "CopyLink";
var CopyLink_default = CopyLink;
// dist/src/parser/classes/DropdownView.js
var DropdownView = class extends YTNode {
constructor(data2) {
super();
this.label = new Text(data2.label);
this.placeholder_text = new Text(data2.placeholderText);
this.disabled = !!data2.disabled;
this.dropdown_type = data2.type;
this.id = data2.id;
if (Reflect.has(data2, "options")) {
this.options = data2.options.map((option) => ({
title: new Text(option.title),
subtitle: new Text(option.subtitle),
leading_image: Thumbnail.fromResponse(option.leadingImage),
value: { privacy_status_value: option.value?.privacyStatusValue },
on_tap: new NavigationEndpoint_default(option.onTap),
is_selected: !!option.isSelected
}));
}
}
};
__name(DropdownView, "DropdownView");
DropdownView.type = "DropdownView";
var DropdownView_default = DropdownView;
// dist/src/parser/classes/TextFieldView.js
var TextFieldView = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "displayProperties")) {
this.display_properties = {
isMultiline: !!data2.displayProperties.isMultiline,
disableNewLines: !!data2.displayProperties.disableNewLines
};
}
if (Reflect.has(data2, "contentProperties")) {
this.content_properties = {
labelText: data2.contentProperties.labelText,
placeholderText: data2.contentProperties.placeholderText,
maxCharacterCount: data2.contentProperties.maxCharacterCount
};
}
if (Reflect.has(data2, "initialState")) {
this.initial_state = {
isFocused: !!data2.initialState.isFocused
};
}
if (Reflect.has(data2, "formFieldMetadata")) {
this.form_field_metadata = {
formId: data2.formFieldMetadata.formId,
fieldId: data2.formFieldMetadata.fieldId
};
}
}
};
__name(TextFieldView, "TextFieldView");
TextFieldView.type = "TextFieldView";
var TextFieldView_default = TextFieldView;
// dist/src/parser/classes/CreatePlaylistDialogFormView.js
var CreatePlaylistDialogFormView = class extends YTNode {
constructor(data2) {
super();
this.playlist_title = parser_exports.parseItem(data2.playlistTitle, TextFieldView_default);
this.playlist_visibility = parser_exports.parseItem(data2.playlistVisibility, DropdownView_default);
this.disable_playlist_collaborate = !!data2.disablePlaylistCollaborate;
this.create_playlist_params_collaboration_enabled = data2.createPlaylistParamsCollaborationEnabled;
this.create_playlist_params_collaboration_disabled = data2.createPlaylistParamsCollaborationDisabled;
this.video_ids = data2.videoIds;
}
};
__name(CreatePlaylistDialogFormView, "CreatePlaylistDialogFormView");
CreatePlaylistDialogFormView.type = "CreatePlaylistDialogFormView";
var CreatePlaylistDialogFormView_default = CreatePlaylistDialogFormView;
// dist/src/parser/classes/DecoratedAvatarView.js
var DecoratedAvatarView = class extends YTNode {
constructor(data2) {
super();
this.avatar = parser_exports.parseItem(data2.avatar, AvatarView_default);
this.a11y_label = data2.a11yLabel;
this.renderer_context = new RendererContext(data2.rendererContext);
}
};
__name(DecoratedAvatarView, "DecoratedAvatarView");
DecoratedAvatarView.type = "DecoratedAvatarView";
var DecoratedAvatarView_default = DecoratedAvatarView;
// dist/src/parser/classes/HeatMarker.js
var HeatMarker = class extends YTNode {
constructor(data2) {
super();
this.time_range_start_millis = data2.timeRangeStartMillis;
this.marker_duration_millis = data2.markerDurationMillis;
this.heat_marker_intensity_score_normalized = data2.heatMarkerIntensityScoreNormalized;
}
};
__name(HeatMarker, "HeatMarker");
HeatMarker.type = "HeatMarker";
var HeatMarker_default = HeatMarker;
// dist/src/parser/classes/Heatmap.js
var Heatmap = class extends YTNode {
constructor(data2) {
super();
this.max_height_dp = data2.maxHeightDp;
this.min_height_dp = data2.minHeightDp;
this.show_hide_animation_duration_millis = data2.showHideAnimationDurationMillis;
this.heat_markers = parser_exports.parseArray(data2.heatMarkers, HeatMarker_default);
this.heat_markers_decorations = parser_exports.parseArray(data2.heatMarkersDecorations);
}
};
__name(Heatmap, "Heatmap");
Heatmap.type = "Heatmap";
var Heatmap_default = Heatmap;
// dist/src/parser/classes/MultiMarkersPlayerBar.js
var Marker = class extends YTNode {
constructor(data2) {
super();
this.marker_key = data2.key;
this.value = {};
if (Reflect.has(data2, "value")) {
if (Reflect.has(data2.value, "heatmap")) {
this.value.heatmap = parser_exports.parseItem(data2.value.heatmap, Heatmap_default);
}
if (Reflect.has(data2.value, "chapters")) {
this.value.chapters = parser_exports.parseArray(data2.value.chapters, Chapter_default);
}
}
}
};
__name(Marker, "Marker");
Marker.type = "Marker";
var MultiMarkersPlayerBar = class extends YTNode {
constructor(data2) {
super();
this.markers_map = observe(data2.markersMap?.map((marker) => new Marker(marker)) || []);
}
};
__name(MultiMarkersPlayerBar, "MultiMarkersPlayerBar");
MultiMarkersPlayerBar.type = "MultiMarkersPlayerBar";
var MultiMarkersPlayerBar_default = MultiMarkersPlayerBar;
// dist/src/parser/classes/DecoratedPlayerBar.js
var DecoratedPlayerBar = class extends YTNode {
constructor(data2) {
super();
this.player_bar = parser_exports.parseItem(data2.playerBar, MultiMarkersPlayerBar_default);
this.player_bar_action_button = parser_exports.parseItem(data2.playerBarActionButton, Button_default);
}
};
__name(DecoratedPlayerBar, "DecoratedPlayerBar");
DecoratedPlayerBar.type = "DecoratedPlayerBar";
var DecoratedPlayerBar_default = DecoratedPlayerBar;
// dist/src/parser/classes/DefaultPromoPanel.js
var DefaultPromoPanel = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.description = new Text(data2.description);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.large_form_factor_background_thumbnail = parser_exports.parseItem(data2.largeFormFactorBackgroundThumbnail);
this.small_form_factor_background_thumbnail = parser_exports.parseItem(data2.smallFormFactorBackgroundThumbnail);
this.scrim_color_values = data2.scrimColorValues;
this.min_panel_display_duration_ms = data2.minPanelDisplayDurationMs;
this.min_video_play_duration_ms = data2.minVideoPlayDurationMs;
this.scrim_duration = data2.scrimDuration;
this.metadata_order = data2.metadataOrder;
this.panel_layout = data2.panelLayout;
}
};
__name(DefaultPromoPanel, "DefaultPromoPanel");
DefaultPromoPanel.type = "DefaultPromoPanel";
var DefaultPromoPanel_default = DefaultPromoPanel;
// dist/src/parser/classes/DescriptionPreviewView.js
var DescriptionPreviewView = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "description"))
this.description = Text.fromAttributed(data2.description);
if (Reflect.has(data2, "maxLines"))
this.max_lines = parseInt(data2.maxLines);
if (Reflect.has(data2, "truncationText"))
this.truncation_text = Text.fromAttributed(data2.truncationText);
this.always_show_truncation_text = !!data2.alwaysShowTruncationText;
if (data2.rendererContext.commandContext?.onTap?.innertubeCommand?.showEngagementPanelEndpoint) {
const endpoint = data2.rendererContext.commandContext?.onTap?.innertubeCommand?.showEngagementPanelEndpoint;
this.more_endpoint = {
show_engagement_panel_endpoint: {
engagement_panel: parser_exports.parseItem(endpoint.engagementPanel, EngagementPanelSectionList_default),
engagement_panel_popup_type: endpoint.engagementPanelPresentationConfigs.engagementPanelPopupPresentationConfig.popupType,
identifier: {
surface: endpoint.identifier.surface,
tag: endpoint.identifier.tag
}
}
};
}
this.renderer_context = new RendererContext(data2.rendererContext);
}
};
__name(DescriptionPreviewView, "DescriptionPreviewView");
DescriptionPreviewView.type = "DescriptionPreviewView";
var DescriptionPreviewView_default = DescriptionPreviewView;
// dist/src/parser/classes/DialogHeaderView.js
var DialogHeaderView = class extends YTNode {
constructor(data2) {
super();
this.headline = Text.fromAttributed(data2.headline);
}
};
__name(DialogHeaderView, "DialogHeaderView");
DialogHeaderView.type = "DialogHeaderView";
var DialogHeaderView_default = DialogHeaderView;
// dist/src/parser/classes/PanelFooterView.js
var PanelFooterView = class extends YTNode {
constructor(data2) {
super();
this.primary_button = parser_exports.parseItem(data2.primaryButton, ButtonView_default);
this.secondary_button = parser_exports.parseItem(data2.secondaryButton, ButtonView_default);
this.should_hide_divider = !!data2.shouldHideDivider;
}
};
__name(PanelFooterView, "PanelFooterView");
PanelFooterView.type = "PanelFooterView";
var PanelFooterView_default = PanelFooterView;
// dist/src/parser/classes/FormFooterView.js
var FormFooterView = class extends YTNode {
constructor(data2) {
super();
this.panel_footer = parser_exports.parseItem(data2.panelFooter, PanelFooterView_default);
this.form_id = data2.formId;
this.container_type = data2.containerType;
}
};
__name(FormFooterView, "FormFooterView");
FormFooterView.type = "FormFooterView";
var FormFooterView_default = FormFooterView;
// dist/src/parser/classes/DialogView.js
var DialogView = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header, DialogHeaderView_default);
this.footer = parser_exports.parseItem(data2.footer, [FormFooterView_default, PanelFooterView_default]);
this.custom_content = parser_exports.parseItem(data2.customContent, CreatePlaylistDialogFormView_default);
}
};
__name(DialogView, "DialogView");
DialogView.type = "DialogView";
var DialogView_default = DialogView;
// dist/src/parser/classes/DidYouMean.js
var DidYouMean = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.didYouMean).toString();
this.corrected_query = new Text(data2.correctedQuery);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint || data2.correctedQueryEndpoint);
}
};
__name(DidYouMean, "DidYouMean");
DidYouMean.type = "DidYouMean";
var DidYouMean_default = DidYouMean;
// dist/src/parser/classes/DynamicTextView.js
var DynamicTextView = class extends YTNode {
constructor(data2) {
super();
this.text = Text.fromAttributed(data2.text);
this.max_lines = parseInt(data2.maxLines);
}
};
__name(DynamicTextView, "DynamicTextView");
DynamicTextView.type = "DynamicTextView";
var DynamicTextView_default = DynamicTextView;
// dist/src/parser/classes/misc/ChildElement.js
var ChildElement = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "type") && Reflect.has(data2.type, "textType")) {
this.text = data2.type.textType.text?.content;
}
this.properties = data2.properties;
if (Reflect.has(data2, "childElements")) {
this.child_elements = data2.childElements.map((el) => new ChildElement(el));
}
}
};
__name(ChildElement, "ChildElement");
ChildElement.type = "ChildElement";
var ChildElement_default = ChildElement;
// dist/src/parser/classes/Element.js
var Element = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "elementRenderer")) {
return parser_exports.parseItem(data2, Element);
}
const type = data2.newElement.type.componentType;
this.model = parser_exports.parseItem(type?.model);
if (Reflect.has(data2, "newElement") && Reflect.has(data2.newElement, "childElements")) {
this.child_elements = observe(data2.newElement.childElements?.map((el) => new ChildElement_default(el)) || []);
}
}
};
__name(Element, "Element");
Element.type = "Element";
var Element_default = Element;
// dist/src/parser/classes/EmergencyOnebox.js
var EmergencyOnebox = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.first_option = parser_exports.parseItem(data2.firstOption);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
}
};
__name(EmergencyOnebox, "EmergencyOnebox");
EmergencyOnebox.type = "EmergencyOnebox";
var EmergencyOnebox_default = EmergencyOnebox;
// dist/src/parser/classes/EmojiPickerCategory.js
var EmojiPickerCategory = class extends YTNode {
constructor(data2) {
super();
this.category_id = data2.categoryId;
this.title = new Text(data2.title);
this.emoji_ids = data2.emojiIds;
this.image_loading_lazy = !!data2.imageLoadingLazy;
this.category_type = data2.categoryType;
}
};
__name(EmojiPickerCategory, "EmojiPickerCategory");
EmojiPickerCategory.type = "EmojiPickerCategory";
var EmojiPickerCategory_default = EmojiPickerCategory;
// dist/src/parser/classes/EmojiPickerCategoryButton.js
var EmojiPickerCategoryButton = class extends YTNode {
constructor(data2) {
super();
this.category_id = data2.categoryId;
if (Reflect.has(data2, "icon")) {
this.icon_type = data2.icon?.iconType;
}
this.tooltip = data2.tooltip;
}
};
__name(EmojiPickerCategoryButton, "EmojiPickerCategoryButton");
EmojiPickerCategoryButton.type = "EmojiPickerCategoryButton";
var EmojiPickerCategoryButton_default = EmojiPickerCategoryButton;
// dist/src/parser/classes/EmojiPickerUpsellCategory.js
var EmojiPickerUpsellCategory = class extends YTNode {
constructor(data2) {
super();
this.category_id = data2.categoryId;
this.title = new Text(data2.title);
this.upsell = new Text(data2.upsell);
this.emoji_tooltip = data2.emojiTooltip;
this.endpoint = new NavigationEndpoint_default(data2.command);
this.emoji_ids = data2.emojiIds;
}
};
__name(EmojiPickerUpsellCategory, "EmojiPickerUpsellCategory");
EmojiPickerUpsellCategory.type = "EmojiPickerUpsellCategory";
var EmojiPickerUpsellCategory_default = EmojiPickerUpsellCategory;
// dist/src/parser/classes/endpoints/AddToPlaylistServiceEndpoint.js
var _AddToPlaylistServiceEndpoint_data;
var API_PATH2 = "playlist/get_add_to_playlist";
var AddToPlaylistServiceEndpoint = class extends YTNode {
constructor(data2) {
super();
_AddToPlaylistServiceEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _AddToPlaylistServiceEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH2;
}
buildRequest() {
const request = {};
request.videoIds = __classPrivateFieldGet(this, _AddToPlaylistServiceEndpoint_data, "f").videoIds ? __classPrivateFieldGet(this, _AddToPlaylistServiceEndpoint_data, "f").videoIds : [__classPrivateFieldGet(this, _AddToPlaylistServiceEndpoint_data, "f").videoId];
if (__classPrivateFieldGet(this, _AddToPlaylistServiceEndpoint_data, "f").playlistId)
request.playlistId = __classPrivateFieldGet(this, _AddToPlaylistServiceEndpoint_data, "f").playlistId;
if (__classPrivateFieldGet(this, _AddToPlaylistServiceEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _AddToPlaylistServiceEndpoint_data, "f").params;
request.excludeWatchLater = !!__classPrivateFieldGet(this, _AddToPlaylistServiceEndpoint_data, "f").excludeWatchLater;
return request;
}
};
__name(AddToPlaylistServiceEndpoint, "AddToPlaylistServiceEndpoint");
_AddToPlaylistServiceEndpoint_data = /* @__PURE__ */ new WeakMap();
AddToPlaylistServiceEndpoint.type = "AddToPlaylistServiceEndpoint";
var AddToPlaylistServiceEndpoint_default = AddToPlaylistServiceEndpoint;
// dist/src/parser/classes/endpoints/AddToPlaylistEndpoint.js
var AddToPlaylistEndpoint = class extends AddToPlaylistServiceEndpoint_default {
constructor(data2) {
super(data2);
}
};
__name(AddToPlaylistEndpoint, "AddToPlaylistEndpoint");
AddToPlaylistEndpoint.type = "AddToPlaylistEndpoint";
var AddToPlaylistEndpoint_default = AddToPlaylistEndpoint;
// dist/src/parser/classes/endpoints/BrowseEndpoint.js
var _BrowseEndpoint_data;
var API_PATH3 = "browse";
var BrowseEndpoint = class extends YTNode {
constructor(data2) {
super();
_BrowseEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _BrowseEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH3;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _BrowseEndpoint_data, "f").browseId)
request.browseId = __classPrivateFieldGet(this, _BrowseEndpoint_data, "f").browseId;
if (__classPrivateFieldGet(this, _BrowseEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _BrowseEndpoint_data, "f").params;
if (__classPrivateFieldGet(this, _BrowseEndpoint_data, "f").query)
request.query = __classPrivateFieldGet(this, _BrowseEndpoint_data, "f").query;
if (__classPrivateFieldGet(this, _BrowseEndpoint_data, "f").browseId === "FEsubscriptions") {
request.subscriptionSettingsState = __classPrivateFieldGet(this, _BrowseEndpoint_data, "f").subscriptionSettingsState || "MY_SUBS_SETTINGS_STATE_LAYOUT_FORMAT_LIST";
}
if (__classPrivateFieldGet(this, _BrowseEndpoint_data, "f").browseId === "SPaccount_playback") {
request.formData = __classPrivateFieldGet(this, _BrowseEndpoint_data, "f").formData || {
accountSettingsFormData: {
flagCaptionsDefaultOff: false,
flagAutoCaptionsDefaultOn: false,
flagDisableInlinePreview: false,
flagAudioDescriptionDefaultOn: false
}
};
}
if (__classPrivateFieldGet(this, _BrowseEndpoint_data, "f").browseId === "FEwhat_to_watch") {
if (__classPrivateFieldGet(this, _BrowseEndpoint_data, "f").browseRequestSupportedMetadata)
request.browseRequestSupportedMetadata = __classPrivateFieldGet(this, _BrowseEndpoint_data, "f").browseRequestSupportedMetadata;
if (__classPrivateFieldGet(this, _BrowseEndpoint_data, "f").inlineSettingStatus)
request.inlineSettingStatus = __classPrivateFieldGet(this, _BrowseEndpoint_data, "f").inlineSettingStatus;
}
return request;
}
};
__name(BrowseEndpoint, "BrowseEndpoint");
_BrowseEndpoint_data = /* @__PURE__ */ new WeakMap();
BrowseEndpoint.type = "BrowseEndpoint";
var BrowseEndpoint_default = BrowseEndpoint;
// dist/src/parser/classes/endpoints/CreateCommentEndpoint.js
var _CreateCommentEndpoint_data;
var API_PATH4 = "comment/create_comment";
var CreateCommentEndpoint = class extends YTNode {
constructor(data2) {
super();
_CreateCommentEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _CreateCommentEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH4;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").createCommentParams)
request.createCommentParams = __classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").createCommentParams;
if (__classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").commentText)
request.commentText = __classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").commentText;
if (__classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").attachedVideoId)
request.videoAttachment = { videoId: __classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").attachedVideoId };
else if (__classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").pollOptions)
request.pollAttachment = { choices: __classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").pollOptions };
else if (__classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").imageBlobId)
request.imageAttachment = { encryptedBlobId: __classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").imageBlobId };
else if (__classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").sharedPostId)
request.sharedPostAttachment = { postId: __classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").sharedPostId };
if (__classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").accessRestrictions && typeof __classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").accessRestrictions === "number") {
const restriction = __classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").accessRestrictions === 1 ? "RESTRICTION_TYPE_EVERYONE" : "RESTRICTION_TYPE_SPONSORS_ONLY";
request.accessRestrictions = { restriction };
}
if (__classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").botguardResponse)
request.botguardResponse = __classPrivateFieldGet(this, _CreateCommentEndpoint_data, "f").botguardResponse;
return request;
}
};
__name(CreateCommentEndpoint, "CreateCommentEndpoint");
_CreateCommentEndpoint_data = /* @__PURE__ */ new WeakMap();
CreateCommentEndpoint.type = "CreateCommentEndpoint";
var CreateCommentEndpoint_default = CreateCommentEndpoint;
// dist/src/parser/classes/endpoints/CreatePlaylistServiceEndpoint.js
var _CreatePlaylistServiceEndpoint_data;
var API_PATH5 = "playlist/create";
var CreatePlaylistServiceEndpoint = class extends YTNode {
constructor(data2) {
super();
_CreatePlaylistServiceEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _CreatePlaylistServiceEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH5;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").title)
request.title = __classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").title;
if (__classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").privacyStatus)
request.privacyStatus = __classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").privacyStatus;
if (__classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").description)
request.description = __classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").description;
if (__classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").videoIds)
request.videoIds = __classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").videoIds;
if (__classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").params;
if (__classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").sourcePlaylistId)
request.sourcePlaylistId = __classPrivateFieldGet(this, _CreatePlaylistServiceEndpoint_data, "f").sourcePlaylistId;
return request;
}
};
__name(CreatePlaylistServiceEndpoint, "CreatePlaylistServiceEndpoint");
_CreatePlaylistServiceEndpoint_data = /* @__PURE__ */ new WeakMap();
CreatePlaylistServiceEndpoint.type = "CreatePlaylistServiceEndpoint";
var CreatePlaylistServiceEndpoint_default = CreatePlaylistServiceEndpoint;
// dist/src/parser/classes/endpoints/DeletePlaylistEndpoint.js
var _DeletePlaylistEndpoint_data;
var API_PATH6 = "playlist/delete";
var DeletePlaylistEndpoint = class extends YTNode {
constructor(data2) {
super();
_DeletePlaylistEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _DeletePlaylistEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH6;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _DeletePlaylistEndpoint_data, "f").playlistId)
request.playlistId = __classPrivateFieldGet(this, _DeletePlaylistEndpoint_data, "f").sourcePlaylistId;
return request;
}
};
__name(DeletePlaylistEndpoint, "DeletePlaylistEndpoint");
_DeletePlaylistEndpoint_data = /* @__PURE__ */ new WeakMap();
DeletePlaylistEndpoint.type = "DeletePlaylistEndpoint";
var DeletePlaylistEndpoint_default = DeletePlaylistEndpoint;
// dist/src/parser/classes/endpoints/FeedbackEndpoint.js
var _FeedbackEndpoint_data;
var API_PATH7 = "feedback";
var FeedbackEndpoint = class extends YTNode {
constructor(data2) {
super();
_FeedbackEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _FeedbackEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH7;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _FeedbackEndpoint_data, "f").feedbackToken)
request.feedbackTokens = [__classPrivateFieldGet(this, _FeedbackEndpoint_data, "f").feedbackToken];
if (__classPrivateFieldGet(this, _FeedbackEndpoint_data, "f").cpn)
request.feedbackContext = { cpn: __classPrivateFieldGet(this, _FeedbackEndpoint_data, "f").cpn };
request.isFeedbackTokenUnencrypted = !!__classPrivateFieldGet(this, _FeedbackEndpoint_data, "f").isFeedbackTokenUnencrypted;
request.shouldMerge = !!__classPrivateFieldGet(this, _FeedbackEndpoint_data, "f").shouldMerge;
return request;
}
};
__name(FeedbackEndpoint, "FeedbackEndpoint");
_FeedbackEndpoint_data = /* @__PURE__ */ new WeakMap();
FeedbackEndpoint.type = "FeedbackEndpoint";
var FeedbackEndpoint_default = FeedbackEndpoint;
// dist/src/parser/classes/endpoints/GetAccountsListInnertubeEndpoint.js
var _GetAccountsListInnertubeEndpoint_data;
var API_PATH8 = "account/accounts_list";
var GetAccountsListInnertubeEndpoint = class extends YTNode {
constructor(data2) {
super();
_GetAccountsListInnertubeEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _GetAccountsListInnertubeEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH8;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").requestType) {
request.requestType = __classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").requestType;
if (__classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").requestType === "ACCOUNTS_LIST_REQUEST_TYPE_CHANNEL_SWITCHER" || __classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").requestType === "ACCOUNTS_LIST_REQUEST_TYPE_IDENTITY_PROMPT") {
if (__classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").nextUrl)
request.nextNavendpoint = {
urlEndpoint: {
url: __classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").nextUrl
}
};
}
}
if (__classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").channelSwitcherQuery)
request.channelSwitcherQuery = __classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").channelSwitcherQuery;
if (__classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").triggerChannelCreation)
request.triggerChannelCreation = __classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").triggerChannelCreation;
if (__classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").contentOwnerConfig && __classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").contentOwnerConfig.externalContentOwnerId)
request.contentOwnerConfig = __classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").contentOwnerConfig;
if (__classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").obfuscatedSelectedGaiaId)
request.obfuscatedSelectedGaiaId = __classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").obfuscatedSelectedGaiaId;
if (__classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").selectedSerializedDelegationContext)
request.selectedSerializedDelegationContext = __classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").selectedSerializedDelegationContext;
if (__classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").callCircumstance)
request.callCircumstance = __classPrivateFieldGet(this, _GetAccountsListInnertubeEndpoint_data, "f").callCircumstance;
return request;
}
};
__name(GetAccountsListInnertubeEndpoint, "GetAccountsListInnertubeEndpoint");
_GetAccountsListInnertubeEndpoint_data = /* @__PURE__ */ new WeakMap();
GetAccountsListInnertubeEndpoint.type = "GetAccountsListInnertubeEndpoint";
var GetAccountsListInnertubeEndpoint_default = GetAccountsListInnertubeEndpoint;
// dist/src/parser/classes/endpoints/HideEngagementPanelEndpoint.js
var HideEngagementPanelEndpoint = class extends YTNode {
constructor(data2) {
super();
this.panel_identifier = data2.panelIdentifier;
}
};
__name(HideEngagementPanelEndpoint, "HideEngagementPanelEndpoint");
HideEngagementPanelEndpoint.type = "HideEngagementPanelEndpoint";
var HideEngagementPanelEndpoint_default = HideEngagementPanelEndpoint;
// dist/src/parser/classes/endpoints/LikeEndpoint.js
var _LikeEndpoint_data;
var LIKE_API_PATH = "like/like";
var DISLIKE_API_PATH = "like/dislike";
var REMOVE_LIKE_API_PATH = "like/removelike";
var LikeEndpoint = class extends YTNode {
constructor(data2) {
super();
_LikeEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _LikeEndpoint_data, data2, "f");
}
getApiPath() {
return __classPrivateFieldGet(this, _LikeEndpoint_data, "f").status === "DISLIKE" ? DISLIKE_API_PATH : __classPrivateFieldGet(this, _LikeEndpoint_data, "f").status === "INDIFFERENT" ? REMOVE_LIKE_API_PATH : LIKE_API_PATH;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _LikeEndpoint_data, "f").target)
request.target = __classPrivateFieldGet(this, _LikeEndpoint_data, "f").target;
const params = this.getParams();
if (params)
request.params = params;
return request;
}
getParams() {
switch (__classPrivateFieldGet(this, _LikeEndpoint_data, "f").status) {
case "LIKE":
return __classPrivateFieldGet(this, _LikeEndpoint_data, "f").likeParams;
case "DISLIKE":
return __classPrivateFieldGet(this, _LikeEndpoint_data, "f").dislikeParams;
case "INDIFFERENT":
return __classPrivateFieldGet(this, _LikeEndpoint_data, "f").removeLikeParams;
default:
return void 0;
}
}
};
__name(LikeEndpoint, "LikeEndpoint");
_LikeEndpoint_data = /* @__PURE__ */ new WeakMap();
LikeEndpoint.type = "LikeEndpoint";
var LikeEndpoint_default = LikeEndpoint;
// dist/src/parser/classes/endpoints/LiveChatItemContextMenuEndpoint.js
var _LiveChatItemContextMenuEndpoint_data;
var API_PATH9 = "live_chat/get_item_context_menu";
var LiveChatItemContextMenuEndpoint = class extends YTNode {
constructor(data2) {
super();
_LiveChatItemContextMenuEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _LiveChatItemContextMenuEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH9;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _LiveChatItemContextMenuEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _LiveChatItemContextMenuEndpoint_data, "f").params;
return request;
}
};
__name(LiveChatItemContextMenuEndpoint, "LiveChatItemContextMenuEndpoint");
_LiveChatItemContextMenuEndpoint_data = /* @__PURE__ */ new WeakMap();
LiveChatItemContextMenuEndpoint.type = "LiveChatItemContextMenuEndpoint";
var LiveChatItemContextMenuEndpoint_default = LiveChatItemContextMenuEndpoint;
// dist/src/parser/classes/endpoints/ModifyChannelNotificationPreferenceEndpoint.js
var _ModifyChannelNotificationPreferenceEndpoint_data;
var API_PATH10 = "notification/modify_channel_preference";
var ModifyChannelNotificationPreferenceEndpoint = class extends YTNode {
constructor(data2) {
super();
_ModifyChannelNotificationPreferenceEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _ModifyChannelNotificationPreferenceEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH10;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _ModifyChannelNotificationPreferenceEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _ModifyChannelNotificationPreferenceEndpoint_data, "f").params;
if (__classPrivateFieldGet(this, _ModifyChannelNotificationPreferenceEndpoint_data, "f").secondaryParams)
request.secondaryParams = __classPrivateFieldGet(this, _ModifyChannelNotificationPreferenceEndpoint_data, "f").secondaryParams;
return request;
}
};
__name(ModifyChannelNotificationPreferenceEndpoint, "ModifyChannelNotificationPreferenceEndpoint");
_ModifyChannelNotificationPreferenceEndpoint_data = /* @__PURE__ */ new WeakMap();
ModifyChannelNotificationPreferenceEndpoint.type = "ModifyChannelNotificationPreferenceEndpoint";
var ModifyChannelNotificationPreferenceEndpoint_default = ModifyChannelNotificationPreferenceEndpoint;
// dist/src/parser/classes/endpoints/PerformCommentActionEndpoint.js
var _PerformCommentActionEndpoint_data;
var API_PATH11 = "comment/perform_comment_action";
var PerformCommentActionEndpoint = class extends YTNode {
constructor(data2) {
super();
_PerformCommentActionEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _PerformCommentActionEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH11;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _PerformCommentActionEndpoint_data, "f").actions)
request.actions = __classPrivateFieldGet(this, _PerformCommentActionEndpoint_data, "f").actions;
if (__classPrivateFieldGet(this, _PerformCommentActionEndpoint_data, "f").action)
request.actions = [__classPrivateFieldGet(this, _PerformCommentActionEndpoint_data, "f").action];
return request;
}
};
__name(PerformCommentActionEndpoint, "PerformCommentActionEndpoint");
_PerformCommentActionEndpoint_data = /* @__PURE__ */ new WeakMap();
PerformCommentActionEndpoint.type = "PerformCommentActionEndpoint";
var PerformCommentActionEndpoint_default = PerformCommentActionEndpoint;
// dist/src/parser/classes/endpoints/PlaylistEditEndpoint.js
var _PlaylistEditEndpoint_data;
var API_PATH12 = "browse/edit_playlist";
var PlaylistEditEndpoint = class extends YTNode {
constructor(data2) {
super();
_PlaylistEditEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _PlaylistEditEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH12;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _PlaylistEditEndpoint_data, "f").actions)
request.actions = __classPrivateFieldGet(this, _PlaylistEditEndpoint_data, "f").actions;
if (__classPrivateFieldGet(this, _PlaylistEditEndpoint_data, "f").playlistId)
request.playlistId = __classPrivateFieldGet(this, _PlaylistEditEndpoint_data, "f").playlistId;
if (__classPrivateFieldGet(this, _PlaylistEditEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _PlaylistEditEndpoint_data, "f").params;
return request;
}
};
__name(PlaylistEditEndpoint, "PlaylistEditEndpoint");
_PlaylistEditEndpoint_data = /* @__PURE__ */ new WeakMap();
PlaylistEditEndpoint.type = "PlaylistEditEndpoint";
var PlaylistEditEndpoint_default = PlaylistEditEndpoint;
// dist/src/parser/classes/endpoints/WatchEndpoint.js
var _WatchEndpoint_data;
var API_PATH13 = "player";
var WatchEndpoint = class extends YTNode {
constructor(data2) {
super();
_WatchEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _WatchEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH13;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _WatchEndpoint_data, "f").videoId)
request.videoId = __classPrivateFieldGet(this, _WatchEndpoint_data, "f").videoId;
if (__classPrivateFieldGet(this, _WatchEndpoint_data, "f").playlistId)
request.playlistId = __classPrivateFieldGet(this, _WatchEndpoint_data, "f").playlistId;
if (__classPrivateFieldGet(this, _WatchEndpoint_data, "f").index !== void 0 || __classPrivateFieldGet(this, _WatchEndpoint_data, "f").playlistIndex !== void 0)
request.playlistIndex = __classPrivateFieldGet(this, _WatchEndpoint_data, "f").index || __classPrivateFieldGet(this, _WatchEndpoint_data, "f").playlistIndex;
if (__classPrivateFieldGet(this, _WatchEndpoint_data, "f").playerParams || __classPrivateFieldGet(this, _WatchEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _WatchEndpoint_data, "f").playerParams || __classPrivateFieldGet(this, _WatchEndpoint_data, "f").params;
if (__classPrivateFieldGet(this, _WatchEndpoint_data, "f").startTimeSeconds)
request.startTimeSecs = __classPrivateFieldGet(this, _WatchEndpoint_data, "f").startTimeSeconds;
if (__classPrivateFieldGet(this, _WatchEndpoint_data, "f").overrideMutedAtStart)
request.overrideMutedAtStart = __classPrivateFieldGet(this, _WatchEndpoint_data, "f").overrideMutedAtStart;
request.racyCheckOk = !!__classPrivateFieldGet(this, _WatchEndpoint_data, "f").racyCheckOk;
request.contentCheckOk = !!__classPrivateFieldGet(this, _WatchEndpoint_data, "f").contentCheckOk;
return request;
}
};
__name(WatchEndpoint, "WatchEndpoint");
_WatchEndpoint_data = /* @__PURE__ */ new WeakMap();
WatchEndpoint.type = "WatchEndpoint";
var WatchEndpoint_default = WatchEndpoint;
// dist/src/parser/classes/endpoints/PrefetchWatchCommand.js
var PrefetchWatchCommand = class extends WatchEndpoint_default {
constructor(data2) {
super(data2);
}
};
__name(PrefetchWatchCommand, "PrefetchWatchCommand");
PrefetchWatchCommand.type = "PrefetchWatchCommand";
var PrefetchWatchCommand_default = PrefetchWatchCommand;
// dist/src/parser/classes/endpoints/ReelWatchEndpoint.js
var _ReelWatchEndpoint_data;
var API_PATH14 = "reel/reel_item_watch";
var ReelWatchEndpoint = class extends YTNode {
constructor(data2) {
super();
_ReelWatchEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _ReelWatchEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH14;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").videoId) {
request.playerRequest = {
videoId: __classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").videoId
};
}
if (request.playerRequest) {
if (__classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").playerParams)
request.playerRequest.params = __classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").playerParams;
if (__classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").racyCheckOk)
request.playerRequest.racyCheckOk = !!__classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").racyCheckOk;
if (__classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").contentCheckOk)
request.playerRequest.contentCheckOk = !!__classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").contentCheckOk;
}
if (__classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").params;
if (__classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").inputType)
request.inputType = __classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").inputType;
request.disablePlayerResponse = !!__classPrivateFieldGet(this, _ReelWatchEndpoint_data, "f").disablePlayerResponse;
return request;
}
};
__name(ReelWatchEndpoint, "ReelWatchEndpoint");
_ReelWatchEndpoint_data = /* @__PURE__ */ new WeakMap();
ReelWatchEndpoint.type = "ReelWatchEndpoint";
var ReelWatchEndpoint_default = ReelWatchEndpoint;
// dist/src/parser/classes/endpoints/SearchEndpoint.js
var _SearchEndpoint_data;
var API_PATH15 = "search";
var SearchEndpoint = class extends YTNode {
constructor(data2) {
super();
_SearchEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _SearchEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH15;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _SearchEndpoint_data, "f").query)
request.query = __classPrivateFieldGet(this, _SearchEndpoint_data, "f").query;
if (__classPrivateFieldGet(this, _SearchEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _SearchEndpoint_data, "f").params;
if (__classPrivateFieldGet(this, _SearchEndpoint_data, "f").webSearchboxStatsUrl)
request.webSearchboxStatsUrl = __classPrivateFieldGet(this, _SearchEndpoint_data, "f").webSearchboxStatsUrl;
if (__classPrivateFieldGet(this, _SearchEndpoint_data, "f").suggestStats)
request.suggestStats = __classPrivateFieldGet(this, _SearchEndpoint_data, "f").suggestStats;
return request;
}
};
__name(SearchEndpoint, "SearchEndpoint");
_SearchEndpoint_data = /* @__PURE__ */ new WeakMap();
SearchEndpoint.type = "SearchEndpoint";
var SearchEndpoint_default = SearchEndpoint;
// dist/src/parser/classes/endpoints/ShareEntityServiceEndpoint.js
var _ShareEntityServiceEndpoint_data;
var API_PATH16 = "share/get_share_panel";
var ShareEntityServiceEndpoint = class extends YTNode {
constructor(data2) {
super();
_ShareEntityServiceEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _ShareEntityServiceEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH16;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _ShareEntityServiceEndpoint_data, "f").serializedShareEntity)
request.serializedSharedEntity = __classPrivateFieldGet(this, _ShareEntityServiceEndpoint_data, "f").serializedShareEntity;
if (__classPrivateFieldGet(this, _ShareEntityServiceEndpoint_data, "f").clientParams)
request.clientParams = __classPrivateFieldGet(this, _ShareEntityServiceEndpoint_data, "f").clientParams;
return request;
}
};
__name(ShareEntityServiceEndpoint, "ShareEntityServiceEndpoint");
_ShareEntityServiceEndpoint_data = /* @__PURE__ */ new WeakMap();
ShareEntityServiceEndpoint.type = "ShareEntityServiceEndpoint";
var ShareEntityServiceEndpoint_default = ShareEntityServiceEndpoint;
// dist/src/parser/classes/endpoints/ShareEndpoint.js
var ShareEndpoint = class extends ShareEntityServiceEndpoint_default {
constructor(data2) {
super(data2);
}
};
__name(ShareEndpoint, "ShareEndpoint");
ShareEndpoint.type = "ShareEndpoint";
var ShareEndpoint_default = ShareEndpoint;
// dist/src/parser/classes/endpoints/ShareEntityEndpoint.js
var ShareEntityEndpoint = class extends ShareEntityServiceEndpoint_default {
constructor(data2) {
super(data2);
}
};
__name(ShareEntityEndpoint, "ShareEntityEndpoint");
ShareEntityEndpoint.type = "ShareEntityEndpoint";
var ShareEntityEndpoint_default = ShareEntityEndpoint;
// dist/src/parser/classes/endpoints/ShowEngagementPanelEndpoint.js
var ShowEngagementPanelEndpoint = class extends YTNode {
constructor(data2) {
super();
this.panel_identifier = data2.panelIdentifier;
this.source_panel_identifier = data2.sourcePanelIdentifier;
}
};
__name(ShowEngagementPanelEndpoint, "ShowEngagementPanelEndpoint");
ShowEngagementPanelEndpoint.type = "ShowEngagementPanelEndpoint";
var ShowEngagementPanelEndpoint_default = ShowEngagementPanelEndpoint;
// dist/src/parser/classes/endpoints/SignalServiceEndpoint.js
var SignalServiceEndpoint = class extends YTNode {
constructor(data2) {
super();
if (Array.isArray(data2.actions)) {
this.actions = parser_exports.parseArray(data2.actions.map((action) => {
delete action.clickTrackingParams;
return action;
}));
}
this.signal = data2.signal;
}
};
__name(SignalServiceEndpoint, "SignalServiceEndpoint");
SignalServiceEndpoint.type = "SignalServiceEndpoint";
var SignalServiceEndpoint_default = SignalServiceEndpoint;
// dist/src/parser/classes/endpoints/SubscribeEndpoint.js
var _SubscribeEndpoint_data;
var API_PATH17 = "subscription/subscribe";
var SubscribeEndpoint = class extends YTNode {
constructor(data2) {
super();
_SubscribeEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _SubscribeEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH17;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _SubscribeEndpoint_data, "f").channelIds)
request.channelIds = __classPrivateFieldGet(this, _SubscribeEndpoint_data, "f").channelIds;
if (__classPrivateFieldGet(this, _SubscribeEndpoint_data, "f").siloName)
request.siloName = __classPrivateFieldGet(this, _SubscribeEndpoint_data, "f").siloName;
if (__classPrivateFieldGet(this, _SubscribeEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _SubscribeEndpoint_data, "f").params;
if (__classPrivateFieldGet(this, _SubscribeEndpoint_data, "f").botguardResponse)
request.botguardResponse = __classPrivateFieldGet(this, _SubscribeEndpoint_data, "f").botguardResponse;
if (__classPrivateFieldGet(this, _SubscribeEndpoint_data, "f").feature)
request.clientFeature = __classPrivateFieldGet(this, _SubscribeEndpoint_data, "f").feature;
return request;
}
};
__name(SubscribeEndpoint, "SubscribeEndpoint");
_SubscribeEndpoint_data = /* @__PURE__ */ new WeakMap();
SubscribeEndpoint.type = "SubscribeEndpoint";
var SubscribeEndpoint_default = SubscribeEndpoint;
// dist/src/parser/classes/endpoints/UnsubscribeEndpoint.js
var _UnsubscribeEndpoint_data;
var API_PATH18 = "subscription/unsubscribe";
var UnsubscribeEndpoint = class extends YTNode {
constructor(data2) {
super();
_UnsubscribeEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _UnsubscribeEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH18;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _UnsubscribeEndpoint_data, "f").channelIds)
request.channelIds = __classPrivateFieldGet(this, _UnsubscribeEndpoint_data, "f").channelIds;
if (__classPrivateFieldGet(this, _UnsubscribeEndpoint_data, "f").siloName)
request.siloName = __classPrivateFieldGet(this, _UnsubscribeEndpoint_data, "f").siloName;
if (__classPrivateFieldGet(this, _UnsubscribeEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _UnsubscribeEndpoint_data, "f").params;
return request;
}
};
__name(UnsubscribeEndpoint, "UnsubscribeEndpoint");
_UnsubscribeEndpoint_data = /* @__PURE__ */ new WeakMap();
UnsubscribeEndpoint.type = "UnsubscribeEndpoint";
var UnsubscribeEndpoint_default = UnsubscribeEndpoint;
// dist/src/parser/classes/endpoints/WatchNextEndpoint.js
var _WatchNextEndpoint_data;
var API_PATH19 = "next";
var WatchNextEndpoint = class extends YTNode {
constructor(data2) {
super();
_WatchNextEndpoint_data.set(this, void 0);
__classPrivateFieldSet(this, _WatchNextEndpoint_data, data2, "f");
}
getApiPath() {
return API_PATH19;
}
buildRequest() {
const request = {};
if (__classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").videoId)
request.videoId = __classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").videoId;
if (__classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").playlistId)
request.playlistId = __classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").playlistId;
if (__classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").index !== void 0 || __classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").playlistIndex !== void 0)
request.playlistIndex = __classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").index || __classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").playlistIndex;
if (__classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").playerParams || __classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").params)
request.params = __classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").playerParams || __classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").params;
request.racyCheckOk = !!__classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").racyCheckOk;
request.contentCheckOk = !!__classPrivateFieldGet(this, _WatchNextEndpoint_data, "f").contentCheckOk;
return request;
}
};
__name(WatchNextEndpoint, "WatchNextEndpoint");
_WatchNextEndpoint_data = /* @__PURE__ */ new WeakMap();
WatchNextEndpoint.type = "WatchNextEndpoint";
var WatchNextEndpoint_default = WatchNextEndpoint;
// dist/src/parser/classes/Endscreen.js
var Endscreen = class extends YTNode {
constructor(data2) {
super();
this.elements = parser_exports.parseArray(data2.elements);
this.start_ms = data2.startMs;
}
};
__name(Endscreen, "Endscreen");
Endscreen.type = "Endscreen";
var Endscreen_default = Endscreen;
// dist/src/parser/classes/EndscreenElement.js
var EndscreenElement = class extends YTNode {
constructor(data2) {
super();
this.style = data2.style;
this.title = new Text(data2.title);
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
if (Reflect.has(data2, "image")) {
this.image = Thumbnail.fromResponse(data2.image);
}
if (Reflect.has(data2, "icon")) {
this.icon = Thumbnail.fromResponse(data2.icon);
}
if (Reflect.has(data2, "metadata")) {
this.metadata = new Text(data2.metadata);
}
if (Reflect.has(data2, "callToAction")) {
this.call_to_action = new Text(data2.callToAction);
}
if (Reflect.has(data2, "hovercardButton")) {
this.hovercard_button = parser_exports.parseItem(data2.hovercardButton);
}
if (Reflect.has(data2, "isSubscribe")) {
this.is_subscribe = !!data2.isSubscribe;
}
if (Reflect.has(data2, "playlistLength")) {
this.playlist_length = new Text(data2.playlistLength);
}
if (Reflect.has(data2, "thumbnailOverlays")) {
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
}
this.left = parseFloat(data2.left);
this.width = parseFloat(data2.width);
this.top = parseFloat(data2.top);
this.aspect_ratio = parseFloat(data2.aspectRatio);
this.start_ms = parseFloat(data2.startMs);
this.end_ms = parseFloat(data2.endMs);
this.id = data2.id;
}
};
__name(EndscreenElement, "EndscreenElement");
EndscreenElement.type = "EndscreenElement";
var EndscreenElement_default = EndscreenElement;
// dist/src/parser/classes/EndScreenPlaylist.js
var EndScreenPlaylist = class extends YTNode {
constructor(data2) {
super();
this.id = data2.playlistId;
this.title = new Text(data2.title);
this.author = new Text(data2.longBylineText);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.video_count = new Text(data2.videoCountText);
}
};
__name(EndScreenPlaylist, "EndScreenPlaylist");
EndScreenPlaylist.type = "EndScreenPlaylist";
var EndScreenPlaylist_default = EndScreenPlaylist;
// dist/src/parser/classes/EndScreenVideo.js
var EndScreenVideo = class extends YTNode {
constructor(data2) {
super();
this.id = data2.videoId;
this.title = new Text(data2.title);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
this.author = new Author(data2.shortBylineText, data2.ownerBadges);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.short_view_count = new Text(data2.shortViewCountText);
this.badges = parser_exports.parseArray(data2.badges);
this.duration = {
text: new Text(data2.lengthText).toString(),
seconds: data2.lengthInSeconds
};
}
};
__name(EndScreenVideo, "EndScreenVideo");
EndScreenVideo.type = "EndScreenVideo";
var EndScreenVideo_default = EndScreenVideo;
// dist/src/parser/classes/EomSettingsDisclaimer.js
var EomSettingsDisclaimer = class extends YTNode {
constructor(data2) {
super();
this.disclaimer = new Text(data2.disclaimer);
this.info_icon = {
icon_type: data2.infoIcon.iconType
};
this.usage_scenario = data2.usageScenario;
}
};
__name(EomSettingsDisclaimer, "EomSettingsDisclaimer");
EomSettingsDisclaimer.type = "EomSettingsDisclaimer";
var EomSettingsDisclaimer_default = EomSettingsDisclaimer;
// dist/src/parser/classes/ExpandableTab.js
var ExpandableTab = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title;
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
this.selected = data2.selected;
this.content = parser_exports.parseItem(data2.content);
}
};
__name(ExpandableTab, "ExpandableTab");
ExpandableTab.type = "ExpandableTab";
var ExpandableTab_default = ExpandableTab;
// dist/src/parser/classes/ExpandedShelfContents.js
var ExpandedShelfContents = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
}
get contents() {
return this.items;
}
};
__name(ExpandedShelfContents, "ExpandedShelfContents");
ExpandedShelfContents.type = "ExpandedShelfContents";
var ExpandedShelfContents_default = ExpandedShelfContents;
// dist/src/parser/classes/FancyDismissibleDialog.js
var FancyDismissibleDialog = class extends YTNode {
constructor(data2) {
super();
this.dialog_message = new Text(data2.dialogMessage);
this.confirm_label = new Text(data2.confirmLabel);
}
};
__name(FancyDismissibleDialog, "FancyDismissibleDialog");
FancyDismissibleDialog.type = "FancyDismissibleDialog";
var FancyDismissibleDialog_default = FancyDismissibleDialog;
// dist/src/parser/classes/FeedFilterChipBar.js
var FeedFilterChipBar = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents, ChipCloudChip_default);
}
};
__name(FeedFilterChipBar, "FeedFilterChipBar");
FeedFilterChipBar.type = "FeedFilterChipBar";
var FeedFilterChipBar_default = FeedFilterChipBar;
// dist/src/parser/classes/FeedNudge.js
var FeedNudge = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.subtitle = new Text(data2.subtitle);
this.endpoint = new NavigationEndpoint_default(data2.impressionEndpoint);
this.apply_modernized_style = data2.applyModernizedStyle;
this.trim_style = data2.trimStyle;
this.background_style = data2.backgroundStyle;
}
};
__name(FeedNudge, "FeedNudge");
FeedNudge.type = "FeedNudge";
var FeedNudge_default = FeedNudge;
// dist/src/parser/classes/FeedTabbedHeader.js
var FeedTabbedHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
}
};
__name(FeedTabbedHeader, "FeedTabbedHeader");
FeedTabbedHeader.type = "FeedTabbedHeader";
var FeedTabbedHeader_default = FeedTabbedHeader;
// dist/src/parser/classes/GameDetails.js
var GameDetails = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.box_art = Thumbnail.fromResponse(data2.boxArt);
this.box_art_overlay_text = new Text(data2.boxArtOverlayText);
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
this.is_official_box_art = !!data2.isOfficialBoxArt;
}
};
__name(GameDetails, "GameDetails");
GameDetails.type = "GameDetails";
var GameDetails_default = GameDetails;
// dist/src/parser/classes/Grid.js
var Grid = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
if (Reflect.has(data2, "header")) {
this.header = parser_exports.parseItem(data2.header);
}
if (Reflect.has(data2, "isCollapsible")) {
this.is_collapsible = data2.isCollapsible;
}
if (Reflect.has(data2, "visibleRowCount")) {
this.visible_row_count = data2.visibleRowCount;
}
if (Reflect.has(data2, "targetId")) {
this.target_id = data2.targetId;
}
this.continuation = data2.continuations?.[0]?.nextContinuationData?.continuation || null;
}
get contents() {
return this.items;
}
};
__name(Grid, "Grid");
Grid.type = "Grid";
var Grid_default = Grid;
// dist/src/parser/classes/GridChannel.js
var GridChannel = class extends YTNode {
constructor(data2) {
super();
this.id = data2.channelId;
this.author = new Author({
...data2.title,
navigationEndpoint: data2.navigationEndpoint
}, data2.ownerBadges, data2.thumbnail);
this.subscribers = new Text(data2.subscriberCountText);
this.video_count = new Text(data2.videoCountText);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.subscribe_button = parser_exports.parseItem(data2.subscribeButton);
}
};
__name(GridChannel, "GridChannel");
GridChannel.type = "GridChannel";
var GridChannel_default = GridChannel;
// dist/src/parser/classes/GridHeader.js
var GridHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
}
};
__name(GridHeader, "GridHeader");
GridHeader.type = "GridHeader";
var GridHeader_default = GridHeader;
// dist/src/parser/classes/GridMix.js
var GridMix = class extends YTNode {
constructor(data2) {
super();
this.id = data2.playlistId;
this.title = new Text(data2.title);
this.author = data2.shortBylineText?.simpleText ? new Text(data2.shortBylineText) : data2.longBylineText?.simpleText ? new Text(data2.longBylineText) : null;
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.video_count = new Text(data2.videoCountText);
this.video_count_short = new Text(data2.videoCountShortText);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.secondary_endpoint = new NavigationEndpoint_default(data2.secondaryNavigationEndpoint);
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
}
};
__name(GridMix, "GridMix");
GridMix.type = "GridMix";
var GridMix_default = GridMix;
// dist/src/parser/classes/GridMovie.js
var GridMovie = class extends YTNode {
constructor(data2) {
super();
const length_alt = data2.thumbnailOverlays.find((overlay) => overlay.hasOwnProperty("thumbnailOverlayTimeStatusRenderer"))?.thumbnailOverlayTimeStatusRenderer;
this.id = data2.videoId;
this.title = new Text(data2.title);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.duration = data2.lengthText ? new Text(data2.lengthText) : length_alt?.text ? new Text(length_alt.text) : null;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.badges = parser_exports.parseArray(data2.badges, MetadataBadge_default);
this.metadata = new Text(data2.metadata);
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
}
};
__name(GridMovie, "GridMovie");
GridMovie.type = "GridMovie";
var GridMovie_default = GridMovie;
// dist/src/parser/classes/GridPlaylist.js
var GridPlaylist = class extends YTNode {
constructor(data2) {
super();
this.id = data2.playlistId;
this.title = new Text(data2.title);
if (Reflect.has(data2, "shortBylineText")) {
this.author = new Author(data2.shortBylineText, data2.ownerBadges);
}
this.badges = parser_exports.parseArray(data2.ownerBadges);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.view_playlist = new Text(data2.viewPlaylistText);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.thumbnail_renderer = parser_exports.parseItem(data2.thumbnailRenderer);
this.sidebar_thumbnails = [].concat(...data2.sidebarThumbnails?.map((thumbnail) => Thumbnail.fromResponse(thumbnail)) || []) || null;
this.video_count = new Text(data2.thumbnailText);
this.video_count_short = new Text(data2.videoCountShortText);
}
};
__name(GridPlaylist, "GridPlaylist");
GridPlaylist.type = "GridPlaylist";
var GridPlaylist_default = GridPlaylist;
// dist/src/parser/classes/ShowCustomThumbnail.js
var ShowCustomThumbnail = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
}
};
__name(ShowCustomThumbnail, "ShowCustomThumbnail");
ShowCustomThumbnail.type = "ShowCustomThumbnail";
var ShowCustomThumbnail_default = ShowCustomThumbnail;
// dist/src/parser/classes/ThumbnailOverlayBottomPanel.js
var ThumbnailOverlayBottomPanel = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "text")) {
this.text = new Text(data2.text);
}
if (Reflect.has(data2, "icon") && Reflect.has(data2.icon, "iconType")) {
this.icon_type = data2.icon.iconType;
}
}
};
__name(ThumbnailOverlayBottomPanel, "ThumbnailOverlayBottomPanel");
ThumbnailOverlayBottomPanel.type = "ThumbnailOverlayBottomPanel";
var ThumbnailOverlayBottomPanel_default = ThumbnailOverlayBottomPanel;
// dist/src/parser/classes/GridShow.js
var GridShow = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.thumbnail_renderer = parseItem(data2.thumbnailRenderer, ShowCustomThumbnail_default);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.long_byline_text = new Text(data2.longBylineText);
this.thumbnail_overlays = parseArray(data2.thumbnailOverlays, ThumbnailOverlayBottomPanel_default);
this.author = new Author(data2.shortBylineText, void 0);
}
};
__name(GridShow, "GridShow");
GridShow.type = "GridShow";
var GridShow_default = GridShow;
// dist/src/parser/classes/GridVideo.js
var GridVideo = class extends YTNode {
constructor(data2) {
super();
const length_alt = data2.thumbnailOverlays.find((overlay) => overlay.hasOwnProperty("thumbnailOverlayTimeStatusRenderer"))?.thumbnailOverlayTimeStatusRenderer;
this.id = data2.videoId;
this.title = new Text(data2.title);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
this.rich_thumbnail = parser_exports.parseItem(data2.richThumbnail);
this.published = new Text(data2.publishedTimeText);
this.duration = data2.lengthText ? new Text(data2.lengthText) : length_alt?.text ? new Text(length_alt.text) : null;
this.author = data2.shortBylineText && new Author(data2.shortBylineText, data2.ownerBadges);
this.views = new Text(data2.viewCountText);
this.short_view_count = new Text(data2.shortViewCountText);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
if (Reflect.has(data2, "buttons")) {
this.buttons = parser_exports.parseArray(data2.buttons);
}
if (Reflect.has(data2, "upcomingEventData")) {
this.upcoming = new Date(Number(`${data2.upcomingEventData.startTime}000`));
this.upcoming_text = new Text(data2.upcomingEventData.upcomingEventText);
this.is_reminder_set = !!data2.upcomingEventData?.isReminderSet;
}
}
get is_upcoming() {
return Boolean(this.upcoming && this.upcoming > new Date());
}
};
__name(GridVideo, "GridVideo");
GridVideo.type = "GridVideo";
var GridVideo_default = GridVideo;
// dist/src/parser/classes/GuideEntry.js
var GuideEntry = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.formattedTitle);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint || data2.serviceEndpoint);
if (Reflect.has(data2, "icon") && Reflect.has(data2.icon, "iconType")) {
this.icon_type = data2.icon.iconType;
}
if (Reflect.has(data2, "thumbnail")) {
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
}
if (Reflect.has(data2, "badges")) {
this.badges = data2.badges;
}
this.is_primary = !!data2.isPrimary;
}
};
__name(GuideEntry, "GuideEntry");
GuideEntry.type = "GuideEntry";
var GuideEntry_default = GuideEntry;
// dist/src/parser/classes/GuideCollapsibleEntry.js
var GuideCollapsibleEntry = class extends YTNode {
constructor(data2) {
super();
this.expander_item = parseItem(data2.expanderItem, GuideEntry_default);
this.collapser_item = parseItem(data2.collapserItem, GuideEntry_default);
this.expandable_items = parseArray(data2.expandableItems);
}
};
__name(GuideCollapsibleEntry, "GuideCollapsibleEntry");
GuideCollapsibleEntry.type = "GuideCollapsibleEntry";
var GuideCollapsibleEntry_default = GuideCollapsibleEntry;
// dist/src/parser/classes/GuideCollapsibleSectionEntry.js
var GuideCollapsibleSectionEntry = class extends YTNode {
constructor(data2) {
super();
this.header_entry = parseItem(data2.headerEntry);
this.expander_icon = data2.expanderIcon.iconType;
this.collapser_icon = data2.collapserIcon.iconType;
this.section_items = parseArray(data2.sectionItems);
}
};
__name(GuideCollapsibleSectionEntry, "GuideCollapsibleSectionEntry");
GuideCollapsibleSectionEntry.type = "GuideCollapsibleSectionEntry";
var GuideCollapsibleSectionEntry_default = GuideCollapsibleSectionEntry;
// dist/src/parser/classes/GuideDownloadsEntry.js
var GuideDownloadsEntry = class extends GuideEntry_default {
constructor(data2) {
super(data2.entryRenderer.guideEntryRenderer);
this.always_show = !!data2.alwaysShow;
}
};
__name(GuideDownloadsEntry, "GuideDownloadsEntry");
GuideDownloadsEntry.type = "GuideDownloadsEntry";
var GuideDownloadsEntry_default = GuideDownloadsEntry;
// dist/src/parser/classes/GuideSection.js
var GuideSection = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "formattedTitle")) {
this.title = new Text(data2.formattedTitle);
}
this.items = parseArray(data2.items);
}
};
__name(GuideSection, "GuideSection");
GuideSection.type = "GuideSection";
var GuideSection_default = GuideSection;
// dist/src/parser/classes/GuideSubscriptionsSection.js
var GuideSubscriptionsSection = class extends GuideSection_default {
};
__name(GuideSubscriptionsSection, "GuideSubscriptionsSection");
GuideSubscriptionsSection.type = "GuideSubscriptionsSection";
var GuideSubscriptionsSection_default = GuideSubscriptionsSection;
// dist/src/parser/classes/HashtagHeader.js
var HashtagHeader = class extends YTNode {
constructor(data2) {
super();
this.hashtag = new Text(data2.hashtag);
this.hashtag_info = new Text(data2.hashtagInfoText);
}
};
__name(HashtagHeader, "HashtagHeader");
HashtagHeader.type = "HashtagHeader";
var HashtagHeader_default = HashtagHeader;
// dist/src/parser/classes/HashtagTile.js
var HashtagTile = class extends YTNode {
constructor(data2) {
super();
this.hashtag = new Text(data2.hashtag);
this.hashtag_info_text = new Text(data2.hashtagInfoText);
this.hashtag_thumbnail = Thumbnail.fromResponse(data2.hashtagThumbnail);
this.endpoint = new NavigationEndpoint_default(data2.onTapCommand);
this.hashtag_background_color = data2.hashtagBackgroundColor;
this.hashtag_video_count = new Text(data2.hashtagVideoCount);
this.hashtag_channel_count = new Text(data2.hashtagChannelCount);
}
};
__name(HashtagTile, "HashtagTile");
HashtagTile.type = "HashtagTile";
var HashtagTile_default = HashtagTile;
// dist/src/parser/classes/HeroPlaylistThumbnail.js
var HeroPlaylistThumbnail = class extends YTNode {
constructor(data2) {
super();
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.on_tap_endpoint = new NavigationEndpoint_default(data2.onTap);
}
};
__name(HeroPlaylistThumbnail, "HeroPlaylistThumbnail");
HeroPlaylistThumbnail.type = "HeroPlaylistThumbnail";
var HeroPlaylistThumbnail_default = HeroPlaylistThumbnail;
// dist/src/parser/classes/HighlightsCarousel.js
var Panel = class extends YTNode {
constructor(data2) {
super();
if (data2.thumbnail) {
this.thumbnail = {
image: Thumbnail.fromResponse(data2.thumbnail.image),
endpoint: new NavigationEndpoint_default(data2.thumbnail.onTap),
on_long_press_endpoint: new NavigationEndpoint_default(data2.thumbnail.onLongPress),
content_mode: data2.thumbnail.contentMode,
crop_options: data2.thumbnail.cropOptions
};
}
this.background_image = {
image: Thumbnail.fromResponse(data2.backgroundImage.image),
gradient_image: Thumbnail.fromResponse(data2.backgroundImage.gradientImage)
};
this.strapline = data2.strapline;
this.title = data2.title;
this.description = data2.description;
this.cta = {
icon_name: data2.cta.iconName,
title: data2.cta.title,
endpoint: new NavigationEndpoint_default(data2.cta.onTap),
accessibility_text: data2.cta.accessibilityText,
state: data2.cta.state
};
this.text_on_tap_endpoint = new NavigationEndpoint_default(data2.textOnTap);
}
};
__name(Panel, "Panel");
Panel.type = "Panel";
var HighlightsCarousel = class extends YTNode {
constructor(data2) {
super();
this.panels = observe(data2.highlightsCarousel.panels.map((el) => new Panel(el)));
}
};
__name(HighlightsCarousel, "HighlightsCarousel");
HighlightsCarousel.type = "HighlightsCarousel";
var HighlightsCarousel_default = HighlightsCarousel;
// dist/src/parser/classes/SearchSuggestion.js
var SearchSuggestion = class extends YTNode {
constructor(data2) {
super();
this.suggestion = new Text(data2.suggestion);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
if (Reflect.has(data2, "icon")) {
this.icon_type = data2.icon.iconType;
}
if (Reflect.has(data2, "serviceEndpoint")) {
this.service_endpoint = new NavigationEndpoint_default(data2.serviceEndpoint);
}
}
};
__name(SearchSuggestion, "SearchSuggestion");
SearchSuggestion.type = "SearchSuggestion";
var SearchSuggestion_default = SearchSuggestion;
// dist/src/parser/classes/HistorySuggestion.js
var HistorySuggestion = class extends SearchSuggestion_default {
constructor(data2) {
super(data2);
}
};
__name(HistorySuggestion, "HistorySuggestion");
HistorySuggestion.type = "HistorySuggestion";
var HistorySuggestion_default = HistorySuggestion;
// dist/src/parser/classes/HorizontalMovieList.js
var HorizontalMovieList = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
this.previous_button = parser_exports.parseItem(data2.previousButton, Button_default);
this.next_button = parser_exports.parseItem(data2.nextButton, Button_default);
}
get contents() {
return this.items;
}
};
__name(HorizontalMovieList, "HorizontalMovieList");
HorizontalMovieList.type = "HorizontalMovieList";
var HorizontalMovieList_default = HorizontalMovieList;
// dist/src/parser/classes/IconLink.js
var IconLink = class extends YTNode {
constructor(data2) {
super();
this.icon_type = data2.icon?.iconType;
if (Reflect.has(data2, "tooltip")) {
this.tooltip = new Text(data2.tooltip).toString();
}
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
};
__name(IconLink, "IconLink");
IconLink.type = "IconLink";
var IconLink_default = IconLink;
// dist/src/parser/classes/ImageBannerView.js
var ImageBannerView = class extends YTNode {
constructor(data2) {
super();
this.image = Thumbnail.fromResponse(data2.image);
this.style = data2.style;
}
};
__name(ImageBannerView, "ImageBannerView");
ImageBannerView.type = "ImageBannerView";
var ImageBannerView_default = ImageBannerView;
// dist/src/parser/classes/IncludingResultsFor.js
var IncludingResultsFor = class extends YTNode {
constructor(data2) {
super();
this.including_results_for = new Text(data2.includingResultsFor);
this.corrected_query = new Text(data2.correctedQuery);
this.corrected_query_endpoint = new NavigationEndpoint_default(data2.correctedQueryEndpoint);
this.search_only_for = Reflect.has(data2, "searchOnlyFor") ? new Text(data2.searchOnlyFor) : void 0;
this.original_query = Reflect.has(data2, "originalQuery") ? new Text(data2.originalQuery) : void 0;
this.original_query_endpoint = Reflect.has(data2, "originalQueryEndpoint") ? new NavigationEndpoint_default(data2.originalQueryEndpoint) : void 0;
}
};
__name(IncludingResultsFor, "IncludingResultsFor");
IncludingResultsFor.type = "IncludingResultsFor";
var IncludingResultsFor_default = IncludingResultsFor;
// dist/src/parser/classes/InfoPanelContent.js
var InfoPanelContent = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.source = new Text(data2.source);
if (Reflect.has(data2, "paragraphs"))
this.paragraphs = data2.paragraphs.map((p) => new Text(p));
if (Reflect.has(data2, "attributedParagraphs"))
this.attributed_paragraphs = data2.attributedParagraphs.map((p) => Text.fromAttributed(p));
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.source_endpoint = new NavigationEndpoint_default(data2.sourceEndpoint);
this.truncate_paragraphs = !!data2.truncateParagraphs;
this.background = data2.background;
if (Reflect.has(data2, "inlineLinkIcon") && Reflect.has(data2.inlineLinkIcon, "iconType")) {
this.inline_link_icon_type = data2.inlineLinkIcon.iconType;
}
}
};
__name(InfoPanelContent, "InfoPanelContent");
InfoPanelContent.type = "InfoPanelContent";
var InfoPanelContent_default = InfoPanelContent;
// dist/src/parser/classes/InfoPanelContainer.js
var InfoPanelContainer = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
this.content = parser_exports.parseItem(data2.content, InfoPanelContent_default);
if (data2.headerEndpoint)
this.header_endpoint = new NavigationEndpoint_default(data2.headerEndpoint);
this.background = data2.background;
this.title_style = data2.titleStyle;
if (Reflect.has(data2, "icon")) {
this.icon_type = data2.icon?.iconType;
}
}
};
__name(InfoPanelContainer, "InfoPanelContainer");
InfoPanelContainer.type = "InfoPanelContainer";
var InfoPanelContainer_default = InfoPanelContainer;
// dist/src/parser/classes/InteractiveTabbedHeader.js
var InteractiveTabbedHeader = class extends YTNode {
constructor(data2) {
super();
this.header_type = data2.type;
this.title = new Text(data2.title);
this.description = new Text(data2.description);
this.metadata = new Text(data2.metadata);
this.badges = parser_exports.parseArray(data2.badges, MetadataBadge_default);
this.box_art = Thumbnail.fromResponse(data2.boxArt);
this.banner = Thumbnail.fromResponse(data2.banner);
this.buttons = parser_exports.parseArray(data2.buttons, [SubscribeButton_default, Button_default]);
this.auto_generated = new Text(data2.autoGenerated);
}
};
__name(InteractiveTabbedHeader, "InteractiveTabbedHeader");
InteractiveTabbedHeader.type = "InteractiveTabbedHeader";
var InteractiveTabbedHeader_default = InteractiveTabbedHeader;
// dist/src/parser/classes/ItemSectionHeader.js
var ItemSectionHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
}
};
__name(ItemSectionHeader, "ItemSectionHeader");
ItemSectionHeader.type = "ItemSectionHeader";
var ItemSectionHeader_default = ItemSectionHeader;
// dist/src/parser/classes/ItemSectionTab.js
var ItemSectionTab = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.selected = !!data2.selected;
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
}
};
__name(ItemSectionTab, "ItemSectionTab");
ItemSectionTab.type = "Tab";
var ItemSectionTab_default = ItemSectionTab;
// dist/src/parser/classes/ItemSectionTabbedHeader.js
var ItemSectionTabbedHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.tabs = parser_exports.parseArray(data2.tabs, ItemSectionTab_default);
if (Reflect.has(data2, "endItems")) {
this.end_items = parser_exports.parseArray(data2.endItems);
}
}
};
__name(ItemSectionTabbedHeader, "ItemSectionTabbedHeader");
ItemSectionTabbedHeader.type = "ItemSectionTabbedHeader";
var ItemSectionTabbedHeader_default = ItemSectionTabbedHeader;
// dist/src/parser/classes/SortFilterHeader.js
var SortFilterHeader = class extends YTNode {
constructor(data2) {
super();
this.filter_menu = parser_exports.parseItem(data2.filterMenu, nodes_exports.SortFilterSubMenu);
}
};
__name(SortFilterHeader, "SortFilterHeader");
SortFilterHeader.type = "SortFilterHeader";
var SortFilterHeader_default = SortFilterHeader;
// dist/src/parser/classes/ItemSection.js
var ItemSection = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header, [CommentsHeader_default, ItemSectionHeader_default, ItemSectionTabbedHeader_default, SortFilterHeader_default, FeedFilterChipBar_default]);
this.contents = parser_exports.parseArray(data2.contents);
if (data2.targetId || data2.sectionIdentifier) {
this.target_id = data2.targetId || data2.sectionIdentifier;
}
if (data2.continuations) {
this.continuation = data2.continuations?.at(0)?.nextContinuationData?.continuation;
}
}
};
__name(ItemSection, "ItemSection");
ItemSection.type = "ItemSection";
var ItemSection_default = ItemSection;
// dist/src/parser/classes/LiveChat.js
var LiveChat = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header);
this.initial_display_state = data2.initialDisplayState;
this.continuation = data2.continuations[0]?.reloadContinuationData?.continuation;
this.client_messages = {
reconnect_message: new Text(data2.clientMessages.reconnectMessage),
unable_to_reconnect_message: new Text(data2.clientMessages.unableToReconnectMessage),
fatal_error: new Text(data2.clientMessages.fatalError),
reconnected_message: new Text(data2.clientMessages.reconnectedMessage),
generic_error: new Text(data2.clientMessages.genericError)
};
this.is_replay = !!data2.isReplay;
}
};
__name(LiveChat, "LiveChat");
LiveChat.type = "LiveChat";
var LiveChat_default = LiveChat;
// dist/src/parser/classes/livechat/items/LiveChatBannerHeader.js
var LiveChatBannerHeader = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text);
if (Reflect.has(data2, "icon") && Reflect.has(data2.icon, "iconType")) {
this.icon_type = data2.icon.iconType;
}
this.context_menu_button = parser_exports.parseItem(data2.contextMenuButton, Button_default);
}
};
__name(LiveChatBannerHeader, "LiveChatBannerHeader");
LiveChatBannerHeader.type = "LiveChatBannerHeader";
var LiveChatBannerHeader_default = LiveChatBannerHeader;
// dist/src/parser/classes/livechat/items/LiveChatBanner.js
var LiveChatBanner = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header, LiveChatBannerHeader_default);
this.contents = parser_exports.parseItem(data2.contents);
this.action_id = data2.actionId;
if (Reflect.has(data2, "viewerIsCreator")) {
this.viewer_is_creator = data2.viewerIsCreator;
}
this.target_id = data2.targetId;
this.is_stackable = data2.isStackable;
if (Reflect.has(data2, "backgroundType")) {
this.background_type = data2.backgroundType;
}
this.banner_type = data2.bannerType;
if (Reflect.has(data2, "bannerProperties") && Reflect.has(data2.bannerProperties, "isEphemeral")) {
this.banner_properties_is_ephemeral = Boolean(data2.bannerProperties.isEphemeral);
}
if (Reflect.has(data2, "bannerProperties") && Reflect.has(data2.bannerProperties, "autoCollapseDelay") && Reflect.has(data2.bannerProperties.autoCollapseDelay, "seconds")) {
this.banner_properties_auto_collapse_delay_seconds = data2.bannerProperties.autoCollapseDelay.seconds;
}
}
};
__name(LiveChatBanner, "LiveChatBanner");
LiveChatBanner.type = "LiveChatBanner";
var LiveChatBanner_default = LiveChatBanner;
// dist/src/parser/classes/livechat/AddBannerToLiveChatCommand.js
var AddBannerToLiveChatCommand = class extends YTNode {
constructor(data2) {
super();
this.banner = parser_exports.parseItem(data2.bannerRenderer, LiveChatBanner_default);
}
};
__name(AddBannerToLiveChatCommand, "AddBannerToLiveChatCommand");
AddBannerToLiveChatCommand.type = "AddBannerToLiveChatCommand";
var AddBannerToLiveChatCommand_default = AddBannerToLiveChatCommand;
// dist/src/parser/classes/livechat/AddChatItemAction.js
var AddChatItemAction = class extends YTNode {
constructor(data2) {
super();
this.item = parser_exports.parseItem(data2.item);
if (Reflect.has(data2, "clientId")) {
this.client_id = data2.clientId;
}
}
};
__name(AddChatItemAction, "AddChatItemAction");
AddChatItemAction.type = "AddChatItemAction";
var AddChatItemAction_default = AddChatItemAction;
// dist/src/parser/classes/livechat/AddLiveChatTickerItemAction.js
var AddLiveChatTickerItemAction = class extends YTNode {
constructor(data2) {
super();
this.item = parser_exports.parseItem(data2.item);
this.duration_sec = data2.durationSec;
}
};
__name(AddLiveChatTickerItemAction, "AddLiveChatTickerItemAction");
AddLiveChatTickerItemAction.type = "AddLiveChatTickerItemAction";
var AddLiveChatTickerItemAction_default = AddLiveChatTickerItemAction;
// dist/src/parser/classes/livechat/DimChatItemAction.js
var DimChatItemAction = class extends YTNode {
constructor(data2) {
super();
this.client_assigned_id = data2.clientAssignedId;
}
};
__name(DimChatItemAction, "DimChatItemAction");
DimChatItemAction.type = "DimChatItemAction";
var DimChatItemAction_default = DimChatItemAction;
// dist/src/parser/classes/livechat/items/BumperUserEduContentView.js
var BumperUserEduContentView = class extends YTNode {
constructor(data2) {
super();
this.text = Text.fromAttributed(data2.text);
this.image_name = data2.image.sources[0].clientResource.imageName;
this.image_color = data2.image.sources[0].clientResource.imageColor;
}
};
__name(BumperUserEduContentView, "BumperUserEduContentView");
BumperUserEduContentView.type = "BumperUserEduContentView";
var BumperUserEduContentView_default = BumperUserEduContentView;
// dist/src/parser/classes/livechat/items/CreatorHeartView.js
var CreatorHeartView = class extends YTNode {
constructor(data2) {
super();
this.creator_thumbnail = Thumbnail.fromResponse(data2.creatorThumbnail);
this.hearted_icon_name = data2.heartedIcon.sources[0].clientResource.imageName;
this.unhearted_icon_name = data2.unheartedIcon.sources[0].clientResource.imageName;
this.unhearted_icon_processor = {
border_image_processor: {
image_tint: {
color: data2.unheartedIcon.processor.borderImageProcessor.imageTint.color
}
}
};
this.hearted_hover_text = data2.heartedHoverText;
this.hearted_accessibility_label = data2.heartedAccessibilityLabel;
this.unhearted_accessibility_label = data2.unheartedAccessibilityLabel;
this.engagement_state_key = data2.engagementStateKey;
}
};
__name(CreatorHeartView, "CreatorHeartView");
CreatorHeartView.type = "CreatorHeartView";
var CreatorHeartView_default = CreatorHeartView;
// dist/src/parser/classes/livechat/items/LiveChatAutoModMessage.js
var LiveChatAutoModMessage = class extends YTNode {
constructor(data2) {
super();
this.menu_endpoint = new NavigationEndpoint_default(data2.contextMenuEndpoint);
this.moderation_buttons = parser_exports.parseArray(data2.moderationButtons, Button_default);
this.auto_moderated_item = parser_exports.parseItem(data2.autoModeratedItem);
this.header_text = new Text(data2.headerText);
this.timestamp = Math.floor(parseInt(data2.timestampUsec) / 1e3);
this.id = data2.id;
}
};
__name(LiveChatAutoModMessage, "LiveChatAutoModMessage");
LiveChatAutoModMessage.type = "LiveChatAutoModMessage";
var LiveChatAutoModMessage_default = LiveChatAutoModMessage;
// dist/src/parser/classes/livechat/items/LiveChatBannerChatSummary.js
var LiveChatBannerChatSummary = class extends YTNode {
constructor(data2) {
super();
this.id = data2.liveChatSummaryId;
this.chat_summary = new Text(data2.chatSummary);
this.icon_type = data2.icon.iconType;
this.like_feedback_button = parser_exports.parseItem(data2.likeFeedbackButton, ToggleButtonView_default);
this.dislike_feedback_button = parser_exports.parseItem(data2.dislikeFeedbackButton, ToggleButtonView_default);
}
};
__name(LiveChatBannerChatSummary, "LiveChatBannerChatSummary");
LiveChatBannerChatSummary.type = "LiveChatBannerChatSummary";
var LiveChatBannerChatSummary_default = LiveChatBannerChatSummary;
// dist/src/parser/classes/livechat/items/LiveChatBannerPoll.js
var LiveChatBannerPoll = class extends YTNode {
constructor(data2) {
super();
this.poll_question = new Text(data2.pollQuestion);
this.author_photo = Thumbnail.fromResponse(data2.authorPhoto);
this.choices = data2.pollChoices.map((choice) => ({
option_id: choice.pollOptionId,
text: new Text(choice.text).toString()
}));
this.collapsed_state_entity_key = data2.collapsedStateEntityKey;
this.live_chat_poll_state_entity_key = data2.liveChatPollStateEntityKey;
this.context_menu_button = parser_exports.parseItem(data2.contextMenuButton, Button_default);
}
};
__name(LiveChatBannerPoll, "LiveChatBannerPoll");
LiveChatBannerPoll.type = "LiveChatBannerPoll";
var LiveChatBannerPoll_default = LiveChatBannerPoll;
// dist/src/parser/classes/livechat/items/LiveChatBannerRedirect.js
var LiveChatBannerRedirect = class extends YTNode {
constructor(data2) {
super();
this.banner_message = new Text(data2.bannerMessage);
this.author_photo = Thumbnail.fromResponse(data2.authorPhoto);
this.inline_action_button = parser_exports.parseItem(data2.inlineActionButton, Button_default);
this.context_menu_button = parser_exports.parseItem(data2.contextMenuButton, Button_default);
}
};
__name(LiveChatBannerRedirect, "LiveChatBannerRedirect");
LiveChatBannerRedirect.type = "LiveChatBannerRedirect";
var LiveChatBannerRedirect_default = LiveChatBannerRedirect;
// dist/src/parser/classes/livechat/items/LiveChatItemBumperView.js
var LiveChatItemBumperView = class extends YTNode {
constructor(data2) {
super();
this.content = parser_exports.parseItem(data2.content, BumperUserEduContentView_default);
}
};
__name(LiveChatItemBumperView, "LiveChatItemBumperView");
LiveChatItemBumperView.type = "LiveChatItemBumperView";
var LiveChatItemBumperView_default = LiveChatItemBumperView;
// dist/src/parser/classes/livechat/items/LiveChatMembershipItem.js
var LiveChatMembershipItem = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.timestamp = Math.floor(parseInt(data2.timestampUsec) / 1e3);
this.timestamp_usec = data2.timestampUsec;
if (Reflect.has(data2, "timestampText")) {
this.timestamp_text = new Text(data2.timestampText);
}
if (Reflect.has(data2, "headerPrimaryText")) {
this.header_primary_text = new Text(data2.headerPrimaryText);
}
this.header_subtext = new Text(data2.headerSubtext);
if (Reflect.has(data2, "message")) {
this.message = new Text(data2.message);
}
this.author = new Author(data2.authorName, data2.authorBadges, data2.authorPhoto, data2.authorExternalChannelId);
this.menu_endpoint = new NavigationEndpoint_default(data2.contextMenuEndpoint);
this.context_menu_accessibility_label = data2.contextMenuAccessibility.accessibilityData.label;
}
};
__name(LiveChatMembershipItem, "LiveChatMembershipItem");
LiveChatMembershipItem.type = "LiveChatMembershipItem";
var LiveChatMembershipItem_default = LiveChatMembershipItem;
// dist/src/parser/classes/livechat/items/LiveChatModeChangeMessage.js
var LiveChatModeChangeMessage = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.icon_type = data2.icon.iconType;
this.text = new Text(data2.text);
this.subtext = new Text(data2.subtext);
this.timestamp = Math.floor(parseInt(data2.timestampUsec) / 1e3);
this.timestamp_usec = data2.timestampUsec;
this.timestamp_text = new Text(data2.timestampText);
}
};
__name(LiveChatModeChangeMessage, "LiveChatModeChangeMessage");
LiveChatModeChangeMessage.type = "LiveChatModeChangeMessage";
var LiveChatModeChangeMessage_default = LiveChatModeChangeMessage;
// dist/src/parser/classes/livechat/items/PdgReplyButtonView.js
var PdgReplyButtonView = class extends YTNode {
constructor(data2) {
super();
this.reply_button = parser_exports.parseItem(data2.replyButton, ButtonView_default);
this.reply_count_entity_key = data2.replyCountEntityKey;
this.reply_count_placeholder = Text.fromAttributed(data2.replyCountPlaceholder);
}
};
__name(PdgReplyButtonView, "PdgReplyButtonView");
PdgReplyButtonView.type = "PdgReplyButtonView";
var PdgReplyButtonView_default = PdgReplyButtonView;
// dist/src/parser/classes/livechat/items/LiveChatPaidMessage.js
var LiveChatPaidMessage = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.message = new Text(data2.message);
this.author = new Author(data2.authorName, data2.authorBadges, data2.authorPhoto, data2.authorExternalChannelId);
this.author_name_text_color = data2.authorNameTextColor;
this.header_background_color = data2.headerBackgroundColor;
this.header_text_color = data2.headerTextColor;
this.body_background_color = data2.bodyBackgroundColor;
this.body_text_color = data2.bodyTextColor;
this.purchase_amount = new Text(data2.purchaseAmountText).toString();
this.menu_endpoint = new NavigationEndpoint_default(data2.contextMenuEndpoint);
this.context_menu_accessibility_label = data2.contextMenuAccessibility.accessibilityData.label;
this.timestamp = Math.floor(parseInt(data2.timestampUsec) / 1e3);
this.timestamp_usec = data2.timestampUsec;
if (Reflect.has(data2, "timestampText")) {
this.timestamp_text = new Text(data2.timestampText).toString();
}
this.timestamp_color = data2.timestampColor;
if (Reflect.has(data2, "headerOverlayImage")) {
this.header_overlay_image = Thumbnail.fromResponse(data2.headerOverlayImage);
}
this.text_input_background_color = data2.textInputBackgroundColor;
this.lower_bumper = parser_exports.parseItem(data2.lowerBumper, LiveChatItemBumperView_default);
this.creator_heart_button = parser_exports.parseItem(data2.creatorHeartButton, CreatorHeartView_default);
this.is_v2_style = data2.isV2Style;
this.reply_button = parser_exports.parseItem(data2.replyButton, PdgReplyButtonView_default);
}
};
__name(LiveChatPaidMessage, "LiveChatPaidMessage");
LiveChatPaidMessage.type = "LiveChatPaidMessage";
var LiveChatPaidMessage_default = LiveChatPaidMessage;
// dist/src/parser/classes/livechat/items/LiveChatPaidSticker.js
var LiveChatPaidSticker = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.author = new Author(data2.authorName, data2.authorBadges, data2.authorPhoto, data2.authorExternalChannelId);
this.money_chip_background_color = data2.moneyChipBackgroundColor;
this.money_chip_text_color = data2.moneyChipTextColor;
this.background_color = data2.backgroundColor;
this.author_name_text_color = data2.authorNameTextColor;
this.sticker = Thumbnail.fromResponse(data2.sticker);
this.sticker_accessibility_label = data2.sticker.accessibility.accessibilityData.label;
this.sticker_display_width = data2.stickerDisplayWidth;
this.sticker_display_height = data2.stickerDisplayHeight;
this.purchase_amount = new Text(data2.purchaseAmountText).toString();
this.menu_endpoint = new NavigationEndpoint_default(data2.contextMenuEndpoint);
this.context_menu = this.menu_endpoint;
this.context_menu_accessibility_label = data2.contextMenuAccessibility.accessibilityData.label;
this.timestamp = Math.floor(parseInt(data2.timestampUsec) / 1e3);
this.timestamp_usec = data2.timestampUsec;
this.is_v2_style = data2.isV2Style;
}
};
__name(LiveChatPaidSticker, "LiveChatPaidSticker");
LiveChatPaidSticker.type = "LiveChatPaidSticker";
var LiveChatPaidSticker_default = LiveChatPaidSticker;
// dist/src/parser/classes/livechat/items/LiveChatPlaceholderItem.js
var LiveChatPlaceholderItem = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.timestamp = Math.floor(parseInt(data2.timestampUsec) / 1e3);
}
};
__name(LiveChatPlaceholderItem, "LiveChatPlaceholderItem");
LiveChatPlaceholderItem.type = "LiveChatPlaceholderItem";
var LiveChatPlaceholderItem_default = LiveChatPlaceholderItem;
// dist/src/parser/classes/livechat/items/LiveChatProductItem.js
var LiveChatProductItem = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title;
this.accessibility_title = data2.accessibilityTitle;
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.price = data2.price;
this.vendor_name = data2.vendorName;
this.from_vendor_text = data2.fromVendorText;
this.information_button = parser_exports.parseItem(data2.informationButton);
this.endpoint = new NavigationEndpoint_default(data2.onClickCommand);
this.creator_message = data2.creatorMessage;
this.creator_name = data2.creatorName;
this.author_photo = Thumbnail.fromResponse(data2.authorPhoto);
this.information_dialog = parser_exports.parseItem(data2.informationDialog);
this.is_verified = data2.isVerified;
this.creator_custom_message = new Text(data2.creatorCustomMessage);
}
};
__name(LiveChatProductItem, "LiveChatProductItem");
LiveChatProductItem.type = "LiveChatProductItem";
var LiveChatProductItem_default = LiveChatProductItem;
// dist/src/parser/classes/livechat/items/LiveChatRestrictedParticipation.js
var LiveChatRestrictedParticipation = class extends YTNode {
constructor(data2) {
super();
this.message = new Text(data2.message);
if (Reflect.has(data2, "icon") && Reflect.has(data2.icon, "iconType")) {
this.icon_type = data2.icon.iconType;
}
}
};
__name(LiveChatRestrictedParticipation, "LiveChatRestrictedParticipation");
LiveChatRestrictedParticipation.type = "LiveChatRestrictedParticipation";
var LiveChatRestrictedParticipation_default = LiveChatRestrictedParticipation;
// dist/src/parser/classes/LiveChatAuthorBadge.js
var LiveChatAuthorBadge = class extends MetadataBadge_default {
constructor(data2) {
super(data2);
this.custom_thumbnail = Thumbnail.fromResponse(data2.customThumbnail);
}
};
__name(LiveChatAuthorBadge, "LiveChatAuthorBadge");
LiveChatAuthorBadge.type = "LiveChatAuthorBadge";
var LiveChatAuthorBadge_default = LiveChatAuthorBadge;
// dist/src/parser/classes/livechat/items/LiveChatSponsorshipsHeader.js
var LiveChatSponsorshipsHeader = class extends YTNode {
constructor(data2) {
super();
this.author_name = new Text(data2.authorName);
this.author_photo = Thumbnail.fromResponse(data2.authorPhoto);
this.author_badges = parser_exports.parseArray(data2.authorBadges, LiveChatAuthorBadge_default);
this.primary_text = new Text(data2.primaryText);
this.menu_endpoint = new NavigationEndpoint_default(data2.contextMenuEndpoint);
this.context_menu_accessibility_label = data2.contextMenuAccessibility.accessibilityData.label;
this.image = Thumbnail.fromResponse(data2.image);
}
};
__name(LiveChatSponsorshipsHeader, "LiveChatSponsorshipsHeader");
LiveChatSponsorshipsHeader.type = "LiveChatSponsorshipsHeader";
var LiveChatSponsorshipsHeader_default = LiveChatSponsorshipsHeader;
// dist/src/parser/classes/livechat/items/LiveChatSponsorshipsGiftPurchaseAnnouncement.js
var LiveChatSponsorshipsGiftPurchaseAnnouncement = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.timestamp_usec = data2.timestampUsec;
this.author_external_channel_id = data2.authorExternalChannelId;
this.header = parser_exports.parseItem(data2.header, LiveChatSponsorshipsHeader_default);
}
};
__name(LiveChatSponsorshipsGiftPurchaseAnnouncement, "LiveChatSponsorshipsGiftPurchaseAnnouncement");
LiveChatSponsorshipsGiftPurchaseAnnouncement.type = "LiveChatSponsorshipsGiftPurchaseAnnouncement";
var LiveChatSponsorshipsGiftPurchaseAnnouncement_default = LiveChatSponsorshipsGiftPurchaseAnnouncement;
// dist/src/parser/classes/livechat/items/LiveChatSponsorshipsGiftRedemptionAnnouncement.js
var LiveChatSponsorshipsGiftRedemptionAnnouncement = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.timestamp_usec = data2.timestampUsec;
this.timestamp_text = new Text(data2.timestampText);
this.author = new Author(data2.authorName, data2.authorBadges, data2.authorPhoto, data2.authorExternalChannelId);
this.message = new Text(data2.message);
this.menu_endpoint = new NavigationEndpoint_default(data2.contextMenuEndpoint);
this.context_menu_accessibility_label = data2.contextMenuAccessibility.accessibilityData.label;
}
};
__name(LiveChatSponsorshipsGiftRedemptionAnnouncement, "LiveChatSponsorshipsGiftRedemptionAnnouncement");
LiveChatSponsorshipsGiftRedemptionAnnouncement.type = "LiveChatSponsorshipsGiftRedemptionAnnouncement";
var LiveChatSponsorshipsGiftRedemptionAnnouncement_default = LiveChatSponsorshipsGiftRedemptionAnnouncement;
// dist/src/parser/classes/livechat/items/LiveChatTextMessage.js
var LiveChatTextMessage = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.message = new Text(data2.message);
this.inline_action_buttons = parser_exports.parseArray(data2.inlineActionButtons, Button_default);
this.timestamp = Math.floor(parseInt(data2.timestampUsec) / 1e3);
this.timestamp_usec = data2.timestampUsec;
if (Reflect.has(data2, "timestampText")) {
this.timestamp_text = new Text(data2.timestampText).toString();
}
this.author = new Author(data2.authorName, data2.authorBadges, data2.authorPhoto, data2.authorExternalChannelId);
if (Reflect.has(data2, "contextMenuEndpoint")) {
this.menu_endpoint = new NavigationEndpoint_default(data2.contextMenuEndpoint);
}
if (Reflect.has(data2, "contextMenuAccessibility") && Reflect.has(data2.contextMenuAccessibility, "accessibilityData") && Reflect.has(data2.contextMenuAccessibility.accessibilityData, "label")) {
this.context_menu_accessibility_label = data2.contextMenuAccessibility.accessibilityData.label;
}
this.before_content_buttons = parser_exports.parseArray(data2.beforeContentButtons, ButtonView_default);
}
};
__name(LiveChatTextMessage, "LiveChatTextMessage");
LiveChatTextMessage.type = "LiveChatTextMessage";
var LiveChatTextMessage_default = LiveChatTextMessage;
// dist/src/parser/classes/livechat/items/LiveChatTickerPaidMessageItem.js
var LiveChatTickerPaidMessageItem = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.author = new Author(data2.authorName || data2.authorUsername, data2.authorBadges, data2.authorPhoto, data2.authorExternalChannelId);
if (Reflect.has(data2, "amount")) {
this.amount = new Text(data2.amount);
}
this.amount_text_color = data2.amountTextColor;
this.start_background_color = data2.startBackgroundColor;
this.end_background_color = data2.endBackgroundColor;
this.duration_sec = data2.durationSec;
this.full_duration_sec = data2.fullDurationSec;
this.show_item = parser_exports.parseItem(data2.showItemEndpoint?.showLiveChatItemEndpoint?.renderer);
this.show_item_endpoint = new NavigationEndpoint_default(data2.showItemEndpoint);
this.animation_origin = data2.animationOrigin;
this.open_engagement_panel_command = new NavigationEndpoint_default(data2.openEngagementPanelCommand);
}
};
__name(LiveChatTickerPaidMessageItem, "LiveChatTickerPaidMessageItem");
LiveChatTickerPaidMessageItem.type = "LiveChatTickerPaidMessageItem";
var LiveChatTickerPaidMessageItem_default = LiveChatTickerPaidMessageItem;
// dist/src/parser/classes/livechat/items/LiveChatTickerPaidStickerItem.js
var LiveChatTickerPaidStickerItem = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.author_external_channel_id = data2.authorExternalChannelId;
this.author_photo = Thumbnail.fromResponse(data2.authorPhoto);
this.start_background_color = data2.startBackgroundColor;
this.end_background_color = data2.endBackgroundColor;
this.duration_sec = data2.durationSec;
this.full_duration_sec = data2.fullDurationSec;
this.show_item = parser_exports.parseItem(data2.showItemEndpoint?.showLiveChatItemEndpoint?.renderer);
this.show_item_endpoint = new NavigationEndpoint_default(data2.showItemEndpoint);
this.ticker_thumbnails = data2.tickerThumbnails.map((item) => ({
thumbnails: Thumbnail.fromResponse(item),
label: item?.accessibility?.accessibilityData?.label
}));
}
};
__name(LiveChatTickerPaidStickerItem, "LiveChatTickerPaidStickerItem");
LiveChatTickerPaidStickerItem.type = "LiveChatTickerPaidStickerItem";
var LiveChatTickerPaidStickerItem_default = LiveChatTickerPaidStickerItem;
// dist/src/parser/classes/livechat/items/LiveChatTickerSponsorItem.js
var LiveChatTickerSponsorItem = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.detail = new Text(data2.detailText);
this.author = new Author(data2.authorName, data2.authorBadges, data2.sponsorPhoto, data2.authorExternalChannelId);
this.duration_sec = data2.durationSec;
}
};
__name(LiveChatTickerSponsorItem, "LiveChatTickerSponsorItem");
LiveChatTickerSponsorItem.type = "LiveChatTickerSponsorItem";
var LiveChatTickerSponsorItem_default = LiveChatTickerSponsorItem;
// dist/src/parser/classes/livechat/items/LiveChatViewerEngagementMessage.js
var LiveChatViewerEngagementMessage = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
if (Reflect.has(data2, "timestampUsec")) {
this.timestamp = Math.floor(parseInt(data2.timestampUsec) / 1e3);
this.timestamp_usec = data2.timestampUsec;
}
if (Reflect.has(data2, "icon") && Reflect.has(data2.icon, "iconType")) {
this.icon_type = data2.icon.iconType;
}
this.message = new Text(data2.message);
this.action_button = parser_exports.parseItem(data2.actionButton);
if (Reflect.has(data2, "contextMenuEndpoint")) {
this.menu_endpoint = new NavigationEndpoint_default(data2.contextMenuEndpoint);
}
if (Reflect.has(data2, "contextMenuAccessibility") && Reflect.has(data2.contextMenuAccessibility, "accessibilityData") && Reflect.has(data2.contextMenuAccessibility.accessibilityData, "label")) {
this.context_menu_accessibility_label = data2.contextMenuAccessibility.accessibilityData.label;
}
}
};
__name(LiveChatViewerEngagementMessage, "LiveChatViewerEngagementMessage");
LiveChatViewerEngagementMessage.type = "LiveChatViewerEngagementMessage";
var LiveChatViewerEngagementMessage_default = LiveChatViewerEngagementMessage;
// dist/src/parser/classes/livechat/items/PollHeader.js
var PollHeader = class extends YTNode {
constructor(data2) {
super();
this.poll_question = new Text(data2.pollQuestion);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.metadata = new Text(data2.metadataText);
this.live_chat_poll_type = data2.liveChatPollType;
this.context_menu_button = parser_exports.parseItem(data2.contextMenuButton, Button_default);
}
};
__name(PollHeader, "PollHeader");
PollHeader.type = "PollHeader";
var PollHeader_default = PollHeader;
// dist/src/parser/classes/livechat/LiveChatActionPanel.js
var LiveChatActionPanel = class extends YTNode {
constructor(data2) {
super();
this.id = data2.id;
this.contents = parser_exports.parse(data2.contents);
this.target_id = data2.targetId;
}
};
__name(LiveChatActionPanel, "LiveChatActionPanel");
LiveChatActionPanel.type = "LiveChatActionPanel";
var LiveChatActionPanel_default = LiveChatActionPanel;
// dist/src/parser/classes/livechat/MarkChatItemAsDeletedAction.js
var MarkChatItemAsDeletedAction = class extends YTNode {
constructor(data2) {
super();
this.deleted_state_message = new Text(data2.deletedStateMessage);
this.target_item_id = data2.targetItemId;
}
};
__name(MarkChatItemAsDeletedAction, "MarkChatItemAsDeletedAction");
MarkChatItemAsDeletedAction.type = "MarkChatItemAsDeletedAction";
var MarkChatItemAsDeletedAction_default = MarkChatItemAsDeletedAction;
// dist/src/parser/classes/livechat/MarkChatItemsByAuthorAsDeletedAction.js
var MarkChatItemsByAuthorAsDeletedAction = class extends YTNode {
constructor(data2) {
super();
this.deleted_state_message = new Text(data2.deletedStateMessage);
this.external_channel_id = data2.externalChannelId;
}
};
__name(MarkChatItemsByAuthorAsDeletedAction, "MarkChatItemsByAuthorAsDeletedAction");
MarkChatItemsByAuthorAsDeletedAction.type = "MarkChatItemsByAuthorAsDeletedAction";
var MarkChatItemsByAuthorAsDeletedAction_default = MarkChatItemsByAuthorAsDeletedAction;
// dist/src/parser/classes/livechat/RemoveBannerForLiveChatCommand.js
var RemoveBannerForLiveChatCommand = class extends YTNode {
constructor(data2) {
super();
this.target_action_id = data2.targetActionId;
}
};
__name(RemoveBannerForLiveChatCommand, "RemoveBannerForLiveChatCommand");
RemoveBannerForLiveChatCommand.type = "RemoveBannerForLiveChatCommand";
var RemoveBannerForLiveChatCommand_default = RemoveBannerForLiveChatCommand;
// dist/src/parser/classes/livechat/RemoveChatItemAction.js
var RemoveChatItemAction = class extends YTNode {
constructor(data2) {
super();
this.target_item_id = data2.targetItemId;
}
};
__name(RemoveChatItemAction, "RemoveChatItemAction");
RemoveChatItemAction.type = "RemoveChatItemAction";
var RemoveChatItemAction_default = RemoveChatItemAction;
// dist/src/parser/classes/livechat/RemoveChatItemByAuthorAction.js
var RemoveChatItemByAuthorAction = class extends YTNode {
constructor(data2) {
super();
this.external_channel_id = data2.externalChannelId;
}
};
__name(RemoveChatItemByAuthorAction, "RemoveChatItemByAuthorAction");
RemoveChatItemByAuthorAction.type = "RemoveChatItemByAuthorAction";
var RemoveChatItemByAuthorAction_default = RemoveChatItemByAuthorAction;
// dist/src/parser/classes/livechat/ReplaceChatItemAction.js
var ReplaceChatItemAction = class extends YTNode {
constructor(data2) {
super();
this.target_item_id = data2.targetItemId;
this.replacement_item = parser_exports.parseItem(data2.replacementItem);
}
};
__name(ReplaceChatItemAction, "ReplaceChatItemAction");
ReplaceChatItemAction.type = "ReplaceChatItemAction";
var ReplaceChatItemAction_default = ReplaceChatItemAction;
// dist/src/parser/classes/livechat/ReplaceLiveChatAction.js
var ReplaceLiveChatAction = class extends YTNode {
constructor(data2) {
super();
this.to_replace = data2.toReplace;
this.replacement = parser_exports.parseItem(data2.replacement);
}
};
__name(ReplaceLiveChatAction, "ReplaceLiveChatAction");
ReplaceLiveChatAction.type = "ReplaceLiveChatAction";
var ReplaceLiveChatAction_default = ReplaceLiveChatAction;
// dist/src/parser/classes/livechat/ReplayChatItemAction.js
var ReplayChatItemAction = class extends YTNode {
constructor(data2) {
super();
this.actions = parser_exports.parseArray(data2.actions?.map((action) => {
delete action.clickTrackingParams;
return action;
}));
this.video_offset_time_msec = data2.videoOffsetTimeMsec;
}
};
__name(ReplayChatItemAction, "ReplayChatItemAction");
ReplayChatItemAction.type = "ReplayChatItemAction";
var ReplayChatItemAction_default = ReplayChatItemAction;
// dist/src/parser/classes/livechat/ShowLiveChatActionPanelAction.js
var ShowLiveChatActionPanelAction = class extends YTNode {
constructor(data2) {
super();
this.panel_to_show = parser_exports.parseItem(data2.panelToShow, LiveChatActionPanel_default);
}
};
__name(ShowLiveChatActionPanelAction, "ShowLiveChatActionPanelAction");
ShowLiveChatActionPanelAction.type = "ShowLiveChatActionPanelAction";
var ShowLiveChatActionPanelAction_default = ShowLiveChatActionPanelAction;
// dist/src/parser/classes/livechat/ShowLiveChatDialogAction.js
var ShowLiveChatDialogAction = class extends YTNode {
constructor(data2) {
super();
this.dialog = parser_exports.parseItem(data2.dialog);
}
};
__name(ShowLiveChatDialogAction, "ShowLiveChatDialogAction");
ShowLiveChatDialogAction.type = "ShowLiveChatDialogAction";
var ShowLiveChatDialogAction_default = ShowLiveChatDialogAction;
// dist/src/parser/classes/livechat/ShowLiveChatTooltipCommand.js
var ShowLiveChatTooltipCommand = class extends YTNode {
constructor(data2) {
super();
this.tooltip = parser_exports.parseItem(data2.tooltip);
}
};
__name(ShowLiveChatTooltipCommand, "ShowLiveChatTooltipCommand");
ShowLiveChatTooltipCommand.type = "ShowLiveChatTooltipCommand";
var ShowLiveChatTooltipCommand_default = ShowLiveChatTooltipCommand;
// dist/src/parser/classes/livechat/UpdateDateTextAction.js
var UpdateDateTextAction = class extends YTNode {
constructor(data2) {
super();
this.date_text = new Text(data2.dateText).toString();
}
};
__name(UpdateDateTextAction, "UpdateDateTextAction");
UpdateDateTextAction.type = "UpdateDateTextAction";
var UpdateDateTextAction_default = UpdateDateTextAction;
// dist/src/parser/classes/livechat/UpdateDescriptionAction.js
var UpdateDescriptionAction = class extends YTNode {
constructor(data2) {
super();
this.description = new Text(data2.description);
}
};
__name(UpdateDescriptionAction, "UpdateDescriptionAction");
UpdateDescriptionAction.type = "UpdateDescriptionAction";
var UpdateDescriptionAction_default = UpdateDescriptionAction;
// dist/src/parser/classes/livechat/UpdateLiveChatPollAction.js
var UpdateLiveChatPollAction = class extends YTNode {
constructor(data2) {
super();
this.poll_to_update = parser_exports.parseItem(data2.pollToUpdate);
}
};
__name(UpdateLiveChatPollAction, "UpdateLiveChatPollAction");
UpdateLiveChatPollAction.type = "UpdateLiveChatPollAction";
var UpdateLiveChatPollAction_default = UpdateLiveChatPollAction;
// dist/src/parser/classes/livechat/UpdateTitleAction.js
var UpdateTitleAction = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
}
};
__name(UpdateTitleAction, "UpdateTitleAction");
UpdateTitleAction.type = "UpdateTitleAction";
var UpdateTitleAction_default = UpdateTitleAction;
// dist/src/parser/classes/livechat/UpdateToggleButtonTextAction.js
var UpdateToggleButtonTextAction = class extends YTNode {
constructor(data2) {
super();
this.default_text = new Text(data2.defaultText).toString();
this.toggled_text = new Text(data2.toggledText).toString();
this.button_id = data2.buttonId;
}
};
__name(UpdateToggleButtonTextAction, "UpdateToggleButtonTextAction");
UpdateToggleButtonTextAction.type = "UpdateToggleButtonTextAction";
var UpdateToggleButtonTextAction_default = UpdateToggleButtonTextAction;
// dist/src/parser/classes/livechat/UpdateViewershipAction.js
var UpdateViewershipAction = class extends YTNode {
constructor(data2) {
super();
const view_count_renderer = data2.viewCount.videoViewCountRenderer;
this.view_count = new Text(view_count_renderer.viewCount);
this.extra_short_view_count = new Text(view_count_renderer.extraShortViewCount);
this.original_view_count = parseInt(view_count_renderer.originalViewCount);
this.unlabeled_view_count_value = new Text(view_count_renderer.unlabeledViewCountValue);
this.is_live = view_count_renderer.isLive;
}
};
__name(UpdateViewershipAction, "UpdateViewershipAction");
UpdateViewershipAction.type = "UpdateViewershipAction";
var UpdateViewershipAction_default = UpdateViewershipAction;
// dist/src/parser/classes/LiveChatDialog.js
var LiveChatDialog = class extends YTNode {
constructor(data2) {
super();
this.confirm_button = parser_exports.parseItem(data2.confirmButton, Button_default);
this.dialog_messages = data2.dialogMessages.map((el) => new Text(el));
}
};
__name(LiveChatDialog, "LiveChatDialog");
LiveChatDialog.type = "LiveChatDialog";
var LiveChatDialog_default = LiveChatDialog;
// dist/src/parser/classes/LiveChatHeader.js
var LiveChatHeader = class extends YTNode {
constructor(data2) {
super();
this.overflow_menu = parser_exports.parseItem(data2.overflowMenu, Menu_default);
this.collapse_button = parser_exports.parseItem(data2.collapseButton, Button_default);
this.view_selector = parser_exports.parseItem(data2.viewSelector, SortFilterSubMenu_default);
}
};
__name(LiveChatHeader, "LiveChatHeader");
LiveChatHeader.type = "LiveChatHeader";
var LiveChatHeader_default = LiveChatHeader;
// dist/src/parser/classes/LiveChatItemList.js
var LiveChatItemList = class extends YTNode {
constructor(data2) {
super();
this.max_items_to_display = data2.maxItemsToDisplay;
this.more_comments_below_button = parser_exports.parseItem(data2.moreCommentsBelowButton, Button_default);
}
};
__name(LiveChatItemList, "LiveChatItemList");
LiveChatItemList.type = "LiveChatItemList";
var LiveChatItemList_default = LiveChatItemList;
// dist/src/parser/classes/LiveChatMessageInput.js
var LiveChatMessageInput = class extends YTNode {
constructor(data2) {
super();
this.author_name = new Text(data2.authorName);
this.author_photo = Thumbnail.fromResponse(data2.authorPhoto);
this.send_button = parser_exports.parseItem(data2.sendButton, Button_default);
this.target_id = data2.targetId;
}
};
__name(LiveChatMessageInput, "LiveChatMessageInput");
LiveChatMessageInput.type = "LiveChatMessageInput";
var LiveChatMessageInput_default = LiveChatMessageInput;
// dist/src/parser/classes/LiveChatParticipant.js
var LiveChatParticipant = class extends YTNode {
constructor(data2) {
super();
this.name = new Text(data2.authorName);
this.photo = Thumbnail.fromResponse(data2.authorPhoto);
this.badges = parser_exports.parseArray(data2.authorBadges);
}
};
__name(LiveChatParticipant, "LiveChatParticipant");
LiveChatParticipant.type = "LiveChatParticipant";
var LiveChatParticipant_default = LiveChatParticipant;
// dist/src/parser/classes/LiveChatParticipantsList.js
var LiveChatParticipantsList = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.participants = parser_exports.parseArray(data2.participants, LiveChatParticipant_default);
}
};
__name(LiveChatParticipantsList, "LiveChatParticipantsList");
LiveChatParticipantsList.type = "LiveChatParticipantsList";
var LiveChatParticipantsList_default = LiveChatParticipantsList;
// dist/src/parser/classes/LockupMetadataView.js
var LockupMetadataView = class extends YTNode {
constructor(data2) {
super();
this.title = Text.fromAttributed(data2.title);
this.metadata = parser_exports.parseItem(data2.metadata, ContentMetadataView_default);
this.image = parser_exports.parseItem(data2.image, DecoratedAvatarView_default);
this.menu_button = parser_exports.parseItem(data2.menuButton, ButtonView_default);
}
};
__name(LockupMetadataView, "LockupMetadataView");
LockupMetadataView.type = "LockupMetadataView";
var LockupMetadataView_default = LockupMetadataView;
// dist/src/parser/classes/LockupView.js
var LockupView = class extends YTNode {
constructor(data2) {
super();
this.content_image = parser_exports.parseItem(data2.contentImage, [CollectionThumbnailView_default, ThumbnailView_default]);
this.metadata = parser_exports.parseItem(data2.metadata, LockupMetadataView_default);
this.content_id = data2.contentId;
this.content_type = data2.contentType.replace("LOCKUP_CONTENT_TYPE_", "");
this.renderer_context = new RendererContext(data2.rendererContext);
}
};
__name(LockupView, "LockupView");
LockupView.type = "LockupView";
var LockupView_default = LockupView;
// dist/src/parser/classes/menus/MenuNavigationItem.js
var MenuNavigationItem = class extends Button_default {
constructor(data2) {
super(data2);
}
};
__name(MenuNavigationItem, "MenuNavigationItem");
MenuNavigationItem.type = "MenuNavigationItem";
var MenuNavigationItem_default = MenuNavigationItem;
// dist/src/parser/classes/menus/MenuPopup.js
var MenuPopup = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items, [MenuNavigationItem_default, MenuServiceItem_default]);
}
};
__name(MenuPopup, "MenuPopup");
MenuPopup.type = "MenuPopup";
var MenuPopup_default = MenuPopup;
// dist/src/parser/classes/menus/MultiPageMenuNotificationSection.js
var MultiPageMenuNotificationSection = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
}
get contents() {
return this.items;
}
};
__name(MultiPageMenuNotificationSection, "MultiPageMenuNotificationSection");
MultiPageMenuNotificationSection.type = "MultiPageMenuNotificationSection";
var MultiPageMenuNotificationSection_default = MultiPageMenuNotificationSection;
// dist/src/parser/classes/menus/MusicMenuItemDivider.js
var MusicMenuItemDivider = class extends YTNode {
constructor(_data) {
super();
}
};
__name(MusicMenuItemDivider, "MusicMenuItemDivider");
MusicMenuItemDivider.type = "MusicMenuItemDivider";
var MusicMenuItemDivider_default = MusicMenuItemDivider;
// dist/src/parser/classes/menus/MusicMultiSelectMenuItem.js
var MusicMultiSelectMenuItem = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title).toString();
this.form_item_entity_key = data2.formItemEntityKey;
if (Reflect.has(data2, "selectedIcon")) {
this.selected_icon_type = data2.selectedIcon.iconType;
}
if (Reflect.has(data2, "selectedCommand")) {
this.endpoint = new NavigationEndpoint_default(data2.selectedCommand);
}
this.selected = !!this.endpoint;
}
};
__name(MusicMultiSelectMenuItem, "MusicMultiSelectMenuItem");
MusicMultiSelectMenuItem.type = "MusicMultiSelectMenuItem";
var MusicMultiSelectMenuItem_default = MusicMultiSelectMenuItem;
// dist/src/parser/classes/menus/MusicMultiSelectMenu.js
var MusicMultiSelectMenu = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "title") && Reflect.has(data2.title, "musicMenuTitleRenderer")) {
this.title = new Text(data2.title.musicMenuTitleRenderer?.primaryText);
}
this.options = parser_exports.parseArray(data2.options, [MusicMultiSelectMenuItem_default, MusicMenuItemDivider_default]);
}
};
__name(MusicMultiSelectMenu, "MusicMultiSelectMenu");
MusicMultiSelectMenu.type = "MusicMultiSelectMenu";
var MusicMultiSelectMenu_default = MusicMultiSelectMenu;
// dist/src/parser/classes/menus/SimpleMenuHeader.js
var SimpleMenuHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.buttons = parser_exports.parseArray(data2.buttons, Button_default);
}
};
__name(SimpleMenuHeader, "SimpleMenuHeader");
SimpleMenuHeader.type = "SimpleMenuHeader";
var SimpleMenuHeader_default = SimpleMenuHeader;
// dist/src/parser/classes/MerchandiseItem.js
var MerchandiseItem = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title;
this.description = data2.description;
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.price = data2.price;
this.vendor_name = data2.vendorName;
this.button_text = data2.buttonText;
this.button_accessibility_text = data2.buttonAccessibilityText;
this.from_vendor_text = data2.fromVendorText;
this.additional_fees_text = data2.additionalFeesText;
this.region_format = data2.regionFormat;
this.endpoint = new NavigationEndpoint_default(data2.buttonCommand);
}
};
__name(MerchandiseItem, "MerchandiseItem");
MerchandiseItem.type = "MerchandiseItem";
var MerchandiseItem_default = MerchandiseItem;
// dist/src/parser/classes/MerchandiseShelf.js
var MerchandiseShelf = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title;
this.menu = parser_exports.parseItem(data2.actionButton);
this.items = parser_exports.parseArray(data2.items);
}
get contents() {
return this.items;
}
};
__name(MerchandiseShelf, "MerchandiseShelf");
MerchandiseShelf.type = "MerchandiseShelf";
var MerchandiseShelf_default = MerchandiseShelf;
// dist/src/parser/classes/MetadataRow.js
var MetadataRow = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.contents = data2.contents.map((content) => new Text(content));
}
};
__name(MetadataRow, "MetadataRow");
MetadataRow.type = "MetadataRow";
var MetadataRow_default = MetadataRow;
// dist/src/parser/classes/MetadataRowContainer.js
var MetadataRowContainer = class extends YTNode {
constructor(data2) {
super();
this.rows = parser_exports.parseArray(data2.rows);
this.collapsed_item_count = data2.collapsedItemCount;
}
};
__name(MetadataRowContainer, "MetadataRowContainer");
MetadataRowContainer.type = "MetadataRowContainer";
var MetadataRowContainer_default = MetadataRowContainer;
// dist/src/parser/classes/MetadataRowHeader.js
var MetadataRowHeader = class extends YTNode {
constructor(data2) {
super();
this.content = new Text(data2.content);
this.has_divider_line = data2.hasDividerLine;
}
};
__name(MetadataRowHeader, "MetadataRowHeader");
MetadataRowHeader.type = "MetadataRowHeader";
var MetadataRowHeader_default = MetadataRowHeader;
// dist/src/parser/classes/MetadataScreen.js
var MetadataScreen = class extends YTNode {
constructor(data2) {
super();
this.section_list = parser_exports.parseItem(data2);
}
};
__name(MetadataScreen, "MetadataScreen");
MetadataScreen.type = "MetadataScreen";
var MetadataScreen_default = MetadataScreen;
// dist/src/parser/classes/MicroformatData.js
var MicroformatData = class extends YTNode {
constructor(data2) {
super();
this.url_canonical = data2.urlCanonical;
this.title = data2.title;
this.description = data2.description;
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.site_name = data2.siteName;
this.app_name = data2.appName;
this.android_package = data2.androidPackage;
this.ios_app_store_id = data2.iosAppStoreId;
this.ios_app_arguments = data2.iosAppArguments;
this.og_type = data2.ogType;
this.url_applinks_web = data2.urlApplinksWeb;
this.url_applinks_ios = data2.urlApplinksIos;
this.url_applinks_android = data2.urlApplinksAndroid;
this.url_twitter_ios = data2.urlTwitterIos;
this.url_twitter_android = data2.urlTwitterAndroid;
this.twitter_card_type = data2.twitterCardType;
this.twitter_site_handle = data2.twitterSiteHandle;
this.schema_dot_org_type = data2.schemaDotOrgType;
this.noindex = data2.noindex;
this.is_unlisted = data2.unlisted;
this.is_family_safe = data2.familySafe;
this.tags = data2.tags;
this.available_countries = data2.availableCountries;
}
};
__name(MicroformatData, "MicroformatData");
MicroformatData.type = "MicroformatData";
var MicroformatData_default = MicroformatData;
// dist/src/parser/classes/Mix.js
var Mix = class extends Playlist_default {
constructor(data2) {
super(data2);
}
};
__name(Mix, "Mix");
Mix.type = "Mix";
var Mix_default = Mix;
// dist/src/parser/classes/ModalWithTitleAndButton.js
var ModalWithTitleAndButton = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.content = new Text(data2.content);
this.button = parser_exports.parseItem(data2.button, Button_default);
}
};
__name(ModalWithTitleAndButton, "ModalWithTitleAndButton");
ModalWithTitleAndButton.type = "ModalWithTitleAndButton";
var ModalWithTitleAndButton_default = ModalWithTitleAndButton;
// dist/src/parser/classes/Movie.js
var Movie = class extends YTNode {
constructor(data2) {
super();
const overlay_time_status = data2.thumbnailOverlays.find((overlay) => overlay.thumbnailOverlayTimeStatusRenderer)?.thumbnailOverlayTimeStatusRenderer.text || "N/A";
this.id = data2.videoId;
this.title = new Text(data2.title);
if (Reflect.has(data2, "descriptionSnippet")) {
this.description_snippet = new Text(data2.descriptionSnippet);
}
this.top_metadata_items = new Text(data2.topMetadataItems);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
this.author = new Author(data2.longBylineText, data2.ownerBadges, data2.channelThumbnailSupportedRenderers?.channelThumbnailWithLinkRenderer?.thumbnail);
this.duration = {
text: data2.lengthText ? new Text(data2.lengthText).toString() : new Text(overlay_time_status).toString(),
seconds: timeToSeconds(data2.lengthText ? new Text(data2.lengthText).toString() : new Text(overlay_time_status).toString())
};
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.badges = parser_exports.parseArray(data2.badges);
this.use_vertical_poster = data2.useVerticalPoster;
this.show_action_menu = data2.showActionMenu;
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
}
};
__name(Movie, "Movie");
Movie.type = "Movie";
var Movie_default = Movie;
// dist/src/parser/classes/MovingThumbnail.js
var MovingThumbnail = class extends YTNode {
constructor(data2) {
super();
return data2.movingThumbnailDetails?.thumbnails.map((thumbnail) => new Thumbnail(thumbnail)).sort((a, b) => b.width - a.width);
}
};
__name(MovingThumbnail, "MovingThumbnail");
MovingThumbnail.type = "MovingThumbnail";
var MovingThumbnail_default = MovingThumbnail;
// dist/src/parser/classes/MusicCardShelfHeaderBasic.js
var MusicCardShelfHeaderBasic = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
}
};
__name(MusicCardShelfHeaderBasic, "MusicCardShelfHeaderBasic");
MusicCardShelfHeaderBasic.type = "MusicCardShelfHeaderBasic";
var MusicCardShelfHeaderBasic_default = MusicCardShelfHeaderBasic;
// dist/src/parser/classes/MusicInlineBadge.js
var MusicInlineBadge = class extends YTNode {
constructor(data2) {
super();
this.icon_type = data2.icon.iconType;
this.label = data2.accessibilityData.accessibilityData.label;
}
};
__name(MusicInlineBadge, "MusicInlineBadge");
MusicInlineBadge.type = "MusicInlineBadge";
var MusicInlineBadge_default = MusicInlineBadge;
// dist/src/parser/classes/MusicPlayButton.js
var MusicPlayButton = class extends YTNode {
constructor(data2) {
super();
this.endpoint = new NavigationEndpoint_default(data2.playNavigationEndpoint);
this.play_icon_type = data2.playIcon.iconType;
this.pause_icon_type = data2.pauseIcon.iconType;
if (Reflect.has(data2, "accessibilityPlayData")) {
this.play_label = data2.accessibilityPlayData.accessibilityData?.label;
}
if (Reflect.has(data2, "accessibilityPauseData")) {
this.pause_label = data2.accessibilityPauseData.accessibilityData?.label;
}
this.icon_color = data2.iconColor;
}
};
__name(MusicPlayButton, "MusicPlayButton");
MusicPlayButton.type = "MusicPlayButton";
var MusicPlayButton_default = MusicPlayButton;
// dist/src/parser/classes/MusicItemThumbnailOverlay.js
var MusicItemThumbnailOverlay = class extends YTNode {
constructor(data2) {
super();
this.content = parser_exports.parseItem(data2.content, MusicPlayButton_default);
this.content_position = data2.contentPosition;
this.display_style = data2.displayStyle;
}
};
__name(MusicItemThumbnailOverlay, "MusicItemThumbnailOverlay");
MusicItemThumbnailOverlay.type = "MusicItemThumbnailOverlay";
var MusicItemThumbnailOverlay_default = MusicItemThumbnailOverlay;
// dist/src/parser/classes/MusicThumbnail.js
var MusicThumbnail = class extends YTNode {
constructor(data2) {
super();
this.contents = Thumbnail.fromResponse(data2.thumbnail);
}
};
__name(MusicThumbnail, "MusicThumbnail");
MusicThumbnail.type = "MusicThumbnail";
var MusicThumbnail_default = MusicThumbnail;
// dist/src/parser/classes/MusicCardShelf.js
var MusicCardShelf = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = parser_exports.parseItem(data2.thumbnail, MusicThumbnail_default);
this.title = new Text(data2.title);
this.subtitle = new Text(data2.subtitle);
this.buttons = parser_exports.parseArray(data2.buttons, Button_default);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
this.on_tap = new NavigationEndpoint_default(data2.onTap);
this.header = parser_exports.parseItem(data2.header, MusicCardShelfHeaderBasic_default);
if (Reflect.has(data2, "endIcon") && Reflect.has(data2.endIcon, "iconType")) {
this.end_icon_type = data2.endIcon.iconType;
}
this.subtitle_badges = parser_exports.parseArray(data2.subtitleBadges, MusicInlineBadge_default);
this.thumbnail_overlay = parser_exports.parseItem(data2.thumbnailOverlay, MusicItemThumbnailOverlay_default);
if (Reflect.has(data2, "contents")) {
this.contents = parser_exports.parseArray(data2.contents);
}
}
};
__name(MusicCardShelf, "MusicCardShelf");
MusicCardShelf.type = "MusicCardShelf";
var MusicCardShelf_default = MusicCardShelf;
// dist/src/parser/classes/MusicCarouselShelfBasicHeader.js
var MusicCarouselShelfBasicHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
if (Reflect.has(data2, "strapline")) {
this.strapline = new Text(data2.strapline);
}
if (Reflect.has(data2, "thumbnail")) {
this.thumbnail = parser_exports.parseItem(data2.thumbnail, MusicThumbnail_default);
}
if (Reflect.has(data2, "moreContentButton")) {
this.more_content = parser_exports.parseItem(data2.moreContentButton, Button_default);
}
if (Reflect.has(data2, "endIcons")) {
this.end_icons = parser_exports.parseArray(data2.endIcons, IconLink_default);
}
}
};
__name(MusicCarouselShelfBasicHeader, "MusicCarouselShelfBasicHeader");
MusicCarouselShelfBasicHeader.type = "MusicCarouselShelfBasicHeader";
var MusicCarouselShelfBasicHeader_default = MusicCarouselShelfBasicHeader;
// dist/src/parser/classes/MusicMultiRowListItem.js
var MusicMultiRowListItem = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = parser_exports.parseItem(data2.thumbnail, MusicThumbnail_default);
this.overlay = parser_exports.parseItem(data2.overlay, MusicItemThumbnailOverlay_default);
this.on_tap = new NavigationEndpoint_default(data2.onTap);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
this.subtitle = new Text(data2.subtitle);
this.title = new Text(data2.title);
if (Reflect.has(data2, "secondTitle")) {
this.second_title = new Text(data2.secondTitle);
}
if (Reflect.has(data2, "description")) {
this.description = new Text(data2.description);
}
if (Reflect.has(data2, "displayStyle")) {
this.display_style = data2.displayStyle;
}
}
};
__name(MusicMultiRowListItem, "MusicMultiRowListItem");
MusicMultiRowListItem.type = "MusicMultiRowListItem";
var MusicMultiRowListItem_default = MusicMultiRowListItem;
// dist/src/parser/classes/MusicNavigationButton.js
var MusicNavigationButton = class extends YTNode {
constructor(data2) {
super();
this.button_text = new Text(data2.buttonText).toString();
this.endpoint = new NavigationEndpoint_default(data2.clickCommand);
}
};
__name(MusicNavigationButton, "MusicNavigationButton");
MusicNavigationButton.type = "MusicNavigationButton";
var MusicNavigationButton_default = MusicNavigationButton;
// dist/src/parser/classes/MusicResponsiveListItemFixedColumn.js
var MusicResponsiveListItemFixedColumn = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.text);
this.display_priority = data2.displayPriority;
}
};
__name(MusicResponsiveListItemFixedColumn, "MusicResponsiveListItemFixedColumn");
MusicResponsiveListItemFixedColumn.type = "musicResponsiveListItemFlexColumnRenderer";
var MusicResponsiveListItemFixedColumn_default = MusicResponsiveListItemFixedColumn;
// dist/src/parser/classes/MusicResponsiveListItemFlexColumn.js
var MusicResponsiveListItemFlexColumn = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.text);
this.display_priority = data2.displayPriority;
}
};
__name(MusicResponsiveListItemFlexColumn, "MusicResponsiveListItemFlexColumn");
MusicResponsiveListItemFlexColumn.type = "MusicResponsiveListItemFlexColumn";
var MusicResponsiveListItemFlexColumn_default = MusicResponsiveListItemFlexColumn;
// dist/src/parser/classes/MusicResponsiveListItem.js
var _MusicResponsiveListItem_instances;
var _MusicResponsiveListItem_playlist_item_data;
var _MusicResponsiveListItem_parseOther;
var _MusicResponsiveListItem_parseVideoOrSong;
var _MusicResponsiveListItem_parseSong;
var _MusicResponsiveListItem_parseVideo;
var _MusicResponsiveListItem_parseArtist;
var _MusicResponsiveListItem_parseLibraryArtist;
var _MusicResponsiveListItem_parseNonMusicTrack;
var _MusicResponsiveListItem_parsePodcastShow;
var _MusicResponsiveListItem_parseAlbum;
var _MusicResponsiveListItem_parsePlaylist;
var MusicResponsiveListItem = class extends YTNode {
constructor(data2) {
super();
_MusicResponsiveListItem_instances.add(this);
_MusicResponsiveListItem_playlist_item_data.set(this, void 0);
this.flex_columns = parser_exports.parseArray(data2.flexColumns, MusicResponsiveListItemFlexColumn_default);
this.fixed_columns = parser_exports.parseArray(data2.fixedColumns, MusicResponsiveListItemFixedColumn_default);
__classPrivateFieldSet(this, _MusicResponsiveListItem_playlist_item_data, {
video_id: data2?.playlistItemData?.videoId || null,
playlist_set_video_id: data2?.playlistItemData?.playlistSetVideoId || null
}, "f");
if (Reflect.has(data2, "navigationEndpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
let page_type = this.endpoint?.payload?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType;
if (!page_type) {
const is_non_music_track = this.flex_columns.find((col) => col.title.endpoint?.payload?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType === "MUSIC_PAGE_TYPE_NON_MUSIC_AUDIO_TRACK_PAGE");
if (is_non_music_track) {
page_type = "MUSIC_PAGE_TYPE_NON_MUSIC_AUDIO_TRACK_PAGE";
}
}
switch (page_type) {
case "MUSIC_PAGE_TYPE_ALBUM":
this.item_type = "album";
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parseAlbum).call(this);
break;
case "MUSIC_PAGE_TYPE_PLAYLIST":
this.item_type = "playlist";
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parsePlaylist).call(this);
break;
case "MUSIC_PAGE_TYPE_ARTIST":
case "MUSIC_PAGE_TYPE_USER_CHANNEL":
this.item_type = "artist";
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parseArtist).call(this);
break;
case "MUSIC_PAGE_TYPE_LIBRARY_ARTIST":
this.item_type = "library_artist";
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parseLibraryArtist).call(this);
break;
case "MUSIC_PAGE_TYPE_NON_MUSIC_AUDIO_TRACK_PAGE":
this.item_type = "non_music_track";
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parseNonMusicTrack).call(this);
break;
case "MUSIC_PAGE_TYPE_PODCAST_SHOW_DETAIL_PAGE":
this.item_type = "podcast_show";
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parsePodcastShow).call(this);
break;
default:
if (this.flex_columns[1]) {
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parseVideoOrSong).call(this);
} else {
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parseOther).call(this);
}
}
if (Reflect.has(data2, "index")) {
this.index = new Text(data2.index);
}
if (Reflect.has(data2, "thumbnail")) {
this.thumbnail = parser_exports.parseItem(data2.thumbnail, MusicThumbnail_default);
}
if (Reflect.has(data2, "badges")) {
this.badges = parser_exports.parseArray(data2.badges);
}
if (Reflect.has(data2, "menu")) {
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
}
if (Reflect.has(data2, "overlay")) {
this.overlay = parser_exports.parseItem(data2.overlay, MusicItemThumbnailOverlay_default);
}
}
get thumbnails() {
return this.thumbnail?.contents || [];
}
};
__name(MusicResponsiveListItem, "MusicResponsiveListItem");
_MusicResponsiveListItem_playlist_item_data = /* @__PURE__ */ new WeakMap(), _MusicResponsiveListItem_instances = /* @__PURE__ */ new WeakSet(), _MusicResponsiveListItem_parseOther = /* @__PURE__ */ __name(function _MusicResponsiveListItem_parseOther2() {
this.title = this.flex_columns[0].title.toString();
if (this.endpoint) {
this.item_type = "endpoint";
} else {
this.item_type = "unknown";
}
}, "_MusicResponsiveListItem_parseOther"), _MusicResponsiveListItem_parseVideoOrSong = /* @__PURE__ */ __name(function _MusicResponsiveListItem_parseVideoOrSong2() {
const music_video_type = this.flex_columns.at(0)?.title.runs?.at(0)?.endpoint?.payload?.watchEndpointMusicSupportedConfigs?.watchEndpointMusicConfig?.musicVideoType;
switch (music_video_type) {
case "MUSIC_VIDEO_TYPE_UGC":
case "MUSIC_VIDEO_TYPE_OMV":
this.item_type = "video";
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parseVideo).call(this);
break;
case "MUSIC_VIDEO_TYPE_ATV":
this.item_type = "song";
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parseSong).call(this);
break;
default:
__classPrivateFieldGet(this, _MusicResponsiveListItem_instances, "m", _MusicResponsiveListItem_parseOther).call(this);
}
}, "_MusicResponsiveListItem_parseVideoOrSong"), _MusicResponsiveListItem_parseSong = /* @__PURE__ */ __name(function _MusicResponsiveListItem_parseSong2() {
this.id = __classPrivateFieldGet(this, _MusicResponsiveListItem_playlist_item_data, "f").video_id || this.endpoint?.payload?.videoId;
this.title = this.flex_columns[0].title.toString();
const duration_text = this.flex_columns.at(1)?.title.runs?.find((run) => /^\d+$/.test(run.text.replace(/:/g, "")))?.text || this.fixed_columns[0]?.title?.toString();
if (duration_text) {
this.duration = {
text: duration_text,
seconds: timeToSeconds(duration_text)
};
}
const album_run = this.flex_columns.at(1)?.title.runs?.find((run) => isTextRun(run) && run.endpoint && run.endpoint.payload.browseId.startsWith("MPR")) || this.flex_columns.at(2)?.title.runs?.find((run) => isTextRun(run) && run.endpoint && run.endpoint.payload.browseId.startsWith("MPR"));
if (album_run && isTextRun(album_run)) {
this.album = {
id: album_run.endpoint?.payload?.browseId,
name: album_run.text,
endpoint: album_run.endpoint
};
}
const artist_runs = this.flex_columns.at(1)?.title.runs?.filter((run) => isTextRun(run) && run.endpoint && run.endpoint.payload.browseId.startsWith("UC"));
if (artist_runs) {
this.artists = artist_runs.map((run) => ({
name: run.text,
channel_id: isTextRun(run) ? run.endpoint?.payload?.browseId : void 0,
endpoint: isTextRun(run) ? run.endpoint : void 0
}));
}
}, "_MusicResponsiveListItem_parseSong"), _MusicResponsiveListItem_parseVideo = /* @__PURE__ */ __name(function _MusicResponsiveListItem_parseVideo2() {
this.id = __classPrivateFieldGet(this, _MusicResponsiveListItem_playlist_item_data, "f").video_id;
this.title = this.flex_columns[0].title.toString();
this.views = this.flex_columns.at(1)?.title.runs?.find((run) => run.text.match(/(.*?) views/))?.toString();
const author_runs = this.flex_columns.at(1)?.title.runs?.filter((run) => isTextRun(run) && run.endpoint && run.endpoint.payload.browseId.startsWith("UC"));
if (author_runs) {
this.authors = author_runs.map((run) => {
return {
name: run.text,
channel_id: isTextRun(run) ? run.endpoint?.payload?.browseId : void 0,
endpoint: isTextRun(run) ? run.endpoint : void 0
};
});
}
const duration_text = this.flex_columns[1].title.runs?.find((run) => /^\d+$/.test(run.text.replace(/:/g, "")))?.text || this.fixed_columns[0]?.title.runs?.find((run) => /^\d+$/.test(run.text.replace(/:/g, "")))?.text;
if (duration_text) {
this.duration = {
text: duration_text,
seconds: timeToSeconds(duration_text)
};
}
}, "_MusicResponsiveListItem_parseVideo"), _MusicResponsiveListItem_parseArtist = /* @__PURE__ */ __name(function _MusicResponsiveListItem_parseArtist2() {
this.id = this.endpoint?.payload?.browseId;
this.name = this.flex_columns[0].title.toString();
this.subtitle = this.flex_columns.at(1)?.title;
this.subscribers = this.subtitle?.runs?.find((run) => /^(\d*\.)?\d+[M|K]? subscribers?$/i.test(run.text))?.text || "";
}, "_MusicResponsiveListItem_parseArtist"), _MusicResponsiveListItem_parseLibraryArtist = /* @__PURE__ */ __name(function _MusicResponsiveListItem_parseLibraryArtist2() {
this.name = this.flex_columns[0].title.toString();
this.subtitle = this.flex_columns.at(1)?.title;
this.song_count = this.subtitle?.runs?.find((run) => /^\d+(,\d+)? songs?$/i.test(run.text))?.text || "";
}, "_MusicResponsiveListItem_parseLibraryArtist"), _MusicResponsiveListItem_parseNonMusicTrack = /* @__PURE__ */ __name(function _MusicResponsiveListItem_parseNonMusicTrack2() {
this.id = __classPrivateFieldGet(this, _MusicResponsiveListItem_playlist_item_data, "f").video_id || this.endpoint?.payload?.videoId;
this.title = this.flex_columns[0].title.toString();
}, "_MusicResponsiveListItem_parseNonMusicTrack"), _MusicResponsiveListItem_parsePodcastShow = /* @__PURE__ */ __name(function _MusicResponsiveListItem_parsePodcastShow2() {
this.id = this.endpoint?.payload?.browseId;
this.title = this.flex_columns[0].title.toString();
}, "_MusicResponsiveListItem_parsePodcastShow"), _MusicResponsiveListItem_parseAlbum = /* @__PURE__ */ __name(function _MusicResponsiveListItem_parseAlbum2() {
this.id = this.endpoint?.payload?.browseId;
this.title = this.flex_columns[0].title.toString();
const author_run = this.flex_columns.at(1)?.title.runs?.find((run) => isTextRun(run) && run.endpoint && run.endpoint.payload.browseId.startsWith("UC"));
if (author_run && isTextRun(author_run)) {
this.author = {
name: author_run.text,
channel_id: author_run.endpoint?.payload?.browseId,
endpoint: author_run.endpoint
};
}
this.year = this.flex_columns.at(1)?.title.runs?.find((run) => /^[12][0-9]{3}$/.test(run.text))?.text;
}, "_MusicResponsiveListItem_parseAlbum"), _MusicResponsiveListItem_parsePlaylist = /* @__PURE__ */ __name(function _MusicResponsiveListItem_parsePlaylist2() {
this.id = this.endpoint?.payload?.browseId;
this.title = this.flex_columns[0].title.toString();
const item_count_run = this.flex_columns.at(1)?.title.runs?.find((run) => run.text.match(/\d+ (song|songs)/));
this.item_count = item_count_run ? item_count_run.text : void 0;
const author_run = this.flex_columns.at(1)?.title.runs?.find((run) => isTextRun(run) && run.endpoint && run.endpoint.payload.browseId.startsWith("UC"));
if (author_run && isTextRun(author_run)) {
this.author = {
name: author_run.text,
channel_id: author_run.endpoint?.payload?.browseId,
endpoint: author_run.endpoint
};
}
}, "_MusicResponsiveListItem_parsePlaylist");
MusicResponsiveListItem.type = "MusicResponsiveListItem";
var MusicResponsiveListItem_default = MusicResponsiveListItem;
// dist/src/parser/classes/MusicTwoRowItem.js
var MusicTwoRowItem = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.id = this.endpoint?.payload?.browseId || this.endpoint?.payload?.videoId;
this.subtitle = new Text(data2.subtitle);
this.badges = parser_exports.parse(data2.subtitleBadges);
const page_type = this.endpoint?.payload?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType;
switch (page_type) {
case "MUSIC_PAGE_TYPE_ARTIST":
this.item_type = "artist";
break;
case "MUSIC_PAGE_TYPE_PLAYLIST":
this.item_type = "playlist";
break;
case "MUSIC_PAGE_TYPE_ALBUM":
this.item_type = "album";
break;
default:
if (this.endpoint?.metadata?.api_url === "/next") {
this.item_type = "endpoint";
} else if (this.subtitle.runs?.[0]) {
if (this.subtitle.runs[0].text !== "Song") {
this.item_type = "video";
} else {
this.item_type = "song";
}
} else if (this.endpoint) {
this.item_type = "endpoint";
} else {
this.item_type = "unknown";
}
break;
}
if (this.item_type == "artist") {
this.subscribers = this.subtitle.runs?.find((run) => /^(\d*\.)?\d+[M|K]? subscribers?$/i.test(run.text))?.text || "";
} else if (this.item_type == "playlist") {
const item_count_run = this.subtitle.runs?.find((run) => run.text.match(/\d+ songs|song/));
this.item_count = item_count_run ? item_count_run.text : null;
} else if (this.item_type == "album") {
const artists = this.subtitle.runs?.filter((run) => run.endpoint?.payload?.browseId.startsWith("UC"));
if (artists) {
this.artists = artists.map((artist) => ({
name: artist.text,
channel_id: artist.endpoint?.payload?.browseId,
endpoint: artist.endpoint
}));
}
this.year = this.subtitle.runs?.slice(-1)[0].text;
if (isNaN(Number(this.year)))
delete this.year;
} else if (this.item_type == "video") {
this.views = this?.subtitle.runs?.find((run) => run?.text.match(/(.*?) views/))?.text || "N/A";
const author = this.subtitle.runs?.find((run) => run.endpoint?.payload?.browseId?.startsWith("UC"));
if (author) {
this.author = {
name: author?.text,
channel_id: author?.endpoint?.payload?.browseId,
endpoint: author?.endpoint
};
}
} else if (this.item_type == "song") {
const artists = this.subtitle.runs?.filter((run) => run.endpoint?.payload?.browseId.startsWith("UC"));
if (artists) {
this.artists = artists.map((artist) => ({
name: artist?.text,
channel_id: artist?.endpoint?.payload?.browseId,
endpoint: artist?.endpoint
}));
}
}
this.thumbnail = Thumbnail.fromResponse(data2.thumbnailRenderer.musicThumbnailRenderer.thumbnail);
this.thumbnail_overlay = parser_exports.parseItem(data2.thumbnailOverlay, MusicItemThumbnailOverlay_default);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
}
};
__name(MusicTwoRowItem, "MusicTwoRowItem");
MusicTwoRowItem.type = "MusicTwoRowItem";
var MusicTwoRowItem_default = MusicTwoRowItem;
// dist/src/parser/classes/MusicCarouselShelf.js
var MusicCarouselShelf = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header, MusicCarouselShelfBasicHeader_default);
this.contents = parser_exports.parseArray(data2.contents, [MusicTwoRowItem_default, MusicResponsiveListItem_default, MusicMultiRowListItem_default, MusicNavigationButton_default]);
if (Reflect.has(data2, "numItemsPerColumn")) {
this.num_items_per_column = parseInt(data2.numItemsPerColumn);
}
}
};
__name(MusicCarouselShelf, "MusicCarouselShelf");
MusicCarouselShelf.type = "MusicCarouselShelf";
var MusicCarouselShelf_default = MusicCarouselShelf;
// dist/src/parser/classes/MusicDescriptionShelf.js
var MusicDescriptionShelf = class extends YTNode {
constructor(data2) {
super();
this.description = new Text(data2.description);
if (Reflect.has(data2, "maxCollapsedLines")) {
this.max_collapsed_lines = data2.maxCollapsedLines;
}
if (Reflect.has(data2, "maxExpandedLines")) {
this.max_expanded_lines = data2.maxExpandedLines;
}
this.footer = new Text(data2.footer);
}
};
__name(MusicDescriptionShelf, "MusicDescriptionShelf");
MusicDescriptionShelf.type = "MusicDescriptionShelf";
var MusicDescriptionShelf_default = MusicDescriptionShelf;
// dist/src/parser/classes/MusicDetailHeader.js
var MusicDetailHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.description = new Text(data2.description);
this.subtitle = new Text(data2.subtitle);
this.second_subtitle = new Text(data2.secondSubtitle);
this.year = this.subtitle.runs?.find((run) => /^[12][0-9]{3}$/.test(run.text))?.text || "";
this.song_count = this.second_subtitle.runs?.[0]?.text || "";
this.total_duration = this.second_subtitle.runs?.[2]?.text || "";
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail.croppedSquareThumbnailRenderer.thumbnail);
this.badges = parser_exports.parseArray(data2.subtitleBadges);
const author = this.subtitle.runs?.find((run) => run?.endpoint?.payload?.browseId.startsWith("UC"));
if (author) {
this.author = {
name: author.text,
channel_id: author.endpoint?.payload?.browseId,
endpoint: author.endpoint
};
}
this.menu = parser_exports.parseItem(data2.menu);
}
};
__name(MusicDetailHeader, "MusicDetailHeader");
MusicDetailHeader.type = "MusicDetailHeader";
var MusicDetailHeader_default = MusicDetailHeader;
// dist/src/parser/classes/MusicDownloadStateBadge.js
var MusicDownloadStateBadge = class extends YTNode {
constructor(data2) {
super();
this.playlist_id = data2.playlistId;
this.supported_download_states = data2.supportedDownloadStates;
}
};
__name(MusicDownloadStateBadge, "MusicDownloadStateBadge");
MusicDownloadStateBadge.type = "MusicDownloadStateBadge";
var MusicDownloadStateBadge_default = MusicDownloadStateBadge;
// dist/src/parser/classes/MusicEditablePlaylistDetailHeader.js
var MusicEditablePlaylistDetailHeader = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header);
this.edit_header = parser_exports.parseItem(data2.editHeader);
this.playlist_id = data2.playlistId;
}
};
__name(MusicEditablePlaylistDetailHeader, "MusicEditablePlaylistDetailHeader");
MusicEditablePlaylistDetailHeader.type = "MusicEditablePlaylistDetailHeader";
var MusicEditablePlaylistDetailHeader_default = MusicEditablePlaylistDetailHeader;
// dist/src/parser/classes/MusicElementHeader.js
var MusicElementHeader = class extends YTNode {
constructor(data2) {
super();
this.element = Reflect.has(data2, "elementRenderer") ? parser_exports.parseItem(data2, Element_default) : null;
}
};
__name(MusicElementHeader, "MusicElementHeader");
MusicElementHeader.type = "MusicElementHeader";
var MusicElementHeader_default = MusicElementHeader;
// dist/src/parser/classes/MusicHeader.js
var MusicHeader = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "header")) {
this.header = parser_exports.parseItem(data2.header);
}
if (Reflect.has(data2, "title")) {
this.title = new Text(data2.title);
}
}
};
__name(MusicHeader, "MusicHeader");
MusicHeader.type = "MusicHeader";
var MusicHeader_default = MusicHeader;
// dist/src/parser/classes/MusicImmersiveHeader.js
var MusicImmersiveHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.description = new Text(data2.description);
this.thumbnail = parser_exports.parseItem(data2.thumbnail, MusicThumbnail_default);
}
};
__name(MusicImmersiveHeader, "MusicImmersiveHeader");
MusicImmersiveHeader.type = "MusicImmersiveHeader";
var MusicImmersiveHeader_default = MusicImmersiveHeader;
// dist/src/parser/classes/MusicLargeCardItemCarousel.js
var ActionButton = class {
constructor(data2) {
this.icon_name = data2.iconName;
this.endpoint = new NavigationEndpoint_default(data2.onTap);
this.a11y_text = data2.a11yText;
this.style = data2.style;
}
};
__name(ActionButton, "ActionButton");
ActionButton.type = "ActionButton";
var Panel2 = class {
constructor(data2) {
this.image = Thumbnail.fromResponse(data2.image.image);
this.content_mode = data2.image.contentMode;
this.crop_options = data2.image.cropOptions;
this.image_aspect_ratio = data2.imageAspectRatio;
this.caption = data2.caption;
this.action_buttons = data2.actionButtons.map((el) => new ActionButton(el));
}
};
__name(Panel2, "Panel");
Panel2.type = "Panel";
var MusicLargeCardItemCarousel = class extends YTNode {
constructor(data2) {
super();
this.header = data2.shelf.header;
this.panels = data2.shelf.panels.map((el) => new Panel2(el));
}
};
__name(MusicLargeCardItemCarousel, "MusicLargeCardItemCarousel");
MusicLargeCardItemCarousel.type = "MusicLargeCardItemCarousel";
var MusicLargeCardItemCarousel_default = MusicLargeCardItemCarousel;
// dist/src/parser/classes/MusicPlaylistEditHeader.js
var MusicPlaylistEditHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.edit_title = new Text(data2.editTitle);
this.edit_description = new Text(data2.editDescription);
this.privacy = data2.privacy;
this.playlist_id = data2.playlistId;
this.endpoint = new NavigationEndpoint_default(data2.collaborationSettingsCommand);
this.privacy_dropdown = parser_exports.parseItem(data2.privacyDropdown, Dropdown_default);
}
};
__name(MusicPlaylistEditHeader, "MusicPlaylistEditHeader");
MusicPlaylistEditHeader.type = "MusicPlaylistEditHeader";
var MusicPlaylistEditHeader_default = MusicPlaylistEditHeader;
// dist/src/parser/classes/MusicPlaylistShelf.js
var MusicPlaylistShelf = class extends YTNode {
constructor(data2) {
super();
this.playlist_id = data2.playlistId;
this.contents = parser_exports.parseArray(data2.contents, [MusicResponsiveListItem_default, ContinuationItem_default]);
this.collapsed_item_count = data2.collapsedItemCount;
this.continuation = data2.continuations?.[0]?.nextContinuationData?.continuation || null;
}
};
__name(MusicPlaylistShelf, "MusicPlaylistShelf");
MusicPlaylistShelf.type = "MusicPlaylistShelf";
var MusicPlaylistShelf_default = MusicPlaylistShelf;
// dist/src/parser/classes/PlaylistPanelVideo.js
var PlaylistPanelVideo = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.selected = data2.selected;
this.video_id = data2.videoId;
this.duration = {
text: new Text(data2.lengthText).toString(),
seconds: timeToSeconds(new Text(data2.lengthText).toString())
};
const album = new Text(data2.longBylineText).runs?.find((run) => run.endpoint?.payload?.browseId?.startsWith("MPR"));
const artists = new Text(data2.longBylineText).runs?.filter((run) => run.endpoint?.payload?.browseId?.startsWith("UC"));
this.author = new Text(data2.shortBylineText).toString();
if (album) {
this.album = {
id: album.endpoint?.payload?.browseId,
name: album.text,
year: new Text(data2.longBylineText).runs?.slice(-1)[0].text,
endpoint: album.endpoint
};
}
if (artists) {
this.artists = artists.map((artist) => ({
name: artist.text,
channel_id: artist.endpoint?.payload?.browseId,
endpoint: artist.endpoint
}));
}
this.badges = parser_exports.parseArray(data2.badges);
this.menu = parser_exports.parseItem(data2.menu);
this.set_video_id = data2.playlistSetVideoId;
}
};
__name(PlaylistPanelVideo, "PlaylistPanelVideo");
PlaylistPanelVideo.type = "PlaylistPanelVideo";
var PlaylistPanelVideo_default = PlaylistPanelVideo;
// dist/src/parser/classes/PlaylistPanelVideoWrapper.js
var PlaylistPanelVideoWrapper = class extends YTNode {
constructor(data2) {
super();
this.primary = parser_exports.parseItem(data2.primaryRenderer, PlaylistPanelVideo_default);
if (Reflect.has(data2, "counterpart")) {
this.counterpart = observe(data2.counterpart.map((item) => parser_exports.parseItem(item.counterpartRenderer, PlaylistPanelVideo_default)) || []);
}
}
};
__name(PlaylistPanelVideoWrapper, "PlaylistPanelVideoWrapper");
PlaylistPanelVideoWrapper.type = "PlaylistPanelVideoWrapper";
var PlaylistPanelVideoWrapper_default = PlaylistPanelVideoWrapper;
// dist/src/parser/classes/PlaylistPanel.js
var PlaylistPanel = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title;
this.title_text = new Text(data2.titleText);
this.contents = parser_exports.parseArray(data2.contents, [PlaylistPanelVideoWrapper_default, PlaylistPanelVideo_default, AutomixPreviewVideo_default]);
this.playlist_id = data2.playlistId;
this.is_infinite = data2.isInfinite;
this.continuation = data2.continuations?.[0]?.nextRadioContinuationData?.continuation || data2.continuations?.[0]?.nextContinuationData?.continuation;
this.is_editable = data2.isEditable;
this.preview_description = data2.previewDescription;
this.num_items_to_show = data2.numItemsToShow;
}
};
__name(PlaylistPanel, "PlaylistPanel");
PlaylistPanel.type = "PlaylistPanel";
var PlaylistPanel_default = PlaylistPanel;
// dist/src/parser/classes/MusicQueue.js
var MusicQueue = class extends YTNode {
constructor(data2) {
super();
this.content = parser_exports.parseItem(data2.content, PlaylistPanel_default);
}
};
__name(MusicQueue, "MusicQueue");
MusicQueue.type = "MusicQueue";
var MusicQueue_default = MusicQueue;
// dist/src/parser/classes/MusicResponsiveHeader.js
var MusicResponsiveHeader = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = parser_exports.parseItem(data2.thumbnail, MusicThumbnail_default);
this.buttons = parser_exports.parseArray(data2.buttons, [DownloadButton_default, ToggleButton_default, MusicPlayButton_default, Button_default, Menu_default]);
this.title = new Text(data2.title);
this.subtitle = new Text(data2.subtitle);
this.strapline_text_one = new Text(data2.straplineTextOne);
this.strapline_thumbnail = parser_exports.parseItem(data2.straplineThumbnail, MusicThumbnail_default);
this.second_subtitle = new Text(data2.secondSubtitle);
if (Reflect.has(data2, "subtitleBadge")) {
this.subtitle_badge = parser_exports.parseArray(data2.subtitleBadge, MusicInlineBadge_default);
}
if (Reflect.has(data2, "description")) {
this.description = parser_exports.parseItem(data2.description, MusicDescriptionShelf_default);
}
}
};
__name(MusicResponsiveHeader, "MusicResponsiveHeader");
MusicResponsiveHeader.type = "MusicResponsiveHeader";
var MusicResponsiveHeader_default = MusicResponsiveHeader;
// dist/src/parser/classes/MusicShelf.js
var MusicShelf = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.contents = parser_exports.parseArray(data2.contents, MusicResponsiveListItem_default);
if (Reflect.has(data2, "bottomEndpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.bottomEndpoint);
}
if (Reflect.has(data2, "continuations")) {
this.continuation = data2.continuations?.[0].nextContinuationData?.continuation || data2.continuations?.[0].reloadContinuationData?.continuation;
}
if (Reflect.has(data2, "bottomText")) {
this.bottom_text = new Text(data2.bottomText);
}
if (Reflect.has(data2, "bottomButton")) {
this.bottom_button = parser_exports.parseItem(data2.bottomButton, Button_default);
}
if (Reflect.has(data2, "subheaders")) {
this.subheaders = parser_exports.parseArray(data2.subheaders);
}
}
};
__name(MusicShelf, "MusicShelf");
MusicShelf.type = "MusicShelf";
var MusicShelf_default = MusicShelf;
// dist/src/parser/classes/MusicSideAlignedItem.js
var MusicSideAlignedItem = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "startItems")) {
this.start_items = parser_exports.parseArray(data2.startItems);
}
if (Reflect.has(data2, "endItems")) {
this.end_items = parser_exports.parseArray(data2.endItems);
}
}
};
__name(MusicSideAlignedItem, "MusicSideAlignedItem");
MusicSideAlignedItem.type = "MusicSideAlignedItem";
var MusicSideAlignedItem_default = MusicSideAlignedItem;
// dist/src/parser/classes/MusicSortFilterButton.js
var MusicSortFilterButton = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title).toString();
if (Reflect.has(data2, "icon")) {
this.icon_type = data2.icon.iconType;
}
this.menu = parser_exports.parseItem(data2.menu, MusicMultiSelectMenu_default);
}
};
__name(MusicSortFilterButton, "MusicSortFilterButton");
MusicSortFilterButton.type = "MusicSortFilterButton";
var MusicSortFilterButton_default = MusicSortFilterButton;
// dist/src/parser/classes/MusicTastebuilderShelfThumbnail.js
var MusicTastebuilderShelfThumbnail = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
}
};
__name(MusicTastebuilderShelfThumbnail, "MusicTastebuilderShelfThumbnail");
MusicTastebuilderShelfThumbnail.type = "MusicTastebuilderShelfThumbnail";
var MusicTastebuilderShelfThumbnail_default = MusicTastebuilderShelfThumbnail;
// dist/src/parser/classes/MusicTastebuilderShelf.js
var MusicTasteBuilderShelf = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = parser_exports.parseItem(data2.thumbnail, MusicTastebuilderShelfThumbnail_default);
this.primary_text = new Text(data2.primaryText);
this.secondary_text = new Text(data2.secondaryText);
this.action_button = parser_exports.parseItem(data2.actionButton, Button_default);
this.is_visible = data2.isVisible;
}
};
__name(MusicTasteBuilderShelf, "MusicTasteBuilderShelf");
MusicTasteBuilderShelf.type = "MusicTasteBuilderShelf";
var MusicTastebuilderShelf_default = MusicTasteBuilderShelf;
// dist/src/parser/classes/MusicVisualHeader.js
var MusicVisualHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.thumbnail = data2.thumbnail ? Thumbnail.fromResponse(data2.thumbnail.musicThumbnailRenderer?.thumbnail) : [];
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
this.foreground_thumbnail = data2.foregroundThumbnail ? Thumbnail.fromResponse(data2.foregroundThumbnail.musicThumbnailRenderer?.thumbnail) : [];
}
};
__name(MusicVisualHeader, "MusicVisualHeader");
MusicVisualHeader.type = "MusicVisualHeader";
var MusicVisualHeader_default = MusicVisualHeader;
// dist/src/parser/classes/mweb/MobileTopbar.js
var MobileTopbar = class extends YTNode {
constructor(data2) {
super();
this.placeholder_text = new Text(data2.placeholderText);
this.buttons = parser_exports.parseArray(data2.buttons);
if (Reflect.has(data2, "logo") && Reflect.has(data2.logo, "iconType"))
this.logo_type = data2.logo.iconType;
}
};
__name(MobileTopbar, "MobileTopbar");
MobileTopbar.type = "MobileTopbar";
var MobileTopbar_default = MobileTopbar;
// dist/src/parser/classes/mweb/MultiPageMenuSection.js
var MultiPageMenuSection = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
}
};
__name(MultiPageMenuSection, "MultiPageMenuSection");
MultiPageMenuSection.type = "MultiPageMenuSection";
var MultiPageMenuSection_default = MultiPageMenuSection;
// dist/src/parser/classes/mweb/PivotBar.js
var PivotBar = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
}
};
__name(PivotBar, "PivotBar");
PivotBar.type = "PivotBar";
var PivotBar_default = PivotBar;
// dist/src/parser/classes/mweb/PivotBarItem.js
var PivotBarItem = class extends YTNode {
constructor(data2) {
super();
this.pivot_identifier = data2.pivotIdentifier;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.title = new Text(data2.title);
if (Reflect.has(data2, "accessibility") && Reflect.has(data2.accessibility, "accessibilityData"))
this.accessibility_label = data2.accessibility.accessibilityData.label;
if (Reflect.has(data2, "icon") && Reflect.has(data2.icon, "iconType"))
this.icon_type = data2.icon.iconType;
}
};
__name(PivotBarItem, "PivotBarItem");
PivotBarItem.type = "PivotBarItem";
var PivotBarItem_default = PivotBarItem;
// dist/src/parser/classes/mweb/TopbarMenuButton.js
var TopbarMenuButton = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "icon") && Reflect.has(data2.icon, "iconType"))
this.icon_type = data2.icon.iconType;
this.menu_renderer = parser_exports.parseItem(data2.menuRenderer);
this.target_id = data2.targetId;
}
};
__name(TopbarMenuButton, "TopbarMenuButton");
TopbarMenuButton.type = "TopbarMenuButton";
var TopbarMenuButton_default = TopbarMenuButton;
// dist/src/parser/classes/Notification.js
var Notification = class extends YTNode {
constructor(data2) {
super();
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.video_thumbnails = Thumbnail.fromResponse(data2.videoThumbnail);
this.short_message = new Text(data2.shortMessage);
this.sent_time = new Text(data2.sentTimeText);
this.notification_id = data2.notificationId;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.record_click_endpoint = new NavigationEndpoint_default(data2.recordClickEndpoint);
this.menu = parser_exports.parseItem(data2.contextualMenu);
this.read = data2.read;
}
};
__name(Notification, "Notification");
Notification.type = "Notification";
var Notification_default = Notification;
// dist/src/parser/classes/NotificationAction.js
var NotificationAction = class extends YTNode {
constructor(data2) {
super();
this.response_text = new Text(data2.responseText);
}
};
__name(NotificationAction, "NotificationAction");
NotificationAction.type = "NotificationAction";
var NotificationAction_default = NotificationAction;
// dist/src/parser/classes/PageHeaderView.js
var PageHeaderView = class extends YTNode {
constructor(data2) {
super();
this.title = parser_exports.parseItem(data2.title, DynamicTextView_default);
this.image = parser_exports.parseItem(data2.image, [ContentPreviewImageView_default, DecoratedAvatarView_default]);
this.animated_image = parser_exports.parseItem(data2.animatedImage, ContentPreviewImageView_default);
this.hero_image = parser_exports.parseItem(data2.heroImage, ContentPreviewImageView_default);
this.metadata = parser_exports.parseItem(data2.metadata, ContentMetadataView_default);
this.actions = parser_exports.parseItem(data2.actions, FlexibleActionsView_default);
this.description = parser_exports.parseItem(data2.description, DescriptionPreviewView_default);
this.attributation = parser_exports.parseItem(data2.attributation, AttributionView_default);
this.banner = parser_exports.parseItem(data2.banner, ImageBannerView_default);
}
};
__name(PageHeaderView, "PageHeaderView");
PageHeaderView.type = "PageHeaderView";
var PageHeaderView_default = PageHeaderView;
// dist/src/parser/classes/PageHeader.js
var PageHeader = class extends YTNode {
constructor(data2) {
super();
this.page_title = data2.pageTitle;
this.content = parser_exports.parseItem(data2.content, PageHeaderView_default);
}
};
__name(PageHeader, "PageHeader");
PageHeader.type = "PageHeader";
var PageHeader_default = PageHeader;
// dist/src/parser/classes/PageIntroduction.js
var PageIntroduction = class extends YTNode {
constructor(data2) {
super();
this.header_text = new Text(data2.headerText).toString();
this.body_text = new Text(data2.bodyText).toString();
this.page_title = new Text(data2.pageTitle).toString();
this.header_icon_type = data2.headerIcon.iconType;
}
};
__name(PageIntroduction, "PageIntroduction");
PageIntroduction.type = "PageIntroduction";
var PageIntroduction_default = PageIntroduction;
// dist/src/parser/classes/PivotButton.js
var PivotButton = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.endpoint = new NavigationEndpoint_default(data2.onClickCommand);
this.content_description = new Text(data2.contentDescription);
this.target_id = data2.targetId;
this.sound_attribution_title = new Text(data2.soundAttributionTitle);
this.waveform_animation_style = data2.waveformAnimationStyle;
this.background_animation_style = data2.backgroundAnimationStyle;
}
};
__name(PivotButton, "PivotButton");
PivotButton.type = "PivotButton";
var PivotButton_default = PivotButton;
// dist/src/parser/classes/PlayerAnnotationsExpanded.js
var PlayerAnnotationsExpanded = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "featuredChannel")) {
this.featured_channel = {
start_time_ms: data2.featuredChannel.startTimeMs,
end_time_ms: data2.featuredChannel.endTimeMs,
watermark: Thumbnail.fromResponse(data2.featuredChannel.watermark),
channel_name: data2.featuredChannel.channelName,
endpoint: new NavigationEndpoint_default(data2.featuredChannel.navigationEndpoint),
subscribe_button: parser_exports.parseItem(data2.featuredChannel.subscribeButton)
};
}
this.allow_swipe_dismiss = data2.allowSwipeDismiss;
this.annotation_id = data2.annotationId;
}
};
__name(PlayerAnnotationsExpanded, "PlayerAnnotationsExpanded");
PlayerAnnotationsExpanded.type = "PlayerAnnotationsExpanded";
var PlayerAnnotationsExpanded_default = PlayerAnnotationsExpanded;
// dist/src/parser/classes/PlayerCaptionsTracklist.js
var PlayerCaptionsTracklist = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "captionTracks")) {
this.caption_tracks = data2.captionTracks.map((ct) => ({
base_url: ct.baseUrl,
name: new Text(ct.name),
vss_id: ct.vssId,
language_code: ct.languageCode,
kind: ct.kind,
is_translatable: ct.isTranslatable
}));
}
if (Reflect.has(data2, "audioTracks")) {
this.audio_tracks = data2.audioTracks.map((at2) => ({
audio_track_id: at2.audioTrackId,
captions_initial_state: at2.captionsInitialState,
default_caption_track_index: at2.defaultCaptionTrackIndex,
has_default_track: at2.hasDefaultTrack,
visibility: at2.visibility,
caption_track_indices: at2.captionTrackIndices
}));
}
if (Reflect.has(data2, "defaultAudioTrackIndex")) {
this.default_audio_track_index = data2.defaultAudioTrackIndex;
}
if (Reflect.has(data2, "translationLanguages")) {
this.translation_languages = data2.translationLanguages.map((tl) => ({
language_code: tl.languageCode,
language_name: new Text(tl.languageName)
}));
}
}
};
__name(PlayerCaptionsTracklist, "PlayerCaptionsTracklist");
PlayerCaptionsTracklist.type = "PlayerCaptionsTracklist";
var PlayerCaptionsTracklist_default = PlayerCaptionsTracklist;
// dist/src/parser/classes/PlayerOverflow.js
var PlayerOverflow = class extends YTNode {
constructor(data2) {
super();
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
this.enable_listen_first = data2.enableListenFirst;
}
};
__name(PlayerOverflow, "PlayerOverflow");
PlayerOverflow.type = "PlayerOverflow";
var PlayerOverflow_default = PlayerOverflow;
// dist/src/parser/classes/PlayerControlsOverlay.js
var PlayerControlsOverlay = class extends YTNode {
constructor(data2) {
super();
this.overflow = parser_exports.parseItem(data2.overflow, PlayerOverflow_default);
}
};
__name(PlayerControlsOverlay, "PlayerControlsOverlay");
PlayerControlsOverlay.type = "PlayerControlsOverlay";
var PlayerControlsOverlay_default = PlayerControlsOverlay;
// dist/src/parser/classes/PlayerErrorMessage.js
var PlayerErrorMessage = class extends YTNode {
constructor(data2) {
super();
this.subreason = new Text(data2.subreason);
this.reason = new Text(data2.reason);
this.proceed_button = parser_exports.parseItem(data2.proceedButton, Button_default);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
if (Reflect.has(data2, "icon")) {
this.icon_type = data2.icon.iconType;
}
}
};
__name(PlayerErrorMessage, "PlayerErrorMessage");
PlayerErrorMessage.type = "PlayerErrorMessage";
var PlayerErrorMessage_default = PlayerErrorMessage;
// dist/src/parser/classes/PlayerLegacyDesktopYpcOffer.js
var PlayerLegacyDesktopYpcOffer = class extends YTNode {
constructor(data2) {
super();
this.title = data2.itemTitle;
this.thumbnail = data2.itemThumbnail;
this.offer_description = data2.offerDescription;
this.offer_id = data2.offerId;
}
};
__name(PlayerLegacyDesktopYpcOffer, "PlayerLegacyDesktopYpcOffer");
PlayerLegacyDesktopYpcOffer.type = "PlayerLegacyDesktopYpcOffer";
var PlayerLegacyDesktopYpcOffer_default = PlayerLegacyDesktopYpcOffer;
// dist/src/parser/classes/YpcTrailer.js
var YpcTrailer = class extends YTNode {
constructor(data2) {
super();
this.video_message = data2.fullVideoMessage;
this.player_response = data2.unserializedPlayerResponse;
}
};
__name(YpcTrailer, "YpcTrailer");
YpcTrailer.type = "YpcTrailer";
var YpcTrailer_default = YpcTrailer;
// dist/src/parser/classes/PlayerLegacyDesktopYpcTrailer.js
var PlayerLegacyDesktopYpcTrailer = class extends YTNode {
constructor(data2) {
super();
this.video_id = data2.trailerVideoId;
this.title = data2.itemTitle;
this.thumbnail = data2.itemThumbnail;
this.offer_headline = data2.offerHeadline;
this.offer_description = data2.offerDescription;
this.offer_id = data2.offerId;
this.offer_button_text = data2.offerButtonText;
this.video_message = data2.fullVideoMessage;
this.trailer = parser_exports.parseItem(data2.ypcTrailer, YpcTrailer_default);
}
};
__name(PlayerLegacyDesktopYpcTrailer, "PlayerLegacyDesktopYpcTrailer");
PlayerLegacyDesktopYpcTrailer.type = "PlayerLegacyDesktopYpcTrailer";
var PlayerLegacyDesktopYpcTrailer_default = PlayerLegacyDesktopYpcTrailer;
// dist/src/parser/classes/PlayerLiveStoryboardSpec.js
var PlayerLiveStoryboardSpec = class extends YTNode {
constructor(data2) {
super();
const [template_url, thumbnail_width, thumbnail_height, columns, rows] = data2.spec.split("#");
this.board = {
type: "live",
template_url,
thumbnail_width: parseInt(thumbnail_width, 10),
thumbnail_height: parseInt(thumbnail_height, 10),
columns: parseInt(columns, 10),
rows: parseInt(rows, 10)
};
}
};
__name(PlayerLiveStoryboardSpec, "PlayerLiveStoryboardSpec");
PlayerLiveStoryboardSpec.type = "PlayerLiveStoryboardSpec";
var PlayerLiveStoryboardSpec_default = PlayerLiveStoryboardSpec;
// dist/src/parser/classes/PlayerMicroformat.js
var PlayerMicroformat = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.description = new Text(data2.description);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
if (Reflect.has(data2, "embed")) {
this.embed = {
iframe_url: data2.embed.iframeUrl,
flash_url: data2.embed.flashUrl,
flash_secure_url: data2.embed.flashSecureUrl,
width: data2.embed.width,
height: data2.embed.height
};
}
this.length_seconds = parseInt(data2.lengthSeconds);
this.channel = {
id: data2.externalChannelId,
name: data2.ownerChannelName,
url: data2.ownerProfileUrl
};
this.is_family_safe = !!data2.isFamilySafe;
this.is_unlisted = !!data2.isUnlisted;
this.has_ypc_metadata = !!data2.hasYpcMetadata;
this.view_count = parseInt(data2.viewCount);
this.category = data2.category;
this.publish_date = data2.publishDate;
this.upload_date = data2.uploadDate;
this.available_countries = data2.availableCountries;
this.start_timestamp = data2.liveBroadcastDetails?.startTimestamp ? new Date(data2.liveBroadcastDetails.startTimestamp) : null;
this.end_timestamp = data2.liveBroadcastDetails?.endTimestamp ? new Date(data2.liveBroadcastDetails.endTimestamp) : null;
}
};
__name(PlayerMicroformat, "PlayerMicroformat");
PlayerMicroformat.type = "PlayerMicroformat";
var PlayerMicroformat_default = PlayerMicroformat;
// dist/src/parser/classes/PlayerOverlayAutoplay.js
var PlayerOverlayAutoplay = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.video_id = data2.videoId;
this.video_title = new Text(data2.videoTitle);
this.short_view_count = new Text(data2.shortViewCountText);
this.prefer_immediate_redirect = data2.preferImmediateRedirect;
this.count_down_secs_for_fullscreen = data2.countDownSecsForFullscreen;
this.published = new Text(data2.publishedTimeText);
this.background = Thumbnail.fromResponse(data2.background);
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
this.author = new Author(data2.byline);
this.cancel_button = parser_exports.parseItem(data2.cancelButton, Button_default);
this.next_button = parser_exports.parseItem(data2.nextButton, Button_default);
this.close_button = parser_exports.parseItem(data2.closeButton, Button_default);
}
};
__name(PlayerOverlayAutoplay, "PlayerOverlayAutoplay");
PlayerOverlayAutoplay.type = "PlayerOverlayAutoplay";
var PlayerOverlayAutoplay_default = PlayerOverlayAutoplay;
// dist/src/parser/classes/PlayerOverlayVideoDetails.js
var PlayerOverlayVideoDetails = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.subtitle = new Text(data2.subtitle);
}
};
__name(PlayerOverlayVideoDetails, "PlayerOverlayVideoDetails");
PlayerOverlayVideoDetails.type = "PlayerOverlayVideoDetails";
var PlayerOverlayVideoDetails_default = PlayerOverlayVideoDetails;
// dist/src/parser/classes/WatchNextEndScreen.js
var WatchNextEndScreen = class extends YTNode {
constructor(data2) {
super();
this.results = parser_exports.parseArray(data2.results, [EndScreenVideo_default, EndScreenPlaylist_default]);
this.title = new Text(data2.title).toString();
}
};
__name(WatchNextEndScreen, "WatchNextEndScreen");
WatchNextEndScreen.type = "WatchNextEndScreen";
var WatchNextEndScreen_default = WatchNextEndScreen;
// dist/src/parser/classes/PlayerOverlay.js
var PlayerOverlay = class extends YTNode {
constructor(data2) {
super();
this.end_screen = parser_exports.parseItem(data2.endScreen, WatchNextEndScreen_default);
this.autoplay = parser_exports.parseItem(data2.autoplay, PlayerOverlayAutoplay_default);
this.share_button = parser_exports.parseItem(data2.shareButton, Button_default);
this.add_to_menu = parser_exports.parseItem(data2.addToMenu, Menu_default);
this.fullscreen_engagement = parser_exports.parseItem(data2.fullscreenEngagement);
this.actions = parser_exports.parseArray(data2.actions);
this.browser_media_session = parser_exports.parseItem(data2.browserMediaSession);
this.decorated_player_bar = parser_exports.parseItem(data2.decoratedPlayerBarRenderer, DecoratedPlayerBar_default);
this.video_details = parser_exports.parseItem(data2.videoDetails, PlayerOverlayVideoDetails_default);
}
};
__name(PlayerOverlay, "PlayerOverlay");
PlayerOverlay.type = "PlayerOverlay";
var PlayerOverlay_default = PlayerOverlay;
// dist/src/parser/classes/PlaylistHeader.js
var PlaylistHeader = class extends YTNode {
constructor(data2) {
super();
this.id = data2.playlistId;
this.title = new Text(data2.title);
this.subtitle = data2.subtitle ? new Text(data2.subtitle) : null;
this.stats = data2.stats.map((stat) => new Text(stat));
this.brief_stats = data2.briefStats.map((stat) => new Text(stat));
this.author = data2.ownerText || data2.ownerEndpoint ? new Author({ ...data2.ownerText, navigationEndpoint: data2.ownerEndpoint }, data2.ownerBadges, null) : null;
this.description = new Text(data2.descriptionText);
this.num_videos = new Text(data2.numVideosText);
this.view_count = new Text(data2.viewCountText);
this.can_share = data2.shareData.canShare;
this.can_delete = data2.editableDetails.canDelete;
this.is_editable = data2.isEditable;
this.privacy = data2.privacy;
this.save_button = parser_exports.parseItem(data2.saveButton);
this.shuffle_play_button = parser_exports.parseItem(data2.shufflePlayButton);
this.menu = parser_exports.parseItem(data2.moreActionsMenu);
this.banner = parser_exports.parseItem(data2.playlistHeaderBanner);
}
};
__name(PlaylistHeader, "PlaylistHeader");
PlaylistHeader.type = "PlaylistHeader";
var PlaylistHeader_default = PlaylistHeader;
// dist/src/parser/classes/PlaylistInfoCardContent.js
var PlaylistInfoCardContent = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.playlistTitle);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.video_count = new Text(data2.playlistVideoCount);
this.channel_name = new Text(data2.channelName);
this.endpoint = new NavigationEndpoint_default(data2.action);
}
};
__name(PlaylistInfoCardContent, "PlaylistInfoCardContent");
PlaylistInfoCardContent.type = "PlaylistInfoCardContent";
var PlaylistInfoCardContent_default = PlaylistInfoCardContent;
// dist/src/parser/classes/PlaylistMetadata.js
var PlaylistMetadata = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title;
this.description = data2.description || null;
}
};
__name(PlaylistMetadata, "PlaylistMetadata");
PlaylistMetadata.type = "PlaylistMetadata";
var PlaylistMetadata_default = PlaylistMetadata;
// dist/src/parser/classes/PlaylistSidebar.js
var PlaylistSidebar = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
}
get contents() {
return this.items;
}
};
__name(PlaylistSidebar, "PlaylistSidebar");
PlaylistSidebar.type = "PlaylistSidebar";
var PlaylistSidebar_default = PlaylistSidebar;
// dist/src/parser/classes/PlaylistSidebarPrimaryInfo.js
var PlaylistSidebarPrimaryInfo = class extends YTNode {
constructor(data2) {
super();
this.stats = data2.stats.map((stat) => new Text(stat));
this.thumbnail_renderer = parser_exports.parseItem(data2.thumbnailRenderer);
this.title = new Text(data2.title);
this.menu = parser_exports.parseItem(data2.menu);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.description = new Text(data2.description);
}
};
__name(PlaylistSidebarPrimaryInfo, "PlaylistSidebarPrimaryInfo");
PlaylistSidebarPrimaryInfo.type = "PlaylistSidebarPrimaryInfo";
var PlaylistSidebarPrimaryInfo_default = PlaylistSidebarPrimaryInfo;
// dist/src/parser/classes/PlaylistSidebarSecondaryInfo.js
var PlaylistSidebarSecondaryInfo = class extends YTNode {
constructor(data2) {
super();
this.owner = parser_exports.parseItem(data2.videoOwner);
this.button = parser_exports.parseItem(data2.button);
}
};
__name(PlaylistSidebarSecondaryInfo, "PlaylistSidebarSecondaryInfo");
PlaylistSidebarSecondaryInfo.type = "PlaylistSidebarSecondaryInfo";
var PlaylistSidebarSecondaryInfo_default = PlaylistSidebarSecondaryInfo;
// dist/src/parser/classes/PlaylistThumbnailOverlay.js
var PlaylistThumbnailOverlay = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "icon"))
this.icon_type = data2.icon.iconType;
this.text = new Text(data2.text);
}
};
__name(PlaylistThumbnailOverlay, "PlaylistThumbnailOverlay");
PlaylistThumbnailOverlay.type = "PlaylistThumbnailOverlay";
var PlaylistThumbnailOverlay_default = PlaylistThumbnailOverlay;
// dist/src/parser/classes/PlaylistVideo.js
var PlaylistVideo = class extends YTNode {
constructor(data2) {
super();
this.id = data2.videoId;
this.index = new Text(data2.index);
this.title = new Text(data2.title);
this.author = new Author(data2.shortBylineText);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.thumbnail_overlays = parser_exports.parseArray(data2.thumbnailOverlays);
this.set_video_id = data2?.setVideoId;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.is_playable = data2.isPlayable;
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
this.video_info = new Text(data2.videoInfo);
this.accessibility_label = data2.title.accessibility.accessibilityData.label;
if (Reflect.has(data2, "style")) {
this.style = data2.style;
}
const upcoming = data2.upcomingEventData && Number(`${data2.upcomingEventData.startTime}000`);
if (upcoming) {
this.upcoming = new Date(upcoming);
}
this.duration = {
text: new Text(data2.lengthText).toString(),
seconds: parseInt(data2.lengthSeconds)
};
}
get is_live() {
return this.thumbnail_overlays.firstOfType(ThumbnailOverlayTimeStatus_default)?.style === "LIVE";
}
get is_upcoming() {
return this.thumbnail_overlays.firstOfType(ThumbnailOverlayTimeStatus_default)?.style === "UPCOMING";
}
};
__name(PlaylistVideo, "PlaylistVideo");
PlaylistVideo.type = "PlaylistVideo";
var PlaylistVideo_default = PlaylistVideo;
// dist/src/parser/classes/PlaylistVideoList.js
var PlaylistVideoList = class extends YTNode {
constructor(data2) {
super();
this.id = data2.playlistId;
this.is_editable = data2.isEditable;
this.can_reorder = data2.canReorder;
this.videos = parser_exports.parseArray(data2.contents);
}
};
__name(PlaylistVideoList, "PlaylistVideoList");
PlaylistVideoList.type = "PlaylistVideoList";
var PlaylistVideoList_default = PlaylistVideoList;
// dist/src/parser/classes/Poll.js
var Poll = class extends YTNode {
constructor(data2) {
super();
this.choices = data2.choices.map((choice) => ({
text: new Text(choice.text),
select_endpoint: choice.selectServiceEndpoint ? new NavigationEndpoint_default(choice.selectServiceEndpoint) : null,
deselect_endpoint: choice.deselectServiceEndpoint ? new NavigationEndpoint_default(choice.deselectServiceEndpoint) : null,
vote_ratio_if_selected: choice?.voteRatioIfSelected || null,
vote_percentage_if_selected: new Text(choice.votePercentageIfSelected),
vote_ratio_if_not_selected: choice?.voteRatioIfSelected || null,
vote_percentage_if_not_selected: new Text(choice.votePercentageIfSelected),
image: choice.image ? Thumbnail.fromResponse(choice.image) : null
}));
if (Reflect.has(data2, "type"))
this.poll_type = data2.type;
if (Reflect.has(data2, "totalVotes"))
this.total_votes = new Text(data2.totalVotes);
if (Reflect.has(data2, "liveChatPollId"))
this.live_chat_poll_id = data2.liveChatPollId;
}
};
__name(Poll, "Poll");
Poll.type = "Poll";
var Poll_default = Poll;
// dist/src/parser/classes/Post.js
var Post = class extends BackstagePost_default {
constructor(data2) {
super(data2);
}
};
__name(Post, "Post");
Post.type = "Post";
var Post_default = Post;
// dist/src/parser/classes/PostMultiImage.js
var PostMultiImage = class extends YTNode {
constructor(data2) {
super();
this.images = parser_exports.parseArray(data2.images, BackstageImage_default);
}
};
__name(PostMultiImage, "PostMultiImage");
PostMultiImage.type = "PostMultiImage";
var PostMultiImage_default = PostMultiImage;
// dist/src/parser/classes/PremiereTrailerBadge.js
var PremiereTrailerBadge = class extends YTNode {
constructor(data2) {
super();
this.label = new Text(data2.label);
}
};
__name(PremiereTrailerBadge, "PremiereTrailerBadge");
PremiereTrailerBadge.type = "PremiereTrailerBadge";
var PremiereTrailerBadge_default = PremiereTrailerBadge;
// dist/src/parser/classes/ProductListHeader.js
var ProductListHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.suppress_padding_disclaimer = !!data2.suppressPaddingDisclaimer;
}
};
__name(ProductListHeader, "ProductListHeader");
ProductListHeader.type = "ProductListHeader";
var ProductListHeader_default = ProductListHeader;
// dist/src/parser/classes/ProductListItem.js
var ProductListItem = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.accessibility_title = data2.accessibilityTitle;
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.price = data2.price;
this.endpoint = new NavigationEndpoint_default(data2.onClickCommand);
this.merchant_name = data2.merchantName;
this.stay_in_app = !!data2.stayInApp;
this.view_button = parser_exports.parseItem(data2.viewButton, Button_default);
}
};
__name(ProductListItem, "ProductListItem");
ProductListItem.type = "ProductListItem";
var ProductListItem_default = ProductListItem;
// dist/src/parser/classes/ProfileColumn.js
var ProfileColumn = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
}
get contents() {
return this.items;
}
};
__name(ProfileColumn, "ProfileColumn");
ProfileColumn.type = "ProfileColumn";
var ProfileColumn_default = ProfileColumn;
// dist/src/parser/classes/ProfileColumnStats.js
var ProfileColumnStats = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
}
get contents() {
return this.items;
}
};
__name(ProfileColumnStats, "ProfileColumnStats");
ProfileColumnStats.type = "ProfileColumnStats";
var ProfileColumnStats_default = ProfileColumnStats;
// dist/src/parser/classes/ProfileColumnStatsEntry.js
var ProfileColumnStatsEntry = class extends YTNode {
constructor(data2) {
super();
this.label = new Text(data2.label);
this.value = new Text(data2.value);
}
};
__name(ProfileColumnStatsEntry, "ProfileColumnStatsEntry");
ProfileColumnStatsEntry.type = "ProfileColumnStatsEntry";
var ProfileColumnStatsEntry_default = ProfileColumnStatsEntry;
// dist/src/parser/classes/ProfileColumnUserInfo.js
var ProfileColumnUserInfo = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
}
};
__name(ProfileColumnUserInfo, "ProfileColumnUserInfo");
ProfileColumnUserInfo.type = "ProfileColumnUserInfo";
var ProfileColumnUserInfo_default = ProfileColumnUserInfo;
// dist/src/parser/classes/Quiz.js
var Quiz = class extends YTNode {
constructor(data2) {
super();
this.choices = data2.choices.map((choice) => ({
text: new Text(choice.text),
is_correct: choice.isCorrect
}));
this.total_votes = new Text(data2.totalVotes);
}
};
__name(Quiz, "Quiz");
Quiz.type = "Quiz";
var Quiz_default = Quiz;
// dist/src/parser/classes/RecognitionShelf.js
var RecognitionShelf = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.subtitle = new Text(data2.subtitle);
this.avatars = data2.avatars.map((avatar) => new Thumbnail(avatar));
this.button = parser_exports.parseItem(data2.button, Button_default);
this.surface = data2.surface;
}
};
__name(RecognitionShelf, "RecognitionShelf");
RecognitionShelf.type = "RecognitionShelf";
var RecognitionShelf_default = RecognitionShelf;
// dist/src/parser/classes/ReelItem.js
var ReelItem = class extends YTNode {
constructor(data2) {
super();
this.id = data2.videoId;
this.title = new Text(data2.headline);
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.views = new Text(data2.viewCountText);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.accessibility_label = data2.accessibility.accessibilityData.label;
}
};
__name(ReelItem, "ReelItem");
ReelItem.type = "ReelItem";
var ReelItem_default = ReelItem;
// dist/src/parser/classes/ReelPlayerHeader.js
var ReelPlayerHeader = class extends YTNode {
constructor(data2) {
super();
this.reel_title_text = new Text(data2.reelTitleText);
this.timestamp_text = new Text(data2.timestampText);
this.channel_title_text = new Text(data2.channelTitleText);
this.channel_thumbnail = Thumbnail.fromResponse(data2.channelThumbnail);
this.author = new Author(data2.channelNavigationEndpoint, void 0);
}
};
__name(ReelPlayerHeader, "ReelPlayerHeader");
ReelPlayerHeader.type = "ReelPlayerHeader";
var ReelPlayerHeader_default = ReelPlayerHeader;
// dist/src/parser/classes/ReelPlayerOverlay.js
var ReelPlayerOverlay = class extends YTNode {
constructor(data2) {
super();
this.like_button = parser_exports.parseItem(data2.likeButton, LikeButton_default);
this.reel_player_header_supported_renderers = parser_exports.parseItem(data2.reelPlayerHeaderSupportedRenderers, ReelPlayerHeader_default);
this.menu = parser_exports.parseItem(data2.menu, Menu_default);
this.next_item_button = parser_exports.parseItem(data2.nextItemButton, Button_default);
this.prev_item_button = parser_exports.parseItem(data2.prevItemButton, Button_default);
this.subscribe_button_renderer = parser_exports.parseItem(data2.subscribeButtonRenderer, [Button_default, SubscribeButton_default]);
this.style = data2.style;
this.view_comments_button = parser_exports.parseItem(data2.viewCommentsButton, Button_default);
this.share_button = parser_exports.parseItem(data2.shareButton, Button_default);
this.pivot_button = parser_exports.parseItem(data2.pivotButton, PivotButton_default);
this.info_panel = parser_exports.parseItem(data2.infoPanel, InfoPanelContainer_default);
}
};
__name(ReelPlayerOverlay, "ReelPlayerOverlay");
ReelPlayerOverlay.type = "ReelPlayerOverlay";
var ReelPlayerOverlay_default = ReelPlayerOverlay;
// dist/src/parser/classes/RelatedChipCloud.js
var RelatedChipCloud = class extends YTNode {
constructor(data2) {
super();
this.content = parser_exports.parseItem(data2.content);
}
};
__name(RelatedChipCloud, "RelatedChipCloud");
RelatedChipCloud.type = "RelatedChipCloud";
var RelatedChipCloud_default = RelatedChipCloud;
// dist/src/parser/classes/RichGrid.js
var RichGrid = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header);
this.contents = parser_exports.parseArray(data2.contents);
if (Reflect.has(data2, "targetId"))
this.target_id = data2.targetId;
}
};
__name(RichGrid, "RichGrid");
RichGrid.type = "RichGrid";
var RichGrid_default = RichGrid;
// dist/src/parser/classes/RichItem.js
var RichItem = class extends YTNode {
constructor(data2) {
super();
this.content = parser_exports.parseItem(data2.content);
}
};
__name(RichItem, "RichItem");
RichItem.type = "RichItem";
var RichItem_default = RichItem;
// dist/src/parser/classes/RichListHeader.js
var RichListHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.subtitle = new Text(data2.subtitle);
if (Reflect.has(data2, "titleStyle")) {
this.title_style = data2.titleStyle.style;
}
if (Reflect.has(data2, "icon")) {
this.icon_type = data2.icon.iconType;
}
}
};
__name(RichListHeader, "RichListHeader");
RichListHeader.type = "RichListHeader";
var RichListHeader_default = RichListHeader;
// dist/src/parser/classes/RichMetadata.js
var RichMetadata = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.title = new Text(data2.title);
this.subtitle = new Text(data2.subtitle);
this.call_to_action = new Text(data2.callToAction);
if (Reflect.has(data2, "callToActionIcon")) {
this.icon_type = data2.callToActionIcon.iconType;
}
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
}
};
__name(RichMetadata, "RichMetadata");
RichMetadata.type = "RichMetadata";
var RichMetadata_default = RichMetadata;
// dist/src/parser/classes/RichMetadataRow.js
var RichMetadataRow = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents);
}
};
__name(RichMetadataRow, "RichMetadataRow");
RichMetadataRow.type = "RichMetadataRow";
var RichMetadataRow_default = RichMetadataRow;
// dist/src/parser/classes/RichSection.js
var RichSection = class extends YTNode {
constructor(data2) {
super();
this.content = parser_exports.parseItem(data2.content);
}
};
__name(RichSection, "RichSection");
RichSection.type = "RichSection";
var RichSection_default = RichSection;
// dist/src/parser/classes/RichShelf.js
var RichShelf = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.contents = parser_exports.parseArray(data2.contents);
if (Reflect.has(data2, "endpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
}
if (Reflect.has(data2, "subtitle")) {
this.subtitle = new Text(data2.subtitle);
}
}
};
__name(RichShelf, "RichShelf");
RichShelf.type = "RichShelf";
var RichShelf_default = RichShelf;
// dist/src/parser/classes/SearchBox.js
var SearchBox = class extends YTNode {
constructor(data2) {
super();
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
this.search_button = parser_exports.parseItem(data2.searchButton, Button_default);
this.clear_button = parser_exports.parseItem(data2.clearButton, Button_default);
this.placeholder_text = new Text(data2.placeholderText);
}
};
__name(SearchBox, "SearchBox");
SearchBox.type = "SearchBox";
var SearchBox_default = SearchBox;
// dist/src/parser/classes/SearchFilter.js
var SearchFilter2 = class extends YTNode {
constructor(data2) {
super();
this.label = new Text(data2.label);
this.endpoint = new NavigationEndpoint_default(data2.endpoint || data2.navigationEndpoint);
this.tooltip = data2.tooltip;
if (Reflect.has(data2, "status")) {
this.status = data2.status;
}
}
get disabled() {
return this.status === "FILTER_STATUS_DISABLED";
}
get selected() {
return this.status === "FILTER_STATUS_SELECTED";
}
};
__name(SearchFilter2, "SearchFilter");
SearchFilter2.type = "SearchFilter";
var SearchFilter_default = SearchFilter2;
// dist/src/parser/classes/SearchFilterGroup.js
var SearchFilterGroup = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.filters = parser_exports.parseArray(data2.filters, SearchFilter_default);
}
};
__name(SearchFilterGroup, "SearchFilterGroup");
SearchFilterGroup.type = "SearchFilterGroup";
var SearchFilterGroup_default = SearchFilterGroup;
// dist/src/parser/classes/SearchFilterOptionsDialog.js
var SearchFilterOptionsDialog = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.groups = parser_exports.parseArray(data2.groups, SearchFilterGroup_default);
}
};
__name(SearchFilterOptionsDialog, "SearchFilterOptionsDialog");
SearchFilterOptionsDialog.type = "SearchFilterOptionsDialog";
var SearchFilterOptionsDialog_default = SearchFilterOptionsDialog;
// dist/src/parser/classes/SearchHeader.js
var SearchHeader = class extends YTNode {
constructor(data2) {
super();
this.chip_bar = parser_exports.parseItem(data2.chipBar, ChipCloud_default);
this.search_filter_button = parser_exports.parseItem(data2.searchFilterButton, Button_default);
}
};
__name(SearchHeader, "SearchHeader");
SearchHeader.type = "SearchHeader";
var SearchHeader_default = SearchHeader;
// dist/src/parser/classes/SearchSubMenu.js
var SearchSubMenu = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "title"))
this.title = new Text(data2.title);
if (Reflect.has(data2, "groups"))
this.groups = parser_exports.parseArray(data2.groups, SearchFilterGroup_default);
if (Reflect.has(data2, "button"))
this.button = parser_exports.parseItem(data2.button, ToggleButton_default);
}
};
__name(SearchSubMenu, "SearchSubMenu");
SearchSubMenu.type = "SearchSubMenu";
var SearchSubMenu_default = SearchSubMenu;
// dist/src/parser/classes/SearchSuggestionsSection.js
var SearchSuggestionsSection = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents);
}
};
__name(SearchSuggestionsSection, "SearchSuggestionsSection");
SearchSuggestionsSection.type = "SearchSuggestionsSection";
var SearchSuggestionsSection_default = SearchSuggestionsSection;
// dist/src/parser/classes/SecondarySearchContainer.js
var SecondarySearchContainer = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parseArray(data2.contents);
}
};
__name(SecondarySearchContainer, "SecondarySearchContainer");
SecondarySearchContainer.type = "SecondarySearchContainer";
var SecondarySearchContainer_default = SecondarySearchContainer;
// dist/src/parser/classes/SegmentedLikeDislikeButton.js
var SegmentedLikeDislikeButton = class extends YTNode {
constructor(data2) {
super();
this.like_button = parser_exports.parseItem(data2.likeButton, [ToggleButton_default, Button_default]);
this.dislike_button = parser_exports.parseItem(data2.dislikeButton, [ToggleButton_default, Button_default]);
}
};
__name(SegmentedLikeDislikeButton, "SegmentedLikeDislikeButton");
SegmentedLikeDislikeButton.type = "SegmentedLikeDislikeButton";
var SegmentedLikeDislikeButton_default = SegmentedLikeDislikeButton;
// dist/src/parser/classes/SettingBoolean.js
var SettingBoolean = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "title")) {
this.title = new Text(data2.title);
}
if (Reflect.has(data2, "summary")) {
this.summary = new Text(data2.summary);
}
if (Reflect.has(data2, "enableServiceEndpoint")) {
this.enable_endpoint = new NavigationEndpoint_default(data2.enableServiceEndpoint);
}
if (Reflect.has(data2, "disableServiceEndpoint")) {
this.disable_endpoint = new NavigationEndpoint_default(data2.disableServiceEndpoint);
}
this.item_id = data2.itemId;
}
};
__name(SettingBoolean, "SettingBoolean");
SettingBoolean.type = "SettingBoolean";
var SettingBoolean_default = SettingBoolean;
// dist/src/parser/classes/SettingsCheckbox.js
var SettingsCheckbox = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.help_text = new Text(data2.helpText);
this.enabled = data2.enabled;
this.disabled = data2.disabled;
this.id = data2.id;
}
};
__name(SettingsCheckbox, "SettingsCheckbox");
SettingsCheckbox.type = "SettingsCheckbox";
var SettingsCheckbox_default = SettingsCheckbox;
// dist/src/parser/classes/SettingsSwitch.js
var SettingsSwitch = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.subtitle = new Text(data2.subtitle);
this.enabled = data2.enabled;
this.enable_endpoint = new NavigationEndpoint_default(data2.enableServiceEndpoint);
this.disable_endpoint = new NavigationEndpoint_default(data2.disableServiceEndpoint);
}
};
__name(SettingsSwitch, "SettingsSwitch");
SettingsSwitch.type = "SettingsSwitch";
var SettingsSwitch_default = SettingsSwitch;
// dist/src/parser/classes/SettingsOptions.js
var SettingsOptions = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
if (Reflect.has(data2, "text")) {
this.text = new Text(data2.text).toString();
}
if (Reflect.has(data2, "options")) {
this.options = parser_exports.parseArray(data2.options, [
SettingsSwitch_default,
Dropdown_default,
CopyLink_default,
SettingsCheckbox_default,
ChannelOptions_default
]);
}
}
};
__name(SettingsOptions, "SettingsOptions");
SettingsOptions.type = "SettingsOptions";
var SettingsOptions_default = SettingsOptions;
// dist/src/parser/classes/SettingsSidebar.js
var SettingsSidebar = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.items = parser_exports.parseArray(data2.items, CompactLink_default);
}
get contents() {
return this.items;
}
};
__name(SettingsSidebar, "SettingsSidebar");
SettingsSidebar.type = "SettingsSidebar";
var SettingsSidebar_default = SettingsSidebar;
// dist/src/parser/classes/SharedPost.js
var SharedPost = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.content = new Text(data2.content);
this.published = new Text(data2.publishedTimeText);
this.menu = parser_exports.parseItem(data2.actionMenu, Menu_default);
this.original_post = parser_exports.parseItem(data2.originalPost, [BackstagePost_default, Post_default]);
this.id = data2.postId;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.expand_button = parser_exports.parseItem(data2.expandButton, Button_default);
this.author = new Author(data2.displayName, void 0);
}
};
__name(SharedPost, "SharedPost");
SharedPost.type = "SharedPost";
var SharedPost_default = SharedPost;
// dist/src/parser/classes/SharePanelHeader.js
var SharePanelHeader = class extends YTNode {
constructor(data2) {
super();
this.title = parser_exports.parseItem(data2.title);
}
};
__name(SharePanelHeader, "SharePanelHeader");
SharePanelHeader.type = "SharePanelHeader";
var SharePanelHeader_default = SharePanelHeader;
// dist/src/parser/classes/SharePanelTitleV15.js
var SharePanelTitleV15 = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
}
};
__name(SharePanelTitleV15, "SharePanelTitleV15");
SharePanelTitleV15.type = "SharePanelTitleV15";
var SharePanelTitleV15_default = SharePanelTitleV15;
// dist/src/parser/classes/ShareTarget.js
var ShareTarget = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "serviceEndpoint"))
this.endpoint = new NavigationEndpoint_default(data2.serviceEndpoint);
else if (Reflect.has(data2, "navigationEndpoint"))
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.service_name = data2.serviceName;
this.target_id = data2.targetId;
this.title = new Text(data2.title);
}
};
__name(ShareTarget, "ShareTarget");
ShareTarget.type = "ShareTarget";
var ShareTarget_default = ShareTarget;
// dist/src/parser/classes/Shelf.js
var Shelf = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
if (Reflect.has(data2, "endpoint")) {
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
}
this.content = parser_exports.parseItem(data2.content);
if (Reflect.has(data2, "icon")) {
this.icon_type = data2.icon.iconType;
}
if (Reflect.has(data2, "menu")) {
this.menu = parser_exports.parseItem(data2.menu);
}
if (Reflect.has(data2, "playAllButton")) {
this.play_all_button = parser_exports.parseItem(data2.playAllButton, Button_default);
}
if (Reflect.has(data2, "subtitle")) {
this.subtitle = new Text(data2.subtitle);
}
}
};
__name(Shelf, "Shelf");
Shelf.type = "Shelf";
var Shelf_default = Shelf;
// dist/src/parser/classes/ShortsLockupView.js
var ShortsLockupView = class extends YTNode {
constructor(data2) {
super();
this.entity_id = data2.entityId;
this.accessibility_text = data2.accessibilityText;
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.on_tap_endpoint = new NavigationEndpoint_default(data2.onTap);
this.menu_on_tap = new NavigationEndpoint_default(data2.menuOnTap);
this.index_in_collection = data2.indexInCollection;
this.menu_on_tap_a11y_label = data2.menuOnTapA11yLabel;
this.overlay_metadata = {
primary_text: data2.overlayMetadata.primaryText ? Text.fromAttributed(data2.overlayMetadata.primaryText) : void 0,
secondary_text: data2.overlayMetadata.secondaryText ? Text.fromAttributed(data2.overlayMetadata.secondaryText) : void 0
};
if (data2.inlinePlayerData?.onVisible) {
this.inline_player_data = new NavigationEndpoint_default(data2.inlinePlayerData.onVisible);
}
if (data2.badge) {
this.badge = parser_exports.parseItem(data2.badge, BadgeView);
}
}
};
__name(ShortsLockupView, "ShortsLockupView");
ShortsLockupView.type = "ShortsLockupView";
var ShortsLockupView_default = ShortsLockupView;
// dist/src/parser/classes/ShowingResultsFor.js
var ShowingResultsFor = class extends YTNode {
constructor(data2) {
super();
this.corrected_query = new Text(data2.correctedQuery);
this.original_query = new Text(data2.originalQuery);
this.corrected_query_endpoint = new NavigationEndpoint_default(data2.correctedQueryEndpoint);
this.original_query_endpoint = new NavigationEndpoint_default(data2.originalQueryEndpoint);
this.search_instead_for = new Text(data2.searchInsteadFor);
this.showing_results_for = new Text(data2.showingResultsFor);
}
};
__name(ShowingResultsFor, "ShowingResultsFor");
ShowingResultsFor.type = "ShowingResultsFor";
var ShowingResultsFor_default = ShowingResultsFor;
// dist/src/parser/classes/SimpleCardContent.js
var SimpleCardContent = class extends YTNode {
constructor(data2) {
super();
this.image = Thumbnail.fromResponse(data2.image);
this.title = new Text(data2.title);
this.display_domain = new Text(data2.displayDomain);
this.show_link_icon = data2.showLinkIcon;
this.call_to_action = new Text(data2.callToAction);
this.endpoint = new NavigationEndpoint_default(data2.command);
}
};
__name(SimpleCardContent, "SimpleCardContent");
SimpleCardContent.type = "SimpleCardContent";
var SimpleCardContent_default = SimpleCardContent;
// dist/src/parser/classes/SimpleCardTeaser.js
var SimpleCardTeaser = class extends YTNode {
constructor(data2) {
super();
this.message = new Text(data2.message);
this.prominent = data2.prominent;
}
};
__name(SimpleCardTeaser, "SimpleCardTeaser");
SimpleCardTeaser.type = "SimpleCardTeaser";
var SimpleCardTeaser_default = SimpleCardTeaser;
// dist/src/parser/classes/SimpleTextSection.js
var SimpleTextSection = class extends YTNode {
constructor(data2) {
super();
this.lines = data2.lines.map((line) => new Text(line));
this.style = data2.layoutStyle;
}
};
__name(SimpleTextSection, "SimpleTextSection");
SimpleTextSection.type = "SimpleTextSection";
var SimpleTextSection_default = SimpleTextSection;
// dist/src/parser/classes/SingleActionEmergencySupport.js
var SingleActionEmergencySupport = class extends YTNode {
constructor(data2) {
super();
this.action_text = new Text(data2.actionText);
this.nav_text = new Text(data2.navigationText);
this.details = new Text(data2.detailsText);
this.icon_type = data2.icon.iconType;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
};
__name(SingleActionEmergencySupport, "SingleActionEmergencySupport");
SingleActionEmergencySupport.type = "SingleActionEmergencySupport";
var SingleActionEmergencySupport_default = SingleActionEmergencySupport;
// dist/src/parser/classes/Tab.js
var Tab = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title || "N/A";
this.selected = !!data2.selected;
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
this.content = parser_exports.parseItem(data2.content, [SectionList_default, MusicQueue_default, RichGrid_default]);
}
};
__name(Tab, "Tab");
Tab.type = "Tab";
var Tab_default = Tab;
// dist/src/parser/classes/SingleColumnBrowseResults.js
var SingleColumnBrowseResults = class extends YTNode {
constructor(data2) {
super();
this.tabs = parser_exports.parseArray(data2.tabs, Tab_default);
}
};
__name(SingleColumnBrowseResults, "SingleColumnBrowseResults");
SingleColumnBrowseResults.type = "SingleColumnBrowseResults";
var SingleColumnBrowseResults_default = SingleColumnBrowseResults;
// dist/src/parser/classes/SingleColumnMusicWatchNextResults.js
var SingleColumnMusicWatchNextResults = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parse(data2);
}
};
__name(SingleColumnMusicWatchNextResults, "SingleColumnMusicWatchNextResults");
SingleColumnMusicWatchNextResults.type = "SingleColumnMusicWatchNextResults";
var SingleColumnMusicWatchNextResults_default = SingleColumnMusicWatchNextResults;
// dist/src/parser/classes/SingleHeroImage.js
var SingleHeroImage = class extends YTNode {
constructor(data2) {
super();
this.thumbnails = Thumbnail.fromResponse(data2.thumbnail);
this.style = data2.style;
}
};
__name(SingleHeroImage, "SingleHeroImage");
SingleHeroImage.type = "SingleHeroImage";
var SingleHeroImage_default = SingleHeroImage;
// dist/src/parser/classes/SlimOwner.js
var SlimOwner = class extends YTNode {
constructor(data2) {
super();
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.title = new Text(data2.title);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.subscribe_button = parser_exports.parseItem(data2.subscribeButton, SubscribeButton_default);
}
};
__name(SlimOwner, "SlimOwner");
SlimOwner.type = "SlimOwner";
var SlimOwner_default = SlimOwner;
// dist/src/parser/classes/SlimVideoMetadata.js
var SlimVideoMetadata = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.collapsed_subtitle = new Text(data2.collapsedSubtitle);
this.expanded_subtitle = new Text(data2.expandedSubtitle);
this.owner = parser_exports.parseItem(data2.owner);
this.description = new Text(data2.description);
this.video_id = data2.videoId;
this.date = new Text(data2.dateText);
}
};
__name(SlimVideoMetadata, "SlimVideoMetadata");
SlimVideoMetadata.type = "SlimVideoMetadata";
var SlimVideoMetadata_default = SlimVideoMetadata;
// dist/src/parser/classes/StartAt.js
var StartAt = class extends YTNode {
constructor(data2) {
super();
this.start_at_option_label = new Text(data2.startAtOptionLabel);
}
};
__name(StartAt, "StartAt");
StartAt.type = "StartAt";
var StartAt_default = StartAt;
// dist/src/parser/classes/SubFeedOption.js
var SubFeedOption = class extends YTNode {
constructor(data2) {
super();
this.name = new Text(data2.name);
this.is_selected = data2.isSelected;
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
};
__name(SubFeedOption, "SubFeedOption");
SubFeedOption.type = "SubFeedOption";
var SubFeedOption_default = SubFeedOption;
// dist/src/parser/classes/SubFeedSelector.js
var SubFeedSelector = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.options = parser_exports.parseArray(data2.options, SubFeedOption_default);
}
};
__name(SubFeedSelector, "SubFeedSelector");
SubFeedSelector.type = "SubFeedSelector";
var SubFeedSelector_default = SubFeedSelector;
// dist/src/parser/classes/Tabbed.js
var Tabbed = class extends YTNode {
constructor(data2) {
super();
this.contents = parser_exports.parse(data2);
}
};
__name(Tabbed, "Tabbed");
Tabbed.type = "Tabbed";
var Tabbed_default = Tabbed;
// dist/src/parser/classes/TabbedSearchResults.js
var TabbedSearchResults = class extends YTNode {
constructor(data2) {
super();
this.tabs = parser_exports.parseArray(data2.tabs, Tab_default);
}
};
__name(TabbedSearchResults, "TabbedSearchResults");
TabbedSearchResults.type = "TabbedSearchResults";
var TabbedSearchResults_default = TabbedSearchResults;
// dist/src/parser/classes/TextHeader.js
var TextHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.style = data2.style;
}
};
__name(TextHeader, "TextHeader");
TextHeader.type = "TextHeader";
var TextHeader_default = TextHeader;
// dist/src/parser/classes/ThirdPartyShareTargetSection.js
var ThirdPartyShareTargetSection = class extends YTNode {
constructor(data2) {
super();
this.share_targets = parser_exports.parseArray(data2.shareTargets, ShareTarget_default);
}
};
__name(ThirdPartyShareTargetSection, "ThirdPartyShareTargetSection");
ThirdPartyShareTargetSection.type = "ThirdPartyShareTargetSection";
var ThirdPartyShareTargetSection_default = ThirdPartyShareTargetSection;
// dist/src/parser/classes/ThumbnailLandscapePortrait.js
var ThumbnailLandscapePortrait = class extends YTNode {
constructor(data2) {
super();
this.landscape = Thumbnail.fromResponse(data2.landscape);
this.portrait = Thumbnail.fromResponse(data2.portrait);
}
};
__name(ThumbnailLandscapePortrait, "ThumbnailLandscapePortrait");
ThumbnailLandscapePortrait.type = "ThumbnailLandscapePortrait";
var ThumbnailLandscapePortrait_default = ThumbnailLandscapePortrait;
// dist/src/parser/classes/ThumbnailOverlayEndorsement.js
var ThumbnailOverlayEndorsement = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text).toString();
}
};
__name(ThumbnailOverlayEndorsement, "ThumbnailOverlayEndorsement");
ThumbnailOverlayEndorsement.type = "ThumbnailOverlayEndorsement";
var ThumbnailOverlayEndorsement_default = ThumbnailOverlayEndorsement;
// dist/src/parser/classes/ThumbnailOverlayHoverText.js
var ThumbnailOverlayHoverText = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text);
this.icon_type = data2.icon.iconType;
}
};
__name(ThumbnailOverlayHoverText, "ThumbnailOverlayHoverText");
ThumbnailOverlayHoverText.type = "ThumbnailOverlayHoverText";
var ThumbnailOverlayHoverText_default = ThumbnailOverlayHoverText;
// dist/src/parser/classes/ThumbnailOverlayInlineUnplayable.js
var ThumbnailOverlayInlineUnplayable = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text).toString();
this.icon_type = data2.icon.iconType;
}
};
__name(ThumbnailOverlayInlineUnplayable, "ThumbnailOverlayInlineUnplayable");
ThumbnailOverlayInlineUnplayable.type = "ThumbnailOverlayInlineUnplayable";
var ThumbnailOverlayInlineUnplayable_default = ThumbnailOverlayInlineUnplayable;
// dist/src/parser/classes/ThumbnailOverlayLoadingPreview.js
var ThumbnailOverlayLoadingPreview = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text);
}
};
__name(ThumbnailOverlayLoadingPreview, "ThumbnailOverlayLoadingPreview");
ThumbnailOverlayLoadingPreview.type = "ThumbnailOverlayLoadingPreview";
var ThumbnailOverlayLoadingPreview_default = ThumbnailOverlayLoadingPreview;
// dist/src/parser/classes/ThumbnailOverlayNowPlaying.js
var ThumbnailOverlayNowPlaying = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text).toString();
}
};
__name(ThumbnailOverlayNowPlaying, "ThumbnailOverlayNowPlaying");
ThumbnailOverlayNowPlaying.type = "ThumbnailOverlayNowPlaying";
var ThumbnailOverlayNowPlaying_default = ThumbnailOverlayNowPlaying;
// dist/src/parser/classes/ThumbnailOverlayPinking.js
var ThumbnailOverlayPinking = class extends YTNode {
constructor(data2) {
super();
this.hack = data2.hack;
}
};
__name(ThumbnailOverlayPinking, "ThumbnailOverlayPinking");
ThumbnailOverlayPinking.type = "ThumbnailOverlayPinking";
var ThumbnailOverlayPinking_default = ThumbnailOverlayPinking;
// dist/src/parser/classes/ThumbnailOverlayPlaybackStatus.js
var ThumbnailOverlayPlaybackStatus = class extends YTNode {
constructor(data2) {
super();
this.texts = data2.texts.map((text) => new Text(text));
}
};
__name(ThumbnailOverlayPlaybackStatus, "ThumbnailOverlayPlaybackStatus");
ThumbnailOverlayPlaybackStatus.type = "ThumbnailOverlayPlaybackStatus";
var ThumbnailOverlayPlaybackStatus_default = ThumbnailOverlayPlaybackStatus;
// dist/src/parser/classes/ThumbnailOverlayResumePlayback.js
var ThumbnailOverlayResumePlayback = class extends YTNode {
constructor(data2) {
super();
this.percent_duration_watched = data2.percentDurationWatched;
}
};
__name(ThumbnailOverlayResumePlayback, "ThumbnailOverlayResumePlayback");
ThumbnailOverlayResumePlayback.type = "ThumbnailOverlayResumePlayback";
var ThumbnailOverlayResumePlayback_default = ThumbnailOverlayResumePlayback;
// dist/src/parser/classes/ThumbnailOverlaySidePanel.js
var ThumbnailOverlaySidePanel = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.text);
this.icon_type = data2.icon.iconType;
}
};
__name(ThumbnailOverlaySidePanel, "ThumbnailOverlaySidePanel");
ThumbnailOverlaySidePanel.type = "ThumbnailOverlaySidePanel";
var ThumbnailOverlaySidePanel_default = ThumbnailOverlaySidePanel;
// dist/src/parser/classes/ThumbnailOverlayToggleButton.js
var ThumbnailOverlayToggleButton = class extends YTNode {
constructor(data2) {
super();
if (Reflect.has(data2, "isToggled")) {
this.is_toggled = data2.isToggled;
}
this.icon_type = {
toggled: data2.toggledIcon.iconType,
untoggled: data2.untoggledIcon.iconType
};
this.tooltip = {
toggled: data2.toggledTooltip,
untoggled: data2.untoggledTooltip
};
if (data2.toggledServiceEndpoint)
this.toggled_endpoint = new NavigationEndpoint_default(data2.toggledServiceEndpoint);
if (data2.untoggledServiceEndpoint)
this.untoggled_endpoint = new NavigationEndpoint_default(data2.untoggledServiceEndpoint);
}
};
__name(ThumbnailOverlayToggleButton, "ThumbnailOverlayToggleButton");
ThumbnailOverlayToggleButton.type = "ThumbnailOverlayToggleButton";
var ThumbnailOverlayToggleButton_default = ThumbnailOverlayToggleButton;
// dist/src/parser/classes/TimedMarkerDecoration.js
var TimedMarkerDecoration = class extends YTNode {
constructor(data2) {
super();
this.visible_time_range_start_millis = data2.visibleTimeRangeStartMillis;
this.visible_time_range_end_millis = data2.visibleTimeRangeEndMillis;
this.decoration_time_millis = data2.decorationTimeMillis;
this.label = new Text(data2.label);
this.icon = data2.icon;
}
};
__name(TimedMarkerDecoration, "TimedMarkerDecoration");
TimedMarkerDecoration.type = "TimedMarkerDecoration";
var TimedMarkerDecoration_default = TimedMarkerDecoration;
// dist/src/parser/classes/TitleAndButtonListHeader.js
var TitleAndButtonListHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
}
};
__name(TitleAndButtonListHeader, "TitleAndButtonListHeader");
TitleAndButtonListHeader.type = "TitleAndButtonListHeader";
var TitleAndButtonListHeader_default = TitleAndButtonListHeader;
// dist/src/parser/classes/ToggleMenuServiceItem.js
var ToggleMenuServiceItem = class extends YTNode {
constructor(data2) {
super();
this.text = new Text(data2.defaultText);
this.toggled_text = new Text(data2.toggledText);
this.icon_type = data2.defaultIcon.iconType;
this.toggled_icon_type = data2.toggledIcon.iconType;
this.default_endpoint = new NavigationEndpoint_default(data2.defaultServiceEndpoint);
this.toggled_endpoint = new NavigationEndpoint_default(data2.toggledServiceEndpoint);
}
};
__name(ToggleMenuServiceItem, "ToggleMenuServiceItem");
ToggleMenuServiceItem.type = "ToggleMenuServiceItem";
var ToggleMenuServiceItem_default = ToggleMenuServiceItem;
// dist/src/parser/classes/Tooltip.js
var Tooltip = class extends YTNode {
constructor(data2) {
super();
this.promo_config = {
promo_id: data2.promoConfig.promoId,
impression_endpoints: data2.promoConfig.impressionEndpoints.map((endpoint) => new NavigationEndpoint_default(endpoint)),
accept: new NavigationEndpoint_default(data2.promoConfig.acceptCommand),
dismiss: new NavigationEndpoint_default(data2.promoConfig.dismissCommand)
};
this.target_id = data2.targetId;
this.details = new Text(data2.detailsText);
this.suggested_position = data2.suggestedPosition.type;
this.dismiss_stratedy = data2.dismissStrategy.type;
this.dwell_time_ms = parseInt(data2.dwellTimeMs);
}
};
__name(Tooltip, "Tooltip");
Tooltip.type = "Tooltip";
var Tooltip_default = Tooltip;
// dist/src/parser/classes/TopicChannelDetails.js
var TopicChannelDetails = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.avatar = Thumbnail.fromResponse(data2.thumbnail ?? data2.avatar);
this.subtitle = new Text(data2.subtitle);
this.subscribe_button = parser_exports.parseItem(data2.subscribeButton, SubscribeButton_default);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
}
};
__name(TopicChannelDetails, "TopicChannelDetails");
TopicChannelDetails.type = "TopicChannelDetails";
var TopicChannelDetails_default = TopicChannelDetails;
// dist/src/parser/classes/TwoColumnBrowseResults.js
var TwoColumnBrowseResults = class extends YTNode {
constructor(data2) {
super();
this.tabs = parser_exports.parse(data2.tabs);
this.secondary_contents = parser_exports.parse(data2.secondaryContents);
}
};
__name(TwoColumnBrowseResults, "TwoColumnBrowseResults");
TwoColumnBrowseResults.type = "TwoColumnBrowseResults";
var TwoColumnBrowseResults_default = TwoColumnBrowseResults;
// dist/src/parser/classes/TwoColumnSearchResults.js
var TwoColumnSearchResults = class extends YTNode {
constructor(data2) {
super();
this.primary_contents = parser_exports.parse(data2.primaryContents);
this.secondary_contents = parser_exports.parse(data2.secondaryContents);
}
};
__name(TwoColumnSearchResults, "TwoColumnSearchResults");
TwoColumnSearchResults.type = "TwoColumnSearchResults";
var TwoColumnSearchResults_default = TwoColumnSearchResults;
// dist/src/parser/classes/TwoColumnWatchNextResults.js
var _TwoColumnWatchNextResults_instances;
var _TwoColumnWatchNextResults_parseAutoplaySet;
var TwoColumnWatchNextResults = class extends YTNode {
constructor(data2) {
super();
_TwoColumnWatchNextResults_instances.add(this);
this.results = parser_exports.parseArray(data2.results?.results.contents);
this.secondary_results = parser_exports.parseArray(data2.secondaryResults?.secondaryResults.results);
this.conversation_bar = parser_exports.parseItem(data2?.conversationBar);
const playlistData = data2.playlist?.playlist;
if (playlistData) {
this.playlist = {
id: playlistData.playlistId,
title: playlistData.title,
author: playlistData.shortBylineText?.simpleText ? new Text(playlistData.shortBylineText) : new Author(playlistData.longBylineText),
contents: parser_exports.parseArray(playlistData.contents),
current_index: playlistData.currentIndex,
is_infinite: !!playlistData.isInfinite,
menu: parser_exports.parseItem(playlistData.menu, Menu_default)
};
}
const autoplayData = data2.autoplay?.autoplay;
if (autoplayData) {
this.autoplay = {
sets: autoplayData.sets.map((set) => __classPrivateFieldGet(this, _TwoColumnWatchNextResults_instances, "m", _TwoColumnWatchNextResults_parseAutoplaySet).call(this, set))
};
if (autoplayData.modifiedSets) {
this.autoplay.modified_sets = autoplayData.modifiedSets.map((set) => __classPrivateFieldGet(this, _TwoColumnWatchNextResults_instances, "m", _TwoColumnWatchNextResults_parseAutoplaySet).call(this, set));
}
if (autoplayData.countDownSecs) {
this.autoplay.count_down_secs = autoplayData.countDownSecs;
}
}
}
};
__name(TwoColumnWatchNextResults, "TwoColumnWatchNextResults");
_TwoColumnWatchNextResults_instances = /* @__PURE__ */ new WeakSet(), _TwoColumnWatchNextResults_parseAutoplaySet = /* @__PURE__ */ __name(function _TwoColumnWatchNextResults_parseAutoplaySet2(data2) {
const result = {
autoplay_video: new NavigationEndpoint_default(data2.autoplayVideo)
};
if (data2.nextButtonVideo) {
result.next_button_video = new NavigationEndpoint_default(data2.nextButtonVideo);
}
return result;
}, "_TwoColumnWatchNextResults_parseAutoplaySet");
TwoColumnWatchNextResults.type = "TwoColumnWatchNextResults";
var TwoColumnWatchNextResults_default = TwoColumnWatchNextResults;
// dist/src/parser/classes/UnifiedSharePanel.js
var UnifiedSharePanel = class extends YTNode {
constructor(data2) {
super();
if (data2.contents) {
const contents = data2.contents.find((content) => content.thirdPartyNetworkSection);
if (contents) {
this.third_party_network_section = {
share_target_container: parser_exports.parseItem(contents.thirdPartyNetworkSection.shareTargetContainer, ThirdPartyShareTargetSection_default),
copy_link_container: parser_exports.parseItem(contents.thirdPartyNetworkSection.copyLinkContainer, CopyLink_default),
start_at_container: parser_exports.parseItem(contents.thirdPartyNetworkSection.startAtContainer, StartAt_default)
};
}
}
this.header = parser_exports.parseItem(data2.header, SharePanelHeader_default);
this.share_panel_version = data2.sharePanelVersion;
if (Reflect.has(data2, "showLoadingSpinner"))
this.show_loading_spinner = data2.showLoadingSpinner;
}
};
__name(UnifiedSharePanel, "UnifiedSharePanel");
UnifiedSharePanel.type = "UnifiedSharePanel";
var UnifiedSharePanel_default = UnifiedSharePanel;
// dist/src/parser/classes/UniversalWatchCard.js
var UniversalWatchCard = class extends YTNode {
constructor(data2) {
super();
this.header = parser_exports.parseItem(data2.header);
this.call_to_action = parser_exports.parseItem(data2.callToAction);
this.sections = parser_exports.parseArray(data2.sections);
if (Reflect.has(data2, "collapsedLabel")) {
this.collapsed_label = new Text(data2.collapsedLabel);
}
}
};
__name(UniversalWatchCard, "UniversalWatchCard");
UniversalWatchCard.type = "UniversalWatchCard";
var UniversalWatchCard_default = UniversalWatchCard;
// dist/src/parser/classes/UpsellDialog.js
var UpsellDialog = class extends YTNode {
constructor(data2) {
super();
this.message_title = new Text(data2.dialogMessageTitle);
this.message_text = new Text(data2.dialogMessageText);
this.action_button = parser_exports.parseItem(data2.actionButton, Button_default);
this.dismiss_button = parser_exports.parseItem(data2.dismissButton, Button_default);
this.is_visible = data2.isVisible;
}
};
__name(UpsellDialog, "UpsellDialog");
UpsellDialog.type = "UpsellDialog";
var UpsellDialog_default = UpsellDialog;
// dist/src/parser/classes/VerticalList.js
var VerticalList = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
this.collapsed_item_count = data2.collapsedItemCount;
this.collapsed_state_button_text = new Text(data2.collapsedStateButtonText);
}
get contents() {
return this.items;
}
};
__name(VerticalList, "VerticalList");
VerticalList.type = "VerticalList";
var VerticalList_default = VerticalList;
// dist/src/parser/classes/VerticalWatchCardList.js
var VerticalWatchCardList = class extends YTNode {
constructor(data2) {
super();
this.items = parser_exports.parseArray(data2.items);
this.view_all_text = new Text(data2.viewAllText);
this.view_all_endpoint = new NavigationEndpoint_default(data2.viewAllEndpoint);
}
get contents() {
return this.items;
}
};
__name(VerticalWatchCardList, "VerticalWatchCardList");
VerticalWatchCardList.type = "VerticalWatchCardList";
var VerticalWatchCardList_default = VerticalWatchCardList;
// dist/src/parser/classes/VideoInfoCardContent.js
var VideoInfoCardContent = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.videoTitle);
this.channel_name = new Text(data2.channelName);
this.view_count = new Text(data2.viewCountText);
this.video_thumbnails = Thumbnail.fromResponse(data2.videoThumbnail);
this.duration = new Text(data2.lengthString);
this.endpoint = new NavigationEndpoint_default(data2.action);
}
};
__name(VideoInfoCardContent, "VideoInfoCardContent");
VideoInfoCardContent.type = "VideoInfoCardContent";
var VideoInfoCardContent_default = VideoInfoCardContent;
// dist/src/parser/classes/VideoMetadataCarouselView.js
var VideoMetadataCarouselView = class extends YTNode {
constructor(data2) {
super();
this.carousel_titles = parser_exports.parse(data2.carouselTitles, true, CarouselTitleView_default);
this.carousel_items = parser_exports.parse(data2.carouselItems, true, CarouselItemView_default);
}
};
__name(VideoMetadataCarouselView, "VideoMetadataCarouselView");
VideoMetadataCarouselView.type = "VideoMetadataCarouselView";
var VideoMetadataCarouselView_default = VideoMetadataCarouselView;
// dist/src/parser/classes/VideoOwner.js
var VideoOwner = class extends YTNode {
constructor(data2) {
super();
this.subscription_button = data2.subscriptionButton;
this.subscriber_count = new Text(data2.subscriberCountText);
this.author = new Author({
...data2.title,
navigationEndpoint: data2.navigationEndpoint
}, data2.badges, data2.thumbnail);
}
};
__name(VideoOwner, "VideoOwner");
VideoOwner.type = "VideoOwner";
var VideoOwner_default = VideoOwner;
// dist/src/parser/classes/VideoViewCount.js
var VideoViewCount = class extends YTNode {
constructor(data2) {
super();
this.original_view_count = data2.originalViewCount;
this.short_view_count = new Text(data2.shortViewCount);
this.extra_short_view_count = new Text(data2.extraShortViewCount);
this.view_count = new Text(data2.viewCount);
}
};
__name(VideoViewCount, "VideoViewCount");
VideoViewCount.type = "VideoViewCount";
var VideoViewCount_default = VideoViewCount;
// dist/src/parser/classes/VideoPrimaryInfo.js
var VideoPrimaryInfo = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
if (Reflect.has(data2, "superTitleLink"))
this.super_title_link = new Text(data2.superTitleLink);
this.view_count = parser_exports.parseItem(data2.viewCount, VideoViewCount_default);
this.badges = parser_exports.parseArray(data2.badges, MetadataBadge_default);
this.published = new Text(data2.dateText);
this.relative_date = new Text(data2.relativeDateText);
this.menu = parser_exports.parseItem(data2.videoActions, Menu_default);
}
};
__name(VideoPrimaryInfo, "VideoPrimaryInfo");
VideoPrimaryInfo.type = "VideoPrimaryInfo";
var VideoPrimaryInfo_default = VideoPrimaryInfo;
// dist/src/parser/classes/VideoSecondaryInfo.js
var VideoSecondaryInfo = class extends YTNode {
constructor(data2) {
super();
this.owner = parser_exports.parseItem(data2.owner, VideoOwner_default);
this.description = new Text(data2.description);
if (Reflect.has(data2, "attributedDescription")) {
this.description = Text.fromAttributed(data2.attributedDescription);
}
this.subscribe_button = parser_exports.parseItem(data2.subscribeButton, [SubscribeButton_default, Button_default]);
this.metadata = parser_exports.parseItem(data2.metadataRowContainer, MetadataRowContainer_default);
this.show_more_text = new Text(data2.showMoreText);
this.show_less_text = new Text(data2.showLessText);
this.default_expanded = data2.defaultExpanded;
this.description_collapsed_lines = data2.descriptionCollapsedLines;
}
};
__name(VideoSecondaryInfo, "VideoSecondaryInfo");
VideoSecondaryInfo.type = "VideoSecondaryInfo";
var VideoSecondaryInfo_default = VideoSecondaryInfo;
// dist/src/parser/classes/WatchCardCompactVideo.js
var WatchCardCompactVideo = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.subtitle = new Text(data2.subtitle);
this.duration = {
text: new Text(data2.lengthText).toString(),
seconds: timeToSeconds(data2.lengthText.simpleText)
};
this.style = data2.style;
}
};
__name(WatchCardCompactVideo, "WatchCardCompactVideo");
WatchCardCompactVideo.type = "WatchCardCompactVideo";
var WatchCardCompactVideo_default = WatchCardCompactVideo;
// dist/src/parser/classes/WatchCardHeroVideo.js
var WatchCardHeroVideo = class extends YTNode {
constructor(data2) {
super();
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.call_to_action_button = parser_exports.parseItem(data2.callToActionButton);
this.hero_image = parser_exports.parseItem(data2.heroImage);
this.label = data2.lengthText?.accessibility.accessibilityData.label || "";
}
};
__name(WatchCardHeroVideo, "WatchCardHeroVideo");
WatchCardHeroVideo.type = "WatchCardHeroVideo";
var WatchCardHeroVideo_default = WatchCardHeroVideo;
// dist/src/parser/classes/WatchCardRichHeader.js
var WatchCardRichHeader = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.title_endpoint = new NavigationEndpoint_default(data2.titleNavigationEndpoint);
this.subtitle = new Text(data2.subtitle);
this.author = new Author(data2, data2.titleBadge ? [data2.titleBadge] : null, data2.avatar);
this.author.name = this.title.toString();
this.style = data2.style;
}
};
__name(WatchCardRichHeader, "WatchCardRichHeader");
WatchCardRichHeader.type = "WatchCardRichHeader";
var WatchCardRichHeader_default = WatchCardRichHeader;
// dist/src/parser/classes/WatchCardSectionSequence.js
var WatchCardSectionSequence = class extends YTNode {
constructor(data2) {
super();
this.lists = parser_exports.parseArray(data2.lists);
}
};
__name(WatchCardSectionSequence, "WatchCardSectionSequence");
WatchCardSectionSequence.type = "WatchCardSectionSequence";
var WatchCardSectionSequence_default = WatchCardSectionSequence;
// dist/src/parser/classes/WatchNextTabbedResults.js
var WatchNextTabbedResults = class extends TwoColumnBrowseResults_default {
constructor(data2) {
super(data2);
}
};
__name(WatchNextTabbedResults, "WatchNextTabbedResults");
WatchNextTabbedResults.type = "WatchNextTabbedResults";
var WatchNextTabbedResults_default = WatchNextTabbedResults;
// dist/src/parser/classes/ytkids/AnchoredSection.js
var AnchoredSection = class extends YTNode {
constructor(data2) {
super();
this.title = data2.title;
this.content = parser_exports.parseItem(data2.content, SectionList_default);
this.endpoint = new NavigationEndpoint_default(data2.navigationEndpoint);
this.category_assets = {
asset_key: data2.categoryAssets?.assetKey,
background_color: data2.categoryAssets?.backgroundColor
};
this.category_type = data2.categoryType;
}
};
__name(AnchoredSection, "AnchoredSection");
AnchoredSection.type = "AnchoredSection";
var AnchoredSection_default = AnchoredSection;
// dist/src/parser/classes/ytkids/KidsBlocklistPickerItem.js
var _KidsBlocklistPickerItem_actions;
var KidsBlocklistPickerItem = class extends YTNode {
constructor(data2) {
super();
_KidsBlocklistPickerItem_actions.set(this, void 0);
this.child_display_name = new Text(data2.childDisplayName);
this.child_account_description = new Text(data2.childAccountDescription);
this.avatar = Thumbnail.fromResponse(data2.avatar);
this.block_button = parser_exports.parseItem(data2.blockButton, [ToggleButton_default]);
this.blocked_entity_key = data2.blockedEntityKey;
}
async blockChannel() {
if (!__classPrivateFieldGet(this, _KidsBlocklistPickerItem_actions, "f"))
throw new InnertubeError("An active caller must be provide to perform this operation.");
const button = this.block_button;
if (!button)
throw new InnertubeError("Block button was not found.", { child_display_name: this.child_display_name });
if (button.is_toggled)
throw new InnertubeError("This channel is already blocked.", { child_display_name: this.child_display_name });
const response = await button.endpoint.call(__classPrivateFieldGet(this, _KidsBlocklistPickerItem_actions, "f"), { parse: false });
return response;
}
setActions(actions) {
__classPrivateFieldSet(this, _KidsBlocklistPickerItem_actions, actions, "f");
}
};
__name(KidsBlocklistPickerItem, "KidsBlocklistPickerItem");
_KidsBlocklistPickerItem_actions = /* @__PURE__ */ new WeakMap();
KidsBlocklistPickerItem.type = "KidsBlocklistPickerItem";
var KidsBlocklistPickerItem_default = KidsBlocklistPickerItem;
// dist/src/parser/classes/ytkids/KidsBlocklistPicker.js
var KidsBlocklistPicker = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.child_rows = parser_exports.parse(data2.childRows, true, [KidsBlocklistPickerItem_default]);
this.done_button = parser_exports.parseItem(data2.doneButton, [Button_default]);
this.successful_toast_action_message = new Text(data2.successfulToastActionMessage);
}
};
__name(KidsBlocklistPicker, "KidsBlocklistPicker");
KidsBlocklistPicker.type = "KidsBlocklistPicker";
var KidsBlocklistPicker_default = KidsBlocklistPicker;
// dist/src/parser/classes/ytkids/KidsCategoryTab.js
var KidsCategoryTab = class extends YTNode {
constructor(data2) {
super();
this.title = new Text(data2.title);
this.category_assets = {
asset_key: data2.categoryAssets?.assetKey,
background_color: data2.categoryAssets?.backgroundColor
};
this.category_type = data2.categoryType;
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
}
};
__name(KidsCategoryTab, "KidsCategoryTab");
KidsCategoryTab.type = "KidsCategoryTab";
var KidsCategoryTab_default = KidsCategoryTab;
// dist/src/parser/classes/ytkids/KidsCategoriesHeader.js
var KidsCategoriesHeader = class extends YTNode {
constructor(data2) {
super();
this.category_tabs = parser_exports.parseArray(data2.categoryTabs, KidsCategoryTab_default);
this.privacy_button = parser_exports.parseItem(data2.privacyButtonRenderer, Button_default);
}
};
__name(KidsCategoriesHeader, "KidsCategoriesHeader");
KidsCategoriesHeader.type = "kidsCategoriesHeader";
var KidsCategoriesHeader_default = KidsCategoriesHeader;
// dist/src/parser/classes/ytkids/KidsHomeScreen.js
var KidsHomeScreen = class extends YTNode {
constructor(data2) {
super();
this.anchors = parser_exports.parseArray(data2.anchors, AnchoredSection_default);
}
};
__name(KidsHomeScreen, "KidsHomeScreen");
KidsHomeScreen.type = "kidsHomeScreen";
var KidsHomeScreen_default = KidsHomeScreen;
// dist/src/parser/generator.js
var generator_exports = {};
__export(generator_exports, {
camelToSnake: () => camelToSnake,
createRuntimeClass: () => createRuntimeClass,
generateRuntimeClass: () => generateRuntimeClass,
generateTypescriptClass: () => generateTypescriptClass,
inferType: () => inferType,
introspect: () => introspect,
isArrayType: () => isArrayType,
isIgnoredKey: () => isIgnoredKey,
isMiscType: () => isMiscType,
isRenderer: () => isRenderer,
isRendererList: () => isRendererList,
mergeKeyInfo: () => mergeKeyInfo,
parse: () => parse2,
toParser: () => toParser,
toTypeDeclaration: () => toTypeDeclaration
});
var IGNORED_KEYS = /* @__PURE__ */ new Set([
"trackingParams",
"accessibility",
"accessibilityData"
]);
var RENDERER_EXAMPLES = {};
function camelToSnake(str) {
return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
}
__name(camelToSnake, "camelToSnake");
function inferType(key, value) {
let return_value = false;
if (typeof value === "object" && value != null) {
if (return_value = isRenderer(value)) {
RENDERER_EXAMPLES[return_value] = Reflect.get(value, Reflect.ownKeys(value)[0]);
return {
type: "renderer",
renderers: [return_value],
optional: false
};
}
if (return_value = isRendererList(value)) {
for (const [key2, value2] of Object.entries(return_value)) {
RENDERER_EXAMPLES[key2] = value2;
}
return {
type: "array",
array_type: "renderer",
renderers: Object.keys(return_value),
optional: false
};
}
if (return_value = isMiscType(key, value)) {
return return_value;
}
if (return_value = isArrayType(value)) {
return return_value;
}
}
const primitive_type = typeof value;
if (primitive_type === "object")
return {
type: "object",
keys: Object.entries(value).map(([key2, value2]) => [key2, inferType(key2, value2)]),
optional: false
};
return {
type: "primitive",
typeof: [primitive_type],
optional: false
};
}
__name(inferType, "inferType");
function isRendererList(value) {
const arr = Array.isArray(value);
if (arr && value.length === 0)
return false;
const is_list = arr && value.every((item) => isRenderer(item));
return is_list ? Object.fromEntries(value.map((item) => {
const key = Reflect.ownKeys(item)[0].toString();
return [sanitizeClassName(key), item[key]];
})) : false;
}
__name(isRendererList, "isRendererList");
function isMiscType(key, value) {
if (typeof value === "object" && value !== null) {
if (key.endsWith("Endpoint") || key.endsWith("Command") || key === "endpoint") {
return {
type: "misc",
endpoint: new NavigationEndpoint_default(value),
optional: false,
misc_type: "NavigationEndpoint"
};
}
if (Reflect.has(value, "simpleText") || Reflect.has(value, "runs")) {
const textNode = new Text(value);
return {
type: "misc",
misc_type: "Text",
optional: false,
endpoint: textNode.endpoint,
text: textNode.toString()
};
}
if (Reflect.has(value, "thumbnails") && Array.isArray(Reflect.get(value, "thumbnails"))) {
return {
type: "misc",
misc_type: "Thumbnail",
optional: false
};
}
}
return false;
}
__name(isMiscType, "isMiscType");
function isRenderer(value) {
const is_object = typeof value === "object";
if (!is_object)
return false;
const keys = Reflect.ownKeys(value);
if (keys.length === 1) {
const first_key = keys[0].toString();
if (first_key.endsWith("Renderer") || first_key.endsWith("Model")) {
return sanitizeClassName(first_key);
}
}
return false;
}
__name(isRenderer, "isRenderer");
function isArrayType(value) {
if (!Array.isArray(value))
return false;
if (value.length === 0)
return {
type: "array",
array_type: "primitive",
items: {
type: "primitive",
typeof: ["never"],
optional: false
},
optional: false
};
const array_entry_types = value.map((item) => typeof item);
const all_same_type = array_entry_types.every((type2) => type2 === array_entry_types[0]);
if (!all_same_type)
return {
type: "array",
array_type: "primitive",
items: {
type: "primitive",
typeof: ["unknown"],
optional: false
},
optional: false
};
const type = array_entry_types[0];
if (type !== "object")
return {
type: "array",
array_type: "primitive",
items: {
type: "primitive",
typeof: [type],
optional: false
},
optional: false
};
let key_type = [];
for (let i = 0; i < value.length; i++) {
const current_keys = Object.entries(value[i]).map(([key, value2]) => [key, inferType(key, value2)]);
if (i === 0) {
key_type = current_keys;
continue;
}
key_type = mergeKeyInfo(key_type, current_keys).resolved_key_info;
}
return {
type: "array",
array_type: "object",
items: {
type: "object",
keys: key_type,
optional: false
},
optional: false
};
}
__name(isArrayType, "isArrayType");
function introspectKeysFirstPass(classdata) {
if (typeof classdata !== "object" || classdata === null) {
throw new InnertubeError("Generator: Cannot introspect non-object", {
classdata
});
}
const keys = Reflect.ownKeys(classdata).filter((key) => !isIgnoredKey(key)).filter((key) => typeof key === "string");
return keys.map((key) => {
const value = Reflect.get(classdata, key);
const inferred_type = inferType(key, value);
return [key, inferred_type];
});
}
__name(introspectKeysFirstPass, "introspectKeysFirstPass");
function introspectKeysSecondPass(key_info) {
const channel_nav = key_info.filter(([, value]) => {
if (value.type !== "misc")
return false;
if (!(value.misc_type === "NavigationEndpoint" || value.misc_type === "Text"))
return false;
return value.endpoint?.metadata.page_type === "WEB_PAGE_TYPE_CHANNEL";
});
const most_probable_match = channel_nav.sort(([, a], [, b]) => {
if (a.type !== "misc" || b.type !== "misc")
return 0;
if (a.misc_type !== "Text" || b.misc_type !== "Text")
return 0;
return b.text.length - a.text.length;
});
const excluded_keys = /* @__PURE__ */ new Set();
const canonical_channel_nave = most_probable_match[0];
let author;
if (canonical_channel_nave) {
excluded_keys.add(canonical_channel_nave[0]);
const keys = key_info.map(([key]) => key);
const badges = keys.filter((key) => key.endsWith("Badges") || key === "badges");
const likely_badges = badges.filter((key) => key.startsWith("owner") || key.startsWith("author"));
const canonical_badges = likely_badges[0] ?? badges[0];
const badge_key_info = key_info.find(([key]) => key === canonical_badges);
const is_badges = badge_key_info ? badge_key_info[1].type === "array" && badge_key_info[1].array_type === "renderer" && Reflect.has(badge_key_info[1].renderers, "MetadataBadge") : false;
if (is_badges && canonical_badges)
excluded_keys.add(canonical_badges);
author = {
type: "misc",
misc_type: "Author",
optional: false,
params: [
canonical_channel_nave[0],
is_badges ? canonical_badges : void 0
]
};
}
if (author) {
key_info.push(["author", author]);
}
return key_info.filter(([key]) => !excluded_keys.has(key));
}
__name(introspectKeysSecondPass, "introspectKeysSecondPass");
function introspect2(classdata) {
const key_info = introspectKeysFirstPass(classdata);
return introspectKeysSecondPass(key_info);
}
__name(introspect2, "introspect2");
function introspect(classdata) {
const key_info = introspect2(classdata);
const dependencies = /* @__PURE__ */ new Map();
for (const [, value] of key_info) {
if (value.type === "renderer" || value.type === "array" && value.array_type === "renderer")
for (const renderer of value.renderers) {
const example = RENDERER_EXAMPLES[renderer];
if (example)
dependencies.set(renderer, example);
}
}
const unimplemented_dependencies = Array.from(dependencies).filter(([classname]) => !hasParser(classname));
return {
key_info,
unimplemented_dependencies
};
}
__name(introspect, "introspect");
function isIgnoredKey(key) {
return typeof key === "string" && IGNORED_KEYS.has(key);
}
__name(isIgnoredKey, "isIgnoredKey");
function createRuntimeClass(classname, key_info, logger) {
var _a2, _node_key_info;
logger({
error_type: "class_not_found",
classname,
key_info
});
const node = (_a2 = /* @__PURE__ */ __name(class extends YTNode {
static set key_info(key_info2) {
__classPrivateFieldSet(this, _a2, new Map(key_info2), "f", _node_key_info);
}
static get key_info() {
return [...__classPrivateFieldGet(this, _a2, "f", _node_key_info).entries()];
}
constructor(data2) {
super();
const { key_info: key_info2, unimplemented_dependencies } = introspect(data2);
const { resolved_key_info, changed_keys } = mergeKeyInfo(node.key_info, key_info2);
const did_change = changed_keys.length > 0;
if (did_change) {
node.key_info = resolved_key_info;
logger({
error_type: "class_changed",
classname,
key_info: node.key_info,
changed_keys
});
}
for (const [name, data3] of unimplemented_dependencies)
generateRuntimeClass(name, data3, logger);
for (const [key, value] of key_info2) {
let snake_key = camelToSnake(key);
if (value.type === "misc" && value.misc_type === "NavigationEndpoint")
snake_key = "endpoint";
Reflect.set(this, snake_key, parse2(key, value, data2));
}
}
}, "_a"), __setFunctionName(_a2, "node"), _a2.type = classname, _node_key_info = { value: /* @__PURE__ */ new Map() }, _a2);
node.key_info = key_info;
Object.defineProperty(node, "name", { value: classname, writable: false });
return node;
}
__name(createRuntimeClass, "createRuntimeClass");
function generateRuntimeClass(classname, classdata, logger) {
const { key_info, unimplemented_dependencies } = introspect(classdata);
const JITNode = createRuntimeClass(classname, key_info, logger);
addRuntimeParser(classname, JITNode);
for (const [name, data2] of unimplemented_dependencies)
generateRuntimeClass(name, data2, logger);
return JITNode;
}
__name(generateRuntimeClass, "generateRuntimeClass");
function generateTypescriptClass(classname, key_info) {
const props = [];
const constructor_lines = [
"super();"
];
for (const [key, value] of key_info) {
let snake_key = camelToSnake(key);
if (value.type === "misc" && value.misc_type === "NavigationEndpoint")
snake_key = "endpoint";
props.push(`${snake_key}${value.optional ? "?" : ""}: ${toTypeDeclaration(value)};`);
constructor_lines.push(`this.${snake_key} = ${toParser(key, value)};`);
}
return `class ${classname} extends YTNode {
static type = '${classname}';
${props.join("\n ")}
constructor(data: RawNode) {
${constructor_lines.join("\n ")}
}
}
`;
}
__name(generateTypescriptClass, "generateTypescriptClass");
function toTypeDeclarationObject(indentation, keys) {
return `{
${keys.map(([key, value]) => `${" ".repeat((indentation + 2) * 2)}${camelToSnake(key)}${value.optional ? "?" : ""}: ${toTypeDeclaration(value, indentation + 1)}`).join(",\n")}
${" ".repeat((indentation + 1) * 2)}}`;
}
__name(toTypeDeclarationObject, "toTypeDeclarationObject");
function toTypeDeclaration(inference_type, indentation = 0) {
switch (inference_type.type) {
case "renderer": {
return `${inference_type.renderers.map((type) => `YTNodes.${type}`).join(" | ")} | null`;
}
case "array": {
switch (inference_type.array_type) {
case "renderer":
return `ObservedArray<${inference_type.renderers.map((type) => `YTNodes.${type}`).join(" | ")}> | null`;
case "primitive": {
const items_list = inference_type.items.typeof;
if (inference_type.items.optional && !items_list.includes("undefined"))
items_list.push("undefined");
const items = items_list.length === 1 ? `${items_list[0]}` : `(${items_list.join(" | ")})`;
return `${items}[]`;
}
case "object":
return `${toTypeDeclarationObject(indentation, inference_type.items.keys)}[]`;
default:
throw new Error("Unreachable code reached! Switch missing case!");
}
}
case "object": {
return toTypeDeclarationObject(indentation, inference_type.keys);
}
case "misc": {
switch (inference_type.misc_type) {
case "Thumbnail":
return "Thumbnail[]";
default:
return inference_type.misc_type;
}
}
case "primitive": {
return inference_type.typeof.join(" | ");
}
}
}
__name(toTypeDeclaration, "toTypeDeclaration");
function toParserObject(indentation, keys, key_path, key) {
const new_keypath = [...key_path, key];
return `{
${keys.map(([key2, value]) => `${" ".repeat((indentation + 2) * 2)}${camelToSnake(key2)}: ${toParser(key2, value, new_keypath, indentation + 1)}`).join(",\n")}
${" ".repeat((indentation + 1) * 2)}}`;
}
__name(toParserObject, "toParserObject");
function toParser(key, inference_type, key_path = ["data"], indentation = 1) {
let parser = "undefined";
switch (inference_type.type) {
case "renderer":
{
parser = `Parser.parseItem(${key_path.join(".")}.${key}, ${toParserValidTypes(inference_type.renderers)})`;
}
break;
case "array":
{
switch (inference_type.array_type) {
case "renderer":
parser = `Parser.parse(${key_path.join(".")}.${key}, true, ${toParserValidTypes(inference_type.renderers)})`;
break;
case "object":
parser = `${key_path.join(".")}.${key}.map((item: any) => (${toParserObject(indentation, inference_type.items.keys, [], "item")}))`;
break;
case "primitive":
parser = `${key_path.join(".")}.${key}`;
break;
default:
throw new Error("Unreachable code reached! Switch missing case!");
}
}
break;
case "object":
{
parser = toParserObject(indentation, inference_type.keys, key_path, key);
}
break;
case "misc":
switch (inference_type.misc_type) {
case "Thumbnail":
parser = `Thumbnail.fromResponse(${key_path.join(".")}.${key})`;
break;
case "Author": {
const author_parser = `new Author(${key_path.join(".")}.${inference_type.params[0]}, ${inference_type.params[1] ? `${key_path.join(".")}.${inference_type.params[1]}` : "undefined"})`;
if (inference_type.optional)
return `Reflect.has(${key_path.join(".")}, '${inference_type.params[0]}') ? ${author_parser} : undefined`;
return author_parser;
}
default:
parser = `new ${inference_type.misc_type}(${key_path.join(".")}.${key})`;
break;
}
if (parser === "undefined")
throw new Error("Unreachable code reached! Switch missing case!");
break;
case "primitive":
parser = `${key_path.join(".")}.${key}`;
break;
}
if (inference_type.optional)
return `Reflect.has(${key_path.join(".")}, '${key}') ? ${parser} : undefined`;
return parser;
}
__name(toParser, "toParser");
function toParserValidTypes(types2) {
if (types2.length === 1) {
return `YTNodes.${types2[0]}`;
}
return `[ ${types2.map((type) => `YTNodes.${type}`).join(", ")} ]`;
}
__name(toParserValidTypes, "toParserValidTypes");
function accessDataFromKeyPath(root, key_path) {
let data2 = root;
for (const key of key_path)
data2 = data2[key];
return data2;
}
__name(accessDataFromKeyPath, "accessDataFromKeyPath");
function hasDataFromKeyPath(root, key_path) {
let data2 = root;
for (const key of key_path)
if (!Reflect.has(data2, key))
return false;
else
data2 = data2[key];
return true;
}
__name(hasDataFromKeyPath, "hasDataFromKeyPath");
function parseObject(key, data2, key_path, keys, should_optional) {
const obj = {};
const new_key_path = [...key_path, key];
for (const [key2, value] of keys) {
obj[key2] = should_optional ? parse2(key2, value, data2, new_key_path) : void 0;
}
return obj;
}
__name(parseObject, "parseObject");
function parse2(key, inference_type, data2, key_path = ["data"]) {
const should_optional = !inference_type.optional || hasDataFromKeyPath({ data: data2 }, [...key_path, key]);
switch (inference_type.type) {
case "renderer": {
return should_optional ? parseItem(accessDataFromKeyPath({ data: data2 }, [...key_path, key]), inference_type.renderers.map((type) => getParserByName(type))) : void 0;
}
case "array": {
switch (inference_type.array_type) {
case "renderer":
return should_optional ? parse(accessDataFromKeyPath({ data: data2 }, [...key_path, key]), true, inference_type.renderers.map((type) => getParserByName(type))) : void 0;
case "object":
return should_optional ? accessDataFromKeyPath({ data: data2 }, [...key_path, key]).map((_, idx) => {
return parseObject(`${idx}`, data2, [...key_path, key], inference_type.items.keys, should_optional);
}) : void 0;
case "primitive":
return should_optional ? accessDataFromKeyPath({ data: data2 }, [...key_path, key]) : void 0;
default:
throw new Error("Unreachable code reached! Switch missing case!");
}
}
case "object": {
return parseObject(key, data2, key_path, inference_type.keys, should_optional);
}
case "misc":
switch (inference_type.misc_type) {
case "NavigationEndpoint":
return should_optional ? new NavigationEndpoint_default(accessDataFromKeyPath({ data: data2 }, [...key_path, key])) : void 0;
case "Text":
return should_optional ? new Text(accessDataFromKeyPath({ data: data2 }, [...key_path, key])) : void 0;
case "Thumbnail":
return should_optional ? Thumbnail.fromResponse(accessDataFromKeyPath({ data: data2 }, [...key_path, key])) : void 0;
case "Author": {
const author_should_optional = !inference_type.optional || hasDataFromKeyPath({ data: data2 }, [...key_path, inference_type.params[0]]);
return author_should_optional ? new Author(accessDataFromKeyPath({ data: data2 }, [...key_path, inference_type.params[0]]), inference_type.params[1] ? accessDataFromKeyPath({ data: data2 }, [...key_path, inference_type.params[1]]) : void 0) : void 0;
}
default:
throw new Error("Unreachable code reached! Switch missing case!");
}
case "primitive":
return accessDataFromKeyPath({ data: data2 }, [...key_path, key]);
}
}
__name(parse2, "parse");
function mergeKeyInfo(key_info, new_key_info) {
const changed_keys = /* @__PURE__ */ new Map();
const current_keys = new Set(key_info.map(([key]) => key));
const new_keys = new Set(new_key_info.map(([key]) => key));
const added_keys = new_key_info.filter(([key]) => !current_keys.has(key));
const removed_keys = key_info.filter(([key]) => !new_keys.has(key));
const common_keys = key_info.filter(([key]) => new_keys.has(key));
const new_key_map = new Map(new_key_info);
for (const [key, type] of common_keys) {
const new_type = new_key_map.get(key);
if (!new_type)
continue;
if (type.type !== new_type.type) {
changed_keys.set(key, {
type: "primitive",
typeof: ["unknown"],
optional: true
});
continue;
}
switch (type.type) {
case "object":
{
if (new_type.type !== "object")
continue;
const { resolved_key_info: resolved_key_info2 } = mergeKeyInfo(type.keys, new_type.keys);
const resolved_key = {
type: "object",
keys: resolved_key_info2,
optional: type.optional || new_type.optional
};
const did_change = JSON.stringify(resolved_key) !== JSON.stringify(type);
if (did_change)
changed_keys.set(key, resolved_key);
}
break;
case "renderer":
{
if (new_type.type !== "renderer")
continue;
const union_map = {
...type.renderers,
...new_type.renderers
};
const either_optional = type.optional || new_type.optional;
const resolved_key = {
type: "renderer",
renderers: union_map,
optional: either_optional
};
const did_change = JSON.stringify({
...resolved_key,
renderers: Object.keys(resolved_key.renderers)
}) !== JSON.stringify({
...type,
renderers: Object.keys(type.renderers)
});
if (did_change)
changed_keys.set(key, resolved_key);
}
break;
case "array": {
if (new_type.type !== "array")
continue;
switch (type.array_type) {
case "renderer":
{
if (new_type.array_type !== "renderer") {
changed_keys.set(key, {
type: "array",
array_type: "primitive",
items: {
type: "primitive",
typeof: ["unknown"],
optional: true
},
optional: true
});
continue;
}
const union_map = {
...type.renderers,
...new_type.renderers
};
const either_optional = type.optional || new_type.optional;
const resolved_key = {
type: "array",
array_type: "renderer",
renderers: union_map,
optional: either_optional
};
const did_change = JSON.stringify({
...resolved_key,
renderers: Object.keys(resolved_key.renderers)
}) !== JSON.stringify({
...type,
renderers: Object.keys(type.renderers)
});
if (did_change)
changed_keys.set(key, resolved_key);
}
break;
case "object":
{
if (new_type.array_type === "primitive" && new_type.items.typeof.length == 1 && new_type.items.typeof[0] === "never") {
continue;
}
if (new_type.array_type !== "object") {
changed_keys.set(key, {
type: "array",
array_type: "primitive",
items: {
type: "primitive",
typeof: ["unknown"],
optional: true
},
optional: true
});
continue;
}
const { resolved_key_info: resolved_key_info2 } = mergeKeyInfo(type.items.keys, new_type.items.keys);
const resolved_key = {
type: "array",
array_type: "object",
items: {
type: "object",
keys: resolved_key_info2,
optional: type.items.optional || new_type.items.optional
},
optional: type.optional || new_type.optional
};
const did_change = JSON.stringify(resolved_key) !== JSON.stringify(type);
if (did_change)
changed_keys.set(key, resolved_key);
}
break;
case "primitive":
{
if (type.items.typeof.includes("never") && new_type.array_type === "object") {
changed_keys.set(key, new_type);
continue;
}
if (new_type.array_type !== "primitive") {
changed_keys.set(key, {
type: "array",
array_type: "primitive",
items: {
type: "primitive",
typeof: ["unknown"],
optional: true
},
optional: true
});
continue;
}
const key_types = /* @__PURE__ */ new Set([...new_type.items.typeof, ...type.items.typeof]);
if (key_types.size > 1 && key_types.has("never"))
key_types.delete("never");
const resolved_key = {
type: "array",
array_type: "primitive",
items: {
type: "primitive",
typeof: Array.from(key_types),
optional: type.items.optional || new_type.items.optional
},
optional: type.optional || new_type.optional
};
const did_change = JSON.stringify(resolved_key) !== JSON.stringify(type);
if (did_change)
changed_keys.set(key, resolved_key);
}
break;
default:
throw new Error("Unreachable code reached! Switch missing case!");
}
break;
}
case "misc":
{
if (new_type.type !== "misc")
continue;
if (type.misc_type !== new_type.misc_type) {
changed_keys.set(key, {
type: "primitive",
typeof: ["unknown"],
optional: true
});
}
switch (type.misc_type) {
case "Author":
{
if (new_type.misc_type !== "Author")
break;
const had_optional_param = type.params[1] || new_type.params[1];
const either_optional = type.optional || new_type.optional;
const resolved_key = {
type: "misc",
misc_type: "Author",
optional: either_optional,
params: [new_type.params[0], had_optional_param]
};
const did_change = JSON.stringify(resolved_key) !== JSON.stringify(type);
if (did_change)
changed_keys.set(key, resolved_key);
}
break;
}
}
break;
case "primitive":
{
if (new_type.type !== "primitive")
continue;
const resolved_key = {
type: "primitive",
typeof: Array.from(/* @__PURE__ */ new Set([...new_type.typeof, ...type.typeof])),
optional: type.optional || new_type.optional
};
const did_change = JSON.stringify(resolved_key) !== JSON.stringify(type);
if (did_change)
changed_keys.set(key, resolved_key);
}
break;
}
}
for (const [key, type] of added_keys) {
changed_keys.set(key, {
...type,
optional: true
});
}
for (const [key, type] of removed_keys) {
changed_keys.set(key, {
...type,
optional: true
});
}
const unchanged_keys = key_info.filter(([key]) => !changed_keys.has(key));
const resolved_key_info_map = new Map([...unchanged_keys, ...changed_keys]);
const resolved_key_info = [...resolved_key_info_map.entries()];
return {
resolved_key_info,
changed_keys: [...changed_keys.entries()]
};
}
__name(mergeKeyInfo, "mergeKeyInfo");
// dist/src/parser/continuations.js
var ItemSectionContinuation = class extends YTNode {
constructor(data2) {
super();
this.contents = parseArray(data2.contents);
if (Array.isArray(data2.continuations)) {
this.continuation = data2.continuations?.at(0)?.nextContinuationData?.continuation;
}
}
};
__name(ItemSectionContinuation, "ItemSectionContinuation");
ItemSectionContinuation.type = "itemSectionContinuation";
var NavigateAction = class extends YTNode {
constructor(data2) {
super();
this.endpoint = new NavigationEndpoint_default(data2.endpoint);
}
};
__name(NavigateAction, "NavigateAction");
NavigateAction.type = "navigateAction";
var ShowMiniplayerCommand = class extends YTNode {
constructor(data2) {
super();
this.miniplayer_command = new NavigationEndpoint_default(data2.miniplayerCommand);
this.show_premium_branding = data2.showPremiumBranding;
}
};
__name(ShowMiniplayerCommand, "ShowMiniplayerCommand");
ShowMiniplayerCommand.type = "showMiniplayerCommand";
var ReloadContinuationItemsCommand = class extends YTNode {
constructor(data2) {
super();
this.target_id = data2.targetId;
this.contents = parse(data2.continuationItems, true);
this.slot = data2?.slot;
}
};
__name(ReloadContinuationItemsCommand, "ReloadContinuationItemsCommand");
ReloadContinuationItemsCommand.type = "reloadContinuationItemsCommand";
var SectionListContinuation = class extends YTNode {
constructor(data2) {
super();
this.contents = parse(data2.contents, true);
this.continuation = data2.continuations?.[0]?.nextContinuationData?.continuation || data2.continuations?.[0]?.reloadContinuationData?.continuation || null;
}
};
__name(SectionListContinuation, "SectionListContinuation");
SectionListContinuation.type = "sectionListContinuation";
var MusicPlaylistShelfContinuation = class extends YTNode {
constructor(data2) {
super();
this.contents = parse(data2.contents, true);
this.continuation = data2.continuations?.[0].nextContinuationData.continuation || null;
}
};
__name(MusicPlaylistShelfContinuation, "MusicPlaylistShelfContinuation");
MusicPlaylistShelfContinuation.type = "musicPlaylistShelfContinuation";
var MusicShelfContinuation = class extends YTNode {
constructor(data2) {
super();
this.contents = parseArray(data2.contents);
this.continuation = data2.continuations?.[0].nextContinuationData?.continuation || data2.continuations?.[0].reloadContinuationData?.continuation || null;
}
};
__name(MusicShelfContinuation, "MusicShelfContinuation");
MusicShelfContinuation.type = "musicShelfContinuation";
var GridContinuation = class extends YTNode {
constructor(data2) {
super();
this.items = parse(data2.items, true);
this.continuation = data2.continuations?.[0].nextContinuationData.continuation || null;
}
get contents() {
return this.items;
}
};
__name(GridContinuation, "GridContinuation");
GridContinuation.type = "gridContinuation";
var PlaylistPanelContinuation = class extends YTNode {
constructor(data2) {
super();
this.contents = parseArray(data2.contents);
this.continuation = data2.continuations?.[0]?.nextContinuationData?.continuation || data2.continuations?.[0]?.nextRadioContinuationData?.continuation || null;
}
};
__name(PlaylistPanelContinuation, "PlaylistPanelContinuation");
PlaylistPanelContinuation.type = "playlistPanelContinuation";
var Continuation = class extends YTNode {
constructor(data2) {
super();
this.continuation_type = data2.type;
this.timeout_ms = data2.continuation?.timeoutMs;
this.time_until_last_message_ms = data2.continuation?.timeUntilLastMessageMsec;
this.token = data2.continuation?.continuation;
}
};
__name(Continuation, "Continuation");
Continuation.type = "continuation";
var LiveChatContinuation = class extends YTNode {
constructor(data2) {
super();
this.actions = parse(data2.actions?.map((action) => {
delete action.clickTrackingParams;
return action;
}), true) || observe([]);
this.action_panel = parseItem(data2.actionPanel);
this.item_list = parseItem(data2.itemList, LiveChatItemList_default);
this.header = parseItem(data2.header, LiveChatHeader_default);
this.participants_list = parseItem(data2.participantsList, LiveChatParticipantsList_default);
this.popout_message = parseItem(data2.popoutMessage, Message_default);
this.emojis = data2.emojis?.map((emoji) => ({
emoji_id: emoji.emojiId,
shortcuts: emoji.shortcuts,
search_terms: emoji.searchTerms,
image: Thumbnail.fromResponse(emoji.image),
is_custom_emoji: emoji.isCustomEmoji
})) || [];
let continuation, type;
if (data2.continuations?.[0].timedContinuationData) {
type = "timed";
continuation = data2.continuations?.[0].timedContinuationData;
} else if (data2.continuations?.[0].invalidationContinuationData) {
type = "invalidation";
continuation = data2.continuations?.[0].invalidationContinuationData;
} else if (data2.continuations?.[0].liveChatReplayContinuationData) {
type = "replay";
continuation = data2.continuations?.[0].liveChatReplayContinuationData;
}
this.continuation = new Continuation({ continuation, type });
this.viewer_name = data2.viewerName;
}
};
__name(LiveChatContinuation, "LiveChatContinuation");
LiveChatContinuation.type = "liveChatContinuation";
var ContinuationCommand2 = class extends YTNode {
constructor(data2) {
super();
this.request = data2.request;
this.token = data2.token;
}
};
__name(ContinuationCommand2, "ContinuationCommand");
ContinuationCommand2.type = "ContinuationCommand";
// dist/src/parser/classes/misc/Format.js
var _Format_this_response_nsig_cache;
var Format = class {
constructor(data2, this_response_nsig_cache) {
_Format_this_response_nsig_cache.set(this, void 0);
if (this_response_nsig_cache)
__classPrivateFieldSet(this, _Format_this_response_nsig_cache, this_response_nsig_cache, "f");
this.itag = data2.itag;
this.mime_type = data2.mimeType;
this.is_type_otf = data2.type === "FORMAT_STREAM_TYPE_OTF";
this.bitrate = data2.bitrate;
this.average_bitrate = data2.averageBitrate;
if (Reflect.has(data2, "width") && Reflect.has(data2, "height")) {
this.width = parseInt(data2.width);
this.height = parseInt(data2.height);
}
if (Reflect.has(data2, "projectionType"))
this.projection_type = data2.projectionType;
if (Reflect.has(data2, "stereoLayout"))
this.stereo_layout = data2.stereoLayout?.replace("STEREO_LAYOUT_", "");
if (Reflect.has(data2, "initRange"))
this.init_range = {
start: parseInt(data2.initRange.start),
end: parseInt(data2.initRange.end)
};
if (Reflect.has(data2, "indexRange"))
this.index_range = {
start: parseInt(data2.indexRange.start),
end: parseInt(data2.indexRange.end)
};
this.last_modified = new Date(Math.floor(parseInt(data2.lastModified) / 1e3));
this.last_modified_ms = data2.lastModified;
if (Reflect.has(data2, "contentLength"))
this.content_length = parseInt(data2.contentLength);
if (Reflect.has(data2, "quality"))
this.quality = data2.quality;
if (Reflect.has(data2, "qualityLabel"))
this.quality_label = data2.qualityLabel;
if (Reflect.has(data2, "fps"))
this.fps = data2.fps;
if (Reflect.has(data2, "url"))
this.url = data2.url;
if (Reflect.has(data2, "cipher"))
this.cipher = data2.cipher;
if (Reflect.has(data2, "signatureCipher"))
this.signature_cipher = data2.signatureCipher;
if (Reflect.has(data2, "audioQuality"))
this.audio_quality = data2.audioQuality;
this.approx_duration_ms = parseInt(data2.approxDurationMs);
if (Reflect.has(data2, "audioSampleRate"))
this.audio_sample_rate = parseInt(data2.audioSampleRate);
if (Reflect.has(data2, "audioChannels"))
this.audio_channels = data2.audioChannels;
if (Reflect.has(data2, "loudnessDb"))
this.loudness_db = data2.loudnessDb;
if (Reflect.has(data2, "spatialAudioType"))
this.spatial_audio_type = data2.spatialAudioType?.replace("SPATIAL_AUDIO_TYPE_", "");
if (Reflect.has(data2, "maxDvrDurationSec"))
this.max_dvr_duration_sec = data2.maxDvrDurationSec;
if (Reflect.has(data2, "targetDurationSec"))
this.target_duration_dec = data2.targetDurationSec;
this.has_audio = !!data2.audioBitrate || !!data2.audioQuality;
this.has_video = !!data2.qualityLabel;
this.has_text = !!data2.captionTrack;
if (Reflect.has(data2, "xtags"))
this.xtags = data2.xtags;
if (Reflect.has(data2, "fairPlayKeyUri"))
this.fair_play_key_uri = data2.fairPlayKeyUri;
if (Reflect.has(data2, "drmFamilies"))
this.drm_families = data2.drmFamilies;
if (Reflect.has(data2, "drmTrackType"))
this.drm_track_type = data2.drmTrackType;
if (Reflect.has(data2, "distinctParams"))
this.distinct_params = data2.distinctParams;
if (Reflect.has(data2, "trackAbsoluteLoudnessLkfs"))
this.track_absolute_loudness_lkfs = data2.trackAbsoluteLoudnessLkfs;
if (Reflect.has(data2, "highReplication"))
this.high_replication = data2.highReplication;
if (Reflect.has(data2, "colorInfo"))
this.color_info = {
primaries: data2.colorInfo.primaries?.replace("COLOR_PRIMARIES_", ""),
transfer_characteristics: data2.colorInfo.transferCharacteristics?.replace("COLOR_TRANSFER_CHARACTERISTICS_", ""),
matrix_coefficients: data2.colorInfo.matrixCoefficients?.replace("COLOR_MATRIX_COEFFICIENTS_", "")
};
if (Reflect.has(data2, "audioTrack"))
this.audio_track = {
audio_is_default: data2.audioTrack.audioIsDefault,
display_name: data2.audioTrack.displayName,
id: data2.audioTrack.id
};
if (Reflect.has(data2, "captionTrack"))
this.caption_track = {
display_name: data2.captionTrack.displayName,
vss_id: data2.captionTrack.vssId,
language_code: data2.captionTrack.languageCode,
kind: data2.captionTrack.kind,
id: data2.captionTrack.id
};
if (this.has_audio || this.has_text) {
const args = new URLSearchParams(this.cipher || this.signature_cipher);
const url_components = new URLSearchParams(args.get("url") || this.url);
const xtags = url_components.get("xtags")?.split(":");
this.language = xtags?.find((x) => x.startsWith("lang="))?.split("=")[1] || null;
if (this.has_audio) {
this.is_drc = !!data2.isDrc || !!xtags?.includes("drc=1");
const audio_content = xtags?.find((x) => x.startsWith("acont="))?.split("=")[1];
this.is_dubbed = audio_content === "dubbed";
this.is_descriptive = audio_content === "descriptive";
this.is_secondary = audio_content === "secondary";
this.is_auto_dubbed = audio_content === "dubbed-auto";
this.is_original = audio_content === "original" || !this.is_dubbed && !this.is_descriptive && !this.is_secondary && !this.is_auto_dubbed && !this.is_drc;
}
if (this.has_text && !this.language && this.caption_track) {
this.language = this.caption_track.language_code;
}
}
}
decipher(player) {
if (!player)
return this.url || "";
return player.decipher(this.url, this.signature_cipher, this.cipher, __classPrivateFieldGet(this, _Format_this_response_nsig_cache, "f"));
}
};
__name(Format, "Format");
_Format_this_response_nsig_cache = /* @__PURE__ */ new WeakMap();
var Format_default = Format;
// dist/src/parser/classes/misc/VideoDetails.js
var VideoDetails = class {
constructor(data2) {
this.id = data2.videoId;
this.channel_id = data2.channelId;
this.title = data2.title;
this.duration = parseInt(data2.lengthSeconds);
this.keywords = data2.keywords;
this.is_owner_viewing = !!data2.isOwnerViewing;
this.short_description = data2.shortDescription;
this.thumbnail = Thumbnail.fromResponse(data2.thumbnail);
this.allow_ratings = !!data2.allowRatings;
this.view_count = parseInt(data2.viewCount);
this.author = data2.author;
this.is_private = !!data2.isPrivate;
this.is_live = !!data2.isLive;
this.is_live_content = !!data2.isLiveContent;
this.is_live_dvr_enabled = !!data2.isLiveDvrEnabled;
this.is_low_latency_live_stream = !!data2.isLowLatencyLiveStream;
this.is_upcoming = !!data2.isUpcoming;
this.is_post_live_dvr = !!data2.isPostLiveDvr;
this.is_crawlable = !!data2.isCrawlable;
this.live_chunk_readahead = data2.liveChunkReadahead;
}
};
__name(VideoDetails, "VideoDetails");
// dist/src/parser/parser.js
var TAG2 = "Parser";
var IGNORED_LIST = /* @__PURE__ */ new Set([
"AdSlot",
"DisplayAd",
"SearchPyv",
"MealbarPromo",
"PrimetimePromo",
"PromotedSparklesWeb",
"CompactPromotedVideo",
"BrandVideoShelf",
"BrandVideoSingleton",
"StatementBanner",
"GuideSigninPromo",
"AdsEngagementPanelContent",
"MiniGameCardView"
]);
var RUNTIME_NODES = new Map(Object.entries(nodes_exports));
var DYNAMIC_NODES = /* @__PURE__ */ new Map();
var MEMO = null;
var ERROR_HANDLER = /* @__PURE__ */ __name(({ classname, ...context }) => {
switch (context.error_type) {
case "parse":
if (context.error instanceof Error) {
Log_exports.warn(TAG2, new InnertubeError(`Something went wrong at ${classname}!
This is a bug, please report it at ${Platform.shim.info.bugs_url}`, {
stack: context.error.stack,
classdata: JSON.stringify(context.classdata, null, 2)
}));
}
break;
case "typecheck":
Log_exports.warn(TAG2, new ParsingError(`Type mismatch, got ${classname} expected ${Array.isArray(context.expected) ? context.expected.join(" | ") : context.expected}.`, context.classdata));
break;
case "mutation_data_missing":
Log_exports.warn(TAG2, new InnertubeError(`Mutation data required for processing ${classname}, but none found.
This is a bug, please report it at ${Platform.shim.info.bugs_url}`));
break;
case "mutation_data_invalid":
Log_exports.warn(TAG2, new InnertubeError(`Mutation data missing or invalid for ${context.failed} out of ${context.total} MusicMultiSelectMenuItems. The titles of the failed items are: ${context.titles.join(", ")}.
This is a bug, please report it at ${Platform.shim.info.bugs_url}`));
break;
case "class_not_found":
Log_exports.warn(TAG2, new InnertubeError(`${classname} not found!
This is a bug, want to help us fix it? Follow the instructions at ${Platform.shim.info.repo_url}/blob/main/docs/updating-the-parser.md or report it at ${Platform.shim.info.bugs_url}!
Introspected and JIT generated this class in the meantime:
${generateTypescriptClass(classname, context.key_info)}`));
break;
case "class_changed":
Log_exports.warn(TAG2, `${classname} changed!
The following keys where altered: ${context.changed_keys.map(([key]) => camelToSnake(key)).join(", ")}
The class has changed to:
${generateTypescriptClass(classname, context.key_info)}`);
break;
default:
Log_exports.warn(TAG2, "Unreachable code reached at ParserErrorHandler");
break;
}
}, "ERROR_HANDLER");
function setParserErrorHandler(handler) {
ERROR_HANDLER = handler;
}
__name(setParserErrorHandler, "setParserErrorHandler");
function _clearMemo() {
MEMO = null;
}
__name(_clearMemo, "_clearMemo");
function _createMemo() {
MEMO = new Memo();
}
__name(_createMemo, "_createMemo");
function _addToMemo(classname, result) {
if (!MEMO)
return;
const list = MEMO.get(classname);
if (!list)
return MEMO.set(classname, [result]);
list.push(result);
}
__name(_addToMemo, "_addToMemo");
function _getMemo() {
if (!MEMO)
throw new Error("Parser#getMemo() called before Parser#createMemo()");
return MEMO;
}
__name(_getMemo, "_getMemo");
function shouldIgnore(classname) {
return IGNORED_LIST.has(classname);
}
__name(shouldIgnore, "shouldIgnore");
function sanitizeClassName(input) {
return (input.charAt(0).toUpperCase() + input.slice(1)).replace(/Renderer|Model/g, "").replace(/Radio/g, "Mix").trim();
}
__name(sanitizeClassName, "sanitizeClassName");
function getParserByName(classname) {
const ParserConstructor = RUNTIME_NODES.get(classname);
if (!ParserConstructor) {
const error2 = new Error(`Module not found: ${classname}`);
error2.code = "MODULE_NOT_FOUND";
throw error2;
}
return ParserConstructor;
}
__name(getParserByName, "getParserByName");
function hasParser(classname) {
return RUNTIME_NODES.has(classname);
}
__name(hasParser, "hasParser");
function addRuntimeParser(classname, ParserConstructor) {
RUNTIME_NODES.set(classname, ParserConstructor);
DYNAMIC_NODES.set(classname, ParserConstructor);
}
__name(addRuntimeParser, "addRuntimeParser");
function getDynamicParsers() {
return Object.fromEntries(DYNAMIC_NODES);
}
__name(getDynamicParsers, "getDynamicParsers");
function parseResponse(data2) {
const parsed_data = {};
_createMemo();
const contents = parse(data2.contents);
const contents_memo = _getMemo();
if (contents) {
parsed_data.contents = contents;
parsed_data.contents_memo = contents_memo;
}
_clearMemo();
_createMemo();
const on_response_received_actions = data2.onResponseReceivedActions ? parseRR(data2.onResponseReceivedActions) : null;
const on_response_received_actions_memo = _getMemo();
if (on_response_received_actions) {
parsed_data.on_response_received_actions = on_response_received_actions;
parsed_data.on_response_received_actions_memo = on_response_received_actions_memo;
}
_clearMemo();
_createMemo();
const on_response_received_endpoints = data2.onResponseReceivedEndpoints ? parseRR(data2.onResponseReceivedEndpoints) : null;
const on_response_received_endpoints_memo = _getMemo();
if (on_response_received_endpoints) {
parsed_data.on_response_received_endpoints = on_response_received_endpoints;
parsed_data.on_response_received_endpoints_memo = on_response_received_endpoints_memo;
}
_clearMemo();
_createMemo();
const on_response_received_commands = data2.onResponseReceivedCommands ? parseRR(data2.onResponseReceivedCommands) : null;
const on_response_received_commands_memo = _getMemo();
if (on_response_received_commands) {
parsed_data.on_response_received_commands = on_response_received_commands;
parsed_data.on_response_received_commands_memo = on_response_received_commands_memo;
}
_clearMemo();
_createMemo();
const continuation_contents = data2.continuationContents ? parseLC(data2.continuationContents) : null;
const continuation_contents_memo = _getMemo();
if (continuation_contents) {
parsed_data.continuation_contents = continuation_contents;
parsed_data.continuation_contents_memo = continuation_contents_memo;
}
_clearMemo();
_createMemo();
const actions = data2.actions ? parseActions(data2.actions) : null;
const actions_memo = _getMemo();
if (actions) {
parsed_data.actions = actions;
parsed_data.actions_memo = actions_memo;
}
_clearMemo();
_createMemo();
const live_chat_item_context_menu_supported_renderers = data2.liveChatItemContextMenuSupportedRenderers ? parseItem(data2.liveChatItemContextMenuSupportedRenderers) : null;
const live_chat_item_context_menu_supported_renderers_memo = _getMemo();
if (live_chat_item_context_menu_supported_renderers) {
parsed_data.live_chat_item_context_menu_supported_renderers = live_chat_item_context_menu_supported_renderers;
parsed_data.live_chat_item_context_menu_supported_renderers_memo = live_chat_item_context_menu_supported_renderers_memo;
}
_clearMemo();
_createMemo();
const header = data2.header ? parse(data2.header) : null;
const header_memo = _getMemo();
if (header) {
parsed_data.header = header;
parsed_data.header_memo = header_memo;
}
_clearMemo();
_createMemo();
const sidebar = data2.sidebar ? parseItem(data2.sidebar) : null;
const sidebar_memo = _getMemo();
if (sidebar) {
parsed_data.sidebar = sidebar;
parsed_data.sidebar_memo = sidebar_memo;
}
_clearMemo();
_createMemo();
const items = parse(data2.items);
if (items) {
parsed_data.items = items;
parsed_data.items_memo = _getMemo();
}
_clearMemo();
applyMutations(contents_memo, data2.frameworkUpdates?.entityBatchUpdate?.mutations);
if (on_response_received_endpoints_memo) {
applyCommentsMutations(on_response_received_endpoints_memo, data2.frameworkUpdates?.entityBatchUpdate?.mutations);
}
const continuation = data2.continuation ? parseC(data2.continuation) : null;
if (continuation) {
parsed_data.continuation = continuation;
}
const continuation_endpoint = data2.continuationEndpoint ? parseLC(data2.continuationEndpoint) : null;
if (continuation_endpoint) {
parsed_data.continuation_endpoint = continuation_endpoint;
}
const metadata = parse(data2.metadata);
if (metadata) {
parsed_data.metadata = metadata;
}
const microformat = parseItem(data2.microformat);
if (microformat) {
parsed_data.microformat = microformat;
}
const overlay = parseItem(data2.overlay);
if (overlay) {
parsed_data.overlay = overlay;
}
const alerts = parseArray(data2.alerts, [Alert_default, AlertWithButton_default]);
if (alerts.length) {
parsed_data.alerts = alerts;
}
const refinements = data2.refinements;
if (refinements) {
parsed_data.refinements = refinements;
}
const estimated_results = data2.estimatedResults ? parseInt(data2.estimatedResults) : null;
if (estimated_results) {
parsed_data.estimated_results = estimated_results;
}
const player_overlays = parse(data2.playerOverlays);
if (player_overlays) {
parsed_data.player_overlays = player_overlays;
}
const background = parseItem(data2.background, MusicThumbnail_default);
if (background) {
parsed_data.background = background;
}
const playback_tracking = data2.playbackTracking ? {
videostats_watchtime_url: data2.playbackTracking.videostatsWatchtimeUrl.baseUrl,
videostats_playback_url: data2.playbackTracking.videostatsPlaybackUrl.baseUrl
} : null;
if (playback_tracking) {
parsed_data.playback_tracking = playback_tracking;
}
const playability_status = data2.playabilityStatus ? {
status: data2.playabilityStatus.status,
reason: data2.playabilityStatus.reason || "",
embeddable: !!data2.playabilityStatus.playableInEmbed || false,
audio_only_playability: parseItem(data2.playabilityStatus.audioOnlyPlayability, AudioOnlyPlayability_default),
error_screen: parseItem(data2.playabilityStatus.errorScreen)
} : null;
if (playability_status) {
parsed_data.playability_status = playability_status;
}
if (data2.streamingData) {
const this_response_nsig_cache = /* @__PURE__ */ new Map();
parsed_data.streaming_data = {
expires: new Date(Date.now() + parseInt(data2.streamingData.expiresInSeconds) * 1e3),
formats: parseFormats(data2.streamingData.formats, this_response_nsig_cache),
adaptive_formats: parseFormats(data2.streamingData.adaptiveFormats, this_response_nsig_cache),
dash_manifest_url: data2.streamingData.dashManifestUrl,
hls_manifest_url: data2.streamingData.hlsManifestUrl,
server_abr_streaming_url: data2.streamingData.serverAbrStreamingUrl
};
}
if (data2.playerConfig) {
parsed_data.player_config = {
audio_config: {
loudness_db: data2.playerConfig.audioConfig?.loudnessDb,
perceptual_loudness_db: data2.playerConfig.audioConfig?.perceptualLoudnessDb,
enable_per_format_loudness: data2.playerConfig.audioConfig?.enablePerFormatLoudness
},
stream_selection_config: {
max_bitrate: data2.playerConfig.streamSelectionConfig?.maxBitrate || "0"
},
media_common_config: {
dynamic_readahead_config: {
max_read_ahead_media_time_ms: data2.playerConfig.mediaCommonConfig?.dynamicReadaheadConfig?.maxReadAheadMediaTimeMs || 0,
min_read_ahead_media_time_ms: data2.playerConfig.mediaCommonConfig?.dynamicReadaheadConfig?.minReadAheadMediaTimeMs || 0,
read_ahead_growth_rate_ms: data2.playerConfig.mediaCommonConfig?.dynamicReadaheadConfig?.readAheadGrowthRateMs || 0
},
media_ustreamer_request_config: {
video_playback_ustreamer_config: data2.playerConfig.mediaCommonConfig?.mediaUstreamerRequestConfig?.videoPlaybackUstreamerConfig
}
}
};
}
const current_video_endpoint = data2.currentVideoEndpoint ? new NavigationEndpoint_default(data2.currentVideoEndpoint) : null;
if (current_video_endpoint) {
parsed_data.current_video_endpoint = current_video_endpoint;
}
const endpoint = data2.endpoint ? new NavigationEndpoint_default(data2.endpoint) : null;
if (endpoint) {
parsed_data.endpoint = endpoint;
}
const captions = parseItem(data2.captions, PlayerCaptionsTracklist_default);
if (captions) {
parsed_data.captions = captions;
}
const video_details = data2.videoDetails ? new VideoDetails(data2.videoDetails) : null;
if (video_details) {
parsed_data.video_details = video_details;
}
const annotations = parseArray(data2.annotations, PlayerAnnotationsExpanded_default);
if (annotations.length) {
parsed_data.annotations = annotations;
}
const storyboards = parseItem(data2.storyboards, [PlayerStoryboardSpec_default, PlayerLiveStoryboardSpec_default]);
if (storyboards) {
parsed_data.storyboards = storyboards;
}
const endscreen = parseItem(data2.endscreen, Endscreen_default);
if (endscreen) {
parsed_data.endscreen = endscreen;
}
const cards = parseItem(data2.cards, CardCollection_default);
if (cards) {
parsed_data.cards = cards;
}
const engagement_panels = parseArray(data2.engagementPanels, EngagementPanelSectionList_default);
if (engagement_panels.length) {
parsed_data.engagement_panels = engagement_panels;
}
if (data2.bgChallenge) {
const interpreter_url = {
private_do_not_access_or_else_trusted_resource_url_wrapped_value: data2.bgChallenge.interpreterUrl.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue,
private_do_not_access_or_else_safe_script_wrapped_value: data2.bgChallenge.interpreterUrl.privateDoNotAccessOrElseSafeScriptWrappedValue
};
parsed_data.bg_challenge = {
interpreter_url,
interpreter_hash: data2.bgChallenge.interpreterHash,
program: data2.bgChallenge.program,
global_name: data2.bgChallenge.globalName,
client_experiments_state_blob: data2.bgChallenge.clientExperimentsStateBlob
};
}
if (data2.challenge) {
parsed_data.challenge = data2.challenge;
}
if (data2.playerResponse) {
parsed_data.player_response = parseResponse(data2.playerResponse);
}
if (data2.watchNextResponse) {
parsed_data.watch_next_response = parseResponse(data2.watchNextResponse);
}
if (data2.cpnInfo) {
parsed_data.cpn_info = {
cpn: data2.cpnInfo.cpn,
cpn_source: data2.cpnInfo.cpnSource
};
}
if (data2.entries) {
parsed_data.entries = data2.entries.map((entry) => new NavigationEndpoint_default(entry));
}
return parsed_data;
}
__name(parseResponse, "parseResponse");
function parseItem(data2, validTypes) {
if (!data2)
return null;
const keys = Object.keys(data2);
if (!keys.length)
return null;
const classname = sanitizeClassName(keys[0]);
if (!shouldIgnore(classname)) {
try {
const has_target_class = hasParser(classname);
const TargetClass = has_target_class ? getParserByName(classname) : generateRuntimeClass(classname, data2[keys[0]], ERROR_HANDLER);
if (validTypes) {
if (Array.isArray(validTypes)) {
if (!validTypes.some((type) => type.type === TargetClass.type)) {
ERROR_HANDLER({
classdata: data2[keys[0]],
classname,
error_type: "typecheck",
expected: validTypes.map((type) => type.type)
});
return null;
}
} else if (TargetClass.type !== validTypes.type) {
ERROR_HANDLER({
classdata: data2[keys[0]],
classname,
error_type: "typecheck",
expected: validTypes.type
});
return null;
}
}
const result = new TargetClass(data2[keys[0]]);
_addToMemo(classname, result);
return result;
} catch (err) {
ERROR_HANDLER({
classname,
classdata: data2[keys[0]],
error: err,
error_type: "parse"
});
return null;
}
}
return null;
}
__name(parseItem, "parseItem");
function parseArray(data2, validTypes) {
if (Array.isArray(data2)) {
const results = [];
for (const item of data2) {
const result = parseItem(item, validTypes);
if (result) {
results.push(result);
}
}
return observe(results);
} else if (!data2) {
return observe([]);
}
throw new ParsingError("Expected array but got a single item");
}
__name(parseArray, "parseArray");
function parse(data2, requireArray, validTypes) {
if (!data2)
return null;
if (Array.isArray(data2)) {
const results = [];
for (const item of data2) {
const result = parseItem(item, validTypes);
if (result) {
results.push(result);
}
}
const res = observe(results);
return requireArray ? res : new SuperParsedResult(res);
} else if (requireArray) {
throw new ParsingError("Expected array but got a single item");
}
return new SuperParsedResult(parseItem(data2, validTypes));
}
__name(parse, "parse");
var command_regexp = /Command$/;
var endpoint_regexp = /Endpoint$/;
var action_regexp = /Action$/;
function parseCommand(data2) {
let keys = [];
try {
keys = Object.keys(data2);
} catch {
}
for (const key of keys) {
const value = data2[key];
if (command_regexp.test(key) || endpoint_regexp.test(key) || action_regexp.test(key)) {
const classname = sanitizeClassName(key);
if (shouldIgnore(classname))
return void 0;
try {
const has_target_class = hasParser(classname);
if (has_target_class)
return new (getParserByName(classname))(value);
} catch (error2) {
ERROR_HANDLER({
error: error2,
classname,
classdata: value,
error_type: "parse"
});
}
}
}
}
__name(parseCommand, "parseCommand");
function parseCommands(commands) {
if (Array.isArray(commands)) {
const results = [];
for (const item of commands) {
const result = parseCommand(item);
if (result) {
results.push(result);
}
}
return observe(results);
} else if (!commands)
return observe([]);
throw new ParsingError("Expected array but got a single item");
}
__name(parseCommands, "parseCommands");
function parseC(data2) {
if (data2.timedContinuationData)
return new Continuation({ continuation: data2.timedContinuationData, type: "timed" });
return null;
}
__name(parseC, "parseC");
function parseLC(data2) {
if (data2.itemSectionContinuation)
return new ItemSectionContinuation(data2.itemSectionContinuation);
if (data2.sectionListContinuation)
return new SectionListContinuation(data2.sectionListContinuation);
if (data2.liveChatContinuation)
return new LiveChatContinuation(data2.liveChatContinuation);
if (data2.musicPlaylistShelfContinuation)
return new MusicPlaylistShelfContinuation(data2.musicPlaylistShelfContinuation);
if (data2.musicShelfContinuation)
return new MusicShelfContinuation(data2.musicShelfContinuation);
if (data2.gridContinuation)
return new GridContinuation(data2.gridContinuation);
if (data2.playlistPanelContinuation)
return new PlaylistPanelContinuation(data2.playlistPanelContinuation);
if (data2.continuationCommand)
return new ContinuationCommand2(data2.continuationCommand);
return null;
}
__name(parseLC, "parseLC");
function parseRR(actions) {
return observe(actions.map((action) => {
if (action.navigateAction)
return new NavigateAction(action.navigateAction);
else if (action.showMiniplayerCommand)
return new ShowMiniplayerCommand(action.showMiniplayerCommand);
else if (action.reloadContinuationItemsCommand)
return new ReloadContinuationItemsCommand(action.reloadContinuationItemsCommand);
else if (action.appendContinuationItemsAction)
return new AppendContinuationItemsAction_default(action.appendContinuationItemsAction);
else if (action.openPopupAction)
return new OpenPopupAction_default(action.openPopupAction);
}).filter((item) => item));
}
__name(parseRR, "parseRR");
function parseActions(data2) {
if (Array.isArray(data2)) {
return parse(data2.map((action) => {
delete action.clickTrackingParams;
return action;
}));
}
return new SuperParsedResult(parseItem(data2));
}
__name(parseActions, "parseActions");
function parseFormats(formats, this_response_nsig_cache) {
return formats?.map((format) => new Format_default(format, this_response_nsig_cache)) || [];
}
__name(parseFormats, "parseFormats");
function applyMutations(memo, mutations) {
const music_multi_select_menu_items = memo.getType(MusicMultiSelectMenuItem_default);
if (music_multi_select_menu_items.length > 0 && !mutations) {
ERROR_HANDLER({
error_type: "mutation_data_missing",
classname: "MusicMultiSelectMenuItem"
});
} else {
const missing_or_invalid_mutations = [];
for (const menu_item of music_multi_select_menu_items) {
const mutation = mutations.find((mutation2) => mutation2.payload?.musicFormBooleanChoice?.id === menu_item.form_item_entity_key);
const choice = mutation?.payload.musicFormBooleanChoice;
if (choice?.selected !== void 0 && choice?.opaqueToken) {
menu_item.selected = choice.selected;
} else {
missing_or_invalid_mutations.push(`'${menu_item.title}'`);
}
}
if (missing_or_invalid_mutations.length > 0) {
ERROR_HANDLER({
error_type: "mutation_data_invalid",
classname: "MusicMultiSelectMenuItem",
total: music_multi_select_menu_items.length,
failed: missing_or_invalid_mutations.length,
titles: missing_or_invalid_mutations
});
}
}
}
__name(applyMutations, "applyMutations");
function applyCommentsMutations(memo, mutations) {
const comment_view_items = memo.getType(CommentView_default);
if (comment_view_items.length > 0) {
if (!mutations) {
ERROR_HANDLER({
error_type: "mutation_data_missing",
classname: "CommentView"
});
}
for (const comment_view of comment_view_items) {
const comment_mutation = mutations.find((mutation) => mutation.payload?.commentEntityPayload?.key === comment_view.keys.comment)?.payload?.commentEntityPayload;
const toolbar_state_mutation = mutations.find((mutation) => mutation.payload?.engagementToolbarStateEntityPayload?.key === comment_view.keys.toolbar_state)?.payload?.engagementToolbarStateEntityPayload;
const engagement_toolbar = mutations.find((mutation) => mutation.entityKey === comment_view.keys.toolbar_surface)?.payload?.engagementToolbarSurfaceEntityPayload;
comment_view.applyMutations(comment_mutation, toolbar_state_mutation, engagement_toolbar);
}
}
}
__name(applyCommentsMutations, "applyCommentsMutations");
// dist/src/parser/youtube/index.js
var youtube_exports = {};
__export(youtube_exports, {
AccountInfo: () => AccountInfo_default,
Channel: () => Channel2,
ChannelListContinuation: () => ChannelListContinuation,
Comments: () => Comments_default,
FilteredChannelList: () => FilteredChannelList,
Guide: () => Guide_default,
HashtagFeed: () => HashtagFeed,
History: () => History,
HomeFeed: () => HomeFeed,
ItemMenu: () => ItemMenu_default,
Library: () => Library_default,
LiveChat: () => LiveChat_default2,
NotificationsMenu: () => NotificationsMenu_default,
Playlist: () => Playlist_default2,
Search: () => Search,
Settings: () => Settings_default,
SmoothedQueue: () => SmoothedQueue_default,
TranscriptInfo: () => TranscriptInfo_default,
VideoInfo: () => VideoInfo_default
});
// dist/src/parser/youtube/AccountInfo.js
var _AccountInfo_page;
var AccountInfo = class {
constructor(response) {
_AccountInfo_page.set(this, void 0);
__classPrivateFieldSet(this, _AccountInfo_page, parser_exports.parseResponse(response.data), "f");
if (!__classPrivateFieldGet(this, _AccountInfo_page, "f").contents)
throw new InnertubeError("Page contents not found");
const account_section_list = __classPrivateFieldGet(this, _AccountInfo_page, "f").contents.array().as(AccountSectionList_default)[0];
if (!account_section_list)
throw new InnertubeError("Account section list not found");
this.contents = account_section_list.contents[0];
}
get page() {
return __classPrivateFieldGet(this, _AccountInfo_page, "f");
}
};
__name(AccountInfo, "AccountInfo");
_AccountInfo_page = /* @__PURE__ */ new WeakMap();
var AccountInfo_default = AccountInfo;
// dist/src/core/mixins/Feed.js
var _Feed_instances;
var _Feed_page;
var _Feed_actions;
var _Feed_memo;
var _Feed_continuation;
var _Feed_isParsed;
var _Feed_getBodyContinuations;
var Feed = class {
constructor(actions, response, already_parsed = false) {
_Feed_instances.add(this);
_Feed_page.set(this, void 0);
_Feed_actions.set(this, void 0);
_Feed_memo.set(this, void 0);
_Feed_continuation.set(this, void 0);
if (__classPrivateFieldGet(this, _Feed_instances, "m", _Feed_isParsed).call(this, response) || already_parsed) {
__classPrivateFieldSet(this, _Feed_page, response, "f");
} else {
__classPrivateFieldSet(this, _Feed_page, parser_exports.parseResponse(response.data), "f");
}
const memo = concatMemos(...[
__classPrivateFieldGet(this, _Feed_page, "f").contents_memo,
__classPrivateFieldGet(this, _Feed_page, "f").continuation_contents_memo,
__classPrivateFieldGet(this, _Feed_page, "f").on_response_received_commands_memo,
__classPrivateFieldGet(this, _Feed_page, "f").on_response_received_endpoints_memo,
__classPrivateFieldGet(this, _Feed_page, "f").on_response_received_actions_memo,
__classPrivateFieldGet(this, _Feed_page, "f").sidebar_memo,
__classPrivateFieldGet(this, _Feed_page, "f").header_memo
]);
if (!memo)
throw new InnertubeError("No memo found in feed");
__classPrivateFieldSet(this, _Feed_memo, memo, "f");
__classPrivateFieldSet(this, _Feed_actions, actions, "f");
}
static getVideosFromMemo(memo) {
return memo.getType(Video_default, GridVideo_default, ReelItem_default, ShortsLockupView_default, CompactVideo_default, PlaylistVideo_default, PlaylistPanelVideo_default, WatchCardCompactVideo_default);
}
static getPlaylistsFromMemo(memo) {
const playlists = memo.getType(Playlist_default, GridPlaylist_default);
const lockup_views = memo.getType(LockupView_default).filter((lockup) => {
return ["PLAYLIST", "ALBUM", "PODCAST"].includes(lockup.content_type);
});
if (lockup_views.length > 0) {
playlists.push(...lockup_views);
}
return playlists;
}
get videos() {
return Feed.getVideosFromMemo(__classPrivateFieldGet(this, _Feed_memo, "f"));
}
get posts() {
return __classPrivateFieldGet(this, _Feed_memo, "f").getType(BackstagePost_default, Post_default, SharedPost_default);
}
get channels() {
return __classPrivateFieldGet(this, _Feed_memo, "f").getType(Channel_default, GridChannel_default);
}
get playlists() {
return Feed.getPlaylistsFromMemo(__classPrivateFieldGet(this, _Feed_memo, "f"));
}
get memo() {
return __classPrivateFieldGet(this, _Feed_memo, "f");
}
get page_contents() {
const tab_content = __classPrivateFieldGet(this, _Feed_memo, "f").getType(Tab_default)?.[0].content;
const reload_continuation_items = __classPrivateFieldGet(this, _Feed_memo, "f").getType(ReloadContinuationItemsCommand)[0];
const append_continuation_items = __classPrivateFieldGet(this, _Feed_memo, "f").getType(AppendContinuationItemsAction_default)[0];
return tab_content || reload_continuation_items || append_continuation_items;
}
get shelves() {
return __classPrivateFieldGet(this, _Feed_memo, "f").getType(Shelf_default, RichShelf_default, ReelShelf_default);
}
getShelf(title) {
return this.shelves.get({ title });
}
get secondary_contents() {
if (!__classPrivateFieldGet(this, _Feed_page, "f").contents?.is_node)
return void 0;
const node = __classPrivateFieldGet(this, _Feed_page, "f").contents?.item();
if (!node.is(TwoColumnBrowseResults_default, TwoColumnSearchResults_default))
return void 0;
return node.secondary_contents;
}
get actions() {
return __classPrivateFieldGet(this, _Feed_actions, "f");
}
get page() {
return __classPrivateFieldGet(this, _Feed_page, "f");
}
get has_continuation() {
return __classPrivateFieldGet(this, _Feed_instances, "m", _Feed_getBodyContinuations).call(this).length > 0;
}
async getContinuationData() {
if (__classPrivateFieldGet(this, _Feed_continuation, "f")) {
if (__classPrivateFieldGet(this, _Feed_continuation, "f").length === 0)
throw new InnertubeError("There are no continuations.");
return await __classPrivateFieldGet(this, _Feed_continuation, "f")[0].endpoint.call(__classPrivateFieldGet(this, _Feed_actions, "f"), { parse: true });
}
__classPrivateFieldSet(this, _Feed_continuation, __classPrivateFieldGet(this, _Feed_instances, "m", _Feed_getBodyContinuations).call(this), "f");
if (__classPrivateFieldGet(this, _Feed_continuation, "f"))
return this.getContinuationData();
}
async getContinuation() {
const continuation_data = await this.getContinuationData();
if (!continuation_data)
throw new InnertubeError("Could not get continuation data");
return new Feed(this.actions, continuation_data, true);
}
};
__name(Feed, "Feed");
_Feed_page = /* @__PURE__ */ new WeakMap(), _Feed_actions = /* @__PURE__ */ new WeakMap(), _Feed_memo = /* @__PURE__ */ new WeakMap(), _Feed_continuation = /* @__PURE__ */ new WeakMap(), _Feed_instances = /* @__PURE__ */ new WeakSet(), _Feed_isParsed = /* @__PURE__ */ __name(function _Feed_isParsed2(response) {
return !("data" in response);
}, "_Feed_isParsed"), _Feed_getBodyContinuations = /* @__PURE__ */ __name(function _Feed_getBodyContinuations2() {
if (__classPrivateFieldGet(this, _Feed_page, "f").header_memo) {
const header_continuations = __classPrivateFieldGet(this, _Feed_page, "f").header_memo.getType(ContinuationItem_default);
return __classPrivateFieldGet(this, _Feed_memo, "f").getType(ContinuationItem_default).filter((continuation) => !header_continuations.includes(continuation));
}
return __classPrivateFieldGet(this, _Feed_memo, "f").getType(ContinuationItem_default);
}, "_Feed_getBodyContinuations");
var Feed_default = Feed;
// dist/src/core/mixins/FilterableFeed.js
var _FilterableFeed_chips;
var FilterableFeed = class extends Feed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
_FilterableFeed_chips.set(this, void 0);
}
get filter_chips() {
if (__classPrivateFieldGet(this, _FilterableFeed_chips, "f"))
return __classPrivateFieldGet(this, _FilterableFeed_chips, "f") || [];
if (this.memo.getType(FeedFilterChipBar_default)?.length > 1)
throw new InnertubeError("There are too many feed filter chipbars, you'll need to find the correct one yourself in this.page");
if (this.memo.getType(FeedFilterChipBar_default)?.length === 0)
throw new InnertubeError("There are no feed filter chipbars");
__classPrivateFieldSet(this, _FilterableFeed_chips, this.memo.getType(ChipCloudChip_default), "f");
return __classPrivateFieldGet(this, _FilterableFeed_chips, "f") || [];
}
get filters() {
return this.filter_chips.map((chip) => chip.text.toString()) || [];
}
async getFilteredFeed(filter) {
let target_filter;
if (typeof filter === "string") {
if (!this.filters.includes(filter))
throw new InnertubeError("Filter not found", { available_filters: this.filters });
target_filter = this.filter_chips.find((chip) => chip.text.toString() === filter);
} else if (filter.type === "ChipCloudChip") {
target_filter = filter;
} else {
throw new InnertubeError("Invalid filter");
}
if (!target_filter)
throw new InnertubeError("Filter not found");
if (target_filter.is_selected)
return this;
const response = await target_filter.endpoint?.call(this.actions, { parse: true });
if (!response)
throw new InnertubeError("Failed to get filtered feed");
return new Feed_default(this.actions, response, true);
}
};
__name(FilterableFeed, "FilterableFeed");
_FilterableFeed_chips = /* @__PURE__ */ new WeakMap();
var FilterableFeed_default = FilterableFeed;
// dist/src/core/mixins/index.js
var mixins_exports = {};
__export(mixins_exports, {
Feed: () => Feed_default,
FilterableFeed: () => FilterableFeed_default,
MediaInfo: () => MediaInfo_default,
TabbedFeed: () => TabbedFeed_default
});
// dist/src/core/mixins/MediaInfo.js
var _MediaInfo_page;
var _MediaInfo_actions;
var _MediaInfo_cpn;
var _MediaInfo_playback_tracking;
var MediaInfo = class {
constructor(data2, actions, cpn) {
_MediaInfo_page.set(this, void 0);
_MediaInfo_actions.set(this, void 0);
_MediaInfo_cpn.set(this, void 0);
_MediaInfo_playback_tracking.set(this, void 0);
__classPrivateFieldSet(this, _MediaInfo_actions, actions, "f");
const info2 = parser_exports.parseResponse(data2[0].data.playerResponse ? data2[0].data.playerResponse : data2[0].data);
const next = data2[1]?.data ? parser_exports.parseResponse(data2[1].data) : void 0;
__classPrivateFieldSet(this, _MediaInfo_page, [info2, next], "f");
__classPrivateFieldSet(this, _MediaInfo_cpn, cpn, "f");
if (info2.playability_status?.status === "ERROR")
throw new InnertubeError("This video is unavailable", info2.playability_status);
if (info2.microformat && !info2.microformat?.is(PlayerMicroformat_default, MicroformatData_default))
throw new InnertubeError("Unsupported microformat", info2.microformat);
this.basic_info = {
...info2.video_details,
...{
embed: info2.microformat?.is(PlayerMicroformat_default) ? info2.microformat?.embed : null,
channel: info2.microformat?.is(PlayerMicroformat_default) ? info2.microformat?.channel : null,
is_unlisted: info2.microformat?.is_unlisted,
is_family_safe: info2.microformat?.is_family_safe,
category: info2.microformat?.is(PlayerMicroformat_default) ? info2.microformat?.category : null,
has_ypc_metadata: info2.microformat?.is(PlayerMicroformat_default) ? info2.microformat?.has_ypc_metadata : null,
start_timestamp: info2.microformat?.is(PlayerMicroformat_default) ? info2.microformat.start_timestamp : null,
end_timestamp: info2.microformat?.is(PlayerMicroformat_default) ? info2.microformat.end_timestamp : null,
view_count: info2.microformat?.is(PlayerMicroformat_default) && isNaN(info2.video_details?.view_count) ? info2.microformat.view_count : info2.video_details?.view_count,
url_canonical: info2.microformat?.is(MicroformatData_default) ? info2.microformat?.url_canonical : null,
tags: info2.microformat?.is(MicroformatData_default) ? info2.microformat?.tags : null
},
like_count: void 0,
is_liked: void 0,
is_disliked: void 0
};
this.annotations = info2.annotations;
this.storyboards = info2.storyboards;
this.endscreen = info2.endscreen;
this.captions = info2.captions;
this.cards = info2.cards;
this.streaming_data = info2.streaming_data;
this.playability_status = info2.playability_status;
this.player_config = info2.player_config;
__classPrivateFieldSet(this, _MediaInfo_playback_tracking, info2.playback_tracking, "f");
}
async toDash(url_transformer, format_filter, options = { include_thumbnails: false }) {
const player_response = __classPrivateFieldGet(this, _MediaInfo_page, "f")[0];
if (player_response.video_details && player_response.video_details.is_live) {
throw new InnertubeError("Generating DASH manifests for live videos is not supported. Please use the DASH and HLS manifests provided by YouTube in `streaming_data.dash_manifest_url` and `streaming_data.hls_manifest_url` instead.");
}
let storyboards;
let captions;
if (options.include_thumbnails && player_response.storyboards) {
storyboards = player_response.storyboards;
}
if (typeof options.captions_format === "string" && player_response.captions?.caption_tracks) {
captions = player_response.captions.caption_tracks;
}
return FormatUtils_exports.toDash(this.streaming_data, this.page[0].video_details?.is_post_live_dvr, url_transformer, format_filter, __classPrivateFieldGet(this, _MediaInfo_cpn, "f"), __classPrivateFieldGet(this, _MediaInfo_actions, "f").session.player, __classPrivateFieldGet(this, _MediaInfo_actions, "f"), storyboards, captions, options);
}
getStreamingInfo(url_transformer, format_filter) {
return getStreamingInfo(this.streaming_data, this.page[0].video_details?.is_post_live_dvr, url_transformer, format_filter, this.cpn, __classPrivateFieldGet(this, _MediaInfo_actions, "f").session.player, __classPrivateFieldGet(this, _MediaInfo_actions, "f"), __classPrivateFieldGet(this, _MediaInfo_page, "f")[0].storyboards ? __classPrivateFieldGet(this, _MediaInfo_page, "f")[0].storyboards : void 0);
}
chooseFormat(options) {
return FormatUtils_exports.chooseFormat(options, this.streaming_data);
}
async download(options = {}) {
const player_response = __classPrivateFieldGet(this, _MediaInfo_page, "f")[0];
if (player_response.video_details && (player_response.video_details.is_live || player_response.video_details.is_post_live_dvr)) {
throw new InnertubeError("Downloading is not supported for live and Post-Live-DVR videos, as they are split up into 5 second segments that are individual files, which require using a tool such as ffmpeg to stitch them together, so they cannot be returned in a single stream.");
}
return FormatUtils_exports.download(options, __classPrivateFieldGet(this, _MediaInfo_actions, "f"), this.playability_status, this.streaming_data, __classPrivateFieldGet(this, _MediaInfo_actions, "f").session.player, this.cpn);
}
async getTranscript() {
const next_response = this.page[1];
if (!next_response)
throw new InnertubeError("Cannot get transcript from basic video info.");
if (!next_response.engagement_panels)
throw new InnertubeError("Engagement panels not found. Video likely has no transcript.");
const transcript_panel = next_response.engagement_panels.get({
panel_identifier: "engagement-panel-searchable-transcript"
});
if (!transcript_panel)
throw new InnertubeError("Transcript panel not found. Video likely has no transcript.");
const transcript_continuation = transcript_panel.content?.as(ContinuationItem_default);
if (!transcript_continuation)
throw new InnertubeError("Transcript continuation not found.");
const response = await transcript_continuation.endpoint.call(this.actions);
return new TranscriptInfo_default(this.actions, response);
}
async addToWatchHistory(client_name = Constants_exports.CLIENTS.WEB.NAME, client_version = Constants_exports.CLIENTS.WEB.VERSION, replacement = "https://www.") {
if (!__classPrivateFieldGet(this, _MediaInfo_playback_tracking, "f"))
throw new InnertubeError("Playback tracking not available");
const url_params = {
cpn: __classPrivateFieldGet(this, _MediaInfo_cpn, "f"),
fmt: 251,
rtn: 0,
rt: 0
};
const url = __classPrivateFieldGet(this, _MediaInfo_playback_tracking, "f").videostats_playback_url.replace("https://s.", replacement);
return await __classPrivateFieldGet(this, _MediaInfo_actions, "f").stats(url, {
client_name,
client_version
}, url_params);
}
get actions() {
return __classPrivateFieldGet(this, _MediaInfo_actions, "f");
}
get cpn() {
return __classPrivateFieldGet(this, _MediaInfo_cpn, "f");
}
get page() {
return __classPrivateFieldGet(this, _MediaInfo_page, "f");
}
};
__name(MediaInfo, "MediaInfo");
_MediaInfo_page = /* @__PURE__ */ new WeakMap(), _MediaInfo_actions = /* @__PURE__ */ new WeakMap(), _MediaInfo_cpn = /* @__PURE__ */ new WeakMap(), _MediaInfo_playback_tracking = /* @__PURE__ */ new WeakMap();
var MediaInfo_default = MediaInfo;
// dist/src/core/mixins/TabbedFeed.js
var _TabbedFeed_actions;
var _TabbedFeed_tabs;
var TabbedFeed = class extends Feed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
_TabbedFeed_actions.set(this, void 0);
_TabbedFeed_tabs.set(this, void 0);
__classPrivateFieldSet(this, _TabbedFeed_actions, actions, "f");
__classPrivateFieldSet(this, _TabbedFeed_tabs, this.page.contents_memo?.getType(Tab_default), "f");
}
get tabs() {
return __classPrivateFieldGet(this, _TabbedFeed_tabs, "f")?.map((tab) => tab.title.toString()) ?? [];
}
async getTabByName(title) {
const tab = __classPrivateFieldGet(this, _TabbedFeed_tabs, "f")?.find((tab2) => tab2.title.toLowerCase() === title.toLowerCase());
if (!tab)
throw new InnertubeError(`Tab "${title}" not found`);
if (tab.selected)
return this;
const response = await tab.endpoint.call(__classPrivateFieldGet(this, _TabbedFeed_actions, "f"));
return new TabbedFeed(__classPrivateFieldGet(this, _TabbedFeed_actions, "f"), response, false);
}
async getTabByURL(url) {
const tab = __classPrivateFieldGet(this, _TabbedFeed_tabs, "f")?.find((tab2) => tab2.endpoint.metadata.url?.split("/").pop() === url);
if (!tab)
throw new InnertubeError(`Tab "${url}" not found`);
if (tab.selected)
return this;
const response = await tab.endpoint.call(__classPrivateFieldGet(this, _TabbedFeed_actions, "f"));
return new TabbedFeed(__classPrivateFieldGet(this, _TabbedFeed_actions, "f"), response, false);
}
hasTabWithURL(url) {
return __classPrivateFieldGet(this, _TabbedFeed_tabs, "f")?.some((tab) => tab.endpoint.metadata.url?.split("/").pop() === url) ?? false;
}
get title() {
return this.page.contents_memo?.getType(Tab_default)?.find((tab) => tab.selected)?.title.toString();
}
};
__name(TabbedFeed, "TabbedFeed");
_TabbedFeed_actions = /* @__PURE__ */ new WeakMap(), _TabbedFeed_tabs = /* @__PURE__ */ new WeakMap();
var TabbedFeed_default = TabbedFeed;
// dist/src/parser/youtube/Channel.js
var Channel2 = class extends TabbedFeed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
this.header = this.page.header?.item()?.as(C4TabbedHeader_default, CarouselHeader_default, InteractiveTabbedHeader_default, PageHeader_default);
const metadata = this.page.metadata?.item().as(ChannelMetadata_default);
const microformat = this.page.microformat?.as(MicroformatData_default);
if (this.page.alerts) {
const alert = this.page.alerts[0];
if (alert?.alert_type === "ERROR") {
throw new ChannelError(alert.text.toString());
}
}
if (!metadata && !this.page.contents)
throw new InnertubeError("Invalid channel", this);
this.metadata = { ...metadata, ...microformat || {} };
this.subscribe_button = this.page.header_memo?.getType(SubscribeButton_default)[0];
if (this.page.contents)
this.current_tab = this.page.contents.item().as(TwoColumnBrowseResults_default).tabs.array().filterType(Tab_default, ExpandableTab_default).get({ selected: true });
}
async applyFilter(filter) {
let target_filter;
const filter_chipbar = this.memo.getType(FeedFilterChipBar_default)[0];
if (typeof filter === "string") {
target_filter = filter_chipbar?.contents.get({ text: filter });
if (!target_filter)
throw new InnertubeError(`Filter ${filter} not found`, { available_filters: this.filters });
} else {
target_filter = filter;
}
if (!target_filter.endpoint)
throw new InnertubeError("Invalid filter", filter);
const page = await target_filter.endpoint.call(this.actions, { parse: true });
if (!page)
throw new InnertubeError("No page returned", { filter: target_filter });
return new FilteredChannelList(this.actions, page, true);
}
async applySort(sort) {
const sort_filter_sub_menu = this.memo.getType(SortFilterSubMenu_default)[0];
if (!sort_filter_sub_menu || !sort_filter_sub_menu.sub_menu_items)
throw new InnertubeError("No sort filter sub menu found");
const target_sort = sort_filter_sub_menu.sub_menu_items.find((item) => item.title === sort);
if (!target_sort)
throw new InnertubeError(`Sort filter ${sort} not found`, { available_sort_filters: this.sort_filters });
if (target_sort.selected)
return this;
const page = await target_sort.endpoint.call(this.actions, { parse: true });
return new Channel2(this.actions, page, true);
}
async applyContentTypeFilter(content_type_filter) {
const sub_menu = this.current_tab?.content?.as(SectionList_default).sub_menu?.as(ChannelSubMenu_default);
if (!sub_menu)
throw new InnertubeError("Sub menu not found");
const item = sub_menu.content_type_sub_menu_items.find((item2) => item2.title === content_type_filter);
if (!item)
throw new InnertubeError(`Sub menu item ${content_type_filter} not found`, { available_filters: this.content_type_filters });
if (item.selected)
return this;
const page = await item.endpoint.call(this.actions, { parse: true });
return new Channel2(this.actions, page, true);
}
get filters() {
return this.memo.getType(FeedFilterChipBar_default)?.[0]?.contents.filterType(ChipCloudChip_default).map((chip) => chip.text) || [];
}
get sort_filters() {
const sort_filter_sub_menu = this.memo.getType(SortFilterSubMenu_default)[0];
return sort_filter_sub_menu?.sub_menu_items?.map((item) => item.title) || [];
}
get content_type_filters() {
const sub_menu = this.current_tab?.content?.as(SectionList_default).sub_menu?.as(ChannelSubMenu_default);
return sub_menu?.content_type_sub_menu_items.map((item) => item.title) || [];
}
async getHome() {
const tab = await this.getTabByURL("featured");
return new Channel2(this.actions, tab.page, true);
}
async getVideos() {
const tab = await this.getTabByURL("videos");
return new Channel2(this.actions, tab.page, true);
}
async getShorts() {
const tab = await this.getTabByURL("shorts");
return new Channel2(this.actions, tab.page, true);
}
async getLiveStreams() {
const tab = await this.getTabByURL("streams");
return new Channel2(this.actions, tab.page, true);
}
async getReleases() {
const tab = await this.getTabByURL("releases");
return new Channel2(this.actions, tab.page, true);
}
async getPodcasts() {
const tab = await this.getTabByURL("podcasts");
return new Channel2(this.actions, tab.page, true);
}
async getCourses() {
const tab = await this.getTabByURL("courses");
return new Channel2(this.actions, tab.page, true);
}
async getPlaylists() {
const tab = await this.getTabByURL("playlists");
return new Channel2(this.actions, tab.page, true);
}
async getCommunity() {
const tab = await this.getTabByURL("community");
return new Channel2(this.actions, tab.page, true);
}
async getAbout() {
if (this.hasTabWithURL("about")) {
const tab = await this.getTabByURL("about");
return tab.memo.getType(ChannelAboutFullMetadata_default)[0];
}
const tagline = this.header?.is(C4TabbedHeader_default) && this.header.tagline;
if (tagline || this.header?.is(PageHeader_default) && this.header.content?.description) {
if (tagline && tagline.more_endpoint instanceof NavigationEndpoint_default) {
const response2 = await tagline.more_endpoint.call(this.actions);
const tab = new TabbedFeed_default(this.actions, response2, false);
return tab.memo.getType(ChannelAboutFullMetadata_default)[0];
}
const endpoint = this.page.header_memo?.getType(ContinuationItem_default)[0]?.endpoint;
if (!endpoint) {
throw new InnertubeError("Failed to extract continuation to get channel about");
}
const response = await endpoint.call(this.actions, { parse: true });
if (!response.on_response_received_endpoints_memo) {
throw new InnertubeError("Unexpected response while fetching channel about", { response });
}
return response.on_response_received_endpoints_memo.getType(AboutChannel_default)[0];
}
throw new InnertubeError("About not found");
}
async search(query) {
const tab = this.memo.getType(ExpandableTab_default)?.[0];
if (!tab)
throw new InnertubeError("Search tab not found", this);
const page = await tab.endpoint.call(this.actions, { query, parse: true });
return new Channel2(this.actions, page, true);
}
get has_home() {
return this.hasTabWithURL("featured");
}
get has_videos() {
return this.hasTabWithURL("videos");
}
get has_shorts() {
return this.hasTabWithURL("shorts");
}
get has_live_streams() {
return this.hasTabWithURL("streams");
}
get has_releases() {
return this.hasTabWithURL("releases");
}
get has_podcasts() {
return this.hasTabWithURL("podcasts");
}
get has_courses() {
return this.hasTabWithURL("courses");
}
get has_playlists() {
return this.hasTabWithURL("playlists");
}
get has_community() {
return this.hasTabWithURL("community");
}
get has_about() {
return this.hasTabWithURL("about") || !!(this.header?.is(C4TabbedHeader_default) && this.header.tagline?.more_endpoint) || !!(this.header?.is(PageHeader_default) && this.header.content?.description?.more_endpoint);
}
get has_search() {
return this.memo.getType(ExpandableTab_default)?.length > 0;
}
async getContinuation() {
const page = await super.getContinuationData();
if (!page)
throw new InnertubeError("Could not get continuation data");
return new ChannelListContinuation(this.actions, page, true);
}
};
__name(Channel2, "Channel");
var ChannelListContinuation = class extends Feed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
this.contents = this.page.on_response_received_actions?.[0] || this.page.on_response_received_endpoints?.[0];
}
async getContinuation() {
const page = await super.getContinuationData();
if (!page)
throw new InnertubeError("Could not get continuation data");
return new ChannelListContinuation(this.actions, page, true);
}
};
__name(ChannelListContinuation, "ChannelListContinuation");
var FilteredChannelList = class extends FilterableFeed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
this.applied_filter = this.memo.getType(ChipCloudChip_default).get({ is_selected: true });
if (this.page.on_response_received_actions && this.page.on_response_received_actions.length > 1) {
this.page.on_response_received_actions.shift();
}
this.contents = this.page.on_response_received_actions?.[0];
}
async applyFilter(filter) {
const feed = await super.getFilteredFeed(filter);
return new FilteredChannelList(this.actions, feed.page, true);
}
async getContinuation() {
const page = await super.getContinuationData();
if (!page?.on_response_received_actions_memo)
throw new InnertubeError("Unexpected continuation data", page);
page.on_response_received_actions_memo.set("FeedFilterChipBar", this.memo.getType(FeedFilterChipBar_default));
page.on_response_received_actions_memo.set("ChipCloudChip", this.memo.getType(ChipCloudChip_default));
return new FilteredChannelList(this.actions, page, true);
}
};
__name(FilteredChannelList, "FilteredChannelList");
// dist/src/parser/youtube/Comments.js
var _Comments_page;
var _Comments_actions;
var _Comments_continuation;
var Comments = class {
constructor(actions, data2, already_parsed = false) {
_Comments_page.set(this, void 0);
_Comments_actions.set(this, void 0);
_Comments_continuation.set(this, void 0);
__classPrivateFieldSet(this, _Comments_page, already_parsed ? data2 : parser_exports.parseResponse(data2), "f");
__classPrivateFieldSet(this, _Comments_actions, actions, "f");
const contents = __classPrivateFieldGet(this, _Comments_page, "f").on_response_received_endpoints;
if (!contents)
throw new InnertubeError("Comments page did not have any content.");
const header_node = contents.at(0)?.as(AppendContinuationItemsAction_default, ReloadContinuationItemsCommand);
const body_node = contents.at(1)?.as(AppendContinuationItemsAction_default, ReloadContinuationItemsCommand);
this.header = header_node?.contents?.firstOfType(CommentsHeader_default);
const threads = body_node?.contents?.filterType(CommentThread_default) || [];
this.contents = observe(threads.map((thread) => {
if (thread.comment)
thread.comment.setActions(__classPrivateFieldGet(this, _Comments_actions, "f"));
thread.setActions(__classPrivateFieldGet(this, _Comments_actions, "f"));
return thread;
}));
__classPrivateFieldSet(this, _Comments_continuation, body_node?.contents?.firstOfType(ContinuationItem_default), "f");
}
async applySort(sort) {
if (!this.header)
throw new InnertubeError("Page header is missing. Cannot apply sort option.");
let button;
if (sort === "TOP_COMMENTS") {
button = this.header.sort_menu?.sub_menu_items?.at(0);
} else if (sort === "NEWEST_FIRST") {
button = this.header.sort_menu?.sub_menu_items?.at(1);
}
if (!button)
throw new InnertubeError("Could not find target button.");
if (button.selected)
return this;
const response = await button.endpoint.call(__classPrivateFieldGet(this, _Comments_actions, "f"), { parse: true });
return new Comments(__classPrivateFieldGet(this, _Comments_actions, "f"), response, true);
}
async createComment(text) {
if (!this.header)
throw new InnertubeError("Page header is missing. Cannot create comment.");
const button = this.header.create_renderer?.as(CommentSimplebox_default).submit_button;
if (!button)
throw new InnertubeError("Could not find target button. You are probably not logged in.");
if (!button.endpoint)
throw new InnertubeError("Button does not have an endpoint.");
return await button.endpoint.call(__classPrivateFieldGet(this, _Comments_actions, "f"), { commentText: text });
}
async getContinuation() {
if (!__classPrivateFieldGet(this, _Comments_continuation, "f"))
throw new InnertubeError("Continuation not found");
const data2 = await __classPrivateFieldGet(this, _Comments_continuation, "f").endpoint.call(__classPrivateFieldGet(this, _Comments_actions, "f"), { parse: true });
const page = Object.assign({}, __classPrivateFieldGet(this, _Comments_page, "f"));
if (!page.on_response_received_endpoints || !data2.on_response_received_endpoints)
throw new InnertubeError("Invalid reponse format, missing on_response_received_endpoints.");
page.on_response_received_endpoints.pop();
page.on_response_received_endpoints.push(data2.on_response_received_endpoints[0]);
return new Comments(__classPrivateFieldGet(this, _Comments_actions, "f"), page, true);
}
get has_continuation() {
return !!__classPrivateFieldGet(this, _Comments_continuation, "f");
}
get page() {
return __classPrivateFieldGet(this, _Comments_page, "f");
}
};
__name(Comments, "Comments");
_Comments_page = /* @__PURE__ */ new WeakMap(), _Comments_actions = /* @__PURE__ */ new WeakMap(), _Comments_continuation = /* @__PURE__ */ new WeakMap();
var Comments_default = Comments;
// dist/src/parser/youtube/Guide.js
var _Guide_page;
var Guide = class {
constructor(data2) {
_Guide_page.set(this, void 0);
__classPrivateFieldSet(this, _Guide_page, parser_exports.parseResponse(data2), "f");
if (__classPrivateFieldGet(this, _Guide_page, "f").items)
this.contents = __classPrivateFieldGet(this, _Guide_page, "f").items.array().as(GuideSection_default, GuideSubscriptionsSection_default);
}
get page() {
return __classPrivateFieldGet(this, _Guide_page, "f");
}
};
__name(Guide, "Guide");
_Guide_page = /* @__PURE__ */ new WeakMap();
var Guide_default = Guide;
// dist/src/parser/youtube/History.js
var History = class extends Feed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
this.sections = this.memo.getType(ItemSection_default);
this.feed_actions = this.memo.getType(BrowseFeedActions_default)[0];
}
async getContinuation() {
const response = await this.getContinuationData();
if (!response)
throw new Error("No continuation data found");
return new History(this.actions, response, true);
}
async removeVideo(video_id) {
let feedbackToken;
for (const section of this.sections) {
for (const content of section.contents) {
const video = content;
if (video.id === video_id && video.menu) {
feedbackToken = video.menu.top_level_buttons[0].as(Button_default).endpoint.payload.feedbackToken;
break;
}
}
}
if (!feedbackToken) {
throw new Error("Failed to get feedback token");
}
const body = { feedbackTokens: [feedbackToken] };
const response = await this.actions.execute("/feedback", body);
const data2 = response.data;
if (!data2.feedbackResponses[0].isProcessed) {
throw new Error("Failed to remove video from watch history");
}
return true;
}
};
__name(History, "History");
// dist/src/parser/youtube/HomeFeed.js
var HomeFeed = class extends FilterableFeed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
this.header = this.memo.getType(FeedTabbedHeader_default)[0];
this.contents = this.memo.getType(RichGrid_default)[0] || this.page.on_response_received_actions?.[0];
}
async applyFilter(filter) {
const feed = await super.getFilteredFeed(filter);
return new HomeFeed(this.actions, feed.page, true);
}
async getContinuation() {
const feed = await super.getContinuation();
feed.page.header = this.page.header;
if (this.header)
feed.page.header_memo?.set(this.header.type, [this.header]);
return new HomeFeed(this.actions, feed.page, true);
}
};
__name(HomeFeed, "HomeFeed");
// dist/src/parser/youtube/HashtagFeed.js
var HashtagFeed = class extends FilterableFeed_default {
constructor(actions, response) {
super(actions, response);
if (!this.page.contents_memo)
throw new InnertubeError("Unexpected response", this.page);
const tab = this.page.contents_memo.getType(Tab_default)[0];
if (!tab.content)
throw new InnertubeError("Content tab has no content", tab);
if (this.page.header) {
this.header = this.page.header.item().as(HashtagHeader_default, PageHeader_default);
}
this.contents = tab.content.as(RichGrid_default);
}
async applyFilter(filter) {
const response = await super.getFilteredFeed(filter);
return new HashtagFeed(this.actions, response.page);
}
};
__name(HashtagFeed, "HashtagFeed");
// dist/src/parser/youtube/ItemMenu.js
var _ItemMenu_page;
var _ItemMenu_actions;
var _ItemMenu_items;
var ItemMenu = class {
constructor(data2, actions) {
_ItemMenu_page.set(this, void 0);
_ItemMenu_actions.set(this, void 0);
_ItemMenu_items.set(this, void 0);
__classPrivateFieldSet(this, _ItemMenu_page, data2, "f");
__classPrivateFieldSet(this, _ItemMenu_actions, actions, "f");
const menu = data2?.live_chat_item_context_menu_supported_renderers;
if (!menu || !menu.is(Menu_default))
throw new InnertubeError('Response did not have a "live_chat_item_context_menu_supported_renderers" property. The call may have failed.');
__classPrivateFieldSet(this, _ItemMenu_items, menu.as(Menu_default).items, "f");
}
async selectItem(item) {
let endpoint;
if (item instanceof Button_default) {
if (!item.endpoint)
throw new InnertubeError("Item does not have an endpoint.");
endpoint = item.endpoint;
} else {
const button = __classPrivateFieldGet(this, _ItemMenu_items, "f").find((button2) => {
if (!button2.is(MenuServiceItem_default)) {
return false;
}
const menuServiceItem = button2.as(MenuServiceItem_default);
return menuServiceItem.icon_type === item;
});
if (!button || !button.is(MenuServiceItem_default))
throw new InnertubeError(`Button "${item}" not found.`);
endpoint = button.endpoint;
}
if (!endpoint)
throw new InnertubeError("Target button does not have an endpoint.");
return await endpoint.call(__classPrivateFieldGet(this, _ItemMenu_actions, "f"), { parse: true });
}
items() {
return __classPrivateFieldGet(this, _ItemMenu_items, "f");
}
page() {
return __classPrivateFieldGet(this, _ItemMenu_page, "f");
}
};
__name(ItemMenu, "ItemMenu");
_ItemMenu_page = /* @__PURE__ */ new WeakMap(), _ItemMenu_actions = /* @__PURE__ */ new WeakMap(), _ItemMenu_items = /* @__PURE__ */ new WeakMap();
var ItemMenu_default = ItemMenu;
// dist/src/parser/youtube/Playlist.js
var _Playlist_instances;
var _Playlist_getStat;
var Playlist2 = class extends Feed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
_Playlist_instances.add(this);
const header = this.memo.getType(PlaylistHeader_default)[0];
const primary_info = this.memo.getType(PlaylistSidebarPrimaryInfo_default)[0];
const secondary_info = this.memo.getType(PlaylistSidebarSecondaryInfo_default)[0];
const video_list = this.memo.getType(PlaylistVideoList_default)[0];
const alert = this.page.alerts?.firstOfType(Alert_default);
if (alert && alert.alert_type === "ERROR")
throw new InnertubeError(alert.text.toString(), alert);
if (!primary_info && !secondary_info && Object.keys(this.page).length === 0)
throw new InnertubeError("Got empty continuation response. This is likely the end of the playlist.");
this.info = {
...this.page.metadata?.item().as(PlaylistMetadata_default),
...{
subtitle: header ? header.subtitle : null,
author: secondary_info?.owner?.as(VideoOwner_default).author ?? header?.author,
thumbnails: primary_info?.thumbnail_renderer?.as(PlaylistVideoThumbnail_default, PlaylistCustomThumbnail_default).thumbnail,
total_items: __classPrivateFieldGet(this, _Playlist_instances, "m", _Playlist_getStat).call(this, 0, primary_info),
views: __classPrivateFieldGet(this, _Playlist_instances, "m", _Playlist_getStat).call(this, 1, primary_info),
last_updated: __classPrivateFieldGet(this, _Playlist_instances, "m", _Playlist_getStat).call(this, 2, primary_info),
can_share: header?.can_share,
can_delete: header?.can_delete,
can_reorder: video_list?.can_reorder,
is_editable: video_list?.is_editable,
privacy: header?.privacy
}
};
this.menu = primary_info?.menu;
this.endpoint = primary_info?.endpoint;
this.messages = this.memo.getType(Message_default);
}
get items() {
return observe(this.videos.as(PlaylistVideo_default, ReelItem_default, ShortsLockupView_default).filter((video) => video.style !== "PLAYLIST_VIDEO_RENDERER_STYLE_RECOMMENDED_VIDEO"));
}
get has_continuation() {
const section_list = this.memo.getType(SectionList_default)[0];
if (!section_list)
return super.has_continuation;
return !!this.memo.getType(ContinuationItem_default).find((node) => !section_list.contents.includes(node));
}
async getContinuationData() {
const section_list = this.memo.getType(SectionList_default)[0];
if (!section_list)
return await super.getContinuationData();
const playlist_contents_continuation = this.memo.getType(ContinuationItem_default).find((node) => !section_list.contents.includes(node));
if (!playlist_contents_continuation)
throw new InnertubeError("There are no continuations.");
return await playlist_contents_continuation.endpoint.call(this.actions, { parse: true });
}
async getContinuation() {
const page = await this.getContinuationData();
if (!page)
throw new InnertubeError("Could not get continuation data");
return new Playlist2(this.actions, page, true);
}
};
__name(Playlist2, "Playlist");
_Playlist_instances = /* @__PURE__ */ new WeakSet(), _Playlist_getStat = /* @__PURE__ */ __name(function _Playlist_getStat2(index, primary_info) {
if (!primary_info || !primary_info.stats)
return "N/A";
return primary_info.stats[index]?.toString() || "N/A";
}, "_Playlist_getStat");
var Playlist_default2 = Playlist2;
// dist/src/parser/youtube/Library.js
var _Library_instances;
var _Library_getAll;
var Library = class extends Feed_default {
constructor(actions, data2) {
super(actions, data2);
_Library_instances.add(this);
if (!this.page.contents_memo)
throw new InnertubeError("Page contents not found");
this.header = this.memo.getType(PageHeader_default)[0];
const shelves = this.page.contents_memo.getType(Shelf_default);
this.sections = shelves.map((shelf) => ({
type: shelf.icon_type,
title: shelf.title,
contents: shelf.content?.key("items").array() || [],
getAll: () => __classPrivateFieldGet(this, _Library_instances, "m", _Library_getAll).call(this, shelf)
}));
}
get history() {
return this.sections.find((section) => section.type === "WATCH_HISTORY");
}
get watch_later() {
return this.sections.find((section) => section.type === "WATCH_LATER");
}
get liked_videos() {
return this.sections.find((section) => section.type === "LIKE");
}
get playlists_section() {
return this.sections.find((section) => section.type === "PLAYLISTS");
}
get clips() {
return this.sections.find((section) => section.type === "CONTENT_CUT");
}
};
__name(Library, "Library");
_Library_instances = /* @__PURE__ */ new WeakSet(), _Library_getAll = /* @__PURE__ */ __name(async function _Library_getAll2(shelf) {
if (!shelf.menu?.as(Menu_default).top_level_buttons)
throw new InnertubeError(`The ${shelf.title.text} shelf doesn't have more items`);
const button = shelf.menu.as(Menu_default).top_level_buttons.firstOfType(Button_default);
if (!button)
throw new InnertubeError("Did not find target button.");
const page = await button.as(Button_default).endpoint.call(this.actions, { parse: true });
switch (shelf.icon_type) {
case "LIKE":
case "WATCH_LATER":
return new Playlist_default2(this.actions, page, true);
case "WATCH_HISTORY":
return new History(this.actions, page, true);
case "CONTENT_CUT":
return new Feed_default(this.actions, page, true);
default:
throw new InnertubeError("Target shelf not implemented.");
}
}, "_Library_getAll");
var Library_default = Library;
// dist/src/parser/youtube/SmoothedQueue.js
var _SmoothedQueue_last_update_time;
var _SmoothedQueue_estimated_update_interval;
var _SmoothedQueue_callback;
var _SmoothedQueue_action_queue;
var _SmoothedQueue_next_update_id;
var _SmoothedQueue_poll_response_delay_queue;
function flattenQueue(queue) {
const nodes = [];
for (const group of queue) {
if (Array.isArray(group)) {
for (const node of group) {
nodes.push(node);
}
} else {
nodes.push(group);
}
}
return nodes;
}
__name(flattenQueue, "flattenQueue");
var DelayQueue = class {
constructor() {
this.front = [];
this.back = [];
}
isEmpty() {
return !this.front.length && !this.back.length;
}
clear() {
this.front = [];
this.back = [];
}
getValues() {
return this.front.concat(this.back.reverse());
}
};
__name(DelayQueue, "DelayQueue");
var SmoothedQueue = class {
constructor() {
_SmoothedQueue_last_update_time.set(this, void 0);
_SmoothedQueue_estimated_update_interval.set(this, void 0);
_SmoothedQueue_callback.set(this, void 0);
_SmoothedQueue_action_queue.set(this, void 0);
_SmoothedQueue_next_update_id.set(this, void 0);
_SmoothedQueue_poll_response_delay_queue.set(this, void 0);
__classPrivateFieldSet(this, _SmoothedQueue_last_update_time, null, "f");
__classPrivateFieldSet(this, _SmoothedQueue_estimated_update_interval, null, "f");
__classPrivateFieldSet(this, _SmoothedQueue_callback, null, "f");
__classPrivateFieldSet(this, _SmoothedQueue_action_queue, [], "f");
__classPrivateFieldSet(this, _SmoothedQueue_next_update_id, null, "f");
__classPrivateFieldSet(this, _SmoothedQueue_poll_response_delay_queue, new DelayQueue(), "f");
}
enqueueActionGroup(group) {
if (__classPrivateFieldGet(this, _SmoothedQueue_last_update_time, "f") !== null) {
const delay = Date.now() - __classPrivateFieldGet(this, _SmoothedQueue_last_update_time, "f");
__classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f").back.push(delay);
if (5 < __classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f").front.length + __classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f").back.length) {
if (!__classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f").front.length) {
__classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f").front = __classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f").back;
__classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f").front.reverse();
__classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f").back = [];
}
__classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f").front.pop();
}
__classPrivateFieldSet(this, _SmoothedQueue_estimated_update_interval, Math.max(...__classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f").getValues()), "f");
}
__classPrivateFieldSet(this, _SmoothedQueue_last_update_time, Date.now(), "f");
__classPrivateFieldGet(this, _SmoothedQueue_action_queue, "f").push(group);
if (__classPrivateFieldGet(this, _SmoothedQueue_next_update_id, "f") === null) {
__classPrivateFieldSet(this, _SmoothedQueue_next_update_id, setTimeout(this.emitSmoothedActions.bind(this)), "f");
}
}
emitSmoothedActions() {
__classPrivateFieldSet(this, _SmoothedQueue_next_update_id, null, "f");
if (__classPrivateFieldGet(this, _SmoothedQueue_action_queue, "f").length) {
let delay = 1e4;
if (__classPrivateFieldGet(this, _SmoothedQueue_estimated_update_interval, "f") !== null && __classPrivateFieldGet(this, _SmoothedQueue_last_update_time, "f") !== null) {
delay = __classPrivateFieldGet(this, _SmoothedQueue_estimated_update_interval, "f") - Date.now() + __classPrivateFieldGet(this, _SmoothedQueue_last_update_time, "f");
}
delay = __classPrivateFieldGet(this, _SmoothedQueue_action_queue, "f").length < delay / 80 ? 1 : Math.ceil(__classPrivateFieldGet(this, _SmoothedQueue_action_queue, "f").length / (delay / 80));
const actions = flattenQueue(__classPrivateFieldGet(this, _SmoothedQueue_action_queue, "f").splice(0, delay));
if (__classPrivateFieldGet(this, _SmoothedQueue_callback, "f")) {
__classPrivateFieldGet(this, _SmoothedQueue_callback, "f").call(this, actions);
}
if (__classPrivateFieldGet(this, _SmoothedQueue_action_queue, "f") !== null) {
if (delay == 1) {
delay = __classPrivateFieldGet(this, _SmoothedQueue_estimated_update_interval, "f") / __classPrivateFieldGet(this, _SmoothedQueue_action_queue, "f").length;
delay *= Math.random() + 0.5;
delay = Math.min(1e3, delay);
delay = Math.max(80, delay);
} else {
delay = 80;
}
__classPrivateFieldSet(this, _SmoothedQueue_next_update_id, setTimeout(this.emitSmoothedActions.bind(this), delay), "f");
}
}
}
clear() {
if (__classPrivateFieldGet(this, _SmoothedQueue_next_update_id, "f") !== null) {
clearTimeout(__classPrivateFieldGet(this, _SmoothedQueue_next_update_id, "f"));
__classPrivateFieldSet(this, _SmoothedQueue_next_update_id, null, "f");
}
__classPrivateFieldSet(this, _SmoothedQueue_action_queue, [], "f");
}
set callback(cb) {
__classPrivateFieldSet(this, _SmoothedQueue_callback, cb, "f");
}
get callback() {
return __classPrivateFieldGet(this, _SmoothedQueue_callback, "f");
}
get action_queue() {
return __classPrivateFieldGet(this, _SmoothedQueue_action_queue, "f");
}
get estimated_update_interval() {
return __classPrivateFieldGet(this, _SmoothedQueue_estimated_update_interval, "f");
}
get last_update_time() {
return __classPrivateFieldGet(this, _SmoothedQueue_last_update_time, "f");
}
get next_update_id() {
return __classPrivateFieldGet(this, _SmoothedQueue_next_update_id, "f");
}
get poll_response_delay_queue() {
return __classPrivateFieldGet(this, _SmoothedQueue_poll_response_delay_queue, "f");
}
};
__name(SmoothedQueue, "SmoothedQueue");
_SmoothedQueue_last_update_time = /* @__PURE__ */ new WeakMap(), _SmoothedQueue_estimated_update_interval = /* @__PURE__ */ new WeakMap(), _SmoothedQueue_callback = /* @__PURE__ */ new WeakMap(), _SmoothedQueue_action_queue = /* @__PURE__ */ new WeakMap(), _SmoothedQueue_next_update_id = /* @__PURE__ */ new WeakMap(), _SmoothedQueue_poll_response_delay_queue = /* @__PURE__ */ new WeakMap();
var SmoothedQueue_default = SmoothedQueue;
// dist/src/parser/youtube/LiveChat.js
var _LiveChat_instances;
var _LiveChat_actions;
var _LiveChat_video_id;
var _LiveChat_channel_id;
var _LiveChat_continuation;
var _LiveChat_mcontinuation;
var _LiveChat_retry_count;
var _LiveChat_pollLivechat;
var _LiveChat_emitSmoothedActions;
var _LiveChat_pollMetadata;
var _LiveChat_wait;
var LiveChat2 = class extends EventEmitterLike_default {
constructor(video_info) {
super();
_LiveChat_instances.add(this);
_LiveChat_actions.set(this, void 0);
_LiveChat_video_id.set(this, void 0);
_LiveChat_channel_id.set(this, void 0);
_LiveChat_continuation.set(this, void 0);
_LiveChat_mcontinuation.set(this, void 0);
_LiveChat_retry_count.set(this, 0);
this.running = false;
this.is_replay = false;
__classPrivateFieldSet(this, _LiveChat_video_id, video_info.basic_info.id, "f");
__classPrivateFieldSet(this, _LiveChat_channel_id, video_info.basic_info.channel_id, "f");
__classPrivateFieldSet(this, _LiveChat_actions, video_info.actions, "f");
__classPrivateFieldSet(this, _LiveChat_continuation, video_info.livechat?.continuation, "f");
this.is_replay = video_info.livechat?.is_replay || false;
this.smoothed_queue = new SmoothedQueue_default();
this.smoothed_queue.callback = async (actions) => {
if (!actions.length) {
await __classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_wait).call(this, 2e3);
} else if (actions.length < 10) {
await __classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_emitSmoothedActions).call(this, actions);
} else if (this.is_replay) {
__classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_emitSmoothedActions).call(this, actions);
await __classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_wait).call(this, 2e3);
} else {
__classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_emitSmoothedActions).call(this, actions);
}
if (this.running) {
__classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_pollLivechat).call(this);
}
};
}
on(type, listener) {
super.on(type, listener);
}
once(type, listener) {
super.once(type, listener);
}
start() {
if (!this.running) {
this.running = true;
__classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_pollLivechat).call(this);
__classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_pollMetadata).call(this);
}
}
stop() {
this.smoothed_queue.clear();
this.running = false;
}
async sendMessage(text) {
const writer = LiveMessageParams.encode({
params: {
ids: {
videoId: __classPrivateFieldGet(this, _LiveChat_video_id, "f"),
channelId: __classPrivateFieldGet(this, _LiveChat_channel_id, "f")
}
},
number0: 1,
number1: 4
});
const params = btoa(encodeURIComponent(u8ToBase64(writer.finish())));
const response = await __classPrivateFieldGet(this, _LiveChat_actions, "f").execute("/live_chat/send_message", {
richMessage: { textSegments: [{ text }] },
clientMessageId: Platform.shim.uuidv4(),
client: "WEB",
parse: true,
params
});
if (!response.actions)
throw new InnertubeError("Unexpected response from send_message", response);
return response.actions.array().as(AddChatItemAction_default, RunAttestationCommand_default);
}
applyFilter(filter) {
if (!this.initial_info)
throw new InnertubeError("Cannot apply filter before initial info is retrieved.");
const menu_items = this.initial_info?.header?.view_selector?.sub_menu_items;
if (filter === "TOP_CHAT") {
if (menu_items?.at(0)?.selected)
return;
__classPrivateFieldSet(this, _LiveChat_continuation, menu_items?.at(0)?.continuation, "f");
} else {
if (menu_items?.at(1)?.selected)
return;
__classPrivateFieldSet(this, _LiveChat_continuation, menu_items?.at(1)?.continuation, "f");
}
}
async getItemMenu(item) {
if (!item.hasKey("menu_endpoint") || !item.key("menu_endpoint").isInstanceof(NavigationEndpoint_default))
throw new InnertubeError("This item does not have a menu.", item);
const response = await item.key("menu_endpoint").instanceof(NavigationEndpoint_default).call(__classPrivateFieldGet(this, _LiveChat_actions, "f"), { parse: true });
if (!response)
throw new InnertubeError("Could not retrieve item menu.", item);
return new ItemMenu_default(response, __classPrivateFieldGet(this, _LiveChat_actions, "f"));
}
async selectButton(button) {
return await button.endpoint.call(__classPrivateFieldGet(this, _LiveChat_actions, "f"), { parse: true });
}
};
__name(LiveChat2, "LiveChat");
_LiveChat_actions = /* @__PURE__ */ new WeakMap(), _LiveChat_video_id = /* @__PURE__ */ new WeakMap(), _LiveChat_channel_id = /* @__PURE__ */ new WeakMap(), _LiveChat_continuation = /* @__PURE__ */ new WeakMap(), _LiveChat_mcontinuation = /* @__PURE__ */ new WeakMap(), _LiveChat_retry_count = /* @__PURE__ */ new WeakMap(), _LiveChat_instances = /* @__PURE__ */ new WeakSet(), _LiveChat_pollLivechat = /* @__PURE__ */ __name(function _LiveChat_pollLivechat2() {
(async () => {
var _a2, _b;
try {
const response = await __classPrivateFieldGet(this, _LiveChat_actions, "f").execute(this.is_replay ? "live_chat/get_live_chat_replay" : "live_chat/get_live_chat", { continuation: __classPrivateFieldGet(this, _LiveChat_continuation, "f"), parse: true });
const contents = response.continuation_contents;
if (!contents) {
this.emit("error", new InnertubeError("Unexpected live chat incremental continuation response", response));
this.emit("end");
this.stop();
}
if (!(contents instanceof LiveChatContinuation)) {
this.stop();
this.emit("end");
return;
}
__classPrivateFieldSet(this, _LiveChat_continuation, contents.continuation.token, "f");
if (contents.header) {
this.initial_info = contents;
this.emit("start", contents);
if (this.running)
__classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_pollLivechat2).call(this);
} else {
this.smoothed_queue.enqueueActionGroup(contents.actions);
}
__classPrivateFieldSet(this, _LiveChat_retry_count, 0, "f");
} catch (err) {
this.emit("error", err);
if ((__classPrivateFieldSet(this, _LiveChat_retry_count, (_b = __classPrivateFieldGet(this, _LiveChat_retry_count, "f"), _a2 = _b++, _b), "f"), _a2) < 10) {
await __classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_wait).call(this, 2e3);
__classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_pollLivechat2).call(this);
} else {
this.emit("error", new InnertubeError("Reached retry limit for incremental continuation requests", err));
this.emit("end");
this.stop();
}
}
})();
}, "_LiveChat_pollLivechat"), _LiveChat_emitSmoothedActions = /* @__PURE__ */ __name(async function _LiveChat_emitSmoothedActions2(action_queue) {
const base = 1e4;
let delay = action_queue.length < base / 80 ? 1 : Math.ceil(action_queue.length / (base / 80));
const emit_delay_ms = delay == 1 ? (delay = base / action_queue.length, delay *= Math.random() + 0.5, delay = Math.min(1e3, delay), delay = Math.max(80, delay)) : delay = 80;
for (const action of action_queue) {
await __classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_wait).call(this, emit_delay_ms);
this.emit("chat-update", action);
}
}, "_LiveChat_emitSmoothedActions"), _LiveChat_pollMetadata = /* @__PURE__ */ __name(function _LiveChat_pollMetadata2() {
(async () => {
try {
const payload = { videoId: __classPrivateFieldGet(this, _LiveChat_video_id, "f") };
if (__classPrivateFieldGet(this, _LiveChat_mcontinuation, "f")) {
payload.continuation = __classPrivateFieldGet(this, _LiveChat_mcontinuation, "f");
}
const response = await __classPrivateFieldGet(this, _LiveChat_actions, "f").execute("/updated_metadata", payload);
const data2 = parser_exports.parseResponse(response.data);
__classPrivateFieldSet(this, _LiveChat_mcontinuation, data2.continuation?.token, "f");
this.metadata = {
title: data2.actions?.array().firstOfType(UpdateTitleAction_default) || this.metadata?.title,
description: data2.actions?.array().firstOfType(UpdateDescriptionAction_default) || this.metadata?.description,
views: data2.actions?.array().firstOfType(UpdateViewershipAction_default) || this.metadata?.views,
likes: data2.actions?.array().firstOfType(UpdateToggleButtonTextAction_default) || this.metadata?.likes,
date: data2.actions?.array().firstOfType(UpdateDateTextAction_default) || this.metadata?.date
};
this.emit("metadata-update", this.metadata);
await __classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_wait).call(this, 5e3);
if (this.running)
__classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_pollMetadata2).call(this);
} catch {
await __classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_wait).call(this, 2e3);
if (this.running)
__classPrivateFieldGet(this, _LiveChat_instances, "m", _LiveChat_pollMetadata2).call(this);
}
})();
}, "_LiveChat_pollMetadata"), _LiveChat_wait = /* @__PURE__ */ __name(async function _LiveChat_wait2(ms) {
return new Promise((resolve) => setTimeout(() => resolve(), ms));
}, "_LiveChat_wait");
var LiveChat_default2 = LiveChat2;
// dist/src/parser/youtube/NotificationsMenu.js
var _NotificationsMenu_page;
var _NotificationsMenu_actions;
var NotificationsMenu = class {
constructor(actions, response) {
_NotificationsMenu_page.set(this, void 0);
_NotificationsMenu_actions.set(this, void 0);
__classPrivateFieldSet(this, _NotificationsMenu_actions, actions, "f");
__classPrivateFieldSet(this, _NotificationsMenu_page, parser_exports.parseResponse(response.data), "f");
if (!__classPrivateFieldGet(this, _NotificationsMenu_page, "f").actions_memo)
throw new InnertubeError("Page actions not found");
this.header = __classPrivateFieldGet(this, _NotificationsMenu_page, "f").actions_memo.getType(SimpleMenuHeader_default)[0];
this.contents = __classPrivateFieldGet(this, _NotificationsMenu_page, "f").actions_memo.getType(Notification_default);
}
async getContinuation() {
const continuation = __classPrivateFieldGet(this, _NotificationsMenu_page, "f").actions_memo?.getType(ContinuationItem_default)[0];
if (!continuation)
throw new InnertubeError("Continuation not found");
const response = await continuation.endpoint.call(__classPrivateFieldGet(this, _NotificationsMenu_actions, "f"), { parse: false });
return new NotificationsMenu(__classPrivateFieldGet(this, _NotificationsMenu_actions, "f"), response);
}
get page() {
return __classPrivateFieldGet(this, _NotificationsMenu_page, "f");
}
};
__name(NotificationsMenu, "NotificationsMenu");
_NotificationsMenu_page = /* @__PURE__ */ new WeakMap(), _NotificationsMenu_actions = /* @__PURE__ */ new WeakMap();
var NotificationsMenu_default = NotificationsMenu;
// dist/src/parser/youtube/Search.js
var Search = class extends Feed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
const contents = this.page.contents_memo?.getType(SectionList_default)[0].contents || this.page.on_response_received_commands?.[0].as(AppendContinuationItemsAction_default, ReloadContinuationItemsCommand).contents;
if (!contents)
throw new InnertubeError("No contents found in search response");
if (this.page.header)
this.header = this.page.header.item().as(SearchHeader_default);
this.results = observe(contents.filterType(ItemSection_default).flatMap((section) => section.contents));
this.refinements = this.page.refinements || [];
this.estimated_results = this.page.estimated_results || 0;
if (this.page.contents_memo) {
this.sub_menu = this.page.contents_memo.getType(SearchSubMenu_default)[0];
this.watch_card = this.page.contents_memo.getType(UniversalWatchCard_default)[0];
}
this.refinement_cards = this.results?.firstOfType(HorizontalCardList_default);
}
async selectRefinementCard(card) {
let target_card;
if (typeof card === "string") {
if (!this.refinement_cards)
throw new InnertubeError("No refinement cards found.");
target_card = this.refinement_cards?.cards.get({ query: card })?.as(SearchRefinementCard_default);
if (!target_card)
throw new InnertubeError(`Refinement card "${card}" not found`, { available_cards: this.refinement_card_queries });
} else if (card.type === "SearchRefinementCard") {
target_card = card;
} else {
throw new InnertubeError("Invalid refinement card!");
}
const page = await target_card.endpoint.call(this.actions, { parse: true });
return new Search(this.actions, page, true);
}
get refinement_card_queries() {
return this.refinement_cards?.cards.as(SearchRefinementCard_default).map((card) => card.query) || [];
}
async getContinuation() {
const response = await this.getContinuationData();
if (!response)
throw new InnertubeError("Could not get continuation data");
return new Search(this.actions, response, true);
}
};
__name(Search, "Search");
// dist/src/parser/youtube/Settings.js
var _Settings_page;
var _Settings_actions;
var Settings = class {
constructor(actions, response) {
_Settings_page.set(this, void 0);
_Settings_actions.set(this, void 0);
__classPrivateFieldSet(this, _Settings_actions, actions, "f");
__classPrivateFieldSet(this, _Settings_page, parser_exports.parseResponse(response.data), "f");
this.sidebar = __classPrivateFieldGet(this, _Settings_page, "f").sidebar?.as(SettingsSidebar_default);
if (!__classPrivateFieldGet(this, _Settings_page, "f").contents)
throw new InnertubeError("Page contents not found");
const tab = __classPrivateFieldGet(this, _Settings_page, "f").contents.item().as(TwoColumnBrowseResults_default).tabs.array().as(Tab_default).get({ selected: true });
if (!tab)
throw new InnertubeError("Target tab not found");
const contents = tab.content?.as(SectionList_default).contents.as(ItemSection_default);
this.introduction = contents?.shift()?.contents?.firstOfType(PageIntroduction_default);
this.sections = contents?.map((el) => ({
title: el.header?.is(CommentsHeader_default, ItemSectionHeader_default, ItemSectionTabbedHeader_default) ? el.header.title.toString() : null,
contents: el.contents
}));
}
async selectSidebarItem(target_item) {
if (!this.sidebar)
throw new InnertubeError("Sidebar not available");
let item;
if (typeof target_item === "string") {
item = this.sidebar.items.get({ title: target_item });
if (!item)
throw new InnertubeError(`Item "${target_item}" not found`, { available_items: this.sidebar_items });
} else if (target_item?.is(CompactLink_default)) {
item = target_item;
} else {
throw new InnertubeError("Invalid item", { target_item });
}
const response = await item.endpoint.call(__classPrivateFieldGet(this, _Settings_actions, "f"), { parse: false });
return new Settings(__classPrivateFieldGet(this, _Settings_actions, "f"), response);
}
getSettingOption(name) {
if (!this.sections)
throw new InnertubeError("Sections not available");
for (const section of this.sections) {
if (!section.contents)
continue;
for (const el of section.contents) {
const options = el.as(SettingsOptions_default).options;
if (options) {
for (const option of options) {
if (option.is(SettingsSwitch_default) && option.title?.toString() === name)
return option;
}
}
}
}
throw new InnertubeError(`Option "${name}" not found`, { available_options: this.setting_options });
}
get setting_options() {
if (!this.sections)
throw new InnertubeError("Sections not available");
let options = [];
for (const section of this.sections) {
if (!section.contents)
continue;
for (const el of section.contents) {
if (el.as(SettingsOptions_default).options)
options = options.concat(el.as(SettingsOptions_default).options);
}
}
return options.map((opt) => opt.title?.toString()).filter((el) => el);
}
get sidebar_items() {
if (!this.sidebar)
throw new InnertubeError("Sidebar not available");
return this.sidebar.items.map((item) => item.title.toString());
}
get page() {
return __classPrivateFieldGet(this, _Settings_page, "f");
}
};
__name(Settings, "Settings");
_Settings_page = /* @__PURE__ */ new WeakMap(), _Settings_actions = /* @__PURE__ */ new WeakMap();
var Settings_default = Settings;
// dist/src/parser/youtube/VideoInfo.js
var _VideoInfo_watch_next_continuation;
var VideoInfo = class extends MediaInfo_default {
constructor(data2, actions, cpn) {
super(data2, actions, cpn);
_VideoInfo_watch_next_continuation.set(this, void 0);
const [info2, next] = this.page;
if (this.streaming_data) {
const default_audio_track = this.streaming_data.adaptive_formats.find((format) => format.audio_track?.audio_is_default);
if (default_audio_track) {
this.streaming_data.formats.forEach((format) => format.language = default_audio_track.language);
} else if (this.captions?.caption_tracks && this.captions?.caption_tracks.length > 0) {
const auto_generated_caption_track = this.captions.caption_tracks.find((caption) => caption.kind === "asr");
const language_code = auto_generated_caption_track?.language_code;
this.streaming_data.adaptive_formats.forEach((format) => {
if (format.has_audio) {
format.language = language_code;
}
});
this.streaming_data.formats.forEach((format) => format.language = language_code);
}
}
const two_col = next?.contents?.item().as(TwoColumnWatchNextResults_default);
const results = two_col?.results;
const secondary_results = two_col?.secondary_results;
if (results && secondary_results) {
if (info2.microformat?.is(PlayerMicroformat_default) && info2.microformat?.category === "Gaming") {
const row = results.firstOfType(VideoSecondaryInfo_default)?.metadata?.rows?.firstOfType(RichMetadataRow_default);
if (row?.is(RichMetadataRow_default)) {
this.game_info = {
title: row?.contents?.firstOfType(RichMetadata_default)?.title,
release_year: row?.contents?.firstOfType(RichMetadata_default)?.subtitle
};
}
}
this.primary_info = results.firstOfType(VideoPrimaryInfo_default);
this.secondary_info = results.firstOfType(VideoSecondaryInfo_default);
this.merchandise = results.firstOfType(MerchandiseShelf_default);
this.related_chip_cloud = secondary_results.firstOfType(RelatedChipCloud_default)?.content.as(ChipCloud_default);
if (two_col?.playlist) {
this.playlist = two_col.playlist;
}
this.watch_next_feed = secondary_results.firstOfType(ItemSection_default)?.contents || secondary_results;
if (this.watch_next_feed && Array.isArray(this.watch_next_feed) && this.watch_next_feed.at(-1)?.is(ContinuationItem_default))
__classPrivateFieldSet(this, _VideoInfo_watch_next_continuation, this.watch_next_feed.pop()?.as(ContinuationItem_default), "f");
this.player_overlays = next?.player_overlays?.item().as(PlayerOverlay_default);
if (two_col?.autoplay) {
this.autoplay = two_col.autoplay;
}
const segmented_like_dislike_button = this.primary_info?.menu?.top_level_buttons.firstOfType(SegmentedLikeDislikeButton_default);
if (segmented_like_dislike_button?.like_button?.is(ToggleButton_default) && segmented_like_dislike_button?.dislike_button?.is(ToggleButton_default)) {
this.basic_info.like_count = segmented_like_dislike_button?.like_button?.like_count;
this.basic_info.is_liked = segmented_like_dislike_button?.like_button?.is_toggled;
this.basic_info.is_disliked = segmented_like_dislike_button?.dislike_button?.is_toggled;
}
const segmented_like_dislike_button_view = this.primary_info?.menu?.top_level_buttons.firstOfType(SegmentedLikeDislikeButtonView_default);
if (segmented_like_dislike_button_view) {
this.basic_info.like_count = segmented_like_dislike_button_view.like_count;
if (segmented_like_dislike_button_view.like_button) {
const like_status = segmented_like_dislike_button_view.like_button.like_status_entity.like_status;
this.basic_info.is_liked = like_status === "LIKE";
this.basic_info.is_disliked = like_status === "DISLIKE";
}
}
const comments_entry_point = results.get({ target_id: "comments-entry-point" })?.as(ItemSection_default);
this.comments_entry_point_header = comments_entry_point?.contents?.firstOfType(CommentsEntryPointHeader_default);
this.livechat = next?.contents_memo?.getType(LiveChat_default)[0];
}
}
async selectFilter(target_filter) {
if (!this.related_chip_cloud)
throw new InnertubeError("Chip cloud not found, cannot apply filter");
let cloud_chip;
if (typeof target_filter === "string") {
const filter = this.related_chip_cloud?.chips?.get({ text: target_filter });
if (!filter)
throw new InnertubeError("Invalid filter", { available_filters: this.filters });
cloud_chip = filter;
} else if (target_filter?.is(ChipCloudChip_default)) {
cloud_chip = target_filter;
} else {
throw new InnertubeError("Invalid cloud chip", target_filter);
}
if (cloud_chip.is_selected)
return this;
const response = await cloud_chip.endpoint?.call(this.actions, { parse: true });
const data2 = response?.on_response_received_endpoints?.get({ target_id: "watch-next-feed" });
this.watch_next_feed = data2?.as(AppendContinuationItemsAction_default, ReloadContinuationItemsCommand).contents;
return this;
}
async addToWatchHistory() {
return super.addToWatchHistory();
}
async getWatchNextContinuation() {
if (!__classPrivateFieldGet(this, _VideoInfo_watch_next_continuation, "f"))
throw new InnertubeError("Watch next feed continuation not found");
const response = await __classPrivateFieldGet(this, _VideoInfo_watch_next_continuation, "f")?.endpoint.call(this.actions, { parse: true });
const data2 = response?.on_response_received_endpoints?.get({ type: "AppendContinuationItemsAction" });
if (!data2)
throw new InnertubeError("AppendContinuationItemsAction not found");
this.watch_next_feed = data2?.as(AppendContinuationItemsAction_default, ReloadContinuationItemsCommand).contents;
if (this.watch_next_feed?.at(-1)?.is(ContinuationItem_default)) {
__classPrivateFieldSet(this, _VideoInfo_watch_next_continuation, this.watch_next_feed.pop()?.as(ContinuationItem_default), "f");
} else {
__classPrivateFieldSet(this, _VideoInfo_watch_next_continuation, void 0, "f");
}
return this;
}
async like() {
const segmented_like_dislike_button_view = this.primary_info?.menu?.top_level_buttons.firstOfType(SegmentedLikeDislikeButtonView_default);
if (segmented_like_dislike_button_view) {
const button2 = segmented_like_dislike_button_view?.like_button?.toggle_button;
if (!button2 || !button2.default_button || !segmented_like_dislike_button_view.like_button)
throw new InnertubeError("Like button not found", { video_id: this.basic_info.id });
const like_status = segmented_like_dislike_button_view.like_button.like_status_entity.like_status;
if (like_status === "LIKE")
throw new InnertubeError("This video is already liked", { video_id: this.basic_info.id });
const endpoint = new NavigationEndpoint_default(button2.default_button.on_tap.payload.commands.find((cmd) => cmd.innertubeCommand));
return await endpoint.call(this.actions);
}
const segmented_like_dislike_button = this.primary_info?.menu?.top_level_buttons.firstOfType(SegmentedLikeDislikeButton_default);
const button = segmented_like_dislike_button?.like_button;
if (!button)
throw new InnertubeError("Like button not found", { video_id: this.basic_info.id });
if (!button.is(ToggleButton_default))
throw new InnertubeError("Like button is not a toggle button. This action is likely disabled for this video.", { video_id: this.basic_info.id });
if (button.is_toggled)
throw new InnertubeError("This video is already liked", { video_id: this.basic_info.id });
return await button.endpoint.call(this.actions);
}
async dislike() {
const segmented_like_dislike_button_view = this.primary_info?.menu?.top_level_buttons.firstOfType(SegmentedLikeDislikeButtonView_default);
if (segmented_like_dislike_button_view) {
const button2 = segmented_like_dislike_button_view?.dislike_button?.toggle_button;
if (!button2 || !button2.default_button || !segmented_like_dislike_button_view.dislike_button || !segmented_like_dislike_button_view.like_button)
throw new InnertubeError("Dislike button not found", { video_id: this.basic_info.id });
const like_status = segmented_like_dislike_button_view.like_button.like_status_entity.like_status;
if (like_status === "DISLIKE")
throw new InnertubeError("This video is already disliked", { video_id: this.basic_info.id });
const endpoint = new NavigationEndpoint_default(button2.default_button.on_tap.payload.commands.find((cmd) => cmd.innertubeCommand));
return await endpoint.call(this.actions);
}
const segmented_like_dislike_button = this.primary_info?.menu?.top_level_buttons.firstOfType(SegmentedLikeDislikeButton_default);
const button = segmented_like_dislike_button?.dislike_button;
if (!button)
throw new InnertubeError("Dislike button not found", { video_id: this.basic_info.id });
if (!button.is(ToggleButton_default))
throw new InnertubeError("Dislike button is not a toggle button. This action is likely disabled for this video.", { video_id: this.basic_info.id });
if (button.is_toggled)
throw new InnertubeError("This video is already disliked", { video_id: this.basic_info.id });
return await button.endpoint.call(this.actions);
}
async removeRating() {
let button;
const segmented_like_dislike_button_view = this.primary_info?.menu?.top_level_buttons.firstOfType(SegmentedLikeDislikeButtonView_default);
if (segmented_like_dislike_button_view) {
const toggle_button = segmented_like_dislike_button_view?.like_button?.toggle_button;
if (!toggle_button || !toggle_button.default_button || !segmented_like_dislike_button_view.like_button)
throw new InnertubeError("Like button not found", { video_id: this.basic_info.id });
const like_status = segmented_like_dislike_button_view.like_button.like_status_entity.like_status;
if (like_status === "LIKE") {
button = segmented_like_dislike_button_view?.like_button?.toggle_button;
} else if (like_status === "DISLIKE") {
button = segmented_like_dislike_button_view?.dislike_button?.toggle_button;
} else {
throw new InnertubeError("This video is not liked/disliked", { video_id: this.basic_info.id });
}
if (!button || !button.toggled_button)
throw new InnertubeError("Like/Dislike button not found", { video_id: this.basic_info.id });
const endpoint = new NavigationEndpoint_default(button.toggled_button.on_tap.payload.commands.find((cmd) => cmd.innertubeCommand));
return await endpoint.call(this.actions);
}
const segmented_like_dislike_button = this.primary_info?.menu?.top_level_buttons.firstOfType(SegmentedLikeDislikeButton_default);
const like_button = segmented_like_dislike_button?.like_button;
const dislike_button = segmented_like_dislike_button?.dislike_button;
if (!like_button?.is(ToggleButton_default) || !dislike_button?.is(ToggleButton_default))
throw new InnertubeError("Like/Dislike button is not a toggle button. This action is likely disabled for this video.", { video_id: this.basic_info.id });
if (like_button?.is_toggled) {
button = like_button;
} else if (dislike_button?.is_toggled) {
button = dislike_button;
}
if (!button)
throw new InnertubeError("This video is not liked/disliked", { video_id: this.basic_info.id });
return await button.toggled_endpoint.call(this.actions);
}
getLiveChat() {
if (!this.livechat)
throw new InnertubeError("Live Chat is not available", { video_id: this.basic_info.id });
return new LiveChat_default2(this);
}
getTrailerInfo() {
if (this.has_trailer && this.playability_status?.error_screen) {
let player_response;
if (this.playability_status.error_screen.is(PlayerLegacyDesktopYpcTrailer_default)) {
player_response = this.playability_status.error_screen.trailer?.player_response;
} else if (this.playability_status.error_screen.is(YpcTrailer_default)) {
player_response = this.playability_status.error_screen.player_response;
}
if (player_response) {
return new VideoInfo([{ data: player_response }], this.actions, this.cpn);
}
}
return null;
}
get filters() {
return this.related_chip_cloud?.chips?.map((chip) => chip.text?.toString()) || [];
}
get wn_has_continuation() {
return !!__classPrivateFieldGet(this, _VideoInfo_watch_next_continuation, "f");
}
get autoplay_video_endpoint() {
return this.autoplay?.sets?.[0]?.autoplay_video || null;
}
get has_trailer() {
return !!this.playability_status?.error_screen?.is(PlayerLegacyDesktopYpcTrailer_default, YpcTrailer_default);
}
get music_tracks() {
const description_content = this.page[1]?.engagement_panels?.filter((panel) => panel.content?.is(StructuredDescriptionContent_default));
if (description_content !== void 0 && description_content.length > 0) {
const music_section = description_content[0].content?.as(StructuredDescriptionContent_default)?.items?.filterType(VideoDescriptionMusicSection_default);
if (music_section !== void 0 && music_section.length > 0) {
return music_section[0].carousel_lockups?.map((lookup) => {
let song;
let artist;
let album;
let license;
let videoId;
let channelId;
song = lookup.video_lockup?.title?.toString();
videoId = lookup.video_lockup?.endpoint.payload.videoId;
for (let i = 0; i < lookup.info_rows.length; i++) {
const info_row = lookup.info_rows[i];
if (info_row.info_row_expand_status_key === void 0) {
if (song === void 0) {
song = info_row.default_metadata?.toString() || info_row.expanded_metadata?.toString();
if (videoId === void 0) {
const endpoint = info_row.default_metadata?.endpoint || info_row.expanded_metadata?.endpoint;
videoId = endpoint?.payload?.videoId;
}
} else {
album = info_row.default_metadata?.toString() || info_row.expanded_metadata?.toString();
}
} else {
if (info_row.info_row_expand_status_key?.indexOf("structured-description-music-section-artists-row-state-id") !== -1) {
artist = info_row.default_metadata?.toString() || info_row.expanded_metadata?.toString();
if (channelId === void 0) {
const endpoint = info_row.default_metadata?.endpoint || info_row.expanded_metadata?.endpoint;
channelId = endpoint?.payload?.browseId;
}
}
if (info_row.info_row_expand_status_key?.indexOf("structured-description-music-section-licenses-row-state-id") !== -1) {
license = info_row.default_metadata?.toString() || info_row.expanded_metadata?.toString();
}
}
}
return { song, artist, album, license, videoId, channelId };
});
}
}
return [];
}
};
__name(VideoInfo, "VideoInfo");
_VideoInfo_watch_next_continuation = /* @__PURE__ */ new WeakMap();
var VideoInfo_default = VideoInfo;
// dist/src/parser/youtube/TranscriptInfo.js
var _TranscriptInfo_page;
var _TranscriptInfo_actions;
var TranscriptInfo = class {
constructor(actions, response) {
_TranscriptInfo_page.set(this, void 0);
_TranscriptInfo_actions.set(this, void 0);
__classPrivateFieldSet(this, _TranscriptInfo_page, parser_exports.parseResponse(response.data), "f");
__classPrivateFieldSet(this, _TranscriptInfo_actions, actions, "f");
if (!__classPrivateFieldGet(this, _TranscriptInfo_page, "f").actions_memo)
throw new Error("Page actions not found");
this.transcript = __classPrivateFieldGet(this, _TranscriptInfo_page, "f").actions_memo.getType(Transcript_default)[0];
}
async selectLanguage(language) {
const target_menu_item = this.transcript.content?.footer?.language_menu?.sub_menu_items?.find((item) => item.title.toString() === language);
if (!target_menu_item)
throw new Error(`Language not found: ${language}`);
if (target_menu_item.selected)
return this;
const response = await __classPrivateFieldGet(this, _TranscriptInfo_actions, "f").execute("/get_transcript", {
params: target_menu_item.continuation
});
return new TranscriptInfo(__classPrivateFieldGet(this, _TranscriptInfo_actions, "f"), response);
}
get languages() {
return this.transcript.content?.footer?.language_menu?.sub_menu_items?.map((item) => item.title.toString()) || [];
}
get selectedLanguage() {
return this.transcript.content?.footer?.language_menu?.sub_menu_items?.find((item) => item.selected)?.title.toString() || "";
}
get page() {
return __classPrivateFieldGet(this, _TranscriptInfo_page, "f");
}
};
__name(TranscriptInfo, "TranscriptInfo");
_TranscriptInfo_page = /* @__PURE__ */ new WeakMap(), _TranscriptInfo_actions = /* @__PURE__ */ new WeakMap();
var TranscriptInfo_default = TranscriptInfo;
// dist/src/parser/ytmusic/index.js
var ytmusic_exports = {};
__export(ytmusic_exports, {
Album: () => Album_default,
Artist: () => Artist_default,
Explore: () => Explore_default,
HomeFeed: () => HomeFeed_default,
Library: () => Library_default2,
LibraryContinuation: () => LibraryContinuation,
Playlist: () => Playlist_default3,
Recap: () => Recap_default,
Search: () => Search_default,
TrackInfo: () => TrackInfo_default
});
// dist/src/parser/ytmusic/Album.js
var _Album_page;
var Album = class {
constructor(response) {
_Album_page.set(this, void 0);
__classPrivateFieldSet(this, _Album_page, parser_exports.parseResponse(response.data), "f");
if (!__classPrivateFieldGet(this, _Album_page, "f").contents_memo)
throw new Error("No contents found in the response");
this.header = __classPrivateFieldGet(this, _Album_page, "f").contents_memo.getType(MusicDetailHeader_default, MusicResponsiveHeader_default)?.[0];
this.contents = __classPrivateFieldGet(this, _Album_page, "f").contents_memo.getType(MusicShelf_default)?.[0].contents || observe([]);
this.sections = __classPrivateFieldGet(this, _Album_page, "f").contents_memo.getType(MusicCarouselShelf_default) || observe([]);
this.background = __classPrivateFieldGet(this, _Album_page, "f").background;
this.url = __classPrivateFieldGet(this, _Album_page, "f").microformat?.as(MicroformatData_default).url_canonical;
}
get page() {
return __classPrivateFieldGet(this, _Album_page, "f");
}
};
__name(Album, "Album");
_Album_page = /* @__PURE__ */ new WeakMap();
var Album_default = Album;
// dist/src/parser/ytmusic/Artist.js
var _Artist_page;
var _Artist_actions;
var Artist = class {
constructor(response, actions) {
_Artist_page.set(this, void 0);
_Artist_actions.set(this, void 0);
__classPrivateFieldSet(this, _Artist_page, parser_exports.parseResponse(response.data), "f");
__classPrivateFieldSet(this, _Artist_actions, actions, "f");
this.header = this.page.header?.item().as(MusicImmersiveHeader_default, MusicVisualHeader_default, MusicHeader_default);
const music_shelf = __classPrivateFieldGet(this, _Artist_page, "f").contents_memo?.getType(MusicShelf_default) || [];
const music_carousel_shelf = __classPrivateFieldGet(this, _Artist_page, "f").contents_memo?.getType(MusicCarouselShelf_default) || [];
this.sections = observe([...music_shelf, ...music_carousel_shelf]);
}
async getAllSongs() {
const music_shelves = this.sections.filter((section) => section.type === "MusicShelf");
if (!music_shelves.length)
throw new InnertubeError("Could not find any node of type MusicShelf.");
const shelf = music_shelves.find((shelf2) => shelf2.title.toString() === "Songs");
if (!shelf)
throw new InnertubeError("Could not find target shelf (Songs).");
if (!shelf.endpoint)
throw new InnertubeError("Target shelf (Songs) did not have an endpoint.");
const page = await shelf.endpoint.call(__classPrivateFieldGet(this, _Artist_actions, "f"), { client: "YTMUSIC", parse: true });
return page.contents_memo?.getType(MusicPlaylistShelf_default)?.[0];
}
get page() {
return __classPrivateFieldGet(this, _Artist_page, "f");
}
};
__name(Artist, "Artist");
_Artist_page = /* @__PURE__ */ new WeakMap(), _Artist_actions = /* @__PURE__ */ new WeakMap();
var Artist_default = Artist;
// dist/src/parser/ytmusic/Explore.js
var _Explore_page;
var Explore = class {
constructor(response) {
_Explore_page.set(this, void 0);
__classPrivateFieldSet(this, _Explore_page, parser_exports.parseResponse(response.data), "f");
const tab = __classPrivateFieldGet(this, _Explore_page, "f").contents?.item().as(SingleColumnBrowseResults_default).tabs.get({ selected: true });
if (!tab)
throw new InnertubeError("Could not find target tab.");
const section_list = tab.content?.as(SectionList_default);
if (!section_list)
throw new InnertubeError("Target tab did not have any content.");
this.top_buttons = section_list.contents.firstOfType(Grid_default)?.items.as(MusicNavigationButton_default) || [];
this.sections = section_list.contents.filterType(MusicCarouselShelf_default);
}
get page() {
return __classPrivateFieldGet(this, _Explore_page, "f");
}
};
__name(Explore, "Explore");
_Explore_page = /* @__PURE__ */ new WeakMap();
var Explore_default = Explore;
// dist/src/parser/ytmusic/HomeFeed.js
var _HomeFeed_page;
var _HomeFeed_actions;
var _HomeFeed_continuation;
var HomeFeed2 = class {
constructor(response, actions) {
_HomeFeed_page.set(this, void 0);
_HomeFeed_actions.set(this, void 0);
_HomeFeed_continuation.set(this, void 0);
__classPrivateFieldSet(this, _HomeFeed_actions, actions, "f");
__classPrivateFieldSet(this, _HomeFeed_page, parser_exports.parseResponse(response.data), "f");
const tab = __classPrivateFieldGet(this, _HomeFeed_page, "f").contents?.item().as(SingleColumnBrowseResults_default).tabs.get({ selected: true });
if (!tab)
throw new InnertubeError("Could not find Home tab.");
if (tab.content === null) {
if (!__classPrivateFieldGet(this, _HomeFeed_page, "f").continuation_contents)
throw new InnertubeError("Continuation did not have any content.");
__classPrivateFieldSet(this, _HomeFeed_continuation, __classPrivateFieldGet(this, _HomeFeed_page, "f").continuation_contents.as(SectionListContinuation).continuation, "f");
this.sections = __classPrivateFieldGet(this, _HomeFeed_page, "f").continuation_contents.as(SectionListContinuation).contents?.as(MusicCarouselShelf_default);
return;
}
this.header = tab.content?.as(SectionList_default).header?.as(ChipCloud_default);
__classPrivateFieldSet(this, _HomeFeed_continuation, tab.content?.as(SectionList_default).continuation, "f");
this.sections = tab.content?.as(SectionList_default).contents.as(MusicCarouselShelf_default, MusicTastebuilderShelf_default);
}
async getContinuation() {
if (!__classPrivateFieldGet(this, _HomeFeed_continuation, "f"))
throw new InnertubeError("Continuation not found.");
const response = await __classPrivateFieldGet(this, _HomeFeed_actions, "f").execute("/browse", {
client: "YTMUSIC",
continuation: __classPrivateFieldGet(this, _HomeFeed_continuation, "f")
});
return new HomeFeed2(response, __classPrivateFieldGet(this, _HomeFeed_actions, "f"));
}
async applyFilter(target_filter) {
let cloud_chip;
if (typeof target_filter === "string") {
cloud_chip = this.header?.chips?.as(ChipCloudChip_default).get({ text: target_filter });
if (!cloud_chip)
throw new InnertubeError("Could not find filter with given name.", { available_filters: this.filters });
} else if (target_filter?.is(ChipCloudChip_default)) {
cloud_chip = target_filter;
}
if (!cloud_chip)
throw new InnertubeError("Invalid filter", { available_filters: this.filters });
if (cloud_chip?.is_selected)
return this;
if (!cloud_chip.endpoint)
throw new InnertubeError("Selected filter does not have an endpoint.");
const response = await cloud_chip.endpoint.call(__classPrivateFieldGet(this, _HomeFeed_actions, "f"), { client: "YTMUSIC" });
return new HomeFeed2(response, __classPrivateFieldGet(this, _HomeFeed_actions, "f"));
}
get filters() {
return this.header?.chips?.as(ChipCloudChip_default).map((chip) => chip.text) || [];
}
get has_continuation() {
return !!__classPrivateFieldGet(this, _HomeFeed_continuation, "f");
}
get page() {
return __classPrivateFieldGet(this, _HomeFeed_page, "f");
}
};
__name(HomeFeed2, "HomeFeed");
_HomeFeed_page = /* @__PURE__ */ new WeakMap(), _HomeFeed_actions = /* @__PURE__ */ new WeakMap(), _HomeFeed_continuation = /* @__PURE__ */ new WeakMap();
var HomeFeed_default = HomeFeed2;
// dist/src/parser/ytmusic/Library.js
var _Library_page;
var _Library_actions;
var _Library_continuation;
var _LibraryContinuation_page;
var _LibraryContinuation_actions;
var _LibraryContinuation_continuation;
var Library2 = class {
constructor(response, actions) {
_Library_page.set(this, void 0);
_Library_actions.set(this, void 0);
_Library_continuation.set(this, void 0);
__classPrivateFieldSet(this, _Library_page, parser_exports.parseResponse(response.data), "f");
__classPrivateFieldSet(this, _Library_actions, actions, "f");
const section_list = __classPrivateFieldGet(this, _Library_page, "f").contents_memo?.getType(SectionList_default)[0];
this.header = section_list?.header?.as(MusicSideAlignedItem_default);
this.contents = section_list?.contents?.as(Grid_default, MusicShelf_default);
__classPrivateFieldSet(this, _Library_continuation, this.contents?.find((list) => list.continuation)?.continuation, "f");
}
async applySort(sort_by) {
let target_item;
if (typeof sort_by === "string") {
const button = __classPrivateFieldGet(this, _Library_page, "f").contents_memo?.getType(MusicSortFilterButton_default)[0];
const options = button?.menu?.options.filter((item) => item instanceof MusicMultiSelectMenuItem_default);
target_item = options?.find((item) => item.title === sort_by);
if (!target_item)
throw new InnertubeError(`Sort option "${sort_by}" not found`, { available_filters: options.map((item) => item.title) });
} else {
target_item = sort_by;
}
if (!target_item.endpoint)
throw new InnertubeError("Invalid sort option");
if (target_item.selected)
return this;
const cmd = target_item.endpoint.payload?.commands?.find((cmd2) => cmd2.browseSectionListReloadEndpoint)?.browseSectionListReloadEndpoint;
if (!cmd)
throw new InnertubeError("Failed to find sort option command");
const response = await __classPrivateFieldGet(this, _Library_actions, "f").execute("/browse", {
client: "YTMUSIC",
continuation: cmd.continuation.reloadContinuationData.continuation,
parse: true
});
const previously_selected_item = __classPrivateFieldGet(this, _Library_page, "f").contents_memo?.getType(MusicMultiSelectMenuItem_default)?.find((item) => item.selected);
if (previously_selected_item)
previously_selected_item.selected = false;
target_item.selected = true;
this.contents = response.continuation_contents?.as(SectionListContinuation).contents?.as(Grid_default, MusicShelf_default);
return this;
}
async applyFilter(filter) {
let target_chip;
const chip_cloud = __classPrivateFieldGet(this, _Library_page, "f").contents_memo?.getType(ChipCloud_default)[0];
if (typeof filter === "string") {
target_chip = chip_cloud?.chips.get({ text: filter });
if (!target_chip)
throw new InnertubeError(`Filter "${filter}" not found`, { available_filters: this.filters });
} else {
target_chip = filter;
}
if (!target_chip.endpoint)
throw new InnertubeError("Invalid filter", filter);
const target_cmd = new NavigationEndpoint_default(target_chip.endpoint.payload?.commands?.[0]);
const response = await target_cmd.call(__classPrivateFieldGet(this, _Library_actions, "f"), { client: "YTMUSIC" });
return new Library2(response, __classPrivateFieldGet(this, _Library_actions, "f"));
}
async getContinuation() {
if (!__classPrivateFieldGet(this, _Library_continuation, "f"))
throw new InnertubeError("No continuation available");
const page = await __classPrivateFieldGet(this, _Library_actions, "f").execute("/browse", {
client: "YTMUSIC",
continuation: __classPrivateFieldGet(this, _Library_continuation, "f")
});
return new LibraryContinuation(page, __classPrivateFieldGet(this, _Library_actions, "f"));
}
get has_continuation() {
return !!__classPrivateFieldGet(this, _Library_continuation, "f");
}
get sort_options() {
const button = __classPrivateFieldGet(this, _Library_page, "f").contents_memo?.getType(MusicSortFilterButton_default)[0];
const options = button?.menu?.options.filter((item) => item instanceof MusicMultiSelectMenuItem_default);
return options.map((item) => item.title);
}
get filters() {
return __classPrivateFieldGet(this, _Library_page, "f").contents_memo?.getType(ChipCloud_default)?.[0].chips.map((chip) => chip.text) || [];
}
get page() {
return __classPrivateFieldGet(this, _Library_page, "f");
}
};
__name(Library2, "Library");
_Library_page = /* @__PURE__ */ new WeakMap(), _Library_actions = /* @__PURE__ */ new WeakMap(), _Library_continuation = /* @__PURE__ */ new WeakMap();
var Library_default2 = Library2;
var LibraryContinuation = class {
constructor(response, actions) {
_LibraryContinuation_page.set(this, void 0);
_LibraryContinuation_actions.set(this, void 0);
_LibraryContinuation_continuation.set(this, void 0);
__classPrivateFieldSet(this, _LibraryContinuation_page, parser_exports.parseResponse(response.data), "f");
__classPrivateFieldSet(this, _LibraryContinuation_actions, actions, "f");
if (!__classPrivateFieldGet(this, _LibraryContinuation_page, "f").continuation_contents)
throw new InnertubeError("No continuation contents found");
this.contents = __classPrivateFieldGet(this, _LibraryContinuation_page, "f").continuation_contents.as(MusicShelfContinuation, GridContinuation);
__classPrivateFieldSet(this, _LibraryContinuation_continuation, this.contents.continuation || null, "f");
}
async getContinuation() {
if (!__classPrivateFieldGet(this, _LibraryContinuation_continuation, "f"))
throw new InnertubeError("No continuation available");
const response = await __classPrivateFieldGet(this, _LibraryContinuation_actions, "f").execute("/browse", {
client: "YTMUSIC",
continuation: __classPrivateFieldGet(this, _LibraryContinuation_continuation, "f")
});
return new LibraryContinuation(response, __classPrivateFieldGet(this, _LibraryContinuation_actions, "f"));
}
get has_continuation() {
return !!__classPrivateFieldGet(this, _LibraryContinuation_continuation, "f");
}
get page() {
return __classPrivateFieldGet(this, _LibraryContinuation_page, "f");
}
};
__name(LibraryContinuation, "LibraryContinuation");
_LibraryContinuation_page = /* @__PURE__ */ new WeakMap(), _LibraryContinuation_actions = /* @__PURE__ */ new WeakMap(), _LibraryContinuation_continuation = /* @__PURE__ */ new WeakMap();
// dist/src/parser/ytmusic/Playlist.js
var _Playlist_instances2;
var _Playlist_page;
var _Playlist_actions;
var _Playlist_continuation;
var _Playlist_last_fetched_suggestions;
var _Playlist_suggestions_continuation;
var _Playlist_fetchSuggestions;
var Playlist3 = class {
constructor(response, actions) {
_Playlist_instances2.add(this);
_Playlist_page.set(this, void 0);
_Playlist_actions.set(this, void 0);
_Playlist_continuation.set(this, void 0);
_Playlist_last_fetched_suggestions.set(this, void 0);
_Playlist_suggestions_continuation.set(this, void 0);
__classPrivateFieldSet(this, _Playlist_actions, actions, "f");
__classPrivateFieldSet(this, _Playlist_page, parser_exports.parseResponse(response.data), "f");
__classPrivateFieldSet(this, _Playlist_last_fetched_suggestions, null, "f");
__classPrivateFieldSet(this, _Playlist_suggestions_continuation, null, "f");
if (__classPrivateFieldGet(this, _Playlist_page, "f").continuation_contents) {
const data2 = __classPrivateFieldGet(this, _Playlist_page, "f").continuation_contents?.as(MusicPlaylistShelfContinuation);
if (!data2.contents)
throw new InnertubeError("No contents found in the response");
this.contents = data2.contents.as(MusicResponsiveListItem_default, ContinuationItem_default);
const continuation_item = this.contents.firstOfType(ContinuationItem_default);
__classPrivateFieldSet(this, _Playlist_continuation, data2.continuation || continuation_item, "f");
} else if (__classPrivateFieldGet(this, _Playlist_page, "f").contents_memo) {
this.header = __classPrivateFieldGet(this, _Playlist_page, "f").contents_memo.getType(MusicResponsiveHeader_default, MusicEditablePlaylistDetailHeader_default, MusicDetailHeader_default)?.[0];
this.contents = __classPrivateFieldGet(this, _Playlist_page, "f").contents_memo.getType(MusicPlaylistShelf_default)?.[0]?.contents.as(MusicResponsiveListItem_default, ContinuationItem_default) || observe([]);
this.background = __classPrivateFieldGet(this, _Playlist_page, "f").background;
const continuation_item = this.contents.firstOfType(ContinuationItem_default);
__classPrivateFieldSet(this, _Playlist_continuation, __classPrivateFieldGet(this, _Playlist_page, "f").contents_memo.getType(MusicPlaylistShelf_default)?.[0]?.continuation || continuation_item, "f");
} else if (__classPrivateFieldGet(this, _Playlist_page, "f").on_response_received_actions) {
const append_continuation_action = __classPrivateFieldGet(this, _Playlist_page, "f").on_response_received_actions.firstOfType(AppendContinuationItemsAction_default);
this.contents = append_continuation_action?.contents?.as(MusicResponsiveListItem_default, ContinuationItem_default);
__classPrivateFieldSet(this, _Playlist_continuation, this.contents?.firstOfType(ContinuationItem_default), "f");
}
}
async getContinuation() {
if (!__classPrivateFieldGet(this, _Playlist_continuation, "f"))
throw new InnertubeError("Continuation not found.");
let response;
if (typeof __classPrivateFieldGet(this, _Playlist_continuation, "f") === "string") {
response = await __classPrivateFieldGet(this, _Playlist_actions, "f").execute("/browse", {
client: "YTMUSIC",
continuation: __classPrivateFieldGet(this, _Playlist_continuation, "f")
});
} else {
response = await __classPrivateFieldGet(this, _Playlist_continuation, "f").endpoint.call(__classPrivateFieldGet(this, _Playlist_actions, "f"), { client: "YTMUSIC" });
}
return new Playlist3(response, __classPrivateFieldGet(this, _Playlist_actions, "f"));
}
async getRelated() {
const target_section_list = __classPrivateFieldGet(this, _Playlist_page, "f").contents_memo?.getType(SectionList_default).find((section_list) => section_list.continuation);
if (!target_section_list)
throw new InnertubeError('Could not find "Related" section.');
let section_continuation = target_section_list.continuation;
while (section_continuation) {
const data2 = await __classPrivateFieldGet(this, _Playlist_actions, "f").execute("/browse", {
client: "YTMUSIC",
continuation: section_continuation,
parse: true
});
const section_list = data2.continuation_contents?.as(SectionListContinuation);
const sections = section_list?.contents?.as(MusicCarouselShelf_default, MusicShelf_default);
const related = sections?.find((section) => section.is(MusicCarouselShelf_default))?.as(MusicCarouselShelf_default);
if (related)
return related;
section_continuation = section_list?.continuation;
}
throw new InnertubeError("Could not fetch related playlists.");
}
async getSuggestions(refresh = true) {
const require_fetch = refresh || !__classPrivateFieldGet(this, _Playlist_last_fetched_suggestions, "f");
const fetch_promise = require_fetch ? __classPrivateFieldGet(this, _Playlist_instances2, "m", _Playlist_fetchSuggestions).call(this) : Promise.resolve(null);
const fetch_result = await fetch_promise;
if (fetch_result) {
__classPrivateFieldSet(this, _Playlist_last_fetched_suggestions, fetch_result.items, "f");
__classPrivateFieldSet(this, _Playlist_suggestions_continuation, fetch_result.continuation, "f");
}
return fetch_result?.items || __classPrivateFieldGet(this, _Playlist_last_fetched_suggestions, "f") || observe([]);
}
get page() {
return __classPrivateFieldGet(this, _Playlist_page, "f");
}
get items() {
return this.contents || observe([]);
}
get has_continuation() {
return !!__classPrivateFieldGet(this, _Playlist_continuation, "f");
}
};
__name(Playlist3, "Playlist");
_Playlist_page = /* @__PURE__ */ new WeakMap(), _Playlist_actions = /* @__PURE__ */ new WeakMap(), _Playlist_continuation = /* @__PURE__ */ new WeakMap(), _Playlist_last_fetched_suggestions = /* @__PURE__ */ new WeakMap(), _Playlist_suggestions_continuation = /* @__PURE__ */ new WeakMap(), _Playlist_instances2 = /* @__PURE__ */ new WeakSet(), _Playlist_fetchSuggestions = /* @__PURE__ */ __name(async function _Playlist_fetchSuggestions2() {
const target_section_list = __classPrivateFieldGet(this, _Playlist_page, "f").contents_memo?.getType(SectionList_default).find((section_list) => section_list.continuation);
const continuation = __classPrivateFieldGet(this, _Playlist_suggestions_continuation, "f") || target_section_list?.continuation;
if (continuation) {
const page = await __classPrivateFieldGet(this, _Playlist_actions, "f").execute("/browse", {
client: "YTMUSIC",
continuation,
parse: true
});
const section_list = page.continuation_contents?.as(SectionListContinuation);
const sections = section_list?.contents?.as(MusicCarouselShelf_default, MusicShelf_default);
const suggestions = sections?.find((section) => section.is(MusicShelf_default))?.as(MusicShelf_default);
return {
items: suggestions?.contents || observe([]),
continuation: suggestions?.continuation || null
};
}
return {
items: observe([]),
continuation: null
};
}, "_Playlist_fetchSuggestions");
var Playlist_default3 = Playlist3;
// dist/src/parser/ytmusic/Recap.js
var _Recap_page;
var _Recap_actions;
var Recap = class {
constructor(response, actions) {
_Recap_page.set(this, void 0);
_Recap_actions.set(this, void 0);
__classPrivateFieldSet(this, _Recap_page, parser_exports.parseResponse(response.data), "f");
__classPrivateFieldSet(this, _Recap_actions, actions, "f");
const header = __classPrivateFieldGet(this, _Recap_page, "f").header?.item();
this.header = header?.is(MusicElementHeader_default) ? __classPrivateFieldGet(this, _Recap_page, "f").header?.item().as(MusicElementHeader_default).element?.model?.as(HighlightsCarousel_default) : __classPrivateFieldGet(this, _Recap_page, "f").header?.item().as(MusicHeader_default);
const tab = __classPrivateFieldGet(this, _Recap_page, "f").contents?.item().as(SingleColumnBrowseResults_default).tabs.firstOfType(Tab_default);
if (!tab)
throw new InnertubeError("Target tab not found");
this.sections = tab.content?.as(SectionList_default).contents.as(ItemSection_default, MusicCarouselShelf_default, Message_default);
}
async getPlaylist() {
if (!this.header)
throw new InnertubeError("Header not found");
if (!this.header.is(HighlightsCarousel_default))
throw new InnertubeError("Recap playlist not available, check back later.");
const endpoint = this.header.panels[0].text_on_tap_endpoint;
const response = await endpoint.call(__classPrivateFieldGet(this, _Recap_actions, "f"), { client: "YTMUSIC" });
return new Playlist_default3(response, __classPrivateFieldGet(this, _Recap_actions, "f"));
}
get page() {
return __classPrivateFieldGet(this, _Recap_page, "f");
}
};
__name(Recap, "Recap");
_Recap_page = /* @__PURE__ */ new WeakMap(), _Recap_actions = /* @__PURE__ */ new WeakMap();
var Recap_default = Recap;
// dist/src/parser/ytmusic/Search.js
var _Search_page;
var _Search_actions;
var _Search_continuation;
var _SearchContinuation_actions;
var _SearchContinuation_page;
var Search2 = class {
constructor(response, actions, is_filtered) {
_Search_page.set(this, void 0);
_Search_actions.set(this, void 0);
_Search_continuation.set(this, void 0);
__classPrivateFieldSet(this, _Search_actions, actions, "f");
__classPrivateFieldSet(this, _Search_page, parser_exports.parseResponse(response.data), "f");
if (!__classPrivateFieldGet(this, _Search_page, "f").contents || !__classPrivateFieldGet(this, _Search_page, "f").contents_memo)
throw new InnertubeError("Response did not contain any contents.");
const tab = __classPrivateFieldGet(this, _Search_page, "f").contents.item().as(TabbedSearchResults_default).tabs.get({ selected: true });
if (!tab)
throw new InnertubeError("Could not find target tab.");
const tab_content = tab.content?.as(SectionList_default);
if (!tab_content)
throw new InnertubeError("Target tab did not have any content.");
this.header = tab_content.header?.as(ChipCloud_default);
this.contents = tab_content.contents.as(MusicShelf_default, MusicCardShelf_default, ItemSection_default);
if (is_filtered) {
__classPrivateFieldSet(this, _Search_continuation, this.contents.firstOfType(MusicShelf_default)?.continuation, "f");
}
}
async getMore(shelf) {
if (!shelf || !shelf.endpoint)
throw new InnertubeError("Cannot retrieve more items for this shelf because it does not have an endpoint.");
const response = await shelf.endpoint.call(__classPrivateFieldGet(this, _Search_actions, "f"), { client: "YTMUSIC" });
if (!response)
throw new InnertubeError("Endpoint did not return any data");
return new Search2(response, __classPrivateFieldGet(this, _Search_actions, "f"), true);
}
async getContinuation() {
if (!__classPrivateFieldGet(this, _Search_continuation, "f"))
throw new InnertubeError("Continuation not found.");
const response = await __classPrivateFieldGet(this, _Search_actions, "f").execute("/search", {
continuation: __classPrivateFieldGet(this, _Search_continuation, "f"),
client: "YTMUSIC"
});
return new SearchContinuation(__classPrivateFieldGet(this, _Search_actions, "f"), response);
}
async applyFilter(target_filter) {
let cloud_chip;
if (typeof target_filter === "string") {
cloud_chip = this.header?.chips?.as(ChipCloudChip_default).get({ text: target_filter });
if (!cloud_chip)
throw new InnertubeError("Could not find filter with given name.", { available_filters: this.filters });
} else if (target_filter?.is(ChipCloudChip_default)) {
cloud_chip = target_filter;
}
if (!cloud_chip)
throw new InnertubeError("Invalid filter", { available_filters: this.filters });
if (cloud_chip?.is_selected)
return this;
if (!cloud_chip.endpoint)
throw new InnertubeError("Selected filter does not have an endpoint.");
const response = await cloud_chip.endpoint.call(__classPrivateFieldGet(this, _Search_actions, "f"), { client: "YTMUSIC" });
return new Search2(response, __classPrivateFieldGet(this, _Search_actions, "f"), true);
}
get filters() {
return this.header?.chips?.as(ChipCloudChip_default).map((chip) => chip.text) || [];
}
get has_continuation() {
return !!__classPrivateFieldGet(this, _Search_continuation, "f");
}
get did_you_mean() {
return __classPrivateFieldGet(this, _Search_page, "f").contents_memo?.getType(DidYouMean_default)[0];
}
get showing_results_for() {
return __classPrivateFieldGet(this, _Search_page, "f").contents_memo?.getType(ShowingResultsFor_default)[0];
}
get message() {
return __classPrivateFieldGet(this, _Search_page, "f").contents_memo?.getType(Message_default)[0];
}
get songs() {
return this.contents?.filterType(MusicShelf_default).find((section) => section.title.toString() === "Songs");
}
get videos() {
return this.contents?.filterType(MusicShelf_default).find((section) => section.title.toString() === "Videos");
}
get albums() {
return this.contents?.filterType(MusicShelf_default).find((section) => section.title.toString() === "Albums");
}
get artists() {
return this.contents?.filterType(MusicShelf_default).find((section) => section.title.toString() === "Artists");
}
get playlists() {
return this.contents?.filterType(MusicShelf_default).find((section) => section.title.toString() === "Community playlists");
}
get page() {
return __classPrivateFieldGet(this, _Search_page, "f");
}
};
__name(Search2, "Search");
_Search_page = /* @__PURE__ */ new WeakMap(), _Search_actions = /* @__PURE__ */ new WeakMap(), _Search_continuation = /* @__PURE__ */ new WeakMap();
var Search_default = Search2;
var SearchContinuation = class {
constructor(actions, response) {
_SearchContinuation_actions.set(this, void 0);
_SearchContinuation_page.set(this, void 0);
__classPrivateFieldSet(this, _SearchContinuation_actions, actions, "f");
__classPrivateFieldSet(this, _SearchContinuation_page, parser_exports.parseResponse(response.data), "f");
this.header = __classPrivateFieldGet(this, _SearchContinuation_page, "f").header?.item().as(MusicHeader_default);
this.contents = __classPrivateFieldGet(this, _SearchContinuation_page, "f").continuation_contents?.as(MusicShelfContinuation);
}
async getContinuation() {
if (!this.contents?.continuation)
throw new InnertubeError("Continuation not found.");
const response = await __classPrivateFieldGet(this, _SearchContinuation_actions, "f").execute("/search", {
continuation: this.contents.continuation,
client: "YTMUSIC"
});
return new SearchContinuation(__classPrivateFieldGet(this, _SearchContinuation_actions, "f"), response);
}
get has_continuation() {
return !!this.contents?.continuation;
}
get page() {
return __classPrivateFieldGet(this, _SearchContinuation_page, "f");
}
};
__name(SearchContinuation, "SearchContinuation");
_SearchContinuation_actions = /* @__PURE__ */ new WeakMap(), _SearchContinuation_page = /* @__PURE__ */ new WeakMap();
// dist/src/parser/ytmusic/TrackInfo.js
var TrackInfo = class extends MediaInfo_default {
constructor(data2, actions, cpn) {
super(data2, actions, cpn);
const next = this.page[1];
if (next) {
const tabbed_results = next.contents_memo?.getType(WatchNextTabbedResults_default)?.[0];
this.tabs = tabbed_results?.tabs.array().as(Tab_default);
this.current_video_endpoint = next.current_video_endpoint;
this.player_overlays = next.player_overlays?.item().as(PlayerOverlay_default);
}
}
async getTab(title_or_page_type) {
if (!this.tabs)
throw new InnertubeError("Could not find any tab");
const target_tab = this.tabs.get({ title: title_or_page_type }) || this.tabs.find((tab) => tab.endpoint.payload.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType === title_or_page_type) || this.tabs?.[0];
if (!target_tab)
throw new InnertubeError(`Tab "${title_or_page_type}" not found`, { available_tabs: this.available_tabs });
if (target_tab.content)
return target_tab.content;
const page = await target_tab.endpoint.call(this.actions, { client: "YTMUSIC", parse: true });
if (page.contents?.item().type === "Message")
return page.contents.item().as(Message_default);
if (!page.contents)
throw new InnertubeError("Page contents was empty", page);
return page.contents.item().as(SectionList_default).contents;
}
async getUpNext(automix = true) {
const music_queue = await this.getTab("Up next");
if (!music_queue || !music_queue.content)
throw new InnertubeError("Music queue was empty, the video id is probably invalid.", music_queue);
const playlist_panel = music_queue.content.as(PlaylistPanel_default);
if (!playlist_panel.playlist_id && automix) {
const automix_preview_video = playlist_panel.contents.firstOfType(AutomixPreviewVideo_default);
if (!automix_preview_video)
throw new InnertubeError("Automix item not found");
const page = await automix_preview_video.playlist_video?.endpoint.call(this.actions, {
videoId: this.basic_info.id,
client: "YTMUSIC",
parse: true
});
if (!page || !page.contents_memo)
throw new InnertubeError("Could not fetch automix");
return page.contents_memo.getType(PlaylistPanel_default)?.[0];
}
return playlist_panel;
}
async getUpNextContinuation(playlistPanel) {
if (!this.current_video_endpoint)
throw new InnertubeError("Current Video Endpoint was not defined.", this.current_video_endpoint);
if (playlistPanel instanceof PlaylistPanel_default && playlistPanel.playlist_id !== this.current_video_endpoint.payload.playlistId) {
throw new InnertubeError("PlaylistId from TrackInfo does not match with PlaylistPanel");
}
const watch_next_endpoint = new NavigationEndpoint_default({ watchNextEndpoint: { ...this.current_video_endpoint.payload, continuation: playlistPanel.continuation } });
const response = await watch_next_endpoint.call(this.actions, { ...this.current_video_endpoint.payload, continuation: playlistPanel.continuation, client: "YTMUSIC", parse: true });
const playlistCont = response.continuation_contents?.as(PlaylistPanelContinuation);
if (!playlistCont)
throw new InnertubeError("No PlaylistPanel Continuation available.", response);
return playlistCont;
}
async getRelated() {
return await this.getTab("MUSIC_PAGE_TYPE_TRACK_RELATED");
}
async getLyrics() {
const tab = await this.getTab("MUSIC_PAGE_TYPE_TRACK_LYRICS");
return tab.firstOfType(MusicDescriptionShelf_default);
}
async addToWatchHistory() {
return super.addToWatchHistory(Constants_exports.CLIENTS.YTMUSIC.NAME, Constants_exports.CLIENTS.YTMUSIC.VERSION, "https://music.");
}
get available_tabs() {
return this.tabs ? this.tabs.map((tab) => tab.title) : [];
}
};
__name(TrackInfo, "TrackInfo");
var TrackInfo_default = TrackInfo;
// dist/src/parser/ytkids/index.js
var ytkids_exports = {};
__export(ytkids_exports, {
Channel: () => Channel3,
HomeFeed: () => HomeFeed3,
Search: () => Search3,
VideoInfo: () => VideoInfo2
});
// dist/src/parser/ytkids/Channel.js
var Channel3 = class extends Feed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
this.header = this.page.header?.item().as(C4TabbedHeader_default);
this.contents = this.memo.getType(ItemSection_default)[0] || this.page.continuation_contents?.as(ItemSectionContinuation);
}
async getContinuation() {
if (!this.contents)
throw new Error("No continuation available.");
const continuation_request = new NavigationEndpoint_default({
continuationCommand: {
token: this.contents.continuation,
request: "CONTINUATION_REQUEST_TYPE_BROWSE"
}
});
const continuation_response = await continuation_request.call(this.actions, { client: "YTKIDS" });
return new Channel3(this.actions, continuation_response);
}
get has_continuation() {
return !!this.contents?.continuation;
}
};
__name(Channel3, "Channel");
// dist/src/parser/ytkids/HomeFeed.js
var HomeFeed3 = class extends Feed_default {
constructor(actions, data2, already_parsed = false) {
super(actions, data2, already_parsed);
this.header = this.page.header?.item().as(KidsCategoriesHeader_default);
this.contents = this.page.contents?.item().as(KidsHomeScreen_default);
}
async selectCategoryTab(tab) {
let target_tab;
if (typeof tab === "string") {
target_tab = this.header?.category_tabs.find((t) => t.title.toString() === tab);
} else if (tab?.is(KidsCategoryTab_default)) {
target_tab = tab;
}
if (!target_tab)
throw new InnertubeError(`Tab "${tab}" not found`);
const page = await target_tab.endpoint.call(this.actions, { client: "YTKIDS", parse: true });
page.header = this.page.header;
page.header_memo = this.page.header_memo;
return new HomeFeed3(this.actions, page, true);
}
get categories() {
return this.header?.category_tabs.map((tab) => tab.title.toString()) || [];
}
};
__name(HomeFeed3, "HomeFeed");
// dist/src/parser/ytkids/Search.js
var Search3 = class extends Feed_default {
constructor(actions, data2) {
super(actions, data2);
this.estimated_results = this.page.estimated_results;
const item_section = this.memo.getType(ItemSection_default)[0];
if (!item_section)
throw new InnertubeError("No item section found in search response.");
this.contents = item_section.contents;
}
};
__name(Search3, "Search");
// dist/src/parser/ytkids/VideoInfo.js
var VideoInfo2 = class extends MediaInfo_default {
constructor(data2, actions, cpn) {
super(data2, actions, cpn);
const next = this.page[1];
const two_col = next?.contents?.item().as(TwoColumnWatchNextResults_default);
const results = two_col?.results;
const secondary_results = two_col?.secondary_results;
if (results && secondary_results) {
this.slim_video_metadata = results.firstOfType(ItemSection_default)?.contents?.firstOfType(SlimVideoMetadata_default);
this.watch_next_feed = secondary_results.firstOfType(ItemSection_default)?.contents || secondary_results;
this.current_video_endpoint = next?.current_video_endpoint;
this.player_overlays = next?.player_overlays?.item().as(PlayerOverlay_default);
}
}
};
__name(VideoInfo2, "VideoInfo");
// dist/src/parser/ytshorts/index.js
var ytshorts_exports = {};
__export(ytshorts_exports, {
ShortFormVideoInfo: () => ShortFormVideoInfo_default
});
// dist/src/parser/ytshorts/ShortFormVideoInfo.js
var _ShortFormVideoInfo_watch_next_continuation;
var ShortFormVideoInfo = class extends MediaInfo_default {
constructor(data2, actions, cpn, reel_watch_sequence_response) {
super(data2, actions, cpn);
_ShortFormVideoInfo_watch_next_continuation.set(this, void 0);
if (reel_watch_sequence_response) {
const reel_watch_sequence = parser_exports.parseResponse(reel_watch_sequence_response.data);
if (reel_watch_sequence.entries)
this.watch_next_feed = reel_watch_sequence.entries;
if (reel_watch_sequence.continuation_endpoint)
__classPrivateFieldSet(this, _ShortFormVideoInfo_watch_next_continuation, reel_watch_sequence.continuation_endpoint?.as(ContinuationCommand2), "f");
}
}
async getWatchNextContinuation() {
if (!__classPrivateFieldGet(this, _ShortFormVideoInfo_watch_next_continuation, "f"))
throw new InnertubeError("Continuation not found");
const response = await this.actions.execute("/reel/reel_watch_sequence", {
sequenceParams: __classPrivateFieldGet(this, _ShortFormVideoInfo_watch_next_continuation, "f").token,
parse: true
});
if (response.entries)
this.watch_next_feed = response.entries;
__classPrivateFieldSet(this, _ShortFormVideoInfo_watch_next_continuation, response.continuation_endpoint?.as(ContinuationCommand2), "f");
return this;
}
get wn_has_continuation() {
return !!__classPrivateFieldGet(this, _ShortFormVideoInfo_watch_next_continuation, "f");
}
};
__name(ShortFormVideoInfo, "ShortFormVideoInfo");
_ShortFormVideoInfo_watch_next_continuation = /* @__PURE__ */ new WeakMap();
var ShortFormVideoInfo_default = ShortFormVideoInfo;
// dist/src/parser/types/index.js
var types_exports = {};
// dist/src/parser/classes/misc/Author.js
var Author = class {
constructor(item, badges, thumbs, id) {
const nav_text = new Text(item);
this.id = id || nav_text?.runs?.[0]?.endpoint?.payload?.browseId || nav_text?.endpoint?.payload?.browseId || "N/A";
this.name = nav_text?.text || "N/A";
this.thumbnails = thumbs ? Thumbnail.fromResponse(thumbs) : [];
this.endpoint = nav_text?.runs?.[0]?.endpoint || nav_text?.endpoint;
if (badges) {
if (Array.isArray(badges)) {
this.badges = parser_exports.parseArray(badges);
this.is_moderator = this.badges?.some((badge) => badge.icon_type == "MODERATOR");
this.is_verified = this.badges?.some((badge) => badge.style == "BADGE_STYLE_TYPE_VERIFIED");
this.is_verified_artist = this.badges?.some((badge) => badge.style == "BADGE_STYLE_TYPE_VERIFIED_ARTIST");
} else {
this.badges = observe([]);
this.is_verified = !!badges.isVerified;
this.is_verified_artist = !!badges.isArtist;
}
} else {
this.badges = observe([]);
}
this.url = nav_text?.runs?.[0]?.endpoint?.metadata?.api_url === "/browse" && `${URLS.YT_BASE}${nav_text?.runs?.[0]?.endpoint?.payload?.canonicalBaseUrl || `/u/${nav_text?.runs?.[0]?.endpoint?.payload?.browseId}`}` || `${URLS.YT_BASE}${nav_text?.endpoint?.payload?.canonicalBaseUrl || `/u/${nav_text?.endpoint?.payload?.browseId}`}`;
}
get best_thumbnail() {
return this.thumbnails[0];
}
};
__name(Author, "Author");
// dist/src/utils/user-agents.js
var user_agents_default = {
"desktop": [
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.61",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
],
"mobile": [
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (Linux; Android 12; SM-G990U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36",
"Mozilla/5.0 (Linux; Android 13; SM-G998B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/108.1 Mobile/15E148 Safari/605.1.15",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77 ChannelId(73) NebulaSDK/1.8.100112 Nebula PSDType(1) AlipayDefined(nt:4G,ws:320|504|2.0) AliApp(AP/10.1.30.300) AlipayClient/10.1.30.300 Alipay Language/zh-Hans",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (Linux; Android 13; SM-N981U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36",
"Mozilla/5.0 (Linux; Android 13; SM-A515F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (Linux; Android 12; M2010J19SG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36",
"Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/109.0.5414.83 Mobile/15E148 Safari/604.1",
"Mozilla/5.0 (Linux; Android 11; M2102J20SG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36",
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Mobile/15E148 Safari/604.1"
]
};
// node_modules/jintr/dist/nodes/index.js
var nodes_exports2 = {};
__export(nodes_exports2, {
ArrayExpression: () => ArrayExpression,
ArrowFunctionExpression: () => ArrowFunctionExpression,
AssignmentExpression: () => AssignmentExpression,
BinaryExpression: () => BinaryExpression,
BlockStatement: () => BlockStatement,
BreakStatement: () => BreakStatement,
CallExpression: () => CallExpression,
ConditionalExpression: () => ConditionalExpression,
ContinueStatement: () => ContinueStatement,
EmptyStatement: () => EmptyStatement,
ExpressionStatement: () => ExpressionStatement,
ForOfStatement: () => ForOfStatement,
ForStatement: () => ForStatement,
FunctionDeclaration: () => FunctionDeclaration,
FunctionExpression: () => FunctionExpression,
Identifier: () => Identifier,
IfStatement: () => IfStatement,
Literal: () => Literal,
LogicalExpression: () => LogicalExpression,
MemberExpression: () => MemberExpression,
NewExpression: () => NewExpression,
ObjectExpression: () => ObjectExpression,
Property: () => Property,
ReturnStatement: () => ReturnStatement,
SequenceExpression: () => SequenceExpression,
SwitchCase: () => SwitchCase,
SwitchStatement: () => SwitchStatement,
TemplateLiteral: () => TemplateLiteral,
ThisExpression: () => ThisExpression,
ThrowStatement: () => ThrowStatement,
TryStatement: () => TryStatement,
UnaryExpression: () => UnaryExpression,
UpdateExpression: () => UpdateExpression,
VariableDeclaration: () => VariableDeclaration,
WhileStatement: () => WhileStatement
});
// node_modules/jintr/dist/nodes/BaseJSNode.js
var BaseJSNode = class {
constructor(node, visitor) {
this.node = node;
this.visitor = visitor;
}
run() {
}
};
__name(BaseJSNode, "BaseJSNode");
// node_modules/jintr/dist/nodes/ArrayExpression.js
var ArrayExpression = class extends BaseJSNode {
run() {
return this.node.elements.map((el) => this.visitor.visitNode(el));
}
};
__name(ArrayExpression, "ArrayExpression");
// node_modules/jintr/dist/utils/index.js
var namedFunction = /* @__PURE__ */ __name((name, fn) => Object.defineProperty(fn, "name", { value: name }), "namedFunction");
var JinterError = class extends Error {
constructor(message, info2) {
super(message);
if (info2) {
this.info = info2;
}
}
};
__name(JinterError, "JinterError");
// node_modules/jintr/dist/nodes/ArrowFunctionExpression.js
var ArrowFunctionExpression = class extends BaseJSNode {
run() {
const { params, body } = this.node;
const fn = namedFunction("anonymous function", (args) => {
let index = 0;
for (const param of params) {
this.visitor.visitNode(param);
if (param.type === "Identifier") {
this.visitor.scope.set(param.name, args[index]);
} else {
console.warn("Unhandled param type", param.type);
}
index++;
}
return this.visitor.visitNode(body);
});
return fn;
}
};
__name(ArrowFunctionExpression, "ArrowFunctionExpression");
// node_modules/jintr/dist/nodes/AssignmentExpression.js
var AssignmentExpression = class extends BaseJSNode {
handleMemberExpression(leftNode, rightValue, operation) {
const obj = this.visitor.visitNode(leftNode.object);
const prop = this.visitor.visitNode(leftNode.property);
const currentValue = obj[prop];
const newValue = operation(currentValue, rightValue);
return obj[prop] = newValue;
}
handleIdentifier(leftNode, rightValue, operation) {
const currentValue = this.visitor.visitNode(leftNode);
const newValue = operation(currentValue, rightValue);
this.visitor.scope.set(leftNode.name, newValue);
return this.visitor.scope.get(leftNode.name);
}
run() {
const { operator, left, right } = this.node;
const rightValue = this.visitor.visitNode(right);
const operation = AssignmentExpression.operatorMap[operator];
if (!operation) {
console.warn("Unhandled operator:", operator);
return void 0;
}
if (left.type === "MemberExpression") {
return this.handleMemberExpression(left, rightValue, operation);
} else if (left.type === "Identifier") {
return this.handleIdentifier(left, rightValue, operation);
}
console.warn("Unhandled left node type:", left.type);
return void 0;
}
};
__name(AssignmentExpression, "AssignmentExpression");
AssignmentExpression.operatorMap = {
"=": (_, right) => right,
"+=": (left, right) => left + right,
"-=": (left, right) => left - right,
"*=": (left, right) => left * right,
"/=": (left, right) => left / right,
"%=": (left, right) => left % right,
"**=": (left, right) => left ** right,
"<<=": (left, right) => left << right,
">>=": (left, right) => left >> right,
">>>=": (left, right) => left >>> right,
"&=": (left, right) => left & right,
"^=": (left, right) => left ^ right,
"|=": (left, right) => left | right
};
// node_modules/jintr/dist/nodes/BinaryExpression.js
var BinaryExpression = class extends BaseJSNode {
run() {
const { operator, left, right } = this.node;
const leftValue = this.visitor.visitNode(left);
const rightValue = this.visitor.visitNode(right);
const operation = BinaryExpression.operatorMap[operator];
if (!operation) {
console.warn("Unhandled binary operator:", operator);
return void 0;
}
return operation(leftValue, rightValue);
}
};
__name(BinaryExpression, "BinaryExpression");
BinaryExpression.operatorMap = {
"!=": (left, right) => left != right,
"!==": (left, right) => left !== right,
"==": (left, right) => left == right,
"===": (left, right) => left === right,
"<": (left, right) => left < right,
"<=": (left, right) => left <= right,
">": (left, right) => left > right,
">=": (left, right) => left >= right,
"+": (left, right) => left + right,
"-": (left, right) => left - right,
"*": (left, right) => left * right,
"/": (left, right) => left / right,
"%": (left, right) => left % right,
"**": (left, right) => left ** right,
"&": (left, right) => left & right,
"|": (left, right) => left | right,
"^": (left, right) => left ^ right,
"<<": (left, right) => left << right,
">>": (left, right) => left >> right,
">>>": (left, right) => left >>> right,
"in": (left, right) => left in right,
"instanceof": (left, right) => left instanceof right
};
// node_modules/jintr/dist/nodes/BlockStatement.js
var BlockStatement = class extends BaseJSNode {
run() {
for (const stmt of this.node.body) {
const result = this.visitor.visitNode(stmt);
if (stmt.type === "ReturnStatement")
return result;
if (result === "$jintr_break_" || result === "$jintr_continue_")
return result;
if ((stmt.type === "WhileStatement" || stmt.type === "IfStatement" || stmt.type === "ForStatement" || stmt.type === "TryStatement") && !!result) {
return result;
}
}
}
};
__name(BlockStatement, "BlockStatement");
// node_modules/jintr/dist/nodes/BreakStatement.js
var BreakStatement = class extends BaseJSNode {
run() {
return "$jintr_break_";
}
};
__name(BreakStatement, "BreakStatement");
// node_modules/jintr/dist/nodes/CallExpression.js
var __classPrivateFieldGet2 = function(receiver, state, kind, f) {
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _CallExpression_instances;
var _CallExpression_throwError;
var _CallExpression_getCalleeString;
var CallExpression = class extends BaseJSNode {
constructor() {
super(...arguments);
_CallExpression_instances.add(this);
}
run() {
let exp_object;
let exp_property;
if (this.node.callee.type === "MemberExpression") {
exp_object = this.visitor.getName(this.node.callee.object);
exp_property = this.visitor.getName(this.node.callee.property);
} else if (this.node.callee.type === "Identifier") {
exp_property = this.node.callee.name;
}
if (exp_object && this.visitor.listeners[exp_object]) {
const cb = this.visitor.listeners[exp_object](this.node, this.visitor);
if (cb !== "__continue_exec") {
return cb;
}
}
if (exp_property && exp_property !== "toString" && this.visitor.listeners[exp_property]) {
const cb = this.visitor.listeners[exp_property](this.node, this.visitor);
if (cb !== "__continue_exec") {
return cb;
}
}
if (this.node.callee.type === "MemberExpression") {
if (Builtins.has(this.node, this.visitor)) {
return Builtins.execute(this.node, this.visitor);
}
const obj = this.visitor.visitNode(this.node.callee.object);
const prop = this.node.callee.computed ? this.visitor.visitNode(this.node.callee.property) : this.visitor.getName(this.node.callee.property);
const args2 = this.node.arguments.map((arg) => this.visitor.visitNode(arg));
if (!obj)
__classPrivateFieldGet2(this, _CallExpression_instances, "m", _CallExpression_throwError).call(this);
if (typeof obj[prop] !== "function")
__classPrivateFieldGet2(this, _CallExpression_instances, "m", _CallExpression_throwError).call(this);
if (obj[prop].toString().includes("[native code]"))
return obj[prop](...args2);
return obj[prop](args2);
}
const fn = this.visitor.visitNode(this.node.callee);
const args = this.node.arguments.map((arg) => this.visitor.visitNode(arg));
if (typeof fn !== "function")
__classPrivateFieldGet2(this, _CallExpression_instances, "m", _CallExpression_throwError).call(this);
return fn(args);
}
};
__name(CallExpression, "CallExpression");
_CallExpression_instances = /* @__PURE__ */ new WeakSet(), _CallExpression_throwError = /* @__PURE__ */ __name(function _CallExpression_throwError2() {
if (this.node.callee.type === "MemberExpression" || this.node.callee.type === "Identifier") {
const callee_string = __classPrivateFieldGet2(this, _CallExpression_instances, "m", _CallExpression_getCalleeString).call(this, this.node.callee);
throw new JinterError(`${callee_string} is not a function`);
} else if (this.node.callee.type === "SequenceExpression") {
const call = [];
const items = [];
call.push("(");
this.node.callee.expressions.forEach((expr) => {
if (expr.type === "Literal") {
items.push(expr.raw || "");
} else if (expr.type === "Identifier") {
items.push(expr.name);
} else if (expr.type === "MemberExpression") {
if (expr.computed) {
items.push(`${this.visitor.getName(expr.object)}[${this.visitor.getName(expr.property) || "..."}]`);
} else {
items.push(`${this.visitor.getName(expr.object)}.${this.visitor.getName(expr.property)}`);
}
}
});
call.push(items.join(", "));
call.push(")");
throw new JinterError(`${call.join("")} is not a function`);
}
}, "_CallExpression_throwError"), _CallExpression_getCalleeString = /* @__PURE__ */ __name(function _CallExpression_getCalleeString2(node) {
if (node.type === "Identifier") {
return node.name;
} else if (node.type === "MemberExpression") {
const object_string = __classPrivateFieldGet2(this, _CallExpression_instances, "m", _CallExpression_getCalleeString2).call(this, node.object);
const property_string = node.computed ? `[${this.visitor.getName(node.property) || "..."}]` : `.${this.visitor.getName(node.property)}`;
return `${object_string}${property_string}`;
}
return "<unknown>";
}, "_CallExpression_getCalleeString");
var Builtins = class {
static has(node, visitor) {
if (node.callee.type === "MemberExpression") {
return !!this.builtins?.[visitor.getName(node.callee.property) || ""];
}
return false;
}
static execute(node, visitor) {
if (node.callee.type === "MemberExpression") {
return this.builtins[visitor.getName(node.callee.property) || ""](node, visitor);
}
}
};
__name(Builtins, "Builtins");
Builtins.builtins = {
forEach: (node, visitor) => {
const args = node.arguments.map((arg) => visitor.visitNode(arg));
if (node.callee.type === "MemberExpression") {
const arr = visitor.visitNode(node.callee.object);
if (args.length > 1) {
visitor.scope.set("_this", args.slice(-1)[0]);
}
let index = 0;
for (const element of arr) {
args[0]([element, index++, arr]);
}
} else {
console.warn("Unhandled callee type:", node.callee.type);
}
},
toString: (node, visitor) => {
if (node.callee.type === "MemberExpression") {
return visitor.visitNode(node.callee.object).toString();
}
}
};
// node_modules/jintr/dist/nodes/ConditionalExpression.js
var ConditionalExpression = class extends BaseJSNode {
run() {
const { test, consequent, alternate } = this.node;
const check = this.visitor.visitNode(test);
if (check) {
return this.visitor.visitNode(consequent);
}
return this.visitor.visitNode(alternate);
}
};
__name(ConditionalExpression, "ConditionalExpression");
// node_modules/jintr/dist/nodes/ContinueStatement.js
var ContinueStatement = class extends BaseJSNode {
run() {
return "$jintr_continue_";
}
};
__name(ContinueStatement, "ContinueStatement");
// node_modules/jintr/dist/nodes/EmptyStatement.js
var EmptyStatement = class extends BaseJSNode {
run() {
return void 0;
}
};
__name(EmptyStatement, "EmptyStatement");
// node_modules/jintr/dist/nodes/ExpressionStatement.js
var ExpressionStatement = class extends BaseJSNode {
run() {
return this.visitor.visitNode(this.node.expression);
}
};
__name(ExpressionStatement, "ExpressionStatement");
// node_modules/jintr/dist/nodes/ForOfStatement.js
var ForOfStatement = class extends BaseJSNode {
run() {
this.visitor.visitNode(this.node.left);
const right_node = this.visitor.visitNode(this.node.right);
for (const el of right_node) {
if (this.node.left.type === "VariableDeclaration" && this.node.left.declarations[0].id.type === "Identifier") {
this.visitor.scope.set(this.node.left.declarations[0].id.name, el);
} else if (this.node.left.type === "VariableDeclaration" && this.node.left.declarations[0].id.type === "ObjectPattern") {
for (const propert of this.node.left.declarations[0].id.properties) {
if (propert.type === "Property" && (propert.value.type === "Identifier" && propert.key.type === "Identifier")) {
this.visitor.scope.set(propert.value.name, el[propert.key.name]);
}
}
}
const body = this.visitor.visitNode(this.node.body);
if (body === "$jintr_break_") {
break;
}
if (body === "$jintr_continue_") {
continue;
}
if (body && this.node.body.type !== "ExpressionStatement") {
return body;
}
}
}
};
__name(ForOfStatement, "ForOfStatement");
// node_modules/jintr/dist/nodes/ForStatement.js
var ForStatement = class extends BaseJSNode {
run() {
if (this.node.init) {
this.visitor.visitNode(this.node.init);
}
const test = /* @__PURE__ */ __name(() => {
return this.node.test ? this.visitor.visitNode(this.node.test) : true;
}, "test");
for (; ; ) {
const _test = test();
if (!_test) {
break;
}
const body = this.visitor.visitNode(this.node.body);
if (body === "$jintr_continue_") {
continue;
}
if (body === "$jintr_break_") {
break;
}
if (this.node.update) {
this.visitor.visitNode(this.node.update);
}
if (body && this.node.body.type !== "ExpressionStatement") {
return body;
}
}
}
};
__name(ForStatement, "ForStatement");
// node_modules/jintr/dist/nodes/FunctionDeclaration.js
var FunctionDeclaration = class extends BaseJSNode {
run() {
const { params, body } = this.node;
const id = this.visitor.visitNode(this.node.id);
const fn = namedFunction(id, (args) => {
let index = 0;
for (const param of params) {
this.visitor.visitNode(param);
if (param.type === "Identifier") {
this.visitor.scope.set(param.name, args[index]);
} else {
console.warn("Unhandled param type", param.type);
}
index++;
}
return this.visitor.visitNode(body);
});
this.visitor.scope.set(id, fn);
}
};
__name(FunctionDeclaration, "FunctionDeclaration");
// node_modules/jintr/dist/nodes/FunctionExpression.js
var FunctionExpression = class extends BaseJSNode {
run() {
const { params, body } = this.node;
const fn = namedFunction("anonymous function", (args) => {
let index = 0;
for (const param of params) {
this.visitor.visitNode(param);
if (param.type === "Identifier") {
this.visitor.scope.set(param.name, args[index]);
} else {
console.warn("Unhandled param type", param.type);
}
index++;
}
return this.visitor.visitNode(body);
});
return fn;
}
};
__name(FunctionExpression, "FunctionExpression");
// node_modules/jintr/dist/nodes/Identifier.js
var Identifier = class extends BaseJSNode {
run() {
if (this.visitor.listeners[this.node.name]) {
const cb = this.visitor.listeners[this.node.name](this.node, this.visitor);
if (cb !== "__continue_exec") {
return cb;
}
}
if (this.visitor.scope.has(this.node.name))
return this.visitor.scope.get(this.node.name);
return this.node.name;
}
};
__name(Identifier, "Identifier");
// node_modules/jintr/dist/nodes/IfStatement.js
var IfStatement = class extends BaseJSNode {
run() {
const test = this.visitor.visitNode(this.node.test);
if (test) {
return this.visitor.visitNode(this.node.consequent);
} else if (this.node.alternate) {
return this.visitor.visitNode(this.node.alternate);
}
}
};
__name(IfStatement, "IfStatement");
// node_modules/jintr/dist/nodes/Literal.js
var Literal = class extends BaseJSNode {
run() {
return this.node.value;
}
};
__name(Literal, "Literal");
// node_modules/jintr/dist/nodes/LogicalExpression.js
var LogicalExpression = class extends BaseJSNode {
run() {
const { operator, left, right } = this.node;
const operation = LogicalExpression.operatorMap[operator];
if (!operation) {
console.warn("Unhandled logical operator:", operator);
return void 0;
}
return operation(this.visitor, left, right);
}
};
__name(LogicalExpression, "LogicalExpression");
LogicalExpression.operatorMap = {
"&&": (visitor, leftNode, rightNode) => {
const leftValue = visitor.visitNode(leftNode);
return leftValue === true ? visitor.visitNode(rightNode) : leftValue;
},
"||": (visitor, leftNode, rightNode) => {
const leftValue = visitor.visitNode(leftNode);
return leftValue || visitor.visitNode(rightNode);
},
"??": (visitor, leftNode, rightNode) => {
const normalizeUndefined = /* @__PURE__ */ __name((value, isIdentifier) => isIdentifier && value === "undefined" ? void 0 : value, "normalizeUndefined");
const leftValue = normalizeUndefined(visitor.visitNode(leftNode), leftNode.type === "Identifier");
const rightValue = normalizeUndefined(visitor.visitNode(rightNode), rightNode.type === "Identifier");
return leftValue ?? rightValue;
}
};
// node_modules/jintr/dist/nodes/MemberExpression.js
var MemberExpression = class extends BaseJSNode {
run() {
const { object, property, computed } = this.node;
const obj = this.visitor.visitNode(object);
const prop = computed ? this.visitor.visitNode(property) : this.visitor.getName(property);
if (prop !== void 0 || prop !== null) {
if (this.visitor.listeners[prop]) {
const cb = this.visitor.listeners[prop](this.node, this.visitor);
if (cb !== "__continue_exec") {
return cb;
}
}
return obj?.[prop];
}
}
};
__name(MemberExpression, "MemberExpression");
// node_modules/jintr/dist/nodes/NewExpression.js
var NewExpression = class extends BaseJSNode {
run() {
const callee = this.visitor.visitNode(this.node.callee);
const args = this.node.arguments.map((arg) => this.visitor.visitNode(arg));
return args.length ? new callee(args) : new callee();
}
};
__name(NewExpression, "NewExpression");
// node_modules/jintr/dist/nodes/ObjectExpression.js
var ObjectExpression = class extends BaseJSNode {
run() {
let result = {};
for (const prop of this.node.properties) {
if (prop.type === "Property") {
result = { ...result, ...this.visitor.visitNode(prop) };
} else {
throw new Error(`Unhandled property type: ${prop.type}`);
}
}
return result;
}
};
__name(ObjectExpression, "ObjectExpression");
// node_modules/jintr/dist/nodes/Property.js
var __classPrivateFieldGet3 = function(receiver, state, kind, f) {
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _Property_instances;
var _Property_init;
var _Property_get;
var _Property_set;
var Property = class extends BaseJSNode {
constructor() {
super(...arguments);
_Property_instances.add(this);
}
run() {
switch (this.node.kind) {
case "init":
return __classPrivateFieldGet3(this, _Property_instances, "m", _Property_init).call(this);
case "get":
return __classPrivateFieldGet3(this, _Property_instances, "m", _Property_get).call(this);
case "set":
return __classPrivateFieldGet3(this, _Property_instances, "m", _Property_set).call(this);
default:
throw new Error(`Unhandled property kind: ${this.node.kind}`);
}
}
};
__name(Property, "Property");
_Property_instances = /* @__PURE__ */ new WeakSet(), _Property_init = /* @__PURE__ */ __name(function _Property_init2() {
const key = this.node.computed ? this.visitor.visitNode(this.node.key) : this.visitor.getName(this.node.key);
const value = this.visitor.visitNode(this.node.value);
if (key) {
return { [key]: value };
}
}, "_Property_init"), _Property_get = /* @__PURE__ */ __name(function _Property_get2() {
throw new TypeError("Not implemented: Property.get");
}, "_Property_get"), _Property_set = /* @__PURE__ */ __name(function _Property_set2() {
throw new TypeError("Not implemented: Property.set");
}, "_Property_set");
// node_modules/jintr/dist/nodes/ReturnStatement.js
var ReturnStatement = class extends BaseJSNode {
run() {
if (this.node.argument) {
return this.visitor.visitNode(this.node.argument);
}
}
};
__name(ReturnStatement, "ReturnStatement");
// node_modules/jintr/dist/nodes/SequenceExpression.js
var SequenceExpression = class extends BaseJSNode {
run() {
let result;
for (const expression of this.node.expressions) {
result = this.visitor.visitNode(expression);
}
return result;
}
};
__name(SequenceExpression, "SequenceExpression");
// node_modules/jintr/dist/nodes/SwitchCase.js
var SwitchCase = class extends BaseJSNode {
run() {
for (const stmt of this.node.consequent) {
const result = this.visitor.visitNode(stmt);
if (stmt.type === "ContinueStatement" || stmt.type === "BreakStatement") {
return result;
}
}
}
};
__name(SwitchCase, "SwitchCase");
// node_modules/jintr/dist/nodes/SwitchStatement.js
var SwitchStatement = class extends BaseJSNode {
run() {
const discriminant = this.visitor.visitNode(this.node.discriminant);
let matched = false;
let default_case = -1;
let index = 0;
while (true) {
const _case = this.node.cases[index];
if (matched) {
const result = this.visitor.visitNode(_case);
if (result === "$jintr_break_") {
break;
}
if (result === "$jintr_continue_") {
return result;
}
++index;
if (index >= this.node.cases.length) {
index = 0;
break;
} else {
continue;
}
}
matched = _case && discriminant === this.visitor.visitNode(_case.test);
if (matched === void 0 && index > this.node.cases.length)
break;
if (_case && !matched && !_case.test) {
default_case = index;
index += 1;
continue;
}
if (!_case && !matched && default_case !== -1) {
matched = true;
index = default_case;
continue;
}
if (!matched) {
++index;
}
}
}
};
__name(SwitchStatement, "SwitchStatement");
// node_modules/jintr/dist/nodes/TemplateLiteral.js
var TemplateLiteral = class extends BaseJSNode {
run() {
let result = "";
for (let i = 0; i < this.node.quasis.length; ++i) {
const quasi = this.node.quasis[i];
if (quasi.type === "TemplateElement") {
if (quasi.value.cooked === null) {
throw new Error(`Invalid template literal: ${quasi.value.raw}`);
}
if (quasi.value.cooked !== void 0) {
result += quasi.value.cooked;
}
if (!quasi.tail) {
const expr = this.node.expressions[i];
if (expr !== void 0) {
result += this.visitor.visitNode(expr);
} else {
throw new Error(`Expected expression after: ${quasi.value}`);
}
}
} else {
throw new Error(`Unhandled quasi type: ${quasi.type}`);
}
}
return result;
}
};
__name(TemplateLiteral, "TemplateLiteral");
// node_modules/jintr/dist/nodes/ThisExpression.js
var ThisExpression = class extends BaseJSNode {
run() {
return this.visitor.scope.get("_this");
}
};
__name(ThisExpression, "ThisExpression");
// node_modules/jintr/dist/nodes/ThrowStatement.js
var ThrowStatement = class extends BaseJSNode {
run() {
const arg = this.visitor.visitNode(this.node.argument);
throw arg;
}
};
__name(ThrowStatement, "ThrowStatement");
// node_modules/jintr/dist/nodes/TryStatement.js
var TryStatement = class extends BaseJSNode {
run() {
try {
return this.visitor.visitNode(this.node.block);
} catch (e) {
if (this.node.handler) {
if (this.node.handler.param && this.node.handler.param.type === "Identifier") {
this.visitor.scope.set(this.node.handler.param.name, e);
}
return this.visitor.visitNode(this.node.handler.body);
}
} finally {
this.visitor.visitNode(this.node.finalizer);
}
}
};
__name(TryStatement, "TryStatement");
// node_modules/jintr/dist/nodes/UnaryExpression.js
var UnaryExpression = class extends BaseJSNode {
static isValidOperator(operator) {
return operator in UnaryExpression.operatorMap;
}
run() {
const { operator, argument } = this.node;
if (!UnaryExpression.isValidOperator(operator)) {
console.warn("Unhandled unary operator:", operator);
return void 0;
}
return UnaryExpression.operatorMap[operator](this.visitor, argument);
}
};
__name(UnaryExpression, "UnaryExpression");
UnaryExpression.operatorMap = {
"-": (visitor, argument) => -visitor.visitNode(argument),
"+": (visitor, argument) => +visitor.visitNode(argument),
"!": (visitor, argument) => !visitor.visitNode(argument),
"~": (visitor, argument) => ~visitor.visitNode(argument),
"void": (visitor, argument) => {
visitor.visitNode(argument);
return void 0;
},
"typeof": (visitor, argument) => {
const arg = visitor.visitNode(argument);
if (argument.type === "Identifier" && arg === "undefined")
return "undefined";
return typeof visitor.visitNode(argument);
},
"delete": (visitor, argument) => {
if (argument.type === "MemberExpression") {
const obj = visitor.visitNode(argument.object);
const prop = argument.computed ? visitor.visitNode(argument.property) : visitor.getName(argument.property);
return delete obj[prop];
}
if (argument.type === "Identifier" && visitor.scope.has(argument.name)) {
return visitor.scope.delete(argument.name);
}
return true;
}
};
// node_modules/jintr/dist/nodes/UpdateExpression.js
var UpdateExpression = class extends BaseJSNode {
run() {
const operator = this.node.operator;
switch (operator) {
case "++":
{
if (this.node.argument.type === "MemberExpression") {
const target_node = this.visitor.visitNode(this.node.argument.object);
return target_node[this.visitor.visitNode(this.node.argument.property)]++;
} else if (this.node.argument.type === "Identifier") {
let target_node = this.visitor.visitNode(this.node.argument);
this.visitor.scope.set(this.node.argument.name, target_node + 1);
return this.node.prefix ? ++target_node : target_node;
}
}
break;
case "--":
{
if (this.node.argument.type === "MemberExpression") {
const target_node = this.visitor.visitNode(this.node.argument.object);
return target_node[this.visitor.visitNode(this.node.argument.property)]--;
} else if (this.node.argument.type === "Identifier") {
let target_node = this.visitor.visitNode(this.node.argument);
this.visitor.scope.set(this.node.argument.name, target_node - 1);
return this.node.prefix ? --target_node : target_node;
}
}
break;
}
}
};
__name(UpdateExpression, "UpdateExpression");
// node_modules/jintr/dist/nodes/VariableDeclaration.js
var VariableDeclaration = class extends BaseJSNode {
run() {
this.node.declarations.forEach((declar) => {
const { id, init } = declar;
const key = this.visitor.getName(id);
const value = init ? this.visitor.visitNode(init) : void 0;
if (key)
this.visitor.scope.set(key, value);
if (typeof value === "object" && value !== null)
this.visitor.scope.set("_this", value);
});
}
};
__name(VariableDeclaration, "VariableDeclaration");
// node_modules/jintr/dist/nodes/WhileStatement.js
var WhileStatement = class extends BaseJSNode {
run() {
while (this.visitor.visitNode(this.node.test)) {
const body = this.visitor.visitNode(this.node.body);
if (body === "$jintr_break_")
break;
if (body === "$jintr_continue_")
continue;
if (body)
return body;
}
}
};
__name(WhileStatement, "WhileStatement");
// node_modules/jintr/dist/visitor.js
var __classPrivateFieldGet4 = function(receiver, state, kind, f) {
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _Visitor_instances;
var _Visitor_getNode;
var Visitor = class {
constructor() {
_Visitor_instances.add(this);
this.scope = /* @__PURE__ */ new Map();
this.listeners = {};
this.ast = [];
}
setAST(ast) {
this.ast = ast;
}
run() {
let result;
for (const node of this.ast) {
result = this.visitNode(node);
}
return result;
}
visitNode(node) {
if (!node)
return null;
const targetNode = __classPrivateFieldGet4(this, _Visitor_instances, "m", _Visitor_getNode).call(this, node.type);
if (targetNode) {
const instance = new targetNode(node, this);
return instance.run();
}
return null;
}
getName(node) {
if (node.type === "Identifier")
return node.name;
else if (node.type === "Literal")
return node.value;
}
on(node_name, listener) {
this.listeners[node_name] = listener;
}
};
__name(Visitor, "Visitor");
_Visitor_instances = /* @__PURE__ */ new WeakSet(), _Visitor_getNode = /* @__PURE__ */ __name(function _Visitor_getNode2(type) {
const node = nodes_exports2[type];
if (!node) {
console.warn("[JINTER]:", `JavaScript node "${type}" not implemented!
If this is causing unexpected behavior, please report it at https://github.com/LuanRT/Jinter/issues/new`);
}
return node;
}, "_Visitor_getNode");
// node_modules/acorn/dist/acorn.mjs
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65";
var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
var reservedWords = {
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
5: "class enum extends super const export import",
6: "enum",
strict: "implements interface let package private protected public static yield",
strictBind: "eval arguments"
};
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";
var keywords$1 = {
5: ecma5AndLessKeywords,
"5module": ecma5AndLessKeywords + " export import",
6: ecma5AndLessKeywords + " const class extends export import super"
};
var keywordRelationalOperator = /^in(stanceof)?$/;
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
function isInAstralSet(code, set) {
var pos = 65536;
for (var i = 0; i < set.length; i += 2) {
pos += set[i];
if (pos > code) {
return false;
}
pos += set[i + 1];
if (pos >= code) {
return true;
}
}
return false;
}
__name(isInAstralSet, "isInAstralSet");
function isIdentifierStart(code, astral) {
if (code < 65) {
return code === 36;
}
if (code < 91) {
return true;
}
if (code < 97) {
return code === 95;
}
if (code < 123) {
return true;
}
if (code <= 65535) {
return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
}
if (astral === false) {
return false;
}
return isInAstralSet(code, astralIdentifierStartCodes);
}
__name(isIdentifierStart, "isIdentifierStart");
function isIdentifierChar(code, astral) {
if (code < 48) {
return code === 36;
}
if (code < 58) {
return true;
}
if (code < 65) {
return false;
}
if (code < 91) {
return true;
}
if (code < 97) {
return code === 95;
}
if (code < 123) {
return true;
}
if (code <= 65535) {
return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
}
if (astral === false) {
return false;
}
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
}
__name(isIdentifierChar, "isIdentifierChar");
var TokenType = /* @__PURE__ */ __name(function TokenType2(label, conf) {
if (conf === void 0)
conf = {};
this.label = label;
this.keyword = conf.keyword;
this.beforeExpr = !!conf.beforeExpr;
this.startsExpr = !!conf.startsExpr;
this.isLoop = !!conf.isLoop;
this.isAssign = !!conf.isAssign;
this.prefix = !!conf.prefix;
this.postfix = !!conf.postfix;
this.binop = conf.binop || null;
this.updateContext = null;
}, "TokenType");
function binop(name, prec) {
return new TokenType(name, { beforeExpr: true, binop: prec });
}
__name(binop, "binop");
var beforeExpr = { beforeExpr: true };
var startsExpr = { startsExpr: true };
var keywords = {};
function kw(name, options) {
if (options === void 0)
options = {};
options.keyword = name;
return keywords[name] = new TokenType(name, options);
}
__name(kw, "kw");
var types$1 = {
num: new TokenType("num", startsExpr),
regexp: new TokenType("regexp", startsExpr),
string: new TokenType("string", startsExpr),
name: new TokenType("name", startsExpr),
privateId: new TokenType("privateId", startsExpr),
eof: new TokenType("eof"),
bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }),
bracketR: new TokenType("]"),
braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }),
braceR: new TokenType("}"),
parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }),
parenR: new TokenType(")"),
comma: new TokenType(",", beforeExpr),
semi: new TokenType(";", beforeExpr),
colon: new TokenType(":", beforeExpr),
dot: new TokenType("."),
question: new TokenType("?", beforeExpr),
questionDot: new TokenType("?."),
arrow: new TokenType("=>", beforeExpr),
template: new TokenType("template"),
invalidTemplate: new TokenType("invalidTemplate"),
ellipsis: new TokenType("...", beforeExpr),
backQuote: new TokenType("`", startsExpr),
dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }),
eq: new TokenType("=", { beforeExpr: true, isAssign: true }),
assign: new TokenType("_=", { beforeExpr: true, isAssign: true }),
incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }),
prefix: new TokenType("!/~", { beforeExpr: true, prefix: true, startsExpr: true }),
logicalOR: binop("||", 1),
logicalAND: binop("&&", 2),
bitwiseOR: binop("|", 3),
bitwiseXOR: binop("^", 4),
bitwiseAND: binop("&", 5),
equality: binop("==/!=/===/!==", 6),
relational: binop("</>/<=/>=", 7),
bitShift: binop("<</>>/>>>", 8),
plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }),
modulo: binop("%", 10),
star: binop("*", 10),
slash: binop("/", 10),
starstar: new TokenType("**", { beforeExpr: true }),
coalesce: binop("??", 1),
_break: kw("break"),
_case: kw("case", beforeExpr),
_catch: kw("catch"),
_continue: kw("continue"),
_debugger: kw("debugger"),
_default: kw("default", beforeExpr),
_do: kw("do", { isLoop: true, beforeExpr: true }),
_else: kw("else", beforeExpr),
_finally: kw("finally"),
_for: kw("for", { isLoop: true }),
_function: kw("function", startsExpr),
_if: kw("if"),
_return: kw("return", beforeExpr),
_switch: kw("switch"),
_throw: kw("throw", beforeExpr),
_try: kw("try"),
_var: kw("var"),
_const: kw("const"),
_while: kw("while", { isLoop: true }),
_with: kw("with"),
_new: kw("new", { beforeExpr: true, startsExpr: true }),
_this: kw("this", startsExpr),
_super: kw("super", startsExpr),
_class: kw("class", startsExpr),
_extends: kw("extends", beforeExpr),
_export: kw("export"),
_import: kw("import", startsExpr),
_null: kw("null", startsExpr),
_true: kw("true", startsExpr),
_false: kw("false", startsExpr),
_in: kw("in", { beforeExpr: true, binop: 7 }),
_instanceof: kw("instanceof", { beforeExpr: true, binop: 7 }),
_typeof: kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true }),
_void: kw("void", { beforeExpr: true, prefix: true, startsExpr: true }),
_delete: kw("delete", { beforeExpr: true, prefix: true, startsExpr: true })
};
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
var lineBreakG = new RegExp(lineBreak.source, "g");
function isNewLine(code) {
return code === 10 || code === 13 || code === 8232 || code === 8233;
}
__name(isNewLine, "isNewLine");
function nextLineBreak(code, from, end) {
if (end === void 0)
end = code.length;
for (var i = from; i < end; i++) {
var next = code.charCodeAt(i);
if (isNewLine(next)) {
return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1;
}
}
return -1;
}
__name(nextLineBreak, "nextLineBreak");
var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
var ref = Object.prototype;
var hasOwnProperty = ref.hasOwnProperty;
var toString = ref.toString;
var hasOwn = Object.hasOwn || function(obj, propName) {
return hasOwnProperty.call(obj, propName);
};
var isArray = Array.isArray || function(obj) {
return toString.call(obj) === "[object Array]";
};
var regexpCache = /* @__PURE__ */ Object.create(null);
function wordsRegexp(words) {
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
}
__name(wordsRegexp, "wordsRegexp");
function codePointToString(code) {
if (code <= 65535) {
return String.fromCharCode(code);
}
code -= 65536;
return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
}
__name(codePointToString, "codePointToString");
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
var Position = /* @__PURE__ */ __name(function Position2(line, col) {
this.line = line;
this.column = col;
}, "Position");
Position.prototype.offset = /* @__PURE__ */ __name(function offset(n) {
return new Position(this.line, this.column + n);
}, "offset");
var SourceLocation = /* @__PURE__ */ __name(function SourceLocation2(p, start, end) {
this.start = start;
this.end = end;
if (p.sourceFile !== null) {
this.source = p.sourceFile;
}
}, "SourceLocation");
function getLineInfo(input, offset2) {
for (var line = 1, cur = 0; ; ) {
var nextBreak = nextLineBreak(input, cur, offset2);
if (nextBreak < 0) {
return new Position(line, offset2 - cur);
}
++line;
cur = nextBreak;
}
}
__name(getLineInfo, "getLineInfo");
var defaultOptions = {
ecmaVersion: null,
sourceType: "script",
onInsertedSemicolon: null,
onTrailingComma: null,
allowReserved: null,
allowReturnOutsideFunction: false,
allowImportExportEverywhere: false,
allowAwaitOutsideFunction: null,
allowSuperOutsideMethod: null,
allowHashBang: false,
checkPrivateFields: true,
locations: false,
onToken: null,
onComment: null,
ranges: false,
program: null,
sourceFile: null,
directSourceFile: null,
preserveParens: false
};
var warnedAboutEcmaVersion = false;
function getOptions(opts) {
var options = {};
for (var opt in defaultOptions) {
options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt];
}
if (options.ecmaVersion === "latest") {
options.ecmaVersion = 1e8;
} else if (options.ecmaVersion == null) {
if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) {
warnedAboutEcmaVersion = true;
console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.");
}
options.ecmaVersion = 11;
} else if (options.ecmaVersion >= 2015) {
options.ecmaVersion -= 2009;
}
if (options.allowReserved == null) {
options.allowReserved = options.ecmaVersion < 5;
}
if (!opts || opts.allowHashBang == null) {
options.allowHashBang = options.ecmaVersion >= 14;
}
if (isArray(options.onToken)) {
var tokens = options.onToken;
options.onToken = function(token) {
return tokens.push(token);
};
}
if (isArray(options.onComment)) {
options.onComment = pushComment(options, options.onComment);
}
return options;
}
__name(getOptions, "getOptions");
function pushComment(options, array) {
return function(block, text, start, end, startLoc, endLoc) {
var comment = {
type: block ? "Block" : "Line",
value: text,
start,
end
};
if (options.locations) {
comment.loc = new SourceLocation(this, startLoc, endLoc);
}
if (options.ranges) {
comment.range = [start, end];
}
array.push(comment);
};
}
__name(pushComment, "pushComment");
var SCOPE_TOP = 1;
var SCOPE_FUNCTION = 2;
var SCOPE_ASYNC = 4;
var SCOPE_GENERATOR = 8;
var SCOPE_ARROW = 16;
var SCOPE_SIMPLE_CATCH = 32;
var SCOPE_SUPER = 64;
var SCOPE_DIRECT_SUPER = 128;
var SCOPE_CLASS_STATIC_BLOCK = 256;
var SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
function functionFlags(async, generator) {
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
}
__name(functionFlags, "functionFlags");
var BIND_NONE = 0;
var BIND_VAR = 1;
var BIND_LEXICAL = 2;
var BIND_FUNCTION = 3;
var BIND_SIMPLE_CATCH = 4;
var BIND_OUTSIDE = 5;
var Parser = /* @__PURE__ */ __name(function Parser2(options, input, startPos) {
this.options = options = getOptions(options);
this.sourceFile = options.sourceFile;
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
var reserved = "";
if (options.allowReserved !== true) {
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
if (options.sourceType === "module") {
reserved += " await";
}
}
this.reservedWords = wordsRegexp(reserved);
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
this.reservedWordsStrict = wordsRegexp(reservedStrict);
this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
this.input = String(input);
this.containsEsc = false;
if (startPos) {
this.pos = startPos;
this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
} else {
this.pos = this.lineStart = 0;
this.curLine = 1;
}
this.type = types$1.eof;
this.value = null;
this.start = this.end = this.pos;
this.startLoc = this.endLoc = this.curPosition();
this.lastTokEndLoc = this.lastTokStartLoc = null;
this.lastTokStart = this.lastTokEnd = this.pos;
this.context = this.initialContext();
this.exprAllowed = true;
this.inModule = options.sourceType === "module";
this.strict = this.inModule || this.strictDirective(this.pos);
this.potentialArrowAt = -1;
this.potentialArrowInForAwait = false;
this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
this.labels = [];
this.undefinedExports = /* @__PURE__ */ Object.create(null);
if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") {
this.skipLineComment(2);
}
this.scopeStack = [];
this.enterScope(SCOPE_TOP);
this.regexpState = null;
this.privateNameStack = [];
}, "Parser");
var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, inClassStaticBlock: { configurable: true } };
Parser.prototype.parse = /* @__PURE__ */ __name(function parse3() {
var node = this.options.program || this.startNode();
this.nextToken();
return this.parseTopLevel(node);
}, "parse");
prototypeAccessors.inFunction.get = function() {
return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0;
};
prototypeAccessors.inGenerator.get = function() {
return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit;
};
prototypeAccessors.inAsync.get = function() {
return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit;
};
prototypeAccessors.canAwait.get = function() {
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
var scope = this.scopeStack[i];
if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) {
return false;
}
if (scope.flags & SCOPE_FUNCTION) {
return (scope.flags & SCOPE_ASYNC) > 0;
}
}
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
};
prototypeAccessors.allowSuper.get = function() {
var ref2 = this.currentThisScope();
var flags = ref2.flags;
var inClassFieldInit = ref2.inClassFieldInit;
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod;
};
prototypeAccessors.allowDirectSuper.get = function() {
return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0;
};
prototypeAccessors.treatFunctionsAsVar.get = function() {
return this.treatFunctionsAsVarInScope(this.currentScope());
};
prototypeAccessors.allowNewDotTarget.get = function() {
var ref2 = this.currentThisScope();
var flags = ref2.flags;
var inClassFieldInit = ref2.inClassFieldInit;
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit;
};
prototypeAccessors.inClassStaticBlock.get = function() {
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0;
};
Parser.extend = /* @__PURE__ */ __name(function extend() {
var plugins = [], len = arguments.length;
while (len--)
plugins[len] = arguments[len];
var cls = this;
for (var i = 0; i < plugins.length; i++) {
cls = plugins[i](cls);
}
return cls;
}, "extend");
Parser.parse = /* @__PURE__ */ __name(function parse4(input, options) {
return new this(options, input).parse();
}, "parse");
Parser.parseExpressionAt = /* @__PURE__ */ __name(function parseExpressionAt(input, pos, options) {
var parser = new this(options, input, pos);
parser.nextToken();
return parser.parseExpression();
}, "parseExpressionAt");
Parser.tokenizer = /* @__PURE__ */ __name(function tokenizer(input, options) {
return new this(options, input);
}, "tokenizer");
Object.defineProperties(Parser.prototype, prototypeAccessors);
var pp$9 = Parser.prototype;
var literal = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
pp$9.strictDirective = function(start) {
if (this.options.ecmaVersion < 5) {
return false;
}
for (; ; ) {
skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this.input)[0].length;
var match = literal.exec(this.input.slice(start));
if (!match) {
return false;
}
if ((match[1] || match[2]) === "use strict") {
skipWhiteSpace.lastIndex = start + match[0].length;
var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
var next = this.input.charAt(end);
return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "=");
}
start += match[0].length;
skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this.input)[0].length;
if (this.input[start] === ";") {
start++;
}
}
};
pp$9.eat = function(type) {
if (this.type === type) {
this.next();
return true;
} else {
return false;
}
};
pp$9.isContextual = function(name) {
return this.type === types$1.name && this.value === name && !this.containsEsc;
};
pp$9.eatContextual = function(name) {
if (!this.isContextual(name)) {
return false;
}
this.next();
return true;
};
pp$9.expectContextual = function(name) {
if (!this.eatContextual(name)) {
this.unexpected();
}
};
pp$9.canInsertSemicolon = function() {
return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
};
pp$9.insertSemicolon = function() {
if (this.canInsertSemicolon()) {
if (this.options.onInsertedSemicolon) {
this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc);
}
return true;
}
};
pp$9.semicolon = function() {
if (!this.eat(types$1.semi) && !this.insertSemicolon()) {
this.unexpected();
}
};
pp$9.afterTrailingComma = function(tokType, notNext) {
if (this.type === tokType) {
if (this.options.onTrailingComma) {
this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc);
}
if (!notNext) {
this.next();
}
return true;
}
};
pp$9.expect = function(type) {
this.eat(type) || this.unexpected();
};
pp$9.unexpected = function(pos) {
this.raise(pos != null ? pos : this.start, "Unexpected token");
};
var DestructuringErrors = /* @__PURE__ */ __name(function DestructuringErrors2() {
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
}, "DestructuringErrors");
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
if (!refDestructuringErrors) {
return;
}
if (refDestructuringErrors.trailingComma > -1) {
this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element");
}
var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
if (parens > -1) {
this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern");
}
};
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
if (!refDestructuringErrors) {
return false;
}
var shorthandAssign = refDestructuringErrors.shorthandAssign;
var doubleProto = refDestructuringErrors.doubleProto;
if (!andThrow) {
return shorthandAssign >= 0 || doubleProto >= 0;
}
if (shorthandAssign >= 0) {
this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns");
}
if (doubleProto >= 0) {
this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property");
}
};
pp$9.checkYieldAwaitInDefaultParams = function() {
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) {
this.raise(this.yieldPos, "Yield expression cannot be a default value");
}
if (this.awaitPos) {
this.raise(this.awaitPos, "Await expression cannot be a default value");
}
};
pp$9.isSimpleAssignTarget = function(expr) {
if (expr.type === "ParenthesizedExpression") {
return this.isSimpleAssignTarget(expr.expression);
}
return expr.type === "Identifier" || expr.type === "MemberExpression";
};
var pp$8 = Parser.prototype;
pp$8.parseTopLevel = function(node) {
var exports = /* @__PURE__ */ Object.create(null);
if (!node.body) {
node.body = [];
}
while (this.type !== types$1.eof) {
var stmt = this.parseStatement(null, true, exports);
node.body.push(stmt);
}
if (this.inModule) {
for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1) {
var name = list[i];
this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined");
}
}
this.adaptDirectivePrologue(node.body);
this.next();
node.sourceType = this.options.sourceType;
return this.finishNode(node, "Program");
};
var loopLabel = { kind: "loop" };
var switchLabel = { kind: "switch" };
pp$8.isLet = function(context) {
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) {
return false;
}
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
if (nextCh === 91 || nextCh === 92) {
return true;
}
if (context) {
return false;
}
if (nextCh === 123 || nextCh > 55295 && nextCh < 56320) {
return true;
}
if (isIdentifierStart(nextCh, true)) {
var pos = next + 1;
while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) {
++pos;
}
if (nextCh === 92 || nextCh > 55295 && nextCh < 56320) {
return true;
}
var ident = this.input.slice(next, pos);
if (!keywordRelationalOperator.test(ident)) {
return true;
}
}
return false;
};
pp$8.isAsyncFunction = function() {
if (this.options.ecmaVersion < 8 || !this.isContextual("async")) {
return false;
}
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
var next = this.pos + skip[0].length, after;
return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 55295 && after < 56320));
};
pp$8.parseStatement = function(context, topLevel, exports) {
var starttype = this.type, node = this.startNode(), kind;
if (this.isLet(context)) {
starttype = types$1._var;
kind = "let";
}
switch (starttype) {
case types$1._break:
case types$1._continue:
return this.parseBreakContinueStatement(node, starttype.keyword);
case types$1._debugger:
return this.parseDebuggerStatement(node);
case types$1._do:
return this.parseDoStatement(node);
case types$1._for:
return this.parseForStatement(node);
case types$1._function:
if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) {
this.unexpected();
}
return this.parseFunctionStatement(node, false, !context);
case types$1._class:
if (context) {
this.unexpected();
}
return this.parseClass(node, true);
case types$1._if:
return this.parseIfStatement(node);
case types$1._return:
return this.parseReturnStatement(node);
case types$1._switch:
return this.parseSwitchStatement(node);
case types$1._throw:
return this.parseThrowStatement(node);
case types$1._try:
return this.parseTryStatement(node);
case types$1._const:
case types$1._var:
kind = kind || this.value;
if (context && kind !== "var") {
this.unexpected();
}
return this.parseVarStatement(node, kind);
case types$1._while:
return this.parseWhileStatement(node);
case types$1._with:
return this.parseWithStatement(node);
case types$1.braceL:
return this.parseBlock(true, node);
case types$1.semi:
return this.parseEmptyStatement(node);
case types$1._export:
case types$1._import:
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
if (nextCh === 40 || nextCh === 46) {
return this.parseExpressionStatement(node, this.parseExpression());
}
}
if (!this.options.allowImportExportEverywhere) {
if (!topLevel) {
this.raise(this.start, "'import' and 'export' may only appear at the top level");
}
if (!this.inModule) {
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
}
}
return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports);
default:
if (this.isAsyncFunction()) {
if (context) {
this.unexpected();
}
this.next();
return this.parseFunctionStatement(node, true, !context);
}
var maybeName = this.value, expr = this.parseExpression();
if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) {
return this.parseLabeledStatement(node, maybeName, expr, context);
} else {
return this.parseExpressionStatement(node, expr);
}
}
};
pp$8.parseBreakContinueStatement = function(node, keyword) {
var isBreak = keyword === "break";
this.next();
if (this.eat(types$1.semi) || this.insertSemicolon()) {
node.label = null;
} else if (this.type !== types$1.name) {
this.unexpected();
} else {
node.label = this.parseIdent();
this.semicolon();
}
var i = 0;
for (; i < this.labels.length; ++i) {
var lab = this.labels[i];
if (node.label == null || lab.name === node.label.name) {
if (lab.kind != null && (isBreak || lab.kind === "loop")) {
break;
}
if (node.label && isBreak) {
break;
}
}
}
if (i === this.labels.length) {
this.raise(node.start, "Unsyntactic " + keyword);
}
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
};
pp$8.parseDebuggerStatement = function(node) {
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement");
};
pp$8.parseDoStatement = function(node) {
this.next();
this.labels.push(loopLabel);
node.body = this.parseStatement("do");
this.labels.pop();
this.expect(types$1._while);
node.test = this.parseParenExpression();
if (this.options.ecmaVersion >= 6) {
this.eat(types$1.semi);
} else {
this.semicolon();
}
return this.finishNode(node, "DoWhileStatement");
};
pp$8.parseForStatement = function(node) {
this.next();
var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
this.labels.push(loopLabel);
this.enterScope(0);
this.expect(types$1.parenL);
if (this.type === types$1.semi) {
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, null);
}
var isLet = this.isLet();
if (this.type === types$1._var || this.type === types$1._const || isLet) {
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
this.next();
this.parseVar(init$1, true, kind);
this.finishNode(init$1, "VariableDeclaration");
if ((this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init$1.declarations.length === 1) {
if (this.options.ecmaVersion >= 9) {
if (this.type === types$1._in) {
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
} else {
node.await = awaitAt > -1;
}
}
return this.parseForIn(node, init$1);
}
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, init$1);
}
var startsWithLet = this.isContextual("let"), isForOf = false;
var containsEsc = this.containsEsc;
var refDestructuringErrors = new DestructuringErrors();
var initPos = this.start;
var init = awaitAt > -1 ? this.parseExprSubscripts(refDestructuringErrors, "await") : this.parseExpression(true, refDestructuringErrors);
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
if (awaitAt > -1) {
if (this.type === types$1._in) {
this.unexpected(awaitAt);
}
node.await = true;
} else if (isForOf && this.options.ecmaVersion >= 8) {
if (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async") {
this.unexpected();
} else if (this.options.ecmaVersion >= 9) {
node.await = false;
}
}
if (startsWithLet && isForOf) {
this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'.");
}
this.toAssignable(init, false, refDestructuringErrors);
this.checkLValPattern(init);
return this.parseForIn(node, init);
} else {
this.checkExpressionErrors(refDestructuringErrors, true);
}
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, init);
};
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
this.next();
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
};
pp$8.parseIfStatement = function(node) {
this.next();
node.test = this.parseParenExpression();
node.consequent = this.parseStatement("if");
node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null;
return this.finishNode(node, "IfStatement");
};
pp$8.parseReturnStatement = function(node) {
if (!this.inFunction && !this.options.allowReturnOutsideFunction) {
this.raise(this.start, "'return' outside of function");
}
this.next();
if (this.eat(types$1.semi) || this.insertSemicolon()) {
node.argument = null;
} else {
node.argument = this.parseExpression();
this.semicolon();
}
return this.finishNode(node, "ReturnStatement");
};
pp$8.parseSwitchStatement = function(node) {
this.next();
node.discriminant = this.parseParenExpression();
node.cases = [];
this.expect(types$1.braceL);
this.labels.push(switchLabel);
this.enterScope(0);
var cur;
for (var sawDefault = false; this.type !== types$1.braceR; ) {
if (this.type === types$1._case || this.type === types$1._default) {
var isCase = this.type === types$1._case;
if (cur) {
this.finishNode(cur, "SwitchCase");
}
node.cases.push(cur = this.startNode());
cur.consequent = [];
this.next();
if (isCase) {
cur.test = this.parseExpression();
} else {
if (sawDefault) {
this.raiseRecoverable(this.lastTokStart, "Multiple default clauses");
}
sawDefault = true;
cur.test = null;
}
this.expect(types$1.colon);
} else {
if (!cur) {
this.unexpected();
}
cur.consequent.push(this.parseStatement(null));
}
}
this.exitScope();
if (cur) {
this.finishNode(cur, "SwitchCase");
}
this.next();
this.labels.pop();
return this.finishNode(node, "SwitchStatement");
};
pp$8.parseThrowStatement = function(node) {
this.next();
if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) {
this.raise(this.lastTokEnd, "Illegal newline after throw");
}
node.argument = this.parseExpression();
this.semicolon();
return this.finishNode(node, "ThrowStatement");
};
var empty$1 = [];
pp$8.parseCatchClauseParam = function() {
var param = this.parseBindingAtom();
var simple = param.type === "Identifier";
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
this.expect(types$1.parenR);
return param;
};
pp$8.parseTryStatement = function(node) {
this.next();
node.block = this.parseBlock();
node.handler = null;
if (this.type === types$1._catch) {
var clause = this.startNode();
this.next();
if (this.eat(types$1.parenL)) {
clause.param = this.parseCatchClauseParam();
} else {
if (this.options.ecmaVersion < 10) {
this.unexpected();
}
clause.param = null;
this.enterScope(0);
}
clause.body = this.parseBlock(false);
this.exitScope();
node.handler = this.finishNode(clause, "CatchClause");
}
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer) {
this.raise(node.start, "Missing catch or finally clause");
}
return this.finishNode(node, "TryStatement");
};
pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
this.next();
this.parseVar(node, false, kind, allowMissingInitializer);
this.semicolon();
return this.finishNode(node, "VariableDeclaration");
};
pp$8.parseWhileStatement = function(node) {
this.next();
node.test = this.parseParenExpression();
this.labels.push(loopLabel);
node.body = this.parseStatement("while");
this.labels.pop();
return this.finishNode(node, "WhileStatement");
};
pp$8.parseWithStatement = function(node) {
if (this.strict) {
this.raise(this.start, "'with' in strict mode");
}
this.next();
node.object = this.parseParenExpression();
node.body = this.parseStatement("with");
return this.finishNode(node, "WithStatement");
};
pp$8.parseEmptyStatement = function(node) {
this.next();
return this.finishNode(node, "EmptyStatement");
};
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) {
var label = list[i$1];
if (label.name === maybeName) {
this.raise(expr.start, "Label '" + maybeName + "' is already declared");
}
}
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
for (var i = this.labels.length - 1; i >= 0; i--) {
var label$1 = this.labels[i];
if (label$1.statementStart === node.start) {
label$1.statementStart = this.start;
label$1.kind = kind;
} else {
break;
}
}
this.labels.push({ name: maybeName, kind, statementStart: this.start });
node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
this.labels.pop();
node.label = expr;
return this.finishNode(node, "LabeledStatement");
};
pp$8.parseExpressionStatement = function(node, expr) {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement");
};
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
if (createNewLexicalScope === void 0)
createNewLexicalScope = true;
if (node === void 0)
node = this.startNode();
node.body = [];
this.expect(types$1.braceL);
if (createNewLexicalScope) {
this.enterScope(0);
}
while (this.type !== types$1.braceR) {
var stmt = this.parseStatement(null);
node.body.push(stmt);
}
if (exitStrict) {
this.strict = false;
}
this.next();
if (createNewLexicalScope) {
this.exitScope();
}
return this.finishNode(node, "BlockStatement");
};
pp$8.parseFor = function(node, init) {
node.init = init;
this.expect(types$1.semi);
node.test = this.type === types$1.semi ? null : this.parseExpression();
this.expect(types$1.semi);
node.update = this.type === types$1.parenR ? null : this.parseExpression();
this.expect(types$1.parenR);
node.body = this.parseStatement("for");
this.exitScope();
this.labels.pop();
return this.finishNode(node, "ForStatement");
};
pp$8.parseForIn = function(node, init) {
var isForIn = this.type === types$1._in;
this.next();
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
this.raise(
init.start,
(isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"
);
}
node.left = init;
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
this.expect(types$1.parenR);
node.body = this.parseStatement("for");
this.exitScope();
this.labels.pop();
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
};
pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
node.declarations = [];
node.kind = kind;
for (; ; ) {
var decl = this.startNode();
this.parseVarId(decl, kind);
if (this.eat(types$1.eq)) {
decl.init = this.parseMaybeAssign(isFor);
} else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
this.unexpected();
} else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
} else {
decl.init = null;
}
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
if (!this.eat(types$1.comma)) {
break;
}
}
return node;
};
pp$8.parseVarId = function(decl, kind) {
decl.id = this.parseBindingAtom();
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
};
var FUNC_STATEMENT = 1;
var FUNC_HANGING_STATEMENT = 2;
var FUNC_NULLABLE_ID = 4;
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
this.initFunction(node);
if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {
if (this.type === types$1.star && statement & FUNC_HANGING_STATEMENT) {
this.unexpected();
}
node.generator = this.eat(types$1.star);
}
if (this.options.ecmaVersion >= 8) {
node.async = !!isAsync;
}
if (statement & FUNC_STATEMENT) {
node.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent();
if (node.id && !(statement & FUNC_HANGING_STATEMENT)) {
this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION);
}
}
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
this.enterScope(functionFlags(node.async, node.generator));
if (!(statement & FUNC_STATEMENT)) {
node.id = this.type === types$1.name ? this.parseIdent() : null;
}
this.parseFunctionParams(node);
this.parseFunctionBody(node, allowExpressionBody, false, forInit);
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression");
};
pp$8.parseFunctionParams = function(node) {
this.expect(types$1.parenL);
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
this.checkYieldAwaitInDefaultParams();
};
pp$8.parseClass = function(node, isStatement) {
this.next();
var oldStrict = this.strict;
this.strict = true;
this.parseClassId(node, isStatement);
this.parseClassSuper(node);
var privateNameMap = this.enterClassBody();
var classBody = this.startNode();
var hadConstructor = false;
classBody.body = [];
this.expect(types$1.braceL);
while (this.type !== types$1.braceR) {
var element = this.parseClassElement(node.superClass !== null);
if (element) {
classBody.body.push(element);
if (element.type === "MethodDefinition" && element.kind === "constructor") {
if (hadConstructor) {
this.raiseRecoverable(element.start, "Duplicate constructor in the same class");
}
hadConstructor = true;
} else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
this.raiseRecoverable(element.key.start, "Identifier '#" + element.key.name + "' has already been declared");
}
}
}
this.strict = oldStrict;
this.next();
node.body = this.finishNode(classBody, "ClassBody");
this.exitClassBody();
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
};
pp$8.parseClassElement = function(constructorAllowsSuper) {
if (this.eat(types$1.semi)) {
return null;
}
var ecmaVersion = this.options.ecmaVersion;
var node = this.startNode();
var keyName = "";
var isGenerator = false;
var isAsync = false;
var kind = "method";
var isStatic = false;
if (this.eatContextual("static")) {
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
this.parseClassStaticBlock(node);
return node;
}
if (this.isClassElementNameStart() || this.type === types$1.star) {
isStatic = true;
} else {
keyName = "static";
}
}
node.static = isStatic;
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {
isAsync = true;
} else {
keyName = "async";
}
}
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {
isGenerator = true;
}
if (!keyName && !isAsync && !isGenerator) {
var lastValue = this.value;
if (this.eatContextual("get") || this.eatContextual("set")) {
if (this.isClassElementNameStart()) {
kind = lastValue;
} else {
keyName = lastValue;
}
}
}
if (keyName) {
node.computed = false;
node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
node.key.name = keyName;
this.finishNode(node.key, "Identifier");
} else {
this.parseClassElementName(node);
}
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
var isConstructor = !node.static && checkKeyName(node, "constructor");
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
if (isConstructor && kind !== "method") {
this.raise(node.key.start, "Constructor can't have get/set modifier");
}
node.kind = isConstructor ? "constructor" : kind;
this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
} else {
this.parseClassField(node);
}
return node;
};
pp$8.isClassElementNameStart = function() {
return this.type === types$1.name || this.type === types$1.privateId || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword;
};
pp$8.parseClassElementName = function(element) {
if (this.type === types$1.privateId) {
if (this.value === "constructor") {
this.raise(this.start, "Classes can't have an element named '#constructor'");
}
element.computed = false;
element.key = this.parsePrivateIdent();
} else {
this.parsePropertyName(element);
}
};
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
var key = method.key;
if (method.kind === "constructor") {
if (isGenerator) {
this.raise(key.start, "Constructor can't be a generator");
}
if (isAsync) {
this.raise(key.start, "Constructor can't be an async method");
}
} else if (method.static && checkKeyName(method, "prototype")) {
this.raise(key.start, "Classes may not have a static property named prototype");
}
var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
if (method.kind === "get" && value.params.length !== 0) {
this.raiseRecoverable(value.start, "getter should have no params");
}
if (method.kind === "set" && value.params.length !== 1) {
this.raiseRecoverable(value.start, "setter should have exactly one param");
}
if (method.kind === "set" && value.params[0].type === "RestElement") {
this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params");
}
return this.finishNode(method, "MethodDefinition");
};
pp$8.parseClassField = function(field) {
if (checkKeyName(field, "constructor")) {
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
} else if (field.static && checkKeyName(field, "prototype")) {
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
}
if (this.eat(types$1.eq)) {
var scope = this.currentThisScope();
var inClassFieldInit = scope.inClassFieldInit;
scope.inClassFieldInit = true;
field.value = this.parseMaybeAssign();
scope.inClassFieldInit = inClassFieldInit;
} else {
field.value = null;
}
this.semicolon();
return this.finishNode(field, "PropertyDefinition");
};
pp$8.parseClassStaticBlock = function(node) {
node.body = [];
var oldLabels = this.labels;
this.labels = [];
this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);
while (this.type !== types$1.braceR) {
var stmt = this.parseStatement(null);
node.body.push(stmt);
}
this.next();
this.exitScope();
this.labels = oldLabels;
return this.finishNode(node, "StaticBlock");
};
pp$8.parseClassId = function(node, isStatement) {
if (this.type === types$1.name) {
node.id = this.parseIdent();
if (isStatement) {
this.checkLValSimple(node.id, BIND_LEXICAL, false);
}
} else {
if (isStatement === true) {
this.unexpected();
}
node.id = null;
}
};
pp$8.parseClassSuper = function(node) {
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null;
};
pp$8.enterClassBody = function() {
var element = { declared: /* @__PURE__ */ Object.create(null), used: [] };
this.privateNameStack.push(element);
return element.declared;
};
pp$8.exitClassBody = function() {
var ref2 = this.privateNameStack.pop();
var declared = ref2.declared;
var used = ref2.used;
if (!this.options.checkPrivateFields) {
return;
}
var len = this.privateNameStack.length;
var parent = len === 0 ? null : this.privateNameStack[len - 1];
for (var i = 0; i < used.length; ++i) {
var id = used[i];
if (!hasOwn(declared, id.name)) {
if (parent) {
parent.used.push(id);
} else {
this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class");
}
}
}
};
function isPrivateNameConflicted(privateNameMap, element) {
var name = element.key.name;
var curr = privateNameMap[name];
var next = "true";
if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) {
next = (element.static ? "s" : "i") + element.kind;
}
if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") {
privateNameMap[name] = "true";
return false;
} else if (!curr) {
privateNameMap[name] = next;
return false;
} else {
return true;
}
}
__name(isPrivateNameConflicted, "isPrivateNameConflicted");
function checkKeyName(node, name) {
var computed = node.computed;
var key = node.key;
return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name);
}
__name(checkKeyName, "checkKeyName");
pp$8.parseExportAllDeclaration = function(node, exports) {
if (this.options.ecmaVersion >= 11) {
if (this.eatContextual("as")) {
node.exported = this.parseModuleExportName();
this.checkExport(exports, node.exported, this.lastTokStart);
} else {
node.exported = null;
}
}
this.expectContextual("from");
if (this.type !== types$1.string) {
this.unexpected();
}
node.source = this.parseExprAtom();
this.semicolon();
return this.finishNode(node, "ExportAllDeclaration");
};
pp$8.parseExport = function(node, exports) {
this.next();
if (this.eat(types$1.star)) {
return this.parseExportAllDeclaration(node, exports);
}
if (this.eat(types$1._default)) {
this.checkExport(exports, "default", this.lastTokStart);
node.declaration = this.parseExportDefaultDeclaration();
return this.finishNode(node, "ExportDefaultDeclaration");
}
if (this.shouldParseExportStatement()) {
node.declaration = this.parseExportDeclaration(node);
if (node.declaration.type === "VariableDeclaration") {
this.checkVariableExport(exports, node.declaration.declarations);
} else {
this.checkExport(exports, node.declaration.id, node.declaration.id.start);
}
node.specifiers = [];
node.source = null;
} else {
node.declaration = null;
node.specifiers = this.parseExportSpecifiers(exports);
if (this.eatContextual("from")) {
if (this.type !== types$1.string) {
this.unexpected();
}
node.source = this.parseExprAtom();
} else {
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
var spec = list[i];
this.checkUnreserved(spec.local);
this.checkLocalExport(spec.local);
if (spec.local.type === "Literal") {
this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
}
}
node.source = null;
}
this.semicolon();
}
return this.finishNode(node, "ExportNamedDeclaration");
};
pp$8.parseExportDeclaration = function(node) {
return this.parseStatement(null);
};
pp$8.parseExportDefaultDeclaration = function() {
var isAsync;
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
var fNode = this.startNode();
this.next();
if (isAsync) {
this.next();
}
return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
} else if (this.type === types$1._class) {
var cNode = this.startNode();
return this.parseClass(cNode, "nullableID");
} else {
var declaration = this.parseMaybeAssign();
this.semicolon();
return declaration;
}
};
pp$8.checkExport = function(exports, name, pos) {
if (!exports) {
return;
}
if (typeof name !== "string") {
name = name.type === "Identifier" ? name.name : name.value;
}
if (hasOwn(exports, name)) {
this.raiseRecoverable(pos, "Duplicate export '" + name + "'");
}
exports[name] = true;
};
pp$8.checkPatternExport = function(exports, pat) {
var type = pat.type;
if (type === "Identifier") {
this.checkExport(exports, pat, pat.start);
} else if (type === "ObjectPattern") {
for (var i = 0, list = pat.properties; i < list.length; i += 1) {
var prop = list[i];
this.checkPatternExport(exports, prop);
}
} else if (type === "ArrayPattern") {
for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
var elt = list$1[i$1];
if (elt) {
this.checkPatternExport(exports, elt);
}
}
} else if (type === "Property") {
this.checkPatternExport(exports, pat.value);
} else if (type === "AssignmentPattern") {
this.checkPatternExport(exports, pat.left);
} else if (type === "RestElement") {
this.checkPatternExport(exports, pat.argument);
}
};
pp$8.checkVariableExport = function(exports, decls) {
if (!exports) {
return;
}
for (var i = 0, list = decls; i < list.length; i += 1) {
var decl = list[i];
this.checkPatternExport(exports, decl.id);
}
};
pp$8.shouldParseExportStatement = function() {
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
};
pp$8.parseExportSpecifier = function(exports) {
var node = this.startNode();
node.local = this.parseModuleExportName();
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
this.checkExport(
exports,
node.exported,
node.exported.start
);
return this.finishNode(node, "ExportSpecifier");
};
pp$8.parseExportSpecifiers = function(exports) {
var nodes = [], first = true;
this.expect(types$1.braceL);
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
nodes.push(this.parseExportSpecifier(exports));
}
return nodes;
};
pp$8.parseImport = function(node) {
this.next();
if (this.type === types$1.string) {
node.specifiers = empty$1;
node.source = this.parseExprAtom();
} else {
node.specifiers = this.parseImportSpecifiers();
this.expectContextual("from");
node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
};
pp$8.parseImportSpecifier = function() {
var node = this.startNode();
node.imported = this.parseModuleExportName();
if (this.eatContextual("as")) {
node.local = this.parseIdent();
} else {
this.checkUnreserved(node.imported);
node.local = node.imported;
}
this.checkLValSimple(node.local, BIND_LEXICAL);
return this.finishNode(node, "ImportSpecifier");
};
pp$8.parseImportDefaultSpecifier = function() {
var node = this.startNode();
node.local = this.parseIdent();
this.checkLValSimple(node.local, BIND_LEXICAL);
return this.finishNode(node, "ImportDefaultSpecifier");
};
pp$8.parseImportNamespaceSpecifier = function() {
var node = this.startNode();
this.next();
this.expectContextual("as");
node.local = this.parseIdent();
this.checkLValSimple(node.local, BIND_LEXICAL);
return this.finishNode(node, "ImportNamespaceSpecifier");
};
pp$8.parseImportSpecifiers = function() {
var nodes = [], first = true;
if (this.type === types$1.name) {
nodes.push(this.parseImportDefaultSpecifier());
if (!this.eat(types$1.comma)) {
return nodes;
}
}
if (this.type === types$1.star) {
nodes.push(this.parseImportNamespaceSpecifier());
return nodes;
}
this.expect(types$1.braceL);
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
nodes.push(this.parseImportSpecifier());
}
return nodes;
};
pp$8.parseModuleExportName = function() {
if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
var stringLiteral = this.parseLiteral(this.value);
if (loneSurrogate.test(stringLiteral.value)) {
this.raise(stringLiteral.start, "An export name cannot include a lone surrogate.");
}
return stringLiteral;
}
return this.parseIdent(true);
};
pp$8.adaptDirectivePrologue = function(statements) {
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
statements[i].directive = statements[i].expression.raw.slice(1, -1);
}
};
pp$8.isDirectiveCandidate = function(statement) {
return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && (this.input[statement.start] === '"' || this.input[statement.start] === "'");
};
var pp$7 = Parser.prototype;
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
if (this.options.ecmaVersion >= 6 && node) {
switch (node.type) {
case "Identifier":
if (this.inAsync && node.name === "await") {
this.raise(node.start, "Cannot use 'await' as identifier inside an async function");
}
break;
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
case "RestElement":
break;
case "ObjectExpression":
node.type = "ObjectPattern";
if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
for (var i = 0, list = node.properties; i < list.length; i += 1) {
var prop = list[i];
this.toAssignable(prop, isBinding);
if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) {
this.raise(prop.argument.start, "Unexpected token");
}
}
break;
case "Property":
if (node.kind !== "init") {
this.raise(node.key.start, "Object pattern can't contain getter or setter");
}
this.toAssignable(node.value, isBinding);
break;
case "ArrayExpression":
node.type = "ArrayPattern";
if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
this.toAssignableList(node.elements, isBinding);
break;
case "SpreadElement":
node.type = "RestElement";
this.toAssignable(node.argument, isBinding);
if (node.argument.type === "AssignmentPattern") {
this.raise(node.argument.start, "Rest elements cannot have a default value");
}
break;
case "AssignmentExpression":
if (node.operator !== "=") {
this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
}
node.type = "AssignmentPattern";
delete node.operator;
this.toAssignable(node.left, isBinding);
break;
case "ParenthesizedExpression":
this.toAssignable(node.expression, isBinding, refDestructuringErrors);
break;
case "ChainExpression":
this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
break;
case "MemberExpression":
if (!isBinding) {
break;
}
default:
this.raise(node.start, "Assigning to rvalue");
}
} else if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
return node;
};
pp$7.toAssignableList = function(exprList, isBinding) {
var end = exprList.length;
for (var i = 0; i < end; i++) {
var elt = exprList[i];
if (elt) {
this.toAssignable(elt, isBinding);
}
}
if (end) {
var last = exprList[end - 1];
if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") {
this.unexpected(last.argument.start);
}
}
return exprList;
};
pp$7.parseSpread = function(refDestructuringErrors) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
return this.finishNode(node, "SpreadElement");
};
pp$7.parseRestBinding = function() {
var node = this.startNode();
this.next();
if (this.options.ecmaVersion === 6 && this.type !== types$1.name) {
this.unexpected();
}
node.argument = this.parseBindingAtom();
return this.finishNode(node, "RestElement");
};
pp$7.parseBindingAtom = function() {
if (this.options.ecmaVersion >= 6) {
switch (this.type) {
case types$1.bracketL:
var node = this.startNode();
this.next();
node.elements = this.parseBindingList(types$1.bracketR, true, true);
return this.finishNode(node, "ArrayPattern");
case types$1.braceL:
return this.parseObj(true);
}
}
return this.parseIdent();
};
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
var elts = [], first = true;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(types$1.comma);
}
if (allowEmpty && this.type === types$1.comma) {
elts.push(null);
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
break;
} else if (this.type === types$1.ellipsis) {
var rest = this.parseRestBinding();
this.parseBindingListItem(rest);
elts.push(rest);
if (this.type === types$1.comma) {
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
}
this.expect(close);
break;
} else {
elts.push(this.parseAssignableListItem(allowModifiers));
}
}
return elts;
};
pp$7.parseAssignableListItem = function(allowModifiers) {
var elem = this.parseMaybeDefault(this.start, this.startLoc);
this.parseBindingListItem(elem);
return elem;
};
pp$7.parseBindingListItem = function(param) {
return param;
};
pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
left = left || this.parseBindingAtom();
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) {
return left;
}
var node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.right = this.parseMaybeAssign();
return this.finishNode(node, "AssignmentPattern");
};
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
if (bindingType === void 0)
bindingType = BIND_NONE;
var isBind = bindingType !== BIND_NONE;
switch (expr.type) {
case "Identifier":
if (this.strict && this.reservedWordsStrictBind.test(expr.name)) {
this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
}
if (isBind) {
if (bindingType === BIND_LEXICAL && expr.name === "let") {
this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name");
}
if (checkClashes) {
if (hasOwn(checkClashes, expr.name)) {
this.raiseRecoverable(expr.start, "Argument name clash");
}
checkClashes[expr.name] = true;
}
if (bindingType !== BIND_OUTSIDE) {
this.declareName(expr.name, bindingType, expr.start);
}
}
break;
case "ChainExpression":
this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
break;
case "MemberExpression":
if (isBind) {
this.raiseRecoverable(expr.start, "Binding member expression");
}
break;
case "ParenthesizedExpression":
if (isBind) {
this.raiseRecoverable(expr.start, "Binding parenthesized expression");
}
return this.checkLValSimple(expr.expression, bindingType, checkClashes);
default:
this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue");
}
};
pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
if (bindingType === void 0)
bindingType = BIND_NONE;
switch (expr.type) {
case "ObjectPattern":
for (var i = 0, list = expr.properties; i < list.length; i += 1) {
var prop = list[i];
this.checkLValInnerPattern(prop, bindingType, checkClashes);
}
break;
case "ArrayPattern":
for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
var elem = list$1[i$1];
if (elem) {
this.checkLValInnerPattern(elem, bindingType, checkClashes);
}
}
break;
default:
this.checkLValSimple(expr, bindingType, checkClashes);
}
};
pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
if (bindingType === void 0)
bindingType = BIND_NONE;
switch (expr.type) {
case "Property":
this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
break;
case "AssignmentPattern":
this.checkLValPattern(expr.left, bindingType, checkClashes);
break;
case "RestElement":
this.checkLValPattern(expr.argument, bindingType, checkClashes);
break;
default:
this.checkLValPattern(expr, bindingType, checkClashes);
}
};
var TokContext = /* @__PURE__ */ __name(function TokContext2(token, isExpr, preserveSpace, override, generator) {
this.token = token;
this.isExpr = !!isExpr;
this.preserveSpace = !!preserveSpace;
this.override = override;
this.generator = !!generator;
}, "TokContext");
var types = {
b_stat: new TokContext("{", false),
b_expr: new TokContext("{", true),
b_tmpl: new TokContext("${", false),
p_stat: new TokContext("(", false),
p_expr: new TokContext("(", true),
q_tmpl: new TokContext("`", true, true, function(p) {
return p.tryReadTemplateToken();
}),
f_stat: new TokContext("function", false),
f_expr: new TokContext("function", true),
f_expr_gen: new TokContext("function", true, false, null, true),
f_gen: new TokContext("function", false, false, null, true)
};
var pp$6 = Parser.prototype;
pp$6.initialContext = function() {
return [types.b_stat];
};
pp$6.curContext = function() {
return this.context[this.context.length - 1];
};
pp$6.braceIsBlock = function(prevType) {
var parent = this.curContext();
if (parent === types.f_expr || parent === types.f_stat) {
return true;
}
if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr)) {
return !parent.isExpr;
}
if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed) {
return lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
}
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow) {
return true;
}
if (prevType === types$1.braceL) {
return parent === types.b_stat;
}
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name) {
return false;
}
return !this.exprAllowed;
};
pp$6.inGeneratorContext = function() {
for (var i = this.context.length - 1; i >= 1; i--) {
var context = this.context[i];
if (context.token === "function") {
return context.generator;
}
}
return false;
};
pp$6.updateContext = function(prevType) {
var update, type = this.type;
if (type.keyword && prevType === types$1.dot) {
this.exprAllowed = false;
} else if (update = type.updateContext) {
update.call(this, prevType);
} else {
this.exprAllowed = type.beforeExpr;
}
};
pp$6.overrideContext = function(tokenCtx) {
if (this.curContext() !== tokenCtx) {
this.context[this.context.length - 1] = tokenCtx;
}
};
types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
if (this.context.length === 1) {
this.exprAllowed = true;
return;
}
var out = this.context.pop();
if (out === types.b_stat && this.curContext().token === "function") {
out = this.context.pop();
}
this.exprAllowed = !out.isExpr;
};
types$1.braceL.updateContext = function(prevType) {
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);
this.exprAllowed = true;
};
types$1.dollarBraceL.updateContext = function() {
this.context.push(types.b_tmpl);
this.exprAllowed = true;
};
types$1.parenL.updateContext = function(prevType) {
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
this.context.push(statementParens ? types.p_stat : types.p_expr);
this.exprAllowed = true;
};
types$1.incDec.updateContext = function() {
};
types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
if (prevType.beforeExpr && prevType !== types$1._else && !(prevType === types$1.semi && this.curContext() !== types.p_stat) && !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat)) {
this.context.push(types.f_expr);
} else {
this.context.push(types.f_stat);
}
this.exprAllowed = false;
};
types$1.colon.updateContext = function() {
if (this.curContext().token === "function") {
this.context.pop();
}
this.exprAllowed = true;
};
types$1.backQuote.updateContext = function() {
if (this.curContext() === types.q_tmpl) {
this.context.pop();
} else {
this.context.push(types.q_tmpl);
}
this.exprAllowed = false;
};
types$1.star.updateContext = function(prevType) {
if (prevType === types$1._function) {
var index = this.context.length - 1;
if (this.context[index] === types.f_expr) {
this.context[index] = types.f_expr_gen;
} else {
this.context[index] = types.f_gen;
}
}
this.exprAllowed = true;
};
types$1.name.updateContext = function(prevType) {
var allowed = false;
if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {
if (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) {
allowed = true;
}
}
this.exprAllowed = allowed;
};
var pp$5 = Parser.prototype;
pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") {
return;
}
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) {
return;
}
var key = prop.key;
var name;
switch (key.type) {
case "Identifier":
name = key.name;
break;
case "Literal":
name = String(key.value);
break;
default:
return;
}
var kind = prop.kind;
if (this.options.ecmaVersion >= 6) {
if (name === "__proto__" && kind === "init") {
if (propHash.proto) {
if (refDestructuringErrors) {
if (refDestructuringErrors.doubleProto < 0) {
refDestructuringErrors.doubleProto = key.start;
}
} else {
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
}
}
propHash.proto = true;
}
return;
}
name = "$" + name;
var other = propHash[name];
if (other) {
var redefinition;
if (kind === "init") {
redefinition = this.strict && other.init || other.get || other.set;
} else {
redefinition = other.init || other[kind];
}
if (redefinition) {
this.raiseRecoverable(key.start, "Redefinition of property");
}
} else {
other = propHash[name] = {
init: false,
get: false,
set: false
};
}
other[kind] = true;
};
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
if (this.type === types$1.comma) {
var node = this.startNodeAt(startPos, startLoc);
node.expressions = [expr];
while (this.eat(types$1.comma)) {
node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors));
}
return this.finishNode(node, "SequenceExpression");
}
return expr;
};
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
if (this.isContextual("yield")) {
if (this.inGenerator) {
return this.parseYield(forInit);
} else {
this.exprAllowed = false;
}
}
var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
if (refDestructuringErrors) {
oldParenAssign = refDestructuringErrors.parenthesizedAssign;
oldTrailingComma = refDestructuringErrors.trailingComma;
oldDoubleProto = refDestructuringErrors.doubleProto;
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;
} else {
refDestructuringErrors = new DestructuringErrors();
ownDestructuringErrors = true;
}
var startPos = this.start, startLoc = this.startLoc;
if (this.type === types$1.parenL || this.type === types$1.name) {
this.potentialArrowAt = this.start;
this.potentialArrowInForAwait = forInit === "await";
}
var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
if (afterLeftParse) {
left = afterLeftParse.call(this, left, startPos, startLoc);
}
if (this.type.isAssign) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.value;
if (this.type === types$1.eq) {
left = this.toAssignable(left, false, refDestructuringErrors);
}
if (!ownDestructuringErrors) {
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
}
if (refDestructuringErrors.shorthandAssign >= left.start) {
refDestructuringErrors.shorthandAssign = -1;
}
if (this.type === types$1.eq) {
this.checkLValPattern(left);
} else {
this.checkLValSimple(left);
}
node.left = left;
this.next();
node.right = this.parseMaybeAssign(forInit);
if (oldDoubleProto > -1) {
refDestructuringErrors.doubleProto = oldDoubleProto;
}
return this.finishNode(node, "AssignmentExpression");
} else {
if (ownDestructuringErrors) {
this.checkExpressionErrors(refDestructuringErrors, true);
}
}
if (oldParenAssign > -1) {
refDestructuringErrors.parenthesizedAssign = oldParenAssign;
}
if (oldTrailingComma > -1) {
refDestructuringErrors.trailingComma = oldTrailingComma;
}
return left;
};
pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseExprOps(forInit, refDestructuringErrors);
if (this.checkExpressionErrors(refDestructuringErrors)) {
return expr;
}
if (this.eat(types$1.question)) {
var node = this.startNodeAt(startPos, startLoc);
node.test = expr;
node.consequent = this.parseMaybeAssign();
this.expect(types$1.colon);
node.alternate = this.parseMaybeAssign(forInit);
return this.finishNode(node, "ConditionalExpression");
}
return expr;
};
pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);
if (this.checkExpressionErrors(refDestructuringErrors)) {
return expr;
}
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit);
};
pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
var prec = this.type.binop;
if (prec != null && (!forInit || this.type !== types$1._in)) {
if (prec > minPrec) {
var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;
var coalesce = this.type === types$1.coalesce;
if (coalesce) {
prec = types$1.logicalAND.binop;
}
var op = this.value;
this.next();
var startPos = this.start, startLoc = this.startLoc;
var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
if (logical && this.type === types$1.coalesce || coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND)) {
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
}
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit);
}
}
return left;
};
pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
if (right.type === "PrivateIdentifier") {
this.raise(right.start, "Private identifier can only be left side of binary expression");
}
var node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.operator = op;
node.right = right;
return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression");
};
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
var startPos = this.start, startLoc = this.startLoc, expr;
if (this.isContextual("await") && this.canAwait) {
expr = this.parseAwait(forInit);
sawUnary = true;
} else if (this.type.prefix) {
var node = this.startNode(), update = this.type === types$1.incDec;
node.operator = this.value;
node.prefix = true;
this.next();
node.argument = this.parseMaybeUnary(null, true, update, forInit);
this.checkExpressionErrors(refDestructuringErrors, true);
if (update) {
this.checkLValSimple(node.argument);
} else if (this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument)) {
this.raiseRecoverable(node.start, "Deleting local variable in strict mode");
} else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) {
this.raiseRecoverable(node.start, "Private fields can not be deleted");
} else {
sawUnary = true;
}
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
} else if (!sawUnary && this.type === types$1.privateId) {
if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) {
this.unexpected();
}
expr = this.parsePrivateIdent();
if (this.type !== types$1._in) {
this.unexpected();
}
} else {
expr = this.parseExprSubscripts(refDestructuringErrors, forInit);
if (this.checkExpressionErrors(refDestructuringErrors)) {
return expr;
}
while (this.type.postfix && !this.canInsertSemicolon()) {
var node$1 = this.startNodeAt(startPos, startLoc);
node$1.operator = this.value;
node$1.prefix = false;
node$1.argument = expr;
this.checkLValSimple(expr);
this.next();
expr = this.finishNode(node$1, "UpdateExpression");
}
}
if (!incDec && this.eat(types$1.starstar)) {
if (sawUnary) {
this.unexpected(this.lastTokStart);
} else {
return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false);
}
} else {
return expr;
}
};
function isLocalVariableAccess(node) {
return node.type === "Identifier" || node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression);
}
__name(isLocalVariableAccess, "isLocalVariableAccess");
function isPrivateFieldAccess(node) {
return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) || node.type === "ParenthesizedExpression" && isPrivateFieldAccess(node.expression);
}
__name(isPrivateFieldAccess, "isPrivateFieldAccess");
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
var startPos = this.start, startLoc = this.startLoc;
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") {
return expr;
}
var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);
if (refDestructuringErrors && result.type === "MemberExpression") {
if (refDestructuringErrors.parenthesizedAssign >= result.start) {
refDestructuringErrors.parenthesizedAssign = -1;
}
if (refDestructuringErrors.parenthesizedBind >= result.start) {
refDestructuringErrors.parenthesizedBind = -1;
}
if (refDestructuringErrors.trailingComma >= result.start) {
refDestructuringErrors.trailingComma = -1;
}
}
return result;
};
pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.potentialArrowAt === base.start;
var optionalChained = false;
while (true) {
var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);
if (element.optional) {
optionalChained = true;
}
if (element === base || element.type === "ArrowFunctionExpression") {
if (optionalChained) {
var chainNode = this.startNodeAt(startPos, startLoc);
chainNode.expression = element;
element = this.finishNode(chainNode, "ChainExpression");
}
return element;
}
base = element;
}
};
pp$5.shouldParseAsyncArrow = function() {
return !this.canInsertSemicolon() && this.eat(types$1.arrow);
};
pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit);
};
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
var optionalSupported = this.options.ecmaVersion >= 11;
var optional = optionalSupported && this.eat(types$1.questionDot);
if (noCalls && optional) {
this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
}
var computed = this.eat(types$1.bracketL);
if (computed || optional && this.type !== types$1.parenL && this.type !== types$1.backQuote || this.eat(types$1.dot)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
if (computed) {
node.property = this.parseExpression();
this.expect(types$1.bracketR);
} else if (this.type === types$1.privateId && base.type !== "Super") {
node.property = this.parsePrivateIdent();
} else {
node.property = this.parseIdent(this.options.allowReserved !== "never");
}
node.computed = !!computed;
if (optionalSupported) {
node.optional = optional;
}
base = this.finishNode(node, "MemberExpression");
} else if (!noCalls && this.eat(types$1.parenL)) {
var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
if (this.awaitIdentPos > 0) {
this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function");
}
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit);
}
this.checkExpressionErrors(refDestructuringErrors, true);
this.yieldPos = oldYieldPos || this.yieldPos;
this.awaitPos = oldAwaitPos || this.awaitPos;
this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
var node$1 = this.startNodeAt(startPos, startLoc);
node$1.callee = base;
node$1.arguments = exprList;
if (optionalSupported) {
node$1.optional = optional;
}
base = this.finishNode(node$1, "CallExpression");
} else if (this.type === types$1.backQuote) {
if (optional || optionalChained) {
this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
}
var node$2 = this.startNodeAt(startPos, startLoc);
node$2.tag = base;
node$2.quasi = this.parseTemplate({ isTagged: true });
base = this.finishNode(node$2, "TaggedTemplateExpression");
}
return base;
};
pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
if (this.type === types$1.slash) {
this.readRegexp();
}
var node, canBeArrow = this.potentialArrowAt === this.start;
switch (this.type) {
case types$1._super:
if (!this.allowSuper) {
this.raise(this.start, "'super' keyword outside a method");
}
node = this.startNode();
this.next();
if (this.type === types$1.parenL && !this.allowDirectSuper) {
this.raise(node.start, "super() call outside constructor of a subclass");
}
if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) {
this.unexpected();
}
return this.finishNode(node, "Super");
case types$1._this:
node = this.startNode();
this.next();
return this.finishNode(node, "ThisExpression");
case types$1.name:
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;
var id = this.parseIdent(false);
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) {
this.overrideContext(types.f_expr);
return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit);
}
if (canBeArrow && !this.canInsertSemicolon()) {
if (this.eat(types$1.arrow)) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit);
}
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
id = this.parseIdent(false);
if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) {
this.unexpected();
}
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit);
}
}
return id;
case types$1.regexp:
var value = this.value;
node = this.parseLiteral(value.value);
node.regex = { pattern: value.pattern, flags: value.flags };
return node;
case types$1.num:
case types$1.string:
return this.parseLiteral(this.value);
case types$1._null:
case types$1._true:
case types$1._false:
node = this.startNode();
node.value = this.type === types$1._null ? null : this.type === types$1._true;
node.raw = this.type.keyword;
this.next();
return this.finishNode(node, "Literal");
case types$1.parenL:
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
if (refDestructuringErrors) {
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) {
refDestructuringErrors.parenthesizedAssign = start;
}
if (refDestructuringErrors.parenthesizedBind < 0) {
refDestructuringErrors.parenthesizedBind = start;
}
}
return expr;
case types$1.bracketL:
node = this.startNode();
this.next();
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
return this.finishNode(node, "ArrayExpression");
case types$1.braceL:
this.overrideContext(types.b_expr);
return this.parseObj(false, refDestructuringErrors);
case types$1._function:
node = this.startNode();
this.next();
return this.parseFunction(node, 0);
case types$1._class:
return this.parseClass(this.startNode(), false);
case types$1._new:
return this.parseNew();
case types$1.backQuote:
return this.parseTemplate();
case types$1._import:
if (this.options.ecmaVersion >= 11) {
return this.parseExprImport(forNew);
} else {
return this.unexpected();
}
default:
return this.parseExprAtomDefault();
}
};
pp$5.parseExprAtomDefault = function() {
this.unexpected();
};
pp$5.parseExprImport = function(forNew) {
var node = this.startNode();
if (this.containsEsc) {
this.raiseRecoverable(this.start, "Escape sequence in keyword import");
}
this.next();
if (this.type === types$1.parenL && !forNew) {
return this.parseDynamicImport(node);
} else if (this.type === types$1.dot) {
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
meta.name = "import";
node.meta = this.finishNode(meta, "Identifier");
return this.parseImportMeta(node);
} else {
this.unexpected();
}
};
pp$5.parseDynamicImport = function(node) {
this.next();
node.source = this.parseMaybeAssign();
if (!this.eat(types$1.parenR)) {
var errorPos = this.start;
if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
} else {
this.unexpected(errorPos);
}
}
return this.finishNode(node, "ImportExpression");
};
pp$5.parseImportMeta = function(node) {
this.next();
var containsEsc = this.containsEsc;
node.property = this.parseIdent(true);
if (node.property.name !== "meta") {
this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'");
}
if (containsEsc) {
this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters");
}
if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) {
this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module");
}
return this.finishNode(node, "MetaProperty");
};
pp$5.parseLiteral = function(value) {
var node = this.startNode();
node.value = value;
node.raw = this.input.slice(this.start, this.end);
if (node.raw.charCodeAt(node.raw.length - 1) === 110) {
node.bigint = node.raw.slice(0, -1).replace(/_/g, "");
}
this.next();
return this.finishNode(node, "Literal");
};
pp$5.parseParenExpression = function() {
this.expect(types$1.parenL);
var val = this.parseExpression();
this.expect(types$1.parenR);
return val;
};
pp$5.shouldParseArrow = function(exprList) {
return !this.canInsertSemicolon();
};
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
if (this.options.ecmaVersion >= 6) {
this.next();
var innerStartPos = this.start, innerStartLoc = this.startLoc;
var exprList = [], first = true, lastIsComma = false;
var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;
this.yieldPos = 0;
this.awaitPos = 0;
while (this.type !== types$1.parenR) {
first ? first = false : this.expect(types$1.comma);
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
lastIsComma = true;
break;
} else if (this.type === types$1.ellipsis) {
spreadStart = this.start;
exprList.push(this.parseParenItem(this.parseRestBinding()));
if (this.type === types$1.comma) {
this.raiseRecoverable(
this.start,
"Comma is not permitted after the rest element"
);
}
break;
} else {
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
}
}
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
this.expect(types$1.parenR);
if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
return this.parseParenArrowList(startPos, startLoc, exprList, forInit);
}
if (!exprList.length || lastIsComma) {
this.unexpected(this.lastTokStart);
}
if (spreadStart) {
this.unexpected(spreadStart);
}
this.checkExpressionErrors(refDestructuringErrors, true);
this.yieldPos = oldYieldPos || this.yieldPos;
this.awaitPos = oldAwaitPos || this.awaitPos;
if (exprList.length > 1) {
val = this.startNodeAt(innerStartPos, innerStartLoc);
val.expressions = exprList;
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
} else {
val = exprList[0];
}
} else {
val = this.parseParenExpression();
}
if (this.options.preserveParens) {
var par = this.startNodeAt(startPos, startLoc);
par.expression = val;
return this.finishNode(par, "ParenthesizedExpression");
} else {
return val;
}
};
pp$5.parseParenItem = function(item) {
return item;
};
pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit);
};
var empty = [];
pp$5.parseNew = function() {
if (this.containsEsc) {
this.raiseRecoverable(this.start, "Escape sequence in keyword new");
}
var node = this.startNode();
this.next();
if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
meta.name = "new";
node.meta = this.finishNode(meta, "Identifier");
this.next();
var containsEsc = this.containsEsc;
node.property = this.parseIdent(true);
if (node.property.name !== "target") {
this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'");
}
if (containsEsc) {
this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters");
}
if (!this.allowNewDotTarget) {
this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block");
}
return this.finishNode(node, "MetaProperty");
}
var startPos = this.start, startLoc = this.startLoc;
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
if (this.eat(types$1.parenL)) {
node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false);
} else {
node.arguments = empty;
}
return this.finishNode(node, "NewExpression");
};
pp$5.parseTemplateElement = function(ref2) {
var isTagged = ref2.isTagged;
var elem = this.startNode();
if (this.type === types$1.invalidTemplate) {
if (!isTagged) {
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
}
elem.value = {
raw: this.value.replace(/\r\n?/g, "\n"),
cooked: null
};
} else {
elem.value = {
raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
cooked: this.value
};
}
this.next();
elem.tail = this.type === types$1.backQuote;
return this.finishNode(elem, "TemplateElement");
};
pp$5.parseTemplate = function(ref2) {
if (ref2 === void 0)
ref2 = {};
var isTagged = ref2.isTagged;
if (isTagged === void 0)
isTagged = false;
var node = this.startNode();
this.next();
node.expressions = [];
var curElt = this.parseTemplateElement({ isTagged });
node.quasis = [curElt];
while (!curElt.tail) {
if (this.type === types$1.eof) {
this.raise(this.pos, "Unterminated template literal");
}
this.expect(types$1.dollarBraceL);
node.expressions.push(this.parseExpression());
this.expect(types$1.braceR);
node.quasis.push(curElt = this.parseTemplateElement({ isTagged }));
}
this.next();
return this.finishNode(node, "TemplateLiteral");
};
pp$5.isAsyncProp = function(prop) {
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === types$1.star) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
};
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
var node = this.startNode(), first = true, propHash = {};
node.properties = [];
this.next();
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
var prop = this.parseProperty(isPattern, refDestructuringErrors);
if (!isPattern) {
this.checkPropClash(prop, propHash, refDestructuringErrors);
}
node.properties.push(prop);
}
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
};
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
if (isPattern) {
prop.argument = this.parseIdent(false);
if (this.type === types$1.comma) {
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
}
return this.finishNode(prop, "RestElement");
}
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
refDestructuringErrors.trailingComma = this.start;
}
return this.finishNode(prop, "SpreadElement");
}
if (this.options.ecmaVersion >= 6) {
prop.method = false;
prop.shorthand = false;
if (isPattern || refDestructuringErrors) {
startPos = this.start;
startLoc = this.startLoc;
}
if (!isPattern) {
isGenerator = this.eat(types$1.star);
}
}
var containsEsc = this.containsEsc;
this.parsePropertyName(prop);
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
isAsync = true;
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
this.parsePropertyName(prop);
} else {
isAsync = false;
}
this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
return this.finishNode(prop, "Property");
};
pp$5.parseGetterSetter = function(prop) {
prop.kind = prop.key.name;
this.parsePropertyName(prop);
prop.value = this.parseMethod(false);
var paramCount = prop.kind === "get" ? 0 : 1;
if (prop.value.params.length !== paramCount) {
var start = prop.value.start;
if (prop.kind === "get") {
this.raiseRecoverable(start, "getter should have no params");
} else {
this.raiseRecoverable(start, "setter should have exactly one param");
}
} else {
if (prop.kind === "set" && prop.value.params[0].type === "RestElement") {
this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params");
}
}
};
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
if ((isGenerator || isAsync) && this.type === types$1.colon) {
this.unexpected();
}
if (this.eat(types$1.colon)) {
prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);
prop.kind = "init";
} else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {
if (isPattern) {
this.unexpected();
}
prop.kind = "init";
prop.method = true;
prop.value = this.parseMethod(isGenerator, isAsync);
} else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
if (isGenerator || isAsync) {
this.unexpected();
}
this.parseGetterSetter(prop);
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
if (isGenerator || isAsync) {
this.unexpected();
}
this.checkUnreserved(prop.key);
if (prop.key.name === "await" && !this.awaitIdentPos) {
this.awaitIdentPos = startPos;
}
prop.kind = "init";
if (isPattern) {
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
} else if (this.type === types$1.eq && refDestructuringErrors) {
if (refDestructuringErrors.shorthandAssign < 0) {
refDestructuringErrors.shorthandAssign = this.start;
}
prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
} else {
prop.value = this.copyNode(prop.key);
}
prop.shorthand = true;
} else {
this.unexpected();
}
};
pp$5.parsePropertyName = function(prop) {
if (this.options.ecmaVersion >= 6) {
if (this.eat(types$1.bracketL)) {
prop.computed = true;
prop.key = this.parseMaybeAssign();
this.expect(types$1.bracketR);
return prop.key;
} else {
prop.computed = false;
}
}
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
};
pp$5.initFunction = function(node) {
node.id = null;
if (this.options.ecmaVersion >= 6) {
node.generator = node.expression = false;
}
if (this.options.ecmaVersion >= 8) {
node.async = false;
}
};
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.initFunction(node);
if (this.options.ecmaVersion >= 6) {
node.generator = isGenerator;
}
if (this.options.ecmaVersion >= 8) {
node.async = !!isAsync;
}
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
this.expect(types$1.parenL);
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
this.checkYieldAwaitInDefaultParams();
this.parseFunctionBody(node, false, true, false);
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.finishNode(node, "FunctionExpression");
};
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
this.initFunction(node);
if (this.options.ecmaVersion >= 8) {
node.async = !!isAsync;
}
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
node.params = this.toAssignableList(params, true);
this.parseFunctionBody(node, true, false, forInit);
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.finishNode(node, "ArrowFunctionExpression");
};
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
var isExpression = isArrowFunction && this.type !== types$1.braceL;
var oldStrict = this.strict, useStrict = false;
if (isExpression) {
node.body = this.parseMaybeAssign(forInit);
node.expression = true;
this.checkParams(node, false);
} else {
var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
if (!oldStrict || nonSimple) {
useStrict = this.strictDirective(this.end);
if (useStrict && nonSimple) {
this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list");
}
}
var oldLabels = this.labels;
this.labels = [];
if (useStrict) {
this.strict = true;
}
this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));
if (this.strict && node.id) {
this.checkLValSimple(node.id, BIND_OUTSIDE);
}
node.body = this.parseBlock(false, void 0, useStrict && !oldStrict);
node.expression = false;
this.adaptDirectivePrologue(node.body.body);
this.labels = oldLabels;
}
this.exitScope();
};
pp$5.isSimpleParamList = function(params) {
for (var i = 0, list = params; i < list.length; i += 1) {
var param = list[i];
if (param.type !== "Identifier") {
return false;
}
}
return true;
};
pp$5.checkParams = function(node, allowDuplicates) {
var nameHash = /* @__PURE__ */ Object.create(null);
for (var i = 0, list = node.params; i < list.length; i += 1) {
var param = list[i];
this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
}
};
pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
var elts = [], first = true;
while (!this.eat(close)) {
if (!first) {
this.expect(types$1.comma);
if (allowTrailingComma && this.afterTrailingComma(close)) {
break;
}
} else {
first = false;
}
var elt = void 0;
if (allowEmpty && this.type === types$1.comma) {
elt = null;
} else if (this.type === types$1.ellipsis) {
elt = this.parseSpread(refDestructuringErrors);
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) {
refDestructuringErrors.trailingComma = this.start;
}
} else {
elt = this.parseMaybeAssign(false, refDestructuringErrors);
}
elts.push(elt);
}
return elts;
};
pp$5.checkUnreserved = function(ref2) {
var start = ref2.start;
var end = ref2.end;
var name = ref2.name;
if (this.inGenerator && name === "yield") {
this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator");
}
if (this.inAsync && name === "await") {
this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function");
}
if (this.currentThisScope().inClassFieldInit && name === "arguments") {
this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer");
}
if (this.inClassStaticBlock && (name === "arguments" || name === "await")) {
this.raise(start, "Cannot use " + name + " in class static initialization block");
}
if (this.keywords.test(name)) {
this.raise(start, "Unexpected keyword '" + name + "'");
}
if (this.options.ecmaVersion < 6 && this.input.slice(start, end).indexOf("\\") !== -1) {
return;
}
var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
if (re.test(name)) {
if (!this.inAsync && name === "await") {
this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function");
}
this.raiseRecoverable(start, "The keyword '" + name + "' is reserved");
}
};
pp$5.parseIdent = function(liberal) {
var node = this.parseIdentNode();
this.next(!!liberal);
this.finishNode(node, "Identifier");
if (!liberal) {
this.checkUnreserved(node);
if (node.name === "await" && !this.awaitIdentPos) {
this.awaitIdentPos = node.start;
}
}
return node;
};
pp$5.parseIdentNode = function() {
var node = this.startNode();
if (this.type === types$1.name) {
node.name = this.value;
} else if (this.type.keyword) {
node.name = this.type.keyword;
if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
this.context.pop();
}
this.type = types$1.name;
} else {
this.unexpected();
}
return node;
};
pp$5.parsePrivateIdent = function() {
var node = this.startNode();
if (this.type === types$1.privateId) {
node.name = this.value;
} else {
this.unexpected();
}
this.next();
this.finishNode(node, "PrivateIdentifier");
if (this.options.checkPrivateFields) {
if (this.privateNameStack.length === 0) {
this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class");
} else {
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
}
}
return node;
};
pp$5.parseYield = function(forInit) {
if (!this.yieldPos) {
this.yieldPos = this.start;
}
var node = this.startNode();
this.next();
if (this.type === types$1.semi || this.canInsertSemicolon() || this.type !== types$1.star && !this.type.startsExpr) {
node.delegate = false;
node.argument = null;
} else {
node.delegate = this.eat(types$1.star);
node.argument = this.parseMaybeAssign(forInit);
}
return this.finishNode(node, "YieldExpression");
};
pp$5.parseAwait = function(forInit) {
if (!this.awaitPos) {
this.awaitPos = this.start;
}
var node = this.startNode();
this.next();
node.argument = this.parseMaybeUnary(null, true, false, forInit);
return this.finishNode(node, "AwaitExpression");
};
var pp$4 = Parser.prototype;
pp$4.raise = function(pos, message) {
var loc = getLineInfo(this.input, pos);
message += " (" + loc.line + ":" + loc.column + ")";
var err = new SyntaxError(message);
err.pos = pos;
err.loc = loc;
err.raisedAt = this.pos;
throw err;
};
pp$4.raiseRecoverable = pp$4.raise;
pp$4.curPosition = function() {
if (this.options.locations) {
return new Position(this.curLine, this.pos - this.lineStart);
}
};
var pp$3 = Parser.prototype;
var Scope = /* @__PURE__ */ __name(function Scope2(flags) {
this.flags = flags;
this.var = [];
this.lexical = [];
this.functions = [];
this.inClassFieldInit = false;
}, "Scope");
pp$3.enterScope = function(flags) {
this.scopeStack.push(new Scope(flags));
};
pp$3.exitScope = function() {
this.scopeStack.pop();
};
pp$3.treatFunctionsAsVarInScope = function(scope) {
return scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_TOP;
};
pp$3.declareName = function(name, bindingType, pos) {
var redeclared = false;
if (bindingType === BIND_LEXICAL) {
var scope = this.currentScope();
redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
scope.lexical.push(name);
if (this.inModule && scope.flags & SCOPE_TOP) {
delete this.undefinedExports[name];
}
} else if (bindingType === BIND_SIMPLE_CATCH) {
var scope$1 = this.currentScope();
scope$1.lexical.push(name);
} else if (bindingType === BIND_FUNCTION) {
var scope$2 = this.currentScope();
if (this.treatFunctionsAsVar) {
redeclared = scope$2.lexical.indexOf(name) > -1;
} else {
redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1;
}
scope$2.functions.push(name);
} else {
for (var i = this.scopeStack.length - 1; i >= 0; --i) {
var scope$3 = this.scopeStack[i];
if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
redeclared = true;
break;
}
scope$3.var.push(name);
if (this.inModule && scope$3.flags & SCOPE_TOP) {
delete this.undefinedExports[name];
}
if (scope$3.flags & SCOPE_VAR) {
break;
}
}
}
if (redeclared) {
this.raiseRecoverable(pos, "Identifier '" + name + "' has already been declared");
}
};
pp$3.checkLocalExport = function(id) {
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1) {
this.undefinedExports[id.name] = id;
}
};
pp$3.currentScope = function() {
return this.scopeStack[this.scopeStack.length - 1];
};
pp$3.currentVarScope = function() {
for (var i = this.scopeStack.length - 1; ; i--) {
var scope = this.scopeStack[i];
if (scope.flags & SCOPE_VAR) {
return scope;
}
}
};
pp$3.currentThisScope = function() {
for (var i = this.scopeStack.length - 1; ; i--) {
var scope = this.scopeStack[i];
if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) {
return scope;
}
}
};
var Node = /* @__PURE__ */ __name(function Node2(parser, pos, loc) {
this.type = "";
this.start = pos;
this.end = 0;
if (parser.options.locations) {
this.loc = new SourceLocation(parser, loc);
}
if (parser.options.directSourceFile) {
this.sourceFile = parser.options.directSourceFile;
}
if (parser.options.ranges) {
this.range = [pos, 0];
}
}, "Node");
var pp$2 = Parser.prototype;
pp$2.startNode = function() {
return new Node(this, this.start, this.startLoc);
};
pp$2.startNodeAt = function(pos, loc) {
return new Node(this, pos, loc);
};
function finishNodeAt(node, type, pos, loc) {
node.type = type;
node.end = pos;
if (this.options.locations) {
node.loc.end = loc;
}
if (this.options.ranges) {
node.range[1] = pos;
}
return node;
}
__name(finishNodeAt, "finishNodeAt");
pp$2.finishNode = function(node, type) {
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc);
};
pp$2.finishNodeAt = function(node, type, pos, loc) {
return finishNodeAt.call(this, node, type, pos, loc);
};
pp$2.copyNode = function(node) {
var newNode = new Node(this, node.start, this.startLoc);
for (var prop in node) {
newNode[prop] = node[prop];
}
return newNode;
};
var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
var ecma11BinaryProperties = ecma10BinaryProperties;
var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict";
var ecma13BinaryProperties = ecma12BinaryProperties;
var ecma14BinaryProperties = ecma13BinaryProperties;
var unicodeBinaryProperties = {
9: ecma9BinaryProperties,
10: ecma10BinaryProperties,
11: ecma11BinaryProperties,
12: ecma12BinaryProperties,
13: ecma13BinaryProperties,
14: ecma14BinaryProperties
};
var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
var unicodeBinaryPropertiesOfStrings = {
9: "",
10: "",
11: "",
12: "",
13: "",
14: ecma14BinaryPropertiesOfStrings
};
var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
var ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";
var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd";
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
var unicodeScriptValues = {
9: ecma9ScriptValues,
10: ecma10ScriptValues,
11: ecma11ScriptValues,
12: ecma12ScriptValues,
13: ecma13ScriptValues,
14: ecma14ScriptValues
};
var data =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment